<?xml version="1.0" encoding="utf-8" ?>
<c:Screen xmlns:c="BitMobile.Controls" xmlns:s="BitMobile.ValueStack">

	<s:Push Id="search" Value="$param1"></s:Push>

	<s:Push Id="groups" Value="$Facade.GetSKUGroups($search)"></s:Push>

	<c:VerticalLayout>

		<c:DockLayout CssClass="top_navigator">
			<c:Button Id="btnBack" CssClass="btn_back" OnEvent="Back" OnClickAction="$Workflow.DoRollback()" />
			<c:Button Id="btnForward" CssClass="btn_grey_forward" OnEvent="Forward" />
			<c:TextView Text="#stock#" />
		</c:DockLayout>
		<c:HorizontalLine />

		<c:HorizontalLayout CssClass="search">
			<s:Push Id="filterClass" Value="$Facade.FilterButtonClass()"></s:Push>
			<c:Button Id="btnFilter" CssClass="$filterClass" OnClickAction="$Workflow.DoAction(SetFilter)"></c:Button>
			<c:DockLayout>
				<c:Image />
				<c:EditText Id="edtSearch" Text="$search" Placeholder="#search#"></c:EditText>
			</c:DockLayout>
			<c:Button Id="btnSearch" Text="#search#" OnClickAction="$Workflow.DoRefresh($edtSearch.Text)"></c:Button>

		</c:HorizontalLayout>

		<c:HorizontalLine />

		<c:ScrollView Id="grScrollView" CssClass="grid">

			<s:Iterator Id="group" Value="$groups">
				<s:Push Id="skusByGroup" Value="$Facade.GetSKUs($search,$group.Id, null)"></s:Push>
				<s:If Test="$groupIsNotEmpty">
					<c:HorizontalLayout CssClass="blockEdit">
						<c:VerticalLayout>
							<c:TextView Text="$group.Description" CssClass="main_row"></c:TextView>
						</c:VerticalLayout>
					</c:HorizontalLayout>
					<c:HorizontalLine CssClass="editLine" />
				</s:If>

				<s:Iterator Id="sku" Value="$skusByGroup">

					<c:HorizontalLayout Id="grSKU" OnClickAction="$Workflow.DoAction(Select, $sku)">
						<c:VerticalLayout>
							<c:TextView Text="$sku.Description" CssClass="main_row"></c:TextView>
							<c:TextView Text="{$sku.CommonStock} {$sku.BaseUnitAsObject.Description}" CssClass="description_row"></c:TextView>
						</c:VerticalLayout>
						<c:Image />
					</c:HorizontalLayout>
					<c:HorizontalLine />

				</s:Iterator>
			</s:Iterator>

		</c:ScrollView>

	</c:VerticalLayout>

</c:Screen>