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

<xf:form action="{{ link('logs/cookie-consent') }}" class="block">
	<div class="block-container">
		<div class="block-body block-row">
			<xf:textbox name="username" value="{{ $limitUser ? $limitUser.username : '' }}"
				ac="single" class="input--inline"
				placeholder="{{ phrase('user_name...') }}" />

			<xf:textbox name="ip" value="{$limitIp}"
				type="search" class="input--inline"
				placeholder="{{ phrase('ip_address...') }}" />

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

<xf:if is="$entries is not empty">
	<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('user') }}</xf:cell>
						<xf:cell>{{ phrase('ip_address') }}</xf:cell>
						<xf:cell>{{ phrase('date') }}</xf:cell>
						<xf:cell>{{ phrase('consented_groups') }}</xf:cell>
					</xf:datarow>

					<xf:foreach loop="$entries" value="$entry">
						<xf:datarow>
							<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.log_date}" /></xf:cell>

							<xf:cell>
								<div>
									<a href="{{ link('logs/cookie-consent', $entry) }}" data-xf-click="overlay">
										<ul class="listInline listInline--comma">
											<xf:foreach loop="$entry.consented_groups" value="$consentedGroup"><xf:trim>
												<li>{{ $xf.cookieConsent.getGroupLabel($consentedGroup) }}
											</xf:trim></xf:foreach>
										</ul>
									</a>
								</div>
							</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/cookie-consent" params="{$linkFilters}"
			wrapperclass="block-outer block-outer--after" />
	</div>
<xf:else />
	<div class="blockMessage">{{ phrase('no_entries_have_been_logged') }}</div>
</xf:if>