{% extends 'template.html' %}
{% block subcontent %}
<h2>List Obat</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_obat_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>Kode</th>
			<th>Harga Jual</th>
			<th>Subsidi</th>
			<th>Exp Date</th>
			<th></th>
		</tr>
		{% for row in data %}
			<tr>
				<td>{{row.nama}}</td>
				<td>{{row.kode}}</td>
				<td>{{row.harga_jual}}</td>
				<td>{% if row.status == 's' %}ya{% endif %}</td>
				<td>{{row.exp}}</td>
				<td>
					<a href="{% nav apotik_obat_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_obat_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 %}