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,77 @@
<!-- $o=App\Models\User -->
<!-- Show active services -->
<div class="card card-dark">
<div class="card-header">
<h3 class="card-title">Active Services</h3>
</div>
<div class="card-body">
@if ($o->services->count())
<table class="table table-striped table-hover" id="services_active">
<thead>
<tr>
<th>ID</th>
<th>Category</th>
<th>Service</th>
<th>Product</th>
<th>Next Invoice</th>
</tr>
</thead>
<tbody>
@foreach ($o->services as $oo)
<tr>
<td><a href="{{ url('u/service',[$oo->id]) }}">{{ $oo->sid }}</a></td>
<td>{{ $oo->product->category_name }}</td>
<td>{{ $oo->name_short }}</td>
<td>{{ $oo->product->name }}</td>
<td>{{ $oo->external_billing ? '-' : $oo->invoice_next->format('Y-m-d') }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th>Count {{ $o->services->count() }}</th>
<th colspan="4">&nbsp;</th>
</tr>
</tfoot>
</table>
@else
<p>No services active</p>
@endif
</div>
</div>
@section('page-scripts')
@css(datatables,bootstrap4|rowgroup)
@js(datatables,bootstrap4|rowgroup)
<style>
table.dataTable tr.dtrg-group.dtrg-end.dtrg-level-0 {
font-size: 75%;
background-color: #eeeeee !important;
}
table.dataTable tr.dtrg-group.dtrg-end.dtrg-level-0 td {
background-color: #fefefe !important;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$('#services_active').DataTable({
order: [[1,'asc'],[2,'asc']],
rowGroup: {
dataSrc: 1,
endRender: function ( rows, group ) {
return rows.count()+' x ' + group;
},
},
});
$('#services_active tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
});
</script>
@append

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

View File

@@ -0,0 +1,50 @@
<!-- $o = App\Models\Service\Domain::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">Domain Details</h3>
</div>
<div class="card-body bg-gray-dark">
<table class="table table-sm">
<tr>
<th>Domain Name</th>
<td>{{ $o->service->name }}</td>
</tr>
<tr>
<th>Registrar URL</th>
<td><a href="{{ $o->registrar->whitelabel_url }}" target="_blank" class="text-white">{{ $o->registrar->whitelabel_url }}</a></td>
</tr>
<tr>
<th>Registrar Username</th>
<td>{{ $o->registrar_username }}</td>
</tr>
<tr>
<th>Registrar Password</th>
<td>{{ $o->registrar_password }}</td>
</tr>
<tr>
<th>Domain Auth</th>
<td>{{ $o->registrar_auth_password }}</td>
</tr>
@if($o->service_connect_date)
<tr>
<th>Connected</th>
<td>{{ $o->service_connect_date->format('Y-m-d') }}</td>
</tr>
@endif
<tr>
<th>Expires</th>
<td>{{ $o->expire_at->format('Y-m-d') }} <small>({{ $o->expire_at->diffInMonths() }} months) </small></td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,179 @@
<div class="row">
<div class="col-6">
<div class="form-group has-validation">
<label for="domain_name">Domain Name</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-globe-asia"></i></span>
</div>
<input type="text" class="form-control text-right @error('domain.domain_name') is-invalid @enderror" id="domain_name" name="domain[domain_name]" placeholder="Domain Name..." value="{{ old('domain.domain_name',$o->domain_name) }}" required>
<div class="input-group-append">
<span class="input-group-text">.</span>
</div>
<select class="form-control" id="domain_tld_id" name="domain[domain_tld_id]">
@foreach(\App\Models\DomainTld::active()->orderBy('name')->get() as $oo)
<option value="{{ $oo->id }}" @if($oo->id == old('domain.domain_tld_id',$o->domain_tld_id))selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain.domain_name')
{{ $message }}
@else
Domain Name is required.
@enderror
</span>
</div>
<span class="input-helper">Licensed Domain Name.</span>
</div>
</div>
<div class="col-3">
<div class="form-group has-validation">
<label for="domain_expire">Expiry</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control @error('domain.domain_expire') is-invalid @enderror" id="domain_expire" name="domain[domain_expire]" value="{{ old('domain.domain_expire',$o->service_expire->format('Y-m-d')) }}" required>
<span class="invalid-feedback" role="alert">
@error('domain.domain_expire')
{{ $message }}
@else
Domain Expiry is required.
@enderror
</span>
</div>
<span class="input-helper">Date Domain Expires.</span>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-group has-validation">
<label for="domain_registrar_id">Registrar</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-handshake"></i></span>
</div>
<select class="form-control @error('domain.domain_registrar_id') is-invalid @enderror" id="domain_registrar_id" name="domain[domain_registrar_id]">
<option></option>
@foreach(\App\Models\DomainRegistrar::active()->orderBy('name')->get() as $oo)
<option value="{{ $oo->id }}" @if($oo->id == old('domain.domain_registrar_id',$o->domain_registrar_id))selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain.domain_registrar_id')
{{ $message }}
@else
Domain Registrar is required.
@enderror
</span>
</div>
<span class="input-helper">Domain Name Registrar.</span>
</div>
</div>
<div class="col-3">
<div class="form-group has-validation">
<label for="registrar_account">Registrar Account</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-user"></i></span>
</div>
<input type="text" class="form-control @error('domain.registrar_account') is-invalid @enderror" id="registrar_account" name="domain[registrar_account]" value="{{ old('domain.registrar_account',$o->registrar_account) }}">
<span class="invalid-feedback" role="alert">
@error('domain.registrar_account')
{{ $message }}
@else
Registrar Account ID is required.
@enderror
</span>
</div>
<span class="input-helper">Registrar Account ID.</span>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-group has-validation">
<label for="registrar_ns">DNS Location</label>
<div class="input-group flex-nowrap">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-project-diagram"></i></span>
</div>
<select class="form-control @error('domain.registrar_ns') is-invalid @enderror" id="registrar_ns" name="domain[registrar_ns]">
@foreach(\App\Models\Service\Domain::select('registrar_ns')->distinct()->get() as $oo)
<option value="{{ $oo->registrar_ns }}" @if($oo->registrar_ns == old('domain.registrar_ns',$o->registrar_ns))selected @endif>{{ $oo->registrar_ns }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain.registrar_ns')
{{ $message }}
@else
DNS Details is required.
@enderror
</span>
</div>
<span class="input-helper">Domain DNS details.</span>
</div>
</div>
<div class="col-3">
<div class="form-group has-validation">
<label for="registrar_username">Registrar Username</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-user"></i></span>
</div>
<input type="text" class="form-control @error('domain.registrar_username') is-invalid @enderror" id="registrar_username" name="domain[registrar_username]" value="{{ old('domain.registrar_username',$o->registrar_username) }}">
<span class="invalid-feedback" role="alert">
@error('domain.registrar_username')
{{ $message }}
@else
Registrar Username is required.
@enderror
</span>
</div>
<span class="input-helper">Registrar Username ID.</span>
</div>
</div>
</div>
@section('page-scripts')
@css(select2)
@js(select2,autofocus)
<style>
.select2-selection.select2-selection--single {
height: calc(2.25rem + 2px) !important;
}
.select2.select2-container.select2-container--default {
display: flex;
flex: 1 1 auto;
}
.select2.select2-container.select2-container--default .selection {
width: 100%;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
// @todo This is taking up too much width
//$('#domain_tld_id').select2();
$('#domain_registrar_id').select2({
dropdownAutoWidth: true,
});
$('#registrar_ns').select2({
dropdownAutoWidth: true,
width: 'style',
tags: true,
});
});
</script>
@append

View File

@@ -0,0 +1,43 @@
<!-- $o = App\Models\Service\Email::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">Email Hosting Details</h3>
</div>
<div class="card-body bg-gray-dark">
<table class="table table-sm">
<tr>
<th>Domain Name</th>
<td>{{ $o->service->name }}</td>
</tr>
@if($o->service_connect_date)
<tr>
<th>Connected</th>
<td>{{ $o->service_connect_date->format('Y-m-d') }}</td>
</tr>
@endif
@if ($o->inContract())
<tr>
<th>Contract Term</th>
<td>{{ $o->service->contract_term }} months</td>
</tr>
<tr>
<th>Contract End</th>
<td>{{ $o->service->contract_end->format('Y-m-d') }} <small>({{ $o->service->contract_end->diffForHumans() }})</small></td>
</tr>
@endif
<tr>
<th>Cancel Notice</th>
<td>Before renewal</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,156 @@
<!-- o = App\Models\Service\Email::class -->
<div class="row">
<!-- DOMAIN NAME -->
<div class="col-6">
<div class="form-group has-validation">
<label for="domain_name">Email Domain Name</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-globe-asia"></i></span>
</div>
<input type="text" class="form-control col-9 text-right @error('email.domain_name') is-invalid @enderror" id="domain_name" name="email[domain_name]" placeholder="Domain Name..." value="{{ old('email.domain_name',$o->domain_name) }}" required>
<div class="input-group-append">
<span class="input-group-text">.</span>
</div>
<select class="form-control col-3" name="email[tld_id]">
@foreach(\App\Models\TLD::orderBy('name')->get() as $oo)
<option value="{{ $oo->id }}" @if($oo->id == old('email.tld_id',$o->tld_id))selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('email.domain_name')
{{ $message }}
@else
Domain Name is required.
@enderror
</span>
</div>
<span class="input-helper">Domain Name</span>
</div>
</div>
<!-- EXPIRY -->
<div class="col-3">
<div class="form-group has-validation">
<label for="expire_at">Expiry</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control @error('email.expire_at') is-invalid @enderror" id="expire_at" name="email[expire_at]" value="{{ old('email.expire_at',($o->expire_at ? $o->expire_at->format('Y-m-d') : NULL)) }}">
<span class="invalid-feedback" role="alert">
@error('email.expire_at')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Email Hosting Expires</span>
</div>
</div>
</div>
<div class="row">
<!-- ADMIN URL -->
<div class="col-9">
<div class="form-group has-validation">
<label for="admin_url">Hosting Admin URL</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fab fa-fw fa-safari"></i></span>
</div>
<input type="text" class="form-control @error('email.admin_url') is-invalid @enderror" id="admin_url" name="email[admin_url]" placeholder="Admin URL..." value="{{ old('email.admin_url',$o->admin_url) }}">
<span class="invalid-feedback" role="alert">
@error('email.admin_url')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Admin URL</span>
</div>
</div>
<!-- ACCOUNTS -->
<div class="col-3">
<div class="form-group has-validation">
<label for="accounts">Accounts</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-hashtag"></i></span>
</div>
<input type="text" class="form-control @error('email.accounts') is-invalid @enderror" id="accounts" name="email[accounts]" placeholder="Accounts" value="{{ old('email.accounts',$o->accounts) }}">
<span class="invalid-feedback" role="alert">
@error('email.accounts')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper"># Accounts</span>
</div>
</div>
</div>
<div class="row">
<!-- ADMIN USER -->
<div class="col-6">
<div class="form-group has-validation">
<label for="admin_user">Admin User</label>
<div class="input-group flex-nowrap">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-user"></i></span>
</div>
<input type="text" class="form-control @error('email.admin_user') is-invalid @enderror" id="admin_user" name="email[admin_user]" placeholder="Admin USER" value="{{ old('email.admin_user',$o->admin_user) }}">
<span class="invalid-feedback" role="alert">
@error('email.admin_user')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Admin USER</span>
</div>
</div>
<!-- ADMIN PASS -->
<div class="col-6">
<div class="form-group has-validation">
<label for="admin_pass">Admin Pass</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-lock"></i></span>
</div>
<input type="text" class="form-control @error('email.admin_pass') is-invalid @enderror" id="admin_pass" name="email[admin_pass]" value="{{ old('email.admin_pass',$o->admin_pass) }}">
<span class="invalid-feedback" role="alert">
@error('email.admin_pass')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Admin PASSWORD</span>
</div>
</div>
</div>
@section('page-scripts')
@css(select2)
@js(select2,autofocus)
<style>
.select2-selection.select2-selection--single {
height: calc(2.25rem + 2px) !important;
}
.select2.select2-container.select2-container--default {
display: flex;
flex: 1 1 auto;
}
.select2.select2-container.select2-container--default .selection {
width: 100%;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
// @todo This is taking up too much width
//$('#tld_id').select2();
});
</script>
@append

View File

@@ -0,0 +1,57 @@
<!-- $o = App\Models\Service\Host::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">Hosting Details</h3>
</div>
<div class="card-body bg-gray-dark">
<table class="table table-sm">
<tr>
<th>Domain Name</th>
<td>{{ $o->service->name }}</td>
</tr>
@if($o->provider->whitelabel_url)
<tr>
<th>Hosting URL</th>
<td><a href="{{ $o->provider->whitelabel_url }}" target="_blank" class="text-white">{{ $o->provider->whitelabel_url }}</a></td>
</tr>
<tr>
<th>Hosting Username</th>
<td>{{ $o->host_username }}</td>
</tr>
<tr>
<th>Hosting Password</th>
<td>{{ $o->host_password }}</td>
</tr>
@endif
@if($o->service_connect_date)
<tr>
<th>Connected</th>
<td>{{ $o->service_connect_date->format('Y-m-d') }}</td>
</tr>
@endif
@if ($o->inContract())
<tr>
<th>Contract Term</th>
<td>{{ $o->service->contract_term }} months</td>
</tr>
<tr>
<th>Contract End</th>
<td>{{ $o->service->contract_end->format('Y-m-d') }} <small>({{ $o->service->contract_end->diffForHumans() }})</small></td>
</tr>
@endif
<tr>
<th>Cancel Notice</th>
<td>Before renewal</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,139 @@
<!-- o = App\Models\Service\Host::class -->
<div class="row">
<!-- DOMAIN NAME -->
<div class="col-6">
<div class="form-group has-validation">
<label for="domain_name">Domain Name</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-globe-asia"></i></span>
</div>
<input type="text" class="form-control col-9 text-right @error('host.domain_name') is-invalid @enderror" id="domain_name" name="host[domain_name]" placeholder="Domain Name..." value="{{ old('host.domain_name',$o->domain_name) }}" required>
<div class="input-group-append">
<span class="input-group-text">.</span>
</div>
<select class="form-control" id="domain_tld_id" name="host[domain_tld_id]">
@foreach(\App\Models\DomainTld::active()->orderBy('name')->get() as $oo)
<option value="{{ $oo->id }}" @if($oo->id == old('domain.domain_tld_id',$o->domain_tld_id))selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('host.domain_name')
{{ $message }}
@else
Domain Name is required.
@enderror
</span>
</div>
<span class="input-helper">Domain Name</span>
</div>
</div>
<!-- EXPIRY -->
<div class="col-3">
<div class="form-group has-validation">
<label for="host_expire">Expiry</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control @error('host.host_expire') is-invalid @enderror" id="host_expire" name="host[host_expire]" value="{{ old('host.host_expire',($o->host_expire ? $o->host_expire->format('Y-m-d') : NULL)) }}">
<span class="invalid-feedback" role="alert">
@error('host.host_expire')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Hosting Expires</span>
</div>
</div>
</div>
<div class="row">
{{--
<!-- ADMIN URL -->
<div class="col-9">
<div class="form-group has-validation">
<label for="admin_url">Hosting Admin URL</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fab fa-fw fa-safari"></i></span>
</div>
<input type="text" class="form-control @error('host.admin_url') is-invalid @enderror" id="admin_url" name="host[admin_url]" placeholder="Admin URL..." value="{{ old('host.admin_url',$o->admin_url) }}">
<span class="invalid-feedback" role="alert">
@error('host.admin_url')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Admin URL</span>
</div>
</div>
--}}
</div>
<div class="row">
<!-- ADMIN USER -->
<div class="col-6">
<div class="form-group has-validation">
<label for="host_username">Admin User</label>
<div class="input-group flex-nowrap">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-user"></i></span>
</div>
<input type="text" class="form-control @error('host.host_username') is-invalid @enderror" id="host_username" name="host[host_username]" placeholder="Admin USER" value="{{ old('host.host_username',$o->host_username) }}">
<span class="invalid-feedback" role="alert">
@error('host.host_username')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Admin USER</span>
</div>
</div>
<!-- ADMIN PASS -->
<div class="col-6">
<div class="form-group has-validation">
<label for="host_password">Admin Pass</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-fw fa-lock"></i></span>
</div>
<input type="text" class="form-control @error('host.host_password') is-invalid @enderror" id="host_password" name="host[host_password]" value="{{ old('host.host_password',$o->host_password) }}">
<span class="invalid-feedback" role="alert">
@error('host.host_password')
{{ $message }}
@enderror
</span>
</div>
<span class="input-helper">Admin PASSWORD</span>
</div>
</div>
</div>
@section('page-scripts')
@css(select2)
@js(select2,autofocus)
<style>
.select2-selection.select2-selection--single {
height: calc(2.25rem + 2px) !important;
}
.select2.select2-container.select2-container--default {
display: flex;
flex: 1 1 auto;
}
.select2.select2-container.select2-container--default .selection {
width: 100%;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
// @todo This is taking up too much width
//$('#domain_tld_id').select2();
});
</script>
@append

View File

@@ -0,0 +1,88 @@
<!-- $o = App\Models\Service -->
<div class="card">
@if($o->external_billing)
<div class="ribbon-wrapper ribbon-lg">
<div class="ribbon bg-danger">
EXTERNAL BILLING
</div>
</div>
@endif
<div class="card-header bg-light">
<h3 class="card-title">Service Information</h3>
</div>
<div class="card-body bg-light">
<table class="table table-sm">
<tr>
<th>Account</th>
<td><a href="{{url('u/home',$o->account->user_id)}}">{{ $o->account->sid }}</a></td>
</tr>
<tr>
<th>Status</th>
<td>{!! $o->status_html !!}</td>
</tr>
@if ($o->order_status == 'ORDER-SENT')
<tr>
<th>Order Reference</th>
<td>{{ $o->order_info_reference ?? '' }}</td>
</tr>
@endif
@if ($o->start_at AND $o->isPending())
<tr>
<th>Pending Connection</th>
<td>{{ $o->start_at->format('Y-m-d') }}</td>
</tr>
@endif
@if ($o->stop_at)
<tr>
<th>Cancellation Date</th>
<td>{{ $o->stop_at->format('Y-m-d') }}</td>
</tr>
@endif
@if (($o->active OR $o->isPending()) AND ! $o->external_billing)
<tr>
<th>Billed</th>
<td>{{ $o->billing_period }}</td>
</tr>
@if($o->active AND $o->invoice_to)
<tr>
<th>Invoiced To</th>
<td>{{ $o->invoice_to->format('Y-m-d') }}</td>
</tr>
@if($o->paid_to)
<tr>
<th>Paid Until</th>
<td>{{ $o->paid_to->format('Y-m-d') }}</td>
</tr>
@endif
@endif
<tr>
<th>Next Invoice</th>
<td>@if ($o->suspend_billing)<strike>@endif{{ $o->invoice_next->format('Y-m-d') }}@if ($o->suspend_billing)</strike> <strong>SUSPENDED</strong>@endif</td>
</tr>
<tr>
<th>Next Estimated Invoice</th>
<td>${{ number_format($o->next_invoice_items(TRUE)->sum('total'),2) }} <sup>*</sup></td>
</tr>
<tr>
<th>Payment Method</th>
<td>@if ($o->billing)Direct Debit @else Invoice @endif</td>
</tr>
@elseif($o->wasCancelled())
<tr>
<th>Cancelled</th>
<!-- @todo This should show the cancelled date -->
<td>{!! $o->stop_at ? $o->stop_at->format('Y-m-d') : ($o->paid_to ? $o->paid_to->format('Y-m-d') : '').'<sup>*</sup>' !!}</td>
</tr>
@endif
</table>
</div>
@if($o->active OR $o->isPending())
<div class="card-footer sm">
<strong><sup>*</sup>NOTE:</strong> Estimated Invoice does not include any setup, connection nor all current billing cycle usage charges.
</div>
@endif
</div>

View File

@@ -0,0 +1,96 @@
<!-- $o = Service::class -->
<table class="table table-sm">
<thead>
<tr>
<th>&nbsp;</th>
@if (($s=$o->supplied) && $s->exists)
<th>{{ $s->supplier_detail->supplier->name }}</th>
@endif
<th>Us</th>
@if ($s->exists)
<th>&nbsp;</th>
@endif
</tr>
</thead>
<tbody>
<tr>
<th>Product</th>
@if ($s->exists)
<td>#{{ $s->id }}: {{ $s->name }}</td>
@endif
<td>#{{ $o->product->id }}: {{ $o->product->name }}</td>
@if ($s->exists)
<td>{{ $o->product->category_name }}</td>
@endif
</tr>
<tr>
<th>Setup</th>
@if ($s->exists)
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->setup_cost,$o->account->taxes),2) }}</td>
<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->setup_charge,$o->account->taxes),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@else
<td>-</td>
@endif
</tr>
<tr>
<th>Billed</th>
@if ($s->exists)
<td>{{ $s->billing_interval_string }}</td>
@endif
<td>{{ $o->billing_interval_string }}</td>
@if ($s->exists)
<td>&nbsp;</td>
@endif
</tr>
<tr>
<th>Billing Price</th>
@if ($s->exists)
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,$o->product->billing_interval),$o->account->taxes),2) }}</td>
@endif
<td>${{ number_format($b=$o->billing_charge,2) }}</td>
@if ($s->exists)
<td>{!! markup($a,$b) !!}</td>
@endif
</tr>
<tr>
<th>Monthly Price</th>
@if ($s->exists)
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->base_cost*\App\Models\Invoice::billing_change($s->billing_interval,1),$o->account->taxes),2) }}</td>
@endif
<td>${{ number_format($b=$o->billing_monthly_price,2) }}</td>
@if ($s->exists)
<td>{!! markup($a,$b) !!}</td>
@endif
</tr>
<tr>
<th>Contract</th>
@if ($s->exists)
<td>{{ $s->contract_term }} months</td>
@endif
<td>{{ $o->contract_term }} months</td>
@if ($s->exists)
<td>&nbsp;</td>
@endif
</tr>
<tr>
<th>Min Price</th>
@if ($s->exists)
<td>${{ number_format($a=\App\Models\Tax::tax_calc($s->min_cost,$o->account->taxes),2) }}</td>
<td>${{ number_format($b=\App\Models\Tax::tax_calc($o->product->getMinChargeAttribute($o->billing_interval),$o->account->taxes),2) }}</td>
<td>{!! markup($a,$b) !!}</td>
@else
<td>-</td>
@endif
</tr>
</tbody>
</table>
@php
function markup($a,$b) {
return ($a > $b)
? sprintf('<span class="badge bg-danger>">(%3.1f%%)</span>',$a ? ($b-$a)/($b ?: 1)*100 : 100)
: sprintf('<span class="badge">%3.1f%%</span>',$a ? ($b-$a)/($b ?: 1)*100 : ($b ? 100: 0));
}
@endphp

View File

@@ -0,0 +1,13 @@
<table class="table">
<tr>
<th colspan="3">{{ $o->name }}</th><th class="text-right">${{ number_format(($x=$o->next_invoice_items(TRUE))->sum('total'),2) }}</th>
</tr>
@foreach ($x as $io)
<tr>
<td class="pt-0 pb-1">&nbsp;</td>
<td class="pt-0 pb-1">{{ $io->item_type_name }}</td>
<td class="text-right pt-0 pb-1">${{ number_format($io->total,2) }}</td>
</tr>
@endforeach
</table>

View File

@@ -0,0 +1,80 @@
<!-- Show client movements -->
<div class="card card-dark">
<div class="card-header">
<h3 class="card-title">Service Movements</h3>
</div>
<div class="card-body">
@if (($x=$user->client_service_movements())->count())
<table class="table table-striped table-hover" id="service_movements">
<thead>
<tr>
<th>ID</th>
<th>Account</th>
<th>Name</th>
<th>Status</th>
<th>Product</th>
</tr>
</thead>
<tbody>
@foreach ($x as $o)
<tr>
<td><a href="{{ url('u/service',$o->id) }}">{{ $o->sid }}</a></td>
<td>{{ $o->account->name }}</td>
<td>{{ $o->name_short }}</td>
<td>
{{ $o->status }}
@switch($o->status)
@case ('ORDER-SENT')
<br>(#{{ $o->order_info_reference }})
@break;
@case ('PROVISION-PLANNED')
<br>({{ ($xx=$o->start_at) ? $xx->format('Y-m-d') : 'No Date' }})
@break;
@case ('CANCEL-PENDING')
<br>({{ ($xx=$o->stop_at) ? $xx->format('Y-m-d') : 'No Date' }})
@break;
@endswitch
</td>
<td>{{ $o->product->name }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th>Count {{ $x->count() }}</th>
<th colspan="4">&nbsp;</th>
</tr>
</tfoot>
</table>
@else
<p>No Service Movements</p>
@endif
</div>
</div>
@section('page-scripts')
@css(datatables,bootstrap4|rowgroup)
@js(datatables,bootstrap4|rowgroup)
<script type="text/javascript">
$(document).ready(function() {
$('#service_movements').DataTable( {
order: [3, 'asc'],
rowGroup: {
dataSrc: 1,
startRender: function ( rows, group ) {
return group+': '+rows.count()+' Services';
},
},
orderFixed: [1, 'asc']
});
$('#service_movements tbody').on('click','tr', function () {
$(this).toggleClass('selected');
});
});
</script>
@append

View File

@@ -0,0 +1,69 @@
<!-- $o = App\Models\Service\Phone::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">Phone 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
<!-- @todo -->
@if($o->technology)
<tr>
<th>Technology</th>
<td>{{ $o->technology }}</td>
</tr>
@endif
<!-- @todo -->
@if($o->service->product->type)
<tr>
<th>Usage</th>
<td>{{ $o->service->product->type->allowance_string() }} Included Calls</td>
</tr>
@endif
@if ($o->inContract())
<tr>
<th>Contract</th>
<td>{{ $o->contract_term }} months <small>({{ ($x=$o->service_contract_date->addMonths($o->contract_term))->diffForHumans() }})</small></td>
</tr>
<tr>
<th>Contract End</th>
<td>{{ $x->format('Y-m-d') }}</td>
</tr>
@endif
<tr>
<th>Cancel Notice</th>
<td>1 month @if($o->inContract())<small>(after {{ $o->service_contract_date->addMonths($o->contract_term-1)->format('Y-m-d') }})</small>@endif</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,72 @@
<!-- $o = App\Models\Service\Phone::class -->
<div class="form-group row">
<label for="service_number" 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="phone[service_number]" value="{{ $o->service_number ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="service_username" 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="phone[service_username]" value="{{ $o->service_username ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="service_password" 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="phone[service_password]" value="{{ $o->service_password ?? '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="connect_at" 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="phone[connect_at]" value="{{ $o->connect_at ? $o->connect_at->format('Y-m-d') : '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="expire_at" class="col-sm-3 col-form-label text-right">Service Expires (Contracted Till)</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="phone[expire_at]" value="{{ $o->expire_at ? $o->expire_at->format('Y-m-d') : '' }}">
</div>
</div>
</div>
<div class="form-group row">
<label for="start_at" 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,26 @@
<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">SSL Details</h3>
</div>
<div class="card-body bg-gray-dark">
<table class="table table-sm">
<tr>
<th>Cert</th>
<td>{{ $o->name_detail }}</td>
</tr>
<tr>
<th>Cancel Notice</th>
<td>Before renewal</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,19 @@
<div class="row">
<div class="col-12">
<h4>Update Service details</h4>
<form class="g-0 needs-validation" method="POST" action="{{ url('a/service/edit',[$o->id]) }}">
@csrf
@includeIf('service.widget.'.$o->product->category.'.update',['o'=>$o->type])
<div class="row">
<div class="col-12">
@can('wholesaler')
<button type="submit" name="submit" class="btn btn-success mr-0 float-right">@if ($site->exists)Save @else Add @endif</button>
@endcan
</div>
</div>
</form>
</div>
</div>