2019-11-14 15:04:11 +01:00
{ { define "content" } }
<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 } }
</div>
</div>
{ { $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 } }
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 } }