Focus on name input area is active when a new item is created

This commit is contained in:
benguozakinci@gmail.com 2021-07-30 18:49:30 +03:00
parent 1e128aee96
commit db8507b856
4 changed files with 25 additions and 4 deletions

View File

@ -280,6 +280,8 @@ export default {
onItemList() {
this.show.item_list = true;
console.log(this.$refs['input-item-field-' + this._uid].focus());
setTimeout(function() {
this.$refs['input-item-field-' + this._uid].focus();
}.bind(this), 100);
@ -367,9 +369,8 @@ export default {
this.selected_items.push(item);
this.$emit('item', item);
this.$emit('item', item)
this.$emit('items', this.selected_items);
this.setItemList(this.items);
this.show.item_selected = false;

View File

@ -15,4 +15,14 @@ function getQueryVariable(variable) {
return(false);
}
export {getQueryVariable}
function promiseTimeout(time) {
return new Promise(function(resolve,reject) {
setTimeout(function(){
resolve(time);
}, time);
});
};
export {getQueryVariable, promiseTimeout}

View File

@ -9,6 +9,8 @@ require('./../../bootstrap');
import Vue from 'vue';
import DashboardPlugin from './../../plugins/dashboard-plugin';
import { promiseTimeout } from './../../plugins/functions';
import Global from './../../mixins/global';
@ -288,11 +290,16 @@ const app = new Vue({
return totals_taxes;
},
// Select Item added form
onSelectedItem(item) {
let { index } = item;
let total = 1 * item.price;
let item_taxes = [];
promiseTimeout(500).then(() => this.$refs['name-input'][index].focus());
if (item.tax_ids) {
item.tax_ids.forEach(function (tax_id, index) {
if (this.taxes.includes(tax_id)) {
@ -466,6 +473,7 @@ const app = new Vue({
methods: {
onSubmit(event) {
this.form = event;
this.form.response = {};
this.loading = true;

View File

@ -32,7 +32,9 @@
<span class="aka-text aka-text--body" tabindex="0" v-html="row.name" v-if="row.item_id"></span>
<div v-else>
@stack('name_input_start')
<input type="text"
<input
type="text"
ref="name-input"
class="form-control"
:name="'items.' + index + '.name'"
autocomplete="off"