Liens entre les composants (WIP)

This commit is contained in:
HORVILLE 2023-03-30 00:54:13 +02:00
parent 25164157df
commit fd7e31f66b
11 changed files with 282 additions and 192 deletions

View File

@ -1,24 +1,41 @@
<fili-info> <fili-info>
<div class="box p-1 m-2"> <div class="box p-1 m-2" if={props.shouldShowInfos}>
<h1 class="title is-4 m-2"><a>BUT</a> / <a>BUT - Production</a> / <a>Informatique</a></h1> <h1 class="title is-4 m-2">
<span style="color: #485FC7;">{props.course.fili}</span> /
<span style="color: #485FC7;">{props.course.sousfili}</span> /
<span style="color: #485FC7;">{props.course.soussousfili}</span>
</h1>
<div class="box mt-2" style="background-color: #EAEAEA; margin: auto; width: 60%;"> <div class="box mt-2" style="background-color: #EAEAEA; margin: auto; width: 60%;">
<p>Moyenne des admis<span class="is-pulled-right">19.3</span></p> <p>Moyenne des admis<span class="is-pulled-right">{state.average}</span></p>
<p>Nombre de formations<span class="is-pulled-right">5</span></p> <p>Nombre de formations<span class="is-pulled-right">{state.courseNumber}</span></p>
<p>Capacité<span class="is-pulled-right">90</span></p> <p>Capacité<span class="is-pulled-right">{state.capacity}</span></p>
<p>Sélectivité</p> <p>Sélectivité</p>
</div> </div>
<div class="m-4"> <div class="m-4">
<line-graph style="height: 6rem;"></line-graph> <line-graph title="Répartition par genre" style="height: 6rem;"></line-graph>
</div> </div>
<div class="m-4"> <div class="m-4">
<line-graph style="height: 6rem;"></line-graph> <line-graph title="Répartition par bac" style="height: 6rem;"></line-graph>
</div> </div>
<div class="m-4"> <div class="m-4">
<line-graph style="height: 6rem;"></line-graph> <line-graph title="Répartition par mention au bac" style="height: 6rem;"></line-graph>
</div> </div>
</div> </div>
<script> <script>
export default {
onBeforeMount(props, state) {
this.state = {
average: 0,
capacity: 0,
selectivity: 0,
courseNumber: 0
}
},
onUpdated(props, state) {
}
}
</script> </script>
</fili-info> </fili-info>

View File

@ -10,6 +10,8 @@
updateCanvas() { updateCanvas() {
let canvas = this.$("canvas") let canvas = this.$("canvas")
if (!canvas) return
canvas.width = canvas.clientWidth canvas.width = canvas.clientWidth
canvas.height = canvas.clientHeight canvas.height = canvas.clientHeight
@ -36,7 +38,7 @@
cx.fillStyle = "#707070" cx.fillStyle = "#707070"
cx.font = "15px Arial" cx.font = "15px Arial"
cx.fillText("This is an example title", width / 2, 10) cx.fillText(this.props.title || "Example", width / 2, 10)
cx.font = "10px Arial" cx.font = "10px Arial"
cx.translate(0, 20) cx.translate(0, 20)

View File

@ -8,8 +8,8 @@
</div> </div>
<div class="column"> <div class="column">
<fili-info></fili-info> <fili-info course={state.course} shouldShowInfos={state.shouldShowInfos}></fili-info>
<school></school> <school course={state.course} shouldShowInfos={state.shouldShowInfos}></school>
</div> </div>
</div> </div>
@ -20,12 +20,14 @@
onBeforeMount(props, state) { onBeforeMount(props, state) {
//Initial state //Initial state
this.state = { this.state = {
formation: null course: null,
shouldShowInfos: false
} }
}, },
updateCourse(formation){ updateCourse(course){
this.update({ this.update({
formation: formation course: course,
shouldShowInfos: course != null
}) })
} }
} }

View File

@ -1,5 +1,5 @@
<school> <school>
<div class="box p-2 m-2"> <div if={props.shouldShowInfos} class="box p-2 m-2">
<iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" <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&amp;layer=mapnik" src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&amp;layer=mapnik"
style="border-radius: 5px;"></iframe> style="border-radius: 5px;"></iframe>
@ -21,7 +21,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr each={etablissement in this.state.items}> <tr if={!state.loading} each={etablissement in state.items}>
<td>{etablissement.fields.g_ea_lib_vx}</td> <td>{etablissement.fields.g_ea_lib_vx}</td>
<td>{etablissement.fields.ville_etab}</td> <td>{etablissement.fields.ville_etab}</td>
<td>{etablissement.fields.dep}</td> <td>{etablissement.fields.dep}</td>
@ -35,23 +35,22 @@
<script> <script>
import PAPI from '../javascript/parcoursup-link.js' import PAPI from '../javascript/parcoursup-link.js'
async function fetchEtablissement(formation) { async function fetchEtablissement(course) {
return PAPI.fetchEtablissement(formation.fili, formation.sousfili, formation.soussousfili); return PAPI.fetchEtablissement(course.fili, course.sousfili, course.soussousfili);
} }
export default function search() { export default function search() {
return { return {
onBeforeMount(props, state) { onBeforeMount(props, state) {
this.state = { state = {
items: null, items: null
formation: this.props.formation
} }
fetchEtablissement(this.state.formation).then((response) => { },
this.update({
items: response onUpdated(props, state) {
}) if (!props.shouldShowInfos) return
//console.log(this.state.items) fetchEtablissement(props.course).then((response) => {
this.state.items.forEach(etablissement => { response.forEach(etablissement => {
// calcul la moyenne // calcul la moyenne
let pct_sansmention = etablissement.fields.pct_sansmention let pct_sansmention = etablissement.fields.pct_sansmention
let pct_AB = etablissement.fields.pct_ab let pct_AB = etablissement.fields.pct_ab
@ -61,12 +60,12 @@
// On prend la moyenne des moyennes comprises dans la mention // On prend la moyenne des moyennes comprises dans la mention
// Exemple : Assez bien est entre 12 et 14 donc 13. // 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*11))/100 etablissement.fields.moyenne = ((pct_TBF*19)+(pct_TB*17)+(pct_B*15)+(pct_AB*13)+(pct_sansmention*11))/100
})
etablissement.fields.moyenne=moyenne
//console.log(etablissement.fields) this.update({
items: response
}) })
this.update()
}) })
} }
} }

View File

@ -30,10 +30,6 @@
updateList() { updateList() {
let promise let promise
this.update({
updating: true
})
switch (this.state.currentStep) { switch (this.state.currentStep) {
case 0: case 0:
promise = PAPI.fetchFilieres() promise = PAPI.fetchFilieres()
@ -44,8 +40,15 @@
case 2: case 2:
promise = PAPI.fetchSpecialites(this.state.course.sousfili) promise = PAPI.fetchSpecialites(this.state.course.sousfili)
break break
default:
return
} }
this.update({
updating: true
})
promise.then((response) => { promise.then((response) => {
this.state.allItems = response this.state.allItems = response
this.filterSearch() this.filterSearch()
@ -99,13 +102,7 @@
case 2: case 2:
this.state.course.soussousfili = selection this.state.course.soussousfili = selection
this.state.updateCourse(this.state.course) this.props.updateCourse(this.state.course)
break
case 2:
console.log(this.props)
console.log(this.root)
console.log("end")
return return
default: default:
@ -132,19 +129,15 @@
}, },
onBeforeMount(props, state) { onBeforeMount(props, state) {
console.log("on m'a appelé")
//Initial state //Initial state
this.state = { this.state = {
placeholder: PLACEHOLDERS[0], placeholder: PLACEHOLDERS[0],
currentStep: 0, currentStep: 0,
allItems: null, allItems: null,
items: null, items: null,
course: [], course: {},
updating: false, updating: false,
updateCourse: this.props.updateCourse
} }
console.log(this.state.updateCourse)
}, },
onMounted(props, state) { onMounted(props, state) {

View File

@ -1,30 +1,94 @@
var filiInfo = { var filiInfo = {
css: null, css: null,
exports: null, exports: {
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-1 m-2"><h1 class="title is-4 m-2"><a>BUT</a> / <a>BUT - Production</a> / <a>Informatique</a></h1><div class="box mt-2" style="background-color: #EAEAEA; margin: auto; width: 60%;"><p>Moyenne des admis<span class="is-pulled-right">19.3</span></p><p>Nombre de formations<span class="is-pulled-right">5</span></p><p>Capacité<span class="is-pulled-right">90</span></p><p>Sélectivité</p></div><div class="m-4"><line-graph expr0="expr0" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr1="expr1" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr2="expr2" style="height: 6rem;"></line-graph></div></div>', [{ onBeforeMount(props, state) {
type: bindingTypes.TAG, this.state = {
getComponent: getComponent, average: 0,
evaluate: _scope => 'line-graph', capacity: 0,
slots: [], selectivity: 0,
attributes: [], courseNumber: 0
redundantAttribute: 'expr0', };
selector: '[expr0]' },
onUpdated(props, state) {}
},
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr1500="expr1500" class="box p-1 m-2"></div>', [{
type: bindingTypes.IF,
evaluate: _scope => _scope.props.shouldShowInfos,
redundantAttribute: 'expr1500',
selector: '[expr1500]',
template: template('<h1 class="title is-4 m-2"><span expr1501="expr1501" style="color: #485FC7;"> </span> / \r\n <span expr1502="expr1502" style="color: #485FC7;"> </span> / \r\n <span expr1503="expr1503" style="color: #485FC7;"> </span></h1><div class="box mt-2" style="background-color: #EAEAEA; margin: auto; width: 60%;"><p>Moyenne des admis<span expr1504="expr1504" class="is-pulled-right"> </span></p><p>Nombre de formations<span expr1505="expr1505" class="is-pulled-right"> </span></p><p>Capacité<span expr1506="expr1506" class="is-pulled-right"> </span></p><p>Sélectivité</p></div><div class="m-4"><line-graph expr1507="expr1507" title="Répartition par genre" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr1508="expr1508" title="Répartition par bac" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr1509="expr1509" title="Répartition par mention au bac" style="height: 6rem;"></line-graph></div>', [{
redundantAttribute: 'expr1501',
selector: '[expr1501]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.props.course.fili
}]
}, {
redundantAttribute: 'expr1502',
selector: '[expr1502]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.props.course.sousfili
}]
}, {
redundantAttribute: 'expr1503',
selector: '[expr1503]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.props.course.soussousfili
}]
}, {
redundantAttribute: 'expr1504',
selector: '[expr1504]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.state.average
}]
}, {
redundantAttribute: 'expr1505',
selector: '[expr1505]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.state.courseNumber
}]
}, {
redundantAttribute: 'expr1506',
selector: '[expr1506]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.state.capacity
}]
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'line-graph', evaluate: _scope => 'line-graph',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr1', redundantAttribute: 'expr1507',
selector: '[expr1]' selector: '[expr1507]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'line-graph', evaluate: _scope => 'line-graph',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr2', redundantAttribute: 'expr1508',
selector: '[expr2]' selector: '[expr1508]'
}, {
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'line-graph',
slots: [],
attributes: [],
redundantAttribute: 'expr1509',
selector: '[expr1509]'
}])
}]), }]),
name: 'fili-info' name: 'fili-info'
}; };

View File

@ -3,6 +3,7 @@ var lineGraph = {
exports: { exports: {
updateCanvas() { updateCanvas() {
let canvas = this.$("canvas"); let canvas = this.$("canvas");
if (!canvas) return;
canvas.width = canvas.clientWidth; canvas.width = canvas.clientWidth;
canvas.height = canvas.clientHeight; canvas.height = canvas.clientHeight;
let cx = canvas.getContext("2d"); let cx = canvas.getContext("2d");
@ -18,7 +19,7 @@ var lineGraph = {
if (!data) return; if (!data) return;
cx.fillStyle = "#707070"; cx.fillStyle = "#707070";
cx.font = "15px Arial"; cx.font = "15px Arial";
cx.fillText("This is an example title", width / 2, 10); cx.fillText(this.props.title || "Example", width / 2, 10);
cx.font = "10px Arial"; cx.font = "10px Arial";
cx.translate(0, 20); cx.translate(0, 20);
let total = data.reduce((total, current) => total + current.value, 0); let total = data.reduce((total, current) => total + current.value, 0);

View File

@ -4,16 +4,18 @@ var mainController = {
onBeforeMount(props, state) { onBeforeMount(props, state) {
//Initial state //Initial state
this.state = { this.state = {
formation: null course: null,
shouldShowInfos: false
}; };
}, },
updateCourse(formation) { updateCourse(course) {
this.update({ this.update({
formation: formation course: course,
shouldShowInfos: course != null
}); });
} }
}, },
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 expr984="expr984"></search></div><div class="column"><fili-info expr985="expr985"></fili-info><school expr986="expr986"></school></div></div><school-info expr987="expr987"></school-info>', [{ 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 expr1334="expr1334"></search></div><div class="column"><fili-info expr1335="expr1335"></fili-info><school expr1336="expr1336"></school></div></div><school-info expr1337="expr1337"></school-info>', [{
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'search', evaluate: _scope => 'search',
@ -23,32 +25,48 @@ var mainController = {
name: 'updateCourse', name: 'updateCourse',
evaluate: _scope => _scope.updateCourse evaluate: _scope => _scope.updateCourse
}], }],
redundantAttribute: 'expr984', redundantAttribute: 'expr1334',
selector: '[expr984]' selector: '[expr1334]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'fili-info', evaluate: _scope => 'fili-info',
slots: [], slots: [],
attributes: [], attributes: [{
redundantAttribute: 'expr985', type: expressionTypes.ATTRIBUTE,
selector: '[expr985]' name: 'course',
evaluate: _scope => _scope.state.course
}, {
type: expressionTypes.ATTRIBUTE,
name: 'shouldShowInfos',
evaluate: _scope => _scope.state.shouldShowInfos
}],
redundantAttribute: 'expr1335',
selector: '[expr1335]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'school', evaluate: _scope => 'school',
slots: [], slots: [],
attributes: [], attributes: [{
redundantAttribute: 'expr986', type: expressionTypes.ATTRIBUTE,
selector: '[expr986]' name: 'course',
evaluate: _scope => _scope.state.course
}, {
type: expressionTypes.ATTRIBUTE,
name: 'shouldShowInfos',
evaluate: _scope => _scope.state.shouldShowInfos
}],
redundantAttribute: 'expr1336',
selector: '[expr1336]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'school-info', evaluate: _scope => 'school-info',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr987', redundantAttribute: 'expr1337',
selector: '[expr987]' selector: '[expr1337]'
}]), }]),
name: 'main-controller' name: 'main-controller'
}; };

View File

@ -10,14 +10,14 @@ var schoolInfo = {
this.update(); this.update();
} }
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr19="expr19" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background: #000000DD;"></div>', [{ template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr9="expr9" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background: #000000DD;"></div>', [{
type: bindingTypes.IF, type: bindingTypes.IF,
evaluate: _scope => _scope.state.enabled, evaluate: _scope => _scope.state.enabled,
redundantAttribute: 'expr19', redundantAttribute: 'expr9',
selector: '[expr19]', selector: '[expr9]',
template: template('<div style="position: absolute; top: 10%; left: 10%; width: 80%; height: 80%; background: #FFFFFF"><button expr20="expr20" class="delete is-medium">X</button><p><h2></h2></p><line-graph expr21="expr21" style="height: 90px; margin: 10px;"></line-graph></div>', [{ template: template('<div style="position: absolute; top: 10%; left: 10%; width: 80%; height: 80%; background: #FFFFFF"><button expr10="expr10" class="delete is-medium">X</button><p><h2></h2></p><line-graph expr11="expr11" style="height: 90px; margin: 10px;"></line-graph></div>', [{
redundantAttribute: 'expr20', redundantAttribute: 'expr10',
selector: '[expr20]', selector: '[expr10]',
expressions: [{ expressions: [{
type: expressionTypes.EVENT, type: expressionTypes.EVENT,
name: 'onclick', name: 'onclick',
@ -29,8 +29,8 @@ var schoolInfo = {
evaluate: _scope => 'line-graph', evaluate: _scope => 'line-graph',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr21', redundantAttribute: 'expr11',
selector: '[expr21]' selector: '[expr11]'
}]) }])
}]), }]),
name: 'school-info' name: 'school-info'

View File

@ -29,24 +29,19 @@ class PAPI {
} }
} }
async function fetchEtablissement(formation) { async function fetchEtablissement(course) {
return PAPI.fetchEtablissement(formation.fili, formation.sousfili, formation.soussousfili); return PAPI.fetchEtablissement(course.fili, course.sousfili, course.soussousfili);
} }
var school = { var school = {
css: null, css: null,
exports: function search() { exports: function search() {
return { return {
onBeforeMount(props, state) { onBeforeMount(props, state) {
this.state = { },
items: null, onUpdated(props, state) {
formation: this.props.formation if (!props.shouldShowInfos) return;
}; fetchEtablissement(props.course).then(response => {
fetchEtablissement(this.state.formation).then(response => { response.forEach(etablissement => {
this.update({
items: response
});
//console.log(this.state.items)
this.state.items.forEach(etablissement => {
// calcul la moyenne // calcul la moyenne
let pct_sansmention = etablissement.fields.pct_sansmention; let pct_sansmention = etablissement.fields.pct_sansmention;
let pct_AB = etablissement.fields.pct_ab; let pct_AB = etablissement.fields.pct_ab;
@ -56,66 +51,71 @@ var school = {
// On prend la moyenne des moyennes comprises dans la mention // On prend la moyenne des moyennes comprises dans la mention
// Exemple : Assez bien est entre 12 et 14 donc 13. // 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 * 11) / 100; etablissement.fields.moyenne = (pct_TBF * 19 + pct_TB * 17 + pct_B * 15 + pct_AB * 13 + pct_sansmention * 11) / 100;
etablissement.fields.moyenne = moyenne; });
//console.log(etablissement.fields) this.update({
items: response
}); });
this.update();
}); });
} }
}; };
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<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&amp;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><table class="table is-fullwidth is-hoverable"><thead><tr><th><abbr title="name">Nom</abbr></th><th><abbr title="city">Ville</abbr></th><th><abbr title="dept">Dpt</abbr></th><th><abbr title="moyenne">Moyenne</abbr></th><th><abbr title="selectivite">Sélectivité</abbr></th></tr></thead><tbody><tr expr972="expr972"></tr></tbody></table></div>', [{ template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr1453="expr1453" class="box p-2 m-2"></div>', [{
type: bindingTypes.IF,
evaluate: _scope => _scope.props.shouldShowInfos,
redundantAttribute: 'expr1453',
selector: '[expr1453]',
template: template('<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&amp;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><table class="table is-fullwidth is-hoverable"><thead><tr><th><abbr title="name">Nom</abbr></th><th><abbr title="city">Ville</abbr></th><th><abbr title="dept">Dpt</abbr></th><th><abbr title="moyenne">Moyenne</abbr></th><th><abbr title="selectivite">Sélectivité</abbr></th></tr></thead><tbody><tr expr1454="expr1454"></tr></tbody></table>', [{
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: _scope => !_scope.state.loading,
template: template('<td expr973="expr973"> </td><td expr974="expr974"> </td><td expr975="expr975"> </td><td expr976="expr976"> </td><td expr977="expr977"> </td>', [{ template: template('<td expr1455="expr1455"> </td><td expr1456="expr1456"> </td><td expr1457="expr1457"> </td><td expr1458="expr1458"> </td><td expr1459="expr1459"> </td>', [{
redundantAttribute: 'expr973', redundantAttribute: 'expr1455',
selector: '[expr973]', selector: '[expr1455]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.g_ea_lib_vx evaluate: _scope => _scope.etablissement.fields.g_ea_lib_vx
}] }]
}, { }, {
redundantAttribute: 'expr974', redundantAttribute: 'expr1456',
selector: '[expr974]', selector: '[expr1456]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.ville_etab evaluate: _scope => _scope.etablissement.fields.ville_etab
}] }]
}, { }, {
redundantAttribute: 'expr975', redundantAttribute: 'expr1457',
selector: '[expr975]', selector: '[expr1457]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.dep evaluate: _scope => _scope.etablissement.fields.dep
}] }]
}, { }, {
redundantAttribute: 'expr976', redundantAttribute: 'expr1458',
selector: '[expr976]', selector: '[expr1458]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.moyenne evaluate: _scope => _scope.etablissement.fields.moyenne
}] }]
}, { }, {
redundantAttribute: 'expr977', redundantAttribute: 'expr1459',
selector: '[expr977]', selector: '[expr1459]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.taux_acces_ens evaluate: _scope => _scope.etablissement.fields.taux_acces_ens
}] }]
}]), }]),
redundantAttribute: 'expr972', redundantAttribute: 'expr1454',
selector: '[expr972]', selector: '[expr1454]',
itemName: 'etablissement', itemName: 'etablissement',
indexName: null, indexName: null,
evaluate: _scope => _scope.state.items evaluate: _scope => _scope.state.items
}])
}]), }]),
name: 'school' name: 'school'
}; };

View File

@ -35,9 +35,6 @@ var search = {
exports: { exports: {
updateList() { updateList() {
let promise; let promise;
this.update({
updating: true
});
switch (this.state.currentStep) { switch (this.state.currentStep) {
case 0: case 0:
promise = PAPI.fetchFilieres(); promise = PAPI.fetchFilieres();
@ -48,7 +45,12 @@ var search = {
case 2: case 2:
promise = PAPI.fetchSpecialites(this.state.course.sousfili); promise = PAPI.fetchSpecialites(this.state.course.sousfili);
break; break;
default:
return;
} }
this.update({
updating: true
});
promise.then(response => { promise.then(response => {
this.state.allItems = response; this.state.allItems = response;
this.filterSearch(); this.filterSearch();
@ -94,12 +96,7 @@ var search = {
break; break;
case 2: case 2:
this.state.course.soussousfili = selection; this.state.course.soussousfili = selection;
this.state.updateCourse(this.state.course); this.props.updateCourse(this.state.course);
break;
case 2:
console.log(this.props);
console.log(this.root);
console.log("end");
return; return;
default: default:
return; return;
@ -121,26 +118,23 @@ var search = {
}); });
}, },
onBeforeMount(props, state) { onBeforeMount(props, state) {
console.log("on m'a appelé");
//Initial state //Initial state
this.state = { this.state = {
placeholder: PLACEHOLDERS[0], placeholder: PLACEHOLDERS[0],
currentStep: 0, currentStep: 0,
allItems: null, allItems: null,
items: null, items: null,
course: [], course: {},
updating: false, updating: false
updateCourse: this.props.updateCourse
}; };
console.log(this.state.updateCourse);
}, },
onMounted(props, state) { onMounted(props, state) {
this.updateList(); this.updateList();
} }
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-1 m-2"><div class="columns m-1"><input expr978="expr978" class="input" type="input"/><button expr979="expr979" class="button ml-1">&lt;</button></div><div id="list-formations"><ul><li expr980="expr980" class="m-1"></li></ul></div></div>', [{ template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-1 m-2"><div class="columns m-1"><input expr1400="expr1400" class="input" type="input"/><button expr1401="expr1401" class="button ml-1">&lt;</button></div><div id="list-formations"><ul><li expr1402="expr1402" class="m-1"></li></ul></div></div>', [{
redundantAttribute: 'expr978', redundantAttribute: 'expr1400',
selector: '[expr978]', selector: '[expr1400]',
expressions: [{ expressions: [{
type: expressionTypes.EVENT, type: expressionTypes.EVENT,
name: 'onkeyup', name: 'onkeyup',
@ -151,8 +145,8 @@ var search = {
evaluate: _scope => _scope.state.placeholder evaluate: _scope => _scope.state.placeholder
}] }]
}, { }, {
redundantAttribute: 'expr979', redundantAttribute: 'expr1401',
selector: '[expr979]', selector: '[expr1401]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'disabled', name: 'disabled',
@ -166,9 +160,9 @@ var search = {
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: null,
template: template('<button expr981="expr981" class="button is-fullwidth p-2"><span style="font-size: .75em; max-size: 90%"><strong expr982="expr982"> </strong></span><div style="margin-left: auto;"></div><span expr983="expr983" class="tag is-primary"> </span></button>', [{ template: template('<button expr1403="expr1403" class="button is-fullwidth p-2"><span style="font-size: .75em; max-size: 90%"><strong expr1404="expr1404"> </strong></span><div style="margin-left: auto;"></div><span expr1405="expr1405" class="tag is-primary"> </span></button>', [{
redundantAttribute: 'expr981', redundantAttribute: 'expr1403',
selector: '[expr981]', selector: '[expr1403]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'disabled', name: 'disabled',
@ -179,24 +173,24 @@ var search = {
evaluate: _scope => () => _scope.cruiseForward(_scope.item.name) evaluate: _scope => () => _scope.cruiseForward(_scope.item.name)
}] }]
}, { }, {
redundantAttribute: 'expr982', redundantAttribute: 'expr1404',
selector: '[expr982]', selector: '[expr1404]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.item.name evaluate: _scope => _scope.item.name
}] }]
}, { }, {
redundantAttribute: 'expr983', redundantAttribute: 'expr1405',
selector: '[expr983]', selector: '[expr1405]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.item.count evaluate: _scope => _scope.item.count
}] }]
}]), }]),
redundantAttribute: 'expr980', redundantAttribute: 'expr1402',
selector: '[expr980]', selector: '[expr1402]',
itemName: 'item', itemName: 'item',
indexName: null, indexName: null,
evaluate: _scope => _scope.state.items evaluate: _scope => _scope.state.items