Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and organize reports #2274

Merged
merged 29 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
afa1c4b
Add schema work
carkom Jan 18, 2024
27f9138
notes
carkom Jan 18, 2024
d362e92
Merge branch 'master' into createReportsSchema
carkom Jan 19, 2024
41dcc69
merge fixes
carkom Jan 19, 2024
cf364e1
Add Reports Save Menu
carkom Jan 19, 2024
71d3b05
Merge remote-tracking branch 'upstream/master' into addSaveReportsMenu
carkom Jan 20, 2024
71b987d
merge fixes
carkom Jan 20, 2024
4f60551
updates
carkom Jan 20, 2024
89579f1
notes
carkom Jan 20, 2024
e961ef6
Merge branch 'master' into addSaveReportsMenu
carkom Jan 21, 2024
be8723b
updates
carkom Jan 22, 2024
5fc710f
Merge branch 'master' into addSaveReportsMenu
carkom Jan 22, 2024
1999b65
updates
carkom Jan 22, 2024
6c395cb
save updates fix
carkom Jan 22, 2024
d49d3dd
typecheck fixes
carkom Jan 22, 2024
493f92c
revert changes
carkom Jan 22, 2024
892559b
notes
carkom Jan 22, 2024
905c225
error fixes
carkom Jan 22, 2024
15f7e18
update
carkom Jan 23, 2024
31afdaa
fix
carkom Jan 23, 2024
2f05644
Merge branch 'master' into updateOrganizeReports
carkom Jan 23, 2024
7bc360c
Merge branch 'master' into updateOrganizeReports
carkom Jan 26, 2024
8c177a6
merge fixes
carkom Jan 26, 2024
fe28b22
review changes
carkom Jan 31, 2024
14a4a54
Merge branch 'master' into updateOrganizeReports
carkom Jan 31, 2024
a83440c
reportChange and savedStatus
carkom Feb 1, 2024
2d6d410
Update packages/desktop-client/src/components/reports/SaveReport.tsx
carkom Feb 1, 2024
e336d32
Merge branch 'master' into updateOrganizeReports
carkom Feb 2, 2024
c118e11
merge fixes
carkom Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,13 @@ export function AppliedFilters({
onDelete,
conditionsOp,
onCondOpChange,
onUpdateChange,
}) {
const onUpdateAppliedFilter = (filter, newFilter) => {
onUpdateChange?.(null, 'modify');
carkom marked this conversation as resolved.
Show resolved Hide resolved
return onUpdate(filter, newFilter);
};

return (
<View
style={{
Expand All @@ -617,7 +623,7 @@ export function AppliedFilters({
value={filter.value}
options={filter.options}
editing={editingFilter === filter}
onChange={newFilter => onUpdate(filter, newFilter)}
onChange={newFilter => onUpdateAppliedFilter(filter, newFilter)}
onDelete={() => onDelete(filter)}
/>
))}
Expand Down
16 changes: 9 additions & 7 deletions packages/desktop-client/src/components/reports/ReportOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import {
const startDate = monthUtils.subMonths(monthUtils.currentMonth(), 5);
const endDate = monthUtils.currentMonth();

export const defaultState: CustomReportEntity = {
export const defaultReport: CustomReportEntity = {
id: undefined,
name: 'Default',
startDate,
endDate,
isDateStatic: false,
dateRange: 'Last 6 months',
mode: 'total',
groupBy: 'Category',
balanceType: 'Payment',
showEmpty: false,
showOffBudgetHidden: false,
showOffBudget: false,
showUncategorized: false,
selectedCategories: [],
graphType: 'BarGraph',
startDate,
endDate,
selectedCategories: null,
isDateStatic: false,
conditions: [],
conditionsOp: 'and',
name: 'Default',
};

const balanceTypeOptions = [
Expand Down
27 changes: 17 additions & 10 deletions packages/desktop-client/src/components/reports/ReportSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ export function ReportSidebar({
setMode,
setIsDateStatic,
setShowEmpty,
setShowOffBudgetHidden,
setShowOffBudget,
setShowUncategorized,
setSelectedCategories,
onChangeDates,
onChangeViews,
onReportChange,
}) {
const [menuOpen, setMenuOpen] = useState(false);
const onSelectRange = cond => {
onReportChange(null, 'modify');
setDateRange(cond);
switch (cond) {
case 'All time':
Expand Down Expand Up @@ -76,6 +78,7 @@ export function ReportSidebar({
};

const onChangeMode = cond => {
onReportChange(null, 'modify');
setMode(cond);
if (cond === 'time') {
if (customReportItems.graphType === 'TableGraph') {
Expand Down Expand Up @@ -106,6 +109,7 @@ export function ReportSidebar({
};

const onChangeSplit = cond => {
onReportChange(null, 'modify');
setGroupBy(cond);
if (customReportItems.mode === 'total') {
if (customReportItems.graphType !== 'TableGraph') {
Expand All @@ -122,6 +126,11 @@ export function ReportSidebar({
}
};

const onChangeBalanceType = cond => {
onReportChange(null, 'modify');
setBalanceType(cond);
};

return (
<View
style={{
Expand Down Expand Up @@ -205,7 +214,7 @@ export function ReportSidebar({
</Text>
<Select
value={customReportItems.balanceType}
onChange={setBalanceType}
onChange={e => onChangeBalanceType(e)}
options={ReportOptions.balanceType.map(option => [
option.description,
option.description,
Expand Down Expand Up @@ -265,11 +274,9 @@ export function ReportSidebar({
>
<Menu
onMenuSelect={type => {
if (type === 'show-hidden-categories') {
setShowOffBudgetHidden(
!customReportItems.showOffBudgetHidden,
);
} else if (type === 'show-empty-rows') {
if (type === 'show-off-budget') {
setShowOffBudget(!customReportItems.showOffBudget);
} else if (type === 'show-empty-items') {
setShowEmpty(!customReportItems.showEmpty);
} else if (type === 'show-uncategorized') {
setShowUncategorized(
Expand All @@ -279,16 +286,16 @@ export function ReportSidebar({
}}
items={[
{
name: 'show-empty-rows',
name: 'show-empty-items',
text: 'Show Empty Rows',
tooltip: 'Show rows that are zero or blank',
toggle: customReportItems.showEmpty,
},
{
name: 'show-hidden-categories',
name: 'show-off-budget',
text: 'Show Off Budget',
tooltip: 'Show off budget accounts and hidden categories',
toggle: customReportItems.showOffBudgetHidden,
toggle: customReportItems.showOffBudget,
},
{
name: 'show-uncategorized',
Expand Down
13 changes: 11 additions & 2 deletions packages/desktop-client/src/components/reports/ReportTopbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { SaveReportMenuButton } from './SaveReport';

export function ReportTopbar({
customReportItems,
savedStatus,
setGraphType,
setTypeDisabled,
setBalanceType,
Expand All @@ -27,6 +28,7 @@ export function ReportTopbar({
viewLabels,
onApplyFilter,
onChangeViews,
onReportChange,
}) {
return (
<View
Expand Down Expand Up @@ -158,10 +160,17 @@ export function ReportTopbar({
marginRight: 15,
flexShrink: 0,
}}
/>{' '}
<FilterButton
compact
hover
onApply={e => {
onApplyFilter(e);
onReportChange(null, 'modify');
}}
/>
<FilterButton onApply={onApplyFilter} compact hover />
<View style={{ flex: 1 }} />
<SaveReportMenuButton />
<SaveReportMenuButton savedStatus={savedStatus} />
</View>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function SaveReportMenu({ setMenuOpen }) {
);
}

export function SaveReportMenuButton() {
export function SaveReportMenuButton(savedStatus: string) {
carkom marked this conversation as resolved.
Show resolved Hide resolved
const [menuOpen, setMenuOpen] = useState(false);

return (
Expand All @@ -65,6 +65,7 @@ export function SaveReportMenuButton() {
>
Unsaved Report&nbsp;
</Text>
{savedStatus === 'modified' && <Text>(modified)&nbsp;</Text>}
<SvgExpandArrow width={8} height={8} style={{ marginRight: 5 }} />
</Button>
{menuOpen && <SaveReportMenu setMenuOpen={setMenuOpen} />}
Expand Down
Loading
Loading