2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

fix: Party Widget payment display

This commit is contained in:
18alantom 2022-02-07 17:15:58 +05:30
parent 0acdaa9b78
commit e8ad2ce21d

View File

@ -25,16 +25,15 @@
<div>
<span
class="font-medium text-gray-900"
v-if="fullyPaid(invoice) || notPaid(invoice)"
>
{{
frappe.format(
invoice.baseGrandTotal,
amountPaid(invoice),
invoiceMeta.getField('baseGrandTotal')
)
}}
</span>
<span class="text-gray-600" v-if="partiallyPaid(invoice)">
<span class="text-gray-600" v-if="!fullyPaid(invoice)">
({{
frappe.format(
invoice.baseGrandTotal,
@ -59,7 +58,7 @@ export default {
props: ['doc'],
data() {
return {
pendingInvoices: []
pendingInvoices: [],
};
},
computed: {
@ -69,7 +68,7 @@ export default {
},
invoiceMeta() {
return frappe.getMeta(this.invoiceDoctype);
}
},
},
mounted() {
this.fetchPendingInvoices();
@ -86,14 +85,15 @@ export default {
'date',
'outstandingAmount',
'baseGrandTotal',
'submitted'
'submitted',
],
filters: {
[partyField]: this.doc.name
[partyField]: this.doc.name,
},
limit: 3,
orderBy: 'creation'
orderBy: 'creation',
});
window.pendingInvoices = this.pendingInvoices;
},
getStatusBadge(doc) {
let statusColumn = getStatusColumn();
@ -103,17 +103,11 @@ export default {
routeTo(`/edit/${this.invoiceDoctype}/${doc.name}`);
},
fullyPaid(invoice) {
return invoice.outstandingAmount == 0;
return invoice.outstandingAmount.isZero();
},
amountPaid(invoice) {
return invoice.baseGrandTotal.sub(invoice.outstandingAmount);
},
partiallyPaid(invoice) {
return (
invoice.outstandingAmount &&
invoice.outstandingAmount !== invoice.baseGrandTotal
);
},
notPaid(invoice) {
return invoice.outstandingAmount === invoice.baseGrandTotal;
}
}
};
</script>