feat: review photo or video in Revisão (front 2)
All checks were successful
Build and deploy / Validate source (push) Successful in 8s
Build and deploy / Integration suite on a real stack (push) Successful in 6m4s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m6s

In Revisão the card gets "Revisar": a photo or a video of up to 30 s of
the printed sheet, from the computer's or the phone's camera in the
browser, or a file already recorded. It is attached to the order as
DTF-<n>-revisao-<seq> with when and who, kept 180 days, and copied by
the computers with the order folders to Kanban/Revisões/. A photo needs
1600 px on its longer side. An order above 1 m cannot reach Finalizado
without one. In Finalizado the customer's order page shows the photo.

The Revisor, Gestão and the administrators take it (capability
"inspect"). Dialogs opened from a card's face or the board (Revisar,
Editar tempos) now show over the page when the order panel is closed;
inside the closed panel they were invisible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-09 11:39:15 -03:00
parent 5aafd9ee91
commit b280e0cfa6
18 changed files with 725 additions and 22 deletions

View File

@@ -250,6 +250,24 @@ try{
await waitFor(async()=>(await savedFiles('1. Arte recebida')).some(n=>n.startsWith(early)&&!n.endsWith('.baixando')),'final file saved in Arte recebida',45000);
assert.equal((await savedFiles('2. Arte conferida')).some(n=>n.startsWith(early)),false);
}
if(state==='fin'){
// Above 1 m Finalizado needs the review photo (app/reviews.py). Take one
// with a canvas in the page and send it as the Revisor's dialog does.
const metres=await kanban.eval(`board.orders.find(o=>o.id==='${oid}').snapshot.items.reduce((t,i)=>t+Number(i.billed_metres),0)`);
if(metres>1){
await kanban.eval(`(async()=>{
const order=board.orders.find(o=>o.id==='${oid}');
const canvas=document.createElement('canvas');canvas.width=2000;canvas.height=1500;
const ctx=canvas.getContext('2d');ctx.fillStyle='#c04030';ctx.fillRect(0,0,2000,1500);
const blob=await new Promise(ok=>canvas.toBlob(ok,'image/jpeg',0.9));
const file=new File([blob],'revisao.jpg',{type:'image/jpeg'});
const uid=await dtfUpload(file,{api,startPath:'/orders/'+order.id+'/reviews/uploads',scope:'operator:review:'+order.id+':browser',progress:()=>{}});
await api('/orders/'+order.id+'/reviews',{upload_id:uid});
await load();
})()`);
await waitFor(()=>kanban.eval(`(board.orders.find(o=>o.id==='${oid}').reviews||[]).some(r=>r.kind==='photo')`),'review photo attached');
}
}
await waitFor(()=>kanban.eval(`!!document.querySelector('[data-order="${oid}"] [data-move="${state}"]')`),'move to '+title);
await kanban.click(`[data-order="${oid}"] [data-move="${state}"]`);
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='${state}'`),'transition '+state);
@@ -296,7 +314,7 @@ try{
await kanban.eval('syncFolder(true)');
await waitFor(async()=>!(await folders()).includes('3. Finalizado'),'old Finalizado folder removed',30000);
const tree=await folders();
for(const name of ['1. Arte recebida','2. Arte conferida','3. Imprimindo','4. Revisão','5. Finalizado','Recibos'])
for(const name of ['1. Arte recebida','2. Arte conferida','3. Imprimindo','4. Revisão','5. Finalizado','Recibos','Revisões'])
assert.ok(tree.includes(name),name+' missing from '+tree.join(', '));
}
}