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

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

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

    <style>
        .btnStyle {
            width: 100px;
        }

        .PopupWSS {
            border-collapse: collapse;
            /*width: 317px;
            height: 250px;
            top: 242px;
            left: 763px;*/
            width: 428px;
            height: 380px;
            top: 200px;
            left: 760px;
            position: absolute;
            background-color: white;
            border: 1px solid #808080;
            display:none;
        }

        .btnWidth {
            width: 100px !important;
        }

        .WrapNoSpace {
            word-break: break-all;
        }

        .beutifyPopUp {
            border-radius: 8px;
            box-shadow: 0 0 10px #000000;
        }

        .notify {
            float: left;
            left: 10px;
            top: 120px;
            position: absolute;
            background-color: #F7F7F7;
            /* border:solid 0.1em #DDD; */
            height: 10px;
            width: 90%;
            /* text-indent:5px; */
            color: #000;
            margin: 10px;
            padding: 2px;
            z-index: 1000;
            FILTER: progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#DDDDDD,strength=3);
            font-size: 11px;
            border: none !IMPORTANT;
        }
         
        .notify span
            {
                margin-left:3px;
                float:left;
                width:95%;
                height:20px;
                font:normal 11px/20px verdana;
                /*border-left:solid 1px #aaa;*/   
            }
         .notify .icon
            {
                width:24px;
                height:20px;
                display:none;
                float:left;                
              
                margin-top:0px;                                                        
              } 
			  
			    .notify .close
            {
                width:24px;
                height:20px;
                font:bold 11px/11px verdana;
                color:#fff;
                float:right;
                cursor: pointer;
            }
             .btn {
            /*height: 28px !important;*/
            /*border-radius: 5px;*/
            width: 100px;
        }

             .closeButton {
            Width: 20px !important;
        }

             .PopUpButton {
            Width: 80px !important;
            margin-left: 6px !important;
            margin-top: 6px !important;
            margin-bottom: 6px !important;
            padding: 5px;
        }
        .info {
            background-color: #fff;
            color: steelblue;
        }


        .UserGrpPopup {
            z-index: 10000000000 !important;
        }

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

        .groupBoxUserAccess {
            position: fixed;
            left: 700px !important;
            top: 275px !important;
            height: auto;
            /*border: solid 1px #ccc;*/
            z-index: 99991 !important;
            background-color: #FFF;
            box-shadow: 4px 4px 4px #ddd;
            display:none;
        }
        .ui-widget-overlay {
        opacity:0 !important; 
        z-index:-99 !important; 
        }
    </style>

    <asp:UpdatePanel ID="UpdatepanelMain" runat="server">
        <ContentTemplate>

            <script type="text/javascript">
                var DisplayPriorityOpen = false;
                function OpenDisplayPriority() {
                    $('#ctl00_MainContent_UPanelWF_Seq_Settings').show();
                    //$('#ctl00_MainContent_UPanelWF_Seq_Settings').style.display = "block";
                    $("#ctl00_MainContent_UPanelWF_Seq_Settings").css('display', 'block');
                    DisplayPriorityOpen = true;
                    var dvScroll = 'ctl00_MainContent_panel11';
                    $get(dvScroll).scrollTop = 0;
                }

                var prm = Sys.WebForms.PageRequestManager.getInstance();
                prm.add_endRequest(function (s, e) {                    
                    
                    if (DisplayPriorityOpen)
                    {
                        
                        var dvScroll = 'ctl00_MainContent_panel11';
                        $('#ctl00_MainContent_UPanelWF_Seq_Settings').show();
                        //$('#ctl00_MainContent_UPanelWF_Seq_Settings').style.display = "block";
                        $("#ctl00_MainContent_UPanelWF_Seq_Settings").css('display', 'block');
                        $get(dvScroll).scrollTop = $get("ctl00_MainContent_hdnScrollTop").value;
                    }
                    else
                    {
                        $('#ctl00_MainContent_UPanelWF_Seq_Settings').hide();
                        $("#ctl00_MainContent_UPanelWF_Seq_Settings").css('display', 'none');
                    }                    
                    return true
                });             

                function CloseDisplayPriority() {
                    try {
                        $('#ctl00_MainContent_UPanelWF_Seq_Settings').hide();
                        //displaypriorityVisibility = true;
                        DisplayPriorityOpen = false
                        //$('#ctl00_MainContent_UPanelWF_Seq_Settings').style.display = "none";
                        $("#ctl00_MainContent_UPanelWF_Seq_Settings").css('display', 'none');
                    }
                    catch (err) {
                        console.log('Error in CloseDisplayPriority panel');
                    }
                }

                function isNumberKey(evt) {
                    //alert(10);
                    
                    var charCode = (evt.which) ? evt.which : evt.keyCode;
                    if (charCode > 31 && (charCode < 48 || charCode > 57))
                        return false;
                    return true;
                }
                function EnterKeyEvent(evt) {
                    var code = (evt.which) ? evt.which : evt.keyCode;

                    if (code == 13) {
                        __doPostBack('<%=txtrowsperpage.ClientID%>', 'TextChanged');
                    }
                }

                function ConfirmDelete() {
                    return confirm("Do you want to delete this record(s)");
                    // }
                }
                    <%--10-Nov-2020 | Added by Rajeshree K to make display priority pop-up draggable--%>

                function draggable() {
                    $(function () {
                        $("#<%=UPanelWF_Seq_Settings.ClientID%>").draggable();
                    });
                }

            </script>

            <table>
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td id="Td1" align="left" runat="server" style="padding-bottom: 10px;">
                                    <asp:Label ID="lblSuccess" runat="server" Text="" CssClass="lblSuccess" ></asp:Label> 
									<asp:Label ID="lblInfo" runat="server" Text="" CssClass="lblInfo" ></asp:Label>									
                                    <asp:Label ID="lblError" runat="server" Text="" CssClass="lblError" ></asp:Label>									
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table>
                            
                            <tr>
                                
                                <td>
                                    <asp:Label runat="server" ID="lblWorkflow" CssClass="lbl" Text="Workflow"></asp:Label>
                                </td>
                                <td>&nbsp;&nbsp;&nbsp;</td>
                                <td>
                                    <asp:DropDownList runat="server" ID="ddlWorkflow" CssClass="ddl" AutoPostBack="true" Width="270px" ></asp:DropDownList></td>
                            </tr>
                        </table>
                    </td>
                </tr>

                <%--Row 2 All Buttons--%>
                <tr>
                    <td>
                        <table>
                            <tr style="height: 45px">
                                <%--<td>
                                    <asp:Button runat="server" ID="btnEdit" Text="Edit" CssClass="btnStyle btn" />
                                </td>--%>
                                <td>
                                    <asp:Button runat="server" ID="btnAdd" Text="Add" CssClass="btnStyle btn" />
                                </td>
                                <td>
                                    <asp:Button runat="server" ID="btnDelete" CssClass="btn btnStyle" Text="Delete" OnClientClick="return ConfirmDelete();" />
                                </td>
                                <td>
                                    <asp:Button runat="server" ID="btnSave" Text="Save" CssClass="btnStyle btn" />
                                </td>
                                <td>
                                    <asp:Button runat="server" ID="btnCancel" Text="Cancel" CssClass="btnStyle btn" />
                                </td>
                                <td>
                                    <asp:Label ID="lblRowsPerPage" runat="server" Text="Rows per page" Style="margin-left: 5px;" />
                                    <asp:TextBox ID="txtrowsperpage" runat="server" Text="999" Width="40px" Style="text-align: center;" AutoPostBack="true" MaxLength="3" onkeydown="EnterKeyEvent(event)" onkeypress="return isNumberKey(event)" />
                                </td>
                            </tr>
                        </table>
                    </td>

                </tr>

                <tr>
                    <td>
                        <asp:Panel ID="pnlChanneluserDisionSettings" runat="server">

                            <table>


                                <tr>
                                    <td class="emptycell"></td>
                                </tr>

                                <tr>
                                    <td class="emptycell"></td>
                                </tr>

                                <tr>
                                    <td class="emptycell"></td>
                                </tr>
                                <%--Row 3 Table Grid Set Up--%>
                                <tr>
                                    <td>
                                        <asp:GridView runat="server" ID="grdWFSequenceMaster" CssClass="Grid Gridview" AllowPaging="true" AllowSorting="True" AutoGenerateColumns="false" PageSize="999" BorderStyle="Solid" BorderWidth="1px" Width="450px" >
                                            <SelectedRowStyle CssClass="GridItemSelect" />
                                            <RowStyle CssClass="GridItem" />
                                            <HeaderStyle CssClass="GridHeader" />
                                            <FooterStyle CssClass="GridFooter" />
                                            <PagerStyle CssClass="GridPager" />
                                            <EmptyDataTemplate>
                                                <asp:Label ID="lblgrdWFSequenceMaster" runat="server" CssClass="lbl" Text="No data found."></asp:Label>
                                            </EmptyDataTemplate>
                                            <Columns>
                                                <asp:TemplateField ControlStyle-Width="50" ItemStyle-HorizontalAlign="Center">
                                                    <ItemTemplate>
                                                        <asp:CheckBox ID="ChkSelSingle" runat="server" AutoPostBack="true" />
                                                    </ItemTemplate>
                                                </asp:TemplateField>

                                                <asp:TemplateField HeaderText="WSM ID">
                                                    <HeaderStyle />
                                                    <ItemStyle />
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblWSM_Id" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "WSM_Id")%>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>

                                               <asp:TemplateField HeaderText="WSM Selection Rank" ControlStyle-Width="115px">
                                                    <HeaderStyle Width="115px" />
                                                    <ItemStyle Wrap="false" Width="115px" HorizontalAlign="left" />
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblWSMSelectionRank" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "WSM_Selection_rank")%>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>

                                                <asp:TemplateField HeaderText="WSM Selection Level" Visible="true" HeaderStyle-Width="110px">
                                                    <HeaderStyle Width="110px" />
                                                    <ItemStyle Width="110px" HorizontalAlign="Center" />
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblWSMSelectionLevel" runat="server" Width="110px" Text='<%# DataBinder.Eval(Container.DataItem, "WSM_Selection_level")%>' style="display:none;"/>
                                                        <asp:DropDownList ID="ddlWSMSelectionLevel" runat="server" AutoPostBack="true" Width="115px" OnSelectedIndexChanged="ddlWSMSelectionLevel_SelectedIndexChanged" CommandArgument='<%# Container.DataItemIndex%>' EnableViewState="true">
                                                            <asp:ListItem>Entity</asp:ListItem>
                                                            <asp:ListItem>Login</asp:ListItem>
                                                            <%--10-Nov-2020 | Rajeshree K | System option removed from dropdown--%>
                                                            <%--<asp:ListItem>System</asp:ListItem>--%>
                                                            <asp:ListItem>UserGroup</asp:ListItem>
                                                        </asp:DropDownList>
                                                    </ItemTemplate>
                                                </asp:TemplateField>

                                                <asp:TemplateField HeaderText="WSM Selection Key" ControlStyle-Width="110px">
                                                    <HeaderStyle Width="110px" />
                                                    <ItemStyle Width="110px" HorizontalAlign="Center" />
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblWSMSelectionKey" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "WSM_Selection_key")%>' style="display:none;"/>
                                                        <asp:DropDownList ID="ddlWSMSelectionKey" runat="server" Width="110px" AutoPostBack="true"  EnableViewState="true" OnSelectedIndexChanged="ddlWSMSelectionKey_SelectedIndexChanged">
                                                        </asp:DropDownList>
                                                    </ItemTemplate>
                                                </asp:TemplateField>

                                                <asp:TemplateField HeaderText="Display Priority" ControlStyle-Width="150px">
                                                    <HeaderStyle Width="150px" />
                                                    <ItemStyle Width="150px" HorizontalAlign="Center" />
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="lnkDisplayPriority" runat="server" CommandArgument='<%# Container.DataItemIndex%>' CommandName="Set Display priority" Text='<%# DataBinder.Eval(Container.DataItem, "WSM_Display_Priority")%>'></asp:LinkButton>
                                                    </ItemTemplate>
                                                </asp:TemplateField>

                                            </Columns>
                                        </asp:GridView>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>

    <asp:UpdatePanel ID="UpdatePanelWF_Seq_Settings" runat="server">
        <ContentTemplate>

            <asp:Panel ID="UPanelWF_Seq_Settings" runat="server" CssClass="PopupWSS">
                <div>
                    <input type="hidden" id="hdnScrollTop" runat="server" value="0"/>
                    <table style="width: 100% ; background-color:#FFFFFF;"  class="beutifyPopUp">

                        <tr>
                            <td>

                                <table style="width: 100%">
                                    <tr>
                                        <td colspan="3" style="padding-bottom:5px;">
                                            <asp:Label ID="lblWSSError" runat="server" CssClass="lbl" Style="color: red !important"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>

                                            <td class="lblBlotterPaddingRight" style="padding-left:7px !important;">
                                                <asp:Label ID="lblWFWSS" runat="server" Text="Workflow"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:DropDownList ID="ddlWorkflowWSS" runat="server" CssClass="ddl" Width="281px" AutoPostBack="true" EnableViewState="true">
                                                </asp:DropDownList>
                                            </td>
                                            <td>
                                                <asp:LinkButton ID="btnCrossWSS" runat="server" CssClass="btn PopUpButton closeButton" Text="X" Style="color:black"></asp:LinkButton>
                                            </td>
                                        </tr>

                                <%--  <tr>
                                  <td style="width: 5px;">
                                    <asp:Button ID="btnEditWSS" runat="server" CssClass="btn btnWidth"   Text="Edit" />
                                </td>

                                <td>
                                    <asp:Button ID="btnSaveWSS" runat="server"   CssClass="btn btnWidth" Text="Save" />
                                </td>
                               
                            </tr>--%>
                            </table>

                            </td>
                        </tr>
                        <tr>
                            <td>
  
                            <div id="draggable" runat="server" class="" style="overflow: auto"> 
                                <table style="width: 100%">
                                    <tr>
                                        <td>

                                                <asp:Panel ID="panel11" runat="server"  Height="390px" Width="395px" ScrollBars="Vertical" onscroll="$get('ctl00_MainContent_hdnScrollTop').value = this.scrollTop;">
                                                    <asp:GridView ID="gvWFSequenceSetting" runat="server" CssClass="Grid" AutoGenerateColumns="false" AllowPaging="false" ShowHeaderWhenEmpty="true" EmptyDataText="No data found" PagerSettings-Mode="Numeric"
                                                        AllowSorting="true" ShowFooter="false" HeaderStyle-CssClass="GridHeaderTitle" RowHeadersWidthSizeMode="DisableResizing;" Width="385px">
                                                        <SelectedRowStyle CssClass="GridItemSelect" />
                                                        <AlternatingRowStyle CssClass="GridItem" />
                                                        <RowStyle CssClass="GridItem" Wrap="true" />
                                                        <HeaderStyle CssClass="GridHeader" />
                                                        <FooterStyle CssClass="GridFooter" />
                                                        <PagerStyle CssClass="GridPager" />
                                                        <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast" Position="Bottom" />

                                                        <Columns>

                                                            <asp:TemplateField HeaderText="">
                                                                <ItemStyle HorizontalAlign="Center" Wrap="true" Width="20px" />
                                                                <%-- <HeaderTemplate>
                                                                <asp:CheckBox ID="chkSelecAllWSS" runat="server" AutoPostBack="True" BorderStyle="None"  Width="30px" />
                                                            </HeaderTemplate>--%>
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox runat="server" ID="chkSelectSingleWSS" AutoPostBack="true" Enabled="true" Width="20px" OnCheckedChanged="chkSelectSingleWSS_CheckedChanged"   />
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>

                                                            <asp:CommandField ButtonType="Link" ShowEditButton="true" EditText="Edit" UpdateText="Update" CancelText="Cancel" ShowCancelButton="true" ControlStyle-Width="40">
                                                                <HeaderStyle Width="40" />
                                                                <ItemStyle Wrap="false" Width="40" HorizontalAlign="center" />
                                                            </asp:CommandField>

                                                            <asp:TemplateField HeaderText="Column Name" ItemStyle-Wrap="true">
                                                                <HeaderStyle Width="80px" Wrap="true" />
                                                                <ItemStyle Width="80px" Wrap="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblColName" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WBM_Blotter_Header").ToString)%>'></asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>

                                                            <asp:TemplateField HeaderText="Column Priority" ItemStyle-Wrap="False">
                                                                <HeaderStyle Width="50px" Wrap="true"  />
                                                                <ItemStyle Width="50px" Wrap="true" CssClass="WrapNoSpace" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblDisplaySeq" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WBM_Sequence").ToString)%>'></asp:Label>
                                                                        <asp:TextBox ID="txtDisplaySeq" runat="server" Width="50" onkeypress="return isNumberKey(event)" AutoPostBack="false" Visible="false"></asp:TextBox>
                                                                    </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Quick Filter (Y/N)" ItemStyle-Wrap="true">
                                                                <HeaderStyle Width="70px" Wrap="true" CssClass="WrapNoSpace" />
                                                                <ItemStyle Width="70px" Wrap="true" CssClass="WrapNoSpace" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblUseAsFilterYN" runat="server" Width="45px" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WSS_UseForFilter").ToString)%>' />
                                                                    <asp:DropDownList ID="ddlUserFilterYN" runat="server" Width="45px" Visible="false">
                                                                        <asp:ListItem>N</asp:ListItem>
                                                                        <asp:ListItem>Y</asp:ListItem>
                                                                    </asp:DropDownList>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>

                                                            </Columns>


                                                    </asp:GridView>

                                                </asp:Panel>

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

                    </table>
                </div>
                <div id="overlayDiv" class="overlaySearch"></div> 
            </asp:Panel>

        </ContentTemplate>
    </asp:UpdatePanel>


</asp:Content>


