<%@ Page Title="UserSecurity" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="UserSecurity.aspx.cs" Inherits="ZFJINV.Administration.UserSecurity" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="row">
        <div class="col-md-12 mySpace">
            <asp:UpdatePanel runat="server">
                <ContentTemplate>
                    <div class="caption" style="padding-bottom: 12px;">
                        <span class="caption-subject font-blue sbold" style="font-size: 150%;">Manage User Rights</span>
                    </div>
                    <div class="ui segment">
                        <div class="ui stackable form">
                            <div class="col-md-3">
                                <label class="lbStyle">User:</label>
                                <asp:DropDownList
                                    ID="txtUser"
                                    AutoPostBack="true"
                                    OnSelectedIndexChanged="txtUser_SelectedIndexChanged"
                                    runat="server"
                                    required="required" onchange="showHide(this.value);"
                                    class="select2 form-control">
                                </asp:DropDownList>
                            </div>
                            <div id="test" style="display: none;">

                                <img src="../assets/global/img/hour.gif" style="margin-top: 22px;" />
                            </div>
                            <%--<img src="../assets/global/img/loader1.gif" style="display: none; margin-top: 22px;" id="userLoader" />--%>
                            <div class="row">
                            </div>
                        </div>
                    </div>
                    <div class="rounded-corners">
                        <div style="width: 100%; overflow: auto;">
                            <asp:GridView ID="grdUserRights" runat="server" AllowPaging="False" AllowSorting="False"
                                AutoGenerateColumns="False"
                                DataKeyNames="ModuleID"
                                GridLines="Horizontal"
                                BorderColor="#ECF0F1"
                                BorderRadius="15px"
                                AlternatingRowStyle-BackColor="#F2F3F4"
                                RowStyle-Wrap="false"
                                HeaderStyle-Wrap="false"
                                RowStyle-BorderColor="#e8e8ec"
                                CssClass="gridviewdesign "
                                RowStyle-CssClass="GV"
                                OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                                OnRowCommand="GridView1_RowCommand"
                                OnRowDeleting="GridView1_RowDeleting"
                                OnPageIndexChanging="GridView1_PageIndexChanging"
                                EmptyDataText="No point of sales to display">
                                <Columns>
                                    <asp:BoundField DataField="ModuleID" Visible="false" HtmlEncode="False" HeaderText="ModuleID" ReadOnly="True" SortExpression="ModuleID" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                    <asp:BoundField DataField="Name" ReadOnly="true" HtmlEncode="False" HeaderText="Name" SortExpression="Name" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                    <asp:CheckBoxField DataField="CanView" HeaderText="Can View" SortExpression="Can View" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                    <asp:CheckBoxField DataField="CanAdd" HeaderText="Can Add" SortExpression="Can Add" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                    <asp:CheckBoxField DataField="CanEdit" HeaderText="Can Edit" SortExpression="Can Edit" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                    <asp:CheckBoxField DataField="CanDelete" HeaderText="Can Delete" SortExpression="Can Delete" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                    <asp:CheckBoxField DataField="CanPost" HeaderText="Can Post" SortExpression="Can Post" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />


                                    <asp:TemplateField HeaderText="Action" InsertVisible="False" SortExpression="Action" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lblEdit" CommandArgument='<%# Eval("ModuleID") %>' CommandName="EditRow"
                                                 runat="server" value="Remove" >Edit

                                            <%--   <div  style="display: none;" id="editLoader" >
                                             OnClientClick="return GetSelectedRow(this); javascript:shouldsubmit=true;"   <img src="../assets/global/img/loading.gif"  />
                                            </div>     
                               
                                                       --%>

                                               
                                            </asp:LinkButton>
                                       
                                        </ItemTemplate>

                                        <EditItemTemplate>
                                            <asp:LinkButton ID="lblUpdate" ToolTip="Update" CommandArgument='<%# Eval("ModuleID") %>' CommandName="UpdateRow" runat="server">Update</asp:LinkButton>
                                            <asp:LinkButton ID="lblCancel" ToolTip="Cancel" CommandArgument='<%# Eval("ModuleID") %>' CommandName="CancelRow" runat="server">Cancel</asp:LinkButton>
                                        </EditItemTemplate>


                                    </asp:TemplateField>


                                </Columns>
                            </asp:GridView>


                        </div>
                        <div class="ui segment col-md-12" style="border-color: #AAB7B8;">
                            <div class="col-md-12">
                                <div class="messagealert" id="alert_container">
                                </div>
                            </div>
                            <asp:Button ID="btnAdd" runat="server" class="ui button green" OnClick="btnAdd_Click" Text="Save" /><br />

                        </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="grdUserRights" />
                </Triggers>
            </asp:UpdatePanel>

        </div>
    </div>

  
    <script>
        <%--   var table = document.getElementById('<%=grdUserRights.ClientID %>');
        var val;
        var row = spinner.parentNode.parentNode;

        var rindex = row.rowIndex; // get gridview row index


        val = table.rows[rindex].cells[1].children[0].value;
        alert("cnfkdnkfjdkf" + val);--%>


        <%-- var rowData = row.parentNode.parentNode;
                var rowIndex = rowData.rowIndex;
                document.getElementById("<%=hdValue.ClientID %>").value = rowIndex;--%>

        //function GetSelectedRow(lnk) {
        //    var row = lnk.parentNode.parentNode;
        //    var rowIndex = row.rowIndex - 1;
            
        //    alert("RowIndex: " + rowIndex);
        //    return false;
        //}

        //$('input[value=Remove]').click(function () {
        //    $(this).closest('tr').alert("djkkhshdjkshjk");
        //});
    </script>
</asp:Content>
