fix: harden week-two ordering, artwork and operations
This commit is contained in:
@@ -8,7 +8,9 @@
|
||||
function avaliar(){
|
||||
if(ehFolha()){
|
||||
if(!folhas.length) return {pronto:false, falta:'Arraste sua folha montada para começar.'};
|
||||
const larga=folhas.find(x=>x.med && x.med.larg > larguraFilme()+0.5);
|
||||
const pdfInvalido=folhas.find(x=>x.measurementError);
|
||||
if(pdfInvalido) return {pronto:false, falta:pdfInvalido.f.name+': '+pdfInvalido.measurementError};
|
||||
const larga=folhas.find(x=>x.med && x.med.larg > larguraFilme());
|
||||
if(larga) return {pronto:false, falta:'A folha '+larga.f.name+' tem '+n1(larga.med.larg)+
|
||||
' cm e não cabe no filme de '+n1(larguraFilme())+' cm.'};
|
||||
const semMedida=folhas.filter(x=>!(x.m>0)).length;
|
||||
@@ -17,12 +19,14 @@ function avaliar(){
|
||||
metros=folhaTotalM();
|
||||
reencaixado=false;
|
||||
const ans=folhas.map(x=>x.an).filter(Boolean);
|
||||
if(!ans.length){
|
||||
// sem análise possível (PDF, CDR, PSD): não inventa nota
|
||||
const exts=[...new Set(folhas.map(f=>extDe(f.f.name)))].join(', ');
|
||||
if(ans.length!==folhas.length){
|
||||
// A nota precisa cobrir cada folha faturada. Uma folha sem análise não
|
||||
// herda a nota/desconto de outra folha que o navegador conseguiu abrir.
|
||||
const ausentes=folhas.filter(f=>!f.an);
|
||||
const exts=[...new Set(ausentes.map(f=>extDe(f.f.name)))].join(', ');
|
||||
mostraNota([
|
||||
['av','Sem nota · '+exts+' não abre no navegador',
|
||||
'não temos como conferir a arte antes de imprimir'],
|
||||
['av','Sem nota · '+exts+' sem análise completa',
|
||||
ausentes.length+' de '+folhas.length+' folha(s) precisam de conferência manual'],
|
||||
['er','Metro pela tabela · '+rs(TABELA[modo]),
|
||||
'exportando em PNG ou PDF, cai até '+rs(pisoEscada())],
|
||||
['fix','Alguém abre seu arquivo','a conferência é feita na mão, na sala']
|
||||
@@ -58,13 +62,18 @@ function avaliar(){
|
||||
return {pronto:true};
|
||||
}
|
||||
if(!artes.length) return {pronto:false, falta:'Arraste suas artes para começar.'};
|
||||
if(artes.some(a=>a.decodeError || !a.src || !(a.px>0) || !(a.py>0)))
|
||||
return {pronto:false, falta:'Não conseguimos ler uma das imagens. Exporte-a novamente em PNG ou JPG antes de continuar.'};
|
||||
if(artes.some(a=>!Number.isFinite(a.cm) || a.cm>larguraFilme()))
|
||||
return {pronto:false, falta:'A largura da arte precisa caber no filme de '+
|
||||
n1(larguraFilme())+' cm. Reduza a medida solicitada antes de continuar.'};
|
||||
const sem=artes.filter(a=>!a.cm).length;
|
||||
if(sem) return {pronto:false, falta:'Informe a largura de '+sem+' arte'+(sem>1?'s':'')+
|
||||
' para ver a nota e o preço.'};
|
||||
// metragem = altura da folha depois de montada, com os 5 mm entre peças
|
||||
metros=+(montagemCm/100).toFixed(4);
|
||||
if(!(metros>0)) return {pronto:false, falta:'Montando a folha…'};
|
||||
const notas=artes.map(a=>Math.max(6,Math.min(100,Math.round((a.px/(a.cm/2.54))/300*100))));
|
||||
const notas=artes.map(a=>Math.max(6,Math.min(100,Math.round(dpiDe(a)/300*100))));
|
||||
const media=Math.round(notas.reduce((s,n)=>s+n,0)/notas.length), pior=Math.min(...notas);
|
||||
mostraNota([
|
||||
['ok','Montagem por nossa conta','5 mm garantidos'],
|
||||
@@ -182,5 +191,8 @@ function ressalvaResolucao(){
|
||||
$('cienteOk').addEventListener('change',e=>{
|
||||
if($('ciente').classList.contains('recusa')) return; // recusa não se aceita
|
||||
$('qOk').disabled=!e.target.checked;
|
||||
if(itemAtual && itemAtual.qualityStatus==='warning'){
|
||||
itemAtual.qualityAcknowledged=e.target.checked;
|
||||
pintaEntrega();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user