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

View File

@ -35,8 +35,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() {
@ -44,11 +44,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
}
@ -90,11 +90,16 @@
cruiseForward(selection) {
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
case 2:
@ -127,16 +132,19 @@
},
onBeforeMount(props, state) {
console.log("on m'a appelé")
//Initial state
this.state = {
placeholder: PLACEHOLDERS[0],
currentStep: 0,
allItems: null,
items: null,
filiere: null,
specialite: null,
course: [],
updating: false,
updateCourse: this.props.updateCourse
}
console.log(this.state.updateCourse)
},
onMounted(props, state) {

View File

@ -1,47 +1,54 @@
var mainController = {
css: null,
exports: {
//Fonction qui va écouter ce que <search> a à dire.
searchListener(arg) {
console.log("Search il a dit: " + arg);
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 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,
getComponent: getComponent,
evaluate: _scope => 'search',
slots: [],
attributes: [{
type: expressionTypes.ATTRIBUTE,
name: 'partouse',
evaluate: _scope => _scope.searchListener
name: 'updateCourse',
evaluate: _scope => _scope.updateCourse
}],
redundantAttribute: 'expr932',
selector: '[expr932]'
redundantAttribute: 'expr984',
selector: '[expr984]'
}, {
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'fili-info',
slots: [],
attributes: [],
redundantAttribute: 'expr933',
selector: '[expr933]'
redundantAttribute: 'expr985',
selector: '[expr985]'
}, {
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'school',
slots: [],
attributes: [],
redundantAttribute: 'expr934',
selector: '[expr934]'
redundantAttribute: 'expr986',
selector: '[expr986]'
}, {
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'school-info',
slots: [],
attributes: [],
redundantAttribute: 'expr935',
selector: '[expr935]'
redundantAttribute: 'expr987',
selector: '[expr987]'
}]),
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 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,
getKey: 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>', [{
redundantAttribute: 'expr407',
selector: '[expr407]',
template: template('<td expr973="expr973"> </td><td expr974="expr974"> </td><td expr975="expr975"> </td><td expr976="expr976"> </td><td expr977="expr977"> </td>', [{
redundantAttribute: 'expr973',
selector: '[expr973]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.g_ea_lib_vx
}]
}, {
redundantAttribute: 'expr408',
selector: '[expr408]',
redundantAttribute: 'expr974',
selector: '[expr974]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.ville_etab
}]
}, {
redundantAttribute: 'expr409',
selector: '[expr409]',
redundantAttribute: 'expr975',
selector: '[expr975]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.dep
}]
}, {
redundantAttribute: 'expr410',
selector: '[expr410]',
redundantAttribute: 'expr976',
selector: '[expr976]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.moyenne
}]
}, {
redundantAttribute: 'expr411',
selector: '[expr411]',
redundantAttribute: 'expr977',
selector: '[expr977]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.etablissement.fields.taux_acces_ens
}]
}]),
redundantAttribute: 'expr406',
selector: '[expr406]',
redundantAttribute: 'expr972',
selector: '[expr972]',
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 => {
@ -87,10 +87,14 @@ var search = {
cruiseForward(selection) {
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;
case 2:
console.log(this.props);
@ -117,24 +121,26 @@ var search = {
});
},
onBeforeMount(props, state) {
console.log("on m'a appelé");
//Initial state
this.state = {
placeholder: PLACEHOLDERS[0],
currentStep: 0,
allItems: null,
items: null,
filiere: null,
specialite: null,
updating: false
course: [],
updating: false,
updateCourse: this.props.updateCourse
};
console.log(this.state.updateCourse);
},
onMounted(props, state) {
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>', [{
redundantAttribute: 'expr966',
selector: '[expr966]',
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: 'expr978',
selector: '[expr978]',
expressions: [{
type: expressionTypes.EVENT,
name: 'onkeyup',
@ -145,8 +151,8 @@ var search = {
evaluate: _scope => _scope.state.placeholder
}]
}, {
redundantAttribute: 'expr967',
selector: '[expr967]',
redundantAttribute: 'expr979',
selector: '[expr979]',
expressions: [{
type: expressionTypes.ATTRIBUTE,
name: 'disabled',
@ -160,9 +166,9 @@ var search = {
type: bindingTypes.EACH,
getKey: 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>', [{
redundantAttribute: 'expr969',
selector: '[expr969]',
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: 'expr981',
selector: '[expr981]',
expressions: [{
type: expressionTypes.ATTRIBUTE,
name: 'disabled',
@ -173,24 +179,24 @@ var search = {
evaluate: _scope => () => _scope.cruiseForward(_scope.item.name)
}]
}, {
redundantAttribute: 'expr970',
selector: '[expr970]',
redundantAttribute: 'expr982',
selector: '[expr982]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.item.name
}]
}, {
redundantAttribute: 'expr971',
selector: '[expr971]',
redundantAttribute: 'expr983',
selector: '[expr983]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.item.count
}]
}]),
redundantAttribute: 'expr968',
selector: '[expr968]',
redundantAttribute: 'expr980',
selector: '[expr980]',
itemName: 'item',
indexName: null,
evaluate: _scope => _scope.state.items