Move Transaction row to own component
This commit is contained in:
parent
09a242f6f6
commit
bd1e1cbfb8
40
web/src/components/TransactionRow.vue
Normal file
40
web/src/components/TransactionRow.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import Currency from "./Currency.vue";
|
||||
|
||||
export default defineComponent({
|
||||
props: [ "transaction", "index" ],
|
||||
components: { Currency }
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<tr class="{{transaction.Date.After now ? '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 style="width: 90px;">{{ transaction.Date.substring(0, 10) }}</td>
|
||||
<td style="max-width: 150px;">{{ transaction.TransferAccount ? "Transfer : " + transaction.TransferAccount : transaction.Payee }}</td>
|
||||
<td style="max-width: 200px;">
|
||||
{{ transaction.CategoryGroup ? transaction.CategoryGroup + " : " + transaction.Category : "" }}
|
||||
</td>
|
||||
<td>
|
||||
<a :href="'/budget/' + $store.getters.CurrentBudgetID + '/transaction/' + transaction.ID">
|
||||
{{ transaction.Memo }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<Currency class="block" :value="transaction.Amount" />
|
||||
</td>
|
||||
<td style="width: 20px;">
|
||||
{{ transaction.Status == "Reconciled" ? "✔" : (transaction.Status == "Uncleared" ? "" : "*") }}
|
||||
</td>
|
||||
<td style="width: 20px;">{{ transaction.GroupID ? "☀" : "" }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
td {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
@ -2,6 +2,7 @@
|
||||
import { defineComponent } from "vue"
|
||||
import Autocomplete, { Suggestion } from '../components/Autocomplete.vue'
|
||||
import Currency from "../components/Currency.vue";
|
||||
import TransactionRow from "../components/TransactionRow.vue";
|
||||
|
||||
export default defineComponent({
|
||||
data() {
|
||||
@ -13,7 +14,7 @@ export default defineComponent({
|
||||
Amount: 0
|
||||
}
|
||||
},
|
||||
components: { Autocomplete, Currency },
|
||||
components: { Autocomplete, Currency, TransactionRow },
|
||||
props: ["budgetid", "accountid"],
|
||||
methods: {
|
||||
saveTransaction(e : MouseEvent) {
|
||||
@ -66,28 +67,9 @@ export default defineComponent({
|
||||
</td>
|
||||
<td style="width: 20px;"></td>
|
||||
</tr>
|
||||
<tr v-for="(transaction, index) in $store.getters.Transactions"
|
||||
class="{{transaction.Date.After now ? '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 style="width: 90px;">{{ transaction.Date.substring(0, 10) }}</td>
|
||||
<td style="max-width: 150px;">{{ transaction.TransferAccount ? "Transfer : " + transaction.TransferAccount : transaction.Payee }}</td>
|
||||
<td
|
||||
style="max-width: 200px;"
|
||||
>{{ transaction.CategoryGroup ? transaction.CategoryGroup + " : " + transaction.Category : "" }}</td>
|
||||
<td>
|
||||
<a
|
||||
:href="'/budget/' + $store.getters.CurrentBudgetID + '/transaction/' + transaction.ID"
|
||||
>{{ transaction.Memo }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<Currency class="block" :value="transaction.Amount" />
|
||||
</td>
|
||||
<td
|
||||
style="width: 20px;"
|
||||
>{{ transaction.Status == "Reconciled" ? "✔" : (transaction.Status == "Uncleared" ? "" : "*") }}</td>
|
||||
<td style="width: 20px;">{{ transaction.GroupID ? "☀" : "" }}</td>
|
||||
</tr>
|
||||
<TransactionRow v-for="(transaction, index) in $store.getters.Transactions"
|
||||
:transaction="transaction"
|
||||
:index="index" />
|
||||
</table>
|
||||
</template>
|
||||
|
||||
@ -96,10 +78,6 @@ table {
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
td {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.negative {
|
||||
color: red;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user