osb/resources/views/theme/backend/adminlte/u/payment/widgets/list.blade.php
2022-06-13 17:31:11 +10:00

70 lines
1.8 KiB
PHP

<!-- Show past 12 months payments -->
<div class="card card-dark">
<div class="card-header">
<h3 class="card-title">Past Payments</h3>
</div>
<div class="card-body">
@if(($x=$o->payments()->active()->where('payments.created_at','>',\Carbon\Carbon::now()->subMonths(12)->unix())->with(['items','account'])->get())->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->sid }}</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