feat: "Baixar todos" downloads every final file in the print queue, named after its order
To import a day's work into FlexiPRINT the operator opened each order in Fila de impressão and downloaded its final. The column now has "Baixar todos": the approved finals of every order in the queue, in queue order, each named pedido-<n>-item-<i>-<original>. They download one by one from storage with short-lived links; a zip of multi-GB sheets would go through the server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -95,6 +95,8 @@ main{padding:0 24px 24px}
|
||||
.col-head .swatch{width:10px;height:10px;border-radius:3px;background:var(--c)}
|
||||
.col-head .n{margin-left:auto;font-family:var(--mono);font-size:13.5px;color:var(--muted)}
|
||||
.col-head small{font-size:13.5px;color:var(--faint)}
|
||||
.col-head .col-sub{justify-content:space-between;min-height:30px}
|
||||
.col-head .col-sub small{white-space:nowrap}
|
||||
.col .empty{font-size:13.5px;color:var(--faint);padding:8px 2px}
|
||||
.card{text-align:left;display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:10px;border:1px solid var(--line2);background:var(--card);width:100%}
|
||||
.card:hover,.card.open{border-color:var(--line3);background:#1E2226}
|
||||
|
||||
@@ -172,6 +172,16 @@ function download(uid){return async()=>{
|
||||
const result=await api('/uploads/'+uid+'/download');
|
||||
const link=node('a');link.href=result.url;link.referrerPolicy='no-referrer';link.download=result.name;link.click();
|
||||
};}
|
||||
async function downloadQueue(){
|
||||
const {files}=await api('/queue/finals');
|
||||
if(!files.length){say('Nenhum arquivo final aprovado na fila.');return;}
|
||||
say('Baixando '+files.length+(files.length>1?' arquivos':' arquivo')+' da fila… Se o navegador perguntar, permita vários downloads.',false,8000);
|
||||
// One at a time: browsers drop clicks that come too close together.
|
||||
for(const file of files){
|
||||
const link=node('a');link.href=file.url;link.referrerPolicy='no-referrer';link.download=file.name;link.click();
|
||||
await new Promise(r=>setTimeout(r,700));
|
||||
}
|
||||
}
|
||||
function manifest(production){
|
||||
const url=URL.createObjectURL(new Blob([JSON.stringify(production,null,2)],{type:'application/json'}));
|
||||
const link=node('a');link.href=url;link.download='dtf-layout-'+production.sources[0].upload_id.slice(0,8)+'.json';
|
||||
@@ -315,7 +325,13 @@ function renderBoard(){
|
||||
// Finished orders are a recent window, not the whole history: say so.
|
||||
const count=state==='fin'&&board.finished_total>orders.length?orders.length+' de '+board.finished_total:String(orders.length);
|
||||
line.append(swatch,node('h2',title),node('span',count,'n'));
|
||||
head.append(line,node('small',orders.length?metres(total)+' no total':'vazio'));
|
||||
const sub=node('div',undefined,'col-sub');sub.append(node('small',orders.length?metres(total)+' no total':'vazio'));
|
||||
// The print queue's files, all at once, to import into FlexiPRINT.
|
||||
if(state==='fil'&&orders.length){
|
||||
const all=downloadButton('Baixar todos',downloadQueue,'btn ghost small');all.title='Baixar os arquivos finais de todos os pedidos da fila';
|
||||
sub.append(all);
|
||||
}
|
||||
head.append(line,sub);
|
||||
column.append(head);
|
||||
for(const order of orders)column.append(card(order));
|
||||
if(state==='fin'&&finishedMore&&filter==='all')moreButton(column,true,loadOlderFinished);
|
||||
|
||||
Reference in New Issue
Block a user