<?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="executedOrder" Value="$FindExecutedOrder()"></s:Push>


	<s:Push Id="thisDoc" Value="$CreateDocumentIfNotExists($executedOrder, $workflow.visit)"></s:Push>

	<s:Push Id="sum" Value="$GetOrderSUM($thisDoc)"></s:Push>

	<c:DockLayout>

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

		<s:If Test="$workflow.name=='Visit'">
			<c:Image CssClass="5_scroll"></c:Image>
		</s:If>

		<c:HorizontalLine />

		<s:If Test="$IsNew($thisDoc)">
			<s:If Test="$NotEmptyRef($thisDoc.PriceList)">
				<c:HorizontalLayout Id="btnAdd" CssClass="bottom_btn" OnEvent="Back" OnClickAction="$DoAction(Add, null, $thisDoc)">
					<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="{@infoTitle}:"></c:TextView>
			</c:HorizontalLayout>
			<c:HorizontalLine />

			<c:DockLayout CssClass="grid" OnClickAction="$DoAction(ShowInfo,$sum,null,$thisDoc)">
				<c:Image />
				<c:VerticalLayout>
					<c:TextView Text="$GetDescription($thisDoc.PriceList)" CssClass="main_row_price_list"></c:TextView>
					<c:TextView Text="{@sumTitle}:" CssClass="description_row"></c:TextView>
					<c:TextView Text="$FormatValue($sum)" CssClass="main_row"></c:TextView>
				</c:VerticalLayout>
			</c:DockLayout>
			<c:HorizontalLine />

			<c:HorizontalLayout CssClass="end_of_block" />

			<c:HorizontalLayout CssClass="caption_grid">
				<c:TextView Id="skuTitleTV" Text="{@skuTitle}:"></c:TextView>
			</c:HorizontalLayout>
			<c:HorizontalLine />

			<s:Iterator Id="orderitem" Value="$GetOrderedSKUs($thisDoc)" Status="statusCount">
				<s:Push Id="index" Value="$statusCount.Index"></s:Push>

				<s:If Test="$orderitem != null">
					<c:SwipeHorizontalLayout Id="swipe_layout2" CssClass="swipe_layout">
						<c:DockLayout CssClass="grid" OnClickAction="$EditIfNew($thisDoc,$orderitem.Id)">
							<s:If Test="$IsNew($thisDoc)">
								<c:Image />
							</s:If>
							<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#: {$FormatValue($orderitem.Amount)}" CssClass="description_row"></c:TextView>
							</c:VerticalLayout>
						</c:DockLayout>
						<s:If Test="$IsNew($thisDoc)">
							<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>
