added online and trigger

This commit is contained in:
2026-07-22 18:12:45 +03:30
parent a759cf7251
commit 090dbbe239
21 changed files with 1463 additions and 286 deletions
@@ -1,11 +1,11 @@
import type { BaseTableColumn } from '@core/type/baseTable'
import { toJalali } from '@core/utils/useDataTime'
import CustomTag from '@/components/CustomTag.vue'
import { usePrice } from '@core/utils/usePrice'
import { getCashBalance } from '@/components/mobile/utils/wallet'
import { customerWalletMetalBalanceTitle } from '@/utils/adminMetalLabels'
import { formatMetalDisplayValue, metalCellValue } from '@/utils/metalWeight'
import type { AccountingProvider } from '@/utils/config'
import CustomerPresenceCell from '@/pages/menuPages/customers/base/components/CustomerPresenceCell.vue'
export type CustomerMetalColumn = { metal_id: number; label: string; display_unit?: string }
@@ -63,24 +63,12 @@ export function buildCustomerColumns(
key: 'mobile',
type: 'Number'
},
{
title: 'نوع کاربر',
dataIndex: 'type_str',
key: 'type_str',
type: 'Text'
},
{
title: 'کد معرف',
dataIndex: 'referral_id',
key: 'referral_id',
type: 'Text'
},
{
title: 'نام معرف کاربر',
dataIndex: 'referral.name',
key: 'referral.name',
type: 'Text'
},
{
title: 'موجودی ریالی (ریال)',
dataIndex: 'wallet.cash',
@@ -122,53 +110,42 @@ export function buildCustomerColumns(
return [
...baseColumns,
...metalColumns,
/* {
title: 'اخرین بازدید',
{
title: 'آخرین بازدید',
dataIndex: 'last_seen_at',
key: 'last_seen_at',
type: 'DateTime',
customRender(data) {
return toJalali(data.record.last_seen_at)
}
},*/
{
title: 'وضعیت کاربر',
dataIndex: 'active',
key: 'active',
type: 'Boolean',
customRender: ({ record }) => {
return record.active ? (
<div class="flex justify-center">
<CustomTag textColor="#25855A" bgColor="#E3F4E9" class={'font-bold px-6'}>
فعال
</CustomTag>
</div>
) : (
<div class="flex justify-center">
<CustomTag textColor="#C53030" bgColor="#FECACA" class={'font-bold px-6'}>
غیر فعال
</CustomTag>
</div>
)
}
width: 130,
filterable: false,
sortable: true,
customRender: ({ record }) => <CustomerPresenceCell lastSeenAt={record.last_seen_at} />
},
{
title: 'وضعیت سفارش دهی',
dataIndex: 'trade_active',
key: 'trade_active',
sortable: false,
title: 'وضعیت',
dataIndex: 'active',
key: 'status',
type: 'Boolean',
width: 132,
filterable: false,
sortable: false,
customRender: ({ record }) => {
return record.trade_active ? (
<div class="flex justify-center">
<CustomTag textColor="#25855A" bgColor="#E3F4E9" class={'font-bold px-6'}>
مجاز
const userOk = Boolean(record.active)
const tradeOk = Boolean(record.trade_active)
return (
<div class="flex flex-col items-center gap-1">
<CustomTag
textColor={userOk ? '#25855A' : '#C53030'}
bgColor={userOk ? '#E3F4E9' : '#FECACA'}
class="m-0 font-bold !px-2.5 !py-0 text-xs leading-6 whitespace-nowrap"
>
{userOk ? 'حساب فعال' : 'حساب غیرفعال'}
</CustomTag>
</div>
) : (
<div class="flex justify-center">
<CustomTag textColor="#C53030" bgColor="#FECACA" class={'font-bold px-6'}>
غیر مجاز
<CustomTag
textColor={tradeOk ? '#25855A' : '#C53030'}
bgColor={tradeOk ? '#E3F4E9' : '#FECACA'}
class="m-0 font-bold !px-2.5 !py-0 text-xs leading-6 whitespace-nowrap"
>
{tradeOk ? 'سفارش مجاز' : 'سفارش غیرمجاز'}
</CustomTag>
</div>
)