diff --git a/public/assets/css/core-extend.css b/public/assets/css/core-extend.css index 2e9e51ef..8ec6df19 100644 --- a/public/assets/css/core-extend.css +++ b/public/assets/css/core-extend.css @@ -280,3 +280,7 @@ .w-8-xl{ width: 2rem; } .w-10-xl{ width: 2.5rem; } } + +.cursor-not-allowed{ + cursor: not-allowed; +} diff --git a/src/components/Activities/Attendance.jsx b/src/components/Activities/Attendance.jsx index 9a082976..c46feac3 100644 --- a/src/components/Activities/Attendance.jsx +++ b/src/components/Activities/Attendance.jsx @@ -126,7 +126,7 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat checked={ShowPending} onChange={(e) => setShowPending(e.target.checked)} /> - + {attLoading ? ( diff --git a/src/components/Activities/AttendcesLogs.jsx b/src/components/Activities/AttendcesLogs.jsx index 8f8a55ac..0a917968 100644 --- a/src/components/Activities/AttendcesLogs.jsx +++ b/src/components/Activities/AttendcesLogs.jsx @@ -190,7 +190,7 @@ useEffect(() => { checked={showPending} onChange={(e) => setShowPending(e.target.checked)} /> - + diff --git a/src/components/Charts/HorizontalBarChart.jsx b/src/components/Charts/HorizontalBarChart.jsx index 82608da6..5a02c98f 100644 --- a/src/components/Charts/HorizontalBarChart.jsx +++ b/src/components/Charts/HorizontalBarChart.jsx @@ -23,7 +23,7 @@ const HorizontalBarChart = ({ if (loading) { return (
- Loading chart... + Loading chart... {/* Replace this with a skeleton or spinner if you prefer */}
); diff --git a/src/components/Dashboard/ProjectCompletionChart.jsx b/src/components/Dashboard/ProjectCompletionChart.jsx index 8ce4b13a..decf7918 100644 --- a/src/components/Dashboard/ProjectCompletionChart.jsx +++ b/src/components/Dashboard/ProjectCompletionChart.jsx @@ -3,7 +3,8 @@ import HorizontalBarChart from "../Charts/HorizontalBarChart"; import { useProjects } from "../../hooks/useProjects"; const ProjectCompletionChart = () => { - const { projects, loading } = useProjects(); + const { data: projects = [], isLoading: loading, isError, error } = useProjects(); + // Bar chart logic const projectNames = projects?.map((p) => p.name) || []; @@ -11,7 +12,7 @@ const ProjectCompletionChart = () => { projects?.map((p) => { const completed = p.completedWork || 0; const planned = p.plannedWork || 1; - const percent = (completed / planned) * 100; + const percent = planned ? (completed / planned) * 100 : 0; return Math.min(Math.round(percent), 100); }) || []; diff --git a/src/components/Documents/DocumentFilterPanel.jsx b/src/components/Documents/DocumentFilterPanel.jsx index 15a2cbf1..581277e8 100644 --- a/src/components/Documents/DocumentFilterPanel.jsx +++ b/src/components/Documents/DocumentFilterPanel.jsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { useDocumentFilterEntities } from "../../hooks/useDocument"; import { FormProvider, useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; @@ -9,9 +9,11 @@ import { import { DateRangePicker1 } from "../common/DateRangePicker"; import SelectMultiple from "../common/SelectMultiple"; import moment from "moment"; +import { useLocation } from "react-router-dom"; const DocumentFilterPanel = ({ entityTypeId, onApply }) => { const [resetKey, setResetKey] = useState(0); + const location = useLocation(); const { data, isError, isLoading, error } = useDocumentFilterEntities(entityTypeId); @@ -52,6 +54,13 @@ const DocumentFilterPanel = ({ entityTypeId, onApply }) => { closePanel(); }; + // Close popup when navigating to another component + useEffect(() => { + return () => { + closePanel(); + }; + }, []); + if (isLoading) return
Loading...
; if (isError) return
Error: {error?.message || "Something went wrong!"}
; @@ -63,6 +72,8 @@ const DocumentFilterPanel = ({ entityTypeId, onApply }) => { documentTag = [], } = data?.data || {}; + + return (
@@ -73,18 +84,16 @@ const DocumentFilterPanel = ({ entityTypeId, onApply }) => {
-
+
{(isSelf || canUploadDocument) && (
{data?.isActive ? "Active" : "In-Active"}{" "} @@ -105,9 +104,101 @@ const VieworgDataanization = ({ orgId }) => {
{data?.address}
-
- {" "} - Projects And Services +
+ + + {/* remove "show" from className */} +
+ {data?.projects && data.projects.length > 0 ? ( + data.projects + .reduce((acc, curr) => { + const projectId = curr.project.id; + if (!acc.find((p) => p.id === projectId)) { + acc.push(curr.project); + } + return acc; + }, []) + .map((project) => ( +
+ + +
+ {data.projects + .filter((p) => p.project.id === project.id) + .map((p) => ( +
+ + {p.service.name} +
+ ))} +
+
+ )) + ) : ( +
No projects available
+ )} +
+
+ + {/* Services Section */} +
+ + + {/* collapse is closed initially */} +
+ {data?.services && data.services.length > 0 ? ( +
+ {data.services.map((service) => ( +
+
+
+
+ + {service.name} +
+

+ {service.description || "No description available."} +

+
+
+
+ ))} +
+ ) : ( +
No services available
+ )} +
); diff --git a/src/components/Project/Infrastructure/WorkArea.jsx b/src/components/Project/Infrastructure/WorkArea.jsx index 59f281be..c5925321 100644 --- a/src/components/Project/Infrastructure/WorkArea.jsx +++ b/src/components/Project/Infrastructure/WorkArea.jsx @@ -104,7 +104,7 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { -
+
{ className="form-check-label ms-2" htmlFor="activeEmployeeSwitch" > - {activeEmployee ? "Active Employees" : "Include Inactive Employees"} + {activeEmployee ? "Active Employees" : "In-active Employees"}
diff --git a/src/pages/Directory/ContactFilterPanel.jsx b/src/pages/Directory/ContactFilterPanel.jsx index 3c9c580a..063a6268 100644 --- a/src/pages/Directory/ContactFilterPanel.jsx +++ b/src/pages/Directory/ContactFilterPanel.jsx @@ -1,5 +1,5 @@ import { zodResolver } from "@hookform/resolvers/zod"; -import React from "react"; +import React, { useEffect } from "react"; import { FormProvider, useForm } from "react-hook-form"; import { contactsFilter, @@ -8,11 +8,14 @@ import { import { useContactFilter } from "../../hooks/useDirectory"; import { ExpenseFilterSkeleton } from "../../components/Expenses/ExpenseSkeleton"; import SelectMultiple from "../../components/common/SelectMultiple"; +import { useLocation } from "react-router-dom"; const ContactFilterPanel = ({ onApply, clearFilter }) => { const { data, isError, isLoading, error, isFetched, isFetching } = useContactFilter(); + const location = useLocation(); + const methods = useForm({ resolver: zodResolver(contactsFilter), defaultValues: defaultContactFilter, @@ -30,14 +33,24 @@ const ContactFilterPanel = ({ onApply, clearFilter }) => { }; const handleClose = () => { - reset(defaultContactFilter); - onApply(defaultContactFilter); + reset(defaultContactFilter); + onApply(defaultContactFilter); closePanel(); }; + + useEffect(() => { + return () => { + closePanel(); + }; + }, []); + if (isLoading || isFetching) return ; if (isError && isFetched) return
Something went wrong Here- {error.message}
; + + + return ( diff --git a/src/pages/Directory/DirectoryPage.jsx b/src/pages/Directory/DirectoryPage.jsx index a2a3e1a5..e0871446 100644 --- a/src/pages/Directory/DirectoryPage.jsx +++ b/src/pages/Directory/DirectoryPage.jsx @@ -139,9 +139,8 @@ export default function DirectoryPage({ IsPage = true, projectId = null }) { + - - diff --git a/src/pages/Directory/NoteFilterPanel.jsx b/src/pages/Directory/NoteFilterPanel.jsx index 87abd52d..0b21fc46 100644 --- a/src/pages/Directory/NoteFilterPanel.jsx +++ b/src/pages/Directory/NoteFilterPanel.jsx @@ -1,5 +1,5 @@ import { zodResolver } from "@hookform/resolvers/zod"; -import React from "react"; +import React, { useEffect } from "react"; import { FormProvider, useForm } from "react-hook-form"; import { defaultNotesFilter, @@ -8,11 +8,18 @@ import { import { useContactFilter, useNoteFilter } from "../../hooks/useDirectory"; import { ExpenseFilterSkeleton } from "../../components/Expenses/ExpenseSkeleton"; import SelectMultiple from "../../components/common/SelectMultiple"; +import { useLocation } from "react-router-dom"; const NoteFilterPanel = ({ onApply, clearFilter }) => { const { data, isError, isLoading, error, isFetched, isFetching } = useNoteFilter(); + useEffect(() => { + return () => { + closePanel(); + }; + }, []); + const methods = useForm({ resolver: zodResolver(notesFilter), defaultValues: defaultNotesFilter, @@ -31,7 +38,7 @@ const NoteFilterPanel = ({ onApply, clearFilter }) => { const handleClose = () => { reset(defaultNotesFilter); - onApply(defaultNotesFilter); + onApply(defaultNotesFilter); closePanel(); }; diff --git a/src/pages/employee/EmployeeList.jsx b/src/pages/employee/EmployeeList.jsx index ca8e6d66..2018afb2 100644 --- a/src/pages/employee/EmployeeList.jsx +++ b/src/pages/employee/EmployeeList.jsx @@ -176,12 +176,10 @@ const EmployeeList = () => { useEffect(() => { if (!loading && Array.isArray(employees)) { const sorted = [...employees].sort((a, b) => { - const nameA = `${a.firstName || ""}${a.middleName || ""}${ - a.lastName || "" - }`.toLowerCase(); - const nameB = `${b.firstName || ""}${b.middleName || ""}${ - b.lastName || "" - }`.toLowerCase(); + const nameA = `${a.firstName || ""}${a.middleName || ""}${a.lastName || "" + }`.toLowerCase(); + const nameB = `${b.firstName || ""}${b.middleName || ""}${b.lastName || "" + }`.toLowerCase(); return nameA?.localeCompare(nameB); }); @@ -258,9 +256,8 @@ const EmployeeList = () => { ? "Suspend Employee" : "Reactivate Employee" } - message={`Are you sure you want to ${ - selectedEmpFordelete?.isActive ? "suspend" : "reactivate" - } this employee?`} + message={`Are you sure you want to ${selectedEmpFordelete?.isActive ? "suspend" : "reactivate" + } this employee?`} onSubmit={(id) => suspendEmployee({ employeeId: id, @@ -309,7 +306,7 @@ const EmployeeList = () => { className="form-check-label ms-0" htmlFor="inactiveEmployeesCheckbox" > - Show Inactive Employees + In-active Employees @@ -471,9 +468,8 @@ const EmployeeList = () => { Status { )} {!loading && - displayData?.length === 0 && - (!searchText ) ? ( + displayData?.length === 0 && + (!searchText) ? ( -
+
No Data Found -
+
) : null} - {!loading && - displayData?.length === 0 && - (searchText ) ? ( + {!loading && + displayData?.length === 0 && + (searchText) ? (
@@ -542,18 +538,17 @@ const EmployeeList = () => {
- + {item.email ? ( {item.email} ) : ( - - - - + NA )} + @@ -567,9 +562,14 @@ const EmployeeList = () => { - - {moment(item.joiningDate)?.format("DD-MMM-YYYY")} + + {item.joiningDate ? ( + moment(item.joiningDate).format("DD-MMM-YYYY") + ) : ( + NA + )} + {showInactive ? ( { -
+