From 92a09bfcf02714d769b67b30873d8b05d3a7369f Mon Sep 17 00:00:00 2001 From: Vikas Nale Date: Mon, 15 Dec 2025 11:45:43 +0530 Subject: [PATCH] Handle Date range in Expense Widget on dashboard Link Project to detail page in Attendance Report Widget --- src/components/Dashboard/ExpenseAnalysis.jsx | 25 ++++++++++---------- src/components/common/DateRangePicker.jsx | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/Dashboard/ExpenseAnalysis.jsx b/src/components/Dashboard/ExpenseAnalysis.jsx index 69797733..4fee4cde 100644 --- a/src/components/Dashboard/ExpenseAnalysis.jsx +++ b/src/components/Dashboard/ExpenseAnalysis.jsx @@ -53,17 +53,17 @@ const ExpenseAnalysis = () => { dataLabels: { enabled: true, formatter: (val) => `${val.toFixed(0)}%` }, colors: flatColors, tooltip: { - y: { - formatter: function (value) { - return formatCurrency(value); + y: { + formatter: function (value) { + return formatCurrency(value); + }, + }, + x: { + formatter: function (label) { + return label; + }, }, }, - x: { - formatter: function (label) { - return label; - }, - }, - }, plotOptions: { pie: { donut: { @@ -100,7 +100,7 @@ const ExpenseAnalysis = () => {
- +
@@ -152,7 +152,9 @@ const ExpenseAnalysis = () => { className="col-6" key={idx} style={{ - borderLeft: `3px solid ${flatColors[idx % flatColors.length]}`, + borderLeft: `3px solid ${ + flatColors[idx % flatColors.length] + }`, }} >
@@ -177,7 +179,6 @@ const ExpenseAnalysis = () => {
- ))} diff --git a/src/components/common/DateRangePicker.jsx b/src/components/common/DateRangePicker.jsx index ff293bde..d74b569f 100644 --- a/src/components/common/DateRangePicker.jsx +++ b/src/components/common/DateRangePicker.jsx @@ -93,6 +93,7 @@ export const DateRangePicker1 = ({ resetSignal, defaultRange = true, maxDate = null, + pastDays = 6, ...rest }) => { const inputRef = useRef(null); @@ -105,7 +106,7 @@ export const DateRangePicker1 = ({ const applyDefaultDates = () => { const today = new Date(); const past = new Date(); - past.setDate(today.getDate() - 6); + past.setDate(today.getDate() - pastDays); const format = (d) => flatpickr.formatDate(d, "d-m-Y"); const formattedStart = format(past);