{% extends 'base.html.twig' %}
{% block title %}Nouveau | {{ parent() }}{% endblock %}
{% block body %}
<div class="breadcrumb">
<h1 class="mr-2">Inscrits</h1>
<ul>
<li><a href="{{ path('default') }}" onclick="$('.loader').addClass('is-active');">Accueil</a></li>
<li><a href="#">Elèves</a></li>
<li><a href="{{ path('registration_student_registration_index') }}" onclick="$('.loader').addClass('is-active');">Retour</a></li>
<li>Nouveau</li>
</ul>
</div>
<div class="separator-breadcrumb border-top"></div>
<div class="row mb-4">
<div class="col-md-7 mb-4">
<div class="card text-left">
<div class="card-header">Création</div>
<div class="card-body">
{{ include('registration/registration_student_registration/_form.html.twig') }}
</div>
</div>
</div>
<div class="col-md-5 mb-4">
<div class="card text-left">
<div class="card-header">Plus d'info</div>
<div class="card-body">
<table class="display table table-striped table-bordered">
<tr>
<th>Photo</th>
<td><img id="_photo" src="#" alt="" style="width: 150px;" /></td>
</tr>
<tr>
<th>Nom & Prénons</th>
<td><span id="_name"></span></td>
</tr>
<tr>
<th>Mle interne</th>
<td><span id="_code"></span></td>
</tr>
<tr>
<th>Mle national</th>
<td><span id="_registrationNumber"></span></td>
</tr>
<tr>
<th>Niveau</th>
<td><span id="_entryLevel"></span></td>
</tr>
<tr>
<th>Date de naissance</th>
<td><span id="_birthDate"></span></td>
</tr>
<tr>
<th>Lieu de naissance</th>
<td><span id="_birthLocation"></span></td>
</tr>
<tr>
<th>Contact SMS</th>
<td><span id="_phoneNumber"></span></td>
</tr>
<tr>
<th>Etablissement</th>
<td><span id="_establishment"></span></td>
</tr>
<tr>
<th>Affecté</th>
<td><span id="_is_affected"></span></td>
</tr>
<tr>
<th>Redoublant</th>
<td><span id="_is_redoubling"></span></td>
</tr>
</table>
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script>
$(document).ready(function (){
$('.submitBtn').hide();
$('#registration_student_registration_registrationStudentPreRegistration').change(function(){
id = $('#registration_student_registration_registrationStudentPreRegistration').val();
getStudentInfo(id);
}).trigger("change");
})
function getStudentInfo(sId) {
console.log('entity ' + sId);
path = '{{ path('api_registration_student_pre_registration_info') }}';
$('#_name').html("Traitement ...");
$('#_code').html("Traitement ...");
$('#_registrationNumber').html("Traitement ...");
$('#_birthDate').html("Traitement ...");
$('#_birthLocation').html("Traitement ...");
$('#_establishment').html("Traitement ...");
$('#_phoneNumber').html("Traitement ...");
$('#_entryLevel').html("Traitement ...");
$('#_is_affected').html("Traitement ...");
$('#_is_redoubling').html("Traitement ...");
$('#registration_student_registration_classroom').html('');
axios.get(path, {
params: {
id: sId,
}
}).then(function (response) {
console.log(response.data);
console.log(response.data.is_affected);
if(response.data.code == 200){
$('#_photo').prop('src', '{{ app.request.schemeAndHttpHost }}/images/students/' + response.data.img_src);
$('#_name').html(response.data.name);
$('#_code').html(response.data.id);
$('#_registrationNumber').html(response.data.registrationNumber);
$('#_birthDate').html(response.data.birthDate);
$('#_birthLocation').html(response.data.birthLocation);
$('#_establishment').html(response.data.establishment);
$('#_phoneNumber').html(response.data.phoneNumber);
$('#_entryLevel').html(response.data.classroom);
if(response.data.is_affected){
$('#_is_affected').html('OUI');
$('#registration_student_registration_is_affected').prop("checked", true);
}else{
$('#_is_affected').html('NON');
$('#registration_student_registration_is_affected').prop("checked", false);
}
if(response.data.is_redoubling){
$('#_is_redoubling').html('OUI');
$('#registration_student_registration_is_redoubling').prop("checked", true);
}else{
$('#_is_redoubling').html('NON');
$('#registration_student_registration_is_redoubling').prop("checked", false);
}
var option = '';
for(var i = 0; i < response.data.classrooms.length; i++){
option = "<option value=" + response.data.classrooms[i].id + ">" + response.data.classrooms[i].label + "</option>";
$('#registration_student_registration_classroom').append(option);
}
$('.submitBtn').show();
}else{
alert(response.data.message);
$('.submitBtn').hide();
}
console.log(response.data.message);
//$(".loader").removeClass("is-active");
});
}
</script>
{% endblock %}