Skip to content

Commit 3592d57

Browse files
authored
Merge pull request #123 from OpenSignLabs/staging
v1.0.1 - Bug fixes and UI improvements
2 parents 9a70778 + 6fc7a41 commit 3592d57

File tree

6 files changed

+167
-94
lines changed

6 files changed

+167
-94
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
The free open source alternative to DocuSign | PandaDoc | SignNow | Adobe Sign | Smartwaiver | SignRequest | HelloSign | Zoho sign.
66

77
[![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")
8-
98
[![All Contributors](https://img.shields.io/github/all-contributors/opensignlabs/opensign?color=ee8449&style=flat-square)](#contributors)
9+
![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/w/opensignlabs/opensign)
10+
![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/opensignlabs/opensign)
11+
1012

1113
<a href="https://www.opensignlabs.com/">Website</a>
1214
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
@@ -23,12 +25,6 @@ The free open source alternative to DocuSign | PandaDoc | SignNow | Adobe Sign |
2325

2426
## An Open-Source Alternative to DocuSign, PandaDoc, SignNow, Adobe Sign, Smartwaiver, SignRequest, and HelloSign
2527

26-
Support us -
27-
28-
<a href="https://www.producthunt.com/posts/opensign-transforming-how-we-sign-docs?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-opensign&#0045;transforming&#0045;how&#0045;we&#0045;sign&#0045;docs" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=418556&theme=light" alt="OpenSign™&#0058;&#0032;Transforming&#0032;How&#0032;We&#0032;Sign&#0032;Docs - Enterprise&#0045;Level&#0032;Document&#0032;Signing&#0032;Goes&#0032;Open&#0045;Source | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
29-
30-
[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/opensignlabs.svg?style=social&label=Follow%20%40opensignlabs)](https://twitter.com/opensignlabs)
31-
3228
---
3329
</div>
3430

@@ -88,7 +84,7 @@ We welcome contributions from the open-source community. For more information on
8884

8985
### License
9086

91-
OpenSign is licensed under the AGPL License. For more details, see the [LICENSE](LICENSE.md) file.
87+
OpenSign is licensed under the AGPL License. For more details, see the [LICENSE](LICENSE) file.
9288

9389
---
9490

apps/OpenSign/src/components/dashboard/DashboardCard.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,35 @@ const DashboardCard = (props) => {
156156
if (props.Data.key !== "count") {
157157
setresponse(res.data.results[0][props.Data.key]);
158158
} else {
159-
setresponse(res.data[props.Data.key]);
159+
if (props.Label === "Need your Signature") {
160+
const listData = res.data?.results.filter(
161+
(x) => x.Signers.length > 0
162+
);
163+
let arr = [];
164+
for (const obj of listData) {
165+
const isSigner = obj.Signers.some(
166+
(item) => item.UserId.objectId === currentUser.id
167+
);
168+
if (isSigner) {
169+
let isRecord;
170+
if (obj?.AuditTrail && obj?.AuditTrail.length > 0) {
171+
isRecord = obj?.AuditTrail.some(
172+
(item) =>
173+
item?.UserPtr?.UserId?.objectId === currentUser.id &&
174+
item.Activity === "Signed"
175+
);
176+
} else {
177+
isRecord = false;
178+
}
179+
if (isRecord === false) {
180+
arr.push(obj);
181+
}
182+
}
183+
}
184+
setresponse(arr.length);
185+
} else {
186+
setresponse(res.data[props.Data.key]);
187+
}
160188
}
161189
} else {
162190
setresponse(0);

apps/OpenSign/src/components/dashboard/DashboardReport.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,39 @@ function DashboardReport(props) {
3434
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
3535
};
3636
try {
37-
const url = `${serverURL}?where=${strParams}&keys=${strKeys}&order=${orderBy}`;
37+
const url = `${serverURL}?where=${strParams}&keys=${strKeys}&order=${orderBy}&include=AuditTrail.UserPtr`;
3838
const res = await axios.get(url, { headers: headers });
3939
// console.log("res ", res.data?.results);
40-
setList(res.data?.results);
40+
if (id === "5Go51Q7T8r") {
41+
const currentUser = Parse.User.current().id;
42+
const listData = res.data?.results.filter(
43+
(x) => x.Signers.length > 0
44+
);
45+
let arr = [];
46+
for (const obj of listData) {
47+
const isSigner = obj.Signers.some(
48+
(item) => item.UserId.objectId === currentUser
49+
);
50+
if (isSigner) {
51+
let isRecord;
52+
if (obj?.AuditTrail && obj?.AuditTrail.length > 0) {
53+
isRecord = obj?.AuditTrail.some(
54+
(item) =>
55+
item?.UserPtr?.UserId?.objectId === currentUser &&
56+
item.Activity === "Signed"
57+
);
58+
} else {
59+
isRecord = false;
60+
}
61+
if (isRecord === false) {
62+
arr.push(obj);
63+
}
64+
}
65+
}
66+
setList(arr);
67+
} else {
68+
setList(res.data?.results);
69+
}
4170
setIsLoader(false);
4271
} catch (err) {
4372
console.log("err ", err);

apps/OpenSign/src/components/fields/FileUpload.js

Lines changed: 52 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React, { useState, useEffect } from "react";
22
import { SaveFileSize } from "../../constant/saveFileSize";
3-
import Parse from "parse";
4-
import sanitizeFileName from "../../primitives/sanitizeFileName";
3+
// import Parse from "parse";
4+
// import sanitizeFileName from "../../primitives/sanitizeFileName";
5+
import axios from "axios";
56

67
const FileUpload = (props) => {
78
const [parseBaseUrl] = useState(localStorage.getItem("baseUrl"));
@@ -11,7 +12,7 @@ const FileUpload = (props) => {
1112

1213
const [localValue, setLocalValue] = useState("");
1314
const [Message] = useState(false);
14-
const [percentage] = useState(0);
15+
const [percentage, setpercentage] = useState(0);
1516

1617
const REQUIRED_FIELD_SYMBOL = "*";
1718

@@ -68,33 +69,50 @@ const FileUpload = (props) => {
6869
};
6970

7071
const handleFileUpload = async (file) => {
71-
Parse.serverURL = parseBaseUrl;
72-
Parse.initialize(parseAppId);
73-
const size = file.size;
74-
const fileName = file.name;
75-
const name = sanitizeFileName(fileName);
7672
setfileload(true);
77-
const pdfFile = file;
78-
const parseFile = new Parse.File(name, pdfFile);
73+
const file_url = parseBaseUrl.slice(0, -4);
74+
const url = `${file_url}file_upload`;
75+
const formData = new FormData();
76+
formData.append("file", file);
77+
const config = {
78+
headers: {
79+
"content-type": "multipart/form-data",
80+
"X-Parse-Application-Id": parseAppId
81+
},
82+
onUploadProgress: function (progressEvent) {
83+
var percentCompleted = Math.round(
84+
(progressEvent.loaded * 100) / progressEvent.total
85+
);
86+
setpercentage(percentCompleted);
87+
}
88+
};
7989

8090
try {
81-
const response = await parseFile.save();
82-
83-
setFileUpload(response.url());
84-
props.onChange(response.url());
85-
setfileload(false);
86-
// The response object will contain information about the uploaded file
87-
// console.log("File uploaded:", response);
88-
89-
// You can access the URL of the uploaded file using response.url()
90-
// console.log("File URL:", response.url());
91-
if (response.url()) {
92-
SaveFileSize(size, response.url());
91+
await axios
92+
.post(url, formData, config)
93+
.then((res) => {
94+
if (res.data.status === "Error") {
95+
alert(res.data.message);
96+
}
97+
setFileUpload(res.data.imageUrl);
98+
props.onChange(res.data.imageUrl);
99+
setfileload(false);
100+
setpercentage(0);
93101

94-
return response.url();
95-
}
102+
if (res.data.imageUrl) {
103+
SaveFileSize(file.size, res.data.imageUrl);
104+
return res.data.imageUrl;
105+
}
106+
})
107+
.catch((err) => {
108+
alert(`${err.message}`);
109+
setfileload(false);
110+
setpercentage(0);
111+
});
96112
} catch (error) {
97-
console.error("Error uploading file:", error);
113+
alert(error.message);
114+
setfileload(false);
115+
setpercentage(0);
98116
}
99117
};
100118

@@ -106,7 +124,7 @@ const FileUpload = (props) => {
106124
<a
107125
href={props.formData}
108126
title={props.formData}
109-
style={{ paddingBottom: "10px", color: "blue" }}
127+
style={{ paddingBottom: "10px", color: "blue"}}
110128
>
111129
Download
112130
</a>
@@ -133,12 +151,14 @@ const FileUpload = (props) => {
133151
<span className="required">{REQUIRED_FIELD_SYMBOL}</span>
134152
)}
135153
{fileload ? (
136-
<div className="progress pull-right">
137-
<div
138-
className="progress__bar"
139-
style={{ width: `${percentage}%` }}
140-
></div>
141-
<span className="progress__value">{percentage}%</span>
154+
<div className="flex items-center gap-x-2">
155+
<div className="h-2 rounded-full w-[200px] md:w-[400px] bg-gray-200">
156+
<div
157+
className="h-2 rounded-full bg-blue-500"
158+
style={{ width: `${percentage}%` }}
159+
></div>
160+
</div>
161+
<span className="text-black text-sm">{percentage}%</span>
142162
</div>
143163
) : (
144164
Message && (

apps/OpenSign/src/json/ReportJson.js

Lines changed: 20 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Parse from "parse";
22
export default function reportJson(id) {
33
const currentUserId = Parse.User.current().id;
4-
// console.log("userId", currentUserId)
4+
// console.log("json ", json);
55

66
switch (id) {
77
// draft documents report
@@ -53,36 +53,17 @@ export default function reportJson(id) {
5353
ExpiryDate: {
5454
$gt: { __type: "Date", iso: new Date().toISOString() }
5555
},
56-
$and: [
57-
{
58-
"AuditTrail.UserPtr": {
59-
$ne: {
60-
__type: "Pointer",
61-
className: "contracts_Users",
62-
objectId: "CkpaR0F6mj"
63-
}
64-
}
65-
},
66-
{ "AuditTrail.Activity": { $ne: "Signed" } }
67-
],
68-
Placeholders: { $ne: null },
69-
Signers: {
70-
$in: [
71-
{
72-
__type: "Pointer",
73-
className: "contracts_Users",
74-
objectId: "CkpaR0F6mj"
75-
}
76-
]
77-
}
56+
Placeholders: { $ne: null }
7857
},
7958
keys: [
8059
"Name",
8160
"Note",
8261
"Folder.Name",
8362
"URL",
8463
"ExtUserPtr.Name",
85-
"Signers.Name"
64+
"Signers.Name",
65+
"Signers.UserId",
66+
"AuditTrail"
8667
],
8768
orderBy: "-updatedAt",
8869
actions: [
@@ -144,7 +125,12 @@ export default function reportJson(id) {
144125
params: {
145126
Type: null,
146127
IsCompleted: true,
147-
$or: [{ IsDeclined: null }, { IsDeclined: false }]
128+
CreatedBy: {
129+
__type: "Pointer",
130+
className: "_User",
131+
objectId: currentUserId
132+
},
133+
IsDeclined: { $ne: true }
148134
},
149135
keys: [
150136
"Name",
@@ -210,6 +196,11 @@ export default function reportJson(id) {
210196
reportName: "Declined Documents",
211197
className: "contracts_Document",
212198
params: { Type: null, IsDeclined: true },
199+
CreatedBy: {
200+
__type: "Pointer",
201+
className: "_User",
202+
objectId: currentUserId
203+
},
213204
keys: [
214205
"Name",
215206
"Note",
@@ -330,36 +321,17 @@ export default function reportJson(id) {
330321
ExpiryDate: {
331322
$gt: { __type: "Date", iso: new Date().toISOString() }
332323
},
333-
$and: [
334-
{
335-
"AuditTrail.UserPtr": {
336-
$ne: {
337-
__type: "Pointer",
338-
className: "contracts_Users",
339-
objectId: "CkpaR0F6mj"
340-
}
341-
}
342-
},
343-
{ "AuditTrail.Activity": { $ne: "Signed" } }
344-
],
345-
Placeholders: { $ne: null },
346-
Signers: {
347-
$in: [
348-
{
349-
__type: "Pointer",
350-
className: "contracts_Users",
351-
objectId: "CkpaR0F6mj"
352-
}
353-
]
354-
}
324+
Placeholders: { $ne: null }
355325
},
356326
keys: [
357327
"Name",
358328
"Note",
359329
"Folder.Name",
360330
"URL",
361331
"ExtUserPtr.Name",
362-
"Signers.Name"
332+
"Signers.Name",
333+
"Signers.UserId",
334+
"AuditTrail"
363335
],
364336
orderBy: "-updatedAt",
365337
actions: [

0 commit comments

Comments
 (0)