<?php 
function nestTree($tree){
	
	foreach ($tree as $c){
		$num=count ($c["SubCats"]);
		
			@$ret.= '<li class="dd-item" data-id="'.$c['id'].'">
                    <div class="dd-handle dd3-handle"></div><div class="dd3-content">'.$c['name'].'
					<div class="uk-float-right">
					'.is(is_right('aqsam_edit'),'<a href="'.site_url("admin/aqsam/edit/$c[id]").'"><i class="fa fa-edit fa-lg"></i></a>').'
					'.is(is_right('aqsam_del'),'<a  onclick="return confirm(\''.lang('is_del').'\')"  href="'.site_url("admin/aqsam/del/$c[id]").'"><i class="fa fa-close fa-lg" style="color: red;" ></i></a>').'</div>
					</div>'.is($num>0,'<ol class="dd-list">
					'.nestTree($c['SubCats']).'
					</ol>').'
					
                </li>';
		
	}
	if(isset($ret)){
		return $ret;
	}else{
		return null;
	}
}

?>


					

						<?php if($nesting_form_msg):?>
						<div class="uk-alert-success" uk-alert>
   
    <p>  <?=$nesting_form_msg?></p>
</div>
						
						<?php endif ?>


<div class="uk-card uk-card-default uk-card-small uk-card-hover">
	
	
	<div class="uk-card-body"  dir="ltr">
<div class="dd" id="nestable" >
            <ol class="dd-list">
			
             	<?php 
					$tree=$this->aqsam_model->GetCats(0);
				echo nestTree($tree);?>

            </ol>
        </div>
		
		<?php echo form_open(); ?>
		<input type="hidden" name="nesting" id="nestable-output">
		<button type="submit" class="uk-button uk-button-primary"><?=lang('save')?></button>
		</form>		
		
		
	</div>
</div>



                           
