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
@@ -0,0 +1,51 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "_fields.html" as fm %}
|
||||
{% import "_agreement_text.html" as ag %}
|
||||
{% block main %}
|
||||
<div class="crumbs"><a href="/agreements">Agreements</a></div>
|
||||
<div class="pagehead">
|
||||
<h1>{{ a.title }}</h1>
|
||||
<div class="actions">
|
||||
<form method="post" action="/agreements/{{ a.id }}/active" class="inline-form"{% if a.active %} data-confirm="Switch this agreement off? Client links stop asking for it; signed copies stay."{% endif %}>
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
<input type="hidden" name="active" value="{% if a.active %}0{% else %}1{% endif %}">
|
||||
<button type="submit" class="btn sm ghost">{% if a.active %}Switch off{% else %}Switch on{% endif %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<p class="meta">{% if a.active %}<span class="chip ok">asked for</span> Every client link asks for version {{ current }}.{% else %}<span class="chip plain">switched off</span> Client links do not ask for it.{% endif %}</p>
|
||||
<div class="cols agcols">
|
||||
<section class="card" id="text">
|
||||
<header><h2>Version {{ shown }}{% if shown != current %} <span class="chip plain">earlier</span>{% endif %}</h2></header>
|
||||
{{ ag.text(blocks) }}
|
||||
</section>
|
||||
<section class="card" id="versions">
|
||||
<header><h2>Versions</h2></header>
|
||||
{% for v in versions %}
|
||||
<div class="item{% if v.version != shown %} old{% endif %}">
|
||||
<div class="row"><a class="strong" href="/agreements/{{ a.id }}/versions/{{ v.version }}">Version {{ v.version }}</a>{% if v.version == current %}<span class="tag">current</span>{% endif %}<span class="muted small">{{ v.signed }} signed</span></div>
|
||||
<div class="muted small">published {{ v.published }} by {{ v.by }}</div>
|
||||
<div class="muted small mono fname" title="SHA-256 of the text">{{ v.sha256 }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
</div>
|
||||
<form method="post" action="/agreements/{{ a.id }}/versions" class="form" id="publish-form">
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
<section class="card">
|
||||
<header><h2>A new version</h2></header>
|
||||
<p class="hint lead">Change the text below and publish it as version {{ current + 1 }}. Clients who signed an earlier version sign again at their next link. A published text can never be changed.</p>
|
||||
{{ fm.area("body", "Text", draft, err=errors.body, rows=16, fcls="wide") }}
|
||||
<div class="formactions">
|
||||
<button type="submit" name="action" value="preview" class="btn" formnovalidate>Preview</button>
|
||||
<button type="submit" name="action" value="publish" class="btn pri" id="publish">Publish version {{ current + 1 }}</button>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
{% if is_preview %}
|
||||
<section class="card" id="preview">
|
||||
<header><h2>The new text as the client reads it</h2></header>
|
||||
{{ ag.text(preview) }}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user