|
@@ -18,7 +18,7 @@ import {
|
|
|
TableHeader,
|
|
TableHeader,
|
|
|
TableRow,
|
|
TableRow,
|
|
|
} from '@/components/ui/table'
|
|
} from '@/components/ui/table'
|
|
|
-import { DataTablePagination } from '@/components/data-table'
|
|
|
|
|
|
|
+import { DataTablePagination, DataTableToolbar } from '@/components/data-table'
|
|
|
import { DataTableBulkActions } from './data-table-bulk-actions'
|
|
import { DataTableBulkActions } from './data-table-bulk-actions'
|
|
|
import { usersColumns as columns } from './users-columns'
|
|
import { usersColumns as columns } from './users-columns'
|
|
|
import { type User } from '@/types/users.types'
|
|
import { type User } from '@/types/users.types'
|
|
@@ -39,7 +39,9 @@ export function UsersTable({
|
|
|
}: DataTableProps) {
|
|
}: DataTableProps) {
|
|
|
// Local UI-only states
|
|
// Local UI-only states
|
|
|
const [rowSelection, setRowSelection] = useState({})
|
|
const [rowSelection, setRowSelection] = useState({})
|
|
|
- const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
|
|
|
|
|
|
|
+ const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({
|
|
|
|
|
+ subscription_type: false,
|
|
|
|
|
+ })
|
|
|
const [sorting, setSorting] = useState<SortingState>([])
|
|
const [sorting, setSorting] = useState<SortingState>([])
|
|
|
|
|
|
|
|
// Local state management for table (uncomment to use local-only state, not synced with URL)
|
|
// Local state management for table (uncomment to use local-only state, not synced with URL)
|
|
@@ -63,6 +65,11 @@ export function UsersTable({
|
|
|
{ columnId: 'username', searchKey: 'username', type: 'string' },
|
|
{ columnId: 'username', searchKey: 'username', type: 'string' },
|
|
|
{ columnId: 'status', searchKey: 'status', type: 'array' },
|
|
{ columnId: 'status', searchKey: 'status', type: 'array' },
|
|
|
{ columnId: 'role', searchKey: 'role', type: 'array' },
|
|
{ columnId: 'role', searchKey: 'role', type: 'array' },
|
|
|
|
|
+ {
|
|
|
|
|
+ columnId: 'subscription_type',
|
|
|
|
|
+ searchKey: 'subscription_type',
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -103,12 +110,24 @@ export function UsersTable({
|
|
|
'flex flex-1 flex-col gap-4'
|
|
'flex flex-1 flex-col gap-4'
|
|
|
)}
|
|
)}
|
|
|
>
|
|
>
|
|
|
- {/* <DataTableToolbar
|
|
|
|
|
|
|
+ <DataTableToolbar
|
|
|
table={table}
|
|
table={table}
|
|
|
searchPlaceholder='فیلتر کاربران...'
|
|
searchPlaceholder='فیلتر کاربران...'
|
|
|
searchKey='username'
|
|
searchKey='username'
|
|
|
- filters={[]}
|
|
|
|
|
- /> */}
|
|
|
|
|
|
|
+ filters={[
|
|
|
|
|
+ {
|
|
|
|
|
+ columnId: 'subscription_type',
|
|
|
|
|
+ title: 'نوع اشتراک',
|
|
|
|
|
+ multiple: false,
|
|
|
|
|
+ options: [
|
|
|
|
|
+ { label: 'رایگان', value: 'no' },
|
|
|
|
|
+ { label: 'بیسیک', value: 'basic' },
|
|
|
|
|
+ { label: 'پرو', value: 'pro' },
|
|
|
|
|
+ { label: 'VIP', value: 'vip' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ ]}
|
|
|
|
|
+ />
|
|
|
<div className='overflow-hidden rounded-md border'>
|
|
<div className='overflow-hidden rounded-md border'>
|
|
|
<Table>
|
|
<Table>
|
|
|
<TableHeader>
|
|
<TableHeader>
|