<!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.lblMenuItems}</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" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/colorbox.css" />
</head>
<body>
<div class="outer_container"> {include file='CommonTop.tpl'}
  <!--End:Header Container-->
  <!--***********************************************************************END HEADER CONTAINER******************************************************-->
  <div class="content_container">
      <div class="content_wrapper">
          
        <h2>{$language.lblManageFrontendMenus}</h2>
        <div id="common_message" ></div>  
      {form->start name="formMenuSearch" action="" method="post" enctype="multipart/form-data"}
        <div class="clearfix "> 
		{form->select name="brandID" value=$brandID options=$listBrand style="float:right;width:150px;margin-left:5px;padding:6px 10px"}	
        {if $resMenusItems} 
     {html->anchor priv_href="custommenu/menuitems/" href="custommenu/menuitems/" title=$language.lblMenuItems history="yes" class="button02 curve-3 fixing_right" content="{$language.lblManageMenuItems}"}
     {/if}
           <div  class="menu-list-left">
                <div class="search_container">
                    <div class="inner single-box"> 
                    
                      <ul class="clearfix">
                        <li class="column">
                           <p class="label-field01">{$language.lblMenu}</p>
                           <span class="form-field01"></span>
                        </li>
                        <li class="column">
                           <p class="label-field01"></p>
                           <span class="form-field01">
                            {form->select tabindex="1" class="select-box" name="menuID" value=$menuID options=$listMenus} 
                           </span>
                        </li>
                        <li class="column">
                           <p class="label-field01">{$language.lbllanguage}</p>
                           <span class="form-field01">
                            {form->select tabindex="1" class="select-box" name="lang" caption="->{$language.lblSelect}" value=$defLang options=$view_common_languages}                           
                           </span>
                        </li>                       
                        <li class="column">
                          <span class="form-field01">
                             {form->submit id="submitSearch" name="submitSearch" tabindex="1"  class="button01" value="{$language.lblSearch}"} 
                             {html->anchor href="/custommenu/frontendmenus/" tabindex="1" caption=$language.lblListAll  class="action-link"}
                          </span>
                        </li>
                      </ul>                       
                     
                      <div class="clear"></div>
                    </div>
              </div>
          </div>
          </div>
		   {form->close}
          <div class="clearfix menu-position"> 
		<div  class="menu-list-left">        
           {if $resMenusItems}  
         <div class="clearfix">  <div class="info-message fixing_right">{$language.lblPleaseDrapDropMenuItems}</div>
        </div>
           <span class="seprtor"></span>
        {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="22"></td>
                      </tr>
                      </thead>
                 </table>
          </div> <!--heading-->
        
		{if $listItemsInOrder}
          <ul id="sort1" class="dragtree connectedSortable">
          	{* define the function *}  <!--menu function-->
            {function name=menu level=0}
            {foreach from=$data item="entry"}
            	 {if $entry.status == 'Active'}
                    {assign var="newstatus" value='Inactive'}
                    {assign var="statusLabel" value=$language.lblActive}
                    {assign var="statusImg" value='status-active icon-set'}
                  {else}
                    {assign var="newstatus" value='Active'}
                    {assign var="statusImg" value='status-inactive icon-set'}
                    {assign var="statusLabel" value=$language.lblInactive}
                 {/if} 
                    <li data-id="{$entry['menuItemID']}" data-orderid="{$entry['orderID']}" data-level="{$level}" data-lang="{$entry['availableLang']}" data-modulekey="{$entry['moduleKey']}" data-defaulturl="{$entry['default_url']}" data-sourceurl="{$entry['set_cms_homepage']}">
                    <div class="group">
                         <div class="positioning">
                        {if $editPrivilege || $deletePrivilege|default:''}
                         <span class="cntols-span">
                             
                              {if $entry.moduleKey=='productfilterurl'}
                                    {html->anchor href="ajax/productpriority/itemID/{$entry.menuItemID}/" 
                                            id="generatepdtlistLink" 
                                            title="Set Product Priority for {$entry.menuItemName}" 
                                            class="showModalPopup" 
                                            content="<img src={$view_images}/icon-agencies.png width='17px' style='margin-bottom:-2px;' />"
                                            popuptype="iframe" 
                                            popuptitle="Set Product Priority for {$entry.menuItemName}"  
                                            frameheight="80%"  
                                            frameWidthClass="modal-lg"}
                                            {/if}
						 {if $editPrivilege}
                         {html->anchor class="{$statusImg} changeItemStatus" id="{$entry.menuItemID}" rel="{$newstatus}"
                         content="" title="{$statusLabel}"  orderid="{$entry.orderID}"}
                         {else}
							{html->anchor content="&nbsp;"}
                        {/if}
                         {html->anchor title=$language.lblEditMenuItem history="yes" class="edit02 icon-set" content=""  href="custommenu/editItem/id/{$entry.menuItemID}/"}
			
                        {html->anchor id="{$entry.menuItemID}" class="delete02 icon-set noremove" title=$language.lblRemove task='deleteItem' 
                        orderid="{$entry.orderID}" child=$entry['children']|default:''|@count}
                        
                        </span>{/if}
                             <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td width="25" class="drag " align="left" valign="middle">
                                        <span class="line1"></span><span class="line2"></span><span class="line3"></span>
                                    </td>
                                    <td width="10"  align="center" valign="middle">
                                        <span class="expand {if !( isset($entry['children']) && is_array($entry['children']) && !empty($entry['children']))}hide{/if}" >
                                         +
                                        </span>
                                    </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']} </td>
                                    <td class="cols4 col" align="left" valign="middle">{$entry['defAccess']}</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=menu 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 menu data=$listItemsInOrder} <!--menu function calling-->
          </ul>
          <div class="fixing_left">{$language.lblRecordsFound} :  <strong id="rowCntOrders"></strong></div>
              <!--end: Pagination-->
          
         {else}
             <ul id="sort1" class="dragtree connectedSortable " style="min-height:25px;"> 
    		</ul>
         {/if} 
          {form->button name="submitItems" id="submitItems" class="update_btn_table curve-3 button02 fixing_right"  value=$language.lblSave}
          {form->close}
       {/if} 
       {if empty($resMenusItems)}
    
    	 <div class="message_info" id="common_message">{$language.msgNoRecords}</div>
    {/if}   
      </div> <!--menu-list-left-->
    
     {if $resMenusItems} <div  class="menu-list-right">
    
      <div class="heading">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left" valign="middle" class="cols1 col">{$language.lblMenuItems}</td>
            <td align="left" valign="middle" class="cols3 col">{$language.lblLang}</td>
          </tr>
        </table>
    </div>
    <ul id="sort2" class="dragtree connectedSortable">
	{* define the function *}  <!--menu function-->
            {function name=menuItems level=0}
            {foreach from=$data item="entry"} 
            	 {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']}" data-modulekey="{$entry['moduleKey']}" data-defaulturl="{$entry['default_url']}" data-sourceurl="{$entry['set_cms_homepage']}">
                    <div class="group">
                        <div class="positioning zindex">
                          {if $deleteprivilege|default:''}
                          <span class="cntols-span">
                            {html->anchor id="{$entry.menuItemID}" class="delete00 icon-set" title=$language.lblDelete task='deleteItem'}
                          </span>
                          {/if}
                           <table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="25" bgcolor="#CCCCCC" class="drag " 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']))}{else}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">{$entry['labelType']}</td>
                                <td class="cols3 col"  align="left" valign="middle">
                                	{$entry['deflang']} {if $entry.source|default:'' == 1}   
                        			<span class="info type_details"  itemid="{$entry.menuItemID}" moduleid="{$entry.moduleID}"></span>
                       				{/if}
                        			<span class="info-details" style="display:none;"><span class="arw"></span>
                           			<span class="inner01">{$language.lblMenuItemType} : <span class="bold">{$entry['labelType']}</span><br />
                                    <span class="add-details-outer"> {$language.lblSource} : <span class="bold add-details"></span> </span>
                            		</span>
                       				</span>
                      			</td>
                                <td class="cols4 col" align="left" valign="middle">{$entry['defAccess']}</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> <!--end: Pagination-->
  </div>   <!--menu-list-right-->
  {/if}
  </div>

    <!--End: main Block-->
  </div>
  </div>
  <!--End:Content Container-->
  {include file='CommonBottom.tpl'} </div>
<!--End:Outer Container-->
{include file='CommonJavaScriptBottom.tpl'}
{html->messages_script id="common_message"}
{form->rootpath_script}
{form->basepath_script}
<script type="text/javascript">
$('.side_wrapper ul li a[rel=menu-items]').addClass('selected'); 
var menuItemAction = "{$menuItemAction}";
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 languageMismatch="{$language.lblLanguageMismatch}";
var languageMismatchRollback="{$language.lblLanguageMismatchSortingRollBacked}";
var lblSorce = "{$language.lblSource}";
{literal}
$('.info').hover(function() {
  $(this).siblings('.info-details').show();
  
},function(){
	$('.info-details').hide();
});
$('.info').customTooltip();
$('#rowCntOrders').text($('#sort1 li:not(.addNew)').length);
$('#rowCntItems').text($('#sort2 li').length);
{/literal}
		$("#brandID").change(function(){ 
			/*var id			=	$('#brandID').val();
			var url 		= 	window.location.href;   
			if (url.indexOf("brandID") > -1) 
				window.location.href = url+"brandID/"+ id+"/";
			*/
			var input = $("<input>")
               .attr("type", "hidden")
               .attr("name", "submitSearch").val("Search").appendTo('#formMenuSearch');
			   
			$('#formMenuSearch').submit();
		});
</script>
<script type="text/javascript" src="{$view_javascript}/menuItemListing.page.js"></script>
<script type="text/javascript" src="{$view_javascript}/custommenuitem.page.js"></script>
<script type="text/javascript"  src="{$view_javascript}/jquery.colorbox.js"></script>
<script type="text/javascript">
{literal}
$(document).ready(function(){
        $(".showModalPopup").colorbox({iframe:true, width:"800px", height:"90%"});
});	
{/literal}
</script>
</body>
</html>
