-
-
-
-
New Budget
-
-
-
-
-
- Close
- Save
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/web/src/pages/Account.vue b/web/src/pages/Account.vue
index af169bf..2106f6c 100644
--- a/web/src/pages/Account.vue
+++ b/web/src/pages/Account.vue
@@ -4,19 +4,54 @@ import Currency from "../components/Currency.vue";
import TransactionRow from "../components/TransactionRow.vue";
import TransactionInputRow from "../components/TransactionInputRow.vue";
import { useAccountStore } from "../stores/budget-account";
+import Modal from "../components/Modal.vue";
const props = defineProps<{
- budgetid: string
- accountid: string
+ budgetid: string
+ accountid: string
}>()
const accountStore = useAccountStore();
const CurrentAccount = computed(() => accountStore.CurrentAccount);
const TransactionsList = computed(() => accountStore.TransactionsList);
+
+const accountName = ref("");
+const accountOnBudget = ref(true);
+
+function editAccount(e : any) {
+ accountStore.EditAccount(CurrentAccount.value?.ID ?? "", accountName.value, accountOnBudget.value);
+}
+
+function openEditAccount(e : any) {
+ accountName.value = CurrentAccount.value?.Name ?? "";
+ accountOnBudget.value = CurrentAccount.value?.OnBudget ?? true;
+}
- {{ CurrentAccount?.Name }}
+ {{ CurrentAccount?.Name }}
+
+ ✎
+
+
+
+
+
+ On Budget
+
+
+
Current Balance:
diff --git a/web/src/stores/budget-account.ts b/web/src/stores/budget-account.ts
index be57f7d..c612c0d 100644
--- a/web/src/stores/budget-account.ts
+++ b/web/src/stores/budget-account.ts
@@ -1,5 +1,6 @@
import { defineStore } from "pinia"
import { GET, POST } from "../api";
+import { useBudgetsStore } from "./budget";
import { useSessionStore } from "./session";
interface State {
@@ -124,6 +125,11 @@ export const useAccountStore = defineStore("budget/account", {
return;
this.addCategoriesForMonth(year, month, response.Categories);
},
+ async EditAccount(accountid : string, name : string, onBudget : boolean) {
+ const result = await POST("/account/" + accountid, JSON.stringify({name: name, onBudget: onBudget}));
+ const response = await result.json();
+ useBudgetsStore().MergeBudgetingData(response);
+ },
addCategoriesForMonth(year: number, month: number, categories: Category[]): void {
this.$patch((state) => {
const yearMap = state.Months.get(year) || new Map>();
diff --git a/web/src/stores/budget.ts b/web/src/stores/budget.ts
index 2d3d1be..919996f 100644
--- a/web/src/stores/budget.ts
+++ b/web/src/stores/budget.ts
@@ -51,6 +51,9 @@ export const useBudgetsStore = defineStore('budget', {
async FetchBudget(budgetid: string) {
const result = await GET("/budget/" + budgetid);
const response = await result.json();
+ this.MergeBudgetingData(response);
+ },
+ MergeBudgetingData(response : any) {
for (const account of response.Accounts || []) {
useAccountStore().Accounts.set(account.ID, account);
}