From 5d4cac81129f68104d07a133d9bbdb30acf2fa3c Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Wed, 1 Nov 2023 18:40:27 +0530 Subject: [PATCH 1/6] add createdby param in query of completed documents reports --- apps/OpenSign/src/json/ReportJson.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.js index abdda66ca..3beebff0e 100644 --- a/apps/OpenSign/src/json/ReportJson.js +++ b/apps/OpenSign/src/json/ReportJson.js @@ -144,6 +144,11 @@ export default function reportJson(id) { params: { Type: null, IsCompleted: true, + CreatedBy: { + __type: "Pointer", + className: "_User", + objectId: currentUserId + }, $or: [{ IsDeclined: null }, { IsDeclined: false }] }, keys: [ From 566a0b646284d0d84ff9c71e99c557a84ffdf632 Mon Sep 17 00:00:00 2001 From: Andrew <148278535+andrew-opensignlabs@users.noreply.github.com> Date: Wed, 1 Nov 2023 21:17:52 +0530 Subject: [PATCH 2/6] docs: add shields to README.md --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3a5062026..dd61a7d7b 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,10 @@ The free open source alternative to DocuSign | PandaDoc | SignNow | Adobe Sign | Smartwaiver | SignRequest | HelloSign | Zoho sign. [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/opensignlabs/opensign.svg)](http://isitmaintained.com/project/opensignlabs/opensign "Average time to resolve an issue") - [![All Contributors](https://img.shields.io/github/all-contributors/opensignlabs/opensign?color=ee8449&style=flat-square)](#contributors) +![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/w/opensignlabs/opensign) +![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/opensignlabs/opensign) + Website   â€˘   @@ -23,12 +25,6 @@ The free open source alternative to DocuSign | PandaDoc | SignNow | Adobe Sign | ## An Open-Source Alternative to DocuSign, PandaDoc, SignNow, Adobe Sign, Smartwaiver, SignRequest, and HelloSign -Support us - - -OpenSign™: Transforming How We Sign Docs - Enterprise-Level Document Signing Goes Open-Source | Product Hunt - -[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/opensignlabs.svg?style=social&label=Follow%20%40opensignlabs)](https://twitter.com/opensignlabs) - --- From 9c5a9754c148c62affabb4855018b28c8e90ad49 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Thu, 2 Nov 2023 15:32:21 +0530 Subject: [PATCH 3/6] fix: report visibility issue except need your sign and recent signature request reports --- apps/OpenSign/src/json/ReportJson.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.js index 3beebff0e..c37ad828d 100644 --- a/apps/OpenSign/src/json/ReportJson.js +++ b/apps/OpenSign/src/json/ReportJson.js @@ -1,7 +1,9 @@ import Parse from "parse"; export default function reportJson(id) { const currentUserId = Parse.User.current().id; - // console.log("userId", currentUserId) + // const extendedCls = localStorage.getItem("Extand_Class"); + // const json = JSON.parse(extendedCls)?.[0]; + // console.log("json ", json); switch (id) { // draft documents report @@ -149,7 +151,7 @@ export default function reportJson(id) { className: "_User", objectId: currentUserId }, - $or: [{ IsDeclined: null }, { IsDeclined: false }] + IsDeclined: { $ne: true } }, keys: [ "Name", @@ -215,6 +217,11 @@ export default function reportJson(id) { reportName: "Declined Documents", className: "contracts_Document", params: { Type: null, IsDeclined: true }, + CreatedBy: { + __type: "Pointer", + className: "_User", + objectId: currentUserId + }, keys: [ "Name", "Note", From bc4d2547fdd7cc1081288127b2e5e32e7a6cbcdd Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Fri, 3 Nov 2023 00:01:58 +0530 Subject: [PATCH 4/6] add progess bar for file_upload --- .../src/components/fields/FileUpload.js | 84 ++++++++++++------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/apps/OpenSign/src/components/fields/FileUpload.js b/apps/OpenSign/src/components/fields/FileUpload.js index bfb47baa4..2b0840276 100644 --- a/apps/OpenSign/src/components/fields/FileUpload.js +++ b/apps/OpenSign/src/components/fields/FileUpload.js @@ -1,7 +1,8 @@ import React, { useState, useEffect } from "react"; import { SaveFileSize } from "../../constant/saveFileSize"; -import Parse from "parse"; -import sanitizeFileName from "../../primitives/sanitizeFileName"; +// import Parse from "parse"; +// import sanitizeFileName from "../../primitives/sanitizeFileName"; +import axios from "axios"; const FileUpload = (props) => { const [parseBaseUrl] = useState(localStorage.getItem("baseUrl")); @@ -11,7 +12,7 @@ const FileUpload = (props) => { const [localValue, setLocalValue] = useState(""); const [Message] = useState(false); - const [percentage] = useState(0); + const [percentage, setpercentage] = useState(0); const REQUIRED_FIELD_SYMBOL = "*"; @@ -68,33 +69,50 @@ const FileUpload = (props) => { }; const handleFileUpload = async (file) => { - Parse.serverURL = parseBaseUrl; - Parse.initialize(parseAppId); - const size = file.size; - const fileName = file.name; - const name = sanitizeFileName(fileName); setfileload(true); - const pdfFile = file; - const parseFile = new Parse.File(name, pdfFile); + const file_url = parseBaseUrl.slice(0, -4); + const url = `${file_url}file_upload`; + const formData = new FormData(); + formData.append("file", file); + const config = { + headers: { + "content-type": "multipart/form-data", + "X-Parse-Application-Id": parseAppId + }, + onUploadProgress: function (progressEvent) { + var percentCompleted = Math.round( + (progressEvent.loaded * 100) / progressEvent.total + ); + setpercentage(percentCompleted); + } + }; try { - const response = await parseFile.save(); - - setFileUpload(response.url()); - props.onChange(response.url()); - setfileload(false); - // The response object will contain information about the uploaded file - // console.log("File uploaded:", response); - - // You can access the URL of the uploaded file using response.url() - // console.log("File URL:", response.url()); - if (response.url()) { - SaveFileSize(size, response.url()); + await axios + .post(url, formData, config) + .then((res) => { + if (res.data.status === "Error") { + alert(res.data.message); + } + setFileUpload(res.data.imageUrl); + props.onChange(res.data.imageUrl); + setfileload(false); + setpercentage(0); - return response.url(); - } + if (res.data.imageUrl) { + SaveFileSize(file.size, res.data.imageUrl); + return res.data.imageUrl; + } + }) + .catch((err) => { + alert(`${err.message}`); + setfileload(false); + setpercentage(0); + }); } catch (error) { - console.error("Error uploading file:", error); + alert(error.message); + setfileload(false); + setpercentage(0); } }; @@ -106,7 +124,7 @@ const FileUpload = (props) => { Download @@ -133,12 +151,14 @@ const FileUpload = (props) => { {REQUIRED_FIELD_SYMBOL} )} {fileload ? ( -
-
- {percentage}% +
+
+
+
+ {percentage}%
) : ( Message && ( From 789c4bd97f169e9af35b118f7cfc5573c9fab2a3 Mon Sep 17 00:00:00 2001 From: Amol Date: Fri, 3 Nov 2023 10:08:02 +0530 Subject: [PATCH 5/6] Fix license link in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd61a7d7b..1420d4cf5 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ We welcome contributions from the open-source community. For more information on ### License -OpenSign is licensed under the AGPL License. For more details, see the [LICENSE](LICENSE.md) file. +OpenSign is licensed under the AGPL License. For more details, see the [LICENSE](LICENSE) file. --- From 2fe79dc2a800c3d5a6ce8439ce584c01ed5192bf Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Fri, 3 Nov 2023 12:49:43 +0530 Subject: [PATCH 6/6] fix: report visibility issue of Need your sign and Recent signature request --- .../src/components/dashboard/DashboardCard.js | 30 +++++++++- .../components/dashboard/DashboardReport.js | 33 ++++++++++- apps/OpenSign/src/json/ReportJson.js | 56 +++---------------- apps/OpenSign/src/routes/Report.js | 34 ++++++++++- 4 files changed, 99 insertions(+), 54 deletions(-) diff --git a/apps/OpenSign/src/components/dashboard/DashboardCard.js b/apps/OpenSign/src/components/dashboard/DashboardCard.js index 0bf4fabaa..c51f7ba42 100644 --- a/apps/OpenSign/src/components/dashboard/DashboardCard.js +++ b/apps/OpenSign/src/components/dashboard/DashboardCard.js @@ -156,7 +156,35 @@ const DashboardCard = (props) => { if (props.Data.key !== "count") { setresponse(res.data.results[0][props.Data.key]); } else { - setresponse(res.data[props.Data.key]); + if (props.Label === "Need your Signature") { + const listData = res.data?.results.filter( + (x) => x.Signers.length > 0 + ); + let arr = []; + for (const obj of listData) { + const isSigner = obj.Signers.some( + (item) => item.UserId.objectId === currentUser.id + ); + if (isSigner) { + let isRecord; + if (obj?.AuditTrail && obj?.AuditTrail.length > 0) { + isRecord = obj?.AuditTrail.some( + (item) => + item?.UserPtr?.UserId?.objectId === currentUser.id && + item.Activity === "Signed" + ); + } else { + isRecord = false; + } + if (isRecord === false) { + arr.push(obj); + } + } + } + setresponse(arr.length); + } else { + setresponse(res.data[props.Data.key]); + } } } else { setresponse(0); diff --git a/apps/OpenSign/src/components/dashboard/DashboardReport.js b/apps/OpenSign/src/components/dashboard/DashboardReport.js index a23f20b15..4a0575f14 100644 --- a/apps/OpenSign/src/components/dashboard/DashboardReport.js +++ b/apps/OpenSign/src/components/dashboard/DashboardReport.js @@ -34,10 +34,39 @@ function DashboardReport(props) { "X-Parse-Session-Token": localStorage.getItem("accesstoken") }; try { - const url = `${serverURL}?where=${strParams}&keys=${strKeys}&order=${orderBy}`; + const url = `${serverURL}?where=${strParams}&keys=${strKeys}&order=${orderBy}&include=AuditTrail.UserPtr`; const res = await axios.get(url, { headers: headers }); // console.log("res ", res.data?.results); - setList(res.data?.results); + if (id === "5Go51Q7T8r") { + const currentUser = Parse.User.current().id; + const listData = res.data?.results.filter( + (x) => x.Signers.length > 0 + ); + let arr = []; + for (const obj of listData) { + const isSigner = obj.Signers.some( + (item) => item.UserId.objectId === currentUser + ); + if (isSigner) { + let isRecord; + if (obj?.AuditTrail && obj?.AuditTrail.length > 0) { + isRecord = obj?.AuditTrail.some( + (item) => + item?.UserPtr?.UserId?.objectId === currentUser && + item.Activity === "Signed" + ); + } else { + isRecord = false; + } + if (isRecord === false) { + arr.push(obj); + } + } + } + setList(arr); + } else { + setList(res.data?.results); + } setIsLoader(false); } catch (err) { console.log("err ", err); diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.js index c37ad828d..960559938 100644 --- a/apps/OpenSign/src/json/ReportJson.js +++ b/apps/OpenSign/src/json/ReportJson.js @@ -1,8 +1,6 @@ import Parse from "parse"; export default function reportJson(id) { const currentUserId = Parse.User.current().id; - // const extendedCls = localStorage.getItem("Extand_Class"); - // const json = JSON.parse(extendedCls)?.[0]; // console.log("json ", json); switch (id) { @@ -55,28 +53,7 @@ export default function reportJson(id) { ExpiryDate: { $gt: { __type: "Date", iso: new Date().toISOString() } }, - $and: [ - { - "AuditTrail.UserPtr": { - $ne: { - __type: "Pointer", - className: "contracts_Users", - objectId: "CkpaR0F6mj" - } - } - }, - { "AuditTrail.Activity": { $ne: "Signed" } } - ], - Placeholders: { $ne: null }, - Signers: { - $in: [ - { - __type: "Pointer", - className: "contracts_Users", - objectId: "CkpaR0F6mj" - } - ] - } + Placeholders: { $ne: null } }, keys: [ "Name", @@ -84,7 +61,9 @@ export default function reportJson(id) { "Folder.Name", "URL", "ExtUserPtr.Name", - "Signers.Name" + "Signers.Name", + "Signers.UserId", + "AuditTrail" ], orderBy: "-updatedAt", actions: [ @@ -342,28 +321,7 @@ export default function reportJson(id) { ExpiryDate: { $gt: { __type: "Date", iso: new Date().toISOString() } }, - $and: [ - { - "AuditTrail.UserPtr": { - $ne: { - __type: "Pointer", - className: "contracts_Users", - objectId: "CkpaR0F6mj" - } - } - }, - { "AuditTrail.Activity": { $ne: "Signed" } } - ], - Placeholders: { $ne: null }, - Signers: { - $in: [ - { - __type: "Pointer", - className: "contracts_Users", - objectId: "CkpaR0F6mj" - } - ] - } + Placeholders: { $ne: null } }, keys: [ "Name", @@ -371,7 +329,9 @@ export default function reportJson(id) { "Folder.Name", "URL", "ExtUserPtr.Name", - "Signers.Name" + "Signers.Name", + "Signers.UserId", + "AuditTrail" ], orderBy: "-updatedAt", actions: [ diff --git a/apps/OpenSign/src/routes/Report.js b/apps/OpenSign/src/routes/Report.js index d59394b17..d82dc3630 100644 --- a/apps/OpenSign/src/routes/Report.js +++ b/apps/OpenSign/src/routes/Report.js @@ -27,6 +27,7 @@ const Report = () => { const { className, params, keys, orderBy } = json; Parse.serverURL = localStorage.getItem("BaseUrl12"); Parse.initialize(localStorage.getItem("AppID12")); + const currentUser = Parse.User.current().id; const serverURL = localStorage.getItem("BaseUrl12") + "classes/" + className; @@ -38,10 +39,37 @@ const Report = () => { "X-Parse-Session-Token": localStorage.getItem("accesstoken") }; try { - const url = `${serverURL}?where=${strParams}&keys=${strKeys}&order=${orderBy}`; + const url = `${serverURL}?where=${strParams}&keys=${strKeys}&order=${orderBy}&include=AuditTrail.UserPtr`; const res = await axios.get(url, { headers: headers }); - // console.log("res ", res.data?.results); - setList(res.data?.results); + if (id === "4Hhwbp482K") { + const listData = res.data?.results.filter( + (x) => x.Signers.length > 0 + ); + let arr = []; + for (const obj of listData) { + const isSigner = obj.Signers.some( + (item) => item.UserId.objectId === currentUser + ); + if (isSigner) { + let isRecord; + if (obj?.AuditTrail && obj?.AuditTrail.length > 0) { + isRecord = obj?.AuditTrail.some( + (item) => + item?.UserPtr?.UserId?.objectId === currentUser && + item.Activity === "Signed" + ); + } else { + isRecord = false; + } + if (isRecord === false) { + arr.push(obj); + } + } + } + setList(arr); + } else { + setList(res.data?.results); + } setIsLoader(false); } catch (err) { console.log("err ", err);