fix: refactor code

This commit is contained in:
RaktimaNXG
2024-07-18 21:06:51 +05:30
parent c59c921a8b
commit 6140aea31a
5 changed files with 30 additions and 30 deletions
+2 -2
View File
@@ -662,9 +662,9 @@ function Login() {
onClick={togglePasswordVisibility}
>
{state.passwordVisible ? (
<i className="fa fa-eye-slash text-xs pb-1" /> // Close eye icon
<i className="fa-light fa-eye-slash text-xs pb-1" /> // Close eye icon
) : (
<i className="fa fa-eye text-xs pb-1 " /> // Open eye icon
<i className="fa-light fa-eye text-xs pb-1 " /> // Open eye icon
)}
</span>
</div>
+1 -1
View File
@@ -951,7 +951,7 @@ function PdfRequestFiles(props) {
}
const hostPublicUrl = isStaging
? "https://staging-app.opensignlabs.com"
: "https://app.opensignlabs.com/";
: "https://app.opensignlabs.com";
let signPdf = props?.templateId
? `${hostPublicUrl}/login/${encodeBase64}`
: `${hostUrl}/login/${encodeBase64}`;
+2 -2
View File
@@ -415,9 +415,9 @@ const Signup = () => {
onClick={togglePasswordVisibility}
>
{showPassword ? (
<i className="fa fa-eye-slash" /> // Close eye icon
<i className="fa-light fa-eye-slash" /> // Close eye icon
) : (
<i className="fa fa-eye" /> // Open eye icon
<i className="fa-light fa-eye" /> // Open eye icon
)}
</span>
</div>
@@ -47,7 +47,7 @@ const ReportTable = (props) => {
const [isTour, setIsTour] = useState(false);
const [tourStatusArr, setTourStatusArr] = useState([]);
const [isResendMail, setIsResendMail] = useState({});
const [isMakePublic, setIsMakePublic] = useState({});
const [isMakePublicModal, setIsMakePublicModal] = useState({});
const [mail, setMail] = useState({ subject: "", body: "" });
const [userDetails, setUserDetails] = useState({});
const [isNextStep, setIsNextStep] = useState({});
@@ -443,7 +443,7 @@ const ReportTable = (props) => {
const handleClose = (item) => {
setIsRevoke({});
setIsDeleteModal({});
setIsMakePublic({});
setIsMakePublicModal({});
setSelectedPublicRole("");
setIsPublicProfile({});
if (item?.objectId) {
@@ -855,7 +855,7 @@ const ReportTable = (props) => {
const handlePublicTemplate = async (item) => {
if (selectedPublicRole || !props.isPublic[item.objectId]) {
setActLoader({ [item.objectId]: true });
setIsMakePublic(false);
setIsMakePublicModal(false);
try {
const res = await Parse.Cloud.run("createpublictemplate", {
templateid: item.objectId,
@@ -925,7 +925,7 @@ const ReportTable = (props) => {
//conditon to check role is exist or not
if (getPlaceholder && getPlaceholder.length > 0) {
const signers = item?.Signers;
//condition to check there should be attached all role to signers except one public role
//condition to check that every role is attached to signers except the public role.
if (getPlaceholder.length - 1 === signers?.length) {
//check template send in order
const IsSendInOrder = item?.SendinOrder;
@@ -935,8 +935,8 @@ const ReportTable = (props) => {
const getIndex = item.Placeholders.findIndex(
(obj) => obj.Role === getRole?.Role
);
//condition for if send in order true then public role order should be on top
//if send in order false and do not need to check order of public role
//condition for if send in order true then the public role order should be prioritized.
//When send in order is false and there's no need to verify the public role's order
if ((IsSendInOrder && getIndex === 0) || !IsSendInOrder) {
const checkIsSignatureExist = getPlaceholder?.every(
(placeholderObj) =>
@@ -951,6 +951,7 @@ const ReportTable = (props) => {
setIsPublicUserName(extendUser[0]?.UserName);
//condition to check user have public url or not
if (userName) {
//`setIsPublic` variable is used to collect all template public status
props.setIsPublic((prevStates) => ({
...prevStates,
[item.objectId]: e.target.checked
@@ -958,7 +959,8 @@ const ReportTable = (props) => {
if (getRole?.Role) {
setSelectedPublicRole(getRole?.Role);
}
setIsMakePublic({ [item.objectId]: true });
//`setIsMakePublicModal` is used to open modal after succesfully make public
setIsMakePublicModal({ [item.objectId]: true });
} else {
setIsPublicProfile({ [item.objectId]: true });
}
@@ -1258,7 +1260,7 @@ const ReportTable = (props) => {
</label>
</div>
)}
{isMakePublic[item.objectId] && (
{isMakePublicModal[item.objectId] && (
<ModalUi
isOpen
title={
@@ -1267,7 +1269,7 @@ const ReportTable = (props) => {
: "Make template private"
}
handleClose={() => {
setIsMakePublic({});
setIsMakePublicModal({});
setSelectedPublicRole("");
props.setIsPublic((prevStates) => ({
...prevStates,
@@ -49,20 +49,19 @@ const saveRoleContact = async contact => {
const createDocumentFromTemplate = async (template, existContact, index) => {
try {
if (template) {
const Doc = JSON.parse(JSON.stringify(template));
//update contact in placeholder, signers and update ACl in provide document
const object = new Parse.Object('contracts_Document');
object.set('Name', Doc?.Name);
object.set('Description', Doc?.Description);
object.set('Note', Doc?.Note);
object.set('TimeToCompleteDays', Doc.TimeToCompleteDays || 15);
object.set('SendinOrder', Doc?.SendinOrder);
object.set('AutomaticReminders', Doc.AutomaticReminders);
object.set('RemindOnceInEvery', Doc?.RemindOnceInEvery);
object.set('URL', Doc?.URL);
object.set('CreatedBy', Doc?.CreatedBy);
object.set('ExtUserPtr', Doc?.ExtUserPtr);
let signers = Doc?.Signers || [];
object.set('Name', template?.Name);
object.set('Description', template?.Description);
object.set('Note', template?.Note);
object.set('TimeToCompleteDays', template.TimeToCompleteDays || 15);
object.set('SendinOrder', template?.SendinOrder);
object.set('AutomaticReminders', template.AutomaticReminders);
object.set('RemindOnceInEvery', template?.RemindOnceInEvery);
object.set('URL', template?.URL);
object.set('CreatedBy', template?.CreatedBy);
object.set('ExtUserPtr', template?.ExtUserPtr);
let signers = template?.Signers || [];
const signerobj = {
__type: 'Pointer',
className: 'contracts_Contactbook',
@@ -70,8 +69,8 @@ const createDocumentFromTemplate = async (template, existContact, index) => {
};
signers = [...signers.slice(0, index), signerobj, ...signers.slice(index)];
object.set('Signers', signers);
object.set('SignedUrl', Doc.URL || Doc.SignedUrl);
const Placeholders = Doc?.Placeholders || [];
object.set('SignedUrl', template.URL || template.SignedUrl);
const Placeholders = template?.Placeholders || [];
Placeholders[index] = {
...Placeholders[index],
signerObjId: existContact.id,
@@ -115,7 +114,6 @@ const sendMailToAllSigners = async docId => {
extUserId: existUserId,
ispublic: true,
});
if (getSubscriptionDetails) {
const tenantRes = JSON.parse(JSON.stringify(res));
const extUserDetails = Doc?.ExtUserPtr;
@@ -151,7 +149,7 @@ const sendMailToAllSigners = async docId => {
const senderName = `${Doc?.ExtUserPtr.Name}`;
const documentName = `${Doc?.Name}`;
let replaceVar;
if (requestBody && requestSubject && isSubscribed) {
if (isSubscribed && requestBody && requestSubject) {
const replacedRequestBody = requestBody.replace(/"/g, "'");
htmlReqBody =
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body>" +