Implement editing of transactions #23

Merged
jacob1123 merged 22 commits from edit-transaction into master 2022-02-25 23:35:12 +01:00
3 changed files with 10 additions and 2 deletions
Showing only changes of commit c864666eb6 - Show all commits

View File

@ -9,7 +9,7 @@ const props = defineProps<{
}>()
const TX = ref<Transaction>({
Date: new Date().toISOString().substring(0, 10),
Date: new Date(),
Memo: "",
Amount: 0,
Payee: "",

View File

@ -4,6 +4,7 @@ import { useBudgetsStore } from "../stores/budget";
import { Transaction } from "../stores/budget-account";
import Currency from "./Currency.vue";
import TransactionEditRow from "./TransactionEditRow.vue";
import { formatDate } from "../date";
const props = defineProps<{
transaction: Transaction,
@ -19,7 +20,7 @@ const CurrentBudgetID = computed(()=> useBudgetsStore().CurrentBudgetID);
<tr v-if="!edit" class="{{new Date(transaction.Date) > new Date() ? 'future' : ''}}"
:class="[index % 6 < 3 ? 'bg-gray-300' : 'bg-gray-100']">
<!--:class="[index % 6 < 3 ? index % 6 === 1 ? 'bg-gray-400' : 'bg-gray-300' : index % 6 !== 4 ? 'bg-gray-100' : '']">-->
<td>{{ transaction.Date.substring(0, 10) }}</td>
<td>{{ formatDate(transaction.Date) }}</td>
<td>{{ transaction.TransferAccount ? "Transfer : " + transaction.TransferAccount : transaction.Payee }}</td>
<td>
{{ transaction.CategoryGroup ? transaction.CategoryGroup + " : " + transaction.Category : "" }}

7
web/src/date.ts Normal file
View File

@ -0,0 +1,7 @@
export function formatDate(date: Date): string {
return date.toLocaleDateString(undefined, { // you can use undefined as first argument
year: "numeric",
month: "2-digit",
day: "2-digit",
});
}