feat: Ajout des données P4Pillon
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is failing

This commit is contained in:
2023-03-02 11:11:50 +01:00
parent db020a2e78
commit bec1b4aa82
7 changed files with 277 additions and 24 deletions

View File

@ -27,7 +27,7 @@
<div id="map" style="width: 100%; height: 100%;"></div>
<script>
<script type="module">
var mappos = L.Permalink.getMapLocation();
var map = L.map('map').setView(mappos.center || [46.55886, 3.21924], mappos.zoom || 6);
L.Permalink.setup(map);
@ -43,30 +43,52 @@
name: 1,
name_long: 2,
dep: 3,
tel: 4,
siret: 5,
x: 6,
y: 7,
adresse: 4,
tel: 5,
siret: 6,
x: 7,
y: 8,
}
var json = fetch('./data.json').then(response => {
return response.json();
})
.then(jsondata => {
var markersCluster = new L.MarkerClusterGroup();
for (const msp of jsondata) {
const marker = L
.marker([msp[columns.x], msp[columns.y]])
.bindPopup(
(msp[columns.name_long] ? msp[columns.name_long] : msp[columns.name]) + " (" + msp[columns.dep] + ")<br>" +
"Établissement FINESS N°" + msp[columns.finessET] + "<br>" +
(msp[columns.siret] != null ? "SIREN : <a rel='noreferrer' target='_blank' href='https://data.inpi.fr/entreprises/" + msp[columns.siret].substring(0, 9) + "'>" + msp[columns.siret].substring(0, 9) + "</a><br>" : "") +
(msp[columns.tel] != null ? "<a href='tel:" + msp[columns.tel] + "'>" + msp[columns.tel] + "</a>" : "")
);
markersCluster.addLayer(marker);
}
map.addLayer(markersCluster);
});
async function getDataP4Pillon() {
const data = await fetch('./data_p4pillon.json')
return data.json()
}
async function getData() {
const data = await fetch('./data.json')
return data.json()
}
function getPopup(msp, dataP4Pillon) {
console.log(dataP4Pillon)
const nom = dataP4Pillon ? dataP4Pillon[0] : (msp[columns.name_long] ? msp[columns.name_long] : msp[columns.name])
const dep = msp[columns.dep]
const adresse = msp[columns.adresse]
return nom + " (" + dep + ")" +
"<br>Établissement FINESS N°" + msp[columns.finessET] +
(msp[columns.siret] != null ? "<br>SIREN : <a rel='noreferrer' target='_blank' href='https://data.inpi.fr/entreprises/" + msp[columns.siret].substring(0, 9) + "'>" + msp[columns.siret].substring(0, 9) + "</a>" : "") +
(msp[columns.tel] != null ? "<br><a href='tel:" + msp[columns.tel] + "'>" + msp[columns.tel] + "</a>" : "") +
(dataP4Pillon ? "<br>" +
(dataP4Pillon[1] || dataP4Pillon[2] ? "<br>Leader : " + dataP4Pillon[1] + " " + dataP4Pillon[2] : "") +
(dataP4Pillon[3] ? "<br>Adhérent à l'association AVEC Santé : ✅" : "") +
(dataP4Pillon[4] ? "<br>Accord conventionnel interprofessionnel : ✅" : "")
: "")
}
var data = await getData()
var dataP4Pillon = await getDataP4Pillon()
var markersCluster = new L.MarkerClusterGroup();
for (const msp of data) {
const marker = L
.marker([msp[columns.x], msp[columns.y]])
.bindPopup(
getPopup(msp, dataP4Pillon[msp[columns.finessET]])
);
markersCluster.addLayer(marker);
}
map.addLayer(markersCluster);
</script>
</body>
</html>