0
0
Fork 0

Merge branch 'dev' into 6943_fix_customer_module

This commit is contained in:
Javier Segarra 2024-09-19 11:10:28 +00:00
commit 650e801433
7 changed files with 37 additions and 71 deletions

View File

@ -2,9 +2,15 @@ import { boot } from 'quasar/wrappers';
import qFormMixin from './qformMixin';
import mainShortcutMixin from './mainShortcutMixin';
import keyShortcut from './keyShortcut';
import useNotify from 'src/composables/useNotify.js';
const { notify } = useNotify();
export default boot(({ app }) => {
app.mixin(qFormMixin);
app.mixin(mainShortcutMixin);
app.directive('shortcut', keyShortcut);
app.config.errorHandler = function (err) {
console.error(err);
notify('globals.error', 'negative', 'error');
};
});

View File

@ -103,6 +103,7 @@ globals:
ticket: Ticket
campaign: Campaign
weight: Weight
error: Ups! Something went wrong
pageTitles:
logIn: Login
addressEdit: Update address

View File

@ -105,6 +105,7 @@ globals:
ticket: Ticket
campaign: Campaña
weight: Peso
error: ¡Ups! Algo salió mal
pageTitles:
logIn: Inicio de sesión
addressEdit: Modificar consignatario

View File

@ -103,7 +103,7 @@ async function remove(row) {
url-create="WagonTypes"
model="WagonType"
:form-initial-data="initialData"
@on-data-saved="window.location.reload()"
@on-data-saved="tableRef.reload()"
auto-load
>
<template #form-inputs="{ data }">

View File

@ -5,7 +5,7 @@ import { useArrayData } from 'src/composables/useArrayData';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
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 VnInput from 'src/components/common/VnInput.vue';
@ -14,7 +14,7 @@ const arrayData = useArrayData('WagonList');
const store = arrayData.store;
const router = useRouter();
const { t } = useI18n();
const tableRef = ref();
const filter = {
include: {
relation: 'type',
@ -107,9 +107,7 @@ async function remove(row) {
:create="{
urlCreate: 'Wagons',
title: t('Create new wagon'),
onDataSaved: () => {
window.location.reload();
},
onDataSaved: () => tableRef.reload(),
formInitialData: {},
}"
>

View File

@ -152,7 +152,11 @@ const refetch = async () => await cardDescriptorRef.value.getData();
</template>
<template #body="{ entity }">
<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
:label="t('worker.list.department')"
:value="entity.department ? entity.department.department.name : null"

View File

@ -1,9 +1,9 @@
<script setup>
import { ref, onMounted, computed } from 'vue';
import { ref, onBeforeMount, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { dashIfEmpty, toDate } from 'src/filters';
import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.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 RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy.vue';
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
import { useRole } from 'src/composables/useRole';
const route = useRoute();
const { t } = useI18n();
@ -23,64 +24,27 @@ const $props = defineProps({
});
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 () => {
workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`;
onBeforeMount(async () => {
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>
<template>
<CardSummary
ref="summary"
:url="`Workers/${entityId}`"
:filter="filter"
:url="`Workers/summary`"
:filter="{ where: { id: entityId } }"
data-key="WorkerSummary"
>
<template #header="{ entity }">
@ -88,10 +52,7 @@ const filter = {
</template>
<template #body="{ entity: worker }">
<QCard class="vn-one">
<VnTitle
:url="`#/worker/${entityId}/basic-data`"
:text="t('worker.summary.basicData')"
/>
<VnTitle :url="basicDataUrl" :text="t('worker.summary.basicData')" />
<VnLv :label="t('worker.card.name')" :value="worker.user?.nickname" />
<VnLv :label="t('worker.list.department')">
<template #value>
@ -128,13 +89,9 @@ const filter = {
<VnLinkPhone :phone-number="worker.client?.phone" />
</template>
</VnLv>
<VnLv :label="t('worker.summary.locker')" :value="worker.locker" />
</QCard>
<QCard class="vn-one">
<VnTitle
:url="`#/worker/${entityId}/basic-data`"
:text="t('worker.summary.basicData')"
/>
<QCard class="vn-one" v-if="advancedSummary">
<VnTitle :url="basicDataUrl" :text="t('worker.summary.basicData')" />
<VnLv
:label="t('worker.summary.fiDueDate')"
:value="toDate(worker.fiDueDate)"
@ -162,7 +119,6 @@ const filter = {
</QCard>
<QCard class="vn-one">
<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.list.email')"