close #72 Fixed: Validation for create customer
This commit is contained in:
@@ -2,4 +2,8 @@
|
||||
|
||||
return [
|
||||
'all' => 'All Customers',
|
||||
|
||||
'error' => [
|
||||
'email' => 'The email has already been taken.'
|
||||
]
|
||||
];
|
||||
|
||||
@@ -9,6 +9,7 @@ return [
|
||||
],
|
||||
'error' => [
|
||||
'not_user_company' => 'Error: You are not allowed to manage this company!',
|
||||
'customer' => 'Error: You can not created customer! :name use this email address.',
|
||||
],
|
||||
'warning' => [
|
||||
'deleted' => 'Warning: You are not allowed to delete <b>:name</b> because it has :text related.',
|
||||
|
||||
@@ -77,10 +77,32 @@
|
||||
});
|
||||
|
||||
$('#create_user').on('ifClicked', function (event) {
|
||||
$('input[name="user_id"]').remove();
|
||||
|
||||
if ($(this).prop('checked')) {
|
||||
$('.col-md-6.password').addClass('hidden');
|
||||
} else {
|
||||
$('.col-md-6.password').removeClass('hidden');
|
||||
$.ajax({
|
||||
url: '{{ url("auth/users/autocomplete") }}',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: {column: 'email', value: $('input[name="email"]').val()},
|
||||
beforeSend: function() {
|
||||
$('.box-footer .btn').attr('disabled', true);
|
||||
},
|
||||
complete: function() {
|
||||
$('.box-footer .btn').attr('disabled', false);
|
||||
},
|
||||
success: function(json) {
|
||||
if (json['errors']) {
|
||||
$('.col-md-6.password').removeClass('hidden');
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('input[name="password_confirmation"]').after('<input name="user_id" type="hidden" value="' + json['data']['id'] + '" id="user-id">');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -82,10 +82,32 @@
|
||||
});
|
||||
|
||||
$('#create_user').on('ifClicked', function (event) {
|
||||
$('input[name="user_id"]').remove();
|
||||
|
||||
if ($(this).prop('checked')) {
|
||||
$('.col-md-6.password').addClass('hidden');
|
||||
} else {
|
||||
$('.col-md-6.password').removeClass('hidden');
|
||||
$.ajax({
|
||||
url: '{{ url("auth/users/autocomplete") }}',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: {column: 'email', value: $('input[name="email"]').val()},
|
||||
beforeSend: function() {
|
||||
$('.box-footer .btn').attr('disabled', true);
|
||||
},
|
||||
complete: function() {
|
||||
$('.box-footer .btn').attr('disabled', false);
|
||||
},
|
||||
success: function(json) {
|
||||
if (json['errors']) {
|
||||
$('.col-md-6.password').removeClass('hidden');
|
||||
}
|
||||
|
||||
if (json['success']) {
|
||||
$('input[name="password_confirmation"]').after('<input name="user_id" type="hidden" value="' + json['data']['id'] + '" id="user-id">');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user