
<?php
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
if (!isset($_SESSION['stud_name'])) {
    header("Location: ./index.php");
    exit;
}
?>

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

    <head>
        <title>હર ઘર તિરંગા કિવઝ</title>
        <link rel="icon" type="image/x-icon" href="flaticon.ico">
        <!-- html2pdf CDN-->
        <script src=
                "https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.js">
        </script>
        <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">-->
        <link rel="stylesheet" href="style.css">
        <style>
            .card {
                box-sizing: content-box;
                width: auto;
                height: auto;
                padding: 10px;
                border: 1px solid black;
                font-style: sans-serif;
            }
        </style>
    </head>

    <body>

        <!--<button type="button" class="btn btn-primary btnsave" id="btn-submit" tabindex="1" style="background-color: #c2dde7;font-size: 16px">Go To Home</button>-->
        <button id="button" style="background-color: #c2dde7;font-size: 16px">Download Certificate</button>
        <!--<button class="btn btn-link" id="btn_view_summary" style="background-color: #c2dde7;font-size: 16px">View Your Quiz Summary</button>-->

        <div id="makepdf">
            <!--<div class="container" style="min-height: auto; background-color: #ffb04266">-->
            <div class="container" style="min-height: auto; background-color: white">
                <!--<div class="container" style="min-height: 780px;background-image:url('certificate-design.jpeg');background-repeat:no-repeat;width:auto;min-height: 780px;">-->
                <div class="card" id="makepdf1">

                    <img src="logo_new.jpg" alt="Nature" style="width:190px;height: auto;float: right;margin-top: -10px;margin-right: -10px;">
                    <img src="modi_final.png" alt="Nature" style="width:150px;;margin-left: -10px;margin-top: -10px;">
                    <h1 class="certificate" style="font-weight: 500;line-height: 1.2;margin-top: 10px;margin-bottom: 0px;color: rgb(236, 85, 69)">પ્રમાણપત્ર</h1>
                    <h2 class="section" style="font-size: 36px;color: black;margin: 0px">આઝાદી કા અમૃત મહોત્સવ અંતર્ગત <br></h2>
                    <h1 class="section" style="margin: 0px">
                        <b style="margin: 0px"><span style="color: orange;margin: 0px">હર ઘર</span><span style="margin: 0px"> તિરંગા </span><span style="color: green;margin: 0px">જ્ઞાન ક્વિઝ</span></b> <br>
                        <span style=";margin: 0px">કુમાર/કુમારી </span><span style="color: rgb(236, 85, 69);margin: 0px">
                        <?php echo $_SESSION['stud_name']; ?></span>
                        <br style=";margin: 0px"><span style=";margin: 0px">કલસ્ટર </span><span style="color: rgb(236, 85, 69);margin: 0px"> <b><?php echo $_SESSION['cluster_name']; ?></b></span>
                         <br style=";margin: 0px">શાળા  <span style="color: rgb(236, 85, 69);margin: 0px"><?php echo $_SESSION['school_name']; ?></span>
                         <br style=";margin: 0px">તાલુકો   <span style="color: rgb(236, 85, 69);margin: 0px"><?php echo $_SESSION['select_taluka']; ?>   </span>જિ.તાપી એ ભાગ લઇ
                        <br style=";margin: 0px">રાષ્ટ્રભાવનાને સુદ્રઢ કરવાનાં પ્રયાસો કરેલ છે, જે બદલ
                        <br style=";margin: 0px">આ પ્રમાણપત્ર એનાયત કરવામાં આવે છે
                        

                        <h3 class="section" style="float: left;font-size: 16px;margin-top: 150px">
                            તારીખ :- <?php echo $_SESSION['quiz_date']; ?> 
                        </h3>
                        <div class="text-center" style="float: right;margin-right: 120px;margin-bottom: -100px;margin-top: 50px">          
                            <img src="sign2.jpeg" alt="Nature" style="width:100px;"> 
                        </div><br><br><br>
                        <h3 class="section" style="float: right;font-size: 26px;margin-top: 0px">
                            જિલ્લા પ્રાથમિક શિક્ષણાધિકારી,<br>
                            તાપી
                        </h3><br><br>

                        <h5 class="userid text-center" style="text-align: left;margin-bottom: 0px">ID <?php echo $_SESSION['certificate_id']; ?></h5>

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

        <script>
            var button = document.getElementById("button");
            var makepdf = document.getElementById("makepdf");

            html2pdf().from(makepdf).save();
            button.addEventListener("click", function () {
                html2pdf().from(makepdf).save();
            });

            setTimeout(function () {
//                window.location.href = '/har_ghar_tiranga_quiz/print.php';
                window.location.href = './view_result.php';
            }, 1000);


        </script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {

                $(document.body).on('click', '#btn_view_summary', function (e) {
                    window.location.href = './view_quiz_summary.php';
                });

//        $(document.body).on('click', '#btn_view_summary', function (e) {
//            window.location.href = '/har_ghar_tiranga_quiz/view_quiz_summary.php';
//        });

                $(document.body).on('click', '.btnsave', function (e) {

                    var send = {'go_to_index': "1"}
                    $.ajax({
                        type: 'POST',
                        data: send,
                        url: './PHP_Code/student_entry.php',
                        success: function (data) {
                            debugger;
//                    console.log('success');
//                    console.log(JSON.stringify(data));
//                            alert('data ' + data);
                            window.location.href = './index.php';

                        }, error: function (xhr, err) {
                            alert('Error ' + err.message);
                        }
                    });

                });
            });

        </script>
    </body>

</html>
