Added logic in quality validation for sfg line enter prevent logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 4m3s
Laravel Larastan / larastan (pull_request) Failing after 5m33s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 4m3s
Laravel Larastan / larastan (pull_request) Failing after 5m33s
This commit is contained in:
@@ -223,7 +223,7 @@ class QualityValidationResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->autofocus()
|
->autofocus()
|
||||||
->live()
|
->live()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state, $livewire) {
|
||||||
|
|
||||||
$pId = $get('line_id');
|
$pId = $get('line_id');
|
||||||
$set('part_validation_type', null);
|
$set('part_validation_type', null);
|
||||||
@@ -533,6 +533,8 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$serialAssigned = false;
|
$serialAssigned = false;
|
||||||
|
|
||||||
|
$visibleSerialColumns = [];
|
||||||
|
|
||||||
foreach ($serialFields as $column) {
|
foreach ($serialFields as $column) {
|
||||||
|
|
||||||
$colFld = $column;
|
$colFld = $column;
|
||||||
@@ -548,6 +550,10 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$set($column . '_visible', $count > 0);
|
$set($column . '_visible', $count > 0);
|
||||||
|
|
||||||
|
if ($count > 0) {
|
||||||
|
$visibleSerialColumns[] = $column; // NEW
|
||||||
|
}
|
||||||
|
|
||||||
// assign serial only once
|
// assign serial only once
|
||||||
if (!$serialAssigned && $count > 0) {
|
if (!$serialAssigned && $count > 0) {
|
||||||
|
|
||||||
@@ -608,11 +614,38 @@ class QualityValidationResource extends Resource
|
|||||||
// Save options in hidden field
|
// Save options in hidden field
|
||||||
$set('part_validation_type_options', $options);
|
$set('part_validation_type_options', $options);
|
||||||
|
|
||||||
|
$visiblePartValidations = array_filter(
|
||||||
|
$partValidationColumns,
|
||||||
|
fn ($col) => ! empty($stickerMaster->$col)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
$visibleSerialColumns === ['serial_number_motor_qr']
|
||||||
|
&& (int) $stickerMaster->serial_number_motor === 1
|
||||||
|
&& empty($visiblePartValidations)
|
||||||
|
) {
|
||||||
|
$livewire->create();
|
||||||
|
$livewire->js("document.getElementById('item_id')?.focus()");
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
->extraAttributes(fn ($get) => [
|
->extraAttributes(fn ($get) => [
|
||||||
'class' => $get('validationError') ? 'border-red-500' : '',
|
'class' => $get('validationError') ? 'border-red-500' : '',
|
||||||
'id' => 'item_id',
|
'id' => 'item_id',
|
||||||
'onkeydown' => "if (event.key === 'Enter') { event.preventDefault(); event.stopPropagation(); return false; }",
|
'onkeydown' => "if (event.key === 'Enter') { event.preventDefault(); event.stopPropagation(); return false; }",
|
||||||
|
// 'onkeydown' => "
|
||||||
|
// if (event.key === 'Enter') {
|
||||||
|
// if (
|
||||||
|
// document.querySelector('[name=\"data[serial_number_motor_qr]\"]')?.value === '1'
|
||||||
|
// ) {
|
||||||
|
// this.closest('form').querySelector('button[wire\\\\:click*=\"create\"]')?.click();
|
||||||
|
// } else {
|
||||||
|
// event.preventDefault();
|
||||||
|
// event.stopPropagation();
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ",
|
||||||
])
|
])
|
||||||
// ->extraAttributes(fn ($get) => [
|
// ->extraAttributes(fn ($get) => [
|
||||||
// 'class' => $get('validationError') ? 'border-red-500' : '',
|
// 'class' => $get('validationError') ? 'border-red-500' : '',
|
||||||
|
|||||||
Reference in New Issue
Block a user