Lanna Desk's larger work is contracts, general ones and artists', for
clients who are Thai or foreign, people or organizations, with several
lawyers in the team. The back office gets a Legal section (phase 9 in
docs/PLAN.md):
- Lawyers: license number, contact, the login of one who uses the app
(then "My contracts"), in the team or left.
- Clients, as record cards: person or organization, names in English and
Thai, stage name or brand, a Thai ID number (checked), a passport or a
registration number, the lawyer in charge.
- Contracts: code LD-<year>-<n>, the general kinds and the artist kinds
(recording, management, publishing, performance, license,
merchandise), other party, status, lawyer, dates and value; a contract
in force shows its notice day and its end ahead. Filters: general or
artists, a lawyer, mine, those over.
- Versions: a text kept here, a file (PDF or scan, encrypted as the
client's document) or both. They never change: the database refuses
UPDATE and DELETE, a version's file cannot be deleted and no document's
checksum can change. Any version reads against the one before as a
line diff.
- Paper copies: the id <code>-P<n> to write on the paper or print as a
90 x 50 mm label with a QR code; where it lies, its state and holder,
each move journaled; found again by its id.
- The journal: every change in words, in the change's transaction, each
entry chained to the one before by SHA-256. The database refuses to
change, delete or truncate it; /journal checks the chain and every
version's text and fingerprints against its entry, shows the last hash
and exports CSV.
The sidebar groups its sections: Legal, Visas and stays, Office. Demo data
(seed-demo) adds three lawyers, six clients and seven contracts with
versions, papers and moves. Documents take a third owner, the client
(migration 0009).
Checks: fmt, clippy, 115 unit and 62 integration tests (new: versions and
the journal, the database refusing changes, a change around the app
breaking the chain, paper ids and moves, the demo checking whole);
screenshots of the new pages in light, dark and on a phone.
Lanna Desk is the legal side of buildfor.life (B4L), and the client link,
its agreements, the demo agreement and the messages now name Lanna Desk:
"Lanna Desk looks after your visa ...", "Send to Lanna Desk", "Lanna
Desk keeps the signed copy". B4L stays where it is the company itself:
the employer in the Non-B pack and its BOI application.
README and PLAN say the same.
Checks: fmt, clippy, 109 unit and 57 integration tests.
Every page of the pack is now A4 upright, so it prints as one stack. A
PDF page or a whole-page picture that lies wider than tall is turned
onto the page (a small one that fits as it is stays as it is), and a
PDF page is only made smaller, never larger.
A picture never prints larger than its resolution allows (the JFIF or
PNG dpi, else 150 dpi), nor larger than its kind's box: passport pages,
visas and stamps 180 x 128 mm, cards 130 x 90 mm, and a phone's
screenshot (the TDAC, or any picture about twice as tall as wide)
150 x 75 mm. These print at the top of the page.
Cards: a new kind "ID card", and the work permit, take two pictures in
one upload as front and back (migration 0008 documents.back_of). The
Documents tab marks them front/back, lists them together and offers
"Print both sides" (.../documents/{id}/sides.pdf); the pack prints both
on one sheet. The client link takes ID cards too. The demo seeds a TDAC
screenshot and an ID card's two sides.
Checks: fmt, clippy, 108 unit and 57 integration tests (print sizes,
dpi reading, the back following its front, the paired upload, its
audit and the sides PDF); the demo pack's pages checked as images.
The Documents tab's actions stack on a phone, so none is cut off.
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.