<%@ Page Language="vb" AutoEventWireup="true" CodeBehind="MultiUCPEntry.aspx.vb" Inherits="FinIQWebApp.MultiUCPEntry" MasterPageFile="~/FiniqAppMasterPage.Master" EnableViewState="true" ViewStateEncryptionMode="Always" EnableEventValidation="true" %>



<asp:Content runat="server" ContentPlaceHolderID="MainContent">
   <%-- <style>
        .CentreAlign{
            text-align:center!important;
        }
    </style>--%>
     <style>

       .centerAlign input[type="text"]
       {
           text-align:center !important;
           
       }


       input[type="text"]
       {
           text-align:center !important;
       }
       .gbTable {
    /* border-color:rgb(185,185,185);
     border-width:1px;
    */    
    border: none 1px #DDDDDD;

   padding-bottom:0px;
   padding-top:0px;
   padding-right:2px;
   padding-left:2px;
   margin:0px !important;
    /*width:315px;*/
}
   /*     .pnlMainClass {
            padding:5px;
    text-align: left;
   border-collapse: collapse;
    
    background-color: #f1f1f1;
    border:1px solid darkgray ;
}

    .pnlMainClass:hover {
     background-color: #f1efef !Important;
    background-image: linear-gradient(to top left, #fdecec, 10%, #f7f7f7);
    } added these classes in style1.css UWI-180*/

         .ucpctlremoveborder {
             border:none !Important;
         }
         .deliconpadding {
         padding-right:10px;
         text-align:right !important; /*30-Sep-2019*/
         }

         lbl, .UCPlblHeader {
    padding-left: 2px;
    line-height: 26px;
}

         .lblTemplateName {
              padding-left: 10px;
             color:#005682;
             text-decoration:underline;
             font-size:16px;
    
         }
         .lblerrorwarningmsg {
             color:#ff0000;
             float:right !important;
         }
         .lblsuccessmsg {
             
             float:right !important;
         }
		 /*AkshayD for popup open on multiucp*/
      .closebtn {
    background-color: Transparent;
    color: #000;
    font: normal 12px/18px Verdana, Helvetica, sans-serif;
    width: 20px;
    height: 20px;
    border: solid 1px #ccc;
}
         
    .ui-widget.ui-widget-content {
        z-index: 99912 !important; /* don't change without shekhar permission */
        /*Arati Kulkarni CSS Changes 16-Jan-2019*/
        box-shadow: 0 0 10px #000000;
        padding: 0px;
        max-width: none !important;
        overflow: hidden;
        /*Arati Kulkarni CSS Changes 16-Jan-2019*/
    }

    .holds-the-iframe {
        background: url(../App_Resources/loading.gif) center center no-repeat;
        background-size: 50px;
        background-attachment: scroll;
    }

    .overlaySearch {
        z-index: -1;
        background-color: #000000; /* Black background with opacity */
    }

          /*Arati Kulkarni CCS Changes 16-Jan-2019*/
    .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;
    }
    /*Arati Kulkarni CCS Changes 16-Jan-2019*/

   </style>
    <script type="text/javascript">
        //AkshayD for popup open on multiucp
      //Start|Added by Mitali on 11-May-2020| load click on popup close for FI | as asked by DJ
    function Embedded_PopUp_Open_WF(PageName, POPUPWidth, POPUPHeight) {
        try {
            /* Added by Arati K to disable window scroll on 15 Jan 2020 -- Start*/
            var scrollPosition = [
                self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
                self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
            ];
            //added by shreyasv for popup size default 05 may 2020
          //  var bondsPopup = GetSizesForBonds(PageName, POPUPWidth, POPUPHeight)
            //POPUPHeight = bondsPopup.popupheight;
            //POPUPWidth = bondsPopup.popupwidth;
            //added by shreyasv for popup size default 05 may 2020
            var html = jQuery('html');
            html.data('scroll-position', scrollPosition);
            html.data('previous-overflow', html.css('overflow'));
            //   html.css('overflow', 'hidden');
            //  window.scrollTo(scrollPosition[0], scrollPosition[1]);
        /* Added by Arati K to disable window scroll on 15 Jan 2020 -- End*/
            //Added by Rohit Tulsiani | 13-Feb-2021
            var marginLeft = -POPUPWidth / 2;
            if (PageName.includes('Order_Aggregation_Monitor/Multi_Blotter_Hedge_Entry_Monitor.aspx')) {
                console.log('true');
                POPUPWidth = 930;
                marginLeft = -POPUPWidth / 2;
            }
            //Ended by Rohit Tulsiani | 13-Feb-2021
            $('body').find("#ModalBoxInside112").remove();
            $('body').append('<div id="ModalBoxInside112" style="top:0px; left:0px; "width:"+POPUPWidth+"px !important;Height:"+POPUPHeight+"px "+"!important"><iframe id="ifrm11" class="holds-the-iframe" frameborder="0" style="width:100%; height:100%;" Src=' + PageName + '&Master_Popup=POPUP></iframe></div>')
            $('body').find("#ModalBoxInside112").dialog({
                display: 'block',
                modal: true,
                draggable: true,
                autoOpen: true,
                closeOnEscape: true,
                resizable: true,    //added by shreyasv for popup size default 05 may 2020
                width: POPUPWidth,
                height: POPUPHeight
                , drag: function (event, ui) { }
                , drop: function (event, ui) { }
                , dragStart: function (event, ui) {
                }
                , dragStop: function (event, ui) {
                    if ($('.ui-dialog')[0].offsetTop < 0 || $('.ui-dialog')[0].offsetTop >= $('body')[0].clientHeight) {
                        $('.ui-dialog').css('top', '5px');
                    }
                    if ($('.ui-dialog')[0].offsetleft < 0 || $('.ui-dialog')[0].offsetleft >= $('body')[0].clientWidth) {
                        $('.ui-dialog').css('left', '5px');
                    }
                }
                , open: function (event, ui) {
                    chkdigopen = 1;
                    $(".ui-widget-overlay").css({
                        background: "rgb(50, 50, 50) !important",
                        opacity: ".50 !important",
                        filter: "Alpha(Opacity=50) !important",
                    });
                    // || start ||added by sushmita.h on 27 feb 2020 for close button icon positioning || asked by Udit sir
                    $(".ui-button-icon-only .ui-icon").css({
                        top: "50%",
                        left: "50%"
                    });
                    // || end ||added by sushmita.h on 27 feb 2020 for close button icon positioning || asked by Udit sir
                    wleft = Number(Math.abs($(window)[0].innerWidth - ($('.ui-dialog').width())) / 6.5).toFixed(0);
                    if (($(window)[0].innerHeight - 50) >= $('.ui-dialog').height()) {
                        wtop = Number(Math.abs($(window)[0].innerHeight - $('.ui-dialog').height()) / 2).toFixed(0) - 45;
                    } else {
                        wtop = Number($(window)[0].innerHeight / 4).toFixed(0);
                    }
                    // $('.ui-dialog').css({ "position": "fixed", "left": wleft + 'px', "top": Math.abs(wtop) + 'px', "max-width": "max-content", "max-height": "max-content" });
                    $('.ui-dialog').css({ "position": "fixed", "left": "50%", "top": "70px", "max-height": "max-content" });//"max-width": "max-content" /*Edited by Rohit Tulsiani | 13 - Feb - 2021*/
                    $('.ui-dialog').css('margin-left', marginLeft); /*Edited by Rohit Tulsiani | 13 - Feb - 2021*/
                    $('.ui-dialog.ui-dialog-content').css({ "left": "0px", "top": "20px" });
                    $(document).keyup(function (e) {
                        if (e.keyCode == 27) {
                            
                            $('body').find("#ModalBoxInside112").dialog("close");
                            e.preventDefault();
                        }
                    });
                    chkInterval = setInterval(function () {
                        if ($(document).find('iframe')[0].contentDocument.body.text == "" && (POPUPWidth == 0 && POPUPHeight == 0)) {
                            $('body').find("#ModalBoxInside112").dialog("close");
                            clearInterval(chkInterval);
                        } else {
                            clearInterval(chkInterval);
                        }
                    }, 100);
                }
                , beforeClose: function (event, ui) {
                    clearInterval(chkInterval);
                    chkdigopen = 0;
                    /* Added by Arati K to show window scroll on 15 Jan 2020 */
                    var html = jQuery('html');
                    var scrollPosition = html.data('scroll-position');
                    html.css('overflow', html.data('previous-overflow'));
                    window.scrollTo(scrollPosition[0], scrollPosition[1]);
                    $("body").css({ 'overflow': html.data('previous-overflow') });
                }
                , close: function (event, ui) {
                    ////
                    //  $('body input[id="ctl00_hdnIsIframePopUpOpen"]').click();
                    if ($('[id$="UpdateProgress1"]').css('display') == 'none') {
                        //Umcommented By Samruddhi Wani|On 14-Jan-2021 |Asked By Naman C | to load workflow blotter on popup close | Start
                        $('[id$="btnProductSearch"]').click(); //This is implemented to load workflow blotter on popup close
                        //Umcommented By Samruddhi Wani|On 14-Jan-2021 |Asked By Naman C | to load workflow blotter on popup close | End
                        //Added by Mitali on 30-Apr-2020||for load click on popup close||fi pages, webcket based refresh changes
                        ////
                        //if (window.parent.location.pathname == "/FinIQWebApp/Workflow/Trade_Workflow_Blotter.aspx") {
                        //    SubScribBonds_WF(document.getElementById("ctl00_MainContent_workflowControl_hdn_WebsocketIP").value, document.getElementById("ctl00_hdnUserNameForNotification").value);
                        //}
                        if (window.parent.location.pathname == "/FinIQWebApp/Workflow/Trade_Workflow_Blotter.aspx") {
                            if (PageName.toUpperCase().indexOf("FINIQ_BOND_ENTRY") > -1 || PageName.indexOf("Bonds_RFQResponseAction") > -1 || PageName.indexOf("Multi_Blotter_Hedge_Entry") > -1 || PageName.indexOf("FinIQ_TradeView") > -1) {
                            
                                //alert('before load refresh');
                                $('[id$="btnProductSearch"]').click();
                                //Jassim AR | 20-Jan-2021 | To remove record from lockstatus after dialog box is closed | START
                                var ROID = parseQueryString('DealNum', PageName)
                                $.ajax({
                                    type: "POST",
                                    url: '../FinIQ_Bond_Entry/FinIQ_Bond_Entry.aspx/UnlockOrders',
                                    data: "{'strROID':'" + ROID  + "','strObjectCode':'MULTBTL'}",
                                    contentType: "application/json; charset=utf-8",
                                    dataType: "json",
                                    cache: false,
                                    async: false,
                                    crossDomain: true,
                                    success: function (data) {
                                    },
                                    error: function (request, status, error) {
                                        console.log("error");
                                    }
                                });
                                //Jassim AR | 20-Jan-2021 | To remove record from lockstatus after dialog box is closed | END


                            }
                        }
                    }
                    ////
                    $("#ifrm11").get(0).contentWindow.postMessage('CloseMe', window.location.origin); //added by Devesh J on 12-Jan-2021 as told by Shekhar Sir
                    //return false;
                    //$('[id$="btnclose"]').click();
                }
            });
        } catch (error) { console.log(error.message); }
    }
    //End|Added by Mitali on 11-May-2020| load click on popup close for FI | as asked by DJ
    </script>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="upMultiUCPEntry"
        DisplayAfter="0">
        <ProgressTemplate>
            <%--<div style="position: absolute; top: 120px; left: 250px;">
                <img alt="Loading" src="../App_Resources/loading.gif" />
            </div>--%>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <link href="../App_Themes/UCPCTL.css" rel="stylesheet" type="text/css" />
    <script src="../UCP/UCPJS/DealEntry.js" type="text/javascript"></script>
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"></asp:ScriptManagerProxy>
    <asp:UpdatePanel runat="server" ID="upMultiUCPEntry" UpdateMode="Conditional">
        <ContentTemplate>
            <table>
                <tr>
                    <td>
                        <asp:Button runat="server" ID="btnPrice" Text="Save All (F8)" CssClass="btn" Width="120px" OnClientClick="sethdnvalue(this.id)" />
                        <%--<asp:Button runat="server" ID="btnSave" Text="Save All (F10)" CssClass="btn" Style="margin-left: 10px;"
                            Width="120px" OnClientClick="sethdnvalue(this.id)" />--%> 
                        <asp:Label runat="server" ID="lblError" Style="margin-left: 10px;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Table runat="server" ID="tbMultiUCP" EnableViewState="true"></asp:Table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlAllTemplates" CssClass="ddl" EnableViewState="true" AutoPostBack="true">
                        </asp:DropDownList>
      
                               <asp:DropDownList runat="server" ID="ddlSubtemplate" CssClass="ddl" EnableViewState="true">
                        </asp:DropDownList>
                        <asp:TextBox runat="server" onfocus="this.select();" onmouseup="return false;" ID="txtRowsPerPage" Width="30px" CssClass="txt" Text="1" onKeyPress=" return AllowOnlyNumeric_without_Decimal(event);" Style="margin-left: 4px;" />
                        <asp:Button runat="server" ID="btnAddNew" Text="Add New Row(s)" CssClass="btn" Width="120px" Style="margin-left: 3px;" />
                        <%--Renamed the button and fixed the width by PranavT on 23/02/2019 as asked by Milind Sir--%>
                        <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="upMultiUCPEntry" DisplayAfter="0">
                            <ProgressTemplate>
                                <div class="divLoading">
                                    <img alt="Loading" src="../App_Resources/loading.gif" style="height:50px;" />
                                    <span class="lbl">Loading...
                                </div>
                                </span>
                            </ProgressTemplate>

                        </asp:UpdateProgress>

                    </td>
                </tr>
            </table>
            <div id="dvLoader" class="UpdateProgress" style="display: none; top: 0px; width: 100%;
            height: 1000px; background-color: #FFF; opacity: 0.5; filter: alpha(opacity=50);
            vertical-align: middle; left: 0px; z-index: 99999; position: absolute; text-align: center;">
            <div class="Progress" style="display:none;font: bold 12px/14px verdana; color: #333333; padding: 10px;
                opacity: 1; filter: alpha(opacity=100); top: 30%; left: 80px; height: 100%; width: 100%;
                background-color: #FFF; vertical-align: middle; z-index: 999999; position: absolute;
                text-align: left;">

                <img alt="" src="../App_Resources/Ajax_loader_White/loading_1.gif" style="display:none;" /><span class="lbl">Please
                    wait...&nbsp;&nbsp;</span>

            </div>
        </div>
            <asp:HiddenField runat="server" ID="hdnbtnValue" Value="0" />
        </ContentTemplate>
    </asp:UpdatePanel>

    <script type="text/javascript">

        $(document).ready(function () { });

        //function UCP_LeftSide_Filter() {
        //    $(".UCP_LeftSide_Filter").each(function () {
        //        $(this).addClass("DisplayNone");
        //    });
		//	//Added below function by PranavT on 22/02/2019 to add background contrast on MultiUCP
        //    $(".UCP_MainTable_Filter").each(function () {
        //        $(this).addClass("tdMainClass");
        //    });
        //}
        function UCP_LeftSide_Filter() {
            $(".txt,.lbl,.ddl").each(function () {
                $(this).addClass("centerAlign");
            });
            //Added below function by PranavT on 22/02/2019 to add background contrast on MultiUCP
            $(".UCP_MainTable_Filter").each(function () {
                // $(this).addClass("tdMainClass");
                $(this).addClass("ucpctlremoveborder");
            });
        }

        function sethdnvalue(SourceID) {
            var hdnSourceID = document.getElementById("<%=hdnbtnValue.ClientID%>");
            hdnSourceID.value = SourceID;
        }

        $(document).keydown(function (e) {
            if (e.which == 119) {
                document.getElementById("<%=btnPrice.ClientID%>").click()
            }
            //Commented handler by PranavT on 19/06/2019 to merge save all functionality on price all button
            <%--if (e.which == 121) {
                document.getElementById("<%=btnSave.ClientID%>").click()
            }--%>  
        });

        function UCP_CenterAlign_Filter() {
            $(".txt, .ddl, .lbl").each(function () {
                $(this).addClass("CentreAlign");
            });
        }


        function AllowOnlyNumeric_without_Decimal(evt) {
            
            var iKeyCode = (evt.which) ? evt.which : evt.keyCode
            if (iKeyCode == 46 || iKeyCode == 110 || iKeyCode == 190) {
                return false;
            }
            else if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57)) {
                return false;
            }
            else {
                return true;
            }

        }
    </script>

</asp:Content>

