{% extends '../template.html' %}
{% block title %}Report - Call History{% endblock %}
{% block subcontent %}
<h1>Report - Call History</h1>

<form>
	<select name="type">
		<option {% if type == "daily" %}selected="selected"{% endif %} value="daily">Daily</option>
		<option {% if type == "weekly" %}selected="selected"{% endif %} value="weekly">Weekly</option>
		<option {% if type == "monthly" %}selected="selected"{% endif %} value="monthly">Monthly</option>
	</select>
	<span {% if type != "daily" %}style="display:none;"{% endif %} class="daily">
		- 
		{% date daily year[2011-2030] %}
	</span>
	<span {% if type != "weekly" %}style="display:none;"{% endif %} class="weekly">
		- <select name="weekly_date">
			<option {% if data.weekly_date == "1" %}selected="selected"{% endif %} value="1">1st week</option>
			<option {% if data.weekly_date == "8" %}selected="selected"{% endif %} value="8">2nd week</option>
			<option {% if data.weekly_date == "15" %}selected="selected"{% endif %}  value="15">3rd week</option>
			<option {% if data.weekly_date == "22" %}selected="selected"{% endif %} value="22">4th week</option>
			<option {% if data.weekly_date == "29" %}selected="selected"{% endif %} value="29">5th week</option>
		</select>
		{% date weekly year[2011-2030] nodate %}
	</span>
	<span {% if type != "monthly" %}style="display:none;"{% endif %} class="monthly">
		- {% date monthly year[2011-2030] nodate %}
	</span>
	<input type="submit" value="Go"/>
</form><br/>
<table class="data">
	<tr>
		<th>Tgl</th>
		<th>Telepon</th>
		<th style="width:100px">Nama</th>
		<th>Jenis</th>
	</tr>
	{% for d in report %}
	<tr>
		<td>{{d.date}}</td>
		<td>{{d.telepon}}</td>
		<td>{{d.nama}}</td>
		<td>{{d.jenis}}</td>
	</tr>
	{% endfor %}
</table>

{% for p in page %}
<a href="{{ p.link }}{% if get.length > 1 %}&type={{get.type}}&daily_date={{get.daily_date}}&daily_month={{get.daily_month}}&daily_year={{get.daily_year}}&weekly_date={{get.weeky_date}}&weekly_month={{get.weekly_month}}&weekly_year={{get.weekly_year}}&monthly_month={{get.monthly_month}}&monthly_year={{get.monthly_year}}{% endif %}" class="{% if p.active == 'yes' %}active{% endif %} page">{{ p.number }}</a>
{% endfor %}

{% endblock %}
{% block script %}
<script type="text/javascript">
	$(document).ready(function() {
		$("select[name=type]").change(function() {
			if ($(this).val() == "daily") {
				$(".daily").show();$(".weekly").hide();$(".monthly").hide();
			}
			else if ($(this).val() == "weekly") {
				$(".daily").hide();$(".weekly").show();$(".monthly").hide();
			}
			else if ($(this).val() == "monthly") {
				$(".daily").hide();$(".weekly").hide();$(".monthly").show();
			}
		});
	});
</script>
{% endblock %}