diff --git a/app/Filament/Resources/PanelBoxValidationResource.php b/app/Filament/Resources/PanelBoxValidationResource.php index 68d1ed21..f4073392 100644 --- a/app/Filament/Resources/PanelBoxValidationResource.php +++ b/app/Filament/Resources/PanelBoxValidationResource.php @@ -807,6 +807,25 @@ class PanelBoxValidationResource extends Resource return; } + $panelExistsPanel = PanelBoxValidation::where('plant_id', $plantId) + ->where('panel_box_serial_number', $serialNumber) + ->where('panel_box_supplier', $supplier) + ->first(); + + if ($panelExistsPanel) { + Notification::make() + ->title('Duplicate Panel Box Serial Number') + ->body("Duplicate panel already exists.
Panel Box Code: $itemCode, Serial Number: $serialNumber, Supplier Number: $supplier in panel box validation") + ->danger() + ->seconds(4) + ->send(); + + $set('item_id', null); + $set('serial_exists', false); + + return; + } + // $plantCode = Plant::where('id', $plantId)->value('code'); // if($plantCode != $supplier){