Todays date is not visible in Daily Progress Report.

This commit is contained in:
Umesh Desai 2025-06-04 11:53:23 +05:30 committed by Vikas Nale
parent c553b36e25
commit 101baa2b78
6 changed files with 137 additions and 126 deletions

View File

@ -42,13 +42,13 @@ const Attendance = ({ attendance, getRole, handleModalData }) => {
<> <>
<table className="table "> <table className="table ">
<thead> <thead>
<tr className="border-top-0" style={{ textAlign: 'left' }}> <tr className="border-none" style={{ textAlign: 'left' }}>
<td > <td style={{ borderBottom: 'none' }}>
<strong>Date : {todayDate.toLocaleDateString('en-GB')}</strong> <strong>Date : {todayDate.toLocaleDateString('en-GB')}</strong>
</td> </td>
<td style={{ paddingLeft: '20px' }}> <td style={{ paddingLeft: '20px', borderBottom: 'none' }}></td>
</td>
</tr> </tr>
<tr> <tr>
<th className="border-top-0" colSpan={2}> <th className="border-top-0" colSpan={2}>
Name Name

View File

@ -122,6 +122,7 @@ const AttendanceLog = ({ handleModalData, projectId, showOnlyCheckout }) => {
return ( return (
<> <>
<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"
@ -138,7 +139,7 @@ const AttendanceLog = ({ handleModalData, projectId, showOnlyCheckout }) => {
/> />
</div> </div>
</div> </div>
<div className="table-responsive text-nowrap"> <div className="table-responsive text-nowrap" style={{ minHeight: "250px" }}>
{data && data.length > 0 && ( {data && data.length > 0 && (
<table className="table mb-0"> <table className="table mb-0">
<thead> <thead>
@ -217,6 +218,8 @@ const AttendanceLog = ({ handleModalData, projectId, showOnlyCheckout }) => {
}, [])} }, [])}
</tbody> </tbody>
</table> </table>
)} )}
{!loading && !isRefreshing && data.length === 0 && <span>No employee logs</span>} {!loading && !isRefreshing && data.length === 0 && <span>No employee logs</span>}
{error && !loading && !isRefreshing && ( {error && !loading && !isRefreshing && (

View File

@ -31,7 +31,7 @@ const Regularization = ({ handleRequest }) => {
); );
return ( return (
<div className="table-responsive text-nowrap"> <div className="table-responsive text-nowrap" style={{minHeight:"300px"}}>
<table className="table mb-0"> <table className="table mb-0">
<thead> <thead>
<tr> <tr>
@ -47,7 +47,7 @@ const Regularization = ({ handleRequest }) => {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{loading && <td colSpan={5}>Loading...</td>} {loading && <td colSpan={6} className="text-center py-5">Loading...</td>}
{!loading && {!loading &&
(regularizes?.length > 0 ? ( (regularizes?.length > 0 ? (
@ -88,12 +88,17 @@ const Regularization = ({ handleRequest }) => {
)) ))
) : ( ) : (
<tr> <tr>
<td colSpan={5}>No Record Found</td> <td colSpan={6}
className="text-center" style={{
height: "200px",
verticalAlign: "middle",
borderBottom: "none",
}}>No Record Found</td>
</tr> </tr>
))} ))}
</tbody> </tbody>
</table> </table>
{!loading && ( {!loading >10 && (
<nav aria-label="Page "> <nav aria-label="Page ">
<ul className="pagination pagination-sm justify-content-end py-1"> <ul className="pagination pagination-sm justify-content-end py-1">
<li className={`page-item ${currentPage === 1 ? "disabled" : ""}`}> <li className={`page-item ${currentPage === 1 ? "disabled" : ""}`}>
@ -107,8 +112,7 @@ const Regularization = ({ handleRequest }) => {
{[...Array(totalPages)].map((_, index) => ( {[...Array(totalPages)].map((_, index) => (
<li <li
key={index} key={index}
className={`page-item ${ className={`page-item ${currentPage === index + 1 ? "active" : ""
currentPage === index + 1 ? "active" : ""
}`} }`}
> >
<button <button
@ -120,8 +124,7 @@ const Regularization = ({ handleRequest }) => {
</li> </li>
))} ))}
<li <li
className={`page-item ${ className={`page-item ${currentPage === totalPages ? "disabled" : ""
currentPage === totalPages ? "disabled" : ""
}`} }`}
> >
<button <button

View File

@ -1,21 +1,27 @@
import React, { useEffect, useRef } from "react"; import React, { useEffect, useRef } from "react";
const DateRangePicker = ({ onRangeChange, DateDifference = 7, defaultStartDate = new Date() - 1 }) => { const DateRangePicker = ({
onRangeChange,
DateDifference = 7,
endDateMode = "yesterday", // "today" or "yesterday"
}) => {
const inputRef = useRef(null); const inputRef = useRef(null);
useEffect(() => { useEffect(() => {
const today = new Date();; const endDate = new Date();
today.setDate(today.getDate() - 1); if (endDateMode === "yesterday") {
const fifteenDaysAgo = new Date(); endDate.setDate(endDate.getDate() - 1);
}
fifteenDaysAgo.setDate(today.getDate() - DateDifference); const startDate = new Date();
startDate.setDate(endDate.getDate() - DateDifference);
const fp = flatpickr(inputRef.current, { const fp = flatpickr(inputRef.current, {
mode: "range", mode: "range",
dateFormat: "Y-m-d", // Format for backend (actual input value) dateFormat: "Y-m-d",
altInput: true, // Enables a visually different field altInput: true,
altFormat: "d-m-Y", altFormat: "d-m-Y",
defaultDate: [fifteenDaysAgo, today], defaultDate: [startDate, endDate],
static: true, static: true,
clickOpens: true, clickOpens: true,
onChange: (selectedDates, dateStr) => { onChange: (selectedDates, dateStr) => {
@ -25,16 +31,14 @@ const DateRangePicker = ({ onRangeChange, DateDifference = 7, defaultStartDate =
}); });
onRangeChange?.({ onRangeChange?.({
// startDate: fifteenDaysAgo.toISOString().split("T")[0], startDate: startDate.toLocaleDateString("en-CA"),
// endDate: today.toISOString().split("T")[0], endDate: endDate.toLocaleDateString("en-CA"),
startDate: fifteenDaysAgo.toLocaleDateString("en-CA"),
endDate: today.toLocaleDateString("en-CA"),
}); });
return () => { return () => {
fp.destroy(); fp.destroy();
}; };
}, [onRangeChange]); }, [onRangeChange, DateDifference, endDateMode]);
return ( return (
<input <input

View File

@ -141,6 +141,7 @@ const DailyTask = () => {
<div className="col-6 text-start"> <div className="col-6 text-start">
<DateRangePicker <DateRangePicker
onRangeChange={setDateRange} onRangeChange={setDateRange}
endDateMode="today"
DateDifference="6" DateDifference="6"
dateFormat="DD-MM-YYYY" dateFormat="DD-MM-YYYY"
/> />

View File

@ -141,7 +141,7 @@ const AttendancesEmployeeRecords = ({ employee }) => {
id="DataTables_Table_0_length" id="DataTables_Table_0_length"
> >
<div className="col-md-3 my-0 "> <div className="col-md-3 my-0 ">
<DateRangePicker onRangeChange={setDateRange} /> <DateRangePicker onRangeChange={setDateRange} endDateMode="yesterday"/>
</div> </div>
<div className="col-md-2 m-0 text-end"> <div className="col-md-2 m-0 text-end">
<i <i