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

<%@ 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 type="text/javascript" language="javascript" src="../js/Popup.js"></script>

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

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

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

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

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

    <link href="../css/ProgressBar.css" rel="stylesheet" type="text/css" />

    <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_StartDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txt_ToDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
    </script>

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

        var SelectLeavePolicy = "Select Leave Policy";
        //values for check date added by MAnjula.P on 11-Feb-2014
        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 SetAlertMessages(selectLeavePolicy) {
            SelectLeavePolicy = selectLeavePolicy;
        }
        function Validation5() {
            var indexpolicy = document.aspnetForm.ctl00_BodyContentPH_ddl_LeavePolicy.selectedIndex;
            var Policy = document.aspnetForm.ctl00_BodyContentPH_ddl_LeavePolicy.options[indexpolicy].value;

            if (Policy == "-Select-") {
                alert(SelectLeavePolicy);
                return false;
            }
            ajaxLeavePolicyGroupPolicy();
            return false;
        }

        function addNextPolicy() {
            Validation5();
            assign_hidden_policyAddGroupPolicy();
            return false;
        }

        function Calculate_Validation() {
            var indexpolicy1 = document.aspnetForm.ctl00_BodyContentPH_ddl_LeavePolicy.selectedIndex;
            var Policy1 = document.aspnetForm.ctl00_BodyContentPH_ddl_LeavePolicy.options[indexpolicy1].value;
            if (document.getElementById("ctl00_BodyContentPH_hdf_Policy").value != "") {
                if (Policy1 == "-Select-") {
                    alert(SelectLeavePolicy);
                    return false;
                }
            }

            ajaxEmpLeaveGroupPolicy();
            return false;
        }

        function showPattern() {
            if (document.aspnetForm.ctl00_BodyContentPH_rbtnShiftPattern.checked == true) {
                document.getElementById("divShiftPattern").style.display = "block";
                document.getElementById("divShiftRoaster").style.display = "none";

            }

            if (document.aspnetForm.ctl00_BodyContentPH_rbtnShiftRoaster.checked == true) {
                document.getElementById("divShiftPattern").style.display = "none";
                document.getElementById("divShiftRoaster").style.display = "block";
            }

            return true;
        }

        function assignLeavePol() {
            var valueLeavepol = document.aspnetForm.ctl00_BodyContentPH_ddl_LeavePolicy.value;
            var indexLeavepol = document.aspnetForm.ctl00_BodyContentPH_ddl_LeavePolicy.selectedIndex;
            var LeavePolicy = document.aspnetForm.ctl00_BodyContentPH_ddl_LeavePolicy.options[indexLeavepol].text;

            document.getElementById("ctl00_BodyContentPH_hdf_PolicyID").value = valueLeavepol;
            document.getElementById("ctl00_BodyContentPH_hdf_PolicyName").value = LeavePolicy;

        }
        //Added by MAnjula.P on 11-Feb-2014
        function WeekdayValidation() {
            var weekDay = document.aspnetForm.ctl00_BodyContentPH_txt_StartDate;
            var weekDay2 = document.aspnetForm.ctl00_BodyContentPH_txt_ToDate;
            var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            if ((weekDay.value == '' && weekDay2.value != '') || (weekDay.value != '' && weekDay2.value == '')) {
                alert(FillFromandToDate);
                return false;
            }
            else {
                // Nothing
            }
            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)) {
                            return true;
                        }
                        else {
                            return false;
                        }
                    }
                }
                else {
                    return false;
                }
            }
        }
        function SaveValidation() {
            if (WeekdayValidation() == true) {
                if ($find('popupProgress') != null) {
                    $find('popupProgress').show();
                    return true;
                }
                else
                    return true;
            }
            else
                return false;
        }
    </script>

    <script type="text/javascript">
        function confApprove() {
            resp = window.confirm('Are you sure, you want to Approve this Record?');
            return resp;
        }
    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/leave-policy-add.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>
    <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>
        <Triggers>
            <asp:PostBackTrigger ControlID="btn_Save" />
        </Triggers>
    </asp:UpdatePanel>
    <div class="content">
        <div class="row" style="color: Red; display: none">
            <div class="col-md-3">
                <asp:Label ID="lblError" runat="server">
                </asp:Label>
            </div>
        </div>
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-2">
                </div>
                <div class="col-sm-2 col-sm-offset-8">
                    <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>
                                (3 No.)</span>
                        </h6>
                    </div>
                </div>
                <div class="clearfix">
                </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="700px"
                            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>
        <div class="emp-filter">
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-6">
                        <div id="actualdiv">
                            <div class="row form-group">
                                <div class="col-md-6">
                                    <asp:Label ID="lbl_SelectedEmployees" runat="server">
                                    </asp:Label>
                                </div>
                                <div class="col-md-6">
                                    <asp:LinkButton ID="btn_Add" CssClass="btn add-btn fa-plus" runat="server" data-toggle="modal"
                                        data-target="#myModal" OnClientClick="return OpenWindowGroupPolicy();" />
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-6">
                                <asp:Label ID="lbl_PolicyName1" runat="server" Text="Leave Policy">
                                </asp:Label>
                            </div>
                            <div class="col-md-6">
                                <asp:DropDownList ID="ddl_LeavePolicy" runat="server" CssClass="form-control man-dat"
                                    AppendDataBoundItems="True" onchange="return assignLeavePol()" Visible="false">
                                    <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                </asp:DropDownList>
                                <asp:Label ID="lblLeavePolicy" runat="server" Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block; min-height: 28px"
                                    CssClass="form-control  man-dat"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-6">
                                <asp:Label ID="lbl_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" 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 class="row">
                            <div class="col-md-6">
                                <div id="div_EmpLeave" runat="server" width="100%" enableviewstate="true">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-6">
                            </div>
                            <div class="col-md-6">
                                <div class="pull-right-button">
                                    <asp:HiddenField ID="Hidden1" runat="server" />
                                    <asp:HiddenField ID="PolicyExistsEmployees" runat="server" />
                                    <asp:LinkButton ID="btn_Save" CssClass="btn save-btn fa-floppy-o" runat="server"
                                        OnClick="btn_Save_Click" OnClientClick="return SaveValidation()" />
                                    <asp:LinkButton ID="btn_Cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                        CausesValidation="False" OnClick="btn_Cancel_Click" Style="display: none" />
                                    <asp:HiddenField ID="hdf_controlID" runat="server" />
                                    <asp:HiddenField ID="hdf_PolicyName" runat="server"></asp:HiddenField>
                                    <asp:HiddenField ID="hdf_Policy" runat="server"></asp:HiddenField>
                                    <asp:HiddenField ID="hdf_PolicyID" runat="server"></asp:HiddenField>
                                    <asp:HiddenField ID="hdf_PolVal" runat="server"></asp:HiddenField>
                                    <asp:HiddenField ID="hdfIsLeavePolicyType" runat="server"></asp:HiddenField>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="row form-group">
                            <div class="col-md-12">
                                <div class="table-responsive">
                                    <asp:GridView ID="grv_Employees" CssClass="table das-table1" runat="server" AutoGenerateColumns="False"
                                        AllowPaging="true" PageSize="10" OnPageIndexChanging="grv_Employees_PageIndexChanging"
                                        CellPadding="4" OnRowDeleting="grv_Employees_RowDeleting" AutoGenerateDeleteButton="True"
                                        OnRowDataBound="grv_Employees_RowDataBound">
                                        <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" ItemStyle-CssClass="table-icons">
                                                <ItemTemplate>
                                                    <itemstyle horizontalalign="Center" />
                                                    <headerstyle horizontalalign="Center" />
                                                    <asp:Label ID="lbl_EmpId" Text='<%# Eval("EmployeeId")%>' runat="server" Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Employee Name" HeaderStyle-CssClass="empheader" ItemStyle-CssClass="table-icons">
                                                <ItemTemplate>
                                                    <asp:Label ID="lbl_EmpName" Text='<%# Eval("EmployeeName")%>' runat="server" Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block; width: 150"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Date Of Joining" HeaderStyle-CssClass="empheader"
                                                ItemStyle-CssClass="table-icons">
                                                <ItemTemplate>
                                                    <asp:Label ID="lbl_EmpDateOfJoining" Text='<%# Eval("DateOfJoining", "{0:MM/dd/yyyy}") %>'
                                                        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>
            </div>
        </div>
    </div>
</asp:Content>
