
<?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">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script><!--
        
        --><script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.8.0/html2pdf.bundle.min.js"></script>
        <!--<link rel="stylesheet" href="style.css">-->
<!--        <script type="text/javascript" src="html2pdf.bundle.min.js"></script>
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>-->

    </head>
    <body style="background-color: aliceblue;">

        <div class="container text-center" style="padding: 10px;border: 0px;min-height: 0px">
            <div class="row">
                <div class="col-sm-3"></div>
                <div class="col-sm-6" style="background-color: white">
                    <img src="logo_new.jpg" class="img-rounded" style=";height: 160px;margin: 10px">
                    <h1><b><span style="color: rgb(236, 85, 69)">શિક્ષણ સમિતિ જિલ્લા પંચાયત, તાપી</span></b></h1>
                </div>
                <div class="col-sm-3"></div>
            </div>
        </div>

        <div class="container" style="padding: 5px;border: 0px;min-height: 0px">
            <div class="row">
                <div class="col-sm-3">            
                    <!--<button type="button" class="btn btn-primary btnsave" id="btn-submit" tabindex="6">Go To Home</button>-->
                </div>
                <div class="col-sm-6" style="background-color: white">
                    <hr style="height: 4px;border-width:0;color:orange;background-color:orange;margin-top: 0px;margin-bottom: 0px">
                    <div style="padding: 10px">
                        <h1><b><span style="color: orange">હર ઘર</span> તિરંગા <span style="color: green">જ્ઞાન ક્વિઝ</span></b></h1>
                        <h5><b style="font-size: 18px">વિદ્યાર્થીનું નામ : <?php echo $_SESSION['stud_name']; ?></b></h5>
                        <button class="btn btn-link" onclick="generatePDF()">Download Certificate</button>
                        <!--<button class="btn btn-link" id="btn_view_summary">View Your Quiz Summary</button>-->
                        <button type="button" class="btn btn-link btnsave" id="btn-submit" tabindex="6">Go To Home</button>
                    </div>
                    <hr style="height: 4px;border-width:0;color:orange;background-color:orange;margin-top: 0px;margin-bottom: 0px">
                </div>
                <div class="col-sm-3">
                </div>
            </div>
        </div>

        <div id="canvas_div_pdf">

            <div class="container" id="print_divtag" style="min-height: 60vh;margin : center; background-color: #ffb04266;border: 10px solid rgb(236, 85, 69);">
                <img src="logo_new.jpg" alt="Nature" style="width:190px;height: auto;float: right;margin-right: -15px;">
                <img src="modi_final.png" alt="Nature" style="width:150px;;margin-left: -15px;margin-top: -0px;">

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

                    <h3 class="section" style="float: left;font-size: 26px;margin-top: 120px">
                        તારીખ :- <?php echo $_SESSION['quiz_date']; ?> 
                    </h3>
                    <div class="text-center" style="float: right;margin-right: 120px;margin-bottom: -100px;">          
                        <img src="sign2.jpeg" alt="Nature" style="width:100px;"> 
                    </div><br><br><br><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;font-size: 16px;">ID <?php echo $_SESSION['certificate_id']; ?></h5>

            </div>

        </div>
        <div style="margin-bottom: 100px;background-color: white"></div>

    </body>

    <script>
        function generatePDF() {
            window.location.href = './certificate.php';
        }

    </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 = './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>
</html>

