fix financial
This commit is contained in:
@@ -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} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,117 +1,118 @@
|
|||||||
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()
|
||||||
|
|
||||||
return (
|
const data = d?.data?.legalUser
|
||||||
<Fragment>
|
|
||||||
<div className='mt-8 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'>
|
if (isSuccess)
|
||||||
<div className='flex gap-2'>
|
return (
|
||||||
<div className='text-description'>
|
<Fragment>
|
||||||
{t('receip.type_person')}
|
<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>
|
||||||
<div>
|
|
||||||
{
|
<div className='flex gap-2'>
|
||||||
data?.user?.legalUser ?
|
<div className='text-description'>
|
||||||
t('receip.company') :
|
{t('receip.representativeـname')}
|
||||||
t('receip.real_person')
|
</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>
|
</div>
|
||||||
|
|
||||||
<div className='flex gap-2'>
|
<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='text-description'>
|
<div className='flex gap-2'>
|
||||||
{t('receip.representativeـname')}
|
<div className='text-description'>
|
||||||
|
{t('receip.tel_company')}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{data.phone}
|
||||||
|
</div>
|
||||||
</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>
|
||||||
|
|
||||||
|
<div className='flex gap-2'>
|
||||||
|
<div className='text-description'>
|
||||||
|
{t('receip.postal_code')}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{data?.address?.postalCode}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='flex gap-2'>
|
<div className='mt-6 flex xl:flex-row flex-col xl:gap-16 gap-4 xl:items-center text-xs'>
|
||||||
<div className='text-description'>
|
<div className='flex gap-2'>
|
||||||
{t('receip.company_name')}
|
<div className='text-description'>
|
||||||
|
{t('receip.state')}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{data?.address?.city?.province?.name}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div className='flex gap-2'>
|
||||||
{data.user?.legalUser?.companyRegisteredName}
|
<div className='text-description'>
|
||||||
|
{t('receip.city')}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{data?.address?.city?.name}
|
||||||
|
</div>
|
||||||
</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='flex gap-2'>
|
<div className='text-description'>
|
||||||
<div className='text-description'>
|
{t('receip.address')}
|
||||||
{t('receip.tel_company')}
|
</div>
|
||||||
</div>
|
<div>
|
||||||
<div>
|
{data?.address?.fullAddress}
|
||||||
{data.user?.legalUser?.number}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</Fragment>
|
||||||
<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>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default LegalInfo
|
export default LegalInfo
|
||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user