Added enter event logic in sticker reprint #443

Merged
jothi merged 1 commits from ranjith-dev into master 2026-03-07 03:24:25 +00:00
2 changed files with 16 additions and 4 deletions
Showing only changes of commit ec0a53e308 - Show all commits

View File

@@ -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();
}
}

View File

@@ -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 => {