This commit is contained in:
gerard 2018-07-02 13:18:22 +02:00
parent 48e44bd610
commit a9b095a3bd
1 changed files with 19 additions and 25 deletions

View File

@ -15,11 +15,19 @@ class Controller extends FilterTicketList {
this.deletable = false;
this.edit = {};
this.moreOptions = [
{callback: this.showAddTurnDialog, name: "Add turn"},
{callback: this.showDeleteTicketDialog, name: "Delete ticket"}
{callback: this.showAddTurnDialog, name: "Add turn", always: true},
{callback: this.showDeleteTicketDialog, name: "Delete ticket", always: true},
{callback: this.markAsReserved, name: 'Mark as reserved'},
{callback: this.unmarkAsReserved, name: 'Unmark as reserved'},
{callback: this.showEditDialog, name: 'Update discount'}
];
}
onMoreOpen() {
let options = this.moreOptions.filter(o => o.always || this.isChecked);
this.$.moreButton.data = options;
}
getTaxes() {
this.getSubTotal();
this.getVAT();
@ -68,7 +76,7 @@ class Controller extends FilterTicketList {
for (let i = 0; i < data.length; i++)
if (data[i].checked)
lines.push({id: data[i].id, instance: i});
console.log(this.$.index.model.instances);
return lines;
}
@ -132,11 +140,18 @@ class Controller extends FilterTicketList {
});
}
removeInstances(instances) {
for (let i = instances.length - 1; i >= 0; i--) {
this.$.index.model.instances.splice(instances[i].instance, 1);
}
}
// Move Lines
showTransferPopover(event) {
let filter = {clientFk: this.ticket.clientFk, ticketFk: this.ticket.id};
let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`/ticket/api/Tickets/threeLastActive?filter=${json}`).then(res => {
let query = `/ticket/api/Tickets/threeLastActive?filter=${json}`;
this.$http.get(query).then(res => {
this.lastThreeTickets = res.data;
});
this.$.transfer.parent = event.target;
@ -173,11 +188,6 @@ class Controller extends FilterTicketList {
this.$state.go("ticket.card.sale", {id: ticketID});
}
removeInstances(instances) {
for (let i = instances.length - 1; i >= 0; i--) {
this.$.index.model.instances.splice(instances[i].instance, 1);
}
}
// Slesperson Mana
getManaSalespersonMana() {
this.$http.get(`/api/Tickets/${this.$state.params.id}/getSalesPersonMana`).then(res => {
@ -278,22 +288,6 @@ class Controller extends FilterTicketList {
this.removeOptionByName('Mark as reserved');
this.removeOptionByName('Unmark as reserved');
this.removeOptionByName('Update discount');
if (!this.isChecked) return;
this.moreOptions.push({
callback: this.markAsReserved,
name: 'Mark as reserved'}
);
this.moreOptions.push({
callback: this.unmarkAsReserved,
name: 'Unmark as reserved'}
);
this.moreOptions.push({
callback: this.showEditDialog,
name: 'Update discount'}
);
}
/**