diff --git a/package-lock.json b/package-lock.json index 4fe3c0cdc..afcf4b291 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "0.0.1", + "version": "23.32.01", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index d9702c895..85e0cd72b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "23.30.01", + "version": "23.32.01", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", diff --git a/src/boot/axios.js b/src/boot/axios.js index f8f27278c..bdc661ae2 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -64,7 +64,7 @@ const onResponseError = (error) => { const url = hash.slice(1); Router.push({ path: url }); } else if (!session.isLoggedIn()) { - message = 'login.loginError'; + return Promise.reject(error); } Notify.create({ diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue index a627f9058..6196c636a 100644 --- a/src/components/LeftMenu.vue +++ b/src/components/LeftMenu.vue @@ -1,6 +1,6 @@ + + + + + + + + + + {{ t(`globals.lang.${lang}`) }} + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/pages/Login/LoginMain.vue b/src/pages/Login/LoginMain.vue index 747fe8b14..7c0bbbd44 100644 --- a/src/pages/Login/LoginMain.vue +++ b/src/pages/Login/LoginMain.vue @@ -1,58 +1,30 @@ - - - - - - - - - - {{ t('globals.lang.en') }} - - - {{ t('globals.lang.es') }} - - - - - - - - - {{ t(`globals.darkMode`) }} - - - - - - - - - - - - - - - + + + + + - - - - - - - - + + + + - + diff --git a/src/pages/Login/TwoFactor.vue b/src/pages/Login/TwoFactor.vue new file mode 100644 index 000000000..f14e85418 --- /dev/null +++ b/src/pages/Login/TwoFactor.vue @@ -0,0 +1,80 @@ + + + + + + {{ t('twoFactor.insert') }} + + + + + + + + + + + + diff --git a/src/pages/Route/Cmr/CmrFilter.vue b/src/pages/Route/Cmr/CmrFilter.vue new file mode 100644 index 000000000..9059e0195 --- /dev/null +++ b/src/pages/Route/Cmr/CmrFilter.vue @@ -0,0 +1,141 @@ + + + + (countries = data)" auto-load /> + + + + {{ t(`params.${tag.label}`) }}: + {{ formatFn(tag.value) }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + en: + params: + cmrFk: Cmr id, + hasCmrDms: Attached in gestdoc, + ticketFk: Ticketd id, + country: Country, + clientFk: Client id, + shipped: Preparation date, + + es: + params: + cmrFk: Id cmr, + hasCmrDms: Adjuntado en gestdoc, + ticketFk: Id ticket, + country: País, + clientFk: Id cliente, + shipped: Fecha preparación, + diff --git a/src/pages/Route/Cmr/CmrList.vue b/src/pages/Route/Cmr/CmrList.vue new file mode 100644 index 000000000..761d79fa2 --- /dev/null +++ b/src/pages/Route/Cmr/CmrList.vue @@ -0,0 +1,130 @@ + + + + + + + + + {{ t('route.cmr.list.total', [rows.length]) }} + + + + + {{ value }} + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/pages/Route/RouteMain.vue b/src/pages/Route/RouteMain.vue new file mode 100644 index 000000000..66ce78f23 --- /dev/null +++ b/src/pages/Route/RouteMain.vue @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/src/router/index.js b/src/router/index.js index 9bc199047..cccf9af6d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -45,8 +45,8 @@ export { Router }; export default route(function (/* { store, ssrContext } */) { Router.beforeEach(async (to, from, next) => { const { isLoggedIn } = session; - - if (!isLoggedIn() && to.name !== 'Login') { + const outLayout = ['Login', 'TwoFactor']; + if (!isLoggedIn() && !outLayout.includes(to.name)) { return next({ name: 'Login', query: { redirect: to.fullPath } }); } diff --git a/src/router/modules/index.js b/src/router/modules/index.js index 30c51939d..2916b98ef 100644 --- a/src/router/modules/index.js +++ b/src/router/modules/index.js @@ -4,6 +4,7 @@ import Claim from './claim'; import InvoiceOut from './invoiceOut'; import Worker from './worker'; import Wagon from './wagon'; +import Route from './route'; export default [ Customer, @@ -11,5 +12,6 @@ export default [ Claim, InvoiceOut, Worker, - Wagon + Wagon, + Route ] diff --git a/src/router/modules/route.js b/src/router/modules/route.js new file mode 100644 index 000000000..a3550885c --- /dev/null +++ b/src/router/modules/route.js @@ -0,0 +1,35 @@ +import { RouterView } from 'vue-router'; + +export default { + path: '/route', + name: 'Route', + meta: { + title: 'routes', + icon: 'vn:delivery', + }, + component: RouterView, + redirect: { name: 'RouteMain' }, + menus: { + main: ['CmrList'], + card: [], + }, + children: [ + { + path: '/route', + name: 'RouteMain', + component: () => import('src/pages/Route/RouteMain.vue'), + redirect: { name: 'CmrList' }, + children: [ + { + path: 'cmr/list', + name: 'CmrList', + meta: { + title: 'cmrsList', + icon: 'fact_check', + }, + component: () => import('src/pages/Route/Cmr/CmrList.vue') + }, + ], + }, + ], +}; diff --git a/src/router/routes.js b/src/router/routes.js index 17a56505d..4425996b0 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -4,13 +4,26 @@ import claim from './modules/claim'; import worker from './modules/worker'; import invoiceOut from './modules/invoiceOut'; import wagon from './modules/wagon'; +import route from './modules/route'; const routes = [ { path: '/login', - name: 'Login', - meta: { title: 'logIn' }, - component: () => import('../pages/Login/LoginMain.vue'), + component: () => import('../layouts/OutLayout.vue'), + children: [ + { + path: '', + name: 'Login', + meta: { title: 'logIn' }, + component: () => import('../pages/Login/LoginMain.vue'), + }, + { + path: '/twoFactor', + name: 'TwoFactor', + meta: { title: 'twoFactor' }, + component: () => import('../pages/Login/TwoFactor.vue'), + }, + ], }, { path: '/', @@ -35,7 +48,8 @@ const routes = [ name: 'NotFound', component: () => import('../pages/NotFound.vue'), }, - wagon + wagon, + route, ], }, ]; diff --git a/src/stores/useNavigationStore.js b/src/stores/useNavigationStore.js index bcaeeb953..168c1f9dc 100644 --- a/src/stores/useNavigationStore.js +++ b/src/stores/useNavigationStore.js @@ -6,7 +6,7 @@ import { useRole } from 'src/composables/useRole'; import routes from 'src/router/modules'; export const useNavigationStore = defineStore('navigationStore', () => { - const modules = ['customer', 'claim', 'ticket', 'invoiceOut', 'worker', 'wagon']; + const modules = ['customer', 'claim', 'ticket', 'invoiceOut', 'worker', 'wagon', 'route']; const pinnedModules = ref([]); const role = useRole(); diff --git a/test/cypress/integration/login.spec.js b/test/cypress/integration/login.spec.js index 4cf10f226..f8a9f5c64 100755 --- a/test/cypress/integration/login.spec.js +++ b/test/cypress/integration/login.spec.js @@ -3,28 +3,37 @@ describe('Login', () => { beforeEach(() => { cy.visit('/#/login'); cy.get('#switchLanguage').click(); - cy.get('div.q-menu div.q-item:nth-child(1)').click(); + cy.get('.q-menu > :nth-child(1) > .q-item').click(); }); it('should fail to log in using wrong user', () => { cy.get('input[aria-label="Username"]').type('incorrectUser'); cy.get('input[aria-label="Password"]').type('nightmare'); cy.get('button[type="submit"]').click(); - cy.get('.q-notification__message').should('have.text', 'Invalid username or password'); + cy.get('.q-notification__message').should( + 'have.text', + 'Invalid username or password' + ); }); it('should fail to log in using wrong password', () => { cy.get('input[aria-label="Username"]').type('employee'); cy.get('input[aria-label="Password"]').type('wrongPassword'); cy.get('button[type="submit"]').click(); - cy.get('.q-notification__message').should('have.text', 'Invalid username or password'); + cy.get('.q-notification__message').should( + 'have.text', + 'Invalid username or password' + ); }); it('should log in', () => { cy.get('input[aria-label="Username"]').type('employee'); cy.get('input[aria-label="Password"]').type('nightmare'); cy.get('button[type="submit"]').click(); - cy.get('.q-notification__message').should('have.text', 'You have successfully logged in'); + cy.get('.q-notification__message').should( + 'have.text', + 'You have successfully logged in' + ); cy.url().should('contain', '/dashboard'); }); @@ -32,7 +41,10 @@ describe('Login', () => { cy.get('input[aria-label="Username"]').type('employee'); cy.get('input[aria-label="Password"]').type('nightmare'); cy.get('button[type="submit"]').click(); - cy.get('.q-notification__message').should('have.text', 'You have successfully logged in'); + cy.get('.q-notification__message').should( + 'have.text', + 'You have successfully logged in' + ); cy.url().should('contain', '/dashboard'); cy.get('#user').click(); cy.get('#logout').click(); diff --git a/test/cypress/integration/workerNotificationsManager.spec.js b/test/cypress/integration/workerNotificationsManager.spec.js index 6c5aa21fb..4cd54629a 100644 --- a/test/cypress/integration/workerNotificationsManager.spec.js +++ b/test/cypress/integration/workerNotificationsManager.spec.js @@ -1,4 +1,4 @@ -describe('WorkerNotificationsManager', () => { +xdescribe('WorkerNotificationsManager', () => { beforeEach(() => { const workerId = 1110; cy.viewport(1280, 720); @@ -9,16 +9,25 @@ describe('WorkerNotificationsManager', () => { it('should unsubscribe 2 notifications, check the unsubscription has been saved, subscribe to other one and should check the data has been saved', () => { cy.get('.q-chip').should('have.length', 3); cy.get('.q-toggle__thumb').eq(0).click(); - cy.get('.q-notification__message').should('have.text', 'Unsubscribed from the notification'); + cy.get('.q-notification__message').should( + 'have.text', + 'Unsubscribed from the notification' + ); cy.get('.q-chip > .q-icon').eq(0).click(); cy.reload(); cy.get('.q-chip').should('have.length', 1); cy.get('.q-toggle__thumb').should('have.length', 3).eq(0).click(); - cy.get('.q-notification__message').should('have.text', 'Subscribed to the notification'); + cy.get('.q-notification__message').should( + 'have.text', + 'Subscribed to the notification' + ); cy.get('.q-toggle__thumb').should('have.length', 3).eq(1).click(); - cy.get('.q-notification__message').should('have.text', 'Subscribed to the notification'); + cy.get('.q-notification__message').should( + 'have.text', + 'Subscribed to the notification' + ); cy.reload(); diff --git a/test/vitest/__tests__/components/Leftmenu.spec.js b/test/vitest/__tests__/components/Leftmenu.spec.js index 87caa2413..ffdaebe7b 100644 --- a/test/vitest/__tests__/components/Leftmenu.spec.js +++ b/test/vitest/__tests__/components/Leftmenu.spec.js @@ -45,7 +45,7 @@ vi.mock('src/router/modules', () => ({ ], })); -describe.skip('Leftmenu', () => { +describe('Leftmenu', () => { let vm; let navigation; beforeAll(() => {