﻿<?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="../../Version_2_0/PortalAddGoalWizardTemplates.xslt"/>
	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:variable name="PortalID" select="AjaxRequest/Params/PortalID"></xsl:variable>
		<xsl:variable name="ParentPage" select="AjaxRequest/Params/ParentPage"></xsl:variable>
		<xsl:variable name="DivID" select="AjaxRequest/Params/DivID"></xsl:variable>
		<xsl:variable name="TemplateURL" select="AjaxRequest/TemplateURL"></xsl:variable>
		<xsl:variable name="HostName" select="AjaxRequest/HostName"></xsl:variable>
		<xsl:variable name="TemplateList" select="AjaxRequest/Items/Item"></xsl:variable>
		<xsl:variable name="Action" select="AjaxRequest/Action"></xsl:variable>
		<xsl:variable name="SelectedUserID" select="AjaxRequest/Params/SelectedUserID"></xsl:variable>

		<xsl:choose>
			<xsl:when test="$ParentPage='CoachingDashboardBox_01' or $ParentPage='CoachingDashboardBox_02' 
					  or $ParentPage='CoachingDashboardBox_03' or $ParentPage='CoachingDashboardBox_04'">
				<span class="col-md-4 col-sm-4 col-xs-4 w-50  m-T-10 ">
					<select style="float:left;width:100%;display:inline-block;" class="form-control pull-left dropdown"
						onchange="getAddItemPanelBySelection('ddl_{$ParentPage}',{$PortalID}, '{$DivID}', {$SelectedUserID},'{$ParentPage}');"
						id="ddl_{$ParentPage}">
						<option value="-99"> Select a goal</option>
						<xsl:for-each select="$TemplateList">
							<option value="{ItemID}">
								<xsl:value-of select="Item"/>
							</option>
						</xsl:for-each>
					</select>
				</span>
			</xsl:when>
			<xsl:when test="$ParentPage='CoachingDashboardBox_05'">
				<span class="col-md-4 col-sm-4 col-xs-4 w-50  m-T-10 ">
					<select style="float:left;width:100%;display:inline-block;" class="form-control pull-left dropdown"
						onchange="loadAddNoteAtGoalLevel_3_0({$PortalID}, {$SelectedUserID},  '{$DivID}','ddl_{$ParentPage}');"
						id="ddl_{$ParentPage}">
						<option value="-99"> Select a goal</option>
						<xsl:for-each select="$TemplateList">
							<option value="{ItemID}">
								<xsl:value-of select="Item"/>
							</option>
						</xsl:for-each>
					</select>
				</span>
			</xsl:when>
			<xsl:otherwise>
				<div>
					<div class="mrginTB">
						<span class="section-title padingL15 ">
							<span class="lftitledas">Select a Goal </span>
							<span class="ritedas">
								<input id="txtClientSideSearchProgram" placeholder="Search..." class="form-control" type="text" onKeyUp="SearchClientSide('ProgramClass', 'txtClientSideSearchProgram','hfdProgramPageNumber','hfdTotalProgramPageNumber',  'iconNextPage', 'iconPrevPage',event);"></input>
							</span>
						</span>
					</div>
					<div id="div_TemplateList" style="margin:20px auto 0px auto;text-align:center;float:none;">
						<xsl:variable name="countGoalList">
							<xsl:value-of select="count($TemplateList)"> </xsl:value-of>
						</xsl:variable>
						<xsl:variable name="styleNextArrow">
							<xsl:choose>
								<xsl:when test="$countGoalList &lt; 6">
									<xsl:text>display:none</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>display:inline-block</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<input type="hidden" value="1" id="hfdProgramPageNumber"/>
						<input type="hidden" value="{$countGoalList}" id="hfdTotalProgramPageNumber"/>
						<div class="col-md-1 col-sm-1 col-xs-6 contain divhide" style="float:left;text-align:left;">
							<xsl:if test="$countGoalList &gt; 5">
								<i onClick="getClientPageStart('Prev', 'ProgramClass', 'hfdProgramPageNumber', 'hfdTotalProgramPageNumber', 'iconNextPage', 'iconPrevPage');"
								   id="iconPrevPage" class="glyphicon glyphicon-menu-left arow onMouseOver" style="font-size: 43px;top:33px; left:10px;display:none;"></i>
							</xsl:if>
						</div>
						<div class="col-md-12 arowshow">
							<div class="col-md-6 col-sm-6 col-xs-6 contain midd">
								<xsl:if test="$countGoalList &gt; 5">
									<i id="iconPrevPageMob" class="glyphicon glyphicon-menu-left arow onMouseOver tpL" style="font-size: 43px;top:75px; left:45px;display:none;"
									   onClick="getClientPageStart('Prev', 'ProgramClass', 'hfdProgramPageNumber', 'hfdTotalProgramPageNumber', 'iconNextPage', 'iconPrevPage');"></i>
								</xsl:if>
							</div>
							<div class="col-md-6 col-sm-6 col-xs-6 contain midr">
								<xsl:if test="$countGoalList &gt; 5">
									<i id="iconNextPageMob" class="glyphicon tpR glyphicon-menu-right arow onMouseOver {$styleNextArrow}" style="font-size: 43px;top:75px; left:30px;"
									   onClick="getClientPageStart('Next', 'ProgramClass', 'hfdProgramPageNumber', 'hfdTotalProgramPageNumber', 'iconNextPage', 'iconPrevPage');"></i>
								</xsl:if>
							</div>
						</div>
						<xsl:for-each select="$TemplateList[position() &lt; 6]">
							<xsl:variable name="TemplateImageURL">
								<xsl:value-of select="ImageURL"/>
							</xsl:variable>
							<xsl:call-template name="PortalGoalWizardTemplateList_3_0">
								<xsl:with-param name="ItemID" select="ItemID"></xsl:with-param>
								<xsl:with-param name="Item" select="Item"></xsl:with-param>
								<xsl:with-param name="TemplateImageURL" select="$TemplateImageURL"></xsl:with-param>
								<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
								<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
								<xsl:with-param name="PromoteKey" select="PromoteKey"></xsl:with-param>
								<xsl:with-param name="TemplateDescription" select="FullDesc"></xsl:with-param>
								<xsl:with-param name="PortalItemID" select="$PortalID"></xsl:with-param>
								<xsl:with-param name="Action" select="$Action"></xsl:with-param>
								<xsl:with-param name="ParentPage" select="$ParentPage"></xsl:with-param>
								<xsl:with-param name="Position" select="position()"></xsl:with-param>
								<xsl:with-param name="DisplayClass" select="'display:inline-block'"></xsl:with-param>
								<xsl:with-param name="ProgramClass" select="'ProgramClass'"></xsl:with-param>
								<xsl:with-param name="DivID" select="$DivID"></xsl:with-param>
								<xsl:with-param name="SelectedUserID" select="$SelectedUserID"></xsl:with-param>
							</xsl:call-template>
						</xsl:for-each>
						<xsl:for-each select="$TemplateList[position() &gt; 5]">
							<xsl:variable name="TemplateImageURL">
								<xsl:value-of select="ImageURL"/>
							</xsl:variable>

							<xsl:call-template name="PortalGoalWizardTemplateList_3_0">
								<xsl:with-param name="ItemID" select="ItemID"></xsl:with-param>
								<xsl:with-param name="Item" select="Item"></xsl:with-param>
								<xsl:with-param name="TemplateImageURL" select="$TemplateImageURL"></xsl:with-param>
								<xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
								<xsl:with-param name="HostName" select="$HostName"></xsl:with-param>
								<xsl:with-param name="Origin">
									<xsl:text>LifespaceTemplate</xsl:text>
								</xsl:with-param>
								<xsl:with-param name="PromoteKey" select="PromoteKey"></xsl:with-param>
								<xsl:with-param name="TemplateDescription" select="FullDesc"></xsl:with-param>
								<xsl:with-param name="PortalItemID" select="$PortalID"></xsl:with-param>
								<xsl:with-param name="Action" select="$Action"></xsl:with-param>
								<xsl:with-param name="ParentPage" select="$ParentPage"></xsl:with-param>
								<xsl:with-param name="Position" select="position()+5"></xsl:with-param>
								<xsl:with-param name="DisplayClass" select="'display:none'"></xsl:with-param>
								<xsl:with-param name="ProgramClass" select="'ProgramClass'"></xsl:with-param>
								<xsl:with-param name="DivID" select="$DivID"></xsl:with-param>
								<xsl:with-param name="SelectedUserID" select="$SelectedUserID"></xsl:with-param>
							</xsl:call-template>
						</xsl:for-each>
						<div class="col-md-1 col-sm-1 col-xs-6 contain divhide arR" style="float:right;width:5%;right:4%;">
							<xsl:if test="$countGoalList &gt; 5">
								<i id="iconNextPage" onClick="getClientPageStart('Next', 'ProgramClass', 'hfdProgramPageNumber', 'hfdTotalProgramPageNumber', 'iconNextPage', 'iconPrevPage');"
								   class="glyphicon glyphicon-menu-right arow onMouseOver {$styleNextArrow}" style="font-size: 43px;top:33px; left:30px;"  ></i>
							</xsl:if>
						</div>
					</div>
				</div>
			</xsl:otherwise>
		</xsl:choose>

	</xsl:template>
</xsl:stylesheet>
