Merge main into front-7a

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

# Conflicts:
#	.gitea/workflows/deploy.yml
This commit is contained in:
Cauê Faleiros
2026-11-09 15:40:55 -03:00
20 changed files with 701 additions and 18 deletions

View File

@@ -1426,6 +1426,8 @@ function renderPanel(order){
code.append(node('span','DTF-'+order.number,'code'),copyButton(fileCode(order),'Copiar “'+fileCode(order)+'”, o começo do nome dos arquivos deste pedido'));
const theirs=node('span','Código do cliente ','tip-l');theirs.append(node('span',orderCode(order.id),'code strong'));theirs.dataset.tip='O código que aparece para o cliente';
sub.append(paid,node('span','Entrou pelo '+(ORIGINS[order.origin]||order.origin)),code,theirs);
if(s.coupon && !order.proof_parent)
sub.append(badge('Cupom '+s.coupon.code,'','Desconto de '+money(s.coupon.discount_cents)));
if(isTest(order))sub.append(badge('Teste','','Pedido de teste: sem pagamento, não vai ao Tiny'));
if(stalled(order)&&!order.cancelled_at)sub.append(badge('Parado há '+hoursSince(order.updated_at)+' h','bad','Sem mudar de etapa desde '+when(order.updated_at)));
const steps=node('ol',undefined,'stepper');steps.setAttribute('aria-label','Etapas');
@@ -3275,6 +3277,30 @@ async function loadStats(){
node('td',String(s.samples),'r'));
if(!s.samples)tr.classList.add('off');
return tr;}));
// Coupons of the period (front 8.3): the page's sections live in the HTML,
// so this panel is built here once and kept beside "Pedidos sem pagamento".
let couponPanel=$('stats-coupons-panel');
if(!couponPanel){
couponPanel=node('section',undefined,'panel clip');couponPanel.id='stats-coupons-panel';
const head=node('div',undefined,'phead');head.append(node('h2','Cupons'));
const table=node('table',undefined,'table');
const thead=node('thead'),headRow=node('tr');
for(const [label,cls] of [['Cupom',''],['Pedidos','r'],['Metros','r'],['Desconto','r'],['Recebido','r']])
headRow.append(node('th',label,cls));
thead.append(headRow);
const tbody=node('tbody');tbody.id='stats-coupons';
table.append(thead,tbody);
couponPanel.append(head,node('p','Cupons usados pelos pedidos pagos do período.','phint'),table);
const anchor=$('stats-unpaid')?.closest('section');
if(anchor)anchor.after(couponPanel);else $('tab-stats').append(couponPanel);
}
const couponRows=data.coupons||[];
$('stats-coupons').replaceChildren(...(couponRows.length?couponRows.map(coupon=>{
const tr=node('tr');
tr.append(node('td',coupon.code),node('td',String(coupon.orders),'r'),
node('td',metres(coupon.metres).replace(' m',''),'r'),
node('td',money(coupon.discount_cents),'r'),node('td',money(coupon.cents),'r'));
return tr;}):[emptyRow('Nenhum cupom usado no período.',5)]));
}
const emptyRow=(text,span)=>{const tr=node('tr');const td=node('td',text,'empty');td.colSpan=span;tr.append(td);return tr;};
// Metres per day: one series of columns from one baseline, the period's