fix financial
This commit is contained in:
@@ -2,7 +2,6 @@ import { FC } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { useGetInvoiceDetail } from './hooks/useReceiptData'
|
||||
import { useGetFinancialInfo } from '../financial/hooks/useFinancialData'
|
||||
import { ReceiptDetailItemType } from './types/ReceiptTypes'
|
||||
import { NumberFormat } from '../../config/func'
|
||||
import moment from 'moment-jalaali'
|
||||
@@ -16,12 +15,13 @@ import ApproveInvoice from './components/ApproveInvoice'
|
||||
import PayInvoice from './components/PayInvoice'
|
||||
import Input from '../../components/Input'
|
||||
import { Helmet } from 'react-helmet-async'
|
||||
import { useGetProfile } from '../profile/hooks/useProfileData'
|
||||
|
||||
const ReceiptsDetail: FC = () => {
|
||||
|
||||
const { id } = useParams()
|
||||
const { t } = useTranslation('global')
|
||||
const getProfile = useGetFinancialInfo()
|
||||
const getProfile = useGetProfile()
|
||||
const getInvoce = useGetInvoiceDetail(id ? id : '')
|
||||
|
||||
return (
|
||||
@@ -72,11 +72,11 @@ const ReceiptsDetail: FC = () => {
|
||||
|
||||
|
||||
{
|
||||
getProfile.data?.data?.user?.legalUser ?
|
||||
<LegalInfo data={getProfile.data?.data} />
|
||||
getProfile.data?.data?.user?.financialType === 'LEGAL' ?
|
||||
<LegalInfo />
|
||||
:
|
||||
getProfile.data?.data?.user?.realUser ?
|
||||
<RealInfo data={getProfile.data?.data} />
|
||||
getProfile.data?.data?.user?.financialType === 'REAL' ?
|
||||
<RealInfo />
|
||||
: <RegisterInfo data={getProfile.data?.data} />
|
||||
}
|
||||
|
||||
|
||||
@@ -1,117 +1,118 @@
|
||||
import { FC, Fragment } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { FinancialDataType } from '../../financial/types/FinancialTypes'
|
||||
import { useGetLegalInfo } from '../../financial/hooks/useFinancialData'
|
||||
import { useGetProfile } from '../../profile/hooks/useProfileData'
|
||||
|
||||
type Props = {
|
||||
data: FinancialDataType
|
||||
}
|
||||
|
||||
const LegalInfo: FC<Props> = ({ data }) => {
|
||||
const LegalInfo: FC = () => {
|
||||
|
||||
const { t } = useTranslation('global')
|
||||
const { data: d, isSuccess } = useGetLegalInfo()
|
||||
const getProfile = useGetProfile()
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<div className='mt-8 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'>
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.type_person')}
|
||||
const data = d?.data?.legalUser
|
||||
|
||||
if (isSuccess)
|
||||
return (
|
||||
<Fragment>
|
||||
<div className='mt-8 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'>
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.type_person')}
|
||||
</div>
|
||||
<div>
|
||||
{
|
||||
t('receip.company')
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{
|
||||
data?.user?.legalUser ?
|
||||
t('receip.company') :
|
||||
t('receip.real_person')
|
||||
}
|
||||
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.representativeـname')}
|
||||
</div>
|
||||
<div>
|
||||
{getProfile.data?.data?.user?.firstName + ' ' + getProfile.data?.data?.user?.lastName}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.company_name')}
|
||||
</div>
|
||||
<div>
|
||||
{data.registrationName}
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.registration_number')}
|
||||
</div>
|
||||
<div>
|
||||
{data.registrationCode}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.representativeـname')}
|
||||
<div className='mt-8 border-t pt-7 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'>
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.tel_company')}
|
||||
</div>
|
||||
<div>
|
||||
{data.phone}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.firstName + ' ' + data.user?.lastName}
|
||||
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.national_code')}
|
||||
</div>
|
||||
<div>
|
||||
{data?.nationalIdentity}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.postal_code')}
|
||||
</div>
|
||||
<div>
|
||||
{data?.address?.postalCode}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.company_name')}
|
||||
<div className='mt-6 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'>
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.state')}
|
||||
</div>
|
||||
<div>
|
||||
{data?.address?.city?.province?.name}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.legalUser?.companyRegisteredName}
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.city')}
|
||||
</div>
|
||||
<div>
|
||||
{data?.address?.city?.name}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.registration_number')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.legalUser?.registrationId}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='mt-8 border-t pt-7 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'>
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.tel_company')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.legalUser?.number}
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.address')}
|
||||
</div>
|
||||
<div>
|
||||
{data?.address?.fullAddress}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.national_code')}
|
||||
</div>
|
||||
<div>
|
||||
{data?.user?.legalUser?.nationalId}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.postal_code')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.address?.postalCode}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div className='mt-6 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'>
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.state')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.address?.city?.province?.name}
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.city')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.address?.city?.name}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex gap-2'>
|
||||
<div className='text-description'>
|
||||
{t('receip.address')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.address?.address}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Fragment>
|
||||
)
|
||||
</Fragment>
|
||||
)
|
||||
}
|
||||
|
||||
export default LegalInfo
|
||||
@@ -1,15 +1,15 @@
|
||||
import { FC, Fragment } from 'react'
|
||||
import { FinancialDataType } from '../../financial/types/FinancialTypes'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
type Props = {
|
||||
data: FinancialDataType
|
||||
}
|
||||
import { useGetRealInfo } from '../../financial/hooks/useFinancialData'
|
||||
|
||||
|
||||
const RealInfo: FC<Props> = ({ data }) => {
|
||||
|
||||
const RealInfo: FC = () => {
|
||||
|
||||
const { t } = useTranslation('global')
|
||||
const { data: d } = useGetRealInfo()
|
||||
|
||||
const data = d?.data?.realUser
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
@@ -28,7 +28,7 @@ const RealInfo: FC<Props> = ({ data }) => {
|
||||
{t('receip.fullName')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.firstName + ' ' + data.user?.lastName}
|
||||
{data?.firstName + ' ' + data?.lastName}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@ const RealInfo: FC<Props> = ({ data }) => {
|
||||
{t('financial.father_name')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.realUser?.fatherName}
|
||||
{data?.fatherName}
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-2'>
|
||||
@@ -45,7 +45,7 @@ const RealInfo: FC<Props> = ({ data }) => {
|
||||
{t('financial.sex')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.realUser?.gender === 'male' ? 'مرد' : 'زن'}
|
||||
{data?.gender === 'MALE' ? 'مرد' : 'زن'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,7 +56,7 @@ const RealInfo: FC<Props> = ({ data }) => {
|
||||
{t('financial.phone')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.phone}
|
||||
{data?.phone}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -67,7 +67,7 @@ const RealInfo: FC<Props> = ({ data }) => {
|
||||
{t('receip.postal_code')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.address?.postalCode}
|
||||
{data?.address?.postalCode}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -79,7 +79,7 @@ const RealInfo: FC<Props> = ({ data }) => {
|
||||
{t('receip.state')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.address?.city?.province?.name}
|
||||
{data?.address?.city?.province?.name}
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex gap-2'>
|
||||
@@ -87,7 +87,7 @@ const RealInfo: FC<Props> = ({ data }) => {
|
||||
{t('receip.city')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.address?.city?.name}
|
||||
{data?.address?.city?.name}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -96,7 +96,7 @@ const RealInfo: FC<Props> = ({ data }) => {
|
||||
{t('receip.address')}
|
||||
</div>
|
||||
<div>
|
||||
{data.user?.address?.address}
|
||||
{data?.address?.fullAddress}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user