<!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.lblCampaignCalendar}</title>
      {include file='CommonStyles.tpl'}
      {include file='CommonJavaScript.tpl'}
      <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}/add-campaign.css" media="screen" />
      <link rel="stylesheet" href="{$view_styles}/chosen.css" type="text/css" />
      <link rel="stylesheet" type="text/css" href="{$view_styles}/colorbox.css" media="screen" />
      <style>
         #productListing{
         padding-top:10px;
         }
      </style>
   </head>
   <body>
      <div class="outer_container">
         {include file='CommonTop.tpl'}
         <!--End:Header Container--> 
         <!--**************************************START CONTAINER SECTION******************************************************-->
         <div class="content_container">
            <div class="content_wrapper">
               <h2>{$language.lblAddCampaign}</h2>
               <!--End: Right Block-->
               <div class="leftblock " style="width:100%">
                  <div class="shadow_outer">
                     <div class="shadow_inner" >
                        <div id="common_message" ></div>
                        <div class="add-campaign">
                           <div class="perioddiv customContent" >
                              <div class="fixing_right"> {include file='ContentLanguageOptions.tpl'}</div>
                              <label  for="productSelect">{$language.lblCustomContent}</label>
                              <input type="checkbox" name="productSelect" id="productSelect"   class="productSelect" name="productSelect" />
                           </div>
                           <div id="productListing">
                              <h2>{$language.lblSelectProduct}</h2>
                              <div class="search_container">
                                 {form->start name="formProductList" action="" method="post" enctype="multipart/form-data"}
                                 <div class="inner wide-box">
                                    <ul class="clearfix">
                                       <li class="column">
                                          <p class="label-field01">{$language.lblSelectCategory}</p>
                                          <span class="form-field01">
                                             <div class="multiple_selection" style="z-index:1000;">
                                                <select name="category[]" id="category" multiple="multiple" style="width:100%" class="multiple_select" data-placeholder="{$language.lblSelect}">
                                                {foreach from=$arrCategory item=category}
                                                <option value={$category[0]} {if in_array($category[0], $searchCategory)}selected="selected" {/if}>{$category[1]}</option>
                                                {/foreach}
                                                </select>
                                             </div>
                                          </span>
                                       </li>
                                       <li class="column">
                                          <p class="label-field01"> {$language.lblProductTitleSKU}</p>
                                          <span class="form-field01"> {form->textbox  name="productName" class="textbox" value=$productName}</span>
                                       </li>
                                       <li class="column search-btn">
                                          <p class="label-field01">&nbsp;</p>
                                          {form->submit  name="productSearch" value="{$language.lblProductSearch}" class="button01 "}
                                          {html->anchor href="campaign/index/"  caption="{$language.lblResetBanner}" class="action-link-reset"} 
                                       </li>
                                    </ul>
                                 </div>
                                 {form->close} 
                              </div>
                              {if $productsList|count>0}
                              <div class="product-listing">
                                 <ul>
                                    {if $productsList}
                                    {foreach from=$productsList item=productList key=i}
                                    {assign var="id" value=$productList.productTypeID|default:''}
                                    <li class="clearfix">
                                       <div class="column01">
                                          <div class="perioddiv">
                                             <span class="custom-radio"><input type="radio" productid={$productList.productID|default:""}  value="" id="product{$i}" class="productRadioSelect" name="productRadioSelect" /><label  for="product{$i}"></label></span>
                                          </div>
                                       </div>
                                       <div class="column02">
                                          <div class="inner-div">
                                             <div class="img-div">
                                                <div> <span imageSource="{$global_url}/public/uploads/catalog/product/small/{$productList.productImage|default:''}" style="display:none;"/> </span></div>
                                             </div>
                                             <div class="fst-row clearfix">
                                                <div class="product-time">
                                                   {if  $productList.productStartTime|default:''!='0000-00-00' }
                                                   {if $productList.productEndTime|default:''=='0000-00-00'}
                                                   {$language.lblFrom} 
                                                   {/if}
                                                   {$productList.productStartTime|default:''|date_format:$date_format} {$productList.productStartTime|default:''|date_format:$time_format} 
                                                   {/if}
                                                   {if $productList.productEndTime|default:''!='0000-00-00'} -  
                                                   {$productList.productEndTime|default:''|date_format:$date_format} {$productList.productEndTime|default:''|date_format:$time_format} {$productList.timeZoneName|default:''} 
                                                   {/if}
                                                </div>
                                                <div class="product_id_type"> <span class="{$productList.productTypeName|default:''}">
												
												{$language.lblProductSKUKey}: <span>{$productList['options'][0].optionSKU|default:''}</span> </span>{if $productList.productCategoryName|default:''} <span>{$language.lblBannerCategory}:</span>  <strong> {$productList.productCategoryName|default:''}</strong> {/if}</div>
                                             </div>
                                             <h4>{$productList.productTitle|default:''}</h4>
                                          </div>
                                       </div>
                                       <div class="clear"></div>
                                    </li>
                                    {/foreach}
                                    {else}
                                    <li>
                                       <div id="common_message"  class="message_info"> {$language.msgNoRecords}</div>
                                    </li>
                                    {/if}
                                 </ul>
                              </div>
                              {else}
								 <div id="common_message"  class="message_info"> {$language.msgNoRecords}</div>
							  {/if} 
							  
                           </div>
                           <!--End:Table Listing--> 
                           {form->start name="frmCreateBannerCampaign" action="" method="post" enctype="multipart/form-data"}
                           <div class="show-hide-div" id="productDetails" style="display:none;">
                              <div class="productInfo">
                                 <h2> <span class="changeproduct">{$language.lblChangeProduct}</span>{$language.lblProductInfo} </h2>
                                 <div class="clearfix product-details">
                                    <div class="img-div" id="image-div">
                                       <div align="center"><img src alt="Product Image" /></div>
                                    </div>
                                    <div class="column02">
                                       <div class="inner-div">
                                          <div class="product_id_type" id="product_id_type"> <span class="{$productList.productTypeName|default:''}">{$language.lblProductIDKey}: <span>{$productList.productKey|default:''}</span> </span> <span> {$language.lblBannerCategory} </span> <strong>{$language.lblBannerCategory}</strong></div>
                                          <h4 id="productTitle"> {html->anchor href="/product/show/id/{$productList.productID|default:''}/" content="{$productList.productTitle|default:''}"} </h4>
                                          <div class="product-time" id="product-time"> {$productList.productStartTime|default:''|date_format:$date_format} {$productList.productStartTime|default:''|date_format:$time_format} -  {$productList.productEndTime|default:''|date_format:$date_format} {$productList.productEndTime|default:''|date_format:$time_format} {$productList.timeZoneName|default:''} </div>
                                       </div>
                                    </div>
                                 </div>
                              </div>
                              {form->validate name="productID" validate="required" error="{$language.errSelectAnyProduct}"}
                              <h2>{$language.lblCampaignBannerInfo}</h2>
                              <div class="search_container">
                                 <div class="inner">
                                    <ul class="clearfix">
                                       <li class="column">
                                          <p class="label-field01">{$language.lblBannerNameDefault}</p>
                                          <span class="form-field01">{form->textbox name='bannerName' class="textbox" value=$banName|default:'' validate="required" error=$language.errBannerName error_class="message_inline_validation"}</span>
                                       </li>
                                       <li class="column">
                                          <p class="label-field01">{$language.lblStartDate}</p>
                                          <span class="form-field01">{form->textbox name='bannerStartDate' class="date-field" value=$banStartDate|date_format:$date_format    validate="required" readonly="readonly" error=$language.errCampaignStartDateReq error_class="message_inline_validation"}
                                          </span>
                                       </li>
                                       <li class="column">
                                          <p class="label-field01">{$language.lblEndDate}</p>
                                          <span class="form-field01">{form->textbox name='bannerEndDate'  class="date-field" value=$banEndDate|default:''|date_format:$date_format readonly="readonly"  validate="required~*callback_checkStartDate" error=$language.errCampaignEndDate|cat:"~*"|cat:$language.errStartEndDate  error_class="message_inline_validation"}
                                          </span>
                                       </li>
                                       <li class="column destinationURL">
                                          <p class="label-field01">Landing URL</p>
                                          <span class="">
                                          {form->textbox name='destinationURL' class="textbox" value="$siteUrl/" validate="required" error=$language.errLandingURL error_class="message_inline_validation"}
                                          <br/><br/>
                                          {html->anchor href="ajax/generatecataloglink/?id=destinationURL" id="generateCatalogLink" caption="{$language.lblImportCatUrl}" title="{$language.lblImportCatUrl}" class="linkbtnt01"}
                                          </span>
                                       </li>
                                    </ul>
                                 </div>
                              </div>
                              <h2>{$language.lblSelectTemplate}</h2>
                              <div class='search-section' style="padding:10px">
                                 <div class="perioddiv">
                                    {foreach from=$templateDesign item=template key=i}  <span class="custom-radio"><input type="radio"  values="" value="{$template['id']}" id="design{$template['id']}" class="designSelect" name="design" /><label  for="design{$template['id']}">{$language[{$template['lblLabel']}]}</label></span> {/foreach}
                                 </div>
                              </div>
							   {form->validate name="templateSelected" validate="required" error="{$language.errSelectTemplate}" error_class="message_error"}
                              <div class="banner-size" id="bannerSize">
                              </div>
                           </div>
                           <!--End:Show Hide Div--> 
                           {form->close} 
                        </div>
                     </div>
                     <!--End:Border 3--> 
                  </div>
                  <!--End:Border 2--> 
               </div>
               <div  > </div>
            </div>
         </div>
         <!--***************************************END CONTAINER SECTION******************************************************--> 
         <!--End:Content Container--> 
         {include file='CommonBottom.tpl'}
      </div>
      <!--End:Outer Container--> 
      {form->rootpath_script}
      {form->basepath_script}
      {html->messages_script id="common_message"}
      {include file='CommonJavaScriptBottom.tpl'} 
      <script type="text/javascript">
         var currDate="{$date|date_format:$settingsDateFormat}";
         var errEndDate="{$language.errCampaignEndDate}";
      </script> 
      <script type="text/javascript" src="{$view_javascript}/jquery.colorbox.js"></script>
      <script type="text/javascript" src="{$common_js}/validate.plugin.js"></script> 
      <script type="text/javascript" src="{$common_js}/jquery-ui-1.10.2.custom.min.js"></script>
      <script type="text/javascript" src="{$view_javascript}/jquery-ui-timepicker-addon.js"></script> 
      <script type="text/javascript" src="{$view_javascript}/custom-radiobutton.js"></script> 
      <script src="{$view_javascript}/chosen.pluggin.js"></script>
      <script type="text/javascript" src="{$view_javascript}/campaignNew.page.js"></script> 
      <script type="text/javascript">
         $(document).ready(function(){
         {if $productID|default:''>0} 
         	$(".productRadioSelect[productid={$productID|default:''}]").trigger('click');
         {else if $productID|default:''==0 }
         if(sessionStorage.productSelect==1){
         	$("#productID").val('');
         	$("#productDetails").hide();
         	$("#productListing,.productInfo").show();
         	$(".destinationURL").hide();
         	$("#productSelect").prop('checked',false);
         	$("[for=productSelect]").removeClass('checked');
         	}
         else{
         	$("#productID").val(0);
         	$("#productDetails").show();
         	$("#productListing,.productInfo").hide();
         	$(".destinationURL").show();
         	$("#productSelect").prop('checked',true);
         	$("[for=productSelect]").addClass('checked');
         	}
         {/if} 
         {if $validateEndDate|default:''}
         	$("#div_err_frmCreateBannerCampaign_validateToDate").removeClass('hide').find('span').html("{$validateEndDate}");
         {/if}
         {if $design|default:''>0} 
         	$(".designSelect[value={$design}]").attr('values','{$bannersizes|default:''}').trigger('click');
         {/if} 
         });
      </script> 
      {form->validate_script form="frmCreateBannerCampaign"}
      <script type="text/javascript">
         {literal}
         $(document).ready(function(){
         	$("#generateCatalogLink").colorbox({iframe:true, width:"80%", height:"80%"});
         });	
         {/literal}
      </script>
   </body>
</html>