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

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

	<c:SwipeHorizontalLayout Id="swipe_layout" Index="1">

		<s:Include File="\Components\SideMenu.xml"/>

		<c:DockLayout>

			<c:DockLayout CssClass="top_navigator">
				<c:DockLayout Id="btnMenu" CssClass="btn_menu" OnEvent="Back" OnClickAction="$OpenMenu($swipe_layout)">
					<c:Image CssClass="menuIcon" />
				</c:DockLayout>
				<c:DockLayout CssClass="btn_space" >
					<c:TextView Id="btnForward" Text="" />
				</c:DockLayout>
				<c:HorizontalLayout>
					<c:TextView Id="listTitleTV" Text="@listTitle" />
				</c:HorizontalLayout>
			</c:DockLayout>
			<c:HorizontalLine />


			<c:HorizontalLayout Id="btnAdd" CssClass="bottom_btn" OnClickAction="$DoAction(Create)">
				<c:TextView Text="#add#"></c:TextView>
			</c:HorizontalLayout>
			<c:HorizontalLine CssClass="b_line" />

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


			<c:ScrollView Id="grScrollView">
				<c:HorizontalLayout CssClass="margin_top"></c:HorizontalLayout>
				<s:If Test="$NoOrders()">
					<c:TextView Text="@no_docs" CssClass="no_items" />
				</s:If>
				<s:Else>
					<c:HorizontalLine />
				</s:Else>

				<s:Iterator Id="order" Value="$GetItems($search)">

					<s:Push Id="checkedNumber" Value="$AssignNumberIfNotExist($order.Number)"></s:Push>

					<!-- <c:HorizontalLayout CssClass="grid" OnClickAction="$DoAction(Review,$order.Outlet,null,$order.Id)"> -->
					<c:HorizontalLayout CssClass="grid" OnClickAction="$SelectOrder($order.Id,$order.Outlet)">
						<s:If Test="$OrderCanceled($order.Status)">
							<c:Image CssClass="red_mark"></c:Image>
						</s:If>
						<s:Else>
							<c:VerticalLayout CssClass="no_mark"></c:VerticalLayout>
						</s:Else>
						<c:VerticalLayout>
							<c:TextView Text="$order.OutletDescription" CssClass="main_row"></c:TextView>
							<c:TextView Text="{$checkedNumber}, {$order.Date}" CssClass="description_row"></c:TextView>
						</c:VerticalLayout>
						<c:Image />
					</c:HorizontalLayout>
					<c:HorizontalLine />

				</s:Iterator>

				<c:HorizontalLayout CssClass="end_of_block" />

			</c:ScrollView>

		</c:DockLayout>

		</c:SwipeHorizontalLayout>

</c:Screen>
