{{ define "content" }} {{$isAdmin := .Claims|isAdmin}} {{$isSchool := .Claims|isSchool}}
{{$update := .Options.Get "update"}} {{if $update}} {{template "breadcrumb" toSlice "Participanti" (all "Participant") (.Data|string) (.Data.ID|show "Participant") "Aggiorna" "current"}} {{else}} {{template "breadcrumb" toSlice "Participanti" (all "Participant") "Aggiungi" "current"}} {{end}} {{template "add_update_header" dict "update" $update "addTitle" "Crea nuovo partecipante" "updateTitle" (printf "Aggiorna partecipante %s" (.Data|string))}} {{$form := "form_add_update"}}
{{$options := ` { name: "Firstname",id: "participant_firstname",label: "Nome del partecipante",placeholder: "Inserire il nome del partecipante",type: "text",required: "true"} `}} {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Firstname") "update" $update}}
{{$options := ` { name: "Lastname",id: "participant_lastname",label: "Cognome del partecipante",placeholder: "Inserire il cognome del partecipante",type: "text",required: "true"} `}} {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Lastname") "update" $update}}
{{if not $update}} {{$options := ` name: "FiscalCode" id: "participant_fiscalcode" label: "Codice fiscale del partecipante" placeholder: "Inserire il codice fiscale" type: "text" inputClass: "form-control uppercase" required: "true" `}} {{template "input" dict "options" ($options|yaml) "value" (.Data|field "FiscalCode") "update" $update}} {{end}}
{{$options := ` { name: "Year",id: "participant_year",label: "Anno di corso",placeholder: "Inserire l'anno di corso",type: "number",required: "true"} `}} {{template "input" dict "options" ($options|yaml) "value" (.Data|field "Year") "update" $update}}
{{$options := ` { name: "StudyField",id: "participant_study_field",label: "Indirizzo del corso di studi",placeholder: "Inserire l'indirizzo frequentato",type: "text",required: "true"} `}} {{template "input" dict "options" ($options|yaml) "value" (.Data|field "StudyField") "update" $update}}
{{$options := ` name: "category_id" id: "category_id" label: "Categoria del partecipante" title: "Seleziona la categoria" required: "true" `}} {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllCategories") "selected" (.Data|field "SelectedCategory") "update" $update "form" $form}} {{if $isAdmin}} {{$options := ` { name: "school_id", id: "school_id", label: "Scuola del partecipante", title: "Seleziona la scuola"}`}} {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllSchools") "selected" (.Data|field "SelectedSchool") "update" $update "form" $form}} {{$options := ` name: "contest_ids" id: "contest_ids" label: "Gare a cui il partecipante รจ iscritto" title: "Seleziona le gare" multiple: "true" `}} {{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllContests") "selected" (.Data|field "SelectedContest") "update" $update "form" $form}} {{end}} {{$options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Participant" } `}} {{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
{{ end }}