

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>SLPES</title>

    {% load static %}
    <!-- Custom fonts for this template-->
    <link rel="shortcut icon" href="{% static 'FirstApp/images/favicon.ico' %}" type="image/x-icon" />
    <link href="{% static 'FirstApp/css/all.min.css' %}" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">

    <!-- Custom styles for this template-->
    <link href="{% static 'FirstApp/css/sb-admin-2.min.css' %}" rel="stylesheet">



</head>

<body id="page-top">

    <!-- Bootstrap core JavaScript-->
<script src="{% static 'FirstApp/vendor/jquery/jquery.min.js'  %}"></script>
<script src="{% static 'FirstApp/vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>

     <script type="text/javascript">
        $(document).ready(function () {
            $('.calc').click(function () {
                let video_name = $(this).attr('id');

                $('#loader').attr('hidden', false);

                // alert('hello');

                $('#no_content_message').attr('hidden', true);

                //fetching data from the API
                fetch('http://127.0.0.1:8000/lecturer/activities/?video_name=' + video_name)
                .then((res) => res.json())
                .then((out) => assignPerct(out.response))
                .catch((error) => alert('error ' + error))
            });


            //to assign percentage values
            function assignPerct(percentages) {
                $('#no_content_message').attr('hidden', true);
                $('#progress_bars').attr('hidden', false);
                $('#loader').attr('hidden', true);

                let sitting = Math.round(percentages.sitting_perct);
                let standing = Math.round(percentages.standing_perct);
                let walking = Math.round(percentages.walking_perct);

                $('#sitting_val').width(sitting+'%');
                $('#standing_val').width(standing+'%');
                $('#walking_val').width(walking+'%');

                $('#sitting_span').text(sitting + '%');
                $('#standing_span').text(standing + '%');
                $('#walking_span').text(walking + '%');


            }


            //this is for the temporay button (delete later)
            $('#temp_btn').click(function () {
                //using the fecth API

                //hide the message
                $('#no_content_audio_message').attr('hidden', true);

                //show the loader
                $('#audio_loader').attr('hidden', false);

                fetch('http://127.0.0.1:8000/lecturer/get-audio-analysis')
                .then((res) => res.json())
                .then((out) => displayAudioAnalysis(out.response))
                .catch((err) => alert('this is a error: ' + err))
            });


            //this function will display the retrieved audio analysis values
            function displayAudioAnalysis(response) {

                $('#num_of_words').text(response.num_of_words);
                $('#lexical_count').text(response.lexical_count);
                $('#non_lexical_count').text(response.non_lexical_count);

                //hide the loader
                $('#audio_loader').attr('hidden', true);

                //show the content
                $('#audio_summary_details').attr('hidden', false);
            }

        });
    </script>

<!-- Page Wrapper -->
<div id="wrapper">

    <!-- Sidebar -->
    <ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">

        <!-- Sidebar - Brand -->
        <a class="sidebar-brand d-flex align-items-center justify-content-center" href="index.html">
            <div class="sidebar-brand-icon rotate-n-15">
                <i class="fas fa-laugh-wink"></i>
            </div>
            <div class="sidebar-brand-text mx-3">SB Admin <sup>2</sup></div>
        </a>

        <!-- Divider -->
        <hr class="sidebar-divider my-0">

        <!-- Nav Item - Dashboard -->
        <li class="nav-item active">
            <a class="nav-link" href="/lecturer">
                <i class="fas fa-fw fa-tachometer-alt"></i>
                <span>Dashboard</span></a>
        </li>


        <!-- Divider -->
        <hr class="sidebar-divider">

        <!-- Heading -->
        <div class="sidebar-heading">

        </div>

        <!-- Nav Item - Pages Collapse Menu -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsePages" aria-expanded="true" aria-controls="collapsePages">
                <i class="fas fa-fw fa-folder"></i>
                <span>Pages</span>
            </a>
            <div id="collapsePages" class="collapse" aria-labelledby="headingPages" data-parent="#accordionSidebar">
                <div class="bg-white py-2 collapse-inner rounded">
<!--                    <h6 class="collapse-header">Login Screens:</h6>-->
                    <a class="collapse-item" href="index.html">Dashboard</a>
                    <a class="collapse-item" href="/lecturer/lecture-video">Video Page</a>

                </div>
            </div>
        </li>

        <!-- Divider -->
        <hr class="sidebar-divider d-none d-md-block">

        <!-- Sidebar Toggler (Sidebar) -->
        <div class="text-center d-none d-md-inline">
            <button class="rounded-circle border-0" id="sidebarToggle"></button>
        </div>

    </ul>
    <!-- End of Sidebar -->

    <!-- Content Wrapper -->
    <div id="content-wrapper" class="d-flex flex-column">

        <!-- Main Content -->
        <div id="content">

            <!-- Topbar -->


            <!-- End of Topbar -->

            <!-- Begin Page Content -->
            <div class="container-fluid">

                <!-- Page Heading -->
                <div class="d-sm-flex align-items-center justify-content-between mb-4">
                    <h1 class="h3 mb-0 text-gray-800">Dashboard</h1>
                    <a href="#" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Generate Report</a>
                </div>


                <!-- Content Row -->

                <div class="row">

                    <!-- Area Chart -->
                    <div class="col-xl-5 col-lg-7">
                        <div class="card shadow mb-4">
                            <!-- Card Header - Dropdown -->
                            <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                                <h6 class="m-0 font-weight-bold text-primary">Audio List</h6>

                            </div>
                            <!-- Card Body -->
                            <div class="card-body">
                                <div class="card-body">
                                    <!--                  <div class="chart-pie pt-4 pb-2">-->
                                    <table class="table table-striped">
                                        <thead>
                                        <tr>
                                            <th>Audio Name</th>
                                            <th>Duration</th>
                                        </tr>
                                        </thead>

                                        <tbody>
<!--                                        {% for video in Videos %}-->
                                        <tr>
<!--                                            <td>{{video.name}}</td>-->
<!--                                            <td>{{video.duration}}</td>-->
                                        </tr>
<!--                                        {% endfor %}-->
                                        </tbody>
                                    </table>
                                    <!--                  </div>-->
                                    <!--this is a temporary button -->
                                    <div class="float-right m-3">
                                        <button type="button" class="btn btn-danger" id="temp_btn">Temp</button>
                                    </div>
                                </div>


                            </div>
                        </div>
                    </div>

                    <!-- Video List -->
                    <div class="col-xl-6 col-lg-5">
                        <div class="card shadow mb-4">
                            <!-- Card Header - Dropdown -->
                            <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                                <h6 class="m-0 font-weight-bold text-primary">Video List</h6>

                            </div>
                            <!-- Card Body -->
                            <div class="card-body">
                                <div class="chart-pie pt-4 pb-2">
                                    <table class="table table-striped">
                                        <thead>
                                        <tr>
                                            <th>Video Name</th>
                                            <th>Duration</th>
                                        </tr>
                                        </thead>

                                        <tbody>
                                        {% for video in Videos %}
                                        <tr>
                                            <td>{{video.name}}</td>
                                            <td>{{video.duration}}</td>
                                            <td class="btn_class">
                                                <button type="button" class="btn btn-success calc" id='{{video.name}}'>Calculate</button>
                                            </td>
                                        </tr>
                                        {% endfor %}
                                        </tbody>
                                    </table>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>

                <!-- Content Row -->
                <div class="row">

                    <!-- Content Column -->
                    <div class="col-lg-6 mb-4">

                        <!-- Project Card Example -->
                        <div class="card shadow mb-4">
                            <div class="card-header py-3">
                                <h6 class="m-0 font-weight-bold text-primary">Audio Summary</h6>
                            </div>
                            <div class="card-body">
                               <div class="text-center" id="no_content_audio_message">
                                    <span class="font-italic">No audio content to be displayed</span>
                                </div>
                            </div>

                            <!--loader -->
                            <div class="text-center" id="audio_loader" hidden>
                                <img src="{% static 'FirstApp/images/ajax-loader.gif' %}" alt="">

                            </div>

                            <div class="text-center" id="audio_summary_details" hidden>
                                <table class="table table-borderless">
                                    <thead>
                                        <tr>
                                            <th>Criteria</th>
                                            <th>Value</th>
                                        </tr>
                                    </thead>
                                    <!-- table body-->
                                    <tbody>
                                        <tr>
                                            <td>No of Total words</td>
                                            <td id="num_of_words"></td>
                                        </tr>
                                        <tr>
                                            <td>No of extraneous words</td>
                                            <td id="lexical_count"></td>
                                        </tr>
                                        <tr>
                                            <td>No of Non-lexical words</td>
                                            <td id="non_lexical_count"></td>
                                        </tr>
                                    </tbody>
                                </table>
                                <!--button -->
                                <div class="float-right">
                                    <button type="button" class="btn btn-outline-primary m-3" id="summary_btn">View More</button>
                                </div>
                            </div>

                        </div>

                    </div>

                    <div class="col-lg-6 mb-4">
                        {% load static %}

                        <!-- Illustrations -->
                        <div class="card shadow mb-4">
                            <div class="card-header py-3">
                                <h6 class="m-0 font-weight-bold text-primary">Video Summary</h6>
                            </div>
                            <div class="card-body">
                                <div class="text-center" id="no_content_message">
                                    <span class="font-italic">No content to be displayed</span>
                                </div>
                                
                                <!--loader -->
                                <div class="text-center" id="loader" hidden>
<!--                                    <img src="{% static 'FirstApp/images/ajax-loader.gif' %}" alt="">-->
                                    <img src="{% static 'FirstApp/images/ajax-loader.gif' %}" alt="">

                                </div>


                                <!--progress -->
                                <div id="progress_bars" hidden>

                                    <h4 class="small font-weight-bold">Sitting <span class="float-right"
                                                                                     id="sitting_span">20%</span></h4>
                                    <div class="progress mb-4">
                                        <div class="progress-bar bg-danger" id="sitting_val" role="progressbar"
                                             style="width: 20%" aria-valuenow="20" aria-valuemin="0"
                                             aria-valuemax="100"></div>
                                    </div>
                                    <h4 class="small font-weight-bold">Standing <span class="float-right"
                                                                                      id="standing_span">40%</span></h4>
                                    <div class="progress mb-4">
                                        <div class="progress-bar bg-warning" id="standing_val" role="progressbar"
                                             style="width: 40%" aria-valuenow="40" aria-valuemin="0"
                                             aria-valuemax="100"></div>
                                    </div>
                                    <h4 class="small font-weight-bold">Walking<span class="float-right"
                                                                                    id="walking_span">60%</span></h4>
                                    <div class="progress mb-4">
                                        <div class="progress-bar" id="walking_val" role="progressbar" style="width: 60%"
                                             aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"></div>
                                    </div>

                                </div>
                                
                            </div>
                        </div>

                        <!-- Approach -->
<!--                        <div class="card shadow mb-4">-->
<!--                            <div class="card-header py-3">-->
<!--                                <h6 class="m-0 font-weight-bold text-primary">Development Approach</h6>-->
<!--                            </div>-->
<!--                            <div class="card-body">-->
<!--&lt;!&ndash;                                <p>SB Admin 2 makes extensive use of Bootstrap 4 utility classes in order to reduce CSS bloat and poor page performance. Custom CSS classes are used to create custom components and custom utility classes.</p>&ndash;&gt;-->
<!--&lt;!&ndash;                                <p class="mb-0">Before working with this theme, you should become familiar with the Bootstrap framework, especially the utility classes.</p>&ndash;&gt;-->
<!--                            </div>-->
<!--                        </div>-->

                    </div>
                </div>

            </div>
            <!-- /.container-fluid -->

        </div>
        <!-- End of Main Content -->

        <!-- Footer -->
        <footer class="sticky-footer bg-white">
            <div class="container my-auto">
                <div class="copyright text-center my-auto">
                    <span>Copyright &copy; Your Website 2019</span>
                </div>
            </div>
        </footer>
        <!-- End of Footer -->

    </div>
    <!-- End of Content Wrapper -->

</div>
<!-- End of Page Wrapper -->

<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
</a>

<!-- Logout Modal-->
<div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>
                <button class="close" type="button" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
            </div>
            <div class="modal-body">Select "Logout" below if you are ready to end your current session.</div>
            <div class="modal-footer">
                <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
                <a class="btn btn-primary" href="login.html">Logout</a>
            </div>
        </div>
    </div>
</div>

{% load static  %}


<!-- Core plugin JavaScript-->
<script src="{% static 'FirstApp/vendor/jquery-easing/jquery.easing.min.js' %}"></script>

<!-- Custom scripts for all pages-->
<script src="{% static 'FirstApp/js/sb-admin-2.min.js' %}"></script>

<!-- Page level plugins -->
<script src="{% static 'FirstApp/vendor/chart.js/Chart.min.js' %}"></script>

<!-- Page level custom scripts -->
<script src="{% static 'FirstApp/js/demo/chart-area-demo.js' %}"></script>
<script src="{% static 'FirstApp/js/demo/chart-pie-demo.js' %}"></script>

</body>

</html>
