<div class="container-fluid">
	<h4>Invoice Pemesanan Produk</h4>
	<form method="post">
		<div class="row">
			<div class="col-md-3">
				<label>Dari Tanggal</label>
				<input type="date" value="<?= $tgl1 ?>" class="form-control" name="tgl1">
		</div>
		<div class="col-md-3">
				<label>Sampai Tanggal</label>
				<input type="date" class="form-control" value="<?= $tgl2 ?>" name="tgl2">
		</div>
		<div class="col-md-2">
			<label>Status Pembayran</label>
			<select class="form-control" name="ket">
					<option disabled selected>-Pilih Status-</option>
					<option value="1" <?= $status == 1? 'selected':'' ?>>LUNAS</option>
					<option value="0" >BELUM LUNAS</option>
			</select>
		</div>
		<div class="col-md-2">
			<label>&nbsp;</label><br>
			<button type="submit" class="btn btn-sm btn-primary mb-4">Lihat Pesanan</button>
		</div>
	</form>

	<form class="mt-4" action="<?= base_url('admin/invoice/printe') ?>" method="post">
	<input type="hidden" name="tgl1" value="<?= $tgl1 ?>">
	<input type="hidden" name="tgl2" value="<?= $tgl2 ?>">
	<button type="submit" class="btn btn-sm btn-info mt-2">Cetak Laporan</button>
	</form>

<?php if($invoice != null):?>
	<table class="table table-bordered table-hover table-striped">
		<tr>
			<th><center>Tanggal Pemesanan</center></th>
			<th><center>Nama Pemesanan</center></th>
			<th><center>Alamat Pengiriman</center></th>
			<th><center>Batas Pembayaran</center></th>
			<th><center>Keterangan</center></th>
			<th><center>Nomor Tlp.</center></th>
			<th><center>Pengiriman</center></th>
			<th><center>Rekening</center></th>
			<th align="center" colspan="2"><center>Aksi</center></th>
		</tr>

		<?php foreach ($invoice as $inv):  ?>
		<tr>
			<td><?php echo $inv->tgl_pesan ?></td>
			<td><?php echo $inv->nama ?></td>
			<td><?php echo $inv->alamat ?></td>
			<td><?php echo $inv->batas_bayar ?></td>
			<td>
			<?php if($inv->ket == 1):?>
			<a onclick="return confirm('Apakah transaksi belum lunas?')" href="<?= base_url('admin/invoice/ket/'.$inv->id.'/0') ?>" class="badge badge-success">LUNAS</a></td>
			<?php elseif($inv->ket == 0):?>
			<a onclick="return confirm('Apakah transaksi telah lunas?')" href="<?= base_url('admin/invoice/ket/'.$inv->id.'/1') ?>" class="badge badge-danger">BELUM LUNAS</a></td>
			<?php else:?>
			<a class="badge badge-warning">PERLU DI CEK</a></td>
			<?php endif;?>
			<td><?=$inv->nomor?></td>
			<td><?=$inv->pengiriman?></td>
			<td><?=$inv->rekening?></td>
			<td> <?php echo anchor('admin/invoice/detail/' .$inv->id, '<div class="btn btn-sm btn-primary">Detail</div>') ?></td>
			<td><a onclick="return confirm('apakah yakin akan menghapus data ini?')" href="<?= base_url('admin/invoice/hapus/'.$inv->id)?>"><div class="btn btn-danger btn-sm"><i class="fa fa-trash" ></i></div></a></td>
		</tr>
	<?php endforeach; ?>
	</table>
	<?php else:?>
		<h1>Hasil Tidak Ditemukan</h1>
	<?php endif;?>
</div>