From 3a55c35445d3e33a9fcc3ecfa94b07d7fffbbe36 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Fri, 15 Mar 2024 14:25:50 +0530 Subject: [PATCH] =?UTF-8?q?feat:=20add=20create=20document=20btn=20in=20da?= =?UTF-8?q?shboard,=20update=20menu=20&=20change=20Root=20to=20=20Opensign?= =?UTF-8?q?=E2=84=A2=20drive=20in=20folder=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/dashboard/DashboardButton.js | 47 ++ .../src/components/dashboard/GetDashboard.js | 62 +- .../components/pdf/DropdownWidgetOption.js | 2 +- .../components/shared/fields/SelectFolder.js | 12 +- apps/OpenSign/src/layout/HomeLayout.js | 6 + .../20240315095256-change_forms_menu.cjs | 690 ++++++++++++++++++ 6 files changed, 808 insertions(+), 11 deletions(-) create mode 100644 apps/OpenSign/src/components/dashboard/DashboardButton.js create mode 100644 apps/OpenSignServer/databases/migrations/20240315095256-change_forms_menu.cjs diff --git a/apps/OpenSign/src/components/dashboard/DashboardButton.js b/apps/OpenSign/src/components/dashboard/DashboardButton.js new file mode 100644 index 000000000..d1f37ea7e --- /dev/null +++ b/apps/OpenSign/src/components/dashboard/DashboardButton.js @@ -0,0 +1,47 @@ +import React from "react"; +import "../../styles/loader.css"; +import { useNavigate } from "react-router-dom"; +import { openInNewTab } from "../../constant/Utils"; + +const DashboardButton = (props) => { + const navigate = useNavigate(); + + function openReport() { + if (props.Data && props.Data.Redirect_type) { + const Redirect_type = props.Data.Redirect_type; + const id = props.Data.Redirect_id; + if (Redirect_type === "Form") { + navigate(`/form/${id}`); + } else if (Redirect_type === "Report") { + navigate(`/report/${id}`); + } else if (Redirect_type === "Url") { + openInNewTab(id); + } + } + } + return ( +
openReport()} + className={`${ + props.Data && props.Data.Redirect_type + ? "cursor-pointer" + : "cursor-default" + } w-full px-3 py-2 flex text-white rounded-md shadow overflow-hidden`} + > +
+ + + +
+
{props.Label}
+
+
+
+ ); +}; + +export default DashboardButton; diff --git a/apps/OpenSign/src/components/dashboard/GetDashboard.js b/apps/OpenSign/src/components/dashboard/GetDashboard.js index a1e3cd063..5d8ed5989 100644 --- a/apps/OpenSign/src/components/dashboard/GetDashboard.js +++ b/apps/OpenSign/src/components/dashboard/GetDashboard.js @@ -1,14 +1,51 @@ import React, { Suspense, lazy } from "react"; +const DashboardButton = lazy(() => import("./DashboardButton")); const DashboardCard = lazy(() => import("./DashboardCard")); const DashboardReport = lazy(() => import("./DashboardReport")); - +const buttonList = [ + { + label: "Sign yourself", + redirectId: "sHAnZphf69", + redirectType: "Form" + }, + { + label: "Request signature", + redirectId: "8mZzFxbG1z", + redirectType: "Form" + } +]; const GetDashboard = (props) => { + const Button = ({ label, redirectId, redirectType }) => ( +
+ +
+
+ } + > + + + + ); const renderSwitchWithTour = (col) => { switch (col.widget.type) { case "Card": return (
@@ -42,7 +79,7 @@ const GetDashboard = (props) => { return (
please wait
}> -
+
@@ -58,7 +95,7 @@ const GetDashboard = (props) => { case "Card": return (
please wait
}> @@ -76,7 +113,7 @@ const GetDashboard = (props) => { case "report": { return ( please wait
}> -
+
@@ -88,6 +125,21 @@ const GetDashboard = (props) => { }; return (
+
+
+ {buttonList.map((btn) => ( +
+
{props.dashboard.map((val, key) => (
{val.columns.map((col, i) => diff --git a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js index b4d3b1dd6..09abff5d4 100644 --- a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js +++ b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js @@ -377,7 +377,7 @@ function DropdownWidgetOption(props) { />
diff --git a/apps/OpenSign/src/components/shared/fields/SelectFolder.js b/apps/OpenSign/src/components/shared/fields/SelectFolder.js index eb4cac824..138648f03 100644 --- a/apps/OpenSign/src/components/shared/fields/SelectFolder.js +++ b/apps/OpenSign/src/components/shared/fields/SelectFolder.js @@ -93,7 +93,7 @@ const SelectFolder = ({ required, onSuccess, folderCls, isReset }) => { // `handleSubmit` is used to pass folderPtr to parent component const handleSubmit = () => { - let url = "Root"; + let url = "OpenSign™ Drive"; tabList.forEach((t) => { url = url + " / " + t.Name; }); @@ -180,7 +180,9 @@ const SelectFolder = ({ required, onSuccess, folderCls, isReset }) => {

- {selectFolder && selectFolder.Name ? selectFolder.Name : "Root"} + {selectFolder && selectFolder.Name + ? selectFolder.Name + : "OpenSign™ Drive"}

SetIsOpen(true)}> { isOpen={isOpen} handleClose={handleCancel} > -
+
removeTabListItem(e)} > - Root /{" "} + OpenSign™ Drive /{" "} {tabList && tabList.map((tab, i) => ( diff --git a/apps/OpenSign/src/layout/HomeLayout.js b/apps/OpenSign/src/layout/HomeLayout.js index 8f4c26379..d3cfd8188 100644 --- a/apps/OpenSign/src/layout/HomeLayout.js +++ b/apps/OpenSign/src/layout/HomeLayout.js @@ -94,6 +94,12 @@ const HomeLayout = () => { position: "top" // style: { backgroundColor: "#abd4d2" }, }, + { + selector: '[data-tut="tourbutton"]', + content: `To upload documents for self-signing or to request others’ signatures, simply select the respective buttons.`, + position: "top" + // style: { backgroundColor: "#abd4d2" }, + }, ...resArr, { selector: '[data-tut="reactourLast"]', diff --git a/apps/OpenSignServer/databases/migrations/20240315095256-change_forms_menu.cjs b/apps/OpenSignServer/databases/migrations/20240315095256-change_forms_menu.cjs new file mode 100644 index 000000000..d6894077f --- /dev/null +++ b/apps/OpenSignServer/databases/migrations/20240315095256-change_forms_menu.cjs @@ -0,0 +1,690 @@ +/** + * + * @param {Parse} Parse + */ +exports.up = async Parse => { + const className = 'w_menu'; + const userMenu = new Parse.Query(className); + const updateUserMenu = await userMenu.get('H9vRfEYKhT'); + updateUserMenu.set('menuItems', [ + { + icon: 'fas fa-tachometer-alt', + title: 'Dashboard', + target: '', + pageType: 'dashboard', + description: '', + objectId: '35KBoSgoAK', + }, + { + icon: 'fas fa-pen-nib', + title: 'Sign yourself', + target: '_self', + pageType: 'form', + description: '', + objectId: 'sHAnZphf69', + }, + { + icon: 'fa-solid fa-paper-plane', + title: 'Request signatures', + target: '_self', + pageType: 'form', + description: '', + objectId: '8mZzFxbG1z', + }, + { + icon: 'far fa-newspaper', + title: 'Templates', + target: '_self', + pageType: null, + description: null, + objectId: null, + children: [ + { + icon: 'fas fa-file-signature', + title: 'Create template', + target: '_self', + pageType: 'form', + description: '', + objectId: 'template', + }, + { + icon: 'fa-solid fa-file-contract', + title: 'Manage templates', + target: '_self', + pageType: 'report', + description: '', + objectId: '6TeaPr321t', + }, + ], + }, + { + icon: 'fas fa-folder', + title: 'OpenSign™ Drive', + target: '_self', + pageType: '', + description: '', + objectId: 'opensigndrive', + }, + { + icon: 'fas fa-address-card', + title: 'Reports', + target: '_self', + pageType: null, + description: '', + objectId: null, + children: [ + { + icon: 'fas fa-signature', + title: 'Need your sign', + target: '_self', + pageType: 'report', + description: '', + objectId: '4Hhwbp482K', + }, + { + icon: 'fas fa-tasks', + title: 'In Progress', + target: '_self', + pageType: 'report', + description: '', + objectId: '1MwEuxLEkF', + }, + { + icon: 'fas fa-check-circle', + title: 'Completed', + target: '_self', + pageType: 'report', + description: '', + objectId: 'kQUoW4hUXz', + }, + { + icon: 'fas fa-edit', + title: 'Drafts', + target: '_self', + pageType: 'report', + description: '', + objectId: 'ByHuevtCFY', + }, + { + icon: 'fas fa-times-circle', + title: 'Declined', + target: '_self', + pageType: 'report', + description: '', + objectId: 'UPr2Fm5WY3', + }, + { + icon: 'fas fa-hourglass-end', + title: 'Expired', + target: '_self', + pageType: 'report', + description: '', + objectId: 'zNqBHXHsYH', + }, + { + icon: 'fa-solid fa-address-book', + title: 'Contactbook', + target: '_self', + pageType: 'report', + description: '', + objectId: '5KhaPr482K', + }, + ], + }, + { + icon: 'fas fa-cog', + title: 'Settings', + target: '_self', + pageType: null, + description: '', + objectId: null, + children: [ + { + icon: 'fas fa-pen-fancy', + title: 'My Signature', + target: '_self', + pageType: '', + description: '', + objectId: 'managesign', + }, + { + icon: 'fa-solid fa-key', + title: 'API Token', + target: '_self', + pageType: 'generatetoken', + description: '', + objectId: '', + }, + { + icon: 'fa-solid fa-globe', + title: 'Webhook', + target: '_self', + pageType: 'webhook', + description: '', + objectId: '', + }, + ], + }, + ]); + + const AdminMenu = new Parse.Query(className); + const updateAdminMenu = await AdminMenu.get('VPh91h0ZHk'); + updateAdminMenu.set('menuItems', [ + { + icon: 'fas fa-tachometer-alt', + title: 'Dashboard', + target: '', + pageType: 'dashboard', + description: '', + objectId: '35KBoSgoAK', + }, + { + icon: 'fas fa-pen-nib', + title: 'Sign yourself', + target: '_self', + pageType: 'form', + description: '', + objectId: 'sHAnZphf69', + }, + { + icon: 'fa-solid fa-paper-plane', + title: 'Request signatures', + target: '_self', + pageType: 'form', + description: '', + objectId: '8mZzFxbG1z', + }, + { + icon: 'far fa-newspaper', + title: 'Templates', + target: '_self', + pageType: null, + description: null, + objectId: null, + children: [ + { + icon: 'fas fa-file-signature', + title: 'Create template', + target: '_self', + pageType: 'form', + description: '', + objectId: 'template', + }, + { + icon: 'fa-solid fa-file-contract', + title: 'Manage templates', + target: '_self', + pageType: 'report', + description: '', + objectId: '6TeaPr321t', + }, + ], + }, + { + icon: 'fas fa-folder', + title: 'OpenSign™ Drive', + target: '_self', + pageType: '', + description: '', + objectId: 'opensigndrive', + }, + { + icon: 'fas fa-address-card', + title: 'Reports', + target: '_self', + pageType: null, + description: '', + objectId: null, + children: [ + { + icon: 'fas fa-signature', + title: 'Need your sign', + target: '_self', + pageType: 'report', + description: '', + objectId: '4Hhwbp482K', + }, + { + icon: 'fas fa-tasks', + title: 'In Progress', + target: '_self', + pageType: 'report', + description: '', + objectId: '1MwEuxLEkF', + }, + { + icon: 'fas fa-check-circle', + title: 'Completed', + target: '_self', + pageType: 'report', + description: '', + objectId: 'kQUoW4hUXz', + }, + { + icon: 'fas fa-edit', + title: 'Drafts', + target: '_self', + pageType: 'report', + description: '', + objectId: 'ByHuevtCFY', + }, + { + icon: 'fas fa-times-circle', + title: 'Declined', + target: '_self', + pageType: 'report', + description: '', + objectId: 'UPr2Fm5WY3', + }, + { + icon: 'fas fa-hourglass-end', + title: 'Expired', + target: '_self', + pageType: 'report', + description: '', + objectId: 'zNqBHXHsYH', + }, + { + icon: 'fa-solid fa-address-book', + title: 'Contactbook', + target: '_self', + pageType: 'report', + description: '', + objectId: '5KhaPr482K', + }, + ], + }, + { + icon: 'fas fa-cog', + title: 'Settings', + target: '_self', + pageType: null, + description: '', + objectId: null, + children: [ + { + icon: 'fas fa-pen-fancy', + title: 'My Signature', + target: '_self', + pageType: '', + description: '', + objectId: 'managesign', + }, + { + icon: 'far fa-user', + title: 'Add User', + target: '_self', + pageType: 'form', + description: '', + objectId: 'lM0xRnM3iE', + }, + { + icon: 'fa-solid fa-key', + title: 'API Token', + target: '_self', + pageType: 'generatetoken', + description: '', + objectId: '', + }, + { + icon: 'fa-solid fa-globe', + title: 'Webhook', + target: '_self', + pageType: 'webhook', + description: '', + objectId: '', + }, + ], + }, + ]); + // TODO: Set the schema here + // Example: + // schema.addString('name').addNumber('cash'); + const batch = [updateUserMenu, updateAdminMenu]; + return Parse.Object.saveAll(batch, { useMasterKey: true }); +}; + +/** + * + * @param {Parse} Parse + */ +exports.down = async Parse => { + // TODO: set className here + const className = 'w_menu'; + const userMenu = new Parse.Query(className); + const revertUserMenu = await userMenu.get('H9vRfEYKhT'); + revertUserMenu.set('menuItems', [ + { + icon: 'fas fa-tachometer-alt', + title: 'Dashboard', + target: '', + pageType: 'dashboard', + description: '', + objectId: '35KBoSgoAK', + }, + { + icon: 'far fa-newspaper', + title: 'New Document', + target: '_self', + pageType: null, + description: null, + objectId: null, + children: [ + { + icon: 'fas fa-pen-nib', + title: 'Sign yourself', + target: '_self', + pageType: 'form', + description: '', + objectId: 'sHAnZphf69', + }, + { + icon: 'fa-solid fa-paper-plane', + title: 'Request signatures', + target: '_self', + pageType: 'form', + description: '', + objectId: '8mZzFxbG1z', + }, + { + icon: 'fas fa-file-signature', + title: 'New template', + target: '_self', + pageType: 'form', + description: '', + objectId: 'template', + }, + ], + }, + { + icon: 'fa-solid fa-file-contract', + title: 'Templates', + target: '_self', + pageType: 'report', + description: '', + objectId: '6TeaPr321t', + }, + { + icon: 'fas fa-folder', + title: 'OpenSign™ Drive', + target: '_self', + pageType: '', + description: '', + objectId: 'opensigndrive', + }, + { + icon: 'fas fa-address-card', + title: 'Reports', + target: '_self', + pageType: null, + description: '', + objectId: null, + children: [ + { + icon: 'fas fa-signature', + title: 'Need your sign', + target: '_self', + pageType: 'report', + description: '', + objectId: '4Hhwbp482K', + }, + { + icon: 'fas fa-tasks', + title: 'In Progress', + target: '_self', + pageType: 'report', + description: '', + objectId: '1MwEuxLEkF', + }, + { + icon: 'fas fa-check-circle', + title: 'Completed', + target: '_self', + pageType: 'report', + description: '', + objectId: 'kQUoW4hUXz', + }, + { + icon: 'fas fa-edit', + title: 'Drafts', + target: '_self', + pageType: 'report', + description: '', + objectId: 'ByHuevtCFY', + }, + { + icon: 'fas fa-times-circle', + title: 'Declined', + target: '_self', + pageType: 'report', + description: '', + objectId: 'UPr2Fm5WY3', + }, + { + icon: 'fas fa-hourglass-end', + title: 'Expired', + target: '_self', + pageType: 'report', + description: '', + objectId: 'zNqBHXHsYH', + }, + { + icon: 'fa-solid fa-address-book', + title: 'Contactbook', + target: '_self', + pageType: 'report', + description: '', + objectId: '5KhaPr482K', + }, + ], + }, + { + icon: 'fas fa-cog', + title: 'Settings', + target: '_self', + pageType: null, + description: '', + objectId: null, + children: [ + { + icon: 'fas fa-pen-fancy', + title: 'My Signature', + target: '_self', + pageType: '', + description: '', + objectId: 'managesign', + }, + { + icon: 'fa-solid fa-key', + title: 'API Token', + target: '_self', + pageType: 'generatetoken', + description: '', + objectId: '', + }, + { + icon: 'fa-solid fa-globe', + title: 'Webhook', + target: '_self', + pageType: 'webhook', + description: '', + objectId: '', + }, + ], + }, + ]); + + const adminMenu = new Parse.Query(className); + const revertAdminMenu = await adminMenu.get('VPh91h0ZHk'); + revertAdminMenu.set('menuItems', [ + { + icon: 'fas fa-tachometer-alt', + title: 'Dashboard', + target: '', + pageType: 'dashboard', + description: '', + objectId: '35KBoSgoAK', + }, + { + icon: 'far fa-newspaper', + title: 'New Document', + target: '_self', + pageType: null, + description: null, + objectId: null, + children: [ + { + icon: 'fas fa-pen-nib', + title: 'Sign yourself', + target: '_self', + pageType: 'form', + description: '', + objectId: 'sHAnZphf69', + }, + { + icon: 'fa-solid fa-paper-plane', + title: 'Request signatures', + target: '_self', + pageType: 'form', + description: '', + objectId: '8mZzFxbG1z', + }, + { + icon: 'fas fa-file-signature', + title: 'New template', + target: '_self', + pageType: 'form', + description: '', + objectId: 'template', + }, + ], + }, + { + icon: 'fa-solid fa-file-contract', + title: 'Templates', + target: '_self', + pageType: 'report', + description: '', + objectId: '6TeaPr321t', + }, + { + icon: 'fas fa-folder', + title: 'OpenSign™ Drive', + target: '_self', + pageType: '', + description: '', + objectId: 'opensigndrive', + }, + { + icon: 'fas fa-address-card', + title: 'Reports', + target: '_self', + pageType: null, + description: '', + objectId: null, + children: [ + { + icon: 'fas fa-signature', + title: 'Need your sign', + target: '_self', + pageType: 'report', + description: '', + objectId: '4Hhwbp482K', + }, + { + icon: 'fas fa-tasks', + title: 'In Progress', + target: '_self', + pageType: 'report', + description: '', + objectId: '1MwEuxLEkF', + }, + { + icon: 'fas fa-check-circle', + title: 'Completed', + target: '_self', + pageType: 'report', + description: '', + objectId: 'kQUoW4hUXz', + }, + { + icon: 'fas fa-edit', + title: 'Drafts', + target: '_self', + pageType: 'report', + description: '', + objectId: 'ByHuevtCFY', + }, + { + icon: 'fas fa-times-circle', + title: 'Declined', + target: '_self', + pageType: 'report', + description: '', + objectId: 'UPr2Fm5WY3', + }, + { + icon: 'fas fa-hourglass-end', + title: 'Expired', + target: '_self', + pageType: 'report', + description: '', + objectId: 'zNqBHXHsYH', + }, + { + icon: 'fa-solid fa-address-book', + title: 'Contactbook', + target: '_self', + pageType: 'report', + description: '', + objectId: '5KhaPr482K', + }, + ], + }, + { + icon: 'fas fa-cog', + title: 'Settings', + target: '_self', + pageType: null, + description: '', + objectId: null, + children: [ + { + icon: 'fas fa-pen-fancy', + title: 'My Signature', + target: '_self', + pageType: '', + description: '', + objectId: 'managesign', + }, + { + icon: 'far fa-user', + title: 'Add User', + target: '_self', + pageType: 'form', + description: '', + objectId: 'lM0xRnM3iE', + }, + { + icon: 'fa-solid fa-key', + title: 'API Token', + target: '_self', + pageType: 'generatetoken', + description: '', + objectId: '', + }, + { + icon: 'fa-solid fa-globe', + title: 'Webhook', + target: '_self', + pageType: 'webhook', + description: '', + objectId: '', + }, + ], + }, + ]); + + const batch = [revertUserMenu, revertAdminMenu]; + return Parse.Object.saveAll(batch, { useMasterKey: true }); +};