Files
serverless-invoices/src/components/invoices/InvoiceTotals.vue
HenriT 2e57464679 Added multiple taxes for invoice rows. Client has_vat => has_tax.
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.
2021-04-14 15:58:55 +03:00

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>