diff --git a/apps/OpenSign/public/locales/en/translation.json b/apps/OpenSign/public/locales/en/translation.json index 6077d59dd..4bad06f67 100644 --- a/apps/OpenSign/public/locales/en/translation.json +++ b/apps/OpenSign/public/locales/en/translation.json @@ -126,7 +126,8 @@ "Share with team": "Share with team", "Share": "Share", "View": "View", - "option": "Option" + "option": "Option", + "Embed":"Embed" }, "report-heading": { "Sr.No": "Sr.No", @@ -616,5 +617,6 @@ "buycredits": "Buy credits", "rotate-right":"Rotate right", "rotate-left":"Rotate left", - "rotate-alert-mssg":"All widgets on this page will be lost. Are you sure you want to proceed?" + "rotate-alert-mssg":"All widgets on this page will be lost. Are you sure you want to proceed?", + "templateid":"Template-Id" } diff --git a/apps/OpenSign/public/locales/fr/translation.json b/apps/OpenSign/public/locales/fr/translation.json index 53b329712..cd831c6c8 100644 --- a/apps/OpenSign/public/locales/fr/translation.json +++ b/apps/OpenSign/public/locales/fr/translation.json @@ -146,7 +146,8 @@ "Share with team": "Partager avec l'équipe", "Share": "Partager", "View": "Voir", - "option": "Option" + "option": "Option", + "Embed":"Intégrer" }, "report-help": { "Draft Documents": "Il s'agit de documents que vous avez commencés mais que vous n'avez pas finalisés pour envoi.", @@ -616,5 +617,6 @@ "buycredits": "Acheter des crédits", "rotate-right" :"Faire pivoter à droite", "rotate-left" :"Faire pivoter à gauche", - "rotate-alert-mssg" :"Tous les widgets de cette page seront perdus. Êtes-vous sûr de vouloir continuer ?" + "rotate-alert-mssg" :"Tous les widgets de cette page seront perdus. Êtes-vous sûr de vouloir continuer ?", + "templateid":"ID de modèle" } diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.js index f09d72279..8100f5477 100644 --- a/apps/OpenSign/src/json/ReportJson.js +++ b/apps/OpenSign/src/json/ReportJson.js @@ -354,6 +354,13 @@ export default function reportJson(id) { redirectUrl: "template", action: "redirect" }, + { + btnId: "2434", + btnLabel: "Embed", + hoverLabel: "Embed", + btnIcon: "fa-light fa-code", + action: "Embed" + }, { btnId: "1834", btnLabel: "Delete", diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.js index 8bde5629a..656cb7958 100644 --- a/apps/OpenSign/src/pages/PdfRequestFiles.js +++ b/apps/OpenSign/src/pages/PdfRequestFiles.js @@ -299,63 +299,65 @@ function PdfRequestFiles(props) { templateDeatils.data && templateDeatils.data.result ? [templateDeatils.data.result] : []; - - if (documentData && documentData.length > 0) { - const url = - documentData[0] && - (documentData[0]?.SignedUrl || documentData[0]?.URL); - if (url) { - //convert document url in array buffer format to use embed widgets in pdf using pdf-lib - const arrayBuffer = await convertPdfArrayBuffer(url); - if (arrayBuffer === "Error") { + if (documentData && documentData[0]?.error) { + props?.setTemplateStatus({ + status: "Invalid" + }); + } else if (documentData && documentData.length > 0) { + if (documentData[0]?.IsPublic) { + props?.setTemplateStatus({ + status: "Success" + }); + const url = + documentData[0] && + (documentData[0]?.SignedUrl || documentData[0]?.URL); + if (url) { + //convert document url in array buffer format to use embed widgets in pdf using pdf-lib + const arrayBuffer = await convertPdfArrayBuffer(url); + if (arrayBuffer === "Error") { + setHandleError(t("something-went-wrong-mssg")); + } else { + setPdfArrayBuffer(arrayBuffer); + } + } else { setHandleError(t("something-went-wrong-mssg")); - } else { - setPdfArrayBuffer(arrayBuffer); } + setIsPublicTemplate(true); + const getPublicRole = documentData[0]?.PublicRole[0]; + const getUniqueIdDetails = documentData[0]?.Placeholders.find( + (x) => x.Role === getPublicRole + ); + if (getUniqueIdDetails) { + setUniqueId(getUniqueIdDetails.Id); + } + setSignerPos(documentData[0]?.Placeholders); + let placeholdersOrSigners = []; + // const placeholder = documentData[0]?.Placeholders; + for (const placeholder of documentData[0].Placeholders) { + //`emailExist` variable to handle condition for quick send flow and show unsigned signers list + const signerIdExist = placeholder?.signerObjId; + if (signerIdExist) { + const getSignerData = documentData[0].Signers.find( + (data) => data.objectId === placeholder?.signerObjId + ); + placeholdersOrSigners.push(getSignerData); + } else { + placeholdersOrSigners.push(placeholder); + } + } + setUnSignedSigners(placeholdersOrSigners); + setPdfDetails(documentData); + setIsLoading({ + isLoad: false + }); } else { - setHandleError(t("something-went-wrong-mssg")); + props?.setTemplateStatus({ + status: "Private" + }); } - setIsPublicTemplate(true); - const getPublicRole = documentData[0]?.PublicRole[0]; - const getUniqueIdDetails = documentData[0]?.Placeholders.find( - (x) => x.Role === getPublicRole - ); - if (getUniqueIdDetails) { - setUniqueId(getUniqueIdDetails.Id); - } - setSignerPos(documentData[0]?.Placeholders); - let placeholdersOrSigners = []; - // const placeholder = documentData[0]?.Placeholders; - for (const placeholder of documentData[0].Placeholders) { - //`emailExist` variable to handle condition for quick send flow and show unsigned signers list - const signerIdExist = placeholder?.signerObjId; - if (signerIdExist) { - const getSignerData = documentData[0].Signers.find( - (data) => data.objectId === placeholder?.signerObjId - ); - placeholdersOrSigners.push(getSignerData); - } else { - placeholdersOrSigners.push(placeholder); - } - } - setUnSignedSigners(placeholdersOrSigners); - setPdfDetails(documentData); - setIsLoading({ - isLoad: false - }); - } else if ( - documentData === "Error: Something went wrong!" || - (documentData.result && documentData.result.error) - ) { - console.log("err in get template details "); - setHandleError(t("something-went-wrong-mssg")); - setIsLoading({ - isLoad: false - }); } else { - setHandleError(t("no-data")); - setIsLoading({ - isLoad: false + props?.setTemplateStatus({ + status: "Invalid" }); } } catch (err) { diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js index 8b0286fe0..4f33ebed8 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.js +++ b/apps/OpenSign/src/primitives/GetReportDisplay.js @@ -362,6 +362,8 @@ const ReportTable = (props) => { setSelectedTeam(formatedList); } setIsShareWith({ [item.objectId]: true }); + } else if (act.action === "Embed") { + handleEmbedFunction(item); } }; // Get current list @@ -834,7 +836,6 @@ const ReportTable = (props) => { setTimeout(() => setIsAlert(false), 1500); } }; - //function to make template public and set public role const handlePublicTemplate = async (item) => { if (selectedPublicRole || !props.isPublic[item.objectId]) { @@ -994,9 +995,26 @@ const ReportTable = (props) => { type: "success", message: t("copied") }); - setTimeout(() => setIsAlert(false), 1500); + setCopied({ ...copied, publicprofile: true }); + setTimeout(() => { + setIsAlert(false); + setCopied(false); + }, 1500); }; + const copyTemplateId = (templateid) => { + copytoData(templateid); + setIsAlert(true); + setAlertMsg({ + type: "success", + message: t("copied") + }); + setCopied({ ...copied, templateid: true }); + setTimeout(() => { + setIsAlert(false); + setCopied(false); + }, 1500); + }; const handleShowRole = (item) => { const getRole = item.Placeholders.find((data) => !data.signerObjId); return getRole?.Role; @@ -1035,7 +1053,14 @@ const ReportTable = (props) => { setTimeout(() => setIsAlert(false), 1500); } }; - + const handleEmbedFunction = (item) => { + setIsPublicProfile({ + [item.objectId]: props.isPublic[item.objectId] + }); + let extendUser = JSON.parse(localStorage.getItem("Extand_Class")); + setIsPublicUserName(extendUser[0]?.UserName || ""); + }; + console.log("ispublic", props.isPublic); return (
{Object.keys(actLoader)?.length > 0 && ( @@ -1312,16 +1337,90 @@ const ReportTable = (props) => { {publicUserName ? (

{t("public-url-copy-mssg")}

-
- - {t("public-url")}: - - copytoProfileLink()} - className="underline underline-offset-2 w-[150px] md:w-[350px] whitespace-nowrap overflow-hidden text-ellipsis cursor-pointer" - > - {publicUrl()} - +
+
+ + {t("public-url")} : + + + copytoProfileLink() + } + className="ml-[2px] underline underline-offset-2 cursor-pointer" + > + {publicUrl()} + +
+
+ + + + +
+
+
+
+ + {t("templateid")} : + + + copyTemplateId(item.objectId) + } + className="underline ml-[2px] underline-offset-2 w-[150px] md:w-[350px] whitespace-nowrap overflow-hidden text-ellipsis cursor-pointer" + > + {item.objectId} + +
+
+ + + + +
) : ( @@ -1376,33 +1475,65 @@ const ReportTable = (props) => { {isOption[item.objectId] && act.action === "option" && ( )}