recuperation formation de search a mc

This commit is contained in:
Haïssous Kayyissa 2023-03-29 22:01:50 +02:00
parent 59e30c88ba
commit 550e172308
7 changed files with 111 additions and 77 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></search> <search updateCourse={updateCourse}></search>
</div> </div>
<div class="column"> <div class="column">
@ -17,7 +17,17 @@
<script> <script>
export default { export default {
onBeforeMount(props, state) {
//Initial state
this.state = {
formation: null
}
},
updateCourse(formation){
this.update({
formation: formation
})
}
} }
</script> </script>

View File

@ -36,8 +36,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() {
@ -45,11 +45,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
} }
@ -76,14 +76,18 @@
}, },
cruiseForward(selection) { cruiseForward(selection) {
if (this.state.currentStep >= 2) return
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
} }
@ -106,6 +110,7 @@
}, },
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],
@ -113,10 +118,12 @@
allItems: null, allItems: null,
filter: null, filter: null,
items: null, items: null,
filiere: null, course: [],
specialite: null, updating: false,
updating: false updateCourse: this.props.updateCourse
} }
console.log(this.state.updateCourse)
}, },
onMounted() { onMounted() {

View File

@ -1,38 +1,54 @@
var mainController = { var mainController = {
css: null, css: null,
exports: {}, exports: {
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 expr12="expr12"></search></div><div class="column"><fili-info expr13="expr13"></fili-info><school expr14="expr14"></school></div></div><school-info expr15="expr15"></school-info>', [{ onBeforeMount(props, state) {
//Initial state
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 expr470="expr470"></search></div><div class="column"><fili-info expr471="expr471"></fili-info><school expr472="expr472"></school></div></div><school-info expr473="expr473"></school-info>', [{
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'search', evaluate: _scope => 'search',
slots: [], slots: [],
attributes: [], attributes: [{
redundantAttribute: 'expr12', type: expressionTypes.ATTRIBUTE,
selector: '[expr12]' name: 'updateCourse',
evaluate: _scope => _scope.updateCourse
}],
redundantAttribute: 'expr470',
selector: '[expr470]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'fili-info', evaluate: _scope => 'fili-info',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr13', redundantAttribute: 'expr471',
selector: '[expr13]' selector: '[expr471]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'school', evaluate: _scope => 'school',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr14', redundantAttribute: 'expr472',
selector: '[expr14]' selector: '[expr472]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'school-info', evaluate: _scope => 'school-info',
slots: [], slots: [],
attributes: [], attributes: [],
redundantAttribute: 'expr15', redundantAttribute: 'expr473',
selector: '[expr15]' selector: '[expr473]'
}]), }]),
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 expr16="expr16"></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 expr3="expr3"></tr></tbody></table></div>', [{
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: null,
template: template('<td expr17="expr17"> </td><td expr18="expr18"> </td><td expr19="expr19"> </td><td expr20="expr20"> </td><td expr21="expr21"> </td>', [{ template: template('<td expr4="expr4"> </td><td expr5="expr5"> </td><td expr6="expr6"> </td><td expr7="expr7"> </td><td expr8="expr8"> </td>', [{
redundantAttribute: 'expr17', redundantAttribute: 'expr4',
selector: '[expr17]', selector: '[expr4]',
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: 'expr18', redundantAttribute: 'expr5',
selector: '[expr18]', selector: '[expr5]',
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: 'expr19', redundantAttribute: 'expr6',
selector: '[expr19]', selector: '[expr6]',
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: 'expr20', redundantAttribute: 'expr7',
selector: '[expr20]', selector: '[expr7]',
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: 'expr21', redundantAttribute: 'expr8',
selector: '[expr21]', selector: '[expr8]',
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: 'expr16', redundantAttribute: 'expr3',
selector: '[expr16]', selector: '[expr3]',
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 => {
@ -75,13 +75,16 @@ var search = {
}); });
}, },
cruiseForward(selection) { cruiseForward(selection) {
if (this.state.currentStep >= 2) return;
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;
} }
this.state.currentStep++; this.state.currentStep++;
@ -99,6 +102,7 @@ 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],
@ -106,18 +110,19 @@ var search = {
allItems: null, allItems: null,
filter: null, filter: null,
items: null, items: null,
filiere: null, course: [],
specialite: null, updating: false,
updating: false updateCourse: this.props.updateCourse
}; };
console.log(this.state.updateCourse);
}, },
onMounted() { onMounted() {
this.updateList(); this.updateList();
} }
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-1 m-2"><div class="columns m-1"><input expr304="expr304" class="input" type="input"/><button expr305="expr305" class="button ml-1">&lt;</button></div><div id="list-formations"><ul><li expr306="expr306" 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 expr60="expr60" class="input" type="input"/><button expr61="expr61" class="button ml-1">&lt;</button></div><div id="list-formations"><ul><li expr62="expr62" class="m-1"></li></ul></div></div>', [{
redundantAttribute: 'expr304', redundantAttribute: 'expr60',
selector: '[expr304]', selector: '[expr60]',
expressions: [{ expressions: [{
type: expressionTypes.EVENT, type: expressionTypes.EVENT,
name: 'onkeyup', name: 'onkeyup',
@ -128,8 +133,8 @@ var search = {
evaluate: _scope => _scope.state.placeholder evaluate: _scope => _scope.state.placeholder
}] }]
}, { }, {
redundantAttribute: 'expr305', redundantAttribute: 'expr61',
selector: '[expr305]', selector: '[expr61]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'disabled', name: 'disabled',
@ -143,9 +148,9 @@ var search = {
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: null,
template: template('<button expr307="expr307" class="button is-fullwidth"><span style="font-size: .75em;"><strong expr308="expr308"> </strong></span><div style="margin-left: auto;"></div><span expr309="expr309" class="tag is-primary"> </span></button>', [{ template: template('<button expr63="expr63" class="button is-fullwidth"><span style="font-size: .75em;"><strong expr64="expr64"> </strong></span><div style="margin-left: auto;"></div><span expr65="expr65" class="tag is-primary"> </span></button>', [{
redundantAttribute: 'expr307', redundantAttribute: 'expr63',
selector: '[expr307]', selector: '[expr63]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'disabled', name: 'disabled',
@ -156,24 +161,24 @@ var search = {
evaluate: _scope => () => _scope.cruiseForward(_scope.item.name) evaluate: _scope => () => _scope.cruiseForward(_scope.item.name)
}] }]
}, { }, {
redundantAttribute: 'expr308', redundantAttribute: 'expr64',
selector: '[expr308]', selector: '[expr64]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.item.name evaluate: _scope => _scope.item.name
}] }]
}, { }, {
redundantAttribute: 'expr309', redundantAttribute: 'expr65',
selector: '[expr309]', selector: '[expr65]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.item.count evaluate: _scope => _scope.item.count
}] }]
}]), }]),
redundantAttribute: 'expr306', redundantAttribute: 'expr62',
selector: '[expr306]', selector: '[expr62]',
itemName: 'item', itemName: 'item',
indexName: null, indexName: null,
evaluate: _scope => _scope.state.items evaluate: _scope => _scope.state.items