|
@@ -2,171 +2,61 @@
|
|
|
|
|
|
<div class="container">
|
|
|
|
|
|
- {{if .Options.Get "update"}}
|
|
|
- <nav aria-label="breadcrumb">
|
|
|
- <ol class="breadcrumb">
|
|
|
- <li class="breadcrumb-item"><a href="/activities?{{query "tpl_layout" "base" "tpl_content" "activities"}}">Attività</a></li>
|
|
|
- <li class="breadcrumb-item active"><a href="#">Aggiorna l'attività</a></li>
|
|
|
- </ol>
|
|
|
- </nav>
|
|
|
- {{else}}
|
|
|
- <nav aria-label="breadcrumb">
|
|
|
- <ol class="breadcrumb">
|
|
|
- <li class="breadcrumb-item"><a href="/activities?{{query "tpl_layout" "base" "tpl_content" "activities"}}">Attività</a></li>
|
|
|
- <li class="breadcrumb-item active"><a href="#">Aggiungi</a></li>
|
|
|
- </ol>
|
|
|
- </nav>
|
|
|
- {{end}}
|
|
|
+ {{$update := .Options.Get "update"}}
|
|
|
|
|
|
- {{if .Options.Get "update"}}
|
|
|
- <div class="karmen-info-header">
|
|
|
- <div class="row">
|
|
|
- <div class="col-md-8">
|
|
|
- <h1>Aggiorna l'attività</h1>
|
|
|
- </div>
|
|
|
- <div class="col-md-4">
|
|
|
- <a href="/activities/{{.Data.Activity.ID}}/delete"
|
|
|
- data-url="/activities/{{.Data.Activity.ID}}/delete"
|
|
|
- class="btn btn-danger karmen-ajax-delete float-right">
|
|
|
- <span class="fa fa-trash" aria-hidden="true"></span>
|
|
|
- Elimina
|
|
|
- </a>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
+ {{if $update}}
|
|
|
+ {{template "breadcrumb" toSlice "Attività" (all "Activity") (.Data|string) (.Data.ID|show "Activity") "Aggiorna" "current"}}
|
|
|
{{else}}
|
|
|
- <h1 class="karmen-info-header">Crea una nuova attività</h1>
|
|
|
+ {{template "breadcrumb" toSlice "Attività" (all "Activity") "Aggiungi" "current"}}
|
|
|
{{end}}
|
|
|
-
|
|
|
- {{if .Options.Get "update"}}
|
|
|
- <form id="form_activities_add_update" action="/activities/{{.Data.Activity.ID}}/update" method="POST" role="form" class="needs-validation">
|
|
|
- {{else}}
|
|
|
- <form id="form_activities_add_update" action="/activities/add/" method="POST" role="form" class="needs-validation">
|
|
|
- {{end}}
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="subject_id">Materia</label>
|
|
|
- <select name="subject_id" class="form-control selectpicker" id="subject_id" placeholder="Materia" data-live-search="true" form="form_activities_add_update" title="Seleziona il nome della materia" data-dropup-auto="false" required>
|
|
|
- <option value="0"></option>
|
|
|
- {{range $subject := .Data.AllSubjects}}
|
|
|
- {{if $.Options.Get "update"}}
|
|
|
- <option
|
|
|
- value="{{$subject.ID}}"
|
|
|
- {{index $.Data.SelectedSubject $subject.ID}}>{{$subject.Name}}
|
|
|
- </option>
|
|
|
- {{else}}
|
|
|
- <option value="{{$subject.ID}}">{{$subject.Name}}</option>
|
|
|
- {{end}}
|
|
|
- {{end}}
|
|
|
- </select>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="class_id">Classe</label>
|
|
|
- <select name="class_id" class="form-control selectpicker" id="class_id" placeholder="Classe" data-live-search="true" form="form_activities_add_update" title="Seleziona la classe" data-dropup-auto="false">
|
|
|
- <option value="0"></option>
|
|
|
- {{range $class := .Data.AllClasses}}
|
|
|
- {{if $.Options.Get "update"}}
|
|
|
- <option
|
|
|
- value="{{$class.ID}}"
|
|
|
- {{index $.Data.SelectedClass $class.ID}}>{{$class.Name}}
|
|
|
- </option>
|
|
|
- {{else}}
|
|
|
- <option value="{{$class.ID}}">{{$class.Name}}</option>
|
|
|
- {{end}}
|
|
|
- {{end}}
|
|
|
- </select>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="student_id">Studente</label>
|
|
|
- <select name="student_id" class="form-control selectpicker" id="student_id" placeholder="Docente" data-live-search="true" form="form_activities_add_update" title="Seleziona il nome del docente" data-dropup-auto="false">
|
|
|
- <option value="0"></option>
|
|
|
- {{range $student := .Data.AllStudents}}
|
|
|
- {{if $.Options.Get "update"}}
|
|
|
- <option
|
|
|
- value="{{$student.ID}}"
|
|
|
- {{index $.Data.SelectedStudent $student.ID}}>{{$student.Name}} {{$student.Surname}}
|
|
|
- </option>
|
|
|
- {{else}}
|
|
|
- <option value="{{$student.ID}}">{{$student.Name}} {{$student.Surname}}</option>
|
|
|
- {{end}}
|
|
|
- {{end}}
|
|
|
- </select>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="teacher_id">Docente</label>
|
|
|
- <select name="teacher_id" class="form-control selectpicker" id="teacher_id" placeholder="Docente" data-live-search="true" form="form_activities_add_update" title="Seleziona il nome del docente" data-dropup-auto="false">
|
|
|
- <option value="0"></option>
|
|
|
- {{range $teacher := .Data.AllTeachers}}
|
|
|
- {{if $.Options.Get "update"}}
|
|
|
- <option
|
|
|
- value="{{$teacher.ID}}"
|
|
|
- {{index $.Data.SelectedTeacher $teacher.ID}}>{{$teacher.Name}} {{$teacher.Surname}}
|
|
|
- </option>
|
|
|
- {{else}}
|
|
|
- <option value="{{$teacher.ID}}">{{$teacher.Name}} {{$teacher.Surname}}</option>
|
|
|
- {{end}}
|
|
|
- {{end}}
|
|
|
- </select>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="supply_teacher_id">Docente supplente</label>
|
|
|
- <select name="supply_teacher_id" class="form-control selectpicker" id="supply_teacher_id" placeholder="Docente supplente" data-live-search="true" form="form_activities_add_update" title="Seleziona il nome del docente supplente" data-dropup-auto="false">
|
|
|
- <option value="0"></option>
|
|
|
- {{range $supplyTeacher := .Data.AllTeachers}}
|
|
|
- {{if $.Options.Get "update"}}
|
|
|
- <option
|
|
|
- value="{{$supplyTeacher.ID}}"
|
|
|
- {{index $.Data.SelectedSupplyTeacher $supplyTeacher.ID}}>{{$supplyTeacher.Name}} {{$supplyTeacher.Surname}}
|
|
|
- </option>
|
|
|
- {{else}}
|
|
|
- <option value="{{$supplyTeacher.ID}}">{{$supplyTeacher.Name}} {{$supplyTeacher.Surname}}</option>
|
|
|
- {{end}}
|
|
|
- {{end}}
|
|
|
- </select>
|
|
|
- </div>
|
|
|
-
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="hours">Numero di ore</label>
|
|
|
- <input class="form-control" min="0" type="number" name="hours" id="hours" {{if .Options.Get "update"}}value="{{.Data.Activity.Hours}}"{{end}} required>
|
|
|
- </div>
|
|
|
-
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <div class="form-check">
|
|
|
- <input type="checkbox" name="GroupActivity" class="form-check-input" id="activity_group_activity" {{if .Options.Get "update"}}{{if .Data.Activity.GroupActivity}}checked{{end}}{{end}}>
|
|
|
- <label class="form-check-label" for="activity_group_activity">Attività di gruppo</label>
|
|
|
- <small id="activity_group_help_box" class="form-text text-muted">
|
|
|
- Spuntare la casella sopra nel caso di attività che coinvolgono più studenti contemporaneamente.
|
|
|
- </small>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label class="control-label" for="group_activity_hours">Numero di ore dell'attività di gruppo</label>
|
|
|
- <input class="form-control" min="0" type="number" name="group_activity_hours" id="group_activity_hours" {{if .Options.Get "update"}}value="{{.Data.Activity.GroupActivityHours}}"{{end}}>
|
|
|
- <small id="activity_group_hours_help_box" class="form-text text-muted">
|
|
|
- Indicare il numero totale di ore che il docente spende nell'attività di gruppo.
|
|
|
- </small>
|
|
|
- </div>
|
|
|
-
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <button type="submit" class="btn btn-primary">Salva</button>
|
|
|
- {{if .Options.Get "update"}}
|
|
|
- <a href="/activities/{{.Data.Activity.ID}}?{{query "tpl_layout" "base" "tpl_content" "activities_show"}}" class="btn btn-default">Annulla</a>
|
|
|
- {{else}}
|
|
|
- <a href="/activities?{{query "tpl_layout" "base" "tpl_content" "activities"}}" class="btn btn-default">Annulla</a>
|
|
|
- {{end}}
|
|
|
- </div>
|
|
|
-
|
|
|
+
|
|
|
+ {{template "add_update_header" dict "update" $update "addTitle" "Crea nuova attività" "updateTitle" (printf "Aggiorna attività %s" (.Data|string))}}
|
|
|
+
|
|
|
+ {{$form := "form_activities_add_update"}}
|
|
|
+ <form
|
|
|
+ class="needs-validation"
|
|
|
+ action="{{if $update}}{{.Data.ID|update "Activity"}}{{else}}{{create "Activity"}}{{end}}"
|
|
|
+ method="POST"
|
|
|
+ role="form"
|
|
|
+ id={{$form}}>
|
|
|
+
|
|
|
+ {{$options := ` { name: "subject_id", id: "subject_id", label: "Materia", title: "Seleziona la materia"}`}}
|
|
|
+ {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllSubjects") "selected" (.Data|field "SelectedSubject") "update" $update "form" $form}}
|
|
|
+
|
|
|
+ {{$options := ` { name: "class_id", id: "class_id", label: "Classe", title: "Seleziona la classe"}`}}
|
|
|
+ {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllClasses") "selected" (.Data|field "SelectedClass") "update" $update "form" $form}}
|
|
|
+
|
|
|
+ {{$options := ` { name: "teacher_id", id: "teacher_id", label: "Docente", title: "Seleziona il docente"}`}}
|
|
|
+ {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllTeachers") "selected" (.Data|field "SelectedTeacher") "update" $update "form" $form}}
|
|
|
+
|
|
|
+ {{$options := ` { name: "supply_teacher_id", id: "supply_teacher_id", label: "Docente supplente", title: "Seleziona il docente"}`}}
|
|
|
+ {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllTeachers") "selected" (.Data|field "SelectedSupplyTeacher") "update" $update "form" $form}}
|
|
|
+
|
|
|
+ {{$options := ` { name: "Hours",id: "hours",label: "Numero di ore",type: "number",required: "true"} `}}
|
|
|
+ {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Hours") "update" $update}}
|
|
|
+
|
|
|
+ {{$options := `
|
|
|
+ name: "GroupActivity"
|
|
|
+ id: "group_activity"
|
|
|
+ label: "Attività di gruppo"
|
|
|
+ formClass: "form-group form-check"
|
|
|
+ help: "Spuntare la casella sopra nel caso di attività che coinvolgono più studenti contemporaneamente."
|
|
|
+ `}}
|
|
|
+ {{template "checkbox" dict "options" ($options|yaml) "value" (.Data|field "GroupActivity") "update" $update}}
|
|
|
+
|
|
|
+ {{$options := `
|
|
|
+ name: "group_activity_hours"
|
|
|
+ id: "group_activity_hours"
|
|
|
+ label: "Numero di ore dell'attività di gruppo"
|
|
|
+ type: "number"
|
|
|
+ help: "Indicare il numero totale di ore che il docente spende nell'attività di gruppo."
|
|
|
+ `}}
|
|
|
+ {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Hours") "update" $update}}
|
|
|
+
|
|
|
+ {{$options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Activity"} ` }}
|
|
|
+ {{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
|
|
|
</form>
|
|
|
-
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
{{ end }}
|