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

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel runat="server" ID="DoctorScheduleUpdatePanel">
        <ContentTemplate>

            <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>
                <label class="header-topic justify-content-center" id="HeaderLabel"></label>
                <input type="button" value="&#xf3e5;" id="bntBackOrg" onclick="BackOrgFunction()" skinid="0" class="float-right btn btn-back btn-icon fas" />
            </div>
            <div class="top-btn col-md-12">
                <div class="custom-select">
                    <div class='fLeft pRight5'>
                        <select id="drpOrganization" onchange="OrganizationFunction()">
                            <option value='0'>Select</option>
                        </select>
                    </div>
                </div>
                <div class="custom-select width-17">
                    <div class='fLeft pRight5'>
                        <select id='drpExam' onchange="ExamFunction()">
                            <option selected="selected" value='0'>Select</option>
                        </select>
                    </div>
                </div>
                <div class="custom-select width-17">
                    <div class='fLeft pRight5'>
                        <select id='drpBatch' onchange="BatchFunction()">
                            <option selected="selected" value='0'>Select</option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="page-header mb37">
                <div class="col-xl-12 col-sm-12 col-xs-12 border-bottom-inline xs-padd0">
                    <div class="main-topic inner" id="HeaderTitle">
                    </div>
                    <div class="misAss">
                        <button id="btnAss" class="btn bg-white-outline btn-icon exdb" onclick="AssDashboar()" style="display: none"><i class="ti-dashboard"></i>&nbsp;Assessment</button>
                    </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">
                            <div class="block row arrow-up">
                                <div class="col-xl-3 col-sm-6 col-xs-12 " id="PassFailStdAnalysisDiv" style="display: none">
                                    <div class="card pull-up">
                                        <div class="card-body">
                                            <a onclick="PassFailStudentFunction()">
                                                <h5 class="card-title text-capitalize">Pass/Fail Student Analysis <i class="ti-arrow-right text-anchor float-right"></i></h5>
                                                <div class="tab-content">
                                                    <div class="tab-pane active">
                                                        <div class="d-flex align-items-center no-block m-t-51">
                                                            <h1 class="pl8"><i class="fas fa-chart-bar text-info"></i></h1>
                                                            <div class="result-margin">
                                                                <span class="d-flex" style="color: green; font-size: 12pt">Pass Student Count :&nbsp;<h4 id="TotalPassStudent"></h4>
                                                                </span>
                                                                <span class="d-flex" style="color: red; font-size: 12pt">Fail Student Count :&nbsp;<h4 id="TotalFailStudent"></h4>
                                                                </span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </a>
                                        </div>
                                        <div class="se-pre-con" id="LoaderDiv1" style="display: none"></div>
                                    </div>
                                </div>
                                <div class="col-xl-3 col-sm-6 col-xs-12 " id="TotalPercentageAnalysisDiv" style="display: none">
                                    <div class="card  pull-up">
                                        <div class="card-body">
                                            <a onclick="TotalPercentageAnalysis()">
                                                <h5 class="card-title text-capitalize">Total Percentage Analysis <i class="ti-arrow-right text-anchor float-right"></i></h5>
                                                <div class="tab-content">
                                                    <div class="tab-pane active">
                                                        <div class="d-flex align-items-center no-block m-t-51">
                                                            <h1 class="pl8"><i class='fas fa-percent text-orange'></i></h1>
                                                            <%--<div class="result-margin">
                                                                <h1 id="SubWiseStdPassFailAnalysis"></h1>
                                                            </div>--%>
                                                        </div>
                                                    </div>
                                                </div>
                                            </a>
                                        </div>
                                        <div class="se-pre-con" id="LoaderDiv2" style="display: none"></div>
                                    </div>
                                </div>
                                <div class="col-xl-3 col-sm-6 col-xs-12 " id="SubWisePercAnalysisDiv" style="display: none">
                                    <div class="card  pull-up">
                                        <div class="card-body">
                                            <a onclick="SubWisePercAnalysis()">
                                                <h5 class="card-title text-capitalize">Subject Wise Percentage Analysis <i class="ti-arrow-right text-anchor float-right"></i></h5>
                                                <div class="tab-content">
                                                    <div class="tab-pane active">
                                                        <div class="d-flex align-items-center no-block m-t-51">
                                                            <h1 class="pl8"><i class="fas fa-book text-success"></i></h1>
                                                            <%-- <div class="result-margin">
                                                                <h1 id="StudentNo1"></h1>
                                                              </div>--%>
                                                        </div>
                                                    </div>
                                                </div>
                                            </a>
                                        </div>
                                        <div class="se-pre-con" id="LoaderDiv3" style="display: none"></div>
                                    </div>
                                </div>
                                <div class="col-xl-3 col-sm-6 col-xs-12 " id="BrightStdAnalysisDiv" style="display: none">
                                    <div class="card  pull-up">
                                        <div class="card-body">
                                            <a onclick="BrightStudentList()">
                                                <h5 class="card-title text-capitalize">Bright Student List <i class="ti-arrow-right text-anchor float-right"></i></h5>
                                                <div class="tab-content">
                                                    <div class="tab-pane active">
                                                        <div class="d-flex align-items-center no-block m-t-51">
                                                            <h1 class="pl8"><i class="fas fa-user-graduate text-darkp"></i></h1>
                                                            <%-- <div class="ml-auto">
                                                                <h1 id="StudentNo3"></h1>
                                                            </div>--%>
                                                        </div>
                                                    </div>
                                                </div>
                                            </a>
                                        </div>
                                        <div class="se-pre-con" id="LoaderDiv4" style="display: none"></div>
                                    </div>
                                </div>
                                <div class="col-xl-3 col-sm-6 col-xs-12 " id="EntryVerifyDiv" style="display: none">
                                    <div class="card  pull-up">
                                        <div class="card-body">
                                            <a onclick="EntryVerify()">
                                                <h5 class="card-title text-capitalize">Mark Entry Status Verify<i class="ti-arrow-right text-anchor float-right"></i></h5>
                                                <div class="tab-content">
                                                    <div class="tab-pane active">
                                                        <div class="d-flex align-items-center no-block m-t-51">
                                                            <h1 class="pl8"><i class="far fa-check-circle text-danger"></i></h1>
                                                            <%-- <div class="ml-auto">
                                                                <h1 id="StudentNo4"></h1>
                                                            </div--%>
                                                        </div>
                                                    </div>
                                                </div>
                                            </a>
                                        </div>
                                        <div class="se-pre-con" id="LoaderDiv5" style="display: none"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <script>
                var Id;
                var BatchId;
                var mySessionVar;
                var ExamId;
                var SubExamGroupId;
                var DepartmentId;
                var Count;
                var NewBatchId;
                var mySessionVar;
                var mySessionOrg;
                var NewId = 0;


                $(document).ready(function () {
                    var myurl = window.location.href;
                    // sessionStorage.clear();
                    if (myurl != "") {
                        var spliturl = myurl.split('?');

                        if (spliturl.length > 1) {
                            var keyval = myurl.split('?')[1].split('&');
                            OrgId = parseInt(keyval[0].split('=')[1].toString());
                        }
                        else { sessionStorage.clear(); }
                    }
                    BatchId = 0;
                    $.ajax({
                        type: "POST",
                        url: "AssessmentDetailDashboard.aspx/GetOrgDropDownList",
                        // data: JSON.stringify({ "OrgGroupId": parseInt(OrgId) }),
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (result) {
                            $("#drpOrganization").val(0);

                            $("#drpOrganization").html(result.d);
                            mySessionOrg = sessionStorage.getItem("NewId");
                            if (mySessionOrg == null || mySessionOrg == "" || mySessionOrg == undefined) {
                                Id = $("#drpOrganization option:first").val();
                            }
                            else {
                                $("#drpOrganization").val(mySessionOrg);
                                Id = mySessionOrg;
                            }
                            AssignPermission();



                            GetExam();
                        }
                    });
                });
                function CurrentBatchGet() {
                    $.ajax({
                        type: "POST",
                        url: "AssessmentDetailDashboard.aspx/GetBatch",
                        data: JSON.stringify({ "Id": parseInt(Id) }),
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (result) {
                            $("#drpBatch").val(0);

                            mySessionVar = sessionStorage.getItem("BatchIDD");

                            $("#drpBatch").html(result.d);
                            if (mySessionVar == null || mySessionVar == "" || mySessionVar == undefined) {
                                BatchId = $("#drpBatch").val();
                            }
                            else {
                                $("#drpBatch").val(mySessionVar);
                                BatchId = mySessionVar;
                            }
                            GetExam();
                        },
                        error: function (xhr, status, error) {
                            var err = eval("(" + xhr.responseText + ")");
                            console.log(err.Message);
                        }
                    });
                }
                function OrganizationFunction() {

                    Id = $("#drpOrganization").val();
                    sessionStorage.setItem('NewId', Id);
                    $("#drpOrganization").val(Id);
                    sessionStorage.removeItem('BatchIDD');
                    sessionStorage.removeItem('ExamId');
                    GetOrgId();
                    CurrentBatchGet();
                    // PassFailStudentAnalysisDataBind();

                    //alert(Id);
                }
                function GetExam() {
                    //  BatchId = $("#drpBatch").val();
                    $.ajax({
                        type: "POST",
                        url: "AssessmentDetailDashboard.aspx/GetExamList",
                        data: JSON.stringify({ "Id": Id, "BatchId": BatchId }),
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (result) {
                            $("#drpExam").val(0);
                            mySessionVar = sessionStorage.getItem("ExamId");

                            $("#drpExam").html(result.d);
                            if (mySessionVar == null || mySessionVar == "" || mySessionVar == undefined) {
                                ExamId = $("#drpExam").val();
                            }
                            else {
                                $("#drpExam").val(mySessionVar);
                                ExamId = mySessionVar;
                            }
                            PassFailStudentAnalysisDataBind();
                            //SubWisePassFailStudentAnalysisDataBind();
                        },
                        error: function (xhr, status, error) {
                            var err = eval("(" + xhr.responseText + ")");
                            console.log(err.Message);
                        }
                    });
                }

                function AssignPermission() {
                    $.ajax({
                        type: "POST",
                        url: "AssessmentDetailDashboard.aspx/AssignPermission",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (result) {
                            var obj = (result.d);
                            console.log(result.d);
                            $.each(obj, function (i, item) {
                                if (item.RoleDashletId == 57 && item.IsCheck == true) {
                                    document.getElementById("PassFailStdAnalysisDiv").style.display = "block";
                                }
                                else if (item.RoleDashletId == 58 && item.IsCheck == true) {
                                    document.getElementById("TotalPercentageAnalysisDiv").style.display = "block";
                                }
                                else if (item.RoleDashletId == 59 && item.IsCheck == true) {
                                    document.getElementById("SubWisePercAnalysisDiv").style.display = "block";
                                }
                                else if (item.RoleDashletId == 60 && item.IsCheck == true) {
                                    document.getElementById("BrightStdAnalysisDiv").style.display = "block";
                                }
                                else if (item.RoleDashletId == 61 && item.IsCheck == true) {
                                    document.getElementById("EntryVerifyDiv").style.display = "block";
                                }
                            });
                            GetOrgId();
                        },
                        error: function (xhr, status, error) {
                            var err = eval("(" + xhr.responseText + ")");
                            console.log(err.Message);
                        }
                    });
                }


                function GetOrgId() {
                    $.ajax({
                        type: "POST",
                        url: "AssessmentDetailDashboard.aspx/GetOrgId",
                        data: JSON.stringify({ "Id": Id }),
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (result) {
                            var obj = (result.d);
                            var Header = "<h5 class='page-title'>" + obj[0].Title + "</h5>";
                            $("#HeaderLabel").text("Assessment Dashboard");
                            document.getElementById("HeaderTitle").innerHTML = Header;
                            CurrentBatchGet();
                        },
                        error: function (xhr, status, error) {
                            var err = eval("(" + xhr.responseText + ")");
                            console.log(err.Message);
                        }
                    });
                }


                DepartmentId = 0;

                function PassFailStudentFunction() {
                    window.location.href = "../MobileView/PassFailStudentAnalysis.aspx?OrgId=" + Id + "&BatchId=" + BatchId + "&SubExamGroupId=" + ExamId;
                }

                function TotalPercentageAnalysis() {
                    window.location.href = "../MobileView/TotalPercentageAnalysis.aspx?OrgId=" + Id + "&BatchId=" + BatchId + "&SubExamGroupId=" + ExamId;
                }

                function SubWisePercAnalysis() {
                    window.location.href = "../MobileView/SubjectWisePercAnalysis.aspx?OrgId=" + Id + "&BatchId=" + BatchId + "&SubExamGroupId=" + ExamId;
                }

                function BrightStudentList() {
                    window.location.href = "../MobileView/BrightStudentList.aspx?OrgId=" + Id + "&BatchId=" + BatchId + "&SubExamGroupId=" + ExamId;
                }

                function EntryVerify() {
                    window.location.href = "../MobileView/MarkEntryStatusVerify.aspx?OrgId=" + Id + "&BatchId=" + BatchId + "&SubExamGroupId=" + ExamId;
                }

                function BatchFunction() {
                    BatchId = $("#drpBatch").val();
                    sessionStorage.setItem('BatchIDD', BatchId);
                    $("#drpBatch").val(BatchId);
                    PassFailStudentAnalysisDataBind();
                    //SubWisePassFailStudentAnalysisDataBind();
                }

                function ExamFunction() {
                    ExamId = $("#drpExam").val();
                    sessionStorage.setItem('ExamId', ExamId);
                    $("#drpExam").val(ExamId);
                    PassFailStudentAnalysisDataBind();
                    //SubWisePassFailStudentAnalysisDataBind();

                }

                //function GetOrgId() {
                //    $.ajax({
                //        type: "POST",
                //        url: "AssessmentDetailDashboard.aspx/GetOrgId",
                //        data: JSON.stringify({ "Id": Id }),
                //        contentType: "application/json; charset=utf-8",
                //        dataType: "json",
                //        success: function (result) {
                //            var obj = (result.d);
                //            var Header = "<h3 class='page-title text-muted'><a href ='../MobileView/AssessmentDashboard.aspx'>Assessment Dashboard</a>";
                //            $("#btnAss").hide();

                //            document.getElementById("HeaderTitle").innerHTML = Header;
                //        }
                //    });
                //}

                function PassFailStudentAnalysisDataBind() {
                    $("#LoaderDiv1").show();
                    var ExamSubGroupId = $("#drpExam").val();
                    var totalpass = 0;
                    var totalfail = 0;
                    $.ajax({
                        type: "POST",
                        url: "AssessmentDetailDashboard.aspx/PassFailStudentAnalysisDataBind",
                        data: JSON.stringify({ "Id": Id, "BatchId": parseInt(BatchId), "ExamSubGroupId": ExamSubGroupId }),
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (result) {
                            var obj = (result.d);
                            $.each(obj, function (i, item) {
                                totalpass += parseInt(item.PassStudent);
                                totalfail += parseInt(item.FailStudent);
                            });
                            document.getElementById("TotalPassStudent").innerHTML = totalpass;
                            document.getElementById("TotalFailStudent").innerHTML = totalfail;
                            $("#LoaderDiv1").hide();
                        }
                    });
                }

                function BackOrgFunction() {
                    window.location.href = "../MobileView/Dashboard.aspx?Id=0";
                    $("#drpBatch").val(BatchId);
                    sessionStorage.removeItem("BatchIDD");
                }

                function AssDashboar() {
                    window.location.href = "../MobileView/Dashboard.aspx?Id=" + Id;
                }
                function DashBoard() { window.location.href = "../MobileView/DashBoard.aspx"; }
            </script>

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

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

