Agreements the client signs on the link (task 7.6)
Built into the app rather than a separate signing service: any number of agreements (the processing of the client's data first, legal services and consultations later), each in versions whose text never changes. - Staff (Agreements in the sidebar, src/web/agreements.rs): paste the lawyers' text (empty line = paragraph, "# " heading, "- " list item), preview it as the client reads it, publish version 1; a changed text is the next version, the same text again is refused, and the database refuses any change to a published one (migrations/0007, trigger). Switch an agreement off and links stop asking for it. - Client: every active agreement is the first step of every link. The client reads it, ticks that they accept, types their name and signs with a finger or the mouse (static/signature.js; a PNG of the pad). A text changed while they read it is refused. A new version is asked for again at the next link. - The signed copy (src/agreements/pdf.rs, Sarabun so Thai prints, long Thai words cut without parting marks from their letter): the text, the name, the record, the time, the drawing, the link, the forwarded address, the browser and the text's SHA-256; kept as the person's encrypted document of kind "agreement", all in one transaction with the signature and the audit rows (actor link N). - The person's page shows each agreement's state (signed, not signed, to sign again) and every signed copy. - Phones: the section row now scrolls sideways instead of wrapping, so it keeps one height with five sections and Sign out. - Demo data: an invented agreement with a Thai paragraph. Checks: fmt, clippy; 105 unit and 56 integration tests (tests/agreements.rs: versions that never change, signing with a drawing, address and browser recorded, the PDF, signing again after a change, a stale version refused, switched off); layout check light/dark desk/phone on the agreement pages, the client's agreement page, the person page and the people list: no problems; a drawn signature in Edge at 390x844 signed and printed.
This commit is contained in:
1 parent
43ed75d81b
commit
d0e13dffd2
28 files changed
+2469
-57
No files matched your search
+28
@@ -7,6 +7,7 @@ use anyhow::Result;
|
||||
use chrono::{Datelike, NaiveDate, TimeDelta};
|
||||
use sqlx::PgPool;
|
||||
|
||||
use crate::agreements;
|
||||
use crate::audit::{self, Action, Entity, Entry};
|
||||
use crate::dates;
|
||||
use crate::documents::{self, Meta, NewFile, Owner};
|
||||
@@ -635,10 +636,37 @@ pub async fn demo(db: &PgPool, today: NaiveDate) -> Result<bool> {
|
||||
}
|
||||
}
|
||||
demo_links(&mut tx, &person_ids).await?;
|
||||
let (_, v) = agreements::create(&mut tx, DEMO_AGREEMENT.0, DEMO_AGREEMENT.1, "seed").await?;
|
||||
audit::record(
|
||||
&mut *tx,
|
||||
&seeded(Action::Create, Entity::Agreement, v.id, None),
|
||||
)
|
||||
.await?;
|
||||
tx.commit().await?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
/// An invented agreement, so the client link shows the step to sign; B4L's
|
||||
/// real text comes from its lawyers.
|
||||
const DEMO_AGREEMENT: (&str, &str) = (
|
||||
"How B4L processes your personal data (demo)",
|
||||
"# This text is invented for development\n\
|
||||
It shows how an agreement looks on the client's link. B4L's real text \
|
||||
comes from its lawyers and is added under Agreements.\n\
|
||||
\n\
|
||||
# 1. What B4L keeps\n\
|
||||
- your name, date of birth and nationality\n\
|
||||
- your passport, visas and stamps\n\
|
||||
- your address in Thailand and how to reach you\n\
|
||||
\n\
|
||||
# 2. What for\n\
|
||||
B4L keeps these to look after your visa and your stay in Thailand: \
|
||||
the deadlines, the forms and the documents Immigration asks for.\n\
|
||||
\n\
|
||||
# 3. ข้อความภาษาไทย\n\
|
||||
ข้อความนี้แสดงว่าภาษาไทยพิมพ์ได้ในสำเนาที่ลงนาม",
|
||||
);
|
||||
|
||||
/// Client links to see on the person's page: the first demo person sent
|
||||
/// theirs an hour ago, with a new phone number and email address; the
|
||||
/// second opened theirs and has not sent it yet. Their tokens are thrown
|
||||
|
||||
Reference in new issue
Block a user