Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8078-enableMultiSelection
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-10-28 13:26:27 +01:00
commit 526b7d91de
33 changed files with 162 additions and 195 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, defineModel } from 'vue'; import { computed } from 'vue';
const model = defineModel(undefined, { required: true }); const model = defineModel(undefined, { required: true });
const $props = defineProps({ const $props = defineProps({

View File

@ -1,6 +1,3 @@
<script setup>
defineProps({ wrap: { type: Boolean, default: false } });
</script>
<template> <template>
<div class="vn-row q-gutter-md q-mb-md"> <div class="vn-row q-gutter-md q-mb-md">
<slot /> <slot />

View File

@ -0,0 +1,11 @@
import axios from 'axios';
import { useRole } from './useRole';
export async function useAdvancedSummary(model, id, roles = ['hr']) {
if (useRole().hasAny(roles)) {
const { data } = await axios.get(`${model}/advancedSummary`, {
params: { filter: { where: { id } } },
});
return Array.isArray(data) ? data[0] : data;
}
}

View File

@ -278,6 +278,7 @@ globals:
RouteExtendedList: Router RouteExtendedList: Router
wasteRecalc: Waste recaclulate wasteRecalc: Waste recaclulate
operator: Operator operator: Operator
parking: Parking
supplier: Supplier supplier: Supplier
created: Created created: Created
worker: Worker worker: Worker
@ -663,8 +664,6 @@ parking:
sector: Sector sector: Sector
row: Row row: Row
column: Column column: Column
pageTitles:
parking: Parking
searchBar: searchBar:
info: You can search by parking code info: You can search by parking code
label: Search parking... label: Search parking...

View File

@ -282,6 +282,7 @@ globals:
medical: Mutua medical: Mutua
wasteRecalc: Recalcular mermas wasteRecalc: Recalcular mermas
operator: Operario operator: Operario
parking: Parking
supplier: Proveedor supplier: Proveedor
created: Fecha creación created: Fecha creación
worker: Trabajador worker: Trabajador
@ -710,8 +711,6 @@ parking:
pickingOrder: Orden de recogida pickingOrder: Orden de recogida
row: Fila row: Fila
column: Columna column: Columna
pageTitles:
parking: Parking
searchBar: searchBar:
info: Puedes buscar por código de parking info: Puedes buscar por código de parking
label: Buscar parking... label: Buscar parking...

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import ItemTypeDescriptor from 'src/pages/ItemType/Card/ItemTypeDescriptor.vue'; import ItemTypeDescriptor from 'src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue';
import ItemTypeFilter from 'src/pages/ItemType/ItemTypeFilter.vue'; import ItemTypeFilter from 'src/pages/Item/ItemType/ItemTypeFilter.vue';
import ItemTypeSearchbar from '../ItemTypeSearchbar.vue'; import ItemTypeSearchbar from '../ItemTypeSearchbar.vue';
</script> </script>
<template> <template>

View File

@ -12,6 +12,39 @@ const props = defineProps({
}); });
const emit = defineEmits(['search']); const emit = defineEmits(['search']);
const exprBuilder = (param, value) => {
switch (param) {
case 'name':
return {
name: { like: `%${value}%` },
};
case 'code':
return {
code: { like: `%${value}%` },
};
case 'search':
if (value) {
if (!isNaN(value)) {
return { id: value };
} else {
return {
or: [
{
name: {
like: `%${value}%`,
},
},
{
code: {
like: `%${value}%`,
},
},
],
};
}
}
}
};
</script> </script>
<template> <template>
@ -19,6 +52,8 @@ const emit = defineEmits(['search']);
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
@search="emit('search')" @search="emit('search')"
search-url="table"
:expr-builder="exprBuilder"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">

View File

@ -10,6 +10,7 @@ const { t } = useI18n();
url="ItemTypes" url="ItemTypes"
:label="t('Search item type')" :label="t('Search item type')"
:info="t('Search itemType by id, name or code')" :info="t('Search itemType by id, name or code')"
search-url="table"
/> />
</template> </template>
<i18n> <i18n>

View File

@ -1,98 +0,0 @@
<script setup>
import { reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n();
const router = useRouter();
const newItemTypeForm = reactive({});
const categoriesOptions = ref([]);
const temperaturesOptions = ref([]);
const redirectToItemTypeBasicData = (_, { id }) => {
router.push({ name: 'ItemTypeBasicData', params: { id } });
};
</script>
<template>
<FetchData
url="ItemCategories"
@on-fetch="(data) => (categoriesOptions = data)"
:filter="{ order: 'name ASC', fields: ['id', 'name'] }"
auto-load
/>
<FetchData
url="Temperatures"
@on-fetch="(data) => (temperaturesOptions = data)"
:filter="{ order: 'name ASC', fields: ['code', 'name'] }"
auto-load
/>
<QPage>
<VnSubToolbar />
<FormModel
url-create="ItemTypes"
model="itemTypeCreate"
:form-initial-data="newItemTypeForm"
observe-form-changes
@on-data-saved="redirectToItemTypeBasicData"
>
<template #form="{ data }">
<VnRow>
<VnInput v-model="data.code" :label="t('itemType.shared.code')" />
<VnInput v-model="data.name" :label="t('itemType.shared.name')" />
</VnRow>
<VnRow>
<VnSelect
url="Workers/search"
v-model="data.workerFk"
:label="t('shared.worker')"
sort-by="nickname ASC"
:fields="['id', 'nickname']"
:params="{ departmentCodes: ['shopping'] }"
option-label="nickname"
option-value="id"
hide-selected
><template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption
>{{ scope.opt?.nickname }},
{{ scope.opt?.code }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnSelect
v-model="data.categoryFk"
:label="t('itemType.shared.category')"
:options="categoriesOptions"
option-value="id"
option-label="name"
hide-selected
/>
</VnRow>
<VnRow>
<VnSelect
v-model="data.temperatureFk"
:label="t('itemType.shared.temperature')"
:options="temperaturesOptions"
option-value="code"
option-label="name"
hide-selected
/>
</VnRow>
</template>
</FormModel>
</QPage>
</template>

View File

@ -1,13 +1,16 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import ItemTypeSearchbar from '../ItemType/ItemTypeSearchbar.vue'; import ItemTypeSearchbar from 'src/pages/Item/ItemType/ItemTypeSearchbar.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ItemTypeFilter from './ItemType/ItemTypeFilter.vue';
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
const ItemCategoriesOptions = ref([]); const itemCategoriesOptions = ref([]);
const temperatureOptions = ref([]);
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -34,7 +37,6 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'workerFk',
label: t('worker'), label: t('worker'),
create: true, create: true,
component: 'select', component: 'select',
@ -45,6 +47,19 @@ const columns = computed(() => [
}, },
cardVisible: true, cardVisible: true,
visible: true, visible: true,
columnField: {
component: 'userLink',
attrs: ({ row }) => {
return {
workerId: row?.worker?.id,
name: row.worker?.user?.name,
defaultName: true,
};
},
},
columnFilter: {
name: 'workerFk',
},
}, },
{ {
align: 'left', align: 'left',
@ -53,9 +68,7 @@ const columns = computed(() => [
create: true, create: true,
component: 'select', component: 'select',
attrs: { attrs: {
options: ItemCategoriesOptions.value, options: itemCategoriesOptions.value,
fields: ['id', 'name'],
order: 'name ASC',
}, },
cardVisible: false, cardVisible: false,
visible: false, visible: false,
@ -67,8 +80,7 @@ const columns = computed(() => [
create: true, create: true,
component: 'select', component: 'select',
attrs: { attrs: {
url: 'Temperatures', options: temperatureOptions.value,
fields: ['id', 'name'],
}, },
cardVisible: false, cardVisible: false,
visible: false, visible: false,
@ -80,26 +92,52 @@ const columns = computed(() => [
<FetchData <FetchData
url="ItemCategories" url="ItemCategories"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }" :filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
@on-fetch="(data) => (ItemCategoriesOptions = data)" @on-fetch="(data) => (itemCategoriesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Temperatures"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
@on-fetch="(data) => (temperatureOptions = data)"
auto-load
/>
<RightMenu>
<template #right-panel>
<ItemTypeFilter data-key="ItemTypeList" />
</template>
</RightMenu>
<ItemTypeSearchbar /> <ItemTypeSearchbar />
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="ItemTypeList" data-key="ItemTypeList"
:url="`ItemTypes`" url="ItemTypes"
:create="{ :create="{
urlCreate: 'ItemTypes', urlCreate: 'ItemTypes',
title: t('Create ItemTypes'), title: t('Create ItemTypes'),
onDataSaved: () => tableRef.reload(), onDataSaved: () => tableRef.reload(),
formInitialData: {}, formInitialData: {},
}" }"
:user-filter="{
include: {
relation: 'worker',
scope: {
fields: ['id'],
include: {
relation: 'user',
scope: {
fields: ['id', 'name'],
},
},
},
},
}"
order="name ASC" order="name ASC"
:columns="columns" :columns="columns"
auto-load auto-load
:right-search="false" :right-search="false"
:is-editable="false" :is-editable="false"
:use-model="true" :use-model="true"
redirect="item/item-type"
/> />
</template> </template>

View File

@ -2,17 +2,11 @@
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import ParkingDescriptor from 'pages/Parking/Card/ParkingDescriptor.vue'; import ParkingDescriptor from 'pages/Parking/Card/ParkingDescriptor.vue';
import ParkingFilter from 'pages/Parking/ParkingFilter.vue'; import ParkingFilter from 'pages/Parking/ParkingFilter.vue';
const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
};
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Parking" data-key="Parking"
base-url="Parkings" base-url="Parkings"
:filter="filter"
:descriptor="ParkingDescriptor" :descriptor="ParkingDescriptor"
:filter-panel="ParkingFilter" :filter-panel="ParkingFilter"
search-data-key="ParkingList" search-data-key="ParkingList"

View File

@ -29,6 +29,7 @@ const filter = {
:url="`Parkings/${entityId}`" :url="`Parkings/${entityId}`"
title="code" title="code"
:filter="filter" :filter="filter"
:to-module="{ name: 'ParkingList' }"
> >
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('globals.code')" :value="entity.code" /> <VnLv :label="t('globals.code')" :value="entity.code" />

View File

@ -22,7 +22,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
const filter = { const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder'], fields: ['id', 'sectorFk', 'code', 'pickingOrder'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
}; };
function exprBuilder(param, value) { function exprBuilder(param, value) {
@ -55,10 +54,9 @@ function exprBuilder(param, value) {
<VnPaginate <VnPaginate
data-key="ParkingList" data-key="ParkingList"
url="Parkings" url="Parkings"
:filter="filter" :user-filter="filter"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:limit="20" :limit="20"
auto-load
order="code" order="code"
> >
<template #body="{ rows }"> <template #body="{ rows }">

View File

@ -348,7 +348,6 @@ async function hasDocuware() {
} }
async function uploadDocuware(force) { async function uploadDocuware(force) {
console.log('force: ', force);
if (!force) if (!force)
return quasar return quasar
.dialog({ .dialog({

View File

@ -211,6 +211,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<template #st-actions> <template #st-actions>
<QBtnGroup push class="q-gutter-x-sm" flat> <QBtnGroup push class="q-gutter-x-sm" flat>
<VnBtnSelect <VnBtnSelect
data-cy="change-state"
:disable="!hasSelectedRows" :disable="!hasSelectedRows"
color="primary" color="primary"
:label="t('globals.changeState')" :label="t('globals.changeState')"

View File

@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnProgress from 'src/components/common/VnProgressModal.vue'; import VnProgress from 'src/components/common/VnProgressModal.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import TicketAdvanceFilter from './TicketAdvanceFilter.vue'; import TicketAdvanceFilter from './TicketAdvanceFilter.vue';

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref, onBeforeMount } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
@ -8,32 +8,22 @@ import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const educationLevels = ref([]); const educationLevels = ref([]);
const countries = ref([]); const countries = ref([]);
const maritalStatus = [ const maritalStatus = [
{ code: 'M', name: t('Married') }, { code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') }, { code: 'S', name: t('Single') },
]; ];
const advancedSummary = ref({});
const workerFilter = { onBeforeMount(async () => {
include: [ advancedSummary.value =
{ (await useAdvancedSummary('Workers', +useRoute().params.id)) ?? {};
relation: 'user', });
scope: {
fields: ['name', 'emailVerified'],
include: { relation: 'emailUser', scope: { fields: ['email'] } },
},
},
{ relation: 'sip', scope: { fields: ['extension', 'secret'] } },
{ relation: 'department', scope: { include: { relation: 'department' } } },
],
};
</script> </script>
<template> <template>
<FetchData <FetchData
:filter="{ fields: ['id', 'name'], order: 'name ASC' }" :filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@ -48,10 +38,16 @@ const workerFilter = {
auto-load auto-load
/> />
<FormModel <FormModel
:filter="workerFilter" :filter="{ where: { id: +$route.params.id } }"
:url="`Workers/${route.params.id}`" url="Workers/summary"
:url-update="`Workers/${$route.params.id}`"
auto-load auto-load
model="Worker" model="Worker"
@on-fetch="
async (data) => {
Object.assign(data, advancedSummary);
}
"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
@ -134,7 +130,7 @@ const workerFilter = {
<VnInput v-model="data.fi" :label="t('fi')" /> <VnInput v-model="data.fi" :label="t('fi')" />
<VnInputDate :label="t('birth')" v-model="data.birth" /> <VnInputDate :label="t('birth')" v-model="data.birth" />
</VnRow> </VnRow>
<VnRow> <VnRow wrap>
<QCheckbox <QCheckbox
size="sm" size="sm"
:label="t('isFreelance')" :label="t('isFreelance')"

View File

@ -18,7 +18,7 @@ const { store } = useArrayData('Worker');
const entityId = computed(() => useRoute().params.id); const entityId = computed(() => useRoute().params.id);
const filter = computed(() => ({ const filter = computed(() => ({
where: { where: {
gender: store.data?.sex, gender: store.data?.[0]?.sex,
or: [{ workerFk: null }, { workerFk: entityId.value }], or: [{ workerFk: null }, { workerFk: entityId.value }],
}, },
})); }));
@ -51,6 +51,7 @@ const init = async (data) => {
> >
<template #form="{ data }"> <template #form="{ data }">
<VnSelect <VnSelect
data-cy="locker"
:label="t('Locker')" :label="t('Locker')"
v-model="data.id" v-model="data.id"
:options="lockers" :options="lockers"

View File

@ -2,7 +2,6 @@
import { ref, onBeforeMount, 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 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';
@ -11,7 +10,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'; import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -25,18 +24,11 @@ const $props = defineProps({
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const basicDataUrl = ref(null); const basicDataUrl = ref(null);
const isHr = computed(() => useRole().hasAny(['hr']));
const advancedSummary = ref(); const advancedSummary = ref();
onBeforeMount(async () => { onBeforeMount(async () => {
if (isHr.value) { advancedSummary.value = await useAdvancedSummary('Workers', entityId.value);
advancedSummary.value = ( basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
await axios.get('Workers/advancedSummary', {
params: { filter: { where: { id: entityId.value } } },
})
).data[0];
basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
}
}); });
</script> </script>
@ -101,21 +93,27 @@ onBeforeMount(async () => {
:label="t('worker.summary.seniority')" :label="t('worker.summary.seniority')"
:value="toDate(worker.seniority)" :value="toDate(worker.seniority)"
/> />
<VnLv :label="t('worker.summary.fi')" :value="worker.fi" /> <VnLv :label="t('worker.summary.fi')" :value="advancedSummary.fi" />
<VnLv :label="t('worker.summary.birth')" :value="toDate(worker.birth)" /> <VnLv
:label="t('worker.summary.birth')"
:value="toDate(advancedSummary.birth)"
/>
<VnLv <VnLv
:label="t('worker.summary.isFreelance')" :label="t('worker.summary.isFreelance')"
:value="worker.isFreelance" :value="advancedSummary.isFreelance"
/> />
<VnLv <VnLv
:label="t('worker.summary.isSsDiscounted')" :label="t('worker.summary.isSsDiscounted')"
:value="worker.isSsDiscounted" :value="advancedSummary.isSsDiscounted"
/> />
<VnLv <VnLv
:label="t('worker.summary.hasMachineryAuthorized')" :label="t('worker.summary.hasMachineryAuthorized')"
:value="worker.hasMachineryAuthorized" :value="advancedSummary.hasMachineryAuthorized"
/>
<VnLv
:label="t('worker.summary.isDisable')"
:value="advancedSummary.isDisable"
/> />
<VnLv :label="t('worker.summary.isDisable')" :value="worker.isDisable" />
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<VnTitle :text="t('worker.summary.userData')" /> <VnTitle :text="t('worker.summary.userData')" />

View File

@ -97,14 +97,6 @@ export default {
}, },
component: () => import('src/pages/Item/ItemTypeList.vue'), component: () => import('src/pages/Item/ItemTypeList.vue'),
}, },
{
path: 'item-type-list/create',
name: 'ItemTypeCreate',
meta: {
title: 'itemTypeCreate',
},
component: () => import('src/pages/Item/ItemTypeCreate.vue'),
},
], ],
}, },
{ {

View File

@ -18,7 +18,7 @@ export default {
{ {
name: 'ItemTypeCard', name: 'ItemTypeCard',
path: ':id', path: ':id',
component: () => import('src/pages/ItemType/Card/ItemTypeCard.vue'), component: () => import('src/pages/Item/ItemType/Card/ItemTypeCard.vue'),
redirect: { name: 'ItemTypeSummary' }, redirect: { name: 'ItemTypeSummary' },
children: [ children: [
{ {
@ -28,7 +28,7 @@ export default {
title: 'summary', title: 'summary',
}, },
component: () => component: () =>
import('src/pages/ItemType/Card/ItemTypeSummary.vue'), import('src/pages/Item/ItemType/Card/ItemTypeSummary.vue'),
}, },
{ {
name: 'ItemTypeBasicData', name: 'ItemTypeBasicData',
@ -38,7 +38,7 @@ export default {
icon: 'vn:settings', icon: 'vn:settings',
}, },
component: () => component: () =>
import('src/pages/ItemType/Card/ItemTypeBasicData.vue'), import('src/pages/Item/ItemType/Card/ItemTypeBasicData.vue'),
}, },
{ {
path: 'log', path: 'log',
@ -47,7 +47,8 @@ export default {
title: 'log', title: 'log',
icon: 'vn:History', icon: 'vn:History',
}, },
component: () => import('src/pages/ItemType/Card/ItemTypeLog.vue'), component: () =>
import('src/pages/Item/ItemType/Card/ItemTypeLog.vue'),
}, },
], ],
}, },

View File

@ -87,6 +87,13 @@ export default {
meta: { meta: {
title: 'basicData', title: 'basicData',
icon: 'vn:settings', icon: 'vn:settings',
acls: [
{
model: 'Worker',
props: 'updateAttributes',
accessType: 'WRITE',
},
],
}, },
component: () => import('src/pages/Worker/Card/WorkerBasicData.vue'), component: () => import('src/pages/Worker/Card/WorkerBasicData.vue'),
}, },

View File

@ -1,5 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('ParkingList', () => { describe('ParkingList', () => {
const searchbar = '#searchbar input';
const firstCard = '.q-card:nth-child(1)'; const firstCard = '.q-card:nth-child(1)';
const firstChipId = const firstChipId =
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content'; ':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
@ -14,6 +15,7 @@ describe('ParkingList', () => {
}); });
it('should redirect on clicking a parking', () => { it('should redirect on clicking a parking', () => {
cy.get(searchbar).type('{enter}');
cy.get(firstChipId) cy.get(firstChipId)
.invoke('text') .invoke('text')
.then((content) => { .then((content) => {
@ -24,6 +26,7 @@ describe('ParkingList', () => {
}); });
it('should open the details', () => { it('should open the details', () => {
cy.get(searchbar).type('{enter}');
cy.get(firstDetailBtn).click(); cy.get(firstDetailBtn).click();
cy.get(summaryHeader).contains('Basic data'); cy.get(summaryHeader).contains('Basic data');
}); });

View File

@ -11,15 +11,13 @@ describe('Ticket expedtion', () => {
it('should change the state', () => { it('should change the state', () => {
cy.visit('#/ticket/1/expedition'); cy.visit('#/ticket/1/expedition');
cy.intercept('GET', /\/api\/Expeditions\/filter/).as('expeditions'); cy.intercept('GET', /\/api\/Expeditions\/filter/).as('show');
cy.intercept('POST', /\/api\/Expeditions\/crud/).as('crud'); cy.intercept('POST', /\/api\/ExpeditionStates\/addExpeditionState/).as('add');
cy.wait('@expeditions');
cy.wait('@show');
cy.selectRows([1, 2]); cy.selectRows([1, 2]);
cy.get('#subToolbar [aria-controls]:nth-child(1)').click(); cy.selectOption('[data-cy="change-state"]', 'Perdida');
cy.get('.q-menu .q-item').contains('Perdida').click(); cy.wait('@add');
cy.wait('@crud');
cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => { cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
cy.wrap($el).contains('Perdida'); cy.wrap($el).contains('Perdida');

View File

@ -11,7 +11,7 @@ describe('WorkerList', () => {
it('should open the worker summary', () => { it('should open the worker summary', () => {
cy.get(inputName).type('jessica{enter}'); cy.get(inputName).type('jessica{enter}');
cy.get(searchBtn).click(); cy.get(searchBtn).click();
cy.intercept('GET', /\/api\/Workers\/\d+/).as('worker'); cy.intercept('GET', /\/api\/Workers\/summary+/).as('worker');
cy.wait('@worker').then(() => cy.wait('@worker').then(() =>
cy.get(descriptorTitle).should('include.text', 'Jessica') cy.get(descriptorTitle).should('include.text', 'Jessica')
); );

View File

@ -1,8 +1,7 @@
describe('WorkerLocker', () => { describe('WorkerLocker', () => {
const productionId = 49; const productionId = 49;
const lockerCode = '2F'; const lockerCode = '4F';
const input = '.q-card input'; const lockerSelect = '[data-cy="locker"]';
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');
@ -10,10 +9,8 @@ describe('WorkerLocker', () => {
}); });
it('should allocates a locker', () => { it('should allocates a locker', () => {
cy.get(input).click(); cy.selectOption(lockerSelect, lockerCode);
cy.waitForElement('[role="listbox"]');
cy.get(thirdOpt).click();
cy.saveCard(); cy.saveCard();
cy.get(input).invoke('val').should('eq', lockerCode); cy.get(lockerSelect).invoke('val').should('eq', lockerCode);
}); });
}); });

View File

@ -82,7 +82,7 @@ Cypress.Commands.add('getValue', (selector) => {
// Fill Inputs // Fill Inputs
Cypress.Commands.add('selectOption', (selector, option) => { Cypress.Commands.add('selectOption', (selector, option) => {
cy.waitForElement(selector); cy.waitForElement(selector);
cy.get(selector).find('.q-select__dropdown-icon').click(); cy.get(selector).click();
cy.get('.q-menu .q-item').contains(option).click(); cy.get('.q-menu .q-item').contains(option).click();
}); });