<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

<div class="table-responsive">
  <table id="example1" class="table table-sm table-bordered table-striped">
    <thead>
      <tr>
        <th>No</th>
        <th>Tgl Kunjungan</th>
        <th>Kunjungan</th>
        <th>Keluhan dan Diagnosa</th>
        <th>Pemeriksaan Fisik</th>
        <th>Status Pulang</th>
      </tr>
    </thead>
    <tbody>
      <?php 
      $urut = 0; foreach ($data['result']['list'] as $key){ $urut++; ?>
        <tr>
          <td><?php echo $urut ?></td>
          <td><?php echo $key['tglKunjungan'] ?></td>
          <td><?php $noKunjungan = $key['noKunjungan']; echo $noKunjungan;  ?><br> <b>No Kartu</b> : <?php echo $key['peserta']['noKartu'] ?><br><b>Pelayanan </b>: <?php echo $key['providerPelayanan']['kdProvider'].' - '.$key['providerPelayanan']['nmProvider'] ?><br><b>Poli</b> : <?php echo $key['poli']['kdPoli'].' - '.$key['poli']['nmPoli'] ?><br><b>Kesadaran</b> : <?php echo $key['kesadaran']['kdSadar'].' - '.$key['kesadaran']['nmSadar'] ?></td>
          <td>
            <table border="0" width="100%">
              <tr>
                <td colspan="3"><b>Keluhan:</b> <?php $keluhan = $key['keluhan']; echo $keluhan ?></td>
              </tr>
              <tr>
                <td>1</td>
                <td> : </td>
                <td><?php echo $key['diagnosa1']['kdDiag'].' - '.$key['diagnosa1']['nmDiag'] ?></td>
              </tr>
              <tr>
                <td>2</td>
                <td> : </td>
                <td><?php echo $key['diagnosa2']['kdDiag'].' - '.$key['diagnosa2']['nmDiag'] ?></td>
              </tr>
              <tr>
                <td>3</td>
                <td> : </td>
                <td><?php echo $key['diagnosa3']['kdDiag'].' - '.$key['diagnosa3']['nmDiag'] ?></td>
              </tr>
            </table>
          </td>            
          <td width="150px">
            <table border="0" width="100%">
              <tr>
                <td>Sistole</td>
                <td> : </td>
                <td><?php $sistole = $key['sistole']; echo $sistole; ?></td>
              </tr>
              <tr>
                <td>Diastole</td>
                <td> : </td>
                <td><?php $diastole = $key['diastole']; echo $diastole; ?></td>
              </tr>
              <tr>
                <td>Tinggi Badan</td>
                <td> : </td>
                <td><?php $tinggiBadan = $key['tinggiBadan']; echo $tinggiBadan; ?></td>
              </tr>
              <tr>
                <td>Berat Badan</td>
                <td> : </td>
                <td><?php $beratBadan = $key['beratBadan']; echo $beratBadan; ?></td>
              </tr>
              <tr>
                <td>Resp Rate</td>
                <td> : </td>
                <td><?php $respRate = $key['respRate']; echo $respRate; ?></td>
              </tr>
              <tr>
                <td>Heart Rate</td>
                <td> : </td>
                <td><?php $heartRate = $key['heartRate']; echo $heartRate; ?></td>
              </tr>
            </table>
          </td>
          <td>
            <?php echo $key['statusPulang']['kdStatusPulang'].' - '.$key['statusPulang']['nmStatusPulang'] ?><br><b>Rujuk Lanjut</b> : <?php echo $key['providerRujukLanjut']['kdProvider'].' - '.$key['providerRujukLanjut']['nmProvider'] ?><br><b>Poli</b> : <?php echo $key['poliRujukLanjut']['kdPoli'].' - '.$key['poliRujukLanjut']['nmPoli'] ?>
            <br><a class="btn btn-sm btn-default" onclick="ambil_riwayat_kunjungan('<?php echo $keluhan ?>', '<?php echo $sistole ?>', '<?php echo $diastole ?>', '<?php echo $beratBadan ?>', '<?php echo $tinggiBadan ?>', '<?php echo $respRate ?>', '<?php echo $heartRate ?>')"><i class="fas fa-download"> Copy data</i></a>
            <?php if($key['providerRujukLanjut']['kdProvider'] != ''){ ?>
              <a class="btn btn-sm btn-default" onclick="print_rujukan('<?php echo $noKunjungan ?>')"><i class="fas fa-print"> Print Rujukan</i></a>
            <?php } ?>
          </td>
        </tr>
      <?php } ?>
    </tbody>
  </table>
</div>