radiantrh/Controleur/ControleurAccueil.php
2025-12-25 11:01:11 +00:00

77 lines
2.7 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Menuvueutilisateur.php';
require_once 'Modele/Synthese.php';
class ControleurAccueil extends Controleur {
private $menuvue;
private $synthese;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuVue('Accueil');
$this->synthese = new Synthese();
}
public function index() {
// KPIs
$kpis = $this->synthese->getKpis();
// Activité récente
$activities = [
["icon" => "fas fa-user-plus", "label" => "Nouveaux salariés ajoutés", "time" => "Il y a 1 heure"],
["icon" => "fas fa-sign-out-alt", "label" => "5 départs validés", "time" => "Il y a 2 heures"],
["icon" => "fas fa-pause-circle", "label" => "3 contrats suspendus", "time" => "Il y a 3 jours"],
["icon" => "fas fa-file-invoice", "label" => "Facture de février réglée", "time" => "Il y a 3 jours"]
];
// Alertes
$alerts = [
"Plafond de remboursement atteint",
"Paiement en retard de 4 520 €",
"Documents manquants pour 2 dossiers"
];
// 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 par mois
$claimsMonth = $this->synthese->getClaimsMonth();
$tabclaimsMonth = [
'months' => array_column($claimsMonth, 'months'),
'monthlyClaims' => array_column($claimsMonth, 'monthlyClaims')
];
$dataTabClaimsMonth = json_encode($tabclaimsMonth, JSON_NUMERIC_CHECK);
// SINISTRALITÉ
$lossRatioLabels = ["Jan", "Fév", "Mar", "Avr", "Mai", "Juin"];
$lossRatioValues = [62, 68, 71, 65, 73, 69]; // %
// Polices
$polices = $this->synthese->getPolices();
$this->genererVue(
array
(
'kpis' => $kpis,
'activities' => $activities,
'alerts' => $alerts,
'lossRatioLabels' => $lossRatioLabels,
'lossRatioValues' => $lossRatioValues,
'dataTabClaims' => $dataTabClaims,
'dataTabClaimsMonth' => $dataTabClaimsMonth,
'polices' => $polices
)
);
}
}