<%@ page autoeventwireup="true" enableeventvalidation="false" inherits="Transactions_TA_UI_Transaction_Enchasement, App_Web_jfcqs0e1" language="C#" masterpagefile="~/MasterFile/TimeCheck.master" %>

<%--<%@ Register Src="../UserControls/TA_uc_OrgLevel_Filter.ascx" TagName="TA_uc_OrgLevel_Filter"
    TagPrefix="uc1" %>--%>
<%@ Register Src="../UserControls/TA_uc_OrgLevelFilter_Updated.ascx" TagName="TA_uc_OrgLevel_Filter"
    TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="ConEncashmentAdd" ContentPlaceHolderID="BodyContentPH" runat="Server">
    <!--[if gt IE 5.5]>
	<link rel="stylesheet" type="text/css" href="../css/ProgressforIE.css" />
 <![endif]-->

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

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

        var SelLeaveType = "Select Leave Type";
        var RemainingDays = "RemainingNoOfdays Should Not Be Empty / Zero";
        var NoofDaysApply = "Number Of Days Applied Should Not be Empty";
        var ReasonNotEmpty = "Reason Should Not be Empty";
        var NoofDaysShouldNot = "Number Of Days Applied Should be greater than Remaining number of Days";
        var Confirm = "Are you sure to, Save?";
        var Fraction = "Number Of Days Applied Should be fraction of 5";
        var MaxLength = "Maximum length is ";
        var NoRecords = "No Records";
        var Errorinretrivingdetails = "Error in retriving details";
        var SelectEmployee = "Select Employee";
        var Select = "-Select-";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetAlertMessages(selLeaveType, remainingDays, NoofDaysapply, reasonNotEmpty, noofDaysShouldNot, confirm, fraction, noRecords, errorinretrivingdetails, selectEmployee, select) {
            SelLeaveType = selLeaveType;
            RemainingDays = remainingDays;
            NoofDaysApply = NoofDaysapply;
            ReasonNotEmpty = reasonNotEmpty;
            NoofDaysShouldNot = noofDaysShouldNot;
            Confirm = confirm;
            Fraction = fraction;
            NoRecords = noRecords;
            Errorinretrivingdetails = errorinretrivingdetails;
            SelectEmployee = selectEmployee;
            Select = select;
        }
        function encashmentValidation() {
            if (document.getElementById('ctl00_BodyContentPH_ddl_Leavetype').value == "-Select-") {
                alert(SelLeaveType);
                return false;
            }
            else if (document.getElementById('ctl00_BodyContentPH_txt_RemainingNoOfDays').value == "" || document.getElementById('ctl00_BodyContentPH_txt_RemainingNoOfDays').value == "0.00") {
                alert(RemainingDays);
                return false;
            }
            else if (document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value == "") {
                alert(NoofDaysApply);
                return false;
            }
            else if (document.getElementById('ctl00_BodyContentPH_txtReason').value == "") {
                alert(ReasonNotEmpty);
                return false;
            }
            else {
                if (document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value != "") {
                    var vNoOfDays = document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value % 0.5;
                    if (vNoOfDays == 0) {
                        if (parseFloat(document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value) > parseFloat(document.getElementById('ctl00_BodyContentPH_txt_RemainingNoOfDays').value)) {
                            alert(NoofDaysShouldNot);
                            return false;
                        }
                        else {
                            return confirm(Confirm);
                        }
                    }
                    else {
                        alert(Fraction);
                        return false;
                    }
                }
            }
        }

    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/encashment.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"
                                    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>
                <%--OnClientClick="if(Page_ClientValidate()) return encashmentValidation();return false;"--%>
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="btn_Save" />
            </Triggers>
        </asp:UpdatePanel>
        <div class="row" style="color: Red; display: none">
            <div class="col-md-12">
                <span class="fa fa-asterisk"></span>
                <asp:Label ID="lbl_IndicatesMandatoryFields" runat="server"></asp:Label></font><br />
            </div>
            <div class="row">
                <div class="col-sm-2">
                </div>
                <div class="col-sm-2 col-sm-offset-8">
                    <div class="pull-right">
                        <h6>
                            <span style="color: Red">|</span><span style="padding-left: 10px; padding-right: 10px">Mandatory
                                (6 No.)</span>
                        </h6>
                        <asp:Label ID="lbl_Error" runat="server" Style="color: #ff0000"></asp:Label>&nbsp;
                        <input id="Hidden1" type="hidden" value='<% Response.Write(Convert.ToString(Session["IDateFormat"])); %>' />
                    </div>
                </div>
                <div class="clearfix">
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        <div id="divAdmin" runat="server" class="pull-left-button">
                            <div class="row">
                                <div class="col-md-12">
                                    <asp:PlaceHolder ID="PlaceHolder1" runat="server">
                                        <uc1:TA_uc_OrgLevel_Filter ID="TA_uc_OrgLevel_Filter1" runat="server" />
                                    </asp:PlaceHolder>
                                </div>
                            </div>
                            <div class="clearfix">
                            </div>
                            <div class="row">
                                <div class="row">
                                    <div class="line16">
                                    </div>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-2">
                                    <asp:Label ID="lbl_EmployeeNames" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddlEmployeeNames" runat="server" CssClass="form-control select2"
                                        DataTextField="-Select-" onchange="return leaveOptionsEncashment(this.value,SelectEmployee,NoRecords,Errorinretrivingdetails,Select);">
                                        <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-2 src-margintop src-padleft">
                                    <asp:LinkButton ID="btnSearch" runat="server" CssClass="btn src-btn fa-search" OnClientClick="return EmployeeNamesForEncashment(NoRecords,Errorinretrivingdetails,Select);" />
                                </div>
                            </div>
                        </div>
                        <div id="divEmployees" runat="server">
                            <div class="row form-group">
                                <div class="col-md-2">
                                    <asp:Label ID="lbl_Code" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:Label ID="lbl_EmpCode" runat="server" Width="141px"></asp:Label>
                                </div>
                                <div class="col-md-1">
                                </div>
                                <div class="col-md-2">
                                    <asp:Label ID="lbl_Name" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:Label ID="lbl_EmpName" runat="server" Width="90%"></asp:Label>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_LeaveType" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_Leavetype" runat="server" CssClass="form-control select2 Man-dat"
                                    onchange="return RemainingNoOfEncashmentLeaves(this.value,Errorinretrivingdetails);">
                                    <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Nodays" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_RemainingNoOfDays" runat="server" CssClass="form-control"
                                    ReadOnly="true" onCut="return false" onDrop="return false" onkeydown="return key_press_nokey(event)"
                                    onkeypress="return key_press_nokey(event)"></asp:TextBox>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Numberofdaysapp" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_Numberofdays" runat="server" CssClass="form-control man-dat"
                                    onDrop="return false;" onkeypress="return number_dot(event,this);" MaxLength="5"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txt_Numberofdays"
                                    SetFocusOnError="True" ErrorMessage="Enter Number of Days applied" Display="none">*</asp:RequiredFieldValidator>
                                <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txt_Numberofdays"
                                    ErrorMessage="Number of Days should between 1 and 365" MaximumValue="365" MinimumValue="0.5"
                                    SetFocusOnError="True" Type="Double">*</asp:RangeValidator>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Reason" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox Style="resize: none;" onpaste="return true" ID="txtReason" runat="server"
                                    onkeypress="return chkMaxLen(event,this,50,MaxLength)" CssClass="form-control man-dat"
                                    MaxLength="50" TextMode="MultiLine"></asp:TextBox>
                                <input id="hdnEmployeeId" runat="server" type="hidden" />
                                <input id="hdnRemainingNoOfDays" runat="server" type="hidden" />
                                <input id="hdnLeaveTypeId" runat="server" type="hidden" />
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-5">
                                <div class="pull-right-button">

                                    <asp:LinkButton ID="btn_Save" runat="server" CssClass="btn save-btn fa-floppy-o"
                                        OnClick="btn_Save_Click" OnClientClick="if(encashmentValidation()) $find('popupProgress').show();else return false;" />
                                    <asp:LinkButton ID="btn_Back" runat="server" CausesValidation="False" CssClass="btn save-btn fa-angle-left"
                                        OnClick="btn_Back_Click" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                    ShowSummary="False" />
            </div>
        </div>
    </div>
</asp:Content>
