This commit is contained in:
Jan Bader 2022-02-15 08:25:30 +00:00
parent e7a085273b
commit fe018e1953
2 changed files with 15 additions and 13 deletions

View File

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed, defineProps, onMounted, PropType, watch, watchEffect } from "vue";
import { computed, defineProps, watchEffect } from "vue";
import Currency from "../components/Currency.vue";
import { useBudgetsStore } from "../stores/budget";
import { useAccountStore } from "../stores/budget-account";
@ -22,6 +22,7 @@ const categoriesForMonth = useAccountStore().CategoriesForMonth;
const Categories = computed(() => {
return [...categoriesForMonth(selected.value.Year, selected.value.Month)];
});
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(),

View File

@ -55,9 +55,10 @@ export const useAccountStore = defineStore("budget/account", {
return [...state.Accounts.values()];
},
CategoriesForMonth: (state) => (year: number, month: number) => {
console.log("MTH", state.Months)
const yearMap = state.Months.get(year);
return [ ...yearMap?.get(month)?.values() || [] ];
const monthMap = yearMap?.get(month);
console.log("MTH", monthMap)
return [...monthMap?.values() || []];
},
CurrentAccount(state): Account | undefined {
if (state.CurrentAccountID == null)