diff --git a/src/App.tsx b/src/App.tsx index b513a7d..5b1b59a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,7 +12,6 @@ import { IApiErrorRepsonse } from './types/error.types' import MainRouter from './router/Main' import AuthRouter from './router/Auth' import { Pages } from './config/Pages' -import useNumberFont from './hooks/useNumberFont'; i18next.init({ interpolation: { escapeValue: false }, @@ -43,7 +42,7 @@ const queryClient = new QueryClient({ const App: FC = () => { - useNumberFont() + // useNumberFont() const [isLogin, setIsLogin] = useState<'checking' | 'isLogin' | 'isNotLogin'>('checking') useEffect(() => { diff --git a/src/langs/fa.json b/src/langs/fa.json index f11f3b2..7e4e2cb 100644 --- a/src/langs/fa.json +++ b/src/langs/fa.json @@ -219,10 +219,14 @@ "service": "سرویس", "status": "وضعیت تایید", "status_paid": "وضعیت پرداخت", - "PENDING": "در انتظار", + "PENDING": "در انتظار پرداخت", "PAID": "پرداخت شده", "CANCELED": "لغو شده", - "EXPIRED": "منقضی شده" + "EXPIRED": "منقضی شده", + "real_person": "شخص حقیقی", + "fullName": "نام و نام خانوادگی", + "compelete_financal_info_error": "برای دریافت فاکتور رسمی اطلاعات مالی خود را وارد کنید", + "compelete_financal_info": "تکمیل اطلاعات مالی" }, "edit": "ویرایش", "transaction": { @@ -375,7 +379,8 @@ "state": "استان", "city": "شهر", "notice_cannot_edit": "ویرایش مشخصات فردی بعد از تکمیل اطلاعات امکان پذیر نیست", - "notice_cannot_edit_legal": "ویرایش مشخصات حقوقی بعد از تکمیل اطلاعات امکان پذیر نیست" + "notice_cannot_edit_legal": "ویرایش مشخصات حقوقی بعد از تکمیل اطلاعات امکان پذیر نیست", + "phone": "شماره تماس" }, "man": "مرد", "woman": "زن", diff --git a/src/pages/financial/types/FinancialTypes.ts b/src/pages/financial/types/FinancialTypes.ts index 11840c6..49ee114 100644 --- a/src/pages/financial/types/FinancialTypes.ts +++ b/src/pages/financial/types/FinancialTypes.ts @@ -22,3 +22,36 @@ export type ProvinesItemType = { id: string; name: string; }; + +export type FinancialDataType = { + user: { + id: string; + createdAt: string; + updatedAt: string; + email: string | null; + phone: string; + userName: string | null; + firstName: string; + lastName: string; + birthDate: string; + nationalCode: string; + profilePic: string; + emailVerified: boolean; + userAddress: string; + postalCode: string; + realUser: CreateRealUserType | null; + legalUser: CreateLegalUserType | null; + address: { + address: string; + postalCode: string; + city: { + id: number; + name: string; + province: { + id: number; + name: string; + }; + }; + } | null; + }; +}; diff --git a/src/pages/receipts/Detail.tsx b/src/pages/receipts/Detail.tsx index 3398ab1..e58b8a1 100644 --- a/src/pages/receipts/Detail.tsx +++ b/src/pages/receipts/Detail.tsx @@ -1,7 +1,5 @@ import { FC } from 'react' import { useTranslation } from 'react-i18next' -import { Edit } from 'iconsax-react' -import SamanImage from '../../assets/images/saman.png' import { useParams } from 'react-router-dom' import { useGetInvoiceDetail } from './hooks/useReceiptData' import { useGetFinancialInfo } from '../financial/hooks/useFinancialData' @@ -9,6 +7,10 @@ import { ReceiptDetailItemType } from './types/ReceiptTypes' import { NumberFormat } from '../../config/func' import moment from 'moment-jalaali' import PageLoading from '../../components/PageLoading' +import LegalInfo from './components/LegalInfo' +import RealInfo from './components/RealInfo' +import RegisterInfo from './components/RegisterInfo' +import { clx } from '../../helpers/utils' const ReceiptsDetail: FC = () => { @@ -21,7 +23,6 @@ const ReceiptsDetail: FC = () => {
{t('receip.detail_account')} - ۱۲۳۱۲
{ @@ -35,115 +36,20 @@ const ReceiptsDetail: FC = () => {
{t('receip.personal_information')}
-
- -
- {t('edit')} -
-
-
-
-
- {t('receip.type_person')} -
-
- {t('receip.company')} -
-
-
-
- {t('receip.representativeـname')} -
-
- مهرداد مظفری -
-
+ { + getProfile.data?.data?.user?.legalUser ? + + : + getProfile.data?.data?.user?.realUser ? + + : + } -
-
- {t('receip.company_name')} -
-
- داناک -
-
-
-
- {t('receip.registration_number')} -
-
- ۱۲۳۴ -
-
-
-
-
-
- {t('receip.tel_company')} -
-
- ۰۰۱۲۳۴۵۶۷۸ -
-
-
-
- {t('receip.national_code')} -
-
- ۰۰۱۲۳۴۵۶۷۸ -
-
- -
-
- {t('receip.postal_code')} -
-
- ۳۸۲۱۳۵۸۸۹۲ -
-
- -
- -
-
-
- {t('receip.state')} -
-
- مرکزی -
-
-
-
- {t('receip.state')} -
-
- مرکزی -
-
-
-
- {t('receip.city')} -
-
- اراک -
-
-
-
- {t('receip.address')} -
-
- اراک -خیابان شریعتی-خیابان جنت -
-
-
@@ -205,8 +111,11 @@ const ReceiptsDetail: FC = () => {
{t('receip.receip_information')}
-
-
پرداخت نشده
+
+
{t(`receip.${getInvoce.data?.data?.invoice?.status}`)}
@@ -245,20 +154,7 @@ const ReceiptsDetail: FC = () => { -
-
- saman -
- بانک سامان -
-
-
- saman -
- بانک سامان -
-
-
+ } diff --git a/src/pages/receipts/components/LegalInfo.tsx b/src/pages/receipts/components/LegalInfo.tsx new file mode 100644 index 0000000..6c3a3f4 --- /dev/null +++ b/src/pages/receipts/components/LegalInfo.tsx @@ -0,0 +1,117 @@ +import { FC, Fragment } from 'react' +import { useTranslation } from 'react-i18next' +import { FinancialDataType } from '../../financial/types/FinancialTypes' + +type Props = { + data: FinancialDataType +} + +const LegalInfo: FC = ({ data }) => { + + const { t } = useTranslation('global') + + return ( + +
+
+
+ {t('receip.type_person')} +
+
+ { + data?.user?.legalUser ? + t('receip.company') : + t('receip.real_person') + } +
+
+ +
+
+ {t('receip.representativeـname')} +
+
+ {data.user?.firstName + ' ' + data.user?.lastName} +
+
+ +
+
+ {t('receip.company_name')} +
+
+ {data.user?.legalUser?.companyRegisteredName} +
+
+
+
+ {t('receip.registration_number')} +
+
+ {data.user?.legalUser?.registrationId} +
+
+
+ +
+
+
+ {t('receip.tel_company')} +
+
+ {data.user?.legalUser?.number} +
+
+ +
+
+ {t('receip.national_code')} +
+
+ {data?.user?.legalUser?.nationalId} +
+
+ +
+
+ {t('receip.postal_code')} +
+
+ {data.user?.address?.postalCode} +
+
+ +
+ +
+
+
+ {t('receip.state')} +
+
+ {data.user?.address?.city?.province?.name} +
+
+
+
+ {t('receip.city')} +
+
+ {data.user?.address?.city?.name} +
+
+ +
+
+ {t('receip.address')} +
+
+ {data.user?.address?.address} +
+
+
+
+ ) +} + +export default LegalInfo \ No newline at end of file diff --git a/src/pages/receipts/components/RealInfo.tsx b/src/pages/receipts/components/RealInfo.tsx new file mode 100644 index 0000000..340288a --- /dev/null +++ b/src/pages/receipts/components/RealInfo.tsx @@ -0,0 +1,107 @@ +import { FC, Fragment } from 'react' +import { FinancialDataType } from '../../financial/types/FinancialTypes' +import { useTranslation } from 'react-i18next' + +type Props = { + data: FinancialDataType +} + + +const RealInfo: FC = ({ data }) => { + + const { t } = useTranslation('global') + + return ( + +
+
+
+ {t('receip.type_person')} +
+
+ {t('receip.real_person')} +
+
+ +
+
+ {t('receip.fullName')} +
+
+ {data.user?.firstName + ' ' + data.user?.lastName} +
+
+ +
+
+ {t('financial.father_name')} +
+
+ {data.user?.realUser?.fatherName} +
+
+
+
+ {t('financial.sex')} +
+
+ {data.user?.realUser?.gender === 'male' ? 'مرد' : 'زن'} +
+
+
+ +
+
+
+ {t('financial.phone')} +
+
+ {data.user?.phone} +
+
+ + + +
+
+ {t('receip.postal_code')} +
+
+ {data.user?.address?.postalCode} +
+
+ +
+ +
+
+
+ {t('receip.state')} +
+
+ {data.user?.address?.city?.province?.name} +
+
+
+
+ {t('receip.city')} +
+
+ {data.user?.address?.city?.name} +
+
+ +
+
+ {t('receip.address')} +
+
+ {data.user?.address?.address} +
+
+
+
+ ) +} + +export default RealInfo \ No newline at end of file diff --git a/src/pages/receipts/components/RegisterInfo.tsx b/src/pages/receipts/components/RegisterInfo.tsx new file mode 100644 index 0000000..590ad80 --- /dev/null +++ b/src/pages/receipts/components/RegisterInfo.tsx @@ -0,0 +1,70 @@ +import { FC, Fragment } from 'react' +import { useTranslation } from 'react-i18next' +import { FinancialDataType } from '../../financial/types/FinancialTypes' +import { InfoCircle } from 'iconsax-react' +import Button from '../../../components/Button' +import { Link } from 'react-router-dom' +import { Pages } from '../../../config/Pages' + +type Props = { + data: FinancialDataType +} + +const RegisterInfo: FC = ({ data }) => { + + const { t } = useTranslation('global') + + return ( + + +
+ +
{t('receip.compelete_financal_info_error')}
+ +
+ +
+
+
+
+
+ {t('receip.type_person')} +
+
+ {t('receip.real_person')} +
+
+ + +
+
+ {t('receip.fullName')} +
+
+ {data.user?.firstName + ' ' + data.user?.lastName} +
+
+ +
+
+ {t('financial.phone')} +
+
+ {data.user?.phone} +
+
+
+
+ ) +} + +export default RegisterInfo \ No newline at end of file diff --git a/src/pages/service/DetailService.tsx b/src/pages/service/DetailService.tsx index 769d406..86dc495 100644 --- a/src/pages/service/DetailService.tsx +++ b/src/pages/service/DetailService.tsx @@ -1,5 +1,4 @@ import { FC, Fragment } from 'react' -import RobotImage from '../../assets/images/robot.jpeg' import { useTranslation } from 'react-i18next' import Button from '../../components/Button' import Rate from 'rc-rate' @@ -12,11 +11,14 @@ import { useGetDetailService } from './hooks/useServiceData' import { useParams } from 'react-router-dom' import PageLoading from '../../components/PageLoading' import moment from 'moment-jalaali' +import { useGetAds } from '../ads/hooks/useAdsData' +import { AdsDisplayLocation } from '../ads/types/AdsTypes' const DetailService: FC = () => { const { id } = useParams() const { t } = useTranslation('global') + const getAdsLeft = useGetAds(AdsDisplayLocation.SINGLE_SERVICE_PAGE) const getDetailService = useGetDetailService(id ? id : '') @@ -204,18 +206,23 @@ const DetailService: FC = () => { -
- -
-
- سفارش نرم‌افزار اختصاصی: سرمایه‌ای برای آینده یا فقط هزینه‌ای برای امروز؟ + + { + getAdsLeft.isSuccess && getAdsLeft.data.data.ads[0] && + + + +
+
+ {getAdsLeft.data.data.ads[0].title} +
-
-
+ + } } diff --git a/src/pages/service/MyServices.tsx b/src/pages/service/MyServices.tsx index 49c0b41..1fb1f88 100644 --- a/src/pages/service/MyServices.tsx +++ b/src/pages/service/MyServices.tsx @@ -3,17 +3,19 @@ import { useTranslation } from 'react-i18next' import Input from '../../components/Input' import ServiceSection from '../../components/ServiceSection' import StatusCircle from '../../components/StatusCircle' -import BannerImage from '../../assets/images/banner.png' import { Link } from 'react-router-dom' import { Pages } from '../../config/Pages' import { useGetMyServices } from './hooks/useServiceData' import { MyServicesItem } from './types/ServiecTypes' +import { useGetAds } from '../ads/hooks/useAdsData' +import { AdsDisplayLocation } from '../ads/types/AdsTypes' const MyServices: FC = () => { const { t } = useTranslation('global') const [search, setSearch] = useState('') const getServices = useGetMyServices(search) + const getAdsLeft = useGetAds(AdsDisplayLocation.MY_SERVICES_PAGE) return (
@@ -84,18 +86,22 @@ const MyServices: FC = () => {
-
- -
-
- سفارش نرم‌افزار اختصاصی: سرمایه‌ای برای آینده یا فقط هزینه‌ای برای امروز؟ + { + getAdsLeft.isSuccess && getAdsLeft.data.data.ads[0] && + + + +
+
+ {getAdsLeft.data.data.ads[0].title} +
-
-
+ + }
) } diff --git a/src/pages/service/OtherServices.tsx b/src/pages/service/OtherServices.tsx index b290576..d91db10 100644 --- a/src/pages/service/OtherServices.tsx +++ b/src/pages/service/OtherServices.tsx @@ -32,7 +32,7 @@ const OtherServices: FC = () => { { getAds.data?.data?.ads?.map((item: AdsItemType) => { return ( -
+
- + ) }) } @@ -96,7 +96,7 @@ const OtherServices: FC = () => { { getAdsLeft.isSuccess && getAdsLeft.data.data.ads[0] && -
+ { {getAdsLeft.data.data.ads[0].title}
- + } )