mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-22 23:52:30 +02:00
refactor: remove unncessary code
This commit is contained in:
@@ -1,369 +1,26 @@
|
||||
import { documentCls, templateCls } from "../constant/const";
|
||||
export const formJson = (id) => {
|
||||
let formData;
|
||||
export const formJson = {
|
||||
//json form for signYourself
|
||||
if (id === "sHAnZphf69") {
|
||||
formData = {
|
||||
title: "Sign Yourself",
|
||||
redirectRoute: "signaturePdf",
|
||||
msgVar: "Document",
|
||||
Cls: documentCls
|
||||
};
|
||||
return formData;
|
||||
}
|
||||
sHAnZphf69: {
|
||||
title: "Sign Yourself",
|
||||
redirectRoute: "signaturePdf",
|
||||
msgVar: "Document",
|
||||
Cls: documentCls
|
||||
},
|
||||
|
||||
//json form for request signature
|
||||
else if (id === "8mZzFxbG1z") {
|
||||
formData = {
|
||||
title: "Request Signature",
|
||||
msgVar: "Document",
|
||||
redirectRoute: "placeHolderSign",
|
||||
Cls: documentCls,
|
||||
signers: true
|
||||
};
|
||||
return formData;
|
||||
} //json form for template
|
||||
else if (id === "template") {
|
||||
formData = {
|
||||
title: "New Template",
|
||||
redirectRoute: "template",
|
||||
msgVar: "Template",
|
||||
Cls: templateCls
|
||||
};
|
||||
return formData;
|
||||
}
|
||||
//json form for create new folder
|
||||
else if (id === "YjIB7W7Xs6") {
|
||||
formData = {
|
||||
jsonSchema: {
|
||||
title: "New Folder",
|
||||
description: "",
|
||||
type: "object",
|
||||
required: ["Name"],
|
||||
properties: {
|
||||
Name: {
|
||||
type: "string",
|
||||
title: "Name",
|
||||
maxLength: 50
|
||||
},
|
||||
Type: {
|
||||
type: "string",
|
||||
data: {
|
||||
valueKey: "Type",
|
||||
isPointer: false
|
||||
},
|
||||
default: "Folder"
|
||||
},
|
||||
Folder: {
|
||||
title: "Parent Folder",
|
||||
data: {
|
||||
class: "contracts_Document",
|
||||
displayKey: "Name",
|
||||
valueKey: "objectId",
|
||||
query: 'where={"Type":"Folder"}&keys=Name',
|
||||
isPointer: true,
|
||||
savePointerClass: "",
|
||||
helpbody: "",
|
||||
helplink: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
uiSchema: {
|
||||
Type: {
|
||||
"ui:field": "HiddenField"
|
||||
},
|
||||
Folder: {
|
||||
"ui:field": "Level1Dropdown"
|
||||
}
|
||||
},
|
||||
userSchema: {},
|
||||
rules: null,
|
||||
noValidate: false,
|
||||
liveValidate: false,
|
||||
isRegisterForm: false,
|
||||
help: { htmlbody: "" },
|
||||
description: "",
|
||||
class: "contracts_Document",
|
||||
buttons: {
|
||||
add: {
|
||||
resetText: "Reset",
|
||||
submitText: "Submit"
|
||||
},
|
||||
edit: { submitText: "Update", cancelText: "Cancel" }
|
||||
},
|
||||
formACL: {
|
||||
"#currentUser#": { read: true, write: true },
|
||||
"*": { read: true, write: true }
|
||||
},
|
||||
redirect_id: "",
|
||||
success_message: "Success!",
|
||||
success_redirect: "",
|
||||
validFunction:
|
||||
"ZnVuY3Rpb24gdmFsaWRhdGUoZm9ybURhdGEsIGVycm9ycykgeyBpZiAoZm9ybURhdGEucGFzczEgIT09IGZvcm1EYXRhLnBhc3MyKSB7IGVycm9ycy5wYXNzMi5hZGRFcnJvcignUGFzc3dvcmRzIGRvbid0IG1hdGNoJyk7IH0gcmV0dXJuIGVycm9yczsgfQ=="
|
||||
};
|
||||
return formData;
|
||||
}
|
||||
//json form for add signers
|
||||
else if (id === "fICciRuUcB") {
|
||||
formData = {
|
||||
jsonSchema: {
|
||||
title: "Add Signer",
|
||||
description: "",
|
||||
type: "object",
|
||||
required: ["Name", "Email", "Phone", "Company"],
|
||||
properties: {
|
||||
Name: {
|
||||
type: "string",
|
||||
title: "Name",
|
||||
maxLength: 50
|
||||
},
|
||||
Email: {
|
||||
type: "string",
|
||||
title: "Email",
|
||||
maxLength: 50
|
||||
},
|
||||
Phone: {
|
||||
type: "string",
|
||||
title: "Phone",
|
||||
maxLength: 50
|
||||
},
|
||||
Company: {
|
||||
type: "string",
|
||||
title: "Company",
|
||||
maxLength: 50
|
||||
},
|
||||
JobTitle: {
|
||||
type: "string",
|
||||
title: "JobTitle",
|
||||
maxLength: 50
|
||||
},
|
||||
IsContactEntry: {
|
||||
type: "boolean",
|
||||
data: {
|
||||
valueKey: "IsContactEntry",
|
||||
isPointer: false
|
||||
},
|
||||
default: true
|
||||
}
|
||||
}
|
||||
},
|
||||
uiSchema: {
|
||||
Email: {
|
||||
"ui:widget": "email"
|
||||
},
|
||||
IsContactEntry: {
|
||||
"ui:field": "HiddenField"
|
||||
}
|
||||
},
|
||||
userSchema: {
|
||||
email: "$Email",
|
||||
name: "$Name",
|
||||
password: "$Phone",
|
||||
phone: "$Phone",
|
||||
role: "contracts_User",
|
||||
username: "$Email"
|
||||
},
|
||||
rules: null,
|
||||
noValidate: false,
|
||||
liveValidate: false,
|
||||
isRegisterForm: true,
|
||||
help: {},
|
||||
description: "",
|
||||
class: "contracts_Users",
|
||||
buttons: {
|
||||
add: {
|
||||
resetText: "Reset",
|
||||
submitText: "Submit"
|
||||
},
|
||||
edit: { submitText: "Update", cancelText: "Cancel" }
|
||||
},
|
||||
formACL: {
|
||||
"#currentUser#": { read: true, write: true },
|
||||
"*": { read: true, write: true }
|
||||
},
|
||||
redirect_id: "",
|
||||
success_message: "Success!",
|
||||
success_redirect: "",
|
||||
validFunction:
|
||||
"ZnVuY3Rpb24gdmFsaWRhdGUoZm9ybURhdGEsIGVycm9ycykgeyBpZiAoZm9ybURhdGEucGFzczEgIT09IGZvcm1EYXRhLnBhc3MyKSB7IGVycm9ycy5wYXNzMi5hZGRFcnJvcignUGFzc3dvcmRzIGRvbid0IG1hdGNoJyk7IH0gcmV0dXJuIGVycm9yczsgfQ=="
|
||||
};
|
||||
return formData;
|
||||
}
|
||||
//json form for add users
|
||||
else if (id === "lM0xRnM3iE") {
|
||||
formData = {
|
||||
jsonSchema: {
|
||||
title: "Add User",
|
||||
description: "",
|
||||
type: "object",
|
||||
required: ["Name", "Email", "Phone", "JobTitle"],
|
||||
properties: {
|
||||
Name: {
|
||||
type: "string",
|
||||
title: "Name",
|
||||
maxLength: 50
|
||||
},
|
||||
Email: {
|
||||
type: "string",
|
||||
title: "Email",
|
||||
maxLength: 50
|
||||
},
|
||||
Phone: {
|
||||
type: "string",
|
||||
title: "Phone",
|
||||
maxLength: 50
|
||||
},
|
||||
JobTitle: {
|
||||
type: "string",
|
||||
title: "Job Title",
|
||||
maxLength: 50
|
||||
},
|
||||
Company: {
|
||||
type: "string",
|
||||
title: "Company",
|
||||
maxLength: 50
|
||||
}
|
||||
}
|
||||
},
|
||||
uiSchema: {
|
||||
Email: {
|
||||
"ui:widget": "email"
|
||||
},
|
||||
Phone: {
|
||||
"ui:options": {
|
||||
inputType: "tel"
|
||||
}
|
||||
}
|
||||
},
|
||||
userSchema: {
|
||||
email: "$Email",
|
||||
name: "$Name",
|
||||
password: "$Phone",
|
||||
phone: "$Phone",
|
||||
role: "contracts_User",
|
||||
username: "$Email"
|
||||
},
|
||||
rules: null,
|
||||
noValidate: false,
|
||||
liveValidate: false,
|
||||
isRegisterForm: true,
|
||||
help: {},
|
||||
description: "",
|
||||
class: "contracts_Users",
|
||||
buttons: {
|
||||
add: {
|
||||
resetText: "Reset",
|
||||
submitText: "Submit"
|
||||
},
|
||||
edit: { submitText: "Update", cancelText: "Cancel" }
|
||||
},
|
||||
formACL: {
|
||||
"#currentUser#": { read: true, write: true },
|
||||
"*": { read: true, write: true }
|
||||
},
|
||||
redirect_id: "",
|
||||
success_message: "Success!",
|
||||
success_redirect: "",
|
||||
validFunction:
|
||||
"ZnVuY3Rpb24gdmFsaWRhdGUoZm9ybURhdGEsIGVycm9ycykgeyBpZiAoZm9ybURhdGEucGFzczEgIT09IGZvcm1EYXRhLnBhc3MyKSB7IGVycm9ycy5wYXNzMi5hZGRFcnJvcignUGFzc3dvcmRzIGRvbid0IG1hdGNoJyk7IH0gcmV0dXJuIGVycm9yczsgfQ=="
|
||||
};
|
||||
return formData;
|
||||
} else if (id === "qUGywSWd8e") {
|
||||
formData = {
|
||||
jsonSchema: {
|
||||
title: "Add Contact",
|
||||
description: "",
|
||||
type: "object",
|
||||
required: ["Name", "Email", "Phone"],
|
||||
properties: {
|
||||
Name: {
|
||||
type: "string",
|
||||
title: "Name",
|
||||
maxLength: 50
|
||||
},
|
||||
Email: {
|
||||
type: "string",
|
||||
title: "Email",
|
||||
maxLength: 50
|
||||
},
|
||||
Phone: {
|
||||
type: "string",
|
||||
title: "Phone",
|
||||
maxLength: 50
|
||||
}
|
||||
}
|
||||
},
|
||||
uiSchema: {
|
||||
Email: {
|
||||
"ui:widget": "email"
|
||||
},
|
||||
Phone: {
|
||||
"ui:options": {
|
||||
inputType: "tel"
|
||||
}
|
||||
}
|
||||
},
|
||||
userSchema: {
|
||||
name: "$Name",
|
||||
username: "$Email",
|
||||
email: "$Email",
|
||||
password: "$Phone",
|
||||
phone: "$Phone",
|
||||
role: "contracts_Guest"
|
||||
},
|
||||
restrict_form_entry: {
|
||||
enable_captcha: false,
|
||||
allow_one_entry_per_ip_address: false,
|
||||
allow_one_entry_per_user: false,
|
||||
enable_geo_fence: false
|
||||
},
|
||||
restrict_form_access: {
|
||||
entryCount: ""
|
||||
},
|
||||
help: {},
|
||||
email_template: {
|
||||
from: "",
|
||||
to: "",
|
||||
subject: "",
|
||||
message: ""
|
||||
},
|
||||
buttons: {
|
||||
add: {
|
||||
submitText: "Submit",
|
||||
resetText: "Reset"
|
||||
},
|
||||
edit: {
|
||||
submitText: "Update",
|
||||
cancelText: "Cancel"
|
||||
}
|
||||
},
|
||||
appId: {
|
||||
__type: "Pointer",
|
||||
className: "w_appinfo",
|
||||
objectId: "aIPmIvMzGM"
|
||||
},
|
||||
formACL: {
|
||||
"*": {
|
||||
read: true,
|
||||
write: true
|
||||
},
|
||||
"#currentUser#": {
|
||||
read: true,
|
||||
write: true
|
||||
}
|
||||
},
|
||||
class: "contracts_Contactbook",
|
||||
description: "",
|
||||
success_message: "Success!",
|
||||
form_permission: "private",
|
||||
success_redirect: "",
|
||||
redirect_id: "",
|
||||
isRegisterForm: true,
|
||||
liveValidate: false,
|
||||
noValidate: false,
|
||||
validFunction:
|
||||
"ZnVuY3Rpb24gdmFsaWRhdGUoZm9ybURhdGEsIGVycm9ycykgeyBpZiAoZm9ybURhdGEucGFzczEgIT09IGZvcm1EYXRhLnBhc3MyKSB7IGVycm9ycy5wYXNzMi5hZGRFcnJvcignUGFzc3dvcmRzIGRvbid0IG1hdGNoJyk7IH0gcmV0dXJuIGVycm9yczsgfQ=="
|
||||
};
|
||||
return formData;
|
||||
"8mZzFxbG1z": {
|
||||
title: "Request Signature",
|
||||
msgVar: "Document",
|
||||
redirectRoute: "placeHolderSign",
|
||||
Cls: documentCls,
|
||||
signers: true
|
||||
},
|
||||
//json form for template
|
||||
template: {
|
||||
title: "New Template",
|
||||
redirectRoute: "template",
|
||||
msgVar: "Template",
|
||||
Cls: templateCls
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@ import Alert from "../primitives/Alert";
|
||||
import SelectFolder from "../components/fields/SelectFolder";
|
||||
import SignersInput from "../components/fields/SignersInput";
|
||||
import Title from "../components/Title";
|
||||
import PageNotFound from "./PageNotFound";
|
||||
|
||||
function Form() {
|
||||
const { id } = useParams();
|
||||
@@ -16,8 +17,12 @@ function Form() {
|
||||
if (id === "lM0xRnM3iE") {
|
||||
return <AddUser />;
|
||||
} else {
|
||||
const config = formJson(id) || {};
|
||||
return <Forms {...config} />;
|
||||
const config = formJson[id];
|
||||
if (config) {
|
||||
return <Forms {...config} />;
|
||||
} else {
|
||||
return <PageNotFound prefix={"Form"} />;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import React from "react";
|
||||
import Title from "../components/Title";
|
||||
|
||||
const PageNotFound = () => {
|
||||
const PageNotFound = ({ prefix }) => {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-screen w-full bg-white rounded">
|
||||
<Title title={"Page Not Found"} />
|
||||
@@ -10,7 +10,9 @@ const PageNotFound = () => {
|
||||
<h1 className="text-[60px] lg:text-[120px] font-semibold text-black">
|
||||
404
|
||||
</h1>
|
||||
<p className="text-[30px] lg:text-[50px] text-black">Page Not Found</p>
|
||||
<p className="text-[30px] lg:text-[50px] text-black">
|
||||
{prefix ? prefix : "Page"} Not Found
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -5,6 +5,7 @@ import axios from "axios";
|
||||
import reportJson from "../json/ReportJson";
|
||||
import { useParams } from "react-router-dom";
|
||||
import Title from "../components/Title";
|
||||
import PageNotFound from "./PageNotFound";
|
||||
|
||||
const Report = () => {
|
||||
const { id } = useParams();
|
||||
@@ -15,7 +16,7 @@ const Report = () => {
|
||||
const [heading, setHeading] = useState([]);
|
||||
const [isNextRecord, setIsNextRecord] = useState(false);
|
||||
const [isMoreDocs, setIsMoreDocs] = useState(true);
|
||||
const [form, setForm]= useState("")
|
||||
const [form, setForm] = useState("");
|
||||
const abortController = new AbortController();
|
||||
const docPerPage = 10;
|
||||
|
||||
@@ -51,7 +52,7 @@ const Report = () => {
|
||||
setActions(json.actions);
|
||||
setHeading(json.heading);
|
||||
setReportName(json.reportName);
|
||||
setForm(json.form)
|
||||
setForm(json.form);
|
||||
Parse.serverURL = localStorage.getItem("BaseUrl12");
|
||||
Parse.initialize(localStorage.getItem("AppID12"));
|
||||
const currentUser = Parse.User.current().id;
|
||||
@@ -159,13 +160,7 @@ const Report = () => {
|
||||
form={form}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex items-center justify-center h-screen w-full bg-white rounded">
|
||||
<div className="text-center">
|
||||
<p className="text-[30px] lg:text-[50px] text-black">
|
||||
Report Not Found
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<PageNotFound prefix={"Report"} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user