feat: the art grade becomes configurable, off by default (front 8.5)
Gestão sets in the Site tab below which grade the designer is warned and below which the designer treatment is required (only while it is offered). The decision is stored with the approved quote, so a later change never rewrites old orders; the card shows 'Nota N: conferir a arte', the Site forces the treatment box with the reason. With no rule nothing changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,32 @@ function limpaPaineis(){
|
||||
if(!pedido.length){ $('carr').classList.remove('on'); }
|
||||
}
|
||||
|
||||
// Front 8.5: when the worst grade of the paying items is below the rule and
|
||||
// the treatment is offered, the designer's treatment is required.
|
||||
function mostraAvisoTratamento(texto){
|
||||
const box=$('tratamentoBox'); if(!box)return;
|
||||
let el=$('tratamentoAviso');
|
||||
if(!el){el=document.createElement('p');el.id='tratamentoAviso';el.className='avisoF';box.append(el);}
|
||||
el.textContent=texto;el.hidden=!texto;
|
||||
}
|
||||
function aplicaTratamento(aPagar){
|
||||
const box=$('tratamentoBox'), check=$('fTratamento');
|
||||
if(!box||!check)return;
|
||||
const offered=TAXA_TRATAMENTO>0;
|
||||
const rule=Number(window.dtfGradeRules?.tratamento)||0;
|
||||
const grades=aPagar.map(it=>Number(it.nota)||0);
|
||||
const worst=grades.length?Math.min(...grades):null;
|
||||
const required=offered&&rule>0&&worst!==null&&worst<rule;
|
||||
box.hidden=!offered;
|
||||
if(!offered){
|
||||
check.checked=false;check.disabled=false;mostraAvisoTratamento('');
|
||||
}else if(required){
|
||||
check.checked=true;check.disabled=true;
|
||||
mostraAvisoTratamento('Sua arte tem nota '+worst+': para imprimir com qualidade, o tratamento pelo designer é obrigatório neste pedido.');
|
||||
}else{
|
||||
check.disabled=false;mostraAvisoTratamento('');
|
||||
}
|
||||
}
|
||||
// O carrinho junta itens de produtos diferentes e cobra uma vez só.
|
||||
function pintaPedido(){
|
||||
const aPagar = itensAPagar();
|
||||
@@ -51,6 +77,7 @@ function pintaPedido(){
|
||||
aviso.hidden=false;
|
||||
}else{aviso.hidden=true;aviso.textContent='';}
|
||||
}
|
||||
aplicaTratamento(aPagar);
|
||||
$('itens').innerHTML = pedido.map((it,i)=>
|
||||
'<div class="item'+(it.marcado===false?' fora':'')+'">'+
|
||||
'<label class="marca"><input type="checkbox" data-sel="'+i+'"'+(it.marcado===false?'':' checked')+
|
||||
@@ -93,8 +120,6 @@ function pintaPedido(){
|
||||
// The proof is only for orders above 10 m (Dropstar, 2026-10-28): below it the box is gone.
|
||||
const prova=$('fProva');
|
||||
if(prova){ const longo=aPagar.reduce((t,it)=>t+(it.cob||0),0)>10; prova.closest('.cxE').hidden=!longo; if(!longo) prova.checked=false; }
|
||||
const tratamentoBox=$('tratamentoBox');
|
||||
if(tratamentoBox){tratamentoBox.hidden=!(TAXA_TRATAMENTO>0);if(tratamentoBox.hidden)$('fTratamento').checked=false;}
|
||||
$('bPagar').disabled = !cartPodeEnviar() || !entrega.cotado || !clienteOk() || !enderecoOk();
|
||||
if(pedido.length || itemAtual) $('carr').classList.add('on');
|
||||
if($('cartN')){ $('cartN').textContent=noCarrinho>99?'99+':noCarrinho; $('cartN').hidden=!noCarrinho;
|
||||
|
||||
Reference in New Issue
Block a user