<style type="text/css">
.buttons-html5, .buttons-print{background: orange; color:#fff; border:0px; float: left; margin-right: 5px; margin-top: 7px}
.DTFC_LeftBodyWrapper{margin-top: -7px;}
table.dataTable{margin-top: 0px !important}
</style>

<div class="row" id="portlet-content">
    <div class="col-md-12">
        <div class="portlet light" style="position:relative">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-list"></i> Detail Pasien <?=$judul?>
                </div> 
                
                <!--
                <?php if(@$tipe_pasien == '2'){ ?>
                <div class="portlet-title" style="float: right;">
                    <div class="actions"  style="margin-right:5px !important" >
                    <a class="btn " href="">
                        <i class="fa fa-plus"></i> Entry
                    </a> 
                  </div>
                </div>
                <?php }?>
                -->
                
            </div>           
            <?php 
            $a=$query->num_rows();
            if($a != 0){ ?>
            <div id="dataTables_processing">
                Loading Data..
            </div>
            <?php }?>
            <div class="portlet-body" id="page-content" style="<?=$a!=0?'display: none':''?>">
                <div class="table-responsive" style="border:0px;">
                    <?php 
                    if($a == 0){ ?>
                    <div class="" class="form-group" style="margin-bottom:40px; margin-top: 0px; margin-left:0px; padding-bottom: 30px; border-radius:4px; background: linear-gradient(to left, #d14415,#d16b49, #fad2d2 ,transparent,transparent,transparent,transparent)">
                      <div class="col-sm-12 col-md-12" style="text-align: right; color: #fff"><h2><strong>Tidak ada data</strong></h2></div><br><br>
                    </div>
                    <?php }else{ ?>
                    <table id="example" class="table table-bordered table-striped table-hover datatable" >
                      <thead>

                        <tr style="background: #5578eb; color:#fff;">
                          <th style="min-width: 50px"><i class="fa fa-th-large"></i></th>
                          <th class="text-center" style="min-width:30px; width: 30px !important" style="margin-left: 200px;"><div style="width:30px !important">NO.</div></th>
                          <th class="text-left" style="min-width: 80px">NO RM.</th>
                          <th class="text-left" style="min-width: 200px">NAMA PASIEN</th>
                          <th class="text-left" style="min-width: 130px">BERKUNJUNG</th>
                          <th class="text-left" style="min-width: 110px">TIPE PASIEN</th>
                          <th class="text-left" style="min-width: 400px">ALAMAT</th>
                        </tr>
                      </thead>
                      <tbody>
                       
                        <?php $i=1; 
                       
                        foreach($query->result() as $key) { ?>
                          <tr style="font-size:12px; <?=($key->active=='0')?'text-decoration: line-through; opacity:0.4':''?>">
                            <td class="" style="background: #fcf4dc;" align="left">
                                <?php if( $this->session->userdata('id_jabatan') != '7' ){ ?>
                                <a class="tooltips btn-xs btn-info" data-toggle="m-tooltip" data-container="body" title="Periksa" href="<?= site_url('front_office/ugd_dir/ugd/info_pasien_diperiksa/'.$key->id_re_pasien.'/'.$key->id_re_kunjungan.'/'.$active)?>" ><i class='fa fa-stethoscope'></i></a>  
                                <?php }?>
                                <a class="tooltips btn-xs btn-danger" data-toggle="m-tooltip" data-container="body" title="Batal Periksa" onclick="return confirm('Batalkan Pemeriksaan?')"  href="<?= site_url('front_office/ugd_dir/ugd/batal_pemeriksaan/'.$key->id_re_kunjungan)?>"><i class='fa fa-times'></i></a>
                            </td>
                            <td align="center"> <?=$i;?> </td>
                            <td align="left">BBMC-<?=$key->nrm?></td>
                            <td align="left"><?=strtoupper($key->nama_pasien)?> </td>
                            <td align="left"><a href="<?=site_url()?>/front_office/ugd_dir/ugd/tipe_pasien/<?=$key->id_type_pasien?>/<?=$key->id_re_pasien?>" target="_Blank" style="text-decoration: underline; color: blue"><?=$key->ttl?>x</a> </td>
                            <td align="left">
                                <?=strtoupper($this->Content_m->get_value('bbmc_re_tipe_pasien','id_tipe_pasien',$key->id_type_pasien,'tipe_pasien'))?>    
                            </td>
                            <td align="left"><?=strtoupper($key->alamat)?></td>

                          </tr>
                        <?php $i++; } ?>
                      </tbody>     
                    </table>
                    <?php }?>



                </div>
            </div>
         
           
        </div>
    </div>
</div>


<script>
$(document).ready(function() {
    var buttonCommon = {
        exportOptions: {
            format: {
                body: function ( data, row, column, node ) {
                    return (column === 5) ? data.replace( /\n/g, '"&CHAR(10)&CHAR(13)&"' ) : data.replace(/(&nbsp;|<([^>]+)>)/ig, "\n");;
                }
            }
        },
        customize: function( xlsx ) {
          var sheet = xlsx.xl.worksheets['sheet1.xml'];
          $('row c', sheet).attr( 's', '55' );
       }
    };
 
    $('#example').DataTable( {
        scrollY:        "300px",
        scrollX:        true,
        scrollCollapse: true,
        dom: 'lBfrtip',
        buttons: [
            $.extend( true, {}, buttonCommon, {
                extend: 'excelHtml5',
                text: 'Print Table Data',
                title:''
            } )
        ],
        lengthMenu: [ [10, 50, 200, -1], [10, 50, 200, 'All Data'] ],
        fixedColumns: {
            leftColumns: 1
        },
        fnInitComplete: function(oSettings, json) {
          $('#dataTables_processing').css('display','none');
          $('#page-content').css('display','block');
          $('#fillter-content').css('display','block');
        }

    } );
} );

$('.tooltips').tooltip({ container: 'body' }) 
$(".date" ).datepicker({
    changeMonth: true,
    changeYear: true,
    yearRange: "-60:+0",
    dateFormat: 'yy-mm-dd'
});
</script>

