Change input enter event handler to use DOM
This commit is contained in:
parent
714fd00971
commit
5633689c17
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) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-footer">
|
||||
<div class="row save-buttons" @click="onSubmit">
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
{!! Form::button(
|
||||
'<span v-if="form.loading" class="btn-inner--icon"><i class="aka-loader"></i></span> <span :class="[{\'ml-0\': form.loading}]" class="btn-inner--text">' . trans('general.save') . '</span>',
|
||||
[':disabled' => 'form.loading', 'class' => 'btn btn-icon btn-success']) !!}
|
||||
[':disabled' => 'form.loading', 'type' => 'submit', 'class' => 'btn btn-icon btn-success']) !!}
|
||||
</div>
|
||||
|
||||
@stack('save_buttons_end')
|
||||
|
Loading…
x
Reference in New Issue
Block a user