ajout du style global et de la carte leaflet

This commit is contained in:
2026-03-18 13:21:19 +01:00
parent 43d0cf4abe
commit c97bda935e
7 changed files with 196 additions and 34 deletions
+1 -3
View File
@@ -1,6 +1,5 @@
<detail-view>
<div if={ props.formation }
style="border:1px solid #ccc; padding:10px; margin:10px;">
<div if={ props.formation } class="detail-card">
<h2>{ props.formation.nom }</h2>
<p><b>Établissement :</b> { props.formation.etablissement }</p>
<p><b>Ville :</b> { props.formation.ville }</p>
@@ -11,7 +10,6 @@
<p><b>Candidats :</b> { props.formation.candidats }</p>
<p><b>Admis :</b> { props.formation.admis }</p>
<p><b>Taux d'accès :</b> { props.formation.tauxAcces }%</p>
<button onclick={ () => props.onback() }>Retour</button>
</div>
</detail-view>
+53
View File
@@ -0,0 +1,53 @@
<map-view>
<div class="map-box">
<h3>Carte des formations</h3>
<div id="map"></div>
</div>
<script>
export default {
onMounted() {
this.map = L.map(this.root.querySelector('#map')).setView([46.8, 2.5], 6)
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap contributors'
}).addTo(this.map)
this.markersLayer = L.layerGroup().addTo(this.map)
this.refreshMarkers()
},
onUpdated() {
this.refreshMarkers()
},
refreshMarkers() {
if (!this.map || !this.markersLayer) {
return
}
this.markersLayer.clearLayers()
const points = []
for (let i = 0; i < this.props.results.length; i++) {
const f = this.props.results[i]
if (f.latitude && f.longitude) {
const marker = L.marker([f.latitude, f.longitude])
marker.bindPopup(`<b>${f.nom}</b><br>${f.ville}`)
marker.addTo(this.markersLayer)
points.push([f.latitude, f.longitude])
}
}
if (points.length > 0) {
this.map.fitBounds(points, { padding: [20, 20] })
} else {
this.map.setView([46.8, 2.5], 6)
}
}
}
</script>
</map-view>
+4 -4
View File
@@ -1,14 +1,14 @@
<result-list>
<div>
<div if={ props.results.length === 0 && props.hasSearched && !props.loading }>
<div class="results">
<div class="message" if={ props.results.length === 0 && props.hasSearched && !props.loading }>
Aucun résultat trouvé
</div>
<div if={ props.loading }>
<div class="message" if={ props.loading }>
Chargement...
</div>
<div each={ (f, i) in props.results } key={ f.id } style="border:1px solid #ccc; padding:10px; margin:10px;">
<div each={ (f, i) in props.results } key={ f.id } class="card">
<h3>{ f.nom }</h3>
<p><b>Établissement :</b> { f.etablissement }</p>
<p><b>Ville :</b> { f.ville } ({ f.departement })</p>
+1 -1
View File
@@ -1,5 +1,5 @@
<search-bar>
<div>
<div class="search-bar">
<input
type="text"
placeholder="Ex : BUT informatique"