mAj
This commit is contained in:
@@ -16,12 +16,17 @@
|
||||
}).addTo(this.map)
|
||||
|
||||
this.markersLayer = L.layerGroup().addTo(this.map)
|
||||
this.markersById = {}
|
||||
this.refreshMarkers()
|
||||
|
||||
// important : Leaflet calcule parfois mal la taille au montage
|
||||
setTimeout(() => {
|
||||
this.map.invalidateSize()
|
||||
}, 100)
|
||||
|
||||
// Exposer globalement pour que result-list puisse appeler
|
||||
window.mapFocus = (id) => {
|
||||
this.focusFormation(id)
|
||||
}
|
||||
},
|
||||
|
||||
onUpdated() {
|
||||
@@ -39,6 +44,7 @@
|
||||
this.map.remove()
|
||||
this.map = null
|
||||
}
|
||||
window.mapFocus = null
|
||||
},
|
||||
|
||||
refreshMarkers() {
|
||||
@@ -47,6 +53,7 @@
|
||||
}
|
||||
|
||||
this.markersLayer.clearLayers()
|
||||
this.markersById = {}
|
||||
|
||||
const points = []
|
||||
const results = this.props.results || []
|
||||
@@ -56,9 +63,10 @@
|
||||
|
||||
if (f.latitude != null && f.longitude != null) {
|
||||
const marker = L.marker([f.latitude, f.longitude])
|
||||
marker.bindPopup(`<b>${f.nom}</b><br>${f.ville}`)
|
||||
marker.bindPopup('<b>' + f.nom + '</b><br>' + f.ville)
|
||||
marker.addTo(this.markersLayer)
|
||||
|
||||
this.markersById[f.id] = marker
|
||||
points.push([f.latitude, f.longitude])
|
||||
}
|
||||
}
|
||||
@@ -68,7 +76,25 @@
|
||||
} else {
|
||||
this.map.setView([46.8, 2.5], 6)
|
||||
}
|
||||
},
|
||||
|
||||
focusFormation(id) {
|
||||
var marker = this.markersById[id]
|
||||
|
||||
if (marker && this.map) {
|
||||
// Scroll vers la carte
|
||||
var mapEl = this.$('div[ref="map"]')
|
||||
if (mapEl) {
|
||||
mapEl.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
}
|
||||
|
||||
// Zoom sur le marqueur et ouvrir le popup
|
||||
setTimeout(() => {
|
||||
this.map.setView(marker.getLatLng(), 13, { animate: true })
|
||||
marker.openPopup()
|
||||
}, 400)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</map-view>
|
||||
</map-view>
|
||||
|
||||
@@ -17,6 +17,17 @@
|
||||
|
||||
<button onclick={ () => props.ondetail(i) }>Voir détail</button>
|
||||
<button onclick={ () => props.onselect(i) }>Ajouter à la sélection</button>
|
||||
<button onclick={ () => locateOnMap(f) } if={ f.latitude != null }>Localiser</button>
|
||||
</div>
|
||||
</div>
|
||||
</result-list>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
locateOnMap(f) {
|
||||
if (window.mapFocus) {
|
||||
window.mapFocus(f.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</result-list>
|
||||
|
||||
@@ -2,26 +2,133 @@
|
||||
<div class="search-bar">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Ex : BUT informatique"
|
||||
placeholder="Ex : BUT informatique, Licence droit..."
|
||||
oninput={ updateQuery }
|
||||
value={ state.query }
|
||||
onkeydown={ handleKey }
|
||||
/>
|
||||
<button onclick={ submitSearch }>Rechercher</button>
|
||||
</div>
|
||||
|
||||
<div class="filters-toggle">
|
||||
<button class="btn btn-small btn-outline" onclick={ toggleFilters }>
|
||||
{ state.showFilters ? 'Masquer les filtres' : 'Filtres avancés' }
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="filters-panel" if={ state.showFilters }>
|
||||
<div class="filter-row">
|
||||
<div class="filter-item">
|
||||
<label>Type de formation</label>
|
||||
<select onchange={ updateFiliere }>
|
||||
<option value="">Tous</option>
|
||||
<option value="BTS">BTS</option>
|
||||
<option value="BUT">BUT</option>
|
||||
<option value="Licence">Licence</option>
|
||||
<option value="Licence_Las">Licence - L.AS</option>
|
||||
<option value="CPGE">CPGE</option>
|
||||
<option value="BTS Agricole">BTS Agricole</option>
|
||||
<option value="DN MADE">DN MADE</option>
|
||||
<option value="DCG">DCG</option>
|
||||
<option value="Ecole de Commerce">École de Commerce</option>
|
||||
<option value="Ecole d'Ingénieurs">École d'Ingénieurs</option>
|
||||
<option value="IFSI">IFSI</option>
|
||||
<option value="PASS">PASS</option>
|
||||
<option value="EFTS">EFTS</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-item">
|
||||
<label>Sélectivité</label>
|
||||
<select onchange={ updateSelectivite }>
|
||||
<option value="">Toutes</option>
|
||||
<option value="formation sélective">Sélective</option>
|
||||
<option value="formation non sélective">Non sélective</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="filter-item">
|
||||
<label>Région</label>
|
||||
<select onchange={ updateRegion }>
|
||||
<option value="">Toutes</option>
|
||||
<option value="Auvergne-Rhône-Alpes">Auvergne-Rhône-Alpes</option>
|
||||
<option value="Bourgogne-Franche-Comté">Bourgogne-Franche-Comté</option>
|
||||
<option value="Bretagne">Bretagne</option>
|
||||
<option value="Centre-Val de Loire">Centre-Val de Loire</option>
|
||||
<option value="Corse">Corse</option>
|
||||
<option value="Grand Est">Grand Est</option>
|
||||
<option value="Guadeloupe">Guadeloupe</option>
|
||||
<option value="Guyane">Guyane</option>
|
||||
<option value="Hauts-de-France">Hauts-de-France</option>
|
||||
<option value="Ile-de-France">Île-de-France</option>
|
||||
<option value="La Réunion">La Réunion</option>
|
||||
<option value="Martinique">Martinique</option>
|
||||
<option value="Mayotte">Mayotte</option>
|
||||
<option value="Normandie">Normandie</option>
|
||||
<option value="Nouvelle-Aquitaine">Nouvelle-Aquitaine</option>
|
||||
<option value="Occitanie">Occitanie</option>
|
||||
<option value="Pays de la Loire">Pays de la Loire</option>
|
||||
<option value="Provence-Alpes-Côte d'Azur">PACA</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filter-row">
|
||||
<div class="filter-item">
|
||||
<label>Taux d'accès min (%)</label>
|
||||
<input type="number" min="0" max="100" value={ state.tauxMin } oninput={ updateTauxMin } placeholder="0" />
|
||||
</div>
|
||||
|
||||
<div class="filter-item">
|
||||
<label>Taux d'accès max (%)</label>
|
||||
<input type="number" min="0" max="100" value={ state.tauxMax } oninput={ updateTauxMax } placeholder="100" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
state: {
|
||||
query: ''
|
||||
query: '',
|
||||
showFilters: false,
|
||||
filiere: '',
|
||||
selectivite: '',
|
||||
region: '',
|
||||
tauxMin: 0,
|
||||
tauxMax: 100
|
||||
},
|
||||
|
||||
updateQuery(e) {
|
||||
this.update({ query: e.target.value })
|
||||
},
|
||||
|
||||
handleKey(e) {
|
||||
if (e.key === 'Enter') {
|
||||
this.submitSearch()
|
||||
}
|
||||
},
|
||||
|
||||
toggleFilters() {
|
||||
this.update({ showFilters: !this.state.showFilters })
|
||||
},
|
||||
|
||||
updateFiliere(e) { this.update({ filiere: e.target.value }) },
|
||||
updateSelectivite(e) { this.update({ selectivite: e.target.value }) },
|
||||
updateRegion(e) { this.update({ region: e.target.value }) },
|
||||
updateTauxMin(e) { this.update({ tauxMin: Number(e.target.value) }) },
|
||||
updateTauxMax(e) { this.update({ tauxMax: Number(e.target.value) }) },
|
||||
|
||||
submitSearch() {
|
||||
this.props.onsearch(this.state.query)
|
||||
var filters = {
|
||||
filiere: this.state.filiere,
|
||||
selectivite: this.state.selectivite,
|
||||
region: this.state.region,
|
||||
tauxMin: this.state.tauxMin,
|
||||
tauxMax: this.state.tauxMax
|
||||
}
|
||||
|
||||
this.props.onsearch(this.state.query, filters)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</search-bar>
|
||||
</search-bar>
|
||||
|
||||
Reference in New Issue
Block a user