From f527b6f0048656041430e744c8a274ab0fac3724 Mon Sep 17 00:00:00 2001 From: efrilm Date: Wed, 17 Sep 2025 00:10:14 +0700 Subject: [PATCH] Loyalty Page --- .../(private)/apps/marketing/loyalty/page.tsx | 7 + .../layout/vertical/VerticalMenu.tsx | 3 + src/data/dictionaries/en.json | 4 +- src/data/dictionaries/id.json | 4 +- src/types/services/loyalty.ts | 9 + .../marketing/loyalty/AddLoyaltiDrawer.tsx | 495 ++++++++++++++ .../marketing/loyalty/LoyaltyListTable.tsx | 635 ++++++++++++++++++ src/views/apps/marketing/loyalty/index.tsx | 17 + 8 files changed, 1172 insertions(+), 2 deletions(-) create mode 100644 src/app/[lang]/(dashboard)/(private)/apps/marketing/loyalty/page.tsx create mode 100644 src/types/services/loyalty.ts create mode 100644 src/views/apps/marketing/loyalty/AddLoyaltiDrawer.tsx create mode 100644 src/views/apps/marketing/loyalty/LoyaltyListTable.tsx create mode 100644 src/views/apps/marketing/loyalty/index.tsx diff --git a/src/app/[lang]/(dashboard)/(private)/apps/marketing/loyalty/page.tsx b/src/app/[lang]/(dashboard)/(private)/apps/marketing/loyalty/page.tsx new file mode 100644 index 0000000..0b09f4d --- /dev/null +++ b/src/app/[lang]/(dashboard)/(private)/apps/marketing/loyalty/page.tsx @@ -0,0 +1,7 @@ +import LoyaltyList from '@/views/apps/marketing/loyalty' + +const LoyaltiPage = () => { + return +} + +export default LoyaltiPage diff --git a/src/components/layout/vertical/VerticalMenu.tsx b/src/components/layout/vertical/VerticalMenu.tsx index c9b634b..11228c0 100644 --- a/src/components/layout/vertical/VerticalMenu.tsx +++ b/src/components/layout/vertical/VerticalMenu.tsx @@ -153,6 +153,9 @@ const VerticalMenu = ({ dictionary, scrollMenu }: Props) => { > {dictionary['navigation'].reports} + }> + {dictionary['navigation'].loyalty} + }> {dictionary['navigation'].list} diff --git a/src/data/dictionaries/en.json b/src/data/dictionaries/en.json index 2194f85..2e1e690 100644 --- a/src/data/dictionaries/en.json +++ b/src/data/dictionaries/en.json @@ -126,6 +126,8 @@ "expenses": "Expenses", "cash_and_bank": "Cash & Bank", "account": "Account", - "fixed_assets": "Fixed Assets" + "fixed_assets": "Fixed Assets", + "marketing": "Marketing", + "loyalty": "Loyalty" } } diff --git a/src/data/dictionaries/id.json b/src/data/dictionaries/id.json index 054b387..19bcaf3 100644 --- a/src/data/dictionaries/id.json +++ b/src/data/dictionaries/id.json @@ -126,6 +126,8 @@ "expenses": "Biaya", "cash_and_bank": "Kas & Bank", "account": "Akun", - "fixed_assets": "Aset Tetap" + "fixed_assets": "Aset Tetap", + "marketing": "Pemasaran", + "loyalty": "Loyalti" } } diff --git a/src/types/services/loyalty.ts b/src/types/services/loyalty.ts new file mode 100644 index 0000000..5e2e896 --- /dev/null +++ b/src/types/services/loyalty.ts @@ -0,0 +1,9 @@ +export interface LoyaltyType { + id: string + name: string + minimumPurchase: number + pointMultiplier: number + benefits: string[] + createdAt: Date + updatedAt: Date +} diff --git a/src/views/apps/marketing/loyalty/AddLoyaltiDrawer.tsx b/src/views/apps/marketing/loyalty/AddLoyaltiDrawer.tsx new file mode 100644 index 0000000..927ae75 --- /dev/null +++ b/src/views/apps/marketing/loyalty/AddLoyaltiDrawer.tsx @@ -0,0 +1,495 @@ +// React Imports +import { useState, useEffect } from 'react' + +// MUI Imports +import Button from '@mui/material/Button' +import Drawer from '@mui/material/Drawer' +import IconButton from '@mui/material/IconButton' +import MenuItem from '@mui/material/MenuItem' +import Typography from '@mui/material/Typography' +import Divider from '@mui/material/Divider' +import Grid from '@mui/material/Grid2' +import Box from '@mui/material/Box' +import Switch from '@mui/material/Switch' +import FormControlLabel from '@mui/material/FormControlLabel' +import Chip from '@mui/material/Chip' +import InputAdornment from '@mui/material/InputAdornment' + +// Third-party Imports +import { useForm, Controller, useFieldArray } from 'react-hook-form' + +// Component Imports +import CustomTextField from '@core/components/mui/TextField' + +// Types +export interface LoyaltyType { + id: string + name: string + minimumPurchase: number + pointMultiplier: number + benefits: string[] + createdAt: Date + updatedAt: Date +} + +export interface LoyaltyRequest { + name: string + minimumPurchase: number + pointMultiplier: number + benefits: string[] + description?: string + isActive?: boolean +} + +type Props = { + open: boolean + handleClose: () => void + data?: LoyaltyType // Data loyalty untuk edit (jika ada) +} + +type FormValidateType = { + name: string + minimumPurchase: number + pointMultiplier: number + benefits: string[] + description: string + isActive: boolean + newBenefit: string // Temporary field for adding new benefits +} + +// Initial form data +const initialData: FormValidateType = { + name: '', + minimumPurchase: 0, + pointMultiplier: 1, + benefits: [], + description: '', + isActive: true, + newBenefit: '' +} + +// Mock mutation hooks (replace with actual hooks) +const useLoyaltyMutation = () => { + const createLoyalty = { + mutate: (data: LoyaltyRequest, options?: { onSuccess?: () => void }) => { + console.log('Creating loyalty:', data) + setTimeout(() => options?.onSuccess?.(), 1000) + } + } + + const updateLoyalty = { + mutate: (data: { id: string; payload: LoyaltyRequest }, options?: { onSuccess?: () => void }) => { + console.log('Updating loyalty:', data) + setTimeout(() => options?.onSuccess?.(), 1000) + } + } + + return { createLoyalty, updateLoyalty } +} + +const AddEditLoyaltyDrawer = (props: Props) => { + // Props + const { open, handleClose, data } = props + + // States + const [showMore, setShowMore] = useState(false) + const [isSubmitting, setIsSubmitting] = useState(false) + + const { createLoyalty, updateLoyalty } = useLoyaltyMutation() + + // Determine if this is edit mode + const isEditMode = Boolean(data?.id) + + // Hooks + const { + control, + reset: resetForm, + handleSubmit, + watch, + setValue, + formState: { errors } + } = useForm({ + defaultValues: initialData + }) + + const watchedBenefits = watch('benefits') + const watchedNewBenefit = watch('newBenefit') + + // Effect to populate form when editing + useEffect(() => { + if (isEditMode && data) { + // Populate form with existing data + const formData: FormValidateType = { + name: data.name || '', + minimumPurchase: data.minimumPurchase || 0, + pointMultiplier: data.pointMultiplier || 1, + benefits: data.benefits || [], + description: '', // Add description field if available in your data + isActive: true, // Add isActive field if available in your data + newBenefit: '' + } + + resetForm(formData) + setShowMore(true) // Always show more for edit mode + } else { + // Reset to initial data for add mode + resetForm(initialData) + setShowMore(false) + } + }, [data, isEditMode, resetForm]) + + const handleAddBenefit = () => { + if (watchedNewBenefit.trim()) { + const currentBenefits = watchedBenefits || [] + setValue('benefits', [...currentBenefits, watchedNewBenefit.trim()]) + setValue('newBenefit', '') + } + } + + const handleRemoveBenefit = (index: number) => { + const currentBenefits = watchedBenefits || [] + const newBenefits = currentBenefits.filter((_, i) => i !== index) + setValue('benefits', newBenefits) + } + + const handleKeyPress = (event: React.KeyboardEvent) => { + if (event.key === 'Enter') { + event.preventDefault() + handleAddBenefit() + } + } + + const handleFormSubmit = async (formData: FormValidateType) => { + try { + setIsSubmitting(true) + + // Create LoyaltyRequest object + const loyaltyRequest: LoyaltyRequest = { + name: formData.name, + minimumPurchase: formData.minimumPurchase, + pointMultiplier: formData.pointMultiplier, + benefits: formData.benefits, + description: formData.description || undefined, + isActive: formData.isActive + } + + if (isEditMode && data?.id) { + // Update existing loyalty + updateLoyalty.mutate( + { id: data.id, payload: loyaltyRequest }, + { + onSuccess: () => { + handleReset() + handleClose() + } + } + ) + } else { + // Create new loyalty + createLoyalty.mutate(loyaltyRequest, { + onSuccess: () => { + handleReset() + handleClose() + } + }) + } + } catch (error) { + console.error('Error submitting loyalty:', error) + // Handle error (show toast, etc.) + } finally { + setIsSubmitting(false) + } + } + + const handleReset = () => { + handleClose() + resetForm(initialData) + setShowMore(false) + } + + const formatCurrency = (value: number) => { + return new Intl.NumberFormat('id-ID', { + style: 'currency', + currency: 'IDR', + minimumFractionDigits: 0 + }).format(value) + } + + return ( + + {/* Sticky Header */} + +
+ {isEditMode ? 'Edit Program Loyalty' : 'Tambah Program Loyalty Baru'} + + + +
+
+ + {/* Scrollable Content */} + +
+
+ {/* Nama Program Loyalty */} +
+ + Nama Program Loyalty * + + ( + + )} + /> +
+ + {/* Minimum Purchase */} +
+ + Minimum Pembelian * + + ( + 0 ? formatCurrency(field.value) : '')} + InputProps={{ + startAdornment: Rp + }} + onChange={e => field.onChange(Number(e.target.value))} + /> + )} + /> +
+ + {/* Point Multiplier */} +
+ + Pengali Poin * + + ( + field.onChange(Number(e.target.value))} + > + {[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(multiplier => ( + + {multiplier}x + + ))} + + )} + /> +
+ + {/* Benefits */} +
+ + Manfaat Program * + + + {/* Display current benefits */} + {watchedBenefits && watchedBenefits.length > 0 && ( +
+ {watchedBenefits.map((benefit, index) => ( + handleRemoveBenefit(index)} + color='primary' + variant='outlined' + size='small' + /> + ))} +
+ )} + + {/* Add new benefit */} + ( + + + + ) + }} + /> + )} + /> + {(!watchedBenefits || watchedBenefits.length === 0) && ( + + Minimal satu manfaat harus ditambahkan + + )} +
+ + {/* Status Aktif */} +
+ ( + } + label='Program Aktif' + /> + )} + /> +
+ + {/* Tampilkan selengkapnya */} + {!showMore && ( + + )} + + {/* Konten tambahan */} + {showMore && ( + <> + {/* Description */} +
+ + Deskripsi Program + + ( + + )} + /> +
+ + {/* Sembunyikan */} + + + )} +
+
+
+ + {/* Sticky Footer */} + +
+ + +
+
+
+ ) +} + +export default AddEditLoyaltyDrawer diff --git a/src/views/apps/marketing/loyalty/LoyaltyListTable.tsx b/src/views/apps/marketing/loyalty/LoyaltyListTable.tsx new file mode 100644 index 0000000..b887d50 --- /dev/null +++ b/src/views/apps/marketing/loyalty/LoyaltyListTable.tsx @@ -0,0 +1,635 @@ +'use client' + +// React Imports +import { useEffect, useState, useMemo, useCallback } from 'react' + +// Next Imports +import Link from 'next/link' +import { useParams } from 'next/navigation' + +// MUI Imports +import Card from '@mui/material/Card' +import CardHeader from '@mui/material/CardHeader' +import Button from '@mui/material/Button' +import Typography from '@mui/material/Typography' +import Chip from '@mui/material/Chip' +import Checkbox from '@mui/material/Checkbox' +import IconButton from '@mui/material/IconButton' +import { styled } from '@mui/material/styles' +import TablePagination from '@mui/material/TablePagination' +import type { TextFieldProps } from '@mui/material/TextField' +import MenuItem from '@mui/material/MenuItem' + +// Third-party Imports +import classnames from 'classnames' +import { rankItem } from '@tanstack/match-sorter-utils' +import { + createColumnHelper, + flexRender, + getCoreRowModel, + useReactTable, + getFilteredRowModel, + getFacetedRowModel, + getFacetedUniqueValues, + getFacetedMinMaxValues, + getPaginationRowModel, + getSortedRowModel +} from '@tanstack/react-table' +import type { ColumnDef, FilterFn } from '@tanstack/react-table' +import type { RankingInfo } from '@tanstack/match-sorter-utils' + +// Type Imports +import type { ThemeColor } from '@core/types' +import type { Locale } from '@configs/i18n' + +// Component Imports +import OptionMenu from '@core/components/option-menu' +import TablePaginationComponent from '@components/TablePaginationComponent' +import CustomTextField from '@core/components/mui/TextField' +import CustomAvatar from '@core/components/mui/Avatar' + +// Util Imports +import { getInitials } from '@/utils/getInitials' +import { getLocalizedUrl } from '@/utils/i18n' +import { formatCurrency } from '@/utils/transform' + +// Style Imports +import tableStyles from '@core/styles/table.module.css' +import Loading from '@/components/layout/shared/Loading' +import AddEditLoyaltyDrawer from './AddLoyaltiDrawer' + +// Loyalty Type Interface +export interface LoyaltyType { + id: string + name: string + minimumPurchase: number + pointMultiplier: number + benefits: string[] + createdAt: Date + updatedAt: Date +} + +declare module '@tanstack/table-core' { + interface FilterFns { + fuzzy: FilterFn + } + interface FilterMeta { + itemRank: RankingInfo + } +} + +type LoyaltyTypeWithAction = LoyaltyType & { + action?: string +} + +// Styled Components +const Icon = styled('i')({}) + +const fuzzyFilter: FilterFn = (row, columnId, value, addMeta) => { + // Rank the item + const itemRank = rankItem(row.getValue(columnId), value) + + // Store the itemRank info + addMeta({ + itemRank + }) + + // Return if the item should be filtered in/out + return itemRank.passed +} + +const DebouncedInput = ({ + value: initialValue, + onChange, + debounce = 500, + ...props +}: { + value: string | number + onChange: (value: string | number) => void + debounce?: number +} & Omit) => { + // States + const [value, setValue] = useState(initialValue) + + useEffect(() => { + setValue(initialValue) + }, [initialValue]) + + useEffect(() => { + const timeout = setTimeout(() => { + onChange(value) + }, debounce) + + return () => clearTimeout(timeout) + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [value]) + + return setValue(e.target.value)} /> +} + +// Dummy data for loyalty programs +const DUMMY_LOYALTY_DATA: LoyaltyType[] = [ + { + id: '1', + name: 'Silver Member', + minimumPurchase: 500000, + pointMultiplier: 1, + benefits: ['Gratis ongkir', 'Diskon 5%', 'Priority customer service'], + createdAt: new Date('2024-01-15'), + updatedAt: new Date('2024-02-10') + }, + { + id: '2', + name: 'Gold Member', + minimumPurchase: 2000000, + pointMultiplier: 2, + benefits: ['Gratis ongkir', 'Diskon 10%', 'Birthday bonus', 'Priority customer service', 'Akses early sale'], + createdAt: new Date('2024-01-20'), + updatedAt: new Date('2024-02-15') + }, + { + id: '3', + name: 'Platinum Member', + minimumPurchase: 5000000, + pointMultiplier: 3, + benefits: [ + 'Gratis ongkir', + 'Diskon 15%', + 'Birthday bonus', + 'Dedicated account manager', + 'VIP event access', + 'Personal shopper' + ], + createdAt: new Date('2024-01-25'), + updatedAt: new Date('2024-02-20') + }, + { + id: '4', + name: 'Diamond Member', + minimumPurchase: 10000000, + pointMultiplier: 5, + benefits: [ + 'Gratis ongkir', + 'Diskon 20%', + 'Birthday bonus', + 'Dedicated account manager', + 'VIP event access', + 'Personal shopper', + 'Annual gift', + 'Luxury experiences' + ], + createdAt: new Date('2024-02-01'), + updatedAt: new Date('2024-02-25') + }, + { + id: '5', + name: 'Student Discount', + minimumPurchase: 100000, + pointMultiplier: 1, + benefits: ['Diskon 10% khusus mahasiswa', 'Gratis ongkir untuk pembelian minimal 200k'], + createdAt: new Date('2024-02-05'), + updatedAt: new Date('2024-03-01') + }, + { + id: '6', + name: 'Senior Citizen', + minimumPurchase: 200000, + pointMultiplier: 2, + benefits: ['Diskon 15% untuk usia 60+', 'Gratis ongkir', 'Konsultasi gratis', 'Priority support'], + createdAt: new Date('2024-02-10'), + updatedAt: new Date('2024-03-05') + }, + { + id: '7', + name: 'Corporate Partner', + minimumPurchase: 15000000, + pointMultiplier: 4, + benefits: [ + 'Diskon 25% untuk pembelian korporat', + 'Payment terms 30 hari', + 'Dedicated sales rep', + 'Bulk discount', + 'Invoice payment' + ], + createdAt: new Date('2024-02-15'), + updatedAt: new Date('2024-03-10') + }, + { + id: '8', + name: 'New Customer Bonus', + minimumPurchase: 0, + pointMultiplier: 1, + benefits: ['Welcome bonus 50 poin', 'Diskon 15% pembelian pertama', 'Gratis ongkir'], + createdAt: new Date('2024-03-01'), + updatedAt: new Date('2024-03-15') + }, + { + id: '9', + name: 'Family Package', + minimumPurchase: 1000000, + pointMultiplier: 2, + benefits: [ + 'Diskon 12% untuk keluarga', + 'Poin dapat dibagi ke anggota keluarga', + 'Family rewards', + 'Group discount' + ], + createdAt: new Date('2024-03-05'), + updatedAt: new Date('2024-03-20') + }, + { + id: '10', + name: 'Loyalty Plus', + minimumPurchase: 3000000, + pointMultiplier: 3, + benefits: [ + 'Cashback 8%', + 'Exclusive member-only products', + 'Free premium packaging', + 'Extended warranty', + 'Member appreciation events' + ], + createdAt: new Date('2024-03-10'), + updatedAt: new Date('2024-03-25') + }, + { + id: '11', + name: 'VIP Collector', + minimumPurchase: 7500000, + pointMultiplier: 4, + benefits: [ + 'Limited edition access', + 'Collector item discounts', + 'Pre-order privileges', + 'Authentication service', + 'Storage solutions' + ], + createdAt: new Date('2024-03-15'), + updatedAt: new Date('2024-03-30') + }, + { + id: '12', + name: 'Seasonal Member', + minimumPurchase: 800000, + pointMultiplier: 2, + benefits: ['Seasonal sale access', 'Holiday bonuses', 'Festival discounts', 'Seasonal gift wrapping'], + createdAt: new Date('2024-03-20'), + updatedAt: new Date('2024-04-05') + } +] + +// Mock data hook with dummy data +const useLoyalty = ({ page, limit, search }: { page: number; limit: number; search: string }) => { + const [isLoading, setIsLoading] = useState(false) + + // Simulate loading + useEffect(() => { + setIsLoading(true) + const timer = setTimeout(() => setIsLoading(false), 500) + return () => clearTimeout(timer) + }, [page, limit, search]) + + // Filter data based on search + const filteredData = useMemo(() => { + if (!search) return DUMMY_LOYALTY_DATA + + return DUMMY_LOYALTY_DATA.filter( + loyalty => + loyalty.name.toLowerCase().includes(search.toLowerCase()) || + loyalty.benefits.some(benefit => benefit.toLowerCase().includes(search.toLowerCase())) + ) + }, [search]) + + // Paginate data + const paginatedData = useMemo(() => { + const startIndex = (page - 1) * limit + const endIndex = startIndex + limit + return filteredData.slice(startIndex, endIndex) + }, [filteredData, page, limit]) + + return { + data: { + loyalties: paginatedData, + total_count: filteredData.length + }, + isLoading, + error: null, + isFetching: isLoading + } +} + +// Column Definitions +const columnHelper = createColumnHelper() + +const LoyaltyListTable = () => { + // States + const [addLoyaltyOpen, setAddLoyaltyOpen] = useState(false) + const [editLoyaltyData, setEditLoyaltyData] = useState(undefined) + const [rowSelection, setRowSelection] = useState({}) + const [globalFilter, setGlobalFilter] = useState('') + const [currentPage, setCurrentPage] = useState(1) + const [pageSize, setPageSize] = useState(10) + const [search, setSearch] = useState('') + + const { data, isLoading, error, isFetching } = useLoyalty({ + page: currentPage, + limit: pageSize, + search + }) + + const loyalties = data?.loyalties ?? [] + const totalCount = data?.total_count ?? 0 + + // Hooks + const { lang: locale } = useParams() + + const handlePageChange = useCallback((event: unknown, newPage: number) => { + setCurrentPage(newPage) + }, []) + + const handlePageSizeChange = useCallback((event: React.ChangeEvent) => { + const newPageSize = parseInt(event.target.value, 10) + setPageSize(newPageSize) + setCurrentPage(1) // Reset to first page + }, []) + + const handleEditLoyalty = (loyalty: LoyaltyType) => { + setEditLoyaltyData(loyalty) + setAddLoyaltyOpen(true) + } + + const handleDeleteLoyalty = (loyaltyId: string) => { + if (confirm('Apakah Anda yakin ingin menghapus program loyalty ini?')) { + console.log('Deleting loyalty:', loyaltyId) + // Add your delete logic here + // deleteLoyalty.mutate(loyaltyId) + } + } + + const handleCloseLoyaltyDrawer = () => { + setAddLoyaltyOpen(false) + setEditLoyaltyData(undefined) + } + + const columns = useMemo[]>( + () => [ + { + id: 'select', + header: ({ table }) => ( + + ), + cell: ({ row }) => ( + + ) + }, + columnHelper.accessor('name', { + header: 'Program Loyalty', + cell: ({ row }) => ( +
+
+ + + {row.original.name} + + +
+
+ ) + }), + columnHelper.accessor('minimumPurchase', { + header: 'Minimum Pembelian', + cell: ({ row }) => ( +
+ + {formatCurrency(row.original.minimumPurchase)} +
+ ) + }), + columnHelper.accessor('pointMultiplier', { + header: 'Pengali Poin', + cell: ({ row }) => ( + + ) + }), + columnHelper.accessor('benefits', { + header: 'Manfaat', + cell: ({ row }) => ( +
+ {row.original.benefits.slice(0, 2).map((benefit, index) => ( + + ))} + {row.original.benefits.length > 2 && ( + + )} +
+ ) + }), + columnHelper.accessor('createdAt', { + header: 'Tanggal Dibuat', + cell: ({ row }) => ( + + {new Date(row.original.createdAt).toLocaleDateString('id-ID', { + year: 'numeric', + month: 'short', + day: 'numeric' + })} + + ) + }), + { + id: 'actions', + header: 'Aksi', + cell: ({ row }) => ( +
+ handleEditLoyalty(row.original) + } + }, + { + text: 'Hapus', + icon: 'tabler-trash text-[22px]', + menuItemProps: { + className: 'flex items-center gap-2 text-textSecondary', + onClick: () => handleDeleteLoyalty(row.original.id) + } + } + ]} + /> +
+ ), + enableSorting: false + } + ], + // eslint-disable-next-line react-hooks/exhaustive-deps + [locale, handleEditLoyalty, handleDeleteLoyalty] + ) + + const table = useReactTable({ + data: loyalties as LoyaltyType[], + columns, + filterFns: { + fuzzy: fuzzyFilter + }, + state: { + rowSelection, + globalFilter, + pagination: { + pageIndex: currentPage, + pageSize + } + }, + enableRowSelection: true, + onRowSelectionChange: setRowSelection, + getCoreRowModel: getCoreRowModel(), + manualPagination: true, + pageCount: Math.ceil(totalCount / pageSize) + }) + + return ( + <> + +
+ table.setPageSize(Number(e.target.value))} + className='max-sm:is-full sm:is-[70px]' + > + 10 + 25 + 50 + +
+ setSearch(value as string)} + placeholder='Cari Program Loyalty' + className='max-sm:is-full' + /> + + +
+
+
+ {isLoading ? ( + + ) : ( + + + {table.getHeaderGroups().map(headerGroup => ( + + {headerGroup.headers.map(header => ( + + ))} + + ))} + + {table.getFilteredRowModel().rows.length === 0 ? ( + + + + + + ) : ( + + {table + .getRowModel() + .rows.slice(0, table.getState().pagination.pageSize) + .map(row => { + return ( + + {row.getVisibleCells().map(cell => ( + + ))} + + ) + })} + + )} +
+ {header.isPlaceholder ? null : ( + <> +
+ {flexRender(header.column.columnDef.header, header.getContext())} + {{ + asc: , + desc: + }[header.column.getIsSorted() as 'asc' | 'desc'] ?? null} +
+ + )} +
+ Tidak ada data tersedia +
{flexRender(cell.column.columnDef.cell, cell.getContext())}
+ )} +
+ ( + + )} + count={totalCount} + rowsPerPage={pageSize} + page={currentPage} + onPageChange={handlePageChange} + onRowsPerPageChange={handlePageSizeChange} + rowsPerPageOptions={[10, 25, 50]} + disabled={isLoading} + /> +
+ + + ) +} + +export default LoyaltyListTable diff --git a/src/views/apps/marketing/loyalty/index.tsx b/src/views/apps/marketing/loyalty/index.tsx new file mode 100644 index 0000000..d5edcd1 --- /dev/null +++ b/src/views/apps/marketing/loyalty/index.tsx @@ -0,0 +1,17 @@ +// MUI Imports +import Grid from '@mui/material/Grid2' +import LoyaltyListTable from './LoyaltyListTable' + +// Type Imports + +const LoyaltyList = () => { + return ( + + + + + + ) +} + +export default LoyaltyList