<!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.lblAffiliate} : {$language.lblWidgets}</title>
{include file='CommonStyles.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/create-widget.css"/>
<link rel="stylesheet" type="text/css" href="{$view_styles}/ui.daterangepicker.css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/chosen.css" />
{include file='CommonJavaScript.tpl'}
</head>
<body>
<!-- Outer container starts-->
<div class="outer_container"> 
  <!-- Header Container starts--> 
  {include file='CommonTop.tpl'} 
  <!-- Header Container ends--> 
  <!-- Content Container starts-->
  <div class="content_container2"> 
    <!-- left wrapper starts-->
    <div class="left_wrapper">
      <div class="content_wrapper">
        <h2>{$language.lblWidgets}</h2>
        <!-- Inner Content Container starts-->
        <div class="inner_content_wrapper"> 
          <!-- Search container starts -->
          <div class="search_container">
            <div class="inner"> {form->start action="" method="post" name="formWidgetSearch" value="formWidgetSearch"}
              {form->hidden id="searchAlert" name="searchAlert" value=$language.lblSearchAlert}
              <table width="100%" border="0" cellspacing="0" cellpadding="0"   >
                <tr>
                  <td width="10%"  align="left" valign="middle" class="left">{$language.lblWidgetName}</td>
                  <td width="23%"  align="left" valign="middle"><div class="textfield">
                      <div class="text-box-div">{form->textbox name="widgetName" type="text" class="text-box"} </div>
                    </div></td>
                  <td width="11%"  align="left" valign="middle" class="left">{$language.lblWidgetType}</td>
                  <td width="20%"  align="left" valign="middle"><div class="textfield">{form->select 
	 options="->"|cat:$language.lblAny|cat:"~*Iframe->"|cat:$language.lblIframe|cat:"~*JS->"|cat:$language.lblJS class="select-box" id="widgetType" name="widgetType"} </div></td>
                  <td width="10%" align="left" valign="middle" class="left" >{$language.lblWidgetContentType}</td>
                  <td width="20%" align="left" valign="middle" >{form->select options="->"|cat:$language.lblAny|cat:"~*Image_With_Text->"|cat:$language.lblImageWithText|cat:"~*Text_Only->"|cat:$language.lblTextOnly class="select-box" name="contentType" id="contentType"} </td>
                </tr>
                <tr>                 
					<td width="10%" align="left" valign="middle" class="left">{$language.lbldate}</td>
                  <td width="23%" align="left" valign="middle"><div class="textfield">
                      <div class="text-box-div-date"> {form->textbox name="daterange" type="text" id="daterange" class="date-field" readonly="true"} </div>
                    </div></td>	
                  <td width="11%" align="left" valign="middle" class="left">{$language.lblProductCategory}</td>
                  <td width="20%" align="left" valign="middle"><div class="textfield">{form->select name="widgetCategory" options=$resCategoryTree class="widgetCategory" style="width:100%" multiple="multiple" value=$selectedWidgetCategory}</div></td>    				  
                  <td width="11%" align="left" valign="middle" class="left">{$language.lblVisitorLocation}</td>
                  <td width="20%" align="left" valign="middle"><div class="textfield">
                      <div class="text-box-div"> {form->textbox name="visitorLocation" id="visitorLocation" class="text-box"} </div>
                    </div></td>
                </tr>
                <tr>                  
                  <td width="10%" align="left" valign="middle" colspan="5">&nbsp;</td>
                  <td width="21%" align="left" valign="middle" class="padding-r-10">{form->submit name="formSearch" id="formSearch" value=$language.lblSearch class="button01"}
                    {html->anchor href="/widget/index/" class="action-link" caption=$language.lblResetFields}</td>
                </tr>
              </table>
              <div class="clear"></div>
              {form->close}
              <div class="clear"></div>
            </div>
          </div>
          {if $resWidgetDetails}
          <div id="common_message" ></div>
          <!--End:Search container--> 
          {form->start name="formWidget" id="formWidget" action="" method="post" enctype="multipart/form-data"} <a class="link-style01 fixing_right" href="export/1/">{$language.lblExportToCsv}</a>
          <div class="clear"></div>
          <div class="grid01"> {if $sortkey=="asc"}
            {assign var="sortimg" value="sortdesc"} 
            {else}  
            {assign var="sortimg" value="sortasc"}
            {/if}
            {if $sortkey1=="asc"}
            {assign var="sortimg1" value="sortdesc"} 
            {else}  
            {assign var="sortimg1" value="sortasc"}
            {/if}
            {if $sortkey2=="asc"}
            {assign var="sortimg2" value="sortdesc"} 
            {else}  
            {assign var="sortimg2" value="sortasc"}
            {/if}
            {if $sortkey3=="asc"}
            {assign var="sortimg3" value="sortdesc"} 
            {else}  
            {assign var="sortimg3" value="sortasc"}
            {/if}
            {if $sortkey4=="asc"}
            {assign var="sortimg4" value="sortdesc"} 
            {else}  
            {assign var="sortimg4" value="sortasc"}
            {/if}
            {if $sortkey5=="asc"}
            {assign var="sortimg5" value="sortdesc"} 
            {else}  
            {assign var="sortimg5" value="sortasc"}
            {/if}
            {if $sortkey6=="asc"}
            {assign var="sortimg6" value="sortdesc"} 
            {else}  
            {assign var="sortimg6" value="sortasc"}
            {/if}
            {if $sortkey7=="asc"}
            {assign var="sortimg7" value="sortdesc"} 
            {else}  
            {assign var="sortimg7" value="sortasc"}
            {/if}
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="grid_table00">
              <thead>
                <tr class="sort">
                  <th align="left" valign="middle"  class="checkbox_column" width="41"> <div class="chekingdiv"> <ul>
                    <li>
                      {form->checkbox id="ListStatusLinkCheckbox" name="ListStatusLinkCheckbox"}
                     {html->anchor href="" id="ListStatusLink" class="status-arw fixing_left"}
                        <ul id="ListStatusSelection"  class="check_status">
                          <li> {html->anchor href="" rel="ListActive" content="{$language.lblActive}"}</li>
                          <li> {html->anchor href="" rel="ListInactive" content="{$language.lblInactive}"}</li>
                          <li> {html->anchor href="" rel="ListAll" content="{$language.lblSelectAll}"}</li>
                        </ul>
                    </li>
                  </ul> </div></th>
                  <th width="15%" align="left" valign="middle" {if $sortkey!=""}class={$sortimg}{else}class="sort" {/if}>{html->anchor href="{$links}sortby/name/orderby/{if $sortkey==''}desc{else}{$sortkey}{/if}/" title=$language.lblName content=$language.lblName}</th>
                  <th width="15%" align="left" valign="middle" {if $sortkey1!=""}class={$sortimg1}{else}class="sort" {/if}>{html->anchor href="{$links}sortby/date/orderby/{if $sortkey1==''}desc{else}{$sortkey1}{/if}/" title=$language.lblCreatedDate content=$language.lblCreatedDate}</th>
                  <th width="7%" align="left" valign="middle"  {if $sortkey2!=""}class={$sortimg2}{else}class="sort" {/if}>{html->anchor href="{$links}sortby/hits/orderby/{if $sortkey2==''}desc{else}{$sortkey2}{/if}/" title=$language.lblHits content=$language.lblHits}</th>
                  <th width="12%" align="left" valign="middle"  {if $sortkey3!=""}class={$sortimg3}{else}class="sort" {/if}>{html->anchor href="{$links}sortby/subscription/orderby/{if $sortkey3==''}desc{else}{$sortkey3}{/if}/" title=$language.lblSubscriptions content=$language.lblSubscriptions}</th>
                  <th width="12%" align="left" valign="middle"  {if $sortkey4!=""}class={$sortimg4}{else}class="sort" {/if}>{html->anchor href="{$links}sortby/registration/orderby/{if $sortkey4==''}desc{else}{$sortkey4}{/if}/" title=$language.lblRegistrations content=$language.lblRegistrations}</th>
                  <th width="14%" align="left" valign="middle"  {if $sortkey5!=""}class={$sortimg5}{else}class="sort" {/if}>{html->anchor href="{$links}sortby/order/orderby/{if $sortkey5==''}desc{else}{$sortkey5}{/if}/" title=$language.lblOrderAmount content=$language.lblOrderAmount}</th>
                  <th width="15%" align="left" valign="middle"  {if $sortkey6!=""}class={$sortimg6}{else}class="sort" {/if}>{html->anchor href="{$links}sortby/revenue/orderby/{if $sortkey6==''}desc{else}{$sortkey6}{/if}/" title=$language.lblRevenueGenerated content=$language.lblRevenueGenerated}</th>
                  <th width="15%" align="left" valign="middle"  {if $sortkey7!=""}class={$sortimg7}{else}class="sort" {/if}>{html->anchor href="{$links}sortby/status/orderby/{if $sortkey7==''}desc{else}{$sortkey7}{/if}/" title=$language.lblStatus content=$language.lblStatus}</th>
                </tr>
              </thead>
              <tbody>
              {foreach from=$resWidgetDetails item="widgetList" key="key1"}
              <tr>
                <td align="left" valign="top" class="checkbox_column"> {form->checkbox name="checkWidgetIDs[]" class="check" class="checkbox01 ListAll List"|cat:$widgetList.widgetStatus value=$widgetList.affiliateWidgetDetailID}</td>
                <td align="left" valign="middle">{html->anchor href="widget/show/id/"|cat:$widgetList.affiliateWidgetDetailID|cat:"/{if $visitorLocation}visitorLocation/$visitorLocation/{/if}" caption=$widgetList.widgetName|cat:"<br />["|cat:$widgetList.languageName|cat:"]"}</td>
                <td align="left" valign="middle">{$widgetList.affiliateWidgetCreatedDate|date_format:$settingsDateFormat} {$widgetList.affiliateWidgetCreatedDate|date_format:$settingsTimeFormat} </td>
                <td align="left" valign="middle">{$widgetList.hits}</td>
                <td align="left" valign="middle">{$widgetList.countSubscription}</td>
                <td align="left" valign="middle">{$widgetList.countRegistration}</td>
                <td align="right" valign="middle">{$widgetList.orderAmount|price}</td>
                <td align="right" valign="middle">{$widgetList.revenueAmount|price}</td>
                <td align="left" valign="middle">{if $widgetList.widgetStatus=='Active'}<span class="status_approved">{$language.lblActive}</span>{/if}{if $widgetList.widgetStatus=='Inactive'}<span class="status_suspended">{$language.lblInactive}</span>{/if}</td>
              </tr>
              {/foreach}
                </tbody>
            </table>
            <div class="fixing_left width-140">{form->select id="changeStatus" class="change-status" name="changeStatus" options="->"|cat:{$language.lblDonotchange}|cat:"~*Active->{$language.lblActivate}~*Inactive->{$language.lblInactivate}"}</div>
            {form->submit name="submitWidgetStatus" class="button02 fixing_left  margin-l-8" value="{$language.lblUpdate}" id="submitWidgetStatus"}
            <div class="pagination_outer fixing_right">{paginate->layout  key="page" label_record="{$language.lblRecorsFound}" label_pages="{$language.lblPages}"}</div>
            <div class="clear"></div>
          </div>
          {else}
          <div class="clear"></div>
          <div class="grid01 message_info"> {$language.msgNoRecords} </div>
          {/if} </div>
        <!-- Inner Content Container ends-->
        <div class="clear"></div>
      </div>
    </div>
    <!-- left wrapper ends--> 
    <!-- right side bar starts-->
    <div class="right-sidebar">
      <div class="side_wrapper"> {html->anchor class="create-widjet" href="/widget/create/" content="<span class='plus-v'></span><span class='plus-h'></span> <strong>"|cat:$language.lblCreateWidget|cat:"</strong>"} 
        <!-- right side menu starts--> 
        {include file="WidgetManagementSideMenu.tpl"} 
        <!-- right side menu ends--> 
      </div>
    </div>
    <!-- right side bar ends-->
    <div class="clear"></div>
  </div>
  <!-- Content Container ends--> 
  <!-- Footer starts--> 
  {include file='CommonBottom.tpl'} 
  <!-- Footer ends--> 
</div>
<!-- Outer container ends--> 
<script type="text/javascript" src="{$view_javascript}/message.plugin.js"></script> 
<script type="text/javascript" src="{$view_javascript}/chosen.pluggin.js"></script> 
<script type="text/javascript" src="{$view_javascript}/table.plugin.js"></script> 
<script>
var msgSelectItem="{$language.msgSelectItem}";
var lblSelectAction ="{$language.lblSelectAction}";

var d 		= new Date();
var nd 		= new Date(d.getFullYear(),d.getMonth(),d.getDate()+1,d.getHours()-1,d.getMinutes(),d.getSeconds());	
{literal}
 $(function(){	  
	 $('#daterange').daterangepicker({arrows: false,presets:{		
			specificDate: 'Specific Date', 
			dateRange: 'Date Range'
		},presetRanges: [
			{text: 'Today', dateStart: 'today', dateEnd: 'today' },
			{text: 'Last 7 days', dateStart: 'today-7days', dateEnd: 'today' },
			{text: 'Month to date', dateStart: function(){ return Date.parse('today').moveToFirstDayOfMonth();  }, dateEnd: 'today' },
			{text: 'Previous Month', dateStart: function(){ return Date.parse('1 month ago').moveToFirstDayOfMonth();  }, dateEnd: function(){ return Date.parse('1 month ago').moveToLastDayOfMonth();  } }

		],latestDate:nd,dateFormat:datePickerDateFormat,placeHolder:'dateOverView',rangeDays:90,rangeSplitter:'-',datepickerOptions: {maxDate:nd}});
	});
	
$('.ui-daterangepicker-dateRange').addClass('ui-state-active');	

$(document).ready(function(e) {
$('.side_menu').find("a[rel='widget']").addClass('selected').removeBorder();
$('.main_menu').find("a[rel='manageWidget']").addClass('active');
});
$("#submitWidgetStatus").click(function(){
                   var ListAllCheckedCount = $(".ListAll:checked").size(); 
				   var widgetStatus= $('#changeStatus').val();
		   if($(".ListAll:checked").size()==0){
			   jAlert(msgSelectItem);
                           return false;
		   } else if(widgetStatus==""){
			   jAlert(lblSelectAction);
                           return false; 
		   }
			else	{
                            return true;
                    }
                    return false;
         });
$(".select-box").chosen();
$(".widgetCategory").chosen();
$("#formSearch").click(function()
{
		if($.trim($('#widgetName').val())=="" && $('#contentType').val()=="" && $('#widgetType').val()==""   && $.trim($('#visitorLocation').val())==""  && $('#daterange').val()=="" && $('#widgetCategory_chzn ul.chzn-choices li').length==1)
		{
			jAlert($("#searchAlert").val());
                           return false;
		}
                            return true;  
 });

</script> 
{/literal}
{html->messages_script id="common_message"}
</body>
</html>