<!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.lblBusiness}: {if $customOptionID|default:''} Edit Option{else}Add Option{/if}</title>
{include file='CommonStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/product-details.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" />
{include file='CommonCustomStyles.tpl'}
{form->rootpath_script}
{form->basepath_script}
{literal}
<style>
.forSelectType,.forFileType {display:none;}
.no-border-right{border-right-color:transparent !important;}
.language-block-inner{float:right;}
{/literal}
{if $enableCustomOption eq '1'}
{literal}
body{background:none;}
{/literal}
{/if}
{literal}
</style>
{/literal}
</head>
<body class="{$languageDirection}">
<div class="outer" id="main"> 
{if $enableCustomOption eq '0'}
{include file='CommonTop.tpl'}
{/if}
{if $enableCustomOption eq '0'}
  <div class="content_container">
  
  {else}
  <div>
  {/if}
    <div class="custom_wrapper add-new-formlisting">
     
     {if $enableCustomOption eq '1'}<div class="clearfix btm-spc margin-right" >{include file='ContentLanguageOptions.tpl'}</div>{/if}
{if $enableCustomOption eq '0'} {include file='ContentLanguageOptions.tpl'}  <h2> {if $customOptionID|default:''}{$language.lblEditGlobalOption} : {$resAttributeEdit.customOptionName|default:''}{else}{$language.lblAddGlobalOption}{/if}</h2>{/if}
	  <div id="common_message"></div>
      {form->start name="formAttributeAdd" action="" method="post" enctype="multipart/form-data"}
      <div class="inner_content_wrapper">
        <div class="form_listing add-option"> 
            <div class="add-option-content">
          <div class=" row">
               <div class="form-group col-sm-3 col-xs-12">
                 <label>{$language.lblName}</label>
                 <span>{form->textbox name="customOptionName" maxlength="255"  class="form-control" validate="required" error=$language.errOptionLabel value=$resAttributeEdit.customOptionName|default:''}</span>
               </div>
               <div class="form-group col-sm-3 col-xs-12">
                 <label>{$language.lblInputType}</label>
                 <span>
                  {if $customOptionID|default:''} 
					{form->select name="inputTypeEdit" options=$resAtrributeInputTypes value=$resAttributeEdit.inputType|default:'' disabled=disabled optionGroup="Yes" class="form-control"}
					{form->hidden name="inputType" value=$resAttributeEdit.inputType|default:''}					
					{else}
					{form->select class="form-control" name="inputType" caption="->{$language.lblSelect}" options=$resAtrributeInputTypes validate="required" error=$language.errInputType value=$resAttributeEdit.inputType|default:'' optionGroup="Yes"}
					{/if}
                 </span>
               </div>
               <div class="form-group col-sm-3 col-xs-12">
                 <label>{$language.lblAttributeSubText}</label>
                 <span >{form->textbox name="helpText" maxlength="255" class="form-control" value=$resAttributeEdit.helpText|default:''}</span>
               </div>
               <div class="form-group col-sm-3 col-xs-12">
                <label>{$language.lblRequired}</label>                
                  {if $resAttributeEdit.validateRule|default:''|strstr:"required"}
                    {assign var="validateChecked" value="checked"} 
                    {else}
                    {assign var="validateChecked" value=""} 
                  {/if}
                 <span class="check_validation"> 
                   {form->checkbox name="validateRuleRequired" class="check-box" value="Yes" checked=$validateChecked} 
                 </span>
               </div> 
            </div>
            <div class="row">
               <div class="form-group col-sm-3 col-xs-12">
                 <label>{$language.lblAttrValidationRule}</label>                
                  {if $resAttributeEdit.validateRule|default:''} 
                    	{assign var="validateRuleArray" value="~*"|explode:$resAttributeEdit.validateRule|default:''}
			{foreach from=$validateRuleArray item="Rule"}			
			 {if $Rule|strstr:"checkFileSize"}
			 {assign var="validateRuleArraysize" value="checkFileSize->"|explode:$Rule}
			 {assign var="maxFileSize" value=$validateRuleArraysize[1]}
			 {elseif $Rule|strstr:"isValidFileExtension"}			
			 {assign var="validateRuleArrayextens" value="isValidFileExtension->"|explode:$Rule}
			  {assign var="allowedExtensions" value=$validateRuleArrayextens[1]}
			 {/if}
			 {/foreach}			
			{if $validateRuleArray[0]|default:''!='required'}
                    	{assign var="validateRuleVar" value=$validateRuleArray[0]|default:''}
                    	{else if $validateRuleArray[1]|default:''!=''} 
                        {assign var="validateRuleVar" value=$validateRuleArray[1]|default:''}
                        {/if}
                    {else}
                    {assign var="validateRuleVar" value=""} 
                    {/if}
                 <span> 
                     {form->select name="validateRule" class="form-control" caption="->{$language.lblSelect}" options=$resAtrributeValidationRules  value=$validateRuleVar|default:''}
                 </span>
               </div>               
               <div class="form-group col-sm-3 col-xs-12">
                <label id="msgReq">{$language.lblAttrValidationMessage}</label>
                 <span>
                    {form->textbox name="validationMessage" maxlength="100"  
					class="form-control" validate="checkValidationMessage->isequal->0~*required"  
					error=$language.errAttrValidationMessage value=$resAttributeEdit.validationMessage|default:''}
                    {form->hidden name="checkValidationMessage" value="1"}
                 </span>
               </div>
	       <div class="form-group col-sm-3 col-xs-12 comboInclude" style=" display: none">
                <label>{$language.lblIncludeInCombo}</label>                
                  {if $resAttributeEdit.include_in_combination|default:''=='Yes'}
                    {assign var="includeComboChecked" value="checked"} 
                    {else}
                    {assign var="includeComboChecked" value=""} 
                  {/if}
                 <span> 
                 {form->checkbox name="includeInCombination" class="" value="Yes" checked=$includeComboChecked} 
                 </span>
               </div> 
               <div class="form-group col-sm-3 col-xs-12 forCommonType">
                  <label>{$language.lblPrice}</label>
                  <span class="price-field1">                  
                    {form->textbox 	name = "priceDiff" class = "form-control  forCommonTypeSection  priceVariation"                
                      validate_inline	= "yes"  
                      validate="isPrice"
                      value = $resAttributeEdit.priceDiff|default:''|escape
		              error = $language.errValidPrice} 
                  </span>
                   {*<div class="priceDiffType">
                     {form->select 	name = "priceDiffType" class = "forCommonTypeSection form-control priceVariation"
	                     value = $resAttributeEdit.priceDiffType|default:''|escape
                         validate_inline	= "yes"        	
                         options ="I->{$language.lblIncrease}~*D->{$language.lblDecrease}~*N->{$language.lblNone}"}
                   </div>*}   
                  </div>
          </div> 
          </div>
          <div class="form-option product-add forFileType">
             <div class="row">
                <div class="form-group col-xs-12 col-sm-3">
                 <label>{$language.lblAllowedExtensions}</label>
                 <span class="form-field01">{form->textarea name="allowedExtensions" class="form-control forFileTypeSection" maxlength="255" value=$allowedExtensions|default:''}</span>
               </div>
               <div class=" form-group col-xs-12 col-sm-5 subtext-outer">
                  <span class="sub-text">{$language.lblFileExtensionNote}</span>
               </div>
               </div>
               <div class="row">
                <div class="form-group col-xs-12 col-sm-3">
                 <label>{$language.lblMaxUploadFileSize}</label>
                 <span class="form-field01">
                   {form->textbox name="maxFileSize" class="form-control forFileTypeSection" maxlength="100" 
                      validate="inputType->isequal->file~*isFloatWithoutZero" 
					  error=$language.errValidFileSize value=$maxFileSize|default:''}					
                 </span>
               </div>
               <div class="form-group col-xs-12 col-sm-5 subtext-outer">
                <span class="sub-text">{$language.lblFileSizeNote}</span>
               </div>
             </div>
          </div>
          <div class="section_wrap form-option clearfix attributeOptionsSections">          
            <h4>{$language.lblOptVariants}</h4>  <div id="variant_message"></div>
              {include file='CustomOptionAddvariant.tpl'}
          </div>
          <div class="fullwidth">
	    {if $customOptionID|default:''}
	      {if $resAttributeEdit.status|default:''=='A'}
                {assign var="attributeStatusVar" value="A"} 
                {else}
                {assign var="attributeStatusVar" value="I"} 
                {/if}

		{else}
		{assign var="attributeStatusVar" value="A"} 
		{/if}
		
	    {if !$hideStatus|default:''}	  
            <div class="row" >
              <label class="col-xs-12 margin-bottom">{$language.lblStatus}</label>
              <div class="col-xs-12">              
                <div id="perioddiv"> {form->radio name="status" class="customradio" options="A->{$language.lblActive}~*I->{$language.lblInactive}" value=$attributeStatusVar} </div>
              </div>
            </div>
	    {else}
	    {form->hidden name="status" value=$attributeStatusVar}	    
	    {/if}	   
	    {form->hidden name="productRequestID" value=$productRequestID}
	    {form->hidden name="productID" value=$productID}
            <div class="clearfix" >
              <div class="">&nbsp;</div>
              <div class=""> {form->submit name="submitAttributeAdd" id="submitAttributeAdd" class="btn btn-primary btn-sm" value="{$language.lblSave}"} <span class="or-block">{$language.lblOr} </span>
              {if $enableCustomOption eq '0'}	      
              {html->anchor href="productoption/" class="btn btn-default btn-sm" caption="{$language.lblCancel}"} 
              {else}
              {html->anchor caption="{$language.lblCancel}" class="btn btn-default btn-sm" onclick="parent.$.colorbox.close();"} 
              {/if}
              </div>
            </div>
          </div>
        </div>
      </div>
      {form->close} </div>
  </div>
  {if $enableCustomOption eq '0'}
  {include file='CommonBottom.tpl'} 
  {/if}
  </div>
{html->messages_script id="common_message"}
{include file='CommonJavaScriptBottom.tpl'} 
<script  type="text/javascript"> 
var lblSelect	=	"{$language.lblSelectProductType}";
var enableCustomOption	=	"{$enableCustomOption}";
var msgSelectDifferentNamesoption="{$language.msgSelectDifferentNamesoption}";
var msgSelectAtleastOne="{$language.msgSelectAtleastOne}";
var lblAttributeFileDeleted ="{$language.lblAttributeFileDeleted}";
var okText	=	"{$language.lblOK}";
var cancelText = "{$language.lblCancel}";
var optionType= "{$enableCustomOption}";
var msgimageDelConfirm= "{$language.msgimageDelConfirm}";
var msgdeleteComboVariant= "{$language.msgdeleteComboVariant}";
 $(function(){
	 $("#perioddiv input").customInput('');
	});	
var postCallback = "{$postCallback|default:''}";	
</script>
<script type="text/javascript" src="{$common_js}/uploadImage.plugin.js"></script> 
<script type="text/javascript" src="{$common_js}/validate.plugin.js"></script> 
<script type="text/javascript" src="{$view_javascript}/optionAdd.page.js"></script> 
<script type="text/javascript" src="{$view_javascript}/jquery.tablednd.js"></script> 
<script type="text/javascript" src="{$view_javascript}/custom-radiobutton.js"></script>

{form->validate_script form="formAttributeAdd"}  
</body>
</html>
