window.addEventListener('DOMContentLoaded', (event) => {
document.getElementsByClassName("submit_btn")[0].addEventListener('click', function(){
const inibition=document.getElementsByClassName("inibition")[0].value ;
const flexibitite=document.getElementsByClassName("flexibitite")[0].value ;
const controle_Emotionnel =document.getElementsByClassName("controle_Emotionnel")[0].value ;
const initiation =document.getElementsByClassName("initiation")[0].value ;
const memoire_de_travail=document.getElementsByClassName("memoire_de_travail")[0].value ;
const planification=document.getElementsByClassName("planification")[0].value ;
const organisation_materiel=document.getElementsByClassName("organisation_materiel")[0].value ;
const controle=document.getElementsByClassName("controle")[0].value ;
console.log("inibition=", inibition) ;
console.log("flexibitite=", flexibitite) ;
console.log("controle_Emotionnel=", controle_Emotionnel) ;
console.log("initiation =", initiation ) ;
console.log("memoire_de_travail=", memoire_de_travail) ;
console.log("planification=", planification) ;
console.log("organisation_materiel=", organisation_materiel) ;
console.log("controle=", controle) ;
const ScoreTable= {
Inibittion: inibition,
Flexibilite: flexibitite ,
Controle_Emotionnel: controle_Emotionnel ,
Initiation: initiation ,
Memoire_de_travail : memoire_de_travail ,
Planification : planification ,
Organisation_Materiel: organisation_materiel,
Controle : controle } ;
console.log(ScoreTable) ;
function compareQuotients(a, b, c, d, e, f, g, h, i) {
const tableScore = [
{ Inibittion: a/30 },
{ Flexibilite: b/24 },
{ Controle_Emotionnel: c/30 },
{ Initiation: d/24 },
{ Memoire_de_travail : e/30 },
{ Planification : f/36 },
{ Organisation_Materiel: g/18 },
{ Controle : h/24 } ];
const n = tableScore.length;
for (let i = 0; i < n-1; i++) {
for (let j = 0; j Object.values(tableScore[j+1])[0]) {
[tableScore[j], tableScore[j+1]] = [tableScore[j+1], tableScore[j]];
}
}
}
return tableScore;
}
const resultatBrief = compareQuotients( inibition,flexibitite , controle_Emotionnel , initiation ,memoire_de_travail , planification , organisation_materiel, controle );
console.log(resultatBrief);
domaine1= (Object.keys(resultatBrief[resultatBrief.length-1]))[0] ;
domaine2= (Object.keys(resultatBrief[resultatBrief.length-2]))[0] ;
console.log(domaine1) ;
console.log(domaine2) ;
const tableLien = [
{ Inibittion: "https://auzyhelp.com/1" },
{ Flexibilite: "https://auzyhelp.com/2"},
{ Controle_Emotionnel: "https://auzyhelp.com/3" },
{ Initiation: "https://auzyhelp.com/4" },
{ Memoire_de_travail : "https://auzyhelp.com/5" },
{ Planification : "https://auzyhelp.com/6" },
{ Organisation_Materiel: "https://auzyhelp.com/7" },
{ Controle : "https://auzyhelp.com/8" } ];
let a = "'"+ domaine1+"'";
let b = "'"+ domaine2+"'";
let lien1, lien2;;
for (let i = 0; i < tableLien.length; i++) {
const obj = tableLien[i];
if (domaine1 in obj) {
lien1 = obj[domaine1];
}
if (domaine2 in obj) {
lien2= obj[domaine2];
}
}
console.log("lien1 = ", lien1);
console.log( "lien2 = ", lien2);
var link1 = "
" + domaine1 + "
";
var link2 = "
" + domaine2 + "
";
var msg= "vous avez des valeurs maximales dans les domaines suivants "+ link1+" et "+link2;
console.log(msg) ;
const url1 = document.getElementsByClassName("lien1")[0] ;
const url2 = document.getElementsByClassName("lien2")[0] ;
url1.value= lien1 ;
url2.value=lien2 ;
const d1 = document.getElementsByClassName("echelle1")[0] ;
const d2 = document.getElementsByClassName("echelle2")[0] ;
d1.value = domaine1 ;
d2.value = domaine2;
});
});