Rework payment tables, enable payment editing

This commit is contained in:
Deon George
2021-07-23 17:25:26 +10:00
parent fa62a47680
commit d463239b17
19 changed files with 352 additions and 116 deletions

View File

@@ -1,6 +1,11 @@
<div class="form-group mb-0">
<label for="checkout_id">Invoices Due</label>
@if(($x=$o->invoices()->where('active',TRUE)->orderBy('due_date')->with(['items.taxes','paymentitems.payment','account'])->get()->where('due','>',0))->count())
@if(($x=$o->invoices()
->where('active',TRUE)
->orderBy('due_date')
->with(['items.taxes','paymentitems.payment','account'])
->get()
->filter(function($item) use ($pid) { return $item->due > 0 || $item->payments->search(function($item) use ($pid) { return $item->id == $pid; }) !== FALSE; }))->count())
<table class="table table-hover">
<thead>
<tr>
@@ -9,7 +14,7 @@
<th>Date Due</th>
<th>Total</th>
<th>Due</th>
<th>Apply</th>
<th class="text-right">Apply</th>
</tr>
</thead>
@@ -21,7 +26,9 @@
<td>{{ $io->due_date->format('Y-m-d') }}</td>
<td>{{ number_format($io->total,2) }}</td>
<td>{{ number_format($io->due,2) }}</td>
<td><input type="text" name="invoices[{{ $io->id }}]"></td>
<td class="text-right">
<input type="text" class="text-right" name="invoices[{{ $io->id }}]" value="{{ ($x=$io->paymentitems->filter(function($item) use ($pid) { return $item->payment_id == $pid; })) ? $x->sum('alloc_amt') : 0}}">
</td>
</tr>
@endforeach
</tbody>