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

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="Server">

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

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

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

    <script language="javascript" src="../js/EmployeeNameAjax.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#ctl00_BodyContentPH_txt_DeductionstartMonth').datetimepicker({ format: 'MMM-YYYY' });
        });
    </script>

   
    <script type="text/javascript">

        var EntertheEmployeeID = "Enter the Employee ID";
        var EntertheLoanAmount = "Enter the Loan Amount";
        var EntertheDueMonth = "Enter the Loan Duration Month";
        var EnterthestartMonth = "please Select the Deduction Start Month";
        var EmployeeNotfound = "Employee not found";
        var EmployeeInvalid = "Invalid Employee ID";

        function ValidationLoan() {
            debugger;
            var loanMonthPayoff = (document.aspnetForm.ctl00_BodyContentPH_txt_Payoff.value);
            document.getElementById('ctl00_BodyContentPH_hdnMonthPayoff').value = loanMonthPayoff;
            var EmpID = document.getElementById('ctl00_BodyContentPH_hdnEmployeeId').value;
            var EmployeeID = document.aspnetForm.ctl00_BodyContentPH_txt_EmployeeId.value;
            var EmployeeName = document.getElementById('ctl00_BodyContentPH_txt_Name').value;
            var LoanAmount = document.aspnetForm.ctl00_BodyContentPH_txt_LoanAmount.value;
            var DuestartMonth = document.aspnetForm.ctl00_BodyContentPH_txt_DeductionstartMonth.value;
            var DurationMonth = document.aspnetForm.ctl00_BodyContentPH_txt_LoanDurationMonth.value;
            // var Description=document.aspnetFrom.ctl00_BodyContentPH_txt_loanDescription.value;
            var ConfirmSave = "Are you sure to, Save?";
            if (EmployeeID == "") {
                alert(EntertheEmployeeID);
                return false;
            }
            if (EmployeeName == "Invalid Employee ID")
            {
                alert(EmployeeInvalid);
                return false;
            }
            if (LoanAmount == "") {
                alert(EntertheLoanAmount);
                return false;
            }
            if (DurationMonth == "") {
                alert(EntertheDueMonth);
                return false;
            }
            if (DuestartMonth == "") {
                alert(EnterthestartMonth);
                return false;
            }
            if (DurationMonth == 0) {
                alert("Invalid Loan duration month");
                return false;

            }
           
            if (LoanAmount == 0) {
                alert("Invalid Loan Amount");
                return false;
            }
            
            if (confirm(ConfirmSave) == true) {
                return true;
            }
            else {
                return false;
            }
        }
        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 > 31 && (charCode < 48 || charCode > 57)) {
                return false;
            }

            else {
                if (e.srcElement.value.length == 0 && e.which == 48) {
                    e.preventDefault();
                    return false;
                }
                else {

                    return true;
                }

            }
        }
    </script>

     <script type="text/javascript">
        
    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/Att-code.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_Header" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <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"
                                    Font-Bold="true" Font-Size="12px" Font-Italic="true" Font-Family="Arial" Text="Please Wait..."></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 id="myModal" class="modal modal-default fade" role="dialog">
            <div class="modal-dialog" style="min-width: 85%;">
                <!-- Modal content-->
                <div class="modal-content" style="margin-top: 50px">
                    <div class="modal-header">
                        <button type="button" id="closemodal" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title">
                            <asp:Label ID="lblSelectEmployee" runat="server" Text="Select Employee"></asp:Label></h4>
                    </div>
                    <div class="modal-body">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="700px"
                            style="border-style: none"></iframe>
                    </div>
                    <div class="modal-footer" style="display: none">
                        <button type="button" class="btn btn-primary pull-right" data-dismiss="modal">
                            Close</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-12">
                    <div class="inr-fil-text pull-left">
                        <asp:Label ID="lblFilter" runat="server" Text="Filter"></asp:Label>
                    </div>
                    <div class="pull-right">
                        <h6>
                            <span style="color: Red">|</span><span style="padding-left: 10px; padding-right: 10px"><asp:Label
                                ID="lbl_IndicatesMandatoryFields" runat="server"></asp:Label>
                                (4 No.)</span>
                        </h6>
                    </div>
                    <div class="clearfix">
                    </div>
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="col-md-12" style="color: Red; display: none">
                <asp:Label ID="lbl_Error" runat="server" ForeColor="Red"></asp:Label>
            </div>
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        <div class="row" style="display: none">
                            <div class="col-md-12">
                                <asp:Label ID="lbl_TypeOfManualEntry" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-12">
                                <asp:RadioButton ID="rbtSingle" runat="server" GroupName="EntryType" onclick="showGroupEntry();"
                                    TabIndex="1" />
                                <asp:RadioButton ID="rbtGroup" runat="server" GroupName="EntryType" onclick="showGroupEntry();"
                                    Style="display: none" />
                            </div>
                        </div>

                        <div class="row form-group">
                            <div id="div_Employee">
                                <div class="col-md-2">
                                    <asp:Label ID="lbl_EmployeeId" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <div class="input-group input-group-sm">
                                        <asp:TextBox onpaste="return true" ID="txt_EmployeeId" runat="server" CssClass="form-control man-dat"
                                            MaxLength="15" onblur="MasterEmpName('LoanEntry');" onkeypress="return acceptCharsNum_MaxLength(event,this,15,MaxLength);"></asp:TextBox>
                                        <span class="input-group-btn">
                                            <asp:LinkButton ID="btn_Search" data-toggle="modal" data-target="#myModal" CssClass="btn save-btn btn-flat fa fa-search"
                                                runat="server" OnClientClick="return openWindowMasterPage('txt_EmployeeId','ManualTimeEntry');" />
                                        </span>
                                        

                                    </div>
                                </div>
                                <asp:HiddenField ID="hdnEmployeeId" runat="server" />
                                <asp:HiddenField ID="hdnEmployeeDOJ" runat="server" />
                            </div>

                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EmployeeName" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" CssClass="form-control" ID="txt_Name" runat="server"
                                    ReadOnly="True"></asp:TextBox>
                            </div>
                        </div>

                        <div class="row form-group">

                            <div class="col-md-2">
                                <asp:Label ID="lbl_LoanAmount" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_LoanAmount" runat="server" MaxLength="8" placeholder="&#8377; INR"
                                    CssClass="form-control man-dat" onCut="return false" onDrop="return false" onblur="LoanCalcutaion('LoanEntry');" onkeypress="return onlyNumbersValue(event)"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_LoanDurantion" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_LoanDurationMonth" runat="server" MaxLength="2"
                                    CssClass="form-control man-dat" onCut="return false" onblur="LoanCalcutaion('LoanEntry');" onDrop="return false" onkeypress="return onlyNumbersValue(event)"></asp:TextBox>

                            </div>
                        </div>
                        <div class="row">


                            <div class="col-md-2">
                                <asp:Label ID="lbl_LoanDeductStartingMonth" runat="server">Deduction Starting Month</asp:Label>
                            </div>
                            <div class="col-md-3">

                                <asp:TextBox onpaste="return true" ID="txt_DeductionstartMonth" runat="server"
                                    CssClass="form-control man-dat" onCut="return false" onDrop="return false" MaxLength="11"></asp:TextBox>
                                <asp:CustomValidator ID="CustomValidator1" runat="server" EnableClientScript="False"
                                    OnServerValidate="CheckInDate" SetFocusOnError="True" ControlToValidate="txt_DeductionstartMonth"
                                    Display="None"></asp:CustomValidator>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_LoanPayoff" runat="server"></asp:Label>
                            </div>
                            <asp:UpdatePanel runat="server" ID="UPDate">
                                <ContentTemplate>
                                    <div class="col-md-3">
                                        <asp:TextBox onpaste="return true" CssClass="form-control" ID="txt_Payoff" runat="server"
                                            Enabled="false"></asp:TextBox>
                                        <input id="hdnMonthPayoff" runat="server" type="hidden" />

                                    </div>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
                        <div class="row form-group">
                        </div>
                        <div class="row">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_LoanDescription" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_loanDescription" runat="server" CssClass="form-control"
                                    Style="resize: none; margin-left: 0px;" 
                                    MaxLength="250" onCut="return false" onDrop="return false" onkeypress="return chkMaxLen(event,this,250,MaxLength);"
                                    TextMode="MultiLine"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                        </div>
                    </div>
                    <div class="clearfix">
                    </div>
                    <div class="col-md-12">
                    </div>
                    <div class="col-md-5">
                    </div>
                    <div class="col-md-6">
                        <div class="pull-right-button">
                            <asp:LinkButton ID="btn_Add" CssClass="btn save-btn fa-floppy-o" runat="server" CausesValidation="true"
                                OnClick="btn_Add_Click"  OnClientClick="javascript:if(ValidationLoan()) $find('popupProgress').show();else return false;" />
                            <asp:LinkButton ID="btn_Cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                CausesValidation="False" OnClick="btn_Cancel_Click" />
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                ShowSummary="False" />
                            <asp:Label ID="lblname" runat="server">
                            </asp:Label>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</asp:Content>

