<!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>{$language.lblAdmin} : {$language.lblManageMenuItems}</title>
{include file='CommonStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/right-menu.css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/menuItemListing.css" />

{form->rootpath_script}
{form->basepath_script}
{include file='CommonCustomStyles.tpl'}
</head>
<body >
<div class="outer_container"> {include file='CommonTop.tpl'}
  <!--End:Header Container-->
  <!--***********************************************************************END HEADER CONTAINER******************************************************-->
<div class="content_container2 clearfix">
	 <div class="right-sidebar">
      <div class="side_wrapper"> 
      {html->anchor priv_href="custommenu/additem/" href="custommenu/additem/" caption="<strong><span class='add'></span>{$language.lblAddNewMenuItem}</strong>" class="custom-btnt" history="yes"}
       	 {include file='MenuRightLink.tpl'}
      </div>
    </div>
    <!--End: Right Block-->
    <div class="left_wrapper">
    <div class="content_wrapper">  
	{form->select name="brandID" value=$brandID options=$listBrand style="float:right;width:150px;margin-left:5px;padding:2px 5px"}	
    <h2>{$language.lblManageMenuItems}</h2>
  <div id="common_message" ></div>
  
         {if $resMenusItems} 
         <div class="manage-menu"> 
        	{form->start name="frmMenuList" action="" method="post"}
            <div class="heading">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" id="contentList" >
                    <thead>
                      <tr class="nodrag nodrop">
                        <td align="left" valign="middle" class="cols1 col">{$language.lblMenuItems}  </td>
                        <td align="left" valign="middle" class="cols2 col">{$language.lblMenuItemType}</td>
                        <td align="left" valign="middle" class="cols3 col">{$language.lblLang}</td>
                        <td align="left" valign="middle" class="cols4 col">{$language.lblAccess}</td>
                         <td align="left" valign="middle" width="70">&nbsp;</td>
                      </tr>
                      </thead>
                 </table>
          </div> <!--heading-->
        
			{if $resMenusItems}
              <ul {if $editPrivilege}id="sort1"{/if}class="menuItemsListing {if $editPrivilege}dragtree connectedSortable{/if}">
                {* define the function *}  <!--menu function-->
                 {function name=menuItems level=0}
                {foreach from=$data item="entry"} 
                     {assign var="childcount" value=''}
                     {if $entry.status == 'Active'}
                        {assign var="newstatus" value='Inactive'}
                        {assign var="statusLabel" value=$language.lblActive}
                        {assign var="statusImg" value='status-active'}
                      {else}
                        {assign var="newstatus" value='Active'}
                        {assign var="statusImg" value='status-inactive'}
                        {assign var="statusLabel" value=$language.lblInactive}
                    {/if}
                        <li data-id="{$entry['menuItemID']}"  data-level="{$level}" data-lang="{$entry['availableLang']}">
                        <div class="group">
                         <span class="chk-bx">
                            {form->checkbox name="menuItemBulkStatus[]" value=$entry['menuItemID'] class="checkbox01 ListAll  hide List"|cat:$entry['status']} 
                         </span>
                         <div class="positioning">
                       
                             <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td width="25" {if $editPrivilege}class="drag"{/if} align="left" valign="middle">
                                    <span class="line1"></span><span class="line2"></span><span class="line3"></span></td>
                                    <td width="10" class="expand  {if !( isset($entry['children']) && is_array($entry['children']) && !empty($entry['children']))}hide{/if}" align="center" valign="middle">+</td>
                                    <td class="cols1 col" align="left" valign="middle">{$entry.menuItemName} </td>
                                    <td class="cols2 col" align="left" valign="middle"> 
                                        <div class="info-outer zindex">
                                       {$entry['labelType']}
                                       {if $entry.source|default:'' == 1}  
                                        <span class="info type_details"  itemid="{$entry.menuItemID}" moduleid="{$entry.moduleID}"></span>
                                        <span class="info-details" style="display: none;"><span class="arw"></span>
                                       <span class="add-details-outer"> <span class="inner01">  {$language.lblSource} : <span class="bold add-details"></span> </span>
                                       </span></span>
                                       {/if}
                                       </div>
                                    </td>
                                    <td class="cols3 col"  align="left" valign="middle">{$entry['deflang']} {$entry['langMulti']|default:''}</td>
                                    <td class="cols4 col" align="left" valign="middle">{$entry['defAccess']}</td>
                                    <td align="left" valign="middle" width="70">
                                    {if $editPrivilege || $deletePrivilege}
									{if $editPrivilege}
                          {html->anchor class="{$statusImg} changeItemStatus icon-set" id="{$entry.menuItemID}" rel="{$newstatus}"  content="" title="{$statusLabel}"}
                        {html->anchor title=$language.lblEditMenuItem history="yes" class="edit02 icon-set" content=""  href="custommenu/editItem/id/{$entry.menuItemID}/"}
						{/if}
						{if $deletePrivilege}
                                                    {if isset($entry['children'])}
                                                    {assign var="childcount" value=$entry['children']|@count}
                                                    {/if}
                        {html->anchor id="{$entry.menuItemID}" class="delete02 icon-set noremove" title=$language.lblDelete task='deleteItem' child=$childcount|default:''}
                       {/if}	
							{/if}
                                    </td>
                                  </tr>
                            </table></div>
                            </div>
                             {if isset($entry['children']) && is_array($entry['children']) && !empty($entry['children'])}
                               <ul id="" class="connectedSortable ui-sortable  hide"> 
                            {call name=menuItems data=$entry['children'] level=$level+1}  <!--menu function calling-->
                            </ul>
                          
                        {else}
                             {if (is_array($entry)) && (is_numeric($entry['menuItemID']))}
                        </li>	
                        {/if}
                    {/if}
            {/foreach}  
          {/function}
          {call menuItems data=$resMenusItems} <!--menu function calling-->
              </ul>
			  <div class="fixing_left">{$language.lblRecordsFound} :  <strong id="rowCntItems"></strong></div>
         	{/if} 
			{if $editPrivilege}
          {form->button name="submitItemDetails" id="submitItemDetails" class="update_btn_table curve-3 button02 fixing_right"  value=$language.lblSave}
		  {/if}
          {form->close}
          </div>
       	{/if} 
       {if empty($resMenusItems)}
    
    	 <div class="message_info" id="common_message">{$language.msgNoRecords}</div>
    {/if} 
     
    <!--End: main Block-->
  </div>
    </div>
    <!--End: left Block-->
    <div class="clear"></div>
  </div>
  <!--End:Content Container-->
  {include file='CommonBottom.tpl'} 
  </div>  <!-- outer_container ends-->
 {assign var="menuItemAction" value="listing"}
{html->messages_script id="common_message"}
{form->rootpath_script}
{form->basepath_script}
{include file='CommonJavaScriptBottom.tpl'}
<script type="text/javascript">
$('.side_wrapper ul li a[rel=manage-menu-items]').addClass('selected'); 
var menuItemAction = '{$menuItemAction}';
setSideMenu();
var msgSelectItem="{$language.msgSelectItem}";
var lblSelectAction="{$language.lblSelectAction}";
var msgDeleteMenuItems="{$language.msgDeleteMenuItems}";
var deleteText = "{$language.lblDelete}";
var msgSelectSearchCriteria ='{$language.msgSelectSearchCriteria}';
var subItemsText="{$language.lblSubItemsPresent}";
var languageMismatchRollback="{$language.lblLanguageMismatchSortingRollBacked}";
var errDeleteItemsWithChild="{$language.errDeleteItemsWithChild}";
$('.info').customTooltip();
$('#rowCntItems').text($('.menuItemsListing li').length);
$("#brandID").change(function(){ 
	var id			=	$('#brandID').val();
	window.location.href = GLOBAL_BASE_PATH+"/custommenu/menuitems/brandID/"+ id+"/";
});
</script>
<script type="text/javascript" src="{$view_javascript}/menuItemDetails.page.js"></script>
<script type="text/javascript" src="{$view_javascript}/custommenuitem.page.js"></script>
</body>
</html>
