<%@ Page Language="C#" MasterPageFile="~/masterpages/modal.master" AutoEventWireup="True" ValidateRequest="false"
    CodeBehind="CampaignManagement.aspx.cs" Inherits="site_HITS_Campaigns_CampaignManagement"
    Culture="auto" UICulture="auto" Theme="eMain" %>

<%@ Register TagPrefix="eSecuritelHITSControls" Namespace="WebSite.Controls" Assembly="WebSite" %>
<%@ Register TagPrefix="cc1" Namespace="eSecuritel.HITS.UI.Components" Assembly="eSecuritel.HITS.UI.Components" %>
<%@ Register Src="~/Controls/Campaigns/Campaign.ascx" TagPrefix="uc2" TagName="Campaign" %>
<%@ Register Src="~/Controls/Campaigns/ModelMapAssociation.ascx" TagPrefix="uc1" TagName="ModelMapAssociation" %>
<%@ Register Src="~/Controls/Campaigns/CampaignDetails.ascx" TagPrefix="uc4" TagName="CampaignDetails" %>
<%@ Register Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="System.Web.UI" TagPrefix="cc2" %>

<%@ Register Src="~/Controls/Campaigns/PaybackSchedule.ascx" TagPrefix="uc3" TagName="PaybackSchedule" %>
<%@ Register Src="~/Controls/Campaigns/CampaignFees.ascx" TagPrefix="uc5" TagName="CampaignFees" %>

<asp:Content ID="mainContent" ContentPlaceHolderID="eContent" runat="Server">
    <style>
        .collapsePanel, .collapsePanel a {
            margin: 0px;
            padding: 5px 10px;
            font-size: 11px;
            text-decoration:none;
            color:#fff;
        }

        .contentCampaignDetails {
            border: solid 1px #808080;
            margin-bottom: 10px;
        }

        .gridContainer {
            margin-top: 10px;
            margin-bottom: 10px;
        }
    </style>
    <asp:Label ID="m_lblSuccessMessage" runat="server" Visible="True" CssClass="successmessage" /><br />
    <ajaxToolkit:TabContainer ID="mainTabContainer" runat="server">
        <ajaxToolkit:TabPanel ID="tabCampaign" runat="server" HeaderText="<%$ Resources: OrganizationManagement, CampaignHeaderLabel %>">
            <ContentTemplate>
                <uc2:Campaign ID="ctlCampaign" runat="server" />
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
        <ajaxToolkit:TabPanel ID="tabCampaignFees" runat="server" HeaderText="<%$ Resources: OrganizationManagement, CampaignModelFeeHeaderLabel %>">
            <ContentTemplate>
                <div style="width: 100%; overflow-y: auto; overflow-x: hidden;" class="contentCampaignDetails">
                    <div class="headerCampaignDetails collapsePanel ">
                        <asp:Label runat="server" ID="Label2" CssClass="collapeCtlText" Text="<%$ Resources: OrganizationManagement, ShowCampaignDetails %>"> </asp:Label>
                        <img src="../../../images/expand_blue.jpg" class="imgCollpsePanel" style="border-width:0px;float:right">
                    </div>
                    <div class="" style="display: none">
                        <uc4:CampaignDetails ID="ctlCampaignDetailsOnFees" runat="server" />
                    </div>
                </div>
                <div style="width: 100%; max-height: 517px; overflow-y: auto; overflow-x: hidden;" id="div1">

                    <div>
                        <uc5:CampaignFees ID="ctlCampaignFees" runat="server" />
                    </div>
                </div>
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
        <ajaxToolkit:TabPanel ID="tabPaybackSchedule" runat="server" HeaderText="<%$ Resources: OrganizationManagement, PaybackScheduleHeaderLabel %>">
            <ContentTemplate>
                <div style="width: 100%; overflow-y: auto; overflow-x: hidden;" class="contentCampaignDetails">
                    <div class="headerCampaignDetails collapsePanel ">
                        <asp:Label runat="server" ID="Label1" CssClass="collapeCtlText" Text="<%$ Resources: OrganizationManagement, ShowCampaignDetails %>"> </asp:Label>
                        <img src="../../../images/expand_blue.jpg" class="imgCollpsePanel" style="border-width:0px;float:right">
                    </div>
                    <div class="" style="display: none">
                        <uc4:CampaignDetails ID="ctlCampaignDetails" runat="server" />
                    </div>
                </div>
                <div style="width: 100%; max-height: 517px; overflow-y: auto; overflow-x: hidden;" id="divPaybackSchedule">

                    <div>
                        <uc3:PaybackSchedule ID="ctlPaybackSchedule" runat="server" />
                    </div>
                </div>
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
        <ajaxToolkit:TabPanel ID="tabModelMapAssociation" runat="server" HeaderText="<%$ Resources: OrganizationManagement, ModelMapAssociationHeaderLabel %>">
            <ContentTemplate>
                <div style="width: 100%; overflow-y: auto; overflow-x: hidden;" class="contentCampaignDetails">
                    <div class="headerCampaignDetails collapsePanel">
                        <asp:Label runat="server" ID="lblShowHideCamDet" CssClass="collapeCtlText" Text="<%$ Resources: OrganizationManagement, ShowCampaignDetails %>"
                            > </asp:Label>
                         <img src="../../../images/expand_blue.jpg" class="imgCollpsePanel" style="border-width:0px;float:right">
                    </div>
                    <div class="" style="display: none">
                        <uc4:CampaignDetails ID="ctlCampaignDetailsForModelMap" runat="server" />
                    </div>
                </div>
                <div style="width: 100%; max-height: 517px; overflow-y: auto; overflow-x: hidden;" id="divModelMapAssociation">

                    <div>
                        <uc1:ModelMapAssociation ID="ctlModelMapAssociation" runat="server" />
                    </div>
                </div>
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
    </ajaxToolkit:TabContainer>
    
    <div>
        <asp:Panel ID="pnlPopupWindow" runat="server">
            <asp:Panel ID="pnlPopupWindowHeader" runat="server" EnableViewState="false" CssClass="modalHeader">
                <table cellpadding="0" cellspacing="0" width="90%" style="margin: 0px;">
                    <tr>
                        <td style="margin: 0px; padding: 2px;">
                            <asp:Label ID="lblHeaderText" runat="server" EnableViewState="false" Text="<%$ Resources:OrganizationManagement, AssignedCampaigns %>" />
                        </td>

                        <td align="right" style="text-align: right; margin: 0px; padding: 2px;">
                            <asp:ImageButton ID="imgCloseTerm" runat="server" Height="18px" CausesValidation="false" ImageUrl="~/images/closeButton.png"
                                ToolTip="<%$ Resources: Default, ToolTipClose %>" Width="18px" CssClass="modalClose" OnClick="imgCloseTerm_OnClick" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="pnlBody" runat="server" CssClass="modalContent">
                <asp:Label ID="lblModelAssignedValidationMessage" runat="server" Visible="True" CssClass="failuremessage assignedCampaignsMessage" 
                    Text="<%$ Resources:OrganizationManagement, AssignedCampaignsValidationError %>" />
                <div class="gridContainer">
                    <cc1:HitsSearchGridView Id="m_gvAssignedCampaigns" runat="server" AllowPaging="false" AutoGenerateColumns="false"
                OnRowDataBound="m_gvAssignedCampaigns_RowDataBound" ShowHeaderWhenEmpty="True" RowStyle-VerticalAlign="Top"  
                    EmptyDataText="<%$ Resources : OrganizationManagement, NoAssignedCampaigns %>" >
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:Literal ID="litGvCampaignsNameHeader" runat="server" Text="<%$ Resources : OrganizationManagement, HeaderTextCampaignName %>"></asp:Literal>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Literal runat="server" ID="litGvCampaignsNameField"></asp:Literal>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:Literal ID="litGvModelNameHeader" runat="server" Text="<%$ Resources : ModelManagement, LabelModelNameColon  %>"></asp:Literal>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Literal runat="server" ID="litGvModelNameField"></asp:Literal>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:Literal ID="litGvCampaignsStartDateHeader" runat="server" Text="<%$ Resources : OrganizationManagement, HeaderEnrollmentStartDate %>"></asp:Literal>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Literal runat="server" ID="litGvCampaignsStartDateField"></asp:Literal>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:Literal ID="litGvCampaignsEndDate" runat="server" Text="<%$ Resources : OrganizationManagement, HeaderEnrollmentEndDate %>"></asp:Literal>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Literal runat="server" ID="litGvCampaignsEndDateField"></asp:Literal>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <RowStyle HorizontalAlign="Left" />
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" />
                </cc1:HitsSearchGridView>
                </div>
                <asp:Button ID="btnHidePopup" runat="server" Text="<%$ Resources: Default, ButtonClose %>" OnClick="btnHidePopup_OnClick"></asp:Button>
            </asp:Panel>
        </asp:Panel>
        <asp:Button runat="server" EnableViewState="false" ID="hiddenTargetControlForModalPopup_New"
            Style="display: none" />
        <esecuritelhitscontrols:hitsmodalpopupextender runat="server" id="modalPopupWindow" targetcontrolid="hiddenTargetControlForModalPopup_New"
            popupcontrolid="pnlPopupWindow" backgroundcssclass="modalBackground"
            popupdraghandlecontrolid="pnlPopupWindowHeader" />
    </div>

    <script>
        $(document).ready(function () {
            $('[id$=mainTabContainer_body]').css('height', '600px');
        });

        var showCampaignDetails = "<%= ShowCampaignDetails %>";
        var hideCampaignDetails = "<%= HideCampaignDetails %>";

        $(".headerCampaignDetails").click(function () {

            $header = $(this);
           
            //getting the next element
            $content = $header.next();
            $content.is(":visible") ? $header.find("img").attr("src", "../../../images/expand_blue.jpg") : $header.find("img").attr("src", "../../../images/collapse_blue.jpg");
            //open up the content needed - toggle the slide- if visible, slide up, if not slidedown.
            $content.slideToggle(500, function () {
                //execute this after slideToggle is done
                //change text of header based on visibility of content div
                $header.find(".collapeCtlText").text(function () {
                    //change text based on condition
                    return $content.is(":visible") ? hideCampaignDetails : showCampaignDetails;
                });
                


            });

        });
    </script>

</asp:Content>


