diff --git a/apps/admin/app/dashboard/user/[id]/user-subscription/subscription-detail.tsx b/apps/admin/app/dashboard/user/[id]/user-subscription/subscription-detail.tsx index 012c057..06f112a 100644 --- a/apps/admin/app/dashboard/user/[id]/user-subscription/subscription-detail.tsx +++ b/apps/admin/app/dashboard/user/[id]/user-subscription/subscription-detail.tsx @@ -57,150 +57,154 @@ export function SubscriptionDetail({ {t('onlineDevices')} - - > - columns={[ - { - accessorKey: 'ip', - header: 'IP', - }, - { - accessorKey: 'user_agent', - header: t('userAgent'), - }, - { - accessorKey: 'token', - header: t('token'), - }, - { - accessorKey: 'created_at', - header: t('time'), - cell: ({ row }) => formatDate(row.getValue('created_at')), - }, - ]} - request={async (pagination) => { - const { data } = await getUserSubscribeLogs({ - user_id: userId, - subscribe_id: subscriptionId, - ...pagination, - }); - return { - list: data.data?.list || [], - total: data.data?.total || 0, - }; - }} - /> - - - > - columns={[ - { - accessorKey: 'download', - header: t('download'), - cell: ({ row }) => , - }, - { - accessorKey: 'upload', - header: t('upload'), - cell: ({ row }) => , - }, - { - accessorKey: 'timestamp', - header: t('time'), - cell: ({ row }) => formatDate(row.getValue('timestamp')), - }, - ]} - request={async (pagination) => { - const { data } = await getUserSubscribeTrafficLogs({ - user_id: userId, - subscribe_id: subscriptionId, - ...pagination, - } as API.GetUserSubscribeTrafficLogsParams); - return { - list: data.data?.list || [], - total: data.data?.total || 0, - }; - }} - /> - - - > - columns={[ - { - accessorKey: 'enabled', - header: t('enable'), - cell: ({ row }) => ( - { - console.log('Switch:', checked); - }} - /> - ), - }, - { - accessorKey: 'id', - header: 'ID', - }, - { - accessorKey: 'identifier', - header: 'IMEI', - }, - { - accessorKey: 'user_agent', - header: t('userAgent'), - }, - { - accessorKey: 'ip', - header: 'IP', - }, - { - accessorKey: 'online', - header: t('loginStatus'), - cell: ({ row }) => ( - - {row.getValue('online') ? t('online') : t('offline')} - - ), - }, - { - accessorKey: 'updated_at', - header: t('lastSeen'), - cell: ({ row }) => formatDate(row.getValue('updated_at')), - }, - ]} - request={async (pagination) => { - const { data } = await getUserSubscribeDevices({ - user_id: userId, - subscribe_id: subscriptionId, - ...pagination, - }); - return { - list: data.data?.list || [], - total: data.data?.total || 0, - }; - }} - actions={{ - render: (row) => { - if (!row.identifier) return []; - return [ - {t('confirmOffline')}} - title={t('confirmOffline')} - description={t('kickOfflineConfirm', { ip: row.ip })} - onConfirm={async () => { - await kickOfflineByUserDevice({ id: row.id }); - toast.success(t('kickOfflineSuccess')); - }} - cancelText={t('cancel')} - confirmText={t('confirm')} - />, - ]; - }, - }} - /> - +
+ + > + columns={[ + { + accessorKey: 'ip', + header: 'IP', + }, + { + accessorKey: 'user_agent', + header: t('userAgent'), + }, + { + accessorKey: 'token', + header: t('token'), + }, + { + accessorKey: 'created_at', + header: t('time'), + cell: ({ row }) => formatDate(row.getValue('created_at')), + }, + ]} + request={async (pagination) => { + const { data } = await getUserSubscribeLogs({ + user_id: userId, + subscribe_id: subscriptionId, + ...pagination, + }); + return { + list: data.data?.list || [], + total: data.data?.total || 0, + }; + }} + /> + + + > + columns={[ + { + accessorKey: 'download', + header: t('download'), + cell: ({ row }) => ( + + ), + }, + { + accessorKey: 'upload', + header: t('upload'), + cell: ({ row }) => , + }, + { + accessorKey: 'timestamp', + header: t('time'), + cell: ({ row }) => formatDate(row.getValue('timestamp')), + }, + ]} + request={async (pagination) => { + const { data } = await getUserSubscribeTrafficLogs({ + user_id: userId, + subscribe_id: subscriptionId, + ...pagination, + } as API.GetUserSubscribeTrafficLogsParams); + return { + list: data.data?.list || [], + total: data.data?.total || 0, + }; + }} + /> + + + > + columns={[ + { + accessorKey: 'enabled', + header: t('enable'), + cell: ({ row }) => ( + { + console.log('Switch:', checked); + }} + /> + ), + }, + { + accessorKey: 'id', + header: 'ID', + }, + { + accessorKey: 'identifier', + header: 'IMEI', + }, + { + accessorKey: 'user_agent', + header: t('userAgent'), + }, + { + accessorKey: 'ip', + header: 'IP', + }, + { + accessorKey: 'online', + header: t('loginStatus'), + cell: ({ row }) => ( + + {row.getValue('online') ? t('online') : t('offline')} + + ), + }, + { + accessorKey: 'updated_at', + header: t('lastSeen'), + cell: ({ row }) => formatDate(row.getValue('updated_at')), + }, + ]} + request={async (pagination) => { + const { data } = await getUserSubscribeDevices({ + user_id: userId, + subscribe_id: subscriptionId, + ...pagination, + }); + return { + list: data.data?.list || [], + total: data.data?.total || 0, + }; + }} + actions={{ + render: (row) => { + if (!row.identifier) return []; + return [ + {t('confirmOffline')}} + title={t('confirmOffline')} + description={t('kickOfflineConfirm', { ip: row.ip })} + onConfirm={async () => { + await kickOfflineByUserDevice({ id: row.id }); + toast.success(t('kickOfflineSuccess')); + }} + cancelText={t('cancel')} + confirmText={t('confirm')} + />, + ]; + }, + }} + /> + +