fix: opensign-drive tour message error andtemplate report tour message

This commit is contained in:
RaktimaNXG
2024-04-17 14:30:53 +05:30
parent 6880ae35a8
commit 1371c2c09a
6 changed files with 202 additions and 91 deletions
+2 -3
View File
@@ -547,7 +547,6 @@ export const signPdfFun = async (
userId: signerObjectId,
isCustomCompletionMail: isCustomCompletionMail
};
const response = await axios
.post(`${localStorage.getItem("baseUrl")}functions/signPdf`, singleSign, {
headers: {
@@ -1248,8 +1247,8 @@ export const multiSignEmbed = async (
position.type === radioButtonWidget
? 10
: position.type === "checkbox"
? 10
: newUpdateHeight;
? 10
: newUpdateHeight;
const newHeight = ind ? (ind > 0 ? widgetHeight : 0) : widgetHeight;
if (signyourself) {
+9 -3
View File
@@ -283,7 +283,9 @@ export default function reportJson(id) {
textColor: "white",
btnIcon: "fa fa-plus",
redirectUrl: "placeHolderSign",
action: "redirect"
action: "redirect",
selector: "reactourSecond",
message: "onclick use button to create document from template."
},
{
btnLabel: "Edit",
@@ -292,7 +294,9 @@ export default function reportJson(id) {
textColor: "white",
btnIcon: "fa-solid fa-pen",
redirectUrl: "template",
action: "redirect"
action: "redirect",
selector: "reactourThird",
message: "onclick edit button you can edit template."
},
{
btnId: "1834",
@@ -301,7 +305,9 @@ export default function reportJson(id) {
textColor: "white",
btnIcon: "fa fa-trash",
redirectUrl: "",
action: "delete"
action: "delete",
selector: "reactourForth",
message: "onclick delete button you can delete template."
}
],
helpMsg:
+52 -43
View File
@@ -129,40 +129,6 @@ function Opensigndrive() {
),
position: "top",
style: { fontSize: "13px" }
},
{
selector: '[data-tut="reactourFifth"]',
content: () => (
<TourContentWithBtn
message={`The document list is displayed according to the selected sorting option. Icons next to each document indicate its current status.`}
isChecked={handleDontShow}
/>
),
position: "bottom",
style: { fontSize: "13px" }
},
{
selector: '[data-tut="reactourSixth"]',
content: () => (
<TourContentWithBtn
message={`Right-click on a document to see options such as Download, Rename, Move, and Delete. Click on the document to open it.`}
isChecked={handleDontShow}
/>
),
position: "bottom",
style: { fontSize: "13px" }
},
{
selector: '[data-tut="reactourSeventh"]',
content: () => (
<TourContentWithBtn
message={`Right-click on any folder to see options. Choose Rename to change the folders name or click on the folder to navigate through its contents.`}
isChecked={handleDontShow}
/>
),
position: "bottom",
style: { fontSize: "13px" }
}
];
//function for get all pdf document list
@@ -177,7 +143,43 @@ function Opensigndrive() {
if (driveDetails && driveDetails === "Error: Something went wrong!") {
setHandleError("Error: Something went wrong!");
} else if (driveDetails && driveDetails.length > 0) {
let newTour = tourConfigs;
const addMoreTour = [
{
selector: '[data-tut="reactourFifth"]',
content: () => (
<TourContentWithBtn
message={`The document list is displayed according to the selected sorting option. Icons next to each document indicate its current status.`}
isChecked={handleDontShow}
/>
),
position: "bottom",
style: { fontSize: "13px" }
},
{
selector: '[data-tut="reactourSixth"]',
content: () => (
<TourContentWithBtn
message={`Right-click on a document to see options such as Download, Rename, Move, and Delete. Click on the document to open it.`}
isChecked={handleDontShow}
/>
),
position: "bottom",
style: { fontSize: "13px" }
},
{
selector: '[data-tut="reactourSeventh"]',
content: () => (
<TourContentWithBtn
message={`Right-click on any folder to see options. Choose Rename to change the folders name or click on the folder to navigate through its contents.`}
isChecked={handleDontShow}
/>
),
position: "bottom",
style: { fontSize: "13px" }
}
];
let newTour = [...tourConfigs, ...addMoreTour];
console.log("tournew", newTour);
const isFolderExist = driveDetails.some(
(data) => data.Type === "Folder"
);
@@ -192,9 +194,12 @@ function Opensigndrive() {
(data) => data.selector !== '[data-tut="reactourSixth"]'
);
}
console.log("newTour", newTour);
setTourData(newTour);
setSkip((prevSkip) => prevSkip + limit);
sortingData(null, null, driveDetails, true);
} else {
setTourData(tourConfigs);
}
if (!docId) {
setFolderName([{ name: "OpenSign™ Drive", objectId: "" }]);
@@ -211,6 +216,7 @@ function Opensigndrive() {
});
}
};
console.log("tourdata", tourData);
//function to fetch drive details list on scroll bottom
const handleScroll = () => {
@@ -696,14 +702,17 @@ function Opensigndrive() {
) : (
<>
<div className="folderContainer">
<Tour
onRequestClose={closeTour}
steps={tourData}
isOpen={isTour}
closeWithMask={false}
scrollOffset={-100}
rounded={5}
/>
{tourData && (
<Tour
onRequestClose={closeTour}
steps={tourData}
isOpen={isTour}
closeWithMask={false}
scrollOffset={-100}
rounded={5}
/>
)}
<div
data-tut="reactourFirst"
onMouseEnter={(e) => handleMouseEnter(e)}
+9 -7
View File
@@ -75,6 +75,7 @@ function PdfRequestFiles() {
isShow: false,
alertMessage: ""
});
const [isSubscribed, setIsSubscribed] = useState(false);
const [isCompleted, setIsCompleted] = useState({
isCertificate: false,
isModal: false
@@ -94,7 +95,7 @@ function PdfRequestFiles() {
const [minRequiredCount, setminRequiredCount] = useState();
const [sendInOrder, setSendInOrder] = useState(false);
const [currWidgetsDetails, setCurrWidgetsDetails] = useState({});
const [isSubscribed, setIsSubscribed] = useState(false);
const [isSubscriptionExpired, setIsSubscriptionExpired] = useState(false);
const [extUserId, setExtUserId] = useState("");
const divRef = useRef(null);
const isMobile = window.innerWidth < 767;
@@ -137,23 +138,24 @@ function PdfRequestFiles() {
async function checkIsSubscribed() {
const res = await fetchSubscription();
const freeplan = res.plan;
const plan = res.plan;
const billingDate = res.billingDate;
if (freeplan === "freeplan") {
if (plan === "freeplan") {
return true;
} else if (billingDate) {
if (new Date(billingDate) > new Date()) {
setIsSubscribed(true);
return true;
} else {
if (location.pathname.includes("/load/")) {
setIsSubscribed(true);
setIsSubscriptionExpired(true);
} else {
navigate(`/subscription`);
}
}
} else {
if (location.pathname.includes("/load/")) {
setIsSubscribed(true);
setIsSubscriptionExpired(true);
} else {
navigate(`/subscription`);
}
@@ -977,10 +979,10 @@ function PdfRequestFiles() {
return (
<DndProvider backend={HTML5Backend}>
<Title title={"Request Sign"} />
{isSubscribed ? (
{isSubscriptionExpired ? (
<ModalUi
title={"Subscription Expired"}
isOpen={isSubscribed}
isOpen={isSubscriptionExpired}
showClose={false}
>
<div className="flex flex-col justify-center items-center py-4 md:py-5 gap-5">
+36 -33
View File
@@ -56,39 +56,6 @@ const Report = () => {
// setIsLoader(true);
const json = reportJson(id);
if (json) {
if (id === "6TeaPr321t") {
const tourConfig = [
{
selector: "[data-tut=reactourFirst]",
content: () => (
<TourContentWithBtn
message={
"Click the Add button to create a new template. Templates are reusable documents designed to quickly generate new documents with the same structure and varying signers. For example, an HR template for onboarding could have predefined roles like HR Manager and New Employee. Each time you use the template, you can assign the New Employee role to different incoming staff members, while the HR Manager role remains constant, facilitating a seamless onboarding process for each recruit."
}
isChecked={handleDontShow}
/>
),
position: "top",
style: { fontSize: "13px" }
}
];
json.actions.map((data) => {
const newConfig = {
selector: `[data-tut="${data?.selector}"]`,
content: () => (
<TourContentWithBtn
message={data?.message}
isChecked={handleDontShow}
/>
),
position: "top",
style: { fontSize: "13px" }
};
tourConfig.push(newConfig);
});
setTourData(tourConfig);
}
setActions(json.actions);
setHeading(json.heading);
setReportName(json.reportName);
@@ -108,6 +75,42 @@ const Report = () => {
headers: headers,
signal: abortController.signal // is used to cancel fetch query
});
if (id === "6TeaPr321t") {
const tourConfig = [
{
selector: "[data-tut=reactourFirst]",
content: () => (
<TourContentWithBtn
message={
"Click the Add button to create a new template. Templates are reusable documents designed to quickly generate new documents with the same structure and varying signers. For example, an HR template for onboarding could have predefined roles like HR Manager and New Employee. Each time you use the template, you can assign the New Employee role to different incoming staff members, while the HR Manager role remains constant, facilitating a seamless onboarding process for each recruit."
}
isChecked={handleDontShow}
/>
),
position: "top",
style: { fontSize: "13px" }
}
];
if (res.data.result && res.data.result?.length > 0) {
json.actions.map((data) => {
const newConfig = {
selector: `[data-tut="${data?.selector}"]`,
content: () => (
<TourContentWithBtn
message={data?.message}
isChecked={handleDontShow}
/>
),
position: "top",
style: { fontSize: "13px" }
};
tourConfig.push(newConfig);
});
}
setTourData(tourConfig);
}
if (id === "4Hhwbp482K") {
const listData = res.data?.result.filter((x) => x.Signers.length > 0);
let arr = [];
@@ -1,4 +1,4 @@
import React, { useState, useEffect, useMemo } from "react";
import React, { useState, useEffect, useMemo } from "react";
import pad from "../assets/images/pad.svg";
import { useNavigate } from "react-router-dom";
import axios from "axios";
@@ -8,6 +8,8 @@ import { modalSubmitBtnColor, modalCancelBtnColor } from "../constant/const";
import Alert from "./Alert";
import Tooltip from "./Tooltip";
import { RWebShare } from "react-web-share";
import Tour from "reactour";
import Parse from "parse";
const ReportTable = ({
ReportName,
@@ -19,7 +21,9 @@ const ReportTable = ({
isMoreDocs,
docPerPage,
form,
report_help
report_help,
tourData,
isDontShow
}) => {
const navigate = useNavigate();
const [currentPage, setCurrentPage] = useState(1);
@@ -33,6 +37,8 @@ const ReportTable = ({
const [shareUrls, setShareUrls] = useState([]);
const [copied, setCopied] = useState(false);
const [alertMsg, setAlertMsg] = useState({ type: "success", message: "" });
const [isTour, setIsTour] = useState(false);
const [tourStatusArr, setTourStatusArr] = useState([]);
const startIndex = (currentPage - 1) * docPerPage;
// For loop is used to calculate page numbers visible below table
@@ -46,6 +52,7 @@ const ReportTable = ({
}, [List, docPerPage]);
// below useEffect reset currenpage to 1 if user change route
useEffect(() => {
checkTourStatus();
return () => setCurrentPage(1);
}, []);
@@ -350,6 +357,80 @@ const ReportTable = ({
setActLoader({});
});
};
async function checkTourStatus() {
const currentUser = Parse.User.current();
const cloudRes = await Parse.Cloud.run("getUserDetails", {
email: currentUser.get("email")
});
const res = { data: cloudRes.toJSON() };
if (res.data && res.data.TourStatus && res.data.TourStatus.length > 0) {
const tourStatus = res.data.TourStatus;
// console.log("res ", res.data.TourStatus);
setTourStatusArr(tourStatus);
const filteredtourStatus = tourStatus.filter(
(obj) => obj["templateReportTour"]
);
if (filteredtourStatus.length > 0) {
const templateReportTour = filteredtourStatus[0]["templateReportTour"];
if (templateReportTour) {
setIsTour(false);
} else {
setIsTour(true);
}
} else {
setIsTour(true);
}
} else {
setIsTour(true);
}
}
const closeTour = async () => {
// console.log("closeTour");
setIsTour(false);
if (isDontShow) {
const serverUrl = localStorage.getItem("baseUrl");
const appId = localStorage.getItem("parseAppId");
const extUserClass = localStorage.getItem("extended_class");
const json = JSON.parse(localStorage.getItem("Extand_Class"));
const extUserId = json && json.length > 0 && json[0].objectId;
// console.log("extUserId ", extUserId)
let updatedTourStatus = [];
if (tourStatusArr.length > 0) {
updatedTourStatus = [...tourStatusArr];
const templateReportTourIndex = tourStatusArr.findIndex(
(obj) =>
obj["templateReportTour"] === false ||
obj["templateReportTour"] === true
);
if (templateReportTourIndex !== -1) {
updatedTourStatus[templateReportTourIndex] = {
templateReportTour: true
};
} else {
updatedTourStatus.push({ templateReportTour: true });
}
} else {
updatedTourStatus = [{ templateReportTour: true }];
}
await axios.put(
serverUrl + "classes/" + extUserClass + "/" + extUserId,
{
TourStatus: updatedTourStatus
},
{
headers: {
"X-Parse-Application-Id": appId
}
}
);
}
};
return (
<div className="relative">
{Object.keys(actLoader)?.length > 0 && (
@@ -362,6 +443,15 @@ const ReportTable = ({
)}
<div className="p-2 overflow-x-scroll w-full bg-white rounded-md">
{isAlert && <Alert type={alertMsg.type}>{alertMsg.message}</Alert>}
{tourData && ReportName === "Templates" && (
<Tour
onRequestClose={closeTour}
steps={tourData}
isOpen={isTour}
// rounded={5}
closeWithMask={false}
/>
)}
<div className="flex flex-row items-center justify-between my-2 mx-3 text-[20px] md:text-[23px]">
<div className="font-light">
{ReportName}{" "}
@@ -373,6 +463,7 @@ const ReportTable = ({
</div>
{ReportName === "Templates" && (
<i
data-tut="reactourFirst"
onClick={() => navigate("/form/template")}
className="fa-solid fa-square-plus text-sky-400 text-[25px]"
></i>
@@ -504,6 +595,7 @@ const ReportTable = ({
{actions?.length > 0 &&
actions.map((act, index) => (
<button
data-tut={act?.selector}
key={index}
onClick={() => handleActionBtn(act, item)}
className={`w-[25px] h-[25px] flex justify-center items-center rounded shadow`}