Compare commits

..

12 Commits

Author SHA1 Message Date
victorAnumudu b31650e5f7 box dark mode bg added 2025-10-07 19:37:38 +01:00
victorAnumudu e508e7cffa added product view endpoint 2025-10-07 18:36:17 +01:00
ameye 79ff004077 Merge branch 'table-reload' of MERMS/MermsFirstOffice into master 2025-10-07 14:38:12 +00:00
victorAnumudu 175e6b5434 reloads table after status update 2025-10-07 15:36:19 +01:00
ameye 9b3cb2a75a Merge branch 'country-checkbox' of MERMS/MermsFirstOffice into master 2025-10-07 09:50:09 +00:00
victorAnumudu b142833901 set country endpoint added 2025-10-07 08:46:52 +01:00
CHIEFSOFT\ameye 10a6023ceb procuct edit page 2025-10-06 18:42:40 -04:00
CHIEFSOFT\ameye d37026c868 product View 2025-10-06 18:31:33 -04:00
CHIEFSOFT\ameye bd4cdb1ae9 Reformat cod e 2025-10-06 16:29:54 -04:00
CHIEFSOFT\ameye f86e5abd3d Edit product Start 2025-10-06 16:26:39 -04:00
victorAnumudu 50551f1c7d Checkbox added 2025-10-06 21:21:05 +01:00
ameye a87a0a58db Merge branch 'country-endpoint-fix' of MERMS/MermsFirstOffice into master 2025-10-06 19:25:22 +00:00
9 changed files with 506 additions and 101 deletions
+1
View File
@@ -11,6 +11,7 @@ const RouteLinks = {
transactionsPage: '/transactions',
countrySettings: '/country',
products: '/products',
productView: '/product-view/*',
usersAdmin: '/users-admin',
productTemplates: '/products-template',
customTemplates: '/custom-template',
+3 -1
View File
@@ -21,7 +21,8 @@ import AccountDetailsPage from "./pages/AccountDetailsPage";
import ProductTemplatePage from "./pages/ProductTemplatePage";
import CustomTemplatePage from "./pages/CustomTemplatePage";
import SubscriptionDetailsPage from "./pages/SubscriptionDetailsPage";
import CountrySettingsPage from "./pages/CountrySettingsPage"; // TRANSACTION DETAILS PAGE
import CountrySettingsPage from "./pages/CountrySettingsPage";
import ProductViewPage from "./pages/ProductViewPage"; // TRANSACTION DETAILS PAGE
// const Home = lazy(() => import('./pages/Home'));
@@ -39,6 +40,7 @@ export default function SiteRoutes() {
<Route path={RouteLinks.accountDetails} element={<AccountDetailsPage/>}/> {`*/CUSTOMER PAGE*/`}
<Route path={RouteLinks.billings} element={<BillingsPage/>}/> {`*/BILLINGS PAGE*/`}
<Route path={RouteLinks.products} element={<ProductsPage/>}/> {`*/PRODUCTS PAGE*/`}
<Route path={RouteLinks.productView} element={<ProductViewPage/>}/> {`*/PRODUCTS VIEW PAGE*/`}
<Route path={RouteLinks.usersAdmin} element={<UsersAdminPage/>}/> {`*/ADMIN USERS PAGE*/`}
<Route path={RouteLinks.countrySettings} element={<CountrySettingsPage/>}/> {`*/PRODUCTS TEMPLATE PAGE*/`}
+94 -12
View File
@@ -1,13 +1,17 @@
import { useState } from "react";
import { useQuery } from '@tanstack/react-query'
import { useEffect, useState } from "react";
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query'
import queryKeys from '../../services/queryKeys'
import BreadcrumbCom from "../breadcrumb/BreadcrumbCom";
import { getCountry } from "../../services/siteServices";
import { getCountry, setCountry } from "../../services/siteServices";
import TableWrapper from "../tableWrapper/TableWrapper";
export default function CountrySettings(){
const {data, isFetching, isError, error} = useQuery({
const [selected, setSelected] = useState('')
const queryClient = useQueryClient()
const {data, isFetching, status, isError, error} = useQuery({
queryKey: queryKeys.country_list,
queryFn: () => {
const reqData = {
@@ -16,18 +20,52 @@ export default function CountrySettings(){
}
return getCountry(reqData)
},
staleTime: 0 //0 mins
// placeholderData: (previousData, previousQuery) => previousData,
staleTime: 0 // 0 mins
})
const countryData = data?.data?.country_data // COUNTRY LIST
const statusChange = useMutation({
mutationFn: (fields) => {
return setCountry(fields)
},
onError: (error) => {
},
onSuccess: (res) => {
queryClient.refetchQueries({
queryKey: [...queryKeys.country_list],
// type: 'active',
// exact: true,
})
},
onSettled: () => {
setSelected('')
}
})
//FUNCTION TO CHANGE STATUS OR SIGNUP
const handleStatusChange = (event, details) => {
setSelected(event.target.id)
const name = event.target.name
const val = name.toLowerCase() == 'STATUS' ? details.status : details.signup
const reqData = {
'val_type': name.toUpperCase(),
'country_uid': details?.country_uid,
'code': details?.code,
'val': val == 0 ? 1 : 0
}
statusChange.mutate(reqData)
};
return (
<div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title='Country Settings' paths={['Dashboard', 'Country']} />
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
<div className='relative box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
<>
{/* status === 'pending' */}
{isFetching ?
<p className='text-slate-800'>Loading...</p>
: isError ?
@@ -45,10 +83,10 @@ export default function CountrySettings(){
<th scope="col" className="px-8">
Country
</th>
<th scope="col" className="px-2 text-right">
<th scope="col" className="px-2 text-center">
Status
</th>
<th scope="col" className="px-2 text-right">
<th scope="col" className="px-2 text-center">
Signup
</th>
</tr>
@@ -67,13 +105,52 @@ export default function CountrySettings(){
</div>
</td>
<td className="px-8">
<div className="text-right">
<div className="text-base font-semibold">{item?.status}</div>
<div className="flex justify-center">
<>
{selected == 'status' + index ?
<div role="status" className="text-center">
<svg aria-hidden="true" className="w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-primary" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
<span className="sr-only">Loading...</span>
</div>
:
<input
className="w-4 h-4 cursor-pointer text-primary bg-gray-100 border-gray-300 rounded-sm focus:ring-primary/80 dark:focus:ring-primary dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
onChange={(e)=>handleStatusChange(e, item)}
type="checkbox"
checked={item?.status}
name="status"
id={'status' + index}
/>
}
</>
</div>
</td>
<td className="px-8">
<div className="text-right">
<div className="text-base font-semibold">{item?.signup}</div>
<div className="flex justify-center">
<>
{selected == `signup${index}`
?
<div role="status" className="text-center">
<svg aria-hidden="true" className="w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-primary" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
<span className="sr-only">Loading...</span>
</div>
:
<input
className="w-4 h-4 cursor-pointer text-primary bg-gray-100 border-gray-300 rounded-sm focus:ring-primary/80 dark:focus:ring-primary dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
onChange={(e)=>handleStatusChange(e, item)}
type="checkbox"
checked={item?.signup}
name="signup"
id={'signup' + index }
/>
}
</>
</div>
</td>
</tr>
@@ -93,6 +170,11 @@ export default function CountrySettings(){
)}
</TableWrapper>
}
{/* {(isFetching && status != 'pending') &&
<div className="w-full absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[991] inset-0 flex justify-center items-center">
<p className="rounded-md shadow-md p-4 bg-white/90 dark:bg-gray-900 text-brown dark:text-white">Loading...</p>
</div>
} */}
</>
</div>
+110
View File
@@ -0,0 +1,110 @@
import {useMutation, useQueryClient} from '@tanstack/react-query'
import {Formik, Form} from 'formik'
import * as Yup from "yup";
import InputText from '../InputText'
import {addCustomTemplate} from '../../services/siteServices'
import queryKeys from '../../services/queryKeys';
const initialValues = {
custom_id: "",
provision_name: "",
};
// To get the validation schema
const validationSchema = Yup.object().shape({
custom_id: Yup.string().required("custom_id is required").min(6, 'must be upto 6 characters').max(25, 'must not exceed 25 characters'),
provision_name: Yup.string().required("provision_name is required").min(6, 'must be upto 6 characters').max(200, 'must not exceed 200 characters'),
});
export default function ProductDetails() {
const queryClient = useQueryClient()
const customTemplate = useMutation({
mutationFn: (fields) => {
if (!fields.custom_id || !fields.provision_name) {
throw new Error('Please provide all fields marked *')
}
return addCustomTemplate(fields)
},
onSuccess: () => {
queryClient.refetchQueries({
queryKey: [...queryKeys.custom_template],
// type: 'active',
// exact: true,
})
},
})
//FUNCTION TO HANDLE ADD TEMPLATE
const handleSubmit = (values, helper) => {
// customTemplate.mutate(values)
};
return (
<Formik
initialValues={initialValues}
validationSchema={validationSchema}
onSubmit={handleSubmit}
>
{(props) => (
<Form>
<div
className='flex flex-col w-full bg-white dark:bg-black-box text-black-body dark:text-white-body rounded-xl p-16 sm:px-20 sm:py-16 shadow'>
<div className='w-full flex flex-col gap-4'>
<div className='relative text-input flex flex-col sm:flex-row gap-2 sm:items-center'>
<label className={`text-base min-w-36 text-end sm:text-left ${(props.errors.custom_id && props.touched.custom_id) && 'text-red-500'}`}>
Details
</label>
<textarea
className='p-4 w-full resize-none border outline-none ring-0 dark:bg-transparent dark:border-white-light'
rows={4}
id='custom_id'
placeholder='Enter your description text here ...'
name='custom_id'
value={props.values.custom_id}
handleChange={props.handleChange}
/>
</div>
<div className='relative text-input flex flex-col sm:flex-row gap-2 sm:items-center'>
<label className={`text-base min-w-36 text-end sm:text-left ${(props.errors.provision_name && props.touched.provision_name) && 'text-red-500'}`}>
Sales Text
</label>
<textarea
className='p-4 w-full resize-none border outline-none ring-0 dark:bg-transparent dark:border-white-light'
rows={4}
id='provision_name'
placeholder='Enter your description text here ...'
name='provision_name'
value={props.values.provision_name}
handleChange={props.handleChange}
/>
</div>
<div className='h-10 my-5 text-end'>
<button type='submit' disabled={customTemplate.isPending}
className='px-4 h-full bg-primary text-white font-bold rounded-md'>{customTemplate.isPending ? 'loading...' : 'Update'}</button>
</div>
{customTemplate.error &&
<>
<div className="w-full text-center">
<p className='text-red-500 text-sm'>{customTemplate.error.message}</p>
</div>
</>
}
{customTemplate.isSuccess &&
<>
<div className="w-full text-center">
<p className='text-emerald-500 text-sm'>{'Template Added'}</p>
</div>
</>
}
</div>
</div>
</Form>
)}
</Formik>
)
}
+162
View File
@@ -0,0 +1,162 @@
import {useEffect, useState} from 'react';
import {useLocation, useNavigate} from 'react-router-dom'
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query'
import queryKeys from '../../services/queryKeys'
import { getProductView } from "../../services/siteServices";
import ProductDetails from './ProductDetails';
export default function ProductView() {
const {state} = useLocation()
const navigate = useNavigate()
useEffect(() => {
if (!state?.productID) {
navigate(RouteLinks.homePage, {replace: true})
}
}, [])
const {data, isFetching, status, isError, error} = useQuery({
queryKey: queryKeys.product_view,
queryFn: () => {
const reqData = {
// page,
// ...filterData
product_id : state?.productID
}
return getProductView(reqData)
},
staleTime: 0 // 0 mins
})
const countryData = data?.data // PRODUCT VIEW LIST
console.log('DATA', countryData)
return (
<div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title={`Product View [${state?.productID}]`} paths={['Dashboard', 'Product View']}/>
<div className='flex flex-col gap-4'>
<div className='flex flex-col gap-2'>
<p className='text-lg dark:text-white-light'>Product Configuration</p>
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
<table className="py-2 w-full text-sm">
<thead className="py-2 text-sm text-slate-500 text-left">
<tr>
<th scope="col" className="px-2 py-2" style={{width: '150px'}}>
Item
</th>
<th scope="col" className="px-2">
Value
</th>
</tr>
</thead>
<tbody>
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
<div className="text-left">
ProductID
</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
P000008
</div>
</td>
</tr>
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
<div className="text-left">
ProductID
</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
P000008
</div>
</td>
</tr>
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
<div className="text-left">
ProductID
</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
P000008
</div>
</td>
</tr>
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
<div className="text-left">
ProductID
</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
P000008
</div>
</td>
</tr>
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
<div className="text-left">
ProductID
</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
P000008
</div>
</td>
</tr>
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
<div className="text-left">
ProductID
</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
P000008
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div className='box bg-[aliceblue] dark:bg-black-box text-black-body dark:text-white-body'>
<div className='flex flex-col gap-2'>
<p className='text-lg'>Product Details</p>
<ProductDetails />
</div>
</div>
</div>
</div>
)
}
+113 -88
View File
@@ -1,11 +1,11 @@
import { useState } from 'react'
import { useQuery } from '@tanstack/react-query'
import {useState} from 'react'
import {useQuery} from '@tanstack/react-query'
import queryKeys from '../../services/queryKeys'
import {Link} from 'react-router-dom'
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
import Icons from '../Icons'
import { getProducts } from '../../services/siteServices'
import {getProducts} from '../../services/siteServices'
import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString'
// import formatNumber from '../../helpers/formatNumber'
// import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString';
@@ -19,18 +19,18 @@ export default function ProductsCom() {
const [filter, setFilter] = useState({type: '', id: ''})
const [willFilter, setWillFilter] = useState(false)
const handleFilter = ({target:{name, value}}) => {
setFilter(prev => ({...prev, [name]:value}))
const handleFilter = ({target: {name, value}}) => {
setFilter(prev => ({...prev, [name]: value}))
}
const handleFilterByParams = () => {
if(filter.type && !filter.id){
if (filter.type && !filter.id) {
return
}else if(!filter.type){
} else if (!filter.type) {
setPage(1)
setWillFilter(prev => !prev)
setFilter({type: '', id: ''})
}else{
} else {
setPage(1)
setWillFilter(prev => !prev)
}
@@ -54,91 +54,116 @@ export default function ProductsCom() {
return (
<div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title='Products' paths={['Dashboard', 'Products']} />
<BreadcrumbCom title='Products' paths={['Dashboard', 'Products']}/>
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
{ isError ?
{isError ?
<p className='text-red-500'>{error?.message}</p>
:
<>
{/* filter section */}
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'>
<Icons name='filter' className='text-3xl' />
<div className='w-full sm:max-w-48'>
<select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md' onChange={handleFilter}>
<option value=''>All</option>
<option value='name'>Name</option>
</select>
:
<>
{/* filter section */}
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'>
<Icons name='filter' className='text-3xl'/>
<div className='w-full sm:max-w-48'>
<select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md'
onChange={handleFilter}>
<option value=''>All</option>
<option value='name'>Name</option>
</select>
</div>
<div className='w-full sm:max-w-48'>
<input name='id' value={filter?.id} disabled={!filter.type}
className={`h-10 w-full p-2 rounded-md outline-none border border-black-aside ${!filter.type && 'opacity-30'}`}
onChange={handleFilter}/>
</div>
<button onClick={handleFilterByParams} disabled={filter.type && !filter.id}
className={`h-10 bg-primary px-2 py-1 rounded-md text-white font-medium sm:self-end ${(filter.type && !filter.id) && 'opacity-50'}`}>Submit
</button>
</div>
<div className='w-full sm:max-w-48'>
<input name='id' value={filter?.id} disabled={!filter.type} className={`h-10 w-full p-2 rounded-md outline-none border border-black-aside ${!filter.type && 'opacity-30'}`} onChange={handleFilter} />
</div>
<button onClick={handleFilterByParams} disabled={filter.type && !filter.id} className={`h-10 bg-primary px-2 py-1 rounded-md text-white font-medium sm:self-end ${(filter.type && !filter.id) && 'opacity-50'}`}>Submit</button>
</div>
{/* end of filter section */}
{/* end of filter section */}
<TablePaginatedWrapper data={productsData} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}>
{({ data }) => (
<>
<table className="py-2 w-full text-sm">
<thead className="py-2 text-sm text-slate-500 text-left">
<tr>
<th scope="col" className="px-2 py-2">
Added
</th>
<th scope="col" className="px-2">
Name
</th>
<th scope="col" className="px-2">
Product ID
</th>
<th scope="col" className="px-2 text-right">
Status
</th>
</tr>
</thead>
<tbody>
{(data && data.length > 0) ? data?.map((item, index) => (
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
<div className="text-left">
<div className="text-base font-semibold">{getDateTimeFromDateString(item?.added)}</div>
</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<div className="text-base font-semibold">{item?.name}</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<div className="text-base font-semibold">{item?.product_id}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div className="text-base font-semibold">{item?.status}</div>
</div>
</td>
<TablePaginatedWrapper data={productsData} isFetching={isFetching} setPage={setPage}
itemsPerPage={pagination?.limit} pagination={pagination}>
{({data}) => (
<>
<table className="py-2 w-full text-sm">
<thead className="py-2 text-sm text-slate-500 text-left">
<tr>
<th scope="col" className="px-2 py-2">
Added
</th>
<th scope="col" className="px-2">
Name
</th>
<th scope="col" className="px-2">
Product ID
</th>
<th scope="col" className="px-2 text-right">
Status
</th>
<th scope="col" className="px-2 text-right">
Action
</th>
</tr>
))
:
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-3 py-2" colSpan={4}>
<div className="flex justify-center items-center">
No Record Found
</div>
</td>
</tr>
}
</tbody>
</table>
</>
)}
</TablePaginatedWrapper>
</>
</thead>
<tbody>
{(data && data.length > 0) ? data?.map((item, index) => (
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2">
<div
className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'>
<div className="text-left">
<div
className="text-base font-semibold">{getDateTimeFromDateString(item?.added)}</div>
</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<div className="text-base font-semibold">{item?.name}</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<div
className="text-base font-semibold">{item?.product_id}</div>
</div>
</td>
<td className="px-2">
<div className="text-right">
<div className="text-base font-semibold">{item?.status}</div>
</div>
</td>
<td className="px-2">
<div
className='p-2 flex justify-center items-center text-slate-500 bg-white-body dark:text-white-body dark:bg-black-body rounded-md'>
<Link to={`/product-view/${item?.product_id}`} state={{productID: item?.product_id}}>
<Icons name='eye'/>
</Link>
</div>
{/*<div className="text-right">*/}
{/* <div className="text-base font-semibold">[---]</div>*/}
{/*</div>*/}
</td>
</tr>
))
:
<tr className="py-2 border-t border-dashed border-slate-300">
<td className="px-3 py-2" colSpan={4}>
<div className="flex justify-center items-center">
No Record Found
</div>
</td>
</tr>
}
</tbody>
</table>
</>
)}
</TablePaginatedWrapper>
</>
}
</div>
</div>
+8
View File
@@ -0,0 +1,8 @@
import React from 'react'
import ProductView from "../components/products/ProductView";
export default function ProductViewPage() {
return (
<ProductView />
)
}
+1
View File
@@ -23,6 +23,7 @@ const queryKeys = {
subscriptions_view: ['subscriptions_view'],
users_admin: ['users_admin'],
country_list: ['country_list'],
product_view: ['product_view'],
}
export default queryKeys
+14
View File
@@ -68,6 +68,20 @@ export const getCountry = (reqData) => {
return getAuxEnd(`/country`, postData)
}
// FUNCTION TO GET PRODUCT VIEW lIST
export const getProductView = (reqData) => {
const postData = { ...reqData }
return getAuxEnd(`/product-view`, postData)
}
// FUNCTION TO SET COUNTRY
export const setCountry = (reqData) => {
let postData = {
...reqData
}
return postAuxEnd('/set-country', postData, false)
}
// FUNCTION TO GET BILLINGS
export const getBillings = (reqData) => {
const postData = { ...reqData }