students_add_update.html.tpl 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {{ define "content" }}
  2. <div class="container">
  3. {{$update := .Options.Get "update"}}
  4. {{if $update}}
  5. {{template "breadcrumb" toSlice "Studenti" (all "Student") (.Data|string) (.Data.ID|show "Student") "Aggiorna" "current"}}
  6. {{else}}
  7. {{template "breadcrumb" toSlice "Studenti" (all "Student") "Aggiungi" "current"}}
  8. {{end}}
  9. {{template "add_update_header" dict "update" $update "addTitle" "Crea nuovo studente" "updateTitle" (printf "Aggiorna studente %s" (.Data|string))}}
  10. {{$form := "form_students_add_update"}}
  11. <form
  12. class="needs-validation"
  13. action="{{if $update}}{{.Data.ID|update "Student"}}{{else}}{{create "Student"}}{{end}}"
  14. method="POST"
  15. role="form"
  16. id={{$form}}>
  17. {{$options := ` { name: "Name",id: "student_name",label: "Nome",placeholder: "Nome",type: "text",required: "true"} `}}
  18. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Name") "update" $update}}
  19. {{$options := ` { name: "Surname",id: "student_surname",label: "Cognome",placeholder: "Cognome",type: "text",required: "true"} `}}
  20. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Surname") "update" $update}}
  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: "tutor_id", id: "tutor_id", label: "Docente tutor", title: "Seleziona il docente tutor"}`}}
  24. {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllTeachers") "selected" (.Data|field "SelectedTeacher") "update" $update "form" $form}}
  25. {{$options := ` { name: "Handicap",id: "student_handicap",label: "Handicap (L. 104/92)",formClass: "form-group form-check" } `}}
  26. {{template "checkbox" dict "options" ($options|yaml) "value" (.Data|field "Handicap") "update" $update}}
  27. {{$options := ` { name: "DSA",id: "student_dsa",label: "DSA (L. 170/10)",formClass: "form-group form-check" } `}}
  28. {{template "checkbox" dict "options" ($options|yaml) "value" (.Data|field "DSA") "update" $update}}
  29. {{$options := ` { name: "BES",id: "student_bes",label: "BES (L. 170/10)",formClass: "form-group form-check" } `}}
  30. {{template "checkbox" dict "options" ($options|yaml) "value" (.Data|field "BES") "update" $update}}
  31. {{ $options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Student"} ` }}
  32. {{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
  33. </form>
  34. </div>
  35. {{ end }}