Added focus to production order and qr input in production quantity page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m53s
Laravel Larastan / larastan (pull_request) Failing after 4m17s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m53s
Laravel Larastan / larastan (pull_request) Failing after 4m17s
This commit is contained in:
@@ -352,7 +352,8 @@ class ProductionQuantityPage extends Page implements HasForms
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
->extraAttributes(fn ($get) => [
|
->extraAttributes(fn ($get) => [
|
||||||
'id' => 'scan_locator_no',
|
'id' => 'production_order',
|
||||||
|
'wire:keydown.enter' => '$dispatch("focus-qr-input")',
|
||||||
'class' => $get('productionError') ? 'border-red-500' : '',
|
'class' => $get('productionError') ? 'border-red-500' : '',
|
||||||
])
|
])
|
||||||
->hint(fn ($get) => $get('productionError') ? $get('productionError') : null)
|
->hint(fn ($get) => $get('productionError') ? $get('productionError') : null)
|
||||||
@@ -508,12 +509,11 @@ class ProductionQuantityPage extends Page implements HasForms
|
|||||||
// 'operator_id'=> $operatorName,
|
// 'operator_id'=> $operatorName,
|
||||||
'recent_qr' => $this->recQr,
|
'recent_qr' => $this->recQr,
|
||||||
]);
|
]);
|
||||||
|
$this->dispatch('focus-production-order');
|
||||||
$this->triggerChartUpdate();
|
$this->triggerChartUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method to process the value when Enter is pressed
|
|
||||||
|
|
||||||
#[On('handleQrScan')]
|
#[On('handleQrScan')]
|
||||||
public function handleQrScan($value)
|
public function handleQrScan($value)
|
||||||
{
|
{
|
||||||
@@ -571,7 +571,6 @@ class ProductionQuantityPage extends Page implements HasForms
|
|||||||
->body('Scan the valid QR code.<br>(Ex: Item_Code|Serial_Number )')
|
->body('Scan the valid QR code.<br>(Ex: Item_Code|Serial_Number )')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (! $this->pId) {
|
if (! $this->pId) {
|
||||||
|
|||||||
@@ -87,6 +87,15 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener('focus-qr-input', () => {
|
||||||
|
const input = document.getElementById('qr-scan-input');
|
||||||
|
|
||||||
|
if (input) {
|
||||||
|
input.focus();
|
||||||
|
input.select();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const scanInput = document.getElementById('qr-scan-input');
|
const scanInput = document.getElementById('qr-scan-input');
|
||||||
if (!scanInput) return;
|
if (!scanInput) return;
|
||||||
@@ -97,10 +106,10 @@
|
|||||||
|
|
||||||
const value = scanInput.value.trim();
|
const value = scanInput.value.trim();
|
||||||
|
|
||||||
if (value !== '') {
|
// if (value != '') {
|
||||||
Livewire.dispatch('handleQrScan', { value: value });
|
Livewire.dispatch('handleQrScan', { value: value });
|
||||||
scanInput.value = '';
|
scanInput.value = '';
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user