<div class="container-fluid">
	
<?= $this->session->flashdata('pesan') ?>

	<h4>Pesanan</h4>

	<table class="table table-bordered table-striped table-hover">
		<tr>
			<th><center>Invoice</center></th>
			<th><center>Tanggal Pesan</center></th>
			<th><center>Total</center></th>
			<th><center>Status</center></th>
			<th><center>Bukti Kwitansi</center></th>
		</tr>

		<?php 
		$no=1;
		foreach ($inv as $items) : ?>
		
		<tr>
			
			<td><center><?php echo $items['id']		?></center></td>
			<td><center><?php echo $items['tgl_pesan']  		?></center></td>
			<td align="right">Rp. <?php echo number_format($items['hargaa'], 0,',','.') ?></td>
			<td align="right">
				<?php if($items['ket']==-1):?>
					<a class="badge badge-warning">Akan Dicek</a>
					<?php elseif($items['ket']==0):?>
						<a class="badge badge-danger">Perlu Dibayar</a>
						<?php else:?>
							<a href="#" class="badge badge-success">LUNAS</a>
							<?php endif;?>
						</td>
			<td align="center">
			<?php if($items['ket']==1):?>
			<a href="#" class="badge badge-success" >TERVALIDASI</a>
			<?php else:?>
			<a href="<?= base_url('dashboard/bukti/'.$items['id']) ?>" data-toggle="modal" data-target="<?= '#upload'.$items['id'] ?>" class="btn btn-sm btn-primary"> Upload Bukti</a></td>
			<?php endif;?>

		</tr>	
		
		<?php endforeach; ?>

	</table>

</div>
<?php foreach ($inv as $items) :?>
<!-- Modal -->
<div class="modal fade" id="<?= 'upload'.$items['id'] ?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Upload Bukti</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
        	<span area-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        
        	<form action=" <?php echo base_url('dashboard/bukti/'.$items['id']); ?>" method="post" enctype="multipart/form-data">
        		
        		<div class="form-group">
        			<label>Invoice</label>
        			<input type="text" name="id" readonly value="<?=$items['id'] ?>" class="form-control">
        		</div>
        		<div class="form-group">
        			<label>Rekening</label>
        			<input type="text" readonly value="<?=$items['rekening'] ?>" class="form-control">
        		</div>
        		<div class="form-group">
        			<label>Total Pembayaran</label>
        			<input type="text" readonly value="<?=$items['harga']+$items['keuntungan'] ?>" class="form-control">
        		</div>

        		<div class="form-group">
        			<label>Bukti</label><br>
        			<input type="file" name="gambar" class="form-control">
        		</div>	
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary">Simpan</button>
      </div>

      </form>
    </div>
  </div>
</div>
<?php endforeach?>