Compare commits

...

29 Commits

Author SHA1 Message Date
105beb6062 more cosmmatic changes 2025-10-15 11:54:49 +05:30
dacd72f945 handle reposnsive height 2025-10-15 10:52:07 +05:30
9526cb0e5e add more cosmatic changes and include contact us section 2025-10-14 10:29:46 +05:30
432cf2122e new design added 2025-10-13 16:12:46 +05:30
aeb9778216 Add link to login page 2025-10-06 17:50:22 +05:30
81ed65c0c6 add initial version of landig page 2025-10-06 17:49:03 +05:30
1e49cf17a2 addd dropdown at expense table action 2025-10-04 16:25:28 +05:30
f0f579beae fixed dashbord card size 2025-10-04 15:47:07 +05:30
b53e6284b9 Merge branch 'OnFieldWork_V1' of https://git.marcoaiot.com/admin/marco.pms.web into OnFieldWork_V1 2025-10-04 14:13:43 +05:30
b1c23aab4d added expens group fied Name 2025-10-04 14:13:09 +05:30
4a05e67ff0 Adding dropdown in ExpenseFilter. 2025-10-04 14:12:20 +05:30
87d13d0f77 Changes in Monthly Expense weidget. 2025-10-04 12:20:59 +05:30
997971629f addd Expense By project 2025-10-04 11:08:19 +05:30
18ac8e11bd added expense filte at api url level 2025-10-04 10:50:14 +05:30
78808ecac0 added Expensebstatus widget, fixed small bugs 2025-10-03 19:07:44 +05:30
3553a7b521 change class to className 2025-10-03 10:57:55 +05:30
aca96c60ae removed console and comment 2025-10-02 13:24:36 +05:30
25f4f1e7a7 added expense analysis card inisde dashboard 2025-10-02 13:10:14 +05:30
0c1889e1c1 added Ellipsis Pagination 2025-10-01 22:45:31 +05:30
9884943907 addded imported field added 2025-10-01 18:45:26 +05:30
2531d91209 fixed dashboard graph 2025-10-01 16:21:08 +05:30
49b597c833 fixed expense date, added project name at check in checkout modal 2025-10-01 15:34:19 +05:30
2aae7194b7 implemented singlR 2025-10-01 13:00:38 +05:30
ae772d925a remove project permissions 2025-10-01 10:13:52 +05:30
c1e5ff4043 remove dashboard 2025-09-30 23:39:41 +05:30
2aff3b9e80 changed logins api 2025-09-30 19:35:01 +05:30
4e48478fbc update attendnace and expense 2025-09-30 19:31:24 +05:30
4ea1e06a9c hide project infra, setting, Organization, and show only all employees and inactive employee 2025-09-30 18:16:29 +05:30
4ddb8415cc added gobal create project,change paid by at expense create 2025-09-30 17:27:20 +05:30
112 changed files with 5590 additions and 3764 deletions

View File

@ -9,6 +9,8 @@
<meta name="description" content="" /> <meta name="description" content="" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<!-- Favicon --> <!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="/img/favicon.ico" /> <link rel="icon" type="image/svg+xml" href="/img/favicon.ico" />
@ -105,6 +107,9 @@
<!-- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script> <!-- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script> --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Flatpickr JS --> <!-- Flatpickr JS -->
</body> </body>

View File

@ -9,4 +9,88 @@
} }
.table_header_border { .table_header_border {
border-bottom:2px solid var(--bs-table-border-color) ; border-bottom:2px solid var(--bs-table-border-color) ;
} }
.text-gary-80 {
color:var(--bs-gray-500)
}
.text-royalblue{
color: #1796e3;
}
.text-md {
font-size: 2rem;
}
.text-md-b {
font-weight: normal;
}
.text-xxs { font-size: 0.55rem; } /* 8px */
.text-xs { font-size: 0.75rem; } /* 12px */
.text-sm { font-size: 0.875rem; } /* 14px */
.text-base { font-size: 1rem; } /* 16px */
.text-lg { font-size: 1.125rem; } /* 18px */
.text-xl { font-size: 1.25rem; } /* 20px */
.text-2xl { font-size: 1.5rem; } /* 24px */
.text-3xl { font-size: 1.875rem; } /* 30px */
.text-4xl { font-size: 2.25rem; } /* 36px */
.text-5xl { font-size: 3rem; } /* 48px */
.text-6xl { font-size: 3.75rem; } /* 60px */
.text-7xl { font-size: 4.5rem; } /* 72px */
.text-8xl { font-size: 6rem; } /* 96px */
.text-9xl { font-size: 8rem; } /* 128px */
/* */
.w-0 { width: 0px; }
.w-px { width: 1px; }
.w-1 { width: 0.25rem; } /* 4px */
.w-2 { width: 0.5rem; } /* 8px */
.w-3 { width: 0.75rem; } /* 12px */
.w-4 { width: 1rem; } /* 16px */
.w-5 { width: 1.25rem; } /* 20px */
.w-6 { width: 1.5rem; } /* 24px */
.w-8 { width: 2rem; } /* 32px */
.w-10 { width: 2.5rem; } /* 40px */
.w-12 { width: 3rem; } /* 48px */
.w-16 { width: 4rem; } /* 64px */
.w-20 { width: 5rem; } /* 80px */
.w-24 { width: 6rem; } /* 96px */
.w-32 { width: 8rem; } /* 128px */
.w-40 { width: 10rem; } /* 160px */
.w-48 { width: 12rem; } /* 192px */
.w-56 { width: 14rem; } /* 224px */
.w-64 { width: 16rem; } /* 256px */
.w-auto { width: auto; }
.w-full { width: 100%; }
.w-screen{ width: 100vw; }
.w-min { width: min-content; }
.w-max { width: max-content; }
.h-0 { height: 0px; }
.h-px { height: 1px; }
.h-1 { height: 0.25rem; } /* 4px */
.h-2 { height: 0.5rem; } /* 8px */
.h-3 { height: 0.75rem; } /* 12px */
.h-4 { height: 1rem; } /* 16px */
.h-5 { height: 1.25rem; } /* 20px */
.h-6 { height: 1.5rem; } /* 24px */
.h-8 { height: 2rem; } /* 32px */
.h-10 { height: 2.5rem; } /* 40px */
.h-12 { height: 3rem; } /* 48px */
.h-16 { height: 4rem; } /* 64px */
.h-20 { height: 5rem; } /* 80px */
.h-24 { height: 6rem; } /* 96px */
.h-32 { height: 8rem; } /* 128px */
.h-40 { height: 10rem; } /* 160px */
.h-48 { height: 12rem; } /* 192px */
.h-56 { height: 14rem; } /* 224px */
.h-64 { height: 16rem; } /* 256px */
.h-auto { height: auto; }
.h-full { height: 100%; }
.h-screen{ height: 100vh; }
.h-min { height: min-content; }
.h-max { height: max-content; }

View File

@ -32573,4 +32573,7 @@ body:not(.modal-open) .layout-content-navbar .layout-navbar {
} }
.text-red{ .text-red{
color:var(--bs-red) color:var(--bs-red)
}
.bg-gray {
background:var(--bs-body-color)
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

BIN
public/img/hero/bg-01.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 KiB

BIN
public/img/hero/bg-012.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 KiB

BIN
public/img/hero/bg-02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

BIN
public/img/hero/bg-03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

BIN
public/img/hero/bg-1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

BIN
public/img/hero/bg-2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
public/img/hero/bg-3.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

View File

Before

Width:  |  Height:  |  Size: 860 KiB

After

Width:  |  Height:  |  Size: 860 KiB

BIN
public/img/icons/ai.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/img/icons/report.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -3,15 +3,19 @@ import { useOrganizationModal } from "./hooks/useOrganization";
import OrganizationModal from "./components/Organization/OrganizationModal"; import OrganizationModal from "./components/Organization/OrganizationModal";
import { useAuthModal } from "./hooks/useAuth"; import { useAuthModal } from "./hooks/useAuth";
import SwitchTenant from "./pages/authentication/SwitchTenant"; import SwitchTenant from "./pages/authentication/SwitchTenant";
import { useProjectModal } from "./hooks/useProjects";
import { ProjectModal } from "./components/Project/ManageProjectInfo";
const ModalProvider = () => { const ModalProvider = () => {
const { isOpen, onClose } = useOrganizationModal(); const { isOpen, onClose } = useOrganizationModal();
const { isOpen: isAuthOpen } = useAuthModal(); const { isOpen: isAuthOpen } = useAuthModal();
const {isOpen:isOpenProject} = useProjectModal()
return ( return (
<> <>
{isOpen && <OrganizationModal />} {isOpen && <OrganizationModal />}
{isAuthOpen && <SwitchTenant />} {isAuthOpen && <SwitchTenant />}
{isOpenProject && <ProjectModal/>}
</> </>
); );
}; };

View File

@ -11,6 +11,7 @@ import { useSelector } from "react-redux";
import { useQueryClient } from "@tanstack/react-query"; import { useQueryClient } from "@tanstack/react-query";
import eventBus from "../../services/eventBus"; import eventBus from "../../services/eventBus";
import { useSelectedProject } from "../../slices/apiDataManager"; import { useSelectedProject } from "../../slices/apiDataManager";
import Pagination from "../common/Pagination";
const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizationId, includeInactive, date }) => { const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizationId, includeInactive, date }) => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
@ -108,6 +109,8 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat
return () => eventBus.off("employee", employeeHandler); return () => eventBus.off("employee", employeeHandler);
}, [employeeHandler]); }, [employeeHandler]);
return ( return (
<> <>
<div <div
@ -138,7 +141,7 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat
<tr className="border-top-1"> <tr className="border-top-1">
<th colSpan={2}>Name</th> <th colSpan={2}>Name</th>
<th>Role</th> <th>Role</th>
<th>Organization</th> {/* <th>Organization</th> */}
<th> <th>
<i className="bx bxs-down-arrow-alt text-success"></i> <i className="bx bxs-down-arrow-alt text-success"></i>
Check-In Check-In
@ -187,7 +190,7 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat
</td> </td>
<td>{item.jobRoleName}</td> <td>{item.jobRoleName}</td>
<td>{item.organizationName || "--"}</td> {/* <td>{item.organizationName || "--"}</td> */}
<td> <td>
{item.checkInTime {item.checkInTime
@ -226,46 +229,12 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat
{!loading && finalFilteredData.length > ITEMS_PER_PAGE && ( {!loading && finalFilteredData.length > ITEMS_PER_PAGE && (
<nav aria-label="Page ">
<ul className="pagination pagination-sm justify-content-end py-1"> <Pagination
<li currentPage={currentPage}
className={`page-item ${currentPage === 1 ? "disabled" : "" totalPages={totalPages}
}`} onPageChange={paginate}
> />
<button
className="page-link btn-xs"
onClick={() => paginate(currentPage - 1)}
>
&laquo;
</button>
</li>
{[...Array(totalPages)].map((_, index) => (
<li
key={index}
className={`page-item ${currentPage === index + 1 ? "active" : ""
}`}
>
<button
className="page-link "
onClick={() => paginate(index + 1)}
>
{index + 1}
</button>
</li>
))}
<li
className={`page-item ${currentPage === totalPages ? "disabled" : ""
}`}
>
<button
className="page-link "
onClick={() => paginate(currentPage + 1)}
>
&raquo;
</button>
</li>
</ul>
</nav>
)} )}
</> </>
) : ( ) : (

View File

@ -11,6 +11,7 @@ import AttendanceRepository from "../../repositories/AttendanceRepository";
import { useAttendancesLogs } from "../../hooks/useAttendance"; import { useAttendancesLogs } from "../../hooks/useAttendance";
import { queryClient } from "../../layouts/AuthLayout"; import { queryClient } from "../../layouts/AuthLayout";
import { ITEMS_PER_PAGE } from "../../utils/constants"; import { ITEMS_PER_PAGE } from "../../utils/constants";
import Pagination from "../common/Pagination";
const usePagination = (data, itemsPerPage) => { const usePagination = (data, itemsPerPage) => {
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
@ -84,56 +85,50 @@ const AttendanceLog = ({ handleModalData, searchTerm ,organizationId}) => {
dateRange.endDate, dateRange.endDate,
organizationId organizationId
); );
const filtering = (data) => { const filtering = useCallback((dataToFilter) => {
const filteredData = showPending const filteredData = showPending
? data.filter((item) => item.checkOutTime === null) ? dataToFilter.filter((item) => item.checkOutTime === null)
: data; : dataToFilter;
const group1 = filteredData const group1 = filteredData
.filter((d) => d.activity === 1 && isSameDay(d.checkInTime)) .filter((d) => d.activity === 1 && isSameDay(d.checkInTime))
.sort(sortByName); .sort(sortByName);
const group2 = filteredData const group2 = filteredData
.filter((d) => d.activity === 4 && isSameDay(d.checkOutTime)) .filter((d) => d.activity === 4 && isSameDay(d.checkOutTime))
.sort(sortByName); .sort(sortByName);
const group3 = filteredData const group3 = filteredData
.filter((d) => d.activity === 1 && isBeforeToday(d.checkInTime)) .filter((d) => d.activity === 1 && isBeforeToday(d.checkInTime))
.sort(sortByName); .sort(sortByName);
const group4 = filteredData.filter( const group4 = filteredData.filter(
(d) => d.activity === 4 && isBeforeToday(d.checkOutTime) (d) => d.activity === 4 && isBeforeToday(d.checkOutTime)
); );
const group5 = filteredData const group5 = filteredData
.filter((d) => d.activity === 2 && isBeforeToday(d.checkOutTime)) .filter((d) => d.activity === 2 && isBeforeToday(d.checkOutTime))
.sort(sortByName); .sort(sortByName);
const group6 = filteredData const group6 = filteredData
.filter((d) => d.activity === 5) .filter((d) => d.activity === 5)
.sort(sortByName); .sort(sortByName);
const sortedList = [ const sortedList = [...group1, ...group2, ...group3, ...group4, ...group5, ...group6];
...group1,
...group2,
...group3,
...group4,
...group5,
...group6,
];
// Group by date // Group by date
const groupedByDate = sortedList.reduce((acc, item) => { const groupedByDate = sortedList.reduce((acc, item) => {
const date = (item.checkInTime || item.checkOutTime)?.split("T")[0]; const date = (item.checkInTime || item.checkOutTime)?.split("T")[0];
if (date) { if (date) {
acc[date] = acc[date] || []; acc[date] = acc[date] || [];
acc[date].push(item); acc[date].push(item);
} }
return acc; return acc;
}, {}); }, {});
const sortedDates = Object.keys(groupedByDate).sort( const sortedDates = Object.keys(groupedByDate).sort(
(a, b) => new Date(b) - new Date(a) (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(() => { useEffect(() => {
filtering(data); filtering(data);
@ -285,7 +280,7 @@ const AttendanceLog = ({ handleModalData, searchTerm ,organizationId}) => {
Name Name
</th> </th>
<th className="border-top-1">Date</th> <th className="border-top-1">Date</th>
<th>Organization</th> {/* <th>Organization</th> */}
<th> <th>
<i className="bx bxs-down-arrow-alt text-success"></i> Check-In <i className="bx bxs-down-arrow-alt text-success"></i> Check-In
</th> </th>
@ -344,7 +339,7 @@ const AttendanceLog = ({ handleModalData, searchTerm ,organizationId}) => {
attendance.checkInTime || attendance.checkOutTime attendance.checkInTime || attendance.checkOutTime
).format("DD-MMM-YYYY")} ).format("DD-MMM-YYYY")}
</td> </td>
<td>{attendance.organizationName || "--"}</td> {/* <td>{attendance.organizationName || "--"}</td> */}
<td>{convertShortTime(attendance.checkInTime)}</td> <td>{convertShortTime(attendance.checkInTime)}</td>
<td> <td>
{attendance.checkOutTime {attendance.checkOutTime
@ -378,45 +373,11 @@ const AttendanceLog = ({ handleModalData, searchTerm ,organizationId}) => {
</div> </div>
)} )}
{filteredSearchData.length > ITEMS_PER_PAGE && ( {filteredSearchData.length > ITEMS_PER_PAGE && (
<nav aria-label="Page "> <Pagination
<ul className="pagination pagination-sm justify-content-end py-1"> currentPage={currentPage}
<li className={`page-item ${currentPage === 1 ? "disabled" : ""}`}> totalPages={totalPages}
<button onPageChange={paginate}
className="page-link btn-xs" />
onClick={() => paginate(currentPage - 1)}
>
&laquo;
</button>
</li>
{Array.from({ length: totalPages }, (_, i) => i + 1).map(
(pageNumber) => (
<li
key={pageNumber}
className={`page-item ${currentPage === pageNumber ? "active" : ""
}`}
>
<button
className="page-link"
onClick={() => paginate(pageNumber)}
>
{pageNumber}
</button>
</li>
)
)}
<li
className={`page-item ${currentPage === totalPages ? "disabled" : ""
}`}
>
<button
className="page-link"
onClick={() => paginate(currentPage + 1)}
>
&raquo;
</button>
</li>
</ul>
</nav>
)} )}
</> </>
); );

View File

@ -1,4 +1,4 @@
import React, { useState } from "react"; import React, { useEffect, useState } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { z } from "zod"; import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
@ -9,6 +9,7 @@ import showToast from "../../services/toastService";
import { checkIfCurrentDate } from "../../utils/dateUtils"; import { checkIfCurrentDate } from "../../utils/dateUtils";
import { useMarkAttendance } from "../../hooks/useAttendance"; import { useMarkAttendance } from "../../hooks/useAttendance";
import { useSelectedProject } from "../../slices/apiDataManager"; import { useSelectedProject } from "../../slices/apiDataManager";
import { useProjectName } from "../../hooks/useProjects";
const createSchema = (modeldata) => { const createSchema = (modeldata) => {
return z return z
@ -19,31 +20,36 @@ const createSchema = (modeldata) => {
.max(200, "Description should be less than 200 characters") .max(200, "Description should be less than 200 characters")
.optional(), .optional(),
}) })
.refine((data) => { .refine(
if (modeldata?.checkInTime && !modeldata?.checkOutTime) { (data) => {
const checkIn = new Date(modeldata.checkInTime); if (modeldata?.checkInTime && !modeldata?.checkOutTime) {
const [time, modifier] = data.markTime.split(" "); const checkIn = new Date(modeldata.checkInTime);
const [hourStr, minuteStr] = time.split(":"); const [time, modifier] = data.markTime.split(" ");
let hour = parseInt(hourStr, 10); const [hourStr, minuteStr] = time.split(":");
const minute = parseInt(minuteStr, 10); let hour = parseInt(hourStr, 10);
const minute = parseInt(minuteStr, 10);
if (modifier === "PM" && hour !== 12) hour += 12; if (modifier === "PM" && hour !== 12) hour += 12;
if (modifier === "AM" && hour === 12) hour = 0; if (modifier === "AM" && hour === 12) hour = 0;
const checkOut = new Date(checkIn); const checkOut = new Date(checkIn);
checkOut.setHours(hour, minute, 0, 0); checkOut.setHours(hour, minute, 0, 0);
return checkOut > checkIn; return checkOut >= checkIn;
}
return true;
},
{
message: "Checkout time must be later than check-in time",
path: ["markTime"],
} }
return true; );
}, {
message: "Checkout time must be later than check-in time",
path: ["markTime"],
});
}; };
const CheckInCheckOut = ({ modeldata, closeModal, handleSubmitForm }) => { const CheckInCheckOut = ({ modeldata, closeModal, handleSubmitForm }) => {
const [currentProject, setCurrentProject] = useState(null);
const projectId = useSelectedProject(); const projectId = useSelectedProject();
const { projectNames, loading } = useProjectName();
const { mutate: MarkAttendance } = useMarkAttendance(); const { mutate: MarkAttendance } = useMarkAttendance();
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const coords = usePositionTracker(); const coords = usePositionTracker();
@ -95,17 +101,24 @@ const CheckInCheckOut = ({ modeldata, closeModal, handleSubmitForm }) => {
closeModal(); closeModal();
}; };
useEffect(() => {
if (projectId && projectNames) {
setCurrentProject(
projectNames?.find((project) => project.id === projectId)
);
}
}, [projectNames, projectId, loading]);
return ( return (
<form className="row g-2" onSubmit={handleSubmit(onSubmit)}> <form className="row g-2" onSubmit={handleSubmit(onSubmit)}>
<div className="col-12 d-flex justify-content-center"> <div className="col-12 d-flex justify-content-center">
<label className="fs-5 text-dark text-center"> <label className="fs-5 text-dark text-center">
{modeldata?.checkInTime && !modeldata?.checkOutTime {modeldata?.checkInTime && !modeldata?.checkOutTime
? "Check-out :" ? `Check out for ${currentProject?.name}`
: "Check-in :"} : `Check In for ${currentProject?.name}`}
</label> </label>
</div> </div>
<div className="col-6 col-md-6 text-start"> <div className="col-6 col-md-6 text-start">
<label className="form-label" htmlFor="checkInDate"> <label className="form-label" htmlFor="checkInDate">
{modeldata?.checkInTime && !modeldata?.checkOutTime {modeldata?.checkInTime && !modeldata?.checkOutTime

View File

@ -9,6 +9,7 @@ import usePagination from "../../hooks/usePagination";
import eventBus from "../../services/eventBus"; import eventBus from "../../services/eventBus";
import { cacheData, clearCacheKey, useSelectedProject } from "../../slices/apiDataManager"; import { cacheData, clearCacheKey, useSelectedProject } from "../../slices/apiDataManager";
import { useQueryClient } from "@tanstack/react-query"; import { useQueryClient } from "@tanstack/react-query";
import Pagination from "../common/Pagination";
const Regularization = ({ handleRequest, searchTerm,projectId, organizationId, IncludeInActive }) => { const Regularization = ({ handleRequest, searchTerm,projectId, organizationId, IncludeInActive }) => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
@ -128,7 +129,7 @@ const Regularization = ({ handleRequest, searchTerm,projectId, organizationId, I
<tr> <tr>
<th colSpan={2}>Name</th> <th colSpan={2}>Name</th>
<th>Date</th> <th>Date</th>
<th>Organization</th> {/* <th>Organization</th> */}
<th> <th>
<i className="bx bxs-down-arrow-alt text-success"></i>Check-In <i className="bx bxs-down-arrow-alt text-success"></i>Check-In
</th> </th>
@ -158,7 +159,7 @@ const Regularization = ({ handleRequest, searchTerm,projectId, organizationId, I
</td> </td>
<td>{moment(att.checkOutTime).format("DD-MMM-YYYY")}</td> <td>{moment(att.checkOutTime).format("DD-MMM-YYYY")}</td>
<td>{att.organizationName || "--"}</td> {/* <td>{att.organizationName || "--"}</td> */}
<td>{convertShortTime(att.checkInTime)}</td> <td>{convertShortTime(att.checkInTime)}</td>
<td> <td>
@ -189,43 +190,11 @@ const Regularization = ({ handleRequest, searchTerm,projectId, organizationId, I
</div> </div>
)} )}
{!loading && totalPages > 1 && ( {!loading && totalPages > 1 && (
<nav aria-label="Page "> <Pagination
<ul className="pagination pagination-sm justify-content-end py-1 mt-3"> currentPage={currentPage}
<li className={`page-item ${currentPage === 1 ? "disabled" : ""}`}> totalPages={totalPages}
<button onPageChange={paginate}
className="page-link btn-xs" />
onClick={() => paginate(currentPage - 1)}
>
&laquo;
</button>
</li>
{[...Array(totalPages)].map((_, index) => (
<li
key={index}
className={`page-item ${currentPage === index + 1 ? "active" : ""
}`}
>
<button
className="page-link "
onClick={() => paginate(index + 1)}
>
{index + 1}
</button>
</li>
))}
<li
className={`page-item ${currentPage === totalPages ? "disabled" : ""
}`}
>
<button
className="page-link "
onClick={() => paginate(currentPage + 1)}
>
&raquo;
</button>
</li>
</ul>
</nav>
)} )}
</div> </div>
); );

View File

@ -2,7 +2,7 @@ import React, { useState, useMemo } from "react";
import ApexChart from "../Charts/Circle"; import ApexChart from "../Charts/Circle";
import { useProjects } from "../../hooks/useProjects"; import { useProjects } from "../../hooks/useProjects";
import { useDashboard_AttendanceData } from "../../hooks/useDashboard_Data"; import { useDashboard_AttendanceData } from "../../hooks/useDashboard_Data";
import { useSelectedProject } from "../../hooks/useSelectedProject"; // your custom hook import { useSelectedProject } from "../../hooks/useSelectedProject";
const Attendance = () => { const Attendance = () => {
const { projects } = useProjects(); const { projects } = useProjects();
@ -31,7 +31,7 @@ const selectedProjectId = useSelectedProject()
<div className="card-header mb-1 pb-0"> <div className="card-header mb-1 pb-0">
<div className="d-flex flex-wrap justify-content-between align-items-center"> <div className="d-flex flex-wrap justify-content-between align-items-center">
<div className="card-title mb-0 text-start"> <div className="card-title mb-0 text-start">
<h5 className="mb-1">Attendance</h5> <h5 className="mb-1 card-title">Attendance</h5>
<p className="card-subtitle">Daily Attendance Data</p> <p className="card-subtitle">Daily Attendance Data</p>
</div> </div>

View File

@ -1,205 +0,0 @@
import React, { useState, useMemo } from "react";
import { useSelector } from "react-redux";
import ReactApexChart from "react-apexcharts";
import { useAttendanceOverviewData } from "../../hooks/useDashboard_Data";
import flatColors from "../Charts/flatColor";
import ChartSkeleton from "../Charts/Skelton";
const formatDate = (dateStr) => {
const date = new Date(dateStr);
return date.toLocaleDateString("en-GB", {
day: "2-digit",
month: "long",
});
};
const AttendanceOverview = () => {
const [dayRange, setDayRange] = useState(7);
const [view, setView] = useState("chart");
const projectId = useSelector((store) => store.localVariables.projectId);
const { attendanceOverviewData, loading, error } = useAttendanceOverviewData(
projectId,
dayRange
);
const { tableData, roles, dates } = useMemo(() => {
const map = new Map();
attendanceOverviewData.forEach((entry) => {
const date = formatDate(entry.date);
if (!map.has(date)) map.set(date, {});
map.get(date)[entry.role.trim()] = entry.present;
});
const uniqueRoles = [
...new Set(attendanceOverviewData.map((e) => e.role.trim())),
];
const sortedDates = [...map.keys()];
const data = sortedDates.map((date) => {
const row = { date };
uniqueRoles.forEach((role) => {
row[role] = map.get(date)?.[role] ?? 0;
});
return row;
});
return {
tableData: data,
roles: uniqueRoles,
dates: sortedDates,
};
}, [attendanceOverviewData]);
const chartSeries = roles.map((role) => ({
name: role,
data: tableData.map((row) => row[role]),
}));
const chartOptions = {
chart: {
type: "bar",
stacked: true,
height: 400,
toolbar: { show: false },
},
plotOptions: {
bar: {
borderRadius: 2,
columnWidth: "60%",
},
},
xaxis: {
categories: tableData.map((row) => row.date),
},
yaxis: {
show: true,
axisBorder: {
show: true,
color: "#78909C",
offsetX: 0,
offsetY: 0,
},
axisTicks: {
show: true,
borderType: "solid",
color: "#78909C",
width: 6,
offsetX: 0,
offsetY: 0,
},
},
legend: {
position: "bottom",
},
fill: {
opacity: 1,
},
colors: roles.map((_, i) => flatColors[i % flatColors.length]),
};
return (
<div className="bg-white p-4 rounded shadow d-flex flex-column">
{/* Header */}
<div className="d-flex justify-content-between align-items-center mb-3">
<div className="card-title mb-0 text-start">
<h5 className="mb-1 fw-bold">Attendance Overview</h5>
<p className="card-subtitle">Role-wise present count</p>
</div>
<div className="d-flex gap-2">
<select
className="form-select form-select-sm"
value={dayRange}
onChange={(e) => setDayRange(Number(e.target.value))}
>
<option value={7}>Last 7 Days</option>
<option value={15}>Last 15 Days</option>
<option value={30}>Last 30 Days</option>
</select>
<button
className={`btn btn-sm p-1 ${
view === "chart" ? "btn-primary" : "btn-outline-primary"
}`}
onClick={() => setView("chart")}
title="Chart View"
>
<i className="bx bx-bar-chart-alt-2"></i>
</button>
<button
className={`btn btn-sm p-1 ${
view === "table" ? "btn-primary" : "btn-outline-primary"
}`}
onClick={() => setView("table")}
title="Table View"
>
<i className="bx bx-list-ul fs-5"></i>
</button>
</div>
</div>
{/* Content */}
<div className="flex-grow-1 d-flex align-items-center justify-content-center">
{loading ? (
<ChartSkeleton />
) : error ? (
<p className="text-danger">{error}</p>
) : view === "chart" ? (
<div className="w-100">
<ReactApexChart
options={chartOptions}
series={chartSeries}
type="bar"
height={400}
/>
</div>
) : (
<div
className="table-responsive w-100"
style={{ maxHeight: "350px", overflowY: "auto" }}
>
<table className="table table-bordered table-sm text-start align-middle mb-0">
<thead
className="table-light"
style={{ position: "sticky", top: 0, zIndex: 1 }}
>
<tr>
<th style={{ background: "#f8f9fa", textTransform: "none" }}>
Role
</th>
{dates.map((date, idx) => (
<th
key={idx}
style={{ background: "#f8f9fa", textTransform: "none" }}
>
{date}
</th>
))}
</tr>
</thead>
<tbody>
{roles.map((role) => (
<tr key={role}>
<td>{role}</td>
{tableData.map((row, idx) => {
const value = row[role];
const cellStyle =
value > 0 ? { backgroundColor: "#d5d5d5" } : {};
return (
<td key={idx} style={cellStyle}>
{value}
</td>
);
})}
</tr>
))}
</tbody>
</table>
</div>
)}
</div>
</div>
);
};
export default AttendanceOverview;

View File

@ -0,0 +1,133 @@
import React, { useState, useMemo } from "react";
import { useSelector } from "react-redux";
import ReactApexChart from "react-apexcharts";
import { useAttendanceOverviewData } from "../../hooks/useDashboard_Data";
import flatColors from "../Charts/flatColor";
import ChartSkeleton from "../Charts/Skelton";
import { useSelectedProject } from "../../slices/apiDataManager";
import { formatDate_DayMonth } from "../../utils/dateUtils";
const AttendanceOverview = () => {
const [dayRange, setDayRange] = useState(7);
const [view, setView] = useState("chart");
const selectedProject = useSelectedProject();
const { data: attendanceOverviewData, isLoading, isError, error } = useAttendanceOverviewData(
selectedProject,
dayRange
);
// Use empty array while loading
const attendanceData = attendanceOverviewData || [];
const { tableData, roles, dates } = useMemo(() => {
if (!attendanceData || attendanceData.length === 0) {
return { tableData: [], roles: [], dates: [] };
}
const map = new Map();
attendanceData.forEach((entry) => {
const date = formatDate_DayMonth(entry.date);
if (!map.has(date)) map.set(date, {});
map.get(date)[entry.role.trim()] = entry.present;
});
const uniqueRoles = [...new Set(attendanceData.map((e) => e.role.trim()))];
const sortedDates = [...map.keys()];
const tableData = sortedDates.map((date) => {
const row = { date };
uniqueRoles.forEach((role) => {
row[role] = map.get(date)?.[role] ?? 0;
});
return row;
});
return { tableData, roles: uniqueRoles, dates: sortedDates };
}, [attendanceData]);
const chartSeries = roles.map((role) => ({
name: role,
data: tableData.map((row) => row[role]),
}));
const chartOptions = {
chart: { type: "bar", stacked: true, height: 400, toolbar: { show: false } },
plotOptions: { bar: { borderRadius: 2, columnWidth: "60%" } },
xaxis: { categories: tableData.map((row) => row.date) },
yaxis: { show: true, axisBorder: { show: true, color: "#78909C" }, axisTicks: { show: true, color: "#78909C", width: 6 } },
legend: { position: "bottom" },
fill: { opacity: 1 },
colors: roles.map((_, i) => flatColors[i % flatColors.length]),
};
return (
<div className="bg-white p-4 rounded shadow d-flex flex-column position-relative " >
{/* Optional subtle loading overlay */}
{isLoading && (
<div className="position-absolute w-100 h-100 d-flex align-items-center justify-content-center bg-white bg-opacity-50 z-index-1">
<span>Loading...</span>
</div>
)}
{/* Header */}
<div className="d-flex justify-content-between align-items-center mb-3">
<div className="card-title mb-0 text-start">
<h5 className="mb-1 card-title">Attendance Overview</h5>
<p className="card-subtitle">Role-wise present count</p>
</div>
<div className="d-flex gap-2">
<select className="form-select form-select-sm" value={dayRange} onChange={(e) => setDayRange(Number(e.target.value))}>
<option value={7}>Last 7 Days</option>
<option value={15}>Last 15 Days</option>
<option value={30}>Last 30 Days</option>
</select>
<button className={`btn btn-sm p-1 ${view === "chart" ? "btn-primary" : "btn-outline-primary"}`} onClick={() => setView("chart")} title="Chart View">
<i className="bx bx-bar-chart-alt-2"></i>
</button>
<button className={`btn btn-sm p-1 ${view === "table" ? "btn-primary" : "btn-outline-primary"}`} onClick={() => setView("table")} title="Table View">
<i className="bx bx-list-ul fs-5"></i>
</button>
</div>
</div>
{/* Content */}
<div className="flex-grow-1 d-flex align-items-center justify-content-center">
{view === "chart" ? (
<div className="w-100">
<ReactApexChart options={chartOptions} series={chartSeries} type="bar" height={300} />
</div>
) : (
<div className="table-responsive w-100" style={{ maxHeight: "350px", overflowY: "auto" }}>
<table className="table table-bordered table-sm text-start align-middle mb-0">
<thead className="table-light" style={{ position: "sticky", top: 0, zIndex: 1 }}>
<tr>
<th style={{ background: "#f8f9fa", textTransform: "none" }}>Role</th>
{dates.map((date, idx) => (
<th key={idx} style={{ background: "#f8f9fa", textTransform: "none" }}>{date}</th>
))}
</tr>
</thead>
<tbody>
{roles.map((role) => (
<tr key={role}>
<td>{role}</td>
{tableData.map((row, idx) => {
const value = row[role];
return <td key={idx} style={value > 0 ? { backgroundColor: "#d5d5d5" } : {}}>{value}</td>;
})}
</tr>
))}
</tbody>
</table>
</div>
)}
</div>
</div>
);
};
export default AttendanceOverview;

View File

@ -1,69 +1,63 @@
import React from "react"; import React, { useEffect, useState } from "react";
import { useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { // import {
useDashboardProjectsCardData, // useDashboardProjectsCardData,
useDashboardTeamsCardData, // useDashboardTeamsCardData,
useDashboardTasksCardData, // useDashboardTasksCardData,
useAttendanceOverviewData // useAttendanceOverviewData
} from "../../hooks/useDashboard_Data"; // } from "../../hooks/useDashboard_Data";
import Projects from "./Projects"; // import Projects from "./Projects";
import Teams from "./Teams"; // import Teams from "./Teams";
import TasksCard from "./Tasks"; // import TasksCard from "./Tasks";
import ProjectCompletionChart from "./ProjectCompletionChart"; // import ProjectCompletionChart from "./ProjectCompletionChart";
import ProjectProgressChart from "./ProjectProgressChart"; // import ProjectProgressChart from "./ProjectProgressChart";
import ProjectOverview from "../Project/ProjectOverview"; // import ProjectOverview from "../Project/ProjectOverview";
import AttendanceOverview from "./AttendanceChart"; import AttendanceOverview from "./AttendanceOverview";
import { useSelectedProject } from "../../slices/apiDataManager";
import { useProjectName } from "../../hooks/useProjects";
import ExpenseAnalysis from "./ExpenseAnalysis";
import ExpenseStatus from "./ExpenseStatus";
import ExpenseByProject from "./ExpenseByProject";
const Dashboard = () => { const Dashboard = () => {
const { projectsCardData } = useDashboardProjectsCardData(); // const { projectsCardData } = useDashboardProjectsCardData();
const { teamsCardData } = useDashboardTeamsCardData(); // const { teamsCardData } = useDashboardTeamsCardData();
const { tasksCardData } = useDashboardTasksCardData(); // const { tasksCardData } = useDashboardTasksCardData();
// Get the selected project ID from Redux store // Get the selected project ID from Redux store
const projectId = useSelector((store) => store.localVariables.projectId); const projectId = useSelector((store) => store.localVariables.projectId);
const isAllProjectsSelected = projectId === null; const isAllProjectsSelected = projectId === null;
return ( return (
<div className="container-fluid mt-5"> <div className="container-fluid py-5">
<div className="row gy-4"> <div className="row mb-6 g-6">
{isAllProjectsSelected && ( <div className="col-12 col-xl-8">
<div className="col-sm-6 col-lg-4"> <div className="card h-100">
<Projects projectsCardData={projectsCardData} /> <ExpenseAnalysis />
</div> </div>
)} </div>
<div className={`${!isAllProjectsSelected ? "col-sm-6 col-lg-6" : "col-sm-6 col-lg-4"}`}> <div className="col-12 col-xl-4 col-md-6">
<Teams teamsCardData={teamsCardData} /> <div className="card ">
</div> <ExpenseStatus />
</div>
</div>
</div>
<div className={`${!isAllProjectsSelected ? "col-sm-6 col-lg-6" : "col-sm-6 col-lg-4"}`}> <div className="row g-6">
<TasksCard tasksCardData={tasksCardData} /> {!isAllProjectsSelected && (
</div> <div className="col-6">
<AttendanceOverview />
</div>
)}
<div className="col-6">
<ExpenseByProject />
</div>
</div>
</div>
{isAllProjectsSelected && ( );
<div className="col-xxl-6 col-lg-6">
<ProjectCompletionChart />
</div>
)}
{!isAllProjectsSelected && (
<div className="col-xxl-6 col-lg-6">
<ProjectOverview />
</div>
)}
<div className="col-xxl-6 col-lg-6">
<ProjectProgressChart />
</div>
{!isAllProjectsSelected && (
<div className="col-xxl-6 col-lg-6">
<AttendanceOverview /> {/* ✅ Removed unnecessary projectId prop */}
</div>
)}
</div>
</div>
);
}; };
export default Dashboard; export default Dashboard;

View File

@ -0,0 +1,158 @@
import React, { useEffect, useMemo, useState } from "react";
import Chart from "react-apexcharts";
import { useExpenseAnalysis } from "../../hooks/useDashboard_Data";
import { useSelectedProject } from "../../slices/apiDataManager";
import { DateRangePicker1 } from "../common/DateRangePicker";
import { FormProvider, useForm } from "react-hook-form";
import { formatCurrency, localToUtc } from "../../utils/appUtils";
const ExpenseAnalysis = () => {
const projectId = useSelectedProject();
const methods = useForm({
defaultValues: {
startDate: "",
endDate: "",
},
});
const { watch } = methods;
const [startDate, endDate] = watch(["startDate", "endDate"]);
const { data, isLoading, isError, error, isFetching } = useExpenseAnalysis(
projectId,
startDate ? localToUtc(startDate) : null,
endDate ? localToUtc(endDate) : null
);
if (isError) return <div>{error.message}</div>;
const report = data?.report ?? [];
const { labels, series, total } = useMemo(() => {
const labels = report.map((item) => item.projectName);
const series = report.map((item) => item.totalApprovedAmount || 0);
const total = formatCurrency(data?.totalAmount || 0);
return { labels, series, total };
}, [report, data?.totalAmount]);
const donutOptions = {
chart: { type: "donut" },
labels,
legend: { show: false },
dataLabels: { enabled: true, formatter: (val) => `${val.toFixed(0)}%` },
colors: ["#7367F0", "#28C76F", "#FF9F43", "#EA5455", "#00CFE8", "#FF78B8"],
plotOptions: {
pie: {
donut: {
size: "70%",
labels: {
show: true,
total: {
show: true,
label: "Total",
fontSize: "16px",
formatter: () => `${total}`,
},
},
},
},
},
};
if (data?.report === 0) {
return <div>No data found</div>;
}
return (
<>
<div className="card-header d-flex justify-content-between align-items-center ">
<div>
<h5 className="mb-1 card-title text-start">Expense Breakdown</h5>
<p className="card-subtitle">Category Wise Expense Breakdown</p>
</div>
<div className="text-end">
<FormProvider {...methods}>
<DateRangePicker1 />
</FormProvider>
</div>
</div>
<div className="card-body position-relative">
{/* Initial loading: show full loader */}
{isLoading && (
<div
className="d-flex justify-content-center align-items-center"
style={{ height: "200px" }}
>
<span>Loading...</span>
</div>
)}
{/* Data display */}
{!isLoading && report.length === 0 && (
<div className="text-center text-muted py-5">No data found</div>
)}
{!isLoading && report.length > 0 && (
<>
{/* Overlay spinner for refetch */}
{isFetching && (
<div className="position-absolute top-0 start-0 w-100 h-100 d-flex justify-content-center align-items-center bg-white bg-opacity-75">
<span>Loading...</span>
</div>
)}
<div className="d-flex justify-content-center mb-3">
<Chart
options={donutOptions}
series={report.map((item) => item.totalApprovedAmount || 0)}
type="donut"
width="320"
/>
</div>
<div className="mb-2 w-100">
<div className="row">
{report.map((item, idx) => (
<div
className="col-6 d-flex justify-content-start align-items-start mb-2"
key={idx}
>
<div className="avatar me-2">
<span
className="avatar-initial rounded-2"
style={{
backgroundColor:
donutOptions.colors[
idx % donutOptions.colors.length
],
}}
>
<i className="bx bx-receipt fs-4"></i>
</span>
</div>
<div className="d-flex flex-column gap-1 text-start">
<small className="fw-semibold ">{item.projectName}</small>
<span className="fw-semibold text-muted ms-1">
{formatCurrency(item.totalApprovedAmount)}
</span>
</div>
</div>
))}
</div>
</div>
</>
)}
</div>
</>
);
};
export default ExpenseAnalysis;

View File

@ -0,0 +1,164 @@
import React, { useState, useEffect } from "react";
import Chart from "react-apexcharts";
import { useExpenseType } from "../../hooks/masterHook/useMaster";
import { useSelector } from "react-redux";
import { useExpenseDataByProject } from "../../hooks/useDashboard_Data";
import { formatCurrency } from "../../utils/appUtils";
import { formatDate_DayMonth } from "../../utils/dateUtils";
const ExpenseByProject = () => {
const projectId = useSelector((store) => store.localVariables.projectId);
const [range, setRange] = useState("12M");
const [selectedType, setSelectedType] = useState("");
const [viewMode, setViewMode] = useState("Category");
const [chartData, setChartData] = useState({ categories: [], data: [] });
const { ExpenseTypes, loading: typeLoading } = useExpenseType();
const { data: expenseApiData, isLoading } = useExpenseDataByProject(
projectId,
selectedType,
range === "All" ? null : parseInt(range)
);
useEffect(() => {
if (expenseApiData) {
const categories = expenseApiData.map((item) =>
formatDate_DayMonth(item.monthName, item.year)
);
const data = expenseApiData.map((item) => item.total);
setChartData({ categories, data });
} else {
setChartData({ categories: [], data: [] });
}
}, [expenseApiData]);
const getSelectedTypeName = () => {
if (!selectedType) return "All Types";
const found = ExpenseTypes.find((t) => t.id === selectedType);
return found ? found.name : "All Types";
};
const options = {
chart: { type: "bar", toolbar: { show: false } },
plotOptions: {
bar: { horizontal: false, columnWidth: "55%", borderRadius: 4 },
},
dataLabels: { enabled: true, formatter: (val) => formatCurrency(val) },
xaxis: {
categories: chartData.categories,
labels: { style: { fontSize: "12px" }, rotate: -45 },
},
tooltip: {
y: {
formatter: (val) => `${formatCurrency(val)} (${getSelectedTypeName()})`,
},
},
annotations: { xaxis: [{ x: 0, strokeDashArray: 0 }] },
fill: { opacity: 1 },
colors: ["#2196f3"],
};
const series = [
{
name: getSelectedTypeName(),
data: chartData.data,
},
];
return (
<div className="card shadow-sm rounded ">
{/* Header */}
<div className="card-header">
<div className="d-flex justify-content-start align-items-center mb-3 mt-3">
<div>
<h5 className="mb-1 me-6 card-title">Monthly Expense -</h5>
<p className="card-subtitle me-5 mb-0">Detailed project expenses</p>
</div>
<div className="btn-group mb-4 ms-n8">
<button
className="btn btn-sm dropdown-toggle fs-5"
type="button"
data-bs-toggle="dropdown"
aria-expanded="false"
>
{viewMode}
</button>
<ul className="dropdown-menu dropdown-menu-end ">
<li>
<button
className="dropdown-item"
onClick={() => {
setViewMode("Category");
setSelectedType("");
}}
>
Category
</button>
</li>
<li>
<button
className="dropdown-item"
onClick={() => {
setViewMode("Project");
setSelectedType("");
}}
>
Project
</button>
</li>
</ul>
</div>
</div>
{/* Range Buttons + Expense Dropdown */}
<div className="d-flex align-items-center flex-wrap">
{["1M", "3M", "6M", "12M", "All"].map((item) => (
<button
key={item}
className={`border-0 px-2 py-1 text-sm rounded ${
range === item
? "text-white bg-primary"
: "text-body bg-transparent"
}`}
style={{ cursor: "pointer", transition: "all 0.2s ease" }}
onClick={() => setRange(item)}
>
{item}
</button>
))}
{viewMode === "Category" && (
<select
className="form-select form-select-sm ms-auto mb-3"
value={selectedType}
onChange={(e) => setSelectedType(e.target.value)}
disabled={typeLoading}
style={{ maxWidth: "200px" }}
>
<option value="">All Types</option>
{ExpenseTypes.map((type) => (
<option key={type.id} value={type.id}>
{type.name}
</option>
))}
</select>
)}
</div>
</div>
{/* Chart */}
<div
className="card-body bg-white text-dark p-3 rounded"
>
{isLoading ? (
<p>Loading chart...</p>
) : (
<Chart options={options} series={series} type="bar" height={235} />
)}
</div>
</div>
);
};
export default ExpenseByProject;

View File

@ -0,0 +1,128 @@
import React, { useEffect, useState } from "react";
import { useExpense } from "../../hooks/useExpense";
import { useExpenseStatus } from "../../hooks/useDashboard_Data";
import { useSelectedProject } from "../../slices/apiDataManager";
import { useProjectName } from "../../hooks/useProjects";
import { countDigit, formatCurrency } from "../../utils/appUtils";
import { EXPENSE_MANAGE, EXPENSE_STATUS } from "../../utils/constants";
import { useNavigate } from "react-router-dom";
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
const ExpenseStatus = () => {
const [projectName, setProjectName] = useState("All Project");
const selectedProject = useSelectedProject();
const { projectNames, loading } = useProjectName();
const { data, isPending, error } = useExpenseStatus(selectedProject);
const navigate = useNavigate();
const isManageExpense = useHasUserPermission(EXPENSE_MANAGE)
useEffect(() => {
if (selectedProject && projectNames?.length) {
const project = projectNames.find((p) => p.id === selectedProject);
setProjectName(project?.name || "All Project");
} else {
setProjectName("All Project");
}
}, [projectNames, selectedProject]);
const handleNavigate = (status) => {
if (selectedProject) {
navigate(`/expenses/${status}/${selectedProject}`);
} else {
navigate(`/expenses/${status}`);
}
};
return (
<>
<div className="card-header d-flex justify-content-between text-start ">
<div className="m-0">
<h5 className="card-title mb-1">Expense - By Status</h5>
<p className="card-subtitle m-0 ">{projectName}</p>
</div>
</div>
<div className="card-body ">
<div className=" py-0 text-start mb-2">
{isManageExpense && ( <div className="d-flex justify-content-between align-items-center">
<div className="d-block">
<span className={`fs-semibold d-block ${countDigit(data?.totalAmount) > 3 ? "text-base":"text-lg" }`}>Project Spendings:</span>{" "}
<small className="d-block text-xxs text-gary-80">{`(All Processed Payments)`}</small>
</div>
<span className={`text-end text-royalblue ${countDigit(data?.totalAmount) > 3 ? "text-":"text-3xl" } text-md`}>
{formatCurrency(data?.totalAmount)}
</span>
</div>)}
</div>
<div className="report-list text-start">
{[
{
title: "Pending Payment",
count: data?.approvePending?.count,
amount: data?.approvePending?.totalAmount,
icon: "bx bx-rupee",
iconColor: "text-primary",
status: EXPENSE_STATUS.payment_pending,
},
{
title: "Pending Approve",
count: data?.processPending?.count,
amount: data?.processPending?.totalAmount,
icon: "fa-solid fa-check",
iconColor: "text-warning",
status: EXPENSE_STATUS.approve_pending,
},
{
title: "Pending Review",
count: data?.reviewPending?.count,
amount: data?.reviewPending?.totalAmount,
icon: "bx bx-search-alt-2",
iconColor: "text-secondary",
status: EXPENSE_STATUS.review_pending,
},
{
title: "Draft",
count: data?.submited?.count,
amount: data?.submited?.totalAmount,
icon: "bx bx-file-blank",
iconColor: "text-info",
status: EXPENSE_STATUS.daft,
},
].map((item, idx) => (
<div
key={idx}
className="report-list-item rounded-2 mb-4 bg-lighter px-2 py-1 cursor-pointer"
onClick={() => handleNavigate(item?.status)}
>
<div className="d-flex align-items-center">
<div className="report-list-icon shadow-xs me-2">
<span className="d-inline-flex align-items-center justify-content-center rounded-circle border p-2">
<i className={`${item?.icon} ${item?.iconColor} bx-lg`}></i>
</span>
</div>
<div className="d-flex justify-content-between align-items-center w-100 flex-wrap gap-2">
<div className="d-flex flex-column gap-2">
<span className="fw-bold">{item?.title}</span>
{item?.amount ? <small className="mb-0 text-primary">
{formatCurrency(item?.amount)}
</small> :""}
</div>
<div className="">
{" "}
<small className={`text-royalblue ${countDigit(item?.count) >= 3 ? "text-xl" : "text-2xl"} text-gray-500`}>
{item?.count }
</small>
<small className="text-muted fs-semibold text-royalblue text-md">
<i className="bx bx-chevron-right"></i>
</small>
</div>
</div>
</div>
</div>
))}
</div>
</div>
</>
);
};
export default ExpenseStatus;

View File

@ -19,8 +19,11 @@ const AssignedBucket = ({ selectedBucket, handleClose }) => {
} }
}, [selectedBucket, employeesList]); }, [selectedBucket, employeesList]);
const { mutate: AssignEmployee, isPending } = useAssignEmpToBucket(() => const { mutate: AssignEmployee, isPending } = useAssignEmpToBucket(() =>{
setSelectedEmployees([])
handleClose() handleClose()
}
); );
const handleSubmit = async (e) => { const handleSubmit = async (e) => {

View File

@ -4,8 +4,9 @@ import Pagination from "../common/Pagination";
import { useDirectoryContext } from "../../pages/Directory/DirectoryPage"; import { useDirectoryContext } from "../../pages/Directory/DirectoryPage";
import { useActiveInActiveContact } from "../../hooks/useDirectory"; import { useActiveInActiveContact } from "../../hooks/useDirectory";
import ConfirmModal from "../common/ConfirmModal"; import ConfirmModal from "../common/ConfirmModal";
import Loader from "../common/Loader";
const ListViewContact = ({ data, Pagination }) => { const ListViewContact = ({ data, Pagination, isLoading }) => {
const { showActive, setManageContact, setContactOpen } = const { showActive, setManageContact, setContactOpen } =
useDirectoryContext(); useDirectoryContext();
const [deleteContact, setDeleteContact] = useState({ const [deleteContact, setDeleteContact] = useState({
@ -85,6 +86,8 @@ const ListViewContact = ({ data, Pagination }) => {
ActiveInActive({ contactId: contactId, contactStatus: !showActive }); ActiveInActive({ contactId: contactId, contactStatus: !showActive });
}; };
if(isLoading) return <Loader/>
if(!data|| data.length === 0)return <div className="text-center py-12">No Contact Found</div>
return ( return (
<> <>
<ConfirmModal <ConfirmModal
@ -97,103 +100,97 @@ const ListViewContact = ({ data, Pagination }) => {
paramData={deleteContact.contactId} paramData={deleteContact.contactId}
isOpen={deleteContact.Open} isOpen={deleteContact.Open}
/> />
<div className="card "> <div className="card page-min-h">
<div <div
className="card-datatable table-responsive" className="card-datatable table-responsive"
id="horizontal-example" id="horizontal-example"
> >
<div className="dataTables_wrapper no-footer mx-5 pb-2">
<table className="table dataTable text-nowrap"> {data && (
<thead> <div className="dataTables_wrapper no-footer mx-5 pb-2">
<tr className="table_header_border"> <table className="table dataTable text-nowrap">
{contactList?.map((col) => ( <thead>
<th key={col.key} className={col.align}> <tr className="table_header_border">
{col.label} {contactList?.map((col) => (
<th key={col.key} className={col.align}>
{col.label}
</th>
))}
<th className="sticky-action-column bg-white text-center">
Action
</th> </th>
))}
<th className="sticky-action-column bg-white text-center">
Action
</th>
</tr>
</thead>
<tbody >
{Array.isArray(data) && data.length > 0 ? (
data.map((row, i) => (
<tr
key={i}
style={{ background: `${!showActive ? "#f8f6f6" : ""}` }}
>
{contactList.map((col) => (
<td key={col.key} className={col.align}>
{col.getValue(row)}
</td>
))}
<td className="text-center">
{showActive ? (
<div className="d-flex justify-content-center gap-2">
<i
className="bx bx-show text-primary cursor-pointer"
onClick={() =>
setContactOpen({ contact: row, Open: true })
}
></i>
<i
className="bx bx-edit text-secondary cursor-pointer"
onClick={() =>
setManageContact({
isOpen: true,
contactId: row.id,
})
}
></i>
<i
className="bx bx-trash text-danger cursor-pointer"
onClick={() =>
setDeleteContact({
contactId: row.id,
Open: true,
})
}
></i>
</div>
) : (
<i
className={`bx ${
isPending && activeContact === row.id
? "bx-loader-alt bx-spin"
: "bx-recycle"
} me-1 text-primary cursor-pointer`}
title="Restore"
onClick={() => {
setActiveContact(row.id);
handleActiveInactive(row.id);
}}
></i>
)}
</td>
</tr>
))
) : (
<tr style={{ height: "200px" }}>
<td
colSpan={contactList.length + 1}
className="text-center align-middle"
>
No contacts found
</td>
</tr> </tr>
</thead>
<tbody>
{Array.isArray(data) && data.length > 0 && (
data.map((row, i) => (
<tr
key={i}
style={{
background: `${!showActive ? "#f8f6f6" : ""}`,
}}
>
{contactList.map((col) => (
<td key={col.key} className={col.align}>
{col.getValue(row)}
</td>
))}
<td className="text-center">
{showActive ? (
<div className="d-flex justify-content-center gap-2">
<i
className="bx bx-show text-primary cursor-pointer"
onClick={() =>
setContactOpen({ contact: row, Open: true })
}
></i>
)} <i
</tbody> className="bx bx-edit text-secondary cursor-pointer"
</table> onClick={() =>
{Pagination && ( setManageContact({
<div className="d-flex justify-content-start"> isOpen: true,
{Pagination} contactId: row.id,
</div> })
)} }
</div> ></i>
<i
className="bx bx-trash text-danger cursor-pointer"
onClick={() =>
setDeleteContact({
contactId: row.id,
Open: true,
})
}
></i>
</div>
) : (
<i
className={`bx ${
isPending && activeContact === row.id
? "bx-loader-alt bx-spin"
: "bx-recycle"
} me-1 text-primary cursor-pointer`}
title="Restore"
onClick={() => {
setActiveContact(row.id);
handleActiveInactive(row.id);
}}
></i>
)}
</td>
</tr>
))
) }
</tbody>
</table>
{Pagination && (
<div className="d-flex justify-content-start">{Pagination}</div>
)}
</div>
)}
</div> </div>
</div> </div>
</> </>

View File

@ -23,7 +23,7 @@ import Label from "../common/Label";
const ManageContact = ({ contactId, closeModal }) => { const ManageContact = ({ contactId, closeModal }) => {
// fetch master data // fetch master data
const { buckets, loading: bucketsLoaging } = useBuckets(); const { buckets, loading: bucketsLoaging } = useBuckets();
const { projects, loading: projectLoading } = useProjects(); const { data: projects, loading: projectLoading } = useProjects();
const { contactCategory, loading: contactCategoryLoading } = const { contactCategory, loading: contactCategoryLoading } =
useContactCategory(); useContactCategory();
const { organizationList } = useOrganization(); const { organizationList } = useOrganization();
@ -205,13 +205,14 @@ const ManageContact = ({ contactId, closeModal }) => {
<Label htmlFor={"organization"} required> <Label htmlFor={"organization"} required>
Organization Organization
</Label> </Label>
<InputSuggestions <InputSuggestions
organizationList={organizationList} organizationList={organizationList}
value={watch("organization") || ""} value={watch("organization") || ""}
onChange={(val) => setValue("organization", val, { shouldValidate: true })} onChange={(val) =>
error={errors.organization?.message} setValue("organization", val, { shouldValidate: true })
/> }
error={errors.organization?.message}
/>
</div> </div>
</div> </div>
@ -394,6 +395,7 @@ const ManageContact = ({ contactId, closeModal }) => {
labelKey="name" labelKey="name"
valueKey="id" valueKey="id"
IsLoading={projectLoading} IsLoading={projectLoading}
/> />
{errors.projectIds && ( {errors.projectIds && (
<small className="danger-text">{errors.projectIds.message}</small> <small className="danger-text">{errors.projectIds.message}</small>
@ -408,6 +410,7 @@ const ManageContact = ({ contactId, closeModal }) => {
label="Tags" label="Tags"
options={contactTags} options={contactTags}
isRequired={true} isRequired={true}
require
/> />
{errors.tags && ( {errors.tags && (
<small className="danger-text">{errors.tags.message}</small> <small className="danger-text">{errors.tags.message}</small>
@ -417,7 +420,7 @@ const ManageContact = ({ contactId, closeModal }) => {
{/* Buckets */} {/* Buckets */}
<div className="row"> <div className="row">
<div className="col-md-12 mt-1 text-start"> <div className="col-md-12 mt-1 text-start">
<label className="form-label ">Select Bucket</label> <Label required>Select Bucket</Label>
<ul className="d-flex flex-wrap px-1 list-unstyled mb-0"> <ul className="d-flex flex-wrap px-1 list-unstyled mb-0">
{bucketsLoaging && <p>Loading...</p>} {bucketsLoaging && <p>Loading...</p>}
{buckets?.map((item) => ( {buckets?.map((item) => (
@ -450,7 +453,7 @@ const ManageContact = ({ contactId, closeModal }) => {
</div> </div>
{/* Address + Description */} {/* Address + Description */}
<div className="col-12 text-start"> <div className="col-12 text-start mb-2">
<label className="form-label">Address</label> <label className="form-label">Address</label>
<textarea <textarea
className="form-control form-control-sm" className="form-control form-control-sm"
@ -459,7 +462,7 @@ const ManageContact = ({ contactId, closeModal }) => {
/> />
</div> </div>
<div className="col-12 text-start"> <div className="col-12 text-start">
<label className="form-label">Description</label> <Label required>Description</Label>
<textarea <textarea
className="form-control form-control-sm" className="form-control form-control-sm"
rows="2" rows="2"
@ -479,10 +482,13 @@ const ManageContact = ({ contactId, closeModal }) => {
> >
Cancel Cancel
</button> </button>
<button className="btn btn-sm btn-primary" type="submit" disabled={isPending}> <button
className="btn btn-sm btn-primary"
type="submit"
disabled={isPending}
>
{isPending ? "Please Wait..." : "Submit"} {isPending ? "Please Wait..." : "Submit"}
</button> </button>
</div> </div>
</form> </form>
</FormProvider> </FormProvider>

View File

@ -189,12 +189,12 @@ const DocumentFilterPanel = ({ entityTypeId, onApply }) => {
<div className="d-flex justify-content-end py-3 gap-2"> <div className="d-flex justify-content-end py-3 gap-2">
<button <button
type="button" type="button"
className="btn btn-label-secondary btn-xs" className="btn btn-label-secondary btn-sm"
onClick={onClear} onClick={onClear}
> >
Clear Clear
</button> </button>
<button type="submit" className="btn btn-primary btn-xs"> <button type="submit" className="btn btn-primary btn-sm">
Apply Apply
</button> </button>
</div> </div>

View File

@ -17,54 +17,56 @@ const SkeletonCell = ({
/> />
); );
export const DocumentTableSkeleton = ({ rows = 5 }) => { export const DocumentTableSkeleton = ({ rows = 10 }) => {
return ( return (
<table className="card-body table border-top dataTable no-footer dtr-column text-nowrap">
<thead>
<tr>
<th className="text-start">Name</th>
<th className="text-start">Document Type</th>
<th className="text-start">Uploaded By</th>
<th className="text-center">Uploaded on</th>
<th className="text-center">Status</th>
</tr>
</thead>
<table className="card-body table border-top dataTable no-footer dtr-column text-nowrap"> <tbody>
<thead> {[...Array(rows)].map((_, idx) => (
<tr> <tr key={idx} className={idx % 2 === 0 ? "odd" : "even"}>
<th className="text-start">Name</th> {/* Name */}
<th className="text-start">Document Type</th> <td className="text-start">
<th className="text-start">Uploaded By</th> <SkeletonCell width="120px" height={16} />
<th className="text-center">Uploaded on</th> </td>
<th className="text-center">Status</th>
</tr>
</thead>
<tbody> {/* Document Type */}
{[...Array(rows)].map((_, idx) => ( <td className="text-start">
<tr key={idx} className={idx % 2 === 0 ? "odd" : "even"}> <SkeletonCell width="100px" height={16} />
{/* Name */} </td>
<td className="text-start">
<SkeletonCell width="120px" height={16} />
</td>
{/* Document Type */} {/* Uploaded By (Avatar + Name) */}
<td className="text-start"> <td className="text-start">
<SkeletonCell width="100px" height={16} /> <div className="d-flex align-items-center gap-2">
</td> <SkeletonCell
width="30px"
{/* Uploaded By (Avatar + Name) */} height={30}
<td className="text-start"> className="rounded-circle"
<div className="d-flex align-items-center gap-2"> />
<SkeletonCell width="30px" height={30} className="rounded-circle" />
<SkeletonCell width="80px" height={16} />
</div>
</td>
{/* Uploaded on */}
<td className="text-center">
<SkeletonCell width="80px" height={16} /> <SkeletonCell width="80px" height={16} />
</td> </div>
</td>
{/* Status */} {/* Uploaded on */}
<td className="text-center"> <td className="text-center">
<SkeletonCell width="70px" height={20} className="rounded" /> <SkeletonCell width="80px" height={16} />
</td> </td>
</tr>
))} {/* Status */}
</tbody> <td className="text-center">
</table> <SkeletonCell width="70px" height={20} className="rounded" />
</td>
</tr>
))}
</tbody>
</table>
); );
}; };

View File

@ -117,7 +117,7 @@ const Documents = ({ Document_Entity, Entity }) => {
}, [Document_Entity]); }, [Document_Entity]);
return ( return (
<DocumentContext.Provider value={contextValues}> <DocumentContext.Provider value={contextValues}>
<div className="mt-5"> <div className="mt-2">
<div className="card page-min-h d-flex p-2"> <div className="card page-min-h d-flex p-2">
<div className="row align-items-center"> <div className="row align-items-center">
{/* Search */} {/* Search */}

View File

@ -82,9 +82,9 @@ const DocumentsList = ({
if (isLoading || isFetching) return <DocumentTableSkeleton />; if (isLoading || isFetching) return <DocumentTableSkeleton />;
if (isError) if (isError)
return <div>Error: {error?.message || "Something went wrong"}</div>; return <div>Error: {error?.message || "Something went wrong"}</div>;
if (isInitialEmpty) return <div>No documents found yet.</div>; if (isInitialEmpty) return <div className="py-12 my-12">No documents found yet.</div>;
if (isSearchEmpty) return <div>No results found for "{debouncedSearch}"</div>; if (isSearchEmpty) return <div className="py-12 my-12">No results found for "{debouncedSearch}"</div>;
if (isFilterEmpty) return <div>No documents match your filter.</div>; if (isFilterEmpty) return <div className="py-12 my-12">No documents match your filter.</div>;
const handleDelete = () => { const handleDelete = () => {
ActiveInActive( ActiveInActive(
@ -180,10 +180,10 @@ const DocumentsList = ({
/> />
)} )}
<div className="table-responsive"> <div className="table-responsive p-2">
<table className="table border-top dataTable text-nowrap"> <table className="table border-top dataTable text-nowrap">
<thead> <thead className="">
<tr className="shadow-sm"> <tr className="py-2 ">
{DocumentColumns.map((col) => ( {DocumentColumns.map((col) => (
<th key={col.key} className={`sorting ${col.align}`}> <th key={col.key} className={`sorting ${col.align}`}>
{col.label} {col.label}

View File

@ -131,7 +131,7 @@ const EmpAttendance = ({ employee }) => {
<AttendLogs Id={attendanceId} /> <AttendLogs Id={attendanceId} />
</GlobalModel> </GlobalModel>
)} )}
<div className="card px-4 mt-5 py-2 " style={{ minHeight: "500px" }}> <div className="card px-4 mt-2 py-2 page-min-h ">
<div <div
className="dataTables_length text-start py-2 d-flex justify-content-between " className="dataTables_length text-start py-2 d-flex justify-content-between "
id="DataTables_Table_0_length" id="DataTables_Table_0_length"

View File

@ -12,11 +12,11 @@ const EmpDashboard = ({ profile }) => {
return ( return (
<> <>
<div className="row"> <div className="row">
<div className="col-12 col-sm-6 pt-5"> <div className="col-12 col-sm-6 pt-2">
{" "} {" "}
<EmpOverview profile={profile}></EmpOverview> <EmpOverview profile={profile}></EmpOverview>
</div> </div>
<div className="col col-sm-6 pt-5"> {/* <div className="col col-sm-6 pt-5">
<div className="card "> <div className="card ">
<div className="card-body"> <div className="card-body">
<small className="card-text text-uppercase text-body-secondary small text-start d-block"> <small className="card-text text-uppercase text-body-secondary small text-start d-block">
@ -29,7 +29,6 @@ const EmpDashboard = ({ profile }) => {
className="d-flex mb-4 align-items-start flex-wrap" className="d-flex mb-4 align-items-start flex-wrap"
key={project.id} key={project.id}
> >
{/* Project Info */}
<div className="flex-grow-1"> <div className="flex-grow-1">
<div className="d-flex flex-wrap align-items-center justify-content-between gap-2"> <div className="d-flex flex-wrap align-items-center justify-content-between gap-2">
<div className="d-flex"> <div className="d-flex">
@ -70,7 +69,6 @@ const EmpDashboard = ({ profile }) => {
</div> </div>
</div> </div>
{/* Dates */}
</div> </div>
</li> </li>
@ -79,7 +77,7 @@ const EmpDashboard = ({ profile }) => {
</div> </div>
</div> </div>
</div> </div> */}
</div> </div>
</> </>
); );

View File

@ -24,7 +24,7 @@ const EmployeeNav = ({ onPillClick, activePill }) => {
icon: "bx bx-file", icon: "bx bx-file",
label: "Documents", label: "Documents",
}, },
{ key: "activities", icon: "bx bx-grid-alt", label: "Activities" }, // { key: "activities", icon: "bx bx-grid-alt", label: "Activities" },
].filter(Boolean); ].filter(Boolean);
return ( return (
<div className="col-md-12"> <div className="col-md-12">

View File

@ -90,7 +90,7 @@ export const employeeSchema =
.min(1, { message: "Phone Number is required" }) .min(1, { message: "Phone Number is required" })
.regex(mobileNumberRegex, { message: "Invalid phone number " }), .regex(mobileNumberRegex, { message: "Invalid phone number " }),
jobRoleId: z.string().min(1, { message: "Role is required" }), jobRoleId: z.string().min(1, { message: "Role is required" }),
organizationId:z.string().min(1,{message:"Organization is required"}), // organizationId:z.string().min(1,{message:"Organization is required"}), // hide temp. for version 1
hasApplicationAccess:z.boolean().default(false), hasApplicationAccess:z.boolean().default(false),
}).refine((data) => { }).refine((data) => {
if (data.hasApplicationAccess) { if (data.hasApplicationAccess) {
@ -119,6 +119,6 @@ export const defatEmployeeObj = {
permanentAddress: "", permanentAddress: "",
phoneNumber: "", phoneNumber: "",
jobRoleId: null, jobRoleId: null,
organizationId:"", // organizationId:"",
hasApplicationAccess:false hasApplicationAccess:false
} }

View File

@ -15,18 +15,18 @@ import {
import Label from "../common/Label"; import Label from "../common/Label";
import DatePicker from "../common/DatePicker"; import DatePicker from "../common/DatePicker";
import { defatEmployeeObj, employeeSchema } from "./EmployeeSchema"; import { defatEmployeeObj, employeeSchema } from "./EmployeeSchema";
import { useOrganizationsList } from "../../hooks/useOrganization"; // import { useOrganizationsList } from "../../hooks/useOrganization";
import { ITEMS_PER_PAGE } from "../../utils/constants"; import { ITEMS_PER_PAGE } from "../../utils/constants";
const ManageEmployee = ({ employeeId, onClosed, IsAllEmployee }) => { const ManageEmployee = ({ employeeId, onClosed, IsAllEmployee }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { mutate: updateEmployee, isPending } = useUpdateEmployee(); const { mutate: updateEmployee, isPending } = useUpdateEmployee();
const { // const {
data: organzationList, // data: organzationList,
isLoading, // isLoading,
isError, // isError,
error: EempError, // error: EempError,
} = useOrganizationsList(ITEMS_PER_PAGE, 1, true); // } = useOrganizationsList(ITEMS_PER_PAGE, 1, true);
const { const {
employee, employee,
error, error,
@ -113,7 +113,7 @@ const ManageEmployee = ({ employeeId, onClosed, IsAllEmployee }) => {
permanentAddress: currentEmployee.permanentAddress || "", permanentAddress: currentEmployee.permanentAddress || "",
phoneNumber: currentEmployee.phoneNumber || "", phoneNumber: currentEmployee.phoneNumber || "",
jobRoleId: currentEmployee.jobRoleId?.toString() || "", jobRoleId: currentEmployee.jobRoleId?.toString() || "",
organizationId: currentEmployee.organizationId || "", // organizationId: currentEmployee.organizationId || "", // Hide temp. for version 1
hasApplicationAccess: currentEmployee.hasApplicationAccess || false, hasApplicationAccess: currentEmployee.hasApplicationAccess || false,
} }
: {} : {}
@ -413,9 +413,10 @@ const ManageEmployee = ({ employeeId, onClosed, IsAllEmployee }) => {
</div> </div>
</div> </div>
{/* -------------- */}
<div className="row mb-3"> <div className="row mb-3">
<div className="col-sm-6"> {/* -------------- Temp hide for Version---------------*/}
{/* <div className="col-sm-6">
<Label className="form-text text-start" required> <Label className="form-text text-start" required>
Organization Organization
</Label> </Label>
@ -446,9 +447,10 @@ const ManageEmployee = ({ employeeId, onClosed, IsAllEmployee }) => {
{errors.organizationId.message} {errors.organizationId.message}
</div> </div>
)} )}
</div> </div> */}
{/* --------------------------------------------------- */}
<div className="col-sm-6 d-flex align-items-center mt-2"> <div className="col-12 d-flex align-items-center mt-2">
<label className="form-check-label d-flex align-items-center"> <label className="form-check-label d-flex align-items-center">
<input <input
type="checkbox" type="checkbox"
@ -584,15 +586,14 @@ const ManageEmployee = ({ employeeId, onClosed, IsAllEmployee }) => {
)} )}
</div> </div>
</div> </div>
<div className="row text-end"> <div className="d-flex flex-row gap-3 justify-content-end">
<div className="col-sm-12">
<button <button
aria-label="manage employee" aria-label="manage employee"
type="reset"
className="btn btn-sm btn-label-secondary me-2" className="btn btn-sm btn-label-secondary me-2"
disabled={isPending} disabled={isPending}
onClick={()=>onClosed()}
> >
Clear Close
</button> </button>
<button <button
aria-label="manage employee" aria-label="manage employee"
@ -600,9 +601,8 @@ const ManageEmployee = ({ employeeId, onClosed, IsAllEmployee }) => {
className="btn btn-sm btn-primary" className="btn btn-sm btn-primary"
disabled={isPending} disabled={isPending}
> >
{isPending ? "Please Wait..." : employeeId ? "Update" : "Create"} {isPending ? "Please Wait..." : employeeId ? "Update" : "Submit"}
</button> </button>
</div>
</div> </div>
</form> </form>
</> </>

View File

@ -0,0 +1,50 @@
const ActiveFilters = ({ filters, optionsLookup = {}, onRemove }) => {
const entries = Object.entries(filters || {});
return (
<div className="d-flex flex-wrap gap-2">
{entries.map(([key, value]) => {
if (!value || (Array.isArray(value) && value.length === 0)) return null;
if (Array.isArray(value)) {
return value.map((v) => {
const label = optionsLookup[key]?.[v] || v;
return (
<span
key={`${key}-${v}`}
className="badge bg-label-primary cursor-pointer"
onClick={() => onRemove(key, v)}
>
{label} <i className="bx bx-x ms-1"></i>
</span>
);
});
}
if (typeof value === "boolean") {
return (
<span
key={key}
className="badge bg-label-success cursor-pointer"
onClick={() => onRemove(key)}
>
{key}: {value ? "Yes" : "No"} <i className="bx bx-x ms-1"></i>
</span>
);
}
return (
<span className="badge bg-primary">
{data?.startDate && data?.endDate
? `${formatUTCToLocalTime(
data.startDate
)} - ${formatUTCToLocalTime(data.endDate)}`
: "No dates"}
</span>
);
})}
</div>
);
};
export default ActiveFilters;

View File

@ -13,9 +13,11 @@ import { useSelector } from "react-redux";
import moment from "moment"; import moment from "moment";
import { useExpenseFilter } from "../../hooks/useExpense"; import { useExpenseFilter } from "../../hooks/useExpense";
import { ExpenseFilterSkeleton } from "./ExpenseSkeleton"; import { ExpenseFilterSkeleton } from "./ExpenseSkeleton";
import { useLocation } from "react-router-dom"; import { useLocation, useNavigate, useParams } from "react-router-dom";
const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => { const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
const { status, project } = useParams();
const navigate = useNavigate();
const selectedProjectId = useSelector( const selectedProjectId = useSelector(
(store) => store.localVariables.projectId (store) => store.localVariables.projectId
); );
@ -34,12 +36,26 @@ const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
].sort((a, b) => a.name.localeCompare(b.name)); ].sort((a, b) => a.name.localeCompare(b.name));
}, []); }, []);
const [selectedGroup, setSelectedGroup] = useState(groupByList[0]); const [selectedGroup, setSelectedGroup] = useState(groupByList[6]);
const [resetKey, setResetKey] = useState(0); const [resetKey, setResetKey] = useState(0);
const dynamicDefaultFilter = useMemo(() => {
return {
...defaultFilter,
statusIds: status ? [status] : defaultFilter.statusIds || [],
projectIds: project ? [project] : defaultFilter.projectIds || [],
createdByIds: defaultFilter.createdByIds || [],
paidById: defaultFilter.paidById || [],
ExpenseTypeIds: defaultFilter.ExpenseTypeIds || [],
isTransactionDate: defaultFilter.isTransactionDate ?? true,
startDate: defaultFilter.startDate,
endDate: defaultFilter.endDate,
};
}, [status]);
const methods = useForm({ const methods = useForm({
resolver: zodResolver(SearchSchema), resolver: zodResolver(SearchSchema),
defaultValues: defaultFilter, defaultValues: dynamicDefaultFilter,
}); });
const { control, handleSubmit, reset, setValue, watch } = methods; const { control, handleSubmit, reset, setValue, watch } = methods;
@ -71,14 +87,50 @@ const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
onApply(defaultFilter); onApply(defaultFilter);
handleGroupBy(groupByList[0].id); handleGroupBy(groupByList[0].id);
closePanel(); closePanel();
if (status) {
navigate("/expenses", { replace: true });
}
}; };
// Close popup when navigating to another component
const location = useLocation(); const location = useLocation();
useEffect(() => { useEffect(() => {
closePanel(); closePanel();
}, [location]); }, [location]);
const [appliedStatusId, setAppliedStatusId] = useState(null);
useEffect(() => {
if (!status && !project) return;
if (status !== appliedStatusId && data) {
const filterWithStatus = {
...dynamicDefaultFilter,
startDate: dynamicDefaultFilter.startDate
? moment
.utc(dynamicDefaultFilter.startDate, "DD-MM-YYYY")
.toISOString()
: undefined,
endDate: dynamicDefaultFilter.endDate
? moment.utc(dynamicDefaultFilter.endDate, "DD-MM-YYYY").toISOString()
: undefined,
};
onApply(filterWithStatus);
handleGroupBy(selectedGroup.id);
setAppliedStatusId(status);
}
}, [
status,
project,
data,
dynamicDefaultFilter,
onApply,
handleGroupBy,
selectedGroup.id,
appliedStatusId,
]);
if (isLoading || isFetching) return <ExpenseFilterSkeleton />; if (isLoading || isFetching) return <ExpenseFilterSkeleton />;
if (isError && isFetched) if (isError && isFetched)
return <div>Something went wrong Here- {error.message} </div>; return <div>Something went wrong Here- {error.message} </div>;
@ -92,18 +144,16 @@ const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
<div className="d-inline-flex border rounded-pill mb-1 overflow-hidden shadow-none"> <div className="d-inline-flex border rounded-pill mb-1 overflow-hidden shadow-none">
<button <button
type="button" type="button"
className={`btn px-2 py-1 rounded-0 text-tiny ${ className={`btn px-2 py-1 rounded-0 text-tiny ${isTransactionDate ? "active btn-primary text-white" : ""
isTransactionDate ? "active btn-primary text-white" : "" }`}
}`}
onClick={() => setValue("isTransactionDate", true)} onClick={() => setValue("isTransactionDate", true)}
> >
Transaction Date Transaction Date
</button> </button>
<button <button
type="button" type="button"
className={`btn px-2 py-1 rounded-0 text-tiny ${ className={`btn px-2 py-1 rounded-0 text-tiny ${!isTransactionDate ? "active btn-primary text-white" : ""
!isTransactionDate ? "active btn-primary text-white" : "" }`}
}`}
onClick={() => setValue("isTransactionDate", false)} onClick={() => setValue("isTransactionDate", false)}
> >
Submitted Date Submitted Date
@ -117,6 +167,7 @@ const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
endField="endDate" endField="endDate"
resetSignal={resetKey} resetSignal={resetKey}
defaultRange={false} defaultRange={false}
maxDate={new Date()}
/> />
</div> </div>
@ -142,6 +193,13 @@ const ExpenseFilterPanel = ({ onApply, handleGroupBy }) => {
labelKey={(item) => item.name} labelKey={(item) => item.name}
valueKey="id" valueKey="id"
/> />
<SelectMultiple
name="ExpenseTypeIds"
label="Category :"
options={data.expensesType}
labelKey={(item) => item.name}
valueKey="id"
/>
<div className="mb-3"> <div className="mb-3">
<label className="form-label">Status :</label> <label className="form-label">Status :</label>

View File

@ -10,7 +10,11 @@ import {
EXPENSE_REJECTEDBY, EXPENSE_REJECTEDBY,
ITEMS_PER_PAGE, ITEMS_PER_PAGE,
} from "../../utils/constants"; } from "../../utils/constants";
import { getColorNameFromHex, useDebounce } from "../../utils/appUtils"; import {
formatCurrency,
getColorNameFromHex,
useDebounce,
} from "../../utils/appUtils";
import { ExpenseTableSkeleton } from "./ExpenseSkeleton"; import { ExpenseTableSkeleton } from "./ExpenseSkeleton";
import ConfirmModal from "../common/ConfirmModal"; import ConfirmModal from "../common/ConfirmModal";
import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import { useHasUserPermission } from "../../hooks/useHasUserPermission";
@ -59,40 +63,61 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
const groupByField = (items, field) => { const groupByField = (items, field) => {
return items.reduce((acc, item) => { return items.reduce((acc, item) => {
let key; let key;
let displayField;
switch (field) { switch (field) {
case "transactionDate": case "transactionDate":
key = item.transactionDate?.split("T")[0]; key = item?.transactionDate?.split("T")[0];
displayField = "Transaction Date";
break; break;
case "status": case "status":
key = item.status?.displayName || "Unknown"; key = item?.status?.displayName || "Unknown";
displayField = "Status";
break; break;
case "submittedBy": case "submittedBy":
key = `${item.createdBy?.firstName ?? ""} ${ key = `${item?.createdBy?.firstName ?? ""} ${
item.createdBy?.lastName ?? "" item.createdBy?.lastName ?? ""
}`.trim(); }`.trim();
displayField = "Submitted By";
break; break;
case "project": case "project":
key = item.project?.name || "Unknown Project"; key = item?.project?.name || "Unknown Project";
displayField = "Project";
break; break;
case "paymentMode": case "paymentMode":
key = item.paymentMode?.name || "Unknown Mode"; key = item?.paymentMode?.name || "Unknown Mode";
displayField = "Payment Mode";
break; break;
case "expensesType": case "expensesType":
key = item.expensesType?.name || "Unknown Type"; key = item?.expensesType?.name || "Unknown Type";
displayField = "Expense Type";
break; break;
case "createdAt": case "createdAt":
key = item.createdAt?.split("T")[0] || "Unknown Type"; key = item?.createdAt?.split("T")[0] || "Unknown Date";
displayField = "Created Date";
break; break;
default: default:
key = "Others"; key = "Others";
displayField = "Others";
} }
if (!acc[key]) acc[key] = [];
acc[key].push(item); const groupKey = `${field}_${key}`; // unique key for object property
if (!acc[groupKey]) {
acc[groupKey] = { key, displayField, items: [] };
}
acc[groupKey].items.push(item);
return acc; return acc;
}, {}); }, {});
}; };
const expenseColumns = [ const expenseColumns = [
{
key: "expenseUId",
label: "Expense Id",
getValue: (e) => e.expenseUId || "N/A",
align: "text-start mx-2",
},
{ {
key: "expensesType", key: "expensesType",
label: "Expense Type", label: "Expense Type",
@ -138,11 +163,7 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
{ {
key: "amount", key: "amount",
label: "Amount", label: "Amount",
getValue: (e) => ( getValue: (e) => <>{formatCurrency(e?.amount)}</>,
<>
<i className="bx bx-rupee b-xs"></i> {e?.amount}
</>
),
isAlwaysVisible: true, isAlwaysVisible: true,
align: "text-end", align: "text-end",
}, },
@ -163,23 +184,27 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
]; ];
if (isInitialLoading) return <ExpenseTableSkeleton />; if (isInitialLoading) return <ExpenseTableSkeleton />;
if (isError) return <div>{error.message}</div>; if (isError) return <div>{error?.message}</div>;
const grouped = groupBy const grouped = groupBy
? groupByField(data?.data ?? [], groupBy) ? groupByField(data?.data ?? [], groupBy)
: { All: data?.data ?? [] }; : { All: data?.data ?? [] };
const IsGroupedByDate = ["transactionDate", "createdAt"].includes(groupBy); const IsGroupedByDate = [
{ key: "transactionDate", displayField: "Transaction Date" },
{ key: "createdAt", displayField: "created Date" },
]?.includes(groupBy);
const canEditExpense = (expense) => { const canEditExpense = (expense) => {
return ( return (
(expense.status.id === EXPENSE_DRAFT || (expense?.status?.id === EXPENSE_DRAFT ||
EXPENSE_REJECTEDBY.includes(expense.status.id)) && EXPENSE_REJECTEDBY.includes(expense?.status?.id)) &&
expense.createdBy?.id === SelfId expense?.createdBy?.id === SelfId
); );
}; };
const canDetetExpense = (expense) => { const canDetetExpense = (expense) => {
return ( return (
expense.status.id === EXPENSE_DRAFT && expense.createdBy.id === SelfId expense?.status?.id === EXPENSE_DRAFT && expense?.createdBy?.id === SelfId
); );
}; };
@ -198,7 +223,7 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
/> />
)} )}
<div className="card px-0 px-sm-4"> <div className="card page-min-h px-sm-4">
<div <div
className="card-datatable table-responsive " className="card-datatable table-responsive "
id="horizontal-example" id="horizontal-example"
@ -226,18 +251,24 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
</thead> </thead>
<tbody> <tbody>
{Object.keys(grouped).length > 0 ? ( {Object.keys(grouped).length > 0 ? (
Object.entries(grouped).map(([group, expenses]) => ( Object.values(grouped).map(({ key, displayField, items }) => (
<React.Fragment key={group}> <React.Fragment key={key}>
<tr className="tr-group text-dark"> <tr className="tr-group text-dark">
<td colSpan={8} className="text-start"> <td colSpan={8} className="text-start">
<strong> <div className="d-flex align-items-center">
{IsGroupedByDate {" "}
? formatUTCToLocalTime(group) <small className="fs-6 ">
: group} {displayField} :{" "}
</strong> </small>{" "}
<small className="fs-6 ms-3">
{IsGroupedByDate
? formatUTCToLocalTime(key)
: key}
</small>
</div>
</td> </td>
</tr> </tr>
{expenses.map((expense) => ( {items?.map((expense) => (
<tr key={expense.id}> <tr key={expense.id}>
{expenseColumns.map( {expenseColumns.map(
(col) => (col) =>
@ -263,27 +294,61 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
}) })
} }
></i> ></i>
{canEditExpense(expense) && ( {canDetetExpense(expense) &&
<i canEditExpense(expense) && (
className="bx bx-edit text-secondary cursor-pointer" <div className="dropdown z-2">
onClick={() => <button
setManageExpenseModal({ type="button"
IsOpen: true, className="btn btn-xs btn-icon btn-text-secondary rounded-pill dropdown-toggle hide-arrow p-0 m-0"
expenseId: expense.id, data-bs-toggle="dropdown"
}) aria-expanded="false"
} >
></i> <i
)} className="bx bx-dots-vertical-rounded text-muted p-0"
data-bs-toggle="tooltip"
data-bs-offset="0,8"
data-bs-placement="top"
data-bs-custom-class="tooltip-dark"
title="More Action"
></i>
</button>
<ul className="dropdown-menu dropdown-menu-end w-auto">
{canDetetExpense(expense) && (
<li
onClick={() =>
setManageExpenseModal({
IsOpen: true,
expenseId: expense.id,
})
}
>
<a className="dropdown-item px-2 cursor-pointer py-1">
<i className="bx bx-edit text-primary bx-xs me-2"></i>
<span className="align-left ">
Modify
</span>
</a>
</li>
)}
{canDetetExpense(expense) && ( {canDetetExpense(expense) && (
<i <li
className="bx bx-trash text-danger cursor-pointer" onClick={() => {
onClick={() => { setIsDeleteModalOpen(true);
setIsDeleteModalOpen(true); setDeletingId(expense.id);
setDeletingId(expense.id); }}
}} >
></i> <a className="dropdown-item px-2 cursor-pointer py-1">
)} <i className="bx bx-trash text-danger bx-xs me-2"></i>
<span className="align-left">
Delete
</span>
</a>
</li>
)}
</ul>
</div>
)}
</div> </div>
</td> </td>
</tr> </tr>
@ -292,8 +357,10 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
)) ))
) : ( ) : (
<tr> <tr>
<td colSpan={8} className="text-center py-4"> <td colSpan={8} className="text-center border-0 ">
No Expense Found <div className="py-8">
<p>No Expense Found</p>
</div>
</td> </td>
</tr> </tr>
)} )}

View File

@ -1,4 +1,5 @@
import { z } from "zod"; import { z } from "zod";
import { localToUtc } from "../../utils/appUtils";
const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
const ALLOWED_TYPES = [ const ALLOWED_TYPES = [
@ -17,15 +18,12 @@ export const ExpenseSchema = (expenseTypes) => {
.min(1, { message: "Expense type is required" }), .min(1, { message: "Expense type is required" }),
paymentModeId: z.string().min(1, { message: "Payment mode is required" }), paymentModeId: z.string().min(1, { message: "Payment mode is required" }),
paidById: z.string().min(1, { message: "Employee name is required" }), paidById: z.string().min(1, { message: "Employee name is required" }),
transactionDate: z transactionDate: z.string().min(1, { message: "Date is required" }),
.string()
.min(1, { message: "Date is required" })
,
transactionId: z.string().optional(), transactionId: z.string().optional(),
description: z.string().min(1, { message: "Description is required" }), description: z.string().min(1, { message: "Description is required" }),
location: z.string().min(1, { message: "Location is required" }), location: z.string().min(1, { message: "Location is required" }),
supplerName: z.string().min(1, { message: "Supplier name is required" }), supplerName: z.string().min(1, { message: "Supplier name is required" }),
gstNumber :z.string().optional(), gstNumber: z.string().optional(),
amount: z.coerce amount: z.coerce
.number({ .number({
invalid_type_error: "Amount is required and must be a number", invalid_type_error: "Amount is required and must be a number",
@ -54,8 +52,6 @@ export const ExpenseSchema = (expenseTypes) => {
}) })
) )
.nonempty({ message: "At least one file attachment is required" }), .nonempty({ message: "At least one file attachment is required" }),
}) })
.refine( .refine(
(data) => { (data) => {
@ -68,9 +64,14 @@ export const ExpenseSchema = (expenseTypes) => {
path: ["paidById"], path: ["paidById"],
} }
) )
.superRefine((data, ctx) => { .superRefine((data, ctx) => {
const expenseType = expenseTypes.find((et) => et.id === data.expensesTypeId); const expenseType = expenseTypes.find(
if (expenseType?.noOfPersonsRequired && (!data.noOfPersons || data.noOfPersons < 1)) { (et) => et.id === data.expensesTypeId
);
if (
expenseType?.noOfPersonsRequired &&
(!data.noOfPersons || data.noOfPersons < 1)
) {
ctx.addIssue({ ctx.addIssue({
code: z.ZodIssueCode.custom, code: z.ZodIssueCode.custom,
message: "No. of Persons is required and must be at least 1", message: "No. of Persons is required and must be at least 1",
@ -92,12 +93,14 @@ export const defaultExpense = {
supplerName: "", supplerName: "",
amount: "", amount: "",
noOfPersons: "", noOfPersons: "",
gstNumber:"", gstNumber: "",
billAttachments: [], billAttachments: [],
}; };
export const ExpenseActionScheam = (
export const ExpenseActionScheam = (isReimbursement = false) => { isReimbursement = false,
transactionDate
) => {
return z return z
.object({ .object({
comment: z.string().min(1, { message: "Please leave comment" }), comment: z.string().min(1, { message: "Please leave comment" }),
@ -122,6 +125,15 @@ export const ExpenseActionScheam = (isReimbursement = false) => {
message: "Reimburse Date is required", message: "Reimburse Date is required",
}); });
} }
// let reimburse_Date = localToUtc(data.reimburseDate);
// if (transactionDate > reimburse_Date) {
// ctx.addIssue({
// code: z.ZodIssueCode.custom,
// path: ["reimburseDate"],
// message:
// "Reimburse Date must be greater than or equal to Expense created Date",
// });
// }
if (!data.reimburseById) { if (!data.reimburseById) {
ctx.addIssue({ ctx.addIssue({
code: z.ZodIssueCode.custom, code: z.ZodIssueCode.custom,
@ -133,7 +145,7 @@ export const ExpenseActionScheam = (isReimbursement = false) => {
}); });
}; };
export const defaultActionValues = { export const defaultActionValues = {
comment: "", comment: "",
statusId: "", statusId: "",
@ -142,13 +154,12 @@ export const ExpenseActionScheam = (isReimbursement = false) => {
reimburseById: null, reimburseById: null,
}; };
export const SearchSchema = z.object({ export const SearchSchema = z.object({
projectIds: z.array(z.string()).optional(), projectIds: z.array(z.string()).optional(),
statusIds: z.array(z.string()).optional(), statusIds: z.array(z.string()).optional(),
createdByIds: z.array(z.string()).optional(), createdByIds: z.array(z.string()).optional(),
paidById: z.array(z.string()).optional(), paidById: z.array(z.string()).optional(),
ExpenseTypeIds: z.array(z.string()).optional(),
startDate: z.string().optional(), startDate: z.string().optional(),
endDate: z.string().optional(), endDate: z.string().optional(),
isTransactionDate: z.boolean().default(true), isTransactionDate: z.boolean().default(true),
@ -159,8 +170,8 @@ export const defaultFilter = {
statusIds: [], statusIds: [],
createdByIds: [], createdByIds: [],
paidById: [], paidById: [],
ExpenseTypeIds: [],
isTransactionDate: true, isTransactionDate: true,
startDate: null, startDate: null,
endDate: null, endDate: null,
}; };

View File

@ -28,6 +28,7 @@ import moment from "moment";
import DatePicker from "../common/DatePicker"; import DatePicker from "../common/DatePicker";
import ErrorPage from "../../pages/ErrorPage"; import ErrorPage from "../../pages/ErrorPage";
import Label from "../common/Label"; import Label from "../common/Label";
import EmployeeSearchInput from "../common/EmployeeSearchInput";
const ManageExpense = ({ closeModal, expenseToEdit = null }) => { const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
const { const {
@ -57,7 +58,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
}); });
const selectedproject = watch("projectId"); const selectedproject = watch("projectId");
const { const {
projectNames, projectNames,
loading: projectLoading, loading: projectLoading,
@ -142,8 +143,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
}; };
useEffect(() => { useEffect(() => {
if (expenseToEdit && data ) { if (expenseToEdit && data) {
reset({ reset({
projectId: data.project.id || "", projectId: data.project.id || "",
expensesTypeId: data.expensesType.id || "", expensesTypeId: data.expensesType.id || "",
@ -156,7 +156,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
supplerName: data.supplerName || "", supplerName: data.supplerName || "",
amount: data.amount || "", amount: data.amount || "",
noOfPersons: data.noOfPersons || "", noOfPersons: data.noOfPersons || "",
gstNumber:data.gstNumber || "", gstNumber: data.gstNumber || "",
billAttachments: data.documents billAttachments: data.documents
? data.documents.map((doc) => ({ ? data.documents.map((doc) => ({
fileName: doc.fileName, fileName: doc.fileName,
@ -183,8 +183,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
const onSubmit = (fromdata) => { const onSubmit = (fromdata) => {
let payload = { let payload = {
...fromdata, ...fromdata,
transactionDate: localToUtc(fromdata.transactionDate) transactionDate: localToUtc(fromdata.transactionDate),
}; };
if (expenseToEdit) { if (expenseToEdit) {
const editPayload = { ...payload, id: data.id }; const editPayload = { ...payload, id: data.id };
@ -206,7 +205,6 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
if (StatusLoadding || projectLoading || ExpenseLoading || isLoading) if (StatusLoadding || projectLoading || ExpenseLoading || isLoading)
return <ExpenseSkeleton />; return <ExpenseSkeleton />;
return ( return (
<div className="container p-3"> <div className="container p-3">
<h5 className="m-0"> <h5 className="m-0">
@ -215,7 +213,9 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
<form id="expenseForm" onSubmit={handleSubmit(onSubmit)}> <form id="expenseForm" onSubmit={handleSubmit(onSubmit)}>
<div className="row my-2 text-start"> <div className="row my-2 text-start">
<div className="col-md-6"> <div className="col-md-6">
<Label className="form-label" required>Select Project</Label> <Label className="form-label" required>
Select Project
</Label>
<select <select
className="form-select form-select-sm" className="form-select form-select-sm"
{...register("projectId")} {...register("projectId")}
@ -296,7 +296,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
)} )}
</div> </div>
<div className="col-md-6"> {/* <div className="col-md-6">
<Label htmlFor="paidById" className="form-label" required> <Label htmlFor="paidById" className="form-label" required>
Paid By Paid By
</Label> </Label>
@ -322,6 +322,15 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
{errors.paidById && ( {errors.paidById && (
<small className="danger-text">{errors.paidById.message}</small> <small className="danger-text">{errors.paidById.message}</small>
)} )}
</div> */}
<div className="col-12 col-md-6 text-start">
<label className="form-label">Paid By </label>
<EmployeeSearchInput
control={control}
name="paidById"
projectId={null}
/>
</div> </div>
</div> </div>
@ -330,7 +339,11 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
<Label htmlFor="transactionDate" className="form-label" required> <Label htmlFor="transactionDate" className="form-label" required>
Transaction Date Transaction Date
</Label> </Label>
<DatePicker name="transactionDate" control={control} maxDate={new Date()}/> <DatePicker
name="transactionDate"
control={control}
maxDate={new Date()}
/>
{errors.transactionDate && ( {errors.transactionDate && (
<small className="danger-text"> <small className="danger-text">
@ -409,9 +422,9 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
</small> </small>
)} )}
</div> </div>
<div className="col-md-6"> <div className="col-md-6">
<label htmlFor="statusId" className="form-label "> <label htmlFor="statusId" className="form-label ">
GST Number GST Number
</label> </label>
<input <input
type="text" type="text"
@ -421,9 +434,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
{...register("gstNumber")} {...register("gstNumber")}
/> />
{errors.gstNumber && ( {errors.gstNumber && (
<small className="danger-text"> <small className="danger-text">{errors.gstNumber.message}</small>
{errors.gstNumber.message}
</small>
)} )}
</div> </div>
@ -448,7 +459,9 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
<div className="row my-2 text-start"> <div className="row my-2 text-start">
<div className="col-md-12"> <div className="col-md-12">
<Label htmlFor="description" className="form-label" required>Description</Label> <Label htmlFor="description" className="form-label" required>
Description
</Label>
<textarea <textarea
id="description" id="description"
className="form-control form-control-sm" className="form-control form-control-sm"
@ -465,7 +478,9 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
<div className="row my-2 text-start"> <div className="row my-2 text-start">
<div className="col-md-12"> <div className="col-md-12">
<Label className="form-label" required>Upload Bill </Label> <Label className="form-label" required>
Upload Bill{" "}
</Label>
<div <div
className="border border-secondary border-dashed rounded p-4 text-center bg-textMuted position-relative" className="border border-secondary border-dashed rounded p-4 text-center bg-textMuted position-relative"
@ -549,7 +564,7 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
<div className="d-flex justify-content-end gap-3"> <div className="d-flex justify-content-end gap-3">
{" "} {" "}
<button <button
type="reset" type="reset"
disabled={isPending || createPending} disabled={isPending || createPending}
onClick={handleClose} onClick={handleClose}
@ -568,7 +583,6 @@ const ManageExpense = ({ closeModal, expenseToEdit = null }) => {
? "Update" ? "Update"
: "Submit"} : "Submit"}
</button> </button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -9,7 +9,7 @@ import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { defaultActionValues, ExpenseActionScheam } from "./ExpenseSchema"; import { defaultActionValues, ExpenseActionScheam } from "./ExpenseSchema";
import { useExpenseContext } from "../../pages/Expense/ExpensePage"; import { useExpenseContext } from "../../pages/Expense/ExpensePage";
import { getColorNameFromHex, getIconByFileType } from "../../utils/appUtils"; import { getColorNameFromHex, getIconByFileType, localToUtc } from "../../utils/appUtils";
import { ExpenseDetailsSkeleton } from "./ExpenseSkeleton"; import { ExpenseDetailsSkeleton } from "./ExpenseSkeleton";
import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import { useHasUserPermission } from "../../hooks/useHasUserPermission";
import { import {
@ -38,7 +38,7 @@ const ViewExpense = ({ ExpenseId }) => {
const IsReview = useHasUserPermission(REVIEW_EXPENSE); const IsReview = useHasUserPermission(REVIEW_EXPENSE);
const [imageLoaded, setImageLoaded] = useState({}); const [imageLoaded, setImageLoaded] = useState({});
const { setDocumentView } = useExpenseContext(); const { setDocumentView } = useExpenseContext();
const ActionSchema = ExpenseActionScheam(IsPaymentProcess) ?? z.object({}); const ActionSchema = ExpenseActionScheam(IsPaymentProcess,data?.createdAt) ?? z.object({});
const navigate = useNavigate(); const navigate = useNavigate();
const { const {
register, register,
@ -91,9 +91,7 @@ const ViewExpense = ({ ExpenseId }) => {
const onSubmit = (formData) => { const onSubmit = (formData) => {
const Payload = { const Payload = {
...formData, ...formData,
reimburseDate: moment reimburseDate:localToUtc(formData.reimburseDate),
.utc(formData.reimburseDate, "DD-MM-YYYY")
.toISOString(),
expenseId: ExpenseId, expenseId: ExpenseId,
comment: formData.comment, comment: formData.comment,
}; };
@ -108,14 +106,12 @@ const ViewExpense = ({ ExpenseId }) => {
return ( return (
<form className="container px-3" onSubmit={handleSubmit(onSubmit)}> <form className="container px-3" onSubmit={handleSubmit(onSubmit)}>
<div className="row mb-3"> <div className="row mb-1">
<div className="col-12 mb-3"> <div className="col-12 mb-1">
<h5 className="fw-semibold">Expense Details</h5> <h5 className="fw-semibold m-0">Expense Details</h5>
<hr /> <hr />
</div> </div>
<div className="text-start mb-2"> <div className="col-12 text-start fw-semibold my-2">{data?.expenseUId}</div>
<div className="text-muted">{data?.description}</div>
</div>
{/* Row 1 */} {/* Row 1 */}
<div className="col-md-6 mb-3"> <div className="col-md-6 mb-3">
<div className="d-flex"> <div className="d-flex">
@ -279,7 +275,7 @@ const ViewExpense = ({ ExpenseId }) => {
className="form-label me-2 mb-0 fw-semibold" className="form-label me-2 mb-0 fw-semibold"
style={{ minWidth: "130px" }} style={{ minWidth: "130px" }}
> >
Paid By: Paid By :
</label> </label>
<div className="d-flex align-items-center "> <div className="d-flex align-items-center ">
<Avatar <Avatar
@ -296,6 +292,11 @@ const ViewExpense = ({ ExpenseId }) => {
</div> </div>
</div> </div>
</div> </div>
<div className="text-start my-1">
<label className="fw-semibold form-label">Description : </label>
<div className="text-muted">{data?.description}</div>
</div>
</div> </div>
<div className="col-12 text-start"> <div className="col-12 text-start">
@ -397,7 +398,8 @@ const ViewExpense = ({ ExpenseId }) => {
<DatePicker <DatePicker
name="reimburseDate" name="reimburseDate"
control={control} control={control}
minDate={data?.transactionDate} minDate={data?.createdAt}
maxDate={new Date()}
/> />
{errors.reimburseDate && ( {errors.reimburseDate && (
<small className="danger-text"> <small className="danger-text">
@ -410,7 +412,7 @@ const ViewExpense = ({ ExpenseId }) => {
<EmployeeSearchInput <EmployeeSearchInput
control={control} control={control}
name="reimburseById" name="reimburseById"
projectId={null} projectId={null}
/> />
</div> </div>
</div> </div>

View File

@ -1,3 +1,4 @@
import { useCallback, useEffect, useState,useMemo } from "react";
import getGreetingMessage from "../../utils/greetingHandler"; import getGreetingMessage from "../../utils/greetingHandler";
import { import {
cacheData, cacheData,
@ -13,122 +14,103 @@ import { useProfile } from "../../hooks/useProfile";
import { useLocation, useNavigate, useParams } from "react-router-dom"; import { useLocation, useNavigate, useParams } from "react-router-dom";
import Avatar from "../../components/common/Avatar"; import Avatar from "../../components/common/Avatar";
import { useChangePassword } from "../Context/ChangePasswordContext"; import { useChangePassword } from "../Context/ChangePasswordContext";
import { useProjects } from "../../hooks/useProjects"; import { useProjects } from "../../hooks/useProjects";
import { useCallback, useEffect, useState } from "react";
import { useProjectName } from "../../hooks/useProjects"; import { useProjectName } from "../../hooks/useProjects";
import eventBus from "../../services/eventBus"; import eventBus from "../../services/eventBus";
import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import { useHasUserPermission } from "../../hooks/useHasUserPermission";
import { MANAGE_PROJECT } from "../../utils/constants"; import { ALLOW_PROJECTSTATUS_ID, MANAGE_PROJECT, UUID_REGEX } from "../../utils/constants";
import { useAuthModal, useLogout } from "../../hooks/useAuth"; import { useAuthModal, useLogout } from "../../hooks/useAuth";
const Header = () => { const Header = () => {
const { profile } = useProfile(); const { profile } = useProfile();
const { data: masterData } = useMaster();
const location = useLocation(); const location = useLocation();
const dispatch = useDispatch(); const dispatch = useDispatch();
const { data, loading } = useMaster();
const navigate = useNavigate(); const navigate = useNavigate();
const {onOpen} = useAuthModal()
const { mutate: logout, isPending: logouting } = useLogout();
const { onOpen } = useAuthModal();
const { openChangePassword } = useChangePassword();
const HasManageProjectPermission = useHasUserPermission(MANAGE_PROJECT); const HasManageProjectPermission = useHasUserPermission(MANAGE_PROJECT);
const { mutate : logout,isPending:logouting} = useLogout()
const isDashboardPath = const pathname = location.pathname;
/^\/dashboard$/.test(location.pathname) || /^\/$/.test(location.pathname);
const isProjectPath = /^\/projects$/.test(location.pathname);
const showProjectDropdown = (pathname) => { // ======= MEMO CHECKS =======
const isDirectoryPath = /^\/directory$/.test(pathname); const isDashboardPath = pathname === "/" || pathname === "/dashboard";
const isProjectPath = pathname === "/projects";
const isDirectory = pathname === "/directory";
const isEmployeeList = pathname === "/employees";
// const isExpense = pathname === "/expenses";
const isEmployeeProfile = UUID_REGEX.test(pathname);
// const isProfilePage = /^\/employee$/.test(location.pathname); const hideDropPaths =
const isProfilePage = isDirectory || isEmployeeList || isEmployeeProfile;
/^\/employee\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
pathname
);
const isExpensePage = /^\/expenses$/.test(pathname);
return !(isDirectoryPath || isProfilePage || isExpensePage); const showProjectDropdown = !hideDropPaths;
};
const allowedProjectStatusIds = [
"603e994b-a27f-4e5d-a251-f3d69b0498ba",
"cdad86aa-8a56-4ff4-b633-9c629057dfef",
"b74da4c2-d07e-46f2-9919-e75e49b12731",
];
const getRole = (roles, joRoleId) => {
if (!Array.isArray(roles)) return "User";
let role = roles.find((role) => role.id === joRoleId);
return role ? role.name : "User";
};
const handleProfilePage = () => {
navigate(`/employee/${profile?.employeeInfo?.id}`);
};
// ===== Project Names & Selected Project =====
const { projectNames, loading: projectLoading, fetchData } = useProjectName(); const { projectNames, loading: projectLoading, fetchData } = useProjectName();
const selectedProject = useSelectedProject(); const selectedProject = useSelectedProject();
const projectsForDropdown = isDashboardPath const projectsForDropdown = useMemo(
? projectNames () =>
: projectNames?.filter((project) => isDashboardPath
allowedProjectStatusIds.includes(project.projectStatusId) ? projectNames
); : projectNames?.filter((project) =>
ALLOW_PROJECTSTATUS_ID.includes(project.projectStatusId)
),
[projectNames, isDashboardPath]
);
let currentProjectDisplayName; const currentProjectDisplayName = useMemo(() => {
if (projectLoading) { if (projectLoading) return "Loading...";
currentProjectDisplayName = "Loading..."; if (!projectNames?.length) return "No Projects Assigned";
} else if (!projectNames || projectNames.length === 0) { if (projectNames.length === 1) return projectNames[0].name;
currentProjectDisplayName = "No Projects Assigned"; if (selectedProject === null) return "All Projects";
} else if (projectNames.length === 1) { const selectedObj = projectNames.find((p) => p.id === selectedProject);
currentProjectDisplayName = projectNames[0].name; return selectedObj
} else { ? selectedObj.name
if (selectedProject === null) { : projectNames[0]?.name || "No Projects Assigned";
currentProjectDisplayName = "All Projects"; }, [projectLoading, projectNames, selectedProject]);
} else {
const selectedProjectObj = projectNames.find(
(p) => p?.id === selectedProject
);
currentProjectDisplayName = selectedProjectObj
? selectedProjectObj.name
: "All Projects";
}
}
const { openChangePassword } = useChangePassword(); // ===== Role Helper =====
const getRole = (roles, joRoleId) => {
if (!Array.isArray(roles)) return "User";
return roles.find((r) => r.id === joRoleId)?.name || "User";
};
// ===== Navigate to Profile =====
const handleProfilePage = () =>
navigate(`/employee/${profile?.employeeInfo?.id}`);
// ===== Set default project on load =====
useEffect(() => { useEffect(() => {
if ( if (
projectNames && projectNames?.length &&
projectNames.length > 0 &&
selectedProject === undefined && selectedProject === undefined &&
!getCachedData("hasReceived") !getCachedData("hasReceived")
) { ) {
if (projectNames.length === 1) { if (projectNames.length === 1) {
dispatch(setProjectId(projectNames[0]?.id || null)); dispatch(setProjectId(projectNames[0].id || null));
} else { } else {
if (isDashboardPath) { if (isDashboardPath) {
dispatch(setProjectId(null)); dispatch(setProjectId(null));
} else { } else {
const firstAllowedProject = projectNames.find((project) => const firstAllowed = projectNames.find((project) =>
allowedProjectStatusIds.includes(project.projectStatusId) ALLOW_PROJECTSTATUS_ID.includes(project.projectStatusId)
); );
dispatch(setProjectId(firstAllowedProject?.id || null)); dispatch(setProjectId(firstAllowed?.id || null));
} }
} }
} }
}, [projectNames, selectedProject, dispatch, isDashboardPath]); }, [projectNames, selectedProject, dispatch, isDashboardPath]);
// ===== Event Handlers =====
const handler = useCallback( const handler = useCallback(
async (data) => { async (data) => {
if (!HasManageProjectPermission) { if (!HasManageProjectPermission) {
await fetchData(); await fetchData();
const projectExist = data.projectIds.some( if (data.projectIds?.includes(selectedProject)) {
(item) => item === selectedProject
);
if (projectExist) {
cacheData("hasReceived", false); cacheData("hasReceived", false);
} }
} }
@ -138,14 +120,15 @@ const Header = () => {
const newProjectHandler = useCallback( const newProjectHandler = useCallback(
async (msg) => { async (msg) => {
if (HasManageProjectPermission && msg.keyword === "Create_Project") { if (
await fetchData(); msg.keyword === "Create_Project" ||
} else if (projectNames?.some((item) => item.id === msg.response.id)) { projectNames?.some((p) => p.id === msg.response?.id)
) {
await fetchData(); await fetchData();
cacheData("hasReceived", false);
} }
cacheData("hasReceived", false);
}, },
[HasManageProjectPermission, projectNames, fetchData] [projectNames, fetchData]
); );
useEffect(() => { useEffect(() => {
@ -162,10 +145,10 @@ const Header = () => {
}; };
}, [handler, newProjectHandler]); }, [handler, newProjectHandler]);
const handleProjectChange = (project) => { // ===== Project Change =====
dispatch(setProjectId(project)); const handleProjectChange = (projectId) => {
dispatch(setProjectId(projectId));
if (isProjectPath && project !== null) { if (isProjectPath && projectId !== null) {
navigate("/projects/details"); navigate("/projects/details");
} }
}; };
@ -189,7 +172,7 @@ const Header = () => {
className="navbar-nav-right d-flex align-items-center justify-content-between" className="navbar-nav-right d-flex align-items-center justify-content-between"
id="navbar-collapse" id="navbar-collapse"
> >
{showProjectDropdown(location.pathname) && ( {showProjectDropdown && (
<div className="align-items-center"> <div className="align-items-center">
<i className="rounded-circle bx bx-building-house bx-sm-lg bx-md me-2"></i> <i className="rounded-circle bx bx-building-house bx-sm-lg bx-md me-2"></i>
<div className="btn-group"> <div className="btn-group">
@ -215,16 +198,14 @@ const Header = () => {
className="dropdown-menu" className="dropdown-menu"
style={{ overflow: "auto", maxHeight: "300px" }} style={{ overflow: "auto", maxHeight: "300px" }}
> >
{isDashboardPath && (
<li> <li>
<button <button
className="dropdown-item" className="dropdown-item"
onClick={() => handleProjectChange(null)} onClick={() => handleProjectChange(null)}
> >All Project</button>
All Projects </li>
</button>
</li>
)}
{[...projectsForDropdown] {[...projectsForDropdown]
.sort((a, b) => a?.name?.localeCompare(b.name)) .sort((a, b) => a?.name?.localeCompare(b.name))
.map((project) => ( .map((project) => (
@ -249,112 +230,9 @@ const Header = () => {
)} )}
<ul className="navbar-nav flex-row align-items-center ms-md-auto"> <ul className="navbar-nav flex-row align-items-center ms-md-auto">
<li className="nav-item dropdown-shortcuts navbar-dropdown dropdown me-2 me-xl-0"> {/* {HasManageProjectPermission && ( */}
<a
className="nav-link dropdown-toggle hide-arrow" {/* )} */}
data-bs-toggle="dropdown"
data-bs-auto-close="true"
aria-expanded="false"
>
<i className="icon-base bx bx-grid-alt icon-md"></i>
</a>
<div className="dropdown-menu dropdown-menu-end p-0">
<div className="dropdown-menu-header border-bottom">
<div className="dropdown-header d-flex align-items-center py-3">
<h6 className="mb-0 me-auto">Shortcuts</h6>
<a
className="dropdown-shortcuts-add py-2 cusror-pointer"
data-bs-toggle="tooltip"
data-bs-placement="top"
aria-label="Add shortcuts"
data-bs-original-title="Add shortcuts"
>
<i className="icon-base bx bx-plus-circle text-heading"></i>
</a>
</div>
</div>
<div className="dropdown-shortcuts-list scrollable-container ps">
<div className="row row-bordered overflow-visible g-0">
<div className="dropdown-shortcuts-item col">
<a
onClick={() => navigate(`/dashboard`)}
className="text-heading text-truncate cursor-pointer"
>
<span className="dropdown-shortcuts-icon rounded-circle mb-3">
<i className="icon-base bx bx-home icon-26px text-heading"></i>
</span>
Dashboard
</a>
<small>User Dashboard</small>
</div>
<div className="dropdown-shortcuts-item col">
<a
onClick={() => navigate(`/projects`)}
className="text-heading text-truncate cursor-pointer"
>
<span className="dropdown-shortcuts-icon rounded-circle mb-3">
<i className="icon-base bx bx-building-house icon-26px text-heading"></i>
</span>
Projects
</a>
<small>Projects List</small>
</div>
</div>
<div className="row row-bordered overflow-visible g-0">
<div className="dropdown-shortcuts-item col">
<a
onClick={() => navigate(`/employees`)}
className="text-heading text-truncate cursor-pointer"
>
<span className="dropdown-shortcuts-icon rounded-circle mb-3">
<i className="icon-base bx bxs-user-account icon-26px text-heading"></i>
</span>
Employees
</a>
<small>Manage Employees</small>
</div>
<div className="dropdown-shortcuts-item col">
<a
onClick={() => navigate(`/activities/attendance`)}
className="text-heading text-truncate cursor-pointer"
>
<span className="dropdown-shortcuts-icon rounded-circle mb-3">
<i className="icon-base bx bx-user-check icon-26px text-heading"></i>
</span>
Attendance
</a>
<small>Manage Attendance</small>
</div>
</div>
<div className="row row-bordered overflow-visible g-0">
<div className="dropdown-shortcuts-item col">
<a
onClick={() => navigate(`/activities/task`)}
className="text-heading text-truncate cursor-pointer"
>
<span className="dropdown-shortcuts-icon rounded-circle mb-3">
<i className="icon-base bx bxs-wrench icon-26px text-heading"></i>
</span>
Allocate Work
</a>
<small>Work Allocations</small>
</div>
<div className="dropdown-shortcuts-item col">
<a
onClick={() => navigate(`/activities/records`)}
className="text-heading text-truncate cursor-pointer"
>
<span className="dropdown-shortcuts-icon rounded-circle mb-3">
<i className="icon-base bx bx-list-ul icon-26px text-heading"></i>
</span>
Daily Work Log
</a>
<small>Daily Work Allocations</small>
</div>
</div>
</div>
</div>
</li>
<li className="nav-item navbar-dropdown dropdown-user dropdown"> <li className="nav-item navbar-dropdown dropdown-user dropdown">
<a <a
aria-label="dropdown profile avatar" aria-label="dropdown profile avatar"
@ -386,7 +264,7 @@ const Header = () => {
{profile?.employeeInfo?.firstName} {profile?.employeeInfo?.firstName}
</span> </span>
<small className="text-muted"> <small className="text-muted">
{getRole(data, profile?.employeeInfo?.joRoleId)} {getRole(masterData, profile?.employeeInfo?.joRoleId)}
</small> </small>
</div> </div>
</div> </div>
@ -395,15 +273,13 @@ const Header = () => {
<li> <li>
<div className="dropdown-divider"></div> <div className="dropdown-divider"></div>
</li> </li>
<li onClick={()=>onOpen()}> {/* <li onClick={() => onOpen()}>
{" "} {" "}
<a <a className="dropdown-item cusor-pointer">
className="dropdown-item cusor-pointer"
>
<i className="bx bx-transfer-alt me-2"></i> <i className="bx bx-transfer-alt me-2"></i>
<span className="align-middle">Switch Workspace</span> <span className="align-middle">Switch Workspace</span>
</a> </a>
</li> </li> */}
<li onClick={handleProfilePage}> <li onClick={handleProfilePage}>
<a <a
aria-label="go to profile" aria-label="go to profile"
@ -433,7 +309,6 @@ const Header = () => {
</a> </a>
</li> </li>
<li> <li>
<div className="dropdown-divider"></div> <div className="dropdown-divider"></div>
</li> </li>
@ -441,10 +316,17 @@ const Header = () => {
<a <a
aria-label="click to log out" aria-label="click to log out"
className="dropdown-item cusor-pointer" className="dropdown-item cusor-pointer"
onClick={()=>logout()} onClick={() => logout()}
> >
{logouting ? "Please Wait":<> <i className="bx bx-log-out me-2"></i> {logouting ? (
<span className="align-middle">SignOut</span></>} "Please Wait"
) : (
<>
{" "}
<i className="bx bx-log-out me-2"></i>
<span className="align-middle">SignOut</span>
</>
)}
</a> </a>
</li> </li>
</ul> </ul>
@ -454,4 +336,4 @@ const Header = () => {
</nav> </nav>
); );
}; };
export default Header; export default Header;

View File

@ -5,7 +5,12 @@ import { zodResolver } from "@hookform/resolvers/zod";
import Label from "../common/Label"; import Label from "../common/Label";
import DatePicker from "../common/DatePicker"; import DatePicker from "../common/DatePicker";
import { useCreateProject, useProjectDetails, useUpdateProject } from "../../hooks/useProjects"; import {
useCreateProject,
useProjectDetails,
useProjectModal,
useUpdateProject,
} from "../../hooks/useProjects";
import { import {
DEFAULT_EMPTY_STATUS_ID, DEFAULT_EMPTY_STATUS_ID,
@ -17,6 +22,7 @@ import {
useOrganizationsList, useOrganizationsList,
} from "../../hooks/useOrganization"; } from "../../hooks/useOrganization";
import { localToUtc } from "../../utils/appUtils"; import { localToUtc } from "../../utils/appUtils";
import Modal from "../common/Modal";
const currentDate = new Date().toLocaleDateString("en-CA"); const currentDate = new Date().toLocaleDateString("en-CA");
const formatDate = (date) => { const formatDate = (date) => {
@ -37,13 +43,19 @@ const ManageProjectInfo = ({ project, onClose }) => {
const ACTIVE_STATUS_ID = "b74da4c2-d07e-46f2-9919-e75e49b12731"; const ACTIVE_STATUS_ID = "b74da4c2-d07e-46f2-9919-e75e49b12731";
const { projects_Details, loading } = useProjectDetails(project); const { projects_Details, loading } = useProjectDetails(project);
const { data, isLoading, isError, error } = useOrganizationsList( // const { data, isLoading, isError, error } = useOrganizationsList(
ITEMS_PER_PAGE, // ITEMS_PER_PAGE,
1, // 1,
true // true
// );
const { mutate: UpdateProject, isPending } = useUpdateProject(() => {
onClose?.();
});
const { mutate: CeateProject, isPending: isCreating } = useCreateProject(
() => {
onClose?.();
}
); );
const { mutate: UpdateProject, isPending } = useUpdateProject(() => {onClose?.()});
const {mutate:CeateProject,isPending:isCreating} = useCreateProject(()=>{onClose?.()})
const { const {
register, register,
@ -70,11 +82,11 @@ const ManageProjectInfo = ({ project, onClose }) => {
projectStatusId: projectStatusId:
String(projects_Details?.projectStatus?.id) || String(projects_Details?.projectStatus?.id) ||
DEFAULT_EMPTY_STATUS_IDF, DEFAULT_EMPTY_STATUS_IDF,
promoterId: projects_Details?.promoter?.id || "", // promoterId: projects_Details?.promoter?.id || "", // hide temp. for version 1
pmcId: projects_Details?.pmc?.id || "", // pmcId: projects_Details?.pmc?.id || "",
}); });
setAddressLength(projects_Details?.projectAddress?.length || 0); setAddressLength(projects_Details?.projectAddress?.length || 0);
}, [project, projects_Details, reset,data]); }, [project, projects_Details, reset]);
const onSubmitForm = (formData) => { const onSubmitForm = (formData) => {
if (project) { if (project) {
@ -85,13 +97,13 @@ const ManageProjectInfo = ({ project, onClose }) => {
id: project, id: project,
}; };
UpdateProject({ projectId: project, payload: payload }); UpdateProject({ projectId: project, payload: payload });
}else{ } else {
let payload = { let payload = {
...formData, ...formData,
startDate: localToUtc(formData.startDate), startDate: localToUtc(formData.startDate),
endDate: localToUtc(formData.endDate), endDate: localToUtc(formData.endDate),
}; };
CeateProject(payload) CeateProject(payload);
} }
}; };
@ -104,7 +116,6 @@ const ManageProjectInfo = ({ project, onClose }) => {
onOpen({ startStep: 2, flowType: "default" }); onOpen({ startStep: 2, flowType: "default" });
}; };
return ( return (
<div className="p-sm-2 p-2"> <div className="p-sm-2 p-2">
<div className="text-center mb-2"> <div className="text-center mb-2">
@ -254,7 +265,7 @@ const ManageProjectInfo = ({ project, onClose }) => {
</div> </div>
)} )}
</div> </div>
<div className="col-12 "> {/* <div className="col-12 ">
<label className="form-label" htmlFor="modalEditUserStatus"> <label className="form-label" htmlFor="modalEditUserStatus">
Promoter Promoter
</label> </label>
@ -330,7 +341,7 @@ const ManageProjectInfo = ({ project, onClose }) => {
<small className="cursor-pointer" onClick={handleOrganizaioFinder}> <small className="cursor-pointer" onClick={handleOrganizaioFinder}>
<i className="bx bx-plus-circle text-primary"></i> <i className="bx bx-plus-circle text-primary"></i>
</small> </small>
</div> </div> */}
<div className="col-12 col-md-12"> <div className="col-12 col-md-12">
<Label htmlFor="projectAddress" required> <Label htmlFor="projectAddress" required>
@ -376,7 +387,11 @@ const ManageProjectInfo = ({ project, onClose }) => {
className="btn btn-primary btn-sm" className="btn btn-primary btn-sm"
disabled={isPending || isCreating} disabled={isPending || isCreating}
> >
{isPending||isCreating ? "Please Wait..." : project ? "Update" : "Submit"} {isPending || isCreating
? "Please Wait..."
: project
? "Update"
: "Submit"}
</button> </button>
</div> </div>
</form> </form>
@ -385,3 +400,15 @@ const ManageProjectInfo = ({ project, onClose }) => {
}; };
export default ManageProjectInfo; export default ManageProjectInfo;
export const ProjectModal = () => {
const { isOpen, data, closeModal } = useProjectModal();
return (
<Modal
isOpen={isOpen}
body={<ManageProjectInfo project={data} onClose={closeModal} />}
onClose={closeModal}
/>
);
};

View File

@ -54,7 +54,7 @@ const ProjectCard = ({ project }) => {
style={{ fontSize: "xx-large" }} style={{ fontSize: "xx-large" }}
></i> ></i>
</div> </div>
<div className="me-2"> <div className="me-2 text-start">
<h5 <h5
className="mb-0 stretched-link text-heading text-start" className="mb-0 stretched-link text-heading text-start"
onClick={handleViewProject} onClick={handleViewProject}
@ -66,7 +66,7 @@ const ProjectCard = ({ project }) => {
</div> </div>
</div> </div>
</div> </div>
<div className={`ms-auto ${!ManageProject && "d-none"}`}> <div className={`ms-auto `}>
<div className="dropdown z-2"> <div className="dropdown z-2">
<button <button
type="button" type="button"
@ -106,12 +106,6 @@ const ProjectCard = ({ project }) => {
<span className="align-left">Modify</span> <span className="align-left">Modify</span>
</a> </a>
</li> </li>
<li onClick={handleViewActivities}>
<a className="dropdown-item">
<i className="bx bx-task me-2"></i>
<span className="align-left">Activities</span>
</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -1,70 +1,62 @@
import React from 'react' import React from "react";
import { useProjects } from '../../hooks/useProjects' import { useProjects } from "../../hooks/useProjects";
import Loader from '../common/Loader' import Loader from "../common/Loader";
import ProjectCard from './ProjectCard' import ProjectCard from "./ProjectCard";
const ProjectCardView = ({currentItems,setCurrentPage,totalPages }) => {
const ProjectCardView = ({ currentItems, setCurrentPage, totalPages }) => {
return ( return (
<div className="row page-min-h">
{currentItems.length === 0 && (
<p className="text-center text-muted">No projects found.</p>
)}
<div className="row page-min-h"> {currentItems.map((project) => (
<ProjectCard key={project.id} project={project} />
))}
{ currentItems.length === 0 && ( {totalPages > 1 && (
<p className="text-center text-muted">No projects found.</p> <nav>
)} <ul className="pagination pagination-sm justify-content-end py-2">
<li className={`page-item ${currentPage === 1 && "disabled"}`}>
{currentItems.map((project) => ( <button
<ProjectCard className="page-link"
key={project.id} onClick={() => setCurrentPage((p) => Math.max(1, p - 1))}
project={project} >
/> &laquo;
))} </button>
</li>
{[...Array(totalPages)].map((_, i) => (
{ totalPages > 1 && (
<nav>
<ul className="pagination pagination-sm justify-content-end py-2">
<li className={`page-item ${currentPage === 1 && "disabled"}`}>
<button
className="page-link"
onClick={() => setCurrentPage((p) => Math.max(1, p - 1))}
>
&laquo;
</button>
</li>
{[...Array(totalPages)].map((_, i) => (
<li
key={i}
className={`page-item ${currentPage === i + 1 && "active"}`}
>
<button
className="page-link"
onClick={() => setCurrentPage(i + 1)}
>
{i + 1}
</button>
</li>
))}
<li <li
className={`page-item ${currentPage === totalPages && "disabled" key={i}
}`} className={`page-item ${currentPage === i + 1 && "active"}`}
> >
<button <button
className="page-link" className="page-link"
onClick={() => onClick={() => setCurrentPage(i + 1)}
setCurrentPage((p) => Math.min(totalPages, p + 1))
}
> >
&raquo; {i + 1}
</button> </button>
</li> </li>
</ul> ))}
</nav> <li
)} className={`page-item ${
</div> currentPage === totalPages && "disabled"
}`}
) >
} <button
className="page-link"
onClick={() =>
setCurrentPage((p) => Math.min(totalPages, p + 1))
}
>
&raquo;
</button>
</li>
</ul>
</nav>
)}
</div>
);
};
export default ProjectCardView export default ProjectCardView;

View File

@ -26,9 +26,8 @@ const ProjectListView = ({
const navigate = useNavigate(); const navigate = useNavigate();
const { setMangeProject } = useProjectContext(); const { setMangeProject } = useProjectContext();
// const { data, isLoading, isError, error } = useProjects(); // const { data, isLoading, isError, error } = useProjects();
// check Permissions // check Permissions
const canManageProject = useHasUserPermission(MANAGE_PROJECT); // const canManageProject = useHasUserPermission(MANAGE_PROJECT);
const projectColumns = [ const projectColumns = [
{ {
@ -125,11 +124,15 @@ const ProjectListView = ({
}, },
]; ];
const handleViewActivities = (project) => { // const handleViewActivities = (project) => {
dispatch(setProjectId(project)); // dispatch(setProjectId(project));
navigate(`/activities/records?project=${project}`); // navigate(`/activities/records?project=${project}`);
}; // };
const handleMoveDetails = (project) => {
dispatch(setProjectId(project));
navigate("/projects/details");
};
return ( return (
<div className="card page-min-h py-4 px-6 shadow-sm"> <div className="card page-min-h py-4 px-6 shadow-sm">
<table className="table table-hover align-middle m-0"> <table className="table table-hover align-middle m-0">
@ -158,11 +161,7 @@ const ProjectListView = ({
: project[col.key] || "N/A"} : project[col.key] || "N/A"}
</td> </td>
))} ))}
<td <td className={`mx-2 ${"d-sm-table-cell"}`}>
className={`mx-2 ${
canManageProject ? "d-sm-table-cell" : "d-none"
}`}
>
<div className="dropdown z-2"> <div className="dropdown z-2">
<button <button
type="button" type="button"
@ -180,7 +179,7 @@ const ProjectListView = ({
></i> ></i>
</button> </button>
<ul className="dropdown-menu dropdown-menu-end"> <ul className="dropdown-menu dropdown-menu-end">
<li> <li onClick={() => handleMoveDetails(project.id)}>
<a <a
aria-label="click to View details" aria-label="click to View details"
className="dropdown-item cursor-pointer" className="dropdown-item cursor-pointer"
@ -204,12 +203,12 @@ const ProjectListView = ({
<span className="align-left">Modify</span> <span className="align-left">Modify</span>
</a> </a>
</li> </li>
<li onClick={() => handleViewActivities(project.id)}> {/* <li onClick={() => handleViewActivities(project.id)}>
<a className="dropdown-item cursor-pointer"> <a className="dropdown-item cursor-pointer">
<i className="bx bx-task me-2"></i> <i className="bx bx-task me-2"></i>
<span className="align-left">Activities</span> <span className="align-left">Activities</span>
</a> </a>
</li> </li> */}
</ul> </ul>
</div> </div>
</td> </td>

View File

@ -27,13 +27,13 @@ const ProjectNav = ({ onPillClick, activePill }) => {
const ProjectTab = [ const ProjectTab = [
{ key: "profile", icon: "bx bx-user", label: "Profile" }, { key: "profile", icon: "bx bx-user", label: "Profile" },
{ key: "teams", icon: "bx bx-group", label: "Teams" }, // { key: "teams", icon: "bx bx-group", label: "Teams" },
{ // {
key: "infra", // key: "infra",
icon: "bx bx-grid-alt", // icon: "bx bx-grid-alt",
label: "Infrastructure", // label: "Infrastructure",
hidden: !(HasViewInfraStructure || HasManageInfra || HasManageTask), // hidden: !(HasViewInfraStructure || HasManageInfra || HasManageTask),
}, // },
{ {
key: "directory", key: "directory",
icon: "bx bxs-contact", icon: "bx bxs-contact",
@ -41,8 +41,8 @@ const ProjectNav = ({ onPillClick, activePill }) => {
hidden: !(DirAdmin || DireManager || DirUser), hidden: !(DirAdmin || DireManager || DirUser),
}, },
{ key: "documents", icon: "bx bx-folder-open", label: "Documents",hidden:!(isViewDocuments || isModifyDocument || isUploadDocument) }, { key: "documents", icon: "bx bx-folder-open", label: "Documents",hidden:!(isViewDocuments || isModifyDocument || isUploadDocument) },
{ key: "organization", icon: "bx bx-buildings", label: "Organization"}, // { key: "organization", icon: "bx bx-buildings", label: "Organization"},
{ key: "setting", icon: "bx bxs-cog", label: "Setting",hidden:!isManageTeam }, // { key: "setting", icon: "bx bxs-cog", label: "Setting",hidden:!isManageTeam },
]; ];
return ( return (
<div className="nav-align-top"> <div className="nav-align-top">

View File

@ -11,8 +11,8 @@ export const projectDefault = {
startDate: currentDate.toISOString().split("T")[0], startDate: currentDate.toISOString().split("T")[0],
endDate: currentDate.toISOString().split("T")[0], endDate: currentDate.toISOString().split("T")[0],
projectStatusId: DEFAULT_EMPTY_STATUS_ID, projectStatusId: DEFAULT_EMPTY_STATUS_ID,
promoterId: "", // promoterId: "",
pmcId: "", // pmcId: "",
}; };
@ -39,8 +39,8 @@ export const projectSchema = z
.min(1, { message: "End Date is required" }) .min(1, { message: "End Date is required" })
.default(projectDefault), .default(projectDefault),
projectStatusId: z.string().min(1, { message: "Status is required" }), projectStatusId: z.string().min(1, { message: "Status is required" }),
promoterId: z.string().min(1, { message: "Promoter is required" }), // promoterId: z.string().min(1, { message: "Promoter is required" }),
pmcId: z.string().min(1, { message: "PMC is required" }), // pmcId: z.string().min(1, { message: "PMC is required" }),
}) })
.refine( .refine(
(data) => { (data) => {

View File

@ -8,12 +8,14 @@ import { orgSize, reference } from "../../utils/constants";
import moment from "moment"; import moment from "moment";
import { useGlobalServices } from "../../hooks/masterHook/useMaster"; import { useGlobalServices } from "../../hooks/masterHook/useMaster";
import SelectMultiple from "../common/SelectMultiple"; import SelectMultiple from "../common/SelectMultiple";
import { useNavigate } from "react-router-dom";
const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => { const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
const { data, isError, isLoading: industryLoading } = useIndustries(); const { data, isError, isLoading: industryLoading } = useIndustries();
const [logoPreview, setLogoPreview] = useState(null); const [logoPreview, setLogoPreview] = useState(null);
const [logoName, setLogoName] = useState(""); const [logoName, setLogoName] = useState("");
const { data: services, isLoading: serviceLoading } = useGlobalServices(); const { data: services, isLoading: serviceLoading } = useGlobalServices();
const navigate = useNavigate()
const { const {
register, register,
control, control,
@ -29,8 +31,8 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
error, error,
isPending, isPending,
} = useCreateTenant(() => { } = useCreateTenant(() => {
debugger // onNext()
onNext() navigate("/tenants");
}); });
const handleNext = async () => { const handleNext = async () => {
@ -134,7 +136,6 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
control={control} control={control}
placeholder="DD-MM-YYYY" placeholder="DD-MM-YYYY"
maxDate={new Date()} maxDate={new Date()}
className={errors.onBoardingDate ? "is-invalid" : ""}
/> />
{errors.onBoardingDate && ( {errors.onBoardingDate && (
<div className="invalid-feedback"> <div className="invalid-feedback">

View File

@ -85,6 +85,7 @@ export const DateRangePicker1 = ({
resetSignal, resetSignal,
defaultRange = true, defaultRange = true,
maxDate = null, maxDate = null,
sm,md,
...rest ...rest
}) => { }) => {
const inputRef = useRef(null); const inputRef = useRef(null);
@ -168,11 +169,12 @@ export const DateRangePicker1 = ({
const formattedValue = start && end ? `${start} To ${end}` : ""; const formattedValue = start && end ? `${start} To ${end}` : "";
return ( return (
<div className={`position-relative ${className}`}> <div className={`col-${sm} col-sm-${md} px-1 position-relative`}>
<input <input
type="text" type="text"
className="form-control form-control-sm" className="form-control form-control-sm ps-2 pe-5 me-4 cursor-pointer"
placeholder={placeholder} placeholder="From to End"
id="flatpickr-range"
defaultValue={formattedValue} defaultValue={formattedValue}
ref={(el) => { ref={(el) => {
inputRef.current = el; inputRef.current = el;
@ -181,12 +183,10 @@ export const DateRangePicker1 = ({
readOnly={!allowText} readOnly={!allowText}
autoComplete="off" autoComplete="off"
/> />
<span <i
className="position-absolute top-50 end-0 pe-1 translate-middle-y cursor-pointer" className="bx bx-calendar calendar-icon cursor-pointer position-absolute top-50 end-0 translate-middle-y me-2"
onClick={() => inputRef.current?._flatpickr?.open()} onClick={() => inputRef.current?._flatpickr?.open()}
> ></i>
<i className="bx bx-calendar bx-sm fs-5 text-muted"></i>
</span>
</div> </div>
); );
}; };

View File

@ -1,13 +1,11 @@
import { useState, useEffect } from "react"; import { useState, useEffect, useRef } from "react";
import { useEmployeesName } from "../../hooks/useEmployees"; import { useEmployeesName } from "../../hooks/useEmployees";
import { useDebounce } from "../../utils/appUtils"; import { useDebounce } from "../../utils/appUtils";
import { useController } from "react-hook-form"; import { useController } from "react-hook-form";
import Avatar from "./Avatar"; import Avatar from "./Avatar";
const EmployeeSearchInput = ({ control, name, projectId, placeholder }) => {
const EmployeeSearchInput = ({ control, name, projectId,placeholder }) => {
const { const {
field: { onChange, value, ref }, field: { onChange, value, ref },
fieldState: { error }, fieldState: { error },
@ -17,6 +15,8 @@ const EmployeeSearchInput = ({ control, name, projectId,placeholder }) => {
const [showDropdown, setShowDropdown] = useState(false); const [showDropdown, setShowDropdown] = useState(false);
const debouncedSearch = useDebounce(search, 500); const debouncedSearch = useDebounce(search, 500);
const wrapperRef = useRef(null);
const { const {
data: employees, data: employees,
isLoading, isLoading,
@ -29,6 +29,19 @@ const EmployeeSearchInput = ({ control, name, projectId,placeholder }) => {
} }
}, [value, employees]); }, [value, employees]);
useEffect(() => {
const handleClickOutside = (e) => {
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
setShowDropdown(false);
}
};
document.addEventListener("mousedown", handleClickOutside);
return () => {
document.removeEventListener("mousedown", handleClickOutside);
};
}, []);
const handleSelect = (employee) => { const handleSelect = (employee) => {
onChange(employee.id); onChange(employee.id);
setSearch(employee.firstName + " " + employee.lastName); setSearch(employee.firstName + " " + employee.lastName);
@ -36,17 +49,17 @@ const EmployeeSearchInput = ({ control, name, projectId,placeholder }) => {
}; };
return ( return (
<div className="position-relative"> <div className="position-relative" ref={wrapperRef}>
<input <input
type="text" type="text"
ref={ref} ref={ref}
className={`form-control form-control-sm`} className="form-control form-control-sm"
placeholder={placeholder} placeholder={placeholder}
value={search} value={search}
onChange={(e) => { onChange={(e) => {
setSearch(e.target.value); setSearch(e.target.value);
setShowDropdown(true); setShowDropdown(true);
onChange(""); onChange("");
}} }}
onFocus={() => { onFocus={() => {
if (search) setShowDropdown(true); if (search) setShowDropdown(true);
@ -55,34 +68,33 @@ const EmployeeSearchInput = ({ control, name, projectId,placeholder }) => {
{showDropdown && (employees?.data?.length > 0 || isLoading) && ( {showDropdown && (employees?.data?.length > 0 || isLoading) && (
<ul <ul
className="list-group position-absolute bg-white w-100 shadow z-3 rounded-none px-0" className="list-group position-absolute bg-white w-100 shadow z-3 px-0"
style={{ maxHeight: 200, overflowY: "auto" }} style={{ maxHeight: 200, overflowY: "auto" }}
> >
{isLoading ? ( {isLoading ? (
<li className="list-group-item"> <li className="list-group-item">
<a>Searching...</a> <a>Searching...</a>
</li> </li>
) : ( ) : (
employees?.data?.map((emp) => ( employees?.data?.map((emp) => (
<li <li
key={emp.id} key={emp.id}
className="list-group-item list-group-item-action py-1 px-1" className="list-group-item list-group-item-action py-1 px-1"
style={{ cursor: "pointer" }} style={{ cursor: "pointer" }}
onClick={() => handleSelect(emp)} onClick={() => handleSelect(emp)}
> >
<div className="d-flex align-items-center px-0"> <div className="d-flex align-items-center px-0">
<Avatar <Avatar
size="xs" size="xs"
classAvatar="m-0 me-2" classAvatar="m-0 me-2"
firstName={emp.firstName} firstName={emp.firstName}
lastName={emp.lastName} lastName={emp.lastName}
/> />
<span className="text-muted"> <span className="text-muted">
{`${emp?.firstName} ${emp?.lastName}`.trim()} {`${emp?.firstName} ${emp?.lastName}`.trim()}
</span> </span>
</div> </div>
</li> </li>
)) ))
)} )}
</ul> </ul>
@ -94,3 +106,4 @@ const EmployeeSearchInput = ({ control, name, projectId,placeholder }) => {
}; };
export default EmployeeSearchInput; export default EmployeeSearchInput;

View File

@ -4,21 +4,26 @@ import { createPortal } from "react-dom";
import "./MultiSelectDropdown.css"; import "./MultiSelectDropdown.css";
import Label from "./Label"; import Label from "./Label";
const SelectMultiple = ({ const SelectMultiple = ({
name, name,
options = [], options = [],
label = "Select options", label = "Select options",
labelKey = "name", labelKey = "name",
valueKey = "id", valueKey = "id",
placeholder = "Please select...", placeholder = "Please select...",
IsLoading = false,required = false IsLoading = false,
required = false,
}) => { }) => {
const { setValue, watch,register } = useFormContext(); const { setValue, watch, register } = useFormContext();
useEffect(() => {
register(name, { value: [] });
}, [register, name]);
const selectedValues = watch(name) || []; useEffect(() => {
register(name, { value: [] });
}, [register, name]);
const selectedValues = watch(name) || [];
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const [searchText, setSearchText] = useState(""); const [searchText, setSearchText] = useState("");
@ -60,18 +65,20 @@ const selectedValues = watch(name) || [];
const updated = selectedValues.includes(value) const updated = selectedValues.includes(value)
? selectedValues.filter((v) => v !== value) ? selectedValues.filter((v) => v !== value)
: [...selectedValues, value]; : [...selectedValues, value];
setValue(name, updated, { shouldValidate: true }); setValue(name, updated, { shouldValidate: true });
}; };
const filteredOptions = (options || []).filter((item) => { const filteredOptions = (options || []).filter((item) => {
const label = getLabel(item); const label = getLabel(item);
return ( return typeof label === "string" && label.toLowerCase().includes(searchText.toLowerCase());
typeof label === "string" && });
label.toLowerCase().includes(searchText.toLowerCase())
);
});
// Sort filtered options in ascending order
const sortedOptions = filteredOptions.sort((a, b) => {
const labelA = getLabel(a).toString().toLowerCase();
const labelB = getLabel(b).toString().toLowerCase();
return labelA.localeCompare(labelB);
});
const dropdownElement = ( const dropdownElement = (
<div <div
@ -101,7 +108,7 @@ const selectedValues = watch(name) || [];
/> />
</div> </div>
{filteredOptions.map((item) => { {sortedOptions.map((item) => {
const labelVal = getLabel(item); const labelVal = getLabel(item);
const valueVal = item[valueKey]; const valueVal = item[valueKey];
const isChecked = selectedValues.includes(valueVal); const isChecked = selectedValues.includes(valueVal);
@ -124,12 +131,12 @@ const selectedValues = watch(name) || [];
); );
})} })}
{!IsLoading && filteredOptions.length === 0 && ( {!IsLoading && sortedOptions.length === 0 && (
<div className="multi-select-dropdown-Not-found" style={{ padding: 8 }}> <div className="multi-select-dropdown-Not-found" style={{ padding: 8 }}>
<label className="text-muted">Not Found {`'${searchText}'`}</label> <label className="text-muted">Not Found {`'${searchText}'`}</label>
</div> </div>
)} )}
{IsLoading && filteredOptions.length === 0 && ( {IsLoading && sortedOptions.length === 0 && (
<div className="multi-select-dropdown-Not-found" style={{ padding: 8 }}> <div className="multi-select-dropdown-Not-found" style={{ padding: 8 }}>
<label className="text-muted">Loading...</label> <label className="text-muted">Loading...</label>
</div> </div>
@ -140,19 +147,14 @@ const selectedValues = watch(name) || [];
return ( return (
<> <>
<div ref={containerRef} className="multi-select-dropdown-container" style={{ position: "relative" }}> <div ref={containerRef} className="multi-select-dropdown-container" style={{ position: "relative" }}>
<label className="form-label mb-1">{label}</label> <Label required={required}>{label}</Label>
<Label className={name} required={required}></Label>
<div <div
className="multi-select-dropdown-header" className="multi-select-dropdown-header"
onClick={() => setIsOpen((prev) => !prev)} onClick={() => setIsOpen((prev) => !prev)}
style={{ cursor: "pointer" }} style={{ cursor: "pointer" }}
> >
<span <span className={selectedValues.length > 0 ? "placeholder-style-selected" : "placeholder-style"}>
className={
selectedValues.length > 0 ? "placeholder-style-selected" : "placeholder-style"
}
>
<div className="selected-badges-container"> <div className="selected-badges-container">
{selectedValues.length > 0 ? ( {selectedValues.length > 0 ? (
selectedValues.map((val) => { selectedValues.map((val) => {

View File

@ -2,7 +2,7 @@ import { useFormContext, useWatch } from "react-hook-form";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import Label from "./Label"; import Label from "./Label";
const TagInput = ({ label, name, placeholder, color = "#e9ecef", options = [] }) => { const TagInput = ({ label, name, placeholder, color = "#e9ecef", options = [],require = false }) => {
const { setValue, watch } = useFormContext(); const { setValue, watch } = useFormContext();
const tags = watch(name) || []; const tags = watch(name) || [];
const [input, setInput] = useState(""); const [input, setInput] = useState("");
@ -65,9 +65,9 @@ const handleChange = (e) => {
return ( return (
<> <>
<label htmlFor={name} className="form-label"> <Label required={require}>
{label} {label}
</label> </Label>
<div <div
className="form-control form-control-sm p-1" className="form-control form-control-sm p-1"

View File

@ -37,7 +37,6 @@ const ServiceGroups = ({ service }) => {
<div className="w-100 my-2"> <div className="w-100 my-2">
<p className="fs-5 fw-semibold">Manage Service</p>
<div className="accordion" id="accordionExample"> <div className="accordion" id="accordionExample">
<div className="accordion-item active shadow-none"> <div className="accordion-item active shadow-none">
{/* Service Header */} {/* Service Header */}

View File

@ -12,38 +12,9 @@ import { setDefaultDateRange } from "../slices/localVariablesSlice";
// ----------------------------Query----------------------------- // ----------------------------Query-----------------------------
// export const useAttendance = (projectId) => {
// const dispatch = useDispatch()
// const {
// data: attendance = [],
// isLoading: loading,
// error,
// refetch: recall,
// isFetching
// } = useQuery({
// queryKey: ["attendance", projectId],
// queryFn: async () => {
// const response = await AttendanceRepository.getAttendance(projectId);
// return response.data;
// },
// enabled: !!projectId,
// onError: (error) => {
// showToast(error.message || "Error while fetching Attendance", "error");
// },
// });
// return {
// attendance,
// loading,
// error,
// recall,
// isFetching
// };
// };
export const useAttendance = (projectId, organizationId, includeInactive = false, date = null) => { export const useAttendance = (projectId, organizationId, includeInactive = false, date = null) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
// queryKey: ["attendance", projectId, organizationId, includeInactive, date],
const { const {
data: attendance = [], data: attendance = [],
isLoading: loading, isLoading: loading,
@ -51,7 +22,7 @@ export const useAttendance = (projectId, organizationId, includeInactive = false
refetch: recall, refetch: recall,
isFetching, isFetching,
} = useQuery({ } = useQuery({
queryKey: ["attendance", projectId, organizationId, includeInactive, date], // include filters in cache key queryKey: ["attendance", projectId ],
queryFn: async () => { queryFn: async () => {
const response = await AttendanceRepository.getAttendance( const response = await AttendanceRepository.getAttendance(
projectId, projectId,
@ -61,7 +32,7 @@ export const useAttendance = (projectId, organizationId, includeInactive = false
); );
return response.data; return response.data;
}, },
enabled: !!projectId, // only run if projectId exists enabled: !!projectId,
onError: (error) => { onError: (error) => {
showToast(error.message || "Error while fetching Attendance", "error"); showToast(error.message || "Error while fetching Attendance", "error");
}, },
@ -142,31 +113,6 @@ export const useAttendanceByEmployee = (employeeId, fromDate, toDate) => {
}); });
}; };
// export const useRegularizationRequests = (projectId) => {
// const {
// data: regularizes = [],
// isLoading: loading,
// error,
// refetch,
// } = useQuery({
// queryKey: ["regularizedList", projectId],
// queryFn: async () => {
// const response = await AttendanceRepository.getRegularizeList(projectId);
// return response.data;
// },
// enabled: !!projectId,
// onError: (error) => {
// showToast(error.message || "Error while fetching Regularization Requests", "error");
// },
// });
// return {
// regularizes,
// loading,
// error,
// refetch,
// };
// };
export const useRegularizationRequests = (projectId, organizationId, IncludeInActive = false) => { export const useRegularizationRequests = (projectId, organizationId, IncludeInActive = false) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -218,10 +164,11 @@ export const useMarkAttendance = () => {
emp.employeeId === data.employeeId ? { ...emp, ...data } : emp emp.employeeId === data.employeeId ? { ...emp, ...data } : emp
); );
}); });
// queryClient.invalidateQueries({queryKey:["attendance"]})
}else if(variables.forWhichTab == 2){ }else if(variables.forWhichTab == 2){
// queryClient.invalidateQueries({ queryClient.invalidateQueries({
// queryKey: ["attendanceLogs"], queryKey: ["attendanceLogs"],
// }); });
queryClient.setQueryData(["attendanceLogs",selectedProject,selectedDateRange.startDate,selectedDateRange.endDate], (oldData) => { queryClient.setQueryData(["attendanceLogs",selectedProject,selectedDateRange.startDate,selectedDateRange.endDate], (oldData) => {
if (!oldData) return oldData; if (!oldData) return oldData;
return oldData.map((record) => return oldData.map((record) =>

View File

@ -155,32 +155,32 @@ export const useDashboard_Data = ({ days, FromDate, projectId }) => {
// }; // };
export const useAttendanceOverviewData = (projectId, days) => { // export const useAttendanceOverviewData = (projectId, days) => {
const [attendanceOverviewData, setAttendanceOverviewData] = useState([]); // const [attendanceOverviewData, setAttendanceOverviewData] = useState([]);
const [loading, setLoading] = useState(false); // const [loading, setLoading] = useState(false);
const [error, setError] = useState(""); // const [error, setError] = useState("");
useEffect(() => { // useEffect(() => {
if (!projectId || !days) return; // if (!projectId || !days) return;
const fetchAttendanceOverview = async () => { // const fetchAttendanceOverview = async () => {
setLoading(true); // setLoading(true);
setError(""); // setError("");
try { // try {
const response = await GlobalRepository.getAttendanceOverview(projectId, days); // const response = await GlobalRepository.getAttendanceOverview(projectId, days);
setAttendanceOverviewData(response.data); // setAttendanceOverviewData(response.data);
} catch (err) { // } catch (err) {
setError("Failed to fetch attendance overview data."); // setError("Failed to fetch attendance overview data.");
} finally { // } finally {
setLoading(false); // setLoading(false);
} // }
}; // };
fetchAttendanceOverview(); // fetchAttendanceOverview();
}, [projectId, days]); // }, [projectId, days]);
return { attendanceOverviewData, loading, error }; // return { attendanceOverviewData, loading, error };
}; // };
// -------------------Query---------------------------- // -------------------Query----------------------------
@ -232,16 +232,17 @@ export const useDashboardTasksCardData = (projectId) => {
} }
}) })
} }
// export const useAttendanceOverviewData = (projectId, days) => { export const useAttendanceOverviewData = (projectId, days) => {
// return useQuery({ return useQuery({
// queryKey:["dashboardAttendanceOverView",projectId], queryKey:["dashboardAttendanceOverView",projectId,days],
// queryFn:async()=> { queryFn:async()=> {
// const resp = await GlobalRepository.getAttendanceOverview(projectId, days); const resp = await GlobalRepository.getAttendanceOverview(projectId, days);
// return resp.data; return resp.data;
// } },
// }) enabled:!!projectId
// } })
}
export const useDashboardProjectsCardData = () => { export const useDashboardProjectsCardData = () => {
return useQuery({ return useQuery({
@ -252,4 +253,44 @@ export const useDashboardProjectsCardData = () => {
return resp.data; return resp.data;
} }
}) })
} }
export const useExpenseAnalysis = (projectId, startDate, endDate) => {
const hasBothDates = !!startDate && !!endDate;
const noDatesSelected = !startDate && !endDate;
const shouldFetch =
noDatesSelected ||
hasBothDates;
return useQuery({
queryKey: ["expenseAnalysis", projectId, startDate, endDate],
queryFn: async () => {
const resp = await GlobalRepository.getExpenseData(projectId, startDate, endDate);
return resp.data;
},
enabled:shouldFetch,
refetchOnWindowFocus: true, // refetch when you come back
refetchOnMount: "always", // always refetch on remount
staleTime: 0,
});
};
export const useExpenseStatus = (projectId)=>{
return useQuery({
queryKey:["expense_stauts",projectId],
queryFn: async()=>{
const resp = await GlobalRepository.getExpenseStatus(projectId);
return resp.data;
}
})
}
export const useExpenseDataByProject = (projectId, categoryId, months) => {
return useQuery({
queryKey: ["expenseByProject", projectId, categoryId, months],
queryFn: async () => {
const resp = await GlobalRepository.getExpenseDataByProject(projectId, categoryId, months);
return resp.data;
},
});
};

View File

@ -399,7 +399,6 @@ export const useUpdateBucket = (onSuccessCallBack) => {
mutationFn: async ({ bucketId, BucketPayload }) => mutationFn: async ({ bucketId, BucketPayload }) =>
await DirectoryRepository.UpdateBuckets(bucketId, BucketPayload), await DirectoryRepository.UpdateBuckets(bucketId, BucketPayload),
onSuccess: (_, variables) => { onSuccess: (_, variables) => {
debugger;
queryClient.invalidateQueries({ queryKey: ["bucketList"] }); queryClient.invalidateQueries({ queryKey: ["bucketList"] });
showToast("Bucket updated successfully", "success"); showToast("Bucket updated successfully", "success");
if (onSuccessCallBack) onSuccessCallBack(); if (onSuccessCallBack) onSuccessCallBack();
@ -415,7 +414,7 @@ export const useUpdateBucket = (onSuccessCallBack) => {
}); });
}; };
export const useAssignEmpToBucket = () => { export const useAssignEmpToBucket = (onSuccessCallBack) => {
return useMutation({ return useMutation({
mutationFn: async ({ bucketId, EmployeePayload }) => mutationFn: async ({ bucketId, EmployeePayload }) =>
await DirectoryRepository.AssignedBuckets(bucketId, EmployeePayload), await DirectoryRepository.AssignedBuckets(bucketId, EmployeePayload),
@ -464,6 +463,7 @@ export const useCreateContact = (onSuccessCallBack) => {
await DirectoryRepository.CreateContact(contactPayload), await DirectoryRepository.CreateContact(contactPayload),
onSuccess: (_, variables) => { onSuccess: (_, variables) => {
queryClient.invalidateQueries({ queryKey: ["contacts"] }); queryClient.invalidateQueries({ queryKey: ["contacts"] });
queryClient.invalidateQueries({ queryKey: ["bucketList"] });
showToast("Contact created Successfully", "success"); showToast("Contact created Successfully", "success");
if (onSuccessCallBack) onSuccessCallBack(); if (onSuccessCallBack) onSuccessCallBack();
}, },
@ -483,6 +483,7 @@ export const useUpdateContact = (onSuccessCallBack) => {
mutationFn: async ({ contactId, contactPayload }) => mutationFn: async ({ contactId, contactPayload }) =>
await DirectoryRepository.UpdateContact(contactId, contactPayload), await DirectoryRepository.UpdateContact(contactId, contactPayload),
onSuccess: (_, variables) => { onSuccess: (_, variables) => {
queryClient.invalidateQueries({ queryKey: ["Contact"] });
queryClient.invalidateQueries({ queryKey: ["contacts"] }); queryClient.invalidateQueries({ queryKey: ["contacts"] });
showToast("Contact updated Successfully", "success"); showToast("Contact updated Successfully", "success");
if (onSuccessCallBack) onSuccessCallBack(); if (onSuccessCallBack) onSuccessCallBack();

View File

@ -120,7 +120,7 @@ export const useUploadDocument = (onSuccessCallBack) => {
DocumentRepository.uploadDocument(DocumentPayload), DocumentRepository.uploadDocument(DocumentPayload),
onSuccess: (data, variables) => { onSuccess: (data, variables) => {
queryClient.invalidateQueries({ queryKey: ["DocumentList"] }); queryClient.invalidateQueries({ queryKey: ["DocumentList"] });
queryClient.invalidateQueries({ queryKey: ["Document"] });
if (onSuccessCallBack) onSuccessCallBack(); if (onSuccessCallBack) onSuccessCallBack();
}, },
onError: (error) => { onError: (error) => {
@ -141,7 +141,7 @@ export const useUpdateDocument = (onSuccessCallBack) => {
onSuccess: (data, variables) => { onSuccess: (data, variables) => {
const { documentId } = variables; const { documentId } = variables;
queryClient.invalidateQueries({ queryKey: ["DocumentList"] }); queryClient.invalidateQueries({ queryKey: ["DocumentList"] });
queryClient.invalidateQueries({ queryKey: ["Document", documentId] }); queryClient.invalidateQueries({ queryKey: ["Document"] });
if (onSuccessCallBack) onSuccessCallBack(); if (onSuccessCallBack) onSuccessCallBack();
}, },
onError: (error) => { onError: (error) => {
@ -187,6 +187,7 @@ export const useActiveInActiveDocument = ()=>{
onSuccess: (data, variables) => { onSuccess: (data, variables) => {
const {isActive} = variables; const {isActive} = variables;
queryClient.invalidateQueries({ queryKey: ["DocumentList"] }); queryClient.invalidateQueries({ queryKey: ["DocumentList"] });
queryClient.invalidateQueries({ queryKey: ["Document"] });
showToast(`Document ${isActive ? "restored":"Deleted"} successfully`,"success") showToast(`Document ${isActive ? "restored":"Deleted"} successfully`,"success")
}, },
onError: (error) => { onError: (error) => {

View File

@ -12,14 +12,14 @@ import { queryClient } from "../layouts/AuthLayout";
// Query --------------------------------------------------------------------------- // Query ---------------------------------------------------------------------------
export const useEmployee = (employeeId) => { export const useEmployee = (employeeId) => {
return useQuery({ return useQuery({
queryKey: ["employeeProfile", employeeId], queryKey: ["employeeProfile", employeeId],
queryFn: async () => { queryFn: async () => {
const res = await EmployeeRepository.getEmployeeProfile(employeeId) const res = await EmployeeRepository.getEmployeeProfile(employeeId);
return res.data; return res.data;
}, },
enabled:!!employeeId enabled: !!employeeId,
}); });
}; };
export const useAllEmployees = (showInactive) => { export const useAllEmployees = (showInactive) => {
@ -208,9 +208,6 @@ export const useEmployeesNameByProject = (projectId) => {
// Mutation------------------------------------------------------------------ // Mutation------------------------------------------------------------------
export const useUpdateEmployee = () => { export const useUpdateEmployee = () => {
const selectedProject = useSelector( const selectedProject = useSelector(
(store) => store.localVariables.projectId (store) => store.localVariables.projectId
@ -218,14 +215,15 @@ export const useUpdateEmployee = () => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useMutation({ return useMutation({
mutationFn: (employeeData) => mutationFn: async (employeeData) =>
EmployeeRepository.manageEmployee(employeeData), await EmployeeRepository.manageEmployee(employeeData),
onSuccess: (_, variables) => { onSuccess: (_, variables) => {
debugger;
const id = variables?.id || variables?.employeeId; const id = variables?.id || variables?.employeeId;
const isAllEmployee = variables.IsAllEmployee; const isAllEmployee = variables.IsAllEmployee;
// Cache invalidation // Cache invalidation
queryClient.invalidateQueries({ queryKey: ["employeeProfile",id] }); queryClient.invalidateQueries({ queryKey: ["employeeProfile"] });
queryClient.invalidateQueries({ queryKey: ["allEmployees"] }); queryClient.invalidateQueries({ queryKey: ["allEmployees"] });
// queryClient.invalidateQueries(['employeeProfile', id]); // queryClient.invalidateQueries(['employeeProfile', id]);
queryClient.invalidateQueries({ queryKey: ["projectEmployees"] }); queryClient.invalidateQueries({ queryKey: ["projectEmployees"] });
@ -247,7 +245,6 @@ export const useUpdateEmployee = () => {
}); });
}; };
export const useSuspendEmployee = ({ export const useSuspendEmployee = ({
setIsDeleteModalOpen, setIsDeleteModalOpen,
setemployeeLodaing, setemployeeLodaing,
@ -300,7 +297,6 @@ export const useSuspendEmployee = ({
}); });
}; };
export const useUpdateEmployeeRoles = ({ export const useUpdateEmployeeRoles = ({
onClose, onClose,
resetForm, resetForm,
@ -334,4 +330,4 @@ export const useUpdateEmployeeRoles = ({
isError: mutation.isError, isError: mutation.isError,
error: mutation.error, error: mutation.error,
}; };
}; };

View File

@ -10,7 +10,7 @@ import moment from "moment";
const cleanFilter = (filter) => { const cleanFilter = (filter) => {
const cleaned = { ...filter }; const cleaned = { ...filter };
["projectIds", "statusIds", "createdByIds", "paidById"].forEach((key) => { ["projectIds", "statusIds", "createdByIds", "paidById","ExpenseTypeIds"].forEach((key) => {
if (Array.isArray(cleaned[key]) && cleaned[key].length === 0) { if (Array.isArray(cleaned[key]) && cleaned[key].length === 0) {
delete cleaned[key]; delete cleaned[key];
} }

View File

@ -8,19 +8,20 @@ export const useHasUserPermission = (permission) => {
data: projectPermissions = [], data: projectPermissions = [],
isLoading, isLoading,
isError, isError,
} = useAllProjectLevelPermissions(selectedProject); } = useAllProjectLevelPermissions();
// set selectedProject to call api- selectedProject
if (isLoading || !permission) return false; if (isLoading || !permission) return false;
const globalPerms = profile?.featurePermissions ?? []; const globalPerms = profile?.featurePermissions ?? [];
const projectPerms = projectPermissions ?? []; // const projectPerms = projectPermissions ?? [];
if (selectedProject) { // if (selectedProject) {
if (projectPerms.length === 0) { // if (projectPerms.length === 0) {
return projectPerms.includes(permission); // return projectPerms.includes(permission);
} else { // } else {
return projectPerms.includes(permission); // return projectPerms.includes(permission);
} // }
} else { // } else {
return globalPerms.includes(permission); // return globalPerms.includes(permission);
} // }
return globalPerms.includes(permission);
}; };

View File

@ -14,7 +14,6 @@ export const useProjectAccess = (projectId) => {
const canView = useHasUserPermission(VIEW_PROJECTS); const canView = useHasUserPermission(VIEW_PROJECTS);
const loading = isLoading || !isFetched; const loading = isLoading || !isFetched;
debugger
useEffect(() => { useEffect(() => {
if (projectId && !loading && !canView) { if (projectId && !loading && !canView) {
showToast("You don't have permission to view project details", "warning"); showToast("You don't have permission to view project details", "warning");

View File

@ -3,7 +3,7 @@ import { cacheData, getCachedData } from "../slices/apiDataManager";
import ProjectRepository from "../repositories/ProjectRepository"; import ProjectRepository from "../repositories/ProjectRepository";
import { useProfile } from "./useProfile"; import { useProfile } from "./useProfile";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { setProjectId } from "../slices/localVariablesSlice"; import { closeProjectModal, openProjectModal, setProjectId } from "../slices/localVariablesSlice";
import EmployeeList from "../components/Directory/EmployeeList"; import EmployeeList from "../components/Directory/EmployeeList";
import eventBus from "../services/eventBus"; import eventBus from "../services/eventBus";
import { import {
@ -18,6 +18,18 @@ export const useCurrentService = () => {
return useSelector((store) => store.globalVariables.selectedServiceId); return useSelector((store) => store.globalVariables.selectedServiceId);
}; };
export const useProjectModal = () => {
const dispatch = useDispatch();
const { isOpen, data } = useSelector((state) => state.localVariables.ProjectModal);
return {
isOpen,
data,
openModal: (payload = null) => dispatch(openProjectModal(payload)),
closeModal: () => dispatch(closeProjectModal()),
};
};
// ------------------------------Query------------------- // ------------------------------Query-------------------
export const useProjects = () => { export const useProjects = () => {

View File

@ -6,6 +6,7 @@ import { useDispatch } from "react-redux";
import { setCurrentTenant } from "../slices/globalVariablesSlice"; import { setCurrentTenant } from "../slices/globalVariablesSlice";
import { ITEMS_PER_PAGE } from "../utils/constants"; import { ITEMS_PER_PAGE } from "../utils/constants";
import moment from "moment"; import moment from "moment";
import { queryClient } from "../layouts/AuthLayout";
const cleanFilter = (filter) => { const cleanFilter = (filter) => {
const cleaned = { ...filter }; const cleaned = { ...filter };
@ -71,6 +72,7 @@ export const useSubscriptionPlan = (freq) => {
// ------------Mutation--------------------- // ------------Mutation---------------------
export const useCreateTenant = (onSuccessCallback) => { export const useCreateTenant = (onSuccessCallback) => {
const clinet = queryClient()
const dispatch = useDispatch(); const dispatch = useDispatch();
return useMutation({ return useMutation({
mutationFn: async (tenantPayload) => { mutationFn: async (tenantPayload) => {
@ -87,6 +89,9 @@ export const useCreateTenant = (onSuccessCallback) => {
operationMode = 2; // tenant exists but subscription not added yet operationMode = 2; // tenant exists but subscription not added yet
} }
clinet.invalidateQueries({queryKey:["Tenants"]})
dispatch(setCurrentTenant({ operationMode, data })); dispatch(setCurrentTenant({ operationMode, data }));
if (onSuccessCallback) onSuccessCallback(); if (onSuccessCallback) onSuccessCallback();

View File

@ -174,7 +174,7 @@ const AttendancePage = () => {
{/* Search + Organization filter */} {/* Search + Organization filter */}
<div className="col-12 col-md-auto mt-2 mt-md-0 ms-md-auto d-flex gap-2 align-items-center"> <div className="col-12 col-md-auto mt-2 mt-md-0 ms-md-auto d-flex gap-2 align-items-center">
{/* Organization Dropdown */} {/* Organization Dropdown */}
<select {/* <select
className="form-select form-select-sm" className="form-select form-select-sm"
style={{ minWidth: "180px" }} style={{ minWidth: "180px" }}
value={appliedFilters.selectedOrganization} value={appliedFilters.selectedOrganization}
@ -192,7 +192,7 @@ const AttendancePage = () => {
{org.name} {org.name}
</option> </option>
))} ))}
</select> </select> */}
{/* Search Input */} {/* Search Input */}
<input <input

View File

@ -9,18 +9,24 @@ import { defaultContactFilter } from "../../components/Directory/DirectorySchema
import { useDebounce } from "../../utils/appUtils"; import { useDebounce } from "../../utils/appUtils";
import Pagination from "../../components/common/Pagination"; import Pagination from "../../components/common/Pagination";
import ListViewContact from "../../components/Directory/ListViewContact"; import ListViewContact from "../../components/Directory/ListViewContact";
import { CardViewContactSkeleton, ListViewContactSkeleton } from "../../components/Directory/DirectoryPageSkeleton"; import {
CardViewContactSkeleton,
ListViewContactSkeleton,
} from "../../components/Directory/DirectoryPageSkeleton";
import Loader from "../../components/common/Loader";
// Utility function to format contacts for CSV export // Utility function to format contacts for CSV export
const formatExportData = (contacts) => { const formatExportData = (contacts) => {
return contacts.map(contact => ({ return contacts.map((contact) => ({
Email: contact.contactEmails?.map(e => e.emailAddress).join(", ") || "", Email: contact.contactEmails?.map((e) => e.emailAddress).join(", ") || "",
Phone: contact.contactPhones?.map(p => p.phoneNumber).join(", ") || "", Phone: contact.contactPhones?.map((p) => p.phoneNumber).join(", ") || "",
Created: contact.createdAt ? new Date(contact.createdAt).toLocaleString() : "", Created: contact.createdAt
? new Date(contact.createdAt).toLocaleString()
: "",
Location: contact.address || "", Location: contact.address || "",
Organization: contact.organization || "", Organization: contact.organization || "",
Category: contact.contactCategory?.name || "", Category: contact.contactCategory?.name || "",
Tags: contact.tags?.map(t => t.name).join(", ") || "", Tags: contact.tags?.map((t) => t.name).join(", ") || "",
Buckets: contact.bucketIds?.join(", ") || "", Buckets: contact.bucketIds?.join(", ") || "",
})); }));
}; };
@ -75,8 +81,21 @@ const ContactsPage = ({ projectId, searchText, onExport }) => {
<div className="row mt-5"> <div className="row mt-5">
{gridView ? ( {gridView ? (
<> <>
{isLoading && (
<div>
<Loader />
</div>
)}
{data?.data?.length === 0 && (<div className="py-12 ">
{searchText ? `No contact found for "${searchText}"`:"No contacts found" }
</div>)}
{data?.data?.map((contact) => ( {data?.data?.map((contact) => (
<div key={contact.id} className="col-12 col-sm-6 col-md-4 col-lg-4 mb-4"> <div
key={contact.id}
className="col-12 col-sm-6 col-md-4 col-lg-4 mb-4"
>
<CardViewContact IsActive={showActive} contact={contact} /> <CardViewContact IsActive={showActive} contact={contact} />
</div> </div>
))} ))}
@ -95,6 +114,7 @@ const ContactsPage = ({ projectId, searchText, onExport }) => {
<div className="col-12"> <div className="col-12">
<ListViewContact <ListViewContact
data={data?.data} data={data?.data}
isLoading={isLoading}
Pagination={ Pagination={
<Pagination <Pagination
currentPage={currentPage} currentPage={currentPage}

View File

@ -44,7 +44,7 @@ export default function DirectoryPage({ IsPage = true, projectId = null }) {
const [searchNote, setSearchNote] = useState(""); const [searchNote, setSearchNote] = useState("");
const [activeTab, setActiveTab] = useState("notes"); const [activeTab, setActiveTab] = useState("notes");
const { setActions } = useFab(); const { setActions } = useFab();
const [gridView, setGridView] = useState(false); const [gridView, setGridView] = useState(true);
const [isOpenBucket, setOpenBucket] = useState(false); const [isOpenBucket, setOpenBucket] = useState(false);
const [isManageContact, setManageContact] = useState({ const [isManageContact, setManageContact] = useState({
isOpen: false, isOpen: false,
@ -133,7 +133,7 @@ export default function DirectoryPage({ IsPage = true, projectId = null }) {
]} ]}
></Breadcrumb> ></Breadcrumb>
)} )}
<div className="card"> <div className="card ">
<div className="d-flex-row px-2"> <div className="d-flex-row px-2">
<div className="d-flex justify-content-between align-items-center mb-1"> <div className="d-flex justify-content-between align-items-center mb-1">
<ul className="nav nav-tabs"> <ul className="nav nav-tabs">
@ -185,14 +185,7 @@ export default function DirectoryPage({ IsPage = true, projectId = null }) {
value={searchContact} value={searchContact}
onChange={(e) => setsearchContact(e.target.value)} onChange={(e) => setsearchContact(e.target.value)}
/> />
<button
className={`btn btn-sm p-1 ${
!gridView ? "btn-primary" : "btn-outline-primary"
}`}
onClick={() => setGridView(false)}
>
<i className="bx bx-list-ul"></i>
</button>
<button <button
className={`btn btn-sm p-1 ${ className={`btn btn-sm p-1 ${
@ -202,9 +195,18 @@ export default function DirectoryPage({ IsPage = true, projectId = null }) {
> >
<i className="bx bx-grid-alt"></i> <i className="bx bx-grid-alt"></i>
</button> </button>
<button
className={`btn btn-sm p-1 ${
!gridView ? "btn-primary" : "btn-outline-primary"
}`}
onClick={() => setGridView(false)}
>
<i className="bx bx-list-ul"></i>
</button>
</div> </div>
<div className="form-check form-switch d-flex align-items-center"> <div className="form-check form-switch d-flex align-items-center m-0">
<input <input
type="checkbox" type="checkbox"
className="form-check-input" className="form-check-input"

View File

@ -60,12 +60,12 @@ const NoteFilterPanel = ({ onApply, clearFilter }) => {
<div className="d-flex justify-content-end py-3 gap-2"> <div className="d-flex justify-content-end py-3 gap-2">
<button <button
type="button" type="button"
className="btn btn-label-secondary btn-xs" className="btn btn-label-secondary btn-sm"
onClick={handleClose} onClick={handleClose}
> >
Clear Clear
</button> </button>
<button type="submit" className="btn btn-primary btn-xs"> <button type="submit" className="btn btn-primary btn-sm">
Apply Apply
</button> </button>
</div> </div>

View File

@ -129,6 +129,7 @@ const ExpensePage = () => {
</div> </div>
<div className="col-6 text-end mt-2 mt-sm-0"> <div className="col-6 text-end mt-2 mt-sm-0">
{IsCreatedAble && ( {IsCreatedAble && (
<button <button
className="btn btn-sm btn-primary" className="btn btn-sm btn-primary"

View File

@ -1,656 +1,265 @@
/* Custom Styles */
.custom-navbar {
background: #efefef;
transition: all 0.3s ease;
padding: 1rem 0;
}
.carousel-item {
height: 100vh;
min-height: 500px;
background-size: cover;
background-position: center;
position: relative;
}
.carousel-caption {
bottom: 20%;
}
.hero-overlay {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.4);
}
.feature-icon {
font-size: 40px;
color: #4fc143;
}
.text-primary {
color: #49bf3c !important;
}
.text-blue {
color: #696cff !important;
}
.btn-primary {
background-color: #49bf3c !important;
}
body {
font-family: "Segoe UI", Roboto, sans-serif;
background-color: #ffff;
}
.hero {
background: linear-gradient(135deg, #4fc143, #007bff);
color: white;
padding: 100px 0;
}
.pricing-card {
transition: transform 0.2s, box-shadow 0.2s;
}
.pricing-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.feature-icon-image {
width: 50px;
}
.accordion {
--bs-accordion-box-shadow: 0 0.125rem 0.375rem 0 rgba(34, 48, 62, 0.08);
--bs-accordion-active-box-shadow: 0 0.1875rem 0.5rem 0 rgba(34, 48, 62, 0.1);
--bs-accordion-active-bg: #fff;
--bs-accordion-btn-active-bg: #fff;
--bs-accordion-btn-focus-box-shadow: none;
--bs-accordion-btn-focus-shadow-width: 0;
--bs-accordion-color: #646e78;
--bs-accordion-bg: #fff;
--bs-accordion-transition: all 0.2s ease-in-out, border-radius 0.15s ease;
--bs-accordion-border-color: #fff;
--bs-accordion-border-width: 1px;
--bs-accordion-border-radius: 0.375rem;
--bs-accordion-inner-border-radius: 0.375rem;
--bs-accordion-btn-padding-x: 1.4375rem;
--bs-accordion-btn-padding-y: 0.7305rem;
--bs-accordion-btn-color: #384551;
--bs-accordion-btn-bg: #fff;
--bs-accordion-btn-icon: url(
data:image/svg + xml,
%3csvgwidth="20"height="20"viewBox="0 0 20 20"fill="none"xmlns="http://www.w3.org/2000/svg"%3e%3cgid="bx-chevron-down"%3e%3cpathid="Vector"d="M13.5775 7.74417L9.99997 11.3217L6.42247 7.74417L5.24414 8.9225L9.99997 13.6783L14.7558 8.9225L13.5775 7.74417Z"fill="%23384551"fill-opacity="0.9"/%3e%3c/g%3e%3c/svg%3e
);
--bs-accordion-btn-icon-width: 1.25rem;
--bs-accordion-btn-icon-transform: rotate(-180deg);
--bs-accordion-btn-icon-transition: transform 0.2s ease-in-out;
--bs-accordion-btn-active-icon: url(
data:image/svg + xml,
%3csvgwidth="20"height="20"viewBox="0 0 20 20"fill="none"xmlns="http://www.w3.org/2000/svg"%3e%3cgid="bx-chevron-down"%3e%3cpathid="Vector"d="M13.5775 7.74417L9.99997 11.3217L6.42247 7.74417L5.24414 8.9225L9.99997 13.6783L14.7558 8.9225L13.5775 7.74417Z"fill="%23384551"fill-opacity="0.9"/%3e%3c/g%3e%3c/svg%3e
);
--bs-accordion-btn-focus-box-shadow: none;
--bs-accordion-body-padding-x: 1.1875rem;
--bs-accordion-body-padding-y: 1.1875rem;
--bs-accordion-active-color: #384551;
--bs-accordion-active-bg: #fff;
}
.accordion-header {
line-height: 1.375;
margin-bottom: 0;
position: relative;
border-bottom: none;
}
.accordion-item {
color: #646e78;
background-color: #fff;
border: 1px solid #fff;
}
.accordion-item:first-of-type {
border-top-left-radius: 0.375rem;
border-top-right-radius: 0.375rem;
}
.accordion:not(.accordion-custom-button):not(.accordion-arrow-left)
.accordion-item:not(:last-of-type) {
margin-block-end: 0.5rem;
}
.accordion-button {
position: relative;
display: flex;
align-items: center;
width: 100%;
padding: var(--bs-accordion-btn-padding-y) var(--bs-accordion-btn-padding-x);
font-size: 1rem;
font-weight: 400;
color: var(--bs-accordion-btn-color);
text-align: left;
background-color: var(--bs-accordion-btn-bg);
border: 0;
border-radius: 0;
overflow-anchor: none;
transition: var(--bs-accordion-transition);
}
.accordion-button:not(.collapsed) {
color: var(--bs-accordion-active-color);
background-color: var(--bs-accordion-active-bg);
box-shadow: inset 0 calc(-1 * var(--bs-accordion-border-width)) 0
var(--bs-accordion-border-color);
}
.section-py { .section-py {
padding: 6.25rem 0; padding: 6.25rem 0;
min-height: 100vh !important;
} }
.section-py .heading { .btn-primary {
font-size: 1.625rem; --bs-btn-color: #fff;
} --bs-btn-bg: #4fc143;
@media (max-width: 1199.98px) { --bs-btn-border-color: #4fc143;
.section-py { --bs-btn-hover-color: #fff;
padding: 4rem 0; --bs-btn-hover-bg: #0b5ed7;
} --bs-btn-hover-border-color: #0a58ca;
} --bs-btn-focus-shadow-rgb: 49, 132, 253;
@media (max-width: 767.98px) { --bs-btn-active-color: #fff;
.section-py { --bs-btn-active-bg: #0a58ca;
padding: 3rem 0; --bs-btn-active-border-color: #0a53be;
} --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
--bs-btn-disabled-color: #fff;
--bs-btn-disabled-bg: #4fc143;
--bs-btn-disabled-border-color: #4fc143;
} }
.first-section-pt { /* https://codingyaar.com/bootstrap-card-hover-effect-3-background-color-change/# */
padding-top: 11.28rem; .card-slider {
} border: 0;
@media (max-width: 1199.98px) { border-radius: 0;
.first-section-pt { /* color: #fff; */
padding-top: 7.5rem; box-shadow: 5px 5px 10px #e1e1e1;
} padding: 3em 0;
/* border-bottom-right-radius: 4em;
border-top-left-radius: 4em; */
background: linear-gradient(
to left,
rgba(var(--bs-light-rgb), var(--bs-bg-opacity)) 50%,
#4fc143 50%
);
background-size: 200%;
background-position: right;
transition: background-position 0.5s ease-out;
} }
.card[class*="card-hover-border-"] { .card-slider:hover {
transition: all 0.2s ease-in-out; background-position: left;
transform: translateY(-5px);
} }
.banner-bg-img { .scroll-top.active {
position: absolute; visibility: visible;
top: 0;
left: 0;
height: 100%;
width: 100%;
object-fit: cover;
object-position: left;
}
.section-title-img {
height: 100%;
width: 120%;
inset-inline-start: -12%;
top: 10px;
}
/* .light-style body {
background-color: #fff;
} */
.dark-style body {
background-color: #2b2c40;
}
nav.layout-navbar {
/* backdrop-filter: unset; */
/* background-color: transparent !important; */
/* background-color: rgba(214, 36, 33, 0.88) !important; */
}
nav.layout-navbar::before {
position: absolute;
display: block;
block-size: 100%;
content: "";
inline-size: 100%;
inset-block-start: 0;
inset-inline-start: 0;
}
nav.layout-navbar .navbar.landing-navbar {
--bs-front-navbar-bg: rgba(var(--bs-paper-bg-rgb), 0.38);
--bs-front-navbar-border-color: rgba(var(--bs-paper-bg-rgb), 0.68);
border: 2px solid var(--bs-front-navbar-border-color);
background-color: var(--bs-front-navbar-bg);
margin-block-start: 1rem;
padding-block: 0.614rem;
transform: unset;
transition: all 0.2s ease-in-out;
border-radius: 0.375rem;
}
nav.layout-navbar.navbar-active::after {
backdrop-filter: saturate(100%) blur(6px);
-webkit-backdrop-filter: saturate(100%) blur(6px);
}
.navbar.landing-navbar {
box-shadow: none;
transition: all 0.2s ease-in-out;
transform: unset !important;
padding-top: 0.614rem;
padding-bottom: 0.614rem;
margin-top: 1rem;
border-width: 2px;
border-style: solid;
border-radius: 0.375rem;
}
.navbar.landing-navbar .navbar-nav .nav-link {
padding: 0.5rem 0.625rem;
margin-inline-end: 0.625rem;
}
@media (max-width: 1199.98px) {
.navbar.landing-navbar .navbar-nav .nav-link {
padding-left: 0.5rem;
padding-right: 0.5rem;
margin-inline-end: 0;
}
}
.navbar.landing-navbar .navbar-nav .nav-item:last-child .nav-link {
margin-inline-end: 0;
}
@media (min-width: 992px) {
.navbar.landing-navbar .navbar-nav .nav-item.mega-dropdown > .dropdown-menu {
max-width: 1300px;
inset-inline-start: 50% !important;
transform: translateX(-50%);
top: 100%;
}
}
@media (max-width: 991.98px) {
.navbar.landing-navbar .navbar-nav .nav-item.mega-dropdown > .dropdown-menu {
background: transparent;
box-shadow: none;
border: none;
}
}
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu
.mega-dropdown-link {
padding-left: 0;
padding-right: 0;
margin: 0;
font-weight: 400;
}
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu
.mega-dropdown-link
i {
font-size: 1rem;
font-weight: 700;
margin-top: -0.125rem;
}
.navbar.landing-navbar .navbar-nav .nav-item .nav-img-col,
.navbar.landing-navbar .navbar-nav .nav-item .nav-img-col img {
border-radius: 0.625rem;
}
@media (max-width: 991.98px) {
.navbar.landing-navbar .landing-menu-overlay {
position: fixed;
display: none;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(34, 48, 62, 0.78);
transition: all 0.2s ease-in-out;
z-index: 9998;
}
.navbar.landing-navbar .landing-nav-menu {
position: fixed;
display: block !important;
height: 100%;
max-width: 300px;
width: 80%;
padding: 1rem;
inset-inline-start: -100%;
top: 0;
overflow-y: auto;
transition: all 0.3s ease-in-out;
z-index: 9999;
}
.navbar.landing-navbar .landing-nav-menu.show {
inset-inline-start: 0;
}
.navbar.landing-navbar .landing-nav-menu.show ~ .landing-menu-overlay {
display: block;
}
}
.light-style .layout-navbar .navbar.landing-navbar {
border-color: rgba(255, 255, 255, 100);
background: rgba(255, 255, 255, 50);
}
.light-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link {
color: #384551;
}
.light-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.show
> .nav-link,
.light-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.active
> .nav-link,
.light-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link.show,
.light-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.nav-link.active {
color: #696cff !important;
}
.light-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu
.mega-dropdown-link
i {
color: #646e78;
}
@media (max-width: 991.98px) {
.light-style .layout-navbar .navbar.landing-navbar .landing-nav-menu {
background-color: #fff;
}
}
.light-style .layout-navbar.navbar-active .navbar.landing-navbar {
background: #fff;
box-shadow: 0 0.125rem 0.375rem 0 rgba(34, 48, 62, 0.08);
}
.light-style .layout-navbar .menu-text {
color: #384551;
}
.dark-style .layout-navbar .navbar.landing-navbar {
border-color: rgba(65, 65, 95, 0.68);
background-color: rgba(65, 65, 95, 0.38);
}
.dark-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link {
color: #d5d5e2;
}
.dark-style .layout-navbar .navbar.landing-navbar .navbar-nav .show > .nav-link,
.dark-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.active
> .nav-link,
.dark-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link.show,
.dark-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link.active {
color: #696cff !important;
}
.dark-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu
.mega-dropdown-link
i {
color: #b2b2c4;
}
@media (max-width: 991.98px) {
.dark-style .layout-navbar .navbar.landing-navbar .landing-nav-menu {
background-color: #2b2c40;
}
}
.dark-style .layout-navbar .navbar .menu-text {
color: #d5d5e2;
}
.dark-style .layout-navbar.navbar-active .navbar.landing-navbar {
background: #2b2c40;
border-color: #2b2c40;
box-shadow: 0 0.125rem 0.375rem 0 rgba(20, 20, 29, 0.2);
}
@media (min-width: 992px) {
[dir="rtl"]
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu {
transform: translateX(50%);
}
}
.landing-footer .footer-link,
.landing-footer .footer-text {
color: #fff;
opacity: 0.78;
}
.landing-footer .footer-title {
color: #fff;
opacity: 0.92;
}
.landing-footer .footer-bottom-text {
color: #d3d4dc;
}
.landing-footer .footer-bottom {
background-color: #f44336;
}
.landing-footer .footer-link {
transition: all 0.2s ease-in-out;
}
.landing-footer .footer-link:hover {
opacity: 1; opacity: 1;
} }
.landing-footer .footer-top {
padding-top: 1.3rem; .scroll-top {
padding-bottom: 1.3rem; position: fixed;
border-top-left-radius: 1.75rem; visibility: hidden;
border-top-right-radius: 1.75rem; opacity: 0;
background-color: #f44336; right: 15px;
bottom: 15px;
z-index: 99999;
background-color: #4fc143;
width: 40px;
height: 40px;
border-radius: 25px;
transition: all 0.4s;
border: 2px solid color-mix(in srgb, #0a53be, transparent 10%);
} }
@media (max-width: 767.98px) {
.landing-footer .footer-top { .contact-section {
padding: 3rem 0; background: #fff;
} border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
padding: 40px 40px;
margin: 60px auto;
max-width: 1100px;
} }
.landing-footer .footer-top .footer-bg {
object-position: center; .contact-img img {
width: 100%;
border-radius: 15px;
} }
@media (min-width: 992px) {
.landing-footer .footer-logo-description { .contact-text h2 {
max-width: 385px; font-size: 2.5rem;
} font-weight: 700;
color: #173b5f;
} }
.landing-footer .footer-form {
max-width: 22.25rem; .contact-text p {
font-size: 1rem;
color: #6c757d;
margin-top: 15px;
margin-bottom: 25px;
} }
.landing-footer .footer-form input {
background-color: transparent; .btn-green {
border-color: #4e4f6c; background-color: #49bf3c;
color: #fff;
border-radius: 50px;
padding: 10px 30px;
font-weight: 500;
text-decoration: none;
transition: all 0.3s ease;
}
.btn-square-small {
border-radius: 3px;
padding-bottom: 5.072px;
padding-inline-end: 12px;
padding-inline-start: 12px;
padding-left: 12px;
padding-right: 12px;
padding-top: 5.072px;
}
.btn-green:hover {
background-color: #00a85a;
color: #fff; color: #fff;
} }
.landing-footer .footer-form input:hover:not([disabled]):not([focus]) {
border-color: #4e4f6c;
}
.landing-footer .footer-form input::placeholder {
color: rgba(255, 255, 255, 0.5);
}
.landing-footer .footer-form label {
color: #d5d5e2;
}
.section-py {
padding: 6.25rem 0;
}
@media (max-width: 1199.98px) {
.section-py {
padding: 5rem 0;
}
}
@media (max-width: 767.98px) {
.section-py {
padding: 3rem 0;
}
}
.landing-hero {
border-radius: 0 0 3.5rem 3.5rem;
padding-top: 8.2rem;
}
.landing-hero::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
@media (min-width: 992px) {
.landing-hero .hero-text-box {
/* max-width: 34.375rem; */
max-width: 70%;
margin: 0 auto;
}
}
.landing-hero .hero-title {
background: linear-gradient(
to right,
#28c76f 0%,
#5a4aff 47.92%,
#ff3739 100%
);
background-size: 200% auto;
color: #384551;
font-size: calc(1.3875rem + 1.65vw);
background-clip: text;
line-height: 1.2;
text-fill-color: transparent;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: shine 2s ease-in-out infinite alternate;
}
@media (min-width: 1200px) {
.landing-hero .hero-title {
font-size: 2.625rem;
}
}
.landing-hero .landing-hero-btn .hero-btn-item {
inset-inline-start: -94%;
top: 65%;
}
.landing-hero .hero-animation-img {
margin-bottom: -32rem;
}
.animation-img {
border: 1px soid red;
}
@media (max-width: 1199.98px) {
.landing-hero .hero-animation-img {
margin-bottom: -20rem;
}
}
@media (max-width: 575.98px) {
.landing-hero .hero-animation-img {
margin-bottom: -10rem;
}
}
.landing-hero .hero-animation-img .hero-dashboard-img {
width: 80%;
margin: 0 auto;
will-change: transform;
transform-style: preserve-3d;
transition: all 0.1s;
}
.landing-hero .hero-animation-img .hero-dashboard-img img {
width: 100%;
}
.landing-hero-blank {
padding-top: 26rem;
}
@media (max-width: 1199.98px) {
.landing-hero-blank {
padding-top: 15rem;
}
}
@media (max-width: 575.98px) {
.landing-hero-blank {
padding-top: 7rem;
}
}
@keyframes shine {
0% {
background-position: 0% 50%;
}
80% {
background-position: 50% 90%;
}
100% {
background-position: 91% 100%;
}
}
.landing-features
.features-icon-wrapper
.features-icon-box
.features-icon-description {
max-width: 19.25rem;
margin: 0 auto;
}
.landing-reviews {
border-top-left-radius: 3.75rem;
border-top-right-radius: 3.75rem;
}
.landing-reviews .swiper-reviews-carousel .swiper-button-prev,
.landing-reviews .swiper-reviews-carousel .swiper-button-next {
display: none;
}
.landing-reviews .swiper-reviews-carousel .swiper-slide {
height: auto;
padding: 0.8125rem;
}
.landing-reviews .swiper-reviews-carousel .client-logo {
height: 1.375rem;
object-fit: contain;
}
.landing-reviews .swiper-logo-carousel {
padding-bottom: 6.25rem;
}
.landing-reviews .swiper-logo-carousel .swiper {
max-width: 45rem;
}
.landing-reviews .swiper-logo-carousel .swiper .swiper-slide {
display: flex;
justify-content: center;
}
.landing-reviews .swiper-logo-carousel .swiper .client-logo {
max-height: 2.5rem;
max-width: 95%;
object-fit: contain;
}
.landing-team .card,
.landing-team .card .team-image-box {
border-top-left-radius: 5.625rem;
border-top-right-radius: 1.25rem;
}
.landing-team .card .card-body {
border-bottom-left-radius: 0.375rem;
border-bottom-right-radius: 0.375rem;
}
.landing-team .team-image-box {
height: 11.5625rem;
}
.landing-team .team-image-box .card-img-position {
height: 15rem;
transform: translateX(-50%);
max-width: 100%;
object-fit: cover;
}
@media (max-width: 991.98px) {
.landing-team .team-image-box .card-img-position {
height: 13rem;
}
}
@media (max-width: 575.98px) {
.landing-team .team-image-box {
height: 11rem;
}
}
.landing-team .card .team-media-icons i {
transition: all 0.2s ease-in-out;
}
.landing-pricing {
border-radius: 3.75rem;
}
.landing-pricing .pricing-plans-item {
inset-inline-end: -56%;
bottom: -0.5rem;
}
@media (max-width: 767.98px) {
.landing-pricing .pricing-plans-item {
inset-inline-end: 0;
bottom: 1rem;
}
}
.landing-pricing .pricing-list .badge.badge-center {
width: 1rem;
height: 1rem;
}
.landing-pricing .pricing-list .badge.badge-center i {
margin-top: -5px;
}
.landing-pricing .price-yearly-toggle {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
}
.landing-pricing .card .card-header,
.landing-pricing .card .card-body {
padding: 2rem;
padding-top: 3rem;
}
.landing-faq {
border-top-left-radius: 3.75rem;
border-top-right-radius: 3.75rem;
}
.landing-faq .faq-image {
max-width: 20rem;
width: 80%;
}
.landing-cta .cta-title {
font-size: 2.125rem;
}
@media (max-width: 767.98px) {
.landing-cta .cta-title {
font-size: 1.8rem;
}
}
.landing-contact .text-heading {
overflow-wrap: anywhere;
}
.landing-contact .contact-img-box,
.landing-contact .contact-img-box .contact-img {
border-radius: 3.75rem 0.375rem 0.375rem 0.375rem;
}
.landing-contact .contact-img-box .contact-border-img {
inset-block-start: -2.5rem;
inset-inline-start: -2.8125rem;
}
.light-style .landing-hero {
background: linear-gradient(138.18deg, #eae8fd 0%, #fce5e6 94.44%);
}
.light-style .landing-hero::after {
background-color: #fff;
}
.dark-style .landing-hero {
background: #1e2130;
}
.dark-style .landing-hero::after {
background-color: #2b2c40;
}
[dir="rtl"] .landing-reviews-btns {
display: flex;
justify-content: flex-end;
flex-direction: row-reverse;
gap: 1rem;
}
[dir="rtl"] .landing-team .team-image-box .card-img-position {
transform: translateX(50%) !important;
}
[dir="rtl"] .landing-pricing .switch .switch-label {
padding-right: 0;
}
[dir="rtl"] .landing-pricing .switch .switch-label:first-child {
padding-left: 0.5rem;
}
[dir="rtl"] .landing-pricing .switch .switch-input ~ .switch-label {
padding-right: 3rem;
}
[dir="rtl"] .landing-contact .contact-img-box {
border-radius: 0.375rem 3.75rem 0.375rem 0.375rem;
}
[dir="rtl"] .landing-contact .contact-img-box::before {
inset-block-start: -1.875rem;
inset-inline-start: -3.125rem;
transform: rotate(90deg);
}
.swiper {
width: 100%;
height: 100%;
border-radius: 10px;
}
.swiper-slide {
text-align: center;
font-size: 18px;
/* Center slide text vertically */
display: flex;
justify-content: center;
align-items: center;
}
.swiper-slide img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,660 @@
:root,
[data-bs-theme="light"] {
--bs-body-font-size: 0.9375rem;
}
.section-py {
padding: 6.25rem 0;
}
.section-py .heading {
font-size: 1.625rem;
}
@media (max-width: 1199.98px) {
.section-py {
padding: 4rem 0;
}
}
@media (max-width: 767.98px) {
.section-py {
padding: 3rem 0;
}
}
.first-section-pt {
padding-top: 11.28rem;
}
@media (max-width: 1199.98px) {
.first-section-pt {
padding-top: 7.5rem;
}
}
.card[class*="card-hover-border-"] {
transition: all 0.2s ease-in-out;
}
.banner-bg-img {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
object-fit: cover;
object-position: left;
}
.section-title-img {
height: 100%;
width: 120%;
inset-inline-start: -12%;
top: 10px;
}
/* .light-style body {
background-color: #fff;
} */
.dark-style body {
background-color: #2b2c40;
}
nav.layout-navbar {
/* backdrop-filter: unset; */
/* background-color: transparent !important; */
/* background-color: rgba(214, 36, 33, 0.88) !important; */
}
nav.layout-navbar::before {
position: absolute;
display: block;
block-size: 100%;
content: "";
inline-size: 100%;
inset-block-start: 0;
inset-inline-start: 0;
}
nav.layout-navbar .navbar.landing-navbar {
--bs-front-navbar-bg: rgba(var(--bs-paper-bg-rgb), 0.38);
--bs-front-navbar-border-color: rgba(var(--bs-paper-bg-rgb), 0.68);
border: 2px solid var(--bs-front-navbar-border-color);
background-color: var(--bs-front-navbar-bg);
margin-block-start: 1rem;
padding-block: 0.614rem;
transform: unset;
transition: all 0.2s ease-in-out;
border-radius: 0.375rem;
}
nav.layout-navbar.navbar-active::after {
backdrop-filter: saturate(100%) blur(6px);
-webkit-backdrop-filter: saturate(100%) blur(6px);
}
.navbar.landing-navbar {
box-shadow: none;
transition: all 0.2s ease-in-out;
transform: unset !important;
padding-top: 0.614rem;
padding-bottom: 0.614rem;
margin-top: 1rem;
border-width: 2px;
border-style: solid;
border-radius: 0.375rem;
}
.navbar.landing-navbar .navbar-nav .nav-link {
padding: 0.5rem 0.625rem;
margin-inline-end: 0.625rem;
}
@media (max-width: 1199.98px) {
.navbar.landing-navbar .navbar-nav .nav-link {
padding-left: 0.5rem;
padding-right: 0.5rem;
margin-inline-end: 0;
}
}
.navbar.landing-navbar .navbar-nav .nav-item:last-child .nav-link {
margin-inline-end: 0;
}
@media (min-width: 992px) {
.navbar.landing-navbar .navbar-nav .nav-item.mega-dropdown > .dropdown-menu {
max-width: 1300px;
inset-inline-start: 50% !important;
transform: translateX(-50%);
top: 100%;
}
}
@media (max-width: 991.98px) {
.navbar.landing-navbar .navbar-nav .nav-item.mega-dropdown > .dropdown-menu {
background: transparent;
box-shadow: none;
border: none;
}
}
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu
.mega-dropdown-link {
padding-left: 0;
padding-right: 0;
margin: 0;
font-weight: 400;
}
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu
.mega-dropdown-link
i {
font-size: 1rem;
font-weight: 700;
margin-top: -0.125rem;
}
.navbar.landing-navbar .navbar-nav .nav-item .nav-img-col,
.navbar.landing-navbar .navbar-nav .nav-item .nav-img-col img {
border-radius: 0.625rem;
}
@media (max-width: 991.98px) {
.navbar.landing-navbar .landing-menu-overlay {
position: fixed;
display: none;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(34, 48, 62, 0.78);
transition: all 0.2s ease-in-out;
z-index: 9998;
}
.navbar.landing-navbar .landing-nav-menu {
position: fixed;
display: block !important;
height: 100%;
max-width: 300px;
width: 80%;
padding: 1rem;
inset-inline-start: -100%;
top: 0;
overflow-y: auto;
transition: all 0.3s ease-in-out;
z-index: 9999;
}
.navbar.landing-navbar .landing-nav-menu.show {
inset-inline-start: 0;
}
.navbar.landing-navbar .landing-nav-menu.show ~ .landing-menu-overlay {
display: block;
}
}
.light-style .layout-navbar .navbar.landing-navbar {
border-color: rgba(255, 255, 255, 100);
background: rgba(255, 255, 255, 50);
}
.light-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link {
color: #384551;
}
.light-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.show
> .nav-link,
.light-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.active
> .nav-link,
.light-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link.show,
.light-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.nav-link.active {
color: #696cff !important;
}
.light-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu
.mega-dropdown-link
i {
color: #646e78;
}
@media (max-width: 991.98px) {
.light-style .layout-navbar .navbar.landing-navbar .landing-nav-menu {
background-color: #fff;
}
}
.light-style .layout-navbar.navbar-active .navbar.landing-navbar {
background: #fff;
box-shadow: 0 0.125rem 0.375rem 0 rgba(34, 48, 62, 0.08);
}
.light-style .layout-navbar .menu-text {
color: #384551;
}
.dark-style .layout-navbar .navbar.landing-navbar {
border-color: rgba(65, 65, 95, 0.68);
background-color: rgba(65, 65, 95, 0.38);
}
.dark-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link {
color: #d5d5e2;
}
.dark-style .layout-navbar .navbar.landing-navbar .navbar-nav .show > .nav-link,
.dark-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.active
> .nav-link,
.dark-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link.show,
.dark-style .layout-navbar .navbar.landing-navbar .navbar-nav .nav-link.active {
color: #696cff !important;
}
.dark-style
.layout-navbar
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu
.mega-dropdown-link
i {
color: #b2b2c4;
}
@media (max-width: 991.98px) {
.dark-style .layout-navbar .navbar.landing-navbar .landing-nav-menu {
background-color: #2b2c40;
}
}
.dark-style .layout-navbar .navbar .menu-text {
color: #d5d5e2;
}
.dark-style .layout-navbar.navbar-active .navbar.landing-navbar {
background: #2b2c40;
border-color: #2b2c40;
box-shadow: 0 0.125rem 0.375rem 0 rgba(20, 20, 29, 0.2);
}
@media (min-width: 992px) {
[dir="rtl"]
.navbar.landing-navbar
.navbar-nav
.nav-item.mega-dropdown
> .dropdown-menu {
transform: translateX(50%);
}
}
.landing-footer .footer-link,
.landing-footer .footer-text {
color: #fff;
opacity: 0.78;
}
.landing-footer .footer-title {
color: #fff;
opacity: 0.92;
}
.landing-footer .footer-bottom-text {
color: #d3d4dc;
}
.landing-footer .footer-bottom {
background-color: var(--bs-primary);
}
.landing-footer .footer-link {
transition: all 0.2s ease-in-out;
}
.landing-footer .footer-link:hover {
opacity: 1;
}
.landing-footer .footer-top {
padding-top: 1.3rem;
padding-bottom: 1.3rem;
border-top-left-radius: 1.75rem;
border-top-right-radius: 1.75rem;
background-color: #f44336;
}
@media (max-width: 767.98px) {
.landing-footer .footer-top {
padding: 3rem 0;
}
}
.landing-footer .footer-top .footer-bg {
object-position: center;
}
@media (min-width: 992px) {
.landing-footer .footer-logo-description {
max-width: 385px;
}
}
.landing-footer .footer-form {
max-width: 22.25rem;
}
.landing-footer .footer-form input {
background-color: transparent;
border-color: #4e4f6c;
color: #fff;
}
.landing-footer .footer-form input:hover:not([disabled]):not([focus]) {
border-color: #4e4f6c;
}
.landing-footer .footer-form input::placeholder {
color: rgba(255, 255, 255, 0.5);
}
.landing-footer .footer-form label {
color: #d5d5e2;
}
.section-py {
padding: 6.25rem 0;
}
@media (max-width: 1199.98px) {
.section-py {
padding: 5rem 0;
}
}
@media (max-width: 767.98px) {
.section-py {
padding: 3rem 0;
}
}
.landing-hero {
border-radius: 0 0 3.5rem 3.5rem;
padding-top: 8.2rem;
}
.landing-hero::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
@media (min-width: 992px) {
.landing-hero .hero-text-box {
/* max-width: 34.375rem; */
max-width: 70%;
margin: 0 auto;
}
}
.landing-hero .hero-title {
background: linear-gradient(
to right,
#28c76f 0%,
#5a4aff 47.92%,
#ff3739 100%
);
background-size: 200% auto;
color: #384551;
font-size: calc(1.3875rem + 1.65vw);
background-clip: text;
line-height: 1.2;
text-fill-color: transparent;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: shine 2s ease-in-out infinite alternate;
}
@media (min-width: 1200px) {
.landing-hero .hero-title {
font-size: 2.625rem;
}
}
.landing-hero .landing-hero-btn .hero-btn-item {
inset-inline-start: -94%;
top: 65%;
}
.landing-hero .hero-animation-img {
margin-bottom: -32rem;
}
.animation-img {
border: 1px soid red;
}
@media (max-width: 1199.98px) {
.landing-hero .hero-animation-img {
margin-bottom: -20rem;
}
}
@media (max-width: 575.98px) {
.landing-hero .hero-animation-img {
margin-bottom: -10rem;
}
}
.landing-hero .hero-animation-img .hero-dashboard-img {
width: 80%;
margin: 0 auto;
will-change: transform;
transform-style: preserve-3d;
transition: all 0.1s;
}
.landing-hero .hero-animation-img .hero-dashboard-img img {
width: 100%;
}
.landing-hero-blank {
padding-top: 26rem;
}
@media (max-width: 1199.98px) {
.landing-hero-blank {
padding-top: 15rem;
}
}
@media (max-width: 575.98px) {
.landing-hero-blank {
padding-top: 7rem;
}
}
@keyframes shine {
0% {
background-position: 0% 50%;
}
80% {
background-position: 50% 90%;
}
100% {
background-position: 91% 100%;
}
}
.landing-features
.features-icon-wrapper
.features-icon-box
.features-icon-description {
max-width: 19.25rem;
margin: 0 auto;
}
.landing-reviews {
border-top-left-radius: 3.75rem;
border-top-right-radius: 3.75rem;
}
.landing-reviews .swiper-reviews-carousel .swiper-button-prev,
.landing-reviews .swiper-reviews-carousel .swiper-button-next {
display: none;
}
.landing-reviews .swiper-reviews-carousel .swiper-slide {
height: auto;
padding: 0.8125rem;
}
.landing-reviews .swiper-reviews-carousel .client-logo {
height: 1.375rem;
object-fit: contain;
}
.landing-reviews .swiper-logo-carousel {
padding-bottom: 6.25rem;
}
.landing-reviews .swiper-logo-carousel .swiper {
max-width: 45rem;
}
.landing-reviews .swiper-logo-carousel .swiper .swiper-slide {
display: flex;
justify-content: center;
}
.landing-reviews .swiper-logo-carousel .swiper .client-logo {
max-height: 2.5rem;
max-width: 95%;
object-fit: contain;
}
.landing-team .card,
.landing-team .card .team-image-box {
border-top-left-radius: 5.625rem;
border-top-right-radius: 1.25rem;
}
.landing-team .card .card-body {
border-bottom-left-radius: 0.375rem;
border-bottom-right-radius: 0.375rem;
}
.landing-team .team-image-box {
height: 11.5625rem;
}
.landing-team .team-image-box .card-img-position {
height: 15rem;
transform: translateX(-50%);
max-width: 100%;
object-fit: cover;
}
@media (max-width: 991.98px) {
.landing-team .team-image-box .card-img-position {
height: 13rem;
}
}
@media (max-width: 575.98px) {
.landing-team .team-image-box {
height: 11rem;
}
}
.landing-team .card .team-media-icons i {
transition: all 0.2s ease-in-out;
}
.landing-pricing {
border-radius: 3.75rem;
}
.landing-pricing .pricing-plans-item {
inset-inline-end: -56%;
bottom: -0.5rem;
}
@media (max-width: 767.98px) {
.landing-pricing .pricing-plans-item {
inset-inline-end: 0;
bottom: 1rem;
}
}
.landing-pricing .pricing-list .badge.badge-center {
width: 1rem;
height: 1rem;
}
.landing-pricing .pricing-list .badge.badge-center i {
margin-top: -5px;
}
.landing-pricing .price-yearly-toggle {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
}
.landing-pricing .card .card-header,
.landing-pricing .card .card-body {
padding: 2rem;
padding-top: 3rem;
}
.landing-faq {
border-top-left-radius: 3.75rem;
border-top-right-radius: 3.75rem;
}
.landing-faq .faq-image {
max-width: 20rem;
width: 80%;
}
.landing-cta .cta-title {
font-size: 2.125rem;
}
@media (max-width: 767.98px) {
.landing-cta .cta-title {
font-size: 1.8rem;
}
}
.landing-contact .text-heading {
overflow-wrap: anywhere;
}
.landing-contact .contact-img-box,
.landing-contact .contact-img-box .contact-img {
border-radius: 3.75rem 0.375rem 0.375rem 0.375rem;
}
.landing-contact .contact-img-box .contact-border-img {
inset-block-start: -2.5rem;
inset-inline-start: -2.8125rem;
}
.light-style .landing-hero {
background: linear-gradient(138.18deg, #eae8fd 0%, #fce5e6 94.44%);
}
.light-style .landing-hero::after {
background-color: #fff;
}
.dark-style .landing-hero {
background: #1e2130;
}
.dark-style .landing-hero::after {
background-color: #2b2c40;
}
[dir="rtl"] .landing-reviews-btns {
display: flex;
justify-content: flex-end;
flex-direction: row-reverse;
gap: 1rem;
}
[dir="rtl"] .landing-team .team-image-box .card-img-position {
transform: translateX(50%) !important;
}
[dir="rtl"] .landing-pricing .switch .switch-label {
padding-right: 0;
}
[dir="rtl"] .landing-pricing .switch .switch-label:first-child {
padding-left: 0.5rem;
}
[dir="rtl"] .landing-pricing .switch .switch-input ~ .switch-label {
padding-right: 3rem;
}
[dir="rtl"] .landing-contact .contact-img-box {
border-radius: 0.375rem 3.75rem 0.375rem 0.375rem;
}
[dir="rtl"] .landing-contact .contact-img-box::before {
inset-block-start: -1.875rem;
inset-inline-start: -3.125rem;
transform: rotate(90deg);
}
.swiper {
width: 100%;
height: 100%;
border-radius: 10px;
}
.swiper-slide {
text-align: center;
font-size: 18px;
/* Center slide text vertically */
display: flex;
justify-content: center;
align-items: center;
}
.swiper-slide img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}

File diff suppressed because it is too large Load Diff

View File

@ -28,29 +28,53 @@ const SubscriptionPlans = () => {
const frequencyLabel = (freq) => { const frequencyLabel = (freq) => {
switch (freq) { switch (freq) {
case 0: return "1 mo"; case 0:
case 1: return "3 mo"; return "1 mo";
case 2: return "6 mo"; case 1:
case 3: return "1 yr"; return "3 mo";
default: return "mo"; case 2:
return "6 mo";
case 3:
return "1 yr";
default:
return "mo";
} }
}; };
return ( return (
<div className="container py-5"> <div className="container py-5">
<h4 className="text-center mb-1">
<span className="position-relative fw-extrabold z-1 me-2">
Tailored pricing plans
{/* <img
src="./../../public/img/icons/section-title-icon.png"
alt="laptop charging"
className="section-title-img position-absolute object-fit-contain bottom-0 z-n1"
/> */}
</span>
designed for you
</h4>
<p className="text-center pb-2 mb-7">
No matter which plan you choose, youll get access to powerful features.{" "}
<strong>Choose the best plan to fit your needs.</strong>
</p>
{/* Frequency Switcher */} {/* Frequency Switcher */}
<div className="text-center mb-4"> <div className="text-center mb-4">
<div className="btn-group" role="group" aria-label="Plan frequency"> <div className="btn-group" role="group" aria-label="Plan frequency">
{["Monthly", "Quarterly", "Half-Yearly", "Yearly"].map((label, idx) => ( {["Monthly", "Quarterly", "Half-Yearly", "Yearly"].map(
<button (label, idx) => (
key={idx} <button
type="button" key={idx}
className={`btn btn-${frequency === idx ? "primary" : "outline-secondary"}`} type="button"
onClick={() => setFrequency(idx)} className={`btn btn-${
> frequency === idx ? "primary" : "outline-secondary"
{label} }`}
</button> onClick={() => setFrequency(idx)}
))} >
{label}
</button>
)
)}
</div> </div>
</div> </div>
@ -72,7 +96,9 @@ const SubscriptionPlans = () => {
{/* Header */} {/* Header */}
<div className="mb-3"> <div className="mb-3">
<i className="bx bxs-package text-primary fs-1 mb-2"></i> <i className="bx bxs-package text-primary fs-1 mb-2"></i>
<p className="card-title fs-3 fw-bold mb-1">{plan.planName}</p> <p className="card-title fs-3 fw-bold mb-1">
{plan.planName}
</p>
<p className="text-muted mb-0 fs-5">{plan.description}</p> <p className="text-muted mb-0 fs-5">{plan.description}</p>
</div> </div>
@ -80,7 +106,9 @@ const SubscriptionPlans = () => {
<div className="mb-3"> <div className="mb-3">
<h4 className="fw-semibold mt-auto mb-0 fs-3"> <h4 className="fw-semibold mt-auto mb-0 fs-3">
{plan.currency?.symbol} {plan.price} {plan.currency?.symbol} {plan.price}
<small className="text-muted ms-1">/ {frequencyLabel(frequency)}</small> <small className="text-muted ms-1">
/ {frequencyLabel(frequency)}
</small>
</h4> </h4>
</div> </div>
@ -133,7 +161,6 @@ const SubscriptionPlans = () => {
)) ))
)} )}
</div> </div>
</div> </div>
); );
}; };

View File

@ -5,37 +5,37 @@ const SwaperBlogContent = ({
ContentAlign = "right", ContentAlign = "right",
}) => { }) => {
return ( return (
<div class="swiper-slide"> <div className="swiper-slide">
<div class="card h-100"> <div className="card h-100">
<div class="card-body text-body d-flex flex-column justify-content-between h-100"> <div className="card-body text-body d-flex flex-column justify-content-between h-100">
<div class="mb-4"> <div className="mb-4">
<img <img
src={ImageUrl} src={ImageUrl}
alt="client logo" alt="client logo"
class="client-logo img-fluid" className="client-logo img-fluid"
style={{ width: "580px", height: "100px" }} style={{ width: "580px", height: "100px" }}
/> />
<h5>{Title}</h5> <h5>{Title}</h5>
</div> </div>
<p>{Body}</p> <p>{Body}</p>
<div class="text-warning mb-4"> <div className="text-warning mb-4">
<i class="bx bxs-star"></i> <i className="bx bxs-star"></i>
<i class="bx bxs-star"></i> <i className="bx bxs-star"></i>
<i class="bx bxs-star"></i> <i className="bx bxs-star"></i>
<i class="bx bxs-star"></i> <i className="bx bxs-star"></i>
<i class="bx bxs-star"></i> <i className="bx bxs-star"></i>
</div> </div>
<div class="d-flex align-items-center"> <div className="d-flex align-items-center">
<div class="avatar me-3 avatar-sm"> <div className="avatar me-3 avatar-sm">
<img <img
src="../../assets/img/avatars/1.png" src="../../assets/img/avatars/1.png"
alt="Avatar" alt="Avatar"
class="rounded-circle" className="rounded-circle"
/> />
</div> </div>
<div> <div>
<h6 class="mb-0">Cecilia Payne</h6> <h6 className="mb-0">Cecilia Payne</h6>
<p class="small text-muted mb-0">CEO of Airbnb</p> <p className="small text-muted mb-0">CEO of Airbnb</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -33,17 +33,14 @@ const SwaperSlideContent = ({
style={{ style={{
borderRadius: "10px", borderRadius: "10px",
background: background:
"linear-gradient(to bottom, rgba(194, 216, 237,1), rgba(194, 216, 237,0.8))", "linear-gradient(to bottom, rgba(194, 216, 237,1), rgba(105, 108, 255, 0.8))",
boxShadow: "10px 10px 15px rgba(0, 0, 0, 0.4)", boxShadow: "10px 10px 15px rgba(0, 0, 0, 0.4)",
}} }}
> >
<h1 <h1 className="fw-bold text-primary hero-title display-6 fw-extrabold">
className="fw-bold text-primary hero-title display-6 fw-extrabold"
style={{ color: "#fff" }}
>
{Title} {Title}
</h1> </h1>
<p className="lead fw-bold">{Body}</p> <p className="lead text-dark">{Body}</p>
{/* <a {/* <a
href="#services" href="#services"
className="btn btn-primary btn-lg mt-3" className="btn btn-primary btn-lg mt-3"

View File

@ -0,0 +1,26 @@
import { SwiperSlide } from "swiper/react";
const SwaperSlideImages = ({
ImageUrl = "../../../public/assets/img/backgrounds/18.jpg",
Title = "",
Body = "",
ContentAlign = "right",
}) => {
return (
<div className="card h-100">
<img className="card-img-top" src={ImageUrl} alt="Card image cap" />
{/* <div className="card-body">
<h5 className="card-title">Card title</h5>
<p className="card-text">
Some quick example text to build on the card title and make up the
bulk of the card's content.
</p>
<a href="javascript:void(0)" className="btn btn-outline-primary">
Go somewhere
</a>
</div> */}
</div>
);
};
export default SwaperSlideImages;

View File

@ -127,7 +127,7 @@ const TenantPage = () => {
<div className="p-0"> <div className="p-0">
<div className="row align-items-center"> <div className="row align-items-center">
{/* Search */} {/* Search */}
<div className="col-6 col-md-6 col-lg-2 mb-md-0"> <div className="col-6 col-md-6 col-lg-3 mb-md-0">
<input <input
type="search" type="search"
value={searchText} value={searchText}
@ -138,7 +138,7 @@ const TenantPage = () => {
</div> </div>
{/* Actions */} {/* Actions */}
<div className="col-6 col-md-6 col-lg-10 text-end"> <div className="col-6 col-md-6 col-lg-9 text-end">
<button <button
className="btn btn-sm btn-primary" className="btn btn-sm btn-primary"
type="button" type="button"

View File

@ -41,21 +41,24 @@ const LoginPage = () => {
password: data.password, password: data.password,
}; };
const response = await AuthRepository.login(userCredential); const response = await AuthRepository.login(userCredential);
if (data.rememberMe) { // if (data.rememberMe) {
localStorage.setItem("jwtToken", response.data.token); // localStorage.setItem("jwtToken", response.data.token);
localStorage.setItem("refreshToken", response.data.refreshToken); // localStorage.setItem("refreshToken", response.data.refreshToken);
} else { // } else {
sessionStorage.setItem("jwtToken", response.data.token); // sessionStorage.setItem("jwtToken", response.data.token);
sessionStorage.setItem("refreshToken", response.data.refreshToken); // sessionStorage.setItem("refreshToken", response.data.refreshToken);
} // }
setLoading(false); setLoading(false);
navigate("/auth/switch/org"); localStorage.setItem("jwtToken", response.data.token);
localStorage.setItem("refreshToken", response.data.refreshToken);
navigate("/dashboard",{ replace: true });
} else { } else {
await AuthRepository.sendOTP({ email: data.username }); await AuthRepository.sendOTP({ email: data.username });
showToast("OTP has been sent to your email.", "success"); showToast("OTP has been sent to your email.", "success");
localStorage.setItem("otpUsername", data.username); localStorage.setItem("otpUsername", data.username);
localStorage.setItem("otpSentTime", now.toString()); localStorage.setItem("otpSentTime", now.toString());
navigate("/auth/login-otp"); // navigate("/auth/login-otp");
navigate("/dashboard",{ replace: true });
} }
} catch (err) { } catch (err) {
showToast("Invalid username or password.", "error"); showToast("Invalid username or password.", "error");

View File

@ -36,31 +36,26 @@ import GlobalModel from "../../components/common/GlobalModel";
import usePagination from "../../hooks/usePagination"; import usePagination from "../../hooks/usePagination";
import { setProjectId } from "../../slices/localVariablesSlice"; import { setProjectId } from "../../slices/localVariablesSlice";
import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import { useHasUserPermission } from "../../hooks/useHasUserPermission";
import Pagination from "../../components/common/Pagination";
const EmployeeList = () => { const EmployeeList = () => {
const selectedProjectId = useSelector( // const selectedProjectId = useSelector(
(store) => store.localVariables.projectId // (store) => store.localVariables.projectId
); // );
const { projectNames, loading: projectLoading, fetchData } = useProjectName(); // const { projectNames, loading: projectLoading, fetchData } = useProjectName();
const dispatch = useDispatch(); const dispatch = useDispatch();
const [showInactive, setShowInactive] = useState(false); const [showInactive, setShowInactive] = useState(false);
const [showAllEmployees, setShowAllEmployees] = useState(false); const [showAllEmployees, setShowAllEmployees] = useState(true);
const Manage_Employee = useHasUserPermission(MANAGE_EMPLOYEES); const Manage_Employee = useHasUserPermission(MANAGE_EMPLOYEES);
const { employees, loading, setLoading, error, recallEmployeeData } = const { employees, loading, setLoading, error, recallEmployeeData } =
useEmployeesAllOrByProjectId( useEmployeesAllOrByProjectId(showAllEmployees, null, showInactive);
showAllEmployees,
selectedProjectId,
showInactive
);
const [employeeList, setEmployeeList] = useState([]); const [employeeList, setEmployeeList] = useState([]);
const [modelConfig, setModelConfig] = useState(); const [modelConfig, setModelConfig] = useState();
const [EmpForManageRole, setEmpForManageRole] = useState(null); const [EmpForManageRole, setEmpForManageRole] = useState(null);
// const [currentPage, setCurrentPage] = useState(1);
// const [itemsPerPage] = useState(ITEMS_PER_PAGE);
const [isCreateModalOpen, setIsCreateModalOpen] = useState(false); const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
const [searchText, setSearchText] = useState(""); const [searchText, setSearchText] = useState("");
const [filteredData, setFilteredData] = useState([]); const [filteredData, setFilteredData] = useState([]);
@ -78,11 +73,11 @@ const EmployeeList = () => {
} }
); );
useEffect(() => { // useEffect(() => {
if (selectedProjectId === null) { // if (selectedProjectId === null) {
dispatch(setProjectId(projectNames[0]?.id)); // dispatch(setProjectId(projectNames[0]?.id));
} // }
}, [selectedProjectId]); // }, [selectedProjectId]);
const navigate = useNavigate(); const navigate = useNavigate();
const applySearchFilter = (data, text) => { const applySearchFilter = (data, text) => {
@ -205,25 +200,16 @@ const EmployeeList = () => {
setCurrentPage((prevPage) => (prevPage !== 1 ? 1 : prevPage)); setCurrentPage((prevPage) => (prevPage !== 1 ? 1 : prevPage));
} }
}, [loading, employees, selectedProjectId, showAllEmployees]); }, [loading, employees, showAllEmployees]);
useEffect(() => {
if (!showAllEmployees) {
recallEmployeeData(showInactive, selectedProjectId);
}
}, [selectedProjectId, showInactive, showAllEmployees, recallEmployeeData]);
const handler = useCallback( const handler = useCallback(
(msg) => { (msg) => {
if (employees.some((item) => item.id == msg.employeeId)) { if (employees.some((item) => item.id == msg.employeeId)) {
setEmployeeList([]); setEmployeeList([]);
recallEmployeeData( recallEmployeeData(showInactive, null, showAllEmployees);
showInactive,
showAllEmployees ? null : selectedProjectId
); // Use selectedProjectId here
} }
}, },
[employees, showInactive, showAllEmployees, selectedProjectId] // Add all relevant dependencies [employees, showInactive, showAllEmployees]
); );
useEffect(() => { useEffect(() => {
@ -293,18 +279,16 @@ const EmployeeList = () => {
{ViewTeamMember ? ( {ViewTeamMember ? (
// <div className="row"> // <div className="row">
<div className="card p-1"> <div className="card page-min-h ">
<div className="card-datatable table-responsive pt-5 mx-5 py-10"> <div
<div id="DataTables_Table_0_wrapper"
id="DataTables_Table_0_wrapper" className="dataTables_wrapper dt-bootstrap5 no-footer p-1 pt-5 mx-5 py-10"
className="dataTables_wrapper dt-bootstrap5 no-footer" >
style={{ width: "100%" }} <div className="d-flex flex-wrap align-items-center justify-content-between gap-3 mb-3">
> {/* Switches: All Employees + Inactive */}
<div className="d-flex flex-wrap align-items-center justify-content-between gap-3 mb-3"> <div className="d-flex flex-wrap align-items-center gap-3">
{/* Switches: All Employees + Inactive */} {/* All Employees Switch */}
<div className="d-flex flex-wrap align-items-center gap-3"> {/* {ViewAllEmployee && (
{/* All Employees Switch */}
{ViewAllEmployee && (
<div className="form-check form-switch text-start"> <div className="form-check form-switch text-start">
<input <input
type="checkbox" type="checkbox"
@ -321,433 +305,382 @@ const EmployeeList = () => {
Show All Employees Show All Employees
</label> </label>
</div> </div>
)} )} */}
{/* Show Inactive Employees Switch */} {/* Show Inactive Employees Switch */}
{showAllEmployees && ( {/* {showAllEmployees && ( */}
<div className="form-check form-switch text-start"> <div className="form-check form-switch text-start">
<input <input
type="checkbox" type="checkbox"
className="form-check-input" className="form-check-input"
role="switch" role="switch"
id="inactiveEmployeesCheckbox" id="inactiveEmployeesCheckbox"
checked={showInactive} checked={showInactive}
onChange={(e) => setShowInactive(e.target.checked)} onChange={(e) => setShowInactive(e.target.checked)}
/> />
<label <label
className="form-check-label ms-0" className="form-check-label ms-0"
htmlFor="inactiveEmployeesCheckbox" htmlFor="inactiveEmployeesCheckbox"
> >
Show Inactive Employees Show Inactive Employees
</label> </label>
</div>
)}
</div>
{/* Right side: Search + Export + Add Employee */}
<div className="d-flex flex-wrap align-items-center justify-content-end gap-3 flex-grow-1">
{/* Search Input - ALWAYS ENABLED */}
<div className="dataTables_filter">
<label className="mb-0">
<input
type="search"
value={searchText}
onChange={handleSearch}
className="form-control form-control-sm"
placeholder="Search Employee"
aria-controls="DataTables_Table_0"
/>
</label>
</div>
{/* Export Dropdown */}
<div className="dropdown">
<button
aria-label="Click me"
className="btn btn-sm btn-label-secondary dropdown-toggle"
type="button"
data-bs-toggle="dropdown"
aria-expanded="false"
>
<i className="bx bx-export me-2 bx-sm"></i>Export
</button>
<ul className="dropdown-menu">
<li>
<a
className="dropdown-item"
href="#"
onClick={() => handleExport("print")}
>
<i className="bx bx-printer me-1"></i> Print
</a>
</li>
<li>
<a
className="dropdown-item"
href="#"
onClick={() => handleExport("csv")}
>
<i className="bx bx-file me-1"></i> CSV
</a>
</li>
<li>
<a
className="dropdown-item"
href="#"
onClick={() => handleExport("excel")}
>
<i className="bx bxs-file-export me-1"></i> Excel
</a>
</li>
<li>
<a
className="dropdown-item"
href="#"
onClick={() => handleExport("pdf")}
>
<i className="bx bxs-file-pdf me-1"></i> PDF
</a>
</li>
</ul>
</div>
{/* Add Employee Button */}
{Manage_Employee && (
<button
className="btn btn-sm btn-primary"
type="button"
onClick={() => handleEmployeeModel(null)}
>
<i className="bx bx-plus-circle me-2"></i>
<span className="d-none d-md-inline-block">
Add New Employee
</span>
</button>
)}
</div> </div>
{/* )} */}
</div> </div>
<table {/* Right side: Search + Export + Add Employee */}
className="datatables-users table border-top dataTable no-footer dtr-column text-nowrap" <div className="d-flex flex-wrap align-items-center justify-content-end gap-3 flex-grow-1">
id="DataTables_Table_0" {/* Search Input - ALWAYS ENABLED */}
aria-describedby="DataTables_Table_0_info" <div className="dataTables_filter">
style={{ width: "100%" }} <label className="mb-0">
ref={tableRef} <input
> type="search"
<thead> value={searchText}
<tr> onChange={handleSearch}
<th className="form-control form-control-sm"
className="sorting sorting_desc" placeholder="Search Employee"
tabIndex="0"
aria-controls="DataTables_Table_0" aria-controls="DataTables_Table_0"
rowSpan="1" />
colSpan="2" </label>
aria-label="User: activate to sort column ascending" </div>
aria-sort="descending"
>
<div className="text-start ms-6">Name</div>
</th>
<th
className="sorting sorting_desc d-none d-sm-table-cell"
tabIndex="0"
aria-controls="DataTables_Table_0"
rowSpan="1"
colSpan="1"
aria-label="User: activate to sort column ascending"
aria-sort="descending"
>
<div className="text-start ms-5">Email</div>
</th>
<th
className="sorting sorting_desc d-none d-sm-table-cell"
tabIndex="0"
aria-controls="DataTables_Table_0"
rowSpan="1"
colSpan="1"
aria-label="User: activate to sort column ascending"
aria-sort="descending"
>
<div className="text-start ms-5">Contact</div>
</th>
<th
className="sorting sorting_desc d-none d-sm-table-cell"
tabIndex="0"
aria-controls="DataTables_Table_0"
rowSpan="1"
colSpan="1"
aria-label="User: activate to sort column ascending"
aria-sort="descending"
>
<div className="text-start ms-5">Designation</div>
</th>
<th {/* Export Dropdown */}
className="sorting d-none d-md-table-cell" <div className="dropdown">
tabIndex="0" <button
aria-controls="DataTables_Table_0" aria-label="Click me"
rowSpan="1" className="btn btn-sm btn-label-secondary dropdown-toggle"
colSpan="1" type="button"
aria-label="Plan: activate to sort column ascending" data-bs-toggle="dropdown"
> aria-expanded="false"
Joining Date >
</th> <i className="bx bx-export me-2 bx-sm"></i>Export
<th </button>
className="sorting" <ul className="dropdown-menu">
tabIndex="0" <li>
aria-controls="DataTables_Table_0" <a
rowSpan="1" className="dropdown-item"
colSpan="1" href="#"
aria-label="Billing: activate to sort column ascending" onClick={() => handleExport("print")}
>
Status
</th>
<th
className={`sorting_disabled ${
!Manage_Employee && "d-none"
}`}
rowSpan="1"
colSpan="1"
style={{ width: "50px" }}
aria-label="Actions"
>
Actions
</th>
</tr>
</thead>
<tbody>
{loading && (
<tr>
<td colSpan={8}>
<p>Loading...</p>
</td>
</tr>
)}
{/* Conditional messages for no data or no search results */}
{!loading &&
displayData?.length === 0 &&
searchText &&
!showAllEmployees ? (
<tr>
<td colSpan={8}>
<small className="muted">
'{searchText}' employee not found
</small>{" "}
</td>
</tr>
) : null}
{!loading &&
displayData?.length === 0 &&
(!searchText || showAllEmployees) ? (
<tr>
<td
colSpan={8}
style={{ paddingTop: "20px", textAlign: "center" }}
> >
No Data Found <i className="bx bx-printer me-1"></i> Print
</td> </a>
</tr> </li>
) : null} <li>
<a
className="dropdown-item"
href="#"
onClick={() => handleExport("csv")}
>
<i className="bx bx-file me-1"></i> CSV
</a>
</li>
<li>
<a
className="dropdown-item"
href="#"
onClick={() => handleExport("excel")}
>
<i className="bx bxs-file-export me-1"></i> Excel
</a>
</li>
<li>
<a
className="dropdown-item"
href="#"
onClick={() => handleExport("pdf")}
>
<i className="bx bxs-file-pdf me-1"></i> PDF
</a>
</li>
</ul>
</div>
{/* Render current items */} {/* Add Employee Button */}
{currentItems && {Manage_Employee && (
!loading && <button
currentItems.map((item) => ( className="btn btn-sm btn-primary"
<tr className="odd" key={item.id}> type="button"
<td className="sorting_1" colSpan={2}> onClick={() => handleEmployeeModel(null)}
<div className="d-flex justify-content-start align-items-center user-name"> >
<Avatar <i className="bx bx-plus-circle me-2"></i>
firstName={item.firstName} <span className="d-none d-md-inline-block">
lastName={item.lastName} Add New Employee
></Avatar> </span>
<div className="d-flex flex-column"> </button>
<a )}
</div>
</div>
<table
className="datatables-users table border-top dataTable no-footer dtr-column text-nowrap"
id="DataTables_Table_0"
aria-describedby="DataTables_Table_0_info"
style={{ width: "100%" }}
ref={tableRef}
>
<thead>
<tr>
<th
className="sorting sorting_desc"
tabIndex="0"
aria-controls="DataTables_Table_0"
rowSpan="1"
colSpan="2"
aria-label="User: activate to sort column ascending"
aria-sort="descending"
>
<div className="text-start ms-6">Name</div>
</th>
<th
className="sorting sorting_desc d-none d-sm-table-cell"
tabIndex="0"
aria-controls="DataTables_Table_0"
rowSpan="1"
colSpan="1"
aria-label="User: activate to sort column ascending"
aria-sort="descending"
>
<div className="text-start ms-5">Email</div>
</th>
<th
className="sorting sorting_desc d-none d-sm-table-cell"
tabIndex="0"
aria-controls="DataTables_Table_0"
rowSpan="1"
colSpan="1"
aria-label="User: activate to sort column ascending"
aria-sort="descending"
>
<div className="text-start ms-5">Contact</div>
</th>
<th
className="sorting sorting_desc d-none d-sm-table-cell"
tabIndex="0"
aria-controls="DataTables_Table_0"
rowSpan="1"
colSpan="1"
aria-label="User: activate to sort column ascending"
aria-sort="descending"
>
<div className="text-start ms-5">Designation</div>
</th>
<th
className="sorting d-none d-md-table-cell"
tabIndex="0"
aria-controls="DataTables_Table_0"
rowSpan="1"
colSpan="1"
aria-label="Plan: activate to sort column ascending"
>
Joining Date
</th>
<th
className="sorting"
tabIndex="0"
aria-controls="DataTables_Table_0"
rowSpan="1"
colSpan="1"
aria-label="Billing: activate to sort column ascending"
>
Status
</th>
<th
className={`sorting_disabled ${
!Manage_Employee && "d-none"
}`}
rowSpan="1"
colSpan="1"
style={{ width: "50px" }}
aria-label="Actions"
>
Actions
</th>
</tr>
</thead>
<tbody>
{loading && (
<tr>
<td colSpan={8}>
<p>Loading...</p>
</td>
</tr>
)}
{/* Conditional messages for no data or no search results */}
{!loading &&
displayData?.length === 0 &&
searchText ? (
<tr>
<td colSpan={8} className="border-0">
<div className="py-12">
<small className="muted">
'{searchText}' employee not found
</small>{" "}
</div>
</td>
</tr>
) : null}
{!loading &&
displayData?.length === 0 &&
(!searchText ) ? (
<tr>
<td colSpan={8} className="border-0">
<div className="py-12">{showInactive ? "No In-active Employeee Found" : "No Employeee Found" }</div>
</td>
</tr>
) : null}
{/* Render current items */}
{currentItems &&
!loading &&
currentItems.map((item) => (
<tr className="odd" key={item.id}>
<td className="sorting_1" colSpan={2}>
<div className="d-flex justify-content-start align-items-center user-name">
<Avatar
firstName={item.firstName}
lastName={item.lastName}
></Avatar>
<div className="d-flex flex-column">
<a
onClick={() => navigate(`/employee/${item.id}`)}
className="text-heading text-truncate cursor-pointer"
>
<span className="fw-normal">
{item.firstName} {item.middleName}{" "}
{item.lastName}
</span>
</a>
</div>
</div>
</td>
<td className="text-start d-none d-sm-table-cell">
{item.email ? (
<span className="text-truncate">
<i className="bx bxs-envelope text-primary me-2"></i>
{item.email}
</span>
) : (
<span className="text-truncate text-italic">-</span>
)}
</td>
<td className="text-start d-none d-sm-table-cell">
<span className="text-truncate">
<i className="bx bxs-phone-call text-primary me-2"></i>
{item.phoneNumber}
</span>
</td>
<td className=" d-none d-sm-table-cell text-start">
<span className="text-truncate">
<i className="bx bxs-wrench text-success me-2"></i>
{item.jobRole || "Not Assign Yet"}
</span>
</td>
<td className=" d-none d-md-table-cell">
{moment(item.joiningDate)?.format("DD-MMM-YYYY")}
</td>
<td>
{showInactive ? (
<span
className="badge bg-label-danger"
text-capitalized=""
>
Inactive
</span>
) : (
<span
className="badge bg-label-success"
text-capitalized=""
>
Active
</span>
)}
</td>
{Manage_Employee && (
<td className="text-end">
<div className="dropdown">
<button
className="btn btn-icon dropdown-toggle hide-arrow"
data-bs-toggle="dropdown"
>
<i className="bx bx-dots-vertical-rounded bx-md"></i>
</button>
<div className="dropdown-menu dropdown-menu-end">
{/* View always visible */}
<button
onClick={() => onClick={() =>
navigate(`/employee/${item.id}`) navigate(`/employee/${item.id}`)
} }
className="text-heading text-truncate cursor-pointer" className="dropdown-item py-1"
> >
<span className="fw-normal"> <i className="bx bx-detail bx-sm"></i> View
{item.firstName} {item.middleName}{" "} </button>
{item.lastName}
</span> {/* If ACTIVE employee */}
</a> {item.isActive && (
<>
<button
className="dropdown-item py-1"
onClick={() =>
handleEmployeeModel(item.id)
}
>
<i className="bx bx-edit bx-sm"></i> Edit
</button>
{/* Suspend only when active */}
{item.isActive && (
<button
className="dropdown-item py-1"
onClick={() => handleOpenDelete(item)}
>
<i className="bx bx-task-x bx-sm"></i>{" "}
Suspend
</button>
)}
<button
className="dropdown-item py-1"
type="button"
data-bs-toggle="modal"
data-bs-target="#managerole-modal"
onClick={() =>
setEmpForManageRole(item.id)
}
>
<i className="bx bx-cog bx-sm"></i> Manage
Role
</button>
</>
)}
{/* If INACTIVE employee AND inactive toggle is ON */}
{!item.isActive && showInactive && (
<button
className="dropdown-item py-1"
onClick={() => handleOpenDelete(item)}
>
<i className="bx bx-refresh bx-sm me-1"></i>{" "}
Re-activate
</button>
)}
</div> </div>
</div> </div>
</td> </td>
<td className="text-start d-none d-sm-table-cell"> )}
{item.email ? ( </tr>
<span className="text-truncate"> ))}
<i className="bx bxs-envelope text-primary me-2"></i> </tbody>
{item.email} </table>
</span>
) : (
<span className="text-truncate text-italic">
-
</span>
)}
</td>
<td className="text-start d-none d-sm-table-cell">
<span className="text-truncate">
<i className="bx bxs-phone-call text-primary me-2"></i>
{item.phoneNumber}
</span>
</td>
<td className=" d-none d-sm-table-cell text-start">
<span className="text-truncate">
<i className="bx bxs-wrench text-success me-2"></i>
{item.jobRole || "Not Assign Yet"}
</span>
</td>
<td className=" d-none d-md-table-cell"> {displayData.length > 0 && (
{moment(item.joiningDate)?.format("DD-MMM-YYYY")} <Pagination
</td> currentPage={currentPage}
<td> totalPages={totalPages}
{showInactive ? ( onPageChange={paginate}
<span />
className="badge bg-label-danger" )}
text-capitalized=""
>
Inactive
</span>
) : (
<span
className="badge bg-label-success"
text-capitalized=""
>
Active
</span>
)}
</td>
{Manage_Employee && (
<td className="text-end">
<div className="dropdown">
<button
className="btn btn-icon dropdown-toggle hide-arrow"
data-bs-toggle="dropdown"
>
<i className="bx bx-dots-vertical-rounded bx-md"></i>
</button>
<div className="dropdown-menu dropdown-menu-end">
{/* View always visible */}
<button
onClick={() =>
navigate(`/employee/${item.id}`)
}
className="dropdown-item py-1"
>
<i className="bx bx-detail bx-sm"></i> View
</button>
{/* If ACTIVE employee */}
{item.isActive && (
<>
<button
className="dropdown-item py-1"
onClick={() =>
handleEmployeeModel(item.id)
}
>
<i className="bx bx-edit bx-sm"></i>{" "}
Edit
</button>
{/* Suspend only when active */}
{item.isActive && (
<button
className="dropdown-item py-1"
onClick={() => handleOpenDelete(item)}
>
<i className="bx bx-task-x bx-sm"></i>{" "}
Suspend
</button>
)}
<button
className="dropdown-item py-1"
type="button"
data-bs-toggle="modal"
data-bs-target="#managerole-modal"
onClick={() =>
setEmpForManageRole(item.id)
}
>
<i className="bx bx-cog bx-sm"></i>{" "}
Manage Role
</button>
</>
)}
{/* If INACTIVE employee AND inactive toggle is ON */}
{!item.isActive && showInactive && (
<button
className="dropdown-item py-1"
onClick={() => handleOpenDelete(item)}
>
<i className="bx bx-refresh bx-sm me-1"></i>{" "}
Re-activate
</button>
)}
</div>
</div>
</td>
)}
</tr>
))}
</tbody>
</table>
<div style={{ width: "1%" }}></div>
{/* Pagination */}
{!loading && displayData.length > ITEMS_PER_PAGE && (
<nav aria-label="Page">
<ul className="pagination pagination-sm justify-content-end py-1">
<li
className={`page-item ${
currentPage === 1 ? "disabled" : ""
}`}
>
<button
className="page-link btn-xs"
onClick={() => paginate(currentPage - 1)}
>
&laquo;
</button>
</li>
{[...Array(totalPages)]?.map((_, index) => (
<li
key={index}
className={`page-item ${
currentPage === index + 1 ? "active" : ""
}`}
>
<button
className="page-link"
onClick={() => paginate(index + 1)}
>
{index + 1}
</button>
</li>
))}
<li
className={`page-item ${
currentPage === totalPages ? "disabled" : ""
}`}
>
<button
className="page-link"
onClick={() => paginate(currentPage + 1)}
>
&raquo;
</button>
</li>
</ul>
</nav>
)}
</div>
</div> </div>
</div> </div>
) : ( ) : (

View File

@ -161,8 +161,8 @@ const MasterPage = () => {
data={[{ label: "Home", link: "/dashboard" }, { label: "Masters" }]} data={[{ label: "Home", link: "/dashboard" }, { label: "Masters" }]}
/> />
<div className="row">
<div className="card"> <div className="card page-min-h">
<div <div
className="card-datatable table-responsive py-10 mx-5 " className="card-datatable table-responsive py-10 mx-5 "
style={{ overflow: "hidden" }} style={{ overflow: "hidden" }}
@ -221,7 +221,6 @@ const MasterPage = () => {
handleModalData={handleModalData} handleModalData={handleModalData}
/> />
</div> </div>
</div>
</div> </div>
</div> </div>
</MasterContext.Provider> </MasterContext.Provider>

View File

@ -109,11 +109,11 @@ const MasterTable = ({ data, columns, loading, handleModalData }) => {
{currentItems.length > 0 ? ( {currentItems.length > 0 ? (
currentItems.map((item, index) => ( currentItems.map((item, index) => (
<tr key={index}> <tr key={index}>
<td style={{ width: "20px" }}> <td style={{ width: "20px", }} className="py-5">
<i className="bx bx-right-arrow-alt"></i> <div className="py-2 px-3"><i className="bx bx-right-arrow-alt"></i></div>
</td> </td>
{updatedColumns.map((col) => ( {updatedColumns.map((col) => (
<td className="text-start mx-2" key={col.key}> <td className="text-start mx-2 p-3" key={col.key} style={{ padding: "12px 16px" }} >
{col.key === "description" ? ( {col.key === "description" ? (
item[col.key] !== undefined && item[col.key] !== undefined &&
item[col.key] !== null ? ( item[col.key] !== null ? (

Some files were not shown because too many files have changed in this diff Show More