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

<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" Runat="Server">
     <script type="text/javascript">
         function Delete_Conf() {
             //Alert_AreyousuretoDelete
             return confirm('Are you sure to Delete ?');
         }
         function navi(loc) {
             document.getElementById('ctl00_BodyContentPH_iframePopup').src = loc;
             return false;
         }
         function OnInit(s, e) {
             AdjustSize();
         }
         function OnEndCallback(s, e) {
             AdjustSize();
         }
         function AdjustSize() {
             var height = Math.max(0, document.documentElement.clientHeight);
             var width = Math.max(0, document.documentElement.clientWidth);
             grid.SetHeight(height);
         }
         function Delete_Conf() {
             //Alert_AreyousuretoDelete
             return confirm('Are you sure to Delete ?');
         }
         function SelectAllOnThisPage(chkSelectAll) {
             var hdnSelectRow = document.getElementById('<%= hdnSelectRow.ClientID %>');
            var hdnSelectAll = document.getElementById('<%= hdnGetAllid.ClientID %>');
            if (chkSelectAll.checked == true) {
                for (var i = 0; i < grvPayRollTeam.pageRowCount; i++) {
                    if (document.getElementById('ctl00_BodyContentPH_grvPayRollTeam_cell' + (i + grvPayRollTeam.visibleStartIndex) + '_0_chkSelect').disabled == false) {
                        document.getElementById('ctl00_BodyContentPH_grvPayRollTeam_cell' + (i + grvPayRollTeam.visibleStartIndex) + '_0_chkSelect').checked = true;
                        var hdnUserId = document.getElementById('ctl00_BodyContentPH_grvPayRollTeam_cell' + (i + grvPayRollTeam.visibleStartIndex) + '_0_chkSelect').accessKey;
                        var hdnSelectRow = document.getElementById('<%= hdnSelectRow.ClientID %>');
                        var removeId = hdnSelectRow.value.split(",");
                        if (hdnUserId != "" && !Array.contains(removeId, hdnUserId)) {
                            if (hdnSelectRow.value != "")
                                hdnSelectRow.value += ",";
                            hdnSelectRow.value += hdnUserId;
                        }
                    }
                }
            }
            else {
                for (var i = 0; i < grvPayRollTeam.pageRowCount; i++) {
                    document.getElementById('ctl00_BodyContentPH_grvPayRollTeam_cell' + (i + grvPayRollTeam.visibleStartIndex) + '_0_chkSelect').checked = false;
                }
                hdnSelectRow.value = '';
            }
        }
        function SelectOnRow(chkOnSelect) {
            var hdnUserId = chkOnSelect.accessKey;
            var hdnSelectRow = document.getElementById('<%= hdnSelectRow.ClientID %>');
            var removeId = hdnSelectRow.value.split(",");
            if (chkOnSelect.checked) {
                if (hdnUserId != "" && !Array.contains(removeId, hdnUserId)) {
                    if (hdnSelectRow.value != "")
                        hdnSelectRow.value += ",";
                    hdnSelectRow.value += hdnUserId;
                }
                var varTotalCheckedCount = 0;
                var varTotalEnabled = 0;
                for (var i = 0; i < grvPayRollTeam.pageRowCount; i++) {
                    if (document.getElementById('ctl00_BodyContentPH_grvPayRollTeam_cell' + (i + grvPayRollTeam.visibleStartIndex) + '_0_chkSelect').disabled == false) {
                        varTotalEnabled = varTotalEnabled + 1;
                    }
                    if (document.getElementById('ctl00_BodyContentPH_grvPayRollTeam_cell' + (i + grvPayRollTeam.visibleStartIndex) + '_0_chkSelect').checked)
                        varTotalCheckedCount = varTotalCheckedCount + 1;
                }
                if (varTotalCheckedCount == varTotalEnabled)
                    document.getElementById('ctl00_BodyContentPH_grvPayRollTeam_header0_chkSelectAll').checked = true;
                else
                    document.getElementById('ctl00_BodyContentPH_grvPayRollTeam_header0_chkSelectAll').checked = false;
            }
            else {
                if (Array.contains(removeId, hdnUserId)) {
                    Array.remove(removeId, hdnUserId);
                }
                hdnSelectRow.value = removeId;
                document.getElementById('ctl00_BodyContentPH_grvPayRollTeam_header0_chkSelectAll').checked = false;
            }
        }

    </script>
      <div class="content-header">
        <h1 style="background-image: url('../dist/img/category.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_EmployeeCategory" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div id="myModal" class="modal modal-default fade" role="dialog">
            <div class="modal-dialog" style="min-width: 85%;">
                <div class="modal-content" style="margin-top: 100px">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title">
                            <asp:Label ID="lblDataView" runat="server" Text="Data View"></asp:Label>
                        </h4>
                    </div>
                    <div class="modal-body">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="170px"
                            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="form-horizontal">
            <div class="border-table new-space" style="margin-top: 0px">
                <div class="row form-group">
                    <div class="col-md-12" style="overflow: auto; overflow-y: hidden; padding-bottom: 10px">
                        <asp:HiddenField ID="hdnSelectRow" runat="server" />
                        <asp:HiddenField ID="hdnGetAllid" runat="server" />
                        <dxGridview:ASPxGridView ID="grvPayRollTeam" runat="server" ClientInstanceName="grvPayRollTeam"
                            EnableCallBacks="false" AutoGenerateColumns="false" KeyFieldName="AutoID"
                            OnHtmlRowCreated="grvPayRollTeam_HtmlRowCreated">
                            <Templates>
                                <TitlePanel>
                                    Payroll Team Master
                                </TitlePanel>
                            </Templates>
                            <Columns>
                                <dxGridview:GridViewDataColumn VisibleIndex="0" Width="30px" 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("AutoID") %>' />
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                </dxGridview:GridViewDataColumn>
                                <dxGridview:GridViewDataTextColumn FieldName="AutoID" VisibleIndex="1" Visible="false">
                                    <DataItemTemplate>
                                        <asp:Label ID="lblAutoID" runat="server" Text='<%# Eval("AutoID") %>'></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataTextColumn>
                                <dxGridview:GridViewDataTextColumn Caption="Level" FieldName="LevelDetails" Width="250px" VisibleIndex="1">
                                    <DataItemTemplate>
                                        <asp:Label ID="Label1" Text='<%# Eval("LevelDetails") %>' runat="server" CssClass="dxlabel"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataTextColumn>
                                <dxGridview:GridViewDataTextColumn Caption="Employee ID and Name " FieldName="EmployeeName" Width="200px" VisibleIndex="2">
                                    <DataItemTemplate>
                                        <asp:Label ID="Label1" Text='<%# Eval("EmployeeName") %>' runat="server" CssClass="dxlabel"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataTextColumn>
                                <dxGridview:GridViewDataTextColumn Caption="Email ID" FieldName="EmailId" Width="150px" VisibleIndex="3">
                                    <DataItemTemplate>
                                        <asp:Label ID="Label1" Text='<%# Eval("EmailId") %>' runat="server" CssClass="dxlabel"></asp:Label>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataTextColumn>

                                <dxGridview:GridViewDataColumn HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center"
                                    CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center" Width="40px" VisibleIndex="3">
                                    <Settings AllowAutoFilter="false" />
                                    <DataItemTemplate>
                                        <a data-toggle="modal" title='<%# Session["View"] %>' data-placement="top" data-target="#myModal" onclick="return navi('TA_UI_Master_Payroll_Team_View.aspx?PAYROLLID=<%# Eval("AutoID") %>')"
                                            href="#"><span class="btn btn-defalut view-icons"></span></a>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataColumn>

                                <dxGridview:GridViewDataColumn HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center"
                                    CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center" Width="30px" VisibleIndex="3">
                                    <Settings AllowAutoFilter="false" />
                                    <DataItemTemplate>
                                        <asp:LinkButton ID="btnEdit" runat="server" ToolTip='<%# Session["Edit"] %>' data-toggle="tooltip"
                                            OnClick="btnEdit_Click" CommandName='<%# Eval("AutoID") %>' data-placement="top"
                                            CssClass="btn btn-defalut edit-icons" Style="color: #3C8DBC"></asp:LinkButton>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataColumn>
                                <dxGridview:GridViewDataColumn HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center"
                                    CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center" Width="30px" VisibleIndex="4">
                                    <Settings AllowAutoFilter="false" />
                                    <DataItemTemplate>
                                        <asp:LinkButton ID="btnDelete" runat="server" ToolTip='<%# Session["Delete"] %>' data-toggle="tooltip"
                                            OnClick="btnDelete_Click" CommandName='<%# Eval("AutoID") %>' data-placement="top"
                                            CssClass="btn btn-defalut del-icons" Style="color: Red" OnClientClick="return Delete_Conf();"></asp:LinkButton>
                                    </DataItemTemplate>
                                    <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                </dxGridview:GridViewDataColumn>

                            </Columns>
                            <Styles AlternatingRow-CssClass="table-bg">
                            </Styles>
                            <SettingsText EmptyDataRow="No Records Found" />
                            <SettingsPager PageSize="10">
                                <PageSizeItemSettings Visible="true" ShowAllItem="true" Items="10,20,50" />
                            </SettingsPager>
                            <Settings ShowFilterRow="true" ShowFilterRowMenu="true" ShowStatusBar="Auto" VerticalScrollableHeight="320" />

                            <SettingsBehavior SortMode="Value" AllowSort="true" AllowDragDrop="true" />
                            <Styles AlternatingRow-CssClass="table-bg">
                            </Styles>
                        </dxGridview:ASPxGridView>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="pull-right-button">
                             <asp:LinkButton ID="btn_add" runat="server" Text="Add" CssClass="btn add-btn fa-plus"
                                OnClick="btn_add_Click" />
                             <asp:LinkButton ID="btn_Delete" runat="server" CausesValidation="False" CssClass="btn save-btn fa-trash-o"
                                OnClick="btn_Delete_Click" OnClientClick="return confirmdelete(this.form);" Text="Delete" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>

