fix: focus input addProduct & feedback addObsOrder & openComanda default 'Sem Mesa'

This commit is contained in:
2025-06-25 12:06:59 -03:00
parent b73e134d9e
commit d7013f0ab8
6 changed files with 11 additions and 3 deletions

View File

@@ -55,7 +55,7 @@ Comandas
<h2>Abrir Comanda</h2> <h2>Abrir Comanda</h2>
<input type="text" id="name-comanda" name="name-comanda" required placeholder="Nome"><br> <input type="text" id="name-comanda" name="name-comanda" required placeholder="Nome"><br>
<select name="select-mesa" required> <select name="select-mesa" required>
<option value="">Selecione um local</option> <option value="1">Sem Mesa</option>
{% for mesa in mesas %} {% for mesa in mesas %}
<option value="{{mesa.id}}">{{mesa.name}}</option> <option value="{{mesa.id}}">{{mesa.name}}</option>

Binary file not shown.

View File

@@ -14,7 +14,7 @@
{{item.product.name}} {{item.product.name}}
{% if item.product.cuisine == True %} {% if item.product.cuisine == True %}
<input hidden id="{{item.id}}-obsOrder" type="order" value="{{item.id | obsOrder}}"> <input hidden id="{{item.id}}-obsOrder" type="order" value="{{item.id | obsOrder}}">
<span data-tooltip="{{item.id | obsOrder}}" data-flow="top"> <span id="tooltip-id-{{item.id}}" data-tooltip="{{item.id | obsOrder}}" data-flow="top">
<img <img
onclick="openModalObs({{item.id}})" onclick="openModalObs({{item.id}})"

View File

@@ -3,8 +3,12 @@
function openModal() { function openModal() {
textField = document.getElementById('search-product') textField = document.getElementById('search-product')
if (textField) {
setTimeout(() => {
textField.focus();
}, 100); // 50ms de delay (ajuste conforme necessário)
}
textField.value = ''; textField.value = '';
textField.focus()
} }
@@ -251,7 +255,9 @@ function troco(){
function addOrder(){ function addOrder(){
obs = document.getElementById('obs') obs = document.getElementById('obs')
id = document.getElementById('id-temp').value id = document.getElementById('id-temp').value
var obsPrint = document.getElementById(id+'-obsOrder')
tooltipObs = document.getElementById('tooltip-id-'+id) tooltipObs = document.getElementById('tooltip-id-'+id)
fetch(`/comandas/editOrders/${id}/${obs.value}`, { fetch(`/comandas/editOrders/${id}/${obs.value}`, {
@@ -266,11 +272,13 @@ function addOrder(){
showToast('✅Pedido atualizado com sucesso!😁','success') showToast('✅Pedido atualizado com sucesso!😁','success')
tooltipObs.dataset.tooltip = data.obs tooltipObs.dataset.tooltip = data.obs
obs.value = '' obs.value = ''
obsPrint.value = data.obs
document.getElementById('modal-obs').style.display = 'none'; document.getElementById('modal-obs').style.display = 'none';
} }
}) })
.catch(error => { .catch(error => {
console.log(error)
showToast('❌Ocorreu um erro!😢','error') showToast('❌Ocorreu um erro!😢','error')
}); });