2019-11-14 12:55:22 +01:00
{ { define "content" } }
<div class="container">
{ { $update : = . Options . Get "update" } }
{ { if $update } }
2019-12-13 08:32:20 +01:00
{ { template "breadcrumb" toSlice "Gare" ( all "Contest" ) ( . Data | string ) ( . Data . ID | show "Contest" ) "Aggiorna" "current" } }
2019-11-14 12:55:22 +01:00
{ { else } }
2019-12-13 08:32:20 +01:00
{ { template "breadcrumb" toSlice "Gare" ( all "Contest" ) "Aggiungi" "current" } }
2019-11-14 12:55:22 +01:00
{ { end } }
2019-12-13 08:32:20 +01:00
{ { template "add_update_header" dict "update" $update "addTitle" "Crea nuova gara" "updateTitle" ( printf "Aggiorna gara %s" ( . Data | string ) ) } }
2019-11-14 12:55:22 +01:00
{ { $form : = "form_add_update" } }
<form
class="needs-validation"
action=" { { if $update } } { { . Data . ID | update "Contest" } } { { else } } { { create "Contest" } } { { end } } "
method="POST"
role="form"
id= { { $form } } >
{ { $options : = ` { name : "Name" , id : "contest_name" , label : "Nome della gara" , placeholder : "Inserire il nome della gara" , type : "text" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "Name" ) "update" $update } }
2020-02-05 14:12:08 +01:00
{ { $options : = ` { name : "Description" , id : "contest_description" , label : "Descrizione della gara" , placeholder : "Inserire una breve descrizione della gara" , type : "text" , required : "true" } ` } }
{ { template "textarea" dict "options" ( $options | yaml ) "value" ( . Data | field "Description" ) "update" $update } }
2019-11-14 12:55:22 +01:00
<div class="form-row">
<div class="col">
{ { $options : = ` { name : "Date" , id : "contest_date" , label : "La gara si svolgerà il giorno" , type : "date" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "Date" | convertDate ) "update" $update } }
</div>
<div class="col">
{ { $options : = ` { name : "StartTime" , id : "contest_start_time" , label : "Dalle ore" , type : "time" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "StartTime" | convertTime ) "update" $update } }
</div>
<div class="col">
{ { $options : = ` { name : "EndTime" , id : "contest_end_time" , label : "Alle ore" , type : "time" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "EndTime" | convertTime ) "update" $update } }
</div>
2019-12-19 12:12:56 +01:00
<div class="col">
{ { $options : = ` { name : "Duration" , id : "contest_duration" , label : "Durata" , type : "number" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "Duration" ) "update" $update } }
</div>
2019-11-14 12:55:22 +01:00
</div>
2019-12-13 08:32:20 +01:00
<div class="form-row">
<div class="col">
{ { $options : = ` { name : "NumQuestions" , id : "contest_num_questions" , label : "Numero totale delle domande presenti nella gara" , placeholder : "Inserire il numero delle domande" , type : "number" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "NumQuestions" ) "update" $update } }
</div>
<div class="col">
{ { $options : = ` { name : "NumAnswersPerQuestion" , id : "contest_num_answers_per_question" , label : "Numero delle risposte per domanda" , placeholder : "Inserire il numero delle risposte per domanda" , type : "number" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "NumAnswersPerQuestion" ) "update" $update } }
</div>
</div>
2020-12-26 15:29:11 +01:00
{ { if $update } }
<div class="form-row">
<div class="col">
{ { $options : = ` { name : "ResetStartTime" , id : "contest_reset_start_time" , label : "Resetta la prima eventuale visualizzazione dei partecipanti" , formClass : "form-check form-check-inline" } ` } }
{ { template "checkbox" dict "options" ( $options | yaml ) "value" ( . Data | field "ResetStartTime" ) "update" $update } }
</div>
</div>
{ { end } }
2019-12-13 08:32:20 +01:00
2019-11-14 12:55:22 +01:00
{ { $options : = ` { cancelTitle : "Annulla" , saveTitle : "Salva" , model : "Contest" } ` } }
{ { template "submit_cancel_buttons" dict "options" ( $options | yaml ) "id" ( . Data | field "ID" ) "update" $update } }
</form>
</div>
{ { end } }