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

	<s:Push Id="outlet" Value="$workflow.outlet"></s:Push>
	<s:Push Id="visit" Value="$workflow.visit"></s:Push>
	<s:Push Id="exTasks" Value="$GetExecutedTasks($workflow.visit)"></s:Push>
	<s:Push Id="newTasks" Value="$GetNotExecutedTasks($workflow.visit)"></s:Push>


	<c:VerticalLayout>

		<c:DockLayout CssClass="top_navigator">
			<c:DockLayout Id="btnBack" CssClass="btn_back" OnEvent="Back" OnClickAction="$DoBackTo(Outlet)">
				<c:Image />
				<c:TextView Text="#back#" />
			</c:DockLayout>
			<c:DockLayout  OnEvent="Forward" CssClass="btn_forward" OnClickAction="$Workflow.DoForward()">
				<c:TextView Id="btnForward" Text="#forward#" />
			</c:DockLayout>			
			<c:HorizontalLayout>
				<c:TextView Text="#tasks#" />
			</c:HorizontalLayout>
		</c:DockLayout>

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

		<c:ScrollView Id="grScrollView">

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

			<s:Iterator Id="task" Value="$newTasks">

				<c:SwipeHorizontalLayout Id="swipe_layout1" CssClass="swipe_layout" Index="1">
					<c:HorizontalLayout CssClass="green_swipe" OnClickAction="$CompleteTheTask($task.Id, $workflow.visit)">
						<c:VerticalLayout>
							<c:Image></c:Image>
							<c:TextView Text="#execute#"></c:TextView>
						</c:VerticalLayout>
					</c:HorizontalLayout>
					<c:DockLayout CssClass="grid" OnClickAction="$DoAction(Select, $task.Id, null, $task.Target)">
						<c:Image />
						<c:VerticalLayout>
							<c:TextView Text="$task.PlanDate" CssClass="description_row"></c:TextView>
							<c:TextView Text="$task.TextTask" CssClass="main_row"></c:TextView>
						</c:VerticalLayout>						
					</c:DockLayout>
				</c:SwipeHorizontalLayout>
				<c:HorizontalLine />

			</s:Iterator>

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

			<s:Iterator Id="eTask" Value="$exTasks">

				<c:SwipeHorizontalLayout Id="swipe_layout2" CssClass="swipe_layout">
					<c:DockLayout CssClass="grid" OnClickAction="$DoAction(Select, $eTask.Id.TaskRef ,$eTask.Id, $eTask.Target)">
						<c:Image />
						<c:VerticalLayout>
							<c:TextView Text="$eTask.PlanDate" CssClass="description_row"></c:TextView>
							<c:TextView Text="$eTask.TextTask" CssClass="main_row"></c:TextView>
						</c:VerticalLayout>						
					</c:DockLayout>
					<c:HorizontalLayout CssClass="gray_swipe" OnClickAction="$RetrieveTask($eTask.Id)">
						<c:VerticalLayout>
							<c:Image></c:Image>
							<c:TextView Text="#retrieve#"></c:TextView>
						</c:VerticalLayout>
					</c:HorizontalLayout>
				</c:SwipeHorizontalLayout>
				<c:HorizontalLine />

			</s:Iterator>

		</c:ScrollView>

	</c:VerticalLayout>

</c:Screen>