@@ -635,6 +644,7 @@ onMounted(async () => {
{
>
{{ row.state }}
+ {{ dashIfEmpty(row.state) }}
diff --git a/src/pages/Ticket/TicketAdvanceFilter.vue b/src/pages/Ticket/TicketAdvanceFilter.vue
index ed61d9447..209a1a307 100644
--- a/src/pages/Ticket/TicketAdvanceFilter.vue
+++ b/src/pages/Ticket/TicketAdvanceFilter.vue
@@ -55,7 +55,7 @@ onMounted(async () => await getItemPackingTypes());
:data-key="props.dataKey"
:search-button="true"
:hidden-tags="['search']"
- :un-removable-params="['warehouseFk', 'dateFuture', 'dateToAdvance']"
+ :unremovable-params="['warehouseFk', 'dateFuture', 'dateToAdvance']"
>
@@ -119,10 +119,9 @@ onMounted(async () => await getItemPackingTypes());
@@ -155,7 +154,7 @@ en:
dateToAdvance: Destination date
futureIpt: Origin IPT
ipt: Destination IPT
- itemPackingTypes: 100% movable
+ isFullMovable: 100% movable
warehouseFk: Warehouse
es:
Horizontal: Horizontal
@@ -166,6 +165,6 @@ es:
dateToAdvance: Fecha destino
futureIpt: IPT Origen
ipt: IPT destino
- itemPackingTypes: 100% movible
+ isFullMovable: 100% movible
warehouseFk: Almacén
diff --git a/src/pages/Ticket/TicketCreateDialog.vue b/src/pages/Ticket/TicketCreateDialog.vue
new file mode 100644
index 000000000..1493adc53
--- /dev/null
+++ b/src/pages/Ticket/TicketCreateDialog.vue
@@ -0,0 +1,226 @@
+
+
+
+ (clientOptions = data)"
+ :filter="{ fields: ['id', 'name', 'defaultAddressFk'], order: 'id' }"
+ auto-load
+ />
+ (warehousesOptions = data)"
+ order="name"
+ auto-load
+ />
+
+
+
+
+
+ onClientSelected(data)"
+ >
+
+
+
+
+ {{ scope.opt.name }}
+
+
+ {{ `#${scope.opt.id}` }}
+
+
+
+
+
+
+
+
+
+ fetchAvailableAgencies(data)"
+ >
+
+
+
+
+ {{ scope.opt.nickname }}
+
+
+ {{ `${scope.opt.street}, ${scope.opt.city}` }}
+
+
+
+
+
+
+
+
+
+ fetchAvailableAgencies(data)"
+ />
+
+
+
+
+ fetchAvailableAgencies(data)"
+ />
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/Ticket/TicketFuture.vue b/src/pages/Ticket/TicketFuture.vue
index 14a4a5ac8..2078d0595 100644
--- a/src/pages/Ticket/TicketFuture.vue
+++ b/src/pages/Ticket/TicketFuture.vue
@@ -49,8 +49,8 @@ const exprBuilder = (param, value) => {
};
const userParams = reactive({
- futureDated: Date.vnNew().toISOString(),
- originDated: Date.vnNew().toISOString(),
+ futureScopeDays: Date.vnNew().toISOString(),
+ originScopeDays: Date.vnNew().toISOString(),
warehouseFk: user.value.warehouseFk,
});
@@ -62,8 +62,8 @@ const arrayData = useArrayData('FutureTickets', {
const { store } = arrayData;
const params = reactive({
- futureDated: Date.vnNew(),
- originDated: Date.vnNew(),
+ futureScopeDays: Date.vnNew(),
+ originScopeDays: Date.vnNew(),
warehouseFk: user.value.warehouseFk,
});
@@ -172,7 +172,7 @@ const ticketColumns = computed(() => [
label: t('futureTickets.availableLines'),
name: 'lines',
field: 'lines',
- align: 'left',
+ align: 'center',
sortable: true,
columnFilter: {
component: VnInput,
@@ -234,7 +234,7 @@ const ticketColumns = computed(() => [
{
label: t('futureTickets.futureState'),
name: 'futureState',
- align: 'left',
+ align: 'right',
sortable: true,
columnFilter: null,
format: (val) => dashIfEmpty(val),
@@ -458,7 +458,7 @@ onMounted(async () => {
-
+
{
-
+
{
diff --git a/src/pages/Wagon/Type/WagonTypeEdit.vue b/src/pages/Wagon/Type/WagonTypeEdit.vue
new file mode 100644
index 000000000..eb8205d72
--- /dev/null
+++ b/src/pages/Wagon/Type/WagonTypeEdit.vue
@@ -0,0 +1,293 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ en:
+ tray: Tray
+ wagonColor: Wagon color
+ Select a tray: Select a tray
+ es:
+ tray: Bandeja
+ wagonColor: Color de la bandeja
+ Select a tray: Seleccione una bandeja
+ Create new Wagon type: Crear nuevo tipo de vagón
+ Add new tray: Añadir nueva bandeja
+ Height: Altura
+ Tray added successfully: Bandeja añadida correctamente
+ Tray deleted successfully: Bandeja eliminada correctamente
+
diff --git a/src/pages/Wagon/Type/WagonTypeList.vue b/src/pages/Wagon/Type/WagonTypeList.vue
index b7bbf8c5d..7615dea02 100644
--- a/src/pages/Wagon/Type/WagonTypeList.vue
+++ b/src/pages/Wagon/Type/WagonTypeList.vue
@@ -1,4 +1,5 @@
@@ -43,8 +48,9 @@ async function remove(row) {
@@ -54,12 +60,19 @@ async function remove(row) {
:key="row.id"
:title="(row.name || '').toString()"
:id="row.id"
- @click="navigate(row.id)"
+ @click="navigate(row.id, row.name)"
>
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('globals.new') }}
+
+
+
+en:
+ nameNotEmpty: The name cannot be empty
+es:
+ Create new Wagon type: Crear nuevo tipo de vagón
+ Name: Nombre
+ nameNotEmpty: El nombre no puede estar vacío
+
diff --git a/src/pages/Worker/Card/WorkerDescriptor.vue b/src/pages/Worker/Card/WorkerDescriptor.vue
index 8d7f4f683..be30537df 100644
--- a/src/pages/Worker/Card/WorkerDescriptor.vue
+++ b/src/pages/Worker/Card/WorkerDescriptor.vue
@@ -151,7 +151,7 @@ const refetch = async () => await cardDescriptorRef.value.getData();
-
+
diff --git a/src/pages/Worker/Card/WorkerLocker.vue b/src/pages/Worker/Card/WorkerLocker.vue
index f19fc8ae6..4a19e472c 100644
--- a/src/pages/Worker/Card/WorkerLocker.vue
+++ b/src/pages/Worker/Card/WorkerLocker.vue
@@ -3,13 +3,13 @@ import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
-import { useRole } from 'src/composables/useRole';
+import { useAcl } from 'src/composables/useAcl';
import FormModel from 'components/FormModel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import { useArrayData } from 'src/composables/useArrayData';
import FetchData from 'components/FetchData.vue';
-const { hasAny } = useRole();
+const { hasAny } = useAcl();
const { t } = useI18n();
const fetchData = ref();
const originaLockerId = ref();
@@ -57,7 +57,11 @@ const init = async (data) => {
option-label="code"
option-value="id"
hide-selected
- :readonly="!hasAny(['productionBoss', 'hr'])"
+ :readonly="
+ !hasAny([
+ { model: 'Worker', props: '__get__locker', accessType: 'READ' },
+ ])
+ "
/>
diff --git a/src/pages/Worker/Card/WorkerTimeControl.vue b/src/pages/Worker/Card/WorkerTimeControl.vue
index f68614575..abf60a078 100644
--- a/src/pages/Worker/Card/WorkerTimeControl.vue
+++ b/src/pages/Worker/Card/WorkerTimeControl.vue
@@ -13,6 +13,7 @@ import WorkerTimeControlCalendar from 'pages/Worker/Card/WorkerTimeControlCalend
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
import { useRole } from 'src/composables/useRole';
+import { useAcl } from 'src/composables/useAcl';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import { useStateStore } from 'stores/useStateStore';
import { useState } from 'src/composables/useState';
@@ -26,7 +27,6 @@ import { date } from 'quasar';
const route = useRoute();
const { t, locale } = useI18n();
const { notify } = useNotify();
-const { hasAny } = useRole();
const _state = useState();
const user = _state.getUser();
const stateStore = useStateStore();
@@ -66,9 +66,11 @@ const arrayData = useArrayData('workerData');
const worker = computed(() => arrayData.store?.data);
-const isHr = computed(() => hasAny(['hr']));
+const isHr = computed(() => useRole().hasAny(['hr']));
-const isHimSelf = computed(() => user.value.id === Number(route.params.id));
+const canSend = computed(() => useAcl().hasAny('WorkerTimeControl', 'sendMail', 'WRITE'));
+
+const isHimself = computed(() => user.value.id === Number(route.params.id));
const columns = computed(() => {
return weekdayStore.getLocales?.map((day, index) => {
@@ -447,7 +449,7 @@ onMounted(async () => {
{
@click="isSatisfied()"
/>
{
{
diff --git a/src/pages/Worker/Card/WorkerTimeReasonForm.vue b/src/pages/Worker/Card/WorkerTimeReasonForm.vue
index 5c1ab9118..23bdba15e 100644
--- a/src/pages/Worker/Card/WorkerTimeReasonForm.vue
+++ b/src/pages/Worker/Card/WorkerTimeReasonForm.vue
@@ -9,7 +9,7 @@ const $props = defineProps({
type: String,
default: '',
},
- isHimSelf: {
+ isHimself: {
type: Boolean,
default: false,
},
@@ -40,7 +40,7 @@ const closeForm = () => {
v-model="reasonFormData"
type="textarea"
autogrow
- :disable="!isHimSelf"
+ :disable="!isHimself"
/>
diff --git a/src/pages/Worker/WorkerList.vue b/src/pages/Worker/WorkerList.vue
index 91d96a162..b8ef3f9d8 100644
--- a/src/pages/Worker/WorkerList.vue
+++ b/src/pages/Worker/WorkerList.vue
@@ -262,7 +262,7 @@ async function autofillBic(worker) {
handleLocation(data, location)"
@@ -311,7 +311,7 @@ async function autofillBic(worker) {
option-label="name"
option-value="id"
hide-selected
- :roles-allowed-to-create="['salesAssistant', 'hr']"
+ :acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
:disable="data.isFreelance"
@update:model-value="autofillBic(data)"
:filter-options="['bic', 'name']"
diff --git a/src/router/index.js b/src/router/index.js
index 686da2dde..18541c0b2 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -60,15 +60,12 @@ export default route(function (/* { store, ssrContext } */) {
await useTokenConfig().fetch();
}
const matches = to.matched;
- const hasRequiredRoles = matches.every((route) => {
+ const hasRequiredAcls = matches.every((route) => {
const meta = route.meta;
- if (meta && meta.roles) return useRole().hasAny(meta.roles);
- return true;
+ if (!meta?.acls) return true;
+ return useAcl().hasAny(meta.acls);
});
-
- if (!hasRequiredRoles) {
- return next({ path: '/' });
- }
+ if (!hasRequiredAcls) return next({ path: '/' });
}
next();
diff --git a/src/router/modules/Supplier.js b/src/router/modules/Supplier.js
index b711066b2..143d7c824 100644
--- a/src/router/modules/Supplier.js
+++ b/src/router/modules/Supplier.js
@@ -7,6 +7,7 @@ export default {
title: 'suppliers',
icon: 'vn:supplier',
moduleName: 'Supplier',
+ keyBinding: 'p',
},
component: RouterView,
redirect: { name: 'SupplierMain' },
diff --git a/src/router/modules/account.js b/src/router/modules/account.js
index cfec2b95d..7200131da 100644
--- a/src/router/modules/account.js
+++ b/src/router/modules/account.js
@@ -7,6 +7,7 @@ export default {
title: 'users',
icon: 'face',
moduleName: 'Account',
+ keyBinding: 'u',
},
component: RouterView,
redirect: { name: 'AccountMain' },
@@ -79,7 +80,7 @@ export default {
meta: {
title: 'accounts',
icon: 'accessibility',
- roles: ['itManagement'],
+ acls: [{ model: 'Account', props: '*', accessType: '*' }],
},
component: () => import('src/pages/Account/AccountAccounts.vue'),
},
@@ -89,7 +90,7 @@ export default {
meta: {
title: 'ldap',
icon: 'account_tree',
- roles: ['itManagement'],
+ acls: [{ model: 'LdapConfig', props: '*', accessType: '*' }],
},
component: () => import('src/pages/Account/AccountLdap.vue'),
},
@@ -99,7 +100,7 @@ export default {
meta: {
title: 'samba',
icon: 'preview',
- roles: ['itManagement'],
+ acls: [{ model: 'SambaConfig', props: '*', accessType: '*' }],
},
component: () => import('src/pages/Account/AccountSamba.vue'),
},
diff --git a/src/router/modules/claim.js b/src/router/modules/claim.js
index cced9e24d..b58a58e8d 100644
--- a/src/router/modules/claim.js
+++ b/src/router/modules/claim.js
@@ -7,6 +7,7 @@ export default {
title: 'claims',
icon: 'vn:claims',
moduleName: 'Claim',
+ keyBinding: 'r',
},
component: RouterView,
redirect: { name: 'ClaimMain' },
@@ -61,7 +62,7 @@ export default {
meta: {
title: 'basicData',
icon: 'vn:settings',
- roles: ['salesPerson'],
+ acls: [{ model: 'Claim', props: 'findById', accessType: 'READ' }],
},
component: () => import('src/pages/Claim/Card/ClaimBasicData.vue'),
},
@@ -98,7 +99,13 @@ export default {
meta: {
title: 'development',
icon: 'vn:traceability',
- roles: ['claimManager'],
+ acls: [
+ {
+ model: 'ClaimDevelopment',
+ props: '*',
+ accessType: 'WRITE',
+ },
+ ],
},
component: () => import('src/pages/Claim/Card/ClaimDevelopment.vue'),
},
diff --git a/src/router/modules/customer.js b/src/router/modules/customer.js
index 684b83b0f..5b73ddc84 100644
--- a/src/router/modules/customer.js
+++ b/src/router/modules/customer.js
@@ -7,6 +7,7 @@ export default {
title: 'customers',
icon: 'vn:client',
moduleName: 'Customer',
+ keyBinding: 'c',
},
component: RouterView,
redirect: { name: 'CustomerMain' },
diff --git a/src/router/modules/entry.js b/src/router/modules/entry.js
index 0d38ed626..365615b87 100644
--- a/src/router/modules/entry.js
+++ b/src/router/modules/entry.js
@@ -7,6 +7,7 @@ export default {
title: 'entries',
icon: 'vn:entry',
moduleName: 'Entry',
+ keyBinding: 'e',
},
component: RouterView,
redirect: { name: 'EntryMain' },
diff --git a/src/router/modules/invoiceIn.js b/src/router/modules/invoiceIn.js
index 906db8a58..168d64f37 100644
--- a/src/router/modules/invoiceIn.js
+++ b/src/router/modules/invoiceIn.js
@@ -1,5 +1,5 @@
import { RouterView } from 'vue-router';
-
+import { setRectificative } from 'src/pages/InvoiceIn/composables/setRectificative';
export default {
path: '/invoice-in',
name: 'InvoiceIn',
@@ -63,6 +63,10 @@ export default {
path: ':id',
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
redirect: { name: 'InvoiceInSummary' },
+ beforeEnter: async (to, from, next) => {
+ await setRectificative(to);
+ next();
+ },
children: [
{
name: 'InvoiceInSummary',
@@ -80,7 +84,6 @@ export default {
meta: {
title: 'basicData',
icon: 'vn:settings',
- roles: ['salesPerson'],
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInBasicData.vue'),
diff --git a/src/router/modules/item.js b/src/router/modules/item.js
index 4bd5df4e2..48e19dd54 100644
--- a/src/router/modules/item.js
+++ b/src/router/modules/item.js
@@ -7,6 +7,7 @@ export default {
title: 'items',
icon: 'vn:item',
moduleName: 'Item',
+ keyBinding: 'a',
},
component: RouterView,
redirect: { name: 'ItemMain' },
diff --git a/src/router/modules/monitor.js b/src/router/modules/monitor.js
index 3353da3cf..7342a5904 100644
--- a/src/router/modules/monitor.js
+++ b/src/router/modules/monitor.js
@@ -7,6 +7,7 @@ export default {
title: 'monitors',
icon: 'grid_view',
moduleName: 'Monitor',
+ keyBinding: 'm',
},
component: RouterView,
redirect: { name: 'MonitorMain' },
diff --git a/src/router/modules/order.js b/src/router/modules/order.js
index 9ccdb820b..bfa37fce5 100644
--- a/src/router/modules/order.js
+++ b/src/router/modules/order.js
@@ -7,6 +7,7 @@ export default {
title: 'order',
icon: 'vn:basket',
moduleName: 'Order',
+ keyBinding: 'o',
},
component: RouterView,
redirect: { name: 'OrderMain' },
diff --git a/src/router/modules/route.js b/src/router/modules/route.js
index 955fc9098..3c5c860cf 100644
--- a/src/router/modules/route.js
+++ b/src/router/modules/route.js
@@ -7,7 +7,6 @@ export default {
title: 'routes',
icon: 'vn:delivery',
moduleName: 'Route',
- keyBinding: 'r',
},
component: RouterView,
redirect: { name: 'RouteMain' },
diff --git a/src/router/modules/shelving.js b/src/router/modules/shelving.js
index 70145dfb4..b7f50a3b6 100644
--- a/src/router/modules/shelving.js
+++ b/src/router/modules/shelving.js
@@ -76,7 +76,6 @@ export default {
meta: {
title: 'basicData',
icon: 'vn:settings',
- roles: ['salesPerson'],
},
component: () => import('pages/Shelving/Card/ShelvingForm.vue'),
},
diff --git a/src/router/modules/ticket.js b/src/router/modules/ticket.js
index 4074f089f..dcc238f95 100644
--- a/src/router/modules/ticket.js
+++ b/src/router/modules/ticket.js
@@ -7,6 +7,7 @@ export default {
title: 'tickets',
icon: 'vn:ticket',
moduleName: 'Ticket',
+ keyBinding: 't',
},
component: RouterView,
redirect: { name: 'TicketMain' },
@@ -53,7 +54,6 @@ export default {
meta: {
title: 'createTicket',
icon: 'vn:ticketAdd',
- roles: ['developer'],
},
component: () => import('src/pages/Ticket/TicketCreate.vue'),
},
diff --git a/src/router/modules/wagon.js b/src/router/modules/wagon.js
index d3d14a888..e25e585eb 100644
--- a/src/router/modules/wagon.js
+++ b/src/router/modules/wagon.js
@@ -11,7 +11,7 @@ export default {
component: RouterView,
redirect: { name: 'WagonMain' },
menus: {
- main: ['WagonList', 'WagonTypeList', 'WagonCounter'],
+ main: ['WagonList', 'WagonTypeList', 'WagonCounter', 'WagonTray'],
card: [],
},
children: [
@@ -81,7 +81,7 @@ export default {
title: 'typeCreate',
icon: 'create',
},
- component: () => import('src/pages/Wagon/Type/WagonTypeCreate.vue'),
+ component: () => import('src/pages/Wagon/Type/WagonTypeList.vue'),
},
{
path: ':id/edit',
@@ -90,7 +90,7 @@ export default {
title: 'typeEdit',
icon: 'edit',
},
- component: () => import('src/pages/Wagon/Type/WagonTypeCreate.vue'),
+ component: () => import('src/pages/Wagon/Type/WagonTypeEdit.vue'),
},
],
},
diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js
index 573bff8ac..263e5b238 100644
--- a/src/router/modules/worker.js
+++ b/src/router/modules/worker.js
@@ -7,6 +7,7 @@ export default {
title: 'workers',
icon: 'vn:worker',
moduleName: 'Worker',
+ keyBinding: 'w',
},
component: RouterView,
redirect: { name: 'WorkerMain' },
diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js
index 40358c58e..1f27cc76f 100644
--- a/src/router/modules/zone.js
+++ b/src/router/modules/zone.js
@@ -7,6 +7,7 @@ export default {
title: 'zones',
icon: 'vn:zone',
moduleName: 'Zone',
+ keyBinding: 'z',
},
component: RouterView,
redirect: { name: 'ZoneMain' },
diff --git a/src/stores/useNavigationStore.js b/src/stores/useNavigationStore.js
index 961e80377..4a819bf19 100644
--- a/src/stores/useNavigationStore.js
+++ b/src/stores/useNavigationStore.js
@@ -2,7 +2,7 @@ import axios from 'axios';
import { ref } from 'vue';
import { defineStore } from 'pinia';
import { toLowerCamel } from 'src/filters';
-import { useRole } from 'src/composables/useRole';
+import { useAcl } from 'src/composables/useAcl';
import routes from 'src/router/modules';
export const useNavigationStore = defineStore('navigationStore', () => {
@@ -26,7 +26,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
'zone',
];
const pinnedModules = ref([]);
- const role = useRole();
+ const acl = useAcl();
function getModules() {
const modulesRoutes = ref([]);
@@ -56,6 +56,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
function addMenuItem(module, route, parent) {
const { meta } = route;
let { menuChildren = null } = meta;
+ if (meta.hidden) return;
if (menuChildren)
menuChildren = menuChildren.map(({ name, title, icon }) => ({
name,
@@ -63,7 +64,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
title: `globals.pageTitles.${title}`,
}));
- if (meta && meta.roles && role.hasAny(meta.roles) === false) return;
+ if (meta && meta.acls && acl.hasAny(meta.acls) === false) return;
const item = {
name: route.name,
@@ -72,6 +73,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
if (meta) {
item.title = `globals.pageTitles.${meta.title}`;
item.icon = meta.icon;
+ item.keyBinding = meta.keyBinding;
}
parent.push(item);
diff --git a/test/cypress/integration/claim/claimDevelopment.spec.js b/test/cypress/integration/claim/claimDevelopment.spec.js
index 903f58d4b..3b73a24d9 100755
--- a/test/cypress/integration/claim/claimDevelopment.spec.js
+++ b/test/cypress/integration/claim/claimDevelopment.spec.js
@@ -8,6 +8,8 @@ describe('ClaimDevelopment', () => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`);
+ cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
+ cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
cy.waitForElement('tbody');
});
@@ -32,10 +34,19 @@ describe('ClaimDevelopment', () => {
});
it('should add and remove new line', () => {
+ cy.wait(['@workers', '@workers']);
cy.addCard();
+
cy.get(thirdRow).should('exist');
- const rowData = [false, 'Novato', 'Roces', 'Compradores', 'employeeNick', 'Tour'];
+ const rowData = [
+ false,
+ 'Novato',
+ 'Roces',
+ 'Compradores',
+ 'administrativeNick',
+ 'Tour',
+ ];
cy.fillRow(thirdRow, rowData);
cy.saveCard();
diff --git a/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js b/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js
index 77a11969b..e1939fe5a 100644
--- a/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInBasicData.spec.js
@@ -36,8 +36,7 @@ describe('InvoiceInBasicData', () => {
});
it('should throw an error creating a new dms if a file is not attached', () => {
- cy.get(formInputs).eq(5).click();
- cy.get(formInputs).eq(5).type('{selectall}{backspace}');
+ cy.get(formInputs).eq(7).type('{selectall}{backspace}');
cy.get(documentBtns).eq(0).click();
cy.get(dialogActionBtns).eq(1).click();
cy.get('.q-notification__message').should(
diff --git a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
index 018ae7a53..b84d743d1 100644
--- a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js
@@ -3,13 +3,14 @@ describe('InvoiceInVat', () => {
const thirdRow = 'tbody > :nth-child(3)';
const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)';
const dialogInputs = '.q-dialog label input';
- const dialogBtns = '.q-dialog button';
- const acrossInput = 'tbody tr:nth-child(1) td:nth-child(2) .default-icon';
+ const addBtn = 'tbody tr:nth-child(1) td:nth-child(2) .--add-icon';
const randomInt = Math.floor(Math.random() * 100);
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/invoice-in/1/vat`);
+ cy.intercept('GET', '/api/InvoiceIns/1/getTotals').as('lastCall');
+ cy.wait('@lastCall');
});
it('should edit the sage iva', () => {
@@ -26,22 +27,15 @@ describe('InvoiceInVat', () => {
});
it('should remove the first line', () => {
- cy.removeRow(2);
- });
-
- it('should throw an error if there are fields undefined', () => {
- cy.get(acrossInput).click();
- cy.get(dialogBtns).eq(2).click();
- cy.get('.q-notification__message').should('have.text', "The code can't be empty");
+ cy.removeRow(1);
});
it('should correctly handle expense addition', () => {
- cy.get(acrossInput).click();
+ cy.get(addBtn).click();
cy.get(dialogInputs).eq(0).type(randomInt);
- cy.get(dialogInputs).eq(1).click();
cy.get(dialogInputs).eq(1).type('This is a dummy expense');
- cy.get(dialogBtns).eq(2).click();
- cy.get('.q-notification__message').should('have.text', 'Data saved');
+ cy.get('button[type="submit"]').click();
+ cy.get('.q-notification__message').should('have.text', 'Data created');
});
});
diff --git a/test/cypress/integration/outLogin/login.spec.js b/test/cypress/integration/outLogin/login.spec.js
index f8a9f5c64..3db223cdb 100755
--- a/test/cypress/integration/outLogin/login.spec.js
+++ b/test/cypress/integration/outLogin/login.spec.js
@@ -52,9 +52,9 @@ describe('Login', () => {
cy.url().should('contain', '/login');
});
- it(`should get redirected to dashboard since employee can't create tickets`, () => {
- cy.visit('/#/ticket/create', { failOnStatusCode: false });
- cy.url().should('contain', '/#/login?redirect=/ticket/create');
+ it(`should be redirected to dashboard since the employee is not enabled to see ldap`, () => {
+ cy.visit('/#/account/ldap', { failOnStatusCode: false });
+ cy.url().should('contain', '/#/login?redirect=/account/ldap');
cy.get('input[aria-label="Username"]').type('employee');
cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click();
diff --git a/test/cypress/integration/ticket/ticketDescriptor.spec.js b/test/cypress/integration/ticket/ticketDescriptor.spec.js
index 882aab157..516b0f13d 100644
--- a/test/cypress/integration/ticket/ticketDescriptor.spec.js
+++ b/test/cypress/integration/ticket/ticketDescriptor.spec.js
@@ -1,18 +1,18 @@
///
describe('Ticket descriptor', () => {
const toCloneOpt = '[role="menu"] .q-list > :nth-child(5)';
+ const setWeightOpt = '[role="menu"] .q-list > :nth-child(6)';
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
const summaryHeader = '.summaryHeader > div';
-
+ const weight = 25;
+ const weightValue = ':nth-child(10) > .value > span';
beforeEach(() => {
- const ticketId = 1;
-
cy.login('developer');
- cy.visit(`/#/ticket/${ticketId}/summary`);
+ cy.viewport(1920, 1080);
});
it('should clone the ticket without warehouse', () => {
- cy.openLeftMenu();
+ cy.visit('/#/ticket/1/summary');
cy.openActionsDescriptor();
cy.get(toCloneOpt).click();
cy.clickConfirm();
@@ -24,4 +24,15 @@ describe('Ticket descriptor', () => {
cy.wrap(owner.trim()).should('eq', 'Bruce Wayne (1101)');
});
});
+
+ it('should set the weight of the ticket', () => {
+ cy.visit('/#/ticket/10/summary');
+ cy.openActionsDescriptor();
+ cy.get(setWeightOpt).click();
+ cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight');
+ cy.get('.q-dialog input').type(weight);
+ cy.clickConfirm();
+ cy.wait('@weight');
+ cy.get(weightValue).contains(weight);
+ });
});
diff --git a/test/cypress/integration/vnComponent/VnShortcut.spec.js b/test/cypress/integration/vnComponent/VnShortcut.spec.js
new file mode 100644
index 000000000..b49b4e964
--- /dev/null
+++ b/test/cypress/integration/vnComponent/VnShortcut.spec.js
@@ -0,0 +1,33 @@
+///
+
+describe('VnShortcuts', () => {
+ const modules = {
+ item: 'a',
+ customer: 'c',
+ ticket: 't',
+ claim: 'r',
+ worker: 'w',
+ monitor: 'm',
+ order: 'o',
+ supplier: 'p',
+ entry: 'e',
+ zone: 'z',
+ account: 'u',
+ };
+ beforeEach(() => {
+ cy.login('developer');
+ cy.visit('/');
+ });
+
+ for (const [module, shortcut] of Object.entries(modules)) {
+ it(`should visit ${module} module`, () => {
+ cy.get('body').trigger('keydown', {
+ ctrlKey: true,
+ altKey: true,
+ code: `Key${shortcut.toUpperCase()}`,
+ });
+
+ cy.url().should('include', module);
+ });
+ }
+});
diff --git a/test/cypress/integration/wagonType/wagonTypeCreate.spec.js b/test/cypress/integration/wagonType/wagonTypeCreate.spec.js
index bcf7fe841..cd7ffa58f 100644
--- a/test/cypress/integration/wagonType/wagonTypeCreate.spec.js
+++ b/test/cypress/integration/wagonType/wagonTypeCreate.spec.js
@@ -3,52 +3,15 @@ describe('WagonTypeCreate', () => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/wagon/type/create');
+ cy.waitForElement('.q-page', 6000);
});
- function chooseColor(color) {
- cy.get('div.shelving-down').eq(1).click();
- cy.get('div.q-color-picker__cube').eq(color).click();
- cy.get('div.q-card__section').find('button').click();
- }
-
- function addTray(position) {
- cy.get('div.action-button').last().find('button').click();
- cy.focused().type(position);
- cy.focused().blur();
- }
-
- it('should create and delete a new wagon type', () => {
+ it('should create a new wagon type', () => {
+ cy.get('.q-page-sticky > div > .q-btn').click();
cy.get('input').first().type('Example for testing');
- cy.get('div.q-checkbox__bg').click();
- chooseColor(1);
-
- // Insert invalid position (not minimal height)
- addTray(20);
- cy.get('div[role="alert"]').should('exist');
- chooseColor(2);
- addTray(150);
- chooseColor(3);
- addTray(100);
-
- // Insert invalid position (max height reached)
- addTray(210);
- cy.get('div[role="alert"]').should('exist');
-
- // Save
cy.get('button[type="submit"]').click();
-
- // Check data has been saved successfully
- cy.get(':nth-child(1) > :nth-child(1) > .justify-between > .flex > .title')
- .contains('Example for testing')
- .click();
- cy.get('input').first().should('have.value', 'Example for testing');
- cy.get('div.wagon-tray').should('have.length', 4);
- cy.get('div.position').eq(0).find('input').should('have.value', '150');
- cy.get('div.position').eq(1).find('input').should('have.value', '100');
- cy.get('div.position').eq(2).find('input').should('have.value', '50');
-
- // Delete wagon type created
- cy.go('back');
+ });
+ it('delete a wagon type', () => {
cy.get(
':nth-child(2) > :nth-child(1) > .card-list-body > .actions > .q-btn--standard'
).click();
diff --git a/test/cypress/integration/wagonType/wagonTypeEdit.spec.js b/test/cypress/integration/wagonType/wagonTypeEdit.spec.js
new file mode 100644
index 000000000..6e5816e51
--- /dev/null
+++ b/test/cypress/integration/wagonType/wagonTypeEdit.spec.js
@@ -0,0 +1,27 @@
+describe('WagonTypeEdit', () => {
+ const trayColorRow =
+ '.q-select > .q-field__inner > .q-field__control > .q-field__control-container';
+ beforeEach(() => {
+ cy.viewport(1920, 1080);
+ cy.login('developer');
+ cy.visit('/#/wagon/type/2/edit');
+ });
+
+ it('should edit the name and the divisible field of the wagon type', () => {
+ cy.get('.q-card');
+ cy.get('input').first().type(' changed');
+ cy.get('div.q-checkbox__bg').first().click();
+ cy.get('.q-btn--standard').click();
+ });
+
+ it('should create a tray', () => {
+ cy.get('.action-button > .q-btn > .q-btn__content > .q-icon').click();
+ cy.get('input').last().type('150');
+ cy.get(trayColorRow).type('{downArrow}{downArrow}{enter}');
+ });
+
+ it('should delete a tray', () => {
+ cy.get('.action-button > .q-btn > .q-btn__content > .q-icon').first().click();
+ cy.reload();
+ });
+});
diff --git a/test/vitest/__tests__/composables/useAcl.spec.js b/test/vitest/__tests__/composables/useAcl.spec.js
index a2b44b5e7..6cb29984c 100644
--- a/test/vitest/__tests__/composables/useAcl.spec.js
+++ b/test/vitest/__tests__/composables/useAcl.spec.js
@@ -48,40 +48,62 @@ describe('useAcl', () => {
describe('hasAny', () => {
it('should return false if no roles matched', async () => {
- expect(acl.hasAny('Worker', 'updateAttributes', 'WRITE')).toBeFalsy();
+ expect(
+ acl.hasAny([
+ { model: 'Worker', props: 'updateAttributes', accessType: 'WRITE' },
+ ])
+ ).toBeFalsy();
});
it('should return false if no roles matched', async () => {
- expect(acl.hasAny('Worker', 'holidays', 'READ')).toBeTruthy();
+ expect(
+ acl.hasAny([{ model: 'Worker', props: 'holidays', accessType: 'READ' }])
+ ).toBeTruthy();
});
describe('*', () => {
it('should return true if an acl matched', async () => {
- expect(acl.hasAny('Address', '*', 'WRITE')).toBeTruthy();
+ expect(
+ acl.hasAny([{ model: 'Address', props: '*', accessType: 'WRITE' }])
+ ).toBeTruthy();
});
it('should return false if no acls matched', async () => {
- expect(acl.hasAny('Worker', '*', 'READ')).toBeFalsy();
+ expect(
+ acl.hasAny([{ model: 'Worker', props: '*', accessType: 'READ' }])
+ ).toBeFalsy();
});
});
describe('$authenticated', () => {
it('should return false if no acls matched', async () => {
- expect(acl.hasAny('Url', 'getByUser', '*')).toBeFalsy();
+ expect(
+ acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: '*' }])
+ ).toBeFalsy();
});
it('should return true if an acl matched', async () => {
- expect(acl.hasAny('Url', 'getByUser', 'READ')).toBeTruthy();
+ expect(
+ acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: 'READ' }])
+ ).toBeTruthy();
});
});
describe('$everyone', () => {
it('should return false if no acls matched', async () => {
- expect(acl.hasAny('TpvTransaction', 'start', 'READ')).toBeFalsy();
+ expect(
+ acl.hasAny([
+ { model: 'TpvTransaction', props: 'start', accessType: 'READ' },
+ ])
+ ).toBeFalsy();
});
it('should return false if an acl matched', async () => {
- expect(acl.hasAny('TpvTransaction', 'start', 'WRITE')).toBeTruthy();
+ expect(
+ acl.hasAny([
+ { model: 'TpvTransaction', props: 'start', accessType: 'WRITE' },
+ ])
+ ).toBeTruthy();
});
});
});
diff --git a/test/vitest/__tests__/pages/Wagons/WagonTypeCreate.spec.js b/test/vitest/__tests__/pages/Wagons/WagonTypeCreate.spec.js
deleted file mode 100644
index 60c199b73..000000000
--- a/test/vitest/__tests__/pages/Wagons/WagonTypeCreate.spec.js
+++ /dev/null
@@ -1,271 +0,0 @@
-import { axios, createWrapper } from 'app/test/vitest/helper';
-import WagonTypeCreate from 'pages/Wagon/Type/WagonTypeCreate.vue';
-import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest';
-
-describe('WagonTypeCreate', () => {
- let vmCreate, vmEdit;
- const entityId = 1;
-
- beforeAll(() => {
- vmEdit = createWrapper(WagonTypeCreate, {propsData: {
- id: entityId,
- }}).vm;
- vmCreate = createWrapper(WagonTypeCreate).vm;
- vmEdit.wagonConfig = vmCreate.wagonConfig = {maxTrays: 2 ,minHeightBetweenTrays: 50, maxWagonHeight: 200 };
- vmEdit.wagonTypeColors = vmCreate.wagonTypeColors = [{id: 1, color:'white', rgb:'#000000'}];
- });
-
- afterEach(() => {
- vi.clearAllMocks();
- });
-
- describe('addTray()', () => {
- it('should throw message if there are uncomplete trays', async () => {
- vi.spyOn(vmEdit.quasar, 'notify');
- vmEdit.wagon = [{
- id: 1,
- position: null,
- color: vmEdit.wagonTypeColors[0]
- }];
-
- await vmEdit.addTray();
-
- expect(vmEdit.quasar.notify).toHaveBeenCalledWith(
- expect.objectContaining({
- type: 'warning',
- })
- );
- });
-
- it('should create a new tray if the limit has not been reached', async () => {
- vmEdit.wagon = [{
- id: 1,
- position: 0,
- color: vmEdit.wagonTypeColors[0]
- }];
-
- await vmEdit.addTray();
- expect(vmEdit.wagon.length).toEqual(2);
- });
-
- it('should throw message if there are uncomplete trays', async () => {
- vi.spyOn(vmEdit.quasar, 'notify');
- vmEdit.wagon = [{
- id: 1,
- position: 0,
- color: vmEdit.wagonTypeColors[0]
- },{
- id: 2,
- position: 50,
- color: vmEdit.wagonTypeColors[0]
- }];
-
- await vmEdit.addTray();
-
- expect(vmEdit.quasar.notify).toHaveBeenCalledWith(
- expect.objectContaining({
- type: 'warning',
- })
- );
- });
- });
-
- describe('deleteTray() reorderIds()', () => {
- it('should delete a tray and reorder the ids', async () => {
- const trayToDelete = {
- id: 1,
- position: 0,
- color: vmEdit.wagonTypeColors[0]
- };
- const trayMaintained = {
- id: 2,
- position: 50,
- color: vmEdit.wagonTypeColors[0]
- };
- vmEdit.wagon = [trayToDelete,trayMaintained];
-
- await vmEdit.deleteTray(trayToDelete);
-
- expect(vmEdit.wagon.length).toEqual(1);
- expect(vmEdit.wagon[0].id).toEqual(0);
- expect(vmEdit.wagon[0].position).toEqual(50);
-
- });
- });
-
- describe('onSubmit()', () => {
- it('should make a patch to editWagonType if have id', async () => {
- vi.spyOn(axios, 'patch').mockResolvedValue({ data: true });
- const wagon = {
- id: entityId,
- name: "Mock name",
- divisible: true,
- trays: [{
- id: 1,
- position: 0,
- color: vmEdit.wagonTypeColors[0]
- }]
- }
- vmEdit.name = wagon.name;
- vmEdit.divisible = wagon.divisible;
- vmEdit.wagon = wagon.trays;
-
- await vmEdit.onSubmit();
-
- expect(axios.patch).toHaveBeenCalledWith(
- `WagonTypes/editWagonType`, wagon
- );
- });
-
- it('should make a patch to createtWagonType if not have id', async () => {
- vi.spyOn(axios, 'patch').mockResolvedValue({ data: true });
- const wagon = {
- name: "Mock name",
- divisible: true,
- trays: [{
- id: 1,
- position: 0,
- color: vmCreate.wagonTypeColors[0]
- }]
- }
- vmCreate.name = wagon.name;
- vmCreate.divisible = wagon.divisible;
- vmCreate.wagon = wagon.trays;
-
- await vmCreate.onSubmit();
-
- expect(axios.patch).toHaveBeenCalledWith(
- `WagonTypes/createWagonType`, wagon
- );
- });
- });
-
- describe('onReset()', () => {
- it('should reset if have id', async () => {
- vmEdit.name = 'Changed name';
- vmEdit.divisible = false;
- vmEdit.wagon = [];
- vmEdit.originalData = {
- name: 'Original name',
- divisible: true,
- trays: [{
- id: 1,
- position: 0,
- color: vmEdit.wagonTypeColors[0]
- },{
- id: 2,
- position: 50,
- color: vmEdit.wagonTypeColors[0]
- }]
- };
-
- vmEdit.onReset();
-
- expect(vmEdit.name).toEqual(vmEdit.originalData.name);
- expect(vmEdit.divisible).toEqual(vmEdit.originalData.divisible);
- expect(vmEdit.wagon).toEqual(vmEdit.originalData.trays);
- });
-
- it('should reset if not have id', async () => {
- vmCreate.name = 'Changed name';
- vmCreate.divisible = false;
- vmCreate.wagon = [];
-
- vmCreate.onReset();
-
- expect(vmCreate.name).toEqual(null);
- expect(vmCreate.divisible).toEqual(false);
- expect(vmCreate.wagon.length).toEqual(1);
- });
- });
-
- describe('onPositionBlur()', () => {
- it('should set position null if position is negative', async () => {
- const negativeTray = {
- id: 1,
- position: -1,
- color: vmCreate.wagonTypeColors[0]
- };
-
- vmCreate.onPositionBlur(negativeTray);
-
- expect(negativeTray.position).toEqual(null);
- });
-
- it('should set position and reorder array', async () => {
- const trays = [{
- id: 0,
- position: 100,
- color: vmCreate.wagonTypeColors[0]
- },{
- id: 1,
- position: 0,
- color: vmCreate.wagonTypeColors[0]
- }];
- const newTray = {
- id: 2,
- position: 50,
- color: vmCreate.wagonTypeColors[0]
- };
- trays.push(newTray);
- vmCreate.wagon = trays;
-
- vmCreate.onPositionBlur(newTray);
-
- expect(vmCreate.wagon[0].position).toEqual(100);
- expect(vmCreate.wagon[1].position).toEqual(50);
- expect(vmCreate.wagon[2].position).toEqual(0);
- });
-
- it('should throw message if not have min height between trays and should set new adequate positions', async () => {
- vi.spyOn(vmCreate.quasar, 'notify');
- const trays = [{
- id: 0,
- position: 0,
- color: vmCreate.wagonTypeColors[0]
- }];
- const newTray = {
- id: 1,
- position: 20,
- color: vmCreate.wagonTypeColors[0]
- };
- trays.push(newTray);
- vmCreate.wagon = trays;
-
- vmCreate.onPositionBlur(newTray);
-
- expect(vmCreate.wagon[0].position).toEqual(50);
- expect(vmCreate.wagon[1].position).toEqual(0);
- expect(vmCreate.quasar.notify).toHaveBeenCalledWith(
- expect.objectContaining({
- type: 'warning',
- })
- );
- });
-
- it('should throw message if max height has been exceed', async () => {
- vi.spyOn(vmCreate.quasar, 'notify');
- const trays = [{
- id: 0,
- position: 0,
- color: vmCreate.wagonTypeColors[0]
- }];
- const newTray = {
- id: 1,
- position: 210,
- color: vmCreate.wagonTypeColors[0]
- };
- trays.push(newTray);
- vmCreate.wagon = trays;
-
- vmCreate.onPositionBlur(newTray);
-
- expect(vmCreate.wagon.length).toEqual(1);
- expect(vmCreate.quasar.notify).toHaveBeenCalledWith(
- expect.objectContaining({
- type: 'warning',
- })
- );
- });
- });
-});