Handle Date range in Expense Widget on dashboard

Link Project to detail page in Attendance Report Widget
This commit is contained in:
Vikas Nale 2025-12-15 11:45:43 +05:30
parent 4f9fa1b7c2
commit 92a09bfcf0
2 changed files with 15 additions and 13 deletions

View File

@ -53,17 +53,17 @@ const ExpenseAnalysis = () => {
dataLabels: { enabled: true, formatter: (val) => `${val.toFixed(0)}%` }, dataLabels: { enabled: true, formatter: (val) => `${val.toFixed(0)}%` },
colors: flatColors, colors: flatColors,
tooltip: { tooltip: {
y: { y: {
formatter: function (value) { formatter: function (value) {
return formatCurrency(value); return formatCurrency(value);
},
},
x: {
formatter: function (label) {
return label;
},
}, },
}, },
x: {
formatter: function (label) {
return label;
},
},
},
plotOptions: { plotOptions: {
pie: { pie: {
donut: { donut: {
@ -100,7 +100,7 @@ const ExpenseAnalysis = () => {
<div className="text-end text-sm-end"> <div className="text-end text-sm-end">
<FormProvider {...methods}> <FormProvider {...methods}>
<DateRangePicker1 /> <DateRangePicker1 pastDays="30" />
</FormProvider> </FormProvider>
</div> </div>
</div> </div>
@ -152,7 +152,9 @@ const ExpenseAnalysis = () => {
className="col-6" className="col-6"
key={idx} key={idx}
style={{ style={{
borderLeft: `3px solid ${flatColors[idx % flatColors.length]}`, borderLeft: `3px solid ${
flatColors[idx % flatColors.length]
}`,
}} }}
> >
<div className="d-flex flex-column text-start"> <div className="d-flex flex-column text-start">
@ -177,7 +179,6 @@ const ExpenseAnalysis = () => {
</span> </span>
</div> </div>
</div> </div>
))} ))}
</div> </div>
</div> </div>

View File

@ -93,6 +93,7 @@ export const DateRangePicker1 = ({
resetSignal, resetSignal,
defaultRange = true, defaultRange = true,
maxDate = null, maxDate = null,
pastDays = 6,
...rest ...rest
}) => { }) => {
const inputRef = useRef(null); const inputRef = useRef(null);
@ -105,7 +106,7 @@ export const DateRangePicker1 = ({
const applyDefaultDates = () => { const applyDefaultDates = () => {
const today = new Date(); const today = new Date();
const past = 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 format = (d) => flatpickr.formatDate(d, "d-m-Y");
const formattedStart = format(past); const formattedStart = format(past);