oef/templates/participants_add_update.html.tpl

91 lines
3.6 KiB
Smarty
Raw Normal View History

2019-11-14 15:04:11 +01:00
{{ define "content" }}
2019-12-09 08:27:46 +01:00
{{$isAdmin := .Claims|isAdmin}}
{{$isSchool := .Claims|isSchool}}
2019-11-14 15:04:11 +01:00
<div class="container">
{{$update := .Options.Get "update"}}
{{if $update}}
2019-11-15 10:41:32 +01:00
{{template "breadcrumb" toSlice "Participanti" (all "Participant") (.Data|string) (.Data.ID|show "Participant") "Aggiorna" "current"}}
2019-11-14 15:04:11 +01:00
{{else}}
2019-11-15 10:41:32 +01:00
{{template "breadcrumb" toSlice "Participanti" (all "Participant") "Aggiungi" "current"}}
2019-11-14 15:04:11 +01:00
{{end}}
2019-11-15 10:41:32 +01:00
{{template "add_update_header" dict "update" $update "addTitle" "Crea nuovo partecipante" "updateTitle" (printf "Aggiorna partecipante %s" (.Data|string))}}
2019-11-14 15:04:11 +01:00
{{$form := "form_add_update"}}
<form
class="needs-validation"
action="{{if $update}}{{.Data.ID|update "Participant"}}{{else}}{{create "Participant"}}{{end}}"
method="POST"
role="form"
id={{$form}}>
2019-11-15 10:41:32 +01:00
<div class="form-row">
<div class="col">
{{$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}}
</div>
<div class="col">
{{$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}}
2019-11-15 10:41:32 +01:00
</div>
</div>
{{if not $update}}
2019-12-02 10:48:46 +01:00
{{$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}}
<div class="form-row">
<div class="col">
{{$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}}
</div>
<div class="col">
{{$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}}
</div>
</div>
2019-12-09 08:27:46 +01:00
{{$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}}
2019-12-03 15:24:01 +01:00
{{$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 := `
2019-12-09 08:27:46 +01:00
name: "contest_ids"
id: "contest_ids"
label: "Gare a cui il partecipante è iscritto"
title: "Seleziona le gare"
multiple: "true"
`}}
2019-11-15 10:41:32 +01:00
{{template "select" dict "options" ($options|yaml) "data" (.Data|field "AllContests") "selected" (.Data|field "SelectedContest") "update" $update "form" $form}}
2019-12-09 08:27:46 +01:00
{{end}}
2019-11-14 15:04:11 +01:00
{{$options := ` { cancelTitle: "Annulla", saveTitle: "Salva", model: "Participant" } `}}
{{template "submit_cancel_buttons" dict "options" ($options|yaml) "id" (.Data|field "ID") "update" $update}}
</form>
</div>
{{ end }}