feat: stroke class, residue per artwork, mixed strokes, sheets split by class
All checks were successful
Build and deploy / Validate source (push) Successful in 1m25s
Build and deploy / Integration suite on a real stack (push) Successful in 4m40s
Build and deploy / Secret scan and release gate (push) Successful in 12s
Build and deploy / Publish images (push) Successful in 1m38s

Round 3, items 9, 4, 16 and 17 (Dropstar, 2026-10-30).

- 9: the Site measures the thinnest stroke of each sheet and loose artwork
  (alpha > 40, chamfer distance in strips, width at local maxima, 1st
  percentile, at 300 DPI) and sends stroke_px and C1/C2/C3 with the item.
  The Kanban shows the class prefilled in the approve step; Produção may
  change it (POST /orders/{id}/contraction, who and when recorded), and the
  manifest carries it.
- 4: the residue check runs on each loose artwork, accepted per artwork; the
  sheet inherits what was accepted.
- 16: fine lines and solid areas in one file. Loose art: a pop-up with
  [Subir separado] [Continuar assim]. Ready sheet: protect the fine lines
  (default), protect the solid areas (stroke_choice client_c3, starts at C3)
  or go back and send two sheets, which holds the order.
- 17: loose art of fine (C1, C2) and solid (C3) strokes goes on separate
  sheets, each its own order item (split group/part/of) with its own file
  and class. Each sheet rounds to 10 cm and the 1 m minimum is charged once
  per group, since the customer did not choose the split. Cart, payment
  summary, portal, receipt and mail show it as such.
- The board loads quote views in two queries instead of two per quote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-03 10:24:29 -03:00
parent 388408d4d6
commit 2615163fd3
23 changed files with 547 additions and 57 deletions

View File

@@ -10,7 +10,43 @@
const residuoAceito=x=>!!(x.residuoAceito && x.an && x.an.residuos);
const folhaBarrada=x=>!!(x.an && !x.an.grande && (x.an.fundoChapado || (x.an.residuos && !residuoAceito(x))));
// Quantos pontos o cliente aceitou imprimir, somadas as folhas: vai no item.
const residuosAceitos=()=>folhas.filter(residuoAceito).reduce((t,x)=>t+x.an.residuos,0);
// the sheet of loose art inherits what each artwork accepted
const residuosDasArtes=lista=>lista.filter(a=>a.residuoAceito).reduce((t,a)=>t+((analiseDaArte(a)||{}).residuos||0),0);
const residuosAceitos=()=>ehFolha()
? folhas.filter(residuoAceito).reduce((t,x)=>t+x.an.residuos,0)
: residuosDasArtes(artes);
// Item 16 (Dropstar, 30/10/2026): traço fino e área chapada no mesmo arquivo,
// com ajustes de branco diferentes. Dispara com o traço mais fino até 19 px e
// pelo menos 20% da tinta em áreas de 20 px ou mais.
const mista=t=>!!(t && t.px<=19 && t.largos>=0.2);
// Numa arte avulsa, o aviso uma vez por arte: subir em dois arquivos, ou
// seguir protegendo os traços finos.
function perguntaMista(){
const dlg=$('mistaDlg');
if(!dlg || dlg.open) return;
const a=artes.find(x=>!x.mistaVista && mista(tracoDaArte(x)));
if(!a) return;
a.mistaVista=true;
$('mistaTit').textContent=a.f.name;
$('mistaSep').onclick=()=>{ dlg.close(); const i=artes.indexOf(a); if(i>=0){ artes.splice(i,1); pintaArtes(); } $('inp').click(); };
$('mistaSegue').onclick=()=>{ dlg.close(); agendaAvaliacao(); };
dlg.showModal();
}
// Numa folha pronta, a escolha fica na folha: proteger os traços finos (a
// medida), as áreas chapadas (C3), ou voltar e mandar duas folhas.
const folhaMista=()=>ehFolha() && folhas.some(x=>mista(x.an && x.an.traco));
const escolhaMista=()=>(document.querySelector('input[name=mistaEsc]:checked')||{}).value||'finos';
// O traço mais fino do item (item 9, Dropstar 30/10/2026): o menor entre as
// folhas que o navegador mediu. Não aparece para o cliente; vai para a sala,
// que confere a classe de contração ao aprovar o arquivo final.
function tracoDoItem(lista){
const medidas=(lista?lista.map(tracoDaArte):ehFolha()?folhas.map(x=>x.an&&x.an.traco):artes.map(tracoDaArte)).filter(Boolean);
if(!medidas.length) return {strokePx:null, strokeClass:null, strokeChoice:null};
const fino=medidas.reduce((a,b)=>b.px<a.px?b:a);
// A folha mista em que o cliente escolheu proteger as áreas chapadas vai como C3.
const chapadas=folhaMista() && escolhaMista()==='chapadas';
return {strokePx:fino.px, strokeClass:fino.classe, strokeChoice:folhaMista()?(chapadas?'client_c3':'measured'):null};
}
// Avalia sozinho conforme o cliente sobe e preenche. Devolve o que ainda falta,
// para a fila dizer em texto em vez de travar num botão.
function avaliar(){
@@ -28,6 +64,9 @@ function avaliar(){
// (Dropstar, 21/10/2026): então o pedido espera a conferência terminar.
const lendo=folhas.find(x=>x.pct!=null);
if(lendo) return {pronto:false, falta:'Conferindo '+lendo.f.name+'…'};
$('mistaFolha').hidden=!folhaMista();
if(folhaMista() && escolhaMista()==='duas')
return {pronto:false, falta:'Separe os traços finos e as áreas chapadas em duas folhas e envie de novo.'};
const barrada=folhas.find(folhaBarrada);
if(barrada) return {pronto:false, falta:barrada.an.fundoChapado
? barrada.f.name+' está sem fundo transparente. Exporte a folha com fundo transparente, em PNG ou PDF, e envie de novo.'
@@ -87,6 +126,14 @@ function avaliar(){
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.'};
// Item 4: a dot under 2 mm in a loose artwork holds the order like on a
// sheet, until the customer erases it or accepts printing that artwork so.
if(artes.some(a=>a.lendoArte)) return {pronto:false, falta:'Conferindo as artes…'};
const comPontos=artes.find(a=>{const an=analiseDaArte(a);return an&&an.residuos&&!a.residuoAceito;});
if(comPontos){const n=analiseDaArte(comPontos).residuos;
return {pronto:false, falta:comPontos.f.name+' tem '+n+' ponto'+(n>1?'s':'')+
' de recorte. Apague e envie de novo, ou marque que aceita imprimir assim.'};}
setTimeout(perguntaMista);
// 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…'};
@@ -207,6 +254,8 @@ function ressalvaResolucao(){
'</div>').join('')+'</div>';
box.className='ciente on'; chk.checked=false; $('qOk').disabled=true;
}
// A escolha da folha mista muda o item (C3 ou não) e pode barrar o pedido.
document.querySelectorAll('input[name=mistaEsc]').forEach(r=>r.addEventListener('change',agendaAvaliacao));
$('cienteOk').addEventListener('change',e=>{
if($('ciente').classList.contains('recusa')) return; // recusa não se aceita
$('qOk').disabled=!e.target.checked;