diff --git a/apps/OpenSign/src/styles/loader.css b/apps/OpenSign/src/styles/loader.css
index a401728ee..e6e1624f8 100644
--- a/apps/OpenSign/src/styles/loader.css
+++ b/apps/OpenSign/src/styles/loader.css
@@ -2211,7 +2211,5 @@
background-position: -2em 0;
}
}
- .box:nth-of-type(n + 43) {
- display: none;
- }
-
\ No newline at end of file
+
+
diff --git a/apps/OpenSignServer/cloud/parsefunction/getDocument.js b/apps/OpenSignServer/cloud/parsefunction/getDocument.js
index 8666cafdf..a88a97cf4 100644
--- a/apps/OpenSignServer/cloud/parsefunction/getDocument.js
+++ b/apps/OpenSignServer/cloud/parsefunction/getDocument.js
@@ -21,6 +21,7 @@ export default async function getDocument(request) {
query.include('Signers');
query.include('AuditTrail.UserPtr');
query.include('Placeholders');
+ query.notEqualTo('IsArchive', true)
const res = await query.first({ useMasterKey: true });
if (res) {
const acl = res.getACL();
diff --git a/apps/OpenSignServer/cloud/parsefunction/getDrive.js b/apps/OpenSignServer/cloud/parsefunction/getDrive.js
index 1813bc069..516ca9764 100644
--- a/apps/OpenSignServer/cloud/parsefunction/getDrive.js
+++ b/apps/OpenSignServer/cloud/parsefunction/getDrive.js
@@ -16,9 +16,9 @@ export default async function getDrive(request) {
if (userId) {
let url;
if (docId) {
- url = `${classUrl}?where={"Folder":{"__type":"Pointer","className":"contracts_Document","objectId":"${docId}"},"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${userId}"}}&include=ExtUserPtr,Signers,Folder`;
+ url = `${classUrl}?where={"Folder":{"__type":"Pointer","className":"contracts_Document","objectId":"${docId}"},"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${userId}"},"IsArchive":{"$ne":true}}&include=ExtUserPtr,Signers,Folder`;
} else {
- url = `${classUrl}?where={"Folder":{"$exists":false},"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${userId}"}}&include=ExtUserPtr,Signers`;
+ url = `${classUrl}?where={"Folder":{"$exists":false},"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${userId}"},"IsArchive":{"$ne":true}}&include=ExtUserPtr,Signers`;
}
try {
const res = await axios.get(url, {
diff --git a/apps/OpenSignServer/cloud/parsefunction/reportsJson.js b/apps/OpenSignServer/cloud/parsefunction/reportsJson.js
index 12adf13a8..1ee858372 100644
--- a/apps/OpenSignServer/cloud/parsefunction/reportsJson.js
+++ b/apps/OpenSignServer/cloud/parsefunction/reportsJson.js
@@ -7,11 +7,11 @@ export default function reportJson(id, userId) {
return {
reportName: 'Draft Documents',
params: {
- Type: null,
- $or: [
- { Signers: null, SignedUrl: null },
- { Signers: { $exists: true }, Placeholders: null },
- ],
+ Type: { $ne: 'Folder' },
+ IsCompleted: { $ne: true },
+ IsDeclined: { $ne: true },
+ IsArchive: { $ne: true },
+ $or: [{ Signers: null }, { Signers: { $exists: true }, Placeholders: null }],
CreatedBy: {
__type: 'Pointer',
className: '_User',
@@ -28,6 +28,7 @@ export default function reportJson(id, userId) {
Type: { $ne: 'Folder' },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
+ IsArchive: { $ne: true },
ExpiryDate: {
$gt: { __type: 'Date', iso: new Date().toISOString() },
},
@@ -66,6 +67,7 @@ export default function reportJson(id, userId) {
Placeholders: { $ne: null },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
+ IsArchive: { $ne: true },
CreatedBy: {
__type: 'Pointer',
className: '_User',
@@ -82,7 +84,7 @@ export default function reportJson(id, userId) {
return {
reportName: 'Completed Documents',
params: {
- Type: null,
+ Type: { $ne: 'Folder' },
IsCompleted: true,
CreatedBy: {
__type: 'Pointer',
@@ -90,6 +92,7 @@ export default function reportJson(id, userId) {
objectId: currentUserId,
},
IsDeclined: { $ne: true },
+ IsArchive: { $ne: true },
},
keys: [
'Name',
@@ -108,6 +111,7 @@ export default function reportJson(id, userId) {
reportName: 'Declined Documents',
params: {
Type: null,
+ IsArchive: { $ne: true },
IsDeclined: true,
CreatedBy: {
__type: 'Pointer',
@@ -125,6 +129,7 @@ export default function reportJson(id, userId) {
params: {
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
+ IsArchive: { $ne: true },
Type: { $ne: 'Folder' },
$and: [
{
@@ -157,6 +162,7 @@ export default function reportJson(id, userId) {
Placeholders: { $ne: null },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
+ IsArchive: { $ne: true },
CreatedBy: {
__type: 'Pointer',
className: '_User',
@@ -176,6 +182,7 @@ export default function reportJson(id, userId) {
Type: { $ne: 'Folder' },
IsCompleted: { $ne: true },
IsDeclined: { $ne: true },
+ IsArchive: { $ne: true },
ExpiryDate: {
$gt: { __type: 'Date', iso: new Date().toISOString() },
},
@@ -200,11 +207,11 @@ export default function reportJson(id, userId) {
return {
reportName: 'Drafts',
params: {
- Type: null,
- $or: [
- { Signers: null, SignedUrl: null },
- { Signers: { $exists: true }, Placeholders: null },
- ],
+ Type: { $ne: 'Folder' },
+ IsCompleted: { $ne: true },
+ IsDeclined: { $ne: true },
+ IsArchive: { $ne: true },
+ $or: [{ Signers: null }, { Signers: { $exists: true }, Placeholders: null }],
CreatedBy: {
__type: 'Pointer',
className: '_User',
@@ -235,6 +242,7 @@ export default function reportJson(id, userId) {
reportClass: 'contracts_Template',
params: {
Type: { $ne: 'Folder' },
+ IsArchive: { $ne: true },
CreatedBy: {
__type: 'Pointer',
className: '_User',
diff --git a/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs b/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs
index 774855dc6..e092c2db5 100644
--- a/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs
+++ b/apps/OpenSignServer/databases/migrations/20231208132950-update_template_menu.cjs
@@ -59,7 +59,7 @@ exports.up = async Parse => {
},
{
icon: 'fas fa-folder',
- title: 'OpenSignDrive™',
+ title: 'OpenSign™ Drive',
target: '_self',
pageType: 'mf',
description: '',
@@ -206,6 +206,15 @@ exports.up = async Parse => {
description: '',
objectId: '6TeaPr321t',
},
+ {
+ icon: 'fas fa-folder',
+ title: 'OpenSign™ Drive',
+ target: '_self',
+ pageType: 'mf',
+ description: '',
+ objectId:
+ 'remoteUrl=aHR0cHM6Ly9xaWstYWktb3JnLmdpdGh1Yi5pby9TaWduLU1pY3JvYXBwVjIvcmVtb3RlRW50cnkuanM=&moduleToLoad=AppRoutes&remoteName=signmicroapp/legadrive',
+ },
{
icon: 'fas fa-address-card',
title: 'Reports',
@@ -576,4 +585,4 @@ exports.down = async Parse => {
// schema.addString('name').addNumber('cash');
const batch = [revertUserMenu, revertAdminMenu];
return Parse.Object.saveAll(batch, { useMasterKey: true });
-};
+};
\ No newline at end of file
diff --git a/apps/OpenSignServer/databases/migrations/20240110100110-update_document_cls_cjs.cjs b/apps/OpenSignServer/databases/migrations/20240110100110-update_document_cls_cjs.cjs
new file mode 100644
index 000000000..1a95b4f46
--- /dev/null
+++ b/apps/OpenSignServer/databases/migrations/20240110100110-update_document_cls_cjs.cjs
@@ -0,0 +1,23 @@
+/**
+ *
+ * @param {Parse} Parse
+ */
+exports.up = async Parse => {
+ // TODO: set className here
+ const className = 'contracts_Document';
+ const schema = new Parse.Schema(className);
+ schema.addBoolean('IsArchive');
+ return schema.update();
+ };
+
+ /**
+ *
+ * @param {Parse} Parse
+ */
+ exports.down = async Parse => {
+ // TODO: set className here
+ const className = 'contracts_Document';
+ const schema = new Parse.Schema(className);
+ schema.deleteField('IsArchive');
+ return schema.update();
+ };
\ No newline at end of file
diff --git a/microfrontends/SignDocuments/src/Component/DraftDocument.js b/microfrontends/SignDocuments/src/Component/DraftDocument.js
index 95ab370b9..8384871f4 100644
--- a/microfrontends/SignDocuments/src/Component/DraftDocument.js
+++ b/microfrontends/SignDocuments/src/Component/DraftDocument.js
@@ -47,65 +47,34 @@ function DraftDocument() {
//check document type and render on signyour self and placeholder route
const handleDraftDoc = () => {
const data = pdfDetails[0];
- const checkSignerExist =
- pdfDetails[0] && pdfDetails[0].Signers && pdfDetails[0].Signers;
- const isPlaceholder =
- pdfDetails[0].Placeholders && pdfDetails[0].Placeholders;
- const isDecline = data.IsDeclined && data.IsDeclined;
- const signUrl = data.SignedUrl && data.SignedUrl;
- const expireDate =
- pdfDetails[0] &&
- pdfDetails[0].ExpiryDate.iso &&
- pdfDetails[0].ExpiryDate.iso;
- const expireUpdateDate = new Date(expireDate).getTime();
- const currDate = new Date().getTime();
const hostUrl = getHostUrl();
+ const signerExist = data.Signers && data.Signers;
+ const isDecline = data.IsDeclined && data.IsDeclined;
+ const isPlaceholder = data.Placeholders && data.Placeholders;
- //checking document is completed and signer exist then navigate to pdfRequestFiles file
- if (data.IsCompleted && checkSignerExist) {
- navigate(`${hostUrl}pdfRequestFiles`);
+ //checking if document has completed and request signature flow
+ if (data?.IsCompleted && signerExist?.length > 0) {
+ navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
}
- //checking document is completed and signer does not exist then navigate to recipientSignPdf file
- else if (data.IsCompleted && !checkSignerExist) {
- navigate(`${hostUrl}signaturePdf`);
+ //checking if document has completed and signyour-self flow
+ else if (!signerExist && !isPlaceholder) {
+ navigate(`${hostUrl}signaturePdf/${data.objectId}`);
}
- //checking document is declined by someone then navigate to pdfRequestFiles file
+ //checking if document has declined by someone
else if (isDecline) {
- navigate(`${hostUrl}pdfRequestFiles`);
+ navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
+ //checking draft type document
}
- //checking document has expired and signers exist and placeholder does not set yet then navigate to pdfRequestFiles file
- //draft type request sign document
+ //Inprogress document
+ else if (isPlaceholder?.length > 0 && signerExist?.length > 0) {
+ navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
+ } //placeholder draft document
else if (
- currDate > expireUpdateDate &&
- checkSignerExist &&
- !isPlaceholder
+ (signerExist?.length > 0 &&
+ (!isPlaceholder || isPlaceholder?.length === 0)) ||
+ ((!signerExist || signerExist?.length === 0) && isPlaceholder?.length > 0)
) {
- navigate(`${hostUrl}placeHolderSign`);
- }
- //checking document has expired and signers does not exist and document not signed yet then navigate to pdfRequestFiles file
- //draft type signyouselfdocument
- else if (
- currDate > expireUpdateDate &&
- !checkSignerExist &&
- !isPlaceholder &&
- !signUrl
- ) {
- // window.location.hash = `/signaturePdf`;
- navigate(`${hostUrl}signaturePdf`);
- }
- //checking document has expired and signers exist and document then navigate to pdfRequestFiles file
- else if (currDate > expireUpdateDate) {
- // window.location.hash = `/pdfRequestFiles`;
- navigate(`${hostUrl}pdfRequestFiles`);
- }
- //checking document has expired not been expired yet and signers exist and placeholder does not set yet then navigate to pdfRequestFiles file
- //draft type request sign document
- else if (!signUrl && checkSignerExist) {
- navigate(`${hostUrl}placeHolderSign`);
- // window.location.hash = `/placeHolderSign`;
- } else {
- // window.location.hash = `/signaturePdf/`;
- navigate(`${hostUrl}signaturePdf`);
+ navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
}
};
diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js
index 1c7ae57c1..760ce39af 100644
--- a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js
+++ b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js
@@ -10,6 +10,9 @@ import { getHostUrl } from "../../../utils/Utils";
import { useNavigate } from "react-router-dom";
import Table from "react-bootstrap/Table";
import * as HoverCard from "@radix-ui/react-hover-card";
+import SelectFolder from "../../../premitives/SelectFolder";
+import ModalUi from "../../../premitives/ModalUi";
+import { themeColor } from "../../../utils/ThemeColor/backColor";
function PdfFileComponent({
pdfData,
@@ -22,7 +25,15 @@ function PdfFileComponent({
const [rename, setRename] = useState("");
const [renameValue, setRenameValue] = useState("");
const inputRef = useRef(null);
-
+ const [isOpenMoveModal, setIsOpenMoveModal] = useState(false);
+ const [selectDoc, setSelectDoc] = useState();
+ const [isDeleteDoc, setIsDeleteDoc] = useState(false);
+ const contextMenu = [
+ { type: "Download", icon: "fa-solid fa-arrow-down" },
+ { type: "Rename", icon: "fa-solid fa-font" },
+ { type: "Move", icon: "fa-solid fa-file-export" },
+ { type: "Delete", icon: "fa-solid fa-trash" }
+ ];
const navigate = useNavigate();
//to focus input box on press rename to change doc name
@@ -100,74 +111,175 @@ function PdfFileComponent({
//function for navigate user to microapp-signature component
const checkPdfStatus = async (data) => {
const hostUrl = getHostUrl();
- const expireDate = data.ExpiryDate.iso;
- const expireUpdateDate = new Date(expireDate).getTime();
- const currDate = new Date().getTime();
+
const signerExist = data.Signers && data.Signers;
- const signUrl = data.SignedUrl && data.SignedUrl;
const isDecline = data.IsDeclined && data.IsDeclined;
const isPlaceholder = data.Placeholders && data.Placeholders;
- //checking and navigate to signyouself page
- const checkPlaceHolder = data.Placeholders;
- //checking if document has completed
- if (data.IsCompleted && signerExist) {
- navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
- // window.location.hash = `/pdfRequestFiles/${data.objectId}`;
- } else if (data.IsCompleted && !signerExist) {
+ //checking if document has completed and request signature flow
+ if (data?.IsCompleted && signerExist?.length > 0) {
+ navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
+ }
+ //checking if document has completed and signyour-self flow
+ else if (!signerExist && !isPlaceholder) {
navigate(`${hostUrl}signaturePdf/${data.objectId}`);
}
//checking if document has declined by someone
else if (isDecline) {
navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
- // window.location.hash = `/pdfRequestFiles/${data.objectId}`;
- } else if (currDate > expireUpdateDate && signerExist && !isPlaceholder) {
- // window.location.hash = `/placeHolderSign/${data.objectId}`;
- navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
- } else if (
- currDate > expireUpdateDate &&
- !signerExist &&
- !isPlaceholder &&
- !signUrl
- ) {
- navigate(`${hostUrl}signaturePdf/${data.objectId}`);
- // window.location.hash = `/signaturePdf/${data.objectId}`;
+ //checking draft type document
}
- //checking if document has expired
- else if (currDate > expireUpdateDate) {
+ //Inprogress document
+ else if (isPlaceholder?.length > 0 && signerExist?.length > 0) {
navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
- // window.location.hash = `/pdfRequestFiles/${data.objectId}`;
- } //checking if document is draft signers type and signers placeholder does not placed yet
- else if (!signUrl && signerExist) {
- // window.location.hash = `/placeHolderSign/${data.objectId}`;
- navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
- }
- //checking if document is request type and signers placeholder exist and does not completed yet
- //then user can check progress of document and sign also
+ } //placeholder draft document
else if (
- checkPlaceHolder &&
- checkPlaceHolder.length > 0 &&
- !data.IsCompleted
+ (signerExist?.length > 0 &&
+ (!isPlaceholder || isPlaceholder?.length === 0)) ||
+ ((!signerExist || signerExist?.length === 0) && isPlaceholder?.length > 0)
) {
- navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
- // window.location.hash = `/pdfRequestFiles/${data.objectId}`;
+ navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
}
- //checking document is draft and signyourself type then user can sign document
- else {
- navigate(`${hostUrl}signaturePdf/${data.objectId}`);
- // navigate(`/signaturePdf/${data.objectId}`);
- // window.location.hash = `/signaturePdf/${data.objectId}`;
+ };
+
+ const handleMenuItemClick = (selectType, data) => {
+ switch (selectType) {
+ case "Download":
+ const pdfName = data && data.Name;
+ const pdfUrl = data && data.SignedUrl ? data.SignedUrl : data.URL;
+ saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);
+ break;
+ case "Rename":
+ setRenameValue(data.Name);
+ setRename(data.objectId);
+ break;
+ case "Delete":
+ setIsDeleteDoc(true);
+ setSelectDoc(data);
+ break;
+
+ case "Move":
+ handleMoveDocument(data);
+ break;
}
};
+ //function for delete document
+ const handleDeleteDocument = async (docData) => {
+ setIsDeleteDoc(false);
+ const docId = docData.objectId;
+ const data = {
+ IsArchive: true
+ };
+
+ await axios
+ .put(
+ `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(
+ "_appName"
+ )}_Document/${docId}`,
+ data,
+ {
+ headers: {
+ "Content-Type": "application/json",
+ "X-Parse-Application-Id": localStorage.getItem("parseAppId"),
+ "X-Parse-Session-Token": localStorage.getItem("accesstoken")
+ }
+ }
+ )
+ .then((result) => {
+ const res = result.data;
+ const updatedData = pdfData.filter((x) => x.objectId !== docId);
+ setPdfData(updatedData);
+ })
+ .catch((err) => {
+ console.log("err", err);
+ });
+ };
+ const handleMoveDocument = async (docData) => {
+ setIsOpenMoveModal(true);
+ setSelectDoc(docData);
+ };
+ //function for move document from one folder to another folder
+ const handleMoveFolder = async (selectFolderData) => {
+ const selecFolderId = selectDoc?.Folder?.objectId;
+ const moveFolderId = selectFolderData?.ObjectId;
+ let updateDocId = selectDoc?.objectId;
+ let updateData;
+ const checkExist = moveFolderId
+ ? selecFolderId === moveFolderId
+ ? true
+ : false
+ : selecFolderId
+ ? false
+ : true;
+ if (!checkExist) {
+ if (moveFolderId) {
+ updateData = {
+ Folder: {
+ __type: "Pointer",
+ className: `${localStorage.getItem("_appName")}_Document`,
+ objectId: moveFolderId
+ }
+ };
+ } else {
+ updateData = {
+ Folder: { __op: "Delete" }
+ };
+ }
+
+ await axios
+ .put(
+ `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(
+ "_appName"
+ )}_Document/${updateDocId}`,
+ updateData,
+ {
+ headers: {
+ "Content-Type": "application/json",
+ "X-Parse-Application-Id": localStorage.getItem("parseAppId"),
+ "X-Parse-Session-Token": localStorage.getItem("accesstoken")
+ }
+ }
+ )
+
+ .then((Listdata) => {
+ // console.log("Listdata ", Listdata);
+ const json = Listdata.data;
+
+ const updatedData = pdfData.filter((x) => x.objectId !== updateDocId);
+ setPdfData(updatedData);
+ })
+ .catch((err) => {
+ console.log("err", err);
+ });
+
+ setIsOpenMoveModal(false);
+ } else {
+ alert("folder already exist!");
+ setIsOpenMoveModal(false);
+ }
+ };
+
+ const sanitizeFileName = (pdfName) => {
+ // Replace spaces with underscore
+ return pdfName.replace(/ /g, "_");
+ };
+
+ const handleEnterPress = (e, data) => {
+ if (e.key === "Enter") {
+ handledRenameDoc(data);
+ }
+ };
+
+ const handleDraftDoc = (data) => {
+ window.location.hash = `/mf/remoteUrl=aHR0cHM6Ly9xaWstYWktb3JnLmdpdGh1Yi5pby9MZWdhR2VuaWUtTWljcm9hcHBWMi9yZW1vdGVFbnRyeS5qcw==&moduleToLoad=AppRoutes&remoteName=legageniemicroapp/legagenie?${data.objectId}`;
+ };
//component to handle type of document and render according to type
const handleFolderData = (data, ind, listType) => {
- // console.log("data", data);
let createddate,
status,
isDecline,
signerExist,
- isExpire,
isComplete,
signUrl,
isPlaceholder;
@@ -182,64 +294,48 @@ function PdfFileComponent({
signUrl = data.SignedUrl && data.SignedUrl;
const expireUpdateDate = new Date(expireDate).getTime();
const currDate = new Date().getTime();
-
+ let isExpire = false;
if (currDate > expireUpdateDate) {
isExpire = true;
- } else {
- isExpire = false;
}
+
if (isComplete) {
status = "Completed";
} else if (isDecline) {
status = "Declined";
- } else if (isExpire && !isPlaceholder && signerExist) {
- // status = "Expired";
+ } else if (!signerExist || signerExist?.length === 0) {
status = "Draft";
- } else if (isExpire && !isPlaceholder && !signerExist && !signUrl) {
- // status = "Expired";
+ } else if (
+ signerExist?.length > 0 &&
+ (!isPlaceholder || isPlaceholder?.length === 0)
+ ) {
status = "Draft";
} else if (isExpire) {
status = "Expired";
- } else if (!signUrl) {
- status = "Draft";
} else {
- status = "InComplete";
+ status = "In Progress";
}
}
- const handleDraftDoc = (data) => {
- window.location.hash = `/mf/remoteUrl=aHR0cHM6Ly9xaWstYWktb3JnLmdpdGh1Yi5pby9MZWdhR2VuaWUtTWljcm9hcHBWMi9yZW1vdGVFbnRyeS5qcw==&moduleToLoad=AppRoutes&remoteName=legageniemicroapp/legagenie?${data.objectId}`;
- };
+ const signersName = () => {
+ const getSignersName = signerExist.map((data) => data.Name);
+ const signerName = getSignersName.join(",");
- const handleMenuItemClick = (selectType, data) => {
- // console.log("data",data)
- if (selectType === "Download") {
- // console.log("download")
- const pdfName = data && data.Name;
- const pdfUrl = data && data.SignedUrl ? data.SignedUrl : data.URL;
- saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);
- } else if (selectType === "Rename") {
- // console.log("rename")
- setRenameValue(data.Name);
- setRename(data.objectId);
- }
+ return (
+
+ {signerName}{" "}
+
+ );
};
-
- const sanitizeFileName = (pdfName) => {
- // Replace spaces with underscore
- return pdfName.replace(/ /g, "_");
- };
-
- const handleEnterPress = (e, data) => {
- if (e.key === "Enter") {
- handledRenameDoc(data);
- }
- };
-
return listType === "table" ? (
data.Type === "Folder" ? (
handleOnclikFolder(data)}>
- |
+ |
) : data.Type === "AIDoc" ? (
handleDraftDoc(data)}>
- |
+ |
) : (
checkPdfStatus(data)}>
- |
+ |
console.log("focus")}
onBlur={() => handledRenameDoc(data)}
onKeyDown={(e) => handleEnterPress(e, data)}
ref={inputRef}
@@ -355,19 +454,12 @@ function PdfFileComponent({
sideOffset={5}
align="end"
>
- {/* handleMenuItemClick("Download", data)}
- onSelect={(e) => console.log("event", e)}
- className="ContextMenuItem"
- >
- Download
- */}
-
handleMenuItemClick("Rename", data)}
className="ContextMenuItem"
>
- Rename
+
+ Rename
@@ -402,7 +494,6 @@ function PdfFileComponent({
}}
autoFocus={true}
type="text"
- // onFocus={()=>console.log("focus")}
onBlur={() => handledRenameDoc(data)}
onKeyDown={(e) => handleEnterPress(e, data)}
ref={inputRef}
@@ -428,26 +519,19 @@ function PdfFileComponent({
sideOffset={5}
align="end"
>
- {/* handleMenuItemClick("Download", data)}
- onSelect={(e) => console.log("event", e)}
- className="ContextMenuItem"
- >
- Download
- */}
-
handleMenuItemClick("Rename", data)}
className="ContextMenuItem"
>
- Rename
+
+ Rename
) : (
-
+
@@ -504,7 +588,7 @@ function PdfFileComponent({
) : (
- status === "InComplete" && (
+ status === "In Progress" && (
@@ -518,20 +602,18 @@ function PdfFileComponent({
sideOffset={5}
align="end"
>
- handleMenuItemClick("Download", data)}
- onSelect={(e) => console.log("event", e)}
- className="ContextMenuItem"
- >
- Download
-
-
- handleMenuItemClick("Rename", data)}
- className="ContextMenuItem"
- >
- Rename
-
+ {contextMenu.map((menu, ind) => {
+ return (
+ handleMenuItemClick(menu.type, data)}
+ className="ContextMenuItem"
+ >
+
+ {menu.type}
+
+ );
+ })}
@@ -554,56 +636,113 @@ function PdfFileComponent({
{signerExist && (
<>
Signers:
- {signerExist.map((data, key) => {
- return (
-
- {data.Name},
-
- );
- })}
+ {/* kjefjjnejkfnkbjs bbfjkdsbjbfjkbjk kscbjkbjkb */}
+ {signersName()}
>
)}
+
);
};
- //component to handle type of document and render according to type
- return isList ? (
-
-
-
-
- | Name |
- Created Date |
- Type |
- Status |
- Action |
-
-
-
+ //component to handle type of document and render according to type
+ return (
+ <>
+ {isList ? (
+
+
+
+
+ | Name |
+ Created Date |
+ Type |
+ Status |
+ Action |
+
+
+
+ {pdfData.map((data, ind) => {
+ return (
+
+ {handleFolderData(data, ind, "table")}
+
+ );
+ })}
+
+
+
+ ) : (
+
{pdfData.map((data, ind) => {
return (
-
- {handleFolderData(data, ind, "table")}
-
+
+ {handleFolderData(data, ind, "list")}
+
);
})}
-
-
-
- ) : (
-
- {pdfData.map((data, ind) => {
- return (
-
- {handleFolderData(data, ind, "list")}
-
- );
- })}
-
+
+ )}
+ {isOpenMoveModal && (
+
+ )}
+ {
+ setIsDeleteDoc(false);
+ }}
+ >
+
+ Are you sure you want to delete this document?
+
+
+
+
+
+
+
+ >
);
}
diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.css b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.css
index 41b16ed3b..2997553ce 100644
--- a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.css
+++ b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.css
@@ -6,12 +6,13 @@
.ContextMenuContent,
.ContextMenuSubContent {
- min-width: 150px;
+ min-width: 135px;
background-color: white;
border-radius: 6px;
overflow: hidden;
padding: 5px;
box-shadow: 0px 10px 38px -10px rgba(22, 23, 24, 0.35), 0px 10px 20px -15px rgba(22, 23, 24, 0.2);
+ z-index: 99;
}
.ContextMenuItem,
@@ -27,7 +28,7 @@
height: 25px;
padding: 0 5px;
position: relative;
- padding-left: 25px;
+ padding-left: 15px;
user-select: none;
outline: none;
}
@@ -395,6 +396,7 @@ a {
will-change: transform, opacity;
text-align: center;
align-items: center;
+
}
.HoverCardContent[data-side='top'] {
@@ -496,12 +498,34 @@ a {
/* for Chrome, Safari, and Opera */
}
+.docDeleteBtn {
+ /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.18); */
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
+ padding: 7px 17px;
+ color: white;
+ font-weight: 600 !important;
+ font-size: 12px !important;
+ border: none;
+ border-radius: 2px;
+}
+
+.docDeleteBtn:focus {
+ border: none;
+ outline: none;
+}
+
+.docDeleteBtn:hover {
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.18);
+ color: white;
+}
+
@media screen and (max-width:766px) {
.itemColor {
font-size: 10px !important;
}
}
+
@media (min-width: 310px) and (max-width:550px) {
.pdfContainer {
diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js
index 417e156c0..fef248eb6 100644
--- a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js
+++ b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js
@@ -9,6 +9,9 @@ import { themeColor, iconColor } from "../../utils/ThemeColor/backColor";
import { getDrive } from "../../utils/Utils";
import AlertComponent from "../component/alertComponent";
import { useNavigate } from "react-router-dom";
+import Title from "../component/Title";
+import Parse from "parse";
+import ModalUi from "../../premitives/ModalUi";
function PdfFile() {
const navigate = useNavigate();
@@ -27,7 +30,7 @@ function PdfFile() {
message: "This might take some time"
});
const [docId, setDocId] = useState();
- const [handleError, setHandleError] = useState();
+ const [handleError, setHandleError] = useState("");
const [folderName, setFolderName] = useState([]);
const [isAlert, setIsAlert] = useState({ isShow: false, alertMessage: "" });
const [isNewFol, setIsNewFol] = useState(false);
@@ -54,15 +57,18 @@ function PdfFile() {
isLoad: true,
message: "This might take some time"
};
+
setIsLoading(load);
+
const driveDetails = await getDrive();
if (driveDetails) {
if (driveDetails.length > 0) {
setPdfData(driveDetails);
+ sortApps(null, null, driveDetails);
}
const data = [
{
- name: "OpenSignDrive™",
+ name: "OpenSign™ Drive",
objectId: ""
}
];
@@ -90,6 +96,7 @@ function PdfFile() {
if (driveDetails) {
if (driveDetails.length > 0) {
setPdfData(driveDetails);
+ sortApps(null, null, driveDetails);
} else {
setPdfData([]);
}
@@ -111,43 +118,16 @@ function PdfFile() {
setIsFolder(true);
};
//function for handle folder name path
- const handleRoute = (data) => {
- let loadObj = {
- isLoad: true,
- message: "This might take some time"
- };
- if (data.name === "LegaDrive™") {
- setIsLoading(loadObj);
- if (docId) {
- setDocId();
- } else {
- setTimeout(() => {
- const loadObj = {
- isLoad: false
- };
- setIsLoading(loadObj);
- }, 1000);
+ const handleRoute = (index) => {
+ const updateFolderName = folderName.filter((x, i) => {
+ if (i <= index) {
+ return x;
}
- } else if (data.name === folderName[folderName.length - 1].name) {
- setIsLoading(loadObj);
- setTimeout(() => {
- const loadObj = {
- isLoad: false
- };
- setIsLoading(loadObj);
- }, 1000);
- } else {
- const findIndex = folderName.findIndex(
- (fold) => fold.objectId === data.objectId
- );
- const newFolder = folderName.slice(0, findIndex + 1);
+ });
- setFolderName(newFolder);
- const getLastId = newFolder[newFolder.length - 1];
-
- setDocId(getLastId.objectId);
- setIsLoading(loadObj);
- }
+ setFolderName(updateFolderName);
+ const getLastId = updateFolderName[updateFolderName.length - 1];
+ setDocId(getLastId.objectId);
};
//function for add new folder name
@@ -156,78 +136,60 @@ function PdfFile() {
const value = e.target.value;
setNewFolderName(value);
};
- //function for add folder
+ //function for create folder
const handleAddFolder = async () => {
if (newFolderName) {
setIsFolderLoader(true);
-
const getParentObjId = folderName[folderName.length - 1];
const parentId = getParentObjId && getParentObjId.objectId;
- let data;
- if (parentId) {
- data = {
- Name: newFolderName,
- Type: "Folder",
- Folder: {
- __type: "Pointer",
- className: `${localStorage.getItem("_appName")}_Document`,
- objectId: parentId
- },
- CreatedBy: {
- __type: "Pointer",
- className: "_User",
- objectId: jsonCurrentUser.objectId
- }
- };
- } else {
- data = {
- Name: newFolderName,
- Type: "Folder",
- CreatedBy: {
- __type: "Pointer",
- className: "_User",
- objectId: jsonCurrentUser.objectId
- }
- };
- }
+ const foldercls = `${localStorage.getItem("_appName")}_Document`;
+ const folderPtr = {
+ __type: "Pointer",
+ className: foldercls,
+ objectId: parentId
+ };
+ const CreatedBy = {
+ __type: "Pointer",
+ className: "_User",
+ objectId: jsonCurrentUser.objectId
+ };
- await axios
- .post(
- `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(
- "_appName"
- )}_Document`,
- data,
- {
- headers: {
- "Content-Type": "application/json",
- "X-Parse-Application-Id": localStorage.getItem("parseAppId"),
- "X-Parse-Session-Token": localStorage.getItem("accesstoken")
- }
- }
- )
+ try {
+ const exsitQuery = new Parse.Query(foldercls);
+ exsitQuery.equalTo("Name", newFolderName);
+ exsitQuery.equalTo("Type", "Folder");
+ if (parentId) {
+ exsitQuery.equalTo("Folder", folderPtr);
+ }
+ const templExist = await exsitQuery.first();
+ if (templExist) {
+ setError("Folder already exist!");
+ setIsFolderLoader(false);
+ } else {
+ const template = new Parse.Object(foldercls);
+ template.set("Name", newFolderName);
+ template.set("Type", "Folder");
- .then((Listdata) => {
- // console.log("Listdata ", Listdata);
- const json = Listdata.data;
- // console.log("json ", json);
- if (json) {
+ if (parentId) {
+ template.set("Folder", folderPtr);
+ }
+ template.set("CreatedBy", CreatedBy);
+ const res = await template.save();
+ if (res) {
+ const result = JSON.parse(JSON.stringify(res));
+
+ setPdfData((prev) => [...prev, result]);
setNewFolderName();
-
setIsFolderLoader(false);
setIsFolder(false);
- if (docId) {
- getPdfFolderDocumentList();
- } else {
- getPdfDocumentList();
- }
}
- })
- .catch((err) => {
- setIsAlert({
- isShow: true,
- alertMessage: "something went wrong"
- });
+ }
+ } catch (e) {
+ setIsAlert({
+ isShow: true,
+ alertMessage: "something went wrong"
});
+ }
} else {
setError("Please fill out this field");
}
@@ -249,11 +211,11 @@ function PdfFile() {
}
};
- const sortApps = () => {
- const selectedSortType = selectedSort;
- const sortOrder = sortingOrder;
+ const sortApps = (type, order, driveDetails) => {
+ const selectedSortType = type ? type : selectedSort ? selectedSort : "Date";
+ const sortOrder = order ? order : sortingOrder ? sortingOrder : "Decending";
- let sortingData = pdfData;
+ let sortingData = driveDetails;
if (selectedSortType === "Name") {
sortingApp(sortingData, "Name", sortOrder);
} else if (selectedSortType === "Date") {
@@ -315,9 +277,9 @@ function PdfFile() {
useEffect(() => {
const closeMenuOnOutsideClick = (e) => {
if (isShowSort && !e.target.closest("#menu-container")) {
- setIsShowSort(false);
+ setIsShowSort(!isShowSort);
} else if (isNewFol && !e.target.closest("#folder-menu")) {
- setIsNewFol(false);
+ setIsNewFol(!isNewFol);
}
};
@@ -327,33 +289,56 @@ function PdfFile() {
// Cleanup the event listener when the component unmounts
document.removeEventListener("click", closeMenuOnOutsideClick);
};
- }, [isShowSort]);
+ }, [isShowSort || isNewFol]);
+ const handleFolderTab = (folderData, isMove) => {
+ return folderData.map((data, id) => {
+ return (
+
+ handleRoute(id)}
+ style={{
+ color: "#a64b4e",
+ fontWeight: "400",
+ cursor: "pointer"
+ }}
+ >
+ {data.name}
+
+ >
+
+
+
+ );
+ });
+ };
+ const oncloseFolder = () => {
+ setIsFolder(false);
+ setNewFolderName("");
+ setError("");
+ };
return (
+
-
-
- Add New Folder
- {!folderLoader && (
- {
- setNewFolderName("");
- setIsFolder(false);
- }}
- >
- X
-
- )}
-
-
-
+
+
{folderLoader ? (
) : (
-
)}
-
-
+
+
{isLoading.isLoad ? (
- {folderName.map((data, id) => {
- return (
- handleRoute(data)}
- style={{
- color: "#a64b4e",
- fontWeight: "400",
- cursor: "pointer"
- }}
- >
- {data.name}
-
- >
-
-
- );
- })}
+ {handleFolderTab(folderName)}
{
setSelectedSort("Name");
- sortApps();
+ sortApps("Name", null, pdfData);
}}
className="dropdown-item itemColor"
>
@@ -625,7 +591,7 @@ function PdfFile() {
{
setSelectedSort("Date");
- sortApps();
+ sortApps("Date", null, pdfData);
}}
className="dropdown-item itemColor"
>
@@ -648,7 +614,7 @@ function PdfFile() {
{
setSortingOrder("Accending");
- sortApps();
+ sortApps(null, "Accending", pdfData);
}}
className="dropdown-item itemColor"
>
@@ -670,7 +636,7 @@ function PdfFile() {
{
setSortingOrder("Decending");
- sortApps();
+ sortApps(null, "Decending", pdfData);
}}
className="dropdown-item itemColor"
>
diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
index 0e0a1f129..471d2bf1f 100644
--- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
+++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
@@ -736,7 +736,7 @@ function PdfRequestFiles() {
diff --git a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js
index 87a4cd27e..f84663c3c 100644
--- a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js
+++ b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js
@@ -660,7 +660,10 @@ const TemplatePlaceholder = () => {
const data = {
Placeholders: signerPos,
SignedUrl: pdfDetails[0].URL,
- Signers: signers
+ Signers: signers,
+ Name: pdfDetails[0]?.Name || "",
+ Note: pdfDetails[0]?.Note || "",
+ Description: pdfDetails[0]?.Description || ""
};
await axios
diff --git a/microfrontends/SignDocuments/src/Component/component/CustomModal.js b/microfrontends/SignDocuments/src/Component/component/CustomModal.js
index eee88a834..5b91cf932 100644
--- a/microfrontends/SignDocuments/src/Component/component/CustomModal.js
+++ b/microfrontends/SignDocuments/src/Component/component/CustomModal.js
@@ -25,39 +25,41 @@ function CustomModal({
{headMsg && headMsg}
{bodyMssg && bodyMssg}
-
{footerMessage && (
-
-
+
+ declineDoc()}
+ >
+ Yes
+
+ setIsDecline({ isDeclined: false })}
+ >
+ Close
+
+
+ >
)}
diff --git a/microfrontends/SignDocuments/src/Component/component/Title.js b/microfrontends/SignDocuments/src/Component/component/Title.js
index 892edee3a..6781b61b4 100644
--- a/microfrontends/SignDocuments/src/Component/component/Title.js
+++ b/microfrontends/SignDocuments/src/Component/component/Title.js
@@ -1,10 +1,10 @@
import React from "react";
import { Helmet } from "react-helmet";
-function Title({ title }) {
+function Title({ title, drive }) {
return (
- {`${title} - OpenSign™`}
+ {drive ? title : `${title} - OpenSign™`}
{
const loadObj = {
isLoad: true,
@@ -720,15 +721,33 @@ function PlaceHolderSign() {
objectId: x.objectId
};
});
+ const addExtraDays = pdfDetails[0]?.TimeToCompleteDays
+ ? pdfDetails[0].TimeToCompleteDays
+ : 15;
const currentUser = signersdata.find((x) => x.Email === currentId);
setCurrentId(currentUser?.objectId);
+ let updateExpiryDate, data;
+ updateExpiryDate = new Date();
+ updateExpiryDate.setDate(updateExpiryDate.getDate() + addExtraDays);
try {
- const data = {
- Placeholders: signerPos,
- SignedUrl: pdfDetails[0].URL,
- Signers: signers
- };
+ if (updateExpiryDate) {
+ data = {
+ Placeholders: signerPos,
+ SignedUrl: pdfDetails[0].URL,
+ Signers: signers,
+ ExpiryDate: {
+ iso: updateExpiryDate,
+ __type: "Date"
+ }
+ };
+ } else {
+ data = {
+ Placeholders: signerPos,
+ SignedUrl: pdfDetails[0].URL,
+ Signers: signers
+ };
+ }
await axios
.put(
diff --git a/microfrontends/SignDocuments/src/Routes.js b/microfrontends/SignDocuments/src/Routes.js
index e9f7adf92..0307ce8d4 100644
--- a/microfrontends/SignDocuments/src/Routes.js
+++ b/microfrontends/SignDocuments/src/Routes.js
@@ -10,7 +10,9 @@ import PdfRequestFiles from "./Component/PdfRequestFiles";
import LegaDrive from "./Component/LegaDrive/LegaDrive";
import PageNotFound from "./Component/PageNotFound";
import TemplatePlaceHolder from "./Component/TemplatePlaceholder";
-
+import Parse from "parse";
+Parse.serverURL = localStorage.getItem("baseUrl");
+Parse.initialize(localStorage.getItem("parseAppId"));
// `AppRoutes` is used to define route path of app and
// it expose to host app, check moduleFederation.config.js for more
function AppRoutes() {
diff --git a/microfrontends/SignDocuments/src/css/selectFolder.css b/microfrontends/SignDocuments/src/css/selectFolder.css
new file mode 100644
index 000000000..16c1f87f1
--- /dev/null
+++ b/microfrontends/SignDocuments/src/css/selectFolder.css
@@ -0,0 +1,6 @@
+.hrStyle{
+ border-top-width: 1px !important;
+ color: #c3bcbc !important;
+ height: 0px !important;
+ margin-bottom: 10px !important;
+}
\ No newline at end of file
diff --git a/microfrontends/SignDocuments/src/premitives/CreateFolder.js b/microfrontends/SignDocuments/src/premitives/CreateFolder.js
index b9967570e..1fc15334f 100644
--- a/microfrontends/SignDocuments/src/premitives/CreateFolder.js
+++ b/microfrontends/SignDocuments/src/premitives/CreateFolder.js
@@ -1,6 +1,7 @@
import React, { useEffect, useState } from "react";
import Parse from "parse";
import Alert from "./Alert";
+import { themeColor } from "../utils/ThemeColor/backColor";
const CreateFolder = ({ parentFolderId, onSuccess, folderCls }) => {
const folderPtr = {
@@ -20,7 +21,7 @@ const CreateFolder = ({ parentFolderId, onSuccess, folderCls }) => {
const fetchFolder = async () => {
try {
- const FolderQuery = new Parse.Query(folderCls);
+ const FolderQuery = new Parse.Query(folderCls);
if (parentFolderId) {
FolderQuery.equalTo("Folder", folderPtr);
FolderQuery.equalTo("Type", "Folder");
@@ -74,6 +75,7 @@ const CreateFolder = ({ parentFolderId, onSuccess, folderCls }) => {
template.set("CreatedBy", Parse.User.createWithoutData(currentUser.id));
const res = await template.save();
if (res) {
+ const result = JSON.parse(JSON.stringify(res));
if (onSuccess) {
setAlert({
type: "success",
@@ -83,7 +85,7 @@ const CreateFolder = ({ parentFolderId, onSuccess, folderCls }) => {
setTimeout(() => {
setIsAlert(false);
}, 1000);
- onSuccess(res);
+ onSuccess(result);
}
}
}
@@ -98,28 +100,43 @@ const CreateFolder = ({ parentFolderId, onSuccess, folderCls }) => {
const handleOptions = (e) => {
setSelectedParent(e.target.value);
};
+
return (
{isAlert && {alert.message}}
- Create Folder
-
+ Create Folder
+
setName(e.target.value)}
required
/>
-
+
| | |