{% extends 'register_admin.html.twig' %}
{% block title %}{{ "L'OFFICE DE L'ELEVAGE ET DES PATURAGES"|trans }}{% endblock %}
{% block body %}
<form method="post" action="{{ path('demande_formation_add') }}" enctype="multipart/form-data" >
<h1 class="text-center mb-4 text-uppercase font-weight-bold text-primary">{{ "Demande de Formation"|trans }}</h1>
<div class="alert-box mt-3">
{% for type, messages in {'failure_insert': "Veuillez cocher le recaptcha"|trans, 'failure_insert_pdf': "Le fichier doit être un PDF."|trans} %}
{% for message in app.flashes(type) %}
{% if message == true %}
<div class="alert alert-danger" role="alert">
<div class="alert-body">{{ messages }}</div>
</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
<div class="row align-items-center mb-4">
<div class="col-md-3 text-md-right text-left">
<label class="font-weight-bold">{{ "Formation en"|trans }} :<span class="text-danger">*</span></label>
</div>
<div class="col-md-9 d-flex">
<div class="custom-control custom-radio mr-4">
<input type="radio" id="customRadio1" name="demande_formation[typeFormation]" value="Insémination Artificielle Bovine" class="custom-control-input" required>
<label class="custom-control-label" for="customRadio1">{{ "Insémination Artificielle"|trans }}</label>
</div>
<div class="custom-control custom-radio">
<input type="radio" id="customRadio2" name="demande_formation[typeFormation]" value="Apiculture" class="custom-control-input">
<label class="custom-control-label" for="customRadio2">{{ "Apiculture"|trans }}</label>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="form-group">
<label class="font-weight-bold">{{ 'user.nom-prenom-fr'|trans }} :<span class="text-danger">*</span></label>
{{ form_widget(form.nprElvLt, { 'attr': {'class': 'form-control form-control-lg'} }) }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="font-weight-bold">{{ 'user.nom-prenom-ar'|trans }} :<span class="text-danger">*</span></label>
{{ form_widget(form.nprElvLi, { 'attr': {'class': 'form-control form-control-lg'} }) }}
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="form-group">
<label class="font-weight-bold">{{ "E-mail"|trans }} :<span class="text-danger">*</span></label>
{{ form_widget(form.email, { 'attr': {'class': 'form-control form-control-lg'} }) }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="font-weight-bold">{{ "N° Carte d'Identité Nationale"|trans }} :<span class="text-danger">*</span></label>
{{ form_widget(form.cin, { 'attr': {'class': 'form-control form-control-lg'} }) }}
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="form-group">
<label class="font-weight-bold">{{ "Niveau d'Education"|trans }} :<span class="text-danger">*</span></label>
{{ form_widget(form.niveauEducation, { 'attr': {'class': 'form-control form-control-lg'} }) }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="font-weight-bold">{{ "Numéro de Telephone"|trans }} :<span class="text-danger">*</span></label>
{{ form_widget(form.numTel, { 'attr': {'class': 'form-control form-control-lg'} }) }}
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-md-6">
<div class="form-group">
<label class="font-weight-bold">{{ "Adresse"|trans }} :<span class="text-danger">*</span></label>
{{ form_widget(form.adresse, { 'attr': {'class': 'form-control form-control-lg'} }) }}
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="font-weight-bold">{{ "Gouvernorats"|trans }} :<span class="text-danger">*</span></label>
{{ form_widget(form.gouvernorat, { 'attr': {'class': 'form-control form-control-lg'} }) }}
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-md-12">
<div class="form-group">
<label class="font-weight-bold">
{{ "Charger Diplôme"|trans }} <span class="text-danger">*</span>
</label>
<div class="file-upload-wrapper" style="position: relative;">
<input type="file" name="demande_formation[docDiplomes]" class="form-control file-upload-input" accept=".pdf" style="border: 2px solid #ced4da; padding: 10px; border-radius: 8px; cursor: pointer;" required>
</div>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12 text-center">
<div class="form-group mt-2" style="">
{{ form_row(form.recaptcha) }}
{{ form_errors(form.recaptcha) }}
</div>
</div>
</div>
{{ form_widget(form._token) }}
<div class="form-group text-center mt-4">
<button class="btn btn-primary btn-lg w-50 btn-rounded text-uppercase">{{ "S'inscrire"|trans }}</button>
</div>
<div class="form-group text-center mt-2">
<a href="{{ path('login') }}" class="text-info">{{ "Vous avez un compte?"|trans }} <strong>{{ "S'authentifier"|trans }}</strong></a>
</div>
</form>
{% endblock %}
{% block javascripts %}
<script type="text/javascript">
$(function() {
$(".preloader ").fadeOut();
});
$("form").submit(function(event) {
var recaptcha = $("#g-recaptcha-response").val();
if (recaptcha === "") {
event.preventDefault();
}
});
function changeType(val){
var type = val.value;
if(type=="P"){
$('#cin').show();
$('#matricule').hide();
}else{
$('#cin').hide();
$('#matricule').show();
}
}
function getDelegation(sel)
{
var name= 'agent[delegation]';
var nameImada= 'agent[imada]';
var formURL = "{{ path('get_delegation_ajax') }}";
var id_gouvernorat = sel.value;
$.ajax({
url: formURL,
data: {'id': id_gouvernorat},
dataType: "json",
type: 'post',
success: function (data, textStatus, jqXHR) {
$('select[name="'+name+'"]').empty();
$('select[name="'+name+'"]').append(
"<option value=" + ">" + "-----" + "</option>"
);
$('select[name="'+nameImada+'"]').empty();
$('select[name="'+nameImada+'"]').append(
"<option value=" + ">" + "-----" + "</option>"
);
i = 0;
$.each(data, function (index, delegation) {
if (delegation != null ) {
$('select[name="'+name+'"]').append(
delegation.nom
+ "<option value=" + delegation.id + ">" + delegation.nom + "</option>"
)
}
i++;
}
);
},
error: function (jqXHR, textStatus, errorThrown) {
console.log('nom: ' + errorThrown);
console.log('Not Ok: ' + jqXHR);
}
});
console.log("Handler for .change() called." + name);
}
function getImada(sel)
{
var name= 'agent[imada]';
var formURL = "{{ path('get_imada_ajax') }}";
var id_gouvernorat = sel.value;
$.ajax({
url: formURL,
data: {'id': id_gouvernorat},
dataType: "json",
type: 'post',
success: function (data, textStatus, jqXHR) {
$('select[name="'+name+'"]').empty();
$('select[name="'+name+'"]').append(
"<option value=" + ">" + "-----" + "</option>"
);
i = 0;
$.each(data, function (index, delegation) {
if (delegation != null ) {
$('select[name="'+name+'"]').append(
delegation.nom
+ "<option value=" + delegation.id + ">" + delegation.nom + "</option>"
)
}
i++;
}
);
},
error: function (jqXHR, textStatus, errorThrown) {
console.log('nom: ' + errorThrown);
console.log('Not Ok: ' + jqXHR);
}
});
console.log("Handler for .change() called." + name);
}
</script>
{% endblock %}