feat: places per machine, drops on Imprimindo go to your machine, a Venda carries its seller to Tiny (DTF-WEB-V)
All checks were successful
Build and deploy / Validate source (push) Successful in 10s
Build and deploy / Integration suite on a real stack (push) Successful in 7m38s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m19s
All checks were successful
Build and deploy / Validate source (push) Successful in 10s
Build and deploy / Integration suite on a real stack (push) Successful in 7m38s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m19s
Marcus, 2026-11-17: - Each machine has its own places (machines.places, 1 to 6, three to start): orders at once in Imprimindo and files at once in its hot folder. Admin sets it in the machine dialog; Admin and Gestão in the machine sheet's Dados da máquina. A third order shows as "Na vez". - Whoever is signed in on a machine drops a card anywhere in Imprimindo and it goes to that machine; without one, the lane under the pointer. - Each Kanban user may name their Tiny seller (Usuários, read from Tiny's own list); a montador Venda reaches Tiny with the seller of who assembled it. Every other order still sends no seller. - A folder download that never reached storage (a network drop) waits for the next pass as a warning and is reported only if it keeps failing (Sentry DTF-WEB-V). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,9 +14,9 @@ function machineChoice(machine,mine=false){
|
||||
b.append(head,node('span',machine.products.map(p=>PRODUCT_LABEL[p]).join(' e ')||'Nenhum produto','sub'));
|
||||
const here=board.orders.filter(o=>o.state==='imp'&&!o.cancelled_at&&o.machine?.id===machine.id)
|
||||
.sort((x,y)=>(x.printing==='imprimindo'?0:1)-(y.printing==='imprimindo'?0:1));
|
||||
for(let i=0;i<Math.max(board.printing_cap||2,here.length);i++){
|
||||
for(let i=0;i<Math.max(machine.places||board.printing_cap||3,here.length);i++){
|
||||
const o=here[i],job=node('span',undefined,'job');
|
||||
if(o)job.append(node('i',undefined,o.printing==='ripando'?'ripmark':'runmark'),node('span','#'+o.number,'code'),node('em',o.printing==='ripando'?'ripando':'imprimindo'));
|
||||
if(o)job.append(node('i',undefined,o.printing==='imprimindo'?'runmark':'ripmark'),node('span','#'+o.number,'code'),node('em',o.printing||'imprimindo'));
|
||||
else job.append(node('i',undefined,'freemark'),node('span','livre','free'));
|
||||
b.append(job);
|
||||
}
|
||||
@@ -247,6 +247,18 @@ function userForm(u){
|
||||
pass.required=!editing;pass.placeholder=editing?'Deixe em branco para manter a atual':'8 caracteres ou mais';
|
||||
const active=node('input');active.checked=u?u.active:true;active.disabled=u?.email===ME.email;
|
||||
const row=node('div',undefined,'frow');row.append(field('Nome',name),field('E-mail',email));
|
||||
// The Tiny seller this person is: a Venda they assemble in Montar reaches
|
||||
// Tiny with it (Marcus, 2026-11-17). The list comes from Tiny itself.
|
||||
const seller=node('select');
|
||||
const none=node('option','Nenhum: o pedido vai sem vendedor');none.value='';seller.append(none);
|
||||
if(u?.tiny_seller){const o=node('option',u.tiny_seller.name);o.value=String(u.tiny_seller.id);seller.append(o);seller.value=o.value;}
|
||||
const sellerNote=node('small','Num pedido de Venda montado por esta pessoa no Montar, o Tiny recebe este vendedor.');
|
||||
api('/tiny/sellers').then(list=>{
|
||||
const keep=seller.value;
|
||||
seller.replaceChildren(none,...list.map(x=>{const o=node('option',x.name);o.value=String(x.id);return o;}));
|
||||
if(keep&&!list.some(x=>String(x.id)===keep)&&u?.tiny_seller){const o=node('option',u.tiny_seller.name+' (não está mais no Tiny)');o.value=keep;seller.append(o);}
|
||||
seller.value=keep;
|
||||
}).catch(e=>{sellerNote.textContent='Não foi possível ler os vendedores do Tiny: '+e.message;});
|
||||
const left=[];
|
||||
if(editing&&u.email!==ME.email){
|
||||
const remove=node('button','Excluir usuário','btn quiet');remove.type='button';
|
||||
@@ -257,18 +269,28 @@ function userForm(u){
|
||||
}
|
||||
const m=formDialog(editing?u.name||u.email:'Novo usuário',{width:560,left,lead:editing?avatar(u,'bigava'):null,
|
||||
text:editing?PRESENCE[presence(u)].split(':')[0]+', último acesso '+(u.last_login_at?when(u.last_login_at):'nunca'):'A pessoa entra com o e-mail e esta senha, e troca a senha em Minha conta.',
|
||||
fields:[row,roleField,field(editing?'Nova senha':'Senha inicial',pass),checkbox('Ativo: pode entrar no sistema',active)],
|
||||
fields:[row,roleField,field(editing?'Nova senha':'Senha inicial',pass),field('Vendedor no Tiny',seller,sellerNote),checkbox('Ativo: pode entrar no sistema',active)],
|
||||
label:editing?'Salvar':'Criar usuário',onsave:async()=>{
|
||||
const body={name:name.value,email:email.value,role:role.value()==='superadmin'?'admin':role.value(),active:active.checked,password:pass.value||null};
|
||||
const picked=seller.value?{id:Number(seller.value),name:seller.selectedOptions[0].textContent.replace(/ \(não está mais no Tiny\)$/,'')}:null;
|
||||
const body={name:name.value,email:email.value,role:role.value()==='superadmin'?'admin':role.value(),active:active.checked,password:pass.value||null,tiny_seller:picked};
|
||||
await api(editing?'/users/'+u.id:'/users',body);
|
||||
say(editing?'Usuário salvo.':'Usuário criado. Passe o e-mail e a senha inicial para a pessoa.');await loadUsers();
|
||||
}});
|
||||
}
|
||||
// A machine's places in Imprimindo, which are also the files at once in its
|
||||
// hot folder (app/machines.py): Admin and Gestão set them (Marcus, 2026-11-17).
|
||||
const PLACES_NOTE='Quantos pedidos a máquina aceita em Imprimindo, e quantos arquivos ficam juntos na hot folder dela.';
|
||||
function placesSelect(value){
|
||||
const select=node('select');
|
||||
for(let n=1;n<=6;n++){const o=node('option',String(n));o.value=String(n);select.append(o);}
|
||||
select.value=String(value||3);return select;
|
||||
}
|
||||
function machineForm(m){
|
||||
const name=node('input');name.required=true;name.maxLength=60;name.value=m?.name||'';name.placeholder='Ex.: Têxtil 2';
|
||||
const products=pills([['textil','Têxtil'],['uv','UV']],m?.products||[]);
|
||||
const limit=node('input');limit.type='number';limit.min='1';limit.max='99999';limit.step='0.1';limit.inputMode='decimal';
|
||||
limit.placeholder='Sem limite';limit.value=m?.limit_metres??'';
|
||||
const places=placesSelect(m?.places);
|
||||
const active=node('input');active.checked=m?m.active:true;
|
||||
const left=[];
|
||||
if(m){
|
||||
@@ -281,11 +303,12 @@ function machineForm(m){
|
||||
const d=formDialog(m?'Editar máquina':'Nova máquina',{width:520,left,
|
||||
fields:[field('Nome',name),group('Imprime',products),
|
||||
field('Limite de metros em aberto',unit(limit,'metros'),'Pedidos novos vão para a máquina do produto com menos metros em aberto, dentro do limite.'),
|
||||
field('Vagas em Imprimindo',places,PLACES_NOTE),
|
||||
checkbox('Ativa: recebe pedidos',active)],
|
||||
onsave:async()=>{
|
||||
if(!products.values().length)throw new Error('Marque o que a máquina imprime.');
|
||||
await api(m?'/machines/'+m.id:'/machines',{name:name.value,active:active.checked,products:products.values(),
|
||||
limit_metres:limit.value?Number(limit.value):null});
|
||||
limit_metres:limit.value?Number(limit.value):null,places:Number(places.value)});
|
||||
say(m?'Máquina salva.':'Máquina criada.');await loadUsers();await load();
|
||||
}});
|
||||
}
|
||||
@@ -396,9 +419,10 @@ async function openMachineSheet(machineId, tab='situacao'){
|
||||
const price=node('input');price.type='number';price.min='0';price.step='0.01';price.inputMode='decimal';
|
||||
price.value=machine.price_cents!==null&&machine.price_cents!==undefined?(machine.price_cents/100).toFixed(2):'';
|
||||
const installed=node('input');installed.type='date';installed.value=machine.installed_on||'';
|
||||
const places=placesSelect(machineState?.places);
|
||||
const minimums={};
|
||||
const box=node('div',undefined,'mblock');
|
||||
box.append(field('Preço de compra (R$)',price),field('Data de instalação',installed));
|
||||
box.append(field('Vagas em Imprimindo',places,PLACES_NOTE),field('Preço de compra (R$)',price),field('Data de instalação',installed));
|
||||
for(const [item,[label,unit]] of Object.entries(data.catalog.supplies)){
|
||||
const input=node('input');input.type='number';input.min='0';input.step='0.001';input.inputMode='decimal';
|
||||
const typed=data.minimums[item], fallback=data.default_minimums?.[item];
|
||||
@@ -412,6 +436,8 @@ async function openMachineSheet(machineId, tab='situacao'){
|
||||
save.onclick=async()=>{
|
||||
save.disabled=true;error.hidden=true;
|
||||
try{
|
||||
if(machineState&&Number(places.value)!==machineState.places)
|
||||
await api('/machines/'+machine.id+'/places',{places:Number(places.value)});
|
||||
await api('/machines/'+machine.id+'/sheet',{
|
||||
price_cents:price.value.trim()===''?null:Math.round(Number(price.value)*100),
|
||||
installed_on:installed.value||null,
|
||||
|
||||
Reference in New Issue
Block a user