Merge branch '7553_FixTicketExpedition' of https://gitea.verdnatura.es/verdnatura/salix-front into 7553_FixTicketExpedition
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
94ae74ca7f
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
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 { useStateStore } from 'stores/useStateStore';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
@ -17,10 +17,12 @@ const props = defineProps({
|
|||
filterPanel: { type: Object, default: undefined },
|
||||
searchDataKey: { type: String, default: undefined },
|
||||
searchbarProps: { type: Object, default: undefined },
|
||||
redirectOnError: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const url = computed(() => {
|
||||
if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`;
|
||||
return props.customUrl;
|
||||
|
@ -35,8 +37,12 @@ const arrayData = useArrayData(props.dataKey, {
|
|||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
||||
await arrayData.fetch({ append: false, updateRouter: false });
|
||||
try {
|
||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
||||
await arrayData.fetch({ append: false, updateRouter: false });
|
||||
} catch (e) {
|
||||
router.push({ name: 'WorkerList' });
|
||||
}
|
||||
});
|
||||
|
||||
if (props.baseUrl) {
|
||||
|
|
|
@ -132,17 +132,6 @@ async function search(evt) {
|
|||
}
|
||||
}
|
||||
|
||||
async function reload() {
|
||||
isLoading.value = true;
|
||||
const params = Object.values(userParams.value).filter((param) => param);
|
||||
store.skip = 0;
|
||||
store.page = 1;
|
||||
await arrayData.fetch({ append: false });
|
||||
if (!$props.showAll && !params.length) store.data = [];
|
||||
isLoading.value = false;
|
||||
emit('refresh');
|
||||
}
|
||||
|
||||
async function clearFilters() {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
|
@ -231,32 +220,18 @@ function sanitizer(params) {
|
|||
</QItemLabel>
|
||||
</QItemSection>
|
||||
<QItemSection top side>
|
||||
<div class="q-gutter-xs">
|
||||
<QBtn
|
||||
@click="clearFilters"
|
||||
color="primary"
|
||||
dense
|
||||
flat
|
||||
icon="filter_list_off"
|
||||
padding="none"
|
||||
round
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>{{ t('Remove filters') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
@click="reload"
|
||||
color="primary"
|
||||
dense
|
||||
flat
|
||||
icon="refresh"
|
||||
padding="none"
|
||||
round
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>{{ t('Refresh') }}</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
<QBtn
|
||||
@click="clearFilters"
|
||||
color="primary"
|
||||
dense
|
||||
flat
|
||||
icon="filter_list_off"
|
||||
padding="none"
|
||||
round
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>{{ t('Remove filters') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
|
|
|
@ -15,5 +15,6 @@ import WorkerFilter from '../WorkerFilter.vue';
|
|||
label: 'Search worker',
|
||||
info: 'You can search by worker id or name',
|
||||
}"
|
||||
:redirect-on-error="true"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -38,29 +38,6 @@ const entityId = computed(() => {
|
|||
|
||||
const worker = ref();
|
||||
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);
|
||||
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 () => {
|
||||
try {
|
||||
const { data } = await axios.get(
|
||||
|
@ -115,14 +84,12 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
|||
ref="cardDescriptorRef"
|
||||
module="Worker"
|
||||
data-key="workerData"
|
||||
:url="`Workers/${entityId}`"
|
||||
:filter="filter"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
url="Workers/descriptor"
|
||||
:filter="{ where: { id: entityId } }"
|
||||
title="user.nickname"
|
||||
@on-fetch="
|
||||
(data) => {
|
||||
worker = data;
|
||||
setData(data);
|
||||
getIsExcluded();
|
||||
}
|
||||
"
|
||||
|
@ -141,7 +108,7 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
|||
v-if="!worker.user.emailVerified && user.id != worker.id"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="openChangePasswordForm()"
|
||||
@click="$refs.changePasswordFormDialog.show()"
|
||||
>
|
||||
<QItemSection>
|
||||
{{ t('Change password') }}
|
||||
|
|
|
@ -34,13 +34,22 @@ const filter = {
|
|||
{
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['email', 'name', 'nickname', 'roleFk'],
|
||||
include: {
|
||||
relation: 'role',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
fields: ['name', 'nickname', 'roleFk'],
|
||||
|
||||
include: [
|
||||
{
|
||||
relation: 'role',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'emailUser',
|
||||
scope: {
|
||||
fields: ['email'],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -153,14 +162,18 @@ 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')" :value="worker.user.email" copy />
|
||||
<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')"
|
||||
:value="worker.user?.emailUser?.email"
|
||||
copy
|
||||
/>
|
||||
<VnLv :label="t('worker.summary.role')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ worker.user.role.name }}
|
||||
<RoleDescriptorProxy :id="worker.user.role.id" />
|
||||
{{ worker?.user?.role?.name }}
|
||||
<RoleDescriptorProxy :id="worker?.user?.role?.id" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
|
|
|
@ -629,6 +629,9 @@ onMounted(async () => {
|
|||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
:deep(.q-td) {
|
||||
min-width: 170px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
describe('WorkerLocker', () => {
|
||||
const workerId = 1109;
|
||||
const productionId = 49;
|
||||
const lockerCode = '2F';
|
||||
const input = '.q-card input';
|
||||
const thirdOpt = '[role="listbox"] .q-item:nth-child(1)';
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
cy.login('productionBoss');
|
||||
cy.visit(`/#/worker/${workerId}/locker`);
|
||||
cy.visit(`/#/worker/${productionId}/locker`);
|
||||
});
|
||||
|
||||
it('should allocates a locker', () => {
|
||||
|
|
Loading…
Reference in New Issue