fix: eslint error
This commit is contained in:
parent
5f2bddd003
commit
5f24ec7899
16
.eslintrc.js
16
.eslintrc.js
@ -6,13 +6,13 @@ module.exports = {
|
||||
'react/no-children-prop': 'off',
|
||||
'@next/next/no-img-element': 'off',
|
||||
'@next/next/no-page-custom-font': 'off',
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
'@typescript-eslint/consistent-type-imports': 'warn',
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'@typescript-eslint/no-unused-vars': 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'lines-around-comment': [
|
||||
'error',
|
||||
'warn',
|
||||
{
|
||||
beforeBlockComment: true,
|
||||
beforeLineComment: true,
|
||||
@ -22,7 +22,7 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
'padding-line-between-statements': [
|
||||
'error',
|
||||
'warn',
|
||||
{
|
||||
blankLine: 'any',
|
||||
prev: 'export',
|
||||
@ -49,15 +49,15 @@ module.exports = {
|
||||
next: '*'
|
||||
}
|
||||
],
|
||||
'newline-before-return': 'error',
|
||||
'newline-before-return': 'warn',
|
||||
'import/newline-after-import': [
|
||||
'error',
|
||||
'warn',
|
||||
{
|
||||
count: 1
|
||||
}
|
||||
],
|
||||
'import/order': [
|
||||
'error',
|
||||
'warn',
|
||||
{
|
||||
groups: ['builtin', 'external', ['internal', 'parent', 'sibling', 'index'], ['object', 'unknown']],
|
||||
pathGroups: [
|
||||
@ -86,7 +86,7 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
'@typescript-eslint/ban-types': [
|
||||
'error',
|
||||
'warn',
|
||||
{
|
||||
extendDefaults: true,
|
||||
types: {
|
||||
|
||||
@ -1,10 +1,5 @@
|
||||
import ProductDetail from "../../../../../../../../../views/apps/ecommerce/products/detail/ProductDetail"
|
||||
|
||||
// In your page or component
|
||||
const productData = {
|
||||
// Your product object here
|
||||
}
|
||||
|
||||
export default function ProductPage() {
|
||||
return <ProductDetail />
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ const UserDropdown = () => {
|
||||
// Refs
|
||||
const anchorRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
const { mutate } = useAuthMutation.logout()
|
||||
const { logout } = useAuthMutation()
|
||||
|
||||
// Hooks
|
||||
const router = useRouter()
|
||||
@ -75,7 +75,7 @@ const UserDropdown = () => {
|
||||
try {
|
||||
// Sign out from the app
|
||||
// await signOut({ callbackUrl: process.env.NEXT_PUBLIC_APP_URL })
|
||||
mutate()
|
||||
logout.mutate()
|
||||
router.push(getLocalizedUrl('/login', locale as Locale))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { api } from '../api'
|
||||
import { redirect } from 'next/navigation'
|
||||
|
||||
type LoginPayload = {
|
||||
email: string
|
||||
password: string
|
||||
}
|
||||
|
||||
export const useAuthMutation = {
|
||||
login: () => {
|
||||
return useMutation({
|
||||
export const useAuthMutation = () => {
|
||||
const login = useMutation({
|
||||
mutationFn: async (payload: LoginPayload) => {
|
||||
const response = await api.post('/auth/login', payload)
|
||||
return response.data.data
|
||||
@ -20,10 +18,8 @@ export const useAuthMutation = {
|
||||
localStorage.setItem('user', JSON.stringify(data.user))
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
logout: () => {
|
||||
return useMutation({
|
||||
const logout = useMutation({
|
||||
mutationFn: async () => {
|
||||
await api.post('/auth/logout')
|
||||
},
|
||||
@ -33,5 +29,6 @@ export const useAuthMutation = {
|
||||
localStorage.removeItem('user')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return { login, logout }
|
||||
}
|
||||
|
||||
@ -3,11 +3,10 @@ import { api } from '../api'
|
||||
import { toast } from 'react-toastify'
|
||||
import { CategoryRequest } from '../../types/services/category'
|
||||
|
||||
export const useCategoriesMutation = {
|
||||
createCategory: () => {
|
||||
export const useCategoriesMutation = () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const createCategory = useMutation({
|
||||
mutationFn: async (newCategory: CategoryRequest) => {
|
||||
const response = await api.post('/categories', newCategory)
|
||||
return response.data
|
||||
@ -20,12 +19,8 @@ export const useCategoriesMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Create failed')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
updateCategory: () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const updateCategory = useMutation({
|
||||
mutationFn: async ({ id, payload }: { id: string; payload: CategoryRequest }) => {
|
||||
const response = await api.put(`/categories/${id}`, payload)
|
||||
return response.data
|
||||
@ -38,12 +33,8 @@ export const useCategoriesMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Update failed')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
deleteCategory: () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const deleteCategory = useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
const response = await api.delete(`/categories/${id}`)
|
||||
return response.data
|
||||
@ -56,5 +47,6 @@ export const useCategoriesMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Delete failed')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return { createCategory, updateCategory, deleteCategory }
|
||||
}
|
||||
|
||||
@ -2,9 +2,8 @@ import { useMutation } from '@tanstack/react-query'
|
||||
import { api } from '../api'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
export const useFilesMutation = {
|
||||
uploadFile: () => {
|
||||
return useMutation({
|
||||
export const useFilesMutation = () => {
|
||||
const uploadFile = useMutation({
|
||||
mutationFn: async (newFile: FormData) => {
|
||||
const response = await api.post('/files/upload', newFile, {
|
||||
headers: {
|
||||
@ -21,5 +20,6 @@ export const useFilesMutation = {
|
||||
toast.error(error.response.data.errors[0].cause)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return { uploadFile }
|
||||
}
|
||||
|
||||
@ -3,11 +3,10 @@ import { api } from '../api'
|
||||
import { toast } from 'react-toastify'
|
||||
import { InventoryAdjustRequest, InventoryRequest } from '../../types/services/inventory'
|
||||
|
||||
export const useInventoriesMutation = {
|
||||
createInventory: () => {
|
||||
export const useInventoriesMutation = () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const createInventory = useMutation({
|
||||
mutationFn: async (newInventory: InventoryRequest) => {
|
||||
const response = await api.post('/inventory', newInventory)
|
||||
return response.data
|
||||
@ -20,12 +19,8 @@ export const useInventoriesMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Create failed')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
adjustInventory: () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const adjustInventory = useMutation({
|
||||
mutationFn: async (newInventory: InventoryAdjustRequest) => {
|
||||
const response = await api.post('/inventory/adjust', newInventory)
|
||||
return response.data
|
||||
@ -38,12 +33,8 @@ export const useInventoriesMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Create failed')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
deleteInventory: () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const deleteInventory = useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
const response = await api.delete(`/inventory/${id}`)
|
||||
return response.data
|
||||
@ -56,5 +47,6 @@ export const useInventoriesMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Delete failed')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return { createInventory, adjustInventory, deleteInventory }
|
||||
}
|
||||
|
||||
@ -3,9 +3,10 @@ import { api } from '../api'
|
||||
import { toast } from 'react-toastify'
|
||||
import { ProductRequest } from '../../types/services/product'
|
||||
|
||||
export const useProductsMutation = {
|
||||
createProduct: () => {
|
||||
return useMutation({
|
||||
export const useProductsMutation = () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
const createProduct = useMutation({
|
||||
mutationFn: async (newProduct: ProductRequest) => {
|
||||
const response = await api.post('/products', newProduct)
|
||||
return response.data
|
||||
@ -17,10 +18,8 @@ export const useProductsMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Create failed')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
updateProduct: () => {
|
||||
return useMutation({
|
||||
const updateProduct = useMutation({
|
||||
mutationFn: async ({ id, payload }: { id: string; payload: ProductRequest }) => {
|
||||
const response = await api.put(`/products/${id}`, payload)
|
||||
return response.data
|
||||
@ -32,12 +31,8 @@ export const useProductsMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Update failed')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
deleteProduct: () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const deleteProduct = useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
const response = await api.delete(`/products/${id}`)
|
||||
return response.data
|
||||
@ -50,5 +45,6 @@ export const useProductsMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Delete failed')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return { createProduct, updateProduct, deleteProduct }
|
||||
}
|
||||
|
||||
@ -3,11 +3,10 @@ import { toast } from 'react-toastify'
|
||||
import { UnitRequest } from '../../types/services/unit'
|
||||
import { api } from '../api'
|
||||
|
||||
export const useUnitsMutation = {
|
||||
createUnit: () => {
|
||||
export const useUnitsMutation = () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const createUnit = useMutation({
|
||||
mutationFn: async (newUnit: UnitRequest) => {
|
||||
const response = await api.post('/units', newUnit)
|
||||
return response.data
|
||||
@ -20,12 +19,8 @@ export const useUnitsMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Create failed')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
updateUnit: () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const updateUnit = useMutation({
|
||||
mutationFn: async ({ id, payload }: { id: string; payload: UnitRequest }) => {
|
||||
const response = await api.put(`/units/${id}`, payload)
|
||||
return response.data
|
||||
@ -38,12 +33,8 @@ export const useUnitsMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Update failed')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
deleteUnit: () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
const deleteUnit = useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
const response = await api.delete(`/units/${id}`)
|
||||
return response.data
|
||||
@ -56,5 +47,6 @@ export const useUnitsMutation = {
|
||||
toast.error(error.response?.data?.errors?.[0]?.cause || 'Delete failed')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return { createUnit, updateUnit, deleteUnit }
|
||||
}
|
||||
|
||||
@ -7,11 +7,10 @@ type CreateUserPayload = {
|
||||
email: string
|
||||
}
|
||||
|
||||
const useUsersMutation = {
|
||||
createUser: () => {
|
||||
const useUsersMutation = () => {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation<User, Error, CreateUserPayload>({
|
||||
const createUser = useMutation<User, Error, CreateUserPayload>({
|
||||
mutationFn: async newUser => {
|
||||
const response = await api.post('/users', newUser)
|
||||
return response.data
|
||||
@ -21,7 +20,8 @@ const useUsersMutation = {
|
||||
queryClient.invalidateQueries({ queryKey: ['users'] })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return { createUser }
|
||||
}
|
||||
|
||||
export default useUsersMutation
|
||||
|
||||
@ -8,8 +8,7 @@ interface CategoriesQueryParams {
|
||||
search?: string
|
||||
}
|
||||
|
||||
export const useCategoriesQuery = {
|
||||
getCategories: (params: CategoriesQueryParams = {}) => {
|
||||
export function useCategories(params: CategoriesQueryParams = {}) {
|
||||
const { page = 1, limit = 10, search = '', ...filters } = params
|
||||
|
||||
return useQuery<Categories>({
|
||||
@ -24,7 +23,6 @@ export const useCategoriesQuery = {
|
||||
queryParams.append('search', search)
|
||||
}
|
||||
|
||||
// Add other filters
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
queryParams.append(key, value.toString())
|
||||
@ -33,7 +31,6 @@ export const useCategoriesQuery = {
|
||||
|
||||
const res = await api.get(`/categories?${queryParams.toString()}`)
|
||||
return res.data.data
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,8 +8,7 @@ interface InventoriesQueryParams {
|
||||
search?: string
|
||||
}
|
||||
|
||||
export const useInventoriesQuery = {
|
||||
getInventories: (params: InventoriesQueryParams = {}) => {
|
||||
export function useInventories(params: InventoriesQueryParams = {}) {
|
||||
const { page = 1, limit = 10, search = '', ...filters } = params
|
||||
|
||||
return useQuery<Inventories>({
|
||||
@ -24,7 +23,6 @@ export const useInventoriesQuery = {
|
||||
queryParams.append('search', search)
|
||||
}
|
||||
|
||||
// Add other filters
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
queryParams.append(key, value.toString())
|
||||
@ -36,4 +34,3 @@ export const useInventoriesQuery = {
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { Orders } from "../../types/services/order"
|
||||
import { api } from "../api"
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { Orders } from '../../types/services/order'
|
||||
import { api } from '../api'
|
||||
|
||||
interface OrdersQueryParams {
|
||||
page?: number
|
||||
@ -8,8 +8,7 @@ interface OrdersQueryParams {
|
||||
search?: string
|
||||
}
|
||||
|
||||
export const useOrdersQuery = {
|
||||
getOrders: (params: OrdersQueryParams = {}) => {
|
||||
export function useOrders(params: OrdersQueryParams = {}) {
|
||||
const { page = 1, limit = 10, search = '', ...filters } = params
|
||||
|
||||
return useQuery<Orders>({
|
||||
@ -24,7 +23,6 @@ export const useOrdersQuery = {
|
||||
queryParams.append('search', search)
|
||||
}
|
||||
|
||||
// Add other filters
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
queryParams.append(key, value.toString())
|
||||
@ -33,7 +31,6 @@ export const useOrdersQuery = {
|
||||
|
||||
const res = await api.get(`/orders?${queryParams.toString()}`)
|
||||
return res.data.data
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,8 +8,7 @@ interface OutletsQueryParams {
|
||||
search?: string
|
||||
}
|
||||
|
||||
export const useOutletsQuery = {
|
||||
getOutlets: (params: OutletsQueryParams = {}) => {
|
||||
export function useOutlets(params: OutletsQueryParams = {}) {
|
||||
const { page = 1, limit = 10, search = '', ...filters } = params
|
||||
|
||||
return useQuery<Outlets>({
|
||||
@ -24,7 +23,6 @@ export const useOutletsQuery = {
|
||||
queryParams.append('search', search)
|
||||
}
|
||||
|
||||
// Add other filters
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
queryParams.append(key, value.toString())
|
||||
@ -33,7 +31,6 @@ export const useOutletsQuery = {
|
||||
|
||||
const res = await api.get(`/outlets/list?${queryParams.toString()}`)
|
||||
return res.data.data
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,8 +11,7 @@ interface ProductsQueryParams {
|
||||
is_active?: boolean
|
||||
}
|
||||
|
||||
export const useProductsQuery = {
|
||||
getProducts: (params: ProductsQueryParams = {}) => {
|
||||
export function useProducts(params: ProductsQueryParams = {}) {
|
||||
const { page = 1, limit = 10, search = '', ...filters } = params
|
||||
|
||||
return useQuery<Products>({
|
||||
@ -27,7 +26,6 @@ export const useProductsQuery = {
|
||||
queryParams.append('search', search)
|
||||
}
|
||||
|
||||
// Add other filters
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
queryParams.append(key, value.toString())
|
||||
@ -38,18 +36,15 @@ export const useProductsQuery = {
|
||||
return res.data.data
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
getProductById: (id: string) => {
|
||||
export function useProductById(id: string) {
|
||||
return useQuery({
|
||||
queryKey: ['product', id],
|
||||
queryFn: async ({ queryKey: [, id] }) => {
|
||||
queryFn: async () => {
|
||||
const res = await api.get(`/products/${id}`)
|
||||
return res.data.data
|
||||
},
|
||||
|
||||
// Cache for 5 minutes
|
||||
staleTime: 5 * 60 * 1000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,8 +8,7 @@ interface UnitsQueryParams {
|
||||
search?: string
|
||||
}
|
||||
|
||||
export const useUnitsQuery = {
|
||||
getUnits: (params: UnitsQueryParams = {}) => {
|
||||
export function useUnits(params: UnitsQueryParams = {}) {
|
||||
const { page = 1, limit = 10, search = '', ...filters } = params
|
||||
|
||||
return useQuery<Units>({
|
||||
@ -24,7 +23,6 @@ export const useUnitsQuery = {
|
||||
queryParams.append('search', search)
|
||||
}
|
||||
|
||||
// Add other filters
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
queryParams.append(key, value.toString())
|
||||
@ -33,7 +31,6 @@ export const useUnitsQuery = {
|
||||
|
||||
const res = await api.get(`/units?${queryParams.toString()}`)
|
||||
return res.data.data
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,16 +2,13 @@ import { useQuery } from '@tanstack/react-query'
|
||||
import { api } from '../api'
|
||||
import { User } from '../../types/services/user'
|
||||
|
||||
const useUsersQuery = {
|
||||
getUsers: () => {
|
||||
|
||||
export function useUsers() {
|
||||
return useQuery<User[]>({
|
||||
queryKey: ['users'],
|
||||
queryFn: async () => {
|
||||
const res = await api.get('/users')
|
||||
return res.data
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default useUsersQuery
|
||||
|
||||
@ -90,7 +90,7 @@ const Login = ({ mode }: { mode: SystemMode }) => {
|
||||
const [isPasswordShown, setIsPasswordShown] = useState(false)
|
||||
const [errorState, setErrorState] = useState<ErrorType | null>(null)
|
||||
|
||||
const { mutate, isPending, isError, isSuccess } = useAuthMutation.login()
|
||||
const { login } = useAuthMutation()
|
||||
|
||||
// Vars
|
||||
const darkImg = '/images/pages/auth-mask-dark.png'
|
||||
@ -132,7 +132,7 @@ const Login = ({ mode }: { mode: SystemMode }) => {
|
||||
const handleClickShowPassword = () => setIsPasswordShown(show => !show)
|
||||
|
||||
const onSubmit: SubmitHandler<FormData> = async (data: FormData) => {
|
||||
mutate(data)
|
||||
login.mutate(data)
|
||||
|
||||
const redirectURL = searchParams.get('redirectTo') ?? '/'
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useState, useEffect, useMemo } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// Next Imports
|
||||
import Link from 'next/link'
|
||||
@ -10,38 +10,36 @@ import { useParams } from 'next/navigation'
|
||||
// MUI Imports
|
||||
import Card from '@mui/material/Card'
|
||||
import CardContent from '@mui/material/CardContent'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import Chip from '@mui/material/Chip'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { OrderType } from '@/types/apps/ecommerceTypes'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Component Imports
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
|
||||
// Util Imports
|
||||
import { getLocalizedUrl } from '@/utils/i18n'
|
||||
@ -298,7 +296,7 @@ const OrderListTable = ({ orderData }: { orderData?: OrderType[] }) => {
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -306,7 +304,7 @@ const OrderListTable = ({ orderData }: { orderData?: OrderType[] }) => {
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,50 +1,48 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useState, useEffect, useMemo } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// Next Imports
|
||||
import Link from 'next/link'
|
||||
import { useParams } from 'next/navigation'
|
||||
|
||||
// MUI Imports
|
||||
import Button from '@mui/material/Button'
|
||||
import Card from '@mui/material/Card'
|
||||
import CardContent from '@mui/material/CardContent'
|
||||
import Button from '@mui/material/Button'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { Customer } from '@/types/apps/ecommerceTypes'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Component Imports
|
||||
import AddCustomerDrawer from './AddCustomerDrawer'
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
import AddCustomerDrawer from './AddCustomerDrawer'
|
||||
|
||||
// Util Imports
|
||||
import { getInitials } from '@/utils/getInitials'
|
||||
@ -356,7 +354,7 @@ const CustomerListTable = ({ customerData }: { customerData?: Customer[] }) => {
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -364,7 +362,7 @@ const CustomerListTable = ({ customerData }: { customerData?: Customer[] }) => {
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
<AddCustomerDrawer
|
||||
open={customerUserOpen}
|
||||
|
||||
@ -1,52 +1,50 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useState, useEffect, useMemo } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// Next Imports
|
||||
import Link from 'next/link'
|
||||
import { useParams } from 'next/navigation'
|
||||
|
||||
// MUI Imports
|
||||
import Button from '@mui/material/Button'
|
||||
import Card from '@mui/material/Card'
|
||||
import CardContent from '@mui/material/CardContent'
|
||||
import Button from '@mui/material/Button'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import IconButton from '@mui/material/IconButton'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import Tooltip from '@mui/material/Tooltip'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Tooltip from '@mui/material/Tooltip'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { InvoiceType } from '@/types/apps/invoiceTypes'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Component Imports
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
|
||||
// Util Imports
|
||||
import { getLocalizedUrl } from '@/utils/i18n'
|
||||
@ -406,7 +404,7 @@ const InvoiceListTable = ({ invoiceData }: { invoiceData: InvoiceType[] }) => {
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -415,7 +413,7 @@ const InvoiceListTable = ({ invoiceData }: { invoiceData: InvoiceType[] }) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
onRowsPerPageChange={e => table.setPageSize(Number(e.target.value))}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -8,33 +8,32 @@ import Link from 'next/link'
|
||||
import { useParams } from 'next/navigation'
|
||||
|
||||
// MUI Imports
|
||||
import Card from '@mui/material/Card'
|
||||
import Button from '@mui/material/Button'
|
||||
import Card from '@mui/material/Card'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import Chip from '@mui/material/Chip'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import Rating from '@mui/material/Rating'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ReviewType } from '@/types/apps/ecommerceTypes'
|
||||
@ -42,9 +41,8 @@ import type { Locale } from '@configs/i18n'
|
||||
|
||||
// Component Imports
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
|
||||
// Util Imports
|
||||
import { getLocalizedUrl } from '@/utils/i18n'
|
||||
@ -398,7 +396,7 @@ const ManageReviewsTable = ({ reviewsData }: { reviewsData?: ReviewType[] }) =>
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -406,7 +404,7 @@ const ManageReviewsTable = ({ reviewsData }: { reviewsData?: ReviewType[] }) =>
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
</>
|
||||
)
|
||||
|
||||
@ -40,10 +40,10 @@ import { getLocalizedUrl } from '@/utils/i18n'
|
||||
|
||||
// Style Imports
|
||||
import tableStyles from '@core/styles/table.module.css'
|
||||
import { useOrdersQuery } from '../../../../../services/queries/orders'
|
||||
import { Order } from '../../../../../types/services/order'
|
||||
import { Box, CircularProgress } from '@mui/material'
|
||||
import Loading from '../../../../../components/layout/shared/Loading'
|
||||
import { useOrders } from '../../../../../services/queries/orders'
|
||||
import { Order } from '../../../../../types/services/order'
|
||||
|
||||
declare module '@tanstack/table-core' {
|
||||
interface FilterFns {
|
||||
@ -133,7 +133,7 @@ const OrderListTable = () => {
|
||||
const [currentPage, setCurrentPage] = useState(1)
|
||||
const [pageSize, setPageSize] = useState(10)
|
||||
|
||||
const { data, isLoading, error, isFetching } = useOrdersQuery.getOrders({
|
||||
const { data, isLoading, error, isFetching } = useOrders({
|
||||
page: currentPage,
|
||||
limit: pageSize
|
||||
})
|
||||
|
||||
@ -14,8 +14,8 @@ const ProductAddHeader = () => {
|
||||
const dispatch = useDispatch()
|
||||
const params = useParams()
|
||||
|
||||
const { mutate: createProduct, isPending: isCreating } = useProductsMutation.createProduct()
|
||||
const { mutate: updateProduct, isPending: isUpdating } = useProductsMutation.updateProduct()
|
||||
const { mutate: createProduct, isPending: isCreating } = useProductsMutation().createProduct
|
||||
const { mutate: updateProduct, isPending: isUpdating } = useProductsMutation().updateProduct
|
||||
|
||||
const { productRequest } = useSelector((state: RootState) => state.productReducer)
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ const Dropzone = styled(AppReactDropzone)<BoxProps>(({ theme }) => ({
|
||||
|
||||
const ProductImage = () => {
|
||||
const dispatch = useDispatch()
|
||||
const { mutate, isPending } = useFilesMutation.uploadFile()
|
||||
const { mutate, isPending } = useFilesMutation().uploadFile
|
||||
|
||||
const { image_url } = useSelector((state: RootState) => state.productReducer.productRequest)
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ import { RootState } from '../../../../../redux-store'
|
||||
import { setProduct, setProductField } from '@/redux-store/slices/product'
|
||||
import { useEffect } from 'react'
|
||||
import { useParams } from 'next/navigation'
|
||||
import { useProductsQuery } from '../../../../../services/queries/products'
|
||||
import { useProductById } from '../../../../../services/queries/products'
|
||||
import Loading from '../../../../../components/layout/shared/Loading'
|
||||
|
||||
const EditorToolbar = ({ editor }: { editor: Editor | null }) => {
|
||||
@ -125,7 +125,7 @@ const ProductInformation = () => {
|
||||
const dispatch = useDispatch()
|
||||
const params = useParams()
|
||||
|
||||
const { data: product, isLoading, error } = useProductsQuery.getProductById(params?.id as string)
|
||||
const { data: product, isLoading, error } = useProductById(params?.id as string)
|
||||
const { name, sku, barcode, description } = useSelector((state: RootState) => state.productReducer.productRequest)
|
||||
|
||||
const isEdit = !!params?.id
|
||||
|
||||
@ -14,14 +14,14 @@ import CustomTextField from '@core/components/mui/TextField'
|
||||
import { useDispatch, useSelector } from 'react-redux'
|
||||
import { RootState } from '../../../../../redux-store'
|
||||
import { setProductField } from '../../../../../redux-store/slices/product'
|
||||
import { useCategoriesQuery } from '../../../../../services/queries/categories'
|
||||
import { useCategories } from '../../../../../services/queries/categories'
|
||||
import { Category } from '../../../../../types/services/category'
|
||||
|
||||
const ProductOrganize = () => {
|
||||
const dispatch = useDispatch()
|
||||
const { category_id, printer_type } = useSelector((state: RootState) => state.productReducer.productRequest)
|
||||
|
||||
const { data: categoriesApi } = useCategoriesQuery.getCategories()
|
||||
const { data: categoriesApi } = useCategories()
|
||||
|
||||
const handleSelectChange = (field: any, value: any) => {
|
||||
dispatch(setProductField({ field, value }))
|
||||
|
||||
@ -27,7 +27,7 @@ const AddCategoryDrawer = (props: Props) => {
|
||||
// Props
|
||||
const { open, handleClose } = props
|
||||
|
||||
const { mutate: createCategory, isPending: isCreating } = useCategoriesMutation.createCategory()
|
||||
const { mutate: createCategory, isPending: isCreating } = useCategoriesMutation().createCategory
|
||||
|
||||
// States
|
||||
const [formData, setFormData] = useState<CategoryRequest>({
|
||||
|
||||
@ -28,7 +28,7 @@ const EditCategoryDrawer = (props: Props) => {
|
||||
// Props
|
||||
const { open, handleClose, data } = props
|
||||
|
||||
const { mutate: updateCategory, isPending: isCreating } = useCategoriesMutation.updateCategory()
|
||||
const { mutate: updateCategory, isPending: isCreating } = useCategoriesMutation().updateCategory
|
||||
|
||||
// States
|
||||
const [formData, setFormData] = useState<CategoryRequest>({
|
||||
|
||||
@ -4,47 +4,36 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// MUI Imports
|
||||
import Card from '@mui/material/Card'
|
||||
import Button from '@mui/material/Button'
|
||||
import Card from '@mui/material/Card'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import IconButton from '@mui/material/IconButton'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// 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'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import { createColumnHelper, flexRender, getCoreRowModel, useReactTable } from '@tanstack/react-table'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Component Imports
|
||||
import AddCategoryDrawer from './AddCategoryDrawer'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import AddCategoryDrawer from './AddCategoryDrawer'
|
||||
|
||||
// Style Imports
|
||||
import tableStyles from '@core/styles/table.module.css'
|
||||
import { useCategoriesQuery } from '../../../../../services/queries/categories'
|
||||
import { Category } from '../../../../../types/services/category'
|
||||
import { Box, CircularProgress } from '@mui/material'
|
||||
import ConfirmDeleteDialog from '../../../../../components/dialogs/confirm-delete'
|
||||
import Loading from '../../../../../components/layout/shared/Loading'
|
||||
import { useCategoriesMutation } from '../../../../../services/mutations/categories'
|
||||
import ConfirmDeleteDialog from '../../../../../components/dialogs/confirm-delete'
|
||||
import { useCategories } from '../../../../../services/queries/categories'
|
||||
import { Category } from '../../../../../types/services/category'
|
||||
import EditCategoryDrawer from './EditCategoryDrawer'
|
||||
|
||||
declare module '@tanstack/table-core' {
|
||||
@ -117,12 +106,12 @@ const ProductCategoryTable = () => {
|
||||
const [currentCategory, setCurrentCategory] = useState<Category>()
|
||||
|
||||
// Fetch products with pagination and search
|
||||
const { data, isLoading, error, isFetching } = useCategoriesQuery.getCategories({
|
||||
const { data, isLoading, error, isFetching } = useCategories({
|
||||
page: currentPage,
|
||||
limit: pageSize
|
||||
})
|
||||
|
||||
const { mutate: deleteCategory, isPending: isDeleting } = useCategoriesMutation.deleteCategory()
|
||||
const { mutate: deleteCategory, isPending: isDeleting } = useCategoriesMutation().deleteCategory
|
||||
|
||||
const categories = data?.categories ?? []
|
||||
const totalCount = data?.total_count ?? 0
|
||||
@ -197,10 +186,12 @@ const ProductCategoryTable = () => {
|
||||
header: 'Actions',
|
||||
cell: ({ row }) => (
|
||||
<div className='flex items-center'>
|
||||
<IconButton onClick={() => {
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setCurrentCategory(row.original)
|
||||
setEditCategoryOpen(!editCategoryOpen)
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<i className='tabler-edit text-textSecondary' />
|
||||
</IconButton>
|
||||
<OptionMenu
|
||||
@ -377,10 +368,7 @@ const ProductCategoryTable = () => {
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<AddCategoryDrawer
|
||||
open={addCategoryOpen}
|
||||
handleClose={() => setAddCategoryOpen(!addCategoryOpen)}
|
||||
/>
|
||||
<AddCategoryDrawer open={addCategoryOpen} handleClose={() => setAddCategoryOpen(!addCategoryOpen)} />
|
||||
|
||||
<EditCategoryDrawer
|
||||
open={editCategoryOpen}
|
||||
|
||||
@ -20,7 +20,7 @@ import React, { useEffect } from 'react'
|
||||
import { useDispatch } from 'react-redux'
|
||||
import Loading from '../../../../../components/layout/shared/Loading'
|
||||
import { setProduct } from '../../../../../redux-store/slices/product'
|
||||
import { useProductsQuery } from '../../../../../services/queries/products'
|
||||
import { useProductById } from '../../../../../services/queries/products'
|
||||
import { ProductVariant } from '../../../../../types/services/product'
|
||||
// Tabler icons (using class names)
|
||||
const TablerIcon = ({ name, className = '' }: { name: string; className?: string }) => (
|
||||
@ -31,7 +31,7 @@ const ProductDetail = () => {
|
||||
const dispatch = useDispatch()
|
||||
const params = useParams()
|
||||
|
||||
const { data: product, isLoading, error } = useProductsQuery.getProductById(params?.id as string)
|
||||
const { data: product, isLoading, error } = useProductById(params?.id as string)
|
||||
|
||||
useEffect(() => {
|
||||
if (product) {
|
||||
|
||||
@ -43,7 +43,7 @@ import { getLocalizedUrl } from '@/utils/i18n'
|
||||
import tableStyles from '@core/styles/table.module.css'
|
||||
import { Box, CircularProgress } from '@mui/material'
|
||||
import Loading from '../../../../../components/layout/shared/Loading'
|
||||
import { useProductsQuery } from '../../../../../services/queries/products'
|
||||
import { useProducts } from '../../../../../services/queries/products'
|
||||
import { Product } from '../../../../../types/services/product'
|
||||
import ConfirmDeleteDialog from '../../../../../components/dialogs/confirm-delete'
|
||||
import { useProductsMutation } from '../../../../../services/mutations/products'
|
||||
@ -117,12 +117,12 @@ const ProductListTable = () => {
|
||||
const { lang: locale } = useParams()
|
||||
|
||||
// Fetch products with pagination and search
|
||||
const { data, isLoading, error, isFetching } = useProductsQuery.getProducts({
|
||||
const { data, isLoading, error, isFetching } = useProducts({
|
||||
page: currentPage,
|
||||
limit: pageSize
|
||||
})
|
||||
|
||||
const { mutate: deleteProduct, isPending: isDeleting } = useProductsMutation.deleteProduct()
|
||||
const { mutate: deleteProduct, isPending: isDeleting } = useProductsMutation().deleteProduct
|
||||
|
||||
const products = data?.products ?? []
|
||||
const totalCount = data?.total_count ?? 0
|
||||
|
||||
@ -18,7 +18,7 @@ import CustomTextField from '@core/components/mui/TextField'
|
||||
import { Autocomplete, CircularProgress } from '@mui/material'
|
||||
import { useDebounce } from 'use-debounce'
|
||||
import { useUnitsMutation } from '../../../../../services/mutations/units'
|
||||
import { useOutletsQuery } from '../../../../../services/queries/outlets'
|
||||
import { useOutlets } from '../../../../../services/queries/outlets'
|
||||
import { UnitRequest } from '../../../../../types/services/unit'
|
||||
|
||||
type Props = {
|
||||
@ -41,10 +41,10 @@ const AddUnitDrawer = (props: Props) => {
|
||||
const [outletInput, setOutletInput] = useState('')
|
||||
const [outletDebouncedInput] = useDebounce(outletInput, 500)
|
||||
|
||||
const { data: outlets, isLoading: outletsLoading } = useOutletsQuery.getOutlets({
|
||||
const { data: outlets, isLoading: outletsLoading } = useOutlets({
|
||||
search: outletDebouncedInput
|
||||
})
|
||||
const { mutate: createUnit, isPending: isCreating } = useUnitsMutation.createUnit()
|
||||
const { mutate: createUnit, isPending: isCreating } = useUnitsMutation().createUnit
|
||||
|
||||
const outletOptions = useMemo(() => outlets?.outlets || [], [outlets])
|
||||
|
||||
|
||||
@ -15,11 +15,11 @@ import Typography from '@mui/material/Typography'
|
||||
|
||||
// Components Imports
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import { useUnitsMutation } from '../../../../../services/mutations/units'
|
||||
import { Unit, UnitRequest } from '../../../../../types/services/unit'
|
||||
import { Autocomplete, CircularProgress } from '@mui/material'
|
||||
import { useOutletsQuery } from '../../../../../services/queries/outlets'
|
||||
import { useDebounce } from 'use-debounce'
|
||||
import { useUnitsMutation } from '../../../../../services/mutations/units'
|
||||
import { useOutlets } from '../../../../../services/queries/outlets'
|
||||
import { Unit, UnitRequest } from '../../../../../types/services/unit'
|
||||
|
||||
type Props = {
|
||||
open: boolean
|
||||
@ -42,11 +42,11 @@ const EditUnitDrawer = (props: Props) => {
|
||||
const [outletInput, setOutletInput] = useState('')
|
||||
const [outletDebouncedInput] = useDebounce(outletInput, 500)
|
||||
|
||||
const { data: outlets, isLoading: outletsLoading } = useOutletsQuery.getOutlets({
|
||||
const { data: outlets, isLoading: outletsLoading } = useOutlets({
|
||||
search: outletDebouncedInput
|
||||
})
|
||||
|
||||
const { mutate: updateUnit, isPending: isCreating } = useUnitsMutation.updateUnit()
|
||||
const { mutate: updateUnit, isPending: isCreating } = useUnitsMutation().updateUnit
|
||||
const outletOptions = useMemo(() => outlets?.outlets || [], [outlets])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -31,7 +31,7 @@ import { Box, CircularProgress } from '@mui/material'
|
||||
import ConfirmDeleteDialog from '../../../../../components/dialogs/confirm-delete'
|
||||
import Loading from '../../../../../components/layout/shared/Loading'
|
||||
import { useUnitsMutation } from '../../../../../services/mutations/units'
|
||||
import { useUnitsQuery } from '../../../../../services/queries/units'
|
||||
import { useUnits } from '../../../../../services/queries/units'
|
||||
import { Unit } from '../../../../../types/services/unit'
|
||||
import AddUnitDrawer from './AddUnitDrawer'
|
||||
import EditUnitDrawer from './EditUnitDrawer'
|
||||
@ -106,12 +106,12 @@ const ProductUnitTable = () => {
|
||||
const [currentUnit, setCurrentUnit] = useState<Unit>()
|
||||
|
||||
// Fetch products with pagination and search
|
||||
const { data, isLoading, error, isFetching } = useUnitsQuery.getUnits({
|
||||
const { data, isLoading, error, isFetching } = useUnits({
|
||||
page: currentPage,
|
||||
limit: pageSize
|
||||
})
|
||||
|
||||
const { mutate: deleteUnit, isPending: isDeleting } = useUnitsMutation.deleteUnit()
|
||||
const { mutate: deleteUnit, isPending: isDeleting } = useUnitsMutation().deleteUnit
|
||||
|
||||
const units = data?.data ?? []
|
||||
const totalCount = data?.pagination.total_count ?? 0
|
||||
@ -370,11 +370,7 @@ const ProductUnitTable = () => {
|
||||
|
||||
<AddUnitDrawer open={addUnitOpen} handleClose={() => setAddUnitOpen(!addUnitOpen)} />
|
||||
|
||||
<EditUnitDrawer
|
||||
open={editUnitOpen}
|
||||
handleClose={() => setEditUnitOpen(!editUnitOpen)}
|
||||
data={currentUnit!}
|
||||
/>
|
||||
<EditUnitDrawer open={editUnitOpen} handleClose={() => setEditUnitOpen(!editUnitOpen)} data={currentUnit!} />
|
||||
|
||||
<ConfirmDeleteDialog
|
||||
open={openConfirm}
|
||||
|
||||
@ -8,41 +8,39 @@ import Link from 'next/link'
|
||||
import { useParams } from 'next/navigation'
|
||||
|
||||
// MUI Imports
|
||||
import Button from '@mui/material/Button'
|
||||
import Card from '@mui/material/Card'
|
||||
import CardContent from '@mui/material/CardContent'
|
||||
import Button from '@mui/material/Button'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import Chip from '@mui/material/Chip'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ReferralsType } from '@/types/apps/ecommerceTypes'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Component Imports
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
|
||||
// Util Imports
|
||||
import { getLocalizedUrl } from '@/utils/i18n'
|
||||
@ -263,7 +261,7 @@ const ReferredUsersTable = ({ referralsData }: { referralsData?: ReferralsType[]
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getExpandedRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -271,7 +269,7 @@ const ReferredUsersTable = ({ referralsData }: { referralsData?: ReferralsType[]
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
</>
|
||||
)
|
||||
|
||||
@ -1,53 +1,51 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useState, useEffect, useMemo } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// Next Imports
|
||||
import Link from 'next/link'
|
||||
import { useParams } from 'next/navigation'
|
||||
|
||||
// MUI Imports
|
||||
import Button from '@mui/material/Button'
|
||||
import Card from '@mui/material/Card'
|
||||
import CardContent from '@mui/material/CardContent'
|
||||
import Button from '@mui/material/Button'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import Chip from '@mui/material/Chip'
|
||||
import IconButton from '@mui/material/IconButton'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import Tooltip from '@mui/material/Tooltip'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Tooltip from '@mui/material/Tooltip'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { InvoiceType } from '@/types/apps/invoiceTypes'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Component Imports
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
|
||||
// Util Imports
|
||||
import { getInitials } from '@/utils/getInitials'
|
||||
@ -446,7 +444,7 @@ const InvoiceListTable = ({ invoiceData }: { invoiceData?: InvoiceType[] }) => {
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -455,7 +453,7 @@ const InvoiceListTable = ({ invoiceData }: { invoiceData?: InvoiceType[] }) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
onRowsPerPageChange={e => table.setPageSize(Number(e.target.value))}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useState, useMemo } from 'react'
|
||||
import { useMemo, useState } from 'react'
|
||||
|
||||
// Next Imports
|
||||
import Link from 'next/link'
|
||||
@ -11,37 +11,35 @@ import { useParams } from 'next/navigation'
|
||||
import Card from '@mui/material/Card'
|
||||
import CardHeader from '@mui/material/CardHeader'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import LinearProgress from '@mui/material/LinearProgress'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import Chip from '@mui/material/Chip'
|
||||
import LinearProgress from '@mui/material/LinearProgress'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { Vehicle } from '@/types/apps/logisticsTypes'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Components Imports
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
|
||||
// Util Imports
|
||||
import { getLocalizedUrl } from '@/utils/i18n'
|
||||
@ -258,7 +256,7 @@ const LogisticsOverviewTable = ({ vehicleData }: { vehicleData?: Vehicle[] }) =>
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table as any} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -266,7 +264,7 @@ const LogisticsOverviewTable = ({ vehicleData }: { vehicleData?: Vehicle[] }) =>
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,47 +1,45 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useEffect, useState, useMemo } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// MUI Imports
|
||||
import type { ButtonProps } from '@mui/material/Button'
|
||||
import Button from '@mui/material/Button'
|
||||
import Card from '@mui/material/Card'
|
||||
import CardContent from '@mui/material/CardContent'
|
||||
import Button from '@mui/material/Button'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import Chip from '@mui/material/Chip'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import IconButton from '@mui/material/IconButton'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import type { ButtonProps } from '@mui/material/Button'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { PermissionRowType } from '@/types/apps/permissionTypes'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Component Imports
|
||||
import PermissionDialog from '@components/dialogs/permission-dialog'
|
||||
import OpenDialogOnElementClick from '@components/dialogs/OpenDialogOnElementClick'
|
||||
import PermissionDialog from '@components/dialogs/permission-dialog'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
|
||||
// Style Imports
|
||||
import tableStyles from '@core/styles/table.module.css'
|
||||
@ -314,7 +312,7 @@ const Permissions = ({ permissionsData }: { permissionsData?: PermissionRowType[
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -322,7 +320,7 @@ const Permissions = ({ permissionsData }: { permissionsData?: PermissionRowType[
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
<PermissionDialog open={open} setOpen={setOpen} data={editValue} />
|
||||
</>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useState, useMemo, useEffect } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// Next Imports
|
||||
import Link from 'next/link'
|
||||
@ -10,43 +10,41 @@ import { useParams } from 'next/navigation'
|
||||
// MUI Imports
|
||||
import Card from '@mui/material/Card'
|
||||
import CardContent from '@mui/material/CardContent'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import Chip from '@mui/material/Chip'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import Chip from '@mui/material/Chip'
|
||||
import IconButton from '@mui/material/IconButton'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import { styled } from '@mui/material/styles'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { UsersType } from '@/types/apps/userTypes'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Component Imports
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
|
||||
// Util Imports
|
||||
import { getInitials } from '@/utils/getInitials'
|
||||
@ -415,7 +413,7 @@ const RolesTable = ({ tableData }: { tableData?: UsersType[] }) => {
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -423,7 +421,7 @@ const RolesTable = ({ tableData }: { tableData?: UsersType[] }) => {
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -17,8 +17,8 @@ import CustomTextField from '@core/components/mui/TextField'
|
||||
import { Autocomplete, CircularProgress } from '@mui/material'
|
||||
import { useDebounce } from 'use-debounce'
|
||||
import { useInventoriesMutation } from '../../../../services/mutations/inventories'
|
||||
import { useOutletsQuery } from '../../../../services/queries/outlets'
|
||||
import { useProductsQuery } from '../../../../services/queries/products'
|
||||
import { useOutlets } from '../../../../services/queries/outlets'
|
||||
import { useProducts } from '../../../../services/queries/products'
|
||||
import { InventoryAdjustRequest } from '../../../../types/services/inventory'
|
||||
|
||||
type Props = {
|
||||
@ -30,7 +30,7 @@ const AdjustmentStockDrawer = (props: Props) => {
|
||||
// Props
|
||||
const { open, handleClose } = props
|
||||
|
||||
const { mutate: adjustInventory, isPending: isCreating } = useInventoriesMutation.adjustInventory()
|
||||
const { mutate: adjustInventory, isPending: isCreating } = useInventoriesMutation().adjustInventory
|
||||
|
||||
// States
|
||||
const [productInput, setProductInput] = useState('')
|
||||
@ -44,10 +44,10 @@ const AdjustmentStockDrawer = (props: Props) => {
|
||||
reason: ''
|
||||
})
|
||||
|
||||
const { data: outlets, isLoading: outletsLoading } = useOutletsQuery.getOutlets({
|
||||
const { data: outlets, isLoading: outletsLoading } = useOutlets({
|
||||
search: outletDebouncedInput
|
||||
})
|
||||
const { data: products, isLoading } = useProductsQuery.getProducts({
|
||||
const { data: products, isLoading } = useProducts({
|
||||
search: productDebouncedInput
|
||||
})
|
||||
|
||||
|
||||
@ -36,8 +36,7 @@ import CustomTextField from '@core/components/mui/TextField'
|
||||
import tableStyles from '@core/styles/table.module.css'
|
||||
import { Box, CircularProgress } from '@mui/material'
|
||||
import Loading from '../../../../components/layout/shared/Loading'
|
||||
import { useInventoriesMutation } from '../../../../services/mutations/inventories'
|
||||
import { useInventoriesQuery } from '../../../../services/queries/inventories'
|
||||
import { useInventories } from '../../../../services/queries/inventories'
|
||||
import { Inventory } from '../../../../types/services/inventory'
|
||||
import AdjustmentStockDrawer from './AdjustmentStockDrawer'
|
||||
|
||||
@ -106,13 +105,11 @@ const StockListTable = () => {
|
||||
const [addInventoryOpen, setAddInventoryOpen] = useState(false)
|
||||
|
||||
// Fetch products with pagination and search
|
||||
const { data, isLoading, error, isFetching } = useInventoriesQuery.getInventories({
|
||||
const { data, isLoading, error, isFetching } = useInventories({
|
||||
page: currentPage,
|
||||
limit: pageSize
|
||||
})
|
||||
|
||||
const { mutate: deleteInventory, isPending: isDeleting } = useInventoriesMutation.deleteInventory()
|
||||
|
||||
const inventories = data?.inventory ?? []
|
||||
const totalCount = data?.total_count ?? 0
|
||||
|
||||
@ -173,7 +170,7 @@ const StockListTable = () => {
|
||||
size='small'
|
||||
/>
|
||||
)
|
||||
}),
|
||||
})
|
||||
// columnHelper.accessor('actions', {
|
||||
// header: 'Actions',
|
||||
// cell: ({ row }) => (
|
||||
|
||||
@ -17,8 +17,8 @@ import CustomTextField from '@core/components/mui/TextField'
|
||||
import { Autocomplete, CircularProgress } from '@mui/material'
|
||||
import { useDebounce } from 'use-debounce'
|
||||
import { useInventoriesMutation } from '../../../../services/mutations/inventories'
|
||||
import { useOutletsQuery } from '../../../../services/queries/outlets'
|
||||
import { useProductsQuery } from '../../../../services/queries/products'
|
||||
import { useOutlets } from '../../../../services/queries/outlets'
|
||||
import { useProducts } from '../../../../services/queries/products'
|
||||
import { InventoryRequest } from '../../../../types/services/inventory'
|
||||
|
||||
type Props = {
|
||||
@ -30,7 +30,7 @@ const AddStockDrawer = (props: Props) => {
|
||||
// Props
|
||||
const { open, handleClose } = props
|
||||
|
||||
const { mutate: createInventory, isPending: isCreating } = useInventoriesMutation.createInventory()
|
||||
const { mutate: createInventory, isPending: isCreating } = useInventoriesMutation().createInventory
|
||||
|
||||
// States
|
||||
const [productInput, setProductInput] = useState('')
|
||||
@ -43,10 +43,10 @@ const AddStockDrawer = (props: Props) => {
|
||||
quantity: 0
|
||||
})
|
||||
|
||||
const { data: outlets, isLoading: outletsLoading } = useOutletsQuery.getOutlets({
|
||||
const { data: outlets, isLoading: outletsLoading } = useOutlets({
|
||||
search: outletDebouncedInput
|
||||
})
|
||||
const { data: products, isLoading } = useProductsQuery.getProducts({
|
||||
const { data: products, isLoading } = useProducts({
|
||||
search: productDebouncedInput
|
||||
})
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// Next Imports
|
||||
import { useParams } from 'next/navigation'
|
||||
|
||||
// MUI Imports
|
||||
import Button from '@mui/material/Button'
|
||||
@ -40,7 +39,7 @@ import { Box, CircularProgress } from '@mui/material'
|
||||
import ConfirmDeleteDialog from '../../../../components/dialogs/confirm-delete'
|
||||
import Loading from '../../../../components/layout/shared/Loading'
|
||||
import { useInventoriesMutation } from '../../../../services/mutations/inventories'
|
||||
import { useInventoriesQuery } from '../../../../services/queries/inventories'
|
||||
import { useInventories } from '../../../../services/queries/inventories'
|
||||
import { Inventory } from '../../../../types/services/inventory'
|
||||
import AddStockDrawer from './AddStockDrawer'
|
||||
|
||||
@ -111,12 +110,12 @@ const StockListTable = () => {
|
||||
const [addInventoryOpen, setAddInventoryOpen] = useState(false)
|
||||
|
||||
// Fetch products with pagination and search
|
||||
const { data, isLoading, error, isFetching } = useInventoriesQuery.getInventories({
|
||||
const { data, isLoading, error, isFetching } = useInventories({
|
||||
page: currentPage,
|
||||
limit: pageSize
|
||||
})
|
||||
|
||||
const { mutate: deleteInventory, isPending: isDeleting } = useInventoriesMutation.deleteInventory()
|
||||
const { mutate: deleteInventory, isPending: isDeleting } = useInventoriesMutation().deleteInventory
|
||||
|
||||
const inventories = data?.inventory ?? []
|
||||
const totalCount = data?.total_count ?? 0
|
||||
|
||||
@ -1,55 +1,53 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useEffect, useState, useMemo } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// Next Imports
|
||||
import Link from 'next/link'
|
||||
import { useParams } from 'next/navigation'
|
||||
|
||||
// MUI Imports
|
||||
import Button from '@mui/material/Button'
|
||||
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 Chip from '@mui/material/Chip'
|
||||
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'
|
||||
import { styled } from '@mui/material/styles'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { UsersType } from '@/types/apps/userTypes'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Component Imports
|
||||
import TableFilters from './TableFilters'
|
||||
import AddUserDrawer from './AddUserDrawer'
|
||||
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'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import AddUserDrawer from './AddUserDrawer'
|
||||
import TableFilters from './TableFilters'
|
||||
|
||||
// Util Imports
|
||||
import { getInitials } from '@/utils/getInitials'
|
||||
@ -403,7 +401,7 @@ const UserListTable = ({ tableData }: { tableData?: UsersType[] }) => {
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -411,7 +409,7 @@ const UserListTable = ({ tableData }: { tableData?: UsersType[] }) => {
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
<AddUserDrawer
|
||||
open={addUserOpen}
|
||||
|
||||
@ -339,7 +339,7 @@ const InvoiceListTable = ({ invoiceData }: { invoiceData?: InvoiceType[] }) => {
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -347,7 +347,7 @@ const InvoiceListTable = ({ invoiceData }: { invoiceData?: InvoiceType[] }) => {
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,34 +1,33 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useState, useMemo, useEffect } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// MUI Imports
|
||||
import Typography from '@mui/material/Typography'
|
||||
import LinearProgress from '@mui/material/LinearProgress'
|
||||
import Card from '@mui/material/Card'
|
||||
import CardHeader from '@mui/material/CardHeader'
|
||||
import LinearProgress from '@mui/material/LinearProgress'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
@ -36,7 +35,6 @@ import type { ThemeColor } from '@core/types'
|
||||
// Component Imports
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
|
||||
// Style Imports
|
||||
import tableStyles from '@core/styles/table.module.css'
|
||||
@ -338,7 +336,7 @@ const ProjectListTable = () => {
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -346,7 +344,7 @@ const ProjectListTable = () => {
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -5,40 +5,38 @@ import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// MUI Imports
|
||||
import AvatarGroup from '@mui/material/AvatarGroup'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import LinearProgress from '@mui/material/LinearProgress'
|
||||
import Card from '@mui/material/Card'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import CardHeader from '@mui/material/CardHeader'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import LinearProgress from '@mui/material/LinearProgress'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ProjectTableRowType } from '@/types/pages/profileTypes'
|
||||
|
||||
// Component Imports
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import TablePaginationComponent from '@/components/TablePaginationComponent'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
|
||||
// Style Imports
|
||||
import tableStyles from '@core/styles/table.module.css'
|
||||
@ -273,7 +271,7 @@ const ProjectTables = ({ projectTable }: { projectTable?: ProjectTableRowType[]
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
rowsPerPageOptions={[5, 7, 10]}
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
@ -282,7 +280,7 @@ const ProjectTables = ({ projectTable }: { projectTable?: ProjectTableRowType[]
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,53 +1,51 @@
|
||||
'use client'
|
||||
|
||||
// React Imports
|
||||
import { useState, useEffect, useMemo } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// Next Imports
|
||||
import Link from 'next/link'
|
||||
import { useParams } from 'next/navigation'
|
||||
|
||||
// MUI Imports
|
||||
import Button from '@mui/material/Button'
|
||||
import Card from '@mui/material/Card'
|
||||
import CardContent from '@mui/material/CardContent'
|
||||
import Button from '@mui/material/Button'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import Chip from '@mui/material/Chip'
|
||||
import IconButton from '@mui/material/IconButton'
|
||||
import MenuItem from '@mui/material/MenuItem'
|
||||
import Tooltip from '@mui/material/Tooltip'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Tooltip from '@mui/material/Tooltip'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ThemeColor } from '@core/types'
|
||||
import type { InvoiceType } from '@/types/apps/invoiceTypes'
|
||||
import type { Locale } from '@configs/i18n'
|
||||
import type { ThemeColor } from '@core/types'
|
||||
|
||||
// Component Imports
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
|
||||
// Util Imports
|
||||
import { getInitials } from '@/utils/getInitials'
|
||||
@ -446,7 +444,7 @@ const InvoiceListTable = ({ invoiceData }: { invoiceData?: InvoiceType[] }) => {
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -455,7 +453,7 @@ const InvoiceListTable = ({ invoiceData }: { invoiceData?: InvoiceType[] }) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
onRowsPerPageChange={e => table.setPageSize(Number(e.target.value))}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -5,40 +5,38 @@ import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
// MUI Imports
|
||||
import AvatarGroup from '@mui/material/AvatarGroup'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import LinearProgress from '@mui/material/LinearProgress'
|
||||
import Card from '@mui/material/Card'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import CardHeader from '@mui/material/CardHeader'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import Checkbox from '@mui/material/Checkbox'
|
||||
import LinearProgress from '@mui/material/LinearProgress'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
import Typography from '@mui/material/Typography'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import {
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
useReactTable,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel
|
||||
getSortedRowModel,
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import type { ColumnDef, FilterFn } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { ProjectTableRowType } from '@/types/pages/profileTypes'
|
||||
|
||||
// Component Imports
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
import CustomAvatar from '@core/components/mui/Avatar'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
import TablePaginationComponent from '@/components/TablePaginationComponent'
|
||||
import OptionMenu from '@core/components/option-menu'
|
||||
|
||||
// Style Imports
|
||||
import tableStyles from '@core/styles/table.module.css'
|
||||
@ -274,7 +272,7 @@ const ProjectTables = ({ projectTable }: { projectTable?: ProjectTableRowType[]
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -283,7 +281,7 @@ const ProjectTables = ({ projectTable }: { projectTable?: ProjectTableRowType[]
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
onRowsPerPageChange={e => table.setPageSize(Number(e.target.value))}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
@ -6,32 +6,30 @@ import { useEffect, useMemo, useState } from 'react'
|
||||
// MUI Imports
|
||||
import Card from '@mui/material/Card'
|
||||
import CardHeader from '@mui/material/CardHeader'
|
||||
import TablePagination from '@mui/material/TablePagination'
|
||||
import type { TextFieldProps } from '@mui/material/TextField'
|
||||
|
||||
// Third-party Imports
|
||||
import classnames from 'classnames'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { Column, ColumnDef, ColumnFiltersState, FilterFn, Table } from '@tanstack/react-table'
|
||||
import {
|
||||
useReactTable,
|
||||
createColumnHelper,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
getFilteredRowModel,
|
||||
getFacetedMinMaxValues,
|
||||
getFacetedRowModel,
|
||||
getFacetedUniqueValues,
|
||||
getFacetedMinMaxValues,
|
||||
getFilteredRowModel,
|
||||
getPaginationRowModel,
|
||||
getSortedRowModel,
|
||||
flexRender,
|
||||
createColumnHelper
|
||||
useReactTable
|
||||
} from '@tanstack/react-table'
|
||||
import { rankItem } from '@tanstack/match-sorter-utils'
|
||||
import type { Column, Table, ColumnFiltersState, FilterFn, ColumnDef } from '@tanstack/react-table'
|
||||
import type { RankingInfo } from '@tanstack/match-sorter-utils'
|
||||
import classnames from 'classnames'
|
||||
|
||||
// Type Imports
|
||||
import type { DataType } from './data'
|
||||
|
||||
// Component Imports
|
||||
import TablePaginationComponent from '@components/TablePaginationComponent'
|
||||
import CustomTextField from '@core/components/mui/TextField'
|
||||
|
||||
// Icon Imports
|
||||
@ -267,7 +265,7 @@ const KitchenSink = () => {
|
||||
)}
|
||||
</table>
|
||||
</div>
|
||||
<TablePagination
|
||||
{/* <TablePagination
|
||||
component={() => <TablePaginationComponent table={table} />}
|
||||
count={table.getFilteredRowModel().rows.length}
|
||||
rowsPerPage={table.getState().pagination.pageSize}
|
||||
@ -275,7 +273,7 @@ const KitchenSink = () => {
|
||||
onPageChange={(_, page) => {
|
||||
table.setPageIndex(page)
|
||||
}}
|
||||
/>
|
||||
/> */}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user