- Drop site/ + RenderSite.sh: repo now carries grav/user/pages as native Grav markdown pages (home/services/terms/sign/execution) - Add knel-contract theme: inherits quark2 via stream fallback, adds sign.html.twig (Twig) driving the DocuSeal flow through the APISIX gateway; esign wiring lives in the theme yaml for forks to retarget - CreateDocument.sh refreshes the Grav services page from the rendered catalogs instead of invoking the removed site renderer Ticket: https://projects.knownelement.com/issues/924
70 lines
2.7 KiB
Twig
70 lines
2.7 KiB
Twig
{% extends 'partials/base.html.twig' %}
|
|
|
|
{% block content %}
|
|
<div class="sign-page">
|
|
{{ page.content|raw }}
|
|
|
|
<style>
|
|
.sign-page form { max-width: 32rem; }
|
|
.sign-page label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; }
|
|
.sign-page input { display: block; width: 100%; padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; }
|
|
.sign-page button { margin-top: 1rem; padding: 0.6rem 1.4rem; cursor: pointer; }
|
|
</style>
|
|
<form id="esign-form">
|
|
<label for="esign-name">Full name</label>
|
|
<input type="text" id="esign-name" name="name" required>
|
|
|
|
<label for="esign-email">Email address</label>
|
|
<input type="email" id="esign-email" name="email" required>
|
|
|
|
<label for="esign-entity">Entity (Party 2)</label>
|
|
<input type="text" id="esign-entity" name="entity" required>
|
|
|
|
<button type="submit">Request signature link</button>
|
|
</form>
|
|
|
|
<p id="esign-status"></p>
|
|
</div>
|
|
|
|
<script>
|
|
(function () {
|
|
var form = document.getElementById('esign-form');
|
|
var status = document.getElementById('esign-status');
|
|
var config = {{ grav.config.themes['knel-contract'].esign|json_encode|raw }};
|
|
|
|
form.addEventListener('submit', function (ev) {
|
|
ev.preventDefault();
|
|
status.textContent = 'Requesting signing link…';
|
|
var name = document.getElementById('esign-name').value;
|
|
var email = document.getElementById('esign-email').value;
|
|
var entity = document.getElementById('esign-entity').value;
|
|
|
|
fetch(config.api_url, {
|
|
method: 'POST',
|
|
headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({
|
|
template_id: Number(config.template_id),
|
|
send_email: false,
|
|
submitters: [
|
|
{role: 'First Party', name: name, email: email},
|
|
{role: 'Second Party', name: name + ' (' + entity + ')', email: email}
|
|
]
|
|
})
|
|
}).then(function (r) {
|
|
if (!r.ok) { throw new Error('gateway returned ' + r.status); }
|
|
return r.json();
|
|
}).then(function (data) {
|
|
var slug = data.submitters && data.submitters[0] && data.submitters[0].slug;
|
|
if (slug) {
|
|
window.location.href = config.sign_url + '/s/' + slug;
|
|
} else {
|
|
status.textContent = 'Signing request created. Check ' + email + ' for the signing link.';
|
|
}
|
|
}).catch(function (e) {
|
|
status.textContent = 'Could not create the signing request (' + e.message + '). Contact the KNEL helpdesk.';
|
|
});
|
|
});
|
|
})();
|
|
</script>
|
|
{% endblock %}
|