feat(invoiceOut): add refund option
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
4ffb61b75c
commit
2b9c656d21
|
@ -97,7 +97,7 @@
|
|||
</vn-confirm>
|
||||
<vn-confirm
|
||||
vn-id="refundConfirmation"
|
||||
on-accept="$ctrl.bookInvoiceOut()"
|
||||
on-accept="$ctrl.refundInvoiceOut()"
|
||||
question="Are you sure you want to refund this invoice?">
|
||||
</vn-confirm>
|
||||
<vn-client-descriptor-popover
|
||||
|
|
|
@ -116,6 +116,37 @@ class Controller extends Section {
|
|||
invoiceId: this.id
|
||||
});
|
||||
}
|
||||
|
||||
async refundInvoiceOut() {
|
||||
let filter = {
|
||||
where: {refFk: this.invoiceOut.ref}
|
||||
};
|
||||
await this.$http.get('Tickets', {filter})
|
||||
.then(res => {
|
||||
this.tickets = res.data;
|
||||
this.ticketsIds = [];
|
||||
for (let ticket of this.tickets)
|
||||
this.ticketsIds.push(ticket.id);
|
||||
});
|
||||
|
||||
filter = {
|
||||
where: {ticketFk: {inq: this.ticketsIds}}
|
||||
};
|
||||
await this.$http.get('Sales', {filter})
|
||||
.then(res => this.sales = res.data);
|
||||
|
||||
await 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});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail'];
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
</append>
|
||||
</vn-autocomplete>
|
||||
<vn-input-number
|
||||
vn-one min="0"
|
||||
vn-one
|
||||
step="1"
|
||||
label="Quantity"
|
||||
ng-model="service.quantity"
|
||||
|
|
Loading…
Reference in New Issue