﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:import href="AddBrandScheduleProfile.xslt"/>

    <xsl:template match="/">
        <xsl:variable name="BrandID" select="normalize-space(BrandSchedule/BrandID)"></xsl:variable>
        <xsl:variable name="TimeStamp" select="normalize-space(BrandSchedule/TimeStamp)"></xsl:variable>
        <xsl:variable name="IsCommunityAdmin" select="normalize-space(BrandSchedule/IsCommunityAdmin)"></xsl:variable>
       

        <div style="padding-left:10px;padding-right:10px;padding-top:2px;padding-bottom:2px; background-color:White;">
            <div id="divBrandProfile_Schedule">
                <xsl:choose>
                    <xsl:when test="$BrandID = -1">
                        <xsl:if test ="BrandSchedule/PermissionID &gt;= 4 or BrandSchedule/UserRoles/Role[RoleName = 'Brand Admin']">
                            <div id="divAddBrandProfile_AddBrandSchedule" style="width:100%;display:block;">
                                <input type="button" value="Add Schedule Item" class="button"
                                       onclick="Brand_SectionEdit('divAddBrandProfile_AddBrandSchedule','divBrandProfileOperations');"></input>
                            </div>
                        </xsl:if>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:call-template name="AddBrandScheduleProfile">
                            <xsl:with-param name="Title" select="normalize-space(BrandSchedule/SectionTitle)"></xsl:with-param>
                            <xsl:with-param name="SectionHTML" select="normalize-space(BrandSchedule/SectionHTML)"></xsl:with-param>
                            <xsl:with-param name="SectionSummary" select="normalize-space(BrandSchedule/SectionSummary)"></xsl:with-param>

                            <xsl:with-param name="BrandID" select="normalize-space(BrandSchedule/BrandID)"></xsl:with-param>
                            <xsl:with-param name="BrandTabID" select="normalize-space(BrandSchedule/BrandTabID)"></xsl:with-param>
                        </xsl:call-template>
                    </xsl:otherwise>
                </xsl:choose>
            </div>
            <div id="divBrandProfileOperations" class="divEdit">
                <xsl:choose>
                    <xsl:when test="$BrandID = -1">
                        <div>
                            <table class="tableMaster">
                                <tr>
                                    <td colspan="2" style="text-align:right">
                                        <span onclick="CloseWindow('divBrandProfileOperations'); closeBrandEditMode();" class="labelHeader link" style="color: Black">
                                            [X]
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:15%">
                                        <span class="labelSize10">
                                            Title:
                                        </span>
                                    </td>
                                    <td style="width:85%">
                                        <input type="text" id="txtTitle" style="width:100%;" class="text" maxlength="50"></input>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:15%">
                                        <span class="labelSize10" >
                                            Section HTML:
                                        </span>
                                    </td>
                                    <td style="width:85%">
                                        <textarea rows="10" id="txtSectionHTML_{$TimeStamp}" style="width:100%; height:350px;" class="textAreaBox mceEditor">
                                        </textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:15%">
                                        <span class="labelSize10" >
                                            Summary:
                                        </span>
                                    </td>
                                    <td style="width:85%">
                                        <textarea rows="4" id="txtSummary" style="width:100%;" class="textAreaBox">
                                        </textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td style="padding-top: 10px; padding-bottom: 10px;">
                                        <input type="button" value="Save" class="button" onclick="BrandSchedule_addBrandProfile({BrandSchedule/ActualBrandID}, 5, 1, 1,'Schedule' , 'txtTitle', 'txtSectionHTML_{$TimeStamp}', 'txtSummary', 'divBrandProfile_Schedule');"/>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </xsl:when>
                    <xsl:otherwise>
                    </xsl:otherwise>
                </xsl:choose>
            </div>
        </div>
    </xsl:template>
</xsl:stylesheet>
