Fix SmsTenantPage TypeScript implicit any for production build.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+49
-37
@@ -114,6 +114,14 @@ function fromGroupedInput(raw: string, allowNegative = false) {
|
||||
return neg ? -n : n
|
||||
}
|
||||
|
||||
function onGroupedMoneyInput(
|
||||
apply: (n: number) => void,
|
||||
value: string | number,
|
||||
allowNegative = false,
|
||||
) {
|
||||
apply(fromGroupedInput(String(value ?? ''), allowNegative))
|
||||
}
|
||||
|
||||
function formatNumber(value: number | null | undefined) {
|
||||
if (value == null) return '—'
|
||||
return new Intl.NumberFormat('fa-IR').format(value)
|
||||
@@ -331,14 +339,14 @@ const logColumns: TableColumnsType = [
|
||||
title: 'مبلغ',
|
||||
key: 'totalAmount',
|
||||
width: 120,
|
||||
customRender: ({ record }) => formatMoney(record.totalAmount),
|
||||
customRender: ({ record }: { record: any }) => formatMoney(record.totalAmount),
|
||||
},
|
||||
{ title: 'ارائهدهنده', dataIndex: 'provider', key: 'provider', width: 110 },
|
||||
{
|
||||
title: 'زمان',
|
||||
key: 'createdAt',
|
||||
width: 150,
|
||||
customRender: ({ record }) => formatIranDateTime(record.createdAt),
|
||||
customRender: ({ record }: { record: any }) => formatIranDateTime(record.createdAt),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -348,20 +356,50 @@ const ledgerColumns: TableColumnsType = [
|
||||
title: 'مبلغ',
|
||||
key: 'amount',
|
||||
width: 130,
|
||||
customRender: ({ record }) => formatMoney(record.amount),
|
||||
customRender: ({ record }: { record: any }) => formatMoney(record.amount),
|
||||
},
|
||||
{
|
||||
title: 'مانده',
|
||||
key: 'balanceAfter',
|
||||
width: 130,
|
||||
customRender: ({ record }) => formatMoney(record.balanceAfter),
|
||||
customRender: ({ record }: { record: any }) => formatMoney(record.balanceAfter),
|
||||
},
|
||||
{ title: 'توضیح', dataIndex: 'note', key: 'note', ellipsis: true },
|
||||
{
|
||||
title: 'زمان',
|
||||
key: 'createdAt',
|
||||
width: 150,
|
||||
customRender: ({ record }) => formatIranDateTime(record.createdAt),
|
||||
customRender: ({ record }: { record: any }) => formatIranDateTime(record.createdAt),
|
||||
},
|
||||
]
|
||||
|
||||
const providerReportColumns: TableColumnsType = [
|
||||
{ title: 'ارائهدهنده', dataIndex: 'provider', key: 'provider' },
|
||||
{ title: 'پیامک', dataIndex: 'messages', key: 'messages' },
|
||||
{ title: 'پارت', dataIndex: 'parts', key: 'parts' },
|
||||
{
|
||||
title: 'مبلغ',
|
||||
key: 'amount',
|
||||
customRender: ({ record }: { record: any }) => formatMoney(record.amount),
|
||||
},
|
||||
]
|
||||
|
||||
const chargeReportColumns: TableColumnsType = [
|
||||
{
|
||||
title: 'مبلغ',
|
||||
key: 'amount',
|
||||
customRender: ({ record }: { record: any }) => formatMoney(record.amount),
|
||||
},
|
||||
{
|
||||
title: 'مانده',
|
||||
key: 'balanceAfter',
|
||||
customRender: ({ record }: { record: any }) => formatMoney(record.balanceAfter),
|
||||
},
|
||||
{ title: 'توضیح', dataIndex: 'note', key: 'note' },
|
||||
{
|
||||
title: 'زمان',
|
||||
key: 'createdAt',
|
||||
customRender: ({ record }: { record: any }) => formatIranDateTime(record.createdAt),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -443,7 +481,7 @@ onMounted(async () => {
|
||||
dir="ltr"
|
||||
class="money-input"
|
||||
:value="toGroupedDisplay(form.pricePerPartRials)"
|
||||
@update:value="(v) => (form.pricePerPartRials = fromGroupedInput(String(v)))"
|
||||
@update:value="(v: string | number) => onGroupedMoneyInput((n) => (form.pricePerPartRials = n), v)"
|
||||
/>
|
||||
<a-button type="primary" size="large" :loading="saving" @click="savePrice">ذخیره قیمت</a-button>
|
||||
</div>
|
||||
@@ -458,7 +496,7 @@ onMounted(async () => {
|
||||
class="money-input"
|
||||
placeholder="مبلغ (ریال)"
|
||||
:value="toGroupedDisplay(chargeForm.amountRials)"
|
||||
@update:value="(v) => (chargeForm.amountRials = fromGroupedInput(String(v), true))"
|
||||
@update:value="(v: string | number) => onGroupedMoneyInput((n) => (chargeForm.amountRials = n), v, true)"
|
||||
/>
|
||||
<a-input v-model:value="chargeForm.note" size="large" placeholder="توضیح (اختیاری)" />
|
||||
<a-button type="primary" size="large" :loading="charging" @click="openChargeConfirm">
|
||||
@@ -507,7 +545,7 @@ onMounted(async () => {
|
||||
dir="ltr"
|
||||
class="money-input"
|
||||
:value="toGroupedDisplay(form.alertCriticalRials)"
|
||||
@update:value="(v) => (form.alertCriticalRials = fromGroupedInput(String(v)))"
|
||||
@update:value="(v: string | number) => onGroupedMoneyInput((n) => (form.alertCriticalRials = n), v)"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
@@ -517,7 +555,7 @@ onMounted(async () => {
|
||||
dir="ltr"
|
||||
class="money-input"
|
||||
:value="toGroupedDisplay(form.alertWarningRials)"
|
||||
@update:value="(v) => (form.alertWarningRials = fromGroupedInput(String(v)))"
|
||||
@update:value="(v: string | number) => onGroupedMoneyInput((n) => (form.alertWarningRials = n), v)"
|
||||
/>
|
||||
</label>
|
||||
<a-button type="primary" size="large" :loading="saving" @click="saveThresholds">ذخیره آستانهها</a-button>
|
||||
@@ -557,16 +595,7 @@ onMounted(async () => {
|
||||
size="small"
|
||||
:pagination="false"
|
||||
:data-source="periodReport.byProvider"
|
||||
:columns="[
|
||||
{ title: 'ارائهدهنده', dataIndex: 'provider', key: 'provider' },
|
||||
{ title: 'پیامک', dataIndex: 'messages', key: 'messages' },
|
||||
{ title: 'پارت', dataIndex: 'parts', key: 'parts' },
|
||||
{
|
||||
title: 'مبلغ',
|
||||
key: 'amount',
|
||||
customRender: ({ record }) => formatMoney(record.amount),
|
||||
},
|
||||
]"
|
||||
:columns="providerReportColumns"
|
||||
row-key="provider"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
@@ -595,24 +624,7 @@ onMounted(async () => {
|
||||
:loading="chargeReportLoading"
|
||||
:pagination="false"
|
||||
:data-source="chargeReport.items"
|
||||
:columns="[
|
||||
{
|
||||
title: 'مبلغ',
|
||||
key: 'amount',
|
||||
customRender: ({ record }) => formatMoney(record.amount),
|
||||
},
|
||||
{
|
||||
title: 'مانده',
|
||||
key: 'balanceAfter',
|
||||
customRender: ({ record }) => formatMoney(record.balanceAfter),
|
||||
},
|
||||
{ title: 'توضیح', dataIndex: 'note', key: 'note' },
|
||||
{
|
||||
title: 'زمان',
|
||||
key: 'createdAt',
|
||||
customRender: ({ record }) => formatIranDateTime(record.createdAt),
|
||||
},
|
||||
]"
|
||||
:columns="chargeReportColumns"
|
||||
row-key="id"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
|
||||
Reference in New Issue
Block a user