<%@ Page Language="C#" MasterPageFile="~/masterpages/eDashboard.master" AutoEventWireup="True" ValidateRequest="false"  
    CodeBehind="Default.aspx.cs" Inherits="site_HITS_Campaigns_Default" Title="Brightstar Device Protection: Campaigns"
    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/ClientCarrierDropDowns.ascx" tagname="ClientCarrierDropDowns" tagprefix="uc1" %>
<%@ Register Src="~/Controls/DefaultHeader.ascx" TagName="DefaultHeader" TagPrefix="uc" %>

<asp:Content ID="mainContent" ContentPlaceHolderID="eContent" runat="Server">         
    <style>
        #content select.dropDownList {
            width: 219px;
            display: inline-block;
            margin-bottom: 20px;
            margin-top: 2px;
        }

        .labelForDropDownList {
            width: 108px;
            display: inline-block;
            padding-left: 2px;
            text-align: right;
        }

        .formControl {
            display: block;
            margin-bottom: 20px;
        }

        .padding-20 {
            padding: 20px;
        }

        #searchPanel {
            background-color: #DBDCDE;
        }

        #title {
            border-bottom: 1px solid #e99f1a;
            margin-bottom: 5px;
        }
        
        #m_btnCreate {
            margin-top: 25px;
        }

        #content a.linkDisabled {
            color: #8e8e8e;
        }

        ul.pagenav li>a:hover {
            cursor: pointer;
        }

    </style>
    
    <h1 id="title">Campaigns</h1>
    
    <uc:DefaultHeader ID="DefaultHeader1" runat="server" />

    <div id="searchPanel" class="padding-20">
            <asp:UpdatePanel ID="searchUpdatePanel" runat="server" >
            <ContentTemplate>
                <uc1:ClientCarrierDropDowns ID="m_ucClientCarrierDropDownList" ShowSelectEntry="true"
                runat="server" DropDownWidth="219" LabelWidth="108" DefaultCarrierText="<%$ Resources: Default, HeaderListItemAll %>"/>
            </ContentTemplate>
        </asp:UpdatePanel>
        
        <div>            
            <asp:Label class="labelForDropDownList" Text="<%$ Resources: OrganizationManagement, CampaignStatusLabel %>" runat="server"></asp:Label>
            <asp:DropDownList runat="server" ID="m_ddlCampaignStatuses" CssClass="dropDownList" />
        </div>
    
        <asp:CheckBox runat="server" ID="m_cbShowActive" CssClass="formControl" Text="<%$ Resources: OrganizationManagement, ActiveFeatureCampaignsLabel %>" Checked="true"/>
    
        <asp:Button runat="server" ID="m_btnSearch" CssClass="formControl" value="Search" Text="<%$ Resources: OrganizationManagement, SearchLabel %>" OnClick="m_btnSearch_Click"/>
    </div>

    <asp:Panel ID="m_pnlCampaignsGrid" runat="server" CssClass="padding-20">
    <h3>
        <asp:Literal ID="m_litResults" runat="server" Text="<%$ Resources: ClaimsManagement, ResultsLabel %>" Visible="False" />
    </h3>
    <asp:Label ID="m_lblSuccessMessage" runat="server" Visible="True" CssClass="successmessage"/><br />
        <div style="width: 100%; overflow: auto">
            <cc1:HitsSearchGridView ID="m_gvCampaigns" runat="server" ShowHeaderWhenEmpty="True"
                AutoGenerateColumns="False" ScrollBars="Horizontal"
                AllowPaging="False" OnRowDataBound="m_gvCampaigns_RowDataBound"
                OnMenuItemCommand="m_gvCampaigns_OnMenuItemCommand"
                ShowMenu="False" ShowSelectField="False" ShowSetStatus="False" ShowExportCSVWithSummary="False"
                ShowExportXMLWithSummary="False" ShowActivateMenu="False" ShowDeActivateMenu="False"
                ShowEmailMenu="False" ShowHotlineMenu="False" ShowDeHotlineMenu="False" AtlasScriptManagerID=""
                ClientFunctionActivateSelected="" ClientFunctionDeActivateSelected="" ClientFunctionDeHotline=""
                ClientFunctionDelete="" ClientFunctionEmailSelected="" ClientFunctionExportSelected=""
                ClientFunctionHotline="" ClientFunctionSetStatus="" 
                CssClassCustomPaging="" CssClassMenu="" PropagateActionToChildID="" ShowDeleteMenu="False"
                ShowDeSelectMenu="False" ShowExportCSV="False" ShowExportMenu="False" ShowExportXML="False"
                ShowPrintMenu="False" ShowSelectMenu="False" ShowUnfulfill="False" ShowReship="False"
                Width="100%" AllowToExportAll="False" ClientFunctionDeSelectAllClicked="" 
                ClientFunctionExecute="" ClientFunctionGenerateSelected="" ClientFunctionNew="" 
                ClientFunctionReshipReplacement="" ClientFunctionSelectAllClicked="" 
                ClientFunctionUnfulfill="" ClientFunctionValidate="" ShowExecuteMenu="False" 
                ShowExportXLS="False" ShowGenerate="False" ShowNewMenu="False" 
                ShowSelectMenuChk="False" ShowValidateMenu="False" 
                ShowVerifyModelMapMenu="False" >  
                <Columns>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <asp:Literal runat="server" ID="m_litCampaignNameHeader" Text="<%$ Resources: OrganizationManagement, HeaderTextCampaignName %>"></asp:Literal>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Literal runat="server" ID="m_litCampaignName"></asp:Literal>
                        </ItemTemplate>
                    </asp:TemplateField> 
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <asp:Literal runat="server" ID="m_litStartDateHeader" Text="<%$ Resources: OrganizationManagement, HeaderEnrollmentStartDate %>"></asp:Literal>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Literal runat="server" ID="m_litStartDate"></asp:Literal>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <asp:Literal runat="server" ID="m_litEndDateHeader" Text="<%$ Resources: OrganizationManagement, HeaderEnrollmentEndDate %>"></asp:Literal>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Literal runat="server" ID="m_litEndDate"></asp:Literal>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <asp:Literal runat="server" ID="m_litStatusHeader" Text="<%$ Resources: Default, HeaderTextStatus %>"></asp:Literal>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Literal runat="server" ID="m_litStatus"></asp:Literal>
                        </ItemTemplate>
                    </asp:TemplateField>  
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <asp:Literal runat="server" ID="m_litEditHeader" Text="<%$ Resources: Default, HyperLinkEdit %>"></asp:Literal>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:LinkButton runat="server" ID="m_lbEdit" CssClass="popupButton"  Text="<%$ Resources: Default, HyperLinkEdit %>"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField> 
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <asp:Literal runat="server" ID="m_litLockUnlock" Text="<%$ Resources: OrganizationManagement, HeaderLockUnlock %>"></asp:Literal>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:LinkButton runat="server" ID="m_lbLockUnlock" Text="<%$ Resources: OrganizationManagement, HyperLinkLock %>" OnClick="m_lbLockUnlock_OnClick"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>          
                </Columns>
                <PagerSettings Mode="NumericFirstLast" />
                <RowStyle HorizontalAlign="Left" />
                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" />            
                </cc1:HitsSearchGridView>
        </div>
    </asp:Panel>
 
    <script type="text/javascript">

        function ConfirmLock() {
            return confirm("<%= MessageConfirmLock %>");
        }

        function ConfirmUnLock() {
            return confirm("<%= MessageConfirmUnlock %>");
        }

        $(document).ready(function () {

            $(".popupButton").click(function (e) {

                var element = $(this);

                e.preventDefault();

                var modalUrl = element.attr("modal-url");

                $.colorbox({
                    iframe: true, href: modalUrl, title: "<%= Resources.OrganizationManagement.LabelCampaignManagement %>", width: "800px", height: "610px", retinaImage: true, retinaUrl: true, overlayClose: false, fastIframe: false, scrolling: false
                });

            });

            $('[id$=m_hlCreate]').click(function (e) {
                e.preventDefault();

                var modalUrl = "<%= ManagementPageBaseUrl %>?campaignId=0";

                $.colorbox({
                    iframe: true, href: modalUrl, title: "<%= Resources.OrganizationManagement.LabelCampaignManagement %>", width: "800px", height: "610px", retinaImage: true, retinaUrl: true, overlayClose: false, fastIframe: false, scrolling: false
                });

            });

        });

        function refreshSearch()
        {
            $("#ctl00_eContent_m_btnSearch").click();
        }

    </script>

</asp:Content>
