{% autoescape false %}
{% set url = 'https://sabre.io/baikal/' %}
<style>
	.label-intext { vertical-align: top;}
</style>
<header class="jumbotron subhead" id="overview">
	<h1><i class="glyph2x-circle-info"></i>Dashboard</h1>
</header>

<section id="about">
	<div class="page-header">
		<h1>About this system</h1>
	</div>
	<div class="row">
		<div class="span3">
			<h2>Version</h2>
			<p>This systems runs Baïkal <span class="label label-info label-intext">{{ BAIKAL_VERSION }}</span><br />
				<small><a href="{{ url }}" target="_blank">{{ url }}</a></small>
			</p>
			<p id="newVersionContainer" style="display: none;">
				<a class="alert alert-info" href="https://github.com/sabre-io/Baikal/releases/latest" target="_blank">
					New version available: <span id="newVersion" class="label label-info label-intext">0.0.0</span>
				</a>
			</p>
			<script type="text/javascript">
				window.onload = function () {
					jQuery.ajax({
						url: "https://api.github.com/repos/sabre-io/Baikal/releases/latest",
						success: function(result) {
							if (result.name != "{{ BAIKAL_VERSION }}") {
								$("#newVersion").text(result.name);
								$("#newVersionContainer").show();
							}
						}
					});
				};
			</script>
		</div>
		<div class="span3">
			<h2>Services</h2>
			{% if cal_enabled %}
				{% set caldavclass = 'label-success' %}
				{% set caldavtext = 'On' %}
			{% else %}
				{% set caldavclass = 'label-important' %}
				{% set caldavtext = 'Off' %}
			{% endif %}
			
			{% if card_enabled %}
				{% set carddavclass = 'label-success' %}
				{% set carddavtext = 'On' %}
			{% else %}
				{% set carddavclass = 'label-important' %}
				{% set carddavtext = 'Off' %}
			{% endif %}
			
			<table class="table">
				<tbody>
					<tr>
						<td>Web admin</td>
						<td><span class="label label-success label-intext">On</span></p></td>
					</tr>
					<tr>
						<td>CalDAV</td>
						<td><span class="label {{ caldavclass }} label-intext">{{ caldavtext }}</span></td>
					</tr>
					<tr>
						<td>CardDAV</td>
						<td><span class="label {{ carddavclass }} label-intext">{{ carddavtext }}</span></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="span6">
			<h2>License and credits</h2>
			<p>Baïkal is open source software licensed under the terms of the GNU GPL v3.</p>
			<p>Baïkal is based upon other open source projects.<br />Read the <a href="https://github.com/sabre-io/Baikal/blob/master/README.md" target="_blank">README.md</a> file to learn about that.</p>
			<p>Baïkal was created by <a href="https://github.com/jeromeschneider" target="_blank">Jérôme Schneider</a><br />and is now developed by volunteers on <a href="https://github.com/sabre-io/Baikal/" target="_blank">GitHub</a>.
		</div>
	</div>
</section>

<section id="statistics">
	<div class="page-header">
		<h1>Statistics</h1>
	</div>
	<div class="row">
		<div class="span4">
			<h2>Users</h2>
			<table class="table">
				<tbody>
					<tr>
						<td>Registered users</td>
						<td><span class="badge">{{ nbusers }}</span></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="span4">
			<h2>CalDAV</h2>
			<table class="table">
				<tbody>
					<tr>
						<td>Number of calendars</td>
						<td><span class="badge">{{ nbcalendars }}</span></td>
					</tr>
					<tr>
						<td>Number of events</td>
						<td><span class="badge">{{ nbevents }}</span></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="span4">
			<h2>CardDAV</h2>
			<table class="table">
				<tbody>
					<tr>
						<td>Number of address books</td>
						<td><span class="badge">{{ nbbooks }}</span></td>
					</tr>
					<tr>
						<td>Number of contacts</td>
						<td><span class="badge">{{ nbcontacts }}</span></td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
</section>
{% endautoescape %}
