diff --git a/src/components/Activities/Attendance.jsx b/src/components/Activities/Attendance.jsx index a4443dc9..ff5d37d8 100644 --- a/src/components/Activities/Attendance.jsx +++ b/src/components/Activities/Attendance.jsx @@ -138,7 +138,7 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat Name Role - Organization + {/* Organization */} Check-In @@ -187,7 +187,7 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat {item.jobRoleName} - {item.organizationName || "--"} + {/* {item.organizationName || "--"} */} {item.checkInTime diff --git a/src/components/Activities/AttendcesLogs.jsx b/src/components/Activities/AttendcesLogs.jsx index 71c7328a..00e9936d 100644 --- a/src/components/Activities/AttendcesLogs.jsx +++ b/src/components/Activities/AttendcesLogs.jsx @@ -84,56 +84,50 @@ const AttendanceLog = ({ handleModalData, searchTerm ,organizationId}) => { dateRange.endDate, organizationId ); - const filtering = (data) => { - const filteredData = showPending - ? data.filter((item) => item.checkOutTime === null) - : data; + const filtering = useCallback((dataToFilter) => { + const filteredData = showPending + ? dataToFilter.filter((item) => item.checkOutTime === null) + : dataToFilter; - const group1 = filteredData - .filter((d) => d.activity === 1 && isSameDay(d.checkInTime)) - .sort(sortByName); - const group2 = filteredData - .filter((d) => d.activity === 4 && isSameDay(d.checkOutTime)) - .sort(sortByName); - const group3 = filteredData - .filter((d) => d.activity === 1 && isBeforeToday(d.checkInTime)) - .sort(sortByName); - const group4 = filteredData.filter( - (d) => d.activity === 4 && isBeforeToday(d.checkOutTime) - ); - const group5 = filteredData - .filter((d) => d.activity === 2 && isBeforeToday(d.checkOutTime)) - .sort(sortByName); - const group6 = filteredData - .filter((d) => d.activity === 5) - .sort(sortByName); + const group1 = filteredData + .filter((d) => d.activity === 1 && isSameDay(d.checkInTime)) + .sort(sortByName); + const group2 = filteredData + .filter((d) => d.activity === 4 && isSameDay(d.checkOutTime)) + .sort(sortByName); + const group3 = filteredData + .filter((d) => d.activity === 1 && isBeforeToday(d.checkInTime)) + .sort(sortByName); + const group4 = filteredData.filter( + (d) => d.activity === 4 && isBeforeToday(d.checkOutTime) + ); + const group5 = filteredData + .filter((d) => d.activity === 2 && isBeforeToday(d.checkOutTime)) + .sort(sortByName); + const group6 = filteredData + .filter((d) => d.activity === 5) + .sort(sortByName); - const sortedList = [ - ...group1, - ...group2, - ...group3, - ...group4, - ...group5, - ...group6, - ]; + const sortedList = [...group1, ...group2, ...group3, ...group4, ...group5, ...group6]; - // Group by date - const groupedByDate = sortedList.reduce((acc, item) => { - const date = (item.checkInTime || item.checkOutTime)?.split("T")[0]; - if (date) { - acc[date] = acc[date] || []; - acc[date].push(item); - } - return acc; - }, {}); + // Group by date + const groupedByDate = sortedList.reduce((acc, item) => { + const date = (item.checkInTime || item.checkOutTime)?.split("T")[0]; + if (date) { + acc[date] = acc[date] || []; + acc[date].push(item); + } + return acc; + }, {}); - const sortedDates = Object.keys(groupedByDate).sort( - (a, b) => new Date(b) - new Date(a) - ); + const sortedDates = Object.keys(groupedByDate).sort( + (a, b) => new Date(b) - new Date(a) + ); + + const finalData = sortedDates.flatMap((date) => groupedByDate[date]); + setProcessedData(finalData); +}, [showPending]); - const finalData = sortedDates.flatMap((date) => groupedByDate[date]); - setProcessedData(finalData); - }; useEffect(() => { filtering(data); @@ -285,7 +279,7 @@ const AttendanceLog = ({ handleModalData, searchTerm ,organizationId}) => { Name Date - Organization + {/* Organization */} Check-In @@ -344,7 +338,7 @@ const AttendanceLog = ({ handleModalData, searchTerm ,organizationId}) => { attendance.checkInTime || attendance.checkOutTime ).format("DD-MMM-YYYY")} - {attendance.organizationName || "--"} + {/* {attendance.organizationName || "--"} */} {convertShortTime(attendance.checkInTime)} {attendance.checkOutTime diff --git a/src/components/Activities/CheckCheckOutForm.jsx b/src/components/Activities/CheckCheckOutForm.jsx index ab105d84..3d7c5e0e 100644 --- a/src/components/Activities/CheckCheckOutForm.jsx +++ b/src/components/Activities/CheckCheckOutForm.jsx @@ -89,7 +89,7 @@ const CheckInCheckOut = ({ modeldata, closeModal, handleSubmitForm }) => { Id: modeldata?.id || null, comment: data.description, employeeID: modeldata.employeeId, - // projectId: projectId, + projectId: projectId, date: new Date().toISOString(), markTime: data.markTime, latitude: coords.latitude.toString(), diff --git a/src/components/Activities/Regularization.jsx b/src/components/Activities/Regularization.jsx index 8f1d21d5..97e6879b 100644 --- a/src/components/Activities/Regularization.jsx +++ b/src/components/Activities/Regularization.jsx @@ -128,7 +128,7 @@ const Regularization = ({ handleRequest, searchTerm,projectId, organizationId, I Name Date - Organization + {/* Organization */} Check-In @@ -158,7 +158,7 @@ const Regularization = ({ handleRequest, searchTerm,projectId, organizationId, I {moment(att.checkOutTime).format("DD-MMM-YYYY")} - {att.organizationName || "--"} + {/* {att.organizationName || "--"} */} {convertShortTime(att.checkInTime)} diff --git a/src/components/Directory/ListViewContact.jsx b/src/components/Directory/ListViewContact.jsx index bc8a296e..26a06f3a 100644 --- a/src/components/Directory/ListViewContact.jsx +++ b/src/components/Directory/ListViewContact.jsx @@ -86,6 +86,8 @@ const ListViewContact = ({ data, Pagination, isLoading }) => { ActiveInActive({ contactId: contactId, contactStatus: !showActive }); }; + if(isLoading) return + if(!data|| data.length === 0)return
No Contact Found
return ( <> { className="card-datatable table-responsive" id="horizontal-example" > - {isLoading && ( -
- -
- )} + {data && (
@@ -124,7 +122,7 @@ const ListViewContact = ({ data, Pagination, isLoading }) => { - {Array.isArray(data) && data.length > 0 ? ( + {Array.isArray(data) && data.length > 0 && ( data.map((row, i) => ( { )) - ) : ( - - - - )} + ) }
- No contacts found -
{Pagination && ( diff --git a/src/components/Directory/ManageContact.jsx b/src/components/Directory/ManageContact.jsx index 56d45e32..143a8ac1 100644 --- a/src/components/Directory/ManageContact.jsx +++ b/src/components/Directory/ManageContact.jsx @@ -23,7 +23,7 @@ import Label from "../common/Label"; const ManageContact = ({ contactId, closeModal }) => { // fetch master data const { buckets, loading: bucketsLoaging } = useBuckets(); - const { data:projects, loading: projectLoading } = useProjects(); + const { data: projects, loading: projectLoading } = useProjects(); const { contactCategory, loading: contactCategoryLoading } = useContactCategory(); const { organizationList } = useOrganization(); @@ -205,13 +205,14 @@ const ManageContact = ({ contactId, closeModal }) => { - setValue("organization", val, { shouldValidate: true })} - error={errors.organization?.message} -/> - + + setValue("organization", val, { shouldValidate: true }) + } + error={errors.organization?.message} + />
@@ -394,6 +395,7 @@ const ManageContact = ({ contactId, closeModal }) => { labelKey="name" valueKey="id" IsLoading={projectLoading} + /> {errors.projectIds && ( {errors.projectIds.message} @@ -408,6 +410,7 @@ const ManageContact = ({ contactId, closeModal }) => { label="Tags" options={contactTags} isRequired={true} + require /> {errors.tags && ( {errors.tags.message} @@ -417,7 +420,7 @@ const ManageContact = ({ contactId, closeModal }) => { {/* Buckets */}
- +
    {bucketsLoaging &&

    Loading...

    } {buckets?.map((item) => ( @@ -450,7 +453,7 @@ const ManageContact = ({ contactId, closeModal }) => {
{/* Address + Description */} -
+