Show available income in Budgeting header
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-03-04 21:31:13 +00:00
parent caf39fe5ea
commit 442e87234c
4 changed files with 16 additions and 1 deletions

View File

@ -55,12 +55,25 @@ export const useAccountStore = defineStore("budget/account", {
return category.AvailableLastMonth + Number(category.Assigned) + category.Activity;
}
},
GetIncomeCategoryID(state) {
const budget = useBudgetsStore();
return budget.CurrentBudget?.IncomeCategoryID;
},
GetIncomeAvailable(state) {
return (year: number, month: number) => {
const categories = this.AllCategoriesForMonth(year, month);
return categories.filter(x => x.ID == this.GetIncomeCategoryID)[0].AvailableLastMonth;
}
},
CategoryGroupsForMonth(state) {
return (year: number, month: number) => {
const categories = this.AllCategoriesForMonth(year, month);
const categoryGroups = [];
let prev = undefined;
for (const category of categories) {
if (category.ID == this.GetIncomeCategoryID)
continue;
if (category.Group != prev)
categoryGroups.push({
Name: category.Group,

View File

@ -16,6 +16,7 @@ export interface Budget {
ID: string
Name: string
AvailableBalance: number
IncomeCategoryID: string
}
export const useSessionStore = defineStore('session', {

View File

@ -39,7 +39,7 @@ export const useTransactionsStore = defineStore("budget/transactions", {
return reconciledBalance;
},
TransactionsList(state): Transaction[] {
const accountsStore = useAccountStore()
const accountsStore = useAccountStore()
return accountsStore.CurrentAccount!.Transactions.map(x => {
return this.Transactions.get(x)!
});