<%@ page language="C#" autoeventwireup="true" maintainscrollpositiononpostback="true" inherits="Transactions_PopUp_ManualGroupEntry, App_Web_c55clzp2" %>

<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web"
    TagPrefix="devxEditors" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="X-UA-Compatible" content="IE=document.documentMode;" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=document.documentMode;" />
    <title>TimeCheck</title>
    <link rel="stylesheet" type="text/css" href="../css/anytime.css" />
    <link href="../css/stylesheet.css" rel="stylesheet" />
    <link href="../css/Calender.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="../css/jquery.autocomplete.css" type="text/css" />
    <link rel="stylesheet" href="../css/fancydropdown.css" type="text/css" />
    <link href="../css/ProgressBar.css" rel="stylesheet" type="text/css" />
</head>
<body runat="server">

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

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

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

    <script language="javascript" src="../js/calendar-setup.js" type="text/javascript"></script>

    <script language="javascript" src="../js/calendar-en.js" type="text/javascript"></script>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    <script language="javascript" src="../js/jquery-1.7.2.js" type="text/javascript"></script>

    <script language="javascript" src="../js/jquery-1.2.min.js" type="text/javascript"></script>

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

    <script language="javascript" src="../js/jquery.ui.widget.js" type="text/javascript"></script>

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

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

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

    <script language="javascript" type="text/jscript">
   //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 EnterToDate='Enter To Date';
var EnterFromDate='Enter From Date';
var MaxLength='Maximum length is';
var ShiftDate="Select Shift Date";
function SetAlertMessages(shiftDate)
{
ShiftDate=shiftDate; 
}

function MaxLen(maxLength)
{
MaxLength = maxLength;  
}


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 CheckDateEntry()
    { 
            if(document.getElementById('txt_Date').value!='')
            {
               var weekDay=document.getElementById('txt_Date');
               var DateFormat = document.getElementById('Hidden1').value;              
               if(checkDate(weekDay,DateFormat,Monthfourdigit,Datefourdigit,Invalidyearentry,Invalidmonthentry,Invaliddateentry,DateformatDDMONYYYY,Entertime,Valueforhours,Invalidvalueforminutes,Invalidtimeformat,EntervalidDateandTime,ValiddatemonthMMDDYYHHMM,ValiddatemonthMMDDYYHHMMTT,EntervalidDateandTime,Invalidvalueforhours,Invalidvalueforminites))
               {                  
               }
               else
               {
                 return false;
               }
            }
            else
            {            
                 alert(ShiftDate);
                 return false;
            } 
    }
    function ValidateGo()
    {
        return CheckDateEntry();   
    }
    function SelectAllOnThisPage(chkSelectAll)
    {      
        var hdnSelectRowGroup=document.getElementById('<%= hdnSelectRowGroup.ClientID %>' );
        var hdnGetAllidGroup=document.getElementById('<%= hdnGetAllidGroup.ClientID %>' );        
        if(chkSelectAll.checked == true)
        {
            for(var i=0;i< grv_Shift.pageRowCount;i++)
            {
                if(document.getElementById('grv_Shift_cell' + (i + grv_Shift.visibleStartIndex) + '_0_chkSelect').disabled==false)
                {
                    document.getElementById('grv_Shift_cell' + (i + grv_Shift.visibleStartIndex) + '_0_chkSelect').checked=true;
                    var hdnUserId = document.getElementById('grv_Shift_cell' + (i + grv_Shift.visibleStartIndex) + '_0_chkSelect').accessKey;
                    selectId(document.getElementById('grv_Shift_cell' + (i + grv_Shift.visibleStartIndex) + '_0_chkSelect'));
                    var hdnSelectRowGroup = document.getElementById('<%= hdnSelectRowGroup.ClientID %>');
                    var removeId = hdnSelectRowGroup.value.split(",");
                    if (hdnUserId != ""  ) 
//                    && !Array.contains(removeId, hdnUserId)
                    {
                        if (hdnSelectRowGroup.value != "")
                            hdnSelectRowGroup.value += ",";
                            hdnSelectRowGroup.value += hdnUserId;
                    }                    
                }
            }            
        }
        else
        {
            for(var i=0;i< grv_Shift.pageRowCount;i++)
            {
                document.getElementById('grv_Shift_cell' + (i + grv_Shift.visibleStartIndex) + '_0_chkSelect').checked=false;
            }
            hdnSelectRowGroup.value='';
        }
    }
    function SelectOnRow(chkOnSelect)
    {
        var hdnUserId = chkOnSelect.accessKey;
        var hdnSelectRowGroup = document.getElementById('<%= hdnSelectRowGroup.ClientID %>');
        var removeId = hdnSelectRowGroup.value.split(",");
        if (chkOnSelect.checked) {
            if (hdnUserId != "" ) {
                if (hdnSelectRowGroup.value != "")
                    hdnSelectRowGroup.value += ",";
                hdnSelectRowGroup.value += hdnUserId;
            }
            var varTotalCheckedCount = 0;
            for (var i = 0; i < grv_Shift.pageRowCount; i++) {
                if (document.getElementById('grv_Shift_cell' + (i + grv_Shift.visibleStartIndex) + '_0_chkSelect').checked)
                    varTotalCheckedCount = varTotalCheckedCount + 1;
                else
                    break;
            }
            if (varTotalCheckedCount == grv_Shift.pageRowCount)
                document.getElementById('grv_Shift_header0_chkSelectAll').checked = true;
            else
                document.getElementById('grv_Shift_header0_chkSelectAll').checked = false;
        }
        else 
        {
            hdnSelectRowGroup.value = removeId;
            document.getElementById('grv_Shift_header0_chkSelectAll').checked = false;
        }
        selectId(chkOnSelect);
    }   
    function selectId(chkOnSelect)
    {
    var hdnId = document.getElementById('<%= hdnId.ClientID %>').value;
    var EmployeeId =chkOnSelect.accessKey;
    if(chkOnSelect.checked)
    {
        if(hdnId!="")
        {
        hdnId=hdnId+","+ EmployeeId;
        }
        else
        {
        hdnId= EmployeeId;
        }
    }
    else
    {
        if(hdnId!="")
        {
         hdnId=hdnId.replace(","+EmployeeId,"");
        }
        else
        {
         hdnId=hdnId.replace(EmployeeId,"");
        }
    }    
    document.getElementById('<%= hdnId.ClientID %>').value=hdnId;
    }
    </script>

    <form id="form1" runat="server">
        <asp:HiddenField ID="Hidden1" runat="server" />
        <div id="Div1" runat="server" style="overflow: auto;">
            <table cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td class="td" style="height: 54px">
                        <asp:Label ID="lblShift" runat="server"></asp:Label>
                        <font color="#ff0000">*</font>
                    </td>
                    <td class="td" style="height: 54px">
                        <asp:DropDownList ID="ddlShift" runat="server" CssClass="dlist">
                        </asp:DropDownList>
                    </td>
                    <td class="td" style="height: 54px">
                        <asp:Label ID="lblDate" runat="server"></asp:Label>
                        <font color="#ff0000">*</font>
                    </td>
                    <td class="td" width="310px" style="height: 54px">
                        <table cellpadding="3" cellspacing="1">
                            <tr>
                                <td>
                                    <asp:TextBox onpaste="return true" ID="txt_Date" runat="server" CssClass="textbox_4">
                                    </asp:TextBox>
                                </td>
                            </tr>
                        </table>
                        <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="txt_Date"
                            Display="None" EnableClientScript="False" OnServerValidate="CheckDate" SetFocusOnError="True"
                            Font-Bold="False" Width="252px"></asp:CustomValidator></td>
                </tr>

             

                <tr>
                    <td align="right" class="td" colspan="4">
                        <div align="left">
                            <asp:Label ID="lblError" Visible="true" runat="server" Style="color: #ff0000"></asp:Label>
                        </div>
                        &nbsp;
                        <asp:Button ID="butGo" CssClass="but" runat="server" CausesValidation="False" OnClientClick="return ValidateGo()"
                            OnClick="butGo_Click" />
                    </td>
                </tr>
            </table>
        </div>
        <div id="Div2" runat="server">
            <asp:HiddenField ID="hdnSelectRowGroup" runat="server" />
            <asp:HiddenField ID="hdnGetAllidGroup" runat="server" />
            <asp:HiddenField ID="hdnId" runat="server" />
            <table cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td class="td1">
                        <dxGridview:ASPxGridView CssClass="td" ID="grv_Shift" Width="100%" runat="server"
                            EnableCallBacks="false" AutoGenerateColumns="False" ClientInstanceName="grv_Shift"
                            KeyFieldName="Employee_Id">
                            <Columns>
                                <dxGridview:GridViewDataColumn VisibleIndex="0" Width="34px" HeaderStyle-VerticalAlign="Middle"
                                    HeaderStyle-HorizontalAlign="Center" CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center">
                                    <Settings AllowAutoFilter="false" />
                                    <HeaderTemplate>
                                        <input id="chkSelectAll" runat="server" type="checkbox" onclick="SelectAllOnThisPage(this)" />
                                    </HeaderTemplate>
                                    <DataItemTemplate>
                                        <input id="chkSelect" runat="server" type="checkbox" onclick="SelectOnRow(this)"
                                            accesskey='<%# Eval("Employee_Id") %>' />
                                    </DataItemTemplate>
                                     <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataColumn>
                                <dxGridview:GridViewDataTextColumn FieldName="Employee_Code_Id" VisibleIndex="2">
                                    <Settings AllowDragDrop="False" />
                                    <DataItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Employee_Code_Id") %>'></asp:Label>
                                    </DataItemTemplate>
                                     <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataTextColumn>
                                <dxGridview:GridViewDataTextColumn FieldName="Employee Name" VisibleIndex="2">
                                    <Settings AllowDragDrop="False" />
                                    <DataItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Employee Name") %>'></asp:Label>
                                    </DataItemTemplate>
                                     <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataTextColumn>
                            </Columns>
                            <Settings ShowGroupFooter="VisibleAlways" />
                            <SettingsPager PageSize="10">
                            </SettingsPager>
                            <SettingsText EmptyDataRow="No Records Found" />
                            <Settings ShowVerticalScrollBar="false" VerticalScrollableHeight="200" ShowFilterRow="true" />
                            <SettingsBehavior SortMode="Value" AllowSort="true" AllowDragDrop="true" />
                        </dxGridview:ASPxGridView>
                    </td>
                </tr>
            </table>
        </div>
        <div align="center">
            <asp:Button ID="btn_done1" CssClass="but" runat="server" OnClick="btn_done1_Click" />
        </div>
    </form>
</body>
</html>
