forked from verdnatura/salix-front
Merge branch 'dev' into 6943_fix_customer_module
This commit is contained in:
commit
650e801433
|
@ -2,9 +2,15 @@ import { boot } from 'quasar/wrappers';
|
||||||
import qFormMixin from './qformMixin';
|
import qFormMixin from './qformMixin';
|
||||||
import mainShortcutMixin from './mainShortcutMixin';
|
import mainShortcutMixin from './mainShortcutMixin';
|
||||||
import keyShortcut from './keyShortcut';
|
import keyShortcut from './keyShortcut';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
const { notify } = useNotify();
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
app.mixin(qFormMixin);
|
app.mixin(qFormMixin);
|
||||||
app.mixin(mainShortcutMixin);
|
app.mixin(mainShortcutMixin);
|
||||||
app.directive('shortcut', keyShortcut);
|
app.directive('shortcut', keyShortcut);
|
||||||
|
app.config.errorHandler = function (err) {
|
||||||
|
console.error(err);
|
||||||
|
notify('globals.error', 'negative', 'error');
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -103,6 +103,7 @@ globals:
|
||||||
ticket: Ticket
|
ticket: Ticket
|
||||||
campaign: Campaign
|
campaign: Campaign
|
||||||
weight: Weight
|
weight: Weight
|
||||||
|
error: Ups! Something went wrong
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Login
|
logIn: Login
|
||||||
addressEdit: Update address
|
addressEdit: Update address
|
||||||
|
|
|
@ -105,6 +105,7 @@ globals:
|
||||||
ticket: Ticket
|
ticket: Ticket
|
||||||
campaign: Campaña
|
campaign: Campaña
|
||||||
weight: Peso
|
weight: Peso
|
||||||
|
error: ¡Ups! Algo salió mal
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Inicio de sesión
|
logIn: Inicio de sesión
|
||||||
addressEdit: Modificar consignatario
|
addressEdit: Modificar consignatario
|
||||||
|
|
|
@ -103,7 +103,7 @@ async function remove(row) {
|
||||||
url-create="WagonTypes"
|
url-create="WagonTypes"
|
||||||
model="WagonType"
|
model="WagonType"
|
||||||
:form-initial-data="initialData"
|
:form-initial-data="initialData"
|
||||||
@on-data-saved="window.location.reload()"
|
@on-data-saved="tableRef.reload()"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import { computed } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ const arrayData = useArrayData('WagonList');
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const tableRef = ref();
|
||||||
const filter = {
|
const filter = {
|
||||||
include: {
|
include: {
|
||||||
relation: 'type',
|
relation: 'type',
|
||||||
|
@ -107,9 +107,7 @@ async function remove(row) {
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Wagons',
|
urlCreate: 'Wagons',
|
||||||
title: t('Create new wagon'),
|
title: t('Create new wagon'),
|
||||||
onDataSaved: () => {
|
onDataSaved: () => tableRef.reload(),
|
||||||
window.location.reload();
|
|
||||||
},
|
|
||||||
formInitialData: {},
|
formInitialData: {},
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
|
|
|
@ -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