Skip to content

Commit c491595

Browse files
Fix: issues in quick send
1 parent 07933b5 commit c491595

File tree

7 files changed

+116
-23
lines changed

7 files changed

+116
-23
lines changed

apps/OpenSign/src/components/pdf/PdfHeader.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function Header({
4040
signerPos && signerPos?.filter((data) => data.Role !== "prefill");
4141
const isMobile = window.innerWidth < 767;
4242
const navigate = useNavigate();
43-
const [isCertificate, setIsCertificate] = useState(false);
43+
const [isDownloading, setIsDownloading] = useState("");
4444
const isGuestSigner = localStorage.getItem("isGuestSigner");
4545
//for go to previous page
4646
function previousPage() {
@@ -62,7 +62,7 @@ function Header({
6262
//function for print digital sign pdf
6363
const handleToPrint = async (event) => {
6464
event.preventDefault();
65-
65+
setIsDownloading("pdf");
6666
try {
6767
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
6868
const axiosRes = await axios.post(
@@ -93,17 +93,21 @@ function Header({
9393
const blob = new Blob([byteArray], { type: "application/pdf" });
9494
const blobUrl = URL.createObjectURL(blob);
9595
window.open(blobUrl, "_blank");
96+
setIsDownloading("");
9697
} else {
9798
printModule({ printable: pdf, type: "pdf", base64: true });
99+
setIsDownloading("");
98100
}
99101
} catch (err) {
102+
setIsDownloading("");
100103
console.log("err in getsignedurl", err);
101104
alert("something went wrong, please try again later.");
102105
}
103106
};
104107

105108
//handle download signed pdf
106109
const handleDownloadPdf = async () => {
110+
setIsDownloading("pdf");
107111
const pdfName = pdfDetails[0] && pdfDetails[0].Name;
108112
try {
109113
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
@@ -120,8 +124,10 @@ function Header({
120124
);
121125
const url = axiosRes.data.result;
122126
saveAs(url, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);
127+
setIsDownloading("");
123128
} catch (err) {
124129
console.log("err in getsignedurl", err);
130+
setIsDownloading("");
125131
alert("something went wrong, please try again later.");
126132
}
127133
};
@@ -142,7 +148,7 @@ function Header({
142148
console.log("err in download in certificate", err);
143149
}
144150
} else {
145-
setIsCertificate(true);
151+
setIsDownloading("certificate");
146152
try {
147153
const data = {
148154
docId: pdfDetails[0]?.objectId
@@ -164,12 +170,13 @@ function Header({
164170
await fetch(doc?.CertificateUrl);
165171
const certificateUrl = doc?.CertificateUrl;
166172
saveAs(certificateUrl, `Certificate_signed_by_OpenSign™.pdf`);
167-
setIsCertificate(false);
173+
setIsDownloading("");
168174
} else {
169-
setIsCertificate(true);
175+
setIsDownloading("certificate");
170176
}
171177
}
172178
} catch (err) {
179+
setIsDownloading("");
173180
console.log("err in download in certificate", err);
174181
alert("something went wrong, please try again later.");
175182
}
@@ -628,12 +635,25 @@ function Header({
628635
)}
629636
</div>
630637
)}
638+
{isDownloading === "pdf" && (
639+
<div className="fixed z-[200] inset-0 flex justify-center items-center bg-black bg-opacity-30">
640+
<div
641+
style={{ fontSize: "45px", color: "#3dd3e0" }}
642+
className="loader-37"
643+
></div>
644+
</div>
645+
)}
631646
<ModalUi
632-
isOpen={isCertificate}
633-
title={"Generating certificate"}
634-
handleClose={() => setIsCertificate(false)}
647+
isOpen={isDownloading === "certificate"}
648+
title={
649+
isDownloading === "certificate"
650+
? "Generating certificate"
651+
: "PDF Download"
652+
}
653+
handleClose={() => setIsDownloading("")}
635654
>
636655
<div className="p-3 md:p-5 text-[13px] md:text-base text-center">
656+
{isDownloading === "certificate"}{" "}
637657
<p>
638658
Your completion certificate is being generated. Please wait
639659
momentarily.

apps/OpenSign/src/json/ReportJson.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export default function reportJson(id) {
33
const head = ["Sr.No", "Title", "Note", "Folder", "File", "Owner", "Signers"];
44
const contactbook = ["Sr.No", "Title", "Email", "Phone"];
55
const dashboardReportHead = ["Title", "File", "Owner", "Signers"];
6-
const templateReport = ["Sr.No", "Title", "File", "Owner", "Signers"];
6+
const templateReport = ["Sr.No", "Title", "File", "Owner", "Roles"];
77
switch (id) {
88
// draft documents report
99
case "ByHuevtCFY":

apps/OpenSign/src/pages/PdfRequestFiles.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,10 @@ function PdfRequestFiles() {
783783
(x) => x.Email === jsonSender.email
784784
);
785785
const newIndex = index + 1;
786-
const user = pdfDetails?.[0].Signers[newIndex];
786+
const usermail = {
787+
Email: pdfDetails?.[0]?.Placeholders[newIndex]?.email || ""
788+
};
789+
const user = usermail || pdfDetails?.[0]?.Signers[newIndex];
787790
if (sendmail !== "false" && sendInOrder) {
788791
const requestBody = pdfDetails?.[0]?.RequestBody;
789792
const requestSubject = pdfDetails?.[0]?.RequestSubject;

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 73 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const ReportTable = (props) => {
4343
const [templateDeatils, setTemplateDetails] = useState({});
4444
const [placeholders, setPlaceholders] = useState([]);
4545
const [isLoader, setIsLoader] = useState({});
46-
46+
const [isViewShare, setIsViewShare] = useState({});
4747
const startIndex = (currentPage - 1) * props.docPerPage;
4848
const { isMoreDocs, setIsNextRecord } = props;
4949
// For loop is used to calculate page numbers visible below table
@@ -340,9 +340,9 @@ const ReportTable = (props) => {
340340

341341
await axios
342342
.put(
343-
`${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(
344-
"_appName"
345-
)}_Document/${item.objectId}`,
343+
`${localStorage.getItem("baseUrl")}classes/contracts_Document/${
344+
item.objectId
345+
}`,
346346
data,
347347
{
348348
headers: {
@@ -578,9 +578,15 @@ const ReportTable = (props) => {
578578
};
579579
try {
580580
const res = await axios.post(url, params, { headers: headers });
581-
if (res) {
581+
if (res?.data?.result?.status === "success") {
582582
setIsAlert(true);
583583
setAlertMsg({ type: "success", message: "Mail sent successfully." });
584+
} else {
585+
setIsAlert(true);
586+
setAlertMsg({
587+
type: "danger",
588+
message: "Something went wrong, please try again later!"
589+
});
584590
}
585591
} catch (err) {
586592
console.log("err in sendmail", err);
@@ -681,6 +687,9 @@ const ReportTable = (props) => {
681687
setTimeout(() => setIsAlert(false), 1500);
682688
}
683689
};
690+
const handleViewSigners = (item) => {
691+
setIsViewShare({ [item.objectId]: true });
692+
};
684693
return (
685694
<div className="relative">
686695
{Object.keys(actLoader)?.length > 0 && (
@@ -835,7 +844,17 @@ const ReportTable = (props) => {
835844
{formatRow(item?.ExtUserPtr)}
836845
</td>
837846
<td className="px-4 py-2">
838-
{item?.Signers ? formatRow(item?.Signers) : "-"}
847+
{/* {item?.Signers ? formatRow(item?.Signers) : "-"} */}
848+
{item?.Placeholders ? (
849+
<button
850+
onClick={() => handleViewSigners(item)}
851+
className="text-[blue] hover:underline focus:outline-none"
852+
>
853+
View
854+
</button>
855+
) : (
856+
"-"
857+
)}
839858
</td>
840859
<td className="px-2 py-2 text-white flex flex-row gap-x-2 gap-y-1 justify-center items-center">
841860
{props.actions?.length > 0 &&
@@ -865,19 +884,21 @@ const ReportTable = (props) => {
865884
)}
866885
{isOption[item.objectId] &&
867886
act.action === "option" && (
868-
<div className="absolute -right-2 top-5 bg-white text-nowrap rounded shadow z-[20] overflow-hidden">
887+
<div className="absolute -right-2 top-5 p-1.5 bg-white text-nowrap rounded shadow-md z-[20] overflow-hidden">
869888
{act.subaction?.map((subact) => (
870889
<div
871890
key={subact.btnId}
872-
className="hover:bg-gray-300 cursor-pointer px-2 py-1.5 flex justify-start items-center text-black"
891+
className="hover:bg-gray-300 rounded cursor-pointer px-2 py-1.5 flex justify-start items-center text-black"
873892
onClick={() =>
874893
handleActionBtn(subact, item)
875894
}
876895
title={subact.hoverLabel}
877896
>
878-
<i className={subact.btnIcon}></i>
897+
<i
898+
className={`${subact.btnIcon} mr-1.5`}
899+
></i>
879900
{subact.btnLabel && (
880-
<span className="ml-[4px] text-xs capitalize">
901+
<span className="ml-[4px] text-[13px] capitalize font-medium">
881902
{subact.btnLabel}
882903
</span>
883904
)}
@@ -887,6 +908,48 @@ const ReportTable = (props) => {
887908
)}
888909
</button>
889910
))}
911+
{isViewShare[item.objectId] && (
912+
<div className="fixed z-[999] inset-0 w-full h-full bg-black bg-opacity-[75%]">
913+
<div className="fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-sm bg-white rounded shadow-md max-h-90 min-w-[90%] md:min-w-[400px] overflow-y-auto max-h-[340px] md:max-h-[400px] hide-scrollbar">
914+
<div
915+
className="cursor-pointer absolute text-white text-[22px] font-medium rounded-full z-50 top-1 right-3"
916+
onClick={() => setIsViewShare({})}
917+
>
918+
&times;
919+
</div>
920+
921+
<table className="table-auto w-full">
922+
<thead className="text-white h-[38px] sticky top-0 bg-[#32a3ac]">
923+
<tr>
924+
{props.ReportName === "Templates" && (
925+
<th className="p-2">Roles</th>
926+
)}
927+
<th className="p-2">Signers</th>
928+
</tr>
929+
</thead>
930+
<tbody>
931+
{item.Placeholders.map((x, i) => (
932+
<tr
933+
key={i}
934+
className="text-sm font-normal text-black odd:bg-white even:bg-gray-200"
935+
>
936+
{props.ReportName === "Templates" && (
937+
<td className="text-[13px] md:text-sm font-semibold p-2 ">
938+
{x.Role && x.Role}
939+
</td>
940+
)}
941+
<td className="text-[13px] md:text-sm p-2 break-all">
942+
{x.email
943+
? x.email
944+
: x?.signerPtr?.Email || "-"}
945+
</td>
946+
</tr>
947+
))}
948+
</tbody>
949+
</table>
950+
</div>
951+
</div>
952+
)}
890953
{isDeleteModal[item.objectId] && (
891954
<ModalUi
892955
isOpen

apps/OpenSignServer/cloud/parsefunction/linkContactToDoc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ export default async function linkContactToDoc(req) {
9999
};
100100
updateDoc.set('Placeholders', Placeholders);
101101
const Acl = docRes.getACL();
102-
Acl.setReadAccess(existContact.get('CreatedBy').id, true);
103-
Acl.setWriteAccess(existContact.get('CreatedBy').id, true);
102+
Acl.setReadAccess(existContact.get('UserId').id, true);
103+
Acl.setWriteAccess(existContact.get('UserId').id, true);
104104
updateDoc.setACL(Acl);
105105
// const parseData = JSON.parse(JSON.stringify(res));
106106
const resDoc = await updateDoc.save(null, { useMasterKey: true });

apps/OpenSignServer/cloud/parsefunction/reportsJson.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default function reportJson(id, userId) {
2727
'Signers.Name',
2828
'Signers.Email',
2929
'Signers.Phone',
30+
'Placeholders',
3031
],
3132
};
3233

@@ -67,6 +68,7 @@ export default function reportJson(id, userId) {
6768
'Signers.Phone',
6869
'Signers.UserId',
6970
'AuditTrail',
71+
'Placeholders',
7072
],
7173
};
7274
// In progess report
@@ -131,6 +133,7 @@ export default function reportJson(id, userId) {
131133
'Signers.Email',
132134
'Signers.Phone',
133135
'TimeToCompleteDays',
136+
'Placeholders',
134137
],
135138
};
136139

@@ -158,6 +161,7 @@ export default function reportJson(id, userId) {
158161
'Signers.Name',
159162
'Signers.Email',
160163
'Signers.Phone',
164+
'Placeholders',
161165
],
162166
};
163167
// Expired Documents report
@@ -188,6 +192,7 @@ export default function reportJson(id, userId) {
188192
'Signers.Name',
189193
'Signers.Email',
190194
'Signers.Phone',
195+
'Placeholders',
191196
],
192197
};
193198
// Recently sent for signatures report show on dashboard
@@ -259,6 +264,7 @@ export default function reportJson(id, userId) {
259264
'AuditTrail',
260265
'Signers.Email',
261266
'Signers.Phone',
267+
'Placeholders',
262268
],
263269
};
264270
// Drafts report show on dashboard
@@ -286,6 +292,7 @@ export default function reportJson(id, userId) {
286292
'Signers.Name',
287293
'Signers.Email',
288294
'Signers.Phone',
295+
'Placeholders',
289296
],
290297
};
291298
// contact book report

apps/OpenSignServer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export const config = {
101101
masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!
102102
masterKeyIps: ['0.0.0.0/0', '::/0'], // '::1'
103103
serverURL: 'http://localhost:8080/app', // Don't forget to change to https if needed
104-
verifyUserEmails: isMailAdapter === true ? true : false,
104+
verifyUserEmails: false,
105105
publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/app',
106106
// Your apps name. This will appear in the subject and body of the emails that are sent.
107107
appName: 'Opensign',

0 commit comments

Comments
 (0)