osb/resources/views/theme/backend/adminlte/account/widget/invoice_next.blade.php

36 lines
1.1 KiB
PHP

<!-- $o=Account::class -->
@use(Carbon\Carbon)
<!-- Show next items for an invoice -->
@if(($x=$o->invoice_next())->count())
<div class="card">
<div class="card-body">
<p>The following items will be invoiced on or after <strong>{{ max($x->first()->start_at->subDays(config('osb.invoice_days')),Carbon::now())->format('Y-m-d') }}</strong></p>
<table class="table table-sm table-stripped">
<!-- Group by Service -->
@foreach ($x->groupBy('service_id') as $id => $oo)
<tr>
<td>{{ $oo->first()?->product?->category_name ?: '-' }}</td>
<td>
@if($id)
<a href="{{ url('u/service',$oo->first()->service_id) }}">{{ $oo->first()->service->name }}</a>
@else
Account Charges
@endif
</td>
<td class="text-right">${{ number_format($oo->sum('total'),2) }}</td>
</tr>
@endforeach
<tr>
<th class="text-right" colspan="2">TOTAL</th>
<th class="text-right">${{ number_format($x->sum('total'),2) }}</th>
</tr>
</table>
</div>
</div>
@else
<p>No items currently due to invoice.</p>
@endif