diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js
index bb34c5121..c56a195d5 100644
--- a/src/composables/useArrayData.js
+++ b/src/composables/useArrayData.js
@@ -100,8 +100,9 @@ export function useArrayData(key, userOptions) {
params.filter = JSON.stringify(params.filter);
if (fetchOptions?.exclude) {
- delete params.exclude;
- params = { ...params.params, ...fetchOptions.exclude };
+ delete params?.exclude;
+ delete params?.params?.exclude;
+ params = { ...params, ...fetchOptions.exclude };
}
store.isLoading = true;
const response = await axios.get(store.url, {
@@ -169,8 +170,8 @@ export function useArrayData(key, userOptions) {
let exclude = {};
if (params?.params?.exclude) {
exclude = params.params.exclude;
- // params = { ...params, ...params.exclude };
- delete params.params.exclude;
+ params = { ...params.params, ...params.exclude };
+ delete params.exclude;
}
let userParams = { ...store.userParams, ...params };
userParams = sanitizerParams(userParams, store?.exprBuilder);
@@ -230,11 +231,7 @@ export function useArrayData(key, userOptions) {
function sanitizerParams(params, exprBuilder) {
for (const param in params) {
- if (
- params[param] === '' ||
- params[param] === null ||
- !Object.keys(params[param]).length
- ) {
+ if (params[param] === '' || params[param] === null) {
delete store.userParams[param];
delete params[param];
if (store.filter?.where) {
diff --git a/test/cypress/integration/ticket/ticketFilter.spec.js b/test/cypress/integration/ticket/ticketFilter.spec.js
new file mode 100644
index 000000000..10973c5c5
--- /dev/null
+++ b/test/cypress/integration/ticket/ticketFilter.spec.js
@@ -0,0 +1,51 @@
+///
+describe('TicketFilter', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/list');
+ cy.domContentLoad();
+ });
+
+ it('use search button', function () {
+ cy.waitForElement('.q-page');
+ cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
+ cy.searchBtnFilterPanel();
+ 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.get('.q-field__control-container > [data-cy="From_date"]')
+ .type(`${today()} `)
+ .type('{enter}');
+ cy.get('.q-notification').should(
+ 'contain',
+ `The date range must have both 'from' and 'to'`,
+ );
+
+ cy.get('.q-field__control-container > [data-cy="To_date"]').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 Date().toISOString().split('T')[0];
+
+ 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 593021e6e..3b5ddef79 100644
--- a/test/cypress/integration/ticket/ticketList.spec.js
+++ b/test/cypress/integration/ticket/ticketList.spec.js
@@ -1,16 +1,16 @@
///
describe('TicketList', () => {
- const firstRow = 'tbody > :nth-child(1)';
+ const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/list');
+ cy.domContentLoad();
});
const searchResults = (search) => {
- cy.dataCy('vn-searchbar').find('input').focus();
- if (search) cy.dataCy('vn-searchbar').find('input').type(search);
+ if (search) cy.typeSearchbar().type(search);
cy.dataCy('vn-searchbar').find('input').type('{enter}');
cy.dataCy('ticketListTable').should('exist');
cy.get(firstRow).should('exist');
@@ -27,7 +27,7 @@ describe('TicketList', () => {
cy.window().then((win) => {
cy.stub(win, 'open').as('windowOpen');
});
- cy.get(firstRow).find('.q-btn:first').click();
+ cy.get(firstRow).should('be.visible').find('.q-btn:first').click();
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
});
@@ -38,6 +38,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('Client list create new client', () => {
cy.dataCy('vnTableCreateBtn').should('exist');
cy.dataCy('vnTableCreateBtn').click();