<%@ page language="C#" autoeventwireup="true" inherits="Pages_TimeTable_TimeTable, App_Web_wwh5q3ps" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" maintainscrollpositiononpostback="true" uiculture="auto" meta:resourcekey="PageResource1" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/TimeTable/TimeTable.ascx" TagName="TimeTableControl" TagPrefix="TimeTable" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/TimeTable/TimeTableSchemaDetailBoxControl.ascx" TagName="TimeTableSchemaControl" TagPrefix="TimeTableSchema" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="OTQueueListingUpdatePanel" runat="server">
        <ContentTemplate>
            <style>
                td.tblheight {
                       line-height: 4.4;
                       /*height:125px !important;*/
                      padding-top:0px;
                      padding-bottom:0px;
                     }
                .GridCellDiv{
                    width: 75px;
                }
                /*mantisid : 0040027 (scroll not working properly)*/ 
                #ctl00_CP_TimeTableGridViewPanelItemContent,
                #ctl00_CP_TimeTableGridViewPanelItem,
                #ctl00_CP_TimeTableGridViewWrapper,
                #ctl00_CP_TimeTableGridViewPanelHeader,
                #ctl00_CP_TimeTableGridViewPanelHeaderContent
                {
                    width:100% !important;
                }
              /*mantisid : 0042609*/
                #ctl00_CP_TimeTableGridView {
                  border-collapse: collapse;
                  border:none !important;
                  border-spacing: 1px;
                  border-collapse: separate !important;
                  background-color : #38445a;
                }
                #ctl00_CP_TimeTableGridView tbody, 
                #ctl00_CP_TimeTableGridView td, 
                #ctl00_CP_TimeTableGridView tfoot, 
                #ctl00_CP_TimeTableGridView th, 
                #ctl00_CP_TimeTableGridView thead, 
                #ctl00_CP_TimeTableGridView tr{
                    border: none !important;
                    background: #fff;
                }
               
                /* Freeze the top row */
                .sticky-style th {
                  position: sticky;
                  top: 0;
                  z-index: 2;
                }
 
                /* Freeze the first column */
                .sticky-style th:first-child,
                .sticky-style td:first-child {
                  position: sticky;
                  left: 0;
                  z-index: 1;
                }
 
                /* Ensure the top-left cell stays above others */
                .sticky-style th:first-child {
                  z-index: 3;
                }
                /*For remove outer scroll*/
                .whiteboxpaddingleft .card-box .card-body.timetable-body
                {
                    height:calc(100vh - 210px) !important;
                    max-height:unset !important;
                    min-height:auto !important;
                }
                #GridViewContainer{
                    height : calc(100vh - 280px) !important;
                 }
            </style>
            <TimeTable:TimeTableControl ID="TimeTableControlBox" runat="server" Visible="false" />
            <div id="divContentPage" class="divcontentpagemargin">

                <div class="dashBoardLeftCont">
                    <div class="himssuHeader3WireBox">
                        <table>
                            <tr>
                                <td>
                                    <div class="himsBoxContent">
                                        <div class="leftUlMenu">
                                            <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="222"
                                                Visible="true" runat="server" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="whiteboxpaddingleft row">
                    <TimeTableSchema:TimeTableSchemaControl ID="TimeTableSchemaUserControl" runat="server" Visible="true" />
                    <div class="himssuHeader5WireBox card card-box">
                        <div class="himsBoxHeader card-head">

                            <div class="himsBoxTitle">
                                <div class="headerText">
                                    <header>
                                        <i class="far fa-calendar-alt"></i>
                                        <asp:Label ID="Label1" runat="server" Text="Time Table"></asp:Label>
                                    </header>
                                </div>
                            </div>
                        </div>
                        <div class="himsBoxContent card-body timetable-body">
                            <div class="contentHolder">
                                <div class="himssuHeader1WireBox">
                                    <div id="TimeTableDetailDiv" runat="server" visible="True">

                                        <div class="outerBox pTop5 col-md-3">
                                            <div class="controlLabelWidth">
                                                <asp:Label ID="OrgLabel" runat="server" Text="Organization"></asp:Label>
                                            </div>
                                            <div class="fLeft pRight5">
                                                <asp:DropDownList runat="server" ID="OrganizationDropDownList" SkinID="CustomWidthDropDownList"
                                                    onmouseleave="showHideTooltip()" CssClass="form-control" onmouseenter="showHideTooltip()" AutoPostBack="true" OnTextChanged="OrganizationDropDownList_TextChanged">
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                        <div class="outerBox col-md-3 pTop5">
                                            <div class="controlLabelWidth">
                                                <asp:CheckBox ID="DataTableStickyCheckBox" runat="server" Text=" Data Table Sticky" class="pLeft5" AutoPostBack="true" OnCheckedChanged="DataTableStickyCheckBox_CheckedChanged"/>
                                            </div>
                                        </div>
                                        <div class="himsBoxContent col-md-12">
                                            <div id="GridViewContainer" style="overflow-x: auto;height: 500px;width: 100%;">
                                            <asp:GridView ID="TimeTableGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="DivisionId"
                                                EmptyDataText="No Records Found !!" AllowPaging="False" OnRowDataBound="TimeTableGridView_RowDataBound"
                                                ShowHeader="true" CssClass="table table-bordered table-striped table-hover editable ">
                                                <PagerSettings Visible="False" />
                                            </asp:GridView>
                                            </div>
                                            <asp:HiddenField ID="hfGridView1SV" runat="server" />
                                            <asp:HiddenField ID="hfGridView1SH" runat="server" />
                                            <asp:HiddenField ID="HoriscrollHiddenField" runat="server"/>  
                                            <asp:HiddenField ID="VertiscrollHiddenField" runat="server"/>  
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        
      
        </ContentTemplate>
    </asp:UpdatePanel>
<%--<script type="text/javascript" src="/../../../JavaScript/gridviewScroll.min.js"></script>--%>
    <%--<script data-main="../../JavaScript/rjs/encrypt/class-room-timeoff-encrypt" src="../../JavaScript/rjs/require.js"></script>--%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/class-room-timeoff")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <script type="text/javascript">
      
        function ImageButtonOnClientClick() {
            var gridViewContainer = document.getElementById('GridViewContainer');
            document.getElementById('ctl00_CP_HoriscrollHiddenField').value = gridViewContainer.scrollLeft;
            document.getElementById('ctl00_CP_VertiscrollHiddenField').value = gridViewContainer.scrollTop;
        };
        function DeleteImageButtonOnClientClick() {
            debugger;
            var gridViewContainer1 = document.getElementById('GridViewContainer');
            document.getElementById('ctl00_CP_HoriscrollHiddenField').value = gridViewContainer1.scrollLeft;
            document.getElementById('ctl00_CP_VertiscrollHiddenField').value = gridViewContainer1.scrollTop;
        };

        function GridViewScrollSet() {
            //debugger;
            var HoriscrollHiddenField = document.getElementById('ctl00_CP_HoriscrollHiddenField').value;
            if (Number(HoriscrollHiddenField) > 0) {
                var gridViewContainer = document.getElementById('GridViewContainer');
                gridViewContainer.scrollLeft = document.getElementById('ctl00_CP_HoriscrollHiddenField').value;
            }
            else
            {
                var gridViewContainer = document.getElementById('GridViewContainer');
                gridViewContainer.scrollLeft = document.getElementById('ctl00_CP_HoriscrollHiddenField').value;
            }

            var VertiscrollHiddenField = document.getElementById('ctl00_CP_VertiscrollHiddenField').value;
            if (Number(VertiscrollHiddenField) > 0) {
                var gridViewContainer = document.getElementById('GridViewContainer');
                gridViewContainer.scrollTop = document.getElementById('ctl00_CP_VertiscrollHiddenField').value;
            }
            else {
                var gridViewContainer = document.getElementById('GridViewContainer');
                gridViewContainer.scrollTop = document.getElementById('ctl00_CP_VertiscrollHiddenField').value;
            }

            <%--$('#<%=TimeTableGridView.ClientID%>').gridviewScroll({
                width: 1090,
                height: 355,
                freezesize: 1,
                headerrowcount: 1,
                startVertical: $("#<%=hfGridView1SV.ClientID%>").val(),
                startHorizontal: $("#<%=hfGridView1SH.ClientID%>").val(),
                onScrollVertical: function (delta) {
                    $("#<%=hfGridView1SV.ClientID%>").val(delta);
                },
                onScrollHorizontal: function (delta) {
                    $("#<%=hfGridView1SH.ClientID%>").val(delta);
                }
            });--%>

        }
       
            function checkitem(checkBox, textBox1) {
                var e = document.getElementById(textBox1.id);
                var f = document.getElementById(checkBox.id);
                if (f.checked == true) {
                    e.disabled = true;
                }
                else {
                    e.disabled = false;
                }
            }
            function isNumberKey(evt) {
                var charCode = (evt.which) ? evt.which : event.keyCode;
                if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
                    return false;
                return true;
            }
            //document.getElementById("ctl00_CP_DataTableStickyCheckBox").addEventListener("change", function () {
            //    const table = document.getElementById("ctl00_CP_TimeTableGridView");
            //    if (this.checked) {
            //        table.classList.add("sticky-style");
            //    } else {
            //        table.classList.remove("sticky-style");
            //    }
            //});
            function OnOrgDropdownChange() {
                const table = document.getElementById("ctl00_CP_TimeTableGridView");
                var checkbox = document.getElementById("ctl00_CP_DataTableStickyCheckBox");
                if (checkbox.checked) {
                    table.classList.add("sticky-style");
                } else {
                    table.classList.remove("sticky-style");
                }
            }
    </script>
</asp:Content>
