Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ec1402f610 | |||
| 4481dae24e | |||
| 68eb0f9abc |
@@ -14,12 +14,12 @@ import CustomerPaymentsView from "./CustomerPaymentsView";
|
||||
|
||||
export default function AccountViewCom() {
|
||||
|
||||
const {state:{memberUID}} = useLocation()
|
||||
const {state} = useLocation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(()=>{
|
||||
if(!memberUID){
|
||||
navigate(RouteLinks.customerPage, {replace: true})
|
||||
if(!state?.memberUID){
|
||||
navigate(RouteLinks.homePage, {replace: true})
|
||||
}
|
||||
},[])
|
||||
|
||||
@@ -28,7 +28,7 @@ export default function AccountViewCom() {
|
||||
queryFn: () => {
|
||||
// const filterData = filter?.type ? {[filter?.type]: filter.id} : {}
|
||||
const reqData = {
|
||||
member_uid: memberUID
|
||||
member_uid: state?.memberUID
|
||||
// page,
|
||||
// ...filterData
|
||||
}
|
||||
@@ -45,7 +45,7 @@ export default function AccountViewCom() {
|
||||
|
||||
return (
|
||||
<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'>
|
||||
{isFetching ?
|
||||
@@ -58,7 +58,7 @@ export default function AccountViewCom() {
|
||||
<>
|
||||
<CustomerAccountView accountInfo={account_info} />
|
||||
<AccountProfileView profile={account_profile} />
|
||||
<CustomerSubscriptionsView subscriptions={subscriptions} memberUID={memberUID} />
|
||||
<CustomerSubscriptionsView subscriptions={subscriptions} />
|
||||
<CustomerPaymentsView payments={payments} />
|
||||
</>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ 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">
|
||||
@@ -70,7 +70,7 @@ 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/${item?.subscription_uid}`} 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>
|
||||
|
||||
@@ -155,7 +155,9 @@ export default function HomeCom() {
|
||||
<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}`}>
|
||||
<Link to={`/subscription-view/${item?.uid}`}
|
||||
state={{subscriptionUID: item?.uid}}
|
||||
>
|
||||
<Icons name='eye'/>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -50,7 +50,11 @@ 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'}}>
|
||||
<b>Add New Custom Template</b>
|
||||
|
||||
|
||||
</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 +66,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'>
|
||||
|
||||
@@ -1,32 +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 {useEffect} from 'react';
|
||||
import RouteLinks from '../../RouteLinks';
|
||||
import { getSubscriptionsView } from '../../services/siteServices'
|
||||
import queryKeys from '../../services/queryKeys'
|
||||
|
||||
export default function SubscriptionViewCom() {
|
||||
|
||||
const subscriptionUID = "63554d40-9ba1-4afe-80c2-ca147236f7ee";
|
||||
|
||||
const {state:{memberUID}} = useLocation()
|
||||
const {state} = useLocation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(()=>{
|
||||
if(!memberUID){
|
||||
navigate(`/account-view/${memberUID}`, {replace: true, state:{memberUID}})
|
||||
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 [${memberUID}]`} paths={['Dashboard', 'Subscription View']}/>
|
||||
<BreadcrumbCom title={`Subscription View [${state?.subscriptionUID}]`} 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>
|
||||
:
|
||||
<>
|
||||
<div className='box bg-white dark:bg-black-box text-black-body dark:text-white-body'>
|
||||
|
||||
<>
|
||||
Show all here
|
||||
</>
|
||||
<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>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -146,7 +146,7 @@ export default function SubscriptionsCom() {
|
||||
<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}}
|
||||
state={{customerID: item?.id, subscriptionUID: item?.subscription_uid}}
|
||||
>
|
||||
<Icons name='eye'/>
|
||||
</Link>
|
||||
|
||||
@@ -20,6 +20,7 @@ const queryKeys = {
|
||||
products_template: ['products_template'],
|
||||
custom_template: ['custom_template'],
|
||||
account_view: ['account_view'],
|
||||
subscriptions_view: ['subscriptions_view'],
|
||||
users_admin: ['users_admin'],
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,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(`/subcription-view`, postData)
|
||||
}
|
||||
|
||||
|
||||
// FUNCTION TO GET LOANS TABLE
|
||||
export const getLoans = (reqData) => {
|
||||
|
||||
Reference in New Issue
Block a user