<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EsposizioneTitoli.aspx.cs" Inherits="OlympiaIntranet.EsposizioneTitoli" %>

<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />

    <title></title>
    <script>
        function OnFirstEndCallback(s, e) {

            // azzera eventuale selezione in gridLookupLinea
            clientgridLookupLinea.SetValue(null);

            // azzera eventuale selezione in gridLookupConsulente 
            clientgridLookupConsulente.SetValue(null);
        }
        //function onShowPopup1(tepiloraText, morningstarText, popupHeaderText) {
        //    lblTepilora.SetText(tepiloraText);
        //    lblMorningstar.SetText(morningstarText);
        //    //popup.SetHeaderText(popupHeaderText); non metto titolo al popup
        //    popup.Show();
        //}
        //function onHidePopup() {
        //    popup.Hide();
        //}
    </script>
    <style>
        .row {
            display: flex;
            margin-left: -5px;
            margin-right: -5px;
        }

        .column {
            flex: 50%;
            padding: 5px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <table>
            <tr>
                <td>
                    <div>
                        <dx:ASPxFormLayout ID="ASPxFormLayout1" runat="server" ColCount="2" EnableTheming="True" Theme="Aqua" ColumnCount="2">
                            <Items>
                                <dx:LayoutGroup Caption="Filtri Selezione" ColSpan="1" ColCount="6" ColumnCount="6">
                                    <Items>
                                        <dx:LayoutItem Caption="" ColSpan="1">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxRadioButtonList ID="rgFiltriRanking" runat="server" RepeatDirection="Horizontal" SelectedIndex="0" ValueType="System.Int32">
                                                        <Items>
                                                            <dx:ListEditItem Selected="True" Text="Titoli con ranking" Value="0" />
                                                            <dx:ListEditItem Text="Titoli senza ranking" Value="1" />
                                                            <dx:ListEditItem Text="Tutti i titoli" Value="2" />
                                                        </Items>
                                                    </dx:ASPxRadioButtonList>
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                        <dx:LayoutItem Caption="Gestore" ColSpan="1">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxGridLookup ID="gridLookupGestore" runat="server" DataSourceID="SqlDSGestori" DropDownStyle="DropDownList" EnableTheming="True" KeyFieldName="Gestore" OnValueChanged="gridLookupGestore_ValueChanged" TextFormatString="{0}" Theme="Aqua">
                                                        <GridViewProperties>
                                                            <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" EnableRowHotTrack="True" />
                                                            <SettingsPager Mode="ShowAllRecords">
                                                            </SettingsPager>
                                                        </GridViewProperties>
                                                        <ClientSideEvents EndCallback="OnFirstEndCallback" />
                                                    </dx:ASPxGridLookup>
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                        <dx:LayoutItem Caption="Consulente" ColSpan="1">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxGridLookup ID="gridLookupConsulente" runat="server" ClientInstanceName="clientgridLookupConsulente" DataSourceID="SqlDSConsulenti" DropDownStyle="DropDownList" EnableTheming="True" KeyFieldName="Consulente" TextFormatString="{0}" Theme="Aqua">
                                                        <GridViewProperties>
                                                            <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" EnableRowHotTrack="True" />
                                                            <SettingsPager Mode="ShowAllRecords">
                                                            </SettingsPager>
                                                        </GridViewProperties>
                                                    </dx:ASPxGridLookup>
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                        <dx:LayoutItem Caption="Linea di Gestione" ColSpan="1">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxGridLookup ID="gridLookupLinea" runat="server" ClientInstanceName="clientgridLookupLinea" DataSourceID="SqlDSLinee" DropDownStyle="DropDownList" EnableTheming="True" KeyFieldName="Linea" TextFormatString="{0}" Theme="Aqua">
                                                        <GridViewProperties>
                                                            <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" EnableRowHotTrack="True" />
                                                            <SettingsPager Mode="ShowAllRecords">
                                                            </SettingsPager>
                                                        </GridViewProperties>
                                                    </dx:ASPxGridLookup>
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                        <dx:LayoutItem Caption="" ColSpan="1">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxButton ID="buttonEsposizioneTitoli" runat="server" OnClick="buttonEsposizioneTitoli_Click" Theme="Aqua">
                                                        <Image IconID="grid_grid_16x16">
                                                        </Image>
                                                    </dx:ASPxButton>
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                        <dx:LayoutItem Caption="" ColSpan="1">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxButton ID="buttonEsportaExcel" runat="server" OnClick="buttonEsportaExcel_Click" Theme="Aqua">
                                                        <Image IconID="export_exporttoxls_16x16">
                                                        </Image>
                                                    </dx:ASPxButton>
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                    </Items>
                                </dx:LayoutGroup>
                            </Items>
                        </dx:ASPxFormLayout>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <dx:ASPxPageControl ID="ASPxPageControl2" runat="server" ActiveTabIndex="0" EnableTheming="True" Theme="Aqua">
                        <TabPages>
                            <dx:TabPage Name="Esposizione Titoli" Text="Esposizione Titoli">
                                <ContentCollection>
                                    <dx:ContentControl runat="server">
                                        <dx:ASPxGridView ID="gvEsposizioneTitoli" runat="server" Theme="Aqua" OnHtmlDataCellPrepared="gvEsposizioneTitoli_HtmlDataCellPrepared" OnHtmlRowPrepared="gvEsposizioneTitoli_HtmlRowPrepared">
                                            <SettingsPager PageSize="20" Mode="ShowAllRecords">
                                            </SettingsPager>
                                            <SettingsDataSecurity AllowDelete="False" AllowEdit="False" AllowInsert="False" />
                                            <SettingsSearchPanel Visible="True" />
                                            <Templates>
                                                <GroupRowContent>
                                                    <%# Eval("Titolo").ToString() %>
                                                    <dx:ASPxButton ID="btnRankingTitoli" runat="server" OnClick="btnRankingTitoli_Click" Theme="Aqua" AutoPostBack="false">
                                                        <Image Url="Images/list.png">
                                                        </Image>
                                                    </dx:ASPxButton>
                                                </GroupRowContent>
                                            </Templates>
                                        </dx:ASPxGridView>
                                        <dx:ASPxPopupControl ID="ASPxPopupControl1" runat="server" ClientInstanceName="popup" ShowHeader="true" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" HeaderText="">
                                            <ContentCollection>
                                                <dx:PopupControlContentControl runat="server">
                                                    <dx:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="0" EnableTheming="True" Theme="Aqua">
                                                        <TabPages>
<%--                                                            <dx:TabPage Name="Ranking Tepilora" Text="Ranking Tepilora">
                                                                <ContentCollection>
                                                                    <dx:ContentControl runat="server">
                                                                        <dx:ASPxLabel ID="ASPxlblTepilora" runat="server" Text="" ClientInstanceName="lblTepilora">
                                                                        </dx:ASPxLabel>
                                                                    </dx:ContentControl>
                                                                </ContentCollection>
                                                            </dx:TabPage>--%>
                                                            <dx:TabPage Name="Ranking MorningStar" Text="Ranking MorningStar">
                                                                <ContentCollection>
                                                                    <dx:ContentControl runat="server">
                                                                        <dx:ASPxLabel ID="ASPxlblMorningstar" runat="server" Text="" ClientInstanceName="lblMorningstar">
                                                                        </dx:ASPxLabel>
                                                                    </dx:ContentControl>
                                                                </ContentCollection>
                                                            </dx:TabPage>
                                                        </TabPages>
                                                    </dx:ASPxPageControl>
                                                </dx:PopupControlContentControl>
                                            </ContentCollection>
                                        </dx:ASPxPopupControl>
                                    </dx:ContentControl>
                                </ContentCollection>
                            </dx:TabPage>
                            <dx:TabPage Name="Controvalori Titoli" Text="Controvalori Titoli">
                                <ContentCollection>
                                    <dx:ContentControl runat="server">
                                        <dx:ASPxGridView ID="gvControvaloreTitoli" runat="server" Theme="Aqua">
                                            <SettingsPager PageSize="20" Mode="ShowAllRecords">
                                            </SettingsPager>
                                            <SettingsDataSecurity AllowDelete="False" AllowEdit="False" AllowInsert="False" />
                                            <SettingsSearchPanel Visible="True" />
                                        </dx:ASPxGridView>
                                    </dx:ContentControl>
                                </ContentCollection>
                            </dx:TabPage>
                        </TabPages>
                    </dx:ASPxPageControl>


                </td>
            </tr>
        </table>

        <%--        <table>
            <tr>
                <td>
                    <dx:ASPxGridView ID="gvControvaloreTitoli" runat="server" Theme="Aqua">
                        <SettingsPager PageSize="20" Mode="ShowAllRecords">
                        </SettingsPager>
                        <SettingsDataSecurity AllowDelete="False" AllowEdit="False" AllowInsert="False" />
                        <SettingsSearchPanel Visible="True" />
                    </dx:ASPxGridView>
                </td>
            </tr>
        </table>--%>
        <dx:ASPxGridViewExporter runat="server" ID="gridviewExporter" GridViewID="gvEsposizioneTitoli"></dx:ASPxGridViewExporter>
        <asp:SqlDataSource ID="SqlDSGestori" runat="server" ConnectionString="Data Source=26.69.45.60;Initial Catalog=FirstSolutionDB;Persist Security Info=True;User ID=sa;Password=Skyline72" SelectCommand="GDN_GPM_Gestori" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:Parameter Direction="ReturnValue" Name="RETURN_VALUE" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDSLinee" runat="server" ConnectionString="Data Source=26.69.45.60;Initial Catalog=FirstSolutionDB;Persist Security Info=True;User ID=sa;Password=Skyline72" SelectCommand="GDN_GPM_Linee1" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:SessionParameter Name="cod_ges" SessionField="cod_ges" />
                <asp:SessionParameter Name="user" SessionField="user" />
                <asp:Parameter Direction="ReturnValue" Name="RETURN_VALUE" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDSConsulenti" runat="server" ConnectionString="Data Source=26.69.45.60;Initial Catalog=FirstSolutionDB;Persist Security Info=True;User ID=sa;Password=Skyline72" SelectCommand="GDN_GPM_Consulenti" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:SessionParameter Name="cod_ges" SessionField="cod_ges" />
                <asp:Parameter Direction="ReturnValue" Name="RETURN_VALUE" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </form>

    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

</body>
</html>


