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">
<img class="mt-1 ml-5 mr-auto" style="margin: auto;" src="../resources/logo-parcoursup.svg"/>
</div>
<search></search>
<search updateCourse={updateCourse}></search>
</div>
<div class="column">
@ -17,7 +17,17 @@
<script>
export default {
onBeforeMount(props, state) {
//Initial state
this.state = {
formation: null
}
},
updateCourse(formation){
this.update({
formation: formation
})
}
}
</script>

View File

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

View File

@ -39,10 +39,10 @@
promise = PAPI.fetchFilieres()
break
case 1:
promise = PAPI.fetchFiliere(this.state.filiere)
promise = PAPI.fetchFiliere(this.state.course.fili)
break
case 2:
promise = PAPI.fetchSpecialites(this.state.specialite)
promise = PAPI.fetchSpecialites(this.state.course.sousfili)
break
}
@ -76,14 +76,18 @@
},
cruiseForward(selection) {
if (this.state.currentStep >= 2) return
switch (this.state.currentStep) {
case 0:
this.state.filiere = selection
this.state.course.fili = selection
break
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
}
@ -106,6 +110,7 @@
},
onBeforeMount(props, state) {
console.log("on m'a appelé")
//Initial state
this.state = {
placeholder: PLACEHOLDERS[0],
@ -113,10 +118,12 @@
allItems: null,
filter: null,
items: null,
filiere: null,
specialite: null,
updating: false
course: [],
updating: false,
updateCourse: this.props.updateCourse
}
console.log(this.state.updateCourse)
},
onMounted() {

View File

@ -1,38 +1,54 @@
var mainController = {
css: null,
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>', [{
exports: {
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,
getComponent: getComponent,
evaluate: _scope => 'search',
slots: [],
attributes: [],
redundantAttribute: 'expr12',
selector: '[expr12]'
attributes: [{
type: expressionTypes.ATTRIBUTE,
name: 'updateCourse',
evaluate: _scope => _scope.updateCourse
}],
redundantAttribute: 'expr470',
selector: '[expr470]'
}, {
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'fili-info',
slots: [],
attributes: [],
redundantAttribute: 'expr13',
selector: '[expr13]'
redundantAttribute: 'expr471',
selector: '[expr471]'
}, {
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'school',
slots: [],
attributes: [],
redundantAttribute: 'expr14',
selector: '[expr14]'
redundantAttribute: 'expr472',
selector: '[expr472]'
}, {
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'school-info',
slots: [],
attributes: [],
redundantAttribute: 'expr15',
selector: '[expr15]'
redundantAttribute: 'expr473',
selector: '[expr473]'
}]),
name: 'main-controller'
};

View File

@ -10,14 +10,14 @@ var schoolInfo = {
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,
evaluate: _scope => _scope.state.enabled,
redundantAttribute: 'expr9',
selector: '[expr9]',
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: 'expr10',
selector: '[expr10]',
redundantAttribute: 'expr19',
selector: '[expr19]',
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: 'expr20',
selector: '[expr20]',
expressions: [{
type: expressionTypes.EVENT,
name: 'onclick',
@ -29,8 +29,8 @@ var schoolInfo = {
evaluate: _scope => 'line-graph',
slots: [],
attributes: [],
redundantAttribute: 'expr11',
selector: '[expr11]'
redundantAttribute: 'expr21',
selector: '[expr21]'
}])
}]),
name: 'school-info'

View File

@ -29,8 +29,8 @@ class PAPI {
}
}
async function fetchEtablissement(state) {
return PAPI.fetchEtablissement(state.fili, state.sousfili, state.soussousfili);
async function fetchEtablissement(formation) {
return PAPI.fetchEtablissement(formation.fili, formation.sousfili, formation.soussousfili);
}
var school = {
css: null,
@ -39,11 +39,9 @@ var school = {
onBeforeMount(props, state) {
this.state = {
items: null,
fili: "BUT",
sousfili: "BUT - Production",
soussousfili: "Informatique"
formation: this.props.formation
};
fetchEtablissement(this.state).then(response => {
fetchEtablissement(this.state.formation).then(response => {
this.update({
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,
getKey: 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>', [{
redundantAttribute: 'expr17',
selector: '[expr17]',
template: template('<td expr4="expr4"> </td><td expr5="expr5"> </td><td expr6="expr6"> </td><td expr7="expr7"> </td><td expr8="expr8"> </td>', [{
redundantAttribute: 'expr4',
selector: '[expr4]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.g_ea_lib_vx
}]
}, {
redundantAttribute: 'expr18',
selector: '[expr18]',
redundantAttribute: 'expr5',
selector: '[expr5]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.ville_etab
}]
}, {
redundantAttribute: 'expr19',
selector: '[expr19]',
redundantAttribute: 'expr6',
selector: '[expr6]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.dep
}]
}, {
redundantAttribute: 'expr20',
selector: '[expr20]',
redundantAttribute: 'expr7',
selector: '[expr7]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.moyenne
}]
}, {
redundantAttribute: 'expr21',
selector: '[expr21]',
redundantAttribute: 'expr8',
selector: '[expr8]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.taux_acces_ens
}]
}]),
redundantAttribute: 'expr16',
selector: '[expr16]',
redundantAttribute: 'expr3',
selector: '[expr3]',
itemName: 'etablissement',
indexName: null,
evaluate: _scope => _scope.state.items

View File

@ -43,10 +43,10 @@ var search = {
promise = PAPI.fetchFilieres();
break;
case 1:
promise = PAPI.fetchFiliere(this.state.filiere);
promise = PAPI.fetchFiliere(this.state.course.fili);
break;
case 2:
promise = PAPI.fetchSpecialites(this.state.specialite);
promise = PAPI.fetchSpecialites(this.state.course.sousfili);
break;
}
promise.then(response => {
@ -75,13 +75,16 @@ var search = {
});
},
cruiseForward(selection) {
if (this.state.currentStep >= 2) return;
switch (this.state.currentStep) {
case 0:
this.state.filiere = selection;
this.state.course.fili = selection;
break;
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;
}
this.state.currentStep++;
@ -99,6 +102,7 @@ var search = {
});
},
onBeforeMount(props, state) {
console.log("on m'a appelé");
//Initial state
this.state = {
placeholder: PLACEHOLDERS[0],
@ -106,18 +110,19 @@ var search = {
allItems: null,
filter: null,
items: null,
filiere: null,
specialite: null,
updating: false
course: [],
updating: false,
updateCourse: this.props.updateCourse
};
console.log(this.state.updateCourse);
},
onMounted() {
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>', [{
redundantAttribute: 'expr304',
selector: '[expr304]',
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: 'expr60',
selector: '[expr60]',
expressions: [{
type: expressionTypes.EVENT,
name: 'onkeyup',
@ -128,8 +133,8 @@ var search = {
evaluate: _scope => _scope.state.placeholder
}]
}, {
redundantAttribute: 'expr305',
selector: '[expr305]',
redundantAttribute: 'expr61',
selector: '[expr61]',
expressions: [{
type: expressionTypes.ATTRIBUTE,
name: 'disabled',
@ -143,9 +148,9 @@ var search = {
type: bindingTypes.EACH,
getKey: 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>', [{
redundantAttribute: 'expr307',
selector: '[expr307]',
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: 'expr63',
selector: '[expr63]',
expressions: [{
type: expressionTypes.ATTRIBUTE,
name: 'disabled',
@ -156,24 +161,24 @@ var search = {
evaluate: _scope => () => _scope.cruiseForward(_scope.item.name)
}]
}, {
redundantAttribute: 'expr308',
selector: '[expr308]',
redundantAttribute: 'expr64',
selector: '[expr64]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.item.name
}]
}, {
redundantAttribute: 'expr309',
selector: '[expr309]',
redundantAttribute: 'expr65',
selector: '[expr65]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.item.count
}]
}]),
redundantAttribute: 'expr306',
selector: '[expr306]',
redundantAttribute: 'expr62',
selector: '[expr62]',
itemName: 'item',
indexName: null,
evaluate: _scope => _scope.state.items