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