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

<xf:pageaction>
	<xf:button href="{{ link('warnings/add') }}" icon="add">{{ phrase('add_warning') }}</xf:button>
	<xf:button href="{{ link('warnings/actions/add') }}" icon="add">{{ phrase('add_warning_action') }}</xf:button>
</xf:pageaction>

<div class="block">
	<div class="block-outer">
		<xf:macro template="filter_macros" name="quick_filter" arg-key="warnings" arg-class="block-outer-opposite" />
	</div>
	<div class="block-container">
		<div class="block-body">
			<xf:datalist>
				<xf:foreach loop="$warnings" value="$warning">
					<xf:datarow
						label="{$warning.title}"
						href="{{ link('warnings/edit', $warning) }}"
						delete="{{ link('warnings/delete', $warning) }}">
						<xf:explain>
							<ul class="listInline listInline--bullet listInline--selfInline">
								<li>{{ phrase('warning_points:') }} {$warning.points_default}</li>
								<li>{{ phrase('expires:') }}
									<xf:if is="$warning.expiry_default == 'never'">
										{{ phrase('never') }}
									<xf:else />
										{{ duration($warning.expiry_default ? $warning.expiry_default : 1, $warning.expiry_type) }}
									</xf:if></li>
							</ul>
						</xf:explain>
					</xf:datarow>
				</xf:foreach>
			</xf:datalist>
		</div>
		<div class="block-footer">
			<span class="block-footer-counter">{{ display_totals($warnings) }}</span>
		</div>
	</div>
</div>

<xf:if is="$actions is not empty">
	<div class="block">
		<div class="block-container">
			<h2 class="block-header">{{ phrase('warning_actions') }}</h2>
			<div class="block-body">
				<xf:datalist>
					<xf:foreach loop="$actions" value="$action">
						<xf:datarow>
							<xf:cell href="{{ link('warnings/actions/edit', $action) }}">
								<div class="dataList-mainRow">
									{{ phrase('points:') }} {$action.points}
									<div class="dataList-hint" dir="auto">
										<ul class="listInline listInline--bullet listInline--selfInline">
											<xf:if is="$action.action == 'ban'">
												<li>{{ phrase('ban') }}</li>
											<xf:elseif is="$action.action == 'discourage'" />
												<li>{{ phrase('discourage') }}</li>
											<xf:elseif is="$action.action == 'groups'" />
												<li>{{ phrase('add_to_selected_groups') }}</li>
											<xf:else />
												<li>{{ phrase('unknown_action') }}</li>
											</xf:if>

											<xf:if is="$action.action_length_type == 'permanent'">
												<li>{{ phrase('permanent') }}</li>
											<xf:elseif is="$action.action_length_type == 'points'" />
												<li>{{ phrase('while_at_or_above_points_threshold') }}</li>
											<xf:else />
												<li>{{ phrase('temporary') }}</li>
											</xf:if>
										</ul>
									</div>
								</div>
							</xf:cell>
							<xf:delete href="{{ link('warnings/actions/delete', $action) }}" />
						</xf:datarow>
					</xf:foreach>
				</xf:datalist>
			</div>
			<!--<div class="block-footer">
				<span class="block-footer-counter">{{ display_totals($actions) }}</span>
			</div>-->
		</div>
	</div>
</xf:if>