<%@ Page Title="" Language="C#" MasterPageFile="~/MasterFile/TimeCheck.master" AutoEventWireup="true" CodeFile="TA_UI_Master_DashboardRights.aspx.cs" Inherits="Masters_TA_UI_Master_DashboardRights" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="Server">
    <!--[if gt IE 5.5]>
	<link rel="stylesheet" type="text/css" href="../css/ProgressforIE.css" />
  <![endif]-->
    <link href="../dist/css/custom.css" rel="stylesheet" type="text/css" />
    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>
    <link href="../dist/css/bootstrap-responsive-tabs.css" rel="stylesheet" type="text/css">
    <script src="../dist/js/jquery.bootstrap-responsive-tabs.min.js"></script>
    <div class="content-header">
        <h1>
            <asp:Label ID="lbl_HeaderUserGroups" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-12" style="height: 33px; padding: 7px 36px 0 36px; font-size: 15px">
                    <span>
                        <asp:Label ID="lblDashboardRights" runat="server" Text="Dashboard Rights"></asp:Label></span>
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="row">
                <div class="form-horizontal">
                    <div class="col-md-12">
                        <div class="row form-group">
                            <div class="col-sm-2">
                                <asp:Label ID="lbl_UserGroup" runat="server" Text="User Group"></asp:Label>
                            </div>
                            <div class="col-sm-3">
                                <asp:Label ID="lblGroupName" runat="server"></asp:Label>
                            </div>
                            <div class="clearfix">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblAttendanceBoard" runat="server" Text="Attendance Data"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <div style="border: 1px solid #C9E1FC; padding: 10px 10px 0 10px; overflow: auto; height: 180px">
                                    <asp:CheckBox ID="cbAttendanceAll" runat="server" Text="Select All" onclick="CheckAll('chklstAttendance','cbAttendanceAll');" Font-Size="12px"
                                        Font-Bold="true" Font-Names="tahoma" CssClass="checkbox checkbox-primary" />
                                    <asp:CheckBoxList ID="chklstAttendance" runat="server" RepeatDirection="vertical" CssClass="checkbox checkbox-primary"
                                        onclick="UnCheckAll('chklstAttendance','cbAttendanceAll');" Font-Names="tahoma" Font-Size="12px">
                                    </asp:CheckBoxList>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblApprovalBoard" runat="server" Text="Approval Data"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <div style="border: 1px solid #C9E1FC; padding: 10px 10px 0 10px; overflow: auto; height: 112px">
                                    <asp:CheckBox ID="cbApprovalAll" runat="server" Text="Select All" onclick="CheckAll('chklstApproval','cbApprovalAll');" Font-Size="12px"
                                        Font-Bold="true" Font-Names="tahoma" CssClass="checkbox checkbox-primary" />
                                    <asp:CheckBoxList ID="chklstApproval" runat="server" RepeatDirection="vertical"
                                        onclick="UnCheckAll('chklstApproval','cbApprovalAll');" CssClass="checkbox checkbox-primary"
                                        Font-Names="tahoma" Font-Size="12px">
                                    </asp:CheckBoxList>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblExceptionData" runat="server" Text="Exception Data"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <div style="border: 1px solid #C9E1FC; padding: 10px 10px 0 10px; overflow: auto; height: 180px">
                                    <asp:CheckBox ID="cbExcepAll" runat="server" Text="Select All" onclick="CheckAll('chklstException','cbExcepAll');" Font-Size="12px"
                                        Font-Bold="true" Font-Names="tahoma" CssClass="checkbox checkbox-primary" />
                                    <asp:CheckBoxList ID="chklstException" runat="server" RepeatDirection="vertical" CssClass="checkbox checkbox-primary"
                                        onclick="UnCheckAll('chklstException','cbExcepAll');" Font-Names="tahoma" Font-Size="12px">
                                    </asp:CheckBoxList>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblDisplay" runat="server" Text="Display"></asp:Label>
                            </div>
                            <div class="col-md-10 pad-left-0px">
                                <div class="col-md-2">
                                    <asp:CheckBox ID="chkbxDash" runat="server" CssClass="checkbox checkbox-primary" Checked="true" Text="Dashboard" />
                                </div>
                                <div class="col-md-2">
                                    <asp:CheckBox ID="chkbxGrid" runat="server" CssClass="checkbox checkbox-primary" Text="Gridview" />
                                </div>
                                <div class="col-md-2">
                                    <asp:CheckBox ID="chkbxChart" runat="server" CssClass="checkbox checkbox-primary" Text="Chart" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-5">
                            <div class="pull-right-button">
                                <asp:LinkButton ID="btn_save" CssClass="btn save-btn fa-floppy-o" runat="server" OnClick="btn_save_Click"
                                    OnClientClick="javascript:if(Validation()) return true; else return false;" />
                                <asp:LinkButton ID="btn_cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                    CausesValidation="False" OnClick="btn_cancel_Click" Style="margin-left: 0px" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        var Alert_Save = "Are you sure to save";
        var Selectanyonedisplayoption = "Select any one display option,Data item(s) and then click save button";
        function SetAlertMessages(alert_save, selectanyonedisplayoption) {
            Alert_Save = Alert_save;
            Selectanyonedisplayoption = selectanyonedisplayoption;
        }
        function Validation() {

            if (document.getElementById("ctl00_BodyContentPH_chkbxDash").checked == false && document.getElementById("ctl00_BodyContentPH_chkbxGrid").checked == false && document.getElementById("ctl00_BodyContentPH_chkbxChart").checked == false) {
                alert(Selectanyonedisplayoption);
                return false;
            }
            return confirm(Alert_Save);
        }


        // Handle tree view click
        function HandleCheckbox(event) {
            var element = event.srcElement || event.target;
            if (element.tagName == "INPUT" && element.type == "checkbox") {
                var checkedState = element.checked;
                while (element.tagName != "TABLE") // Get wrapping table
                {
                    //element = element.parentElement;
                    element = element.parentNode;
                }

                UnCheckParents(element); // Uncheck all parents

                element = element.nextSibling;

                if (element == null) // If no childrens than exit
                    return;

                var childTables = element.getElementsByTagName("TABLE");

                for (var tableIndex = 0; tableIndex < childTables.length; tableIndex++) {
                    CheckTable(childTables[tableIndex], checkedState);
                }
            }
        }
        function postBackByObject() {
            var o = window.event.srcElement;
            if (o.tagName == "INPUT" && o.type == "checkbox") {
                __doPostBack("", "");
            }
        }
        function UnCheckParents(table) {
            if (table == null || table.rows[0].cells.length == 2) // This is the root
            {
                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;
            }
        }
        function CheckAll(controlID, cbAttendanceAll) {
            var intIndex = 0;
            var rowCount = document.getElementById('ctl00_BodyContentPH_' + controlID).getElementsByTagName("input").length;
            for (i = 0; i < rowCount; i++) {
                if (document.getElementById('ctl00_BodyContentPH_' + cbAttendanceAll).checked == true) {
                    if (document.getElementById('ctl00_BodyContentPH_' + controlID + "_" + i)) {
                        if (document.getElementById('ctl00_BodyContentPH_' + controlID + "_" + i).disabled != true)
                            document.getElementById('ctl00_BodyContentPH_' + controlID + "_" + i).checked = true;
                    }
                }
                else {
                    if (document.getElementById('ctl00_BodyContentPH_' + controlID + "_" + i)) {

                        if (document.getElementById('ctl00_BodyContentPH_' + controlID + "_" + i).disabled != true)
                            document.getElementById('ctl00_BodyContentPH_' + controlID + "_" + i).checked = false;
                    }
                }
            }
        }
        function UnCheckAll(controlID, cbAttendanceAll) {
            var intIndex = 0;
            var flag = 0;
            var rowCount = document.getElementById('ctl00_BodyContentPH_' + controlID).getElementsByTagName("input").length;
            for (i = 0; i < rowCount; i++) {
                if (document.getElementById('ctl00_BodyContentPH_' + controlID + "_" + i)) {
                    if (document.getElementById('ctl00_BodyContentPH_' + controlID + "_" + i).checked == true) {
                        flag = 1;
                    }
                    else {
                        flag = 0;
                        break;
                    }
                }
            }
            if (flag == 0)
                document.getElementById('ctl00_BodyContentPH_' + cbAttendanceAll).checked = false;
            else
                document.getElementById('ctl00_BodyContentPH_' + cbAttendanceAll).checked = true;
        }

    </script>
</asp:Content>


