<?php
include "db.php";
$conn = connect_db();
    
    $data = get_verify_by_code($conn, $_GET['code']);
    
    $date_tes = date_create($data['tes_tgl']);
$sertifikat_number = $data['sertifikat_NO']."-".$data['sertifikat_BLN']."/UN26.33/TU.00.08/".date_format($date_tes, "Y");
?>
<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Language" content="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>eSertifikat - UPT Bahasa Universitas Lampung</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no"
    />
    
    <!-- Disable tap highlight on IE -->
    <meta name="msapplication-tap-highlight" content="no">

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<link href="verify.css" rel="stylesheet">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->

<style>

th, td {
    text-align: center
}

</style>

<body>


<!--Author      : @arboshiki-->
<div id="invoice">

   
    <div class="invoice overflow-auto">
        <div style="min-width: 800px">
            <header>
                <div class="row">
                    <div class="col">
                        <a target="_blank" href="https://lobianijs.com">
                            <img src="assets/images/logo_unila.png" data-holder-rendered="true" />
                            </a>
                    </div>
                    <div class="col company-details">
                        <h2 class="name">
                            <a target="_blank" href="https://uptbahasa.unila.ac.id">
                            UPT Bahasa Universitas Lampung
                            </a>
                        </h2>
                        <div>Jl. Prof. Dr. Soemantri Brojonegoro No. 1 Bandar Lampung 35145</div>
                        <div>(0721) 770844</div>
                        <div>uptbahasa@kpa.unila.ac.id</div>
                    </div>
                </div>
            </header>
            <main>
                <div class="row contacts">
                    <div class="col invoice-to">
                        <div class="text-gray-light">UPT Bahasa Universitas Lampung menyatakan bahwa:</div>
                        <h2 class="to"><?php echo $data['nama'] ?></h2>
                        <div class="address"><?php echo $data['ID'] ?></div>
                        <div class="email"><?php 
                        
                        $unit_kerja = "";
                                        switch(strtolower($data['fakultas']))
                                        {
                                            case 'eb': $unit_kerja = "Fakultas Ekonomi dan Bisnis"; break;
                                            case 'hukum': $unit_kerja = "Fakultas Hukum"; break;
                                            case 'kip': $unit_kerja = "Fakultas Keguruan dan Ilmu Pendidikan"; break;
                                            case 'pertanian': $unit_kerja = "Fakultas Pertanian"; break;
                                            case 'teknik': $unit_kerja = "Fakultas Teknik"; break;
                                            case 'isip': $unit_kerja = "Fakultas Ilmu Sosial dan Ilmu Politik"; break;
                                            case 'mipa': $unit_kerja = "Fakultas Matematika dan Ilmu Pengetahuan Alam"; break;
                                            case 'kedokteran': $unit_kerja = "Fakultas Kedokteran"; break;
                                            case 'pasca': $unit_kerja = "Pascasarjana / Umum"; break;
                                        }
                        
                        echo $unit_kerja ?></div>
                    </div>
                    <div class="col invoice-details">
                        <h1 class="invoice-id"></h1>
                        <div class="date">No. Sertifikat: <?php echo $sertifikat_number ?></div>
                        <div class="date">Tanggal English Proficiency Test (EPT): <?php echo date_format($date_tes, "d/m/Y") ?></div>
                        
                    </div>
                </div>
                <table border="0" cellspacing="0" cellpadding="0">
                    <thead>
                        <tr>
                            <th class="text-left">KOMPONEN</th>
                            <th class="text-right">NILAI</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td class="text-left"><h3>
                                Listening Comprehension
                            </td>
                            <td class="total"><?php echo $data['lis'] ?></td>
                        </tr>
                        <tr>
                            <td class="text-left"><h3>
                                Structure and Written Expression
                            </td>
                            <td class="total"><?php echo $data['str'] ?></td>
                        </tr>
                        <tr>
                            <td class="text-left"><h3>
                                Reading Comprehension
                            </td>
                            <td class="total"><?php echo $data['rv'] ?></td>
                        </tr>
                    </tbody>
                    <tfoot>
                        <tr>

                            <td>TOTAL</td>
                            <td><?php echo $data['skor'] ?></td>
                        </tr>
                      
                    </tfoot>
                </table>
                
                <div class="notices">
                    <div>Adalah benar dan tercatat dalam database kami.</div>
                    <div>Sertifikat EPT berlaku selama Satu Tahun sejak diterbitkan serta dapat digunakan sebagai syarat untuk mengikuti seminar hasil, ujian komprehensif dan wisuda.</div>
                </div>
            </main>
            <footer>
                Untuk memastikan bahwa Anda mengakses Database yang benar, pastikan bahwa URL pada browser Anda adalah <a href="https://uptbahasa.unila.ac.id" target="_blank">https://uptbahasa.unila.ac.id</a>
            </footer>
        </div>
        <!--DO NOT DELETE THIS div. IT is responsible for showing footer always at the bottom-->
        <div></div>
    </div>
</div>
</body>
</html>