2019-12-03 12:21:28 +01:00
{ { define "content" } }
<div class="container">
2019-12-07 11:44:19 +01:00
{ { $isAdmin : = . Claims | isAdmin } }
2019-12-04 14:10:09 +01:00
{ { $isSubscriber : = . Claims | isSubscriber } }
2019-12-07 11:44:19 +01:00
{ { $isSchool : = . Claims | isSchool } }
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-07 11:44:19 +01:00
{ { if $isSchool } }
{ { template "breadcrumb" toSlice ( . Data | string ) ( . Data . ID | show "School" ) "Aggiorna" "current" } }
{ { else } }
2019-12-03 15:24:01 +01:00
{ { template "breadcrumb" toSlice "Scuole" ( all "School" ) ( . Data | string ) ( . Data . ID | show "School" ) "Aggiorna" "current" } }
2019-12-07 11:44:19 +01:00
{ { end } }
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 } }
2020-02-12 11:14:04 +01:00
{ { template "add_update_header" dict "update" $update "addTitle" "Iscrivi una nuova scuola" "updateTitle" ( printf "Aggiorna scuola %s" ( . Data | string ) ) } }
2019-12-04 14:10:09 +01:00
{ { 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 } } >
2019-12-04 14:53:35 +01:00
{ { $options : = ` { name : "Name" , id : "school_name" , label : "Denominazione dell'istituto" , placeholder : "Inserire la denominazione" , type : "text" , required : "true" } ` } }
2019-12-03 12:21:28 +01:00
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "Name" ) "update" $update } }
2019-12-07 11:44:19 +01:00
{ { $codeOptions : = "" } }
{ { if or $isAdmin $isSubscriber } }
{ { $codeOptions = `
2019-12-03 12:21:28 +01:00
name: "Code"
id: "school_code"
label: "Codice meccanografico"
placeholder: "Inserire il codice meccanografico"
type: "text"
inputClass: "form-control uppercase"
2019-12-06 10:59:00 +01:00
otherAttrs: "maxlength=10 minlength=10"
2019-12-03 12:21:28 +01:00
required: "true"
`}}
2019-12-07 11:44:19 +01:00
{ { end } }
{ { if $isSchool } }
{ { $codeOptions = `
name: "Code"
id: "school_code"
label: "Codice meccanografico"
type: "text"
inputClass: "form-control-plaintext"
otherAttrs: "readonly"
`}}
{ { end } }
{ { template "input" dict "options" ( $codeOptions | yaml ) "value" ( . Data | field "Code" ) "update" $update } }
2019-12-09 14:18:31 +01:00
{ { $options : = ` { name : "Address" , id : "school_address" , label : "Indirizzo dell'istituto" , placeholder : "Inserire via, numero civico e città" , type : "text" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "Address" ) "update" $update } }
{ { $options : = `
name: "region_id"
id: "region_id"
label: "Regione"
title: "Seleziona la regione"
required: "true"
`}}
{ { template "select" dict "options" ( $options | yaml ) "data" ( . Data | field "AllRegions" ) "selected" ( . Data | field "SelectedRegion" ) "update" $update "form" $form } }
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 } }
2020-01-20 12:07:02 +01:00
<div class="form-row">
<div class="col">
{ { $options : = ` { name : "SchoolContactPersonFirstname" , id : "school_contact_person_firstname" , label : "Nome del referente di sede" , placeholder : "Inserire il nome del referente di sede" , type : "text" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "SchoolContactPersonFirstname" ) "update" $update } }
</div>
<div class="col">
2022-02-01 18:32:03 +01:00
{ { $options : = ` { name : "SchoolContactPersonLastname" , id : "school_contact_person_lastname" , label : "Cognome del referente di sede" , placeholder : "Inserire il cognome del referente di sede" , type : "text" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "SchoolContactPersonLastname" ) "update" $update } }
</div>
<div class="col">
{ { $options : = ` { name : "SchoolContactPersonEmail" , id : "school_contact_person_email" , label : "Email del referente di sede" , placeholder : "Inserire l'email del referente di sede" , type : "email" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "SchoolContactPersonEmail" ) "update" $update } }
</div>
<div class="col">
{ { $options : = ` { name : "SchoolContactPersonTelephoneNumber" , id : "school_contact_person_telephone_number" , label : "Telefono del referente di sede" , placeholder : "Inserire il n. di telefono del referente di sede" , type : "telephone_number" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "SchoolContactPersonTelephoneNumber" ) "update" $update } }
2020-01-20 12:07:02 +01:00
</div>
</div>
<div class="form-row">
<div class="col">
{ { $options : = ` { name : "ContestDirectorFirstname" , id : "school_contest_director_firstname" , label : "Nome del responsabile di gara" , placeholder : "Inserire il nome del responsabile di gara" , type : "text" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "ContestDirectorFirstname" ) "update" $update } }
</div>
<div class="col">
2022-02-03 16:20:39 +01:00
{ { $options : = ` { name : "ContestDirectorLastname" , id : "school_contest_director_lastname" , label : "Cognome del responsabile di gara" , placeholder : "Inserire il cognome del responsabile di gara" , type : "text" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "ContestDirectorLastname" ) "update" $update } }
2020-01-20 12:07:02 +01:00
</div>
</div>
2020-02-12 11:14:04 +01:00
2022-02-03 16:20:39 +01:00
<div class="form-row">
<div class="col">
{ { $options : = ` { name : "PreviousParticipantsSelection" , id : "school_previous_participants_selection" , label : "Indicare il numero complessivo degli studenti nell'ambito del quale sono stati selezionati il candidato JUNIOR e il candidato SENIOR dell'Istituto" , placeholder : "Indicare il numero complessivo degli studenti" , type : "number" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) "value" ( . Data | field "PreviousParticipantsSelection" ) "update" $update } }
</div>
</div>
2020-02-12 11:14:04 +01:00
{ { if ne ( env "OEF_REGRESSION_TEST" ) "1" } }
2019-12-04 14:10:09 +01:00
{ { if . Claims | isSubscriber } }
2020-02-12 09:50:35 +01:00
{ { $captcha : = genCaptcha } }
2020-02-12 11:14:04 +01:00
<div class="form-row justify-content-center">
<div class="col-auto">
<img class="border" id="captcha_img" src="/captcha/ { { $captcha } } .png" alt="Immagine CAPTCHA">
<button type="button" onclick="reload()" class="btn btn-outline-success"><i class="fa fa-redo"></i></button>
{ { $options : = ` { name : "CaptchaSolution" , id : "school_captcha_solution" , placeholder : "Inserire i numeri visualizzati sopra" , type : "text" , required : "true" } ` } }
{ { template "input" dict "options" ( $options | yaml ) } }
<input type="hidden" name="CaptchaID" value=" { { $captcha } } ">
</div>
2020-02-12 09:50:35 +01:00
</div>
2020-02-12 11:14:04 +01:00
{ { end } }
2020-02-12 09:50:35 +01:00
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 } }
2020-02-03 11:54:53 +01:00
{ { $options : = ` { cancelTitle : "Annulla" , saveTitle : "Salva" , model : "School" } ` } }
{ { if $isAdmin } }
2019-12-04 12:20:34 +01:00
{ { template "submit_cancel_buttons" dict "options" ( $options | yaml ) "id" ( . Data | field "ID" ) "update" $update } }
2020-02-03 11:54:53 +01:00
{ { else } }
{ { template "submit_cancel_buttons" dict "options" ( $options | yaml ) "id" ( . Data | field "ID" ) "update" $update "referer" ( . Data . ID | show "School" ) } }
{ { end } }
2019-12-04 12:20:34 +01:00
{ { end } }
2019-12-03 12:21:28 +01:00
</form>
2020-02-12 11:14:04 +01:00
{ { if ne ( env "OEF_REGRESSION_TEST" ) "1" } }
2020-02-12 09:50:35 +01:00
<script>
function setSrcQuery(e, q) {
var src = e.src;
var p = src.indexOf('?');
if (p >= 0) {
src = src.substr(0, p);
}
e.src = src + "?" + q
}
function reload() {
setSrcQuery(document.getElementById('captcha_img'), "reload=" + (new Date()).getTime());
return false;
}
</script>
2020-02-12 11:14:04 +01:00
{ { end } }
2019-12-03 12:21:28 +01:00
</div>
{ { end } }