Implement region capacity as test

main
Giò Diani 2024-12-20 21:46:54 +01:00
parent f585a7a2aa
commit 640a5b2f9e
3 changed files with 12 additions and 5 deletions

View File

@ -55,6 +55,11 @@ class Api
return self::get("/property/{$id}/base"); return self::get("/property/{$id}/base");
} }
public static function regionCapacities(int $id): mixed
{
return self::get("/region/{$id}/capacities");
}

View File

@ -61,7 +61,7 @@ const cHeatmapOptions = {
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: hours, data: {!! json_encode($heat['property_ids']) !!},
splitArea: { splitArea: {
show: false show: false
} }
@ -75,7 +75,7 @@ const cHeatmapOptions = {
}, },
visualMap: { visualMap: {
min: 0, min: 0,
max: 10, max: 100,
calculable: true, calculable: true,
orient: 'horizontal', orient: 'horizontal',
left: 'center', left: 'center',
@ -85,7 +85,7 @@ const cHeatmapOptions = {
{ {
name: 'Punch Card', name: 'Punch Card',
type: 'heatmap', type: 'heatmap',
data: data, data: {!! json_encode($heat['values']) !!},
label: { label: {
show: false show: false
}, },

View File

@ -5,12 +5,14 @@ use App\Api;
Route::get('/', function () { Route::get('/', function () {
$regionHeat = Api::regionCapacities(1);
$propertiesGrowth = Api::propertiesGrowth(); $propertiesGrowth = Api::propertiesGrowth();
$propsPerRegion = Api::propertiesPerRegion(); $propsPerRegion = Api::propertiesPerRegion();
$propsPerRegionName = []; $propsPerRegionName = [];
$propsPerRegionCounts = []; $propsPerRegionCounts = [];
// dump($regionHeat);
foreach ($propsPerRegion as $el) { foreach ($propsPerRegion as $el) {
$propsPerRegionName[] = $el['name']; $propsPerRegionName[] = $el['name'];
$propsPerRegionCounts[] = $el['count_properties']; $propsPerRegionCounts[] = $el['count_properties'];
@ -18,7 +20,7 @@ Route::get('/', function () {
$propertiesGeo = Api::propertiesGeo(); $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) { Route::get('/prop/{id}', function (int $id) {