Files
aem_moniteurs/aem_gestion/templates/eleves/eleve_doc_prefecture.pt
2023-06-22 10:34:18 +02:00

120 lines
5.0 KiB
XML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<div class="row">
<form id="change-eleve-details-form" class="form-horizontal" action="${url}" method="post" tal:condition="eleve"
data-fv-framework="bootstrap"
data-fv-icon-valid="glyphicon glyphicon-ok"
data-fv-icon-invalid="glyphicon glyphicon-remove"
data-fv-icon-validating="glyphicon glyphicon-refresh">
<div class="form-group" id="matricule-form">
<label class="col-xs-4 control-label">No immatriculation</label>
<div class="col-xs-4" id="matricule-field">
<div class="input-group">
<input class="form-control" type="text" name="DOSSIER_NO" id="DOSSIER_NO"
value="${eleve.DOSSIER_NO}"
placeholder="NO."
data-fv-integer="true"
data-fv-integer-message="Ce nombre n'est pas vailde" />
</div>
</div>
</div>
<div class="form-group" id="save_date_form">
<label class="col-xs-4 control-label">Enregistré le </label>
<div class="col-xs-4" id="save_date_field">
<div class="input-group" >
<input class="form-control" type="text" name="DOSSIER_DATE" id="DOSSIER_DATE"
value="${dossier_date}"
data-fv-date="true"
data-fv-date-format="DD/MM/YYYY"
data-fv-date-message="La date n'est pas valide (JJ/MM/AAAA)"
placeholder="JJ/MM/AAAA" />
</div>
</div>
</div>
<div class="form-group" tal:condition="code >= 6">
<label class="control-label col-xs-4" for="AGENCE">Agence</label>
<div class="col-xs-4">
<select class="form-control" id="AGENCE" name="AGENCE">
<div tal:repeat="item agences">
<option value="${item.CODE}" tal:attributes="selected eleve.AGENCE == item.CODE and 'selected' or None">${item.LIBELLE}</option>
</div>
</select>
</div>
</div>
<div class="form-group" tal:condition="code >= 6">
<label class="control-label col-xs-4" for="STATUT">Statut</label>
<div class="col-xs-4">
<select class="form-control" id="STATUT" name="STATUT">
<div tal:repeat="item status">
<option value="${item.CODE}" tal:attributes="selected eleve.STATUT == item.CODE and 'selected' or None">${item.LIBELLE}</option>
</div>
</select>
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-4 col-xs-5">
<a class="btn btn-default" href="${request.application_url}/fiche_eleve/${eleve.CD_CLI}">
<span class="glyphicon glyphicon-chevron-left"></span> Annuler</a>
<button class="btn btn-primary" type="submit" name="form.submitted">
<span class="glyphicon glyphicon-ok"></span>&nbsp;Enregistrer</button>
</div>
</div>
</form>
</div> <!-- row -->
<br />
<br />
<script>
$(document).ready(function() {
const notEmptyValidator = {
validators: {
notEmpty: {
message: 'Date d\'immatriculation obligatoire',
enable : true
},
date: {
format: 'DD/MM/YYYY',
message: 'La date d\'immatriculation n\'est pas valide (JJ/MM/AAAA)',
}
}
};
$("#DOSSIER_NO").on('change input',function(){
var no_matricul = $("#DOSSIER_NO").val().trim();
if(no_matricul != ''){
$("#DOSSIER_DATE").prop("disabled", false);
fv.formValidation.addField('DOSSIER_DATE',notEmptyValidator);
}
else{
fv.formValidation.removeField('DOSSIER_DATE').resetField('DOSSIER_DATE');
$('#save_date_form').removeClass('has-feedback').removeClass('has-success').removeClass('has-error')
$('#save_date_field').html("<div class=\"input-group\" > <input class=\"form-control\" type=\"text\" id=\"DOSSIER_DATE\" name=\"DOSSIER_DATE\"\n" +
"value=\"\" placeholder=\"JJ/MM/AAAA\"/></div>");
$("#DOSSIER_DATE").prop("disabled", true);
}
});
var fv = $('#change-eleve-details-form').formValidation().data();
var date_matric = $('#DOSSIER_DATE').val().trim();
if (date_matric == ""){
$("#DOSSIER_DATE").prop("disabled", true);
}
var no_matricul = $("#DOSSIER_NO").val().trim();
if(no_matricul != ''){
fv.formValidation.removeField('DOSSIER_DATE').resetField('DOSSIER_DATE');
fv.formValidation.addField('DOSSIER_DATE',notEmptyValidator);
}
$('form input').on('keypress', function(e) {
return e.which !== 13;
});
});
</script>
</div>
</metal:block>