﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
	<xsl:import href="../Reports/UpComingTaskFilter.xslt"/>
	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:variable name="GoalItemID" select="AjaxRequest/Params/GoalItemID"></xsl:variable>
		<xsl:variable name="LoggedInUserID" select="AjaxRequest/LoggedInUserID"></xsl:variable>
		<xsl:variable name="IsCoach" select="AjaxRequest/IsCoach"></xsl:variable>
		<xsl:variable name="SuccessKey" select="AjaxRequest/GoalDetail/SuccessKey"></xsl:variable>
		<xsl:variable name="MasterPortalItemID" select="AjaxRequest/Settings/MasterPortalItemID"></xsl:variable>
		<xsl:variable name="CurrentDate" select="AjaxRequest/CurrentDate"></xsl:variable>
		<xsl:variable name="SelectedUserID" >
			<xsl:choose>
				<xsl:when test="AjaxRequest/Params/SelectedUserID !=''">
					<xsl:value-of  select="AjaxRequest/Params/SelectedUserID"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:choose>
						<xsl:when test="$IsCoach = 1">
							<xsl:number value="0"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$LoggedInUserID"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<div class="col-sm-12 col-md-12 RiteTxt right-section A" style="width:100% !important">
			<div class="TaskBordr padingrite" id="divTopicSummary">
				<script>
					loadGoalUserTopicSummary(<xsl:value-of select="$GoalItemID"/>,'divTopicSummary',<xsl:value-of select="$SelectedUserID"/>,'<xsl:value-of select="$SuccessKey"/>');
				</script>
			</div>
			<div class="padingrite">
				<div class="col-sm-12 col-md-6 mrginbtm box inner light-gray Lt" >
					<div class="section-title" style="padding-bottom:6px;">
						<div class="lftasks">
							<xsl:variable name="UpcomingTaskHeading">
								<xsl:choose>
									<xsl:when test="$SuccessKey='Worksheets' or $SuccessKey='BusinessPlanning'">
										<xsl:text>Modules</xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:text>Tasks</xsl:text>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>
							<xsl:choose>
								<xsl:when test="$LoggedInUserID=$SelectedUserID">
									<xsl:text>My Upcoming </xsl:text>
									<xsl:value-of select="$UpcomingTaskHeading"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>Upcoming </xsl:text>
									<xsl:value-of select="$UpcomingTaskHeading"/>
								</xsl:otherwise>
							</xsl:choose>
						</div>
						<div  class="ritody">
							<xsl:call-template name="UpComingTaskFilter">
								<xsl:with-param name="DisplayDateDiv" select="'divDisplayDate'"></xsl:with-param>
								<xsl:with-param name="GoalItemID" select="$GoalItemID"></xsl:with-param>
								<xsl:with-param name="DivID" select="'divMyUpComingTask'"></xsl:with-param>
								<xsl:with-param name="PageNumber" select="'1'"></xsl:with-param>
								<xsl:with-param name="ResponsibleID" select="$LoggedInUserID"></xsl:with-param>
								<xsl:with-param name="MasterPortalItemID" select="$MasterPortalItemID"></xsl:with-param>
								<xsl:with-param name="PortalItemID" select="'-99'"></xsl:with-param>
								<xsl:with-param name="SuccessKey" select="$SuccessKey"></xsl:with-param>
								<xsl:with-param name="ItemType" select="''"></xsl:with-param>
								<xsl:with-param name="CompletePercentage" select="''"></xsl:with-param>
								<xsl:with-param name="CurrentDate" select="$CurrentDate"></xsl:with-param>
								<xsl:with-param name="SelectedText" select="'Top 10'"></xsl:with-param>
							</xsl:call-template>
						</div>
					</div>

					<div class="section-title" style="text-align:center;border:none;" id="divDisplayDate">
					</div>
					<div class="col-md-12 MyUpcomingDiv" id="divMyUpComingTask">
						<xsl:choose>
							<xsl:when test="$SuccessKey='Worksheets' or $SuccessKey='BusinessPlanning'">
								<script>
									loadUpComingGoalTask_3_0(<xsl:value-of select="$GoalItemID"/>,'divMyUpComingTask',1,<xsl:value-of select="$SelectedUserID"/>,-99,-99,'<xsl:value-of select="$SuccessKey"/>',14,75);
								</script>
							</xsl:when>
							<xsl:otherwise>
								<script>
									loadUpComingGoalTask_3_0(<xsl:value-of select="$GoalItemID"/>,'divMyUpComingTask',1,<xsl:value-of select="$SelectedUserID"/>,-99,-99,'<xsl:value-of select="$SuccessKey"/>');
								</script>
							</xsl:otherwise>
						</xsl:choose>
						<script>

						</script>
					</div>
				</div>
				<xsl:choose>
					<xsl:when test="$SuccessKey !='Worksheets' and $SuccessKey !='BusinessPlanning'">
						<div class="col-sm-12 col-md-6 mrginbtm box inner light-gray Rt">
							<div class="section-title">
								<p>Recent Activity</p>
							</div>
							<div class="col-md-12 RecentAct" id="divGoalUserNotification">
								<script>
									loadGoalUserNotifications(<xsl:value-of select="$GoalItemID"/>,'divGoalUserNotification', null,null,<xsl:value-of select="$SelectedUserID"/>);
								</script>
							</div>
						</div>
					</xsl:when>
					<xsl:otherwise>
						<div class="col-sm-12 col-md-6 mrginbtm box inner light-gray Rt WorkSheet padgLR">
							<div width="100%">
								<i id="PrevSliderArrow" class="glyphicon glyphicon-menu-left iconL onMouseOver" onclick="nextOrPreviousUpcomingTask('prev', 'ClickRowID', -99)" >
								</i>
								<div style="width:90%" class="Midiv1">
									<span id="spanCurrentWorksheetPage"></span>
									<span id="spanPageDiff"></span>
									<span id="spanTotalWorkSheetPage"></span>
								</div>
								<i id="NextSliderArrow" class="glyphicon glyphicon-menu-right iconL onMouseOver" onclick="nextOrPreviousUpcomingTask('next', 'ClickRowID', -99)">
								</i>
							</div>
							<div id="divWorksheetLeftSlide" class="Midiv1" style="width:100%;">
							</div>
						</div>
					</xsl:otherwise>
				</xsl:choose>
			</div>
		</div>
	</xsl:template>
</xsl:stylesheet>
