{% include 'headerlogin.html.twig' %}
<body>
<div class="container-scroller">
<div class="container-fluid page-body-wrapper full-page-wrapper inscription">
<div class="row flex-grow">
<div class="col-lg-4 mx-auto" style="margin-right: 10%; background: #e8eff4;">
</div>
<div class="col-lg-8 mx-auto" style="margin-right: 10%; background: white;">
<div class="card-body " style="background-color : white; width : 95%; margin-top : 5%; margin-left : 2%;">
<p> <img style="width : 40%; margin-left : 30%;" src="{{asset('images/icones/logo.jpeg')}}"> </p>
<h2 class="font-weight-bold" style="color : #3673bc;"> J'ADHERE AU CNC </h2>
<div class="row" style="font-weight : bold;">
<div class="col-md-12">
<h4 class="font-weight-bold" style="color : #3673bc;"> Choisissez votre Province ; </h4>
<div class="row">
{% for province in provinces %}
<div class="col-md-2" style="margin : 1%;">
<a href="{{ path('adhesion_form', {'id':province.id}) }}" type="button" class="btn btn-inverse-success btn-icon-text font-weight-bold">
<i class="ti-location-pin btn-icon-prepend"></i>
{{province.nom}}
</a>
</div>
{% endfor %}
</div>
</div>
<div class="col-md-6 ml-auto mr-auto">
<div id="worldMap" style="height: 300px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
</div>
<!-- page-body-wrapper ends -->
{#
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.
See https://symfony.com/doc/current/security/remember_me.html
<div class="checkbox mb-3">
<label>
<input type="checkbox" name="_remember_me"> Remember me
</label>
</div>
#}
<script>
window.onload = () => {
let province = document.querySelector("#demande_Province");
let selectCommune = document.querySelector('#demande_commune');
selectCommune.innerHTML = "";
province.addEventListener("change", function(){
let form = this.closest("form");
let data = this.name + "=" + this.value;
fetch(form.action, {
method: form.getAttribute("method"),
body: data,
headers: {
"content-type": "application/x-www-form-urlencoded; charset:UTF-8 "
}
})
.then(response => response.text())
.then(html => {
let content = document.createElement("html");
content.innerHTML = html;
let nouveauSelect = content.querySelector("#demande_ville");
document.querySelector("#demande_ville").replaceWith(nouveauSelect);
let ville = document.querySelector("#demande_ville");
ville.addEventListener("change", function(){
getCommunes(ville.value);
})
})
})
}
</script>
<script>
function getCommunes(idVille){
var communes = "";
const xmlhttp = new XMLHttpRequest();
var params = 'id=' + idVille;
xmlhttp.open("POST", "http://localhost/republic/public/index.php/commune/formdata/", true);
xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xmlhttp.send("id="+idVille);
xmlhttp.onload = function() {
communes = JSON.parse(this.responseText);
let selectCommune = document.querySelector('#demande_commune');
selectCommune.innerHTML = "";
for (let i = 0; i< communes.length; i++){
let newOption = new Option(communes[i].nom, communes[i].id)
selectCommune.add(newOption);
}
}
}
</script>
{% include 'footer.html.twig' %}