feat: one order, one machine: UV and textile never share an order (Marcus, 2026-11-26)
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 7m56s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m16s

The server refuses a cart (and a review) with UV and textile items; the Site
says so as soon as the customer opens a product of the other line, or adds it,
with "Finalizar este pedido" and "Trocar o carrinho por este item". Basic
and premium textile still go together. Proof cards copy their order's items,
so they follow.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-26 09:57:03 -03:00
parent 5ed8109d50
commit a88e7a3288
7 changed files with 82 additions and 5 deletions

View File

@@ -9,6 +9,25 @@ function escolheProduto(m){
if(modo===m && $('foco').classList.contains('on')) vaiPara(PAGINAS[m]);
else abrir(m);
}
// Um pedido, uma máquina (Marcus, 26/11/2026): UV e têxtil nunca no mesmo
// pedido, que vira um card numa máquina só. Têxtil e Premium vão juntos.
// Conta todo o carrinho, também o que ficou guardado para depois; o servidor
// recusa o mesmo pedido misto (app/core/models.py check_one_machine).
const linhaUV=m=>m==='uvfile'||m==='uv';
function outraMaquina(m){ return pedido.some(it=>linhaUV(it.modo)!==linhaUV(m)); }
function avisaOutraMaquina(m,depois){
const dlg=$('linhaDlg');
if(!dlg || dlg.open) return;
$('linhaFim').onclick=()=>{ dlg.close(); vaiPara(CARRINHO); };
$('linhaTroca').onclick=()=>{
dlg.close();
const antes=pedido.slice();
pedido=[]; pintaPedido();
avisaDesfazer('Carrinho trocado por '+MODOS[m].tit+'.',()=>{ pedido=antes; pintaPedido(); });
if(depois) depois();
};
dlg.showModal();
}
function abrir(m){
modo=m; artes=[]; folhas=[]; metros=0; nota=0; reencaixado=false;
montagemCm=0;
@@ -19,6 +38,8 @@ function abrir(m){
$('vMt').textContent='—'; previaAoVivo(); agendaAvaliacao();
limpaPaineis(); // o carrinho só some se o pedido estiver vazio
vaiPara(PAGINAS[m]);
// Produto da outra máquina: avisa já ao abrir, antes de o cliente subir arquivos.
if(outraMaquina(m)) avisaOutraMaquina(m);
}
function pintaModo(){
const m=modo;