Added logic in panel box
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 1m47s
Laravel Larastan / larastan (pull_request) Failing after 3m15s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 1m47s
Laravel Larastan / larastan (pull_request) Failing after 3m15s
This commit is contained in:
@@ -228,47 +228,11 @@ class PanelBoxValidationResource extends Resource
|
||||
}
|
||||
|
||||
// // Check if QR format contains '|'
|
||||
if (strpos($state, '|') == false) {
|
||||
$set('validationError', 'Scan valid QR code. (Ex: Item_Code|Serial_Number)');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('part_validation_type_options', []);
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! preg_match('/^[a-zA-Z0-9]{6,}+\|[1-9][a-zA-Z0-9]{8,}+(\|)?$/', $state)) {
|
||||
$splits = explode('|', $state);
|
||||
$iCode = trim($splits[0]);
|
||||
$sNumber = isset($splits[1]) ? trim($splits[1]) : null;
|
||||
|
||||
if (! ctype_alnum($iCode)) {
|
||||
$set('validationError', 'Item code must contain alpha-numeric values.');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('part_validation_type_options', []);
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
} elseif (strlen($iCode) < 6) {
|
||||
$set('validationError', 'Item code must be at least 6 digits.');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('part_validation_type_options', []);
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
} elseif (! ctype_alnum($sNumber)) {
|
||||
$set('validationError', 'Serial Number must contain alpha-numeric values.');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('part_validation_type_options', []);
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
} elseif (strlen($sNumber) < 9) {
|
||||
$set('validationError', 'Serial Number must be at least 9 digits.');
|
||||
if ($state && str_contains($state, '|'))
|
||||
{
|
||||
if (strpos($state, '|') == false) {
|
||||
$set('validationError', 'Scan valid QR code. (Ex: Item_Code|Serial_Number)');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('part_validation_type_options', []);
|
||||
@@ -276,17 +240,67 @@ class PanelBoxValidationResource extends Resource
|
||||
|
||||
return;
|
||||
}
|
||||
// }
|
||||
|
||||
} else {
|
||||
$set('validationError', null);
|
||||
if (! preg_match('/^[a-zA-Z0-9]{6,}+\|[1-9][a-zA-Z0-9]{8,}+(\|)?$/', $state)) {
|
||||
$splits = explode('|', $state);
|
||||
$iCode = trim($splits[0]);
|
||||
$sNumber = isset($splits[1]) ? trim($splits[1]) : null;
|
||||
|
||||
if (! ctype_alnum($iCode)) {
|
||||
$set('validationError', 'Item code must contain alpha-numeric values.');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('part_validation_type_options', []);
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
} elseif (strlen($iCode) < 6) {
|
||||
$set('validationError', 'Item code must be at least 6 digits.');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('part_validation_type_options', []);
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
} elseif (! ctype_alnum($sNumber)) {
|
||||
$set('validationError', 'Serial Number must contain alpha-numeric values.');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('part_validation_type_options', []);
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
} elseif (strlen($sNumber) < 9) {
|
||||
$set('validationError', 'Serial Number must be at least 9 digits.');
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('part_validation_type_options', []);
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
}
|
||||
// }
|
||||
|
||||
} else {
|
||||
$set('validationError', null);
|
||||
}
|
||||
}
|
||||
|
||||
$parts = explode('|', $state);
|
||||
if ($state && str_contains($state, '|')) {
|
||||
|
||||
$itemCode = trim($parts[0]); // Extract item code // 123456|123456789
|
||||
$parts = explode('|', $state);
|
||||
|
||||
$serialNumber = trim($parts[1]);
|
||||
$itemCode = trim($parts[0]); // Extract item code // 123456|123456789
|
||||
|
||||
$serialNumber = trim($parts[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$parts = explode('/', $state);
|
||||
|
||||
$itemCode = trim($parts[1] ?? ''); // item code
|
||||
$serialNumber = trim($parts[2] ?? ''); // serial number
|
||||
}
|
||||
|
||||
// Store serial number before resetting fields
|
||||
$previousSerialNumber = $serialNumber;
|
||||
|
||||
Reference in New Issue
Block a user