<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="COA_structure.aspx.cs" Inherits="HRMS.GL.ChartOfAccount.COA_structure" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ScriptManager ID="scriptManager" runat="server">
    </asp:ScriptManager>

     <asp:UpdatePanel runat="server" ID="upMain" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <ContentTemplate>
<script type="text/javascript">
    function clearTextBox() {
        var elements = document.getElementsByTagName("input");
        for (var ii = 0; ii < elements.length; ii++) {
            if (elements[ii].type == "text") {
                elements[ii].value = "";
            }
        }
        document.getElementById('<%=hid_str_id.ClientID %>').value = "";

    }
</script>

    <div class="panel">
        <div class="row">
            <div class="col-md-12">
                <section class="panel">
                    <header class="panel-heading">
                    Structure
                        <div class="pull-right">
                            <asp:button text="Save" CssClass="btn btn-info" ID="btn_save" runat="server"  ValidationGroup="save"
                                onclick="btn_save_Click"/>
                            <asp:button text="Back" CssClass="btn btn-info" ID="btn_cancel" runat="server" 
                                onclick="btn_cancel_Click"/>

                                 <input type="button" value="Clear" class="btn btn-info" onclick="clearTextBox()" />
                        </div>
                    </header>

                    <div class="panel-body">
                        <div class="span6">
                                <div id="divmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                    <asp:label text="" ID="lbl_msg" CssClass="msg" runat="server"></asp:label>
                                </div>
                            </div>

                            <div class="span6">
                                <div id="diverrmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                    <asp:label text="" id="lbl_err_msg" CssClass="msg" runat="server"></asp:label>
                                </div>
                            </div>

                             <div class="row">
                                <asp:HiddenField ID="HiddenField1" runat="server" />
                                <label id="Label7" class="control-label col-md-2" runat="server">Application</label>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="DropDownList1" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                </div>

                                <label id="Label8" class="control-label col-md-2" runat="server">Flex Field</label>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="DropDownList2" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                </div>
                            </div>


                            <div class="row" style="padding-top:05px">
                                <asp:HiddenField ID="hid_str_id" runat="server" />
                                <label class="control-label col-md-2" runat="server">Business Gruoup</label>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddl_business_grp" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                </div>

                                <label id="Label1" class="control-label col-md-2" runat="server">Status</label>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddl_status" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                </div>
                            </div>


                            <div class="row" style="padding-top:05px">
                                <label id="Label2" class="control-label col-md-2" runat="server">Structure Code</label>
                                <div class="col-md-3">
                                    <asp:TextBox ID="txt_str_code" runat="server" CssClass="form-control"></asp:TextBox>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server" id="req_str_code" controltovalidate="txt_str_code" errormessage="Structure Code Required!" />
                                </div>

                                <label id="Label3" class="control-label col-md-2" runat="server">Title</label>
                                <div class="col-md-3">
                                    <asp:TextBox ID="txt_title" runat="server" CssClass="form-control"></asp:TextBox>
                                    
                                </div>
                            </div>

                            <div class="row" style="padding-top:05px">
                                <label id="Label4" class="control-label col-md-2" runat="server">Description</label>
                                <div class="col-md-8">
                                    <asp:TextBox ID="txt_desc" runat="server" CssClass="form-control"></asp:TextBox>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server" id="req_desc" controltovalidate="txt_desc" errormessage="Description Required!" />
                                </div>
                            </div>
                           <hr />

                            <div class="row" style="padding-top:05px">
                                <label id="Label5" class="control-label col-md-2" runat="server">Start Date</label>
                                <div class="col-md-3">
                                    <asp:TextBox ID="txt_strt_date" runat="server" CssClass="form-control form_datetime"></asp:TextBox>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server" id="req_strt_date" controltovalidate="txt_strt_date" errormessage="Date Required!" />
                                </div>

                                <label id="Label6" class="control-label col-md-2" runat="server">End Date</label>
                                <div class="col-md-3">
                                    <asp:TextBox ID="txt_end_date" runat="server" CssClass="form-control form_datetime"></asp:TextBox>
                                </div>
                            </div>
                            <hr />
                            <div class="pull-right">
                                <asp:Button ID="btn_add_dtl" runat="server" CssClass="btn btn-info" 
                                    Text="Add Value Set" onclick="btn_add_dtl_Click" />
                            </div>

                            <br />
                            <hr />
                            <h4>List Of Value Sets</h4>
                            <asp:Gridview runat="server" ID="GridView1" CssClass="display" 
                            CellPadding="0" border="0" AutoGenerateColumns="false" 
                            onrowcommand="GridView1_RowCommand">
                <Columns>
                    <asp:BoundField DataField="FLEX_VALUE_SET_ID" HeaderText="ID" />
                    <asp:BoundField DataField="FLEX_VALUE_SET_NAME" HeaderText="Name" />
                    <asp:BoundField DataField="DESCRIPTION" HeaderText="Description" />

                    <asp:TemplateField HeaderText="Action">
                        <ItemTemplate>
                            <asp:linkbutton text="text" ID="linkbtn" CommandName="iedit" runat="server">
                                  <span class ="fa  fa-pencil" style="font-size:20px"></span>
                            </asp:linkbutton>

                            <asp:linkbutton text="text" ID="lnkbtn" CommandName="idelete" Visible="false" OnClientClick="return confirm('Are you sure to delete?')" runat="server">
                                <span class ="fa fa-trash" style="font-size:20px"></span>
                            </asp:linkbutton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                 <FooterStyle CssClass="footerStyle" />
                            <HeaderStyle CssClass="headerStyle" />
                            <RowStyle CssClass="rowStyle" />
              </asp:Gridview>


            <script src="/ThemeScrips/Datatables/media/js/jquery.js" type="text/javascript"></script>
                    <script src="/ThemeScrips/Datatables/media/js/jquery.datatables.min.js" type="text/javascript"></script>
                    <script src="/ThemeScrips/Datatables/media/js/jquery.Datatables.js" type="text/javascript"></script>
                    <script src="/ThemeScrips/Datatables/media/js/GridviewFix.js" type="text/javascript"></script>
                    <script type="text/javascript">
                        $("#ContentPlaceHolder1_GridView1").GridviewFix().dataTable();
                    </script>
                    </div>
                </section>
            </div>
        </div>
    </div>
    
</ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btn_save" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowCommand" />
        </Triggers>
    </asp:UpdatePanel>

    <script src="../../ThemeScrips/jquery.min.js"></script>
    <link href="../../ThemeScrips/select2.min.css" rel="stylesheet" />
    <script src="../../ThemeScrips/select2.min.js"></script>
    <script>
        $('.select2').select2();
    </script>
</asp:Content>
