-
+
+
);
diff --git a/src/components/Project/Infrastructure/WorkAreaModel.jsx b/src/components/Project/Infrastructure/WorkAreaModel.jsx
index adab5677..3da776cd 100644
--- a/src/components/Project/Infrastructure/WorkAreaModel.jsx
+++ b/src/components/Project/Infrastructure/WorkAreaModel.jsx
@@ -5,13 +5,14 @@ import { z } from "zod";
import showToast from "../../../services/toastService";
import { useManageProjectInfra } from "../../../hooks/useProjects";
import { useSelector } from "react-redux";
+import Label from "../../common/Label";
const workAreaSchema = z.object({
id: z.string().optional(),
buildingId: z.string().refine((val) => val !== "0", {
- message: "Building is required",
-}),
- floorId: z.string().refine((val)=>val !== "0",{message:"Floor is required"}),
+ message: "Building is required",
+ }),
+ floorId: z.string().refine((val) => val !== "0", { message: "Floor is required" }),
areaName: z.string().min(3, "Work Area Name must be at least 3 characters"),
});
@@ -25,7 +26,7 @@ const defaultModel = {
const WorkAreaModel = ({ project, onSubmit, onClose }) => {
const [selectedBuilding, setSelectedBuilding] = useState(null);
const [selectedFloor, setSelectedFloor] = useState(null);
- const selectedProject = useSelector((store)=>store.localVariables.projectId)
+ const selectedProject = useSelector((store) => store.localVariables.projectId)
const {
register,
handleSubmit,
@@ -84,8 +85,7 @@ const WorkAreaModel = ({ project, onSubmit, onClose }) => {
reset(defaultModel);
}, []);
- const onSubmitForm = ( data ) =>
- {
+ const onSubmitForm = (data) => {
const payload = {
id: data.id === "0" ? null : data.id,
areaName: data.areaName,
@@ -108,51 +108,51 @@ const WorkAreaModel = ({ project, onSubmit, onClose }) => {
Manage Work Area
-
-
+
+
+
+ {errors.buildingId && (
+
{errors.buildingId.message}
+ )}
+
+
+ {watchBuildingId !== "0" && (
+
+
- {errors.buildingId && (
-
{errors.buildingId.message}
+ {errors.floorId && (
+
{errors.floorId.message}
)}
-
- {watchBuildingId !== "0" && (
-
-
-
- {errors.floorId && (
-
{errors.floorId.message}
- )}
-
- )}
+ )}
{watchFloorId !== "0" && (
<>
-
+
-
-