Added validation in panel box page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 18s
Laravel Pint / pint (pull_request) Successful in 2m3s
Laravel Larastan / larastan (pull_request) Failing after 5m33s

This commit is contained in:
dhanabalan
2026-12-01 09:34:18 +05:30
parent f3203ed2f6
commit 6af925945d

View File

@@ -1075,6 +1075,27 @@ class PanelBoxValidationResource extends Resource
return;
}
$alreadyAssigned = PanelBoxValidation::where('plant_id', $plantId)
->where('serial_number', $serialNumber)
->where('panel_box_supplier', $supplier)
->where('panel_box_code', '!=', $panelBoxCode)
->whereNotNull('panel_box_code')
->where('panel_box_code', '!=', '')
->first();
if ($alreadyAssigned) {
Notification::make()
->title('Panel Box Already Assigned')
->body("Serial number '$serialNumber' for supplier '$supplier' is already assigned to another panel box code.")
->danger()
->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);