Bouton Vider le cache + Carte
This commit is contained in:
		| @@ -23,6 +23,7 @@ | ||||
|     </div> | ||||
|  | ||||
|     <script> | ||||
|  | ||||
|         export default { | ||||
|             onBeforeMount(props, state) { | ||||
|                 state = { | ||||
| @@ -36,22 +37,20 @@ | ||||
|                 } | ||||
|             }, | ||||
|  | ||||
|             onBeforeUpdate(props, state) { | ||||
|                 if (!props.schoolList || !props.schoolList.length) return | ||||
|  | ||||
|                 let list = props.schoolList | ||||
|             updateFiliStats() { | ||||
|                 let list = this.props.schoolList | ||||
|  | ||||
|                 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 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 | ||||
|                 state.average = Math.round(avg * 100) / 100 | ||||
|                 state.capacity = Math.floor(avgCap) | ||||
|                 state.selectivity = Math.floor(avgSlc) | ||||
|                 this.state.courseNumber = list.length | ||||
|                 this.state.average = Math.round(avg * 100) / 100 | ||||
|                 this.state.capacity = Math.floor(avgCap) | ||||
|                 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) | ||||
|                 state.genreStats = [ | ||||
|                 this.state.genreStats = [ | ||||
|                     { | ||||
|                         name: "Hommes", | ||||
|                         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 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", | ||||
|                         short: "Gen.", | ||||
| @@ -97,7 +96,7 @@ | ||||
|                 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) | ||||
|  | ||||
|                 state.mentionStats = [ | ||||
|                 this.state.mentionStats = [ | ||||
|                     { | ||||
|                         name: "Sans Mention", | ||||
|                         short: "SM", | ||||
| @@ -129,6 +128,11 @@ | ||||
|                         value: 100 - (pctSM + pctAB + pctB + pctTB + pctTBF) | ||||
|                     } | ||||
|                 ] | ||||
|             }, | ||||
|  | ||||
|             onBeforeUpdate(props, state) { | ||||
|                 if (!props.schoolList || !props.schoolList.length) return | ||||
|                 this.updateFiliStats() | ||||
|             } | ||||
|         } | ||||
|     </script> | ||||
|   | ||||
| @@ -5,9 +5,10 @@ | ||||
|                 <img class="m-auto" src="./resources/logo-parcoursup.svg"/> | ||||
|             </div> | ||||
| 			<search updateCourse={updateCourse}></search> | ||||
|             <button class="button is-danger ml-2 is-outlined" onclick={clearCache}>Vider le cache</button> | ||||
| 		</div> | ||||
|  | ||||
| 		<div class="column"> | ||||
| 		<div class="column pl-0"> | ||||
| 			<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> | ||||
| 		</div> | ||||
| @@ -25,7 +26,7 @@ | ||||
|  | ||||
|                 this.update({ | ||||
|                     course: course, | ||||
| 					shouldShowInfos: course != null, | ||||
| 					shouldShowInfos: course != null | ||||
|                 }) | ||||
|             }, | ||||
|  | ||||
| @@ -59,34 +60,18 @@ | ||||
|             onMounted(props, state) { | ||||
|                 this.update({ | ||||
|                     course: null, | ||||
| <<<<<<< HEAD | ||||
|                     sortBy: null, | ||||
|                     schoolList: null, | ||||
|                     sortFields: SORT_TABLE, | ||||
|                     filteredSchoolList: null, | ||||
| 					shouldShowInfos: false, | ||||
|                     school: null, | ||||
|                     popupEnabled: false | ||||
|                     schoolList: [], | ||||
| 					shouldShowInfos: 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. | ||||
|                 if (input.value.length > 1) {  | ||||
|                     finalArray = this.state.schoolList.filter((item) => { | ||||
|                         return item.name.toLowerCase().includes(input.value.toLowerCase()) | ||||
|                     }) | ||||
|                 } else { | ||||
|                     finalArray = this.state.schoolList | ||||
|                 } | ||||
|                  | ||||
|                 this.update({ | ||||
|                     filteredSchoolList: finalArray | ||||
|                 }) | ||||
|                 setTimeout(() => { | ||||
|                     e.target.textContent = "Vider le cache" | ||||
|                 }, 3000) | ||||
|             }, | ||||
|             popup(school){ | ||||
|                 this.update({ | ||||
| @@ -100,11 +85,6 @@ | ||||
|                     popupEnabled: false | ||||
|                 }) | ||||
|                 console.log("closed!") | ||||
| ======= | ||||
|                     schoolList: [], | ||||
| 					shouldShowInfos: false | ||||
|                 }) | ||||
| >>>>>>> 6ed22586179f7de1d23fd1ebd68d111298170226 | ||||
|             } | ||||
|         } | ||||
|     </script> | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <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-content"> | ||||
|             <div class="box p-2"> | ||||
|   | ||||
| @@ -1,15 +1,13 @@ | ||||
| <school> | ||||
|     <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"  | ||||
|         src="https://www.openstreetmap.org/export/embed.html?bbox=-14.655761718750002%2C40.56389453066509%2C13.601074218750002%2C51.754240074033525&layer=mapnik"  | ||||
|         style="border-radius: 5px;"></iframe> | ||||
|         <div class="block control has-icons-left is-inline-block is-pulled-right"> | ||||
|         <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 class="input" onkeyup={filterSearch} 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"> | ||||
| 		<table class="table is-fullwidth is-hoverable is-narrow"> | ||||
| 			<thead> | ||||
| 				<tr> | ||||
| 					<th each={sortField in sortFields}> | ||||
| @@ -37,7 +35,7 @@ | ||||
|         const SORT_TABLE = [ | ||||
|             {name: "Nom", id: "g_ea_lib_vx"}, | ||||
|             {name: "Ville", id: "ville_etab"}, | ||||
|             {name: "Département", id: "dep"}, | ||||
|             {name: "Dept.", id: "dep"}, | ||||
|             {name: "Moyenne", id: "moyenne"}, | ||||
|             {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: '© <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) { | ||||
|                 this.state = { | ||||
|                     sortBy: null, | ||||
|   | ||||
							
								
								
									
										15
									
								
								index.html
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								index.html
									
									
									
									
									
								
							| @@ -3,12 +3,19 @@ | ||||
| 	<head> | ||||
| 		<title>Parcourplus | Accueil</title> | ||||
| 		<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"> | ||||
| 		 | ||||
| 		<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://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="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> | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -87,9 +87,29 @@ var mainController = { | ||||
|         schoolList: [], | ||||
|         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, | ||||
|     getComponent: getComponent, | ||||
|     evaluate: _scope => 'search', | ||||
| @@ -99,8 +119,16 @@ var mainController = { | ||||
|       name: 'updateCourse', | ||||
|       evaluate: _scope => _scope.updateCourse | ||||
|     }], | ||||
|     redundantAttribute: 'expr643', | ||||
|     selector: '[expr643]' | ||||
|     redundantAttribute: 'expr167', | ||||
|     selector: '[expr167]' | ||||
|   }, { | ||||
|     redundantAttribute: 'expr168', | ||||
|     selector: '[expr168]', | ||||
|     expressions: [{ | ||||
|       type: expressionTypes.EVENT, | ||||
|       name: 'onclick', | ||||
|       evaluate: _scope => _scope.clearCache | ||||
|     }] | ||||
|   }, { | ||||
|     type: bindingTypes.TAG, | ||||
|     getComponent: getComponent, | ||||
| @@ -119,14 +147,18 @@ var mainController = { | ||||
|       name: 'shouldShowInfos', | ||||
|       evaluate: _scope => _scope.state.shouldShowInfos | ||||
|     }], | ||||
|     redundantAttribute: 'expr644', | ||||
|     selector: '[expr644]' | ||||
|     redundantAttribute: 'expr169', | ||||
|     selector: '[expr169]' | ||||
|   }, { | ||||
|     type: bindingTypes.TAG, | ||||
|     getComponent: getComponent, | ||||
|     evaluate: _scope => 'school', | ||||
|     slots: [], | ||||
|     attributes: [{ | ||||
|       type: expressionTypes.ATTRIBUTE, | ||||
|       name: 'popup', | ||||
|       evaluate: _scope => _scope.popup | ||||
|     }, { | ||||
|       type: expressionTypes.ATTRIBUTE, | ||||
|       name: 'schoolList', | ||||
|       evaluate: _scope => _scope.state.schoolList | ||||
| @@ -143,16 +175,28 @@ var mainController = { | ||||
|       name: 'shouldShowInfos', | ||||
|       evaluate: _scope => _scope.state.shouldShowInfos | ||||
|     }], | ||||
|     redundantAttribute: 'expr645', | ||||
|     selector: '[expr645]' | ||||
|     redundantAttribute: 'expr170', | ||||
|     selector: '[expr170]' | ||||
|   }, { | ||||
|     type: bindingTypes.TAG, | ||||
|     getComponent: getComponent, | ||||
|     evaluate: _scope => 'school-info', | ||||
|     slots: [], | ||||
|     attributes: [], | ||||
|     redundantAttribute: 'expr646', | ||||
|     selector: '[expr646]' | ||||
|     attributes: [{ | ||||
|       type: expressionTypes.ATTRIBUTE, | ||||
|       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' | ||||
| }; | ||||
|   | ||||
| @@ -1,36 +1,174 @@ | ||||
| var schoolInfo = { | ||||
|   css: null, | ||||
|   exports: { | ||||
|     onMounted() { | ||||
|       this.state.enabled = false; | ||||
|       this.update(); | ||||
|     onBeforeMount(props, state) { | ||||
|       this.state = { | ||||
|         bacStats: [], | ||||
|         genreStats: [], | ||||
|         mentionStats: [] | ||||
|       }; | ||||
|     }, | ||||
|     closeWindow() { | ||||
|       this.state.enabled = false; | ||||
|       this.update(); | ||||
|     onBeforeUpdate(props, state) { | ||||
|       if (!this.props.school) return; | ||||
|       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, | ||||
|     evaluate: _scope => _scope.state.enabled, | ||||
|     redundantAttribute: 'expr29', | ||||
|     selector: '[expr29]', | ||||
|     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>', [{ | ||||
|       redundantAttribute: 'expr30', | ||||
|       selector: '[expr30]', | ||||
|     evaluate: _scope => _scope.props.popupEnabled, | ||||
|     redundantAttribute: 'expr172', | ||||
|     selector: '[expr172]', | ||||
|     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: 'expr173', | ||||
|       selector: '[expr173]', | ||||
|       expressions: [{ | ||||
|         type: expressionTypes.EVENT, | ||||
|         name: 'onclick', | ||||
|         evaluate: _scope => _scope.closeWindow | ||||
|         type: expressionTypes.TEXT, | ||||
|         childNodeIndex: 0, | ||||
|         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, | ||||
|       getComponent: getComponent, | ||||
|       evaluate: _scope => 'line-graph', | ||||
|       slots: [], | ||||
|       attributes: [], | ||||
|       redundantAttribute: 'expr31', | ||||
|       selector: '[expr31]' | ||||
|       attributes: [{ | ||||
|         type: expressionTypes.ATTRIBUTE, | ||||
|         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' | ||||
|   | ||||
| @@ -5,7 +5,7 @@ const SORT_TABLE = [{ | ||||
|   name: "Ville", | ||||
|   id: "ville_etab" | ||||
| }, { | ||||
|   name: "Département", | ||||
|   name: "Dept.", | ||||
|   id: "dep" | ||||
| }, { | ||||
|   name: "Moyenne", | ||||
| @@ -69,6 +69,38 @@ var school = { | ||||
|         state.filteredSchoolList = [...state.schoolList]; | ||||
|         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: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' | ||||
|         }).addTo(state.map); | ||||
|       } | ||||
|     }, | ||||
|     onBeforeMount(props, state) { | ||||
|       this.state = { | ||||
| @@ -79,20 +111,14 @@ var school = { | ||||
|     }, | ||||
|     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, | ||||
|     evaluate: _scope => _scope.props.shouldShowInfos, | ||||
|     redundantAttribute: 'expr680', | ||||
|     selector: '[expr680]', | ||||
|     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&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>', [{ | ||||
|       type: bindingTypes.IF, | ||||
|       evaluate: _scope => false, | ||||
|       redundantAttribute: 'expr681', | ||||
|       selector: '[expr681]', | ||||
|       template: template(null, []) | ||||
|     }, { | ||||
|       redundantAttribute: 'expr682', | ||||
|       selector: '[expr682]', | ||||
|     redundantAttribute: 'expr157', | ||||
|     selector: '[expr157]', | ||||
|     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>', [{ | ||||
|       redundantAttribute: 'expr158', | ||||
|       selector: '[expr158]', | ||||
|       expressions: [{ | ||||
|         type: expressionTypes.EVENT, | ||||
|         name: 'onkeyup', | ||||
| @@ -102,15 +128,15 @@ var school = { | ||||
|       type: bindingTypes.EACH, | ||||
|       getKey: 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: [{ | ||||
|           type: expressionTypes.TEXT, | ||||
|           childNodeIndex: 0, | ||||
|           evaluate: _scope => [_scope.sortField.name].join('') | ||||
|         }] | ||||
|       }, { | ||||
|         redundantAttribute: 'expr684', | ||||
|         selector: '[expr684]', | ||||
|         redundantAttribute: 'expr160', | ||||
|         selector: '[expr160]', | ||||
|         expressions: [{ | ||||
|           type: expressionTypes.ATTRIBUTE, | ||||
|           name: 'id', | ||||
| @@ -121,8 +147,8 @@ var school = { | ||||
|           evaluate: _scope => () => _scope.sortList(_scope.sortField.id, true) | ||||
|         }] | ||||
|       }]), | ||||
|       redundantAttribute: 'expr683', | ||||
|       selector: '[expr683]', | ||||
|       redundantAttribute: 'expr159', | ||||
|       selector: '[expr159]', | ||||
|       itemName: 'sortField', | ||||
|       indexName: null, | ||||
|       evaluate: _scope => _scope.sortFields | ||||
| @@ -130,9 +156,9 @@ var school = { | ||||
|       type: bindingTypes.EACH, | ||||
|       getKey: 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>', [{ | ||||
|         redundantAttribute: 'expr686', | ||||
|         selector: '[expr686]', | ||||
|       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: 'expr162', | ||||
|         selector: '[expr162]', | ||||
|         expressions: [{ | ||||
|           type: expressionTypes.TEXT, | ||||
|           childNodeIndex: 0, | ||||
| @@ -143,24 +169,24 @@ var school = { | ||||
|           evaluate: _scope => () => _scope.props.popup(_scope.school) | ||||
|         }] | ||||
|       }, { | ||||
|         redundantAttribute: 'expr687', | ||||
|         selector: '[expr687]', | ||||
|         redundantAttribute: 'expr163', | ||||
|         selector: '[expr163]', | ||||
|         expressions: [{ | ||||
|           type: expressionTypes.TEXT, | ||||
|           childNodeIndex: 0, | ||||
|           evaluate: _scope => _scope.school.fields.ville_etab | ||||
|         }] | ||||
|       }, { | ||||
|         redundantAttribute: 'expr688', | ||||
|         selector: '[expr688]', | ||||
|         redundantAttribute: 'expr164', | ||||
|         selector: '[expr164]', | ||||
|         expressions: [{ | ||||
|           type: expressionTypes.TEXT, | ||||
|           childNodeIndex: 0, | ||||
|           evaluate: _scope => _scope.school.fields.dep | ||||
|         }] | ||||
|       }, { | ||||
|         redundantAttribute: 'expr689', | ||||
|         selector: '[expr689]', | ||||
|         redundantAttribute: 'expr165', | ||||
|         selector: '[expr165]', | ||||
|         expressions: [{ | ||||
|           type: expressionTypes.TEXT, | ||||
|           childNodeIndex: 0, | ||||
| @@ -176,11 +202,11 @@ var school = { | ||||
|           name: 'value', | ||||
|           evaluate: _scope => _scope.school.fields.taux_acces_ens | ||||
|         }], | ||||
|         redundantAttribute: 'expr690', | ||||
|         selector: '[expr690]' | ||||
|         redundantAttribute: 'expr166', | ||||
|         selector: '[expr166]' | ||||
|       }]), | ||||
|       redundantAttribute: 'expr685', | ||||
|       selector: '[expr685]', | ||||
|       redundantAttribute: 'expr161', | ||||
|       selector: '[expr161]', | ||||
|       itemName: 'school', | ||||
|       indexName: null, | ||||
|       evaluate: _scope => _scope.state.filteredSchoolList | ||||
|   | ||||
| @@ -150,9 +150,9 @@ var search = { | ||||
|       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"><</button></div><div id="list-formations"><ul><li expr33="expr33" class="m-1"></li></ul></div></div>', [{ | ||||
|     redundantAttribute: 'expr31', | ||||
|     selector: '[expr31]', | ||||
|   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"><</button></div><div id="list-formations"><ul><li expr30="expr30" class="m-1"></li></ul></div></div>', [{ | ||||
|     redundantAttribute: 'expr28', | ||||
|     selector: '[expr28]', | ||||
|     expressions: [{ | ||||
|       type: expressionTypes.EVENT, | ||||
|       name: 'onkeyup', | ||||
| @@ -163,8 +163,8 @@ var search = { | ||||
|       evaluate: _scope => _scope.state.placeholder | ||||
|     }] | ||||
|   }, { | ||||
|     redundantAttribute: 'expr32', | ||||
|     selector: '[expr32]', | ||||
|     redundantAttribute: 'expr29', | ||||
|     selector: '[expr29]', | ||||
|     expressions: [{ | ||||
|       type: expressionTypes.ATTRIBUTE, | ||||
|       name: 'disabled', | ||||
| @@ -178,9 +178,9 @@ var search = { | ||||
|     type: bindingTypes.EACH, | ||||
|     getKey: 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>', [{ | ||||
|       redundantAttribute: 'expr34', | ||||
|       selector: '[expr34]', | ||||
|     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: 'expr31', | ||||
|       selector: '[expr31]', | ||||
|       expressions: [{ | ||||
|         type: expressionTypes.ATTRIBUTE, | ||||
|         name: 'disabled', | ||||
| @@ -191,24 +191,24 @@ var search = { | ||||
|         evaluate: _scope => () => _scope.cruiseForward(_scope.item.name) | ||||
|       }] | ||||
|     }, { | ||||
|       redundantAttribute: 'expr35', | ||||
|       selector: '[expr35]', | ||||
|       redundantAttribute: 'expr32', | ||||
|       selector: '[expr32]', | ||||
|       expressions: [{ | ||||
|         type: expressionTypes.TEXT, | ||||
|         childNodeIndex: 0, | ||||
|         evaluate: _scope => _scope.item.name | ||||
|       }] | ||||
|     }, { | ||||
|       redundantAttribute: 'expr36', | ||||
|       selector: '[expr36]', | ||||
|       redundantAttribute: 'expr33', | ||||
|       selector: '[expr33]', | ||||
|       expressions: [{ | ||||
|         type: expressionTypes.TEXT, | ||||
|         childNodeIndex: 0, | ||||
|         evaluate: _scope => _scope.item.count | ||||
|       }] | ||||
|     }]), | ||||
|     redundantAttribute: 'expr33', | ||||
|     selector: '[expr33]', | ||||
|     redundantAttribute: 'expr30', | ||||
|     selector: '[expr30]', | ||||
|     itemName: 'item', | ||||
|     indexName: null, | ||||
|     evaluate: _scope => _scope.state.items | ||||
|   | ||||
| @@ -25,11 +25,11 @@ var titleProgress = { | ||||
|       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, | ||||
|     evaluate: _scope => _scope.props.title, | ||||
|     redundantAttribute: 'expr664', | ||||
|     selector: '[expr664]', | ||||
|     redundantAttribute: 'expr44', | ||||
|     selector: '[expr44]', | ||||
|     template: template(' ', [{ | ||||
|       expressions: [{ | ||||
|         type: expressionTypes.TEXT, | ||||
| @@ -38,16 +38,16 @@ var titleProgress = { | ||||
|       }] | ||||
|     }]) | ||||
|   }, { | ||||
|     redundantAttribute: 'expr665', | ||||
|     selector: '[expr665]', | ||||
|     redundantAttribute: 'expr45', | ||||
|     selector: '[expr45]', | ||||
|     expressions: [{ | ||||
|       type: expressionTypes.TEXT, | ||||
|       childNodeIndex: 0, | ||||
|       evaluate: _scope => _scope.calcPct() | ||||
|     }] | ||||
|   }, { | ||||
|     redundantAttribute: 'expr666', | ||||
|     selector: '[expr666]', | ||||
|     redundantAttribute: 'expr46', | ||||
|     selector: '[expr46]', | ||||
|     expressions: [{ | ||||
|       type: expressionTypes.ATTRIBUTE, | ||||
|       name: 'value', | ||||
|   | ||||
| @@ -2,4 +2,10 @@ body, html { | ||||
|     background-color: gainsboro; | ||||
|     min-height: 100vh; | ||||
|     padding-bottom: 0px; | ||||
| } | ||||
|  | ||||
| #map { | ||||
|     height: 350px; | ||||
|     width: 100%; | ||||
|     border-radius: 5px; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user