function show_ModalMyContent(content){
$('#modContent').html(content);
$('#modFrm').modal();
}
function show_Modal(title, content, type_class){
var cnt='
' +
''+content+'
' +
'';
show_ModalMyContent(cnt);
}
function showErr(errContent) {show_Modal('Ошибка', errContent, 'warning');}
function showSuccess(errContent) {show_Modal('Успешно', errContent, 'success');}
function showPrimary(errContent) {show_Modal('Внимание!', errContent, 'primary');}
$(document).ajaxError(function (ev, jqXHR, ajaxSettings, thrownError) {
//loaderShow(false);
showErr(jqXHR.status + ': ' + jqXHR.statusText);
});
$(document).ready(function () {
// Validate inputs of form
$('input.form-control[pattern]').keyup(function () {
var pr = $(this).closest('.form-group-sm,.form-group');
pr.removeClass('has-success');
pr.removeClass('has-error');
pr.find('.form-control-feedback').remove();
if ($(this)[0].checkValidity()) {
pr.addClass('has-success');
$(this).after('');
} else {
pr.addClass('has-error');
$(this).after('');
}
});
// autosave checkbox
$('input[type=checkbox].autosave').on('click', function(){
var data_url = $(this).attr('data-url');
$.getJSON(data_url, {checked: this.checked});
});
$('.btn-modal').on('click', function(){
$.get(this.href, function(r){
show_ModalMyContent(r);
});
return false;
});
});