<section class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h1>
                </h1>
            </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="<?php echo base_url();?>">Dashboard</a></li>
                    <li class="breadcrumb-item"><?php echo $parent;?></li>
                    <li class="breadcrumb-item active"><?php echo $title;?></li>
                </ol>
            </div>
        </div>
    </div>
</section>
<!-- Main content -->
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="card card-default">
                    <div class="card-header">
                        <h3 class="card-title"><?php 
                        echo $title;
                        $tglawal = $awal;
                        $tglakhir= $akhir;
                        $tglgabung = date("m/d/Y", strtotime($awal))." - ".date("m/d/Y", strtotime($akhir));
                        ?></h3>
                    </div>
                    <form action="<?php echo(base_url()); ?>index.php/lp_ppi/detail_apd" method="post" autocomplete="off">
                        <div class="card-body">
                            <div class="form-group row">
                                <label class="col-sm-1 col-form-label">Tanggal :</label>
                                <div class="col-sm-4">
                                    <div class="input-group">
                                        <div class="input-group-prepend">
                                            <span class="input-group-text">
                                                <i class="far fa-calendar-alt"></i>
                                            </span>
                                        </div>
                                        <input type="text" name="tanggalmonitoring" class="form-control float-right" id="reservation" value="<?php echo $tglgabung;?>">
                                    </div>
                                </div>
                                <div class="col-sm-2">
                                    <button type="submit" class="btn btn-outline-info">Search </button>
                                </div>
                            </div>
                        </div>
                    </form>
                    <div class="card-body">
                        <?php if($this->session->flashdata('message')){?>
                        <div id="alert" class="alert alert-success alert-dismissable">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                            <i class="icon fa fa-check"></i> Alert!
                            <?php echo $this->session->flashdata('message');?>
                        </div>
                        <?php }?>
                        <script> 
                            setTimeout(function() {
                                $('#alert').hide('fast');
                            }, 3000);
                        </script>
                        <table id="example1" class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>No</th>
                                    <th>Kode</th>
                                    <th>Ruangan</th>
                                    <th>Kelas</th>
                                    <th>Fristname</th>
                                    <th>Datecreated</th>
                                    <th>Jenis Tindakan</th>
                                    <th>A P</th>
                                    <th>A TP</th>
                                    <th>B P</th>
                                    <th>B TP</th>
                                    <th>C P</th>
                                    <th>C TP</th>
                                    <th>D P</th>
                                    <th>D TP</th>
                                    <th>E P</th>
                                    <th>E TP</th>
                                    <th>F P</th>
                                    <th>F TP</th>
                                    <th>TOT P</th>
                                    <th>TOT TP</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                    $no=0; $totpatuh = 0; $tottidak_patuh = 0;
                                    foreach($apd as $datapd){
                                        $no++;
                                        $totpatuh       = $datapd->apatuh + $datapd->bpatuh + $datapd->cpatuh + $datapd->dpatuh + $datapd->epatuh + $datapd->fpatuh; 
                                        $tottidak_patuh = $datapd->atidak_patuh + $datapd->btidak_patuh + $datapd->ctidak_patuh + $datapd->dtidak_patuh + $datapd->etidak_patuh + $datapd->ftidak_patuh;
                                        echo("
                                            <tr>
                                                <td>".$no."</td>
                                                <td>".$datapd->koderuang."</td>
                                                <td>".$datapd->namaruang."</td>
                                                <td>".$datapd->kelasruang."</td>
                                                <td>".$datapd->first_name."</td>
                                                <td>".$datapd->date_created."</td>
                                                <td>".$datapd->jenis_tindakan." ".$datapd->keterangan."</td>
                                                <td>".$datapd->apatuh."</td>
                                                <td>".$datapd->atidak_patuh."</td>
                                                <td>".$datapd->bpatuh."</td>
                                                <td>".$datapd->btidak_patuh."</td>
                                                <td>".$datapd->cpatuh."</td>
                                                <td>".$datapd->ctidak_patuh."</td>
                                                <td>".$datapd->dpatuh."</td>
                                                <td>".$datapd->dtidak_patuh."</td>
                                                <td>".$datapd->epatuh."</td>
                                                <td>".$datapd->etidak_patuh."</td>
                                                <td>".$datapd->fpatuh."</td>
                                                <td>".$datapd->ftidak_patuh."</td>
                                                <td>".$totpatuh."</td>
                                                <td>".$tottidak_patuh."</td>
                                            </tr>
                                        ");
                                    }
                                ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
