groups_add_update.html.tpl 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. {{ define "content" }}
  2. <div class="container">
  3. {{$update := .Options.Get "update"}}
  4. {{if $update}}
  5. {{template "breadcrumb" toSlice "Gruppi" (all "Group") (.Data|string) (.Data.ID|show "Group") "Aggiorna" "current"}}
  6. {{else}}
  7. {{template "breadcrumb" toSlice "Gruppi" (all "Group") "Aggiungi" "current"}}
  8. {{end}}
  9. {{template "add_update_header" dict "update" $update "addTitle" "Crea nuovo gruppo" "updateTitle" (printf "Aggiorna gruppo %s" (.Data|string))}}
  10. {{$form := "form_groups_add_update"}}
  11. <form
  12. class="needs-validation"
  13. action="{{if $update}}{{.Data.ID|update "Group"}}{{else}}{{create "Group"}}{{end}}"
  14. method="POST"
  15. role="form"
  16. id={{$form}}>
  17. {{$options := ` { name: "Name",id: "group_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: "Query",id: "group_query",label: "Stringa di popolamento",placeholder: "surname:*",type: "text"} `}}
  20. {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Query") "update" $update}}
  21. {{$options := ` { name: "teacher_ids", id: "teacher_ids", label: "Docenti", title: "Seleziona i docenti", multiple: "true"}`}}
  22. {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllTeachers") "selected" (.Data|field "SelectedTeacher") "update" $update "form" $form}}
  23. {{ $options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Group"} ` }}
  24. {{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
  25. </form>
  26. </div>
  27. {{ end }}