feat(ticket_sale): allow multi-check for recalculatePrice
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2021-11-29 08:30:36 +01:00
parent 452d4557d1
commit 8ea3307230
4 changed files with 18 additions and 7 deletions

View File

@ -556,6 +556,7 @@ export default {
moreMenuReserve: 'vn-item[name="reserve"]', moreMenuReserve: 'vn-item[name="reserve"]',
moreMenuUnmarkReseved: 'vn-item[name="unreserve"]', moreMenuUnmarkReseved: 'vn-item[name="unreserve"]',
moreMenuUpdateDiscount: 'vn-item[name="discount"]', moreMenuUpdateDiscount: 'vn-item[name="discount"]',
moreMenuRecalculatePrice: 'vn-item[name="calculatePrice"]',
moreMenuUpdateDiscountInput: 'vn-input-number[ng-model="$ctrl.edit.discount"] input', moreMenuUpdateDiscountInput: 'vn-input-number[ng-model="$ctrl.edit.discount"] input',
transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text', transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable', transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',

View File

@ -195,6 +195,17 @@ describe('Ticket Edit sale path', () => {
expect(result).toContain('22.50'); expect(result).toContain('22.50');
}); });
it('should recalculate price of sales', async() => {
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
await page.waitToClick(selectors.ticketSales.moreMenu);
await page.waitToClick(selectors.ticketSales.moreMenuRecalculatePrice);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should select the third sale and create a claim of it', async() => { it('should select the third sale and create a claim of it', async() => {
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox); await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
await page.waitToClick(selectors.ticketSales.moreMenu); await page.waitToClick(selectors.ticketSales.moreMenu);

View File

@ -464,7 +464,7 @@
<vn-item translate <vn-item translate
name="calculatePrice" name="calculatePrice"
ng-click="$ctrl.calculateSalePrice()" ng-click="$ctrl.calculateSalePrice()"
ng-if="$ctrl.isEditable && $ctrl.hasOneSaleSelected()"> ng-if="$ctrl.isEditable">
Recalculate price Recalculate price
</vn-item> </vn-item>
<vn-item translate <vn-item translate

View File

@ -450,13 +450,12 @@ class Controller extends Section {
} }
calculateSalePrice() { calculateSalePrice() {
const sale = this.selectedValidSales()[0]; const sales = this.selectedValidSales();
if (!sale) return; sales.forEach(sale => {
const query = `Sales/${sale.id}/recalculatePrice`; this.$http.post(`Sales/${sale.id}/recalculatePrice`);
this.$http.post(query).then(() => { });
this.vnApp.showSuccess(this.$t('Data saved!')); this.vnApp.showSuccess(this.$t('Data saved!'));
this.$.model.refresh(); this.$.model.refresh();
});
} }
itemSearchFunc($search) { itemSearchFunc($search) {