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

<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" style="padding-bottom:30px">
                           <span class="label label-primary">  Recruitment Requisition</span>
                      

                         <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" />
                            <asp:button text="Reset" Visible="false" CssClass="btn btn-info" ID="btn_clear" runat="server" onclick="btn_clear_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">
                            <asp:HiddenField runat="server" ID="hid_requisition" />
                            
                            <asp:HiddenField runat="server" ID="hid_req" />
                            <label class="control-label  col-xs-11 col-sm-3 col-md-2 col-lg-2">Business Group</label>
                             <div class="col-xs-11 col-sm-7 col-md-3 col-lg-3">
                                 <asp:DropDownList CssClass="form-control select2" ID="ddl_busgroup" runat="server"></asp:DropDownList>
                                 <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server"
                                  id="res_busgroup" controltovalidate="ddl_busgroup" errormessage="Business Group is Required!" />

                                 <%--<div class="input-group">
                                 <asp:TextBox  CssClass="form-control" ID="txt_req" runat="server"></asp:TextBox>
                                 <asp:RequiredFieldValidator Visible="false" SetFocusOnError="true" ValidationGroup="save" 
                                     runat="server" id="req_acc" controltovalidate="txt_acc" errormessage="Account Required!" />
                                    <span class="input-group-btn">
                                    <button id="btn_lov_req_by" type="button" runat="server" 
                                        class="btn btn-white" onserverclick="btn_lov_req_by_Click"><i class="fa fa-search"></i></button>
                                    </span>
                                </div>--%>

                             </div>

                            <label class="control-label col-xs-11 col-sm-3 col-md-2 col-lg-2">Request Date</label>
                            <div class="col-xs-11 col-sm-7 col-md-3 col-lg-3">
                                <asp:TextBox ID="txt_req_date" runat="server" CssClass="form-control datetime"></asp:TextBox>
                                <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server"
                                  id="req_req_date" controltovalidate="txt_req_date" errormessage="Request Date is Required!" />
                            </div>
                        </div>

                        <div class="row"style="padding-top:05px">                            
                           
                            

                            <label class="control-label  col-xs-11 col-sm-3 col-md-2 col-lg-2">Request By#</label>
                             <div class="col-xs-11 col-sm-7 col-md-3 col-lg-3">
                                 <div class="input-group">
                                     <asp:HiddenField runat="server" ID="hid_req_no" />
                                 <asp:TextBox  CssClass="form-control" ID="txt_req_no" runat="server"></asp:TextBox>
                                 <asp:RequiredFieldValidator Visible="false" SetFocusOnError="true" ValidationGroup="save" runat="server" 
                                     id="req_req_no" controltovalidate="txt_req_no" errormessage="Request # is Required!" />
                                    <span class="input-group-btn">
                                    <button id="btn_lov_req_no" type="button" runat="server" 
                                        class="btn btn-white" onserverclick="btn_lov_req_no_Click"><i class="fa fa-search"></i></button>
                                    </span>
                                    </div>
                             </div>

                            <label class="control-label  col-xs-11 col-sm-3 col-md-2 col-lg-2">Request To</label>
                             <div class="col-xs-11 col-sm-7 col-md-3 col-lg-3">
                                 <div class="input-group">
                                      <asp:HiddenField runat="server" ID="hid_req_by_user" />
                                 <asp:TextBox  CssClass="form-control" ID="txt_req_by_user" runat="server"></asp:TextBox>
                                 <asp:RequiredFieldValidator Visible="false" SetFocusOnError="true" ValidationGroup="save" runat="server" 
                                     id="req_req_by_user" controltovalidate="txt_req_by_user" errormessage="Request by User is Required!" />
                                    <span class="input-group-btn">
                                    <button id="btn_lov_req_by_user" type="button" runat="server" 
                                        class="btn btn-white" onserverclick="btn_lov_req_by_user_Click"><i class="fa fa-search"></i></button>
                                    </span>
                                    </div>
                             </div>                                                        
                        </div>

                        <div class="row" style="padding-top:05px">
                              <label class="control-label col-xs-11 col-sm-3 col-md-2 col-lg-2">Comment</label>
                            <div class="col-xs-11 col-sm-7 col-md-3 col-lg-3">
                                <asp:TextBox ID="txt_coment" runat="server" CssClass="form-control" TextMode="MultiLine"></asp:TextBox>
                            </div>

                            <label class="control-label col-xs-11 col-sm-3 col-md-2 col-lg-2">(Requestee) Reference</label>
                            <div class="col-xs-11 col-sm-7 col-md-3 col-lg-3">
                                <asp:TextBox ID="txt_req_ref" runat="server" onkeypress="return numbersOnly(event);" CssClass="form-control"></asp:TextBox>
                            </div>                            
                        </div>

                        <div class="row" style="padding-top:05px">                            
                              <label class="control-label col-xs-11 col-sm-3 col-md-2 col-lg-2">Date From</label>
                            <div class="col-xs-11 col-sm-7 col-md-3 col-lg-3">
                                <asp:TextBox ID="txt_date_frm" runat="server" CssClass="form-control datetime"></asp:TextBox>
                                <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server"
                                  id="req_date_frm" controltovalidate="txt_date_frm" errormessage="Date From is Required!" />
                            </div>  
                            
                           <label class="control-label col-xs-11 col-sm-3 col-md-2 col-lg-2">Date To</label>
                            <div class="col-xs-11 col-sm-7 col-md-3 col-lg-3">
                                <asp:TextBox ID="txt_date_to" runat="server" CssClass="form-control datetime"></asp:TextBox>
                            </div>
                        </div>

                        <div class="row" style="padding-top:05px">
                            <label class="control-label col-xs-11 col-sm-3 col-md-2 col-lg-2">Due Date</label>
                            <div class="col-xs-11 col-sm-7 col-md-3 col-lg-3">
                                <asp:TextBox ID="txt_due_date" runat="server" CssClass="form-control datetime"></asp:TextBox>
                                <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server"
                                  id="req_due_date" controltovalidate="txt_due_date" errormessage="Due Date is Required!" />
                            </div>
                        </div>

                        <hr />

                        <asp:HiddenField runat="server" ID="hidTAB" Value="0" />

                        <ul class="nav nav-tabs" id="myTabs">
                          <li class="active"><a data-toggle="tab" id="line_click" href="#Line" aria-expanded="true">Line</a></li>
                        </ul>

                        <%--<ul class="nav nav-tabs" id="myTabs">
                          <li class="inactive"><a data-toggle="tab" href="#Line" aria-expanded="true">Line</a></li>
                          <li class="inactive"><a data-toggle="tab" href="#Skill" aria-expanded="false">Skill</a></li> 
                          <li class="inactive"><a data-toggle="tab" href="#Location" aria-expanded="false">Location</a></li>                          
                        </ul>--%>

                        <!-- Tab of Line -->
                        <div class="tab-content">
                         <div id="Line" class="tab-pane fade active in">
                           <br> 
                             <div style="width: 102%; height:250px; overflow: scroll">
                                 <div class="table-responsive">
                                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                                    CssClass="table table-striped table-bordered table-hover" CellPadding="0" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound">
                                <Columns>

                                <asp:TemplateField HeaderStyle-Width="5px">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hid_line_id" runat="server" Value='<%#Bind("REQUESITION_LINE_ID")%>' />
                                        <asp:HiddenField ID="hid_position_id" runat="server" Value='<%#Bind("POSITION_ID")%>'/>
                                        <asp:HiddenField ID="hid_pos_name" runat="server" Value='<%#Bind("NAME")%>'/>
                                        <asp:HiddenField ID="hid_career_id" runat="server" Value='<%#Bind("CAREER_LEVEL_ID")%>'/>
                                        <asp:HiddenField ID="hid_job_id" runat="server" Value='<%#Bind("JOB_ID")%>'/>
                                        <asp:HiddenField ID="hid_shift_id" runat="server" Value='<%#Bind("JOB_SHIFT")%>'/>
                                        <asp:HiddenField ID="hid_qualif" runat="server" Value='<%#Bind("MIN_EDUCATION")%>'/>
                                    </ItemTemplate>
                                </asp:TemplateField>    

                                <asp:TemplateField HeaderText="Position" HeaderStyle-Width="05%" ItemStyle-Width="05%">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddl_position" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                        <asp:RequiredFieldValidator runat="server" ID="req_position" ControlToValidate="ddl_position" ErrorMessage="Position is required." setfocusonerror="true" ValidationGroup = '<%# "add3_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>
                                    </ItemTemplate>

                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Job Title" HeaderStyle-Width="05%">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddl_jobtitle" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                        <%--<asp:TextBox ID="txt_title" runat="server" Text='<%#Bind("JOB_TITLE") %>' CssClass="form-control"></asp:TextBox>--%>
                                        <asp:RequiredFieldValidator runat="server" ID="req_jobtitle" ControlToValidate="ddl_jobtitle" ErrorMessage="Job Title is required." setfocusonerror="true" ValidationGroup = '<%# "add3_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>
                                    </ItemTemplate>

                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Job Shift" HeaderStyle-Width="05%">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddl_shift" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                        <%--<asp:TextBox ID="txt_shift" runat="server" onkeypress="return numbersOnly(event);" Text='<%#Bind("JOB_SHIFT") %>' CssClass="form-control"></asp:TextBox>--%>
                                        <asp:RequiredFieldValidator runat="server" ID="req_shift" ControlToValidate="ddl_shift" ErrorMessage="Job Shift is required." setfocusonerror="true" ValidationGroup = '<%# "add3_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>
                                    </ItemTemplate>


                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="No Of Vacancy" HeaderStyle-Width="15%">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_vacancy" runat="server" onkeypress="return numbersOnly(event);" Text='<%#Bind("NO_OF_VACANCIES") %>' CssClass="form-control" ></asp:TextBox>
                                        <asp:RequiredFieldValidator runat="server" ID="req_vacancy" ControlToValidate="txt_vacancy" ErrorMessage="No Of Vacancy is required." setfocusonerror="true" ValidationGroup = '<%# "add3_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Career Level" HeaderStyle-Width="15%">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddl_careerlvl" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                        <%--<asp:TextBox ID="txt_careerlvl" runat="server" Text='<%#Bind("CAREER_LEVEL_ID") %>' CssClass="form-control"></asp:TextBox>--%>
                                        <asp:RequiredFieldValidator runat="server" ID="req_careerlvl" ControlToValidate="ddl_careerlvl" ErrorMessage="Career Level is required." setfocusonerror="true" ValidationGroup = '<%# "add3_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>
                                    </ItemTemplate>
                                </asp:TemplateField>


                                    <asp:TemplateField HeaderText="Qualification" HeaderStyle-Width="15%">
                                        <ItemTemplate>
                                            <asp:DropDownList ID="ddl_qual" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                            <asp:RequiredFieldValidator runat="server" ID="req_qual" ControlToValidate="ddl_qual" ErrorMessage="Qualification is required." setfocusonerror="true" ValidationGroup = '<%# "add3_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>
                                        </ItemTemplate>
                                    </asp:TemplateField>


                                <asp:TemplateField HeaderText="Apply Before" HeaderStyle-Width="55%">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_applybefore" runat="server" Text='<%#Bind("POSITION_DUE_DATE") %>'  CssClass="form-control datetime"></asp:TextBox>
                                        <asp:RequiredFieldValidator runat="server" ID="req_applybefore" ControlToValidate="txt_applybefore" ErrorMessage="Apply Before is required." setfocusonerror="true" ValidationGroup = '<%# "add3_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Action" HeaderStyle-Width="100px" ItemStyle-Width="150px">
                                                            <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= '<%# "add3_" + Container.DataItemIndex %>'
                                                                    runat="server" CommandName="gadd"><i
                                                                        class="fa fa-plus"
                                                                        style="font-size:20px !important;"></i>
                                                                </asp:LinkButton>
                                                                <asp:linkbutton ID="linkdlt" CausesValidation="false" Visible="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>

                                                                  <a id="asg"  href="Requisition_skills.aspx?req_id=<%# HRMS.Global.Encrypt(hid_requisition.Value.ToString())+"&req_line_id="+HRMS.Global.Encrypt(Eval("REQUESITION_LINE_ID").ToString()) +"&bg_id="+ HRMS.Global.Encrypt(ddl_busgroup.SelectedValue.ToString())+"&pos_id="+HRMS.Global.Encrypt(Eval("POSITION_ID").ToString())+"&pos_name="+ HRMS.Global.Encrypt(Eval("NAME").ToString())%>">Skills</a>


                                                                <a id="loc" href="Requisition_Location.aspx?req_id=<%# HRMS.Global.Encrypt(hid_requisition.Value.ToString())+"&req_line_id="+HRMS.Global.Encrypt(Eval("REQUESITION_LINE_ID").ToString()) +"&bg_id="+ HRMS.Global.Encrypt(ddl_busgroup.SelectedValue.ToString())+"&pos_id="+HRMS.Global.Encrypt(Eval("POSITION_ID").ToString())+"&pos_name="+ HRMS.Global.Encrypt(Eval("NAME").ToString())%>">Location</a>
                                                            </ItemTemplate>
                                    </asp:TemplateField>

                                <%--<asp:TemplateField HeaderText="Skill" ItemStyle-Width="4%">
                                                            <ItemTemplate>                                                                
                                                                 <asp:LinkButton ID="lnk_add1" data-toggle="modal" data-target="#myModal1"
                                                                    runat="server" CommandName="gaddpopup1"><i
                                                                        class="fa fa-external-link"
                                                                        style="font-size:20px !important;"></i>
                                                                </asp:LinkButton>
                                                            </ItemTemplate>
                                                            <ItemStyle Width="4%"></ItemStyle>
                                    </asp:TemplateField>--%>

                                <%--<asp:TemplateField HeaderText="Location" ItemStyle-Width="4%" ItemStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>                                                                
                                                                 <asp:LinkButton ID="lnkpopup" 
                                                                    runat="server" CommandName="gPopup" OnClick="lnkpopup_Click"><i
                                                                        class="fa fa-external-link"
                                                                        style="font-size:20px !important;"></i>
                                                                </asp:LinkButton>
                                                                <%--data-toggle="modal" data-target="#myModal2"

                                                            </ItemTemplate>
                                                            <ItemStyle Width="4%"></ItemStyle>
                                    </asp:TemplateField>--%>

                                </Columns>
                                    <%--<FooterStyle CssClass="footerStyle" />
                                    <HeaderStyle CssClass="headerStyle" />
                                    <RowStyle CssClass="rowStyle" />--%>
                            </asp:GridView> 
                                     </div>
                                 </div>
                           <hr> 
                        </div>
                       <!-- End Tab Of Line -->

                        
                        <!-- The Model Popup -->
                          <%--<div class="modal fade" id="myModal2">
                            <div class="modal-dialog modal-lg">
                              <div class="modal-content">
      
                                <!-- Modal Header -->
                                <div class="modal-header">
                                  <h4 class="modal-title">Location</h4>
                                  <%--<button type="button" class="close" data-dismiss="modal">&times;</button>
                                </div>
        
                                <!-- Modal body -->
                                <div class="modal-body" style="overflow-y: scroll;">  

                                </div>
                                <!-- Modal footer -->
                                <div class="modal-footer">
                                  <%--<button type="button" class="btn btn-info" data-dismiss="modal">Close</button>
                                  <asp:button text="Close" CssClass="btn btn-info" ID="clspopup" runat="server" onclick="clspopup_Click" />                                    
                                </div>
        
                              </div>
                            </div>
                         </div>--%>
                        <!-- Model Popup -->

                    </div>
                </section>
            </div>
        </div>
    </div>
    <script src="../../ThemeScrips/jquery.min.js"></script>
    <link href="../../ThemeScrips/select2.min.css" rel="stylesheet" />
    <script src="../../ThemeScrips/select2.min.js"></script>
    <%--<script src="/ThemeScrips/select2.min.js"></script>--%>


    <script src="Scripts/jquery-2.1.3.min.js"></script>
    <script src="Scripts/bootstrap.js"></script>

    <script>
        $('.select2').select2();
        $('.select2').select2({ dropdownAutoWidth: true });
        $('.select2').select2({ width: '100%' });

        $(document).ready(function () {

            var tabId = document.getElementById('<%= hidTAB.ClientID%>').value;
            if (tabId == "3") {
                $('#myTabs a[href="#Location"]').tab('show');
                //$('.nav-tabs a[href="#Location"]').tab('show');
            } else if (tabId == "2") {
                $('#myTabs a[href="#Skill"]').tab('show');
                //$('.nav-tabs a[href="#Skill"]').tab('show');
            } else {
                $('#myTabs a[href="#Line"]').tab('show');
            }

            //$('.nav-tabs a[href="#' + tabId + '"]').tab('show');
            //$('#myTabs a[href="' + tab + '"]').tab('show');

        });

        $("#line_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "1";
            //var x = document.getElementById('<%= hidTAB.ClientID%>').value;           
            //alert(x);
        });

        $("#skill_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "2";
            //var y = document.getElementById('<%= hidTAB.ClientID%>').value;
            //alert(y);
        });

        $("#location_click").click(function () {
            document.getElementById('<%= hidTAB.ClientID%>').value = "3";
            //var z = document.getElementById('<%= hidTAB.ClientID%>').value;
            //alert(z);
        });

        // Open & Close Modal Popup \\

        //function openModal() {
        //    $('[id*=myModal2]').modal('show');
        //}  

        //function closeModal() {
        //    $('[id*=myModal2]').modal('hide');
        //} 

        // Open & Close Modal Popup \\

        //$("#lnkpopup").click(function () {
        //    // show Modal
        //    //$('[id*=myModal2]').modal('show');
        //});

    </script>

</asp:Content>
