Change input enter event handler to use DOM
This commit is contained in:
11
resources/assets/js/views/common/documents.js
vendored
11
resources/assets/js/views/common/documents.js
vendored
@ -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) {
|
||||
|
Reference in New Issue
Block a user