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

<xf:form action="{{ link('logs/oembed') }}" class="block">
	<div class="block-container">
		<div class="block-body block-row">
			<span>
				<label>{{ phrase('media_provider_is:') }}
				<xf:select name="mediaSiteId" value="{$filters.mediaSiteId}}" class="input--inline">
					<xf:option value=""></xf:option>
					<xf:foreach loop="$mediaSites" value="$mediaSite">
						<xf:option value="{$mediaSite.media_site_id}">{$mediaSite.site_title}</xf:option>
					</xf:foreach>
				</xf:select></label>
			</span>
			<span>
				<label>{{ phrase('ordered_by:') }}
				<xf:select name="order" value="{{ $filters.order ? $filters.order : 'last_request_date' }}"
					class="input--inline">
					<xf:option value="last_request_date">{{ phrase('last_requested') }}</xf:option>
					<xf:option value="first_request_date">{{ phrase('first_requested') }}</xf:option>
					<xf:option value="views">{{ phrase('hits') }}</xf:option>
				</xf:select></label>
			</span>

			<xf:button type="submit">{{ phrase('go') }}</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('media') }}</xf:cell>
						<xf:cell>{{ phrase('hits') }}</xf:cell>
					</xf:datarow>
					<xf:foreach loop="$entries" value="$entry">
						<xf:datarow>
							<xf:cell href="{{ link('logs/oembed', $entry) }}" overlay="true" overlaycache="false">
								<div class="dataList-textRow">
									<b>{$entry.BbCodeMediaSite.site_title}</b>:
									<span dir="auto">{{ $entry.title ? $entry.title : $entry.media_id }}</span>
								</div>
								<div class="dataList-subRow">
									<ul class="listInline listInline--bullet">
										<li>{{ phrase('first_requested:') }} <xf:date time="{$entry.first_request_date}" /></li>
										<li>{{ phrase('last_requested:') }} <xf:date time="{$entry.last_request_date}" /></li>
									</ul>
								</div>
							</xf:cell>
							<xf:cell href="{{ link('logs/oembed-item', $entry) }}" class="dataList-cell--min"
								overlay="true">
								{$entry.views|number}
							</xf:cell>
						</xf:datarow>
					</xf:foreach>
				</xf:datalist>
				<div class="block-footer">
					<span class="block-footer-counter">{{ display_totals($entries, $total) }}</span>
				</div>
			</div>
		</div>

		<xf:pagenav page="{$page}" perpage="{$perPage}" total="{$total}"
			link="logs/oembed" params="{$filters}"
			wrapperclass="block-outer block-outer--after" />
	</div>
<xf:else />
	<div class="blockMessage">{{ phrase('no_entries_have_been_logged') }}</div>
</xf:if>