Staff make a link for a person (or "+ New client": a record with only the name they know, and its link); the client fills in their own record from their phone without a login, and presses Send. - Links (src/links.rs, migrations/0006): the table keeps the SHA-256 of the token only, as sessions do; the link is shown once, to copy, to email (mailto with the person's address) or as a QR code (qrcode crate, inline SVG). It is open 14 days, until Send, or until staff close it; a new link closes the earlier one. States open, opened, sent, closed, expired. - The client's pages at /c/<token> (src/web/client.rs, client_*.html in a frame of their own, phone first): About you, Passport (the photo reader; a zone fills in the personal details still empty), Address in Thailand, Contact, Documents, Send. Each part is saved on its own, straight into the record. Forms carry the link's own token plus the same-site check. A passport with the same number is changed; an address unlike the current one is added beside it, so the current one and its TM.30 receipt stay; a second save changes what the link added. Uploads (passport page, photo, visa, arrival stamp, TDAC, work permit, other) go through the same checks and encrypted store as staff uploads, tied to the person's newest record of their kind. - Audit: the client's views and changes carry the actor `link <id>`; actions send and close and entity link are new. The person's page shows the newest links, when they were opened and sent, and each record the client changed, with the fields, to check. - Demo data: Erika sent her link an hour ago (phone and email changed), Jane opened hers. - documents::read_upload returns why it refused, so the client's pages answer in their own words. Checks: fmt, clippy; 101 unit and 54 integration tests (tests/client.rs: the link shown once and kept as a hash, a new client, the whole client flow with the login on, forged, closed, expired and made-up links); layout check light/dark desk/phone on the client pages, the person page and the new client form: no problems; the camera reader on the client's passport page with a fake camera filled the form and Send closed the link.
58 lines
3.2 KiB
HTML
58 lines
3.2 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 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="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>
|
|
{% 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 %}
|