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

<%--<%@ Register Src="../UserControls/TA_uc_OrgLevel_Filter.ascx" TagName="TA_uc_OrgLevel_Filter"
    TagPrefix="uc1" %>--%>
<%--<%@ Register Src="../UserControls/TA_uc_OrgLevel_Filter_Modify.ascx" TagName="TA_uc_OrgLevel_Filter"
    TagPrefix="uc1" %>--%>
<%@ Register Src="~/UserControls/TA_uc_OrganizationLevels.ascx" TagName="OrganizationLevel"
    TagPrefix="uc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ContentPlaceHolderID="BodyContentPH" ID="rptLateInstance" runat="server">

    <link rel="stylesheet" href="../bootstrap/css/autoCompleteNew.css" type="text/css"
        media="all" />

    <script type="text/javascript" src="../bootstrap/js/1.4.3/jquery.min.js"></script>

    <script src="../bootstrap/js/1.8.5/jquery-ui.min.js" type="text/javascript"></script>


    <script type="text/javascript">        
        $(function () {
          
            $("#<%= txtEmployeeId.ClientID %>").autocomplete({
                source: function (request, response) {
                    $.getJSON("../AutoCompleteByEmployeeId.ashx?EmpAutoid=" + '<%= Convert.ToString(Session["EmpAutoID"]) %>', {
                        term: extractLast(request.term)
                    }, response);
                },
                search: function () {
                    // custom minLength
                    var term = extractLast(this.value);
                    if (term.length < 1) {
                        return false;
                    }
                },
                focus: function () {
                    // prevent value inserted on focus
                    return false;
                },
                select: function (event, ui) {
               
                    var terms = split(this.value);
                    // remove the current input
                    terms.pop();
                    // add the selected item
                    terms.push(ui.item.value);
                    // add placeholder to get the comma-and-space at the end
                    terms.push("");
                    this.value = terms.join(",");
                    return false;
                }
            });
            function split(val) {
                return val.split(/,\s*/);
            }
            function extractLast(term) {
                return split(term).pop();
            }
        });
        
            $(function () {
          
                $("#<%= txtEmployeeName.ClientID %>").autocomplete({
                    source: function (request, response) {
                        $.getJSON("../AutoCompleteByName.ashx?EmpAutoid=" + '<%= Convert.ToString(Session["EmpAutoID"]) %>', {
                            term: extractLast(request.term)
                        }, response);
                    },
                    search: function () {
                        // custom minLength
                        var term = extractLast(this.value);
                        if (term.length < 1) {
                            return false;
                        }
                    },
                    focus: function () {
                        // prevent value inserted on focus
                        return false;
                    },
                    select: function (event, ui) {
               
                        var terms = split(this.value);
                        // remove the current input
                        terms.pop();
                        // add the selected item
                        terms.push(ui.item.value);
                        // add placeholder to get the comma-and-space at the end
                        terms.push("");
                        this.value = terms.join(",");
                        return false;
                    }
                });
                function split(val) {
                    return val.split(/,\s*/);
                }
                function extractLast(term) {
                    return split(term).pop();
                }
            });
    </script>

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

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

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

    <script type="text/javascript">

        $(function () {
            $('#ctl00_BodyContentPH_txtFromDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txtToDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );

        });
    </script>

    <script type="text/javascript"> 
    $(document).ready(function() {
         $("#<%=txtEmployeeId.ClientID%>").autocomplete('../AutoCompleteByEmployeeId.ashx?EmpAutoid=' + '<%= Convert.ToString(Session["EmpAutoID"]) %>', { multiple: true,
             multipleSeparator: ",",         
             width: 180,            
             highlight: false,
             scroll: true,
             scrollHeight: 300,
             delay: 10
         });
         });
    $(document).ready(function() {
  $("#<%=txtEmployeeName.ClientID%>").autocomplete('../AutoCompleteByName.ashx?EmpAutoid=' + '<%= Convert.ToString(Session["EmpAutoID"]) %>', { multiple: true,
             multipleSeparator: " ,",
             width: 200,             
             highlight: false,
             scroll: true,
             scrollHeight: 300,
             delay: 10
         });
         });
    </script>

    <div class="content-header" id="conHeader" runat="server">
        <h1 style="background-image: url(../dist/img/swipe-icon.png); background-repeat: no-repeat; padding-left: 35px">
            <input id="Hidden2" type="hidden" value='<% Response.Write(Session["IDateFormat"].ToString()); %>' />
            <asp:Label ID="lblWeeklyWorkHours" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-2">
                    <div class="inr-fil-text">
                        <asp:Label ID="lblFilter" runat="server" Text="Filters"></asp:Label>
                    </div>
                </div>
                <div class="clearfix">
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="form-horizontal">
                <asp:HiddenField ID="Hidden1" runat="server" />
                <div id="divEmployeeDetails" runat="server">
                    <div class="row form-group">
                        <div class="col-md-2">
                            <asp:Label ID="lblEmployeeName" runat="server"></asp:Label>
                        </div>
                        <div class="col-md-3">
                            <asp:TextBox ID="txtEmployeeName" runat="server" CssClass="form-control"   Style="resize: none;" TextMode="multiLine"></asp:TextBox>
                          <%--  <cc1:AutoCompleteExtender ID="acEmployeeName" runat="server" CompletionSetCount="10"
                                CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                CompletionInterval="10" Enabled="true" MinimumPrefixLength="1" TargetControlID="txtEmployeeName"
                                ServicePath="../WebServices/AutoCompleteExtender.asmx" ServiceMethod="GetEmployeeNameForReports"
                                CompletionListCssClass="autocomplete_completionListElement" FirstRowSelected="true">
                            </cc1:AutoCompleteExtender>--%>
                        </div>
                        <div class="col-md-1">
                        </div>
                        <div class="col-md-2">
                            <asp:Label ID="lblEmployeeId" runat="server"></asp:Label>
                        </div>
                        <div class="col-md-3">
                            <asp:TextBox ID="txtEmployeeId" runat="server" CssClass="form-control"   Style="resize: none;" TextMode="multiLine"></asp:TextBox>
                           <%-- <cc1:AutoCompleteExtender ID="acEmployeeId" runat="server" CompletionSetCount="10"
                                CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                CompletionInterval="10" Enabled="true" MinimumPrefixLength="1" TargetControlID="txtEmployeeId"
                                ServicePath="../WebServices/AutoCompleteExtender.asmx" ServiceMethod="GetEmployeeIdForReports"
                                CompletionListCssClass="autocomplete_completionListElement" FirstRowSelected="true">
                            </cc1:AutoCompleteExtender>--%>
                        </div>
                    </div>
                    <div class="row form-group">
                        <div class="col-md-2">
                            <asp:Label ID="lblEmpCategory" runat="server"></asp:Label>
                        </div>
                        <div class="col-md-3">
                            <asp:DropDownList ID="ddlEmpCatagory" runat="server" CssClass="form-control select2"
                                AppendDataBoundItems="true">
                                <asp:ListItem Value="0" Selected="True">-Select-</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                        <div class="col-md-1">
                        </div>
                        <div class="col-md-2">
                            <asp:Label ID="lblEmpType" runat="server"></asp:Label>
                        </div>
                        <div class="col-md-3">
                            <asp:DropDownList ID="ddlEmpType" runat="server" CssClass="form-control select2"
                                AppendDataBoundItems="true">
                                <asp:ListItem Value="0" Selected="True">-Select-</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </div>
                </div>
                <div class="row form-group">
                    <div class="col-md-2">
                        <asp:Label ID="lblTimePeriod" runat="server"></asp:Label>
                        -
                        <asp:Label ID="lblFrom" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:TextBox onpaste="return true" ID="txtFromDate" runat="server" CssClass="form-control"
                            onCut="return false" onDrop="return false" MaxLength="11"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="reqFromDate" runat="server" ControlToValidate="txtFromDate"
                            Display="None" EnableClientScript="False" ErrorMessage="Please select FromDate"></asp:RequiredFieldValidator>
                    </div>
                    <div class="col-md-1">
                    </div>
                    <div class="col-md-2">
                        <asp:Label ID="lblTo" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:TextBox onpaste="return true" ID="txtToDate" runat="server" CssClass="form-control"
                            onCut="return false" onDrop="return false" MaxLength="11"></asp:TextBox>
                        <asp:CustomValidator ID="cus_ComToDate" runat="server" EnableClientScript="False"
                            OnServerValidate="CompareDate" ErrorMessage="Select valid date compare with Fromdate"
                            Display="None"></asp:CustomValidator>
                        <asp:RequiredFieldValidator ID="reqToDate" runat="server" ControlToValidate="txtToDate"
                            Display="None" EnableClientScript="False" ErrorMessage="Please select ToDate"></asp:RequiredFieldValidator>
                    </div>
                </div>
                <div class="row form-group">
                    <div class="col-md-2">
                        <asp:Label ID="lblShift" runat="server"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:DropDownList ID="ddlShift" runat="server" CssClass="form-control select2">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlShift"
                            Display="None" ErrorMessage="Select Shift"></asp:RequiredFieldValidator>
                    </div>
                    <div class="col-md-1">
                    </div>
                    <div class="col-md-2">
                        <asp:Label ID="lblReportType" runat="server" Text="Report Type "></asp:Label>
                    </div>
                    <div class="col-md-3" style="padding-left: 0px">
                        <div class="col-md-6">
                            <asp:RadioButton ID="rbtnSummaryReport" GroupName="ReportType" Text="Summary" runat="server"
                                CssClass="radio radio-primary" />
                        </div>
                        <div class="col-md-6">
                            <asp:RadioButton ID="rbtnDetailedReport" GroupName="ReportType" Text="Detailed" runat="server"
                                Checked="true" CssClass="radio radio-primary" />
                        </div>
                    </div>
                </div>
                <div style="display: none;">
                    <div class="col-md-2">
                        <asp:Label ID="lblEmpSwipe" runat="server" Style="display: none;"></asp:Label>
                    </div>
                    <div class="col-md-3">
                        <asp:TextBox ID="txtSwipeCard" MaxLength="20" runat="server" CssClass="form-control"
                            Style="display: none;"></asp:TextBox>
                    </div>
                </div>
                <div class="clearfix">
                </div>
                <div class="row">
                    <div class="row">
                        <div class="line16">
                        </div>
                    </div>
                </div>
                <asp:UpdatePanel ID="upOrgLevel" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:PlaceHolder ID="PlaceHolderLateEntry" runat="server">
                            <uc:OrganizationLevel ID="ucOrganizationLevel" runat="server" />
                        </asp:PlaceHolder>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <div class="row">
                    <div class="col-md-5">
                    </div>
                    <div class="col-md-6">
                        <div class="pull-right-button">
                            <asp:LinkButton ID="btn_View" CssClass="btn save-btn fa-eye" runat="server" OnClick="btn_View_Click"
                                OnClientClick="return DateEntryValidation()" />
                            <asp:ValidationSummary ID="ValidationSummary1" ShowMessageBox="false" ShowSummary="false"
                                runat="server" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

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

        //values for check date
        var Monthfourdigit = 'Please enter valid date as month, day, and four digit year : Format MM/dd/yyyy.';
        //Adding this line var Datefourdigit='Please enter valid date with correct format dd/MM/yyyy'; as newly
        var Datefourdigit = 'Please enter valid date with correct format dd/MM/yyyy';
        var Invalidyearentry = 'Invalid year entry';
        var Invalidmonthentry = 'Invalid month entry';
        var Invaliddateentry = 'Invalid date entry';
        var DateformatDDMONYYYY = 'Incorrect date format. Enter as DD-MON-YYYY';
        var Entertime = 'Enter time';
        var Valueforhours = 'Invalid value for hours:';
        var Invalidvalueforminutes = 'Invalid value for minutes:';
        var Invalidtimeformat = 'Invalid time format:';
        var EntervalidDateandTime = 'Please enter valid Date and Time';
        var ValiddatemonthMMDDYYHHMM = 'Please enter valid Date and Time MM/dd/yyyy HH:mm';
        var ValiddatemonthMMDDYYHHMMTT = 'Please enter valid Date and Time MM/dd/yyyy hh:mm tt';
        var EntervalidDateandTime = 'Please enter valid Date and Time';
        var Invalidvalueforhours = 'Invalid value for hours:';
        var Invalidvalueforminites = 'Invalid value for minutes:';
        var MaxLength = "Maximum length is ";
        var FromDate = "Enter Valid From Date";
        var ToDate = "Enter Valid To Date";

        function SetAlertMessages(fromdate, enterToDate) {

            FromDate = fromdate;
            ToDate = enterToDate;
        }



        function DateEntryValidation() {
            var rangeDemoFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            if (document.aspnetForm.ctl00_BodyContentPH_txtFromDate.value != '') {
                var weekDay = document.aspnetForm.ctl00_BodyContentPH_txtFromDate;
                var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;

                if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)
         ) {
                    if (document.aspnetForm.ctl00_BodyContentPH_txtToDate.value != '') {
                        var weekDay = document.aspnetForm.ctl00_BodyContentPH_txtToDate;
                        var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;

                        if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)
         ) {
                        }
                        else {
                            return false;
                        }
                    }
                    else {
                        //                alert('Enter To Date');
                        alert(ToDate);

                        return false;
                    }
                }
                else {
                    return false;
                }
            }
            else {
                //        alert('Enter From Date');
                alert(FromDate);

                return false;
            }


        }


    </script>

</asp:Content>
