{% extends 'template.html' %}
{% block subcontent %}
<h2>List Pembelian</h2>
<div>
	<form method="get">
		<b>Cari: <input type="text" id="find" name="find" value="{{find}}"/></b>
		<input type="submit" value="Go"/>
	</form>
	<br/><br/>
	<a href="{% nav apotik_stock_new %}" class="big_btn">Tambah</a>
	<br/><br/>

	{% if data.length > 0 %}
	<label>Hal : </label>
	<select class="halaman" style="width:50px">
		{% for p in page %}
		<option value="{{ p.link }}" {% if p.active == 'yes' %}selected="selected"{% endif %}>{{ p.number }}</option>
		{% endfor %}
	</select>
	<label> dari {{hal}} halaman</label>
	</br></br>
	<table class="data">
		<tr>
			<th>Nama</th>
			<th>Jenis</th>
			<th>Tgl Beli</th>
			<th>PBF</th>
			<th>batch</th>
			<th>Harga Beli</th>
			<th>Exp Date</th>
			<th>Masuk</th>
			<th>Keluar</th>
			<th>Keterangan</th>
		</tr>
		{% for row in data %}
			<tr>
				<td>{{row.nama}}</td>
				<td>{% if row.jenis == 'u' %}Umum{% else %}Subsidi{% endif %}</td>
				<td>{{row.tgl_beli}}</td>
				<td>{{row.pbf}}</td>
				<td>{{row.batch}}</td>
				<td>{{row.batch}}</td>
				<td>{{row.exp}}</td>
				<td>{{row.masuk}}</td>
				<td>{{row.keluar}}</td>
				<td>{{row.keterangan}}</td>
				<td>
					<a href="{% nav apotik_stock_edit %}/{{ row.id }}" class="btn btn-default"><i class="far fa-edit"></i></a>
					<a onclick="return confirm('Apakah Anda Yakin Ingin Menghapus Data Ini ?');" class="btn btn-default" href="{% nav apotik_stock_del %}/{{ row.id }}"><i class="far fa-trash-alt"></i></a>
				</td>
			</tr>
		{% endfor %}
	</table>
	</br>
	<label>Hal : </label>
	<select class="halaman" style="width:50px">
		{% for p in page %}
		<option value="{{ p.link }}" {% if p.active == 'yes' %}selected="selected"{% endif %}>{{ p.number }}</option>
		{% endfor %}
	</select>
	<label> dari {{hal}} halaman</label>
	{% else %}
		- Data Kosong -<br/><br/>
	{% endif %}
	</br></br>
</div>
{% endblock %}
{% block script %}
<script>
$(document).ready(function () {
    $(function () {
		$('.halaman').on("change", function(){
			window.location = $(this).val();
		});
	});
});
</script>
{% endblock %}