fix: reset rows selected

This commit is contained in:
Javier Segarra 2025-03-12 08:56:43 +01:00
parent bf41ab168d
commit 44198ae7a7
2 changed files with 8 additions and 5 deletions

View File

@ -186,6 +186,7 @@ const getRowUpdateInputEvents = (sale) => ({
const resetChanges = async () => { const resetChanges = async () => {
arrayData.fetch({ append: false }); arrayData.fetch({ append: false });
tableRef.value.reload(); tableRef.value.reload();
selectedRows.value = [];
}; };
const changeQuantity = async (sale) => { const changeQuantity = async (sale) => {
if (!sale.itemFk || sale.quantity == null || sale?.originalQuantity === sale.quantity) if (!sale.itemFk || sale.quantity == null || sale?.originalQuantity === sale.quantity)
@ -195,6 +196,7 @@ const changeQuantity = async (sale) => {
if (await isSalePrepared(sale)) { if (await isSalePrepared(sale)) {
await confirmUpdate(() => updateQuantity(sale)); await confirmUpdate(() => updateQuantity(sale));
} else await updateQuantity(sale); } else await updateQuantity(sale);
resetChanges();
}; };
const updateQuantity = async (sale) => { const updateQuantity = async (sale) => {
@ -203,7 +205,6 @@ const updateQuantity = async (sale) => {
sale.isNew = false; sale.isNew = false;
await axios.post(`Sales/${id}/updateQuantity`, { quantity }); await axios.post(`Sales/${id}/updateQuantity`, { quantity });
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
resetChanges();
} catch (e) { } catch (e) {
const { quantity } = tableRef.value.CrudModelRef.originalData.find( const { quantity } = tableRef.value.CrudModelRef.originalData.find(
(s) => s.id === sale.id, (s) => s.id === sale.id,
@ -235,7 +236,7 @@ const addSale = async (sale) => {
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
sale.isNew = false; sale.isNew = false;
arrayData.fetch({}); resetChanges();
}; };
const changeConcept = async (sale) => { const changeConcept = async (sale) => {
if (await isSalePrepared(sale)) { if (await isSalePrepared(sale)) {
@ -473,7 +474,7 @@ const endNewRow = (row) => {
}; };
async function confirmUpdate(cb) { async function confirmUpdate(cb) {
await quasar quasar
.dialog({ .dialog({
component: VnConfirm, component: VnConfirm,
componentProps: { componentProps: {

View File

@ -1,7 +1,7 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('TicketSale', () => { describe('TicketSale', () => {
describe.skip('Free ticket #31', () => { describe('Free ticket #31', () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
@ -44,6 +44,7 @@ describe('TicketSale', () => {
cy.dataCy('recalculatePriceItem').click(); cy.dataCy('recalculatePriceItem').click();
cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200); cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200);
cy.checkNotification('Data saved'); cy.checkNotification('Data saved');
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
}); });
it('should update discount when "Update discount" is clicked', () => { it('should update discount when "Update discount" is clicked', () => {
@ -58,6 +59,7 @@ describe('TicketSale', () => {
cy.dataCy('saveManaBtn').click(); cy.dataCy('saveManaBtn').click();
cy.waitForElement('.q-notification__message'); cy.waitForElement('.q-notification__message');
cy.checkNotification('Data saved'); cy.checkNotification('Data saved');
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
}); });
it('adds claim', () => { it('adds claim', () => {
@ -120,7 +122,7 @@ describe('TicketSale', () => {
cy.url().should('match', /\/ticket\/31\/log/); cy.url().should('match', /\/ticket\/31\/log/);
}); });
}); });
describe.skip('Ticket prepared #23', () => { describe('Ticket prepared #23', () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.viewport(1920, 1080); cy.viewport(1920, 1080);