1
0
forked from poc/pds

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

This commit is contained in:
dhanabalan
2025-07-09 20:57:06 +05:30
parent 4ac1823e5b
commit b8738a2f6a
4 changed files with 845 additions and 542 deletions

View File

@@ -77,9 +77,10 @@ class InvoiceFinder extends Page implements HasForms
if(!$invoiceNo) if(!$invoiceNo)
{ {
Notification::make() Notification::make()
->title("Invoice number '$invoiceNo' can't be empty!") ->title("Invoice number '$invoiceNo' can't be empty!")
->danger() ->danger()
->send(); ->duration(1200)
->send();
$this->dispatch('loadData', '', [], [], [], [], $plantId); $this->dispatch('loadData', '', [], [], [], [], $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -98,13 +99,14 @@ class InvoiceFinder extends Page implements HasForms
if(!$invoiceExists) if(!$invoiceExists)
{ {
Notification::make() Notification::make()
->title("Invoice number '$invoiceNo' does not exist in locator invoice table!") ->title("Invoice number '$invoiceNo' does not exist in locator invoice table!")
->danger() ->danger()
->send(); ->duration(2000)
->send();
$this->dispatch('loadData', '', [], [], [], [], $plantId); $this->dispatch('loadData', '', [], [], [], [], $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
'scan_invoice' => $invoiceNo, 'scan_invoice' => null,//$invoiceNo,
'total_sno_quantity' => 0, 'total_sno_quantity' => 0,
'pending_quantity' => 0, 'pending_quantity' => 0,
'scan_quantity' => 0 'scan_quantity' => 0
@@ -120,21 +122,22 @@ class InvoiceFinder extends Page implements HasForms
if(!$invoiceCompleted) if(!$invoiceCompleted)
{ {
$count = LocatorInvoiceValidation::where('invoice_number', $invoiceNo) // $count = LocatorInvoiceValidation::where('invoice_number', $invoiceNo)
->where('plant_id', $plantId) // ->where('plant_id', $plantId)
->count(); // ->count();
Notification::make() Notification::make()
->title("Invoice number '$invoiceNo' already completed the scanning process...") ->title("Invoice number '$invoiceNo' already completed the scanning process..!")
->success() ->success()
->send(); ->duration(2000)
->send();
$this->dispatch('loadData', '', [], [], [], [], $plantId); $this->dispatch('loadData', '', [], [], [], [], $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
'scan_invoice' => $invoiceNo, 'scan_invoice' => null,//$invoiceNo,
'total_sno_quantity' => $count, 'total_sno_quantity' => 0,//$count,
'pending_quantity' => 0, 'pending_quantity' => 0,//0,
'scan_quantity' => $count 'scan_quantity' => 0//$count
]); ]);
return; return;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -93,6 +93,7 @@ class PalletFromLocator extends Page implements HasForms
TextInput::make('scan_locator_number') TextInput::make('scan_locator_number')
->label('Scan Locator Number') ->label('Scan Locator Number')
->reactive() ->reactive()
->minLength(7)
->columnSpan(1) ->columnSpan(1)
->readOnly(fn (callable $get) => !$get('plant') || $get('scan_serial_number') || $get('scan_remove_sno')) ->readOnly(fn (callable $get) => !$get('plant') || $get('scan_serial_number') || $get('scan_remove_sno'))
->extraAttributes([ ->extraAttributes([
@@ -101,6 +102,7 @@ class PalletFromLocator extends Page implements HasForms
TextInput::make('scan_serial_number') TextInput::make('scan_serial_number')
->label('Scan Serial Number') ->label('Scan Serial Number')
->reactive() ->reactive()
->minLength(9)
->columnSpan(1) ->columnSpan(1)
->readOnly(fn (callable $get) => !$get('plant') || $get('scan_locator_number') || $get('scan_remove_sno')) ->readOnly(fn (callable $get) => !$get('plant') || $get('scan_locator_number') || $get('scan_remove_sno'))
->extraAttributes([ ->extraAttributes([
@@ -109,6 +111,7 @@ class PalletFromLocator extends Page implements HasForms
TextInput::make('scan_remove_sno') TextInput::make('scan_remove_sno')
->label('Remove Serial Number') ->label('Remove Serial Number')
->reactive() ->reactive()
->minLength(9)
->columnSpan(1) ->columnSpan(1)
->readOnly(fn (callable $get) => !$get('plant') || $get('scan_locator_number') || $get('scan_serial_number') || count($this->records) <= 0) ->readOnly(fn (callable $get) => !$get('plant') || $get('scan_locator_number') || $get('scan_serial_number') || count($this->records) <= 0)
->extraAttributes([ ->extraAttributes([
@@ -141,8 +144,9 @@ class PalletFromLocator extends Page implements HasForms
Notification::make() Notification::make()
->title('Press enter on "Scan Serial Number" field to proceed..!') ->title('Press enter on "Scan Serial Number" field to proceed..!')
->danger() ->danger()
->seconds(2) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -159,8 +163,9 @@ class PalletFromLocator extends Page implements HasForms
Notification::make() Notification::make()
->title('Press enter on "Remove Serial Number" field to proceed..!') ->title('Press enter on "Remove Serial Number" field to proceed..!')
->danger() ->danger()
->seconds(2) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -179,8 +184,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Invalid: Locator Number') ->title('Invalid: Locator Number')
->body("Locator number can't be empty!") ->body("Locator number can't be empty!")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -198,8 +204,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Invalid: Locator Number') ->title('Invalid: Locator Number')
->body("Locator number '$locatorNo' must be at least 7 digits.") ->body("Locator number '$locatorNo' must be at least 7 digits.")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -222,8 +229,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Unknown: Locator Number') ->title('Unknown: Locator Number')
->body("Locator number '$locatorNo' does not exist in the master.") ->body("Locator number '$locatorNo' does not exist in the master.")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -254,8 +262,9 @@ class PalletFromLocator extends Page implements HasForms
->body("Scanned locator number '$locatorNo' does not have any locator serial numbers to store into the pallet.<br> ->body("Scanned locator number '$locatorNo' does not have any locator serial numbers to store into the pallet.<br>
Please scan a valid stored locator number to proceed.") Please scan a valid stored locator number to proceed.")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -273,8 +282,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Add: Locator Serial Numbers') ->title('Add: Locator Serial Numbers')
->body("Scanned locator number '$locatorNo' has '".$serialLocator->count()."' locator serial numbers!<br>Do you want to store it into 'PALLET DATA' table?") ->body("Scanned locator number '$locatorNo' has '".$serialLocator->count()."' locator serial numbers!<br>Do you want to store it into 'PALLET DATA' table?")
->info() ->info()
->seconds(2) ->duration(2000)
->send(); ->send();
$this->dispatch('open-confirm-modal', locatorNo: $locatorNo, plantId: $plantId); $this->dispatch('open-confirm-modal', locatorNo: $locatorNo, plantId: $plantId);
} }
} }
@@ -389,7 +399,7 @@ class PalletFromLocator extends Page implements HasForms
->title('Add: Locator Serial Number') ->title('Add: Locator Serial Number')
->body("Scanned locator serial number '$serialNo' successfully added into 'PALLET DATA' table.") ->body("Scanned locator serial number '$serialNo' successfully added into 'PALLET DATA' table.")
->success() ->success()
->seconds(3) ->duration(1000)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
@@ -412,7 +422,7 @@ class PalletFromLocator extends Page implements HasForms
->title('Remove: Locator Serial Number') ->title('Remove: Locator Serial Number')
->body("Scanned locator serial number '$removeserial' removed successfully from 'PALLET DATA' table.") ->body("Scanned locator serial number '$removeserial' removed successfully from 'PALLET DATA' table.")
->success() ->success()
->seconds(3) ->duration(1000)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
@@ -451,8 +461,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Add: Locator Serial Numbers') ->title('Add: Locator Serial Numbers')
->body("Scanned locator number '$locatorNo' has '$serialLocator' locator serial numbers!<br>Successfully added into 'PALLET DATA' table.") ->body("Scanned locator number '$locatorNo' has '$serialLocator' locator serial numbers!<br>Successfully added into 'PALLET DATA' table.")
->success() ->success()
->seconds(3) ->duration(1000)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -471,8 +482,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Skipped: Locator Number') ->title('Skipped: Locator Number')
->body('Scan the new locator number to proceed..!') ->body('Scan the new locator number to proceed..!')
->info() ->info()
->seconds(3) ->duration(2000)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -501,8 +513,9 @@ class PalletFromLocator extends Page implements HasForms
Notification::make() Notification::make()
->title('Press enter on "Scan Locator Number" field to proceed..!') ->title('Press enter on "Scan Locator Number" field to proceed..!')
->danger() ->danger()
->seconds(2) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -519,8 +532,9 @@ class PalletFromLocator extends Page implements HasForms
Notification::make() Notification::make()
->title('Press enter on "Remove Serial Number" field to proceed..!') ->title('Press enter on "Remove Serial Number" field to proceed..!')
->danger() ->danger()
->seconds(2) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -539,8 +553,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Invalid: Serial Number') ->title('Invalid: Serial Number')
->body("Serial number can't be empty!") ->body("Serial number can't be empty!")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -552,14 +567,15 @@ class PalletFromLocator extends Page implements HasForms
]); ]);
return; return;
} }
else if (strlen($serialNo) < 13) else if (strlen($serialNo) < 9)
{ {
Notification::make() Notification::make()
->title('Invalid: Serial Number') ->title('Invalid: Serial Number')
->body("Serial number '$serialNo' must be at least 13 digits.") ->body("Serial number '$serialNo' must be at least 9 digits.")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -577,8 +593,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Invalid: Serial Number') ->title('Invalid: Serial Number')
->body("Serial number '$serialNo' must contain alpha-numeric values only.") ->body("Serial number '$serialNo' must contain alpha-numeric values only.")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -606,8 +623,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Unknown: Serial Number') ->title('Unknown: Serial Number')
->body("Scanned serial number: '$serialNo' doesn't exist in pallet table.<br>Scan the valid exist locator-serial number to proceed..!") ->body("Scanned serial number: '$serialNo' doesn't exist in pallet table.<br>Scan the valid exist locator-serial number to proceed..!")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -625,8 +643,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Invalid: Serial Number') ->title('Invalid: Serial Number')
->body("Scanned serial number: '$serialNo' already exist in pallet number '".$serialLocator->pallet_number."'.<br>Scan the valid locator-serial number to proceed..!") ->body("Scanned serial number: '$serialNo' already exist in pallet number '".$serialLocator->pallet_number."'.<br>Scan the valid locator-serial number to proceed..!")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -657,8 +676,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Locator Serials Not Found') ->title('Locator Serials Not Found')
->body("Add some locator serial numbers to proceed generate pallet..!") ->body("Add some locator serial numbers to proceed generate pallet..!")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -750,8 +770,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Success: Pallet Generated') ->title('Success: Pallet Generated')
->body("Pallet number '$newPalletNumber' completed the master packing successfully!") ->body("Pallet number '$newPalletNumber' completed the master packing successfully!")
->success() ->success()
->seconds(3) ->duration(1000)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -770,8 +791,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Failed: Pallet Generated') ->title('Failed: Pallet Generated')
->body("No locator serial number records found to generate pallet..!") ->body("No locator serial number records found to generate pallet..!")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -800,6 +822,7 @@ class PalletFromLocator extends Page implements HasForms
// ->title('Pallet Generated') // ->title('Pallet Generated')
// ->body("Pallet number {$this->latestPalletNumber} assigned to all serials for locator {$locatorNo}") // ->body("Pallet number {$this->latestPalletNumber} assigned to all serials for locator {$locatorNo}")
// ->success() // ->success()
// ->duration(1000)
// ->send(); // ->send();
// $this->dispatch('loadData', $this->records, $plantId); // $this->dispatch('loadData', $this->records, $plantId);
// $this->form->fill([ // $this->form->fill([
@@ -828,8 +851,9 @@ class PalletFromLocator extends Page implements HasForms
Notification::make() Notification::make()
->title('Press enter on "Scan Locator Number" field to proceed..!') ->title('Press enter on "Scan Locator Number" field to proceed..!')
->danger() ->danger()
->seconds(2) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -846,8 +870,9 @@ class PalletFromLocator extends Page implements HasForms
Notification::make() Notification::make()
->title('Press enter on "Scan Serial Number" field to proceed..!') ->title('Press enter on "Scan Serial Number" field to proceed..!')
->danger() ->danger()
->seconds(2) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -866,8 +891,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Invalid: Serial Number') ->title('Invalid: Serial Number')
->body("Serial number can't be empty!") ->body("Serial number can't be empty!")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -879,14 +905,15 @@ class PalletFromLocator extends Page implements HasForms
]); ]);
return; return;
} }
else if (strlen($removeSno) < 13) else if (strlen($removeSno) < 9)
{ {
Notification::make() Notification::make()
->title('Invalid: Serial Number') ->title('Invalid: Serial Number')
->body("Serial number '$removeSno' must be at least 13 digits.") ->body("Serial number '$removeSno' must be at least 9 digits.")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -904,8 +931,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Invalid: Serial Number') ->title('Invalid: Serial Number')
->body("Serial number '$removeSno' must contain alpha-numeric values only.") ->body("Serial number '$removeSno' must contain alpha-numeric values only.")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -936,8 +964,9 @@ class PalletFromLocator extends Page implements HasForms
->title('Unknown: Serial Number') ->title('Unknown: Serial Number')
->body("Scanned serial number: '$removeSno' doesn't exist in 'PALLET DATA' table.<br>Scan the valid exist locator-serial number to proceed..!") ->body("Scanned serial number: '$removeSno' doesn't exist in 'PALLET DATA' table.<br>Scan the valid exist locator-serial number to proceed..!")
->danger() ->danger()
->seconds(3) ->duration(1200)
->send(); ->send();
$this->dispatch('loadData', $this->records, $plantId); $this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,

File diff suppressed because it is too large Load Diff