Add 'v' key navigation to bet verification and ESC back navigation

- Press 'v' or 'V' from bets list pages to go to verification
- ESC key from verification pages goes back to bets list
- Ensure barcode input focus on verification pages
- Applied to both admin and cashier interfaces
parent 09343719
...@@ -241,13 +241,24 @@ document.addEventListener('DOMContentLoaded', function() { ...@@ -241,13 +241,24 @@ document.addEventListener('DOMContentLoaded', function() {
window.location.href = '/verify-bet'; window.location.href = '/verify-bet';
}); });
// Keyboard navigation: Enter key moves to /bets/new // Keyboard navigation: Enter key moves to /bets/new, 'v' or 'V' moves to verification
document.addEventListener('keydown', function(event) { document.addEventListener('keydown', function(event) {
// Only handle Enter key if not in an input field // Only handle keys if not in an input field
if (event.key === 'Enter' && event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA' && event.target.tagName !== 'SELECT') { if (event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA' || event.target.tagName === 'SELECT') {
return;
}
// Enter key moves to new bet page
if (event.key === 'Enter') {
event.preventDefault(); event.preventDefault();
window.location.href = '/bets/new'; window.location.href = '/bets/new';
} }
// 'v' or 'V' key moves to bet verification page
if (event.key === 'v' || event.key === 'V') {
event.preventDefault();
window.location.href = '/verify-bet';
}
}); });
// Print receipt button in modal // Print receipt button in modal
......
...@@ -241,13 +241,24 @@ document.addEventListener('DOMContentLoaded', function() { ...@@ -241,13 +241,24 @@ document.addEventListener('DOMContentLoaded', function() {
window.location.href = '/cashier/verify-bet'; window.location.href = '/cashier/verify-bet';
}); });
// Keyboard navigation: Enter key moves to /bets/new // Keyboard navigation: Enter key moves to /bets/new, 'v' or 'V' moves to verification
document.addEventListener('keydown', function(event) { document.addEventListener('keydown', function(event) {
// Only handle Enter key if not in an input field // Only handle keys if not in an input field
if (event.key === 'Enter' && event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA' && event.target.tagName !== 'SELECT') { if (event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA' || event.target.tagName === 'SELECT') {
return;
}
// Enter key moves to new bet page
if (event.key === 'Enter') {
event.preventDefault(); event.preventDefault();
window.location.href = '/cashier/bets/new'; window.location.href = '/cashier/bets/new';
} }
// 'v' or 'V' key moves to bet verification page
if (event.key === 'v' || event.key === 'V') {
event.preventDefault();
window.location.href = '/cashier/verify-bet';
}
}); });
// Status update functions (same as cashier dashboard) // Status update functions (same as cashier dashboard)
......
...@@ -188,6 +188,14 @@ document.addEventListener('DOMContentLoaded', function() { ...@@ -188,6 +188,14 @@ document.addEventListener('DOMContentLoaded', function() {
setTimeout(() => { setTimeout(() => {
barcodeInput.focus(); barcodeInput.focus();
}, 100); }, 100);
// ESC key handling to go back to bets list
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
event.preventDefault();
window.location.href = '/cashier/bets';
}
});
}); });
function generateMobileAccessQR() { function generateMobileAccessQR() {
......
...@@ -183,6 +183,19 @@ document.addEventListener('DOMContentLoaded', function() { ...@@ -183,6 +183,19 @@ document.addEventListener('DOMContentLoaded', function() {
processBarcodeInput(); processBarcodeInput();
} }
}); });
// Focus on barcode input immediately when page loads
setTimeout(() => {
barcodeInput.focus();
}, 100);
// ESC key handling to go back to bets list
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
event.preventDefault();
window.location.href = '/bets';
}
});
}); });
function generateMobileAccessQR() { function generateMobileAccessQR() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment