added validation in panel box validation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 23s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Successful in 4m14s
Laravel Larastan / larastan (pull_request) Failing after 7m1s

This commit is contained in:
dhanabalan
2026-10-31 14:53:26 +05:30
parent 9b359527b9
commit 3cea3e8ed9

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);