@@ -11,6 +11,7 @@ import { collection, setDoc, updateDoc, doc } from "firebase/firestore";
|
|||||||
import { AppContext } from "../../Hooks/useContext/appContext.js";
|
import { AppContext } from "../../Hooks/useContext/appContext.js";
|
||||||
import { db } from "../../firebase";
|
import { db } from "../../firebase";
|
||||||
import { objectMap } from "../../Utils/Object";
|
import { objectMap } from "../../Utils/Object";
|
||||||
|
import { createCaseFields as fields } from "../../Constants/Fields/CreateCaseFields.js";
|
||||||
import "../../styles/modals.scss";
|
import "../../styles/modals.scss";
|
||||||
import {
|
import {
|
||||||
getFormDataDefaults,
|
getFormDataDefaults,
|
||||||
@@ -29,27 +30,6 @@ const CreateModal = ({ setShowModal, caseData }) => {
|
|||||||
const editCaseId = caseData?.id;
|
const editCaseId = caseData?.id;
|
||||||
const isEditing = typeof editCaseId !== "undefined";
|
const isEditing = typeof editCaseId !== "undefined";
|
||||||
|
|
||||||
const fields = {
|
|
||||||
caption: { required: true, maxLength: 45 },
|
|
||||||
captionTwo: { required: true, maxLength: 45 },
|
|
||||||
caseNumber: { required: true, maxLength: 45 },
|
|
||||||
judge: { required: true, maxLength: 45 },
|
|
||||||
plaintiffParties: { required: true, maxLength: 45 },
|
|
||||||
defendantParties: { required: true, maxLength: 45 },
|
|
||||||
jurisdiction: { required: true, maxLength: 45 },
|
|
||||||
billingCode: { required: true, maxLength: 45 },
|
|
||||||
venue: { required: true, maxLength: 45 },
|
|
||||||
caseType: { required: true, maxLength: 45 },
|
|
||||||
trialDate: { required: true, maxLength: 45, type: "date" },
|
|
||||||
filedDate: { required: true, maxLength: 45, type: "date" },
|
|
||||||
contactFirstName: { required: true, maxLength: 45 },
|
|
||||||
contactLastName: { required: true, maxLength: 45 },
|
|
||||||
contactEmail: { required: true, maxLength: 45, type: "email" },
|
|
||||||
leadAttorneys: { required: true, maxLength: 45 },
|
|
||||||
lawFirm: { required: false, maxLength: 45 },
|
|
||||||
clientPosition: { required: true, default: "Defendant" },
|
|
||||||
};
|
|
||||||
|
|
||||||
const [isBusy, setIsBusy] = useState(false);
|
const [isBusy, setIsBusy] = useState(false);
|
||||||
const [data, setData] = useState(
|
const [data, setData] = useState(
|
||||||
getFormDataDefaults(fields, isEditing ? caseData : undefined)
|
getFormDataDefaults(fields, isEditing ? caseData : undefined)
|
||||||
|
|||||||
20
src/Constants/Fields/CreateCaseFields.js
Normal file
20
src/Constants/Fields/CreateCaseFields.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
export const createCaseFields = {
|
||||||
|
caption: { required: true, maxLength: 45 },
|
||||||
|
captionTwo: { required: true, maxLength: 45 },
|
||||||
|
caseNumber: { required: true, maxLength: 45 },
|
||||||
|
judge: { required: true, maxLength: 45 },
|
||||||
|
plaintiffParties: { required: true, maxLength: 45 },
|
||||||
|
defendantParties: { required: true, maxLength: 45 },
|
||||||
|
jurisdiction: { required: true, maxLength: 45 },
|
||||||
|
billingCode: { required: true, maxLength: 45 },
|
||||||
|
venue: { required: true, maxLength: 45 },
|
||||||
|
caseType: { required: true, maxLength: 45 },
|
||||||
|
trialDate: { required: true, maxLength: 45, type: "date" },
|
||||||
|
filedDate: { required: true, maxLength: 45, type: "date" },
|
||||||
|
contactFirstName: { required: true, maxLength: 45 },
|
||||||
|
contactLastName: { required: true, maxLength: 45 },
|
||||||
|
contactEmail: { required: true, maxLength: 45, type: "email" },
|
||||||
|
leadAttorneys: { required: true, maxLength: 45 },
|
||||||
|
lawFirm: { required: false, maxLength: 45 },
|
||||||
|
clientPosition: { required: true, default: "Defendant" },
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user