Merge pull request #1347 from OpenSignLabs/validation

fix: document loading err and report UI
This commit is contained in:
Andrew
2024-10-16 20:26:22 +05:30
committed by GitHub
5 changed files with 59 additions and 151 deletions
@@ -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);
};
+3 -3
View File
@@ -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",
+2 -15
View File
@@ -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",
@@ -1165,7 +1165,7 @@ const ReportTable = (props) => {
<Loader />
</div>
)}
<div className="p-2 w-full overflow-hidden bg-base-100 text-base-content op-card shadow-lg">
<div className="p-2 w-full bg-base-100 text-base-content op-card shadow-lg">
{isCelebration && (
<div className="relative z-[1000]">
<Confetti
@@ -1227,10 +1227,14 @@ const ReportTable = (props) => {
</div>
<div
className={`${
isDashboard && props.List?.length > 0 ? "min-h-[317px]" : "h-full"
} overflow-auto w-full`}
isDashboard && props.List?.length > 0
? "min-h-[317px]"
: currentList?.length === props.docPerPage
? "h-fit"
: "h-screen"
} overflow-auto w-full border-b`}
>
<table className="op-table border-collapse w-full ">
<table className="op-table border-collapse w-full mb-4">
<thead className="text-[14px]">
<tr className="border-y-[1px]">
{props.heading?.map((item, index) => (
@@ -1311,7 +1315,14 @@ const ReportTable = (props) => {
</td>
</tr>
) : (
<tr className="border-y-[1px]" key={index}>
<tr
className={`${
currentList?.length === props.docPerPage
? "last:border-none"
: ""
} border-y-[1px] `}
key={index}
>
{props.heading.includes("Sr.No") && (
<th className="px-4 py-2">
{startIndex + index + 1}
@@ -1590,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"
}
@@ -1609,9 +1618,10 @@ const ReportTable = (props) => {
)}`}
</span>
)}
{/* template report */}
{isOption[item.objectId] &&
act.action === "option" && (
<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">
<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">
{act.subaction?.map((subact) => (
<li
key={subact.btnId}
@@ -1665,9 +1675,10 @@ const ReportTable = (props) => {
{t(`btnLabel.${act.btnLabel}`)}
</span>
)}
{/* doc report */}
{isOption[item.objectId] &&
act.action === "option" && (
<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">
<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">
{act.subaction?.map((subact) => (
<li
key={subact.btnId}
@@ -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;