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

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy11" runat="server">
    </asp:ScriptManagerProxy>
    <script src="../FinIQJS/SortFilter_Grid.js"></script>
<%--    <script src="../FinIQJS/FreezeGrid.js"></script>
    <link href="../FinIQJS/FreezeGrid.css" rel="stylesheet" type="text/css"/>--%>
    <style type="text/css">
       /* Commented by Shraddha D || 17-sep-2021 || */
       /* .ui-state-active a, .ui-state-active a:link {
            color: #000000 !important;
            background-color: #efefef !important;
        }*/

        .ui-widget-content.ui-widget {
/*            border: solid 1px white;*/
            z-index:unset !important;
        }

       /* .ui-tabs .ui-tabs-nav {
            background: white;
            border: none;
            border-bottom: 1px solid #dddddd;
        }*/
/*
        .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
            border: 1px solid #fff !important;
        }*/

       /* .ui-tabs .ui-tabs-nav .ui-tabs-anchor {
            background-color: #e6e6e600;
            color: #8080808c;
        }*/
        .divLoading
        {
            position:absolute;
            left:600px; top:90px;
        }

        .GridItem a {
            /**/
            color:  #005682 !important;
           
        }
       
    </style>

    <script type="text/javascript">

        //Start| 26-JUN-2020 | Added by Rajeshree K for grid filters        
        $(document).ready(function () {
            SetSorting_Filter1();
        });
        //End| 26-JUN-2020 | Added by Rajeshree K for grid filters

        function clearErrorLabel1() {
            document.getElementById('<%= lblerror.ClientID%>').textContent = "";
            document.getElementById('<%=btnCallFirstAccessControl.ClientID%>').click();
        }

        function clearErrorLabel() {
            document.getElementById('<%= lblerror.ClientID%>').textContent = "";
        }
        function deleteRecord() {
            return confirm('Are you sure to delete this record(s) ?');
        }
     </script>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table>
                <tr>
                    <td>
                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"
                            DisplayAfter="0">
                            <ProgressTemplate>
                                <div class="divLoading">
                                    <img alt="Loading" src="../App_Resources/loading.gif" /><span class="lbl">Loading...&nbsp;&nbsp;</span>
                                </div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td>
                                    <asp:Label ID="lblerror" runat="server" CssClass="lblerror"></asp:Label>
                                     <asp:Label ID="lblInfo" CssClass="lblInfo" runat="server" Text=""></asp:Label>
                                        <asp:Label ID="lblSuccess" CssClass="lblSuccess" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                          <asp:Button ID="btnCallFirstAccessControl" runat="server" Text="" Style="display: none"></asp:Button>
                        <div id="tabs" runat="server">
                            <ul>

                                <li id="Li1" runat="server" onclick ="clearErrorLabel1()"><a href="#tabs_1">Data Fetch</a></li>
                                <li id="Li2" runat="server" onclick ="clearErrorLabel()"><a href="#tabs_2">Access Type Setup</a></li>
                            </ul>
                            <div>
                                 <%--Added by Nikhil Mali on 20-11-2019 for vertical editing : START--%>
                         <%--UBPINT-6 changed by Prateek M--%>
                         <asp:Label ID="lblRowsPerPage" runat="server" Text="Row(s) per page :" Style="margin-left:10px;"/>
                         <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)"  />
                   
                      <%--Added by Nikhil Mali on 20-11-2019 for vertical editing : END--%>
                            </div>
                            <div id="tabs_1">

                                <table>
                                    <tr>
                                        <td>
                                            <asp:Label ID="Label2" runat="server" Text="Total Records : " CssClass="lbl"></asp:Label>
                                            <asp:Label ID="lblTotalRecDF" runat="server" Text="" CssClass="lbl"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                    <td>
                             <asp:GridView ID="dgv_FirstAccessControl" runat="server" AllowSorting="True" AutoGenerateColumns="False" CssClass="Grid" AllowPaging="true" PageSize="999" ShowHeaderWhenEmpty="true" 
                                                EmptyDataText="No data found" ShowFooter="true" HeaderStyle-CssClass="GridHeaderTitle">
                                                <SelectedRowStyle CssClass="GridItemSelect" />
                                                <RowStyle CssClass="GridItem" />
                                                <HeaderStyle CssClass="GridHeader" HorizontalAlign="Center" Wrap="true" />
                                                <FooterStyle CssClass="GridFooter" />
                                                <PagerStyle CssClass="GridPager" />
                                                <PagerSettings Mode="NumericFirstLast" FirstPageText="First" LastPageText="Last" Position="Bottom" />
                                                <EmptyDataTemplate>
                                                    <asp:Label ID="lblqueueDataFetch" runat="server" Text="No data found."></asp:Label>
                                                </EmptyDataTemplate>

                                                <Columns>
                                                    <asp:TemplateField ItemStyle-CssClass="" HeaderStyle-CssClass="" Visible="false">

                                                        <ItemTemplate>
                                                            <asp:CheckBox ID="CheckboxDF" runat="server" AutoPostBack="true"></asp:CheckBox>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField>
                                                        <EditItemTemplate>
                                                            <asp:LinkButton ID="btnUpdateDF" runat="server" CommandName="Update" Width="40px" Text="Update" />
                                                            <asp:LinkButton ID="btnCancelDF" runat="server" CommandName="Cancel" Width="40px" Text="Cancel" />
                                                        </EditItemTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <FooterStyle HorizontalAlign="Center" />
                                                        <ItemTemplate>
                                                            <asp:LinkButton ID="btnEditDF" runat="server" CommandName="Edit" Text="Edit" Width="40px" />
                                                             <asp:LinkButton ID="btnDeleteDF" runat="server" CommandName="Delete" Text="Delete" Width="40px" />
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:LinkButton ID="btnInsertDF" runat="server" CommandName="Add" Text="Add" Width="90px" ValidationGroup="InsertDF" />
                                                        </FooterTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderText="ID">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblIDDF" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.FAC_ID").ToString)%>' />
                                                        </ItemTemplate>
                                                        <%--   <EditItemTemplate>
                                                            <asp:TextBox ID="txtIDDF" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.FAC_ID").ToString)%>'></asp:TextBox>
                                                        </EditItemTemplate>--%>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderText="Workflow">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblWorkflow" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.WTM_CODE").ToString)%>' />
                                                        </ItemTemplate>
                                                        <EditItemTemplate>
                                                            <asp:DropDownList ID="ddlWorkflow" runat="server" CssClass="ddl" AutoPostBack="False" Enabled="false"></asp:DropDownList>
                                                        </EditItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:RequiredFieldValidator ID="ReqddlNewWorkflow" runat="server" ControlToValidate="ddlNewWorkflow" ValidationGroup="InsertDF" ErrorMessage="*" ForeColor="#ff4e4e" Display="Dynamic" />
                                                            <asp:DropDownList ID="ddlNewWorkflow" runat="server" CssClass="ddl" Width="180px"></asp:DropDownList>
                                                        </FooterTemplate>
                                                    </asp:TemplateField>

                                                     <asp:TemplateField HeaderText="WorkflowID" Visible="false">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblWorkflowID" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.FAC_WTM_id").ToString)%>' />
                                                        </ItemTemplate>
                                                        
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Login Group">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblLogin" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.FAC_Login_Group").ToString)%>' />
                                                        </ItemTemplate>
                                                        <EditItemTemplate>
                                                            <asp:DropDownList ID="ddlLogin" runat="server" CssClass="ddl" AutoPostBack="False" Enabled="false"></asp:DropDownList>
                                                        </EditItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:RequiredFieldValidator ID="ReqddlNewLogin" runat="server" ControlToValidate="ddlNewLogin" ValidationGroup="InsertDF" ErrorMessage="*" ForeColor="#ff4e4e" Display="Dynamic" />
                                                            <asp:DropDownList ID="ddlNewLogin" runat="server" CssClass="ddl" Width="180px"></asp:DropDownList>
                                                        </FooterTemplate>
                                                    </asp:TemplateField>

                                                    <%--<asp:TemplateField HeaderText="LoginID" Visible="false">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblLoginID" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.FAC_User_Group").ToString)%>' />
                                                        </ItemTemplate>
                                                        
                                                    </asp:TemplateField>--%>

                                                    <asp:TemplateField HeaderText="Access Type">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblAccessType" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.AT_CODE").ToString)%>' />
                                                        </ItemTemplate>
                                                        <EditItemTemplate>
                                                            <asp:DropDownList ID="ddlAccessType" runat="server" CssClass="ddl" AutoPostBack="False" Enabled="false"></asp:DropDownList>
                                                        </EditItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:RequiredFieldValidator ID="ReqddlAccessType" runat="server" ControlToValidate="ddlNewAccessType" ValidationGroup="InsertDF" ErrorMessage="*" ForeColor="#ff4e4e" Display="Dynamic" />
                                                            <asp:DropDownList ID="ddlNewAccessType" runat="server" CssClass="ddl"></asp:DropDownList>
                                                        </FooterTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderText="Created By">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblCreatedByDF" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.FAC_Created_By").ToString)%>' />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderText="Created At">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblCreatedAtDF" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.FAC_Created_At").ToString)%>' />
                                                        </ItemTemplate>

                                                    </asp:TemplateField>
                                                </Columns>
                                            </asp:GridView>
                                        </td>
                                    </tr>

                                </table>
                            </div>
                            <div id="tabs_2">
                                <table>
                                    <tr>
                                        <td>

                                            <asp:Label ID="Label1" runat="server" Text="Total Records : " CssClass="lbl"></asp:Label>
                                            <asp:Label ID="lblTotalRecAT" runat="server" Text="" CssClass="lbl"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:GridView ID="dgvAccessTypeSetup" runat="server" AllowSorting="True" AutoGenerateColumns="False" CssClass="Grid" AllowPaging="true" PageSize="15" 
                                                ShowHeaderWhenEmpty="true" EmptyDataText="No data found" ShowFooter="true" >
                                                <SelectedRowStyle CssClass="GridItemSelect" />
                                                <RowStyle CssClass="GridItem" />

                                                <HeaderStyle CssClass="GridHeader" HorizontalAlign="Center" Wrap="true" />
                                                <FooterStyle CssClass="GridFooter" />
                                                <PagerStyle CssClass="GridPager" />
                                                <PagerSettings Mode="NumericFirstLast" FirstPageText="First" LastPageText="Last" Position="Bottom" />
                                                <EmptyDataTemplate>
                                                    <asp:Label ID="lblqueueDataFetch" runat="server" Text="No data found."></asp:Label>
                                                </EmptyDataTemplate>

                                                <Columns>
                                                    <asp:TemplateField ItemStyle-CssClass="" HeaderStyle-CssClass="" Visible="false">
                                                        <ItemTemplate>
                                                            <asp:CheckBox ID="CheckboxAT" runat="server" AutoPostBack="true"></asp:CheckBox>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField>
                                                        <EditItemTemplate>
                                                            <asp:LinkButton ID="btnUpdate" runat="server" CommandName="Update" Width="40px" Text="Update" />
                                                            <asp:LinkButton ID="btnCancel" runat="server" CommandName="Cancel" Width="40px" Text="Cancel" />
                                                        </EditItemTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <FooterStyle HorizontalAlign="Center" />
                                                        <ItemTemplate>
                                                            <asp:LinkButton ID="btnEdit" runat="server" CommandName="Edit" Text="Edit" Width="90px" />
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:LinkButton ID="btnInsert" runat="server" CommandName="Add" Text="Add" Width="90px" ValidationGroup="Insert" />
                                                        </FooterTemplate>
                                                    </asp:TemplateField>

                                                    <%--  <asp:CommandField ButtonType="Link" ShowEditButton="true" EditText="Edit" UpdateText="Update" ControlStyle-Width="40">
                                            <ItemStyle Wrap="false" Width="40px" HorizontalAlign="center" />
                                            <footertemplate>
                                        <asp:LinkButton ID="btnInsert" runat="server" CommandName="Add" Text="Add" Width="90" ValidationGroup="Insert"/>
                                    </footertemplate>
                                        </asp:CommandField>--%>

                                                    <asp:TemplateField HeaderText="SR No" Visible="false">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblSRno" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.AT_id").ToString)%>' />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderText="ID">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblID" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.AT_id").ToString)%>' />
                                                        </ItemTemplate>
                                                        <%-- <EditItemTemplate>
                                                            <asp:TextBox ID="txtID" runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.AT_id").ToString)%>'></asp:TextBox>
                                                        </EditItemTemplate>--%>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderText="Code">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblCode" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.AT_Code").ToString)%>' />
                                                        </ItemTemplate>
                                                        <EditItemTemplate>
                                                            <asp:TextBox ID="txtCode" runat="server" CssClass="txt"></asp:TextBox>
                                                        </EditItemTemplate>

                                                        <FooterTemplate>
                                                            <asp:RequiredFieldValidator ID="ReqtxtNewCode" runat="server" ControlToValidate="txtNewCode" ValidationGroup="Insert" ErrorMessage="*" ForeColor="#ff4e4e" Display="Dynamic" />
                                                            <asp:TextBox ID="txtNewCode" runat="server" CssClass="txt"></asp:TextBox>
                                                        </FooterTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderText="Name">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblName" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.AT_LongName").ToString)%>' />
                                                        </ItemTemplate>
                                                        <EditItemTemplate>
                                                            <asp:TextBox ID="txtName" runat="server" CssClass="txt"></asp:TextBox>
                                                        </EditItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:RequiredFieldValidator ID="ReqtxtNewName" runat="server" ControlToValidate="txtNewName" ValidationGroup="Insert" ErrorMessage="*" ForeColor="#ff4e4e" Display="Dynamic" />
                                                            <asp:TextBox ID="txtNewName" runat="server" CssClass="txt" ></asp:TextBox>
                                                        </FooterTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderText="Created By">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblCreatedBy" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.AT_CreatedBy").ToString)%>' />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>

                                                    <asp:TemplateField HeaderText="Created At">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblCreatedAt" runat="server" CssClass="lbl" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.AT_CretedAt").ToString)%>' />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>

                                                </Columns>
                                            </asp:GridView>

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

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

    <script type="text/javascript">
        var saveSelectedTab = 0;

        function PageLoad_WFLAccessControl() {
            SetTabs();
           
        }

        function isNumberKey(evt) {
            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 SetTabs() {

            if (saveSelectedTab == 1) {
                $("#ctl00_MainContent_tabs_1").css("display", "none");
            }
            else if (saveSelectedTab == 0) {
                $("#ctl00_MainContent_tabs_2").css("display", "none");
            }


            $("#ctl00_MainContent_tabs").tabs({ active: saveSelectedTab });


            $('#ctl00_MainContent_tabs li').click(function (event, ui) {
               var selectedTab = $("#ctl00_MainContent_tabs").tabs('option', 'active');
                
                if (selectedTab == 0) {
                    
                    $("#ctl00_MainContent_tabs_1").css("display", "block");
                    $("#ctl00_MainContent_tabs_2").css("display", "none");
                    saveSelectedTab = selectedTab;
                   
                    
                    
                }
                else if (selectedTab == 1) {
                    $("#ctl00_MainContent_tabs_2").css("display", "block");
                    $("#ctl00_MainContent_tabs_1").css("display", "none");
                    saveSelectedTab = selectedTab;
                    
                }

            });


        }



    </script>
</asp:Content>
 