Skip to content

Commit b67932f

Browse files
Merge pull request #296 from OpenSignLabs/staging
sync fork
2 parents 300ddb8 + 751c7b5 commit b67932f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+7176
-1512
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@
196196
"contributions": [
197197
"code"
198198
]
199+
},
200+
{
201+
"login": "VikramNagwal",
202+
"name": "Vikram",
203+
"avatar_url": "https://avatars.githubusercontent.com/u/123088024?v=4",
204+
"profile": "https://github.com/VikramNagwal",
205+
"contributions": [
206+
"code"
207+
]
199208
}
200209
]
201210
}

.env.local_dev

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ DO_REGION=us-west
4545
USE_LOCAL=TRUE
4646

4747
# Email mailgun or set SMTP_ENABLE true to use SMTP config (The app will not initialize if any of these 3 variables are not set) *********************************************************************************************************************
48-
MAILGUN_API_KEY=XXXXX
48+
MAILGUN_API_KEY=
4949
MAILGUN_DOMAIN=mail.yourdomain.com
5050
5151
SMTP_ENABLE=
52-
SMTP_HOST=
53-
SMTP_PORT=
54-
SMTP_USER_EMAIL=
55-
SMTP_PASS=
52+
SMTP_HOST=smtp.yourhost.com
53+
SMTP_PORT=443
54+
SMTP_USER_EMAIL=[email protected]
55+
SMTP_PASS=password
5656

5757

5858
# Base64 encoded PFX or p12 document signing certificate file *********************************************************************************************************************

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ We would like to thank all our contributors and users for their support and feed
131131
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Govinda04"><img src="https://avatars.githubusercontent.com/u/50038172?v=4?s=100" width="100px;" alt="Govinda Kocharekar"/><br /><sub><b>Govinda Kocharekar</b></sub></a><br /><a href="#code-Govinda04" title="Code">💻</a></td>
132132
<td align="center" valign="top" width="14.28%"><a href="https://bilal.cc"><img src="https://avatars.githubusercontent.com/u/55330484?v=4?s=100" width="100px;" alt="Bilal Ahmad Bhat"/><br /><sub><b>Bilal Ahmad Bhat</b></sub></a><br /><a href="#code-crediblebilal" title="Code">💻</a></td>
133133
</tr>
134+
<tr>
135+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/VikramNagwal"><img src="https://avatars.githubusercontent.com/u/123088024?v=4?s=100" width="100px;" alt="Vikram"/><br /><sub><b>Vikram</b></sub></a><br /><a href="#code-VikramNagwal" title="Code">💻</a></td>
136+
</tr>
134137
</tbody>
135138
</table>
136139

apps/OpenSign/public/version.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
v1.0.5-beta

apps/OpenSign/src/components/AppendFormInForm.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const AppendFormInForm = (props) => {
4646
// Define a function to handle form submission
4747
const handleSubmit = async (e) => {
4848
e.preventDefault();
49+
e.stopPropagation();
4950
setIsLoader(true);
5051
Parse.serverURL = parseBaseUrl;
5152
Parse.initialize(parseAppId);
@@ -105,13 +106,18 @@ const AppendFormInForm = (props) => {
105106
const res = await contactQuery.save();
106107

107108
const parseData = JSON.parse(JSON.stringify(res));
108-
props.details({
109-
value: parseData[props.valueKey],
110-
label: parseData[props.displayKey]
111-
});
109+
if (props.details) {
110+
props.details({
111+
value: parseData[props.valueKey],
112+
label: parseData[props.displayKey]
113+
});
114+
}
112115
if (props.closePopup) {
113116
props.closePopup();
114117
}
118+
if (props.handleUserData) {
119+
props.handleUserData(parseData);
120+
}
115121

116122
setIsLoader(false);
117123
// Reset the form fields
@@ -158,13 +164,18 @@ const AppendFormInForm = (props) => {
158164
const res = await contactQuery.save();
159165

160166
const parseData = JSON.parse(JSON.stringify(res));
161-
props.details({
162-
value: parseData[props.valueKey],
163-
label: parseData[props.displayKey]
164-
});
167+
if (props.details) {
168+
props.details({
169+
value: parseData[props.valueKey],
170+
label: parseData[props.displayKey]
171+
});
172+
}
165173
if (props.closePopup) {
166174
props.closePopup();
167175
}
176+
if (props.handleUserData) {
177+
props.handleUserData(parseData);
178+
}
168179
setIsLoader(false);
169180
// Reset the form fields
170181
setAddYourself(false);

apps/OpenSign/src/components/TreeWidget.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Parse from "parse";
55
import axios from "axios";
66
import "../styles/spinner.css";
77
import TreeFormComponent from "./TreeFormComponent";
8-
import TreeEditForm from "./TreeEditForm";
8+
// import TreeEditForm from "./TreeEditForm";
99
import "../styles/modal.css";
1010
import Modal from "react-modal";
1111

@@ -22,7 +22,7 @@ const TreeWidget = (props) => {
2222
const [schemaState, setSchemaState] = useState({});
2323
const [TabURL, setTabURL] = useState("");
2424
const [editable, setEditable] = useState(false);
25-
const [editId, setEditId] = useState("");
25+
// const [editId, setEditId] = useState("");
2626
const [defaultState, setDefaultState] = useState(false);
2727
const [isShowModal, setIsShowModal] = useState(false);
2828
const selectFolderHandle = async () => {
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
import React, { useEffect, useState } from "react";
2+
import Parse from "parse";
3+
import Alert from "../../primitives/Alert";
4+
5+
const CreateFolder = ({ parentFolderId, onSuccess, folderCls }) => {
6+
const folderPtr = {
7+
__type: "Pointer",
8+
className: folderCls,
9+
objectId: parentFolderId
10+
};
11+
const [name, setName] = useState("");
12+
const [folderList, setFolderList] = useState([]);
13+
const [isAlert, setIsAlert] = useState(false);
14+
const [selectedParent, setSelectedParent] = useState();
15+
const [alert, setAlert] = useState({ type: "info", message: "" });
16+
useEffect(() => {
17+
fetchFolder();
18+
// eslint-disable-next-line
19+
}, []);
20+
21+
const fetchFolder = async () => {
22+
try {
23+
const FolderQuery = new Parse.Query(folderCls);
24+
if (parentFolderId) {
25+
FolderQuery.equalTo("Folder", folderPtr);
26+
FolderQuery.equalTo("Type", "Folder");
27+
} else {
28+
FolderQuery.doesNotExist("Folder");
29+
FolderQuery.equalTo("Type", "Folder");
30+
}
31+
32+
const res = await FolderQuery.find();
33+
if (res) {
34+
const result = JSON.parse(JSON.stringify(res));
35+
if (result) {
36+
setFolderList(result);
37+
}
38+
}
39+
} catch (error) {
40+
console.log("Err ", error);
41+
}
42+
};
43+
const handleCreateFolder = async (event) => {
44+
event.preventDefault();
45+
if (name) {
46+
const currentUser = Parse.User.current();
47+
const exsitQuery = new Parse.Query(folderCls);
48+
exsitQuery.equalTo("Name", name);
49+
exsitQuery.equalTo("Type", "Folder");
50+
if (parentFolderId) {
51+
exsitQuery.equalTo("Folder", folderPtr);
52+
}
53+
const templExist = await exsitQuery.first();
54+
if (templExist) {
55+
setAlert({ type: "dange", message: "Folder already exist!" });
56+
setIsAlert(true);
57+
setTimeout(() => {
58+
setIsAlert(false);
59+
}, 1000);
60+
} else {
61+
const template = new Parse.Object(folderCls);
62+
template.set("Name", name);
63+
template.set("Type", "Folder");
64+
65+
if (selectedParent) {
66+
template.set("Folder", {
67+
__type: "Pointer",
68+
className: folderCls,
69+
objectId: selectedParent
70+
});
71+
} else if (parentFolderId) {
72+
template.set("Folder", folderPtr);
73+
}
74+
template.set("CreatedBy", Parse.User.createWithoutData(currentUser.id));
75+
const res = await template.save();
76+
if (res) {
77+
if (onSuccess) {
78+
setAlert({
79+
type: "success",
80+
message: "Folder created successfully!"
81+
});
82+
setIsAlert(true);
83+
setTimeout(() => {
84+
setIsAlert(false);
85+
}, 1000);
86+
onSuccess(res);
87+
}
88+
}
89+
}
90+
} else {
91+
setAlert({ type: "info", message: "Please fill folder name" });
92+
setIsAlert(true);
93+
setTimeout(() => {
94+
setIsAlert(false);
95+
}, 1000);
96+
}
97+
};
98+
const handleOptions = (e) => {
99+
setSelectedParent(e.target.value);
100+
};
101+
return (
102+
<div>
103+
{isAlert && <Alert type={alert.type}>{alert.message}</Alert>}
104+
<div id="createFolder">
105+
<h1 className="text-base font-semibold">Create Folder</h1>
106+
<div className="text-xs mt-2">
107+
<label className="block">
108+
Name<span className="text-red-500 text-[13px]">*</span>
109+
</label>
110+
<input
111+
className="px-3 py-2 w-full border-[1px] border-gray-300 rounded focus:outline-none text-xs"
112+
value={name}
113+
onChange={(e) => setName(e.target.value)}
114+
required
115+
/>
116+
</div>
117+
<div className="text-xs mt-2">
118+
<label className="block">Parent Folder</label>
119+
<select
120+
value={selectedParent}
121+
onChange={handleOptions}
122+
className="px-3 py-2 w-full border-[1px] border-gray-300 rounded focus:outline-none text-xs"
123+
>
124+
<option>select</option>
125+
{folderList.length > 0 &&
126+
folderList.map((x) => (
127+
<option key={x.objectId} value={x.objectId}>
128+
{x.Name}
129+
</option>
130+
))}
131+
</select>
132+
</div>
133+
<div>
134+
<button
135+
onClick={handleCreateFolder}
136+
className="flex items-center rounded p-2 bg-[#32a3ac] text-white mt-3"
137+
>
138+
<i className="fa-solid fa-plus mr-1"></i>
139+
<span>Create</span>
140+
</button>
141+
</div>
142+
</div>
143+
</div>
144+
);
145+
};
146+
147+
export default CreateFolder;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ export default function DropboxChooser({ children, onSuccess, onCancel }) {
4141
[onSuccess, onCancel]
4242
);
4343

44-
const handleChoose = useCallback(() => {
44+
const handleChoose = useCallback((e) => {
45+
e.preventDefault()
4546
if (window.Dropbox) {
4647
window.Dropbox.choose(options);
4748
}

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ const FileUpload = (props) => {
258258
<div className="flex gap-2 justify-center items-center">
259259
<div className="flex justify-between items-center px-2 py-[3px] w-full font-bold rounded border-[1px] border-[#ccc] text-gray-500 bg-white text-[13px]">
260260
<div className="break-all">
261-
file selected : {props.formData.split("/")[3]}
261+
file selected : {props.formData?.split("/")[3]?.split("_")[1]}
262262
</div>
263263
<div
264264
onClick={() => {
@@ -271,10 +271,12 @@ const FileUpload = (props) => {
271271
<i className="fa-solid fa-xmark"></i>
272272
</div>
273273
</div>
274-
<DropboxChooser
275-
onSuccess={dropboxSuccess}
276-
onCancel={dropboxCancel}
277-
/>
274+
{process.env.REACT_APP_DROPBOX_API_KEY && (
275+
<DropboxChooser
276+
onSuccess={dropboxSuccess}
277+
onCancel={dropboxCancel}
278+
/>
279+
)}
278280
</div>
279281
) : (
280282
<div className="flex gap-2 justify-center items-center">
@@ -294,10 +296,12 @@ const FileUpload = (props) => {
294296
accept="application/pdf,application/vnd.ms-excel"
295297
onChange={onChange}
296298
/>
297-
<DropboxChooser
298-
onSuccess={dropboxSuccess}
299-
onCancel={dropboxCancel}
300-
/>
299+
{process.env.REACT_APP_DROPBOX_API_KEY && (
300+
<DropboxChooser
301+
onSuccess={dropboxSuccess}
302+
onCancel={dropboxCancel}
303+
/>
304+
)}
301305
</div>
302306
)}
303307
</>

0 commit comments

Comments
 (0)