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:
@@ -468,16 +468,16 @@ class LocatorInvoiceValidationResource extends Resource
|
||||
->label('Import Invoice')
|
||||
->form([
|
||||
Select::make('plant_id')
|
||||
->options(Plant::pluck('name', 'id')->toArray())
|
||||
->label('Select Plant')
|
||||
->required()
|
||||
->default(function () {
|
||||
return optional(InvoiceValidation::latest()->first())->plant_id;
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('invoice_serial_number', null);
|
||||
})
|
||||
->reactive(),
|
||||
->options(Plant::pluck('name', 'id')->toArray())
|
||||
->label('Select Plant')
|
||||
->required()
|
||||
->default(function () {
|
||||
return optional(InvoiceValidation::latest()->first())->plant_id;
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('invoice_serial_number', null);
|
||||
})
|
||||
->reactive(),
|
||||
|
||||
FileUpload::make('invoice_serial_number')
|
||||
->label('Invoice Serial Number')
|
||||
@@ -554,7 +554,7 @@ class LocatorInvoiceValidationResource extends Resource
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber))
|
||||
if(Str::length($serialNumber) < 9 || Str::length($serialNumber) > 20 || !ctype_alnum($serialNumber))
|
||||
{
|
||||
$invalidSerialCodes[] = $serialNumber;
|
||||
}
|
||||
@@ -577,7 +577,7 @@ class LocatorInvoiceValidationResource extends Resource
|
||||
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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ class CreatePalletValidation extends CreateRecord
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'serial_number' => null,
|
||||
'plant_id' => $plantId,
|
||||
@@ -86,6 +87,7 @@ class CreatePalletValidation extends CreateRecord
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'serial_number' => null,
|
||||
@@ -98,13 +100,14 @@ class CreatePalletValidation extends CreateRecord
|
||||
]);
|
||||
return;
|
||||
}
|
||||
else if (strlen($serialNumber) < 9)
|
||||
else if (strlen($serialNumber) < 9 || strlen($serialNumber) > 20)
|
||||
{
|
||||
Notification::make()
|
||||
->title('Serial number should contain minimum 9 digits.')
|
||||
->title('Serial number should contain minimum 9 digits and maximum 20 digits.')
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'serial_number' => null,
|
||||
@@ -124,6 +127,7 @@ class CreatePalletValidation extends CreateRecord
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'serial_number' => null,
|
||||
@@ -150,6 +154,7 @@ class CreatePalletValidation extends CreateRecord
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', $palletNumber, $plantId);
|
||||
$this->form->fill([
|
||||
'serial_number' => null,
|
||||
@@ -532,10 +537,10 @@ class CreatePalletValidation extends CreateRecord
|
||||
]);
|
||||
return;
|
||||
}
|
||||
else if (strlen($serialNumber) < 9)
|
||||
else if (strlen($serialNumber) < 9 || strlen($serialNumber) > 20)
|
||||
{
|
||||
Notification::make()
|
||||
->title('Serial number should contain minimum 9 digits.')
|
||||
->title('Serial number should contain minimum 9 digits and maximum 20 digits.')
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
|
||||
@@ -148,11 +148,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
]);
|
||||
return;
|
||||
}
|
||||
else if (strlen($serialNo) > 0 && strlen($serialNo) < 9)
|
||||
else if (strlen($serialNo) > 0 && (strlen($serialNo) < 9 || strlen($serialNo) > 20))
|
||||
{
|
||||
Notification::make()
|
||||
->title("Invalid: Serial Number")
|
||||
->body("Serial number '$serialNo' must be at least 9 digits.")
|
||||
->body("Serial number should contain minimum 9 digits and maximum 20 digits.")
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
@@ -518,11 +518,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen($serialNo) > 0 && strlen($serialNo) < 9)
|
||||
if (strlen($serialNo) > 0 && (strlen($serialNo) < 9 || strlen($serialNo) > 20))
|
||||
{
|
||||
Notification::make()
|
||||
->title("Invalid: Serial Number")
|
||||
->body("Serial number '$serialNo' must be at least 9 digits.")
|
||||
->body("Serial number should contain minimum 9 digits and maximum 20 digits.")
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
@@ -599,7 +599,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
->title('Completed: Rework Pallet from Invoice')
|
||||
->body("Scanned pallet number '$palletNo' successfully moved into rework invoice table from invoice number '$invoiceNo'.<br><br>Please, scan the next pallet number to proceed..!")
|
||||
->success()
|
||||
->duration(800)
|
||||
->duration(500)
|
||||
->send();
|
||||
|
||||
$InvoiceSerialNumbers = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->first();
|
||||
@@ -609,7 +609,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
Notification::make()
|
||||
->title("All available serial numbers are successfully moved into rework invoice table from invoice number '$invoiceNo'.<br><br>Please, scan the next invoice number to proceed..!")
|
||||
->success()
|
||||
->duration(1000)
|
||||
->duration(800)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', '', '', $plantId, $reworkType);
|
||||
@@ -794,11 +794,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen($serialNo) > 0 && strlen($serialNo) < 9)
|
||||
if (strlen($serialNo) > 0 && (strlen($serialNo) < 9 || strlen($serialNo) > 20))
|
||||
{
|
||||
Notification::make()
|
||||
->title("Invalid: Serial Number")
|
||||
->body("Serial number '$serialNo' must be at least 9 digits.")
|
||||
->body("Serial number should contain minimum 9 digits and maximum 20 digits.")
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
@@ -1109,11 +1109,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
]);
|
||||
return;
|
||||
}
|
||||
else if (strlen($serialNo) < 9)
|
||||
else if (strlen($serialNo) < 9 || strlen($serialNo) > 20)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Invalid: Serial Number")
|
||||
->body("Serial number '$serialNo' must be at least 9 digits.")
|
||||
->body("Serial number should contain minimum 9 digits and maximum 20 digits.")
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
@@ -1218,7 +1218,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
->title('Completed: Rework Serial from Invoice')
|
||||
->body("Scanned serial number '$serialNo' successfully moved into rework invoice table from invoice number '$invoiceNo'.<br><br>Please, scan the next serial number to proceed..!")
|
||||
->success()
|
||||
->duration(800)
|
||||
->duration(500)
|
||||
->send();
|
||||
|
||||
$InvoiceSerialNumbers = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->first();
|
||||
@@ -1228,7 +1228,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
Notification::make()
|
||||
->title("All available serial numbers are successfully moved into rework invoice table from invoice number '$invoiceNo'.<br><br>Please, scan the next invoice number to proceed..!")
|
||||
->success()
|
||||
->duration(1000)
|
||||
->duration(800)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', '', '', $plantId, $reworkType);
|
||||
@@ -1439,11 +1439,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
]);
|
||||
return;
|
||||
}
|
||||
else if (strlen($serialNo) < 9)
|
||||
else if (strlen($serialNo) < 9 || strlen($serialNo) > 20)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Invalid: Serial Number")
|
||||
->body("Serial number '$serialNo' must be at least 9 digits.")
|
||||
->body("Serial number should contain minimum 9 digits and maximum 20 digits.")
|
||||
->danger()
|
||||
->duration(1200)
|
||||
->send();
|
||||
@@ -1520,9 +1520,10 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
|
||||
foreach ($records as $row)
|
||||
{
|
||||
if ($PalletSerialNumbers->serial_number != null && $PalletSerialNumbers->serial_number != '' && $PalletSerialNumbers->serial_number != $serialNo)
|
||||
if ($row->serial_number != null && $row->serial_number != '' && $row->serial_number == $serialNo)
|
||||
{
|
||||
$row->forceDelete();
|
||||
continue;
|
||||
}
|
||||
|
||||
$row->pallet_status = null;
|
||||
@@ -1535,7 +1536,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
->title('Completed: Rework Serial from Pallet')
|
||||
->body("Scanned serial number '$serialNo' successfully removed from pallet number '$palletNo'.<br><br>Please, scan the next pallet number to re-master packing..!")
|
||||
->success()
|
||||
->duration(800)
|
||||
->duration(500)
|
||||
->send();
|
||||
|
||||
$PalletSerialNumbers = PalletValidation::where('plant_id', $plantId)->where('pallet_number', $palletNo)->first();
|
||||
@@ -1545,7 +1546,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
Notification::make()
|
||||
->title("Pallet number '$palletNo' successfully re-master packed.<br><br>Please, scan the next pallet number to re-master packing..!")
|
||||
->success()
|
||||
->duration(1000)
|
||||
->duration(800)
|
||||
->send();
|
||||
|
||||
$this->dispatch('loadData', '', '', $plantId, $reworkType);
|
||||
|
||||
Reference in New Issue
Block a user