ajout de la sélection de formations et correction des composants riot
This commit is contained in:
+25
-12
@@ -3,6 +3,8 @@
|
||||
<h1>Mini projet Parcoursup</h1>
|
||||
<p class="subtitle">Recherche de formations Parcoursup avec Riot</p>
|
||||
|
||||
<p><b>{ state.selectedFormations.length }</b> formation(s) sélectionnée(s)</p>
|
||||
|
||||
<div if={ !state.selected }>
|
||||
<search-bar onsearch={ launchSearch }></search-bar>
|
||||
|
||||
@@ -11,11 +13,22 @@
|
||||
results={ state.results }
|
||||
hasSearched={ state.hasSearched }
|
||||
loading={ state.loading }
|
||||
ondetail={ showDetail }>
|
||||
ondetail={ showDetail }
|
||||
onselect={ addToSelection }>
|
||||
</result-list>
|
||||
|
||||
<map-view results={ state.results }></map-view>
|
||||
</div>
|
||||
|
||||
<div class="detail-card" if={ state.selectedFormations.length > 0 }>
|
||||
<h3>Formations sélectionnées</h3>
|
||||
|
||||
<div each={ f in state.selectedFormations }>
|
||||
<p>
|
||||
<b>{ f.nom }</b> — { f.ville } — taux : { f.tauxAcces }%
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div if={ state.selected }>
|
||||
@@ -32,7 +45,7 @@
|
||||
loading: false,
|
||||
hasSearched: false,
|
||||
results: [],
|
||||
selected: null
|
||||
selected: null,
|
||||
selectedFormations: []
|
||||
},
|
||||
|
||||
@@ -80,17 +93,17 @@
|
||||
|
||||
let exists = false
|
||||
|
||||
for (let i = 0; i < selection.length; i++) {
|
||||
if (selection[i].id === formation.id) {
|
||||
exists = true
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < selection.length; i++) {
|
||||
if (selection[i].id === formation.id) {
|
||||
exists = true
|
||||
}
|
||||
}
|
||||
|
||||
if (!exists) {
|
||||
selection.push(formation)
|
||||
this.update({ selectedFormations: selection })
|
||||
}
|
||||
},
|
||||
if (!exists) {
|
||||
selection.push(formation)
|
||||
this.update({ selectedFormations: selection })
|
||||
}
|
||||
},
|
||||
|
||||
backToList() {
|
||||
this.update({
|
||||
|
||||
Reference in New Issue
Block a user