<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?= $certificate['certname'] ?></title>
    <style>
        @page {
            margin: 0;
            padding: 0;
        }
        body {
            font-family: Arial;
            margin: 0;
            padding: 0;
            /* font-size: 12px; */
            /* line-height: 1.4; */
            color: #000000;
            width: 100%;
            height: 100%;
        }
        /* Container untuk background agar memenuhi halaman */
        .bg-container {
            margin:0;
            padding:0;     
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1000;
        }
        .bg-container img {
            margin:0;
            padding:0;   
            width: 100%;
            height: 100%;
        }

        h1 {
            margin :0;
            padding:0;
            color:#336600;
        }

        .container {
            max-width: 100%;
            margin: 0;
            /* padding-top: 20px; */
        }
        .instument-name {
            text-align: center;
            margin: 0;
            padding: 0;
            margin-top: 230px;
            margin-bottom: 25px;
        }
        .site-name {
            text-align: center;
            margin-bottom: 40px;
        }
        .detail-information {
            text-align: center;
            /* margin-bottom: 137px; */
            margin-bottom: 29px;
        }
        h4 {
            margin :0;
            padding:0;
            /* color:#336600; */
        }


        /* Menggunakan table agar dompdf tidak bingung */
        .signature-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 26px;
        }
        .signature-table td {
            width: 50%; /* Membagi dua sisi sama rata */
            text-align: center;
            vertical-align: top;
        }
        .name {
            font-weight: bold;
            text-decoration: underline;
            display: block;
            margin-bottom: 1px;
        }
        .position {
            font-weight: bold;
            display: block;
        }

        .fo-wrapper {
            margin-left: 40px;
        }
    </style>
</head>
<body>
    <div class="bg-container">
        <img src="<?=base_url();?>/assets/images/background_certificate/maintenance.jpeg">
    </div>

    <div class="container">
        <div class="instument-name">
            <h1><?= $certificate['productname'] ?></h1>
        </div>

        <div class="site-name">
            <h1> at <?= $certificate['sitename'] ?> </h1>
        </div>

        <div class="detail-information">
            <h4>Serial Number: <?= $certificate['productnumber'] ?></h4>
            
            <h4>has completed through a series of <?= $certificate['certtype'] ?></h4>
            <h4>and the final result:</h4>
            <h2>PASSED</h2>
            <h4>Date of Instrument Maintenance and Inspection: <?= $certificate['issueddate'] ?></h4>
            <h4>Valid until <?= $certificate['expireddate'] ?></h4>
        </div>

        <table class="signature-table">
            <tr>
                <td>
                    <img src="<?= $certificate['qrcode'] ?>">
                </td>
                <!-- <td>
                    <span class="name">Adhitya Pranata Putra</span>
                    <span class="position">Technical Support Manager</span>
                </td> -->
                
                <!-- <td>
                    <span class="name"><?= $certificate['fullname'] ?></span>
                    <span class="position"><?= $certificate['userposition'] ?></span>
                </td> -->
            </tr>
        </table>

        <div class="fo-wrapper">
            <p>FO.IV.01/20.00/2020</p>
        </div>

    </div>

    <!-- Untuk Tanda Export PDF atau tidak -->
    <?php if (!isset($certificate['exportToPDF'])) : ?>
    <div class="container">
        <div class="instument-name">
            <h1><?= $certificate['productname'] ?></h1>
        </div>

        <div class="site-name">
            <h1> at <?= $certificate['sitename'] ?> </h1>
        </div>

        <div class="detail-information">
            <h4>Serial Number: <?= $certificate['productnumber'] ?></h4>
            
            <h4>has completed through a series of <?= $certificate['certtype'] ?></h4>
            <h4>and the final result:</h4>
            <h2>PASSED</h2>
            <h4>Date of Instrument Maintenance and Inspection: <?= $certificate['issueddate'] ?></h4>
            <h4>Valid until <?= $certificate['expireddate'] ?></h4>
        </div>

        <table class="signature-table">
            <tr>
                <td>
                    <img src="<?= $certificate['qrcode'] ?>">
                </td>
                <!-- <td>
                    <span class="name">Adhitya Pranata Putra</span>
                    <span class="position">Technical Support Manager</span>
                </td>
                
                <td>
                    <span class="name"><?= $certificate['fullname'] ?></span>
                    <span class="position"><?= $certificate['userposition'] ?></span>
                </td> -->
            </tr>
        </table>

        <div class="fo-wrapper">
            <p>FO.IV.01/20.00/2020</p>
        </div>

    </div>
    <?php endif ?>
</body>
</html>
