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

<%--<%@ 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">

    <script language="javascript" src="../js/EmployeeNameAjax.js" type="text/javascript"></script>
      <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>
    <script>
        $(function () {
            debugger
            $('#ctl00_BodyContentPH_TextBox9').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value });
            $('#ctl00_BodyContentPH_TextBox1').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value });
           
            var Company = document.getElementById('ddlLevel0').value;

            $('#ctl00_BodyContentPH_hdnComany').val({ selectedText: document.getElementById('ddlLevel0').selectedText });

        });


        function Save_Conf() {
            //Alert_AreyousuretoDelete
            return confirm(AreyousuretoSave);
        }


        function ValidateApprovalSettings()
        {
            debugger;
            var Company = document.getElementById("ddlLevel0").value;
            var Branch = document.getElementById('ddlLevel1').value;
            var departmnet = document.getElementById('ddlLevel2').value;

            document.getElementById('ctl00_BodyContentPH_hdnBranch').value = Branch;
            document.getElementById('ctl00_BodyContentPH_hdndepart').value = departmnet;
            var SelectCompany = document.getElementById('ddlLevel0');
            var CompanyName = SelectCompany.options[SelectCompany.selectedIndex].text;
            var selectBranch = document.getElementById('ddlLevel1');
            var BranName = selectBranch.options[selectBranch.selectedIndex].text;
           // var BranName = document.getElementById('ddlLevel1').selectedText;
            var selectDepart = document.getElementById('ddlLevel2');
            var DepatName = selectDepart.options[selectDepart.selectedIndex].text;
            document.getElementById('ctl00_BodyContentPH_HdnComapnyName').value = CompanyName;
            document.getElementById('ctl00_BodyContentPH_HdnBranName').value = BranName;
            document.getElementById('ctl00_BodyContentPH_HdnDepartName').value = DepatName;

            var Confirm = window.confirm(AreyousuretoSave);
            debugger;
            if (Confirm)
            {
                debugger;
                var Check = document.getElementById('ctl00_BodyContentPH_HdnGetCompanyName').value;
                var Des = document.getElementById('ctl00_BodyContentPH_ddl_Designation').value;
                if (document.aspnetForm.ctl00_BodyContentPH_txt_EmployeeId.value == "") {
                    alert(EnterEmployeeCode);
                    document.aspnetForm.ctl00_BodyContentPH_txt_EmployeeId.focus();
                    return false;
                } else
                if (document.getElementById('ctl00_BodyContentPH_HdnGetCompanyName').value != CompanyName) {
                    alert(DoNotChange);
                    document.getElementById("ddlLevel0").focus();
                    return false;

                }
                else if (CompanyName == '' || CompanyName == '-Select-') {
                    alert(DoNotChange);
                    document.getElementById("ddlLevel0").focus();
                    return false;
                }
                else if (BranName == '' || BranName == '-Select-') {
                    alert(SelectOrgana);
                    document.getElementById("ddlLevel1").focus();
                    return false;
                }
                else if (document.getElementById("ctl00_BodyContentPH_ddl_Designation").value == '' || document.getElementById("ctl00_BodyContentPH_ddl_Designation").value == '0') {
                    alert(SelDesignation);
                    document.getElementById("ctl00_BodyContentPH_ddl_Designation").focus();
                    return false;
                }
                else if (document.getElementById("ctl00_BodyContentPH_TextBox9").value == '') {
                    alert(SelectDate);
                    document.getElementById("ctl00_BodyContentPH_TextBox9").focus();
                    return false;
                }
                else if (document.aspnetForm.ctl00_BodyContentPH_TextBox1.value == "") {
                        alert(SelectDate);
                        //document.aspnetForm.ctl00_BodyContentPH_TextBox1.value == ""
                        return false;
                }

                else if (document.aspnetForm.ctl00_BodyContentPH_TextBox9.value == "") {
                    alert(SelectDate);
                    // document.aspnetForm.ctl00_BodyContentPH_TextBox9.value == ""
                    return false;
                }
                else if (document.getElementById("ctl00_BodyContentPH_txtReason").value == '') {
                    alert(ReasonNotEmpty);
                    document.getElementById("ctl00_BodyContentPH_txtReason").focus();
                    return false;
                }
                    
                
                    //else if (DepatName == '' || DepatName == '-Select-') {
                    //    alert(SelectOrgana);
                    //    document.getElementById("ddlLevel2").focus();
                    //    return false;
                    //}
            }

            else {
                alert('Changes Cancled');
                return false;
            }

            



            
            
        };


        function getOrg()
        {
            debugger;
            //const dropdown = document.getElementById("ddlLevel0");

            //// The value you want to select
            //const valueToSelect = document.getElementById('ctl00_BodyContentPH_hdnComany').value;

            //// Loop through the options and find the one to select
            //for (let i = 0; i < dropdown.options.length; i++) {
            //    if (dropdown.options[i].value === valueToSelect) {
            //        dropdown.options[i].selected = true;
            //        break; // Exit the loop once the value is selected
            //    }
            //}

        }




    </script>
   
    <script language="javascript" type="text/javascript">
        var SelDesignation = "Select The Designation";
        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 AreyousuretoSave = "Are you sure to Save";
        var EnterEmployeeCode = "Enter Valid Employee Code";
        var DoNotChange = "Do not Change Comapny Name Select the Same Company";
        var SelectDate = "Select the Transfer Date";
        var SelectOrgana = "Select Valid the Organaization Level2";
        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">

        <%--<img src="../dist/img/EmpTra.png" />--%>

        <h1 style="background-image: url('../dist/img/EmpTransfer.png'); background-repeat: no-repeat; padding-left: 40px">
            <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>
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="btn_Save" />
            </Triggers>
        </asp:UpdatePanel>
        <div class="form-horizontal">
            <div class="inr-ftr">
                <div class="row">
                    <div class="col-sm-6">
                        <div class="inr-fil-text pull-left" style="width: 150px !important">
                            <asp:Label ID="lblFilter" runat="server" Text="Transfer From"></asp:Label>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <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>
                                    (6 No.)</span>
                            </h6>
                        </div>
                        <div class="clearfix">
                        </div>
                    </div>
                </div>
            </div>

            <div class="emp-filter">
                <div class="row form-group">
                    <div class="col-md-2">
                        <asp:Label ID="lbl_EmployeeId" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <%--onblur="EmpName('ManualTimeEntry');" OnClientClick="return OpenWindowShiftExchange('txt_EmployeeId','ManualTimeEntry');"--%>
                        <div class="input-group input-group-sm">
                            <asp:TextBox onpaste="return true" ID="txt_EmployeeId" runat="server" CssClass="form-control man-dat"
                                MaxLength="15" OnTextChanged="txt_EmployeeId_TextChanged" AutoPostBack="true" 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" OnClick="btn_Search_Click" CssClass="btn save-btn btn-flat fa fa-search"
                                    OnClientClick="return validateandgetValue();" runat="server" />
                            </span>
                        </div>
                    </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="lblCurDeprtlblNme" Text="Organization Hierarchy" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-9">
                        <asp:TextBox onpaste="return true" CssClass="form-control" ID="Txt_Company" runat="server"
                            ReadOnly="True"></asp:TextBox>
                    </div>
                    <div class="col-md-1">
                    </div>
                   <%-- <div class="col-md-2">
                        <asp:Label ID="lblCurDesgnton" Text="Branch" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:TextBox onpaste="return true" CssClass="form-control" ID="Txt_Branch" runat="server"
                            ReadOnly="True"></asp:TextBox>
                    </div>--%>
                </div>
                <div class="row form-group">
                    <%--<div class="col-md-2">
                        <asp:Label ID="lblDepartment" Text="Department" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:TextBox onpaste="return true" CssClass="form-control" ID="Txt_Depart" runat="server"
                            ReadOnly="True"></asp:TextBox>
                    </div>--%>
              <%--      <div class="col-md-1">
                    </div>--%>
                    <div class="col-md-2">
                        <asp:Label ID="lblApprvlAuthrty" Text="Current Designation" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:TextBox onpaste="return true" CssClass="form-control" ID="Txt_Design" runat="server"
                            ReadOnly="True"></asp:TextBox>
                    </div>
                </div>
                <div class="clearfix">
                </div>

            </div>
        </div>

        <div class="inr-ftr">
                <div class="row">
                    <div class="col-md-12">
                        <div class="inr-fil-text pull-left" style="width:150px; padding-left:5px;">
                            <asp:Label ID="Label4" runat="server" Text="Transfer From"></asp:Label>
                        </div>
                    </div>
                    <div class="clearfix">
             </div>
                </div>
            
            <div class="emp-filter">
            <%--<div class="config-hdr con-spc">
                    <div class="row">
                        <div class="col-md-12">
                            <h3>
                                <asp:Label Font-Bold="true" ID="lblTransfrToHdr" runat="server" Text="Transferred To"></asp:Label></h3>
                        </div>
                    </div>
                </div>--%>
                
                <div class="row">
                    <div class="col-md-12">
                        <asp:UpdatePanel ID="upOrgLevel" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:PlaceHolder ID="PlaceHolderLateEntry" runat="server">
                                    <uc1:TA_uc_OrgLevel_Filter ID="ucOrganizationLevel" runat="server" onclientClick="getOrg()" />
                                </asp:PlaceHolder>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </div>

                   <%--<div class="row form-group">
                    <div class="col-md-2">
                        <asp:Label ID="Label5" Text="Organization Hierarchy" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                 
                        <asp:TextBox onpaste="return true" CssClass="form-control" ID="Txt_COmpanyNw" runat="server"
                            ReadOnly="True"></asp:TextBox>
                    </div>
                    <div class="col-md-1">
                    </div>
                    <div class="col-md-2">
                        <asp:Label ID="Label7" Text="Level" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:DropDownList ID="ddl_BranchTo" AutoPostBack="true" OnTextChanged="ddl_BranchTo_TextChanged" CssClass="form-control select2" runat="server"
                            AppendDataBoundItems="true">
                            <asp:ListItem Text="-Select-" Value="0"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                </div>--%>

               <%-- <div class="row form-group">
                    <div class="col-md-2">
                        <asp:Label ID="Label2" Text="Department" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:DropDownList ID="ddl_Deaprtment" CssClass="form-control select2" runat="server"
                            AppendDataBoundItems="true" onchange="return GetEmployeeInfo('2',ErrorretrievingdatafromAuthority);">
                            <asp:ListItem Text="-Select-" Value="0"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    </div>--%>

                <div class="row form-group">
                    <div class="col-md-2">
                        <asp:Label ID="Label1" Text="New Designation" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:DropDownList ID="ddl_Designation" CssClass="form-control select2 Man-dat" EnableViewState="true"
                            runat="server" AppendDataBoundItems="true" onchange="return GetEmployeeInfo('1',ErrorretrievingdatafromAuthority);">
                            <asp:ListItem Text="-Select-" Value="0"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div class="col-md-1">
                    </div>
                    <div class="col-md-2">
                        <asp:Label ID="Label3" Text="Entry Date" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:TextBox onpaste="return true" CssClass="form-control" ID="txtEntryDate" runat="server"
                            ReadOnly="True"></asp:TextBox>
                    </div>
                </div>
              <%--  <div class="row form-group">
                    <div class="col-md-2">
                        <asp:Label ID="Label5" Text="New Reporting To" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:DropDownList ID="ddl_ReportingTo" CssClass="form-control select2" runat="server"
                            AppendDataBoundItems="true" onchange="return GetEmployeeInfo('2',ErrorretrievingdatafromAuthority);">
                            <asp:ListItem Text="-Select-" Value="0"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div class="col-md-1">
                    </div>
                    <div class="col-md-2">
                        <asp:Label ID="Label7" Text="New Approval Authority" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:DropDownList ID="ddl_LeaveSancAuthority" CssClass="form-control select2" runat="server"
                            AppendDataBoundItems="true">
                            <asp:ListItem Text="-Select-" Value="0"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                </div>--%>
                <div class="row form-group">
                    <div class="col-md-2">
                        <asp:Label ID="Label9" Text="Transfer Date" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:TextBox onpaste="return true" CssClass="form-control" ID="TextBox9" runat="server"></asp:TextBox>
                    </div>
                    <div class="col-md-1">
                    </div>

                    <div class="col-md-2">
                        <asp:Label ID="Label2" Text="Transfer To" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:TextBox onpaste="return true" CssClass="form-control" ID="TextBox1" runat="server"></asp:TextBox>
                    </div>

                    
                </div>
                <div class="row form-group">
                    <div class="col-md-2">
                        <asp:Label ID="Label11" Text="Remarks" 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>
                    </div>
                    <div class="col-md-5">
                    </div>
                    <div class="col-md-6">
                        <div class="col-md-5">
                    </div>
                     
                        <div class="pull-right-button">
                            <asp:HiddenField ID="Hidden1" runat="server" />
                            <asp:LinkButton ID="btn_Save" runat="server" CssClass="btn save-btn fa-floppy-o"
                                OnClick="btn_Save_Click" OnClientClick="return ValidateApprovalSettings();" />
                            <asp:LinkButton ID="btn_Back" runat="server" CausesValidation="False" CssClass="btn save-btn fa-angle-left"
                                OnClick="btn_Back_Click" />
                        </div>
                    </div>
                </div>
                <asp:UpdatePanel ID="abc" runat="server">
                    <ContentTemplate>
                         
                         <asp:HiddenField ID="hdnComany"  runat="server"/>
                        <asp:HiddenField ID="hdnBranch"  runat="server"/>
                        <asp:HiddenField ID="hdndepart"  runat="server"/>
                        <asp:HiddenField ID="HdnBranName"  runat="server"/>
                        <asp:HiddenField ID="HdnDepartName"  runat="server"/>
                        <asp:HiddenField ID="HdnComapnyName"  runat="server"/>
                        <asp:HiddenField ID="HdnGetCompanyName"  runat="server"/>
                         <asp:HiddenField ID="HdnEmployeeMaster" runat="server" />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
            </div>


        <div class="clearfix">
                        </div>





    </div>
</asp:Content>
