﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:import href="ClientContactControl.xslt"/>
    <xsl:import href="GoalControl.xslt"/>
    <xsl:import href="AccountControl.xslt"/>

    <xsl:template match="/">
        <xsl:variable name="ItemID" select="normalize-space(AjaxRequest/Params/PortalID)" />
        <xsl:variable name="crmProjectTypeID" select="normalize-space(AjaxRequest/Params/TypeID)" />
        <xsl:variable name="TemplateURL" select="AjaxRequest/TemplateURL" />

        <table class="tableMaster" cellpadding="5" cellspacing="5" width="100%">
            <tr>

                <xsl:choose>
                    <xsl:when test="$crmProjectTypeID = 2">
                        <td style="vertical-align:top;" nowrap="nowrap"  width="15%">
                            <span class="packageTitle">Team Member</span>
                        </td>
                        <td style="vertical-align:top;"  width="85%">
                            <xsl:call-template name="DisplayClientContactPortal">
                                <xsl:with-param name="ItemID" select="$ItemID"></xsl:with-param>
                                <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                                <xsl:with-param name="Origin">
                                    <xsl:text>CorporatePortalAutoSuggest</xsl:text>
                                </xsl:with-param>
                            </xsl:call-template>
                        </td>
                    </xsl:when>
                    <xsl:otherwise>
                        <td style="vertical-align:top;" nowrap="nowrap"  width="15%">
                            <span class="packageTitle">Client Contact</span>
                        </td>
                        <td style="vertical-align:top;"  width="85%">
                            <xsl:call-template name="DisplayClientContactPortal">
                                <xsl:with-param name="ItemID" select="$ItemID"></xsl:with-param>
                                <xsl:with-param name="Origin">
                                    <xsl:text>PortalAutoSuggest</xsl:text>
                                </xsl:with-param>
                                <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                            </xsl:call-template>
                        </td>
                    </xsl:otherwise>
                </xsl:choose>



            </tr>
            <xsl:if test="$crmProjectTypeID = 1">
                <tr>
                    <td width="10%" style="vertical-align:top;" nowrap="nowrap">
                        <span class="packageTitle">Account</span>
                    </td>
                    <td width="90%" style="vertical-align:top;">
                        <xsl:call-template name="DisplayClientPortalAccount">
                            <xsl:with-param name="ItemID" select="$ItemID"></xsl:with-param>
                            <xsl:with-param name="Origin">
                                <xsl:text>PortalAccountAutoSuggest</xsl:text>
                            </xsl:with-param>
                            <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                        </xsl:call-template>
                    </td>
                </tr>
            </xsl:if>
            <tr>
                <td style="vertical-align:top;" nowrap="nowrap">
                    <span class="packageTitle">Goal/Project</span>
                </td>
                <td style="vertical-align:top;">
                    <xsl:call-template name="DisplayGoalControl">
                        <xsl:with-param name="ItemID" select="$ItemID"></xsl:with-param>
                        <xsl:with-param name="LinkedTemplates" select="AjaxRequest/Templates/."></xsl:with-param>
                        <xsl:with-param name="HostName" select="AjaxRequest/HostName"></xsl:with-param>
                        <xsl:with-param name="TemplateID" select="AjaxRequest/Templates/Template/TemplateID"></xsl:with-param>
                        <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                    </xsl:call-template>
                </td>
            </tr>
            <tr>
                <td style="vertical-align:top;">
                    <span class="packageTitle">Stage</span>
                </td>
                <td style="vertical-align:top;">
                    <select style="margin-left: 10px;" class="smallDropdown" id="ctrl_{$ItemID}_StageID">
                        <xsl:choose>
                            <xsl:when test="$crmProjectTypeID = 1">
                                <xsl:for-each select="AjaxRequest/ProjectStages/Stage[CRMProjectStageID != 11]">
                                    <option value="{CRMProjectStageID}">
                                        <xsl:value-of select="ProjectStage"/>
                                    </option>
                                </xsl:for-each>
                            </xsl:when>
                            <xsl:when test="$crmProjectTypeID = 2">
                                <xsl:for-each select="AjaxRequest/ProjectStages/Stage[CRMProjectStageID = 3 or CRMProjectStageID = 4
                                                                             or CRMProjectStageID = 6 or CRMProjectStageID = 11]">
                                    <option value="{CRMProjectStageID}">
                                        <xsl:value-of select="ProjectStage"/>
                                    </option>
                                </xsl:for-each>
                            </xsl:when>
                        </xsl:choose>

                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <!--<input type="button" class="button"
                           onclick="return ClientPortal_AddNewProject('divClientPortalOperations_Container','ctrl_{$ItemID}_StageID','{$ItemID}','{$crmProjectTypeID}');"
                           value="Submit"></input>-->

                    <div class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:80px;line-height:30px;"
                         onmouseover="document.getElementById('img_Submit').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';"
                         onmouseout="document.getElementById('img_Submit').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';"
                         onclick="ClientPortal_AddNewProject('divClientPortalOperations_Container','ctrl_{$ItemID}_StageID','{$ItemID}','{$crmProjectTypeID}');">
                        <img id="img_Submit" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle" style="padding-left:8px;" class="marginRight5"></img>
                        <span id="span_Cancel">SUBMIT</span>
                    </div>
                </td>
                <td>
                    <div class="verticallyMiddle onMouseOver divBrowseGradient spanBrowseGradientTextGray" style="width:80px;line-height:30px;"
                       onmouseover="document.getElementById('img_Cancel_AddProject').src='{$TemplateURL}Web/Images/Ver_2_0/BT_x_hover.png';"
                       onmouseout="document.getElementById('img_Cancel_AddProject').src='{$TemplateURL}Web/Images/Ver_2_0/BT_x.png';"
                       onclick="ClientPortal_CloseAddNewProject('divClientPortalOperations_Container','{$ItemID}','{$crmProjectTypeID}');">
                        <img id="img_Cancel_AddProject" src="{$TemplateURL}Web/Images/Ver_2_0/BT_x.png" align="absmiddle" style="padding-left:8px;" class="marginRight5"></img>
                        <span id="span_Cancel">CANCEL</span>
                    </div>
                </td>
            </tr>
        </table>
    </xsl:template>
</xsl:stylesheet>
