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 : 3.129.73.6


Current Path : /var/www/html/stph/js/
Upload File :
Current File : /var/www/html/stph/js/module_setup.js

function Loadenablemodulesetup()
{
   
    $geditinternalcode=0;
	window.enable_proper_module="enablemodulesetup";
	$("#page_main_div").load('html_modules/module_setup.html',function()
	{	
	document.getElementById('display_module_name').innerHTML = 'Module Setup';
	document.getElementById('module_name_for_save').value = 'saveModuleSetup'; 			 	
	getDefaultHeadFooterLinks('Module'); 
	display_module_setup_master_grid();		
	}
	);
	$('#module_details_div').hide();		
 }
 
 function clearModuleSetup()
 {
  $geditinternalcode=0;
  $("#m_code").val('');
  $("#m_name").val('');
  $("#module_code").val('');
  $("#module_value").val(''); 
  $("#m_code").focus();
 } 

function display_module_setup_master_grid()
{
$main="<table id='table_module_setup_div' class='scroll' ondblclick='getModuleSetupDetails();'></table> <div id='sub_module_setup_div' class='scroll' style='text-align:center;'></div>";
document.getElementById('main_module_setup_div').innerHTML=$main;
var module_set=jQuery("#table_module_setup_div").jqGrid(
{
url:$host_url+'display_module_setup_grid.demo',
datatype: "json",
colNames:['Code','Name','Module','Value'],
colModel:[
{name:'grid_m_code',index:'grid_m_code', width:10},
{name:'grid_m_name',index:'grid_m_name', width:20},
{name:'grid_module_code',index:'grid_module_code', width:10},
{name:'grid_module_value',index:'grid_module_value', width:60}
],
rowNum:10,
rowList:[5,10,15,20,25,30],
imgpath:$img_path,
pager: jQuery('#sub_module_setup_div'),
sortname: 'id',
height:'250',
width:'750',
viewrecords: true,
cellEdit: true,
sortorder: "desc",
multiselect: false,
caption:"Module Setup Details",
editurl:$host_url+'mdelete_module_setup_grid.demo'
	}).navGrid('#sub_module_setup_div',{edit:false,add:false,del:true,search:true},{},{},{},{multipleSearch:true})
			.navButtonAdd('#sub_module_setup_div',{caption:"Toggle",
			buttonicon :'ui-icon-pin-s', onClickButton:function(){ module_set[0].toggleToolbar() } }).
    navButtonAdd('#sub_module_setup_div',{caption:"Edit", 
    onClickButton:function()
    {
	getModuleSetupDetails();
    }	     
    }); 
module_set.filterToolbar(); 		
  }  
  

function saveModuleSetup()
 {
   if(trim($("#m_code").val())=='')
	{
		alert('Please Enter the Code');
		$("#m_code").focus();
		return;
	    }
    else if(trim($("#m_name").val())=='')
	{
	     alert('Please Enter the Name');
	     $("#m_name").focus();
		 return;
        } 
    else if(trim($("#module_code").val())=='')
	 {   
		 alert('Please Enter the Module Code');
	     $("#module_code").focus();
		 return;
        } 
	else if(trim($("#module_value").val())=='')
	 {  
	    alert('Please Enter the Module Value');
	    $("#module_value").focus();
		 return;
        } 
		
   else
   {	   
	$lstr_query_string="update_id="+$geditinternalcode;
    $lstr_query_string+="&Code="+encodeURIComponent(trim(document.getElementById('m_code').value));
	$lstr_query_string+="&Name="+document.getElementById('m_name').value;
	$lstr_query_string+="&FMODULE="+document.getElementById('module_code').value;
    $lstr_query_string+="&Value="+encodeURIComponent(trim(document.getElementById('module_value').value));
     $.ajax({
       type: "POST",
       url: $host_url+"saveModuleSetup.demo",
       data:$lstr_query_string,
       success:saveModuleSetupResponce
      }); 
    } 
  }
function saveModuleSetupResponce($responce)
  {  
	$responce = eval('(' + $responce + ')');    
	if ($responce.error_code == 0) 
	  {                                                         
	   alert($responce.data);	   
	   $("#m_code").val('');
       $("#m_name").val('');
       $("#module_code").val('');
       $("#module_value").val(''); 
	   enablemodulesetup();
     }
   else
	{   
	  alert($responce.data);    
	}
	return; 

}

function getModuleSetupDetails()
{ 
 var id=jQuery("#table_module_setup_div").getGridParam('selrow'); 
 if (id) 
  { 	 	  
	$.ajax({
	type: "POST",
	async: false,
	url: $host_url+"mgetModuleSetupForUpdate.demo",
	data:"Code="+id,
	success: populateModulesetuptDetails
   });	 
  } 
else
	{ alert("Please select row"); return false;}
 }
 
function populateModulesetuptDetails($responce)
{
$responce = eval('(' + $responce + ')');    
if ($responce.error_code == 0)
{      
	$geditinternalcode=$responce.data.Code;        
	document.getElementById('m_code').value = $responce.data.Code;
	document.getElementById('m_name').value = $responce.data.Name;
	document.getElementById('module_code').value = $responce.data.FMODULE;
	document.getElementById('module_value').value = $responce.data.Value;	
 }
}