Skip to content

Commit 273ada8

Browse files
Merge pull request #703 from OpenSignLabs/staging
v1.5.9
2 parents ff9a495 + 7912670 commit 273ada8

File tree

8 files changed

+106
-60
lines changed

8 files changed

+106
-60
lines changed

.all-contributorsrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,33 @@
205205
"contributions": [
206206
"code"
207207
]
208+
},
209+
{
210+
"login": "ugoconsonni",
211+
"name": "ugoconsonni",
212+
"avatar_url": "https://avatars.githubusercontent.com/u/13661702?v=4",
213+
"profile": "https://github.com/ugoconsonni",
214+
"contributions": [
215+
"code"
216+
]
217+
},
218+
{
219+
"login": "daniel-mutwiri",
220+
"name": "Daniel Mutwiri",
221+
"avatar_url": "https://avatars.githubusercontent.com/u/8936960?v=4",
222+
"profile": "https://github.com/daniel-mutwiri",
223+
"contributions": [
224+
"code"
225+
]
226+
},
227+
{
228+
"login": "Zathiel",
229+
"name": "Zathiel",
230+
"avatar_url": "https://avatars.githubusercontent.com/u/26553418?v=4",
231+
"profile": "https://github.com/Zathiel",
232+
"contributions": [
233+
"code"
234+
]
208235
}
209236
]
210237
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ We would like to thank all our contributors and users for their support and feed
134134
</tr>
135135
<tr>
136136
<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>
137+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ugoconsonni"><img src="https://avatars.githubusercontent.com/u/13661702?v=4?s=100" width="100px;" alt="ugoconsonni"/><br /><sub><b>ugoconsonni</b></sub></a><br /><a href="#code-ugoconsonni" title="Code">💻</a></td>
138+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/daniel-mutwiri"><img src="https://avatars.githubusercontent.com/u/8936960?v=4?s=100" width="100px;" alt="Daniel Mutwiri"/><br /><sub><b>Daniel Mutwiri</b></sub></a><br /><a href="#code-daniel-mutwiri" title="Code">💻</a></td>
139+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Zathiel"><img src="https://avatars.githubusercontent.com/u/26553418?v=4?s=100" width="100px;" alt="Zathiel"/><br /><sub><b>Zathiel</b></sub></a><br /><a href="#code-Zathiel" title="Code">💻</a></td>
137140
</tr>
138141
</tbody>
139142
</table>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ function Header({
577577
handleClose={() => setIsCertificate(false)}
578578
>
579579
<div className="p-3 md:p-5 text-[13px] md:text-base text-center">
580-
<p>Completion certificate is generating,</p>
581-
<p>please wait for some time if not download try again later</p>
580+
<p>Your completion certificate is being generated. Please wait momentarily.</p>
581+
<p>If the download doesn&apos;t start shortly, click the button again.</p>
582582
</div>
583583
</ModalUi>
584584
</div>

apps/OpenSign/src/pages/PlaceHolderSign.js

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -830,11 +830,11 @@ function PlaceHolderSign() {
830830
return pdfDetails[0].URL;
831831
}
832832
};
833-
834833
const alertSendEmail = async () => {
835834
const filterPrefill = signerPos?.filter((data) => data.Role !== "prefill");
836835
const getPrefill = signerPos?.filter((data) => data.Role === "prefill");
837836
let isLabel = false;
837+
//condition is used to check text widget data is empty or have response
838838
if (getPrefill && getPrefill.length > 0) {
839839
const prefillPlaceholder = getPrefill[0].placeHolder;
840840
if (prefillPlaceholder) {
@@ -845,30 +845,56 @@ function PlaceHolderSign() {
845845
});
846846
}
847847
}
848+
let isSignatureExist = true; // variable is used to check a signature widget exit or not then execute other code
849+
//for loop is used to check signature widget exist or not
850+
for (let item of filterPrefill) {
851+
let signatureExist = false; // Reset for each iteration
852+
for (let x of item.placeHolder) {
853+
if (!signatureExist) {
854+
const typeExist = x.pos.some((data) => data?.type);
855+
if (typeExist) {
856+
signatureExist = x.pos.some((data) => data?.type === "signature");
857+
} else {
858+
signatureExist = x.pos.some((data) => !data.isStamp);
859+
}
860+
}
861+
}
862+
if (!signatureExist) {
863+
isSignatureExist = false;
864+
const alert = {
865+
mssg: "sure",
866+
alert: true
867+
};
868+
setIsSendAlert(alert);
869+
}
870+
}
848871

849872
if (getPrefill && isLabel) {
850873
const alert = {
851874
mssg: textWidget,
852875
alert: true
853876
};
854877
setIsSendAlert(alert);
855-
} else if (filterPrefill.length === signersdata.length) {
856-
const IsSignerNotExist = filterPrefill?.filter((x) => !x.signerObjId);
857-
if (IsSignerNotExist && IsSignerNotExist?.length > 0) {
858-
setSignerExistModal(true);
859-
setSelectWidgetId(IsSignerNotExist[0]?.placeHolder?.[0]?.pos?.[0]?.key);
878+
} else if (isSignatureExist) {
879+
if (filterPrefill.length === signersdata.length) {
880+
const IsSignerNotExist = filterPrefill?.filter((x) => !x.signerObjId);
881+
if (IsSignerNotExist && IsSignerNotExist?.length > 0) {
882+
setSignerExistModal(true);
883+
setSelectWidgetId(
884+
IsSignerNotExist[0]?.placeHolder?.[0]?.pos?.[0]?.key
885+
);
886+
} else {
887+
saveDocumentDetails();
888+
}
860889
} else {
861-
saveDocumentDetails();
890+
const alert = {
891+
mssg: "sure",
892+
alert: true
893+
};
894+
setIsSendAlert(alert);
862895
}
863-
} else {
864-
const alert = {
865-
mssg: "sure",
866-
alert: true
867-
};
868-
setIsSendAlert(alert);
869896
}
870897
};
871-
872898
//function to use save placeholder details in contracts_document
873899
const saveDocumentDetails = async () => {
874900
setIsUiLoading(true);
@@ -1687,8 +1713,8 @@ function PlaceHolderSign() {
16871713
>
16881714
{isSendAlert.mssg === "sure" ? (
16891715
<span>
1690-
Please add at least one signature field for all
1691-
recipients.
1716+
Please ensure there&apos;s at least one signature widget
1717+
added for all recipients.
16921718
</span>
16931719
) : isSendAlert.mssg === textWidget ? (
16941720
<p>Please confirm that you have filled the text field.</p>

apps/OpenSign/src/pages/SignyourselfPdf.js

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,13 @@ function SignYourSelf() {
480480
Width: widgetTypeExist
481481
? calculateInitialWidthHeight(dragTypeValue, widgetValue).getWidth
482482
: dragTypeValue === "initials"
483-
? defaultWidthHeight(dragTypeValue).width
484-
: "",
483+
? defaultWidthHeight(dragTypeValue).width
484+
: "",
485485
Height: widgetTypeExist
486486
? calculateInitialWidthHeight(dragTypeValue, widgetValue).getHeight
487487
: dragTypeValue === "initials"
488-
? defaultWidthHeight(dragTypeValue).height
489-
: "",
488+
? defaultWidthHeight(dragTypeValue).height
489+
: "",
490490
options: addWidgetOptions(dragTypeValue)
491491
};
492492

@@ -603,7 +603,8 @@ function SignYourSelf() {
603603
};
604604
//function for send placeholder's co-ordinate(x,y) position embed signature url or stamp url
605605
async function embedWidgetsData() {
606-
let showAlert = false;
606+
let showAlert = false,
607+
isSignatureExist = false;
607608
try {
608609
for (let i = 0; i < xyPostion?.length; i++) {
609610
const requiredWidgets = xyPostion[i].pos.filter(
@@ -627,17 +628,26 @@ function SignYourSelf() {
627628
}
628629
}
629630
}
631+
//condition to check exist signature widget or not
632+
if (!isSignatureExist) {
633+
isSignatureExist = xyPostion[i].pos.some(
634+
(data) => data?.type === "signature"
635+
);
636+
}
630637
}
631-
if (xyPostion.length === 0) {
638+
if (xyPostion.length === 0 || !isSignatureExist) {
632639
setIsAlert({
640+
header: "Fields required",
633641
isShow: true,
634-
alertMessage: "Please complete your signature!"
642+
alertMessage:
643+
"Please ensure there's at least one signature widget added"
635644
});
636645
return;
637646
} else if (showAlert) {
638647
setIsAlert({
639648
isShow: true,
640-
alertMessage: "Please complete your signature!"
649+
alertMessage:
650+
"Please ensure all field is accurately filled and meets all requirements."
641651
});
642652
return;
643653
} else {
@@ -713,13 +723,13 @@ function SignYourSelf() {
713723
// for adding it in completion certificate
714724
let getSignature;
715725
for (let item of xyPostion) {
716-
const typeExist = item.pos.some((data) => data?.type);
717-
if (typeExist) {
718-
getSignature = item.pos.find((data) => data?.type === "signature");
719-
break;
720-
} else {
721-
getSignature = item.pos.find((data) => !data.isStamp);
722-
break;
726+
if (!getSignature) {
727+
const typeExist = item.pos.some((data) => data?.type);
728+
if (typeExist) {
729+
getSignature = item.pos.find((data) => data?.type === "signature");
730+
} else {
731+
getSignature = item.pos.find((data) => !data.isStamp);
732+
}
723733
}
724734
}
725735
let base64Sign = getSignature.SignUrl;
@@ -1161,7 +1171,7 @@ function SignYourSelf() {
11611171
<ModalUi
11621172
headerColor={"#dc3545"}
11631173
isOpen={isAlert.isShow}
1164-
title={"Alert"}
1174+
title={isAlert?.header || "Alert"}
11651175
handleClose={() => {
11661176
setIsAlert({
11671177
isShow: false,
@@ -1171,28 +1181,6 @@ function SignYourSelf() {
11711181
>
11721182
<div style={{ height: "100%", padding: 20 }}>
11731183
<p>{isAlert.alertMessage}</p>
1174-
1175-
<div
1176-
style={{
1177-
height: "1px",
1178-
backgroundColor: "#9f9f9f",
1179-
width: "100%",
1180-
marginTop: "15px",
1181-
marginBottom: "15px"
1182-
}}
1183-
></div>
1184-
<button
1185-
onClick={() => {
1186-
setIsAlert({
1187-
isShow: false,
1188-
alertMessage: ""
1189-
});
1190-
}}
1191-
type="button"
1192-
className="finishBtn cancelBtn"
1193-
>
1194-
Ok
1195-
</button>
11961184
</div>
11971185
</ModalUi>
11981186

apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ export default async function createDocumentWithTemplate(request, response) {
169169
object.set('Signers', templateSigner);
170170
}
171171
object.set('URL', template.URL);
172+
object.set('SignedUrl', template.URL);
172173
object.set('CreatedBy', template.CreatedBy);
173174
object.set('ExtUserPtr', {
174175
__type: 'Pointer',

apps/OpenSignServer/cloud/customRoute/v1/routes/createDocumentwithCoordinate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export default async function createDocumentwithCoordinate(request, response) {
130130
object.set('SendinOrder', sendInOrder);
131131
}
132132
object.set('URL', fileUrl);
133+
object.set('SignedUrl', fileUrl);
133134
object.set('CreatedBy', userPtr);
134135
object.set('ExtUserPtr', extUserPtr);
135136
object.set('IsSendMail', send_email);
@@ -279,7 +280,7 @@ export default async function createDocumentwithCoordinate(request, response) {
279280
const objectId = contactMail[i].contactPtr.objectId;
280281
const hostUrl = baseUrl.origin;
281282
//encode this url value `${response.id}/${contactMail[i].email}/${objectId}` to base64 using `btoa` function
282-
const encodeBase64 = btoa(`${response.id}/${contactMail[i].email}/${objectId}`);
283+
const encodeBase64 = btoa(`${res.id}/${contactMail[i].email}/${objectId}`);
283284
let signPdf = `${hostUrl}/login/${encodeBase64}`;
284285
const openSignUrl = 'https://www.opensignlabs.com/contact-us';
285286
const orgName = parseExtUser.Company ? parseExtUser.Company : '';
@@ -332,7 +333,7 @@ export default async function createDocumentwithCoordinate(request, response) {
332333
);
333334
} else {
334335
replaceVar = {
335-
subject: `${parseExtUser.Name} has requested you to sign "${parseExtUser.Name}"`,
336+
subject: `${parseExtUser.Name} has requested you to sign "${name}"`,
336337
body: email_html,
337338
};
338339
}

apps/OpenSignServer/cloud/parsefunction/pdf/GenerateCertificate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default async function GenerateCertificate(docDetails) {
2828
const company = docDetails?.ExtUserPtr?.Company || '';
2929
const createdAt = docDetails?.DocSentAt?.iso || docDetails.createdAt;
3030
const auditTrail =
31-
docDetails.AuditTrail?.length > 1
31+
docDetails?.Signers?.length > 0
3232
? docDetails.AuditTrail.map(x => {
3333
const data = docDetails.Signers.find(y => y.objectId === x.UserPtr.objectId);
3434
return {
@@ -281,7 +281,7 @@ export default async function GenerateCertificate(docDetails) {
281281
});
282282

283283
page.drawText('Viewed on :', {
284-
x: half +55,
284+
x: half + 55,
285285
y: yPosition2,
286286
size: timeText,
287287
font: timesRomanFont,

0 commit comments

Comments
 (0)