Home page performance optimisations
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
<!-- $o = Account::class -->
|
||||
<!-- Show past 12 months payments -->
|
||||
<div class="card card-success">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Past Payments</h3>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if(($x=$o->payments->where('created_at','>',\Carbon\Carbon::now()->subMonths(12)))->count())
|
||||
<table class="table table-bordered w-100" id="payments_past">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Account</th>
|
||||
<th>#</th>
|
||||
<th>Received</th>
|
||||
<th class="text-right">Total</th>
|
||||
{{--<th class="text-right">Balance</th>--}}
|
||||
<th>Invoice(s)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($x as $oo)
|
||||
<tr>
|
||||
<td>{{ $oo->account->name }}</td>
|
||||
<td>{{ $oo->lid }}</td>
|
||||
<td>{{ $oo->paid_at->format('Y-m-d') }}</td>
|
||||
<td class="text-right">${{ number_format($oo->total,2) }}</td>
|
||||
{{--<td class="text-right">${{ number_format($oo->balance,2) }}</td>--}}
|
||||
<td>
|
||||
{!! join(', ',$oo->items
|
||||
->filter(function($item) { return $item->invoice_id; })
|
||||
->transform(function($item) { return sprintf('<a href="%s">%s</a>',url('u/invoice',$item->invoice_id),$item->invoice_id); })
|
||||
->toArray()) !!}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@else
|
||||
<p>No payments to list</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section('page-scripts')
|
||||
@css(datatables,bootstrap4|rowgroup)
|
||||
@js(datatables,bootstrap4|rowgroup)
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#payments_past').DataTable({
|
||||
order: [2,'desc'],
|
||||
rowGroup: {
|
||||
dataSrc: 0,
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: [0],
|
||||
visible: false,
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
$('#payments_past tbody').on('click','tr', function () {
|
||||
$(this).toggleClass('selected');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
Reference in New Issue
Block a user