1
0
forked from poc/pds

Update invoice data handling to include onCapFocus parameter and adjust focus function and timing for input fields

This commit is contained in:
dhanabalan
2025-11-21 17:18:31 +05:30
parent 376ee84e63
commit affa38251d
3 changed files with 47 additions and 30 deletions

View File

@@ -97,7 +97,7 @@ class CreateInvoiceValidation extends CreateRecord
'update_invoice' => false,
'scanned_quantity'=> $scanSQuan
]);
$this->dispatch('refreshInvoiceData', invoiceNumber: $this->invoiceNumber, plantId: $this->plantId);
$this->dispatch('refreshInvoiceData', invoiceNumber: $this->invoiceNumber, plantId: $this->plantId, onCapFocus: false);
}
}
@@ -211,7 +211,7 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playNotificationSound');
// $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false); //$this->invoiceNumber
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
if ($updateStatus == '1')
@@ -852,7 +852,7 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scanSQuan,
]);
//$hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
// $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
// $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
if ($totQuan == $scanSQuan)
{
@@ -893,7 +893,7 @@ class CreateInvoiceValidation extends CreateRecord
->seconds(1)
->send();
$this->dispatch('playNotificationSound');
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
if ($updateStatus == '1')
{
@@ -1284,8 +1284,8 @@ class CreateInvoiceValidation extends CreateRecord
// }
// $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false); //$this->invoiceNumber
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
}
}
else
@@ -1894,7 +1894,7 @@ class CreateInvoiceValidation extends CreateRecord
// }
// $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false); //$this->invoiceNumber
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
}
}
@@ -2270,8 +2270,8 @@ class CreateInvoiceValidation extends CreateRecord
// }
// $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false); //$this->invoiceNumber
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
}
}
else
@@ -2343,7 +2343,16 @@ class CreateInvoiceValidation extends CreateRecord
else
{
$hasRecords = $hasInvoice->stickerMasterRelation->material_type ?? null;
$this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $this->invoiceNumber, plantId: $this->plantId);
//$this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $this->invoiceNumber, plantId: $this->plantId);
if (!empty($hasRecords) && $hasRecords)
{
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $this->invoiceNumber, plantId: $this->plantId);
}
else
{
$this->dispatch('refreshInvoiceData', invoiceNumber: $this->invoiceNumber, plantId: $this->plantId, onCapFocus: false);
}
}
}
}
@@ -2459,7 +2468,7 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scanMQuan,
]);
//$hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
$this->dispatch( 'refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
}
$pattern1 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>[^|]+)\/(?<batch_quantity>.+)$/i';
@@ -3209,7 +3218,7 @@ class CreateInvoiceValidation extends CreateRecord
'update_invoice' => false,
'scanned_quantity'=> $scannedMQuantity,
]);
$this->dispatch( 'refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
}
return;
}
@@ -3259,7 +3268,7 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scanSQuan,
]);
//$hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
$this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
}
///^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/
@@ -3695,7 +3704,7 @@ class CreateInvoiceValidation extends CreateRecord
}
else
{
$this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
// $this->refreshInvoiceTable();
}
return;
@@ -3871,7 +3880,7 @@ class CreateInvoiceValidation extends CreateRecord
}
else
{
$this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
// $this->refreshInvoiceTable();
}
return;
@@ -3971,11 +3980,9 @@ class CreateInvoiceValidation extends CreateRecord
'scanned_quantity'=> $scannedQuantity,
]);
$this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('focus-capacitor-input');
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: true);
// $this->refreshInvoiceTable();
return;
}
else if ($isMarkPs)
{
@@ -4150,7 +4157,7 @@ class CreateInvoiceValidation extends CreateRecord
}
else
{
$this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
// $this->refreshInvoiceTable();
}
return;

View File

@@ -24,6 +24,8 @@ class InvoiceDataTable extends Component
public bool $isSerial = false;
public bool $onCapFocus = false;
public bool $emptyInvoice = false;
public bool $hasSearched = false;
@@ -39,7 +41,7 @@ class InvoiceDataTable extends Component
'refreshEmptyInvoice' => 'loadEmptyData',
'refreshInvoiceData' => 'loadData',
'refreshMaterialInvoiceData' => 'loadMaterialData',
'openCapacitorModal' => 'showCapacitorInputBox',
'openCapacitorModal' => 'showCapacitorInputBox'
];
public $capacitorInput = '';
@@ -60,6 +62,7 @@ class InvoiceDataTable extends Component
$this->invoiceNumber = $invoiceNumber;
$this->completedInvoice = true;
$this->isSerial = $isSerial;
$this->onCapFocus = false;
$this->emptyInvoice = false;
$this->hasSearched = false;
$this->materialInvoice = false;
@@ -73,6 +76,7 @@ class InvoiceDataTable extends Component
$this->plantId = $plantId;
$this->invoiceNumber = $invoiceNumber;
$this->completedInvoice = false;
$this->onCapFocus = false;
$this->emptyInvoice = true;
$this->hasSearched = false;
$this->materialInvoice = false;
@@ -80,12 +84,13 @@ class InvoiceDataTable extends Component
// $this->showCapacitorInput = false;
}
public function loadData($invoiceNumber, $plantId)
public function loadData($invoiceNumber, $plantId, $onCapFocus)
{
$this->plantId = $plantId;
$this->invoiceNumber = $invoiceNumber;
$this->completedInvoice = false;
$this->isSerial = true;
$this->onCapFocus = $onCapFocus;
$this->emptyInvoice = false;
$this->hasSearched = true;
$this->materialInvoice = false;
@@ -179,7 +184,15 @@ class InvoiceDataTable extends Component
$this->packageCount += $stickCount - $scannedCount;
}
$this->dispatch('focus-serial-number');
if ($onCapFocus)
{
$this->dispatch('focus-capacitor-input');
}
else
{
$this->dispatch('focus-serial-number');
}
}
public function loadMaterialData($invoiceNumber, $plantId)
@@ -188,6 +201,7 @@ class InvoiceDataTable extends Component
$this->invoiceNumber = $invoiceNumber;
$this->completedInvoice = false;
$this->isSerial = false;
$this->onCapFocus = false;
$this->emptyInvoice = false;
$this->hasSearched = false;
$this->materialInvoice = true;
@@ -234,11 +248,6 @@ class InvoiceDataTable extends Component
$this->dispatch('focus-serial-number');
}
// public function showCapacitorInputBox()
// {
// $this->showCapacitorInput = true;
// }
public function showCapacitorInputBox($itemCode, $serialNumber, $plantId)
{
$this->plantId = $plantId;
@@ -248,6 +257,7 @@ class InvoiceDataTable extends Component
// $this->capacitorInput = '';
$this->completedInvoice = false;
$this->isSerial = true;
$this->onCapFocus = false;
$this->emptyInvoice = false;
$this->hasSearched = false;
$this->materialInvoice = false;
@@ -407,7 +417,7 @@ class InvoiceDataTable extends Component
}
else
{
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id);
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
}
}
break;

View File

@@ -201,7 +201,7 @@
input.focus();
input.select();
}
}, 100);
}, 50);
});
window.addEventListener('focus-invoice-number', () => {
@@ -213,7 +213,7 @@
input.focus();
input.select();
}
}, 100);
}, 50);
});
</script>