<%@ page language="C#" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" autoeventwireup="true" inherits="SecurityUserProfile, App_Web_d1aqseku" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager"
    TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl"
    TagPrefix="ScreenGroup" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
        <link href="../../App_Themes/jquery-ui.css" rel="stylesheet" />
    <link href="../../App_Themes/newTheme/css/inner-db.css" rel="stylesheet" />
    <script src="../../App_Themes/newTheme/js/Chart.min.js"></script>
    <script src="../../App_Themes/newTheme/js/utils.js"></script>
    <script>
        var DepositId = 0;
        $(document).ready(function () {
            SecurityListGet();
        });

        function SecurityListGet() {
            $.ajax({
                type: "POST",
                url: "SecuritySummaryDashboard.aspx/SecurityListGet",
                // data: JSON.stringify({ "DepositId": DepositId }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    var obj = (result.d);
                    var tblSecurityList = "";
                    var SecurityGraph = "";
                    if (obj != "") {
                        var columnsIn = obj[0];
                        var newObj = {};
                        tblSecurityList += "<tr>";
                        for (var key in columnsIn) {
                            tblSecurityList += "<th>" + columnsIn[key].key + "</th>";
                        }
                        tblSecurityList += "</tr>";

                        $.each(obj, function (i, item) {

                            tblSecurityList += "<tr>";
                            for (var key in item) {
                                if (item[key] !== "null" && item[key] !== undefined && item[key] !== null) {
                                    if (item[0].value != 'NA') { tblSecurityList += "<td>" + item[key].value + "</a></td>"; }

                                }
                            }
                            tblSecurityList += "</tr>";
                        });
                    }
                    else { tblSecurityList += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    document.getElementById("tblSecurityList").innerHTML = tblSecurityList;
                    var color = ['bg-success', 'bg-danger',' bg-warning','bg-primary'];
                    $.each(obj, function (i, item) {
                        if (item[0].value != 'NA') {
                            SecurityGraph += " <div class='col-md-4 col-sm-12' > <div class='kt-box'><h3>" + item[0].value + "<span class='kt-widget15__text pull-right'>" + item[1].value + "</span></h3><div class='kt-widget15__item'>" +
                                         " <span class='kt-widget15__stats'>" + item[5].value + " % </span> <div class='kt-space-10'></div> <div class='progress kt-widget15__chart-progress--sm'> " +
                                         " <div class='progress-bar " + color [i] + "' role='progressbar' style='width: "+item[5].value+"%;' aria-valuenow='25' aria-valuemin='0' aria-valuemax='100'></div> </div>  </div> </div></div>";
                        }
                    });
                    document.getElementById("SecurityGraph").innerHTML = SecurityGraph;
                    StudentListGet();
                }
            });
        }

        function StudentListGet() {
            $.ajax({
                type: "POST",
                url: "SecuritySummaryDashboard.aspx/StudentListGet",
                // data: JSON.stringify({ "DepositId": DepositId }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    var obj = (result.d);
                    var tblStudentList = "";
                    if (obj != "") {
                        tblStudentList += "<tr><th>Class Division</th><th>Created User</th><th>Registered</th><th>Not Register</th></tr>";
                        $.each(obj, function (i, item) {
                            tblStudentList += "<tr><td>" + item[0].value + "</td><td>" + item[1].value + "</td><td>" + item[2].value + "</td><td>" + item[3].value +"</td></tr>";
                        });
                    }
                    else { tblStudentList += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    document.getElementById("tblStudentList").innerHTML = tblStudentList;
                    EmployeeListGet();
                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                }
            });
        }

        function EmployeeListGet() {
            $.ajax({
                type: "POST",
                url: "SecuritySummaryDashboard.aspx/EmployeeListGet",
                // data: JSON.stringify({ "DepositId": DepositId }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    var obj = (result.d);
                    var tblEmployeeList = "";
                    if (obj != "") {
                        tblEmployeeList += "<tr><th>Role Name</th><th>Created User</th><th>Registered</th><th>Not Registered</th></tr>";
                        $.each(obj, function (i, item) {
                            tblEmployeeList += "<tr><td>" + item[0].value + "</td><td>" + item[1].value + "</td><td>" + item[2].value + "</td><td>" + item[3].value + "</td></tr>";
                        });
                    }
                    else { tblEmployeeList += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    document.getElementById("tblEmployeeList").innerHTML = tblEmployeeList;
                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                }
            });
        }
    </script>
    <asp:UpdatePanel ID="StudentViewResultUpdatePanel" runat="server">
        <ContentTemplate>
            <div id="divContentPage" class="divcontentpagemargin">

                <div class="dashBoardLeftCont" valign="top" runat="server" id="ScreenGroup">
                    <div class="himssuHeader3WireBox">
                        <table>
                            <tr>
                                <td>
                                    <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="122"
                                        Visible="true" runat="server" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="row whiteboxpaddingleft">
                    
                    <div class="himssuHeader1WireBox card card-box">
                        <div class="himsBoxHeader card-head">
                            <div class="leftdiv">
                            </div>
                            <div class="himsBoxTitle">
                                <div class="headerText">
                                    <header>
                                        <i class="fas fa-user"></i>
                                        <asp:Label ID="UserProfileLabel" runat="server" Text="Security Dashboard"></asp:Label>
                                    </header>
                                </div>
                            </div>
                        </div>

                  <div class="himsBoxContent card-body">
                            <div class="contentHolder">
                                    
                                  <div class="col-md-12 pb15 mlr14">
                                      <div class="himsBoxHeader card-head inner">
                                            <div class="himsBoxTitle">
                                                    <div class="headerText fLeft">
                                                        <header>
                                                            <span>User List</span>
                                                        </header>
                                                    </div>
                                                </div>
                                        </div>
                                    <div class='himsBoxContent'>
                                        <div class='table-responsive'>
                                            <table id='tblSecurityList' class='table table-striped table-bordered'>
                                            </table>
                                        </div>
                                    </div>
                                </div>


                                <div class="col-md-12 p-0 kt-widget15" id="SecurityGraph"></div>
                                <div class="col-md-12 pTop15">
                                        <div class="col-md-6">
                                    <div class="mlr14">
                                        <div class="himsBoxHeader card-head inner">
                                            <div class="himsBoxTitle">
                                                    <div class="headerText fLeft">
                                                        <header>
                                                            <span>Student List</span>
                                                        </header>
                                                    </div>
                                                </div>
                                        </div>
                                        <div class='himsBoxContent'>
                                            <div class='table-responsive'>
                                                <table id='tblStudentList' class='table table-striped table-bordered'>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="mlr14">
                                          <div class="himsBoxHeader card-head inner">
                                            <div class="himsBoxTitle">
                                                    <div class="headerText fLeft">
                                                        <header>
                                                            <span>Employee List</span>
                                                        </header>
                                                    </div>
                                                </div>
                                        </div>
                                        <div class='himsBoxContent'>
                                            <div class='table-responsive'>
                                                <table id='tblEmployeeList' class='table table-striped table-bordered'>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                </div>
                            
                            </div>
                        </div>
                    </div>
                    </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/security-summary-dashboard")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
</asp:Content>
