2026.camp.carte/js/feature-widgets/capacite-espace.js

28 lines
No EOL
957 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function exclude(feature){
return feature.properties["Parking"] ||
feature.properties["n couchage"];
}
export function capaciteEspaceWidget(feature){
let capacityValue = feature.properties["capacity"] || feature.properties["capacite"]
if((capacityValue !== undefined && capacityValue !== null) && !(exclude(feature))){
let content = document.createElement("div")
content.classList.add("widget")
content.classList.add("table-widget")
content.classList.add("capacite-espace-widget")
let fielName = document.createElement("h2");
fielName.textContent = "Capacité :"
content.append(fielName)
let value = document.createElement("p");
if(capacityValue > 1){
value.textContent = `${capacityValue} personnes`
} else {
value.textContent = `${capacityValue} personne`
}
content.append(value)
return content
}
}