refactor: refs #8201 added onMounted to stablish the value to show icons
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-12-17 06:27:03 +01:00
parent 7fc0d0bcfe
commit fe1d9e93a3
3 changed files with 11 additions and 17 deletions

View File

@ -164,19 +164,7 @@ const columns = computed(() => [
:autofocus="col.tabIndex == 1" :autofocus="col.tabIndex == 1"
input-debounce="0" input-debounce="0"
hide-selected hide-selected
> />
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>
{{ scope.opt?.nickname }}
{{ scope.opt?.code }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectWorker>
<VnSelect <VnSelect
v-else v-else
v-model="row[col.model]" v-model="row[col.model]"

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
@ -14,7 +14,13 @@ import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
const state = useState(); const state = useState();
const customer = computed(() => state.get('customer')); const customer = ref();
onMounted(async () => {
console.log('state.get(customer): ', state.get('customer'));
customer.value = state.get('customer');
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
});
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -38,7 +44,6 @@ const entityId = computed(() => {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
data.value = useCardDescription(entity?.name, entity?.id); data.value = useCardDescription(entity?.name, entity?.id);
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
}; };
const debtWarning = computed(() => { const debtWarning = computed(() => {
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary'; return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
@ -94,6 +99,7 @@ const debtWarning = computed(() => {
/> />
</template> </template>
<template #icons> <template #icons>
{{ console.log('customer: ', customer) }}
<QCardActions v-if="customer" class="q-gutter-x-md"> <QCardActions v-if="customer" class="q-gutter-x-md">
<QIcon <QIcon
v-if="!customer.isActive" v-if="!customer.isActive"

View File

@ -52,7 +52,7 @@ const { t } = useI18n();
<VnSelectWorker <VnSelectWorker
:label="t('department.bossDepartment')" :label="t('department.bossDepartment')"
v-model="data.workerFk" v-model="data.workerFk"
:rules="validate('department.workerFk')" :rules="validate('department.bossDepartment')"
/> />
<VnSelect <VnSelect
:label="t('department.selfConsumptionCustomer')" :label="t('department.selfConsumptionCustomer')"