forked from verdnatura/salix-front
Merge branch 'master' into 6898-fixSupplier2
This commit is contained in:
commit
681c72a3d0
|
@ -192,7 +192,7 @@ function setUserParams(watchedParams, watchedOrder) {
|
||||||
|
|
||||||
function sanitizer(params) {
|
function sanitizer(params) {
|
||||||
for (const [key, value] of Object.entries(params)) {
|
for (const [key, value] of Object.entries(params)) {
|
||||||
if (typeof value == 'object') {
|
if (value && typeof value == 'object') {
|
||||||
const param = Object.values(value)[0];
|
const param = Object.values(value)[0];
|
||||||
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
|
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,11 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('worker.card.user')" :value="entity.user?.name" />
|
<VnLv :label="t('worker.card.user')" :value="entity.user?.name" />
|
||||||
<VnLv :label="t('worker.card.email')" :value="entity.user?.email" copy />
|
<VnLv
|
||||||
|
:label="t('worker.card.email')"
|
||||||
|
:value="entity.user?.emailUser?.email"
|
||||||
|
copy
|
||||||
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('worker.list.department')"
|
:label="t('worker.list.department')"
|
||||||
:value="entity.department ? entity.department.department.name : null"
|
:value="entity.department ? entity.department.department.name : null"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, computed } from 'vue';
|
import { ref, onBeforeMount, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import axios from 'axios';
|
||||||
import { dashIfEmpty, toDate } from 'src/filters';
|
import { dashIfEmpty, toDate } from 'src/filters';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
|
@ -11,6 +11,7 @@ import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
import RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy.vue';
|
import RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy.vue';
|
||||||
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
||||||
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -23,64 +24,27 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const workerUrl = ref();
|
const basicDataUrl = ref(null);
|
||||||
|
const isHr = computed(() => useRole().hasAny(['hr']));
|
||||||
|
const advancedSummary = ref();
|
||||||
|
|
||||||
onMounted(async () => {
|
onBeforeMount(async () => {
|
||||||
workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`;
|
if (isHr.value) {
|
||||||
|
advancedSummary.value = (
|
||||||
|
await axios.get('Workers/advancedSummary', {
|
||||||
|
params: { filter: { where: { id: entityId.value } } },
|
||||||
|
})
|
||||||
|
).data[0];
|
||||||
|
basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const filter = {
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
relation: 'user',
|
|
||||||
scope: {
|
|
||||||
fields: ['name', 'nickname', 'roleFk'],
|
|
||||||
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
relation: 'role',
|
|
||||||
scope: {
|
|
||||||
fields: ['name'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
relation: 'emailUser',
|
|
||||||
scope: {
|
|
||||||
fields: ['email'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
relation: 'department',
|
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'department',
|
|
||||||
scope: {
|
|
||||||
fields: ['name'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
relation: 'boss',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
relation: 'client',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
relation: 'sip',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
ref="summary"
|
ref="summary"
|
||||||
:url="`Workers/${entityId}`"
|
:url="`Workers/summary`"
|
||||||
:filter="filter"
|
:filter="{ where: { id: entityId } }"
|
||||||
data-key="WorkerSummary"
|
data-key="WorkerSummary"
|
||||||
>
|
>
|
||||||
<template #header="{ entity }">
|
<template #header="{ entity }">
|
||||||
|
@ -88,10 +52,7 @@ const filter = {
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity: worker }">
|
<template #body="{ entity: worker }">
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle
|
<VnTitle :url="basicDataUrl" :text="t('worker.summary.basicData')" />
|
||||||
:url="`#/worker/${entityId}/basic-data`"
|
|
||||||
:text="t('worker.summary.basicData')"
|
|
||||||
/>
|
|
||||||
<VnLv :label="t('worker.card.name')" :value="worker.user?.nickname" />
|
<VnLv :label="t('worker.card.name')" :value="worker.user?.nickname" />
|
||||||
<VnLv :label="t('worker.list.department')">
|
<VnLv :label="t('worker.list.department')">
|
||||||
<template #value>
|
<template #value>
|
||||||
|
@ -128,13 +89,9 @@ const filter = {
|
||||||
<VnLinkPhone :phone-number="worker.client?.phone" />
|
<VnLinkPhone :phone-number="worker.client?.phone" />
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :label="t('worker.summary.locker')" :value="worker.locker" />
|
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one" v-if="advancedSummary">
|
||||||
<VnTitle
|
<VnTitle :url="basicDataUrl" :text="t('worker.summary.basicData')" />
|
||||||
:url="`#/worker/${entityId}/basic-data`"
|
|
||||||
:text="t('worker.summary.basicData')"
|
|
||||||
/>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('worker.summary.fiDueDate')"
|
:label="t('worker.summary.fiDueDate')"
|
||||||
:value="toDate(worker.fiDueDate)"
|
:value="toDate(worker.fiDueDate)"
|
||||||
|
@ -162,7 +119,6 @@ const filter = {
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle :text="t('worker.summary.userData')" />
|
<VnTitle :text="t('worker.summary.userData')" />
|
||||||
<VnLv :label="t('worker.summary.userId')" :value="worker?.user?.id" />
|
|
||||||
<VnLv :label="t('worker.card.name')" :value="worker?.user?.nickname" />
|
<VnLv :label="t('worker.card.name')" :value="worker?.user?.nickname" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('worker.list.email')"
|
:label="t('worker.list.email')"
|
||||||
|
|
Loading…
Reference in New Issue