From 68069ba9c64ca7b04e323bc7d4a2237b3ad603e9 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 15 Apr 2024 12:48:07 +0200 Subject: [PATCH] feat: refs #6938 hide personal phone --- src/components/ui/CardDescriptor.vue | 4 +- src/components/ui/CardSummary.vue | 2 +- src/pages/Worker/Card/WorkerBasicData.vue | 3 ++ src/pages/Worker/Card/WorkerDescriptor.vue | 26 +------------ src/pages/Worker/Card/WorkerSummary.vue | 43 ++-------------------- 5 files changed, 12 insertions(+), 66 deletions(-) diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index 8e9304d3e..f30ea8937 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -47,7 +47,7 @@ const arrayData = useArrayData($props.dataKey || $props.module, { skip: 0, }); const { store } = arrayData; -const entity = computed(() => store.data); +const entity = computed(() =>Array.isArray( store.data) ? store.data[0] : store.data); const isLoading = ref(false); defineExpose({ @@ -67,7 +67,7 @@ async function getData() { try { const { data } = await arrayData.fetch({ append: false, updateRouter: false }); state.set($props.dataKey, data); - emit('onFetch', data); + emit('onFetch', Array.isArray(data) ? data[0] : data); } finally { isLoading.value = false; } diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index 1e1480293..a06837cf4 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -32,7 +32,7 @@ const arrayData = useArrayData(props.dataKey || route.meta.moduleName, { skip: 0, }); const { store } = arrayData; -const entity = computed(() => store.data); +const entity = computed(() => Array.isArray(store.data) ? store.data[0] : store.data); const isLoading = ref(false); defineExpose({ diff --git a/src/pages/Worker/Card/WorkerBasicData.vue b/src/pages/Worker/Card/WorkerBasicData.vue index c59f4281d..775472065 100644 --- a/src/pages/Worker/Card/WorkerBasicData.vue +++ b/src/pages/Worker/Card/WorkerBasicData.vue @@ -27,6 +27,7 @@ const workerFilter = { }, { relation: 'sip', scope: { fields: ['extension', 'secret'] } }, { relation: 'department', scope: { include: { relation: 'department' } } }, + { relation: 'client', scope: {fields:['phone']} }, ], }; const workersFilter = { @@ -86,6 +87,7 @@ const maritalStatus = [ :label="t('Mobile extension')" clearable /> + @@ -157,6 +159,7 @@ es: Last name: Apellidos Business phone: Teléfono de empresa Mobile extension: Extensión móvil + Personal phone: Teléfono personal Boss: Jefe Marital status: Estado civil Married: Casado/a diff --git a/src/pages/Worker/Card/WorkerDescriptor.vue b/src/pages/Worker/Card/WorkerDescriptor.vue index a20ad5546..bb4acec69 100644 --- a/src/pages/Worker/Card/WorkerDescriptor.vue +++ b/src/pages/Worker/Card/WorkerDescriptor.vue @@ -31,29 +31,7 @@ const entityId = computed(() => { }); const worker = ref(); -const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['email', 'name', 'nickname'], - }, - }, - { - relation: 'department', - scope: { - include: [ - { - relation: 'department', - }, - ], - }, - }, - { - relation: 'sip', - }, - ], -}; +const filter = { where: { id: route.params.id}}; const sip = ref(null); @@ -82,7 +60,7 @@ const setData = (entity) => { $props.id || route.params.id); +const entityId = computed(() => $props.id || params.id); const workerUrl = ref(); onMounted(async () => { workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`; }); -const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['email', 'name', 'nickname', 'roleFk'], - include: { - relation: 'role', - scope: { - fields: ['name'], - }, - }, - }, - }, - { - relation: 'department', - scope: { - include: { - relation: 'department', - scope: { - fields: ['name'], - }, - }, - }, - }, - { - relation: 'boss', - }, - { - relation: 'client', - }, - { - relation: 'sip', - }, - ], -}; +const filter = {where: {id: params.id}};