modi
This commit is contained in:
parent
baa563b466
commit
10a0c5e9b0
|
|
@ -73,4 +73,39 @@ class ControleurAjaxgraphiquesinistres extends Controleur
|
||||||
echo json_encode($data, JSON_NUMERIC_CHECK);
|
echo json_encode($data, JSON_NUMERIC_CHECK);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function api()
|
||||||
|
{
|
||||||
|
// Répartition sinistres
|
||||||
|
$claims = $this->synthese->getClaims();
|
||||||
|
$tabclaims = [
|
||||||
|
'claimsLabels' => array_column($claims, 'claimsLabels'),
|
||||||
|
'claimsValues' => array_column($claims, 'claimsValues')
|
||||||
|
];
|
||||||
|
|
||||||
|
// Évolution 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')
|
||||||
|
];
|
||||||
|
|
||||||
|
// Sinistralité
|
||||||
|
$claimsLossRatio = $this->synthese->getClaimsLossRatio();
|
||||||
|
$tabLossRatio = [
|
||||||
|
'lossRatioLabels' => array_column($claimsLossRatio, 'months'),
|
||||||
|
'lossRatioValues' => array_column($claimsLossRatio, 'ratio')
|
||||||
|
];
|
||||||
|
|
||||||
|
// Réponse JSON
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
echo json_encode([
|
||||||
|
'claims' => $tabclaims,
|
||||||
|
'claimsMonth' => $tabclaimsMonth,
|
||||||
|
'lossRatio' => $tabLossRatio
|
||||||
|
], JSON_NUMERIC_CHECK);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user