5 Commits

Author SHA1 Message Date
dhanabalan
eb2b857aa7 Updated column position in view report 2025-07-09 18:05:11 +05:30
dhanabalan
693e3a23a4 Added serial_number minimum length should be 9 digit and notification display duration 2025-07-09 17:27:41 +05:30
dhanabalan
49d2f1088f Removed colon symbol in notifications 2025-07-09 17:03:09 +05:30
dhanabalan
34b2a05166 Added serial_number minimum length should be 9 digit 2025-07-09 16:16:47 +05:30
dhanabalan
ee99ada3e7 Added notification display duration 2025-07-09 16:15:44 +05:30
4 changed files with 302 additions and 162 deletions

View File

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

View File

@@ -59,10 +59,11 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if(!$plantId)
{
Notification::make()
->title('Plant Not Found')
->body("Plant can't be empty!")
->danger()
->send();
->title('Plant Not Found')
->body("Plant can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -103,6 +104,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice')
->body("Locator invoice '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info()
->duration(1000)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
@@ -147,7 +149,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invoice File Not Found')
->body("Import the scanned 'Invoice' file to proceed..!")
->danger()
->seconds(2)
->duration(1200)
->send();
$this->form->fill([
'plant_id' => $plantId,
@@ -175,6 +177,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invalid Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath))
@@ -212,7 +215,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
}
else
{
if(Str::length($serialNumber) < 13 || !ctype_alnum($serialNumber))
if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber))
{
$invalidSerialCodes[] = $serialNumber;
}
@@ -234,10 +237,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if (!empty($uniqueSerialCodes)) {
Notification::make()
->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 13 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->send();
->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
@@ -262,7 +267,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers Found')
->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes))
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
@@ -284,7 +291,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invalid Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
@@ -315,7 +324,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers Found')
->body('The following serial numbers already exist with a different invoice number:<br>' . implode(', ', $existingSerials))
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath))
{
$disk->delete($filePath);
@@ -387,10 +398,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title('Success: Invoice inserted successfully.')
->success()
->duration(800)
->send();
Notification::make()
->title("Start the scanning process for imported invoice number '$invoiceNumber'!")
->info()
->duration(1000)
->send();
if ($disk->exists($filePath))
{
@@ -441,7 +454,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Updated Invoice File Not Found')
->body("Import the updated 'Invoice' file to proceed..!")
->danger()
->seconds(2)
->duration(1200)
->send();
$this->form->fill([
@@ -476,6 +489,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invalid Updated Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath))
@@ -513,7 +527,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
}
else
{
if(Str::length($serialNumber) < 13 || !ctype_alnum($serialNumber))
if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber))
{
$invalidSerialCodes[] = $serialNumber;
}
@@ -535,10 +549,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if (!empty($uniqueSerialCodes)) {
Notification::make()
->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 13 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->send();
->title('Invalid Serial Numbers Found')
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
@@ -560,10 +576,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if (!empty($duplicateSerialCodes)) {
Notification::make()
->title('Duplicate Serial Numbers Found')
->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes))
->danger()
->send();
->title('Duplicate Serial Numbers Found')
->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes))
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath))
{
$disk->delete($filePath);
@@ -587,10 +605,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invalid Updated Locator Invoice Found')
->body('Uploaded excel sheet is empty or<br>contains no valid data.')
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -618,7 +638,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Duplicate Serial Numbers Found')
->body('The following serial numbers already exist with a different invoice number:<br>' . implode(', ', $existingSerials))
->danger()
->duration(1200)
->send();
if ($disk->exists($filePath)) {
$disk->delete($filePath);
}
@@ -666,12 +688,14 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if ($createdAny)
{
Notification::make()
->title('Success: Locator invoice updated successfully.')
->title('Success: Invoice updated successfully.')
->success()
->duration(800)
->send();
Notification::make()
->title("Start the scanning process for updated invoice number '$invoiceNumber'!")
->info()
->duration(1000)
->send();
if ($disk->exists($filePath))
{
@@ -703,6 +727,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("Start the scanning process for scanned invoice number '$invoiceNumber'!")
->info()
->duration(1000)
->send();
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -730,6 +755,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Error: Locator invoice insertion (or updation).')
->body($e->getMessage())
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -786,7 +812,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Found')
->body("Scanned invoice number '$invoiceNumber' does not exist in invoice table!<br>Import the scanned 'Invoice' file to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -821,7 +849,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info()
->duration(1000)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -842,11 +872,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("Pallet number can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)
->where('invoice_number', $invoiceNumber)
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)
->count();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
'plant' => $plantId,
@@ -865,9 +896,11 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if (strlen($palletNumber) < 10)
{
Notification::make()
->title("Pallet number '$palletNumber' must be at least 10 digits.")
->danger()
->send();
->title("Pallet number '$palletNumber' must be at least 10 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -892,7 +925,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("Pallet number '{$palletNumber}' does not exist in pallet table.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -925,7 +960,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("Pallet number '{$palletNumber}' does not completed the master packing!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -944,28 +981,30 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if ($allCompleted)
{
$PalletSerialNumbers = $palletRecords->pluck('serial_number')
->map(function ($serial) {
return trim($serial);
})
->all();
->map(function ($serial) {
return trim($serial);
})
->all();
$InvoiceSerialNumbers = LocatorInvoiceValidation::where('plant_id', $plantId)
->where('invoice_number', $invoiceNumber)
->where(function ($query) {
$query->where('scanned_status', '=', '')
->orWhereNull('scanned_status');
})
->pluck('serial_number')
->all();
->where('invoice_number', $invoiceNumber)
->where(function ($query) {
$query->where('scanned_status', '=', '')
->orWhereNull('scanned_status');
})
->pluck('serial_number')
->all();
$matchedSerialNumbers = array_intersect($PalletSerialNumbers, $InvoiceSerialNumbers);
if (empty($matchedSerialNumbers))
{
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..!")
->danger()
->send();
->title("Scanned pallet number '$palletNumber' does not have invoice serial numbers.<br>Scan the valid exist pallet number to start the scanning process..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -1001,10 +1040,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
// $body = "Scanned pallet number '$palletNumber' has ".$missingSerialsString."<br>Do you want to skip missing serial numbers?<br>Then Press 'Yes' and Click 'Enter'.";
Notification::make()
->title("Partial Pallet Serial Numbers Found")
->body($missingSerialsString)
->danger()
->send();
->title("Partial Pallet Serial Numbers Found")
->body($missingSerialsString)
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -1069,6 +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)
->send();
$records = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -1089,6 +1131,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info()
->duration(1000)
->send();
$this->dispatch('loadData', '', $plantId);
@@ -1157,6 +1200,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title($succMsgStr)
->success()
->duration(800)
->send();
$records = LocatorInvoiceValidation::where('plant_id', $plantId)
@@ -1177,6 +1221,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info()
->duration(1000)
->send();
$this->dispatch('loadData', '', $plantId);
@@ -1250,7 +1295,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Found')
->body("Scanned invoice number '$invoiceNumber' does not exist in invoice table!<br>Import the scanned 'Invoice' file to proceed..!")
->danger()
->duration(1200)
->send();
$this->form->fill([
'plant_id' => $plantId,
'plant' => $plantId,
@@ -1284,7 +1331,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info()
->duration(1000)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -1303,10 +1352,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord
if ($serialNumber == '' || $serialNumber == null)
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number can't be empty!")
->danger()
->send();
->title("Invalid: Serial Number")
->body("Serial number can't be empty!")
->danger()
->duration(1200)
->send();
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
@@ -1324,13 +1375,38 @@ class CreateLocatorInvoiceValidation extends CreateRecord
}
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count();
if (strlen($serialNumber) < 13)
if (strlen($serialNumber) < 9)
{
Notification::make()
->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()
->duration(1200)
->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->form->fill([
'plant_id' => $plantId,
@@ -1353,7 +1429,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title("Unknown: Serial Number")
->body("Serial number '{$serialNumber}' does not exist in invoice number '$invoiceNumber'.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -1373,7 +1451,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title("Completed: Serial Number")
->body("Serial number '{$serialNumber}' already completed the scanning process for the invoice number '$invoiceNumber'.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -1403,7 +1483,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title("Unknown: Serial Number")
->body("Serial number '{$serialNumber}' does not exist in pallet table.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'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!
->body("Serial number '{$serialNumber}' exist in pallet number '$existPallNum' and it does not completed the master packing!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -1502,6 +1586,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title($succMsg)
->success()
->duration(800)
->send();
$records = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->get();
@@ -1520,6 +1605,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
->title('Completed: Locator Invoice')
->body("Invoice number '$invoiceNumber' completed the scanning process.<br>Scan the next 'Locator Invoice' to proceed..!")
->info()
->duration(1000)
->send();
$this->dispatch('loadData', '', $plantId);
@@ -1557,7 +1643,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("Failed to check Serial number '{$serialNumber}' existence.<br>Scan the valid serial number to proceed...")
->success()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,

View File

@@ -112,6 +112,7 @@ class PalletValidationResource extends Resource
Forms\Components\TextInput::make('serial_number')
->label('Scan Serial No')
->reactive()
->minLength(9)
->readOnly(fn (callable $get) => !$get('pallet_number') || $get('removeSno_number'))
->extraAttributes([
'x-on:keydown.enter.prevent' => '$wire.processPalletSNo()',
@@ -119,6 +120,7 @@ class PalletValidationResource extends Resource
Forms\Components\TextInput::make('removeSno_number')
->label('Remove Serial No')
->reactive()
->minLength(9)
->readOnly(fn (callable $get) => !$get('pallet_number') || $get('serial_number'))
->extraAttributes([
'x-data' => '{ value: "" }',
@@ -220,24 +222,24 @@ class PalletValidationResource extends Resource
->label('Created By')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('scanned_by')
->label('Scanned By')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('updated_at')
Tables\Columns\TextColumn::make('scanned_by')
->label('Scanned By')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('scanned_at')
->dateTime()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('scanned_at')
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->alignCenter()
->sortable()

View File

@@ -57,13 +57,13 @@ class CreatePalletValidation extends CreateRecord
$clickedBy = session('pallet_created_by');
if(!$palletNumber)
if (!$palletNumber)
{
Notification::make()
->title('Pallet number cannot be empty')
->danger()
->send();
->title("Pallet number can't be empty")
->danger()
->duration(1200)
->send();
$this->form->fill([
'serial_number' => null,
'plant_id' => $plantId,
@@ -76,18 +76,16 @@ class CreatePalletValidation extends CreateRecord
return;
}
$count = PalletValidation::where('plant_id', $plantId)
->where('pallet_number', $palletNumber)
->count('pallet_number');
if(!$serialNumber)
if (!$serialNumber)
{
Notification::make()
->title('Serial number cannot be empty')
->danger()
->send();
->title('Serial number is required to add.')
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -100,12 +98,13 @@ class CreatePalletValidation extends CreateRecord
]);
return;
}
if(strlen($serialNumber) < 13)
else if (strlen($serialNumber) < 9)
{
Notification::make()
->title('Serial number should contain minimum 13 digits.')
->danger()
->send();
->title('Serial number should contain minimum 9 digits.')
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -118,12 +117,13 @@ class CreatePalletValidation extends CreateRecord
]);
return;
}
if (!ctype_alnum($serialNumber))
else if (!ctype_alnum($serialNumber))
{
Notification::make()
->title('Serial number must contain alpha-numeric values only.')
->danger()
->send();
->title('Serial number must contain alpha-numeric values only.')
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -143,12 +143,13 @@ class CreatePalletValidation extends CreateRecord
->first();
$invoiceNumber = $existInvoiceSno?->invoice_number;
if($existInvoiceSno)
if ($existInvoiceSno)
{
Notification::make()
->title("Scanned serial number '{$serialNumber}' already completed the scanning process and exist in invoice number : {$invoiceNumber}.<br>Scan the new serial number to add!")
->danger()
->send();
->title("Scanned serial number '{$serialNumber}' already completed the scanning process and exist in invoice number : {$invoiceNumber}.<br>Scan the new serial number to add!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -173,6 +174,7 @@ class CreatePalletValidation extends CreateRecord
// Notification::make()
// ->title("Scanned serial number '{$serialNumber}' exists in pallet table .<br>scan the valid serial number to proceed...")
// ->danger()
// ->duration(1200)
// ->send();
// $this->form->fill([
// 'serial_number' => null,
@@ -191,6 +193,7 @@ class CreatePalletValidation extends CreateRecord
Notification::make()
->title("Scanned serial number '{$serialNumber}' is already exists in pallet number '{$palletNumber}'.<br>Scan the new serial number to proceed...")
->danger()
->duration(1200)
->send();
}
else if ($existingRecord && $existingRecord->pallet_number && $existingRecord->pallet_number != $palletNumber)
@@ -198,6 +201,7 @@ class CreatePalletValidation extends CreateRecord
Notification::make()
->title("Scanned serial number '{$serialNumber}' already exists in pallet number '{$existingRecord->pallet_number}'.<br>Scan the new serial number to proceed...")
->danger()
->duration(1200)
->send();
}
else if ($existingRecord && $existingRecord->locator_number)
@@ -205,6 +209,7 @@ class CreatePalletValidation extends CreateRecord
Notification::make()
->title("Scanned serial number '{$serialNumber}' is already exists in locator number '{$existingRecord->locator_number}'.<br>Scan the new serial number to proceed...")
->danger()
->duration(1200)
->send();
}
$this->dispatch('loadData', $palletNumber, $plantId);
@@ -249,14 +254,16 @@ class CreatePalletValidation extends CreateRecord
if ($record)
{
Notification::make()
->title("Scanned serial number : '{$serialNumber}' successfully inserted into pallet table!<br>Scan the next new serial number to proceed...")
->title("Scanned serial number '{$serialNumber}' successfully inserted into pallet table!<br>Scan the next new serial number to proceed...")
->success()
->duration(600)
->send();
$this->snoCount = PalletValidation::where('plant_id', $plantId)
->where('pallet_number', $palletNumber)
->count();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
'pallet_number' => $palletNumber,
@@ -266,34 +273,36 @@ class CreatePalletValidation extends CreateRecord
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
$this->dispatch('loadData', $palletNumber, $plantId);
}
else
{
Notification::make()
->title('Pallet validation not inserted.')
->title("Failed to insert scanned serial number '$serialNumber' into pallet table!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
'pallet_number' => $palletNumber,
'serial_number' => null,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'scanned_by' => $operatorName,
]);
return;
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
'pallet_number' => $palletNumber,
'serial_number' => null,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'scanned_by' => $operatorName,
]);
return;
}
}
catch (\Exception $e)
{
Notification::make()
->title('Error: Pallet validation not inserted.')
->body("Something went wrong while inserting serial number : '{$serialNumber}' into pallet table!\nScan the new serial number to proceed...")
->title('Error: Serial not inserted.')
->body("Something went wrong while inserting serial number '{$serialNumber}' into pallet table!\nScan the new serial number to proceed...")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -362,12 +371,14 @@ class CreatePalletValidation extends CreateRecord
->where('plant_id', $plantId)
->first();
if(!$palletExist)
if (!$palletExist)
{
Notification::make()
->title("Pallet number '$palletNumber' does not have serial numbers to save!<br>Add the valid serial number into pallet number to proceed...")
->danger()
->send();
->title("Pallet number '$palletNumber' does not have serial numbers to save!<br>Add the valid serial number into pallet number to proceed...")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -391,7 +402,9 @@ class CreatePalletValidation extends CreateRecord
Notification::make()
->title("Pallet number '$palletNumber' already completed the master packing!<br>Generate the new pallet number or choose from pending pallet list!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'serial_number' => null,
@@ -420,7 +433,8 @@ class CreatePalletValidation extends CreateRecord
if ($updated > 0)
{
Notification::make()->title("Pallet number '$palletNumber' records saved successfully!")->success()->send();
Notification::make()->title("Pallet number '$palletNumber' records saved successfully!")->success()->duration(800)->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'serial_number' => null,
@@ -446,7 +460,8 @@ class CreatePalletValidation extends CreateRecord
if ($updated > 0)
{
Notification::make()->title("Pallet number '$palletNumber' completed the master packing successfully!")->success()->send();
Notification::make()->title("Pallet number '$palletNumber' completed the master packing successfully!")->success()->duration(800)->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'serial_number' => null,
@@ -487,6 +502,7 @@ class CreatePalletValidation extends CreateRecord
Notification::make()
->title('Pallet number is required to remove.')
->danger()
->duration(1200)
->send();
return;
}
@@ -501,7 +517,9 @@ class CreatePalletValidation extends CreateRecord
Notification::make()
->title('Serial number is required to remove.')
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -514,12 +532,14 @@ class CreatePalletValidation extends CreateRecord
]);
return;
}
if(strlen($serialNumber) < 13)
else if (strlen($serialNumber) < 9)
{
Notification::make()
->title('Serial number should contain minimum 13 digits.')
->danger()
->send();
->title('Serial number should contain minimum 9 digits.')
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -535,9 +555,11 @@ class CreatePalletValidation extends CreateRecord
else if (!ctype_alnum($serialNumber))
{
Notification::make()
->title('Serial number must contain alpha-numeric values only.')
->danger()
->send();
->title('Serial number must contain alpha-numeric values only.')
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -556,12 +578,14 @@ class CreatePalletValidation extends CreateRecord
->where('scanned_status', '=', 'Scanned')
->first();
if($invoiceExist)
if ($invoiceExist)
{
Notification::make()
->title("Scanned serial number '{$serialNumber}' already completed the scanning process and exist in invoice number : '{$invoiceExist->invoice_number}'.<br>Scan the valid exist serial number to remove!")
->danger()
->send();
->title("Scanned serial number '{$serialNumber}' already completed the scanning process and exist in invoice number '{$invoiceExist->invoice_number}'.<br>Scan the valid exist serial number to remove!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -578,12 +602,14 @@ class CreatePalletValidation extends CreateRecord
$serialexist = PalletValidation::where('plant_id', $plantId)
->where('serial_number', $serialNumber)
->first();
if(!$serialexist)
if (!$serialexist)
{
Notification::make()
->title('Serial number not exists in pallet table.')
->danger()
->send();
->title('Serial number not exists in pallet table.')
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -603,12 +629,13 @@ class CreatePalletValidation extends CreateRecord
->where('pallet_number', '!=', null)
->first();
if($palletExist && $palletExist->pallet_number != $palletNumber)
if ($palletExist && $palletExist->pallet_number != $palletNumber)
{
Notification::make()
->title("Scanned serial number exist in pallet number '$palletExist->pallet_number'.<br>Scan the valid exist serial number to remove!")
->danger()
->send();
->title("Scanned serial number exist in pallet number '$palletExist->pallet_number'.<br>Scan the valid exist serial number to remove!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -628,12 +655,13 @@ class CreatePalletValidation extends CreateRecord
->where('locator_number', '!=', null)
->first();
if($locatorExist && $locatorExist->locator_number)
if ($locatorExist && $locatorExist->locator_number)
{
Notification::make()
->title("Scanned serial number exist in locator number '$locatorExist->locator_number'.<br>Scan the valid exist serial number to remove!")
->danger()
->send();
->title("Scanned serial number exist in locator number '$locatorExist->locator_number'.<br>Scan the valid exist serial number to remove!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
@@ -656,8 +684,9 @@ class CreatePalletValidation extends CreateRecord
if ($deleted)
{
Notification::make()
->title("Scanned serial number : '$serialNumber' successfully removed from pallet table!<br>Scan the next exist serial number to remove...")
->title("Scanned serial number '$serialNumber' successfully removed from pallet table!<br>Scan the next exist serial number to remove...")
->success()
->duration(600)
->send();
$this->snoCount = PalletValidation::where('plant_id', $plantId)
@@ -679,24 +708,25 @@ class CreatePalletValidation extends CreateRecord
else
{
Notification::make()
->title('Failed to delete serial number.')
->title("Failed to remove scanned serial number '$serialNumber' from pallet table!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
'plant_id' => $plantId,
'pallet_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
$this->dispatch('loadData', $palletNumber, $plantId);
$this->form->fill([
'serial_number' => null,
'plant_id' => $plantId,
'pallet_number' => $palletNumber,
'pending_pallet_list' => $pendingPallet,
'Sno_quantity' => $count,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
}
//$this->dispatch('removeSno', $serialNumber, $palletNumber, $plantId);
}
public function processPalletNo()
@@ -735,7 +765,9 @@ class CreatePalletValidation extends CreateRecord
Notification::make()
->title('Pallet number is required.')
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', $plantId);
$this->form->fill([
'serial_number' => null,
@@ -754,7 +786,9 @@ class CreatePalletValidation extends CreateRecord
Notification::make()
->title("Pallet number '$palletNumber' must be at least 10 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadLocator' ,'',$plantId);
$this->form->fill([
'serial_number' => null,
@@ -782,8 +816,9 @@ class CreatePalletValidation extends CreateRecord
if (!$palletNotCompleted)
{
Notification::make()
->title("Already completed for pallet number $palletNumber")
->title("Already completed for pallet number $palletNumber!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $palletNumber, $plantId);