﻿<?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="UserID" select="/AjaxRequest/Params/UserID"></xsl:variable>
		<xsl:variable name="MasterPortalItemID" select="/AjaxRequest/Params/MasterPortalItemID"></xsl:variable>
		<xsl:variable name="PortalItemID" select="/AjaxRequest/Params/PortalItemID"></xsl:variable>
		<xsl:variable name="Classification" select="/AjaxRequest/Params/Classification"></xsl:variable>
		<xsl:variable name="KeyDate" select="/AjaxRequest/Params/KeyDate"></xsl:variable>
		<xsl:variable name="DivID" select="/AjaxRequest/Params/DivID"></xsl:variable>
		<xsl:variable name="BusinessPlanNavigation" select="/AjaxRequest/Params/BusinessPlanNavigation"></xsl:variable>
		<xsl:variable name="UpcomingTaskHTML" select="/AjaxRequest/UpcomingTaskHTML"></xsl:variable>
		<xsl:variable name="CountRecords" select="AjaxRequest/CountRecords"></xsl:variable>
		<xsl:variable name="CurrentDate" select="AjaxRequest/CurrentDate"></xsl:variable>
		<xsl:variable name="GoalItemID" select="AjaxRequest/GoalItemID"></xsl:variable>
		<xsl:variable name="AllowGoalAddition" select="AjaxRequest/Params/AllowGoalAddition"></xsl:variable>
		<xsl:variable name="varAddProgram">
			<xsl:choose>
				<xsl:when test="$Classification='BusinessPlanning'">
					<xsl:text>BusinessPlan</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$Classification"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="OnClickAddProgram">
			<xsl:choose>
				<xsl:when test="$MasterPortalItemID =$PortalItemID">
					<xsl:text>getUserAndPortalDetailsByPortalID(</xsl:text>
					<xsl:value-of select="$PortalItemID"/>
					<xsl:text>, null, '</xsl:text>
					<xsl:value-of select="$varAddProgram"/>
					<xsl:text>', 'divAddProgram_BusinessPlan');</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>baseBrandAutoSuggest_selectAutoSuggetData('</xsl:text>
					<xsl:value-of select="$PortalItemID"/>
					<xsl:text>','</xsl:text>
					<xsl:value-of select="$UserID"/>
					<xsl:text>', 'N/A', 'PortalAddGoalWizardForSelectedUser', 'divAddProgram_BusinessPlan','-99','-99','MarkAutoSuggestDataSelected_3_0','</xsl:text>
					<xsl:value-of select="$varAddProgram"/>
					<xsl:text>','</xsl:text>
					<xsl:value-of select="$Classification"/>
					<xsl:text>');</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="LeftDivStyle">
			<xsl:choose>
				<xsl:when test="$Classification='BusinessPlanning'">
					<xsl:text></xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>
						width:37%!important;margin-right:0px!important;webkit-border-radius: 2px;
						-moz-border-radius: 2px; -ms-border-radius: 2px; -o-border-radius: 2px;
					   border-radius: 2px;   -webkit-box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.2);
					   -moz-box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.2);   box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.2);    float: left;
				</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="RightDivStyle">
			<xsl:choose>
				<xsl:when test="$Classification='BusinessPlanning'">
					<xsl:text></xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>
			width:60%!important;webkit-border-radius: 2px;
			 -moz-border-radius: 2px;   -ms-border-radius: 2px;  -o-border-radius: 2px;   border-radius: 2px;
		   -webkit-box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.2);
			 -moz-box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.2);   box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.2);  float: left;margin-bottom:10px;
				</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<div class="BusinessPlan padingrite" style="width:100%">
			<xsl:choose>
				<xsl:when test="$Classification='BusinessPlanning'">
					<style>
						.BusinessPlan .leftRowDiv
						{
						display:none;!important;
						}
						.BusinessPlan .col-sm-12.col-md-6.mrginbtm.box.inner.light-gray.Rt.WorkSheet.padgLR
						{
						float: none;
						margin: 0 auto!Important;
						width: 90%!important;
						}
					</style>
				</xsl:when>
				<xsl:when test="$Classification !='BusinessPlanning' and $CountRecords &gt; 0">
					<style>
						.BusinessPlan
						{
						background:#dedede;
						float:left;padding-top:10px;
						}
						.BusinessPlan .Lt
						{
						background:#fff;
						margin-left:10px;
						width:35%!important;
						}
						.BusinessPlan .Rt
						{
						background:#fff;
						}
					</style>
				</xsl:when>
			</xsl:choose>
			<xsl:choose>
				<xsl:when test="$Classification !='BusinessPlanning' and $CountRecords &gt; 0">
					<div class="col-sm-12 col-md-6 mrginbtm box inner light-gray Lt" style="{$LeftDivStyle}">
						<div class="section-title" style="padding-bottom:6px;">
							<div class="lftasks">
								My Upcoming Modules
							</div>
							<div  class="ritody">
								<xsl:call-template name="UpComingTaskFilter">
									<xsl:with-param name="DisplayDateDiv" select="'divDisplayDate'"></xsl:with-param>
									<xsl:with-param name="DivID" select="'divUserGoalForTemplate'"></xsl:with-param>
									<xsl:with-param name="GoalItemID" select="'-99'"></xsl:with-param>
									<xsl:with-param name="PageNumber" select="'1'"></xsl:with-param>
									<xsl:with-param name="ResponsibleID" select="$UserID"></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="$Classification"></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="divUserGoalForTemplate">
							<xsl:value-of select="$UpcomingTaskHTML" disable-output-escaping="yes"/>
						</div>
					</div>
				</xsl:when>
				<xsl:otherwise>
					<div class="col-md-12 MyUpcomingDiv" id="divUserGoalForTemplate">
						<xsl:choose>
							<xsl:when test="$CountRecords &gt; 0">
								<xsl:value-of select="$UpcomingTaskHTML" disable-output-escaping="yes"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:choose>
									<xsl:when test="$GoalItemID &gt; 0">
										<xsl:text>No record found</xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:choose>
											<xsl:when test="$AllowGoalAddition != 0">
												<div  class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray adbtn"
								   style="width:150px;line-height:30px;text-align:center;float:left;display:none"
								   onclick="$('#divUserGoalForTemplate').css('display','none');
							$('#divAddProgram_BusinessPlan').css('display','inline-block');{$OnClickAddProgram}" id="btnClickBusinessAddPlan">
													<span class="glyphicon glyphicon-plus"></span>
													<span id="span_Cancel">
														Create a Plan for <xsl:value-of select="substring-after($KeyDate, '01/01/')"/>
													</span>
												</div>
												<script>
													$('#divUserGoalForTemplate').css('display','none');
													$('#divAddProgram_BusinessPlan').css('display','inline-block');
													<xsl:value-of select="$OnClickAddProgram"></xsl:value-of>
												</script>
											</xsl:when>
											<xsl:otherwise>
												<xsl:text>No program available</xsl:text>
											</xsl:otherwise>
										</xsl:choose>

									</xsl:otherwise>
								</xsl:choose>

							</xsl:otherwise>
						</xsl:choose>
					</div>
				</xsl:otherwise>
			</xsl:choose>

			<xsl:choose>
				<xsl:when  test="$CountRecords &gt; 0">
					<xsl:variable name="hideclass">
						<xsl:choose>
							<xsl:when test="$CountRecords=1">
								hide
							</xsl:when>
					</xsl:choose>
					</xsl:variable>
					<div class="col-sm-12 col-md-6 mrginbtm box inner light-gray Rt WorkSheet padgLR" style="{$RightDivStyle}">
						<div width="100%">
							<i id="PrevSliderArrow" class="glyphicon glyphicon-menu-left iconL onMouseOver disabledArrow {$hideclass}"
							   onclick="nextOrPreviousUpcomingTask('prev', 'ClickRowID', -99)" >
							</i>
							<div style="width:90%" class="Midiv1">
								<span id="spanWorksheetHeaderName" style="visibility: hidden;">Worksheet </span>
								<span id="spanCurrentWorksheetPage" style="visibility: hidden;"></span>
								<span id="spanPageDiff"></span>
								<span id="spanTotalWorkSheetPage"></span>
							</div>
							<i id="NextSliderArrow" class="glyphicon glyphicon-menu-right iconL onMouseOver disabledArrow {$hideclass}"
							   onclick="nextOrPreviousUpcomingTask('next', 'ClickRowID', -99)">
							</i>
						</div>
						<div id="divWorksheetLeftSlide" class="Midiv1" style="width:100%;">
						</div>
					</div>
				</xsl:when>
				<xsl:otherwise>
					<div style="display:none;" id="divAddProgram_BusinessPlan"></div>
				</xsl:otherwise>
			</xsl:choose>
		</div>

	</xsl:template>
</xsl:stylesheet>
