diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index f361fb536..53c756f42 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -12,7 +12,7 @@ const $props = defineProps({ type: Boolean, default: false, }, - showEvent: { + isPopupOpen: { type: Boolean, default: true, }, @@ -114,7 +114,7 @@ const manageDate = (dates) => { } else { formattedDate.value = dates; } - isPopupOpen.value = false; + if ($props.isPopupOpen) isPopupOpen.value = false; }; diff --git a/src/pages/Item/components/ItemProposal.vue b/src/pages/Item/components/ItemProposal.vue index 22c1d3d8b..a827508ad 100644 --- a/src/pages/Item/components/ItemProposal.vue +++ b/src/pages/Item/components/ItemProposal.vue @@ -255,9 +255,17 @@ async function handleTicketConfig(data) { :row-click="change" :is-editable="false" :right-search="false" - :without-header="true" :disable-option="{ card: true, table: true }" > + + + {{ statusConditionalValue(row) }}% - - {{ row.longName }} + + {{ row.longName }} - + diff --git a/src/pages/Ticket/Negative/TicketLackFilter.vue b/src/pages/Ticket/Negative/TicketLackFilter.vue index 60b50362e..705307cbd 100644 --- a/src/pages/Ticket/Negative/TicketLackFilter.vue +++ b/src/pages/Ticket/Negative/TicketLackFilter.vue @@ -7,7 +7,6 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnSelect from 'src/components/common/VnSelect.vue'; import VnInputDateTime from 'src/components/common/VnInputDateTime.vue'; -import VnDate from 'src/components/common/VnDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue'; const { t } = useI18n(); @@ -131,6 +130,7 @@ const setUserParams = (params) => { filled :label="t('negative.excludedDates')" :multiple="true" + :is-popup-open="false" > diff --git a/src/pages/Ticket/locale/es.yml b/src/pages/Ticket/locale/es.yml index ec4534e5f..d2c908b2c 100644 --- a/src/pages/Ticket/locale/es.yml +++ b/src/pages/Ticket/locale/es.yml @@ -227,7 +227,7 @@ negative: origen: Origen value: Negativo warehouseFk: Almacen - producer: Producer + producer: Productor excludedDates: Fechas excluidas category: CategorÃa categoryFk: Familia diff --git a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js index b4997fa69..08fdc16d8 100644 --- a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js +++ b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js @@ -1,147 +1,173 @@ /// -describe.skip('Ticket Lack detail', () => { + +const firstRow = 'tr.cursor-pointer > :nth-child(1)'; +const ticketId = 1000000; +const findTr = (index) => `tbody > tr > :nth-child(${index}) > div`; +const clickNotificationAction = () => { + const notification = '.q-notification'; + cy.waitForElement(notification); + cy.get(notification).should('be.visible'); + cy.get(notification).find('.q-btn').click(); + cy.get(notification).should('not.be.visible'); +}; +describe('Ticket Lack detail', () => { beforeEach(() => { + cy.viewport(1280, 720); cy.login('developer'); - cy.intercept('GET', /\/api\/Tickets\/itemLack\/5.*$/, { - statusCode: 200, - body: [ - { - saleFk: 33, - code: 'OK', - ticketFk: 142, - nickname: 'Malibu Point', - shipped: '2000-12-31T23:00:00.000Z', - hour: 0, - quantity: 50, - agName: 'Super-Man delivery', - alertLevel: 0, - stateName: 'OK', - stateId: 3, - itemFk: 5, - price: 1.79, - alertLevelCode: 'FREE', - zoneFk: 9, - zoneName: 'Zone superMan', - theoreticalhour: '2011-11-01T22:59:00.000Z', - isRookie: 1, - turno: 1, - peticionCompra: 1, - hasObservation: 1, - hasToIgnore: 1, - isBasket: 1, - minTimed: 0, - customerId: 1104, - customerName: 'Tony Stark', - observationTypeCode: 'administrative', - }, - ], - }).as('getItemLack'); + cy.intercept('GET', /\/api\/Tickets\/itemLack\/88.*$/).as('getItemLack'); + cy.visit('/#/ticket/negative/88'); - cy.visit('/#/ticket/negative/5', false); - cy.wait('@getItemLack'); + cy.wait('@getItemLack').then((interception) => { + const { query } = interception.request; + const filter = JSON.parse(query.filter); + expect(filter).to.have.property('where'); + expect(filter.where).to.have.property('alertLevelCode', 'FREE'); + }); + cy.domContentLoad(); + cy.waitForElement('.q-table'); }); - describe('Table actions', () => { + describe('Table detail', () => { + it('should open descriptors', () => { + cy.get('.q-table').should('be.visible'); + cy.colField('zoneName').click(); + cy.dataCy('zoneDescriptorProxy').should('be.visible'); + cy.get('.q-item > .q-item__label').should('have.text', ' #1'); + cy.colField('ticketFk').click(); + cy.dataCy('ticketDescriptorProxy').should('be.visible'); + cy.get('.q-item > .q-item__label').should('have.text', ` #${ticketId}`); + cy.colField('nickname').find('.link').click(); + cy.waitForElement('[data-cy="customerDescriptorProxy"]'); + cy.dataCy('customerDescriptorProxy').should('be.visible'); + cy.get('.q-item > .q-item__label').should('have.text', ' #1'); + }); it('should display only one row in the lack list', () => { - cy.location('href').should('contain', '#/ticket/negative/5'); - - cy.get('[data-cy="changeItem"]').should('be.disabled'); - cy.get('[data-cy="changeState"]').should('be.disabled'); - cy.get('[data-cy="changeQuantity"]').should('be.disabled'); - cy.get('[data-cy="itemProposal"]').should('be.disabled'); - cy.get('[data-cy="transferLines"]').should('be.disabled'); + cy.dataCy('changeItem').should('be.disabled'); + cy.dataCy('changeState').should('be.disabled'); + cy.dataCy('changeQuantity').should('be.disabled'); + cy.dataCy('itemProposal').should('be.disabled'); + cy.dataCy('transferLines').should('be.disabled'); cy.get('tr.cursor-pointer > :nth-child(1)').click(); - cy.get('[data-cy="changeItem"]').should('be.enabled'); - cy.get('[data-cy="changeState"]').should('be.enabled'); - cy.get('[data-cy="changeQuantity"]').should('be.enabled'); - cy.get('[data-cy="itemProposal"]').should('be.enabled'); - cy.get('[data-cy="transferLines"]').should('be.enabled'); + cy.dataCy('changeItem').should('be.enabled'); + cy.dataCy('changeState').should('be.enabled'); + cy.dataCy('changeQuantity').should('be.enabled'); + cy.dataCy('itemProposal').should('be.enabled'); + cy.dataCy('transferLines').should('be.enabled'); + }); + }); + + describe('Split', () => { + beforeEach(() => { + cy.get(firstRow).click(); + cy.dataCy('transferLines').click(); + }); + it('Split', () => { + cy.dataCy('ticketTransferPopup').find('.flex > .q-btn').click(); + + clickNotificationAction(); + + cy.dataCy('HandleLackDialog').should('be.visible'); + cy.dataCy('HandleLackDialog').find('tbody > tr > :nth-child(1) > .q-icon'); + cy.dataCy('HandleLackDialog').find(findTr(2)).should('have.class', 'link'); + cy.dataCy('HandleLackDialog') + .find(`${findTr(2)}.link > div > span`) + .should('have.text', `${ticketId} `); + cy.dataCy('HandleLackDialog').find(findTr(3)).should('have.text', 'noSplit'); + }); + }); + describe('Change Item', () => { + beforeEach(() => { + cy.get(firstRow).click(); + cy.dataCy('changeItem').click(); + }); + it('Change failed', () => { + cy.dataCy('New item_select').should('be.visible').click(); + cy.get('.q-item').contains('Palito rojo').click(); + cy.get('.q-btn--unelevated > .q-btn__content > .block').click(); + + clickNotificationAction(); + + cy.dataCy('HandleLackDialog').should('be.visible'); + cy.dataCy('HandleLackDialog').find('tbody > tr > :nth-child(1) > .q-icon'); + cy.dataCy('HandleLackDialog').find(findTr(2)).should('have.class', 'link'); + cy.dataCy('HandleLackDialog') + .find(`${findTr(2)}.link > span`) + .should('have.text', `${ticketId}`); + cy.dataCy('HandleLackDialog') + .find(findTr(3)) + .should('have.text', 'price retrieval failed'); + }); + }); + describe('Change state', () => { + beforeEach(() => { + cy.get(firstRow).click(); + cy.dataCy('changeState').click(); + }); + it('Change success', () => { + cy.dataCy('New state_select').should('be.visible').click(); + cy.get('.q-item').contains('OK').click(); + cy.get('.q-btn--unelevated > .q-btn__content > .block').click(); + + clickNotificationAction(); + + cy.dataCy('HandleLackDialog') + .should('be.visible') + .find('tbody > tr > :nth-child(1) > .q-icon'); + cy.dataCy('HandleLackDialog').find(findTr(2)).should('have.class', 'link'); + cy.dataCy('HandleLackDialog') + .find(`${findTr(2)}.link > div > span`) + .should('have.text', `${ticketId} `); + cy.dataCy('HandleLackDialog').find(findTr(3)).should('have.text', 'OK'); + }); + }); + describe('change quantity', () => { + beforeEach(() => { + cy.get(firstRow).click(); + + cy.dataCy('changeQuantity').click(); + }); + + it('Change success', () => { + cy.dataCy('New quantity_input').type(10); + cy.get('.q-btn--unelevated > .q-btn__content > .block').click(); + + clickNotificationAction(); + + cy.dataCy('HandleLackDialog') + .should('be.visible') + .find('tbody > tr > :nth-child(1) > .q-icon'); + cy.dataCy('HandleLackDialog').find(findTr(2)).should('have.class', 'link'); + cy.dataCy('HandleLackDialog') + .find(`${findTr(2)}.link > div > span`) + .should('have.text', `${ticketId} `); + cy.dataCy('HandleLackDialog').find(findTr(3)).should('have.text', '10'); }); }); describe('Item proposal', () => { beforeEach(() => { - cy.get('tr.cursor-pointer > :nth-child(1)').click(); - - cy.intercept('GET', /\/api\/Items\/getSimilar\?.*$/, { - statusCode: 200, - body: [ - { - id: 1, - longName: 'Ranged weapon longbow 50cm', - subName: 'Stark Industries', - tag5: 'Color', - value5: 'Brown', - match5: 0, - match6: 0, - match7: 0, - match8: 1, - tag6: 'Categoria', - value6: '+1 precission', - tag7: 'Tallos', - value7: '1', - tag8: null, - value8: null, - available: 20, - calc_id: 6, - counter: 0, - minQuantity: 1, - visible: null, - price2: 1, - }, - { - id: 2, - longName: 'Ranged weapon longbow 100cm', - subName: 'Stark Industries', - tag5: 'Color', - value5: 'Brown', - match5: 0, - match6: 1, - match7: 0, - match8: 1, - tag6: 'Categoria', - value6: '+1 precission', - tag7: 'Tallos', - value7: '1', - tag8: null, - value8: null, - available: 50, - calc_id: 6, - counter: 1, - minQuantity: 5, - visible: null, - price2: 10, - }, - { - id: 3, - longName: 'Ranged weapon longbow 200cm', - subName: 'Stark Industries', - tag5: 'Color', - value5: 'Brown', - match5: 1, - match6: 1, - match7: 1, - match8: 1, - tag6: 'Categoria', - value6: '+1 precission', - tag7: 'Tallos', - value7: '1', - tag8: null, - value8: null, - available: 185, - calc_id: 6, - counter: 10, - minQuantity: 10, - visible: null, - price2: 100, - }, - ], - }).as('getItemGetSimilar'); - cy.get('[data-cy="itemProposal"]').click(); - cy.wait('@getItemGetSimilar'); + cy.get(firstRow).click(); + cy.dataCy('itemProposal').click(); }); - describe.skip('Replace item if', () => { - it('Quantity is less than available', () => { + describe('Replace item if', () => { + it.skip('Quantity is less than available', () => { cy.get(':nth-child(1) > .text-right > .q-btn').click(); }); + + it('item proposal cells', () => { + cy.get('[data-col-field="longName"] .link').first().click(); + + cy.dataCy('itemDescriptorProxy').should('be.visible'); + + cy.colField('longName', 2) + .find('.no-padding > .q-td > .middle') + .should('have.class', 'proposal-primary'); + cy.colField('tag5', 2) + .find('.no-padding > .match') + .should('have.class', 'match'); + cy.colField('tag6', 2) + .find('.no-padding > .match') + .should('have.class', 'match'); + cy.colField('tag7', 2).click(); + }); }); }); }); diff --git a/test/cypress/integration/ticket/negative/TicketLackList.spec.js b/test/cypress/integration/ticket/negative/TicketLackList.spec.js index 01ab4f621..a53668c12 100644 --- a/test/cypress/integration/ticket/negative/TicketLackList.spec.js +++ b/test/cypress/integration/ticket/negative/TicketLackList.spec.js @@ -1,34 +1,16 @@ /// describe('Ticket Lack list', () => { beforeEach(() => { - cy.login('developer'); - cy.intercept('GET', /Tickets\/itemLack\?.*$/, { - statusCode: 200, - body: [ - { - itemFk: 5, - longName: 'Ranged weapon pistol 9mm', - warehouseFk: 1, - producer: null, - size: 15, - category: null, - warehouse: 'Warehouse One', - lack: -50, - inkFk: 'SLV', - timed: '2025-01-25T22:59:00.000Z', - minTimed: '23:59', - originFk: 'Holand', - }, - ], - }).as('getLack'); + cy.viewport(1280, 720); + cy.login('developer'); cy.visit('/#/ticket/negative'); }); describe('Table actions', () => { it('should display only one row in the lack list', () => { - cy.wait('@getLack', { timeout: 10000 }); - + cy.get('[data-col-field="longName"]').first().click(); + cy.dataCy('itemDescriptorProxy').should('be.visible'); cy.get('.q-virtual-scroll__content > :nth-child(1) > .sticky').click(); cy.location('href').should('contain', '#/ticket/negative/5'); });