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



<!DOCTYPE html>

<html lang="en">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
        <link rel="stylesheet" href="style.css">

        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <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>
        <script>
            function generatePDF() {
                // Choose the element that our invoice is rendered in.
                const element = document.getElementById('print_divtag');
                html2pdf(element);
//                html2pdf()
//                        .set({html2canvas: {scale: 4}})
//                        .from(element)
//                        .save();

//                document.getElementById('invoice').style.display ='none';
            }
        </script>
        <style>
            * {
                box-sizing: border-box;
            }

            .column {
                float: left;
                width: 33.33%;
                padding: 5px;
            }

            /* Clearfix (clear floats) */
            .row::after {
                content: "";
                clear: both;
                display: table;
            }
        </style>

        <title>Certificate</title>

    </head>
</html>
<body>
    <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="logo1.jpg" class="img-rounded" style="width: 100%;height: 160px;margin: 10px">
<!--                    <h1><b><span style="color: orange">હર ઘર</span> તિરંગા <span style="color: green">કિવઝ</span></b></h1>
                <h5>આઝાદી કા અમૃત મહોત્સવે આપનું જ્ઞાન ચકાસીએ.</h5> -->
                <!--<hr style="height: 4px;border-width:0;color:orange;background-color:orange">-->
            </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"></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-primary" onclick="generatePDF()">Download Certificate</button>
                    <button class="btn btn-link">View Quiz Answer Accuracy</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 class="container" id="print_divtag">
         <!--<img src="logo_1.png" alt="Nature" style="width:100px;">-->
        <h1 class="certificate">CERTIFICATE</h1>
        <p class="section">This Certificate Declares that</p>
        <h2 class="name"> <?php echo $_SESSION['stud_name']; ?></h2>
        <h6 class="content"> <?php echo $_SESSION['school_name'] . ', ' . $_SESSION['select_taluka']; ?></h6>
        <h6 class="content2"> has completed</h6>
        <h3 class="title"> <b><span style="color: orange">હર ઘર</span> તિરંગા <span style="color: green">કિવઝ</span></b></h3>

        <div class="text-center" style="margin-left: 0px;">
            On <?php echo $_SESSION['quiz_date']; ?>            
            <img src="logo_1.png" alt="Nature" style="width:100px;"> With Passing Score of <?php echo $_SESSION['percentage'] . '%'; ?>
        </div>
        <h6 class="userid text-center"> Certificate ID <?php echo $_SESSION['certificate_id']; ?></h6>

    </div>


</body>
</html>