Merge front 7a.4: montador Venda with shipping

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-11 14:46:42 -03:00
6 changed files with 288 additions and 30 deletions

View File

@@ -111,11 +111,11 @@ def montador_upload(body: UploadStart, user=Depends(can('assemble'))):
@router.post('/api/operator/montador/orders')
def montador_order(body: MontadorOrder, request: Request, user=Depends(can('assemble'))):
"""The card a montador sheet becomes (front 7a.3): Interno (the fixed
internal customer, origin dropflow, never Tiny) or Venda (a Tiny customer,
origin atendimento, invoiced and sent to Tiny). Pickup in both, at the
Site's table price; the order records whether it travels with a clothing
order."""
"""The card a montador sheet becomes (fronts 7a.3 and 7a.4): Interno (the
fixed internal customer, origin dropflow, never Tiny) or Venda (a Tiny
customer, origin atendimento, invoiced and sent to Tiny), at the Site's
table price. A Venda is picked up, travels with a clothing order or ships
with the Site's freight; approve quotes the freight again."""
role = request.state.operator['role']
if body.kind not in MONTADOR_KINDS.get(role, set()):
raise HTTPException(403, 'Seu perfil não permite este tipo de pedido.')
@@ -127,7 +127,8 @@ def montador_order(body: MontadorOrder, request: Request, user=Depends(can('asse
customer = body.customer
origin, method = 'atendimento', payments.INVOICED_METHOD
draft = QuoteRequest(request_key=body.request_key, customer=customer, items=body.items,
freight=Freight(service='pickup')).model_dump(mode='json', exclude={'request_key'})
freight=body.freight or Freight(service='pickup'),
destination=body.destination).model_dump(mode='json', exclude={'request_key'})
draft['montador'] = True
draft['kind'] = body.kind
if body.with_order:

View File

@@ -289,10 +289,11 @@ class QuoteRequest(StrictModel):
return self
class MontadorOrder(StrictModel):
"""What the montador sends (front 7a.3): Interno or Venda, loose artwork
only and pickup; the server prices and approves it as a quote. An Interno
"""What the montador sends (fronts 7a.3 and 7a.4): Interno or Venda, loose
artwork only; the server prices and approves it as a quote. An Interno
order takes the fixed customer from the database, a Venda one the customer
picked from Tiny."""
picked from Tiny. A Venda ships with the Site's freight or travels with the
customer's clothing order; an Interno never ships."""
request_key: UUID
kind: Literal['interno', 'venda']
# Empty for an Interno order: the server reads the internal customer.
@@ -300,6 +301,9 @@ class MontadorOrder(StrictModel):
items: list[Item] = Field(min_length=1, max_length=30)
# A Venda that travels with the customer's clothing order; pickup freight.
with_order: int | None = Field(default=None, ge=1, le=999999, strict=True)
# A Venda with "Envio": the chosen freight service and the full address.
freight: Freight | None = None
destination: Destination | None = None
@model_validator(mode='after')
def order_kind(self):
@@ -307,8 +311,21 @@ class MontadorOrder(StrictModel):
raise ValueError('O montador só monta artes avulsas.')
if self.kind == 'venda' and self.customer is None:
raise ValueError('O pedido de venda precisa do cliente.')
if self.kind == 'interno' and self.with_order is not None:
raise ValueError('O pedido interno não tem envio.')
delivery = bool(self.freight and self.freight.service != 'pickup')
if self.kind == 'interno':
if self.with_order is not None:
raise ValueError('O pedido interno não tem envio.')
if delivery or self.destination is not None:
raise ValueError('O pedido interno não tem envio.')
elif delivery:
if self.with_order is not None:
raise ValueError('Escolha retirada, envio ou junto com o pedido de roupa.')
if self.destination is None:
raise ValueError('O envio precisa do endereço completo.')
if self.destination.postal_code != self.freight.postal_code:
raise ValueError('O CEP do frete e o do endereço precisam ser o mesmo.')
elif self.destination is not None:
raise ValueError('Só o pedido com envio tem endereço de entrega.')
return self
class Review(StrictModel):

View File

@@ -79,6 +79,8 @@ def run():
'zap': '1633334444', 'mail': f'interno-{tag}@example.test'}
venda_customer = {'name': 'Maria Souza', 'cnpj': '12345678909',
'zap': '16988887777', 'mail': f'venda-{tag}@example.test'}
envio_customer = {'name': 'Maria Souza', 'cnpj': '12345678909',
'zap': '16988887777', 'mail': f'envio-{tag}@example.test'}
identities = [operator_identity(emails['expedicao']), operator_identity(emails['vendedor'])]
made_orders, made_quotes = [], []
# A code of its own, so a brand someone saved in Estampas/ is never touched.
@@ -200,8 +202,36 @@ def run():
designer.call('/operator/montador/orders', {'request_key': str(uuid4()), **venda}, expected=403)
shipping.call('/operator/montador/orders', {'request_key': str(uuid4()), 'kind': 'interno',
'items': [montador_item(stamp, 'file')]}, expected=422)
# Venda with Envio: the Site's freight, re-quoted by the server.
destination = {'recipient': 'Maria Souza', 'street': 'Rua das Flores', 'number': '100',
'complement': 'Sala 2', 'district': 'Centro', 'city': 'Franca',
'state': 'SP', 'postal_code': '14400000'}
envio_stamp = upload_stamp(seller)
envio = {'kind': 'venda', 'customer': envio_customer, 'items': [montador_item(envio_stamp)],
'freight': {'service': 'mock-standard', 'postal_code': '14400000'},
'destination': destination}
order_envio = seller.call('/operator/montador/orders', {'request_key': str(uuid4()), **envio})
made_orders.append(UUID(order_envio['id']))
made_quotes.append(UUID(order_envio['quote_id']))
snapshot = order_envio['snapshot']
assert snapshot['destination'] == destination, snapshot.get('destination')
assert snapshot['freight']['service'] == 'mock-standard', snapshot.get('freight')
assert snapshot['freight']['total_cents'] > 0, snapshot.get('freight')
assert snapshot['total_cents'] == (sum(item['total_cents'] for item in snapshot['items']) +
snapshot['freight']['total_cents']), snapshot['total_cents']
with db.connect() as c:
assert c.execute('SELECT 1 FROM dtf_local.outbox WHERE event_key=%s AND provider=%s',
(f"{order_envio['id']}:paid:tiny", 'tiny')).fetchone()
# Envio needs the full address; an Interno order never ships.
sem_destino = {key: value for key, value in envio.items() if key != 'destination'}
seller.call('/operator/montador/orders', {'request_key': str(uuid4()), **sem_destino}, expected=422)
shipping.call('/operator/montador/orders', {'request_key': str(uuid4()), 'kind': 'interno',
'items': [montador_item(stamp)],
'destination': destination}, expected=422)
print('PASS: Expedição makes Interno and Vendedor makes Venda; the internal customer, the Tiny '
'contacts, the stamp brand and the table price in Números work; invalid profiles and modes are refused')
'contacts, the stamp brand and the table price in Números work; a Venda with Envio carries '
'the destination and the quoted freight; invalid profiles, modes and deliveries are refused')
finally:
with db.connect() as c:
if made_orders:
@@ -215,8 +245,8 @@ def run():
c.execute('DELETE FROM dtf_local.orders WHERE id=%s', (oid,))
if made_quotes:
c.execute('DELETE FROM dtf_local.quotes WHERE id=ANY(%s)', (made_quotes,))
c.execute('DELETE FROM dtf_local.mail_queue WHERE to_addr IN (%s,%s)',
(internal_customer['mail'], venda_customer['mail']))
c.execute('DELETE FROM dtf_local.mail_queue WHERE to_addr IN (%s,%s,%s)',
(internal_customer['mail'], venda_customer['mail'], envio_customer['mail']))
for identity in identities:
c.execute('DELETE FROM dtf_local.uploads WHERE owner=%s', (identity,))
c.execute('DELETE FROM dtf_local.stamps WHERE code=%s', (stamp_code,))

View File

@@ -10,7 +10,8 @@ const MONTAR_DPI_REFUSE=96, MONTAR_DPI_WARN=200;
const MONTAR_FILM_CM=57, MONTAR_GAP_CM=0.5;
const MONTAR={sizes:[],lines:[],seq:0,preview:null,timer:null,dirty:false,token:0,
layout:null,layoutTimer:null,layoutToken:0,layoutPending:false,creating:false,requestKey:null,
kind:null,internal:null,internalDirty:false,brands:new Map(),contactToken:0,contactTimer:null};
kind:null,internal:null,internalDirty:false,brands:new Map(),contactToken:0,contactTimer:null,
freights:null,freight:null,catalog:null};
const montarFolderReady=()=>!!FOLDER.handle&&!!FOLDER.granted;
const montarDpi=found=>found.width/(found.widthCm/2.54);
@@ -66,15 +67,138 @@ function montarPaintCustomer(){
}
const montarDelivery=()=>document.querySelector('input[name="montar-delivery"]:checked')?.value||'pickup';
function montarPaintDelivery(){
const withOrder=montarDelivery()==='with_order';
const delivery=montarDelivery(),withOrder=delivery==='with_order',ship=delivery==='ship';
$('montar-with-order').disabled=!withOrder;
if(!withOrder)$('montar-with-order').value='';
$('montar-shipping').hidden=!ship;
if(ship&&!$('montar-ship-recipient').value.trim())
$('montar-ship-recipient').value=$('montar-name').value.trim();
montarPaintFreights();
}
function montarWithOrder(){
if(MONTAR.kind!=='venda'||montarDelivery()!=='with_order')return null;
const value=Math.round(Number($('montar-with-order').value));
return Number.isInteger(value)&&value>=1&&value<=999999?value:null;
}
// ---- Envio (front 7a.4): the Site's own freight ---------------------------
// The Site's public routes for the CEP and the carrier quotes (app/api/health.py);
// the Kanban's api() helper only reaches /api/operator.
// The Site's UFS list (web/site-config.js), copied for the address select.
const MONTAR_UFS='AC AL AP AM BA CE DF ES GO MA MT MS MG PA PB PR PE PI RJ RN RS RO RR SC SP SE TO'.split(' ');
const montarCep=()=>$('montar-ship-cep').value.replace(/\D/g,'').slice(0,8);
function montarDestination(){
const destination={recipient:$('montar-ship-recipient').value.trim(),
street:$('montar-ship-street').value.trim(),number:$('montar-ship-number').value.trim(),
complement:$('montar-ship-complement').value.trim(),
district:$('montar-ship-district').value.trim(),city:$('montar-ship-city').value.trim(),
state:$('montar-ship-state').value.trim().toUpperCase(),postal_code:montarCep()};
const ok=destination.postal_code.length===8&&destination.recipient.length>=2&&
destination.street.length>=2&&destination.number.length>=1&&
destination.district.length>=2&&destination.city.length>=2&&MONTAR_UFS.includes(destination.state);
return ok?destination:null;
}
const montarShipReady=()=>montarDelivery()==='ship'&&!!montarDestination()&&
!!MONTAR.freight&&MONTAR.freight.postal_code===montarCep();
function montarResetFreight(){
MONTAR.freights=null;MONTAR.freight=null;
$('montar-freights').replaceChildren();$('montar-freights').hidden=true;
$('montar-freight-msg').textContent='';
}
async function montarPublic(path,options={}){
const response=await fetch('/api'+path,options);
const data=await response.json().catch(()=>({}));
if(!response.ok)throw new Error(typeof data.detail==='string'?data.detail:'Não foi possível agora ('+response.status+').');
return data;
}
async function montarCepLookup(){
const msg=$('montar-ship-msg'),cep=montarCep();
if(cep.length!==8){msg.textContent='Informe um CEP com oito dígitos.';return;}
msg.textContent='Buscando o endereço…';
try{
const address=await montarPublic('/cep/'+cep);
$('montar-ship-street').value=address.street||'';
$('montar-ship-district').value=address.district||'';
$('montar-ship-city').value=address.city||'';
if(MONTAR_UFS.includes(address.state))$('montar-ship-state').value=address.state;
if(!$('montar-ship-recipient').value.trim())$('montar-ship-recipient').value=$('montar-name').value.trim();
msg.textContent='';MONTAR.requestKey=null;montarPaintActions();
}catch(e){msg.textContent=e.message;}
}
// The item's packed metres and the table value of the items, as the server
// will price them: the band price of the loose-art mode on the billed metres.
function montarQuoteFigures(lines){
const heights=montarGroups(lines).map(group=>{
const cargas=[];
group.sources.forEach((source,sourceIndex)=>{
for(let copyIndex=0;copyIndex<source.copies;copyIndex++)
cargas.push({a:{sourceIndex,giro:0,esp:false},img:source.line.img,copyIndex,
w:source.line.widthCm,h:source.line.heightCm,travado:false});
});
return encaixar(cargas,MONTAR_FILM_CM).altura/100;
});
const catalog=MONTAR.catalog?.avulsa;
if(!catalog)throw new Error('Preço de tabela indisponível agora.');
const billed=heights.map(metres=>Math.max(1,Math.ceil(metres*10)/10));
const total=+billed.reduce((sum,metres)=>sum+metres,0).toFixed(2);
let unit=catalog.unit_cents,best=null;
for(const band of catalog.bands||[]){
const from=Number(band.from_metres);
if(total>=from&&(best===null||from>=best)){best=from;unit=band.unit_cents;}
}
return {metres:+heights.reduce((sum,metres)=>sum+metres,0).toFixed(4),
cents:billed.reduce((sum,metres)=>sum+Math.floor(Number((metres*unit).toFixed(6))),0)};
}
async function montarCatalog(){
if(MONTAR.catalog)return MONTAR.catalog;
const session=await montarPublic('/session');
MONTAR.catalog=session.products||null;
return MONTAR.catalog;
}
async function montarFreightQuote(){
const msg=$('montar-freight-msg'),cep=montarCep();
if(cep.length!==8){msg.textContent='Informe o CEP de entrega primeiro.';return;}
if(!MONTAR.lines.length||!MONTAR.layout||MONTAR.layoutPending){
msg.textContent='Monte a folha antes de cotar o frete.';return;
}
msg.textContent='Cotando o frete…';
const token=MONTAR.layoutToken;
try{
await montarCatalog();
if(token!==MONTAR.layoutToken||montarCep()!==cep)return;
const figures=montarQuoteFigures([...MONTAR.lines]);
const result=await montarPublic('/freight/options',{method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({postal_code:cep,metres:figures.metres,declared_cents:figures.cents})});
if(token!==MONTAR.layoutToken||montarCep()!==cep)return;
MONTAR.freights=result.options||[];
MONTAR.freight=MONTAR.freights.length?{...MONTAR.freights[0],postal_code:cep}:null;
MONTAR.requestKey=null;
msg.textContent='';montarPaintFreights();montarPaintActions();
}catch(e){
if(token!==MONTAR.layoutToken||montarCep()!==cep)return;
MONTAR.freights=null;MONTAR.freight=null;
$('montar-freights').replaceChildren();$('montar-freights').hidden=true;
msg.textContent=e.message;montarPaintActions();
}
}
function montarPaintFreights(){
const box=$('montar-freights'),options=MONTAR.freights||[];
box.hidden=!options.length;
box.replaceChildren(...options.map(option=>{
const label=node('label',undefined,'montar-freight');
const radio=node('input');radio.type='radio';radio.name='montar-freight';radio.value=option.service;
radio.checked=!!MONTAR.freight&&option.service===MONTAR.freight.service;
radio.onchange=()=>{
MONTAR.freight={...option,postal_code:montarCep()};MONTAR.requestKey=null;montarPaintActions();
};
const meta=node('span',undefined,'montar-freight-meta');
meta.append(node('b',option.description||option.service),
node('span',option.days?'até '+option.days+' dias úteis':'','sub'),
node('em',money(option.total_cents)));
label.append(radio,meta);
return label;
}));
}
// The brand of a stamp, recorded for the future catalogue (Marcus, 10/11):
// only Gestão edits it; everyone who assembles reads it.
async function montarStampBrand(code){
@@ -231,6 +355,7 @@ function montarChanged(){
MONTAR.layout=null;
MONTAR.layoutPending=true;
MONTAR.requestKey=null;
montarResetFreight();
montarPaintLines();
if(!MONTAR.lines.length)montarDrawPreview(null);
clearTimeout(MONTAR.layoutTimer);
@@ -302,6 +427,11 @@ function montarClearCustomer(){
for(const id of MONTAR_CUSTOMER)$(id).value='';
$('montar-customer-q').value='';
$('montar-customer-hits').hidden=true;
for(const id of ['montar-ship-cep','montar-ship-recipient','montar-ship-street','montar-ship-number',
'montar-ship-complement','montar-ship-district','montar-ship-city','montar-ship-state'])
$(id).value='';
$('montar-ship-msg').textContent='';
montarResetFreight();
document.querySelector('input[name="montar-delivery"][value="pickup"]').checked=true;
montarPaintDelivery();
MONTAR.requestKey=null;
@@ -311,13 +441,16 @@ function montarClearCustomer(){
function montarPaintActions(){
const build=$('montar-build');
const customerReady=MONTAR.kind==='interno'?montarInternalReady():montarCustomerFilled();
const deliveryReady=MONTAR.kind!=='venda'||montarDelivery()!=='ship'||montarShipReady();
const ready=!!(MONTAR.lines.length&&MONTAR.layout&&!MONTAR.layoutPending&&
customerReady&&!MONTAR.creating);
customerReady&&deliveryReady&&!MONTAR.creating);
build.disabled=!ready;
build.title=ready?'':(!MONTAR.lines.length?'Monte a folha primeiro.'
:(MONTAR.layoutPending||!MONTAR.layout)?'Aguarde a montagem da folha.'
:MONTAR.kind==='interno'?'Peça à Gestão para completar o cliente interno.'
:'Preencha os dados do cliente.');
:!customerReady?'Preencha os dados do cliente.'
:!deliveryReady?(!montarDestination()?'Preencha o endereço de entrega.':'Cote o frete e escolha uma opção.')
:'');
}
// The Site's grade for loose art (web/site-quality.js): each stamp's DPI over
// the ideal 200, from 6 to 100; the item's is the average of its stamps'.
@@ -345,13 +478,11 @@ function montarItem(sources){
}
// 20 sources and 4000 copies per item; a stamp above 200 copies becomes
// several sources of the same upload, 200 each; items in list order.
function montarItems(lines,uploads){
function montarGroups(lines){
const pool=[];
for(const line of lines){
const uploadId=uploads.get(line.id);
for(const line of lines)
for(let left=line.qty;left>0;left-=200)
pool.push({line,uploadId,copies:Math.min(200,left)});
}
pool.push({line,copies:Math.min(200,left)});
const groups=[];let current=null;
for(const source of pool){
if(!current||current.sources.length>=20||current.copies+source.copies>4000){
@@ -359,7 +490,11 @@ function montarItems(lines,uploads){
}
current.sources.push(source);current.copies+=source.copies;
}
return groups.map(group=>montarItem(group.sources));
return groups;
}
function montarItems(lines,uploads){
return montarGroups(lines).map(group=>montarItem(group.sources.map(source=>
({...source,uploadId:uploads.get(source.line.id)}))));
}
async function montarCreate(){
if(MONTAR.creating)return;
@@ -373,8 +508,18 @@ async function montarCreate(){
if(!montarCustomerFilled())return say('Preencha os dados do cliente.',true);
name=customer.name;
}
if(kind==='venda'&&montarDelivery()==='with_order'&&!montarWithOrder())
return say('Informe o número do pedido de roupa.',true);
let withOrder=null,deliveryFreight=null,destination=null;
if(kind==='venda'&&montarDelivery()==='with_order'){
withOrder=montarWithOrder();
if(!withOrder)return say('Informe o número do pedido de roupa.',true);
}
if(kind==='venda'&&montarDelivery()==='ship'){
destination=montarDestination();
if(!destination)return say('Preencha o endereço de entrega.',true);
if(!MONTAR.freight)return say('Cote o frete e escolha uma opção.',true);
if(MONTAR.freight.postal_code!==montarCep())return say('Cote o frete de novo para este CEP.',true);
deliveryFreight={service:MONTAR.freight.service,postal_code:montarCep()};
}
if(!MONTAR.lines.length)return say('Monte a folha primeiro.',true);
if(!MONTAR.layout||MONTAR.layoutPending)return say('A montagem ainda está sendo calculada.',true);
const lines=[...MONTAR.lines];
@@ -395,8 +540,9 @@ async function montarCreate(){
const body={request_key:MONTAR.requestKey,kind,items:montarItems(lines,uploads)};
if(kind==='venda'){
body.customer=customer;
const withOrder=montarWithOrder();
if(withOrder)body.with_order=withOrder;
if(deliveryFreight)body.freight=deliveryFreight;
if(destination)body.destination=destination;
}
const order=await api('/montador/orders',body);
MONTAR.requestKey=null;
@@ -574,12 +720,16 @@ function montarQueueContacts(){
MONTAR.contactTimer=setTimeout(()=>montarSearchContacts().catch(e=>say(e.message,true)),300);
}
function montarPickContact(contact){
const previous=$('montar-name').value.trim();
$('montar-name').value=contact.name||'';
$('montar-doc').value=contact.document||'';
$('montar-zap').value=contact.phone||'';
$('montar-mail').value=contact.email||'';
$('montar-customer-q').value=contact.name||contact.document||'';
$('montar-customer-hits').hidden=true;
const recipient=$('montar-ship-recipient').value.trim();
if(montarDelivery()==='ship'&&(!recipient||recipient===previous))
$('montar-ship-recipient').value=contact.name||'';
MONTAR.requestKey=null;
montarPaintActions();
const missing=MONTAR_CUSTOMER.find(id=>!$(id).value.trim());
@@ -643,8 +793,31 @@ $('montar-with-order').addEventListener('focus',()=>{
});
$('montar-with-order').addEventListener('input',()=>{MONTAR.requestKey=null;});
for(const radio of document.querySelectorAll('input[name="montar-delivery"]'))
radio.addEventListener('change',()=>{MONTAR.requestKey=null;montarPaintDelivery();});
radio.addEventListener('change',()=>{MONTAR.requestKey=null;montarPaintDelivery();montarPaintActions();});
$('montar-ship-cep').addEventListener('input',()=>{
const digits=$('montar-ship-cep').value.replace(/\D/g,'').slice(0,8);
$('montar-ship-cep').value=digits.length>5?digits.slice(0,5)+'-'+digits.slice(5):digits;
MONTAR.requestKey=null;montarResetFreight();montarPaintActions();
});
$('montar-cep-find').onclick=async()=>{
$('montar-cep-find').disabled=true;
try{await montarCepLookup();}catch(e){say(e.message,true);}
finally{$('montar-cep-find').disabled=false;}
};
$('montar-freight-quote').onclick=async()=>{
$('montar-freight-quote').disabled=true;
try{await montarFreightQuote();}catch(e){say(e.message,true);}
finally{$('montar-freight-quote').disabled=false;}
};
for(const id of ['montar-ship-recipient','montar-ship-street','montar-ship-number',
'montar-ship-complement','montar-ship-district','montar-ship-city'])
$(id).addEventListener('input',()=>{MONTAR.requestKey=null;montarPaintActions();});
$('montar-ship-state').addEventListener('change',()=>{MONTAR.requestKey=null;montarPaintActions();});
document.addEventListener('click',event=>{
if(!event.target.closest('.montar-customer-search'))$('montar-customer-hits').hidden=true;
});
const montarUfPlaceholder=node('option','UF');montarUfPlaceholder.value='';
$('montar-ship-state').append(montarUfPlaceholder,...MONTAR_UFS.map(uf=>{
const option=node('option',uf);option.value=uf;return option;
}));
montarPaintDelivery();

View File

@@ -1306,6 +1306,22 @@ dialog.viewer::backdrop{background:var(--scrim)}
#tab-montar .montar-radio:has(input[type="radio"]:checked){border-color:var(--acc);color:var(--tx)}
#tab-montar .montar-radio input[type="number"]{width:110px;height:28px;padding:0 8px;border-radius:7px;border:1px solid var(--ln2);background:var(--bg);color:var(--tx);font-family:inherit;font-size:13px}
#tab-montar .montar-radio input[type="number"]:disabled{opacity:.5}
#tab-montar .montar-shipping{margin-top:12px}
#tab-montar .montar-cep{display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap}
#tab-montar .montar-cep .fld{flex:1;min-width:180px}
#tab-montar .montar-cep .btn{height:42px}
#tab-montar #montar-ship-msg,#tab-montar #montar-freight-msg{margin:8px 0 0;padding:0}
#tab-montar #montar-freight-msg{flex:1;min-width:180px}
#tab-montar .montar-ship-fields{margin-top:12px}
#tab-montar .montar-freight-actions{display:flex;align-items:center;gap:12px;margin-top:14px;flex-wrap:wrap}
#tab-montar .montar-freights{display:flex;flex-direction:column;gap:6px;margin-top:10px}
#tab-montar .montar-freight{display:flex;align-items:center;gap:10px;padding:9px 12px;border:1px solid var(--ln2);border-radius:9px;cursor:pointer}
#tab-montar .montar-freight:has(input:checked){border-color:var(--acc)}
#tab-montar .montar-freight input{accent-color:var(--acc)}
#tab-montar .montar-freight-meta{display:flex;flex:1;align-items:baseline;gap:10px;flex-wrap:wrap;min-width:0}
#tab-montar .montar-freight-meta b{font-size:13.5px;font-weight:650}
#tab-montar .montar-freight-meta .sub{font-size:12.5px;color:var(--tx3)}
#tab-montar .montar-freight-meta em{margin-left:auto;font-style:normal;font-weight:650}
#tab-montar .montar-brand{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:8px}
#tab-montar .montar-brand .lbl{font-size:12px;color:var(--tx3)}
#tab-montar .montar-brand b{font-size:13.5px;font-weight:650}

View File

@@ -154,12 +154,33 @@
<p class="phint" id="montar-interno-note" hidden>O cliente fixo dos pedidos internos.</p>
</div>
<div class="montar-delivery" id="montar-delivery">
<h3>Envio</h3>
<h3>Entrega</h3>
<div class="montar-delivery-options">
<label class="montar-radio"><input type="radio" name="montar-delivery" value="pickup" checked> Retirada</label>
<label class="montar-radio"><input type="radio" name="montar-delivery" value="with_order"> Junto com o pedido de roupa nº <input id="montar-with-order" type="number" min="1" max="999999" step="1" inputmode="numeric" disabled></label>
<label class="montar-radio"><input type="radio" name="montar-delivery" value="ship"> Envio</label>
</div>
<div class="montar-shipping" id="montar-shipping" hidden>
<div class="montar-cep">
<label class="fld"><span>CEP de entrega</span><input id="montar-ship-cep" inputmode="numeric" maxlength="9" autocomplete="off" placeholder="00000-000"></label>
<button class="btn" id="montar-cep-find" type="button">Buscar endereço</button>
</div>
<p class="phint" id="montar-ship-msg" role="status"></p>
<div class="montar-customer-fields montar-ship-fields">
<label class="fld"><span>Quem recebe</span><input id="montar-ship-recipient" maxlength="120" autocomplete="off" placeholder="Nome ou empresa"></label>
<label class="fld"><span>Rua / avenida</span><input id="montar-ship-street" maxlength="160" autocomplete="off"></label>
<label class="fld"><span>Número</span><input id="montar-ship-number" maxlength="20" autocomplete="off" placeholder="123 ou S/N"></label>
<label class="fld"><span>Complemento</span><input id="montar-ship-complement" maxlength="80" autocomplete="off"></label>
<label class="fld"><span>Bairro</span><input id="montar-ship-district" maxlength="80" autocomplete="off"></label>
<label class="fld"><span>Cidade</span><input id="montar-ship-city" maxlength="80" autocomplete="off"></label>
<label class="fld"><span>UF</span><select id="montar-ship-state"></select></label>
</div>
<div class="montar-freight-actions">
<button class="btn" id="montar-freight-quote" type="button">Cotar frete</button>
<span class="phint" id="montar-freight-msg" role="status"></span>
</div>
<div class="montar-freights" id="montar-freights" role="radiogroup" aria-label="Opções de entrega" hidden></div>
</div>
<p class="phint">Envio com o frete do Site chega na próxima etapa.</p>
</div>
<div class="montar-actions">
<button class="btn ghost" id="montar-clear" type="button">Limpar lista</button>