feat: modal aberta apos adicionar item + filtrar produtos inativos

- Modal de adicionar item nao fecha mais apos cadastro, permite adicionar varios itens seguidos
- Campos resetam (qtd, obs, selecao) e grid de sugestoes recarrega
- Produtos inativos excluidos da aggregation getTopProducts (groupBy filtra ativo=true)
This commit is contained in:
2026-07-21 13:40:54 -03:00
parent 01ecf06215
commit 4be043edf3
2 changed files with 14 additions and 2 deletions

View File

@@ -392,7 +392,19 @@ function bindOrderEvents() {
try {
await api.post(`/comandas/${comandaId}/itens`, { produtoId, quantidade, observacao: observacao || undefined });
toast('Pedido enviado para preparo!', 'success');
(document.getElementById('modal-add-item') as HTMLElement).style.display = 'none';
(document.getElementById('qtd') as HTMLInputElement).value = '1';
(document.getElementById('obs') as HTMLInputElement).value = '';
(document.getElementById('selected-produto-id') as HTMLInputElement).value = '';
const preview = document.getElementById('selected-produto-preview')!;
preview.textContent = 'Nenhum produto selecionado';
preview.style.color = 'var(--text-primary)';
try {
const topProducts = await api.get('/produtos/mais-vendidos');
renderProductCards(topProducts);
} catch {}
await loadComandas({ status: 'ABERTA,FECHADA' });
} catch (err: any) {
toast(err.message, 'error');