import * as React from 'react'; import { FC, Fragment, ReactElement, useState } from 'react'; import { FilterOutlined, SearchOutlined, AuditOutlined, } from '@ant-design/icons'; import { Button, Input } from '@imphnen-frontend-service/ui/atoms'; import { DataTable, Filter } from '@imphnen-frontend-service/ui/organisms'; import { ColumnDef, getCoreRowModel, getPaginationRowModel, PaginationState, useReactTable, RowSelectionState, } from '@tanstack/react-table'; import ModalProcessDelivery from './_components/modal-process-item'; type OrderValid = 'valid' | 'invalid' | 'unchecked'; type Status = 'undelivered' | 'delivered'; interface Prize { id: number; name: string; orderValid: OrderValid; items: string; address: string; status: Status; } const items = [ 'Sertifikat + Laminating', 'Lanyard + ID Card', 'Pin', 'Sticker Isi 3', 'Sticker Isi 5', 'Gelang Karet', ]; // Mock data for transactions const mockData: Prize[] = Array.from({ length: 90 }, (_, i) => ({ id: i + 1, name: 'Nama Lengkap', orderValid: (i % 3 === 0 ? 'invalid' : i % 5 === 0 ? 'unchecked' : 'valid') as OrderValid, items: items[i % items.length], address: 'Jl. Pantai Cibaduyut Indah', status: (i % 3 === 0 ? 'undelivered' : 'delivered') as Status, })); export const Components: FC = (): ReactElement => { const [showModalProcessDelivery, setShowModalProcessDelivery] = useState(false); const [pagination, setPagination] = React.useState({ pageIndex: 0, pageSize: 9, }); const [rowSelection, setRowSelection] = React.useState({}); const [showFilter, setShowFilter] = useState(false); const deliveryOptions = [ { id: 'option1', value: 'undelivered', label: 'Undelivered' }, { id: 'option1', value: 'delivered', label: 'Delivered' }, ]; const columns: ColumnDef[] = [ { id: 'select', header: ({ table }) => ( ), cell: ({ row }) => ( ), }, { header: 'No', accessorKey: 'id', }, { header: 'Nama Lengkap', accessorKey: 'name', }, { header: 'Order Valid?', accessorKey: 'orderValid', cell: ({ row }) => { const status = row.original.orderValid; const statusColors: Record = { valid: 'bg-success-200 text-success-500', invalid: 'bg-danger-200 text-danger-500', unchecked: 'bg-warning-200 text-warning-900', }; const statusText: Record = { valid: 'Valid', invalid: 'Invalid', unchecked: 'Unchecked', }; return (
{statusText[status]}
); }, }, { header: 'Items', accessorKey: 'items', }, { header: 'Alamat Pengiriman', accessorKey: 'address', }, { header: 'Status', accessorKey: 'status', cell: ({ row }) => { const status = row.original.status; const statusColors: Record = { delivered: 'bg-success-200 text-success-500', undelivered: 'bg-danger-200 text-danger-500', }; const statusText: Record = { delivered: 'Delivered', undelivered: 'Undelivered', }; return (
{statusText[status]}
); }, }, { header: 'Action', cell: ({ row }) => ( ), }, ]; const table = useReactTable({ data: mockData, columns, state: { pagination, rowSelection, }, enableRowSelection: true, onRowSelectionChange: setRowSelection, getCoreRowModel: getCoreRowModel(), getPaginationRowModel: getPaginationRowModel(), onPaginationChange: setPagination, pageCount: Math.ceil(mockData.length / pagination.pageSize), manualPagination: false, }); return (
{/* Header */}

Data Pengiriman Hadiah

{/* Account Table Section */}
{/* Search and Filter */}
{showFilter && (
setShowFilter(false)} onFilterChange={(value) => { console.log('Selected filter:', value); // Filter logic di sini }} />
)}
{/* Table */}
{/* Modal Process Delivery */} setShowModalProcessDelivery(false)} handleProcessDelivery={() => { console.log('Action ketika user menekan tombol Proses Pengiriman'); }} />
); }; export default Components;