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

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="main-panel">
        <div class="row">
            <div class="col-md-12">
                <section class="panel">

                    <header class="panel-heading">
                        Approval Groups
                            <div class="pull-right">
                                <asp:Button Text="Save" CssClass="btn btn-info" ID="btn_save" Width="120px"
                                    ValidationGroup="save" runat="server" OnClick="btn_save_Click" />
                                <asp:Button Text="Back" CssClass="btn btn-info" ID="btn_cancel" runat="server"
                                    OnClick="btn_cancel_Click" />
                            </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" style="padding-top: 10px">
                            <asp:HiddenField ID="hid_controlgroupid" runat="server" />
                            <asp:HiddenField ID="hid_operatingunit" runat="server" />
                            <asp:HiddenField ID="hid_low_acc" runat="server" />
                            <asp:HiddenField ID="hid_cash_acc" runat="server" />
                            <label class="control-label col-md-3">Operating Unit</label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <asp:TextBox CssClass="form-control" ID="txt_operatingunit" runat="server">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save"
                                        runat="server" ID="req_operatingunit" ControlToValidate="txt_operatingunit"
                                        ErrorMessage="Operating Unit is Required!" />
                                    <span class="input-group-btn">
                                        <button id="btn_lov_operatingunit" type="button" runat="server"
                                            class="btn btn-white" onserverclick="btn_lov_operatingunit_Click">
                                            <i
                                                class="fa fa-search"></i>
                                        </button>
                                    </span>
                                </div>
                            </div>
                            <label class="col-md-2 control-label"></label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <%--<asp:TextBox CssClass="form-control" ID="txt_name" runat="server">
                                            </asp:TextBox>
                                            <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save"
                                                runat="server" id="req_name" controltovalidate="txt_name"
                                                errormessage="Name is Required!" /> --%>
                                </div>
                            </div>
                        </div>

                        <div class="row" style="padding-top: 10px">
                            <label class="col-md-3 control-label">Name</label>
                            <div class="col-md-3">
                                <asp:TextBox CssClass="form-control" ID="txt_name" runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save"
                                    runat="server" ID="req_name" ControlToValidate="txt_name"
                                    ErrorMessage="Name is Required!" />
                            </div>

                            <label class="col-md-2 control-label"></label>
                            <div class="col-md-3 text-left">
                                <span class="checkbox">
                                    <input id="chkbox_enabled" runat="server" type="checkbox"
                                        name="chkbox_enabled" />
                                    <label class="col-md-1 control-label"></label>
                                    Enabled</span>
                            </div>
                        </div>

                        <div class="row" style="padding-top: 10px">
                            <label class="control-label col-md-3">Decription</label>
                            <div class="col-md-4">
                                <asp:TextBox CssClass="form-control" ID="txt_description" runat="server">
                                </asp:TextBox>
                                <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save"
                                    runat="server" ID="req_description" ControlToValidate="txt_description"
                                    ErrorMessage="Description is Required!" />
                            </div>

                            <label class="col-md-2 control-label"></label>
                            <div class="col-md-3 text-left">
                                <%--<span class="checkbox"><input id="chkbox_innercityjurd" runat="server"
                                            type="checkbox" name="chkbox_innercityjurd" />
                                        <label class="col-md-1 control-label"></label>Inner City Jurisdiction</span>--%>
                            </div>
                        </div>

                        <div class="panel">
                            <div class="panel-heading">
                                <h3 class="panel-title">Approval Rules</h3>
                            </div>

                            <!--Panel Place-->
                            <div class="panel-body">


                                <div style="width: 102%; height: 250px; overflow: scroll">
                                    <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 HeaderText="Object" ControlStyle-Width="180px" ItemStyle-Width="180px">
                                                <ItemTemplate>
                                                    <div class="input-group">
                                                        <%--<asp:HiddenField ID="hid_CONTROL_GROUP_ID" runat="server"
                                                                    Value='<%#Bind("CONTROL_GROUP_ID")%>' />--%>

                                                        <asp:HiddenField ID="hid_CONTROL_RULE_ID" runat="server"
                                                            Value='<%#Bind("CONTROL_RULE_ID")%>' />

                                                        <asp:HiddenField ID="hid_object" runat="server"
                                                            Value='<%#Bind("OBJECT_CODE")%>' />
                                                        <asp:TextBox ID="txt_object" runat="server"
                                                            CssClass="form-control text"
                                                            Text='<%#Bind("OBJECT_NAMES") %>'></asp:TextBox>
                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_object" type="button"
                                                                runat="server" class="btn btn-white"
                                                                onserverclick="btn_lov_object_Click">
                                                                <i class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Type" ControlStyle-Width="150px" ItemStyle-Width="150px">
                                                <ItemTemplate>
                                                    <%--                                                                <asp:DropDownList CssClass="form-control" ID="ddl_type" 
                                                                    DataMember=""
                                                                    DataValueField='<%#Bind("RULE_TYPE_CODE") %>' runat="server">                                                                    
                                                                    <asp:ListItem Value="0">----Select----</asp:ListItem>  
                                                                    <asp:ListItem Value="1">Include</asp:ListItem>  
                                                                    <asp:ListItem Value="2">Exclude</asp:ListItem>
                                                                </asp:DropDownList>--%>

                                                    <asp:HiddenField ID="hid_ruletypecode" runat="server"
                                                        Value='<%#Bind("RULE_TYPE_CODE")%>' />

                                                    <asp:DropDownList CssClass="form-control select2"
                                                        ID="ddl_type" runat="server">
                                                    </asp:DropDownList>
                                                    <asp:RequiredFieldValidator SetFocusOnError="true"
                                                        ValidationGroup="d_save" runat="server"
                                                        ID="req_ddl_type" ControlToValidate="ddl_type"
                                                        ErrorMessage="Object Type is Required!" />
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <%--<%# Eval("RULE_TYPE_CODE") %>--%>

                                            <asp:TemplateField HeaderText="Amount Limit" ControlStyle-Width="100px" ItemStyle-Width="100px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_amountlimit" runat="server"
                                                        onkeypress="return numbersOnly(event);" CssClass="form-control"
                                                        Text='<%#Bind("Amount_Limit") %>'></asp:TextBox>
                                                    <%--<asp:RequiredFieldValidator SetFocusOnError="true"
                                                                    ValidationGroup="d_save" runat="server"
                                                                    id="req_rcv_date" controltovalidate="txt_rcv_date"
                                                                    errormessage="Receive Date is Required!" />--%>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Low Value" ControlStyle-Width="240px" ItemStyle-Width="240px">
                                                <ItemTemplate>
                                                    <div class="input-group">
                                                        <asp:HiddenField ID="hid_lowvalue" runat="server"
                                                            Value='<%#Bind("SEGMENT1_LOW")%>' />
                                                        <asp:TextBox ID="txt_lowvalue" runat="server"
                                                            CssClass="form-control text"
                                                            Text='<%#Bind("SEGMENT1_CODE_LOW") %>'></asp:TextBox>

                                                        <asp:RequiredFieldValidator Visible="false" SetFocusOnError="true" ValidationGroup="save" runat="server"
                                                            ID="req_lowvalue" ControlToValidate="txt_lowvalue" ErrorMessage="Account Required!" />
                                                        <span class="input-group-btn">
                                                            <button id="btn_add_low" type="button" data-target="#LowVal" data-toggle="modal" runat="server"
                                                                class="btn btn-white">
                                                                <i class="fa fa-plus" onclick="btn_add_low_Click"></i>
                                                            </button>
                                                        </span>

                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_lowvalue" type="button"
                                                                runat="server" class="btn btn-white"
                                                                onserverclick="btn_lov_lowvalue_Click">
                                                                <i class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="High Value" ControlStyle-Width="240px" ItemStyle-Width="240px">
                                                <ItemTemplate>
                                                    <div class="input-group">
                                                        <asp:HiddenField ID="hid_highvalue" runat="server"
                                                            Value='<%#Bind("SEGMENT1_HIGH")%>' />
                                                        <asp:TextBox ID="txt_highvalue" runat="server"
                                                            CssClass="form-control"
                                                            Text='<%#Bind("SEGMENT1_CODE_HIGH") %>'></asp:TextBox>

                                                        <asp:RequiredFieldValidator Visible="false" SetFocusOnError="true" ValidationGroup="save" runat="server"
                                                            ID="req_highvalue" ControlToValidate="txt_highvalue" ErrorMessage="Account Required!" />
                                                        <span class="input-group-btn">
                                                            <button id="btn_add_high" type="button" data-target="#CostVal" data-toggle="modal" runat="server"
                                                                class="btn btn-white">
                                                                <i class="fa fa-plus"></i>
                                                            </button>
                                                        </span>

                                                        <span class="input-group-btn">
                                                            <button id="btn_lov_highvalue" type="button"
                                                                runat="server" class="btn btn-white"
                                                                onserverclick="btn_lov_highvalue_Click">
                                                                <i class="fa fa-search"></i>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Inactive Date" ControlStyle-Width="120px" ItemStyle-Width="120px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_inactivedate" runat="server"
                                                        CssClass="form-control datetime"
                                                        Text='<%#Bind("INACTIVE_DATE") %>'></asp:TextBox>
                                                    <%--<asp:RequiredFieldValidator SetFocusOnError="true"
                                                                    ValidationGroup="d_save" runat="server"
                                                                    id="req_rcv_date" controltovalidate="txt_rcv_date"
                                                                    errormessage="Receive Date is Required!" />--%>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField HeaderText="Action" ItemStyle-Width="5%">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="linkedit" runat="server"
                                                        Visible="false" CommandName="gEdit"><i
                                                                        class="fa fa-pencil"
                                                                        style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="lnk_add" ValidationGroup="d_save"
                                                        runat="server" CommandName="gadd"><i
                                                                        class="fa fa-plus"
                                                                        style="font-size:20px !important;"></i>
                                                    </asp:LinkButton>
                                                    <asp:LinkButton ID="linkdlt" CausesValidation="false"
                                                        CommandName="gDelete" runat="server"
                                                        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>
                                <div class="row" style="padding-top: 10px">
                                    <div class="col-md-offset-0 ">
                                        <div class="modal fade" id="LowVal" role="dialog">
                                            <div class="modal-dialog modal-dialog-center">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                                                        <h4 class="modal-title">Costing Values :</h4>
                                                    </div>
                                                    <div class="modal-body">
                                                        <asp:Repeater ID="rpt_cost" runat="server" OnItemDataBound="rpt_cost_OnItemDataBound">
                                                            <ItemTemplate>
                                                                <div class="form-group">
                                                                    <div class="col-lg-1"></div>
                                                                    <asp:Label ID="r_lbl" runat="server" class="col-lg-3 col-sm-3 control-label" Text='<%# Eval("PROMPT") %>'></asp:Label>
                                                                    <div class="col-lg-6">

                                                                        <asp:DropDownList Width="320px" ID="ddl_r_value" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                                                        <asp:HiddenField ID="hid_field_name" runat="server" Value='<%# Eval("col_name") %>'></asp:HiddenField>
                                                                        <asp:HiddenField ID="hid_vs_name" runat="server" Value='<%# Eval("SEG_VALUE_SET") %>'></asp:HiddenField>
                                                                        <asp:HiddenField ID="hid_value" runat="server" Value='<%# Eval("VALUE") %>'></asp:HiddenField>

                                                                    </div>
                                                                </div>

                                                            </ItemTemplate>
                                                        </asp:Repeater>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <asp:Button ID="btn_rpt_load" runat="server" CssClass="btn btn-default" Text="Save & Close" OnClick="btn_rpt_load_Click"></asp:Button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                                <hr />




                        </div>

                        <hr />

                        <div class="row">
                            <asp:Label CssClass="control-label col-md-offset-2" ID="lbl_due" runat="server">
                            </asp:Label>
                        </div>

                    </div>
                </section>
            </div>
        </div>
    </div>
</asp:Content>
