Added enter event logic in sticker reprint #443
@@ -281,7 +281,7 @@ class StickerReprint extends Page implements HasForms
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'id' => 'scan_locator_no',
|
||||
'id' => 'production_order',
|
||||
'class' => $get('productionError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('productionError') ? $get('productionError') : null)
|
||||
@@ -421,6 +421,7 @@ class StickerReprint extends Page implements HasForms
|
||||
// 'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
$this->dispatch('focus-qr-input');
|
||||
$this->triggerChartUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,22 +34,33 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
|
||||
window.addEventListener('focus-qr-input', () => {
|
||||
const input = document.getElementById('qr-scan-input');
|
||||
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const scanInput = document.getElementById('qr-scan-input');
|
||||
if (!scanInput) return;
|
||||
|
||||
scanInput.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Enter') {
|
||||
if (event.key == 'Enter') {
|
||||
event.preventDefault();
|
||||
|
||||
const value = scanInput.value.trim();
|
||||
|
||||
if (value !== '') {
|
||||
//if (value !== '') {
|
||||
Livewire.dispatch('handleQrScan', { value: value });
|
||||
scanInput.value = '';
|
||||
}
|
||||
//}
|
||||
}
|
||||
});
|
||||
window.addEventListener('open-pdf', event => {
|
||||
|
||||
Reference in New Issue
Block a user