forked from verdnatura/salix-front
Merge pull request 'HOTFIX: CustomerSummary BalanceDue' (!955) from hotFix_customerSumamry_balanceDue into master
Reviewed-on: verdnatura/salix-front#955 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
5ab28c13d0
|
@ -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')"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue