<inp2:m_RequireLogin permissions="in-portal:user_list.view" system="1"/>
<inp2:m_DefineElement name="order_catalog_tab">
	<inp2:m_if check="m_ParamEquals" name="tab_init" value="" inverse="inverse">
		<inp2:m_if check="m_ParamEquals" name="tab_init" value="1">
			<div id="orders_div" prefix="<inp2:m_param name="prefix"/>" view_template="in-commerce/user_order_item_tab" edit_template="in-commerce/orders/orders_edit" dep_buttons="new_order" category_id="-1" class="catalog-tab"><!-- IE minimal height problem fix --></div>
			<script type="text/javascript">$Catalog.registerTab('orders');</script>
		</inp2:m_if>
		<inp2:m_if check="m_ParamEquals" name="tab_init" value="2">
			<inp2:adm_CatalogTab render_as="item_tab" prefix="$prefix" title_property="$title_property"/>
		</inp2:m_if>
	<inp2:m_else/>
		<inp2:m_include t="incs/blocks"/>
		<inp2:m_include t="incs/in-portal"/>
		<inp2:m_include t="categories/ci_blocks"/>
		<inp2:m_include template="in-commerce/orders/order_blocks"/>

		<inp2:$prefix_InitList grid="$grid_name"/>

		$Catalog.setItemCount('<inp2:m_param name="prefix"/>', '<inp2:{$prefix}_TotalRecords/>');
		$Catalog.setCurrentCategory('<inp2:m_param name="prefix"/>', <inp2:m_get name="m_cat_id" js_escape="1"/>);
		$Catalog.saveSearch('<inp2:m_Param name="prefix"/>', '<inp2:$prefix_SearchKeyword js_escape="1"/>', '<inp2:m_Param name="grid_name"/>');

		<inp2:m_RenderElement name="grid_js" PrefixSpecial="$prefix" IdField="OrderId" grid="$grid_name"/>

		Grids['<inp2:m_param name="prefix"/>'].SetDependantToolbarButtons( new Array('edit','delete'));
		$Catalog.setViewMenu('<inp2:m_param name="prefix"/>');
		#separator#
		<!-- orders tab: begin -->
		<inp2:m_RenderElement name="kernel_form" form_name="orders_form"/>
			<inp2:m_RenderElement name="grid" ajax="1" PrefixSpecial="$prefix" IdField="OrderId" grid="$grid_name" menu_filters="yes"/>
		<inp2:m_RenderElement name="kernel_form_end"/>
		<!-- orders tab: end -->
	</inp2:m_if>
</inp2:m_DefineElement>

<inp2:ord_InitCatalogTab render_as="order_catalog_tab" default_grid="Search" radio_grid="Radio"/>
