Subversion Repositories SmartDukaan

Rev

Rev 26014 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
26014 amit.gupta 1
$(document).on('click', 'a.category-level', function(){
2
	$(this).closest('tbody').find('td').removeClass('highlight');
31905 amit.gupta 3
	let category = $(this).data("category");
4
	let level = $(this).data("level");
5
	doGetAjaxRequestHandler(context + "/admin/resources?ticketCategoryId=" + category + "&escalationType=" + level, function (response) {
26014 amit.gupta 6
		response = JSON.parse(response);
31905 amit.gupta 7
		$("#access-resource").find(":input").each(function (index, element) {
26014 amit.gupta 8
			console.log($(element).data("menuid"));
31905 amit.gupta 9
			element.checked = response.indexOf($(element).data("menuid")) > -1;
26014 amit.gupta 10
		});
11
	});
12
	$("#access-resource th").html("Resources for " + $(this).html());
13
	$(this).closest('td').addClass('highlight');
14
});
15
$(document).on('change', '#access-resource :checkbox', function(){
16
	var menuId = $(this).data("menuid");
17
	if($("#ticket-category td.highlight").length == 0) {
18
		bootbox.alert("Please choose Category!");
19
		return false;
20
	}
21
	var highlightedAnchor = $("#ticket-category td.highlight").find('a');
22
	var category = highlightedAnchor.data("category");
23
	var level = highlightedAnchor.data("level");
24
	doGetAjaxRequestHandler(context + "/admin/toggleResourcePermission?ticketCategoryId="+category+"&escalationType="+level+"&menuId=" + menuId, function(response) {
25
	});
26
});