From 9ea9239250ba209a644057b4be5102b631f3935d Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 18 Nov 2024 10:41:25 +0100 Subject: [PATCH] fix: customerSummary balanceDue label value --- src/pages/Customer/Card/CustomerSummary.vue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pages/Customer/Card/CustomerSummary.vue b/src/pages/Customer/Card/CustomerSummary.vue index 8b5f0f2c2..62792a5c2 100644 --- a/src/pages/Customer/Card/CustomerSummary.vue +++ b/src/pages/Customer/Card/CustomerSummary.vue @@ -4,7 +4,7 @@ import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; import VnUserLink from 'src/components/ui/VnUserLink.vue'; -import { toCurrency, toPercentage, toDate } from 'src/filters'; +import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters'; import CardSummary from 'components/ui/CardSummary.vue'; import VnLv from 'src/components/ui/VnLv.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; @@ -25,16 +25,16 @@ const $props = defineProps({ const entityId = computed(() => $props.id || route.params.id); const customer = computed(() => summary.value.entity); const summary = ref(); - +const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount); const balanceDue = computed(() => { - return ( - customer.value && - customer.value.defaulters.length && - customer.value.defaulters[0].amount - ); + const amount = defaulterAmount.value; + if (!amount || amount < 0) { + return null; + } + return amount; }); -const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : '')); +const balanceDueWarning = computed(() => (defaulterAmount.value ? 'negative' : '')); const claimRate = computed(() => { return customer.value.claimsRatio?.claimingRate ?? 0; @@ -281,7 +281,7 @@ const sumRisk = ({ clientRisks }) => {