{if $bindAttributeForm eq '1'}
{if $productReqID}
 {assign var="AttrLoc" value='reqid'}
 {else}
  {assign var="AttrLoc" value='id'}
 {/if}
<div class="tabpane float-button6" style="display: none;">
  <div class="tabpane_inner"> <span class="BreadCrump">
    <ul class="clearfix"><li>{$language.lblProductDetails}&raquo; </li>
      <li class="first last"><span>{$language.lblCustomAttributes}</span></li>
    </ul>
    </span>
    <div class="form_listing">   
     <div id="loadCustomAttributes">      
{form->start name="formCustomAttributeAdd" action="" method="post" enctype="multipart/form-data" rel="attribute-save"}
{form->hidden name="selAttrSetID" value="{$attributeSetID}"}
{form->validate name="validationApply" validate="required" value="1"}
    <h3><span>{$language.lblCustomAttributes}</span></h3>
    {if $resAttributes|@count>0}
    {foreach from=$resAttributes item="resAttributesAdminGroup"}
	{if $resAttributesAdminGroup.attributes|@count>0}
    <h4>{$resAttributesAdminGroup.attributeGroupName}</h4> 
    <div class="grid_table01 attr-grid">
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tbody> 
    <tr>
    <th align="left" valign="middle" width="30%">{$language.lblAttributes}</th>
    <th align="left" valign="middle" width="60%">{$language.lblValues}</th>
    </tr>      
    {foreach from=$resAttributesAdminGroup.attributes key=k item="resAttributesAdmin"}    
    {assign var="customAttributeID" value=$k}
    {assign var="attrDetValue" value=$resAttributesAdmin.attrDetValue}   
    <tr>
    <td align="left" valign="top">{$resAttributesAdmin.attrName}
    </td>
    <td  align="left" valign="top">
    {if $resAttributesAdmin.attrInputType eq 'textbox' || $resAttributesAdmin.attrInputType eq 'textarea' || $resAttributesAdmin.attrInputType eq 'date' || $resAttributesAdmin.attrInputType eq 'datetime' || $resAttributesAdmin.attrInputType eq 'time'}    
    {if $resAttributesAdmin.attrInputType eq 'textbox'}
    {form->textbox name="adminAttributeValues_"|cat:$customAttributeID maxlength="255" class="form-control" value=$attrDetValue}
    {else if $resAttributesAdmin.attrInputType eq 'textarea'}
    {form->textarea name="adminAttributeValues_"|cat:$customAttributeID rows="6" value=$attrDetValue}
    {else if $resAttributesAdmin.attrInputType eq 'date'}
    {assign var="attrDateFormatted" value=$attrDetValue|date_format:$settingsDateFormat}
    {form->textbox name="adminAttributeValues_"|cat:$customAttributeID autocomplete="off" maxlength="255" class="form-control  enableDatePicker date-field pull-left margin-right" value=$attrDateFormatted readonly=readonly}
     <a class="attributeReset padding-top pull-left" rel="{$customAttributeID}" href="Javascript:void(0);">Reset</a>
    {else if $resAttributesAdmin.attrInputType eq 'datetime'}
    {assign var="attrDateFormatted" value="{$attrDetValue|customDate}"}
    {form->textbox name="adminAttributeValues_"|cat:$customAttributeID autocomplete="off" maxlength="255" class="form-control   enableDateTimePicker date-field" value=$attrDateFormatted readonly=readonly}
   <a class="attributeReset" rel="{$customAttributeID}" href="Javascript:void(0);">Reset</a>
    {else if $resAttributesAdmin.attrInputType eq 'time'}
    {assign var="attrDateFormatted" value="{$attrDetValue}"}
    {form->textbox name="adminAttributeValues_"|cat:$customAttributeID autocomplete="off" maxlength="255" class="form-control  enableTimePicker date-field" value=$attrDateFormatted  readonly=readonly}
    <a class="attributeReset" rel="{$customAttributeID}" href="Javascript:void(0);">Reset</a>
    {/if} 
    {else if $resAttributesAdmin.attrInputType eq 'file'}   
	{if $resAttributesAdmin.attrDetValue neq ''}	  
	<span id="trashDisplay_{$resAttributesAdmin.attrValueID}">{html->anchor href="product/download/{$AttrLoc}/{$resAttributesAdmin.attrValueID}/" class="file-display" image="{$view_images}/download.png"  title=$language.lblDownloadFile}&nbsp;
	{html->anchor class="customAttributeFile file-display" image="{$view_images}/trash.png" title=$language.lblRemoveFile attrValueID="{$resAttributesAdmin.attrValueID}"}</span>	
	<br/><br/><span id="FileEdit_{$resAttributesAdmin.attrValueID}" style="display:none">
        {*{form->upload_custom class="upload_custom" name="adminAttributeValues_"|cat:$customAttributeID validate="isValidFileExtension" error="Invalid File"}*}
        <div class="fileinput fileinput-new" data-provides="fileinput">
    <span class="btn btn-default btn-file"><span>Choose file</span><input type="file" multiple /></span>
    <span class="fileinput-filename"></span><span class="fileinput-new">No file chosen</span>
</div>
	</span>
	{else}
        {*{form->upload_custom class="upload_custom" name="adminAttributeValues_"|cat:$customAttributeID validate="isValidFileExtension" error="Invalid File"}*}	
        <div class="fileinput fileinput-new" data-provides="fileinput">
    <span class="btn btn-default btn-file"><span>Choose file</span><input type="file" multiple /></span>
    <span class="fileinput-filename"></span><span class="fileinput-new">No file chosen</span>
</div>
	{/if}	
    {else if $resAttributesAdmin.attrInputType eq 'select' || $resAttributesAdmin.attrInputType eq 'multiselect'}    
	
	{assign var="optionArray" value=''}
	{assign var="optionValueArray" value=''}	
	{assign var="count" value=0}

    {foreach from=$resAttributesAdmin['attrOptionID'] key="OptionID" item="optionTitle"}
          {assign var="labelValue" value="adminAttributeValues_"|cat:$customAttributeID|cat:"_"|cat:$count}
    {$optionArray[$count][0]=$OptionID}
        {$optionArray[$count][1]="<label for='{$labelValue}'>"|cat:$optionTitle|html_entity_decode|cat:"</label>"}
    {assign var="count" value=$count+1}
    {/foreach}
    {if $resAttributesAdmin.attrInputType eq 'multiselect'}       
        {assign var="optionValueArray" value=$resAttributesAdmin.assignedOptionID}        
	{if $attributePostBackFlag eq '1'}
	{assign var="checkBoxVals" value="adminAttributeValues_"|cat:$customAttributeID}
	{assign var="optionValueArray" value=","|explode:$attributePostBackArray[$checkBoxVals]}
	{/if}
	<span class="customattr-checkbox">
    {form->checkbox class="adminAttributeCheckBoxes" name="adminAttributeValues_"|cat:$customAttributeID 
	options=$optionArray
	seperator="</span><span class='customattr-checkbox'>" value=$optionValueArray }

	</span>
	{form->hidden name="adminAttributeValues_"|cat:$customAttributeID}	
    {/if}	
    {if $resAttributesAdmin.attrInputType eq 'select'}   
    {form->select class="form-control" name="adminAttributeValues_"|cat:$customAttributeID caption="->{$language.lblSelect}" options=$optionArray  value=$resAttributesAdmin.assignedOptionID['0']} 
    {/if}   
    {/if}
    </td> 
    </tr>
    {/foreach}	
    </tbody>    
    </table>
    </div>
	{/if}
    {/foreach}
{else}
<div class="message_info"> {$language.msgNoRecords}</div>
{/if}
{if $resAttributesAdminGroup.attributes|@count>0} 
<div id="attribute-save-section" class="save-floating-section">
<div class="cm-buttons-floating">
  <div class="submit-position"> 
  {form->submit name="submitAttributeDetails" id="submitAttributeDetails" class="btn btn-primary btn-sm" value="{$language.lblSaveAttributes}"}                
  <span class="or-block">{$language.lblOr}</span>{html->anchor href="product/index/" content=$language.lblCancel class="btn btn-default btn-sm"} </div>
</div>
<div class="cm-buttons"></div>
</div>
{/if}
{form->close}
     </div>
    </div>
  </div>
</div>

{form->validate_script form="formCustomAttributeAdd"}
{/if}
<script type="text/javascript">
var lblAttributeFileDeleted ="{$language.lblAttributeFileDeleted}";
var msgAttributeFileDeleted ="{$language.msgAttributeFileDeleted}";
var okText	=	"{$language.lblOK}";
var cancelText = "{$language.lblCancel}";
</script>
{literal} 
<style>
.customattr-checkbox{
display:inline-block;
margin:0 10px 5px 0;
*display:inline;
padding:4px;
}
</style>
{/literal}