fix financial

This commit is contained in:
hamid zarghami
2025-03-03 09:26:25 +03:30
parent 632c8f4c4e
commit 62e8d0224e
3 changed files with 115 additions and 114 deletions
+6 -6
View File
@@ -2,7 +2,6 @@ import { FC } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useParams } from 'react-router-dom' import { useParams } from 'react-router-dom'
import { useGetInvoiceDetail } from './hooks/useReceiptData' import { useGetInvoiceDetail } from './hooks/useReceiptData'
import { useGetFinancialInfo } from '../financial/hooks/useFinancialData'
import { ReceiptDetailItemType } from './types/ReceiptTypes' import { ReceiptDetailItemType } from './types/ReceiptTypes'
import { NumberFormat } from '../../config/func' import { NumberFormat } from '../../config/func'
import moment from 'moment-jalaali' import moment from 'moment-jalaali'
@@ -16,12 +15,13 @@ import ApproveInvoice from './components/ApproveInvoice'
import PayInvoice from './components/PayInvoice' import PayInvoice from './components/PayInvoice'
import Input from '../../components/Input' import Input from '../../components/Input'
import { Helmet } from 'react-helmet-async' import { Helmet } from 'react-helmet-async'
import { useGetProfile } from '../profile/hooks/useProfileData'
const ReceiptsDetail: FC = () => { const ReceiptsDetail: FC = () => {
const { id } = useParams() const { id } = useParams()
const { t } = useTranslation('global') const { t } = useTranslation('global')
const getProfile = useGetFinancialInfo() const getProfile = useGetProfile()
const getInvoce = useGetInvoiceDetail(id ? id : '') const getInvoce = useGetInvoiceDetail(id ? id : '')
return ( return (
@@ -72,11 +72,11 @@ const ReceiptsDetail: FC = () => {
{ {
getProfile.data?.data?.user?.legalUser ? getProfile.data?.data?.user?.financialType === 'LEGAL' ?
<LegalInfo data={getProfile.data?.data} /> <LegalInfo />
: :
getProfile.data?.data?.user?.realUser ? getProfile.data?.data?.user?.financialType === 'REAL' ?
<RealInfo data={getProfile.data?.data} /> <RealInfo />
: <RegisterInfo data={getProfile.data?.data} /> : <RegisterInfo data={getProfile.data?.data} />
} }
+18 -17
View File
@@ -1,15 +1,18 @@
import { FC, Fragment } from 'react' import { FC, Fragment } from 'react'
import { useTranslation } from 'react-i18next' 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 { t } = useTranslation('global')
const { data: d, isSuccess } = useGetLegalInfo()
const getProfile = useGetProfile()
const data = d?.data?.legalUser
if (isSuccess)
return ( return (
<Fragment> <Fragment>
<div className='mt-8 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'> <div className='mt-8 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'>
@@ -19,9 +22,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
</div> </div>
<div> <div>
{ {
data?.user?.legalUser ? t('receip.company')
t('receip.company') :
t('receip.real_person')
} }
</div> </div>
</div> </div>
@@ -31,7 +32,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
{t('receip.representativeـname')} {t('receip.representativeـname')}
</div> </div>
<div> <div>
{data.user?.firstName + ' ' + data.user?.lastName} {getProfile.data?.data?.user?.firstName + ' ' + getProfile.data?.data?.user?.lastName}
</div> </div>
</div> </div>
@@ -40,7 +41,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
{t('receip.company_name')} {t('receip.company_name')}
</div> </div>
<div> <div>
{data.user?.legalUser?.companyRegisteredName} {data.registrationName}
</div> </div>
</div> </div>
<div className='flex gap-2'> <div className='flex gap-2'>
@@ -48,7 +49,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
{t('receip.registration_number')} {t('receip.registration_number')}
</div> </div>
<div> <div>
{data.user?.legalUser?.registrationId} {data.registrationCode}
</div> </div>
</div> </div>
</div> </div>
@@ -59,7 +60,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
{t('receip.tel_company')} {t('receip.tel_company')}
</div> </div>
<div> <div>
{data.user?.legalUser?.number} {data.phone}
</div> </div>
</div> </div>
@@ -68,7 +69,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
{t('receip.national_code')} {t('receip.national_code')}
</div> </div>
<div> <div>
{data?.user?.legalUser?.nationalId} {data?.nationalIdentity}
</div> </div>
</div> </div>
@@ -77,7 +78,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
{t('receip.postal_code')} {t('receip.postal_code')}
</div> </div>
<div> <div>
{data.user?.address?.postalCode} {data?.address?.postalCode}
</div> </div>
</div> </div>
@@ -89,7 +90,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
{t('receip.state')} {t('receip.state')}
</div> </div>
<div> <div>
{data.user?.address?.city?.province?.name} {data?.address?.city?.province?.name}
</div> </div>
</div> </div>
<div className='flex gap-2'> <div className='flex gap-2'>
@@ -97,7 +98,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
{t('receip.city')} {t('receip.city')}
</div> </div>
<div> <div>
{data.user?.address?.city?.name} {data?.address?.city?.name}
</div> </div>
</div> </div>
@@ -106,7 +107,7 @@ const LegalInfo: FC<Props> = ({ data }) => {
{t('receip.address')} {t('receip.address')}
</div> </div>
<div> <div>
{data.user?.address?.address} {data?.address?.fullAddress}
</div> </div>
</div> </div>
</div> </div>
+14 -14
View File
@@ -1,15 +1,15 @@
import { FC, Fragment } from 'react' import { FC, Fragment } from 'react'
import { FinancialDataType } from '../../financial/types/FinancialTypes'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useGetRealInfo } from '../../financial/hooks/useFinancialData'
type Props = {
data: FinancialDataType
}
const RealInfo: FC<Props> = ({ data }) => {
const RealInfo: FC = () => {
const { t } = useTranslation('global') const { t } = useTranslation('global')
const { data: d } = useGetRealInfo()
const data = d?.data?.realUser
return ( return (
<Fragment> <Fragment>
@@ -28,7 +28,7 @@ const RealInfo: FC<Props> = ({ data }) => {
{t('receip.fullName')} {t('receip.fullName')}
</div> </div>
<div> <div>
{data.user?.firstName + ' ' + data.user?.lastName} {data?.firstName + ' ' + data?.lastName}
</div> </div>
</div> </div>
@@ -37,7 +37,7 @@ const RealInfo: FC<Props> = ({ data }) => {
{t('financial.father_name')} {t('financial.father_name')}
</div> </div>
<div> <div>
{data.user?.realUser?.fatherName} {data?.fatherName}
</div> </div>
</div> </div>
<div className='flex gap-2'> <div className='flex gap-2'>
@@ -45,7 +45,7 @@ const RealInfo: FC<Props> = ({ data }) => {
{t('financial.sex')} {t('financial.sex')}
</div> </div>
<div> <div>
{data.user?.realUser?.gender === 'male' ? 'مرد' : 'زن'} {data?.gender === 'MALE' ? 'مرد' : 'زن'}
</div> </div>
</div> </div>
</div> </div>
@@ -56,7 +56,7 @@ const RealInfo: FC<Props> = ({ data }) => {
{t('financial.phone')} {t('financial.phone')}
</div> </div>
<div> <div>
{data.user?.phone} {data?.phone}
</div> </div>
</div> </div>
@@ -67,7 +67,7 @@ const RealInfo: FC<Props> = ({ data }) => {
{t('receip.postal_code')} {t('receip.postal_code')}
</div> </div>
<div> <div>
{data.user?.address?.postalCode} {data?.address?.postalCode}
</div> </div>
</div> </div>
@@ -79,7 +79,7 @@ const RealInfo: FC<Props> = ({ data }) => {
{t('receip.state')} {t('receip.state')}
</div> </div>
<div> <div>
{data.user?.address?.city?.province?.name} {data?.address?.city?.province?.name}
</div> </div>
</div> </div>
<div className='flex gap-2'> <div className='flex gap-2'>
@@ -87,7 +87,7 @@ const RealInfo: FC<Props> = ({ data }) => {
{t('receip.city')} {t('receip.city')}
</div> </div>
<div> <div>
{data.user?.address?.city?.name} {data?.address?.city?.name}
</div> </div>
</div> </div>
@@ -96,7 +96,7 @@ const RealInfo: FC<Props> = ({ data }) => {
{t('receip.address')} {t('receip.address')}
</div> </div>
<div> <div>
{data.user?.address?.address} {data?.address?.fullAddress}
</div> </div>
</div> </div>
</div> </div>