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

@@ -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);