diff --git a/src/components/Activities/AttendLogs.jsx b/src/components/Activities/AttendLogs.jsx
index b94c80c6..7c1e686d 100644
--- a/src/components/Activities/AttendLogs.jsx
+++ b/src/components/Activities/AttendLogs.jsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";
import { useEmployeeAttendacesLog } from "../../hooks/useAttendance";
-import { convertShortTime } from "../../utils/dateUtils";
+import { convertShortTime, formatUTCToLocalTime } from "../../utils/dateUtils";
import { useNavigate } from "react-router-dom";
import { THRESH_HOLD } from "../../utils/constants";
@@ -128,7 +128,7 @@ const AttendLogs = ({ Id }) => {
Attendance logs for{" "}
{logs[0]?.employee?.firstName + " " + logs[0]?.employee?.lastName}{" "}
- on {logs[0]?.activityTime.slice(0, 10)}{" "}
+ on {formatUTCToLocalTime(logs[0]?.activityTime)}
)}
@@ -156,7 +156,7 @@ const AttendLogs = ({ Id }) => {
.sort((a, b) => b.id - a.id)
.map((log, index) => (
- {log.activityTime.slice(0, 10)} |
+ {formatUTCToLocalTime(log.activityTime)} |
{convertShortTime(log.activityTime)} |
{whichActivityPerform(log.activity, log.activityTime)}
diff --git a/src/components/Activities/Attendance.jsx b/src/components/Activities/Attendance.jsx
index 2dde2938..eb7dc500 100644
--- a/src/components/Activities/Attendance.jsx
+++ b/src/components/Activities/Attendance.jsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useCallback, useMemo } 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 usePagination from "../../hooks/usePagination";
import { useNavigate } from "react-router-dom";
@@ -10,7 +10,7 @@ import { useAttendance } from "../../hooks/useAttendance";
import { useSelector } from "react-redux";
import { useQueryClient } from "@tanstack/react-query";
import eventBus from "../../services/eventBus";
-import { useSelectedproject } from "../../slices/apiDataManager";
+import { useSelectedProject } from "../../slices/apiDataManager";
const Attendance = ({ getRole, handleModalData, searchTerm }) => {
const queryClient = useQueryClient();
@@ -21,7 +21,7 @@ const Attendance = ({ getRole, handleModalData, searchTerm }) => {
// const selectedProject = useSelector(
// (store) => store.localVariables.projectId
// );
- const selectedProject = useSelectedproject();
+ const selectedProject = useSelectedProject();
const {
attendance,
loading: attLoading,
@@ -116,7 +116,7 @@ const Attendance = ({ getRole, handleModalData, searchTerm }) => {
<>
- Date : {todayDate.toLocaleDateString("en-GB")}
+ Date : {formatUTCToLocalTime(todayDate)}
{
const [currentPage, setCurrentPage] = useState(1);
@@ -37,7 +38,7 @@ const AttendanceLog = ({ handleModalData, searchTerm }) => {
// const selectedProject = useSelector(
// (store) => store.localVariables.projectId
// );
- const selectedProject = useSelectedproject();
+ const selectedProject = useSelectedProject();
const [dateRange, setDateRange] = useState({ startDate: "", endDate: "" });
const dispatch = useDispatch();
const [loading, setLoading] = useState(false);
@@ -353,7 +354,7 @@ const AttendanceLog = ({ handleModalData, searchTerm }) => {
No Pending Record Available !
)}
- {filteredSearchData.length > 10 && (
+ {filteredSearchData.length > ITEMS_PER_PAGE && (
-
-
+
Domain Name
{
-
+
Tax ID
{
+
{errors.organizationSize && (
{errors.organizationSize.message}
)}
+
Industry
-
-
+
+ {isLoading ? "Please Wait..." : "Submit"}
+
+ {
+ resetForm(); // clear inputs
+ onClose?.(); // close modal from parent
+ }}
>
Cancel
@@ -123,10 +128,10 @@ useEffect(() => {
-
+
-
- >
+
+ >
)
}
diff --git a/src/components/master/DeleteMaster.jsx b/src/components/master/DeleteMaster.jsx
index ca9998be..f6c877ec 100644
--- a/src/components/master/DeleteMaster.jsx
+++ b/src/components/master/DeleteMaster.jsx
@@ -34,13 +34,15 @@ const DeleteMaster = ({ master, onClose }) => {
)}
{
+ onClose?.(); // properly close modal
+ }}
>
Cancel
+
);
diff --git a/src/components/master/EditActivity.jsx b/src/components/master/EditActivity.jsx
index 43816f4c..55eaa3e1 100644
--- a/src/components/master/EditActivity.jsx
+++ b/src/components/master/EditActivity.jsx
@@ -239,8 +239,8 @@ const UpdateActivity = ({ activityData, onClose }) => {
{/* Submit / Cancel */}
Cancel
diff --git a/src/components/master/EditContactCategory.jsx b/src/components/master/EditContactCategory.jsx
index f29d09e2..28c20a32 100644
--- a/src/components/master/EditContactCategory.jsx
+++ b/src/components/master/EditContactCategory.jsx
@@ -1,10 +1,10 @@
-import React, { useEffect,useState } from 'react'
+import React, { useEffect, useState } from 'react'
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import { MasterRespository } from '../../repositories/MastersRepository';
import { clearApiCacheKey } from '../../slices/apiCacheSlice';
-import { getCachedData,cacheData } from '../../slices/apiDataManager';
+import { getCachedData, cacheData } from '../../slices/apiDataManager';
import showToast from '../../services/toastService';
import {useUpdateContactCategory} from '../../hooks/masterHook/useMaster';
import Label from '../common/Label';
@@ -13,38 +13,38 @@ import Label from '../common/Label';
const schema = z.object({
name: z.string().min(1, { message: "Category name is required" }),
description: z.string().min(1, { message: "Description is required" })
- .max(255, { message: "Description cannot exceed 255 characters" }),
+ .max(255, { message: "Description cannot exceed 255 characters" }),
});
-const EditContactCategory= ({data,onClose}) => {
-const {
- register,
- handleSubmit,
- formState: { errors },
- reset,
-} = useForm({
- resolver: zodResolver(schema),
- defaultValues: {
- name: data?.name || "",
- description: data?.description || "",
- },
-});
+const EditContactCategory = ({ data, onClose }) => {
+ const {
+ register,
+ handleSubmit,
+ formState: { errors },
+ reset,
+ } = useForm({
+ resolver: zodResolver(schema),
+ defaultValues: {
+ name: data?.name || "",
+ description: data?.description || "",
+ },
+ });
-const [descriptionLength, setDescriptionLength] = useState(data?.description?.length || 0);
-const maxDescriptionLength = 255;
+ const [descriptionLength, setDescriptionLength] = useState(data?.description?.length || 0);
+ const maxDescriptionLength = 255;
-const { mutate: updateContactCategory, isPending: isLoading } = useUpdateContactCategory(() => onClose?.());
+ const { mutate: updateContactCategory, isPending: isLoading } = useUpdateContactCategory(() => onClose?.());
-const onSubmit = (formData) => {
- const payload = {
- id: data?.id,
- name: formData.name,
- description: formData.description,
+ const onSubmit = (formData) => {
+ const payload = {
+ id: data?.id,
+ name: formData.name,
+ description: formData.description,
+ };
+
+ updateContactCategory({ id: data?.id, payload });
};
-
- updateContactCategory({id:data?.id,payload});
- };
- // const onSubmit = (formdata) => {
+ // const onSubmit = (formdata) => {
// setIsLoading(true)
// const result = {
// id:data?.id,
@@ -52,8 +52,8 @@ const onSubmit = (formData) => {
// description: formdata.description,
// };
-
-
+
+
// MasterRespository.updateContactCategory(data?.id,result).then((resp)=>{
// setIsLoading(false)
// showToast("Contact Category Updated successfully.", "success");
@@ -71,18 +71,18 @@ const onSubmit = (formData) => {
// showToast(error?.response?.data?.message, "error")
// setIsLoading(false)
// })
-
+
// };
-const resetForm = () => {
- reset({ name: "", description: "" });
- setDescriptionLength(0);
-};
+ const resetForm = () => {
+ reset({ name: "", description: "" });
+ setDescriptionLength(0);
+ };
+
+ useEffect(() => {
+ return () => resetForm();
+ }, []);
-useEffect(() => {
- return () => resetForm();
-}, []);
-
return (<>
@@ -107,17 +107,22 @@ useEffect(() => {
{maxDescriptionLength - descriptionLength} characters left
- {errors.description && (
- {errors.description.message}
- )}
-
+ {errors.description && (
+ {errors.description.message}
+ )}
+
-
-
+
+ {isLoading ? "Please Wait..." : "Submit"}
+
+ {
+ resetForm(); // clear inputs
+ onClose?.(); // close modal from parent
+ }}
>
Cancel
@@ -126,10 +131,10 @@ useEffect(() => {
-
+
-
- >
+
+ >
)
}
diff --git a/src/components/master/EditContactTag.jsx b/src/components/master/EditContactTag.jsx
index 929ddecf..d61d6511 100644
--- a/src/components/master/EditContactTag.jsx
+++ b/src/components/master/EditContactTag.jsx
@@ -1,10 +1,10 @@
-import React,{useState,useEffect} from 'react'
-import {useForm} from 'react-hook-form';
+import React, { useState, useEffect } from 'react'
+import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import { MasterRespository } from '../../repositories/MastersRepository';
import { clearApiCacheKey } from '../../slices/apiCacheSlice';
-import { getCachedData,cacheData } from '../../slices/apiDataManager';
+import { getCachedData, cacheData } from '../../slices/apiDataManager';
import showToast from '../../services/toastService';
import {useUpdateContactTag} from '../../hooks/masterHook/useMaster';
import Label from '../common/Label';
@@ -13,38 +13,38 @@ import Label from '../common/Label';
const schema = z.object({
name: z.string().min(1, { message: "Tag name is required" }),
description: z.string().min(1, { message: "Description is required" })
- .max(255, { message: "Description cannot exceed 255 characters" }),
+ .max(255, { message: "Description cannot exceed 255 characters" }),
});
-const EditContactTag= ({data,onClose}) => {
-const {
- register,
- handleSubmit,
- formState: { errors },
- reset
-} = useForm({
- resolver: zodResolver(schema),
- defaultValues: {
- name: data?.name || "",
- description: data?.description || "",
- },
-});
+const EditContactTag = ({ data, onClose }) => {
+ const {
+ register,
+ handleSubmit,
+ formState: { errors },
+ reset
+ } = useForm({
+ resolver: zodResolver(schema),
+ defaultValues: {
+ name: data?.name || "",
+ description: data?.description || "",
+ },
+ });
-const [descriptionLength, setDescriptionLength] = useState(data?.description?.length || 0);
-const maxDescriptionLength = 255;
+ const [descriptionLength, setDescriptionLength] = useState(data?.description?.length || 0);
+ const maxDescriptionLength = 255;
-const { mutate: updateContactTag, isPending: isLoading } = useUpdateContactTag(() => onClose?.());
+ const { mutate: updateContactTag, isPending: isLoading } = useUpdateContactTag(() => onClose?.());
-const onSubmit = (formData) => {
- const payload = {
- id: data?.id,
- name: formData.name,
- description: formData.description,
- };
- debugger
- updateContactTag({ id: data?.id, payload} );
+ const onSubmit = (formData) => {
+ const payload = {
+ id: data?.id,
+ name: formData.name,
+ description: formData.description,
+ };
+ debugger
+ updateContactTag({ id: data?.id, payload });
}
- // const onSubmit = (formdata) => {
+ // const onSubmit = (formdata) => {
// setIsLoading(true)
// const result = {
// id:data?.id,
@@ -52,8 +52,8 @@ const onSubmit = (formData) => {
// description: formdata.description,
// };
-
-
+
+
// MasterRespository.updateContactTag(data?.id,result).then((resp)=>{
// setIsLoading(false)
// showToast("Contact Tag Updated successfully.", "success");
@@ -71,18 +71,18 @@ const onSubmit = (formData) => {
// showToast(error?.response?.data?.message, "error")
// setIsLoading(false)
// })
-
+
// };
-const resetForm = () => {
- reset({ name: "", description: "" });
- setDescriptionLength(0);
-};
+ const resetForm = () => {
+ reset({ name: "", description: "" });
+ setDescriptionLength(0);
+ };
+
+ useEffect(() => {
+ return () => resetForm();
+ }, []);
-useEffect(() => {
- return () => resetForm();
-}, []);
-
return (<>
@@ -107,17 +107,22 @@ useEffect(() => {
{maxDescriptionLength - descriptionLength} characters left
- {errors.description && (
- {errors.description.message}
- )}
-
+ {errors.description && (
+ {errors.description.message}
+ )}
+
-
-
+
+ {isLoading ? "Please Wait..." : "Submit"}
+
+ {
+ resetForm(); // clear inputs
+ onClose?.(); // close modal from parent
+ }}
>
Cancel
@@ -126,10 +131,10 @@ useEffect(() => {
-
+
-
- >
+
+ >
)
}
diff --git a/src/components/master/EditJobRole.jsx b/src/components/master/EditJobRole.jsx
index 2b5234d3..1b88c091 100644
--- a/src/components/master/EditJobRole.jsx
+++ b/src/components/master/EditJobRole.jsx
@@ -1,9 +1,9 @@
-import React, { useEffect,useState } from 'react'
-import { useForm ,Controller} from 'react-hook-form';
+import React, { useEffect, useState } from 'react'
+import { useForm, Controller } from 'react-hook-form';
import { set, z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import { MasterRespository } from '../../repositories/MastersRepository';
-import { cacheData,getCachedData } from '../../slices/apiDataManager';
+import { cacheData, getCachedData } from '../../slices/apiDataManager';
import showToast from '../../services/toastService';
import {useUpdateJobRole} from '../../hooks/masterHook/useMaster';
import Label from '../common/Label';
@@ -13,13 +13,13 @@ import Label from '../common/Label';
const schema = z.object({
role: z.string().min(1, { message: "Role is required" }),
description: z.string().min(1, { message: "Description is required" })
- .max(255, { message: "Description cannot exceed 255 characters" }),
+ .max(255, { message: "Description cannot exceed 255 characters" }),
});
-const EditJobRole = ({data,onClose}) => {
-const [descriptionLength, setDescriptionLength] = useState(data?.description?.length || 0);
+const EditJobRole = ({ data, onClose }) => {
+ const [descriptionLength, setDescriptionLength] = useState(data?.description?.length || 0);
const maxDescriptionLength = 255;
const {
@@ -36,38 +36,38 @@ const [descriptionLength, setDescriptionLength] = useState(data?.description?.le
},
});
- const { mutate: updateJobRole, isPendin:isLoading } = useUpdateJobRole(() => {
+ const { mutate: updateJobRole, isPendin: isLoading } = useUpdateJobRole(() => {
onClose?.();
});
-// const onSubmit = (formdata) => {
- // setIsLoading(true)
- // const result = {
- // id:data?.id,
- // name: formdata?.role,
- // description: formdata.description,
- // };
+ // const onSubmit = (formdata) => {
+ // setIsLoading(true)
+ // const result = {
+ // id:data?.id,
+ // name: formdata?.role,
+ // description: formdata.description,
+ // };
-
-
- // MasterRespository.updateJobRole(data?.id,result).then((resp)=>{
- // setIsLoading(false)
- // showToast("JobRole Update successfully.", "success");
- // const cachedData = getCachedData("Job Role");
- // if (cachedData) {
- // const updatedData = cachedData.map((role) =>
- // role.id === data?.id ? { ...role, ...resp.data } : role
- // );
- // cacheData("Job Role", updatedData);
- // }
- // onClose()
- // }).catch((error)=>{
- // showToast(error.message, "error")
- // setIsLoading(false)
- // })
-
- // };
+ // MasterRespository.updateJobRole(data?.id,result).then((resp)=>{
+ // setIsLoading(false)
+ // showToast("JobRole Update successfully.", "success");
+ // const cachedData = getCachedData("Job Role");
+ // if (cachedData) {
+
+ // const updatedData = cachedData.map((role) =>
+ // role.id === data?.id ? { ...role, ...resp.data } : role
+ // );
+ // cacheData("Job Role", updatedData);
+ // }
+
+ // onClose()
+ // }).catch((error)=>{
+ // showToast(error.message, "error")
+ // setIsLoading(false)
+ // })
+
+ // };
const onSubmit = (formData) => {
updateJobRole({
@@ -94,9 +94,9 @@ const [descriptionLength, setDescriptionLength] = useState(data?.description?.le
});
return () => sub.unsubscribe();
}, [watch]);
-
+
return (<>
-
+
{/*
Edit Job Role
*/}
@@ -126,14 +126,16 @@ const [descriptionLength, setDescriptionLength] = useState(data?.description?.le
{errors.description.message}
)}
-
+
-
-
+
+ {isLoading ? "Please Wait..." : "Submit"}
+
+
Cancel
@@ -142,10 +144,11 @@ const [descriptionLength, setDescriptionLength] = useState(data?.description?.le
-
+
+
-
- >
+
+ >
)
}
diff --git a/src/components/master/EditRole.jsx b/src/components/master/EditRole.jsx
index b20f33c9..f16841bf 100644
--- a/src/components/master/EditRole.jsx
+++ b/src/components/master/EditRole.jsx
@@ -279,13 +279,11 @@ const EditMaster = ({ master, onClose }) => {
Cancel
- {isLoading ? "Please Wait..." : "Submit"}
diff --git a/src/components/master/EditWorkCategory.jsx b/src/components/master/EditWorkCategory.jsx
index 723e5f24..8a4c4072 100644
--- a/src/components/master/EditWorkCategory.jsx
+++ b/src/components/master/EditWorkCategory.jsx
@@ -1,103 +1,103 @@
-import React, { useEffect,useState } from 'react'
-import { useForm ,Controller} from 'react-hook-form';
+import React, { useEffect, useState } from 'react'
+import { useForm, Controller } from 'react-hook-form';
import { set, z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import { MasterRespository } from '../../repositories/MastersRepository';
-import { cacheData,getCachedData } from '../../slices/apiDataManager';
+import { cacheData, getCachedData } from '../../slices/apiDataManager';
import showToast from '../../services/toastService';
-import {useUpdateWorkCategory} from '../../hooks/masterHook/useMaster';
+import { useUpdateWorkCategory } from '../../hooks/masterHook/useMaster';
const schema = z.object({
name: z.string().min(1, { message: "Work Category is required" }),
description: z.string().min(1, { message: "Description is required" })
- .max(255, { message: "Description cannot exceed 255 characters" }),
+ .max(255, { message: "Description cannot exceed 255 characters" }),
});
-const EditWorkCategory = ({data,onClose}) => {
-
-const {
- register,
- handleSubmit,
- formState: { errors },
- reset,
-} = useForm({
- resolver: zodResolver(schema),
- defaultValues: {
- name: data?.name || "",
- description: data?.description || "",
- },
-});
+const EditWorkCategory = ({ data, onClose }) => {
-const [descriptionLength, setDescriptionLength] = useState(data?.description?.length || 0);
-const maxDescriptionLength = 255;
+ const {
+ register,
+ handleSubmit,
+ formState: { errors },
+ reset,
+ } = useForm({
+ resolver: zodResolver(schema),
+ defaultValues: {
+ name: data?.name || "",
+ description: data?.description || "",
+ },
+ });
-const { mutate: updateWorkCategory, isPending: isLoading } = useUpdateWorkCategory(() => onClose?.());
+ const [descriptionLength, setDescriptionLength] = useState(data?.description?.length || 0);
+ const maxDescriptionLength = 255;
-const onSubmit = (formdata) => {
- const payload = {
- id: data?.id,
- name: formdata.name,
- description: formdata.description,
+ const { mutate: updateWorkCategory, isPending: isLoading } = useUpdateWorkCategory(() => onClose?.());
+
+ const onSubmit = (formdata) => {
+ const payload = {
+ id: data?.id,
+ name: formdata.name,
+ description: formdata.description,
+ };
+
+ updateWorkCategory({ id: data?.id, payload });
};
- updateWorkCategory({id:data?.id,payload});
-};
-
- // const onSubmit = (formdata) => {
- // setIsLoading(true)
- // const result = {
- // id:data?.id,
- // name: formdata?.name,
- // description: formdata.description,
- // };
-
-
-
- // MasterRespository.updateWorkCategory(data?.id,result).then((resp)=>{
- // setIsLoading(false)
- // showToast("Work Category Update successfully.", "success");
- // const cachedData = getCachedData("Work Category");
- // if (cachedData) {
-
- // const updatedData = cachedData.map((category) =>
- // category.id === data?.id ? { ...category, ...resp.data } : category
- // );
- // cacheData("Work Category", updatedData);
- // }
-
- // onClose()
- // }).catch((error)=>{
- // showToast(error?.response?.data?.message, "error")
- // setIsLoading(false)
- // })
-
- // };
-useEffect(() => {
- reset({
- name: data?.name || "",
- description: data?.description || "",
- });
- setDescriptionLength(data?.description?.length || 0);
-}, [data, reset]);
+ // const onSubmit = (formdata) => {
+ // setIsLoading(true)
+ // const result = {
+ // id:data?.id,
+ // name: formdata?.name,
+ // description: formdata.description,
+ // };
+
+
+
+ // MasterRespository.updateWorkCategory(data?.id,result).then((resp)=>{
+ // setIsLoading(false)
+ // showToast("Work Category Update successfully.", "success");
+ // const cachedData = getCachedData("Work Category");
+ // if (cachedData) {
+
+ // const updatedData = cachedData.map((category) =>
+ // category.id === data?.id ? { ...category, ...resp.data } : category
+ // );
+ // cacheData("Work Category", updatedData);
+ // }
+
+ // onClose()
+ // }).catch((error)=>{
+ // showToast(error?.response?.data?.message, "error")
+ // setIsLoading(false)
+ // })
+
+ // };
+ useEffect(() => {
+ reset({
+ name: data?.name || "",
+ description: data?.description || "",
+ });
+ setDescriptionLength(data?.description?.length || 0);
+ }, [data, reset]);
+
-
return (<>
-
-
- Category Name
-
- {errors.name && {errors.name.message} }
-
-
- Description
+
+
+ Category Name
+
+ {errors.name && {errors.name.message} }
+
+
+ Description
+
-
-
- {isLoading? "Please Wait...":"Submit"}
+
+
+ {isLoading ? "Please Wait..." : "Submit"}
Cancel
+
-
+
-
- >
+
+ >
)
}
diff --git a/src/components/master/ManagePaymentMode.jsx b/src/components/master/ManagePaymentMode.jsx
index b901a520..cdb2c89d 100644
--- a/src/components/master/ManagePaymentMode.jsx
+++ b/src/components/master/ManagePaymentMode.jsx
@@ -18,31 +18,31 @@ const ManagePaymentMode = ({ data = null, onClose }) => {
formState: { errors },
} = useForm({
resolver: zodResolver(ExpnseSchema),
- defaultValues: { name: "", description: "" },
+ defaultValues: { name: "", description: "" },
});
const { mutate: CreatePaymentMode, isPending } = useCreatePaymentMode(() =>
onClose?.()
);
- const {mutate:UpdatePaymentMode,isPending:Updating} = useUpdatePaymentMode(()=>onClose?.())
+ const { mutate: UpdatePaymentMode, isPending: Updating } = useUpdatePaymentMode(() => onClose?.())
const onSubmit = (payload) => {
- if(data){
- UpdatePaymentMode({id:data.id,payload:{...payload,id:data.id}})
- }else(
- CreatePaymentMode(payload)
+ if (data) {
+ UpdatePaymentMode({ id: data.id, payload: { ...payload, id: data.id } })
+ } else (
+ CreatePaymentMode(payload)
)
-
+
};
- useEffect(()=>{
- if(data){
+ useEffect(() => {
+ if (data) {
reset({
- name:data.name ?? "",
- description:data.description ?? ""
+ name: data.name ?? "",
+ description: data.description ?? ""
})
}
- },[data])
+ }, [data])
return (
@@ -71,8 +71,19 @@ const ManagePaymentMode = ({ data = null, onClose }) => {
)}
+
+
+ {isPending || Updating ? "Please Wait..." : Updating ? "Update" : "Submit"}
+
{
export const useMarkAttendance = () => {
const queryClient = useQueryClient();
- // const selectedProject = useSelector((store)=>store.localVariables.projectId)
- const selectedProject = useSelectedproject();
+ const selectedProject = useSelectedProject();
const selectedDateRange = useSelector((store)=>store.localVariables.defaultDateRange)
return useMutation({
diff --git a/src/hooks/useExpense.js b/src/hooks/useExpense.js
index ec1a45bf..41976103 100644
--- a/src/hooks/useExpense.js
+++ b/src/hooks/useExpense.js
@@ -17,13 +17,13 @@ const cleanFilter = (filter) => {
});
// moment.utc() to get consistent UTC ISO strings
- if (!cleaned.startDate) {
- cleaned.startDate = moment.utc().subtract(7, "days").startOf("day").toISOString();
- }
+ // if (!cleaned.startDate) {
+ // cleaned.startDate = moment.utc().subtract(7, "days").startOf("day").toISOString();
+ // }
- if (!cleaned.endDate) {
- cleaned.endDate = moment.utc().startOf("day").toISOString();
- }
+ // if (!cleaned.endDate) {
+ // cleaned.endDate = moment.utc().startOf("day").toISOString();
+ // }
return cleaned;
};
diff --git a/src/pages/Activities/AttendancePage.jsx b/src/pages/Activities/AttendancePage.jsx
index d2b87e22..c2c65623 100644
--- a/src/pages/Activities/AttendancePage.jsx
+++ b/src/pages/Activities/AttendancePage.jsx
@@ -4,7 +4,7 @@ import {
clearCacheKey,
getCachedData,
getCachedProfileData,
- useSelectedproject,
+ useSelectedProject,
} from "../../slices/apiDataManager";
import Breadcrumb from "../../components/common/Breadcrumb";
import AttendanceLog from "../../components/Activities/AttendcesLogs";
@@ -26,11 +26,11 @@ import { useQueryClient } from "@tanstack/react-query";
const AttendancePage = () => {
const [activeTab, setActiveTab] = useState("all");
const [ShowPending, setShowPending] = useState(false);
- const [searchTerm, setSearchTerm] = useState(""); // 🔹 New state for search
+ const [searchTerm, setSearchTerm] = useState("");
const queryClient = useQueryClient();
const loginUser = getCachedProfileData();
- // const selectedProject = useSelector((store) => store.localVariables.projectId);
- const selectedProject = useSelectedproject();
+
+ const selectedProject = useSelectedProject();
const dispatch = useDispatch();
const [attendances, setAttendances] = useState();
diff --git a/src/pages/Activities/DailyTask.jsx b/src/pages/Activities/DailyTask.jsx
index 1837f6fa..73f1ccba 100644
--- a/src/pages/Activities/DailyTask.jsx
+++ b/src/pages/Activities/DailyTask.jsx
@@ -1,4 +1,4 @@
-import React, { useEffect, useMemo, useRef, useState } from "react";
+import React, { useEffect, useMemo, useState } from "react";
import { useDispatch } from "react-redux";
import { useTaskList } from "../../hooks/useTasks";
import { useProjectName } from "../../hooks/useProjects";
@@ -13,13 +13,13 @@ import SubTask from "../../components/Activities/SubTask";
import { formatNumber, formatUTCToLocalTime } from "../../utils/dateUtils";
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
import { APPROVE_TASK, ASSIGN_REPORT_TASK } from "../../utils/constants";
-import { useSelectedproject } from "../../slices/apiDataManager";
+import { useSelectedProject } from "../../slices/apiDataManager";
import moment from "moment";
import Loader from "../../components/common/Loader";
const DailyTask = () => {
const dispatch = useDispatch();
- const selectedProject = useSelectedproject();
+ const selectedProject = useSelectedProject();
const { projectNames } = useProjectName();
const ApprovedTaskRights = useHasUserPermission(APPROVE_TASK);
const ReportTaskRights = useHasUserPermission(ASSIGN_REPORT_TASK);
@@ -41,10 +41,20 @@ const DailyTask = () => {
// Ensure project is set
useEffect(() => {
if (!selectedProject && projectNames.length > 0) {
+ debugger
dispatch(setProjectId(projectNames[0].id));
}
}, [selectedProject, projectNames, dispatch]);
+ // 🔹 Reset filters when project changes
+ useEffect(() => {
+ setFilters({
+ selectedBuilding: "",
+ selectedFloors: [],
+ selectedActivities: [],
+ });
+ }, [selectedProject]);
+
// Memoized filtering
const filteredTasks = useMemo(() => {
if (!TaskList) return [];
@@ -91,8 +101,8 @@ const DailyTask = () => {
data-bs-content={`
${task.teamMembers
- .map(
- (m) => `
+ .map(
+ (m) => `
@@ -101,8 +111,8 @@ const DailyTask = () => {
${m.firstName} ${m.lastName}
`
- )
- .join("")}
+ )
+ .join("")}
`}
>
@@ -163,6 +173,7 @@ const DailyTask = () => {
currentSelectedBuilding={filters.selectedBuilding}
currentSelectedFloors={filters.selectedFloors}
currentSelectedActivities={filters.selectedActivities}
+ selectedProject={selectedProject}
/>
diff --git a/src/pages/Activities/TaskPlannng.jsx b/src/pages/Activities/TaskPlannng.jsx
index ed51490c..09acc21f 100644
--- a/src/pages/Activities/TaskPlannng.jsx
+++ b/src/pages/Activities/TaskPlannng.jsx
@@ -4,21 +4,19 @@ import InfraPlanning from "../../components/Activities/InfraPlanning";
import { useProjectName } from "../../hooks/useProjects";
import { useDispatch, useSelector } from "react-redux";
import { setProjectId } from "../../slices/localVariablesSlice";
-import { useSelectedproject } from "../../slices/apiDataManager";
+import { useSelectedProject } from "../../slices/apiDataManager";
const TaskPlannng = () => {
- const selectedProject = useSelectedproject();
- const dispatch = useDispatch();
- const { projectNames, loading: projectLoading } = useProjectName();
+const selectedProject = useSelectedProject();
+const dispatch = useDispatch();
+const { projectNames = [], loading: projectLoading } = useProjectName();
- const initialized = useRef(false);
+useEffect(() => {
+ if (!selectedProject) {
+ dispatch(setProjectId(projectNames[0].id));
+ }
+}, [projectNames, selectedProject?.id, dispatch]);
- useEffect(() => {
- if (!initialized.current && projectNames.length > 0 && !selectedProject?.id) {
- dispatch(setProjectId(projectNames[0].id));
- initialized.current = true;
- }
- }, [projectNames, selectedProject, dispatch]);
return (
diff --git a/src/pages/authentication/LoginPage.jsx b/src/pages/authentication/LoginPage.jsx
index c9eb5e0d..3f91e29a 100644
--- a/src/pages/authentication/LoginPage.jsx
+++ b/src/pages/authentication/LoginPage.jsx
@@ -210,7 +210,7 @@ const LoginPage = () => {
Login With Password
) : (
-
+
Request a Demo
)}
diff --git a/src/pages/employee/EmployeeList.jsx b/src/pages/employee/EmployeeList.jsx
index 935add9b..5cd7ab2d 100644
--- a/src/pages/employee/EmployeeList.jsx
+++ b/src/pages/employee/EmployeeList.jsx
@@ -18,7 +18,7 @@ import {
VIEW_ALL_EMPLOYEES,
VIEW_TEAM_MEMBERS,
} from "../../utils/constants";
-import { clearCacheKey, useSelectedproject } from "../../slices/apiDataManager";
+import { clearCacheKey, useSelectedProject } from "../../slices/apiDataManager";
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
import SuspendEmp from "../../components/Employee/SuspendEmp"; // Keep if you use SuspendEmp
import {
@@ -41,7 +41,7 @@ const EmployeeList = () => {
// const selectedProjectId = useSelector(
// (store) => store.localVariables.projectId
// );
- const selectedProjectId = useSelectedproject();
+ const selectedProjectId = useSelectedProject();
const { projectNames, loading: projectLoading, fetchData } = useProjectName();
const dispatch = useDispatch();
diff --git a/src/pages/master/MasterPage.jsx b/src/pages/master/MasterPage.jsx
index 72710679..564fc036 100644
--- a/src/pages/master/MasterPage.jsx
+++ b/src/pages/master/MasterPage.jsx
@@ -122,14 +122,17 @@ const MasterPage = () => {
onChange={(e) => dispatch(changeMaster(e.target.value))}
name="DataTables_Table_0_length"
aria-controls="DataTables_Table_0"
- className="form-select form-select-sm"
+ className="form-select py-1 px-2"
+ style={{ fontSize: "0.875rem", height: "32px", width: "150px" }}
value={selectedMaster}
>
- {isLoading && ()}
- {(!isLoading && data) && data?.map((item) => (
-
-
- ))}
+ {isLoading && }
+ {!isLoading &&
+ data?.map((item) => (
+
+ ))}
diff --git a/src/pages/project/ProjectDetails.jsx b/src/pages/project/ProjectDetails.jsx
index 75f7705b..1df27bb9 100644
--- a/src/pages/project/ProjectDetails.jsx
+++ b/src/pages/project/ProjectDetails.jsx
@@ -13,7 +13,7 @@ import {
cacheData,
clearCacheKey,
getCachedData,
- useSelectedproject,
+ useSelectedProject,
} from "../../slices/apiDataManager";
import "./ProjectDetails.css";
import {
@@ -29,7 +29,7 @@ import { setProjectId } from "../../slices/localVariablesSlice";
const ProjectDetails = () => {
- const projectId = useSelectedproject()
+ const projectId = useSelectedProject()
const { projectNames, fetchData } = useProjectName();
const dispatch = useDispatch()
diff --git a/src/repositories/DirectoryRepository.jsx b/src/repositories/DirectoryRepository.jsx
index e19571cc..aa630338 100644
--- a/src/repositories/DirectoryRepository.jsx
+++ b/src/repositories/DirectoryRepository.jsx
@@ -34,6 +34,8 @@ export const DirectoryRepository = {
DeleteNote: (id, isActive) =>
api.delete(`/api/directory/note/${id}?active=${isActive}`),
- GetNotes: (pageSize, pageNumber) =>
- api.get(`/api/directory/notes?pageSize=${pageSize}&pageNumber=${pageNumber}`),
+ GetNotes: (pageSize, pageNumber, projectId) =>
+ api.get(
+ `/api/directory/notes?pageSize=${pageSize}&pageNumber=${pageNumber}&projectId=${projectId}`
+ ),
};
diff --git a/src/repositories/MarketRepository.jsx b/src/repositories/MarketRepository.jsx
index 4baa3c74..e71393d8 100644
--- a/src/repositories/MarketRepository.jsx
+++ b/src/repositories/MarketRepository.jsx
@@ -1,6 +1,6 @@
import { api } from "../utils/axiosClient";
export const MarketRepository = {
- requestDemo: (data) => api.post("/api/market/inquiry", data),
+ requestDemo: (data) => api.post("/api/market/enquire", data),
getIndustries: () => api.get("api/market/industries"),
};
diff --git a/src/router/AppRoutes.jsx b/src/router/AppRoutes.jsx
index 0e269a6f..019a3e8d 100644
--- a/src/router/AppRoutes.jsx
+++ b/src/router/AppRoutes.jsx
@@ -52,7 +52,7 @@ const router = createBrowserRouter(
children: [
{ path: "/auth/login", element: },
{ path: "/auth/login-otp", element: },
- { path: "/auth/reqest/demo", element: },
+ { path: "/market/enquire", element: },
{ path: "/auth/forgot-password", element: },
{ path: "/reset-password", element: },
{ path: "/legal-info", element: },
diff --git a/src/slices/apiDataManager.jsx b/src/slices/apiDataManager.jsx
index d0f8bc67..97f6dcb5 100644
--- a/src/slices/apiDataManager.jsx
+++ b/src/slices/apiDataManager.jsx
@@ -33,13 +33,12 @@ export const clearAllCache = () => {
export const cacheProfileData = ( data) => {
store.dispatch(setLoginUserPermmisions(data));
};
-
// Get cached data
export const getCachedProfileData = () => {
return store.getState().globalVariables.loginUser;
};
-export const useSelectedproject = () => {
+export const useSelectedProject = () => {
const selectedProject = useSelector((store)=> store.localVariables.projectId);
var project = localStorage.getItem("project");
if(project){
@@ -47,7 +46,7 @@ export const useSelectedproject = () => {
} else{
return selectedProject
}
- // return project ? selectedProject
+
};
\ No newline at end of file
|