1
0
forked from poc/pds

Merge pull request 'added validation in panel box validation' (#1353) from ranjith-dev into master

Reviewed-on: poc/pds#1353
This commit is contained in:
2026-10-31 09:23:39 +00:00

View File

@@ -844,7 +844,7 @@ class PanelBoxValidationResource extends Resource
}
}
$serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->where('panel_box_supplier', $supplier)->first();
$serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->where('panel_box_supplier', $supplier)->where('status', '!=', '')->whereNotNull('status')->where('status', 'NotOk')->first();
if ($serialExists) {
$set('serial_exists', true);
@@ -852,6 +852,20 @@ class PanelBoxValidationResource extends Resource
$set('serial_exists', false);
}
$serialExistsPanel = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->where('panel_box_supplier', $supplier)->where('status', '!=', '')->whereNotNull('status')->where('status', 'Ok')->first();
if($serialExistsPanel){
Notification::make()
->title('Panel Box Already Validated')
->body("Serial number '$serialNumber' for supplier '$supplier' has already been tested and marked as 'OK'")
->success()
->send();
$set('item_id', null);
$set('serial_exists', false);
$set('validationError', null);
return;
}
// if ($serialExists && ! $get('id')) {
// $set('validationError', 'Serial number already exists in panel box validation.');
// $set('sticker_master_id', null);