Merge pull request 'Added plant code validation logic in resource page' (#818) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 22s

Reviewed-on: #818
This commit was merged in pull request #818.
This commit is contained in:
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) { ->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$pId = $get('line_id'); $pId = $get('line_id');
$plantId = $get('plant_id');
$plaCode = Plant::find($plantId)?->code;
$set('part_validation_type', null); $set('part_validation_type', null);
$set('show_validation_image', false); $set('show_validation_image', false);
$set('validation1_image_url', null); $set('validation1_image_url', null);
@@ -384,7 +386,17 @@ class PanelBoxValidationResource extends Resource
$set('item_id', null); $set('item_id', null);
return; 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() Notification::make()
->title('Invalid QR Format') ->title('Invalid QR Format')
@@ -478,6 +490,7 @@ class PanelBoxValidationResource extends Resource
// $set('serial_number', null); // $set('serial_number', null);
// $set('serial_number', $serialNumber); // $set('serial_number', $serialNumber);
} }
// Check if user input matches the database values // Check if user input matches the database values
foreach ($partValidationColumns as $field) { foreach ($partValidationColumns as $field) {
if ($get("{$field}_visible")) { if ($get("{$field}_visible")) {