<style type="text/css">
  #myTable_filter {
		margin-right: 20px
	}
  .sorting_1{background: #fafafa;}
</style>

<div class="row" id="filter-content" style="display:nonee">
  <div class="col-md-12">
    <div class="portlet light">
      
      <div class="portlet-body form">
        <form id="form-filter" class="horizontal-form">
          <div class="form-body">
            <div class="row">
              <!-- <div class="col-md-4">
                <div class="form-group" id="form_no_reg">
                  <label for="no_reg" class="control-label">No Registrasi</label>
                  <input type="text" id="no_reg" name="no_reg" class="form-control" placeholder="Nomor Registrasi">
                </div>
              </div> -->
              <!--
              <div class="col-md-4">
                <div class="form-group" id="form_tgl_registrasi">
                  <label for="tgl_registrasi" class="control-label">Tgl Registrasi</label>
                  <div class="input-group date" id="datepicker_tglreg">
                    <span class="input-group-btn">
                        <button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
                    </span>
                    <input type="text" id="tgl_registrasi" name="tgl_registrasi" class="form-control" placeholder="Tanggal Registrasi">
                  </div>                  
                </div>
              </div>
              -->
              <!--
              <div class="col-md-4">
                <div class="form-group" id="form_id_type_pasien">
                  <label for="id_type_pasien" class="control-label" style="width:100%">Type Pasien</label>
                  <select id="id_type_pasien" name="id_type_pasien" style="width:100%">
                    <option value=""></option>
                    <?php foreach ($this->Content_m->select_db('bbmc_re_tipe_pasien')->result() as $key ) { ?>
                        <option value="<?=$key->id_tipe_pasien?>"><?=$key->tipe_pasien?></option>
                    <?php }?>
                  </select>
                </div>
              </div>
              -->

              <div class="col-md-4">
                <div class="form-group" id="form_nrm">
                  <label for="nrm" class="control-label">No. Rekam Medis</label>
                  <div class="input-group">
                    <span class="input-group-addon">
                        BBMC -
                    </span>
                    <input type="text" id="nrm" name="nrm" class="form-control" placeholder="Nomor Rekam Medis">
                  </div>                   
                </div>
              </div>

              <div class="col-md-6">
                <div class="form-group" id="form_nama_pasien">
                  <label for="nama_pasien" class="control-label">Nama Pasien</label>
                  <input type="text" id="nama_pasien" name="nama_pasien" class="form-control" placeholder="Nama Pasien">
                </div>
              </div>

              <div class="col-md-2">
                <div class="form-group" id="form_nama_pasien">
                  <label for="nama_pasien" class="control-label">&nbsp;</label><br>
                  
                  <button class="btn green-jungle btn-sm" id="tampilkan" style="padding: 8.5px; width: 100%">
                    <i class="fa fa-search"></i> Tampilkan
                  </button>
                </div>
              </div>

            </div>
            <!--
            <div class="row">
              
              <div class="col-md-4">
                <div class="form-group" id="form_jenis_kelamin">
                  <label for="jenis_kelamin" class="control-label" style="width:100%">Jenis Kelamin</label>
                  <select id="jenis_kelamin" name="jenis_kelamin" style="width:100%">
                    <option value=""></option>
                    <option value="L">Laki-laki</option>
                    <option value="P">Perempuan</option>
                  </select>
                </div>
              </div>
            </div>
            -->
          </div>
          <!--
          <div class="form-actions right">
            <a class="btn yellow-lemon btn-sm" id="reset-filter">
              <i class="fa fa-refresh"></i> Reset Filter
            </a>
            <button class="btn green-jungle btn-sm" id="tampilkan">
              <i class="fa fa-search"></i> Tampilkan
            </button>
          </div>
          -->
        </form>
      </div>
    </div>
  </div>
</div>

<div class="row" id="portlet-content">
  <div class="col-md-12">
    <div class="portlet light" style="position:relative">
      <div class="portlet-title col-md-2">
        <div class="caption">
          <i class="fa fa-th-list"></i>Data <?= $judul ?>
        </div>
      </div>
      <div class="col-md-10" id="tombol-added" style="margin-bottom:5px; padding:0px; border-bottom:0px" id="tombol-action" style="display:none">
        <div style="float:right; overflow:hidden; margin-top:5px;">
          <!--
          <a class="btn red-soft btn-sm" id="filter">
            <i class="fa fa-filter"></i> Filter Data
          </a>
          -->
          <!--
          <a class="btn green btn-sm" target="_Blank" href="<?=site_url()?>/front_office/reg_dir/registrasi/whole_print">
            <i class="fa fa-print"></i> Print
          </a>
          -->
          

          <a class="btn blue btn-sm" href="<?= site_url('front_office/'.$controller_dir.$controller.'/tambah_data') ?>">
            <i class="fa fa-plus"></i> Pasien
          </a>
          <!--
          <a class="btn btn-sm" style="background-color:#1dc9b7; color:#fff" href="<?= site_url('front_office/'.$controller_dir.'kunjungan')?>" >
            <i class="fa fa-list-ul"></i> Kunjungan
          </a>
          -->
          <!--
          <a class="btn btn-sm" style="background-color:#5578eb; color:#fff" href="<?= site_url('front_office/'.$controller_dir.'antrian')?>" >
            <i class="fa fa-list-ul"></i> Antrian
          </a>
          -->
          <!--
          <a class="btn btn-sm" style="background-color:#3f51b5; color:#fff" href="<?= site_url('front_office/'.$controller_dir.'rekam_medis')?>" >
            <i class="fa fa-list-ul"></i> Rekam Medis
          </a>     
          -->   
        </div>
      </div>
      <div class="portlet-body" id="page-content" style="display:block">
        <div class="table-responsive">
          <table id="<?=$controller?>_table" class="table table-bordered table-hover" style="width:100%; font-size:11px !important">
            <thead>
         

              <tr style="background:#5578eb; color:#ffffff;">
                <th style="min-width: 70px"><i class="fa fa-th-large"></i></th>
                <th class="text-left" style="min-width:55px; text-transform: uppercase;">No RM</th>
                <th class="text-left" style="min-width:175px; text-transform: uppercase;">Nama Pasien</th>
                <th class="text-left" style="min-width:130px; text-transform: uppercase;">TGL Registrasi</th>
                
                <th class="text-left" style="min-width:300px; text-transform: uppercase;">Alamat Pasien</th>
                <th class="text-left" style="min-width:100px; text-transform: uppercase;">Type Pasien</th>
                <th class="text-left" style="min-width:210px; text-transform: uppercase;">Perusahaan Penanggung</th>
                <th class="text-left" style="min-width:205px; text-transform: uppercase;">Nomor Asuransi Jiwa</th>
                <th class="text-left" style="min-width:150px; text-transform: uppercase;">Email</th>
                <th class="text-left" style="min-width:150px; text-transform: uppercase;">Kebangsaan</th>
                <th class="text-left" style="min-width:130px; text-transform: uppercase;">Tempat Lahir</th>
                <th class="text-left" style="min-width:130px; text-transform: uppercase;">Tanggal Lahir</th>
                <th class="text-left" style="min-width:70px; text-transform: uppercase;">Umur </th>
                <th class="text-left" style="min-width:130px; text-transform: uppercase;">Jenis Kelamin</th>
                <th class="text-left" style="min-width:70px; text-transform: uppercase;">Status</th>
                <th class="text-left" style="min-width:75px; text-transform: uppercase;">Agama</th>
                <th class="text-left" style="min-width:130px; text-transform: uppercase;">Telepon Pasien</th>
                <th class="text-left" style="min-width:140px; text-transform: uppercase;">Golongan Darah</th>
                <th class="text-left" style="min-width:140px; text-transform: uppercase;">Pendidikan Akhir</th>
                <th class="text-left" style="min-width:100px; text-transform: uppercase;">Pekerjaan</th>
                <th class="text-left" style="min-width:140px; text-transform: uppercase;">Alamat Banjar</th>
                <th class="text-left" style="min-width:130px; text-transform: uppercase;">Alamat Desa</th>
                <th class="text-left" style="min-width:160px; text-transform: uppercase;">Alamat Kecamatan</th>
                <th class="text-left" style="min-width:160px; text-transform: uppercase;">Alamat Kabupaten</th>
                <th class="text-left" style="min-width:160px; text-transform: uppercase;">Alamat Provinsi</th>                              
              </tr>
            </thead>
          </table>
        </div>
      </div>
      <?php $this->load->view('front_office/include/loading'); ?>
    </div>
  </div>
</div>
<script>
  $(document).ready(function() {
    var table = $('#<?=$controller?>_table').DataTable({  
      "order": [[1, 'asc' ]],
      "processing": true,
      "serverSide": true,
      "searching": false,
      "lengthChange": false,
      "language": {
            "url": "<?=base_url('media/assets/global/plugins/datatables/media/js')?>/indonesian.json"
       },
      "lengthMenu": [ [10, 50, 100, 1000, 10000, 50000, 100000], [10, 50, 100, 1000, 10000, 50000, 100000] ],
      "ajax": {
            url: "<?=site_url('front_office/'.$controller_dir.$controller.'/data_table')?>"+"?filter=true",
            type: 'POST',
            data: function (d) {
                d.form_filter = $('#form-filter').serialize();
                return d;
            }
      },
      "columnDefs": [
        {"className": "text-left", "targets": [0,1,2,5,7,9,10,11,12,13,-1]}, // Class to assign to each cell in the column
        {
          "targets": [0],
          "bSortable": false // Enable or disable ordering on this column v 1.10++ (columns.orderable)
        }
      ],    
      "columns": [
            {"data": "aksi"},            
            {"data": "nrm"},
            {"data": "nama_pasien"},
            {"data": "tgl_registrasi"},
            
            {"data": "alamat_pasien"},
            {"data": "id_type_pasien"},      
            {"data": "perusahaan_penanggung"},
            {"data": "nomor_asuransi_jiwa"},
            {"data": "email"},
            {"data": "kebangsaan"},
            {"data": "tempat_lahir"},
            {"data": "tanggal_lahir"},
            {"data": "umur"},      
            {"data": "jenis_kelamin"},
            {"data": "status"},
            {"data": "agama"},         
            {"data": "telepon_pasien"},           
            {"data": "golongan_darah"},
            {"data": "pendidikan_akhir"},
            {"data": "pekerjaan"},
            {"data": "alamat_banjar"},
            {"data": "alamat_desa"},      
            {"data": "alamat_kecamatan"},
            {"data": "alamat_kabupaten"},
            {"data": "alamat_provinsi"},           
      ],
      "fnInitComplete": function(oSettings, json) {
        $('.dataTables_processing').css('display','none');
        $( "#loading-content" ).fadeOut( "fast", function() {
          $( "#tombol-action" ).fadeIn("fast");
          $( "#page-content" ).fadeIn("fast");
        });
      }
    });

    $('#form-filter').submit(function() {
        $('html,body').animate({scrollTop: $('#portlet-content').offset().top-70},500);
        table.ajax.url("<?=site_url('front_office/'.$controller_dir.$controller.'/data_table')?>"+"?filter=true").load();
        return false;
    });

    $('#reset-filter').click(function() {
      $('html, body').animate({scrollTop: $('#portlet-content').offset().top-70},500);
      $('#id_type_pasien, #jenis_kelamin').val('').trigger('change.select2');
      $('#no_reg, #tgl_reg, #nrm, #nama_pasien').val("");
      $('#<?=$controller?>_table').dataTable().fnSort([[ 2, 'asc' ]]);
      table.ajax.url("<?=site_url('front_office/'.$controller_dir.$controller.'/data_table')?>"+"?filter=false").load();
    });

    $('#datepicker_tglreg').datepicker({
      format: "yyyy-mm-dd",
      clearBtn: true,
      language: 'id',
      autoclose: true,
      todayHighlight: true
    });

  });

    $("#id_type_pasien").select2({
      placeholder: "Pilih Type Pasien",
      language: "id"
    });  

    $("#jenis_kelamin").select2({
      placeholder: "Pilih Jenis Kelamin",
      language: "id"
    });   

    $('#filter').click(function() {
      $( "#filter-content" ).slideToggle('fast');
    });

  $('.hapusdata').click(function(){
    if(confirm("Apakah kamu yakin menghapus entry ini?")){
      return true;
    }
    else{
      return false;
    }
  });
</script>
<?php $this->load->view('front_office/script/hapus_data');?>
