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

<%@ Register Src="../UserControls/TA_uc_OrgLevelFilter_Updated.ascx" TagName="TA_uc_OrgLevel_Filter"
    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]-->
    <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 language="javascript" src="../js/DateTimeValidation.js" type="text/javascript"></script>

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

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

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

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

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

        //values for check date
        var Monthfourdigit = 'Please enter valid date as month, day, and four digit year : Format MM/dd/yyyy.';
        //Adding this line var Datefourdigit='Please enter valid date with correct format dd/MM/yyyy'; as newly
        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 ";
        var SelectShiftToBeChanged = "Select Shift To Be Changed";
        var SelectCurrentShift = "Select Current Shift";
        var EnterFromDate = "Enter From Date";
        var EnterToDate = "Enter To Date";
        var Shiftchangedshouldnotbesameastheselectedshift = "Shift to be changed should not be same as the selected shift";
        var SureToSave = "Are you sure to save?";

        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetAlertMessages(selectShiftToBeChanged, selectCurrentShift, enterFromDate, enterToDate, shiftchangedshouldnotbesameastheselectedshift, sureToSave) {
            SelectShiftToBeChanged = selectShiftToBeChanged;
            SelectCurrentShift = selectCurrentShift;
            EnterFromDate = enterFromDate;
            EnterToDate = enterToDate;
            Shiftchangedshouldnotbesameastheselectedshift = shiftchangedshouldnotbesameastheselectedshift;
            SureToSave = sureToSave;
        }
        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 ShiftValidation() {
            if (document.getElementById('ctl00_BodyContentPH_ddlShiftToBeChanged').selectedIndex == 0) {
                alert(SelectShiftToBeChanged);
                return false;
            }
            else if (document.getElementById('ctl00_BodyContentPH_hdnPreviousShiftId').value == document.getElementById('ctl00_BodyContentPH_ddlShiftToBeChanged').options[document.getElementById('ctl00_BodyContentPH_ddlShiftToBeChanged').selectedIndex].value) {
                alert(Shiftchangedshouldnotbesameastheselectedshift);
                return false;
            }
            else {
                return confirm(SureToSave);
            }
        }
        function WeekdayValidation() {
            var rangeDemoFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            if (document.getElementById('ctl00_BodyContentPH_txtFromDate').value == "") {
                alert(EnterFromDate);
                return false;
            }
            if (document.getElementById('ctl00_BodyContentPH_txtToDate').value == "") {
                alert(EnterToDate);
                return false;
            }
            if (document.getElementById('ctl00_BodyContentPH_ddlCurrentShift').selectedIndex == 0) {
                alert(SelectCurrentShift);
                return false;
            }
            var weekDay = document.aspnetForm.ctl00_BodyContentPH_txtFromDate;
            var weekDay2 = document.aspnetForm.ctl00_BodyContentPH_txtToDate;
            var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;

            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;
                }
            }
        }
    </script>

    <input type="hidden" id="hidFlag" />
    <div class="content-header">
        <h1 style="background-image: url('../dist/img/shift-realocation.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lblShiftReAllocationReport" Text="Shift Re-Allocation" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <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">
                            <img src="../dist/img/default.gif" />
                            <asp:Label ID="lblLoading" runat="server" ForeColor="black" Style="text-align: left;"
                                Font-Bold="true" Font-Size="12px" Font-Italic="true" Font-Family="Arial" Text="Please Wait..."></asp:Label>
                            <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="btnSave" />
            </Triggers>
        </asp:UpdatePanel>
        <div id="accordion">
            <div>
                <div class="inr-ftr">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="inr-fil-text pull-left">
                                <asp:Label ID="lblFilter" runat="server" Text="Filter"></asp:Label>
                                <asp:HiddenField ID="HiddenField1" runat="server" />
                            </div>
                            <div class="pull-right">
                                <h6>
                                    <span style="color: Red">|</span><span style="padding-left: 10px; padding-right: 10px">
                                        <asp:Label ID="lbl_Mandatory" runat="server" Text="Mandatory"></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" style="color: Red">
                                        <span class="fa fa-asterisk"></span>
                                        <asp:Label ID="lbl_IndicatesMandatoryFields" runat="server"></asp:Label>
                                    </div>
                                </div>
                                <div id="divEmployeeDetails" runat="server">
                                    <div class="row" style="display: none">
                                        <div class="col-md-12">
                                            <asp:HiddenField ID="Hidden1" runat="server" />
                                            <asp:HiddenField ID="Hidden2" runat="server" />
                                            <asp:HiddenField ID="hiddenTime" runat="server" Value="%I:%M:%S %p" />
                                            <asp:Label ID="lblEmpSwipe" runat="server"></asp:Label>
                                            <asp:Label ID="Label1" runat="server" ForeColor="Red" Text="*"> </asp:Label>
                                        </div>
                                        <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>
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-2">
                                            <asp:Label ID="lblEmployeeName" runat="server"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:TextBox onpaste="return true" ID="txtEmployeeName" 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="txtEmployeeName">
                                            </cc1:AutoCompleteExtender>
                                        </div>
                                        <div class="col-md-1">
                                        </div>
                                        <div class="col-md-2">
                                            <asp:Label ID="lblEmployeeId" runat="server"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:TextBox onpaste="return true" ID="txtEmployeeId" runat="server" CssClass="form-control"
                                                MaxLength="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 class="row form-group" style="display: none">
                                        <div class="col-md-12">
                                            <asp:Label ID="lblEmpCategory" runat="server"></asp:Label>
                                        </div>
                                        <div class="col-md-12">
                                            <asp:DropDownList ID="ddlEmpCatagory" runat="server" CssClass="form-control select2" AppendDataBoundItems="true">
                                                <asp:ListItem Value="0" Selected="True" Text="-Select-"></asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                        <div class="col-md-12">
                                            <asp:Label ID="lblEmpType" runat="server"></asp:Label>
                                        </div>
                                        <div class="col-md-12">
                                            <asp:DropDownList ID="ddlEmpType" runat="server" CssClass="form-control select2" AppendDataBoundItems="true">
                                                <asp:ListItem Value="0" Selected="True" Text="-Select-"></asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                </div>
                                <div class="row form-group">
                                    <div class="col-md-2">
                                        <asp:Label ID="lblTimePeriod" runat="server"></asp:Label>
                                        <asp:Label ID="Label3" runat="server" ForeColor="Red" Text="*" Style="display: none"> </asp:Label>
                                        -
                                        <asp:Label ID="lblFrom" runat="server"></asp:Label>
                                    </div>
                                    <div class="col-md-3">
                                        <asp:TextBox onpaste="return true" ID="txtFromDate" runat="server" CssClass="form-control mandatory"
                                            onCut="return false" onDrop="return false">
                                        </asp:TextBox>
                                    </div>
                                    <div class="col-md-1">
                                    </div>
                                    <div class="col-md-2">
                                        <asp:Label ID="lblTo" runat="server"></asp:Label>
                                    </div>
                                    <div class="col-md-3">
                                        <asp:TextBox onpaste="return true" ID="txtToDate" runat="server" CssClass="form-control mandatory"
                                            onCut="return false" onDrop="return false">
                                        </asp:TextBox>
                                        <asp:CustomValidator ID="cus_ComToDate" runat="server" EnableClientScript="False"
                                            OnServerValidate="CompareDate" ErrorMessage="Todate Should be greater than  Fromdate"
                                            Display="None"></asp:CustomValidator>
                                    </div>
                                </div>
                                <div class="row form-group">
                                    <div class="col-md-2">
                                        <asp:Label ID="lblCurrentShift" runat="server" Text="Current Shift"></asp:Label>
                                        <asp:Label ID="Label2" runat="server" ForeColor="Red" Text="*" Style="display: none"> </asp:Label>
                                    </div>
                                    <div class="col-md-3">
                                        <asp:DropDownList ID="ddlCurrentShift" runat="server" CssClass="form-control select2 Man-dat">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <div class="clearfix">
                                </div>
                                <div class="row">
                                    <div class="row">
                                        <div class="line16">
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-12">
                                        <asp:PlaceHolder ID="PlaceHolderDiscrepancy" runat="server">
                                            <uc1:TA_uc_OrgLevel_Filter ID="TA_uc_OrgLevel_Filter1" runat="server" />
                                        </asp:PlaceHolder>
                                    </div>
                                </div>
                                <div class="row form-group">
                                    <div class="col-md-5">
                                    </div>
                                    <div class="col-md-6">
                                        <div class="pull-right-button">
                                            <asp:LinkButton ID="btn_View" CssClass="btn save-btn fa-eye" runat="server" OnClick="btn_View_Click"
                                                OnClientClick="return WeekdayValidation()" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="divGrid" runat="server" style="display: none">
                    <div class="border-table new-space">
                        <div class="row form-group">
                            <div class="col-md-12" style="overflow: auto">
                                <div class="row form-group">
                                    <div class="col-md-12">
                                        <asp:GridView ID="grdEmployeeDetails" runat="server" AutoGenerateColumns="false"
                                            Width="100%" CssClass="table das-table1" AllowPaging="true" AllowSorting="true"
                                            PageSize="10" OnPageIndexChanging="grdEmployeeDetails_PageIndexChanging" OnSorting="grdEmployeeDetails_Sorting"
                                            HorizontalAlign="left">
                                            <Columns>
                                                <asp:TemplateField HeaderStyle-CssClass="empheader">
                                                    <HeaderTemplate>
                                                        <asp:CheckBox ID="checkall" runat="server" AutoPostBack="true" OnCheckedChanged="grv_CheckAll_CheckedChanged" />
                                                        <asp:Label ID="lblall" runat="server"></asp:Label>
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <asp:CheckBox ID="deletethis" runat="server" AutoPostBack="true" Checked='<%# (Eval("SelectedRecords").ToString() == "1" ? true : false) %>'
                                                            OnCheckedChanged="grv_Check_CheckedChanged"></asp:CheckBox>
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Center" Width="6%" />
                                                    <HeaderStyle HorizontalAlign="center" />
                                                </asp:TemplateField>
                                                <asp:TemplateField Visible="false" HeaderText="Employee Auto Id" HeaderStyle-CssClass="empheader GridColumn50">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblEmployeeAutoID" runat="server" Text='<%# Eval("EmployeeAutoID") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Employee Id" SortExpression="Employee_Code_Id" HeaderStyle-CssClass="empheader GridColumn50">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblEmployeeCodeId" runat="server" Text='<%# Eval("Employee_Code_Id") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="center" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Employee Name" SortExpression="EmpName" HeaderStyle-CssClass="empheader GridColumn50">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblEmployeeName" runat="server" Text='<%# Eval("EmpName") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="center" />
                                                </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" />
                                            <HeaderStyle HorizontalAlign="Left" ForeColor="Black" />
                                        </asp:GridView>
                                    </div>
                                </div>
                                <div class="row form-group">
                                    <div class="col-md-6">
                                        <label class="form-control">
                                            <asp:Label ID="lblPreviousShift" runat="server" Text="Selected Shift is "></asp:Label>
                                            <b>
                                                <asp:Label ID="lblPreviousShiftName" runat="server"></asp:Label></b>
                                        </label>
                                        <asp:HiddenField ID="hdnPreviousShiftId" runat="server" />
                                    </div>
                                    <div class="col-md-1">
                                    </div>
                                    <div class="col-md-5">
                                        <label class="form-control">
                                            <asp:Label ID="lblSelectedDateRange" runat="server" Text="Selected Date Range is "></asp:Label>
                                            <b>
                                                <asp:Label ID="lblSelecteddate" runat="server"></asp:Label></b>
                                        </label>
                                        <asp:HiddenField ID="hdnSelectedFromDate" runat="server" />
                                        <asp:HiddenField ID="hdnSelectedToDate" runat="server" />
                                    </div>
                                </div>
                                <div class="row form-group">
                                    <div class="col-md-3">
                                        <asp:Label ID="lblShiftToTransfer" runat="server" Text="Shift to be changed"></asp:Label>
                                        <asp:Label ID="Label4" runat="server" ForeColor="Red" Text="*" Style="display: none"> </asp:Label>
                                    </div>
                                    <div class="col-md-3">
                                        <asp:DropDownList ID="ddlShiftToBeChanged" runat="server" CssClass="form-control select2">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                    </div>
                                    <div class="col-md-6">
                                        <div class="pull-right-button">
                                            <asp:LinkButton ID="btnSave" Text="Save" CssClass="btn save-btn fa-floppy-o" runat="server"
                                                OnClientClick="if(ShiftValidation()) $find('popupProgress').show();else return false;"
                                                OnClick="btnSave_Click" />
                                            <asp:LinkButton ID="btn_Cancel" Text="Cancel" CssClass="btn save-btn fa-hand-o-left"
                                                runat="server" OnClick="btn_Cancel_Click" Visible="false" />
                                            <asp:ValidationSummary ID="ValidationSummary2" ShowMessageBox="True" ShowSummary="False"
                                                runat="server" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
