From 12f60c9be511ff68814dbba116225e233b815e23 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Thu, 22 Aug 2024 12:49:48 +0530 Subject: [PATCH] fix: wrong alert is visible after loader in quicksend popup --- apps/OpenSign/src/components/BulkSendUi.js | 309 +++++++++--------- .../src/primitives/GetReportDisplay.js | 2 +- 2 files changed, 162 insertions(+), 149 deletions(-) diff --git a/apps/OpenSign/src/components/BulkSendUi.js b/apps/OpenSign/src/components/BulkSendUi.js index 9e6a4b657..f04130cbf 100644 --- a/apps/OpenSign/src/components/BulkSendUi.js +++ b/apps/OpenSign/src/components/BulkSendUi.js @@ -20,11 +20,11 @@ const BulkSendUi = (props) => { const [amount, setAmount] = useState({ price: (75.0).toFixed(2), quantity: 500, - totalPrice: 0, priceperbulksend: 0.15, totalQuickSend: 0 }); const [isQuotaReached, setIsQuotaReached] = useState(false); + const [isLoader, setIsLoader] = useState(false); const allowedSigners = 50; useEffect(() => { signatureExist(); @@ -34,24 +34,24 @@ const BulkSendUi = (props) => { //function to check atleast one signature field exist const signatureExist = async () => { if (isEnableSubscription) { - setIsSubmit(true); + setIsLoader(true); try { const allowedquicksend = await Parse.Cloud.run("allowedquicksend"); if (allowedquicksend > 0) { setIsBulkAvailable(true); - const getPlaceholder = props.item?.Placeholders; - const checkIsSignatureExistt = getPlaceholder?.every( - (placeholderObj) => - placeholderObj?.placeHolder?.some((holder) => - holder?.pos?.some((posItem) => posItem?.type === "signature") - ) - ); - setIsSignatureExist(checkIsSignatureExistt); } setAmount((obj) => ({ ...obj, totalQuickSend: allowedquicksend })); - setIsSubmit(false); + const getPlaceholder = props.item?.Placeholders; + const checkIsSignatureExistt = getPlaceholder?.every((placeholderObj) => + placeholderObj?.placeHolder?.some((holder) => + holder?.pos?.some((posItem) => posItem?.type === "signature") + ) + ); + setIsSignatureExist(checkIsSignatureExistt); + setIsLoader(false); } catch (err) { - setIsSubmit(false); + setIsLoader(false); + alert(t("something-went-wrong-mssg")); console.log("Err", err); } } else { @@ -63,6 +63,7 @@ const BulkSendUi = (props) => { ) ); setIsSignatureExist(checkIsSignatureExistt); + setIsLoader(false); } }; useEffect(() => { @@ -246,9 +247,9 @@ const BulkSendUi = (props) => { setAmount((obj) => ({ ...obj, quantity: 500, - priceperapi: 0.15, + priceperbulksend: 0.15, price: (75.0).toFixed(2), - totalapis: _resAddon.addon + totalQuickSend: _resAddon.addon })); } } @@ -274,146 +275,158 @@ const BulkSendUi = (props) => { }; return ( <> - {isSubmit && ( -
+ {isLoader ? ( +
- )} - {isBulkAvailable ? ( + ) : ( <> - {props.Placeholders?.length > 0 ? ( - isSignatureExist ? ( - <> - {props.Placeholders?.some((x) => !x.signerObjId) ? ( -
-
-
- {forms?.map((form, index) => ( -
- {form?.fields?.map((field, fieldIndex) => ( -
- - - handleInputChange(index, signer, fieldIndex) - } - /> -
- ))} - {forms?.length > 1 && ( - - )} -
-
- ))} -
-
- - -
-
- handleCloseQuotaReached()} - > -
-

- {t("quotaerrquicksend")} -

- -
-
-
- ) : ( -
- {t("quick-send-alert-1")} -
- )} - - ) : ( -
- {t("quick-send-alert-2")} -
- ) - ) : ( -
- {t("quick-send-alert-3")} + {isSubmit && ( +
+
)} + {isBulkAvailable ? ( + <> + {props.Placeholders?.length > 0 ? ( + isSignatureExist ? ( + <> + {props.Placeholders?.some((x) => !x.signerObjId) ? ( +
+
+
+ {forms?.map((form, index) => ( +
+ {form?.fields?.map((field, fieldIndex) => ( +
+ + + handleInputChange( + index, + signer, + fieldIndex + ) + } + /> +
+ ))} + {forms?.length > 1 && ( + + )} +
+
+ ))} +
+
+ + +
+
+ handleCloseQuotaReached()} + > +
+

+ {t("quotaerrquicksend")} +

+ +
+
+
+ ) : ( +
+ {t("quick-send-alert-1")} +
+ )} + + ) : ( +
+ {t("quick-send-alert-2")} +
+ ) + ) : ( +
+ {t("quick-send-alert-3")} +
+ )} + + ) : ( +
+

+ {t("additional-quicksend")} +

+
+ + +
+
+ +
+ USD {amount.price} +
+
+
+ +
+ )} - ) : ( -
-

- {t("additional-quicksend")} -

-
- - -
-
- -
- USD {amount.price} -
-
-
- -
)} ); diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js index 169fe93d0..8b0286fe0 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.js +++ b/apps/OpenSign/src/primitives/GetReportDisplay.js @@ -1669,7 +1669,7 @@ const ReportTable = (props) => { handleClose={() => setIsBulkSend({})} > {isLoader[item.objectId] ? ( -
+
) : (