merge
This commit is contained in:
commit
486d105064
@ -51,7 +51,6 @@
|
||||
state.selectivity = Math.floor(avgSlc)
|
||||
|
||||
let pctFemmes = Math.round(list.reduce((s, e) => s + (e.fields.pct_f || 0), 0) / list.filter((e) => e.fields.pct_f).length)
|
||||
console.log(pctFemmes)
|
||||
state.genreStats = [
|
||||
{
|
||||
name: "Hommes",
|
||||
|
@ -1,15 +1,15 @@
|
||||
<main-controller>
|
||||
<div class="columns">
|
||||
<div class="column is-one-third">
|
||||
<div class="box p-3 m-2">
|
||||
<img class="mt-1 ml-5 mr-auto" style="margin: auto;" src="./resources/logo-parcoursup.svg"/>
|
||||
<div class="box p-3 m-2" style="display: flex">
|
||||
<img class="m-auto" src="./resources/logo-parcoursup.svg"/>
|
||||
</div>
|
||||
<search updateCourse={updateCourse}></search>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<fili-info schoolList={state.schoolList} course={state.course} shouldShowInfos={state.shouldShowInfos}></fili-info>
|
||||
<school popup={popup} sortList={sortList} schoolList={state.filteredSchoolList} sortFields={state.sortFields} course={state.course} shouldShowInfos={state.shouldShowInfos}></school>
|
||||
<school popup={popup} schoolList={state.schoolList} schoolListUpdating={state.schoolListUpdating} course={state.course} shouldShowInfos={state.shouldShowInfos}></school>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -19,45 +19,16 @@
|
||||
|
||||
import PAPI from '../javascript/parcoursup-link.js'
|
||||
|
||||
const SORT_TABLE = [
|
||||
{name: "Nom", id: "g_ea_lib_vx"},
|
||||
{name: "Ville", id: "ville_etab"},
|
||||
{name: "Département", id: "dep"},
|
||||
{name: "Moyenne", id: "moyenne"},
|
||||
{name: "Sélectivité", id: "taux_acces_ens"}
|
||||
]
|
||||
|
||||
export default {
|
||||
sortList(sortBy) {
|
||||
//Si la liste est déjà triée par la bonne catégorie, on l'inverse
|
||||
if (sortBy == this.state.sortBy) {
|
||||
this.state.filteredSchoolList.reverse()
|
||||
}
|
||||
//Sinon on l'ordonne par la nouvelle catégorie (ascendant par défaut)
|
||||
else {
|
||||
this.state.sortBy = sortBy
|
||||
updateCourse(course){
|
||||
this.updateList(course)
|
||||
|
||||
switch (sortBy) {
|
||||
case SORT_TABLE[3].id:
|
||||
case SORT_TABLE[4].id: {
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
if (a.fields[sortBy] > b.fields[sortBy]) return 1
|
||||
else return -1
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
default: {
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
return (a.fields[sortBy]).localeCompare(b.fields[sortBy])
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.update()
|
||||
this.update({
|
||||
course: course,
|
||||
shouldShowInfos: course != null,
|
||||
})
|
||||
},
|
||||
|
||||
updateList(course) {
|
||||
course = course || this.state.course
|
||||
PAPI.fetchEtablissement(course.fili, course.sousfili, course.soussousfili).then((response) => {
|
||||
@ -75,24 +46,20 @@
|
||||
})
|
||||
|
||||
this.update({
|
||||
schoolListUpdating: true,
|
||||
schoolList: response
|
||||
})
|
||||
this.filterSearch()
|
||||
})
|
||||
},
|
||||
updateCourse(course){
|
||||
this.updateList(course)
|
||||
|
||||
this.update({
|
||||
course: course,
|
||||
sortFields: SORT_TABLE,
|
||||
shouldShowInfos: course != null,
|
||||
this.update({
|
||||
schoolListUpdating: false
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
onMounted(props, state) {
|
||||
this.update({
|
||||
course: null,
|
||||
<<<<<<< HEAD
|
||||
sortBy: null,
|
||||
schoolList: null,
|
||||
sortFields: SORT_TABLE,
|
||||
@ -133,6 +100,11 @@
|
||||
popupEnabled: false
|
||||
})
|
||||
console.log("closed!")
|
||||
=======
|
||||
schoolList: [],
|
||||
shouldShowInfos: false
|
||||
})
|
||||
>>>>>>> 6ed22586179f7de1d23fd1ebd68d111298170226
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -3,9 +3,8 @@
|
||||
<iframe if={false} 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" onkeyup={props.filterSearch} type="search" placeholder="Établissement">
|
||||
<input class="input" onkeyup={filterSearch} type="search" placeholder="Établissement">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-search"></i>
|
||||
</span>
|
||||
@ -13,16 +12,16 @@
|
||||
<table class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th each={sortField in props.sortFields}>
|
||||
<th each={sortField in sortFields}>
|
||||
{sortField.name}
|
||||
<a id={sortField.id} onclick={() => props.sortList(sortField.id)}>
|
||||
<a id={sortField.id} onclick={() => sortList(sortField.id, true)}>
|
||||
<span class="icon"><i class="fas fa-sort"></i></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr each={school in props.schoolList}>
|
||||
<tr each={school in state.filteredSchoolList}>
|
||||
<td><a onclick={() => props.popup(school)}>{school.fields.g_ea_lib_vx}</a></td>
|
||||
<td>{school.fields.ville_etab}</td>
|
||||
<td>{school.fields.dep}</td>
|
||||
@ -32,4 +31,87 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
const SORT_TABLE = [
|
||||
{name: "Nom", id: "g_ea_lib_vx"},
|
||||
{name: "Ville", id: "ville_etab"},
|
||||
{name: "Département", id: "dep"},
|
||||
{name: "Moyenne", id: "moyenne"},
|
||||
{name: "Sélectivité", id: "taux_acces_ens"}
|
||||
]
|
||||
|
||||
export default {
|
||||
filterSearch() {
|
||||
let input = this.$("input")
|
||||
if (!input) return
|
||||
|
||||
let finalArray = []
|
||||
|
||||
//On évite de trier avant d'avoir plus de 1 lettres.
|
||||
if (input.value.length > 1) {
|
||||
finalArray = this.state.schoolList.filter((item) => {
|
||||
return item.fields.g_ea_lib_vx.toLowerCase().includes(input.value.toLowerCase())
|
||||
})
|
||||
} else {
|
||||
finalArray = this.state.schoolList
|
||||
}
|
||||
|
||||
this.update({
|
||||
filteredSchoolList: finalArray
|
||||
})
|
||||
},
|
||||
|
||||
sortList(sortBy, shouldUpdate) {
|
||||
//Si la liste est déjà triée par la bonne catégorie, on l'inverse
|
||||
if (sortBy == this.state.sortBy) {
|
||||
this.state.filteredSchoolList.reverse()
|
||||
}
|
||||
|
||||
//Sinon on l'ordonne par la nouvelle catégorie (ascendant par défaut)
|
||||
else {
|
||||
this.state.sortBy = sortBy
|
||||
|
||||
switch (sortBy) {
|
||||
case SORT_TABLE[3].id:
|
||||
case SORT_TABLE[4].id: {
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
if (a.fields[sortBy] > b.fields[sortBy]) return 1
|
||||
else return -1
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
default: {
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
return (a.fields[sortBy]).localeCompare(b.fields[sortBy])
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.update()
|
||||
},
|
||||
|
||||
onBeforeUpdate(props, state) {
|
||||
if (props.schoolListUpdating) {
|
||||
state.schoolList = [...props.schoolList]
|
||||
state.filteredSchoolList = [...state.schoolList]
|
||||
if (this.$("input")) this.$("input").value = ""
|
||||
}
|
||||
},
|
||||
|
||||
onBeforeMount(props, state) {
|
||||
this.state = {
|
||||
sortBy: null,
|
||||
schoolList: [],
|
||||
filteredSchoolList: []
|
||||
}
|
||||
},
|
||||
|
||||
sortFields: SORT_TABLE
|
||||
}
|
||||
</script>
|
||||
</school>
|
@ -9,11 +9,11 @@
|
||||
<script>
|
||||
const DEFAULT_CLASSES = "progress is-small m-2 mt-auto mb-auto"
|
||||
const COLOR_CLASSES = [
|
||||
"is-link",
|
||||
"is-info",
|
||||
"is-success",
|
||||
"is-danger",
|
||||
"is-warning",
|
||||
"is-danger"
|
||||
"is-success",
|
||||
"is-info",
|
||||
"is-link"
|
||||
]
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -17,7 +17,9 @@ class PAPI {
|
||||
}
|
||||
static async fetchFiliere(filiere) {
|
||||
if (localStorage.getItem("fili." + filiere)) return JSON.parse(localStorage.getItem("fili." + filiere));
|
||||
let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=form_lib_voe_acc&refine.fili=${filiere}`);
|
||||
let url = `${PAPI.searchURL}&rows=0&sort=tri&facet=form_lib_voe_acc&refine.fili=${filiere}`;
|
||||
url = url.replace("+", "%2B");
|
||||
let request = await fetch(url);
|
||||
let result = await request.json();
|
||||
let response = result["facet_groups"][0]["facets"];
|
||||
localStorage.setItem("fili." + filiere, JSON.stringify(response));
|
||||
@ -25,7 +27,9 @@ class PAPI {
|
||||
}
|
||||
static async fetchSpecialites(filiere, specialite) {
|
||||
if (localStorage.getItem(`spe.${filiere}.${specialite}`)) return JSON.parse(localStorage.getItem(`spe.${filiere}.${specialite}`));
|
||||
let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=fil_lib_voe_acc&refine.form_lib_voe_acc=${specialite}&refine.fili=${filiere}`);
|
||||
let url = `${PAPI.searchURL}&rows=0&sort=tri&facet=fil_lib_voe_acc&refine.form_lib_voe_acc=${specialite}&refine.fili=${filiere}`;
|
||||
url = url.replace("+", "%2B");
|
||||
let request = await fetch(url);
|
||||
let result = await request.json();
|
||||
let response = result["facet_groups"][0]["facets"];
|
||||
localStorage.setItem(`spe.${filiere}.${specialite}`, JSON.stringify(response));
|
||||
@ -33,7 +37,9 @@ class PAPI {
|
||||
}
|
||||
static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) {
|
||||
if (localStorage.getItem(`eta.${filiere}.${sousfiliere}.${soussousfiliere}`)) return JSON.parse(localStorage.getItem(`eta.${filiere}.${sousfiliere}.${soussousfiliere}`));
|
||||
let request = await fetch(`${PAPI.searchURL}&rows=10000&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`);
|
||||
let url = `${PAPI.searchURL}&rows=10000&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`;
|
||||
url = url.replace("+", "%2B");
|
||||
let request = await fetch(url);
|
||||
let result = await request.json();
|
||||
let response = result["records"];
|
||||
localStorage.setItem(`eta.${filiere}.${sousfiliere}.${soussousfiliere}`, JSON.stringify(response));
|
||||
@ -41,52 +47,15 @@ class PAPI {
|
||||
}
|
||||
}
|
||||
|
||||
const SORT_TABLE = [{
|
||||
name: "Nom",
|
||||
id: "g_ea_lib_vx"
|
||||
}, {
|
||||
name: "Ville",
|
||||
id: "ville_etab"
|
||||
}, {
|
||||
name: "Département",
|
||||
id: "dep"
|
||||
}, {
|
||||
name: "Moyenne",
|
||||
id: "moyenne"
|
||||
}, {
|
||||
name: "Sélectivité",
|
||||
id: "taux_acces_ens"
|
||||
}];
|
||||
var mainController = {
|
||||
css: null,
|
||||
exports: {
|
||||
sortList(sortBy) {
|
||||
//Si la liste est déjà triée par la bonne catégorie, on l'inverse
|
||||
if (sortBy == this.state.sortBy) {
|
||||
this.state.filteredSchoolList.reverse();
|
||||
}
|
||||
//Sinon on l'ordonne par la nouvelle catégorie (ascendant par défaut)
|
||||
else {
|
||||
this.state.sortBy = sortBy;
|
||||
switch (sortBy) {
|
||||
case SORT_TABLE[3].id:
|
||||
case SORT_TABLE[4].id:
|
||||
{
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
if (a.fields[sortBy] > b.fields[sortBy]) return 1;else return -1;
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
return a.fields[sortBy].localeCompare(b.fields[sortBy]);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.update();
|
||||
updateCourse(course) {
|
||||
this.updateList(course);
|
||||
this.update({
|
||||
course: course,
|
||||
shouldShowInfos: course != null
|
||||
});
|
||||
},
|
||||
updateList(course) {
|
||||
course = course || this.state.course;
|
||||
@ -104,48 +73,23 @@ var mainController = {
|
||||
etablissement.fields.moyenne = (pct_TBF * 19 + pct_TB * 17 + pct_B * 15 + pct_AB * 13 + pct_sansmention * 11) / 100;
|
||||
});
|
||||
this.update({
|
||||
schoolListUpdating: true,
|
||||
schoolList: response
|
||||
});
|
||||
this.filterSearch();
|
||||
});
|
||||
},
|
||||
updateCourse(course) {
|
||||
this.updateList(course);
|
||||
this.update({
|
||||
course: course,
|
||||
sortFields: SORT_TABLE,
|
||||
shouldShowInfos: course != null
|
||||
this.update({
|
||||
schoolListUpdating: false
|
||||
});
|
||||
});
|
||||
},
|
||||
onMounted(props, state) {
|
||||
this.update({
|
||||
course: null,
|
||||
sortBy: null,
|
||||
schoolList: null,
|
||||
sortFields: SORT_TABLE,
|
||||
filteredSchoolList: null,
|
||||
schoolList: [],
|
||||
shouldShowInfos: false
|
||||
});
|
||||
},
|
||||
filterSearch() {
|
||||
let input = this.$("input");
|
||||
if (!input) return;
|
||||
let finalArray = [];
|
||||
|
||||
//On évite de trier avant d'avoir plus de 1 lettres.
|
||||
if (input.value.length > 1) {
|
||||
finalArray = this.state.schoolList.filter(item => {
|
||||
return item.name.toLowerCase().includes(input.value.toLowerCase());
|
||||
});
|
||||
} else {
|
||||
finalArray = this.state.schoolList;
|
||||
}
|
||||
this.update({
|
||||
filteredSchoolList: finalArray
|
||||
});
|
||||
}
|
||||
},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="columns"><div class="column is-one-third"><div class="box p-3 m-2"><img class="mt-1 ml-5 mr-auto" style="margin: auto;" src="./resources/logo-parcoursup.svg"/></div><search expr71="expr71"></search></div><div class="column"><fili-info expr72="expr72"></fili-info><school expr73="expr73"></school></div></div><school-info expr74="expr74"></school-info>', [{
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="columns"><div class="column is-one-third"><div class="box p-3 m-2" style="display: flex"><img class="m-auto" src="./resources/logo-parcoursup.svg"/></div><search expr643="expr643"></search></div><div class="column"><fili-info expr644="expr644"></fili-info><school expr645="expr645"></school></div></div><school-info expr646="expr646"></school-info>', [{
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
evaluate: _scope => 'search',
|
||||
@ -155,8 +99,8 @@ var mainController = {
|
||||
name: 'updateCourse',
|
||||
evaluate: _scope => _scope.updateCourse
|
||||
}],
|
||||
redundantAttribute: 'expr71',
|
||||
selector: '[expr71]'
|
||||
redundantAttribute: 'expr643',
|
||||
selector: '[expr643]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
@ -175,25 +119,21 @@ var mainController = {
|
||||
name: 'shouldShowInfos',
|
||||
evaluate: _scope => _scope.state.shouldShowInfos
|
||||
}],
|
||||
redundantAttribute: 'expr72',
|
||||
selector: '[expr72]'
|
||||
redundantAttribute: 'expr644',
|
||||
selector: '[expr644]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
evaluate: _scope => 'school',
|
||||
slots: [],
|
||||
attributes: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'sortList',
|
||||
evaluate: _scope => _scope.sortList
|
||||
}, {
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'schoolList',
|
||||
evaluate: _scope => _scope.state.filteredSchoolList
|
||||
evaluate: _scope => _scope.state.schoolList
|
||||
}, {
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'sortFields',
|
||||
evaluate: _scope => _scope.state.sortFields
|
||||
name: 'schoolListUpdating',
|
||||
evaluate: _scope => _scope.state.schoolListUpdating
|
||||
}, {
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'course',
|
||||
@ -203,16 +143,16 @@ var mainController = {
|
||||
name: 'shouldShowInfos',
|
||||
evaluate: _scope => _scope.state.shouldShowInfos
|
||||
}],
|
||||
redundantAttribute: 'expr73',
|
||||
selector: '[expr73]'
|
||||
redundantAttribute: 'expr645',
|
||||
selector: '[expr645]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
evaluate: _scope => 'school-info',
|
||||
slots: [],
|
||||
attributes: [],
|
||||
redundantAttribute: 'expr74',
|
||||
selector: '[expr74]'
|
||||
redundantAttribute: 'expr646',
|
||||
selector: '[expr646]'
|
||||
}]),
|
||||
name: 'main-controller'
|
||||
};
|
||||
|
@ -26,7 +26,10 @@ class PAPI {
|
||||
|
||||
if (localStorage.getItem("fili." + filiere)) return JSON.parse(localStorage.getItem("fili." + filiere))
|
||||
|
||||
let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=form_lib_voe_acc&refine.fili=${filiere}`)
|
||||
let url = `${PAPI.searchURL}&rows=0&sort=tri&facet=form_lib_voe_acc&refine.fili=${filiere}`
|
||||
url = url.replace("+", "%2B")
|
||||
|
||||
let request = await fetch(url)
|
||||
let result = await request.json()
|
||||
let response = result["facet_groups"][0]["facets"]
|
||||
|
||||
@ -39,7 +42,10 @@ class PAPI {
|
||||
|
||||
if (localStorage.getItem(`spe.${filiere}.${specialite}`)) return JSON.parse(localStorage.getItem(`spe.${filiere}.${specialite}`))
|
||||
|
||||
let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=fil_lib_voe_acc&refine.form_lib_voe_acc=${specialite}&refine.fili=${filiere}`)
|
||||
let url = `${PAPI.searchURL}&rows=0&sort=tri&facet=fil_lib_voe_acc&refine.form_lib_voe_acc=${specialite}&refine.fili=${filiere}`
|
||||
url = url.replace("+", "%2B")
|
||||
|
||||
let request = await fetch(url)
|
||||
let result = await request.json()
|
||||
let response = result["facet_groups"][0]["facets"]
|
||||
|
||||
@ -52,7 +58,10 @@ class PAPI {
|
||||
|
||||
if (localStorage.getItem(`eta.${filiere}.${sousfiliere}.${soussousfiliere}`)) return JSON.parse(localStorage.getItem(`eta.${filiere}.${sousfiliere}.${soussousfiliere}`))
|
||||
|
||||
let request = await fetch(`${PAPI.searchURL}&rows=10000&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`)
|
||||
let url = `${PAPI.searchURL}&rows=10000&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`
|
||||
url = url.replace("+", "%2B")
|
||||
|
||||
let request = await fetch(url)
|
||||
let result = await request.json()
|
||||
let response = result["records"]
|
||||
|
||||
|
@ -10,14 +10,14 @@ var schoolInfo = {
|
||||
this.update();
|
||||
}
|
||||
},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr23="expr23" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background: #000000DD;"></div>', [{
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr29="expr29" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background: #000000DD;"></div>', [{
|
||||
type: bindingTypes.IF,
|
||||
evaluate: _scope => _scope.state.enabled,
|
||||
redundantAttribute: 'expr23',
|
||||
selector: '[expr23]',
|
||||
template: template('<div style="position: absolute; top: 10%; left: 10%; width: 80%; height: 80%; background: #FFFFFF"><button expr24="expr24" class="delete is-medium">X</button><p><h2></h2></p><line-graph expr25="expr25" style="height: 90px; margin: 10px;"></line-graph></div>', [{
|
||||
redundantAttribute: 'expr24',
|
||||
selector: '[expr24]',
|
||||
redundantAttribute: 'expr29',
|
||||
selector: '[expr29]',
|
||||
template: template('<div style="position: absolute; top: 10%; left: 10%; width: 80%; height: 80%; background: #FFFFFF"><button expr30="expr30" class="delete is-medium">X</button><p><h2></h2></p><line-graph expr31="expr31" style="height: 90px; margin: 10px;"></line-graph></div>', [{
|
||||
redundantAttribute: 'expr30',
|
||||
selector: '[expr30]',
|
||||
expressions: [{
|
||||
type: expressionTypes.EVENT,
|
||||
name: 'onclick',
|
||||
@ -29,8 +29,8 @@ var schoolInfo = {
|
||||
evaluate: _scope => 'line-graph',
|
||||
slots: [],
|
||||
attributes: [],
|
||||
redundantAttribute: 'expr25',
|
||||
selector: '[expr25]'
|
||||
redundantAttribute: 'expr31',
|
||||
selector: '[expr31]'
|
||||
}])
|
||||
}]),
|
||||
name: 'school-info'
|
||||
|
@ -1,38 +1,116 @@
|
||||
const SORT_TABLE = [{
|
||||
name: "Nom",
|
||||
id: "g_ea_lib_vx"
|
||||
}, {
|
||||
name: "Ville",
|
||||
id: "ville_etab"
|
||||
}, {
|
||||
name: "Département",
|
||||
id: "dep"
|
||||
}, {
|
||||
name: "Moyenne",
|
||||
id: "moyenne"
|
||||
}, {
|
||||
name: "Sélectivité",
|
||||
id: "taux_acces_ens"
|
||||
}];
|
||||
var school = {
|
||||
css: null,
|
||||
exports: null,
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr52="expr52" class="box p-2 m-2" disabled></div>', [{
|
||||
exports: {
|
||||
filterSearch() {
|
||||
let input = this.$("input");
|
||||
if (!input) return;
|
||||
let finalArray = [];
|
||||
|
||||
//On évite de trier avant d'avoir plus de 1 lettres.
|
||||
if (input.value.length > 1) {
|
||||
finalArray = this.state.schoolList.filter(item => {
|
||||
return item.fields.g_ea_lib_vx.toLowerCase().includes(input.value.toLowerCase());
|
||||
});
|
||||
} else {
|
||||
finalArray = this.state.schoolList;
|
||||
}
|
||||
this.update({
|
||||
filteredSchoolList: finalArray
|
||||
});
|
||||
},
|
||||
sortList(sortBy, shouldUpdate) {
|
||||
//Si la liste est déjà triée par la bonne catégorie, on l'inverse
|
||||
if (sortBy == this.state.sortBy) {
|
||||
this.state.filteredSchoolList.reverse();
|
||||
}
|
||||
|
||||
//Sinon on l'ordonne par la nouvelle catégorie (ascendant par défaut)
|
||||
else {
|
||||
this.state.sortBy = sortBy;
|
||||
switch (sortBy) {
|
||||
case SORT_TABLE[3].id:
|
||||
case SORT_TABLE[4].id:
|
||||
{
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
if (a.fields[sortBy] > b.fields[sortBy]) return 1;else return -1;
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
this.state.filteredSchoolList.sort((a, b) => {
|
||||
return a.fields[sortBy].localeCompare(b.fields[sortBy]);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.update();
|
||||
},
|
||||
onBeforeUpdate(props, state) {
|
||||
if (props.schoolListUpdating) {
|
||||
state.schoolList = [...props.schoolList];
|
||||
state.filteredSchoolList = [...state.schoolList];
|
||||
if (this.$("input")) this.$("input").value = "";
|
||||
}
|
||||
},
|
||||
onBeforeMount(props, state) {
|
||||
this.state = {
|
||||
sortBy: null,
|
||||
schoolList: [],
|
||||
filteredSchoolList: []
|
||||
};
|
||||
},
|
||||
sortFields: SORT_TABLE
|
||||
},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr680="expr680" class="box p-2 m-2" disabled></div>', [{
|
||||
type: bindingTypes.IF,
|
||||
evaluate: _scope => _scope.props.shouldShowInfos,
|
||||
redundantAttribute: 'expr52',
|
||||
selector: '[expr52]',
|
||||
template: template('<iframe expr53="expr53" 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 expr54="expr54" class="input" type="search" placeholder="Établissement"/><span class="icon is-small is-left"><i class="fas fa-search"></i></span></div><table class="table is-fullwidth is-hoverable"><thead><tr><th expr55="expr55"></th></tr></thead><tbody><tr expr57="expr57"></tr></tbody></table>', [{
|
||||
redundantAttribute: 'expr680',
|
||||
selector: '[expr680]',
|
||||
template: template('<iframe expr681="expr681" 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><div class="block control has-icons-left is-inline-block is-pulled-right"><input expr682="expr682" class="input" type="search" placeholder="Établissement"/><span class="icon is-small is-left"><i class="fas fa-search"></i></span></div><table class="table is-fullwidth is-hoverable"><thead><tr><th expr683="expr683"></th></tr></thead><tbody><tr expr685="expr685"></tr></tbody></table>', [{
|
||||
type: bindingTypes.IF,
|
||||
evaluate: _scope => false,
|
||||
redundantAttribute: 'expr53',
|
||||
selector: '[expr53]',
|
||||
redundantAttribute: 'expr681',
|
||||
selector: '[expr681]',
|
||||
template: template(null, [])
|
||||
}, {
|
||||
redundantAttribute: 'expr54',
|
||||
selector: '[expr54]',
|
||||
redundantAttribute: 'expr682',
|
||||
selector: '[expr682]',
|
||||
expressions: [{
|
||||
type: expressionTypes.EVENT,
|
||||
name: 'onkeyup',
|
||||
evaluate: _scope => _scope.props.filterSearch
|
||||
evaluate: _scope => _scope.filterSearch
|
||||
}]
|
||||
}, {
|
||||
type: bindingTypes.EACH,
|
||||
getKey: null,
|
||||
condition: null,
|
||||
template: template(' <a expr56="expr56"><span class="icon"><i class="fas fa-sort"></i></span></a>', [{
|
||||
template: template(' <a expr684="expr684"><span class="icon"><i class="fas fa-sort"></i></span></a>', [{
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => [_scope.sortField.name].join('')
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr56',
|
||||
selector: '[expr56]',
|
||||
redundantAttribute: 'expr684',
|
||||
selector: '[expr684]',
|
||||
expressions: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'id',
|
||||
@ -40,45 +118,49 @@ var school = {
|
||||
}, {
|
||||
type: expressionTypes.EVENT,
|
||||
name: 'onclick',
|
||||
evaluate: _scope => () => _scope.props.sortList(_scope.sortField.id)
|
||||
evaluate: _scope => () => _scope.sortList(_scope.sortField.id, true)
|
||||
}]
|
||||
}]),
|
||||
redundantAttribute: 'expr55',
|
||||
selector: '[expr55]',
|
||||
redundantAttribute: 'expr683',
|
||||
selector: '[expr683]',
|
||||
itemName: 'sortField',
|
||||
indexName: null,
|
||||
evaluate: _scope => _scope.props.sortFields
|
||||
evaluate: _scope => _scope.sortFields
|
||||
}, {
|
||||
type: bindingTypes.EACH,
|
||||
getKey: null,
|
||||
condition: null,
|
||||
template: template('<td expr58="expr58"> </td><td expr59="expr59"> </td><td expr60="expr60"> </td><td expr61="expr61"> </td><td><title-progress expr62="expr62" max="100" style="margin: auto"></title-progress></td>', [{
|
||||
redundantAttribute: 'expr58',
|
||||
selector: '[expr58]',
|
||||
template: template('<td><a expr686="expr686"> </a></td><td expr687="expr687"> </td><td expr688="expr688"> </td><td expr689="expr689"> </td><td><title-progress expr690="expr690" max="100" style="margin: auto"></title-progress></td>', [{
|
||||
redundantAttribute: 'expr686',
|
||||
selector: '[expr686]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.school.fields.g_ea_lib_vx
|
||||
}, {
|
||||
type: expressionTypes.EVENT,
|
||||
name: 'onclick',
|
||||
evaluate: _scope => () => _scope.props.popup(_scope.school)
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr59',
|
||||
selector: '[expr59]',
|
||||
redundantAttribute: 'expr687',
|
||||
selector: '[expr687]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.school.fields.ville_etab
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr60',
|
||||
selector: '[expr60]',
|
||||
redundantAttribute: 'expr688',
|
||||
selector: '[expr688]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.school.fields.dep
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr61',
|
||||
selector: '[expr61]',
|
||||
redundantAttribute: 'expr689',
|
||||
selector: '[expr689]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
@ -94,14 +176,14 @@ var school = {
|
||||
name: 'value',
|
||||
evaluate: _scope => _scope.school.fields.taux_acces_ens
|
||||
}],
|
||||
redundantAttribute: 'expr62',
|
||||
selector: '[expr62]'
|
||||
redundantAttribute: 'expr690',
|
||||
selector: '[expr690]'
|
||||
}]),
|
||||
redundantAttribute: 'expr57',
|
||||
selector: '[expr57]',
|
||||
redundantAttribute: 'expr685',
|
||||
selector: '[expr685]',
|
||||
itemName: 'school',
|
||||
indexName: null,
|
||||
evaluate: _scope => _scope.props.schoolList
|
||||
evaluate: _scope => _scope.state.filteredSchoolList
|
||||
}])
|
||||
}]),
|
||||
name: 'school'
|
||||
|
@ -17,7 +17,9 @@ class PAPI {
|
||||
}
|
||||
static async fetchFiliere(filiere) {
|
||||
if (localStorage.getItem("fili." + filiere)) return JSON.parse(localStorage.getItem("fili." + filiere));
|
||||
let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=form_lib_voe_acc&refine.fili=${filiere}`);
|
||||
let url = `${PAPI.searchURL}&rows=0&sort=tri&facet=form_lib_voe_acc&refine.fili=${filiere}`;
|
||||
url = url.replace("+", "%2B");
|
||||
let request = await fetch(url);
|
||||
let result = await request.json();
|
||||
let response = result["facet_groups"][0]["facets"];
|
||||
localStorage.setItem("fili." + filiere, JSON.stringify(response));
|
||||
@ -25,7 +27,9 @@ class PAPI {
|
||||
}
|
||||
static async fetchSpecialites(filiere, specialite) {
|
||||
if (localStorage.getItem(`spe.${filiere}.${specialite}`)) return JSON.parse(localStorage.getItem(`spe.${filiere}.${specialite}`));
|
||||
let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=fil_lib_voe_acc&refine.form_lib_voe_acc=${specialite}&refine.fili=${filiere}`);
|
||||
let url = `${PAPI.searchURL}&rows=0&sort=tri&facet=fil_lib_voe_acc&refine.form_lib_voe_acc=${specialite}&refine.fili=${filiere}`;
|
||||
url = url.replace("+", "%2B");
|
||||
let request = await fetch(url);
|
||||
let result = await request.json();
|
||||
let response = result["facet_groups"][0]["facets"];
|
||||
localStorage.setItem(`spe.${filiere}.${specialite}`, JSON.stringify(response));
|
||||
@ -33,7 +37,9 @@ class PAPI {
|
||||
}
|
||||
static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) {
|
||||
if (localStorage.getItem(`eta.${filiere}.${sousfiliere}.${soussousfiliere}`)) return JSON.parse(localStorage.getItem(`eta.${filiere}.${sousfiliere}.${soussousfiliere}`));
|
||||
let request = await fetch(`${PAPI.searchURL}&rows=10000&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`);
|
||||
let url = `${PAPI.searchURL}&rows=10000&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`;
|
||||
url = url.replace("+", "%2B");
|
||||
let request = await fetch(url);
|
||||
let result = await request.json();
|
||||
let response = result["records"];
|
||||
localStorage.setItem(`eta.${filiere}.${sousfiliere}.${soussousfiliere}`, JSON.stringify(response));
|
||||
@ -144,9 +150,9 @@ var search = {
|
||||
this.updateList();
|
||||
}
|
||||
},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-1 m-2"><div class="columns m-1"><input expr14="expr14" class="input" type="input"/><button expr15="expr15" class="button ml-1"><</button></div><div id="list-formations"><ul><li expr16="expr16" class="m-1"></li></ul></div></div>', [{
|
||||
redundantAttribute: 'expr14',
|
||||
selector: '[expr14]',
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-1 m-2"><div class="columns m-1"><input expr31="expr31" class="input" type="input"/><button expr32="expr32" class="button ml-1"><</button></div><div id="list-formations"><ul><li expr33="expr33" class="m-1"></li></ul></div></div>', [{
|
||||
redundantAttribute: 'expr31',
|
||||
selector: '[expr31]',
|
||||
expressions: [{
|
||||
type: expressionTypes.EVENT,
|
||||
name: 'onkeyup',
|
||||
@ -157,8 +163,8 @@ var search = {
|
||||
evaluate: _scope => _scope.state.placeholder
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr15',
|
||||
selector: '[expr15]',
|
||||
redundantAttribute: 'expr32',
|
||||
selector: '[expr32]',
|
||||
expressions: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'disabled',
|
||||
@ -172,9 +178,9 @@ var search = {
|
||||
type: bindingTypes.EACH,
|
||||
getKey: null,
|
||||
condition: null,
|
||||
template: template('<button expr17="expr17" class="button is-fullwidth p-2" style="white-space: unset"><div style="display: flex; width: 100%"><span class="mt-auto mb-auto" style="font-size: 0.75em; text-align: left; "><strong expr18="expr18"> </strong></span><div style="margin-left: auto;"></div><span expr19="expr19" class="tag is-primary mt-auto mb-auto"> </span></div></button>', [{
|
||||
redundantAttribute: 'expr17',
|
||||
selector: '[expr17]',
|
||||
template: template('<button expr34="expr34" class="button is-fullwidth p-2" style="white-space: unset"><div style="display: flex; width: 100%"><span class="mt-auto mb-auto" style="font-size: 0.75em; text-align: left; "><strong expr35="expr35"> </strong></span><div style="margin-left: auto;"></div><span expr36="expr36" class="tag is-primary mt-auto mb-auto"> </span></div></button>', [{
|
||||
redundantAttribute: 'expr34',
|
||||
selector: '[expr34]',
|
||||
expressions: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'disabled',
|
||||
@ -185,24 +191,24 @@ var search = {
|
||||
evaluate: _scope => () => _scope.cruiseForward(_scope.item.name)
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr18',
|
||||
selector: '[expr18]',
|
||||
redundantAttribute: 'expr35',
|
||||
selector: '[expr35]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.item.name
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr19',
|
||||
selector: '[expr19]',
|
||||
redundantAttribute: 'expr36',
|
||||
selector: '[expr36]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.item.count
|
||||
}]
|
||||
}]),
|
||||
redundantAttribute: 'expr16',
|
||||
selector: '[expr16]',
|
||||
redundantAttribute: 'expr33',
|
||||
selector: '[expr33]',
|
||||
itemName: 'item',
|
||||
indexName: null,
|
||||
evaluate: _scope => _scope.state.items
|
||||
|
@ -1,5 +1,5 @@
|
||||
const DEFAULT_CLASSES = "progress is-small m-2 mt-auto mb-auto";
|
||||
const COLOR_CLASSES = ["is-link", "is-info", "is-success", "is-warning", "is-danger"];
|
||||
const COLOR_CLASSES = ["is-danger", "is-warning", "is-success", "is-info", "is-link"];
|
||||
var titleProgress = {
|
||||
css: null,
|
||||
exports: {
|
||||
@ -25,11 +25,11 @@ var titleProgress = {
|
||||
state.class = this.computeClasses();
|
||||
}
|
||||
},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div style="display: flex;"><span expr20="expr20"></span><span expr21="expr21" class="ml-1"> </span><progress expr22="expr22" style="box-shadow: 0 0.5em 1em -0.125em rgb(10 10 10 / 10%), 0 0 0 1px rgb(10 10 10 / 2%);"></progress></div>', [{
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div style="display: flex;"><span expr664="expr664"></span><span expr665="expr665" class="ml-1"> </span><progress expr666="expr666" style="box-shadow: 0 0.5em 1em -0.125em rgb(10 10 10 / 10%), 0 0 0 1px rgb(10 10 10 / 2%);"></progress></div>', [{
|
||||
type: bindingTypes.IF,
|
||||
evaluate: _scope => _scope.props.title,
|
||||
redundantAttribute: 'expr20',
|
||||
selector: '[expr20]',
|
||||
redundantAttribute: 'expr664',
|
||||
selector: '[expr664]',
|
||||
template: template(' ', [{
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
@ -38,16 +38,16 @@ var titleProgress = {
|
||||
}]
|
||||
}])
|
||||
}, {
|
||||
redundantAttribute: 'expr21',
|
||||
selector: '[expr21]',
|
||||
redundantAttribute: 'expr665',
|
||||
selector: '[expr665]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.calcPct()
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr22',
|
||||
selector: '[expr22]',
|
||||
redundantAttribute: 'expr666',
|
||||
selector: '[expr666]',
|
||||
expressions: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'value',
|
||||
|
Loading…
Reference in New Issue
Block a user