Bouton Vider le cache + Carte

This commit is contained in:
HORVILLE 2023-03-31 17:07:25 +02:00
parent 486d105064
commit 6fcbfb4a08
13 changed files with 1694 additions and 3686 deletions

View File

@ -23,6 +23,7 @@
</div> </div>
<script> <script>
export default { export default {
onBeforeMount(props, state) { onBeforeMount(props, state) {
state = { state = {
@ -36,22 +37,20 @@
} }
}, },
onBeforeUpdate(props, state) { updateFiliStats() {
if (!props.schoolList || !props.schoolList.length) return let list = this.props.schoolList
let list = props.schoolList
let avg = list.reduce((s, e) => s + e.fields.moyenne, 0) / list.length let avg = list.reduce((s, e) => s + e.fields.moyenne, 0) / list.length
let avgCap = list.reduce((s, e) => s + e.fields.capa_fin, 0) / list.length let avgCap = list.reduce((s, e) => s + e.fields.capa_fin, 0) / list.length
let avgSlc = list.reduce((s, e) => s + (e.fields.taux_acces_ens || 0), 0) / list.filter((e) => e.fields.taux_acces_ens).length let avgSlc = list.reduce((s, e) => s + (e.fields.taux_acces_ens || 0), 0) / list.filter((e) => e.fields.taux_acces_ens).length
state.courseNumber = list.length this.state.courseNumber = list.length
state.average = Math.round(avg * 100) / 100 this.state.average = Math.round(avg * 100) / 100
state.capacity = Math.floor(avgCap) this.state.capacity = Math.floor(avgCap)
state.selectivity = Math.floor(avgSlc) this.state.selectivity = Math.floor(avgSlc)
let pctFemmes = Math.round(list.reduce((s, e) => s + (e.fields.pct_f || 0), 0) / list.filter((e) => e.fields.pct_f).length) let pctFemmes = Math.round(list.reduce((s, e) => s + (e.fields.pct_f || 0), 0) / list.filter((e) => e.fields.pct_f).length)
state.genreStats = [ this.state.genreStats = [
{ {
name: "Hommes", name: "Hommes",
short: "H", short: "H",
@ -68,7 +67,7 @@
let pctBT = Math.round(list.reduce((s, e) => s + (e.fields.part_acces_tec || 0), 0) / list.filter((e) => e.fields.part_acces_tec).length) let pctBT = Math.round(list.reduce((s, e) => s + (e.fields.part_acces_tec || 0), 0) / list.filter((e) => e.fields.part_acces_tec).length)
let pctBP = Math.round(list.reduce((s, e) => s + (e.fields.part_acces_pro || 0), 0) / list.filter((e) => e.fields.part_acces_pro).length) let pctBP = Math.round(list.reduce((s, e) => s + (e.fields.part_acces_pro || 0), 0) / list.filter((e) => e.fields.part_acces_pro).length)
state.bacStats = [ this.state.bacStats = [
{ {
name: "Général", name: "Général",
short: "Gen.", short: "Gen.",
@ -97,7 +96,7 @@
let pctTB = Math.round(list.reduce((s, e) => s + e.fields.pct_tb, 0) / list.length) let pctTB = Math.round(list.reduce((s, e) => s + e.fields.pct_tb, 0) / list.length)
let pctTBF = Math.round(list.reduce((s, e) => s + e.fields.pct_tbf, 0) / list.length) let pctTBF = Math.round(list.reduce((s, e) => s + e.fields.pct_tbf, 0) / list.length)
state.mentionStats = [ this.state.mentionStats = [
{ {
name: "Sans Mention", name: "Sans Mention",
short: "SM", short: "SM",
@ -129,6 +128,11 @@
value: 100 - (pctSM + pctAB + pctB + pctTB + pctTBF) value: 100 - (pctSM + pctAB + pctB + pctTB + pctTBF)
} }
] ]
},
onBeforeUpdate(props, state) {
if (!props.schoolList || !props.schoolList.length) return
this.updateFiliStats()
} }
} }
</script> </script>

View File

@ -5,9 +5,10 @@
<img class="m-auto" src="./resources/logo-parcoursup.svg"/> <img class="m-auto" src="./resources/logo-parcoursup.svg"/>
</div> </div>
<search updateCourse={updateCourse}></search> <search updateCourse={updateCourse}></search>
<button class="button is-danger ml-2 is-outlined" onclick={clearCache}>Vider le cache</button>
</div> </div>
<div class="column"> <div class="column pl-0">
<fili-info schoolList={state.schoolList} course={state.course} shouldShowInfos={state.shouldShowInfos}></fili-info> <fili-info schoolList={state.schoolList} course={state.course} shouldShowInfos={state.shouldShowInfos}></fili-info>
<school popup={popup} schoolList={state.schoolList} schoolListUpdating={state.schoolListUpdating} course={state.course} shouldShowInfos={state.shouldShowInfos}></school> <school popup={popup} schoolList={state.schoolList} schoolListUpdating={state.schoolListUpdating} course={state.course} shouldShowInfos={state.shouldShowInfos}></school>
</div> </div>
@ -25,7 +26,7 @@
this.update({ this.update({
course: course, course: course,
shouldShowInfos: course != null, shouldShowInfos: course != null
}) })
}, },
@ -59,34 +60,18 @@
onMounted(props, state) { onMounted(props, state) {
this.update({ this.update({
course: null, course: null,
<<<<<<< HEAD schoolList: [],
sortBy: null, shouldShowInfos: false
schoolList: null,
sortFields: SORT_TABLE,
filteredSchoolList: null,
shouldShowInfos: false,
school: null,
popupEnabled: false
}) })
}, },
filterSearch() {
let input = this.$("input")
if (!input) return
let finalArray = [] clearCache(e) {
localStorage.clear()
e.target.textContent = "Cache vidé !"
//On évite de trier avant d'avoir plus de 1 lettres. setTimeout(() => {
if (input.value.length > 1) { e.target.textContent = "Vider le cache"
finalArray = this.state.schoolList.filter((item) => { }, 3000)
return item.name.toLowerCase().includes(input.value.toLowerCase())
})
} else {
finalArray = this.state.schoolList
}
this.update({
filteredSchoolList: finalArray
})
}, },
popup(school){ popup(school){
this.update({ this.update({
@ -100,11 +85,6 @@
popupEnabled: false popupEnabled: false
}) })
console.log("closed!") console.log("closed!")
=======
schoolList: [],
shouldShowInfos: false
})
>>>>>>> 6ed22586179f7de1d23fd1ebd68d111298170226
} }
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<school-info> <school-info>
<div if={props.popupEnabled} class="modal is-active"> <div if={props.popupEnabled} style="z-index: 10000" class="modal is-active">
<div class="modal-background"></div> <div class="modal-background"></div>
<div class="modal-content"> <div class="modal-content">
<div class="box p-2"> <div class="box p-2">

View File

@ -1,15 +1,13 @@
<school> <school>
<div if={props.shouldShowInfos} class="box p-2 m-2" disabled="true"> <div if={props.shouldShowInfos} class="box p-2 m-2" disabled="true">
<iframe if={false} width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" <div id="map" width="100%" style="border-radius: 5px"></div>
src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&amp;layer=mapnik" <div class="mt-2 mb-2 control has-icons-left is-inline-block is-pulled-right">
style="border-radius: 5px;"></iframe>
<div class="block control has-icons-left is-inline-block is-pulled-right">
<input class="input" onkeyup={filterSearch} type="search" placeholder="Établissement"> <input class="input" onkeyup={filterSearch} type="search" placeholder="Établissement">
<span class="icon is-small is-left"> <span class="icon is-small is-left">
<i class="fas fa-search"></i> <i class="fas fa-search"></i>
</span> </span>
</div> </div>
<table class="table is-fullwidth is-hoverable"> <table class="table is-fullwidth is-hoverable is-narrow">
<thead> <thead>
<tr> <tr>
<th each={sortField in sortFields}> <th each={sortField in sortFields}>
@ -37,7 +35,7 @@
const SORT_TABLE = [ const SORT_TABLE = [
{name: "Nom", id: "g_ea_lib_vx"}, {name: "Nom", id: "g_ea_lib_vx"},
{name: "Ville", id: "ville_etab"}, {name: "Ville", id: "ville_etab"},
{name: "Département", id: "dep"}, {name: "Dept.", id: "dep"},
{name: "Moyenne", id: "moyenne"}, {name: "Moyenne", id: "moyenne"},
{name: "Sélectivité", id: "taux_acces_ens"} {name: "Sélectivité", id: "taux_acces_ens"}
] ]
@ -103,6 +101,44 @@
} }
}, },
onUpdated(props, state) {
if (!state.map && props.shouldShowInfos) {
state.map = L.map("map").setView([47, 2.5], 5)
state.markers = L.markerClusterGroup()
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(state.map);
} else (state.map) {
state.markers.clearLayers()
for (let school of state.filteredSchoolList) {
let fields = school.fields
let pos = fields.g_olocalisation_des_formations
let popupHTML = document.createElement("div")
let title = document.createElement("span")
title.textContent = fields.g_ea_lib_vx
title.class = "is-primary"
let linkToForma = document.createElement("a")
linkToForma.onclick = () => props.popup(school)
linkToForma.textContent = "Voir les infos de l'établissement"
popupHTML.appendChild(title)
popupHTML.appendChild(document.createElement("br"))
popupHTML.appendChild(linkToForma)
let marker = L.marker(pos)
marker.bindPopup(popupHTML)
state.markers.addLayer(marker)
}
state.map.addLayer(state.markers)
}
},
onBeforeMount(props, state) { onBeforeMount(props, state) {
this.state = { this.state = {
sortBy: null, sortBy: null,

View File

@ -3,12 +3,19 @@
<head> <head>
<title>Parcourplus | Accueil</title> <title>Parcourplus | Accueil</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="./style/parcoursup.css">
<script src="riot.min.js"></script>
<link rel="icon" href="./favicon.ico" />
<link rel="stylesheet" href ="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="./favicon.ico" />
<link rel="stylesheet" href="./style/parcoursup.css">
<link rel="stylesheet" href ="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha512-q3eWabyZPc1XTCmF+8/LuE1ozpg5xxn7iO89yfSOd5/oKvyqLngoNGsx8jq92Y8eXJ/IRxQbEC+FGSYxtk2oiw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha512-q3eWabyZPc1XTCmF+8/LuE1ozpg5xxn7iO89yfSOd5/oKvyqLngoNGsx8jq92Y8eXJ/IRxQbEC+FGSYxtk2oiw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI="crossorigin=""/>
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css"/>
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css"/>
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>
<script src="https://unpkg.com/leaflet.markercluster@1.4.1/dist/leaflet.markercluster.js"></script>
<script src="riot.min.js"></script>
<script src="loader.js" type="module"></script> <script src="loader.js" type="module"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/riot/7.1.0/riot+compiler.min.js" integrity="sha512-sSGKGR9MvL0bUx3CScaBb56crXwspwDkL/JnB0IrLFQfw3uvSUlITQtsTtDZctshhv5wdwIt+qZeN8zThRF4Dw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/riot/7.1.0/riot+compiler.min.js" integrity="sha512-sSGKGR9MvL0bUx3CScaBb56crXwspwDkL/JnB0IrLFQfw3uvSUlITQtsTtDZctshhv5wdwIt+qZeN8zThRF4Dw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head> </head>

File diff suppressed because one or more lines are too long

View File

@ -87,9 +87,29 @@ var mainController = {
schoolList: [], schoolList: [],
shouldShowInfos: false shouldShowInfos: false
}); });
},
clearCache(e) {
localStorage.clear();
e.target.textContent = "Cache vidé !";
setTimeout(() => {
e.target.textContent = "Vider le cache";
}, 3000);
},
popup(school) {
this.update({
school: school,
popupEnabled: true
});
console.log("popup!");
},
closePopup() {
this.update({
popupEnabled: false
});
console.log("closed!");
} }
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="columns"><div class="column is-one-third"><div class="box p-3 m-2" style="display: flex"><img class="m-auto" src="./resources/logo-parcoursup.svg"/></div><search expr643="expr643"></search></div><div class="column"><fili-info expr644="expr644"></fili-info><school expr645="expr645"></school></div></div><school-info expr646="expr646"></school-info>', [{ template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="columns"><div class="column is-one-third"><div class="box p-3 m-2" style="display: flex"><img class="m-auto" src="./resources/logo-parcoursup.svg"/></div><search expr167="expr167"></search><button expr168="expr168" class="button is-danger ml-2 is-outlined">Vider le cache</button></div><div class="column pl-0"><fili-info expr169="expr169"></fili-info><school expr170="expr170"></school></div></div><school-info expr171="expr171"></school-info>', [{
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'search', evaluate: _scope => 'search',
@ -99,8 +119,16 @@ var mainController = {
name: 'updateCourse', name: 'updateCourse',
evaluate: _scope => _scope.updateCourse evaluate: _scope => _scope.updateCourse
}], }],
redundantAttribute: 'expr643', redundantAttribute: 'expr167',
selector: '[expr643]' selector: '[expr167]'
}, {
redundantAttribute: 'expr168',
selector: '[expr168]',
expressions: [{
type: expressionTypes.EVENT,
name: 'onclick',
evaluate: _scope => _scope.clearCache
}]
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
@ -119,14 +147,18 @@ var mainController = {
name: 'shouldShowInfos', name: 'shouldShowInfos',
evaluate: _scope => _scope.state.shouldShowInfos evaluate: _scope => _scope.state.shouldShowInfos
}], }],
redundantAttribute: 'expr644', redundantAttribute: 'expr169',
selector: '[expr644]' selector: '[expr169]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'school', evaluate: _scope => 'school',
slots: [], slots: [],
attributes: [{ attributes: [{
type: expressionTypes.ATTRIBUTE,
name: 'popup',
evaluate: _scope => _scope.popup
}, {
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'schoolList', name: 'schoolList',
evaluate: _scope => _scope.state.schoolList evaluate: _scope => _scope.state.schoolList
@ -143,16 +175,28 @@ var mainController = {
name: 'shouldShowInfos', name: 'shouldShowInfos',
evaluate: _scope => _scope.state.shouldShowInfos evaluate: _scope => _scope.state.shouldShowInfos
}], }],
redundantAttribute: 'expr645', redundantAttribute: 'expr170',
selector: '[expr645]' selector: '[expr170]'
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'school-info', evaluate: _scope => 'school-info',
slots: [], slots: [],
attributes: [], attributes: [{
redundantAttribute: 'expr646', type: expressionTypes.ATTRIBUTE,
selector: '[expr646]' name: 'closeWindow',
evaluate: _scope => _scope.closePopup
}, {
type: expressionTypes.ATTRIBUTE,
name: 'popupEnabled',
evaluate: _scope => _scope.state.popupEnabled
}, {
type: expressionTypes.ATTRIBUTE,
name: 'school',
evaluate: _scope => _scope.state.school
}],
redundantAttribute: 'expr171',
selector: '[expr171]'
}]), }]),
name: 'main-controller' name: 'main-controller'
}; };

View File

@ -1,36 +1,174 @@
var schoolInfo = { var schoolInfo = {
css: null, css: null,
exports: { exports: {
onMounted() { onBeforeMount(props, state) {
this.state.enabled = false; this.state = {
this.update(); bacStats: [],
genreStats: [],
mentionStats: []
};
}, },
closeWindow() { onBeforeUpdate(props, state) {
this.state.enabled = false; if (!this.props.school) return;
this.update(); let school = this.props.school.fields;
state.genreStats = [{
name: "Hommes",
short: "H",
value: 100 - school.pct_f
}, {
name: "Femmes",
short: "F",
value: school.pct_f
}];
state.bacStats = [{
name: "Général",
short: "Gen.",
value: school.part_acces_gen
}, {
name: "Technologique",
short: "Tech.",
value: school.part_acces_tec
}, {
name: "Professionnel",
short: "Pro.",
value: school.part_acces_pro
}, {
name: "Autre",
short: "Au.",
value: 100 - (school.part_acces_gen + school.part_acces_tec + school.part_acces_pro)
}];
state.mentionStats = [{
name: "Sans Mention",
short: "SM",
value: school.pct_sansmention
}, {
name: "Assez Bien",
short: "AB",
value: school.pct_ab
}, {
name: "Bien",
short: "B",
value: school.pct_b
}, {
name: "Très Bien",
short: "TB",
value: school.pct_tb
}, {
name: "Très Bien + Félicitations",
short: "TBF",
value: school.pct_tbf
}, {
name: "Non Spécifié",
short: "NS",
value: 100 - (school.pct_sansmention + school.pct_ab + school.pct_b + school.pct_tb + school.pct_tbf)
}];
} }
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr29="expr29" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background: #000000DD;"></div>', [{ template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr172="expr172" style="z-index: 10000" class="modal is-active"></div>', [{
type: bindingTypes.IF, type: bindingTypes.IF,
evaluate: _scope => _scope.state.enabled, evaluate: _scope => _scope.props.popupEnabled,
redundantAttribute: 'expr29', redundantAttribute: 'expr172',
selector: '[expr29]', selector: '[expr172]',
template: template('<div style="position: absolute; top: 10%; left: 10%; width: 80%; height: 80%; background: #FFFFFF"><button expr30="expr30" class="delete is-medium">X</button><p><h2></h2></p><line-graph expr31="expr31" style="height: 90px; margin: 10px;"></line-graph></div>', [{ template: template('<div class="modal-background"></div><div class="modal-content"><div class="box p-2"><p><h1 expr173="expr173" class="title is-4 m-2" style="color: #485FC7;"> </h1></p><p><h2></h2></p><div class="columns m-2"><div class="column"><p expr174="expr174"> </p><p expr175="expr175"> </p><p expr176="expr176"> </p><p expr177="expr177"> </p><p expr178="expr178"> </p><p expr179="expr179"> </p><p>Rang dernier admis : </p></div><div class="column is-one-fifth"><p>Vitesse de remplissage :</p></div></div><div class="m-4"><line-graph expr180="expr180" title="Répartition par genre" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr181="expr181" title="Répartition par bac" style="height: 6rem;"></line-graph></div><div class="m-4"><line-graph expr182="expr182" title="Répartition par mention au bac" style="height: 6rem;"></line-graph></div></div></div><button expr183="expr183" class="modal-close is-medium"></button>', [{
redundantAttribute: 'expr30', redundantAttribute: 'expr173',
selector: '[expr30]', selector: '[expr173]',
expressions: [{ expressions: [{
type: expressionTypes.EVENT, type: expressionTypes.TEXT,
name: 'onclick', childNodeIndex: 0,
evaluate: _scope => _scope.closeWindow evaluate: _scope => _scope.props.school.fields.g_ea_lib_vx
}]
}, {
redundantAttribute: 'expr174',
selector: '[expr174]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => ['Ville : ', _scope.props.school.fields.ville_etab].join('')
}]
}, {
redundantAttribute: 'expr175',
selector: '[expr175]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => ['Département : ', _scope.props.school.fields.dep, ' ', _scope.props.school.fields.dep_lib].join('')
}]
}, {
redundantAttribute: 'expr176',
selector: '[expr176]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => ['Académie : ', _scope.props.school.fields.acad_mies].join('')
}]
}, {
redundantAttribute: 'expr177',
selector: '[expr177]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => _scope.props.school.fields.contrat_etab
}]
}, {
redundantAttribute: 'expr178',
selector: '[expr178]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => ['Capacité : ', _scope.props.school.fields.capa_fin].join('')
}]
}, {
redundantAttribute: 'expr179',
selector: '[expr179]',
expressions: [{
type: expressionTypes.TEXT,
childNodeIndex: 0,
evaluate: _scope => ['Nombre de voeux : ', _scope.props.school.fields.voe_tot].join('')
}] }]
}, { }, {
type: bindingTypes.TAG, type: bindingTypes.TAG,
getComponent: getComponent, getComponent: getComponent,
evaluate: _scope => 'line-graph', evaluate: _scope => 'line-graph',
slots: [], slots: [],
attributes: [], attributes: [{
redundantAttribute: 'expr31', type: expressionTypes.ATTRIBUTE,
selector: '[expr31]' name: 'data',
evaluate: _scope => _scope.state.genreStats
}],
redundantAttribute: 'expr180',
selector: '[expr180]'
}, {
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'line-graph',
slots: [],
attributes: [{
type: expressionTypes.ATTRIBUTE,
name: 'data',
evaluate: _scope => _scope.state.bacStats
}],
redundantAttribute: 'expr181',
selector: '[expr181]'
}, {
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'line-graph',
slots: [],
attributes: [{
type: expressionTypes.ATTRIBUTE,
name: 'data',
evaluate: _scope => _scope.state.mentionStats
}],
redundantAttribute: 'expr182',
selector: '[expr182]'
}, {
redundantAttribute: 'expr183',
selector: '[expr183]',
expressions: [{
type: expressionTypes.EVENT,
name: 'onclick',
evaluate: _scope => _scope.props.closeWindow
}]
}]) }])
}]), }]),
name: 'school-info' name: 'school-info'

View File

@ -5,7 +5,7 @@ const SORT_TABLE = [{
name: "Ville", name: "Ville",
id: "ville_etab" id: "ville_etab"
}, { }, {
name: "Département", name: "Dept.",
id: "dep" id: "dep"
}, { }, {
name: "Moyenne", name: "Moyenne",
@ -69,6 +69,38 @@ var school = {
state.filteredSchoolList = [...state.schoolList]; state.filteredSchoolList = [...state.schoolList];
if (this.$("input")) this.$("input").value = ""; if (this.$("input")) this.$("input").value = "";
} }
if (state.map) {
state.markers.clearLayers();
for (let school of state.filteredSchoolList) {
let fields = school.fields;
let pos = fields.g_olocalisation_des_formations;
let popupHTML = document.createElement("div");
let title = document.createElement("span");
title.textContent = fields.g_ea_lib_vx;
title.class = "is-primary";
console.log(props);
let linkToForma = document.createElement("a");
linkToForma.onclick = () => props.popup(school);
linkToForma.textContent = "Voir les infos de l'établissement";
popupHTML.appendChild(title);
popupHTML.appendChild(document.createElement("br"));
popupHTML.appendChild(linkToForma);
let marker = L.marker(pos);
marker.bindPopup(popupHTML);
state.markers.addLayer(marker);
}
state.map.addLayer(state.markers);
}
},
onUpdated(props, state) {
if (!state.map && props.shouldShowInfos) {
state.map = L.map("map").setView([47, 2.5], 5);
state.markers = L.markerClusterGroup();
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(state.map);
}
}, },
onBeforeMount(props, state) { onBeforeMount(props, state) {
this.state = { this.state = {
@ -79,20 +111,14 @@ var school = {
}, },
sortFields: SORT_TABLE sortFields: SORT_TABLE
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr680="expr680" class="box p-2 m-2" disabled></div>', [{ template: (template, expressionTypes, bindingTypes, getComponent) => template('<div expr157="expr157" class="box p-2 m-2" disabled></div>', [{
type: bindingTypes.IF, type: bindingTypes.IF,
evaluate: _scope => _scope.props.shouldShowInfos, evaluate: _scope => _scope.props.shouldShowInfos,
redundantAttribute: 'expr680', redundantAttribute: 'expr157',
selector: '[expr680]', selector: '[expr157]',
template: template('<iframe expr681="expr681" 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><div class="block control has-icons-left is-inline-block is-pulled-right"><input expr682="expr682" 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 expr683="expr683"></th></tr></thead><tbody><tr expr685="expr685"></tr></tbody></table>', [{ template: template('<div id="map" width="100%" style="border-radius: 5px"></div><div class="mt-2 mb-2 control has-icons-left is-inline-block is-pulled-right"><input expr158="expr158" 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 is-narrow"><thead><tr><th expr159="expr159"></th></tr></thead><tbody><tr expr161="expr161"></tr></tbody></table>', [{
type: bindingTypes.IF, redundantAttribute: 'expr158',
evaluate: _scope => false, selector: '[expr158]',
redundantAttribute: 'expr681',
selector: '[expr681]',
template: template(null, [])
}, {
redundantAttribute: 'expr682',
selector: '[expr682]',
expressions: [{ expressions: [{
type: expressionTypes.EVENT, type: expressionTypes.EVENT,
name: 'onkeyup', name: 'onkeyup',
@ -102,15 +128,15 @@ var school = {
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: null,
template: template(' <a expr684="expr684"><span class="icon"><i class="fas fa-sort"></i></span></a>', [{ template: template(' <a expr160="expr160"><span class="icon"><i class="fas fa-sort"></i></span></a>', [{
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => [_scope.sortField.name].join('') evaluate: _scope => [_scope.sortField.name].join('')
}] }]
}, { }, {
redundantAttribute: 'expr684', redundantAttribute: 'expr160',
selector: '[expr684]', selector: '[expr160]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'id', name: 'id',
@ -121,8 +147,8 @@ var school = {
evaluate: _scope => () => _scope.sortList(_scope.sortField.id, true) evaluate: _scope => () => _scope.sortList(_scope.sortField.id, true)
}] }]
}]), }]),
redundantAttribute: 'expr683', redundantAttribute: 'expr159',
selector: '[expr683]', selector: '[expr159]',
itemName: 'sortField', itemName: 'sortField',
indexName: null, indexName: null,
evaluate: _scope => _scope.sortFields evaluate: _scope => _scope.sortFields
@ -130,9 +156,9 @@ var school = {
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: null,
template: template('<td><a expr686="expr686"> </a></td><td expr687="expr687"> </td><td expr688="expr688"> </td><td expr689="expr689"> </td><td><title-progress expr690="expr690" max="100" style="margin: auto"></title-progress></td>', [{ template: template('<td><a expr162="expr162"> </a></td><td expr163="expr163"> </td><td expr164="expr164"> </td><td expr165="expr165"> </td><td><title-progress expr166="expr166" max="100" style="margin: auto"></title-progress></td>', [{
redundantAttribute: 'expr686', redundantAttribute: 'expr162',
selector: '[expr686]', selector: '[expr162]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
@ -143,24 +169,24 @@ var school = {
evaluate: _scope => () => _scope.props.popup(_scope.school) evaluate: _scope => () => _scope.props.popup(_scope.school)
}] }]
}, { }, {
redundantAttribute: 'expr687', redundantAttribute: 'expr163',
selector: '[expr687]', selector: '[expr163]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.school.fields.ville_etab evaluate: _scope => _scope.school.fields.ville_etab
}] }]
}, { }, {
redundantAttribute: 'expr688', redundantAttribute: 'expr164',
selector: '[expr688]', selector: '[expr164]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.school.fields.dep evaluate: _scope => _scope.school.fields.dep
}] }]
}, { }, {
redundantAttribute: 'expr689', redundantAttribute: 'expr165',
selector: '[expr689]', selector: '[expr165]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
@ -176,11 +202,11 @@ var school = {
name: 'value', name: 'value',
evaluate: _scope => _scope.school.fields.taux_acces_ens evaluate: _scope => _scope.school.fields.taux_acces_ens
}], }],
redundantAttribute: 'expr690', redundantAttribute: 'expr166',
selector: '[expr690]' selector: '[expr166]'
}]), }]),
redundantAttribute: 'expr685', redundantAttribute: 'expr161',
selector: '[expr685]', selector: '[expr161]',
itemName: 'school', itemName: 'school',
indexName: null, indexName: null,
evaluate: _scope => _scope.state.filteredSchoolList evaluate: _scope => _scope.state.filteredSchoolList

View File

@ -150,9 +150,9 @@ var search = {
this.updateList(); this.updateList();
} }
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div class="box p-1 m-2"><div class="columns m-1"><input expr31="expr31" class="input" type="input"/><button expr32="expr32" class="button ml-1">&lt;</button></div><div id="list-formations"><ul><li expr33="expr33" 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 expr28="expr28" class="input" type="input"/><button expr29="expr29" class="button ml-1">&lt;</button></div><div id="list-formations"><ul><li expr30="expr30" class="m-1"></li></ul></div></div>', [{
redundantAttribute: 'expr31', redundantAttribute: 'expr28',
selector: '[expr31]', selector: '[expr28]',
expressions: [{ expressions: [{
type: expressionTypes.EVENT, type: expressionTypes.EVENT,
name: 'onkeyup', name: 'onkeyup',
@ -163,8 +163,8 @@ var search = {
evaluate: _scope => _scope.state.placeholder evaluate: _scope => _scope.state.placeholder
}] }]
}, { }, {
redundantAttribute: 'expr32', redundantAttribute: 'expr29',
selector: '[expr32]', selector: '[expr29]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'disabled', name: 'disabled',
@ -178,9 +178,9 @@ var search = {
type: bindingTypes.EACH, type: bindingTypes.EACH,
getKey: null, getKey: null,
condition: null, condition: null,
template: template('<button expr34="expr34" class="button is-fullwidth p-2" style="white-space: unset"><div style="display: flex; width: 100%"><span class="mt-auto mb-auto" style="font-size: 0.75em; text-align: left; "><strong expr35="expr35"> </strong></span><div style="margin-left: auto;"></div><span expr36="expr36" class="tag is-primary mt-auto mb-auto"> </span></div></button>', [{ template: template('<button expr31="expr31" class="button is-fullwidth p-2" style="white-space: unset"><div style="display: flex; width: 100%"><span class="mt-auto mb-auto" style="font-size: 0.75em; text-align: left; "><strong expr32="expr32"> </strong></span><div style="margin-left: auto;"></div><span expr33="expr33" class="tag is-primary mt-auto mb-auto"> </span></div></button>', [{
redundantAttribute: 'expr34', redundantAttribute: 'expr31',
selector: '[expr34]', selector: '[expr31]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'disabled', name: 'disabled',
@ -191,24 +191,24 @@ var search = {
evaluate: _scope => () => _scope.cruiseForward(_scope.item.name) evaluate: _scope => () => _scope.cruiseForward(_scope.item.name)
}] }]
}, { }, {
redundantAttribute: 'expr35', redundantAttribute: 'expr32',
selector: '[expr35]', selector: '[expr32]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.item.name evaluate: _scope => _scope.item.name
}] }]
}, { }, {
redundantAttribute: 'expr36', redundantAttribute: 'expr33',
selector: '[expr36]', selector: '[expr33]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.item.count evaluate: _scope => _scope.item.count
}] }]
}]), }]),
redundantAttribute: 'expr33', redundantAttribute: 'expr30',
selector: '[expr33]', selector: '[expr30]',
itemName: 'item', itemName: 'item',
indexName: null, indexName: null,
evaluate: _scope => _scope.state.items evaluate: _scope => _scope.state.items

View File

@ -25,11 +25,11 @@ var titleProgress = {
state.class = this.computeClasses(); state.class = this.computeClasses();
} }
}, },
template: (template, expressionTypes, bindingTypes, getComponent) => template('<div style="display: flex;"><span expr664="expr664"></span><span expr665="expr665" class="ml-1"> </span><progress expr666="expr666" style="box-shadow: 0 0.5em 1em -0.125em rgb(10 10 10 / 10%), 0 0 0 1px rgb(10 10 10 / 2%);"></progress></div>', [{ template: (template, expressionTypes, bindingTypes, getComponent) => template('<div style="display: flex;"><span expr44="expr44"></span><span expr45="expr45" class="ml-1"> </span><progress expr46="expr46" style="box-shadow: 0 0.5em 1em -0.125em rgb(10 10 10 / 10%), 0 0 0 1px rgb(10 10 10 / 2%);"></progress></div>', [{
type: bindingTypes.IF, type: bindingTypes.IF,
evaluate: _scope => _scope.props.title, evaluate: _scope => _scope.props.title,
redundantAttribute: 'expr664', redundantAttribute: 'expr44',
selector: '[expr664]', selector: '[expr44]',
template: template(' ', [{ template: template(' ', [{
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
@ -38,16 +38,16 @@ var titleProgress = {
}] }]
}]) }])
}, { }, {
redundantAttribute: 'expr665', redundantAttribute: 'expr45',
selector: '[expr665]', selector: '[expr45]',
expressions: [{ expressions: [{
type: expressionTypes.TEXT, type: expressionTypes.TEXT,
childNodeIndex: 0, childNodeIndex: 0,
evaluate: _scope => _scope.calcPct() evaluate: _scope => _scope.calcPct()
}] }]
}, { }, {
redundantAttribute: 'expr666', redundantAttribute: 'expr46',
selector: '[expr666]', selector: '[expr46]',
expressions: [{ expressions: [{
type: expressionTypes.ATTRIBUTE, type: expressionTypes.ATTRIBUTE,
name: 'value', name: 'value',

View File

@ -3,3 +3,9 @@ body, html {
min-height: 100vh; min-height: 100vh;
padding-bottom: 0px; padding-bottom: 0px;
} }
#map {
height: 350px;
width: 100%;
border-radius: 5px;
}

4798
test.json

File diff suppressed because it is too large Load Diff