From f37b327ecfee3d45fb63df7dc8c67f4944bbbd16 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sat, 10 Oct 2026 10:38:31 +0530 Subject: [PATCH] Added duplicate panel box validation check in invoice --- app/Livewire/InvoiceDataTable.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Livewire/InvoiceDataTable.php b/app/Livewire/InvoiceDataTable.php index 0a0098e8..1e5d227e 100644 --- a/app/Livewire/InvoiceDataTable.php +++ b/app/Livewire/InvoiceDataTable.php @@ -850,7 +850,7 @@ class InvoiceDataTable extends Component if($categoryExist?->category == 'Panel Box'){ - $panelExist = PanelBoxValidation::where('panel_box_serial_number', $serialNumber)->where('panel_box_code', $itemCode)->where('panel_box_supplier', $supplier)->first(); + $panelExist = PanelBoxValidation::where('plant_id', $this->plantId)->where('panel_box_serial_number', $serialNumber)->where('panel_box_code', $itemCode)->where('panel_box_supplier', $supplier)->first(); if(!$panelExist){ Notification::make() @@ -864,6 +864,22 @@ class InvoiceDataTable extends Component return; } } + if($categoryExist?->category == 'Panel Box'){ + + $panelExistInvoice = InvoiceValidation::where('plant_id', $this->plantId)->where('panel_box_serial_number', $serialNumber)->where('panel_box_code', $itemCode)->where('panel_box_supplier', $supplier)->first(); + + if($panelExistInvoice){ + Notification::make() + ->title('Duplicate Panel') + ->body("Duplicate panel already exist.
Panel Box Code: $itemCode, Item Code: {$this->currentItemCode}, Serial Number: $serialNumber.
") + ->danger() + ->seconds(2) + ->send(); + $this->capacitorInput = ''; + + return; + } + } $this->package = InvoiceValidation::with('stickerMasterRelation') ->where('invoice_number', $this->invoiceNumber)