fix: customerSummary balanceDue label value
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Javier Segarra 2024-11-18 10:41:25 +01:00
parent 03490b7f3a
commit 9ea9239250
1 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; 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 CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.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 entityId = computed(() => $props.id || route.params.id);
const customer = computed(() => summary.value.entity); const customer = computed(() => summary.value.entity);
const summary = ref(); const summary = ref();
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount);
const balanceDue = computed(() => { const balanceDue = computed(() => {
return ( const amount = defaulterAmount.value;
customer.value && if (!amount || amount < 0) {
customer.value.defaulters.length && return null;
customer.value.defaulters[0].amount }
); return amount;
}); });
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : '')); const balanceDueWarning = computed(() => (defaulterAmount.value ? 'negative' : ''));
const claimRate = computed(() => { const claimRate = computed(() => {
return customer.value.claimsRatio?.claimingRate ?? 0; return customer.value.claimsRatio?.claimingRate ?? 0;
@ -281,7 +281,7 @@ const sumRisk = ({ clientRisks }) => {
<VnLv <VnLv
v-if="entity.defaulters" v-if="entity.defaulters"
:label="t('customer.summary.balanceDue')" :label="t('customer.summary.balanceDue')"
:value="toCurrency(balanceDue)" :value="dashOrCurrency(balanceDue)()"
:class="balanceDueWarning" :class="balanceDueWarning"
:info="t('customer.summary.balanceDueInfo')" :info="t('customer.summary.balanceDueInfo')"
/> />