Scans and photos of a person's papers, and a company's documents for the extension packs, uploaded on a dashed strip that takes dropped files: up to 10 files of 20 MB each, 64 MB in all; PDF, JPEG, PNG and WebP, told by their first bytes. - src/files.rs: one file per document as <id>.vdoc, AES-256-GCM under a key per file (HKDF-SHA256 from the file key and a random salt in the header); the document's id is authenticated with it. The key comes from VISA_FILES_KEY_FILE or the credential files-key; with the login on, the app does not start without it and VISA_FILES_DIR. - migrations/0003: documents (a person's or a company's, the record it belongs to, kind, date on it, note, file name, type, size, SHA-256); audit_log gets company_id and the action download. - A Documents tab per person, the documents on the company's page, and each record's documents next to its Edit link with "+ Document". - An upload's form token is its first field and is checked before any file is read; the guard lets multipart through only to the two upload addresses. - Files open under their own CSP and are never cached; a download is named after the person or company, the kind and the date. Every upload, view, download, change and deletion is in the audit log. - visa files-check; demo documents in seed-demo; scripts/dev.sh keeps the local documents and their key in .dev/; /favicon.ico for image and PDF pages. Tests: 57 unit and 33 integration (8 new for documents). Edge check of the strip (choose, drop, too large), an upload, the PDF and image viewers under the file policy: no problems, no console errors.
76 lines
5.3 KiB
HTML
76 lines
5.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="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 %}
|