Skip to content

Instantly share code, notes, and snippets.

@BerezhniyDmitro
Created June 20, 2018 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BerezhniyDmitro/a5f9efb61d74b827e139eb6bc0c68e5e to your computer and use it in GitHub Desktop.
Save BerezhniyDmitro/a5f9efb61d74b827e139eb6bc0c68e5e to your computer and use it in GitHub Desktop.
(function() {
$('input[name=client-sort-famemark]').blur(function (e) {
e.stopPropagation();
var self = $(this);
var domainId = self.data('domain-id');
var clientId = self.data('client-id');
var mark = +self.val();
if (mark < +self.attr('min') || mark > +self.attr('max')) {
self.addClass('client-sort-input-error');
return false;
}
self.removeClass('client-sort-input-error');
var nameMark = 'fame-' + domainId;
var postData = {};
postData[nameMark] = mark;
postData.clientId = clientId;
$.post('/admin/clients_sort/saveFameMarkFromClientsSort', postData).done(function(response) {
response = JSON.parse(response);
if (response.success) {
swal({
title: 'Сохранено',
icon: 'success'
});
return false;
}
swal({
title: 'Ошибка!',
text: 'Проверьте корректность вводимой известности',
icon: 'error'
});
return false;
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment