diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 079fe6508..43a3a8a38 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -91,9 +91,15 @@ globals: basicData: Basic data log: Logs parkingList: Parkings list + agencyList: Agencies list + agency: Agency + workCenters: Work centers + modes: Modes created: Created worker: Worker now: Now + name: Name + new: New errors: statusUnauthorized: Access denied statusInternalServerError: An internal server error has ocurred diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 64a72ce54..06aa057e3 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -91,9 +91,15 @@ globals: basicData: Datos básicos log: Historial parkingList: Listado de parkings + agencyList: Listado de agencias + agency: Agencia + workCenters: Centros de trabajo + modes: Modos created: Fecha creación worker: Trabajador now: Ahora + name: Nombre + new: Nuevo errors: statusUnauthorized: Acceso denegado statusInternalServerError: Ha ocurrido un error interno del servidor diff --git a/src/pages/Agency/AgencyList.vue b/src/pages/Agency/AgencyList.vue new file mode 100644 index 000000000..88abba3eb --- /dev/null +++ b/src/pages/Agency/AgencyList.vue @@ -0,0 +1,79 @@ + + + + es: + isOwn: Tiene propietario + isAnyVolumeAllowed: Permite cualquier volumen + Search agency: Buscar agencia + You can search by name: Puedes buscar por nombre + en: + isOwn: Has owner + isAnyVolumeAllowed: Allows any volume + diff --git a/src/pages/Agency/Card/AgencyBasicData.vue b/src/pages/Agency/Card/AgencyBasicData.vue new file mode 100644 index 000000000..5999f853b --- /dev/null +++ b/src/pages/Agency/Card/AgencyBasicData.vue @@ -0,0 +1,52 @@ + + diff --git a/src/pages/Agency/Card/AgencyCard.vue b/src/pages/Agency/Card/AgencyCard.vue new file mode 100644 index 000000000..e78d1cc55 --- /dev/null +++ b/src/pages/Agency/Card/AgencyCard.vue @@ -0,0 +1,35 @@ + + diff --git a/src/pages/Agency/Card/AgencyDescriptor.vue b/src/pages/Agency/Card/AgencyDescriptor.vue new file mode 100644 index 000000000..0fa89d07d --- /dev/null +++ b/src/pages/Agency/Card/AgencyDescriptor.vue @@ -0,0 +1,35 @@ + + diff --git a/src/pages/Agency/Card/AgencyLog.vue b/src/pages/Agency/Card/AgencyLog.vue new file mode 100644 index 000000000..d4769a676 --- /dev/null +++ b/src/pages/Agency/Card/AgencyLog.vue @@ -0,0 +1,6 @@ + + diff --git a/src/pages/Agency/Card/AgencyModes.vue b/src/pages/Agency/Card/AgencyModes.vue new file mode 100644 index 000000000..4fb81914a --- /dev/null +++ b/src/pages/Agency/Card/AgencyModes.vue @@ -0,0 +1,60 @@ + + + + es: + isOwn: Tiene propietario + isAnyVolumeAllowed: Permite cualquier volumen + Search agency: Buscar agencia + You can search by name: Puedes buscar por nombre + deliveryMethod: Método de entrega + inflation: Inflación + en: + isOwn: Has owner + isAnyVolumeAllowed: Allows any volume + diff --git a/src/pages/Agency/Card/AgencySummary.vue b/src/pages/Agency/Card/AgencySummary.vue new file mode 100644 index 000000000..0e80813aa --- /dev/null +++ b/src/pages/Agency/Card/AgencySummary.vue @@ -0,0 +1,55 @@ + + + diff --git a/src/pages/Agency/Card/AgencyWorkcenter.vue b/src/pages/Agency/Card/AgencyWorkcenter.vue new file mode 100644 index 000000000..31be90af4 --- /dev/null +++ b/src/pages/Agency/Card/AgencyWorkcenter.vue @@ -0,0 +1,136 @@ + + + + + es: + workCenter removed successfully: Centro de trabajo eliminado correctamente + This workCenter is already assigned to this agency: Este workCenter ya está asignado a esta agencia + Add work center: Añadir centro de trabajo + workCenter: Centro de trabajo + diff --git a/src/pages/Agency/locale/en.yml b/src/pages/Agency/locale/en.yml new file mode 100644 index 000000000..3cc3d69e8 --- /dev/null +++ b/src/pages/Agency/locale/en.yml @@ -0,0 +1,11 @@ +agency: + isOwn: Own + isAnyVolumeAllowed: Any volume allowed + notification: + removeItemError: Error removing agency + removeItem: WorkCenter removed successfully + pageTitles: + agency: Agency + searchBar: + info: You can search by agency code + label: Search agency... diff --git a/src/pages/Agency/locale/es.yml b/src/pages/Agency/locale/es.yml new file mode 100644 index 000000000..2607472bd --- /dev/null +++ b/src/pages/Agency/locale/es.yml @@ -0,0 +1,12 @@ +agency: + isOwn: Propio + isAnyVolumeAllowed: Cualquier volumen + removeItem: Agencia eliminada correctamente + notification: + removeItemError: Error al eliminar la agencia + removeItem: Centro de trabajo eliminado correctamente + pageTitles: + agency: Agencia + searchBar: + info: Puedes buscar por nombre o id + label: Buscar agencia... diff --git a/src/pages/Customer/components/CustomerCreditCreate.vue b/src/pages/Customer/components/CustomerCreditCreate.vue index ae6d4de89..729deb258 100644 --- a/src/pages/Customer/components/CustomerCreditCreate.vue +++ b/src/pages/Customer/components/CustomerCreditCreate.vue @@ -13,7 +13,6 @@ const router = useRouter(); const initialData = ref({}); const setClient = (data) => { - console.log(data.credit); initialData.value.credit = data.credit; }; diff --git a/src/pages/Ticket/TicketCreate.vue b/src/pages/Ticket/TicketCreate.vue index cb3e46d6a..16f5a2a40 100644 --- a/src/pages/Ticket/TicketCreate.vue +++ b/src/pages/Ticket/TicketCreate.vue @@ -73,7 +73,6 @@ const fetchAddresses = async (formData) => { const { defaultAddress } = selectedClient.value; formData.addressId = defaultAddress.id; - console.log(); } catch (err) { console.error(`Error fetching addresses`, err); return err.response; diff --git a/src/router/modules/agency.js b/src/router/modules/agency.js new file mode 100644 index 000000000..6f281e21d --- /dev/null +++ b/src/router/modules/agency.js @@ -0,0 +1,88 @@ +import { RouterView } from 'vue-router'; + +export default { + path: '/agency', + name: 'Agency', + meta: { + title: 'agency', + icon: 'garage_home', + moduleName: 'Agency', + }, + component: RouterView, + redirect: { name: 'AgencyCard' }, + menus: { + main: [], + card: ['AgencyBasicData', 'AgencyModes', 'AgencyWorkCenters', 'AgencyLog'], + }, + children: [ + { + path: '/agency/:id', + name: 'AgencyCard', + component: () => import('src/pages/Agency/Card/AgencyCard.vue'), + redirect: { name: 'AgencySummary' }, + children: [ + { + name: 'AgencySummary', + path: 'summary', + meta: { + title: 'summary', + icon: 'view_list', + }, + component: () => import('src/pages/Agency/Card/AgencySummary.vue'), + }, + { + name: 'AgencyBasicData', + path: 'basic-data', + meta: { + title: 'basicData', + icon: 'vn:settings', + }, + component: () => import('pages/Agency/Card/AgencyBasicData.vue'), + }, + { + path: 'workCenter', + name: 'AgencyWorkCenterCard', + redirect: { name: 'AgencyWorkCenters' }, + children: [ + { + path: '', + name: 'AgencyWorkCenters', + meta: { + icon: 'apartment', + title: 'workCenters', + }, + component: () => + import('src/pages/Agency/Card/AgencyWorkcenter.vue'), + }, + ], + }, + { + path: 'modes', + name: 'AgencyModesCard', + redirect: { name: 'AgencyModes' }, + children: [ + { + path: '', + name: 'AgencyModes', + meta: { + icon: 'format_list_bulleted', + title: 'modes', + }, + component: () => + import('src/pages/Agency/Card/AgencyModes.vue'), + }, + ], + }, + { + name: 'AgencyLog', + path: 'log', + meta: { + title: 'log', + icon: 'history', + }, + component: () => import('src/pages/Agency/Card/AgencyLog.vue'), + }, + ], + }, + ], +}; diff --git a/src/router/modules/index.js b/src/router/modules/index.js index 302ba7fe0..6f4b0b35e 100644 --- a/src/router/modules/index.js +++ b/src/router/modules/index.js @@ -15,6 +15,7 @@ import Department from './department'; import Entry from './entry'; import roadmap from './roadmap'; import Parking from './parking'; +import Agency from './agency'; export default [ Item, @@ -34,4 +35,5 @@ export default [ Entry, roadmap, Parking, + Agency, ]; diff --git a/src/router/modules/route.js b/src/router/modules/route.js index f8ededf55..8e08d7222 100644 --- a/src/router/modules/route.js +++ b/src/router/modules/route.js @@ -11,7 +11,7 @@ export default { component: RouterView, redirect: { name: 'RouteMain' }, menus: { - main: ['RouteList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList'], + main: ['RouteList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList', 'AgencyList'], card: ['RouteBasicData', 'RouteTickets', 'RouteLog'], }, children: [ @@ -75,6 +75,21 @@ export default { }, component: () => import('src/pages/Route/Cmr/CmrList.vue'), }, + { + path: '/agency', + redirect: { name: 'AgencyList' }, + children: [ + { + path: 'list', + name: 'AgencyList', + meta: { + title: 'agencyList', + icon: 'view_list', + }, + component: () => import('src/pages/Agency/AgencyList.vue'), + }, + ], + }, ], }, { diff --git a/src/router/routes.js b/src/router/routes.js index 51e726a62..ca52441e7 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -15,6 +15,7 @@ import order from 'src/router/modules/order'; import entry from 'src/router/modules/entry'; import roadmap from 'src/router/modules/roadmap'; import parking from 'src/router/modules/parking'; +import agency from 'src/router/modules/agency'; const routes = [ { @@ -71,6 +72,7 @@ const routes = [ roadmap, entry, parking, + agency, { path: '/:catchAll(.*)*', name: 'NotFound', diff --git a/test/cypress/integration/agency/agencyWorkCenter.spec.js b/test/cypress/integration/agency/agencyWorkCenter.spec.js new file mode 100644 index 000000000..ff3c53214 --- /dev/null +++ b/test/cypress/integration/agency/agencyWorkCenter.spec.js @@ -0,0 +1,50 @@ +describe('AgencyWorkCenter', () => { + beforeEach(() => { + cy.viewport(1920, 1080); + cy.login('developer'); + cy.visit(`/#/agency`); + }); + + it('assign workCenter', () => { + cy.visit(`/#/agency`); + cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click(); + cy.get('[href="#/agency/11/workCenter"] > .q-item__section--main').click(); + cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); + cy.get( + '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container' + ).type('workCenterOne{enter}'); + cy.get('.q-btn--standard > .q-btn__content > .block').click(); + cy.get('.q-notification__message').should('have.text', 'Data created'); + }); + + it('delete workCenter', () => { + cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click(); + cy.get('[href="#/agency/11/workCenter"] > .q-item__section--main').click(); + cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click(); + cy.get('.q-notification__message').should( + 'have.text', + 'WorkCenter removed successfully' + ); + }); + + it('error on duplicate workCenter', () => { + cy.visit(`/#/agency`); + cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click(); + cy.get('[href="#/agency/11/workCenter"] > .q-item__section--main').click(); + cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); + cy.get( + '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container' + ).type('workCenterOne{enter}'); + cy.get('.q-btn--standard > .q-btn__content > .block').click(); + cy.get('.q-notification__message').should('have.text', 'Data created'); + cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); + cy.get( + '.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container' + ).type('workCenterOne{enter}'); + cy.get('.q-btn--standard > .q-btn__content > .block').click(); + + cy.get( + ':nth-child(2) > .q-notification__wrapper > .q-notification__content > .q-notification__message' + ).should('have.text', 'This workCenter is already assigned to this agency'); + }); +}); diff --git a/test/vitest/setup-file.js b/test/vitest/setup-file.js index 499204981..288f80beb 100644 --- a/test/vitest/setup-file.js +++ b/test/vitest/setup-file.js @@ -1 +1 @@ -// This file will be run before each test file +// This file will be run before each test file, don't delete or vitest will not work.