Show dash instead of null string on Tahesab document cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 11:40:57 +03:30
co-authored by Cursor
parent 11fa4c5e23
commit 028362da44
@@ -131,6 +131,14 @@ function formatMandehAmount(amount: string | number, unit: string) {
return abs.toLocaleString('fa-IR', { maximumFractionDigits: 3 });
}
/** ته‌حساب گاهی رشتهٔ "null" می‌فرستد؛ ?? کافی نیست */
function dash(v: unknown, fallback = '—'): string {
if (v == null) return fallback;
const s = String(v).trim();
if (!s || s === 'null' || s === 'undefined' || s === 'NaN') return fallback;
return s;
}
/** تبدیل تاریخ محلی میلادی به شمسی YYYY-MM-DD برای API ته‌حساب */
function toShamsiYmd(localIso: string): string | null {
const d = parseLocalInput(localIso);
@@ -558,24 +566,24 @@ onMounted(async () => {
class="sanad-card card"
>
<div class="sc-head">
<span>شماره سند: {{ item.Sh_Factor ?? item.Sh_factor ?? '—' }}</span>
<span>تاریخ: {{ item.Tarikh ?? '—' }}</span>
<span>شماره سند: {{ dash(item.Sh_Factor ?? item.Sh_factor) }}</span>
<span>تاریخ: {{ dash(item.Tarikh) }}</span>
</div>
<div class="sc-row gold">
<span>نوع</span>
<strong>{{ item.NO ?? '—' }}</strong>
<strong>{{ dash(item.NO) }}</strong>
</div>
<div class="sc-row gold">
<span>وزن / عیار</span>
<strong dir="ltr">{{ item.Vazn ?? '—' }} / {{ item.Ayar ?? '—' }}</strong>
<strong dir="ltr">{{ dash(item.Vazn) }} / {{ dash(item.Ayar) }}</strong>
</div>
<div class="sc-row cash">
<span>مالی</span>
<strong dir="ltr">{{ item.Mali ?? '—' }}</strong>
<strong dir="ltr">{{ dash(item.Mali) }}</strong>
</div>
<div class="sc-row">
<span>شرح</span>
<span>{{ item.Sharh1 ?? item.Sharh ?? '—' }}</span>
<span>{{ dash(item.Sharh1 ?? item.Sharh) }}</span>
</div>
</article>
</div>