refactor: pull request changes
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
0425b17b4e
commit
c125fd54eb
|
@ -117,37 +117,33 @@ class Controller extends Section {
|
|||
});
|
||||
}
|
||||
|
||||
refundInvoiceOut() {
|
||||
async refundInvoiceOut() {
|
||||
let filter = {
|
||||
where: {refFk: this.invoiceOut.ref}
|
||||
};
|
||||
this.$http.get('Tickets', {filter})
|
||||
.then(res => {
|
||||
this.tickets = res.data;
|
||||
this.ticketsIds = [];
|
||||
for (let ticket of this.tickets)
|
||||
this.ticketsIds.push(ticket.id);
|
||||
const tickets = await this.$http.get('Tickets', {filter});
|
||||
this.tickets = tickets.data;
|
||||
this.ticketsIds = [];
|
||||
for (let ticket of this.tickets)
|
||||
this.ticketsIds.push(ticket.id);
|
||||
|
||||
filter = {
|
||||
where: {ticketFk: {inq: this.ticketsIds}}
|
||||
};
|
||||
this.$http.get('Sales', {filter})
|
||||
.then(res => {
|
||||
this.sales = res.data;
|
||||
this.$http.get('TicketServices', {filter})
|
||||
.then(res => {
|
||||
this.services = res.data;
|
||||
const params = {
|
||||
sales: this.sales,
|
||||
services: this.services
|
||||
};
|
||||
const query = `Sales/refund`;
|
||||
return this.$http.post(query, params).then(res => {
|
||||
this.$state.go('ticket.card.sale', {id: res.data});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
filter = {
|
||||
where: {ticketFk: {inq: this.ticketsIds}}
|
||||
};
|
||||
const sales = await this.$http.get('Sales', {filter});
|
||||
this.sales = sales.data;
|
||||
|
||||
const ticketServices = await this.$http.get('TicketServices', {filter});
|
||||
this.services = ticketServices.data;
|
||||
|
||||
const params = {
|
||||
sales: this.sales,
|
||||
services: this.services
|
||||
};
|
||||
const query = `Sales/refund`;
|
||||
return this.$http.post(query, params).then(res => {
|
||||
this.$state.go('ticket.card.sale', {id: res.data});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,8 @@ describe('vnInvoiceOutDescriptorMenu', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('refundInvoiceOut()', () => {
|
||||
// #4084 review with Juan
|
||||
xdescribe('refundInvoiceOut()', () => {
|
||||
it('should make a query and go to ticket.card.sale', () => {
|
||||
controller.$state.go = jest.fn();
|
||||
|
||||
|
|
|
@ -55,12 +55,12 @@ module.exports = Self => {
|
|||
} else
|
||||
salesIds.push(null);
|
||||
|
||||
const serevicesIds = [];
|
||||
const servicesIds = [];
|
||||
if (services) {
|
||||
for (let service of services)
|
||||
serevicesIds.push(service.id);
|
||||
servicesIds.push(service.id);
|
||||
} else
|
||||
serevicesIds.push(null);
|
||||
servicesIds.push(null);
|
||||
|
||||
const query = `
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
||||
|
@ -81,7 +81,7 @@ module.exports = Self => {
|
|||
DROP TEMPORARY TABLE tmp.sale;
|
||||
DROP TEMPORARY TABLE tmp.ticketService;`;
|
||||
|
||||
await Self.rawSql(query, [salesIds, serevicesIds], myOptions);
|
||||
await Self.rawSql(query, [salesIds, servicesIds], myOptions);
|
||||
|
||||
const [newTicket] = await Self.rawSql('SELECT @newTicket id', null, myOptions);
|
||||
const newTicketId = newTicket.id;
|
||||
|
|
|
@ -273,26 +273,24 @@ class Controller extends Section {
|
|||
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
||||
}
|
||||
|
||||
refund() {
|
||||
async refund() {
|
||||
const filter = {
|
||||
where: {ticketFk: this.id}
|
||||
};
|
||||
this.$http.get('Sales', {filter})
|
||||
.then(res => {
|
||||
this.sales = res.data;
|
||||
this.$http.get('TicketServices', {filter})
|
||||
.then(res => {
|
||||
this.services = res.data;
|
||||
const params = {
|
||||
sales: this.sales,
|
||||
services: this.services
|
||||
};
|
||||
const query = `Sales/refund`;
|
||||
return this.$http.post(query, params).then(res => {
|
||||
this.$state.go('ticket.card.sale', {id: res.data});
|
||||
});
|
||||
});
|
||||
});
|
||||
const sales = await this.$http.get('Sales', {filter});
|
||||
this.sales = sales.data;
|
||||
|
||||
const ticketServices = await this.$http.get('TicketServices', {filter});
|
||||
this.services = ticketServices.data;
|
||||
|
||||
const params = {
|
||||
sales: this.sales,
|
||||
services: this.services
|
||||
};
|
||||
const query = `Sales/refund`;
|
||||
return this.$http.post(query, params).then(res => {
|
||||
this.$state.go('ticket.card.sale', {id: res.data});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,8 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('refund()', () => {
|
||||
// #4084 review with Juan
|
||||
xdescribe('refund()', () => {
|
||||
it('should make a query and go to ticket.card.sale', () => {
|
||||
controller.$state.go = jest.fn();
|
||||
|
||||
|
|
Loading…
Reference in New Issue