This commit is contained in:
Cüneyt Şentürk 2021-06-30 15:01:17 +03:00
parent e2f29060a2
commit 72acc3e3ee
2 changed files with 121 additions and 117 deletions

View File

@ -4,31 +4,31 @@
* building robust, powerful web applications using Vue and Laravel. * building robust, powerful web applications using Vue and Laravel.
*/ */
require('./../../bootstrap'); require('./../../bootstrap');
import Vue from 'vue'; import Vue from 'vue';
import DashboardPlugin from './../../plugins/dashboard-plugin'; import DashboardPlugin from './../../plugins/dashboard-plugin';
import Global from './../../mixins/global'; import Global from './../../mixins/global';
import Form from './../../plugins/form'; import Form from './../../plugins/form';
import BulkAction from './../../plugins/bulk-action'; import BulkAction from './../../plugins/bulk-action';
// plugin setup // plugin setup
Vue.use(DashboardPlugin); Vue.use(DashboardPlugin);
const app = new Vue({ const app = new Vue({
el: '#main-body', el: '#main-body',
mixins: [ mixins: [
Global Global
], ],
data: function () { data: function () {
return { return {
form: new Form('vendor'), form: new Form('vendor'),
bulk_action: new BulkAction('vendors') bulk_action: new BulkAction('vendors')
} }
} }
}); });

View File

@ -4,94 +4,98 @@
* building robust, powerful web applications using Vue and Laravel. * building robust, powerful web applications using Vue and Laravel.
*/ */
require('./../../bootstrap'); require('./../../bootstrap');
import Vue from 'vue'; import Vue from 'vue';
import DashboardPlugin from './../../plugins/dashboard-plugin'; import DashboardPlugin from './../../plugins/dashboard-plugin';
import Global from './../../mixins/global'; import Global from './../../mixins/global';
import Form from './../../plugins/form'; import Form from './../../plugins/form';
import BulkAction from './../../plugins/bulk-action'; import BulkAction from './../../plugins/bulk-action';
// plugin setup // plugin setup
Vue.use(DashboardPlugin); Vue.use(DashboardPlugin);
const app = new Vue({ const app = new Vue({
el: '#main-body', el: '#main-body',
mixins: [ mixins: [
Global Global
], ],
data: function () { data: function () {
return { return {
form: new Form('customer'), form: new Form('customer'),
bulk_action: new BulkAction('customers'), bulk_action: new BulkAction('customers'),
can_login : false can_login : false
} }
}, },
mounted() { mounted() {
this.form.create_user = false; this.form.create_user = false;
}, },
methods:{ methods:{
onCanLogin(event) { onCanLogin(event) {
if (event.target.checked) { if (event.target.checked) {
if (this.form.email) { if (this.form.email) {
axios.get(url + '/auth/users/autocomplete', { axios.get(url + '/auth/users/autocomplete', {
params: { params: {
column: 'email', column: 'email',
value : this.form.email value : this.form.email
} }
}) })
.then(response => { .then(response => {
if (response.data.errors) { if (response.data.errors) {
if (response.data.data) { if (response.data.data) {
this.form.errors.set('email', { this.form.errors.set('email', {
0: response.data.data 0: response.data.data
}); });
return false; return false;
} }
this.can_login = true; this.can_login = true;
this.form.create_user = true; this.form.create_user = true;
return true;
} return true;
}
if (response.data.success) {
this.form.errors.set('email', { if (response.data.success) {
0: can_login_errors.email this.form.errors.set('email', {
}); 0: can_login_errors.email
});
this.can_login = false;
this.form.create_user = false; this.can_login = false;
return false; this.form.create_user = false;
}
}) return false;
.catch(error => { }
}); })
} else { .catch(error => {
this.form.errors.set('email', { });
0: can_login_errors.valid } else {
}); this.form.errors.set('email', {
0: can_login_errors.valid
this.can_login = false; });
this.form.create_user = false;
return false; this.can_login = false;
} this.form.create_user = false;
return false; return false;
} else { }
this.form.errors.clear('email');
return false;
this.can_login = false; } else {
this.form.create_user = false; this.form.errors.clear('email');
return false;
} this.can_login = false;
} this.form.create_user = false;
}
}); return false;
}
}
}
});