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

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <script type="text/javascript">
        var Id = 0;
        $(document).ready(function () {

            var myurl = window.location.href;

            if (myurl != "") {
                var spliturl = myurl.split('?');

                if (spliturl.length > 1) {
                    var keyval = myurl.split('?')[1].split('&');
                    Id = parseInt(keyval[0].split('=')[1].toString());
                }
            }
            else { GetOrgId(); }

            if (Id != 0) {
                GetOrgData()
            }
            else { GetOrgId(); }
            // alert(Id);


        });
        function GetOrgId() {

            $.ajax({
                type: "POST",
                url: "AssessmentDashboard.aspx/GetOrgId",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    var obj = (result.d);
                    var SchoolList = "";
                    var k = 0;
                    if (obj != "") {
                        $.each(obj, function (i, item) {
                            if (k >= 8) { k = 0; }
                            k++;
                            console.log(item.DisplayTitle);
                            SchoolList += "<div class='col-xs-12 col-sm-6 col-md-4 col-xl-3 mt-43'><a  onclick='OrgIdFunction(" + item.Id + ")' class='block text-center bg-image' style='background-image:url(../../App_Themes/mis_db/images/" + k + ".jpeg);'>" +
                            "<div class='block-content block-content-full bg-gd-fruit-op aspect-ratio-16-9 d-flex justify-content-center align-items-center'><div> <i class='fas fa-2x fa-school text-white'></i> " +
                            "<div class='font-w600 mt-3 text-uppercase text-white'>" + item.DisplayTitle + "</div></div></div></a></div>";
                        });
                    }
                    else {
                        SchoolList += "<div class='col-xs-12 col-sm-6 col-md-4 col-xl-3 mt-43'>" +
                              "<div class='block-content block-content-full bg-gd-fruit-op aspect-ratio-16-9 d-flex justify-content-center align-items-center'><div>" +
                              "<div class='font-w600 mt-3 text-uppercase text-white'><label>No records found..!!</label> </div></div></div></div>";
                    }
                    document.getElementById("AssessmentDashboard").innerHTML = SchoolList;


                    //$("#MisDashBoard").html(result.d);
                }
            });
        }
        function GetOrgData() {

            $.ajax({
                type: "POST",
                url: "AssessmentDashboard.aspx/GetOrgData",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify({ "Id": Id }),
                dataType: "json",
                success: function (result) {
                    var obj = (result.d);
                    var SchoolList = "";
                    var k = 0;
                    if (obj != "") {
                        $.each(obj, function (i, item) {
                            if (k >= 8) { k = 0; }
                            k++;
                            console.log(item.DisplayTitle);
                            SchoolList += "<div class='col-xs-12 col-sm-6 col-md-4 col-xl-3 mt-43'><a  onclick='OrgIdFunction(" + item.Id + ")' class='block text-center bg-image' style='background-image:url(../../App_Themes/mis_db/images/" + k + ".jpeg);'>" +
                            "<div class='block-content block-content-full bg-gd-fruit-op aspect-ratio-16-9 d-flex justify-content-center align-items-center'><div> <i class='fas fa-2x fa-school text-white'></i> " +
                            "<div class='font-w600 mt-3 text-uppercase text-white'>" + item.DisplayTitle + "</div></div></div></a></div>";
                        });

                    }
                    else {
                        SchoolList += "<div class='col-xs-12 col-sm-6 col-md-4 col-xl-3 mt-43'>" +
                              "<div class='block-content block-content-full bg-gd-fruit-op aspect-ratio-16-9 d-flex justify-content-center align-items-center'><div>" +
                              "<div class='font-w600 mt-3 text-uppercase text-white'><label>No records found..!!</label> </div></div></div></div>";
                    }
                    document.getElementById("AssessmentDashboard").innerHTML = SchoolList;
                }
                //$("#MisDashBoard").html(result.d);

            });
        }
        function OrgIdFunction(Id) {
            window.location.href = "../MobileView/AssessmentDetailDashboard.aspx?OrgId=" + Id;
        }
        function DashBoard() { window.location.href = "../MobileView/Dashboard.aspx"; }
    </script>
    <asp:UpdatePanel ID="DoctorScheduleUpdatePanel" runat="server">
        <ContentTemplate>
            <div class="col-md-12 ptb12">
                <span class="btn btn-home btn-icon" onclick="DashBoard()" title="home">
                    <span>
                        <i class="material-icons">home</i>
                    </span>
                </span>
            </div>
            <div class="page-header row mb37">
                <div class="col-xl-6 col-sm-6 col-xs-12 border-bottom-inline">
                    <div class="main-topic db">
                        <h2 class="page-title">Assessment Dashboard</h2>
                    </div>
                </div>
            </div>
            <div class="bg-body-dark row center-block">
                <div class="container-fluid">
                    <div class="gutters-tiny push js-appear-enabled animated fadeIn" data-toggle="appear">
                        <div class="tab row" id="AssessmentDashboard">

                            <%--   <div class="col-xs-12 col-sm-6 col-md-4 col-xl-3 mt-43" id="SchoolList">
                               <a class="block text-center bg-image">
                                    <div class="block-content block-content-full bg-gd-fruit-op aspect-ratio-16-9 d-flex justify-content-center align-items-center">
                                        <div >
                                            <%--<i class="fas fa-2x fa-school text-white"></i>
                                            <asp:PlaceHolder ID="DataPlaceHolder" runat="server" />
                                            <div class="font-w600 mt-3 text-uppercase text-white">School Name 1</div>
                                        </div>
                                    </div>
                                </a>
                            </div>--%>
                        </div>
                        <%--  <div class="himssuHeader1WireBox col-md-12 pTop5"  id='tblError'>
                                      <%--  <%--<h3 class="table-topic">User Role</h3>
                                       <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> 
                                        <div class='himsBoxContent'><div class='table-responsive'>
                                             <table id='tblError' class='table table-striped table-bordered'>
                                            </table>
                                            </div></div>
                                 
                                    </div>--%>
                    </div>
                </div>
            </div>

            <script>
                function openNav() {
                    document.getElementById("mySidenav").style.width = "344px";
                }

                function closeNav() {
                    document.getElementById("mySidenav").style.width = "0";
                }
            </script>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
