Consolidate service resources into a top level services/ directory

This commit is contained in:
Deon George
2022-07-29 17:45:17 +10:00
parent 7f6df8d032
commit 97f5c84f23
36 changed files with 66 additions and 64 deletions

View File

@@ -0,0 +1,54 @@
<div class="form-group row">
<label for="reference" class="col-sm-2 col-form-label text-right">Product</label>
<div class="col-sm-6">
<div class="input-group">
<select class="form-control" id="product_id" name="product_id">
<option value="">&nbsp;</option>
@php
$po = $selected = NULL;
@endphp
@foreach (\App\Models\Product::active()->get()->filter(function($item) { return $item->type && (get_class($item->type) == 'App\Models\Product\Broadband'); })->sortBy('name') as $o)
@php
if ($o->id == old('product_id')) {
$selected = 'selected';
$po = $o;
} else {
$selected = NULL;
}
@endphp
<option value="{{ $o->id }}" {{ $selected }}>{{ $o->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="offset-2 col-10">
<strong>NOTE</strong>: A plan setup fee is normally not applicable to Broadband changes, but a plan change fee normally is.
</div>
</div>
@section('page-scripts')
<script>
$(document).ready(function() {
$('select[name=product_id]').change(function() {
// If we select a blank, then dont continue
if (this.value == 0)
return false;
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
dataType: "html",
cache: true,
url: '{{ url('product_info') }}'+'/'+$(this).val(),
timeout: 5000,
error: function(x) {
alert("Failed to submit");
},
success: function(data) {
$("div[id=product_info]").empty().append(data);
}
});
});
});
</script>
@append

View File

@@ -0,0 +1,78 @@
<!-- $o = App\Models\Service\Broadband::class -->
<div class="card">
@if($o->service->isPending())
<div class="ribbon-wrapper ribbon-lg">
<div class="ribbon bg-warning">
Pending
</div>
</div>
@endif
<div class="card-header bg-gray-dark">
<h3 class="card-title">Broadband Details</h3>
</div>
<div class="card-body bg-gray-dark">
<table class="table table-sm">
<tr>
<th>Address</th>
<td>{{ $o->service_address }}</td>
</tr>
<tr>
<th>Service Number</th>
<td>{{ $o->service_number }}</td>
</tr>
<tr>
<th>Service Username</th>
<td>{{ $o->service_username }}</td>
</tr>
<tr>
<th>Service Password</th>
<td>{{ $o->service_password }}</td>
</tr>
@if($o->connect_at)
<tr>
<th>Connected</th>
<td>{{ $o->connect_at->format('Y-m-d') }}</td>
</tr>
@endif
@if($x=$o->technology)
<tr>
<th>Technology</th>
<td>{{ $x }}</td>
</tr>
@endif
<tr>
<th>Speed</th>
<td>{{ $o->supplied()->speed }} Mbps</td>
</tr>
<!-- @todo -->
<tr>
<th>Traffic</th>
<td>{{ $o->service->offering->allowance_string() }} GB @if(FALSE)(YY GB used month)@endif</td>
</tr>
<tr>
<th>IP4 Address</th>
<td>{{ $o->ipaddress ?: 'Dynamic' }}</td>
</tr>
<tr>
<th>IP6 Address</th>
<td>{{ $o->ip6address ?: '-' }}</td>
</tr>
@if ($o->inContract())
<tr>
<th>Contract</th>
<td>{{ $o->contract_term }} months</td>
</tr>
<tr>
<th>Contract End</th>
<td>{{ $o->service_expire->format('Y-m-d') }} <small>({{ $o->service_expire->diffForHumans() }})</small></td>
</tr>
@endif
<tr>
<th>Cancel Notice</th>
<td>1 month @if($o->inContract())<small>(after {{ $o->service_expire->subMonth()->format('Y-m-d') }})</small>@endif</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,74 @@
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Number</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-phone"></i></span>
</div>
<input type="text" class="form-control" name="broadband[service_number]" value="{{ $o->service_number ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Username</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div>
<input type="text" class="form-control" name="broadband[service_username]" value="{{ $o->service_username ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Password</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
</div>
<input type="text" class="form-control" name="broadband[service_password]" value="{{ $o->service_password ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Connect Date</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="broadband[connect_at]" value="{{ $o->connect_at ? $o->connect_at->format('Y-m-d') : '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Contract Date</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<!-- @todo We changed contract_date in the DB, what happened to it and how do we work it out now -->
<!--
<input type="date" class="form-control" name="broadband[service_contract_date]" value="{{ $o->service_contract_date ? $o->service_contract_date->format('Y-m-d') : '' }}">
-->
</div>
</div>
</div>
<div class="form-group row">
<label for="reference" class="col-sm-3 col-form-label text-right">Service Billing Start Date</label>
<div class="col-sm-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="start_at" value="{{ $o->service->start_at ? $o->service->start_at->format('Y-m-d') : '' }}">
</div>
</div>
</div>

View File

@@ -0,0 +1,92 @@
<div class="card">
<div class="card-header bg-gray-dark">
<h3 class="card-title">Broadband Traffic</h3>
</div>
<div class="card-body">
<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>
</div>
<div class="col-9">
<div id="graph"></div>
</div>
</div>
</div>
</div>
@section('page-scripts')
@js(highcharts)
<script>
const timezone = new Date().getTimezoneOffset()
Highcharts.setOptions({
global: {
timezoneOffset: timezone,
},
lang: {
thousandsSep: ','
}
});
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',
data: {!! $o->usage(30)->map(function($item) { return ['x'=>$item->date->timestamp*1000,'y'=>$item->total];}) !!}
}]
});
</script>
@append