Files
MYSOPHAL/front/fiche.resultat.evaluation2222222.php
2025-08-07 13:15:31 +01:00

3025 lines
50 KiB
PHP

<?php
use Glpi\Event;
use function Docopt\dump;
include('../model_controller/fiche.resultat.evaluation.php');
include('../inc/utils.class.php');
echo '<link rel="stylesheet" type="text/css" href="../css/reports_evaluation.css" />';
echo '<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>';
echo '<script type="text/javascript" src="https://unpkg.com/xlsx@0.15.1/dist/xlsx.full.min.js"></script>';
Session::checkLoginUser();
if (Session::getCurrentInterface() == "helpdesk") {
Html::helpHeader("DRH", '', $_SESSION["glpiname"]);
} else {
Html::header("DRH", '', "", "");
}
$idUserCurrent = "";
if ($_SESSION['glpiactiveprofile']['name'] != "Super-Admin" && $_SESSION['glpiactiveprofile']['name'] != "DRH" && $_SESSION['glpiactiveprofile']['name'] != "Directeur RH" && $_SESSION['glpiactiveprofile']['name'] != "Charge Des Formations")
$idUserCurrent = $_SESSION["glpiID"];
if (isset($_GET['delete'])) {
deleteLignesFicheEvaluation($_GET['id']);
//echo "<script>history.go(-1);</script>";
}
if (isset($_GET['fiche'])) {
$ficheEvaluation = getFicheEvaluation($_GET['fiche']);
$root = $_SERVER['DOCUMENT_ROOT'] . $CFG_GLPI["root_doc"] . "/temp_sophal/";
$file_name = $root . $_SESSION["glpiID"] . ".json";
if (file_exists($file_name) == false) {
$fiche = $_GET['fiche'];
if ($_GET['fiche'] === '25')
$fiche = '24';
$resultatLignesFicheEvaluation = getResultatLignesFicheEvaluation($fiche, $idUserCurrent);
$mainblocks = [];
foreach ($resultatLignesFicheEvaluation as $lignesFicheEvaluation) {
$blocks = [];
foreach ($lignesFicheEvaluation as $row) {
if ($row['id_parent'] == 0) {
$lignesblocks = [];
foreach ($lignesFicheEvaluation as $row2) {
if ($row['id_ligne_fiche_evaluation'] == $row2['id_parent'])
$lignesblocks[] = $row2;
}
$blocks[] = [$row, $lignesblocks];
}
}
$mainblocks[] = $blocks;
}
cache_write($file_name, json_encode($mainblocks));
} else {
$mainblocks = json_decode(cache_read($file_name), true);
}
}
$results = array();
$annuel = $ficheEvaluation["annuel"];
// foreach($mainblocks[89] as $row){
// print_r($row);
// echo'<br><br>***************<br><br>';
// }
// die();
echo "<div class='center'>
<h2 class='fieldBlockHeader'> Resultats : " . str_replace('\'', '"', $ficheEvaluation["nom_fiche_evaluation"]) . "</h2>
</div><br><br>
<div class='center'> <H3 id='nbLigneResultat'>" . sizeof($mainblocks) . " Evaluation(s)</H3>
<table id='tabcenter' border='0' class='tab_cadrehov js-dynamitable'>";
// bachir...Mohammed
$isDRH = ($_SESSION['glpiactiveprofile']['name'] == "Directeur RH" || $_SESSION['glpiactiveprofile']['name'] == "DRH");
$isMGX = ($_SESSION['glpiactiveprofile']['name'] == "Directeur MGX");
function visibleMenus($rowP)
{
global $isDRH;
global $isMGX;
if ($isDRH || $isMGX)
return $rowP['ordre'] == 1 || $rowP['ordre'] == 3 || $rowP['ordre'] == 10 || $rowP['ordre'] == 11 || $rowP['ordre'] == 12 || $rowP['ordre'] == 13 || $rowP['ordre'] == 14;
return $rowP['ordre'] == 1 || $rowP['ordre'] == 3 || $rowP['ordre'] == 10 || $rowP['ordre'] == 11 || $rowP['ordre'] == 14;
}
if (isset($_GET["fiche"])) {
if ($_GET["fiche"] == 25) {
$resultatLignesFicheEvaluation = getHeaders();
$ficheEvaluation = getFicheEvaluation($_GET['fiche']);
echo '<div class="container">
<div style=" margin: auto;width: 70%;">
<canvas id="lineChart"></canvas>
</div>
<div style=" margin: auto;width: 90%;"><hr>
<button id="toggle-button" style="background-color: turquoise; border: none; border-radius: 5px; color: #333;color: white;padding: 15px 32px">AFFICHER/CACHER TOUT</button></div>
<div style=" margin: auto;width: 60%;">
<canvas id="radarChart"></canvas>
</div>
<div style=" margin: auto;width: 70%;"><hr></div><br>
<div class="card-container">
<div class="cards">
<div class="card card-3">
<div class="card__icon"><i class="fas fa-chart-area"> Compétences</i></div>
<h2 class="card__title" id="analytics-comp"></h2>
<!--<p class="card__apply">
<a class="card__link" onclick="statisticsRef()">Actualiser <i class="fas fa-sync"></i></a>
</p>--!>
</div>
<div class="card card-2">
<div class="card__icon"><i class="fas fa-chart-area"> Evaluation RH et HSE</i></div>
<h2 class="card__title" id="analytics-hr"></h2>
<!--<p class="card__apply">
<a class="card__link" onclick="statisticsRef()">Actualiser <i class="fas fa-sync"></i></a>
</p>--!>
</div>
<div class="card card-1">
<div class="card__icon"><i class="fas fa-chart-area"> Performances</i></div>
<h2 class="card__title" id="analytics-perf"></h2>
<!--<p class="card__apply">
<a class="card__link" onclick="statisticsRef()">Actualiser <i class="fas fa-sync"></i></a>
</p>--!>
</div>
</div>
</div><hr>';
echo '<div class="form-wrapper">';
foreach ($resultatLignesFicheEvaluation as $key => $value) {
if (visibleMenus($value)) {
echo '<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" onchange="menuCheck(this)" value="' . $key . '">
' . $value["question"] . '
</label>
</div>';
}
}
echo '</div>
<button onclick="ExportToExcel(\'xlsx\')">
Exporter Le Rapport</button>
</div>';
}
}
// end bachir...Mohammed
if (isset($mainblocks)) {
if (sizeof($mainblocks) > 0) {
$first_block = $mainblocks[0][0];
//$entete_first_block = $first_block[0];
//print_r($first_block);
$lignes_first_block = $first_block[1];
//print_r($lignes_first_block);
echo "<thead>
<tr class='tab_bg_2'>";
if ($annuel) {
echo "<th>Matricule</th>";
echo "<th>Employee</th>";
echo "<th>Fonction</th>";
echo "<th>Structure</th>";
echo "<th>Responsable Direct</th>";
echo "<th id='perform_head' style='display:none;' colspan='2'>Performances</th>";
echo "<th id='perform_head' style='display:none;'></th>";
echo "<th id='compe_head' style='display:none;' colspan='5'>Compétences</th>";
echo "<th id='compe_head' style='display:none;'></th>";
echo "<th id='compe_head' style='display:none;'></th>";
echo "<th id='compe_head' style='display:none;'></th>";
echo "<th id='compe_head' style='display:none;'></th>";
echo "<th id='exams_head' style='display:none;' colspan='2'>Examen du plan de Formation</th>";
echo "<th id='exams_head' style='display:none;'></th>";
echo "<th id='plan_head' style='display:none;' colspan='6'>Plan de Developpement de Carrière</th>";
echo "<th id='plan_head' style='display:none;'></th>";
echo "<th id='plan_head' style='display:none;'></th>";
echo "<th id='plan_head' style='display:none;'></th>";
echo "<th id='plan_head' style='display:none;'></th>";
echo "<th id='plan_head' style='display:none;'></th>";
echo "<th id='objectifs_head' style='display:none;'>Objectifs 2022</th>";
echo "<th>Annee</th>";
echo "<th>Status</th>";
echo "<th></th>";
} else {
foreach ($lignes_first_block as $th) {
echo "<th>" . $th['question'] . "</th>";
}
echo "<th></th>";
}
echo " </tr>";
if ($annuel) {
echo "<tr class='tab_bg_2'>";
echo "<th><input class='form-control center' type='text' name='matricule' placeholder='Matricule' onchange='matriculeChange(this)'></th>";
echo "<th><input class='form-control center' type='text' name='employee' placeholder='Employee' onchange='employeeChange(this)'></th>";
echo "<th><input class='form-control center' type='text' name='fonction' placeholder='Fonction' onchange='fonctionChange(this)'></th>";
echo "<th><input class='form-control center' type='text' name='structure' placeholder='Structure' onchange='structurechange(this)'></th>";
echo "<th><input class='form-control center' type='text' name='responsable' placeholder='Responsable Direct' onchange='responsableChange(this)'></th>";
echo "<th class='perform' style='display:none;'>Tâche</th>";
echo "<th class='perform' style='display:none;min-width:100px;'>Note</th>";
echo "<th class='compe' style='display:none;'>AUTONOMIE ET CREATIVITE</th>";
echo "<th class='compe' style='display:none;'>LA GESTION DES DIIFICULTES</th>";
echo "<th class='compe' style='display:none;'>DIMENSION RELATIONNELLE</th>";
echo "<th class='compe' style='display:none;'>LA COMPETENCE, LES CONNAISSANCES REQUISES</th>";
echo "<th class='compe' style='display:none;'>Responsabilité</th>";
echo "<th class='exams' style='display:none;'>Compétences Ciblées</th>";
echo "<th class='exams' style='display:none;'>Mesures de développement convenues</th>";
echo "<th class='plan' style='display:none;'>Compétences Ciblées</th>";
echo "<th class='plan' style='display:none;'>Planification</th>";
echo "<th class='plan' style='display:none;'>Mesures validées</th>";
echo "<th class='plan' style='display:none;'>Responsabilités</th>";
echo "<th class='plan' style='display:none;'>Evaluation RH</th>";
echo "<th class='plan' style='display:none;'>Respect des Normes HSE</th>";
echo "<th class='objectifs' style='display:none;'></th>";
echo "<th><input class='form-control center' type='text' name='annee' placeholder='Annee' onchange='anneeChange(this)'></th>";
echo "<th></th>";
echo "<th></th>";
echo "</tr>";
}
echo "</thead>
<tbody>";
foreach ($mainblocks as $mainblock) {
if ($annuel)
resultannuel($mainblock);
else
result($mainblock);
}
echo "</tbody>";
}
}
echo '
</table>
</div>';
Html::footer();
//$row_data[blocknumer][zero(blockheader question) or one(all block questions)][block questions number]
function resultannuel($row_data)
{
global $results;
$userarray = array();
$userPerformance = array();
$userExams = array();
$userPlans = array();
$userObjectifs = array();
$linges_blocks = $row_data[0][0];
$idResultatFicheEvaluation = $linges_blocks['id_resultat_fiche_evaluation'];
$user = getFUser($linges_blocks['id_candidat']);
$row_data_size = sizeof($row_data) - 1;
global $idUserCurrent;
echo "<tr style='height:50px;background-color:#e3e3e3;'>";
$allScores = array();
$score = getScore($linges_blocks['id_candidat'],$linges_blocks['reponse'])["score"];
$score = is_numeric($score) ? round($score,2)*10 : 0;
if ($row_data[1][1][0]['observation'] != "" && $linges_blocks['id_candidat'] == $idUserCurrent) {
echo "<td>" . $user['matricule'] . "</td>";
echo "<td><a>" . $user['fullname'] . "</a></td>";
echo "<td>" . $user['fonction'] . "</td>";
echo "<td>" . $user['structure'] . "</td>";
echo "<td>" . $user['superiorname'] . "</td>";
echo "<td>" . $linges_blocks['reponse'] . "</td>";
echo "<td></td>";
} else {
echo "<td onclick=\"location.href='fiche.resultat.evaluation.edit.php?idrfe=" . $idResultatFicheEvaluation . "'\"><a>" . $user['matricule'] . "</a></td>";
echo "<td onclick=\"location.href='fiche.resultat.evaluation.edit.php?idrfe=" . $idResultatFicheEvaluation . "'\"><a>" . $user['fullname'] . "</a></td>";
echo "<td onclick=\"location.href='fiche.resultat.evaluation.edit.php?idrfe=" . $idResultatFicheEvaluation . "'\">" . $user['fonction'] . "</td>";
echo "<td onclick=\"location.href='fiche.resultat.evaluation.edit.php?idrfe=" . $idResultatFicheEvaluation . "'\">" . $user['structure'] . "</td>";
echo "<td onclick=\"location.href='fiche.resultat.evaluation.edit.php?idrfe=" . $idResultatFicheEvaluation . "'\">" . $user['superiorname'] . "</td>";
echo "<td class= 'perform' style='display:none;'><div><ul>";
$i = 0;
foreach($row_data[1][1] as $data){
if($data["reponse"]!=""){
echo'<li> * '.$data["reponse"].'</li><br>';
$userPerformance["perf".$i] = array($data["reponse"],$data["observation"]);
$i++;
}
}
echo"</ul></div></td>";
$allScores[1] = $score;
echo "<td class='perform' style='display:none;'>".$score."%</td>";
$cascore = calcScore(0,0,$row_data[4][1],1);
$cascore = is_numeric($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1])) ? round($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1]),2)*10 : '';
$allScores[2] = $cascore;
echo "<td class='compe' style='display:none;'>".$cascore."%</td>";
$cascore = calcScore(0,0,$row_data[5][1],1);
$cascore = is_numeric($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1])) ? round($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1]),2)*10 : '';
$allScores[3] = $cascore;
echo "<td class='compe' style='display:none;'>".$cascore."%</td>";
$cascore = calcScore(0,0,$row_data[6][1],1);
$cascore = is_numeric($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1])) ? round($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1]),2)*10 : '';
$allScores[4] = $cascore;
echo "<td class='compe' style='display:none;'>".$cascore."%</td>";
$cascore = calcScore(0,0,$row_data[7][1],1);
$cascore = is_numeric($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1])) ? round($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1]),2)*10 : '';
$allScores[5] = $cascore;
echo "<td class='compe' style='display:none;'>".$cascore."%</td>";
$cascore = calcScore(0,0,$row_data[8][1],1);
$cascore = is_numeric($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1])) ? round($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1]),2)*10 : '';
$allScores[6] = $cascore;
echo "<td class='compe' style='display:none;'>".$cascore."%</td>";
echo "<td class='exams' style='display:none;'><div><ul>";
$i = 0;
foreach($row_data[9][1] as $data){
if($data["reponse"]!="" && $data["reponse"]!="[,]"){
$rep = explode(",",trim(trim($data["reponse"],'['),']'));
echo'<li> * '.$rep[0].'</li><br>';
$userExams["exam".$i] = array($rep[0],$rep[1]);
$i++;
}
}
echo"</ul></div></td>";
echo "<td class='exams' style='display:none;'><div><ul>";
foreach($row_data[9][1] as $data){
if($data["reponse"]!="" && $data["reponse"]!="[,]"){
$rep = explode(",",trim(trim($data["reponse"],'['),']'));
echo'<li> * '.$rep[1].'</li><br>';
}
}
echo"</ul></div></td>";
echo "<td class='plan' style='display:none;'><div><ul>";
$i = 0;
foreach($row_data[10][1] as $data){
if($data["reponse"]!="" && $data["reponse"]!="[,,,]"){
$rep = explode(",",trim(trim($data["reponse"],'['),']'));
echo'<li> * '.$rep[0].'</li><br>';
$userPlans["plan".$i] = array($rep[0],$rep[1],$rep[2],$rep[3]);
$i++;
}
}
echo"</ul></div></td>";
echo "<td class='plan' style='display:none;'><div><ul>";
foreach($row_data[10][1] as $data){
if($data["reponse"]!="" && $data["reponse"]!="[,,,]"){
$rep = explode(",",trim(trim($data["reponse"],'['),']'));
echo'<li> * '.$rep[1].'</li><br>';
}
}
echo"</ul></div></td>";
echo "<td class='plan' style='display:none;'><div><ul>";
foreach($row_data[10][1] as $data){
if($data["reponse"]!="" && $data["reponse"]!="[,,,]"){
$rep = explode(",",trim(trim($data["reponse"],'['),']'));
echo'<li> * '.$rep[2].'</li><br>';
}
}
echo"</ul></div></td>";
echo "<td class='plan' style='display:none;'><div><ul>";
foreach($row_data[10][1] as $data){
if($data["reponse"]!="" && $data["reponse"]!="[,,,]"){
$rep = explode(",",trim(trim($data["reponse"],'['),']'));
echo'<li> * '.$rep[3].'</li><br>';
}
}
echo"</ul></div></td>";
$cascore = calcScore(0,0,$row_data[11][1],2);
$cascore = is_numeric($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1])) ? round($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1]),2) : '';
$allScores[7] = $cascore;
echo "<td class='plan' style='display:none;'>".$cascore."</td>";
$cascore = calcScore(0,0,$row_data[12][1],3);
$cascore = is_numeric($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1])) ? round($cascore[0]/($cascore[1]==0 ? 1 : $cascore[1]),2) : '';
$allScores[8] = $cascore;
echo "<td class='plan' style='display:none;'>".$cascore."</td>";
echo "<td class='objectifs' style='display:none;'><div><ul>";
$i = 0;
foreach($row_data[13][1] as $data){
if($data["reponse"]!=""){
echo'<li> * '.$data["reponse"].'</li><br>';
$userObjectifs["objec".$i] = array($data["reponse"]);
$i++;
}
}
echo"</ul></div></td>";
echo "<td onclick=\"location.href='fiche.resultat.evaluation.edit.php?idrfe=" . $idResultatFicheEvaluation . "'\">" . $linges_blocks['reponse'] . "</td>";
echo "<td></td>";
}
$userarray[] = $user['fullname'];
$userarray[] = $user['fonction'];
$userarray[] = str_replace('ô', 'o', str_replace('é', 'e', $user['structure']));
$userarray[] = $linges_blocks['reponse'];
$statusString = "<td>Employé</td>";
if ($row_data[1][1][0]['observation'] != "")
$statusString = "<td>Superviseur</td>";
if ($row_data[5][1][0]['reponse'] != "" && $row_data[5][1][0]['reponse'] != "0")
$statusString = "<td>DRH</td>";
if ($row_data[$row_data_size - 2][1][0]['reponse'] != "" && $row_data[$row_data_size - 2][1][0]['reponse'] != "0")
$statusString = "<td>HSE</td>";
if ($row_data[$row_data_size][1][0]['reponse'] != "" && $row_data[$row_data_size][1][0]['reponse'] != "0")
$statusString = "<td></td>";
//print_r($row_data[$row_data_size][1]);echo "ENDdddddddddddddddddddddddd";
$userarray[] = $statusString;
if ($_SESSION['glpiactiveprofile']['name'] == "Super-Admin")
echo "<td><form method='post' action='fiche.resultat.evaluation.php?delete=1&id=" . $idResultatFicheEvaluation . "'>" .
"<input type='hidden' id='_glpi_csrf_token' name='_glpi_csrf_token' value='" . Session::getNewCSRFToken() . "'>" .
"<input src='../pics/supprimer.png' style='background-color:#e3e3e3; width: 15px; height: 16px;' type='image' Value='submit' onclick='return(confirm(\"Etes-vous sûr de vouloir supprimer cette ligne ?\"));'/>" .
"</form> </td>";
else
echo "<td></td>";
echo "</tr>";
if ($row_data[1][1][0]['observation'] != "" && $linges_blocks['id_candidat'] == $idUserCurrent) {
} else
$userarray[] = $idResultatFicheEvaluation;
$results[] = array_merge( $userarray,$user,array("perf" => $userPerformance,"perfscore"=>$allScores,"exams"=> $userExams,"plan"=>$userPlans,"objectifs"=>$userObjectifs) ) ;
}
function result($row_data)
{
$linges_blocks1 = $row_data[0][1];
if (isset($linges_blocks1[0])) {
$idResultatFicheEvaluation = $linges_blocks1[0]['id_resultat_fiche_evaluation'];
echo "<tr style='height:50px;background-color:#e3e3e3;' onclick=\"location.href='fiche.resultat.evaluation.edit.php?idrfe=" . $idResultatFicheEvaluation . "'\">";
//echo "<td>".$idResultatFicheEvaluation."</td>";
foreach ($linges_blocks1 as $lbrow) {
echo "<td>" . $lbrow['reponse'] . "</td>";
}
/*
$linges_blocks2 = $row_data[1][1];
foreach ($linges_blocks2 as $lbrow) {
echo "<td>".$lbrow['reponse']."</td>";
}*/
echo "<td><form method='post' onclick='event.stopPropagation()' action='?delete=1&id=" . $idResultatFicheEvaluation . "'>" .
"<input src='../pics/supprimer.png' style='background-color:#e3e3e3; width: 15px; height: 16px;' type='image' Value='submit' onclick='return(confirm(\"Etes-vous sûr de vouloir supprimer cette ligne ?\"));'/>" .
"</form> </td>";
echo "</tr>";
}
}
function calcScore($score,$scoreCount,$rbreponse,$type){
switch($type){
case 1:
foreach($rbreponse as $data){
if($data["reponse"]!="" && $data["reponse"]!="0"){
$resultnote = annuelToNote($score,$scoreCount, $data["reponse"]);
$score = $resultnote[0];
$scoreCount = $resultnote[1];
}
}
break;
case 2:
$abs = is_numeric($rbreponse[1]["reponse"]) ? ($rbreponse[1]["reponse"] * 2) : 5;
$disip = is_numeric($rbreponse[2]["reponse"]) ? ($rbreponse[2]["reponse"] * 2) : 5;
$score = $abs + $disip;
$scoreCount = 4;
break;
case 3:
$score = is_numeric($rbreponse[0]["reponse"]) ? ($rbreponse[0]["reponse"] * 5) : 2;
$scoreCount = 1;
break;
}
return [$score, $scoreCount];
}
?>
<style>
.card-container {
padding: 30px;
}
/* CARDS */
.cards {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 0;
padding: 0;
box-sizing: border-box;
}
.card {
margin: 20px;
padding: 20px;
width: 500px;
min-height: 200px;
display: grid;
grid-template-rows: 20px 50px 1fr 50px;
border-radius: 10px;
box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.25);
transition: all 0.2s;
}
.card:hover {
box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.4);
transform: scale(1.01);
}
.card__link,
.card__exit,
.card__icon {
position: relative;
text-decoration: none;
color: rgba(255, 255, 255, 0.9);
}
.card__link::after {
position: absolute;
top: 25px;
left: 0;
content: "";
width: 0%;
height: 3px;
background-color: rgba(255, 255, 255, 0.6);
transition: all 0.5s;
}
.card__link:hover::after {
width: 100%;
}
.card__exit {
grid-row: 1/2;
justify-self: end;
}
.card__icon {
grid-row: 2/3;
font-size: 30px;
}
.card__title {
grid-row: 3/4;
font-weight: 400;
color: #ffffff;
}
.card__apply {
grid-row: 4/5;
align-self: center;
}
/* CARD BACKGROUNDS */
.card-1 {
background: radial-gradient(#1fe4f5, #3fbafe);
}
.card-2 {
background: radial-gradient(#fbc1cc, #fa99b2);
}
.card-3 {
background: radial-gradient(#76b2fe, #b69efe);
}
.card-4 {
background: radial-gradient(#60efbc, #58d5c9);
}
.card-5 {
background: radial-gradient(#f588d8, #c0a3e5);
}
/* RESPONSIVE */
@media (max-width: 1600px) {
.cards {
justify-content: center;
}
}
</style>
<script>
$(document).ready(function() {
$("#c_ssmenu2").html('<ul>' +
'<li class="breadcrumb_item"><a href="central.php" title="Accueil">Accueil</a></li>' +
'<li class="breadcrumb_item"><a href="" title="">Ressources Humaines</a></li>' +
'<li class="breadcrumb_item"><a href="fiche.resultat.evaluation.list.php" class="here" title="Evaluations"><i class="far fa-sticky-note"></i>&nbsp;Evaluations</a></li>' +
'</ul>');
$("tr:odd").css({
"background-color":"#f2f2f2"});
statisticsRef();
});
var Base64 = {
// private property
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
// public method for encoding
, encode: function (input)
{
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length)
{
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2))
{
enc3 = enc4 = 64;
}
else if (isNaN(chr3))
{
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
} // Whend
return output;
} // End Function encode
// public method for decoding
,decode: function (input)
{
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length)
{
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64)
{
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64)
{
output = output + String.fromCharCode(chr3);
}
} // Whend
output = Base64._utf8_decode(output);
return output;
} // End Function decode
// private method for UTF-8 encoding
,_utf8_encode: function (string)
{
var utftext = "";
string = string.replace(/\r\n/g, "\n");
for (var n = 0; n < string.length; n++)
{
var c = string.charCodeAt(n);
if (c < 128)
{
utftext += String.fromCharCode(c);
}
else if ((c > 127) && (c < 2048))
{
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else
{
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
} // Next n
return utftext;
} // End Function _utf8_encode
// private method for UTF-8 decoding
,_utf8_decode: function (utftext)
{
var string = "";
var i = 0;
var c, c1, c2, c3;
c = c1 = c2 = 0;
while (i < utftext.length)
{
c = utftext.charCodeAt(i);
if (c < 128)
{
string += String.fromCharCode(c);
i++;
}
else if ((c > 191) && (c < 224))
{
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else
{
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
} // Whend
return string;
} // End Function _utf8_decode
}
var results = <?php echo json_encode($results); ?>;
let perfChecked = false;
let compChecked = false;
let examsChecked = false;
let planChecked = false;
let objectifsChecked = false;
function employeeChange(e) {
var res = results.filter(a => a[0].toUpperCase().includes(e.value.toUpperCase()));
loadtable(res);
}
function fonctionChange(e) {
var res = results.filter(a =>a[1] != null ? a[1].toUpperCase().includes(e.value.toUpperCase()) : a);
loadtable(res);
}
function structurechange(e) {
var res = results.filter(a => a[2].toUpperCase().includes(e.value.toUpperCase()));
loadtable(res);
}
function responsableChange(e) {
var res = results.filter(a => a["superiorname"].toUpperCase().includes(e.value.toUpperCase()));
loadtable(res);
}
function matriculeChange(e) {
var res = results.filter(a => a["matricule"].toUpperCase().includes(e.value.toUpperCase()));
loadtable(res);
}
function anneeChange(e) {
var res = results.filter(a => a[3].toUpperCase().includes(e.value.toUpperCase()));
loadtable(res);
}
function loadtable(resultsp) {
$('#tabcenter tr').slice(2).remove();
if (resultsp.length > 0) {
for (var i = 0; i < resultsp.length; i++) {
var row = resultsp[i];
//console.log(row);
var fonction = row[1];
if (fonction == null)
fonction = '';
var volatileData = '';
var perfdata = '';
var examcompdata = '';
var exammesurdata = '';
var plancompdata = '';
var planplaneddata = '';
var planmesurdata = '';
var planrespondata = '';
var objecdata ='';
for(let d in row["perf"]){
perfdata = perfdata + "<div><ul><li> * " + row["perf"][d][0] + "</li><br></ul></div>";
}
for(let d in row["exams"]){
examcompdata = examcompdata + "<div><ul><li> * " + row["exams"][d][0] + "</li><br></ul></div>";
exammesurdata = exammesurdata + "<div><ul><li> * " + row["exams"][d][1] + "</li><br></ul></div>";
}
for(let d in row["plan"]){
plancompdata = plancompdata + "<div><ul><li> * " + row["plan"][d][0] + "</li><br></ul></div>";
planplaneddata = planplaneddata + "<div><ul><li> * " + row["plan"][d][1] + "</li><br></ul></div>";
planmesurdata = planmesurdata + "<div><ul><li> * " + row["plan"][d][2] + "</li><br></ul></div>";
planrespondata = planrespondata + "<div><ul><li> * " + row["plan"][d][3] + "</li><br></ul></div>";
}
for(let d in row["objectifs"]){
objecdata = objecdata + "<div><ul><li> * " + row["objectifs"][d][0] + "</li><br></ul></div>";
}
volatileData = perfChecked ? (volatileData +"<td class= 'perform'>"+perfdata+"</td>") : (volatileData +"<td class= 'perform' style='display:none;'>"+perfdata+"</td>");
volatileData = perfChecked ? (volatileData +"<td class= 'perform'>"+row["perfscore"][1]+"%</td>") : (volatileData +"<td class= 'perform' style='display:none;'>"+row["perfscore"][1]+"%</td>");
volatileData = compChecked ? (volatileData +"<td class= 'compe'>"+row["perfscore"][2]+"%</td>") : (volatileData +"<td class= 'compe' style='display:none;'>"+row["perfscore"][2]+"%</td>");
volatileData = compChecked ? (volatileData +"<td class= 'compe'>"+row["perfscore"][3]+"%</td>") : (volatileData +"<td class= 'compe' style='display:none;'>"+row["perfscore"][3]+"%</td>");
volatileData = compChecked ? (volatileData +"<td class= 'compe'>"+row["perfscore"][4]+"%</td>") : (volatileData +"<td class= 'compe' style='display:none;'>"+row["perfscore"][4]+"%</td>");
volatileData = compChecked ? (volatileData +"<td class= 'compe'>"+row["perfscore"][5]+"%</td>") : (volatileData +"<td class= 'compe' style='display:none;'>"+row["perfscore"][5]+"%</td>");
volatileData = compChecked ? (volatileData +"<td class= 'compe'>"+row["perfscore"][6]+"%</td>") : (volatileData +"<td class= 'compe' style='display:none;'>"+row["perfscore"][6]+"%</td>");
volatileData = examsChecked ? (volatileData +"<td class= 'exams'>"+examcompdata+"</td>") : (volatileData +"<td class= 'exams' style='display:none;'>"+examcompdata+"</td>");
volatileData = examsChecked ? (volatileData +"<td class= 'exams'>"+exammesurdata+"</td>") : (volatileData +"<td class= 'exams' style='display:none;'>"+exammesurdata+"</td>");
volatileData = planChecked ? (volatileData +"<td class= 'plan'>"+plancompdata+"</td>") : (volatileData +"<td class= 'plan' style='display:none;'>"+plancompdata+"</td>");
volatileData = planChecked ? (volatileData +"<td class= 'plan'>"+planplaneddata+"</td>") : (volatileData +"<td class= 'plan' style='display:none;'>"+planplaneddata+"</td>");
volatileData = planChecked ? (volatileData +"<td class= 'plan'>"+planmesurdata+"</td>") : (volatileData +"<td class= 'plan' style='display:none;'>"+planmesurdata+"</td>");
volatileData = planChecked ? (volatileData +"<td class= 'plan'>"+planrespondata+"</td>") : (volatileData +"<td class= 'plan' style='display:none;'>"+planrespondata+"</td>");
volatileData = planChecked ? (volatileData +"<td class= 'plan'>"+row["perfscore"][7]+"</td>") : (volatileData +"<td class= 'plan' style='display:none;'>"+row["perfscore"][7]+"</td>");
volatileData = planChecked ? (volatileData +"<td class= 'plan'>"+row["perfscore"][8]+"</td>") : (volatileData +"<td class= 'plan' style='display:none;'>"+row["perfscore"][8]+"</td>");
volatileData = objectifsChecked ? (volatileData +"<td class= 'objectifs'>"+objecdata+"</td>") : (volatileData +"<td class= 'objectifs' style='display:none;'>"+objecdata+"</td>");
$('#tabcenter').append(
"<tr style='height:50px;background-color:#e3e3e3;'>" +
"<td>" + row["matricule"] + "</td>" +
"<td onclick=\"location.href='fiche.resultat.evaluation.edit.php?idrfe=" + row[5] + "'\">" + row[0].trim() + "</td>" +
"<td>" + fonction + "</td>" +
"<td>" + row[2] + "</td>" +
"<td>" + row["superiorname"] + "</td>" +
volatileData +
"<td>" + row[3] + "</td>" +
"<td></td>" +
"<td></td>" +
"</tr>"
);
}
document.getElementById("nbLigneResultat").innerHTML = resultsp.length + " Evaluation(s)";
}
$("tr:odd").css({
"background-color":"#f2f2f2"});
}
function menuCheck(e){
if(e.checked){
switch(e.value){
case "0":
var all_col=document.getElementsByClassName("perform");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="table-cell";
}
document.getElementById("perform_head").style.display="table-cell";
perfChecked = true;
break;
case "2":
var all_col=document.getElementsByClassName("compe");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="table-cell";
}
document.getElementById("compe_head").style.display="table-cell";
compChecked = true;
break;
case "8":
var all_col=document.getElementsByClassName("exams");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="table-cell";
}
document.getElementById("exams_head").style.display="table-cell";
examsChecked = true;
break;
case "9":
var all_col=document.getElementsByClassName("plan");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="table-cell";
}
document.getElementById("plan_head").style.display="table-cell";
planChecked = true;
break;
case "12":
var all_col=document.getElementsByClassName("objectifs");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="table-cell";
}
document.getElementById("objectifs_head").style.display="table-cell";
objectifsChecked = true;
break;
}
}
else{
switch(e.value){
case "0":
var all_col=document.getElementsByClassName("perform");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="none";
}
document.getElementById("perform_head").style.display="none";
perfChecked = false;
break;
case "2":
var all_col=document.getElementsByClassName("compe");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="none";
}
document.getElementById("compe_head").style.display="none";
compChecked = false;
break;
case "8":
var all_col=document.getElementsByClassName("exams");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="none";
}
document.getElementById("exams_head").style.display="none";
examsChecked = false;
break;
case "9":
var all_col=document.getElementsByClassName("plan");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="none";
}
document.getElementById("plan_head").style.display="none";
planChecked = false;
break;
case "12":
var all_col=document.getElementsByClassName("objectifs");
for(var i=0;i<all_col.length;i++)
{
all_col[i].style.display="none";
}
document.getElementById("objectifs_head").style.display="none";
objectifsChecked = false;
break;
}
}
}
function ExportToExcel(type, fn, dl) {
var elt = document.getElementById('tabcenter');
var wb = XLSX.utils.table_to_book(elt, { sheet: "DATA" });
return dl ?
XLSX.write(wb, { bookType: type, bookSST: true, type: 'base64' }):
XLSX.writeFile(wb, fn || ('Repport_eval_'+Date.now()+'.' + (type || 'xlsx')));
}
/**
*
*/
function exportData(){
/* Get the HTML data using Element by Id */
var table = document.getElementById("tabcenter");
/* Declaring array variable */
var rows =[];
//iterate through rows of table
for(var i=0,row; row = table.rows[i];i++){
//rows would be accessed using the "row" variable assigned in the for loop
//Get each cell value/column from the row
column1 = row.cells[0].innerText;
column2 = row.cells[1].innerText;
column3 = row.cells[2].innerText;
column4 = row.cells[3].innerText;
column5 = row.cells[4].innerText;
column6 = row.cells[5].innerText.replaceAll(/\n\n\n/g, ' - ').trim();
column7 = row.cells[6].innerText;
column8 = row.cells[7].innerText;
column9 = row.cells[8].innerText;
column10 = row.cells[9].innerText;
column11= row.cells[10].innerText;
column12= row.cells[11].innerText;
column13= row.cells[12].innerText;
column14= row.cells[13].innerText;
column15= row.cells[14].innerText;
column16= row.cells[15].innerText;
column17= row.cells[16].innerText;
column18= row.cells[17].innerText;
column19= row.cells[18].innerText;
column20= row.cells[19].innerText;
column21= row.cells[20].innerText;
column22= row.cells[21].innerText;
/* add a new records in the array */
cols = [
column1,
column2,
column3,
column4,
column5,
]
if(perfChecked){
cols.push(column6);
cols.push(column7);
}
if(compChecked){
cols.push(column8);
cols.push(column9);
cols.push(column10);
cols.push(column11);
cols.push(column12);
}
if(examsChecked){
cols.push(column13);
cols.push(column14);
}
if(planChecked){
cols.push(column15);
cols.push(column16);
cols.push(column17);
cols.push(column18);
cols.push(column19);
cols.push(column20);
cols.push(column21);
}
if(objectifsChecked)
cols.push(column22);
rows.push(cols);
}
csvContent = "data:text/csv;charset=UTF-8,";
/* add the column delimiter as comma(,) and each row splitted by new line character (\n) */
rows.forEach(function(rowArray){
row = rowArray.join(";");
csvContent += row + "\r\n";
});
console.log(csvContent);
/* create a hidden <a> DOM node and set its download attribute */
var encodedUri = encodeURI(csvContent);//Base64._utf8_encode(unescape(encodeURIComponent(csvContent)))
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "Repport_eval_"+Date.now()+".csv");
document.body.appendChild(link);
/* download the data file named Repport_eval.csv" */
link.click();
}
let perfstructuresdata = new Map();
let autonomstructuresdata = new Map();
let difficstructuresdata = new Map();
let relationstructuresdata = new Map();
let requiredcompstructuresdata = new Map();
let responstructuresdata = new Map();
let rhnotedata = new Map();
let hsenotedata = new Map();
for(let value in results){
if(perfstructuresdata.has(results[value][2])){
perfstructuresdata.get(results[value][2]).push(results[value]["perfscore"][1]);
}else{
perfstructuresdata.set(results[value][2],[results[value]["perfscore"][1]]);
}
if(autonomstructuresdata.has(results[value][2])){
autonomstructuresdata.get(results[value][2]).push(results[value]["perfscore"][2])
}else{
autonomstructuresdata.set(results[value][2],[results[value]["perfscore"][2]]);
}
if(difficstructuresdata.has(results[value][2])){
difficstructuresdata.get(results[value][2]).push(results[value]["perfscore"][3]);
}else{
difficstructuresdata.set(results[value][2],[results[value]["perfscore"][3]]);
}
if(relationstructuresdata.has(results[value][2])){
relationstructuresdata.get(results[value][2]).push(results[value]["perfscore"][4]);
}else{
relationstructuresdata.set(results[value][2],[results[value]["perfscore"][4]]);
}
if(requiredcompstructuresdata.has(results[value][2])){
requiredcompstructuresdata.get(results[value][2]).push(results[value]["perfscore"][5]);
}else{
requiredcompstructuresdata.set(results[value][2],[results[value]["perfscore"][5]]);
}
if(responstructuresdata.has(results[value][2])){
responstructuresdata.get(results[value][2]).push(results[value]["perfscore"][6]);
}else{
responstructuresdata.set(results[value][2],[results[value]["perfscore"][6]]);
}
if(rhnotedata.has(results[value][2])){
rhnotedata.get(results[value][2]).push(results[value]["perfscore"][7]);
}else{
rhnotedata.set(results[value][2],[results[value]["perfscore"][7]]);
}
if(hsenotedata.has(results[value][2])){
hsenotedata.get(results[value][2]).push(results[value]["perfscore"][8]);
}else{
hsenotedata.set(results[value][2],[results[value]["perfscore"][8]]);
}
}
const labels = [];
const content = [];
for(let [key, value] of perfstructuresdata){
labels.push(key);
content.push(value.reduce((a, b) => a + b, 0)/value.length);
}
const content1 = [];
for(let [key, value] of autonomstructuresdata){
content1.push(value.reduce((a, b) => a + b, 0)/value.length);
}
const content2 = [];
for(let [key, value] of difficstructuresdata){
content2.push(value.reduce((a, b) => a + b, 0)/value.length);
}
const content3 = [];
for(let [key, value] of relationstructuresdata){
content3.push(value.reduce((a, b) => a + b, 0)/value.length);
}
const content4 = [];
for(let [key, value] of requiredcompstructuresdata){
content4.push(value.reduce((a, b) => a + b, 0)/value.length);
}
const content5 = [];
for(let [key, value] of responstructuresdata){
content5.push(value.reduce((a, b) => a + b, 0)/value.length);
}
const content6 = [];
for(let [key, value] of rhnotedata){
content6.push(value.reduce((a, b) => a + b, 0)/value.length);
}
const content7 = [];
for(let [key, value] of hsenotedata){
content7.push(value.reduce((a, b) => a + b, 0)/value.length);
}
function random_rgba() {
var x = Math.floor(Math.random() * 256),y = 100+ Math.floor(Math.random() * 256),z = 50+ Math.floor(Math.random() * 256), r = Math.random;
return 'rgba(' + x + ',' + y + ',' + z + ',' + '0.5'+ ')';
}
var arr = {
max: function(map) {
if (map.length === 0) {
return -1;
}
var max = map.entries().next().value[1].reduce((a, b) => a + b, 0)/map.entries().next().value[1].length;
var maxStruct = map.entries().next().value[0];
var i = 0;
for (let [key, value] of map) {
const currentval = value.reduce((a, b) => a + b, 0)/value.length;
if (currentval > max) {
maxStruct = key;
max = currentval;
}
}
return [maxStruct,max];
},
min: function(map) {
if (map.length === 0) {
return -1;
}
var min = map.entries().next().value[1].reduce((a, b) => a + b, 0)/map.entries().next().value[1].length;
var minStruct = map.entries().next().value[0];
var i = 0;
for (let [key, value] of map) {
const currentval = value.reduce((a, b) => a + b, 0)/value.length;
if (currentval < min) {
minStruct = key;
min = currentval;
}
}
return [minStruct,min];
},
range: function(array) {
return Math.max.apply(null,array.slice()) - Math.min.apply(null,array.slice());
},
midrange: function(array) {
return arr.range(array.slice()) / 2;
},
sum: function(array) {
var num = 0;
for (var i = 0, l = array.length; i < l; i++) num += array[i];
return num;
},
mean: function(array) {
return arr.sum(array.slice()) / array.slice().length;
},
median: function(array) {
array.slice().sort(function(a, b) {
return a - b;
});
var mid = array.slice().length / 2;
return mid % 1 ? array.slice()[mid - 0.5] : (array.slice()[mid - 1] + array.slice()[mid]) / 2;
},
modes: function(array) {
if (!array.length) return [];
var modeMap = {},
maxCount = 0,
modes = [];
array.slice().forEach(function(val) {
if (!modeMap[val]) modeMap[val] = 1;
else modeMap[val]++;
if (modeMap[val] > maxCount) {
modes = [val];
maxCount = modeMap[val];
}
else if (modeMap[val] === maxCount) {
modes.push(val);
maxCount = modeMap[val];
}
});
return modes;
},
variance: function(array) {
var mean = arr.mean(array);
return arr.mean(array.map(function(num) {
return Math.pow(num - mean, 2);
}));
},
standardDeviation: function(array) {
return Math.sqrt(arr.variance(array));
},
meanAbsoluteDeviation: function(array) {
var mean = arr.mean(array);
return arr.mean(array.map(function(num) {
return Math.abs(num - mean);
}));
},
zScores: function(array) {
var mean = arr.mean(array);
var standardDeviation = arr.standardDeviation(array);
return array.map(function(num) {
return (num - mean) / standardDeviation;
});
}
};
function statisticsRef(){
let maxperf = arr.max(perfstructuresdata);
let maxauto = arr.max(autonomstructuresdata);
let maxdiff = arr.max(difficstructuresdata);
let maxrel = arr.max(relationstructuresdata);
let maxcon = arr.max(requiredcompstructuresdata);
let maxrespo = arr.max(responstructuresdata);
let maxrh = arr.max(rhnotedata);
let maxhse = arr.max(hsenotedata);
let minperf = arr.min(perfstructuresdata);
let minauto = arr.min(autonomstructuresdata);
let miniff = arr.min(difficstructuresdata);
let minrel = arr.min(relationstructuresdata);
let mincon = arr.min(requiredcompstructuresdata);
let minrespo = arr.min(responstructuresdata);
let minrh = arr.min(rhnotedata);
let minhse = arr.min(hsenotedata);
$("#analytics-perf").html(
"<div>"+
"<div> Max : "+maxperf[0] +" ("+maxperf[1].toFixed(2)+")</div><br>"+
"<div> Min : "+minperf[0] +" ("+minperf[1].toFixed(2)+")</div><br>"+
"<div> Moynne SOPHAL : "+arr.mean(content).toFixed(2)+"</div><br>"+
"<div> Mediane SOPHAL : "+arr.median(content).toFixed(2)+"</div><br>"+
"</div>"
)
$("#analytics-comp").html(
"<div>"+
"<div> Max AUTONOMIE ET CREATIVITE: "+maxauto[0] +" ("+maxauto[1].toFixed(2)+")</div><br>"+
"<div> Max GESTION DES DIIFICULTES: "+maxdiff[0] +" ("+maxdiff[1].toFixed(2)+")</div><br>"+
"<div> Max RELATIONNELLE: "+maxrel[0] +" ("+maxrel[1].toFixed(2)+")</div><br>"+
"<div> Max CONNAISSANCES: "+maxcon[0] +" ("+maxcon[1].toFixed(2)+")</div><br>"+
"<div> Max Responsabilité: "+maxrespo[0] +" ("+maxrespo[1].toFixed(2)+")</div><br>"+
"<div> Min AUTONOMIE ET CREATIVITE: "+minauto[0] +" ("+minauto[1].toFixed(2)+")</div><br>"+
"<div> Min GESTION DES DIIFICULTES: "+miniff[0] +" ("+miniff[1].toFixed(2)+")</div><br>"+
"<div> Min RELATIONNELLE: "+minrel[0] +" ("+minrel[1].toFixed(2)+")</div><br>"+
"<div> Min CONNAISSANCES: "+mincon[0] +" ("+mincon[1].toFixed(2)+")</div><br>"+
"<div> Min Responsabilité: "+minrespo[0] +" ("+minrespo[1].toFixed(2)+")</div><br>"+
"</div>"
)
$("#analytics-hr").html(
"<div>"+
"<div> Max RH : "+maxrh[0] +" ("+maxrh[1].toFixed(2)+")</div><br>"+
"<div> Max HSE : "+maxhse[0] +" ("+maxhse[1].toFixed(2)+")</div><br>"+
"<div> Min RH : "+minrh[0] +" ("+minrh[1].toFixed(2)+")</div><br>"+
"<div> Min HSE : "+minhse[0] +" ("+minhse[1].toFixed(2)+")</div><br>"+
"<div> Moynne RH SOPHAL : "+arr.mean(content6).toFixed(2)+"</div><br>"+
"<div> Moynne HSE SOPHAL : "+arr.mean(content7).toFixed(2)+"</div><br>"+
"<div> Mediane RH SOPHAL : "+arr.median(content6).toFixed(2)+"</div><br>"+
"<div> Mediane HSE SOPHAL : "+arr.median(content7).toFixed(2)+"</div><br>"+
"</div>"
)
}
const data = {
labels: labels,
datasets: [{
label: 'Performance',
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
data: content,
},
{
label: 'AUTONOMIE ET CREATIVITE',
backgroundColor: 'rgb(0, 153, 255)',
borderColor: 'rgb(0, 153, 255)',
data: content1,
},
{
label: 'LA GESTION DES DIIFICULTES',
backgroundColor: 'rgb(102, 102, 255)',
borderColor: 'rgb(102, 102, 255)',
data: content2,
},
{
label: 'DIMENSION RELATIONNELLE',
backgroundColor: 'rgb(204, 0, 153)',
borderColor: 'rgb(204, 0, 153)',
data: content3,
},
{
label: 'LA COMPETENCE, LES CONNAISSANCES REQUISES',
backgroundColor: 'rgb(51, 153, 102)',
borderColor: 'rgb(51, 153, 102)',
data: content4,
},
{
label: 'Responsabilité',
backgroundColor: 'rgb(204, 0, 0)',
borderColor: 'rgb(204, 0, 0)',
data: content5,
},
]
};
function radarDataSets(){
const dataset = [];
const colorlist = ['rgba(255, 99, 132,0.5)'];
dataset.push({
label: 'SOPHAL SPA',
backgroundColor: 'rgba(255, 99, 132,0.5)',
borderColor: 'rgba(255, 99, 132)',
data: [
content.reduce((a,b) => a + b, 0)/content.length,
content1.reduce((a,b) => a + b, 0)/content1.length,
content2.reduce((a,b) => a + b, 0)/content2.length,
content3.reduce((a,b) => a + b, 0)/content3.length,
content4.reduce((a,b) => a + b, 0)/content4.length,
content5.reduce((a,b) => a + b, 0)/content5.length,
content6.reduce((a,b) => a + b, 0)/content6.length,
content7.reduce((a,b) => a + b, 0)/content7.length]
});
for(let key of labels){
let color = random_rgba();
while(colorlist.includes(color)){
if((color.match(/255/g) || []).length === 3)
continue;
color = random_rgba();
}
colorlist.push(color);
const perf = perfstructuresdata.get(key);
const autonom = autonomstructuresdata.get(key);
const difficult = difficstructuresdata.get(key);
const relation = relationstructuresdata.get(key);
const req = requiredcompstructuresdata.get(key);
const respon = responstructuresdata.get(key);
const hr = rhnotedata.get(key);
const hse = hsenotedata.get(key);
dataset.push({
label: key,
backgroundColor: color,
borderColor: color,
data: [
perf.reduce((a,b) => a + b, 0)/perf.length,
autonom.reduce((a,b) => a + b, 0)/autonom.length,
difficult.reduce((a,b) => a + b, 0)/difficult.length,
relation.reduce((a,b) => a + b, 0)/relation.length,
req.reduce((a,b) => a + b, 0)/req.length,
respon.reduce((a,b) => a + b, 0)/respon.length,
hr.reduce((a,b) => a + b, 0)/hr.length,
hse.reduce((a,b) => a + b, 0)/hse.length]
});
}
return dataset;
}
const data1 = {
labels: ['Performance','AUTONOMIE ET CREATIVITE','GESTION DES DIIFICULTES','RELATIONNELLE','CONNAISSANCES','RESPONSABILITE','RH','HSE'],
datasets: radarDataSets()
};
const config = {
type: 'line',
data: data,
options: {
}
};
const config1 = {
type: 'radar',
data: data1,
options: {
}
};
const lineChart = new Chart(
document.getElementById('lineChart'),
config
);
const radarChart = new Chart(
document.getElementById('radarChart'),
config1
);
$("#toggle-button").click(function() {
radarChart.data.datasets.forEach(function(ds) {
ds.hidden = !ds.hidden;
});
radarChart.update();
});
</script>