diff --git a/src/components/Activities/AttendLogs.jsx b/src/components/Activities/AttendLogs.jsx index 7c1e686d..39af03ab 100644 --- a/src/components/Activities/AttendLogs.jsx +++ b/src/components/Activities/AttendLogs.jsx @@ -123,12 +123,15 @@ const AttendLogs = ({ Id }) => { }, []); return (
-
+
+
Attendance Logs
{logs && !loading && ( -

- Attendance logs for{" "} - {logs[0]?.employee?.firstName + " " + logs[0]?.employee?.lastName}{" "} - on {formatUTCToLocalTime(logs[0]?.activityTime)} +

+ Showing logs for{" "} + + {logs[0]?.employee?.firstName + " " + logs[0]?.employee?.lastName} + {" "} + on {formatUTCToLocalTime(logs[0]?.activityTime)}

)}
@@ -142,9 +145,9 @@ const AttendLogs = ({ Id }) => { + - @@ -156,11 +159,16 @@ const AttendLogs = ({ Id }) => { .sort((a, b) => b.id - a.id) .map((log, index) => ( - - + + +
Activity Date TimeActivity Location Recored By Description
{formatUTCToLocalTime(log.activityTime)}{convertShortTime(log.activityTime)} {whichActivityPerform(log.activity, log.activityTime)} +
+ {formatUTCToLocalTime(log.activityTime)} +
+
{convertShortTime(log.activityTime)} {log?.latitude != 0 ? ( { )} - {`${log?.updatedByEmployee?.firstName ?? ""} ${ - log?.updatedByEmployee?.lastName ?? "" - }`} + {`${log?.updatedByEmployee?.firstName ?? ""} ${log?.updatedByEmployee?.lastName ?? "" + }`} {log?.comment?.length > 50 diff --git a/src/components/Activities/Attendance.jsx b/src/components/Activities/Attendance.jsx index b7ddfaff..681434df 100644 --- a/src/components/Activities/Attendance.jsx +++ b/src/components/Activities/Attendance.jsx @@ -11,6 +11,7 @@ import { useSelector } from "react-redux"; import { useQueryClient } from "@tanstack/react-query"; import eventBus from "../../services/eventBus"; import { useSelectedProject } from "../../slices/apiDataManager"; +import { SpinnerLoader } from "../common/Loader"; const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizationId, }) => { const queryClient = useQueryClient(); @@ -110,28 +111,41 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat return ( <> +
+ {/* Left side - Date */} +
+ Date: {formatUTCToLocalTime(todayDate)} +
+ + {/* Right side - Pending Attendance toggle */} +
+ setShowPending(e.target.checked)} + /> + +
+
-
- Date : {formatUTCToLocalTime(todayDate)} -
- setShowPending(e.target.checked)} - /> - -
-
{attLoading ? ( -
Loading...
+
+ +
) : currentItems?.length > 0 ? ( + <> diff --git a/src/components/Activities/AttendcesLogs.jsx b/src/components/Activities/AttendcesLogs.jsx index 4660f956..f1d8e008 100644 --- a/src/components/Activities/AttendcesLogs.jsx +++ b/src/components/Activities/AttendcesLogs.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useState, useMemo, useCallback } from "react"; import moment from "moment"; import Avatar from "../common/Avatar"; -import { convertShortTime } from "../../utils/dateUtils"; +import { convertShortTime, formatUTCToLocalTime } from "../../utils/dateUtils"; import RenderAttendanceStatus from "./RenderAttendanceStatus"; import { useSelector, useDispatch } from "react-redux"; import DateRangePicker from "../common/DateRangePicker"; @@ -16,6 +16,7 @@ import { useAttendancesLogs } from "../../hooks/useAttendance"; import { queryClient } from "../../layouts/AuthLayout"; import { ITEMS_PER_PAGE } from "../../utils/constants"; import { useNavigate } from "react-router-dom"; +import { SpinnerLoader } from "../common/Loader"; const usePagination = (data, itemsPerPage) => { const [currentPage, setCurrentPage] = useState(1); @@ -174,49 +175,51 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => { return ( <>
-
- {/* Date Range Picker */} -
- -
- - {/* Pending Attendance Switch */} -
- setShowPending(e.target.checked)} - /> - -
+ {/* Left Side - Date Picker */} +
+
+ {/* Right Side - Pending Attendance Switch */} +
+ setShowPending(e.target.checked)} + /> + +
+
{isLoading ? (
-

Loading...

+
) : filteredSearchData?.length > 0 ? ( +
@@ -255,8 +258,8 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => { className="table-row-header" > diff --git a/src/components/Activities/InfraPlanning.jsx b/src/components/Activities/InfraPlanning.jsx index e7a4003a..08f03a93 100644 --- a/src/components/Activities/InfraPlanning.jsx +++ b/src/components/Activities/InfraPlanning.jsx @@ -24,8 +24,7 @@ import { useProfile } from "../../hooks/useProfile"; import { refreshData, setProjectId } from "../../slices/localVariablesSlice"; import InfraTable from "../Project/Infrastructure/InfraTable"; import { useSelectedProject } from "../../slices/apiDataManager"; -import Loader from "../common/Loader"; - +import { SpinnerLoader } from "../common/Loader"; const InfraPlanning = () => { const { profile: LoggedUser, refetch: fetchData } = useProfile(); const dispatch = useDispatch(); @@ -57,7 +56,14 @@ const InfraPlanning = () => { } if (isLoading) { - return ; + return ( +
+ +
+ ); } if (isFetched && (!projectInfra || projectInfra.length === 0)) { diff --git a/src/components/Activities/Regularization.jsx b/src/components/Activities/Regularization.jsx index 954820c2..8e0ff865 100644 --- a/src/components/Activities/Regularization.jsx +++ b/src/components/Activities/Regularization.jsx @@ -15,6 +15,7 @@ import { import { useQueryClient } from "@tanstack/react-query"; import Pagination from "../../components/common/Pagination"; import { useNavigate } from "react-router-dom"; +import { SpinnerLoader } from "../common/Loader"; const Regularization = ({ handleRequest, @@ -106,15 +107,15 @@ const Regularization = ({ return (
{loading ? (
-

Loading...

+
) : currentItems?.length > 0 ? (
- - {moment(currentDate).format("DD-MM-YYYY")} + + {formatUTCToLocalTime(currentDate)}
diff --git a/src/components/Charts/HorizontalBarChart.jsx b/src/components/Charts/HorizontalBarChart.jsx index 5a02c98f..c28778fc 100644 --- a/src/components/Charts/HorizontalBarChart.jsx +++ b/src/components/Charts/HorizontalBarChart.jsx @@ -1,6 +1,7 @@ import React from "react"; import ReactApexChart from "react-apexcharts"; import PropTypes from "prop-types"; +import { SpinnerLoader } from "../common/Loader"; const HorizontalBarChart = ({ seriesData = [], @@ -23,8 +24,12 @@ const HorizontalBarChart = ({ if (loading) { return (
- Loading chart... - {/* Replace this with a skeleton or spinner if you prefer */} +
+ +
); } diff --git a/src/components/Charts/LineChart.jsx b/src/components/Charts/LineChart.jsx index 6eb4840c..be8b5ebe 100644 --- a/src/components/Charts/LineChart.jsx +++ b/src/components/Charts/LineChart.jsx @@ -1,6 +1,7 @@ import React from "react"; import ReactApexChart from "react-apexcharts"; import PropTypes from "prop-types"; +import { SpinnerLoader } from "../common/Loader"; const LineChart = ({ seriesData = [], @@ -9,24 +10,28 @@ const LineChart = ({ loading = false, lineChartCategoriesDates = [], }) => { - const hasValidData = - Array.isArray(seriesData) && - seriesData.length > 0 && - Array.isArray(categories) && - categories.length > 0; + const hasValidData = + Array.isArray(seriesData) && + seriesData.length > 0 && + Array.isArray(categories) && + categories.length > 0; - if (loading) { - return ( -
-
- Loading chart... -
- ); - } + if (loading) { + return ( +
+
+ +
+
+ ); + } - if (!hasValidData) { - return
No data to display
; - } + if (!hasValidData) { + return
No data to display
; + } const chartOptions = { chart: { @@ -129,16 +134,16 @@ const LineChart = ({ }; LineChart.propTypes = { - seriesData: PropTypes.arrayOf( - PropTypes.shape({ - name: PropTypes.string.isRequired, - data: PropTypes.arrayOf(PropTypes.number).isRequired - }) - ), - categories: PropTypes.arrayOf(PropTypes.string), - colors: PropTypes.arrayOf(PropTypes.string), - title: PropTypes.string, - loading: PropTypes.bool + seriesData: PropTypes.arrayOf( + PropTypes.shape({ + name: PropTypes.string.isRequired, + data: PropTypes.arrayOf(PropTypes.number).isRequired + }) + ), + categories: PropTypes.arrayOf(PropTypes.string), + colors: PropTypes.arrayOf(PropTypes.string), + title: PropTypes.string, + loading: PropTypes.bool }; export default LineChart; diff --git a/src/components/Dashboard/AttendanceChart.jsx b/src/components/Dashboard/AttendanceChart.jsx index 67950d9a..71d14e48 100644 --- a/src/components/Dashboard/AttendanceChart.jsx +++ b/src/components/Dashboard/AttendanceChart.jsx @@ -4,6 +4,7 @@ import ReactApexChart from "react-apexcharts"; import { useAttendanceOverviewData } from "../../hooks/useDashboard_Data"; import flatColors from "../Charts/flatColor"; import ChartSkeleton from "../Charts/Skelton"; +import { SpinnerLoader } from "../common/Loader"; const formatDate = (dateStr) => { const date = new Date(dateStr); @@ -99,7 +100,7 @@ const AttendanceOverview = () => { }; return ( -
+
{/* Header */}
@@ -117,18 +118,16 @@ const AttendanceOverview = () => {
{/* Content */} -
+
{loading ? ( - + ) : error ? (

{error}

+ ) : attendanceOverviewData.length === 0 || + attendanceOverviewData.every((item) => item.present === 0) ? ( +
No data found
) : view === "chart" ? (
{ style={{ position: "sticky", top: 0, zIndex: 1 }} >
- + {dates.map((date, idx) => ( - {roles.map((role) => ( {tableData.map((row, idx) => { const value = row[role]; - const cellStyle = - value > 0 ? { backgroundColor: "#d5d5d5" } : {}; + const cellStyle = value > 0 ? { backgroundColor: "#d5d5d5" } : {}; return (
- Role - Role { ))}
{role} {value} diff --git a/src/components/Dashboard/Dashboard.jsx b/src/components/Dashboard/Dashboard.jsx index 4c09056a..3d0f0a66 100644 --- a/src/components/Dashboard/Dashboard.jsx +++ b/src/components/Dashboard/Dashboard.jsx @@ -63,12 +63,12 @@ const Dashboard = () => {
-
+
{!isAllProjectsSelected && ( -
+
)} diff --git a/src/components/Dashboard/ExpenseAnalysis.jsx b/src/components/Dashboard/ExpenseAnalysis.jsx index f398e8b5..92465d13 100644 --- a/src/components/Dashboard/ExpenseAnalysis.jsx +++ b/src/components/Dashboard/ExpenseAnalysis.jsx @@ -6,6 +6,7 @@ import { DateRangePicker1 } from "../common/DateRangePicker"; import { FormProvider, useForm } from "react-hook-form"; import { formatCurrency, localToUtc } from "../../utils/appUtils"; import { useProjectName } from "../../hooks/useProjects"; +import { SpinnerLoader } from "../common/Loader"; const ExpenseAnalysis = () => { const projectId = useSelectedProject(); @@ -78,86 +79,92 @@ const ExpenseAnalysis = () => { return ( <> - -
-
-
Expense Breakdown
- {/*

Category Wise Expense Breakdown

*/} -

{projectName}

-
-
- - - -
+
+
+
Expense Breakdown
+ {/*

Category Wise Expense Breakdown

*/} +

{projectName}

- {/* Card body */} -
- {isLoading && ( -
- Loading... +
+ + + +
+
+ + {/* Card body */} +
+ {isLoading && ( +
+ +
+ )} + + {!isLoading && report.length === 0 && ( +
+ No data found +
+ )} + + + {!isLoading && report.length > 0 && ( + <> + {isFetching && ( +
+ Loading... +
+ )} + +
+
- )} - {!isLoading && report.length === 0 && ( -
No data found
- )} - - {!isLoading && report.length > 0 && ( - <> - {isFetching && ( -
- Loading... -
- )} - -
- -
- -
-
- {report.map((item, idx) => ( -
-
- - - -
-
- {item.projectName} - - {formatCurrency(item.totalApprovedAmount)} - -
+
+
+ {report.map((item, idx) => ( +
+
+ + +
- ))} -
+
+ {item.projectName} + + {formatCurrency(item.totalApprovedAmount)} + +
+
+ ))}
- - )} -
- +
+ + )} +
+ {/* Header */} diff --git a/src/components/Dashboard/ExpenseByProject.jsx b/src/components/Dashboard/ExpenseByProject.jsx index 96e3fb56..1c87ef33 100644 --- a/src/components/Dashboard/ExpenseByProject.jsx +++ b/src/components/Dashboard/ExpenseByProject.jsx @@ -7,6 +7,7 @@ import { formatCurrency } from "../../utils/appUtils"; import { formatDate_DayMonth } from "../../utils/dateUtils"; import { useProjectName } from "../../hooks/useProjects"; import { useSelectedProject } from "../../slices/apiDataManager"; +import { SpinnerLoader } from "../common/Loader"; const ExpenseByProject = () => { const projectId = useSelector((store) => store.localVariables.projectId); @@ -63,6 +64,12 @@ const ExpenseByProject = () => { categories: chartData.categories, labels: { style: { fontSize: "12px" }, rotate: -45 }, }, + yaxis: { + labels: { + formatter: (val) => formatCurrency(val), + style: { fontSize: "12px", colors: "#555" }, + }, + }, tooltip: { y: { formatter: (val) => `${formatCurrency(val)} (${getSelectedTypeName()})`, @@ -82,15 +89,15 @@ const ExpenseByProject = () => { ]; return ( -
+
{/* Header */}
-
+
Monthly Expense -

{projectName}

-
+
diff --git a/src/components/Dashboard/ProjectCompletionChart.jsx b/src/components/Dashboard/ProjectCompletionChart.jsx index decf7918..98ee1d3b 100644 --- a/src/components/Dashboard/ProjectCompletionChart.jsx +++ b/src/components/Dashboard/ProjectCompletionChart.jsx @@ -24,7 +24,7 @@ const ProjectCompletionChart = () => {

Projects Completion Status

-
+
{
) : ( -
+
{/* Total Tasks */} -
+

{formatFigure(tasksCardData?.totalTasks ?? 0, { notation: "compact", @@ -56,7 +56,7 @@ const TasksCard = () => {

{/* Completed Tasks */} -
+

{formatFigure(tasksCardData?.completedTasks ?? 0, { notation: "compact", diff --git a/src/components/Directory/CardViewContact.jsx b/src/components/Directory/CardViewContact.jsx index 8e6c8068..0b446da0 100644 --- a/src/components/Directory/CardViewContact.jsx +++ b/src/components/Directory/CardViewContact.jsx @@ -61,7 +61,7 @@ const CardViewContact = ({ (contact?.name || "").trim().split(" ")[1]?.charAt(0) || "" } />{" "} - {contact?.name} + {contact?.name}

{IsActive && ( diff --git a/src/components/Directory/NoteCardDirectoryEditable.jsx b/src/components/Directory/NoteCardDirectoryEditable.jsx index 5ef8d08f..bc6ff517 100644 --- a/src/components/Directory/NoteCardDirectoryEditable.jsx +++ b/src/components/Directory/NoteCardDirectoryEditable.jsx @@ -87,7 +87,7 @@ const NoteCardDirectoryEditable = ({ />
contactProfile(noteItem.contactId)} > @@ -98,7 +98,7 @@ const NoteCardDirectoryEditable = ({
-
+
by{" "} @@ -184,7 +184,7 @@ const NoteCardDirectoryEditable = ({ ) : (
)} diff --git a/src/components/Documents/DocumentFilterPanel.jsx b/src/components/Documents/DocumentFilterPanel.jsx index edc613e1..04f54956 100644 --- a/src/components/Documents/DocumentFilterPanel.jsx +++ b/src/components/Documents/DocumentFilterPanel.jsx @@ -13,230 +13,236 @@ import { useParams } from "react-router-dom"; const DocumentFilterPanel = forwardRef( ({ entityTypeId, onApply, setFilterdata }, ref) => { - const [resetKey, setResetKey] = useState(0); - const { status } = useParams(); + const [resetKey, setResetKey] = useState(0); + const { status } = useParams(); - const { data, isError, isLoading, error } = - useDocumentFilterEntities(entityTypeId); + const { data, isError, isLoading, error } = + useDocumentFilterEntities(entityTypeId); - //changes + useEffect(() => { + return () => { + closePanel(); + }; + }, []); - const dynamicDocumentFilterDefaultValues = useMemo(() => { - return { - ...DocumentFilterDefaultValues, - uploadedByIds: DocumentFilterDefaultValues.uploadedByIds || [], - documentCategoryIds: DocumentFilterDefaultValues.documentCategoryIds || [], - documentTypeIds: DocumentFilterDefaultValues.documentTypeIds || [], - documentTagIds: DocumentFilterDefaultValues.documentTagIds || [], - startDate: DocumentFilterDefaultValues.startDate, - endDate: DocumentFilterDefaultValues.endDate, + //changes + + const dynamicDocumentFilterDefaultValues = useMemo(() => { + return { + ...DocumentFilterDefaultValues, + uploadedByIds: DocumentFilterDefaultValues.uploadedByIds || [], + documentCategoryIds: DocumentFilterDefaultValues.documentCategoryIds || [], + documentTypeIds: DocumentFilterDefaultValues.documentTypeIds || [], + documentTagIds: DocumentFilterDefaultValues.documentTagIds || [], + startDate: DocumentFilterDefaultValues.startDate, + endDate: DocumentFilterDefaultValues.endDate, + }; + + }, [status]); + + const methods = useForm({ + resolver: zodResolver(DocumentFilterSchema), + defaultValues: dynamicDocumentFilterDefaultValues, + }); + + const { handleSubmit, reset, setValue, watch } = methods; + + // Watch values from form + const isUploadedAt = watch("isUploadedAt"); + const isVerified = watch("isVerified"); + + // Close the offcanvas (bootstrap specific) + const closePanel = () => { + document.querySelector(".offcanvas.show .btn-close")?.click(); }; - }, [status]); + useImperativeHandle(ref, () => ({ + resetFieldValue: (name, value) => { + if (value !== undefined) { + setValue(name, value); + } else { + reset({ ...methods.getValues(), [name]: DocumentFilterDefaultValues[name] }); + } + }, + getValues: methods.getValues, // optional, to read current filter state + })); - const methods = useForm({ - resolver: zodResolver(DocumentFilterSchema), - defaultValues: dynamicDocumentFilterDefaultValues, - }); - - const { handleSubmit, reset, setValue, watch } = methods; - - // Watch values from form - const isUploadedAt = watch("isUploadedAt"); - const isVerified = watch("isVerified"); - - // Close the offcanvas (bootstrap specific) - const closePanel = () => { - document.querySelector(".offcanvas.show .btn-close")?.click(); - }; - - useImperativeHandle(ref, () => ({ - resetFieldValue: (name, value) => { - if (value !== undefined) { - setValue(name, value); - } else { - reset({ ...methods.getValues(), [name]: DocumentFilterDefaultValues[name] }); + //changes + useEffect(() => { + if (data && setFilterdata) { + setFilterdata(data); } - }, - getValues: methods.getValues, // optional, to read current filter state - })); + }, [data, setFilterdata]); - //changes - useEffect(() => { - if (data && setFilterdata) { - setFilterdata(data); - } - }, [data, setFilterdata]); + const onSubmit = (values) => { + onApply({ + ...values, + startDate: values.startDate + ? moment.utc(values.startDate, "DD-MM-YYYY").toISOString() + : null, + endDate: values.endDate + ? moment.utc(values.endDate, "DD-MM-YYYY").toISOString() + : null, + }); + // closePanel(); + }; - const onSubmit = (values) => { - onApply({ - ...values, - startDate: values.startDate - ? moment.utc(values.startDate, "DD-MM-YYYY").toISOString() - : null, - endDate: values.endDate - ? moment.utc(values.endDate, "DD-MM-YYYY").toISOString() - : null, - }); - // closePanel(); - }; + const onClear = () => { + reset(DocumentFilterDefaultValues); + setResetKey((prev) => prev + 1); + onApply(DocumentFilterDefaultValues); + // closePanel(); + }; - const onClear = () => { - reset(DocumentFilterDefaultValues); - setResetKey((prev) => prev + 1); - onApply(DocumentFilterDefaultValues); - // closePanel(); - }; + if (isLoading) return
Loading...
; + if (isError) + return
Error: {error?.message || "Something went wrong!"}
; - if (isLoading) return
Loading...
; - if (isError) - return
Error: {error?.message || "Something went wrong!"}
; - - const { - uploadedBy = [], - documentCategory = [], - documentType = [], - documentTag = [], - } = data?.data || {}; + const { + uploadedBy = [], + documentCategory = [], + documentType = [], + documentTag = [], + } = data?.data || {}; - return ( - -
- {/* Date Range Section */} -
-
- -
- - + return ( + + + {/* Date Range Section */} +
+
+ +
+ + +
+
+ + +
+ + {/* Dropdown Filters */} +
+ + + + +
+ + {/* Status Filter */} +
+ +
+ + + + +
- -
- - {/* Dropdown Filters */} -
- - - - -
- - {/* Status Filter */} -
- -
- - - - - + {/* Footer Buttons */} +
+ +
-
- - {/* Footer Buttons */} -
- - -
- - - ); -}); + + + ); + }); export default DocumentFilterPanel; diff --git a/src/components/Documents/DocumentVersionList.jsx b/src/components/Documents/DocumentVersionList.jsx index ea1bdc13..9061c52c 100644 --- a/src/components/Documents/DocumentVersionList.jsx +++ b/src/components/Documents/DocumentVersionList.jsx @@ -74,7 +74,7 @@ const DocumentVersionList = ({ firstName={currentDoc.uploadedBy?.firstName} lastName={currentDoc.uploadedBy?.lastName} /> - + {`${currentDoc.uploadedBy?.firstName ?? ""} ${currentDoc.uploadedBy?.lastName ?? ""}`.trim() || "N/A"} @@ -196,7 +196,7 @@ const DocumentVersionList = ({ firstName={document.uploadedBy?.firstName} lastName={document.uploadedBy?.lastName} /> - + {`${document.uploadedBy?.firstName ?? ""} ${document.uploadedBy?.lastName ?? ""}`.trim() || "N/A"} @@ -216,7 +216,7 @@ const DocumentVersionList = ({ firstName={document.verifiedBy?.firstName} lastName={document.verifiedBy?.lastName} /> - + {`${document.verifiedBy?.firstName ?? ""} ${document.verifiedBy?.lastName ?? ""}`.trim() || "N/A"} diff --git a/src/components/Employee/EmpActivities.jsx b/src/components/Employee/EmpActivities.jsx index e79b181d..8d23b68a 100644 --- a/src/components/Employee/EmpActivities.jsx +++ b/src/components/Employee/EmpActivities.jsx @@ -12,13 +12,13 @@ const EmpActivities = ({ employee }) => { const { data, -isError, -isLoading, -error, + isError, + isLoading, + error, refetch, - } = useProjectTasksByEmployee(employee?.id,dateRange.startDate,dateRange.endDate); + } = useProjectTasksByEmployee(employee?.id, dateRange.startDate, dateRange.endDate); - if(isLoading) return
Loading...
+ if (isLoading) return
Loading...
return ( <>
@@ -31,28 +31,28 @@ error, />
    - {data?.map((activity)=>( -
  • - -
    -
    -
    {activity.projectName}
    - - {useFormattedDate(activity.assignmentDate, "dd-MMM-yyyy")} - + {data?.map((activity) => ( +
  • + +
    +
    +
    {activity.projectName}
    + + {useFormattedDate(activity.assignmentDate, "dd-MMM-yyyy")} + +
    +

    Activity:{activity.activityName}

    +

    + Location: {activity.location} +

    +

    + Planned: {activity.plannedTask} + Completed : {activity.completedTask} +

    -

    Activity:{activity.activityName}

    -

    - Location: {activity.location} -

    -

    - Planned: {activity.plannedTask} - Completed : {activity.completedTask} -

    -
- + ))} - + {/*
  • diff --git a/src/components/Employee/EmpAttendance.jsx b/src/components/Employee/EmpAttendance.jsx index 686d820c..481cd03f 100644 --- a/src/components/Employee/EmpAttendance.jsx +++ b/src/components/Employee/EmpAttendance.jsx @@ -15,6 +15,7 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; import { localToUtc } from "../../utils/appUtils"; import { useParams } from "react-router-dom"; +import { SpinnerLoader } from "../common/Loader"; const EmpAttendance = () => { const { employeeId } = useParams(); @@ -82,21 +83,19 @@ const EmpAttendance = () => {
  • -
    - refetch()} - /> -
    - {!loading && data.length === 0 && No employee logs} + {!loading && data.length === 0 && ( +
    No employee logs
    + )} + {isError &&
    {error.message}
    } - {loading && !data &&
    Loading...
    } + {loading && ( +
    + +
    + )} + {data && data.length > 0 && ( @@ -179,9 +178,8 @@ const EmpAttendance = () => { {[...Array(totalPages)].map((_, index) => (
  • ))}
  • {" "} - + {displayField} :{" "} {" "} - + {IsGroupedByDate ? formatUTCToLocalTime(key) : key} diff --git a/src/components/Project/Infrastructure/WorkArea.jsx b/src/components/Project/Infrastructure/WorkArea.jsx index c5925321..9ab6b832 100644 --- a/src/components/Project/Infrastructure/WorkArea.jsx +++ b/src/components/Project/Infrastructure/WorkArea.jsx @@ -16,6 +16,7 @@ import { useParams } from "react-router-dom"; import ProgressBar from "../../common/ProgressBar"; import { formatNumber } from "../../../utils/dateUtils"; import { useServices } from "../../../hooks/masterHook/useMaster"; +import { SpinnerLoader } from "../../common/Loader"; const WorkArea = ({ workArea, floor, forBuilding }) => { const selectedProject = useSelectedProject() @@ -120,9 +121,14 @@ const WorkArea = ({ workArea, floor, forBuilding }) => { className="accordion-collapse collapse" aria-labelledby={`heading-${workArea.id}`} > -
    +
    {isLoading || ProjectTaskList === undefined ? ( -
    Loading activities...
    +
    + +
    ) : ProjectTaskList?.length === 0 ? (
    No activities available for this work area.
    ) : ProjectTaskList?.length > 0 ? ( diff --git a/src/components/Project/ProjectInfra.jsx b/src/components/Project/ProjectInfra.jsx index 643f6106..cbc8ed82 100644 --- a/src/components/Project/ProjectInfra.jsx +++ b/src/components/Project/ProjectInfra.jsx @@ -29,6 +29,7 @@ import eventBus from "../../services/eventBus"; import { useParams } from "react-router-dom"; import GlobalModel from "../common/GlobalModel"; import { setService } from "../../slices/globalVariablesSlice"; +import { SpinnerLoader } from "../common/Loader"; const ProjectInfra = ({ data, onDataChange, eachSiteEngineer }) => { const projectId = useSelectedProject(); @@ -186,18 +187,20 @@ const ProjectInfra = ({ data, onDataChange, eachSiteEngineer }) => { )}
    -
    - {isLoading &&

    Loading....

    } - {projectInfra && projectInfra?.length > 0 && ( +
    + {isLoading ? ( +
    + +
    + ) : projectInfra && projectInfra.length > 0 ? ( - )} - {!isLoading && projectInfra?.length == 0 && ( -
    -

    No Infra Avaiable

    + ) : ( +
    +

    No infrastructure data available.

    )}
    diff --git a/src/components/Project/ProjectOrganization/ProjectAssignedOrgs.jsx b/src/components/Project/ProjectOrganization/ProjectAssignedOrgs.jsx index c4aec957..e8281dfe 100644 --- a/src/components/Project/ProjectOrganization/ProjectAssignedOrgs.jsx +++ b/src/components/Project/ProjectOrganization/ProjectAssignedOrgs.jsx @@ -2,6 +2,7 @@ import React from "react"; import { useProjectAssignedOrganizations } from "../../../hooks/useProjects"; import { useSelectedProject } from "../../../slices/apiDataManager"; import { formatUTCToLocalTime } from "../../../utils/dateUtils"; +import { SpinnerLoader } from "../../common/Loader"; const ProjectAssignedOrgs = () => { const selectedProject = useSelectedProject(); @@ -25,12 +26,12 @@ const ProjectAssignedOrgs = () => { ), align: "text-start", }, - { + { key: "service", label: "Service Name", getValue: (org) => (
    - {org?.service?.name} + {org?.service?.name}
    ), align: "text-start", @@ -49,7 +50,7 @@ const ProjectAssignedOrgs = () => { align: "text-center", }, - { + { key: "organizationType", label: "Organization Type", getValue: (org) => ( @@ -62,7 +63,7 @@ const ProjectAssignedOrgs = () => { ), align: "text-center", }, - { + { key: "assignedDate", label: "Assigned Date", getValue: (org) => ( @@ -78,7 +79,12 @@ const ProjectAssignedOrgs = () => { }, ]; - if (isLoading) return
    Loading...
    ; + if (isLoading) + return ( +
    + +
    + ); if (isError) return
    {error.message}
    ; return ( diff --git a/src/components/Project/ProjectOrganizations.jsx b/src/components/Project/ProjectOrganizations.jsx index b5a91fa6..7e5bfce5 100644 --- a/src/components/Project/ProjectOrganizations.jsx +++ b/src/components/Project/ProjectOrganizations.jsx @@ -21,7 +21,7 @@ const ProjectOrganizations = () => {
    -
    +
    diff --git a/src/components/Project/Team/Teams.jsx b/src/components/Project/Team/Teams.jsx index 31d27efa..dfd4a86a 100644 --- a/src/components/Project/Team/Teams.jsx +++ b/src/components/Project/Team/Teams.jsx @@ -21,6 +21,7 @@ import { import { useSelectedProject } from "../../../slices/apiDataManager"; import GlobalModel from "../../common/GlobalModel"; import TeamAssignToProject from "./TeamAssignToProject"; +import { SpinnerLoader } from "../../common/Loader"; const Teams = () => { const selectedProject = useSelectedProject(); @@ -158,16 +159,8 @@ const Teams = () => {
    {!servicesLoading && ( <> - {(!assignedServices || assignedServices.length === 0) && ( - - Not Service Assigned - - )} - {assignedServices?.length === 1 && ( - - {assignedServices[0].name} - +
    {assignedServices[0].name}
    )} {assignedServices?.length > 1 && ( @@ -232,7 +225,11 @@ const Teams = () => {
    - {employeeLodaing &&

    Loading..

    } + {employeeLodaing && ( +
    + +
    + )} {projectEmployees && projectEmployees.length > 0 && ( @@ -290,8 +287,8 @@ const Teams = () => { )} diff --git a/src/components/Tenant/TenantSchema.js b/src/components/Tenant/TenantSchema.js index 33fba1c4..e52c53bb 100644 --- a/src/components/Tenant/TenantSchema.js +++ b/src/components/Tenant/TenantSchema.js @@ -20,16 +20,7 @@ export const newTenantSchema = z.object({ contactNumber: z.string().trim() .nonempty("Contact number is required") .regex(/^\+?[1-9]\d{7,14}$/, "Enter a valid contact number"), - onBoardingDate: z.preprocess((val) => { - if (typeof val === "string" && val.includes("-")) { - const [day, month, year] = val.split("-"); - return new Date(`${year}-${month}-${day}`); - } - return val; - }, z.date({ - required_error: "Onboarding date is required", - invalid_type_error: "Invalid date format", - })), + onBoardingDate: z.string().min(1, { message: "Date is required" }), organizationSize: z.string().nonempty("Organization size is required"), industryId: z.string().uuid("Invalid industry ID"), reference: z.string().nonempty("Reference is required"), diff --git a/src/components/common/Loader.jsx b/src/components/common/Loader.jsx index 07078edb..6727117f 100644 --- a/src/components/common/Loader.jsx +++ b/src/components/common/Loader.jsx @@ -19,3 +19,13 @@ const Loader = () => { export default Loader; +export const SpinnerLoader = () => { + return ( +
    +
    + Loading... +
    +

    Loading data...

    +
    + ) +} \ No newline at end of file diff --git a/src/components/gallary/GalleryFilterPanel.jsx b/src/components/gallary/GalleryFilterPanel.jsx index d71625a3..760d0587 100644 --- a/src/components/gallary/GalleryFilterPanel.jsx +++ b/src/components/gallary/GalleryFilterPanel.jsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { useImageGalleryFilter } from "../../hooks/useImageGallery"; import { useSelectedProject } from "../../slices/apiDataManager"; import { FormProvider, useForm } from "react-hook-form"; @@ -8,6 +8,7 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { defaultGalleryFilterValue, gallerySchema } from "./GallerySchema"; import SelectMultiple from "../common/SelectMultiple"; import { localToUtc } from "../../utils/appUtils"; +import { useLocation } from "react-router-dom"; const GalleryFilterPanel = ({ onApply }) => { const selectedProject = useSelectedProject(); @@ -27,7 +28,7 @@ const GalleryFilterPanel = ({ onApply }) => { const { handleSubmit, register, - setValue,reset, + setValue, reset, formState: { errors }, } = methods; @@ -40,12 +41,17 @@ const GalleryFilterPanel = ({ onApply }) => { // closePanel() }; - const onClear=()=>{ + const onClear = () => { reset(defaultGalleryFilterValue); - setResetKey((prev) => prev + 1); + setResetKey((prev) => prev + 1); // closePanel() } + const location = useLocation(); + useEffect(() => { + closePanel(); + }, [location]); + if (isLoading) return
    Loading....
    ; if (isError) return
    {error.message}
    ; return ( diff --git a/src/components/gallary/ImageGalleryListView.jsx b/src/components/gallary/ImageGalleryListView.jsx index 6973f6f0..af5cfbc2 100644 --- a/src/components/gallary/ImageGalleryListView.jsx +++ b/src/components/gallary/ImageGalleryListView.jsx @@ -7,8 +7,7 @@ import { useSelectedProject } from "../../slices/apiDataManager"; import { ITEMS_PER_PAGE } from "../../utils/constants"; import Pagination from "../common/Pagination"; import { formatUTCToLocalTime } from "../../utils/dateUtils"; -import Loader from "../common/Loader"; - +import { SpinnerLoader } from "../common/Loader"; const ImageGalleryListView = ({filter}) => { const [hoveredImage, setHoveredImage] = useState(null); const selectedProject = useSelectedProject(); @@ -44,10 +43,10 @@ const ImageGalleryListView = ({filter}) => { } - if (isLoading) { + if (isLoading) { return (
    - +
    ); } diff --git a/src/pages/Activities/AttendancePage.jsx b/src/pages/Activities/AttendancePage.jsx index b2a0c39b..5b07002e 100644 --- a/src/pages/Activities/AttendancePage.jsx +++ b/src/pages/Activities/AttendancePage.jsx @@ -179,7 +179,7 @@ const AttendancePage = () => { {/* Search + Organization filter */} -
    +
    { @@ -19,7 +19,7 @@ const SelfTenantDetails = () => { }, [isSelfTenantView, navigate]); if (loading || !tenantId) { - return ; + return ; } return ( diff --git a/src/pages/Tenant/TenantDetails.jsx b/src/pages/Tenant/TenantDetails.jsx index d799522e..8d744293 100644 --- a/src/pages/Tenant/TenantDetails.jsx +++ b/src/pages/Tenant/TenantDetails.jsx @@ -7,7 +7,7 @@ import { ComingSoonPage } from "../Misc/ComingSoonPage"; import GlobalModel from "../../components/common/GlobalModel"; import EditProfile from "../../components/Tenant/EditProfile"; import SubScriptionHistory from "../../components/Tenant/SubScriptionHistory"; -import Loader from "../../components/common/Loader"; +import { SpinnerLoader } from "../../components/common/Loader"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import { MANAGE_TENANTS, SUPPER_TENANT } from "../../utils/constants"; @@ -71,8 +71,11 @@ const TenantDetails = ({ if (!activeTenantId) return
    No tenant selected.
    ; if (isLoading) return ( -
    - +
    +
    ); if (isError) @@ -110,14 +113,14 @@ const TenantDetails = ({ data={ iTSelf ? [ - { label: "Home", link: "/dashboard" }, - { label: "Tenant Details", link: null }, - ] + { label: "Home", link: "/dashboard" }, + { label: "Tenant Details", link: null }, + ] : [ - { label: "Home", link: "/dashboard" }, - { label: "Tenant", link: "/tenants" }, - { label: "Tenant Details", link: null }, - ] + { label: "Home", link: "/dashboard" }, + { label: "Tenant", link: "/tenants" }, + { label: "Tenant Details", link: null }, + ] } /> )} @@ -128,9 +131,8 @@ const TenantDetails = ({
  • ); - return :contentBody} />; + return :contentBody} />; }; export default SwitchTenant; \ No newline at end of file diff --git a/src/pages/authentication/TenantSelectionPage.jsx b/src/pages/authentication/TenantSelectionPage.jsx index b8a5398d..5dac4e62 100644 --- a/src/pages/authentication/TenantSelectionPage.jsx +++ b/src/pages/authentication/TenantSelectionPage.jsx @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; import { useTenants, useSelectTenant, useLogout } from "../../hooks/useAuth.jsx"; import { Link, useNavigate } from "react-router-dom"; import Dashboard from "../../components/Dashboard/Dashboard.jsx"; -import Loader from "../../components/common/Loader.jsx"; +import { SpinnerLoader } from "../../components/common/Loader.jsx"; const TenantSelectionPage = () => { const [pendingTenant, setPendingTenant] = useState(null); @@ -45,7 +45,7 @@ const TenantSelectionPage = () => { isPending || (data?.data?.length === 1 && pendingTenant !== null) ) { - return ; + return ; } if (!data?.data?.length) { diff --git a/src/pages/employee/EmployeeList.jsx b/src/pages/employee/EmployeeList.jsx index 10db6786..d675d5d2 100644 --- a/src/pages/employee/EmployeeList.jsx +++ b/src/pages/employee/EmployeeList.jsx @@ -39,6 +39,7 @@ import { setProjectId } from "../../slices/localVariablesSlice"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import Pagination from "../../components/common/Pagination"; import handleEmployeeExport from "../../components/Employee/handleEmployeeExport"; +import { SpinnerLoader } from "../../components/common/Loader"; const EmployeeList = () => { const selectedProjectId = useSelector( @@ -468,12 +469,15 @@ const EmployeeList = () => {
    {loading && ( - )} + {!loading && displayData?.length === 0 && (!searchText) ? ( @@ -649,16 +653,16 @@ const EmployeeList = () => { ))} -
    {emp.reAllocationDate ? moment(emp.reAllocationDate).format( - "DD-MMM-YYYY" - ) + "DD-MMM-YYYY" + ) : "Present"}
    -

    Loading...

    +
    +
    + +
    +
    - {displayData?.length > 0 && ( - - )} + {displayData?.length > 0 && ( + + )}
    ) : (
    diff --git a/src/pages/project/ProjectDetails.jsx b/src/pages/project/ProjectDetails.jsx index d6fbd55d..011d1e9b 100644 --- a/src/pages/project/ProjectDetails.jsx +++ b/src/pages/project/ProjectDetails.jsx @@ -7,7 +7,7 @@ import AboutProject from "../../components/Project/AboutProject"; import ProjectNav from "../../components/Project/ProjectNav"; import Teams from "../../components/Project/Team/Teams"; import ProjectInfra from "../../components/Project/ProjectInfra"; -import Loader from "../../components/common/Loader"; +import { SpinnerLoader } from "../../components/common/Loader"; import WorkPlan from "../../components/Project/WorkPlan"; import Breadcrumb from "../../components/common/Breadcrumb"; import { useSelectedProject } from "../../slices/apiDataManager"; @@ -20,7 +20,7 @@ import { setProjectId } from "../../slices/localVariablesSlice"; import ProjectDocuments from "../../components/Project/ProjectDocuments"; import ProjectSetting from "../../components/Project/ProjectSetting"; import DirectoryPage from "../Directory/DirectoryPage"; -import { useProjectAccess } from "../../hooks/useProjectAccess"; +import { useProjectAccess } from "../../hooks/useProjectAccess"; import "./ProjectDetails.css"; import ProjectOrganizations from "../../components/Project/ProjectOrganizations"; @@ -65,7 +65,14 @@ const ProjectDetails = () => { }; if (projectLoading || permsLoading || !projects_Details) { - return ; + return ( +
    + +
    + ); } const renderContent = () => { diff --git a/src/pages/project/ProjectPage.jsx b/src/pages/project/ProjectPage.jsx index a85d6f58..3806608d 100644 --- a/src/pages/project/ProjectPage.jsx +++ b/src/pages/project/ProjectPage.jsx @@ -7,8 +7,8 @@ import ManageProjectInfo from "../../components/Project/ManageProjectInfo"; import ProjectCardView from "../../components/Project/ProjectCardView"; import usePagination from "../../hooks/usePagination"; import { useProjects } from "../../hooks/useProjects"; -import Loader from "../../components/common/Loader"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; +import { SpinnerLoader } from "../../components/common/Loader"; const ProjectContext = createContext(); export const useProjectContext = () => { @@ -95,8 +95,16 @@ const ProjectPage = () => { } }, [data, isLoading, selectedStatuses]); + if (isLoading) + return ( +
    + +
    + ); - if (isLoading) return
    if (isError) return

    {error.message}

    return (