{% extends 'Services/base.html.twig' %}
{% block header_epingles %}
{{ include('Lenord/Main/parts/epingles.html.twig') }}
{% endblock %}
{% block header_breadcrumb %}
{% include 'Nordinfo/Main/parts/breadcrumb.html.twig' %}
{% endblock %}
{% block body %}
<main tabindex="-1" role="main" id="mainContent">
{% include 'Nordinfo/Main/parts/back_btn.html.twig' with {'back_btn_class':'--nordServices --postDetails'} %}
<article style="overflow:visible;position:relative;z-index:98;">
<div class="containerSm containerPostDetails --nordServices mBLg">
<h1 class="__headingMain mTMd--imp">{{ service.titre }}</h1>
<ul class="__tags">
{% if service.sousprofils is not empty %}
{% if service.sousprofils|length == count_sous_profils %}
<li class="--profile"><a href="{{ path('services_services', {'slug': 'particulier'}) }}">Particulier</a></li>
{% else %}
{% for sp in service.sousprofils %}
<li class="--profile">
<a href="{{ path('services_services', {'slug': 'particulier'}) }}?sp[]={{ sp.aliasUrl }}">{{ sp.titre }}</a>{% if not loop.last %},{% endif %}
</li>
{% endfor %}
{% endif %}
{% endif %}
{% for grandprofil in service.grandprofils %}
{% if grandprofil.aliasUrl != 'particulier' %}
<li class="--profile">
<a href="{{ path('services_services', {'slug': grandprofil.aliasUrl}) }}">{{ grandprofil.titre }}</a>{% if not loop.last %},{% endif %}
</li>
{% endif %}
{% endfor %}
{% for sp in service.themes %}
<li class="{% if (service.sousprofils is not empty or service.grandprofils is not empty) and loop.first %}--separator{% endif %}">
{{ sp.titre }}{% if not loop.last %},{% endif %}
</li>
{% endfor %}
</ul>
<div class="separatorLine --sm"></div>
<div class="containerContent --nordServices">
<p class="__intro">{{ service.chapo }}</p>
{{ content_post|raw }}
</div>
{% if id == 45 %}
<div
style="background-color:#ecf4f7;padding-bottom:4rem;margin-top:4rem;width:100vw;transform:translateX(-50%);left:50%;position:relative;">
<div class="containerSm containerPostDetails --nordServices">
<h2 class="headingSection pTMd mBMd--imp">Mon adresse</h2>
<form class="formCustom mBMd--imp">
<div class="form-group">
<div class="__input-wrapper">
<div class="__inner" style="position:relative;">
<label for="inputAddress" style="margin-bottom:.5em;">
<span class="label-text">Adresse</span>
</label>
<div id="autocomplete" class="autocomplete">
<input class="autocomplete-input"
placeholder="Entrez le nom de la rue"
aria-label="Entrez le nom de la rue"
id="inputAddress"
>
<ul class="autocomplete-result-list"></ul>
</div>
<div class="d-none">
<input type="text"
class="form-control"
id="rueInput"
placeholder="Entrez le nom de la rue"
list="rueOptions"
aria-autocomplete="list"
aria-activedescendant="rueOptions"
aria-expanded="false"
style="padding:0.25rem 3rem 0.25rem 0.75rem;"
onkeyup="handlerOnKeyUp(event)"
onkeydown="handlerOnKeyDown(event)"
onfocusout="handlerOnFocusOut(event)"
autocomplete="one-time-code"
>
<ul class="address-feedback position-absolute list-group top-0"
style="z-index:1100;top:calc(100% + 1px);width:calc(100%);" id="rueOptions"></ul>
</div>
<button onclick="init(event)" type="button"
class="cardCollege__btnBack" id="btn_reinitialisation" style="display:none;">
<svg xmlns="http://www.w3.org/2000/svg" height="1em"
viewBox="0 0 384 512">
<path
d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/>
</svg>
<span class="sr-only">Vider la recherche</span></button>
<div style="display:none;" class="cardCollege__containerLoader" id="rueInputLoader"
aria-hidden="true">
<div class="loader"></div>
</div>
</div>
</div>
</div>
</form>
<div id="libelle_multiple" class="labelMultipleColleges" style="display:none;">Cette adresse relève de
plusieurs secteurs et donc de plusieurs collèges :
</div>
<div id="leCollege" class="cardColleges" style="display:none;">
<div class="cardColleges__inner">
<div>
<h3 id="college_nom"></h3>
<p id="college_adresse"></p>
<ul class="cardColleges__listButtons">
<li>
<a id="college_telephone_lien" href="">
<div class="cardColleges__inner">
<span class="cardColleges__icon">
<svg aria-hidden="true" id="b502a819-aaf7-4b39-99a9-de8335e974aa"
data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 265.57 265.51">
<defs>
<style>
.a7dd9744-ec09-4c6c-9c16-c23d5f53046b {
fill: #17323f;
}
</style>
</defs>
<path id="aeeccaf6-071a-4ed9-8b98-9c660428bb39"
data-name="e079d0e0-4290-4499-8edc-92635082f6d4"
class="a7dd9744-ec09-4c6c-9c16-c23d5f53046b"
d="M208.1,274.5a125.29,125.29,0,0,1-45.4-11.6C99.1,232.7,49,188.5,21.3,122.2A233.38,233.38,0,0,1,9.8,78.8,51.3,51.3,0,0,1,20,37.9,84.63,84.63,0,0,1,52.1,11.3,21.59,21.59,0,0,1,62.4,9a11.34,11.34,0,0,1,7.8,3.9c11.3,17.7,22.1,35.7,32.9,53.6A9.93,9.93,0,0,1,101.9,80c-6.1,5.9-12.5,11.5-19,16.9-13.7,11.5-15.2,15.8-5.8,31.1a146,146,0,0,0,24,30.7c18.1,16.5,37.3,31.9,56.8,46.7,14.9,11.2,17.4,10.1,28.9-4.4,4.1-5.1,8-10.4,12.3-15.2,7-8,11.1-8.5,20.1-3.3,16.6,9.7,33,19.6,49.7,29.1a9.3,9.3,0,0,1,5.1,11.7,64.5,64.5,0,0,1-46.9,47.5A135.69,135.69,0,0,1,208.1,274.5Z"
transform="translate(-8.99 -8.99)"></path>
</svg>
</span>
<span class="cardColleges__text" id="college_telephone"></span>
</div>
</a>
</li>
<li id="bloc_mail">
<a id="college_mail_href" href="#">
<div class="cardColleges__inner">
<span class="cardColleges__icon">
<svg aria-hidden="true" id="b5c621d6-1983-4327-9028-3fe9272e594c"
data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 384">
<path
d="M502.3,190.8a6,6,0,0,1,9.7,4.7V400a48,48,0,0,1-48,48H48A48,48,0,0,1,0,400V195.6a6,6,0,0,1,9.7-4.7c22.4,17.4,52.1,39.5,154.1,113.6,21.1,15.4,56.7,47.8,92.2,47.6,35.7.3,72-32.8,92.3-47.6C450.3,230.4,479.9,208.2,502.3,190.8ZM256,320c23.2.4,56.6-29.2,73.4-41.4,132.7-96.3,142.8-104.7,173.4-128.7A23.93,23.93,0,0,0,512,131V112a48,48,0,0,0-48-48H48A48,48,0,0,0,0,112v19a24.08,24.08,0,0,0,9.2,18.9c30.6,23.9,40.7,32.4,173.4,128.7,16.8,12.2,50.2,41.8,73.4,41.4Z"
transform="translate(0 -64)"></path>
</svg>
</span>
<span class="cardColleges__text" id="college_mail">xxxxxxxxx@ac-lille.fr</span>
</div>
</a>
</li>
<li>
<a target="_blank" class="--icon-external" id="college_site_ent"
href="#" title="Site internet">
<div class="cardColleges__inner">
<span class="cardColleges__icon">
<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 640 512">
<!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
<path
d="M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"/>
</svg>
</span>
<span class="cardColleges__text">
Site internet
<span class="cardColleges__icon">
<svg aria-hidden="true" id="f0e66a82-9691-4c5a-8636-9953692f0b2f"
data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 232.3 234.74"
fill="currentColor">
<rect y="51.74" height="183"></rect>
<path d="M0,234.74H183v-183H0ZM20.4,72H162.7v142.3H20.4Z" transform="translate(0 0)">
</path>
<polygon
points="113.2 0 113.2 20.3 211.9 20.3 211.9 121.6 232.3 121.6 232.3 0 113.2 0">
</polygon>
</svg>
</span>
</span>
</div>
</a>
</li>
</ul>
</div>
</div>
<p>
<span id="college_rne"></span>
<span id="college_nb_eleve"></span>
<span class="font-weight-bold">Restauration scolaire :</span> <a id="college_menu_link" href="#"
target="_blank"
title="Consulter le menu"
class="link-external">Consulter le
menu du restaurant scolaire</a>
</p>
</div>
<div id="lesImages" class="cardColleges__map mBMd--imp" style="display:none;">
<div class="flex-item-left" id="college_image"></div>
<div class="flex-item-right no-first-image" id="college_map"></div>
</div>
<div id="results"></div>
<p class="textCenter pBMd" style="display:none;" id="lien_reinitialisation">
<button onclick="init();" class="btnResetCollegeSearch" id="btnResetCollegeSearch">Réinitialiser la
recherche
</button>
</p>
</div>
<script>
(() => {
const loader = document.getElementById('rueInputLoader');
const btnReset = document.getElementById('btn_reinitialisation');
function filterByNord(results) {
return results.filter(function (result) {
return result.properties.postcode && result.properties.postcode.startsWith('59');
});
}
new Autocomplete('#autocomplete', {
search: input => {
const url = `https://api-adresse.data.gouv.fr/search?q=${encodeURI(input)}&limit=4&autocomplete=1`;
return new Promise(resolve => {
if (input.length < 3) {
return resolve([]);
}
loader.style.display = 'block';
fetch(url)
.then(response => response.json())
.then(data => {
const suggestions = filterByNord(data.features);
const results = suggestions.map((result, index) => {
return {...result, index};
})
loader.style.display = 'none';
resolve(results);
})
})
},
debounceTime: 1000,
submitOnEnter: true,
renderResult: (result, props) => {
let address = result.properties.name + " " + result.properties.postcode + " <strong>" + result.properties.city + "</strong>";
return `
<li ${props}>
${address}
</li>
`
},
getResultValue: result => {
return result.properties.name + " " + result.properties.postcode + " " + result.properties.city;
},
onSubmit: result => {
btnReset.style.display = 'none';
loader.style.display = 'block';
getInfoRue(result.properties.name + " " + result.properties.postcode + " " + result.properties.city);
}
})
})();
</script>
</div>
{% elseif id == 500 %}
<div
style="background-color:#ecf4f7;padding-bottom:4rem;margin-top:4rem;width:100vw;transform:translateX(-50%);left:50%;position:relative;">
<div class="containerSm containerPostDetails --nordServices">
<h2 class="headingSection pTMd mBMd--imp">Mon adresse</h2>
<form class="formCustom mBMd--imp">
<div class="form-group">
<div class="__input-wrapper">
<div class="__inner" style="position:relative;">
<label for="inputAddress" style="margin-bottom:.5em;">
<span class="label-text">Adresse</span>
</label>
<div id="autocomplete" class="autocomplete">
<input class="autocomplete-input"
placeholder="Entrez le numéro et le nom de la rue"
aria-label="Entrez le numéro et le nom de la rue"
id="inputAddress"
>
<ul class="autocomplete-result-list"></ul>
</div>
<div style="display:none;">
<label for="rueInput">
<span class="label-text">Adresse</span>
</label>
<input type="text" class="form-control" id="rueInput"
placeholder="Entrez le numéro et le nom de la rue"
list="rueOptions" style="padding:0.25rem 3rem 0.25rem 0.75rem;"
onkeyup="handlerOnKeyUp(this.value)" onkeydown="handlerOnKeyDown(event)"
onfocusout="handlerOnFocusOut()" autocomplete="one-time-code">
<ul class="address-feedback position-absolute list-group top-0"
style="z-index:1100;top:calc(100% + 1px);width:calc(100%);" id="rueOptions"></ul>
</div>
<button class="cardCollege__btnBack" id="btn_reinitialisation"
style="display: none;" type="button">
<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 384 512">
<path
d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z">
</path>
</svg>
<span class="sr-only">Vider la recherche</span></button>
<div style="display: none;" class="cardCollege__containerLoader" id="rueInputLoader"
aria-hidden="true">
<div class="loader"></div>
</div>
</div>
</div>
</div>
</form>
<div id="mnsContainer"></div>
<p class="textCenter pBMd" style="display: none;" id="lien_reinitialisation">
<button onclick="init();" class="btnResetCollegeSearch" id="btnResetMnsSearch">Réinitialiser la
recherche
</button>
</p>
<script>
(() => {
const loader = document.getElementById('rueInputLoader');
const btnReset = document.getElementById('btn_reinitialisation');
const inputAddress = document.getElementById('inputAddress');
new Autocomplete('#autocomplete', {
search: input => {
const url = `https://api-adresse.data.gouv.fr/search?q=${encodeURI(input)}&limit=20&autocomplete=1`;
return new Promise(resolve => {
if (input.length < 3) {
return resolve([]);
}
loader.style.display = 'block';
fetch(url)
.then(response => response.json())
.then(data => {
const suggestions = filterByNord(data.features);
const results = suggestions.map((result, index) => {
return {...result, index};
})
loader.style.display = 'none';
resolve(results);
})
})
},
debounceTime: 1000,
submitOnEnter: true,
renderResult: (result, props) => {
let address = result.properties.name + " " + result.properties.postcode + " <strong>" + result.properties.city + "</strong>";
return `
<li ${props}>
${address}
</li>
`
},
getResultValue: result => {
return result.properties.name + " " + result.properties.postcode + " " + result.properties.city;
},
onSubmit: async result => {
btnReset.style.display = 'none';
loader.style.display = 'block';
await displayMnsInfo(result.properties.name + " " + result.properties.postcode + " " + result.properties.city);
}
})
let currentFocus = -1;
let fetchTrigger = 0;
document.getElementById('btnResetMnsSearch').addEventListener('click', function (event) {
init(event);
});
document.getElementById('btnResetMnsSearch').addEventListener('keyup', function (event) {
if (event.key === 'Enter') {
init(event);
}
});
btnReset.addEventListener('click', init.bind(event));
function httpRequest(url, callback) {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
callback(JSON.parse(xhr.responseText));
}
};
xhr.open('GET', url, false);
xhr.send();
}
function init(e) {
e.preventDefault();
document.getElementById('rueInput').setAttribute('aria-expanded', 'false');
document.getElementById('rueInputLoader').style.display = 'none';
document.getElementById("rueInput").focus();
document.getElementById('rueInput').value = "";
inputAddress.value = "";
afficheResultat(false);
let datalist = document.getElementById('rueOptions');
datalist.innerHTML = '';
document.getElementById('lien_reinitialisation').style.display = "none";
document.getElementById('btn_reinitialisation').style.display = "none";
document.getElementById('rueInput').disabled = false;
document.getElementById('rueInput').focus();
document.getElementById('mnsContainer').innerHTML = '';
}
function afficheResultat(bool) {
if (bool) {
document.getElementById('lien_reinitialisation').style.display = "";
document.getElementById('btn_reinitialisation').style.display = "";
document.getElementById('rueInput').disabled = true;
document.getElementById('rueInput').setAttribute('aria-expanded', 'false');
}
}
function filterByNord(results) {
return results.filter(function (result) {
return result.properties.postcode && result.properties.postcode.startsWith('59');
});
}
function convertirPremiereLettreMajuscule(chaine) {
// Diviser la phrase en mots
let mots = chaine.toLowerCase().split(" ");
// Convertir la première lettre de chaque mot en majuscule
for (let i = 0; i < mots.length; i++) {
mots[i] = mots[i].charAt(0).toUpperCase() + mots[i].slice(1);
}
// Réassembler les mots en une phrase et la retourner
return mots.join(" ");
}
async function getAddress(address) {
const addressResponse = await fetch(
`https://api-adresse.data.gouv.fr/search/?q=${encodeURIComponent(address)}`);
const addressData = await addressResponse.json();
return addressData.features[0].geometry.coordinates;
}
async function getMnsDetails(mns) {
let url = '/ajax/get_mns_details?code_utpas=' + mns[0].attributes.code_utpas;
let adresse;
let type = "MNS";
let horaires;
let adresseMail;
let photoUrl;
let photoExists;
let formattedTelephone = '';
let telephone_lien = "";
let nom;
let result_array = [];
let features;
httpRequest(url, function (response) {
features = response.features;
let i = 0;
features.forEach(feature => {
const telephone = feature.attributes.telephone;
if (telephone && telephone.length > 0) {
// Supprimer tous les espaces du numéro de téléphone
const cleanedTelephone = telephone.replace(/\s/g, '');
// Formater le numéro de téléphone avec des espaces en utilisant une expression régulière
formattedTelephone = cleanedTelephone.replace(/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/, '$1 $2 $3 $4 $5');
// Remplacer "03" par "+33"
formattedTelephone = formattedTelephone.replace("03", "+33 3");
// Formater le lien de téléphone avec le format tel:
telephone_lien = 'tel:' + cleanedTelephone.replace(/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/, '$1 $2 $3 $4 $5').replace("03", "+333").replace(/\s/g, '');
}
adresseMail = feature.attributes.adressemail;
horaires = feature.attributes.horaires;
adresse = feature.attributes.adresse + " " + feature.attributes.cp + " " + convertirPremiereLettreMajuscule(feature.attributes.commune);
nom = "Maison Nord Solidarités (ex Unité Territoriale de Prévention et d'Action Sociale) " + mns[0].attributes.nomutpas;
if (feature.attributes.adresse2 != null && feature.attributes.adresse2 == "ANTENNE") {
nom = "Antenne Maison Nord Solidarités " + mns[0].attributes.nomutpas;
type = "ANTENNE";
}
photoUrl =
`https://datasig.lenord.fr/applications/mns/${feature.attributes.code_mns_txt}.jpg`;
photoExists = checkPhotoExist(feature.attributes.code_mns_txt);
tmp_array = [];
tmp_array['id'] = feature.attributes.code_utpas;
tmp_array['type'] = type;
tmp_array['code_mns'] = feature.attributes.code_mns_txt;
tmp_array['nom'] = convertirPremiereLettreMajuscule(nom);
tmp_array['adresse'] = adresse;
tmp_array['horaires'] = horaires;
tmp_array['picto_access'] = feature.attributes.picto_access;
tmp_array['longitude'] = feature.attributes.x_wgs84;
tmp_array['latitude'] = feature.attributes.y_wgs84;
tmp_array['telephone'] = formattedTelephone;
tmp_array['telephone_lien'] = telephone_lien;
tmp_array['adresseMail'] = adresseMail;
tmp_array['photoUrl'] = photoUrl;
tmp_array['photoExists'] = photoExists;
result_array[i] = tmp_array;
i++;
}
);
});
return result_array;
}
async function getMnsInfo(address) {
const coordinates = await getAddress(address);
let url = '/ajax/get_mns_info?lat=' + coordinates[0] + '&lng=' + coordinates[1];
let mnsList;
httpRequest(url, function (response) {
mnsList = response.features;
});
return await getMnsDetails(mnsList);
}
function checkPhotoExist(photo) {
let url = '/ajax/check_photo_exists?photo=' + photo;
httpRequest(url, function (response) {
return response;
//}
});
/*try {
const response = await fetch(url, {
method: 'HEAD'
});
return response.ok;
} catch (error) {
return false;
}*/
}
async function displayMnsInfo(address) {
document.getElementById('mnsContainer').innerHTML = '';
const mnsInfosArray = await getMnsInfo(address);
const googleMapsStaticApiKey = 'AIzaSyCmvIOcgfl_y9l40sGBnqOo-6KypVacBP8';
mnsInfosArray.forEach(mnsInfo => {
const staticMapUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${encodeURIComponent(mnsInfo.adresse)}&markers=color:red%7C${mnsInfo.latitude},${mnsInfo.longitude}&zoom=16&size=600x400&maptype=roadmap&key=${googleMapsStaticApiKey}`;
const googleMapsLink =
`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(mnsInfo.adresse)}`;
const mnsElement = document.createElement('div');
mnsElement.innerHTML = `
<div class="cardColleges" style="">
<div class="cardColleges__inner">
<div>
<h3>${mnsInfo.nom}</h3>
<p> ${mnsInfo.adresse}</p>
<ul class="cardColleges__listButtons">
${mnsInfo.telephone ? ` <li>
<a href="${mnsInfo.telephone_lien}">
<div class="cardColleges__inner">
<span class="cardColleges__icon">
<svg aria-hidden="true" id="b502a819-aaf7-4b39-99a9-de8335e974aa"
data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 265.57 265.51">
<defs>
<style>
.a7dd9744-ec09-4c6c-9c16-c23d5f53046b {
fill: #17323f;
}
</style>
</defs>
<path id="aeeccaf6-071a-4ed9-8b98-9c660428bb39"
data-name="e079d0e0-4290-4499-8edc-92635082f6d4"
class="a7dd9744-ec09-4c6c-9c16-c23d5f53046b"
d="M208.1,274.5a125.29,125.29,0,0,1-45.4-11.6C99.1,232.7,49,188.5,21.3,122.2A233.38,233.38,0,0,1,9.8,78.8,51.3,51.3,0,0,1,20,37.9,84.63,84.63,0,0,1,52.1,11.3,21.59,21.59,0,0,1,62.4,9a11.34,11.34,0,0,1,7.8,3.9c11.3,17.7,22.1,35.7,32.9,53.6A9.93,9.93,0,0,1,101.9,80c-6.1,5.9-12.5,11.5-19,16.9-13.7,11.5-15.2,15.8-5.8,31.1a146,146,0,0,0,24,30.7c18.1,16.5,37.3,31.9,56.8,46.7,14.9,11.2,17.4,10.1,28.9-4.4,4.1-5.1,8-10.4,12.3-15.2,7-8,11.1-8.5,20.1-3.3,16.6,9.7,33,19.6,49.7,29.1a9.3,9.3,0,0,1,5.1,11.7,64.5,64.5,0,0,1-46.9,47.5A135.69,135.69,0,0,1,208.1,274.5Z"
transform="translate(-8.99 -8.99)"></path>
</svg>
</span>
<span class="cardColleges__text">${mnsInfo.telephone}</span>
</div>
</a>
</li> ` : ''}
${mnsInfo.adresseMail ? `<li>
<a href="mailto:${mnsInfo.adresseMail}">
<div class="cardColleges__inner">
<span class="cardColleges__icon">
<svg aria-hidden="true" id="b5c621d6-1983-4327-9028-3fe9272e594c"
data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 384">
<path
d="M502.3,190.8a6,6,0,0,1,9.7,4.7V400a48,48,0,0,1-48,48H48A48,48,0,0,1,0,400V195.6a6,6,0,0,1,9.7-4.7c22.4,17.4,52.1,39.5,154.1,113.6,21.1,15.4,56.7,47.8,92.2,47.6,35.7.3,72-32.8,92.3-47.6C450.3,230.4,479.9,208.2,502.3,190.8ZM256,320c23.2.4,56.6-29.2,73.4-41.4,132.7-96.3,142.8-104.7,173.4-128.7A23.93,23.93,0,0,0,512,131V112a48,48,0,0,0-48-48H48A48,48,0,0,0,0,112v19a24.08,24.08,0,0,0,9.2,18.9c30.6,23.9,40.7,32.4,173.4,128.7,16.8,12.2,50.2,41.8,73.4,41.4Z"
transform="translate(0 -64)"></path>
</svg>
</span>
<span class="cardColleges__text" >${mnsInfo.adresseMail}</span>
</div>
</a>
</li>` : ''}
</ul>
</div>
</div>
${mnsInfo.horaires ? `<p >
<b>Horaires : </b><span>${mnsInfo.horaires}</span>
</p>` : ''}
${mnsInfo.picto_access ? `<p >
<b>Accessibilité des lieux :</b><br /><iframe title="Détail de l'accessibilité de ${mnsInfo.nom}"
src="${mnsInfo.picto_access}"
height="150"
width="330"
loading="lazy"
style="border: none;"
>
</iframe>
</p>` : ''}
</div>
</section>
<div class="cardColleges__map mBMd--imp" style="">
<div class="flex-item-left">
<img src="${mnsInfo.photoUrl}" alt="">
</div>
<div class="flex-item-right">
<a target="_blank" href="${googleMapsLink}" title="Itinéraire vers ${mnsInfo.nom}" style="position:relative;">
<img src="${staticMapUrl}" alt="Itinéraire vers ${mnsInfo.nom}" style="width:100%;height:100%;position:absolute;left:0;top:0;object-fit:cover;border:0">
</a>
</div>
</div>
`;
if (mnsInfo.type === "MNS") {
document.getElementById('mnsContainer').appendChild(mnsElement);
}
});
afficheResultat(true);
btnReset.focus();
loader.style.display = 'none';
}
async function onRueSelection(inputValue) {
const address = inputValue.trim();
if (address.length > 0) {
await displayMnsInfo(address);
document.getElementById('lien_reinitialisation').style.display = "";
document.getElementById('btn_reinitialisation').style.display = "";
document.getElementById('rueInput').disabled = true;
}
}
function setActive() {
let nbVal = $("div.address-feedback a").length;
if (!nbVal)
return false;
$('div.address-feedback a').removeClass("active");
currentFocus = ((currentFocus + nbVal - 1) % nbVal) + 1;
$('div.address-feedback a:nth-child(' + currentFocus + ')').addClass("active");
}
function handlerOnKeyUp() {
event.preventDefault();
event.stopPropagation();
if (event.keyCode === 38) {
currentFocus--;
setActive();
return false;
} else if (event.keyCode === 40) {
currentFocus++;
setActive();
return false;
} else if (event.keyCode === 13) {
if (currentFocus > 0) {
if ($("div.address-feedback a:nth-child(" + currentFocus + ")").attr("data-name")) {
$("#rueInput").val($("div.address-feedback a:nth-child(" + currentFocus + ")").attr("data-name") + ' ' + $(
"div.address-feedback a:nth-child(" + currentFocus + ")").attr("data-postcode") + ' ' + $(
"div.address-feedback a:nth-child(" + currentFocus + ")").attr("data-city"));
} else {
$("#rueInput").val('');
}
$('.address-feedback').empty();
onRueSelection($("#rueInput").val()).then(r => null);
}
return false;
}
$('div.address-feedback a').removeClass("active");
currentFocus = 0;
clearTimeout(fetchTrigger);
let rue = $("#rueInput").val();
if (rue.length === 0) {
$('.address-feedback').empty();
return false;
}
if (rue.length > 2) {
document.getElementById('rueInputLoader').style.display = 'block';
fetchTrigger = setTimeout(function () {
$.get('https://api-adresse.data.gouv.fr/search/', {
q: rue,
limit: 20,
autocomplete: 1
}, function (data, status, xhr) {
let liste = "";
let suggestions = filterByNord(data.features);
$.each(suggestions, function (i, obj) {
let cooladdress = obj.properties.name + " " + obj.properties.postcode + " <strong>" + obj
.properties.city + "</strong>";
if (obj.properties.type && obj.properties.type.trim() !== 'municipality') {
liste +=
'<a class="list-group-item list-group-item-action py-1" href="javascript:void(0)" name="' +
obj.properties.label + '" data-name="' + obj.properties.name + '" data-postcode="' + obj
.properties.postcode + '" data-city="' + obj.properties.city + '">' + cooladdress + '</a>';
}
});
$('.address-feedback').html(liste);
const elems = document.querySelectorAll('.list-group-item');
for (let i = 0; i < elems.length; i++) {
elems[i].addEventListener('mousedown', function (event) {
handlerOnMouseDown(event, i, elems[i]);
});
}
document.getElementById('rueInputLoader').style.display = 'none';
document.getElementById('rueInput').setAttribute('aria-expanded', 'true');
}, 'json');
}, 500);
}
}
function handlerOnKeyDown(e) {
if ($("div.address-feedback a").length > 0 && (e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 13)) {
e.preventDefault();
}
}
function handlerOnFocusOut() {
$('.address-feedback').empty();
document.getElementById('rueInput').setAttribute('aria-expanded', 'false');
}
function handlerOnMouseDown(event, index, element) {
event.preventDefault();
event.stopPropagation();
$("#rueInput").val($(element).attr("data-name") + ' ' + $(element).attr("data-postcode") + ' ' + $(element).attr(
"data-city"));
$('.address-feedback').empty();
onRueSelection($("#rueInput").val()).then(r => null);
}
})();
</script>
</div>
</div>
{% endif %}
</div>
</article>
{% if is_preview != 1 %}
<div class="container pT pB">
{% include 'Nordinfo/Main/parts/article-actions.html.twig' with {'post_title': title, 'post_id':'test', 'is_le_nord':true} %}
</div>
{% endif %}
{% if is_pdf|default and is_pdf == 1 %}{% else %}
<div class="containerVoting">
<div class="containerSm" aria-live="polite">
{% if hasVoted == 1 %}
<p id="labelSuccess" class="__result" style="margin-bottom:0;display:block!important;">Vous avez déja donné
votre avis sur ce
service.</p>
{% else %}
<fieldset class="__fieldset" id="fieldset">
<legend>Ce contenu vous a-t-il été utile ?</legend>
<div>
<div>
<input type="radio" id="vote_yes" name="vote" value="positif" aria-labelledby="label_yes"
class="sr-only">
<label id="label_yes" for="vote_yes">
<span aria-hidden="true">
<img src="{{ asset('img/brandmaster/icon-yes.svg') }}" alt="">
</span>
<span>Oui</span>
</label>
</div>
<div>
<input
type="radio" id="vote_no" name="vote" value="negatif" aria-labelledby="label_no" class="sr-only">
<label id="label_no" for="vote_no">
<span aria-hidden="true">
<img src="{{ asset('img/brandmaster/icon-no.svg') }}" alt="">
</span>
<span>Non</span>
</label>
</div>
</div>
</fieldset>
<div class="containerBtnSubmitVote"
id="containerBtnSubmitVote"
style="display:none;"
>
<button
id="btnSubmitVote"
class="btn btnFormSubmit --nordServices"
aria-disabled="false"
aria-busy="false"
>
<span>Valider</span>
<span class="loader"></span>
</button>
</div>
<p id="labelSuccess" class="__result" role="status">Merci d'avoir donné votre avis</p>
<p id="labelSuccessMessage" class="__result" role="status">Merci de votre message</p>
<div class="__containerForm" id="containerForm" style="display:none;">
<p class="__subtitle">Comment améliorer cette page ?</p>
<form
action="#"
method="post"
class="needs-validation formCustom"
id="formComment"
>
<div class="form-group">
<div class="__input-wrapper">
<div class="__inner">
<label for="inputComment">
<span class="label-text">Votre commentaire <span class="colorRed">*</span></span>
</label>
<input
type="text"
class="form-control"
id="inputComment"
name="comment"
placeholder=""
required
>
</div>
</div>
</div>
<div class="__buttons-wrapper containerBtnSubmitComment">
<button
class="btn btnFormSubmit --nordServices"
id="btnSubmitFormComment"
type="submit"
aria-disabled="false"
aria-busy="false"
>
<span>Valider</span>
<span class="loader"></span>
</button>
</div>
</form>
</div>
{% endif %}
</div>
</div>
{% endif %}
</main>
{% endblock %}
{% block include_js %}
<script type="text/javascript">
const id = "{{ id }}";
const btnSubmitFormComment = document.getElementById('btnSubmitFormComment');
const formComment = document.getElementById('formComment');
const containerBtnSubmitVote = document.getElementById('containerBtnSubmitVote');
const btnSubmitVote = document.getElementById('btnSubmitVote');
const voteYes = document.getElementById('vote_yes');
const voteNo = document.getElementById('vote_no');
const containerForm = document.getElementById('containerForm');
const fieldset = document.getElementById('fieldset');
const labelSuccess = document.getElementById('labelSuccess');
const inputComment = document.getElementById('inputComment');
const labelSuccessMessage = document.getElementById('labelSuccessMessage');
function toggleSubmitButtonVisibility() {
if (voteYes.checked || voteNo.checked) {
containerBtnSubmitVote.style.display = 'block';
} else {
containerBtnSubmitVote.style.display = 'none';
}
}
voteYes.addEventListener('change', toggleSubmitButtonVisibility);
voteNo.addEventListener('change', toggleSubmitButtonVisibility);
btnSubmitVote.addEventListener('click', function (e) {
e.preventDefault();
if (voteYes.checked) {
btnSubmitVote.classList.add('--loading');
btnSubmitVote.setAttribute('aria-disabled', 'true');
btnSubmitVote.setAttribute('aria-busy', 'true');
btnSubmitVote.setAttribute('disabled', 'disabled');
$.ajax({
url: "{{ path('services_save_avis') }}",
data: {
'id': id,
'valeur': 'positif'
},
type: "POST",
success: function () {
setTimeout(() => {
containerBtnSubmitVote.style.display = 'none';
fieldset.style.display = 'none';
labelSuccess.style.display = 'block';
}, 1500);
}
});
} else if (voteNo.checked) {
btnSubmitVote.classList.add('--loading');
btnSubmitVote.setAttribute('aria-disabled', 'true');
btnSubmitVote.setAttribute('aria-busy', 'true');
btnSubmitVote.setAttribute('disabled', 'disabled');
setTimeout(() => {
containerForm.style.display = 'block';
containerBtnSubmitVote.style.display = 'none';
fieldset.style.display = 'none';
}, 1000);
}
});
formComment.addEventListener('submit', function (e) {
e.preventDefault();
btnSubmitFormComment.classList.add('--loading');
btnSubmitFormComment.setAttribute('aria-disabled', 'true');
btnSubmitFormComment.setAttribute('aria-busy', 'true');
btnSubmitFormComment.setAttribute('disabled', 'disabled');
$.ajax({
url: "{{ path('services_save_avis') }}",
data: {
'id': id,
'valeur': 'negatif',
'comment': inputComment.value
},
type: "POST",
success: function () {
setTimeout(() => {
containerForm.style.display = 'none';
labelSuccessMessage.style.display = 'block';
}, 1500);
}
});
});
if (id === "45") {
{% include 'Services/js/college.js' %}
}
</script>
{% endblock %}