feat: Dropstar's answers of 23/10 that need nothing more from them
All checks were successful
Build and deploy / Validate source (push) Successful in 1m6s
Build and deploy / Integration suite on a real stack (push) Successful in 4m5s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m6s
All checks were successful
Build and deploy / Validate source (push) Successful in 1m6s
Build and deploy / Integration suite on a real stack (push) Successful in 4m5s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m6s
- JPG is refused in every product, at upload and by the server: it has no transparency, so the background prints and loose art packs as a box - a PDF over 150 MB says before payment that the Site cannot check it, as a file opened by hand does - every piece that is not square is tried both ways; the 1 cm rule left 19,5 x 18,5 cm standing, 2 to a row instead of 3 - a mirrored order (UV only) is flagged on its card and panel, and its print file's footer ends in ESPELHADO, in bold - print files are named DTF-23-item-1, and the order panel copies DTF-23-, so the code pasted into the folder's search finds them - the proof: up to 30 cm, from the thinnest lines, a piece of each different artwork, at most three per order, free - a file opened by hand costs R$ 2,00 more a metre by default, and the Site says so Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ from ..core import db
|
|||||||
from ..core.auth import (COOKIE_SECURE, DESIGNER_STATES, DUMMY_PASSWORD_HASH, audit, can, client_ip, operator,
|
from ..core.auth import (COOKIE_SECURE, DESIGNER_STATES, DUMMY_PASSWORD_HASH, audit, can, client_ip, operator,
|
||||||
login_failed, password_matches, throttle)
|
login_failed, password_matches, throttle)
|
||||||
from ..core.models import Move, OperatorLogin, Resolution, Review, StrictModel
|
from ..core.models import Move, OperatorLogin, Resolution, Review, StrictModel
|
||||||
from ..printjobs import queue as queue_print_files
|
from ..printjobs import file_prefix, queue as queue_print_files
|
||||||
from .. import cnpj, machines, mail, payments, proof, quote_review
|
from .. import cnpj, machines, mail, payments, proof, quote_review
|
||||||
from .. import tiny
|
from .. import tiny
|
||||||
from ..runtime import (BACK, BOARD_FINISHED_LIMIT, BOARD_QUOTE_LIMIT, ENVIRONMENT, PUBLIC_ORIGIN, STATES,
|
from ..runtime import (BACK, BOARD_FINISHED_LIMIT, BOARD_QUOTE_LIMIT, ENVIRONMENT, PUBLIC_ORIGIN, STATES,
|
||||||
@@ -637,7 +637,7 @@ def move(uid: UUID, body: Move, request: Request, user=Depends(can('produce'))):
|
|||||||
if {r['item_index'] for r in coverage} != set(range(len(row['snapshot']['items']))):
|
if {r['item_index'] for r in coverage} != set(range(len(row['snapshot']['items']))):
|
||||||
raise HTTPException(409, 'Aprove os arquivos finais de todos os itens antes de colocar na fila.')
|
raise HTTPException(409, 'Aprove os arquivos finais de todos os itens antes de colocar na fila.')
|
||||||
if body.state == 'fin' and proof.needs_proof(row['snapshot']) and not row['proof_ok_at']:
|
if body.state == 'fin' and proof.needs_proof(row['snapshot']) and not row['proof_ok_at']:
|
||||||
raise HTTPException(409, 'Falta a prova: confira os 20 cm impressos e marque Prova OK antes de finalizar.')
|
raise HTTPException(409, 'Falta a prova: confira a prova impressa e marque Prova OK antes de finalizar.')
|
||||||
if body.state == 'cor':
|
if body.state == 'cor':
|
||||||
c.execute("UPDATE dtf_local.order_files SET active=false WHERE order_id=%s AND kind='final'", (uid,))
|
c.execute("UPDATE dtf_local.order_files SET active=false WHERE order_id=%s AND kind='final'", (uid,))
|
||||||
c.execute('INSERT INTO dtf_local.movements(order_id,from_state,to_state,operator,reason,back) VALUES(%s,%s,%s,%s,%s,%s)',
|
c.execute('INSERT INTO dtf_local.movements(order_id,from_state,to_state,operator,reason,back) VALUES(%s,%s,%s,%s,%s,%s)',
|
||||||
@@ -924,8 +924,14 @@ def named_files(rows):
|
|||||||
readable, with a link straight to storage."""
|
readable, with a link straight to storage."""
|
||||||
files, names = [], set()
|
files, names = [], set()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
prefix = f"pedido-{row['number']}-item-{row['item_index'] + 1}"
|
prefix = file_prefix(row['number'], row['item_index'])
|
||||||
name = row['name'] if row['name'].startswith(prefix) else f"{prefix}-{row['name']}"
|
# Generated before 2026-10-23, a file was called pedido-23-item-1.
|
||||||
|
older = f"pedido-{row['number']}-item-{row['item_index'] + 1}"
|
||||||
|
name = row['name']
|
||||||
|
if name.startswith(older):
|
||||||
|
name = prefix + name[len(older):]
|
||||||
|
elif not name.startswith(prefix):
|
||||||
|
name = f"{prefix}-{name}"
|
||||||
stem, dot, ext = name.rpartition('.')
|
stem, dot, ext = name.rpartition('.')
|
||||||
copy = 2
|
copy = 2
|
||||||
while name in names:
|
while name in names:
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ def create_quote(body: QuoteRequest, session_id=Depends(owner)):
|
|||||||
row = upload_row(c, uid, session_id)
|
row = upload_row(c, uid, session_id)
|
||||||
if not row['complete']:
|
if not row['complete']:
|
||||||
raise HTTPException(409, 'Espere o envio de todos os arquivos terminar antes de continuar.')
|
raise HTTPException(409, 'Espere o envio de todos os arquivos terminar antes de continuar.')
|
||||||
|
# No transparency: the background prints, and loose art packs as a box (2026-10-23).
|
||||||
|
if row['name'].lower().endswith(('.jpg', '.jpeg')):
|
||||||
|
raise HTTPException(422, 'JPG não tem fundo transparente. Envie a arte em PNG ou PDF.')
|
||||||
require_clean(row)
|
require_clean(row)
|
||||||
rows[str(uid)] = row
|
rows[str(uid)] = row
|
||||||
# The grade sets the price and came from the browser: before a cart is
|
# The grade sets the price and came from the browser: before a cart is
|
||||||
|
|||||||
@@ -413,6 +413,8 @@ def footer_commands(text, logo_size=None):
|
|||||||
"""The footer's line, 0,5 cm from the left: the logo then the rest, or,
|
"""The footer's line, 0,5 cm from the left: the logo then the rest, or,
|
||||||
without a logo, the line's first part (the brand) in bold."""
|
without a logo, the line's first part (the brand) in bold."""
|
||||||
brand, _, rest = text.partition(' · ')
|
brand, _, rest = text.partition(' · ')
|
||||||
|
# A warning closing the line (ESPELHADO) goes in bold.
|
||||||
|
rest, mark, _ = rest.rpartition(' · ESPELHADO') if rest.endswith(' · ESPELHADO') else (rest, '', '')
|
||||||
def literal(value):
|
def literal(value):
|
||||||
raw = value.encode('cp1252', 'replace')
|
raw = value.encode('cp1252', 'replace')
|
||||||
return b'(' + raw.replace(b'\\', b'\\\\').replace(b'(', b'\\(').replace(b')', b'\\)') + b')'
|
return b'(' + raw.replace(b'\\', b'\\\\').replace(b'(', b'\\(').replace(b')', b'\\)') + b')'
|
||||||
@@ -423,10 +425,12 @@ def footer_commands(text, logo_size=None):
|
|||||||
width = height * logo_size[0] / logo_size[1]
|
width = height * logo_size[0] / logo_size[1]
|
||||||
bottom = (float(FOOTER_CM) * PT_PER_CM - height) / 2
|
bottom = (float(FOOTER_CM) * PT_PER_CM - height) / 2
|
||||||
return (b'q %s 0 0 %s %s %s cm /Logo Do Q\n' % (serialize(width), serialize(height), serialize(x), serialize(bottom))
|
return (b'q %s 0 0 %s %s %s cm /Logo Do Q\n' % (serialize(width), serialize(height), serialize(x), serialize(bottom))
|
||||||
+ b'q 0 g BT /F2 %d Tf %s %s Td %s Tj ET Q\n'
|
+ b'q 0 g BT /F2 %d Tf %s %s Td %s Tj /F1 %d Tf %s Tj ET Q\n'
|
||||||
% (FOOTER_PT, serialize(x + width + 0.4 * PT_PER_CM), serialize(y), literal(rest)))
|
% (FOOTER_PT, serialize(x + width + 0.4 * PT_PER_CM), serialize(y), literal(rest),
|
||||||
return (b'q 0 g BT /F1 %d Tf %s %s Td %s Tj /F2 %d Tf %s Tj ET Q\n'
|
FOOTER_PT, literal(mark)))
|
||||||
% (FOOTER_PT, serialize(x), serialize(y), literal(brand), FOOTER_PT, literal(' · ' + rest if rest else '')))
|
return (b'q 0 g BT /F1 %d Tf %s %s Td %s Tj /F2 %d Tf %s Tj /F1 %d Tf %s Tj ET Q\n'
|
||||||
|
% (FOOTER_PT, serialize(x), serialize(y), literal(brand), FOOTER_PT, literal(' · ' + rest if rest else ''),
|
||||||
|
FOOTER_PT, literal(mark)))
|
||||||
|
|
||||||
|
|
||||||
def render(item, files, out, title, footer=None):
|
def render(item, files, out, title, footer=None):
|
||||||
|
|||||||
@@ -142,15 +142,27 @@ def whole_sheet(item, uploads):
|
|||||||
return row
|
return row
|
||||||
|
|
||||||
|
|
||||||
|
def file_prefix(number, item_index):
|
||||||
|
"""How an order's files are named: DTF-23-item-1, the code the Kanban
|
||||||
|
copies, the footer prints and Tiny keeps (Dropstar, 2026-10-23)."""
|
||||||
|
return f'DTF-{number}-item-{item_index + 1}'
|
||||||
|
|
||||||
|
|
||||||
def footer(job, item):
|
def footer(job, item):
|
||||||
"""The print file's footer line: DROPSTAR · Pedido DTF-123 · Item 1/2 ·
|
"""The print file's footer line: DROPSTAR · Pedido DTF-123 · Item 1/2 ·
|
||||||
21/10/2026 · 0,90 m. The order is named by its Kanban number, which Tiny
|
21/10/2026 · 0,90 m, and · ESPELHADO when the artwork is mirrored. The
|
||||||
keeps as the purchase order; the length is the one billed."""
|
order is named by its Kanban number, which Tiny keeps; the length is the
|
||||||
|
one billed."""
|
||||||
count = len(job['snapshot']['items'])
|
count = len(job['snapshot']['items'])
|
||||||
day = job['ordered_at'].astimezone(LOCAL).strftime('%d/%m/%Y')
|
day = job['ordered_at'].astimezone(LOCAL).strftime('%d/%m/%Y')
|
||||||
billed = f"{Decimal(str(item['billed_metres'])):.2f}".replace('.', ',')
|
billed = f"{Decimal(str(item['billed_metres'])):.2f}".replace('.', ',')
|
||||||
return ' · '.join(('DROPSTAR', f'Pedido {purchase_order(job["number"])}',
|
fields = ['DROPSTAR', f'Pedido {purchase_order(job["number"])}',
|
||||||
f'Item {job["item_index"] + 1}/{count}', day, f'{billed} m'))
|
f'Item {job["item_index"] + 1}/{count}', day, f'{billed} m']
|
||||||
|
# A mirrored artwork (UV only) is named on the sheet, for the room to see
|
||||||
|
# before printing (Dropstar, 2026-10-23).
|
||||||
|
if any(source.get('mirrored') for source in item['production']['sources']):
|
||||||
|
fields.append('ESPELHADO')
|
||||||
|
return ' · '.join(fields)
|
||||||
|
|
||||||
|
|
||||||
def produce(storage, job, item, uploads):
|
def produce(storage, job, item, uploads):
|
||||||
@@ -162,7 +174,7 @@ def produce(storage, job, item, uploads):
|
|||||||
if row['purged_at'] or row['expired']:
|
if row['purged_at'] or row['expired']:
|
||||||
raise Unsupported('um arquivo original passou do prazo de guarda')
|
raise Unsupported('um arquivo original passou do prazo de guarda')
|
||||||
number = job['number']
|
number = job['number']
|
||||||
name = f'pedido-{number}-item-{job["item_index"] + 1}.pdf'
|
name = f'{file_prefix(number, job["item_index"])}.pdf'
|
||||||
with tempfile.TemporaryDirectory(prefix='print-') as scratch:
|
with tempfile.TemporaryDirectory(prefix='print-') as scratch:
|
||||||
files = {}
|
files = {}
|
||||||
for index, upload_id in enumerate(item['uploads']):
|
for index, upload_id in enumerate(item['uploads']):
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
"""The print proof (Dropstar, 2026-10-21).
|
"""The print proof (Dropstar, 2026-10-21).
|
||||||
|
|
||||||
An order above 10 m prints 20 cm of proof before the rest, checked by the
|
An order above 10 m prints a proof before the rest, checked by the print room
|
||||||
print room without stopping the order. A customer may also ask for a proof at
|
without stopping the order. Dropstar's rule (2026-10-23): up to 30 cm, from
|
||||||
|
the part with the thinnest lines, a piece of each different artwork, at most
|
||||||
|
three proofs per order, never billed. A customer may also ask for a proof at
|
||||||
checkout, for any length: that order waits for them, marked "Aguardando
|
checkout, for any length: that order waits for them, marked "Aguardando
|
||||||
contato", until they approve the photo sent by WhatsApp. Either way the room
|
contato", until they approve the photo sent by WhatsApp. Either way the room
|
||||||
marks "Prova OK" once the proof is checked, and without it the order does not
|
marks "Prova OK" once the proof is checked, and without it the order does not
|
||||||
reach Finalizado. The proof is not billed (to be confirmed by Dropstar).
|
reach Finalizado.
|
||||||
"""
|
"""
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ x-app-environment: &app-environment
|
|||||||
QUOTE_AUTO_APPROVE: ${QUOTE_AUTO_APPROVE:-true}
|
QUOTE_AUTO_APPROVE: ${QUOTE_AUTO_APPROVE:-true}
|
||||||
QUOTE_AUTO_MAX_METRES: ${QUOTE_AUTO_MAX_METRES:-50}
|
QUOTE_AUTO_MAX_METRES: ${QUOTE_AUTO_MAX_METRES:-50}
|
||||||
# Cents added to each metre of a finished sheet someone has to open by hand
|
# Cents added to each metre of a finished sheet someone has to open by hand
|
||||||
# (CDR, AI, PSD, TIFF, or a length the customer typed). 0 adds nothing; 500
|
# (CDR, AI, PSD, TIFF, or a length the customer typed). Dropstar set R$ 2,00
|
||||||
# is R$ 5,00 a metro. The Site shows it before the customer pays.
|
# a metro on 2026-10-23; 0 adds nothing. The Site shows it before payment.
|
||||||
MANUAL_FILE_EXTRA_CENTS: ${MANUAL_FILE_EXTRA_CENTS:-0}
|
MANUAL_FILE_EXTRA_CENTS: ${MANUAL_FILE_EXTRA_CENTS:-200}
|
||||||
# Order creation in Tiny stays off until it has been tested against the
|
# Order creation in Tiny stays off until it has been tested against the
|
||||||
# client's account (Tiny has no sandbox). The application credentials can be
|
# client's account (Tiny has no sandbox). The application credentials can be
|
||||||
# set now: they let an operator connect Tiny from the Kanban, and the worker
|
# set now: they let an operator connect Tiny from the Kanban, and the worker
|
||||||
|
|||||||
@@ -360,7 +360,12 @@ Helvetica, after Dropstar's logo (app/assets). An original used whole as its
|
|||||||
own print file (over 300 MB) has no footer. The print proof (app/proof.py):
|
own print file (over 300 MB) has no footer. The print proof (app/proof.py):
|
||||||
an order above 10 m, or one whose customer ticked "quero aprovar uma prova" at
|
an order above 10 m, or one whose customer ticked "quero aprovar uma prova" at
|
||||||
checkout (that one arrives marked Aguardando contato), cannot reach Finalizado
|
checkout (that one arrives marked Aguardando contato), cannot reach Finalizado
|
||||||
before the print room marks Prova OK; the proof is not billed. Waiting on
|
before the print room marks Prova OK; the proof is not billed (up to 30 cm,
|
||||||
|
at most 3 per order). Dropstar's answers of 2026-10-23: JPG is refused in every
|
||||||
|
product; a PDF over 150 MB is flagged before payment; any non-square piece is
|
||||||
|
tried both ways; a mirrored (UV) order is flagged on the card and in the PDF
|
||||||
|
footer; files are named DTF-<number>-item-<n>, the code the Kanban copies;
|
||||||
|
manual files cost R$ 2,00 more a metre. Waiting on
|
||||||
Dropstar: the Tiny category/seller/tag conflict, residue and opaque background
|
Dropstar: the Tiny category/seller/tag conflict, residue and opaque background
|
||||||
blocking, the print-file footer, the packing margins, the DTF terms, the
|
blocking, the print-file footer, the packing margins, the DTF terms, the
|
||||||
manual-file value, the proof print, and mirroring.
|
manual-file value, the proof print, and mirroring.
|
||||||
|
|||||||
@@ -202,8 +202,10 @@ Kanban, then switch on "Receber alertas por e-mail" for whoever wants alerts in
|
|||||||
Usuários. Use a sending domain with SPF and DKIM, or the messages land in spam.
|
Usuários. Use a sending domain with SPF and DKIM, or the messages land in spam.
|
||||||
|
|
||||||
`MANUAL_FILE_EXTRA_CENTS` is the per-metre charge on finished sheets someone
|
`MANUAL_FILE_EXTRA_CENTS` is the per-metre charge on finished sheets someone
|
||||||
opens by hand (CDR, AI, PSD, TIFF); 500 is R$ 5,00 a metro. Change it only on
|
opens by hand (CDR, AI, PSD, TIFF). The default is 200, R$ 2,00 a metro
|
||||||
the client's instruction; the Site shows the new price after the redeploy.
|
(Dropstar, 2026-10-23); a value set in the stack's environment overrides it.
|
||||||
|
Change it only on the client's instruction; the Site shows the new price after
|
||||||
|
the redeploy.
|
||||||
|
|
||||||
## 8. Correios
|
## 8. Correios
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ try{
|
|||||||
encaixar=(pieces,width)=>{const result=original(pieces,width);
|
encaixar=(pieces,width)=>{const result=original(pieces,width);
|
||||||
if(pieces.some(p=>p.a))window.lastLayout={altura:result.altura,pos:result.pos.map(p=>({x:p.x,y:p.y,w:p.w,h:p.h,rot:p.rot}))};
|
if(pieces.some(p=>p.a))window.lastLayout={altura:result.altura,pos:result.pos.map(p=>({x:p.x,y:p.y,w:p.w,h:p.h,rot:p.rot}))};
|
||||||
return result;};
|
return result;};
|
||||||
window.sendImage=async(type='image/jpeg',drop=false)=>{
|
window.sendImage=async(type='image/png',drop=false)=>{
|
||||||
const c=document.createElement('canvas');c.width=200;c.height=400;
|
const c=document.createElement('canvas');c.width=200;c.height=400;
|
||||||
const ctx=c.getContext('2d');ctx.fillStyle='white';ctx.fillRect(0,0,200,400);
|
const ctx=c.getContext('2d');ctx.fillStyle='white';ctx.fillRect(0,0,200,400);
|
||||||
ctx.fillStyle='#222';ctx.fillRect(85,20,20,360);ctx.fillRect(25,100,140,20);
|
ctx.fillStyle='#222';ctx.fillRect(85,20,20,360);ctx.fillRect(25,100,140,20);
|
||||||
@@ -173,19 +173,24 @@ try{
|
|||||||
await evaluate(`folhas=[];pintaFolha()`);
|
await evaluate(`folhas=[];pintaFolha()`);
|
||||||
await evaluate(`pickTipo('avulsa')`);
|
await evaluate(`pickTipo('avulsa')`);
|
||||||
assert.equal(await evaluate('modo'),'avulsa');
|
assert.equal(await evaluate('modo'),'avulsa');
|
||||||
// A large JPG artwork cannot be read in parts: it is measured from its
|
// JPG has no transparency: refused in loose artwork as in a sheet (Dropstar,
|
||||||
|
// 2026-10-23), with the reason, before anything is read.
|
||||||
|
await evaluate(`sel([new File(['x'],'arte.jpg',{type:'image/jpeg'})])`);
|
||||||
|
assert.equal(await evaluate(`artes.length===0 && $('recusa').textContent.includes('JPG não dá para enviar')`),true);
|
||||||
|
// A large WebP artwork cannot be read in parts: it is measured from its
|
||||||
// header and placed as a full box, with the discount, instead of refused.
|
// header and placed as a full box, with the discount, instead of refused.
|
||||||
await evaluate(`(()=>{const h=new Uint8Array(20);h.set([0xFF,0xD8,0xFF,0xC0,0,17,8,0x09,0x3A,0x09,0x3A,3]);
|
await evaluate(`(()=>{const h=new Uint8Array(30);h.set([0x52,0x49,0x46,0x46,0,0,0,0,0x57,0x45,0x42,0x50,0x56,0x50,0x38,0x58]);
|
||||||
const f=new File([h],'arte-grande.jpg');Object.defineProperty(f,'size',{value:400*1048576});sel([f]);})()`);
|
h.set([0x39,0x09,0x00,0x39,0x09,0x00],24);
|
||||||
await waitFor(()=>evaluate(`artes.length===1 && artes[0].semPrevia===true`),'large JPG artwork measured from its header');
|
const f=new File([h],'arte-grande.webp');Object.defineProperty(f,'size',{value:400*1048576});sel([f]);})()`);
|
||||||
|
await waitFor(()=>evaluate(`artes.length===1 && artes[0].semPrevia===true`),'large WebP artwork measured from its header');
|
||||||
await fill('[data-cm]',20);
|
await fill('[data-cm]',20);
|
||||||
await waitFor(()=>evaluate(`!!itemAtual?.production?.sources?.length`),'large JPG artwork packed');
|
await waitFor(()=>evaluate(`!!itemAtual?.production?.sources?.length`),'large WebP artwork packed');
|
||||||
assert.deepEqual(await evaluate(`({dpi:Math.round(dpiDe(artes[0])),src:!!artes[0].src,
|
assert.deepEqual(await evaluate(`({dpi:Math.round(dpiDe(artes[0])),src:!!artes[0].src,
|
||||||
measurement:itemAtual.production.sources[0].measurement,note:$('lista').textContent.includes('Sem prévia')})`),
|
measurement:itemAtual.production.sources[0].measurement,note:$('lista').textContent.includes('Sem prévia')})`),
|
||||||
{dpi:300,src:false,measurement:'file',note:true});
|
{dpi:300,src:false,measurement:'file',note:true});
|
||||||
await evaluate(`artes=[];pintaArtes()`);
|
await evaluate(`artes=[];pintaArtes()`);
|
||||||
await evaluate('sendImage()');
|
await evaluate('sendImage()');
|
||||||
await waitFor(()=>evaluate(`artes.length===1 && !!artes[0].src`),'JPG artwork model');
|
await waitFor(()=>evaluate(`artes.length===1 && !!artes[0].src`),'PNG artwork model');
|
||||||
assert.deepEqual(await evaluate(`({mode:modo,sheets:folhas.length,width:artes[0].cm,quantity:artes[0].q})`),{mode:'avulsa',sheets:0,width:0,quantity:1});
|
assert.deepEqual(await evaluate(`({mode:modo,sheets:folhas.length,width:artes[0].cm,quantity:artes[0].q})`),{mode:'avulsa',sheets:0,width:0,quantity:1});
|
||||||
await fill('[data-cm]',20);await fill('[data-q]',6);
|
await fill('[data-cm]',20);await fill('[data-q]',6);
|
||||||
let layout=await packed(6);
|
let layout=await packed(6);
|
||||||
@@ -251,6 +256,11 @@ try{
|
|||||||
assert.deepEqual(await evaluate(`(()=>{const a={};const r=encaixar(Array.from({length:8},()=>({w:30,h:10,img:null,a})),57);
|
assert.deepEqual(await evaluate(`(()=>{const a={};const r=encaixar(Array.from({length:8},()=>({w:30,h:10,img:null,a})),57);
|
||||||
return {rot:[...new Set(r.pos.map(p=>p.rot))],altura:+r.altura.toFixed(2)}})()`),
|
return {rot:[...new Set(r.pos.map(p=>p.rot))],altura:+r.altura.toFixed(2)}})()`),
|
||||||
{rot:[90],altura:61.5});
|
{rot:[90],altura:61.5});
|
||||||
|
// Any piece that is not square is tried both ways (Dropstar, 2026-10-23):
|
||||||
|
// 19,5 x 18,5 cm fits 2 to a row standing and 3 lying down.
|
||||||
|
assert.deepEqual(await evaluate(`(()=>{const a={};const r=encaixar(Array.from({length:6},()=>({w:19.5,h:18.5,img:null,a})),57);
|
||||||
|
return {rot:[...new Set(r.pos.map(p=>p.rot))],altura:+r.altura.toFixed(2)}})()`),
|
||||||
|
{rot:[90],altura:40.5});
|
||||||
await click('[data-rm]');
|
await click('[data-rm]');
|
||||||
assert.equal(await evaluate(`artes.length===0 && itemAtual===null && !cartPodeEnviar()`),true,
|
assert.equal(await evaluate(`artes.length===0 && itemAtual===null && !cartPodeEnviar()`),true,
|
||||||
'removed artwork cannot remain in the cart');
|
'removed artwork cannot remain in the cart');
|
||||||
@@ -408,6 +418,6 @@ try{
|
|||||||
console.log('Supplied image:',JSON.stringify(layout));
|
console.log('Supplied image:',JSON.stringify(layout));
|
||||||
}
|
}
|
||||||
assert.deepEqual(errors,[]);
|
assert.deepEqual(errors,[]);
|
||||||
console.log('PASS: JPG/PNG upload and drop, packed copies, 5 mm gaps, aspect ratio, live width/quantity/rotation/mirror, metres, ready-sheet pricing/repeats, residue and solid background stop the order, UV, stale renders, strict inline CSP.');
|
console.log('PASS: PNG upload and drop, JPG refused, packed copies, 5 mm gaps, aspect ratio, live width/quantity/rotation/mirror, metres, ready-sheet pricing/repeats, residue and solid background stop the order, UV, stale renders, strict inline CSP.');
|
||||||
}catch(error){console.error(error);if(stderr)console.error(stderr.slice(-1200));process.exitCode=1;}
|
}catch(error){console.error(error);if(stderr)console.error(stderr.slice(-1200));process.exitCode=1;}
|
||||||
finally{ws?.close();chrome.kill();server.closeAllConnections();await new Promise(r=>server.close(r));}
|
finally{ws?.close();chrome.kill();server.closeAllConnections();await new Promise(r=>server.close(r));}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ try{
|
|||||||
await kanban.eval(`(()=>{const check=document.querySelector('[data-order="${oid}"] [data-confirm]');check.click();check.closest('form').requestSubmit();})()`);
|
await kanban.eval(`(()=>{const check=document.querySelector('[data-order="${oid}"] [data-confirm]');check.click();check.closest('form').requestSubmit();})()`);
|
||||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').version===2`),'final file approval');
|
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').version===2`),'final file approval');
|
||||||
// Approved before the queue: already on this computer, in Recebidos.
|
// Approved before the queue: already on this computer, in Recebidos.
|
||||||
const early='pedido-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
const early='DTF-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
||||||
await kanban.eval('syncFolder(true)');
|
await kanban.eval('syncFolder(true)');
|
||||||
await waitFor(async()=>(await savedFiles('Recebidos')).some(n=>n.startsWith(early)&&!n.endsWith('.baixando')),'final file saved in Recebidos',45000);
|
await waitFor(async()=>(await savedFiles('Recebidos')).some(n=>n.startsWith(early)&&!n.endsWith('.baixando')),'final file saved in Recebidos',45000);
|
||||||
assert.equal((await savedFiles()).some(n=>n.startsWith(early)),false);
|
assert.equal((await savedFiles()).some(n=>n.startsWith(early)),false);
|
||||||
@@ -230,7 +230,7 @@ try{
|
|||||||
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='${state}'`),'transition '+state);
|
await waitFor(()=>kanban.eval(`board.orders.find(o=>o.id==='${oid}').state==='${state}'`),'transition '+state);
|
||||||
if(state==='fil'){
|
if(state==='fil'){
|
||||||
// Entering the queue saves its final file there, whole and named after the order.
|
// Entering the queue saves its final file there, whole and named after the order.
|
||||||
const prefix='pedido-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
const prefix='DTF-'+await kanban.eval(`board.orders.find(o=>o.id==='${oid}').number`)+'-item-1';
|
||||||
await waitFor(async()=>(await savedFiles()).some(n=>n.startsWith(prefix)&&!n.endsWith('.baixando')),'final file saved in the folder',45000);
|
await waitFor(async()=>(await savedFiles()).some(n=>n.startsWith(prefix)&&!n.endsWith('.baixando')),'final file saved in the folder',45000);
|
||||||
// Other orders the earlier suites left in the queue may still be coming
|
// Other orders the earlier suites left in the queue may still be coming
|
||||||
// down: only once the round ends must no half-written file be left.
|
// down: only once the round ends must no half-written file be left.
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ def run():
|
|||||||
early = client.call('/operator/queue/folder', {'early': True, 'held': [oid]}, operator=True)
|
early = client.call('/operator/queue/folder', {'early': True, 'held': [oid]}, operator=True)
|
||||||
mine = [f for f in early['files'] if f['order'] == oid]
|
mine = [f for f in early['files'] if f['order'] == oid]
|
||||||
assert [(f['upload_id'], f['state']) for f in mine] == [(str(row['upload_id']), 'rec')], early['files']
|
assert [(f['upload_id'], f['state']) for f in mine] == [(str(row['upload_id']), 'rec')], early['files']
|
||||||
assert mine[0]['name'].startswith('pedido-%d-item-1' % order['number']) and early['states'] == {oid: 'rec'}
|
assert mine[0]['name'].startswith('DTF-%d-item-1' % order['number']) and early['states'] == {oid: 'rec'}
|
||||||
late = client.call('/operator/queue/folder', {'early': False, 'held': []}, operator=True)
|
late = client.call('/operator/queue/folder', {'early': False, 'held': []}, operator=True)
|
||||||
assert not [f for f in late['files'] if f['order'] == oid] and late['states'] == {}
|
assert not [f for f in late['files'] if f['order'] == oid] and late['states'] == {}
|
||||||
client.call('/operator/queue/folder', {'early': True, 'held': []}, expected=401)
|
client.call('/operator/queue/folder', {'early': True, 'held': []}, expected=401)
|
||||||
|
|||||||
@@ -121,6 +121,20 @@ class PrintFileTests(unittest.TestCase):
|
|||||||
plain = io.BytesIO()
|
plain = io.BytesIO()
|
||||||
self.assertEqual(render(spec, {0: (path, 'a.png')}, plain, 'test')['page_height_cm'], '10')
|
self.assertEqual(render(spec, {0: (path, 'a.png')}, plain, 'test')['page_height_cm'], '10')
|
||||||
|
|
||||||
|
def test_a_mirrored_item_says_so_in_bold_at_the_end(self):
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
from app.printfile import footer_commands
|
||||||
|
from app.printjobs import file_prefix, footer
|
||||||
|
spec = item([placement(0, 0, 20, 10, mirrored=True)], [source(20, 10, mirrored=True)], 10)
|
||||||
|
job = {'snapshot': {'items': [spec, spec]}, 'number': 7, 'item_index': 1,
|
||||||
|
'ordered_at': datetime(2026, 10, 23, 15, 0, tzinfo=timezone.utc)}
|
||||||
|
line = footer(job, spec)
|
||||||
|
self.assertEqual(line, 'DROPSTAR · Pedido DTF-7 · Item 2/2 · 23/10/2026 · 1,00 m · ESPELHADO')
|
||||||
|
self.assertIn(b'/F1 18 Tf ( \xb7 ESPELHADO) Tj', footer_commands(line, (100, 80)))
|
||||||
|
self.assertNotIn(b'ESPELHADO', footer_commands(footer(job, item([placement(0, 0, 20, 10)], [source(20, 10)], 10)), (100, 80)))
|
||||||
|
# The files start with the code the Kanban copies.
|
||||||
|
self.assertEqual(file_prefix(7, 1), 'DTF-7-item-2')
|
||||||
|
|
||||||
def test_jpeg_bytes_are_embedded_unchanged(self):
|
def test_jpeg_bytes_are_embedded_unchanged(self):
|
||||||
path = self.save(quadrants(), 'a.jpg', quality=90)
|
path = self.save(quadrants(), 'a.jpg', quality=90)
|
||||||
pdf, _ = self.render(item([placement(0, 0, 20, 10)], [source(20, 10)], 10), [path])
|
pdf, _ = self.render(item([placement(0, 0, 20, 10)], [source(20, 10)], 10), [path])
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ def run():
|
|||||||
# The print queue's files come named after their order, straight from storage.
|
# The print queue's files come named after their order, straight from storage.
|
||||||
queued=customer.call('/operator/queue/finals',operator=True)['files']
|
queued=customer.call('/operator/queue/finals',operator=True)['files']
|
||||||
mine=[f for f in queued if urlopen(f['url']).read()==b'LOCAL FINAL VERSION ONE']
|
mine=[f for f in queued if urlopen(f['url']).read()==b'LOCAL FINAL VERSION ONE']
|
||||||
assert len(mine)==1 and mine[0]['name'].startswith('pedido-%d-item-1-' % mine[0]['number']), queued
|
assert len(mine)==1 and mine[0]['name'].startswith('DTF-%d-item-1-' % mine[0]['number']), queued
|
||||||
customer.call('/operator/queue/finals',expected=401)
|
customer.call('/operator/queue/finals',expected=401)
|
||||||
version=move('imp',version);version=move('cor',version)
|
version=move('imp',version);version=move('cor',version)
|
||||||
customer.call('/customer/orders/'+oid+'/files/'+final['id']+'/download',expected=404)
|
customer.call('/customer/orders/'+oid+'/files/'+final['id']+'/download',expected=404)
|
||||||
|
|||||||
@@ -57,11 +57,12 @@
|
|||||||
window.dtfUploadMaxBytes=session.max_upload_bytes;
|
window.dtfUploadMaxBytes=session.max_upload_bytes;
|
||||||
const limit=document.getElementById('zLimite');
|
const limit=document.getElementById('zLimite');
|
||||||
if(limit)limit.textContent='Até '+(session.max_upload_bytes/1073741824).toFixed(0)+' GB por arquivo.';
|
if(limit)limit.textContent='Até '+(session.max_upload_bytes/1073741824).toFixed(0)+' GB por arquivo.';
|
||||||
|
// What the server charges for a file opened by hand, never the page's own text.
|
||||||
|
const zona=document.getElementById('zManual');
|
||||||
|
if(zona)zona.innerHTML='Tem <b>CDR, AI, PSD ou TIFF</b>? Pode mandar também. Alguém abre na mão, e o '+
|
||||||
|
'metro sai pelo preço cheio'+(session.manual_extra_cents>0?' mais '+rs(session.manual_extra_cents/100):'')+'.';
|
||||||
if(session.manual_extra_cents>0){
|
if(session.manual_extra_cents>0){
|
||||||
TAXA_MANUAL=session.manual_extra_cents/100;
|
TAXA_MANUAL=session.manual_extra_cents/100;
|
||||||
const zona=document.getElementById('zManual');
|
|
||||||
if(zona)zona.innerHTML='Tem <b>CDR, AI, PSD ou TIFF</b>? Pode mandar também. Alguém abre na mão: '+
|
|
||||||
'o metro sai pelo preço cheio, mais '+rs(TAXA_MANUAL)+'.';
|
|
||||||
if(typeof folhas!=='undefined'&&folhas.length&&typeof pintaFolha==='function')pintaFolha();
|
if(typeof folhas!=='undefined'&&folhas.length&&typeof pintaFolha==='function')pintaFolha();
|
||||||
if(typeof itemAtual!=='undefined'&&itemAtual&&typeof carrinho==='function')carrinho();
|
if(typeof itemAtual!=='undefined'&&itemAtual&&typeof carrinho==='function')carrinho();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ h2 em{font-style:normal;color:var(--laranja)}
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="etapas2"><div class="w">
|
<section class="etapas2"><div class="w">
|
||||||
<div><span>1</span><div><b>Envie a arte</b><p>PNG, JPG ou PDF, conforme o produto. Sem cadastro.</p></div></div>
|
<div><span>1</span><div><b>Envie a arte</b><p>PNG ou PDF, conforme o produto. Sem cadastro.</p></div></div>
|
||||||
<div><span>2</span><div><b>Veja nota e montagem</b><p>A folha e o preço aparecem na hora.</p></div></div>
|
<div><span>2</span><div><b>Veja nota e montagem</b><p>A folha e o preço aparecem na hora.</p></div></div>
|
||||||
<div><span>3</span><div><b>Pague na hora</b><p>Cartão de crédito ou PIX, na própria página.</p></div></div>
|
<div><span>3</span><div><b>Pague na hora</b><p>Cartão de crédito ou PIX, na própria página.</p></div></div>
|
||||||
<div><span>4</span><div><b>Acompanhe</b><p>Em Minha conta, com aviso no WhatsApp quando ficar pronto.</p></div></div>
|
<div><span>4</span><div><b>Acompanhe</b><p>Em Minha conta, com aviso no WhatsApp quando ficar pronto.</p></div></div>
|
||||||
@@ -843,7 +843,7 @@ h2 em{font-style:normal;color:var(--laranja)}
|
|||||||
<span class="bt">ou escolher no computador</span>
|
<span class="bt">ou escolher no computador</span>
|
||||||
<span class="zOutra"><b id="zOutra">Adicionar outra folha</b> ou arraste aqui</span>
|
<span class="zOutra"><b id="zOutra">Adicionar outra folha</b> ou arraste aqui</span>
|
||||||
<span class="zManual" id="zManual">Tem <b>CDR, AI, PSD ou TIFF</b>? Pode mandar também.
|
<span class="zManual" id="zManual">Tem <b>CDR, AI, PSD ou TIFF</b>? Pode mandar também.
|
||||||
Alguém abre na mão e o metro sai pelo preço cheio.</span>
|
Alguém abre na mão, e o metro sai pelo preço cheio mais R$ 2,00.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="resumoA" id="rA" style="display:none"></div>
|
<div class="resumoA" id="rA" style="display:none"></div>
|
||||||
<input type="file" id="inp" hidden>
|
<input type="file" id="inp" hidden>
|
||||||
@@ -891,10 +891,10 @@ h2 em{font-style:normal;color:var(--laranja)}
|
|||||||
<li class="a"><b>TIFF, PSD, AI e CDR</b> a gente aceita, mas ninguém consegue
|
<li class="a"><b>TIFF, PSD, AI e CDR</b> a gente aceita, mas ninguém consegue
|
||||||
conferir sozinho: alguém abre na mão, sai mais devagar e o metro vai pela
|
conferir sozinho: alguém abre na mão, sai mais devagar e o metro vai pela
|
||||||
tabela, sem desconto de nota</li>
|
tabela, sem desconto de nota</li>
|
||||||
<li class="a"><b>Folha em JPG não passa:</b> JPG não tem fundo transparente, e o
|
<li class="a"><b>JPG não passa:</b> não tem fundo transparente, e o branco do
|
||||||
branco do fundo sai no filme. Exporte a folha em PNG ou PDF</li>
|
fundo sai no filme. Exporte a folha em PNG ou PDF</li>
|
||||||
<li class="a">Em <b>artes avulsas</b> só PNG e JPG: a montagem precisa
|
<li class="a">Em <b>artes avulsas</b> só PNG com fundo transparente: a montagem
|
||||||
enxergar a sua arte para encaixar pela forma</li>
|
precisa enxergar a sua arte para encaixar pela forma</li>
|
||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
@@ -1083,8 +1083,8 @@ h2 em{font-style:normal;color:var(--laranja)}
|
|||||||
<h4>Prova antes de imprimir</h4>
|
<h4>Prova antes de imprimir</h4>
|
||||||
<label class="provaOp"><input type="checkbox" id="fProva">
|
<label class="provaOp"><input type="checkbox" id="fProva">
|
||||||
<span><b>Quero aprovar uma prova antes de imprimir</b>
|
<span><b>Quero aprovar uma prova antes de imprimir</b>
|
||||||
Imprimimos um trecho da sua folha e mandamos a foto pelo WhatsApp. O resto só é impresso
|
Imprimimos até 30 cm da sua folha e mandamos a foto pelo WhatsApp. O resto só é impresso
|
||||||
depois do seu ok, então o pedido espera a sua resposta.</span></label>
|
depois do seu ok, então o pedido espera a sua resposta. Até 3 provas por pedido, sem custo.</span></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,9 @@ function paymentBadge(p){
|
|||||||
// What the customer calls the order (the id's first 8 characters, as the
|
// What the customer calls the order (the id's first 8 characters, as the
|
||||||
// server's order_code); the # number is the operators'.
|
// server's order_code); the # number is the operators'.
|
||||||
const orderCode=id=>String(id).replace(/-/g,'').slice(0,8).toUpperCase();
|
const orderCode=id=>String(id).replace(/-/g,'').slice(0,8).toUpperCase();
|
||||||
|
// The order's files start with this (app/printjobs.py): pasted into the folder's
|
||||||
|
// search it finds them, and the dash keeps DTF-23 from finding DTF-230.
|
||||||
|
const fileCode=order=>'DTF-'+order.number+'-';
|
||||||
const sheetSize=p=>p?cm(p.film_width_cm)+' × '+cm(p.height_cm)+' cm':null;
|
const sheetSize=p=>p?cm(p.film_width_cm)+' × '+cm(p.height_cm)+' cm':null;
|
||||||
const hoursSince=v=>Math.floor((Date.now()-new Date(v))/3600000);
|
const hoursSince=v=>Math.floor((Date.now()-new Date(v))/3600000);
|
||||||
// The freight's weight: what the package weighs and, when Jadlog charges the
|
// The freight's weight: what the package weighs and, when Jadlog charges the
|
||||||
@@ -561,8 +564,12 @@ const contactWho=order=>(order.contact_by||'')+' em '+when(order.contact_since);
|
|||||||
// The print proof (app/proof.py): asked for at checkout, or an order above 10 m.
|
// The print proof (app/proof.py): asked for at checkout, or an order above 10 m.
|
||||||
// The room marks "Prova OK" once it is checked; without it, no Finalizado.
|
// The room marks "Prova OK" once it is checked; without it, no Finalizado.
|
||||||
const PROOF_ABOVE_METRES=10;
|
const PROOF_ABOVE_METRES=10;
|
||||||
|
const PROOF_RULE='Até 30 cm, do trecho de traço mais fino, um pedaço de cada arte diferente; no máximo 3 provas por pedido, sem cobrança.';
|
||||||
const needsProof=order=>!!order.snapshot.proof||order.snapshot.items.reduce((t,i)=>t+Number(i.billed_metres),0)>PROOF_ABOVE_METRES;
|
const needsProof=order=>!!order.snapshot.proof||order.snapshot.items.reduce((t,i)=>t+Number(i.billed_metres),0)>PROOF_ABOVE_METRES;
|
||||||
const proofPending=order=>needsProof(order)&&!order.proof_ok_at&&order.state!=='fin'&&!order.cancelled_at;
|
const proofPending=order=>needsProof(order)&&!order.proof_ok_at&&order.state!=='fin'&&!order.cancelled_at;
|
||||||
|
// Mirrored by the customer (UV only, web/site-pdf.js): the room checks it before printing.
|
||||||
|
const mirroredItem=item=>!!item.production?.sources?.some(source=>source.mirrored);
|
||||||
|
const MIRROR_NOTE='O cliente espelhou a arte: confira antes de imprimir';
|
||||||
async function proofOk(order){
|
async function proofOk(order){
|
||||||
await api('/orders/'+order.id+'/proof',{});say('Prova do pedido #'+order.number+' conferida.');await load();
|
await api('/orders/'+order.id+'/proof',{});say('Prova do pedido #'+order.number+' conferida.');await load();
|
||||||
}
|
}
|
||||||
@@ -712,11 +719,12 @@ function card(order){
|
|||||||
const p=printState(order);
|
const p=printState(order);
|
||||||
flags.append(badge((p.tone==='ok'?'✓ ':p.tone==='warn'?'! ':'')+p.text,p.tone));
|
flags.append(badge((p.tone==='ok'?'✓ ':p.tone==='warn'?'! ':'')+p.text,p.tone));
|
||||||
if(s.items.some(i=>i.quality_status==='warning'))flags.append(badge('! Ressalva','warn','O cliente aceitou a ressalva de resolução'));
|
if(s.items.some(i=>i.quality_status==='warning'))flags.append(badge('! Ressalva','warn','O cliente aceitou a ressalva de resolução'));
|
||||||
|
if(s.items.some(mirroredItem))flags.append(badge('Espelhado','bad',MIRROR_NOTE));
|
||||||
if(stalled(order))flags.append(badge('⏱ Parado '+hoursSince(order.updated_at)+' h','bad','Sem mudar de etapa desde '+when(order.updated_at)));
|
if(stalled(order))flags.append(badge('⏱ Parado '+hoursSince(order.updated_at)+' h','bad','Sem mudar de etapa desde '+when(order.updated_at)));
|
||||||
if(waitingContact(order))flags.append(badge('☎ Aguardando contato','warn',order.contact_note+' · '+contactWho(order)));
|
if(waitingContact(order))flags.append(badge('☎ Aguardando contato','warn',order.contact_note+' · '+contactWho(order)));
|
||||||
if(needsProof(order))flags.append(order.proof_ok_at
|
if(needsProof(order))flags.append(order.proof_ok_at
|
||||||
? badge('✓ Prova OK','ok','Conferida por '+order.proof_ok_by+' em '+when(order.proof_ok_at))
|
? badge('✓ Prova OK','ok','Conferida por '+order.proof_ok_by+' em '+when(order.proof_ok_at))
|
||||||
: badge('Prova','warn',order.snapshot.proof?'O cliente pediu uma prova antes de imprimir':'Pedido acima de 10 m: 20 cm de prova antes do resto'));
|
: badge('Prova','warn',order.snapshot.proof?'O cliente pediu uma prova antes de imprimir':'Pedido acima de 10 m: prova antes do resto'));
|
||||||
}
|
}
|
||||||
c.append(artBox(s.items,'card-art'),top,buyerBlock(s,'cust'),meta,place(s.destination));
|
c.append(artBox(s.items,'card-art'),top,buyerBlock(s,'cust'),meta,place(s.destination));
|
||||||
if(order.machine&&order.state!=='fin'){const m=node('div',undefined,'place machine');m.append(icon(ICON_PRINTER),order.machine.name);c.append(m);}
|
if(order.machine&&order.state!=='fin'){const m=node('div',undefined,'place machine');m.append(icon(ICON_PRINTER),order.machine.name);c.append(m);}
|
||||||
@@ -802,7 +810,11 @@ function renderPanel(order){
|
|||||||
const close=node('button',undefined,'close');close.type='button';close.setAttribute('aria-label','Fechar');close.append(icon(['M6 6l12 12M18 6L6 18']));close.onclick=closePanel;
|
const close=node('button',undefined,'close');close.type='button';close.setAttribute('aria-label','Fechar');close.append(icon(['M6 6l12 12M18 6L6 18']));close.onclick=closePanel;
|
||||||
const test=isTest(order)?node('span','TESTE','tag-teste'):null;
|
const test=isTest(order)?node('span','TESTE','tag-teste'):null;
|
||||||
if(test)test.title='Pedido de teste: sem pagamento, não vai ao Tiny';
|
if(test)test.title='Pedido de teste: sem pagamento, não vai ao Tiny';
|
||||||
const code=node('span',undefined,'ocode');code.append('Pedido '+orderCode(order.id),copyButton(orderCode(order.id),'Copiar código do pedido'));
|
// DTF-23 is the room's code, in the file names, the footer and Tiny; the
|
||||||
|
// customer knows the order by the other one.
|
||||||
|
const code=node('span',undefined,'ocode');
|
||||||
|
code.append('Pedido DTF-'+order.number,copyButton(fileCode(order),'Copiar “'+fileCode(order)+'”, o começo do nome dos arquivos deste pedido'));
|
||||||
|
const theirs=node('span',' · cliente: '+orderCode(order.id),'faint');theirs.title='O código que o cliente vê';code.append(theirs);
|
||||||
code.title='O código que o cliente vê';
|
code.title='O código que o cliente vê';
|
||||||
row.append(node('span','#'+order.number,'num'),stage,...(test?[test]:[]),code,close);
|
row.append(node('span','#'+order.number,'num'),stage,...(test?[test]:[]),code,close);
|
||||||
// What was paid and when, and whether it is stuck: the first things asked of an order.
|
// What was paid and when, and whether it is stuck: the first things asked of an order.
|
||||||
@@ -904,9 +916,9 @@ function moves(order){
|
|||||||
}else if(next==='fin'&&proofPending(order)){
|
}else if(next==='fin'&&proofPending(order)){
|
||||||
// Finalizado waits for the proof: printing it and checking it is the next step.
|
// Finalizado waits for the proof: printing it and checking it is the next step.
|
||||||
const text=node('div');text.append(node('b','Próximo passo: conferir a prova'),
|
const text=node('div');text.append(node('b','Próximo passo: conferir a prova'),
|
||||||
node('span',order.snapshot.proof
|
node('span',(order.snapshot.proof
|
||||||
?'O cliente pediu uma prova: mande a foto pelo WhatsApp e, com o aceite dele, marque Prova OK.'
|
?'O cliente pediu uma prova: imprima, mande a foto pelo WhatsApp e, com o aceite dele, marque Prova OK.'
|
||||||
:'Pedido acima de 10 m: imprima 20 cm, confira e marque Prova OK antes de rodar o resto.'));
|
:'Pedido acima de 10 m: imprima a prova, confira e marque Prova OK antes de rodar o resto.')+' '+PROOF_RULE));
|
||||||
if(may('print')){const actions=node('div',undefined,'stepactions');
|
if(may('print')){const actions=node('div',undefined,'stepactions');
|
||||||
const b=button('Prova OK',()=>proofOk(order),'btn primary');b.dataset.proof='';actions.append(b);text.append(actions);}
|
const b=button('Prova OK',()=>proofOk(order),'btn primary');b.dataset.proof='';actions.append(b);text.append(actions);}
|
||||||
step=node('div',undefined,'nextstep lead');step.append(node('span','!','nextmark'),text);
|
step=node('div',undefined,'nextstep lead');step.append(node('span','!','nextmark'),text);
|
||||||
@@ -1107,6 +1119,11 @@ function itemCard(order,item,index){
|
|||||||
if(extra)body.append(node('div',extra,'line'));
|
if(extra)body.append(node('div',extra,'line'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(mirroredItem(item)){
|
||||||
|
const mirrored=node('div',undefined,'file');
|
||||||
|
mirrored.append(icon(ICON_WARN),node('span',MIRROR_NOTE,'warn'));
|
||||||
|
body.append(mirrored);
|
||||||
|
}
|
||||||
if(['rec','tra','cor'].includes(order.state)){
|
if(['rec','tra','cor'].includes(order.state)){
|
||||||
const done=(order.final_items||[]).includes(index), status=node('div',undefined,'file');
|
const done=(order.final_items||[]).includes(index), status=node('div',undefined,'file');
|
||||||
status.append(icon(done?ICON_OK:ICON_WARN),node('span',done?'Arquivo final aprovado':'Falta aprovar o arquivo final',done?'ok':'warn'));
|
status.append(icon(done?ICON_OK:ICON_WARN),node('span',done?'Arquivo final aprovado':'Falta aprovar o arquivo final',done?'ok':'warn'));
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ const MODOS={
|
|||||||
zt:'Arraste sua folha montada aqui', zs:'PNG ou PDF com fundo transparente · 57 cm de largura'},
|
zt:'Arraste sua folha montada aqui', zs:'PNG ou PDF com fundo transparente · 57 cm de largura'},
|
||||||
avulsa:{tit:'Artes avulsas', lg:'DTF têxtil · 57 cm', larg:57, multi:true,
|
avulsa:{tit:'Artes avulsas', lg:'DTF têxtil · 57 cm', larg:57, multi:true,
|
||||||
zt:'Arraste suas artes aqui',
|
zt:'Arraste suas artes aqui',
|
||||||
zs:'PNG ou JPG com fundo transparente · informe a largura de cada uma'},
|
zs:'PNG com fundo transparente · informe a largura de cada uma'},
|
||||||
uvfile:{tit:'Arquivo por metro · UV', lg:'Adesivo UV · 28,5 cm', larg:28.5, multi:true, folha:true,
|
uvfile:{tit:'Arquivo por metro · UV', lg:'Adesivo UV · 28,5 cm', larg:28.5, multi:true, folha:true,
|
||||||
zt:'Arraste sua folha de UV aqui', zs:'PNG ou PDF com fundo transparente · 28,5 cm de largura'},
|
zt:'Arraste sua folha de UV aqui', zs:'PNG ou PDF com fundo transparente · 28,5 cm de largura'},
|
||||||
uv: {tit:'Artes avulsas · UV', lg:'Adesivo UV · 28,5 cm', larg:28.5, multi:true,
|
uv: {tit:'Artes avulsas · UV', lg:'Adesivo UV · 28,5 cm', larg:28.5, multi:true,
|
||||||
zt:'Arraste suas artes de UV',
|
zt:'Arraste suas artes de UV',
|
||||||
zs:'PNG ou JPG com fundo transparente · informe a largura de cada arte'}
|
zs:'PNG com fundo transparente · informe a largura de cada arte'}
|
||||||
};
|
};
|
||||||
// Quatro escadas. A de artes avulsas e a da folha pronta mais a montagem:
|
// Quatro escadas. A de artes avulsas e a da folha pronta mais a montagem:
|
||||||
// R$ 10,00 no têxtil, R$ 14,00 no UV, constante em todas as faixas.
|
// R$ 10,00 no têxtil, R$ 14,00 no UV, constante em todas as faixas.
|
||||||
@@ -63,12 +63,14 @@ const ehFolha=m=>!!MODOS[m||modo].folha;
|
|||||||
const pisoEscada=m=>FAIXAS[m||modo][0][1];
|
const pisoEscada=m=>FAIXAS[m||modo][0][1];
|
||||||
const MINIMO_M=1, GAP_CM=0.5, RODAPE_CM=5;
|
const MINIMO_M=1, GAP_CM=0.5, RODAPE_CM=5;
|
||||||
const RENDERIZA=/[.](png|jpe?g|webp|gif|bmp)$/i;
|
const RENDERIZA=/[.](png|jpe?g|webp|gif|bmp)$/i;
|
||||||
// Folha pronta: dá para medir PNG, JPG e PDF. PSD, AI, TIFF e CDR entram, mas
|
// Folha pronta: dá para medir PNG e PDF. PSD, AI, TIFF e CDR entram, mas
|
||||||
// o navegador não abre — o cliente informa o comprimento e o arquivo passa por
|
// o navegador não abre — o cliente informa o comprimento e o arquivo passa por
|
||||||
// tratamento antes de imprimir.
|
// tratamento antes de imprimir.
|
||||||
|
// JPG não tem canal alfa: o branco do fundo sai no filme, e na montagem a arte
|
||||||
|
// vira uma caixa retangular. Não entra em produto nenhum (Dropstar, 23/10/2026).
|
||||||
const ACEITA={
|
const ACEITA={
|
||||||
folha: /[.](png|jpe?g|tiff?|pdf|psd|psb|ai|cdr)$/i,
|
folha: /[.](png|tiff?|pdf|psd|psb|ai|cdr)$/i,
|
||||||
avulsa: /[.](png|jpe?g|webp)$/i
|
avulsa: /[.](png|webp)$/i
|
||||||
};
|
};
|
||||||
const MEDE=/[.](png|jpe?g|webp|gif|bmp|pdf)$/i;
|
const MEDE=/[.](png|jpe?g|webp|gif|bmp|pdf)$/i;
|
||||||
const DPI_RECUSA=96, DPI_AVISA=300; // régua dos designers · 02/09/2026
|
const DPI_RECUSA=96, DPI_AVISA=300; // régua dos designers · 02/09/2026
|
||||||
|
|||||||
@@ -30,9 +30,10 @@ function pintaModo(){
|
|||||||
$('zOutra').textContent = ehFolha(m) ? 'Adicionar outra folha' : 'Adicionar mais artes';
|
$('zOutra').textContent = ehFolha(m) ? 'Adicionar outra folha' : 'Adicionar mais artes';
|
||||||
$('zona').classList.remove('compacta');
|
$('zona').classList.remove('compacta');
|
||||||
$('inp').multiple=c.multi;
|
$('inp').multiple=c.multi;
|
||||||
// The file decides the price: PNG, JPG and PDF are checked here, the others by hand.
|
// The file decides the price: PNG and PDF are checked here, the others by hand.
|
||||||
$('inp').accept = ehFolha(m) ? '.png,.jpg,.jpeg,.pdf,.tif,.tiff,.psd,.psb,.ai,.cdr'
|
// JPG has no transparency and is refused (ACEITA, web/site-config.js).
|
||||||
: '.png,.jpg,.jpeg,.webp';
|
$('inp').accept = ehFolha(m) ? '.png,.pdf,.tif,.tiff,.psd,.psb,.ai,.cdr'
|
||||||
|
: '.png,.webp';
|
||||||
$('catFoco').className='cat '+(ehFolha(m)?'file':'av');
|
$('catFoco').className='cat '+(ehFolha(m)?'file':'av');
|
||||||
$('larguraFolhaPronta').textContent=String(c.larg).replace('.',',');
|
$('larguraFolhaPronta').textContent=String(c.larg).replace('.',',');
|
||||||
$('foco2').classList.remove('sofila'); // a caixa de requisitos vale nos 4 modos
|
$('foco2').classList.remove('sofila'); // a caixa de requisitos vale nos 4 modos
|
||||||
|
|||||||
@@ -154,8 +154,10 @@ function encaixar(pecas,W){
|
|||||||
function encaixarEmLinhas(pecas,W){
|
function encaixarEmLinhas(pecas,W){
|
||||||
const arteDe=p=>p.a||p;
|
const arteDe=p=>p.a||p;
|
||||||
const artes=[...new Set(pecas.map(arteDe))];
|
const artes=[...new Set(pecas.map(arteDe))];
|
||||||
|
// Toda peça que não é quadrada é testada nos dois sentidos (Dropstar,
|
||||||
|
// 23/10/2026): 19,5 x 18,5 cm cabe 2 por linha de pé e 3 deitada.
|
||||||
const giraveis=artes.filter(arte=>{const p=pecas.find(q=>arteDe(q)===arte);
|
const giraveis=artes.filter(arte=>{const p=pecas.find(q=>arteDe(q)===arte);
|
||||||
return !p.mPronta && !p.travado && Math.abs(p.w-p.h)>1 && p.h<=W;});
|
return !p.mPronta && !p.travado && Math.abs(p.w-p.h)>0.01 && p.h<=W;});
|
||||||
const deitadas=new Set();
|
const deitadas=new Set();
|
||||||
const montar=()=>emLinhas(pecas.map(p=>deitadas.has(arteDe(p))
|
const montar=()=>emLinhas(pecas.map(p=>deitadas.has(arteDe(p))
|
||||||
? {ref:p,w:p.h,h:p.w,rot:90} : {ref:p,w:p.w,h:p.h,rot:0}),W);
|
? {ref:p,w:p.h,h:p.w,rot:90} : {ref:p,w:p.w,h:p.h,rot:0}),W);
|
||||||
@@ -236,7 +238,7 @@ function encaixarPelaForma(pecas,W){
|
|||||||
|
|
||||||
ordem.forEach(p=>{
|
ordem.forEach(p=>{
|
||||||
const oris=[{w:p.w,h:p.h,rot:0}];
|
const oris=[{w:p.w,h:p.h,rot:0}];
|
||||||
if(!p.mPronta && !p.travado && Math.abs(p.w-p.h)>1 && p.h<=W) oris.push({w:p.h,h:p.w,rot:90});
|
if(!p.mPronta && !p.travado && Math.abs(p.w-p.h)>0.01 && p.h<=W) oris.push({w:p.h,h:p.w,rot:90});
|
||||||
|
|
||||||
let melhor=null;
|
let melhor=null;
|
||||||
oris.forEach(o=>{
|
oris.forEach(o=>{
|
||||||
|
|||||||
@@ -497,6 +497,13 @@ function pintaFolha(){
|
|||||||
medida='<div class="repMed"><b>'+n1(x.med.larg)+' × '+n1(x.med.alt)+' cm</b>'+
|
medida='<div class="repMed"><b>'+n1(x.med.larg)+' × '+n1(x.med.alt)+' cm</b>'+
|
||||||
'<span>'+escapeHTML(extDe(x.f.name))+' · '+fmt(x.f.size)+'</span></div>'+
|
'<span>'+escapeHTML(extDe(x.f.name))+' · '+fmt(x.f.size)+'</span></div>'+
|
||||||
(a? '<ul class="chips">'+chipsDaFolha(a)+'</ul>'+avisosDaFolha(a,x.f.name)+detalhesDaFolha(a,i,x.detAberto) : '')+
|
(a? '<ul class="chips">'+chipsDaFolha(a)+'</ul>'+avisosDaFolha(a,x.f.name)+detalhesDaFolha(a,i,x.detAberto) : '')+
|
||||||
|
// Over 150 MB the browser cannot check a PDF: said before payment, as
|
||||||
|
// for a file opened by hand (Dropstar, 2026-10-23).
|
||||||
|
(x.pdfGrande? '<span class="chipSo">Conferência manual · sem conferência no site</span>'+
|
||||||
|
'<p class="repTxt">Este PDF tem mais de 150 MB, e o site não confere arquivo desse tamanho: '+
|
||||||
|
'resíduo de recorte, fundo e resolução ficam para a equipe, que abre antes de imprimir, e o '+
|
||||||
|
'pedido pode voltar depois de pago. O metro sai pela tabela, <b>'+rs(TABELA[modo])+'</b>. '+
|
||||||
|
'Exportando em <b>PNG</b>, ou num PDF menor, a conferência sai aqui, antes de pagar.</p>' : '')+
|
||||||
(suspeito? '<p class="avisoF"><b>Este PDF passa do tamanho que o formato comporta.</b> '+
|
(suspeito? '<p class="avisoF"><b>Este PDF passa do tamanho que o formato comporta.</b> '+
|
||||||
'A especificação para em 508 cm e o seu tem '+n1(x.med.alt)+' cm. '+
|
'A especificação para em 508 cm e o seu tem '+n1(x.med.alt)+' cm. '+
|
||||||
'Ele abre certo só em quem o gerou — aqui vai precisar de tratamento. '+
|
'Ele abre certo só em quem o gerou — aqui vai precisar de tratamento. '+
|
||||||
@@ -623,7 +630,7 @@ function pintaArtes(){
|
|||||||
barra='<div class="prog"><i style="width:'+a.lendo+'%"></i></div>'+
|
barra='<div class="prog"><i style="width:'+a.lendo+'%"></i></div>'+
|
||||||
'<span class="progT">arquivo grande · gerando a prévia · '+faltaLeitura(a.leitura)+'</span>';
|
'<span class="progT">arquivo grande · gerando a prévia · '+faltaLeitura(a.leitura)+'</span>';
|
||||||
}else if(a.decodeError){
|
}else if(a.decodeError){
|
||||||
aviso='<p class="avisoF"><b>Não conseguimos ler esta imagem.</b> Exporte novamente em PNG ou JPG.</p>';
|
aviso='<p class="avisoF"><b>Não conseguimos ler esta imagem.</b> Exporte novamente em PNG.</p>';
|
||||||
}else if(a.cm>larguraFilme()){
|
}else if(a.cm>larguraFilme()){
|
||||||
aviso='<p class="avisoF"><b>Largura maior que o filme.</b> O filme aqui tem '+n1(larguraFilme())+' cm.</p>';
|
aviso='<p class="avisoF"><b>Largura maior que o filme.</b> O filme aqui tem '+n1(larguraFilme())+' cm.</p>';
|
||||||
}else if(a.cm>0 && (a.src||a.semPrevia)){
|
}else if(a.cm>0 && (a.src||a.semPrevia)){
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ function avaliar(){
|
|||||||
if(!artes.length) return {pronto:false, falta:'Arraste suas artes para começar.'};
|
if(!artes.length) return {pronto:false, falta:'Arraste suas artes para começar.'};
|
||||||
if(artes.some(a=>a.lendo!=null)) return {pronto:false, falta:'Gerando a prévia das artes grandes…'};
|
if(artes.some(a=>a.lendo!=null)) return {pronto:false, falta:'Gerando a prévia das artes grandes…'};
|
||||||
if(artes.some(a=>a.decodeError || !(a.src||a.semPrevia) || !(a.px>0) || !(a.py>0)))
|
if(artes.some(a=>a.decodeError || !(a.src||a.semPrevia) || !(a.px>0) || !(a.py>0)))
|
||||||
return {pronto:false, falta:'Não conseguimos ler uma das imagens. Exporte-a novamente em PNG ou JPG antes de continuar.'};
|
return {pronto:false, falta:'Não conseguimos ler uma das imagens. Exporte-a novamente em PNG antes de continuar.'};
|
||||||
if(artes.some(a=>!Number.isFinite(a.cm) || a.cm>larguraFilme()))
|
if(artes.some(a=>!Number.isFinite(a.cm) || a.cm>larguraFilme()))
|
||||||
return {pronto:false, falta:'A largura da arte precisa caber no filme de '+
|
return {pronto:false, falta:'A largura da arte precisa caber no filme de '+
|
||||||
n1(larguraFilme())+' cm. Reduza a medida solicitada antes de continuar.'};
|
n1(larguraFilme())+' cm. Reduza a medida solicitada antes de continuar.'};
|
||||||
|
|||||||
@@ -12,10 +12,15 @@ function recusa(lista){
|
|||||||
if(!lista.length){ el.style.display='none'; el.innerHTML=''; return; }
|
if(!lista.length){ el.style.display='none'; el.innerHTML=''; return; }
|
||||||
const exts=escapeHTML([...new Set(lista.map(f=>extDe(f.name)))].join(', '));
|
const exts=escapeHTML([...new Set(lista.map(f=>extDe(f.name)))].join(', '));
|
||||||
el.style.display='block';
|
el.style.display='block';
|
||||||
|
if(lista.every(f=>/\.jpe?g$/i.test(f.name))){
|
||||||
|
el.innerHTML='<b>JPG não dá para enviar.</b> JPG não tem fundo transparente, e o branco do fundo '+
|
||||||
|
'sai no filme. Exporte em '+(ehFolha()?'PNG ou PDF':'PNG')+' com fundo transparente e envie de novo.';
|
||||||
|
return;
|
||||||
|
}
|
||||||
el.innerHTML = ehFolha()
|
el.innerHTML = ehFolha()
|
||||||
? '<b>'+exts+' não dá para enviar aqui.</b> A folha pronta aceita PNG, JPG, TIFF, '+
|
? '<b>'+exts+' não dá para enviar aqui.</b> A folha pronta aceita PNG, PDF, TIFF, '+
|
||||||
'PDF, PSD, AI e CDR.'
|
'PSD, AI e CDR, com fundo transparente.'
|
||||||
: '<b>'+exts+' não dá para enviar aqui.</b> Artes avulsas precisam de PNG ou JPG com '+
|
: '<b>'+exts+' não dá para enviar aqui.</b> Artes avulsas precisam de PNG com '+
|
||||||
'fundo transparente — é o que a montagem enxerga para encaixar. '+
|
'fundo transparente — é o que a montagem enxerga para encaixar. '+
|
||||||
'Se o seu arquivo é CDR, AI ou PSD, exporte em PNG ou use <b>Arquivo por metro</b>.';
|
'Se o seu arquivo é CDR, AI ou PSD, exporte em PNG ou use <b>Arquivo por metro</b>.';
|
||||||
}
|
}
|
||||||
@@ -107,7 +112,7 @@ function sel(fs){
|
|||||||
x.pct=null; pintaFolha(); marcaResiduos(x);
|
x.pct=null; pintaFolha(); marcaResiduos(x);
|
||||||
});
|
});
|
||||||
}else if(md && /\.pdf$/i.test(x.f.name) && x.f.size>GRANDE_BYTES){
|
}else if(md && /\.pdf$/i.test(x.f.name) && x.f.size>GRANDE_BYTES){
|
||||||
x.semAnalise='PDF grande: a resolução das imagens de dentro é conferida pela equipe';
|
x.pdfGrande=true; // a warning on the sheet, like a file opened by hand
|
||||||
x.pct=null; pintaFolha();
|
x.pct=null; pintaFolha();
|
||||||
}else if(md && /\.pdf$/i.test(x.f.name)){
|
}else if(md && /\.pdf$/i.test(x.f.name)){
|
||||||
x.pct=70; pintaFolha();
|
x.pct=70; pintaFolha();
|
||||||
@@ -150,7 +155,7 @@ function medir(a){
|
|||||||
return dimensoesImagem(a.f).then(async d=>{
|
return dimensoesImagem(a.f).then(async d=>{
|
||||||
if(!d || !(d.w>0) || !(d.h>0)){ a.decodeError=true; return a; }
|
if(!d || !(d.w>0) || !(d.h>0)){ a.decodeError=true; return a; }
|
||||||
a.px=d.w; a.py=d.h; a.prop=d.h/d.w; a.grande=true;
|
a.px=d.w; a.py=d.h; a.prop=d.h/d.w; a.grande=true;
|
||||||
// JPG and WebP cannot be read in parts: the art is placed by its
|
// WebP cannot be read in parts (JPG is refused): the art is placed by its
|
||||||
// measurements, as a full box, and the team checks it before printing.
|
// measurements, as a full box, and the team checks it before printing.
|
||||||
if(!/\.png$/i.test(a.f.name)){ a.semPrevia=true; return a; }
|
if(!/\.png$/i.test(a.f.name)){ a.semPrevia=true; return a; }
|
||||||
a.lendo=0; a.leitura={inicio:Date.now(), p:0}; pintaArtes();
|
a.lendo=0; a.leitura={inicio:Date.now(), p:0}; pintaArtes();
|
||||||
|
|||||||
Reference in New Issue
Block a user