This commit is contained in:
2022-02-10 16:07:29 +00:00
parent c693625e34
commit 21dcd7837b
8 changed files with 46 additions and 38 deletions

View File

@ -4,6 +4,7 @@ import { defineComponent } from "vue"
import Autocomplete, { Suggestion } from '../components/Autocomplete.vue'
import Currency from "../components/Currency.vue";
import TransactionRow from "../components/TransactionRow.vue";
import { useAPI } from "../stores/api";
import { useAccountStore } from "../stores/budget-account";
import { useSessionStore } from "../stores/session";
@ -25,9 +26,8 @@ export default defineComponent({
methods: {
saveTransaction(e : MouseEvent) {
e.preventDefault();
fetch("/api/v1/transaction/new", {
method: "POST",
body: JSON.stringify({
const api = useAPI();
api.POST("/transaction/new", JSON.stringify({
budget_id: this.budgetid,
account_id: this.accountid,
date: this.$data.TransactionDate,
@ -36,9 +36,7 @@ export default defineComponent({
memo: this.$data.Memo,
amount: this.$data.Amount,
state: "Uncleared"
}),
headers: useSessionStore().AuthHeaders,
})
}))
.then(x => x.json());
},
}

View File

@ -12,7 +12,7 @@ interface Date {
export default defineComponent({
mounted() {
document.title = "Budgeteer - Budget for " + this.month + " " + this.year;
document.title = "Budgeteer - Budget for " + this.selected.Month + "/" + this.selected.Year;
return useAccountStore().FetchMonthBudget(this.budgetid, this.year, this.month);
},
watch: {
@ -27,7 +27,9 @@ export default defineComponent({
computed: {
...mapState(useBudgetsStore, ["CurrentBudgetID"]),
Categories() : IterableIterator<Category> | undefined {
return useAccountStore().Categories(this.year, this.month);
const accountStore = useAccountStore();
console.log(accountStore.CategoriesForMonth(this.year, this.month));
return accountStore.CategoriesForMonth(this.year, this.month);
},
previous(): Date {
return {

View File

@ -36,7 +36,7 @@ export default defineComponent({
return;
const api = useAPI();
api.DELETE("/api/v1/budget/" + currentBudgetID);
api.DELETE("/budget/" + currentBudgetID);
const budgetStore = useSessionStore();
budgetStore.Budgets.delete(currentBudgetID);
@ -45,7 +45,7 @@ export default defineComponent({
clearBudget() {
const currentBudgetID = useBudgetsStore().CurrentBudgetID;
const api = useAPI();
api.POST("/api/v1/budget/" + currentBudgetID + "/settings/clear", null)
api.POST("/budget/" + currentBudgetID + "/settings/clear", null)
},
cleanNegative() {
// <a href="/budget/{{.Budget.ID}}/settings/clean-negative">Fix all historic negative category-balances</a>