|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
const minZoomForRequest = 17;
|
|
|
|
|
const urlADSL='https://tools.aquilenet.fr/cgi-bin/recherchend.cgi'
|
|
|
|
|
const urlTestFTTH='https://tools.aquilenet.fr/cgi-bin/test.cgi'
|
|
|
|
|
const urlADSL = 'https://tools.aquilenet.fr/cgi-bin/recherchend.cgi'
|
|
|
|
|
const urlTestFTTH = 'https://tools.aquilenet.fr/cgi-bin/test.cgi'
|
|
|
|
|
|
|
|
|
|
const streetTypeConversion = new Map();
|
|
|
|
|
streetTypeConversion.set("aire", "aire")
|
|
|
|
@ -72,6 +72,7 @@ streetTypeConversion.set("zone industrielle", "zi")
|
|
|
|
|
streetTypeConversion.set("zone", "zone")
|
|
|
|
|
|
|
|
|
|
let markers = [];
|
|
|
|
|
|
|
|
|
|
function initMap(btn) {
|
|
|
|
|
// Init map position/zoom. Potentially using what's in the URL search string.
|
|
|
|
|
const params = new URLSearchParams(window.location.search);
|
|
|
|
@ -147,39 +148,39 @@ function updateEligData(map, eligData) {
|
|
|
|
|
}
|
|
|
|
|
let colorMarker = 'black'
|
|
|
|
|
let messageElig = ``
|
|
|
|
|
eligTestApi=`eligtest/ftth?idImm=${building.idImm}&codePostal=${building.codePostal}&axione=${building.aquilenetEligStatus.isEligible}&liazo=${building.fdnEligStatus.isEligible}`
|
|
|
|
|
eligTestApi = `eligtest/ftth?idImm=${building.idImm}&codePostal=${building.codePostal}&axione=${building.aquilenetEligStatus.isEligible}&liazo=${building.fdnEligStatus.isEligible}`
|
|
|
|
|
// éligible chez Aquilenet, lien pour le test
|
|
|
|
|
if (building.aquilenetEligStatus.isEligible) {
|
|
|
|
|
messageElig = `<p class=deployeeAquilenet>Fibre deployee et disponible par Aquilenet !</p>`
|
|
|
|
|
const zip=encodeURIComponent(building.codePostal);
|
|
|
|
|
const idImm=encodeURIComponent(building.idImm);
|
|
|
|
|
messageElig += `<br/><a href=${urlTestFTTH}?ftth=1&axione=1&adsltel=NOUVEAU&cp=${zip}&refimmeuble=${idImm}`
|
|
|
|
|
+ `>Tester l'éligibilité</a>`
|
|
|
|
|
const zip = encodeURIComponent(building.codePostal);
|
|
|
|
|
const idImm = encodeURIComponent(building.idImm);
|
|
|
|
|
messageElig += `<br/><a href=${urlTestFTTH}?ftth=1&axione=1&adsltel=NOUVEAU&cp=${zip}&refimmeuble=${idImm}` +
|
|
|
|
|
`>Tester l'éligibilité</a>`
|
|
|
|
|
colorMarker = 'green'
|
|
|
|
|
// pas de données Axione mais Kosc nous renvoie qque chose à cette adresse (fdnEligStatus)
|
|
|
|
|
// c'est peut être OK, on croise avec les données ARCEP (othersEligStatus)
|
|
|
|
|
// Enfin on affiche un lien vers le test d'éligibilté KOSC à cette adresse
|
|
|
|
|
// pas de données Axione mais Kosc nous renvoie qque chose à cette adresse (fdnEligStatus)
|
|
|
|
|
// c'est peut être OK, on croise avec les données ARCEP (othersEligStatus)
|
|
|
|
|
// Enfin on affiche un lien vers le test d'éligibilté KOSC à cette adresse
|
|
|
|
|
} else if (building.fdnEligStatus.isEligible && building.othersEligStatus.isEligible) {
|
|
|
|
|
messageElig = `<p class=deployeeFDN>Fibre deployee mais pas chez Axione !`
|
|
|
|
|
messageElig += `<br/><a href=${eligTestApi}>Tester l'eligibilite par Kosc et Bouygues</a></p>`
|
|
|
|
|
colorMarker = 'orange'
|
|
|
|
|
// Pas de données Kosc ou Axione mais l'ARCEP nous dit qu'une fibre est déployée à cette adresse
|
|
|
|
|
// Pas de données Kosc ou Axione mais l'ARCEP nous dit qu'une fibre est déployée à cette adresse
|
|
|
|
|
} else if (building.othersEligStatus.isEligible) {
|
|
|
|
|
messageElig = `<p class=deployeeAutres>Fibre deployee mais non eligible Aquilenet, desole :(</p>`
|
|
|
|
|
colorMarker = 'red'
|
|
|
|
|
// Pas de fibre il semblerait, proposer un test ADSL Aquilenet
|
|
|
|
|
// Pas de fibre il semblerait, proposer un test ADSL Aquilenet
|
|
|
|
|
} else {
|
|
|
|
|
messageElig = `<p class=nonDeployee>Fibre non deployee :(</p>`
|
|
|
|
|
const zip=encodeURIComponent(building.codePostal);
|
|
|
|
|
const comm=encodeURIComponent(building.commune);
|
|
|
|
|
const zip = encodeURIComponent(building.codePostal);
|
|
|
|
|
const comm = encodeURIComponent(building.commune);
|
|
|
|
|
let convertType = streetTypeConversion.get(building.typeVoieImm.toLowerCase());
|
|
|
|
|
if (! convertType) {
|
|
|
|
|
if (!convertType) {
|
|
|
|
|
convertType = building.typeVoieImm;
|
|
|
|
|
}
|
|
|
|
|
const street=encodeURIComponent(`${convertType} ${building.nomVoieImm}`)
|
|
|
|
|
const street_nb=encodeURIComponent(building.numVoieImm)
|
|
|
|
|
messageElig += `<br/><a href=${urlADSL}?zip=${zip}&city=${comm}&street=${street}&street_nb=${street_nb}&gps=&do=1&submit=Valider`
|
|
|
|
|
+ `>Tester ADSL a cette adresse</a>`
|
|
|
|
|
const street = encodeURIComponent(`${convertType} ${building.nomVoieImm}`)
|
|
|
|
|
const street_nb = encodeURIComponent(building.numVoieImm)
|
|
|
|
|
messageElig += `<br/><a href=${urlADSL}?zip=${zip}&city=${comm}&street=${street}&street_nb=${street_nb}&gps=&do=1&submit=Valider` +
|
|
|
|
|
`>Tester ADSL a cette adresse</a>`
|
|
|
|
|
if (building.othersEligStatus.reasonNotEligible != "") {
|
|
|
|
|
messageElig += `<br/><br/>Status general ARCEP: ${building.othersEligStatus.reasonNotEligible}`
|
|
|
|
|
}
|
|
|
|
@ -196,11 +197,13 @@ function updateEligData(map, eligData) {
|
|
|
|
|
popupAnchor: [1, -34],
|
|
|
|
|
shadowSize: [41, 41]
|
|
|
|
|
});
|
|
|
|
|
const marker = new L.marker(latlng, {icon: markerIcon})
|
|
|
|
|
.bindPopup(`${addrImm}<br/>${building.codePostal} ${building.commune}`
|
|
|
|
|
+ `<br/><br/>${messageElig}<br/><br/>Ref Immeuble: ${building.idImm}`, {
|
|
|
|
|
maxWidth : 560
|
|
|
|
|
});
|
|
|
|
|
const marker = new L.marker(latlng, {
|
|
|
|
|
icon: markerIcon
|
|
|
|
|
})
|
|
|
|
|
.bindPopup(`${addrImm}<br/>${building.codePostal} ${building.commune}` +
|
|
|
|
|
`<br/><br/>${messageElig}<br/><br/>Ref Immeuble: ${building.idImm}`, {
|
|
|
|
|
maxWidth: 560
|
|
|
|
|
});
|
|
|
|
|
map.addLayer(marker);
|
|
|
|
|
return marker
|
|
|
|
|
});
|
|
|
|
@ -214,13 +217,12 @@ function updateUrl(map) {
|
|
|
|
|
async function fetchEligData(map) {
|
|
|
|
|
const zoom = map.getZoom();
|
|
|
|
|
if (zoom >= minZoomForRequest) {
|
|
|
|
|
const mc = map.getCenter();
|
|
|
|
|
const bounds = map.getBounds();
|
|
|
|
|
const sw = bounds.getSouthWest();
|
|
|
|
|
const ne = bounds.getNorthEast();
|
|
|
|
|
const btn = document.getElementById("btn-load-elig-data");
|
|
|
|
|
waitBtn(btn);
|
|
|
|
|
const reqUri = encodeURI(`eligdata?swx=${sw.lng}&swy=${sw.lat}&nex=${ne.lng}&ney=${ne.lat}¢erlat=${mc.lat}¢erlng=${mc.lng}`);
|
|
|
|
|
const reqUri = encodeURI(`eligdata?swx=${sw.lng}&swy=${sw.lat}&nex=${ne.lng}&ney=${ne.lat}`);
|
|
|
|
|
const source = await fetch(reqUri);
|
|
|
|
|
const eligData = await source.json();
|
|
|
|
|
updateEligData(map, eligData);
|
|
|
|
@ -246,6 +248,7 @@ function hideBtn(btn) {
|
|
|
|
|
btn.disabled = true;
|
|
|
|
|
btn.title = "Veuillez zoomer plus la carte avant de lancer une recherche d'éligibilité.";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function waitBtn(btn) {
|
|
|
|
|
btn.disabled = true;
|
|
|
|
|
btn.title = "Chargement des batiments...";
|
|
|
|
@ -254,4 +257,4 @@ function waitBtn(btn) {
|
|
|
|
|
|
|
|
|
|
const btn = initBtn();
|
|
|
|
|
const map = initMap(btn);
|
|
|
|
|
const addrSearch = initAddrSearch(map);
|
|
|
|
|
const addrSearch = initAddrSearch(map);
|