{% extends 'base.html.twig' %}
{% block content %}
<h5 class="text-uppercase fw-bold">
<a href="{{ path('stagiaires') }}"><button type="button" class="btn btn-secondary text-uppercase" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Retour"><i class="bi bi-arrow-bar-left"></i> Stagiaires</button></a>
<i class="bi bi-caret-right"></i> Ajouter
</h5>
<div class="row">
<div class="col-8 mt-3">
{{ form_start(formulaire) }}
<div class="row">
<div class="col-6">{{ form_row(formulaire.agence) }}</div>
</div>
<div class="row">
<div class="col-6">{{ form_row(formulaire.etat) }}</div>
</div>
<div class="row">
<div class="col-6">
{{ form_row(formulaire.nom) }}
</div>
<div class="col-6">{{ form_row(formulaire.prenom) }}</div>
<div id="stagiaireVerifDoublonMessage"></div>
</div>
<div class="row">
<div class="col-3">
{{ form_label(formulaire.telephone) }}
<div class="input-group mb-3">
{{ form_widget(formulaire.telephone) }}
<span class="input-group-text" id="basic-addon"><i class="bi bi-phone-vibrate"></i></span>
</div>
</div>
<div class="col-3">
{{ form_label(formulaire.agrementNum) }}
<div class="input-group mb-3">
{{ form_widget(formulaire.agrementNum) }}
<span class="input-group-text" id="basic-addon"><i class="bi bi-123"></i></span>
</div>
</div>
<div class="col-3">
{{ form_label(formulaire.agrementDateFin) }}
<div class="input-group mb-3">
{{ form_widget(formulaire.agrementDateFin) }}
</div>
</div>
<div class="col-3 align-self-center">
<div class="form-check form-switch input-group mb-2">
{{ form_widget(formulaire.accueil240h) }}
</div>
</div>
</div>
{{ form_label(formulaire.email) }}
<div class="input-group mb-3">
{{ form_widget(formulaire.email) }}
<span class="input-group-text" id="basic-addon">@</span>
</div>
{{ form_row(formulaire.adresse1) }}
{{ form_row(formulaire.adresse2) }}
<div class="row">
<div class="col-2">
{{ form_label(formulaire.codePostal) }}
<div class="input-group mb-3">
{{ form_widget(formulaire.codePostal) }}
<!-- <span class="input-group-text" id="basic-addon"><i class="bi bi-phone-vibrate"></i></span> -->
</div>
</div>
<div class="col-4">
{{ form_label(formulaire.ville) }}
<div class="input-group mb-3">
{{ form_widget(formulaire.ville) }}
<span class="input-group-text" id="basic-addon"><i class="bi bi-geo-fill"></i></span>
</div>
</div>
</div>
<div class="row">
<div class="col-4">
{{ form_label(formulaire.diplome1) }}
<div class="input-group mb-3">
{{ form_widget(formulaire.diplome1) }}
<span class="input-group-text" id="basic-addon"><i class="bi bi-briefcase"></i></span>
</div>
</div>
<div class="col-4">
{{ form_label(formulaire.diplome2) }}
<div class="input-group mb-3">
{{ form_widget(formulaire.diplome2) }}
<span class="input-group-text" id="basic-addon"><i class="bi bi-briefcase"></i></span>
</div>
</div>
<div class="col-4">
{{ form_label(formulaire.diplome3) }}
<div class="input-group mb-3">
{{ form_widget(formulaire.diplome3) }}
<span class="input-group-text" id="basic-addon"><i class="bi bi-briefcase"></i></span>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col-12">Dispenses :</div>
</div>
<div class="row form-check form-switch">
<div class="col-4">
<div class="input-group mb-2">
{{ form_widget(formulaire.dispenseDomaine1) }}
</div>
</div>
<div class="col-4">
<div class="input-group mb-2">
{{ form_widget(formulaire.dispenseDomaine2) }}
</div>
</div>
<div class="col-4">
<div class="input-group mb-2">
{{ form_widget(formulaire.dispenseDomaine3) }}
</div>
</div>
</div>
{{ form_end(formulaire) }}
</div>
<div class="col-4">
<h5><i class="bi bi-info-circle"></i> Aide à la saisie</h5>
<div class="border-start ps-2">
Les champs avec un fond anthracite sont obligatoires.
</div>
</div>
</div>
<script>
$('#stagiaires_add_form_nom, #stagiaires_add_form_prenom').change(function(){
// alert('toto');
valeurStagiaireNom = $('#stagiaires_add_form_nom').val();
valeurStagiairePrenom = $('#stagiaires_add_form_prenom').val();
// alert(valeurStagiaireNom+' '+valeurStagiairePrenom);
$.ajax({
method: "POST",
url: "{{ path('stagiaires_add_verif_doublon') }}",
data: {
stagiaireNom: valeurStagiaireNom,
stagiairePrenom: valeurStagiairePrenom
}
})
.done(function( msg ) {
$('#stagiaireVerifDoublonMessage').html(msg);
if(msg != '') {
$('#stagiaires_add_form_submit').prop("disabled",true);
}
else {
$('#stagiaires_add_form_submit').prop("disabled",false);
}
});
});
</script>
{% endblock %}