diff --git a/templates/sugo.php b/templates/sugo.php
index 501b2cf..864974d 100644
--- a/templates/sugo.php
+++ b/templates/sugo.php
@@ -14,8 +14,7 @@
data() {
return {
users: = json_encode($users) ?>,
- selectedUser: = $selectedUser ? "'" . json_encode($selectedUser, JSON_UNESCAPED_UNICODE) . "'" : 'null' ?>,
- selectedUserData: null,
+ selectedUser: = $selectedUser ? json_encode($selectedUser, JSON_UNESCAPED_UNICODE) : 'null' ?>,
document: null,
finalDocument: null,
loading: false,
@@ -135,7 +134,19 @@
// add the signature
let signatureBuffer = Uint8Array.from(atob(signatureData.split(',')[1]), c => c.charCodeAt(0));
let signatureImage = await pdf.embedPng(signatureBuffer);
- thirdPage.drawImage(signatureImage, {
+ thirdPage.drawImage(signatureImage, { // guanti
+ x: 355,
+ y: 592,
+ width: 80,
+ height: 40,
+ });
+ thirdPage.drawImage(signatureImage, { // cappa
+ x: 260,
+ y: 460,
+ width: 80,
+ height: 40,
+ });
+ thirdPage.drawImage(signatureImage, { // end of document
x: 360,
y: 110,
width: 180,
@@ -147,7 +158,7 @@
this.download(); // temp
this.loading = false;
},
- send() {
+ send() { // currently unused as we don't have an email endpoint
if (!this.toEmail || this.loading) {
return;
}
@@ -168,15 +179,22 @@
}
});
},
+ async downloadBlank() {
+ await this.sign();
+ this.loading = true;
+ this.finalDocument = this.document;
+ this.download();
+ this.loading = false;
+ },
download() {
let pdfBlob = new Blob([this.finalDocument], {type: 'application/pdf'});
let pdfUrl = URL.createObjectURL(pdfBlob);
let a = document.createElement('a');
a.href = pdfUrl;
- a.download = 'sir.pdf';
+ a.download = `sir-${this.selectedUser}.pdf`;
a.click();
URL.revokeObjectURL(pdfUrl);
- if (this.users.length === 0) {
+ if (this.users.length === 1) {
// just redirect to the home page
window.location.href = '/';
}
@@ -202,7 +220,8 @@
-
+
+