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

View File

@@ -62,6 +62,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Plant Not Found') ->title('Plant Not Found')
->body("Plant can't be empty!") ->body("Plant can't be empty!")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', '', $plantId); $this->dispatch('loadData', '', $plantId);
$this->form->fill([ $this->form->fill([
@@ -103,6 +104,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice') ->title('Completed: Locator Invoice')
->body("Locator invoice '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!") ->body("Locator invoice '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info() ->info()
->duration(1000)
->send(); ->send();
$this->dispatch('loadData', '', $plantId); $this->dispatch('loadData', '', $plantId);
$this->form->fill([ $this->form->fill([
@@ -147,7 +149,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invoice File Not Found') ->title('Invoice File Not Found')
->body("Import the scanned 'Invoice' file to proceed..!") ->body("Import the scanned 'Invoice' file to proceed..!")
->danger() ->danger()
->seconds(2) ->duration(1200)
->send(); ->send();
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -175,6 +177,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invalid Locator Invoice Found') ->title('Invalid Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.') ->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) if ($disk->exists($filePath))
@@ -212,7 +215,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
} }
else else
{ {
if(Str::length($serialNumber) < 13 || !ctype_alnum($serialNumber)) if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber))
{ {
$invalidSerialCodes[] = $serialNumber; $invalidSerialCodes[] = $serialNumber;
} }
@@ -235,9 +238,11 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if (!empty($uniqueSerialCodes)) { if (!empty($uniqueSerialCodes)) {
Notification::make() Notification::make()
->title('Invalid Serial Numbers Found') ->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 13 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes)) ->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) { if ($disk->exists($filePath)) {
$disk->delete($filePath); $disk->delete($filePath);
} }
@@ -262,7 +267,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers Found') ->title('Duplicate Serial Numbers Found')
->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes)) ->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes))
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) { if ($disk->exists($filePath)) {
$disk->delete($filePath); $disk->delete($filePath);
} }
@@ -284,7 +291,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invalid Locator Invoice Found') ->title('Invalid Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.') ->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) { if ($disk->exists($filePath)) {
$disk->delete($filePath); $disk->delete($filePath);
} }
@@ -315,7 +324,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers Found') ->title('Duplicate Serial Numbers Found')
->body('The following serial numbers already exist with a different invoice number:<br>' . implode(', ', $existingSerials)) ->body('The following serial numbers already exist with a different invoice number:<br>' . implode(', ', $existingSerials))
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) if ($disk->exists($filePath))
{ {
$disk->delete($filePath); $disk->delete($filePath);
@@ -387,10 +398,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title('Success: Invoice inserted successfully.') ->title('Success: Invoice inserted successfully.')
->success() ->success()
->duration(800)
->send(); ->send();
Notification::make() Notification::make()
->title("Start the scanning process for imported invoice number '$invoiceNumber'!") ->title("Start the scanning process for imported invoice number '$invoiceNumber'!")
->info() ->info()
->duration(1000)
->send(); ->send();
if ($disk->exists($filePath)) if ($disk->exists($filePath))
{ {
@@ -441,7 +454,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Updated Invoice File Not Found') ->title('Updated Invoice File Not Found')
->body("Import the updated 'Invoice' file to proceed..!") ->body("Import the updated 'Invoice' file to proceed..!")
->danger() ->danger()
->seconds(2) ->duration(1200)
->send(); ->send();
$this->form->fill([ $this->form->fill([
@@ -476,6 +489,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invalid Updated Locator Invoice Found') ->title('Invalid Updated Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.') ->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) if ($disk->exists($filePath))
@@ -513,7 +527,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
} }
else else
{ {
if(Str::length($serialNumber) < 13 || !ctype_alnum($serialNumber)) if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber))
{ {
$invalidSerialCodes[] = $serialNumber; $invalidSerialCodes[] = $serialNumber;
} }
@@ -536,9 +550,11 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if (!empty($uniqueSerialCodes)) { if (!empty($uniqueSerialCodes)) {
Notification::make() Notification::make()
->title('Invalid Serial Numbers Found') ->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 13 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes)) ->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) { if ($disk->exists($filePath)) {
$disk->delete($filePath); $disk->delete($filePath);
} }
@@ -563,7 +579,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers Found') ->title('Duplicate Serial Numbers Found')
->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes)) ->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes))
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) if ($disk->exists($filePath))
{ {
$disk->delete($filePath); $disk->delete($filePath);
@@ -587,7 +605,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invalid Updated Locator Invoice Found') ->title('Invalid Updated Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.') ->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) { if ($disk->exists($filePath)) {
$disk->delete($filePath); $disk->delete($filePath);
} }
@@ -618,7 +638,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers Found') ->title('Duplicate Serial Numbers Found')
->body('The following serial numbers already exist with a different invoice number:<br>' . implode(', ', $existingSerials)) ->body('The following serial numbers already exist with a different invoice number:<br>' . implode(', ', $existingSerials))
->danger() ->danger()
->duration(1200)
->send(); ->send();
if ($disk->exists($filePath)) { if ($disk->exists($filePath)) {
$disk->delete($filePath); $disk->delete($filePath);
} }
@@ -666,12 +688,14 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if ($createdAny) if ($createdAny)
{ {
Notification::make() Notification::make()
->title('Success: Locator invoice updated successfully.') ->title('Success: Invoice updated successfully.')
->success() ->success()
->duration(800)
->send(); ->send();
Notification::make() Notification::make()
->title("Start the scanning process for updated invoice number '$invoiceNumber'!") ->title("Start the scanning process for updated invoice number '$invoiceNumber'!")
->info() ->info()
->duration(1000)
->send(); ->send();
if ($disk->exists($filePath)) if ($disk->exists($filePath))
{ {
@@ -703,6 +727,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title("Start the scanning process for scanned invoice number '$invoiceNumber'!") ->title("Start the scanning process for scanned invoice number '$invoiceNumber'!")
->info() ->info()
->duration(1000)
->send(); ->send();
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId) $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -730,6 +755,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Error: Locator invoice insertion (or updation).') ->title('Error: Locator invoice insertion (or updation).')
->body($e->getMessage()) ->body($e->getMessage())
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId) $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -786,7 +812,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Found') ->title('Invoice Not Found')
->body("Scanned invoice number '$invoiceNumber' does not exist in invoice table!<br>Import the scanned 'Invoice' file to proceed..!") ->body("Scanned invoice number '$invoiceNumber' does not exist in invoice table!<br>Import the scanned 'Invoice' file to proceed..!")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -821,7 +849,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice') ->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!") ->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info() ->info()
->duration(1000)
->send(); ->send();
$this->dispatch('loadData', '', $plantId); $this->dispatch('loadData', '', $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -842,11 +872,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title("Pallet number can't be empty!") ->title("Pallet number can't be empty!")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId) $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)
->where('invoice_number', $invoiceNumber)
->count(); ->count();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
'plant' => $plantId, 'plant' => $plantId,
@@ -867,7 +898,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title("Pallet number '$palletNumber' must be at least 10 digits.") ->title("Pallet number '$palletNumber' must be at least 10 digits.")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -892,7 +925,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title("Pallet number '{$palletNumber}' does not exist in pallet table.") ->title("Pallet number '{$palletNumber}' does not exist in pallet table.")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -925,7 +960,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title("Pallet number '{$palletNumber}' does not completed the master packing!") ->title("Pallet number '{$palletNumber}' does not completed the master packing!")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -965,7 +1002,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title("Scanned pallet number '$palletNumber' does not have invoice serial numbers.<br>Scan the valid exist pallet number to start the scanning process..!") ->title("Scanned pallet number '$palletNumber' does not have invoice serial numbers.<br>Scan the valid exist pallet number to start the scanning process..!")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -1004,7 +1043,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title("Partial Pallet Serial Numbers Found") ->title("Partial Pallet Serial Numbers Found")
->body($missingSerialsString) ->body($missingSerialsString)
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -1069,6 +1110,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() 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..!") ->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() ->success()
->duration(800)
->send(); ->send();
$records = LocatorInvoiceValidation::where('plant_id', $plantId) $records = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -1089,6 +1131,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice') ->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!") ->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info() ->info()
->duration(1000)
->send(); ->send();
$this->dispatch('loadData', '', $plantId); $this->dispatch('loadData', '', $plantId);
@@ -1157,6 +1200,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title($succMsgStr) ->title($succMsgStr)
->success() ->success()
->duration(800)
->send(); ->send();
$records = LocatorInvoiceValidation::where('plant_id', $plantId) $records = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -1177,6 +1221,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice') ->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!") ->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info() ->info()
->duration(1000)
->send(); ->send();
$this->dispatch('loadData', '', $plantId); $this->dispatch('loadData', '', $plantId);
@@ -1250,7 +1295,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Found') ->title('Invoice Not Found')
->body("Scanned invoice number '$invoiceNumber' does not exist in invoice table!<br>Import the scanned 'Invoice' file to proceed..!") ->body("Scanned invoice number '$invoiceNumber' does not exist in invoice table!<br>Import the scanned 'Invoice' file to proceed..!")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
'plant' => $plantId, 'plant' => $plantId,
@@ -1284,7 +1331,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice') ->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!") ->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info() ->info()
->duration(1000)
->send(); ->send();
$this->dispatch('loadData', '', $plantId); $this->dispatch('loadData', '', $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -1306,7 +1355,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Serial Number") ->title("Invalid: Serial Number")
->body("Serial number can't be empty!") ->body("Serial number can't be empty!")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count(); $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
@@ -1324,13 +1375,38 @@ class CreateLocatorInvoiceValidation extends CreateRecord
} }
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count(); $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count();
if (strlen($serialNumber) < 13) if (strlen($serialNumber) < 9)
{ {
Notification::make() Notification::make()
->title("Invalid: Serial Number") ->title("Invalid: Serial Number")
->body("Serial number '$serialNumber' must be at least 13 digits and alpha-numeric value only allowed!") ->body('Serial number should contain minimum 9 digits.')
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
'plant' => $plantId,
'invoice_number' => $invoiceNumber,
'pallet_number' => null,
'serial_number' => null,
'sno_quantity' => $snoCount,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if (!ctype_alnum($serialNumber))
{
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();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -1353,7 +1429,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title("Unknown: Serial Number") ->title("Unknown: Serial Number")
->body("Serial number '{$serialNumber}' does not exist in invoice number '$invoiceNumber'.") ->body("Serial number '{$serialNumber}' does not exist in invoice number '$invoiceNumber'.")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -1373,7 +1451,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title("Completed: Serial Number") ->title("Completed: Serial Number")
->body("Serial number '{$serialNumber}' already completed the scanning process for the invoice number '$invoiceNumber'.") ->body("Serial number '{$serialNumber}' already completed the scanning process for the invoice number '$invoiceNumber'.")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -1403,7 +1483,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title("Unknown: Serial Number") ->title("Unknown: Serial Number")
->body("Serial number '{$serialNumber}' does not exist in pallet table.") ->body("Serial number '{$serialNumber}' does not exist in pallet table.")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -1434,7 +1516,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title("Incompleted Pallet: Serial Number")//Pallet number '{$existPallNum}' does not completed the master packing! ->title("Incompleted Pallet: Serial Number")//Pallet number '{$existPallNum}' does not completed the master packing!
->body("Serial number '{$serialNumber}' exist in pallet number '$existPallNum' and it does not completed the master packing!") ->body("Serial number '{$serialNumber}' exist in pallet number '$existPallNum' and it does not completed the master packing!")
->danger() ->danger()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -1502,6 +1586,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title($succMsg) ->title($succMsg)
->success() ->success()
->duration(800)
->send(); ->send();
$records = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->get(); $records = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->get();
@@ -1520,6 +1605,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice') ->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!") ->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info() ->info()
->duration(1000)
->send(); ->send();
$this->dispatch('loadData', '', $plantId); $this->dispatch('loadData', '', $plantId);
@@ -1557,7 +1643,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make() Notification::make()
->title("Failed to check Serial number '{$serialNumber}' existence.<br>Scan the valid serial number to proceed...") ->title("Failed to check Serial number '{$serialNumber}' existence.<br>Scan the valid serial number to proceed...")
->success() ->success()
->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $invoiceNumber, $plantId); $this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,