﻿<?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="CoachesShareIT.xslt"/>
	<xsl:import href="ParticipantsShareIT.xslt"/>
	<xsl:import href="ObserversShareIT.xslt"/>
	<xsl:import href="AutoSuggestVer11.xslt"/>
	<xsl:import href="../Version_2_0/ShareItListTemplate.xslt"/>
	<xsl:include href="../SendInvite.xslt"/>


	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:call-template name="GoalShareIT">
			<xsl:with-param name="GoalItemID" select="ShareITRecords/SourceID"></xsl:with-param>
			<xsl:with-param name="Origin" select="ShareITRecords/Origin"></xsl:with-param>
			<xsl:with-param name="ShareITRecords" select="ShareITRecords/."></xsl:with-param>
			<xsl:with-param name="Permissions" select="ShareITRecords/Permissions/."></xsl:with-param>
			<xsl:with-param name="PortalItemID" select="ShareITRecords/PortalItemID"></xsl:with-param>
			<xsl:with-param name="PortalName" select="ShareITRecords/PortalName"></xsl:with-param>
			<xsl:with-param name="LifespaceID" select="ShareITRecords/LifespaceID"></xsl:with-param>
			<xsl:with-param name="BrandID" select="ShareITRecords/BrandID"></xsl:with-param>
			<xsl:with-param name="TemplateURL" select="ShareITRecords/TemplateURL"></xsl:with-param>
			<xsl:with-param name="UserID" select="ShareITRecords/UserID"></xsl:with-param>
			<xsl:with-param name="IsSecureConnection" select="ShareITRecords/IsSecureConnection"></xsl:with-param>
		</xsl:call-template>
	</xsl:template>

	<xsl:template name="GoalShareIT">
		<xsl:param name="GoalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="Origin" select="'N/A'"></xsl:param>
		<xsl:param name="ShareITRecords" select="'N/A'"></xsl:param>
		<xsl:param name="Permissions" select="'N/A'"></xsl:param>
		<xsl:param name="PortalItemID" select="'N/A'"></xsl:param>
		<xsl:param name="PortalName" select="'N/A'"></xsl:param>
		<xsl:param name="LifespaceID" select="'N/A'"></xsl:param>
		<xsl:param name="BrandID" select="'N/A'"></xsl:param>
		<xsl:param name="TemplateURL" select="'N/A'"></xsl:param>
		<xsl:param name="UserID" select="'N/A'"></xsl:param>
		<xsl:param name="UserRoles" select="ShareITRecords/UserRoles/."></xsl:param>
		<xsl:param name="IsSecureConnection" select="'N/A'"></xsl:param>

		<xsl:variable name="PermissionID" select="$ShareITRecords/ShareIT[ID=$UserID]/PermissionID"></xsl:variable>

		<div id="divGoalShareIT_{$GoalItemID}" class="">

			<xsl:variable name="CoachesRecords">
				<xsl:copy-of select ="$ShareITRecords/ShareIT[Coach = 1]"></xsl:copy-of>
			</xsl:variable>
			<xsl:variable name="ParticipantsRecords">
				<xsl:copy-of  select ="$ShareITRecords/ShareIT[Participant = 1]"></xsl:copy-of>
			</xsl:variable>
			<xsl:variable name="ObserverRecords">
				<xsl:copy-of  select ="$ShareITRecords/ShareIT[Observer = 1]"></xsl:copy-of>
			</xsl:variable>


			<!--<div>
                <img style="width:550px;height:10px;" class="verticallyMiddle" src="{$TemplateURL}Web/Images/Ver_2_0/dropshadow_550.png"></img>
            </div>-->
			<table class="table" cellspacing="0" cellpadding="0">
				<tr>
					<td >
						<!--<div class="labelGoalTitle paddingBottom10 paddingLeft5 marginBottom10" style="border-bottom:1px solid gray;">
							<span>Add Team Members</span>
						</div>-->

						<div class=" paddingLeft10 paddingRight10" id="div_SendInvite_{$GoalItemID}">

							<!--<div class="capitalFont marginLeft10">
								<span class="labelGoalActionsText">ENTER NAMES OR EMAIL ADDRESSES BELOW</span>
							</div>-->
							<div id="div_permissionRDB_{$GoalItemID}" class="marginBottom10 marginLeft5 ">
								<input id="rb_AddTask_{$GoalItemID}" name="userType_{$GoalItemID}" type="radio"   checked="checked">
									<span class="myTeamText" >Add to Task</span>
								</input>
								<input id="rb_AddProgram_{$GoalItemID}" name="userType_{$GoalItemID}" type="radio" >
									<span class="myTeamText" >Add to Program</span>
								</input>


								<input id="rb_Participant_{$GoalItemID}" name="userType_{$GoalItemID}" type="radio"  style="display:none;"
                                       onClick="document.getElementById('div_AutoSuggest_{$GoalItemID}').style.display = 'block';
                                                displayAutoSuggestUser('{$GoalItemID}');">
									<span class="myTeamText"  style="display:none;">Participant</span>
								</input>
								<xsl:if test="$PermissionID &gt;= 4">
									<input id="rb_Coach_{$GoalItemID}" name="userType_{$GoalItemID}" type="radio" style="display:none;"
                                           onClick="document.getElementById('div_AutoSuggest_{$GoalItemID}').style.display = 'none';
                                                displayAutoSuggestUser('{$GoalItemID}');">
										<span class="myTeamText" style="display:none;">Coach/Manager</span>
									</input>
								</xsl:if>
								<input id="rb_Observer_{$GoalItemID}" name="userType_{$GoalItemID}" type="radio" style="display:none;"
                                       onClick="document.getElementById('div_AutoSuggest_{$GoalItemID}').style.display = 'block';
                                                displayAutoSuggestUser('{$GoalItemID}');">
									<span class="myTeamText" style="display:none;">Observer</span>
								</input>
							</div>
							<div id="div_Participant_{$GoalItemID}_AutoSuggest" style="display:block;">
								<xsl:call-template name="AutoSuggestVer11">
									<xsl:with-param name="SourceID" select="$GoalItemID"></xsl:with-param>
									<xsl:with-param name="TargetDivID">
										<xsl:text>div_shareIt_</xsl:text>
										<xsl:value-of select="$GoalItemID"/>
										<xsl:text>_participant</xsl:text>
									</xsl:with-param>
									<xsl:with-param name="Origin">
										<xsl:text>ParticipantShareIt_3_0</xsl:text>
									</xsl:with-param>
								</xsl:call-template>
							</div>
							<div id="div_Coach_{$GoalItemID}_AutoSuggest" style="display:none;">
								<xsl:call-template name="AutoSuggestVer11">
									<xsl:with-param name="SourceID" select="$GoalItemID"></xsl:with-param>
									<xsl:with-param name="TargetDivID">
										<xsl:text>div_shareIt_</xsl:text>
										<xsl:value-of select="$GoalItemID"/>
										<xsl:text>_coaches</xsl:text>
									</xsl:with-param>
									<xsl:with-param name="Origin">
										<xsl:text>CoachesShareIt_3_0</xsl:text>
									</xsl:with-param>
								</xsl:call-template>
							</div>
							<div id="div_Observer_{$GoalItemID}_AutoSuggest" style="display:none;">
								<xsl:call-template name="AutoSuggestVer11">
									<xsl:with-param name="SourceID" select="$GoalItemID"></xsl:with-param>
									<xsl:with-param name="TargetDivID">
										<xsl:text>div_shareIt_</xsl:text>
										<xsl:value-of select="$GoalItemID"/>
										<xsl:text>_observer</xsl:text>
									</xsl:with-param>
									<xsl:with-param name="Origin">
										<xsl:text>ObserverShareIt_3_0</xsl:text>
									</xsl:with-param>
								</xsl:call-template>
							</div>
							<div align="right" class="marginTop20" style="display:block;">
								<div id="div_Participant_{$GoalItemID}_Submit" class="divGradientButton spanGradientText verticallyMiddle lineHeight30" style="width:90px;display:table-Cell;"
								  onmouseover="document.getElementById('div_Participant_{$GoalItemID}_SubmitImage').src='{$TemplateURL}/web/images/ver_2_0/BT_arrow_hover.png';"
								  onmouseout="document.getElementById('div_Participant_{$GoalItemID}_SubmitImage').src='{$TemplateURL}/web/images/ver_2_0/BT_arrow.png';"
								  onclick='return brandAutoSuggest_selectAutoSuggestFromAutoSuggestTextBox_OnButton("{$GoalItemID}",
                                                    "div_shareIt_{$GoalItemID}_participant_txt_shareIt_{$GoalItemID}_Add_New", 
                                                    "ParticipantShareIt_3_0",
                                                    "div_shareIt_{$GoalItemID}_participant",
                                                    "div_shareIt_{$GoalItemID}_participant_Suggestions");'>
									<img alt="" id="div_Participant_{$GoalItemID}_SubmitImage" class="verticallyMiddle marginRight5"
										 src="{$TemplateURL}/web/images/ver_2_0/BT_arrow.png"></img>
									<span class="verticallyMiddle">
										Submit
									</span>
								</div>
							</div>
							<div id="div_Coach_{$GoalItemID}_Submit" align="right" class="marginTop20" style="display:none;">
								<div class="divGradientButton spanGradientText verticallyMiddle" style="width:90px;display:table-Cell;"
									 onmouseover="document.getElementById('div_Coach_{$GoalItemID}_SubmitImage').src='{$TemplateURL}/web/images/ver_2_0/BT_arrow_hover.png';"
									 onmouseout="document.getElementById('div_Coach_{$GoalItemID}_SubmitImage').src='{$TemplateURL}/web/images/ver_2_0/BT_arrow.png';"
									 onclick='return brandAutoSuggest_selectAutoSuggestFromAutoSuggestTextBox_OnButton("{$GoalItemID}",
                                                    "div_shareIt_{$GoalItemID}_coaches_txt_shareIt_{$GoalItemID}_Add_New", 
                                                    "CoachesShareIt_3_0",
                                                    "div_shareIt_{$GoalItemID}_coach",
                                                    "div_shareIt_{$GoalItemID}_coach_Suggestions");'>
									<img alt="" id="div_Coach_{$GoalItemID}_SubmitImage" class="verticallyMiddle marginRight5"
										 src="{$TemplateURL}/web/images/ver_2_0/BT_arrow.png"></img>
									<span class="verticallyMiddle">
										Submit
									</span>
								</div>
							</div>
							<div id="div_Observer_{$GoalItemID}_Submit" align="right" class="marginTop20" style="display:none;">
								<div class="divGradientButton spanGradientText verticallyMiddle" style="width:90px;display:table-Cell;"
									 onmouseover="document.getElementById('div_Observer_{$GoalItemID}_SubmitImage').src='{$TemplateURL}/web/images/ver_2_0/BT_arrow_hover.png';"
									 onmouseout="document.getElementById('div_Observer_{$GoalItemID}_SubmitImage').src='{$TemplateURL}/web/images/ver_2_0/BT_arrow.png';"
									 onclick='return brandAutoSuggest_selectAutoSuggestFromAutoSuggestTextBox_OnButton("{$GoalItemID}",
                                                    "div_shareIt_{$GoalItemID}_observer_txt_shareIt_{$GoalItemID}_Add_New", 
                                                    "ObserverShareIt_3_0",
                                                    "div_shareIt_{$GoalItemID}_observer",
                                                    "div_shareIt_{$GoalItemID}_observer_Suggestions");'>
									<img alt="" id="div_Observer_{$GoalItemID}_SubmitImage" class="verticallyMiddle marginRight5"
										 src="{$TemplateURL}/web/images/ver_2_0/BT_arrow.png"></img>
									<span class="verticallyMiddle">
										Submit
									</span>
								</div>
							</div>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</xsl:template>

</xsl:stylesheet>
