Small refactor
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-02-25 09:00:49 +01:00
parent bb45d78062
commit cc00587b66
5 changed files with 22 additions and 24 deletions

View File

@ -9,6 +9,6 @@ body {
.title { .title {
margin-bottom: 20px; margin-bottom: 20px;
font-weight: 100; font-weight: 100;
font-size: 3em; font-size: 2.6rem;
margin-top: 0 margin-top: 0
} }

View File

@ -19,7 +19,7 @@ h2 {
} }
.ticket-info { .ticket-info {
font-size: 26px font-size: 22px
} }
#phytosanitary { #phytosanitary {

View File

@ -4,7 +4,8 @@ h2 {
} }
.table-title { .table-title {
margin-bottom: 15px margin-bottom: 15px;
font-size: 0.8rem
} }
.table-title h2 { .table-title h2 {
@ -12,7 +13,12 @@ h2 {
} }
.ticket-info { .ticket-info {
font-size: 26px font-size: 22px
}
#nickname h2 {
max-width: 400px;
word-wrap: break-word
} }
#phytosanitary { #phytosanitary {

View File

@ -101,8 +101,8 @@
<span>{{ticket.shipped | date}}</span> <span>{{ticket.shipped | date}}</span>
</div> </div>
</div> </div>
<span class="pull-right"> <span id="nickname" class="pull-right">
<h2 style="max-width: 400px; text-overflow: ellipsis;white-space: nowrap;overflow: hidden;">{{ticket.nickname}}</h2> <h2>{{ticket.nickname}}</h2>
</span> </span>
</div> </div>
<table class="column-oriented"> <table class="column-oriented">
@ -125,7 +125,7 @@
<td class="number">{{sale.price | currency('EUR', $i18n.locale)}}</td> <td class="number">{{sale.price | currency('EUR', $i18n.locale)}}</td>
<td class="centered" width="5%">{{(sale.discount / 100) | percentage}}</td> <td class="centered" width="5%">{{(sale.discount / 100) | percentage}}</td>
<td class="centered">{{sale.vatType}}</td> <td class="centered">{{sale.vatType}}</td>
<td class="number">{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}}</td> <td class="number">{{saleImport(sale) | currency('EUR', $i18n.locale)}}</td>
</tr> </tr>
<tr class="description font light-gray"> <tr class="description font light-gray">
<td colspan="7"> <td colspan="7">
@ -146,7 +146,7 @@
<td colspan="6" class="font bold"> <td colspan="6" class="font bold">
<span class="pull-right">{{$t('subtotal')}}</span> <span class="pull-right">{{$t('subtotal')}}</span>
</td> </td>
<td class="number">{{subTotal(ticket) | currency('EUR', $i18n.locale)}}</td> <td class="number">{{ticketSubtotal(ticket) | currency('EUR', $i18n.locale)}}</td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View File

@ -59,15 +59,6 @@ module.exports = {
const vat = this.sumTotal(this.taxes, 'vat'); const vat = this.sumTotal(this.taxes, 'vat');
return base + vat; return base + vat;
} }
/*
serviceTotal() {
let total = 0.00;
this.services.forEach(service => {
total += parseFloat(service.price) * service.quantity;
});
return total;
} */
}, },
methods: { methods: {
fetchInvoice(invoiceId) { fetchInvoice(invoiceId) {
@ -100,17 +91,18 @@ module.exports = {
fetchRectified(invoiceId) { fetchRectified(invoiceId) {
return this.rawSqlFromDef(`rectified`, [invoiceId]); return this.rawSqlFromDef(`rectified`, [invoiceId]);
}, },
subTotal(ticket) { saleImport(sale) {
const price = sale.quantity * sale.price;
return price * (1 - sale.discount / 100);
},
ticketSubtotal(ticket) {
let subTotal = 0.00; let subTotal = 0.00;
ticket.sales.forEach(sale => { for (let sale of ticket.sales)
subTotal += sale.quantity * sale.price * (1 - sale.discount / 100); subTotal += this.saleImport(sale);
});
return subTotal; return subTotal;
}, },
getTotal() {
return this.getTotalBase() + this.getTotalTax();
},
sumTotal(rows, prop) { sumTotal(rows, prop) {
let total = 0.00; let total = 0.00;
for (let row of rows) for (let row of rows)