Shift parent -> enfant
This commit is contained in:
parent
ac30b03c51
commit
6ed2258617
@ -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",
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<div class="column">
|
||||
<fili-info schoolList={state.schoolList} course={state.course} shouldShowInfos={state.shouldShowInfos}></fili-info>
|
||||
<school sortList={sortList} schoolList={state.filteredSchoolList} sortFields={state.sortFields} course={state.course} shouldShowInfos={state.shouldShowInfos}></school>
|
||||
<school 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) => {
|
||||
@ -72,52 +43,25 @@
|
||||
// On prend la moyenne des moyennes comprises dans la mention
|
||||
// Exemple : Assez bien est entre 12 et 14 donc 13.
|
||||
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.update({
|
||||
schoolList: response
|
||||
})
|
||||
this.filterSearch()
|
||||
})
|
||||
},
|
||||
updateCourse(course){
|
||||
this.updateList(course)
|
||||
|
||||
this.update({
|
||||
course: course,
|
||||
sortFields: SORT_TABLE,
|
||||
shouldShowInfos: course != null,
|
||||
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
|
||||
})
|
||||
}
|
||||
}
|
||||
</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>{school.fields.g_ea_lib_vx}</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>
|
@ -14,7 +14,6 @@ var filiInfo = {
|
||||
state.capacity = Math.floor(avgCap);
|
||||
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",
|
||||
short: "H",
|
||||
@ -76,54 +75,54 @@ var filiInfo = {
|
||||
}];
|
||||
}
|
||||
},
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr26="expr26" class="box p-1 m-2"></div>', [{
|
||||
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr7="expr7" class="box p-1 m-2"></div>', [{
|
||||
type: bindingTypes.IF,
|
||||
evaluate: _scope => _scope.props.shouldShowInfos,
|
||||
redundantAttribute: 'expr26',
|
||||
selector: '[expr26]',
|
||||
template: template('<h1 class="title is-4 m-2"><span expr27="expr27" style="color: #485FC7;"> </span> / \n <span expr28="expr28" style="color: #485FC7;"> </span> / \n <span expr29="expr29" style="color: #485FC7;"> </span></h1><div class="box mt-2" style="background-color: #EAEAEA; margin: auto; width: 60%;"><p>Moyenne des admis<span expr30="expr30" class="is-pulled-right"> </span></p><p>Nombre de formations<span expr31="expr31" class="is-pulled-right"> </span></p><p>Capacité<span expr32="expr32" class="is-pulled-right"> </span></p><title-progress expr33="expr33" max="100"></title-progress></div><div class="m-4"><line-graph expr34="expr34" title="Répartition par genre" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr35="expr35" title="Répartition par bac" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr36="expr36" title="Répartition par mention au bac" style="height: 6rem;"></line-graph></div>', [{
|
||||
redundantAttribute: 'expr27',
|
||||
selector: '[expr27]',
|
||||
redundantAttribute: 'expr7',
|
||||
selector: '[expr7]',
|
||||
template: template('<h1 class="title is-4 m-2"><span expr8="expr8" style="color: #485FC7;"> </span> / \r\n <span expr9="expr9" style="color: #485FC7;"> </span> / \r\n <span expr10="expr10" style="color: #485FC7;"> </span></h1><div class="box mt-2" style="background-color: #EAEAEA; margin: auto; width: 60%;"><p>Moyenne des admis<span expr11="expr11" class="is-pulled-right"> </span></p><p>Nombre de formations<span expr12="expr12" class="is-pulled-right"> </span></p><p>Capacité<span expr13="expr13" class="is-pulled-right"> </span></p><title-progress expr14="expr14" max="100"></title-progress></div><div class="m-4"><line-graph expr15="expr15" title="Répartition par genre" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr16="expr16" title="Répartition par bac" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr17="expr17" title="Répartition par mention au bac" style="height: 6rem;"></line-graph></div>', [{
|
||||
redundantAttribute: 'expr8',
|
||||
selector: '[expr8]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.props.course.fili
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr28',
|
||||
selector: '[expr28]',
|
||||
redundantAttribute: 'expr9',
|
||||
selector: '[expr9]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.props.course.sousfili
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr29',
|
||||
selector: '[expr29]',
|
||||
redundantAttribute: 'expr10',
|
||||
selector: '[expr10]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.props.course.soussousfili
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr30',
|
||||
selector: '[expr30]',
|
||||
redundantAttribute: 'expr11',
|
||||
selector: '[expr11]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.state.average
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr31',
|
||||
selector: '[expr31]',
|
||||
redundantAttribute: 'expr12',
|
||||
selector: '[expr12]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.state.courseNumber
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr32',
|
||||
selector: '[expr32]',
|
||||
redundantAttribute: 'expr13',
|
||||
selector: '[expr13]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
@ -143,8 +142,8 @@ var filiInfo = {
|
||||
name: 'value',
|
||||
evaluate: _scope => _scope.state.selectivity
|
||||
}],
|
||||
redundantAttribute: 'expr33',
|
||||
selector: '[expr33]'
|
||||
redundantAttribute: 'expr14',
|
||||
selector: '[expr14]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
@ -155,8 +154,8 @@ var filiInfo = {
|
||||
name: 'data',
|
||||
evaluate: _scope => _scope.state.genreStats
|
||||
}],
|
||||
redundantAttribute: 'expr34',
|
||||
selector: '[expr34]'
|
||||
redundantAttribute: 'expr15',
|
||||
selector: '[expr15]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
@ -167,8 +166,8 @@ var filiInfo = {
|
||||
name: 'data',
|
||||
evaluate: _scope => _scope.state.bacStats
|
||||
}],
|
||||
redundantAttribute: 'expr35',
|
||||
selector: '[expr35]'
|
||||
redundantAttribute: 'expr16',
|
||||
selector: '[expr16]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
@ -179,8 +178,8 @@ var filiInfo = {
|
||||
name: 'data',
|
||||
evaluate: _scope => _scope.state.mentionStats
|
||||
}],
|
||||
redundantAttribute: 'expr36',
|
||||
selector: '[expr36]'
|
||||
redundantAttribute: 'expr17',
|
||||
selector: '[expr17]'
|
||||
}])
|
||||
}]),
|
||||
name: 'fili-info'
|
||||
|
@ -47,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;
|
||||
@ -110,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" style="display: flex"><img class="m-auto" src="./resources/logo-parcoursup.svg"/></div><search expr59="expr59"></search></div><div class="column"><fili-info expr60="expr60"></fili-info><school expr61="expr61"></school></div></div><school-info expr62="expr62"></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',
|
||||
@ -161,8 +99,8 @@ var mainController = {
|
||||
name: 'updateCourse',
|
||||
evaluate: _scope => _scope.updateCourse
|
||||
}],
|
||||
redundantAttribute: 'expr59',
|
||||
selector: '[expr59]'
|
||||
redundantAttribute: 'expr643',
|
||||
selector: '[expr643]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
@ -181,25 +119,21 @@ var mainController = {
|
||||
name: 'shouldShowInfos',
|
||||
evaluate: _scope => _scope.state.shouldShowInfos
|
||||
}],
|
||||
redundantAttribute: 'expr60',
|
||||
selector: '[expr60]'
|
||||
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',
|
||||
@ -209,16 +143,16 @@ var mainController = {
|
||||
name: 'shouldShowInfos',
|
||||
evaluate: _scope => _scope.state.shouldShowInfos
|
||||
}],
|
||||
redundantAttribute: 'expr61',
|
||||
selector: '[expr61]'
|
||||
redundantAttribute: 'expr645',
|
||||
selector: '[expr645]'
|
||||
}, {
|
||||
type: bindingTypes.TAG,
|
||||
getComponent: getComponent,
|
||||
evaluate: _scope => 'school-info',
|
||||
slots: [],
|
||||
attributes: [],
|
||||
redundantAttribute: 'expr62',
|
||||
selector: '[expr62]'
|
||||
redundantAttribute: 'expr646',
|
||||
selector: '[expr646]'
|
||||
}]),
|
||||
name: 'main-controller'
|
||||
};
|
||||
|
@ -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 expr44="expr44" 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: 'expr44',
|
||||
selector: '[expr44]',
|
||||
template: template('<iframe expr45="expr45" 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 expr46="expr46" 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 expr47="expr47"></th></tr></thead><tbody><tr expr49="expr49"></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: 'expr45',
|
||||
selector: '[expr45]',
|
||||
redundantAttribute: 'expr681',
|
||||
selector: '[expr681]',
|
||||
template: template(null, [])
|
||||
}, {
|
||||
redundantAttribute: 'expr46',
|
||||
selector: '[expr46]',
|
||||
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 expr48="expr48"><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: 'expr48',
|
||||
selector: '[expr48]',
|
||||
redundantAttribute: 'expr684',
|
||||
selector: '[expr684]',
|
||||
expressions: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'id',
|
||||
@ -40,45 +118,45 @@ var school = {
|
||||
}, {
|
||||
type: expressionTypes.EVENT,
|
||||
name: 'onclick',
|
||||
evaluate: _scope => () => _scope.props.sortList(_scope.sortField.id)
|
||||
evaluate: _scope => () => _scope.sortList(_scope.sortField.id, true)
|
||||
}]
|
||||
}]),
|
||||
redundantAttribute: 'expr47',
|
||||
selector: '[expr47]',
|
||||
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 expr50="expr50"> </td><td expr51="expr51"> </td><td expr52="expr52"> </td><td expr53="expr53"> </td><td><title-progress expr54="expr54" max="100" style="margin: auto"></title-progress></td>', [{
|
||||
redundantAttribute: 'expr50',
|
||||
selector: '[expr50]',
|
||||
template: template('<td expr686="expr686"> </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
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr51',
|
||||
selector: '[expr51]',
|
||||
redundantAttribute: 'expr687',
|
||||
selector: '[expr687]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.school.fields.ville_etab
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr52',
|
||||
selector: '[expr52]',
|
||||
redundantAttribute: 'expr688',
|
||||
selector: '[expr688]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.school.fields.dep
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr53',
|
||||
selector: '[expr53]',
|
||||
redundantAttribute: 'expr689',
|
||||
selector: '[expr689]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
@ -94,14 +172,14 @@ var school = {
|
||||
name: 'value',
|
||||
evaluate: _scope => _scope.school.fields.taux_acces_ens
|
||||
}],
|
||||
redundantAttribute: 'expr54',
|
||||
selector: '[expr54]'
|
||||
redundantAttribute: 'expr690',
|
||||
selector: '[expr690]'
|
||||
}]),
|
||||
redundantAttribute: 'expr49',
|
||||
selector: '[expr49]',
|
||||
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 expr32="expr32" class="input" type="input"/><button expr33="expr33" class="button ml-1"><</button></div><div id="list-formations"><ul><li expr34="expr34" class="m-1"></li></ul></div></div>', [{
|
||||
redundantAttribute: 'expr32',
|
||||
selector: '[expr32]',
|
||||
expressions: [{
|
||||
type: expressionTypes.EVENT,
|
||||
name: 'onkeyup',
|
||||
@ -157,8 +163,8 @@ var search = {
|
||||
evaluate: _scope => _scope.state.placeholder
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr15',
|
||||
selector: '[expr15]',
|
||||
redundantAttribute: 'expr33',
|
||||
selector: '[expr33]',
|
||||
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 expr35="expr35" 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 expr36="expr36"> </strong></span><div style="margin-left: auto;"></div><span expr37="expr37" class="tag is-primary mt-auto mb-auto"> </span></div></button>', [{
|
||||
redundantAttribute: 'expr35',
|
||||
selector: '[expr35]',
|
||||
expressions: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'disabled',
|
||||
@ -185,24 +191,24 @@ var search = {
|
||||
evaluate: _scope => () => _scope.cruiseForward(_scope.item.name)
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr18',
|
||||
selector: '[expr18]',
|
||||
redundantAttribute: 'expr36',
|
||||
selector: '[expr36]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.item.name
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr19',
|
||||
selector: '[expr19]',
|
||||
redundantAttribute: 'expr37',
|
||||
selector: '[expr37]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.item.count
|
||||
}]
|
||||
}]),
|
||||
redundantAttribute: 'expr16',
|
||||
selector: '[expr16]',
|
||||
redundantAttribute: 'expr34',
|
||||
selector: '[expr34]',
|
||||
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 expr4="expr4"></span><span expr5="expr5" class="ml-1"> </span><progress expr6="expr6" 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: 'expr4',
|
||||
selector: '[expr4]',
|
||||
template: template(' ', [{
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
@ -38,16 +38,16 @@ var titleProgress = {
|
||||
}]
|
||||
}])
|
||||
}, {
|
||||
redundantAttribute: 'expr21',
|
||||
selector: '[expr21]',
|
||||
redundantAttribute: 'expr5',
|
||||
selector: '[expr5]',
|
||||
expressions: [{
|
||||
type: expressionTypes.TEXT,
|
||||
childNodeIndex: 0,
|
||||
evaluate: _scope => _scope.calcPct()
|
||||
}]
|
||||
}, {
|
||||
redundantAttribute: 'expr22',
|
||||
selector: '[expr22]',
|
||||
redundantAttribute: 'expr6',
|
||||
selector: '[expr6]',
|
||||
expressions: [{
|
||||
type: expressionTypes.ATTRIBUTE,
|
||||
name: 'value',
|
||||
|
Loading…
Reference in New Issue
Block a user