account view subscription table data fixed

This commit is contained in:
victorAnumudu
2025-09-28 14:31:22 +01:00
parent 9a0ed2d78c
commit ebcde80a3d
5 changed files with 242 additions and 161 deletions
@@ -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>