﻿<?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="TemplateURL" select="normalize-space(AjaxRequest/TemplateURL)"></xsl:variable>
        <xsl:variable name="IsCommunityAdmin" select="normalize-space(AjaxRequest/IsCommunityAdmin)"></xsl:variable>
        <xsl:variable name="PackageLengthID" select="normalize-space(AjaxRequest/CoachServices/CoachServiceNode/PackageLengthID)"></xsl:variable>
        <xsl:variable name="CheckinFrequencyID" select="normalize-space(AjaxRequest/CoachServices/CoachServiceNode/CheckinFrequencyID)"></xsl:variable>
        <xsl:variable name="FocusLimitSizeID" select="normalize-space(AjaxRequest/CoachServices/CoachServiceNode/FocusLimitSizeID)"></xsl:variable>
        <xsl:variable name="PublicYN" select="normalize-space(AjaxRequest/CoachServices/CoachServiceNode/PublicYN)"></xsl:variable>
        <xsl:variable name="ActiveYN" select="normalize-space(AjaxRequest/CoachServices/CoachServiceNode/ActiveYN)"></xsl:variable>
        <xsl:variable name="BrandID" select="normalize-space(AjaxRequest/CoachServices/CoachServiceNode/BrandID)"></xsl:variable>
        <xsl:variable name="PackageID" select="normalize-space(AjaxRequest/CoachServices/CoachServiceNode/PackageID)"></xsl:variable>
        <xsl:variable name="PackageFee" select="normalize-space(AjaxRequest/CoachServices/CoachServiceNode/PackageFee)"></xsl:variable>
        <xsl:variable name="PackageFeeDisplay" select="normalize-space(AjaxRequest/CoachServices/CoachServiceNode/DisplayFeeImage)"></xsl:variable>
        <table class="tableMaster" cellpadding="0" cellspacing="5" border="0">
            <tr>
                <td>
                    <span class="labelSize10">
                        Package Name:
                    </span>
                </td>
            </tr>
            <tr>
                <td>
                    <div style="width:75%;">
                        <input type="text" id="txt_{$PackageID}_PackName" class="text" style="width:100%" maxlength="100"
                               value="{normalize-space(AjaxRequest/CoachServices/CoachServiceNode/Package)}"/>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="labelSize10">
                        Package Description:
                    </span>
                </td>
            </tr>
            <tr>
                <td>
                    <div style="width:75%;">
                        <textarea rows="4" id="txt_{$PackageID}_PackDescription" class="textAreaBox">
                            <xsl:value-of select ="AjaxRequest/CoachServices/CoachServiceNode/Description" disable-output-escaping ="yes"/>
                        </textarea>
                    </div>
                </td>
            </tr>
            <xsl:choose>
                <xsl:when test="$PackageFeeDisplay = 'Yes'">
                    <tr>
                        <td>
                            <span class="labelSize10">
                                Package Amount:&#xa0;$<xsl:value-of select ="$PackageFee"/>
                                <input type="hidden" id="txt_{$PackageID}_PackAmount" value="{$PackageFee}"/>
                            </span>
                        </td>
                    </tr>
                </xsl:when>
                <xsl:otherwise>
                    <tr>
                        <td>
                            <span class="labelSize10">
                                Package Amount:
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div style="width:75%;">
                                <input type="text" id="txt_{$PackageID}_PackAmount" class="text" style="width:100%" maxlength="6"
                                       value="{$PackageFee}"/>
                            </div>
                        </td>
                    </tr>
                </xsl:otherwise>
            </xsl:choose>
            <tr>
                <td>
                    <xsl:choose>
                        <xsl:when test ="AjaxRequest/CoachServices/CoachServiceNode/PackageLengthYN != 0">
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_Service" checked="checked"
                                   onClick='coachServices_checkUncheckCheckBox("ddl_{$PackageID}_Services", "chb_{$PackageID}_Service");'/>
                            <span class="labelSize10">
                                This Package Covers &#xa0;
                                <xsl:choose>
                                    <xsl:when test ="$PackageLengthID &gt; -1">
                                        <select class="smallDropdown" id="ddl_{$PackageID}_Services"
                                                onChange='coachServices_checkUncheckDropDown("ddl_{$PackageID}_Services", "chb_{$PackageID}_Service");'>
                                            <option value="-1">Choose...</option>
                                            <xsl:for-each select ="AjaxRequest/PackageServices/PackageServicesID">
                                                <xsl:choose>
                                                    <xsl:when test ="ID = $PackageLengthID">
                                                        <option value="{ID/.}" selected="selected">
                                                            <xsl:value-of select ="normalize-space(Name/.)"/>
                                                        </option>
                                                    </xsl:when>
                                                    <xsl:otherwise>
                                                        <option value="{ID/.}">
                                                            <xsl:value-of select ="normalize-space(Name/.)"/>
                                                        </option>
                                                    </xsl:otherwise>
                                                </xsl:choose>
                                            </xsl:for-each>
                                        </select>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <select class="smallDropdown" id="ddl_{$PackageID}_Services"
                                                onChange='coachServices_checkUncheckDropDown("ddl_{$PackageID}_Services", "chb_{$PackageID}_Service");'>
                                            <option value="-1" selected="selected">Choose...</option>
                                            <xsl:for-each select ="AjaxRequest/PackageServices/PackageServicesID">
                                                <option value="{ID/.}">
                                                    <xsl:value-of select ="normalize-space(Name/.)"/>
                                                </option>
                                            </xsl:for-each>
                                        </select>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </span>
                        </xsl:when>
                        <xsl:otherwise>
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_Service"
                                   onClick='coachServices_checkUncheckCheckBox("ddl_{$PackageID}_Services", "chb_{$PackageID}_Service");'/>
                            <span class="labelSize10">
                                This Package Covers &#xa0;
                                <select class="smallDropdown" id="ddl_{$PackageID}_Services"
                                        onChange='coachServices_checkUncheckDropDown("ddl_{$PackageID}_Services", "chb_{$PackageID}_Service");'>
                                    <option value="-1" selected="selected">Choose...</option>
                                    <xsl:for-each select ="AjaxRequest/PackageServices/PackageServicesID">
                                        <option value="{ID/.}">
                                            <xsl:value-of select ="normalize-space(Name/.)"/>
                                        </option>
                                    </xsl:for-each>
                                </select>
                            </span>
                        </xsl:otherwise>
                    </xsl:choose>
                </td>
            </tr>
            <tr>
                <td>
                    <xsl:choose>
                        <xsl:when test ="AjaxRequest/CoachServices/CoachServiceNode/KickoffCallYN != 0">
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_CallMins" checked="checked"
                          onClick='coachServices_setTextBoxValue("txt_{$PackageID}_CallMins","chb_{$PackageID}_CallMins");'/>
                            <span class="labelSize10">
                                Includes Coaching Call up to&#xa0;
                                <input type="text" class="text" style="width:5%"
                                       value ="{normalize-space(AjaxRequest/CoachServices/CoachServiceNode/PackageCall)}"
                                       maxlength="3" id="txt_{$PackageID}_CallMins"
                                       onBlur='coachServices_setCheckBoxValue("txt_{$PackageID}_CallMins","chb_{$PackageID}_CallMins");'/>&#xa0;Minutes
                            </span>
                        </xsl:when>
                        <xsl:otherwise>
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_CallMins"
                          onClick='coachServices_setTextBoxValue("txt_{$PackageID}_CallMins","chb_{$PackageID}_CallMins");'/>
                            <span class="labelSize10">
                                Includes Coaching Call up to&#xa0;
                                <input type="text" class="text" style="width:5%"
                                       value ="0"
                                       maxlength="3" id="txt_{$PackageID}_CallMins"
                                       onBlur='coachServices_setCheckBoxValue("txt_{$PackageID}_CallMins","chb_{$PackageID}_CallMins");'/>&#xa0;Minutes
                            </span>
                        </xsl:otherwise>
                    </xsl:choose>
                </td>
            </tr>
            <tr>
                <td>
                    <xsl:choose>
                        <xsl:when test ="AjaxRequest/CoachServices/CoachServiceNode/UseLifeSpaceYN != 0">
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_AccTrack" checked="checked"/>
                            <span class="labelSize10">Includes Accountability Tracking Using LifeSpace Goals and Templates</span>
                        </xsl:when>
                        <xsl:otherwise>
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_AccTrack"/>
                            <span class="labelSize10">Includes Accountability Tracking Using LifeSpace Goals and Templates</span>
                        </xsl:otherwise>
                    </xsl:choose>
                </td>
            </tr>
            <tr>
                <td>
                    <xsl:choose>
                        <xsl:when test ="AjaxRequest/CoachServices/CoachServiceNode/CheckinsYN != 0">
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_CheckCalls" checked="checked"
                                   onClick='coachServices_checkUncheckCheckBox("ddl_{$PackageID}_Calls", "chb_{$PackageID}_CheckCalls");'/>
                            <span class="labelSize10">
                                Additional&#xa0;
                                <xsl:choose>
                                    <xsl:when test ="$CheckinFrequencyID &gt; -1">
                                        <select class="smallDropdown" id="ddl_{$PackageID}_Calls"
                                                onChange='coachServices_checkUncheckDropDown("ddl_{$PackageID}_Calls", "chb_{$PackageID}_CheckCalls");'>
                                            <option value="-1">Choose...</option>
                                            <xsl:for-each select ="AjaxRequest/CheckInCalls/CheckInCallsID">
                                                <xsl:choose>
                                                    <xsl:when test ="ID = $CheckinFrequencyID">
                                                        <option value="{ID/.}" selected="selected">
                                                            <xsl:value-of select ="normalize-space(Name/.)"/>
                                                        </option>
                                                    </xsl:when>
                                                    <xsl:otherwise>
                                                        <option value="{ID/.}">
                                                            <xsl:value-of select ="normalize-space(Name/.)"/>
                                                        </option>
                                                    </xsl:otherwise>
                                                </xsl:choose>
                                            </xsl:for-each>
                                        </select>&#xa0;
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <select class="smallDropdown" id="ddl_{$PackageID}_Calls"
                                                onChange='coachServices_checkUncheckDropDown("ddl_{$PackageID}_Calls", "chb_{$PackageID}_CheckCalls");'>
                                            <option value="-1" selected="selected">Choose...</option>
                                            <xsl:for-each select ="AjaxRequest/CheckInCalls/CheckInCallsID">
                                                <option value="{ID/.}">
                                                    <xsl:value-of select ="normalize-space(Name/.)"/>
                                                </option>
                                            </xsl:for-each>
                                        </select>&#xa0;
                                    </xsl:otherwise>
                                </xsl:choose>Coaching Calls
                            </span>
                        </xsl:when>
                        <xsl:otherwise>
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_CheckCalls"
                                   onClick='coachServices_checkUncheckCheckBox("ddl_{$PackageID}_Calls", "chb_{$PackageID}_CheckCalls");'/>
                            <span class="labelSize10">
                                Additional&#xa0;
                                <select class="smallDropdown" id="ddl_{$PackageID}_Calls"
                                        onChange='coachServices_checkUncheckDropDown("ddl_{$PackageID}_Calls", "chb_{$PackageID}_CheckCalls");'>
                                    <option value="-1" selected="selected">Choose...</option>
                                    <xsl:for-each select ="AjaxRequest/CheckInCalls/CheckInCallsID">
                                        <option value="{ID/.}">
                                            <xsl:value-of select ="normalize-space(Name/.)"/>
                                        </option>
                                    </xsl:for-each>
                                </select>&#xa0;Coaching Calls
                            </span>
                        </xsl:otherwise>
                    </xsl:choose>
                </td>
            </tr>
            <tr>
                <td>
                    <xsl:choose>
                        <xsl:when test ="AjaxRequest/CoachServices/CoachServiceNode/EmailSupportYN != 0">
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_EMail" checked="checked"/>
                            <span class="labelSize10">E-Mail Support Via LifeSpace Discussions</span>
                        </xsl:when>
                        <xsl:otherwise>
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_EMail"/>
                            <span class="labelSize10">E-Mail Support Via LifeSpace Discussions</span>
                        </xsl:otherwise>
                    </xsl:choose>
                </td>
            </tr>
            <tr>
                <td>
                    <xsl:choose>
                        <xsl:when test ="AjaxRequest/CoachServices/CoachServiceNode/FocusLimitYN != 0">
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_Focus" checked="checked"
                           onClick='coachServices_checkUncheckCheckBox("ddl_{$PackageID}_Focus", "chb_{$PackageID}_Focus");'/>
                            <span class="labelSize10">
                                We Will Focus on&#xa0;
                                <xsl:choose>
                                    <xsl:when test ="$FocusLimitSizeID &gt; -1">
                                        <select class="smallDropdown" id="ddl_{$PackageID}_Focus"
                                                onChange='coachServices_checkUncheckDropDown("ddl_{$PackageID}_Calls", "chb_{$PackageID}_CheckCalls");'>
                                            <option value="-1" >Choose...</option>
                                            <xsl:for-each select ="AjaxRequest/GoalFocus/GoalFocusID">
                                                <xsl:choose>
                                                    <xsl:when test ="ID = $FocusLimitSizeID">
                                                        <option value="{ID/.}" selected="selected">
                                                            <xsl:value-of select ="normalize-space(Name/.)"/>
                                                        </option>
                                                    </xsl:when>
                                                    <xsl:otherwise>
                                                        <option value="{ID/.}">
                                                            <xsl:value-of select ="normalize-space(Name/.)"/>
                                                        </option>
                                                    </xsl:otherwise>
                                                </xsl:choose>
                                            </xsl:for-each>
                                        </select>&#xa0;
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <select class="smallDropdown" id="ddl_{$PackageID}_Focus"
                                     onChange='coachServices_checkUncheckDropDown("ddl_{$PackageID}_Focus", "chb_{$PackageID}_Focus");'>
                                            <option value="-1" selected="selected">Choose...</option>
                                            <xsl:for-each select ="AjaxRequest/GoalFocus/GoalFocusID">
                                                <option value="{ID/.}">
                                                    <xsl:value-of select ="normalize-space(Name/.)"/>
                                                </option>
                                            </xsl:for-each>
                                        </select>&#xa0;
                                    </xsl:otherwise>
                                </xsl:choose>
                            </span>
                        </xsl:when>
                        <xsl:otherwise>
                            <input type="checkbox" class="labelSize10" id="chb_{$PackageID}_Focus"
                           onClick='coachServices_checkUncheckCheckBox("ddl_{$PackageID}_Focus", "chb_{$PackageID}_Focus");'/>
                            <span class="labelSize10">
                                We Will Focus on&#xa0;
                                <select class="smallDropdown" id="ddl_{$PackageID}_Focus"
                                      onChange='coachServices_checkUncheckDropDown("ddl_{$PackageID}_Focus", "chb_{$PackageID}_Focus");'>
                                    <option value="-1" selected="selected">Choose...</option>
                                    <xsl:for-each select ="AjaxRequest/GoalFocus/GoalFocusID">
                                        <option value="{ID/.}">
                                            <xsl:value-of select ="normalize-space(Name/.)"/>
                                        </option>
                                    </xsl:for-each>
                                </select>&#xa0;
                            </span>
                        </xsl:otherwise>
                    </xsl:choose>
                </td>
            </tr>
            <tr>
                <td>
                    <xsl:choose>
                        <xsl:when test ="AjaxRequest/CoachServices/CoachServiceNode/lsHelpYN != 0">
                            <input type="checkbox" class="labelSize10" style="margin-top:20px;"
                                   checked="checked" id="chb_{$PackageID}_Assistance"/>
                            <span class="labelSize11">
                                I need assistance. Have a LifeSpace account representative contact me
                            </span>
                        </xsl:when>
                        <xsl:otherwise>
                            <input type="checkbox" class="labelSize10" style="margin-top:20px;" id="chb_{$PackageID}_Assistance"/>
                            <span class="labelSize11">
                                I need assistance. Have a LifeSpace account representative contact me
                            </span>
                        </xsl:otherwise>
                    </xsl:choose>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="labelSize10">
                        Active:
                    </span>
                </td>
            </tr>
            <tr>
                <td>
                    <div style="width:75%;">
                        <select class="smallDropdown" id="ddl_{$PackageID}_Active">
                            <xsl:choose>
                                <xsl:when test ="$ActiveYN = 0">
                                    <option value="-1">Choose...</option>
                                    <option value="1">Yes</option>
                                    <option value="0" selected="selected">No</option>
                                </xsl:when>
                                <xsl:when test ="$ActiveYN = 1">
                                    <option value="-1">Choose...</option>
                                    <option value="1" selected="selected">Yes</option>
                                    <option value="0">No</option>
                                </xsl:when>
                                <xsl:otherwise>
                                    <option value="-1" selected="selected">Choose...</option>
                                    <option value="1">Yes</option>
                                    <option value="0">No</option>
                                </xsl:otherwise>
                            </xsl:choose>
                        </select>&#xa0;
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="labelSize10">
                        Public:
                    </span>
                </td>
            </tr>
            <tr>
                <td>
                    <div style="width:75%;">
                        <select class="smallDropdown" id="ddl_{$PackageID}_Public">
                            <xsl:choose>
                                <xsl:when test ="$PublicYN = 0">
                                    <option value="-1">Choose...</option>
                                    <option value="1">Yes</option>
                                    <option value="0" selected="selected">No</option>
                                </xsl:when>
                                <xsl:when test ="$PublicYN = 1">
                                    <option value="-1">Choose...</option>
                                    <option value="1" selected="selected">Yes</option>
                                    <option value="0">No</option>
                                </xsl:when>
                                <xsl:otherwise>
                                    <option value="-1" selected="selected">Choose...</option>
                                    <option value="1">Yes</option>
                                    <option value="0">No</option>
                                </xsl:otherwise>
                            </xsl:choose>
                        </select>&#xa0;
                    </div>
                </td>
            </tr>
            <xsl:choose>
                <xsl:when test ="$IsCommunityAdmin = 'True'">
                    <tr>
                        <td>
                            <span class="labelSize10">
                                Buy Button Override:
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div style="width:75%;">
                                <textarea rows="4" id="txt_{$PackageID}_PayPalHTML" class="textAreaBox">
                                    <xsl:value-of select ="AjaxRequest/CoachServices/CoachServiceNode/PayPalHTML" disable-output-escaping ="yes"/>
                                </textarea>
                            </div>
                        </td>
                    </tr>
                </xsl:when>
                <xsl:otherwise>
                    <tr>
                        <td>
                            <textarea id="txt_{$PackageID}_PayPalHTML" style="display:none;">
                                <xsl:value-of select ="AjaxRequest/CoachServices/CoachServiceNode/PayPalHTML" disable-output-escaping ="yes"/>
                            </textarea>
                        </td>
                    </tr>
                </xsl:otherwise>
            </xsl:choose>
            <tr>
                <td>
                    <input type="button" class="button" value="Update Package" style="margin-top:10px;" id="btn_{$PackageID}_UpdatePackage"
                           onClick='coachWizard_UpdateServices("{$BrandID}","txt_{$PackageID}_PackName","txt_{$PackageID}_PackDescription","txt_{$PackageID}_PackAmount"
                               ,"chb_{$PackageID}_Service","ddl_{$PackageID}_Services","chb_{$PackageID}_CallMins","chb_{$PackageID}_AccTrack",
                                "chb_{$PackageID}_CheckCalls","ddl_{$PackageID}_Calls","chb_{$PackageID}_EMail",
                               "chb_{$PackageID}_Focus","ddl_{$PackageID}_Focus","chb_{$PackageID}_Assistance","txt_{$PackageID}_CallMins",
                               "div_{$BrandID}_Display_Services", "ddl_{$PackageID}_Active", "ddl_{$PackageID}_Public","{$PackageID}","txt_{$PackageID}_PayPalHTML");'></input>
                    
                    <input type="button" class="button" value="Cancel" 
                           onClick="toggleDivDisplay('div_{$PackageID}_Coach_Package', 'div_{$PackageID}_Coach_Package_Update');"></input>
                </td>                                 
               
            </tr>
        </table>
    </xsl:template>
</xsl:stylesheet>
