0
0
Fork 0

Merge branch 'dev' into 7553_FixTicketExpedition

This commit is contained in:
Jon Elias 2024-09-06 12:05:07 +00:00
commit 4636e2f2e6
6 changed files with 43 additions and 53 deletions

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { onBeforeMount, computed } from 'vue'; import { onBeforeMount, computed } from 'vue';
import { useRoute, onBeforeRouteUpdate } from 'vue-router'; import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import useCardSize from 'src/composables/useCardSize'; import useCardSize from 'src/composables/useCardSize';
@ -17,10 +17,12 @@ const props = defineProps({
filterPanel: { type: Object, default: undefined }, filterPanel: { type: Object, default: undefined },
searchDataKey: { type: String, default: undefined }, searchDataKey: { type: String, default: undefined },
searchbarProps: { type: Object, default: undefined }, searchbarProps: { type: Object, default: undefined },
redirectOnError: { type: Boolean, default: false },
}); });
const stateStore = useStateStore(); const stateStore = useStateStore();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const url = computed(() => { const url = computed(() => {
if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`; if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`;
return props.customUrl; return props.customUrl;
@ -35,8 +37,12 @@ const arrayData = useArrayData(props.dataKey, {
}); });
onBeforeMount(async () => { onBeforeMount(async () => {
try {
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id }; if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
await arrayData.fetch({ append: false, updateRouter: false }); await arrayData.fetch({ append: false, updateRouter: false });
} catch (e) {
router.push({ name: 'WorkerList' });
}
}); });
if (props.baseUrl) { if (props.baseUrl) {

View File

@ -15,5 +15,6 @@ import WorkerFilter from '../WorkerFilter.vue';
label: 'Search worker', label: 'Search worker',
info: 'You can search by worker id or name', info: 'You can search by worker id or name',
}" }"
:redirect-on-error="true"
/> />
</template> </template>

View File

@ -38,29 +38,6 @@ const entityId = computed(() => {
const worker = ref(); const worker = ref();
const workerExcluded = ref(false); const workerExcluded = ref(false);
const filter = {
include: [
{
relation: 'user',
scope: {
fields: ['email', 'name', 'nickname'],
},
},
{
relation: 'department',
scope: {
include: [
{
relation: 'department',
},
],
},
},
{
relation: 'sip',
},
],
};
const sip = ref(null); const sip = ref(null);
watch( watch(
@ -74,14 +51,6 @@ watch(
} }
); );
const data = ref(useCardDescription());
const setData = (entity) => {
if (!entity) return;
data.value = useCardDescription(entity.user?.nickname, entity.id);
};
const openChangePasswordForm = () => changePasswordFormDialog.value.show();
const getIsExcluded = async () => { const getIsExcluded = async () => {
try { try {
const { data } = await axios.get( const { data } = await axios.get(
@ -115,14 +84,12 @@ const refetch = async () => await cardDescriptorRef.value.getData();
ref="cardDescriptorRef" ref="cardDescriptorRef"
module="Worker" module="Worker"
data-key="workerData" data-key="workerData"
:url="`Workers/${entityId}`" url="Workers/descriptor"
:filter="filter" :filter="{ where: { id: entityId } }"
:title="data.title" title="user.nickname"
:subtitle="data.subtitle"
@on-fetch=" @on-fetch="
(data) => { (data) => {
worker = data; worker = data;
setData(data);
getIsExcluded(); getIsExcluded();
} }
" "
@ -141,7 +108,7 @@ const refetch = async () => await cardDescriptorRef.value.getData();
v-if="!worker.user.emailVerified && user.id != worker.id" v-if="!worker.user.emailVerified && user.id != worker.id"
v-ripple v-ripple
clickable clickable
@click="openChangePasswordForm()" @click="$refs.changePasswordFormDialog.show()"
> >
<QItemSection> <QItemSection>
{{ t('Change password') }} {{ t('Change password') }}

View File

@ -34,13 +34,22 @@ const filter = {
{ {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['email', 'name', 'nickname', 'roleFk'], fields: ['name', 'nickname', 'roleFk'],
include: {
include: [
{
relation: 'role', relation: 'role',
scope: { scope: {
fields: ['name'], fields: ['name'],
}, },
}, },
{
relation: 'emailUser',
scope: {
fields: ['email'],
},
},
],
}, },
}, },
{ {
@ -153,14 +162,18 @@ 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.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 :label="t('worker.list.email')" :value="worker.user.email" copy /> <VnLv
:label="t('worker.list.email')"
:value="worker.user?.emailUser?.email"
copy
/>
<VnLv :label="t('worker.summary.role')"> <VnLv :label="t('worker.summary.role')">
<template #value> <template #value>
<span class="link"> <span class="link">
{{ worker.user.role.name }} {{ worker?.user?.role?.name }}
<RoleDescriptorProxy :id="worker.user.role.id" /> <RoleDescriptorProxy :id="worker?.user?.role?.id" />
</span> </span>
</template> </template>
</VnLv> </VnLv>

View File

@ -629,6 +629,9 @@ onMounted(async () => {
margin-bottom: 0px; margin-bottom: 0px;
} }
} }
:deep(.q-td) {
min-width: 170px;
}
</style> </style>
<i18n> <i18n>

View File

@ -1,12 +1,12 @@
describe('WorkerLocker', () => { describe('WorkerLocker', () => {
const workerId = 1109; const productionId = 49;
const lockerCode = '2F'; const lockerCode = '2F';
const input = '.q-card input'; const input = '.q-card input';
const thirdOpt = '[role="listbox"] .q-item:nth-child(1)'; const thirdOpt = '[role="listbox"] .q-item:nth-child(1)';
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('productionBoss'); cy.login('productionBoss');
cy.visit(`/#/worker/${workerId}/locker`); cy.visit(`/#/worker/${productionId}/locker`);
}); });
it('should allocates a locker', () => { it('should allocates a locker', () => {