This commit is contained in:
CHIEFSOFT\ameye
2025-09-28 08:08:36 -04:00
parent 5783dfd521
commit 9a0ed2d78c
+42 -31
View File
@@ -1,13 +1,13 @@
import React from 'react' import React 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 BreadcrumbCom from '../../components/breadcrumb/BreadcrumbCom' import BreadcrumbCom from '../../components/breadcrumb/BreadcrumbCom'
import CustomCounter from '../../components/CustomCounter' import CustomCounter from '../../components/CustomCounter'
import Icons from '../../components/Icons' import Icons from '../../components/Icons'
import formatNumber from '../../helpers/formatNumber' import formatNumber from '../../helpers/formatNumber'
import queryKeys from '../../services/queryKeys' import queryKeys from '../../services/queryKeys'
import { getDashData } from '../../services/siteServices' import {getDashData} from '../../services/siteServices'
import getDateFromDateString from '../../helpers/GetDateFromDateString'; import getDateFromDateString from '../../helpers/GetDateFromDateString';
import getTimeFromDateString from '../../helpers/GetTimeFromDateString'; import getTimeFromDateString from '../../helpers/GetTimeFromDateString';
import localImgLoader from '../../helpers/localImageLoader'; import localImgLoader from '../../helpers/localImageLoader';
@@ -27,48 +27,54 @@ export default function HomeCom() {
return ( return (
<div className='w-full flex flex-col gap-8'> <div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title='Dashboard' paths={['Home', 'Dashboard']} /> <BreadcrumbCom title='Dashboard' paths={['Home', 'Dashboard']}/>
{(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> */}
<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'>
{/*{dashData?.loans?.currency_text}*/} {/*{dashData?.loans?.currency_text}*/}
</span><CustomCounter targetNumber={formatNumber(dashData?.loans?.value)} timeInSeconds='1' /> </span><CustomCounter targetNumber={formatNumber(dashData?.loans?.value)} timeInSeconds='1'/>
</p> </p>
<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'>
{dashData?.payments?.currency_text} {dashData?.payments?.currency_text}
</span><CustomCounter targetNumber={formatNumber(dashData?.payments?.value)} timeInSeconds='1' /> </span><CustomCounter targetNumber={formatNumber(dashData?.payments?.value)} timeInSeconds='1'/>
</p> </p>
<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
<Icons name='sales' /> 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>
<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>
@@ -110,50 +116,54 @@ export default function HomeCom() {
</thead> </thead>
<tbody> <tbody>
{(dashData?.subscription && dashData?.subscription.length > 0) ? dashData?.subscription?.map((item, index) => { {(dashData?.subscription && dashData?.subscription.length > 0) ? dashData?.subscription?.map((item, index) => {
if(index <= 10) { if (index <= 10) {
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'> <Icons name='eye'/>
<Link to={RouteLinks.transaction_details_page} state={{transactionID: item?.transaction_id}}>
<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>
) )
}else{ } else {
return null return null
} }
} }
@@ -171,7 +181,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>