2022-08-01 11:06:57 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-3">
|
|
|
|
<table class="table table-sm">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Period</th>
|
|
|
|
<th class="text-right">Traffic <small>(GB)</small></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach ($o->usage_summary(6) as $key => $oo)
|
|
|
|
<tr>
|
|
|
|
<td>{{ $key }}</td>
|
|
|
|
<td class="text-right">{{ number_format($oo/1024,2) }}</td>
|
|
|
|
</tr>
|
|
|
|
@endforeach
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2021-02-17 13:22:50 +00:00
|
|
|
</div>
|
|
|
|
|
2022-08-01 11:06:57 +00:00
|
|
|
<div class="col-9">
|
|
|
|
<div id="graph"></div>
|
2021-02-17 13:22:50 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@section('page-scripts')
|
2021-12-20 03:08:00 +00:00
|
|
|
@js(highcharts)
|
|
|
|
|
2021-02-17 13:22:50 +00:00
|
|
|
<script>
|
2021-03-12 10:08:40 +00:00
|
|
|
const timezone = new Date().getTimezoneOffset()
|
|
|
|
|
|
|
|
Highcharts.setOptions({
|
|
|
|
global: {
|
2021-03-16 00:30:37 +00:00
|
|
|
timezoneOffset: timezone,
|
|
|
|
},
|
|
|
|
lang: {
|
|
|
|
thousandsSep: ','
|
2021-03-12 10:08:40 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-02-17 13:22:50 +00:00
|
|
|
Highcharts.chart('graph', {
|
|
|
|
chart: {
|
|
|
|
type: 'areaspline'
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
text: 'Usage Traffic up to {{ $o->usage(30)->max('date')->format('Y-m-d') }}'
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
layout: 'vertical',
|
|
|
|
align: 'left',
|
|
|
|
verticalAlign: 'top',
|
|
|
|
x: 150,
|
|
|
|
y: 100,
|
|
|
|
floating: true,
|
|
|
|
borderWidth: 1,
|
|
|
|
backgroundColor:
|
|
|
|
Highcharts.defaultOptions.legend.backgroundColor || '#FFFFFF'
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'datetime'
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
title: {
|
|
|
|
text: 'MB'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tooltip: {
|
|
|
|
shared: true,
|
|
|
|
valueSuffix: ' MB'
|
|
|
|
},
|
|
|
|
credits: {
|
|
|
|
enabled: false
|
|
|
|
},
|
|
|
|
plotOptions: {
|
|
|
|
areaspline: {
|
|
|
|
fillOpacity: 0.5
|
|
|
|
}
|
|
|
|
},
|
|
|
|
series: [{
|
|
|
|
name: 'Traffic',
|
2021-03-12 10:08:40 +00:00
|
|
|
data: {!! $o->usage(30)->map(function($item) { return ['x'=>$item->date->timestamp*1000,'y'=>$item->total];}) !!}
|
2021-02-17 13:22:50 +00:00
|
|
|
}]
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@append
|