<!-- Begin Page Content -->
<div class="container-fluid" id="print-area">
    <style>
        .float {
            background: #4e73df;
            color: white;
            border-top: 0;
            border-left: 0;
            border-right: 0;
            text-decoration: none;
            font-family: sans-serif;
            font-size: 14pt;
            position: fixed;
            width: 60px;
            height: 60px;
            bottom: 40px;
            right: 40px;
            background-color: #4e73df;
            color: #FFF;
            border-radius: 50px;
            text-align: center;
            box-shadow: 2px 2px 3px #999;
            margin-top: 32px;
        }

        .scroll-to-top {
            display: none !important;
        }

        #print {
            border-bottom: 0;
            border-top: 0;
            border-left: 0;
            border-right: 0;
            text-decoration: none;
            font-family: sans-serif;
            font-size: 14pt;
            background-color: #1abc9c;
            color: #FFF;
            border-radius: 2px;
            text-align: center;
            padding: 10px;
            margin-top: 5px;
        }

        .box {
            position: relative;
            border-radius: 3px;
            background: #ffffff;
            border-top: 3px solid #d2d6de;
            margin-bottom: 20px;
            width: 100%;
            box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
        }

        .box-title {
            color: #fff;
        }

        .box.box-solid.box-info {
            border: 1px solid #00c0ef;
        }

        .box.box-solid.box-info>.box-header {
            color: #fff;
            background: #00c0ef;
            background-color: #00c0ef;
        }

        .box.box-solid.box-warning {
            border: 1px solid #f39c12;
        }

        .box.box-solid.box-warning>.box-header {
            color: #fff;
            background: #f39c12;
            background-color: #f39c12;
        }

        .box.box-solid.box-danger {
            border: 1px solid #dd4b39;
        }

        .box.box-solid.box-danger>.box-header {
            color: #fff;
            background: #dd4b39;
            background-color: #dd4b39;
        }

        .box-header.with-border {
            border-bottom: 1px solid #f4f4f4;
        }

        .box-header {
            color: #444;
            display: block;
            padding: 10px;
            position: relative;
        }

        .box-body {
            border-top-left-radius: 0;
            border-top-right-radius: 0;
            border-bottom-right-radius: 3px;
            border-bottom-left-radius: 3px;
            padding: 10px;
        }

        .callout {
            border-radius: 3px;
            margin: 0 0 20px 0;
            padding: 15px 30px 15px 15px;
            border-left: 5px solid #eee;
        }

        .well {
            min-height: 20px;
            padding: 19px;
            margin-bottom: 20px;
            background-color: #f5f5f5;
            border: 1px solid #e3e3e3;
            border-radius: 4px;
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
        }

        .well {
            overflow: hidden;
        }

        span.kondisipilih {
            background-color: #2f2130;
            padding: 2px 4px;
            border-radius: 4px;
        }

        h3 {
            font-size: 1.25rem;
            font-weight: bold;
        }
    </style>

    <div class="row">
        <div class="col-xl-12 col-md-12">
            <div class="card">
                <div class="card-body" id="card-body">
                    <!-- <h2 class='text text-primary'>Hasil Diagnosis - <?php echo $sqlhasil[0]['nama_gejala']; ?></h2> -->
                    <h2 class='text text-primary'>Hasil Diagnosis</h2>
                    <button id="print" onclick="printDiv('print-area');" data-toggle="tooltip" data-placement="right" title="Klik tombol ini untuk mencetak hasil diagnosa"><i class="fa fa-print"></i> Cetak</button>
                    <hr>

                    <div class="table-responsive">
                        <table class="table table-bordered" width="100%" cellspacing="0">
                            <thead>
                                <tr>
                                    <th>No</th>
                                    <th>Kode</th>
                                    <th>Gejala</th>
                                    <th>Pilih Kondisi</th>
                                </tr>
                            </thead>
                            <tbody class="pilihkondisi">
                                <?php $no = 1;
                                foreach ($argejala as $k => $d) {
                                    $kondisi = $d;

                                    $r4 = $this->db->query('SELECT * FROM gejala WHERE kode_gejala = ' . $k)->row_array();
                                ?>
                                    <tr>
                                        <td><?php echo $no;
                                            $no++; ?></td>
                                        <td><?php echo str_pad($r4['kode_gejala'], 3, '0', STR_PAD_LEFT); ?></td>
                                        <td><?php echo $r4['nama_gejala']; ?></td>
                                        <td><span class="kondisipilih" style="color: <?php echo $arcolor[$kondisi]; ?>;"><?php echo $arkondisitext[$kondisi]; ?></span></td>
                                    </tr>
                                <?php } ?>
                            </tbody>
                        </table>
                    </div>

                    <?php

                    $np = 0;
                    foreach ($arpenyakit as $key => $value) {
                        $np++;
                        $idpkt[$np] = $key;
                        $nmpkt[$np] = $arpkt[$key];
                        $vlpkt[$np] = $value;
                    }
                    if ($argpkt[$idpkt[1]]) {
                        $gambar = base_url() . 'aset/penyakit/' . $argpkt[$idpkt[1]];
                    } else {
                        $gambar = base_url() . 'aset/noimage.png';
                    }
                    echo "<div class='well well-small'><img class='img-bordered-sm' style='float:right; margin-left:15px;' src='" . $gambar . "' height=200><h3>Hasil Diagnosa</h3>";
                    echo "<div class='callout callout-default'>Jenis penyakit yang diderita adalah <b><h3 class='text text-success'>" . $nmpkt[1] . "</b> / " . round($vlpkt[1] * 100, 2) . " % (" . $vlpkt[1]  . ")<br></h3>";
                    echo "</div></div><div class='box box-info box-solid'><div class='box-header with-border'><h3 class='box-title'>Detail</h3></div><div class='box-body'><p>";
                    echo $ardpkt[$idpkt[1]];
                    echo "</p></div></div>
        <div class='box box-warning box-solid'><div class='box-header with-border'><h3 class='box-title'>Saran</h3></div><div class='box-body'><p>";
                    echo $arspkt[$idpkt[1]];
                    echo "</p></div></div>
        <div class='box box-danger box-solid'><div class='box-header with-border'><h3 class='box-title'>Kemungkinan lain:</h3></div><div class='box-body'><p>";
                    for ($ipl = 2; $ipl < count($idpkt); $ipl++) {
                        echo " <p>- " . $nmpkt[$ipl] . "</b> / " . round($vlpkt[$ipl], 2) . " % (" . $vlpkt[$ipl] . ")<br></p>";
                    }
                    echo "";
                    ?>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- /.container-fluid -->

<script>
    function printDiv(divName) {
        var printContents = document.getElementById(divName).innerHTML;
        var originalContents = document.body.innerHTML;

        document.body.innerHTML = printContents;

        window.print();

        document.body.innerHTML = originalContents;
    }
</script>