Apply Persian BiDi and formatting polish to Telegram Ads Cockpit

This commit is contained in:
parastoo 2026-11-11 12:09:29 +00:00
parent 3398a19218
commit 2cd79eac60
2 changed files with 20 additions and 20 deletions

View file

@ -381,7 +381,7 @@
<div>
<div class="flex justify-between text-xs font-bold mb-1">
<span>بودجه کل کمپین (TON):</span>
<span id="simBudgetVal" class="text-indigo-600 font-mono text-sm">75 TON (~35 م.ت)</span>
<span id="simBudgetVal" class="text-indigo-600 font-bold text-sm" dir="ltr">75 TON (~۳۵ م.ت)</span>
</div>
<input type="range" id="simBudget" min="20" max="200" step="5" value="75" oninput="calculateSimulator()" class="w-full accent-indigo-600">
</div>
@ -390,7 +390,7 @@
<div>
<div class="flex justify-between text-xs font-bold mb-1">
<span>میانگین CPM (TON):</span>
<span id="simCpmVal" class="text-indigo-600 font-mono text-sm">0.85 TON</span>
<span id="simCpmVal" class="text-indigo-600 font-bold text-sm" dir="ltr">0.85 TON</span>
</div>
<input type="range" id="simCpm" min="0.5" max="2.5" step="0.05" value="0.85" oninput="calculateSimulator()" class="w-full accent-indigo-600">
</div>
@ -399,7 +399,7 @@
<div>
<div class="flex justify-between text-xs font-bold mb-1">
<span>نرخ کلیک به پست کانال (CTR):</span>
<span id="simCtrVal" class="text-indigo-600 font-mono text-sm">1.8%</span>
<span id="simCtrVal" class="text-indigo-600 font-bold text-sm" dir="ltr">1.8%</span>
</div>
<input type="range" id="simCtr" min="0.8" max="4.0" step="0.1" value="1.8" oninput="calculateSimulator()" class="w-full accent-indigo-600">
</div>
@ -408,7 +408,7 @@
<div>
<div class="flex justify-between text-xs font-bold mb-1">
<span>نرخ تبدیل کلیک به خرید (CVR):</span>
<span id="simCvrVal" class="text-indigo-600 font-mono text-sm">2.8%</span>
<span id="simCvrVal" class="text-indigo-600 font-bold text-sm" dir="ltr">2.8%</span>
</div>
<input type="range" id="simCvr" min="1.0" max="6.0" step="0.1" value="2.8" oninput="calculateSimulator()" class="w-full accent-indigo-600">
</div>
@ -452,7 +452,7 @@
<div class="bg-blue-50/70 border border-blue-200 rounded-2xl p-4 flex flex-col justify-between">
<span class="text-xs font-bold text-blue-950">بهای هر سفارش (CPO)</span>
<div>
<span id="resCpo" class="text-2xl font-black text-blue-700 tnum block">۱۶۵,۰۰۰ ت</span>
<span id="resCpo" class="text-2xl font-black text-blue-700 tnum block whitespace-nowrap">۱۵۹,۰۰۰ تومان</span>
<span class="text-[10px] text-blue-600">هزینه جذب هر خریدار</span>
</div>
</div>
@ -1619,7 +1619,8 @@ ${t.post_draft}
const aov = parseFloat(document.getElementById('simAov').value);
// Labels update
document.getElementById('simBudgetVal').innerText = budgetTon + ' TON (~' + Math.round(budgetTon * 466000 / 1000000) + ' م.ت)';
const budgetTomans = budgetTon * 466000;
document.getElementById('simBudgetVal').innerText = budgetTon + ' TON (~' + (Math.round(budgetTomans / 1000000)).toLocaleString('fa-IR') + ' م.ت)';
document.getElementById('simCpmVal').innerText = cpm + ' TON';
document.getElementById('simCtrVal').innerText = (ctr * 100).toFixed(1) + '%';
document.getElementById('simCvrVal').innerText = (cvr * 100).toFixed(1) + '%';
@ -1629,18 +1630,17 @@ ${t.post_draft}
const impressions = Math.round((budgetTon / cpm) * 1000);
const clicks = Math.round(impressions * ctr);
const orders = Math.round(clicks * cvr);
const budgetTomans = budgetTon * 466000;
const gmv = orders * aov;
const cpo = orders > 0 ? Math.round(budgetTomans / orders) : 0;
const roas = budgetTomans > 0 ? (gmv / budgetTomans).toFixed(2) : '0';
// Update DOM
// Update DOM with Persian formatting
document.getElementById('resImpressions').innerText = impressions.toLocaleString('fa-IR');
document.getElementById('resClicks').innerText = clicks.toLocaleString('fa-IR');
document.getElementById('resOrders').innerText = orders.toLocaleString('fa-IR') + ' رزرو';
document.getElementById('resCpo').innerText = (cpo / 1000).toLocaleString('fa-IR') + ' هزار ت';
document.getElementById('resCpo').innerText = cpo.toLocaleString('fa-IR') + ' تومان';
document.getElementById('resGmv').innerText = gmv.toLocaleString('fa-IR') + ' تومان';
document.getElementById('resRoas').innerText = roas + 'x';
document.getElementById('resRoas').innerText = parseFloat(roas).toLocaleString('fa-IR') + 'x';
}
function resetSimulator() {

View file

@ -381,7 +381,7 @@
<div>
<div class="flex justify-between text-xs font-bold mb-1">
<span>بودجه کل کمپین (TON):</span>
<span id="simBudgetVal" class="text-indigo-600 font-mono text-sm">75 TON (~35 م.ت)</span>
<span id="simBudgetVal" class="text-indigo-600 font-bold text-sm" dir="ltr">75 TON (~۳۵ م.ت)</span>
</div>
<input type="range" id="simBudget" min="20" max="200" step="5" value="75" oninput="calculateSimulator()" class="w-full accent-indigo-600">
</div>
@ -390,7 +390,7 @@
<div>
<div class="flex justify-between text-xs font-bold mb-1">
<span>میانگین CPM (TON):</span>
<span id="simCpmVal" class="text-indigo-600 font-mono text-sm">0.85 TON</span>
<span id="simCpmVal" class="text-indigo-600 font-bold text-sm" dir="ltr">0.85 TON</span>
</div>
<input type="range" id="simCpm" min="0.5" max="2.5" step="0.05" value="0.85" oninput="calculateSimulator()" class="w-full accent-indigo-600">
</div>
@ -399,7 +399,7 @@
<div>
<div class="flex justify-between text-xs font-bold mb-1">
<span>نرخ کلیک به پست کانال (CTR):</span>
<span id="simCtrVal" class="text-indigo-600 font-mono text-sm">1.8%</span>
<span id="simCtrVal" class="text-indigo-600 font-bold text-sm" dir="ltr">1.8%</span>
</div>
<input type="range" id="simCtr" min="0.8" max="4.0" step="0.1" value="1.8" oninput="calculateSimulator()" class="w-full accent-indigo-600">
</div>
@ -408,7 +408,7 @@
<div>
<div class="flex justify-between text-xs font-bold mb-1">
<span>نرخ تبدیل کلیک به خرید (CVR):</span>
<span id="simCvrVal" class="text-indigo-600 font-mono text-sm">2.8%</span>
<span id="simCvrVal" class="text-indigo-600 font-bold text-sm" dir="ltr">2.8%</span>
</div>
<input type="range" id="simCvr" min="1.0" max="6.0" step="0.1" value="2.8" oninput="calculateSimulator()" class="w-full accent-indigo-600">
</div>
@ -452,7 +452,7 @@
<div class="bg-blue-50/70 border border-blue-200 rounded-2xl p-4 flex flex-col justify-between">
<span class="text-xs font-bold text-blue-950">بهای هر سفارش (CPO)</span>
<div>
<span id="resCpo" class="text-2xl font-black text-blue-700 tnum block">۱۶۵,۰۰۰ ت</span>
<span id="resCpo" class="text-2xl font-black text-blue-700 tnum block whitespace-nowrap">۱۵۹,۰۰۰ تومان</span>
<span class="text-[10px] text-blue-600">هزینه جذب هر خریدار</span>
</div>
</div>
@ -1619,7 +1619,8 @@ ${t.post_draft}
const aov = parseFloat(document.getElementById('simAov').value);
// Labels update
document.getElementById('simBudgetVal').innerText = budgetTon + ' TON (~' + Math.round(budgetTon * 466000 / 1000000) + ' م.ت)';
const budgetTomans = budgetTon * 466000;
document.getElementById('simBudgetVal').innerText = budgetTon + ' TON (~' + (Math.round(budgetTomans / 1000000)).toLocaleString('fa-IR') + ' م.ت)';
document.getElementById('simCpmVal').innerText = cpm + ' TON';
document.getElementById('simCtrVal').innerText = (ctr * 100).toFixed(1) + '%';
document.getElementById('simCvrVal').innerText = (cvr * 100).toFixed(1) + '%';
@ -1629,18 +1630,17 @@ ${t.post_draft}
const impressions = Math.round((budgetTon / cpm) * 1000);
const clicks = Math.round(impressions * ctr);
const orders = Math.round(clicks * cvr);
const budgetTomans = budgetTon * 466000;
const gmv = orders * aov;
const cpo = orders > 0 ? Math.round(budgetTomans / orders) : 0;
const roas = budgetTomans > 0 ? (gmv / budgetTomans).toFixed(2) : '0';
// Update DOM
// Update DOM with Persian formatting
document.getElementById('resImpressions').innerText = impressions.toLocaleString('fa-IR');
document.getElementById('resClicks').innerText = clicks.toLocaleString('fa-IR');
document.getElementById('resOrders').innerText = orders.toLocaleString('fa-IR') + ' رزرو';
document.getElementById('resCpo').innerText = (cpo / 1000).toLocaleString('fa-IR') + ' هزار ت';
document.getElementById('resCpo').innerText = cpo.toLocaleString('fa-IR') + ' تومان';
document.getElementById('resGmv').innerText = gmv.toLocaleString('fa-IR') + ' تومان';
document.getElementById('resRoas').innerText = roas + 'x';
document.getElementById('resRoas').innerText = parseFloat(roas).toLocaleString('fa-IR') + 'x';
}
function resetSimulator() {