<%@ page language="C#" autoeventwireup="true" inherits="Pages_MobileView_MobileDashBoard1, App_Web_aq5icn21" 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: "MobileDashBoard1.aspx/GetOrgId",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    var obj = (result.d);
                    var SchoolList = "";
                    var k = 0;
                    $.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>";
                    });
                    document.getElementById("MisDashBoard").innerHTML = SchoolList;


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

            $.ajax({
                type: "POST",
                url: "MobileDashBoard1.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("MisDashBoard").innerHTML = SchoolList;
                }
                //$("#MisDashBoard").html(result.d);

            });
        }
        function OrgIdFunction(Id) {
            window.location.href = "../MobileView/MobileDashBoard2.aspx?OrgId=" + Id;
        }
        function DashBoard() { window.location.href = "../MobileView/DashBoard.aspx"; }
    </script>
    <asp:UpdatePanel ID="DoctorScheduleUpdatePanel" runat="server">
        <ContentTemplate>
            <div class="page-header row mb37">
                <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="col-xl-6 col-sm-6 col-xs-12 border-bottom-inline">
                    <div class="main-topic db">
                        
                        <h2 class="page-title">MIS 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="MisDashBoard">

                            <%--   <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>
