Update TransactionInputRow to new models
This commit is contained in:
parent
be3829baf8
commit
306edbf817
@ -1,27 +1,42 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import Autocomplete, { Suggestion } from '../components/Autocomplete.vue'
|
import Autocomplete, { Suggestion } from '../components/Autocomplete.vue'
|
||||||
import { useAccountStore } from '../stores/budget-account'
|
import { Transaction, useAccountStore } from '../stores/budget-account'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
budgetid: string
|
budgetid: string
|
||||||
accountid: string
|
accountid: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const TransactionDate = ref(new Date().toISOString().substring(0, 10));
|
const TX = ref<Transaction>({
|
||||||
const Payee = ref<Suggestion | undefined>(undefined);
|
Date: new Date().toISOString().substring(0, 10),
|
||||||
const Category = ref<Suggestion | undefined>(undefined);
|
Memo: "",
|
||||||
const Memo = ref("");
|
Amount: 0,
|
||||||
const Amount = ref("0");
|
Payee: "",
|
||||||
|
PayeeID: undefined,
|
||||||
|
Category: "",
|
||||||
|
CategoryID: undefined,
|
||||||
|
CategoryGroup: "",
|
||||||
|
GroupID: "",
|
||||||
|
ID: "",
|
||||||
|
Status: "Uncleared",
|
||||||
|
TransferAccount: "",
|
||||||
|
});
|
||||||
|
|
||||||
const payload = computed(() => JSON.stringify({
|
const payload = computed(() => JSON.stringify({
|
||||||
budgetId: props.budgetid,
|
budgetId: props.budgetid,
|
||||||
accountId: props.accountid,
|
accountId: props.accountid,
|
||||||
date: TransactionDate.value,
|
date: TX.value.Date,
|
||||||
payee: Payee.value,
|
payee: {
|
||||||
category: Category.value,
|
Name: TX.value.Payee,
|
||||||
memo: Memo.value,
|
ID: TX.value.PayeeID,
|
||||||
amount: Amount.value,
|
},
|
||||||
|
category: {
|
||||||
|
Name: TX.value.Category,
|
||||||
|
ID: TX.value.CategoryID,
|
||||||
|
},
|
||||||
|
memo: TX.value.Memo,
|
||||||
|
amount: TX.value.Amount,
|
||||||
state: "Uncleared"
|
state: "Uncleared"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -35,22 +50,22 @@ function saveTransaction(e: MouseEvent) {
|
|||||||
<template>
|
<template>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 90px;" class="text-sm">
|
<td style="width: 90px;" class="text-sm">
|
||||||
<input class="border-b-2 border-black" type="date" v-model="TransactionDate" />
|
<input class="border-b-2 border-black" type="date" v-model="TX.Date" />
|
||||||
</td>
|
</td>
|
||||||
<td style="max-width: 150px;">
|
<td style="max-width: 150px;">
|
||||||
<Autocomplete v-model="Payee" type="payees" />
|
<Autocomplete v-model:text="TX.Payee" v-model:id="TX.PayeeID" type="payees" />
|
||||||
</td>
|
</td>
|
||||||
<td style="max-width: 200px;">
|
<td style="max-width: 200px;">
|
||||||
<Autocomplete v-model="Category" type="categories" />
|
<Autocomplete v-model:text="TX.Category" v-model:id="TX.CategoryID" type="categories" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="block w-full border-b-2 border-black" type="text" v-model="Memo" />
|
<input class="block w-full border-b-2 border-black" type="text" v-model="TX.Memo" />
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 80px;" class="text-right">
|
<td style="width: 80px;" class="text-right">
|
||||||
<input
|
<input
|
||||||
class="text-right block w-full border-b-2 border-black"
|
class="text-right block w-full border-b-2 border-black"
|
||||||
type="currency"
|
type="currency"
|
||||||
v-model="Amount"
|
v-model="TX.Amount"
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 20px;">
|
<td style="width: 20px;">
|
||||||
|
@ -18,12 +18,12 @@ export interface Transaction {
|
|||||||
TransferAccount: string,
|
TransferAccount: string,
|
||||||
CategoryGroup: string,
|
CategoryGroup: string,
|
||||||
Category: string,
|
Category: string,
|
||||||
CategoryID: string,
|
CategoryID: string | undefined,
|
||||||
Memo: string,
|
Memo: string,
|
||||||
Status: string,
|
Status: string,
|
||||||
GroupID: string,
|
GroupID: string,
|
||||||
Payee: string,
|
Payee: string,
|
||||||
PayeeID: string,
|
PayeeID: string | undefined,
|
||||||
Amount: number,
|
Amount: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user