<%@ Page Title="" Language="C#" MasterPageFile="~/MasterFile/TimeCheck.master" AutoEventWireup="true" 
    CodeFile="TA_Master_UI_GeoFencingAllocation.aspx.cs" Inherits="Masters_TA_Master_UI_GeoFencingAllocation" %>

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

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

    <!--[if gt IE 5.5]>
	<link rel="stylesheet" type="text/css" href="../css/anytimeIE.css" />
			<link rel="stylesheet" type="text/css" href="../css/ProgressforIE.css" />
 <![endif]-->

    
    <link href="../dist/css/bootstrap-responsive-tabs.css" rel="stylesheet" type="text/css">
    <script src="../dist/js/jquery.bootstrap-responsive-tabs.min.js"></script>

    <%--<script src="../plugins/datepicker/bootstrap-datepicker.js"></script>--%>
    <link href="../dist/css/bootstrap-responsive-tabs.css" rel="stylesheet" type="text/css">

    <script src="../js/Map_GoogleV3.js"></script>



    <link href="../css/ProgressBar.css" rel="stylesheet" type="text/css" />
    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>
    <script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
    <script language="javascript" src="../js/DateTimeValidation.js" type="text/javascript"></script>
    

    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>
    <script>
        $(function () {
            $('#ctl00_BodyContentPH_txt_StartDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txt_ToDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
    </script>

    <script>
        $(function () {
            $('#ctl00_BodyContentPH_txtStartDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txtEndDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
    </script>

    <script type="text/javascript">
        function getLocation() {
            debugger
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(showPosition);
            } else {
                console.log("Geolocation is not supported by this browser.");
            }
        }

        function showPosition(position) {

            //10.997445274090484, 76.98714034150377

            //var latitude = position.coords.latitude;
            //var longitude = position.coords.longitude;
        
            //var latitude = "10.99981490970107";
            //var longitude = "76.98817665393813";

            document.getElementById('ctl00_BodyContentPH_hdnLatitude').value = latitude;
            document.getElementById('ctl00_BodyContentPH_hdnLongitude').value = latitude;

            FencingPolygon(latitude, longitude);
            //chckPolygonFencing();
        }


    </script>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

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

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

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

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

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

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

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

    <script src="../js/EmpShiftAllocationSingle.js"></script>





    <script type="text/javascript">
        //values for check date
        var Monthfourdigit = 'Please enter valid date as month, day, and four digit year : Format MM/dd/yyyy.';
        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 ";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }


        function SetAlertCheckDate(monthfourdigit, datefourdigit, invalidyearentry, invalidmonthentry, invaliddateentry, dateformatDDMONYYYY, entertime, valueforhours, invalidvalueforminutes, invalidtimeformat, entervalidDateandTime, validdatemonthMMDDYYHHMM, validdatemonthMMDDYYHHMMTT, entervalidDateandTime, invalidvalueforhours, invalidvalueforminites) {
            Monthfourdigit = monthfourdigit;
            Datefourdigit = datefourdigit;
            Invalidyearentry = invalidyearentry;
            Invalidmonthentry = invalidmonthentry;
            Invaliddateentry = invaliddateentry;
            DateformatDDMONYYYY = dateformatDDMONYYYY;
            Entertime = Entertime;
            Valueforhours = valueforhours;
            Invalidvalueforminutes = invalidvalueforminutes;
            Invalidtimeformat = invalidtimeformat;
            EntervalidDateandTime = entervalidDateandTime;
            ValiddatemonthMMDDYYHHMM = validdatemonthMMDDYYHHMM;
            ValiddatemonthMMDDYYHHMMTT = validdatemonthMMDDYYHHMMTT;
            EntervalidDateandTime = entervalidDateandTime;
            Invalidvalueforhours = invalidvalueforhours;
            Invalidvalueforminites = invalidvalueforminites;
        }
        var EnterDetails = "Please enter any of the above details";
        var FillFromandToDate = "Please enter both the From and To Date";
        function SetAlertMessages(FillDetails, fillFromToDate) {
            EnterDetails = FillDetails;
            FillFromandToDate = fillFromToDate;
        }
        function WeekdayValidation() {
            var EmpId = document.getElementById('ctl00_BodyContentPH_txtEmployeeId');
            var EmpName = document.getElementById('ctl00_BodyContentPH_txt_EmpName');
            var weekDay = document.aspnetForm.ctl00_BodyContentPH_txtStartDate;
            var weekDay2 = document.aspnetForm.ctl00_BodyContentPH_txtEndDate;
            var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            var strSwipCard = document.getElementById('ctl00_BodyContentPH_txtSwipeCard').value;
            var Type = document.getElementById('ctl00_BodyContentPH_ddlType').selectedIndex;
            var rangeDemoFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            if ((weekDay.value == '' && weekDay2.value != '') || (weekDay.value != '' && weekDay2.value == '')) {
                alert(FillFromandToDate);
                return false;
            }
            if (weekDay.value != '') {
                if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                    if (weekDay2.value != '') {
                        if (checkDate(weekDay2, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                        }
                        else {
                            return false;
                        }
                    }
                }
                else {
                    return false;
                }
            }
            ValidationFencingSearch();
        }

        function ValidationFencing() {

            debugger;
            var SelectSheduleFrom = "Select Schedule From";
            var SelectSheduleTo = "Select Schedule To";
            var SelectFencing = "Select Fencing";
            var AddEmployee = "Please Click Add Button To Select Employee(s)";
            var Patternindex = document.aspnetForm.ctl00_BodyContentPH_ddl_Fencing.selectedIndex;

           
            if (Patternindex == "0") {
                alert(SelectFencing);
                return false;
            }
            else
            if (document.aspnetForm.ctl00_BodyContentPH_txt_StartDate.value == "") {
                alert(SelectSheduleFrom);
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txt_ToDate.value == "") {
                alert(SelectSheduleTo);
                return false;
            }
            
        }

        function ValidationFencingSearch() {

            debugger;
            var SelectSheduleFrom = "Select Data Rang From";
            var SelectSheduleTo = "Select Data Rang To";
            
            if (document.aspnetForm.ctl00_BodyContentPH_txtStartDate.value == "") {
                    alert(SelectSheduleFrom);
                    return false;
                }
            else if (document.aspnetForm.ctl00_BodyContentPH_txtEndDate.value == ""
                    ) {
                    alert(SelectSheduleTo);
                    return false;
                }

        }

        function mapload()
        {
            debugger;
           
            //$("BtnView").on("click", function () {
            //    $($(this).data("target")).modal("myMapModal");
            //});
            loadMapControl();
            getLocation();
            //showPosition(position);
            return true;
        }



        function getLocation() {
            debugger;
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(showPosition);
            } else {
                console.log("Geolocation is not supported by this browser.");
            }
        }

        function showPosition(position) {

            //10.997445274090484, 76.98714034150377

            //var latitude = position.coords.latitude;
            //var longitude = position.coords.longitude;
            debugger;

            var latitude = "10.99981490970107";
            var longitude = "76.98817665393813";

            document.getElementById('ctl00_BodyContentPH_hdnLatitude').value = latitude;
            document.getElementById('ctl00_BodyContentPH_hdnLongitude').value = latitude;

            FencingPolygon(latitude, longitude);
            //chckPolygonFencing();
        }

        
        function ShowPopup(title, body) {
            $("#myMapModal .modal-title").html(title);
            $("#myMapModal .modal-body").html(body);
            $("#myMapModal").modal("show");
        };



    </script>
    <script type="text/javascript">
        function navi(loc) {
            document.getElementById('ctl00_BodyContentPH_iframePopup').src = loc;
            return false;
        }
        function Delete_Conf() {
            //Alert_AreyousuretoDelete
            return confirm('Are you sure to Delete ?');
        }
    </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_Headers" Text="Geo Fencing Allocation" 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="Label1" runat="server" Text="Allocation"></asp:Label>
                    </div>
                </div>
            </div>
        </div>

         


        <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" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title" style="padding-bottom: 10px">
                            <asp:Label ID="lblSelectEmployee" runat="server" Text="Select Employee(s)"></asp:Label>
                        </h4>
                    </div>
                    <div class="modal-body" style="padding-top: 0px">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="680px"
                            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>

        <%-- Map Modal --%>
         <div id="myMapModal" 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" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title" style="padding-bottom: 10px">
                            <asp:Label ID="Label2" runat="server" Text="Fencing Map"></asp:Label>
                        </h4>
                    </div>
                    <div class="modal-body" style="padding-top: 40px; height: 400px; width: 102%;">
                        <div class="row form-group">
                        <div class="col-md-12">


                            <div id="map-dsply" style="height: 1000px; direction: ltr; width: 98%; left: -5px" >
                            </div>
                            <style type="text/css">
                                .nm_buttonPair {
                                    right: 96%;
                                }

                                @media screen and (-webkit-min-device-pixel-ratio:0) {
                                    .nm_zoomWrap {
                                        margin-right: 96%;
                                    }
                                }
                            </style>    

                        </div>
                        

                    </div>
                    </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="emp-filter">

        </div>


        
        <div class="emp-filter">
            <div class="form-horizontal">
                <asp:Panel ID="FiratPanel" runat="server" >
                <div class="row" id="divManual" runat="server">
                    <div class="col-md-6">
                        <div id="actualdiv">
                            
                            <div id="divMultiple" runat="server">
                                <div class="row form-group">
                                    <div class="col-md-6">
                                        <asp:Label ID="lbl_SelectedEmployees" Text="Select Employee" runat="server"></asp:Label>
                                    </div>
                                    <div class="col-md-6">
                                        <asp:LinkButton ID="btn_Add" Text="Add" CssClass="btn add-btn fa-plus" runat="server" 
                                             data-toggle="modal" data-target="#myModal" OnClick="btn_Add_Click" 
                                            OnClientClick="return OpenWindow();" />
                                       
                                    </div>
                                </div>
                            </div>
                         
                            <div id="divSingle" style="display: none" runat="server">
                                <div class="row form-group">
                                    <div class="col-md-6">
                                        <asp:Label ID="lblEmployeeCode" runat="server" Text="Employee Code"></asp:Label>
                                    </div>
                                    <div class="col-md-6">
                                        <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="ajaxShiftAllocationSingle();" 
                                                onkeypress="return acceptCharsNum_MaxLength(event,this,15,MaxLength);"></asp:TextBox>
                                            <span class="input-group-btn">
                                                <asp:LinkButton ID="LinkButton1" data-toggle="modal" data-target="#myModal" 
                                                    CssClass="btn save-btn btn-flat fa fa-search"
                                                    runat="server" OnClientClick="return OpenWindowShiftExchangeGrid('txt_EmployeeId');" />
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                        </div>
                        <div id="divShiftPattern">
                            
                            <div class="row form-group">
                                <div class="col-md-6">
                                    <asp:Label ID="lbl_Fencing" Text="Fencing" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-6">
                                    <asp:DropDownList ID="ddl_Fencing" runat="server" AppendDataBoundItems="true" CssClass="form-control select2 Man-dat">
                                        <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                           
                        </div>
                        
                        <div class="row form-group">
                            <div class="col-md-6">
                                <asp:Label ID="lbl_ScheduleFrom" Text="ScheduleFrom" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-6">
                                <asp:TextBox onpaste="return true" ID="txt_StartDate" runat="server" CssClass="form-control man-dat"
                                    onCut="return false" onDrop="return false;"></asp:TextBox>
                               
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-6">
                                <asp:Label ID="lbl_ScheduleTo" Text="ScheduleTo" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-6">
                                <asp:TextBox onpaste="return true" ID="txt_ToDate" runat="server" CssClass="form-control man-dat"
                                    onCut="return false" onDrop="return false;"></asp:TextBox>
                                
                            </div>
                        </div>
                        
                        <div>
                            


                            <asp:UpdatePanel ID="Update" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>

                            <div class="pull-right-button">
                                <asp:LinkButton ID="btn_Save" Text=" Save" CssClass="btn save-btn fa-floppy-o" runat="server"
                                    OnClick="btn_Save_Click" OnClientClick ="return ValidationFencing();" />

                               
                                <asp:HiddenField ID="HiddenField1" runat="server" Value="Geofencing" />
                            </div>
                                    </ContentTemplate>
                                </asp:UpdatePanel>




                        </div>

                    </div>
                    <div class="col-md-6">
                        <div class="row">
                        </div>
                        <div class="row form-group">
                            <div class="col-md-12">
                                <div class="table-responsive">
                                    <asp:GridView ID="grv_Employees" runat="server" AutoGenerateColumns="False" AllowPaging="true"
                                        PageSize="10" OnPageIndexChanging="grv_Employees_PageIndexChanging" CellPadding="4"
                                        OnRowDeleting="grv_Employees_RowDeleting" OnRowDataBound="grv_Employees_RowDataBound"
                                        AutoGenerateDeleteButton="True" CssClass="table das-table1">
                                        <Columns>
                                            <asp:TemplateField HeaderText="EmpId" Visible="false" HeaderStyle-CssClass="empheader"
                                                ItemStyle-CssClass="table-icons">
                                                <ItemTemplate>
                                                    <itemstyle horizontalalign="Center" />
                                                    <headerstyle horizontalalign="Center" />
                                                    <asp:Label ID="lbl_EmpAutoId" Text='<%# Eval("EmpId")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="LoginEmployeeId" Visible="false" HeaderStyle-CssClass="empheader"
                                                ItemStyle-CssClass="table-icons">
                                                <ItemTemplate>
                                                    <itemstyle horizontalalign="Center" />
                                                    <headerstyle horizontalalign="Center" />
                                                    <asp:Label ID="lbl_LoginEmployeeId" Text='<%# Eval("LoginEmployeeId")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Employee Id" HeaderStyle-CssClass="empheader">
                                                <ItemTemplate>
                                                    <itemstyle horizontalalign="Center" />
                                                    <headerstyle horizontalalign="Center" />
                                                    <asp:Label ID="lbl_EmpId" Text='<%# Eval("EmployeeId")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Employee Name" HeaderStyle-CssClass="empheader">
                                                <ItemTemplate>
                                                    <asp:Label ID="lbl_EmpName" Text='<%# Eval("EmployeeName")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <RowStyle Height="30px" CssClass="table-bg" BorderColor="#C5DFFC" />
                                        <PagerStyle Font-Overline="False" HorizontalAlign="Right" CssClass="GridPager" />
                                        <PagerSettings FirstPageText="<<" LastPageText=">>" Mode="NumericFirstLast" NextPageText=">"
                                            PreviousPageText="<" />
                                        <AlternatingRowStyle BackColor="white" />
                                    </asp:GridView>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
               </asp:Panel>
            </div>
        </div>


        <!--FILTERS-->
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-2">
                    <div class="inr-fil-text">
                        <asp:Label ID="lblFilter" runat="server" Text="Filter"></asp:Label>
                    </div>
                </div>
            </div>
        </div>
       
        <div class="emp-filter">
            <div class="row">
                <div class="form-horizontal">
                    <div class="col-md-12">
                        <div id="trSwipeCardNo" runat="server" style="display: none;">
                            <div class="row form-group">
                                <div class="col-md-12">
                                    <asp:Label ID="lblEmpSwipe" runat="server"></asp:Label>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-12">
                                    <asp:TextBox onpaste="return true" ID="txtSwipeCard" MaxLength="20" runat="server"
                                        CssClass="form-control" onkeypress="return acceptCharsNum_MaxLength(event,this,20,MaxLength);"></asp:TextBox>
                                    <cc1:AutoCompleteExtender ID="acSwipeCardNo" runat="server" CompletionSetCount="10"
                                        CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                        CompletionInterval="10" Enabled="true" MinimumPrefixLength="1" TargetControlID="txtSwipeCard"
                                        ServicePath="../WebServices/AutoCompleteExtender.asmx" ServiceMethod="GetCardNo"
                                        CompletionListCssClass="autocomplete_completionListElement" FirstRowSelected="true">
                                    </cc1:AutoCompleteExtender>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-12" style="display: none;">
                                    <asp:Label ID="lblType" runat="server"></asp:Label>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-12" style="display: none;">
                                    <asp:DropDownList ID="ddlType" runat="server">
                                        <asp:ListItem Text="Manual Entry" Value="ManualEntry"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                        </div>
                        <div runat="server" id="trEmpName">
                            <div class="row form-group">
                                <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" ID="txt_EmpName" runat="server" CssClass="form-control"
                                        MaxLength="50" onkeypress="return employeename_singlequotes_maxlength(event,this,50,MaxLength);"></asp:TextBox>
                                    <cc1:AutoCompleteExtender ID="acEmpName" runat="server" CompletionInterval="10" CompletionSetCount="10"
                                        CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                        Enabled="true" FirstRowSelected="true" MinimumPrefixLength="1" ServicePath="../WebServices/AutoCompleteExtender.asmx"
                                        ServiceMethod="GetEmployeeName" CompletionListCssClass="autocomplete_completionListElement"
                                        TargetControlID="txt_EmpName">
                                    </cc1:AutoCompleteExtender>
                                </div>
                                <div class="col-md-1">
                                </div>
                                <div class="col-md-2">
                                    <asp:Label ID="lbl_EmployeeId" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:TextBox onpaste="return true" ID="txtEmployeeId" runat="server" CssClass="form-control"
                                        SMaxLength="15" onkeypress="return acceptCharsNum_MaxLength(event,this,15,MaxLength);"></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="GetEmployeeId"
                                        CompletionListCssClass="autocomplete_completionListElement" FirstRowSelected="true">
                                    </cc1:AutoCompleteExtender>
                                </div>
                            </div>
                        </div>
                        <div class="row" style="display: none">
                            <div class="col-md-3">
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblTimePeriod" runat="server"></asp:Label>
                                <asp:Label ID="lblStartDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtStartDate" runat="server" CssClass="form-control man-dat"
                                    EnableViewState="False" onCut="return false" onDrop="return false"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lblEndDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtEndDate" runat="server" CssClass="form-control man-dat"
                                    EnableViewState="False" onCut="return false" onDrop="return false"></asp:TextBox>
                            </div>
                        </div>
                        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                        <div class="row">
                            <div class="col-md-5">
                            </div>
                            <div class="col-md-6" runat="server" id="td1">
                                <div class="pull-right-button">
                                    <asp:Label ID="lbl_Error" runat="server" ForeColor="Red"></asp:Label>
                                    <asp:LinkButton ID="btn_Search" CssClass="btn src-btn fa-search" runat="server" 
                                        OnClick="btn_Search_Click" 
                                        OnClientClick="return ValidationFencingSearch();" />
                                    <asp:LinkButton ID="btn_Clear" CssClass="btn clr-btn fa-refresh" runat="server" 
                                        OnClick="btn_Clear_Click" />
                                </div>
                            </div>
                        </div>
                                    </ContentTemplate>
                            </asp:UpdatePanel>
                    </div>
                </div>
            </div>
        </div>
        <!--RES TABLE-->
        <div class="border-table new-space">
            <div class="pull-right-button">
                <%--<asp:LinkButton ID="btnCustWindow" Visible="false" runat="server" CssClass="btn save-btn fa-folder-open-o"
                        Text="&nbsp;&nbsp;Field Lists" OnClientClick="ShowHideCustomizationWindow();"></asp:LinkButton>--%>
                <%--<asp:LinkButton ID="btn_Add" CssClass="btn add-btn fa-plus" runat="server" OnClick="btnAdd_Click" />--%>
                <%--<asp:LinkButton ID="btnImport" CssClass="btn add-btn fa-plus" runat="server" OnClick="btnImport_Click" />--%>
                <%--<asp:LinkButton ID="btn_Cancel" CssClass="btn clr-btn fa-angle-left" runat="server"
                    CausesValidation="False" OnClick="btn_Cancel_Click" Visible="false" />--%>
<%--                <asp:LinkButton ID="lnktbnexcel" Visible="false" ToolTip="Excel" CommandName="excel" runat="server" CssClass="btn del-btn fa-file-excel-o" OnClick="lnktbnexcel_Click">
                </asp:LinkButton>--%>
                <%--<asp:LinkButton ID="lnkbtnpdf" Visible="false" ToolTip="Pdf" CommandName="pdf" runat="server" CssClass="btn del-btn fa-file-pdf-o" OnClick="lnktbnexcel_Click">
                </asp:LinkButton>--%>
            </div>
           
            <div class="table-responsive">
                <asp:HiddenField ID="Hidden1" runat="server" />
                <asp:HiddenField ID="Hidden2" runat="server" />
                  

                <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:HiddenField ID="hdnLatitude" runat="server" />
                                <asp:HiddenField ID="hdnLongitude" runat="server" />
                                <asp:HiddenField ID="hdnEmployeeId" runat="server" />
                                <asp:HiddenField ID="hdnSelectedLat" runat="server" />
                                <asp:HiddenField ID="hdnSelectedLong" runat="server" />
                                <asp:HiddenField ID="hdnisValidepunch" runat="server" />
                        <dxGridview:ASPxGridView ID="GridView1" EnableCallBacks="false" runat="server" 
                            ClientInstanceName="GridView1" OnRowCommand="GridView1_RowCommand"
                            AutoGenerateColumns="false" Width="50%"
                             KeyFieldName="id">


                            <%--DataSourceID="ObjectDataSource1"--%>

                            <Columns>

                                <dxGridview:GridViewDataTextColumn FieldName="Fencing Allocation Auto ID" VisibleIndex="0"
                                    Visible="false">
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_id" Text='<%# Eval("id") %>' runat="server"></asp:Label>
                                    </DataItemTemplate>
                                    <Settings AllowHeaderFilter="true" />
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataTextColumn>


                                <dxGridview:GridViewDataTextColumn FieldName="Employeeid" VisibleIndex="1" Caption="Employee ID"
                                    Width="100px" Visible="false">
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_EmpCodeid" Text='<%# Eval("EmployeeId") %>' runat="server"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                    <CellStyle Wrap="True"></CellStyle>
                                </dxGridview:GridViewDataTextColumn>

                                <dxGridview:GridViewDataTextColumn FieldName="EmployeeCodeid" VisibleIndex="2" Caption="Employee Code"
                                    Width="150px">
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_EmpCodeid" Text='<%# Eval("Employee_Code_Id") %>' runat="server"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                    <CellStyle Wrap="True"></CellStyle>
                                </dxGridview:GridViewDataTextColumn>

                                <dxGridview:GridViewDataTextColumn FieldName="EmployeeName" VisibleIndex="3" Caption="Employee Name"
                                    Width="150px">
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_EmpCodeid" Text='<%# Eval("EmployeeName") %>' runat="server"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                    <CellStyle Wrap="True"></CellStyle>
                                </dxGridview:GridViewDataTextColumn>

                                <dxGridview:GridViewDataTextColumn Caption="Fencing ID" FieldName="Fencing ID"
                                     Width="200px" Visible="false">
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_FencingID" Text='<%# Eval("FencingId") %>' runat="server" 
                                            Style="overflow-y: auto; overflow-x: auto; word-break: break-all;
                                                 word-wrap: break-word; cursor: pointer; display: inline-block;"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                    <CellStyle Wrap="True"></CellStyle>
                                </dxGridview:GridViewDataTextColumn>

                                <dxGridview:GridViewDataTextColumn Caption="Fencing Name" FieldName="Fencing Name"
                                    VisibleIndex="4" Width="200px">
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_FencingName" Text='<%# Eval("Fencing_Name") %>' runat="server" 
                                            Style="overflow-y: auto; overflow-x: auto; word-break: break-all;
                                                 word-wrap: break-word; cursor: pointer; display: inline-block;"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                    <CellStyle Wrap="True"></CellStyle>
                                </dxGridview:GridViewDataTextColumn>


                                <dxGridview:GridViewDataTextColumn FieldName="From Date" VisibleIndex="5"
                                    Width="120px">
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_FromDate" Text='<%# Eval("FromDate") %>'
                                            runat="server"></asp:Label></a>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataTextColumn>


                                <dxGridview:GridViewDataTextColumn FieldName="To Date" VisibleIndex="6"
                                    Width="136px">
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_ToDate" Text='<%# Eval("Todate") %>' runat="server"></asp:Label></a>
                                    </DataItemTemplate>
                                    <Settings AllowAutoFilter="true" />
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataTextColumn>


                                <dxGridview:GridViewDataTextColumn FieldName="Creater" 
                                    Width="85px"  Visible="false">
                                    <Settings AllowAutoFilter="false" AllowDragDrop="false" />
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_CreatedBy" Text='<%# Eval("CreatedBy") %>' runat="server"></asp:Label></a>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataTextColumn>


                                <dxGridview:GridViewDataTextColumn FieldName="Created Date" 
                                    Width="120px"  Visible="false">
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_CreatedOn" Text='<%# Eval("CreatedOn") %>'
                                            runat="server"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataTextColumn>


                                <dxGridview:GridViewDataTextColumn FieldName="Modify BY" 
                                    Width="136px"  Visible="false">
                                    <Settings AllowAutoFilter="true" />
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_ModifyBy" Text='<%# Eval("ModifyBy") %>' runat="server"></asp:Label></a>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataTextColumn>


                                <dxGridview:GridViewDataTextColumn FieldName="Modified On" 
                                    Width="85px"  Visible="false">
                                    <Settings AllowAutoFilter="false" AllowDragDrop="false" />
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_ModifyOn" Text='<%# Eval("ModifyOn") %>' runat="server"></asp:Label></a>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataTextColumn>


                                <dxGridview:GridViewDataTextColumn FieldName="Months" 
                                    Width="200px"  Visible="false">
                                    <Settings AllowAutoFilter="false" AllowDragDrop="false" />
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_Months" Text='<%# Eval("months")%>' runat="server"
                                            Style="overflow-y: auto; overflow-x: auto; word-break: break-all; cursor: pointer; width: 180px; word-wrap: break-word; display: inline-block;"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataTextColumn>


                                <dxGridview:GridViewDataTextColumn FieldName="Year" 
                                    Width="122px"  Visible="false">
                                    <Settings AllowDragDrop="False" />
                                    <DataItemTemplate>
                                        <asp:Label ID="lbl_Year" Text='<%# Eval("years")%>' runat="server"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataTextColumn>

                                <dxGridview:GridViewDataColumn HeaderStyle-VerticalAlign="Middle" 
                                    HeaderStyle-HorizontalAlign="Center"
                                    CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center" Width="60px">
                                    <Settings AllowAutoFilter="false" />
                                    <DataItemTemplate>
                                          <asp:LinkButton ID="BtnView" runat="server" 
                                          
                                            OnClick="BtnView_Click" CommandName='<%# Eval("FromDate") %>' CommandArgument='<%# Eval("EmployeeId") %>' 
                                              data-target="#myMapModal"
                                             data-placement="top"
                                            CssClass="btn btn-defalut view-icons" Style="color: #3C8DBC"></asp:LinkButton>

                                        <%--<a data-toggle="modal" title='<%# Session["View"] %>' data-target="#myMapModal" data-placement="top"
                                            onclick="mapload();"
                                            href="#">
                                            <span class="btn btn-defalut view-icons"></span></a>--%>

                                        
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataColumn>


                               <%-- <dxGridview:GridViewDataColumn HeaderStyle-VerticalAlign="Middle" 
                                    HeaderStyle-HorizontalAlign="Center"
                                    CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center" Width="35px">
                                    <Settings AllowAutoFilter="false" />
                                    <DataItemTemplate>
                                        <asp:LinkButton ID="btnEdit" runat="server" ToolTip='<%# Session["Edit"] %>' 
                                            data-toggle="tooltip"
                                            OnClick="EditLinkButton_Click" CommandName='<%# Eval("id") %>'
                                             data-placement="top"
                                            CssClass="btn btn-defalut edit-icons" Style="color: #3C8DBC"></asp:LinkButton>--%>
                                        <%--CommandArgument='<%# Eval("ManualTimeEntry_Status") %>'--%>
                                  <%--  </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataColumn>--%>

                               <%-- <dxGridview:GridViewDataTextColumn CellStyle-HorizontalAlign="Center" VisibleIndex="6" Name="Edit" Width="50px">
                                                            <DataItemTemplate>
                                                                <asp:LinkButton ID="btnEdit" runat="server" CommandArgument='<%# Eval("ManualTimeEntry_Id") %>' data-toggle="tooltip"
                                                                    data-placement="top" CssClass="btn btn-defalut view-icons" Style="color: #3C8DBC; text-decoration: none;"
                                                                    OnClick="btnEdit_Click" CommandName="Edit"></asp:LinkButton>
                                                            </DataItemTemplate>
                                                        </dxGridview:GridViewDataTextColumn>--%>

                                <dxGridview:GridViewDataColumn HeaderStyle-VerticalAlign="Middle"
                                     HeaderStyle-HorizontalAlign="Center"
                                    CellStyle-VerticalAlign="Middle" Visible="false" CellStyle-HorizontalAlign="Center" Width="60px">
                                    <Settings AllowAutoFilter="false" />

                                    <DataItemTemplate>
                                        <asp:LinkButton ID="btnDelete" runat="server" ToolTip='<%# Session["Delete"] %>'
                                             data-toggle="tooltip"
                                            OnClick="btn_delete_Click_1" CommandName='<%# Eval("id") %>'
                                             data-placement="top"
                                            CssClass="btn btn-defalut del-icons" Style="color: Red" 
                                            OnClientClick="return Delete_Conf();"></asp:LinkButton>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                </dxGridview:GridViewDataColumn>

                            </Columns>
                            <SettingsPager PageSize="10">
                                <PageSizeItemSettings Visible="true" ShowAllItem="true" Items="10,20,50,100,200" />
                            </SettingsPager>
                            <Settings ShowFilterRow="false" ShowFilterRowMenu="false" HorizontalScrollBarMode="Auto" ShowGroupPanel="true"
                                 VerticalScrollBarMode="Hidden" VerticalScrollableHeight="400" />
                            <SettingsText EmptyDataRow="No Records Found" />
                            <SettingsBehavior AutoExpandAllGroups="false" ColumnResizeMode="Control" />
                            <SettingsBehavior AllowDragDrop="true" />
                            <Styles AlternatingRow-CssClass="table-bg">
                            </Styles>
                        </dxGridview:ASPxGridView>
                        <dxGridview:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" GridViewID="GridView1">
                            <PageFooter Right="[Page # of Pages #]">
                            </PageFooter>
                        </dxGridview:ASPxGridViewExporter>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                    </Triggers>
                </asp:UpdatePanel>
                <asp:Timer ID="Timer1" runat="server" Interval="180000" OnTick="Timer1_Tick"></asp:Timer>
            </div>
            <div class="clearfix">
            </div>
           
        </div>
        <!--RES TABLE-->
    </div>
    <script type="text/javascript">
        function OnInit(s, e) {
            AdjustSize();
        }
        function OnEndCallback(s, e) {
            AdjustSize();
        }
        function AdjustSize() {
            var height = Math.max(0, document.documentElement.clientHeight);
            var width = Math.max(0, document.documentElement.clientWidth);
            grid.SetHeight(height);
        }
    </script>
</asp:Content>

