refactoring; more consistent naming for API endpoint and variables.

This commit is contained in:
Giò Diani committed 2025-01-17 23:46:22 +01:00
1 parent e0c8b3eb1b
commit e4e05b4788
16 files changed
+325 -238

No files matched your search

+37 -43
View File
@@ -2,11 +2,11 @@
@section('body-class', 'property')
@section('header')
<nav>
<strong>Property: {{ $base['check_data'] }} ({{ $base['region_name'] }})</strong>
<strong>Property: {{ $base['latlng'] }} ({{ $base['region_name'] }})</strong>
<ul>
<li><a href="/">Start</a></li>
@foreach($regions as $r)
<li><a href="/region/{{ $r['region_id'] }}">{{ $r['region_name'] }}</a></li>
<li><a href="/region/{{ $r['id'] }}">{{ $r['name'] }}</a></li>
@endforeach
</ul>
</nav>
@@ -24,11 +24,6 @@
@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>
@@ -86,41 +81,41 @@
<script type="module">
const sharedOptions = {
basic: {
color: {!! $chartOptions['colors'] !!},
grid: {
top: 20,
left: 60,
right: 0,
bottom: 50
},
tooltip: {
show: true,
trigger: 'axis',
valueFormatter: (value) => value.toFixed(2)+' %'
},
name: (opt) => {
return {
name: opt.name,
nameLocation: opt.location,
nameGap: 24,
nameTextStyle: {
fontWeight: 'bold',
extractiondates: {!! $diagramsOptions['shared']['extractiondates']!!},
basic: {
color: {!!$diagramsOptions['shared']['colors']!!},
grid: {
top: 20,
left: 60,
right: 0,
bottom: 50
},
}
tooltip: {
show: true,
trigger: 'axis',
valueFormatter: (value) => value.toFixed(2) + ' %'
},
name: (opt) => {
return {
name: opt.name,
nameLocation: opt.location,
nameGap: 24,
nameTextStyle: {
fontWeight: 'bold',
}
}
}
}
}
}
const chartTimeline = document.getElementById('timeline');
const cTimeline = echarts.init(chartTimeline);
const cTimelineOptions = {
grid: {
show: false,
},
timeline: {
data: {!! $extractiondates !!},
data: sharedOptions.extractiondates,
playInterval: 1000,
axisType: 'time',
left: 8,
@@ -141,7 +136,7 @@ const cCapacityMonthlyOptions = {
tooltip: sharedOptions.basic.tooltip,
timeline: {
show: false,
data: {!! $extractiondates !!},
data: sharedOptions.extractiondates,
axisType: 'time',
},
grid: {
@@ -164,7 +159,7 @@ const cCapacityMonthlyOptions = {
type: 'category',
},
options: [
@foreach ($capacitiesMonthly as $cM)
@foreach ($diagramsOptions['capacityMonthly']['options'] as $cM)
{
yAxis: {
data: {!! json_encode($cM['months']) !!}
@@ -190,7 +185,7 @@ const cCapacityDailyOptions = {
tooltip: sharedOptions.basic.tooltip,
timeline: {
show: false,
data: {!! $extractiondates !!},
data: sharedOptions.extractiondates,
axisType: 'time',
},
grid: {
@@ -213,7 +208,7 @@ const cCapacityDailyOptions = {
type: 'category',
},
options: [
@foreach ($capacitiesDaily as $cD)
@foreach ($diagramsOptions['capacityDaily']['options'] as $cD)
{
yAxis: {
data: {!! json_encode($cD['weekdays']) !!}
@@ -254,7 +249,7 @@ const cCapacityOptions = {
xAxis: {
type: 'category',
boundaryGap: false,
data: {!! json_encode($propertyCapacities['dates']) !!},
data: {!! $diagramsOptions['capacities']['xAxis']['data'] !!},
name: 'Zeitpunkt Scraping',
nameLocation: 'center',
nameGap: 24,
@@ -278,19 +273,19 @@ const cCapacityOptions = {
name: 'Verfügbarkeit Mietobjekt',
type: 'line',
symbolSize: 7,
data: {!! json_encode($propertyCapacities['capacities']) !!}
data: {!! $diagramsOptions['capacities']["series"][0]["data"] !!}
},
{
name: 'Verfügbarkeit {{ $base['region_name'] }}',
type: 'line',
symbolSize: 7,
data: {!! json_encode($regionCapacities[0]) !!}
data: {!! $diagramsOptions['capacities']["series"][1]["data"] !!}
},
{
name: 'Verfügbarkeit alle Regionen',
type: 'line',
symbolSize: 7,
data: {!! json_encode($regionCapacities[1]) !!}
data: {!! $diagramsOptions['capacities']["series"][2]["data"] !!}
}
]
};
@@ -304,7 +299,7 @@ const h2Belegung = document.getElementById('belegung-title');
const cCalendarOptions = {
timeline: {
show: false,
data: {!! json_encode($propertyCapacities['dates']) !!},
data: sharedOptions.extractiondates,
axisType: 'time',
},
visualMap: {
@@ -363,7 +358,7 @@ const cCalendarOptions = {
}
],
options: [
@foreach ($calendar as $c)
@foreach ($diagramsOptions['calendar']['series'] as $c)
{
series: [{
type: 'heatmap',
@@ -445,7 +440,7 @@ function icon(id = 0){
}
const markers = L.featureGroup([
L.marker([{{ $base['check_data'] }}], {icon: icon(1)}),
L.marker([{{ $base['latlng'] }}], {icon: icon(1)}),
@foreach($neighbours as $n)
L.marker([{{ $n['lat'] }}, {{ $n['lon'] }}], {icon: icon()}).bindPopup('<a href="/property/{{ $n['id'] }}">{{ $n['lat'] }}, {{ $n['lon'] }}</a>'),
@endforeach
@@ -465,5 +460,4 @@ cCapacity.on('click', 'series', (e) => {
</script>
@endif
@endsection