Merge pull request 'Added focus to production order and qr input in production quantity page' (#438) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s

Reviewed-on: #438
This commit was merged in pull request #438.
This commit is contained in:
2026-03-05 09:32:59 +00:00
2 changed files with 14 additions and 6 deletions

View File

@@ -352,7 +352,8 @@ class ProductionQuantityPage extends Page implements HasForms
}
})
->extraAttributes(fn ($get) => [
'id' => 'scan_locator_no',
'id' => 'production_order',
'wire:keydown.enter' => '$dispatch("focus-qr-input")',
'class' => $get('productionError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('productionError') ? $get('productionError') : null)
@@ -508,12 +509,11 @@ class ProductionQuantityPage extends Page implements HasForms
// 'operator_id'=> $operatorName,
'recent_qr' => $this->recQr,
]);
$this->dispatch('focus-production-order');
$this->triggerChartUpdate();
}
}
// Method to process the value when Enter is pressed
#[On('handleQrScan')]
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 )')
->danger()
->send();
return;
} else {
if (! $this->pId) {

View File

@@ -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 () {
const scanInput = document.getElementById('qr-scan-input');
if (!scanInput) return;
@@ -97,10 +106,10 @@
const value = scanInput.value.trim();
if (value !== '') {
// if (value != '') {
Livewire.dispatch('handleQrScan', { value: value });
scanInput.value = '';
}
// }
}
});