﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:import href="GenericTemplates/BoxLayout.xslt"/>
    <!--<xsl:import href="GenericTemplates/ItemDropDown.xslt"/>-->
    <xsl:template match="/">

    </xsl:template>

    <xsl:template name="SelectedGoalTitle">
        <xsl:param name="TemplatePathURL" select="'N/A'"></xsl:param>
        <xsl:param name="ItemID" select="'N/A'"></xsl:param>
        <xsl:param name="ItemName" select="'N/A'"></xsl:param>
        <xsl:param name ="PermissionID" select ="'N/A'"></xsl:param>
        <xsl:param name ="ParentName" select ="'N/A'"></xsl:param>
        <!--<xsl:param name ="ParentTypeID" select ="'N/A'"></xsl:param>-->
        <xsl:param name ="ImageURL" select ="'N/A'"></xsl:param>
        <xsl:param name="IsFollowingGoal" select="'N/A'"/>
        <xsl:param name="StatusID" select="'N/A'"></xsl:param>
        <xsl:param name="IsCoach" select="'N/A'"></xsl:param>
        <xsl:param name="Origin">
            <xsl:text>Goal</xsl:text>
        </xsl:param>
        <xsl:param name="UserRoles"></xsl:param>

        <div id="SelectedGoalTitleContainer">
            <div id="div_SelectedGoalItem" style="display:block; 
                                                    border: 2px solid #385D8A; 
                                                    margin-bottom:20px;margin-top:5px;">
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                        <td>
                            <div style="margin: 10px;">
                                <xsl:choose>
                                    <xsl:when test ="$ImageURL != ''">
                                        <img id="div_Img_GoalItem" src="{$ImageURL}"
                                 onload="setWidthAndHeightImage(this,'100');" style="border: 0pt none; float:left; margin-right: 10px; display:none;"/>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <xsl:choose>
                                            <xsl:when test="$ParentName='Fun' or $ParentName='Family' or $ParentName='Fitness' or $ParentName='Finance' or $ParentName='Faith'">
                                                <img id="div_Img_GoalItem" src="{$TemplatePathURL}Web/Images/{$ParentName}.jpg"
                                onload="setWidthAndHeightImage(this,'100');" style="border: 0pt none; float:left; margin-right: 10px;display:none;"/>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <img id="div_Img_GoalItem" src="{$TemplatePathURL}Web/Images/LifeSpace LLC.jpg"
                                  onload="setWidthAndHeightImage(this,'100');" style="border: 0pt none; float:left; margin-right: 10px;"/>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:otherwise>
                                </xsl:choose>
                                <a class="link"
                                   onmouseover="this.style.textDecoration='underline';"
                                   onmouseout="this.style.textDecoration='none';"
                                   href="http://{normalize-space(AjaxRequest/HostName)}/Goal.aspx?ID={$ItemID}">
                                    <span id="div_SelectedGoalItem_Name" class="label" style="color: #17375E; font-size: 14pt; font-weight: bold;">
                                        <xsl:value-of select="$ItemName"/>
                                    </span>
                                </a>
                                <xsl:if test ="$PermissionID &gt;= 4 or $PermissionID = 3 or $IsCoach = 1">
                                    <div id="div_ShareIT">
                                        <xsl:for-each select="AjaxRequest/Params/ShareIt/Users/User">
                                            <xsl:if test="position()&lt;=5">
                                                <xsl:choose>
                                                    <xsl:when test="position() &lt; count(../User) and position() &lt; 5">
                                                        <xsl:choose>
                                                            <xsl:when test="$PermissionID &gt;= 4">
                                                                <a href="#" onclick="return Dashboard_GoalShareIt('divGoal_Operations','{$ItemID}');">
                                                                    <span class="label" style="color: #A6A6A6; font-weight: bold;">
                                                                        <xsl:value-of select="FirstName"/>&#xa0;<xsl:value-of select="LastName"/>
                                                                        <xsl:text>,&#xa0;</xsl:text>
                                                                    </span>
                                                                </a>
                                                            </xsl:when>
                                                            <xsl:otherwise>
                                                                <a href="#">
                                                                    <span class="label" style="color: #A6A6A6; font-weight: bold;">
                                                                        <xsl:value-of select="FirstName"/>&#xa0;<xsl:value-of select="LastName"/>
                                                                        <xsl:text>,&#xa0;</xsl:text>
                                                                    </span>
                                                                </a>
                                                            </xsl:otherwise>
                                                        </xsl:choose>
                                                    </xsl:when>
                                                    <xsl:otherwise>
                                                        <xsl:choose>
                                                            <xsl:when test="$PermissionID &gt;= 4">
                                                                <a href="#" onclick="return Dashboard_GoalShareIt('divGoal_Operations','{$ItemID}');">
                                                                    <span class="label" style="color: #A6A6A6; font-weight: bold;">
                                                                        <xsl:value-of select="FirstName"/>&#xa0;
                                                                        <xsl:value-of select="LastName"/>
                                                                    </span>
                                                                </a>
                                                            </xsl:when>
                                                            <xsl:otherwise>
                                                                <a href="#">
                                                                    <span class="label" style="color: #A6A6A6; font-weight: bold;">
                                                                        <xsl:value-of select="FirstName"/>&#xa0;
                                                                        <xsl:value-of select="LastName"/>
                                                                    </span>
                                                                </a>
                                                            </xsl:otherwise>
                                                        </xsl:choose>

                                                    </xsl:otherwise>
                                                </xsl:choose>
                                            </xsl:if>
                                        </xsl:for-each>
                                        <xsl:if test="count(AjaxRequest/Params/ShareIt/Users/User) &gt; 5">
                                            <a href="#" onclick="return Dashboard_GoalShareIt('divGoal_Operations','{$ItemID}');">
                                                <span class="link" style="color: #A6A6A6; font-weight: bold;">
                                                    (More...)
                                                </span>
                                            </a>
                                        </xsl:if>
                                    </div>
                                </xsl:if>
                                <input type="hidden" id="hiddenGoalID" value="{$ItemID}"></input>

                                <div>
                                    <!--<span style="color: rgb(23, 55, 94); font-weight: bold;">-->

                                    You are currently
                                    <xsl:choose>
                                        <xsl:when test="$IsFollowingGoal = 'True'">
                                            <a href="#" onclick="return followCommunity('{$ItemID}','divGoal_Operations', 'Goal');">
                                                Following
                                            </a>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <a href="#" onclick="return followCommunity('{$ItemID}','divGoal_Operations', 'Goal');">
                                                Not Following
                                            </a>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                    this Goal
                                    <!--</span>-->
                                </div>
                            </div>
                            <div style="margin-top: 10px; margin-bottom: 10px;">
                                <table style="width: 70%;">
                                    <tr>
                                        <xsl:if test ="$PermissionID &gt;= 4 or $IsCoach = 1">
                                            <td style="padding-left: 40px; padding-right: 10px; text-align: center"
                                                valign="bottom">
                                                <a onclick="return Dashboard_GoalUpdate('divGoal_Operations','{$ItemID}');" href="#">
                                                    <img src="{$TemplatePathURL}Web/Icons/Update/32 Bit Alpha png/Update 32 n p.png"
                                                         cssclass="link" title="Update" style="border: 0pt none ;"></img>
                                                    <div>
                                                    </div>
                                                    <span id="ctrlUpdateGoal" class="link">Edit Goal</span>
                                                </a>
                                            </td>
                                        </xsl:if>
                                        <xsl:if test ="$PermissionID &gt;= 4 or $IsCoach = 1">
                                            <td style="padding-left: 10px; padding-right: 10px; text-align: center"
                                                align="center" valign="bottom">
                                                <a onclick="saveSettings('chkCurrentItem', 'chkFutureItem', 'chkCompletedItem', 'chkMyItems', 'chkOtherItems', '{$ItemID}','1');
                                                   return Dashboard_GoalShareIt('divGoal_Operations','{$ItemID}');">
                                                    <img src="{$TemplatePathURL}Web/Icons/Share It/32 Bit Alpha png/Share It 32 n p.png"
                                                         title="Share It" style="border: 0pt none ;"></img>
                                                    <div>
                                                    </div>
                                                    <span id="ctrlShareITGoal" class="link">Share It</span>
                                                </a>
                                            </td>
                                        </xsl:if>
                                        <xsl:if test="count(AjaxRequest/Params/ShareIt/Users/User) &gt; 0">
                                            <td style="padding-left: 10px; padding-right: 10px; text-align: center"
                                                align="center" valign="bottom">
                                                <xsl:if test="$Origin = 'Goal'">
                                                    <a href="#" onclick="return discussion_Load('{$ItemID}', 'divGoal_Operations');">
                                                        <img src="{$TemplatePathURL}Web/Icons/Discussions/32 Bit Alpha png/Discussions 32 n p.png"
                                                             style="border: 0pt none;"></img>
                                                        <div>
                                                        </div>
                                                        <span id="ctrlDiscussionGoal" class="link">
                                                            <xsl:if test="count(AjaxRequest/Params/ShareIt/Users/User) &gt; 1">
                                                                Discussions
                                                            </xsl:if>
                                                            <xsl:if test="count(AjaxRequest/Params/ShareIt/Users/User) = 1">
                                                                Journal
                                                            </xsl:if>
                                                        </span>
                                                    </a>
                                                </xsl:if>
                                            </td>
                                        </xsl:if>
                                        <td style="padding-left: 10px; padding-right: 10px; text-align: center"
                                                align="center" valign="bottom">
                                            <a href="#" onclick="return followCommunity('{$ItemID}','divGoal_Operations', 'Goal');">
                                                <img src="DesktopModules/Communities/images/FollowIt.jpg"
                                                     title="Follow It" style="border: 0pt none ;"></img>
                                                <div>
                                                </div>
                                                <span id="ctrlFollowITGoal" class="link">Follow It</span>
                                            </a>
                                        </td>
                                        <xsl:if test ="$PermissionID &gt;= 4 or $IsCoach = 1">
                                            <td style="padding-left: 10px; padding-right: 10px; text-align: center;"
                                                align="center" valign="bottom" width="100px">
                                                <a onclick="return displayDivForGoalStatus('div_GoalStatus_Popup','ctrlFinishGoal');">
                                                    <img src="{$TemplatePathURL}Web/Icons/GoalCheck.jpg"
                                                         title="Finish Goal" style="border: 0pt none ;"></img>
                                                    <div>
                                                    </div>
                                                    <span id="ctrlFinishGoal" class="link">Finish Goal</span>
                                                </a>
                                                <div style="display:none;position:absolute;border: 2px solid black;padding: 10px; 
                                                                background-color:#FFFFFF;visibility: visible; width:200px; height:80px;margin-left:-20px;"
                                                     id="div_GoalStatus_Popup" align="center" name="collapsed">

                                                    <itemExpansionStatus id="div_GoalStatus_Popup_expansionStatus" status="collapsed"></itemExpansionStatus>

                                                    <span style="margin-right:6px;">
                                                        This goal is
                                                    </span>

                                                    <select onchange="return updateItemOption('Goal_UpdateGoalStatus','{$ItemID}',this,'');" id="ddlgoalStatus">
                                                        <xsl:choose>
                                                            <xsl:when test="$StatusID = 3">
                                                                <option value="-99">-Select-</option>
                                                                <option value="3" selected="selected">Waiting</option>
                                                                <option value="4">Completed</option>
                                                                <option value="5">Terminated</option>
                                                            </xsl:when>
                                                            <xsl:when test="$StatusID = 4">
                                                                <option value="-99">-Select-</option>
                                                                <option value="3">Waiting</option>
                                                                <option value="4"  selected="selected">Completed</option>
                                                                <option value="5">Terminated</option>
                                                            </xsl:when>
                                                            <xsl:when test="$StatusID = 5">
                                                                <option value="-99">-Select-</option>
                                                                <option value="3">Waiting</option>
                                                                <option value="4">Completed</option>
                                                                <option value="5"  selected="selected">Terminated</option>
                                                            </xsl:when>
                                                            <xsl:otherwise>
                                                                <option value="-99">-Select-</option>
                                                                <option value="3">Waiting</option>
                                                                <option value="4">Completed</option>
                                                                <option value="5">Terminated</option>
                                                            </xsl:otherwise>
                                                        </xsl:choose>
                                                    </select>
                                                </div>
                                            </td>
                                        </xsl:if>
                                        <xsl:if test ="$PermissionID != 4 and $IsCoach != 1 and $UserRoles and count($UserRoles/Role[RoleName = 'Brand Admin']) &gt; 0">
                                            <td style="padding-left: 10px; padding-right: 10px; text-align: center"
                                                align="center" valign="bottom" width="100px">
                                                <input type="button" class="button" value="Take Ownership"
                                                          onClick="return clientPortal_OpenProjectAddMe({$ItemID},'divGoal_Operations','GoalHeader');"></input>

                                            </td>
                                        </xsl:if>
                                        <!--<xsl:if test ="$PermissionID = 4">
                                              <td style="padding-left: 10px; padding-right: 10px; text-align: center"
                                                  valign="bottom">
                                                   <a href="#"
                                                      onclick='return EmailUserInvitation_Load("{$ItemName}","divGoal_Operations",{$ItemID},"Goal");'>
                                                        <img src="DesktopModules/Communities/images/email_icon.png"
                                                             cssclass="link" title="Email" style="border: 0pt none ;"></img>
                                                        <div>
                                                        </div>
                                                        <span id="ctrlUpdateGoal" class="link">Email</span>
                                                   </a>
                                              </td>
                                         </xsl:if>-->
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </xsl:template>
</xsl:stylesheet>
