From 67c9b53e91abab5e0b048f95043449dce8cdce28 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 1 Mar 2022 20:11:59 +0000 Subject: [PATCH] Extract date to own row on small screens --- web/src/components/TransactionRow.vue | 39 ++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/web/src/components/TransactionRow.vue b/web/src/components/TransactionRow.vue index b182273..d5f2fff 100644 --- a/web/src/components/TransactionRow.vue +++ b/web/src/components/TransactionRow.vue @@ -5,6 +5,7 @@ import { useTransactionsStore } from "../stores/transactions"; import Currency from "./Currency.vue"; import TransactionEditRow from "./TransactionEditRow.vue"; import { formatDate } from "../date"; +import { useAccountStore } from "../stores/budget-account"; const props = defineProps<{ transactionid: string, @@ -18,17 +19,43 @@ const Reconciling = computed(() => useTransactionsStore().Reconciling); const transactionsStore = useTransactionsStore(); const TX = transactionsStore.Transactions.get(props.transactionid)!; + +function dateChanged() { + const currentAccount = useAccountStore().CurrentAccount; + if (currentAccount == null) + return true; + const transactionIndex = currentAccount.Transactions.indexOf(props.transactionid); + if(transactionIndex<=0) + return true; + + const previousTransactionId = currentAccount.Transactions[transactionIndex-1]; + const previousTransaction = transactionsStore.Transactions.get(previousTransactionId); + return TX.Date.getTime() != previousTransaction?.Date.getTime(); +} + +function getStatusSymbol() { + if(TX.Status == "Reconciled") + return "✔"; + + if(TX.Status == "Uncleared") + return "*"; + + return "✘"; +}