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

<%@ Register TagPrefix="UC" TagName="orglevel" Src="~/UserControls/TA_uc_OrgLevel_Filter_Modify.ascx" %>
<%--<%@ Register Src="~/UserControls/TA_uc_OrgLevelFilter_Updated.ascx" TagName="orglevel1"
    TagPrefix="UC1" %>--%>
<%@ 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/ProgressforIE.css" />
	<link rel="stylesheet" type="text/css" href="../css/anytimeIE.css" />
 <![endif]-->
    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>
    <script language="javascript" src="../js/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
    <script>
        $(function () {
            $('#ctl00_BodyContentPH_txt_HFromDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
            $('#ctl00_BodyContentPH_txt_HToDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
    </script>
    <script language="javascript" type="text/javascript">
        var SelectHolidayType = "Select Holiday Type";
        var FillFromDate = "Fill From Date";
        var FillToDate = "Fill To Date";
        var FillDescription = "Fill Description";
        var EnterToDate = "Enter To Date";
        var ConfirmSave = "Are you sure, to Save?";
        var MaxLength = "Maximum length is ";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetAlertMessages(selectHolidayType, fillFromDate, fillToDate, fillDescription, enterToDate, confirmSave) {
            SelectHolidayType = selectHolidayType;
            FillFromDate = fillFromDate;
            FillToDate = fillToDate;
            FillDescription = fillDescription;
            EnterToDate = enterToDate;
            ConfirmSave = confirmSave;
        }
        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:';
        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;
        }
        function DisplayLevel() {
            if (document.aspnetForm.ctl00_BodyContentPH_rbYes.checked == true) {
                document.getElementById('ctl00_BodyContentPH_divLevel').style.display = "block";
            }
            else {
                document.getElementById('ctl00_BodyContentPH_divLevel').style.display = "none";
            }
        }
        function Validation() {
            var rangeDemoFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            if (rangeDemoFormat == 'DD-MMM-YYYY') { var Earlier = "01-Jan-1900"; var Final = "31-Dec-9999"; } else { if (rangeDemoFormat == 'DD-MMM-YYYY') { var Earlier = "01-Jan-1900"; var Final = "31-Dec-9999"; } else { var Earlier = "01/01/1900"; var Final = "12/31/9999"; } }
            var rangeDemoFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            var index = document.aspnetForm.ctl00_BodyContentPH_ddl_Holidaytype.selectedIndex;
            var item = document.aspnetForm.ctl00_BodyContentPH_ddl_Holidaytype.options[index].value;
            if (item == "-Select-") {
                alert(SelectHolidayType);
                document.aspnetForm.ctl00_BodyContentPH_ddl_Holidaytype.focus();
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txt_HFromDate.value == "") {
                alert(FillFromDate);
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txt_HToDate.value == "") {
                alert(FillToDate);
                return false;
            }
            else if (trim(document.aspnetForm.ctl00_BodyContentPH_txt_HDescription.value) == "") {
                alert(FillDescription);
                return false;
            }
            else {
                if (document.aspnetForm.ctl00_BodyContentPH_txt_HFromDate.value != '') {
                    var weekDay = document.aspnetForm.ctl00_BodyContentPH_txt_HFromDate;
                    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_txt_HToDate.value != '') {
                            var weekDay = document.aspnetForm.ctl00_BodyContentPH_txt_HToDate;
                            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)) {
                                return confirm(ConfirmSave);
                            }
                            else {
                                return false;
                            }
                        }
                        else {
                            alert(EnterToDate);
                            return false
                        }
                    }
                    else {
                        return false;
                    }
                }
            }
        }
    </script>
    <script type="text/javascript" language="javascript">
        function HandleCheckbox(event) {
            var element = event.srcElement || event.target;
            if (element.tagName == "INPUT" && element.type == "checkbox") {
                var checkedState = element.checked;
                while (element.tagName != "TABLE") {
                    element = element.parentNode;
                }
                UnCheckParents(element);
                element = element.nextSibling;
                if (element == null)
                    return;
                var childTables = element.getElementsByTagName("TABLE");
                for (var tableIndex = 0; tableIndex < childTables.length; tableIndex++) {
                    CheckTable(childTables[tableIndex], checkedState);
                }
            }
        }
        function UnCheckParents(table) {
            if (table == null || table.rows[0].cells.length == 2) {
                return;
            }
            var parentTable = table.parentNode.previousSibling;
            UnCheckParents(parentTable);
        }
        function CheckTable(table, checked) {
            var checkboxIndex = table.rows[0].cells.length - 1;
            var cell = table.rows[0].cells[checkboxIndex];
            var checkboxes = cell.getElementsByTagName("INPUT");
            if (checkboxes.length == 1) {
                checkboxes[0].checked = checked;
            }
        }
    </script>
    <div class="content-header">
        <h1 style="background-image: url('../dist/img/holiday.png'); background-repeat: no-repeat; padding: 0 35px 0 35px;">
            <asp:Label ID="lbl_HeaderHolidays" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb" ShowToolTips="true">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <asp:UpdatePanel ID="upLeave" runat="server">
            <ContentTemplate>
                <asp:Panel ID="pnlProgress" runat="server" Style="display: none;">
                    <asp:Panel ID="pnlLoading" runat="server" HorizontalAlign="center">
                        <div class="InsideProgressBar">
                            <div class="row" style="margin-top: 10px">
                                <img src="../dist/img/logo-Progress.png" />
                            </div>
                            <div class="row" style="min-width: 280px">
                                <img src="../dist/img/default.gif" style="width: 100px" />
                            </div>
                            <div class="row" style="margin-bottom: 10px">
                                <asp:Label ID="lblLoading" runat="server" ForeColor="black" Style="text-align: center"
                                    Text="Please Wait..." Font-Bold="true" Font-Size="12px" Font-Italic="true" Font-Family="Arial"></asp:Label>
                            </div>
                            <div class="clear clearfix">
                            </div>
                        </div>
                    </asp:Panel>
                </asp:Panel>
                <asp:HiddenField ID="hdnProgress" runat="server" />
                <cc1:ModalPopupExtender ID="popupProgress" runat="server" TargetControlID="hdnProgress"
                    BackgroundCssClass="ModalPopup" PopupControlID="pnlProgress" BehaviorID="popupProgress">
                </cc1:ModalPopupExtender>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-6">
                    <h5 style="padding: 0 15px 0 15px; font-weight: bold">
                        <asp:Label ID="lbl_Year" runat="server"></asp:Label></h5>
                </div>
                <div class="col-sm-6">
                    <asp:HiddenField ID="Hidden1" runat="server" />
                    <div class="pull-right">
                        <h6>
                            <span style="color: Red">|</span><span style="padding-left: 10px; padding-right: 10px"><asp:Label
                                ID="lbl_IndicatesMandatoryFields" runat="server"></asp:Label>
                                (4 No.)</span>
                        </h6>
                    </div>
                </div>
                <div class="clearfix">
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        <div class="row" style="display: none">
                            <div class="col-md-12">
                                <asp:Label ID="lblCompanyWise" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-12">
                                <asp:RadioButton ID="rbYes" runat="server" GroupName="CompanyWise" onclick="DisplayLevel()" />
                                <asp:RadioButton ID="rbNo" runat="server" GroupName="CompanyWise" onclick="DisplayLevel()" />
                            </div>
                        </div>
                        <div class="row form-group">
                            <div style="overflow: scroll; height: 280px" id="divTreeview" runat="server" class="col-md-12">
                                <asp:TreeView ID="tvLevel" runat="server" NodeStyle-Font-Size="10" ShowCheckBoxes="All"
                                    ImageSet="Simple" NodeStyle-Font-Names="tahoma" ShowLines="true" NodeIndent="15"
                                    onclick="HandleCheckbox(event);">
                                </asp:TreeView>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_HolidayType" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_Holidaytype" runat="server" CssClass="form-control select2 Man-dat">
                                    <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                    <asp:ListItem Text="Global Holiday" Value="Global Holiday"></asp:ListItem>
                                    <asp:ListItem Value="Restricted Holiday" Text="Restricted Holiday"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_From" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_HFromDate" runat="server" CssClass="form-control man-dat"
                                    ondrop="return false;" oncut="return false;"></asp:TextBox>
                                <asp:CustomValidator ID="CustomValidator1" runat="server" Display="None" EnableClientScript="False"
                                    OnServerValidate="CompareCurrentdate" ValidationGroup="MasHoliday"></asp:CustomValidator>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_To" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_HToDate" runat="server" CssClass="form-control man-dat"
                                    ondrop="return false;" oncut="return false;"></asp:TextBox>
                                <asp:CustomValidator ID="cus_ComDate" runat="server" EnableClientScript="False" OnServerValidate="CompareDate"
                                    Display="None" ValidationGroup="MasHoliday"></asp:CustomValidator>
                                <asp:CustomValidator ID="CustomValidator2" runat="server" EnableClientScript="False"
                                    OnServerValidate="CompareTodate" Display="None" ValidationGroup="MasHoliday"></asp:CustomValidator>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_HolidayDescription" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_HDescription" runat="server" onkeypress="return chkMaxLen(event,this,250,MaxLength);"
                                    CssClass="form-control man-dat" MaxLength="250" TextMode="MultiLine" Style="resize: none;">
                                </asp:TextBox>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-5">
                            </div>
                            <div class="col-md-6">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="btn_modify" CssClass="btn save-btn fa-floppy-o" runat="server"
                                        ValidationGroup="MasHoliday" OnClick="btn_modify_Click" OnClientClick="javascript:return Validation();" />
                                    <asp:LinkButton ID="btn_cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                        OnClick="btn_cancel_Click" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
