<!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">
{assign var="productID" value=$productID|default:''}
{assign var="productReqID" value=$productReqID|default:''}
<title>{$language.lblBusiness}: {$language.lblProductsTitle} : {if $productID}{$language.lblEditProduct} {else} {$language.lblAddNewProduct}{/if}</title>
{include file='CommonStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/product-details.css" media="screen" />
</head>
<body class="{$languageDirection}">
<div class="outer" id="main">{include file='CommonHeader.tpl'}
    {*<!--***********************************************************************START CONTAINER SECTION******************************************************-->*}
<div class="content-wrapper">
<div class="container-fluid">
  <noscript>
  <div class="message_info">{$language.lblJsEnable} !!</div>
  </noscript>{if $productReqID>0 || $productID>0}
  <div class="clearfix">
    <div class="pull-right right">{include file='ContentLanguageOptions.tpl'}</div>{assign var="cancelHref" value="product/index/"}  
  </div>
  {/if}
  <div id="common_message"></div>
  <div id="common_validate_message" class="message_error hide"></div>
    {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}
    {*<!-- Inner Content Container starts-->*}
  <div class="inner_content_wrapper">
      <div id="common_message"></div>
      {* <!-- tab product details starts -->*}
      <h2>
          {if $productID>0}
              {$language.lblEditProduct}
          {else}
              {$language.lblAddNewProduct}
          {/if}
      </h2>
          <div class="clearfix">
          
              {*<!--Left block end-->*}
              {*<!-- tab General tab-1 starts -->*}
             <div class="container-section">
             {assign var="productBusOptForm" value="productBusOptForm"}
             {form->start name=$productBusOptForm action="" method="post" enctype="multipart/form-data" rel="product-details-save"}
                 <div id="" class="save-floating-section">
                <div class="cm-buttons-floating">
                    <div class="submit-position">
               {form->submit  name="submitProductDetails" id="submitProductDetails" class="btn btn-primary btn-sm" value="{$language.lblSave}"}                
                         <span class="or-block">{$language.lblOr}</span>
                         
                         {html->anchor href="product/index/" class="btn btn-default btn-sm" content=$language.lblCancel}
                   </div>
                </div>
                <div class="cm-buttons"></div>
			</div>
            <div class="contents">
                <div class="row">
                    <div class="col-sm-3">
                        <img src="{$view_public_path}/uploads/catalog/product/thumb/{$productDetails.productImage}" width="100%" class="img-responsive"/>
                    </div>
                    <div class="col-sm-9">
                        <div class="form_listing">
                        <div class="form-group row">
                            <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblProductName}</label>
                            <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">{$productDetails.productTitle}</div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblMinimumOrder}<span class="sub-text">({$language.lblMinimumOrderLimitIndividual})</span></label>
                            <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">{$productDetails.productMinBuyLimit}</div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblMaximumOrderLimit}<span class="sub-text">({$language.lblMaximumOrderLimitIndividual})</span></label>
                            {if $productDetails.productMaxBuyLimit>0}
                            <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">{$productDetails.productMaxBuyLimit}</div>
                            {else}
                            <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">{$language.lblUnlimited}</div>
                            {/if}
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblShortDescription}</label>
                            <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">{$productDetails.productShortDescription|unescape:"html"}</div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblDescription}</label>
                            <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">{$productDetails.productDescription|unescape:"html"}</div>
                        </div>
                        {if $productDetails.productHighlights neq ""}
                            <div class="form-group row">
                                <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblHighlights}</label>
                                <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">{$productDetails.productHighlights|unescape:"html"}</div>
                            </div>
                        {/if}
                            {if $productDetails.InventoryTrackLevel|default:'' eq 'Product'}
                                {assign var="quanStyle" value=""}
                            {else}
                                {assign var="quanStyle" value="hide"}
                            {/if}
                            {form->hidden name="hiddenInvLevel" value=$productDetails.InventoryTrackLevel|default:''}
                            {form->hidden name="hiddenOptionCount" value=$optionDetails|count|default:0}


                           {form->fieldGroup 	
                                fieldName		= "businessOptionSKU" 
                                group		    = "businessOptionsGroup" 
                                parentGroup		= "" 
                                validate		= "businessOptionsGroup_#0#_sellThisOptionCheck->isequal->1~*required"
                                error		    = $language.errMerchantSKU}

                           {form->fieldGroup 	
                                fieldName		= "businessOptionReqPrice" 
                                group		    = "businessOptionsGroup" 
                                parentGroup		= "" 
                                validate		= "businessOptionsGroup_#0#_sellThisOptionCheck->isequal->1~*required~*isPrice"
                                error		    = "~*"|cat:$language.errRequired|cat:"~*"|cat:$language.errValidRateShort|cat:"~*"|cat:$language.errRegularProductPrice
                                postTrigger		= 'if($("#businessOptionsGroup_#0#_businessOptionSalePrice").val() != ""){$("#businessOptionsGroup_#0#_businessOptionSalePrice").blur()};'}   

                           {form->fieldGroup 	
                                fieldName		= "businessOptionSalePrice" 
                                group		    = "businessOptionsGroup" 
                                parentGroup		= "" 
                                validate		= "businessOptionsGroup_#0#_sellThisOptionCheck->isequal->1~*isPrice~*businessOptionsGroup_#0#_businessOptionSalePrice->isnotequal->~*businessOptionsGroup_#0#_businessOptionSalePrice->lt->businessOptionsGroup_#0#_businessOptionReqPrice" 
                                error		    = "~*"|cat:$language.errValidRateShort|cat:"~*~*"|cat:$language.errProductsalePrice}  

                            {form->fieldGroup 	
                                fieldName		= "businessQuantity" 
                                group		    = "businessOptionsGroup" 
                                parentGroup		= "" 
                                validate		= "businessOptionsGroup_#0#_sellThisOptionCheck->isequal->1~*hiddenInvLevel->isequal->Product~*required~*isWholeNumberWithZero"
                                error		    = $language.errValidQuantity}


                            {assign var="optionIncr" value="1"}
                            {if $businessOptionsGroup_postback|count|default:0>0}
                                {assign var="optionDetails" value=$businessOptionsGroup_postback}
                            {/if}
                            {foreach $optionDetails as $busOptCount}
                                {form->hidden name="businessOptionsGroup[{$optionIncr}][hiddenOptionBusinessID]" value=$busOptCount.productOptionBusinessID|default:''}
                                {form->hidden name="businessOptionsGroup[{$optionIncr}][hiddenProductOptionID]" value=$busOptCount.productOptionID|default:''}
                                {form->hidden name="businessOptionsGroup[{$optionIncr}][hiddenProductID]" value=$busOptCount.productID|default:''}

                                {form->hidden name="businessOptionsGroup[{$optionIncr}][hiddenProductOptionName]" value=$busOptCount.productOptionName|default:''}
                                {form->hidden name="businessOptionsGroup[{$optionIncr}][hiddenOptionSKU]" value=$busOptCount.optionSKU|default:''}
                                {form->hidden name="businessOptionsGroup[{$optionIncr}][hiddenBusinessOptionDefault]" value=$busOptCount.businessOptionDefault|default:''}

                                {if $busOptCount['productOptionRegularPrice']|default:"">0}
                                     {assign var="prodRegPrice" value="{$busOptCount['productOptionRegularPrice']|price_no_symbol}"}
                                {else}
                                    {assign var="prodRegPrice" value=""}
                                {/if}
                                {if $busOptCount['productOptionProductPrice']|default:"">0}
                                     {assign var="prodSalePrice" value="{$busOptCount['productOptionProductPrice']|price_no_symbol}"}
                                {else}
                                    {assign var="prodSalePrice" value=""}
                                {/if}

                                <div class="option-values" productoptioncount="{$optionIncr}">
                                {if $optionDetails|count>1}
                                    <div>{$language.lblProductVariant} {$optionIncr}</div>
                                {/if}

                                 <div class="form-group row">
                                     <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblOptionName}</label>
                                     <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                       {$busOptCount.productOptionName}
                                     </div>
                                  </div>

                                  <div class="form-group row">
                                     <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblOptionSKU}</label>
                                     <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                       {$busOptCount.optionSKU}
                                     </div>
                                  </div>
                                 {if $optionDetails|count>1}
                                   {if $busOptCount.productOptionBusinessID|default:''>0}
                                       {assign var="sellOptionChecked" value="checked"}
                                       {assign var="sellOptionValue" value="1"}
                                   {else if $busOptCount.sellThisOptionCheck|default:'' eq '1'}
                                       {assign var="sellOptionChecked" value="checked"}
                                       {assign var="sellOptionValue" value="1"}
                                   {else}
                                       {assign var="sellOptionChecked" value=""}
                                       {assign var="sellOptionValue" value="0"}
                                   {/if}
                                   {form->hidden name="businessOptionsGroup[{$optionIncr}][sellThisOptionCheck]" id="sellThisOptionCheck_{$optionIncr}" value="{$sellOptionValue}"}    
                                    <div class="form-group row">
                                       <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblSellForThisOption}</label>
                                       <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                         {form->checkbox 
                                           name            =   "businessOptionsGroup[{$optionIncr}][sellThisOption]"
                                           class           =   "sellThisOption"
                                           id              =   "sellThisOption_{$optionIncr}"
                                           fieldName       =   "sellThisOption" 
                                           checked         =   {$sellOptionChecked}
                                           value           =   "Yes"
                                           form	           =   $productBusOptForm}
                                       </div>
                                    </div>
                                 {else}
                                     {form->hidden name="businessOptionsGroup[{$optionIncr}][sellThisOption]" id="sellThisOption_{$optionIncr}" value="Yes"}
                                     {form->hidden name="businessOptionsGroup[{$optionIncr}][sellThisOptionCheck]" id="sellThisOptionCheck_{$optionIncr}" value="1"}
                                 {/if}


                                <div id="business_option_sec_{$optionIncr}">
                                 <div class="form-group row">
                                     <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblMerchantSKU}</label>
                                     <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                       {form->textbox 
                                         name            =   "businessOptionsGroup[{$optionIncr}][businessOptionSKU]"
                                         class           =   "form-control"
                                         fieldName       =   "businessOptionSKU" 
                                         group           =   "businessOptionsGroup"
                                         value           =   $busOptCount['businessOptionSKU']|default:''
                                         error_class     =   "message_inline_validation"
                                         validate_inline =   "yes"
                                         form	         =   $productBusOptForm} 
                                     </div>
                                  </div>

                                  <div class="form-group row">
                                     <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblItemPrice}</label>
                                     <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                       {form->textbox 
                                         name            =   "businessOptionsGroup[{$optionIncr}][businessOptionReqPrice]"
                                         class           =   "form-control"
                                         fieldName       =   "businessOptionReqPrice" 
                                         group           =   "businessOptionsGroup"
                                         value           =   $prodRegPrice
                                         error_class     =   "message_inline_validation"
                                         validate_inline =   "yes"
                                         form	         =   $productBusOptForm} 
                                     </div>
                                  </div>

                                  <div class="form-group row">
                                     <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblSaleprice}</label>
                                     <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                       {form->textbox 
                                         name            =   "businessOptionsGroup[{$optionIncr}][businessOptionSalePrice]"
                                         class           =   "form-control"
                                         fieldName       =   "businessOptionSalePrice" 
                                         group           =   "businessOptionsGroup"
                                         value           =   $prodSalePrice
                                         error_class     =   "message_inline_validation"
                                         validate_inline =   "yes"
                                         form	         =   $productBusOptForm} 
                                     </div>
                                  </div>

                                  <div class="form-group row {$quanStyle}">
                                     <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblQuantity}</label>
                                     <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                       {form->textbox 
                                         name            =   "businessOptionsGroup[{$optionIncr}][businessQuantity]"
                                         class           =   "form-control"
                                         fieldName       =   "businessQuantity" 
                                         group           =   "businessOptionsGroup"
                                         value           =   $busOptCount['productOptionQuantity']|default:''
                                         error_class     =   "message_inline_validation"
                                         validate_inline =   "yes"
                                         form	         =   $productBusOptForm} 
                                     </div>
                                  </div>

                                  <div class="form-group row">
                                     <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblWareHouse}</label>
                                     <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                       {form->select 
                                         name            =   "businessOptionsGroup[{$optionIncr}][businessWareHouse]"
                                         class           =   "form-control"
                                         options         =   $businessLocations
                                         caption         =   "->{$language.lblSelect}"
                                         value           =   $busOptCount['busWareHouse']|default:''
                                         form	         =   $productBusOptForm} 
                                     </div>
                                  </div>

                                  <div class="form-group row">
                                     <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblDeliveryTime}</label>
                                     <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                       {form->select 
                                         name            =   "businessOptionsGroup[{$optionIncr}][businessDispatchTime]"
                                         class           =   "form-control"
                                         options         =   "{$resPeriod}" 
                                         caption         =   "->{$language.lblSelect}"
                                         value           =   $busOptCount['businessDispatchTime']|default:''
                                         form	         =   $productBusOptForm} 
                                     </div>
                                  </div>

                                  <div class="form-group row">
                                     <label class="col-sm-4 col-md-3 col-xs-12">{$language.lblGroupPrice}</label>
                                     <div class="col-sm-7 col-md-6 col-lg-5 col-xs-12">
                                       <ul id="group_prices_table">
                                             <li class="header row">
                                                 <div class="col-xs-6"><label>{$language.lblCustomerGroup}</label></div>
                                                 <div class="col-xs-6"><label>{$language.lblPrice}</label></div>
                                             </li>
                                             <li class="levl-02 clearfix" id="business_group_price_container_{$optionIncr}">
                                                 {assign var="busGroupCnt" value="{$busOptCount['group_price']|count|default:0}"}
                                                 {assign var="addedGroupCnt" value="0"}
                                                 {if $busGroupCnt>0}
                                                     {assign var="addedGroupCnt" value=$busGroupCnt-1}
                                                 {/if}

                                                 {form->hidden name="groupIncrCount_{$optionIncr}" value="{$addedGroupCnt}"}

                                                 {assign var="groupIncr" value="{$groupIncr|default:0}"}
                                                 {if isset($busOptCount['group_price'])}		   
                                                     {foreach $busOptCount['group_price'] as $key1=>$group_price}
                                                         {assign var="groupIncr" value="{$key1}"}
                                                         {include file="AjaxBusinessGroupPrice.tpl"}
                                                     {/foreach}
                                                 {*{else}
                                                     {include file="AjaxBusinessGroupPrice.tpl"}*}
                                                 {/if}
                                                 <div class="message_validation hide" id="validate_usergroup_{$optionIncr}"></div>  
                                             </li>
                                             <li>
                                                 {html->anchor  class="btn-add btn btn-primary busAddGroupPrice" id="grpPrice_{$optionIncr}" productoptioncount="{$optionIncr}" content="<span class='icon-plus2'></span>{$language.lblAddGroupPrice}" title="{$language.lblAddGroupPrice}"}
                                             </li>
                                         </ul>
                                     </div>
                                   </div>
                                </div>
                                {assign var="optionIncr" value=$optionIncr+1}   
                             </div>
                         {/foreach} 


                    </div>
                    </div>
                </div>
            </div>
                 
                 {form->close}
              </div>
  </div>
  </div>  
</div>
	
	
</div>
{include file='CommonBottom.tpl'}
</div>
    {*<!--End:Outer Container--> *}
{include file='CommonJavaScriptBottom.tpl'}
{form->validate_script form="productBusOptForm"}
{html->messages_script id="common_message"}
{form->basepath_script}
{form->rootpath_script}
<script type="text/javascript">
var errRequired                 =	"{$language.errRequired}";
var errValidNumber              =	"{$language.errValidNumber}";
var errDuplicateCombination     =       "{$language.errDuplicateCombination}";
var msgDeleteItem               =       "{$language.msgDeleteItem}";
var errNoDetailsForMerchants    =       "{$language.errNoDetailsForMerchants}";
    
    
    $(document).on("click",".left-tab-a",function(){		
	var thisVar = $(this);
	var thisRel = $(this).attr("rel");
	var cmButtonsFloating = $("#"+thisRel+"-section").children(".cm-buttons-floating");
	var cmButtons = $("#"+thisRel+"-section").children(".cm-buttons");
	$.scrollPane({
			floating: cmButtonsFloating,
			fixed: cmButtons,
			padding: 71
		});
	toggleSaveButton(thisRel);
	var editedForms = 0;
	var editedForm = '';
	$("form").each(function(){
	if($(this).attr("changed")=="true")
	{
		editedForm = $(this).attr("rel");
		editedForms++;
	}	
	});
	if (editedForm!='' && thisRel!=editedForm) {
		jAlert(lblPageLeaveAlert);
		jConfirm(lblPageLeaveAlert, 'Alert',function (r) {
			if (r == true) 
			{
				setSelectedTab(thisVar,cmButtonsFloating,cmButtons,thisRel);
			}
			else 
			{
				return false;
			}
		},okText,cancelText);	  

	}
	else
	{
		setSelectedTab(thisVar,cmButtonsFloating,cmButtons,thisRel);
	}
	});
    
</script>
<script type="text/javascript" src="{$common_js}/validate.plugin.js"></script> 
<script type="text/javascript" src="{$view_javascript}/buyboxadd.page.js"></script>
</body>
</html>