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

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
       <script>

           var OrgGroupId 
           var GroupId 
           var NoOfTopStudent
           var CommonOrgGroupBatchId = 0;

           $(document).ready(function () {
               var myurl = window.location.href;
               var keyval = myurl.split('?')[1].split('&');
               OrgGroupId = parseInt(keyval[0].split('=')[1].toString());
               CommonOrgGroupBatchId = parseInt(keyval[1].split('=')[1].toString());
               GroupId = 2;
               NoOfTopStudent = 3;
               BrightStudentDataBind(OrgGroupId, GroupId, NoOfTopStudent, CommonOrgGroupBatchId);
           });

           function BrightStudentDataBind(OrgGroupId, GroupId, NoOfTopStudent, CommonOrgGroupBatchId) {
               $.ajax({
                   type: "POST",
                   url: "ConsolidateBrightStdDashBoard.aspx/BrightStudentListGet",
                   data: JSON.stringify({ "OrgGroupId": parseInt(OrgGroupId), "GroupId": parseInt(GroupId), "NoOfTopStudent": parseInt(NoOfTopStudent), "CommonOrgGroupBatchId": CommonOrgGroupBatchId }),
                   contentType: "application/json; charset=utf-8",
                   dataType: "json",
                   success: function (result) {
                       var obj = (result.d);
                       var tblBright = "";
                       var alreadyAdded = [];
                       var alreadyAdded1 = [];
                       if (obj != "") {
                           tblBright += "<tr><th>Class</th><th>Code</th><th>Name</th><th>Rank</th><th>Per %</th></tr>";

                           $.each(obj, function (j, item1) {

                               if (alreadyAdded.indexOf(item1.OrgCode) >= 0)
                               { }
                               else
                               {
                                   tblBright += "<tr><th colspan='9'>" + item1.OrgCode + "</th></tr>";
                                   $.each(obj, function (i, item) {
                                       if (item.OrgCode === item1.OrgCode) {
                                           tblBright += "<tr><td>" + item.Class + "</td><td>" + item.Code + "</td><td>" + item.Name +
                                               "</td><td>" + item.rn + "</td><td>" + item.Percentage + "</td></tr>";
                                       }
                                       else {
                                       }
                                   });
                                   alreadyAdded.push(item1.OrgCode);
                               }
                           });
                       }
                       else { tblBright += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                       document.getElementById("tblBright").innerHTML = tblBright;
                       document.getElementById("BrightHead").style.display = "block";
                   }
               });
           }

           //function GroupFunction() {
           //    GroupId = $("#drpGroup").val();
           //    BrightStudentDataBind(OrgGroupId,GroupId,NoOfTopStudent)
           //}

           function NoOfStdFunction() {
               NoOfTopStudent = $("#drpNoOfStudent").val();
               BrightStudentDataBind(OrgGroupId, GroupId, NoOfTopStudent, CommonOrgGroupBatchId);
           }

           function BackOrgFunction() { window.location.href = "../MobileView/ConsolidateDashBoard.aspx"; CurrentBatchGet(); }
           function DashBoard() { window.location.href = "../MobileView/DashBoard.aspx"; }
    </script>
    <asp:UpdatePanel ID="DoctorScheduleUpdatePanel" runat="server">
        <ContentTemplate>
            <div class="page-header row mb20">
                <div class="col-xl-12 col-sm-12 col-xs-12 border-bottom-inline padd-0">
                    <div class="col-md-12 ptb12 d-inline-flex">
                        <span class='btn btn-home btn-icon' onclick='DashBoard()' title='home'><span><i class='material-icons'>home</i></span></span>
                        <div class="d-inline-flex w-100">
                            <label class="header-topic justify-content-center" id="HeaderLabel">Consolidate DashBoard</label>
                        </div>
                        <input type="button" value="&#xf3e5;" id="bntBackOrg" onclick="BackOrgFunction()" skinid="0" class="float-right btn btn-back btn-icon fas" />
                    </div>
                    <div class="main-topic inner" id="HeaderTitle">
                    </div>
                </div>
            </div>

            <div class="bg-white row center-block">
                <div class="container-fluid">
                    <div class="gutters-tiny push js-appear-enabled animated fadeIn overflow-hidden" data-toggle="appear">
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="BrightHead" style="display: none">
                            <h3 class="table-topic">Classwise Bright Student List </h3>
                            <div class="cBoth"></div>
                            <div class="custom-select">
                                <div class='fRight pRight5'>
                                    <select id='drpNoOfStudent' onchange="NoOfStdFunction()">
                                        <option value='1'>Top 1</option>
                                        <option selected="selected" value='3'>Top 3</option>
                                        <option value='5'>Top 5</option>
                                        <option value='10'>Top 10</option>
                                    </select>
                                </div>
                                <div class="cBoth"></div>
                            </div>
                            <div class="cBoth"></div>
                            
                            <div class='himsBoxContent pTop5'>
                                <div class='table-responsive'>
                                    <br />
                                    <table id='tblBright' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
 
</asp:Content>
