From dfa297d9b5693f88c17e127f05af67000f65926a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Fri, 2 Oct 2026 16:28:40 -0300 Subject: [PATCH] fix: "Excluir pedido de teste" asks before deleting instead of failing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The order panel kept the "Enviar para correção" button in a variable named `confirm`, which hid window.confirm from the new delete button ("confirm is not a function"). It is renamed, as is the same name in the final-files form, and every question to the operator calls window.confirm explicitly. Co-Authored-By: Claude Opus 5.5 --- web/kanban.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web/kanban.js b/web/kanban.js index 18332fe..2ab8b6b 100644 --- a/web/kanban.js +++ b/web/kanban.js @@ -463,7 +463,7 @@ function moves(order){ const cancelForm=node('form',undefined,'reason');cancelForm.hidden=true; if(isTest(order)){ row.append(button('Excluir pedido de teste',async()=>{ - if(!confirm('Excluir o pedido de teste #'+order.number+'? Ele some do Kanban, com o histórico.'))return; + if(!window.confirm('Excluir o pedido de teste #'+order.number+'? Ele some do Kanban, com o histórico.'))return; await api('/orders/'+order.id+'/delete-test',{});closePanel();say('Pedido de teste #'+order.number+' excluído.');await load(); },'btn ghost')); }else{ @@ -478,9 +478,9 @@ function moves(order){ catch(error){say(error.message,true);go.disabled=false;}}; } const text=node('textarea');text.placeholder='Motivo da correção';text.setAttribute('aria-label','Motivo da correção');text.maxLength=1000;text.required=true; - const confirm=node('button','Enviar para correção','btn danger'); - reason.append(text,confirm); - reason.onsubmit=async e=>{e.preventDefault();confirm.disabled=true;try{await move(order,'cor',text.value.trim());}catch(error){say(error.message,true);confirm.disabled=false;}}; + const sendFix=node('button','Enviar para correção','btn danger'); + reason.append(text,sendFix); + reason.onsubmit=async e=>{e.preventDefault();sendFix.disabled=true;try{await move(order,'cor',text.value.trim());}catch(error){say(error.message,true);sendFix.disabled=false;}}; box.append(row,reason,backForm,cancelForm);return box; } const PRINT_TEXT={pending:'Na fila para gerar',rendering:'Gerando arquivo…',ready:'PDF gerado',manual:'Preparar à mão',failed:'Falhou ao gerar'}; @@ -558,9 +558,9 @@ function finalsSection(order,revisions,section){ }); const note=node('input');note.placeholder='Nota da revisão';note.required=true;note.maxLength=1000; const check=node('input');check.type='checkbox';check.required=true;check.dataset.confirm=''; - const confirm=node('label',undefined,'check');confirm.append(check,'Arquivos conferidos'); + const checked=node('label',undefined,'check');checked.append(check,'Arquivos conferidos'); const submit=node('button','Aprovar arquivos finais','btn primary'); - form.append(note,confirm,submit); + form.append(note,checked,submit); form.onsubmit=async event=>{event.preventDefault();submit.disabled=true;try{ const refs=[]; for(const [index,input] of inputs.entries()){ @@ -706,7 +706,7 @@ function review(quote){ foot.append(discardButton(quote)); // Tries the whole production flow without a payment. foot.append(button('Criar pedido de teste',async()=>{ - if(!confirm('Criar um pedido de TESTE para esta cotação? Não cobra nada e não vai para o Tiny nem para o WhatsApp.'))return; + if(!window.confirm('Criar um pedido de TESTE para esta cotação? Não cobra nada e não vai para o Tiny nem para o WhatsApp.'))return; const order=await api('/quotes/'+quote.id+'/test-order',{}); say('Pedido de teste #'+order.number+' criado em Arte recebida.');await load(); },'btn ghost')); @@ -735,7 +735,7 @@ function review(quote){ // An unpaid quote leaves the list and can no longer be paid. function discardButton(quote){ return button('Descartar cotação',async()=>{ - if(!confirm('Descartar esta cotação? Ela sai do Kanban e o cliente não consegue mais pagá-la.'))return; + if(!window.confirm('Descartar esta cotação? Ela sai do Kanban e o cliente não consegue mais pagá-la.'))return; await api('/quotes/'+quote.id+'/discard',{});currentQuote=null;say('Cotação descartada.');await load(); },'btn ghost discard'); }