feat: montador Interno and Venda, Tiny customers, brand per stamp (front 7a.3, Marcus 10/11)
Interno: the Expedição assembles the marketplace's own sales on the fixed internal customer Gestão fills in once; no Tiny order, no paid e-mail, marked interno, it stays in house. Venda: a Vendedor or Gestão picks the customer from the Tiny base and the order goes to Tiny like an approved quote, faturado (Boleto from TINY_RECEIPT_BOLETO when set), pickup or 'junto com o pedido de roupa nº X'. Números counts both at table price, apart from cash (and the average ticket over cash orders only). Each stamp can carry a brand and a public flag for the future catalogue. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1114,6 +1114,8 @@ function card(order,place){
|
||||
row.append(node('span','#'+order.number,'num'),originTag(order),age);
|
||||
const name=node('span',who.title,'cname');name.title=[who.legal,who.mail].filter(Boolean).join(' · ')||who.title;
|
||||
const meta=node('span',undefined,'cmeta');meta.append(node('span',productLine(s.items)));
|
||||
const special=specialDelivery(s);
|
||||
if(special){const tag=node('span',special,'origin');tag.title=special;meta.append(tag);}
|
||||
if(order.machine){const m=node('span',order.machine.name,'mach'+(mine?' mine':''));m.title=mine?'Sua máquina':'Máquina';meta.append(m);}
|
||||
meta.append(node('b',metres(orderMetres(order)),'mtr'));
|
||||
info.append(row,name,meta);
|
||||
@@ -1141,8 +1143,10 @@ function miniCard(order){
|
||||
const name=node('span',who.title,'cname');name.title=who.mail||who.title;
|
||||
let text,ic=IC.check,warn=false;
|
||||
const days=Math.floor((Date.now()-new Date(order.updated_at))/86400000);
|
||||
const special=specialDelivery(order.snapshot);
|
||||
if(order.cancelled_at){text='Cancelado';ic=IC.ban;warn=true;}
|
||||
else if(order.picked_up_at)text='Retirado';
|
||||
else if(special){text=special;ic=IC.box;}
|
||||
else if(order.snapshot.destination){text='Entrega, '+order.snapshot.destination.city+'/'+order.snapshot.destination.state;ic=IC.truck;}
|
||||
else if(days>=PICKUP_WARN_DAYS){text='Não retirado, '+plural(days,'dia','dias');ic=IC.bag;warn=true;}
|
||||
else{text='Aguardando retirada';ic=IC.bag;}
|
||||
@@ -1425,7 +1429,7 @@ function renderPanel(order){
|
||||
// A proof card is no sale (app/proof.py): it says whose proof it is.
|
||||
if(order.proof_parent)paid.append(node('b','Prova do pedido #'+order.proof_parent.number),', sem custo, criada em '+when(order.created_at));
|
||||
else paid.append(node('b',money(s.total_cents)),isTest(order)?' sem pagamento, '+when(order.created_at):
|
||||
paidOutside(order)?' pago fora do site ('+PAID_OUTSIDE[order.payment.method]+'), registrado em '+when(order.created_at):' pago em '+when(order.created_at));
|
||||
paidOutside(order)?' pago fora do site ('+(PAID_OUTSIDE[order.payment.method]||order.payment.method)+'), registrado em '+when(order.created_at):' pago em '+when(order.created_at));
|
||||
const code=node('span',undefined,'chip');
|
||||
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';
|
||||
@@ -1822,6 +1826,10 @@ function pickupDialog(order){
|
||||
}
|
||||
// Pickup or delivery, from the freight the customer chose.
|
||||
const isPickup=order=>order.snapshot.freight?.service==='pickup';
|
||||
// An internal order stays in house, and a sale can travel with the customer's
|
||||
// clothing order (Fase 2, front 7a.3): the card and the panel say so instead
|
||||
// of "Retirada".
|
||||
const specialDelivery=s=>s.kind==='interno'?'Interno':s.with_order?'Junto com o pedido de roupa nº '+s.with_order:null;
|
||||
// ---- Final files: the file each item is printed from, approved by an operator.
|
||||
const finalDone=order=>order.snapshot.items.every((_,index)=>(order.final_items||[]).includes(index));
|
||||
const treatmentDone=order=>order.snapshot.items.every((_,index)=>order.treated?.items?.includes(index));
|
||||
@@ -2230,7 +2238,7 @@ function phoneFacts(order){
|
||||
const box=node('div',undefined,'mblock mfacts');
|
||||
const row=(k,v)=>{if(!v)return;const r=node('div',undefined,'mfact');r.append(node('span',k),node('b',v));box.append(r);};
|
||||
row('Cliente',who.title);row('E-mail',s.customer.mail);row(docKind(s.customer.cnpj),cnpj(s.customer.cnpj));
|
||||
row('Entrega',dest?dest.city+'/'+dest.state:'Retirada em Franca');
|
||||
row('Entrega',specialDelivery(s)||(dest?dest.city+'/'+dest.state:'Retirada em Franca'));
|
||||
row('Máquina',order.machine?.name||'Nenhuma');row('Código','DTF-'+order.number+', cliente '+orderCode(order.id));
|
||||
// Choosing the machine stays where it is allowed.
|
||||
if(may('print')&&ME?.role!=='operador'&&board.machines?.length){const m=machineCard(order).querySelector('select');if(m)box.append(m);}
|
||||
@@ -2246,9 +2254,10 @@ function orderFacts(order){
|
||||
client.append(node('span','Cliente','lbl'),title,...(who.mail?[node('span',who.mail)]:[]),doc);
|
||||
const zap=whatsappLink(s.customer.zap);
|
||||
if(zap){const a=node('a','Abrir conversa','btn lnk');a.href=zap;a.target='_blank';a.rel='noopener noreferrer';a.title=s.customer.zap;a.prepend(svgIcon(IC.chat,'i s'));client.append(a);}
|
||||
const where=node('div',undefined,'fact');
|
||||
where.append(node('span','Entrega','lbl'),node('b',dest?dest.recipient:'Retirada em Franca'),
|
||||
node('span',dest?dest.street+', '+dest.number+(dest.complement?' '+dest.complement:'')+', '+dest.district+', '+dest.city+'/'+dest.state+', CEP '+dest.postal_code:'O cliente retira na fábrica'));
|
||||
const where=node('div',undefined,'fact'),special=specialDelivery(s);
|
||||
where.append(node('span','Entrega','lbl'),node('b',special||(dest?dest.recipient:'Retirada em Franca')),
|
||||
node('span',special?(special==='Interno'?'Fica na fábrica':'Sem frete próprio'):
|
||||
dest?dest.street+', '+dest.number+(dest.complement?' '+dest.complement:'')+', '+dest.district+', '+dest.city+'/'+dest.state+', CEP '+dest.postal_code:'O cliente retira na fábrica'));
|
||||
if(dest&&s.freight?.total_cents)where.append(node('span',(s.freight.description||'Jadlog')+', '+money(s.freight.total_cents)+(s.freight.weight_kg?', '+freightWeight(s.freight):''),'faint'));
|
||||
grid.append(client,where);
|
||||
if(order.machine||board.machines?.length)grid.append(machineCard(order));
|
||||
@@ -2429,7 +2438,7 @@ function historyView(order,rows,view){
|
||||
item.stroke_choice==='client_c3'?'proteger chapado (C3)':'imprimir assim (C1)'));
|
||||
}
|
||||
list.append(entry('Pedido recebido',board.environment==='local'&&order.payment?.provider==='fake'?'pagamento de teste':isTest(order)?'teste, sem pagamento':
|
||||
paidOutside(order)?ORIGINS[order.origin]+', pago fora do site ('+PAID_OUTSIDE[order.payment.method]+'), registrado por '+order.payment.operator:ORIGINS[order.origin]||'Site',
|
||||
paidOutside(order)?ORIGINS[order.origin]+', pago fora do site ('+(PAID_OUTSIDE[order.payment.method]||order.payment.method)+'), registrado por '+order.payment.operator:ORIGINS[order.origin]||'Site',
|
||||
order.created_at,paidOutside(order)?order.payment.note:''));
|
||||
view.replaceChildren(list);
|
||||
}
|
||||
@@ -3685,7 +3694,7 @@ function hitRow(items,title,sub,meta,state,tone,open){
|
||||
function orderHit(order){
|
||||
const s=order.snapshot;
|
||||
return hitRow(s.items,'#'+order.number+' · '+orderCode(order.id),buyer(s).title,
|
||||
s.items.map(i=>SHORT[i.mode]+' · '+metres(i.billed_metres)).join(' + ')+' · '+(s.destination?'Entrega':'Retirada')+' · pago '+when(order.created_at),
|
||||
s.items.map(i=>SHORT[i.mode]+' · '+metres(i.billed_metres)).join(' + ')+' · '+(specialDelivery(s)||(s.destination?'Entrega':'Retirada'))+' · pago '+when(order.created_at),
|
||||
order.cancelled_at?'Cancelado':board.states[order.state],order.cancelled_at?'bad':'',()=>{
|
||||
// An older finished order is not on the board yet: it joins, like "Carregar mais".
|
||||
if(!board.orders.some(o=>o.id===order.id)){olderFinished.push(order);board.orders.push(order);}
|
||||
|
||||
Reference in New Issue
Block a user