<%@ page title="" language="VB" autoeventwireup="false" masterpagefile="~/Template/Master.master" inherits="RCC_MailChimp, MachSol.MachPanel.Web" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="EM" %>
<%@ Register Assembly="MachSol.MachPanel.Utility" Namespace="MachSol.MachPanel.Utility"
    TagPrefix="EM" %>
<%@ Register Src="~/Template/GVPager.ascx" TagName="Pager" TagPrefix="EM" %>
<%@ Register Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI" TagPrefix="cc1" %>

<asp:Content ID="Content4" ContentPlaceHolderID="CPH_Content" runat="Server">
    <asp:PlaceHolder ID="PH" runat="server"></asp:PlaceHolder>
    <div class="col-xs-12">
        <div class="card">
            <div class="body">

                <EM:TabContainer ID="TbCntr_MailChimp" runat="server" OnClientActiveTabChanged="loadTabPanel">

                    <EM:TabPanel ID="Tab_MailChimpSetting" runat="server" HeaderText="<%$Resources:Content,MailChimpSetting%>">
                        <ContentTemplate>
                            <asp:Button ID="Btn_Tab0" runat="server" Style="display: none;" />
                            <asp:Panel ID="Pnl_TabContent0" Visible="true" runat="server">
                                <div class="card">
                                    <div class="body">
                                        <div class="row">
                                            <div class="col-sm-3 col-xs-12 row-label">
                                                <asp:Literal ID="Literal8" runat="server" Text="<%$Resources:Content,GN000195%>" EnableViewState="false"></asp:Literal>:
                                            </div>
                                            <div class="col-sm-4 col-xs-12">
                                                <asp:CheckBox ID="ChkBx_MailChimpEnabled" runat="server" Text=" " Checked="false" />
                                            </div>
                                        </div>

                                        <div id="Div_enabledMailChimp" runat="server" style="display: none;">
                                            <div class="row" id="Div_AllowedForResellerInterface" runat="server" visible="false">
                                                <div class="col-sm-3 col-xs-12 row-label">
                                                    <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Content,AllowedForResellerInterface%>" EnableViewState="false"></asp:Literal>:
                                                </div>
                                                <div class="col-sm-4 col-xs-12">
                                                    <asp:CheckBox ID="ChBx_AllowedForResellerInterface" runat="server" Text=" " Checked="false" />
                                                </div>
                                            </div>

                                            <div class="row">
                                                <div class="col-sm-3 col-xs-12 row-label">
                                                    <label>
                                                        *<asp:Literal ID="Literal12" runat="server" Text='<%$ Resources:Content,APIUrl%>'></asp:Literal>:</label>
                                                </div>
                                                <div class="col-sm-4 col-xs-12">
                                                    <div class="form-group">
                                                        <div class="form-line">
                                                            <asp:TextBox ID="TxBx_MailChimpAPIUrl" runat="server" MaxLength="250"></asp:TextBox>
                                                            <asp:RequiredFieldValidator ID="RFV_TxBx_MailChimpAPIUrl" runat="server" ControlToValidate="TxBx_MailChimpAPIUrl"
                                                                Display="None" SetFocusOnError="True" ValidationGroup="mailchimp"></asp:RequiredFieldValidator>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-sm-3 col-xs-12 row-label">
                                                    <label>
                                                        *<asp:Literal ID="Literal14" runat="server" Text='<%$ Resources:Content,APIKey%>'></asp:Literal>:</label>
                                                </div>
                                                <div class="col-sm-4 col-xs-12">
                                                    <div class="form-group">
                                                        <div class="form-line">
                                                            <asp:TextBox ID="TxBx_MailChimpAPIKey" runat="server" MaxLength="250"></asp:TextBox>
                                                            <asp:RequiredFieldValidator ID="RFV_MailChimpAPIKey" runat="server" ControlToValidate="TxBx_MailChimpAPIKey"
                                                                Display="None" SetFocusOnError="True" ValidationGroup="mailchimp"></asp:RequiredFieldValidator>
                                                        </div>
                                                    </div>
                                                    <label class="small">
                                                        <%= Resources.Content.MailChimpAPIKeyHint %>
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-xs-12">
                                                <asp:Button ID="Btn_SaveMailChimpSetting" runat="server" class="btn btn-primary waves-effect btnAction"
                                                    Text='<%$ Resources:Content,GN0000281%>' ValidationGroup="mailchimp" CausesValidation="true" />
                                            </div>
                                        </div>
                                    </div>
                            </asp:Panel>
                        </ContentTemplate>
                    </EM:TabPanel>

                    <EM:TabPanel ID="Tab_MailChimpListing" runat="server" Enabled="false" HeaderText="<%$ Resources:Content,MailChimpListing %>">
                        <ContentTemplate>
                            <asp:Button ID="Btn_Tab1" runat="server" Style="display: none;" />
                            <asp:Panel ID="Pnl_TabContent1" Visible="false" runat="server">
                                <div class="card">
                                    <div class="body">
                                        <%--   1.	Display MailChimp Lists listing:
                                                        a.	Name, Subscribers, Opens, Lists, Rating, [Alias], List Used for DDL
                                                        i.	Alias is a textbox to give list an alias.
                                                        b.	The lists will be fetched using MailChimp using API, Alias will be fetched from our db.
                                                        c.	Used for: Reseller, Customer, Both, None.
                                                        i.	Default: Both.
                                                        2.	[Save]
                                                        a.	On save, MailChimpId, the aliases and used for will be saved/updated in our database.
                                                        b.	CompanyId, MailChimpId, Alias, UsedFor--%>

                                        <asp:GridView CssClass="table table-bordered table-striped table-hover"
                                            EmptyDataText="<%$ Resources:Content, GN00001375 %>"
                                            ID="GV_MailChimp" AllowPaging="false" AllowSorting="true" runat="server" AutoGenerateColumns="False"
                                            DataKeyNames="">
                                            <Columns>
                                                <asp:TemplateField SortExpression="ListName" HeaderStyle-CssClass="col-xs-3" HeaderText='<%$ Resources:Content, Name %>'>
                                                    <ItemTemplate>
                                                        <asp:HiddenField ID="HF_ListName" runat="server" />
                                                        <asp:HiddenField ID="HF_ListId" runat="server" />
                                                        <asp:LinkButton ID="LB_Name" runat="server" CommandName="Detail"></asp:LinkButton>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-CssClass="col-xs-2" HeaderText="<%$ Resources:Content, strSubscribers %>">
                                                    <ItemTemplate>
                                                        <asp:Label ID="Lbl_Subscribers" runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-CssClass="col-xs-1" HeaderText="<%$ Resources:Content, Opens %>">
                                                    <ItemTemplate>
                                                        <asp:Label ID="Lbl_Opens" runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>

                                                <asp:TemplateField HeaderStyle-CssClass="col-xs-1" HeaderText="<%$ Resources:Content, Clicks %>">
                                                    <ItemTemplate>
                                                        <asp:Label ID="Lbl_Clicks" runat="server" />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-CssClass="col-xs-3" HeaderText="<%$ Resources:Content, Alias%>">
                                                    <ItemTemplate>
                                                        <div class="col-xs-12">
                                                            <div class="form-group form-float">
                                                                <div class="form-line">
                                                                    <asp:TextBox ID="TxBx_Alias" runat="server"></asp:TextBox>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-CssClass="col-xs-2" HeaderText="<%$ Resources:Content, UsedFor%>">
                                                    <ItemTemplate>
                                                        <div class="col-xs-12" runat="server" id="div_Owner_search">
                                                            <div class="form-group form-float">
                                                                <asp:DropDownList ID="DDl_UsedFor" runat="server"></asp:DropDownList>
                                                            </div>
                                                        </div>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                            <%--PagerTemplate Start--%>
                                            <PagerTemplate>
                                                <EM:Pager ID="Pager1" runat="server" />
                                            </PagerTemplate>
                                            <%--PagerTemplate End--%>
                                        </asp:GridView>
                                        <br />
                                        <div class="row">
                                            <div class="col-xs-12">
                                                <asp:Button ID="Btn_SaveMailChimp" runat="server" class="btn btn-primary waves-effect btnAction"
                                                    Text='<%$ Resources:Content,GN0000281%>' />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </asp:Panel>
                        </ContentTemplate>

                    </EM:TabPanel>
                    <EM:TabPanel ID="Tab_ListDetail" runat="server" Enabled="false" HeaderText="<%$ Resources:Content,ListDetail %>">
                        <ContentTemplate>
                            <asp:Button ID="Btn_Tab2" runat="server" Style="display: none;" />
                            <asp:Panel ID="Pnl_TabContent2" Visible="false" runat="server">
                                <asp:Panel ID="Pnl_Subscribers" Visible="true" runat="server">
                                    <div class="row">
                                        <div class="col-sm-2 col-xs-12 row-label">
                                            <asp:Label Text="<%$ Resources:Content,MailingList %>" runat="server" />:
                                        </div>
                                        <div class="col-sm-10 col-xs-12">
                                            <asp:Label ID="Lbl_MailingList" runat="server" />
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-2 col-xs-12 row-label">
                                            <asp:Label Text="<%$ Resources:Content,Alias %>" runat="server" />:
                                        </div>
                                        <div class="col-sm-10 col-xs-12">
                                            <asp:Label ID="Lbl_Alias" runat="server" />
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-2 col-xs-12 row-label">
                                            <asp:Label Text="<%$ Resources:Content,UsedFor %>" runat="server" />:
                                        </div>
                                        <div class="col-sm-10 col-xs-12">
                                            <asp:Label ID="Lbl_UsedFor" runat="server" />
                                        </div>
                                    </div>
                                    <div class="row Div_OpsRow" id="Div_OpsRow" runat="server">
                                        <div class="col-xs-12">
                                            <div class="card">
                                                <div class="header">
                                                    <h3>
                                                        <%= Resources.Content.GN00001320%>                                                                                                                                 
                                                    </h3>
                                                </div>
                                                <div class="body">
                                                    <asp:Button ID="Btn_AddBulkSubscribers" runat="server"
                                                        class="btn btn-primary btnAction" Text="<%$ Resources:Content,AddBulkSubscribers %>" />
                                                    <asp:Button ID="Btn_RemoveSelectedMembers" runat="server"
                                                        Text="<%$ Resources:Content,L00149%>"
                                                        class="btn btn-primary waves-effect btnAction" Custom1="Custom" Style="display: none" />
                                                    <EM:ConfirmButtonExtender ID="CBE_Delete" runat="server"
                                                        ConfirmText='<%$ Resources:Content,RemoveSelectedSubscribers%>'
                                                        TargetControlID="Btn_RemoveSelectedMembers">
                                                    </EM:ConfirmButtonExtender>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <asp:Panel CssClass="row" ID="Pnl_Search" runat="server" DefaultButton="Btn_Search">
                                        <div class="panel-group search-panel" id="AS_List" role="tablist" aria-multiselectable="true">
                                            <div class="col-xs-12" role="tab" id="SH_List">
                                                <div class="card">
                                                    <div class="header" role="button" data-toggle="collapse" data-parent="#AS_List" href="#<%= CSB_List.ClientID %>" aria-expanded="true" aria-controls="SH_List">
                                                        <h3>
                                                            <%= Resources.Content.GN0000395%>
                                                        </h3>
                                                    </div>
                                                    <div id="CSB_List" runat="server" class="body panel-collapse collapse" role="tabpanel" aria-labelledby="SH_List" aria-expanded="false">
                                                        <div class="row">
                                                            <div class="col-md-4 col-sm-6 col-xs-12" runat="server" id="td_Owner">
                                                                <div class="form-group form-float">
                                                                    <div class="form-line">
                                                                        <asp:TextBox ID="TxBx_SearchQuery" runat="server" MaxLength="200"></asp:TextBox>
                                                                        <asp:Label ID="Label2" runat="server" EnableViewState="false"
                                                                            Text="<%$ Resources:Content,GN0000391%>" class="form-label"></asp:Label>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-8 col-sm-6 col-xs-12">
                                                                <div class="form-group">
                                                                    <asp:Button ID="Btn_Search" runat="server"
                                                                        class="btn btn-primary"
                                                                        Text="<%$ Resources:Content,GN0000391%>" />
                                                                    <asp:Button ID="Btn_Clear" Visible="false"
                                                                        class="btn btn-primary" runat="server"
                                                                        Text="<%$ Resources:Content,String289 %>" />
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </asp:Panel>
                                    <div class="row">
                                        <div class="col-xs-12">
                                            <asp:GridView CssClass="table table-bordered table-striped table-hover"
                                                EmptyDataText="<%$ Resources:Content, GN00001375 %>"
                                                ID="GV_Members" AllowPaging="true" AllowSorting="false" runat="server" AutoGenerateColumns="False">
                                                <Columns>
                                                    <asp:TemplateField HeaderStyle-CssClass="col-xs-1" ItemStyle-CssClass="col-xs-1" HeaderText='<%$ Resources:Content,GN0000370 %>'>
                                                        <HeaderTemplate>
                                                            <asp:CheckBox class="option-menu" ID="ChkBx_All" runat="server" Text=" " onclick="SetCheckedHeader(this.checked, this,'All');" />
                                                        </HeaderTemplate>
                                                        <ItemTemplate>
                                                            <asp:CheckBox class="option-menu" ID="ChkBx_Item" runat="server" Text=" " onclick="SetCheckedHeader(this.checked, this,'1');" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderStyle-CssClass="col-xs-5"
                                                        HeaderText='<%$ Resources:Content,SubsciberEmail %>' SortExpression="email_address">
                                                        <ItemTemplate>
                                                            <asp:Literal ID="Ltl_SubsciberEmail" runat="server" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderStyle-CssClass="col-xs-5"
                                                        HeaderText='<%$ Resources:Content, Name %>' SortExpression="FName">
                                                        <ItemTemplate>
                                                            <asp:Literal ID="Ltl_Name" runat="server" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderStyle-CssClass="col-xs-1"
                                                        HeaderText='<%$ Resources:Content, String385 %>'>
                                                        <ItemTemplate>
                                                            <asp:LinkButton ID="Lbtn_Remove" runat="server"
                                                                Text="<%$ Resources:Content,Remove %>"
                                                                CommandArgument='<%# Eval("EmailAddress")%>'
                                                                CommandName="Remove" CssClass="btnAction"></asp:LinkButton>
                                                            <EM:ConfirmButtonExtender ID="CBE_Delete" runat="server"
                                                                ConfirmText='<%# Resources.Content.String619.Replace("%action-text%", Eval("Name"))%>' TargetControlID="Lbtn_Remove">
                                                            </EM:ConfirmButtonExtender>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                                <PagerTemplate>
                                                    <EM:Pager ID="Pager1" runat="server" />
                                                </PagerTemplate>
                                            </asp:GridView>
                                        </div>
                                    </div>
                                </asp:Panel>
                                <asp:Panel ID="Pnl_AddBulkSubscribers" Visible="false" runat="server">
                                    <div class="row">
                                        <div class="col-xs-12">
                                            <div class="card">
                                                <div class="header">
                                                    <div class="displayInlineBlock">
                                                        <h2>
                                                            <asp:Literal ID="Literal74" runat="server" EnableViewState="false" Text="<%$ Resources:Content,AddBulkSubscribers%>" /></h2>
                                                    </div>
                                                </div>
                                                <div class="body">
                                                    <div class="row">
                                                        <div class="col-xs-12 row-label">
                                                            <asp:Label ID="use_Interface" runat="server" Text="<%$ Resources:Content,BulkSubscribersInfoText%>"></asp:Label>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-sm-2 col-xs-12 row-label">
                                                            <label>
                                                                <asp:Literal ID="Ltrl_SelectProfilePic" runat="server" Text="<%$Resources:Content,String380 %>"></asp:Literal>:</label>
                                                        </div>
                                                        <div class="col-sm-10 col-xs-12">
                                                            <div class="form-group">
                                                                <div class="fileupload fileupload-new" data-provides="fileupload">
                                                                    <span class="btn btn-primary btn-file"><span class="fileupload-new"><%= Resources.Content.strSelectFile%></span>
                                                                        <span class="fileupload-exists"><%= Resources.Content.GN0000385%></span>
                                                                        <asp:FileUpload ID="FU_BulkMailBox" runat="server" />
                                                                    </span>
                                                                    <span class="fileupload-preview"></span>
                                                                    <a href="#" class="close fileupload-exists" data-dismiss="fileupload" style="float: none">×</a>
                                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="FU_BulkMailBox"
                                                                        Display="None" SetFocusOnError="True" ValidationGroup="AddBulkSubscribers"></asp:RequiredFieldValidator>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-xs-12">
                                                            <asp:ValidationSummary ID="ValidationSummary3" runat="server" ShowMessageBox="true"
                                                                ShowSummary="false" ValidationGroup="AddBulkSubscribers" HeaderText="<%$ Resources:Content,EM000001%>" />
                                                            <asp:Button ID="Btn_SaveBulkSubscribers" runat="server" ValidationGroup="AddBulkSubscribers" CausesValidation="True"
                                                                class="btn btn-primary waves-effect" Text="<%$ Resources:Content,AddBulkSubscribers%>" />
                                                            <asp:Button ID="Btn_BSCancel" runat="server" CausesValidation="false" class="btn btn-primary waves-effect"
                                                                Text="<%$ Resources:Content,GN0000572%>" />
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </asp:Panel>
                                <asp:Panel ID="pnl_BulkSubscribersLog" runat="server" Visible="false">
                                    <div class="card">
                                        <div class="header">
                                            <h3>
                                                <asp:Literal ID="Literal88" runat="server" EnableViewState="false" Text="<%$ Resources:Content,SMI0371%>" />
                                            </h3>
                                        </div>
                                        <div class="body">
                                            <div class="row">
                                                <div class="col-xs-12" id="Div_Result" runat="server">
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-xs-12">
                                                    <asp:Button ID="Btn_BSubsLogClose" runat="server" CausesValidation="false" class="btn btn-primary waves-effect"
                                                        Text="<%$ Resources:Content,GN000150%>" />
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </asp:Panel>
                            </asp:Panel>
                        </ContentTemplate>
                    </EM:TabPanel>
                </EM:TabContainer>
            </div>
        </div>
    </div>

    <script type="text/javascript">

        function SaveMailChimp(e) {

            if (document.getElementById("<%= ChkBx_MailChimpEnabled.ClientID%>").checked && ($("#" + '<%= TxBx_MailChimpAPIKey.ClientID%>').val() == '' || $("#" + '<%= TxBx_MailChimpAPIUrl.ClientID%>').val() == '')) {
                alert("Fields with * are required");
                e.preventDefault();
            }
        }
    </script>
</asp:Content>

