<!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" />
{assign var="widgetID" value=$widgetID|default:''}
{assign var="tabID" value=$tabID|default:""}
<title>{$language.lblAdmin} : {if $widgetID>0}  {$language.lblWidgetEdit}  {else} {$language.lblWidgetAddNew} {/if}</title>
{include file="CommonStyles.tpl"}
{include file="CommonCustomStyles.tpl"}
{include file="CommonJavaScript.tpl"}
<link rel="stylesheet" type="text/css" href="{$view_styles}/inner-formlisting.css" />
<link href="{$view_styles}/jquery-ui-1.8.19.custom.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/ui.daterangepicker.css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/colorbox.css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/add-edit.css" media="screen" />	
	</head><body>
<div class="outer_container"> {include file='CommonTop.tpl'} 
  <!--End:Header Container--> 
  <!--*************************************************START CONTAINER SECTION*************************************************-->
 <div class="content_container4 clearfix">
        <div class="wdgt-tab-section">
        <div class="wdgt-tab-head clearfix">
        	<h4 class="page-head fixing_left inactive"> 
             {if $widgetID>0}
			{html->anchor href="/widget/edit/id/{$widgetID}"  class="icon-set-af edit" content="{$widgetTitle}"} 
		{else}			
			{$language.lblWidgetAddNew}
		{/if}
             
       </h4>
             <ul class="wdgt-tab2 fixing_right tabSort">
		  {assign var="resTabs" value=$resTabs|default:array()}
		  {if $resTabs|count|default:0>0}
		  {foreach item="tabs" from=$resTabs}
		  {assign var="tstatus" value=""}
		  {if $tabs.widgetTabID==$tabID} {assign var="tstatus" value="active"} {/if}
             	<li id="{$tabs.widgetTabID}">{html->anchor href="/widget/tabs/wid/{$widgetID}/tid/{$tabs.widgetTabID}/" class="tab {$tstatus} icon-set-af" 
                content="<span class='drag handle'>
                <span class='line1'></span><span class='line1'></span><span class='line1'></span>
                </span>
                {$tabs.tabTitle}"}
{html->anchor title="{$language.lblDelete}" rel="{$widgetID}" tabID="{$tabs.widgetTabID}" class="delete-tab icon-set"}
		</li>
               {/foreach}
	        {/if}
		 {if $widgetID>0 }{*&& $widgetType=='default'*}<li class="note">
		{html->anchor href="/widget/tabs/wid/{$widgetID}"  class="icon-set-bf add-new-btn2" content="{$language.lblAddTab}"} 
		</li>{/if}
             </ul>
	</div>
	{form->start name="formWidget" action="" method="post"}
	{form->hidden name="postItemIds"}
	{form->hidden name="widgetID" value="{$widgetID}"}
	   <div class="wdgt-tab-cnt">
		<div class="inner_content_wrapper">
		<div id="common_message"></div>
        <div class="clearfix"><div class="fixing_right space-t-l">{include file='ContentLanguageOptions.tpl'}</div></div>
		  <div class="form_listing form_listing03">
			<ul>
			      <li class="clearfix">
				<div class="leftside01 mandatory">
					{$language.lblWidgetwidgetTitle}
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
					{form->textbox
						name="widgetTitle" 
						class="textbox" 
						tabindex="9"
						validate="required" 
						error="{$language.errWidgetwidgetTitleRequired}"}						
				</div>
				<!--End:right-->
				<li class="clearfix"><div class="leftside01 ">	{$language.lblShowTitle}				
				</div> <div class="rightside01 top-spc">
					
					{form->checkbox 
						name="showTitle" 
						value="Yes" 
						checked="{if isset($showTitle) && $showTitle=='Yes'}checked{/if}"}
                
				</div>	
			  </li>
	
				<!--{*<li class="clearfix">
				<div class="leftside01 mandatory">
					{$language.lblStaticWidget} 
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
					{form->radio 
						name="widgetType" 
						tabindex="5"
						options="default->Default~*static->Static"
						value="default"						
						} 
				</div>
				<!--End:right-->
			  </li>	
			      
			 <li class="clearfix" id="staticDiv">
				<div class="leftside01 mandatory">
					{$language.lblStaticContents}
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
			      {form->editor  
					validate="widgetType->isEqual->static~*required" 
					error=$language.errcontentRequire 
					mode="simple" skin=2 name="staticWidgetContent" 
					id="staticWidgetContent"   class="textarea" uploads="widgets"}
                       
				</div>
				<!--End:right-->
			  </li>
				*}-->
			 	     
			<li class="clearfix">
				<div class="leftside01 mandatory">
					{$language.lblWidgetwidgetDisplayedOn}
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
					{form->radio 
						name="widgetDisplayedOn" 
						tabindex="5"
						options="home->Home~*category->Category"
						value="home"
						class="displayOn"
						} 
				</div>
				<!--End:right-->
			  </li>			
			<li class="clearfix">
				<div class="leftside01 mandatory">
					{$language.lblWidgetPlatform}
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
					{form->radio 
						name="widgetPlatform" 
						tabindex="5"
						options="desktop->{$language.lblDesktop}~*mobile->{$language.lblMobile}~*mobileApp->{$language.lblMobileApp}"
						value="desktop"						
						} 
						</div>
				<!--End:right-->
			  </li>	
                                                 <li class="clearfix">
							<div class="leftside01 mandatory">
								{$language.lblMenuBrands}
							</div>
							<!--End:Left-->
							<div class="rightside01"> 
								{form->select style="width:28%;" class="select" name="brandID" caption="->{$language.lblSelect}" options=$listBrand validate="required" error=$language.errFranchisee}
							</div>
							<!--End:right-->
						  </li>
                           <li class="clearfix" id="typeDiv">
				<div class="leftside01">
					{$language.lblType}
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
					{form->radio 
						name="widget_type" 
						tabindex="5"
						options="product->{$language.lblProductWidget}~*banner->{$language.lblBanner}"
						} 
						</div>
				<!--End:right-->
			  </li>	
                           <li class="clearfix" id="bannerDiv">
                                <div class="rightside01"> 
<div>
                                         {form->hidden name="bannerIDs" value=$bannerIDs|default:''}
			{form->hidden name="type"}
			{form->hidden name="no_image_path" value="{$view_images}/thumbnail.gif"}
			{form->hidden name="image_path" value="{$view_public_path}/uploads/"}
                                                  {html->anchor priv_href="widget/loadBanner/{if $widgetID}id/{$widgetID}{/if}" href="widget/loadBanner/id/{if $widgetID}{$widgetID}{/if}" title="{$language.lblAddBanner}" class="add-new-loc" content="<span class='plus-v'></span> <span class='plus-h'></span><strong>{$language.lblAddBanner}</strong>"}
                                                  {if $resWidgetBanner}
                                                      
                                                  <ul id="contentList" style="display: block" class="item-list"> 
{foreach $resWidgetBanner as $widgetbanner}  
    <li class="clearfix pickerDataListCommon banner" id="{$widgetbanner.bannerID}" rel="{$widgetbanner.bannerID}">
        <div class="img-div"> 
   {if $widgetbanner.bannerSize=='Small'} 
       <img	src="{$view_public_path}/uploads/banner/thumb/{$widgetbanner['bannerImage']}" width="50"/> {else}
       <img	src="{$view_public_path}/uploads/banner/thumb/{$widgetbanner['bannerImage']}" width="100"/> {/if}
   </div>{$widgetbanner.bannerTitle}</li>
    {/foreach}
                    </ul>
                                                  {else}
                                                       <ul id="contentList" style="display: none" class="item-list">                    	                      
                    </ul>
                                                      {/if}
                                                      {form->hidden name="hidItem" value=""}	
                                                  
                                            </div>
                              
		
                                </div>
                             </li>
			<li class="clearfix hide" id="catDiv">
				<div class="leftside01 mandatory">
					{$language.lblCategories}
				</div>
				<!--End:Left-->
				<div class="rightside01 "> 
				 <div class="category-section pos-relative">
				  <div class="div-city">
                      <div class="fixed-section width_50per">
                          <h2>{$language.lblProductCategory}</h2>
                      {assign var="categoryValue" value=""}
				{form->textbox name="filterCategories" class="filterBrands text-box  margin-bottom" placeholder="Search Categories"}
                          </div>
				{assign var="categoryValue" value=""}
			        <ul  class="dragtree categoryList" id="categoryList">
							  

                <!--menu function-->
                 {function name=categories level=0 catValues=0}

                {foreach from=$data item="productCategory"} 
					
					 {if $productCategory.productCategoryStatus=='Inactive'}
				  {assign var="categoryName" value="<span class='inactive'>"|cat:$productCategory.productCategoryName|cat:"</span>"}              
				  {else}
				  {assign var="categoryName" value=$productCategory.productCategoryName} 
				  {/if}
					
		
                        <li  data-level="{$level}" category="{$productCategory.productCategoryID}" catname="{$productCategory.productCategoryName}" class="left-spacing {if $productCategory.productCategoryID==1} ui-state-disabled {/if} li_catIDs" >
                     
                           
                                  
							
									{if !(in_array($productCategory.productCategoryID, $categoryIDList|default:array()))}
                                    <span class="expand {if !(!empty($productCategory['children']) && is_array($productCategory['children']))}hide{/if}"></span>
									{else}
									<span class="expand colapse {if !(!empty($productCategory['children']) && is_array($productCategory['children']))}hide{/if}"></span>
									{/if}
																		  
									 {assign var="categoryValue" value=$catValues|cat:","|cat:$productCategory.productCategoryID}
										{*{if !(in_array($productCategory.productCategoryID, $categoryIDList|default:array()))}
										 {assign var="disable" value="disabled"}
										 {else}
										  {assign var="disable" value=""}
										 {/if}*}
                                                                        {form->checkbox   name="productCategoryID" class="categoryTree selectCheckBoxItems" id="category" options=$productCategory.productCategoryID|cat:"->"|cat:"&nbsp;"|cat:$categoryName value="{if in_array($productCategory.productCategoryID, $resWidgetcategory|default:array())}{$productCategory.productCategoryID}{/if}"} 
									{*form->checkbox   name="productCategoryID" class="categoryTree selectCheckBoxItems" id="category" options=$productCategory.productCategoryID|cat:"->"|cat:"&nbsp;"|cat:$categoryName value="{if $productCategory.productCategoryID|in_array:$resWidgetcategory}{$productCategory.productCategoryID}{/if}"*} 
																			<span class="hiddenTitle hide">	 
												{$productCategory.productCategoryName}
											</span>
                         
							{assign var="children" value=$productCategory['children']|default:''}
                             {if isset($productCategory['children']) && is_array($productCategory['children']) && !empty($productCategory['children'])}
                               <ul id="" class="categoryList {if !(in_array($productCategory.productCategoryID, $categoryIDList|default:array()))}hide {/if}"> 
                            {call name=categories data=$children level=$level+1 catValues=$categoryValue}  <!--menu function calling-->
                            </ul>
                          
                        {else}
                             {if (is_array($productCategory)) && (isset($productCategory['menuItemID'])) && (is_numeric($productCategory['menuItemID']))}
                        </li>	
                        {/if}
                    {/if}
            {/foreach}  
          {/function}
          {call categories data=$resCategories} <!--menu function calling-->
             	 </ul>  
</div>
				</div>				                           
			    {form->validate name="categorySelected" validate="widgetDisplayedOn->isequal->category~*required" error=$language.errSelectAnyCategory} 	
				
				</div>
				<!--End:right-->
			  </li>
			<li class="clearfix">
				<div class="leftside01">
					{$language.lblWidgetwidgetDescription}
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
					{form->textarea
						name="widgetDescription" 
						class="textarea" 
						tabindex="10"						
						} 
				</div>
				<!--End:right-->
			  </li>
			<li class="clearfix">
				<div class="leftside01">
					{$language.lblWidgetwidgetStartDate}
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
					{if isset($widgetStartDate) && $widgetStartDate!="0000-00-00"}
						{assign var="widgetStartDate" value="{$widgetStartDate|date_format:$date_format}"}
					{else}
                              {assign var="widgetStartDate" value=""}	
					{/if}
					{form->textbox
						name="widgetStartDate" 
						class="textbox date-field width_28per" 
						tabindex="1"
						validate="isDate" error=$language.errValidDate
						} 
				</div>
				<!--End:right-->
			  </li>
			<li class="clearfix">
				<div class="leftside01">
					{$language.lblWidgetwidgetEndDate}
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
					{if isset($widgetEndDate) && $widgetEndDate!="0000-00-00"}
						{assign var="widgetEndDate" value="{$widgetEndDate|date_format:$date_format}"}
					{else}
				    {assign var="widgetEndDate" value=""}
					{/if}
					{form->textbox
						name="widgetEndDate" 
						class="textbox date-field width_28per" 
						tabindex="2"
						
						} 
					{form->validate 
						name="StartEndDatecheck"  
						validate="hiddenStartEndDate->isequal->0~*required" 
						error=$language.errStartEndDate}
                    {form->hidden name="hiddenStartEndDate" value="2"}	
				</div>
				<!--End:right-->
			  </li>
			
			<li class="clearfix">
				<div class="leftside01 mandatory">
					{$language.lblWidgetstatus}
				</div>
				<!--End:Left-->
				<div class="rightside01"> 
					<div id="perioddiv">
					{form->radio 
						name="status" 
						class="customradio"
						tabindex="7"
						value="A"
						options="A->{$language.lblActive}~*I->{$language.lblInactive}" 
						} 
					</div>
				</div>
				<!--End:right-->
			  </li>
			{form->hidden name="isTab" value=''}
                        {form->hidden name="sortOrder" value=''}
			  <li class="clearfix">
				<div class="submit-block clearfix"> 
						<span>  </span>
						<div class="leftside01"> </div>
						<div class="rightside01">	
						{form->submit 
							name="submitWidget" 
							class="curve-3" 
							value="{if $widgetID>0}{$language.lblSave}{else}{$language.lblSave}{/if}"}
							{$language.lblOr}
							{html->anchor  href="widget/index/" content="{$language.lblCancel}"}
						
						 </div>
					</div>
				<!--End:right-->
			  </li>
			</ul>
		  </div>
		  <!--End:From Listing--> 
		</div>
		<!--End:Border 3--> 
	  </div>
	  <!--End:Border 2--> 
	  {form->close} 
	  </div>
  </div>
<!--*********************************************END CONTAINER SECTION******************************************************--> 
<!--End:Content Container--> 
{include file='CommonBottom.tpl'}
</div>
<!--End:Outer Container--> 
{include file='CommonJavaScriptBottom.tpl'} 
<script type="text/javascript" src="{$common_js}/validate.plugin.js"></script> 
{form->basepath_script}
{*{form->editor_script names="staticWidgetContent"}*}
{form->validate_script form='formWidget'}
{html->messages_script id="common_message"}
<script type="text/javascript">
var lblDelete			= '{$language.lblDelete}';
var msgConfirmDeletetab      = '{$language.msgConfirmDelete}';
</script>
<script type="text/javascript" src="{$view_javascript}/custom-radiobutton.js"></script>
<script type="text/javascript" src="{$view_javascript}/widgetAdd.page.js"></script>
<script type="text/javascript" src="{$view_javascript}/jquery.colorbox.js"></script>
<script type="text/javascript">
$('.tabSort').sortable({		
		items : "li:not(.note)",
		placeholder:'ui-sortable-placeholder',
		cursor:'move',
		handle: '.handle',
		update: function(event, ui) {
			var result = $(this).sortable('toArray');						 
			$("#postItemIds").val(result);
			}
	});
$(".tabSort").disableSelection();
	</script>
<script type="text/javascript">
{literal}
$(document).ready(function(){

$(".add-new-loc").colorbox({title:function(){var colorboxTitle=$(this).next("span").html();return colorboxTitle;},iframe:true, innerWidth:"80%", innerHeight:"80%", onClosed:function(){parent.$.colorbox.close();}});

});
{/literal}
</script>

</body>
</html>
