Home page performance optimisations
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<!-- $o = Account::class -->
|
||||
<!-- Show outstanding invoices -->
|
||||
<div class="card card-warning">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Invoices Due</h3>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if(($list=$o->invoiceSummaryDue()->get())->count())
|
||||
@include('theme.backend.adminlte.invoice.widget.due')
|
||||
|
||||
@else
|
||||
<p>No invoice due</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,65 @@
|
||||
<!-- $o = Account::class -->
|
||||
<!-- Show past 12 months invoices -->
|
||||
<div class="card card-success">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Past Invoices</h3>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if(($list=$o->invoiceSummaryPast()->where('invoices.created_at','>=',\Carbon\Carbon::now()->subYears(2)->startOfYear())->get())->count())
|
||||
<table class="table table-bordered w-100" id="invoices_past_{{ $o->id }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Account</th>
|
||||
<th>#</th>
|
||||
<th>Issued</th>
|
||||
<th>Paid</th>
|
||||
<th class="text-right">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($list as $oo)
|
||||
<tr>
|
||||
<td>{{ $oo->account->name }}</td>
|
||||
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->lid }}</a></td>
|
||||
<td>{{ $oo->created_at->format('Y-m-d') }}</td>
|
||||
<td>{{ $oo->_paid_at?->format('Y-m-d') }}</td>
|
||||
<td class="text-right">${{ number_format($oo->_total,2) }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@else
|
||||
<p>No invoices to list</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section('page-styles')
|
||||
@css(datatables,bootstrap4|rowgroup)
|
||||
@append
|
||||
|
||||
@section('page-scripts')
|
||||
@js(datatables,bootstrap4|rowgroup)
|
||||
|
||||
<script type="text/javascript">
|
||||
@if ($list->count())
|
||||
$(document).ready(function() {
|
||||
$('#invoices_past_{{ $o->id }}').DataTable({
|
||||
order: [[2,'desc'],[0,'asc']],
|
||||
rowGroup: {
|
||||
dataSrc: 0,
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: [0],
|
||||
visible: false,
|
||||
}
|
||||
],
|
||||
});
|
||||
});
|
||||
@endif
|
||||
</script>
|
||||
@append
|
@@ -0,0 +1,72 @@
|
||||
<!-- $o = Account::class -->
|
||||
<!-- Show active services -->
|
||||
<div class="card card-light">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Active Services</h3>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if (($x=$o->services->where('active',TRUE))->count())
|
||||
<table class="table table-striped table-hover w-100" id="services_active_{{ $ao->id }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Category</th>
|
||||
<th>Service</th>
|
||||
<th>Product</th>
|
||||
<th>Next Invoice</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($x as $so)
|
||||
<tr>
|
||||
<td><a href="{{ url('u/service',[$so->id]) }}">{{ $so->sid }}</a></td>
|
||||
<td>{{ $so->product->category_name }}</td>
|
||||
<td>{{ $so->name_short }}</td>
|
||||
<td>{{ $so->product->name }}</td>
|
||||
<td>{{ $so->external_billing ? '-' : $so->invoice_next->format('Y-m-d') }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Count {{ $x->count() }}</th>
|
||||
<th colspan="4"> </th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
@else
|
||||
<p>No services active</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section('page-styles')
|
||||
@css(datatables,bootstrap4|rowgroup)
|
||||
@append
|
||||
|
||||
@section('page-scripts')
|
||||
@js(datatables,bootstrap4|rowgroup)
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#services_active_{{ $ao->id }}').DataTable({
|
||||
order: [[1,'asc'],[2,'asc']],
|
||||
rowGroup: {
|
||||
dataSrc: 1,
|
||||
endRender: function ( rows, group ) {
|
||||
return rows.count()+' x ' + group;
|
||||
},
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: [1],
|
||||
visible: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
@@ -0,0 +1,62 @@
|
||||
@if(Auth::user()->isReseller() && $o->my_accounts->count() <= 2 && $o->my_accounts->pluck('providers')->flatten()->count())
|
||||
<div class="col-12 col-sm-4 col-md-2">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-dark elevation-1"><i class="fas fa-file-invoice"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Accounting</span>
|
||||
@foreach ($o->my_accounts as $ao)
|
||||
@foreach($ao->providers as $po)
|
||||
<span class="info-box-number"><a href="{{ url(($po->api_class())::url().'/customerdetail?nameId='.$po->pivot->ref) }}" target="{{ $po->name }}">{{ ucfirst($po->name) }}</a></span>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($o->accounts->count() > 1)
|
||||
<div class="col-12 col-sm-4 col-md-2">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-primary elevation-1"><i class="fas fa-user"></i></span>
|
||||
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Linked Accounts</span>
|
||||
<span class="info-box-number">{{ number_format($o->my_accounts->count()) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="col-12 col-sm-4 col-md-2">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-info"><i class="fas fa-clone"></i></span>
|
||||
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Active Services</span>
|
||||
<!-- @todo This should count of inactive services too -->
|
||||
<span class="info-box-number">{{ $o->services->count() }} <small>/{{ $o->services->count() }}</small></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-4 col-md-2">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-danger"><i class="fas fa-dollar-sign"></i></span>
|
||||
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Account Balance</span>
|
||||
<span class="info-box-number"><small>$</small> {{ number_format(($x=$o->accounts->map(fn($item)=>$item->invoiceSummaryDue()->get()->pluck('_balance'))->flatten())->sum(),2) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-4 col-md-2">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-dark"><i class="fas fa-hashtag"></i></span>
|
||||
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Invoices Due</span>
|
||||
<span class="info-box-number">{{ $x->count() }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user