refactor: refs #6802 update TicketFilter and TicketSale components to use departmentFk and adjust API endpoints

This commit is contained in:
Javi Gallego 2025-02-10 13:17:58 +01:00
parent d296db7679
commit 94fa7431a1
5 changed files with 9 additions and 57 deletions

View File

@ -12,7 +12,7 @@ export default {
fields: [
'id',
'name',
'salesPersonFk',
'departmentFk',
'phone',
'mobile',
'email',
@ -29,7 +29,7 @@ export default {
fields: ['id', 'lang'],
},
},
{ relation: 'salesPersonUser' },
{ relation: 'department' },
],
},
},

View File

@ -262,7 +262,7 @@ const getUsesMana = async () => {
};
const getMana = async () => {
const { data } = await axios.get(`Tickets/${route.params.id}/departmentMana`);
const { data } = await axios.get(`Tickets/${route.params.id}/getDepartmentMana`);
mana.value = data;
await getUsesMana();
};

View File

@ -65,8 +65,6 @@ const isClaimable = computed(() => {
}
return false;
});
const hasReserves = computed(() => props.sales.some((sale) => sale.reserved == true));
const sendSms = async (params) => {
await axios.post(`Tickets/${ticket.value.id}/sendSms`, params);
notify(t('SMS sent'), 'positive');
@ -131,13 +129,13 @@ const createClaim = () => {
openConfirmationModal(
t('Claim out of time'),
t('Do you want to continue?'),
onCreateClaimAccepted
onCreateClaimAccepted,
);
else
openConfirmationModal(
t('Do you want to create a claim?'),
false,
onCreateClaimAccepted
onCreateClaimAccepted,
);
};
@ -147,14 +145,6 @@ const onCreateClaimAccepted = async () => {
push({ name: 'ClaimBasicData', params: { id: data.id } });
};
const setReserved = async (reserved) => {
const params = { ticketId: ticket.value.id, sales: props.sales, reserved: reserved };
await axios.post(`Sales/reserve`, params);
props.sales.forEach((sale) => {
sale.reserved = reserved;
});
};
const createRefund = async (withWarehouse) => {
if (!props.ticket) return;
@ -249,18 +239,6 @@ const createRefund = async (withWarehouse) => {
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
</QItemSection>
</QItem>
<QItem
v-if="isTicketEditable && hasReserves"
clickable
v-close-popup
v-ripple
@click="setReserved(false)"
data-cy="unmarkAsReservedItem"
>
<QItemSection>
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
</QItemSection>
</QItem>
<QItem clickable v-ripple data-cy="ticketSaleRefundItem">
<QItemSection>
<QItemLabel>{{ t('Refund') }}</QItemLabel>

View File

@ -12,7 +12,7 @@ describe('Login', () => {
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should(
'have.text',
'Invalid username or password'
'Invalid username or password',
);
});
@ -23,7 +23,7 @@ describe('Login', () => {
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should(
'have.text',
'Invalid username or password'
'Invalid username or password',
);
});
@ -33,7 +33,7 @@ describe('Login', () => {
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should(
'have.text',
'You have successfully logged in'
'You have successfully logged in',
);
cy.url().should('contain', '/dashboard');
});
@ -44,7 +44,7 @@ describe('Login', () => {
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should(
'have.text',
'You have successfully logged in'
'You have successfully logged in',
);
cy.url().should('contain', '/dashboard');
cy.get('#user').click();
@ -61,14 +61,4 @@ describe('Login', () => {
cy.get('button[type="submit"]').click();
cy.url().should('contain', '/dashboard');
});
// ticket creation is not yet implemented, use this test once it is
// it(`should get redirected to ticket creation after login since salesPerson can do it`, () => {
// cy.visit('/#/ticket/create', { failOnStatusCode: false });
// cy.url().should('contain', '/#/login?redirect=/ticket/create');
// cy.get('input[aria-label="Username"]').type('salesPerson');
// cy.get('input[aria-label="Password"]').type('nightmare');
// cy.get('button[type="submit"]').click();
// cy.url().should('contain', '/#/ticket/create');
// })
});

View File

@ -72,22 +72,6 @@ describe('TicketSale', () => {
cy.checkNotification('Data deleted');
});
it('marks row as reserved', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="markAsReservedItem"]');
cy.dataCy('markAsReservedItem').click();
cy.dataCy('ticketSaleReservedIcon').should('exist');
});
it('unmarks row as reserved', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="unmarkAsReservedItem"]');
cy.dataCy('unmarkAsReservedItem').click();
cy.dataCy('ticketSaleReservedIcon').should('not.exist');
});
it('refunds row with warehouse', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();