﻿<?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="../../GenericTemplates/StringReplace.xslt"/>
	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:variable name="MasterPortalItemID" select="AjaxRequest/Params/MasterPortalItemID"></xsl:variable>
		<xsl:variable name="PortalItemID" select="AjaxRequest/Params/PortalItemID"></xsl:variable>
		<xsl:variable name="SelectedPortalItemID" select="AjaxRequest/Params/SelectedPortalItemID"></xsl:variable>
		<xsl:variable name="GoalItemID" select="AjaxRequest/Params/GoalItemID"></xsl:variable>
		<xsl:variable name="GoalList" select="AjaxRequest/Items/Item"></xsl:variable>
		<xsl:variable name="HostName" select ="normalize-space(AjaxRequest/HostName)"></xsl:variable>
		<xsl:variable name="IsSecureConnection" select="AjaxRequest/IsSecureConnection"></xsl:variable>
		<xsl:variable name="LoggedInUserID" select="AjaxRequest/LoggedInUserID"></xsl:variable>
		<xsl:variable name="parentDivID" select="AjaxRequest/Params/parentDivID"></xsl:variable>
		<xsl:variable name="UserBrands" select="AjaxRequest/UserBrands/."></xsl:variable>
		<xsl:variable name="UsersList" select="AjaxRequest/Users/User"></xsl:variable>
		<xsl:variable name="ResponsibleID" select="AjaxRequest/Params/ResponsibleID"></xsl:variable>
		<xsl:variable name="UserID" select="AjaxRequest/Params/UserID"></xsl:variable>
		<xsl:variable name="List" select="AjaxRequest/Items/List"/>
		<xsl:variable name="SearchText" select="AjaxRequest/Params/SearchText"></xsl:variable>
		<xsl:variable name="PageNumber" select="AjaxRequest/Params/PageNumber"></xsl:variable>
		<xsl:variable name="Mode" select="AjaxRequest/Params/Mode"></xsl:variable>
		<xsl:variable name="PageSize" select="AjaxRequest/PageSize"></xsl:variable>
		<xsl:variable name="TotalRec" select="AjaxRequest/Items/Item/TotalRec"></xsl:variable>
		<xsl:variable name="LastRecRowID" select="AjaxRequest/LastRecRowID"></xsl:variable>
		<xsl:variable name="StatusID" select="AjaxRequest/Params/StatusID"></xsl:variable>
		<xsl:variable name="ItemStatusList" select="AjaxRequest/ItemStatus"></xsl:variable>
		<xsl:variable name="Theme" select="AjaxRequest/Settings/Theme"></xsl:variable>
		<!--Call scroll function only if next set of records exists-->
		<!--<xsl:variable name="StopScrollFunc">
			<xsl:choose>
				<xsl:when test="$LastRecRowID &lt; $TotalRec">
					<xsl:text>Start</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>Stop</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>-->
		<xsl:variable name="HitScrollFunction">
			<xsl:choose>
				<xsl:when test="not($TotalRec)">
					<xsl:text></xsl:text>
				</xsl:when>
				<xsl:when test="$LastRecRowID &lt; $TotalRec">
					<xsl:text>checkIfScrollBottom('divGoalSummaryPaging');</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>


		<xsl:variable name="Protocol">
			<xsl:choose>
				<xsl:when test="$IsSecureConnection = 1">
					<xsl:text>https://</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>http://</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="PortalID">
			<xsl:choose>
				<xsl:when test="AjaxRequest/Params/PortalItemID='-99'">
					<xsl:value-of select="AjaxRequest/Params/MasterPortalItemID"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="AjaxRequest/Params/PortalItemID"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:choose>
			<xsl:when test="$Mode ='Scroll'">
				<xsl:for-each select="$GoalList">
					<xsl:variable name="CompletionPercentage">
						<xsl:choose>
							<xsl:when test="TotalComp=0">
								<xsl:text>0</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="round((TotalComp div TotalTask)*100)"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
					<xsl:variable name="CurrentPriorityValue">
						<xsl:value-of select="Priority"/>
					</xsl:variable>
					<xsl:variable name="CurrentItemID">
						<xsl:value-of select="ItemID"/>
					</xsl:variable>
					<xsl:variable name="CurrentOwnerID">
						<xsl:value-of select="OwnerID"/>
					</xsl:variable>

					<div id="tr_Goal_{CRMProjectID}" class="full_column ExpandRow " style="width:100%;float:left;" >

						<div style="float:left;width:4%;">
							<div class="btn-group ">
								<button type="button" class="multiselect dropdown-toggle btn padinone" data-toggle="dropdown" title="" aria-expanded="false" style="width: auto;">
									<span class="strspac onMouseOver star-default glyphicon glyphicon-star star_{Priority}"  id="span_Goal_Priority__{ItemID}"></span>
								</button>
								<ul class=" dropdown-menu Priority" id="ddl_GoalPriority_{ItemID}" previousValue="{Priority}">
									<xsl:for-each select="$List/Priority/Option">
										<xsl:variable name="OnClickPriority">
											<xsl:text>UpdateItemUserPriority_3_0('</xsl:text>
											<xsl:value-of select="$CurrentItemID"></xsl:value-of>
											<xsl:text>','</xsl:text>
											<xsl:value-of select="Value"></xsl:value-of>
											<xsl:text>','ddl_GoalPriority_</xsl:text>
											<xsl:value-of select="$CurrentItemID"/>
											<xsl:text>','</xsl:text>
											<xsl:value-of select="$UserID"/>
											<xsl:text>');</xsl:text>
										</xsl:variable>
										<xsl:choose>
											<xsl:when test="Value = $CurrentPriorityValue">
												<li class="active" val="{Value}">
													<a href="javascript:void(0);" onclick="{$OnClickPriority}">
														<label class="radio" style="padding-left: 0px;">
															<span class="glyphicon glyphicon-star star_{Value}" ></span>
														</label>
													</a>
												</li>
											</xsl:when>
											<xsl:otherwise>
												<li class="" val="{Value}">
													<a href="javascript:void(0);">
														<label class="radio" style="padding-left: 0px;" onclick="{$OnClickPriority}">
															<span class="glyphicon glyphicon-star star_{Value}"></span>
														</label>
													</a>
												</li>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:for-each>
								</ul>
							</div>
						</div>
						<xsl:variable name="EscapedItem">
							<xsl:call-template name="replaceCharsInString">
								<xsl:with-param name="stringIn" select="Item"></xsl:with-param>
								<xsl:with-param name="charsIn">
									<xsl:text>'</xsl:text>
								</xsl:with-param>
								<xsl:with-param name="charsOut">
									<xsl:text>\'</xsl:text>
								</xsl:with-param>
							</xsl:call-template>
						</xsl:variable>

						<xsl:variable name="FromattedImageURL">
							<xsl:choose>
								<xsl:when test="$IsSecureConnection = 1 and ImageURL!=''">
									<xsl:call-template name="replaceCharsInString">
										<xsl:with-param name="stringIn" select="ImageURL"></xsl:with-param>
										<xsl:with-param name="charsIn">
											<xsl:text>http://</xsl:text>
										</xsl:with-param>
										<xsl:with-param name="charsOut">
											<xsl:text>https://</xsl:text>
										</xsl:with-param>
									</xsl:call-template>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="ImageURL"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="funcLoadGoal">
							<xsl:choose>
								<xsl:when test="$Theme/@active ='true' and $Theme/@transformBaseTemplatePath='false'">
									<xsl:text>window.location.href='</xsl:text>
									<xsl:value-of select="$Protocol"/>
									<xsl:value-of select="$HostName"/>
									<xsl:text>/Program/</xsl:text>
									<xsl:value-of select="ItemID"/>
									<xsl:text>'</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>loadGoal_3_0('</xsl:text>
									<xsl:value-of select="ItemID"/>
									<xsl:text>','</xsl:text>
									<xsl:value-of select="$parentDivID"/>
									<xsl:text>','</xsl:text>
									<xsl:value-of select="$EscapedItem"/>
									<xsl:text>','</xsl:text>
									<xsl:value-of select="ImageURL"/>
									<xsl:text>','</xsl:text>
									<xsl:value-of select="SuccessKey"/>
									<xsl:text>','-99','</xsl:text>
									<xsl:value-of select="$PortalID"/>
									<xsl:text>','</xsl:text>
									<xsl:value-of select="$UserID"/>
									<xsl:text>','MyActivity');</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>

						<xsl:choose>
							<xsl:when test="$Theme/@active ='true' and $Theme/@transformBaseTemplatePath='false'">
								<xsl:variable name="ProgramURL">
									<xsl:value-of select="$Protocol"/>
									<xsl:value-of select="$HostName"/>
									<xsl:text>/Program/</xsl:text>
									<xsl:value-of select="ItemID"/>
								</xsl:variable>
								<a href="{$ProgramURL}">
									<div class="left_column PadingLft midprogram cochdas" style="padding:2px 0px 2px 10px!important;width:84%">
										<img src="{$FromattedImageURL}" style="width:40px;height:40px" class="pull-left"></img>
										<div class="MiDiv ExpandRow nwprogrm">
											<span  class="whitespace sumry" id="span_{ItemID}_OwnerName">
												<xsl:if test="OwnerName[text()]">
													<xsl:choose>
														<xsl:when test="not(normalize-space(substring-before(OwnerName, '@')))">
															<xsl:value-of select="OwnerName"></xsl:value-of>:
														</xsl:when>
														<xsl:otherwise>
															<xsl:value-of select="normalize-space(substring-before(OwnerName, '@'))"></xsl:value-of>:
														</xsl:otherwise>
													</xsl:choose>
												</xsl:if>
												<xsl:value-of select="Item"/>
											</span>
										</div>
									</div>
								</a>
							</xsl:when>
							<xsl:otherwise>
								<div onclick="{$funcLoadGoal}"
									 class="left_column PadingLft midprogram cochdas" style="padding:2px 0px 2px 10px!important;width:84%">
									<img src="{$FromattedImageURL}" style="width:40px;height:40px" class="pull-left"></img>
									<div class="MiDiv ExpandRow nwprogrm">
										<span  class="whitespace sumry" id="span_{ItemID}_OwnerName">
											<xsl:if test="OwnerName[text()]">
												<xsl:choose>
													<xsl:when test="not(normalize-space(substring-before(OwnerName, '@')))">
														<xsl:value-of select="OwnerName"></xsl:value-of>:
													</xsl:when>
													<xsl:otherwise>
														<xsl:value-of select="normalize-space(substring-before(OwnerName, '@'))"></xsl:value-of>:
													</xsl:otherwise>
												</xsl:choose>
											</xsl:if>
											<xsl:value-of select="Item"/>
										</span>
									</div>
								</div>
							</xsl:otherwise>
						</xsl:choose>


						<xsl:variable name="icnStatus">
							<xsl:choose>
								<xsl:when test="StatusID=1">
									<xsl:text> fa fa-dot-circle-o</xsl:text>
								</xsl:when>
								<xsl:when test="StatusID=2">
									<xsl:text>fa fa-adjust</xsl:text>
								</xsl:when>
								<xsl:when test="StatusID=3">
									<xsl:text>fa fa-pause-circle</xsl:text>
								</xsl:when>
								<xsl:when test="StatusID=4">
									<xsl:text> fa fa-check-circle</xsl:text>
								</xsl:when>
							</xsl:choose>
						</xsl:variable>
						<div class="btn-group" style="width:3%">
							<button type="button" class="multiselect dropdown-toggle btn padinone"
									data-toggle="dropdown" title="{Status}" style="width: auto;" aria-expanded="false">
								<span style="color: " class="onMouseOver {$icnStatus} clsStatusFontStyle" id="spanGoalStatus_{ItemID}">
								</span>
							</button>
							<ul class="dropdown-menu clsDdlGoal ddlGoalStatus_{ItemID}"  style="margin-left: -20px;margin-top: -8px;">
								<xsl:choose>
									<xsl:when test="StatusID=1">
										<li class="active" val="1" title="Not Started"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 1, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-dot-circle-o">
													</span>
												</label>
											</a>
										</li>
									</xsl:when>
									<xsl:otherwise>
										<li class="" val="1"  title="Not Started"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 1, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-dot-circle-o">
													</span>
												</label>
											</a>
										</li>

									</xsl:otherwise>
								</xsl:choose>
								<xsl:choose>
									<xsl:when test="StatusID=2">
										<li class="active" val="2"  title="In Progress"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 2, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-adjust" >
													</span>
												</label>
											</a>
										</li>
									</xsl:when>
									<xsl:otherwise>
										<li class="" val="2" title="In Progress"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 2, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-adjust" >
													</span>
												</label>
											</a>
										</li>
									</xsl:otherwise>
								</xsl:choose>
								<xsl:choose>
									<xsl:when test="StatusID=3">
										<li class="active" val="3" title="Paused"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 3, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);" >
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-pause-circle">
													</span>
												</label>
											</a>
										</li>
									</xsl:when>
									<xsl:otherwise>
										<li class=""  val="3"  title="Paused"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 3, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);" >
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-pause-circle">
													</span>
												</label>
											</a>
										</li>
									</xsl:otherwise>
								</xsl:choose>
								<xsl:choose>
									<xsl:when test="StatusID=4">
										<li class="active" val="4" title="Completed"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 4, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-check-circle">
													</span>
												</label>
											</a>
										</li>
									</xsl:when>
									<xsl:otherwise>
										<li class="" val="4"  title="Completed"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 4, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-check-circle">
													</span>
												</label>
											</a>
										</li>
									</xsl:otherwise>
								</xsl:choose>
								<xsl:choose>
									<xsl:when test="StatusID=5">
										<li class="active" val="5" title="Deleted"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 5, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-times-circle">
													</span>
												</label>
											</a>
										</li>
									</xsl:when>
									<xsl:otherwise>
										<li class="" val="5" title="Deleted"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 5, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-times-circle">
													</span>
												</label>
											</a>
										</li>
									</xsl:otherwise>
								</xsl:choose>
								<xsl:choose>
									<xsl:when test="StatusID=6">
										<li class="active" val="6" title="Archived"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 6, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-arrow-circle-o-down">
													</span>
												</label>
											</a>
										</li>
									</xsl:when>
									<xsl:otherwise>
										<li class="" val="6" title="Archived"
											onclick="updateActivityDashboardGoalStatus({ItemID}, 6, 'spanGoalStatus_{ItemID}');">
											<a href="javascript:void(0);">
												<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
													<span class="fa fa-arrow-circle-o-down">
													</span>
												</label>
											</a>
										</li>
									</xsl:otherwise>
								</xsl:choose>
							</ul>
						</div>
						<span style="width:7%">
							<select class="smallDropdown riteselect" style="width:6%;margin-top:8px;" id="ddlAction_{CRMProjectID}" onChange="clientPortal_SelectAction('{$PortalID}','divOpenProjects_{CRMProjectID}','{TemplateSourceID}',
                                                                                            '{ItemID}','{BrandID}','ddlAction_{normalize-space(CRMProjectID)}','{normalize-space(OwnerID)}',
                                                                                            '{normalize-space(CRMProjectID)}','3');">
								<option value="-99" >
									Admin
								</option>
								<option value="1">Send Response</option>
								<option value="2">Re-apply Template</option>
								<option value="3">Add Me</option>
								<option value="4">Delete</option>
							</select>
						</span>
					</div>
					<div id="divOpenProjects_{CRMProjectID}_detail_container" style="z-index:10;position:absolute;display:none;border: 1px solid black;padding: 5px;
                                             background-color:#FFFFFF;visibility: visible;width:600px;"></div>
				</xsl:for-each>
			</xsl:when>
			<xsl:otherwise>
				<!--<div class="col-md-12 pading0 Borderd alter-color myprgrms"  id="divActivityDashboardGoalSummary">-->
				<div  class="tab_grid Taskwid nwstatus padded10"  style="background:#fff;display:inline!important;">
					<!-- section-heading-->
					<div class="section-title" style="float:left;">
						<div>
							<span class="TitleName lftitle">
								<xsl:text>COACH/MANAGER PROGRAMS</xsl:text>
							</span>
							<span class="ritcont">
								<xsl:if test="count($UsersList) &gt; 1">
									<span class="pull-right firstxt" >
										<select class="form-control-dashboard pull-right"  style="width:100%;"
					id="ddlSelectedDashboardUser"
					onChange="LoadCoachDashboard_3_0_Selection({$MasterPortalItemID}, {$PortalItemID}, {$UserID}, {$GoalItemID}, '{$parentDivID}','{$StatusID}');">
											<option value="-99">
												<xsl:text>All Users</xsl:text>
											</option>
											<xsl:for-each select="$UsersList">
												<xsl:choose>
													<xsl:when test="$ResponsibleID = UserID">
														<option value="{UserID}" selected="">
															<xsl:value-of select="FirstName"/>
														</option>
													</xsl:when>
													<xsl:otherwise>
														<option value="{UserID}">
															<xsl:value-of select="FirstName"/>
														</option>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:for-each>
										</select>
									</span>
								</xsl:if>

								<xsl:if test="count($UserBrands/Brand) &gt; 1">
									<span class="pull-right  firstxt" style="margin-left:10px;margin-right:10px;">
										<select class="form-control-dashboard pull-right"  style="width:100%;"
												id="ddlSelectedDashboardPortal"
												onChange="LoadCoachDashboard_3_0_Selection({$MasterPortalItemID}, {$PortalItemID}, {$UserID}, {$GoalItemID}, '{$parentDivID}','{$StatusID}');">
											<option value="{$MasterPortalItemID}">
												<xsl:text>All Portals</xsl:text>
											</option>
											<xsl:for-each select="$UserBrands/Brand[ItemID != $MasterPortalItemID]">
												<xsl:choose>
													<xsl:when test="$SelectedPortalItemID = ItemID">
														<option value="{ItemID}" selected="">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:when>
													<xsl:when test="$PortalItemID = ItemID">
														<option value="{ItemID}" selected="">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:when>
													<xsl:otherwise>
														<option value="{ItemID}">
															<xsl:value-of select="Item"/>
														</option>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:for-each>
										</select>

									</span>
								</xsl:if>
								<span class="pull-right firstxt" >
									<input type="text" style="height:28px;width:100%;" title="Search..." placeholder="Search..." value="{$SearchText}" id="txtSearchText" onkeyup="loadCoachDashboardGoalSummary_Search({$MasterPortalItemID}, {$PortalItemID},  {$GoalItemID},{$UserID}, '{$parentDivID}',event,'{$StatusID}');"  class="proPageBoxInput form-control"></input>
								</span>

								<span class="pull-right  firstxt" style="margin-right:10px;">
									<xsl:variable name="icnStatusFilter">
										<xsl:choose>
											<xsl:when test="$StatusID=0 or not($StatusID)">
												<xsl:text> fa fa-dot-circle-o</xsl:text>
											</xsl:when>
											<xsl:when test="$StatusID=3">
												<xsl:text>fa fa-pause-circle</xsl:text>
											</xsl:when>
											<xsl:when test="$StatusID=4">
												<xsl:text> fa fa-check-circle</xsl:text>
											</xsl:when>
											<xsl:when test="$StatusID=5">
												<xsl:text>fa fa-times-circle</xsl:text>
											</xsl:when>
											<xsl:when test="$StatusID=6">
												<xsl:text>fa fa-arrow-circle-o-down</xsl:text>
											</xsl:when>
											<xsl:otherwise>
												<xsl:text> fa fa-dot-circle-o</xsl:text>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:variable>
									<xsl:variable name="StatusTitle">
										<xsl:choose>
											<xsl:when test="$StatusID=0 or not($StatusID)">
												<xsl:text>Open Programs</xsl:text>
											</xsl:when>
											<xsl:when test="$StatusID=3">
												<xsl:text>Paused</xsl:text>
											</xsl:when>
											<xsl:when test="$StatusID=4">
												<xsl:text>Completed</xsl:text>
											</xsl:when>
											<xsl:when test="$StatusID=5">
												<xsl:text>Deleted</xsl:text>
											</xsl:when>
											<xsl:when test="$StatusID=6">
												<xsl:text>Archived</xsl:text>
											</xsl:when>
											<xsl:otherwise>
												<xsl:text>Open Programs</xsl:text>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:variable>
									<span class="pull-right widstatus">
										<div class="btn-group">
											<button type="button" class="multiselect dropdown-toggle btn"
													data-toggle="dropdown" title="{$StatusTitle}" style="width: auto;padding-top: 0px; margin-top: -11px;  height: 40px;" aria-expanded="false">
												<span style="color: " class="onMouseOver {$icnStatusFilter} clsStatusFontStyle" id="ddlListStatus">
												</span>
											</button>
											<ul class="dropdown-menu clsDdlGoal" style="left:-10px;">
												<xsl:choose>
													<xsl:when test="$StatusID =0 or not($StatusID) or $StatusID = ''">
														<li class="active" title="Open Programs" val="0">
															<a href="javascript:void(0);"
															   onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 0)">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-dot-circle-o">
																	</span>
																</label>
															</a>
														</li>
													</xsl:when>
													<xsl:otherwise>
														<li class="" title="Open Programs" val="0">
															<a href="javascript:void(0);"
															   onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 0)">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-dot-circle-o">
																	</span>
																</label>
															</a>
														</li>
													</xsl:otherwise>
												</xsl:choose>
												<xsl:choose>
													<xsl:when test="$StatusID=3">
														<li class="active" title="Paused" val="3">
															<a href="javascript:void(0);"
															   onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 3)">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-pause-circle">
																	</span>
																</label>
															</a>
														</li>
													</xsl:when>
													<xsl:otherwise>
														<li class="" title="Paused" val="3">
															<a href="javascript:void(0);"
															   onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 3)">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-pause-circle">
																	</span>
																</label>
															</a>
														</li>
													</xsl:otherwise>
												</xsl:choose>
												<xsl:choose>
													<xsl:when test="$StatusID=4">
														<li class="active"  title="Completed" val="4">
															<a href="javascript:void(0);"
															   onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 4)">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-check-circle">
																	</span>
																</label>
															</a>
														</li>
													</xsl:when>
													<xsl:otherwise>
														<li class=""  title="Completed" val="4">
															<a href="javascript:void(0);"
															   onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 4)">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-check-circle">
																	</span>
																</label>
															</a>
														</li>
													</xsl:otherwise>
												</xsl:choose>
												<xsl:choose>
													<xsl:when test="$StatusID=5">
														<li class="active" title="Deleted" val="5">
															<a href="javascript:void(0);"
															   onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 5)">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-times-circle">
																	</span>
																</label>
															</a>
														</li>
													</xsl:when>
													<xsl:otherwise>
														<li class="" title="Deleted" val="5">
															<a href="javascript:void(0);"
															   onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 5)">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-times-circle">
																	</span>
																</label>
															</a>
														</li>
													</xsl:otherwise>
												</xsl:choose>
												<xsl:choose>
													<xsl:when test="$StatusID=6">
														<li class="active"  title="Archived" val="6"
													onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 6)">
															<a href="javascript:void(0);">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-arrow-circle-o-down">
																	</span>
																</label>
															</a>
														</li>
													</xsl:when>
													<xsl:otherwise>
														<li class=""  title="Archived" val="6"
															onclick="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 6)">
															<a href="javascript:void(0);">
																<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
																	<span class="fa fa-arrow-circle-o-down">
																	</span>
																</label>
															</a>
														</li>
													</xsl:otherwise>
												</xsl:choose>
											</ul>
										</div>
									</span>
									<!--<select id="ddlListStatus" class="form-control-dashboard" style="width:100%;"
											onchange="loadCoachDashboardGoalSummaryFilter({$MasterPortalItemID},  {$PortalItemID},  {$GoalItemID},  {$UserID}, 
											'divActivityDashboardGoalSummary','{$parentDivID}', 'ddlSelectedDashboardUser',	'ddlSelectedDashboardPortal', 'ddlListStatus') ">
										<xsl:for-each select="$ItemStatusList/Name">
											<xsl:choose>
												<xsl:when test="@val = $StatusID">
													<option value="{@val}" selected="">
														<xsl:value-of select="text()"/>
													</option>
												</xsl:when>
												<xsl:otherwise>
													<option value="{@val}">
														<xsl:value-of select="text()"/>
													</option>
												</xsl:otherwise>
											</xsl:choose>

										</xsl:for-each>
									</select>-->
								</span>

							</span>
						</div>
					</div>
					<!-- same code-->
					<div source="CoachDashboardGoalSummary"  LastRecRowID="{$LastRecRowID}" onmouseover="{$HitScrollFunction}"
						 onTouchStart="{$HitScrollFunction}" id="divGoalSummaryPaging"  class="fixed_overflow" style="width: 100%;    float: left; "
						  onmouseout="">
						<xsl:for-each select="$GoalList">
							<xsl:variable name="CompletionPercentage">
								<xsl:choose>
									<xsl:when test="TotalComp=0">
										<xsl:text>0</xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="round((TotalComp div TotalTask)*100)"/>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>
							<xsl:variable name="CurrentPriorityValue">
								<xsl:value-of select="Priority"/>
							</xsl:variable>
							<xsl:variable name="CurrentItemID">
								<xsl:value-of select="ItemID"/>
							</xsl:variable>
							<xsl:variable name="CurrentOwnerID">
								<xsl:value-of select="OwnerID"/>
							</xsl:variable>
							<div id="tr_Goal_{CRMProjectID}" class="full_column ExpandRow " style="width:100%;float:left;" >
								<div style="float:left;width:4%;">
									<div class="btn-group ">
										<button type="button" class="multiselect dropdown-toggle btn padinone" data-toggle="dropdown" title="" aria-expanded="false" style="width: auto;">
											<span class="strspac onMouseOver star-default glyphicon glyphicon-star star_{Priority}"  id="span_Goal_Priority__{ItemID}"></span>
										</button>
										<ul class=" dropdown-menu Priority" id="ddl_GoalPriority_{ItemID}" previousValue="{Priority}">
											<xsl:for-each select="$List/Priority/Option">
												<xsl:variable name="OnClickPriority">
													<xsl:text>UpdateItemUserPriority_3_0('</xsl:text>
													<xsl:value-of select="$CurrentItemID"></xsl:value-of>
													<xsl:text>','</xsl:text>
													<xsl:value-of select="Value"></xsl:value-of>
													<xsl:text>','ddl_GoalPriority_</xsl:text>
													<xsl:value-of select="$CurrentItemID"/>
													<xsl:text>','</xsl:text>
													<xsl:value-of select="$UserID"/>
													<xsl:text>');</xsl:text>
												</xsl:variable>
												<xsl:choose>
													<xsl:when test="Value = $CurrentPriorityValue">
														<li class="active" val="{Value}">
															<a href="javascript:void(0);" onclick="{$OnClickPriority}">
																<label class="radio" style="padding-left: 0px;">
																	<span class="glyphicon glyphicon-star star_{Value}" ></span>
																</label>
															</a>
														</li>
													</xsl:when>
													<xsl:otherwise>
														<li class="" val="{Value}">
															<a href="javascript:void(0);">
																<label class="radio" style="padding-left: 0px;" onclick="{$OnClickPriority}">
																	<span class="glyphicon glyphicon-star star_{Value}"></span>
																</label>
															</a>
														</li>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:for-each>
										</ul>
									</div>
								</div>
								<xsl:variable name="EscapedItem">
									<xsl:call-template name="replaceCharsInString">
										<xsl:with-param name="stringIn" select="Item"></xsl:with-param>
										<xsl:with-param name="charsIn">
											<xsl:text>'</xsl:text>
										</xsl:with-param>
										<xsl:with-param name="charsOut">
											<xsl:text>\'</xsl:text>
										</xsl:with-param>
									</xsl:call-template>
								</xsl:variable>
								<xsl:variable name="FromattedImageURL">
									<xsl:choose>
										<xsl:when test="$IsSecureConnection = 1 and ImageURL!=''">
											<xsl:call-template name="replaceCharsInString">
												<xsl:with-param name="stringIn" select="ImageURL"></xsl:with-param>
												<xsl:with-param name="charsIn">
													<xsl:text>http://</xsl:text>
												</xsl:with-param>
												<xsl:with-param name="charsOut">
													<xsl:text>https://</xsl:text>
												</xsl:with-param>
											</xsl:call-template>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="ImageURL"/>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<xsl:variable name="funcLoadGoal">
									<xsl:choose>
										<xsl:when test="$Theme/@active ='true' and $Theme/@transformBaseTemplatePath='false'">
											<xsl:text>window.location.href='</xsl:text>
											<xsl:value-of select="$Protocol"/>
											<xsl:value-of select="$HostName"/>
											<xsl:text>/Program/</xsl:text>
											<xsl:value-of select="ItemID"/>
											<xsl:text>'</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>loadGoal_3_0('</xsl:text>
											<xsl:value-of select="ItemID"/>
											<xsl:text>','</xsl:text>
											<xsl:value-of select="$parentDivID"/>
											<xsl:text>','</xsl:text>
											<xsl:value-of select="$EscapedItem"/>
											<xsl:text>','</xsl:text>
											<xsl:value-of select="ImageURL"/>
											<xsl:text>','</xsl:text>
											<xsl:value-of select="SuccessKey"/>
											<xsl:text>','-99','</xsl:text>
											<xsl:value-of select="$PortalID"/>
											<xsl:text>','</xsl:text>
											<xsl:value-of select="$UserID"/>
											<xsl:text>','MyActivity');</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>

								<xsl:choose>
									<xsl:when test="$Theme/@active ='true' and $Theme/@transformBaseTemplatePath='false'">
										<xsl:variable name="ProgramURL">
											<xsl:value-of select="$Protocol"/>
											<xsl:value-of select="$HostName"/>
											<xsl:text>/Program/</xsl:text>
											<xsl:value-of select="ItemID"/>
										</xsl:variable>
										<a href="{$ProgramURL}">
											<div class="left_column PadingLft midprogram cochdas"
																						 style="padding:2px 0px 2px 10px!important;width:84%">
												<img src="{$FromattedImageURL}" style="width:40px;height:40px" class="pull-left"></img>
												<div class="MiDiv ExpandRow nwprogrm">
													<span  class="whitespace sumry" id="span_{ItemID}_OwnerName">
														<xsl:if test="OwnerName[text()]">
															<xsl:choose>
																<xsl:when test="not(normalize-space(substring-before(OwnerName, '@')))">
																	<xsl:value-of select="OwnerName"></xsl:value-of>:
																</xsl:when>
																<xsl:otherwise>
																	<xsl:value-of select="normalize-space(substring-before(OwnerName, '@'))"></xsl:value-of>:
																</xsl:otherwise>
															</xsl:choose>
														</xsl:if>
														<xsl:value-of select="Item"/>
													</span>
												</div>
											</div>
										</a>
									</xsl:when>
									<xsl:otherwise>
										<div onclick="{$funcLoadGoal}" class="left_column PadingLft midprogram cochdas"
											 style="padding:2px 0px 2px 10px!important;width:84%">
											<img src="{$FromattedImageURL}" style="width:40px;height:40px" class="pull-left"></img>
											<div class="MiDiv ExpandRow nwprogrm">
												<span  class="whitespace sumry" id="span_{ItemID}_OwnerName">
													<xsl:if test="OwnerName[text()]">
														<xsl:choose>
															<xsl:when test="not(normalize-space(substring-before(OwnerName, '@')))">
																<xsl:value-of select="OwnerName"></xsl:value-of>:
															</xsl:when>
															<xsl:otherwise>
																<xsl:value-of select="normalize-space(substring-before(OwnerName, '@'))"></xsl:value-of>:
															</xsl:otherwise>
														</xsl:choose>
													</xsl:if>
													<xsl:value-of select="Item"/>
												</span>
											</div>
										</div>
									</xsl:otherwise>
								</xsl:choose>

								<xsl:variable name="icnStatus">
									<xsl:choose>
										<xsl:when test="StatusID=1">
											<xsl:text> fa fa-dot-circle-o</xsl:text>
										</xsl:when>
										<xsl:when test="StatusID=2">
											<xsl:text>fa fa-adjust</xsl:text>
										</xsl:when>
										<xsl:when test="StatusID=3">
											<xsl:text>fa fa-pause-circle</xsl:text>
										</xsl:when>
										<xsl:when test="StatusID=4">
											<xsl:text> fa fa-check-circle</xsl:text>
										</xsl:when>
										<xsl:when test="StatusID=5">
											<xsl:text>fa fa-times-circle</xsl:text>
										</xsl:when>
										<xsl:when test="StatusID=6">
											<xsl:text>fa fa-arrow-circle-o-down</xsl:text>
										</xsl:when>
									</xsl:choose>
								</xsl:variable>
								<div class="btn-group" style="width:3%">
									<button type="button" class="multiselect dropdown-toggle btn padinone"
											data-toggle="dropdown" title="{Status}" style="width: auto;" aria-expanded="false">
										<span style="color: " class="onMouseOver {$icnStatus} clsStatusFontStyle" id="spanGoalStatus_{ItemID}">
										</span>
									</button>
									<ul class="dropdown-menu clsDdlGoal ddlGoalStatus_{ItemID}"  style="margin-left: -20px;margin-top: -8px;">
										<xsl:choose>
											<xsl:when test="StatusID=1">
												<li class="active" val="1" title="Not Started"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 1, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-dot-circle-o">
															</span>
														</label>
													</a>
												</li>
											</xsl:when>
											<xsl:otherwise>
												<li class="" val="1"  title="Not Started"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 1, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-dot-circle-o">
															</span>
														</label>
													</a>
												</li>

											</xsl:otherwise>
										</xsl:choose>
										<xsl:choose>
											<xsl:when test="StatusID=2">
												<li class="active" val="2"  title="In Progress"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 2, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-adjust" >
															</span>
														</label>
													</a>
												</li>
											</xsl:when>
											<xsl:otherwise>
												<li class="" val="2" title="In Progress"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 2, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-adjust" >
															</span>
														</label>
													</a>
												</li>
											</xsl:otherwise>
										</xsl:choose>
										<xsl:choose>
											<xsl:when test="StatusID=3">
												<li class="active" val="3" title="Paused"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 3, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);" >
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-pause-circle">
															</span>
														</label>
													</a>
												</li>
											</xsl:when>
											<xsl:otherwise>
												<li class=""  val="3"  title="Paused"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 3, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);" >
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-pause-circle">
															</span>
														</label>
													</a>
												</li>
											</xsl:otherwise>
										</xsl:choose>
										<xsl:choose>
											<xsl:when test="StatusID=4">
												<li class="active" val="4" title="Completed"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 4, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-check-circle">
															</span>
														</label>
													</a>
												</li>
											</xsl:when>
											<xsl:otherwise>
												<li class="" val="4"  title="Completed"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 4, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-check-circle">
															</span>
														</label>
													</a>
												</li>
											</xsl:otherwise>
										</xsl:choose>
										<xsl:choose>
											<xsl:when test="StatusID=5">
												<li class="active" val="5" title="Deleted"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 5, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-times-circle">
															</span>
														</label>
													</a>
												</li>
											</xsl:when>
											<xsl:otherwise>
												<li class="" val="5" title="Deleted"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 5, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-times-circle">
															</span>
														</label>
													</a>
												</li>
											</xsl:otherwise>
										</xsl:choose>
										<xsl:choose>
											<xsl:when test="StatusID=6">
												<li class="active" val="6" title="Archived"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 6, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-arrow-circle-o-down">
															</span>
														</label>
													</a>
												</li>
											</xsl:when>
											<xsl:otherwise>
												<li class="" val="6" title="Archived"
													onclick="updateActivityDashboardGoalStatus({ItemID}, 6, 'spanGoalStatus_{ItemID}');">
													<a href="javascript:void(0);">
														<label class="radio clsStatusFontStyle" style="padding-left: 0px;">
															<span class="fa fa-arrow-circle-o-down">
															</span>
														</label>
													</a>
												</li>
											</xsl:otherwise>
										</xsl:choose>
									</ul>
								</div>

								<span style="width:7%">
									<select class="smallDropdown riteselect" style="width:6%;margin-top:8px;" id="ddlAction_{CRMProjectID}" onChange="clientPortal_SelectAction('{$PortalID}','divOpenProjects_{CRMProjectID}','{TemplateSourceID}',
                                                                                            '{ItemID}','{BrandID}','ddlAction_{normalize-space(CRMProjectID)}','{normalize-space(OwnerID)}',
                                                                                            '{normalize-space(CRMProjectID)}','3');">
										<option value="-99" >
											Admin
										</option>
										<option value="1">Send Response</option>
										<option value="2">Re-apply Template</option>
										<option value="3">Add Me</option>
										<option value="4">Delete</option>
									</select>
								</span>
							</div>
							<div id="divOpenProjects_{CRMProjectID}_detail_container" style="z-index:10;position:absolute;display:none;border: 1px solid black;padding: 5px;
                                             background-color:#FFFFFF;visibility: visible;width:600px;"></div>
						</xsl:for-each>
					</div>
				</div>
				<!--</div>-->
				<input style="display:none;" id="btnCoachGoalSummary" TotalRec="{$TotalRec}" pageSize="{$PageSize}" currentPageNumber="{$PageNumber}" type="button" value="Next>>" onclick="loachCoachDashboardGoalSummaryMainCall({$MasterPortalItemID}, {$PortalItemID},{$GoalItemID},{$UserID},'divGoalSummaryPaging', '{$parentDivID}',{$PageNumber+1},'Scroll','{$StatusID}');"></input>
			</xsl:otherwise>

		</xsl:choose>

	</xsl:template>

</xsl:stylesheet>
