feat: a ready sheet prints at its real size, centred on the film, with the customer's confirmation (Marcus, 2026-12-02)
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 7m55s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m43s

Replaces 7111995 (only 57,0 cm entered; a whole order of 56,5-56,9 cm
sheets was refused, DTF-WEB-2C). Marcus's rules, for Arquivo por metro,
Premium (57 cm) and UV (27 cm):
1. A known width up to the film (PNG recording 200 DPI or more, or a PDF
   page) enters at its real size, centred, billed by its real height.
2. Narrower: his warning before the cart, confirmation required
   (Imprimir no tamanho real / Enviar outro arquivo); recorded in the
   Prumo report ("cliente confirmou folha de 35,8 cm no tamanho real") and
   shown in the cart and payment summaries.
3. Wider than the film: refused with his message.
4. Unknown width: taken as the film's, DPI from the pixels; 200 or more
   with a confirmation, under 200 refused with the artes avulsas hint.
Within 0,1 cm of the film counts as the film. The server checks it all
again at checkout (sheet_width_issue, centred placement, size_confirmed).

Also ops.stretched_sheets: the ready-sheet orders since 16/10 laid out
wider than their real width (number, real width, factor), for Marcus.
Contract: output/revisao/contrato-folha-real.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-02 09:51:38 -03:00
parent 7af6c9797d
commit 41126a42fd
22 changed files with 634 additions and 153 deletions

View File

@@ -48,19 +48,65 @@ function recusa(lista){
: '<b>'+exts+' não entra aqui.</b> Artes avulsas só aceitam PNG com '+
'fundo transparente. Para CDR, AI ou PSD, exporte em PNG ou use <b>Arquivo por metro</b>.';
}
// Folha de 57 cm com largura real conhecida e diferente: sai da lista e o
// diálogo junta os arquivos, um por linha, até o cliente fechar.
function recusaLargura(nome, {cm, dpi}){
// Folha mais larga que o filme: sai da lista e o diálogo junta os arquivos,
// um por linha, até o cliente fechar.
function recusaLargura(nome, {cm}){
const dlg=$('larguraDlg'); if(!dlg) return;
const lista=$('larguraLista');
const li=document.createElement('li');
li.textContent=nome+': '+n1(cm)+' cm'+(dpi==null?'':' ('+dpi+' DPI)');
li.textContent=nome+': tem '+n1(cm)+' cm e não cabe em '+larguraFilme()+' cm.';
lista.appendChild(li);
$('larguraTit').textContent='A folha não cabe no filme de '+larguraFilme()+' cm';
const texto=$('larguraTxt');
if(texto) texto.textContent='Reduza no seu programa ou envie as artes separadas.';
const ok=$('larguraOk');
ok.onclick=()=>dlg.close();
dlg.onclose=()=>{ lista.textContent=''; const z=$('zona'); if(z) z.focus(); agendaAvaliacao(); };
if(!dlg.open){ dlg.showModal(); ok.focus(); }
}
// Uma folha por vez, na ordem em que chegaram. Uma folha que já saiu da lista
// (troca de modo, remoção) é pulada; confirmar segue para a próxima.
let filaTamanho=[], tamanhoAtual=null;
function proximaTamanho(){
const dlg=$('tamanhoDlg'); if(!dlg || dlg.open) return;
while(filaTamanho.length && (!folhas.includes(filaTamanho[0]) || !filaTamanho[0].med?.confirmar))
filaTamanho.shift();
const x=filaTamanho.shift();
if(!x || !MODOS[modo] || !ehFolha()){ tamanhoAtual=null; return; }
tamanhoAtual=x;
const md=x.med;
$('tamanhoTit').textContent=x.f.name;
if(md.confirmar==='estreita'){
$('tamanhoTxt').textContent='Sua folha tem '+n1(md.larg)+' cm de largura. '+
'Vamos imprimir no tamanho real, centralizada no filme de '+larguraFilme()+
' cm, e cobrar pela altura: '+fmtM(md.alt/100)+' m. Se quiser aproveitar a largura toda, '+
'remonte a folha com '+larguraFilme()+' cm no seu programa ou envie as artes separadas ('+
rs(PRECO[PAR[modo]]||PRECO[modo])+'/m) que nós encaixamos.';
$('tamanhoOk').textContent='Imprimir no tamanho real';
}else{
$('tamanhoTxt').textContent='Sua folha vai sair com '+larguraFilme()+' cm de largura e '+
n1(md.alt)+' cm de altura ('+md.dpiFolha+' DPI). Confirma?';
$('tamanhoOk').textContent='Confirmar';
}
$('tamanhoOk').className='ec-go';
dlg.showModal();
$('tamanhoOk').focus();
}
function resolveTamanho(acao){
const dlg=$('tamanhoDlg'), x=tamanhoAtual;
if(x && folhas.includes(x)){
if(acao==='confirmar') x.confirmado=true;
else folhas=folhas.filter(y=>y!==x);
pintaFolha();
}
tamanhoAtual=null;
if(dlg && dlg.open) dlg.close();
if(acao==='outro') $('inp').click();
setTimeout(proximaTamanho,0);
}
$('tamanhoDlg')?.addEventListener('cancel',e=>{ e.preventDefault(); resolveTamanho('cancelar'); });
$('tamanhoOk')?.addEventListener('click',()=>resolveTamanho('confirmar'));
$('tamanhoOutro')?.addEventListener('click',()=>resolveTamanho('outro'));
const Z=$('zona'), I=$('inp');
Z.addEventListener('click',()=>I.click());
Z.addEventListener('keydown',e=>{if(e.key==='Enter'||e.key===' '){I.click();e.preventDefault();}});
@@ -221,16 +267,23 @@ async function sel(fs){
if(md && md.rejected){
x.measurementError=md.reason; x.pct=null; pintaFolha(); return;
}
if(md && md.larguraErrada){
if(md && md.largaDemais){
if(folhas.includes(x)){
folhas=folhas.filter(y=>y!==x);
pintaFolha();
recusaLargura(x.f.name, md.larguraErrada);
recusaLargura(x.f.name, md.largaDemais);
}
return;
}
if(md && md.dpiFolha!=null && md.dpiFolha<DPI_RECUSA) return recusaFolha(x, md);
x.med=md; if(md) x.m=md.alt/100; x.pct=55; pintaFolha();
if(md && md.larguraDesconhecida && md.dpiFolha<DPI_MINIMO_FOLHA)
return recusaFolha(x, md);
x.med=md; if(md) x.m=md.alt/100; x.pct=55;
if(md && md.confirmar){
x.confirmado=false;
if(!filaTamanho.includes(x)) filaTamanho.push(x);
}
pintaFolha();
if(md && md.confirmar) proximaTamanho();
if(md && md.grande){
// Graded at once from its size in pixels. A PNG is then read as a
// stream into a small copy: the preview, and the sheet check.