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

<%@ 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">
    <script src="../js/Map_GoogleV3.js"></script>

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

    <script type="text/javascript">

        function ScrollUp() {
            
            $('html, body').animate({ scrollTop: 0 }, 'slow');
        }



        function getLocation() {
            debugger;
            var FecingId = document.getElementById('ctl00_BodyContentPH_hdnFencingId').value;
            var adminEmployee=document.getElementById('ctl00_BodyContentPH_hdnEmployeeId').value;

            if (FecingId != "") {
                if (navigator.geolocation) {
                    navigator.geolocation.getCurrentPosition(showPosition);
                } else {
                    console.log("Geolocation is not supported by this browser.");
                }
                return true;
            }
            else if (adminEmployee != "18000000")
            {
                alert('Geofencing not Allocated');
                return false;

            }

        }

        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 = longitude;

            FencingPolygon(latitude, longitude);
            return true;

            //chckPolygonFencing();
        }


    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/city.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_Header" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>

    <div class="emp-filter">
        <div class="form-horizontal">

            <div id="Search1" runat="server">
                <div class="emp-filter">
                    <div class="row form-group">
                        <div class="col-md-12">
                            <div id="map-dsply" style="height: 1200px; direction: ltr; width: 102%; left: -10px">
                            </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 class="row form-group">
                    </div>

                    <div class="row form-group">
                        <div class="col-md-12" style="margin-top: 16px; margin-right: 10px; left: 57px;">
                            <div class="col-md-3">
                            </div>
                            <div class="col-md-8 pull-right-button ">


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

                                        <asp:LinkButton ID="lnkbtnClockIn" runat="server" Autopostback="false" CssClass="btn save-btn fa-floppy-o0"
                                            Text="&nbsp; Clock In" OnClick="lnkbtnSave_Click" OnClientClick="return getLocation();" CommandName="Clock In">
                                        </asp:LinkButton>


                                        <asp:LinkButton ID="lnkbtnBreakOut" CommandName="Break Out" Class="btn save-btn" runat="server" CausesValidation="true"
                                            OnClick="lnkbtnSave_Click" OnClientClick="return getLocation();" />



                                        <asp:LinkButton ID="lnkbtnBreakIn" CommandName="Break In" Class="btn save-btn" runat="server" CausesValidation="true"
                                            OnClick="lnkbtnSave_Click" OnClientClick="return getLocation();" />


                                        <asp:LinkButton ID="lnkbtnClockOut" CommandName="Check Out" Class="btn save-btn fa-floppy-o0" runat="server" CausesValidation="true"
                                            Text="&nbsp; Clock Out" OnClientClick="return getLocation();" OnClick="lnkbtnSave_Click" />

                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>

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

            </div>
            <div class="content">

                <div class="form-horizontal">
                </div>
            </div>
            <div class="form-horizontal">


                <div class="center-none">
                    <div class="Panel-group" id="fencingLocation" role="tablist" aria-multiselectable="true">
                        <div class="panel panel-default">
                            <div class="panel-heading " role="tab" id="heading">
                                <h4 class="panel-title" style="width: 100%">
                                    <label runat="server" id="lbl_FencingLocation">Recent Punches</label>
                                    <%-- <a  role="button" data-toggle="collapse" data-parent="#fencingLocation" href="#collapse" aria-expanded="true" aria-controls="collapse">Add Landmark
                                                                                    </a>--%>
                                </h4>
                            </div>
                            <div id="collapsetwo" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading">
                                <div class="panel-body">

                                     <div id="Div1" runat="server">
                                                    <div class="emp-filter">
                                                        <div class="row form-group">
                                                            <div class="col-md-12" style="overflow: auto; overflow-y: hidden; padding-bottom: 10px">
                                                                <asp:UpdatePanel ID="UpdGrid" 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" />
                                                                        <asp:HiddenField ID="hdnDateFormat" runat="server" />
                                                                        <asp:HiddenField ID="hdnTimeFormat" runat="server" />
                                                                        <asp:HiddenField ID="hdnEmployeeAutoId" runat="server" />
                                                                        <asp:HiddenField ID="hdnFencingId" runat="server" />
                                                                        <dxGridview:ASPxGridView ID="grvAttendance" EnableCallBacks="false" runat="server" ClientInstanceName="grvAttendance"
                                                                            AutoGenerateColumns="false" KeyFieldName="ManualTimeEntry_Id">
                                                                            <Columns>
                                                                                <dxGridview:GridViewDataTextColumn FieldName="logid" VisibleIndex="1" Visible="false">
                                                                                    <DataItemTemplate>
                                                                                        <asp:Label ID="lblTemplateid" runat="server" Text=' <%# Eval("ManualTimeEntry_Id")%>' CssClass="dxlabel"></asp:Label>
                                                                                    </DataItemTemplate>
                                                                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                                                                </dxGridview:GridViewDataTextColumn>
                                                                                <dxGridview:GridViewDataTextColumn FieldName="EmployeeID" VisibleIndex="1" Visible="false">
                                                                                    <DataItemTemplate>
                                                                                        <asp:Label ID="lblEmpid" runat="server" Text=' <%# Eval("Emp_Id")%>' CssClass="dxlabel"></asp:Label>
                                                                                    </DataItemTemplate>
                                                                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                                                                </dxGridview:GridViewDataTextColumn>
                                                                                <dxGridview:GridViewDataTextColumn FieldName="Employee Code Id" VisibleIndex="1" Visible="True">
                                                                                    <DataItemTemplate>
                                                                                        <asp:Label ID="lblTemplateid" runat="server" Text=' <%# Eval("EmployeeCodeid")%>' CssClass="dxlabel"></asp:Label>
                                                                                    </DataItemTemplate>
                                                                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                                                                </dxGridview:GridViewDataTextColumn>
                                                                                <dxGridview:GridViewDataTextColumn Caption="Entry Date" FieldName="Enty Date"
                                                                                    VisibleIndex="2" Width="100px">
                                                                                    <DataItemTemplate>
                                                                                        <asp:Label ID="lblTemplateName" runat="server" Text='<%# Eval("ManualTimeEntry_Date")%>'
                                                                                            CssClass="dxlabel"></asp:Label>
                                                                                    </DataItemTemplate>
                                                                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                                                                </dxGridview:GridViewDataTextColumn>
                                                                                <dxGridview:GridViewDataTextColumn FieldName="Attendance Type" VisibleIndex="3" Width="100px">
                                                                                    <DataItemTemplate>
                                                                                        <asp:Label ID="lblreceivers" runat="server" Text=' <%# Eval("PunchType")%>' CssClass="dxlabel"></asp:Label>
                                                                                    </DataItemTemplate>
                                                                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                                                                </dxGridview:GridViewDataTextColumn>
                                                                                <dxGridview:GridViewDataTextColumn FieldName="Punch Time" VisibleIndex="4" Width="300px">
                                                                                    <DataItemTemplate>
                                                                                        <asp:Label ID="lblpunchTime" runat="server" Text=' <%# Eval("PunchTime")%>' CssClass="dxlabel"></asp:Label>
                                                                                    </DataItemTemplate>
                                                                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />

                                                                                </dxGridview:GridViewDataTextColumn>


                                                                                <dxGridview:GridViewDataTextColumn FieldName="Status" VisibleIndex="5" Width="300px">
                                                                                    <DataItemTemplate>
                                                                                        <asp:Label ID="lblMessage" runat="server" Text=' <%# Eval("ManualTimeEntry_Status")%>' CssClass="dxlabel"></asp:Label>
                                                                                    </DataItemTemplate>
                                                                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                                                                </dxGridview:GridViewDataTextColumn>
                                                                                <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:GridViewDataTextColumn FieldName="Latitude" VisibleIndex="7" Visible="false" Width="300px">
                                                                                    <DataItemTemplate>
                                                                                        <asp:Label ID="lbllat" runat="server" Text=' <%# Eval("Latitude_value")%>' CssClass="dxlabel"></asp:Label>
                                                                                    </DataItemTemplate>
                                                                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />

                                                                                </dxGridview:GridViewDataTextColumn>

                                                                                <dxGridview:GridViewDataTextColumn FieldName="Longitude" VisibleIndex="8" Visible="false" Width="300px">
                                                                                    <DataItemTemplate>
                                                                                        <asp:Label ID="lbllong" runat="server" Text=' <%# Eval("Longitude_value")%>' CssClass="dxlabel"></asp:Label>
                                                                                    </DataItemTemplate>
                                                                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />

                                                                                </dxGridview:GridViewDataTextColumn>

                                                                            </Columns>
                                                                            <SettingsPager PageSize="10">
                                                                                <PageSizeItemSettings Visible="true" ShowAllItem="true" Items="10,20,50,100,200" />
                                                                            </SettingsPager>
                                                                            <SettingsText EmptyDataRow="No Records Found" />
                                                                            <Settings ShowFilterRow="true" />
                                                                            <SettingsBehavior SortMode="Value" AllowSort="true" AllowDragDrop="true" />
                                                                            <Styles CssFilePath="../bootstrap/css/GridView.css" AlternatingRow-CssClass="table-bg">
                                                                            </Styles>
                                                                        </dxGridview:ASPxGridView>
                                                                        <dxGridview:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" GridViewID="grvFencing">
                                                                            <PageFooter Right="[Page # of Pages #]">
                                                                            </PageFooter>
                                                                        </dxGridview:ASPxGridViewExporter>
                                                                    </ContentTemplate>
                                                                </asp:UpdatePanel>

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>

                                    <div class="col-md-12 config-table">



                                        <div class="lvepol-table">
                                            <div class="row">
                                               
                                            </div>
                                            <div class="clearfix">
                                            </div>

                                        </div>


                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</asp:Content>

