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

<head>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <title>Corass -Student Dashboard</title>
    <link rel="icon" href="img/kp.png" type="image/png" />

    <link rel="stylesheet" href="css/bootstrap1.min.css" />

    <link rel="stylesheet" href="vendors/themefy_icon/themify-icons.css" />

    <link rel="stylesheet" href="vendors/niceselect/css/nice-select.css" />

    <link rel="stylesheet" href="vendors/owl_carousel/css/owl.carousel.css" />

    <link rel="stylesheet" href="vendors/gijgo/gijgo.min.css" />

    <link rel="stylesheet" href="vendors/font_awesome/css/all.min.css" />
    <link rel="stylesheet" href="vendors/tagsinput/tagsinput.css" />

    <link rel="stylesheet" href="vendors/datepicker/date-picker.css" />

    <link rel="stylesheet" href="vendors/scroll/scrollable.css" />

    <link rel="stylesheet" href="vendors/datatable/css/jquery.dataTables.min.css" />
    <link rel="stylesheet" href="vendors/datatable/css/responsive.dataTables.min.css" />
    <link rel="stylesheet" href="vendors/datatable/css/buttons.dataTables.min.css" />
    <link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700,900" rel="stylesheet">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"
        integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
    <link rel="stylesheet" href="vendors/text_editor/summernote-bs4.css" />

    <link rel="stylesheet" href="vendors/morris/morris.css">

    <link rel="stylesheet" href="vendors/material_icon/material-icons.css" />

    <link rel="stylesheet" href="css/metisMenu.css">

    <link rel="stylesheet" href="css/style1.css" />
    <link rel="stylesheet" href="css/flipdown.css" />
    <link rel="stylesheet" href="css/colors/default.css" id="colorSkinCSS">

    <!-- toastr -->
    <link href="js/toastr.css" rel="stylesheet">

</head>

<body class="crm_body_bg">

    <%- include('../component/student-sidebar.ejs')%>
        <section class="main_content dashboard_part large_header_bg">
            <%- include('../component/student-profile-info.ejs')%>

                <div class="modal fade text-center py-5" id="subscribeModal" tabindex="-1" role="dialog"
                    aria-labelledby="exampleModalLabel" aria-hidden="true">
                    <div class="modal-dialog modal-md" role="document">
                        <div class="modal-content">
                            <%if(user.profile.session.status==true){%>

                                <div class="example" style="background-color: white">
                                    <br><br><br>
                                    
                                    <!-- <h4>Corass Portal Closes for Registration in:</h4> -->
                                     <h4>Welcome to Corass Portal </h4> 
                                    <!--<h4 style="color: red;">Corass Portal Closed for this session</h4>-->
                                    <!-- <p>Registration Closes on:</p> -->
                                    <!-- <div id="flipdown" class="flipdown"></div> -->

                                </div>
                                <%}%>
                        </div>
                    </div>
                </div>

                <div class="main_content_iner ">
                    <div class="container-fluid p-0 ">
                        <h2>Dashboard</h2>
                        <%if(user.payment_status==="UNPAID" ){%>
                            <div class="col-lg-12">
                                <div class="white_card card_height_100 mb_30">
                                    <div class="white_card_body">
                                        <div class="row justify-content-center">
                                            <!-- <div class="col-lg-1">
                                    <img src="image/payreq2.png" style="width: 150px;" alt="">
                                </div> -->
                                            <div class="col-lg-7 col-sm-6">

                                                <div class="row justify-content-center">

                                                    <div class="alert_wrap">
                                                        <div class="alert alert-danger alert_bg">
                                                            <strong
                                                                class="text-center justify-content-center str_text">Make
                                                                payment in order to have full access to CORASS
                                                                Features</strong>
                                                        </div>
                                                    </div>
                                                    <div class="submit_button text-center" style="float: left;">
                                                        <a href="payment-plan" class="btn_1">View Payment Plans</a>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>


                            <%}%>
                                <%if(user.payment_status==="PAID" ){%>
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <div class="single_element">
                                                <div class="quick_activity">
                                                    <div class="row">
                                                        <div class="col-lg-6">
                                                            <div class="single_quick_activity">
                                                                <div class="row">
                                                                    <div class="col-lg-7 col-sm-6 col-md-7">
                                                                        <div class="count_content">
                                                                            <h6>Congratulations <%= profile?.firstname
                                                                                    %>
                                                                            </h6>
                                                                            <p>You have unlock some<span> CORASS
                                                                                    features</span></p>
                                                                            <a href="#">
                                                                                <h5>Access Fee Paid</h5>
                                                                            </a>
                                                                            <div class="submit_button text-center"
                                                                                style="float: left;">
                                                                                <a href="/payment-history"
                                                                                    class="btn_1">View payments</a>
                                                                            </div>
                                                                            <!-- <img src="img/badge.svg" class="congratulation-medal" alt="Medal Pic"> -->
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-lg-5 col-sm-6 col-md-5">
                                                                        <img src="image/paid.jpg" style="width: 150px;"
                                                                            alt="">
                                                                    </div>
                                                                </div>

                                                            </div>
                                                        </div>
                                                        <%if (isReady ){%>
                                                            <div class="col-lg-6">
                                                                <div class="single_quick_activity">
                                                                    <div class="count_content">
                                                                        <h6>Congratulations</h6>
                                                                        <p>Your Final project has been approved, please
                                                                            print your exit form here</p>

                                                                        <div class="submit_button mr-3 text-center"
                                                                            style="float: left;">
                                                                            <a href="/acknownledge" class="btn_1">Exit
                                                                                Form</a>
                                                                        </div>

                                                                        <%if(user.profile.session.status==false){%>
                                                                            <div class="ml-3 submit_button text-center"
                                                                                style="float: left; margin-left: 2px;">
                                                                                <a href="/view-document/<%=project.id%>"
                                                                                    class="btn_1">View Final Project</a>
                                                                            </div>
                                                                            <%}%>


                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <%}else{ %>
                                                                <div class="col-lg-6">
                                                                    <div class="single_quick_activity">
                                                                        <div class="count_content">
                                                                            <h6>Topic Submission</h6>
                                                                            <p>Proceed to view topic approved topic</p>
                                                                            <% if(parseInt(topicApproved)> 0){ %>
                                                                                <a href="">
                                                                                    <h5>Topic approved </h5>
                                                                                </a>
                                                                                <% } %>
                                                                                    <div class="submit_button text-center"
                                                                                        style="float: left;">
                                                                                        <a href="/topic-submission"
                                                                                            class="btn_1">View
                                                                                            details</a>
                                                                                    </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <%}%>
                                                                    <div class="row" style="margin-top: 30px;">
                                                                        <div class="col-lg-6">
                                                                            <input type="hidden" id="sessionStatus"
                                                                                value="<%= user.profile.session.status %>">
                                                                            <div class="single_quick_activity">
                                                                                <%if(user.profile.session.status==true){%>
                                                                                    <div class="count_content">
                                                                                        <h6>Project Document Submission
                                                                                        </h6>
                                                                                        <p>Proceed to view project
                                                                                            approval
                                                                                            status</p>
                                                                                        <a href="/project-submission">
                                                                                            <h5>Project ongoing</h5>
                                                                                        </a>
                                                                                        <div class="submit_button text-center"
                                                                                            style="float: left;">
                                                                                            <a href="/project-submission"
                                                                                                class="btn_1">View
                                                                                                status</a>
                                                                                        </div>
                                                                                    </div>
                                                                                    <%}else{%>
                                                                                        <div class="count_content">
                                                                                            <h6>Project Document
                                                                                                Submission</h6>
                                                                                            <p>Session has closed</p>
                                                                                        </div>
                                                                                        <%}%>
                                                                            </div>
                                                                        </div>
                                                                        <div class="col-lg-6">
                                                                            <div class="single_quick_activity">
                                                                                <div class="count_content">
                                                                                    <h6>Supervisor Information</h6>
                                                                                    <p>This is the supervisor<span>
                                                                                            assigned to
                                                                                            you.</span></p>
                                                                                    <h4>
                                                                                        <%= supervisoDetails?.title %>
                                                                                            <%= supervisoDetails?.firstname
                                                                                                %>
                                                                                                <%= supervisoDetails?.lastname
                                                                                                    %>
                                                                                    </h4>
                                                                                    <div class="submit_button text-center"
                                                                                        style="float: left;">
                                                                                        <a href=""
                                                                                            class="btn_1">Unlocked</a>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <h5 class="mt-5">Project Documents Submitted</h5>
                                    <p class="mb-2">
                                        Summary of uploaded project documents (Proposal, Chapter 1 - 5 etc.)
                                    </p>
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <div class="single_element">
                                                <div class="quick_activity">
                                                    <div class="row">
                                                        <div class="col-lg-3">
                                                            <div class="single_quick_activity">
                                                                <div class="count_content">
                                                                    <h6>
                                                                        <%= allDoc%>
                                                                    </h6>
                                                                    <p>All Documents</p>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-lg-3">
                                                            <div class="single_quick_activity">
                                                                <div class="count_content">
                                                                    <h6>
                                                                        <%= pendingProj %>
                                                                    </h6>
                                                                    <p>Pending Approval</p>
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="col-lg-3">
                                                            <div class="single_quick_activity">
                                                                <div class="count_content">
                                                                    <h6>
                                                                        <%= approvedProj %>
                                                                    </h6>
                                                                    <p>Approved Documents</p>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-lg-3">
                                                            <div class="single_quick_activity">
                                                                <div class="count_content">
                                                                    <h6>
                                                                        <%= rejectedProj %>
                                                                    </h6>
                                                                    <p>Rejected Documents</p>
                                                                </div>
                                                            </div>
                                                        </div>


                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div><br>
                                    <div class="col-lg-12 pt-4">
                                        <div class="white_card card_height_100 mb_30 QA_section">
                                            <div class="white_card_body">
                                                <div class="card-body border-bottom">
                                                    <h4 class="card-title">Project Status</h4>
                                                    <p class="mb-0">
                                                        Approved project topic appears here. This section display your
                                                        project with it's completion status [Inprogress, Completed,
                                                        Rejected]
                                                    </p>
                                                </div>
                                                <div class="QA_table table-responsive ">
                                                    <table class="table mt-5">
                                                        <thead class="table"
                                                            style="background-color: #069140; color: white;">
                                                            <tr>
                                                                <th>
                                                                    <h5>Project Topic</h5>
                                                                </th>
                                                                <th>
                                                                    <h5>Supervisor</h5>
                                                                </th>
                                                                <th>
                                                                    <h5>Status</h5>
                                                                </th>
                                                                <th>
                                                                    <h5>Date Submitted</h5>
                                                                </th>
                                                                <th>
                                                                    <h5>Action</h5>
                                                                </th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <% for(topic of topics){ %>
                                                                <tr>
                                                                    <td>
                                                                        <%=topic.topic%>
                                                                    </td>
                                                                    <td>
                                                                        <%=topic.lecturer?.title%>
                                                                            <%=topic.lecturer.firstname%>
                                                                                <%=topic.lecturer.lastname%>
                                                                    </td>

                                                                    <%if(topic.is_approved==true){%>
                                                                        <td>Approved</td>
                                                                        <td>
                                                                            <%=topic.createdAt%>
                                                                        </td>
                                                                        <td></td>
                                                                        <%}else if(topic.is_approved==false){%>
                                                                            <td>Pending</td>
                                                                            <td>
                                                                                <%=topic.createdAt%>
                                                                            </td>
                                                                            <td> </td>
                                                                            <%} else if (topic.active==false) {%>
                                                                                <td>Rejected</td>
                                                                                <td>
                                                                                    <%=topic.createdAt%>
                                                                                </td>
                                                                                <td></td>
                                                                                <%}%>
                                                                </tr>
                                                                <%}%>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                    </div>
                    <%}%>
                </div>
                </div>

                <div class="footer_part">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-lg-12">
                                <footer class="footer footer-light  footer-static">
                                    <p class="clearfix mb-0">
                                        <span
                                            class="float-md-start d-block d-md-inline-block mt-25 text-center">COPYRIGHT
                                            &copy;
                                            <script>document.write(new Date().getFullYear())</script><a class="ms-25"
                                                href="">CORASS</a>,
                                            <span class="d-inline-block">All rights Reserved</span>
                                        </span>
                                        <span class="float-md-end d-block text-center">Centralized Online Research
                                            Assessment and Submission System<i data-feather="file-text"></i></span>
                                    </p>
                                </footer>
                            </div>
                        </div>
                    </div>
                </div>
        </section>

        <div id="back-top" style="display: none;">
            <a title="Go to Top" href="#">
                <i class="ti-angle-up"></i>
            </a>
        </div>

        <script>
            document.addEventListener('DOMContentLoaded', () => {


                // Unix timestamp (in seconds) to count down to
                // var twoDaysFromNow = (new Date("2024-08-16 11:59 PM").getTime() / 1000) + (86400 * 2) + 1;
                var twoDaysFromNow = (new Date("2024-08-31 11:59 PM").getTime() / 1000)
                console.log(twoDaysFromNow)
                // Set up FlipDown
                var flipdown = new FlipDown(twoDaysFromNow)

                    // Start the countdown
                    .start()

                    // Do something when the countdown ends
                    .ifEnded(() => {
                        console.log('The countdown has ended!');
                    });

                // Toggle theme
                var interval = setInterval(() => {
                    let body = document.body;
                    body.classList.toggle('light-theme');
                    body.querySelector('#flipdown').classList.toggle('flipdown__theme-dark');
                    body.querySelector('#flipdown').classList.toggle('flipdown__theme-light');
                }, 5000);

                // Show version number
                var ver = document.getElementById('ver');
                ver.innerHTML = flipdown.version;
            });
        </script>
        <script src="js/jquery1-3.4.1.min.js"></script>

        <script src="js/popper1.min.js"></script>
        <script src="js/flipdown.js"></script>

        <script src="js/bootstrap1.min.js"></script>

        <script src="vendors/datatable/js/jquery.dataTables.min.js"></script>
        <script src="vendors/datatable/js/dataTables.responsive.min.js"></script>
        <script src="vendors/datatable/js/dataTables.buttons.min.js"></script>
        <script src="vendors/datatable/js/buttons.flash.min.js"></script>
        <script src="vendors/datatable/js/jszip.min.js"></script>
        <script src="vendors/datatable/js/pdfmake.min.js"></script>
        <script src="vendors/datatable/js/vfs_fonts.js"></script>
        <script src="vendors/datatable/js/buttons.html5.min.js"></script>
        <script src="vendors/datatable/js/buttons.print.min.js"></script>

        <!--Start of Tawk.to Script-->
        <script type="text/javascript">
            var Tawk_API = Tawk_API || {}, Tawk_LoadStart = new Date();
            (function () {
                var s1 = document.createElement("script"), s0 = document.getElementsByTagName("script")[0];
                s1.async = true;
                s1.src = 'https://embed.tawk.to/61c33018c82c976b71c2a947/1fnh77ocr';
                s1.charset = 'UTF-8';
                s1.setAttribute('crossorigin', '*');
                s0.parentNode.insertBefore(s1, s0);
            })();
        </script>
        <!--End of Tawk.to Script-->
        <!-- END: Page JS-->

        <script src="js/custom.js"></script>
        <script src="js/jquery1-3.4.1.min.js"></script>
        <script src="js/toastr.min.js"></script>

        <%if(error){%>
            <input hidden id="errorHandler" value="<%=error.error%>">

            <script>toastr.options.progressBar = true;
                toastr.error(
                    document.getElementById('errorHandler').value,
                    "ERROR", {
                    timeOut: 9000
                }
                );</script>
            <%}%>

                <script>
                    $(window).on('load', function () {
                        var sessionStatus = $('#sessionStatus').text().trim();
                        console.log(sessionStatus)
                        // if (sessionStatus == true) {
                        setTimeout(function () {
                            $('#subscribeModal').modal('show');
                        }, 1000);
                        // }
                    });
                    $('#Reloadpage').click(function () {
                        location.reload();
                    }); 
                </script>
</body>

</html>