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.
100 lines
7.3 KiB
HTML
100 lines
7.3 KiB
HTML
{% extends "base.html" %}
|
|
{% block main %}
|
|
{% include "_person_head.html" %}
|
|
<div class="cols">
|
|
{% include "_deadlines.html" %}
|
|
<section class="card" id="details">
|
|
<header><h2>Personal details</h2><a class="btn sm" href="/people/{{ p.id }}/edit">Edit</a></header>
|
|
<dl class="kv">
|
|
<dt>Surname</dt><dd>{{ p.surname }}</dd>
|
|
<dt>Given names</dt><dd>{{ p.given }}</dd>
|
|
{% if p.title %}<dt>Title</dt><dd>{{ p.title }}</dd>{% endif %}
|
|
<dt>Sex</dt><dd>{% if p.sex %}{{ p.sex }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
|
<dt>Date of birth</dt><dd>{% if p.dob %}{{ p.dob }} <span class="muted">({{ p.age }} years)</span>{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
|
<dt>Place of birth</dt><dd>{% if p.place_of_birth %}{{ p.place_of_birth }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
|
<dt>Nationality</dt><dd>{% if p.nationality %}{{ p.nationality_name }} <span class="muted mono">{{ p.nationality }}</span>{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
|
<dt>Occupation</dt><dd>{% if p.occupation %}{{ p.occupation }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
|
<dt>Employer</dt><dd>{% if p.employer %}<a href="/companies/{{ p.employer_id }}">{{ p.employer }}</a>{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
|
<dt>Phone</dt><dd>{% if p.phone %}{{ p.phone }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
|
<dt>Email</dt><dd>{% if p.email %}{{ p.email }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
|
{% if p.notes %}<dt>Notes</dt><dd class="pre">{{ p.notes }}</dd>{% endif %}
|
|
</dl>
|
|
</section>
|
|
|
|
<section class="card" id="passports">
|
|
<header><h2>Passport</h2><a class="btn sm" href="/people/{{ p.id }}/passports/new">+ New passport</a></header>
|
|
{% for pp in passports %}
|
|
<div class="item{% if not pp.current %} old{% endif %}">
|
|
<div class="row">
|
|
<span class="mono strong">{{ pp.number }}</span>
|
|
<span class="muted">{{ pp.country_name }}</span>
|
|
{% if pp.current %}<span class="tag">current</span>{% else %}<span class="tag plain">previous</span>{% endif %}
|
|
</div>
|
|
<dl class="kv">
|
|
<dt>Issued</dt><dd>{% if pp.issued_on %}{{ pp.issued_on }}{% else %}<span class="muted">date not recorded</span>{% endif %}{% if pp.issued_at %}, {{ pp.issued_at }}{% endif %}</dd>
|
|
<dt>Valid until</dt><dd>{{ pp.expires_on }}{% if pp.status %} <span class="chip {{ pp.status.level }}">{{ pp.status.label }}</span>{% endif %}</dd>
|
|
<dt>Zone</dt><dd>{% if pp.has_mrz %}read, check digits matched{% else %}<span class="muted">typed in by hand</span>{% endif %}</dd>
|
|
</dl>
|
|
<div class="rowactions"><a href="/people/{{ p.id }}/passports/{{ pp.id }}/edit">Edit</a>{% for d in docs["passports:" ~ pp.id] %}<a class="doclink" href="{{ d.href }}" target="_blank" rel="noopener">{{ d.label }}</a>{% endfor %}<a href="/people/{{ p.id }}/documents?for=passports:{{ pp.id }}#upload">+ Document</a></div>
|
|
</div>
|
|
{% else %}
|
|
<p class="empty-inline">No passport recorded yet. Add it with + New passport; the two lines at the bottom of the photo page fill the form in.</p>
|
|
{% endfor %}
|
|
</section>
|
|
|
|
<section class="card" id="addresses">
|
|
<header><h2>Address in Thailand</h2><a class="btn sm" href="/people/{{ p.id }}/addresses/new">+ New address</a></header>
|
|
{% for a in addresses %}
|
|
<div class="item{% if not a.current %} old{% endif %}">
|
|
<div class="row">
|
|
{% if a.current %}<span class="tag">current</span>{% else %}<span class="tag plain">earlier</span>{% endif %}
|
|
<span class="muted small">{% if a.moved_in_on %}since {{ a.moved_in_on }}{% endif %}{% if a.moved_out_on %} until {{ a.moved_out_on }}{% endif %}</span>
|
|
</div>
|
|
<p class="addr">{{ a.line }}</p>
|
|
<dl class="kv">
|
|
<dt>House master</dt><dd>{% if a.house_master %}{{ a.house_master }}{% if a.house_master_phone %}, {{ a.house_master_phone }}{% endif %}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
|
<dt>TM.30</dt><dd>{% if a.tm30_reported_on %}reported {{ a.tm30_reported_on }}{% if a.tm30_receipt_no %}, receipt <span class="mono">{{ a.tm30_receipt_no }}</span>{% endif %}{% else %}<span class="muted">no receipt recorded</span>{% endif %}
|
|
{% if a.tm30 %}<div><span class="chip {{ a.tm30.level }}">{{ a.tm30.label }}</span></div>{% endif %}</dd>
|
|
</dl>
|
|
<div class="rowactions"><a href="/people/{{ p.id }}/addresses/{{ a.id }}/edit">Edit</a>{% for d in docs["addresses:" ~ a.id] %}<a class="doclink" href="{{ d.href }}" target="_blank" rel="noopener">{{ d.label }}</a>{% endfor %}<a href="/people/{{ p.id }}/documents?for=addresses:{{ a.id }}#upload">+ Document</a></div>
|
|
</div>
|
|
{% else %}
|
|
<p class="empty-inline">No address recorded yet. The TM.30 receipt of the current address goes with it.</p>
|
|
{% endfor %}
|
|
</section>
|
|
|
|
<section class="card" id="client-link">
|
|
<header><h2>Client link</h2>
|
|
<form method="post" action="/people/{{ p.id }}/links" class="inline-form"{% if client_links and client_links[0].usable %} data-confirm="Make a new link? The open one stops working."{% endif %}><input type="hidden" name="csrf" value="{{ csrf }}"><button type="submit" class="btn sm" id="make-link">{% if client_links %}New link{% else %}Make a link{% endif %}</button></form>
|
|
</header>
|
|
{% for l in client_links %}
|
|
<div class="item{% if not loop.first %} old{% endif %}">
|
|
<div class="row">
|
|
<span class="chip {{ l.level }}">{{ l.state }}</span>
|
|
<span class="muted small">made {{ l.made }} by {{ l.by }}{% if l.usable %}, works until {{ l.until }}{% endif %}</span>
|
|
</div>
|
|
<dl class="kv">
|
|
{% if l.opened %}<dt>Opened</dt><dd>{{ l.opened }}</dd>{% endif %}
|
|
{% if l.sent %}<dt>Sent</dt><dd>{{ l.sent }}</dd>{% endif %}
|
|
{% if l.closed %}<dt>Closed</dt><dd>{{ l.closed }}</dd>{% endif %}
|
|
{% if l.changes %}<dt>Changed</dt><dd><ul class="changes">{% for c in l.changes %}<li><a href="{{ c.href }}">{{ c.label }}</a>{% if c.fields %} <span class="muted">({{ c.fields }})</span>{% endif %}</li>{% endfor %}</ul></dd>{% endif %}
|
|
</dl>
|
|
{% if l.changes %}<p class="hint">The client's entries went straight into the record: check them against the papers.</p>{% endif %}
|
|
{% if l.usable %}<div class="rowactions"><form method="post" action="/people/{{ p.id }}/links/{{ l.id }}/close" class="inline-form" data-confirm="Close this link? The client can no longer use it."><input type="hidden" name="csrf" value="{{ csrf }}"><button type="submit" class="linkbtn">Close the link</button></form></div>{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<p class="empty-inline">A link lets the client fill in their own details, passport, address and scans from their phone, without a login. It works for 14 days, or until they press Send.</p>
|
|
{% endfor %}
|
|
</section>
|
|
|
|
<section class="card" id="recent">
|
|
<header><h2>Recent activity</h2><a class="btn sm ghost" href="/activity?person={{ p.id }}">All of it</a></header>
|
|
<ul class="log">
|
|
{% for e in recent %}
|
|
<li><span class="when">{{ e.at }}</span><span><b>{{ e.actor }}</b> {{ e.action }} {{ e.what }}{% if e.fields %} <span class="muted">({{ e.fields }})</span>{% endif %}</span></li>
|
|
{% endfor %}
|
|
</ul>
|
|
</section>
|
|
</div>
|
|
{% endblock %}
|