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

	<s:Push Id="nextVisit" Value="$GetNextVisit($workflow.outlet)"></s:Push>

	<c:VerticalLayout>

		<c:DockLayout CssClass="top_navigator">
			<c:DockLayout Id="btnBack" CssClass="btn_back" OnEvent="Back" OnClickAction="$DoBack()">
				<c:Image />
				<c:TextView Text="#back#" />
			</c:DockLayout>
			<c:DockLayout CssClass="btn_forward" OnEvent="Forward" OnClickAction="$CheckAndCommit($workflow.order, $workflow.visit, $workflow.name)" >
				<c:TextView Id="btnForward" Text="#ready#" />
			</c:DockLayout>
			<c:HorizontalLayout>
				<c:TextView Text="#visitTotal#" />
			</c:HorizontalLayout>
		</c:DockLayout>

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

		<c:ScrollView Id="grScrollView">

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

			<s:If Test="$OrderExists($workflow.visit)">
				<c:HorizontalLayout CssClass="grid" OnClickAction="$SetDeliveryDate($workflow.order, $deliveryDate)">
					<c:VerticalLayout>
						<c:TextView Text="#deliveryDate#" CssClass="description_row"></c:TextView>
						<c:TextView Id="deliveryDate" Text="$FormatDate($workflow.order.DeliveryDate)" CssClass="main_row"></c:TextView>
					</c:VerticalLayout>
				</c:HorizontalLayout>
				<c:HorizontalLine />
			</s:If>

			<s:If Test="$sessionConst.PlanEnbl">
				<c:HorizontalLayout CssClass="grid" OnClickAction="$SetnextVisitDate($nextVisit, $nextVisitControl)">
					<c:VerticalLayout>
						<c:TextView Text="#nextVisitDate#" CssClass="description_row"></c:TextView>
						<c:TextView Id="nextVisitControl" Text="$FormatOutput($nextVisit.PlanDate)" CssClass="main_row"></c:TextView>
					</c:VerticalLayout>
				</c:HorizontalLayout>
				<c:HorizontalLine />
			</s:If>

			<s:If Test="@checkOrderReason">
				<c:DockLayout CssClass="grid" OnClickAction="$DoSelect($workflow.visit,ReasonForNotOfTakingOrder,$noOrderReason,#reasonForEmptyOrder#)">
					<s:If Test="$IsEmptyValue($workflow.visit.ReasonForNotOfTakingOrder)">
						<c:HorizontalLayout CssClass="required_side_wh"></c:HorizontalLayout>
					</s:If>
					<s:Else>
						<c:HorizontalLayout CssClass="answered_side_wh"></c:HorizontalLayout>
					</s:Else>
					<c:VerticalLayout>
						<c:TextView Text="#reasonForEmptyOrder#" CssClass="description_row"></c:TextView>
						<c:TextView Id="noOrderReason" Text="$FormatOutput($workflow.visit.ReasonForNotOfTakingOrder.Description)" CssClass="main_row"></c:TextView>
					</c:VerticalLayout>
				</c:DockLayout>
				<c:HorizontalLine />
			</s:If>

			<s:If Test="@checkVisitReason">
				<c:DockLayout CssClass="grid" OnClickAction="$DoSelect($workflow.visit,ReasonForVisit,$visitReason,#visitReason#)">
					<s:If Test="$IsEmptyValue($workflow.visit.ReasonForVisit)">
						<c:HorizontalLayout CssClass="required_side_wh"></c:HorizontalLayout>
					</s:If>
					<s:Else>
						<c:HorizontalLayout CssClass="answered_side_wh"></c:HorizontalLayout>
					</s:Else>
					<c:VerticalLayout>
						<c:TextView Text="#visitReason#" CssClass="description_row"></c:TextView>
						<c:TextView Id="visitReason" Text="$FormatOutput($workflow.visit.ReasonForVisit.Description)" CssClass="main_row"></c:TextView>
					</c:VerticalLayout>
				</c:DockLayout>
				<c:HorizontalLine />
			</s:If>

			<c:HorizontalLayout CssClass="memo_block">
				<c:VerticalLayout>
					<c:TextView Text="#commentary#" CssClass="description_row"></c:TextView>
					<c:MemoEdit Value="$workflow.visit.Commentary" CssClass="main_row" Placeholder="—"></c:MemoEdit>
				</c:VerticalLayout>
			</c:HorizontalLayout>
			<c:HorizontalLine />

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

			<s:If Test="$NoQuestionnaires($workflow.skipQuestions, $workflow.skipSKUs)">
				<c:DockLayout CssClass="parameter_grid">
					<s:Push Id="answered" Value="$GetSum($workflow.questions_answ, $workflow.questions_answ_sku)"></s:Push>
					<s:Push Id="questions" Value="$GetSum($workflow.questions_qty, $workflow.questions_qty_sku)"></s:Push>
					<c:TextView Text="#questAnswers#"></c:TextView>
					<c:TextView Text="{$answered} #of# {$questions}" CssClass="value"></c:TextView>
				</c:DockLayout>
				<c:HorizontalLine />
			</s:If>

			<s:If Test="$NoTasks($workflow.skipTasks)">
				<c:DockLayout CssClass="parameter_grid">
					<s:Push Id="todoDone" Value="$CountDoneTasks($workflow.visit)"></s:Push>
					<s:Push Id="todo" Value="$CountTasks($workflow.outlet)"></s:Push>
					<c:TextView Text="#todoDone#"></c:TextView>
					<c:TextView Text="{$todoDone} #of# {$todo}" CssClass="value"></c:TextView>
				</c:DockLayout>
				<c:HorizontalLine />
			</s:If>

			<c:DockLayout CssClass="parameter_grid">
				<c:TextView Text="#orderSum#"></c:TextView>
				<c:TextView Text="{$GetOrderSUM($workflow.order)}" CssClass="value"></c:TextView>
			</c:DockLayout>
			<c:HorizontalLine />

			<s:If Test="$sessionConst.encashEnabled">
				<c:DockLayout CssClass="parameter_grid">
					<c:TextView Text="#encashmentSum#"></c:TextView>
					<c:TextView Text="{$FormatValue($workflow.encashment.EncashmentAmount)}" CssClass="value"></c:TextView>
				</c:DockLayout>
				<c:HorizontalLine />
			</s:If>

		</c:ScrollView>

	</c:VerticalLayout>

</c:Screen>
