Compare commits

...

17 Commits

Author SHA1 Message Date
victorAnumudu ec1402f610 link error isued fixed 2025-09-29 18:36:10 +01:00
CHIEFSOFT\ameye 4481dae24e add templates 2025-09-29 11:53:25 -04:00
ameye 68eb0f9abc Merge branch 'account-profile-data' of MERMS/MermsFirstOffice into master 2025-09-29 14:02:20 +00:00
victorAnumudu b5a5452a0d bg color fix 2025-09-29 11:24:35 +01:00
victorAnumudu 0a66679950 padding fix 2025-09-29 11:11:50 +01:00
victorAnumudu fd9eb08cea fixed profile table data 2025-09-29 11:06:04 +01:00
CHIEFSOFT\ameye 1e28046093 clean up 2025-09-28 22:42:51 -04:00
CHIEFSOFT\ameye 4b39b73931 more data 2025-09-28 15:28:49 -04:00
CHIEFSOFT\ameye 54bfe7affa Fix layout 2025-09-28 14:44:26 -04:00
ameye d7cfb03550 Merge branch 'account-view-section-fix' of MERMS/MermsFirstOffice into master 2025-09-28 17:56:30 +00:00
victorAnumudu 2324980cf4 account view subscription table data fixed 2025-09-28 14:31:40 +01:00
victorAnumudu ebcde80a3d account view subscription table data fixed 2025-09-28 14:31:22 +01:00
CHIEFSOFT\ameye 9a0ed2d78c home lnk 2025-09-28 08:08:36 -04:00
CHIEFSOFT\ameye 5783dfd521 Office subscription 2025-09-28 07:40:48 -04:00
CHIEFSOFT\ameye b26df44c19 Details pages 2025-09-27 16:47:13 -04:00
CHIEFSOFT\ameye 2a92649eec Adding Customer page details 2025-09-27 14:02:30 -04:00
ameye 52193f0baa Merge branch 'custom-template-fix' of MERMS/MermsFirstOffice into master 2025-09-23 16:19:26 +00:00
14 changed files with 767 additions and 263 deletions
+1
View File
@@ -3,6 +3,7 @@ const RouteLinks = {
homePage: '/', homePage: '/',
customerPage: '/customer', customerPage: '/customer',
accountDetails: '/account-view/*', accountDetails: '/account-view/*',
subscriptionDetails: '/subscription-view/*',
subscriptions: '/subscriptions', subscriptions: '/subscriptions',
billings: '/billings', billings: '/billings',
recentSignup: '/recent-signup', recentSignup: '/recent-signup',
+3 -1
View File
@@ -19,7 +19,8 @@ import LoansPage from './pages/LoansPage' // SELECTED LOANS PAGE
import TransactionDetailsPage from './pages/TransactionDetailsPage' import TransactionDetailsPage from './pages/TransactionDetailsPage'
import AccountDetailsPage from "./pages/AccountDetailsPage"; import AccountDetailsPage from "./pages/AccountDetailsPage";
import ProductTemplatePage from "./pages/ProductTemplatePage"; import ProductTemplatePage from "./pages/ProductTemplatePage";
import CustomTemplatePage from "./pages/CustomTemplatePage"; // TRANSACTION DETAILS PAGE import CustomTemplatePage from "./pages/CustomTemplatePage";
import SubscriptionDetailsPage from "./pages/SubscriptionDetailsPage"; // TRANSACTION DETAILS PAGE
// const Home = lazy(() => import('./pages/Home')); // const Home = lazy(() => import('./pages/Home'));
@@ -45,6 +46,7 @@ export default function SiteRoutes() {
<Route path={RouteLinks.loansPage} element={<LoansPage/>}/> {`*/LOANS PAGE*/`} <Route path={RouteLinks.loansPage} element={<LoansPage/>}/> {`*/LOANS PAGE*/`}
<Route path={RouteLinks.transaction_details_page} <Route path={RouteLinks.transaction_details_page}
element={<TransactionDetailsPage/>}/> {`*/TRANSACTION PAGE*/`} element={<TransactionDetailsPage/>}/> {`*/TRANSACTION PAGE*/`}
<Route path={RouteLinks.subscriptionDetails} element={<SubscriptionDetailsPage/>} />
</Route> </Route>
{/* ERROR PAGE */} {/* ERROR PAGE */}
@@ -0,0 +1,61 @@
export default function AccountProfileView({profile}) {
return <>
<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="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">
Member ID
</th>
<th scope="col" className="px-2">
Practice/specialization
</th>
<th scope="col" className="px-2">
URL Name
</th>
</tr>
</thead>
<tbody>
{(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>
</>
}
+22 -9
View File
@@ -7,15 +7,19 @@ import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
import RouteLinks from '../../RouteLinks' import RouteLinks from '../../RouteLinks'
import { getAccountView } from '../../services/siteServices' import { getAccountView } from '../../services/siteServices'
import queryKeys from '../../services/queryKeys' 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() { export default function AccountViewCom() {
const {state:{memberUID}} = useLocation() const {state} = useLocation()
const navigate = useNavigate() const navigate = useNavigate()
useEffect(()=>{ useEffect(()=>{
if(!memberUID){ if(!state?.memberUID){
navigate(RouteLinks.customerPage, {replace: true}) navigate(RouteLinks.homePage, {replace: true})
} }
},[]) },[])
@@ -24,7 +28,7 @@ export default function AccountViewCom() {
queryFn: () => { queryFn: () => {
// const filterData = filter?.type ? {[filter?.type]: filter.id} : {} // const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
const reqData = { const reqData = {
member_uid: memberUID member_uid: state?.memberUID
// page, // page,
// ...filterData // ...filterData
} }
@@ -32,13 +36,16 @@ export default function AccountViewCom() {
}, },
staleTime: 0 //0 mins staleTime: 0 //0 mins
}) })
const accountsViewData = data?.data?.products // ACCOUNT VIEW DATA const accountsViewData = data?.data // ACCOUNT VIEW DATA
const pagination = data?.data?.pagination const account_info = accountsViewData?.account
console.log('DATA', data?.data) const account_profile = accountsViewData?.account_profile
const subscriptions = accountsViewData?.subscriptions
const payments = accountsViewData?.payments
// console.log('DATA', payments, subscriptions)
return ( return (
<div className='w-full flex flex-col gap-8'> <div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title={`Account View [${memberUID}]`} paths={['Dashboard', 'Account View']}/> <BreadcrumbCom title={`Account View [${state?.memberUID}]`} paths={['Dashboard', 'Account View']}/>
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'> <div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
{isFetching ? {isFetching ?
@@ -48,7 +55,13 @@ export default function AccountViewCom() {
: isError ? : isError ?
<p className='text-red-500'>{error.message}</p> <p className='text-red-500'>{error.message}</p>
: :
<p className='text-slate-800'>coming soon</p> <>
<CustomerAccountView accountInfo={account_info} />
<AccountProfileView profile={account_profile} />
<CustomerSubscriptionsView subscriptions={subscriptions} />
<CustomerPaymentsView payments={payments} />
</>
} }
</div> </div>
@@ -0,0 +1,93 @@
import {Link} from 'react-router-dom'
import Icons from "../Icons";
export default function CustomerAccountView({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 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 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`}
>
<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={6}>
<div className="flex justify-center items-center">
No Record Found
</div>
</td>
</tr>
}
</tbody>
</table>
</>
</div>
</div>
</div>
</>
}
@@ -0,0 +1,77 @@
export default function CustomerPaymentsView({payments}) {
return <>
<div className="pb-5">
<div className="flex flex-col gap-1">
<div className="w-full">
<h4 className="font-semibold text-lg">Payments</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">
#
</th>
<th scope="col" className="px-2">
Added
</th>
<th scope="col" className="px-2">
Option Name
</th>
<th scope="col" className="px-2">
Amount
</th>
<th scope="col" className="px-2">
Currency
</th>
</tr>
</thead>
<tbody>
{(payments && payments.length > 0) ? payments?.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">{index+1}</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<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?.option_name}</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<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>
))
:
<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>
</div>
</>
}
@@ -0,0 +1,97 @@
import getDateTimeFromDateString from "../../helpers/getDateTimeFromDateString";
import RouteLinks from "../../RouteLinks";
import Icons from "../Icons";
import {Link} from 'react-router-dom'
export default function CustomerSubscriptionsView({subscriptions}) {
return <>
<div className="pb-5">
<div className="flex flex-col gap-1">
<div className="w-full">
<h4 className="font-semibold text-lg">Subscriptions</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">
#
</th>
<th scope="col" className="px-2">
Added
</th>
<th scope="col" className="px-2">
Product
</th>
<th scope="col" className="px-2">
URL / Templates
</th>
<th scope="col" className="px-2">
Status
</th>
<th scope="col" className="px-2 text-right">
Action
</th>
</tr>
</thead>
<tbody>
{(subscriptions && subscriptions.length > 0) ? subscriptions?.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">{index+1}</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<div className="text-base font-semibold">{getDateTimeFromDateString(item?.added)}</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}
<br /><span>Template :</span> {item?.product_template}
<br /><span>Custom :</span> {item?.custom_template}
</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={6}>
<div className="flex justify-center items-center">
No Record Found
</div>
</td>
</tr>
}
</tbody>
</table>
</>
</div>
</div>
</div>
</>
}
+35 -22
View File
@@ -31,12 +31,14 @@ export default function HomeCom() {
{(isFetching || isError) ? {(isFetching || isError) ?
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'> <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>} {isError ? <p className='text-red-500'>{error.message}</p> :
<p className='text-slate-800'>Loading...</p>}
</div> </div>
: :
<div className='grid grid-cols-1 gap-8'> <div className='grid grid-cols-1 gap-8'>
<div className='w-full grid grid-cols-1 xl:grid-cols-3 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'> <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> <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'> <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-3xl sm:text-[39px]'><span className='text-xl sm:text-2xl'>{dashData?.loans?.currency_text}</span><CustomCounter targetNumber={dashData?.loans?.value} timeInSeconds='1' /></p> */}
@@ -47,7 +49,8 @@ export default function HomeCom() {
<p className='sm:text-[13.9px]'>{dashData?.loans?.text}</p> <p className='sm:text-[13.9px]'>{dashData?.loans?.text}</p>
</div> </div>
</div> </div>
<div className='box min-h-[230] justify-between bg-[#CBF0F5] dark:bg-black-box text-black-body dark:text-white-body'> <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> <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'> <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'> <p className='text-xl sm:text-[30px]'><span className='text-lg sm:text-xl'>
@@ -57,18 +60,21 @@ export default function HomeCom() {
<p className='sm:text-[13.9px]'>{dashData?.payments?.text}</p> <p className='sm:text-[13.9px]'>{dashData?.payments?.text}</p>
</div> </div>
</div> </div>
<div className='box min-h-[230] justify-between bg-[#CBD4F4] dark:bg-black-box text-black-body dark:text-white-body'> <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> <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'> <div className='grid grid-cols-2 gap-4 font-bold'>
{ {
Object.values(dashData?.request_summary).map((item, index) => { Object.values(dashData?.request_summary).map((item, index) => {
return ( return (
<div key={index} className='flex items-center gap-2'> <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'> <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'/> <Icons name='sales'/>
</div> </div>
<div> <div>
<p className='font-bold text-base'><CustomCounter targetNumber={Object.values(item)[0]} timeInSeconds='1' /></p> <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> <p className='text-12 text-slate-500'>{Object.keys(item)[0]}</p>
</div> </div>
</div> </div>
@@ -114,41 +120,47 @@ export default function HomeCom() {
return ( return (
<tr key={item?.id} className="py-2 border-t border-dashed border-slate-300"> <tr key={item?.id} className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2"> <td className="px-2 py-2">
<div className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'> <div
<img className="w-10 h-10 rounded-md" src={localImgLoader(`loan_icons/select_offer.png`)} alt="Icon" /> 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-left">
<div className="text-base font-semibold">{item?.product_id}</div> <div
<div className="font-normal text-gray-500">{getDateFromDateString(item?.added)} {getTimeFromDateString(item?.added)}</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>
</div> </div>
</td> </td>
<td className="px-2"> <td className="px-2">
<div className="text-left"> <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="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 className="font-normal text-gray-500">{item?.status}</div>
</div> </div>
</td> </td>
<td className="px-2"> <td className="px-2">
<div className="text-left"> <div className="text-left">
<div className="font-normal text-gray-500">50%</div> <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
<div className={`absolute left-0 h-full w-1/2 bg-emerald-600`}></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>
</div> </div>
</td> </td>
<td className="px-2 text-right"> <td className="px-2 text-right">
<div className='flex items-center justify-end gap-3 md:gap-4'> <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'> <div
<Icons name='edit' /> className='p-2 flex justify-center items-center text-slate-500 bg-white-body dark:text-white-body dark:bg-black-body rounded-md'>
</div> */} <Link to={`/subscription-view/${item?.uid}`}
<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'> state={{subscriptionUID: item?.uid}}
<Link to={RouteLinks.transaction_details_page} state={{transactionID: item?.transaction_id}}> >
<Icons name='eye'/> <Icons name='eye'/>
</Link> </Link>
</div> </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> </div>
</td> </td>
</tr> </tr>
@@ -171,7 +183,8 @@ export default function HomeCom() {
{dashData?.subscription.length > 10 && {dashData?.subscription.length > 10 &&
<tr className="py-2 border-t border-dashed text-right text-primary border-slate-300"> <tr className="py-2 border-t border-dashed text-right text-primary border-slate-300">
<td className="px-3 py-2" colSpan={4}> <td className="px-3 py-2" colSpan={4}>
<Link to={RouteLinks.transactionsPage} className="flex justify-end items-center"> <Link to={RouteLinks.transactionsPage}
className="flex justify-end items-center">
More ... More ...
</Link> </Link>
</td> </td>
+6 -1
View File
@@ -50,7 +50,11 @@ export default function CustomTemplates() {
return ( return (
<div className='w-full flex flex-col gap-8'> <div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title='Custom Templates' paths={['Dashboard', 'Custom Templates']} /> <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'}}>
<b>Add New Custom Template</b>
</div>
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'> <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> <p className='text-red-500'>{error?.message}</p>
@@ -62,7 +66,8 @@ export default function CustomTemplates() {
<div className='w-full sm:max-w-48'> <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}> <select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md' onChange={handleFilter}>
<option value=''>All</option> <option value=''>All</option>
<option value='name'>Name</option> <option value='custom_id'>Custom ID</option>
<option value='provision_name'>Provision Name</option>
</select> </select>
</div> </div>
<div className='w-full sm:max-w-48'> <div className='w-full sm:max-w-48'>
@@ -0,0 +1,97 @@
import {useLocation, useNavigate, Link} from 'react-router-dom'
import { useQuery } from '@tanstack/react-query'
import { FaCaretDown } from "react-icons/fa";
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
import {useEffect} from 'react';
import RouteLinks from '../../RouteLinks';
import { getSubscriptionsView } from '../../services/siteServices'
import queryKeys from '../../services/queryKeys'
export default function SubscriptionViewCom() {
const {state} = useLocation()
const navigate = useNavigate()
useEffect(() => {
if (!state?.subscriptionUID) {
navigate(RouteLinks.homePage, {replace: true})
}
}, [])
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
console.log('subscriptionViewData', subscriptionViewData)
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='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
<div>
Repeat the Subscription at the top
</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 Template</label>
<div className='flex flex-col md:flex-row md:items-center gap-2'>
<div className='w-full relative'>
<select className='w-full p-2'>
<option value=''>None</option>
</select>
<FaCaretDown className='text-base absolute top-1/2 -translate-y-1/2 right-2' />
</div>
<button>Update</button>
</div>
</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 md:flex-row md:items-center gap-2'>
<div className='w-full relative'>
<select className='w-full p-2'>
<option value=''>None</option>
</select>
<FaCaretDown className='text-base absolute top-1/2 -translate-y-1/2 right-2' />
</div>
<button>Update</button>
</div>
</div>
</div>
</>
}
</div>
)
}
@@ -1,4 +1,6 @@
import {useState} from 'react' import {useState} from 'react'
import {Link} from 'react-router-dom'
// 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 queryKeys from '../../services/queryKeys'
@@ -62,59 +64,76 @@ export default function SubscriptionsCom() {
<div className='px-2 py-2 mb-4 flex flex-col sm:flex-row flex-wrap sm:items-center gap-2'> <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'/> <Icons name='filter' className='text-3xl'/>
<div className='w-full sm:max-w-48'> <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}> <select name='type' value={filter?.type} className='h-10 w-full p-2 rounded-md'
onChange={handleFilter}>
<option value=''>All</option> <option value=''>All</option>
<option value='member_id'>Member ID</option> <option value='member_id'>Member ID</option>
<option value='product_id'>Product ID</option> <option value='product_id'>Product ID</option>
</select> </select>
</div> </div>
<div className='w-full sm:max-w-48'> <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} /> <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> </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> <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 */} {/* end of filter section */}
<TablePaginatedWrapper data={subscriptionData} isFetching={isFetching} setPage={setPage} itemsPerPage={pagination?.limit} pagination={pagination}> <TablePaginatedWrapper data={subscriptionData} isFetching={isFetching} setPage={setPage}
itemsPerPage={pagination?.limit} pagination={pagination}>
{({data}) => ( {({data}) => (
<> <>
<table className="py-2 w-full text-sm"> <table className="py-2 w-full text-sm">
<thead className="py-2 text-sm text-slate-500 text-left"> <thead className="py-2 text-sm text-slate-500 text-left">
<tr> <tr>
<th scope="col" className="px-2 py-2"> <th scope="col" className="px-2 py-2">
Added Added/Updated
</th> </th>
<th scope="col" className="px-2"> <th scope="col" className="px-2">
Product Product
</th> </th>
<th scope="col" className="px-2"> <th scope="col" className="px-2">
URL Internal-URL/External-URL/SubscriptionUID
</th> </th>
<th scope="col" className="px-2 text-right"> <th scope="col" className="px-2 text-right">
Status Status
</th> </th>
<th scope="col" className="px-2 text-right">
Action
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{(data && data.length > 0) ? data?.map((item, index) => ( {(data && data.length > 0) ? data?.map((item, index) => (
<tr key={index} className="py-2 border-t border-dashed border-slate-300"> <tr key={index} className="py-2 border-t border-dashed border-slate-300">
<td className="px-2 py-2"> <td className="px-2 py-2">
<div className='w-full min-w-48 flex items-center gap-2 whitespace-nowrap'> <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" /> */} {/* <img className="w-10 h-10 rounded-md" src={localImgLoader(`loan_icons/${item?.type}.png`)} alt="Icon" /> */}
<div className="text-left"> <div className="text-left">
<div className="text-base font-semibold">{getDateTimeFromDateString(item?.added)}</div> <div
className="text-base font-semibold">
{getDateTimeFromDateString(item?.added)}<br />
{getDateTimeFromDateString(item?.updated)}<br />
</div>
</div> </div>
</div> </div>
</td> </td>
<td className="px-2"> <td className="px-2">
<div className="text-left"> <div className="text-left">
<div className="text-base font-semibold">{item?.product_id}</div> <div
className="text-base font-semibold">{item?.product_id}</div>
</div> </div>
</td> </td>
<td className="px-2"> <td className="px-2">
<div className="text-left"> <div className="text-left">
<div className="text-base font-semibold">{item?.internal_url}</div> <div className="text-base font-semibold ">
<div className="font-normal text-gray-500">{item?.external_url}</div> <span>Int :</span> {item?.internal_url}<br/>
<span>Ext :</span> {item?.external_url}<br/>
{item?.subscription_uid}</div>
</div> </div>
</td> </td>
<td className="px-2"> <td className="px-2">
@@ -122,6 +141,18 @@ export default function SubscriptionsCom() {
<div className="text-base font-semibold">{item?.status}</div> <div className="text-base font-semibold">{item?.status}</div>
</div> </div>
</td> </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>
)) ))
: :
+7
View File
@@ -0,0 +1,7 @@
import React from 'react'
import SubscriptionViewCom from "../components/subscription_view/SubscriptionViewCom";
export default function SubscriptionDetailsPage() {
return (
<SubscriptionViewCom />
)
}
+1
View File
@@ -20,6 +20,7 @@ const queryKeys = {
products_template: ['products_template'], products_template: ['products_template'],
custom_template: ['custom_template'], custom_template: ['custom_template'],
account_view: ['account_view'], account_view: ['account_view'],
subscriptions_view: ['subscriptions_view'],
users_admin: ['users_admin'], users_admin: ['users_admin'],
} }
+6
View File
@@ -116,6 +116,12 @@ export const getAccountView = (reqData) => {
return getAuxEnd(`/account-view`, postData) return getAuxEnd(`/account-view`, postData)
} }
// FUNCTION TO GET SUBSCRIPTIONS VIEW DATA
export const getSubscriptionsView = (reqData) => {
const postData = { ...reqData }
return getAuxEnd(`/subcription-view`, postData)
}
// FUNCTION TO GET LOANS TABLE // FUNCTION TO GET LOANS TABLE
export const getLoans = (reqData) => { export const getLoans = (reqData) => {