diff --git a/docs/PLAN.md b/docs/PLAN.md index bad19a1..ea7d1fa 100644 --- a/docs/PLAN.md +++ b/docs/PLAN.md @@ -19,7 +19,8 @@ > its `/` now leads to the back office, and the texts clients read name Lanna > Desk rather than B4L. Phase 9, the legal practice > (clients, lawyers, contracts with versions, paper copies, the journal), -> followed that night. **Resume here: phase 8, reminders.** +> followed that night, and phase 10, one client list, was planned. **Resume +> here: phase 8, reminders, or phase 10 once Alex decides its three questions.** Lanna Desk keeps the immigration records of the foreigners that it looks after: their passports, addresses in Thailand, arrivals with the Thailand @@ -244,6 +245,7 @@ dark at desktop and phone width, a commit and a push. | 7 | The client link: a client fills in their own record on a phone, the MRZ read from a photo, and signs Lanna Desk's agreements | built Nov 20, 2026 | | 8 | Reminders by Matrix room message and by email | | | 9 | The legal practice: lawyers, clients (Thai and foreign, people and organizations), general and artist contracts with versions that never change, paper copies with ids and places, the journal as a hash-chained ledger | built Nov 21, 2026 | +| 10 | One client list: a visa record becomes part of a client; People becomes the visa clients | planned Nov 21, 2026 | | later | Thai user interface, agency cases and fees, other visa categories' packs | | ### Phase 1: app, login, people @@ -581,6 +583,81 @@ message, the backup); contract templates; signing contracts on the client link; reminders of notice days and ends (phase 8); links between a client and their visa record. +### Phase 10: one client list (planned) + +Since phase 9 there are two lists of the people Lanna Desk works for: +Clients (the legal practice) and People (the visa records), and nothing ties +Erika's visa record to a client. Alex asked on November 21, 2026 whether +People should become Clients; the plan is one list in which a visa record is +part of a client. Not started: build it when Alex says so. + +**The model.** `clients` is everyone Lanna Desk works for. `people` stays as +the visa record of a person client, so passports, addresses, stays, +documents, client links, signatures, the deadlines, the forms, the pack and +the audit log keep their `person_id` and work as they do. + +- `people.client_id` references `clients`, unique and, once filled, not + null: a client has at most one visa record, every visa record has a client. +- One place for each fact. The passport-style name (surname, first and + middle name, title, sex, date and place of birth) stays on the visa record, + since the forms need it as printed. Phone and email move to the client + (`people.phone` and `people.email` go after the copy); the client link's + Contact page and the forms read them there. A visa client's name on the + client list is taken from the visa record ("Erika Mustermann") and is not + edited on the client form. +- Nationality becomes an ISO alpha-3 code on clients too, with the country + list the person form uses, so both say "Germany" the same way. +- Archiving is the client's: a former client's visa record is archived with + it, and restoring the client restores it. +- The audit log keeps the visa side (views and changes of a person); the + journal keeps the client, contracts and papers, and adds an entry when a + visa record is opened for a client or the client's contact changes. + +**Migration 0010** creates a client for every person (kind person, the name, +nationality, phone and email from the person, status from `archived_at`, no +lawyer), sets `client_id`, then the constraint, and writes one journal entry +per client ("client added from the visa record of person N"). It runs by +itself at the first start after cnx01 fetches the release, on the live +records, and a rollback does not undo it, so it needs a test that loads +people through the migrations up to 0009, applies 0010 and checks every +person has its client with the same name and contact. + +**The pages.** + +- Clients: every client; a chip on the cards of those with a visa record and + their next deadline; tabs All, With contracts, With a visa record. +- A client's page: a "Visa and stay" card with the stay and the next dates, + linking to the visa record's pages, which keep their `/people/{id}/...` + addresses (client links, bookmarks and audit rows point there). A client + without one gets "Open a visa record", which asks for the passport-style + name. +- The visa record's pages show "Clients / name" above the tabs and a link + to the client's contracts. +- The sidebar: under Visas and stays, People becomes "Visa clients", the + same clients filtered to those with a visa record; Deadlines stays the + start page. +- "+ New client" on the visa side opens the client and the visa record in + one step, as `/people/new-client` does now. + +**Steps.** + +1. Migration 0010, the backfill test, contact read from the client. +2. The client page's visa card, the visa pages' crumb, the list filters and + the sidebar. +3. The client link writes the contact to the client; the journal entries. +4. Docs, screenshots, release; on cnx01, `visa-admin` checks that the + number of people equals the number of clients with a visa record. + +**To decide with Alex before building.** + +1. How a visa client's name reads in the client list: "Erika Mustermann" or + "MUSTERMANN, Erika" as on the visa side now. +2. Whether Companies (the employers) and organization clients become one + list too: Demo Records can be a client and an employer. The same pattern + would make the company record part of an organization client. +3. Whether every lawyer and staff member keeps seeing every client, as now, + or only the clients they work on. + ## Open questions 1. B4L's BOI application: once B4L is promoted, its staff extend their stay