<%@ control language="VB" autoeventwireup="false" inherits="RCC_O365_CC_OfferNameAndDescription, MachSol.MachPanel.Web" %>
<%@ Register Src="~/Template/GVPager.ascx" TagName="Pager" TagPrefix="EM" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="EM" %>
<script>
    function ShowFullText(event) {
        $("span[data-num='FullText" + $(event).attr("data-num") + "']").removeClass("hide");
        $("span[data-num='PartialText" + $(event).attr("data-num") + "']").addClass("hide");
        $(event).addClass("hide")
        $("button[data-num2='Less" + $(event).attr("data-num") + "']").removeClass("hide");
    }
    function ShowPartialText(event) {
        $("span[data-num='FullText" + $(event).attr("data-num") + "']").addClass("hide");
        $("span[data-num='PartialText" + $(event).attr("data-num") + "']").removeClass("hide");
        $(event).addClass("hide")
        $("input[data-num2='More" + $(event).attr("data-num") + "']").removeClass("hide");
    }
</script>
<asp:Panel ID="Pnl_Search" runat="server" DefaultButton="Btn_SearchOffers">
    <div class="panel-group search-panel" id="div-offers-search-panel" role="tablist" aria-multiselectable="true">
        <div role="tab" id="div-search-tab-header">
            <div class="card">
                <div class="header" role="button" data-toggle="collapse" data-parent="#div-offers-search-panel"
                    href="#div-search-tab-body" aria-expanded="true" aria-controls="div-search-tab-header">
                    <h3>
                        <%= Resources.Content.GN0000395%>
                    </h3>
                </div>
                <div id="div-search-tab-body" class="body panel-collapse collapse" role="tabpanel" aria-labelledby="div-search-tab-header" aria-expanded="false">
                    <div class="row">
                        <div class="col-md-3 col-sm-6 col-xs-12" runat="server" id="td_Owner">
                            <div class="form-group">
                                <asp:DropDownList ID="Ddl_SearchOfferProfiles" runat="server" AutoPostBack="true" OnSelectedIndexChanged="Ddl_SearchOfferProfiles_SelectedIndexChanged"></asp:DropDownList>
                            </div>
                        </div>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                            <div class="form-group">
                                <asp:DropDownList ID="Ddl_SearchOfferCountries" runat="server" AutoPostBack="true" OnSelectedIndexChanged="Ddl_SearchOfferCountries_SelectedIndexChanged"></asp:DropDownList>
                            </div>
                        </div>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                            <div class="form-group">
                                <asp:DropDownList ID="Ddl_SearchOfferLocales" runat="server"></asp:DropDownList>
                            </div>
                        </div>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                            <div class="form-group form-float">
                                <div class="form-line">
                                    <asp:TextBox ID="TxBx_SearchOffers" runat="server" onKeyUp='filterCSPOffers(this)'></asp:TextBox>
                                    <asp:Label ID="Lbl_SearchOfferTitle" runat="server" EnableViewState="false" Text="<%$ Resources:Content,strOfferName%>" class="form-label"></asp:Label>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class="form-group">
                                <asp:Button ID="Btn_SearchOffers" runat="server" class="btn btn-primary waves-effect" Text="<%$ Resources:Content,GN0000391%>" />
                                <asp:Button ID="Btn_ClearOffers" runat="server" class="btn btn-primary waves-effect" Text="<%$ Resources:Content,String289%>" Visible="false" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Panel>
<div class="row Div_OpsRow" id="Div_OpsRow" runat="server">
    <div class="col-xs-12">
        <div class="card">
            <div class="header">
                <h3>
                    <asp:Literal ID='Ltrl_CSPProfOpsHeading' runat="server" Text='<%$ Resources:Content,GN00001320%>'></asp:Literal></h3>
            </div>
            <div class="body">
                <asp:Button ID="Btn_ImportOffersFromExcel" class="btn btn-primary waves-effect btnAction" runat="server"
                    Text='<%$ Resources:Content,L00100 %>' />
                <asp:Button ID="Btn_ExportOffersToExcel" class="btn btn-primary waves-effect btnAction" runat="server"
                    Text='<%$ Resources:Content,strExport %>' />
            </div>
        </div>
    </div>
</div>
<asp:GridView CssClass="table table-bordered table-striped table-hover" EmptyDataText="<%$ Resources:Content, GN00001375 %>"
    ID="GV_Offers" AllowPaging="true" AllowSorting="true" runat="server" AutoGenerateColumns="False">
    <Columns>
        <asp:TemplateField HeaderStyle-CssClass="col-xs-2" SortExpression="CustomOfferName" HeaderText='<%$ Resources:Content, CustomOfferName %>'>
            <ItemTemplate>
                <asp:Literal ID="Ltl_CustomOfferName" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderStyle-CssClass="col-xs-2" SortExpression="MSOfferName" HeaderText='<%$ Resources:Content, MicrosoftOfferName %>'>
            <ItemTemplate>
                <asp:Literal ID="Ltl_MicrosoftOfferName" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderStyle-CssClass="col-xs-2" SortExpression="MSOfferId" HeaderText='<%$ Resources:Content, strOfferID %>'>
            <ItemTemplate>
                <asp:Literal ID="Ltl_OfferId" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderStyle-CssClass="col-xs-3" SortExpression="CustomOfferDescription" HeaderText='<%$ Resources:Content, Description %>'>
            <ItemTemplate>
                <asp:Label ID="Lbl_Description_FullText"
                    data-num='<%# "FullText" & DataBinder.Eval(Container.DataItem, "OfferId") %>'
                    runat="server" Text="" CssClass="hide break-word-all" />
                <asp:Label ID="Lbl_Description_PartialText"
                    data-num='<%# "PartialText" & DataBinder.Eval(Container.DataItem, "OfferId") %>'
                    CssClass="break-word-all"
                    runat="server" Text="" />
                <br />
                <asp:Button
                    ID="lbtn_More"
                    runat="server"
                    CommandName="Detail"
                    CommandArgument='<%# DataBinder.Eval(Container.DataItem, "OfferId") %>'
                    Text="<%$ Resources:Content,ShowMore %>"
                    CssClass="btn btn-primary btn-sm"
                    data-num='<%# DataBinder.Eval(Container.DataItem, "OfferId") %>'
                    data-num2='<%# "More" & DataBinder.Eval(Container.DataItem, "OfferId") %>'
                    OnClientClick="ShowFullText($(this));return false;"></asp:Button>
                <button id="btn_ViewLess"
                    class="btn btn-primary btn-sm hide"
                    data-num='<%#  DataBinder.Eval(Container.DataItem, "OfferId") %>'
                    data-num2='<%# "Less" & DataBinder.Eval(Container.DataItem, "OfferId") %>'
                    onclick="ShowPartialText($(this));return false;">
                    <%= Resources.Content.ShowLess %></button>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderStyle-CssClass="col-xs-2" SortExpression="ProfileName" HeaderText='<%$ Resources:Content, CSPProfile %>'>
            <ItemTemplate>
                <asp:Literal ID="Ltl_CSPProfile" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderStyle-CssClass="col-xs-1" SortExpression="CultureName" HeaderText='<%$ Resources:Content, LanguageLocale %>'>
            <ItemTemplate>
                <asp:Literal ID="Ltl_LanguageLocale" runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <PagerTemplate>
        <EM:Pager ID="Pager" runat="server" />
    </PagerTemplate>
</asp:GridView>

<asp:Button ID="Btn_Dummy" Style="display: none" runat="server" />
<asp:Panel ID="Pnl_OffersImport" runat="server" CssClass="width-modal-popup-auto" Style="display: none">
    <div class="col-xs-12">
        <div class="card">
            <div class="header container-fluid">
                <h3 class="pull-left">
                    <asp:Literal ID="Literal77" EnableViewState="false" runat="server" Text="<%$ Resources:Content,String380%>" />:  </h3>

            </div>
            <div class="body">
                <div class="row">
                    <div class="col-sm-3 col-xs-12 row-label">
                    </div>
                    <div class="col-sm-9 col-xs-12">
                        <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_BulkOffersNamesAndDescriptions" runat="server" EnableViewState="true" />
                            </span>
                            <span class="fileupload-preview"></span>
                            <a href="#" class="close fileupload-exists" data-dismiss="fileupload" style="float: none">×</a>
                            <asp:RequiredFieldValidator ID="RFV_BulkOffersNamesAndDescriptions" runat="server" ControlToValidate="FU_BulkOffersNamesAndDescriptions"
                                Display="None" SetFocusOnError="True" ValidationGroup="importOffersNameAndDescription" ErrorMessage='<%$Resources:Content,USM0077 %>'></asp:RequiredFieldValidator>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-sm-3 col-xs-12 row-label"></div>
                        <div class="col-sm-9 col-xs-12">
                            <asp:ValidationSummary HeaderText='<%$ Resources:Content, EM000001%>' ID="ValidationSummary2" ValidationGroup="importOffersNameAndDescription"
                                ShowMessageBox="true" ShowSummary="false" runat="server" />
                            <asp:Button ID="Btn_UpdateOffersNamesAndDescriptions" runat="server" Text="<%$ Resources:Content,strImport%>" ValidationGroup="importOffersNameAndDescription" CssClass="btn btn-primary waves-effect btnAction" />
                            <asp:Button ID="Btn_Cancel" runat="server" Text="<%$ Resources:Content,GN0000572%>" CssClass="btn btn-primary waves-effect" CausesValidation="false" />
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>

</asp:Panel>

<EM:ModalPopupExtender runat="server" ID="MPE_ImportOffersFromExcel" BackgroundCssClass="modalBackground"
    DropShadow="false" PopupControlID="Pnl_OffersImport" TargetControlID="Btn_Dummy" CancelControlID="Btn_Cancel">
</EM:ModalPopupExtender>
