Skip to content

Commit 631f118

Browse files
Merge pull request #1347 from OpenSignLabs/validation
fix: document loading err and report UI
2 parents f1ab35e + b43e3a6 commit 631f118

File tree

5 files changed

+59
-151
lines changed

5 files changed

+59
-151
lines changed

apps/OpenSign/src/components/pdf/WidgetComponent.js

Lines changed: 24 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import RecipientList from "./RecipientList";
44
import { useDrag } from "react-dnd";
55
import WidgetList from "./WidgetList";
66
import {
7+
color,
78
radioButtonWidget,
89
textInputWidget,
910
textWidget,
@@ -43,163 +44,69 @@ function WidgetComponent({
4344
const [isSignersModal, setIsSignersModal] = useState(false);
4445
const [, dropdown] = useDrag({
4546
type: "BOX",
46-
item: {
47-
type: "BOX",
48-
id: 5,
49-
text: "dropdown"
50-
},
51-
47+
item: { type: "BOX", id: 5, text: "dropdown" },
5248
collect: (monitor) => ({
5349
isDragDropdown: !!monitor.isDragging()
5450
})
5551
});
5652
const [, checkbox] = useDrag({
5753
type: "BOX",
58-
item: {
59-
type: "BOX",
60-
id: 6,
61-
text: "checkbox"
62-
},
63-
64-
collect: (monitor) => ({
65-
isDragCheck: !!monitor.isDragging()
66-
})
54+
item: { type: "BOX", id: 6, text: "checkbox" },
55+
collect: (monitor) => ({ isDragCheck: !!monitor.isDragging() })
6756
});
6857
const [, textInput] = useDrag({
6958
type: "BOX",
70-
item: {
71-
type: "BOX",
72-
id: 7,
73-
text: textInputWidget
74-
},
75-
collect: (monitor) => ({
76-
isDragTextInput: !!monitor.isDragging()
77-
})
59+
item: { type: "BOX", id: 7, text: textInputWidget },
60+
collect: (monitor) => ({ isDragTextInput: !!monitor.isDragging() })
7861
});
7962
const [, initials] = useDrag({
8063
type: "BOX",
81-
item: {
82-
type: "BOX",
83-
id: 8,
84-
text: "initials"
85-
},
86-
87-
collect: (monitor) => ({
88-
isDragInitial: !!monitor.isDragging()
89-
})
64+
item: { type: "BOX", id: 8, text: "initials" },
65+
collect: (monitor) => ({ isDragInitial: !!monitor.isDragging() })
9066
});
9167
const [, name] = useDrag({
9268
type: "BOX",
93-
item: {
94-
type: "BOX",
95-
id: 9,
96-
text: "name"
97-
},
98-
99-
collect: (monitor) => ({
100-
isDragName: !!monitor.isDragging()
101-
})
69+
item: { type: "BOX", id: 9, text: "name" },
70+
collect: (monitor) => ({ isDragName: !!monitor.isDragging() })
10271
});
10372
const [, company] = useDrag({
10473
type: "BOX",
105-
item: {
106-
type: "BOX",
107-
id: 10,
108-
text: "company"
109-
},
110-
111-
collect: (monitor) => ({
112-
isDragCompany: !!monitor.isDragging()
113-
})
74+
item: { type: "BOX", id: 10, text: "company" },
75+
collect: (monitor) => ({ isDragCompany: !!monitor.isDragging() })
11476
});
11577
const [, jobTitle] = useDrag({
11678
type: "BOX",
117-
item: {
118-
type: "BOX",
119-
id: 11,
120-
text: "job title"
121-
},
122-
123-
collect: (monitor) => ({
124-
isDragJobtitle: !!monitor.isDragging()
125-
})
79+
item: { type: "BOX", id: 11, text: "job title" },
80+
collect: (monitor) => ({ isDragJobtitle: !!monitor.isDragging() })
12681
});
12782
const [, date] = useDrag({
12883
type: "BOX",
129-
item: {
130-
type: "BOX",
131-
id: 12,
132-
text: "date"
133-
},
134-
135-
collect: (monitor) => ({
136-
isDragDate: !!monitor.isDragging()
137-
})
84+
item: { type: "BOX", id: 12, text: "date" },
85+
collect: (monitor) => ({ isDragDate: !!monitor.isDragging() })
13886
});
13987
const [, image] = useDrag({
14088
type: "BOX",
141-
item: {
142-
type: "BOX",
143-
id: 13,
144-
text: "image"
145-
},
146-
147-
collect: (monitor) => ({
148-
isDragImage: !!monitor.isDragging()
149-
})
89+
item: { type: "BOX", id: 13, text: "image" },
90+
collect: (monitor) => ({ isDragImage: !!monitor.isDragging() })
15091
});
15192
const [, email] = useDrag({
15293
type: "BOX",
153-
item: {
154-
type: "BOX",
155-
id: 14,
156-
text: "email"
157-
},
158-
collect: (monitor) => ({
159-
isDragEmail: !!monitor.isDragging()
160-
})
94+
item: { type: "BOX", id: 14, text: "email" },
95+
collect: (monitor) => ({ isDragEmail: !!monitor.isDragging() })
16196
});
16297
const [, radioButton] = useDrag({
16398
type: "BOX",
164-
165-
item: {
166-
type: "BOX",
167-
id: 15,
168-
text: radioButtonWidget
169-
},
170-
collect: (monitor) => ({
171-
isDragRadiotton: !!monitor.isDragging()
172-
})
99+
item: { type: "BOX", id: 15, text: radioButtonWidget },
100+
collect: (monitor) => ({ isDragRadiotton: !!monitor.isDragging() })
173101
});
174102
const [, text] = useDrag({
175103
type: "BOX",
176-
177-
item: {
178-
type: "BOX",
179-
id: 16,
180-
text: textWidget
181-
},
182-
collect: (monitor) => ({
183-
isDragText: !!monitor.isDragging()
184-
})
104+
item: { type: "BOX", id: 16, text: textWidget },
105+
collect: (monitor) => ({ isDragText: !!monitor.isDragging() })
185106
});
186107
const isMobile = window.innerWidth < 767;
187108
const scrollContainerRef = useRef(null);
188109
const [widget, setWidget] = useState([]);
189-
const color = [
190-
"#93a3db",
191-
"#e6c3db",
192-
"#c0e3bc",
193-
"#bce3db",
194-
"#b8ccdb",
195-
"#ceb8db",
196-
"#ffccff",
197-
"#99ffcc",
198-
"#cc99ff",
199-
"#ffcc99",
200-
"#66ccff",
201-
"#ffffcc"
202-
];
203110
const handleModal = () => {
204111
setIsSignersModal(!isSignersModal);
205112
};

apps/OpenSign/src/json/ReportJson.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ export default function reportJson(id) {
2727
const templateSubAction = isEnableSubscription
2828
? [
2929
{
30-
btnId: "2434",
30+
btnId: "2435",
3131
btnLabel: "Embed",
3232
hoverLabel: "Embed",
3333
btnIcon: "fa-light fa-code",
3434
action: "Embed"
3535
},
3636
{
37-
btnId: "2434",
37+
btnId: "2436",
3838
btnLabel: "Copy TemplateId",
3939
hoverLabel: "Copy TemplateId",
4040
btnIcon: "fa-light fa-copy",
4141
action: "CopyTemplateId"
4242
},
4343
{
44-
btnId: "2434",
44+
btnId: "2437",
4545
btnLabel: "Copy Public URL",
4646
hoverLabel: "Copy Public URL",
4747
btnIcon: "fa-light fa-copy",

apps/OpenSign/src/pages/TemplatePlaceholder.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import {
2929
onClickZoomOut,
3030
onClickZoomIn,
3131
handleRemoveWidgets,
32-
handleRotateWarning
32+
handleRotateWarning,
33+
color
3334
} from "../constant/Utils";
3435
import RenderPdf from "../components/pdf/RenderPdf";
3536
import "../styles/AddUser.css";
@@ -102,20 +103,6 @@ const TemplatePlaceholder = () => {
102103
const [isTextSetting, setIsTextSetting] = useState(false);
103104
const [pdfLoad, setPdfLoad] = useState(false);
104105
const [pdfRotateBase64, setPdfRotatese64] = useState("");
105-
const color = [
106-
"#93a3db",
107-
"#e6c3db",
108-
"#c0e3bc",
109-
"#bce3db",
110-
"#b8ccdb",
111-
"#ceb8db",
112-
"#ffccff",
113-
"#99ffcc",
114-
"#cc99ff",
115-
"#ffcc99",
116-
"#66ccff",
117-
"#ffffcc"
118-
];
119106
const isMobile = window.innerWidth < 767;
120107
const [, drop] = useDrop({
121108
accept: "BOX",

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ const ReportTable = (props) => {
11651165
<Loader />
11661166
</div>
11671167
)}
1168-
<div className="p-2 w-full overflow-hidden bg-base-100 text-base-content op-card shadow-lg">
1168+
<div className="p-2 w-full bg-base-100 text-base-content op-card shadow-lg">
11691169
{isCelebration && (
11701170
<div className="relative z-[1000]">
11711171
<Confetti
@@ -1227,10 +1227,14 @@ const ReportTable = (props) => {
12271227
</div>
12281228
<div
12291229
className={`${
1230-
isDashboard && props.List?.length > 0 ? "min-h-[317px]" : "h-full"
1231-
} overflow-auto w-full`}
1230+
isDashboard && props.List?.length > 0
1231+
? "min-h-[317px]"
1232+
: currentList?.length === props.docPerPage
1233+
? "h-fit"
1234+
: "h-screen"
1235+
} overflow-auto w-full border-b`}
12321236
>
1233-
<table className="op-table border-collapse w-full ">
1237+
<table className="op-table border-collapse w-full mb-4">
12341238
<thead className="text-[14px]">
12351239
<tr className="border-y-[1px]">
12361240
{props.heading?.map((item, index) => (
@@ -1311,7 +1315,14 @@ const ReportTable = (props) => {
13111315
</td>
13121316
</tr>
13131317
) : (
1314-
<tr className="border-y-[1px]" key={index}>
1318+
<tr
1319+
className={`${
1320+
currentList?.length === props.docPerPage
1321+
? "last:border-none"
1322+
: ""
1323+
} border-y-[1px] `}
1324+
key={index}
1325+
>
13151326
{props.heading.includes("Sr.No") && (
13161327
<th className="px-4 py-2">
13171328
{startIndex + index + 1}
@@ -1590,9 +1601,7 @@ const ReportTable = (props) => {
15901601
className={
15911602
act.action !== "option"
15921603
? `${
1593-
act?.btnColor
1594-
? act.btnColor
1595-
: ""
1604+
act?.btnColor || ""
15961605
} op-btn op-btn-sm mr-1`
15971606
: "text-base-content focus:outline-none text-lg mr-2 relative"
15981607
}
@@ -1609,9 +1618,10 @@ const ReportTable = (props) => {
16091618
)}`}
16101619
</span>
16111620
)}
1621+
{/* template report */}
16121622
{isOption[item.objectId] &&
16131623
act.action === "option" && (
1614-
<ul className="absolute -right-1 top-auto z-[70] w-max op-dropdown-content op-menu shadow bg-base-100 text-base-content rounded-box">
1624+
<ul className="absolute -right-1 top-auto z-[70] w-max op-dropdown-content op-menu shadow-black/20 shadow bg-base-100 text-base-content rounded-box">
16151625
{act.subaction?.map((subact) => (
16161626
<li
16171627
key={subact.btnId}
@@ -1665,9 +1675,10 @@ const ReportTable = (props) => {
16651675
{t(`btnLabel.${act.btnLabel}`)}
16661676
</span>
16671677
)}
1678+
{/* doc report */}
16681679
{isOption[item.objectId] &&
16691680
act.action === "option" && (
1670-
<ul className="absolute -right-1 top-auto z-[70] w-max op-dropdown-content op-menu shadow bg-base-100 text-base-content rounded-box">
1681+
<ul className="absolute -right-1 top-auto z-[70] w-max op-dropdown-content op-menu shadow-black/20 shadow bg-base-100 text-base-content rounded-box">
16711682
{act.subaction?.map((subact) => (
16721683
<li
16731684
key={subact.btnId}

apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,16 @@ async function PDF(req) {
316316
}
317317
}
318318
const _resDoc = resDoc?.toJSON();
319-
// `FileAdapter` && `ActiveFileAdapter` is used to save file in user's fileAdapter
320-
const ActiveFileAdapter = _resDoc?.ExtUserPtr?.TenantId?.ActiveFileAdapter;
321-
const FileAdapter =
322-
_resDoc?.ExtUserPtr?.TenantId?.FileAdapters?.find(x => x.id === ActiveFileAdapter) || {};
319+
// `fileAdapterId` is used check document uploaded in custom file adapter and get customFileAdapter id
320+
const fileAdapterId = _resDoc?.FileAdapterId || '';
323321
let adapterConfig = {};
324-
if (FileAdapter && ActiveFileAdapter) {
325-
adapterConfig = { ActiveFileAdapter: ActiveFileAdapter, ...FileAdapter };
322+
if (fileAdapterId) {
323+
// `FileAdapter` is used to credintials of file adapter
324+
const FileAdapter =
325+
_resDoc?.ExtUserPtr?.TenantId?.FileAdapters?.find(x => x.id === fileAdapterId) || {};
326+
if (FileAdapter) {
327+
adapterConfig = FileAdapter;
328+
}
326329
}
327330
let signUser;
328331
let className;

0 commit comments

Comments
 (0)