Merge pull request #916 from OpenSignLabs/multiuser_issue

This commit is contained in:
Amol
2024-07-10 16:46:08 +05:30
committed by GitHub
7 changed files with 112 additions and 99 deletions
+12 -39
View File
@@ -44,10 +44,7 @@ function Header({
//function for show decline alert
const handleDeclinePdfAlert = async () => {
const currentDecline = {
currnt: "Sure",
isDeclined: true
};
const currentDecline = { currnt: "Sure", isDeclined: true };
setIsDecline(currentDecline);
};
@@ -209,7 +206,7 @@ function Header({
</DropdownMenu.Trigger>
<DropdownMenu.Portal>
<DropdownMenu.Content
className="bg-white shadow-md rounded px-2 py-1"
className="bg-white shadow-md rounded-full px-3 py-2"
sideOffset={5}
>
<DropdownMenu.Item
@@ -362,40 +359,16 @@ function Header({
>
Finish
</button>
<div className="op-dropdown op-dropdown-end">
<div
tabIndex={0}
role="button"
className="op-btn op-btn-info op-btn-sm shadow"
>
<i
className="fa-light fa-ellipsis-v"
aria-hidden="true"
></i>
</div>
<ul
tabIndex={0}
className="op-dropdown-content z-[1] op-menu op-menu-sm p-1 shadow bg-base-100 rounded-box mt-1"
>
<li
onClick={() =>
handleDownloadPdf(
pdfDetails,
pdfUrl,
setIsDownloading
)
}
>
<span className="font-semibold text-[12px]">
<i
className="fa-light fa-arrow-down"
aria-hidden="true"
></i>{" "}
Download
</span>
</li>
</ul>
</div>
<button
type="button"
className="op-btn op-btn-neutral op-btn-sm mr-[3px] shadow"
onClick={() =>
handleDownloadPdf(pdfDetails, pdfUrl, setIsDownloading)
}
>
<i className="fa-light fa-arrow-down font-semibold lg:hidden"></i>
<span className="hidden lg:block">Download</span>
</button>
</>
)}
</div>
+8 -8
View File
@@ -346,14 +346,14 @@ export default function reportJson(id) {
message:
"This menu reveals more options such as Edit & Delete. Use the 'Edit' button to add signer roles, modify fields, and update your template. Changes will apply to all future documents created from this template but wont affect existing documents.Use the Delete button you can delete template. ",
subaction: [
// {
// btnId: "1873",
// btnLabel: "Share-with",
// hoverLabel: "Share-with",
// btnIcon: "fa-light fa-share-nodes",
// redirectUrl: "",
// action: "sharewith"
// },
{
btnId: "1873",
btnLabel: "Share-with",
hoverLabel: "Share-with",
btnIcon: "fa-light fa-share-nodes",
redirectUrl: "",
action: "sharewith"
},
{
btnId: "2434",
btnLabel: "Edit",
+11 -19
View File
@@ -1140,11 +1140,9 @@ function PdfRequestFiles() {
});
};
//function for set decline true on press decline button
const declineDoc = async () => {
const declineDoc = async (reason) => {
setIsDecline({ isDeclined: false });
const data = {
IsDeclined: true
};
const data = { IsDeclined: true, DeclineReason: reason };
setIsUiLoading(true);
await axios
@@ -1486,12 +1484,9 @@ function PdfRequestFiles() {
<ModalUi
isOpen={defaultSignAlert.isShow}
title={"Auto sign"}
handleClose={() => {
setDefaultSignAlert({
isShow: false,
alertMessage: ""
});
}}
handleClose={() =>
setDefaultSignAlert({ isShow: false, alertMessage: "" })
}
>
<div className="h-full p-[20px]">
<p>{defaultSignAlert.alertMessage}</p>
@@ -1506,12 +1501,12 @@ function PdfRequestFiles() {
Yes
</button>
<button
onClick={() => {
onClick={() =>
setDefaultSignAlert({
isShow: false,
alertMessage: ""
});
}}
})
}
type="button"
className="op-btn op-btn-secondary"
>
@@ -1520,12 +1515,9 @@ function PdfRequestFiles() {
</>
) : (
<button
onClick={() => {
setIsAlert({
isShow: false,
alertMessage: ""
});
}}
onClick={() =>
setIsAlert({ isShow: false, alertMessage: "" })
}
type="button"
className="op-btn op-btn-primary"
>
@@ -68,6 +68,7 @@ const ReportTable = (props) => {
// const [publicUserName, setIsPublicUserName] = useState("");
const [isViewShare, setIsViewShare] = useState({});
const [isSubscribe, setIsSubscribe] = useState(true);
const [reason, setReason] = useState("");
const Extand_Class = localStorage.getItem("Extand_Class");
const extClass = Extand_Class && JSON.parse(Extand_Class);
const startIndex = (currentPage - 1) * props.docPerPage;
@@ -146,21 +147,23 @@ const ReportTable = (props) => {
if (props.ReportName === "Templates") {
try {
const extUser = JSON.parse(localStorage.getItem("Extand_Class"))?.[0];
const team = new Parse.Query("contracts_Teams");
team.equalTo("OrganizationId", {
__type: "Pointer",
className: "contracts_Organizations",
objectId: extUser.OrganizationId.objectId
});
team.notEqualTo("IsActive", false);
const teamtRes = await team.find();
if (teamtRes.length > 0) {
const _teamRes = JSON.parse(JSON.stringify(teamtRes));
const formatedList = _teamRes.map((x) => ({
label: x.Name,
value: x.objectId
}));
setTeamList(formatedList);
if (extUser?.OrganizationId?.objectId) {
const team = new Parse.Query("contracts_Teams");
team.equalTo("OrganizationId", {
__type: "Pointer",
className: "contracts_Organizations",
objectId: extUser.OrganizationId.objectId
});
team.notEqualTo("IsActive", false);
const teamtRes = await team.find();
if (teamtRes.length > 0) {
const _teamRes = JSON.parse(JSON.stringify(teamtRes));
const formatedList = _teamRes.map((x) => ({
label: x.Name,
value: x.objectId
}));
setTeamList(formatedList);
}
}
} catch (err) {
console.log("Err in fetch top level teamlist", err);
@@ -444,6 +447,7 @@ const ReportTable = (props) => {
const handleClose = () => {
setIsRevoke({});
setIsDeleteModal({});
setReason("");
// setIsMakePublic({});
// setSelectedPublicRole("");
// setIsPublicProfile({});
@@ -487,10 +491,7 @@ const ReportTable = (props) => {
const handleRevoke = async (item) => {
setIsRevoke({});
setActLoader({ [`${item.objectId}`]: true });
const data = {
IsDeclined: true
};
const data = { IsDeclined: true, DeclineReason: reason };
await axios
.put(
`${localStorage.getItem("baseUrl")}classes/contracts_Document/${
@@ -508,6 +509,7 @@ const ReportTable = (props) => {
.then(async (result) => {
const res = result.data;
if (res) {
setReason("");
setActLoader({});
setIsAlert(true);
setAlertMsg({
@@ -523,6 +525,7 @@ const ReportTable = (props) => {
})
.catch((err) => {
console.log("err", err);
setReason("");
setIsAlert(true);
setAlertMsg({
type: "danger",
@@ -1708,20 +1711,28 @@ const ReportTable = (props) => {
handleClose={handleClose}
>
<div className="m-[20px]">
<div className="text-lg font-normal text-black">
<div className="text-sm md:text-lg font-normal text-black">
Are you sure you want to revoke this document?
</div>
<hr className="bg-[#ccc] mt-4" />
<div className="mt-2">
<textarea
rows={3}
placeholder="Reason (optional)"
className="px-4 op-textarea op-textarea-bordered focus:outline-none hover:border-base-content w-full text-xs"
value={reason}
onChange={(e) => setReason(e.target.value)}
></textarea>
</div>
<div className="flex items-center mt-3 gap-2">
<button
onClick={() => handleRevoke(item)}
className="op-btn op-btn-primary"
className="op-btn op-btn-primary px-6"
>
Yes
</button>
<button
onClick={handleClose}
className="op-btn op-btn-secondary"
className="op-btn op-btn-secondary px-6"
>
No
</button>
@@ -1,4 +1,4 @@
import React from "react";
import React, { useState } from "react";
import "../styles/signature.css";
function CustomModal({
@@ -9,10 +9,11 @@ function CustomModal({
declineDoc,
setIsDecline
}) {
const [reason, setReason] = useState("");
return (
show && (
<dialog className="op-modal op-modal-open absolute z-[998]">
<div className="w-[80%] md:w-[40%] op-modal-box p-0 overflow-y-auto hide-scrollbar text-sm">
<dialog className="op-modal op-modal-open absolute z-[448]">
<div className="w-[95%] md:w-[60%] lg:w-[40%] op-modal-box p-0 overflow-y-auto hide-scrollbar text-sm">
<h3 className="text-[#de4337] font-bold text-lg pt-[15px] px-[20px]">
{headMsg && headMsg}
</h3>
@@ -21,19 +22,34 @@ function CustomModal({
</div>
{footerMessage && (
<>
<div className="h-[1px] bg-[#9f9f9f] w-full"></div>
<div className="m-[15px] ">
<div className="mx-3">
<textarea
rows={3}
placeholder="Reason (optional)"
className="px-4 op-textarea op-textarea-bordered focus:outline-none hover:border-base-content w-full text-xs"
value={reason}
onChange={(e) => setReason(e.target.value)}
></textarea>
</div>
{/* <div className="h-[1px] bg-[#9f9f9f] w-full"></div> */}
<div className="m-[15px]">
<button
className="op-btn op-btn-primary mr-2"
className="op-btn op-btn-primary mr-2 px-6"
type="button"
onClick={() => declineDoc()}
onClick={() => {
setReason("");
declineDoc(reason);
}}
>
Yes
</button>
<button
type="button"
className="op-btn op-btn-secondary"
onClick={() => setIsDecline({ isDeclined: false })}
onClick={() => {
setReason("");
setIsDecline({ isDeclined: false });
}}
>
Close
</button>
@@ -65,7 +65,7 @@ export default async function SubscriptionAftersave(request) {
const extUserRes = await extUserQuery.first({ useMasterKey: true });
if (extUserRes) {
const extUser = JSON.parse(JSON.stringify(extUserRes));
if (extUser?.UserRole !== 'contracts_Admin') {
if (!extUser?.OrganizationId) {
await addTeamAndOrg(extUser);
}
}
@@ -86,7 +86,7 @@ export default async function SubscriptionAftersave(request) {
const extUserRes = await extUserQuery.first({ useMasterKey: true });
if (extUserRes) {
const extUser = JSON.parse(JSON.stringify(extUserRes));
if (extUser?.UserRole !== 'contracts_Admin') {
if (!extUser?.OrganizationId) {
await addTeamAndOrg(extUser);
}
}
@@ -0,0 +1,21 @@
/**
*
* @param {Parse} Parse
*/
exports.up = async Parse => {
const className = 'contracts_Document';
const schema = new Parse.Schema(className);
schema.addString('DeclineReason');
return schema.update();
};
/**
*
* @param {Parse} Parse
*/
exports.down = async Parse => {
const className = 'contracts_Document';
const schema = new Parse.Schema(className);
schema.deleteField('DeclineReason');
return schema.update();
};