mirror of
https://github.com/mokuappio/serverless-invoices.git
synced 2025-10-28 00:11:08 -04:00
Abstracted add row button to separate component. Abstracted invoice row headers to separate component. Remove vat related things, now replaced with custom taxes. Invoice tax totals are calculated per tax based on invoice rows.
57 lines
1.4 KiB
Vue
57 lines
1.4 KiB
Vue
<template>
|
|
<tfoot>
|
|
<tr class="text-right">
|
|
<td :colspan="colspan">Subtotal</td>
|
|
<td>{{ invoice.subTotal | currency }}</td>
|
|
</tr>
|
|
<tr class="text-right" v-for="tax in invoice.taxes" :key="tax.label">
|
|
<td :colspan="colspan">
|
|
{{ tax.label }}
|
|
<!--({{ tax.rate | currency }}%)-->
|
|
</td>
|
|
<td>{{ tax.total | currency }}</td>
|
|
</tr>
|
|
<tr class="text-right">
|
|
<th :colspan="colspan">
|
|
Total
|
|
<AppEditable :value="invoice.currency"
|
|
:errors="errors"
|
|
field="currency"
|
|
placeholder="Add currency"
|
|
@change="updateProp({ currency: $event })"/>
|
|
</th>
|
|
<th class="text-nowrap">{{ invoice.total | currency }}</th>
|
|
</tr>
|
|
</tfoot>
|
|
</template>
|
|
<script>
|
|
import { mapGetters } from 'vuex';
|
|
import AppEditable from '../form/AppEditable';
|
|
import { formatDate } from '../../filters/date.filter';
|
|
import { formatCurrency } from '../../filters/currency.filter';
|
|
|
|
export default {
|
|
props: ['invoice', 'errors'],
|
|
components: {
|
|
AppEditable,
|
|
},
|
|
filters: {
|
|
date: formatDate,
|
|
currency: formatCurrency,
|
|
},
|
|
computed: {
|
|
...mapGetters({
|
|
taxes: 'invoiceRows/taxes',
|
|
}),
|
|
colspan() {
|
|
return 4 + this.taxes.length;
|
|
},
|
|
},
|
|
methods: {
|
|
updateProp(props) {
|
|
this.$emit('update', props);
|
|
},
|
|
},
|
|
};
|
|
</script>
|