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>
|
<h1>Mini projet Parcoursup</h1>
|
||||||
<p class="subtitle">Recherche de formations Parcoursup avec Riot</p>
|
<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 }>
|
<div if={ !state.selected }>
|
||||||
<search-bar onsearch={ launchSearch }></search-bar>
|
<search-bar onsearch={ launchSearch }></search-bar>
|
||||||
|
|
||||||
@@ -11,11 +13,22 @@
|
|||||||
results={ state.results }
|
results={ state.results }
|
||||||
hasSearched={ state.hasSearched }
|
hasSearched={ state.hasSearched }
|
||||||
loading={ state.loading }
|
loading={ state.loading }
|
||||||
ondetail={ showDetail }>
|
ondetail={ showDetail }
|
||||||
|
onselect={ addToSelection }>
|
||||||
</result-list>
|
</result-list>
|
||||||
|
|
||||||
<map-view results={ state.results }></map-view>
|
<map-view results={ state.results }></map-view>
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
<div if={ state.selected }>
|
<div if={ state.selected }>
|
||||||
@@ -32,7 +45,7 @@
|
|||||||
loading: false,
|
loading: false,
|
||||||
hasSearched: false,
|
hasSearched: false,
|
||||||
results: [],
|
results: [],
|
||||||
selected: null
|
selected: null,
|
||||||
selectedFormations: []
|
selectedFormations: []
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -80,17 +93,17 @@
|
|||||||
|
|
||||||
let exists = false
|
let exists = false
|
||||||
|
|
||||||
for (let i = 0; i < selection.length; i++) {
|
for (let i = 0; i < selection.length; i++) {
|
||||||
if (selection[i].id === formation.id) {
|
if (selection[i].id === formation.id) {
|
||||||
exists = true
|
exists = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
selection.push(formation)
|
selection.push(formation)
|
||||||
this.update({ selectedFormations: selection })
|
this.update({ selectedFormations: selection })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
backToList() {
|
backToList() {
|
||||||
this.update({
|
this.update({
|
||||||
|
|||||||
@@ -14,7 +14,9 @@
|
|||||||
<p><b>Ville :</b> { f.ville } ({ f.departement })</p>
|
<p><b>Ville :</b> { f.ville } ({ f.departement })</p>
|
||||||
<p><b>Filière :</b> { f.filiere }</p>
|
<p><b>Filière :</b> { f.filiere }</p>
|
||||||
<p><b>Taux d'accès :</b> { f.tauxAcces }%</p>
|
<p><b>Taux d'accès :</b> { f.tauxAcces }%</p>
|
||||||
|
|
||||||
<button onclick={ () => props.ondetail(i) }>Voir détail</button>
|
<button onclick={ () => props.ondetail(i) }>Voir détail</button>
|
||||||
|
<button onclick={ () => props.onselect(i) }>Ajouter à la sélection</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</result-list>
|
</result-list>
|
||||||
Reference in New Issue
Block a user