<xf:if is="$upgradeCheck">
	<xf:macro template="upgrade_check_macros" name="full_status" arg-upgradeCheck="{$upgradeCheck}" />
</xf:if>

<xf:if is="$showUnicodeWarning">
	<div class="blockMessage blockMessage--error blockMessage--iconic">
		{{ phrase('full_unicode_support_has_been_enabled_in_config_but_db_does_not_support') }}
	</div>
</xf:if>

<xf:if is="$xf.visitor.hasAdminPermission('style') && $outdatedTemplates">
	<div class="blockMessage blockMessage--important blockMessage--iconic">
		<a href="{{ link('templates/outdated') }}"> {{ phrase('there_templates_that_may_be_outdated_click_to_review') }}</a>
	</div>
</xf:if>

<xf:if is="$xf.visitor.hasAdminPermission('viewLogs') && $serverErrorLogs">
	<div class="blockMessage blockMessage--error blockMessage--iconic">
		<a href="{{ link('logs/server-errors') }}"> {{ phrase('server_errors_have_been_logged') }}</a>
	</div>
</xf:if>

<xf:if is="$xf.visitor.hasAdminPermission('addOn') && $hasProcessingAddOn">
	<div class="blockMessage blockMessage--error blockMessage--iconic">
		{{ phrase('addon_action_pending_warning') }}<br />
		<br />
		<a href="{{ link('add-ons') }}">{{ phrase('view_addons...') }}</a>
	</div>
</xf:if>

<xf:if is="$legacyConfig">
	<div class="blockMessage blockMessage--important">
		{{ phrase('your_old_config_file_at_library_config_is_still_available') }}
	</div>
</xf:if>

<xf:if is="$hasStoppedJobs">
	<div class="blockMessage blockMessage--error blockMessage--iconic">
		{{ phrase('there_scheduled_jobs_outstanding_which_have_not_run') }}
	</div>
<xf:elseif is="$hasStoppedManualJobs" />
	<div class="blockMessage blockMessage--important blockMessage--iconic">
		{{ phrase('there_manual_rebuild_jobs_awaiting_completion_continue_running', {'link': link('tools/run-job')}) }}
	</div>
</xf:if>

<xf:if is="$isImportRunning AND $xf.options.activitySummaryEmail.enabled">
	<div class="blockMessage blockMessage--important blockMessage--iconic">
		{{ phrase('while_import_running_sending_activity_summary_disabled') }}
	</div>
</xf:if>

<xf:set var="$firstFileCheck" value="{$fileChecks|first}" />
<xf:if is="$firstFileCheck.check_state == 'failure'">
	<div class="blockMessage blockMessage--error blockMessage--iconic">
		<a href="{{ link('tools/file-check/results', $firstFileCheck) }}">
			{{ phrase('there_x_missing_files_or_files_with_unexpected_contents', {
				'total_missing': ($firstFileCheck.total_missing + $firstFileCheck.total_inconsistent)|number
			}) }}
		</a>
	</div>
</xf:if>

<xf:if is="$requirementErrors">
	<div class="blockMessage blockMessage--error blockMessage--iconic">
		{{ phrase('following_errors_occurred_while_verifying_that_your_server_still_meets_requirements') }}:
		<ul>
			<xf:foreach loop="$requirementErrors" value="$error">
				<li>{$error}</li>
			</xf:foreach>
		</ul>
	</div>
</xf:if>

<xf:if is="{{ $xf.visitor.hasAdminPermission('user') }}">
	<div class="block">
		<div class="block-container">
			<xf:form action="{{ link('users/quick-search') }}">
				<div class="block-body">
					<xf:textboxrow name="query" placeholder="{{ phrase('username_email_ip...') }}" value=""
						label="{{ phrase('search_for_users') }}" />
					<xf:submitrow icon="search" />
				</div>
			</xf:form>
		</div>
	</div>
</xf:if>

<xf:if is="$stats is not empty AND $xf.visitor.hasAdminPermission('viewStatistics')">
	<xf:css src="public:chartist.css" />
	<xf:css src="stats.less" />

	<xf:js prod="xf/stats-compiled.js" dev="vendor/chartist/chartist.min.js, xf/stats.js" />

	<div class="block">
		<div class="block-container">
			<h2 class="block-header"><a href="{{ link('stats') }}">{{ phrase('statistics') }}</a></h2>
			<div class="block-body block-row">
				<ul class="graphList">
					<xf:foreach loop="$stats" value="$statsData">
						<li data-xf-init="stats" data-max-ticks="4">
							<script class="js-statsData" type="application/json">
								{$statsData.data|json|raw}
							</script>
							<script class="js-statsSeriesLabels" type="application/json">
								{$statsData.phrases|json|raw}
							</script>
							<div class="ct-chart ct-chart--small ct-major-tenth js-statsChart"></div>
							<ul class="ct-legend js-statsLegend"></ul>
						</li>
					</xf:foreach>
				</ul>
			</div>
		</div>
	</div>
</xf:if>

<div class="iconicLinks">
	<ul class="iconicLinks-list">
		<xf:foreach loop="$navigation" value="$entry">
			<xf:set var="$nav" value="{$entry.record}" />
			<xf:if is="{$nav.link}">
				<li><a href="{{ link($nav.link) }}">
					<div class="iconicLinks-icon"><xf:fa icon="fa-fw {$nav.icon}" /></div>
					<div class="iconicLinks-title">{$nav.title}</div>
				</a></li>
			</xf:if>
		</xf:foreach>
		<li class="iconicLinks-placeholder"></li>
		<li class="iconicLinks-placeholder"></li>
		<li class="iconicLinks-placeholder"></li>
		<li class="iconicLinks-placeholder"></li>
		<li class="iconicLinks-placeholder"></li>
	</ul>
</div>

<xf:if is="$envReport">
	<div class="block">
		<div class="block-container">
			<h2 class="block-header">
				<span class="collapseTrigger collapseTrigger--block {{ !is_toggled('collapse_env_report') ? 'is-active' : '' }}" data-xf-click="toggle" data-xf-init="toggle-storage" data-storage-key="collapse_env_report" data-storage-type="cookie" data-target="#js-collapse-env-report">
					{{ phrase('server_environment_report') }}
				</span>
			</h2>
			<div class="block-body block-body--collapsible block-row {{ !is_toggled('collapse_env_report') ? 'is-active' : '' }}" id="js-collapse-env-report">
				<xf:if is="$envReport.phpVersionState == 'not_newest'">
					<div class="block-rowMessage block-rowMessage--warning">
						{{ phrase('php_version_not_newest') }}
					</div>
				<xf:elseif is="$envReport.phpVersionState == 'recommended'" />
					<div class="block-rowMessage block-rowMessage--success">
						{{ phrase('php_version_recommended') }}
					</div>
				</xf:if>
				<div class="pairWrapper pairWrapper--spaced">
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('php_version') }}</dt>
						<dd><a href="{{ link('tools/phpinfo') }}" target="_blank">{$envReport.phpVersion}</a></dd>
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('mysql_version') }}</dt>
						<dd>{$envReport.mysqlVersion}</dd>
					</dl>
					<xf:if is="$envReport.server_software">
						<dl class="pairs pairs--columns">
							<dt>{{ phrase('server_software') }}</dt>
							<dd>{$envReport.server_software}</dd>
						</dl>
					</xf:if>
					<xf:foreach loop="$envReport.ini" key="$ini" value="$iniVal">
						<dl class="pairs pairs--columns">
							<dt>PHP <code>{$ini}</code></dt>
							<dd>{$iniVal}</dd>
						</dl>
					</xf:foreach>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('curl_version') }}</dt>
						<dd>{{ $envReport.curl_version ?: phrase('n_a') }}</dd>
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('curl_ssl_version') }}</dt>
						<dd>{{ $envReport.ssl_version ?: phrase('n_a') }}</dd>
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('openssl_version') }}</dt>
						<dd>{{ $envReport.openssl_version ?: phrase('n_a') }}
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('suhosin_enabled') }}</dt>
						<dd>{{ $envReport.suhosin ? phrase('yes') : phrase('no') }}</dd>
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('imagick_support') }}</dt>
						<dd>{{ $envReport.imagick ? phrase('yes') : phrase('no') }}</dd>
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('exif_support') }}</dt>
						<dd>{{ $envReport.exif ? phrase('yes') : phrase('no') }}</dd>
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('gzip_support') }}</dt>
						<dd>{{ $envReport.gzip ? phrase('yes') : phrase('no') }}</dd>
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('mbstring_support') }}</dt>
						<dd>{{ $envReport.mbstring ? phrase('yes') : phrase('no') }}</dd>
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('gmp_support') }}</dt>
						<dd>{{ $envReport.gmp ? phrase('yes') : phrase('no') }}</dd>
					</dl>
					<dl class="pairs pairs--columns">
						<dt>{{ phrase('ziparchive_support') }}</dt>
						<dd>{{ $envReport.zip ? phrase('yes') : phrase('no') }}</dd>
					</dl>
				</div>
			</div>
		</div>
	</div>
</xf:if>

<xf:if is="$logCounts is not empty AND $xf.visitor.hasAdminPermission('viewLogs')">
	<div class="block">
		<div class="block-container">
			<h2 class="block-header">
				<span class="collapseTrigger collapseTrigger--block {{ !is_toggled('collapse_logged_activity') ? 'is-active' : '' }}" data-xf-click="toggle" data-xf-init="toggle-storage" data-storage-key="collapse_logged_activity" data-storage-type="cookie" data-target="#js-collapse-logged-activity">
					{{ phrase('logged_activity') }}
				</span>
			</h2>
			<div class="block-body block-body--collapsible {{ !is_toggled('collapse_logged_activity') ? 'is-active' : '' }}" id="js-collapse-logged-activity">
				<xf:datalist data-xf-init="responsive-data-list">
					<xf:datarow rowtype="header">
						<xf:cell>{{ phrase('type') }}</xf:cell>
						<xf:cell>{{ phrase('last_day') }}</xf:cell>
						<xf:cell>{{ phrase('last_week') }}</xf:cell>
						<xf:cell>{{ phrase('last_month') }}</xf:cell>
						<xf:cell> </xf:cell>
					</xf:datarow>

					<!--[XF:activity_stats:top]-->
					<xf:datarow>
						<xf:cell>{{ phrase('moderator_actions') }}</xf:cell>
						<xf:cell>{$logCounts.moderator.day|number}</xf:cell>
						<xf:cell>{$logCounts.moderator.week|number}</xf:cell>
						<xf:cell>{$logCounts.moderator.month|number}</xf:cell>
						<xf:action href="{{ link('logs/moderator') }}">{{ phrase('view') }}</xf:action>
					</xf:datarow>

					<xf:datarow>
						<xf:cell>{{ phrase('spam_triggers') }}</xf:cell>
						<xf:cell>{$logCounts.spamTrigger.day|number}</xf:cell>
						<xf:cell>{$logCounts.spamTrigger.week|number}</xf:cell>
						<xf:cell>{$logCounts.spamTrigger.month|number}</xf:cell>
						<xf:action href="{{ link('logs/spam-trigger') }}">{{ phrase('view') }}</xf:action>
					</xf:datarow>

					<xf:datarow>
						<xf:cell>{{ phrase('spam_cleanings') }}</xf:cell>
						<xf:cell>{$logCounts.spamCleaner.day|number}</xf:cell>
						<xf:cell>{$logCounts.spamCleaner.week|number}</xf:cell>
						<xf:cell>{$logCounts.spamCleaner.month|number}</xf:cell>
						<xf:action href="{{ link('logs/spam-cleaner') }}">{{ phrase('view') }}</xf:action>
					</xf:datarow>

					<xf:datarow>
						<xf:cell>{{ phrase('emails_bounced') }}</xf:cell>
						<xf:cell>{$logCounts.emailBounce.day|number}</xf:cell>
						<xf:cell>{$logCounts.emailBounce.week|number}</xf:cell>
						<xf:cell>{$logCounts.emailBounce.month|number}</xf:cell>
						<xf:action href="{{ link('logs/email-bounces') }}">{{ phrase('view') }}</xf:action>
					</xf:datarow>

					<xf:datarow>
						<xf:cell>{{ phrase('payments_received') }}</xf:cell>
						<xf:cell>{$logCounts.payment.day|number}</xf:cell>
						<xf:cell>{$logCounts.payment.week|number}</xf:cell>
						<xf:cell>{$logCounts.payment.month|number}</xf:cell>
						<xf:action href="{{ link('logs/payment-provider') }}">{{ phrase('view') }}</xf:action>
					</xf:datarow>
					<!--[XF:activity_stats:bottom]-->
				</xf:datalist>
			</div>
		</div>
	</div>
</xf:if>

<xf:if is="$staffOnline is not empty">
	<div class="block">
		<div class="block-container">
			<h2 class="block-header">
				<span class="collapseTrigger collapseTrigger--block {{ !is_toggled('collapse_staff_online') ? 'is-active' : '' }}" data-xf-click="toggle" data-xf-init="toggle-storage" data-storage-key="collapse_staff_online" data-storage-type="cookie" data-target="#js-collapse-staff-online">
					{{ phrase('staff_online') }}
				</span>
			</h2>
			<ul class="block-body block-body--collapsible {{ !is_toggled('collapse_staff_online') ? 'is-active' : '' }}" id="js-collapse-staff-online">
				<xf:foreach loop="$staffOnline" value="$user">
					<li class="block-row">
						<div class="contentRow">
							<div class="contentRow-figure">
								<xf:avatar user="$user" size="xs"/>
							</div>
							<div class="contentRow-main contentRow-main--close">
								<xf:username user="$user" rich="true"/>
								<div class="contentRow-minor">
									<xf:usertitle user="$user"/>
								</div>
							</div>
						</div>
					</li>
				</xf:foreach>
			</ul>
		</div>
	</div>
</xf:if>

<xf:if is="$fileChecks is not empty">
	<div class="block">
		<div class="block-container">
			<h2 class="block-header">
				<span class="collapseTrigger collapseTrigger--block {{ !is_toggled('collapse_health_check') ? 'is-active' : '' }}" data-xf-click="toggle" data-xf-init="toggle-storage" data-storage-key="collapse_health_check" data-storage-type="cookie" data-target="#js-collapse-health-check">
					{{ phrase('file_health_check_results') }}
				</span>
			</h2>
			<div class="block-body block-body--collapsible {{ !is_toggled('collapse_health_check') ? 'is-active' : '' }}" id="js-collapse-health-check">
				<xf:macro template="tools_file_check" name="file_check_list" arg-fileChecks="{$fileChecks}" />
			</div>
		</div>
	</div>
</xf:if>

<xf:if is="{{ $xf.visitor.hasAdminPermission('addOn') AND $installedAddOns is not empty }}">
	<xf:css src="addon_list.less" />
	<div class="addOnList">
		<div class="block">
			<div class="block-container">
				<h2 class="block-header">
					<span class="collapseTrigger collapseTrigger--block {{ !is_toggled('collapse_add_ons') ? 'is-active' : '' }}" data-xf-click="toggle" data-xf-init="toggle-storage" data-storage-key="collapse_add_ons" data-storage-type="cookie" data-target="#js-collapse-add-ons">
						{{ phrase('installed_add_ons') }}
					</span>
				</h2>
				<ul class="block-body block-body--collapsible {{ !is_toggled('collapse_add_ons') ? 'is-active' : '' }}" id="js-collapse-add-ons">
					<xf:foreach loop="$installedAddOns" value="$addOn">
						<xf:macro template="addon_list_macros" name="addon_list_item" arg-addOn="{$addOn}" />
					</xf:foreach>
				</ul>
			</div>
		</div>
	</div>
</xf:if>