0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.191.171.72


Current Path : /var/www/html/sdu/js/
Upload File :
Current File : /var/www/html/sdu/js/sectionwisepermission.js

 var $g_user_subjIdentfy_details='';
 
function callsectionwisepermission()
 {
	$("#page_main_div").load('html_modules/sectionwisepermission.html?v=1',function()
	{
		window.location.g_FeePopUpExamNo='';
		document.getElementById('display_module_name').innerHTML = 'Section Wise Permission';
		document.getElementById('module_name_for_save').value = 'Section Wise Permission';
	
		getDefaultHeadFooterLinks("Section Wise Permission");

		$.ajax({
			type: "POST",
			url: $host_url+"getUserRightsDetails.demo",      
			success: populateUserSubjDetailsResponse
		}); 
	});
}

function getsection()
{
	var degree = $("#user_subj_degree_code").val();
	if(degree != '')
	{	
		$.ajax({
			type: "POST",
			data:"degree="+degree,
			url: $host_url+"getsection",      
			success: getsectionResponse
		}); 
	}
}

function getsectionResponse($responce)
{
	$responce = eval('(' + $responce + ')'); 
	
	if($responce.error_code==0)	
	{	
		document.getElementById('section').options.length = 0;

		$op = new Option('Select Section', '');
		$op.id='0';
		document.getElementById('section').options.add($op);

		for($i=0;$i < $responce.data['section'].length;$i++)                                  
		{            
	    	$op = new Option($responce.data['section'][$i]['value'], $responce.data['section'][$i]['value']);
			$op.id=$responce.data['section'][$i]['value'];
			document.getElementById('section').options.add($op);
		}
	}
}

function populateUserSubjDetailsResponse($responce)
{
  $responce = eval('(' + $responce + ')'); 
 
   document.getElementById('user_rights_user').options.length = 0;
  
		$op = new Option('Select One', '0');
		$op.id='0';
		document.getElementById('user_rights_user').options.add($op);
		
		
		 
	 for($i=0;$i < $responce.data['user_rights_user'].length;$i++)                                  
		{            
	    	$op = new Option($responce.data['user_rights_user'][$i]['value'], $responce.data['user_rights_user'][$i]['internal_code']);
			$op.id=$responce.data['user_rights_user'][$i]['internal_code'];//specifying the id  for options
			document.getElementById('user_rights_user').options.add($op);
		}
	
		 document.getElementById('user_subject_table_data_div').innerHTML='';
		 //getUserRightModuleNames(0,'');
		 
}

function ClearUserSubjIdentify()
{
	$("#user_rights_user").val('');		
	$("#user_subj_degree_code").val('');	
	$("#user_subj_degree_name").val('');	
	$("#user_subject_table_data_div").html("");	
	document.getElementById('user_rights_user').disabled=false;
	document.getElementById('user_subj_degree_code').disabled=false;
	document.getElementById('user_rights_user').focus();
}

function PopulateUserSectionList()
{
	var userType = $("#user_rights_user").val();
	
	if(empty(userType))
	{
		alert("Select User");
		return;
	}
	
	$.ajax({
		type: "POST",
		data:"userType="+userType,
		url: $host_url+"PopulateUserSectionList",
		success: PopulateUserSectionListResponce
	});
}

function PopulateUserSectionListResponce($responce)
{
	$responce = eval('('+$responce+')');
	if($responce.error_code==0)
	{
		$g_user_subjIdentfy_details = $responce;
		$("#user_subject_table_data_div").html($responce.data['html_data']);
		document.getElementById('user_rights_user').disabled=true;
	}
	

}

function filter_subjects() {
	var subject = document.getElementById("filter_sub");
	var table = document.getElementById("user_rights_table_data");
	var filter = subject.value.toUpperCase();
	var tr = table.getElementsByTagName('tr');
	var i = 0;
	for (i=0; i<tr.length;i++){
		td = tr[i].getElementsByTagName('td')[1];
		if(td){
			if(td.innerHTML.toUpperCase().indexOf(filter)>-1){
				tr[i].style.display = "";
			}else{
				tr[i].style.display = "none";
			}
		}
	}
}

function selectAllUserSectiont()
{
	if(document.getElementById('check_Allrow').checked==true)
	{
		for($i=0;$i<$g_user_subjIdentfy_details.data['module_id_details'].length;$i++)
		{
			document.getElementById('check_row_'+$i).checked=true;		
		}
	}
	else
	{
	 	for($i=0;$i<$g_user_subjIdentfy_details.data['module_id_details'].length;$i++)
		{
			document.getElementById('check_row_'+$i).checked=false;				
		}
	} 
}


function SaveUserSectiont()
{
	var userType = $("#user_rights_user").val();
	
	var subjSelected ='';
	for($i=0;$i<$g_user_subjIdentfy_details.data['module_id_details'].length;$i++)
	{
		if(document.getElementById('check_row_'+$i).checked==true)
		{
			subjSelected+= document.getElementById('check_row_'+$i).value+"*";
		}
	}

	if(subjSelected == '')
	{
		alert('Please Select One Section');
		return;
	}	

	$.ajax({
		type: "POST",
		data:"userType="+userType+"&subjSelected="+subjSelected,
		url: $host_url+"saveUserSectionList",
		success: saveUserSectionListResponce
		});
	

}


function saveUserSectionListResponce($responce)
{
	$responce = eval('('+$responce+')');
	alert($responce.data);
	
}