Skip to content

Commit 6b3abed

Browse files
fix:template report tour messsage
1 parent f163958 commit 6b3abed

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed

apps/OpenSign/src/json/ReportJson.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ export default function reportJson(id) {
320320
textColor: "white",
321321
btnIcon: "fa fa-plus",
322322
redirectUrl: "placeHolderSign",
323-
action: "redirect"
323+
action: "redirect",
324+
selector: "reactourSecond",
325+
message:
326+
"Click the 'Use' button to create a new document from an existing template."
324327
},
325328
{
326329
btnId: "2234",
@@ -329,6 +332,9 @@ export default function reportJson(id) {
329332
textColor: "black",
330333
btnIcon: "fa-solid fa-ellipsis-vertical fa-lg",
331334
action: "option",
335+
selector: "reactourThird",
336+
message:
337+
"Onclick option button you can see 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 won’t affect existing documents.Use the Delete button you can delete template",
332338
subaction: [
333339
{
334340
btnId: "2434",

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { modalSubmitBtnColor, modalCancelBtnColor } from "../constant/const";
88
import Alert from "./Alert";
99
import Tooltip from "./Tooltip";
1010
import { RWebShare } from "react-web-share";
11+
import Tour from "reactour";
12+
import Parse from "parse";
1113

1214
const ReportTable = (props) => {
1315
const navigate = useNavigate();
@@ -23,6 +25,8 @@ const ReportTable = (props) => {
2325
const [copied, setCopied] = useState(false);
2426
const [isOption, setIsOption] = useState({});
2527
const [alertMsg, setAlertMsg] = useState({ type: "success", message: "" });
28+
const [isTour, setIsTour] = useState(false);
29+
const [tourStatusArr, setTourStatusArr] = useState([]);
2630
const startIndex = (currentPage - 1) * props.docPerPage;
2731
const { isMoreDocs, setIsNextRecord } = props;
2832
// For loop is used to calculate page numbers visible below table
@@ -36,6 +40,7 @@ const ReportTable = (props) => {
3640
}, [props.List, props.docPerPage]);
3741
// below useEffect reset currenpage to 1 if user change route
3842
useEffect(() => {
43+
checkTourStatus();
3944
return () => setCurrentPage(1);
4045
}, []);
4146

@@ -346,6 +351,75 @@ const ReportTable = (props) => {
346351
setActLoader({});
347352
});
348353
};
354+
355+
async function checkTourStatus() {
356+
const currentUser = Parse.User.current();
357+
const cloudRes = await Parse.Cloud.run("getUserDetails", {
358+
email: currentUser.get("email")
359+
});
360+
const res = { data: cloudRes.toJSON() };
361+
if (res.data && res.data.TourStatus && res.data.TourStatus.length > 0) {
362+
const tourStatus = res.data.TourStatus;
363+
// console.log("res ", res.data.TourStatus);
364+
setTourStatusArr(tourStatus);
365+
const filteredtourStatus = tourStatus.filter(
366+
(obj) => obj["templateTour"]
367+
);
368+
if (filteredtourStatus.length > 0) {
369+
const templateTour = filteredtourStatus[0]["templateTour"];
370+
371+
if (templateTour) {
372+
setIsTour(false);
373+
} else {
374+
setIsTour(true);
375+
}
376+
} else {
377+
setIsTour(true);
378+
}
379+
} else {
380+
setIsTour(true);
381+
}
382+
}
383+
384+
const closeTour = async () => {
385+
// console.log("closeTour");
386+
setIsTour(false);
387+
if (props.isDontShow) {
388+
const serverUrl = localStorage.getItem("baseUrl");
389+
const appId = localStorage.getItem("parseAppId");
390+
const extUserClass = localStorage.getItem("extended_class");
391+
const json = JSON.parse(localStorage.getItem("Extand_Class"));
392+
const extUserId = json && json.length > 0 && json[0].objectId;
393+
// console.log("extUserId ", extUserId)
394+
395+
let updatedTourStatus = [];
396+
if (tourStatusArr.length > 0) {
397+
updatedTourStatus = [...tourStatusArr];
398+
const templateTourIndex = tourStatusArr.findIndex(
399+
(obj) => obj["templateTour"] === false || obj["templateTour"] === true
400+
);
401+
if (templateTourIndex !== -1) {
402+
updatedTourStatus[templateTourIndex] = { templateTour: true };
403+
} else {
404+
updatedTourStatus.push({ templateTour: true });
405+
}
406+
} else {
407+
updatedTourStatus = [{ templateTour: true }];
408+
}
409+
410+
await axios.put(
411+
serverUrl + "classes/" + extUserClass + "/" + extUserId,
412+
{
413+
TourStatus: updatedTourStatus
414+
},
415+
{
416+
headers: {
417+
"X-Parse-Application-Id": appId
418+
}
419+
}
420+
);
421+
}
422+
};
349423
return (
350424
<div className="relative">
351425
{Object.keys(actLoader)?.length > 0 && (
@@ -358,6 +432,15 @@ const ReportTable = (props) => {
358432
)}
359433
<div className="p-2 overflow-x-scroll w-full bg-white rounded-md">
360434
{isAlert && <Alert type={alertMsg.type}>{alertMsg.message}</Alert>}
435+
{props.tourData && props.ReportName === "Templates" && (
436+
<Tour
437+
onRequestClose={closeTour}
438+
steps={props.tourData}
439+
isOpen={isTour}
440+
// rounded={5}
441+
closeWithMask={false}
442+
/>
443+
)}
361444
<div className="flex flex-row items-center justify-between my-2 mx-3 text-[20px] md:text-[23px]">
362445
<div className="font-light">
363446
{props.ReportName}{" "}
@@ -369,6 +452,7 @@ const ReportTable = (props) => {
369452
</div>
370453
{props.ReportName === "Templates" && (
371454
<i
455+
data-tut="reactourFirst"
372456
onClick={() => navigate("/form/template")}
373457
className="fa-solid fa-square-plus text-sky-400 text-[25px]"
374458
></i>
@@ -500,6 +584,7 @@ const ReportTable = (props) => {
500584
{props.actions?.length > 0 &&
501585
props.actions.map((act, index) => (
502586
<button
587+
data-tut={act?.selector}
503588
key={index}
504589
onClick={() => handleActionBtn(act, item)}
505590
className={`${

0 commit comments

Comments
 (0)