115 lines
3.2 KiB
JavaScript
Raw Normal View History

2019-11-16 10:21:14 +03:00
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
2021-06-30 15:01:17 +03:00
require('./../../bootstrap');
import Vue from 'vue';
import DashboardPlugin from './../../plugins/dashboard-plugin';
import Global from './../../mixins/global';
import Form from './../../plugins/form';
import BulkAction from './../../plugins/bulk-action';
2022-06-01 10:15:55 +03:00
import Swiper, { Navigation, Pagination } from 'swiper';
Swiper.use([Navigation, Pagination]);
2021-06-30 15:01:17 +03:00
// plugin setup
Vue.use(DashboardPlugin);
const app = new Vue({
el: '#main-body',
mixins: [
Global
],
data: function () {
return {
2022-06-01 10:15:55 +03:00
form: new Form('contact'),
bulk_action: new BulkAction('contacts'),
2021-06-30 15:01:17 +03:00
can_login : false
}
},
mounted() {
this.form.create_user = false;
},
methods:{
onCanLogin(event) {
if (event.target.checked) {
if (this.form.email) {
axios.get(url + '/auth/users/autocomplete', {
params: {
column: 'email',
value : this.form.email
}
})
.then(response => {
if (response.data.errors) {
if (response.data.data) {
this.form.errors.set('email', {
0: response.data.data
});
return false;
}
this.can_login = true;
this.form.create_user = true;
return true;
}
2021-10-31 20:07:44 +03:00
if (response.data.error) {
this.$notify({
message: response.data.message,
timeout: 0,
icon: 'fas fa-bell',
type: 'warning',
});
return false;
}
2021-06-30 15:01:17 +03:00
if (response.data.success) {
this.form.errors.set('email', {
0: can_login_errors.email
});
this.can_login = false;
this.form.create_user = false;
return false;
}
})
.catch(error => {
});
} else {
this.form.errors.set('email', {
0: can_login_errors.valid
});
this.can_login = false;
this.form.create_user = false;
return false;
}
return false;
} else {
this.form.errors.clear('email');
this.can_login = false;
this.form.create_user = false;
return false;
}
}
}
});