osb/resources/views/theme/backend/adminlte/account/widget/invoice_past.blade.php
Deon George 5f10175b35
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 35s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Updated datatables, using @pa instead of @js/@css, using conditionalPaging in datatables
2024-07-28 21:33:30 +10:00

62 lines
1.5 KiB
PHP

<!-- $o=Account::class -->
<!-- Show past 12 months invoices -->
<div class="card card-success">
<div class="card-header p-2">
<h3 class="card-title">Past Invoices</h3>
</div>
<div class="card-body p-2">
@if(($list=$o->invoiceSummaryPast()->where('invoices.created_at','>=',\Carbon\Carbon::now()->subYears(2)->startOfYear())->get())->count())
<table class="table table-sm table-striped" 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>
@pa(datatables,rowgroup|conditionalpaging)
@section('page-scripts')
<script type="text/javascript">
@if($list->count())
$(document).ready(function() {
$('#invoices_past_{{ $o->id }}').DataTable({
conditionalPaging: true,
order: [[2,'desc'],[0,'asc']],
rowGroup: {
dataSrc: 0,
},
columnDefs: [
{
targets: [0],
visible: false,
}
],
});
});
@endif
</script>
@append