Show available income in Budgeting header
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
caf39fe5ea
commit
442e87234c
@ -68,6 +68,7 @@ function getGroupState(group: { Name: string, Expand: boolean }): boolean {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1>Budget for {{ selected.Month + 1 }}/{{ selected.Year }}</h1>
|
<h1>Budget for {{ selected.Month + 1 }}/{{ selected.Year }}</h1>
|
||||||
|
<span>Available balance: <Currency :value="accountStore.GetIncomeAvailable(selected.Year, selected.Month)" /></span>
|
||||||
<div>
|
<div>
|
||||||
<router-link
|
<router-link
|
||||||
:to="'/budget/' + CurrentBudgetID + '/budgeting/' + previous.Year + '/' + previous.Month"
|
:to="'/budget/' + CurrentBudgetID + '/budgeting/' + previous.Year + '/' + previous.Month"
|
||||||
|
@ -55,12 +55,25 @@ export const useAccountStore = defineStore("budget/account", {
|
|||||||
return category.AvailableLastMonth + Number(category.Assigned) + category.Activity;
|
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) {
|
CategoryGroupsForMonth(state) {
|
||||||
return (year: number, month: number) => {
|
return (year: number, month: number) => {
|
||||||
const categories = this.AllCategoriesForMonth(year, month);
|
const categories = this.AllCategoriesForMonth(year, month);
|
||||||
const categoryGroups = [];
|
const categoryGroups = [];
|
||||||
let prev = undefined;
|
let prev = undefined;
|
||||||
for (const category of categories) {
|
for (const category of categories) {
|
||||||
|
if (category.ID == this.GetIncomeCategoryID)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (category.Group != prev)
|
if (category.Group != prev)
|
||||||
categoryGroups.push({
|
categoryGroups.push({
|
||||||
Name: category.Group,
|
Name: category.Group,
|
||||||
|
@ -16,6 +16,7 @@ export interface Budget {
|
|||||||
ID: string
|
ID: string
|
||||||
Name: string
|
Name: string
|
||||||
AvailableBalance: number
|
AvailableBalance: number
|
||||||
|
IncomeCategoryID: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSessionStore = defineStore('session', {
|
export const useSessionStore = defineStore('session', {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user