<xf:title>{{ phrase('admin_log') }}</xf:title>

<xf:form action="{{ link('logs/admin') }}" class="block">
	<div class="block-container">
		<div class="block-body block-row">
			<span>
				{{ phrase('filter_by_user:') }}
				<xf:select name="user_id" value="{$userId}" class="input--inline">
					<xf:option value="0">{{ phrase('any') }}</xf:option>
					<xf:options source="$logUsers" />
				</xf:select>
			</span>

			<xf:button type="submit">{{ phrase('filter') }}</xf:button>
		</div>
	</div>
</xf:form>

<xf:if is="$entries">
	<div class="block">
		<div class="block-container">
			<div class="block-body">
				<xf:datalist data-xf-init="responsive-data-list">
					<xf:datarow rowtype="header">
						<xf:cell>{{ phrase('action') }}</xf:cell>
						<xf:cell>{{ phrase('user') }}</xf:cell>
						<xf:cell>{{ phrase('ip_address') }}</xf:cell>
						<xf:cell>{{ phrase('date_time') }}</xf:cell>
					</xf:datarow>
					<xf:foreach loop="$entries" value="$entry">
						<xf:datarow>
							<xf:cell class="u-ltr"><a href="{{ link('logs/admin', $entry) }}" data-xf-click="overlay">{$entry.request_url_short}</a></xf:cell>
							<xf:cell><xf:username user="$entry.User" href="{{ link('users/edit', $entry.User) }}" /></xf:cell>
							<xf:cell class="u-ltr">{{ $entry.ip_address ? $entry.ip_address|ip : '' }}</xf:cell>
							<xf:cell><xf:date time="{$entry.request_date}" /></xf:cell>
						</xf:datarow>
					</xf:foreach>
				</xf:datalist>
			</div>
			<div class="block-footer">
				<span class="block-footer-counter">{{ display_totals($entries, $total) }}</span>
			</div>
		</div>
		<xf:pagenav page="{$page}" perpage="{$perPage}" total="{$total}"
			link="logs/admin" params="{$linkFilters}"
			wrapperclass="block-outer block-outer--after" />
	</div>
<xf:else />
	<div class="blockMessage">{{ phrase('no_entries_have_been_logged') }}</div>
</xf:if>