Added serial_number minimum length should be 9 digit and notification display duration

This commit is contained in:
dhanabalan
2025-07-09 17:27:41 +05:30
parent 49d2f1088f
commit 693e3a23a4
2 changed files with 172 additions and 69 deletions

View File

@@ -104,6 +104,7 @@ class LocatorInvoiceValidationResource extends Resource
Forms\Components\TextInput::make('pallet_number')
->label('Scan Pallet No')
->reactive()
->minLength(10)
// ->readOnly(fn (callable $get) => !$get('plant') || !$get('invoice_number') || $get('serial_number'))
->readOnly(function (callable $get) {
$invoiceNumber = $get('invoice_number');
@@ -145,6 +146,7 @@ class LocatorInvoiceValidationResource extends Resource
Forms\Components\TextInput::make('serial_number')
->label('Scan Serial No')
->reactive()
->minLength(9)
// ->readOnly(fn (callable $get) => !$get('plant') || !$get('invoice_number') || $get('pallet_number'))
->readOnly(function (callable $get) {
$invoiceNumber = $get('invoice_number');
@@ -264,9 +266,10 @@ class LocatorInvoiceValidationResource extends Resource
if (!$palletRecord)
{
Notification::make()
->title("Pallet number '{$palletNumber}' does not exist.")
->danger()
->send();
->title("Pallet number '{$palletNumber}' does not exist.")
->danger()
->duration(1200)
->send();
return;
}
@@ -287,8 +290,9 @@ class LocatorInvoiceValidationResource extends Resource
Notification::make()
->title("Pallet number '{$palletNumber}' is not completed in masters")
->danger()
->duration(1200)
->send();
return;
return;
}
// if ($allCompleted)
@@ -331,6 +335,7 @@ class LocatorInvoiceValidationResource extends Resource
// Notification::make()
// ->title("Pallet number '{$palletNumber}' scanned successfully")
// ->success()
// ->duration(800)
// ->send();
// }
@@ -362,6 +367,7 @@ class LocatorInvoiceValidationResource extends Resource
// Notification::make()
// ->title("Pallet number '{$palletNumber}' scanned successfully")
// ->success()
// ->duration(800)
// ->send();
// }
@@ -522,6 +528,7 @@ class LocatorInvoiceValidationResource extends Resource
->title('Invalid Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger()
->duration(1200)
->send();
if ($disk->exists($path)) {
@@ -547,7 +554,7 @@ class LocatorInvoiceValidationResource extends Resource
}
else
{
if(Str::length($serialNumber) < 13 || !ctype_alnum($serialNumber))
if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber))
{
$invalidSerialCodes[] = $serialNumber;
}
@@ -569,10 +576,12 @@ class LocatorInvoiceValidationResource extends Resource
if (!empty($uniqueSerialCodes)) {
Notification::make()
->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 13 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->send();
->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->duration(1200)
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
@@ -586,7 +595,9 @@ class LocatorInvoiceValidationResource extends Resource
->title('Duplicate Serial Numbers Found')
->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes))
->danger()
->duration(1200)
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
@@ -598,10 +609,12 @@ class LocatorInvoiceValidationResource extends Resource
->title('Invalid Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger()
->duration(1200)
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
@@ -618,20 +631,22 @@ class LocatorInvoiceValidationResource extends Resource
->title('Duplicate Serial Numbers Found')
->body('The following serial numbers already exist with a different invoice number:<br>' . implode(', ', $existingSerials))
->danger()
->duration(1200)
->send();
if ($disk->exists($path))
{
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
else
{
// Save full file path to session
// Save full file path to session
session(['uploaded_invoice_path' => $fullPath]);
Notification::make()
->title('Success: Invoice imported successfully.')
->success()
->duration(800)
->send();
}
}