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

	<s:Push Id="workflow.outlet" Value="$outlet"></s:Push>
	<s:Push Id="executedOrder" Value="$param3"></s:Push>

	<s:Push Id="workflow.order" Value="$CreateOrderIfNotExists($workflow.order, $outlet, $common.UserRef, $workflow.visit, $executedOrder)"></s:Push>

	<s:Push Id="items" Value="$GetOrderedSKUs($workflow.order)"></s:Push>
	<s:Push Id="sum" Value="$GetOrderSUM($workflow.order)"></s:Push>

	<c:DockLayout>

		<c:DockLayout CssClass="top_navigator">
			<c:HorizontalLayout Id="btnBack" CssClass="btn_back" OnEvent="Back" OnClickAction="$OrderBack()">
				<c:Image />
				<c:TextView Text="#back#" />
			</c:HorizontalLayout>
			<c:Button Id="btnForward" Text="#forward#" CssClass="btn_forward" OnEvent="Forward" OnClickAction="$CheckIfEmptyAndForward($workflow.order, $workflow.name)" />
			<c:HorizontalLayout>
				<c:TextView Text="#order#" />
			</c:HorizontalLayout>
		</c:DockLayout>

		<c:Image CssClass="5_scroll"></c:Image>
		<c:HorizontalLine />

		<s:If Test="$IsNew($workflow.order)">
			<s:If Test="$NotEmptyRef($workflow.order.PriceList)">
				<c:HorizontalLayout Id="btnAdd" CssClass="bottom_btn" OnEvent="Back" OnClickAction="$DoAction(Add)">
					<c:TextView Text="#add#"></c:TextView>
				</c:HorizontalLayout>
				<c:HorizontalLine CssClass="b_line" />
			</s:If>
		</s:If>

		<c:ScrollView Id="grScrollView">

			<c:HorizontalLayout Id="Orderadd" CssClass="caption_grid">
				<c:TextView Text="#orderInfo#:"></c:TextView>
			</c:HorizontalLayout>
			<c:HorizontalLine />

			<c:HorizontalLayout CssClass="grid" OnClickAction="$DoAction(ShowInfo,$sum,null)">
				<c:VerticalLayout>
					<c:TextView Text="$GetDescription($workflow.order.PriceList)" CssClass="description_row"></c:TextView>
					<c:TextView Text="#orderSum#:" CssClass="description_row"></c:TextView>
					<c:TextView Text="$sum" CssClass="main_row"></c:TextView>
				</c:VerticalLayout>
				<c:Image />
			</c:HorizontalLayout>
			<c:HorizontalLine />

			<c:HorizontalLayout CssClass="caption_grid">
				<c:TextView Text="#skuInOrder#:"></c:TextView>
			</c:HorizontalLayout>
			<c:HorizontalLine />

			<s:Iterator Id="orderitem" Value="$items">

				<s:If Test="$orderitem != null">
					<c:SwipeHorizontalLayout Id="swipe_layout2" CssClass="swipe_layout">
						<c:HorizontalLayout CssClass="grid" OnClickAction="$EditIfNew($workflow.order,$orderitem.SKU,null,$orderitem.Id)">
							<c:VerticalLayout>
								<s:Push Id="featureDescr" Value="$GetFeatureDescr($orderitem.Feature)"></s:Push>
								<c:TextView Text="{$orderitem.SKU.Description}{$GetFeatureDescr($orderitem.Feature)}" CssClass="main_row"></c:TextView>
								<c:TextView Text="#quantity#: {$orderitem.Qty}   #amount#: {$orderitem.Amount}" CssClass="description_row"></c:TextView>
							</c:VerticalLayout>
							<s:If Test="$IsNew($workflow.order)">
								<c:Image />
							</s:If>
						</c:HorizontalLayout>
						<s:If Test="$IsNew($workflow.order)">
							<c:HorizontalLayout CssClass="red_swipe" OnClickAction="$DeleteItem($orderitem.Id, $executedOrder)">
								<c:VerticalLayout>
									<c:Image></c:Image>
									<c:TextView Text="#delete#"></c:TextView>
								</c:VerticalLayout>
							</c:HorizontalLayout>
						</s:If>
					</c:SwipeHorizontalLayout>
					<c:HorizontalLine />
				</s:If>

			</s:Iterator>

		</c:ScrollView>

	</c:DockLayout>

</c:Screen>