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

<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('recipient') }}</xf:cell>
					<xf:cell>{{ phrase('date') }}</xf:cell>
					<xf:cell>{{ phrase('type') }}</xf:cell>
					<xf:cell>{{ phrase('action') }}</xf:cell>
					<xf:cell class="dataList-cell--min">&nbsp;</xf:cell>
				</xf:datarow>

				<xf:foreach loop="$bounces" value="$bounce">
					<xf:datarow>
						<xf:cell>
							<xf:if is="$bounce.User">
								<a href="{{ link('users/edit', $bounce.User) }}"
									data-xf-init="tooltip"
									title="{$bounce.User.username}">{$bounce.recipient}</a>
								<xf:else />
								{$bounce.recipient}
							</xf:if>
						</xf:cell>
						<xf:cell>
							<xf:date time="{$bounce.log_date}" />
						</xf:cell>
						<xf:cell>
							<xf:if is="$bounce.message_type == 'bounce'">
								<span data-xf-init="tooltip" title="{$bounce.status_code}">{{ phrase('bounce') }}</span>
							<xf:elseif is="$bounce.message_type == 'delay'" />
								<span class="u-muted">{{ phrase('delay') }}</span>
							<xf:elseif is="$bounce.message_type == 'challenge'" />
								<span class="u-muted">{{ phrase('challenge') }}</span>
							<xf:elseif is="$bounce.message_type == 'autoreply'" />
								<span class="u-muted">{{ phrase('auto_reply') }}</span>
							<xf:elseif is="$bounce.message_type == 'unknown'" />
								{{ phrase('unknown') }}
							<xf:else />
								{$bounce.message_type}
							</xf:if>
						</xf:cell>
						<xf:cell>
							<xf:if is="$bounce.action_taken == 'hard'">
								{{ phrase('hard_bounce') }}
							<xf:elseif is="$bounce.action_taken == 'soft'" />
								{{ phrase('soft_bounce_logged') }}
							<xf:elseif is="$bounce.action_taken == 'soft_hard'" />
								{{ phrase('too_many_soft_bounces') }}
							<xf:elseif is="$bounce.action_taken == 'untrusted'" />
								<span class="u-muted">{{ phrase('skipped_untrusted') }}</span>
							<xf:elseif is="$bounce.action_taken == ''" />
								<span class="u-muted">{{ phrase('none') }}</span>
							<xf:else />
								{$bounce.action_taken}
							</xf:if>
						</xf:cell>
						<xf:action href="{{ link('logs/email-bounces', null, {'bounce_id': $bounce.bounce_id}) }}">
							{{ phrase('view') }}
						</xf:action>
					</xf:datarow>
					<xf:else />
					<xf:datarow>
						<xf:cell colspan="5">{{ phrase('no_entries_have_been_logged') }}</xf:cell>
					</xf:datarow>
				</xf:foreach>
			</xf:datalist>
		</div>
		<div class="block-footer">
			<span class="block-footer-counter">{{ display_totals($bounces, $total) }}</span>
		</div>
	</div>
	<xf:pagenav page="{$page}" perpage="{$perPage}" total="{$total}"
		link="logs/email-bounces" params="{$linkFilters}"
		wrapperclass="block-outer block-outer--after" />
</div>
