maj de la syntaxe

This commit is contained in:
2026-03-30 16:33:11 +02:00
parent b73e91ff98
commit 20bdddd729
8 changed files with 347 additions and 351 deletions
+34 -34
View File
@@ -1,60 +1,60 @@
// Échapper les apostrophes dans les valeurs injectées dans la clause where
function echapperValeur(valeur) {
return String(valeur).replace(/'/g, "\\'")
return String(valeur).replace(/'/g, "\\'");
}
// Construire l'URL de requête vers l'API Parcoursup
export function construireURL(requete, limite = 20, decalage = 0, filtres = {}) {
var url = "https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records?"
var url = "https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records?";
url += "limit=" + limite
url += "&offset=" + decalage
url += "limit=" + limite;
url += "&offset=" + decalage;
var conditions = []
var conditions = [];
if (requete && requete.trim() !== "") {
conditions.push("search(lib_for_voe_ins, '" + echapperValeur(requete.trim()) + "')")
conditions.push("search(lib_for_voe_ins, '" + echapperValeur(requete.trim()) + "')");
}
if (filtres.filiere && filtres.filiere !== "") {
conditions.push("fili='" + echapperValeur(filtres.filiere) + "'")
conditions.push("fili='" + echapperValeur(filtres.filiere) + "'");
}
if (filtres.selectivite && filtres.selectivite !== "") {
conditions.push("select_form='" + echapperValeur(filtres.selectivite) + "'")
conditions.push("select_form='" + echapperValeur(filtres.selectivite) + "'");
}
if (filtres.region && filtres.region !== "") {
conditions.push("region_etab_aff='" + echapperValeur(filtres.region) + "'")
conditions.push("region_etab_aff='" + echapperValeur(filtres.region) + "'");
}
if (filtres.tauxMin && filtres.tauxMin > 0) {
conditions.push("taux_acces_ens>=" + filtres.tauxMin)
conditions.push("taux_acces_ens>=" + filtres.tauxMin);
}
if (filtres.tauxMax && filtres.tauxMax < 100) {
conditions.push("taux_acces_ens<=" + filtres.tauxMax)
conditions.push("taux_acces_ens<=" + filtres.tauxMax);
}
if (conditions.length > 0) {
url += "&where=" + encodeURIComponent(conditions.join(" AND "))
url += "&where=" + encodeURIComponent(conditions.join(" AND "));
}
return url
return url;
}
// Charger les formations depuis l'API Parcoursup
export async function chargerFormations(requete, limite = 20, decalage = 0, filtres = {}) {
var url = construireURL(requete, limite, decalage, filtres)
var reponse = await fetch(url)
var url = construireURL(requete, limite, decalage, filtres);
var reponse = await fetch(url);
if (!reponse.ok) {
throw new Error("Erreur HTTP " + reponse.status)
throw new Error("Erreur HTTP " + reponse.status);
}
return await reponse.json()
return await reponse.json();
}
// Charger l'historique d'une formation sur plusieurs années
@@ -67,42 +67,42 @@ export async function chargerHistoriqueFormation(codUai, nomFormation) {
2023: "fr-esr-parcoursup_2023",
2024: "fr-esr-parcoursup_2024",
2025: "fr-esr-parcoursup"
}
};
var historique = []
var nomCourt = echapperValeur((nomFormation || "").substring(0, 40))
var codeUai = echapperValeur(codUai)
var annees = [2020, 2021, 2022, 2023, 2024, 2025]
var historique = [];
var nomCourt = echapperValeur((nomFormation || "").substring(0, 40));
var codeUai = echapperValeur(codUai);
var annees = [2020, 2021, 2022, 2023, 2024, 2025];
for (var i = 0; i < annees.length; i++) {
var annee = annees[i]
var dataset = jeuDeDonnees[annee]
var annee = annees[i];
var dataset = jeuDeDonnees[annee];
try {
var where =
"cod_uai='" + codeUai + "' AND search(lib_for_voe_ins, '" + nomCourt + "')"
"cod_uai='" + codeUai + "' AND search(lib_for_voe_ins, '" + nomCourt + "')";
var url = "https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/"
+ dataset + "/records?"
+ "limit=5"
+ "&where=" + encodeURIComponent(where)
+ "&select=" + encodeURIComponent("cod_uai,lib_for_voe_ins,voe_tot,acc_tot,pct_sansmention,pct_ab,pct_b,pct_tb,pct_tbf,pct_bg,pct_bt,pct_bp")
+ "&select=" + encodeURIComponent("cod_uai,lib_for_voe_ins,voe_tot,acc_tot,pct_sansmention,pct_ab,pct_b,pct_tb,pct_tbf,pct_bg,pct_bt,pct_bp");
var reponse = await fetch(url)
var reponse = await fetch(url);
if (reponse.ok) {
var donnees = await reponse.json()
var donnees = await reponse.json();
if (donnees.results && donnees.results.length > 0) {
var ligne = donnees.results[0]
var taux = 0
var ligne = donnees.results[0];
var taux = 0;
if (ligne.voe_tot && ligne.voe_tot > 0) {
taux = Math.round((ligne.acc_tot / ligne.voe_tot) * 100)
taux = Math.round((ligne.acc_tot / ligne.voe_tot) * 100);
}
historique.push({
@@ -118,14 +118,14 @@ export async function chargerHistoriqueFormation(codUai, nomFormation) {
pctGeneral: ligne.pct_bg || 0,
pctTechno: ligne.pct_bt || 0,
pctPro: ligne.pct_bp || 0
})
});
}
}
} catch (e) {
console.warn("Erreur pour l'année " + annee + " :", e)
console.warn("Erreur pour l'année " + annee + " :", e);
}
}
return historique
return historique;
}
+134 -134
View File
File diff suppressed because it is too large Load Diff
+25 -25
View File
@@ -83,17 +83,17 @@
},
ouvrirModale() {
this.update({ visible: true, erreur: null })
this.update({ visible: true, erreur: null });
},
fermerModale() {
this.update({ visible: false, erreur: null })
this.update({ visible: false, erreur: null });
},
// Fermer si l'utilisateur clique en dehors de la modale
cliquerFond(e) {
if (e.target === e.currentTarget) {
this.fermerModale()
this.fermerModale();
}
},
@@ -105,7 +105,7 @@
labelBouton: 'Se connecter',
classBtnConnexion: 'auth-tab active',
classBtnInscription: 'auth-tab'
})
});
},
afficherInscription() {
@@ -116,59 +116,59 @@
labelBouton: 'Créer le compte',
classBtnConnexion: 'auth-tab',
classBtnInscription: 'auth-tab active'
})
});
},
async validerFormulaire(e) {
e.preventDefault()
e.preventDefault();
var email = e.target.email.value.trim()
var password = e.target.password.value
var services = window.firebaseServices
var email = e.target.email.value.trim();
var password = e.target.password.value;
var services = window.firebaseServices;
this.update({ chargement: true, erreur: null })
this.update({ chargement: true, erreur: null });
try {
if (this.state.mode === 'inscription') {
await services.createAccount(email, password)
await services.createAccount(email, password);
} else {
await services.login(email, password)
await services.login(email, password);
}
this.update({ visible: false, chargement: false })
this.props.onauth && this.props.onauth()
this.update({ visible: false, chargement: false });
this.props.onauth && this.props.onauth();
} catch (err) {
var messageErreur = 'Une erreur est survenue.'
var messageErreur = 'Une erreur est survenue.';
if (err.code === 'auth/email-already-in-use') {
messageErreur = 'Cet e-mail est déjà utilisé.'
messageErreur = 'Cet e-mail est déjà utilisé.';
} else if (err.code === 'auth/invalid-email') {
messageErreur = 'Adresse e-mail invalide.'
messageErreur = 'Adresse e-mail invalide.';
} else if (err.code === 'auth/wrong-password' || err.code === 'auth/invalid-credential') {
messageErreur = 'E-mail ou mot de passe incorrect.'
messageErreur = 'E-mail ou mot de passe incorrect.';
} else if (err.code === 'auth/weak-password') {
messageErreur = 'Le mot de passe doit faire au moins 6 caractères.'
messageErreur = 'Le mot de passe doit faire au moins 6 caractères.';
} else if (err.code === 'auth/user-not-found') {
messageErreur = 'Aucun compte trouvé avec cet e-mail.'
messageErreur = 'Aucun compte trouvé avec cet e-mail.';
}
this.update({ chargement: false, erreur: messageErreur })
this.update({ chargement: false, erreur: messageErreur });
}
},
async seDeconnecter() {
try {
await window.firebaseServices.logout()
this.props.onlogout && this.props.onlogout()
await window.firebaseServices.logout();
this.props.onlogout && this.props.onlogout();
} catch (err) {
console.error('Erreur déconnexion :', err)
console.error('Erreur déconnexion :', err);
}
}
}
};
</script>
</auth-panel>
+86 -86
View File
@@ -203,57 +203,57 @@
},
onMounted() {
this.afficherGraphiques()
this.chargerHistorique()
this.afficherGraphiques();
this.chargerHistorique();
},
onUpdated() {
this.afficherGraphiques()
this.afficherGraphiques();
if (this.state.historique.length > 0) {
this.afficherGraphiquesHistoriques()
this.afficherGraphiquesHistoriques();
}
},
// Retour à la liste des résultats
retourListe() {
this.props.onback()
this.props.onback();
},
// Limiter une valeur entre 0 et 1 pour Charts.css
limiterValeur(val) {
if (val === null || val === undefined || isNaN(val)) {
return 0
return 0;
}
var v = val / 100
var v = val / 100;
if (v > 1) {
return 1
return 1;
}
if (v < 0) {
return 0
return 0;
}
return Math.round(v * 100) / 100
return Math.round(v * 100) / 100;
},
afficherGraphiques() {
var f = this.props.formation
var f = this.props.formation;
if (!f) {
return
return;
}
var graphBac = this.$('[ref="graphBac"]')
var graphMentions = this.$('[ref="graphMentions"]')
var graphProfil = this.$('[ref="graphProfil"]')
var graphBac = this.$('[ref="graphBac"]');
var graphMentions = this.$('[ref="graphMentions"]');
var graphProfil = this.$('[ref="graphProfil"]');
if (graphBac) {
graphBac.innerHTML = this.construireGraphiqueColonnes([
{ label: 'Général', valeur: f.pctGeneral, couleur: '#3d7fff' },
{ label: 'Techno', valeur: f.pctTechno, couleur: '#f59e0b' },
{ label: 'Pro', valeur: f.pctPro, couleur: '#10b981' }
])
]);
}
if (graphMentions) {
@@ -263,7 +263,7 @@
{ label: 'Bien', valeur: f.pctB, couleur: '#34d399' },
{ label: 'TB', valeur: f.pctTB, couleur: '#fbbf24' },
{ label: 'TB Féli.', valeur: f.pctTBF, couleur: '#f472b6' }
])
]);
}
if (graphProfil) {
@@ -271,158 +271,158 @@
{ label: 'Femmes', valeur: f.pctFemmes, couleur: '#a78bfa' },
{ label: 'Boursiers', valeur: f.pctBoursiers, couleur: '#fb923c' },
{ label: 'Néo-bac', valeur: f.pctNeoBac, couleur: '#2dd4bf' }
])
]);
}
},
async chargerHistorique() {
var f = this.props.formation
var f = this.props.formation;
if (!f) {
return
return;
}
var codUai = f.id.split('-')[0]
var codUai = f.id.split('-')[0];
if (!codUai || !window.chargerHistoriqueFormation) {
return
return;
}
this.update({ chargementHistorique: true })
this.update({ chargementHistorique: true });
try {
var historique = await window.chargerHistoriqueFormation(codUai, f.nom)
this.update({ historique: historique, chargementHistorique: false })
var historique = await window.chargerHistoriqueFormation(codUai, f.nom);
this.update({ historique: historique, chargementHistorique: false });
} catch (e) {
console.error('Erreur chargement historique :', e)
this.update({ historique: [], chargementHistorique: false })
console.error('Erreur chargement historique :', e);
this.update({ historique: [], chargementHistorique: false });
}
},
afficherGraphiquesHistoriques() {
var historique = this.state.historique
var historique = this.state.historique;
if (!historique || historique.length === 0) {
return
return;
}
var graphTaux = this.$('[ref="graphTaux"]')
var graphCandidats = this.$('[ref="graphCandidats"]')
var graphMentionsHist = this.$('[ref="graphMentionsHist"]')
var graphTaux = this.$('[ref="graphTaux"]');
var graphCandidats = this.$('[ref="graphCandidats"]');
var graphMentionsHist = this.$('[ref="graphMentionsHist"]');
// Graphique : taux d'accès par année
if (graphTaux) {
var elementsAnnee = []
var elementsAnnee = [];
for (var i = 0; i < historique.length; i++) {
elementsAnnee.push({
label: '' + historique[i].annee,
valeur: historique[i].tauxAcces,
couleur: '#1a936f'
})
});
}
graphTaux.innerHTML = this.construireGraphiqueColonnes(elementsAnnee)
graphTaux.innerHTML = this.construireGraphiqueColonnes(elementsAnnee);
}
// Graphique : candidats vs admis
if (graphCandidats) {
var maxCandidats = 0
var maxCandidats = 0;
for (var i = 0; i < historique.length; i++) {
if (historique[i].candidats > maxCandidats) {
maxCandidats = historique[i].candidats
maxCandidats = historique[i].candidats;
}
}
var lignes = ''
var lignes = '';
for (var i = 0; i < historique.length; i++) {
var h = historique[i]
var tailleCand = 0
var tailleAdmis = 0
var h = historique[i];
var tailleCand = 0;
var tailleAdmis = 0;
if (maxCandidats > 0) {
tailleCand = Math.round((h.candidats / maxCandidats) * 100) / 100
tailleAdmis = Math.round((h.admis / maxCandidats) * 100) / 100
tailleCand = Math.round((h.candidats / maxCandidats) * 100) / 100;
tailleAdmis = Math.round((h.admis / maxCandidats) * 100) / 100;
}
lignes += '<tr>'
lignes += '<th scope="row">' + h.annee + '</th>'
lignes += '<td style="--size: ' + tailleCand + '; --color: #2a5298;">'
lignes += '<span class="data">' + h.candidats + '</span></td>'
lignes += '<td style="--size: ' + tailleAdmis + '; --color: #1a936f;">'
lignes += '<span class="data">' + h.admis + '</span></td>'
lignes += '</tr>'
lignes += '<tr>';
lignes += '<th scope="row">' + h.annee + '</th>';
lignes += '<td style="--size: ' + tailleCand + '; --color: #2a5298;">';
lignes += '<span class="data">' + h.candidats + '</span></td>';
lignes += '<td style="--size: ' + tailleAdmis + '; --color: #1a936f;">';
lignes += '<span class="data">' + h.admis + '</span></td>';
lignes += '</tr>';
}
graphCandidats.innerHTML = '<table class="charts-css column multiple show-labels show-primary-axis show-4-secondary-axes data-spacing-10">'
+ '<thead><tr><th scope="col">Année</th><th scope="col">Candidats</th><th scope="col">Admis</th></tr></thead>'
+ '<tbody>' + lignes + '</tbody></table>'
+ '<tbody>' + lignes + '</tbody></table>';
}
// Tableau : évolution des mentions
if (graphMentionsHist) {
var tableau = '<table class="detail-table">'
tableau += '<thead><tr><th>Année</th><th>Sans mention</th><th>AB</th><th>Bien</th><th>TB</th><th>TB Féli.</th></tr></thead>'
tableau += '<tbody>'
var tableau = '<table class="detail-table">';
tableau += '<thead><tr><th>Année</th><th>Sans mention</th><th>AB</th><th>Bien</th><th>TB</th><th>TB Féli.</th></tr></thead>';
tableau += '<tbody>';
for (var i = 0; i < historique.length; i++) {
var h = historique[i]
tableau += '<tr>'
tableau += '<td><b>' + h.annee + '</b></td>'
tableau += '<td>' + h.pctSansMention + '%</td>'
tableau += '<td>' + h.pctAB + '%</td>'
tableau += '<td>' + h.pctB + '%</td>'
tableau += '<td>' + h.pctTB + '%</td>'
tableau += '<td>' + h.pctTBF + '%</td>'
tableau += '</tr>'
var h = historique[i];
tableau += '<tr>';
tableau += '<td><b>' + h.annee + '</b></td>';
tableau += '<td>' + h.pctSansMention + '%</td>';
tableau += '<td>' + h.pctAB + '%</td>';
tableau += '<td>' + h.pctB + '%</td>';
tableau += '<td>' + h.pctTB + '%</td>';
tableau += '<td>' + h.pctTBF + '%</td>';
tableau += '</tr>';
}
tableau += '</tbody></table>'
graphMentionsHist.innerHTML = tableau
tableau += '</tbody></table>';
graphMentionsHist.innerHTML = tableau;
}
},
construireGraphiqueColonnes(elements) {
var lignes = ''
var lignes = '';
for (var i = 0; i < elements.length; i++) {
var el = elements[i]
var taille = this.limiterValeur(el.valeur)
var affiche = el.valeur || 0
var el = elements[i];
var taille = this.limiterValeur(el.valeur);
var affiche = el.valeur || 0;
lignes += '<tr>'
lignes += '<th scope="row">' + el.label + '</th>'
lignes += '<td style="--size: ' + taille + '; --color: ' + el.couleur + ';">'
lignes += '<span class="data">' + affiche + '%</span>'
lignes += '</td></tr>'
lignes += '<tr>';
lignes += '<th scope="row">' + el.label + '</th>';
lignes += '<td style="--size: ' + taille + '; --color: ' + el.couleur + ';">';
lignes += '<span class="data">' + affiche + '%</span>';
lignes += '</td></tr>';
}
return '<table class="charts-css column show-labels show-primary-axis show-4-secondary-axes data-spacing-10">'
+ '<thead><tr><th scope="col">Type</th><th scope="col">%</th></tr></thead>'
+ '<tbody>' + lignes + '</tbody></table>'
+ '<tbody>' + lignes + '</tbody></table>';
},
construireGraphiqueBarres(elements) {
var lignes = ''
var lignes = '';
for (var i = 0; i < elements.length; i++) {
var el = elements[i]
var taille = this.limiterValeur(el.valeur)
var affiche = el.valeur || 0
var el = elements[i];
var taille = this.limiterValeur(el.valeur);
var affiche = el.valeur || 0;
lignes += '<tr>'
lignes += '<th scope="row">' + el.label + '</th>'
lignes += '<td style="--size: ' + taille + '; --color: ' + el.couleur + ';">'
lignes += '<span class="data">' + affiche + '%</span>'
lignes += '</td></tr>'
lignes += '<tr>';
lignes += '<th scope="row">' + el.label + '</th>';
lignes += '<td style="--size: ' + taille + '; --color: ' + el.couleur + ';">';
lignes += '<span class="data">' + affiche + '%</span>';
lignes += '</td></tr>';
}
return '<table class="charts-css bar show-labels show-primary-axis show-4-secondary-axes data-spacing-14">'
+ '<thead><tr><th scope="col">Catégorie</th><th scope="col">%</th></tr></thead>'
+ '<tbody>' + lignes + '</tbody></table>'
+ '<tbody>' + lignes + '</tbody></table>';
}
}
};
</script>
</detail-view>
+44 -44
View File
@@ -8,113 +8,113 @@
export default {
onMounted() {
var divCarte = this.$('div[ref="carte"]')
var divCarte = this.$('div[ref="carte"]');
this.carte = L.map(divCarte).setView([46.8, 2.5], 6)
this.groupeMarqueurs = L.layerGroup().addTo(this.carte)
this.marqueursIndex = {}
this.carte = L.map(divCarte).setView([46.8, 2.5], 6);
this.groupeMarqueurs = L.layerGroup().addTo(this.carte);
this.marqueursIndex = {};
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap contributors'
}).addTo(this.carte)
}).addTo(this.carte);
this.afficherMarqueurs()
this.afficherMarqueurs();
var composant = this
var composant = this;
setTimeout(function() {
if (composant.carte) {
composant.carte.invalidateSize()
composant.carte.invalidateSize();
}
}, 200)
}, 200);
setTimeout(function() {
if (composant.carte) {
composant.carte.invalidateSize()
composant.carte.invalidateSize();
}
}, 500)
}, 500);
window.mapFocus = function(id) {
composant.centrerSurFormation(id)
}
composant.centrerSurFormation(id);
};
},
onUpdated() {
this.afficherMarqueurs()
this.afficherMarqueurs();
var composant = this
var composant = this;
if (this.carte) {
setTimeout(function() {
composant.carte.invalidateSize()
}, 100)
composant.carte.invalidateSize();
}, 100);
setTimeout(function() {
composant.carte.invalidateSize()
}, 300)
composant.carte.invalidateSize();
}, 300);
}
},
onBeforeUnmount() {
if (this.carte) {
this.carte.remove()
this.carte = null
this.carte.remove();
this.carte = null;
}
window.mapFocus = null
window.mapFocus = null;
},
afficherMarqueurs() {
if (!this.carte || !this.groupeMarqueurs) {
return
return;
}
this.groupeMarqueurs.clearLayers()
this.marqueursIndex = {}
this.groupeMarqueurs.clearLayers();
this.marqueursIndex = {};
var coordonnees = []
var formations = this.props.results || []
var coordonnees = [];
var formations = this.props.results || [];
for (var i = 0; i < formations.length; i++) {
var f = formations[i]
var f = formations[i];
if (f.latitude != null && f.longitude != null) {
var marqueur = L.marker([f.latitude, f.longitude])
marqueur.bindPopup('<b>' + f.nom + '</b><br>' + f.ville)
marqueur.addTo(this.groupeMarqueurs)
var marqueur = L.marker([f.latitude, f.longitude]);
marqueur.bindPopup('<b>' + f.nom + '</b><br>' + f.ville);
marqueur.addTo(this.groupeMarqueurs);
this.marqueursIndex[f.id] = marqueur
coordonnees.push([f.latitude, f.longitude])
this.marqueursIndex[f.id] = marqueur;
coordonnees.push([f.latitude, f.longitude]);
}
}
if (coordonnees.length > 0) {
this.carte.fitBounds(coordonnees, { padding: [20, 20] })
this.carte.fitBounds(coordonnees, { padding: [20, 20] });
} else {
this.carte.setView([46.8, 2.5], 6)
this.carte.setView([46.8, 2.5], 6);
}
},
centrerSurFormation(id) {
var marqueur = this.marqueursIndex[id]
var marqueur = this.marqueursIndex[id];
if (marqueur && this.carte) {
var divCarte = this.$('div[ref="carte"]')
var divCarte = this.$('div[ref="carte"]');
if (divCarte) {
divCarte.scrollIntoView({ behavior: 'smooth', block: 'center' })
divCarte.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
var composant = this
var composant = this;
setTimeout(function() {
composant.carte.invalidateSize()
composant.carte.setView(marqueur.getLatLng(), 13, { animate: true })
marqueur.openPopup()
}, 400)
composant.carte.invalidateSize();
composant.carte.setView(marqueur.getLatLng(), 13, { animate: true });
marqueur.openPopup();
}, 400);
}
}
}
};
</script>
</map-view>
+4 -4
View File
@@ -28,22 +28,22 @@
// Déclencher l'affichage du détail d'une formation
afficherDetail(index) {
this.props.ondetail(index)
this.props.ondetail(index);
},
// Ajouter une formation à la sélection
ajouterALaSelection(index) {
this.props.onselect(index)
this.props.onselect(index);
},
// Centrer la carte sur la formation
localiserSurCarte(formation) {
if (window.mapFocus) {
window.mapFocus(formation.id)
window.mapFocus(formation.id);
}
}
}
};
</script>
</result-list>
+13 -17
View File
@@ -27,11 +27,7 @@
<option value="Licence">Licence</option>
<option value="Licence_Las">Licence - L.AS</option>
<option value="CPGE">CPGE</option>
<option value="BTS Agricole">BTS Agricole</option>
<option value="DN MADE">DN MADE</option>
<option value="DCG">DCG</option>
<option value="Ecole de Commerce">École de Commerce</option>
<option value="Ecole d'Ingénieurs">École d'Ingénieurs</option>
<option value="IFSI">IFSI</option>
<option value="PASS">PASS</option>
<option value="EFTS">EFTS</option>
@@ -100,39 +96,39 @@
},
updateQuery(e) {
this.update({ query: e.target.value })
this.update({ query: e.target.value });
},
handleKey(e) {
if (e.key === 'Enter') {
this.submitSearch()
this.submitSearch();
}
},
toggleFilters() {
var visible = !this.state.showFilters
var label = visible ? 'Masquer les filtres' : 'Filtres avancés'
this.update({ showFilters: visible, labelFiltres: label })
var visible = !this.state.showFilters;
var label = visible ? 'Masquer les filtres' : 'Filtres avancés';
this.update({ showFilters: visible, labelFiltres: label });
},
updateFiliere(e) {
this.update({ filiere: e.target.value })
this.update({ filiere: e.target.value });
},
updateSelectivite(e) {
this.update({ selectivite: e.target.value })
this.update({ selectivite: e.target.value });
},
updateRegion(e) {
this.update({ region: e.target.value })
this.update({ region: e.target.value });
},
updateTauxMin(e) {
this.update({ tauxMin: Number(e.target.value) })
this.update({ tauxMin: Number(e.target.value) });
},
updateTauxMax(e) {
this.update({ tauxMax: Number(e.target.value) })
this.update({ tauxMax: Number(e.target.value) });
},
submitSearch() {
@@ -142,10 +138,10 @@
region: this.state.region,
tauxMin: this.state.tauxMin,
tauxMax: this.state.tauxMax
}
};
this.props.onsearch(this.state.query, filters)
this.props.onsearch(this.state.query, filters);
}
}
};
</script>
</search-bar>
+7 -7
View File
@@ -1,17 +1,17 @@
// Créer un objet formation à partir des données brutes de l'API
export function creerFormation(brut) {
var taux = 0
var latitude = null
var longitude = null
var taux = 0;
var latitude = null;
var longitude = null;
if (brut.voe_tot && brut.voe_tot > 0) {
taux = Math.round((brut.acc_tot / brut.voe_tot) * 100)
taux = Math.round((brut.acc_tot / brut.voe_tot) * 100);
}
if (brut.g_olocalisation_des_formations) {
latitude = brut.g_olocalisation_des_formations.lat
longitude = brut.g_olocalisation_des_formations.lon
latitude = brut.g_olocalisation_des_formations.lat;
longitude = brut.g_olocalisation_des_formations.lon;
}
return {
@@ -93,5 +93,5 @@ export function creerFormation(brut) {
classesPCTotal: brut.nb_cla_pc,
acceptesPCTotal: brut.acc_pc
}
};
}