🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
security improvement
prafull-opensignlabs03e660527df5
diff --git a/apps/OpenSign/src/components/LoginFacebook.js b/apps/OpenSign/src/components/LoginFacebook.jsindex 1aeef2c73..1dd0297a4 100644--- a/apps/OpenSign/src/components/LoginFacebook.js+++ b/apps/OpenSign/src/components/LoginFacebook.js@@ -213,6 +213,7 @@ const LoginFacebook = ({type="button"onClick={() => handleSubmitbtn()}className="btn btn-info"+ style={{ marginRight: 10 }}>Sign up</button>@@ -220,7 +221,7 @@ const LoginFacebook = ({type="button"className="btn btn-secondary"onClick={() => setIsModal(false)}- style={{ marginRight: 10, width: 90 }}+ style={{ width: 90 }}>Cancel</button>diff --git a/apps/OpenSign/src/components/LoginGoogle.js b/apps/OpenSign/src/components/LoginGoogle.jsindex 1038b21bb..4e464d11c 100644--- a/apps/OpenSign/src/components/LoginGoogle.js+++ b/apps/OpenSign/src/components/LoginGoogle.js@@ -287,7 +287,7 @@ const GoogleSignInBtn = ({<div><buttontype="button"- className="bg-[#17a2b8] p-2 text-white rounded"+ className="bg-[#17a2b8] p-2 text-white rounded mr-2"onClick={() => handleSubmitbtn()}>Sign up@@ -296,7 +296,7 @@ const GoogleSignInBtn = ({type="button"className="bg-[#6c757d] p-2 text-white rounded"onClick={handleCloseModal}- style={{ marginRight: 10, width: 90 }}+ style={{ width: 90 }}>Cancel</button>diff --git a/apps/OpenSign/src/components/dashboard/DashboardCard.js b/apps/OpenSign/src/components/dashboard/DashboardCard.jsindex 0c432c4e1..08d2a8904 100644--- a/apps/OpenSign/src/components/dashboard/DashboardCard.js+++ b/apps/OpenSign/src/components/dashboard/DashboardCard.js@@ -1,7 +1,6 @@import React, { useState, useEffect } from "react";import axios from "axios";import Parse from "parse";-import onSearchFilter from "../../constant/searchQuery";import getReplacedHashQuery from "../../constant/getReplacedHashQuery";import "../../styles/loader.css";import { useNavigate } from "react-router-dom";@@ -45,12 +44,7 @@ const DashboardCard = (props) => {var reg = /(\#.*?\#)/gi; // eslint-disable-linevar str = props.Data.query;var test = "";- if (str.includes("#filterCondition#")) {- str = str.replace(- "#filterCondition#",- onSearchFilter(props.DefaultQuery)- );- }+if (props.Data.extendkey) {let a = props.Data.extendkey.split(".");if (a.length > 0) {@@ -105,13 +99,6 @@ const DashboardCard = (props) => {let data = JSON.parse(localStorage.getItem("Extand_Class"));resr = data[0];} else {- // let emp = Parse.Object.extend(- // localStorage.getItem("extended_class")- // );- // let q = new Parse.Query(emp);- // q.equalTo("UserId", currentUser);- // let t = await q.first();- // resr = t.toJSON();resr = await Parse.Cloud.run("getUserDetails", {email: currentUser.get("email")});@@ -149,47 +136,65 @@ const DashboardCard = (props) => {"X-Parse-Application-Id": parseAppId,"X-Parse-Session-Token": localStorage.getItem("accesstoken")};- await axios.get(url, { headers: headers }).then((res) => {- if (res.data.results.length > 0) {- setLoading(false);- if (props.Data.key !== "count") {- setresponse(res.data.results[0][props.Data.key]);- } else {- if (props.Label === "Need your Signature") {- const listData = res.data?.results.filter(- (x) => x.Signers.length > 0+ // handle need your sign report count+ if (props.Data.Redirect_id === "4Hhwbp482K") {+ const params = {+ reportId: props.Data.Redirect_id,+ skip: 0,+ limit: 200+ };+ const url = `${parseBaseUrl}/functions/getReport`;+ await axios+ .post(url, params, {+ headers: {+ "Content-Type": "application/json",+ "X-Parse-Application-Id": parseAppId,+ sessiontoken: localStorage.getItem("accesstoken")+ }+ })+ .then((res) => {+ const listData = res.data?.result.filter(+ (x) => x.Signers.length > 0+ );+ let arr = [];+ for (const obj of listData) {+ const isSigner = obj.Signers.some(+ (item) => item.UserId.objectId === currentUser.id);- let arr = [];- for (const obj of listData) {- const isSigner = obj.Signers.some(- (item) => item.UserId.objectId === currentUser.id- );- if (isSigner) {- let isRecord;- if (obj?.AuditTrail && obj?.AuditTrail.length > 0) {- isRecord = obj?.AuditTrail.some(- (item) =>- item?.UserPtr?.UserId?.objectId === currentUser.id &&- item.Activity === "Signed"- );- } else {- isRecord = false;- }- if (isRecord === false) {- arr.push(obj);- }+ if (isSigner) {+ let isRecord;+ if (obj?.AuditTrail && obj?.AuditTrail.length > 0) {+ isRecord = obj?.AuditTrail.some(+ (item) =>+ item?.UserPtr?.UserId?.objectId === currentUser.id &&+ item.Activity === "Signed"+ );+ } else {+ isRecord = false;+ }+ if (isRecord === false) {+ arr.push(obj);}}- setresponse(arr.length);+ }+ setresponse(arr.length);+ setLoading(false);+ });+ } else {+ await axios.get(url, { headers: headers }).then((res) => {+ if (res.data.results.length > 0) {+ setLoading(false);+ if (props.Data.key !== "count") {+ setresponse(res.data.results[0][props.Data.key]);} else {setresponse(res.data[props.Data.key]);}+ } else {+ setresponse(0);+ setLoading(false);}- } else {- setresponse(0);- setLoading(false);- }- });+ });+ }} catch (e) {console.error("Problem", e);setLoading(false);@@ -226,13 +231,6 @@ const DashboardCard = (props) => {let data = JSON.parse(localStorage.getItem("Extand_Class"));res = data[0];} else {- // var emp = Parse.Object.extend(- // localStorage.getItem("extended_class")- // );- // var q = new Parse.Query(emp);- // q.equalTo("UserId", currentUser);- // let resr = await q.first();- // res = resr.toJSON();let resr = await Parse.Cloud.run("getUserDetails", {email: currentUser.get("email")});diff --git a/apps/OpenSign/src/components/dashboard/DashboardReport.js b/apps/OpenSign/src/components/dashboard/DashboardReport.jsindex 4a0575f14..985d55c28 100644--- a/apps/OpenSign/src/components/dashboard/DashboardReport.js+++ b/apps/OpenSign/src/components/dashboard/DashboardReport.js@@ -9,39 +9,58 @@ function DashboardReport(props) {const [isLoader, setIsLoader] = useState(true);const [reportName, setReportName] = useState("");const [actions, setActions] = useState([]);+ const [isNextRecord, setIsNextRecord] = useState(false);+ const [isMoreDocs, setIsMoreDocs] = useState(true);+ const abortController = new AbortController();+ const docPerPage = 5;+useEffect(() => {setReportName("");getReportData(props.Record.reportId);++ // Function returned from useEffect is called on unmount+ return () => {+ setIsLoader(true);+ setList([]);+ setIsNextRecord(false);+ // Here it'll abort the fetch+ abortController.abort();+ };+ // eslint-disable-next-line}, [props.Record.reportId]);- const getReportData = async (id) => {+ // below useEffect call when isNextRecord state is true and fetch next record+ useEffect(() => {+ if (isNextRecord) {+ getReportData(props.Record.reportId, List.length, 200);+ }+ // eslint-disable-next-line+ }, [isNextRecord]);++ const getReportData = async (id, skipUserRecord = 0, limit = 200) => {setIsLoader(true);const json = reportJson(id);if (json) {setActions(json.actions);setReportName(json.reportName);- const { className, params, keys, orderBy } = json;Parse.serverURL = localStorage.getItem("BaseUrl12");Parse.initialize(localStorage.getItem("AppID12"));- const serverURL =- localStorage.getItem("BaseUrl12") + "classes/" + className;+ const currentUser = Parse.User.current().id;- const strParams = JSON.stringify(params);- const strKeys = keys.join();const headers = {"Content-Type": "application/json","X-Parse-Application-Id": localStorage.getItem("AppID12"),- "X-Parse-Session-Token": localStorage.getItem("accesstoken")+ sessiontoken: localStorage.getItem("accesstoken")};try {- const url = `${serverURL}?where=${strParams}&keys=${strKeys}&order=${orderBy}&include=AuditTrail.UserPtr`;- const res = await axios.get(url, { headers: headers });- // console.log("res ", res.data?.results);+ const params = { reportId: id, skip: skipUserRecord, limit: limit };+ const url = `${localStorage.getItem("BaseUrl12")}/functions/getReport`;+ const res = await axios.post(url, params, {+ headers: headers,+ signal: abortController.signal // is used to cancel fetch query+ });if (id === "5Go51Q7T8r") {- const currentUser = Parse.User.current().id;- const listData = res.data?.results.filter(- (x) => x.Signers.length > 0- );+ const listData = res.data?.result.filter((x) => x.Signers.length > 0);let arr = [];for (const obj of listData) {const isSigner = obj.Signers.some(@@ -63,14 +82,34 @@ function DashboardReport(props) {}}}- setList(arr);+ if (arr.length === docPerPage) {+ setIsMoreDocs(true);+ } else {+ setIsMoreDocs(false);+ }+ setList((prevRecord) =>+ prevRecord.length > 0 ? [...prevRecord, ...arr] : arr+ );} else {- setList(res.data?.results);+ if (res.data.result.length === docPerPage) {+ setIsMoreDocs(true);+ } else {+ setIsMoreDocs(false);+ }+ setIsNextRecord(false);+ setList((prevRecord) =>+ prevRecord.length > 0+ ? [...prevRecord, ...res.data.result]+ : res.data.result+ );}setIsLoader(false);} catch (err) {- console.log("err ", err);- setIsLoader(false);+ const isCancel = axios.isCancel(err);+ if (!isCancel) {+ console.log("err ", err);+ setIsLoader(false);+ }}} else {setIsLoader(false);@@ -101,8 +140,10 @@ function DashboardReport(props) {<ReportTableReportName={reportName}List={List}- act={"Sign"}actions={actions}+ setIsNextRecord={setIsNextRecord}+ isMoreDocs={isMoreDocs}+ docPerPage={docPerPage}/>) : (<div className="flex items-center justify-center h-[100px] w-full bg-white rounded">diff --git a/apps/OpenSign/src/components/dashboard/GetDashboard.js b/apps/OpenSign/src/components/dashboard/GetDashboard.jsindex 8133f6f59..144505ef9 100644--- a/apps/OpenSign/src/components/dashboard/GetDashboard.js+++ b/apps/OpenSign/src/components/dashboard/GetDashboard.js@@ -1,5 +1,4 @@-import React, { useState, Suspense, lazy } from "react";-import moment from "moment";+import React, { Suspense, lazy } from "react";import ErrorBoundary from "../ErrorBoundary";const DashboardCard = lazy(() => import("./DashboardCard"));@@ -7,258 +6,6 @@ const DashboardCard = lazy(() => import("./DashboardCard"));const DashboardReport = lazy(() => import("./DashboardReport"));const GetDashboard = (props) => {- const [filter, setfilter] = useState("");- const [option, setoption] = useState("");-- const onSearchFilter = (e) => {- let _search = e.target.value;- localStorage.setItem("DashboardDefaultFilter", _search);- switch (_search) {- case "Today": {- let d = new Date();- let formDate = new Date(- Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0)- ).toISOString();- let Todate = new Date(- Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59)- ).toISOString();- let Query = `'$gte':'${formDate}','$lte':'${Todate}'`;- setfilter(Query);- setoption(_search);- break;- }- case "Yesterday": {- let d1 = new Date();- d1.setDate(d1.getDate() - 1);- let yesFrDate = new Date(- Date.UTC(d1.getFullYear(), d1.getMonth(), d1.getDate(), 0, 0, 0)- ).toISOString();-- let YesTodate = new Date(- Date.UTC(d1.getFullYear(), d1.getMonth(), d1.getDate(), 23, 59, 59)- ).toISOString();- let Query1 = `'$gte':'${yesFrDate}','$lte':'${YesTodate}'`;- setfilter(Query1);- setoption(_search);- break;- }- case "This week": {- let oneDay = 24 * 60 * 60 * 1000;- let curr = new Date(); // get current date- let first = curr.getDate() - curr.getDay(); // First day is the day of the month - the day of the week-- let firstday = new Date(- new Date(- Date.UTC(- curr.getFullYear(),- curr.getMonth(),- curr.getDate(),- 0,- 0,- 0- )- ).setDate(first)- ).toISOString();- let diffDays = Math.round(- Math.abs(- (new Date(- Date.UTC(- curr.getFullYear(),- curr.getMonth(),- curr.getDate(),- 23,- 59,- 59- )- ) -- new Date(firstday)) /- oneDay- )- ); //Days since last week- let last = first + diffDays;- let lastday = new Date(- new Date(- Date.UTC(- curr.getFullYear(),- curr.getMonth(),- curr.getDate(),- 23,- 59,- 59- )- ).setDate(last)- ).toISOString();- let Query2 = `'$gte':'${firstday}','$lte':'${lastday}'`;- setfilter(Query2);- setoption(_search);- break;- }- case "Last 7 days": {- let d7 = new Date();- let d7l = new Date();- d7.setDate(d7.getDate() - 7);- let l7t = new Date(- Date.UTC(d7l.getFullYear(), d7l.getMonth(), d7l.getDate(), 23, 59, 59)- ).toISOString();- let date7 = new Date(- Date.UTC(d7.getFullYear(), d7.getMonth(), d7.getDate(), 0, 0, 0)- ).toISOString();- let Query7 = `'$gte':'${date7}','$lte':'${l7t}'`;- setfilter(Query7);- setoption(_search);- break;- }- case "Last 14 days": {- let d14 = new Date();- let d14l = new Date();- let l14t = new Date(- Date.UTC(- d14l.getFullYear(),- d14l.getMonth(),- d14l.getDate(),- 23,- 59,- 59- )- ).toISOString();- d14.setDate(d14.getDate() - 14);- let date14 = new Date(- Date.UTC(d14.getFullYear(), d14.getMonth(), d14.getDate(), 0, 0, 0)- ).toISOString();-- let Query14 = `'$gte':'${date14}','$lte':'${l14t}'`;- setfilter(Query14);- setoption(_search);- break;- }- case "Last 30 days": {- let d30 = new Date();- let d30l = new Date();- let l30t = new Date(- Date.UTC(- d30l.getFullYear(),- d30l.getMonth(),- d30l.getDate(),- 23,- 59,- 59- )- ).toISOString();- d30.setDate(d30.getDate() - 30);- let date30 = new Date(- Date.UTC(d30.getFullYear(), d30.getMonth(), d30.getDate(), 0, 0, 0)- ).toISOString();- let Query30 = `'$gte':'${date30}','$lte':'${l30t}'`;- setfilter(Query30);- setoption(_search);- break;- }- case "Last week": {- const from_date = moment().startOf("week").subtract(7, "days");- const to_date = moment().endOf("week").subtract(7, "days");- let Queryl = `'$gte':'${from_date.toISOString()}','$lte':'${to_date.toISOString()}'`;- setfilter(Queryl);- setoption(_search);- break;- }- case "This month": {- const tdate = new Date();- let tfirstDay = new Date(- tdate.getFullYear(),- tdate.getMonth(),- 1- ).toISOString();- let tlastDay = new Date(- tdate.getFullYear(),- tdate.getMonth() + 1,- 0- ).toISOString();- let Querylt = `'$gte':'${tfirstDay}','$lte':'${tlastDay}'`;- setfilter(Querylt);- setoption(_search);- break;- }- case "Last month": {- const ldate = new Date();- var lfirstDay = new Date(- ldate.getFullYear(),- ldate.getMonth() - 1,- 2- ).toISOString();- var llastDay = new Date(- ldate.getFullYear(),- ldate.getMonth(),- 1- ).toISOString();- let Queryltl = `'$gte':'${lfirstDay}','$lte':'${llastDay}'`;- setfilter(Queryltl);- setoption(_search);- break;- }- case "All": {- let fall = new Date(- new Date().getFullYear() - 100,- 0,- 1,- 0,- 0,- 0- ).toISOString();- let fall_year = `'$gte':'${fall}'`;- setfilter(fall_year);- setoption(_search);- break;- }- case "This year": {- let fcy = new Date(- new Date().getFullYear(),- 0,- 1,- 0,- 0,- 0- ).toISOString();- let lcy = new Date(- new Date().getFullYear(),- 11,- 31,- 23,- 59,- 59- ).toISOString();- let cur_year = `'$gte':'${fcy}','$lte':'${lcy}'`;- setfilter(cur_year);- setoption(_search);- break;- }- case "Last year": {- let fly = new Date(- new Date().getFullYear() - 1,- 0,- 1,- 0,- 0,- 0- ).toISOString();- let lly = new Date(- new Date().getFullYear() - 1,- 11,- 31,- 23,- 59,- 59- ).toISOString();- let last_year = `'$gte':'${fly}','$lte':'${lly}'`;- setfilter(last_year);- setoption(_search);- break;- }- default: {- setoption(_search);- break;- }- }- };const renderSwitchWithTour = (col) => {switch (col.widget.type) {case "Card":@@ -272,7 +19,6 @@ const GetDashboard = (props) => {<DashboardCardIcon={col.widget.icon}Label={col.widget.label}- Filter={filter}Format={col.widget.format && col.widget.format}Data={col.widget.data}FilterData={col.widget.filter}@@ -281,50 +27,12 @@ const GetDashboard = (props) => {</Suspense></div>);- case "customeHtml":- return (- <div data-tut={col.widget.data.tourSection}>- <select- id="searchFiltr"- className="form-control"- value={- option ||- localStorage.getItem("DashboardDefaultFilter") ||- col.widget.data[0].default- }- onChange={onSearchFilter}- >- {col.widget.data[0].options.map((opt) => (- <option key={opt} value={opt}>- {opt}- </option>- ))}- </select>-- <br />- </div>- );-- case "customeTag":- return (- <h3- data-tut={col.widget.data.tourSection}- style={{- marginBottom: "4px",- color: "currentColor",- marginLeft: "4px"- }}- >- {col.widget.label}- </h3>- );case "report": {- let _filter = `${col.widget.filterKey}:${filter}`;return (<div data-tut={col.widget.data.tourSection}><Suspense fallback={<div>please wait</div>}><div className="mb-4 md:mb-0">- <DashboardReport Filter={_filter} Record={col.widget} />+ <DashboardReport Record={col.widget} /></div></Suspense></div>@@ -346,7 +54,6 @@ const GetDashboard = (props) => {<DashboardCardIcon={col.widget.icon}Label={col.widget.label}- Filter={filter}Format={col.widget.format && col.widget.format}Data={col.widget.data}FilterData={col.widget.filter}@@ -355,48 +62,11 @@ const GetDashboard = (props) => {</Suspense></div>);- case "customeHtml":- return (- <div>- <select- id="searchFiltr"- className="form-control"- value={- option ||- localStorage.getItem("DashboardDefaultFilter") ||- col.widget.data[0].default- }- onChange={onSearchFilter}- >- {col.widget.data[0].options.map((opt) => (- <option key={opt} value={opt}>- {opt}- </option>- ))}- </select>-- <br />- </div>- );-- case "customeTag":- return (- <h3- style={{- marginBottom: "4px",- color: "currentColor",- marginLeft: "4px"- }}- >- {col.widget.label}- </h3>- );case "report": {- let _filter = `${col.widget.filterKey}:${filter}`;return (<Suspense fallback={<div>please wait</div>}><div className="mb-4 md:mb-0">- <DashboardReport Filter={_filter} Record={col.widget} />+ <DashboardReport Record={col.widget} /></div></Suspense>);diff --git a/apps/OpenSign/src/constant/searchQuery.js b/apps/OpenSign/src/constant/searchQuery.jsdeleted file mode 100644index d9d5531bf..000000000--- a/apps/OpenSign/src/constant/searchQuery.js+++ /dev/null@@ -1,210 +0,0 @@-import moment from "moment";--export default function onSearchFilter(_search) {- switch (_search) {- case "Today": {- let d = new Date();- let formDate = new Date(- Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0)- ).toISOString();- let Todate = new Date(- Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59)- ).toISOString();- let Query = `'$gte':'${formDate}','$lte':'${Todate}'`;- return Query;- }- case "Yesterday": {- let d1 = new Date();- d1.setDate(d1.getDate() - 1);- let yesFrDate = new Date(- Date.UTC(d1.getFullYear(), d1.getMonth(), d1.getDate(), 0, 0, 0)- ).toISOString();-- let YesTodate = new Date(- Date.UTC(d1.getFullYear(), d1.getMonth(), d1.getDate(), 23, 59, 59)- ).toISOString();- let Query1 = `'$gte':'${yesFrDate}','$lte':'${YesTodate}'`;- return Query1;- }-- case "This week": {- let oneDay = 24 * 60 * 60 * 1000;- let curr = new Date(); // get current date- let first = curr.getDate() - curr.getDay(); // First day is the day of the month - the day of the week-- let firstday = new Date(- new Date(- Date.UTC(curr.getFullYear(), curr.getMonth(), curr.getDate(), 0, 0, 0)- ).setDate(first)- ).toISOString();- let diffDays = Math.round(- Math.abs(- (new Date(- Date.UTC(- curr.getFullYear(),- curr.getMonth(),- curr.getDate(),- 23,- 59,- 59- )- ) -- new Date(firstday)) /- oneDay- )- ); //Days since last week- let last = first + diffDays;- let lastday = new Date(- new Date(- Date.UTC(- curr.getFullYear(),- curr.getMonth(),- curr.getDate(),- 23,- 59,- 59- )- ).setDate(last)- ).toISOString();- let Query2 = `'$gte':'${firstday}','$lte':'${lastday}'`;- return Query2;- }-- case "Last 7 days": {- let d7 = new Date();- let d7l = new Date();- d7.setDate(d7.getDate() - 7);- let l7t = new Date(- Date.UTC(d7l.getFullYear(), d7l.getMonth(), d7l.getDate(), 23, 59, 59)- ).toISOString();- let date7 = new Date(- Date.UTC(d7.getFullYear(), d7.getMonth(), d7.getDate(), 0, 0, 0)- ).toISOString();- let Query7 = `'$gte':'${date7}','$lte':'${l7t}'`;- return Query7;- }- case "Last 14 days": {- let d14 = new Date();- let d14l = new Date();- let l14t = new Date(- Date.UTC(- d14l.getFullYear(),- d14l.getMonth(),- d14l.getDate(),- 23,- 59,- 59- )- ).toISOString();- d14.setDate(d14.getDate() - 14);- let date14 = new Date(- Date.UTC(d14.getFullYear(), d14.getMonth(), d14.getDate(), 0, 0, 0)- ).toISOString();-- let Query14 = `'$gte':'${date14}','$lte':'${l14t}'`;- return Query14;- }-- case "Last 30 days": {- let d30 = new Date();- let d30l = new Date();- let l30t = new Date(- Date.UTC(- d30l.getFullYear(),- d30l.getMonth(),- d30l.getDate(),- 23,- 59,- 59- )- ).toISOString();- d30.setDate(d30.getDate() - 30);- let date30 = new Date(- Date.UTC(d30.getFullYear(), d30.getMonth(), d30.getDate(), 0, 0, 0)- ).toISOString();- return `'$gte':'${date30}','$lte':'${l30t}'`;- }- case "Last week": {- const from_date = moment().startOf("week").subtract(7, "days");- const to_date = moment().endOf("week").subtract(7, "days");- return `'$gte':'${from_date.toISOString()}','$lte':'${to_date.toISOString()}'`;- }- case "This month": {- var tdate = new Date();- var tfirstDay = new Date(- tdate.getFullYear(),- tdate.getMonth(),- 1- ).toISOString();- var tlastDay = new Date(- tdate.getFullYear(),- tdate.getMonth() + 1,- 0- ).toISOString();- let Querylt = `'$gte':'${tfirstDay}','$lte':'${tlastDay}'`;- return Querylt;- }- case "Last month": {- var ldate = new Date();- var lfirstDay = new Date(- ldate.getFullYear(),- ldate.getMonth() - 1,- 2- ).toISOString();- var llastDay = new Date(- ldate.getFullYear(),- ldate.getMonth(),- 1- ).toISOString();- let Queryltl = `'$gte':'${lfirstDay}','$lte':'${llastDay}'`;- return Queryltl;- }- case "All": {- let fall = new Date(- new Date().getFullYear() - 100,- 0,- 1,- 0,- 0,- 0- ).toISOString();- let fall_year = `'$gte':'${fall}'`;- return fall_year;- }- case "This year": {- let fcy = new Date(new Date().getFullYear(), 0, 1, 0, 0, 0).toISOString();- let lcy = new Date(- new Date().getFullYear(),- 11,- 31,- 23,- 59,- 59- ).toISOString();- let cur_year = `'$gte':'${fcy}','$lte':'${lcy}'`;- return cur_year;- }- case "Last year": {- let fly = new Date(- new Date().getFullYear() - 1,- 0,- 1,- 0,- 0,- 0- ).toISOString();- let lly = new Date(- new Date().getFullYear() - 1,- 11,- 31,- 23,- 59,- 59- ).toISOString();- let last_year = `'$gte':'${fly}','$lte':'${lly}'`;- return last_year;- }- default:- return "";- }-}diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.jsindex 960559938..364b0af2d 100644--- a/apps/OpenSign/src/json/ReportJson.js+++ b/apps/OpenSign/src/json/ReportJson.js@@ -1,6 +1,4 @@-import Parse from "parse";export default function reportJson(id) {- const currentUserId = Parse.User.current().id;// console.log("json ", json);switch (id) {@@ -8,28 +6,6 @@ export default function reportJson(id) {case "ByHuevtCFY":return {reportName: "Draft Documents",- className: "contracts_Document",- params: {- Type: null,- $or: [- { Signers: null, SignedUrl: null },- { Signers: { $exists: true }, Placeholders: null }- ],- CreatedBy: {- __type: "Pointer",- className: "_User",- objectId: currentUserId- }- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name"- ],- orderBy: "-updatedAt",actions: [{btnLabel: "sign",@@ -45,27 +21,6 @@ export default function reportJson(id) {case "4Hhwbp482K":return {reportName: "Need your sign",- className: "contracts_Document",- params: {- Type: { $ne: "Folder" },- IsCompleted: { $ne: true },- IsDeclined: { $ne: true },- ExpiryDate: {- $gt: { __type: "Date", iso: new Date().toISOString() }- },- Placeholders: { $ne: null }- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name",- "Signers.UserId",- "AuditTrail"- ],- orderBy: "-updatedAt",actions: [{btnLabel: "sign",@@ -81,31 +36,6 @@ export default function reportJson(id) {case "1MwEuxLEkF":return {reportName: "In-progress documents",- className: "contracts_Document",- params: {- Type: { $ne: "Folder" },- Signers: { $ne: null },- Placeholders: { $ne: null },- IsCompleted: { $ne: true },- IsDeclined: { $ne: true },- CreatedBy: {- __type: "Pointer",- className: "_User",- objectId: currentUserId- },- ExpiryDate: {- $gt: { __type: "Date", iso: new Date().toISOString() }- }- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name"- ],- orderBy: "-updatedAt",actions: [{btnLabel: "View",@@ -121,27 +51,6 @@ export default function reportJson(id) {case "kQUoW4hUXz":return {reportName: "Completed Documents",- className: "contracts_Document",- params: {- Type: null,- IsCompleted: true,- CreatedBy: {- __type: "Pointer",- className: "_User",- objectId: currentUserId- },- IsDeclined: { $ne: true }- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name",- "TimeToCompleteDays"- ],- orderBy: "-updatedAt",actions: [{btnLabel: "View",@@ -153,63 +62,10 @@ export default function reportJson(id) {}]};- // OpenSignDriveâ„¢ documents Drafts- case "VRFDmUmw5B":- return {- reportName: "OpenSignDriveâ„¢ Drafts",- className: "contracts_Document",- params: {- Type: "AIDoc",- $or: [- { Signers: null, SignedUrl: null },- { Signers: { $exists: true }, Placeholders: null }- ],- CreatedBy: {- __type: "Pointer",- className: "_User",- objectId: currentUserId- }- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name"- ],- orderBy: "-updatedAt",- actions: [- {- btnLabel: "edit",- btnColor: "#3ac9d6",- textColor: "white",- btnIcon: "fa fa-plus",- redirectUrl:- "remoteUrl=aHR0cHM6Ly9xaWstYWktb3JnLmdpdGh1Yi5pby9MZWdhR2VuaWUtTWljcm9hcHBWMi9yZW1vdGVFbnRyeS5qcw==&moduleToLoad=AppRoutes&remoteName=legageniemicroapp/legagenie"- }- ]- };// declined documents reportcase "UPr2Fm5WY3":return {reportName: "Declined Documents",- className: "contracts_Document",- params: { Type: null, IsDeclined: true },- CreatedBy: {- __type: "Pointer",- className: "_User",- objectId: currentUserId- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name"- ],- orderBy: "-updatedAt",actions: [{btnLabel: "View",@@ -225,39 +81,6 @@ export default function reportJson(id) {case "zNqBHXHsYH":return {reportName: "Expired Documents",- className: "contracts_Document",- params: {- IsCompleted: { $ne: true },- IsDeclined: { $ne: true },- Type: { $ne: "Folder" },- $and: [- {- $or: [- { Signers: { $ne: null }, SignedUrl: { $ne: null } },- { Placeholders: { $ne: null } }- ]- },- {- ExpiryDate: {- $lt: { __type: "Date", iso: new Date().toISOString() }- }- }- ],- CreatedBy: {- __type: "Pointer",- className: "_User",- objectId: currentUserId- }- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name"- ],- orderBy: "-updatedAt",actions: [{btnLabel: "View",@@ -273,31 +96,6 @@ export default function reportJson(id) {case "d9k3UfYHBc":return {reportName: "Recently sent for signatures",- className: "contracts_Document",- params: {- Type: { $ne: "Folder" },- Signers: { $ne: null },- Placeholders: { $ne: null },- IsCompleted: { $ne: true },- IsDeclined: { $ne: true },- CreatedBy: {- __type: "Pointer",- className: "_User",- objectId: currentUserId- },- ExpiryDate: {- $gt: { __type: "Date", iso: new Date().toISOString() }- }- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name"- ],- orderBy: "-updatedAt",actions: [{btnLabel: "View",@@ -313,27 +111,6 @@ export default function reportJson(id) {case "5Go51Q7T8r":return {reportName: "Recent signature requests",- className: "contracts_Document",- params: {- Type: { $ne: "Folder" },- IsCompleted: { $ne: true },- IsDeclined: { $ne: true },- ExpiryDate: {- $gt: { __type: "Date", iso: new Date().toISOString() }- },- Placeholders: { $ne: null }- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name",- "Signers.UserId",- "AuditTrail"- ],- orderBy: "-updatedAt",actions: [{btnLabel: "Sign",@@ -349,28 +126,6 @@ export default function reportJson(id) {case "kC5mfynCi4":return {reportName: "Drafts",- className: "contracts_Document",- params: {- Type: null,- $or: [- { Signers: null, SignedUrl: null },- { Signers: { $exists: true }, Placeholders: null }- ],- CreatedBy: {- __type: "Pointer",- className: "_User",- objectId: currentUserId- }- },- keys: [- "Name",- "Note",- "Folder.Name",- "URL",- "ExtUserPtr.Name",- "Signers.Name"- ],- orderBy: "-updatedAt",actions: [{btnLabel: "sign",diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.jsindex 4bf02a818..676230a25 100644--- a/apps/OpenSign/src/primitives/GetReportDisplay.js+++ b/apps/OpenSign/src/primitives/GetReportDisplay.js@@ -7,11 +7,11 @@ const ReportTable = ({List,actions,setIsNextRecord,- isMoreDocs+ isMoreDocs,+ docPerPage}) => {const navigate = useNavigate();const [currentPage, setCurrentPage] = useState(1);- const docPerPage = 10;// const pageNumbers = [];// For loop is used to calculate page numbers visible below table@@ -22,7 +22,7 @@ const ReportTable = ({calculatedPageNumbers.push(i);}return calculatedPageNumbers;- }, [List]);+ }, [List, docPerPage]);// below useEffect reset currenpage to 1 if user change routeuseEffect(() => {return () => setCurrentPage(1);@@ -154,7 +154,7 @@ const ReportTable = ({</tbody></table><div className="flex flex-wrap items-center gap-2 p-2 ">- {List.length > 10 && (+ {List.length > docPerPage && (<>{currentPage > 1 && (<button@@ -178,7 +178,7 @@ const ReportTable = ({{isMoreDocs && (<button className="text-black rounded px-1 py-2">...</button>)}- {List.length > 10 && (+ {List.length > docPerPage && (<>{pageNumbers.includes(currentPage + 1) && (<buttondiff --git a/apps/OpenSign/src/routes/Report.js b/apps/OpenSign/src/routes/Report.jsindex 44ecb74ff..c1e8d7689 100644--- a/apps/OpenSign/src/routes/Report.js+++ b/apps/OpenSign/src/routes/Report.js@@ -15,6 +15,7 @@ const Report = () => {const [isNextRecord, setIsNextRecord] = useState(false);const [isMoreDocs, setIsMoreDocs] = useState(true);const abortController = new AbortController();+ const docPerPage = 10;// below useEffect is call when id param changeuseEffect(() => {@@ -86,7 +87,7 @@ const Report = () => {}}}- if (arr.length === 10) {+ if (arr.length === docPerPage) {setIsMoreDocs(true);} else {setIsMoreDocs(false);@@ -95,9 +96,8 @@ const Report = () => {prevRecord.length > 0 ? [...prevRecord, ...arr] : arr);} else {- if (res.data.result.length === 10) {+ if (res.data.result.length === docPerPage) {setIsMoreDocs(true);- console.log("here");} else {setIsMoreDocs(false);}@@ -149,6 +149,7 @@ const Report = () => {actions={actions}setIsNextRecord={setIsNextRecord}isMoreDocs={isMoreDocs}+ docPerPage={docPerPage}/>) : (<div className="flex items-center justify-center h-screen w-full bg-white rounded">diff --git a/apps/OpenSign/src/routes/UserProfile.js b/apps/OpenSign/src/routes/UserProfile.jsindex f252f3644..ea450c94f 100644--- a/apps/OpenSign/src/routes/UserProfile.js+++ b/apps/OpenSign/src/routes/UserProfile.js@@ -5,7 +5,7 @@ import { SaveFileSize } from "../constant/saveFileSize";import dp from "../assets/images/dp.png";import Title from "../components/Title";import sanitizeFileName from "../primitives/sanitizeFileName";-+import axios from "axios";function UserProfile() {const navigate = useNavigate();let UserProfile = JSON.parse(localStorage.getItem("UserInformation"));@@ -64,18 +64,24 @@ function UserProfile() {const extClass = localStorage.getItem("extended_class");const extData = JSON.parse(localStorage.getItem("Extand_Class"));const ExtUserId = extData[0].objectId;- // console.log("extData ", extData);// console.log("UserId ", ExtUserId);+ const body = { Phone: obj.Phone, Name: obj.Name };+ await axios.put(+ parseBaseUrl + "classes/" + extClass + "/" + ExtUserId,+ body,+ {+ headers: {+ "Content-Type": "application/json",+ "X-Parse-Application-Id": parseAppId,+ "X-Parse-Session-Token": localStorage.getItem("accesstoken")+ }+ }+ );+ const res = await Parse.Cloud.run("getUserDetails", {+ email: extData[0].Email+ });- const extQuery = new Parse.Query(extClass);- const update = await extQuery.get(ExtUserId);- // console.log("update ", update);-- update.set("Phone", obj.Phone);- update.set("Name", obj.Name);- const updateRes = await update.save();-- const json = JSON.parse(JSON.stringify([updateRes]));+ const json = JSON.parse(JSON.stringify([res]));const extRes = JSON.stringify(json);localStorage.setItem("Extand_Class", extRes);@@ -154,6 +160,7 @@ function UserProfile() {<inputtype="file"className="max-w-[270px] text-sm py-1 px-2 mt-4 border-[1px] border-[#15b4e9] text-black rounded"+ accept="image/png, image/gif, image/jpeg"onChange={(e) => {let files = e.target.files;fileUpload(files[0]);