forked from verdnatura/salix-front
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 4074-useAcls
This commit is contained in:
commit
86e1396da4
|
@ -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 () => {
|
||||
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) {
|
||||
|
|
|
@ -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: {
|
||||
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>
|
||||
|
|
|
@ -631,6 +631,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