fix: the Kanban shows the package's real weight and what Jadlog charges it as
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 2m40s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 57s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 2m40s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 57s
"Frete Jadlog · 4,541 kg" read as if 2,30 m of film weighed 4.5 kg. It now reads "0,47 kg · cobrado como 4,54 kg pela caixa" when the box's cubed weight is what Jadlog charges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,14 @@ function facts(pairs){
|
||||
}
|
||||
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);
|
||||
// The freight's weight: what the package weighs and, when Jadlog charges the
|
||||
// box's size instead (the cubed weight), what it is charged as.
|
||||
function freightWeight(fr){
|
||||
const kg=v=>Number(v).toLocaleString('pt-BR',{maximumFractionDigits:2})+' kg';
|
||||
if(!fr?.weight_kg)return '';
|
||||
if(fr.real_kg&&Number(fr.real_kg)<Number(fr.weight_kg))return kg(fr.real_kg)+' · cobrado como '+kg(fr.weight_kg)+' pela caixa';
|
||||
return kg(fr.weight_kg);
|
||||
}
|
||||
// A download button: the arrow, then its label.
|
||||
function downloadButton(text,fn,className){const b=button(text,fn,className);b.prepend(icon(ICON_DOWNLOAD));b.classList.add('with-icon');return b;}
|
||||
async function api(path,body){
|
||||
@@ -371,7 +379,7 @@ function renderPanel(order){
|
||||
const placeLine=node('b');placeLine.append(icon(dest?ICON_TRUCK:ICON_PIN),dest?dest.recipient:'Retirada em Franca');
|
||||
where.append(node('p','Entrega','eyebrow'),placeLine,
|
||||
node('span',dest?dest.street+', '+dest.number+(dest.complement?' '+dest.complement:'')+' · '+dest.district+' · '+dest.city+'/'+dest.state+' · CEP '+dest.postal_code:'Cliente retira na fábrica'));
|
||||
if(dest&&s.freight?.total_cents)where.append(node('span','Jadlog · '+money(s.freight.total_cents)+(s.freight.weight_kg?' · '+String(s.freight.weight_kg).replace('.',',')+' kg':''),'faint'));
|
||||
if(dest&&s.freight?.total_cents)where.append(node('span','Jadlog · '+money(s.freight.total_cents)+(s.freight.weight_kg?' · '+freightWeight(s.freight):''),'faint'));
|
||||
facts.append(who,where);
|
||||
const items=node('section');items.append(node('p',s.items.length>1?'Itens':'Item','eyebrow'));
|
||||
const itemsList=node('div');itemsList.style.display='flex';itemsList.style.flexDirection='column';itemsList.style.gap='10px';
|
||||
@@ -607,7 +615,7 @@ function review(quote){
|
||||
const sums=node('div',undefined,'qsums');const fr=quote.approved.freight||{};
|
||||
const itemsTotal=quote.approved.items.reduce((t,i)=>t+i.total_cents,0);
|
||||
sums.append(node('span','Itens '),node('b',money(itemsTotal)),
|
||||
node('span',fr.service==='pickup'||!fr.total_cents?' · Retirada ':' · Frete Jadlog'+(fr.weight_kg?' · '+String(fr.weight_kg).replace('.',',')+' kg':'')+' '),
|
||||
node('span',fr.service==='pickup'||!fr.total_cents?' · Retirada ':' · Frete Jadlog'+(fr.weight_kg?' · '+freightWeight(fr):'')+' '),
|
||||
node('b',fr.total_cents?money(fr.total_cents):'grátis'));
|
||||
content.append(sums);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user