From be8723bd7a9f91c56bf44eaaa4e8ae97d8bb62e3 Mon Sep 17 00:00:00 2001 From: carkom Date: Mon, 22 Jan 2024 08:50:58 +0000 Subject: [PATCH] updates --- .../src/components/reports/ReportOptions.ts | 13 ++-- .../src/components/reports/ReportSidebar.jsx | 28 ++++---- .../src/components/reports/ReportTopbar.jsx | 10 +-- .../src/components/reports/SaveReport.tsx | 17 +++-- .../src/components/reports/SaveReportMenu.tsx | 18 ++--- .../src/components/reports/SaveReportName.tsx | 2 +- .../reports/reports/CustomReport.jsx | 70 +++++++++++-------- .../loot-core/src/types/models/reports.d.ts | 16 +++-- 8 files changed, 97 insertions(+), 77 deletions(-) diff --git a/packages/desktop-client/src/components/reports/ReportOptions.ts b/packages/desktop-client/src/components/reports/ReportOptions.ts index a7c0332d1de..35165d237b0 100644 --- a/packages/desktop-client/src/components/reports/ReportOptions.ts +++ b/packages/desktop-client/src/components/reports/ReportOptions.ts @@ -12,19 +12,20 @@ const endDate = monthUtils.currentMonth(); export const defaultReport: CustomReportEntity = { id: undefined, + name: undefined, + startDate, + endDate, + isDateStatic: false, + dateRange: 'Last 6 months', mode: 'total', groupBy: 'Category', balanceType: 'Payment', showEmpty: false, - showOffBudgetHidden: false, + showOffBudget: false, showUncategorized: false, - graphType: 'BarGraph', - startDate, - endDate, selectedCategories: null, - isDateStatic: false, + graphType: 'BarGraph', conditionsOp: 'and', - name: 'Default', }; const balanceTypeOptions = [ diff --git a/packages/desktop-client/src/components/reports/ReportSidebar.jsx b/packages/desktop-client/src/components/reports/ReportSidebar.jsx index a0a3b06797a..bac9e97f1a7 100644 --- a/packages/desktop-client/src/components/reports/ReportSidebar.jsx +++ b/packages/desktop-client/src/components/reports/ReportSidebar.jsx @@ -38,10 +38,10 @@ export function ReportSidebar({ setSelectedCategories, onChangeDates, onChangeViews, - setSavedStatus, + onReportChange, }) { const onSelectRange = cond => { - setSavedStatus('changed'); + onReportChange(null, 'modify'); setDateRange(cond); switch (cond) { case 'All time': @@ -75,7 +75,7 @@ export function ReportSidebar({ }; const onChangeMode = cond => { - setSavedStatus('changed'); + onReportChange(null, 'modify'); setMode(cond); if (cond === 'time') { if (customReportItems.graphType === 'TableGraph') { @@ -106,7 +106,7 @@ export function ReportSidebar({ }; const onChangeSplit = cond => { - setSavedStatus('changed'); + onReportChange(null, 'modify'); setGroupBy(cond); if (customReportItems.mode === 'total') { if (customReportItems.graphType !== 'TableGraph') { @@ -124,7 +124,7 @@ export function ReportSidebar({ }; const onChangeBalanceType = cond => { - setSavedStatus('changed'); + onReportChange(null, 'modify'); setBalanceType(cond); }; @@ -258,7 +258,7 @@ export function ReportSidebar({ value={customReportItems.showEmpty} onChange={() => { setShowEmpty(!customReportItems.showEmpty); - setSavedStatus('changed'); + onReportChange(null, 'modify'); }} />