sempre retorna o focus para input search em page balcao

This commit is contained in:
2025-01-04 19:28:06 -03:00
parent 8de4f74aeb
commit 3b4a871166
3 changed files with 7 additions and 5 deletions

View File

@@ -73,10 +73,10 @@
<h2 style="text-align: center;">Buscar Produto </h2> <h2 style="text-align: center;">Buscar Produto </h2>
<div class="grid-container"> <div class="grid-container">
<input <input
oninput="searchProduct()"
type="text"
id="search-product" id="search-product"
name="search-product" name="search-product"
type="text"
oninput="searchProduct()"
autofocus autofocus
placeholder="Buscar Produto" placeholder="Buscar Produto"

Binary file not shown.

View File

@@ -91,6 +91,7 @@ function addProductBalcao() {
const imprimir = document.getElementById('imprimirFichas') const imprimir = document.getElementById('imprimirFichas')
receber.removeAttribute('disabled'); receber.removeAttribute('disabled');
imprimir.removeAttribute('disabled'); imprimir.removeAttribute('disabled');
document.getElementById('search-product').focus()
fieldQtd.value = 1; fieldQtd.value = 1;
setTimeout(function() { setTimeout(function() {
updateTotal();}, 100); updateTotal();}, 100);
@@ -98,7 +99,6 @@ function addProductBalcao() {
function removeProductBalcao(id) { function removeProductBalcao(id) {
const url = `/balcao/removeProductBalcao${id}/`; const url = `/balcao/removeProductBalcao${id}/`;
fetch(url, { fetch(url, {
method: 'GET', method: 'GET',
@@ -110,10 +110,9 @@ function removeProductBalcao(id) {
var listProductsBalcaoElement = document.getElementById("list-products-balcao"); var listProductsBalcaoElement = document.getElementById("list-products-balcao");
listProductsBalcaoElement.innerHTML = text; listProductsBalcaoElement.innerHTML = text;
}) })
document.getElementById('search-product').focus()
setTimeout(function() { setTimeout(function() {
updateTotal();}, 100); updateTotal();}, 100);
} }
@@ -161,8 +160,11 @@ function addProductClick(productId, comandaId) {
const receber = document.getElementById('pagarComanda') const receber = document.getElementById('pagarComanda')
const imprimir = document.getElementById('imprimirFichas') const imprimir = document.getElementById('imprimirFichas')
var search = document.getElementById('search-product')
receber.removeAttribute('disabled'); receber.removeAttribute('disabled');
imprimir.removeAttribute('disabled'); imprimir.removeAttribute('disabled');
search.focus()
// search.setAttribute('autofocus');
fieldQtd.value = 1; fieldQtd.value = 1;
setTimeout(function() { setTimeout(function() {