<style type="text/css">
  .form-control{padding-left: 5px; border: 0px}
  .border{border: 1px solid silver}
</style>

<div class="row" id="info-content" style="display:block">
    <div class="col-md-12">
        <div class="portlet box green-haze" style="position:relative">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-user"></i> Nama Pasien
                </div>
            </div>
            <div class="portlet-body form">

               	<form class="form-horizontal form-bordered form-row-stripped" role="form">
                    <div class="form-body">
                        <div class="form-group">
                            <div class="col-md-12">
                                
                                <div class="row">
                                   
                                    <p class="form-control-static col-md-8">
                                        BBMC-<?=$this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'nrm')?> - <?=strtoupper($this->Content_m->get_value('bbmc_tr_pasien','id_re_pasien',$id_re_pasien,'nama_pasien'))?>  / <?=$this->Content_m->get_tipe_pasien($id_re_pasien)?>
                                    </p>
                                </div>
                             
                            </div>
                         
                        </div>                                    
                    </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-body form" id="page-content" style="display:none">
              <!--
              <a href="<?=site_url()?>/front_office/ugd_dir/ugd/edit_pemeriksaan_lab/<?=$keterangan?>"  style="float: right; color:blue; text-decoration: underline;"><b>Edit</b> </a>
              -->


              <form action="<?= site_url('front_office/'.$controller_dir.$controller.'/update_hasil_pemeriksaan') ?>" method="post" enctype="multipart/form-data" class="horizontal-form">
              <input type="hidden" name="id_re_laboratorium" value="<?=$id_re_laboratorium?>">
              <input type="hidden" name="tindakan_lab" value="<?=$tindakan_lab?>">
              <input type="hidden" name="id_re_pasien" value="<?=$id_re_pasien?>">
              <input type="hidden" name="id_re_kunjungan" value="<?=$id_re_kunjungan?>">
                <div class="form-body">
                  <div class="alert alert-danger display-hide" style="display:none;" id="error">
                    <button class="close" data-close="alert"></button>
                    <span id="error-text"></span>
                  </div>


                  <h4 class="form-section" style=" margin:0px 0px 5px 0px !important; padding-bottom:10px !important; font-size:13px !important"><i class="fa fa-flask"></i><strong> Hasil Pemeriksaan </strong><hr style="margin:10px 0px 0px 0px !important"> </h4>
                   <div class="row">
                    <div class="col-md-12">
                      <div class="form-group" id="icd">
                        <div class="table-responsive">
                          	<table id="<?= $controller ?>_tables" class="table table-bordered table-striped table-hover" style="margin-bottom:0px; width:100%; font-size:11px !important">
                              
                              <tbody>
                            	<?php 
                            	$i=0;
                            	$this->db->where('keterangan',$keterangan);
                            	$this->db->order_by('id_re_laboratorium_set');
                            	foreach ($this->Content_m->select_db('bbmc_re_laboratorium_set')->result() as $key ) { ?>
                        		  <tr style="<?=$i==0?'background: silver;':''?> <?=($key->text1=='Makroskopis' || $key->text1 == 'Mikroskopis')?'background: silver; ':''?>">
                          			<!-- INPUT 1 -->
                                <?php if($key->text1 != ''){ ?>
                                <td>
                          			    <?php if($key->text1 == 'select'){ ?>
                                    <select class="sel2" name="text1[]" style="width:100%">
                                      <option value=" ">Pilih ..</option>
                                      <?php 
                                      $this->db->where('keterangan',$keterangan);
                                      foreach ($this->Content_m->select_db('bbmc_re_pilihan_hasil_lab')->result() as $keya ) { ?>
                                        <option value="<?=$keya->pilihan?>"><?=$keya->pilihan?></option>
                                      <?php }?>
                                    </select>
                                    <?php }else if($key->text1 == 'string'){ ?>
                                    <input class="form-control border" type="text" name="text1[]" value=" " placeholder="Ketik disini..">
                                    <?php }else{ ?>
                                    <input style="background: transparent; border: 0px" class="form-control" readonly name="text1[]" value="<?=$key->text1?>" >
                                    <?php }?>
                                </td>
                          			<?php }?>
                                <!-- INPUT 1 -->

                                <!-- INPUT 2 -->
                          			<?php if($key->text2 != ''){ ?>
                          			<td>

                                    <?php if($key->text2 == 'select'){ ?>
                                    <select class="sel2" name="text2[]" style="width:100%">
                                      <option value=" ">Pilih ..</option>
                                      <?php 
                                      if($key->text1 == 'Kristal'){
                                        $this->db->where('keterangan2','Kristal');
                                      }
                                      $this->db->where('keterangan',$keterangan);
                                      foreach ($this->Content_m->select_db('bbmc_re_pilihan_hasil_lab')->result() as $keya ) { ?>
                                        <option value="<?=$keya->pilihan?>"><?=$keya->pilihan?></option>
                                      <?php }?>
                                    </select>
                                    <?php }else if($key->text2 == 'string'){ ?>
                                    <input class="form-control border" type="text" name="text2[]" value=" " placeholder="Ketik hasil disini..">
                                    <?php }else{ ?>
                                    <input style="background: transparent; border: 0px" class="form-control" readonly name="text2[]" value="<?=$key->text2?>" >
                                    <?php }?>
                                </td>
                          			<?php }?>
                                <!-- INPUT 2 -->

                                <!-- INPUT 3 -->
                          			<?php if($key->text3 != ''){ ?>
                          			<td>
                                    <?php if($key->text3 == 'select'){ ?>
                                    <select class="sel2" name="text3[]" style="width:100%">
                                      <option value=" ">Pilih ..</option>
                                      <?php 
                                      $this->db->where('keterangan',$keterangan);
                                      foreach ($this->Content_m->select_db('bbmc_re_pilihan_hasil_lab')->result() as $keya ) { ?>
                                        <option value="<?=$keya->pilihan?>"><?=$keya->pilihan?></option>
                                      <?php }?>
                                    </select>
                                    <?php }else if($key->text3 == 'string'){ ?>
                                    <input class="form-control border" type="text" name="text3[]" value=" " placeholder="Ketik disini..">
                                    <?php }else{ ?>
                                    <!--
                                    <input style="background: transparent; border: 0px" class="form-control" readonly name="text3[]" value="<?=$key->text3?>" >
                                    -->
                                    <input class="form-control border"  style="background: transparent;" type="text" name="text3[]" value="<?=$key->text3?>" placeholder="Ketik disini..">
                                    
                                    <?php }?>
                                </td>
                          			<?php }?>
                                <!-- INPUT 3 -->

                                <!-- INPUT 4 -->
                                <?php if($keterangan == 'widal'){ ?>
                                    
                                    <?php if($i == '0'){ ?>
                                    <td>
                                    <input class="form-control border"  style="background: transparent;" type="text" name="text4[]" value="<?=$key->text4?>" placeholder="Ketik disini..">
                                    </td>
                                    <?php }else if($i == '1'){ ?>
                                    <td rowspan="4">
                                    <textarea name="text4[]" style="width: 100%; height: 200px; font-size: 14px; padding: 10px; border:1px solid silver"><?=$key->text4?></textarea>
                                    </td>
                                    <?php }?>
                                  
                                

                                <?php }else{ ?>
                                <?php if($key->text4 != ''){ ?>
                          			<td>
                                    <?php if($key->text4 == 'select'){ ?>
                                    <select class="sel2" name="text4[]" style="width:100%">
                                      <option value=" ">Pilih ..</option>
                                      <?php 
                                      $this->db->where('keterangan',$keterangan);
                                      foreach ($this->Content_m->select_db('bbmc_re_pilihan_hasil_lab')->result() as $keya ) { ?>
                                        <option value="<?=$keya->pilihan?>"><?=$keya->pilihan?></option>
                                      <?php }?>
                                    </select>
                                    <?php }else if($key->text4 == 'string'){ ?>
                                    <input class="form-control border" type="text" name="text4[]" value=" " placeholder="Ketik disini..">
                                    <?php }else{ ?>

                                    <!--
                                    <input style="background: transparent; border: 0px" class="form-control" readonly name="text4[]" value="<?=$key->text4?>" >
                                    -->

                                    <input class="form-control border"  style="background: transparent;" type="text" name="text4[]" value="<?=$key->text4?>" placeholder="Ketik disini..">
                                    
                                    <?php }?>
                                </td>
                          			<?php }?>
                                <!-- INPUT 4 -->

                                <!-- INPUT 5 -->
                          			<?php if($key->text5 != ''){ ?>
                          			<td>
                                    <?php if($key->text5 == 'select'){ ?>
                                    <select class="sel2" name="text5[]" style="width:100%">
                                      <option value=" ">Pilih ..</option>
                                      <?php 
                                      $this->db->where('keterangan',$keterangan);
                                      foreach ($this->Content_m->select_db('bbmc_re_pilihan_hasil_lab')->result() as $keya ) { ?>
                                        <option value="<?=$keya->pilihan?>"><?=$keya->pilihan?></option>
                                      <?php }?>
                                    </select>
                                    <?php }else if($key->text5 == 'string'){ ?>
                                    <input class="form-control border" type="text" name="text5[]" value=" " placeholder="Ketik disini..">
                                    <?php }else{ ?>
                                    <!--
                                    <input style="background: transparent; border: 0px" class="form-control" readonly name="text5[]" value="<?=$key->text5?>" >
                                    -->
                                    <input class="form-control border"  style="background: transparent;" type="text" name="text5[]" value="<?=$key->text5?>" placeholder="Ketik disini..">
                                    
                                    <?php }?>
                                </td>
                          			<?php }?>
                                <?php }?>
                                <!-- INPUT 5 -->
                          		</tr>
                              <?php $i++;}?> 
                                
                              </tbody>
                            </table>            
                        </div>
                      </div> 
                    </div>
                  </div>
                  <br>
                  
                
                <div class="form-actions right">
                
                  <a type="button" class="btn default" href="<?= site_url('front_office/ugd_dir/ugd/tmbh_pemeriksaan/'.$id_re_pasien.'/'.$id_re_kunjungan.'/pemeriksaan_lab') ?>">Kembali</a>
                  <button type="submit" class="btn blue"><i class="fa fa-check"></i> Simpan</button>
                </div>
              </form>
            </div>
            <?php $this->load->view('front_office/include/loading');?>
        </div>
    </div>
</div>

<script type="text/javascript">
	$(document).ready(function() {
     /*-------------Datepicker-------------*/
     $('#datepicker_keluar_ugd').datepicker({
      format: "yyyy-mm-dd",
      clearBtn: true,
      language: 'id',
      autoclose: true,
      todayHighlight: true
    });


    $(".sel2").select2({
      placeholder: "Pilih ..",
      language: "id"
    });


    
       
    $("#loading-content,#loading").fadeOut("fast", function() {
      $("#page-content").fadeIn("fast");
    });

  });
</script>
<?php $this->load->view('front_office/script/form_data'); ?>
