Files
visa/templates/person.html
T
grabowski ff716eb9d3
CI / secret scan (push) Successful in 8s
CI / fmt, clippy, tests (push) Successful in 1m23s
CI / release (push) Skipped
Originals in our care (phase 12, step 1)
What clients hand Lanna Desk for a while (a passport for an extension, a
signed contract, a title deed) gets a code and a label (OR-2026-0001), and
a record of where it is: held at a place in the office, out with someone
such as Chiang Mai Immigration until a date, or returned.

- Migration 0013: table originals, owned by a client or a person; the
  database refuses a delete and a change of what it is, whose it is and
  how it came.
- Every intake and move is a journal entry starting with the code; the
  item's page reads its history from there. The audit log has the new
  entity "original", with a view when a person's original is shown.
- Pages: Legal, Originals (in our care, out, held, returned, all; a find
  box for a typed or scanned code), the item's page with the move form,
  intake from a client's or a person's page, and the label with a QR code
  to the item's page. Cards on the client's and the person's pages.
- A field can show only for some choices of a selection
  (data-shown-when), so the move form asks "Where it lies", "With whom"
  or "Returned to" as fits.
- Demo data: a passport out at Immigration, a title deed and a house
  registration held, a company certificate returned.
- PLAN: phase 12, with step 2 (the inbox that files a pile of scans) and
  step 3 planned.
2026-11-23 14:06:50 +07:00

119 lines
8.3 KiB
HTML

{% extends "base.html" %}
{% import "_originals.html" as og %}
{% 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>
{% if agreements or signed_agreements %}
<section class="card" id="agreements">
<header><h2>Agreements</h2></header>
{% for g in agreements %}
<div class="row agrow"><a href="/agreements/{{ g.id }}">{{ g.title }}</a><span class="chip {{ g.level }}">{{ g.state }}</span><span class="muted small">{{ g.note }}</span></div>
{% endfor %}
{% if signed_agreements %}
<ul class="log">
{% for s in signed_agreements %}
<li><span class="when">{{ s.at }}</span><span>{% if s.href %}<a href="{{ s.href }}" target="_blank" rel="noopener">{{ s.title }}, version {{ s.version }}</a>{% else %}{{ s.title }}, version {{ s.version }}{% endif %} signed as <b>{{ s.name }}</b>{% if s.through %} <span class="muted">({{ s.through }})</span>{% endif %}{% if s.old %} <span class="tag plain">earlier version</span>{% endif %}</span></li>
{% endfor %}
</ul>
{% endif %}
</section>
{% endif %}
{{ og.card(originals, "/originals/new?person=" ~ p.id) }}
<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 %}