oef/templates/schools_add_update.html.tpl

60 lines
2.2 KiB
Smarty
Raw Normal View History

2019-12-03 12:21:28 +01:00
{{ define "content" }}
<div class="container">
2019-12-04 14:10:09 +01:00
{{$isSubscriber := .Claims|isSubscriber}}
2019-12-03 12:21:28 +01:00
{{$update := .Options.Get "update"}}
2019-12-04 14:10:09 +01:00
{{if not $isSubscriber}}
2019-12-03 12:21:28 +01:00
2019-12-04 14:10:09 +01:00
{{if $update}}
2019-12-03 15:24:01 +01:00
{{template "breadcrumb" toSlice "Scuole" (all "School") (.Data|string) (.Data.ID|show "School") "Aggiorna" "current"}}
2019-12-03 12:21:28 +01:00
{{else}}
2019-12-03 15:24:01 +01:00
{{template "breadcrumb" toSlice "Scuole" (all "School") "Aggiungi" "current"}}
2019-12-03 12:21:28 +01:00
{{end}}
2019-12-04 14:10:09 +01:00
{{end}}
{{if $isSubscriber}}
{{template "add_update_header" dict "update" $update "addTitle" "Iscrivi scuola" "updateTitle" (printf "Aggiorna scuola %s" (.Data|string))}}
{{else}}
2019-12-03 12:21:28 +01:00
{{template "add_update_header" dict "update" $update "addTitle" "Crea nuova scuola" "updateTitle" (printf "Aggiorna scuola %s" (.Data|string))}}
2019-12-04 14:10:09 +01:00
{{end}}
2019-12-03 12:21:28 +01:00
{{$form := "form_add_update"}}
<form
class="needs-validation"
action="{{if $update}}{{.Data.ID|update "School"}}{{else}}{{create "School"}}{{end}}"
method="POST"
role="form"
id={{$form}}>
{{$options := ` { name: "Name",id: "school_name",label: "Denominazione dell'istituto",placeholder: "Inserire la denominazione",type: "text",required: "true"} `}}
{{template "input" dict "options" ($options|yaml) "value" (.Data|field "Name") "update" $update}}
{{$options := `
name: "Code"
id: "school_code"
label: "Codice meccanografico"
placeholder: "Inserire il codice meccanografico"
type: "text"
inputClass: "form-control uppercase"
required: "true"
`}}
{{template "input" dict "options" ($options|yaml) "value" (.Data|field "Code") "update" $update}}
2019-12-03 15:24:01 +01:00
{{$options := ` { name: "Email",id: "school_email",label: "Indirizzo email",placeholder: "Inserire l'indirizzo di posta istituzionale",type: "email",required: "true"} `}}
2019-12-03 12:21:28 +01:00
{{template "input" dict "options" ($options|yaml) "value" (.Data|field "Email") "update" $update}}
2019-12-04 14:10:09 +01:00
{{if .Claims|isSubscriber}}
2019-12-04 12:20:34 +01:00
{{$options := ` { saveTitle: "Invia iscrizione", model: "School" } `}}
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
{{else}}
2019-12-03 12:21:28 +01:00
{{$options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "School" } `}}
2019-12-04 12:20:34 +01:00
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
{{end}}
2019-12-03 12:21:28 +01:00
</form>
</div>
{{ end }}