IW4M-Admin/WebfrontCore/wwwroot/js/configuration.js

28 lines
1.1 KiB
JavaScript
Raw Normal View History

$(document).ready(function() {
$.each($('.has-related-content'), function (key, value) {
value = $(value);
if (value.attr('checked') !== undefined && value.attr('checked').length > 0) {
$(value.data('related-content')).slideDown();
}
});
$('input:checkbox').change(function () {
var isChecked = $(this).is(':checked');
isChecked ? $($(this).data('related-content')).slideDown() : $($(this).data('related-content')).slideUp();
});
$('.configuration-add-new').click(function (e) {
e.preventDefault();
//let totalItems = $(this).siblings().length;
//let inputHtml = $(this).siblings().last().get(0).outerHTML;
//inputHtml = inputHtml.replace('_' + totalItems - 1 + '_', '_' + totalItems + '_');
//inputHtml = inputHtml.replace('[' + totalItems - 1 + ']', '[' + totalItems + ']');
//$(this).parent().prepend(inputHtml);
let parentElement = $(this).parent();
$.get($(this).attr('href') + '&itemCount=' + $(this).siblings().length, function (response) {
parentElement.prepend(response);
});
});
});