Implement budgeting
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
@@ -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}));
|
||||
}
|
||||
},
|
||||
});
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user