<!DOCTYPE html>  
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
<title>{$language.lblBusiness} :{$language.lblMenuManageProducts} :{$language.lblProductsRequest}</title>
{include file='CommonStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/product-listing.css" media="screen" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/chosen.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" /> 
{form->basepath_script}
{form->rootpath_script}
</head> 
<body class="{$languageDirection}">
<div id="main" class="outer">
    {include file='CommonHeader.tpl'} 
  <!--***********************************************************************START CONTAINER SECTION******************************************************-->
  <div class="content-wrapper">
      <div class="container-fluid">
          <div class=" clearfix">
        <noscript>
        <div class="message_info">{$language.lblJsEnable} !!</div>
        </noscript><div class=" fixing_right">
       </div>
        
        <div id="common_message"></div>
        <!-- Inner Content Container starts-->
        <div class="inner_content_wrapper"> 
          <!-- Search container starts -->
            <div class="container-section search-wrapper ">
                {if $settingsBuyboxEnable|default:'' eq "Yes"}
                    {assign var="productAddAction" value="add"}
                {else}
                    {assign var="productAddAction" value="new"}
                {/if}
                 {html->anchor href="/product/{$productAddAction}/" class="add-btn  btn btn-primary bt-sm margin-horizontal pull-right" content="<span class='icon-plus2'></span> {if $requestReviewSettings=='Yes'} {$language.lblAddProductRequest}{else}{$language.lblAddProduct}{/if}"}
                <h3 class="border-bottom">{$language.lblProductsRequest}</h3>
          {form->start name="frmSearchProducts" action="/product/request/" method="post"}         
          <div class="search_container content-block clearfix">
            <div class="inner">
              <div class="row">
                <div class="form-group col-xs-12 col-sm-3">
                  <label>{$language.lblProductIDTitle}</label>
                  <span class="form-field01"> {form->textbox name="searchProductName" class="form-control"} </span> 
                  </div>
               <div class="form-group col-md-3 col-xs-12">  
                  <label>{$language.lblDate}</label>
                  <span class="form-field01">
                      <div class="text-box-div-date">
                          {form->textbox name="searchProductDate" class="date-picker form-control" readonly="readonly"} </div>
                   </span>
                </div>
				<div class="form-group col-md-3 col-xs-12">  
                  <label class="label-field01">{$language.lblStatus}</label>
                  <span class="form-field01">
                       {form->select class="form-control" name="productStatus" options="{$language.lblPending}~*{$language.lblRejected}"} </span>
                </div>
                <div class="col-md-3 col-xs-12">
                   <label>&nbsp;</label>
                  {form->hidden name="searchOption" value="basic"}
                  {form->submit name="submitProductSearch" id="submit" class="btn btn-primary btn-sm"  value=$language.lblSearch}
				   {html->anchor href="/product/request/" class="action-link" content="{$language.lblListAll}"}
				</div>
              </div>
            </div>
          </div>
          {form->close} 
              </div>
          <!-- Search container ends --> 
          {if $resProducts|@count>0} 
          <!-- sort by starts -->
            <div class="container-section">
          <div class=" clearfix">
	   
            <div class="sort_links border-bottom clearfix {if $sortByOption==''}right-pos {/if}"> 
            
            <div class="pull-left left">
                {include file='ContentLanguageOptions.tpl'}
            </div>

            <span class="sort-link"></span> 
			{if $sortByOption=='skey'}
              {assign var="sortLabel" value=$language.lblProductID}
              {elseif $sortByOption=='stitle'}                	
              {assign var="sortLabel" value=$language.lblProductTitle}
              {elseif $sortByOption=='screated'}
              {assign var="sortLabel" value=$language.lblRecency}
              {/if} 
              
              {if $sortByOrder=='asc' || $sortByOrder==''}
              {assign var="sortOrderAsc" value="active"}
              {assign var="sortOrderDesc" value="inactive"}
              {else}
              {assign var="sortOrderAsc" value="inactive"}
              {assign var="sortOrderDesc" value="active"}
              {/if} 
                <span class="sortby-list btn btn-default pull-right"> 
                    {if $sortByOption==''}  
                    {$language.lblSortby} 
                    <span class="caret"></span>
                </span> {else}{$sortLabel} </span>{html->anchor class="asnd {$sortOrderAsc}" href="product/request/{$link}/sortby/{$sortByOption}/orderby/asc/" content="<span class='arw'></span> <span class='line'></span>"}
              {html->anchor  class="dsnd {$sortOrderDesc}" href="product/request/{$link}/sortby/{$sortByOption}/orderby/desc/"
              content="<span class='line'></span> <span class='arw'></span>"}
              {/if}
              <ul class="sort_links_ul" >
                <li>{html->anchor href="product/request/$link/sortby/stitle/orderby/$sortByOrderProductTitle/" title="{$language.lblProductTitle}" content="{$language.lblProductTitle}"} </li>
                <li>{html->anchor href="product/request/{$link}/sortby/screated/orderby/$sortByOrderDate/" title="{$language.lblRecency}" content="{$language.lblRecency}" class=$cnewlyadded|default:''} </li>
              </ul>
            </div>
             
          </div>
         
          <!-- sort by ends --> 
          <!--Start: Product List--> 
          {form->start name="formProduct" action="" method="post" enctype="multipart/form-data"}
          
         {if $profileStatus|default:''!='yes'}
        {assign var="flag" value="yes"}
           <div class="message_info">{$language.lblBusinessProfile}
           {html->anchor href="/user/edit/" rel="" caption="{$language.lblEditProfile}" class="" style="float:right"} 
           </div>
    {elseif $agreeBusiness|default:''!='yes'}
        {assign var="flag" value="yes"}
           <div class="message_info">{$language.lblMerAgremnt}</div>
    {else}
        {assign var="flag" value="No"}
    {/if}
         
          {if $settingEditProduct=='Yes' && $flag|default:''=='No'}
		{assign var="disabledTxt" value="disabled"}	 
		  {else}
		  {assign var="disabledTxt" value="disabled"}			 
		  {/if}
           
			<div class="grid_table00 product-list"> 
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-bordered"  >
					<thead>
						<tr>
						
						<th align="left" valign="middle" colspan="2">
                            <label for="ListStatusLinkCheckbox">{$language.lblProduct}</label>
						</th>
						
						<th align="left" valign="middle" width="9%"><label>{$language.lblItemPrice}</label></th>
						<th align="left" valign="middle" width="9%"><label>{$language.lblSalePrice}</label></th>
						<th align="left" valign="middle" width="7%"><label>{$language.lblQuantity}</label></th>
						
						</tr>
					</thead>
					<tbody>
                        {assign var="checkboxCounter" value="1"}
						{foreach from=$resProducts item="resProductList" key="key"}
								
							{assign var="productID" value=$resProductList.productID}
							{assign var="defaultOptionID" value=$resProductList["options"][0]["productOptionID"]|default:''}
							{assign var="defaultOption" value=$resProductList["options"][0]|default:''}
							{if $resProductList.multiOptionsAvailable eq "No"}
								{if $optionIDsString|default:'' != ''}
									{assign var="optionIDsString" value=$optionIDsString|cat:"_"|cat:$defaultOptionID}
								{else}
									{assign var="optionIDsString" value=$defaultOptionID}
								{/if}
							{/if}
							<tr {if $resProductList.productStatus=='Inactive'}class="active inactive-txt fixing_right"{/if} >
                                
							<td align="left" valign="middle" colspan="2" >
                                <div style="min-width:370px";>
                                    {if $resProductList.productImage neq ''}
							<figure><img src="{$view_public_path}/uploads/catalog/product/small/{$resProductList.productImage}" class=" img-responsive" /></figure>
                                                        {else}
                              <figure>  <img src="{$view_images}/{$resProductList.medicineType}.png" alt="{$resProductList.medicineType}" class="fixing_left pd-img" /></figure>
                                                       
                                                        {/if}
							
							<div class="pdt-details">
                                {html->anchor history="yes" href="/product/show/id/{$resProductList.productID}/" class="normal_link" content="{$resProductList.productTitle|truncate:120}"} <br />
							<span class="pd-time">{$resProductList.productCreatedDate|date_format:$date_format} {$resProductList.productCreatedDate|date_format:$time_format}</span>
                                <span class="sku">{$language.lblSKU} : {$defaultOption.optionSKU}</span>
                                <span class="edit">
                                    {assign var="href" value="/product/show/id/"|cat:$resProductList.productID|cat:"/"}
							{if $settingEditProduct=='Yes' && $flag|default:''=='No'}
								{html->anchor href="/product/edit/id/"|cat:$resProductList.productID|cat:"/" title="{$language.lblEdit}" content="<span class='icon-edit-fill'></span> {$language.lblEdit}" class="btn btn-default btn-xs rmv-padding-bottom"}
                               {else}
                               {html->anchor href="{$href}" title="view" class="deal-preview icon-set preview"}
							{/if}
							
							{if $resProductList.options|@count>1 || $resProductList.combination|default:array()|@count>0}
                               {html->anchor  class="icon-plus2 viewOptions add01" rel=$productID}
                            {/if}
                                </span>
							</div>
							</div>
							</td>
				
                            
							<td align="left" valign="middle">
							{if $resProductList.multiOptionsAvailable eq "Yes" || $resProductList.combination|default:array()|@count>0}
								<span class="text-box2"> <label>{$defaultOption.productOptionRegularPrice|price:'':$resProductList.productDefaultCurrency:$resProductList.productDefaultCurrency}</label></span>
							{else}
								{form->textbox value=$defaultOption.productOptionRegularPrice 
								name="itemPrice_"|cat:$defaultOptionID 
								class="form-control"
								validate="required~*isPrice"
								disabled=$disabledTxt
								error = $language.errRequired|cat:"~*"|cat:$language.errValidRateShort|cat:"~*"|cat:$language.errRegularProductPrice}	
							{/if}
							</td>
							<td align="left" valign="middle">
							{if $resProductList.multiOptionsAvailable eq "Yes" || $resProductList.combination|default:array()|@count>0}
								<span class="text-box2">
                                <label>{$defaultOption.productOptionProductPrice|price:'':$resProductList.productDefaultCurrency:$resProductList.productDefaultCurrency}</label></span>
							{else}
								{if $defaultOption.productOptionProductPrice==$defaultOption.productOptionRegularPrice}
									{form->textbox value=''
									name="salePrice_"|cat:$defaultOptionID 
									class="form-control"
									disabled=$disabledTxt
									validate="isPrice~*salePrice_"|cat:$defaultOptionID|cat:"->isnotequal->~*salePrice_"|cat:$defaultOptionID|cat:"->lt->itemPrice_"|cat:$defaultOptionID|cat:""
									error = $language.errValidRateShort|cat:"~*~*"|cat:$language.errProductsalePrice
									}
								{else}
									{form->textbox value=$defaultOption.productOptionProductPrice 
									name="salePrice_"|cat:$defaultOptionID 
									class="form-control"
									disabled=$disabledTxt
									validate="isPrice~*salePrice_"|cat:$defaultOptionID|cat:"->isnotequal->~*salePrice_"|cat:$defaultOptionID|cat:"->lt->itemPrice_"|cat:$defaultOptionID|cat:""
									error = $language.errValidRateShort|cat:"~*~*"|cat:$language.errProductsalePrice
									}
								{/if}
							{/if}
							</td>
							<td align="left" valign="middle">
								{if $resProductList.InventoryTrackLevel=='No'}
									<span class="form-control"> <label>{$language.lblUnlimited}</label></span>
								{else}
									<span class="form-control"> <label>{$resProductList.quantityString}</label></span>
									
								{/if}
							</td>
							
                            
							</tr>
							 {assign var="checkboxCounter" value=$checkboxCounter+1}	
							{if $resProductList.options|@count>1} 
                           
								{foreach from=$resProductList.options item="options" key="key1"}
								{assign var="productOptionID" value=$options.productOptionID}
								{if $optionIDsString|default:'' != ''}
									{assign var="optionIDsString" value=$optionIDsString|cat:"_"|cat:$productOptionID}
								{else}
									{assign var="optionIDsString" value=$productOptionID}
								{/if}
									<tr class="details_{$productID} pd-option" style="display:none;">
									<td  align="left" valign="middle" >
                                     
                                     {if $options.productOptionStatus=='Inactive'}<span class="inactive-txt fixing_right">{$options.productOptionStatus}</span>{/if}
									<span class="pd-title"><strong>{$options.productOptionName|truncate:80} </strong></span>
                                   
									</td>
									<td align="left" valign="top">
									{form->textbox value=$options.optionSKU disabled=$disabledTxt 
									validate="required~*callback_checkOptSKUexist" error = $language.errRequired|cat:"~*"|cat:$language.errSkuExists 
									name="optionSKU_"|cat:$productOptionID class="form-control"}	
									</td>
									<td align="left" valign="top">
									{form->textbox value=$options.productOptionRegularPrice 
									name="itemPrice_"|cat:$productOptionID  class="form-control"
									validate="required~*isPrice"
									disabled=$disabledTxt
									error = $language.errRequired|cat:"~*"|cat:$language.errValidRateShort|cat:"~*"|cat:$language.errRegularProductPrice}	
									</td>
									<td align="left" valign="top">
									{if $options.productOptionProductPrice==$options.productOptionRegularPrice}
										{form->textbox value=''
										name="salePrice_"|cat:$productOptionID  class="form-control"
										disabled=$disabledTxt
										validate="isPrice~*salePrice_"|cat:$productOptionID|cat:"->isnotequal->~*salePrice_"|cat:$productOptionID|cat:"->lt->itemPrice_"|cat:$productOptionID|cat:""
										error = $language.errValidRateShort|cat:"~*~*"|cat:$language.errProductsalePrice
										}

									{else}
										{form->textbox value=$options.productOptionProductPrice 
										name="salePrice_"|cat:$productOptionID  class="form-control "
										disabled=$disabledTxt
										validate="isPrice~*salePrice_"|cat:$productOptionID|cat:"->isnotequal->~*salePrice_"|cat:$productOptionID|cat:"->lt->itemPrice_"|cat:$productOptionID|cat:""
										error = $language.errValidRateShort|cat:"~*~*"|cat:$language.errProductsalePrice
										}
									{/if}
									</td>
									<td align="left" valign="top">
									{if $resProductList.InventoryTrackLevel=='No'}
										{$language.lblUnlimited}
									{else if $resProductList.InventoryTrackLevel=='Product'}
										{form->textbox value=$options.productOptionQuantity disabled=$disabledTxt 
										name="optionQuantity_"|cat:$productOptionID  class="form-control" validate="isWholeNumberWithZero" error=$language.errValidQunatity}	
									{/if}
									</td>
									
									</tr>
								{/foreach}
							{/if}
			{if $resProductList.combination|default:array()|@count>0}
              {*<tr class="details_{$productID} pd-option" style="display:none;">
                               <td  align="left" valign="middle" class="pd-lf-td" width="1%"></td>
                                <td  align="left" valign="middle" colspan="6"  class="pd-tp-td"></td>
                                <td  align="left" valign="middle" class="pd-lf-td" width="1%"></td>    
                            </tr> *}
								{foreach from=$resProductList.combination|default:array() item="combination" key="key2"}
								{assign var="combinationID" value=$combination.combinationID|default:0}
								{if $combinationIDsString|default:'' != ''}
									{assign var="combinationIDsString" value=$combinationIDsString|cat:"_"|cat:$combinationID}
								{else}
									{assign var="combinationIDsString" value=$combinationID}
								{/if}								
									<tr class="details_{$productID} pd-option" style="display:none;">
                                        {*<td  align="left" valign="middle" class="pd-lf-td" width="1%"></td>*}
									<td  align="left" valign="middle">
                                    
                                   {if $combination.status=='I'}
				   <span class="inactive-txt fixing_right">									
					{$language.lblInactive}
				    </span>
				   {/if}
					[{$combination.ProductCombo}]
									
									
									</td>
                                    
									<td align="left" valign="top" width="120">
                                        <div style="width:120px;">
									{form->textbox value=$combination.combinationSKU|default:'' disabled=$disabledTxt 
									validate="required~*callback_checkComSKUexist" error = $language.errRequired|cat:"~*"|cat:$language.errSkuExists
									name="combinationSKU_"|cat:$combinationID  class="form-control"}	
                                            </div>
									</td>
									<td align="left" valign="top" colspan="2">
									{form->textbox value=$combination.combinationPrice|default:'' disabled=$disabledTxt name="combinationPrice_"|cat:$combinationID  class="form-control pull-left"}	
									{form->select name="combinationPriceDiffType_"|cat:$combinationID  disabled=$disabledTxt class="form-control pull-right"
									value=$combination.combinationPriceDiffType
									options="N->{$language.lblNone}~*I->{$language.lblIncrease}"		
									}
									</td>
									<td align="left" valign="middle">
									{if $resProductList.InventoryTrackLevel=='No'}
										{$language.lblUnlimited}
									{else if $resProductList.InventoryTrackLevel=='Options'}
										{form->textbox value=$combination.combinationQty|default:'' disabled=$disabledTxt 
										name="combinationQuantity_"|cat:$combinationID  class="form-control" validate="isWholeNumberWithZero" error=$language.errValidQunatity}
									{/if}
									</td>
                                        {*<td align="left" valign="middle">
									</td>
                                    <td  align="left" valign="middle" class="pd-lf-td" width="1%"></td>*}
									</tr>
								{/foreach}
							{/if}
						{/foreach}
						{form->hidden name="optionIDsString" value=$optionIDsString|default:''}
						{form->hidden name="combinationIDsString" value=$combinationIDsString|default:''}
					</tbody>             
				</table>
            </div>
              </div>
		  
		  <!--end: Product List--> 
          <!--Start: Pagination-->
          <div class="fixing_right pagination_outer"> {paginate->layout  key="page" label_record="{$language.lblRecorsFound}" label_pages="{$language.lblPages}"} 
            <!--end: Pagination-->
          </div>
          <!--end: Pagination--> 
          <div class="clear"></div>
          {form->close} 		  
          {else}
          <div  class="message_info"> {$language.msgNoRecords}</div>
          {/if} </div>
      </div>
      </div>
  </div>
  {include file='CommonFooter.tpl'} </div>
<script  type="text/javascript">
var lblCheckall = "{$language.lblCheckall}";
var lblUncheckall = "{$language.lblUncheckall}";
var lblSelectBusiness = "{$language.lblSelectBusiness}";
var lblSelectCitys = "{$language.lblSelectCitys}";
var lblselected 	= "{$language.lblselected}";
var msgConfirmDeletepdt 	= "{$language.msgConfirmDeletepdt}";
var lblSelectCategory="{$language.lblSelectCategory}";
var lblBasicSearch="{$language.lblBasicSearch}";
var lblAdvanceSearch="{$language.lblAdvanceSearch}";
</script> 

<script type="text/javascript" src="{$view_javascript}/jquery.multiselect.widget.js"></script> 
<script type="text/javascript" src="{$common_js}/date.js"></script>
<script type="text/javascript" src="{$view_javascript}/daterangepicker.jQuery.js"></script>
<script type="text/javascript" src="{$view_javascript}/chosen.jquery.min.js"></script>
<script  type="text/javascript">
 var lblNoMatch = "{$language.lblNoMatch}";
</script>
<!--<script type="text/javascript" src="{$view_javascript}/productRequestList.page.js"></script> -->
<script type="text/javascript" src="{$view_javascript}/productRequestList.page.js"></script> 
<script type="text/javascript" src="{$common_js}/validate.plugin.js"></script>
<script type="text/javascript" src="{$view_javascript}/table.plugin.js"></script> 
<script>
    $(function() {

    function cb(start, end) {
        $('#searchProductDate').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
    }
    cb(moment().subtract(29, 'days'), moment()); 
    $('#searchProductDate').daterangepicker({
        ranges: {
           [lblToday]: [moment(), moment()],
           [lblYesterday]: [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
           [lblLast7Days]: [moment().subtract(6, 'days'), moment()],
           [lblLast30Days]: [moment().subtract(29, 'days'), moment()],
           [lblThisMonth]: [moment().startOf('month'), moment().endOf('month')],
           [lblLastMonth]: [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        },
		 locale: {
          cancelLabel: cancelLabel,
          applyLabel: applyLabel,
		  customRangeLabel: customRangeLabel
      }
    }, cb);


});
</script>
<script type="text/javascript" src="{$view_javascript}/moment.min.js"></script>
<script type="text/javascript" src="{$view_javascript}/bootstrap-daterangepicker-min.js"></script>


<!--//*********sales rep***********//--> 
<script language="javascript" type="text/javascript">
$(".sortby-list").click(function(){ 
 if($(this).siblings(".sort_links_ul").is(':visible'))
 {
 $(this).removeClass("active");
 $(".sort_links_ul").hide();
 }
 else{
 $(this).siblings(".sort_links_ul").slideDown("fast");
 $(this).addClass("active"); 
 } 
$('body').click(function (e) {       
  if ($(".sort_links ").has(e.target).length === 0) {
     $(".sort_links_ul").hide();
	 $(".sortby-list").removeClass("active");
        }
    });
 
});
var msgSelectItem ="{$language.msgSelectItem}";
var lblSelectAction ="{$language.lblSelectAction}";
var msgConfirmDelete ="{$language.msgConfirmDelete}";
</script> 
<!--//*********sales rep end***********//--> 
{form->validate_script form	= "formProduct"}
{html->messages_script id="common_message"}
</body>
</html>