Subversion Repositories SmartDukaan

Rev

Rev 31905 | Go to most recent revision | Details | 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');
3
	category = $(this).data("category");
4
	level = $(this).data("level");
5
	doGetAjaxRequestHandler(context + "/admin/resources?ticketCategoryId="+category+"&escalationType="+level, function(response) {
6
		response = JSON.parse(response);
7
		$("#access-resource").find(":input").each(function(index, element){
8
			console.log($(element).data("menuid"));
9
			element.checked=response.indexOf($(element).data("menuid")) > -1;
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
});