Change input enter event handler to use DOM

This commit is contained in:
benguozakinci@gmail.com
2021-08-27 15:33:11 +03:00
parent 714fd00971
commit 5633689c17
3 changed files with 10 additions and 4 deletions

View File

@ -97,13 +97,20 @@ const app = new Vue({
methods: {
onRefFocus(ref, index) {
this.disableFormSubmission();
ref
? ref === 'price'
? setPromiseTimeout(100).then(() => this.$refs[ref][0].$children[0].$el.focus())
? setPromiseTimeout(100).then(() => this.$refs[ref][index].$children[0].$el.focus())
: setPromiseTimeout(100).then(() => this.$refs[ref][index].focus())
: {}
},
disableFormSubmission() {
const saveButtonEl = document.getElementsByClassName("btn btn-icon btn-success")[0];
saveButtonEl.setAttribute("type", "button");
},
onCalculateTotal() {
let global_discount = parseFloat(this.form.discount);
let discount_total = 0;
@ -316,7 +323,7 @@ const app = new Vue({
let inputRef = `${itemType === 'newItem' ? 'name' : 'description'}`; // indication for which input to focus first
let total = 1 * item.price;
let item_taxes = [];
this.onRefFocus(inputRef, index); // trigger initial focus event on input
if (item.tax_ids) {