Merge branch 'Organization_Management' of https://git.marcoaiot.com/admin/marco.pms.web into Organization_Management
This commit is contained in:
commit
52e12426af
@ -19,15 +19,15 @@ import ManageProjectInfo from "../../components/Project/ManageProjectInfo";
|
|||||||
import showToast from "../../services/toastService";
|
import showToast from "../../services/toastService";
|
||||||
import { getCachedData, cacheData } from "../../slices/apiDataManager";
|
import { getCachedData, cacheData } from "../../slices/apiDataManager";
|
||||||
import GlobalModel from "../../components/common/GlobalModel";
|
import GlobalModel from "../../components/common/GlobalModel";
|
||||||
import {formatNumber} from "../../utils/dateUtils";
|
import { formatNumber } from "../../utils/dateUtils";
|
||||||
import { setProjectId } from "../../slices/localVariablesSlice";
|
import { setProjectId } from "../../slices/localVariablesSlice";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
const ProjectListView = ({ projectData, recall }) => {
|
const ProjectListView = ({ projectData, recall }) => {
|
||||||
const [projectInfo, setProjectInfo] = useState(projectData);
|
const [projectInfo, setProjectInfo] = useState(projectData);
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const { projects_Details, loading, error, refetch } = useProjectDetails(
|
const { projects_Details, loading, error, refetch } = useProjectDetails(
|
||||||
projectInfo?.id,false
|
projectInfo?.id, false
|
||||||
);
|
);
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -35,16 +35,16 @@ const ProjectListView = ({ projectData, recall }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setProjectInfo(projectData);
|
setProjectInfo(projectData);
|
||||||
}, [projectData]);
|
}, [projectData]);
|
||||||
const {
|
const {
|
||||||
mutate: updateProject,
|
mutate: updateProject,
|
||||||
isPending,
|
isPending,
|
||||||
isSuccess,
|
isSuccess,
|
||||||
isError,
|
isError,
|
||||||
} = useUpdateProject({
|
} = useUpdateProject({
|
||||||
onSuccessCallback: () => {
|
onSuccessCallback: () => {
|
||||||
setShowModal(false);
|
setShowModal(false);
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleShow = async () => {
|
const handleShow = async () => {
|
||||||
try {
|
try {
|
||||||
@ -65,6 +65,7 @@ const ProjectListView = ({ projectData, recall }) => {
|
|||||||
const handleClose = () => setShowModal(false);
|
const handleClose = () => setShowModal(false);
|
||||||
|
|
||||||
const handleViewProject = () => {
|
const handleViewProject = () => {
|
||||||
|
dispatch(setProjectId(projectInfo.id))
|
||||||
navigate(`/projects/details`);
|
navigate(`/projects/details`);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -81,18 +82,18 @@ const ProjectListView = ({ projectData, recall }) => {
|
|||||||
<>
|
<>
|
||||||
{showModal && projects_Details && (
|
{showModal && projects_Details && (
|
||||||
<GlobalModel isOpen={showModal} closeModal={handleClose}> <ManageProjectInfo
|
<GlobalModel isOpen={showModal} closeModal={handleClose}> <ManageProjectInfo
|
||||||
project={projects_Details}
|
project={projects_Details}
|
||||||
handleSubmitForm={handleFormSubmit}
|
handleSubmitForm={handleFormSubmit}
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
isPending={isPending}
|
isPending={isPending}
|
||||||
/></GlobalModel>
|
/></GlobalModel>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<tr className={`py-8 ${isPending ? "bg-light opacity-50 pointer-events-none" : ""} `}>
|
<tr className={`py-8 ${isPending ? "bg-light opacity-50 pointer-events-none" : ""} `}>
|
||||||
<td className="text-start" colSpan={5}>
|
<td className="text-start" colSpan={5}>
|
||||||
<span
|
<span
|
||||||
className="text-primary cursor-pointer"
|
className="text-primary cursor-pointer"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
dispatch(setProjectId(projectInfo.id))
|
dispatch(setProjectId(projectInfo.id))
|
||||||
navigate(`/projects/details`)
|
navigate(`/projects/details`)
|
||||||
}}
|
}}
|
||||||
@ -168,7 +169,7 @@ const ProjectListView = ({ projectData, recall }) => {
|
|||||||
<a
|
<a
|
||||||
aria-label="click to View details"
|
aria-label="click to View details"
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
onClick={() => navigate(`/projects/details`)}
|
onClick={handleViewProject}
|
||||||
>
|
>
|
||||||
<i className="bx bx-detail me-2"></i>
|
<i className="bx bx-detail me-2"></i>
|
||||||
<span className="align-left">View details</span>
|
<span className="align-left">View details</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user