|
@@ -47,8 +47,8 @@ class RecordPayments extends ListRecords
|
47
|
47
|
|
48
|
48
|
public ?int $allocationAmount = null;
|
49
|
49
|
|
50
|
|
- #[Url(as: 'invoice_id')]
|
51
|
|
- public ?int $invoiceId = null;
|
|
50
|
+ #[Url(except: '')]
|
|
51
|
+ public string $invoiceId = '';
|
52
|
52
|
|
53
|
53
|
public function getBreadcrumb(): ?string
|
54
|
54
|
{
|
|
@@ -77,8 +77,7 @@ class RecordPayments extends ListRecords
|
77
|
77
|
'currency_code' => ['value' => $preservedCurrencyCode],
|
78
|
78
|
];
|
79
|
79
|
|
80
|
|
- // Auto-fill payment amount if invoice_id is provided
|
81
|
|
- if ($invoiceId = $this->invoiceId) {
|
|
80
|
+ if ($invoiceId = (int) $this->invoiceId) {
|
82
|
81
|
$invoice = Invoice::find($invoiceId);
|
83
|
82
|
if ($invoice && $invoice->client_id == $preservedClientId) {
|
84
|
83
|
$this->paymentAmounts[$invoiceId] = $invoice->amount_due;
|
|
@@ -474,6 +473,24 @@ class RecordPayments extends ListRecords
|
474
|
473
|
return $bankAccount ?: BankAccount::where('enabled', true)->first();
|
475
|
474
|
}
|
476
|
475
|
|
|
476
|
+ public function resetTableFiltersForm(): void
|
|
477
|
+ {
|
|
478
|
+ parent::resetTableFiltersForm();
|
|
479
|
+
|
|
480
|
+ $this->invoiceId = '';
|
|
481
|
+ $this->paymentAmounts = [];
|
|
482
|
+ $this->allocationAmount = null;
|
|
483
|
+ }
|
|
484
|
+
|
|
485
|
+ public function removeTableFilters(): void
|
|
486
|
+ {
|
|
487
|
+ parent::removeTableFilters();
|
|
488
|
+
|
|
489
|
+ $this->invoiceId = '';
|
|
490
|
+ $this->paymentAmounts = [];
|
|
491
|
+ $this->allocationAmount = null;
|
|
492
|
+ }
|
|
493
|
+
|
477
|
494
|
protected function handleTableFilterUpdates(): void
|
478
|
495
|
{
|
479
|
496
|
parent::handleTableFilterUpdates();
|