Hotfix[CustomerDescriptor]: Fixed icons in descriptor #1217

Merged
jon merged 4 commits from Hotfix-CustomerDescriptorIcons into master 2025-01-15 08:23:57 +00:00
1 changed files with 14 additions and 23 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
@ -11,15 +11,9 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue'; import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue';
import { useState } from 'src/composables/useState';
const state = useState();
const customer = ref(); const customerDebt = ref();
const customerCredit = ref();
onMounted(async () => {
customer.value = state.get('customer');
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
});
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -42,10 +36,12 @@ const entityId = computed(() => {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
customerDebt.value = entity?.debt;
customerCredit.value = entity?.credit;
data.value = useCardDescription(entity?.name, entity?.id); data.value = useCardDescription(entity?.name, entity?.id);
}; };
const debtWarning = computed(() => { const debtWarning = computed(() => {
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary'; return customerDebt.value > customerCredit.value ? 'negative' : 'primary';
}); });
</script> </script>
@ -97,26 +93,21 @@ const debtWarning = computed(() => {
:value="entity.businessType.description" :value="entity.businessType.description"
/> />
</template> </template>
<template #icons> <template #icons="{ entity }">
<QCardActions v-if="customer" class="q-gutter-x-md"> <QCardActions class="q-gutter-x-md">
<QIcon <QIcon
v-if="!customer.isActive" v-if="!entity.isActive"
name="vn:disabled" name="vn:disabled"
size="xs" size="xs"
color="primary" color="primary"
> >
<QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip> <QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon v-if="entity.isFreezed" name="vn:frozen" size="xs" color="primary">
v-if="customer.isFreezed"
name="vn:frozen"
size="xs"
color="primary"
>
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip> <QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="!customer.account?.active" v-if="!entity.account?.active"
color="primary" color="primary"
name="vn:noweb" name="vn:noweb"
size="xs" size="xs"
@ -124,7 +115,7 @@ const debtWarning = computed(() => {
<QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip> <QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="customer.debt > customer.credit" v-if="entity.debt > entity.credit"
name="vn:risk" name="vn:risk"
size="xs" size="xs"
:color="debtWarning" :color="debtWarning"
@ -132,7 +123,7 @@ const debtWarning = computed(() => {
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip> <QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="!customer.isTaxDataChecked" v-if="!entity.isTaxDataChecked"
name="vn:no036" name="vn:no036"
size="xs" size="xs"
color="primary" color="primary"
@ -140,7 +131,7 @@ const debtWarning = computed(() => {
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip> <QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
</QIcon> </QIcon>
<QBtn <QBtn
v-if="customer.unpaid" v-if="entity.unpaid"
flat flat
size="sm" size="sm"
icon="vn:Client_unpaid" icon="vn:Client_unpaid"