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: {
|
methods: {
|
||||||
onRefFocus(ref, index) {
|
onRefFocus(ref, index) {
|
||||||
|
this.disableFormSubmission();
|
||||||
|
|
||||||
ref
|
ref
|
||||||
? ref === 'price'
|
? 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())
|
: setPromiseTimeout(100).then(() => this.$refs[ref][index].focus())
|
||||||
: {}
|
: {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disableFormSubmission() {
|
||||||
|
const saveButtonEl = document.getElementsByClassName("btn btn-icon btn-success")[0];
|
||||||
|
saveButtonEl.setAttribute("type", "button");
|
||||||
|
},
|
||||||
|
|
||||||
onCalculateTotal() {
|
onCalculateTotal() {
|
||||||
let global_discount = parseFloat(this.form.discount);
|
let global_discount = parseFloat(this.form.discount);
|
||||||
let discount_total = 0;
|
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 inputRef = `${itemType === 'newItem' ? 'name' : 'description'}`; // indication for which input to focus first
|
||||||
let total = 1 * item.price;
|
let total = 1 * item.price;
|
||||||
let item_taxes = [];
|
let item_taxes = [];
|
||||||
|
|
||||||
this.onRefFocus(inputRef, index); // trigger initial focus event on input
|
this.onRefFocus(inputRef, index); // trigger initial focus event on input
|
||||||
|
|
||||||
if (item.tax_ids) {
|
if (item.tax_ids) {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<div class="row save-buttons" @click="onSubmit">
|
<div class="row save-buttons" @click="onSubmit">
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
{!! Form::button(
|
{!! 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>',
|
'<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>
|
</div>
|
||||||
|
|
||||||
@stack('save_buttons_end')
|
@stack('save_buttons_end')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user