<!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" />
{assign var="customOptionID" value=$customOptionID|default:''}
<title>{$language.lblAdmin}: {if $customOptionID} Edit Option{else}Add Option{/if}</title>
{include file='CommonStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/inner-formlisting.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>
<div class="outer_container"> 
{if $enableCustomOption eq '0'}
{include file='CommonTop.tpl'}
{/if}
{if $enableCustomOption eq '0'}
  <div class="content_container">
  {else}
  <div>
  {/if}
    <div class="content_wrapper add-new-formlisting">
     {if $enableCustomOption eq '1'}<div class="clearfix btm-spc" >{include file='ContentLanguageOptions.tpl'}</div>{/if}
{if $enableCustomOption eq '0'} {include file='ContentLanguageOptions.tpl'}  <h2> {if $customOptionID}{$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">                  
          <div class="search_container add-option">
           <div class="inner custom-option-add">
             <ul class="clearfix">
               <li class="column">
                 <p class="label-field01 mandatory">{$language.lblName}</p>
                 <span class="form-field01">{form->textbox name="customOptionName" maxlength="255"  class="textbox" validate="required" error=$language.errOptionLabel value=$resAttributeEdit.customOptionName|default:''}</span>
               </li>
               <li class="column">
                 <p class="label-field01 mandatory">{$language.lblInputType}</p>
                 <span class="form-field01">
                  {if $customOptionID} 
					{form->select name="inputTypeEdit" options=$resAtrributeInputTypes value=$resAttributeEdit.inputType|default:'' disabled=disabled optionGroup="Yes" class="slect-option"}
					{form->hidden name="inputType" value=$resAttributeEdit.inputType|default:''}					
					{else}
					{form->select class="slect-option" name="inputType" caption="->{$language.lblSelect}" options=$resAtrributeInputTypes validate="required" error=$language.errInputType value=$resAttributeEdit.inputType|default:'' optionGroup="Yes"}
					{/if}
                 </span>
               </li>
               <li class="column">
                 <p class="label-field01">{$language.lblAttributeSubText}</p>
                 <span class="form-field01">{form->textbox name="helpText" maxlength="255" class="textbox" value=$resAttributeEdit.helpText|default:''}</span>
               </li>
               <li class="column" style="width:10%;">
                <p class="label-field01">{$language.lblRequired}</p>                
                  {if $resAttributeEdit.validateRule|strstr:"required"|default:''}
                    {assign var="validateChecked" value="checked"} 
                    {else}
                    {assign var="validateChecked" value=""} 
                  {/if}
                 <span class="form-field01"> 
                   {form->checkbox name="validateRuleRequired" class="check-box" value="Yes" checked=$validateChecked} 
                 </span>
               </li>               
               <li class="column">
                 <p class="label-field01">{$language.lblAttrValidationRule}</p>                
                  {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]|default:''}
			 {/if}
			 {/foreach}			
			{if $validateRuleArray[0]!='required'}
                    	{assign var="validateRuleVar" value=$validateRuleArray[0]}
                    	{else if $validateRuleArray[1]|default:''!=''} 
                        {assign var="validateRuleVar" value=$validateRuleArray[1]}
                        {/if}
                    {else}
                    {assign var="validateRuleVar" value=""} 
                    {/if}
                 <span class="form-field01"> 
                     {form->select name="validateRule" class="select-box" caption="->{$language.lblSelect}" options=$resAtrributeValidationRules  value=$validateRuleVar|default:''}
                 </span>
               </li>               
               <li class="column">
                <p class="label-field01" id="msgReq">{$language.lblAttrValidationMessage}</p>
                 <span class="form-field01">
                    {form->textbox name="validationMessage" maxlength="100"  
					class="textbox" validate="checkValidationMessage->isequal->0~*required"  
					error=$language.errAttrValidationMessage value=$resAttributeEdit.validationMessage|default:''}
                    {form->hidden name="checkValidationMessage" value="1"}
                    {form->hidden name="includeInCombination"  value=""}
                 </span>
               </li>
	        {*<li class="column comboInclude" style="display: none">
                <p class="label-field01">{$language.lblIncludeInCombo}</p>                
                  {if $resAttributeEdit.include_in_combination|default:''=='Yes'}
                    {assign var="includeComboChecked" value="checked"} 
                    {else}
                    {assign var="includeComboChecked" value=""} 
                  {/if}
                 <span class="form-field01"> 
                 {form->checkbox name="includeInCombination" class="check-box" value="Yes" checked=$includeComboChecked} 
                 </span>
               </li>*} 
               <li class="column forCommonType">
                  <p class="label-field01">{$language.lblPrice}</p>
                  <span class="form-field01 price-field1">                  
                    {form->textbox 	name = "priceDiff" class = "textbox  forCommonTypeSection  priceVariation"                
                      validate_inline	= "yes"  
                      validate="isPrice"
                      value = $resAttributeEdit.priceDiff|escape|default:''
		              error = $language.errValidPrice} 
                  </span>
                   <div class="priceDiffType">
                     {form->select 	name = "priceDiffType" class = "forCommonTypeSection priceVariation"
	                     value = $resAttributeEdit.priceDiffType|escape|default:''
                         validate_inline	= "yes"        	
                         options ="I->{$language.lblIncrease}~*D->{$language.lblDecrease}~*N->{$language.lblNone}"}
                   </div>   
                  </li>
              
             </ul>
           </div>          
          </div> 
          <div class="form-option product-add forFileType">
             <ul class="clearfix">
                <li class="column">
                 <p class="label-field01 txt-normal">{$language.lblAllowedExtensions}</p>
                 <span class="form-field01">{form->textarea name="allowedExtensions" class="textbox forFileTypeSection" maxlength="255" value=$allowedExtensions|default:''}</span>
               </li>
               <li class="subtext-outer">
                  <span class="sub-text">{$language.lblFileExtensionNote}</span>
               </li>
               </ul>
               <ul class="clearfix">
                <li class="column">
                 <p class="label-field01 txt-normal">{$language.lblMaxUploadFileSize}</p>
                 <span class="form-field01">
                   {form->textbox name="maxFileSize" class="textbox forFileTypeSection" maxlength="100" 
                      validate="inputType->isequal->file~*isFloatWithoutZero" 
					  error=$language.errValidFileSize value=$maxFileSize|default:''}					
                 </span>
               </li>
               <li class="subtext-outer">
                <span class="sub-text">{$language.lblFileSizeNote}</span>
               </li>
             </ul>
          </div>
          <div class="section_wrap form-option clearfix attributeOptionsSections">          
            <h4>{$language.lblVariants}</h4><div id="variant_message"></div>
              {include file='CustomOptionAddvariant.tpl'}
          </div>
          <span class="line"></span>
          <ul class="fullwidth ">
	    {if $customOptionID}
	      {if $resAttributeEdit.status|default:''=='A'}
                {assign var="attributeStatusVar" value="A"} 
                {else}
                {assign var="attributeStatusVar" value="I"} 
                {/if}

		{else}
		{assign var="attributeStatusVar" value="A"} 
		{/if}
		  
		<li class="clearfix" >
		  <div class="leftside01 mandatory">{$language.lblStatus}</div>
		  <div class="rightside01">              
			<div id="perioddiv"> {form->radio name="status" class="customradio" options="A->{$language.lblActive}~*I->{$language.lblInactive}" value=$attributeStatusVar} </div>
		  </div>
		</li>
	    {form->hidden name="productRequestID" value=$productRequestID|default:''}
	    {form->hidden name="productID" value=$productID|default:''}
            <li class="clearfix" >
              <div class="leftside01 mandatory">&nbsp;</div>
              <div class="rightside01 submit-block "> {form->submit name="submitAttributeAdd" id="submitAttributeAdd" class="curve-3" value="{$language.lblSave}"}
				{if $currentAction|default:'' eq "new"}
					{$language.lblOr} 
					{form->submit name="submitAttributeAddNew" id="submitAttributeAddNew" class="curve-3" value="{$language.lblSaveNCreateNew}"}	
				{/if}	
			  {$language.lblOr} 
              {if $enableCustomOption eq '0'}
			  {form->hidden name="section" value='global'}
              {html->anchor href="productoption/index/" caption="{$language.lblCancel}"} 
              {else}
              {html->anchor caption="{$language.lblCancel}" onclick="parent.$.colorbox.close();"} 
              {/if}
              </div>
            </li>
          </ul>
        </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>
