<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="True" CodeBehind="PAY_ELEMENT_LINKS.aspx.cs"
    Inherits="HRMS.PAY_ELEMENT_LINKS" Title="Cloud HR - Element Link" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Panel ID="main_pnl" runat="server">
        <div class="row">
            <div class="col-lg-12">
                <section class="panel">
                    <header class="panel-heading">Element Link
                    <div class="pull-right">
                        <asp:Button ID="btnSave" class="btn btn-info" runat="server" Text="Save"  onclick="btnSave_Click" ValidationGroup="save" ></asp:Button>
                        <a href="#" id="aCancel" runat="server" class="btn btn-info">Back</a>
                    </div>
                    </header>
                        <div class="panel-body">



                                <div class="span6">
                                    <div id="divMessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                         <i class="icon-check-sign"></i>
                                        <asp:Label ID="lblMessage" class="msg" runat="server" Text="" ></asp:Label>
                                    </div>
                                        <div class="span6">
                                            <div id="diverrorMessage" runat="server" visible="false" class="alert alert-danger alert-dismissable">
                                             <i class="icon-check-sign"></i>
                                             <asp:Label ID="lblerrorMessage" class="msg" runat="server" Text="" ></asp:Label>
                                           </div>
                                        </div>
                                </div>

                                <div class="row">
                                     <div class="col-md-11 col-md-offset-1">
                                        <div class="row">
                                            <div class="col-md-6">
                                               <label class="control-label col-md-4">Business Group</label>
                                               <div class="col-md-8">
                                                    <asp:DropDownList ID="ddl_BUSINESS_GROUP_ID" runat="server" CssClass="form-control select2" ></asp:DropDownList>
                                                    <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_ddl_BUSINESS_GROUP_ID" ControlToValidate="ddl_BUSINESS_GROUP_ID" ErrorMessage="Business Group is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                                     
                                               </div>
                                             </div>
                                         </div>
                                     </div>
                                </div>
                                <div class="row">
                                     <div class="col-md-11 col-md-offset-1">
                                       <div class="row">
                                            <div class="col-md-6">
                                               <label class="control-label col-md-4">Element Name</label>
                                               <div class="col-md-8">
                                                    <asp:HiddenField ID="hid_ELEMENT_LINK_ID" runat="server"></asp:HiddenField>
                                                    <asp:HiddenField id="hid_cost" runat="server" />
                                                    <asp:DropDownList ID="ddl_ELEMENT_TYPE_ID" runat="server" 
                                                        CssClass="form-control select2" AutoPostBack="True" 
                                                        onselectedindexchanged="ddl_ELEMENT_TYPE_ID_SelectedIndexChanged"></asp:DropDownList>
                                                    <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_ddl_ELEMENT_TYPE_ID" ControlToValidate="ddl_ELEMENT_TYPE_ID" ErrorMessage="Element Name is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                                               </div>
                                             </div>
                                            <div class="col-md-6">
                                               <label class="control-label col-md-4">Reporting Name</label>
                                               <div class="col-md-8">
                                                  <asp:TextBox ID="txt_rpt_name" CssClass="form-control" Enabled="false" runat="server"></asp:TextBox>
                                               </div>
                                             </div>
                                         </div>
                                     </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-10 col-md-offset-1">
                                        <h5>Eligibility Criteria</h5>    
                                         <hr />
                                       <div class="row">
                                         <div class="col-md-6">
                                           <label class="control-label col-md-4">Organization</label>
                                           <div class="col-md-8">
                                                <asp:DropDownList ID="ddl_ORGANIZATION_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                           </div>
                                         </div>
                                         <div class="col-md-6">
                                           <label class="control-label col-md-4">Group</label>
                                           <div class="col-md-8">
                                                <asp:DropDownList ID="ddl_PEOPLE_GROUP_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                           </div>
                                         </div>
                                       </div>
                                       <div class="row">
                                         <div class="col-md-6">
                                           <label class="control-label col-md-4">Job</label>
                                           <div class="col-md-8">
                                                <asp:DropDownList ID="ddl_JOB_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                           </div>
                                         </div>
                                         <div class="col-md-6">
                                           <label class="control-label col-md-4">Position</label>
                                           <div class="col-md-8">
                                               <asp:DropDownList ID="ddl_POSITION_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                           </div>
                                         </div>
                                       </div>
                                       <div class="row">
                                          <div class="col-md-6">
                                            <label class="control-label col-md-4">Grade</label>
                                            <div class="col-md-8">
                                                <asp:DropDownList ID="ddl_GRADE_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                            </div>
                                          </div>
                                          <div class="col-md-6">
                                            <label class="control-label col-md-4">Location</label>
                                            <div class="col-md-8">
                                              <asp:DropDownList ID="ddl_LOCATION_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                            </div>
                                          </div>
                                        </div>
                                       <div class="row">
                                          <div class="col-md-6">
                                            <label class="control-label col-md-4">Emp. Category</label>
                                            <div class="col-md-8">
                                               <asp:DropDownList ID="ddl_EMPLOYMENT_CATEGORY" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                            </div>
                                          </div>
                                          <div class="col-md-6">
                                            <label class="control-label col-md-4">Payroll</label>
                                            <div class="col-md-8">
                                              <asp:DropDownList ID="ddl_PAYROLL_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                            </div>
                                          </div>
                                        </div>
                                       <div class="row">
                                          <div class="col-md-6">
                                          </div>
                                          <div class="col-md-6">
                                            <div class="col-md-4"></div>
                                             <div class="col-md-8">
                                             <asp:CheckBox ID="chk_LINK_TO_ALL_PAYROLLS_FLAG" runat="server" CssClass="checkboxes" Text="Link To All Payroll"></asp:CheckBox>
                                             </div>

                                          </div>
                                        </div>


                                    </div>
                                  </div>


                                  

                          <%--Costing Values Repeater--%>
                          <div class="modal fade" id="CostVal" 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>
                                  <hr />
                                              <%--<div class="form-group">
                                              <div class="col-lg-1"></div>
                                                <asp:Label ID="Label1" runat="server" class="col-lg-3 col-sm-3 control-label" Text="Balancing Account"></asp:Label>
                                                <div class="col-lg-6">
                                                     <asp:DropDownList ID="ddl_bal_account" runat="server" CssClass="form-control"></asp:DropDownList>

                                                </div>
                                            </div>--%>
                                  <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal" >Select & Close</button>
                                  </div>
                                </div>
                               </div>
                            </div>


                            <%--Balancing Values Repeater--%>
                          <div class="modal fade" id="BalVal" 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">Balancing Values :</h4>
                                  </div>
                                  <div class="modal-body">
                                        <asp:Repeater ID="rpt_bal" runat="server" OnItemDataBound="rpt_bal_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("PROMPTT") %>'></asp:Label>
                                                <div class="col-lg-6">
                                                     <asp:DropDownList Width="320px"  ID="ddl_br_value" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                                     <asp:HiddenField ID="hid_b_field_name" runat="server" Value='<%# Eval("col_namee") %>' ></asp:HiddenField>
                                                     <asp:HiddenField ID="hid_b_vs_name" runat="server" Value='<%# Eval("SEG_VALUE_SETT") %>' ></asp:HiddenField>
                                                     <asp:HiddenField ID="hid_b_value" runat="server" Value='<%# Eval("VALUEE") %>' ></asp:HiddenField>

                                                </div>
                                            </div>
                                            
                                           </ItemTemplate>
                                       </asp:Repeater>
                                        
         
                                  </div>
                                  <hr />
                                              <%--<div class="form-group">
                                              <div class="col-lg-1"></div>
                                                <asp:Label ID="Label1" runat="server" class="col-lg-3 col-sm-3 control-label" Text="Balancing Account"></asp:Label>
                                                <div class="col-lg-6">
                                                     <asp:DropDownList ID="ddl_bal_account" runat="server" CssClass="form-control"></asp:DropDownList>

                                                </div>
                                            </div>--%>
                                  <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal" >Select & Close</button>
                                  </div>
                                </div>
                               </div>
                            </div>

                                  <div class="row">
                                    <div class="col-md-10 col-md-offset-1">
                                     <asp:GridView ID="grdObject" runat="server" AutoGenerateColumns="false" cellpadding="0" cellspacing="0" border="0" class="display" OnRowDataBound="OnRowDataBound" OnRowCommand="OnRowCommand" >
                                                    <Columns>
                                                        <asp:TemplateField ItemStyle-Width="30%" HeaderText ="Calculation Column">
                                                            <ItemTemplate  >
                                                                <asp:DropDownList ID="ddl_CALC_ELEMENT_TYPE_ID" CssClass="form-control select2" runat="server" Width="100%" ></asp:DropDownList>
                                                                <asp:Label ID="lbl_CALC_ELEMENT_TYPE_ID" runat="server" Text='<%# Eval("CALC_ELEMENT_TYPE_ID") %>' Visible = "false" />
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField ItemStyle-Width="15%" HeaderText ="Calculation Value">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txt_CALCULATION_VALUE" CssClass="form-control" runat="server" Width="100%"   Text='<%# Bind("CALCULATION_VALUE") %>'></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField ItemStyle-Width="15%" HeaderText ="Date From">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txt_EFFECTIVE_START_DATE" CssClass="form-control" runat="server" Width="100%"   Text='<%# Bind("EFFECTIVE_START_DATE") %>'></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>

                                                        <asp:TemplateField ItemStyle-Width="15%" HeaderText ="Date To">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txt_EFFECTIVE_END_DATE" CssClass="form-control" runat="server" Width="100%"   Text='<%# Bind("EFFECTIVE_END_DATE") %>'></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>

                                                        <asp:TemplateField ItemStyle-Width="10%" HeaderText="Action">
                                                            <ItemTemplate>
                                                                <asp:LinkButton ID="lnkAdd" runat="server" CommandName="gAdd"><i class="fa fa-plus" style="font-size:20px !important"></i></asp:LinkButton>
                                                                &nbsp
                                                                <asp:LinkButton ID="lnkDelete" runat="server" CommandName="gDelete" OnClientClick="return confirm('Are you sure to delete?')"><i class="fa fa-trash" style="font-size:20px !important"></i></asp:LinkButton>
                        
                        
                            
                                                             </ItemTemplate>
                                                        </asp:TemplateField>
                                                    </Columns>
                                                    <%-- Mandatory--%>
                                                    <RowStyle CssClass="rowStyle"/>
                                                   <%-- Mandatory--%>
                                                    <HeaderStyle CssClass="headerStyle" />
                                                   <%-- optional--%>
                                                   <FooterStyle  CssClass="footerStyle"  />
                                                </asp:GridView>
                                    </div>
                                   </div>

                                   <br />

                                    <div class="row">
                           <div class="col-md-3 pull-right">
                            <a href="#" data-target="#CostVal" data-toggle="modal" id="btn_CostVal"   runat="server" class="btn btn-block btn-info">Costing Values</a>
                           </div>
                           <div class="col-md-3 pull-right">
                            <a href="#" data-target="#BalVal" data-toggle="modal" id="A3"   runat="server" class="btn btn-block btn-info">Balancing Values</a>
                           </div>
                          </div>

                          
                                <div class="form-group">
                                <asp:Repeater ID="add_info" runat="server">
                                <HeaderTemplate> <header class="panel-heading">Additional Information</header><br /></HeaderTemplate>
                                <ItemTemplate>
                                    <div class="form-group">
                                        <div class="col-lg-1"></div>
                                        <asp:Label ID="r_lbl" runat="server" class="col-lg-2 col-sm-2 control-label" Text='<%# Eval("PROMPT") %>'></asp:Label>
                                        <div class="col-lg-4">
                                            <asp:TextBox ID="txt_r_value" runat="server"  placeholder='<%# Eval("PROMPT") %>' Text='<%# Eval("value") %>' CssClass="form-control"></asp:TextBox>
                                            <asp:HiddenField ID="hid_field_name" runat="server" Value='<%# Eval("col_name") %>' ></asp:HiddenField>
                                        </div>
                                    </div>
                                </ItemTemplate>
                                </asp:Repeater>
                                </div>




                             </div>
                         </section>
            </div>
        </div>
    </asp:Panel>

    <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>
