refactor: refs #6802 update TicketFilter and TicketSale components to use departmentFk and adjust API endpoints
This commit is contained in:
parent
d296db7679
commit
94fa7431a1
|
@ -12,7 +12,7 @@ export default {
|
||||||
fields: [
|
fields: [
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
'salesPersonFk',
|
'departmentFk',
|
||||||
'phone',
|
'phone',
|
||||||
'mobile',
|
'mobile',
|
||||||
'email',
|
'email',
|
||||||
|
@ -29,7 +29,7 @@ export default {
|
||||||
fields: ['id', 'lang'],
|
fields: ['id', 'lang'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ relation: 'salesPersonUser' },
|
{ relation: 'department' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -262,7 +262,7 @@ const getUsesMana = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMana = 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;
|
mana.value = data;
|
||||||
await getUsesMana();
|
await getUsesMana();
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,8 +65,6 @@ const isClaimable = computed(() => {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
const hasReserves = computed(() => props.sales.some((sale) => sale.reserved == true));
|
|
||||||
|
|
||||||
const sendSms = async (params) => {
|
const sendSms = async (params) => {
|
||||||
await axios.post(`Tickets/${ticket.value.id}/sendSms`, params);
|
await axios.post(`Tickets/${ticket.value.id}/sendSms`, params);
|
||||||
notify(t('SMS sent'), 'positive');
|
notify(t('SMS sent'), 'positive');
|
||||||
|
@ -131,13 +129,13 @@ const createClaim = () => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('Claim out of time'),
|
t('Claim out of time'),
|
||||||
t('Do you want to continue?'),
|
t('Do you want to continue?'),
|
||||||
onCreateClaimAccepted
|
onCreateClaimAccepted,
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('Do you want to create a claim?'),
|
t('Do you want to create a claim?'),
|
||||||
false,
|
false,
|
||||||
onCreateClaimAccepted
|
onCreateClaimAccepted,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -147,14 +145,6 @@ const onCreateClaimAccepted = async () => {
|
||||||
push({ name: 'ClaimBasicData', params: { id: data.id } });
|
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) => {
|
const createRefund = async (withWarehouse) => {
|
||||||
if (!props.ticket) return;
|
if (!props.ticket) return;
|
||||||
|
|
||||||
|
@ -249,18 +239,6 @@ const createRefund = async (withWarehouse) => {
|
||||||
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</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">
|
<QItem clickable v-ripple data-cy="ticketSaleRefundItem">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
||||||
|
|
|
@ -12,7 +12,7 @@ describe('Login', () => {
|
||||||
cy.get('button[type="submit"]').click();
|
cy.get('button[type="submit"]').click();
|
||||||
cy.get('.q-notification__message').should(
|
cy.get('.q-notification__message').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
'Invalid username or password'
|
'Invalid username or password',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ describe('Login', () => {
|
||||||
cy.get('button[type="submit"]').click();
|
cy.get('button[type="submit"]').click();
|
||||||
cy.get('.q-notification__message').should(
|
cy.get('.q-notification__message').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
'Invalid username or password'
|
'Invalid username or password',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ describe('Login', () => {
|
||||||
cy.get('button[type="submit"]').click();
|
cy.get('button[type="submit"]').click();
|
||||||
cy.get('.q-notification__message').should(
|
cy.get('.q-notification__message').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
'You have successfully logged in'
|
'You have successfully logged in',
|
||||||
);
|
);
|
||||||
cy.url().should('contain', '/dashboard');
|
cy.url().should('contain', '/dashboard');
|
||||||
});
|
});
|
||||||
|
@ -44,7 +44,7 @@ describe('Login', () => {
|
||||||
cy.get('button[type="submit"]').click();
|
cy.get('button[type="submit"]').click();
|
||||||
cy.get('.q-notification__message').should(
|
cy.get('.q-notification__message').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
'You have successfully logged in'
|
'You have successfully logged in',
|
||||||
);
|
);
|
||||||
cy.url().should('contain', '/dashboard');
|
cy.url().should('contain', '/dashboard');
|
||||||
cy.get('#user').click();
|
cy.get('#user').click();
|
||||||
|
@ -61,14 +61,4 @@ describe('Login', () => {
|
||||||
cy.get('button[type="submit"]').click();
|
cy.get('button[type="submit"]').click();
|
||||||
cy.url().should('contain', '/dashboard');
|
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');
|
|
||||||
// })
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -72,22 +72,6 @@ describe('TicketSale', () => {
|
||||||
cy.checkNotification('Data deleted');
|
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', () => {
|
it('refunds row with warehouse', () => {
|
||||||
selectFirstRow();
|
selectFirstRow();
|
||||||
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
|
Loading…
Reference in New Issue