﻿<?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:output method="xml" indent="yes" omit-xml-declaration="yes"/>

	<xsl:template match="/">

		<xsl:variable name="itemID" select="AjaxRequest/Params/ItemID"></xsl:variable>
		<xsl:variable name="GoalColumns" select="AjaxRequest/Goal/Columns"></xsl:variable>
		<xsl:variable name="GoalIsLand" select="AjaxRequest/Goal/IsLand"></xsl:variable>
		<xsl:variable name="GoalsRecords" select="AjaxRequest/Goal/Records"></xsl:variable>
		<xsl:variable name="LoggedInUser" select="AjaxRequest/LoggedInUserID"/>
		<xsl:variable name="List" select="AjaxRequest/Goal/List"/>
		<xsl:variable name="ResponsibleColumns" select="AjaxRequest/Goal/ResponsibleList"></xsl:variable>
		<xsl:variable name="TargetArea" select="AjaxRequest/Params/TargetArea"></xsl:variable>
		<xsl:for-each select="$GoalsRecords/Record">
			<table id="divTaskItemFull">
				<xsl:call-template name="GoalTaskFull">
					<xsl:with-param name="CurrentRecordRow" select="."></xsl:with-param>
					<xsl:with-param name="GoalColumns" select="$GoalColumns"></xsl:with-param>
					<xsl:with-param name="LoggedInUser" select="$LoggedInUser"></xsl:with-param>
					<xsl:with-param name="itemID" select="$itemID"></xsl:with-param>
					<xsl:with-param name="List" select="$List"></xsl:with-param>
					<xsl:with-param name="ResponsibleColumns" select="$ResponsibleColumns"></xsl:with-param>
				</xsl:call-template>
			</table>
			<div id="divTaskItemSmall">
				<xsl:call-template name="GoalTaskSmall">
					<xsl:with-param name="CurrentBriefRecordRow" select="."></xsl:with-param>
					<xsl:with-param name="GoalIsLand" select="$GoalIsLand"></xsl:with-param>
					<xsl:with-param name="List" select="$List"></xsl:with-param>
					<xsl:with-param name="LoggedInUser" select="$LoggedInUser"></xsl:with-param>
					<xsl:with-param name="itemID" select="$itemID"></xsl:with-param>
					<xsl:with-param name="TargetArea" select="$TargetArea"></xsl:with-param>
				</xsl:call-template>
			</div>
		</xsl:for-each>

	</xsl:template>


	<xsl:template name="GoalTaskFull">
		<xsl:param name="CurrentRecordRow" select="'N/A'"></xsl:param>
		<xsl:param name="GoalColumns" select="'N/A'"></xsl:param>
		<xsl:param name="LoggedInUser" select="'N/A'"></xsl:param>
		<xsl:param name="itemID" select="'N/A'"></xsl:param>
		<xsl:param name="List" select="'N/A'"></xsl:param>
		<xsl:param name="ResponsibleColumns" select="'N/A'"></xsl:param>


		<xsl:variable name="TypeID" select="$CurrentRecordRow/TypeID"></xsl:variable>
		<xsl:variable name="StatusID" select="$CurrentRecordRow/StatusID"></xsl:variable>
		<xsl:variable name="Responsible_user" select="$CurrentRecordRow/ResponsibleID"></xsl:variable>
		<xsl:variable name="CurrentItemRecurringID">
			<xsl:value-of select="$CurrentRecordRow/ItemRecurringID"/>
		</xsl:variable>
		<xsl:variable name="CurrentItemID">
			<xsl:value-of select="$CurrentRecordRow/ItemID"/>
		</xsl:variable>
		<xsl:variable name="CurrentTopicID">
			<xsl:value-of select="$CurrentRecordRow/TopicID"/>
		</xsl:variable>
		<xsl:variable name="PermissionID" select="$CurrentRecordRow/PermissionID"></xsl:variable>

		<xsl:variable name="OnClickDueDate">
			<xsl:choose>
				<xsl:when test="$PermissionID = 3 or $PermissionID &gt;= 4">
					<xsl:text>dp('div_item_</xsl:text>
					<xsl:value-of select="$CurrentItemID"></xsl:value-of>
					<xsl:text>_title_content_subTitle', 'div_item_</xsl:text>
					<xsl:value-of select="$CurrentItemID"></xsl:value-of>
					<xsl:text>_title_content_subTitle')</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="DataToggle">
			<xsl:choose>
				<xsl:when test="$PermissionID = 3 or $PermissionID &gt;= 4">
					<xsl:text>dropdown</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="DataToggleCP">
			<xsl:choose>
				<xsl:when test="$TypeID != 14 and ($PermissionID = 3 or $PermissionID &gt;= 4)">
					<xsl:text>dropdown</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>

		<tr id="tr_Task_{$CurrentItemID}" class="ExpandRow paddingNone" >
			<xsl:for-each select="$GoalColumns/Col[Visibility=1]">

				<xsl:variable name="CurrentColName">
					<xsl:value-of select="ColName"/>
				</xsl:variable>
				<xsl:variable name="CurrentDueDateState">
					<xsl:value-of select="$CurrentRecordRow/DueDateState"/>
				</xsl:variable>
				<xsl:variable name="CircleColor">
					<xsl:choose>
						<xsl:when test="$CurrentDueDateState='Current'">
							<xsl:text>circle</xsl:text>
						</xsl:when>
						<xsl:when test="$CurrentDueDateState='PastDue'">
							<xsl:text>circle_yellow</xsl:text>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>circle</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>

				<xsl:variable name="changeStatus">
					<xsl:choose>
						<xsl:when test="$TypeID=14 
								  and $StatusID=1 
								  and $LoggedInUser=$Responsible_user
								  and $CurrentColName!='Priority' 
								  and $CurrentColName!='DueDateLabel' 
								  and $CurrentColName!='CompletionPercentage'">
							<xsl:text>if($('#ddl_CompletionPercentage_</xsl:text>
							<xsl:value-of select="$CurrentItemID"></xsl:value-of>
							<xsl:text>').attr('previousValue') &lt;= 25)</xsl:text>
							<xsl:text>UpdateItemCompletionPercentage_3_0(</xsl:text>
							<xsl:value-of select="$CurrentItemID"/>
							<xsl:text>, '25.00', '</xsl:text>
							<xsl:value-of select="$CircleColor"/>
							<xsl:text>');</xsl:text>
						</xsl:when>
					</xsl:choose>
				</xsl:variable>

				<xsl:variable name="sliderCall">
					<xsl:choose>
						<xsl:when test="($CurrentColName!='Priority') and ($CurrentColName!='DueDateLabel') and ($CurrentColName!='CompletionPercentage') 
								  and ($CurrentColName !='Responsible') and ($CurrentColName !='Topic')">
							<xsl:text>resetSliderClass();viewItemDetailVersion3('</xsl:text>
							<xsl:value-of select="$CurrentItemID"></xsl:value-of>
							<xsl:text>', '</xsl:text>
							<xsl:value-of select="$itemID"></xsl:value-of>
							<xsl:text>', 'div_item_</xsl:text>
							<xsl:value-of select="$CurrentItemID"></xsl:value-of>
							<xsl:text>_detail_container', 'div_item_</xsl:text>
							<xsl:value-of select="$CurrentItemID"></xsl:value-of>
							<xsl:text>','2.0', 'view');</xsl:text>
						</xsl:when>
						<xsl:when test="$CurrentColName='Topic'">
							<xsl:text>LoadCoreGoalTask_3_0('</xsl:text>
							<xsl:value-of select="$itemID"/>
							<xsl:text>', 'div_Goal_</xsl:text>
							<xsl:value-of select="$itemID"/>
							<xsl:text>_Operations', '', '', 1,'</xsl:text>
							<xsl:value-of select="$CurrentTopicID"></xsl:value-of>
							<xsl:text>');</xsl:text>
						</xsl:when>
						<xsl:when test="$CurrentColName='CompletionPercentage' and $TypeID= 14 ">
							<xsl:text>resetSliderClass();viewItemDetailVersion3('</xsl:text>
							<xsl:value-of select="$CurrentItemID"></xsl:value-of>
							<xsl:text>', '</xsl:text>
							<xsl:value-of select="$itemID"></xsl:value-of>
							<xsl:text>', 'div_item_</xsl:text>
							<xsl:value-of select="$CurrentItemID"></xsl:value-of>
							<xsl:text>_detail_container', 'div_item_</xsl:text>
							<xsl:value-of select="$CurrentItemID"></xsl:value-of>
							<xsl:text>','2.0', 'view');</xsl:text>
						</xsl:when>
						<xsl:otherwise>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<xsl:variable name="OnClickClass">
					<xsl:choose>
						<xsl:when test="$CurrentColName='Priority' or $CurrentColName='CompletionPercentage' or $CurrentColName='Responsible' or $CurrentColName='Topic'">
							<xsl:text>onMouseOver</xsl:text>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text></xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<xsl:variable name="CurrentColValue">
					<xsl:value-of select="$CurrentRecordRow/child::node()[name(.) = $CurrentColName]"/>
				</xsl:variable>


				<td onclick="{$sliderCall} {$changeStatus}">
					<xsl:choose>
						<xsl:when test="$CurrentColName='Priority'">
							<div class="col-md-12">
								<div class="btn-group ">
									<button type="button" class="multiselect dropdown-toggle btn padinone" data-toggle="{$DataToggle}" title="" aria-expanded="false" style="width: auto;">
										<span class="{$OnClickClass} star-default glyphicon glyphicon-star star_{$CurrentColValue}"  id="span_{$CurrentColName}_{$CurrentItemID}"></span>
										<!--<b class="caret"></b>-->
									</button>
									<ul class=" dropdown-menu {$CurrentColName}" id="ddl_{$CurrentColName}_{$CurrentItemID}" previousValue="{$CurrentColValue}">
										<xsl:for-each select="$List/Priority/Option">

											<xsl:variable name="OnClickPriority">
												<xsl:choose>
													<xsl:when test="$CurrentRecordRow/PermissionID = 3 or $CurrentRecordRow/PermissionID &gt;= 4">
														<xsl:text>UpdateItemPriority_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>')</xsl:text>
													</xsl:when>
												</xsl:choose>
											</xsl:variable>

											<xsl:choose>
												<xsl:when test="Value=$CurrentColValue">
													<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);" onclick="{$OnClickPriority}">
															<label class="radio" style="padding-left: 0px;">
																<span class="glyphicon glyphicon-star star_{Value}" ></span>
															</label>
														</a>
													</li>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:for-each>
									</ul>
								</div>
							</div>
						</xsl:when>
						<xsl:when test="$CurrentColName='Responsible'">
							<xsl:variable name="ShowHideTask">
								<xsl:choose>
									<xsl:when test="$PermissionID = 3 or $PermissionID &gt;= 4">
										<xsl:text>ShowHideTask('ddlTask_Responsible_</xsl:text>
										<xsl:value-of select="$CurrentItemID"></xsl:value-of>
										<xsl:text>','spanTask_Responsible_</xsl:text>
										<xsl:value-of select="$CurrentItemID"></xsl:value-of>
										<xsl:text>');</xsl:text>
									</xsl:when>
								</xsl:choose>
							</xsl:variable>
							<span   onmouseover="this.style.textDecoration = 'underline';"
						  onmouseout="this.style.textDecoration = 'none';" class="{$OnClickClass}" id="spanTask_Responsible_{$CurrentItemID}"
													onclick="{$ShowHideTask}">
								<xsl:choose>
									<xsl:when test="$CurrentColValue = ''">
										<xsl:text>Set Responsible</xsl:text>
									</xsl:when>
									<xsl:when test="$LoggedInUser=$Responsible_user">
										<xsl:text>Me</xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="$CurrentColValue"/>
									</xsl:otherwise>
								</xsl:choose>
							</span>
							<xsl:choose>
								<xsl:when test="$PermissionID = 3 or $PermissionID &gt;= 4">
									<select style="display:none" class="AddNewUser_{$itemID}" id="ddlTask_Responsible_{$CurrentItemID}" onchange="UpdateTaskResponsible_3_0('ddlTask_Responsible_{$CurrentItemID}', '{$CurrentItemID}', '{$itemID}', 'spanTask_Responsible_{$CurrentItemID}');">
										<option value="-99">Select</option>
										<xsl:for-each select="$ResponsibleColumns/Responsible">
											<xsl:variable name="ResponsibleName">
												<xsl:choose>
													<xsl:when test="$LoggedInUser=UserID">
														<xsl:text>Me</xsl:text>
													</xsl:when>
													<xsl:otherwise>
														<xsl:value-of select="FirstName"/>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:variable>
											<xsl:choose>
												<xsl:when test="$Responsible_user = UserID">
													<option value="{UserID}" selected="">
														<xsl:value-of select="$ResponsibleName"/>
													</option>
												</xsl:when>
												<xsl:otherwise>
													<option value="{UserID}">
														<xsl:value-of select="$ResponsibleName"/>
													</option>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:for-each>
										<option value="-1">More...</option>
									</select>
								</xsl:when>
							</xsl:choose>


						</xsl:when>
						<xsl:when test="$CurrentColName='DueDateLabel'">
							<div id="div_item_{$CurrentItemID}" goalitemid="{$itemID}">
								<div  onclick="{$OnClickDueDate}"
									  id="div_item_{$CurrentItemID}_title_content_subTitle"
									  name="&lt;OperationalData&gt;&lt;Version&gt;2.0&lt;/Version&gt;
											  &lt;ItemID&gt;{$CurrentItemID}&lt;/ItemID&gt;&lt;GoalID&gt;{$itemID}&lt;/GoalID&gt;
											  &lt;Mode&gt;GoalDetail30&lt;/Mode&gt;
											  &lt;ItemDivPrefix&gt;div_item_{$CurrentItemID}&lt;/ItemDivPrefix&gt;
											  &lt;/OperationalData&gt;" style="float:left;">
									<a id="div_item_{$CurrentItemID}_title_container" href="javascript:void(0);">
										<xsl:choose>
											<xsl:when test="$CurrentRecordRow/child::node()[name(.) = $CurrentColName]">
												<xsl:value-of select="$CurrentRecordRow/child::node()[name(.) = $CurrentColName]"/>
											</xsl:when>
											<xsl:otherwise>
												<xsl:text>Set Due Date</xsl:text>
											</xsl:otherwise>
										</xsl:choose>
									</a>
								</div>
								<xsl:choose>
									<xsl:when test="$CurrentItemRecurringID !=''">
										<span class="glyphicon glyphicon-refresh spanRecurringSign_{$CurrentItemID}" 
											  style="color: #3f51b5;font-weight: bold;margin-left:10px;"></span>
									</xsl:when>
									<xsl:otherwise>
										<span class="glyphicon glyphicon-refresh spanRecurringSign_{$CurrentItemID}" 
										  style="color: #3f51b5;font-weight: bold;margin-left:10px;display:none;"></span>
									</xsl:otherwise>
								</xsl:choose>
							</div>

						</xsl:when>
						<xsl:when test="$CurrentColName='CompletionPercentage'">

							<div class="col-md-12">
								<div  class="btn-group">
									<button type="button" class="multiselect dropdown-toggle btn padinone" data-toggle="{$DataToggleCP}" title="" style="width: auto;" aria-expanded="false" >
										<span style="color: " class="{$OnClickClass} star-default glyphicon {$CircleColor}_{round($CurrentColValue)}" id="span_{$CurrentColName}_{$CurrentItemID}">
											<!--<xsl:value-of select="round($CurrentRecordRow/child::node()[name(.) = $CurrentColName])"/>-->
										</span>
										<!--<b class="caret"></b>-->
									</button>
									<ul class="dropdown-menu {$CurrentColName}" id="ddl_{$CurrentColName}_{$CurrentItemID}" previousValue="{$CurrentColValue}">
										<xsl:for-each select="$List/CompletionPercentage/Option">
											<xsl:variable name="OnClickCP">
												<xsl:choose>
													<xsl:when test="$TypeID != 14 and
															  ($CurrentRecordRow/PermissionID = 3 or $CurrentRecordRow/PermissionID &gt;= 4)">
														<xsl:text>UpdateItemCompletionPercentage_3_0('</xsl:text>
														<xsl:value-of select="$CurrentItemID"/>
														<xsl:text>','</xsl:text>
														<xsl:value-of select="Value"/>
														<xsl:text>','</xsl:text>
														<xsl:value-of select="$CircleColor"/>
														<xsl:text>');</xsl:text>
													</xsl:when>
												</xsl:choose>
											</xsl:variable>
											<xsl:choose>
												<xsl:when test="Value=$CurrentColValue">
													<li class="active" val="{round(Value)}">
														<a href="javascript:void(0);" onclick="{$OnClickCP}">
															<label class="radio" style="padding-left: 0px;">
																<span class="glyphicon {$CircleColor}_{round(Value)}" style="color: "></span>
															</label>
														</a>
													</li>
												</xsl:when>
												<xsl:otherwise>
													<li class="" val="{round(Value)}">
														<a href="javascript:void(0);" onclick="{$OnClickCP}">
															<label class="radio" style="padding-left: 0px;">
																<span class="glyphicon {$CircleColor}_{round(Value)}" style="color: "></span>
															</label>
														</a>
													</li>
												</xsl:otherwise>
											</xsl:choose>
										</xsl:for-each>
									</ul>
								</div>
							</div>
						</xsl:when>
						<xsl:when test="$CurrentColName='Item'">

							<xsl:variable name="completionClass">
								<xsl:choose>
									<xsl:when test="round($CurrentRecordRow/CompletionPercentage)='100'">
										<xsl:text> completionClass</xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:text></xsl:text>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>
							<span class="{$OnClickClass} {$completionClass}" id="span_{$CurrentColName}_{$CurrentItemID}"
								  title="{$CurrentColValue}" style="cursor:pointer; "
								  data-slidepanel="panel">
								<xsl:value-of select="$CurrentColValue"/>

							</span>

						</xsl:when>
						<xsl:otherwise>
							<span class="{$OnClickClass}" id="span_{$CurrentColName}_{$CurrentItemID}" >
								<xsl:value-of select="$CurrentColValue"/>
							</span>
						</xsl:otherwise>
					</xsl:choose>
				</td>
			</xsl:for-each>
		</tr>
	</xsl:template>

	<xsl:template name="GoalTaskSmall">
		<xsl:param name="CurrentBriefRecordRow" select="'N/A'"></xsl:param>
		<xsl:param name="GoalIsLand" select="'N/A'"></xsl:param>
		<xsl:param name="List" select="'N/A'"></xsl:param>
		<xsl:param name="LoggedInUser" select="'N/A'"></xsl:param>
		<xsl:param name="itemID" select="'N/A'"></xsl:param>
		<xsl:param name="SuccessKey" select="'N/A'"></xsl:param>
		<xsl:param name="TargetArea" select="'N/A'"></xsl:param>

		<xsl:variable name="TypeID" select="$CurrentBriefRecordRow/TypeID"></xsl:variable>
		<xsl:variable name="StatusID" select="$CurrentBriefRecordRow/StatusID"></xsl:variable>
		<xsl:variable name="Responsible_user" select="$CurrentBriefRecordRow/ResponsibleID"></xsl:variable>
		<xsl:variable name="PermissionID" select="$CurrentBriefRecordRow/PermissionID"></xsl:variable>
		<xsl:variable name="RowID" select="$CurrentBriefRecordRow/RowID"/>

		<xsl:variable name="DataToggle">
			<xsl:choose>
				<xsl:when test="$PermissionID = 3 or $PermissionID &gt;= 4">
					<xsl:text>dropdown</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="DataToggleCP">
			<xsl:choose>
				<xsl:when test="$TypeID != 14 and ($PermissionID = 3 or $PermissionID &gt;= 4)">
					<xsl:text>dropdown</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>

		<div ColouredRow="0" rowID="{$RowID}" class="full_column ExpandRow TabFlex" id="div_Task_{$CurrentBriefRecordRow/ItemID}">
			<div class="left_column" style="width:100%;padding:2px;">
				<xsl:for-each select="$GoalIsLand/Left[Visibility=1]">
					<xsl:variable name="CurrentLeftColName">
						<xsl:value-of select="ColName"/>
					</xsl:variable>
					<xsl:variable name="OnClickClass">
						<xsl:choose>
							<xsl:when test="$CurrentLeftColName='CompletionPercentage'">
								<xsl:text>onMouseOver</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text></xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
					<xsl:variable name="CurrentColValue">
						<xsl:value-of select="$CurrentBriefRecordRow/child::node()[name(.) = $CurrentLeftColName]"/>
					</xsl:variable>
					<xsl:variable name="CurrentItemID">
						<xsl:value-of select="$CurrentBriefRecordRow/ItemID"/>
					</xsl:variable>
					<xsl:variable name="CurrentDueDateState">
						<xsl:value-of select="$CurrentBriefRecordRow/DueDateState"/>
					</xsl:variable>
					<xsl:variable name="CurrentDueDateLabel">
						<xsl:choose>
							<xsl:when test="$CurrentBriefRecordRow/DueDateLabel !=''">
								<xsl:value-of select="$CurrentBriefRecordRow/DueDateLabel"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text>Set Due Date</xsl:text>
							</xsl:otherwise>
						</xsl:choose>

					</xsl:variable>
					<xsl:variable name="CircleColor">
						<xsl:choose>
							<xsl:when test="$CurrentDueDateState='Current'">
								<xsl:text>circle</xsl:text>
							</xsl:when>
							<xsl:when test="$CurrentDueDateState='PastDue'">
								<xsl:text>circle_yellow</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text>circle</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>

					<xsl:variable name="OpenSliderOnClick">
						<xsl:choose>
							<xsl:when test="$TargetArea !='AddTaskSurvey'">
								<xsl:text>resetSliderClass();viewItemDetailVersion3('</xsl:text>
								<xsl:value-of select="$CurrentItemID"/>
								<xsl:text>', '</xsl:text>
								<xsl:value-of select="$itemID"/>
								<xsl:text>', 'div_item_</xsl:text>
								<xsl:value-of select="$CurrentItemID"/>
								<xsl:text>_detail_container', 'div_item_</xsl:text>
								<xsl:value-of select="$CurrentItemID"/>
								<xsl:text>','2.0', 'view');</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text></xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
					<xsl:variable name="dueDatePostFix">
						<xsl:choose>
							<xsl:when test="$TargetArea !='' and $TargetArea !='N/A'">
								<xsl:value-of select="$TargetArea"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text></xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
					<xsl:variable name="OnClickDueDate">
						<xsl:choose>
							<xsl:when test="$PermissionID = 3 or $PermissionID &gt;= 4">
								<xsl:text>dp('div_item_</xsl:text>
								<xsl:value-of select="$CurrentItemID"></xsl:value-of>
								<xsl:text>_title_content_subTitle_Mobile</xsl:text>
								<xsl:value-of select="$dueDatePostFix"/>
								<xsl:text>', 'div_item_</xsl:text>
								<xsl:value-of select="$CurrentItemID"></xsl:value-of>
								<xsl:text>_title_content_subTitle_Mobile</xsl:text>
								<xsl:value-of select="$dueDatePostFix"/>
								<xsl:text>')</xsl:text>
							</xsl:when>
						</xsl:choose>
					</xsl:variable>
					<xsl:choose>
						<xsl:when test="$CurrentLeftColName='CompletionPercentage'">
							<xsl:variable name="worksheetCPClick">
								<xsl:choose>
									<xsl:when test="$TypeID = 14 and ($CurrentBriefRecordRow/PermissionID = 3 or $CurrentBriefRecordRow/PermissionID &gt;= 4
											  and $TargetArea !='AddTaskSurvey')">
										<xsl:value-of select="$OpenSliderOnClick"/>
									</xsl:when>
								</xsl:choose>
							</xsl:variable>
							<div>
								<div  class="LeftDiv">
									<div  class="btn-group">
										<button type="button" class="multiselect dropdown-toggle btn padinone" data-toggle="{$DataToggleCP}" title="" style="width: auto;padding:0px;" aria-expanded="false" >
											<span style="color: " class="{$OnClickClass} star-default glyphicon {$CircleColor}_{round($CurrentColValue)}" id="span_Brief_{$CurrentLeftColName}_{$CurrentItemID}" onclick="{$worksheetCPClick}">
											</span>
											<!--<b class="caret"></b>-->
										</button>
										<ul class="dropdown-menu {$CurrentLeftColName}" id="ddl_Brief_{$CurrentLeftColName}_{$CurrentItemID}" previousValue="{$CurrentColValue}">
											<xsl:for-each select="$List/CompletionPercentage/Option">
												<xsl:variable name="OnClickCP">
													<xsl:choose>
														<xsl:when test="$TypeID != 14 and
																  ($CurrentBriefRecordRow/PermissionID = 3 or $CurrentBriefRecordRow/PermissionID &gt;= 4)">
															<xsl:text>UpdateItemCompletionPercentage_3_0('</xsl:text>
															<xsl:value-of select="$CurrentItemID"/>
															<xsl:text>','</xsl:text>
															<xsl:value-of select="Value"/>
															<xsl:text>','</xsl:text>
															<xsl:value-of select="$CircleColor"/>
															<xsl:text>');</xsl:text>
														</xsl:when>

													</xsl:choose>
												</xsl:variable>
												<xsl:choose>
													<xsl:when test="Value=$CurrentColValue">
														<li class="active" val="{round(Value)}">
															<a href="javascript:void(0);" onclick="{$OnClickCP}" >
																<label class="radio" style="padding-left: 0px;">
																	<span class="glyphicon {$CircleColor}_{round(Value)}" style="color: " ></span>
																</label>
															</a>
														</li>
													</xsl:when>
													<xsl:otherwise>
														<li class="" val="{round(Value)}">
															<a href="javascript:void(0);" onclick="{$OnClickCP}">
																<label class="radio" style="padding-left: 0px;">
																	<span class="glyphicon {$CircleColor}_{round(Value)}" style="color: " ></span>
																</label>
															</a>
														</li>
													</xsl:otherwise>
												</xsl:choose>
											</xsl:for-each>
										</ul>
									</div>
								</div>
							</div>
						</xsl:when>
						<xsl:when test="$CurrentLeftColName='Item'">
							<xsl:variable name="changeStatus">
								<xsl:choose>
									<xsl:when test="($TypeID)=14 and ($StatusID)=1 and (($LoggedInUser)=($Responsible_user))">
										<xsl:text>if($('#ddl_Brief_CompletionPercentage_</xsl:text>
										<xsl:value-of select="$CurrentItemID"></xsl:value-of>
										<xsl:text>').attr('previousValue') &lt;= 25)</xsl:text>
										<xsl:text>UpdateItemCompletionPercentage_3_0(</xsl:text>
										<xsl:value-of select="$CurrentItemID"/>
										<xsl:text>, '25.00', '</xsl:text>
										<xsl:value-of select="$CircleColor"/>
										<xsl:text>');</xsl:text>
									</xsl:when>
								</xsl:choose>
							</xsl:variable>
							<xsl:variable name="completionClass">
								<xsl:choose>
									<xsl:when test="round($CurrentBriefRecordRow/CompletionPercentage)='100'">
										<xsl:text> completionClass</xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:text></xsl:text>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>
							<xsl:variable name="OpenWorksheetSliderOnClick">
								<xsl:choose>
									<xsl:when test="$SuccessKey='Worksheets' or $SuccessKey='BusinessPlanning' and $TargetArea !='AddTaskSurvey'">
										<xsl:text>resetSliderClass();</xsl:text>
										<xsl:text>viewItemDetailVersion3('</xsl:text>
										<xsl:value-of select="$CurrentItemID"/>
										<xsl:text>', '</xsl:text>
										<xsl:value-of select="$itemID"/>
										<xsl:text>', 'divWorksheetLeftSlide', 'div_item_</xsl:text>
										<xsl:value-of select="$CurrentItemID"/>
										<xsl:text>','2.0', 'view');</xsl:text>
										<xsl:value-of select="$changeStatus"/>
									</xsl:when>
									<xsl:otherwise>
										<xsl:text></xsl:text>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>

							<xsl:choose>
								<xsl:when test="$SuccessKey='Worksheets' or $SuccessKey='BusinessPlanning' and $TargetArea !='AddTaskSurvey'">
									<div class="MiDiv  MiDiv1 ExpandRow {$completionClass}"  MainDiv="div_Task_{$CurrentBriefRecordRow/ItemID}"
								 
								  id="div_item_{$CurrentItemID}_small"
										 goalitemid="{$itemID}">
										<span ClickRowID="{$RowID}" class="{$OnClickClass} {$completionClass} MiDiv wid80 div_item_{$CurrentItemID}_small" id="span_{$CurrentItemID}" title="{$CurrentColValue}"
											  style="cursor:pointer; " data-slidepanel="panel" onclick="{$OpenWorksheetSliderOnClick}">
											<xsl:value-of select="$CurrentColValue"/>
										</span>
										<div style="width:10%;float:left;" class="pull-right onMouseOver"
											onclick="{$OnClickDueDate}" id="div_item_{$CurrentItemID}_title_content_subTitle_Mobile{$dueDatePostFix}"
											  name="&lt;OperationalData&gt;&lt;Version&gt;2.0&lt;/Version&gt;
											  &lt;ItemID&gt;{$CurrentItemID}&lt;/ItemID&gt;&lt;GoalID&gt;{$itemID}&lt;/GoalID&gt;
											  &lt;Mode&gt;GoalDetail30&lt;/Mode&gt;
											  &lt;ItemDivPrefix&gt;div_item_{$CurrentItemID}&lt;/ItemDivPrefix&gt;
											  &lt;/OperationalData&gt;">
											<span class="pull-right div_item_{$CurrentItemID}_DueDate" style="color:#8c8a8a;font-size:12px;" >
												<xsl:value-of select="$CurrentDueDateLabel"/>
											</span>
										</div>
									</div>
								</xsl:when>
								<xsl:otherwise>
									<div class="MiDiv MiDiv1 ExpandRow {$completionClass}"
								  id="div_item_{$CurrentItemID}_small" goalitemid="{$itemID}">
										<xsl:choose>
											<xsl:when test="$TargetArea !='AddTaskSurvey'">
												<span class="{$OnClickClass} {$completionClass} MiDiv wid80 div_item_{$CurrentItemID}_small" id="span_{$CurrentItemID}" title="{$CurrentColValue}"
																						  style="cursor:pointer;" data-slidepanel="panel"
																			 onclick="{$changeStatus};{$OpenSliderOnClick}">
													<xsl:value-of select="$CurrentColValue"/>
												</span>
											</xsl:when>
											<xsl:otherwise>
												<span class="{$OnClickClass} {$completionClass} MiDiv wid80 div_item_{$CurrentItemID}_small" id="span_{$CurrentItemID}" title="{$CurrentColValue}"
												  style="cursor:pointer;" data-slidepanel="panel"
									 onclick="{$OpenSliderOnClick}">
													<xsl:value-of select="$CurrentColValue"/>
												</span>
											</xsl:otherwise>
										</xsl:choose>
										<div style="width:10%;float:left;" class="pull-right onMouseOver"
											 onclick="{$OnClickDueDate}" id="div_item_{$CurrentItemID}_title_content_subTitle_Mobile{$dueDatePostFix}"
											  name="&lt;OperationalData&gt;&lt;Version&gt;2.0&lt;/Version&gt;
											  &lt;ItemID&gt;{$CurrentItemID}&lt;/ItemID&gt;&lt;GoalID&gt;{$itemID}&lt;/GoalID&gt;
											  &lt;Mode&gt;GoalDetail30&lt;/Mode&gt;
											  &lt;ItemDivPrefix&gt;div_item_{$CurrentItemID}&lt;/ItemDivPrefix&gt;
											  &lt;/OperationalData&gt;">
											<span class="pull-right font12 div_item_{$CurrentItemID}_DueDate" style="" >
												<xsl:value-of select="$CurrentDueDateLabel"/>
											</span>
										</div>
									</div>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:otherwise>
							<div class="MiDiv ExpandRow"  onclick="return {$OpenSliderOnClick}">
								<xsl:value-of select="$CurrentColValue"/>
							</div>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:for-each>
				<!-- Right Div-->

				<div class="right_column RightDiv rit7">
					<xsl:for-each select="$GoalIsLand/Right[Visibility=1]">
						<xsl:variable name="CurrentRightColName">
							<xsl:value-of select="ColName"/>
						</xsl:variable>
						<xsl:variable name="OnClickClass">
							<xsl:choose>
								<xsl:when test="$CurrentRightColName='Priority'">
									<xsl:text>onMouseOver</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text></xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="CurrentColValue">
							<xsl:value-of select="$CurrentBriefRecordRow/child::node()[name(.) = $CurrentRightColName]"/>
						</xsl:variable>
						<xsl:variable name="CurrentItemID">
							<xsl:value-of select="$CurrentBriefRecordRow/ItemID"/>
						</xsl:variable>
						<xsl:choose>
							<xsl:when test="$CurrentRightColName='Priority'">
								<div class="float_padding">
									<div>
										<div class="btn-group ">
											<button  type="button" class="multiselect dropdown-toggle btn padinone" data-toggle="{$DataToggle}" title="" aria-expanded="false" style="width: auto;padding:0px;">
												<span class="{$OnClickClass} star-default glyphicon glyphicon-star star_{$CurrentColValue}"  id="span_Brief_{$CurrentRightColName}_{$CurrentItemID}"></span>
												<!--<b class="caret"></b>-->
											</button>
											<ul class=" dropdown-menu {$CurrentRightColName}" id="ddl_Brief_{$CurrentRightColName}_{$CurrentItemID}" previousValue="{$CurrentColValue}">
												<xsl:for-each select="$List/Priority/Option">

													<xsl:variable name="OnClickPriority">
														<xsl:choose>
															<xsl:when test="$CurrentBriefRecordRow/PermissionID = 3 or $CurrentBriefRecordRow/PermissionID &gt;= 4">
																<xsl:text>UpdateItemPriority_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>')</xsl:text>
															</xsl:when>
														</xsl:choose>
													</xsl:variable>

													<xsl:choose>
														<xsl:when test="Value=$CurrentColValue">
															<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);" onclick="{$OnClickPriority}">
																	<label class="radio" style="padding-left: 0px;">
																		<span class="glyphicon glyphicon-star star_{Value}" ></span>
																	</label>
																</a>
															</li>
														</xsl:otherwise>
													</xsl:choose>
												</xsl:for-each>
											</ul>
										</div>
									</div>
								</div>
							</xsl:when>
							<xsl:otherwise>
								<div class="float_padding">
									<xsl:value-of select="$CurrentColValue"/>
								</div>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:for-each>
				</div>
			</div>

		</div>
	</xsl:template>

</xsl:stylesheet>
