2023-03-25 16:31:36 +01:00
|
|
|
<search>
|
2023-03-28 13:06:28 +02:00
|
|
|
<div class="box p-1 m-2">
|
|
|
|
<div class="columns m-1">
|
2023-03-29 16:50:48 +02:00
|
|
|
<input onkeydown={filterSearch} onfocusout={filterSearch} class="input" type="input" placeholder={state.placeholder}>
|
|
|
|
<button class="button ml-1" disabled={!state.currentStep} onclick={cruiseBack}><</button>
|
2023-03-28 13:06:28 +02:00
|
|
|
</div>
|
2023-03-25 16:31:36 +01:00
|
|
|
<div id="list-formations">
|
2023-03-26 15:03:06 +02:00
|
|
|
<ul>
|
2023-03-28 13:06:28 +02:00
|
|
|
<li class="m-1" each={item in this.state.items}>
|
2023-03-29 16:50:48 +02:00
|
|
|
<button class="button is-fullwidth" onclick={()=>cruiseForward(item.name)}>
|
2023-03-28 13:42:53 +02:00
|
|
|
<span style="font-size: .75em;"><strong>{item.name}</strong></span>
|
2023-03-28 13:06:28 +02:00
|
|
|
<div style="margin-left: auto;"></div>
|
|
|
|
<span class="tag is-primary">{item.count}</span>
|
|
|
|
</button>
|
2023-03-26 15:03:06 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
2023-03-25 16:31:36 +01:00
|
|
|
</div>
|
2023-03-28 13:06:28 +02:00
|
|
|
</div>
|
2023-03-25 16:31:36 +01:00
|
|
|
<script>
|
2023-03-28 00:48:55 +02:00
|
|
|
import PAPI from '../javascript/parcoursup-link.js'
|
2023-03-26 15:03:06 +02:00
|
|
|
|
2023-03-29 16:50:48 +02:00
|
|
|
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`
|
2023-03-27 20:19:59 +02:00
|
|
|
|
2023-03-27 21:22:11 +02:00
|
|
|
async function fetchFiliere(state) {
|
|
|
|
if (state.sousfili){
|
2023-03-28 00:48:55 +02:00
|
|
|
return PAPI.fetchSpecialites(state.sousfili)
|
2023-03-29 16:50:48 +02:00
|
|
|
} else if (state.fili && !state.sousfili){
|
2023-03-28 00:48:55 +02:00
|
|
|
return PAPI.fetchFiliere(state.fili)
|
2023-03-29 16:50:48 +02:00
|
|
|
} else if (!state.fili && !state.sousfili){
|
2023-03-28 00:48:55 +02:00
|
|
|
return PAPI.fetchFilieres()
|
2023-03-27 21:22:11 +02:00
|
|
|
}
|
2023-03-26 15:03:06 +02:00
|
|
|
}
|
2023-03-29 16:50:48 +02:00
|
|
|
|
2023-03-26 15:03:06 +02:00
|
|
|
|
2023-03-25 16:31:36 +01:00
|
|
|
export default function search(){
|
2023-03-26 15:03:06 +02:00
|
|
|
return {
|
|
|
|
onBeforeMount(props, state) {
|
2023-03-29 16:50:48 +02:00
|
|
|
// initial state
|
2023-03-26 15:03:06 +02:00
|
|
|
this.state = {
|
2023-03-27 16:15:49 +02:00
|
|
|
placeholder: "Formation",
|
2023-03-26 22:12:11 +02:00
|
|
|
items: null,
|
2023-03-27 11:16:06 +02:00
|
|
|
allitems: null,
|
2023-03-27 16:15:49 +02:00
|
|
|
fili: null,
|
|
|
|
sousfili: null
|
2023-03-26 15:03:06 +02:00
|
|
|
}
|
2023-03-27 21:22:11 +02:00
|
|
|
fetchFiliere(this.state).then((response) => {
|
2023-03-26 15:03:06 +02:00
|
|
|
this.update({
|
2023-03-26 22:12:11 +02:00
|
|
|
items: response,
|
|
|
|
allitems: response
|
2023-03-26 15:03:06 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
2023-03-26 22:12:11 +02:00
|
|
|
searchF(e){
|
|
|
|
let responseFiltered=[]
|
|
|
|
this.state.allitems.forEach(formation => {
|
2023-03-27 11:16:06 +02:00
|
|
|
if (formation.name.toUpperCase().includes(e.target.value.toUpperCase())) {
|
2023-03-26 22:12:11 +02:00
|
|
|
responseFiltered.push(formation)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.update({
|
|
|
|
items: responseFiltered
|
|
|
|
})
|
2023-03-27 11:16:06 +02:00
|
|
|
},
|
|
|
|
filter(fili){
|
|
|
|
console.log("filter! "+fili)
|
2023-03-27 16:15:49 +02:00
|
|
|
if (this.state.placeholder==="Filière de formation"){
|
2023-03-27 11:16:06 +02:00
|
|
|
this.update({
|
2023-03-27 16:15:49 +02:00
|
|
|
placeholder: "Filière de formation détaillée",
|
|
|
|
sousfili: fili,
|
|
|
|
})
|
2023-03-27 20:19:59 +02:00
|
|
|
} else if (this.state.placeholder="Formation"){
|
2023-03-27 11:16:06 +02:00
|
|
|
this.update({
|
2023-03-27 16:15:49 +02:00
|
|
|
placeholder: "Filière de formation",
|
2023-03-27 20:19:59 +02:00
|
|
|
fili: fili
|
|
|
|
})
|
2023-03-27 11:16:06 +02:00
|
|
|
}
|
2023-03-27 21:22:11 +02:00
|
|
|
fetchFiliere(this.state).then((response) => {
|
|
|
|
this.update({
|
|
|
|
allitems: response,
|
|
|
|
items: response
|
|
|
|
})
|
|
|
|
console.log(this.state.items)
|
|
|
|
})
|
2023-03-27 20:19:59 +02:00
|
|
|
},
|
|
|
|
back(){
|
|
|
|
console.log("back")
|
|
|
|
if (this.state.placeholder==="Filière de formation"){
|
2023-03-27 11:16:06 +02:00
|
|
|
this.update({
|
2023-03-27 20:19:59 +02:00
|
|
|
placeholder: "Formation",
|
|
|
|
fili: null,
|
|
|
|
})
|
|
|
|
} else if (this.state.placeholder="Filière de formation détaillée"){
|
|
|
|
this.update({
|
|
|
|
placeholder: "Filière de formation",
|
|
|
|
sousfili: null
|
|
|
|
})
|
|
|
|
}
|
2023-03-27 21:22:11 +02:00
|
|
|
fetchFiliere(this.state).then((response) => {
|
|
|
|
this.update({
|
|
|
|
allitems: response,
|
|
|
|
items: response
|
|
|
|
})
|
|
|
|
})
|
2023-03-25 16:31:36 +01:00
|
|
|
}
|
|
|
|
}
|
2023-03-29 16:50:48 +02:00
|
|
|
}*/
|
2023-03-25 16:31:36 +01:00
|
|
|
</script>
|
|
|
|
</search>
|