Files
grabowski fc8c1b6a44
CI / secret scan (push) Successful in 4s
CI / fmt, clippy, tests (push) Successful in 31s
Phase 6: the Non-B extension pack, checked and printed as one PDF
The pack for an extension of stay based on work, item by item in the
officer's order, each with its state at the date of the application:
generated, has blanks, uploaded, missing, out of date, no date, or not
needed for this person.

- src/pack/mod.rs: the rules as a pure function of the records and the
  documents, a unit test per rule. Copies belong to their record (the
  current passport, the last arrival and its TDAC, the re-entry permit it
  came back on, every extension since the passport was issued, the last
  90-day report, the current address, the work permit); the company
  certificate and BOJ.5 count six months from their certification, the
  balance sheet 17 months from its year's end, PND.1, SPS 1-10 and PP.30
  the last three months, PND.91 the latest year; two photos of the office.
  Sources in docs/PLAN.md (thailand.go.th 006_008, Immigration Division 1).
- A Pack tab: the six parts, each item's files and form, and what fixes it
  (the upload with the kind and record chosen, through the new ?kind= on
  the Documents tab and on a company's page; a document's date; a record).
  The application's fields are the Forms tab's, and both tabs carry them.
- /people/{id}/pack.pdf (src/pack/pdf.rs): a cover sheet with the contents
  page by page and what to sign and bring, the five forms, then every copy:
  uploaded PDFs as they are (a PDF 2.0 upload makes the pack 2.0), images
  fitted on A4 and turned as their EXIF orientation says, a page in place of
  a file that cannot be read; bookmarks per item. krilla gains its
  raster-images feature. The audit logs the forms' codes and a view or
  download of each document that went in.
- A company's page shows its part of every employee's pack.
- The extension deadline links to the pack; at 390 px the six tabs fit, as
  "Visa and stay" reads "Stay" on phones.
- Demo data shows every state.
- The Forms tab showed "Back about" and "Purpose" empty: the template read
  app.back and app.purpose, which serialize as "return" and "for".

docs/PLAN.md: phase 6 done, open question 2 settled (the office is the
application's), phase 7 planned from Alex's answers: the client link, the
MRZ from a phone photo, later the signed agreement; reminders move to 8.

Checks: cargo fmt, clippy -D warnings, 97 unit and 47 integration tests;
layout_check 0 problems (pack, company, forms, dashboard, person; light,
dark, desk, phone); the tabs measured at 390 and 360 px; the pack PDF
rendered and looked at, an EXIF-turned JPEG upright.
2026-11-20 16:04:13 +07:00

149 lines
8.7 KiB
HTML

{% extends "base.html" %}
{% import "_documents.html" as dm %}
{% 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>
<h3 class="fsec">For the forms</h3>
{%- if c.figures %}
<dl class="kv">
{%- for f in c.figures %}
<dt>{{ f[0] }}</dt><dd>{{ f[1] }}</dd>
{%- endfor %}
</dl>
{%- else %}
<p class="empty-inline">The employer's certificate (STM.1) states the capital, the latest revenue and equity, and the staff; STM.11 names a coordinator. <a href="/companies/{{ c.id }}/edit#f-capital_thb">Add them</a>.</p>
{%- endif %}
</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>
<section class="card span2" id="office">
<header><h2>Office</h2><a class="btn sm ghost" href="/companies/{{ c.id }}/edit#f-office_gps">{% if c.gps %}Change the position{% else %}Add the GPS position{% endif %}</a></header>
<div class="office">
<div class="office-pic">
{%- if office.photo %}
<a href="{{ office.photo.href }}" target="_blank" rel="noopener"><img src="{{ office.photo.href }}" alt="Photo of the office of {{ c.name }}"></a>
<p class="muted small">{% if office.photo.dated_on %}Taken {{ office.photo.dated_on }}{% else %}Added {{ office.photo.uploaded }}{% endif %}{% if office.more %} · {{ office.more }} more under <a href="#documents">Company documents</a>{% endif %}</p>
{%- else %}
<div class="office-none">No photo of the office yet</div>
{%- if office.more %}
<p class="muted small">{{ office.more }} as PDF under <a href="#documents">Company documents</a></p>
{%- endif %}
{%- endif %}
</div>
<div class="office-info">
<dl class="kv">
<dt>GPS position</dt>
<dd>{% if c.gps %}<span class="mono">{{ c.gps }}</span>{% if c.osm %}<span class="maplinks"><a href="{{ c.osm }}" target="_blank" rel="noopener noreferrer">OpenStreetMap</a><a href="{{ c.gmaps }}" target="_blank" rel="noopener noreferrer">Google Maps</a></span>{% endif %}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
</dl>
<p class="hint">The position and the photo help the officers who visit the workplace, and go into the extension packs of the people employed here.</p>
{%- if office.files_on %}
<form method="post" action="/companies/{{ c.id }}/documents" enctype="multipart/form-data" class="upload office-up" id="office-upload">
<input type="hidden" name="csrf" value="{{ csrf }}">
<input type="hidden" name="kind" value="office-photo">
<input type="hidden" name="back" value="office">
{%- if office.errors %}
<div class="notice warn">Nothing was uploaded. {{ office.errors.file or office.errors.kind or office.errors.note or "Choose the photo again." }}</div>
{%- endif %}
<div class="drop{% if office.errors.file %} has-err{% endif %}" data-max="{{ office.file_limit }}">
<input type="file" id="f-office-file" name="file" required accept="image/jpeg,image/png,image/webp" aria-describedby="h-office-file">
<span class="drop-icon" aria-hidden="true">+</span>
<label for="f-office-file"><b>{% if office.photo %}Add a newer photo{% else %}Add a photo of the office{% endif %}</b> or drop it here</label>
<span class="drop-names" data-drop-names></span>
<span class="hint" id="h-office-file">JPEG, PNG or WebP, up to {{ office.file_limit_mb }} MB</span>
</div>
<button type="submit" class="btn pri">Upload</button>
</form>
{%- endif %}
</div>
</div>
</section>
<section class="card span2" id="pack">
<header><h2>For the extension packs</h2><span class="muted small">as each employee's pack sees them today</span></header>
<ul class="checklist">
{%- for i in pack %}
<li class="ci" id="item-{{ i.key }}">
<span class="chip {{ i.level }}">{{ i.label }}</span>
<div class="ci-body">
<div class="ci-what">{{ i.what }}</div>
<p class="ci-note">{{ i.note }}</p>
{%- if i.fix %}
<div class="rowactions"><a href="{{ i.fix.href }}">{{ i.fix.text }}</a></div>
{%- endif %}
</div>
</li>
{%- endfor %}
</ul>
</section>
<section class="card span2" id="documents">
<header><h2>Company documents</h2><span class="muted small">for the extension packs of the people employed here</span></header>
{{ dm.upload(upload, csrf, person=false) }}
{%- if docs %}
{{ dm.table(docs, person=false) }}
{%- else %}
<p class="empty-inline">No company documents yet: the company certificate and the list of shareholders (certified within six months), the tax and social security returns, a map and photos of the office.</p>
{%- endif %}
</section>
</div>
{% endblock %}