osb/resources/views/theme/backend/adminlte/u/payment/widgets/list.blade.php
2021-07-23 17:49:59 +10:00

73 lines
2.1 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()->where('payments.date_orig','>',\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->payment_date->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('//cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css','jq-dt-css')
@js('//cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js','jq-dt-js')
@js('//cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js','jq-dt-bs5-js','jq-dt-js')
@js('//cdn.datatables.net/rowgroup/1.1.3/js/dataTables.rowGroup.min.js','jq-dt-rowgroup-js','jq-dt-js')
@css('//cdn.datatables.net/rowgroup/1.1.3/css/rowGroup.bootstrap4.min.css','jq-dt-rowgroup-css','jq-dt-jss')
<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