<inp2:adm_SetPopupSize width="830" height="720"/>

<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="p" section="in-portal:browse" pagination="1" pagination_prefix="poc.grid" title_preset="options_combinations"/>

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
	<tr>
  	<td>
  		<script type="text/javascript">

  			function edit()
  			{
  				set_hidden_field('remove_specials[poc.grid]', 1);
  				set_hidden_field('poc_id', '');
  				submit_event('poc','')
  			}

				a_toolbar = new ToolBar();

				a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Close" escape="1"/>', function() {
							window_close();
						}
				 ) );

				a_toolbar.AddButton( new ToolBarSeparator('sep1') );

				a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
						function() {
							std_delete_items('poc.grid')
						} ) );

				a_toolbar.AddButton( new ToolBarSeparator('sep2') );

				a_toolbar.AddButton( new ToolBarButton('move_up', '<inp2:m_phrase label="la_ToolTip_MoveUp" escape="1"/>', function() {
							submit_event('poc.grid','OnMassMoveUp');
						}
				 ) );

				a_toolbar.AddButton( new ToolBarButton('move_down', '<inp2:m_phrase label="la_ToolTip_MoveDown" escape="1"/>', function() {
							submit_event('poc.grid','OnMassMoveDown');
						}
				 ) );

				a_toolbar.Render();

			</script>
		</td>

		<inp2:m_RenderElement name="search_main_toolbar" prefix="poc.grid" grid="Default"/>
	</tr>
</tbody>
</table>

<inp2:m_DefineElement name="option_value_block">
	<option value="<inp2:m_param name="id"/>" <inp2:m_param name="selected"/>><inp2:m_param name="value"/></option>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="option_value_cb_block">
	<input type="checkbox"
				name="poc[<inp2:poc_Field name="CombinationId"/>][Combination][<inp2:Field name="ProductOptionId"/>][]"
				id="poc[<inp2:poc_Field name="CombinationId"/>][Combination][<inp2:Field name="ProductOptionId"/>]_<inp2:m_param name="id"/>"
				value="<inp2:m_param name="id"/>" <inp2:m_param name="selected"/>>
				<label for="poc[<inp2:poc_Field name="CombinationId"/>][Combination][<inp2:Field name="ProductOptionId"/>]_<inp2:m_param name="id"/>"><inp2:m_param name="value"/></label>&nbsp;
</inp2:m_DefineElement>

<inp2:m_DefineElement name="option_block">
	<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
		<inp2:m_inc param="tab_index" by="1"/>
		<td class="label-cell">
			<inp2:Field name="Name"/>:
		</td>
		<td class="control-mid">&nbsp;</td>
		<script type="text/javascript">
			if (typeof(fields['poc']) == 'undefined') {
				fields['poc'] = new Object();
			}
			fields['poc']['Combination[<inp2:Field name="ProductOptionId"/>]'] = '<inp2:Field name="Name" js_escape="1"/>';
		</script>
		<td class="control-cell">
			<inp2:m_if check="FieldEquals" field="OptionType" value="6">
				<inp2:ShowOptions render_as="option_value_cb_block" mode="selected" combination_prefix="poc" combination_field="Combination"/>
				<span class="error"><inp2:poc_Error field="Combination"/></span>
			<inp2:m_else/>
				<select style="padding-left: 0px; width: 300px" name="poc[<inp2:poc_Field name="CombinationId"/>][Combination][<inp2:Field name="ProductOptionId"/>]" id="poc[<inp2:poc_Field name="CombinationId"/>][Combination][<inp2:Field name="ProductOptionId"/>]" style="width: 200px">
					<option value=""></option>
					<option value="_ANY_"><inp2:m_phrase label="la_comm_Any"/></option>
					<inp2:ShowOptions render_as="option_value_block" mode="selected" combination_prefix="poc" combination_field="Combination"/>
				</select>
			</inp2:m_if>
		</td>
		<script type="text/javascript">
			add_form_error('poc', 'Combination[<inp2:Field name="ProductOptionId"/>]', '<inp2:poc_InputName field="Combination"/>[<inp2:Field name="ProductOptionId"/>]', '<inp2:poc_Error field="Combination" js_escape="1"/>');
		</script>
	</tr>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="combination_buttons">
	<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
		<inp2:m_inc param="tab_index" by="1"/>
		<td class="label-cell">&nbsp;</td>
		<td class="control-mid">&nbsp;</td>
		<td class="control-cell">
			<input class="button" style="width: 80px" type="button" onclick="submit_event('poc', '<inp2:poc_SaveEvent/>')" value="<inp2:m_if check="m_GetEquals" var="poc_SaveEvent" value="OnCreate"><inp2:m_Phrase label="la_Button_Add"/><inp2:m_else/><inp2:m_Phrase label="la_Button_Save"/></inp2:m_if>">&nbsp
			<input class="button" style="width: 80px" type="button" onclick="submit_event('poc', 'OnNew')" value="<inp2:m_Phrase label="la_Cancel"/>">&nbsp;&nbsp;
		</td>
	</tr>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="grid_combination_td">
	<inp2:Field field="$field" grid="$grid" no_special="1"/>
	<inp2:m_ifnot check="Field" field="Priority" equals_to="0"><span class="priority"><sup><inp2:Field field="Priority" /></sup></span></inp2:m_ifnot>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="price_td" >
	<inp2:m_if check="FieldEquals" field="PriceType" value="1">
		=
		<inp2:Field field="$field" grid="$grid" format="%.2f"/>&nbsp;
		$
	</inp2:m_if>
	<inp2:m_if check="FieldEquals" field="PriceType" value="2">
		<inp2:Field field="$field" grid="$grid" format="%+.2f"/>&nbsp;
		$
	</inp2:m_if>
	<inp2:m_if check="FieldEquals" field="PriceType" value="3">
		<inp2:Field field="$field" grid="$grid" format="%+ 6.2f"/>&nbsp;
		%
	</inp2:m_if>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="weight_td" >
	<inp2:Field field="$field" grid="$grid"/>
</inp2:m_DefineElement>

<!--<inp2:poc_SaveWarning name="grid_save_warning"/>-->
<inp2:poc_ErrorWarning name="form_error_warning"/>

<div id="scroll_container" style="height: 250px;">
	<table class="edit-form" style="border-bottom: 1px solid black;">
		<inp2:m_RenderElement name="subsection" title="la_Text_Combination"/>
			<inp2:po.edit_PrintList2 per_page="-1" selectable_only="1" render_as="option_block" main_special=""/>
		<inp2:m_RenderElement name="subsection" title="la_Text_Properties"/>
			<inp2:m_RenderElement name="inp_edit_hidden" prefix="poc" field="ProductId"/>
			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="poc" field="Availability" title="la_fld_Availability"/>
			<inp2:m_RenderElement name="inp_edit_radio" prefix="poc" field="PriceType" title="la_fld_PriceType"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="poc" field="Price" title="la_fld_Price" size="4"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="poc" field="SKU" title="la_fld_SKU" size="40"/>
			<!--<inp2:m_RenderElement name="inp_edit_radio" prefix="poc" field="WeightType" title="la_fld_WeightType"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="poc" field="Weight" title="la_fld_Weight" size="4"/>-->
			<inp2:m_RenderElement name="combination_buttons"/>
			<inp2:m_RenderElement name="inp_edit_filler"/>
	</table>
</div>

<inp2:m_RenderElement name="grid" main_special="" PrefixSpecial="poc.grid" IdField="CombinationId" grid="Default"/>
<script type="text/javascript">
	Grids['poc.grid'].SetDependantToolbarButtons( new Array('delete', 'move_up', 'move_down') );
</script>

<inp2:m_include t="incs/footer"/>