Ajouté quelques widgets
This commit is contained in:
parent
e61c495cc4
commit
9c5c4181b2
8 changed files with 189 additions and 35 deletions
22
js/feature-widgets/capacite-dortoir.js
Normal file
22
js/feature-widgets/capacite-dortoir.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export function capaciteDortoirWidget(feature){
|
||||
if(feature.properties["n couchage"]){
|
||||
let content = document.createElement("div")
|
||||
content.classList.add("widget")
|
||||
content.classList.add("table-widget")
|
||||
content.classList.add("capacite-dortoir-widget")
|
||||
|
||||
let fielName = document.createElement("h2");
|
||||
fielName.textContent = "Capacité :"
|
||||
content.append(fielName)
|
||||
|
||||
let value = document.createElement("p");
|
||||
if(feature.properties["n couchage"] > 1){
|
||||
value.textContent = `${feature.properties["n couchage"]} lits`
|
||||
} else {
|
||||
value.textContent = `${feature.properties["n couchage"]} lit`
|
||||
}
|
||||
content.append(value)
|
||||
|
||||
return content
|
||||
}
|
||||
}
|
||||
28
js/feature-widgets/capacite-espace.js
Normal file
28
js/feature-widgets/capacite-espace.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
22
js/feature-widgets/capacite-parking.js
Normal file
22
js/feature-widgets/capacite-parking.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export function capaciteParkingWidget(feature){
|
||||
if(feature.properties["Parking"] && feature.properties["capacite"]){
|
||||
let content = document.createElement("div")
|
||||
content.classList.add("widget")
|
||||
content.classList.add("table-widget")
|
||||
content.classList.add("capacite-parking-widget")
|
||||
|
||||
let fielName = document.createElement("h2");
|
||||
fielName.textContent = "Capacité :"
|
||||
content.append(fielName)
|
||||
|
||||
let value = document.createElement("p");
|
||||
if(feature.properties["capacite"] > 1){
|
||||
value.textContent = `${feature.properties["capacite"]} places`
|
||||
} else {
|
||||
value.textContent = `${feature.properties["capacite"]} place`
|
||||
}
|
||||
content.append(value)
|
||||
|
||||
return content
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,15 @@
|
|||
import { capaciteDortoirWidget } from "./capacite-dortoir.js"
|
||||
import { capaciteEspaceWidget } from "./capacite-espace.js"
|
||||
import { capaciteParkingWidget } from "./capacite-parking.js"
|
||||
import { mixiteChoisieWidget } from "./mixite-choisie.js"
|
||||
import { zoneInterditeWidget } from "./zone-interdite.js"
|
||||
|
||||
export const FEATURE_WIDGETS = [
|
||||
zoneInterditeWidget
|
||||
capaciteParkingWidget,
|
||||
capaciteDortoirWidget,
|
||||
capaciteEspaceWidget,
|
||||
mixiteChoisieWidget,
|
||||
zoneInterditeWidget,
|
||||
]
|
||||
|
||||
export default FEATURE_WIDGETS
|
||||
24
js/feature-widgets/mixite-choisie.js
Normal file
24
js/feature-widgets/mixite-choisie.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
export function mixiteChoisieWidget(feature){
|
||||
if(feature.properties["mixite-choisie"]){
|
||||
let content = document.createElement("div")
|
||||
content.classList.add("mixite-choisie-widget")
|
||||
content.classList.add("widget")
|
||||
content.classList.add("box-widget")
|
||||
|
||||
let h2 = document.createElement("h2")
|
||||
h2.textContent = "Mixité choisie"
|
||||
content.append(h2)
|
||||
|
||||
if(feature.properties["description-mixite-choisie"]){
|
||||
let description = document.createElement("p")
|
||||
description.textContent = feature.properties["description-mixite-choisie"]
|
||||
content.append(description)
|
||||
} else {
|
||||
let p = document.createElement("p")
|
||||
p.textContent = `Cet espace est en mixité choisie sans mecs cis`
|
||||
content.append(p)
|
||||
}
|
||||
|
||||
return content
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ export function zoneInterditeWidget(feature){
|
|||
let content = document.createElement("div")
|
||||
content.classList.add("zone-interdite-widget")
|
||||
content.classList.add("widget")
|
||||
content.classList.add("box-widget")
|
||||
|
||||
let h2 = document.createElement("h2")
|
||||
h2.textContent = "Zone interdite"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue