Merge branch 'dev' into 6679-addCreateIcon
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Robert Ferrús 2024-04-16 07:30:27 +00:00
commit 130869dcdb
5 changed files with 12 additions and 72 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: entityId.value } };
</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>
@ -103,12 +68,6 @@ const filter = {
<VnLinkPhone :phone-number="worker.phone" />
</template>
</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" />
</QCard>
<QCard class="vn-one">