diff --git a/src/components/Project/Infrastructure/FloorModel.jsx b/src/components/Project/Infrastructure/FloorModel.jsx index 1e748f77..2d64c275 100644 --- a/src/components/Project/Infrastructure/FloorModel.jsx +++ b/src/components/Project/Infrastructure/FloorModel.jsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; -import {getCachedData} from "../../../slices/apiDataManager"; +import { getCachedData } from "../../../slices/apiDataManager"; import showToast from "../../../services/toastService"; // Zod validation schema @@ -25,13 +25,11 @@ const FloorModel = ({ onSubmit, clearTrigger, onClearComplete, -} ) => -{ - +}) => { const [formData, setFormData] = useState(defaultModel); - const [ selectedBuilding, setSelectedBuilding ] = useState( {} ); + const [selectedBuilding, setSelectedBuilding] = useState({}); const [buildings, setBuildings] = useState(project?.buildings || []); - + // Initialize the form with React Hook Form const { register, @@ -45,14 +43,12 @@ const FloorModel = ({ defaultValues: defaultModel, }); - useEffect( () => - { - + useEffect(() => { if (clearTrigger) { reset(defaultModel); onClearComplete(); } - }, [clearTrigger, onClearComplete, reset,]); + }, [clearTrigger, onClearComplete, reset]); // Handle building selection change const handleBuildigChange = (e) => { @@ -64,7 +60,6 @@ const FloorModel = ({ id: "", floorName: "", buildingId: building.id, - }); setValue("buildingId", building.id); // Set value for validation setValue("id", "0"); // Reset floorId when changing building @@ -74,13 +69,10 @@ const FloorModel = ({ id: "", floorName: "", buildingId: "0", - }); setValue("buildingId", "0"); } }; - - // Handle floor selection change const handleFloorChange = (e) => { @@ -91,15 +83,13 @@ const FloorModel = ({ id: floor.id, floorName: floor.floorName, buildingId: selectedBuilding.id, - }); - setValue("floorName", floor.floorName); + setValue("floorName", floor.floorName); } else { setFormData({ id: "0", floorName: "", buildingId: selectedBuilding.id, - }); setValue("floorName", ""); } @@ -107,36 +97,32 @@ const FloorModel = ({ // Handle form submission const onFormSubmit = (data) => { - onSubmit( data ); - reset( - { - floorName: "" - } ) - if ( data.id !== "0" ) - { - showToast( "Floor updated successfully.", "success" ); - } else - { - showToast( "Floor created successfully.", "success" ); - } - + onSubmit(data); + reset({ + floorName: "", + }); + if (data.id !== "0") { + showToast("Floor updated successfully.", "success"); + } else { + showToast("Floor created successfully.", "success"); + } }; - - return (
- -
diff --git a/src/components/Project/Infrastructure/WorkItem.jsx b/src/components/Project/Infrastructure/WorkItem.jsx index ab85c28d..d568c14c 100644 --- a/src/components/Project/Infrastructure/WorkItem.jsx +++ b/src/components/Project/Infrastructure/WorkItem.jsx @@ -8,6 +8,7 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { const [itemName, setItemName] = useState(""); const [NewWorkItem, setNewWorkItem] = useState(); const [isModalOpen, setIsModalOpen] = useState(false); + const [showModal, setShowModal] = useState(false); const openModal = () => setIsModalOpen(true); const closeModal = () => setIsModalOpen(false); @@ -38,6 +39,8 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { tooltipTriggerList.forEach((el) => new bootstrap.Tooltip(el)); }, []); + const showModal1 = () => setShowModal(true); + const closeModal1 = () => setShowModal(false); return ( <>
{
+
+
+
+
+ +
+ +
Comming Soon
+
+
+
+
+ @@ -119,6 +149,7 @@ const WorkItem = ({ workItem, forBuilding, forFloor, forWorkArea }) => { aria-label="Modify" type="button" className="btn p-0 dropdown-toggle hide-arrow" + onClick={showModal1} > { aria-label="Delete" type="button" className="btn p-0 dropdown-toggle hide-arrow" + onClick={showModal1} > {