{% extends 'template.html' %}
{% block subcontent %}
<h1>Report - Pemasukan</h1>
<h2><input type="text" id="date_picker" value="{{tgl}}"></h2>

{% if data.length > 0 %}
	<table class="orderhistory data">
		<tr>
			<th>Pasien</th>
			<th>Poli</th>
			<th>Dokter</th>
			<th>Pemeriksaan</th>
			<th>Total</th>
			<th>Jns. Kel.</th>
			<th>Golongan</th>
			<th style="width:80px">Status</th>
			<th></th>
		</tr>
		{% for row in data %}
			<tr class="kunjungan_{{row.id}} orders" valign="top">
				<td>{{row.no_kunjungan}}</td>
				<td>{{row.jam}}</td>
				<td>{{row.no_rekmed}}</td>
				<td><abbr title="Alamat : {{row.alamat}} , Telp. {{row.tlp}}">{{row.nama}}</abbr></td>
				<td>{{row.usia}}</td>
				<td>{{row.sex}}</td>
				<td>{{row.golongan}}</td>
				<td class="status">{{row.status}}</td>
				<td class="histori_options">
					<button class="lanjut btn btn-success" idk="{{row.id}}">Periksa</button>
				</td>
			</tr>
		{% endfor %}
	</table>
	<div id="current_time" year="{{current.year}}" month="{{current.mon}}" day="{{current.mday}}" hour="{{current.hours}}" minute="{{current.minutes}}" second="{{current.seconds}}"></div>
	{% else %}
		- Kunjungan Masih Kosong -<br/><br/>
	{% endif %}

{% endblock %}
{% block script %}
<script type="text/javascript" src="{% nav public %}js/glDatePicker.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$("#date_picker").glDatePicker({
			cssName: "android",
			selectedDate:new Date("{{tgl_js}}"),
			startDate: new Date("{{tgl_js}}"),
		    allowOld: true,
			onChange: function(target, newDate)
				{
					var month= ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Des"];
					target.val
					(
						newDate.getDate()  + "-" +
						month[newDate.getMonth()] + "-" +
						newDate.getFullYear() 
					);
					
					location.href = "{% nav bendahara_pemasukan %}?tgl=" + newDate.getDate()  + "-" + (newDate.getMonth() + 1) + "-" + newDate.getFullYear();
				}
		});
	});
</script>
{% endblock %}