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