From 5b6c182df91a5f1529d9057564a20ecb2f6a3f67 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 27 Oct 2026 10:13:28 +0530 Subject: [PATCH] change dlogic in panel box inspection --- app/Filament/Pages/PanelBoxInspectionStock.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/Filament/Pages/PanelBoxInspectionStock.php b/app/Filament/Pages/PanelBoxInspectionStock.php index c1543f34..16fa4747 100644 --- a/app/Filament/Pages/PanelBoxInspectionStock.php +++ b/app/Filament/Pages/PanelBoxInspectionStock.php @@ -17,6 +17,7 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Facades\Filament; use Illuminate\Support\Facades\Auth; +use App\Models\InvoiceValidation; class PanelBoxInspectionStock extends Page { @@ -445,6 +446,23 @@ class PanelBoxInspectionStock extends Page } } + $panelExistsInvoice = InvoiceValidation::where('plant_id', $this->plantId) + ->where('panel_box_serial_number', $serialNumber) + // ->where('panel_box_code', $itemCode) + ->where('panel_box_supplier', $supplier) + ->first(); + + if ($panelExistsInvoice) { + Notification::make() + ->title('Duplicate Panel Box Serial Number') + ->body("Duplicate panel already exists.
Panel Box Code: $itemCode, Item Code: {$this->currentItemCode}, Serial Number: $serialNumber, Supplier Number: $supplier against invoice Number: $panelExistsInvoice->invoice_number") + ->danger() + ->seconds(2) + ->send(); + + return; + } + $serialExists = PanelBoxValidation::where('plant_id', $plantId)->where('serial_number', $serialNumber)->where('panel_box_supplier', $supplier)->first(); if ($serialExists) {