{{ t(`params.${tag.label}`) }}:
@@ -301,6 +341,7 @@ const getGroupedStates = (data) => {
en:
+ dateRangeMustHaveBothFrom: The date range must have both 'from' and 'to'
params:
search: Contains
clientFk: Customer
@@ -329,6 +370,7 @@ en:
DELIVERED: Delivered
ON_PREVIOUS: ON_PREVIOUS
es:
+ dateRangeMustHaveBothFrom: El rango de fechas debe tener 'desde' y 'hasta'
params:
search: Contiene
clientFk: Cliente
diff --git a/src/pages/Ticket/TicketList.vue b/src/pages/Ticket/TicketList.vue
index b2e13fcb6..13fcf591a 100644
--- a/src/pages/Ticket/TicketList.vue
+++ b/src/pages/Ticket/TicketList.vue
@@ -43,12 +43,8 @@ from.setDate(from.getDate() - 7);
const to = Date.vnNew();
to.setHours(23, 59, 0, 0);
to.setDate(to.getDate() + 1);
-const userParams = {
- from: null,
- to: null,
-};
+
onBeforeMount(() => {
- initializeFromQuery();
stateStore.rightDrawer = true;
});
onMounted(async () => {
@@ -79,6 +75,7 @@ const companiesOptions = ref([]);
const accountingOptions = ref([]);
const amountToReturn = ref();
const dataKey = 'TicketList';
+const filterPanelRef = ref(null);
const formInitialData = ref({});
const columns = computed(() => [
@@ -483,11 +480,17 @@ function setReference(data) {
:array-data-props="{
url: 'Tickets/filter',
order: ['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id'],
+ filterPanel: filterPanelRef,
+ searchRemoveParams: true,
exprBuilder,
}"
>
-
+
onClientSelected(data)"
+ @update:model-value="onClientSelected(data)"
:sort-by="'id ASC'"
>
diff --git a/test/cypress/integration/ticket/ticketFilter.spec.js b/test/cypress/integration/ticket/ticketFilter.spec.js
index 2e5a3f3ce..932dab536 100644
--- a/test/cypress/integration/ticket/ticketFilter.spec.js
+++ b/test/cypress/integration/ticket/ticketFilter.spec.js
@@ -6,10 +6,39 @@ describe('TicketFilter', () => {
cy.visit('/#/ticket/list');
});
- it('use search button', function () {
+ it('use search button', () => {
cy.waitForElement('.q-page');
- cy.get('[data-cy="Customer ID_input"]').type('1105');
+ cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
cy.searchBtnFilterPanel();
- cy.location('href').should('contain', '#/ticket/15/summary');
+ cy.waitRequest('@ticketFilter', ({ request }) => {
+ const { query } = request;
+ expect(query).to.have.property('from');
+ expect(query).to.have.property('to');
+ });
+ // cy.on('uncaught:exception', () => {
+ // return false;
+ // });
+ cy.dataCy('From_inputDate').type(`${today()} `).type('{enter}');
+ cy.get('.q-notification').should(
+ 'contain',
+ `The date range must have both 'from' and 'to'`,
+ );
+
+ cy.dataCy('To_inputDate').type(`${today()}{enter}`);
+ cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
+ cy.searchBtnFilterPanel();
+ cy.wait('@ticketFilter').then(({ request }) => {
+ const { query } = request;
+ expect(query).to.have.property('from');
+ expect(query).to.have.property('to');
+ });
+ cy.location('href').should('contain', '#/ticket/999999');
});
});
+function today(date) {
+ return new Intl.DateTimeFormat('es-ES', {
+ day: '2-digit',
+ month: '2-digit',
+ year: 'numeric',
+ }).format(date ?? new Date());
+}
diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js
index 8a459a6bf..95a4de6ae 100644
--- a/test/cypress/integration/ticket/ticketList.spec.js
+++ b/test/cypress/integration/ticket/ticketList.spec.js
@@ -35,6 +35,31 @@ describe('TicketList', () => {
cy.get('.summaryBody').should('exist');
});
+ it('filter client and create ticket', () => {
+ cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
+ searchResults();
+ cy.wait('@ticketSearchbar').then(({ request }) => {
+ const { query } = request;
+ expect(query).to.have.property('from');
+ expect(query).to.have.property('to');
+ expect(query).to.not.have.property('clientFk');
+ });
+ cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
+ cy.dataCy('Customer ID_input').clear('1');
+ cy.dataCy('Customer ID_input').type('1101{enter}');
+ cy.wait('@ticketFilter').then(({ request }) => {
+ const { query } = request;
+ expect(query).to.not.have.property('from');
+ expect(query).to.not.have.property('to');
+ expect(query).to.have.property('clientFk');
+ });
+ cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click();
+ cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
+ cy.dataCy('Address_select').click();
+
+ cy.getOption().click();
+ cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
+ });
it('filter client and create ticket', () => {
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
searchResults();
@@ -66,7 +91,7 @@ describe('TicketList', () => {
cy.url().should('match', /\/ticket\/\d+\/summary/);
});
- it('should show the correct problems', () => {
+ it.only('should show the correct problems', () => {
cy.intercept('GET', '**/api/Tickets/filter*', (req) => {
req.headers['cache-control'] = 'no-cache';
req.headers['pragma'] = 'no-cache';
@@ -81,7 +106,7 @@ describe('TicketList', () => {
cy.get('[data-cy="Warehouse_select"]').type('Warehouse Five');
cy.get('.q-menu .q-item').contains('Warehouse Five').click();
cy.wait('@ticket').then((interception) => {
- const data = interception.response.body[1];
+ const data = interception.response.body.at(-1);
expect(data.hasComponentLack).to.equal(1);
expect(data.isTooLittle).to.equal(1);
expect(data.hasItemShortage).to.equal(1);