From 97c2f183ca72923500c937a4cad1732d318b9764 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Tue, 15 Oct 2024 18:56:50 +0530 Subject: [PATCH 1/6] fix: document loading err and report UI --- apps/OpenSign/src/primitives/GetReportDisplay.js | 10 ++++++---- .../OpenSignServer/cloud/parsefunction/pdf/PDF.js | 15 +++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js index 136994fd4..b9176d19b 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.js +++ b/apps/OpenSign/src/primitives/GetReportDisplay.js @@ -1165,7 +1165,7 @@ const ReportTable = (props) => { )} -
+
{isCelebration && (
{
0 ? "min-h-[317px]" : "h-full" - } overflow-auto w-full`} + isDashboard && props.List?.length > 0 ? "min-h-[317px]" : "h-screen" + } overflow-auto w-full border-b`} > - +
{props.heading?.map((item, index) => ( @@ -1609,6 +1609,7 @@ const ReportTable = (props) => { )}`} )} + {/* template report */} {isOption[item.objectId] && act.action === "option" && (
    @@ -1665,6 +1666,7 @@ const ReportTable = (props) => { {t(`btnLabel.${act.btnLabel}`)} )} + {/* doc report */} {isOption[item.objectId] && act.action === "option" && (
      diff --git a/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js b/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js index d0f7731e9..1c3204bf9 100644 --- a/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js +++ b/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js @@ -316,13 +316,16 @@ async function PDF(req) { } } const _resDoc = resDoc?.toJSON(); - // `FileAdapter` && `ActiveFileAdapter` is used to save file in user's fileAdapter - const ActiveFileAdapter = _resDoc?.ExtUserPtr?.TenantId?.ActiveFileAdapter; - const FileAdapter = - _resDoc?.ExtUserPtr?.TenantId?.FileAdapters?.find(x => x.id === ActiveFileAdapter) || {}; + // `fileAdapterId` is used check document uploaded in custom file adapter and get customFileAdapter id + const fileAdapterId = _resDoc?.FileAdapterId || ''; let adapterConfig = {}; - if (FileAdapter && ActiveFileAdapter) { - adapterConfig = { ActiveFileAdapter: ActiveFileAdapter, ...FileAdapter }; + if (fileAdapterId) { + // `FileAdapter` is used to credintials of file adapter + const FileAdapter = + _resDoc?.ExtUserPtr?.TenantId?.FileAdapters?.find(x => x.id === fileAdapterId) || {}; + if (FileAdapter) { + adapterConfig = FileAdapter; + } } let signUser; let className; From 3a8e41de27ad8075f63f84eb91bf91faa995c01d Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Tue, 15 Oct 2024 18:57:15 +0530 Subject: [PATCH 2/6] fix: duplicate id warning --- apps/OpenSign/src/json/ReportJson.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.js index 859a2e4fd..c3c0a0cc7 100644 --- a/apps/OpenSign/src/json/ReportJson.js +++ b/apps/OpenSign/src/json/ReportJson.js @@ -27,21 +27,21 @@ export default function reportJson(id) { const templateSubAction = isEnableSubscription ? [ { - btnId: "2434", + btnId: "2435", btnLabel: "Embed", hoverLabel: "Embed", btnIcon: "fa-light fa-code", action: "Embed" }, { - btnId: "2434", + btnId: "2436", btnLabel: "Copy TemplateId", hoverLabel: "Copy TemplateId", btnIcon: "fa-light fa-copy", action: "CopyTemplateId" }, { - btnId: "2434", + btnId: "2437", btnLabel: "Copy Public URL", hoverLabel: "Copy Public URL", btnIcon: "fa-light fa-copy", From 8467340fb54d6d95fe8251ce3a71353e7fcf5f7e Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Wed, 16 Oct 2024 12:13:19 +0530 Subject: [PATCH 3/6] fix: report UI --- apps/OpenSign/src/primitives/GetReportDisplay.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js index b9176d19b..f1af679db 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.js +++ b/apps/OpenSign/src/primitives/GetReportDisplay.js @@ -1227,7 +1227,13 @@ const ReportTable = (props) => {
      0 ? "min-h-[317px]" : "h-screen" + isDashboard && props.List?.length > 0 + ? "min-h-[317px]" + : `${ + currentList?.length === props.docPerPage + ? "h-fit" + : "h-screen" + }` } overflow-auto w-full border-b`} >
From a103f93925001ddbbc0aa7d544845270273d5315 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Wed, 16 Oct 2024 13:02:24 +0530 Subject: [PATCH 4/6] fix: add space after last record in reports --- .../src/primitives/GetReportDisplay.js | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js index f1af679db..be73b2e3c 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.js +++ b/apps/OpenSign/src/primitives/GetReportDisplay.js @@ -1229,14 +1229,12 @@ const ReportTable = (props) => { className={`${ isDashboard && props.List?.length > 0 ? "min-h-[317px]" - : `${ - currentList?.length === props.docPerPage - ? "h-fit" - : "h-screen" - }` + : currentList?.length === props.docPerPage + ? "h-fit" + : "h-screen" } overflow-auto w-full border-b`} > -
+
{props.heading?.map((item, index) => ( @@ -1317,7 +1315,14 @@ const ReportTable = (props) => { ) : ( - + {props.heading.includes("Sr.No") && (
{startIndex + index + 1} @@ -1596,9 +1601,7 @@ const ReportTable = (props) => { className={ act.action !== "option" ? `${ - act?.btnColor - ? act.btnColor - : "" + act?.btnColor || "" } op-btn op-btn-sm mr-1` : "text-base-content focus:outline-none text-lg mr-2 relative" } @@ -1618,7 +1621,7 @@ const ReportTable = (props) => { {/* template report */} {isOption[item.objectId] && act.action === "option" && ( -
    +
      {act.subaction?.map((subact) => (
    • { {/* doc report */} {isOption[item.objectId] && act.action === "option" && ( -
        +
          {act.subaction?.map((subact) => (
        • Date: Wed, 16 Oct 2024 14:48:34 +0530 Subject: [PATCH 5/6] fix: add space below in last row from reports --- apps/OpenSign/src/primitives/GetReportDisplay.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js index be73b2e3c..c56828e94 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.js +++ b/apps/OpenSign/src/primitives/GetReportDisplay.js @@ -1234,7 +1234,7 @@ const ReportTable = (props) => { : "h-screen" } overflow-auto w-full border-b`} > - +
          {props.heading?.map((item, index) => ( From b43e3a61e6f07b839b02baf9c46ccb451dcd42bb Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Wed, 16 Oct 2024 16:22:06 +0530 Subject: [PATCH 6/6] refactor: remove unnecessary code --- .../src/components/pdf/WidgetComponent.js | 141 +++--------------- .../OpenSign/src/pages/TemplatePlaceholder.js | 17 +-- 2 files changed, 26 insertions(+), 132 deletions(-) diff --git a/apps/OpenSign/src/components/pdf/WidgetComponent.js b/apps/OpenSign/src/components/pdf/WidgetComponent.js index 89aab1e6b..e59220b68 100644 --- a/apps/OpenSign/src/components/pdf/WidgetComponent.js +++ b/apps/OpenSign/src/components/pdf/WidgetComponent.js @@ -4,6 +4,7 @@ import RecipientList from "./RecipientList"; import { useDrag } from "react-dnd"; import WidgetList from "./WidgetList"; import { + color, radioButtonWidget, textInputWidget, textWidget, @@ -43,163 +44,69 @@ function WidgetComponent({ const [isSignersModal, setIsSignersModal] = useState(false); const [, dropdown] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 5, - text: "dropdown" - }, - + item: { type: "BOX", id: 5, text: "dropdown" }, collect: (monitor) => ({ isDragDropdown: !!monitor.isDragging() }) }); const [, checkbox] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 6, - text: "checkbox" - }, - - collect: (monitor) => ({ - isDragCheck: !!monitor.isDragging() - }) + item: { type: "BOX", id: 6, text: "checkbox" }, + collect: (monitor) => ({ isDragCheck: !!monitor.isDragging() }) }); const [, textInput] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 7, - text: textInputWidget - }, - collect: (monitor) => ({ - isDragTextInput: !!monitor.isDragging() - }) + item: { type: "BOX", id: 7, text: textInputWidget }, + collect: (monitor) => ({ isDragTextInput: !!monitor.isDragging() }) }); const [, initials] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 8, - text: "initials" - }, - - collect: (monitor) => ({ - isDragInitial: !!monitor.isDragging() - }) + item: { type: "BOX", id: 8, text: "initials" }, + collect: (monitor) => ({ isDragInitial: !!monitor.isDragging() }) }); const [, name] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 9, - text: "name" - }, - - collect: (monitor) => ({ - isDragName: !!monitor.isDragging() - }) + item: { type: "BOX", id: 9, text: "name" }, + collect: (monitor) => ({ isDragName: !!monitor.isDragging() }) }); const [, company] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 10, - text: "company" - }, - - collect: (monitor) => ({ - isDragCompany: !!monitor.isDragging() - }) + item: { type: "BOX", id: 10, text: "company" }, + collect: (monitor) => ({ isDragCompany: !!monitor.isDragging() }) }); const [, jobTitle] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 11, - text: "job title" - }, - - collect: (monitor) => ({ - isDragJobtitle: !!monitor.isDragging() - }) + item: { type: "BOX", id: 11, text: "job title" }, + collect: (monitor) => ({ isDragJobtitle: !!monitor.isDragging() }) }); const [, date] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 12, - text: "date" - }, - - collect: (monitor) => ({ - isDragDate: !!monitor.isDragging() - }) + item: { type: "BOX", id: 12, text: "date" }, + collect: (monitor) => ({ isDragDate: !!monitor.isDragging() }) }); const [, image] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 13, - text: "image" - }, - - collect: (monitor) => ({ - isDragImage: !!monitor.isDragging() - }) + item: { type: "BOX", id: 13, text: "image" }, + collect: (monitor) => ({ isDragImage: !!monitor.isDragging() }) }); const [, email] = useDrag({ type: "BOX", - item: { - type: "BOX", - id: 14, - text: "email" - }, - collect: (monitor) => ({ - isDragEmail: !!monitor.isDragging() - }) + item: { type: "BOX", id: 14, text: "email" }, + collect: (monitor) => ({ isDragEmail: !!monitor.isDragging() }) }); const [, radioButton] = useDrag({ type: "BOX", - - item: { - type: "BOX", - id: 15, - text: radioButtonWidget - }, - collect: (monitor) => ({ - isDragRadiotton: !!monitor.isDragging() - }) + item: { type: "BOX", id: 15, text: radioButtonWidget }, + collect: (monitor) => ({ isDragRadiotton: !!monitor.isDragging() }) }); const [, text] = useDrag({ type: "BOX", - - item: { - type: "BOX", - id: 16, - text: textWidget - }, - collect: (monitor) => ({ - isDragText: !!monitor.isDragging() - }) + item: { type: "BOX", id: 16, text: textWidget }, + collect: (monitor) => ({ isDragText: !!monitor.isDragging() }) }); const isMobile = window.innerWidth < 767; const scrollContainerRef = useRef(null); const [widget, setWidget] = useState([]); - const color = [ - "#93a3db", - "#e6c3db", - "#c0e3bc", - "#bce3db", - "#b8ccdb", - "#ceb8db", - "#ffccff", - "#99ffcc", - "#cc99ff", - "#ffcc99", - "#66ccff", - "#ffffcc" - ]; const handleModal = () => { setIsSignersModal(!isSignersModal); }; diff --git a/apps/OpenSign/src/pages/TemplatePlaceholder.js b/apps/OpenSign/src/pages/TemplatePlaceholder.js index c1ed4333c..5a0b79085 100644 --- a/apps/OpenSign/src/pages/TemplatePlaceholder.js +++ b/apps/OpenSign/src/pages/TemplatePlaceholder.js @@ -29,7 +29,8 @@ import { onClickZoomOut, onClickZoomIn, handleRemoveWidgets, - handleRotateWarning + handleRotateWarning, + color } from "../constant/Utils"; import RenderPdf from "../components/pdf/RenderPdf"; import "../styles/AddUser.css"; @@ -102,20 +103,6 @@ const TemplatePlaceholder = () => { const [isTextSetting, setIsTextSetting] = useState(false); const [pdfLoad, setPdfLoad] = useState(false); const [pdfRotateBase64, setPdfRotatese64] = useState(""); - const color = [ - "#93a3db", - "#e6c3db", - "#c0e3bc", - "#bce3db", - "#b8ccdb", - "#ceb8db", - "#ffccff", - "#99ffcc", - "#cc99ff", - "#ffcc99", - "#66ccff", - "#ffffcc" - ]; const isMobile = window.innerWidth < 767; const [, drop] = useDrop({ accept: "BOX",