Skip to content

Commit 812b946

Browse files
Merge pull request #1156 from OpenSignLabs/raktima-patch-3
feat: display the email of the user who declined the document along with the decline reason in the document decline popup.
2 parents 981654a + 27eca2b commit 812b946

File tree

7 files changed

+86
-5
lines changed

7 files changed

+86
-5
lines changed

apps/OpenSign/public/locales/en/translation.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,9 @@
627627
"regenerate-test-token":"Regenerate Test Token",
628628
"help-test-token":"This token can be used to test the APIs at the https://sandbox.opensignlabs.com/api/v1 endpoint, allowing you to conduct unlimited document signatures. Please note that the sandbox API will sign your documents with self-signed certificates, which may not be recognized as valid by Adobe. Once you’ve completed your testing, you can upgrade to one of our paid plans to generate a production token.",
629629
"help-api-token":"This token can be used to access the production APIs at the {{origin}}/api/v1 endpoint. It can only be generated on one of our paid plans.",
630+
"reason":"Reason",
631+
"decline-by":"Declined/revoked by",
632+
"document-declined": "Document declined",
630633
"Add-Webhook":"Add Webhook",
631634
"quotamailselfsign": "You've reached your limit of 20 emails for this month. Upgrade now to continue sending emails directly.",
632635
"quotamail": "You've reached your limit of 20 signature request emails for this month. Upgrade now to continue sending emails directly.",

apps/OpenSign/public/locales/fr/translation.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,9 @@
627627
"regenerate-test-token":"Régénérer le jeton de test",
628628
"help-test-token":"Ce jeton peut être utilisé pour tester les API au niveau du point de terminaison https://sandbox.opensignlabs.com/api/v1, vous permettant ainsi d'effectuer un nombre illimité de signatures de documents. Veuillez noter que l'API sandbox signera vos documents avec des certificats auto-signés, qui peuvent ne pas être reconnus comme valides par Adobe. Une fois vos tests terminés, vous pouvez passer à l’un de nos forfaits payants pour générer un jeton de production.",
629629
"help-api-token":"Ce jeton peut être utilisé pour accéder aux API de production au point de terminaison {{origin}}/api/v1. Il ne peut être généré que sur l'un de nos forfaits payants.",
630+
"reason" :"Raison",
631+
"decline-by" :"Refusé/révoqué par",
632+
"document-declined":"document refusé",
630633
"Add-Webhook":"Ajouter Webhook",
631634
"quotamailselfsign": "Vous avez atteint votre limite de 20 e-mails pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
632635
"quotamail": "Vous avez atteint votre limite de 20 e-mails de demande de signature pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",

apps/OpenSign/src/constant/Utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ export const multiSignEmbed = async (
14111411
};
14121412
const color = position?.options?.fontColor;
14131413
const updateColorInRgb = getWidgetsFontColor(color);
1414-
const fontSize = parseInt(position?.options?.fontSize);
1414+
const fontSize = parseInt(position?.options?.fontSize || 13);
14151415
const widgetTypeExist = [
14161416
textWidget,
14171417
textInputWidget,

apps/OpenSign/src/pages/PdfRequestFiles.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,15 @@ function PdfRequestFiles(props) {
12161216
);
12171217
const jsonSender = JSON.parse(senderUser);
12181218
setIsDecline({ isDeclined: false });
1219-
const data = { IsDeclined: true, DeclineReason: reason };
1219+
const data = {
1220+
IsDeclined: true,
1221+
DeclineReason: reason,
1222+
DeclineBy: {
1223+
__type: "Pointer",
1224+
className: "_User",
1225+
objectId: jsonSender?.objectId
1226+
}
1227+
};
12201228
setIsUiLoading(true);
12211229

12221230
await axios
@@ -1277,6 +1285,8 @@ function PdfRequestFiles(props) {
12771285
})
12781286
.catch((err) => {
12791287
console.log("error updating field is decline ", err);
1288+
setIsUiLoading(false);
1289+
alert(t("something-went-wrong-mssg"));
12801290
});
12811291
};
12821292
//function to add default signature for all requested placeholder of sign
@@ -1575,6 +1585,23 @@ function PdfRequestFiles(props) {
15751585
const name = pdfDetails?.[0]?.Name;
15761586
await fetchUrl(url, name);
15771587
};
1588+
const handleDeclineMssg = () => {
1589+
const user = pdfDetails[0]?.DeclineBy?.email;
1590+
return (
1591+
<div>
1592+
{t("decline-alert-3")}
1593+
<div className="mt-2">
1594+
{" "}
1595+
<span className="font-medium">{t("reason")}</span> :{" "}
1596+
{pdfDetails[0]?.DeclineReason}{" "}
1597+
</div>
1598+
<div className="mt-2">
1599+
{" "}
1600+
<span className="font-medium">{t("decline-by")}</span> : {user}
1601+
</div>
1602+
</div>
1603+
);
1604+
};
15781605
return (
15791606
<DndProvider backend={HTML5Backend}>
15801607
<Title title={props.templateId ? "Public Sign" : "Request Sign"} />
@@ -1664,13 +1691,17 @@ function PdfRequestFiles(props) {
16641691
{/* this modal is used to show decline alert */}
16651692
<PdfDeclineModal
16661693
show={isDecline.isDeclined}
1667-
headMsg={t("document-decline")}
1694+
headMsg={
1695+
pdfDetails[0]?.IsDeclined
1696+
? t("document-declined")
1697+
: t("document-decline")
1698+
}
16681699
bodyMssg={
16691700
isDecline.currnt === "Sure"
16701701
? t("decline-alert-1")
16711702
: isDecline.currnt === "YouDeclined"
16721703
? t("decline-alert-2")
1673-
: isDecline.currnt === "another" && t("decline-alert-3")
1704+
: isDecline.currnt === "another" && handleDeclineMssg()
16741705
}
16751706
footerMessage={isDecline.currnt === "Sure"}
16761707
declineDoc={declineDoc}

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,21 @@ const ReportTable = (props) => {
473473
};
474474
//function to handle revoke/decline docment
475475
const handleRevoke = async (item) => {
476+
const senderUser = localStorage.getItem(
477+
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
478+
);
479+
const jsonSender = JSON.parse(senderUser);
476480
setIsRevoke({});
477481
setActLoader({ [`${item.objectId}`]: true });
478-
const data = { IsDeclined: true, DeclineReason: reason };
482+
const data = {
483+
IsDeclined: true,
484+
DeclineReason: reason,
485+
DeclineBy: {
486+
__type: "Pointer",
487+
className: "_User",
488+
objectId: jsonSender?.objectId
489+
}
490+
};
479491
await axios
480492
.put(
481493
`${localStorage.getItem("baseUrl")}classes/contracts_Document/${

apps/OpenSignServer/cloud/parsefunction/getDocument.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default async function getDocument(request) {
2222
query.include('Signers');
2323
query.include('AuditTrail.UserPtr');
2424
query.include('Placeholders');
25+
query.include('DeclineBy');
2526
query.notEqualTo('IsArchive', true);
2627
const res = await query.first({ useMasterKey: true });
2728
if (res) {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
*
3+
* @param {Parse} Parse
4+
*/
5+
exports.up = async Parse => {
6+
// TODO: set className here
7+
const className = 'contracts_Document';
8+
const schema = new Parse.Schema(className);
9+
schema.addPointer('DeclineBy', '_User');
10+
// TODO: Set the schema here
11+
// Example:
12+
// schema.addString('name').addNumber('cash');
13+
14+
return schema.update();
15+
};
16+
17+
/**
18+
*
19+
* @param {Parse} Parse
20+
*/
21+
exports.down = async Parse => {
22+
// TODO: set className here
23+
const className = 'contracts_Document';
24+
const schema = new Parse.Schema(className);
25+
schema.deleteField('DeclineBy');
26+
// TODO: Set the schema here
27+
// Example:
28+
// schema.deleteField('name').deleteField('cash');
29+
30+
return schema.update();
31+
};

0 commit comments

Comments
 (0)