<script type="text/javascript" src="{$view_javascript}/jquery.colorbox.js"></script> 
<script src="{$common_js}/validate.plugin.js"></script>
{form->start name="formCustomOptionAdd" action="" method="post" enctype="multipart/form-data" rel="custom-option-save"}
{form->hidden name="setDefaultRequired" value="1" validate="required"}
{form->validate  name="validatesetDefaultRequired" validate="setDefaultRequired->isequal->1~*setDefaultRequired->required" error="Error"}
{if $productRequestID}
{assign var="userAttrImportURL" value='product/importglobaloption/productRequestID/'|cat:{$productRequestID}|cat:'/'}
{assign var="userAddAttributeURL" value='productoption/new/productRequestID/'|cat:{$productRequestID}|cat:'/scope/user/'}
{else if $productID}
{assign var="userAttrImportURL" value='product/importglobaloption/productID/'|cat:{$productID}|cat:'/'}
{assign var="userAddAttributeURL" value='productoption/ajaxproductoptionadd/productID/'|cat:{$productID}|cat:'/'}
{/if}
<h3><span>{$language.lblCustomOptions}</span></h3>
{*<div class="Aligned_pad_cont clearfix">{html->anchor href=$userAttrImportURL caption=$language.lblImportGlobalOptions title=$language.lblImportGlobalOptions  class="linkbtnt01 fixing_right click importGlobalAttributes"}
{html->anchor href=$userAddAttributeURL caption=$language.lblAddCustomOption default=$language.lblAddCustomOption title=$language.lblAddOption  class="linkbtnt01 fixing_right click addCustomAttributes"}
</div>*}
{if $resUserLevelAttributes|@count>0}  
    <div class="grid_table01 custom-option-grid">
    <table width="100%" cellspacing="0" cellpadding="0" border="0" id="userLevelCustomAttr" class="customAttributePriority">
    <tbody>              
    <tr class="nodrag nodrop">
    <th align="left" valign="middle">{$language.lblName}</th>   
    <th align="left" valign="middle"  width="30%">{$language.lblInputType}</th>
    <th width="65">&nbsp;</th>
    </tr>
    {foreach from=$resUserLevelAttributes item="resAttributesUser"}   
    {assign var="customOptionID" value=$resAttributesUser.customOptionID}
    {if $productRequestID}
    {assign var="editAttributeURL" value='attribute/edit/productRequestID/'|cat:{$productRequestID}|cat:'/custid/'|cat:$customOptionID|cat:'/'}
    {else if $productID}        
    {assign var="editAttributeURL" value='productoption/ajaxproductoptionedit/productID/'|cat:{$productID}|cat:'/id/'|cat:$customOptionID|cat:'/'}
    {/if}
    {form->hidden name="customAttributes[{$customOptionID}][priority]" value= $resAttributesUser.attributePriority|default:''} 
    <tr id="{$customOptionID}" class="customAttributePriorityRows">
    <td align="left" valign="top">{$resAttributesUser.customOptionName}{if $resAttributesUser.isGlobal==1}(Global){/if}</td>        
    <td align="left" valign="top">{$resAtrributeInputTypes[$resAttributesUser.inputType]}</td>
    <td align="left" valign="top"> 
    {if $resAttributesUser.status=='A'} 
    {assign var="classtext" value="status-active hide-txt customOptionStatus icon-set"} 
    {else} 
    {assign var="classtext" value="status-inactive hide-txt customOptionStatus icon-set"} 
    {/if}
    {html->anchor href="" type="{$resAttributesUser.inputType}" class="{$classtext}"  customOptionID="{$customOptionID}" title="{if $resAttributesUser.status == 'A'} {$language.lblActive} {else} {$language.lblInactive} {/if}" content="{if $resAttributesUser.status == 'A'} {$language.lblActive} {else} {$language.lblInactive} {/if}"}
    {html->anchor href=$editAttributeURL class="icon-set edit02 editCustomAttributes"  title="{$language.lblEdit} {$language.lblCustomOption}"}                
    {html->anchor rel="{if $resAttributesUser.isGlobal} 1 {else} 0 {/if}" title="{$language.lblDelete}" customOptionID="{$customOptionID}" type="{$resAttributesUser.inputType}" class="icon-set delete02 customOptionDelete"}  
    </td>
    </tr>
    {/foreach}
    </tbody>
    </table>
    </div>	            
{else}
<div class="message_info"> {$language.msgNoRecords}</div>
{/if}
<div class="clear"></div>
{if $resUserLevelAttributes|@count>0} 
<div id="custom-option-save-section" class="save-floating-section">
<div class="cm-buttons-floating">
  <div class="submit-position"> 
  {form->submit name="submitOptionDetails" id="submitOptionDetails" class="button03 curve-3" value="{$language.lblSavepriority}"}                
  {$language.lblOr}{html->anchor href="product/index/" content=$language.lblCancel} </div>
</div>
<div class="cm-buttons"></div>
</div>
{/if}
{form->close}
{form->validate_script form="formCustomOptionAdd"}
<script type="text/javascript">
{literal}
$(document).ready(function () {
	$(".importGlobalAttributes").colorbox({iframe:true,width:"60%", height:"60%"});		
	$(".addCustomAttributes").colorbox({iframe:true,width:"90%", height:"80%",onClosed:function(){ reloadCustomOptions(); }});		
	$(".editCustomAttributes").colorbox({iframe:true,width:"90%", height:"80%"});		
});
{/literal}
</script>