activities_add_update.html.tpl 3.0 KB

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