Fehlermeldung, wenn keine Daten für Property vorhanden.

main
Giò Diani 2025-01-17 15:13:41 +01:00
parent 0d3bc7acd3
commit e4462b0cfa
2 changed files with 26 additions and 16 deletions

View File

@ -24,13 +24,18 @@
@endsection
@section('main')
@if(!isset($propertyCapacities['capacities']))
<div style="position: absolute;">
Für dieses Mietobjekt sind keine Daten vorhanden.
</div>
@else
<article style="grid-area: timeline;">
<div id="timeline"></div>
</article>
<article class="header" style="grid-area: chart1;">
<header>
<h2 id="belegung-title">
Kalenderansicht der Belegung am <span class="date">{{ $startDate }}</span>
Kalenderansicht der Verfügbarkeit am <span class="date">{{ $startDate }}</span>
</h2><button popovertarget="popup-cal"></button>
<div popover id="popup-cal">
<p>
@ -51,7 +56,7 @@
<article class="header" style="grid-area: chart3;">
<header>
<h2>
Belegung Mietobjekt Monate am <span class="date">{{ $startDate }}</span>
Verfügbarkeit Mietobjekt Monate am <span class="date">{{ $startDate }}</span>
</h2>
</header>
<div id="chart-capacity-monthly">
@ -73,7 +78,7 @@
<article class="header" style="grid-area: chart4;">
<header>
<h2>
Belegung Mietobjekt Tage am <span class="date">{{ $startDate }}</span>
Verfügbarkeit Mietobjekt Tage am <span class="date">{{ $startDate }}</span>
</h2>
</header>
<div id="chart-capacity-daily">
@ -460,4 +465,5 @@ cCapacity.on('click', 'series', (e) => {
</script>
@endif
@endsection

View File

@ -99,22 +99,26 @@ Route::get('/property/{id}', function (int $id) {
$propertyCapacitiesMonthly = [];
$propertyCapacitiesDaily = [];
foreach ($propertyCapacities['dates'] as $date) {
$propertyCapacitiesMonthly[] = Api::propertyCapacitiesMonthly($id, $date);
$propertyCapacitiesDaily[] = Api::propertyCapacitiesDaily($id, $date);
}
// filter out all date, which were not scraped for the property
foreach ($regionCapacitiesAll['dates'] as $index => $date) {
if(in_array($date, $propertyCapacities['dates'])){
$regionCapacities[0][] = $regionCapacitiesAll['capacities'][$index];
if($propertyCapacities){
foreach ($propertyCapacities['dates'] as $date) {
$propertyCapacitiesMonthly[] = Api::propertyCapacitiesMonthly($id, $date);
$propertyCapacitiesDaily[] = Api::propertyCapacitiesDaily($id, $date);
}
}
foreach ($regionCapacitiesRegion['dates'] as $index => $date) {
if(in_array($date, $propertyCapacities['dates'])){
$regionCapacities[1][] = $regionCapacitiesRegion['capacities'][$index];
// filter out all date, which were not scraped for the property
foreach ($regionCapacitiesAll['dates'] as $index => $date) {
if(in_array($date, $propertyCapacities['dates'])){
$regionCapacities[0][] = $regionCapacitiesAll['capacities'][$index];
}
}
foreach ($regionCapacitiesRegion['dates'] as $index => $date) {
if(in_array($date, $propertyCapacities['dates'])){
$regionCapacities[1][] = $regionCapacitiesRegion['capacities'][$index];
}
}
}else{
$propertyCapacities = ['dates' => [null]];
}
// prepare data for calendar chart