Compare commits

...

6 Commits

8 changed files with 317 additions and 345 deletions

View File

@ -223,8 +223,20 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat
)}
</tbody>
</table>
</>
) : (
<div
className="d-flex justify-content-center align-items-center text-muted"
style={{ height: "200px" }}
>
{searchTerm
? "No results found for your search."
: attendanceList.length === 0
? "No employees assigned to the project."
: "No pending records available."}
</div>
)}
</div>
{!loading && finalFilteredData.length > ITEMS_PER_PAGE && (
<nav aria-label="Page ">
<ul className="pagination pagination-sm justify-content-end py-1">
@ -268,20 +280,6 @@ const Attendance = ({ getRole, handleModalData, searchTerm, projectId, organizat
</nav>
)}
</>
) : (
<div
className="d-flex justify-content-center align-items-center text-muted"
style={{ height: "200px" }}
>
{searchTerm
? "No results found for your search."
: attendanceList.length === 0
? "No employees assigned to the project."
: "No pending records available."}
</div>
)}
</div>
</>
);
};

View File

@ -15,6 +15,7 @@ import AttendanceRepository from "../../repositories/AttendanceRepository";
import { useAttendancesLogs } from "../../hooks/useAttendance";
import { queryClient } from "../../layouts/AuthLayout";
import { ITEMS_PER_PAGE } from "../../utils/constants";
import { useNavigate } from "react-router-dom";
const usePagination = (data, itemsPerPage) => {
const [currentPage, setCurrentPage] = useState(1);
@ -44,6 +45,7 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => {
const [loading, setLoading] = useState(false);
const [showPending, setShowPending] = useState(false);
const [isRefreshing, setIsRefreshing] = useState(false);
const navigate = useNavigate();
const today = new Date();
today.setHours(0, 0, 0, 0);
@ -172,15 +174,15 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => {
return (
<>
<div
className="dataTables_length text-start py-2 d-flex justify-content-between "
className="dataTables_length text-start py-2 d-flex flex-wrap justify-content-between"
id="DataTables_Table_0_length"
>
<div className="d-flex align-items-center my-0 ">
<div className="d-flex flex-wrap align-items-center my-0 gap-2">
<DateRangePicker
onRangeChange={setDateRange}
defaultStartDate={yesterday}
/>
<div className="form-check form-switch text-start ms-1 ms-md-2 align-items-center mb-0">
<div className="form-check form-switch text-start d-flex align-items-center mb-0">
<input
type="checkbox"
className="form-check-input"
@ -190,10 +192,11 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => {
checked={showPending}
onChange={(e) => setShowPending(e.target.checked)}
/>
<label className="form-check-label ms-0">Pending Attendance</label>
<label className="form-check-label ms-2 mb-0">Pending Attendance</label>
</div>
</div>
</div>
<div
className="table-responsive text-nowrap"
style={{ minHeight: "200px" }}
@ -260,7 +263,12 @@ const AttendanceLog = ({ handleModalData, searchTerm, organizationId }) => {
lastName={attendance.lastName}
/>
<div className="d-flex flex-column">
<a href="#" className="text-heading text-truncate">
<a
onClick={() =>
navigate(`/employee/${attendance.employeeId}?for=attendance`)
}
className="text-heading text-truncate cursor-pointer"
>
<span className="fw-normal">
{attendance.firstName} {attendance.lastName}
</span>

View File

@ -14,6 +14,7 @@ import {
} from "../../slices/apiDataManager";
import { useQueryClient } from "@tanstack/react-query";
import Pagination from "../../components/common/Pagination";
import { useNavigate } from "react-router-dom";
const Regularization = ({
handleRequest,
@ -26,6 +27,7 @@ const Regularization = ({
// var selectedProject = useSelector((store) => store.localVariables.projectId);
const selectedProject = useSelectedProject();
const [regularizesList, setregularizedList] = useState([]);
const navigate = useNavigate();
const { regularizes, loading, error, refetch } = useRegularizationRequests(
selectedProject,
organizationId,
@ -102,8 +104,9 @@ const Regularization = ({
}, [employeeHandler]);
return (
<div>
<div
className="table-responsive text-nowrap pb-4"
className="table-responsive pt-3 text-nowrap pb-4"
style={{ minHeight: "200px" }}
>
{loading ? (
@ -141,8 +144,11 @@ const Regularization = ({
<td colSpan={2}>
<div className="d-flex justify-content-start align-items-center">
<Avatar firstName={att.firstName} lastName={att.lastName} />
<div className="d-flex flex-column">
<a href="#" className="text-heading text-truncate">
<div className="d-flex flex-column"> <a
onClick={() =>
navigate(`/employee/${att.employeeId}?for=attendance`)
}
className="text-heading text-truncate cursor-pointer" >
<span className="fw-normal">
{att.firstName} {att.lastName}
</span>
@ -197,46 +203,7 @@ const Regularization = ({
</span>
</div>
)}
{/* {!loading && totalPages > 1 && (
<nav aria-label="Page ">
<ul className="pagination pagination-sm justify-content-end py-1 mt-3">
<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>
{totalPages > 0 && (
<Pagination
currentPage={currentPage}
@ -244,6 +211,7 @@ const Regularization = ({
onPageChange={paginate}
/>
)}
</div>
);
};

View File

@ -192,6 +192,7 @@ const TaskReportList = () => {
if (isLoading) return <TaskReportListSkeleton />;
if (isError) return <div>Loading....</div>;
return (
<div>
<div className="mt-2 table-responsive text-nowrap">
<table className="table">
<thead>
@ -287,13 +288,17 @@ const TaskReportList = () => {
))}
</tbody>
</table>
{data?.data?.length > 0 && (
</div>
{
data?.data?.length > 0 && (
<Pagination
currentPage={currentPage}
totalPages={data.totalPages}
onPageChange={paginate}
/>
)}
)
}
</div >
);
};

View File

@ -160,8 +160,7 @@ const ListViewContact = ({ data, Pagination }) => {
</div>
) : (
<i
className={`bx ${
isPending && activeContact === row.id
className={`bx ${isPending && activeContact === row.id
? "bx-loader-alt bx-spin"
: "bx-recycle"
} me-1 text-primary cursor-pointer`}
@ -188,14 +187,14 @@ const ListViewContact = ({ data, Pagination }) => {
)}
</tbody>
</table>
</div>
</div>
{Pagination && (
<div className="d-flex justify-content-start">
{Pagination}
</div>
)}
</div>
</div>
</div>
</>
);
};

View File

@ -15,6 +15,7 @@ import { ExpenseTableSkeleton } from "./ExpenseSkeleton";
import ConfirmModal from "../common/ConfirmModal";
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
import { useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
const [deletingId, setDeletingId] = useState(null);
@ -24,6 +25,7 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
const IsExpesneApprpve = useHasUserPermission(APPROVE_EXPENSE);
const [currentPage, setCurrentPage] = useState(1);
const debouncedSearch = useDebounce(searchText, 500);
const navigate = useNavigate();
const { mutate: DeleteExpense, isPending } = useDeleteExpense();
const { data, isLoading, isError, isInitialLoading, error } = useExpenseList(
@ -67,8 +69,7 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
key = item.status?.displayName || "Unknown";
break;
case "submittedBy":
key = `${item.createdBy?.firstName ?? ""} ${
item.createdBy?.lastName ?? ""
key = `${item.createdBy?.firstName ?? ""} ${item.createdBy?.lastName ?? ""
}`.trim();
break;
case "project":
@ -110,11 +111,11 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
label: "Submitted By",
align: "text-start",
getValue: (e) =>
`${e.createdBy?.firstName ?? ""} ${
e.createdBy?.lastName ?? ""
`${e.createdBy?.firstName ?? ""} ${e.createdBy?.lastName ?? ""
}`.trim() || "N/A",
customRender: (e) => (
<div className="d-flex align-items-center">
<div className="d-flex align-items-center cursor-pointer"
onClick={() => navigate(`/employee/${e.createdBy?.id}`)}>
<Avatar
size="xs"
classAvatar="m-0"
@ -122,8 +123,7 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
lastName={e.createdBy?.lastName}
/>
<span className="text-truncate">
{`${e.createdBy?.firstName ?? ""} ${
e.createdBy?.lastName ?? ""
{`${e.createdBy?.firstName ?? ""} ${e.createdBy?.lastName ?? ""
}`.trim() || "N/A"}
</span>
</div>
@ -152,8 +152,7 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
align: "text-center",
getValue: (e) => (
<span
className={`badge bg-label-${
getColorNameFromHex(e?.status?.color) || "secondary"
className={`badge bg-label-${getColorNameFromHex(e?.status?.color) || "secondary"
}`}
>
{e.status?.name || "Unknown"}
@ -299,6 +298,8 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
)}
</tbody>
</table>
</div>
</div>
{data?.data?.length > 0 && (
<Pagination
currentPage={currentPage}
@ -307,8 +308,6 @@ const ExpenseList = ({ filters, groupBy = "transactionDate", searchText }) => {
/>
)}
</div>
</div>
</div>
</>
);
};

View File

@ -179,10 +179,9 @@ const AttendancePage = () => {
</div>
{/* 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">
{/* Organization Dropdown */}
<div className="row">
<div className="col-12 col-sm-6 mb-2 mb-sm-0">
<div className="col-12 col-md-auto mt-2 mt-md-0 ms-md-auto">
<div className="row g-2">
<div className="col-12 col-sm-6">
<select
className="form-select form-select-sm"
value={appliedFilters.selectedOrganization}
@ -203,7 +202,6 @@ const AttendancePage = () => {
</select>
</div>
<div className="col-12 col-sm-6">
{/* Search Input */}
<input
type="text"
className="form-control form-control-sm"
@ -213,10 +211,8 @@ const AttendancePage = () => {
/>
</div>
</div>
</div>
</div>
</div>
@ -224,7 +220,7 @@ const AttendancePage = () => {
{selectedProject ? (
<>
{activeTab === "all" && (
<div className="tab-pane fade show active py-0 mx-5">
<div className="tab-pane fade show active py-0 mx-2">
<Attendance
handleModalData={handleModalData}
getRole={getRole}
@ -234,7 +230,7 @@ const AttendancePage = () => {
</div>
)}
{activeTab === "logs" && (
<div className="tab-pane fade show active py-0">
<div className="tab-pane fade p-3 show active py-0">
<AttendanceLog
handleModalData={handleModalData}
searchTerm={searchTerm}
@ -243,7 +239,7 @@ const AttendancePage = () => {
</div>
)}
{activeTab === "regularization" && DoRegularized && (
<div className="tab-pane fade show active py-0">
<div className="tab-pane fade p-3 show active py-0">
<Regularization
searchTerm={searchTerm}
organizationId={appliedFilters.selectedOrganization}

View File

@ -650,7 +650,8 @@ const EmployeeList = () => {
))}
</tbody>
</table>
</div>
</div>
{displayData?.length > 0 && (
<Pagination
currentPage={currentPage}
@ -659,8 +660,6 @@ const EmployeeList = () => {
/>
)}
</div>
</div>
</div>
) : (
<div className="card">
<div className="text-center">