0
0
Fork 0

Merge pull request '#6938 hide personal phone' (!290) from 6938-hideWorkerPhone into dev

Reviewed-on: verdnatura/salix-front#290
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Jorge Penadés 2024-04-16 06:38:56 +00:00
commit c2048afb53
5 changed files with 12 additions and 72 deletions

View File

@ -47,7 +47,7 @@ const arrayData = useArrayData($props.dataKey || $props.module, {
skip: 0, skip: 0,
}); });
const { store } = arrayData; const { store } = arrayData;
const entity = computed(() => store.data); const entity = computed(() =>Array.isArray( store.data) ? store.data[0] : store.data);
const isLoading = ref(false); const isLoading = ref(false);
defineExpose({ defineExpose({
@ -67,7 +67,7 @@ async function getData() {
try { try {
const { data } = await arrayData.fetch({ append: false, updateRouter: false }); const { data } = await arrayData.fetch({ append: false, updateRouter: false });
state.set($props.dataKey, data); state.set($props.dataKey, data);
emit('onFetch', data); emit('onFetch', Array.isArray(data) ? data[0] : data);
} finally { } finally {
isLoading.value = false; isLoading.value = false;
} }

View File

@ -32,7 +32,7 @@ const arrayData = useArrayData(props.dataKey || route.meta.moduleName, {
skip: 0, skip: 0,
}); });
const { store } = arrayData; const { store } = arrayData;
const entity = computed(() => store.data); const entity = computed(() => Array.isArray(store.data) ? store.data[0] : store.data);
const isLoading = ref(false); const isLoading = ref(false);
defineExpose({ defineExpose({

View File

@ -27,6 +27,7 @@ const workerFilter = {
}, },
{ relation: 'sip', scope: { fields: ['extension', 'secret'] } }, { relation: 'sip', scope: { fields: ['extension', 'secret'] } },
{ relation: 'department', scope: { include: { relation: 'department' } } }, { relation: 'department', scope: { include: { relation: 'department' } } },
{ relation: 'client', scope: {fields:['phone']} },
], ],
}; };
const workersFilter = { const workersFilter = {
@ -86,6 +87,7 @@ const maritalStatus = [
:label="t('Mobile extension')" :label="t('Mobile extension')"
clearable clearable
/> />
<VnInput v-model="data.client.phone" :label="t('Personal phone')" clearable />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
@ -157,6 +159,7 @@ es:
Last name: Apellidos Last name: Apellidos
Business phone: Teléfono de empresa Business phone: Teléfono de empresa
Mobile extension: Extensión móvil Mobile extension: Extensión móvil
Personal phone: Teléfono personal
Boss: Jefe Boss: Jefe
Marital status: Estado civil Marital status: Estado civil
Married: Casado/a Married: Casado/a

View File

@ -31,29 +31,7 @@ const entityId = computed(() => {
}); });
const worker = ref(); const worker = ref();
const filter = { const filter = { where: { id: route.params.id}};
include: [
{
relation: 'user',
scope: {
fields: ['email', 'name', 'nickname'],
},
},
{
relation: 'department',
scope: {
include: [
{
relation: 'department',
},
],
},
},
{
relation: 'sip',
},
],
};
const sip = ref(null); const sip = ref(null);
@ -82,7 +60,7 @@ const setData = (entity) => {
<CardDescriptor <CardDescriptor
module="Worker" module="Worker"
data-key="workerData" data-key="workerData"
:url="`Workers/${entityId}`" :url="`Workers/summary`"
:filter="filter" :filter="filter"
:title="data.title" :title="data.title"
:subtitle="data.subtitle" :subtitle="data.subtitle"

View File

@ -10,7 +10,7 @@ import CardSummary from 'components/ui/CardSummary.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnTitle from 'src/components/common/VnTitle.vue'; import VnTitle from 'src/components/common/VnTitle.vue';
const route = useRoute(); const { params } = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const $props = defineProps({ const $props = defineProps({
@ -20,53 +20,18 @@ const $props = defineProps({
}, },
}); });
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || params.id);
const workerUrl = ref(); const workerUrl = ref();
onMounted(async () => { onMounted(async () => {
workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`; workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`;
}); });
const filter = { const filter = { where: { id: entityId.value } };
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',
},
],
};
</script> </script>
<template> <template>
<CardSummary ref="summary" :url="`Workers/${entityId}`" :filter="filter"> <CardSummary ref="summary" :url="`Workers/summary`" :filter="filter">
<template #header="{ entity }"> <template #header="{ entity }">
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div> <div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
</template> </template>
@ -103,12 +68,6 @@ const filter = {
<VnLinkPhone :phone-number="worker.phone" /> <VnLinkPhone :phone-number="worker.phone" />
</template> </template>
</VnLv> </VnLv>
<VnLv :value="worker.client?.phone">
<template #label>
{{ t('worker.summary.personalPhone') }}
<VnLinkPhone :phone-number="worker.client?.phone" />
</template>
</VnLv>
<VnLv :label="t('worker.summary.locker')" :value="worker.locker" /> <VnLv :label="t('worker.summary.locker')" :value="worker.locker" />
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">