Properly updateExpense time line

This commit is contained in:
pramod.mahajan 2025-11-06 09:10:30 +05:30
parent 82f173c0ed
commit 06e8046dde
2 changed files with 4 additions and 7 deletions

View File

@ -12,15 +12,14 @@ const ExpenseStatusLogs = ({ data }) => {
return [...data.expenseLogs].sort( return [...data.expenseLogs].sort(
(a, b) => new Date(b.updateAt) - new Date(a.updateAt) (a, b) => new Date(b.updateAt) - new Date(a.updateAt)
); );
}, [data?.updateLogs]); }, [data?.expenseLogs]);
const logsToShow = useMemo( const logsToShow = useMemo(
() => sortedLogs.slice(0, visibleCount), () => sortedLogs.slice(0, visibleCount),
[sortedLogs, visibleCount] [sortedLogs, visibleCount]
); );
console.log(logsToShow) console.log(logsToShow);
const timelineData = useMemo(() => { const timelineData = useMemo(() => {
return logsToShow.map((log, index) => ({ return logsToShow.map((log, index) => ({
id: index + 1, id: index + 1,
title: log.action || "Status Updated", title: log.action || "Status Updated",
@ -46,8 +45,6 @@ console.log(logsToShow)
return ( return (
<div className="page-min-h overflow-auto py-1"> <div className="page-min-h overflow-auto py-1">
<Timeline items={timelineData} /> <Timeline items={timelineData} />
</div> </div>
); );

View File

@ -152,9 +152,9 @@ const ViewExpense = ({ ExpenseId }) => {
className="form-label me-2 mb-0 fw-semibold text-start" className="form-label me-2 mb-0 fw-semibold text-start"
style={{ minWidth: "130px" }} style={{ minWidth: "130px" }}
> >
Expense Type : Expense Category :
</label> </label>
<div className="text-muted">{data?.expensesType?.name}</div> <div className="text-muted">{data?.expenseCategory?.name}</div>
</div> </div>
</div> </div>