diff --git a/Controleur/ControleurAjaxgraphiquesinistres.php b/Controleur/ControleurAjaxgraphiquesinistres.php new file mode 100755 index 0000000..b80fbc5 --- /dev/null +++ b/Controleur/ControleurAjaxgraphiquesinistres.php @@ -0,0 +1,58 @@ +synthese = new Synthese(); + } + + public function index() { + + // Répartition sinistres + $claims = $this->synthese->getClaims(); + + $tabclaims = [ + 'claimsLabels' => array_column($claims, 'claimsLabels'), + 'claimsValues' => array_column($claims, 'claimsValues') + ]; + + $dataTabClaims = json_encode($tabclaims, JSON_NUMERIC_CHECK); + + + // Evolution des sinistres + $claimsMonth = $this->synthese->getClaimsMonth(); + $claimsSingleMonth = $this->synthese->getClaimsSingleMonth(); + + $tabclaimsMonth = [ + 'months' => array_column($claimsMonth, 'months'), + 'monthlyClaims' => array_column($claimsMonth, 'monthlyClaims'), + 'singleClaims' => array_column($claimsSingleMonth, 'singleClaims') + ]; + + $dataTabClaimsMonth = json_encode($tabclaimsMonth, JSON_NUMERIC_CHECK); + + // SINISTRALITÉ + $claimsLossRatio = $this->synthese->getClaimsLossRatio(); + + $tabLossRatio = [ + 'lossRatioLabels' => array_column($claimsLossRatio, 'months'), + 'lossRatioValues' => array_column($claimsLossRatio, 'ratio') + ]; + + $dataLossRatio = json_encode($tabLossRatio, JSON_NUMERIC_CHECK); + + $this->genererVueAjax( + array + ( + 'dataTabClaims' => $dataTabClaims, + 'dataTabClaimsMonth' => $dataTabClaimsMonth, + 'dataLossRatio' => $dataLossRatio + ) + ); + } +} diff --git a/Js/fonctions.js b/Js/fonctions.js index 2404060..4a1971f 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -803,4 +803,28 @@ function afficher_adherents_police() $("#div_liste_adherent").html(data); } }); +} + +function graphique_sinistre() +{ + $("#div_graphique").html(` +
Affichage des graphiques en cours...
+