From 6dd8a3791fa1c3426fec294fc3bafcf3238849b2 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 1 Mar 2022 08:36:03 +0000 Subject: [PATCH] Use grid instead of table --- web/src/pages/Budgeting.vue | 69 +++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/web/src/pages/Budgeting.vue b/web/src/pages/Budgeting.vue index b1d05ac..1c5332c 100644 --- a/web/src/pages/Budgeting.vue +++ b/web/src/pages/Budgeting.vue @@ -17,7 +17,7 @@ const CurrentBudgetID = computed(() => budgetsStore.CurrentBudgetID); const accountStore = useAccountStore(); const categoriesForMonth = accountStore.CategoriesForMonthAndGroup; -function GetCategories(group : string) { +function GetCategories(group: string) { return [...categoriesForMonth(selected.value.Year, selected.value.Month, group)]; }; @@ -28,20 +28,20 @@ const GroupsForMonth = computed(() => { const previous = computed(() => ({ - Year: new Date(selected.value.Year, selected.value.Month - 1, 1).getFullYear(), - Month: new Date(selected.value.Year, selected.value.Month - 1, 1).getMonth(), + Year: new Date(selected.value.Year, selected.value.Month - 1, 1).getFullYear(), + Month: new Date(selected.value.Year, selected.value.Month - 1, 1).getMonth(), })); const current = computed(() => ({ - Year: new Date().getFullYear(), - Month: new Date().getMonth(), + Year: new Date().getFullYear(), + Month: new Date().getMonth(), })); const selected = computed(() => ({ - Year: Number(props.year) ?? current.value.Year, - Month: Number(props.month ?? current.value.Month) + Year: Number(props.year) ?? current.value.Year, + Month: Number(props.month ?? current.value.Month) })); const next = computed(() => ({ - Year: new Date(selected.value.Year, Number(props.month) + 1, 1).getFullYear(), - Month: new Date(selected.value.Year, Number(props.month) + 1, 1).getMonth(), + Year: new Date(selected.value.Year, Number(props.month) + 1, 1).getFullYear(), + Month: new Date(selected.value.Year, Number(props.month) + 1, 1).getMonth(), })); watchEffect(() => { @@ -56,12 +56,12 @@ onMounted(() => { const expandedGroups = ref>(new Map()) -function toggleGroup(group : {Name : string, Expand: boolean}) { +function toggleGroup(group: { Name: string, Expand: boolean }) { console.log(expandedGroups.value); expandedGroups.value.set(group.Name, !(expandedGroups.value.get(group.Name) ?? group.Expand)) } -function getGroupState(group : {Name : string, Expand: boolean}) : boolean { +function getGroupState(group: { Name: string, Expand: boolean }): boolean { return expandedGroups.value.get(group.Name) ?? group.Expand; } @@ -79,31 +79,24 @@ function getGroupState(group : {Name : string, Expand: boolean}) : boolean { :to="'/budget/' + CurrentBudgetID + '/budgeting/' + next.Year + '/' + next.Month" >Next Month - - - - - - - - - - - - - - - - - - -
CategoryAssignedActivityAvailable
{{ (getGroupState(group) ? "−" : "+") + " " + group.Name }}
{{ category.Name }} - - - - - -
+
+ Category + + Assigned + Activity + Available + +