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