Phase 2: companies, stay records, deadlines
Companies become records of their own, and the stay in Thailand is recorded in full; from these records the app works out each person's deadlines (docs/PLAN.md, phase 2). - Companies: list, page, form, archive; Thai name, the 13-digit registration number with its check digit verified, address and the director who signs. The employer is chosen from them on the person form and on work permits; a company's page adds people to it; the people list and the Deadlines page filter by employer. Migration 0002 turns the free-text employers into companies. - Stay records, each one `Kind` in src/records.rs with one form, one set of routes and the same audit entries: arrivals and departures with the TDAC, extensions of stay (approved, under consideration, refused), 90-day reports with the receipt's next date, visas, re-entry permits and work permits. Passports, visas and companies are chosen from the person's own records; the server checks the choice. - The deadline engine (src/deadlines.rs, a pure function with a unit test per rule): the 90-day report from day 1 of each arrival, reset by a report or an extension, with the in-person and online windows and the in-person rule after a new passport or an extension; the extension window from 30 days before to the last working day; the decision to collect; overstay with its fine; TM.30 after each arrival; passport and work permit expiry; re-entry permits; visas still to be used. - The Deadlines page at /, the person's status and deadlines on the Overview and the new "Visa and stay" tab, the person's Activity tab, and the next deadline in the people list. - The online 90-day window ends 7 days before the due date (the plan said 8; the Immigration Bureau's TM.47 manual says 7). - 69 tests: 45 unit tests and 24 integration tests.
This commit is contained in:
1 parent
2e009700a9
commit
83bc481952
37 files changed
+5515
-142
No files matched your search
@@ -0,0 +1,22 @@
|
||||
{#- Where the person stands and what is due, the most urgent first. -#}
|
||||
<section class="card span2" id="deadlines">
|
||||
<header><h2>Status and deadlines</h2>{% if tab != "stay" %}<a class="btn sm ghost" href="/people/{{ p.id }}/stay">Visa and stay</a>{% endif %}</header>
|
||||
{% if stay.state == "in" %}
|
||||
<p class="stayline{% if stay.overstay %} bad{% endif %}">In Thailand since <b>{{ stay.since }}</b>, permitted to stay until <b>{{ stay.permitted_until }}</b> ({{ stay.remaining }}). Basis: {{ stay.basis }}.</p>
|
||||
{% elif stay.state == "abroad" %}
|
||||
<p class="stayline">Left Thailand on <b>{{ stay.left_on }}</b>; no stay is running.</p>
|
||||
{% else %}
|
||||
<p class="stayline muted">No arrival is recorded yet. Add the latest arrival under <a href="/people/{{ p.id }}/stay#arrivals">Visa and stay</a> to see the deadlines of the stay.</p>
|
||||
{% endif %}
|
||||
{% if deadlines %}
|
||||
<ul class="dl">
|
||||
{% for d in deadlines %}
|
||||
<li>
|
||||
<div class="dl-what"><b>{{ d.title }}</b>{% if d.due_text %}<span class="dl-when">{{ d.due_text }}, {{ d.when }}{% if d.estimate %} (estimate){% endif %}</span>{% endif %}</div>
|
||||
<span class="chip {{ d.level }}">{{ d.label }}</span>
|
||||
<p class="dl-note">{{ d.note }}</p>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</section>
|
||||
@@ -14,10 +14,10 @@
|
||||
</div>
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro select(name, label, value, options, err="", hint="", blank="Not recorded", cls="") -%}
|
||||
{% macro select(name, label, value, options, err="", hint="", blank="Not recorded", cls="", req=false) -%}
|
||||
<div class="field{% if err %} has-err{% endif %}{% if cls %} {{ cls }}{% endif %}">
|
||||
<label for="f-{{ name }}">{{ label }}</label>
|
||||
<select id="f-{{ name }}" name="{{ name }}"{% if err %} aria-invalid="true" aria-describedby="e-{{ name }}"{% endif %}>
|
||||
<label for="f-{{ name }}">{{ label }}{% if req %} <span class="req" aria-hidden="true">*</span>{% endif %}</label>
|
||||
<select id="f-{{ name }}" name="{{ name }}"{% if req %} required{% endif %}{% if err %} aria-invalid="true" aria-describedby="e-{{ name }}"{% endif %}>
|
||||
<option value="">{{ blank }}</option>
|
||||
{%- for o in options %}
|
||||
<option value="{{ o[0] }}"{% if o[0] == value %} selected{% endif %}>{{ o[1] }}</option>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{#- The head of every page about one person: the same place on each. -#}
|
||||
<div class="phead">
|
||||
{#- The head of every page about one person, with its tabs: the same
|
||||
place on each. -#}
|
||||
<div class="phead tabbed">
|
||||
<div class="crumbs"><a href="/people">People</a></div>
|
||||
<div class="pagehead">
|
||||
<h1><a href="/people/{{ p.id }}">{{ p.name }}</a></h1>
|
||||
@@ -15,9 +16,14 @@
|
||||
{%- if p.nationality_name %}{{ p.nationality_name }}{% else %}Nationality not recorded{% endif %}
|
||||
{%- if p.age is not none %}<span class="sep">·</span>{{ p.age }} years{% endif %}
|
||||
{%- if p.current_passport %}<span class="sep">·</span>passport <span class="mono">{{ p.current_passport }}</span>{% endif %}
|
||||
{%- if p.employer %}<span class="sep">·</span>{{ p.employer }}{% endif %}
|
||||
{%- if p.employer %}<span class="sep">·</span><a href="/companies/{{ p.employer_id }}">{{ p.employer }}</a>{% endif %}
|
||||
</p>
|
||||
<nav class="tabs" aria-label="About {{ p.name }}">
|
||||
<a href="/people/{{ p.id }}"{% if tab != "stay" and tab != "activity" %} class="on" aria-current="page"{% endif %}>Overview</a>
|
||||
<a href="/people/{{ p.id }}/stay"{% if tab == "stay" %} class="on" aria-current="page"{% endif %}>Visa and stay</a>
|
||||
<a href="/people/{{ p.id }}/activity"{% if tab == "activity" %} class="on" aria-current="page"{% endif %}>Activity</a>
|
||||
</nav>
|
||||
</div>
|
||||
{% if p.archived %}
|
||||
<div class="notice warn">Archived on {{ p.archived_on }}. Archived people are left out of the list; Restore brings the record back.</div>
|
||||
<div class="notice warn">Archived on {{ p.archived_on }}. Archived people are left out of the list and the deadlines; Restore brings the record back.</div>
|
||||
{% endif %}
|
||||
@@ -16,7 +16,7 @@
|
||||
<td class="mono">{{ e.at }}</td>
|
||||
<td>{{ e.actor }}</td>
|
||||
<td>{{ e.action }}</td>
|
||||
<td>{% if e.person_id %}<a href="/people/{{ e.person_id }}">{{ e.person_name or ("person " ~ e.person_id) }}</a> <span class="muted">{{ e.what }}</span>{% else %}<span class="muted">{{ e.what }}</span>{% endif %}</td>
|
||||
<td>{% if e.person_id %}<a href="/people/{{ e.person_id }}">{{ e.person_name or ("person " ~ e.person_id) }}</a> <span class="muted">{{ e.what }}</span>{% elif e.company_id %}<a href="/companies/{{ e.company_id }}">{{ e.company_name or ("company " ~ e.company_id) }}</a> <span class="muted">company</span>{% else %}<span class="muted">{{ e.what }}</span>{% endif %}</td>
|
||||
<td class="hs muted">{{ e.fields }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
+3
-1
@@ -12,7 +12,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
<a class="brand" href="/people" aria-label="visa.buildfor.life, the people">
|
||||
<a class="brand" href="/" aria-label="visa.buildfor.life, the deadlines">
|
||||
{% include "_mark.html" %}
|
||||
<span class="nm">Visa</span><span class="sub">buildfor.life</span>
|
||||
</a>
|
||||
@@ -21,7 +21,9 @@
|
||||
<div class="app">
|
||||
<aside class="side">
|
||||
<nav class="nav" aria-label="Sections">
|
||||
<a href="/"{% if nav == "deadlines" %} class="on" aria-current="page"{% endif %}>Deadlines</a>
|
||||
<a href="/people"{% if nav == "people" %} class="on" aria-current="page"{% endif %}>People</a>
|
||||
<a href="/companies"{% if nav == "companies" %} class="on" aria-current="page"{% endif %}>Companies</a>
|
||||
<a href="/activity"{% if nav == "activity" %} class="on" aria-current="page"{% endif %}>Activity</a>
|
||||
</nav>
|
||||
<div class="who">
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
{% extends "base.html" %}
|
||||
{% block main %}
|
||||
<div class="pagehead">
|
||||
<h1>{% if archived %}Archived companies{% else %}Companies{% endif %}</h1>
|
||||
<div class="actions"><a class="btn pri" href="/companies/new" id="new-company">+ New company</a></div>
|
||||
</div>
|
||||
{% if companies or n_archived %}
|
||||
<div class="toolbar">
|
||||
{% if companies %}<input type="search" id="q" class="filter" placeholder="Filter by name, number or province ( / )" aria-label="Filter the list" autocomplete="off">{% endif %}
|
||||
{% if archived %}<a href="/companies">Back to the {{ n_active }} in the list</a>{% elif n_archived %}<a href="/companies?archived=1">Archived ({{ n_archived }})</a>{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if companies %}
|
||||
<div class="card flush">
|
||||
<div class="tblwrap">
|
||||
<table class="tbl" id="companies">
|
||||
<thead><tr><th>Company</th><th>Registration number</th><th class="hs">Province</th><th>People</th></tr></thead>
|
||||
<tbody>
|
||||
{% for c in companies %}
|
||||
<tr data-q="{{ c.q }}">
|
||||
<td><a class="strong" href="/companies/{{ c.id }}">{{ c.name }}</a>{% if c.name_th %}<div class="sub">{{ c.name_th }}</div>{% endif %}</td>
|
||||
<td class="mono">{{ c.registration_no }}</td>
|
||||
<td class="hs">{{ c.province }}</td>
|
||||
<td>{% if c.people %}<a href="/people?company={{ c.id }}">{{ c.people }}</a>{% else %}<span class="muted">0</span>{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="filter-empty" data-filter-empty hidden>No company matches the filter.</p>
|
||||
</div>
|
||||
{% elif archived %}
|
||||
<div class="card"><p class="empty-inline">No company is archived.</p></div>
|
||||
{% else %}
|
||||
<div class="card">
|
||||
<h2>No companies yet</h2>
|
||||
<p>Add the employers with <b>+ New company</b>. A person's employer and the employer on a work permit are then chosen from this list.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,70 @@
|
||||
{% extends "base.html" %}
|
||||
{% block main %}
|
||||
<div class="phead">
|
||||
<div class="crumbs"><a href="/companies">Companies</a></div>
|
||||
<div class="pagehead">
|
||||
<h1>{{ c.name }}</h1>
|
||||
<div class="actions">
|
||||
<a class="btn sm" href="/companies/{{ c.id }}/edit">Edit</a>
|
||||
{% if c.archived %}
|
||||
<form method="post" action="/companies/{{ c.id }}/restore" class="inline-form"><input type="hidden" name="csrf" value="{{ csrf }}"><button type="submit" class="btn sm">Restore</button></form>
|
||||
{% else %}
|
||||
<form method="post" action="/companies/{{ c.id }}/archive" class="inline-form" data-confirm="Archive {{ c.name }}? It is no longer offered as an employer; existing records keep it."><input type="hidden" name="csrf" value="{{ csrf }}"><button type="submit" class="btn sm ghost">Archive</button></form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<p class="meta">
|
||||
{%- if c.name_th %}{{ c.name_th }}{% endif %}
|
||||
{%- if c.registration_no %}{% if c.name_th %}<span class="sep">·</span>{% endif %}registration <span class="mono">{{ c.registration_no }}</span>{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% if c.archived %}
|
||||
<div class="notice warn">Archived on {{ c.archived_on }}. It is no longer offered as an employer; Restore brings it back.</div>
|
||||
{% endif %}
|
||||
<div class="cols">
|
||||
<section class="card" id="details">
|
||||
<header><h2>Company details</h2></header>
|
||||
<dl class="kv">
|
||||
<dt>Name in English</dt><dd>{{ c.name }}</dd>
|
||||
<dt>Name in Thai</dt><dd>{% if c.name_th %}{{ c.name_th }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
||||
<dt>Registration number</dt><dd>{% if c.registration_no %}<span class="mono">{{ c.registration_no }}</span>{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
||||
<dt>Type of business</dt><dd>{% if c.business %}{{ c.business }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
||||
<dt>Address</dt><dd>{% if c.address %}{{ c.address }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
||||
<dt>Phone</dt><dd>{% if c.phone %}{{ c.phone }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
||||
<dt>Email</dt><dd>{% if c.email %}{{ c.email }}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
||||
<dt>Authorized director</dt><dd>{% if c.signatory %}{{ c.signatory }}{% if c.signatory_position %}, {{ c.signatory_position }}{% endif %}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
||||
{% if c.notes %}<dt>Notes</dt><dd class="pre">{{ c.notes }}</dd>{% endif %}
|
||||
</dl>
|
||||
</section>
|
||||
<section class="card" id="people">
|
||||
<header><h2>People employed</h2>{% if employees %}<a class="btn sm ghost" href="/people?company={{ c.id }}">In the people list</a>{% endif %}</header>
|
||||
{% for e in employees %}
|
||||
<div class="item">
|
||||
<div class="row"><a class="strong" href="/people/{{ e.id }}">{{ e.name }}</a><span class="muted">{{ e.nationality }}</span></div>
|
||||
<div class="row">
|
||||
<span class="chip {{ e.permit.level }}">{{ e.permit.label }}</span>
|
||||
<form method="post" action="/companies/{{ c.id }}/employees/{{ e.id }}/remove" class="inline-form" data-confirm="Remove {{ e.name }} from the people employed here? The person's record stays."><input type="hidden" name="csrf" value="{{ csrf }}"><button type="submit" class="linkbtn">Remove</button></form>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="empty-inline">No one is recorded as employed here yet.</p>
|
||||
{% endfor %}
|
||||
{% if candidates and not c.archived %}
|
||||
<form method="post" action="/companies/{{ c.id }}/employees" class="hire" id="hire-form">
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
<label for="f-person">Add a person</label>
|
||||
<div class="hire-row">
|
||||
<select id="f-person" name="person" required>
|
||||
<option value="">Choose a person</option>
|
||||
{%- for o in candidates %}
|
||||
<option value="{{ o[0] }}">{{ o[1] }}</option>
|
||||
{%- endfor %}
|
||||
</select>
|
||||
<button type="submit" class="btn sm">Add</button>
|
||||
</div>
|
||||
<p class="hint">This makes the company the person's employer. Someone new is first added under People.</p>
|
||||
</form>
|
||||
{% endif %}
|
||||
</section>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,54 @@
|
||||
{% extends "base.html" %}
|
||||
{% block main %}
|
||||
<div class="pagehead">
|
||||
<h1>Deadlines</h1>
|
||||
<div class="actions"><a class="btn" href="/people">People</a></div>
|
||||
</div>
|
||||
<div class="summary">
|
||||
<span class="chip {% if overdue %}bad{% else %}ok{% endif %}">{{ overdue }} overdue or urgent</span>
|
||||
<span class="chip {% if soon %}warn{% else %}ok{% endif %}">{{ soon }} need attention</span>
|
||||
<span class="muted small">For {{ n_people }} {% if n_people == 1 %}person{% else %}people{% endif %}{% if not all %}: the next {{ horizon_days }} days, and anything urgent{% endif %}.</span>
|
||||
</div>
|
||||
<form method="get" action="/" class="toolbar" id="dash-filter">
|
||||
{% if rows %}<input type="search" id="q" class="filter" placeholder="Filter by name, company or deadline ( / )" 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 all %}<input type="hidden" name="all" value="1"><a href="/{% if company %}?company={{ company }}{% endif %}">Only the next {{ horizon_days }} days</a>{% else %}<a href="/?all=1{% if company %}&company={{ company }}{% endif %}">Show everything</a>{% endif %}
|
||||
</form>
|
||||
{% if rows %}
|
||||
<div class="card flush">
|
||||
<div class="tblwrap">
|
||||
<table class="tbl" id="deadline-list">
|
||||
<thead><tr><th>Due</th><th>Person</th><th>Deadline</th><th>Status</th><th class="hs">What to do</th></tr></thead>
|
||||
<tbody>
|
||||
{% for r in rows %}
|
||||
<tr data-q="{{ r.q }}">
|
||||
<td class="nowrap">{{ r.d.due_text }}<div class="sub">{{ r.d.when }}{% if r.d.estimate %}, estimate{% endif %}</div></td>
|
||||
<td class="nowrap"><a class="strong" href="/people/{{ r.person_id }}">{{ r.person }}</a>{% if r.employer %}<div class="sub">{{ r.employer }}</div>{% endif %}</td>
|
||||
<td class="nowrap">{{ r.d.title }}</td>
|
||||
<td><span class="chip {{ r.d.level }}">{{ r.d.label }}</span></td>
|
||||
<td class="hs small note">{{ r.d.note }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="filter-empty" data-filter-empty hidden>No deadline matches the filter.</p>
|
||||
</div>
|
||||
{% elif n_people %}
|
||||
<div class="card"><p class="empty-inline">Nothing is due{% if not all %} in the next {{ horizon_days }} days{% endif %}.</p></div>
|
||||
{% else %}
|
||||
<div class="card">
|
||||
<h2>No people yet</h2>
|
||||
<p>The deadlines appear here once people and their arrivals are recorded. Start under <a href="/people">People</a>.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
+21
-8
@@ -1,31 +1,42 @@
|
||||
{% extends "base.html" %}
|
||||
{% block main %}
|
||||
<div class="pagehead">
|
||||
<h1>{% if archived %}Archived people{% else %}People{% endif %}</h1>
|
||||
<h1>{{ heading }}</h1>
|
||||
<div class="actions"><a class="btn pri" href="/people/new" id="new-person">+ New person</a></div>
|
||||
</div>
|
||||
{% if people or n_archived %}
|
||||
<div class="toolbar">
|
||||
{% 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 archived %}<a href="/people">Back to the {{ n_active }} in the list</a>{% elif n_archived %}<a href="/people?archived=1">Archived ({{ n_archived }})</a>{% endif %}
|
||||
</div>
|
||||
{% 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 class="hs">Nationality</th><th>Passport</th><th>Valid until</th><th class="hs">Lives in</th><th class="hs">Employer</th></tr>
|
||||
<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 class="hs">{{ r.nationality }}</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>
|
||||
<td class="hs">{{ r.employer }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -33,6 +44,8 @@
|
||||
</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 %}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{% 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">
|
||||
@@ -13,7 +14,7 @@
|
||||
<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 %}{{ p.employer }}{% 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 %}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{% extends "base.html" %}
|
||||
{% block main %}
|
||||
{% include "_person_head.html" %}
|
||||
<p class="muted">Every view and change of this person's record, newest first: who, when and which fields changed, never their values. The log cannot be edited.</p>
|
||||
{% if items %}
|
||||
<div class="card flush">
|
||||
<div class="tblwrap">
|
||||
<table class="tbl" id="activity">
|
||||
<thead><tr><th>When</th><th>Who</th><th>Did</th><th>Record</th><th class="hs">Fields</th></tr></thead>
|
||||
<tbody>
|
||||
{% for e in items %}
|
||||
<tr><td class="mono">{{ e.at }}</td><td>{{ e.actor }}</td><td>{{ e.action }}</td><td class="muted">{{ e.what }}</td><td class="hs muted">{{ e.fields }}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card"><p class="empty-inline">Nothing has happened yet.</p></div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -33,7 +33,7 @@
|
||||
{{ fm.text("place_of_birth", "Place of birth", f.place_of_birth, err=errors.place_of_birth) }}
|
||||
{{ fm.select("nationality", "Nationality", f.nationality, countries, err=errors.nationality) }}
|
||||
{{ fm.text("occupation", "Occupation", f.occupation, err=errors.occupation) }}
|
||||
{{ fm.text("employer", "Employer", f.employer, err=errors.employer, hint="The company named in the work permit.") }}
|
||||
{{ fm.select("employer", "Employer", f.employer, companies, err=errors.employer, blank="Not employed", hint="The company named in the work permit. Companies are kept under Companies.") }}
|
||||
{{ fm.text("phone", "Phone", f.phone, err=errors.phone, type="tel") }}
|
||||
{{ fm.text("email", "Email", f.email, err=errors.email, type="email") }}
|
||||
{{ fm.area("notes", "Notes", f.notes, err=errors.notes, rows=3, fcls="wide") }}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "_fields.html" as fm %}
|
||||
{% block main %}
|
||||
{% if p %}
|
||||
{% include "_person_head.html" %}
|
||||
{% else %}
|
||||
<div class="crumbs"><a href="/companies">Companies</a></div>
|
||||
<div class="pagehead"><h1>{{ heading }}</h1></div>
|
||||
{% endif %}
|
||||
<form method="post" action="{{ action }}" class="form" id="record-form">
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
<section class="card">
|
||||
{% if p %}<header><h2>{{ heading }}</h2></header>{% endif %}
|
||||
{% if lead %}<p class="hint lead">{{ lead }}</p>{% endif %}
|
||||
<div class="grid">
|
||||
{%- for fl in fields %}
|
||||
{%- if fl.kind == "area" %}
|
||||
{{ fm.area(fl.name, fl.label, values[fl.name], err=errors[fl.name], hint=fl.hint, rows=3, fcls="wide") }}
|
||||
{%- elif fl.kind == "select" %}
|
||||
{{ fm.select(fl.name, fl.label, values[fl.name], fl.options, err=errors[fl.name], hint=fl.hint, blank=fl.blank, cls=("wide" if fl.wide else ""), req=fl.required) }}
|
||||
{%- else %}
|
||||
{{ fm.text(fl.name, fl.label, values[fl.name], err=errors[fl.name], hint=fl.hint, req=fl.required, type=fl.kind, list=fl.suggest, cls=("wide" if fl.wide else "")) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</div>
|
||||
</section>
|
||||
<div class="formactions">
|
||||
<button type="submit" class="btn pri" id="save">{% if mode == "new" %}Add the {{ one }}{% else %}Save{% endif %}</button>
|
||||
<a class="btn ghost" href="{{ cancel }}">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
<datalist id="ports">{% for x in ports %}<option value="{{ x }}"></option>{% endfor %}</datalist>
|
||||
<datalist id="offices">{% for x in offices %}<option value="{{ x }}"></option>{% endfor %}</datalist>
|
||||
<datalist id="provinces">{% for x in provinces %}<option value="{{ x }}"></option>{% endfor %}</datalist>
|
||||
{% if mode == "edit" and p %}
|
||||
<form method="post" action="{{ action }}/delete" class="dangerzone" data-confirm="Delete this {{ one }} from the record?">
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
<button type="submit" class="btn sm danger">Delete this {{ one }}</button>
|
||||
<span class="muted small">For a record entered by mistake. The activity log keeps a note that it existed.</span>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,30 @@
|
||||
{% extends "base.html" %}
|
||||
{% block main %}
|
||||
{% include "_person_head.html" %}
|
||||
<div class="cols">
|
||||
{% include "_deadlines.html" %}
|
||||
{% for s in sections %}
|
||||
<section class="card" id="{{ s.slug }}">
|
||||
<header><h2>{{ s.title }}</h2><a class="btn sm" href="/people/{{ p.id }}/{{ s.slug }}/new">+ New {{ s.one }}</a></header>
|
||||
{% for r in s.records %}
|
||||
<div class="item{% if r.old %} old{% endif %}">
|
||||
<div class="row">
|
||||
{%- for h in r.headline %}{% if not loop.first %}<span class="muted">·</span>{% endif %}{% if h.href %}<a class="strong" href="{{ h.href }}">{{ h.text }}</a>{% else %}<span class="strong">{{ h.text }}</span>{% endif %}{% endfor %}
|
||||
{%- if r.status %}<span class="chip {{ r.status.level }}">{{ r.status.label }}</span>{% endif %}
|
||||
</div>
|
||||
{% if r.items %}
|
||||
<dl class="kv">
|
||||
{%- for it in r.items %}
|
||||
<dt>{{ it.label }}</dt><dd{% if it.pre %} class="pre"{% elif it.mono %} class="mono"{% endif %}>{% if it.href %}<a href="{{ it.href }}">{{ it.value }}</a>{% else %}{{ it.value }}{% endif %}</dd>
|
||||
{%- endfor %}
|
||||
</dl>
|
||||
{% endif %}
|
||||
<div class="rowactions"><a href="/people/{{ p.id }}/{{ s.slug }}/{{ r.id }}/edit">Edit</a></div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="empty-inline">No {{ s.one }} recorded yet.</p>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user