fix: review of round 5 against its contracts: a hand-added stamp never joins a referenced line, an open preview reminds only in Arte recebida, previews in the history, the proof in Minha conta

Found re-reading A1-D6 with the interaction contracts: Adicionar merged
into a pasted line and printed its reference; a preview left open after
the card moved or was cancelled kept its flag and the 3 h reminder; the
reject reason said it stays in the history, which only listed moves; the
"com prova" summary (B3) was missing in Minha conta; removing every
line kept the pasted list's batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-30 15:03:02 -03:00
parent 9e0d33ef47
commit 28c10aabf6
4 changed files with 14 additions and 2 deletions

View File

@@ -30,7 +30,9 @@ const contactWho=order=>(order.contact_by||'')+' em '+when(order.contact_since);
// The redesign previews of an order: each one is sent to the customer and // The redesign previews of an order: each one is sent to the customer and
// waits for the answer; the card counts them. // waits for the answer; the card counts them.
const previewsOf=order=>order.previews||[]; const previewsOf=order=>order.previews||[];
const openPreview=order=>previewsOf(order).find(p=>!p.decided_at)||null; // Only a card still in Arte recebida waits for a preview: one left open when
// the card moved on or was cancelled neither shows nor reminds anyone.
const openPreview=order=>order.state==='rec'&&!order.cancelled_at?previewsOf(order).find(p=>!p.decided_at)||null:null;
const previewApproved=order=>previewsOf(order).some(p=>p.result==='approved'); const previewApproved=order=>previewsOf(order).some(p=>p.result==='approved');
// A preview waiting three hours or more reminds the designer, once per block. // A preview waiting three hours or more reminds the designer, once per block.
function remindPreviews(orders){ function remindPreviews(orders){

View File

@@ -667,6 +667,7 @@ function montarPaintLines(){
function montarRemoveLine(line){ function montarRemoveLine(line){
URL.revokeObjectURL(line.url); URL.revokeObjectURL(line.url);
MONTAR.lines=MONTAR.lines.filter(other=>other!==line); MONTAR.lines=MONTAR.lines.filter(other=>other!==line);
if(!MONTAR.lines.length)MONTAR.batch=null;
montarChanged(); montarChanged();
} }
function montarClear(){ function montarClear(){
@@ -693,7 +694,9 @@ async function montarAdd(){
if(found.widthCm>56)return say('A estampa tem '+cm(found.widthCm)+' cm de largura: o máximo é 56 cm.'); if(found.widthCm>56)return say('A estampa tem '+cm(found.widthCm)+' cm de largura: o máximo é 56 cm.');
const dpi=montarDpi(found); const dpi=montarDpi(found);
if(dpi<MONTAR_DPI_REFUSE)return say('A estampa tem só '+Math.floor(dpi)+' DPI em '+size.letter+': pequena demais.'); if(dpi<MONTAR_DPI_REFUSE)return say('A estampa tem só '+Math.floor(dpi)+' DPI em '+size.letter+': pequena demais.');
const existing=MONTAR.lines.find(line=>line.code===code&&line.letter===size.letter); // A line from a pasted list carries its reference printed under the stamp:
// a stamp added by hand never joins it.
const existing=MONTAR.lines.find(line=>line.code===code&&line.letter===size.letter&&!line.ref);
if(existing){existing.qty=Math.min(9999,existing.qty+qty);montarChanged();return;} if(existing){existing.qty=Math.min(9999,existing.qty+qty);montarChanged();return;}
const url=URL.createObjectURL(found.file),picture=montarStampImage(url); const url=URL.createObjectURL(found.file),picture=montarStampImage(url);
MONTAR.lines.push({id:++MONTAR.seq,code,letter:size.letter,widthCm:found.widthCm,qty, MONTAR.lines.push({id:++MONTAR.seq,code,letter:size.letter,widthCm:found.widthCm,qty,

View File

@@ -1301,6 +1301,11 @@ function historyView(order,rows,view){
}; };
for(const r of [...rows].reverse())list.append(entry(r.back?'Voltou para '+stateName(r.to_state):stateName(r.to_state), for(const r of [...rows].reverse())list.append(entry(r.back?'Voltou para '+stateName(r.to_state):stateName(r.to_state),
r.operator+(r.machine?', na '+r.machine:''),r.created_at,r.reason)); r.operator+(r.machine?', na '+r.machine:''),r.created_at,r.reason));
// The Redesenho previews (D2), newest first, like the moves above.
for(const p of [...previewsOf(order)].reverse()){
if(p.decided_at)list.append(entry('Prévia '+p.number+(p.result==='approved'?' aprovada':' reprovada'),p.decided_by,p.decided_at,p.reason));
list.append(entry('Prévia '+p.number+' enviada',p.sent_by,p.sent_at,''));
}
for(const item of order.snapshot.items){ for(const item of order.snapshot.items){
if(item.residue_accepted_at)list.append(entry('Resíduo aceito','cliente',item.residue_accepted_at, if(item.residue_accepted_at)list.append(entry('Resíduo aceito','cliente',item.residue_accepted_at,
item.residue_accepted+' pontos')); item.residue_accepted+' pontos'));

View File

@@ -205,6 +205,8 @@ function itensPedido(snapshot){
li.append(node('span',nomeItem(item),'nome'),node('span',metros(item.billed_metres),'qt'),node('b',money(item.total_cents))); li.append(node('span',nomeItem(item),'nome'),node('span',metros(item.billed_metres),'qt'),node('b',money(item.total_cents)));
ul.append(li); ul.append(li);
} }
// The proof the customer asked for (Rodada 5, B3).
if(snapshot.proof){const li=node('li',null,'frete');li.append(node('span','Prova antes de imprimir','nome'),node('span','','qt'),node('b','Grátis'));ul.append(li);}
const f=snapshot.freight; const f=snapshot.freight;
if(f&&f.total_cents){const li=node('li',null,'frete');li.append(node('span','Frete','nome'),node('span',f.days?'até '+f.days+' dias úteis':'','qt'),node('b',money(f.total_cents)));ul.append(li);} if(f&&f.total_cents){const li=node('li',null,'frete');li.append(node('span','Frete','nome'),node('span',f.days?'até '+f.days+' dias úteis':'','qt'),node('b',money(f.total_cents)));ul.append(li);}
return ul; return ul;