fixed bug were VAT was not disponible and refactor of popover
This commit is contained in:
parent
bd2ad7fa54
commit
88633f3741
|
@ -75,15 +75,6 @@ export default class Popover extends Component {
|
||||||
|
|
||||||
this.document.addEventListener('keydown', this.docKeyDownHandler);
|
this.document.addEventListener('keydown', this.docKeyDownHandler);
|
||||||
this.document.addEventListener('focusin', this.docFocusInHandler);
|
this.document.addEventListener('focusin', this.docFocusInHandler);
|
||||||
let firstFocusable = this.element.querySelector('input, textarea');
|
|
||||||
if (firstFocusable) {
|
|
||||||
firstFocusable.addEventListener('focus', () => {
|
|
||||||
firstFocusable.select();
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
firstFocusable.focus();
|
|
||||||
}, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.deregisterCallback = this.$transitions.onStart({}, () => this.hide());
|
this.deregisterCallback = this.$transitions.onStart({}, () => this.hide());
|
||||||
this.relocate();
|
this.relocate();
|
||||||
|
|
|
@ -51,10 +51,8 @@ class Controller {
|
||||||
|
|
||||||
getVAT() {
|
getVAT() {
|
||||||
this.$http.get(`/ticket/api/Tickets/${this.ticket.id}/getVAT`).then(res => {
|
this.$http.get(`/ticket/api/Tickets/${this.ticket.id}/getVAT`).then(res => {
|
||||||
if (res.data) {
|
this.VAT = res.data || 0;
|
||||||
this.VAT = res.data;
|
this.total = this.subTotal + this.VAT;
|
||||||
this.total = this.subTotal + this.VAT;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,6 +203,19 @@ class Controller {
|
||||||
this.$state.go("ticket.card.sale", {id: ticketID});
|
this.$state.go("ticket.card.sale", {id: ticketID});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Focus First Input
|
||||||
|
focusFirstInput(e) {
|
||||||
|
let firstFocusable = e.querySelector('input, textarea');
|
||||||
|
if (firstFocusable) {
|
||||||
|
firstFocusable.addEventListener('focus', () => {
|
||||||
|
firstFocusable.select();
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
firstFocusable.focus();
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Slesperson Mana
|
// Slesperson Mana
|
||||||
getManaSalespersonMana() {
|
getManaSalespersonMana() {
|
||||||
this.$http.get(`/api/Tickets/${this.$state.params.id}/getSalesPersonMana`).then(res => {
|
this.$http.get(`/api/Tickets/${this.$state.params.id}/getSalesPersonMana`).then(res => {
|
||||||
|
@ -233,6 +244,7 @@ class Controller {
|
||||||
};
|
};
|
||||||
this.$.editPricePopover.parent = event.target;
|
this.$.editPricePopover.parent = event.target;
|
||||||
this.$.editPricePopover.show();
|
this.$.editPricePopover.show();
|
||||||
|
this.focusFirstInput(this.$.editPricePopover.$element[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePrice() {
|
updatePrice() {
|
||||||
|
@ -256,11 +268,13 @@ class Controller {
|
||||||
}];
|
}];
|
||||||
this.$.editPopover.parent = event.target;
|
this.$.editPopover.parent = event.target;
|
||||||
this.$.editPopover.show();
|
this.$.editPopover.show();
|
||||||
|
this.focusFirstInput(this.$.editPopover.$element[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async showEditDialog() {
|
showEditDialog() {
|
||||||
this.edit = this.getCheckedLines();
|
this.edit = this.getCheckedLines();
|
||||||
this.$.editDialog.show();
|
this.$.editDialog.show();
|
||||||
|
this.focusFirstInput(this.$.editDialog.$element[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
hideEditDialog() {
|
hideEditDialog() {
|
||||||
|
@ -282,27 +296,6 @@ class Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* updateLine() {
|
|
||||||
if (this.edit.quantity != this.sale.quantity) {
|
|
||||||
this.$http.post(`/ticket/api/Sales/updateQuantity`, {id: this.edit.id, quantity: this.edit.quantity}).then(() => {
|
|
||||||
this.sale.quantity = this.edit.quantity;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.edit.price != this.sale.price) {
|
|
||||||
this.$http.post(`/ticket/api/Sales/updatePrice`, {id: this.edit.id, price: this.edit.price}).then(() => {
|
|
||||||
this.sale.price = this.edit.price;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.edit.discount != this.sale.discount) {
|
|
||||||
this.$http.post(`/ticket/api/Sales/updateDiscount`, {id: this.edit.id, discount: this.edit.discount}).then(() => {
|
|
||||||
this.sale.discount = this.edit.discount;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.$.edit.hide();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unmark sale as reserved
|
* Unmark sale as reserved
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue