Improved transaction page.
Build and Deploy Web App / build-and-deploy (push) Successful in 19s
Details
Build and Deploy Web App / build-and-deploy (push) Successful in 19s
Details
This commit is contained in:
parent
9ff1bb2839
commit
30715947a3
|
|
@ -13,6 +13,8 @@ import { onMounted, ref, type Ref } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import AttachmentRow from '@/components/common/AttachmentRow.vue'
|
import AttachmentRow from '@/components/common/AttachmentRow.vue'
|
||||||
import LineItemCard from '@/components/LineItemCard.vue'
|
import LineItemCard from '@/components/LineItemCard.vue'
|
||||||
|
import AppBadge from '@/components/common/AppBadge.vue'
|
||||||
|
import ButtonBar from '@/components/common/ButtonBar.vue'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
@ -48,101 +50,66 @@ async function deleteTransaction() {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<AppPage
|
<AppPage :title="'Transaction ' + transaction.id" v-if="transaction">
|
||||||
:title="'Transaction ' + transaction.id"
|
<!-- Top-row with some badges for amount, vendor, and category. -->
|
||||||
v-if="transaction"
|
<div>
|
||||||
>
|
<AppBadge size="lg" class="font-mono">
|
||||||
|
{{ transaction.currency.code }} {{ formatMoney(transaction.amount, transaction.currency) }}
|
||||||
|
</AppBadge>
|
||||||
|
<AppBadge size="md" v-if="transaction.vendor">
|
||||||
|
{{ transaction.vendor.name }}
|
||||||
|
</AppBadge>
|
||||||
|
<CategoryLabel v-if="transaction.category" :category="transaction.category" :clickable="true" />
|
||||||
|
</div>
|
||||||
|
<!-- Second row that lists all tags. -->
|
||||||
|
<div v-if="transaction.tags.length > 0" class="mt-1">
|
||||||
|
<TagLabel v-for="t in transaction.tags" :key="t" :tag="t" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>{{ transaction.description }}</p>
|
||||||
|
|
||||||
|
<p v-if="transaction.creditedAccount">
|
||||||
|
<strong class="text-negative">Credited</strong> from
|
||||||
|
<RouterLink :to="`/profiles/${getSelectedProfile(route)}/accounts/${transaction.creditedAccount.id}`">
|
||||||
|
{{ transaction.creditedAccount.name }} (#{{ transaction.creditedAccount.numberSuffix }})
|
||||||
|
</RouterLink>
|
||||||
|
</p>
|
||||||
|
<p v-if="transaction.debitedAccount">
|
||||||
|
<strong class="text-positive">Debited</strong> to
|
||||||
|
<RouterLink :to="`/profiles/${getSelectedProfile(route)}/accounts/${transaction.debitedAccount.id}`">
|
||||||
|
{{ transaction.debitedAccount.name }} (#{{ transaction.debitedAccount.numberSuffix }})
|
||||||
|
</RouterLink>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- All remaining properties are put in this table. -->
|
||||||
<PropertiesTable>
|
<PropertiesTable>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Timestamp</th>
|
<th>Timestamp</th>
|
||||||
<td>{{ new Date(transaction.timestamp).toLocaleString() }}</td>
|
<td>{{ new Date(transaction.timestamp).toLocaleString() }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Added at</th>
|
<th>Added to Finnow</th>
|
||||||
<td>{{ new Date(transaction.addedAt).toLocaleString() }}</td>
|
<td>{{ new Date(transaction.addedAt).toLocaleString() }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th>Amount</th>
|
|
||||||
<td>{{ formatMoney(transaction.amount, transaction.currency) }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Description</th>
|
|
||||||
<td>{{ transaction.description }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="transaction.vendor">
|
|
||||||
<th>Vendor</th>
|
|
||||||
<td>
|
|
||||||
{{ transaction.vendor.name }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="transaction.category">
|
|
||||||
<th>Category</th>
|
|
||||||
<td>
|
|
||||||
<CategoryLabel
|
|
||||||
:category="transaction.category"
|
|
||||||
:clickable="true"
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="transaction.creditedAccount">
|
|
||||||
<th>Credited Account</th>
|
|
||||||
<td>
|
|
||||||
{{ transaction.creditedAccount.name }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr v-if="transaction.debitedAccount">
|
|
||||||
<th>Debited Account</th>
|
|
||||||
<td>
|
|
||||||
{{ transaction.debitedAccount.name }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Tags</th>
|
|
||||||
<td>
|
|
||||||
<TagLabel
|
|
||||||
v-for="t in transaction.tags"
|
|
||||||
:key="t"
|
|
||||||
:tag="t"
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</PropertiesTable>
|
</PropertiesTable>
|
||||||
|
|
||||||
<div v-if="transaction.lineItems.length > 0">
|
<div v-if="transaction.lineItems.length > 0">
|
||||||
<h3>Line Items</h3>
|
<h3>Line Items</h3>
|
||||||
<LineItemCard
|
<LineItemCard v-for="item of transaction.lineItems" :key="item.idx" :line-item="item"
|
||||||
v-for="item of transaction.lineItems"
|
:currency="transaction.currency" :total-count="transaction.lineItems.length" :editable="false" />
|
||||||
:key="item.idx"
|
|
||||||
:line-item="item"
|
|
||||||
:currency="transaction.currency"
|
|
||||||
:total-count="transaction.lineItems.length"
|
|
||||||
:editable="false"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="transaction.attachments.length > 0">
|
<div v-if="transaction.attachments.length > 0">
|
||||||
<h3>Attachments</h3>
|
<h3>Attachments</h3>
|
||||||
<AttachmentRow
|
<AttachmentRow v-for="a in transaction.attachments" :attachment="a" :key="a.id" disabled />
|
||||||
v-for="a in transaction.attachments"
|
|
||||||
:attachment="a"
|
|
||||||
:key="a.id"
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<ButtonBar>
|
||||||
<AppButton
|
<AppButton icon="wrench" @click="
|
||||||
icon="wrench"
|
|
||||||
@click="
|
|
||||||
router.push(`/profiles/${getSelectedProfile(route)}/transactions/${transaction.id}/edit`)
|
router.push(`/profiles/${getSelectedProfile(route)}/transactions/${transaction.id}/edit`)
|
||||||
"
|
">
|
||||||
>
|
|
||||||
Edit
|
Edit
|
||||||
</AppButton>
|
</AppButton>
|
||||||
<AppButton
|
<AppButton icon="trash" @click="deleteTransaction()">Delete</AppButton>
|
||||||
icon="trash"
|
</ButtonBar>
|
||||||
@click="deleteTransaction()"
|
|
||||||
>Delete</AppButton
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</AppPage>
|
</AppPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue