{% extends "base.html" %}
{% block title %}{{ shell.t("Preferences") }} - {{ shell.brand }}{% endblock %}
{% block content %}
<div class="lat-toolbar"><h1>{{ shell.t("Preferences") }}</h1></div>
<div class="lat-card lat-card--form">
{% if let Some(message) = error %}<div class="lat-alert">{{ message }}</div>{% endif %}
<form method="post" action="{{ shell.base }}/preferences">
{% include "_csrf.html" %}
<div class="lat-field">
<label class="lat-field__label" for="timezone">{{ shell.t("Display timezone") }}</label>
<select class="lat-input" id="timezone" name="timezone">
<option value=""{% if inherits %} selected{% endif %}>{{ shell.t("Use the deployment default") }} ({{ default_tz }})</option>
{% for zone in zones %}<option value="{{ zone.name }}"{% if zone.selected %} selected{% endif %}>{{ zone.name }}</option>{% endfor %}
</select>
<p class="lat-help">Timestamps currently render in {{ effective_tz }}. Storage is always UTC; this only changes how dates are shown to you.</p>
</div>
<div class="lat-field">
<label class="lat-field__label" for="locale">{{ shell.t("Language") }}</label>
<select class="lat-input" id="locale" name="locale">
<option value=""{% if inherits_locale %} selected{% endif %}>{{ shell.t("Use the deployment default") }} ({{ default_locale }})</option>
{% for locale in locales %}<option value="{{ locale.code }}"{% if locale.selected %} selected{% endif %}>{{ locale.name }}</option>{% endfor %}
</select>
<p class="lat-help">{{ shell.t("The admin renders in this language. It only changes the interface, not your content.") }}</p>
</div>
<div class="lat-actions">
<button class="lat-btn lat-btn--primary" type="submit">{{ shell.t("Save") }}</button>
</div>
</form>
</div>
<div class="lat-toolbar lat-toolbar--section"><h2>{{ shell.t("Signed-in devices") }}</h2></div>
<p class="lat-help lat-sectionintro">{{ shell.t("Every browser currently signed in to this account. Signing one out ends it immediately.") }}</p>
<div class="lat-tablewrap">
<table class="lat-table">
<thead>
<tr>
<th>{{ shell.t("Device") }}</th>
<th>{{ shell.t("Signed in") }}</th>
<th>{{ shell.t("Last active") }}</th>
<th>{{ shell.t("Expires") }}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for item in sessions %}
<tr>
<td>
{{ item.device }}{% if item.current %} <span class="lat-badge">{{ shell.t("This device") }}</span>{% endif %}
{% if !item.ip_address.is_empty() %}<p class="lat-help">{{ item.ip_address }}</p>{% endif %}
</td>
<td>{{ item.started }}</td>
<td>{{ item.last_seen }}</td>
<td>{{ item.expires }}</td>
<td class="lat-table__actions">
{% if !item.current %}
<form method="post" action="{{ shell.base }}/preferences/sessions/revoke">
{% include "_csrf.html" %}
<input type="hidden" name="id" value="{{ item.id }}">
<button class="lat-btn lat-btn--danger" type="submit">{{ shell.t("Sign out") }}</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if sessions.len() > 1 %}
<form method="post" action="{{ shell.base }}/preferences/sessions/revoke-others">
{% include "_csrf.html" %}
<div class="lat-actions">
<button class="lat-btn lat-btn--danger" type="submit">{{ shell.t("Sign out every other device") }}</button>
</div>
</form>
{% endif %}
{% endblock %}