53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
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'];
|
|
}
|
|
|
|
$propertiesGeo = Api::propertiesGeo();
|
|
|
|
return view('overview', ["heat" => $regionHeat, "geo" => $propertiesGeo, "growth" => $propertiesGrowth, "propsPerRegion" => [json_encode($propsPerRegionName), json_encode($propsPerRegionCounts)]]);
|
|
});
|
|
|
|
Route::get('/prop/{id}', function (int $id) {
|
|
|
|
$propertyBase = Api::propertyBase($id);
|
|
$extractions = Api::propertyExtractions($id);
|
|
$propertyCapacities = Api::propertyCapacities($id);
|
|
$data = [];
|
|
$dates = [];
|
|
|
|
foreach ($extractions as $ext) {
|
|
|
|
$series = [];
|
|
$dates[] = $ext['created_at'];
|
|
|
|
$extCalendar = json_decode($ext['calendar'], 1);
|
|
|
|
|
|
|
|
foreach ($extCalendar as $date => $status) {
|
|
$series[] = [$date, $status];
|
|
}
|
|
|
|
$data[] = $series;
|
|
|
|
}
|
|
|
|
return view('property', ['base' => $propertyBase[0], "extractiondates" => json_encode($dates), "calendar" => $data, 'capacities' => $propertyCapacities]);
|
|
});
|