{% extends "base.html" %}
{% block title %}{{lang.menu_links.logs.h2}} {{service_name}}{% endblock %}
{% block h2 %}{{lang.menu_links.logs.h2}} {{service_name}}{% endblock %}
{% block content %}	
{% from 'include/input_macros.html' import input, checkbox %}
<script src="/inc/users.js"></script>
<input type="hidden" id="service" value="{{service}}" />
<table class="overview">
	<tr class="overviewHead">
		<td class="padding10 first-collumn" style="width: 10%;">
			{{lang.words.server|title()}}
		</td>
		{% if not waf %}
		<td style="width: 10%;">{{lang.words.log|title()}} {{lang.words.files|title()}}</td>
		{% endif %}
		{% if service != 'nginx' %}
		{% endif %}
		<td style="width: 10%;">{{lang.words.number|title()}} {{lang.words.rows}}</td>
		<td class="help_cursor" style="width: 10%;" title="" data-help="{{lang.phrases.find_in_log}}">{{lang.words.find|title()}}</td>
		<td class="help_cursor" style="width: 10%;" title="" data-help="{{lang.phrases.exclude_in_log}}">{{lang.words.exclude|title()}}</td>
		<td style="width: 10%;">
			<label for="time_range_out_hour" style="padding: 0">{{lang.words.time_range|title()}}:</label>
			{{ input('time_range_out_hour', value=hour, class='time-range', readonly='readonly') }}:{{ input('time_range_out_minut', value=minut, class='time-range', readonly='readonly') }}
			{{ input('time_range_out_hour1', value=hour1, class='time-range', readonly='readonly') }}:{{ input('time_range_out_minut1', value=minut1, class='time-range', readonly='readonly') }}	
		</td>
		<td></td>
	</tr>
	<tr>
		<td class="padding10 first-collumn" style="width: 10%;">
			<form action="" method="post" id="show_log_form">
				{% include 'include/select.html' %}
		</td>
		{% if not waf %}
		<td id="remote_log_files"></td>
		{% endif %}
		<td style="width: 10%;">
			{{ input('rows', type='number', value=rows, required='required', style='width: 110px;') }}
		</td> 
		<td style="width: 10%;">
			{{ input('grep', value=grep, style='width: 110px;') }}
		</td>
		<td style="width: 10%;">
			{{ input('exgrep', value=exgrep, style='width: 110px;') }}
		</td>
		<td style="width: 10%;">
			<div id="time-range"></div>			
		</td>			
		<td class="padding10 first-collumn" style="width: 1%;">
			<button type="submit" name="Show log" value="Show" id="show_log_button">{{lang.words.show|title()}}</button>
			</form>
		</td>
	</tr>
</table>
<div id="ajax"></div>
<script>
		{% if waf %}
			$('#waf').prop('checked', true);
		{% endif %}
		{% if not waf %}
			{% if remote_file %}
				showLog()
			{% else %}
				showRemoteLogFiles()
				$( "#serv" ).on('selectmenuchange',function() {
					showRemoteLogFiles();
				});
			{% endif %}
		{% else %}
			showLog()
		{% endif %}

		if (window.matchMedia('(max-width: 786px)').matches || window.matchMedia('(max-width: 1024px)').matches || window.matchMedia('(max-width: 667px)').matches) {
				$( "#serv" ).selectmenu({
				  width: 150
			});
			$( "#log_files" ).selectmenu({
				  width: 150
			});
		}
</script>
{% endblock %}
