0
0
Fork 0

feat: refs #6938 hide personal phone

This commit is contained in:
Jorge Penadés 2024-04-15 12:48:07 +02:00
parent 32382622e4
commit 68069ba9c6
5 changed files with 12 additions and 66 deletions

View File

@ -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;
}

View File

@ -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({

View File

@ -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
/>
<VnInput v-model="data.client.phone" :label="t('Personal phone')" clearable />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
@ -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

View File

@ -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) => {
<CardDescriptor
module="Worker"
data-key="workerData"
:url="`Workers/${entityId}`"
:url="`Workers/summary`"
:filter="filter"
:title="data.title"
: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 VnTitle from 'src/components/common/VnTitle.vue';
const route = useRoute();
const {params} = useRoute();
const { t } = useI18n();
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();
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}};
</script>
<template>
<CardSummary ref="summary" :url="`Workers/${entityId}`" :filter="filter">
<CardSummary ref="summary" :url="`Workers/summary`" :filter="filter" >
<template #header="{ entity }">
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
</template>