teachers_add_update.html.tpl 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {{ define "content" }}
  2. <div class="container">
  3. {{$update := .Options.Get "update"}}
  4. {{if $update}}
  5. {{template "breadcrumb" toSlice "Docenti" (all "Teacher") (.Data|string) (.Data.ID|show "Teacher") "Aggiorna" "current"}}
  6. {{else}}
  7. {{template "breadcrumb" toSlice "Docenti" (all "Teacher") "Aggiungi" "current"}}
  8. {{end}}
  9. {{template "add_update_header" dict "update" $update "addTitle" "Crea nuovo docente" "updateTitle" (printf "Aggiorna docente %s" (.Data|string))}}
  10. <form
  11. class="needs-validation"
  12. action="{{if $update}}{{.Data.ID|update "Teacher"}}{{else}}{{create "Teacher"}}{{end}}" method="POST" role="form">
  13. {{$options := ` { name: "Name",id: "teacher_name",label: "Nome",placeholder: "Nome",type: "text" } `}}
  14. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Name") "update" $update}}
  15. {{$options := ` { name: "Surname",id: "teacher_surname",label: "Cognome",placeholder: "Cognome",type: "text" } `}}
  16. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Surname") "update" $update}}
  17. {{$options := ` { name: "Hours",id: "teacher_hours",label: "Numero di ore",placeholder: "",type: "number" } `}}
  18. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Hours") "update" $update}}
  19. {{$options := ` { name: "AltEmail",id: "teacher_altemail",label: "Email alternativa",placeholder: "Inserire indirizzo email",type: "email" } `}}
  20. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "AltEmail") "update" $update}}
  21. <div class="form-row">
  22. <div class="col">
  23. {{$options := ` { name: "Regenerate",id: "teacher_regenerate",label: "Rigenerare/inviare le credenziali",formClass: "form-check form-check-inline" } `}}
  24. {{template "checkbox" dict "options" ($options|yaml) "value" (.Data|field "Regenerate") "update" $update}}
  25. </div>
  26. <div class="col">
  27. {{$options := ` { name: "Exclude",id: "teacher_exclude",label: "Escludere dalle utenze",formClass: "form-check form-check-inline" } `}}
  28. {{template "checkbox" dict "options" ($options|yaml) "value" (.Data|field "Exclude") "update" $update}}
  29. </div>
  30. <div class="col">
  31. {{$options := ` { name: "NotInvited",id: "teacher_not_invited",label: "Escludere dagli inviti",formClass: "form-check form-check-inline" } `}}
  32. {{template "checkbox" dict "options" ($options|yaml) "value" (.Data|field "NotInvited") "update" $update}}
  33. </div>
  34. </div>
  35. <div class="form-row">
  36. <div class="col">
  37. {{$options := ` { name: "DateFrom",id: "teacher_date_from",label: "In servizio dal",type: "date" } `}}
  38. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "DateFrom"|convertDate) "update" $update}}
  39. </div>
  40. <div class="col">
  41. {{$options := ` { name: "DateTo",id: "teacher_date_to",label: "In servizio fino al",type: "date" } `}}
  42. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "DateTo"|convertDate) "update" $update}}
  43. </div>
  44. </div>
  45. {{$options := ` { name: "LdapDNFmt",id: "teacher_ldapfnfmt",label: "Stringa DN per LDAP",placeholder: "cn=%s %s,ou=People,dc=foo,dc=org",type: "text" } `}}
  46. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "LdapDNFmt") "update" $update}}
  47. {{ $options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Teacher"} ` }}
  48. {{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
  49. </form>
  50. </div>
  51. {{ end }}