<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="FinIQ_Workflow_QueueStatistics.aspx.vb" Inherits="FinIQWebApp.FinIQ_Workflow_QueueStatistics"
    MasterPageFile="~/FiniqAppMasterPage.Master" Title="Workflow Queue Statistics" %>

<%@ Register Src="../FinIQ_User_Controls/DateControl.ascx" TagName="DateControl" TagPrefix="uc1" %>
<%@ Register Src="~/Workflow/Trade_Workflow_Blotter_CTL.ascx" TagPrefix="ucWorkflow" TagName="WorkFlowControl" %>


<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy11" runat="server">
    </asp:ScriptManagerProxy>
    <script src="../FinIQJS/SortFilter_Grid.js"></script>
    <%--28-Aug-2020 | Rajeshree Kathariya | Calling FreezeGrid JS--%>
    <script src="../FinIQJS/FreezeGrid.js"></script>
    <script src="../FinIQJS/WorkflowGlobal.js"></script>
	<link href="../FinIQJS/FreezeGrid.css" rel="stylesheet" type="text/css"/>
    <asp:UpdatePanel ID="updatepanel1" runat="server">
        <ContentTemplate>
            <style>
                /*28-Oct-2021|Added ruby Rajeshree k for*/ 
                .ExportToExcel {
                    outline: 0 !important;
                    background-repeat: no-repeat;
                    height: 32px;
                    width: 50px;
                    cursor: pointer;
                    margin-left: 10px;
                }
                .pnlGraph {
                    height: 470px;
                    width: 841px !important;
                    position: fixed;
                    top: 30%;
                    left: 35%;
                    border: ridge 1px lightgray;
                    display: inline-block;
                    /*overflow: auto;*/
                   /* background-color: rgb(0,0,0);
                    background-color: rgba(0,0,0,0.4);
                    background-color: #FFFFFF;
                    background-color: rgb(255, 255, 255);*/
                    padding: 10px;
                    border-radius: 12px;
                    min-height: 500px !important;
                    box-shadow: rgb(0, 0, 0) 0px 0px 10px;
                    z-index: 10;
                }

                .btnclose {
                    height: 20px;
                    width: 20px;
                    position: absolute;
                    left: 828px;
                    top: 10px;
                }


                .modalBackground {
                    background-color: Gray;
                    filter: alpha(opacity=80);
                    opacity: 0.8;
                    z-index: 10000;
                }

                .modalPopup {
                    /*background-color: #FFFFFF;
                    border-width: 2px;
                    border-style: ridge;
                    border-color: lightgray;
                    padding-top: 10px;
                    padding-left: 10px;
                    margin-left: auto;
                    margin-right: auto;*/
                }

                .labelsCal {
                    width: 150px;
                }

                .btn, .btn:hover {
                    text-align: left !important;
                    outline: none !important;
                }

                .CollpseCSS {
                    font-size: 18px;
                    padding: 10px 10px 10px 10px;
                    border-radius: 2px 2px 2px 2px;
                    border-bottom-left-radius: 2px;
                    border-bottom-right-radius: 2px;
                    /*7-Dec-2021 | Commented by Rajeshree K for OCBCGWPINT-1177*/
                    /*height: 40px;*/
                    margin-top: 5px;
                    width: 100% !important;
                    min-width: 1880px !important;
                    text-align: left;
                    letter-spacing: normal;
                    border-collapse: collapse;
                    border: none;
                    outline: none !important;
                }

                .btn, .btn:hover {
                    text-align: center !important;
                }

                .ui-dialog {
                    position: absolute !important;
                    /*top: 107px !important;
                    left: 100px !important;*/
                }

                .Grid1 td, .Grid th {
                    font-weight: normal !important;
                    background-repeat: no-repeat;
                    background-position: right top;
                    /*padding: 5px !important;*/ /*Commented by Arati K for Grid alignment issue || 21-jul-2020*/
                    padding-right: 20px !important;
                }

                .btnSearch {
                    vertical-align: bottom;
                }

                .Toggle_EmptyQ {
                    border-radius: 5px;
                    border: solid 1px #dddddd;
                    word-wrap: break-word;
                    white-space: normal;
                }

                .hideToggle_EmptyQ, .showToggle_EmptyQ, .TabView, .LinkView {
                    width: 126px;
                    height: 24px;
                    border: none 0px #FFF !important;
                    color: #FFF !important;
                    outline: 0 !important;
                    background-color: #FFFFFF;
                    background-repeat: no-repeat;
                    opacity: 0.7;
                }

                    .hideToggle_EmptyQ:focus, .showToggle_EmptyQ:focus, .TabView:focus, .LinkView:focus, .hideToggle_EmptyQ:active, .showToggle_EmptyQ:active, .TabView:active, .LinkView:active, .hideToggle_EmptyQ:hover, .showToggle_EmptyQ:hover, .TabView:hover, .LinkView:hover {
                        outline: 0 !important;
                        border: none 0px #FFF !important;
                    }

                .showToggle_EmptyQ {
                    background-image: url("../App_Resources/Hidden_show.png");
                }

                .hideToggle_EmptyQ {
                    background-image: url("../App_Resources/Hide_shown.png");
                }

                .hidden {
                    display: none;
                }



                .ui-widget-overlay {
                    background: #000 !important;
                    opacity: .3 !important;
                }

                .ui-dialog .ui-dialog-titlebar, .ui-dialog .ui-dialog-titlebar .ui-widget {
                    background-image: none !important;
                    background-color: #fff !important;
                    color: #000000 !important;
                    border: none;
                }

                .ui-selectmenu-button, .ui-widget, .ui-state-default, .ui-corner-all {
                    border-radius: 8px !important;
                }

                .ui-dialog .ui-dialog-titlebar-close span {
                    background-color: #fff !important;
                    color: #000000 !important;
                }

                .ui-widget.ui-widget-content {
                    z-index: 9999999 !important;
                    box-shadow: 0 0 10px #000000;
                    padding: 0px;
                    max-width: none !important;
                    overflow: hidden;
                    position: fixed !important;
                }

                .personalSetting {
                    background-color: white;
                    color: #0284E0;
                    border: white;
                    cursor: pointer;
                    /*width: 114px  !important;*/
                }
            </style>
            <%--16-Oct-20 | Rajeshree K | To handle UCP-181--%>
            <table>
                <tr>
                    <td>
                        <asp:Button ID="btnWorkflowReport" UseSubmitBehavior="false" runat="server" Text="Summary" CssClass="CollpseCSS " />
                    </td>
                </tr>
            </table>
            <table style="padding-top: 10px; padding-bottom: 10px;">
                <tr>
                    <td>
                        <asp:Label ID="lblError" runat="server" Text="" CssClass="lbl" Style="color: red !important"></asp:Label>
                    </td>
                    <td style="padding-left: 30px;">
                        
                    </td>
                </tr>
                <tr>
                    <%--START | 28-Oct-2021 | Modified by Rajeshree K for MASINT-2290--%>
                    <td>
                        <asp:Label ID="lblEntity" runat="server" CssClass="lbl" Text="Entity"></asp:Label>
                        <asp:DropDownList ID="ddlEntity" CssClass="ddl" AutoPostBack="true" runat="server" Width="200px">
                        </asp:DropDownList>
                    </td>


                    <td style="padding-left: 20px;padding-bottom: 18px;">
                        <div>
                            <button type="button" id="btnYear" class="personalSetting" onclick="dateRangeValueSelector('Year','navigator')">Y</button>
                            <button type="button" id="btnMonth" class="personalSetting" onclick="dateRangeValueSelector('Month','navigator')">M</button>
                            <button type="button" id="btnWeek" class="personalSetting" onclick="dateRangeValueSelector('Week','navigator')">W</button>
                            <button type="button" id="btnDay" class="personalSetting" onclick="dateRangeValueSelector('Day','navigator')">D</button>
                        </div>

                        <uc1:DateControl ID="txtFromDateQ" runat="server" CalenderCss="btn1" TextBoxCss="txt" TabIndex="0"/>
                    </td>
                    <%--  <asp:Textbox ID="txtFromDate" runat="server" CssClass="txt"></asp:Textbox >--%>
                    <td style="width: 10PX !important; padding: 10px">
                        <asp:Label ID="lblToDate" Text="To" runat="server" CssClass="lbl"></asp:Label>
                    </td>
                    <%--<asp:Textbox ID="txtToDate" runat="server" CssClass="txt"></asp:Textbox>--%>
                    <td>
                        <uc1:DateControl ID="txtToDateQ" runat="server" CalenderCss="btn1" TextBoxCss="txt" TabIndex="1" />
                        <%-- </asp:Panel>--%>
                    </td>






                    <td>
                        <asp:Label ID="lbldealsearch" runat="server" Text="Ref ID" CssClass="lbl" Visible="false"></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtSearch" runat="server" Width="200px" CssClass="txt" AutoPostBack="true" Visible="false"></asp:TextBox>
                        <asp:Button ID="BtnSearch" runat="server" CssClass="btnSearch" Visible="false" />
                    </td>
                    <td style="padding-left: 10px;">
                        <asp:Label ID="lblWorkflow" Text="Workflow/ Queue" runat="server" CssClass="lbl" Width="55px" Style="white-space: break-spaces !important;"></asp:Label>
                    </td>
                    <td>
                        <%--Start | 29-Oct-2021 | Added by Rajeshree K for MASINT-2290--%>
                        <asp:TextBox ID="txtworkflow" runat="server" CssClass="txt" Width="220px" AutoPostBack="true" onkeydown="return searchIfEnterKey(event)"></asp:TextBox>

                    </td>
                    
                    <td style="padding-left: 10px;">
                        <asp:Label ID="lblRefId" Text="Ref ID" runat="server" CssClass="lbl"></asp:Label>
                    </td>
                    <td>

                        <asp:TextBox ID="txtRefId" runat="server" CssClass="txt" Width="220px" AutoPostBack="true" onkeydown="return searchIfEnterKey(event)"></asp:TextBox>
                        <%--END | 29-Oct-2021 | Added by Rajeshree K for MASINT-2290--%>
                    </td>
                    <td style="padding-left: 10px;">
                        <asp:Button ID="btnLoad" Text="Load" runat="server" Width="80px" CssClass="btn" TabIndex="2"></asp:Button>

                    </td>
                    <td style="padding-left: 10px;">
                        
                        <asp:Button ID="BtnExport" runat="server" CssClass="ExportToExcel" />
                    </td>
                    <%--<td style="width: 4px"></td>--%>
                    <td>
                        <asp:Button ID="btnView" runat="server" Text="View" Visible="false"></asp:Button>
                    </td>
                    <td style="padding-left: 20px;">
                        <asp:Label ID="lblShowEmptyQueues" runat="server" Text="Empty Queues" CssClass="lbl" Width="40px" Style="white-space: break-spaces !important;"></asp:Label>
                    </td>

                    <td>
                        <table border="0" class="">
                            <tr>
                                <td style="min-width: 130px; border: none">
                                    <asp:Button runat="server" ID="btnShow_EmptyQ" Text="" class="showToggle_EmptyQ" />
                                    <asp:Button runat="server" ID="btnHide_EmptyQ" Text="" class="hideToggle_EmptyQ" Visible="false" />
                                </td>
                            </tr>
                        </table>

                    </td>
                    <td style="padding-left: 20px;">
                        <asp:Button ID="btnDensityChart" runat="server" Text="View Density Chart" CssClass="btn" Width="130px" Visible="true" />
                    </td>
                    <%--END | 28-Oct-2021 | Modified by Rajeshree K for MASINT-2290--%>

                    <!-- Added by Rajeshree on 22nd Nov 2019 for opening Workflow using data on Queue Density Bubble Chart -->
                    <td>
                        <asp:Button ID="hdnBtnWorkFlowFromQueueDensity" runat="server" CssClass="hidden" />
                        <asp:HiddenField ID="hfWF_ID" runat="server" ClientIDMode="Static" />
                        <asp:HiddenField ID="hfQueueId" runat="server" ClientIDMode="Static" />
                        <asp:HiddenField ID="hfFromDate" runat="server" ClientIDMode="Static" />
                        <asp:HiddenField ID="hfToDate" runat="server" ClientIDMode="Static" />
                        <asp:HiddenField ID="hdn_WebsocketIP" runat="server" />
                        <!-- Added by Mitali on 25-Jun-2020|For workflow refresh changes-->
                    </td>

                </tr>
            </table>
            <table id="alltabdata" runat="server">
                <%--                <tr>
                    <td>
                        <asp:Button ID="btnWorkflowReport" UseSubmitBehavior="false" runat="server" Text="Summary" CssClass="CollpseCSS " />
                    </td>
                </tr>--%>
                <tr>
                    <td>
                        <asp:Panel runat="server" ID="pnlsummary" Visible="true">
                            <div>
                                <table>
                                    <tr>
                                        <td>
                                            <%--28-Aug-2020 | Rajeshree Kathariya | Removed NoFreeze class--%>
                                            <asp:GridView ID="gvWorkflowQueueStatistics" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                                                BorderStyle="None" BorderWidth="0" CellPadding="3" CssClass="Grid Gridview noFilter" AllowPaging="false" ShowHeaderWhenEmpty="true" HeaderStyle-CssClass="GridHeaderTitle">
                                                <HeaderStyle CssClass="GridHeader" />
                                                <RowStyle CssClass="GridItem" />

                                                <FooterStyle CssClass="GridFooter" />

                                                <EmptyDataTemplate>
                                                    <asp:Label ID="lblWorkflowQueueStatisticsGrid" runat="server" Text="No data found..."></asp:Label>
                                                </EmptyDataTemplate>

                                                <Columns>

                                                    <asp:TemplateField HeaderStyle-Wrap="True" HeaderText="Serial No" Visible="false">
                                                        <ItemStyle Width="30px" HorizontalAlign="right" />
                                                        <HeaderStyle Width="30px" />

                                                        <ItemTemplate>
                                                            <asp:Label ID="lblSer" runat="server" Text='<%#Container.DataItemIndex + 1%>' />
                                                        </ItemTemplate>


                                                    </asp:TemplateField>

                                                    <%--                                                    <asp:TemplateField>
                                                        <ItemTemplate>
                                                            <asp:Chart ID ="chartbubble" runat="server"  ItemType="AjaxControlToolkit.AreaChartSeries"  Width ="800" Height="500" Transitions="True" style="animation-duration:20s;transition:linear;position:absolute;grid-cell:none;"></asp:Chart>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>--%>

                                                    <asp:TemplateField HeaderStyle-Wrap="True" HeaderText="WTM ID" Visible="false">
                                                        <ItemStyle Width="50px" HorizontalAlign="Right" />
                                                        <HeaderStyle Width="50px" />

                                                        <ItemTemplate>
                                                            <asp:Label ID="WF_ID" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WTM_ID").ToString)%>' />
                                                        </ItemTemplate>

                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderStyle-Wrap="True" HeaderText="Workflow" Visible="true">
                                                        <ItemStyle Width="200px" HorizontalAlign="Left" />
                                                        <HeaderStyle Width="200px" />

                                                        <ItemTemplate>
                                                            <%--<asp:Label ID="lblID2" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WTM_Title").ToString)%>' />--%>
                                                            <asp:LinkButton ID="linkBtnWTMTitle" runat="server" CommandName="Workflow" CommandArgument='<%# Container.DataItemIndex%>' Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WTM_Title").ToString)%>'></asp:LinkButton>
                                                        </ItemTemplate>

                                                    </asp:TemplateField>


                                                    <asp:TemplateField HeaderStyle-Wrap="True" HeaderText=" QM ID" Visible="False">
                                                        <ItemStyle Width="300px" HorizontalAlign="Right" />
                                                        <HeaderStyle Width="300px" />

                                                        <ItemTemplate>
                                                            <asp:Label ID="Queue_Id" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.QM_ID").ToString)%>' />
                                                        </ItemTemplate>

                                                    </asp:TemplateField>


                                                    <asp:TemplateField HeaderStyle-Wrap="True" HeaderText="Queue" Visible="true">
                                                        <ItemStyle HorizontalAlign="Left" />
                                                        <HeaderStyle />

                                                        <ItemTemplate>
                                                            <%--<asp:Label ID="lblID4" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.QM_Name").ToString)%>' />--%>
                                                            <asp:LinkButton ID="linkBtnQMName" runat="server" CommandName="Queue" CommandArgument='<%# Container.DataItemIndex%>' Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.QM_Name").ToString)%>'></asp:LinkButton>
                                                        </ItemTemplate>

                                                    </asp:TemplateField>


                                                    <asp:TemplateField HeaderStyle-Wrap="True" HeaderText=" Count " Visible="true">
                                                        <ItemStyle Width="50px" HorizontalAlign="Center" />
                                                        <HeaderStyle Width="50px" />

                                                        <ItemTemplate>
                                                            <asp:Label ID="lblID5" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Count").ToString)%>' />
                                                        </ItemTemplate>

                                                    </asp:TemplateField>


                                                    <asp:TemplateField HeaderStyle-Wrap="True" HeaderText=" Queue Chart" Visible="true">
                                                        <ItemStyle Width="150px" HorizontalAlign="Center" />
                                                        <HeaderStyle Width="150px" />

                                                        <%--<ItemTemplate >
                                        <asp:Label ID="lblID6" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.QueueChart").ToString)%>' />
                                    </ItemTemplate>--%>

                                                        <ItemTemplate>
                                                            <asp:LinkButton ID="linkBtnQueueChart" runat="server" CommandName="QueueChart" CommandArgument='<%#Container.DataItemIndex %>' Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.QueueChart").ToString)%>'></asp:LinkButton>
                                                        </ItemTemplate>

                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderStyle-Wrap="True" HeaderText=" Workflow Graph " Visible="true">
                                                        <ItemStyle Width="150px" HorizontalAlign="Center" />
                                                        <HeaderStyle Width="150px" />

                                                        <ItemTemplate>
                                                            <%--<asp:Label ID="lblID7" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WorkflowGraph").ToString)%>' />--%>
                                                            <asp:LinkButton ID="linkBtnWorkflowGraph" runat="server" CommandName="WorkflowGraph" CommandArgument='<%# Container.DataItemIndex%>' Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WorkflowGraph").ToString)%>'></asp:LinkButton>
                                                        </ItemTemplate>

                                                    </asp:TemplateField>

                                                </Columns>
                                            </asp:GridView>

                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </td>
                </tr>
                <tr>
                    <td style="padding-top: 20px;">
                        <%--7-Dec-2021 | Changed button to label | Rajeshree K for OCBCGWPINT-1177--%>
                        <%--<asp:Button ID="ButtonWorkflowControl" autopostback="false" runat="server" Text="Workflow" CssClass="CollpseCSS"/>--%>
                        <asp:Label ID="lblWorkflowControl" runat="server" Text="Workflow" CssClass="CollpseCSS" Style="display:block;pointer-events: none;" />  <%--Added by Arati k || 12-Jan-2022 || INT1FINFXC-257--%>

                    </td>
                </tr>

                <tr>
                    <td>
                        <div class="none">
                            <asp:Panel runat="server" ID="pnlAjaxWorkflow" Visible="false">
                                <div>

                                    <asp:Panel ID="pnlWorkFlow" runat="server" EnableViewState="true" > <%--scrollbars removed by Arati K || 17-Nov-2021 || INT1FIN47-244--%>

                                        <ucWorkflow:WorkFlowControl runat="server" ID="workflowControl" Visible="true" EnableViewState="true" Mode="2" />

                                    </asp:Panel>
                                </div>
                            </asp:Panel>
                        </div>
                    </td>
                </tr>
                <%----------------------------------------------------------------------------------------------------------------------%>
                <%----------------------------------------Workflow Queue Statistics Grid --------------------------------------%>
            </table>

            <asp:Panel ID="pnlgraph" runat="server" CssClass="pnlGraph modalPopup" BackgroundCssClass="modalBackground" align="center" Visible="false">
                <table>
                    <tr>
                        <td>
                            <div class="modal-content">
                                <asp:PlaceHolder ID="chartPlaceHolder" runat="server"></asp:PlaceHolder>
                            </div>
                        </td>
                        <td>
                            <%-- <asp:Button ID="btnclose" runat="server" display="none"/>--%>
                            <%--Added By Arati on 24-Jan-2020 --%>
                            <asp:ImageButton ID="ImageButton1" ImageUrl="../App_Resources/close_btn.png" Width="20" Height="20" CssClass="btnclose" ImageAlign="Right" AlternateText="No Image available" runat="server" />
                        </td>
                    </tr>
                </table>



            </asp:Panel>


        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnExport" />
        </Triggers>

    </asp:UpdatePanel>

    <script type="text/javascript">
        /*29-Oct-2021 | Added by Rajeshree K for MASINT-2290 */
        function searchIfEnterKey(evt)
        {
            
            if (evt == null) {
                evt = window.event;
            }
            var key = parseInt(evt.keyCode, 10);
            /*7-Dec-2021 | Rajeshree K | OCBCGWPINT-1177*/
            if (key == 13 || key==9) {
                debugger
                $("#<%=btnLoad.ClientID%>").click();
            }
        }

        function draggable() {
            try {

                $(function () {

                    $("#<%=pnlgraph.ClientID%>").draggable();

                });
            }
            catch (error) {
                console.log("Error: " + error);
            }
        }





        function OpenEmbeddedPopUp_QS(PageName, POPUPWidth, POPUPHeight) {
            try {

                console.log(PageName);
                $('body').find("#ModalBoxInside112").remove();
                $('body').append('<div id="ModalBoxInside112" title="Workflow Graph" style="top:0px; left:0px;width:' + POPUPWidth + 'px !important;height:' + POPUPHeight + 'px !important"><iframe id="ifrm11" frameborder="0" width="' + POPUPWidth + 'px " height="' + POPUPHeight + 'px " Src=' + PageName + '&Master_Popup=POPUP></iframe></div>')
                //$('body').append('<div id="ModalBoxInside112" title="Filter, Sorting, Action Link and Data Type Settings: ' + templateName + '" style="font:bold; overflow-y: unset !important;  width:' + POPUPWidth + 'px !important;height:' + POPUPHeight + 'px !important; " ><iframe id="ifrm11" frameborder="0" width="' + POPUPWidth + 'px " height="' + POPUPHeight + 'px " Src=' + PageName + '></iframe></div>')
                $('body').find("#ModalBoxInside112").dialog({
                    modal: true,
                    autoOpen: true,
                    width: POPUPWidth,
                    height: POPUPHeight,
                    open: function (event, ui) {
                        $("body").css({
                            overflow: 'hidden'
                        });
                        $(".ui-widget-overlay").css({
                            background: "rgb(50, 50, 50) !important",
                            opacity: ".50 !important",
                            filter: "Alpha(Opacity=50) !important",
                            //background: "#666666 !important",
                            //opacity: ".40 !important"
                        });

                        wleft = Number(Math.abs($(window)[0].innerWidth - ($('.ui-dialog').width())) / 2).toFixed(0);
                        if (($(window)[0].innerHeight - 50) >= $('.ui-dialog').height()) {
                            wtop = Number(Math.abs($(window)[0].innerHeight - $('.ui-dialog').height()) / 2).toFixed(0);
                        } else {
                            wtop = Number($(window)[0].innerHeight / 4).toFixed(0);
                        }
                        //wtop = (wtop - 62);
                        console.log(wleft + ":" + wtop);
                        $('.ui-dialog').css({ "position": "fixed", "left": wleft + 'px', "top": wtop + 'px', "max-width": "max-content", "max-height": "max-content" });
                        $('.ui-dialog.ui-dialog-content').css({ "left": "0px", "top": "20px" });
                    },
                    beforeClose: function (event, ui) {
                        $("body").css({ overflow: 'inherit' })
                    },
                    close: function (event, ui) {
                        //  $('body input[id="ctl00_hdnIsIframePopUpOpen"]').click();
                        if ($('[id$="UpdateProgress1"]').css('display') == 'none') {
                            //$('[id$="btnProductSearch"]').click(); //This is implemented to load workflow blotter on popup close
                        }
                    }

                });
            }
            catch (error) {
                console.log("Error: " + error);
            }
        }
        function ViewGraph12(id) {

            <%---   var WorkFlow = document.getElementById('<%=cboWFType.ClientID%>');   ---%>
         <%---       var WorkFlowTypeId = WorkFlow.options[WorkFlow.selectedIndex].value;   ---%>
            //alert("hello");
            //  
            //  alert(id);

            var Id_val = parseInt(id, 10);

            var Token_Id = "NULL"
            window.open("WorkFlow_Graph_D3.aspx?WorkFlowTypeId=" + Id_val + "&Token_Id=" + Token_Id + "&Master_Popup=POPUP", "_blank", "", false);
        }


        function OpenWorkFlowFromQueueDensityPage(wf_id, QueueId, timePeriod, from, to) {
            try {



                //alert("Parent function called with " + wf_id + ", " + timePeriod + ", " + QueueId + ", " + from + ", " + to)
                $('#ModalBoxInside112').remove();
                $("body").css({ overflow: 'inherit' });
                $("#hfWF_ID").val(wf_id)
                $("#hfQueueId").val(QueueId)
                $("#hfFromDate").val(from)
                $("#hfToDate").val(to)
                document.getElementById('<%= hdnBtnWorkFlowFromQueueDensity.ClientID%>').click();
            }
            catch (error) {
                console.log("Error: " + error);
            }

        }

        function Embedded_PopUp_Open_Q(PageName, POPUPWidth, POPUPHeight) {
            try {
                //             
                console.log(PageName);
                $('body').find("#ModalBoxInside112").remove();
                $('body').append('<div id="ModalBoxInside112" title="Queue Density Chart" style="top:0px; left:0px;width:' + POPUPWidth + 'px !important;height:' + POPUPHeight + 'px !important"><iframe id="ifrm11" frameborder="0" width="' + POPUPWidth + 'px " height="' + POPUPHeight + 'px " Src=' + PageName + '&Master_Popup=POPUP></iframe></div>')
                //$('body').append('<div id="ModalBoxInside112" title="Filter, Sorting, Action Link and Data Type Settings: ' + templateName + '" style="font:bold; overflow-y: unset !important;  width:' + POPUPWidth + 'px !important;height:' + POPUPHeight + 'px !important; " ><iframe id="ifrm11" frameborder="0" width="' + POPUPWidth + 'px " height="' + POPUPHeight + 'px " Src=' + PageName + '></iframe></div>')
                $('body').find("#ModalBoxInside112").dialog({
                    modal: true,
                    autoOpen: true,
                    width: POPUPWidth,
                    height: POPUPHeight,
                    open: function (event, ui) {
                        $("body").css({
                            overflow: 'hidden'
                        });
                        $(".ui-widget-overlay").css({
                            background: "rgb(50, 50, 50) !important",
                            opacity: ".50 !important",
                            filter: "Alpha(Opacity=50) !important",
                            //background: "#666666 !important",
                            //opacity: ".40 !important"
                        });

                        wleft = Number(Math.abs($(window)[0].innerWidth - ($('.ui-dialog').width())) / 2).toFixed(0);
                        if (($(window)[0].innerHeight - 50) >= $('.ui-dialog').height()) {
                            wtop = Number(Math.abs($(window)[0].innerHeight - $('.ui-dialog').height()) / 2).toFixed(0);
                        } else {
                            wtop = Number($(window)[0].innerHeight / 4).toFixed(0);
                        }
                        //wtop = (wtop - 62);
                        console.log(wleft + ":" + wtop);
                        $('.ui-dialog').css({ "position": "fixed", "left": wleft + 'px', "top": wtop + 'px', "max-width": "max-content", "max-height": "max-content" });
                        $('.ui-dialog.ui-dialog-content').css({ "left": "0px", "top": "20px" });
                    },
                    beforeClose: function (event, ui) {
                        $("body").css({ overflow: 'inherit' })
                    },
                    close: function (event, ui) {
                        //  $('body input[id="ctl00_hdnIsIframePopUpOpen"]').click();
                        if ($('[id$="UpdateProgress1"]').css('display') == 'none') {
                            //$('[id$="btnProductSearch"]').click(); //This is implemented to load workflow blotter on popup close
                        }
                    }

                });
            }
            catch (error) {
                console.log("Error: " + error);
            }

        }

        function SetFocus() {
            try {
                //$('body').scrollTo('#ctl00_MainContent_gvWorkflowQueueStatistics_ctl21_linkBtnWTMTitle');
                $([document.documentElement, document.body]).animate({
                    scrollTop: $("#" + sessionStorage.getItem("CurrentItem") + "")[0].offsetParent.offsetTop
                }, 2);
                //  $("#" + sessionStorage.getItem("CurrentItem")).css('background-color','#ddd');
            }
            catch (error) {
                console.log("Error: " + error);
            }
        }

        $(document).click(function (event) {
            try {

                if (event.toElement.nodeName == 'TD') {
                    if (event.toElement.children[0].nodeName == 'A') {
                        if (event.toElement.children[0].id.toUpperCase().includes(("linkBtnWTMTitle").toUpperCase())) {
                            //alert(event.toElement.children[0].id.toUpperCase());
                            sessionStorage.setItem("CurrentItem", event.toElement.children[0].id);
                        }
                    }
                } else if (event.toElement.nodeName == 'A') {
                    if (event.toElement.id.toUpperCase().includes(("linkBtnWTMTitle").toUpperCase())) {
                        sessionStorage.setItem("CurrentItem", event.toElement.id);
                    }
                }
            }
            catch (error) {
                console.log("Error: " + error);
            }

        });


        //Changed By Shubham Podhade on 24-Jan-2020 REMOVE this function
        function My_confirmationDialog(obj, title, dialogText, mode) {
            try {

                if ($("#pageName").html() != null) {
                    title = "Workflow Queue Statistics";

                }
                if (mode == 'dialog') {
                    $('html').append(String.Format("<div id='popupdgr' title='{0}'><p style='float:left;'><span class='ui-icon ui-icon-alert' style='float:left; margin:0 5px 20px 0;'></span>{1}</p></div>",
                        title, dialogText));

                    $('#popupdgr').dialog
                        ({

                            height: 180,
                            width: 380,
                            modal: true,
                            resizable: false,
                            draggable: true,

                            close: function (event, ui) { $('html').find('#popupdgr').remove(); },
                            buttons:
                            {
                                'Ok': function () {
                                    $(this).dialog('close');

                                }

                            }
                        });

                }

                $(".ui-widget-overlay").height($("body").height());

            }
            catch (error) {
                console.log("Error: " + error);
            }
        }
//Changed By Shubham Podhade on 24-Jan-2020 REMOVE this function
    </script>

</asp:Content>
