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.
44 lines
2.8 KiB
HTML
44 lines
2.8 KiB
HTML
{% extends "client_base.html" %}
|
|
{% import "_agreement_text.html" as ag %}
|
|
{% block main %}
|
|
<div class="crumbs"><a href="{{ base }}">Your details</a></div>
|
|
<h1 class="chead">{{ title }}</h1>
|
|
<p class="muted small">Version {{ version }}, {{ published }}</p>
|
|
{% if again %}<div class="notice warn">The text has changed since you last signed it. Read this version and sign it again.</div>{% endif %}
|
|
<section class="card agcard">
|
|
{{ ag.text(blocks) }}
|
|
</section>
|
|
{% if signed %}
|
|
<div class="notice ok" role="status">You signed this version on {{ signed }}. B4L keeps the signed copy.</div>
|
|
<p><a class="btn" href="{{ base }}">Back</a></p>
|
|
{% else %}
|
|
<form method="post" action="{{ base }}/agree/{{ agreement_id }}" class="form card" id="sign-form" data-sign-form>
|
|
<input type="hidden" name="csrf" value="{{ csrf }}">
|
|
<input type="hidden" name="version" value="{{ version_id }}">
|
|
<h2>Sign</h2>
|
|
<div class="field{% if errors.accept %} has-err{% endif %}">
|
|
<label class="check"><input type="checkbox" name="accept" value="yes" id="f-accept" required{% if f.accept %} checked{% endif %}{% if errors.accept %} aria-invalid="true" aria-describedby="e-accept"{% endif %}> I have read this agreement and accept it.</label>
|
|
{% if errors.accept %}<p class="err" id="e-accept">{{ errors.accept }}</p>{% endif %}
|
|
</div>
|
|
<div class="field{% if errors.name %} has-err{% endif %}">
|
|
<label for="f-name">Your full name, as your signature <span class="req" aria-hidden="true">*</span></label>
|
|
<input id="f-name" name="name" type="text" value="{{ f.name }}" required autocomplete="name"{% if errors.name %} aria-invalid="true" aria-describedby="e-name"{% endif %}>
|
|
{% if errors.name %}<p class="err" id="e-name">{{ errors.name }}</p>{% endif %}
|
|
</div>
|
|
<div class="field sigfield{% if errors.drawing %} has-err{% endif %}" data-sign-wrap hidden>
|
|
<label for="f-pad">Sign with your finger or the mouse <span class="req" aria-hidden="true">*</span></label>
|
|
<canvas class="sigpad" id="f-pad" data-sign-pad aria-label="Signature pad"></canvas>
|
|
<input type="hidden" name="drawing" value="" data-sign-out>
|
|
<div class="sigbar"><button type="button" class="btn sm ghost" data-sign-clear>Clear</button><span class="err" data-sign-msg hidden>Sign in the box first.</span></div>
|
|
{% if errors.drawing %}<p class="err" id="e-drawing">{{ errors.drawing }}</p>{% endif %}
|
|
</div>
|
|
<div class="formactions">
|
|
<button type="submit" class="btn pri" id="sign-btn">Sign</button>
|
|
<a class="btn ghost" href="{{ base }}">Back</a>
|
|
</div>
|
|
<p class="hint">Signing records your name, the time, this link, your internet address and your browser with the exact text. B4L keeps the signed copy as a PDF.</p>
|
|
</form>
|
|
<script src="/static/signature.js?v={{ v }}" defer></script>
|
|
{% endif %}
|
|
{% endblock %}
|