Implement budgeting
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing

This commit is contained in:
2022-09-23 21:01:40 +00:00
parent 31a4135f2e
commit 88283a8817
5 changed files with 20 additions and 17 deletions

View File

@@ -41,9 +41,13 @@ export const useBudgetsStore = defineStore("budget", {
sessionStore.Budgets.set(response.ID, response);
},
async SetCurrentBudget(budgetid: string): Promise<void> {
if(this.CurrentBudgetID == budgetid)
return;
this.CurrentBudgetID = budgetid;
if (budgetid == null) return;
if (budgetid == null)
return;
await this.FetchBudget(budgetid);
},

View File

@@ -49,5 +49,11 @@ export const useCategoryStore = defineStore("category", {
this.Categories.set(category.ID, category);
}
},
async SetAssigned(category : Category, year : number, month : number, assigned : number){
this.Categories.get(category.ID)!.Assigned = assigned;
const currentBudgetID = useBudgetsStore().CurrentBudgetID;
await POST("/budget/"+currentBudgetID+"/category/" + category.ID + "/" + year + "/" + (month+1),
JSON.stringify({Assigned: assigned}));
}
},
});

View File

@@ -130,18 +130,15 @@ export const useTransactionsStore = defineStore("budget/transactions", {
const recTrans = response.ReconciliationTransaction;
if (recTrans) {
this.AddTransactions([recTrans]);
account.Transactions.unshift(recTrans.ID);
}
},
logout() {
this.$reset();
},
async saveTransaction(payload: string) {
const accountsStore = useAccountStore();
const result = await POST("/transaction/new", payload);
const response = (await result.json()) as Transaction;
this.AddTransactions([response]);
accountsStore.CurrentAccount?.Transactions.unshift(response.ID);
},
async editTransaction(transactionid: string, payload: string) {
const result = await POST("/transaction/" + transactionid, payload);