feat: the proof's photo or video opens beside Prova OK and from its order, also after the answer
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 6m43s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m11s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 6m43s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m11s
Marcus could not reach the review photo of the proof of #30 (card #31): in Revisão it sat at the end of the card's Pedido tab, away from the answer, and once the seller answered, the card left the board and the photo with it. - The board sends each order's proof card with its photos and videos. - "Responder a prova" has "Ver foto" / "Ver vídeo" beside Prova OK, or says the Revisor has not sent one yet. - The parent shows a Prova section (the card, its answer, who and when) with the same buttons, and "Aguardando prova" offers them too. - The viewer drops the print-file line for a review photo and reports a photo it could not load, in red and to Sentry. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -268,12 +268,17 @@ function nextBox(order){
|
||||
note(manual?'O Prumo não abriu o original. Prepare o PNG completo deste pedido; a prova será gerada automaticamente a partir dele.'
|
||||
:'O pedido segue para Arte conferida após Prova OK no card da prova. Você pode abrir o arquivo para consultar.');
|
||||
if(manual&&may('produce'))main.push(button('Preparar arquivo para a prova',()=>finalDialog(order,readyFinals(order)),'btn pri lg'));
|
||||
if(order.proof_card.reviews?.length)more.push(...reviewButtons(order.proof_card.id,order.proof_card.reviews,order.proof_card.number));
|
||||
return composeNext(title,body,main,more);
|
||||
}
|
||||
// A proof card in Revisão waits for its answer (Dropstar, 2026-11-03).
|
||||
if(order.proof_parent&&st==='rev'){
|
||||
title='Responder a prova';
|
||||
note('Prova do pedido #'+order.proof_parent.number+'. Com a prova impressa conferida'+(order.snapshot.proof?' e o aceite do cliente':'')+', responda aqui.');
|
||||
// The photo or video the answer rests on, beside the answer (Marcus, 2026-11-17).
|
||||
const media=order.reviews||[];
|
||||
if(media.length)main.push(...reviewButtons(order.id,media,order.number));
|
||||
else note('A foto ou o vídeo da prova ainda não foi enviado: o Revisor envia em “Revisar”, no card.');
|
||||
if(may('proof')){main.push(button('Prova OK',()=>proofAnswer(order,'ok'),'btn pri lg'));
|
||||
more.push(button('Prova reprovada',()=>proofReject(order),'btn quiet lg'));}
|
||||
else note('Quem responde é o Vendedor, a Gestão ou o Administrador.');
|
||||
@@ -899,8 +904,42 @@ function treatDialog(order){
|
||||
paint();
|
||||
})();
|
||||
}
|
||||
// The reviews recorded on the order: what was checked, when and by whom. A
|
||||
// photo opens in the viewer; a video cannot, so it opens in a new tab. In
|
||||
// A review's photo opens in the viewer; a video cannot, so it opens in a new
|
||||
// tab. `orderId` is the order it was taken on: a proof's is its proof card.
|
||||
async function openReview(orderId,review,number){
|
||||
const view=await api('/orders/'+orderId+'/reviews/'+review.id+'/view');
|
||||
if(review.kind==='photo'&&window.openViewer)openViewer([{name:view.name,picture:view.url,photo:true}],{title:'Revisão #'+number});
|
||||
else{const link=node('a');link.href=view.url;link.target='_blank';link.rel='noopener noreferrer';link.click();}
|
||||
}
|
||||
// "Ver foto" / "Ver vídeo", one per review, numbered when there are several.
|
||||
function reviewButtons(orderId,reviews,number,className='btn lg'){
|
||||
const count={photo:0,video:0};
|
||||
for(const review of reviews)count[review.kind]++;
|
||||
return reviews.map(review=>{
|
||||
const b=button((review.kind==='video'?'Ver vídeo':'Ver foto')+(count[review.kind]>1?' '+review.seq:''),
|
||||
()=>openReview(orderId,review,number),className);
|
||||
b.prepend(svgIcon(review.kind==='video'?IC.camera:IC.eye||IC.file,'i m'));return b;});
|
||||
}
|
||||
// The order's proof (app/proof.py): its card, where it stands or its answer,
|
||||
// and the photo or video it was answered on. An answered card leaves the
|
||||
// board, so this is where its media stays (Marcus, 2026-11-17, the proof of #30).
|
||||
function proofSection(order){
|
||||
const card=order.proof_card;
|
||||
if(!card)return null;
|
||||
const box=node('section',undefined,'reviewsec');box.setAttribute('aria-label','Prova');
|
||||
const info=node('div',undefined,'iinfo');
|
||||
const answer=card.proof_result==='ok'?'Prova OK':card.proof_result==='rejected'?'Prova reprovada':
|
||||
'Aguardando a resposta'+(card.state==='rev'?', em Revisão':'');
|
||||
info.append(node('span','Prova','lbl'),node('h3','Prova do #'+card.number+' · '+answer));
|
||||
if(card.proof_result)info.append(node('p',(card.proof_decided_by||'')+' · '+when(card.proof_decided_at)+
|
||||
(card.proof_reason?' · '+card.proof_reason:''),'nnote'));
|
||||
const media=card.reviews||[];
|
||||
if(media.length){const row=node('div',undefined,'nact proofmedia');row.append(...reviewButtons(card.id,media,card.number,'btn'));info.append(row);}
|
||||
else info.append(node('p',card.proof_result?'Nenhuma foto ou vídeo foi enviado na prova.':'A foto ou o vídeo da prova entra quando o Revisor enviar.','nnote'));
|
||||
box.append(info);
|
||||
return box;
|
||||
}
|
||||
// The reviews recorded on the order: what was checked, when and by whom. In
|
||||
// Revisão a reviewer may remove one.
|
||||
function reviewSection(order){
|
||||
if(!order.reviews?.length)return null;
|
||||
@@ -914,11 +953,7 @@ function reviewSection(order){
|
||||
open.append(node('span','Revisão · '+(review.kind==='video'?'vídeo':'foto')+' · '+
|
||||
when(review.created_at)+' · '+review.created_by));
|
||||
open.onclick=async()=>{
|
||||
try{
|
||||
const view=await api('/orders/'+order.id+'/reviews/'+review.id+'/view');
|
||||
if(review.kind==='photo'&&window.openViewer)openViewer([{name:view.name,picture:view.url}],{title:'Revisão #'+order.number});
|
||||
else{const link=node('a');link.href=view.url;link.target='_blank';link.rel='noopener noreferrer';link.click();}
|
||||
}catch(error){say(error.message,true);}
|
||||
try{await openReview(order.id,review,order.number);}catch(error){say(error.message,true);}
|
||||
};
|
||||
row.append(open);
|
||||
if(order.state==='rev'&&may('inspect')){
|
||||
@@ -941,6 +976,7 @@ function orderView(order){
|
||||
const s=order.snapshot;
|
||||
s.items.forEach((item,index)=>view.append(itemCard(order,item,index)));
|
||||
view.append(orderFacts(order));
|
||||
const proof=proofSection(order);if(proof)view.append(proof);
|
||||
const reviews=reviewSection(order);if(reviews)view.append(reviews);
|
||||
if(order.reworks?.length)view.append(reworkSection(order));
|
||||
return view;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
width at the zoom shown (app/printtiles.py), only those on screen.
|
||||
|
||||
openViewer(files, {title, onClose}): files are [{name, label, manifest,
|
||||
picture}], each with its strips' manifest (and their urls), or only a
|
||||
picture when it has none. */
|
||||
picture, photo}], each with its strips' manifest (and their urls), or only a
|
||||
picture when it has none; `photo` marks a review photo, which is whole. */
|
||||
(function(){
|
||||
const BG_KEY='dtf-viewer-bg';
|
||||
const BACKGROUNDS=[['light','Claro'],['dark','Escuro'],['check','Xadrez']];
|
||||
@@ -103,8 +103,15 @@
|
||||
for(const b of tabs.children)b.setAttribute('aria-pressed',String(b===tab));
|
||||
name.textContent=title?title+' · '+f.name:f.name;
|
||||
if(!f.manifest){
|
||||
note.textContent=f.picture?'Este arquivo não tem os pedaços para 100%: veja a prévia ou baixe o arquivo.':'Este arquivo não tem prévia: baixe para conferir.';
|
||||
if(f.picture){try{const r=await fetch(f.picture);picture=await createImageBitmap(await r.blob());}catch(_){}}
|
||||
// A review photo is the whole picture; a print file without pieces is only its preview.
|
||||
note.textContent=f.photo?'':f.picture?'Este arquivo não tem os pedaços para 100%: veja a prévia ou baixe o arquivo.':'Este arquivo não tem prévia: baixe para conferir.';
|
||||
if(f.picture){
|
||||
try{const r=await fetch(f.picture);if(!r.ok)throw new Error('erro '+r.status);picture=await createImageBitmap(await r.blob());}
|
||||
catch(e){
|
||||
const text='Não foi possível abrir '+(f.photo?'a foto':'a prévia')+' '+f.name+' ('+e.message+').';
|
||||
note.textContent=text;window.dtfObservability?.uiError?.(text,'kanban');
|
||||
}
|
||||
}
|
||||
}
|
||||
zoom=fitZoom();x=0;y=0;clamp();zoomText.textContent=Math.round(zoom*100)+'%';draw();
|
||||
}
|
||||
|
||||
@@ -313,6 +313,7 @@ main{padding:0}
|
||||
.modal.reviewdialog .dfoot{padding-top:14px;border-top:1px solid var(--ln)}
|
||||
.reviewlist{display:flex;flex-direction:column;max-height:220px;overflow:auto;border-top:1px solid var(--ln)}
|
||||
.reviewsec{padding-top:22px;border-top:1px solid var(--ln)}
|
||||
.proofmedia{margin-top:10px}
|
||||
.reviewrow{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--ln)}
|
||||
.reviewopen{flex:1;min-width:0;padding:5px 2px;border:0;background:none;color:var(--tx);font:inherit;font-size:13px;text-align:left;cursor:pointer}
|
||||
.reviewopen:hover,.reviewopen:focus-visible{color:var(--acc)}
|
||||
|
||||
Reference in New Issue
Block a user