feat: "Abrir e conferir", the print file full screen, in pieces (item 7)
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 4m28s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m17s

The card's "Abrir e conferir" opens the order's print file full screen
(Dropstar's third round, item 7): zoom up to 100% real (one file pixel, one
screen pixel), the position in cm, the order's files one after the other
without closing, and the background behind the transparency light, dark or
checkered, remembered (Dropstar, 2026-10-30). Closed in Arte recebida, it asks
"Está OK?": the class of each item, prefilled with the measure, then
"Mover para Arte conferida" (the final approved, the class kept, the card
moved) or "Tratar a arte".

A 15 m film is loaded like a map: while the PNG is written, its strips of
512 rows go to storage at 100% and at each halving (app/printtiles.py,
originals/tiles/<upload>/), and the viewer (web/kanban-viewer.js) fetches
only those on screen. They go when their file expires. Storing a print file
that fails is now an attempt like a failed render, not a claim held for an
hour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-03 20:10:03 -03:00
parent e3a5ad6fa0
commit 8b7d9f0bdb
12 changed files with 483 additions and 11 deletions

View File

@@ -1520,6 +1520,8 @@ function nextBox(order){
if(!may('produce')){note('O Designer confere e aprova o arquivo final.');body.push(contractionList(order));}
else{
const lead=st==='rec'||fixed, a=approveParts(order,lead);
// Item 7: open the file, then say whether it is OK.
if(st==='rec'){a.approve.classList.remove('pri');main.push(checkButton(order,'btn pri lg'));}
if(lead){if(a.files)body.push(a.files);note(a.text);body.push(contractionList(order));main.push(a.approve,...a.extra);}
else more.push(a.approve,...a.extra);
}
@@ -1711,6 +1713,52 @@ function finalDialog(order,ready,{replace=false}={}){
// where the folder is, to copy the whole path.
const TREAT_NOTE='Arte tratada';
const FOLDER_PATH_KEY='folder-path';
// ---- Abrir e conferir (item 7) ----------------------------------------------
// The print file full screen, in pieces (web/kanban-viewer.js); closed in
// Arte recebida, it asks whether the art is OK.
function checkButton(order,className='btn'){
const b=button('Abrir e conferir',()=>openCheck(order),className);b.prepend(svgIcon(IC.eye||IC.file,'i m'));return b;
}
async function openCheck(order){
const {files}=await api('/orders/'+order.id+'/view');
if(!files.length){say('Ainda não há arquivo para abrir.',true);return;}
openViewer(files,{title:'#'+order.number,onClose:()=>{
const now=board.orders.find(o=>o.id===order.id)||order;
if(now.state==='rec'&&!now.cancelled_at&&may('produce')&&mayMove('rec','tra'))isOk(now);}});
}
// "Está OK?" (Dropstar, 2026-10-29): the class of each item, prefilled with
// the measure, and the art either goes on to Arte conferida, its final
// approved and its class kept, or is treated (item 8).
function isOk(order){
const items=order.snapshot.items, ready=readyFinals(order);
const selects=items.map((item,index)=>{
const select=node('select');select.required=true;
const none=node('option','Escolha');none.value='';none.disabled=true;select.append(none);
for(const c of ['C1','C2','C3']){const o=node('option',c+', '+CLASS_NOTE[c]);o.value=c;select.append(o);}
select.value=contractionOf(order,index)||'';return select;});
const fields=selects.map((select,index)=>{const item=items[index];
return field(items.length>1?'Item '+(index+1)+', contração':'Contração',select,
item.stroke_class?'O site mediu '+item.stroke_class+', traço de '+item.stroke_px+' px':'O site não mediu esta arte');});
const missing=!finalDone(order)&&!ready.every(Boolean);
const treat=button('Tratar a arte',()=>{m.close();treatDialog(order);},'btn');
const m=formDialog('Está OK?',{host:$('drawer'),fields,left:[treat],label:'Mover para Arte conferida',
text:missing?'Falta o arquivo final de um item: trate a arte e envie o arquivo preparado.'
:'A arte chegou boa? Confira a contração e mova para Arte conferida.',
onsave:async()=>{
if(missing)throw new Error('Falta o arquivo final de um item.');
for(const [index,select] of selects.entries())
if(select.value!==contractionOf(order,index))
await api('/orders/'+order.id+'/contraction',{item_index:index,value:select.value});
if(!finalDone(order))
await api('/orders/'+order.id+'/final-files',{version:order.version,
files:ready.flatMap((r,i)=>r.files.map(f=>({item_index:i,upload_id:f.upload_id}))),note:'Conferido em Abrir e conferir'});
await load();
await move(board.orders.find(o=>o.id===order.id)||order,'tra');
say('Pedido #'+order.number+' em Arte conferida.');
}});
if(missing)m.box.querySelector('button.pri')?.setAttribute('disabled','');
}
function treatDialog(order){
const base=node('input');base.placeholder='Ex.: D:\\'+(FOLDER.handle?.name||'Pedidos');
const names={};
@@ -1868,6 +1916,7 @@ function itemCard(order,item,index){
}
item.uploads.forEach((uid,i)=>links.append(dl_(item.uploads.length>1?'Original '+(i+1):'Arquivo original',uid)));
if(spec?.placements){const m=button('Manifesto',()=>manifest(spec,contractionRecord(item,order.contraction?.[index])),'btn');m.prepend(svgIcon(IC.file,'i m'));links.append(m);}
if(row?.status==='ready')links.prepend(checkButton(order));
if(may('produce')&&!fix&&['rec','tra'].includes(order.state)&&(!row||row.status==='manual'||row.status==='failed')){
const again=button('Gerar de novo',async()=>{await api('/orders/'+order.id+'/print-files',{});await load();},'btn');again.prepend(svgIcon(IC.refresh,'i m'));links.append(again);}
info.append(links);