From f6bdbe006e60754ec1d704dc383067c77326c3b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Thu, 22 Oct 2026 17:05:35 -0300 Subject: [PATCH] fix: checkout and the Kanban take layout version 3 The layout rule of 2026-10-21 records version 3, but checkout still refused any item not on version 2, so no order could be quoted (CI's browser test timed out at the upload), and the Kanban marked new quotes "Montagem antiga". Both now take versions 2 and 3, as the server does. Co-Authored-By: Claude Opus 5.5 --- web/checkout.js | 3 ++- web/kanban.js | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/web/checkout.js b/web/checkout.js index a06fe75..40b753f 100644 --- a/web/checkout.js +++ b/web/checkout.js @@ -311,7 +311,8 @@ uploads.push(await upload(file)); enviaFoto(uploads[index], item.fotos?.[index]); } - if (item.production?.version!==2 || item.production.sources?.length!==uploads.length) + // Layout versions the server takes: 3 since 2026-10-21, 2 for a cart saved before. + if (![2,3].includes(item.production?.version) || item.production.sources?.length!==uploads.length) throw new Error('A montagem deste item precisa ser refeita antes da cotação.'); items.push({mode:item.modo, metres:String(item.metros), grade:item.nota, uploads, production:{...item.production,sources:item.production.sources.map((source,index)=>({ diff --git a/web/kanban.js b/web/kanban.js index f0a7494..25ede5c 100644 --- a/web/kanban.js +++ b/web/kanban.js @@ -30,6 +30,8 @@ function outcomeText(outcome){ let board=null; let tab='board', openOrder=null, openToken=0; const boardFilter={product:'',machine:'',delivery:'',status:''}; +// Layout versions the server takes (app/core/models.py PRODUCTION_VERSIONS). +const LAYOUT_VERSIONS=[2,3]; let quoteKind='pending', pickedQuote=null; let quoteQuery='', quoteProduct='', quoteLayout='', quoteFlag='', quoteTimer=null; // Uploads that have an artwork picture (the customer's browser made it). Every @@ -1448,7 +1450,7 @@ function renderQuotes(){ meta.append(gradePill(lowestGrade(items)),productBadge(items),node('b',metres(quoteMetres(q)),'mtr'), place(q.draft.destination),node('span',ago(q.created_at),'age')); const flags=node('div',undefined,'flags'); - if(items.some(i=>i.production?.version!==2))flags.append(badge('Montagem antiga','bad','Peça uma nova cotação ao cliente')); + if(items.some(i=>!LAYOUT_VERSIONS.includes(i.production?.version)))flags.append(badge('Montagem antiga','bad','Peça uma nova cotação ao cliente')); else if(items.some(i=>i.quality_status==='warning'))flags.append(badge('! Ressalva aceita','warn','O cliente aceitou a ressalva de resolução')); if(!q.approved&&q.review_reason)flags.append(badge('! '+q.review_reason,'warn','Revisão manual: '+q.review_reason)); // Approved by the Site is the rule; only a person's review is worth a line. @@ -1482,7 +1484,7 @@ function review(quote){ if(quote.approved){const total=node('div',undefined,'qbig');total.append(node('span','Total'),node('b',money(quote.approved.total_cents)));head.append(total);} const content=node('div',undefined,'content'); const foot=node('div',undefined,'foot'); - if(quote.status==='pending_review'&"e.draft.items.some(item=>item.production?.version!==2)){ + if(quote.status==='pending_review'&"e.draft.items.some(item=>!LAYOUT_VERSIONS.includes(item.production?.version))){ content.append(node('p','Montagem antiga. Solicite uma nova cotação ao cliente.','muted')); card.append(head,content);return card; }