<%@ control language="VB" autoeventwireup="false" inherits="RCC_O365_CC_CSP3rdPartyProducts, MachSol.MachPanel.Web" %>

<%@ Register Src="~/Template/GVPager.ascx" TagName="Pager" TagPrefix="UC" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="Ajax" %>


<asp:Panel ID="Pnl_ProductsListing" runat="server">
    <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_ImportProductDetails" runat="server" Text="<%$ Resources:Content,StrImportProducts %>" CssClass="btn btn-primary waves-effect btnAction" />
                    &nbsp;
                    <asp:Button ID="Btn_ExportProdcutDetails" runat="server" Text="<%$ Resources:Content,StrExportProducts %>" CssClass="btn btn-primary waves-effect btnAction" />
                    &nbsp;
                </div>
            </div>
        </div>
    </div>

    <div class="row m-t-10">
        <div class="col-xs-12">
            <div class="card">
                <div class="header">
                    <h3>
                        <asp:Literal ID='Ltrl_3rdProdHeading' runat="server" Text='<%$ Resources:Content,StrCSP3rdPartyProducts %>'></asp:Literal>
                    </h3>
                </div>
                <div class="body">

                    <div class="row">

                        <div class="col-sm-2 col-xs-12" id="div_pg_label" runat="server">
                            <label class="font-bold">
                                <asp:Literal ID="Ltrl_PaymentGroup" runat="server" Text="<%$ Resources:Content,GN0000831 %>"></asp:Literal></label>
                        </div>

                        <div class="col-sm-2 col-xs-12">
                            <label class="font-bold">
                                <asp:Literal ID="Ltrl_SelectProfile" runat="server" Text="<%$ Resources:Content,USM0190 %>"></asp:Literal></label>
                        </div>
                        <div class="col-sm-2 col-xs-12">
                            <label class="font-bold">
                                <asp:Literal ID="Ltrl_Country" runat="server" Text="<%$ Resources:Content,Country %>"></asp:Literal></label>
                        </div>
                        <div class="col-sm-2 col-xs-12">
                            <label class="font-bold">
                                <asp:Literal ID="Ltrl_Locale" runat="server" Text="<%$ Resources:Content,GN00003000 %>"></asp:Literal></label>
                        </div>
                        <div class="col-sm-2 col-xs-12">
                            <label class="font-bold">
                                <asp:Literal ID="Ltrl_TargetView" runat="server" Text="<%$ Resources:Content,StrTargetView %>"></asp:Literal></label>
                        </div>
                        <div class="col-sm-2 col-xs-12">
                            <label class="font-bold">
                                <asp:Literal ID="Ltrl_TargetSegment" runat="server" Text="<%$ Resources:Content,StrTargetSegment %>"></asp:Literal></label>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-sm-2 col-xs-12" id="div_pg" runat="server">
                            <asp:DropDownList ID="Ddl_PaymentGroup" runat="server"></asp:DropDownList>
                        </div>
                        <div class="col-sm-2 col-xs-12">
                            <asp:DropDownList ID="Ddl_SelectProfile" runat="server" AutoPostBack="true"></asp:DropDownList>
                        </div>
                        <div class="col-sm-2 col-xs-12">
                            <asp:DropDownList ID="Ddl_Country" runat="server"></asp:DropDownList>
                        </div>
                        <div class="col-sm-2 col-xs-12">
                            <asp:DropDownList ID="Ddl_Locale" runat="server"></asp:DropDownList>
                        </div>
                        <div class="col-sm-2 col-xs-12">
                            <asp:DropDownList ID="Ddl_TargetView" runat="server"></asp:DropDownList>
                        </div>
                        <div class="col-sm-2 col-xs-12">
                            <asp:DropDownList ID="Ddl_TargetSegment" runat="server"></asp:DropDownList>
                        </div>

                        <div class="col-xs-12">
                            <div class="col-sm-2 col-xs-12 m-l--15">
                                <asp:DropDownList ID="Ddl_ShowTrialProduct" runat="server">
                                    <asp:ListItem Text="All Products" Value="-1"></asp:ListItem>
                                    <asp:ListItem Text="Trial Products" Value="1"></asp:ListItem>
                                    <asp:ListItem Text="Paid Products" Value="0"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <div class="col-sm-2 col-xs-12 m-l-5">
                                <asp:DropDownList ID="Ddl_ShowAvailableProducts" runat="server">
                                    <asp:ListItem Text="Available Products" Value="0" Selected="true"></asp:ListItem>
                                    <asp:ListItem Text="Removed Products" Value="1"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <div class="col-sm-2 col-xs-12 m-l--5">
                                <div class="form-group form-float p-l-10">
                                    <div class="form-line">
                                        <asp:TextBox ID="TxBx_SearchProdTitle" runat="server"></asp:TextBox>
                                        <asp:Label ID="Lbl_SearchProdTitle" runat="server" EnableViewState="false" Text="<%$ Resources:Content,SPT002744%>" class="form-label"></asp:Label>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-2 col-xs-12 m-l-5">
                                <div class="form-group form-float p-l-10">
                                    <div class="form-line">
                                        <asp:TextBox ID="TxBx_SearchSkuTitle" runat="server"></asp:TextBox>
                                        <asp:Label ID="Lbl_SearchSkuTitle" runat="server" EnableViewState="false" Text="<%$ Resources:Content,StrSku%>" class="form-label"></asp:Label>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-2 col-xs-12 m-l-5">
                                <div class="form-group p-l-10">
                                    <asp:DropDownList ID="Ddl_Publisher" runat="server">
                                        <asp:ListItem Text="All Publishers" Value="-1"></asp:ListItem>
                                        <asp:ListItem Text="Microsoft" Value="1"></asp:ListItem>
                                        <asp:ListItem Text="Partner" Value="0"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="col-sm-2 col-xs-12 m-l-5">
                                <div class="form-group p-l-10">
                                    <asp:DropDownList ID="Ddl_ProdLevel" runat="server">
                                        <asp:ListItem Text="All Levels" Value="-1"></asp:ListItem>
                                        <asp:ListItem Text="Base Only" Value="0"></asp:ListItem>
                                        <asp:ListItem Text="AddOn Only" Value="1"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class="pull-right">
                                <asp:CheckBox ID="CB_SyncFromBackend" runat="server" Text="<%$ Resources:Content,USM0163 %>" />
                                &nbsp;
                                <asp:Button ID="Btn_GetProducts" runat="server" Text="<%$ Resources:Content,StrGetProducts %>" CssClass="btn btn-primary waves-effect btnAction" />
                            </div>
                        </div>
                    </div>

                    <asp:GridView ID="GV_Products" CssClass="table table-bordered table-striped table-hover" AllowSorting="true" AllowPaging="true"
                        EmptyDataText='<%$ Resources:Content, GN00001375 %>' runat="server" AutoGenerateColumns="False">
                        <Columns>
                            <%--Package Name, Offer name, Offer Id, Status, Price--%>
                            <asp:TemplateField HeaderStyle-CssClass="col-xs-6" HeaderText="<%$ Resources:Content,SPT002744 %>">
                                <ItemTemplate>

                                    <asp:HiddenField ID="HF_TargetSegment" runat="server" Value='<%# Eval("TargetSegment") %>' />
                                    <asp:HiddenField ID="HF_TargetView" runat="server" Value='<%# Eval("TargetView") %>' />
                                    <asp:HiddenField ID="HF_ProfileId" runat="server" Value='<%# Eval("ProfileId") %>' />
                                    <asp:HiddenField ID="HF_LocaleId" runat="server" Value='<%# Eval("LocaleId") %>' />
                                    <asp:HiddenField ID="HF_CountryId" runat="server" Value='<%# Eval("CountryId") %>' />
                                    <asp:HiddenField ID="HF_ProvVars" runat="server" Value='<%# Eval("ProvVars") %>' />
                                    <asp:HiddenField ID="HF_InvVars" runat="server" Value='<%# Eval("InventoryVars") %>' />
                                    <asp:HiddenField ID="HF_PurchasePreREq" runat="server" Value='<%# Eval("PurchasePreReq") %>' />
                                    <asp:HiddenField ID="HF_PGId" runat="server" Value='<%# Eval("PGId") %>' />

                                    <div class="row">
                                        <div class="col-sm-5 font-bold">
                                            <asp:Literal ID="Ltrl_ProdTitle" runat="server" Text="<%$ Resources:Content,SPT002744 %>"></asp:Literal>:
                                        </div>
                                        <div class="col-sm-7">
                                            <asp:Literal ID="Ltrl_ProdTitlePlaceHoder" runat="server" Text='<%# Eval("ProdTitle") %>'></asp:Literal>
                                            <div>
                                                <asp:HiddenField ID="HF_ProdId" runat="server" Value='<%# Eval("ProdId") %>' />
                                            </div>
                                            <div id="div_prodDescription" runat="server" visible="false">
                                                <asp:Literal ID="Ltrl_ProdDescription" runat="server" Text='<%# HttpUtility.HtmlDecode(Eval("ProdDescription")) %>'></asp:Literal>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-sm-5 font-bold">
                                            <asp:Literal ID="Ltrl_SkuTitle" runat="server" Text="<%$ Resources:Content,StrSku %>"></asp:Literal>:
                                        </div>
                                        <div class="col-sm-7">
                                            <asp:Literal ID="Ltrl_SkuTitlePlaceHolder" runat="server" Text='<%# Eval("SkuTitle") %>'></asp:Literal>
                                            <div>
                                                <asp:HiddenField ID="HF_SkuId" runat="server" Value='<%# Eval("SkuId") %>' />
                                            </div>
                                            <div id="div_skuDescription" runat="server" visible="false">
                                                <asp:Literal ID="Ltrl_SkuDescription" runat="server" Text='<%# HttpUtility.HtmlDecode(Eval("SkuDescription")) %>'></asp:Literal>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-sm-3 font-bold">
                                            <asp:Literal ID="Ltrl_MinQty" runat="server" Text="<%$ Resources:Content,StrMinQty %>"></asp:Literal>:
                                        </div>
                                        <div class="col-sm-2 font-12">
                                            <asp:Literal ID="Ltrl_MinQtyPlaceHolder" runat="server" Text='<%# Eval("MinQty") %>'></asp:Literal>
                                        </div>
                                        <div class="col-sm-3 font-bold">
                                            <asp:Literal ID="Ltrl_MaxQty" runat="server" Text="<%$ Resources:Content,StrMaxQty %>"></asp:Literal>:
                                        </div>
                                        <div class="col-sm-3 font-12">
                                            <asp:Literal ID="Ltrl_MaxQtyPlaceHolder" runat="server" Text='<%# Eval("MaxQty") %>'></asp:Literal>
                                        </div>
                                    </div>

                                    <div class="row" runat="server" id="div_IsMSProduct" visible="false">
                                        <div class="col-sm-5 font-bold">
                                            <asp:Literal ID="Ltrl_IsMsProduct" runat="server" Text="<%$ Resources:Content,StrIsMicrosoftProduct %>"></asp:Literal>:
                                        </div>
                                        <div class="col-sm-7">
                                            <asp:Literal ID="Ltrl_IsMsProductPlaceHolder" runat="server" Text='<%# Eval("IsMsProduct") %>'></asp:Literal>
                                        </div>
                                    </div>

                                    <div class="row" id="div_IsTrial" runat="server" visible="false">
                                        <div class="col-sm-5 font-bold">
                                            <asp:Literal ID="Ltrl_IsTrial" runat="server" Text="<%$ Resources:Content,StrIsTrial %>"></asp:Literal>:
                                        </div>
                                        <div class="col-sm-7">
                                            <asp:Literal ID="Ltrl_IsTrialPlaceHolder" runat="server" Text='<%# Eval("IsTrial") %>'></asp:Literal>
                                        </div>
                                    </div>

                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-CssClass="col-xs-2" HeaderText="<%$ Resources:Content,GN00001473 %>">
                                <ItemTemplate>
                                    <asp:Repeater ID="Rep_ProdPriceDetail" runat="server" DataSource='<%# Eval("PriceDetailsObj") %>' OnItemDataBound="Rep_ProdPriceDetail_ItemDataBound">
                                        <ItemTemplate>
                                            <div class="col-sm-2 m-l--5 m-t-5 font-11">
                                                <asp:Literal ID="Ltrl_BillCycle" runat="server" Text='<%# Eval("Billingcycle") %>'></asp:Literal>
                                            </div>
                                            <div class="col-sm-2 m-l--5 m-t-5 font-11">
                                                <asp:Literal ID="Ltrl_Term" runat="server" Text='<%# Eval("TermDuration") %>'></asp:Literal>
                                            </div>
                                            <div class="col-sm-4">
                                                <asp:TextBox ID="TxBx_CostPrice" runat="server" Text='<%# string.Format("{0} {1:N}",ViewState("CS"), Eval("CostPrice")) %>'></asp:TextBox>
                                            </div>
                                            <div class="col-sm-4">
                                                <asp:TextBox ID="TxBx_SalePrice" runat="server" Text='<%# String.Format("{0} {1:N}", ViewState("CS"), Eval("SalePrice")) %>'></asp:TextBox>
                                            </div>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-CssClass="col-xs-2" HeaderText="<%$ Resources:Content,CostPrice %>">
                                <ItemTemplate>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-CssClass="col-xs-2" HeaderText="<%$ Resources:Content,SalePrice %>">
                                <ItemTemplate>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <%--PagerTemplate Start--%>
                        <PagerTemplate>
                            <UC:Pager ID="Pager1" runat="server" />
                        </PagerTemplate>
                        <%--PagerTemplate End--%>
                    </asp:GridView>

                    <div class="row m-t-5">
                        <div class="col-sm-offset-6 col-sm-6 col-xs-12">
                            <span class="pull-right">
                                <asp:Button ID="Btn_UpdateProductPrices" runat="server" Text="<%$ Resources:Content,StrUpdatePriceDetail %>" CssClass="btn btn-primary waves-effect btnAction" Visible="false" />
                            </span>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</asp:Panel>

<asp:Panel ID="Pnl_ImportProduct" runat="server" Visible="false">
    <div class="card">
        <div class="header">
            <h3>
                <asp:Literal ID="Ltrl_ImportProdHeader" runat="server" Text="<%$ Resources:Content,StrImportProducts %>"></asp:Literal>
            </h3>
        </div>
        <div class="body">

            <asp:Panel ID="Pnl_BulkStep1" runat="server">
                <div class="row" id="div_import_pg_row" runat="server">
                    <div class="col-sm-3 col-xs-12 row-label">
                        <label>
                            <asp:Literal ID="Ltrl_ImportPaymentGroup" runat="server" Text="<%$ Resources:Content,GN0000831 %>"></asp:Literal>
                        </label>
                    </div>
                    <div class="col-sm-4 col-xs-12">
                        <asp:DropDownList ID="Ddl_ImportPaymentGroup" runat="server"></asp:DropDownList>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-3 col-xs-12 row-label">
                        <label>
                            <asp:Literal ID="Ltrl_ImportProfile" runat="server" Text="<%$ Resources:Content,CSPProfile %>"></asp:Literal>
                        </label>
                    </div>
                    <div class="col-sm-4 col-xs-12">
                        <asp:DropDownList ID="Ddl_ImportProfile" runat="server" AutoPostBack="true"></asp:DropDownList>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-3 col-xs-12 row-label">
                        <label>
                            <asp:Literal ID="Ltrl_ImportCountry" runat="server" Text="<%$ Resources:Content,GN0000882 %>"></asp:Literal>
                        </label>
                    </div>
                    <div class="col-sm-4 col-xs-12">
                        <asp:DropDownList ID="Ddl_ImportCountry" runat="server"></asp:DropDownList>
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-3 col-xs-12 row-label">
                        <label>
                            <asp:Literal ID="Ltrl_ImportLocale" runat="server" Text="<%$ Resources:Content,GN00001527 %>"></asp:Literal>
                        </label>
                    </div>
                    <div class="col-sm-4 col-xs-12">
                        <asp:DropDownList ID="Ddl_ImportLocale" runat="server"></asp:DropDownList>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-3 col-xs-12 row-label">
                        <label>
                            <asp:Literal ID="Ltrl_SelectImportFile" runat="server" Text="<%$Resources:Content,selectExcelFileToImport %>"></asp:Literal>:</label>
                    </div>
                    <div class="col-sm-4 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_ImportFile" runat="server" />
                                </span>
                                <span class="fileupload-preview"></span>
                                <a href="#" class="close fileupload-exists" data-dismiss="fileupload" style="float: none">×</a>
                                <asp:RequiredFieldValidator ID="RFV_ImportFile" runat="server" ControlToValidate="FU_ImportFile"
                                    Display="None" SetFocusOnError="True" ValidationGroup="ImportFile" ErrorMessage='<%$Resources:Content,USM0077 %>'></asp:RequiredFieldValidator>
                            </div>
                        </div>
                    </div>
                </div>

                <br />
                <div class="row">
                    <div class="col-sm-offset-3 col-sm-4 col-xs-12">
                        <asp:Button ID="Btn_Import" runat="server" ValidationGroup="ImportFile" CausesValidation="True"
                            class="btn btn-primary waves-effect btnAction" Text="<%$ Resources:Content,L00100%>" />

                        <asp:Button ID="Btn_CancelImport" runat="server" CausesValidation="false" class="btn btn-primary waves-effect" Text="<%$ Resources:Content,GN0000572%>" />
                    </div>
                </div>
            </asp:Panel>
            <asp:Panel CssClass="row" ID="pnl_BulkUserLog" runat="server" Visible="false">
                <div class="col-xs-12">
                    <div class="card">
                        <div class="header">
                            <h3>
                                <asp:Literal ID="Literal88" runat="server" EnableViewState="false" Text="<%$ Resources:Content,StrImportProductsLog%>" /></h3>
                        </div>
                        <div class="body">
                            <div class="row">
                                <div class="col-xs-12 row-label" id="Div_Result" runat="server">
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-12">
                                    <asp:Button ID="Btn_BUserLogClose" runat="server" CausesValidation="false" class="btn btn-primary waves-effect" Text="<%$ Resources:Content,GN000150%>" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </asp:Panel>
        </div>
    </div>
</asp:Panel>

