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