From b3ff5cf055293f2621b2355f3ac131f166fdf36a Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 15 Feb 2022 09:02:14 +0000 Subject: [PATCH] Extract component for new Transaction --- web/src/components/TransactionInputRow.vue | 59 ++++++++++++++++++++++ web/src/pages/Account.vue | 49 +----------------- 2 files changed, 61 insertions(+), 47 deletions(-) create mode 100644 web/src/components/TransactionInputRow.vue diff --git a/web/src/components/TransactionInputRow.vue b/web/src/components/TransactionInputRow.vue new file mode 100644 index 0000000..1724dc3 --- /dev/null +++ b/web/src/components/TransactionInputRow.vue @@ -0,0 +1,59 @@ + + + \ No newline at end of file diff --git a/web/src/pages/Account.vue b/web/src/pages/Account.vue index dcc7905..d38b6b1 100644 --- a/web/src/pages/Account.vue +++ b/web/src/pages/Account.vue @@ -3,7 +3,7 @@ import { computed, ref } from "vue" import Autocomplete, { Suggestion } from '../components/Autocomplete.vue' import Currency from "../components/Currency.vue"; import TransactionRow from "../components/TransactionRow.vue"; -import { POST } from "../api"; +import TransactionInputRow from "../components/TransactionInputRow.vue"; import { useAccountStore } from "../stores/budget-account"; const props = defineProps<{ @@ -11,27 +11,6 @@ const props = defineProps<{ accountid: string }>() -const TransactionDate = ref(new Date().toISOString().substring(0, 10)); -const Payee = ref(undefined); -const Category = ref(undefined); -const Memo = ref(""); -const Amount = ref(0); - -function saveTransaction(e: MouseEvent) { - e.preventDefault(); - POST("/transaction/new", JSON.stringify({ - budget_id: props.budgetid, - account_id: props.accountid, - date: TransactionDate.value, - payee: Payee.value, - category: Category.value, - memo: Memo.value, - amount: Amount, - state: "Uncleared" - })) - .then(x => x.json()); -} - const accountStore = useAccountStore(); const CurrentAccount = computed(() => accountStore.CurrentAccount); const TransactionsList = computed(() => accountStore.TransactionsList); @@ -53,31 +32,7 @@ const TransactionsList = computed(() => accountStore.TransactionsList); - - - - - - - - - - - - - - - - - - - - - +