diff --git a/src/pages/Route/Cmr/CmrList.vue b/src/pages/Route/Cmr/CmrList.vue index b3eaf3b48f4..d0683e48194 100644 --- a/src/pages/Route/Cmr/CmrList.vue +++ b/src/pages/Route/Cmr/CmrList.vue @@ -2,28 +2,38 @@ import { onBeforeMount, onMounted, computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { Notify } from 'quasar'; +import { useRoute } from 'vue-router'; import { useSession } from 'src/composables/useSession'; import { toDateHourMin } from 'filters/index'; import { useStateStore } from 'src/stores/useStateStore'; -import axios from 'axios'; import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnTable from 'components/VnTable/VnTable.vue'; +import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; +const route = useRoute(); const { t } = useI18n(); const { getTokenMultimedia } = useSession(); const token = getTokenMultimedia(); const state = useStateStore(); -const warehouses = ref([]); const selectedRows = ref([]); +const dataKey = 'CmrList'; +const shipped = Date.vnNew(); +shipped.setHours(0, 0, 0, 0); +shipped.setDate(shipped.getDate() - 1); +const userParams = { + shipped: null, +}; + + const columns = computed(() => [ { align: 'left', name: 'cmrFk', - label: t('route.cmr.list.cmrFk'), + label: t('route.cmr.params.cmrFk'), chip: { condition: () => true, }, @@ -32,62 +42,67 @@ const columns = computed(() => [ { align: 'center', name: 'hasCmrDms', - label: t('route.cmr.list.hasCmrDms'), + label: t('route.cmr.params.hasCmrDms'), component: 'checkbox', cardVisible: true, }, { align: 'left', - label: t('route.cmr.list.ticketFk'), + label: t('route.cmr.params.ticketFk'), name: 'ticketFk', }, { align: 'left', - label: t('route.cmr.list.routeFk'), + label: t('route.cmr.params.routeFk'), name: 'routeFk', }, { align: 'left', - label: t('route.cmr.list.clientFk'), + label: t('route.cmr.params.clientFk'), name: 'clientFk', }, { align: 'right', - label: t('route.cmr.list.country'), + label: t('route.cmr.params.countryFk'), name: 'countryFk', - cardVisible: true, + component: 'select', attrs: { url: 'countries', fields: ['id', 'name'], - optionLabel: 'name', - optionValue: 'id', }, columnFilter: { - inWhere: true, - component: 'select', + name: 'countryFk', + attrs: { + url: 'countries', + fields: ['id', 'name'], + }, }, format: ({ countryName }) => countryName, }, { align: 'right', - label: t('route.cmr.list.shipped'), + label: t('route.cmr.params.shipped'), name: 'shipped', cardVisible: true, - columnFilter: { - component: 'date', - inWhere: true, - }, + component: 'date', format: ({ shipped }) => toDateHourMin(shipped), }, { align: 'right', + label: t('route.cmr.params.warehouseFk'), name: 'warehouseFk', - label: t('globals.warehouse'), - columnFilter: { - component: 'select', - }, + component: 'select', attrs: { - options: warehouses.value, + url: 'warehouses', + fields: ['id', 'name'], + }, + columnFilter: { + inWhere: true, + name: 'warehouseFk', + attrs: { + url: 'warehouses', + fields: ['id', 'name'], + }, }, format: ({ warehouseName }) => warehouseName, }, @@ -96,7 +111,7 @@ const columns = computed(() => [ name: 'tableActions', actions: [ { - title: t('Ver cmr'), + title: t('route.cmr.params.viewCmr'), icon: 'visibility', isPrimary: true, action: (row) => window.open(getCmrUrl(row?.cmrFk), '_blank'), @@ -105,13 +120,17 @@ const columns = computed(() => [ }, ]); -onBeforeMount(async () => { - const { data } = await axios.get('Warehouses'); - warehouses.value = data; +onBeforeMount(() => { + initializeFromQuery(); }); onMounted(() => (state.rightDrawer = true)); +const initializeFromQuery = () => { + const query = route.query.table ? JSON.parse(route.query.table) : {}; + shipped.value = query.shipped || shipped.toISOString(); + Object.assign(userParams, { shipped }); +}; function getApiUrl() { return new URL(window.location).origin; } @@ -133,6 +152,11 @@ function downloadPdfs() { } </script> <template> + <VnSearchbar + :data-key + :label="t('route.cmr.search')" + :info="t('route.cmr.searchInfo')" + /> <VnSubToolbar> <template #st-actions> <QBtn @@ -142,16 +166,16 @@ function downloadPdfs() { :disable="!selectedRows?.length" @click="downloadPdfs" > - <QTooltip>{{ t('route.cmr.list.downloadCmrs') }}</QTooltip> + <QTooltip>{{ t('route.cmr.params.downloadCmrs') }}</QTooltip> </QBtn> </template> </VnSubToolbar> <VnTable ref="tableRef" - data-key="CmrList" + :data-key url="Cmrs/filter" :columns="columns" - :right-search="true" + :user-params="userParams" default-mode="table" v-model:selected="selectedRows" table-height="85vh" diff --git a/src/pages/Route/locale/en.yml b/src/pages/Route/locale/en.yml index cc445f41203..ec7f5287a57 100644 --- a/src/pages/Route/locale/en.yml +++ b/src/pages/Route/locale/en.yml @@ -3,16 +3,19 @@ route: search: Search roadmap searchInfo: You can search by roadmap reference params: + id: Id + name: Name etd: ETD tractorPlate: Plate price: Price observations: Observations - id: ID - name: Name cmrFk: CMR id hasCmrDms: Attached in gestdoc ticketFk: Ticketd id routeFk: Route id + clientFk: Client id + countryFk: Country + warehouseFk: Warehouse shipped: Shipped agencyAgreement: Agency agreement agencyModeName: Agency route @@ -42,7 +45,9 @@ route: search: Search route searchInfo: You can search by route reference cmr: - list: + search: Search Cmr + searchInfo: You can search Cmr by Id + params: results: results cmrFk: CMR id hasCmrDms: Attached in gestdoc @@ -50,8 +55,10 @@ route: 'false': 'No' ticketFk: Ticketd id routeFk: Route id - country: Country + countryFk: Country clientFk: Client id + warehouseFk: Warehouse shipped: Preparation date viewCmr: View CMR - downloadCmrs: Download CMRs \ No newline at end of file + downloadCmrs: Download CMRs + search: General search diff --git a/src/pages/Route/locale/es.yml b/src/pages/Route/locale/es.yml index 51d43774a5a..1e247ab68bb 100644 --- a/src/pages/Route/locale/es.yml +++ b/src/pages/Route/locale/es.yml @@ -3,8 +3,6 @@ route: search: Buscar troncales searchInfo: Puedes buscar por referencia del troncal params: - agencyModeName: Agencia Ruta - agencyAgreement: Agencia Acuerdo id: Id name: Troncal etd: ETD @@ -13,9 +11,15 @@ route: observations: Observaciones cmrFk: Id CMR hasCmrDms: Gestdoc + search: Búsqueda general ticketFk: Id ticket - routeFK: Id ruta + routeFk: Id ruta + clientFk: Id cliente + countryFk: Pais + warehouseFk: Almacén shipped: Fecha preparación + agencyModeName: Agencia Ruta + agencyAgreement: Agencia Acuerdo Worker: Trabajador Agency: Agencia Vehicle: Vehículo @@ -55,4 +59,4 @@ route: clientFk: Id cliente shipped: Fecha preparación viewCmr: Ver CMR - downloadCmrs: Descargar CMRs \ No newline at end of file + downloadCmrs: Descargar CMRs diff --git a/test/cypress/integration/client/clientBalance.spec.js b/test/cypress/integration/client/clientBalance.spec.js index 4579efaa61a..56ce0169201 100644 --- a/test/cypress/integration/client/clientBalance.spec.js +++ b/test/cypress/integration/client/clientBalance.spec.js @@ -1,17 +1,14 @@ /// <reference types="cypress" /> -describe.skip('Client balance', () => { +describe('Client balance', () => { beforeEach(() => { cy.viewport(1280, 720); cy.login('developer'); cy.visit('#/customer/1101/balance'); }); - it('Should load layout', () => { - cy.get('.q-page').should('be.visible'); - }); it('Should create a mandate', () => { cy.get('.q-page-sticky > div > .q-btn').click(); - cy.dataCy('paymentBank').type({ arroyDown }); - cy.dataCy('paymentAmount').type('100'); + cy.selectOption('[data-cy="paymentBank"]', 2); + cy.dataCy('paymentAmount_input').type('100'); cy.saveCard(); }); }); diff --git a/test/cypress/integration/route/roadMap/roadmapList.spec.js b/test/cypress/integration/route/roadMap/roadmapList.spec.js index 6d46b2cf623..35c0c2b0285 100644 --- a/test/cypress/integration/route/roadMap/roadmapList.spec.js +++ b/test/cypress/integration/route/roadMap/roadmapList.spec.js @@ -1,12 +1,74 @@ describe('RoadMap', () => { + const getSelector = (colField) => + `tr:last-child > [data-col-field="${colField}"] > .no-padding`; + + const selectors = { + roadmap: getSelector('name'), + id: getSelector('id'), + etd: getSelector('etd'), + summaryHeader: '.summaryHeader > :nth-child(2)', + summaryGoToSummaryBtn: '.summaryHeader > a > .q-icon', + summaryBtn: 'tableAction-0', + inputRoadmap: 'Roadmap_input', + checkbox: '.q-virtual-scroll__content tr:last-child .q-checkbox', + cloneFormBtn: '.q-card__actions > .q-btn--standard', + cloneBtn: '#subToolbar > :nth-child(3)', + deleteBtn: ':nth-child(4) > .q-btn__content', + confirmBtn: 'VnConfirm_confirm', + inputEtd: 'ETD_inputDate', + }; + + const data = { + roadmap: 'TEST-ROADMAP', + etd: '01/01/2025', + }; + + const dataCreated = 'Data created'; + const summaryUrl = '/summary'; + beforeEach(() => { + cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/route/roadmap`); + cy.typeSearchbar('{enter}'); }); + + it('Should list roadmaps', () => { + cy.get('.q-table') + .children() + .should('be.visible') + .should('have.length.greaterThan', 0); + }); + it('Route list create roadmap and redirect', () => { cy.addBtnClick(); - cy.get('input[name="name"]').type('roadMapTestOne{enter}'); - cy.get('.q-notification__message').should('have.text', 'Data created'); - cy.url().should('include', '/summary'); + cy.dataCy(selectors.inputRoadmap).type(`${data.roadmap}{enter}`); + cy.checkNotification(dataCreated); + cy.url().should('include', summaryUrl); + }); + + it('open summary', () => { + cy.dataCy(selectors.summaryBtn).last().click(); + cy.get(selectors.summaryHeader).should('contain', data.roadmap); + cy.get(selectors.summaryGoToSummaryBtn).click(); + cy.get(selectors.summaryHeader).should('contain', data.roadmap); + }); + + it('Should clone selected roadmap with new ETD', () => { + cy.get(selectors.checkbox).click(); + cy.get(selectors.cloneBtn).click(); + cy.dataCy(selectors.inputEtd).click().type(`${data.etd}{enter}`); + cy.get(selectors.cloneFormBtn).click(); + cy.get(selectors.etd).should('contain', data.etd); + }); + + it('Should delete selected roadmap', () => { + cy.get(selectors.id).then(($el) => { + cy.get(selectors.checkbox).click(); + cy.get(selectors.deleteBtn).click(); + cy.dataCy(selectors.confirmBtn).click(); + cy.typeSearchbar('{enter}'); + cy.get(selectors.id).should('not.have.text', $el.text); + }); }); }); diff --git a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js index 7b1932b11bc..b4997fa69ce 100644 --- a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js +++ b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js @@ -138,8 +138,8 @@ describe.skip('Ticket Lack detail', () => { cy.get('[data-cy="itemProposal"]').click(); cy.wait('@getItemGetSimilar'); }); - describe('Replace item if', () => { - it.skip('Quantity is less than available', () => { + describe.skip('Replace item if', () => { + it('Quantity is less than available', () => { cy.get(':nth-child(1) > .text-right > .q-btn').click(); }); });