{% extends "base.html" %}
{% block title %}{{ title }} - {{ shell.brand }}{% endblock %}
{% block content %}
<div class="lat-toolbar">
<h1>{{ title }}</h1>
{% if creatable %}{% if let Some(base) = edit_base %}<div class="lat-toolbar__actions"><a class="lat-btn lat-btn--primary" href="{{ base }}/new">+ {{ shell.t("New") }}</a></div>{% endif %}{% endif %}
</div>
<div class="lat-tablewrap">
<table class="lat-table">
<thead><tr>
{% for c in columns %}<th>{{ c }}</th>{% endfor %}
{% if edit_base.is_some() %}<th></th>{% endif %}
</tr></thead>
<tbody>
{% if rows.is_empty() %}
<tr><td class="lat-table__empty" colspan="99">{{ shell.t("No records.") }}</td></tr>
{% else %}
{% for row in rows %}
<tr>
{% for cell in row.cells %}<td>{{ cell|safe }}</td>{% endfor %}
{% if let Some(base) = edit_base %}<td class="lat-table__actions"><a href="{{ base }}/{{ row.id }}/edit">{{ shell.t("Edit") }}</a></td>{% endif %}
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
<div class="lat-listfoot">
<span>{{ shell.tf("Displayed records: {shown} of {total}", [("shown", shown), ("total", total)]) }}</span>
<span class="lat-pager">
{% if page > 1 %}<a class="lat-btn lat-btn--secondary lat-btn--sm" href="?page={{ page - 1 }}">← {{ shell.t("Prev") }}</a>{% endif %}
<span style="align-self:center">{{ shell.tf("Page {page} of {pages}", [("page", page), ("pages", total_pages)]) }}</span>
{% if page < total_pages %}<a class="lat-btn lat-btn--secondary lat-btn--sm" href="?page={{ page + 1 }}">{{ shell.t("Next") }} →</a>{% endif %}
</span>
</div>
{% endblock %}