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

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

<script lang="javascript">

    function triggerFilterUpdate() {
        $get('<%=Btn_FilterProducts.ClientID %>').click();
    }

</script>

<asp:Panel ID="Pnl_ProductsListing" runat="server">
    <div class="row">
        <div class="col-xs-12">
            <div class="card">
                <div class="body">
                    <div class="row">
                        <div class="col-xs-3">
                            <asp:DropDownList ID="Ddl_TargetView" runat="server"></asp:DropDownList>
                        </div>

                        <div class="col-xs-3">
                            <asp:DropDownList ID="Ddl_TargetSegment" runat="server"></asp:DropDownList>
                        </div>

                        <div class="col-xs-2">
                            <asp:DropDownList ID="Ddl_Category" runat="server">
                                <asp:ListItem Text="--Select Category--" Value="-1" Selected="true"></asp:ListItem>
                                <asp:ListItem Text="Paid" Value="0"></asp:ListItem>
                                <%--0: Means Not 'IsTrial'--%>
                                <asp:ListItem Text="Trial" Value="1"></asp:ListItem>
                                <%--True: 'IsTrial'--%>
                            </asp:DropDownList>
                        </div>
                        <div class="col-xs-4">
                            <div class="form-group form-float">
                                <div class="form-line">
                                    <asp:TextBox ID="TxBx_ProdTitle" runat="server" MaxLength="200"></asp:TextBox>
                                    <asp:Label ID="Lbl_ProdTitle" runat="server" EnableViewState="false" Text="<%$ Resources:Content,SPT002744%>" class="form-label"></asp:Label>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="row">
                        <div class="col-xs-3">
                            <asp:DropDownList ID="Ddl_Publisher" runat="server">
                                <asp:ListItem Text="--Select Publisher--" Selected="True" Value="-1"></asp:ListItem>
                                <asp:ListItem Text="Microsoft" Value="1"></asp:ListItem>
                                <%--1: 'IsMicrosoft'--%>
                                <asp:ListItem Text="Partner" Value="0"></asp:ListItem>
                                <%--False: Means Not 'IsMicrosoft'--%>
                            </asp:DropDownList>
                        </div>
                        <div class="col-xs-3">
                            <asp:DropDownList ID="Ddl_ProdLevel" runat="server">
                                <asp:ListItem Text="--Select Product Level--" Value="-1" Selected="true"></asp:ListItem>
                                <asp:ListItem Text="Base Only" Value="0"></asp:ListItem>
                                <%--0: Means Not 'DA_IsAddOn'--%>
                                <asp:ListItem Text="AddOn Only" Value="1"></asp:ListItem>
                                <%--1: Means 'DA_IsAddOn'--%>
                            </asp:DropDownList>
                        </div>

                        <div class="col-xs-2">
                            <div class="form-group">
                                <asp:CheckBox ID="CB_NCEOnly" runat="server" Text="NCE Only" />
                            </div>
                        </div>

                        <div class="col-xs-2">
                            <div class="form-group">
                                <asp:Button ID="Btn_FilterProducts" runat="server" CssClass="btn btn-primary waves-effect" Text="Filter" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row m-t-10">
        <div class="col-xs-12">
            <div class="card" id="div_csp_prod_listing">
                <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 hide d-none">
                        <div class="col-xs-4">
                            <asp:Button ID="Btn_SyncProdsFromBackend" runat="server" Text="<%$ Resources:Content, USM0163 %>" CssClass="btn btn-primary waves-effect btnAction" />
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-xs-12">
                            <div class="form-group">
                                <div class="form-line">
                                    <asp:TextBox ID="TxBx_SearchOffers" runat="server" CssClass="TypeToSearch"
                                        Text='<%# Resources.Content.TypeToSearch%>'
                                        onFocus='<%# "ClearDefaultIfNotChanged(this,&#39;" & Resources.Content.TypeToSearch & "&#39;)"%>'
                                        onBlur='<%# "SetDefaultValueIfBlank(this,&#39;" & Resources.Content.TypeToSearch & "&#39;)"%>'
                                        onKeyUp='<%# "filterCommercialSaaSProds(this)"%>'>
                                    </asp:TextBox>
                                </div>
                            </div>
                        </div>
                    </div>

                    <table class="table table-bordered table-striped table-hover">
                        <asp:UpdatePanel ID="UP_Products" runat="server" UpdateMode="Conditional">
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="Btn_FilterProducts" EventName="Click" />
                            </Triggers>
                            <ContentTemplate>
                                <asp:Repeater ID="Rep_Products" runat="server">
                                    <HeaderTemplate>
                                        <tr class="header-row">
                                            <th class="col-xs-3" id="Title_Header" runat="server">
                                                <asp:Literal ID="Ltrl_ProdHeader" runat="server" Text='<%$ Resources:Content,SPT002744 %>'></asp:Literal>
                                            </th>
                                            <th class="col-xs-2" id="PG_Header" runat="server">
                                                <asp:Literal ID="Ltrl_PayGroupHeader" runat="server" Text='<%$ Resources:Content,GN0000831 %>'></asp:Literal>
                                            </th>
                                            <th class="col-xs-1" id="BC_Header" runat="server">
                                                <asp:Literal ID="Ltrl_BillingCycleHeader" runat="server" Text='<%$ Resources:Content, GN00001473 %>'></asp:Literal>
                                            </th>
                                            <th class="col-xs-2" id="Term_Header" runat="server" style="text-align: left !important;">
                                                <asp:CheckBox class="option-menu" ID="ChkBx_All" runat="server" Text=" " onclick="SetCheckedHeaderCommercialSaaSProd(this.checked, this,'All');" />
                                                <asp:Literal ID="Ltrl_TermHeader" runat="server" Text='Term'></asp:Literal>
                                            </th>
                                            <th class="col-xs-2" id="CP_Header" runat="server">
                                                <asp:Literal ID="Ltrl_CostPriceHeader" runat="server" Text='<%$ Resources:Content,CostPrice %>'></asp:Literal>
                                            </th>
                                            <th class="col-xs-2" id="SP_Header" runat="server">
                                                <asp:Literal ID="Ltrl_SalePriceHeader" runat="server" Text='<%$ Resources:Content,SalePrice %>'></asp:Literal>
                                            </th>
                                        </tr>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <tr class="data-row search-js-prod-row">
                                            <td class="col-xs-3" id="Prod_Title" runat="server">
                                                <asp:HiddenField ID="HF_ProdId" runat="server" Value='<%# Eval("ProdId") %>' />
                                                <asp:HiddenField ID="HF_SkuId" runat="server" Value='<%# Eval("SkuId") %>' />
                                                <input type="hidden" id="HF_TargetView" runat="server" value='<%# Eval("TargetView") %>' />
                                                <input type="hidden" id="HF_TargetSegment" runat="server" value='<%# Eval("TargetSegment") %>' />
                                                <input type="hidden" id="HF_IsMsProduct" runat="server" value='<%# Eval("IsMSProduct") %>' />
                                                <input type="hidden" id="HF_IsTrial" runat="server" value='<%# Eval("IsTrial") %>' />
                                                <input type="hidden" id="HF_IsAddOn" runat="server" value='<%# Eval("DA_IsAddOn") %>' />
                                                <input type="hidden" id="HF_ProductType" runat="server" value='<%# Eval("ProductType") %>' />
                                                <asp:Label ID="Lbl_Cb_Product" runat="server" CssClass="prod-title"></asp:Label>

                                            </td>
                                            <td class="col-xs-9" colspan="5" id="Billing_Details" runat="server">
                                                <asp:Repeater ID="Rep_PaymentGroups" runat="server" OnItemDataBound="Rep_PaymentGroups_ItemDataBound">
                                                    <ItemTemplate>
                                                        <div class="row">
                                                            <div class="col-xs-3" id="PG_Detail" runat="server">
                                                                <asp:HiddenField ID="HF_PGId" runat="server" Value='<%# Eval("Key") %>' />
                                                                <asp:Literal ID="Ltrl_PGName" runat="server" Text='<%# Eval("Value").ToString().Split("|")(0) %>'></asp:Literal>
                                                                <asp:HiddenField ID="HF_PGCS" runat="server" Value='<%# Eval("Value").ToString().Split("|")(1) %>' />
                                                            </div>
                                                            <div class="col-xs-9 m-l--10" id="div_bc_td" runat="server">
                                                                <asp:Repeater ID="Rep_BillingCycle" runat="server" OnItemDataBound="Rep_BillingCycle_ItemDataBound">
                                                                    <ItemTemplate>
                                                                        <div class="row m-l--30" id="div_bc_td_row" runat="server">
                                                                            <div class="col-xs-2" id="div_bc" runat="server">
                                                                                <asp:Literal ID="Ltrl_BillingCycle" runat="server" Text='<%# Eval("Billingcycle").ToString() %>'></asp:Literal>
                                                                            </div>
                                                                            <div class="col-xs-3 m-l--15" id="div_td" runat="server">
                                                                                <asp:CheckBox ID="Cb_Product" runat="server" Text='<%# Eval("TermDuration").ToString() %>'
                                                                                    Checked='<%#Eval("IsSelectedInPackage") andalso PackageId > 0 %>' onclick="SetCheckedHeaderCommercialSaaSProd(this.checked, this,'1');" />
                                                                            </div>
                                                                            <div class="col-xs-3 m-l-20" id="div_cp" runat="server">
                                                                                <asp:TextBox ID="TxBx_CostPrice" runat="server"></asp:TextBox>
                                                                            </div>
                                                                            <div class="col-xs-3 m-l-20" id="div_sp" runat="server">
                                                                                <asp:TextBox ID="TxBx_SalePrice" runat="server"></asp:TextBox>
                                                                            </div>
                                                                        </div>
                                                                    </ItemTemplate>
                                                                </asp:Repeater>
                                                            </div>
                                                        </div>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                            </td>

                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </table>

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

