{% include 'mcp_header.html' %}

<section class="iz-card iz-card--mcp" aria-labelledby="iz-mcp-logs-title">
	<header class="iz-card__header">
		<h2 class="iz-card__title" id="iz-mcp-logs-title">{{ L_TITLE }}</h2>
	</header>

	<div class="iz-card__body">
		<form method="post" id="mcp" class="iz-form" action="{{ U_POST_ACTION }}">
			<div class="iz-toolbar" role="region" aria-label="{{ L_SEARCH }}">
				<div class="iz-toolbar__left">
					<div class="iz-field iz-field--search">
						<label class="iz-label" for="search_keywords">{{ L_SEARCH_KEYWORDS }}{{ L_COLON }}</label>
						<div class="iz-field__row iz-field__row--actions">
							<input class="iz-input" type="text" name="keywords" id="search_keywords" placeholder="{{ L_SEARCH_KEYWORDS }}">
							<button type="submit" class="iz-btn iz-btn--primary">{{ L_SEARCH }}</button>
						</div>
					</div>
				</div>

				<div class="iz-toolbar__right">
					<nav class="iz-pagination" aria-label="{{ L_PAGINATION }}">
						<span class="iz-pagination__meta">{{ TOTAL }}</span>

						{% if pagination %}
							{% include 'pagination.html' %}
						{% else %}
							<span class="iz-pagination__current" aria-current="page">{{ PAGE_NUMBER }}</span>
						{% endif %}
					</nav>
				</div>
			</div>

			<div class="iz-table" role="region" aria-label="{{ L_MODERATOR_LOGS }}">
				<table class="iz-table__table">
					<thead class="iz-table__head">
						<tr class="iz-table__row">
							<th scope="col" class="iz-table__th">{{ L_MCP_DETAIL_U_IP }}</th>
							<th scope="col" class="iz-table__th">{{ L_TIME }}</th>
							<th scope="col" class="iz-table__th iz-table__th--grow">{{ L_ACTION }}</th>
							{% if S_CLEAR_ALLOWED %}
								<th scope="col" class="iz-table__th iz-table__th--choice">{{ L_MARK }}</th>
							{% endif %}
						</tr>
					</thead>

					<tbody class="iz-table__body">
						{% if S_LOGS %}
							{% for log in log %}
							<tr class="iz-table__row">
								<td class="iz-table__td">
									{{ log.USERNAME }}<br>
									{{ log.IP }}
								</td>
								<td class="iz-table__td"><time>{{ log.DATE }}</time></td>
								<td class="iz-table__td">
									<div class="iz-meta">
										<div>{{ log.ACTION }}</div>
										<div class="iz-muted">{{ log.DATA }}</div>
									</div>
								</td>
								{% if S_CLEAR_ALLOWED %}
									<td class="iz-table__td iz-table__td--choice">
										<label class="iz-choice" for="log_{{ log.ID }}">
											<input class="iz-choice__input" type="checkbox" name="mark[]" id="log_{{ log.ID }}" value="{{ log.ID }}">
											<span class="iz-choice__label">{{ L_MARK }}</span>
										</label>
									</td>
								{% endif %}
							</tr>
							{% endfor %}
						{% else %}
							<tr class="iz-table__row">
								<td class="iz-table__td" colspan="{% if S_CLEAR_ALLOWED %}4{% else %}3{% endif %}">{{ L_NO_ENTRIES }}</td>
							</tr>
						{% endif %}
					</tbody>
				</table>
			</div>

			{% if log %}
				<div class="iz-toolbar" role="region" aria-label="{{ L_OPTIONS }}">
					{% if S_CLEAR_ALLOWED %}
						<div class="iz-toolbar__left">
							<fieldset class="iz-actions iz-actions--inline">
								<button class="iz-btn iz-btn--danger" type="submit" name="action[del_all]" title="{{ L_DELETE_ALL }}">
									{{ L_DELETE_ALL }}
								</button>

								{% if not S_CLOSED %}
									<button class="iz-btn iz-btn--danger" type="submit" name="action[del_marked]" title="{{ L_DELETE_MARKED }}">
										{{ L_DELETE_MARKED }}
									</button>
								{% endif %}

								<button class="iz-btn iz-btn--secondary" type="button"
										onclick="marklist('mcp', 'mark', true); return false;"
										title="{{ L_MARK_ALL }}">
									{{ L_MARK_ALL }}
								</button>

								<button class="iz-btn iz-btn--secondary" type="button"
										onclick="marklist('mcp', 'mark', false); return false;"
										title="{{ L_UNMARK_ALL }}">
									{{ L_UNMARK_ALL }}
								</button>
							</fieldset>
						</div>
					{% endif %}

					<div class="iz-toolbar__right">
						<nav class="iz-pagination" aria-label="{{ L_PAGINATION }}">
							<span class="iz-pagination__meta">{{ TOTAL }}</span>

							{% if pagination %}
								{% include 'pagination.html' %}
							{% else %}
								<span class="iz-pagination__current" aria-current="page">{{ PAGE_NUMBER }}</span>
							{% endif %}
						</nav>
					</div>
				</div>

				{{ S_FORM_TOKEN }}
				{% include 'display_options.html' %}
			{% else %}
				{{ S_FORM_TOKEN }}
			{% endif %}
		</form>
	</div>
</section>

{% include 'mcp_footer.html' %}
{% include 'mcp_header.html' %}

<section class="iz-card iz-card--mcp" aria-labelledby="iz-mcp-logs-title">
	<header class="iz-card__header">
		<h2 class="iz-card__title" id="iz-mcp-logs-title">{{ L_TITLE }}</h2>
	</header>

	<div class="iz-card__body">
		<form method="post" id="mcp" class="iz-form" action="{{ U_POST_ACTION }}">
			<div class="iz-toolbar" role="region" aria-label="{{ L_SEARCH }}">
				<div class="iz-toolbar__left">
					<div class="iz-field iz-field--search">
						<label class="iz-label" for="search_keywords">{{ L_SEARCH_KEYWORDS }}{{ L_COLON }}</label>
						<div class="iz-field__row iz-field__row--actions">
							<input class="iz-input" type="text" name="keywords" id="search_keywords" placeholder="{{ L_SEARCH_KEYWORDS }}">
							<button type="submit" class="iz-btn iz-btn--primary">{{ L_SEARCH }}</button>
						</div>
					</div>
				</div>

				<div class="iz-toolbar__right">
					<nav class="iz-pagination" aria-label="{{ L_PAGINATION }}">
						<span class="iz-pagination__meta">{{ TOTAL }}</span>

						{% if pagination %}
							{% include 'pagination.html' %}
						{% else %}
							<span class="iz-pagination__current" aria-current="page">{{ PAGE_NUMBER }}</span>
						{% endif %}
					</nav>
				</div>
			</div>

			<div class="iz-table" role="region" aria-label="{{ L_MODERATOR_LOGS }}">
				<table class="iz-table__table">
					<thead class="iz-table__head">
						<tr class="iz-table__row">
							<th scope="col" class="iz-table__th">{{ L_MCP_DETAIL_U_IP }}</th>
							<th scope="col" class="iz-table__th">{{ L_TIME }}</th>
							<th scope="col" class="iz-table__th iz-table__th--grow">{{ L_ACTION }}</th>
							{% if S_CLEAR_ALLOWED %}
								<th scope="col" class="iz-table__th iz-table__th--choice">{{ L_MARK }}</th>
							{% endif %}
						</tr>
					</thead>

					<tbody class="iz-table__body">
						{% if S_LOGS %}
							{% for log in log %}
							<tr class="iz-table__row">
								<td class="iz-table__td">
									{{ log.USERNAME }}<br>
									{{ log.IP }}
								</td>
								<td class="iz-table__td"><time>{{ log.DATE }}</time></td>
								<td class="iz-table__td">
									<div class="iz-meta">
										<div>{{ log.ACTION }}</div>
										<div class="iz-muted">{{ log.DATA }}</div>
									</div>
								</td>
								{% if S_CLEAR_ALLOWED %}
									<td class="iz-table__td iz-table__td--choice">
										<label class="iz-choice" for="log_{{ log.ID }}">
											<input class="iz-choice__input" type="checkbox" name="mark[]" id="log_{{ log.ID }}" value="{{ log.ID }}">
											<span class="iz-choice__label">{{ L_MARK }}</span>
										</label>
									</td>
								{% endif %}
							</tr>
							{% endfor %}
						{% else %}
							<tr class="iz-table__row">
								<td class="iz-table__td" colspan="{% if S_CLEAR_ALLOWED %}4{% else %}3{% endif %}">{{ L_NO_ENTRIES }}</td>
							</tr>
						{% endif %}
					</tbody>
				</table>
			</div>

			{% if log %}
				<div class="iz-toolbar" role="region" aria-label="{{ L_OPTIONS }}">
					{% if S_CLEAR_ALLOWED %}
						<div class="iz-toolbar__left">
							<fieldset class="iz-actions iz-actions--inline">
								<button class="iz-btn iz-btn--danger" type="submit" name="action[del_all]" title="{{ L_DELETE_ALL }}">
									{{ L_DELETE_ALL }}
								</button>

								{% if not S_CLOSED %}
									<button class="iz-btn iz-btn--danger" type="submit" name="action[del_marked]" title="{{ L_DELETE_MARKED }}">
										{{ L_DELETE_MARKED }}
									</button>
								{% endif %}

								<button class="iz-btn iz-btn--secondary" type="button"
										onclick="marklist('mcp', 'mark', true); return false;"
										title="{{ L_MARK_ALL }}">
									{{ L_MARK_ALL }}
								</button>

								<button class="iz-btn iz-btn--secondary" type="button"
										onclick="marklist('mcp', 'mark', false); return false;"
										title="{{ L_UNMARK_ALL }}">
									{{ L_UNMARK_ALL }}
								</button>
							</fieldset>
						</div>
					{% endif %}

					<div class="iz-toolbar__right">
						<nav class="iz-pagination" aria-label="{{ L_PAGINATION }}">
							<span class="iz-pagination__meta">{{ TOTAL }}</span>

							{% if pagination %}
								{% include 'pagination.html' %}
							{% else %}
								<span class="iz-pagination__current" aria-current="page">{{ PAGE_NUMBER }}</span>
							{% endif %}
						</nav>
					</div>
				</div>

				{{ S_FORM_TOKEN }}
				{% include 'display_options.html' %}
			{% else %}
				{{ S_FORM_TOKEN }}
			{% endif %}
		</form>
	</div>
</section>

{% include 'mcp_footer.html' %}
