Überarbeitung Dashboard
This commit is contained in:
1 parent
8bef4b9621
commit
a5a21fb925
10 files changed
+242
-95
No files matched your search
+51
-40
@@ -36,8 +36,57 @@ Route::get('/', function () {
|
||||
"propsPerRegion" => [json_encode($propsPerRegionId), json_encode($propsPerRegionName), json_encode($propsPerRegionCounts)]]);
|
||||
});
|
||||
|
||||
Route::get('/region/{id}', function (int $id) {
|
||||
|
||||
$regionBaseAll = Api::regionBase(-1);
|
||||
$regionBaseAll[] = ['region_name' => 'Alle Regionen', 'region_id' => -1];
|
||||
$regionBaseRegion = $id >= 0 ? Api::regionBase($id) : [['region_name' => 'Alle Regionen']];
|
||||
|
||||
$regionPropertiesCapacities = Api::regionPropertiesCapacities($id);
|
||||
$regionCapacitiesRegion = Api::regionCapacities($id);
|
||||
$regionCapacitiesAll = Api::regionCapacities(-1);
|
||||
|
||||
$regionCapacitiesMonthly = [];
|
||||
$regionCapacitiesDaily = [];
|
||||
$regionPredictions = [];
|
||||
|
||||
foreach ($regionCapacitiesRegion['dates'] as $date) {
|
||||
$regionCapacitiesMonthly[] = Api::regionCapacitiesMonthly($id, $date);
|
||||
$regionCapacitiesDaily[] = Api::regionCapacitiesDaily($id, $date);
|
||||
$regionPredictions[] = Api::regionMovingAverage($id, $date);
|
||||
}
|
||||
|
||||
$chartOptions = [
|
||||
'colors' => Chart::colors()
|
||||
];
|
||||
|
||||
$regionCapacities = [
|
||||
'all' => $regionCapacitiesAll,
|
||||
'region' => $regionCapacitiesRegion,
|
||||
'region_monthly' => $regionCapacitiesMonthly,
|
||||
'region_daily' => $regionCapacitiesDaily
|
||||
|
||||
];
|
||||
|
||||
return view('region', [
|
||||
'chartOptions' => $chartOptions,
|
||||
'startDate' => $regionCapacitiesRegion['dates'][0],
|
||||
'regions' => $regionBaseAll,
|
||||
'region' => $regionBaseRegion,
|
||||
'region_id' => $id,
|
||||
'regionCapacities' => $regionCapacities,
|
||||
'regionPropertiesCapacities' => $regionPropertiesCapacities,
|
||||
'predictions' => $regionPredictions]);
|
||||
|
||||
|
||||
});
|
||||
|
||||
Route::get('/property/{id}', function (int $id) {
|
||||
|
||||
$chartOptions = [
|
||||
'colors' => Chart::colors()
|
||||
];
|
||||
|
||||
$propertyBase = Api::propertyBase($id);
|
||||
$calendars = Api::propertyExtractions($id);
|
||||
$propertyCapacities = Api::propertyCapacities($id);
|
||||
@@ -85,6 +134,8 @@ Route::get('/property/{id}', function (int $id) {
|
||||
}
|
||||
|
||||
return view('property', [
|
||||
'chartOptions' => $chartOptions,
|
||||
'startDate' => $propertyCapacities['dates'][0],
|
||||
'base' => $propertyBase[0],
|
||||
'extractiondates' => json_encode($propertyCapacities['dates']),
|
||||
'calendar' => $data,
|
||||
@@ -98,43 +149,3 @@ Route::get('/property/{id}', function (int $id) {
|
||||
});
|
||||
|
||||
|
||||
Route::get('/region/{id}', function (int $id) {
|
||||
|
||||
$regionBaseAll = Api::regionBase(-1);
|
||||
$regionBaseAll[] = ['region_name' => 'Alle Regionen', 'region_id' => -1];
|
||||
$regionBaseRegion = $id >= 0 ? Api::regionBase($id) : [['region_name' => 'Alle Regionen']];
|
||||
|
||||
$regionPropertiesCapacities = Api::regionPropertiesCapacities($id);
|
||||
$regionCapacitiesRegion = Api::regionCapacities($id);
|
||||
$regionCapacitiesAll = Api::regionCapacities(-1);
|
||||
|
||||
$regionCapacitiesMonthly = [];
|
||||
$regionCapacitiesDaily = [];
|
||||
$regionPredictions = [];
|
||||
|
||||
foreach ($regionCapacitiesRegion['dates'] as $date) {
|
||||
$regionCapacitiesMonthly[] = Api::regionCapacitiesMonthly($id, $date);
|
||||
$regionCapacitiesDaily[] = Api::regionCapacitiesDaily($id, $date);
|
||||
$regionPredictions[] = Api::regionMovingAverage($id, $date);
|
||||
}
|
||||
|
||||
$regionCapacities = [
|
||||
'all' => $regionCapacitiesAll,
|
||||
'region' => $regionCapacitiesRegion,
|
||||
'region_monthly' => $regionCapacitiesMonthly,
|
||||
'region_daily' => $regionCapacitiesDaily
|
||||
|
||||
];
|
||||
|
||||
dump($regionPredictions);
|
||||
|
||||
return view('region', [
|
||||
'regions' => $regionBaseAll,
|
||||
'region' => $regionBaseRegion,
|
||||
'region_id' => $id,
|
||||
'regionCapacities' => $regionCapacities,
|
||||
'regionPropertiesCapacities' => $regionPropertiesCapacities,
|
||||
'predictions' => $regionPredictions]);
|
||||
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user