feat: a cancelled order can be deleted
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 2m55s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m2s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 2m55s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m2s
"Excluir pedido" now also works on a paid order once it is cancelled; one in progress must be cancelled first, with its reason. Deleting a cancelled order also discards its quote, so it neither returns to Cotações as unpaid nor can be paid again. The payment stays recorded and the audit log keeps who deleted which order and the cancellation reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -434,7 +434,11 @@ function moves(order){
|
||||
if(order.cancelled_at){
|
||||
const note=node('div',undefined,'callout bad');
|
||||
note.append(node('b','Pedido cancelado'),node('span',when(order.cancelled_at)+' · '+order.cancelled_by+' · '+order.cancel_reason));
|
||||
box.append(note);return box;
|
||||
const remove=button('Excluir pedido',async()=>{
|
||||
if(!window.confirm('Excluir o pedido #'+order.number+' de vez? Ele some do Kanban com o histórico. O pagamento continua registrado no Mercado Pago.'))return;
|
||||
await api('/orders/'+order.id+'/delete',{});closePanel();say('Pedido #'+order.number+' excluído.');await load();
|
||||
},'btn danger');remove.style.alignSelf='flex-start';
|
||||
box.append(note,remove);return box;
|
||||
}
|
||||
const row=node('div',undefined,'moves');
|
||||
const reason=node('form',undefined,'reason');reason.hidden=true;
|
||||
@@ -464,7 +468,7 @@ function moves(order){
|
||||
if(isTest(order)){
|
||||
row.append(button('Excluir pedido de teste',async()=>{
|
||||
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();
|
||||
await api('/orders/'+order.id+'/delete',{});closePanel();say('Pedido de teste #'+order.number+' excluído.');await load();
|
||||
},'btn ghost'));
|
||||
}else{
|
||||
const b=node('button','Cancelar pedido','btn ghost');b.type='button';
|
||||
|
||||
Reference in New Issue
Block a user