From 9e8a98ffd7c767b42156810512e047ca647135c6 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 26 Aug 2026 15:42:43 +0530 Subject: [PATCH] added duplicate logic in panel box validation --- .../Resources/PanelBoxValidationResource.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/Filament/Resources/PanelBoxValidationResource.php b/app/Filament/Resources/PanelBoxValidationResource.php index 710d038..45e4522 100644 --- a/app/Filament/Resources/PanelBoxValidationResource.php +++ b/app/Filament/Resources/PanelBoxValidationResource.php @@ -817,21 +817,21 @@ class PanelBoxValidationResource extends Resource $serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->latest()->first(); - if ($serialExists) { - $set('serial_exists', true); - } else { - $set('serial_exists', false); - } - - // if ($serialExists && ! $get('id')) { - // $set('validationError', 'Serial number already exists in panel box validation.'); - // $set('sticker_master_id', null); - // $set('uom', null); - // $set('serial_number', null); - - // return; + // if ($serialExists) { + // $set('serial_exists', true); + // } else { + // $set('serial_exists', false); // } + if ($serialExists && ! $get('id')) { + $set('validationError', 'Serial number already exists in panel box validation.'); + $set('sticker_master_id', null); + $set('uom', null); + $set('serial_number', null); + + return; + } + $set('validationError', null); foreach ($serialFields as $column) { @@ -1027,7 +1027,7 @@ class PanelBoxValidationResource extends Resource Notification::make() ->title('Invalid Rework') ->body( - 'This document number and inspection lot number have already been used for this serial number. Please provide a new document number and inspection lot number.' + 'This document number and inspection lot number have already been used for this serial number. Please provide a new document number and inspection lot number for rework..' ) ->danger() ->send(); -- 2.49.1