refactoring; more consistent naming for API endpoint and variables.
This commit is contained in:
1 parent
e0c8b3eb1b
commit
e4e05b4788
16 files changed
+325
-238
No files matched your search
@@ -5,7 +5,7 @@
|
||||
<strong>Start</strong>
|
||||
<ul>
|
||||
@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>
|
||||
@@ -82,7 +82,7 @@
|
||||
<script type="module">
|
||||
const sharedOptions = {
|
||||
basic: {
|
||||
color: {!! $chartOptions['colors'] !!},
|
||||
color: {!! $diagramsOptions['shared']['colors'] !!},
|
||||
grid: {
|
||||
top: 30,
|
||||
left: 70,
|
||||
@@ -101,7 +101,7 @@ const sharedOptions = {
|
||||
}
|
||||
}
|
||||
}
|
||||
const extractionDates = {!! json_encode($regionPropertiesCapacities['scrapeDates']) !!};
|
||||
const extractionDates = {!! $diagramsOptions['shared']['extractionDates'] !!};
|
||||
|
||||
const chartHeatmap = document.getElementById('chart-heatmap');
|
||||
const cHeatmap = echarts.init(chartHeatmap);
|
||||
@@ -156,7 +156,7 @@ const cHeatmapOptions = {
|
||||
yAxis: {
|
||||
show: true,
|
||||
type: 'category',
|
||||
data: {!! json_encode($regionPropertiesCapacities['property_ids']) !!},
|
||||
data: {!! $diagramsOptions['heatmap']['yAxis']['data'] !!},
|
||||
splitArea: {
|
||||
show: false
|
||||
},
|
||||
@@ -196,7 +196,7 @@ const cHeatmapOptions = {
|
||||
name: 'Verfügbarkeit',
|
||||
type: 'heatmap',
|
||||
blurSize: 0,
|
||||
data: {!! json_encode($regionPropertiesCapacities['values']) !!},
|
||||
data: {!! $diagramsOptions['heatmap']['series']['data'] !!},
|
||||
label: {
|
||||
show: false
|
||||
},
|
||||
@@ -230,7 +230,7 @@ const cPropsPerRegionOptions = {
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
type: 'category',
|
||||
data: {!! $propsPerRegion[1] !!}
|
||||
data: {!! $diagramsOptions['propertiesPerRegion']['xAxis']['data'] !!}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
@@ -243,7 +243,7 @@ const cPropsPerRegionOptions = {
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: {!! $propsPerRegion[2] !!},
|
||||
data: {!! $diagramsOptions['propertiesPerRegion']['yAxis']['data'] !!},
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
color: (e) => {
|
||||
@@ -259,17 +259,13 @@ cPropsPerRegion.setOption(cPropsPerRegionOptions);
|
||||
const chartExtractions = document.getElementById('extractions');
|
||||
const cExtractions = echarts.init(chartExtractions);
|
||||
|
||||
const filters = {
|
||||
regions: ["Alle", "Davos", "Engadin", "Heidiland", "St. Moritz"]
|
||||
}
|
||||
|
||||
const cExtractionsOptions = {
|
||||
color: sharedOptions.basic.color,
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: filters.regions
|
||||
show: true
|
||||
},
|
||||
grid: sharedOptions.basic.grid,
|
||||
xAxis: {
|
||||
@@ -297,31 +293,31 @@ const cExtractionsOptions = {
|
||||
name: 'Alle',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
data: {!! json_encode($growth['total_all']) !!},
|
||||
data: {!! json_encode($diagramsOptions['extractions']['series']['total_all']) !!},
|
||||
},
|
||||
{
|
||||
connectNulls: true,
|
||||
name: 'Davos',
|
||||
type: 'line',
|
||||
data: {!! json_encode($growth['total_davos']) !!}
|
||||
data: {!! json_encode($diagramsOptions['extractions']['series']['total_davos']) !!}
|
||||
},
|
||||
{
|
||||
connectNulls: true,
|
||||
name: 'Engadin',
|
||||
type: 'line',
|
||||
data: {!! json_encode($growth['total_engadin']) !!}
|
||||
data: {!! json_encode($diagramsOptions['extractions']['series']['total_engadin']) !!}
|
||||
},
|
||||
{
|
||||
connectNulls: true,
|
||||
name: 'Heidiland',
|
||||
type: 'line',
|
||||
data: {!! json_encode($growth['total_heidiland']) !!}
|
||||
data: {!! json_encode($diagramsOptions['extractions']['series']['total_heidiland']) !!}
|
||||
},
|
||||
{
|
||||
connectNulls: true,
|
||||
name: 'St. Moritz',
|
||||
type: 'line',
|
||||
data: {!! json_encode($growth['total_stmoritz']) !!}
|
||||
data: {!! json_encode($diagramsOptions['extractions']['series']['total_stmoritz']) !!}
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
@extends('base')
|
||||
@section('body-class', 'property')
|
||||
@section('header')
|
||||
<nav>
|
||||
<strong>Property: {{ $base['check_data'] }} ({{ $base['region_name'] }})</strong>
|
||||
<ul>
|
||||
<li><a href="/">Start</a></li>
|
||||
@foreach($regions as $r)
|
||||
<li><a href="/region/{{ $r['id'] }}">{{ $r['name'] }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</nav>
|
||||
<button popovertarget="prop-details"></button>
|
||||
<div popover id="prop-details">
|
||||
<dl>
|
||||
<dt>Region</dt>
|
||||
<dd>{{ $base['region_name'] }}</dd>
|
||||
<dt>Zum ersten mal gefunden</dt>
|
||||
<dd>{{ $base['first_found'] }}</dd>
|
||||
<dt>Zum letzten mal gefunden</dt>
|
||||
<dd>{{ $base['last_found'] }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
@endsection
|
||||
@section('main')
|
||||
<p>Für dieses Mietobjekt sind keine Daten vorhanden.</p>
|
||||
@endsection
|
||||
@@ -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
|
||||
@@ -2,12 +2,12 @@
|
||||
@section('body-class', 'region')
|
||||
@section('header')
|
||||
<nav>
|
||||
<strong>{{ $region[0]['region_name'] }}</strong>
|
||||
<strong>{{ $region[0]['name'] }}</strong>
|
||||
<ul>
|
||||
<li><a href="/">Start</a></li>
|
||||
@foreach($regions as $r)
|
||||
@if($r['region_id'] != $region_id)
|
||||
<li><a href="/region/{{ $r['region_id'] }}">{{ $r['region_name'] }}</a></li>
|
||||
@if($r['id'] != $regionId)
|
||||
<li><a href="/region/{{ $r['id'] }}">{{ $r['name'] }}</a></li>
|
||||
@endif
|
||||
@endforeach
|
||||
</ul>
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
const sharedOptions = {
|
||||
basic: {
|
||||
color: {!! $chartOptions['colors'] !!},
|
||||
color: {!! $diagramsOptions['shared']['colors'] !!},
|
||||
grid: {
|
||||
top: 20,
|
||||
left: 60,
|
||||
@@ -108,7 +108,7 @@ const cCapacityOptions = {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: {!! json_encode($regionCapacities['region']['dates']) !!},
|
||||
data: {!! $diagramsOptions['capacity']['xAxis']['data'] !!},
|
||||
name: 'Zeitpunkt Scraping',
|
||||
nameLocation: 'center',
|
||||
nameGap: 24,
|
||||
@@ -131,13 +131,13 @@ const cCapacityOptions = {
|
||||
name: 'Verfügbarkeit alle Regionen',
|
||||
type: 'line',
|
||||
symbolSize: 7,
|
||||
data: {!! json_encode($regionCapacities['all']['capacities']) !!}
|
||||
data: {!! $diagramsOptions['capacity']['series']['all']['data'] !!}
|
||||
},
|
||||
{
|
||||
name: 'Verfügbarkeit Region',
|
||||
type: 'line',
|
||||
symbolSize: 7,
|
||||
data: {!! json_encode($regionCapacities['region']['capacities']) !!}
|
||||
data: {!! $diagramsOptions['capacity']['series']['region']['data'] !!}
|
||||
}]
|
||||
};
|
||||
|
||||
@@ -149,7 +149,7 @@ const cCapacityMonthly = echarts.init(chartCapacityMonthly);
|
||||
const cCapacityMonthlyOptions = {
|
||||
timeline: {
|
||||
show: false,
|
||||
data: {!! json_encode($regionCapacities['region']['dates']) !!},
|
||||
data: {!! $diagramsOptions['capacity']['xAxis']['data'] !!},
|
||||
axisType: 'time',
|
||||
},
|
||||
grid: {
|
||||
@@ -173,7 +173,7 @@ const cCapacityMonthlyOptions = {
|
||||
},
|
||||
tooltip: sharedOptions.basic.tooltip,
|
||||
options: [
|
||||
@foreach ($regionCapacities['region_monthly'] as $m)
|
||||
@foreach ($diagramsOptions['capacityMonthly']['options'] as $m)
|
||||
{
|
||||
yAxis: {
|
||||
data: {!! json_encode($m['months']) !!}
|
||||
@@ -198,7 +198,7 @@ const cCapacityDaily = echarts.init(chartCapacityDaily);
|
||||
const cCapacityDailyOptions = {
|
||||
timeline: {
|
||||
show: false,
|
||||
data: {!! json_encode($regionCapacities['region']['dates']) !!},
|
||||
data: {!! $diagramsOptions['capacity']['xAxis']['data'] !!},
|
||||
axisType: 'time',
|
||||
},
|
||||
tooltip: sharedOptions.basic.tooltip,
|
||||
@@ -222,7 +222,7 @@ const cCapacityDailyOptions = {
|
||||
type: 'category',
|
||||
},
|
||||
options: [
|
||||
@foreach ($regionCapacities['region_daily'] as $d)
|
||||
@foreach ($diagramsOptions['capacityDaily']['options'] as $d)
|
||||
{
|
||||
yAxis: {
|
||||
data: {!! json_encode($d['weekdays']) !!}
|
||||
@@ -248,7 +248,7 @@ const cPredictionOptions = {
|
||||
color: sharedOptions.basic.color,
|
||||
timeline: {
|
||||
show: false,
|
||||
data: {!! json_encode($regionCapacities['region']['dates']) !!},
|
||||
data: {!! $diagramsOptions['capacity']['xAxis']['data'] !!},
|
||||
axisType: 'time',
|
||||
replaceMerge: ['graphic', 'series']
|
||||
},
|
||||
@@ -285,7 +285,7 @@ const cPredictionOptions = {
|
||||
}
|
||||
},
|
||||
options: [
|
||||
@foreach ($predictions as $p)
|
||||
@foreach ($diagramsOptions['predictions']['options'] as $p)
|
||||
@if($p === null)
|
||||
{
|
||||
graphic: {
|
||||
@@ -368,7 +368,7 @@ const cHeatmapOptions = {
|
||||
show: true,
|
||||
name: 'Zeitpunkt Scraping',
|
||||
type: 'category',
|
||||
data: {!! json_encode($regionPropertiesCapacities['scrapeDates']) !!},
|
||||
data: {!! $diagramsOptions['heatmap']['xAxis']['data'] !!},
|
||||
splitArea: {
|
||||
show: false
|
||||
},
|
||||
@@ -393,7 +393,7 @@ const cHeatmapOptions = {
|
||||
yAxis: {
|
||||
show: true,
|
||||
type: 'category',
|
||||
data: {!! json_encode($regionPropertiesCapacities['property_ids']) !!},
|
||||
data: {!! $diagramsOptions['heatmap']['yAxis']['data'] !!},
|
||||
splitArea: {
|
||||
show: false
|
||||
},
|
||||
@@ -462,7 +462,7 @@ const cTimelineOptions = {
|
||||
show: false,
|
||||
},
|
||||
timeline: {
|
||||
data: {!! json_encode($regionCapacities['region']['dates']) !!},
|
||||
data: {!! $diagramsOptions['capacity']['xAxis']['data'] !!},
|
||||
playInterval: 2000,
|
||||
axisType: 'time',
|
||||
left: 8,
|
||||
|
||||
Reference in new issue
Block a user