<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/FiniqAppMasterPage.Master" CodeBehind="OrderSummary_Dashboard.aspx.vb" Inherits="FinIQWebApp.OrderSummary_Dashboard" %>

<%@ Register Src="~/FinIQ_User_Controls/DateControl.ascx" TagPrefix="uc11" TagName="DateControl" %>
<%@ Register Src="~/FinIQ_User_Controls/ShareSearch/UCP_CounterParty_Client.ascx" TagPrefix="uc1" TagName="UCP_CounterParty_Client" %>
<%@ Register Src="~/TradeSummary_Dashboard/UCTimeAT.ascx" TagPrefix="uc1" TagName="UCTimeAT" %>
<%@ Register Src="~/TradeSummary_Dashboard/UC_SmartSearch.ascx" TagPrefix="uc1" TagName="UC_SmartSearch" %>
<%@ Register Src="~/FinIQ_User_Controls/ToggleButton/ToggleButton.ascx" TagPrefix="uc1" TagName="ToggleButton" %>
<%@ Register Src="~/FinIQ_User_Controls/RailwayLine/RailwayLine.ascx" TagPrefix="uc1" TagName="RailwayLine" %>



<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:ScriptManagerProxy ID="ScriptManagerProxy2" runat="server">
    </asp:ScriptManagerProxy>

    <script src="../FinIQJS/SortFilter_Grid.js" type="text/javascript"></script>

     <script src="../FinIQJS/FreezeGrid.js" type="text/javascript"></script>
    <link href="../FinIQJS/FreezeGrid.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .divLoading {
            top: 200px;
        }

        textarea, textarea:disabled {
            width: 550px;
            border: none !important;
            overflow: hidden;
            line-height: 16px !important;
            resize: none;
           /* background-color: #FFFFFF;*/               /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/  
        }

        .GridHeader a:link {
            pointer-events: none !important;
        }


        td.Date > Table {
            display: inline-block;
        }

        td.Date {
            padding-left: 5px;
        }

        [type="radio"] {
            float: left;
            line-height: 20px;
        }

            [type="radio"] + label {
                float: right;
                line-height: 20px;
            }

        .Load {
          /*  background-image: url(../App_Resources/refresh_v2.png);
            border: solid 1px #ddd;
            box-shadow: 0px 2px 2px #ddd;
            background-color: Transparent;*/             /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/
            background-size: 15%;
            background-position: 8px 50%;
            background-attachment: scroll;
            background-repeat: no-repeat;
            width: 120px !important;
            height: 32px;
            border-collapse: collapse;
            border-style: none;
            cursor: pointer;
            vertical-align: middle;
            border-radius: 20px;
            padding-left: 20px;
            line-height: 11px;
           
        }

        .btnClearResults {
            /*background-image: url(../App_Resources/closeMe.png);*/
            /*box-shadow: 0px 2px 2px #ddd;*/
            /*background-color: Transparent;*/
            /*border: solid 1px #ddd;*/                      /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/
            background-size: 15%;
            background-position: 8px 50%;
            background-attachment: scroll;
            background-repeat: no-repeat;
            width: 120px !important;
            height: 32px;
            border-collapse: collapse;
            border-style: none;
            cursor: pointer;
            vertical-align: middle;
            border-radius: 20px;
            padding-left: 20px;
            line-height: 11px;
            
        }

        .btnClearFilters {
           /* background-image: url(../App_Resources/filter_0.png); 
            background-color: Transparent;
            box-shadow: 0px 2px 2px #ddd;
            border: solid 1px #ddd;*/                           /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/  
            background-size: 15%;
            background-position: 8px 50%;
            background-attachment: scroll;
            background-repeat: no-repeat;
            width: 120px !important;
            height: 32px;
            border-collapse: collapse;
            border-style: none;
            cursor: pointer;
            vertical-align: middle;
            border-radius: 20px;
            padding-left: 20px;
            line-height: 11px;
           
        }

        .Search {
            background-image: url(../App_Resources/SearchMB.png);
            background-size: contain;
            background-position: center;
            background-attachment: scroll;
            background-repeat: no-repeat;
            background-color: Transparent;
            width: 32px !important;
            height: 32px;
            border-collapse: collapse;
            border-style: none;
            cursor: pointer;
        }

        .Export2Excel {
           /* background-image: url(../App_Resources/Export2Excel.png);*/           
            /*background-color: Transparent;*/                                  /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/  
           background-size: initial;
            background-position: center;
            background-attachment: scroll;
            background-repeat: no-repeat;
            width: 52px !important;
            height: 29px;
            border-collapse: collapse;
            border-style: none;
            cursor: pointer;
            padding: 10px;
        }

        .Export2PDF {
            /*background-image: url(../App_Resources/Pdf.png);*/
            /*background-color: Transparent;*/                                  /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/  
            background-size: initial;
            background-position: center;
            background-attachment: scroll;
            background-repeat: no-repeat;
            width: 52px !important;
            height: 29px;
            border-collapse: collapse;
            border-style: none;
            cursor: pointer;
            padding: 10px;
        }

        .rightAlign {
            text-align: right;
        }

        #trFilterPane {
            display: none;
        }

        .GridHeader th {
            text-transform: capitalize;
        }

        .btnNextPrev, .btnNextPrev:disabled {
          border-style: none  !important;
            height: 25PX  !important;
            width: 40PX  !important;
            /*background-color: #ffffff !important;*/
            /*color: #0368B6 !important;*/              /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/  
            font: normal 14px Verdana, Helvetica, sans-serif, Montserrat;
            
        }
        /*        input[type="submit"]:not(.btn1)[disabled="disabled"], input[type="button"]:not(.LPDisableLink)[disabled="disabled"], .btnDisabled {
                    border-style: none  !important;
                    height: 25PX  !important;
                    width: 40PX  !important;
                    background-color: #ffffff !important;
                    font: normal 14px Verdana, Helvetica, sans-serif, Montserrat;
                    color: #0368B6 !important;
        }*/                                                     /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/  
        .GridItem td:nth-child(6) {
            word-break: keep-all;
            word-wrap: break-word;
            white-space: pre-wrap;
        }

        .rblActiveDeals {
            border-collapse: collapse;
            border-spacing: 0px;
        }

            .rblActiveDeals td {
                border-collapse: collapse;
                border-spacing: 0px;
                padding: 0px;
                /*border: solid 1px #ccc;*/             /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/
            }

            .rblActiveDeals [type="radio"] {
                display: none;
            }

                .rblActiveDeals [type="radio"] + label {
                    float: right;
                    line-height: 21px;
                    display: inline-block;
                    width: 92px;
                    text-align: center;
                    padding: 2px;
                    border-radius: 0px;
                   /* background-color: #ffffff;
                    color: #000;
                    box-shadow: none;
                    background: linear-gradient(to bottom, #ffffff, #eaeaea);*/                          /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/
                }

            /*    .rblActiveDeals [type="radio"]:checked + label {
                    background-color: #ffffff;
                    color: #000;
                    border-left: none 0px #a7a7a7;
                    background: linear-gradient(to bottom, #ffffff, #ffffff);
                    box-shadow: none;
                }*/                                                                                      /*Commneted By RizwanS for common css use / JIRA ID:MASINT 2044 * / 24 Sep 2021*/

        .txtPageNum {
            width: 50px;
            text-align: center;
            line-height: 18px;
        }
    </style>

    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"
        DisplayAfter="0">
        <ProgressTemplate>
            <div class="divLoading">
                <img alt="Loading" src="../App_Resources/loading.gif" style="width:60px;" /><span class="lbl">
            </div>
            </span>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <table cellpadding="5px" cellspacing="5px">
        <tr>
            <td class="TSD_td" style="box-sizing: border-box; width: 99vw;  border-collapse: collapse; ">
                <asp:UpdatePanel runat="server" ID="UpdatePanel1" ChildrenAsTriggers="true" UpdateMode="Conditional">
                    <ContentTemplate>
                        <table class="Step1" style="box-sizing: border-box; border: solid 0px #ddd; border-collapse: collapse; margin-bottom: 0px;" cellpadding="5px" cellspacing="5px">
                            <tr>
                                <td>
                                    <input type="button" id="btnSerch" onclick="javascript: $('#trFilterPane').toggle('slow');" value="" class=" Search" title="Show Filters" /></td>
                                <td style="width: 150px;">
                                    <label id="btnPageSize" class="lbl RecordsPerPage" title="Page Size">Records Per Page </label>
                                    <asp:TextBox ID="txtRecordsPerPage" CssClass="txt rightAlign" runat="server" Text="10" Width="35px"
                                        MaxLength="3"></asp:TextBox>
                                </td>
                               <td style="width: 210px;" class="chkTheme1">
                                    <asp:CheckBox ID="chkRefresh"  runat="server" AutoPostBack="true" Text="Auto Refresh " />&nbsp;
                                    <asp:TextBox ID="txtRefreshFreq" CssClass="txt rightAlign" runat="server" Text="60" Width="33px" MaxLength="5"></asp:TextBox>
                                    Sec.
                                </td>
                                <td>
                                    <asp:Button runat="server" ID="btnExcel1" Text="" CssClass="Export2Excel" ToolTip="Export Excel" />
                                </td>
                                <td>
                                    <asp:Button runat="server" ID="btnPDF1" Text="" CssClass="Export2PDF" ToolTip="Export PDF" />
                                </td>

                                <td style="display:none">
                                     <asp:Timer ID="Timer1" runat="server" Enabled="FALSE" Interval="100" OnTick="Timer1_Tick"></asp:Timer>
                                </td>
                            </tr>
                        </table>

<table>
                <tr>
                    <td style="width: 700px;">
                        <table>
                            <tr>
                                <td style="white-space: nowrap;">
                                    <asp:Button ID="btnPrev" runat="server" Text="<<" CssClass="btnNextPrev" />
                                    <asp:TextBox ID="txtpageno" runat="server" Text="1" MaxLength="6" min="1" TextMode="Number" CssClass="txtPageNum" AutoPostBack="true"></asp:TextBox>
                                    <asp:Button ID="btnNext" runat="server" Text=">>" CssClass="btnNextPrev" />
                                </td>
                                <td>
                                    <asp:Label runat="server" ID="lblRecordCount" CssClass="lblInfo" Text=""></asp:Label>       <%--Changed By RizwanS for default lblerror to lblinfo / JIRA ID:MASINT 2044 * / 24 Sep 2021--%> 
                                    <asp:HiddenField ID="hdnRowCount" Value="" runat="server" />
                                </td>

                                <td style="padding-left: 20px;">
                                    <asp:Button runat="server" ID="btnClearResults" Text="Clear Results" ToolTip="Clear Results" CssClass="btnClearResults" />
                                    <asp:Button runat="server" ID="btnClearFilters" Text="Clear Filters" ToolTip="Clear Filters" CssClass="btnClearFilters" OnClientClick="ClearFilters1();" />
                                    <asp:Button runat="server" ID="btnLoad" Text="Show Results" ToolTip="Show Results" CssClass="Load" />
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtNotification" TextMode="MultiLine" Rows="2" CssClass="lblInfo" Width="550px" Enabled="false"></asp:TextBox>
                         <%--Changed By RizwanS for default lblerror to lblinfo / JIRA ID:MASINT 2044 * / 24 Sep 2021--%> 
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                </table>
                    </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="btnExcel1" />
                        <asp:PostBackTrigger ControlID="btnPDF1" />
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td>&nbsp;</td>
        </tr>
        <tr id="trFilterPane">
            <td>
                <asp:UpdatePanel runat="server" ID="upFilter" ChildrenAsTriggers="false" UpdateMode="Conditional" EnableViewState="true">
                    <ContentTemplate>
                        <table>

                            <tr>
                                <td>
                                    <table class="#Step2" style="box-sizing: border-box; border-spacing: 0px;" cellpadding="0"
                                        cellspacing="5" border="0">
                                        <tr>
                                            <td style="width: 180px;" class="chkTheme1">
                                                <input type="checkbox" id="chkTradeDate" runat="server" checked="checked" />
                                                <asp:Label runat="server" ID="lblTradeDate" AssociatedControlID="chkTradeDate" CssClass="lblWidth" Text="Trade Date"></asp:Label>
                                            </td>
                                            <td class="Date">
                                                <table cellpadding="0" cellspacing="5" border="0">
                                                    <tr>
                                                        <td>
                                                            <uc11:DateControl DateFormat="dd-NNN-yyyy" DoPostBack="false" runat="server" ID="dtpFromTradeDate" CalenderCss="btn1" TextBoxSize="98" />
                                                        </td>
                                                        <td style="width: 30px; text-align: center;">To</td>
                                                        <td>
                                                            <uc11:DateControl DateFormat="dd-NNN-yyyy" DoPostBack="false" runat="server" ID="dtpToTradeDate" CalenderCss="btn1" TextBoxSize="98" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr style="height: 40px;">
                                            <td style="width: 180px; height: 40px;" class="chkTheme1">
                                                <asp:CheckBox ID="chkActiveDeal" runat="server" AutoPostBack="false" Checked="true" />
                                                <asp:Label runat="server" ID="lblActiveDeal" AssociatedControlID="chkActiveDeal" CssClass="lblWidth" Text="Active Deal"></asp:Label>
                                            </td>
                                            <td class="Date">
                                                <asp:RadioButtonList RepeatColumns="3" RepeatDirection="Horizontal" RepeatLayout="Table" runat="server" ID="rblActiveDeals" CssClass="rblActiveDeals" CellPadding="2" CellSpacing="0" BorderWidth="0px">
                                                    <asp:ListItem Text="All" Value="" Selected="True"></asp:ListItem>
                                                    <asp:ListItem Text="Yes" Value="Y"></asp:ListItem>
                                                    <asp:ListItem Text="No" Value="N"></asp:ListItem>
                                                </asp:RadioButtonList>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <uc1:UC_SmartSearch runat="server" ID="UC_SmartSearch_DEAL_FACING" labelText="DealFacing"
                                                    SetMode="DEAL_FACING" SetLabelWidth="180" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <uc1:UC_SmartSearch runat="server" ID="UC_SmartSearch_ClientCounterparty" labelText="Client/Counterparty Ref"
                                                    SetMode="CUSTOMER" SetLabelWidth="180" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <uc1:UC_SmartSearch runat="server" ID="UC_SmartSearch_ProductType" labelText="Product Type" SetMode="PRODUCT_TYPE" SetLabelWidth="180" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <uc1:UC_SmartSearch runat="server" ID="UC_SmartSearch_Product" labelText="Product" SetMode="PRODUCT" SetLabelWidth="180" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <uc1:UCTimeAT runat="server" ID="UC_QuotedAt" labelText="Product Quoted At" ChkBoxList="<11|11 -1|1 -3|>3"
                                        SetLabelWidth="180" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <uc1:UCTimeAT runat="server" ID="UC_OrderPlacedAt" labelText="Order Placed At" ChkBoxList="<11|11-1|1-3|>3"
                                        SetLabelWidth="180" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <uc1:UCTimeAT runat="server" ID="UC_TradeVerifiedAt" labelText="Trade Verified At" ChkBoxList="<11|11-1|1-3|>3"
                                        SetLabelWidth="180" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <uc1:UC_SmartSearch runat="server" ID="UC_CcyRef" labelText="Ccy Ref." SetMode="CCY"
                                        SetLabelWidth="180" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <uc1:UC_SmartSearch runat="server" ID="UC_EntityRef" labelText="Entity Ref." SetMode="ENTITY"
                                        SetLabelWidth="180" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <uc1:UC_SmartSearch runat="server" ID="UC_BookRef" labelText="Book Ref." SetMode="BOOK"
                                        SetLabelWidth="180" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <uc1:UC_SmartSearch runat="server" ID="UC_RMRef" labelText="RM Ref." SetMode="RM"
                                        SetLabelWidth="180" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <uc1:UCTimeAT runat="server" ID="UC_Revenue" labelText="Revenue" ChkBoxList="<100|100-500|500-1000|>1000"
                                        SetLabelWidth="180" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <uc1:UCTimeAT runat="server" ID="UC_TradeSize" labelText="Trade Size" ChkBoxList="<100k|100k-500k|500k-2M|>2M"
                                        SetLabelWidth="180" />
                                </td>
                            </tr>
                        </table>


                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>



    <asp:UpdatePanel runat="server" ID="UpdatePanel2" ChildrenAsTriggers="true" UpdateMode="Conditional">
        <ContentTemplate>
            
            <table>
                <tr>
                    <td colspan="2">

                        <asp:GridView ID="gdvTradeSummary" runat="server" AllowPaging="True" AllowSorting="True"
                            AutoGenerateColumns="true" BorderStyle="None" BorderWidth="0px" CellPadding="3" ShowHeaderWhenEmpty="true" UseAccessibleHeader="true"
                            CssClass="Grid" EmptyDataText="Record Count : 0">
                            <SelectedRowStyle CssClass="GridItemSelect" />
                            <RowStyle CssClass="GridItem" Wrap="false" />
                            <HeaderStyle CssClass="GridHeader" />
                            <FooterStyle CssClass="GridFooter" />
                            <PagerStyle CssClass="GridPager" />

                            <Columns></Columns>

                        </asp:GridView>


                    </td>
                </tr>
            </table>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger EventName="Click" ControlID="btnLoad" />
        </Triggers>
    </asp:UpdatePanel>
    <script type="text/javascript">

        $(document).ready(function () {
            try {
                freezeCols = 0;
                 
                $('#ctl00_MainContent_rblActiveDeals').prop("disabled", $(event.currentTarget).is(':checked') ? false : true);
                if (!$('#ctl00_MainContent_chkActiveDeal').is(':checked')) {
                    $('#ctl00_MainContent_rblActiveDeals_0').checked();
                    $('#ctl00_MainContent_rblActiveDeals_0').prop("checked", true).attr("checked", "checked");
                    $('#ctl00_MainContent_rblActiveDeals').hide();
                }
                else {
                    $('#ctl00_MainContent_rblActiveDeals').show('slow');
                }

                $('#ctl00_MainContent_chkActiveDeal').on('click', function (event) {
                    
                    if (!$('#ctl00_MainContent_chkActiveDeal').is(':checked')) {
                        $('#ctl00_MainContent_rblActiveDeals_0').trigger('click');
                        $('#ctl00_MainContent_rblActiveDeals_0').prop("checked", true).attr("checked", "checked");
                        $('.rblActiveDeals').find('[type="radio"]').prop("disabled", true).attr("disabled", "disabled").css({ "pointer-events": "none;" });
                        $('#ctl00_MainContent_rblActiveDeals').hide('slow');
                    }
                    else {
                        $('.rblActiveDeals').find('[type="radio"]').prop("disabled", false).removeAttr("disabled").css({ "pointer-events": "All;" });
                        $('#ctl00_MainContent_rblActiveDeals').show('slow');

                    }
                });

                $('[id$="lblRecordCount"]').text("Total Record/s Count : " + $('[id$="hdnRowCount"]').val());
                SetSorting_Filter1();
            } catch (er) { }



            $(".txtPageNum").keypress(function (e) {
                //if the letter is not digit then display error and don't type anything
                if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {

                    return false;
                }
            });

        });

        function HideFilters() {
            try {

                $('#trFilterPane').hide('slow');

            }
            catch (er) {
            }
        }

        function ClearFilters2() {
            $(document).ready(function () {
                cFilters = $(".ClearFilters")[0];
                ClearFilters1(cFilters, 'All')
                
            });  
        }

    </script>
</asp:Content>
