Andrew Wallo 4 mēnešus atpakaļ
vecāks
revīzija
1f56c1bbcd

+ 1
- 1
app/Filament/Company/Resources/Sales/InvoiceResource.php Parādīt failu

@@ -497,7 +497,7 @@ class InvoiceResource extends Resource
497 497
                                     'client_id' => ['value' => $record->client_id],
498 498
                                     'currency_code' => ['value' => $record->currency_code],
499 499
                                 ],
500
-                                'invoice_id' => $record->id,
500
+                                'invoiceId' => $record->id,
501 501
                             ]))
502 502
                             ->openUrlInNewTab(false),
503 503
                     ])->dropdown(false),

+ 21
- 4
app/Filament/Company/Resources/Sales/InvoiceResource/Pages/RecordPayments.php Parādīt failu

@@ -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();

Notiek ielāde…
Atcelt
Saglabāt