Current File : //root/panel/etc/styles/CstyleX-master/inc/hrpanelcustom.js
insearch = 0;
function searchpage(searchBoxEl) {
/*  ////////////////////////////  For searching start //////////////////////////// */
    var searchText = searchBoxEl.value.toLowerCase();
	 if (searchText) {
        document.getElementById("clearlnk").style.display = "";
		
    }else
	{
	    document.getElementById("clearlnk").style.display = "none";
	}
	$('#sortable-with-handles li ul li').each(function () {
	var getText=$(this).html().toLowerCase();
	if (getText.indexOf(searchText) >= 0)
	{
		$(this).removeClass("RemoveList");
		$(this).addClass("ShowList");
	}else
	{
		$(this).removeClass("ShowList");
		$(this).addClass("RemoveList");
	}
});
$('#sortable-with-handles li ul li').each(function () {
		//alert($(this).html());
		var getText=$(this).html().toLowerCase();
		//alert(getText);
	//$($(this).html().toLowerCase():conta)
	if (getText.indexOf(searchText) >= 0)
	{
		$(this).removeClass("RemoveList");
		$(this).addClass("ShowList");
	}else
	{
		$(this).removeClass("ShowList");
		$(this).addClass("RemoveList");
	}
});
$('#sortable-with-handles li ul').each(function () {
	var childcount=$(this).children().length;
	var children = this.children;
    var count = 0;
    for(var i = 0; i < children.length; i++)
        if (children[i].classList.contains('RemoveList'))
            count++;
	if(count==childcount)
	{	 $(this).parent().parent().removeClass("ShowList");
		 $(this).parent().parent().addClass("RemoveList");
	}else
	{
		 $(this).parent().parent().removeClass("RemoveList");
		 $(this).parent().parent().addClass("ShowList");
	}
	
});
/*  ////////////////////////////  For searching End //////////////////////////// */
}
function showhelp()
{

}
function defaultorder()
{
var sortorder =  ["1","6","8","5","4","3","7","2","9"];
$.ajax({
type: "POST",
url: "dryden/ajax/moduleorder.php",
dataType: "json",
contentType: "application/x-www-form-urlencoded",
data: {
'moduleorder':sortorder,
//'csrfmiddlewaretoken': ''
},

success: function(data) {
window.location.href="index.php";
},
error: function(ts) {
//  Sentora.utils.log('ERROR: Sentora.modules.dragDrop() AJAX Sorting order NOT Saved');
// Sentora.loader.hideLoader();

console.log("failure");
}

});
} 	
function expandallboxes() {

	$(".module-box-body").each(function() {
	$(".module-box-body").show('fast'); 	
    });
		$(".icon-down-open").each(function() {
	$(".icon-down-open").addClass('icon-up-open').removeClass('icon-down-open'); 	
    });
}

	function clearsearch() {
    var quickJumpEl = document.getElementById("quickjump");
    quickJumpEl.value = "";
    searchpage(quickJumpEl);
    //restoreboxes();
	   document.getElementById("clearlnk").style.display = "none"
    insearch = 0
}
function togglediv(Id)
{
 $("#showhidetable").toggleClass( "hide_view","linear" );
 if($("#togglecollapsestats").css('display') == 'none'){ 
 $("#togglecollapsestats").show();
 }else
 {
  $("#togglecollapsestats").hide();

 }
 if($("#toggleextendedstats").css('display') == 'none'){ 

 $("#toggleextendedstats").show();
}else
 {
  $("#toggleextendedstats").hide();
   

 }
 if(  $("#icon-up-open-toggle").hasClass("icon-down-open-sidebar"))
 {
 $("#icon-up-open-toggle").removeClass("icon-down-open-sidebar");
     $("#icon-up-open-toggle").addClass("icon-up-open-sidebar");
 }else
 {
    $("#icon-up-open-toggle").removeClass("icon-up-open-sidebar");
   $("#icon-up-open-toggle").addClass("icon-down-open-sidebar");
 
 }
 //$(this).hide();
}
function hideicons()
{
 if ($.cookie('iconvisible') == null ||  $.cookie('iconvisible')=='show'){
$.cookie('iconvisible', 'hide', { expires: 365 });
}else
{
$.cookie('iconvisible', 'show', { expires: 365 });
}
window.location.href="index.php";
}
$( document ).ready(function() {
   // console.log( "ready!" );
   if ($.cookie('iconvisible') == null ||  $.cookie('iconvisible')=='show'){
			$('#sortable-with-handles li ul li a img').each(function () {
			$(this).css("visibility","visible");
			});
		$("#showhideicon").html("Hide Icons");

  }else
  {
		$('#sortable-with-handles li ul li a img').each(function () {
		$(this).css("visibility","hidden");
		});
		$("#showhideicon").html("Show Icons");
  }
  if (window.location.search.indexOf('module=') > -1) {
  $("#togglebox").hide();
  }else
  {
  $("#togglebox").show(); 
  }
  
});
 $( function() {
     $( "#sortable-with-handles" ).sortable({
	     connectWith: '#sortable-with-handles',
		  update : function () {
	
	  				//var order1 = $('#sortable-with-handles').sortable('toArray').toString();
			
					 var sortorder = new Array();
					$('.sortable li.module-box').each(function() {
                    sortorder.push($(this).attr('data-catid'));
						});
						$.ajax({
                    type: "POST",
                    url: "dryden/ajax/moduleorder.php",
                    dataType: "json",
                    contentType: "application/x-www-form-urlencoded",
                    data: {
                        'moduleorder': sortorder,
                        //'csrfmiddlewaretoken': ''
                    },

                    success: function(data) {
                      //  Sentora.utils.log('Sentora.modules.dragDrop() AJAX Sorting order Saved');
                       // Sentora.loader.hideLoader();
                    },

                    error: function(ts) {
                      //  Sentora.utils.log('ERROR: Sentora.modules.dragDrop() AJAX Sorting order NOT Saved');
                       // Sentora.loader.hideLoader();
                    }

                });
		},
      placeholder: "ui-state-highlight",
	  
    });
	$( "#sortable-with-handles" ).disableSelection();
  } );
  function rollboxes(Id)
  {
  
  var res = Id.split("-");
if($("#module-box-body-"+res[3]+"").css('display') == 'none'){ 
					if(res[0]=="icon")
					{
					$("#"+Id+"").removeClass('icon-down-open');
					$("#"+Id+"").addClass('icon-up-open');
					
					}
$("#module-box-body-"+res[3]+"").show('fast'); 

} else { 

					if(res[0]=="icon")
					{
					$("#"+Id+"").removeClass('icon-up-open');
					$("#"+Id+"").addClass('icon-down-open');
					
					}
$("#module-box-body-"+res[3]+"").hide('fast'); 
} 
//$("#module-box-body-"+res[3]+"").toggle('fast');
  }
  function reset_all_interface_settings()
{
clearsearch();
expandallboxes();
$("#toggleextendedstats").show();
$("#togglecollapsestats").hide();
$("#showhidetable").addClass( "hide_view");
$("#icon-up-open-toggle").removeClass("icon-up-open-sidebar");
$("#icon-up-open-toggle").addClass("icon-down-open-sidebar");
 defaultorder();
}