1
0
forked from poc/pds

Updated validations and success durations and added serial_number maximum length should be 20 digit and clear field if invalid input

This commit is contained in:
dhanabalan
2025-07-11 18:23:52 +05:30
parent 9fa4c0dd49
commit 27524c4d62
11 changed files with 360 additions and 291 deletions

View File

@@ -215,7 +215,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
}
else
{
if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber))
if(Str::length($serialNumber) < 9 || Str::length($serialNumber) > 20 || !ctype_alnum($serialNumber))
{
$invalidSerialCodes[] = $serialNumber;
}
@@ -238,7 +238,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if (!empty($uniqueSerialCodes)) {
Notification::make()
->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->body('The following serial numbers should contain minimum 9 digit (and maximum 20 digit) alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->duration(1200)
->send();
@@ -398,12 +398,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title('Success: Invoice inserted successfully.')
->success()
->duration(800)
->duration(500)
->send();
Notification::make()
->title("Start the scanning process for imported invoice number '$invoiceNumber'!")
->info()
->duration(1000)
->duration(800)
->send();
if ($disk->exists($filePath))
{
@@ -527,7 +527,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
}
else
{
if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber))
if(Str::length($serialNumber) < 9 || Str::length($serialNumber) > 20 || !ctype_alnum($serialNumber))
{
$invalidSerialCodes[] = $serialNumber;
}
@@ -550,7 +550,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if (!empty($uniqueSerialCodes)) {
Notification::make()
->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->body('The following serial numbers should contain minimum 9 digit (and maximum 20 digit) alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->duration(1200)
->send();
@@ -690,12 +690,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title('Success: Invoice updated successfully.')
->success()
->duration(800)
->duration(500)
->send();
Notification::make()
->title("Start the scanning process for updated invoice number '$invoiceNumber'!")
->info()
->duration(1000)
->duration(800)
->send();
if ($disk->exists($filePath))
{
@@ -1110,7 +1110,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("All Serial numbers are moved into invoice from the pallet number '$palletNumber'.<br>Scan the next exist pallet number to start the scanning process..!")
->success()
->duration(800)
->duration(500)
->send();
$records = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -1200,7 +1200,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title($succMsgStr)
->success()
->duration(800)
->duration(500)
->send();
$records = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -1349,6 +1349,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
}
}
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count();
if ($serialNumber == '' || $serialNumber == null)
{
Notification::make()
@@ -1358,7 +1359,6 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->duration(1200)
->send();
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -1373,13 +1373,11 @@ class CreateLocatorInvoiceValidation extends CreateRecord
]);
return;
}
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count();
if (strlen($serialNumber) < 9)
else if (strlen($serialNumber) < 9 || strlen($serialNumber) > 20)
{
Notification::make()
->title("Invalid: Serial Number")
->body('Serial number should contain minimum 9 digits.')
->body('Serial number should contain minimum 9 digits and maximum 20 digits.')
->danger()
->duration(1200)
->send();
@@ -1402,7 +1400,6 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("Invalid: Serial Number")
->body('Serial number must contain alpha-numeric values only.')
// ->body("Serial number '$serialNumber' must be at least 9 digits and alpha-numeric value only allowed!")
->danger()
->duration(1200)
->send();
@@ -1586,7 +1583,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title($succMsg)
->success()
->duration(800)
->duration(500)
->send();
$records = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->get();
@@ -1642,7 +1639,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
{
Notification::make()
->title("Failed to check Serial number '{$serialNumber}' existence.<br>Scan the valid serial number to proceed...")
->success()
->danger()
->duration(1200)
->send();