Focus on name input area is active when a new item is created
This commit is contained in:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								resources/assets/js/plugins/functions.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								resources/assets/js/plugins/functions.js
									
									
									
									
										vendored
									
									
								
							@@ -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}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user