<%@ page language="C#" autoeventwireup="true" masterpagefile="~/MasterFile/TimeCheck.master" inherits="Organization_Settings_Organization_LevelDetails, App_Web_khau1nsh" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="server">

    <script language="javascript" type="text/javascript">

        var AreyousuretoDelete = "Are you sure to Delete ";

        function SetAlertMessages(areyousuretoDelete) {
            AreyousuretoDelete = areyousuretoDelete;
        }
        function ConfirmDelete(id) {
            if (confirm(AreyousuretoDelete)) {
                location.href = "delLevels.aspx?nid=" + id + "&sid=<%=Session.SessionID %>";
            }
            else {
                return false;
            }
        }
    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/org-icon.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lblHeader" runat="server" Text="Organization Hierarchy"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-4">
                    <h5>
                        <asp:Label ID="lblHead" runat="server" Style="padding-left: 10px; padding-right: 10px; font-weight: bold;"></asp:Label></h5>
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        <div class="row  form-group">
                            <div class="col-md-1"></div>
                            <div class="col-md-9">
                                <asp:GridView ID="grvLevel" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                                    CssClass="table table-responsive table-bordered" AllowSorting="True" DataSourceID="ObjectDataSource1"
                                    OnRowDataBound="grvLevel_RowDataBound">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Level ID" Visible="False" HeaderStyle-BorderStyle="Solid"
                                            HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid"
                                            ItemStyle-BorderColor="#FFFFFF" ItemStyle-BorderWidth="1px">
                                            <ItemTemplate>
                                                <asp:Label ID="lblLevelID" Text='<%# Eval("levelId") %>' runat="server"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Level No" SortExpression="levelId" Visible="false"
                                            HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#FFFFFF"
                                            ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF" ItemStyle-BorderWidth="1px">
                                            <ItemTemplate>
                                                <asp:Label ID="lblleveId" Text='<%# Eval("childId") %>' runat="server">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Child Level" SortExpression="levelName" HeaderStyle-BackColor="#d9f0fb" HeaderStyle-ForeColor="black">
                                            <ItemTemplate>
                                                <a href="Organization_LevelDetails.aspx?tid=<%# Eval("childId") %>&sid=<%=Session.SessionID %>">
                                                    <asp:Label ID="lblLevelName" Text='<%# Eval("childLevelName") %>' runat="server" Style="text-decoration: underline;"></asp:Label></a>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Parent Level" SortExpression="parentLevelId" Visible="false" HeaderStyle-BackColor="#d9f0fb" HeaderStyle-ForeColor="black"
                                            HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px" HeaderStyle-BorderColor="#FFFFFF"
                                            ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF" ItemStyle-BorderWidth="1px">
                                            <ItemTemplate>
                                                <asp:Label ID="lblparentLevelId" Text='<%# Eval("parentLevelId") %>' runat="server">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Delete" SortExpression="levelId" HeaderStyle-BackColor="#d9f0fb" HeaderStyle-ForeColor="black">
                                            <ItemTemplate>
                                                <a href="javascript:;" onclick='ConfirmDelete(<%#Eval("childId")%>)'>
                                                    <asp:Label ID="lbllev" Text='Delete' runat="server" Style="text-decoration: underline;"></asp:Label></a>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <PagerStyle VerticalAlign="Bottom" HorizontalAlign="Right" Font-Overline="False"
                                        BorderColor="#FFFFFF" BorderStyle="solid" BorderWidth="1px" Font-Size="Smaller" />
                                    <PagerSettings Mode="NumericFirstLast" FirstPageText="First" LastPageText="Last"
                                        NextPageText="Next" PreviousPageText="&lt;" />
                                </asp:GridView>
                                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="selectLevelDetails"
                                    TypeName="levelsEventData">
                                    <SelectParameters>
                                        <asp:QueryStringParameter Name="lel_Id" QueryStringField="tid" Type="Int32" />
                                    </SelectParameters>
                                </asp:ObjectDataSource>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-1"></div>
                            <div class="col-md-9">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="butAdd" CssClass="btn add-btn fa-plus" runat="server" OnClick="butAdd_Click" />
                                    <asp:LinkButton ID="btn_Cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                        OnClick="btn_Cancel_Click" CausesValidation="false" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
