feat: the team registers an order paid outside the site, choosing its origin and payment (Dropstar's rule D-35)
Some checks failed
Build and deploy / Integration suite on a real stack (push) Failing after 3m26s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Has been skipped
Build and deploy / Validate source (push) Successful in 6s
Some checks failed
Build and deploy / Integration suite on a real stack (push) Failing after 3m26s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Has been skipped
Build and deploy / Validate source (push) Successful in 6s
On an approved quote in Cotacoes, Administrador, Gestao and Vendedor pick the origin (Site, Dropflow, Atendimento) and how it was paid (Pix, cartao, dinheiro, credito do cliente), neither preselected, with an optional note. The price is the quote's, the Site's table price. The order is marked paid outside, counts in Numeros, and goes to Tiny like a Site order with the payment named in its internal note; a Dropflow order stays out of Tiny, status updates and cancelling included, until its revenue category exists. Auto-refresh waits while a register form on screen is half filled in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -221,6 +221,13 @@ main{padding:0 24px 24px}
|
||||
.pane .foot .total{margin-left:auto;font-family:var(--mono);color:var(--muted)}
|
||||
.pane .foot .total b{color:var(--tx)}
|
||||
.pane .note{padding:24px;color:var(--muted)}
|
||||
.pane .register{flex-direction:column;align-items:stretch;gap:10px;border-top:1px solid var(--line)}
|
||||
.register .opts{display:grid;grid-template-columns:110px 1fr;align-items:center;gap:8px}
|
||||
.register .optset{display:flex;flex-wrap:wrap;gap:8px 16px}
|
||||
.register .optlabel{font-size:13.5px;font-weight:600;color:var(--muted)}
|
||||
.register .opt{display:inline-flex;align-items:center;gap:6px;font-size:14px;color:var(--tx2);cursor:pointer}
|
||||
.register .optrow{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
|
||||
.register .optrow input{flex:1;min-width:200px;height:38px;padding:0 10px;border-radius:8px;border:1px solid var(--line3);background:var(--bg);color:var(--tx)}
|
||||
|
||||
/* Payments and integrations */
|
||||
.page{display:flex;flex-direction:column;gap:22px;padding-top:18px}
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<p class="faint stats-note">Quem entra no Kanban e o que cada perfil pode fazer. Administrador: tudo, inclusive esta página.
|
||||
Gestão: tudo, menos usuários; no quadro só puxa para trás, com motivo (Correção ou voltar uma etapa). Designer: vê todos os pedidos, aprova e recusa o arquivo final, pede correção.
|
||||
Operador: ligado a uma máquina, vê só os pedidos dela; imprime e passa para a Revisão. Revisor: confere a folha impressa e libera; é o único que manda para Finalizado.
|
||||
Vendedor: só consulta.</p>
|
||||
Vendedor: consulta e registra pedidos pagos fora do site, em Cotações.</p>
|
||||
<section class="statbox"><table class="log"><thead><tr><th scope="col">Nome</th><th scope="col">Perfil</th><th scope="col">Máquinas</th><th scope="col">Último acesso</th><th scope="col"></th></tr></thead><tbody id="users-list"></tbody></table></section>
|
||||
<div class="pagehead"><h2>Máquinas</h2><button class="btn" id="new-machine" type="button">Nova máquina</button></div>
|
||||
<p class="faint stats-note">Cada pedido vai para a máquina do produto com menos metros em aberto, dentro do limite. No pedido dá para trocar.</p>
|
||||
|
||||
@@ -855,7 +855,8 @@ function renderPanel(order){
|
||||
row.append(node('span','#'+order.number,'num'),stage,originTag(order),...(test?[test]:[]),code,close);
|
||||
// What was paid and when, and whether it is stuck: the first things asked of an order.
|
||||
const paid=node('div',undefined,'paidline');
|
||||
paid.append(node('b',money(order.snapshot.total_cents)),isTest(order)?' sem pagamento · '+when(order.created_at):' pago em '+when(order.created_at));
|
||||
paid.append(node('b',money(order.snapshot.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));
|
||||
if(order.cancelled_at)paid.append(badge('Cancelado','bad'));
|
||||
else if(stalled(order))paid.append(badge('⏱ Parado há '+hoursSince(order.updated_at)+' h','bad'));
|
||||
const steps=node('ol',undefined,'steps');steps.setAttribute('aria-label','Etapas');
|
||||
@@ -1211,7 +1212,9 @@ function historySection(order,rows,section){
|
||||
li.append(text,node('small',when(at)));return li;
|
||||
};
|
||||
for(const r of [...rows].reverse())list.append(entry(STAGE_COLORS[r.to_state],r.back?'Voltou para '+stateName(r.to_state):stateName(r.to_state),r.operator,r.created_at,r.reason));
|
||||
list.append(entry('var(--rec)','Pedido recebido',board.environment==='local'&&order.payment?.provider==='fake'?'pagamento de teste':isTest(order)?'teste, sem pagamento':'Site',order.created_at,''));
|
||||
list.append(entry('var(--rec)','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',
|
||||
order.created_at,paidOutside(order)?order.payment.note:''));
|
||||
section.replaceChildren(node('p','Histórico','eyebrow'),list);
|
||||
}
|
||||
|
||||
@@ -1597,6 +1600,7 @@ function review(quote){
|
||||
content.append(sums);
|
||||
}
|
||||
card.append(head,content);
|
||||
if(quote.status==='approved'&&may('enter'))card.append(registerForm(quote));
|
||||
if(quote.status==='approved'&&may('manage')){
|
||||
foot.append(discardButton(quote));
|
||||
// Tries the whole production flow without a payment.
|
||||
@@ -1631,6 +1635,32 @@ function review(quote){
|
||||
catch(error){say(error.message,true);submit.disabled=false;}};
|
||||
card.append(head,form);return card;
|
||||
}
|
||||
// An order paid outside the site (Dropstar's rule D-35): the team builds the
|
||||
// cart on the Site, as a customer would, and registers it here. Origin and
|
||||
// payment start unchosen: a default would become the answer to everything.
|
||||
const PAID_OUTSIDE={pix:'Pix',card:'Cartão',cash:'Dinheiro',credit:'Crédito do cliente'};
|
||||
function registerForm(quote){
|
||||
const form=node('form',undefined,'foot register');
|
||||
const group=(name,label,options)=>{
|
||||
const g=node('div',undefined,'opts');g.setAttribute('role','radiogroup');g.setAttribute('aria-label',label);
|
||||
const set=node('div',undefined,'optset');
|
||||
for(const [value,text] of Object.entries(options)){
|
||||
const l=node('label',undefined,'opt'),r=node('input');
|
||||
r.type='radio';r.name=name+'-'+quote.id;r.value=value;r.required=true;l.append(r,text);set.append(l);}
|
||||
g.append(node('span',label,'optlabel'),set);return g;};
|
||||
const note=node('input');note.type='text';note.maxLength=300;note.placeholder='Observação (opcional)';note.setAttribute('aria-label','Observação');
|
||||
const submit=node('button','Registrar pedido','btn primary');
|
||||
const row=node('div',undefined,'optrow');row.append(note,submit);
|
||||
form.append(node('b','Pago fora do site? Registre o pedido'),group('origin','Origem',ORIGINS),group('method','Como foi pago',PAID_OUTSIDE),row);
|
||||
form.onsubmit=async e=>{e.preventDefault();
|
||||
const pick=name=>form.querySelector('input[name="'+name+'-'+quote.id+'"]:checked')?.value;
|
||||
submit.disabled=true;
|
||||
try{const order=await api('/quotes/'+quote.id+'/register',{origin:pick('origin'),method:pick('method'),note:note.value});
|
||||
currentQuote=null;say('Pedido #'+order.number+' registrado em Arte recebida.');await load();}
|
||||
catch(error){say(error.message,true);submit.disabled=false;}};
|
||||
return form;
|
||||
}
|
||||
const paidOutside=order=>order.payment?.provider==='manual';
|
||||
// An unpaid quote leaves the list and can no longer be paid.
|
||||
function discardButton(quote){
|
||||
return button('Descartar cotação',async()=>{
|
||||
@@ -2050,7 +2080,10 @@ let autoTimer=null, lastAuto=0;
|
||||
function busy(){
|
||||
const a=document.activeElement;
|
||||
const typing=!!(a&&a.matches&&a.matches('input,textarea,select')&&a.id!=='refresh-every');
|
||||
return $('app').hidden||!!dragging||!$('drawer').hidden||typing;
|
||||
// An order being registered, half filled in and on screen, keeps its choices.
|
||||
const registering=!$('tab-quotes').hidden&&[...document.querySelectorAll('.register')].some(f=>
|
||||
f.querySelector('input:checked')||f.querySelector('input[type=text]').value);
|
||||
return $('app').hidden||!!dragging||!$('drawer').hidden||typing||registering;
|
||||
}
|
||||
function autoRefresh(){
|
||||
if(busy())return;
|
||||
|
||||
Reference in New Issue
Block a user