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

	<s:Push Id="order" Value="$workflow.order"></s:Push>
	<s:Push Id="search" Value="$param2"></s:Push>

	<s:Push Id="skusByGroup" Value="$GetSKUAndGroups($search, $order.PriceList, $order.Stock)"></s:Push>

	<c:DockLayout>

		<c:HorizontalLayout CssClass="margin_top"></c:HorizontalLayout>

		<c:HorizontalLayout Id="btnDone" CssClass="bottom_btn" OnEvent="Back" OnClickAction="$DoBackTo(Order)">
			<c:TextView Text="#ready#"></c:TextView>
		</c:HorizontalLayout>
		<c:HorizontalLine CssClass="b_line" />

		<c:HorizontalLine />
		<c:HorizontalLayout CssClass="search">
			<c:DockLayout>
				<c:Image />
				<c:EditText Id="edtSearch" Text="$search" OnGetFocus="$HideSwiped()" Placeholder="#search#"></c:EditText>
			</c:DockLayout>
			<c:Button Id="btnSearch" Text="#search#" OnClickAction="$DoRefresh($param1,$edtSearch.Text)"></c:Button>
		</c:HorizontalLayout>
		<c:HorizontalLine />

		<c:DockLayout CssClass="parameter_grid" OnClickAction="$Workflow.DoAction(SetFilter)">
			<c:TextView Text="#filter#"></c:TextView>
			<c:Image></c:Image>
		</c:DockLayout>
		<c:HorizontalLine />



		<c:ScrollView Id="grScrollView" OnScroll="$OnScroll()">
			<s:Push Id="currentGroup" Value=""></s:Push>

			<s:Iterator Id="item" Value="$skusByGroup" Status="statusCount">
				<s:Push Id="index" Value="$statusCount.Index"></s:Push>

				<s:If Test="$currentGroup != $item.GroupDescription">
					<s:Push Id="currentGroup" Value="$item.GroupDescription"></s:Push>
					<s:Push Id="groupPath" Value="$GetGroupPath($item.GroupId, $item.GroupParent, $item.ParentDescription)"></s:Push>
					<c:HorizontalLayout CssClass="caption_grid">
						<c:TextView Text="{$groupPath} / {$currentGroup}"></c:TextView>
					</c:HorizontalLayout>
					<c:HorizontalLine CssClass="editLine" />
				</s:If>


				<c:SwipeHorizontalLayout Id="swipe_layout" CssClass="swipe_order" Index="1" OnSwipe="$GetQuickOrder($item.Id, $item.Price, $index, pack{$index}, textView{$index})">
					<c:HorizontalLayout CssClass="quickOrder">
						<c:VerticalLayout>
							<c:HorizontalLayout>
								<c:HorizontalLayout>
									<c:EditText Id="editText{$index}" Text="0" Keyboard="numeric" />
									<c:TextView Id="pack{$index}" Text=""/>
								</c:HorizontalLayout>
								<c:Button Text="+1" CssClass="add_button" OnClick="$AddToOrder(editText{$index})" />
								<c:Button CssClass="cart_button" OnClick="$CreateOrderItem(editText{$index}, textView{$index}, pack{$index}, $item.Id, $item.Price, pack{$index}, $index, $swipe_layout)" />
							</c:HorizontalLayout>
							<c:TextView Id="textView{$index}" Text="0 {#alreadyOrdered#}" />
						</c:VerticalLayout>
					</c:HorizontalLayout>
					<c:HorizontalLayout OnClickAction="$DoAction(SelectSKU, $item.Id, $item.Price)" CssClass="grid">
						<c:VerticalLayout>
							<c:TextView Text="$item.Description" CssClass="main_row"></c:TextView>
							<c:TextView Text="#price2# {$item.Price}  #stock#: {$item.CommonStock} #brand#: {$item.Brand}" CssClass="description_row"></c:TextView>
						</c:VerticalLayout>
						<c:Image />
					</c:HorizontalLayout>
				</c:SwipeHorizontalLayout>
				<c:HorizontalLine />

			</s:Iterator>

		</c:ScrollView>

	</c:DockLayout>

</c:Screen>