<%@ page title="" language="C#" masterpagefile="~/MasterFile/TimeCheck.master" autoeventwireup="true" inherits="Masters_TA_UI_Master_ConveyanceAllowanceEdit, App_Web_tobzptic" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dxe" %>
<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" Runat="Server">
     <script language="javascript" type="text/javascript">

        function onlyNumbersValue(e) {
            var charCode;
            if (e.keyCode > 0) {
                charCode = e.which || e.keyCode;
            }
            else if (typeof (e.charCode) != "undefined") {
                charCode = e.which || e.keyCode;
            }
            if (charCode == 46)
                return true
            if (charCode > 31 && (charCode < 48 || charCode > 57))
                return false;
            return true;
        }

        function validateamount()
        {
            debugger;
           
            var FixedAmount = document.aspnetForm.ctl00_BodyContentPH_txt_MaximumAmount.value;
            document.getElementById("ctl00_BodyContentPH_txt_ConAmount").value = Math.round((FixedAmount) / 12);
            var textAmount = document.getElementById("ctl00_BodyContentPH_txt_ConAmount").value;
            document.getElementById("ctl00_BodyContentPH_hdnTxtconAmount").value = textAmount;

        }
        var EnterPolicyName = "Enter Conveyance Allowance Name";
        var SelectCompany = "Select Company";
        var FixedAmountmsg = "Enter Maximum Fixed Amount";
        var msgPercentage = "Enter Conveyance Allowance Percentage";
        var msgAmount = "Enter Conveyance Allowance Amount";
        function ValidateAll() {
            debugger;
            var index = document.aspnetForm.ctl00_BodyContentPH_ddlCompany.selectedIndex;
            var company = document.aspnetForm.ctl00_BodyContentPH_ddlCompany.options[index].value;
            var FixedAmount = document.aspnetForm.ctl00_BodyContentPH_txt_MaximumAmount.value;
            var rbtn_Percentage = document.getElementById("ctl00_BodyContentPH_rbtn_Percentage");
            //var textPercent = document.getElementById("ctl00_BodyContentPH_txt_ConPercentage").value;
            //var textAmount = document.getElementById("ctl00_BodyContentPH_txt_ConAmount").value;
            if (company == "0") {
                alert(SelectCompany);
                document.aspnetForm.ctl00_BodyContentPH_ddlCompany.focus();
                return false;
            }
            if ((/^(\s*)$/.test(document.aspnetForm.ctl00_BodyContentPH_txt_PolicyName.value))) {
                alert(EnterPolicyName);
                document.getElementById("ctl00_BodyContentPH_txt_PolicyName").focus();
                return false;
            }
            if (FixedAmount == "" || (/^(\s*)$/.test(FixedAmount))) {
                alert(FixedAmountmsg);
                document.getElementById("ctl00_BodyContentPH_txt_MaximumAmount").focus();
                return false;
            }
            if (parseInt(FixedAmount) == 0) {
                alert("Enter Valid Maximum Fixed Amount ");
                document.getElementById("ctl00_BodyContentPH_txt_MaximumAmount").focus();
                return false;
            }
            //if (rbtn_Percentage.checked) {
            //    if (textPercent == "" || (/^(\s*)$/.test(textPercent))) {
            //        alert(msgPercentage);
            //        document.getElementById("ctl00_BodyContentPH_txt_ConPercentage").focus();
            //        return false;
            //    }
            //}
            //else {
            //    if (textAmount == "" || (/^(\s*)$/.test(textAmount))) {
            //        alert(msgAmount);
            //        document.getElementById("ctl00_BodyContentPH_txt_ConAmount").focus();
            //        return false;
            //    }

            //}
            return true;
        }

        function EnableDisableTextBox() {
            debugger;
            var rbtn_Percentage = document.getElementById("ctl00_BodyContentPH_rbtn_Percentage");
            var textPercent = document.getElementById("ctl00_BodyContentPH_txt_ConPercentage");
            var textAmount = document.getElementById("ctl00_BodyContentPH_txt_ConAmount");
            if (rbtn_Percentage.checked) {
                textPercent.value = '';
                textPercent.style.display = "";
                textAmount.style.display = "none";

            } else {
                textPercent.style.display="none"
                textAmount.style.display = "";
            }
            
        }

    </script>

    <script src="../js/maxLength.js" type="text/javascript"></script>

    <script src="../plugins/daterangepicker/moment.js" type="text/javascript"></script>

    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>

    <script language="javascript" src="../js/jquery.autocomplete.js" type="text/javascript"></script>

    <script src="../plugins/datepicker/bootstrap-datepicker.js"></script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/leave-policy.png'); background-repeat: no-repeat; padding-left: 35px">
            <%--<span>
                <img src="../dist/img/policy-icon.png" style="padding-right: 10px;"></span>--%>
            <asp:Label ID="lbl_HeaderConveyance" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div>
            <!--FILTERS-->
            <div class="exda-table">
                <h6>
                    <span style="color: Red">|</span>
                    <asp:Label ID="lbl_IndicatesMandatoryFields" runat="server"></asp:Label>
                    (3
                    No.)</h6>
            </div>
            <div class="emp-filter">

                <div class="row">
                    <div class="form-horizontal">
                        <div class="row form-group">
                            <div class="col-md-12">
                                <div class="col-md-2">
                                    <asp:Label ID="lblCompany" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddlCompany" runat="server" AppendDataBoundItems="true" CssClass="form-control select2 Man-dat">
                                        <asp:ListItem Value="0" Text="-Select-"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-1">
                                </div>
                                <div class="col-md-2">
                                    <asp:Label ID="lbl_PolicyName" runat="server" class="control-label"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:TextBox onpaste="return true" ID="txt_PolicyName" runat="server" CssClass="form-control mandatory"
                                        MaxLength="40" oncut="return false" onDelete="return false" ondrop="return false"
                                        onkeyPress="return chkMaxLen(event,this,40,MaxLength)"></asp:TextBox>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-12">
                                <div class="col-md-2">
                                    <asp:Label ID="lblEmpCategory" runat="server" class="control-label"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddlEmpCatagory" runat="server" CssClass="form-control select2"
                                        AppendDataBoundItems="true" OnDataBound="ddlEmpCatagory_DataBound">
                                        <asp:ListItem Value="0" Selected="True" Text="All"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-1">
                                </div>
                                <div class="col-md-2">
                                    <asp:Label ID="lblEmpType" runat="server" class="control-label"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddlEmpType" runat="server" CssClass="form-control select2"
                                        AppendDataBoundItems="true" OnDataBound="ddlEmpType_DataBound">
                                        <asp:ListItem Value="0" Selected="True" Text="All"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-12">
                                <div class="col-md-2">
                                    <asp:Label ID="lblGender" runat="server" class="control-label"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddlGender" runat="server" CssClass="form-control select2">
                                        <asp:ListItem Value="0" Text="Both"></asp:ListItem>
                                        <asp:ListItem Value="1" Text="Male"></asp:ListItem>
                                        <asp:ListItem Value="2" Text="Female"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-1">
                                </div>

                            </div>
                        </div>
                        <!--TABLE-->
                        <!--3-->
                      <%--  <div style="margin-top: 15px">
                            <div class="row">
                                <div class="lve-polhdr1">
                                    <h3>
                                      
                                        <asp:Label ID="chkPF_ESIPolicy" 
                                            runat="server" Text="Range From"></asp:Label>

                                    </h3>
                                </div>
                            </div>--%>
                      <div class="row">
                          <div class="line16" style="margin: 4px 8px 20px 8px">                 
                          </div>      
                      </div>
                      <div class="row  form-group">
                          <div class="col-md-12">
                               <div class="col-md-3">
                                   <asp:Label ID="Label4" CssClass=" control-label con-top"
                                     runat="server" Text="Maximun Fixed Amount"></asp:Label>      
                                </div>
                                 <div class="col-md-3">
                                      <asp:TextBox onpaste="return true" ID="txt_MaximumAmount" runat="server" CssClass="form-control mandatory "
                                                    MaxLength="5" oncut="return false" onDelete="return false" ondrop="return false" placeholder="%"
                                                    onkeyPress="return onlyNumbersValue(event)" onblur="return validateamount()" ></asp:TextBox>          
                                  </div>      
                                        <%--<div class="form-group" style="margin-top: 10px;">
                                            
                                            <div class="col-md-1">
                                            </div>
                                            <div class="col-md-3">
                                                <asp:TextBox onpaste="return true" ID="txt_MaximumAmount" runat="server" CssClass="form-control mandatory "
                                                    MaxLength="5" oncut="return false" onDelete="return false" ondrop="return false" placeholder="%"
                                                    onkeyPress="return onlyNumbersValue(event)"></asp:TextBox>
                                            </div>
                                          
                                        </div>--%>
                                    </div>
                          </div>
                        <div class="row form-group">
                            <div class="col-md-12">
                                <div class="col-md-3">
                                    <asp:Label ID="Label2" CssClass="control-label con-top"
                                                    runat="server" Text="Conveyance Allowance "></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:TextBox onpaste="return true" ID="txt_ConAmount" runat="server" CssClass="form-control "  Enabled="false"
                                                 MaxLength="5" oncut="return false" onDelete="return false" ondrop="return false" placeholder=" INR"
                                                 onkeyPress="return onlyNumbersValue(event);"></asp:TextBox>

                                    <asp:HiddenField ID="hdnTxtconAmount"  runat="server"/>

                                </div>

                            </div>
                        </div>
                                    <%--<div class="col-md-12">
                                        <div class="form-group" style="margin-top: 10px;">
                                            <div class="col-md-3">
                                                <asp:Label ID="Label5" CssClass="control-label con-top"
                                                    runat="server" Text="Conveyance Type"></asp:Label>
                                            </div>
                                            <div class="col-md-1">
                                            </div>
                                            <div class="col-md-3">
                                                <div class="row">
                                                    <div class="col-md-6">
                                                        <asp:RadioButton ID="rbtn_Amount" runat="server" Checked="True" GroupName="Gender"
                                                            Text="Amount" CssClass="radio radio-primary" onClick="EnableDisableTextBox()" />
                                                    </div>
                                                    <div class="col-md-6">
                                                        <asp:RadioButton ID="rbtn_Percentage" runat="server" GroupName="Gender" Text="Percentage"
                                                            CssClass="radio radio-primary"  onClick="EnableDisableTextBox()"/>
                                                    </div>
                                                </div>
                                            </div>
          
                                        </div>
                                    </div>--%>

                                   <%-- <div class="col-md-12">
                                        <div class="form-group" style="margin-top: 10px;">
                                            <div class="col-md-3">
                                                <asp:Label ID="Label1" CssClass="control-label con-top"
                                                    runat="server" Text="Conveyance Allowance "></asp:Label>
                                            </div>
                                            <div class="col-md-1">
                                            </div>
                                            <div class="col-md-3">
                                                <asp:TextBox onpaste="return true" ID="txt_ConAmount" runat="server" CssClass="form-control "
                                                    MaxLength="5" oncut="return false" onDelete="return false" ondrop="return false" placeholder=" INR"
                                                    onkeyPress="return onlyNumbersValue(event);"></asp:TextBox>
                                                 <asp:TextBox onpaste="return true" ID="txt_ConPercentage" runat="server" CssClass="form-control "
                                                    MaxLength="5" oncut="return false" onDelete="return false" ondrop="return false" placeholder="%"
                                                    onkeyPress="return onlyNumbersValue(event);" Style="display:none"></asp:TextBox>
                                            </div>
                                            <div class="col-sm-1">
                                            </div>
                                        </div>
                                    </div>--%>
                              

                                <%--<div class="lve-polhdr4" runat="server" id="dynamic" style="background: none; border-bottom: none;">
                                   <%-- <div class="col-md-12">
                                     
                                    </div>
                                  
                                <div class="clearfix">
                                </div>
                            </div>--%>
                        </div>
                        <div class="col-md-6">
                            <asp:UpdatePanel ID="upLeave" runat="server">
                                <ContentTemplate>
                                    <asp:Panel ID="pnlProgress" runat="server" Style="display: none;">
                                        <asp:Panel ID="pnlLoading" runat="server" HorizontalAlign="center">
                                            <div class="InsideProgressBar">
                                                <div class="row" style="margin-top: 10px">
                                                    <img src="../dist/img/logo-Progress.png" />
                                                </div>
                                                <div class="row" style="min-width: 280px">
                                                    <img src="../dist/img/default.gif" style="width: 100px" />
                                                </div>
                                                <div class="row" style="margin-bottom: 10px">
                                                    <asp:Label ID="lblLoading" runat="server" ForeColor="black" Style="text-align: center"
                                                        Text="Please Wait..." Font-Bold="true" Font-Size="12px" Font-Italic="true" Font-Family="Arial"></asp:Label>
                                                </div>
                                                <div class="clear clearfix">
                                                </div>
                                            </div>
                                        </asp:Panel>
                                    </asp:Panel>
                                    <asp:HiddenField ID="hdnProgress" runat="server" />
                                    <cc1:ModalPopupExtender ID="popupProgress" runat="server" TargetControlID="hdnProgress"
                                        BackgroundCssClass="ModalPopup" PopupControlID="pnlProgress" BehaviorID="popupProgress">
                                    </cc1:ModalPopupExtender>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
                        <div class="col-md-6"
                            align="left">
                            <div class="filter-button">
                                <asp:LinkButton ID="btn_save" CssClass="btn save-btn fa-floppy-o" runat="server"
                                    OnClick="btn_save_Click" OnClientClick="javascript:return ValidateAll();" />
                                <asp:LinkButton ID="btn_cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                    CausesValidation="false" OnClick="btn_cancel_Click" />
                                <%-- Change the value to 1, it will throw the alert message --%>
                                <asp:HiddenField ID="hdfValidation" Value="0" runat="server" />
                                <asp:HiddenField ID="hdnLeaveCount" runat="server" />
                                <asp:HiddenField ID="hdfOTHourType" runat="server" Value="0" />
                                <asp:HiddenField ID="hdfOTDayType" runat="server" Value="0" />
                                <asp:HiddenField ID="hdfFilter" runat="server" Value="0" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
    </div>

</asp:Content>

