80 lines
2.0 KiB
TypeScript
80 lines
2.0 KiB
TypeScript
import type { BaseTableColumn } from '@core/type/baseTable'
|
|||
|
|
import { usePrice } from '@core/utils/usePrice'
|
||
|
|
import { toJalali } from '@core/utils/useDataTime'
|
||
|
|
|
||
|
|
export function getSpecialPricePackageColumns(): BaseTableColumn[] {
|
||
|
|
return [
|
||
|
|
{
|
||
|
|
title: 'ردیف',
|
||
|
|
dataIndex: 'id',
|
||
|
|
key: 'row',
|
||
|
|
filterable: false,
|
||
|
|
sortable: false,
|
||
|
|
customRender: (record: any) => record.index + 1
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'عنوان پکیج',
|
||
|
|
dataIndex: 'title',
|
||
|
|
key: 'title',
|
||
|
|
type: 'Text'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'تعداد کاربر',
|
||
|
|
dataIndex: 'customers_count',
|
||
|
|
key: 'customers_count',
|
||
|
|
type: 'Number',
|
||
|
|
filterable: false
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'تعداد محصول',
|
||
|
|
dataIndex: 'products_count',
|
||
|
|
key: 'products_count',
|
||
|
|
type: 'Number',
|
||
|
|
filterable: false
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'سود خرید',
|
||
|
|
dataIndex: 'profit_buy',
|
||
|
|
key: 'profit_buy',
|
||
|
|
type: 'Text',
|
||
|
|
customRender: ({ record }) => usePrice(record.profit_buy ?? 0, true, '')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'سود فروش',
|
||
|
|
dataIndex: 'profit_sell',
|
||
|
|
key: 'profit_sell',
|
||
|
|
type: 'Text',
|
||
|
|
customRender: ({ record }) => usePrice(record.profit_sell ?? 0, true, '')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'نمایش محصول',
|
||
|
|
dataIndex: 'show_product',
|
||
|
|
key: 'show_product',
|
||
|
|
type: 'Text',
|
||
|
|
customRender: ({ record }) => (record.show_product ? 'فعال' : 'مخفی')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'وضعیت',
|
||
|
|
dataIndex: 'is_active',
|
||
|
|
key: 'is_active',
|
||
|
|
type: 'Text',
|
||
|
|
customRender: ({ record }) => (record.is_active ? 'فعال' : 'غیرفعال')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'تاریخ',
|
||
|
|
dataIndex: 'updated_at',
|
||
|
|
key: 'updated_at',
|
||
|
|
type: 'DateTime',
|
||
|
|
customRender: (r: any) => (r.record?.updated_at ? toJalali(r.record.updated_at) : '—')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'عملیات',
|
||
|
|
dataIndex: 'action',
|
||
|
|
key: 'action',
|
||
|
|
slot: 'action',
|
||
|
|
filterable: false,
|
||
|
|
sortable: false
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|