fix: a cancelled upload holds no reservation, an old ready sheet is flagged in the cart, the address check is guidance (DTF-WEB-14, 22, 24)
All checks were successful
Build and deploy / Validate source (push) Successful in 1m39s
Build and deploy / Integration suite on a real stack (push) Successful in 10m18s
Build and deploy / Secret scan and release gate (push) Successful in 16s
Build and deploy / Publish images (push) Successful in 2m33s

- 14: switching products cancelled the files being sent, but each one still
  waiting for a place opened its reservation when it got one, and none gave
  it back: 27 in ten seconds filled the cap of 30 (29/11). A cancelled upload
  now never starts, and one cancelled after starting gives its place back.
- 22: a ready sheet kept in the cart from before the 8 mm says so on its row
  and holds Pagar, instead of a refusal after the whole checkout.
- 24: "Preencha o endereço de entrega" is a warning, not an error.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-30 09:36:34 -03:00
parent 6ec0ea31a6
commit 9fc4d4e906
3 changed files with 33 additions and 5 deletions

View File

@@ -118,9 +118,18 @@ function invalidaItemAtual(){
pintaPedido();
}
function itemPodeEnviar(item){
if(semMargem(item)) return false;
return item.qualityStatus==='ok' || item.qualityStatus==='unverified' ||
(item.qualityStatus==='warning' && item.qualityAcknowledged===true);
}
// Uma folha pronta guardada no carrinho antes dos 8 mm entre as cópias
// (27/11/2026): o servidor a recusa no pagamento, então o carrinho diz já,
// no próprio item, para refazê-lo (Sentry DTF-WEB-22).
function semMargem(item){
if(!['file','uvfile','premium'].includes(item.modo) || !item.production?.placements) return false;
const ps=[...item.production.placements].sort((a,b)=>a.y_cm-b.y_cm);
return ps.some((p,i)=>i>0 && p.y_cm < ps[i-1].y_cm+ps[i-1].length_cm+MARGEM_FOLHA_CM-0.02);
}
// Os itens marcados no carrinho são os que vão para o pagamento; um item
// desmarcado fica guardado para depois. O item aberto no produto sempre vai.
function itensAPagar(){
@@ -209,7 +218,8 @@ function pintaPedido(){
' aria-label="Incluir '+escapeHTML(it.tit)+' no pagamento"></label>'+
'<span class="miniItem">'+(it.mini ? '<img src="'+escapeHTML(it.mini)+'" alt="">' : '<i>'+escapeHTML(it.ext||'')+'</i>')+
(it.arquivos>1 ? '<em>+'+(it.arquivos-1)+'</em>' : '')+'</span>'+
'<div class="nm2"><b>'+escapeHTML(it.tit)+'</b><span>'+escapeHTML(it.desc)+'</span></div>'+
'<div class="nm2"><b>'+escapeHTML(it.tit)+'</b><span>'+escapeHTML(it.desc)+'</span>'+
(semMargem(it)?'<span class="avisoF">O espaço entre as cópias passou a ser de 8 mm. Remova este item e adicione a folha de novo.</span>':'')+'</div>'+
'<div class="vl2">'+rs(it.total)+'</div>'+
'<button type="button" class="x" data-rmi="'+i+'" aria-label="Remover '+escapeHTML(it.tit)+'">'+icone('lixeira')+'<span>Remover</span></button></div>').join('');
$('itens').querySelectorAll('[data-sel]').forEach(c=>c.addEventListener('change',()=>{