Estimate your parking leaks before ordering the demo
Four basic data, a pre-configured profile and, if you want, hand-editable coefficients. Download the PDF or image breakdown to review with your team.
`;
}
function init(root) {
if (root.dataset.ready) return;
root.dataset.ready = '1';
let state = {
stays:400, fare:80, extrasPct:40, subs:50,
...defaults
};
let selected = -1;
let latest;
root.innerHTML = `
Leak calculator
How much do you miss each month?
Four basic facts. Choose a profile to preload
realistic coefficients and then refine them one by one.
Profile of your parking
${profiles.map((p,i)=>`
${esc(p[0])}
${esc(p[1])}
`).join('')}
${primary.map(slider).join('')}
Tune coefficients manually +
Edit any value by hand or use the slider.
${advanced.map(([name,fields])=>`
${esc(name)}
${fields.map(slider).join('')}
`).join('')}
Reset coefficients
Monthly estimate
Conservative model. Apply recovery factor
in overselling and subscriptions, and limits the total leakage
at 15% of gross monthly income.
15% cap applied to gross income.
${labels.map((label,i)=>`
`).join('')}
`; const $ = q => root.querySelector(q); const $$ = q => [...root.querySelectorAll(q)]; function calc() { const s = state; let vals = [ s.stays*s.oversalePct/100*s.fare*s.CashLossPct/100, s.stays*s.flightsPct/100*s.flightsCost, s.stays*s.adoptionextras/100*s.extrasPrice*s.extrasPct/100, s.subs*s.renewalPct/100*s.subscriptionrate*s.lostmonths ]; const raw = vals.reduce((a,b)=>a b,0); const cap = (s.stays*s.fare s.subs*s.subscriptionrate)*.15; const capped = raw>cap if(!key)return; const v=Number(e.target.value); if(!Number.isFinite(v))return; state[key]=Math.max(0,v); if(Object.prototype.hasOwnProperty.call(defaults,key)) selected=-1; render(); }); root.addEventListener('change',e=>{ const key=e.target.dataset.number; if(!key)return; const range=e.target.closest('[data-field]') .querySelector('[data-range]'); state[key]=Math.max( range.min, Math.min( range.max,Number(e.target.value)||0)); render(); }); $$('[data-profile]').forEach((el,i)=>{ el.addEventListener('click',()=>{ Object.assign(state,profiles[i][2]); selected=i; render(); }); }); $('.pw-reset').addEventListener('click',()=>{ Object.assign(state,defaults); selected=-1; render(); }); $('.pw-toggle').addEventListener('click',()=>{ const content=$('.pw-advanced-content'); const open=content.hidden; content.hidden=!open; $('.pw-toggle').setAttribute('aria-expanded',String(open)); $('.pw-toggle').textContent=open?'−':' '; }); function download(blob,name) { const a=document.createElement('a'); const url=URL.createObjectURL(blob); a.href=url; a.download=name; document.body.append(a); a.click(); a.remove(); setTimeout(()=>URL.revokeObjectURL(url),3000); } function makeSvg() { const {vals,total}=latest; const rows=labels.map((label,i)=>`
${esc(label)}
${esc(money(waltz[i]))}
`).join('');
return `
PARKWIN · CALCULADORA DE FUGAS
${esc(money(total))} / mes
${esc(money(total*12))} al año de margen que no llega a caja
${rows}
Estimación orientativa · Límite del 15%
`;
}
$('[data-export="png"]').addEventListener('click',()=>{
const img=new Image();
const url=URL.createObjectURL(
new Blob([makeSvg()],{type:'image/svg xml;charset=utf-8'})
);
img.onload=()=>{
const canvas=document.createElement('canvas');
canvas.width=1800;
canvas.height=1080;
canvas.getContext('2d').drawImage(img,0,0,1800,1080);
canvas.toBlob(blob=>{
if(blob)download(blob,'parkwin-leaks.png');
},'image/png');
URL.revokeObjectURL(url);
};
img.onerror=()=>URL.revokeObjectURL(url);
img.src=url;
});
// CORPORATE PDF WITH A4 DESIGN
$('[data-export="pdf"]').addEventListener('click',()=>{
const result=calc();
const date=new Intl.DateTimeFormat('es-ES',{
day:'numeric',month:'long',year:'numeric'
}).format(new Date());
const dataRows=[
['Completed stays/month',state.stays],
['Average rate per stay',money(state.fare)],
['% extras offered without charge',state.extrasPct '%'],
['Active monthly subscriptions',state.subs]
];
const breakdown=labels.map((label,i)=>{
const amount=result.vals[i];
const width=result.total>0
? Math.min(100,amount/result.total*100)
: 0;
return `
${esc(label)}
${esc(money(amount))}
`;
}).join('');
const html=`
Parkwin - Leak Estimation
PARKWIN · LEAK CALCULATOR
Estimated monthly leaks
Generated on ${esc(date)}
Monthly estimates
${esc(money(result.total))}
≈ ${esc(money(result.total*12))} per year of uncaptured margin.
Your data
${dataRows.map(([label,value])=>`
${esc(label)}
${esc(value)}
`).join('')}
Leak Breakdown
${breakdown}
Method
Effective loss due to overselling
${esc(state.effectivePctloss)}%
Average months lost due to non-renewal
${esc(state.lostmonths)}
Limit applied on gross income
15%
`;
const printWindow=window.open('','_blank');
if(!printWindow) {
alert('Allow pop-up windows to generate the PDF.');
return;
}
printWindow.document.open();
printWindow.document.write(html);
printWindow.document.close();
printWindow.onload=()=>{
setTimeout(()=>printWindow.print(),400);
};
});
render();
}
function boot() {
document.querySelectorAll('[data-pw-calculator]').forEach(init);
}
if(document.readyState==='loading') {
document.addEventListener('DOMContentLoaded',boot);
} else {
boot();
}
})();