Compare commits

...

10 Commits

Author SHA1 Message Date
victorAnumudu cc5c215eb9 added product template checkbox 2025-10-21 18:19:39 +01:00
CHIEFSOFT\ameye f7430cc231 checks 2025-10-21 12:01:16 -04:00
ameye 7d39c0fc23 Merge branch 'recent-signup' of MERMS/MermsFirstOffice into master 2025-10-17 18:17:35 +00:00
victorAnumudu 43e8b9601a added recent signup data 2025-10-17 17:43:36 +01:00
CHIEFSOFT\ameye a2c7ecd1f5 recent signup 2025-10-17 11:58:44 -04:00
ameye 0113f047dd Merge branch 'recent-payment' of MERMS/MermsFirstOffice into master 2025-10-16 22:20:01 +00:00
victorAnumudu d131e981cf added recent payments 2025-10-16 19:51:22 +01:00
CHIEFSOFT\ameye 85a07427e5 fix text 2025-10-16 11:53:07 -04:00
CHIEFSOFT\ameye 647f9473a0 fix links 2025-10-14 03:06:21 -04:00
ameye 95ea5aaabf Merge branch 'rebuild-confirmation' of MERMS/MermsFirstOffice into master 2025-10-13 10:54:29 +00:00
8 changed files with 207 additions and 115 deletions
+11 -1
View File
@@ -1,5 +1,5 @@
import {useEffect, useState} from 'react'
import { useQuery } from '@tanstack/react-query'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import {useLocation, useNavigate, Link} from 'react-router-dom'
@@ -14,6 +14,8 @@ import CustomerPaymentsView from "./CustomerPaymentsView";
export default function AccountViewCom() {
const queryClient = useQueryClient()
const {state} = useLocation()
const navigate = useNavigate()
@@ -43,6 +45,14 @@ export default function AccountViewCom() {
const payments = accountsViewData?.payments
// console.log('DATA', payments, subscriptions)
useEffect(()=>{
queryClient.refetchQueries({
queryKey: [...queryKeys.account_view],
// type: 'active',
// exact: true,
})
},[state?.memberUID])
return (
<div className='w-full flex flex-col gap-8'>
<BreadcrumbCom title={`Account View [${state?.memberUID}]`} paths={['Dashboard', 'Account View']}/>
@@ -71,7 +71,7 @@ export default function CustomerSubscriptionsView({subscriptions}) {
<br/>
<span className="badge badge-warning">
<a href={`https://${item?.external_url}`}
<a href={`${item?.external_url}`}
target='_blank'
rel="noreferrer">{item?.external_url}</a>
</span>
@@ -1,10 +1,16 @@
import React from 'react'
import {Link} from 'react-router-dom'
import Img from '../../../assets/user_avatar.jpg'
import CustomCounter from '../../CustomCounter'
import RouteLinks from '../../../RouteLinks'
export default function RecentPaymentsBar({data, isFetching, isError, error}) {
const recentPayment = data?.data?.recent_payment_summary
const recentLogin = data?.data?.recent_login
return (
<div className='h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 overflow-y-auto aside-scroll-design'>
<div className='h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 aside-scroll-design'>
<div className='flex flex-col gap-4'>
<p className='text-base text-white-body font-bold'>Recent Payments [7 days]</p>
{isFetching ?
@@ -18,32 +24,32 @@ export default function RecentPaymentsBar({data, isFetching, isError, error}) {
<div className='grid grid-cols-2 gap-4 sm:gap-6 large:gap-8'>
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
<p className='text-base font-bold text-white-body'>
<CustomCounter targetNumber={18} timeInSeconds={1} />
<CustomCounter targetNumber={recentPayment?.approved} timeInSeconds={1} />
</p>
<p className='text-sm text-slate-500'>Approved</p>
</div>
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
<p className='text-base font-bold text-white-body'>
<CustomCounter targetNumber={5} timeInSeconds={1} />
<CustomCounter targetNumber={recentPayment?.verified} timeInSeconds={1} />
</p>
<p className='text-sm text-slate-500'>Verified</p>
</div>
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
<p className='text-base font-bold text-white-body'>
<CustomCounter targetNumber={1} timeInSeconds={1} />
<CustomCounter targetNumber={recentPayment?.failed} timeInSeconds={1} />
</p>
<p className='text-sm text-slate-500'>Failed</p>
</div>
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
<p className='text-base font-bold text-white-body'>
<CustomCounter targetNumber={1} timeInSeconds={1} />
<CustomCounter targetNumber={recentPayment?.total} timeInSeconds={1} />
</p>
<p className='text-sm text-slate-500'>Total</p>
</div>
</div>
}
</div>
<div className='flex flex-col gap-4'>
<div className='overflow-y-auto h-full flex flex-col gap-4'>
<p className='text-base text-white-body font-bold'>Recent Login</p>
{isFetching ?
<div className='w-full flex justify-center'>
@@ -54,42 +60,25 @@ export default function RecentPaymentsBar({data, isFetching, isError, error}) {
<p className='text-base text-white-body font-bold'>{error?.message}</p>
:
<div className='flex flex-col gap-4'>
<div className='flex gap-3 items-center'>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>Project Briefing</p>
<p className='text-sm text-slate-500'>Project Manager</p>
</div>
</div>
<div className='flex gap-3 items-center'>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>Project Briefing</p>
<p className='text-sm text-slate-500'>Project Manager</p>
</div>
</div>
<div className='flex gap-3 items-center'>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>Project Briefing</p>
<p className='text-sm text-slate-500'>Project Manager</p>
</div>
</div>
<div className='flex gap-3 items-center'>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>Project Briefing</p>
<p className='text-sm text-slate-500'>Project Manager</p>
</div>
</div>
{recentLogin.map((item, index)=> {
return (
<Link
to={`/account-view/${item?.member_uid}`}
state={{customerID: item?.id, memberUID: item?.member_uid}}
key={index}
className='flex gap-3 items-center'
>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>{item.firstname} {item.lastname}</p>
<p className='text-sm text-slate-500'>{item.username}</p>
</div>
</Link>
)
}
)}
</div>
}
</div>
@@ -29,14 +29,9 @@ export default function RightAsideBar() {
},
// staleTime: 0 //0 mins
})
const recentData = [] // RECENT LIST
// const recentData = data?.data // RECENT LIST
// const pagination = data?.data?.pagination
// console.log('RIGHT', data?.data)
return (
<div className='w-full h-full flex flex-col gap-8'>
<div className='w-full h-full pb-8 flex flex-col gap-8'>
{/* Menu */}
<div className='grid grid-cols-3 gap-8'>
<button name='orders' onClick={() => handleActiveMenu('orders')} className={`flex justify-center items-center px-2 py-3 large:px-4 large:py-5 rounded-md shadow-round_white bg-[#0E172E] text-white-body hover:scale-[1.1] ${active === 'orders' && 'scale-[1.2]'}`}>
@@ -51,9 +46,9 @@ export default function RightAsideBar() {
</div>
{/* Body */}
{active === 'orders' && <RecentPaymentsBar data={recentData} isFetching={isFetching} isError={isError} error={error} />}
{active === 'tickets' && <Tickets data={recentData} isFetching={isFetching} isError={isError} error={error} />}
{active === 'tasks' && <Tasks data={recentData} isFetching={isFetching} isError={isError} error={error} />}
{active === 'orders' && <RecentPaymentsBar data={data} isFetching={isFetching} isError={isError} error={error} />}
{active === 'tickets' && <Tickets data={data} isFetching={isFetching} isError={isError} error={error} />}
{active === 'tasks' && <Tasks data={data} isFetching={isFetching} isError={isError} error={error} />}
</div>
)
}
+35 -46
View File
@@ -1,10 +1,16 @@
import React from 'react'
import {Link} from 'react-router-dom'
import Img from '../../../assets/user_avatar.jpg'
import CustomCounter from '../../CustomCounter'
export default function Tickets({data, isFetching, isError, error}) {
const recentDeployment = data?.data?.recent_deployment_summary
const recentSignup = data?.data?.recent_signup
return (
<div className='h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 overflow-y-auto aside-scroll-design'>
<div className='h-full p-2 sm:p-4 large:p-8 flex flex-col gap-16 aside-scroll-design'>
<div className='flex flex-col gap-4'>
<p className='text-base text-white-body font-bold'>Recent Deployments</p>
{isFetching ?
@@ -18,33 +24,33 @@ export default function Tickets({data, isFetching, isError, error}) {
<div className='grid grid-cols-2 gap-4 sm:gap-6 large:gap-8'>
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
<p className='text-base font-bold text-white-body'>
<CustomCounter targetNumber={18} timeInSeconds={1} />
<CustomCounter targetNumber={recentDeployment?.pending} timeInSeconds={1} />
</p>
<p className='text-sm text-slate-500'>Pending</p>
</div>
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
<p className='text-base font-bold text-white-body'>
<CustomCounter targetNumber={2} timeInSeconds={1} />
<CustomCounter targetNumber={recentDeployment?.started} timeInSeconds={1} />
</p>
<p className='text-sm text-slate-500'>Offers</p>
<p className='text-sm text-slate-500'>Started</p>
</div>
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
<p className='text-base font-bold text-white-body'>
<CustomCounter targetNumber={3} timeInSeconds={1} />
<CustomCounter targetNumber={recentDeployment?.stuck} timeInSeconds={1} />
</p>
<p className='text-sm text-slate-500'>Created</p>
<p className='text-sm text-slate-500'>Stuck</p>
</div>
<div className='p-2 sm:p-3 large:p-4 flex flex-col border border-slate-500 border-dashed'>
<p className='text-base font-bold text-white-body'>
<CustomCounter targetNumber={1} timeInSeconds={1} />
<CustomCounter targetNumber={recentDeployment?.completed} timeInSeconds={1} />
</p>
<p className='text-sm text-slate-500'>Rejected</p>
<p className='text-sm text-slate-500'>Completed</p>
</div>
</div>
}
</div>
<div className='flex flex-col gap-4'>
<p className='text-base text-white-body font-bold'>Tracked Errors</p>
<div className='overflow-y-auto h-full flex flex-col gap-4'>
<p className='text-base text-white-body font-bold'>Recent Signup</p>
{isFetching ?
<div className='w-full flex justify-center'>
<div className="w-6 h-6 border-2 border-gray-300 border-b-gray-500 rounded-full animate-spin"></div>
@@ -54,42 +60,25 @@ export default function Tickets({data, isFetching, isError, error}) {
<p className='text-base text-white-body font-bold'>{error?.message}</p>
:
<div className='flex flex-col gap-4'>
<div className='flex gap-3 items-center'>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>Project Briefing</p>
<p className='text-sm text-slate-500'>Project Manager</p>
</div>
</div>
<div className='flex gap-3 items-center'>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>Project Briefing</p>
<p className='text-sm text-slate-500'>Project Manager</p>
</div>
</div>
<div className='flex gap-3 items-center'>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>Project Briefing</p>
<p className='text-sm text-slate-500'>Project Manager</p>
</div>
</div>
<div className='flex gap-3 items-center'>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>Project Briefing</p>
<p className='text-sm text-slate-500'>Project Manager</p>
</div>
</div>
{recentSignup.map((item, index)=> {
return (
<Link
to={`/account-view/${item?.member_uid}`}
state={{customerID: item?.id, memberUID: item?.member_uid}}
key={index}
className='flex gap-3 items-center'
>
<div className='px-4 py-2 bg-[#0E172E] rounded-md'>
<img src={Img} className='w-8' alt="Order" />
</div>
<div className='flex-col'>
<p className='text-base font-bold text-white-body'>{item.firstname} {item.lastname}</p>
<p className='text-sm text-slate-500'>{item.username}</p>
</div>
</Link>
)
}
)}
</div>
}
</div>
+84 -9
View File
@@ -1,15 +1,17 @@
import { useState } from 'react'
import { useQuery } from '@tanstack/react-query'
import { useEffect, useState } from 'react'
import { useQuery, useMutation } from '@tanstack/react-query'
import queryKeys from '../../services/queryKeys'
import BreadcrumbCom from '../breadcrumb/BreadcrumbCom'
import TablePaginatedWrapper from '../tableWrapper/TablePaginatedWrapper'
import Icons from '../Icons'
import { getProductsTemplate } from '../../services/siteServices'
import { getProductsTemplate, setProductsTemplate } from '../../services/siteServices'
// import getDateTimeFromDateString from '../../helpers/getDateTimeFromDateString'
export default function ProductTemplates() {
const [selected, setSelected] = useState('')
const [page, setPage] = useState(1)
const [filter, setFilter] = useState({type: '', id: ''})
const [willFilter, setWillFilter] = useState(false)
@@ -43,9 +45,62 @@ export default function ProductTemplates() {
},
staleTime: 0 //0 mins
})
const productsTemData = data?.data?.templates // PRODUCTS TEMPLATE LIST
const pagination = data?.data?.pagination
// const productsTemData = data?.data?.templates // PRODUCTS TEMPLATE LIST
// const pagination = data?.data?.pagination
// console.log('DATA', data?.data)
const [productsTemData, setProductsTemData] = useState([])
const [pagination, setPagination] = useState({})
useEffect(()=>{
if(data){
setProductsTemData(data?.data?.templates)
setPagination(data?.data?.pagination)
}
},[data])
const statusChange = useMutation({
mutationFn: (fields) => {
return setProductsTemplate(fields)
},
onError: (error) => {
},
onSuccess: (res) => {
queryClient.refetchQueries({
queryKey: [...queryKeys.country_list],
// type: 'active',
// exact: true,
})
},
onSettled: () => {
setSelected('')
}
})
//FUNCTION TO CHANGE STATUS OR SIGNUP
const handleStatusChange = (event, details) => {
setSelected(event.target.id)
const name = event.target.name
const val = name.toUpperCase() == 'STATUS' ? details.status : details.signup
const reqData = {
'val_type': name.toUpperCase(),
'country_uid': details?.country_uid,
'code': details?.code,
'val': val == 0 ? 1 : 0
}
// statusChange.mutate(reqData)
setTimeout(()=>{
setSelected('')
const NewData = productsTemData.map(item => { // remove later
if(item.product_id == event.target.id){
return ({...item, status: !item.status})
}else{
return item
}
})
setProductsTemData(NewData)
},3000) // remove later
};
return (
<div className='w-full flex flex-col gap-8'>
@@ -62,7 +117,8 @@ export default function ProductTemplates() {
<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='product_id'>Product ID</option>
<option value='provision_name'>Provision Name</option>
</select>
</div>
<div className='w-full sm:max-w-48'>
@@ -84,7 +140,7 @@ export default function ProductTemplates() {
<th scope="col" className="px-8">
Provision Name
</th>
<th scope="col" className="px-2 text-right">
<th scope="col" className="px-2 text-center">
Status
</th>
</tr>
@@ -105,8 +161,27 @@ export default function ProductTemplates() {
</div>
</td>
<td className="px-2">
<div className="text-right">
<div className="text-base font-semibold">{item?.status}</div>
<div className="flex justify-center">
<>
{selected == item?.product_id ?
<div role="status" className="text-center">
<svg aria-hidden="true" className="w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-primary" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
<span className="sr-only">Loading...</span>
</div>
:
<input
className="w-4 h-4 cursor-pointer text-primary bg-gray-100 border-gray-300 rounded-sm focus:ring-primary/80 dark:focus:ring-primary dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
onChange={(e)=>handleStatusChange(e, item)}
type="checkbox"
checked={item?.status}
name="status"
id={item?.product_id}
/>
}
</>
</div>
</td>
</tr>
@@ -150,20 +150,43 @@ export default function SubscriptionViewCom() {
<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">{getDateTimeFromDateString(selectedSubscription?.added)}</div>
<div className="text-base font-semibold">{getDateTimeFromDateString(selectedSubscription?.added)}</div>
<div className="text-base font-semibold">{getDateTimeFromDateString(selectedSubscription?.updated)}</div>
<div className="text-base font-semibold">ID: {selectedSubscription?.id}</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<div
className="text-base font-semibold">{selectedSubscription?.product_id}</div>
<div><a href={`http://${selectedSubscription?.primary_server}:${selectedSubscription?.provision_port}`}
target='_blank'
rel="noreferrer">{selectedSubscription?.primary_server}:{selectedSubscription?.provision_port}</a>
</div>
</div>
</td>
<td className="px-2">
<div className="text-left">
<div
className="text-base font-semibold">{selectedSubscription?.internal_url}
<span className="text-base font-semibold">
<a href={`https://${selectedSubscription?.internal_url}`}
target='_blank'
rel="noreferrer">{selectedSubscription?.internal_url}</a>
</span>
<br/>
<span className="text-base font-semibold">
<a href={`${selectedSubscription?.external_url}`}
target='_blank'
rel="noreferrer">{selectedSubscription?.external_url}</a>
</span>
<br/>
<div className="text-base font-semibold">
<br/><span>Template :</span> {selectedSubscription?.product_template}
<br/><span>Custom :</span> {selectedSubscription?.custom_template}
</div>
@@ -177,7 +200,8 @@ export default function SubscriptionViewCom() {
</td>
<td className="px-2">
<div className="text-right">
<button name='template' onClick={()=>setRebuildStatus({status: true, data:{}})}
<button name='template'
onClick={() => setRebuildStatus({status: true, data: {}})}
className={`rounded-md p-2 bg-primary text-white text-center`}>
Rebuild
</button>
@@ -240,8 +264,10 @@ export default function SubscriptionViewCom() {
</div>
</div>
</>
}
{ rebuildStatus?.status && <RebuildModal data={{}} templateRebuild={templateRebuild} proceedFunc={handleRebuildTemplate} closeModal={()=>setRebuildStatus({status: false, data:{}})} />}
}
{rebuildStatus?.status &&
<RebuildModal data={{}} templateRebuild={templateRebuild} proceedFunc={handleRebuildTemplate}
closeModal={() => setRebuildStatus({status: false, data: {}})}/>}
</div>
)
}
+8
View File
@@ -124,6 +124,14 @@ export const getProductsTemplate = (reqData) => {
return getAuxEnd(`/products-templates`, postData)
}
// FUNCTION TO SET COUNTRY
export const setProductsTemplate = (reqData) => {
let postData = {
...reqData
}
return postAuxEnd('/set-product', postData, false)
}
// FUNCTION TO INITIATE TEMPLATE REBUILD
export const rebuildTemplate = (reqData) => {
let postData = {