This commit is contained in:
hamid zarghami
2025-02-24 10:21:40 +03:30
parent f8054e2202
commit e8512bb147
6 changed files with 65 additions and 75 deletions
+52 -54
View File
@@ -7,10 +7,14 @@ import Input from '../../components/Input'
import Td from '../../components/Td'
import { Link } from 'react-router-dom'
import { Pages } from '../../config/Pages'
import { useGetCustomers } from './hooks/useCustomerData'
import PageLoading from '../../components/PageLoading'
import { CustomerItemType } from './types/CustomerTypes'
const CustomerList: FC = () => {
const { t } = useTranslation('global')
const getCustomers = useGetCustomers()
return (
<div className='mt-4'>
@@ -63,60 +67,54 @@ const CustomerList: FC = () => {
</div>
</div>
<div className='relative overflow-x-auto rounded-3xl mt-9 w-full'>
<table className='w-full text-sm '>
<thead className='thead'>
<tr>
<Td text={t('customer.name')} />
<Td text={t('customer.company')} />
<Td text={t('customer.email')} />
<Td text={t('customer.active_services')} />
<Td text={t('customer.factor')} />
<Td text={t('customer.tickets')} />
<Td text={t('customer.detail')} />
<Td text={''} />
</tr>
</thead>
<tbody>
<tr className='tr'>
<Td text='مهرداد مظفری' />
<Td text={'شرکت داناک'} />
<Td text={'info@example.com'} />
<Td text={'2 سرویس'} />
<Td text={''}>
<div className='text-[#0047FF]'>۳ صورت حساب</div>
</Td>
<Td text={''}>
<div className='text-[#0047FF]'>۴ تیکت</div>
</Td>
<Td text={''}>
<Link to={Pages.ticket.detail + '1'}>
<Eye size={20} color='#8C90A3' />
</Link>
</Td>
<Td text={''} />
</tr>
<tr className='tr'>
<Td text='مهرداد مظفری' />
<Td text={'شرکت داناک'} />
<Td text={'info@example.com'} />
<Td text={'2 سرویس'} />
<Td text={''}>
<div className='text-[#0047FF]'>۳ صورت حساب</div>
</Td>
<Td text={''}>
<div className='text-[#0047FF]'>۴ تیکت</div>
</Td>
<Td text={''}>
<Link to={Pages.ticket.detail + '1'}>
<Eye size={20} color='#8C90A3' />
</Link>
</Td>
<Td text={''} />
</tr>
</tbody>
</table>
</div>
{
getCustomers.isPending ?
<PageLoading />
:
<div className='relative overflow-x-auto rounded-3xl mt-9 w-full'>
<table className='w-full text-sm '>
<thead className='thead'>
<tr>
<Td text={t('customer.name')} />
<Td text={t('customer.company')} />
<Td text={t('customer.email')} />
<Td text={t('customer.active_services')} />
<Td text={t('customer.factor')} />
<Td text={t('customer.tickets')} />
<Td text={t('customer.detail')} />
<Td text={''} />
</tr>
</thead>
<tbody>
{
getCustomers.data?.data?.customers?.map((item: CustomerItemType) => {
return (
<tr key={item.id} className='tr'>
<Td text={item.firstName + ' ' + item.lastName} />
<Td text={'شرکت داناک'} />
<Td text={item.email ? item.email : ''} />
<Td text={item.subscriptionsCount} />
<Td text={''}>
<div className='text-[#0047FF]'>{item.invoicesCount} صورت حساب</div>
</Td>
<Td text={''}>
<div className='text-[#0047FF]'>{item.ticketsCount} تیکت</div>
</Td>
<Td text={''}>
<Link to={Pages.ticket.detail + '1'}>
<Eye size={20} color='#8C90A3' />
</Link>
</Td>
<Td text={''} />
</tr>
)
})
}
</tbody>
</table>
</div>
}
</div>
)
}
@@ -17,4 +17,7 @@ export type CustomerItemType = {
tickets: unknown[];
updatedAt: string;
userName: string | null;
subscriptionsCount: string;
ticketsCount: string;
invoicesCount: string;
};