From 954dbb3375bd97f605a83f13221090fe8bdc8187 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Mon, 8 Jul 2024 19:06:37 +0530 Subject: [PATCH] fix: teams are not visible in add user form, after upgrade subscription some menu are not visible --- apps/OpenSign/src/components/AddTeam.js | 1 + apps/OpenSign/src/components/AddUser.js | 2 +- apps/OpenSign/src/pages/GenerateToken.js | 2 +- apps/OpenSign/src/pages/Pgsignup.js | 13 ++++ apps/OpenSign/src/pages/PlanSubscriptions.js | 74 +++++++++---------- .../src/primitives/GetReportDisplay.js | 2 +- 6 files changed, 50 insertions(+), 44 deletions(-) diff --git a/apps/OpenSign/src/components/AddTeam.js b/apps/OpenSign/src/components/AddTeam.js index 3c784738c..d01264623 100644 --- a/apps/OpenSign/src/components/AddTeam.js +++ b/apps/OpenSign/src/components/AddTeam.js @@ -107,6 +107,7 @@ const AddTeam = (props) => { objectId: localUser.OrganizationId.objectId }); } + newTeam.set("IsActive", true); const newTeamRes = await newTeam.save(); if (updatedAncestors.length > 0) { const ParentId = teamList.find((x) => x.objectId === formdata.team); diff --git a/apps/OpenSign/src/components/AddUser.js b/apps/OpenSign/src/components/AddUser.js index 82bac3ced..7808c6040 100644 --- a/apps/OpenSign/src/components/AddUser.js +++ b/apps/OpenSign/src/components/AddUser.js @@ -44,7 +44,7 @@ const AddUser = (props) => { className: "contracts_Organizations", objectId: extUser.OrganizationId.objectId }); - team.equalTo("IsActive", true); + team.notEqualTo("IsActive", false); const teamRes = await team.find(); if (teamRes.length > 0) { const _teamRes = JSON.parse(JSON.stringify(teamRes)); diff --git a/apps/OpenSign/src/pages/GenerateToken.js b/apps/OpenSign/src/pages/GenerateToken.js index 775fd5b0d..bf2a9ff82 100644 --- a/apps/OpenSign/src/pages/GenerateToken.js +++ b/apps/OpenSign/src/pages/GenerateToken.js @@ -45,7 +45,7 @@ function GenerateToken() { }; const res = await axios.post(url, {}, { headers: headers }); if (res) { - SetApiToken(res.data.result.result); + SetApiToken(res.data?.result?.result); } setIsLoader(false); } catch (err) { diff --git a/apps/OpenSign/src/pages/Pgsignup.js b/apps/OpenSign/src/pages/Pgsignup.js index 9180bf015..7e5c97637 100644 --- a/apps/OpenSign/src/pages/Pgsignup.js +++ b/apps/OpenSign/src/pages/Pgsignup.js @@ -70,6 +70,19 @@ const PgSignUp = () => { }); if (res) { localStorage.removeItem("userDetails"); + try { + const extUser = await Parse.Cloud.run("getUserDetails", { + email: userDetails.email + }); + const userRole = extUser?.get("UserRole"); + const _currentRole = userRole; + const _role = _currentRole.replace("contracts_", ""); + localStorage.setItem("_user_role", _role); + const extInfo_stringify = JSON.stringify([extUser]); + localStorage.setItem("Extand_Class", extInfo_stringify); + } catch (err) { + console.log("Err in fetching extuser", err); + } navigate( "/" + userSettings[0].pageType + "/" + userSettings[0].pageId ); diff --git a/apps/OpenSign/src/pages/PlanSubscriptions.js b/apps/OpenSign/src/pages/PlanSubscriptions.js index a45f525e1..fd39f5efb 100644 --- a/apps/OpenSign/src/pages/PlanSubscriptions.js +++ b/apps/OpenSign/src/pages/PlanSubscriptions.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from "react"; -import { NavLink, useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import checkmark from "../assets/images/checkmark.png"; import plansArr from "../json/plansArr"; import Title from "../components/Title"; @@ -61,25 +61,33 @@ const PlanSubscriptions = () => { // eslint-disable-next-line }, []); - const handleFreePlan = async () => { - setIsLoader(true); - try { - const params = { userId: Parse.User.current().id }; - const res = await Parse.Cloud.run("freesubscription", params); - if (res.status === "success" && res.result === "already subscribed!") { - setIsLoader(false); - alert("You have already subscribed to plan!"); - } else if (res.status === "success") { - setIsLoader(false); - navigate("/"); - } else if (res.status === "error") { - setIsLoader(false); - alert(res.result); + const handleFreePlan = async (item) => { + if (item.url) { + const url = yearlyVisible ? item.yearlyUrl + details : item.url + details; + if (user) { + localStorage.setItem("userDetails", JSON.stringify(user)); + } + openInNewTab(url, item?.target); + } else { + setIsLoader(true); + try { + const params = { userId: Parse.User.current().id }; + const res = await Parse.Cloud.run("freesubscription", params); + if (res.status === "success" && res.result === "already subscribed!") { + setIsLoader(false); + alert("You have already subscribed to plan!"); + } else if (res.status === "success") { + setIsLoader(false); + navigate("/"); + } else if (res.status === "error") { + setIsLoader(false); + alert(res.result); + } + } catch (err) { + setIsLoader(false); + console.log("err in free subscribe", err.message); + alert("Somenthing went wrong, please try again later!"); } - } catch (err) { - setIsLoader(false); - console.log("err in free subscribe", err.message); - alert("Somenthing went wrong, please try again later!"); } }; return ( @@ -173,28 +181,12 @@ const PlanSubscriptions = () => { - {item.url ? ( - - {item.btnText} - - ) : ( - - )} +