Liens entre les composants (WIP)
This commit is contained in:
@@ -1,24 +1,41 @@
|
||||
<fili-info>
|
||||
<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 p-1 m-2" if={props.shouldShowInfos}>
|
||||
<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%;">
|
||||
<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>Moyenne des admis<span class="is-pulled-right">{state.average}</span></p>
|
||||
<p>Nombre de formations<span class="is-pulled-right">{state.courseNumber}</span></p>
|
||||
<p>Capacité<span class="is-pulled-right">{state.capacity}</span></p>
|
||||
<p>Sélectivité</p>
|
||||
</div>
|
||||
<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 class="m-4">
|
||||
<line-graph style="height: 6rem;"></line-graph>
|
||||
<line-graph title="Répartition par bac" style="height: 6rem;"></line-graph>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onBeforeMount(props, state) {
|
||||
this.state = {
|
||||
average: 0,
|
||||
capacity: 0,
|
||||
selectivity: 0,
|
||||
courseNumber: 0
|
||||
}
|
||||
},
|
||||
|
||||
onUpdated(props, state) {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</fili-info>
|
@@ -10,6 +10,8 @@
|
||||
|
||||
updateCanvas() {
|
||||
let canvas = this.$("canvas")
|
||||
if (!canvas) return
|
||||
|
||||
canvas.width = canvas.clientWidth
|
||||
canvas.height = canvas.clientHeight
|
||||
|
||||
@@ -36,7 +38,7 @@
|
||||
|
||||
cx.fillStyle = "#707070"
|
||||
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.translate(0, 20)
|
||||
|
||||
|
@@ -8,24 +8,26 @@
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<fili-info></fili-info>
|
||||
<school></school>
|
||||
<fili-info course={state.course} shouldShowInfos={state.shouldShowInfos}></fili-info>
|
||||
<school course={state.course} shouldShowInfos={state.shouldShowInfos}></school>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<school-info></school-info>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
export default {
|
||||
onBeforeMount(props, state) {
|
||||
//Initial state
|
||||
this.state = {
|
||||
formation: null
|
||||
course: null,
|
||||
shouldShowInfos: false
|
||||
}
|
||||
},
|
||||
updateCourse(formation){
|
||||
updateCourse(course){
|
||||
this.update({
|
||||
formation: formation
|
||||
course: course,
|
||||
shouldShowInfos: course != null
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<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"
|
||||
src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&layer=mapnik"
|
||||
style="border-radius: 5px;"></iframe>
|
||||
@@ -21,7 +21,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<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.ville_etab}</td>
|
||||
<td>{etablissement.fields.dep}</td>
|
||||
@@ -35,23 +35,22 @@
|
||||
<script>
|
||||
import PAPI from '../javascript/parcoursup-link.js'
|
||||
|
||||
async function fetchEtablissement(formation) {
|
||||
return PAPI.fetchEtablissement(formation.fili, formation.sousfili, formation.soussousfili);
|
||||
async function fetchEtablissement(course) {
|
||||
return PAPI.fetchEtablissement(course.fili, course.sousfili, course.soussousfili);
|
||||
}
|
||||
|
||||
export default function search() {
|
||||
return {
|
||||
onBeforeMount(props, state) {
|
||||
this.state = {
|
||||
items: null,
|
||||
formation: this.props.formation
|
||||
state = {
|
||||
items: null
|
||||
}
|
||||
fetchEtablissement(this.state.formation).then((response) => {
|
||||
this.update({
|
||||
items: response
|
||||
})
|
||||
//console.log(this.state.items)
|
||||
this.state.items.forEach(etablissement => {
|
||||
},
|
||||
|
||||
onUpdated(props, state) {
|
||||
if (!props.shouldShowInfos) return
|
||||
fetchEtablissement(props.course).then((response) => {
|
||||
response.forEach(etablissement => {
|
||||
// calcul la moyenne
|
||||
let pct_sansmention = etablissement.fields.pct_sansmention
|
||||
let pct_AB = etablissement.fields.pct_ab
|
||||
@@ -61,12 +60,12 @@
|
||||
|
||||
// On prend la moyenne des moyennes comprises dans la mention
|
||||
// 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=moyenne
|
||||
//console.log(etablissement.fields)
|
||||
etablissement.fields.moyenne = ((pct_TBF*19)+(pct_TB*17)+(pct_B*15)+(pct_AB*13)+(pct_sansmention*11))/100
|
||||
})
|
||||
|
||||
this.update({
|
||||
items: response
|
||||
})
|
||||
this.update()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -29,10 +29,6 @@
|
||||
|
||||
updateList() {
|
||||
let promise
|
||||
|
||||
this.update({
|
||||
updating: true
|
||||
})
|
||||
|
||||
switch (this.state.currentStep) {
|
||||
case 0:
|
||||
@@ -44,8 +40,15 @@
|
||||
case 2:
|
||||
promise = PAPI.fetchSpecialites(this.state.course.sousfili)
|
||||
break
|
||||
|
||||
default:
|
||||
return
|
||||
}
|
||||
|
||||
this.update({
|
||||
updating: true
|
||||
})
|
||||
|
||||
promise.then((response) => {
|
||||
this.state.allItems = response
|
||||
this.filterSearch()
|
||||
@@ -99,13 +102,7 @@
|
||||
|
||||
case 2:
|
||||
this.state.course.soussousfili = selection
|
||||
this.state.updateCourse(this.state.course)
|
||||
break
|
||||
|
||||
case 2:
|
||||
console.log(this.props)
|
||||
console.log(this.root)
|
||||
console.log("end")
|
||||
this.props.updateCourse(this.state.course)
|
||||
return
|
||||
|
||||
default:
|
||||
@@ -132,19 +129,15 @@
|
||||
},
|
||||
|
||||
onBeforeMount(props, state) {
|
||||
console.log("on m'a appelé")
|
||||
//Initial state
|
||||
this.state = {
|
||||
placeholder: PLACEHOLDERS[0],
|
||||
currentStep: 0,
|
||||
allItems: null,
|
||||
items: null,
|
||||
course: [],
|
||||
course: {},
|
||||
updating: false,
|
||||
updateCourse: this.props.updateCourse
|
||||
}
|
||||
console.log(this.state.updateCourse)
|
||||
|
||||
},
|
||||
|
||||
onMounted(props, state) {
|
||||
|
Reference in New Issue
Block a user