From 4ac1823e5b36ae0b3d161ea78e559092b7e79c0f Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 9 Jul 2025 19:35:39 +0530 Subject: [PATCH] Added serial_number minimum length should be 9 digit and notification display duration and updated validations --- ...ReworkLocatorInvoiceValidationResource.php | 58 ++--- .../CreateReworkLocatorInvoiceValidation.php | 217 +++++++++++++++++- 2 files changed, 234 insertions(+), 41 deletions(-) diff --git a/app/Filament/Resources/ReworkLocatorInvoiceValidationResource.php b/app/Filament/Resources/ReworkLocatorInvoiceValidationResource.php index 02fce43..100dc58 100644 --- a/app/Filament/Resources/ReworkLocatorInvoiceValidationResource.php +++ b/app/Filament/Resources/ReworkLocatorInvoiceValidationResource.php @@ -86,6 +86,7 @@ class ReworkLocatorInvoiceValidationResource extends Resource ->label('Scan Pallet No') ->required( fn ($get) => $get('rework_type') == 'pallet') ->readOnly(fn ($get) => $get('rework_type') == 'invoice') + ->minLength(10) ->reactive() ->readOnly(fn (callable $get) => (!$get('plant') || !$get('rework_type') || ($get('rework_type') == 'invoice' && !$get('invoice_number')) || $get('scan_serial_no'))) ->extraAttributes([ @@ -93,8 +94,9 @@ class ReworkLocatorInvoiceValidationResource extends Resource ]), Forms\Components\TextInput::make('scan_serial_no') ->label('Scan Serial No') - ->reactive() ->readOnly(fn (callable $get) => (!$get('plant') || !$get('rework_type') || ($get('rework_type') == 'invoice' && !$get('invoice_number')) || ($get('rework_type') == 'invoice' && $get('scan_pallet_no')) || ($get('rework_type') == 'pallet' && !$get('scan_pallet_no')))) + ->minLength(9) + ->reactive() ->extraAttributes([ 'wire:keydown.enter' => 'processSno($event.target.value)', ]), @@ -145,21 +147,21 @@ class ReworkLocatorInvoiceValidationResource extends Resource $invoiceNumber = $get('invoice_number'); $rows = LocatorInvoiceValidation::where('invoice_number', $invoiceNumber) - ->where('plant_id', $plantId) - ->get(); + ->where('plant_id', $plantId) + ->get(); $notCompletedCount = LocatorInvoiceValidation::where('invoice_number', $invoiceNumber) - ->where('plant_id', $plantId) - ->where(function($query) { - $query->whereNull('scanned_status') - ->orWhere('scanned_status', ''); - }) - ->count(); + ->where('plant_id', $plantId) + ->where(function($query) { + $query->whereNull('scanned_status') + ->orWhere('scanned_status', ''); + }) + ->count(); $isScanningComplete = true; foreach ($rows as $row) { - if ($row->scanned_status !== 'Scanned') { + if ($row->scanned_status != 'Scanned') { $isScanningComplete = false; break; } @@ -168,9 +170,12 @@ class ReworkLocatorInvoiceValidationResource extends Resource if (!$isScanningComplete) { Notification::make() - ->title("Scanned invoice number: '$invoiceNumber' does not completed the scanning process!
Has '$notCompletedCount' pending serial number to scan!
Please, scan the valid completed invoice number to proceed...") - ->danger() - ->send(); + ->title("Scanned invoice number: '$invoiceNumber' does not completed the scanning process!
Has '$notCompletedCount' pending serial number to scan!
Please, scan the valid completed invoice number to proceed...") + ->danger() + ->duration(1200) + ->send(); + $set('invoice_number', null); + $set('update_invoice', null); return; } }), @@ -184,24 +189,16 @@ class ReworkLocatorInvoiceValidationResource extends Resource ->afterStateUpdated(function ($state, callable $set, callable $get, $livewire) { $plantId = $get('plant'); - $invoiceNumber = $get('invoice_number'); + $palletNumber = $get('scan_pallet_no'); - $rows = LocatorInvoiceValidation::where('invoice_number', $invoiceNumber) - ->where('plant_id', $plantId) - ->get(); - - $notCompletedCount = LocatorInvoiceValidation::where('invoice_number', $invoiceNumber) - ->where('plant_id', $plantId) - ->where(function($query) { - $query->whereNull('scanned_status') - ->orWhere('scanned_status', ''); - }) - ->count(); + $rows = PalletValidation::where('pallet_number', $palletNumber) + ->where('plant_id', $plantId) + ->get(); $isScanningComplete = true; foreach ($rows as $row) { - if ($row->scanned_status !== 'Scanned') { + if ($row->pallet_status != 'Completed') { $isScanningComplete = false; break; } @@ -210,9 +207,12 @@ class ReworkLocatorInvoiceValidationResource extends Resource if (!$isScanningComplete) { Notification::make() - ->title("Scanned invoice number: '$invoiceNumber' does not completed the scanning process!
Has '$notCompletedCount' pending serial number to scan!
Please, scan the valid completed invoice number to proceed...") - ->danger() - ->send(); + ->title("Scanned pallet number '$palletNumber' does not completed the master packing!
Please, scan the valid completed pallet number to proceed...") + ->danger() + ->duration(1200) + ->send(); + $set('scan_pallet_no', null); + $set('update_pallet', null); return; } }), diff --git a/app/Filament/Resources/ReworkLocatorInvoiceValidationResource/Pages/CreateReworkLocatorInvoiceValidation.php b/app/Filament/Resources/ReworkLocatorInvoiceValidationResource/Pages/CreateReworkLocatorInvoiceValidation.php index 4620dc2..b64ef48 100644 --- a/app/Filament/Resources/ReworkLocatorInvoiceValidationResource/Pages/CreateReworkLocatorInvoiceValidation.php +++ b/app/Filament/Resources/ReworkLocatorInvoiceValidationResource/Pages/CreateReworkLocatorInvoiceValidation.php @@ -54,7 +54,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Invoice Number") ->body("Invoice number can't be empty!") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); // $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count(); $this->form->fill([ @@ -81,6 +83,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Invoice Not Found') ->body("Invoice number '$invoiceNo' doesn't exist in invoice table!

Scan the valid exist 'Invoice Number' to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -126,7 +129,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Pallet Number") ->body("Pallet number '$palletNo' must be at least 10 digits.") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -143,13 +148,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ]); return; } - else if (strlen($serialNo) > 0 && strlen($serialNo) < 13) + else if (strlen($serialNo) > 0 && strlen($serialNo) < 9) { Notification::make() ->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() + ->duration(1200) ->send(); + + $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); + $this->form->fill([ + 'plant_id' => $plantId, + 'plant' => $plantId, + 'invoice_number' => $invoiceNo, + 'scan_pallet_no' => null, + 'scan_serial_no' => null, + 'rework_type' => $reworkType, + 'reworkType' => $reworkType, + 'update_invoice' => 0, + 'update_pallet' => 0, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); + return; + } + else if (strlen($serialNo) > 0 && !ctype_alnum($serialNo)) + { + Notification::make() + ->title("Invalid: Serial Number") + ->body("Serial number '$serialNo' must contain alpha-numeric values only.") + ->danger() + ->duration(1200) + ->send(); + $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -196,6 +228,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Completed: Rework Invoice') ->body("Scanned invoice number '$invoiceNo' successfully moved into rework invoice table.

Please, scan the next completed invoice number to proceed..!") ->success() + ->duration(800) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -219,6 +252,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Completed: Invoice Found') ->body("Press 'Yes' and Press 'Enter' in Scan Invoice No to do rework for entire invoice.

Press 'No' to do rework against 'Pallet or Serial Number'..!") ->info() + ->duration(1200) ->send(); $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); @@ -244,6 +278,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Invoice Not Completed') ->body("Scanned invoice number '$invoiceNo' doesn't completed the scanning process!

Has '$notCompletedCount' pending serial number to scan!

Please, scan the valid completed invoice number to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -269,15 +304,18 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Choosed: Pallet Rework Type") ->body("Scan valid pallet number to proceed..!") ->danger() + ->duration(1200) ->send(); - return; + return; } else { Notification::make() ->title("Rework Type Not Found") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -331,7 +369,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Invoice Number") ->body("Invoice number can't be empty!") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); // $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count(); $this->form->fill([ @@ -358,6 +398,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Invoice Not Found') ->body("Invoice number '$invoiceNo' doesn't exist in invoice table!

Scan the valid exist 'Invoice Number' to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -403,7 +444,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Pallet Number") ->body("Pallet number can't be empty!") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); // $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count(); $this->form->fill([ @@ -427,7 +470,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Pallet Number") ->body("Pallet number '$palletNo' must be at least 10 digits.") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -453,6 +498,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Pallet Not Found') ->body("Pallet number '$palletNo' doesn't exist in scanned invoice number '$invoiceNo'!

Scan the valid exist 'Pallet Number' to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); @@ -472,13 +518,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord return; } - if (strlen($serialNo) > 0 && strlen($serialNo) < 13) + if (strlen($serialNo) > 0 && strlen($serialNo) < 9) { Notification::make() ->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() + ->duration(1200) ->send(); + + $this->dispatch('loadData', $invoiceNo, $palletNo, $plantId, $reworkType); + $this->form->fill([ + 'plant_id' => $plantId, + 'plant' => $plantId, + 'invoice_number' => $invoiceNo, + 'scan_pallet_no' => $palletNo, + 'scan_serial_no' => null, + 'rework_type' => $reworkType, + 'reworkType' => $reworkType, + 'update_invoice' => 0, + 'update_pallet' => 0, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); + return; + } + else if (strlen($serialNo) > 0 && !ctype_alnum($serialNo)) + { + Notification::make() + ->title("Invalid: Serial Number") + ->body("Serial number '$serialNo' must contain alpha-numeric values only.") + ->danger() + ->duration(1200) + ->send(); + $this->dispatch('loadData', $invoiceNo, $palletNo, $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -526,6 +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'.

Please, scan the next pallet number to proceed..!") ->success() + ->duration(800) ->send(); $InvoiceSerialNumbers = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->first(); @@ -535,6 +609,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("All available serial numbers are successfully moved into rework invoice table from invoice number '$invoiceNo'.

Please, scan the next invoice number to proceed..!") ->success() + ->duration(1000) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -576,6 +651,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Invoice Not Completed') ->body("Scanned invoice number '$invoiceNo' doesn't completed the scanning process!

Has '$notCompletedCount' pending serial number to scan!

Please, scan the valid completed invoice number to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -603,7 +679,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Pallet Number") ->body("Pallet number can't be empty!") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); // $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count(); $this->form->fill([ @@ -627,7 +705,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Pallet Number") ->body("Pallet number '$palletNo' must be at least 10 digits.") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -653,6 +733,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Pallet Not Found') ->body("Pallet number '$palletNo' doesn't exist in pallet table!

Scan the valid exist 'Pallet Number' to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -692,6 +773,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Locator Pallet Found') ->body("Scanned pallet number '$palletNo' exist in locator number '$locatExist'.

Remove scanned 'Pallet' from 'Locator' to proceed re-master packing..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -712,13 +794,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord } else { - if (strlen($serialNo) > 0 && strlen($serialNo) < 13) + if (strlen($serialNo) > 0 && strlen($serialNo) < 9) { Notification::make() ->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() + ->duration(1200) ->send(); + + $this->dispatch('loadData', '', $palletNo, $plantId, $reworkType); + $this->form->fill([ + 'plant_id' => $plantId, + 'plant' => $plantId, + 'invoice_number' => null, + 'scan_pallet_no' => $palletNo, + 'scan_serial_no' => null, + 'rework_type' => $reworkType, + 'reworkType' => $reworkType, + 'update_invoice' => 0, + 'update_pallet' => 0, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); + return; + } + else if (strlen($serialNo) > 0 && !ctype_alnum($serialNo)) + { + Notification::make() + ->title("Invalid: Serial Number") + ->body("Serial number '$serialNo' must contain alpha-numeric values only.") + ->danger() + ->duration(1200) + ->send(); + $this->dispatch('loadData', '', $palletNo, $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -747,6 +856,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Completed: Rework Pallet') ->body("Scanned pallet number '$palletNo' successfully removed from pallet table.

Please, scan the next pallet number to re-master packing..!") ->success() + ->duration(800) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -771,6 +881,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Completed: Pallet Found') ->body("Press 'Yes' and Press 'Enter' in Scan Pallet No to do re-master packing for entire pallet.

Press 'No' to do partial re-master packing against 'Serial Number'..!") ->info() + ->duration(1200) ->send(); $this->dispatch('loadData', '', $palletNo, $plantId, $reworkType); @@ -797,6 +908,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Pallet Not Completed') ->body("Scanned pallet number '$palletNo' doesn't completed the master packing!

Please, scan the valid completed pallet number to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -821,7 +933,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("Rework Type Not Found") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -875,7 +989,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Invoice Number") ->body("Invoice number can't be empty!") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); // $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count(); $this->form->fill([ @@ -902,6 +1018,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Invoice Not Found') ->body("Invoice number '$invoiceNo' doesn't exist in invoice table!

Scan the valid exist 'Invoice Number' to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -947,7 +1064,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Pallet Number") ->body("Pallet number '$palletNo' must be at least 10 digits.") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -970,7 +1089,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Serial Number") ->body("Serial number can't be empty!") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); // $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count(); $this->form->fill([ @@ -988,13 +1109,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ]); return; } - else if (strlen($serialNo) < 13) + else if (strlen($serialNo) < 9) { Notification::make() ->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() + ->duration(1200) ->send(); + + $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); + $this->form->fill([ + 'plant_id' => $plantId, + 'plant' => $plantId, + 'invoice_number' => $invoiceNo, + 'scan_pallet_no' => null, + 'scan_serial_no' => null, + 'rework_type' => $reworkType, + 'reworkType' => $reworkType, + 'update_invoice' => 0, + 'update_pallet' => 0, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); + return; + } + else if (!ctype_alnum($serialNo)) + { + Notification::make() + ->title("Invalid: Serial Number") + ->body("Serial number '$serialNo' must contain alpha-numeric values only.") + ->danger() + ->duration(1200) + ->send(); + $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -1020,6 +1168,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Serial Not Found') ->body("Serial number '$serialNo' doesn't exist in scanned invoice number '$invoiceNo'!

Scan the valid exist 'Serial Number' to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType); @@ -1069,6 +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'.

Please, scan the next serial number to proceed..!") ->success() + ->duration(800) ->send(); $InvoiceSerialNumbers = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->first(); @@ -1078,6 +1228,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("All available serial numbers are successfully moved into rework invoice table from invoice number '$invoiceNo'.

Please, scan the next invoice number to proceed..!") ->success() + ->duration(1000) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -1119,6 +1270,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Invoice Not Completed') ->body("Scanned invoice number '$invoiceNo' doesn't completed the scanning process!

Has '$notCompletedCount' pending serial number to scan!

Please, scan the valid completed invoice number to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -1146,7 +1298,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Pallet Number") ->body("Pallet number can't be empty!") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); // $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count(); $this->form->fill([ @@ -1170,7 +1324,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Pallet Number") ->body("Pallet number '$palletNo' must be at least 10 digits.") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -1196,6 +1352,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Pallet Not Found') ->body("Pallet number '$palletNo' doesn't exist in pallet table!

Scan the valid exist 'Pallet Number' to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -1235,6 +1392,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Locator Pallet Found') ->body("Scanned pallet number '$palletNo' exist in locator number '$locatExist'.

Remove scanned 'Pallet' from 'Locator' to proceed re-master packing..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '' , '', $plantId, $reworkType); @@ -1261,7 +1419,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title("Invalid: Serial Number") ->body("Serial number can't be empty!") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', $palletNo, $plantId, $reworkType); // $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count(); $this->form->fill([ @@ -1279,13 +1439,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ]); return; } - else if (strlen($serialNo) < 13) + else if (strlen($serialNo) < 9) { Notification::make() - ->title("Invalid: Serial Number") - ->body("Serial number '$serialNo' must be at least 13 digits.") + ->title("Invalid: Serial Number") + ->body("Serial number '$serialNo' must be at least 9 digits.") ->danger() + ->duration(1200) ->send(); + + $this->dispatch('loadData', '', $palletNo, $plantId, $reworkType); + $this->form->fill([ + 'plant_id' => $plantId, + 'plant' => $plantId, + 'invoice_number' => null, + 'scan_pallet_no' => $palletNo, + 'scan_serial_no' => null, + 'rework_type' => $reworkType, + 'reworkType' => $reworkType, + 'update_invoice' => 0, + 'update_pallet' => 0, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); + return; + } + else if (!ctype_alnum($serialNo)) + { + Notification::make() + ->title("Invalid: Serial Number") + ->body("Serial number '$serialNo' must contain alpha-numeric values only.") + ->danger() + ->duration(1200) + ->send(); + $this->dispatch('loadData', '', $palletNo, $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId, @@ -1311,6 +1498,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Serial Not Found') ->body("Serial number '$serialNo' doesn't exist in pallet number '$palletNo'!

Scan the valid exist 'Serial Number' to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '', $palletNo, $plantId, $reworkType); @@ -1347,6 +1535,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Completed: Rework Serial from Pallet') ->body("Scanned serial number '$serialNo' successfully removed from pallet number '$palletNo'.

Please, scan the next pallet number to re-master packing..!") ->success() + ->duration(800) ->send(); $PalletSerialNumbers = PalletValidation::where('plant_id', $plantId)->where('pallet_number', $palletNo)->first(); @@ -1356,6 +1545,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("Pallet number '$palletNo' successfully re-master packed.

Please, scan the next pallet number to re-master packing..!") ->success() + ->duration(1000) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -1398,6 +1588,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Pallet Not Completed') ->body("Pallet number '$palletNo' doesn't completed the master packing for scanned serial number '$serialNo'!

Please, scan the valid completed pallet number to proceed..!") ->danger() + ->duration(1200) ->send(); $this->dispatch('loadData', '' , '', $plantId, $reworkType); @@ -1422,7 +1613,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("Rework Type Not Found") ->danger() + ->duration(1200) ->send(); + $this->dispatch('loadData', '', '', $plantId, $reworkType); $this->form->fill([ 'plant_id' => $plantId,