Merge branch 'account-view-section-fix' of MERMS/MermsFirstOffice into master

This commit is contained in:
2025-09-28 17:56:30 +00:00
committed by Gogs
5 changed files with 241 additions and 161 deletions
@@ -36,9 +36,12 @@ export default function AccountViewCom() {
},
staleTime: 0 //0 mins
})
const accountsViewData = data?.data?.products // ACCOUNT VIEW DATA
const pagination = data?.data?.pagination
console.log('DATA', data?.data)
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)
return (
<div className='w-full flex flex-col gap-8'>
@@ -53,10 +56,10 @@ export default function AccountViewCom() {
<p className='text-red-500'>{error.message}</p>
:
<>
<CustomerAccountView />
<CustomerAccountView accountInfo={account_info} />
<AccountProfileView />
<CustomerSubscriptionsView />
<CustomerPaymentsView />
<CustomerSubscriptionsView subscriptions={subscriptions} memberUID={memberUID} />
<CustomerPaymentsView payments={payments} />
</>
}
@@ -1,51 +1,91 @@
import {Link} from 'react-router-dom'
import Icons from "../Icons";
export default function CustomerAccountView() {
export default function CustomerAccountView({accountInfo}) {
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 Info</b></h4>
</div>
</div>
<div className="card-body">
<div className="table-responsive">
<table className="table table-hover mb-0" style={{width:'100%', backgroundColor: 'aliceblue', borderRadius: '10px'}}>
<thead>
<tr>
<th scope="col">id</th>
<th scope="col">Firstname</th>
<th scope="col">Lastname</th>
<th scope="col">Username</th>
<th scope="col">Email</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
<td>Otto</td>
<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" style={{backgroundColor: 'aliceblue', borderRadius: '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">
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={`/account-view/${item?.member_uid}`}>*/}
<Icons name='eye'/>
{/*</Link>*/}
<Link
// to={`/subscription-view/63554d40-9ba1-4afe-80c2-ca147236f7ee`}
>
<Icons name='eye'/>
</Link>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
:
<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>
@@ -1,48 +1,67 @@
export default function CustomerPaymentsView() {
export default function CustomerPaymentsView({payments}) {
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>Payments</b></h4>
</div>
</div>
<div className="card-body">
<div className="table-responsive">
<table className="table table-hover mb-0" style={{width:'100%', backgroundColor: 'aliceblue', borderRadius: '10px'}}>
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
<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" style={{backgroundColor: 'aliceblue', borderRadius: '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
</th>
<th scope="col" className="px-2">
Last
</th>
<th scope="col" className="px-2">
Handle
</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?.first}</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<div className="text-base font-semibold">{item?.last}</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<div className="text-base font-semibold">{item?.handle}</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>
</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>
</tbody>
</table>
</div>
</div>
}
</tbody>
</table>
</>
</div>
</div>
</div>
@@ -1,86 +1,92 @@
import getDateTimeFromDateString from "../../helpers/getDateTimeFromDateString";
import RouteLinks from "../../RouteLinks";
import Icons from "../Icons";
import {Link} from 'react-router-dom'
export default function CustomerSubscriptionsView() {
export default function CustomerSubscriptionsView({subscriptions, memberUID}) {
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>Subscriptions</b></h4>
</div>
</div>
<div className="card-body">
<div className="table-responsive">
<table className="table table-hover mb-0"
style={{width: '100%', backgroundColor: 'aliceblue', borderRadius: '10px'}}>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Added</th>
<th scope="col">Product</th>
<th scope="col">URL</th>
<th scope="col">Status</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Sat, Sep 27th 2025 7:29AM</td>
<td>A000002</td>
<td>bobmarleya2.devprov.mermsemr.com</td>
<td>7</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 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" style={{backgroundColor: 'aliceblue', borderRadius: '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
</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}</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/${memberUID}`} state={{customerID: item?.id, memberUID}}>
<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>
<tr>
<th scope="row">2</th>
<td>Sat, Sep 27th 2025 7:29AM</td>
<td>A000002</td>
<td>bobmarleya2.devprov.mermsemr.com</td>
<td>7</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>
<th scope="row">3</th>
<td>Sat, Sep 27th 2025 7:29AM</td>
<td>A000002</td>
<td>bobmarleya2.devprov.mermsemr.com</td>
<td>7</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>
</tbody>
</table>
</div>
</div>
}
</tbody>
</table>
</>
</div>
</div>
</div>
@@ -1,11 +1,23 @@
import {useLocation, useNavigate, Link} from 'react-router-dom'
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
import { useEffect } from 'react';
export default function SubscriptionViewCom() {
const subscriptionUID = "63554d40-9ba1-4afe-80c2-ca147236f7ee";
const {state:{memberUID}} = useLocation()
const navigate = useNavigate()
useEffect(()=>{
if(!memberUID){
navigate(`/account-view/${memberUID}`, {replace: true, state:{memberUID}})
}
},[])
return (
<div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title={`Subscription View [${subscriptionUID}]`} paths={['Dashboard', 'Subscription View']}/>
<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'>