departments_add_update.html.tpl 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. {{ define "content" }}
  2. <div class="container">
  3. {{$update := .Options.Get "update"}}
  4. {{if $update}}
  5. {{template "breadcrumb" toSlice "Dipartimenti" (all "Department") (.Data|string) (.Data.ID|show "Department") "Aggiorna" "current"}}
  6. {{else}}
  7. {{template "breadcrumb" toSlice "Dipartimenti" (all "Department") "Aggiungi" "current"}}
  8. {{end}}
  9. {{template "add_update_header" dict "update" $update "addTitle" "Crea nuovo dipartimento" "updateTitle" (printf "Aggiorna dipartimento %s" (.Data|string))}}
  10. {{$form := "form_departments_add_update"}}
  11. <form
  12. class="needs-validation"
  13. action="{{if $update}}{{.Data.ID|update "Department"}}{{else}}{{create "Department"}}{{end}}"
  14. method="POST"
  15. role="form"
  16. id={{$form}}>
  17. {{$options := ` { name: "Name",id: "department_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: "coordinator_id", id: "coordinator_id", label: "Coordinatore", title: "Seleziona il coordinatore"}`}}
  20. {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllTeachers") "selected" (.Data|field "SelectedCoordinator") "update" $update "form" $form}}
  21. {{ $options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Department"} ` }}
  22. {{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
  23. </form>
  24. </div>
  25. {{ end }}