From 640a5b2f9e72636a5f8259df423255aa5bc6ca75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gi=C3=B2=20Diani?= Date: Fri, 20 Dec 2024 21:46:54 +0100 Subject: [PATCH] Implement region capacity as test --- dashboard/app/Api.php | 5 +++++ dashboard/resources/views/overview.blade.php | 6 +++--- dashboard/routes/web.php | 6 ++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dashboard/app/Api.php b/dashboard/app/Api.php index 3b41e45..c337978 100644 --- a/dashboard/app/Api.php +++ b/dashboard/app/Api.php @@ -55,6 +55,11 @@ class Api return self::get("/property/{$id}/base"); } + public static function regionCapacities(int $id): mixed + { + return self::get("/region/{$id}/capacities"); + } + diff --git a/dashboard/resources/views/overview.blade.php b/dashboard/resources/views/overview.blade.php index 8f3f870..45be5a0 100644 --- a/dashboard/resources/views/overview.blade.php +++ b/dashboard/resources/views/overview.blade.php @@ -61,7 +61,7 @@ const cHeatmapOptions = { }, xAxis: { type: 'category', - data: hours, + data: {!! json_encode($heat['property_ids']) !!}, splitArea: { show: false } @@ -75,7 +75,7 @@ const cHeatmapOptions = { }, visualMap: { min: 0, - max: 10, + max: 100, calculable: true, orient: 'horizontal', left: 'center', @@ -85,7 +85,7 @@ const cHeatmapOptions = { { name: 'Punch Card', type: 'heatmap', - data: data, + data: {!! json_encode($heat['values']) !!}, label: { show: false }, diff --git a/dashboard/routes/web.php b/dashboard/routes/web.php index 86c25c7..89920f7 100644 --- a/dashboard/routes/web.php +++ b/dashboard/routes/web.php @@ -5,12 +5,14 @@ use App\Api; Route::get('/', function () { - + $regionHeat = Api::regionCapacities(1); $propertiesGrowth = Api::propertiesGrowth(); $propsPerRegion = Api::propertiesPerRegion(); $propsPerRegionName = []; $propsPerRegionCounts = []; + // dump($regionHeat); + foreach ($propsPerRegion as $el) { $propsPerRegionName[] = $el['name']; $propsPerRegionCounts[] = $el['count_properties']; @@ -18,7 +20,7 @@ Route::get('/', function () { $propertiesGeo = Api::propertiesGeo(); - return view('overview', ["geo" => $propertiesGeo, "growth" => $propertiesGrowth, "propsPerRegion" => [json_encode($propsPerRegionName), json_encode($propsPerRegionCounts)]]); + return view('overview', ["heat" => $regionHeat, "geo" => $propertiesGeo, "growth" => $propertiesGrowth, "propsPerRegion" => [json_encode($propsPerRegionName), json_encode($propsPerRegionCounts)]]); }); Route::get('/prop/{id}', function (int $id) {