Merge review photo checks (DTF-WEB-B, C)
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 7m11s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m10s
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 7m11s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m10s
This commit is contained in:
@@ -265,6 +265,13 @@ function renderBoard(){
|
|||||||
const order=board.orders.find(o=>o.id===e.dataTransfer.getData('text/plain'));
|
const order=board.orders.find(o=>o.id===e.dataTransfer.getData('text/plain'));
|
||||||
const machine=state==='imp'?laneAt(column,e.clientY):null;markLane(column,null);
|
const machine=state==='imp'?laneAt(column,e.clientY):null;markLane(column,null);
|
||||||
if(!order)return;
|
if(!order)return;
|
||||||
|
// Above 1 m Finalizado needs the review photo: the drop opens Revisão
|
||||||
|
// instead of a refused move (Sentry DTF-WEB-B).
|
||||||
|
if(state==='fin'&&order.state==='rev'&&needsReviewPhoto(order)){
|
||||||
|
if(may('inspect')){say('Pedido acima de 1 m: tire a foto da revisão antes de finalizar.');reviewDialog(order);}
|
||||||
|
else say('Pedido acima de 1 m: falta a foto da revisão antes de finalizar.',true);
|
||||||
|
clearDrop();return;
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
if(order.state!==state)await (state==='imp'?pullTo(order,machine):move(order,state,'',machine));
|
if(order.state!==state)await (state==='imp'?pullTo(order,machine):move(order,state,'',machine));
|
||||||
else if(state!=='fin')await reorder(order,column,e.clientY);
|
else if(state!=='fin')await reorder(order,column,e.clientY);
|
||||||
|
|||||||
@@ -374,8 +374,7 @@ function nextBox(order){
|
|||||||
}else{
|
}else{
|
||||||
// Above 1 m the photo is required to finish (app/reviews.py): the main
|
// Above 1 m the photo is required to finish (app/reviews.py): the main
|
||||||
// button takes it instead of releasing the order.
|
// button takes it instead of releasing the order.
|
||||||
const hasPhoto=(order.reviews||[]).some(review=>review.kind==='photo');
|
if(needsReviewPhoto(order)){
|
||||||
if(!order.proof_parent&&orderMetres(order)>1&&!hasPhoto){
|
|
||||||
title='Tire a foto da revisão';
|
title='Tire a foto da revisão';
|
||||||
note('Pedido acima de 1 m: tire a foto da revisão antes de finalizar.');
|
note('Pedido acima de 1 m: tire a foto da revisão antes de finalizar.');
|
||||||
if(may('inspect'))main.push(button('Revisar',()=>reviewDialog(order),'btn pri lg'));else cannot();
|
if(may('inspect'))main.push(button('Revisar',()=>reviewDialog(order),'btn pri lg'));else cannot();
|
||||||
@@ -595,6 +594,18 @@ function cardOpenAction(order){
|
|||||||
// recorded. The server names it DTF-<n>-revisao-<seq> and keeps it 180 days.
|
// recorded. The server names it DTF-<n>-revisao-<seq> and keeps it 180 days.
|
||||||
const REVIEW_VIDEO_MAX=30;
|
const REVIEW_VIDEO_MAX=30;
|
||||||
const reviewClock=s=>Math.floor(s/60)+':'+String(s%60).padStart(2,'0');
|
const reviewClock=s=>Math.floor(s/60)+':'+String(s%60).padStart(2,'0');
|
||||||
|
// Above 1 m the order finishes only with a review photo (app/reviews.py), of
|
||||||
|
// at least REVIEW_PHOTO_MIN px on its longer side so the footer can be read.
|
||||||
|
const REVIEW_PHOTO_MIN=1600;
|
||||||
|
const needsReviewPhoto=order=>!order.proof_parent&&orderMetres(order)>1&&
|
||||||
|
!(order.reviews||[]).some(review=>review.kind==='photo');
|
||||||
|
const smallPhoto=(width,height)=>'A foto tem '+width+'×'+height+' px; a revisão precisa de pelo menos '+
|
||||||
|
REVIEW_PHOTO_MIN+' px no lado maior para ler o rodapé.';
|
||||||
|
// The photo's size, read in the browser before the upload (Sentry DTF-WEB-C).
|
||||||
|
async function photoSize(file){
|
||||||
|
try{const bitmap=await createImageBitmap(file);const size=[bitmap.width,bitmap.height];bitmap.close?.();return size;}
|
||||||
|
catch(_){return null;}
|
||||||
|
}
|
||||||
function reviewDialog(order){
|
function reviewDialog(order){
|
||||||
const host=dialogHost();
|
const host=dialogHost();
|
||||||
const video=node('video');video.className='reviewcam';video.muted=true;video.playsInline=true;video.autoplay=true;
|
const video=node('video');video.className='reviewcam';video.muted=true;video.playsInline=true;video.autoplay=true;
|
||||||
@@ -659,6 +670,8 @@ function reviewDialog(order){
|
|||||||
clear();
|
clear();
|
||||||
const width=video.videoWidth,height=video.videoHeight;
|
const width=video.videoWidth,height=video.videoHeight;
|
||||||
if(!width||!height){fail('A câmera ainda não está pronta. Espere um instante.');return;}
|
if(!width||!height){fail('A câmera ainda não está pronta. Espere um instante.');return;}
|
||||||
|
if(Math.max(width,height)<REVIEW_PHOTO_MIN){
|
||||||
|
fail(smallPhoto(width,height)+' Esta câmera não chega a isso: grave um vídeo, use o celular ou envie um arquivo.');return;}
|
||||||
const canvas=document.createElement('canvas');canvas.width=width;canvas.height=height;
|
const canvas=document.createElement('canvas');canvas.width=width;canvas.height=height;
|
||||||
canvas.getContext('2d').drawImage(video,0,0,width,height);
|
canvas.getContext('2d').drawImage(video,0,0,width,height);
|
||||||
canvas.toBlob(blob=>{
|
canvas.toBlob(blob=>{
|
||||||
@@ -704,7 +717,12 @@ function reviewDialog(order){
|
|||||||
try{await checkDuration(file);}catch(error){input.value='';fail(error.message);return;}
|
try{await checkDuration(file);}catch(error){input.value='';fail(error.message);return;}
|
||||||
if(closed)return;
|
if(closed)return;
|
||||||
showReady(file,'video');
|
showReady(file,'video');
|
||||||
}else showReady(file,'photo');
|
}else{
|
||||||
|
const size=await photoSize(file);
|
||||||
|
if(closed)return;
|
||||||
|
if(size&&Math.max(...size)<REVIEW_PHOTO_MIN){input.value='';fail(smallPhoto(size[0],size[1]));return;}
|
||||||
|
showReady(file,'photo');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
fileLabel.onkeydown=event=>{if(event.key==='Enter'||event.key===' '){event.preventDefault();input.click();}};
|
fileLabel.onkeydown=event=>{if(event.key==='Enter'||event.key===' '){event.preventDefault();input.click();}};
|
||||||
cancel.onclick=()=>m.close();
|
cancel.onclick=()=>m.close();
|
||||||
@@ -725,7 +743,8 @@ function reviewDialog(order){
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const m=modal('Revisão do #'+order.number,{host,width:640,
|
const m=modal('Revisão do #'+order.number,{host,width:640,
|
||||||
text:'Tire uma foto ou grave um vídeo de até 30 s da folha impressa, ou envie um arquivo.',
|
text:'Tire uma foto ou grave um vídeo de até 30 s da folha impressa, ou envie um arquivo. '+
|
||||||
|
'A foto precisa de pelo menos '+REVIEW_PHOTO_MIN+' px no lado maior.',
|
||||||
body:[video,controls,timer,preview],foot:[status,cancel,save],onclose:cleanup});
|
body:[video,controls,timer,preview],foot:[status,cancel,save],onclose:cleanup});
|
||||||
(async()=>{
|
(async()=>{
|
||||||
try{
|
try{
|
||||||
|
|||||||
Reference in New Issue
Block a user