diff --git a/apps/backoffice/src/app/accounts/page.tsx b/apps/backoffice/src/app/accounts/page.tsx index 5191e88..61a8fd4 100644 --- a/apps/backoffice/src/app/accounts/page.tsx +++ b/apps/backoffice/src/app/accounts/page.tsx @@ -120,7 +120,7 @@ export const Components: FC = (): ReactElement => { return (
{/* Header */} -
+

Data Akun

diff --git a/apps/backoffice/src/app/dashboard/page.tsx b/apps/backoffice/src/app/dashboard/page.tsx index 09fc3ba..2567e8c 100644 --- a/apps/backoffice/src/app/dashboard/page.tsx +++ b/apps/backoffice/src/app/dashboard/page.tsx @@ -12,7 +12,7 @@ export const Components: FC = (): ReactElement => { return (
{/* Dashboard Header */} -
+

Dashboard

diff --git a/apps/backoffice/src/app/prizes/layout.tsx b/apps/backoffice/src/app/prizes/layout.tsx new file mode 100644 index 0000000..a770c99 --- /dev/null +++ b/apps/backoffice/src/app/prizes/layout.tsx @@ -0,0 +1,18 @@ +import { FC, ReactElement } from 'react'; +import { Outlet } from 'react-router-dom'; +import { BackofficeSidebar } from '@imphnen-frontend-service/ui/organisms'; + +export const AppLayout: FC = (): ReactElement => { + return ( +
+
+ +
+ +
+
+
+ ); +}; + +export default AppLayout; diff --git a/apps/backoffice/src/app/prizes/page.tsx b/apps/backoffice/src/app/prizes/page.tsx new file mode 100644 index 0000000..c638599 --- /dev/null +++ b/apps/backoffice/src/app/prizes/page.tsx @@ -0,0 +1,223 @@ +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 Status = 'valid' | 'invalid' | 'unchecked'; + +interface Prize { + id: number; + name: string; + orderValid: Status; + 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 Status, + items: items[i % items.length], + address: 'Jl. Pantai Cibaduyut Indonesia', + status: (i % 3 === 0 + ? 'unchecked' + : i % 5 === 0 + ? 'invalid' + : 'valid') as Status, +})); + +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 = { + 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: '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: 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 */} +
+
+ +
+ +
+
+ + +
+ + {/* Table */} + +
+
+ ); +}; + +export default Components; diff --git a/apps/backoffice/src/app/transactions/page.tsx b/apps/backoffice/src/app/transactions/page.tsx index fb8428f..0df99f3 100644 --- a/apps/backoffice/src/app/transactions/page.tsx +++ b/apps/backoffice/src/app/transactions/page.tsx @@ -39,7 +39,7 @@ const mockTransactions: Transaction[] = Array.from({ length: 20 }, (_, i) => ({ : 'valid') as TransactionStatus, })); -const columns: ColumnDef[] = [ +const columns: ColumnDef[] = [ { id: 'select', header: ({ table }) => ( @@ -77,9 +77,9 @@ const columns: ColumnDef[] = [ 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', + 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', @@ -88,7 +88,7 @@ const columns: ColumnDef[] = [ }; return (
{statusText[status]}
@@ -140,7 +140,7 @@ export const Components: FC = (): ReactElement => { return (
{/* Header */} -
+

Validasi Transaksi

diff --git a/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx b/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx index b1aa794..c8b77ec 100644 --- a/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx +++ b/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx @@ -1,6 +1,7 @@ import { AppstoreOutlined, AuditOutlined, + InboxOutlined, LogoutOutlined, UserOutlined, } from '@ant-design/icons'; @@ -56,6 +57,18 @@ export const BackofficeSidebar: FC = (): ReactElement => { Validasi Transaksi + + + + Data Pengiriman Hadiah + diff --git a/libs/ui/src/organisms/datatable/datatable.tsx b/libs/ui/src/organisms/datatable/datatable.tsx index 3a3a425..0a52130 100644 --- a/libs/ui/src/organisms/datatable/datatable.tsx +++ b/libs/ui/src/organisms/datatable/datatable.tsx @@ -49,7 +49,7 @@ export const DataTable = ({ {headerGroup.headers.map((header) => ( {header.isPlaceholder ? null @@ -62,7 +62,7 @@ export const DataTable = ({ ))} - + {table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell, index) => (