<?php /* Smarty version Smarty-3.1.8, created on 2019-11-25 10:16:18
         compiled from "/home/stg70/public_html/agmc-v2/application/core/views/manage/standard/AjaxCategoryList.tpl" */ ?>
<?php /*%%SmartyHeaderCode:18256221515ddb71b2068cd6-09076025%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '5ccd4518f6f1bb849b8cc460b8a6ff193e36bdba' => 
    array (
      0 => '/home/stg70/public_html/agmc-v2/application/core/views/manage/standard/AjaxCategoryList.tpl',
      1 => 1574165223,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '18256221515ddb71b2068cd6-09076025',
  'function' => 
  array (
    'categories' => 
    array (
      'parameter' => 
      array (
        'level' => 0,
        'catValues' => 0,
      ),
      'compiled' => '',
    ),
  ),
  'variables' => 
  array (
    'language' => 0,
    'view_styles' => 0,
    'resCategories' => 0,
    'data' => 0,
    'productCategory' => 0,
    'level' => 0,
    'categoryIDList' => 0,
    'catValues' => 0,
    'categoryName' => 0,
    'categoryIDs' => 0,
    'children' => 0,
    'categoryValue' => 0,
  ),
  'has_nocache_code' => 0,
  'version' => 'Smarty-3.1.8',
  'unifunc' => 'content_5ddb71b210c286_64926201',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5ddb71b210c286_64926201')) {function content_5ddb71b210c286_64926201($_smarty_tpl) {?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $_smarty_tpl->tpl_vars['language']->value['lblProductCategories'];?>
</title>
<?php echo $_smarty_tpl->getSubTemplate ('CommonJavaScript.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?>

<link rel="stylesheet" type="text/css" href="<?php echo $_smarty_tpl->tpl_vars['view_styles']->value;?>
/popup.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo $_smarty_tpl->tpl_vars['view_styles']->value;?>
/add-edit.css" media="screen" />	
<?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->rootpath_script(array(),$_smarty_tpl);?>

<?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->basepath_script(array(),$_smarty_tpl);?>

</head>
<body>
<div class="popup-block">
	<div class="clear"></div>
	<?php if (count($_smarty_tpl->tpl_vars['resCategories']->value)>0){?> 
			<div class="form_listing02 clearfix">
				<div class="clearfix"> 
	
				 <div class="category-section pos-relative">
				  <div class="div-city">
                      <div class="fixed-section">
                          <h2><?php echo $_smarty_tpl->tpl_vars['language']->value['lblProductCategory'];?>
</h2>
                      <?php $_smarty_tpl->tpl_vars["categoryValue"] = new Smarty_variable('', null, 0);?>

				<?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->textbox(array('name'=>"filterCategories",'class'=>"filterBrands text-box margin-bottom",'placeholder'=>"Search Categories"),$_smarty_tpl);?>

                          </div>
				<?php $_smarty_tpl->tpl_vars["categoryValue"] = new Smarty_variable('', null, 0);?>
			        <ul  class="dragtree categoryList" id="categoryList">
							  

                <!--menu function-->
                 <?php if (!function_exists('smarty_template_function_categories')) {
    function smarty_template_function_categories($_smarty_tpl,$params) {
    $saved_tpl_vars = $_smarty_tpl->tpl_vars;
    foreach ($_smarty_tpl->smarty->template_functions['categories']['parameter'] as $key => $value) {$_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value);};
    foreach ($params as $key => $value) {$_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value);}?>

                <?php  $_smarty_tpl->tpl_vars["productCategory"] = new Smarty_Variable; $_smarty_tpl->tpl_vars["productCategory"]->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['data']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars["productCategory"]->key => $_smarty_tpl->tpl_vars["productCategory"]->value){
$_smarty_tpl->tpl_vars["productCategory"]->_loop = true;
?> 
					
					 <?php if ($_smarty_tpl->tpl_vars['productCategory']->value['productCategoryStatus']=='Inactive'){?>
				                
                                  <?php $_smarty_tpl->tpl_vars["categoryName"] = new Smarty_variable($_smarty_tpl->tpl_vars['productCategory']->value['productCategoryName'], null, 0);?>
                                  <?php }else{ ?>
				  <?php $_smarty_tpl->tpl_vars["categoryName"] = new Smarty_variable($_smarty_tpl->tpl_vars['productCategory']->value['productCategoryName'], null, 0);?> 
				  <?php }?>
					
		
                        <li  data-level="<?php echo $_smarty_tpl->tpl_vars['level']->value;?>
" category="<?php echo $_smarty_tpl->tpl_vars['productCategory']->value['productCategoryID'];?>
" catname="<?php echo $_smarty_tpl->tpl_vars['productCategory']->value['productCategoryName'];?>
" class="left-spacing <?php if ($_smarty_tpl->tpl_vars['productCategory']->value['productCategoryID']==1){?> ui-state-disabled <?php }?> li_catIDs" >
                     
                           
                                  
							
									<?php if (!(in_array($_smarty_tpl->tpl_vars['productCategory']->value['productCategoryID'],(($tmp = @$_smarty_tpl->tpl_vars['categoryIDList']->value)===null||$tmp==='' ? array() : $tmp)))){?>
                                    <span class="expand <?php if (!(!empty($_smarty_tpl->tpl_vars['productCategory']->value['children'])&&is_array($_smarty_tpl->tpl_vars['productCategory']->value['children']))){?>hide<?php }?>"></span>
									<?php }else{ ?>
									<span class="expand colapse <?php if (!(!empty($_smarty_tpl->tpl_vars['productCategory']->value['children'])&&is_array($_smarty_tpl->tpl_vars['productCategory']->value['children']))){?>hide<?php }?>"></span>
									<?php }?>
																		  
									 <?php $_smarty_tpl->tpl_vars["categoryValue"] = new Smarty_variable((($_smarty_tpl->tpl_vars['catValues']->value).(",")).($_smarty_tpl->tpl_vars['productCategory']->value['productCategoryID']), null, 0);?>
										

									<?php ob_start();?><?php if (in_array($_smarty_tpl->tpl_vars['productCategory']->value['productCategoryID'],$_smarty_tpl->tpl_vars['categoryIDs']->value)){?><?php echo " 
									 ";?><?php echo $_smarty_tpl->tpl_vars['productCategory']->value['productCategoryID'];?><?php echo "
									";?><?php }?><?php $_tmp1=ob_get_clean();?><?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->checkbox(array('name'=>"categoryIDs",'class'=>"categoryTree selectCheckBoxItems",'id'=>"category",'options'=>((($_smarty_tpl->tpl_vars['productCategory']->value['productCategoryID']).("->")).("&nbsp;")).($_smarty_tpl->tpl_vars['categoryName']->value),'value'=>$_tmp1),$_smarty_tpl);?>
 
																			<span class="hiddenTitle hide">	 
												<?php echo $_smarty_tpl->tpl_vars['productCategory']->value['productCategoryName'];?>

											</span>
                         
							<?php $_smarty_tpl->tpl_vars["children"] = new Smarty_variable((($tmp = @$_smarty_tpl->tpl_vars['productCategory']->value['children'])===null||$tmp==='' ? '' : $tmp), null, 0);?>
                             <?php if (isset($_smarty_tpl->tpl_vars['productCategory']->value['children'])&&is_array($_smarty_tpl->tpl_vars['productCategory']->value['children'])&&!empty($_smarty_tpl->tpl_vars['productCategory']->value['children'])){?>
                               <ul id="" class="categoryList <?php if (!(in_array($_smarty_tpl->tpl_vars['productCategory']->value['productCategoryID'],(($tmp = @$_smarty_tpl->tpl_vars['categoryIDList']->value)===null||$tmp==='' ? array() : $tmp)))){?>hide <?php }?>"> 
                            <?php smarty_template_function_categories($_smarty_tpl,array('data'=>$_smarty_tpl->tpl_vars['children']->value,'level'=>$_smarty_tpl->tpl_vars['level']->value+1,'catValues'=>$_smarty_tpl->tpl_vars['categoryValue']->value));?>
  <!--menu function calling-->
                            </ul>
                          
                        <?php }else{ ?>
                             <?php if ((is_array($_smarty_tpl->tpl_vars['productCategory']->value))&&(isset($_smarty_tpl->tpl_vars['productCategory']->value['menuItemID']))&&(is_numeric($_smarty_tpl->tpl_vars['productCategory']->value['menuItemID']))){?>
                        </li>	
                        <?php }?>
                    <?php }?>
            <?php } ?>  
          <?php $_smarty_tpl->tpl_vars = $saved_tpl_vars;}}?>

          <?php smarty_template_function_categories($_smarty_tpl,array('data'=>$_smarty_tpl->tpl_vars['resCategories']->value));?>
 <!--menu function calling-->
             	 </ul>  
</div>
				</div>
				
				</div>
				<div class="clear"></div>
			</div>
			<div class="submit-block clearfix textto_center pos-fixed">
				<span>&nbsp; </span> 
				<?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->button(array('name'=>"addCategoryButton",'class'=>"blueBtn-1",'value'=>$_smarty_tpl->tpl_vars['language']->value['lblPromotionSchemaLinkCategory']),$_smarty_tpl);?>

				<?php echo $_smarty_tpl->tpl_vars['language']->value['lblOr'];?>
 
				<?php echo $_smarty_tpl->smarty->registered_objects['html'][0]->anchor(array('onclick'=>"parent."."$".".colorbox.close();",'id'=>"cancel",'class'=>"grayBtn3",'caption'=>($_smarty_tpl->tpl_vars['language']->value['lblCancel'])),$_smarty_tpl);?>

			</div>
	<?php }else{ ?>
        <div class="message_info"> <?php echo $_smarty_tpl->tpl_vars['language']->value['msgNoRecords'];?>
</div>	
	<?php }?>	
</div>
<script>
var wHeight = $(window).height();
var docHeight=$(document).height();

if(docHeight>wHeight){
	$(".popup-block").addClass("footerfix");
}
else{
	$(".popup-block").removeClass("footerfix");
}
var lblSelectItem ="<?php echo $_smarty_tpl->tpl_vars['language']->value['lblSelectItem'];?>
";	
$(document).ready(function (){	
		$(".expand").click(function(){
		if($(this).hasClass('colapse')){
			$(this).removeClass('colapse');
			$(this).closest('li').find('ul:first').addClass('hide');
		}
		else{
			$(this).addClass('colapse'); 
			$(this).closest('li').find('ul:first').removeClass('hide');
		}
	});
	
    $(document).on('click', ".expandable", function () {
        var id = $(this).attr("id");
        $("#div" + id).fadeIn();
        $(this).removeClass("expandable").addClass("collapsable");
    });
    $(document).on('click',".collapsable",function () {
        var id = $(this).attr("id");
        $("#div" + id).fadeOut();
        $(this).removeClass("collapsable").addClass("expandable");
    });		
		$(document).on('keyup',"#filterCategories",function(){
		
		var val = $(this).val();
		$(".li_catIDs").each(function() {
		//console.log($(this).attr('catname').toLowerCase().indexOf(val));
		if ($(this).attr('catname').toLowerCase().indexOf(val) > -1) {
			if($(this).attr('data-level') == 0){
				$(this).removeClass("hide").addClass("show");
			}
		}else{
			if($(this).attr('data-level') == 0){
				$(this).removeClass("show").addClass("hide");
			}
		}			
		});
	})		
$(document).on('click', ".listAllCheckBoxItems", function () {
	if ($(this).prop("checked") == true) {
		$(".selectCheckBoxItems").prop("checked", true);
	} else {
		$(".selectCheckBoxItems").prop("checked",false);
	}
});	
$(document).on('click', "#addCategoryButton", function () {
	if($(".categoryTree:checked").size()==0)
	{
		jAlert(lblSelectItem);
		return false;
	} 
	var selectedDataObj = [];
	$('.categoryTree:checked').each(function () {        
		selectedDataObj.push({
            id: $(this).val(),
            title: $(this).next(".hiddenTitle").html()
        });
	}); 
	parent.$.colorbox.close();
	parent.addItemFromPicker(selectedDataObj); 
});	
});	
setCheckboxSelected();
function setCheckboxSelected()
{
	var currentSelected = parent.currentPopupPicker.nextAll().find(".popupPickerDataValues:first").val();
	if(currentSelected)
	{
		var selectedIds = currentSelected.split(",");
		$('.selectCheckBoxItems').each(function () { 
			if($.inArray($(this).val(),selectedIds)>-1)
			$(this).prop("checked", true);
		});
	}
}
</script>	
</body>
</html><?php }} ?>