<!-- Main content -->
<section class="content">
<!-- Info boxes -->
<div class="row">
	<?php foreach($poli as $k=>$data_poli): ?>
	<?php
		$no=$k+1;
		if ($no%4==1) {
			$bgColor='bg-green';
		} else if ($no%4==2) {
			$bgColor='bg-aqua';
		} else if ($no%4==3) {
			$bgColor='bg-yellow';
		} else {
			$bgColor='bg-red';
		}
	?>
	<div class="col-md-3 col-sm-6 col-xs-12">
		<div class="small-box <?php echo $bgColor; ?>">
			<div class="inner">
				<?php $antrian=@get_antrian($data_poli->id_poli); ?>
				<h5>No. Antrian Sekarang</h5>
				<h3><?php echo @$data_poli->antrian_saat_ini; ?></h3>
				<p><?php echo $data_poli->nama_poli; ?></p>
			</div>
			<div class="icon">
				<i class="fa fa-briefcase"></i>
			</div>
			<div class="row" style="text-align:center;">
				<div class="col-md-12">
					<h6>No. Antrian Saya</h6>
					<?php echo @$antrian['no_antrian']; ?>
					<p>
						<?php
							$estimasi_waktu=0;
							$no_antrian_saya = @$antrian['no_antrian'];
							$no_antrian_sekarang = @$data_poli->antrian_saat_ini;
							if ($no_antrian_saya>0 && $no_antrian_sekarang>0) {
								if ($no_antrian_saya > $no_antrian_sekarang) {
									$estimasi_waktu = ($no_antrian_saya-$no_antrian_sekarang)*10;
								}
							}
							if (!empty($no_antrian_saya) AND $no_antrian_saya!='-') {
								echo "Estimasi Waktu Kedatangan: ".$estimasi_waktu.' Menit';
							} else {
								echo "&nbsp;";
							}
						?>
					</p>
				</div>
				<!-- <div class="col-md-6">
					<h6>Total Antrian</h6>
					<?php //echo @$antrian['total_antrian']; ?>
				</div> -->
			</div>
			<?php  //echo base_url('antrian/tambah/'.@$data_poli->id_poli) ?>
			<?php if (!empty($no_antrian_saya) AND $no_antrian_saya!='-') { ?>

			<a href="#" class="small-box-footer" data-toggle="modal" data-target="#exampleModal">
				Konfirmasi Kehadiran <i class="fa fa-arrow-right"></i>
			</a>
		<?php }else{ ?>
			<a href="<?php echo base_url('pasien/index/'.@$data_poli->id_poli); ?>" class="small-box-footer">
				Ambil Antrian <i class="fa fa-arrow-right"></i>
			</a>
		<?php } ?>

		</div>
	</div>
	<?php if ($no%2==0): ?>
	<div class="clearfix visible-sm-block"></div>
	<?php endif; ?>
	<!-- /.col -->
	<?php endforeach; ?>
</div>
<!-- /.row -->
</section>
<!-- /.content -->


<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h2 class="modal-title" id="exampleModalLabel" style="text-align:center;">Untuk Scan Di Klinik</h2>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <p style="text-align : center;"><img src="<?=base_url();?>template/dist/img/frame.png"></p>
        <table class="center">
        	<tr>
					    <th></th>
					    <th></th>
					    <th></th>
				  </tr>
				  <tr>
					    <th>Nama Pasien</th>
					    <th>:</th>
					    <th><?php echo @get_pasien()['username'];?></th>
				  </tr>
				  <tr>
					    <th>No. Bpjs</th>
					    <th>:</th>
					    <th><?php echo @get_pasien()['nik'];?></th>
				  </tr>
			</table>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>

<style>
table, th, td {
  border-bottom: 1px solid black;
  border-collapse: collapse;
  width: 50%;
}

table.center {
  margin-left: auto; 
  margin-right: auto;
}
</style>