activities_add_update.html.tpl 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {{ define "content" }}
  2. <div class="container">
  3. {{$update := .Options.Get "update"}}
  4. {{if $update}}
  5. {{template "breadcrumb" toSlice "Attività" (all "Activity") (.Data|string) (.Data.ID|show "Activity") "Aggiorna" "current"}}
  6. {{else}}
  7. {{template "breadcrumb" toSlice "Attività" (all "Activity") "Aggiungi" "current"}}
  8. {{end}}
  9. {{$updateTitle := ""}}
  10. {{if $update}}{{$updateTitle = (printf "Aggiorna attività %s" (.Data|string))}}{{end}}
  11. {{template "add_update_header" dict "update" $update "addTitle" "Crea nuova attività" "updateTitle" $updateTitle}}
  12. {{$form := "form_activities_add_update"}}
  13. <form
  14. class="needs-validation"
  15. action="{{if $update}}{{.Data.ID|update "Activity"}}{{else}}{{create "Activity"}}{{end}}"
  16. method="POST"
  17. role="form"
  18. id={{$form}}>
  19. {{$options := ` { name: "subject_id", id: "subject_id", label: "Materia", title: "Seleziona la materia"}`}}
  20. {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllSubjects") "selected" (.Data|field "SelectedSubject") "update" $update "form" $form}}
  21. {{$options := ` { name: "class_id", id: "class_id", label: "Classe", title: "Seleziona la classe"}`}}
  22. {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllClasses") "selected" (.Data|field "SelectedClass") "update" $update "form" $form}}
  23. {{$options := ` { name: "teacher_id", id: "teacher_id", label: "Docente", title: "Seleziona il docente"}`}}
  24. {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllTeachers") "selected" (.Data|field "SelectedTeacher") "update" $update "form" $form}}
  25. {{$options := ` { name: "supply_teacher_id", id: "supply_teacher_id", label: "Docente supplente", title: "Seleziona il docente"}`}}
  26. {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllTeachers") "selected" (.Data|field "SelectedSupplyTeacher") "update" $update "form" $form}}
  27. {{$options := ` { name: "student_id", id: "student_id", label: "Studente", title: "Seleziona lo studente"}`}}
  28. {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllStudents") "selected" (.Data|field "SelectedStudent") "update" $update "form" $form}}
  29. {{$options := ` { name: "Hours",id: "hours",label: "Numero di ore",type: "number",required: "true"} `}}
  30. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Hours") "update" $update}}
  31. {{$options := `
  32. name: "GroupActivity"
  33. id: "group_activity"
  34. label: "Attività di gruppo"
  35. formClass: "form-group form-check"
  36. help: "Spuntare la casella sopra nel caso di attività che coinvolgono più studenti contemporaneamente."
  37. `}}
  38. {{template "checkbox" dict "options" ($options|yaml) "value" (.Data|field "GroupActivity") "update" $update}}
  39. {{$options := `
  40. name: "group_activity_hours"
  41. id: "group_activity_hours"
  42. label: "Numero di ore dell'attività di gruppo"
  43. type: "number"
  44. help: "Indicare il numero totale di ore che il docente spende nell'attività di gruppo."
  45. `}}
  46. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Hours") "update" $update}}
  47. {{$options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Activity"} ` }}
  48. {{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
  49. </form>
  50. </div>
  51. {{ end }}