Added plant code validation logic in resource page #818

Merged
jothi merged 1 commits from ranjith-dev into master 2026-07-08 04:28:15 +00:00

View File

@@ -178,6 +178,8 @@ class PanelBoxValidationResource extends Resource
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$pId = $get('line_id');
$plantId = $get('plant_id');
$plaCode = Plant::find($plantId)?->code;
$set('part_validation_type', null);
$set('show_validation_image', false);
$set('validation1_image_url', null);
@@ -384,7 +386,17 @@ class PanelBoxValidationResource extends Resource
$set('item_id', null);
return;
}
} else {
else if($plantCode != $plaCode){
Notification::make()
->title('Invalid Plant Code')
->body("Scanned plant code doesn't match the selected plant.")
->danger()
->send();
$set('item_id', null);
return;
}
}
else {
Notification::make()
->title('Invalid QR Format')
@@ -478,6 +490,7 @@ class PanelBoxValidationResource extends Resource
// $set('serial_number', null);
// $set('serial_number', $serialNumber);
}
// Check if user input matches the database values
foreach ($partValidationColumns as $field) {
if ($get("{$field}_visible")) {