Files
grabowski 3d2d8fa30b
CI / secret scan (push) Successful in 10s
CI / fmt, clippy, tests (push) Successful in 44s
CI / release (push) Skipped
Back office in the website's style; People as record cards
The back office now looks like lannadesk.com:

- Light theme as a printed letterhead (warm paper, navy ink, thin gold
  rules, a gold line across the top), and the default; the dark theme is
  the same navy and gold and stays a click away.
- Trirong for headings and names, Sarabun for text: the website's
  fonts, self-hosted in static/fonts/ (latin and Thai subsets, OFL),
  since the CSP allows fonts from this origin only.
- The header reads "Lanna Desk, back office"; primary buttons are navy
  on paper and gold on navy; corners are squarer.

People are record cards, like the example record on the website: a
monogram, the name in Trirong, nationality and province, the most
urgent deadline's chip, the stay today, the next four dated deadlines
with how far away they are, the passport and the employer. The filter
works on the cards; "Table" shows the table as before (?view=table),
and the switch keeps the employer and archive filters.

Checks: fmt, clippy, 109 unit and 57 integration tests (the cards show
the stay, the next dates and the monogram; the table view and the
switch keep their filters); screenshots of People (light, dark, phone),
a person, the deadlines and a client link.
2026-11-21 21:27:09 +07:00

105 lines
5.6 KiB
HTML

{% extends "base.html" %}
{% block main %}
<div class="pagehead">
<h1>{{ heading }}</h1>
<div class="actions"><a class="btn" href="/people/new-client" id="new-client">+ New client</a><a class="btn pri" href="/people/new" id="new-person">+ New person</a></div>
</div>
{% if people or n_archived or company %}
<form method="get" action="/people" class="toolbar" id="people-filter">
{% if people %}<input type="search" id="q" class="filter" placeholder="Filter by name, passport, nationality or employer ( / )" aria-label="Filter the list" autocomplete="off">{% endif %}
{% if companies %}
<label class="sel"><span class="small muted">Employer</span>
<select name="company" data-autosubmit>
<option value="">Any</option>
{%- for c in companies %}
<option value="{{ c[0] }}"{% if c[0] == company %} selected{% endif %}>{{ c[1] }}</option>
{%- endfor %}
</select></label>
<noscript><button type="submit" class="btn sm">Show</button></noscript>
{% endif %}
{% if table %}<input type="hidden" name="view" value="table">{% endif %}
{% if archived %}<input type="hidden" name="archived" value="1"><a href="/people">Back to the {{ n_active }} in the list</a>{% elif n_archived and not company %}<a href="/people?archived=1">Archived ({{ n_archived }})</a>{% endif %}
</form>
{% endif %}
{% if people %}
<div class="viewswitch" role="group" aria-label="Show as">
<a href="{{ cards_href }}"{% if not table %} class="on" aria-current="page"{% endif %} id="view-cards">Cards</a>
<a href="{{ table_href }}"{% if table %} class="on" aria-current="page"{% endif %} id="view-table">Table</a>
</div>
{% if table %}
<div class="card flush">
<div class="tblwrap">
<table class="tbl" id="people">
<thead>
<tr><th>Name</th><th>Next deadline</th><th>Passport</th><th>Valid until</th><th class="hs">Nationality</th><th class="hs">Employer</th><th class="hs">Lives in</th></tr>
</thead>
<tbody>
{% for r in people %}
<tr data-q="{{ r.q }}">
<td><a class="strong" href="/people/{{ r.id }}">{{ r.name }}</a>{% if r.age is not none %}<div class="sub">{{ r.age }} years</div>{% endif %}</td>
<td>{% if r.next %}<span class="chip {{ r.next.level }}">{{ r.next.label }}</span><div class="sub">{{ r.next.title }}, {{ r.next.due_text }}</div>{% else %}<span class="muted">none</span>{% endif %}</td>
<td>{% if r.passport_number %}<span class="mono">{{ r.passport_number }}</span>{% else %}<span class="muted">none recorded</span>{% endif %}</td>
<td>{% if r.passport_status %}{{ r.passport_expires }}<div><span class="chip {{ r.passport_status.level }}">{{ r.passport_status.label }}</span></div>{% endif %}</td>
<td class="hs">{{ r.nationality }}</td>
<td class="hs">{% if r.employer %}<a href="/companies/{{ r.employer_id }}">{{ r.employer }}</a>{% endif %}</td>
<td class="hs">{{ r.province }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p class="filter-empty" data-filter-empty hidden>No one in the list matches the filter.</p>
</div>
{% else %}
<ul class="rcards" id="people-cards">
{% for r in people %}
<li class="rcard" data-q="{{ r.q }}">
<a class="rc-head" href="/people/{{ r.id }}">
<span class="rc-mono" aria-hidden="true">{{ r.initials }}</span>
<span class="rc-who">
<span class="rc-name">{{ r.name }}</span>
<span class="rc-sub"><span>{{ r.nationality }}</span>{% if r.province %} · <span>{{ r.province }}</span>{% endif %}</span>
</span>
{% if r.next %}<span class="chip {{ r.next.level }}">{{ r.next.label }}</span>{% elif r.stay and r.stay.state == "in" %}<span class="chip ok">In order</span>{% endif %}
</a>
<div class="rc-label">Stay</div>
<p class="rc-stay">
{%- if r.stay and r.stay.state == "in" -%}
In Thailand on {{ r.stay.basis }}, until <b>{{ r.stay.permitted_until }}</b>{% if r.stay.remaining %} <span class="muted">({{ r.stay.remaining }})</span>{% endif %}
{%- elif r.stay and r.stay.state == "abroad" -%}
Abroad{% if r.stay.left_on %} since {{ r.stay.left_on }}{% endif %}
{%- else -%}
<span class="muted">No arrival recorded yet</span>
{%- endif -%}
</p>
<div class="rc-label">Next dates</div>
{% if r.upcoming %}
<dl class="rc-dates">
{% for d in r.upcoming %}
<div class="{{ d.level }}"><dt>{{ d.title }}</dt><dd>{{ d.when }}</dd></div>
{% endfor %}
</dl>
{% else %}
<p class="rc-none muted">Nothing due</p>
{% endif %}
<div class="rc-foot">
{% if r.passport_number %}<span class="mono">{{ r.passport_number }}</span>{% if r.passport_status %} <span class="chip {{ r.passport_status.level }}">{{ r.passport_status.label }}</span>{% endif %}{% else %}<span class="muted">No passport recorded</span>{% endif %}
{% if r.employer %}<a href="/companies/{{ r.employer_id }}">{{ r.employer }}</a>{% endif %}
</div>
</li>
{% endfor %}
</ul>
<p class="filter-empty card" data-filter-empty hidden>No one in the list matches the filter.</p>
{% endif %}
{% elif company %}
<div class="card"><p class="empty-inline">No one in the list works for {{ company_name or "this company" }}. <a href="/people">Everyone</a></p></div>
{% elif archived %}
<div class="card"><p class="empty-inline">No one is archived.</p></div>
{% else %}
<div class="card">
<h2>No people yet</h2>
<p>Add the first person with <b>+ New person</b>. Paste the two lines at the bottom of the passport's photo page there, and the form fills in the name, nationality, date of birth and the passport itself.</p>
</div>
{% endif %}
{% endblock %}