This commit is contained in:
HORVILLE 2023-03-29 22:57:36 +02:00
commit 25164157df
7 changed files with 104 additions and 80 deletions

View File

@ -4,7 +4,7 @@
<div class="box p-3 m-2"> <div class="box p-3 m-2">
<img class="mt-1 ml-5 mr-auto" style="margin: auto;" src="../resources/logo-parcoursup.svg"/> <img class="mt-1 ml-5 mr-auto" style="margin: auto;" src="../resources/logo-parcoursup.svg"/>
</div> </div>
<search partouse={searchListener}></search> <search updateCourse={updateCourse}></search>
</div> </div>
<div class="column"> <div class="column">
@ -17,10 +17,17 @@
<script> <script>
export default { export default {
//Fonction qui va écouter ce que <search> a à dire. onBeforeMount(props, state) {
searchListener(arg) { //Initial state
console.log("Search il a dit: " + arg) this.state = {
} formation: null
}
},
updateCourse(formation){
this.update({
formation: formation
})
}
} }
</script> </script>

View File

@ -35,8 +35,8 @@
<script> <script>
import PAPI from '../javascript/parcoursup-link.js' import PAPI from '../javascript/parcoursup-link.js'
async function fetchEtablissement(state) { async function fetchEtablissement(formation) {
return PAPI.fetchEtablissement(state.fili, state.sousfili, state.soussousfili); return PAPI.fetchEtablissement(formation.fili, formation.sousfili, formation.soussousfili);
} }
export default function search() { export default function search() {
@ -44,11 +44,9 @@
onBeforeMount(props, state) { onBeforeMount(props, state) {
this.state = { this.state = {
items: null, items: null,
fili: "BUT", formation: this.props.formation
sousfili: "BUT - Production",
soussousfili : "Informatique"
} }
fetchEtablissement(this.state).then((response) => { fetchEtablissement(this.state.formation).then((response) => {
this.update({ this.update({
items: response items: response
}) })

View File

@ -39,10 +39,10 @@
promise = PAPI.fetchFilieres() promise = PAPI.fetchFilieres()
break break
case 1: case 1:
promise = PAPI.fetchFiliere(this.state.filiere) promise = PAPI.fetchFiliere(this.state.course.fili)
break break
case 2: case 2:
promise = PAPI.fetchSpecialites(this.state.specialite) promise = PAPI.fetchSpecialites(this.state.course.sousfili)
break break
} }
@ -90,11 +90,16 @@
cruiseForward(selection) { cruiseForward(selection) {
switch (this.state.currentStep) { switch (this.state.currentStep) {
case 0: case 0:
this.state.filiere = selection this.state.course.fili = selection
break break
case 1: case 1:
this.state.specialite = selection this.state.course.sousfili = selection
break
case 2:
this.state.course.soussousfili = selection
this.state.updateCourse(this.state.course)
break break
case 2: case 2:
@ -127,16 +132,19 @@
}, },
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,
filiere: null, course: [],
specialite: null,
updating: false, updating: false,
updateCourse: this.props.updateCourse
} }
console.log(this.state.updateCourse)
}, },
onMounted(props, state) { onMounted(props, state) {

View File

@ -1,47 +1,54 @@
var mainController = { var mainController = {
css: null, css: null,
exports: { exports: {
//Fonction qui va écouter ce que <search> a à dire. onBeforeMount(props, state) {
searchListener(arg) { //Initial state
console.log("Search il a dit: " + arg); this.state = {
formation: null
};
},
updateCourse(formation) {
this.update({
formation: formation
});
} }
}, },
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 expr932="expr932"></search></div><div class="column"><fili-info expr933="expr933"></fili-info><school expr934="expr934"></school></div></div><school-info expr935="expr935"></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 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>', [{
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'search', evaluate: _scope => 'search',
slots: [], slots: [],
attributes: [{ attributes: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'partouse', name: 'updateCourse',
evaluate: _scope => _scope.searchListener evaluate: _scope => _scope.updateCourse
}], }],
redundantAttribute: 'expr932', redundantAttribute: 'expr984',
selector: '[expr932]' selector: '[expr984]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'fili-info', evaluate: _scope => 'fili-info',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr933', redundantAttribute: 'expr985',
selector: '[expr933]' selector: '[expr985]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'school', evaluate: _scope => 'school',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr934', redundantAttribute: 'expr986',
selector: '[expr934]' selector: '[expr986]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'school-info', evaluate: _scope => 'school-info',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr935', redundantAttribute: 'expr987',
selector: '[expr935]' selector: '[expr987]'
}]), }]),
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 expr9="expr9" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background: #000000DD;"></div>', [{ template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr19="expr19" 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: 'expr9', redundantAttribute: 'expr19',
selector: '[expr9]', selector: '[expr19]',
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>', [{ 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>', [{
redundantAttribute: 'expr10', redundantAttribute: 'expr20',
selector: '[expr10]', selector: '[expr20]',
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: 'expr11', redundantAttribute: 'expr21',
selector: '[expr11]' selector: '[expr21]'
}]) }])
}]), }]),
name: 'school-info' name: 'school-info'

View File

@ -29,8 +29,8 @@ class PAPI {
} }
} }
async function fetchEtablissement(state) { async function fetchEtablissement(formation) {
return PAPI.fetchEtablissement(state.fili, state.sousfili, state.soussousfili); return PAPI.fetchEtablissement(formation.fili, formation.sousfili, formation.soussousfili);
} }
var school = { var school = {
css: null, css: null,
@ -39,11 +39,9 @@ var school = {
onBeforeMount(props, state) { onBeforeMount(props, state) {
this.state = { this.state = {
items: null, items: null,
fili: "BUT", formation: this.props.formation
sousfili: "BUT - Production",
soussousfili: "Informatique"
}; };
fetchEtablissement(this.state).then(response => { fetchEtablissement(this.state.formation).then(response => {
this.update({ this.update({
items: response items: response
}); });
@ -68,53 +66,53 @@ var school = {
} }
}; };
}, },
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 expr406="expr406"></tr></tbody></table></div>', [{ 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>', [{
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: null,
template: template('<td expr407="expr407"> </td><td expr408="expr408"> </td><td expr409="expr409"> </td><td expr410="expr410"> </td><td expr411="expr411"> </td>', [{ template: template('<td expr973="expr973"> </td><td expr974="expr974"> </td><td expr975="expr975"> </td><td expr976="expr976"> </td><td expr977="expr977"> </td>', [{
redundantAttribute: 'expr407', redundantAttribute: 'expr973',
selector: '[expr407]', selector: '[expr973]',
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: 'expr408', redundantAttribute: 'expr974',
selector: '[expr408]', selector: '[expr974]',
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: 'expr409', redundantAttribute: 'expr975',
selector: '[expr409]', selector: '[expr975]',
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: 'expr410', redundantAttribute: 'expr976',
selector: '[expr410]', selector: '[expr976]',
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: 'expr411', redundantAttribute: 'expr977',
selector: '[expr411]', selector: '[expr977]',
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: 'expr406', redundantAttribute: 'expr972',
selector: '[expr406]', selector: '[expr972]',
itemName: 'etablissement', itemName: 'etablissement',
indexName: null, indexName: null,
evaluate: _scope => _scope.state.items evaluate: _scope => _scope.state.items

View File

@ -43,10 +43,10 @@ var search = {
promise = PAPI.fetchFilieres(); promise = PAPI.fetchFilieres();
break; break;
case 1: case 1:
promise = PAPI.fetchFiliere(this.state.filiere); promise = PAPI.fetchFiliere(this.state.course.fili);
break; break;
case 2: case 2:
promise = PAPI.fetchSpecialites(this.state.specialite); promise = PAPI.fetchSpecialites(this.state.course.sousfili);
break; break;
} }
promise.then(response => { promise.then(response => {
@ -87,10 +87,14 @@ var search = {
cruiseForward(selection) { cruiseForward(selection) {
switch (this.state.currentStep) { switch (this.state.currentStep) {
case 0: case 0:
this.state.filiere = selection; this.state.course.fili = selection;
break; break;
case 1: case 1:
this.state.specialite = selection; this.state.course.sousfili = selection;
break;
case 2:
this.state.course.soussousfili = selection;
this.state.updateCourse(this.state.course);
break; break;
case 2: case 2:
console.log(this.props); console.log(this.props);
@ -117,24 +121,26 @@ 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,
filiere: null, course: [],
specialite: null, 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 expr966="expr966" class="input" type="input"/><button expr967="expr967" class="button ml-1">&lt;</button></div><div id="list-formations"><ul><li expr968="expr968" 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 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>', [{
redundantAttribute: 'expr966', redundantAttribute: 'expr978',
selector: '[expr966]', selector: '[expr978]',
expressions: [{ expressions: [{
type: expressionTypes.EVENT, type: expressionTypes.EVENT,
name: 'onkeyup', name: 'onkeyup',
@ -145,8 +151,8 @@ var search = {
evaluate: _scope => _scope.state.placeholder evaluate: _scope => _scope.state.placeholder
}] }]
}, { }, {
redundantAttribute: 'expr967', redundantAttribute: 'expr979',
selector: '[expr967]', selector: '[expr979]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'disabled', name: 'disabled',
@ -160,9 +166,9 @@ var search = {
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: null,
template: template('<button expr969="expr969" class="button is-fullwidth p-2"><span style="font-size: .75em; max-size: 90%"><strong expr970="expr970"> </strong></span><div style="margin-left: auto;"></div><span expr971="expr971" class="tag is-primary"> </span></button>', [{ 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>', [{
redundantAttribute: 'expr969', redundantAttribute: 'expr981',
selector: '[expr969]', selector: '[expr981]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'disabled', name: 'disabled',
@ -173,24 +179,24 @@ var search = {
evaluate: _scope => () => _scope.cruiseForward(_scope.item.name) evaluate: _scope => () => _scope.cruiseForward(_scope.item.name)
}] }]
}, { }, {
redundantAttribute: 'expr970', redundantAttribute: 'expr982',
selector: '[expr970]', selector: '[expr982]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.item.name evaluate: _scope => _scope.item.name
}] }]
}, { }, {
redundantAttribute: 'expr971', redundantAttribute: 'expr983',
selector: '[expr971]', selector: '[expr983]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.item.count evaluate: _scope => _scope.item.count
}] }]
}]), }]),
redundantAttribute: 'expr968', redundantAttribute: 'expr980',
selector: '[expr968]', selector: '[expr980]',
itemName: 'item', itemName: 'item',
indexName: null, indexName: null,
evaluate: _scope => _scope.state.items evaluate: _scope => _scope.state.items