113 lines
6.9 KiB
HTML
113 lines
6.9 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Directory · MIEM Employees{% endblock %}
|
|
{% block content %}
|
|
<section class="directory">
|
|
<div class="directory__header">
|
|
<div>
|
|
<h2 class="directory__title">Directory</h2>
|
|
<p class="directory__summary">{{ page.total }} employees found</p>
|
|
</div>
|
|
<button class="button" type="button" data-columns-open>Columns</button>
|
|
</div>
|
|
|
|
<form class="directory__filters" method="get" action="/admin/directory">
|
|
<input class="directory__input" name="q" value="{{ filters.q }}" placeholder="Name or URL">
|
|
<select class="directory__input" name="status">
|
|
<option value="" {% if not filters.status %}selected{% endif %}>All statuses</option>
|
|
<option value="active" {% if filters.status == "active" %}selected{% endif %}>Active</option>
|
|
<option value="dismissed" {% if filters.status == "dismissed" %}selected{% endif %}>Dismissed</option>
|
|
</select>
|
|
<select class="directory__input" name="has_email">
|
|
<option value="" {% if not filters.has_email %}selected{% endif %}>Any email</option>
|
|
<option value="true" {% if filters.has_email == "true" %}selected{% endif %}>Has email</option>
|
|
<option value="false" {% if filters.has_email == "false" %}selected{% endif %}>No email</option>
|
|
</select>
|
|
<input class="directory__input" type="date" name="started_from" value="{{ filters.started_from }}" aria-label="First seen from">
|
|
<input class="directory__input" type="date" name="started_to" value="{{ filters.started_to }}" aria-label="First seen to">
|
|
<select class="directory__input" name="sort">
|
|
{% for value, label in [("full_name", "Name"), ("status", "Status"), ("hse_start_year", "HSE start"), ("first_seen_at", "First seen"), ("last_seen_at", "Last seen"), ("dismissed_at", "Dismissed")] %}
|
|
<option value="{{ value }}" {% if filters.sort == value %}selected{% endif %}>Sort: {{ label }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<select class="directory__input" name="direction">
|
|
<option value="asc" {% if filters.direction == "asc" %}selected{% endif %}>Ascending</option>
|
|
<option value="desc" {% if filters.direction == "desc" %}selected{% endif %}>Descending</option>
|
|
</select>
|
|
<button class="button" type="submit">Apply</button>
|
|
</form>
|
|
|
|
<div class="directory__table-wrap">
|
|
<table class="directory-table" data-directory-table>
|
|
<thead>
|
|
<tr>
|
|
<th class="directory-table__head" data-column="full_name">Name</th>
|
|
<th class="directory-table__head" data-column="status">Status</th>
|
|
<th class="directory-table__head" data-column="positions">Positions</th>
|
|
<th class="directory-table__head" data-column="hse_start_year">HSE start</th>
|
|
<th class="directory-table__head" data-column="email">Email</th>
|
|
<th class="directory-table__head" data-column="phone">Phone</th>
|
|
<th class="directory-table__head" data-column="address">Address</th>
|
|
<th class="directory-table__head" data-column="publications_count">Publications</th>
|
|
<th class="directory-table__head" data-column="courses_count">Courses</th>
|
|
<th class="directory-table__head" data-column="first_seen_at">First seen</th>
|
|
<th class="directory-table__head" data-column="last_seen_at">Last seen</th>
|
|
<th class="directory-table__head" data-column="dismissed_at">Dismissed</th>
|
|
<th class="directory-table__head" data-column="profile">Profile</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for employee in page.employees %}
|
|
<tr class="directory-table__row" data-row-href="/admin/employees/{{ employee.id }}">
|
|
<td class="directory-table__cell" data-column="full_name">{{ employee.full_name or "No name" }}</td>
|
|
<td class="directory-table__cell" data-column="status"><span class="badge {% if employee.status == "dismissed" %}badge--dismissed{% endif %}">{{ employee.status }}</span></td>
|
|
<td class="directory-table__cell" data-column="positions">{{ employee.positions_text }}</td>
|
|
<td class="directory-table__cell" data-column="hse_start_year">{{ employee.hse_start_year or "" }}</td>
|
|
<td class="directory-table__cell" data-column="email">{{ employee.email_text }}</td>
|
|
<td class="directory-table__cell" data-column="phone">{{ employee.phone_text }}</td>
|
|
<td class="directory-table__cell" data-column="address">{{ employee.address or "" }}</td>
|
|
<td class="directory-table__cell" data-column="publications_count">{{ employee.publications_count }}</td>
|
|
<td class="directory-table__cell" data-column="courses_count">{{ employee.courses_count }}</td>
|
|
<td class="directory-table__cell" data-column="first_seen_at">{{ employee.first_seen_at or "" }}</td>
|
|
<td class="directory-table__cell" data-column="last_seen_at">{{ employee.last_seen_at or "" }}</td>
|
|
<td class="directory-table__cell" data-column="dismissed_at">{{ employee.dismissed_at or "" }}</td>
|
|
<td class="directory-table__cell" data-column="profile"><a class="admin__link" href="{{ employee.canonical_url }}">Open</a></td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td class="directory-table__empty" colspan="13">No employees match these filters.</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="directory__pagination">
|
|
{% set prev_offset = filters.offset - filters.limit %}
|
|
{% set next_offset = filters.offset + filters.limit %}
|
|
{% if filters.offset > 0 %}
|
|
<a class="admin__link" href="{{ request.url.include_query_params(offset=prev_offset) }}">Previous</a>
|
|
{% endif %}
|
|
<span class="directory__page">Page {{ page.page }}{% if page.pages %} of {{ page.pages }}{% endif %}</span>
|
|
{% if next_offset < page.total %}
|
|
<a class="admin__link" href="{{ request.url.include_query_params(offset=next_offset) }}">Next</a>
|
|
{% endif %}
|
|
</div>
|
|
</section>
|
|
|
|
<div class="columns-modal" data-columns-modal hidden>
|
|
<div class="columns-modal__backdrop" data-columns-close></div>
|
|
<section class="columns-modal__panel" aria-label="Column settings">
|
|
<div class="columns-modal__header">
|
|
<h3 class="columns-modal__title">Visible columns</h3>
|
|
<button class="button button--ghost" type="button" data-columns-close>Close</button>
|
|
</div>
|
|
<div class="columns-modal__grid">
|
|
{% for key, label in [("full_name", "Name"), ("status", "Status"), ("positions", "Positions"), ("hse_start_year", "HSE start"), ("email", "Email"), ("phone", "Phone"), ("address", "Address"), ("publications_count", "Publications"), ("courses_count", "Courses"), ("first_seen_at", "First seen"), ("last_seen_at", "Last seen"), ("dismissed_at", "Dismissed"), ("profile", "Profile")] %}
|
|
<label class="columns-modal__option"><input class="columns-modal__checkbox" type="checkbox" value="{{ key }}" data-column-toggle> {{ label }}</label>
|
|
{% endfor %}
|
|
</div>
|
|
</section>
|
|
</div>
|
|
{% endblock %}
|
|
{% block scripts %}
|
|
<script src="/static/admin.js"></script>
|
|
{% endblock %}
|