import * as React from 'react'; import { FC, ReactElement } from 'react'; import { FilterOutlined, SearchOutlined, AuditOutlined, } from '@ant-design/icons'; import { Button, Input } from '@imphnen-frontend-service/ui/atoms'; import { DataTable } from '@imphnen-frontend-service/ui/organisms'; import { ColumnDef, getCoreRowModel, getPaginationRowModel, PaginationState, useReactTable, RowSelectionState, } from '@tanstack/react-table'; type TransactionStatus = 'valid' | 'invalid' | 'unchecked'; interface Transaction { id: number; name: string; transactionNumber: string; status: TransactionStatus; } // Mock data for transactions const mockTransactions: Transaction[] = Array.from({ length: 20 }, (_, i) => ({ id: i + 1, name: i === 0 ? 'Ahmad Wijuana' : 'Nama Lengkap', transactionNumber: '25D2133Y9AFYBD', status: (i % 3 === 0 ? 'invalid' : i % 5 === 0 ? 'unchecked' : 'valid') as TransactionStatus, })); const columns: ColumnDef[] = [ { id: 'select', header: ({ table }) => ( ), cell: ({ row }) => ( ), }, { header: 'No', accessorKey: 'id', }, { header: 'Nama Lengkap', accessorKey: 'name', }, { header: 'Nomor Transaksi', accessorKey: 'transactionNumber', }, { header: 'Order Valid?', accessorKey: 'status', cell: ({ row }) => { const status = row.original.status; const statusColors: Record = { valid: 'bg-success-500 text-white', invalid: 'bg-danger-500 text-white', unchecked: 'bg-yellow-400 text-black', }; const statusText: Record = { valid: 'Valid', invalid: 'Invalid', unchecked: 'Unchecked', }; return (
{statusText[status]}
); }, }, { header: 'Action', cell: ({ row }) => ( ), }, ]; export const Components: FC = (): ReactElement => { const [pagination, setPagination] = React.useState({ pageIndex: 0, pageSize: 9, }); const [rowSelection, setRowSelection] = React.useState({}); const table = useReactTable({ data: mockTransactions, columns, state: { pagination, rowSelection, }, enableRowSelection: true, onRowSelectionChange: setRowSelection, getCoreRowModel: getCoreRowModel(), getPaginationRowModel: getPaginationRowModel(), onPaginationChange: setPagination, pageCount: Math.ceil(mockTransactions.length / pagination.pageSize), manualPagination: false, }); return (
{/* Header */}

Validasi Transaksi

{/* Account Table Section */}
{/* Search and Filter */}
{/* Table */}
); }; export default Components;