<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
    CodeBehind="GL_Period_Types.aspx.cs" Inherits="HRMS.GL.Accounting_Calender.GL_Period_Types" %>

<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_period_type.ClientID %>').value = "";

                }
            </script>
            <div class="main-panel">
                <div class="row">
                    <div class="col-md-12">
                        <section class="panel">
                    <header class="panel-heading">
                     Period Types
                        <div class="pull-right">
                            <asp:button text="Save" CssClass="btn btn-info" ID="btn_save" Width="120px" runat="server"  
                                onclick="btn_save_Click"/>
                            <asp:button text="Back" CssClass="btn btn-info" ID="btn_cancel" 
                                runat="server" onclick="btn_cancel_Click" Visible= "false"/>

                                 <%--<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">
                                <label class="control-label col-md-2" runat="server" visible="false">Period Type</label>
                                <div class="col-md-3">
                                    <asp:HiddenField ID="hid_period_type" runat="server"  visible="false"/>
                                    <asp:TextBox ID="txt_period_type" CssClass="form-control" visible="false" runat="server"></asp:TextBox>
                                    <%--<asp:RequiredFieldValidator ValidationGroup="save"   runat="server" id="req_period_type" controltovalidate="txt_period_type" errormessage="Period Type Required!" />--%>
                                </div>

                                  <label id="Label1" class="control-label col-md-2" runat="server" visible="false">Period Per Year</label>
                                <div class="col-md-2">
                                    <asp:TextBox ID="txt_period_per_year" CssClass="form-control" visible="false" runat="server"></asp:TextBox>
                                   <%-- <asp:RequiredFieldValidator ValidationGroup="save" runat="server" id="req_period_per_year" SetFocusOnError="true" controltovalidate="txt_period_per_year" errormessage="Period Year Required!" />--%>
                                </div>

                            </div>


                            <div class="row" style="padding-top:10px">
                                <label id="Label2" class="control-label col-md-2" runat="server" visible="false">Year Type</label>
                                <div class="col-md-2">
                                <asp:dropdownlist CssClass="form-control" runat="server" visible="false" ID="drop_year_type">
                                </asp:dropdownlist>
                                   <%-- <asp:TextBox ID="gk" CssClass="form-control" runat="server"></asp:TextBox>--%>
                                </div>

                                  <label id="Label3" class="control-label col-md-3" visible="false" runat="server">Description</label>
                                <div class="col-md-4">
                                    <asp:TextBox ID="txt_desc" CssClass="form-control" visible="false" runat="server"></asp:TextBox>
                                   <%-- <asp:RequiredFieldValidator runat="server" id="req_desc" SetFocusOnError="true" controltovalidate="txt_desc" errormessage="Description Required!" />--%>
                                </div>

                            </div>


                            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                        CssClass="table table-striped table-bordered table-hover" CellPadding="0" 
                             onrowcommand="GridView2_RowCommand" onrowdatabound="GridView2_RowDataBound">
                                <Columns>
                                <asp:TemplateField HeaderStyle-Width="10px">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hid_per_type" runat="server" Value='<%#Bind("PERIOD_TYPE_ID")%>' />
                                        <asp:HiddenField ID="hid_type" runat="server" Value='<%#Bind("YEAR_TYPE_IN_NAME")%>' />
                                    </ItemTemplate>
                                </asp:TemplateField>    

                                <asp:TemplateField HeaderText="Period Type">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_pr_type" runat="server" CssClass="form-control" Text='<%#Bind("PERIOD_TYPE") %>' Enabled='<%#bool.Parse(Eval("PERIOD_TYPE").ToString() != "" ? "False" : "True") %>'></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                  <asp:TemplateField HeaderText="Period Per Year" HeaderStyle-Width="150px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_pr_year" runat="server" CssClass="form-control" Text='<%#Bind("NUMBER_PER_FISCAL_YEAR") %>' Enabled='<%#bool.Parse(Eval("NUMBER_PER_FISCAL_YEAR").ToString() != "" ? "False" : "True") %>'></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Year Type" HeaderStyle-Width="160px">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddl_type" runat="server" CssClass="form-control"></asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Description">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_desc" runat="server" CssClass="form-control" Text='<%#Bind("DESCRIPTION") %>' Enabled='<%#bool.Parse(Eval("DESCRIPTION").ToString() != "" ? "False" : "True") %>'></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                
                                    <asp:TemplateField HeaderText="Action" ItemStyle-Width="6%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="linkedit"  runat="server" CommandName="gEdit"><i class="fa fa-pencil" style="font-size:20px !important;"></i></asp:LinkButton>
                                            <asp:linkbutton ID="linkdlt" CausesValidation="false" CommandName="gDelete" runat="server" Visible="false" OnClientClick="return confirm('Are you sure to delete?')"><i class="fa fa-trash" style="font-size:20px !important"></i></asp:linkbutton>
                                        </ItemTemplate> 
                                            <ItemStyle Width="6%"></ItemStyle>
                                    </asp:TemplateField>
                                </Columns>
                                    <%--<FooterStyle CssClass="footerStyle" />
                                    <HeaderStyle CssClass="headerStyle" />
                                    <RowStyle CssClass="rowStyle" />--%>
                            </asp:GridView>


                    </div>
                </section>
                    </div>
                </div>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btn_save" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
