search.riot refactor WIP
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
<school>
|
||||
<main class="container">
|
||||
<div class="block control has-icons-left is-inline-block is-pulled-right">
|
||||
<input class="input" type="search" placeholder="Établissement">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-search"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="box p-2 m-2">
|
||||
<iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&layer=mapnik" style="border-radius: 5px;"></iframe>
|
||||
<br>
|
||||
<div class="block control has-icons-left is-inline-block is-pulled-right">
|
||||
<input class="input" type="search" placeholder="Établissement">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-search"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +31,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -51,7 +54,7 @@
|
||||
this.update({
|
||||
items: response
|
||||
})
|
||||
console.log(this.state.items)
|
||||
//console.log(this.state.items)
|
||||
this.state.items.forEach(etablissement => {
|
||||
// calcul la moyenne
|
||||
let pct_sansmention = etablissement.fields.pct_sansmention
|
||||
@@ -60,10 +63,12 @@
|
||||
let pct_TB = etablissement.fields.pct_tb
|
||||
let pct_TBF = etablissement.fields.pct_tbf
|
||||
|
||||
let moyenne = ((pct_TBF*18)+(pct_TB*16)+(pct_B*14)+(pct_AB*12)+(pct_sansmention*10))/100
|
||||
// On prend la moyenne des moyennes comprises dans la mention
|
||||
// Exemple : Assez bien est entre 12 et 14 donc 13.
|
||||
let moyenne = ((pct_TBF*19)+(pct_TB*17)+(pct_B*15)+(pct_AB*13)+(pct_sansmention*11g))/100
|
||||
|
||||
etablissement.fields.moyenne=moyenne
|
||||
console.log(etablissement.fields)
|
||||
//console.log(etablissement.fields)
|
||||
})
|
||||
this.update()
|
||||
})
|
||||
|
@@ -1,13 +1,13 @@
|
||||
<search>
|
||||
<div class="box p-1 m-2">
|
||||
<div class="columns m-1">
|
||||
<input onkeydown={searchF} class="input" type="input" placeholder={state.placeholder}>
|
||||
<button class="button ml-1" onclick={back}><</button>
|
||||
<input onkeydown={filterSearch} onfocusout={filterSearch} class="input" type="input" placeholder={state.placeholder}>
|
||||
<button class="button ml-1" disabled={!state.currentStep} onclick={cruiseBack}><</button>
|
||||
</div>
|
||||
<div id="list-formations">
|
||||
<ul>
|
||||
<li class="m-1" each={item in this.state.items}>
|
||||
<button class="button is-fullwidth" onclick={()=>filter(item.name)}>
|
||||
<button class="button is-fullwidth" onclick={()=>cruiseForward(item.name)}>
|
||||
<span style="font-size: .75em;"><strong>{item.name}</strong></span>
|
||||
<div style="margin-left: auto;"></div>
|
||||
<span class="tag is-primary">{item.count}</span>
|
||||
@@ -19,28 +19,57 @@
|
||||
<script>
|
||||
import PAPI from '../javascript/parcoursup-link.js'
|
||||
|
||||
const searchURL = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&timezone=Europe%2FBerlin`
|
||||
function cruiseBack() {
|
||||
|
||||
}
|
||||
|
||||
function cruiseForward() {
|
||||
|
||||
}
|
||||
|
||||
function filterSearch() {
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
onBeforeMount(props, state) {
|
||||
//Initial state
|
||||
this.state = {
|
||||
placeholder: "Formation",
|
||||
currentStep: 0,
|
||||
allItems: null,
|
||||
filter: null,
|
||||
items: null
|
||||
}
|
||||
|
||||
PAPI.fetchFilieres().then((response) => {
|
||||
this.state.allItems = response
|
||||
|
||||
this.update({
|
||||
items: filterSearch(this.state.allItems)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*const searchURL = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&timezone=Europe%2FBerlin`
|
||||
|
||||
async function fetchFiliere(state) {
|
||||
if (state.sousfili){
|
||||
return PAPI.fetchSpecialites(state.sousfili)
|
||||
//var request = await fetch(`${searchURL}&rows=0&sort=tri&facet=fil_lib_voe_acc&refine.form_lib_voe_acc=${state.sousfili}`)
|
||||
} else if (state.fili&&!state.sousfili){
|
||||
} else if (state.fili && !state.sousfili){
|
||||
return PAPI.fetchFiliere(state.fili)
|
||||
//var request = await fetch(`${searchURL}&rows=0&sort=tri&facet=form_lib_voe_acc&refine.fili=${state.fili}`)
|
||||
} else if (!state.fili&&!state.sousfili){
|
||||
} else if (!state.fili && !state.sousfili){
|
||||
return PAPI.fetchFilieres()
|
||||
//var request = await fetch(`${searchURL}&rows=0&sort=tri&facet=fili`)
|
||||
}
|
||||
|
||||
//let result = await request.json()
|
||||
//return result["facet_groups"][0]["facets"]
|
||||
}
|
||||
|
||||
|
||||
export default function search(){
|
||||
return {
|
||||
onBeforeMount(props, state) {
|
||||
// initial state
|
||||
// initial state
|
||||
this.state = {
|
||||
placeholder: "Formation",
|
||||
items: null,
|
||||
@@ -108,8 +137,6 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
</script>
|
||||
</search>
|
Reference in New Issue
Block a user