diff --git a/src/common/modal/index.tsx b/src/common/modal/index.tsx
index 2734f1d..b655540 100644
--- a/src/common/modal/index.tsx
+++ b/src/common/modal/index.tsx
@@ -14,6 +14,7 @@ export default function MuiModal({
submitOnClick,
disabled,
handleCloseCustom,
+ aboveSubmit,
children,
}: MuiModalProps) {
const [open, setOpen] = useState(false);
@@ -57,22 +58,27 @@ export default function MuiModal({
{children}
-
-
- {submitText && (
-
+
+ {aboveSubmit && (
+ {aboveSubmit}
)}
+
+
+ {submitText && (
+
+ )}
+
diff --git a/src/pages/shop/section/productList/components/ModalBuy.tsx b/src/pages/shop/section/productList/components/ModalBuy.tsx
index 2b9550a..1ba0fc5 100644
--- a/src/pages/shop/section/productList/components/ModalBuy.tsx
+++ b/src/pages/shop/section/productList/components/ModalBuy.tsx
@@ -195,13 +195,13 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => {
};
const submitHandler = () => {
- if (requiresAdvancedVerification) {
- goToAdvancedVerification();
+ if (hasExtraDescription && !hasReadDescription) {
+ toast.error("لطفا ابتدا توضیحات سرویس را مطالعه و تایید کنید");
return;
}
- if (hasExtraDescription && !hasReadDescription) {
- toast.error("لطفا ابتدا توضیحات سرویس را مطالعه و تایید کنید");
+ if (requiresAdvancedVerification) {
+ goToAdvancedVerification();
return;
}
@@ -213,6 +213,7 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => {
const payload = {
...formik.values,
status: "buy",
+ ...(hasExtraDescription ? { hasReadDescription: true } : {}),
...(needsShahkarVerification ? { nationalCode: nationalCode.trim() } : {}),
};
@@ -291,11 +292,7 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => {
setIsOpenModal={setIsOpen}
submitText={data?.data?.result?.max_config === 0 ? undefined : "خرید"}
submitOnClick={submitHandler}
- disabled={
- isLoading ||
- isFetching ||
- (hasExtraDescription && !hasReadDescription)
- }
+ disabled={isLoading || isFetching}
nameService={
isLoading || isFetching
? "درحال بارگذاری..."
@@ -303,6 +300,19 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => {
? data?.data.result.title
: "خطا رخ داد"
}
+ aboveSubmit={
+ hasExtraDescription ? (
+
+ ) : undefined
+ }
>
{error && (
@@ -349,17 +359,6 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => {
توضیحات سرویس
)}
- {hasExtraDescription && (
-
- )}
{" "}
کاربر گرامی لطفا از خاموش بودن vpn خود اطمینان حاصل فرمایید تا در
diff --git a/src/pages/shop/section/productList/components/ModalDnsServiceInfo.tsx b/src/pages/shop/section/productList/components/ModalDnsServiceInfo.tsx
index d2d85fd..41cd93a 100644
--- a/src/pages/shop/section/productList/components/ModalDnsServiceInfo.tsx
+++ b/src/pages/shop/section/productList/components/ModalDnsServiceInfo.tsx
@@ -1,7 +1,7 @@
import { Dispatch, SetStateAction } from "react";
import MuiModal from "../../../../../common/modal";
-interface DescriptionSection {
+export interface DescriptionSection {
emoji?: string;
title?: string;
items?: string[];
@@ -41,7 +41,6 @@ const ModalDnsServiceInfo = ({
isOpenModal={isOpen}
setIsOpenModal={setIsOpen}
title="توضیحات سرویس"
- nameService="توضیحات سرویس"
>
{(sections ?? []).map((section, sectionIndex) => (
diff --git a/src/types/props.d.ts b/src/types/props.d.ts
index c54e781..038fc31 100644
--- a/src/types/props.d.ts
+++ b/src/types/props.d.ts
@@ -116,6 +116,7 @@ export interface MuiModalProps {
submitOnClick?: () => void;
disabled?: boolean;
handleCloseCustom ?: () => void;
+ aboveSubmit?: React.ReactNode;
children: React.ReactNode;
}