Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c686acf1e8 | |||
| 5d8d5aa2be | |||
| 5c8f96d92a | |||
| ae0500a799 | |||
| fc38378210 | |||
| 044b880726 | |||
| 28b3d85b24 | |||
| f440c5a9b9 | |||
| 4481e6b826 | |||
| b46d96d1b8 | |||
| f712c80c67 | |||
| 97189d08f6 | |||
| b090dbb056 | |||
| 455b6677fa | |||
| 447f15f7d9 | |||
| 04b7c5c4ff | |||
| 6c98292fce | |||
| cc5c215eb9 | |||
| f7430cc231 | |||
| 7d39c0fc23 | |||
| 43e8b9601a | |||
| a2c7ecd1f5 | |||
| 0113f047dd | |||
| d131e981cf | |||
| 85a07427e5 | |||
| 647f9473a0 | |||
| 95ea5aaabf | |||
| cb4b0e89c7 | |||
| b898f7c3e3 | |||
| a5fc0890b4 | |||
| 45ba601c11 | |||
| 0f65bc24b0 | |||
| c9048cdbd3 | |||
| 77c01683ae | |||
| 94f6e55a7d | |||
| 14f9b83f12 | |||
| b31650e5f7 | |||
| e508e7cffa | |||
| 79ff004077 | |||
| 175e6b5434 | |||
| 9b3cb2a75a | |||
| b142833901 | |||
| 10a6023ceb | |||
| d37026c868 | |||
| bd4cdb1ae9 | |||
| f86e5abd3d | |||
| 50551f1c7d | |||
| a87a0a58db | |||
| 6927d53c59 | |||
| e24df8e744 | |||
| 20c224b625 | |||
| 54a0361620 | |||
| a9721991de | |||
| e15e9f271c | |||
| c9ad818370 | |||
| 466d10c0fc | |||
| 7a7149de0c | |||
| 34ef37c905 | |||
| 52249ae3a2 | |||
| 183a6ce903 | |||
| e65371e41b | |||
| 767a900e36 | |||
| 8f41dcbf35 | |||
| 11289c44fb | |||
| 65f4aafc68 | |||
| 79d5005d6b | |||
| ba6b3a1dd0 | |||
| ec1402f610 | |||
| 4481dae24e | |||
| 68eb0f9abc | |||
| b5a5452a0d | |||
| 0a66679950 | |||
| fd9eb08cea | |||
| 1e28046093 | |||
| 4b39b73931 | |||
| 54bfe7affa | |||
| d7cfb03550 | |||
| 2324980cf4 | |||
| ebcde80a3d | |||
| 9a0ed2d78c | |||
| 5783dfd521 |
@@ -7,6 +7,7 @@ INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API="https://devapi.mermsemr.com"
|
||||
# REACT_APP_MAIN_API="http://localhost:14700"
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
|
||||
@@ -7,6 +7,7 @@ VITE_INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API="https://devapi.mermsemr.com"
|
||||
# REACT_APP_MAIN_API="http://localhost:14700"
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
|
||||
@@ -7,6 +7,7 @@ INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API="https://api.mermsemr.com"
|
||||
#REACT_APP_MAIN_API="http://localhost:14700"
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
|
||||
+2
-2
@@ -27,9 +27,9 @@ COPY . .
|
||||
|
||||
#RUN npm run build
|
||||
|
||||
|
||||
RUN npm run start
|
||||
# CMD [ "npm", "run", "preview" ]
|
||||
##CMD [ "npm", "run", "start" ,"--", "--host"]
|
||||
|
||||
CMD /bin/sh ./run.sh
|
||||
#CMD /bin/sh ./run.sh
|
||||
|
||||
|
||||
@@ -24,5 +24,14 @@ else
|
||||
# npm run start
|
||||
nginx -g 'daemon off;' -c /usr/src/app/nginx.conf
|
||||
nginx -c /usr/src/app/nginx.conf
|
||||
|
||||
# build the app and serve it via nginx
|
||||
echo "Production build"
|
||||
npm install --legacy-peer-deps
|
||||
npm run build
|
||||
# Testing sometimes
|
||||
# npm run start
|
||||
nginx -g 'daemon off;' -c /usr/src/app/nginx.conf
|
||||
nginx -c /usr/src/app/nginx.conf
|
||||
fi
|
||||
|
||||
|
||||
+5
-1
@@ -3,13 +3,17 @@ const RouteLinks = {
|
||||
homePage: '/',
|
||||
customerPage: '/customer',
|
||||
accountDetails: '/account-view/*',
|
||||
subscriptions: '/subscriptions',
|
||||
accountEdit:'/account-edit/*',
|
||||
subscriptionDetails: '/subscription-view/*',
|
||||
subscriptions: '/subscriptions',
|
||||
billings: '/billings',
|
||||
files_uploads: '/files-uploads',
|
||||
recentSignup: '/recent-signup',
|
||||
loansPage: '/loans',
|
||||
transactionsPage: '/transactions',
|
||||
countrySettings: '/country',
|
||||
products: '/products',
|
||||
productView: '/product-view/*',
|
||||
usersAdmin: '/users-admin',
|
||||
productTemplates: '/products-template',
|
||||
customTemplates: '/custom-template',
|
||||
|
||||
+14
-6
@@ -19,9 +19,12 @@ import LoansPage from './pages/LoansPage' // SELECTED LOANS PAGE
|
||||
import TransactionDetailsPage from './pages/TransactionDetailsPage'
|
||||
import AccountDetailsPage from "./pages/AccountDetailsPage";
|
||||
import ProductTemplatePage from "./pages/ProductTemplatePage";
|
||||
import CustomTemplatePage from "./pages/CustomTemplatePage"; // TRANSACTION DETAILS PAGE
|
||||
import SubscriptionDetailViewPage from './pages/SubscriptionDetailViewPage' // SUBSCRIPTION DETAIL VIEW PAGE
|
||||
|
||||
import CustomTemplatePage from "./pages/CustomTemplatePage";
|
||||
import SubscriptionDetailsPage from "./pages/SubscriptionDetailsPage";
|
||||
import CountrySettingsPage from "./pages/CountrySettingsPage";
|
||||
import ProductViewPage from "./pages/ProductViewPage";
|
||||
import FilesUploadPage from "./pages/FilesUploadPage"; // TRANSACTION DETAILS PAGE
|
||||
import AccountEditpage from "./pages/AccountEditPage";
|
||||
|
||||
// const Home = lazy(() => import('./pages/Home'));
|
||||
|
||||
@@ -36,17 +39,22 @@ export default function SiteRoutes() {
|
||||
<Route path={RouteLinks.subscriptions} element={<SubscriptionsPage/>}/> {`*/SUBSCRIPTIONS PAGE*/`}
|
||||
<Route path={RouteLinks.customerPage} element={<CustomerPage/>}/> {`*/CUSTOMER PAGE*/`}
|
||||
<Route path={RouteLinks.accountDetails} element={<AccountDetailsPage/>}/> {`*/CUSTOMER PAGE*/`}
|
||||
<Route path={RouteLinks.accountEdit} element={<AccountEditpage/>}/> {`*/CUSTOMER EDIT 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.files_uploads} element={<FilesUploadPage/>}/> {`*/FILES PAGE*/`}
|
||||
|
||||
<Route path={RouteLinks.countrySettings} element={<CountrySettingsPage/>}/> {`*/PRODUCTS TEMPLATE PAGE*/`}
|
||||
<Route path={RouteLinks.productTemplates} element={<ProductTemplatePage/>}/> {`*/PRODUCTS TEMPLATE PAGE*/`}
|
||||
<Route path={RouteLinks.customTemplates} element={<CustomTemplatePage/>}/> {`*/CUSTOM TEMPLATES PAGE*/`}
|
||||
<Route path={RouteLinks.subscriptionDetails} element={<SubscriptionDetailViewPage/>}/> {`*/SUBSCRIPTION DETAIL VIEW PAGE*/`}
|
||||
|
||||
<Route path={RouteLinks.loansPage} element={<LoansPage/>}/> {`*/LOANS PAGE*/`}
|
||||
<Route path={RouteLinks.transaction_details_page}
|
||||
element={<TransactionDetailsPage/>}/> {`*/TRANSACTION PAGE*/`}
|
||||
<Route path={RouteLinks.transaction_details_page} element={<TransactionDetailsPage/>}/> {`*/TRANSACTION PAGE*/`}
|
||||
<Route path={RouteLinks.subscriptionDetails} element={<SubscriptionDetailsPage/>} />
|
||||
</Route>
|
||||
|
||||
{/* ERROR PAGE */}
|
||||
|
||||
@@ -66,7 +66,7 @@ export default function UserExist() {
|
||||
navigate(RouteLinks.login, {replace:true})
|
||||
}
|
||||
}
|
||||
if(userDetails.name){
|
||||
if(userDetails?.email || userDetails?.username){
|
||||
setPageIsLoading(false)
|
||||
}else if(!userDetails.name && localStorage.getItem('token')){
|
||||
loadUser(localStorage.getItem('token'))
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
|
||||
import {Link} from 'react-router-dom'
|
||||
import Icons from "../Icons";
|
||||
|
||||
export default function AccountBannerCom({accountInfo}) {
|
||||
return <>
|
||||
<div className="pb-5">
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="w-full">
|
||||
<h4 className="font-semibold text-lg">Account Info</h4>
|
||||
</div>
|
||||
<div className="w-full overflow-x-auto">
|
||||
<>
|
||||
<table className="py-2 w-full text-sm bg-[aliceblue] dark:bg-transparent rounded-[10px]">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Firstname
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Lastname
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Username
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Email
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Country
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(accountInfo && Object.keys(accountInfo).length > 0) ?
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
{/*<td className="px-2 py-2">*/}
|
||||
{/* <div className="text-left">*/}
|
||||
{/* <div className="text-base font-semibold">{1}</div>*/}
|
||||
{/* </div>*/}
|
||||
{/*</td>*/}
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{accountInfo?.firstname}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{accountInfo?.lastname}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{accountInfo?.username}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{accountInfo?.email}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{accountInfo?.country}</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
:
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={6}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
import { useEffect } from "react";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
|
||||
import BreadcrumbCom from "../breadcrumb/BreadcrumbCom";
|
||||
import RouteLinks from "../../RouteLinks";
|
||||
import { getAccountView } from "../../services/siteServices";
|
||||
import queryKeys from "../../services/queryKeys";
|
||||
import AccountBannerCom from "./AccountBannerCom";
|
||||
|
||||
|
||||
export default function AccountEditCom() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const { state } = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
if (!state?.memberUID) {
|
||||
navigate(RouteLinks.homePage, { replace: true });
|
||||
}
|
||||
}, [navigate, state?.memberUID]);
|
||||
|
||||
const { data, isFetching, isError, error } = useQuery({
|
||||
queryKey: queryKeys.account_view,
|
||||
queryFn: () => {
|
||||
// const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
member_uid: state?.memberUID,
|
||||
// page,
|
||||
// ...filterData
|
||||
};
|
||||
return getAccountView(reqData);
|
||||
},
|
||||
staleTime: 0, //0 mins
|
||||
});
|
||||
const accountsViewData = data?.data; // ACCOUNT EDIT DATA
|
||||
const account_info = accountsViewData?.account;
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
queryClient.refetchQueries({
|
||||
queryKey: [...queryKeys.account_view],
|
||||
// type: 'active',
|
||||
// exact: true,
|
||||
});
|
||||
}, [queryClient, state?.memberUID]);
|
||||
|
||||
return (
|
||||
<div className="w-full flex flex-col gap-8">
|
||||
<BreadcrumbCom
|
||||
title={`Account Edit [${state?.memberUID}]`}
|
||||
paths={["Dashboard", "Account Edit"]}
|
||||
/>
|
||||
|
||||
<div className="box bg-white dark:bg-black-box text-black-body dark:text-white-body">
|
||||
{isFetching ? (
|
||||
<>
|
||||
<p className="text-slate-800">Loading...</p>
|
||||
</>
|
||||
) : isError ? (
|
||||
<p className="text-red-500">{error.message}</p>
|
||||
) : (
|
||||
<>
|
||||
<AccountBannerCom accountInfo={account_info} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,52 +1,61 @@
|
||||
|
||||
|
||||
|
||||
export default function AccountProfileView() {
|
||||
export default function AccountProfileView({profile}) {
|
||||
return <>
|
||||
<div className="row" style={{paddingBottom:'20px'}}>
|
||||
<div className="col-12 col-lg-12">
|
||||
<div className="card card-statistics">
|
||||
<div className="card-header">
|
||||
<div className="card-heading">
|
||||
<h4 className="card-title"><b>Account Profile</b></h4>
|
||||
</div>
|
||||
<div className="pb-5">
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="w-full">
|
||||
<h4 className="font-semibold text-lg">Account Profile</h4>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="table-responsive">
|
||||
<table className="table table-hover mb-0" style={{width:'100%', backgroundColor: 'aliceblue', borderRadius: '10px'}}>
|
||||
<thead>
|
||||
<div className="w-full overflow-x-auto">
|
||||
<>
|
||||
<table className="py-2 w-full text-sm bg-[aliceblue] dark:bg-transparent rounded-[10px]">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">First</th>
|
||||
<th scope="col">Last</th>
|
||||
<th scope="col">Handle</th>
|
||||
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Member ID
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Practice/specialization
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
URL Name
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">1</th>
|
||||
<td>Mark</td>
|
||||
<td>Otto</td>
|
||||
<td>@mdo</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">2</th>
|
||||
<td>Jacob</td>
|
||||
<td>Thornton</td>
|
||||
<td>@fat</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">3</th>
|
||||
<td>Larry</td>
|
||||
<td>the Bird</td>
|
||||
<td>@twitter</td>
|
||||
</tr>
|
||||
{(profile && Object.keys(profile).length > 0) ?
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{profile?.member_id}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">Practice: {profile?.practice}</div>
|
||||
<div className="text-base font-semibold">Specialization: {profile?.specialization}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{profile?.url_name}</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
:
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={3}>
|
||||
<div className="flex justify-center items-center">
|
||||
No Record Found
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</>
|
||||
}
|
||||
@@ -1,70 +1,79 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useEffect } from "react";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import {useLocation, useNavigate, Link} from 'react-router-dom'
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import RouteLinks from '../../RouteLinks'
|
||||
import { getAccountView } from '../../services/siteServices'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import BreadcrumbCom from "../breadcrumb/BreadcrumbCom";
|
||||
import RouteLinks from "../../RouteLinks";
|
||||
import { getAccountView } from "../../services/siteServices";
|
||||
import queryKeys from "../../services/queryKeys";
|
||||
import CustomerAccountView from "./CustomerAccountView";
|
||||
import AccountProfileView from "./AccountProfileView";
|
||||
import CustomerSubscriptionsView from "./CustomerSubscriptionsView";
|
||||
import CustomerPaymentsView from "./CustomerPaymentsView";
|
||||
|
||||
export default function AccountViewCom() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const {state:{memberUID}} = useLocation()
|
||||
const navigate = useNavigate()
|
||||
const { state } = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(()=>{
|
||||
if(!memberUID){
|
||||
navigate(RouteLinks.customerPage, {replace: true})
|
||||
}
|
||||
},[])
|
||||
useEffect(() => {
|
||||
if (!state?.memberUID) {
|
||||
navigate(RouteLinks.homePage, { replace: true });
|
||||
}
|
||||
}, [navigate, state?.memberUID]);
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.account_view,
|
||||
queryFn: () => {
|
||||
// const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
member_uid: memberUID
|
||||
// page,
|
||||
// ...filterData
|
||||
}
|
||||
return getAccountView(reqData)
|
||||
},
|
||||
staleTime: 0 //0 mins
|
||||
})
|
||||
const accountsViewData = data?.data // ACCOUNT VIEW DATA
|
||||
const account_info = accountsViewData?.account
|
||||
const account_profile = accountsViewData?.account_profile
|
||||
const subscriptions = accountsViewData?.subscriptions
|
||||
const payments = accountsViewData?.payments
|
||||
// console.log('DATA', payments, subscriptions)
|
||||
const { data, isFetching, isError, error } = useQuery({
|
||||
queryKey: queryKeys.account_view,
|
||||
queryFn: () => {
|
||||
// const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
member_uid: state?.memberUID,
|
||||
// page,
|
||||
// ...filterData
|
||||
};
|
||||
return getAccountView(reqData);
|
||||
},
|
||||
staleTime: 0, //0 mins
|
||||
});
|
||||
const accountsViewData = data?.data; // ACCOUNT VIEW DATA
|
||||
const account_info = accountsViewData?.account;
|
||||
const account_profile = accountsViewData?.account_profile;
|
||||
const subscriptions = accountsViewData?.subscriptions;
|
||||
const payments = accountsViewData?.payments;
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title={`Account View [${memberUID}]`} paths={['Dashboard', 'Account View']}/>
|
||||
useEffect(() => {
|
||||
queryClient.refetchQueries({
|
||||
queryKey: [...queryKeys.account_view],
|
||||
// type: 'active',
|
||||
// exact: true,
|
||||
});
|
||||
}, [queryClient, state?.memberUID]);
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{isFetching ?
|
||||
<>
|
||||
<p className='text-slate-800'>Loading...</p>
|
||||
</>
|
||||
: isError ?
|
||||
<p className='text-red-500'>{error.message}</p>
|
||||
:
|
||||
<>
|
||||
<CustomerAccountView accountInfo={account_info} />
|
||||
<AccountProfileView />
|
||||
<CustomerSubscriptionsView subscriptions={subscriptions} memberUID={memberUID} />
|
||||
<CustomerPaymentsView payments={payments} />
|
||||
</>
|
||||
return (
|
||||
<div className="w-full flex flex-col gap-8">
|
||||
<BreadcrumbCom
|
||||
title={`Account View [${state?.memberUID}]`}
|
||||
paths={["Dashboard", "Account View"]}
|
||||
/>
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
<div className="box bg-white dark:bg-black-box text-black-body dark:text-white-body">
|
||||
{isFetching ? (
|
||||
<>
|
||||
<p className="text-slate-800">Loading...</p>
|
||||
</>
|
||||
) : isError ? (
|
||||
<p className="text-red-500">{error.message}</p>
|
||||
) : (
|
||||
<>
|
||||
<CustomerAccountView accountInfo={account_info} />
|
||||
<AccountProfileView profile={account_profile} />
|
||||
<CustomerSubscriptionsView subscriptions={subscriptions} />
|
||||
<CustomerPaymentsView payments={payments} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {Link} from 'react-router-dom'
|
||||
import Icons from "../Icons";
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
|
||||
export default function CustomerAccountView({accountInfo}) {
|
||||
return <>
|
||||
@@ -10,13 +11,11 @@ export default function CustomerAccountView({accountInfo}) {
|
||||
</div>
|
||||
<div className="w-full overflow-x-auto">
|
||||
<>
|
||||
<table className="py-2 w-full text-sm" style={{backgroundColor: 'aliceblue', borderRadius: '10px'}}>
|
||||
<table className="py-2 w-full text-sm bg-[aliceblue] dark:bg-transparent rounded-[10px]">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
|
||||
<th scope="col" className="px-2 py-2">
|
||||
#
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Firstname
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
@@ -28,6 +27,9 @@ export default function CustomerAccountView({accountInfo}) {
|
||||
<th scope="col" className="px-2">
|
||||
Email
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Country
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
@@ -36,11 +38,11 @@ export default function CustomerAccountView({accountInfo}) {
|
||||
<tbody>
|
||||
{(accountInfo && Object.keys(accountInfo).length > 0) ?
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-2 py-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{1}</div>
|
||||
</div>
|
||||
</td>
|
||||
{/*<td className="px-2 py-2">*/}
|
||||
{/* <div className="text-left">*/}
|
||||
{/* <div className="text-base font-semibold">{1}</div>*/}
|
||||
{/* </div>*/}
|
||||
{/*</td>*/}
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{accountInfo?.firstname}</div>
|
||||
@@ -61,12 +63,21 @@ export default function CustomerAccountView({accountInfo}) {
|
||||
<div className="text-base font-semibold">{accountInfo?.email}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{accountInfo?.country}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2 text-right">
|
||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||
<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={`/subscription-view/63554d40-9ba1-4afe-80c2-ca147236f7ee`}
|
||||
to={`/account-edit/${accountInfo?.uid}`}
|
||||
state={{
|
||||
customerID: accountInfo?.id,
|
||||
memberUID: accountInfo?.uid,
|
||||
}}
|
||||
>
|
||||
<Icons name='eye'/>
|
||||
</Link>
|
||||
|
||||
@@ -8,20 +8,23 @@ export default function CustomerPaymentsView({payments}) {
|
||||
</div>
|
||||
<div className="w-full overflow-x-auto">
|
||||
<>
|
||||
<table className="py-2 w-full text-sm" style={{backgroundColor: 'aliceblue', borderRadius: '10px'}}>
|
||||
<table className="py-2 w-full text-sm bg-[aliceblue] dark:bg-transparent rounded-[10px]">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
#
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
First
|
||||
Added
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Last
|
||||
Option Name
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Handle
|
||||
Amount
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Currency
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -35,17 +38,22 @@ export default function CustomerPaymentsView({payments}) {
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.first}</div>
|
||||
<div className="text-base font-semibold">{item?.added}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.last}</div>
|
||||
<div className="text-base font-semibold">{item?.option_name}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.handle}</div>
|
||||
<div className="text-base font-semibold">{item?.amount}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">Dollars</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import getDateTimeFromDateString from "../../helpers/getDateTimeFromDateString";
|
||||
import RouteLinks from "../../RouteLinks";
|
||||
import Icons from "../Icons";
|
||||
import {Link} from 'react-router-dom'
|
||||
|
||||
export default function CustomerSubscriptionsView({subscriptions, memberUID}) {
|
||||
export default function CustomerSubscriptionsView({subscriptions}) {
|
||||
return <>
|
||||
<div className="pb-5">
|
||||
<div className="flex flex-col gap-1">
|
||||
@@ -12,20 +11,20 @@ export default function CustomerSubscriptionsView({subscriptions, memberUID}) {
|
||||
</div>
|
||||
<div className="w-full overflow-x-auto">
|
||||
<>
|
||||
<table className="py-2 w-full text-sm" style={{backgroundColor: 'aliceblue', borderRadius: '10px'}}>
|
||||
<table className="py-2 w-full text-sm bg-[aliceblue] dark:bg-transparent rounded-[10px]">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
#
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Added
|
||||
Added/Updated
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Product
|
||||
Product/Server
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
URL
|
||||
URL / EXT/ Templates
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Status
|
||||
@@ -40,22 +39,46 @@ export default function CustomerSubscriptionsView({subscriptions, memberUID}) {
|
||||
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-2 py-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{index+1}</div>
|
||||
<div className="text-base font-semibold">{index + 1}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{getDateTimeFromDateString(item?.added)}</div>
|
||||
<div
|
||||
className="text-base font-semibold">{getDateTimeFromDateString(item?.added)}</div>
|
||||
<div
|
||||
className="text-base font-semibold">{getDateTimeFromDateString(item?.updated)}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.product_id}</div>
|
||||
<div><a href={`http://${item?.primary_server}:${item?.provision_port}`}
|
||||
target='_blank'
|
||||
rel="noreferrer">{item?.primary_server}:{item?.provision_port}</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.internal_url}</div>
|
||||
<div className="text-base">
|
||||
<span className="badge badge-pill badge-primary-inverse">
|
||||
<a href={`https://${item?.internal_url}`}
|
||||
target='_blank'
|
||||
rel="noreferrer">{item?.internal_url}</a>
|
||||
</span>
|
||||
|
||||
<br/>
|
||||
<span className="badge badge-warning">
|
||||
<a href={`${item?.external_url}`}
|
||||
target='_blank'
|
||||
rel="noreferrer">{item?.external_url}</a>
|
||||
</span>
|
||||
|
||||
<br/>
|
||||
<span>Template :</span> {item?.product_template}
|
||||
<br/><span>Custom :</span> {item?.custom_template}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
@@ -67,7 +90,10 @@ export default function CustomerSubscriptionsView({subscriptions, memberUID}) {
|
||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||
<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={`/subscription-view/${memberUID}`} state={{customerID: item?.id, memberUID}}>
|
||||
<Link to={`/subscription-view/${item?.subscription_uid}`} state={{
|
||||
customerID: item?.id,
|
||||
subscriptionUID: item?.subscription_uid
|
||||
}}>
|
||||
<Icons name='eye'/>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, {useState} from 'react'
|
||||
import {useState} from 'react'
|
||||
import {useDispatch} from 'react-redux'
|
||||
import {useNavigate, Link} from 'react-router-dom'
|
||||
import {useNavigate} from 'react-router-dom'
|
||||
import {useMutation} from '@tanstack/react-query'
|
||||
import {Formik, Form} from 'formik'
|
||||
import * as Yup from "yup";
|
||||
@@ -45,9 +45,7 @@ export default function LoginCom() {
|
||||
const {jwt_token, user} = res?.data
|
||||
if (jwt_token) {
|
||||
localStorage.setItem('token', jwt_token)
|
||||
// localStorage.setItem('room', room)
|
||||
const data = {jwt_token}
|
||||
dispatch(updateUserDetails({...data, ...user}));
|
||||
dispatch(updateUserDetails({jwt_token, ...user}));
|
||||
}
|
||||
setLoading(false)
|
||||
navigate(RouteLinks.homePage, {state: {proceed: 'true'}}) // later add redux to dispatch state
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
import { useState } from "react";
|
||||
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import BreadcrumbCom from "../breadcrumb/BreadcrumbCom";
|
||||
import { getCountry, setCountry } from "../../services/siteServices";
|
||||
|
||||
export default function CountrySettings(){
|
||||
|
||||
const [selected, setSelected] = useState('')
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
const {data, status, isError, error} = useQuery({
|
||||
queryKey: queryKeys.country_list,
|
||||
queryFn: () => {
|
||||
const reqData = {
|
||||
// page,
|
||||
// ...filterData
|
||||
}
|
||||
return getCountry(reqData)
|
||||
},
|
||||
// placeholderData: (previousData, previousQuery) => previousData,
|
||||
staleTime: 0 // 0 mins
|
||||
})
|
||||
const countryData = data?.data?.country_data // COUNTRY LIST
|
||||
// console.log('countryData', countryData)
|
||||
|
||||
|
||||
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.toUpperCase() === '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='relative box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
|
||||
<>
|
||||
{/* status === 'pending' */}
|
||||
{status === 'pending' ?
|
||||
<p className='text-slate-800'>Loading...</p>
|
||||
: isError ?
|
||||
<p className='text-red-500'>{error.message}</p>
|
||||
:
|
||||
// <TableWrapper data={countryData} itemsPerPage={20}>
|
||||
// {({ data }) => (
|
||||
// )}
|
||||
// </TableWrapper>
|
||||
<>
|
||||
<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">
|
||||
Code
|
||||
</th>
|
||||
<th scope="col" className="px-8">
|
||||
Country
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-center">
|
||||
Status
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-center">
|
||||
Signup
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(countryData && countryData.length > 0) ? countryData?.map((item, index) => (
|
||||
<tr key={index} className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-2 py-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.code}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-8">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.description}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-8">
|
||||
<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="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>
|
||||
))
|
||||
:
|
||||
<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>
|
||||
</>
|
||||
}
|
||||
</>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
import {useState} from 'react'
|
||||
import {useQuery} from '@tanstack/react-query'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
import {getFilesUpload} from '../../services/siteServices'
|
||||
import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString';
|
||||
|
||||
export default function FileUploadCom() {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
const [filter, setFilter] = useState({type: '', id: ''})
|
||||
const [willFilter, setWillFilter] = useState(false)
|
||||
|
||||
const handleFilter = ({target: {name, value}}) => {
|
||||
setFilter(prev => ({...prev, [name]: value}))
|
||||
}
|
||||
|
||||
const handleFilterByParams = () => {
|
||||
if (filter.type && !filter.id) {
|
||||
return
|
||||
} else if (!filter.type) {
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
setFilter({type: '', id: ''})
|
||||
} else {
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
}
|
||||
}
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.billings, page, willFilter],
|
||||
queryFn: () => {
|
||||
const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
page,
|
||||
...filterData
|
||||
}
|
||||
return getFilesUpload(reqData)
|
||||
},
|
||||
staleTime: 0 //0 mins
|
||||
})
|
||||
const billingData = data?.data?.file_list; // file_list
|
||||
const media_server = data?.data?.media_server; // file_list
|
||||
const pagination = data?.data?.pagination
|
||||
debugger;
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Files' paths={['Dashboard', 'Files']}/>
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{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='file_group'>File Group</option>
|
||||
<option value='member_id'>Member ID</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>
|
||||
{/* end of filter section */}
|
||||
|
||||
<TablePaginatedWrapper data={billingData} 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">
|
||||
Member ID
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
File Name
|
||||
</th>
|
||||
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Group
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Status
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(data && data.length > 0) ? data?.map((item, index) => {
|
||||
const file_url = (media_server + "/" + item?.file_group + "/" + item?.file_uid + "/" + item.filename).toLowerCase();
|
||||
return (
|
||||
<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?.member_id}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div
|
||||
className="text-base font-semibold">
|
||||
<a href={`${file_url}`} target='_blank'
|
||||
rel="noreferrer">
|
||||
{item?.filename}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div
|
||||
className="text-base font-semibold">{item?.file_group}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div
|
||||
className="text-base font-semibold">{item?.status}</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>
|
||||
)
|
||||
}
|
||||
+174
-162
@@ -1,13 +1,13 @@
|
||||
import React from 'react'
|
||||
import {Link} from 'react-router-dom'
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {Link} from 'react-router-dom'
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
import BreadcrumbCom from '../../components/breadcrumb/BreadcrumbCom'
|
||||
import CustomCounter from '../../components/CustomCounter'
|
||||
import Icons from '../../components/Icons'
|
||||
import formatNumber from '../../helpers/formatNumber'
|
||||
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import { getDashData } from '../../services/siteServices'
|
||||
import {getDashData} from '../../services/siteServices'
|
||||
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||
import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
|
||||
import localImgLoader from '../../helpers/localImageLoader';
|
||||
@@ -15,176 +15,188 @@ import RouteLinks from '../../RouteLinks';
|
||||
|
||||
export default function HomeCom() {
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.dashboard,
|
||||
queryFn: () => getDashData(),
|
||||
})
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.dashboard,
|
||||
queryFn: () => getDashData(),
|
||||
})
|
||||
|
||||
const dashData = data?.data // DASHBOARD DATA
|
||||
const dashData = data?.data // DASHBOARD DATA
|
||||
|
||||
// console.log('dashData', dashData)
|
||||
// loans, payments, recent_transactions [], request_summary
|
||||
// console.log('dashData', dashData)
|
||||
// loans, payments, recent_transactions [], request_summary
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Dashboard' paths={['Home', 'Dashboard']} />
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Dashboard' paths={['Home', 'Dashboard']}/>
|
||||
|
||||
{(isFetching || isError) ?
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{isError ? <p className='text-red-500'>{error.message}</p> : <p className='text-slate-800'>Loading...</p>}
|
||||
</div>
|
||||
:
|
||||
<div className='grid grid-cols-1 gap-8'>
|
||||
<div className='w-full grid grid-cols-1 xl:grid-cols-3 gap-8'>
|
||||
<div className='box min-h-[230] justify-between bg-[#F7D9E3] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='text-base sm:text-lg font-bold hover:text-primary'>Subscriptions</p>
|
||||
<div className='flex flex-wrap gap-2 items-end font-bold'>
|
||||
{/* <p className='text-3xl sm:text-[39px]'><span className='text-xl sm:text-2xl'>{dashData?.loans?.currency_text}</span><CustomCounter targetNumber={dashData?.loans?.value} timeInSeconds='1' /></p> */}
|
||||
<p className='text-xl sm:text-[30px]'><span className='text-lg sm:text-xl'>
|
||||
{(isFetching || isError) ?
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{isError ? <p className='text-red-500'>{error.message}</p> :
|
||||
<p className='text-slate-800'>Loading...</p>}
|
||||
</div>
|
||||
:
|
||||
<div className='grid grid-cols-1 gap-8'>
|
||||
<div className='w-full grid grid-cols-1 xl:grid-cols-3 gap-8'>
|
||||
<div
|
||||
className='box min-h-[230] justify-between bg-[#F7D9E3] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='text-base sm:text-lg font-bold hover:text-primary'>Subscriptions</p>
|
||||
<div className='flex flex-wrap gap-2 items-end font-bold'>
|
||||
{/* <p className='text-3xl sm:text-[39px]'><span className='text-xl sm:text-2xl'>{dashData?.loans?.currency_text}</span><CustomCounter targetNumber={dashData?.loans?.value} timeInSeconds='1' /></p> */}
|
||||
<p className='text-xl sm:text-[30px]'><span className='text-lg sm:text-xl'>
|
||||
{/*{dashData?.loans?.currency_text}*/}
|
||||
</span><CustomCounter targetNumber={formatNumber(dashData?.loans?.value)} timeInSeconds='1' />
|
||||
</p>
|
||||
<p className='sm:text-[13.9px]'>{dashData?.loans?.text}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='box min-h-[230] justify-between bg-[#CBF0F5] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='text-base sm:text-lg font-bold hover:text-primary'>Payments</p>
|
||||
<div className='flex flex-wrap gap-2 items-end font-bold'>
|
||||
<p className='text-xl sm:text-[30px]'><span className='text-lg sm:text-xl'>
|
||||
</span><CustomCounter targetNumber={formatNumber(dashData?.signups?.value)} timeInSeconds='1'/>
|
||||
</p>
|
||||
<p className='sm:text-[13.9px]'>{dashData?.signups?.text.toString()}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className='box min-h-[230] justify-between bg-[#CBF0F5] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='text-base sm:text-lg font-bold hover:text-primary'>Payments</p>
|
||||
<div className='flex flex-wrap gap-2 items-end font-bold'>
|
||||
<p className='text-xl sm:text-[30px]'><span className='text-lg sm:text-xl'>
|
||||
{dashData?.payments?.currency_text}
|
||||
</span><CustomCounter targetNumber={formatNumber(dashData?.payments?.value)} timeInSeconds='1' />
|
||||
</p>
|
||||
<p className='sm:text-[13.9px]'>{dashData?.payments?.text}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='box min-h-[230] justify-between bg-[#CBD4F4] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='mb-4 text-base sm:text-lg font-bold hover:text-primary'>Provision Summary</p>
|
||||
<div className='grid grid-cols-2 gap-4 font-bold'>
|
||||
{
|
||||
Object.values(dashData?.request_summary).map((item, index) => {
|
||||
return (
|
||||
<div key={index} className='flex items-center gap-2'>
|
||||
<div className='min-w-10 min-h-10 bg-white-body dark:bg-black-box dark:shadow-[0_0_0_1px_#f9f9f9] rounded-md flex justify-center items-center'>
|
||||
<Icons name='sales' />
|
||||
</span><CustomCounter targetNumber={formatNumber(dashData?.payments?.value)} timeInSeconds='1'/>
|
||||
</p>
|
||||
<p className='sm:text-[13.9px]'>{dashData?.payments?.text}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className='box min-h-[230] justify-between bg-[#CBD4F4] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<p className='mb-4 text-base sm:text-lg font-bold hover:text-primary'>Provision Summary</p>
|
||||
<div className='grid grid-cols-2 gap-4 font-bold'>
|
||||
{
|
||||
Object.values(dashData?.request_summary).map((item, index) => {
|
||||
return (
|
||||
<div key={index} className='flex items-center gap-2'>
|
||||
<div
|
||||
className='min-w-10 min-h-10 bg-white-body dark:bg-black-box dark:shadow-[0_0_0_1px_#f9f9f9] rounded-md flex justify-center items-center'>
|
||||
<Icons name='sales'/>
|
||||
</div>
|
||||
<div>
|
||||
<p className='font-bold text-base'><CustomCounter
|
||||
targetNumber={Object.values(item)[0]} timeInSeconds='1'/></p>
|
||||
<p className='text-12 text-slate-500'>{Object.keys(item)[0]}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p className='font-bold text-base'><CustomCounter targetNumber={Object.values(item)[0]} timeInSeconds='1' /></p>
|
||||
<p className='text-12 text-slate-500'>{Object.keys(item)[0]}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='w-full'>
|
||||
<div className='box gap-8 bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<div className='grid grid-cols-1 xs:grid-cols-2 gap-4'>
|
||||
<div className='flex flex-col gap-1 order-2 xs:order-1'>
|
||||
<p className='font-bold text-base'>Recent Subscriptions</p>
|
||||
{/* <p className='text-12'>Over 500 members</p> */}
|
||||
</div>
|
||||
{/* <div className='order-1 xs:order-2 text-left xs:text-right'>
|
||||
<div className='w-full'>
|
||||
<div className='box gap-8 bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<div className='grid grid-cols-1 xs:grid-cols-2 gap-4'>
|
||||
<div className='flex flex-col gap-1 order-2 xs:order-1'>
|
||||
<p className='font-bold text-base'>Recent Subscriptions</p>
|
||||
{/* <p className='text-12'>Over 500 members</p> */}
|
||||
</div>
|
||||
{/* <div className='order-1 xs:order-2 text-left xs:text-right'>
|
||||
<button className='font-bold bg-white-aside text-black-body text-12 px-4 py-2 hover:text-primary hover:bg-sky-50 dark:hover:text-white dark:hover:bg-primary dark:text-white-body dark:bg-black-body rounded-md'>+ New Member</button>
|
||||
</div> */}
|
||||
</div>
|
||||
|
||||
<table className="py-2 w-full text-sm">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left font-semibold">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Subscription
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Status
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Activity
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(dashData?.subscription && dashData?.subscription.length > 0) ? dashData?.subscription?.map((item, index) => {
|
||||
if(index <= 10) {
|
||||
return (
|
||||
<tr key={item?.id} 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'>
|
||||
<img className="w-10 h-10 rounded-md" src={localImgLoader(`loan_icons/select_offer.png`)} alt="Icon" />
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.product_id}</div>
|
||||
<div className="font-normal text-gray-500">{getDateFromDateString(item?.added)} {getTimeFromDateString(item?.added)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold"><a href={`https://${item?.internal_url}`} target='_blank' rel="noreferrer">{item?.internal_url}</a></div>
|
||||
<div className="font-normal text-gray-500">{item?.status}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="font-normal text-gray-500">50%</div>
|
||||
<div className="relative h-[6px] w-full bg-white-body dark:bg-black-body rounded-full overflow-hidden">
|
||||
<div className={`absolute left-0 h-full w-1/2 bg-emerald-600`}></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2 text-right">
|
||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||
{/* <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'>
|
||||
<Icons name='edit' />
|
||||
</div> */}
|
||||
<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={RouteLinks.transaction_details_page} state={{transactionID: item?.transaction_id}}>
|
||||
<Icons name='eye' />
|
||||
</Link>
|
||||
</div>
|
||||
{/* <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'>
|
||||
<Icons name='trash' />
|
||||
</div> */}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
}else{
|
||||
return null
|
||||
}
|
||||
}
|
||||
)
|
||||
:
|
||||
<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>
|
||||
}
|
||||
<>
|
||||
{dashData?.subscription.length > 10 &&
|
||||
<tr className="py-2 border-t border-dashed text-right text-primary border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={4}>
|
||||
<Link to={RouteLinks.transactionsPage} className="flex justify-end items-center">
|
||||
More ...
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<table className="py-2 w-full text-sm">
|
||||
<thead className="py-2 text-sm text-slate-500 text-left font-semibold">
|
||||
<tr>
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Subscription
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
URL
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Status
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(dashData?.subscription && dashData?.subscription.length > 0) ? dashData?.subscription?.map((item, index) => {
|
||||
if (index <= 10) {
|
||||
return (
|
||||
<tr key={item?.id} 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'>
|
||||
<img className="w-10 h-10 rounded-md"
|
||||
src={localImgLoader(`loan_icons/select_offer.png`)}
|
||||
alt="Icon"/>
|
||||
<div className="text-left">
|
||||
<div
|
||||
className="text-base font-semibold">{item?.product_id}</div>
|
||||
<div
|
||||
className="font-normal text-gray-500">{getDateFromDateString(item?.added)} {getTimeFromDateString(item?.added)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold"><a
|
||||
href={`https://${item?.internal_url}`} target='_blank'
|
||||
rel="noreferrer">{item?.internal_url}</a></div>
|
||||
<div className="font-normal text-gray-500">
|
||||
<a href={`http://${item?.primary_server}:${item?.provision_port}`}
|
||||
target='_blank'
|
||||
rel="noreferrer">
|
||||
{item?.primary_server}:{item?.provision_port} </a></div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="font-normal text-gray-500">{item?.status}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2 text-right">
|
||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||
<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={`/subscription-view/${item?.uid}`}
|
||||
state={{subscriptionUID: item?.uid}}
|
||||
>
|
||||
<Icons name='eye'/>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
)
|
||||
:
|
||||
<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>
|
||||
}
|
||||
<>
|
||||
{dashData?.subscription.length > 10 &&
|
||||
<tr className="py-2 border-t border-dashed text-right text-primary border-slate-300">
|
||||
<td className="px-3 py-2" colSpan={4}>
|
||||
<Link to={RouteLinks.transactionsPage}
|
||||
className="flex justify-end items-center">
|
||||
More ...
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useSelector } from "react-redux";
|
||||
import { LuSunDim } from "react-icons/lu";
|
||||
import { IoMdSunny } from "react-icons/io";
|
||||
|
||||
@@ -17,6 +18,8 @@ export default function DashboardHeader() {
|
||||
|
||||
const {theme, handleTheme, setLogoutModal, activeMenu, handleActiveMenu, showAsideDrawer, setShowAsideDrawer} = GeneralLayoutContext()
|
||||
|
||||
const {userDetails:{username, email}} = useSelector((state) => state.userDetails) // GETS LOGGED IN USER
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* HEADER SECTION*/}
|
||||
@@ -60,8 +63,8 @@ export default function DashboardHeader() {
|
||||
<div className="pop-modal z-[777] absolute p-4 w-52 sm:w-96 bg-white dark:bg-black-box right-0 top-16 rounded shadow-round_black dark:shadow-round_white">
|
||||
<div className="w-full h-full flex flex-col gap-4">
|
||||
<div className="flex flex-col text-black dark:text-white text-base sm:text-lg">
|
||||
<h1 className="font-semibold">Username</h1>
|
||||
<p className="-mt-2">username@gmail.com</p>
|
||||
<h1 className="font-semibold">{username}</h1>
|
||||
<p className="-mt-2">{email}</p>
|
||||
</div>
|
||||
<div className="rounded w-full flex justify-center items-center gap-2">
|
||||
<MainBtn
|
||||
|
||||
@@ -4,8 +4,9 @@ import DashboardHeader from './DashboardHeader'
|
||||
import { GeneralLayoutContext } from '../../context/GeneralLayoutContext'
|
||||
import DashboardAside from './aside/DashboardAside'
|
||||
import RightAsideBar from './rightaside/RightAsideBar'
|
||||
import { memo } from 'react'
|
||||
|
||||
export default function DashboardLayout() {
|
||||
const DashboardLayout =memo(()=> {
|
||||
|
||||
// let {pathname} = useLocation()
|
||||
|
||||
@@ -54,4 +55,6 @@ export default function DashboardLayout() {
|
||||
</>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
export default DashboardLayout
|
||||
@@ -1,22 +1,23 @@
|
||||
import {useLocation} from 'react-router-dom'
|
||||
import {useSelector} from "react-redux";
|
||||
import RouteLinks from "../../../RouteLinks";
|
||||
import DummyLogo from "../../DummyLogo";
|
||||
import MainBtn from "../../MainBtn";
|
||||
import AsideLink from "./AsideLink";
|
||||
import AsideLinkWithSubLinks from "./AsideLinkWithSubLinks";
|
||||
// import { useSelector } from "react-redux";
|
||||
import {GeneralLayoutContext} from "../../../context/GeneralLayoutContext";
|
||||
import {TbLogout2} from "react-icons/tb";
|
||||
import UserAvatar from '../../../assets/user_avatar.jpg'
|
||||
import Icons from "../../Icons";
|
||||
|
||||
|
||||
export default function DashboardAside() {
|
||||
|
||||
const {pathname} = useLocation()
|
||||
|
||||
const {setLogoutModal, handleActiveMenu} = GeneralLayoutContext()
|
||||
|
||||
// const {userDetails} = useSelector((state) => state.userDetails) // GETS LOGGED IN USER ROLE DETAILS
|
||||
const {userDetails: {username, email}} = useSelector((state) => state.userDetails) // GETS LOGGED IN USER
|
||||
// const {role}= userDetails
|
||||
|
||||
return (
|
||||
@@ -126,8 +127,8 @@ export default function DashboardAside() {
|
||||
<div className="w-full min-h-48 flex flex-col justify-between gap-4">
|
||||
<div className="w-full h-full">
|
||||
<div className="flex flex-col text-black dark:text-white text-base sm:text-lg">
|
||||
<h1 className="font-semibold">Username</h1>
|
||||
<p className="-mt-2">username@gmail.com</p>
|
||||
<h1 className="font-semibold">{username}</h1>
|
||||
<p className="-mt-2">{email}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="rounded w-full flex items-center gap-2">
|
||||
@@ -155,8 +156,10 @@ const asideNavLinks = [
|
||||
{name: 'Provisions', status: 1, icon: 'dot', to: RouteLinks.subscriptions},
|
||||
{name: 'Customers', status: 1, icon: 'dot', to: RouteLinks.customerPage},
|
||||
{name: 'Billings', status: 1, icon: 'dot', to: RouteLinks.billings},
|
||||
{name: 'Files & Uploads', status: 1, icon: 'dot', to: RouteLinks.files_uploads},
|
||||
{
|
||||
name: 'Configurations', status: 1, icon: 'arrow-right', subLinks: [
|
||||
{name: 'Country', status: 1, icon: 'dot', to: RouteLinks.countrySettings},
|
||||
{name: 'Product Settings', status: 1, icon: 'dot', to: RouteLinks.products},
|
||||
{name: 'Product Templates', status: 1, icon: 'dot', to: RouteLinks.productTemplates},
|
||||
{name: 'Custom Templates', status: 1, icon: 'dot', to: RouteLinks.customTemplates},
|
||||
|
||||
@@ -1,98 +1,143 @@
|
||||
import React from 'react'
|
||||
import Img from '../../../assets/user_avatar.jpg'
|
||||
import CustomCounter from '../../CustomCounter'
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import Img from "../../../assets/user_avatar.jpg";
|
||||
import CustomCounter from "../../CustomCounter";
|
||||
|
||||
export default function RecentPaymentsBar({data, isFetching, isError, error}) {
|
||||
return (
|
||||
<div className='h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 overflow-y-auto aside-scroll-design'>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<p className='text-base text-white-body font-bold'>Recent Payments [7 days]</p>
|
||||
{isFetching ?
|
||||
<div className='w-full flex justify-center'>
|
||||
<div className="w-6 h-6 border-2 border-gray-300 border-b-gray-500 rounded-full animate-spin"></div>
|
||||
</div>
|
||||
:
|
||||
isError ?
|
||||
<p className='text-base text-white-body font-bold'>{error?.message}</p>
|
||||
:
|
||||
<div className='grid grid-cols-2 gap-4 sm:gap-6 large:gap-8'>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={18} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Approved</p>
|
||||
</div>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={5} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Verified</p>
|
||||
</div>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={1} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Failed</p>
|
||||
</div>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={1} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Total</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
export default function RecentPaymentsBar({
|
||||
data,
|
||||
isFetching,
|
||||
isError,
|
||||
error,
|
||||
}) {
|
||||
const recentPayment = data?.data?.recent_payment_summary;
|
||||
const recentLogin = data?.data?.recent_login;
|
||||
const systemList = data?.data?.system_url;
|
||||
|
||||
|
||||
return (
|
||||
<div className="h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 aside-scroll-design">
|
||||
<div className="flex flex-col gap-4">
|
||||
<p className="text-base text-white-body font-bold">
|
||||
Recent Payments [7 days]
|
||||
</p>
|
||||
{isFetching ? (
|
||||
<div className="w-full flex justify-center">
|
||||
<div className="w-6 h-6 border-2 border-gray-300 border-b-gray-500 rounded-full animate-spin"></div>
|
||||
</div>
|
||||
) : isError ? (
|
||||
<p className="text-base text-white-body font-bold">
|
||||
{error?.message}
|
||||
</p>
|
||||
) : (
|
||||
<div className="grid grid-cols-2 gap-4 sm:gap-6 large:gap-8">
|
||||
<div className="p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed">
|
||||
<p className="text-base font-bold text-white-body">
|
||||
<CustomCounter
|
||||
targetNumber={recentPayment?.approved}
|
||||
timeInSeconds={1}
|
||||
/>
|
||||
</p>
|
||||
<p className="text-sm text-slate-500">Approved</p>
|
||||
</div>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<p className='text-base text-white-body font-bold'>Recent Login</p>
|
||||
{isFetching ?
|
||||
<div className='w-full flex justify-center'>
|
||||
<div className="w-6 h-6 border-2 border-gray-300 border-b-gray-500 rounded-full animate-spin"></div>
|
||||
</div>
|
||||
:
|
||||
isError ?
|
||||
<p className='text-base text-white-body font-bold'>{error?.message}</p>
|
||||
:
|
||||
<div className='flex flex-col gap-4'>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div className="p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed">
|
||||
<p className="text-base font-bold text-white-body">
|
||||
<CustomCounter
|
||||
targetNumber={recentPayment?.verified}
|
||||
timeInSeconds={1}
|
||||
/>
|
||||
</p>
|
||||
<p className="text-sm text-slate-500">Verified</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
<div className="p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed">
|
||||
<p className="text-base font-bold text-white-body">
|
||||
<CustomCounter
|
||||
targetNumber={recentPayment?.failed}
|
||||
timeInSeconds={1}
|
||||
/>
|
||||
</p>
|
||||
<p className="text-sm text-slate-500">Failed</p>
|
||||
</div>
|
||||
<div className="p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed">
|
||||
<p className="text-base font-bold text-white-body">
|
||||
<CustomCounter
|
||||
targetNumber={recentPayment?.total}
|
||||
timeInSeconds={1}
|
||||
/>
|
||||
</p>
|
||||
<p className="text-sm text-slate-500">Total</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="overflow-y-auto h-full flex flex-col gap-4">
|
||||
<p className="text-base text-white-body font-bold">Systems</p>
|
||||
{isFetching ? (
|
||||
<div className="w-full flex justify-center">
|
||||
<div className="w-6 h-6 border-2 border-gray-300 border-b-gray-500 rounded-full animate-spin"></div>
|
||||
</div>
|
||||
) : isError ? (
|
||||
<p className="text-base text-white-body font-bold">
|
||||
{error?.message}
|
||||
</p>
|
||||
) : (
|
||||
<div className="flex flex-col gap-4">
|
||||
{systemList.map((item, index) => {
|
||||
return (
|
||||
<Link
|
||||
to={item.url}
|
||||
key={index}
|
||||
className="flex gap-3 items-center"
|
||||
>
|
||||
<div className="px-4 py-2 bg-[#0E172E] rounded-md">
|
||||
<img src={Img} className="w-8" alt="Order" />
|
||||
</div>
|
||||
<div className="flex-col">
|
||||
<p className="text-base font-bold text-white-body">
|
||||
{item.name}
|
||||
</p>
|
||||
<p className="text-sm text-slate-500">{item.url}</p>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="overflow-y-auto h-full flex flex-col gap-4">
|
||||
<p className="text-base text-white-body font-bold">Recent Login</p>
|
||||
{isFetching ? (
|
||||
<div className="w-full flex justify-center">
|
||||
<div className="w-6 h-6 border-2 border-gray-300 border-b-gray-500 rounded-full animate-spin"></div>
|
||||
</div>
|
||||
) : isError ? (
|
||||
<p className="text-base text-white-body font-bold">
|
||||
{error?.message}
|
||||
</p>
|
||||
) : (
|
||||
<div className="flex flex-col gap-4">
|
||||
{recentLogin.map((item, index) => {
|
||||
return (
|
||||
<Link
|
||||
to={`/account-view/${item?.member_uid}`}
|
||||
state={{ customerID: item?.id, memberUID: item?.member_uid }}
|
||||
key={index}
|
||||
className="flex gap-3 items-center"
|
||||
>
|
||||
<div className="px-4 py-2 bg-[#0E172E] rounded-md">
|
||||
<img src={Img} className="w-8" alt="Order" />
|
||||
</div>
|
||||
<div className="flex-col">
|
||||
<p className="text-base font-bold text-white-body">
|
||||
{item.firstname} {item.lastname}
|
||||
</p>
|
||||
<p className="text-sm text-slate-500">{item.username}</p>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,14 +29,9 @@ export default function RightAsideBar() {
|
||||
},
|
||||
// staleTime: 0 //0 mins
|
||||
})
|
||||
const recentData = [] // RECENT LIST
|
||||
|
||||
// const recentData = data?.data // RECENT LIST
|
||||
// const pagination = data?.data?.pagination
|
||||
// console.log('RIGHT', data?.data)
|
||||
|
||||
return (
|
||||
<div className='w-full h-full flex flex-col gap-8'>
|
||||
<div className='w-full h-full pb-8 flex flex-col gap-8'>
|
||||
{/* Menu */}
|
||||
<div className='grid grid-cols-3 gap-8'>
|
||||
<button name='orders' onClick={() => handleActiveMenu('orders')} className={`flex justify-center items-center px-2 py-3 large:px-4 large:py-5 rounded-md shadow-round_white bg-[#0E172E] text-white-body hover:scale-[1.1] ${active === 'orders' && 'scale-[1.2]'}`}>
|
||||
@@ -51,9 +46,9 @@ export default function RightAsideBar() {
|
||||
</div>
|
||||
|
||||
{/* Body */}
|
||||
{active === 'orders' && <RecentPaymentsBar data={recentData} isFetching={isFetching} isError={isError} error={error} />}
|
||||
{active === 'tickets' && <Tickets data={recentData} isFetching={isFetching} isError={isError} error={error} />}
|
||||
{active === 'tasks' && <Tasks data={recentData} isFetching={isFetching} isError={isError} error={error} />}
|
||||
{active === 'orders' && <RecentPaymentsBar data={data} isFetching={isFetching} isError={isError} error={error} />}
|
||||
{active === 'tickets' && <Tickets data={data} isFetching={isFetching} isError={isError} error={error} />}
|
||||
{active === 'tasks' && <Tasks data={data} isFetching={isFetching} isError={isError} error={error} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import React from 'react'
|
||||
import {Link} from 'react-router-dom'
|
||||
import Img from '../../../assets/user_avatar.jpg'
|
||||
import CustomCounter from '../../CustomCounter'
|
||||
|
||||
export default function Tickets({data, isFetching, isError, error}) {
|
||||
|
||||
const recentDeployment = data?.data?.recent_deployment_summary
|
||||
const recentSignup = data?.data?.recent_signup
|
||||
|
||||
|
||||
return (
|
||||
<div className='h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 overflow-y-auto aside-scroll-design'>
|
||||
<div className='h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 aside-scroll-design'>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<p className='text-base text-white-body font-bold'>Recent Deployments</p>
|
||||
{isFetching ?
|
||||
@@ -18,33 +24,33 @@ export default function Tickets({data, isFetching, isError, error}) {
|
||||
<div className='grid grid-cols-2 gap-4 sm:gap-6 large:gap-8'>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={18} timeInSeconds={1} />
|
||||
<CustomCounter targetNumber={recentDeployment?.pending} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Pending</p>
|
||||
</div>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={2} timeInSeconds={1} />
|
||||
<CustomCounter targetNumber={recentDeployment?.started} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Offers</p>
|
||||
<p className='text-sm text-slate-500'>Started</p>
|
||||
</div>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={3} timeInSeconds={1} />
|
||||
<CustomCounter targetNumber={recentDeployment?.stuck} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Created</p>
|
||||
<p className='text-sm text-slate-500'>Stuck</p>
|
||||
</div>
|
||||
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
|
||||
<p className='text-base font-bold text-white-body'>
|
||||
<CustomCounter targetNumber={1} timeInSeconds={1} />
|
||||
<CustomCounter targetNumber={recentDeployment?.completed} timeInSeconds={1} />
|
||||
</p>
|
||||
<p className='text-sm text-slate-500'>Rejected</p>
|
||||
<p className='text-sm text-slate-500'>Completed</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div className='flex flex-col gap-4'>
|
||||
<p className='text-base text-white-body font-bold'>Tracked Errors</p>
|
||||
<div className='overflow-y-auto h-full flex flex-col gap-4'>
|
||||
<p className='text-base text-white-body font-bold'>Recent Signup</p>
|
||||
{isFetching ?
|
||||
<div className='w-full flex justify-center'>
|
||||
<div className="w-6 h-6 border-2 border-gray-300 border-b-gray-500 rounded-full animate-spin"></div>
|
||||
@@ -54,42 +60,25 @@ export default function Tickets({data, isFetching, isError, error}) {
|
||||
<p className='text-base text-white-body font-bold'>{error?.message}</p>
|
||||
:
|
||||
<div className='flex flex-col gap-4'>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-3 items-center'>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>Project Briefing</p>
|
||||
<p className='text-sm text-slate-500'>Project Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
{recentSignup.map((item, index)=> {
|
||||
return (
|
||||
<Link
|
||||
to={`/account-view/${item?.member_uid}`}
|
||||
state={{customerID: item?.id, memberUID: item?.member_uid}}
|
||||
key={index}
|
||||
className='flex gap-3 items-center'
|
||||
>
|
||||
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
|
||||
<img src={Img} className='w-8' alt="Order" />
|
||||
</div>
|
||||
<div className='flex-col'>
|
||||
<p className='text-base font-bold text-white-body'>{item.firstname} {item.lastname}</p>
|
||||
<p className='text-sm text-slate-500'>{item.username}</p>
|
||||
</div>
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
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 AddTemplate() {
|
||||
|
||||
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 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'}`}>
|
||||
Custom ID
|
||||
</label>
|
||||
<InputText
|
||||
id='custom_id'
|
||||
placeholder='Custom ID'
|
||||
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'}`}>
|
||||
Provision Name
|
||||
</label>
|
||||
<InputText
|
||||
id='provision_name'
|
||||
placeholder='Provision Name'
|
||||
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...' : 'Add'}</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>
|
||||
)
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
import { getCustomTemplate } from '../../services/siteServices'
|
||||
import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString'
|
||||
import AddTemplate from './AddTemplate'
|
||||
|
||||
export default function CustomTemplates() {
|
||||
|
||||
@@ -50,7 +51,12 @@ export default function CustomTemplates() {
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Custom Templates' paths={['Dashboard', 'Custom Templates']} />
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body' style={{backgroundColor: 'aliceblue'}}>
|
||||
<div className='mb-3'>
|
||||
<b>Add New Custom Template</b>
|
||||
</div>
|
||||
<AddTemplate />
|
||||
</div>
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{ isError ?
|
||||
<p className='text-red-500'>{error?.message}</p>
|
||||
@@ -62,7 +68,8 @@ export default function CustomTemplates() {
|
||||
<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>
|
||||
<option value='custom_id'>Custom ID</option>
|
||||
<option value='provision_name'>Provision Name</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
import {useMutation} from '@tanstack/react-query'
|
||||
import {Formik, Form} from 'formik'
|
||||
import * as Yup from "yup";
|
||||
// import InputText from '../InputText'
|
||||
import {updateProduct} from '../../services/siteServices'
|
||||
// import queryKeys from '../../services/queryKeys';
|
||||
|
||||
|
||||
// To get the validation schema
|
||||
const validationSchema = Yup.object().shape({
|
||||
details: Yup.string().required("details text is required").min(6, 'must be upto 6 characters').max(500, 'must not exceed 500 characters'),
|
||||
sale_text: Yup.string().required("sales text is required").min(6, 'must be upto 6 characters').max(500, 'must not exceed 500 characters'),
|
||||
});
|
||||
|
||||
export default function ProductDetails({productDetails}) {
|
||||
|
||||
const initialValues = {
|
||||
details: productDetails?.details,
|
||||
sale_text: productDetails?.sale_text,
|
||||
};
|
||||
|
||||
// const queryClient = useQueryClient()
|
||||
|
||||
const productUpdate = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return updateProduct(fields)
|
||||
},
|
||||
onSuccess: () => {
|
||||
// queryClient.refetchQueries({
|
||||
// queryKey: [...queryKeys.custom_template],
|
||||
// // type: 'active',
|
||||
// // exact: true,
|
||||
// })
|
||||
},
|
||||
onSettled: ()=>{
|
||||
setTimeout(()=>{
|
||||
productUpdate.reset()
|
||||
}, 3000)
|
||||
}
|
||||
})
|
||||
|
||||
//FUNCTION TO HANDLE ADD TEMPLATE
|
||||
const handleSubmit = (values, helper) => {
|
||||
const reqData = {
|
||||
details: values.details,
|
||||
product_detail_id: productDetails?.product_detail_id,
|
||||
product_id: productDetails?.product_id,
|
||||
sale_text: values.sale_text,
|
||||
}
|
||||
productUpdate.mutate(reqData)
|
||||
};
|
||||
|
||||
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.details && props.touched.details) && '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='details'
|
||||
placeholder='Enter your description text here ...'
|
||||
name='details'
|
||||
value={props.values.details}
|
||||
onChange={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.sale_text && props.touched.sale_text) && '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='sale_text'
|
||||
placeholder='Enter your description text here ...'
|
||||
name='sale_text'
|
||||
value={props.values.sale_text}
|
||||
onChange={props.handleChange}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='h-10 my-5 text-end'>
|
||||
<button type='submit' disabled={productUpdate.isPending}
|
||||
className='px-4 h-full bg-primary text-white font-bold rounded-md'>{productUpdate.isPending ? 'loading...' : 'Update'}</button>
|
||||
</div>
|
||||
|
||||
{productUpdate.error &&
|
||||
<>
|
||||
<div className="w-full text-center">
|
||||
<p className='text-red-500 text-sm'>{productUpdate.error.message}</p>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
{productUpdate.isSuccess &&
|
||||
<>
|
||||
<div className="w-full text-center">
|
||||
<p className='text-emerald-500 text-sm'>{'Product Details Updated'}</p>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
)}
|
||||
</Formik>
|
||||
)
|
||||
}
|
||||
@@ -1,15 +1,19 @@
|
||||
import { useState } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
import { getProductsTemplate } from '../../services/siteServices'
|
||||
import { getProductsTemplate, setProductsTemplate } from '../../services/siteServices'
|
||||
// import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString'
|
||||
|
||||
export default function ProductTemplates() {
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
const [selected, setSelected] = useState('')
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
const [filter, setFilter] = useState({type: '', id: ''})
|
||||
const [willFilter, setWillFilter] = useState(false)
|
||||
@@ -43,9 +47,62 @@ export default function ProductTemplates() {
|
||||
},
|
||||
staleTime: 0 //0 mins
|
||||
})
|
||||
const productsTemData = data?.data?.templates // PRODUCTS TEMPLATE LIST
|
||||
const pagination = data?.data?.pagination
|
||||
// const productsTemData = data?.data?.templates // PRODUCTS TEMPLATE LIST
|
||||
// const pagination = data?.data?.pagination
|
||||
// console.log('DATA', data?.data)
|
||||
const [productsTemData, setProductsTemData] = useState([])
|
||||
const [pagination, setPagination] = useState({})
|
||||
useEffect(()=>{
|
||||
if(data){
|
||||
setProductsTemData(data?.data?.templates)
|
||||
setPagination(data?.data?.pagination)
|
||||
}
|
||||
},[data])
|
||||
|
||||
|
||||
const statusChange = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return setProductsTemplate(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.toUpperCase() === '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)
|
||||
|
||||
setTimeout(()=>{
|
||||
setSelected('')
|
||||
const NewData = productsTemData.map(item => { // remove later
|
||||
if(item.product_id === event.target.id){
|
||||
return ({...item, status: !item.status})
|
||||
}else{
|
||||
return item
|
||||
}
|
||||
})
|
||||
setProductsTemData(NewData)
|
||||
},3000) // remove later
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
@@ -62,7 +119,8 @@ export default function ProductTemplates() {
|
||||
<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>
|
||||
<option value='product_id'>Product ID</option>
|
||||
<option value='provision_name'>Provision Name</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className='w-full sm:max-w-48'>
|
||||
@@ -81,13 +139,10 @@ export default function ProductTemplates() {
|
||||
<th scope="col" className="px-2 py-2">
|
||||
Product ID
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Name
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
<th scope="col" className="px-8">
|
||||
Provision Name
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
<th scope="col" className="px-2 text-center">
|
||||
Status
|
||||
</th>
|
||||
</tr>
|
||||
@@ -102,19 +157,33 @@ export default function ProductTemplates() {
|
||||
</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">
|
||||
<td className="px-8">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.provision_name}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="text-base font-semibold">{item?.status}</div>
|
||||
<div className="flex justify-center">
|
||||
<>
|
||||
{selected === item?.product_id ?
|
||||
<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={item?.product_id}
|
||||
/>
|
||||
}
|
||||
</>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
import {useEffect} from 'react';
|
||||
import {useLocation, useNavigate} from 'react-router-dom'
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import { getProductView } from "../../services/siteServices";
|
||||
import ProductDetails from './ProductDetails';
|
||||
import RouteLinks from './../../RouteLinks'
|
||||
import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString';
|
||||
|
||||
export default function ProductView() {
|
||||
|
||||
const {state} = useLocation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(() => {
|
||||
const stateExist = () => {
|
||||
if (!state?.productID) {
|
||||
navigate(RouteLinks.homePage, {replace: true})
|
||||
}
|
||||
}
|
||||
stateExist()
|
||||
}, [])
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.product_view,
|
||||
queryFn: () => {
|
||||
const reqData = {
|
||||
// page,
|
||||
// ...filterData
|
||||
product_id : state?.productID
|
||||
}
|
||||
return getProductView(reqData)
|
||||
},
|
||||
staleTime: 0 // 0 mins
|
||||
})
|
||||
const productConfig = data?.data?.product_configuration // PRODUCT CONFIG
|
||||
const productDetails = data?.data?.product_details // PRODUCT DETAILS
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title={`Product View [${state?.productID}]`} paths={['Dashboard', 'Product View']}/>
|
||||
{isFetching ?
|
||||
<>
|
||||
<p className='text-slate-800'>Loading...</p>
|
||||
</>
|
||||
: isError ?
|
||||
<p className='text-red-500'>{error.message}</p>
|
||||
:
|
||||
<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">
|
||||
{productConfig?.product_id}
|
||||
</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">
|
||||
Description
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
{productConfig?.description}
|
||||
</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">
|
||||
Status
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
{productConfig?.status}
|
||||
</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">
|
||||
Added
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
{getDateTimeFromDateString(productConfig?.added)}
|
||||
</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">
|
||||
Banner
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
{productConfig?.banner}
|
||||
</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">
|
||||
UID
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
{productConfig?.uid}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p className='text-lg'>Product Details</p>
|
||||
<ProductDetails productDetails={productDetails} />
|
||||
|
||||
<div className='box bg-[aliceblue] dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
<div className='flex flex-col gap-2'>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -1,146 +1,203 @@
|
||||
import { useState } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import { useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import queryKeys from "../../services/queryKeys";
|
||||
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
import { getRecentSignup } from '../../services/siteServices'
|
||||
import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString'
|
||||
// import formatNumber from '../../helpers/formatNumber'
|
||||
// import formatNumber from '../../helpers/formatNumber'
|
||||
// import Avatar from '../../assets/user_avatar.jpg'
|
||||
import BreadcrumbCom from "../breadcrumb/BreadcrumbCom";
|
||||
import TablePaginatedWrapper from "../tableWrapper/TablePaginatedWrapper";
|
||||
import Icons from "../Icons";
|
||||
import { getRecentSignup } from "../../services/siteServices";
|
||||
import getDateTimeFromDateString from "../../helpers/getDateTimeFromDateString";
|
||||
import {Link} from 'react-router-dom';
|
||||
|
||||
|
||||
export default function RecentSignup() {
|
||||
const [page, setPage] = useState(1);
|
||||
const [filter, setFilter] = useState({ type: "", id: "" });
|
||||
const [willFilter, setWillFilter] = useState(false);
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
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) {
|
||||
return;
|
||||
} else if (!filter.type) {
|
||||
setPage(1);
|
||||
setWillFilter((prev) => !prev);
|
||||
setFilter({ type: "", id: "" });
|
||||
} else {
|
||||
setPage(1);
|
||||
setWillFilter((prev) => !prev);
|
||||
}
|
||||
};
|
||||
|
||||
const handleFilterByParams = () => {
|
||||
if(filter.type && !filter.id){
|
||||
return
|
||||
}else if(!filter.type){
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
setFilter({type: '', id: ''})
|
||||
}else{
|
||||
setPage(1)
|
||||
setWillFilter(prev => !prev)
|
||||
}
|
||||
}
|
||||
const { data, isFetching, isError, error } = useQuery({
|
||||
queryKey: [...queryKeys.recent_signup, page, willFilter],
|
||||
queryFn: () => {
|
||||
const filterData = filter?.type ? { [filter?.type]: filter.id } : {};
|
||||
const reqData = {
|
||||
page,
|
||||
...filterData,
|
||||
};
|
||||
return getRecentSignup(reqData);
|
||||
},
|
||||
staleTime: 0, //0 mins
|
||||
});
|
||||
const recentSignupData = data?.data?.members; // BILLINGS LIST
|
||||
const pagination = data?.data?.pagination;
|
||||
// console.log('DATA', data?.data)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.recent_signup, page, willFilter],
|
||||
queryFn: () => {
|
||||
const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
page,
|
||||
...filterData
|
||||
}
|
||||
return getRecentSignup(reqData)
|
||||
},
|
||||
staleTime: 0 //0 mins
|
||||
})
|
||||
const recentSignupData = data?.data?.payments // BILLINGS LIST
|
||||
const pagination = data?.data?.pagination
|
||||
// console.log('DATA', data?.data)
|
||||
return (
|
||||
<div className="w-full flex flex-col gap-8">
|
||||
<BreadcrumbCom
|
||||
title="Recent Signup"
|
||||
paths={["Dashboard", "Recent Acc"]}
|
||||
/>
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Recent Signup' paths={['Dashboard', 'Recent Acc']} />
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{ 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>
|
||||
</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 */}
|
||||
|
||||
<TablePaginatedWrapper data={recentSignupData} 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">
|
||||
Option Name
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Amount
|
||||
</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?.option_name}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="text-base font-semibold">${item?.amount}</div>
|
||||
{/* <div className="font-normal text-gray-500">{item?.external_url}</div> */}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="text-base font-semibold">{item?.status}</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 className="box bg-white dark:bg-black-box text-black-body dark:text-white-body">
|
||||
{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="username">Username</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>
|
||||
)
|
||||
}
|
||||
{/* end of filter section */}
|
||||
|
||||
<TablePaginatedWrapper
|
||||
data={recentSignupData}
|
||||
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">
|
||||
User Name /Email
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Name
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Country
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</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?.username}
|
||||
</div>
|
||||
<div className="text-base font-semibold">
|
||||
{item?.email}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="text-base font-semibold">
|
||||
{item?.firstname} {item?.lastname}
|
||||
</div>
|
||||
{/* <div className="font-normal text-gray-500">{item?.external_url}</div> */}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div className="text-base font-semibold">
|
||||
{item?.country}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td className="px-2 text-right">
|
||||
<div className="flex items-center justify-end gap-3 md:gap-4">
|
||||
<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={`/account-view/${item?.member_uid}`}
|
||||
state={{
|
||||
customerID: item?.id,
|
||||
memberUID: item?.member_uid,
|
||||
}}
|
||||
>
|
||||
<Icons name="eye" />
|
||||
</Link>
|
||||
</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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import React from 'react'
|
||||
import ModalWrapper from '../modals/ModalWrapper'
|
||||
import MainBtn from '../MainBtn'
|
||||
|
||||
export default function RebuildModal({data={}, templateRebuild, closeModal, proceedFunc}) {
|
||||
return (
|
||||
<ModalWrapper maxWidth='max-w-sm'>
|
||||
<div className='relative bg-white rounded-lg shadow-round_black dark:border-[1px] dark:border-[#1E2027] dark:bg-black-box dark:text-white'>
|
||||
{/* <!-- Modal header --> */}
|
||||
{/* <div className="p-8 sm:p-12 flex items-center justify-between border-b rounded-t border-gray-300 dark:border-gray-600">
|
||||
<h3 className="text-xl font-semibold text-gray-900 dark:text-white">
|
||||
EDIT
|
||||
</h3>
|
||||
<button onClick={closeModal} type="button" className="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide="default-modal">
|
||||
<svg className="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
|
||||
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
|
||||
</svg>
|
||||
<span className="sr-only">Close modal</span>
|
||||
</button>
|
||||
</div> */}
|
||||
{/* <!-- Modal body --> */}
|
||||
<div className='p-8 sm:p-12 mb-4 flex flex-col flex-wrap gap-4 lg:gap-8'>
|
||||
<div className='w-full text-center'>
|
||||
<p className='text-lg font-semibold mb-1'>Please confirm you want product rebuild to start</p>
|
||||
{templateRebuild.isPending && <p className='text-sm text-emerald-600'>Rebuild started ...</p>}
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between items-center gap-4'>
|
||||
<MainBtn
|
||||
onClick={proceedFunc}
|
||||
className={`bg-primary dark:bg-primary-dark px-2 py-1 mt-4 rounded-md text-white font-medium sm:self-end`}
|
||||
text='Proceed'
|
||||
/>
|
||||
<MainBtn
|
||||
type='button'
|
||||
className={`bg-red-500 px-2 py-1 mt-4 rounded-md text-white font-medium sm:self-end`}
|
||||
text='Cancel'
|
||||
onClick={closeModal}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ModalWrapper>
|
||||
)
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
|
||||
import {useLocation, useNavigate, Link} from 'react-router-dom'
|
||||
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import RouteLinks from '../../RouteLinks'
|
||||
import { getAccountView } from '../../services/siteServices'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
|
||||
export default function SubscriptionDetailViewCom() {
|
||||
|
||||
const {state:{memberUID}} = useLocation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(()=>{
|
||||
if(!memberUID){
|
||||
navigate(`/account-view/${memberUID}`, {replace: true, state:{memberUID}})
|
||||
}
|
||||
},[])
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.account_view,
|
||||
queryFn: () => {
|
||||
// const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
member_uid: memberUID
|
||||
// page,
|
||||
// ...filterData
|
||||
}
|
||||
// return getAccountView(reqData)
|
||||
},
|
||||
staleTime: 0 //0 mins
|
||||
})
|
||||
const subscriptionViewData = data?.data // SUBSCRIPTION VIEW DATA
|
||||
// console.log('DATA', payments, subscriptions)
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title={`Subscription View [${memberUID}]`} paths={['Dashboard', 'Subscription View']}/>
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
{isFetching ?
|
||||
<>
|
||||
<p className='text-slate-800'>Loading...</p>
|
||||
</>
|
||||
: isError ?
|
||||
<p className='text-red-500'>{error.message}</p>
|
||||
:
|
||||
<p className='text-slate-800'>Coming soon</p>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
import {useLocation, useNavigate} from 'react-router-dom'
|
||||
import {useQuery, useMutation} from '@tanstack/react-query'
|
||||
import {FaCaretDown} from "react-icons/fa";
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import {useEffect, useState} from 'react';
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
import {getSubscriptionsView, updateTemplate, updateCustomTemplate, rebuildTemplate} from '../../services/siteServices'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString';
|
||||
import RebuildModal from './RebuildModal';
|
||||
|
||||
export default function SubscriptionViewCom() {
|
||||
|
||||
|
||||
const {state} = useLocation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
const [rebuildStatus, setRebuildStatus] = useState({status: false, data: {}})
|
||||
|
||||
const [values, setValues] = useState({custom_id: '', template_uid: ''})
|
||||
|
||||
const handleValueChange = ({target: {name, value}}) => {
|
||||
if (name === 'custom_template') {
|
||||
setValues(prev => ({...prev, custom_id: value}))
|
||||
} else if (name === 'template') {
|
||||
setValues(prev => ({...prev, template_uid: value}))
|
||||
} else {
|
||||
setValues(prev => ({...prev}))
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const stateExist = () => {
|
||||
if (!state?.subscriptionUID) {
|
||||
navigate(RouteLinks.homePage, {replace: true})
|
||||
}
|
||||
}
|
||||
stateExist()
|
||||
}, [])
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.subscriptions_view,
|
||||
queryFn: () => {
|
||||
// const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
subscription_uid: state?.subscriptionUID
|
||||
// page,
|
||||
// ...filterData
|
||||
}
|
||||
return getSubscriptionsView(reqData)
|
||||
},
|
||||
staleTime: 0 //0 mins
|
||||
})
|
||||
const subscriptionViewData = data?.data // ACCOUNT VIEW DATA
|
||||
const customTemplates = subscriptionViewData?.available_custom_templates
|
||||
const availableTemplates = subscriptionViewData?.available_templates
|
||||
const selectedSubscription = subscriptionViewData?.subscription
|
||||
const currentCustomTem = subscriptionViewData?.available_custom_templates?.filter(item => item?.custom_id === subscriptionViewData?.subscription?.custom_template)[0]?.custom_id
|
||||
const currentTemplate = subscriptionViewData?.available_templates?.filter(item => item?.template_uid === subscriptionViewData?.subscription?.product_template)[0]?.template_uid
|
||||
// // console.log('subscriptionViewData', subscriptionViewData, currentCustomTem, currentTemplate)
|
||||
|
||||
// useEffect(()=>{
|
||||
// if(data){
|
||||
// const currentCustomTem = subscriptionViewData?.available_custom_templates?.filter(item => item?.custom_id == subscriptionViewData?.subscription?.custom_template)[0]?.custom_id
|
||||
// const currentTemplate = subscriptionViewData?.available_templates?.filter(item => item?.template_uid == subscriptionViewData?.subscription?.product_template)[0]?.template_uid
|
||||
// setValues({custom_id: currentCustomTem || '', template_uid: currentTemplate || ''})
|
||||
// }
|
||||
// },[data])
|
||||
|
||||
const templateRebuild = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return rebuildTemplate(fields)
|
||||
},
|
||||
onSettled: () => {
|
||||
setTimeout(() => {
|
||||
setRebuildStatus({status: false, data: {}})
|
||||
templateRebuild.reset()
|
||||
}, 3000)
|
||||
}
|
||||
})
|
||||
|
||||
const templateUpdate = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return updateTemplate(fields)
|
||||
},
|
||||
// onError: (error) => {
|
||||
// },
|
||||
// onSuccess: (res) => {
|
||||
// },
|
||||
onSettled: () => {
|
||||
setTimeout(() => {
|
||||
templateUpdate.reset()
|
||||
}, 3000)
|
||||
}
|
||||
})
|
||||
|
||||
const customTemplateUpdate = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return updateCustomTemplate(fields)
|
||||
},
|
||||
// onError: (error) => {
|
||||
// },
|
||||
// onSuccess: (res) => {
|
||||
// },
|
||||
onSettled: () => {
|
||||
setTimeout(() => {
|
||||
customTemplateUpdate.reset()
|
||||
}, 3000)
|
||||
}
|
||||
})
|
||||
|
||||
const handleUpdateTemplate = () => {
|
||||
const reqData = {
|
||||
subscrtiption_uid: state?.subscriptionUID,
|
||||
template_uid: values.template_uid
|
||||
}
|
||||
templateUpdate.mutate(reqData)
|
||||
}
|
||||
|
||||
const handleRebuildTemplate = () => {
|
||||
const reqData = {
|
||||
subscription_uid: state?.subscriptionUID,
|
||||
}
|
||||
templateRebuild.mutate(reqData)
|
||||
}
|
||||
|
||||
const handleUpdateCustomTemplate = () => {
|
||||
const reqData = {
|
||||
subscrtiption_uid: state?.subscriptionUID,
|
||||
custom_id: values.custom_id
|
||||
}
|
||||
customTemplateUpdate.mutate(reqData)
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title={`Subscription View [${state?.subscriptionUID}]`}
|
||||
paths={['Dashboard', 'Subscription View']}/>
|
||||
|
||||
{isFetching ?
|
||||
<>
|
||||
<p className='text-slate-800'>Loading...</p>
|
||||
</>
|
||||
: isError ?
|
||||
<p className='text-red-500'>{error.message}</p>
|
||||
:
|
||||
<>
|
||||
<div
|
||||
className='w-full box bg-white dark:bg-black-box text-black-body dark:text-white-body overflow-x-auto'>
|
||||
<table className="py-2 w-full text-sm bg-[aliceblue] dark:bg-transparent rounded-[10px]">
|
||||
<tbody>
|
||||
<tr className="py-2 border-t border-dashed border-slate-300">
|
||||
<td className="px-2 py-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{getDateTimeFromDateString(selectedSubscription?.added)}</div>
|
||||
<div className="text-base font-semibold">{getDateTimeFromDateString(selectedSubscription?.updated)}</div>
|
||||
<div className="text-base font-semibold">ID: {selectedSubscription?.id}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div
|
||||
className="text-base font-semibold">{selectedSubscription?.product_id}</div>
|
||||
<div><a href={`http://${selectedSubscription?.primary_server}:${selectedSubscription?.provision_port}`}
|
||||
target='_blank'
|
||||
rel="noreferrer">{selectedSubscription?.primary_server}:{selectedSubscription?.provision_port}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
|
||||
|
||||
<span className="text-base font-semibold">
|
||||
<a href={`https://${selectedSubscription?.internal_url}`}
|
||||
target='_blank'
|
||||
rel="noreferrer">{selectedSubscription?.internal_url}</a>
|
||||
</span>
|
||||
|
||||
<br/>
|
||||
<span className="text-base font-semibold">
|
||||
<a href={`${selectedSubscription?.external_url}`}
|
||||
target='_blank'
|
||||
rel="noreferrer">{selectedSubscription?.external_url}</a>
|
||||
</span>
|
||||
|
||||
<br/>
|
||||
|
||||
|
||||
<div className="text-base font-semibold">
|
||||
<br/><span>TM :</span> - {selectedSubscription?.template_name} - {selectedSubscription?.product_template} - {selectedSubscription?.flavor}
|
||||
<br/><span>CS :</span> {selectedSubscription?.custom_template}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<div
|
||||
className="text-base font-semibold">{selectedSubscription?.status}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-right">
|
||||
<button name='template'
|
||||
onClick={() => setRebuildStatus({status: true, data: {}})}
|
||||
className={`rounded-md p-2 bg-primary text-white text-center`}>
|
||||
Rebuild
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
|
||||
<div className='w-full'>
|
||||
<label className='font-medium'>Assign Template</label>
|
||||
<div className='flex flex-col xs:flex-row md:items-center gap-2'>
|
||||
<div className='w-full h-10 relative overflow-hidden rounded-md'>
|
||||
<select name='template' value={currentTemplate || values.template_uid}
|
||||
onChange={handleValueChange}
|
||||
className='w-full h-full p-2 appearance-none dark:bg-transparent border-0 dark:border-1 border-white ring-0 outline-none'>
|
||||
<option value=''>None</option>
|
||||
{availableTemplates && availableTemplates.map(item => (
|
||||
<option key={item?.template_uid}
|
||||
value={item?.template_uid}>{`${item?.product_id}-${item?.provision_name}`}</option>
|
||||
))}
|
||||
</select>
|
||||
<FaCaretDown className='text-base absolute top-1/2 -translate-y-1/2 right-2'/>
|
||||
</div>
|
||||
<button name='template' onClick={handleUpdateTemplate}
|
||||
disabled={(templateUpdate.isPending || !values.template_uid)}
|
||||
className={`rounded-md p-2 bg-primary text-white text-center ${(templateUpdate.isPending || !values.template_uid) && 'opacity-50'}`}>Update
|
||||
</button>
|
||||
</div>
|
||||
<p className={`p-2 mt-4 ${templateUpdate.isSuccess ? 'text-emerald-500' : 'text-red-500'}`}>{templateUpdate.isSuccess ? 'Template updated' : templateUpdate.isSuccess ? 'Unable to complete request, try again' : ''}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
|
||||
<div className='w-full'>
|
||||
<label className='font-medium'>Assign Custom Template</label>
|
||||
<div className='flex flex-col xs:flex-row md:items-center gap-2'>
|
||||
<div className='w-full h-10 relative overflow-hidden rounded-md'>
|
||||
<select name='custom_template' value={currentCustomTem || values.custom_id}
|
||||
onChange={handleValueChange}
|
||||
className='w-full h-full p-2 appearance-none dark:bg-transparent border-0 dark:border-1 border-white ring-0 outline-none'>
|
||||
<option value=''>None</option>
|
||||
{customTemplates && customTemplates.map(item => (
|
||||
<option key={item?.custom_id}
|
||||
value={item?.custom_id}>{`${item?.custom_id}-${item?.provision_name}`}</option>
|
||||
))}
|
||||
</select>
|
||||
<FaCaretDown className='text-base absolute top-1/2 -translate-y-1/2 right-2'/>
|
||||
</div>
|
||||
<button name='custom_template' onClick={handleUpdateCustomTemplate}
|
||||
disabled={(customTemplateUpdate.isPending || !values.custom_id)}
|
||||
className={`rounded-md p-2 bg-primary text-white text-center ${(customTemplateUpdate.isPending || !values.custom_id) && 'opacity-50'}`}>Update
|
||||
</button>
|
||||
</div>
|
||||
<p className={`p-2 mt-4 ${customTemplateUpdate.isSuccess ? 'text-emerald-500' : 'text-red-500'}`}>{customTemplateUpdate.isSuccess ? 'Custom Template updated' : customTemplateUpdate.isSuccess ? 'Unable to complete request, try again' : ''}</p>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
{rebuildStatus?.status &&
|
||||
<RebuildModal data={{}} templateRebuild={templateRebuild} proceedFunc={handleRebuildTemplate}
|
||||
closeModal={() => setRebuildStatus({status: false, data: {}})}/>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import formatNumber from '../../helpers/formatNumber';
|
||||
|
||||
export default function LoanChargeDetails({transactionID}) {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
const [page] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.loan_charges, page],
|
||||
|
||||
@@ -11,7 +11,7 @@ import formatNumber from '../../helpers/formatNumber';
|
||||
|
||||
export default function RepaymentScheduleDetails({transactionID}) {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
const [page] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.repayment_schedule, page],
|
||||
|
||||
@@ -11,7 +11,7 @@ import localImgLoader from '../../helpers/localImageLoader';
|
||||
|
||||
export default function TransactionDetails({transactionID}) {
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
const [page] = useState(1)
|
||||
|
||||
const {data, isFetching, isError, error} = useQuery({
|
||||
queryKey: [...queryKeys.transactions, page],
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { useState } from 'react'
|
||||
import {useState} from 'react'
|
||||
import {Link} from 'react-router-dom'
|
||||
|
||||
// import {Link} from 'react-router-dom'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import {useQuery} from '@tanstack/react-query'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
|
||||
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
|
||||
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
|
||||
import Icons from '../Icons'
|
||||
import { getSubscriptions } from '../../services/siteServices'
|
||||
import {getSubscriptions} from '../../services/siteServices'
|
||||
import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString';
|
||||
// import localImgLoader from '../../helpers/localImageLoader';
|
||||
// import RouteLinks from '../../RouteLinks';
|
||||
@@ -19,18 +19,18 @@ export default function SubscriptionsCom() {
|
||||
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)
|
||||
}
|
||||
@@ -53,108 +53,138 @@ export default function SubscriptionsCom() {
|
||||
|
||||
return (
|
||||
<div className='w-full flex flex-col gap-8'>
|
||||
<BreadcrumbCom title='Provisions' paths={['Dashboard', 'Provisions']} />
|
||||
<BreadcrumbCom title='Provisions' paths={['Dashboard', 'Provisions']}/>
|
||||
|
||||
<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='member_id'>Member ID</option>
|
||||
<option value='product_id'>Product ID</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='member_id'>Member ID</option>
|
||||
<option value='product_id'>Product ID</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={subscriptionData} 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">
|
||||
Product
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
URL
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Status
|
||||
</th>
|
||||
<th scope="col" className="px-2 text-right">
|
||||
Action
|
||||
</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'>
|
||||
{/* <img className="w-10 h-10 rounded-md" src={localImgLoader(`loan_icons/${item?.type}.png`)} alt="Icon" /> */}
|
||||
<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?.product_id}</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base font-semibold">{item?.internal_url}</div>
|
||||
<div className="font-normal text-gray-500">{item?.external_url}</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 text-right">
|
||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||
<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={`/subscription-view/${item?.subscription_uid}`}
|
||||
state={{customerID: item?.id, memberUID: item?.member_uid}}>
|
||||
<Icons name='eye'/>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<TablePaginatedWrapper data={subscriptionData} 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/Updated
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Product/Server
|
||||
</th>
|
||||
<th scope="col" className="px-2">
|
||||
Internal-URL/External-URL/SubscriptionUID
|
||||
</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'>
|
||||
{/* <img className="w-10 h-10 rounded-md" src={localImgLoader(`loan_icons/${item?.type}.png`)} alt="Icon" /> */}
|
||||
<div className="text-left">
|
||||
<div
|
||||
className="text-base font-semibold">
|
||||
{getDateTimeFromDateString(item?.added)}<br/>
|
||||
{getDateTimeFromDateString(item?.updated)}<br/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div
|
||||
className="text-base font-semibold">
|
||||
{item?.product_id}
|
||||
<br/>
|
||||
<a href={`http://${item?.primary_server}:${item?.provision_port}`}
|
||||
target='_blank'
|
||||
rel="noreferrer">{item?.primary_server}:{item?.provision_port}</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-2">
|
||||
<div className="text-left">
|
||||
<div className="text-base">
|
||||
<span>Int :</span><a href={`https://${item?.internal_url}`}
|
||||
target='_blank'
|
||||
rel="noreferrer"> {item?.internal_url}</a>
|
||||
<br/>
|
||||
<span>Ext :</span><a href={`https://${item?.external_url}`}
|
||||
target='_blank'
|
||||
rel="noreferrer"> {item?.external_url}</a>
|
||||
<br/>
|
||||
{item?.subscription_uid}</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 text-right">
|
||||
<div className='flex items-center justify-end gap-3 md:gap-4'>
|
||||
<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={`/subscription-view/${item?.subscription_uid}`}
|
||||
state={{
|
||||
customerID: item?.id,
|
||||
subscriptionUID: item?.subscription_uid
|
||||
}}
|
||||
>
|
||||
<Icons name='eye'/>
|
||||
</Link>
|
||||
</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>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
import AccountEditCom from "../components/account_edit/AccountEditCom";
|
||||
export default function AccountEditPage() {
|
||||
return (
|
||||
<AccountEditCom />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from 'react'
|
||||
import CountrySettings from "../components/country/CountrySettings";
|
||||
|
||||
export default function CountrySettingsPage() {
|
||||
return (
|
||||
<CountrySettings />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from 'react'
|
||||
import FileUploadCom from "../components/file_uploads/FileUploadCom";
|
||||
|
||||
export default function FilesUploadPage() {
|
||||
return (
|
||||
<FileUploadCom />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from 'react'
|
||||
import ProductView from "../components/products/ProductView";
|
||||
|
||||
export default function ProductViewPage() {
|
||||
return (
|
||||
<ProductView />
|
||||
)
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import React from 'react'
|
||||
import SubscriptionDetailViewCom from "../components/subscription_view/SubscriptionDetailViewCom";
|
||||
export default function SubscriptionDetailViewPage() {
|
||||
return (
|
||||
<SubscriptionDetailViewCom />
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
import SubscriptionViewCom from "../components/subscription_view/SubscriptionViewCom";
|
||||
export default function SubscriptionDetailsPage() {
|
||||
return (
|
||||
<SubscriptionViewCom />
|
||||
)
|
||||
}
|
||||
@@ -11,7 +11,7 @@ export default function TransactionDetailsPage() {
|
||||
if(!state?.transactionID){
|
||||
navigate('/', {replace: true})
|
||||
}
|
||||
},[state])
|
||||
},[navigate, state])
|
||||
return (
|
||||
<TransactionDetailsCom id={state?.transactionID} />
|
||||
)
|
||||
|
||||
@@ -20,7 +20,10 @@ const queryKeys = {
|
||||
products_template: ['products_template'],
|
||||
custom_template: ['custom_template'],
|
||||
account_view: ['account_view'],
|
||||
subscriptions_view: ['subscriptions_view'],
|
||||
users_admin: ['users_admin'],
|
||||
country_list: ['country_list'],
|
||||
product_view: ['product_view'],
|
||||
}
|
||||
|
||||
export default queryKeys
|
||||
@@ -62,12 +62,38 @@ export const getCustomers = (reqData) => {
|
||||
return getAuxEnd(`/customers`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET COUNTRY
|
||||
export const getCountry = (reqData) => {
|
||||
const postData = { ...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 }
|
||||
return getAuxEnd(`/billings`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET FILES
|
||||
export const getFilesUpload = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/file-uploads`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET SUBSCRIPTIONS
|
||||
export const getSubscriptions = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
@@ -104,6 +130,54 @@ export const getProductsTemplate = (reqData) => {
|
||||
return getAuxEnd(`/products-templates`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO SET COUNTRY
|
||||
export const setProductsTemplate = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/set-product', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO INITIATE TEMPLATE REBUILD
|
||||
export const rebuildTemplate = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/rebuild-template', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO UPDATE TEMPLATE
|
||||
export const updateTemplate = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/template/set-template', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO UPDATE CUSTOM TEMPLATE
|
||||
export const updateCustomTemplate = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/template/set-custom', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO ADD CUSTOM TEMPLATE
|
||||
export const addCustomTemplate = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/template/custom-add', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO ADD CUSTOM TEMPLATE
|
||||
export const updateProduct = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/product-update', postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET CUSTOM TEMPLATE DATA
|
||||
export const getCustomTemplate = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
@@ -116,6 +190,12 @@ export const getAccountView = (reqData) => {
|
||||
return getAuxEnd(`/account-view`, postData)
|
||||
}
|
||||
|
||||
// FUNCTION TO GET SUBSCRIPTIONS VIEW DATA
|
||||
export const getSubscriptionsView = (reqData) => {
|
||||
const postData = { ...reqData }
|
||||
return getAuxEnd(`/subscription-view`, postData)
|
||||
}
|
||||
|
||||
|
||||
// FUNCTION TO GET LOANS TABLE
|
||||
export const getLoans = (reqData) => {
|
||||
|
||||
Reference in New Issue
Block a user