{% extends "base.html" %}
{% block content %}	
{% if onclick == 'showApacheLog()' %}
<script src="/inc/users.js"></script>
{% endif %}
<table class="overview">
	<tr class="overviewHead">
		<td class="padding10 first-collumn" style="width: 10%;">
			{% if onclick == 'showApacheLog()' %}
				Log
			{% else %}
				Server
			{% endif %}
		</td>
		<td style="width: 10%;">Number rows</td>
		<td class="padding10" style="width: 10%;">Ex for grep</td>
		<td style="width: 10%;">
			<label for="time_range_out_hour">Time range:</label>
			<input type="text" id="time_range_out_hour" readonly class="time-range">:<input type="text" id="time_range_out_minut" readonly class="time-range"> -
			<input type="text" id="time_range_out_hour1" readonly class="time-range">:<input type="text" id="time_range_out_minut1" readonly class="time-range">	
		</td>
		<td style="width: 10%;"> </td>
	</tr>
	<tr>
		<td class="padding10 first-collumn" style="width: 10%;">
			<form action="logs.py" method="get">
				<select autofocus required name="serv" id="{{ select_id }}">					
					{% if onclick == 'showApacheLog()' or onclick == 'viewLogs()' %}
						<option disabled selected>Choose log</option>
						{% for select in selects %}
							{% if select.2 == serv %}
								<option value="{{ select.0 }}" selected>{{ select.1 }}</option>
							{% else %}
								<option value="{{ select.0 }}">{{ select.1 }}</option>
							{% endif %}
						{% endfor %}
					{% else %}
						<option disabled selected>Choose server</option>
						{% for select in selects %}						
							{% if select.2 == serv %}
								<option value="{{ select.2 }}" selected>{{ select.1 }}</option>
							{% else %}
								<option value="{{ select.2 }}">{{ select.1 }}</option>
							{% endif %}
						{% endfor %}
					{% endif %}
				</select>
		</td>
		<td class="padding10" style="width: 10%;">
			<input type="number" name="rows" id="rows" value="{{ rows }}" class="form-control" required>
		</td> 
		<td class="padding10" style="width: 10%;">
			<input type="text" name="grep" id="grep" class="form-control" value="{{ grep }}" >
		</td>
		<td class="padding10" style="width: 10%;">
			<div id="time-range"></div>			
		</td>			
		<td class="padding10 first-collumn" style="width: 10%;">
			<a class="ui-button ui-widget ui-corner-all" id="show" title="Show logs" onclick="{{ onclick }}">Show</a>
			</form>
		</td>
	</tr>
</table>
<div id="ajax">
</div>
<script>
	{% if onclick == 'showApacheLog()' %}
		window.onload = showApacheLog()
		$('#serv').on('selectmenuchange',function() {
			showApacheLog();
		});
	{% else %}
		window.onload = showLog()
		$('#serv').on('selectmenuchange',function() {
			showLog();
		});
	{% endif %}	
</script>

{% endblock %}