<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="DistSet.aspx.cs" Inherits="HRMS.DistSet" %>
<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">
                         Distribution Set
                          <div class="pull-right">
                            <asp:button text="Save" CssClass="btn btn-info" ID="btn_save"   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">
                            <asp:HiddenField ID="hid_dist_set" runat="server" />
                            <label class="col-md-2 control-label">Operating Unit</label>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_legal_entity" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                <asp:RequiredFieldValidator runat="server" ID="Reqadd" ControlToValidate="ddl_legal_entity" ErrorMessage="Operating Unit is required." setfocusonerror="true" ValidationGroup="save"></asp:RequiredFieldValidator>
                            </div>

                             <label class="col-md-2 control-label">Name</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_name" runat="server" CssClass="form-control"></asp:TextBox>
                                <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ControlToValidate="txt_name" ErrorMessage="Name is required." setfocusonerror="true" ValidationGroup="save"></asp:RequiredFieldValidator>
                            </div>
                        </div>


                        <div class="row" style="padding-top:05px">
                            <label class="control-label col-md-2">Description</label>
                            <div class="col-md-8">
                                <asp:TextBox ID="txt_desc" runat="server" CssClass="form-control"></asp:TextBox>
                                <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ControlToValidate="txt_desc" ErrorMessage="Description is required." setfocusonerror="true" ValidationGroup="save"></asp:RequiredFieldValidator>
                            </div>
                        </div>

                         <div class="row" style="padding-top:05px">
                            <label class="control-label col-md-2">Type</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_type" runat="server" CssClass="form-control"></asp:TextBox>
                            </div>

                              <label class="control-label col-md-2">Inactive Date</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_date" runat="server" CssClass="form-control datetime"></asp:TextBox>
                            </div>
                        </div>

                        <hr />

                           <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_line" runat="server" Value='<%#Bind("DISTRIBUTION_SET_LINE_NUMBER")%>' />
                                    </ItemTemplate>
                                </asp:TemplateField>    

                                  <asp:TemplateField HeaderText="%"  ControlStyle-Width="100px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_per" runat="server" Text='<%# Bind("PERCENT_DISTRIBUTION") %>' CssClass="form-control"></asp:TextBox>
                                        <asp:RequiredFieldValidator runat="server" ID="rq2" ControlToValidate="txt_per" ErrorMessage="Persentage is required." setfocusonerror="true" ValidationGroup = '<%# "add_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                     <asp:TemplateField HeaderText="Project Related"  ControlStyle-Width="100px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chk_pro_rltd" style="text-align:center" runat="server" CssClass="checkbox" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                     <asp:TemplateField HeaderText="Account"  ControlStyle-Width="250px" ItemStyle-Width="150px">
                                    <ItemTemplate>
                                         <div class="input-group">
                                                        <asp:HiddenField ID="hid_acc" Value='<%#Bind("DIST_CODE_COMBINATION_ID") %>' runat="server" />
                                                            <asp:TextBox ID="txt_acc" runat="server" Text='<%# Bind("acc_desc") %>' CssClass="form-control"></asp:TextBox>
                                             <asp:RequiredFieldValidator runat="server" ID="rq4" ControlToValidate="txt_acc" ErrorMessage="Account is required." setfocusonerror="true" ValidationGroup = '<%# "add_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>
                                                                <span class="input-group-btn">
                                                                    <asp:HiddenField ID="hf_row" Value='<%# Container.DataItemIndex %>' runat="server" />
                                                                    <button id="btn_cc" type="button" onclick="PopupBulkQuestion('<%#row_id.ClientID  %>','<%# ((GridViewRow)Container).FindControl("hf_row").ClientID %>')"class="btn btn-white">
                                                                        <i class="fa fa-plus"></i>
                                                                    </button>
                                                                     <button id="btn_lov" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_ServerClick"><i class="fa fa-search"></i></button>
                                                                </span>
                                             
                                                    </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                     <asp:TemplateField HeaderText="Description"  ControlStyle-Width="350px" ItemStyle-Width="200px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_desc" runat="server" Text='<%# Bind("DESCRIPTION") %>' CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                       <asp:TemplateField Visible="false" HeaderText="Income Tax type"  ControlStyle-Width="50px" ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_tax_type" runat="server" CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                    <asp:TemplateField HeaderText="Action" ItemStyle-Width="6%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkadd"  runat="server" CommandName="gadd" ValidationGroup = '<%# "add_" + Container.DataItemIndex %>'><i class="fa fa-plus" style="font-size:20px !important;"></i></asp:LinkButton>&nbsp;
                                            <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>

                      <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:HiddenField ID="row_id" runat="server" />
                                        <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>


                </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>
        $('.select2').select2();
    </script>
     <script type="text/javascript">

         function PopupBulkQuestion(clientid, clid2) {

             $('#' + '' + clientid).val($('#' + '' + clid2).val());
             $('#CostVal').modal();
         }
                         </script>
</asp:Content>
