From ba8c987fc4d638841ee533299efbab4dd199c163 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Wed, 6 Mar 2024 08:24:30 -0300 Subject: [PATCH 1/2] Add sign button when have more than one signer Signed-off-by: Vitor Mattos --- src/Components/Request/RequestSignature.vue | 57 +++++++++++++-------- src/store/files.js | 3 +- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/Components/Request/RequestSignature.vue b/src/Components/Request/RequestSignature.vue index 410306f172..256c4a5669 100644 --- a/src/Components/Request/RequestSignature.vue +++ b/src/Components/Request/RequestSignature.vue @@ -29,28 +29,33 @@ - - - {{ t('libresign', 'Next') }} - - - - {{ t('libresign', 'Sign') }} - - - {{ t('libresign', 'Validate') }} - +
+ + + {{ t('libresign', 'Next') }} + + + + {{ t('libresign', 'Sign') }} + + + {{ t('libresign', 'Validate') }} + +
@@ -215,3 +220,11 @@ export default { }, } + diff --git a/src/store/files.js b/src/store/files.js index 3492feeb29..0743daae10 100644 --- a/src/store/files.js +++ b/src/store/files.js @@ -59,7 +59,8 @@ export const useFilesStore = defineStore('files', { if (!Object.hasOwn(this.getFile(), 'signers')) { return false } - return this.files[this.selectedNodeId].signers.filter(signer => signer.signed?.length > 0).length > 0 + return this.files[this.selectedNodeId].signers + .filter(signer => signer.signed?.length > 0).length === this.files[this.selectedNodeId].signers.length }, getSubtitle() { if (this.selectedNodeId === 0) { From 8af28df002c987405099feb2f90a11aef029699e Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Wed, 6 Mar 2024 12:12:51 -0300 Subject: [PATCH 2/2] Only show next when don't have any signature After the first person sign the document, the document can't be changed Signed-off-by: Vitor Mattos --- src/Components/Request/RequestSignature.vue | 10 +++++----- src/store/files.js | 12 +++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Components/Request/RequestSignature.vue b/src/Components/Request/RequestSignature.vue index 256c4a5669..c235e6a9e5 100644 --- a/src/Components/Request/RequestSignature.vue +++ b/src/Components/Request/RequestSignature.vue @@ -5,7 +5,7 @@
- {{ t('libresign', 'Add signer') }} @@ -30,7 +30,7 @@
- {{ t('libresign', 'Validate') }} @@ -105,11 +105,11 @@ export default { !Object.hasOwn(this.filesStore.getFile(), 'requested_by') || this.filesStore.getFile().requested_by.uid === getCurrentUser().uid ) - && !this.filesStore.isSigned() + && !this.filesStore.isFullSigned() && this.filesStore.getFile()?.signers?.length > 0 }, canSign() { - return !this.filesStore.isSigned() + return !this.filesStore.isFullSigned() && this.filesStore.getFile()?.signers?.filter(signer => signer.me).length > 0 }, dataSigners() { diff --git a/src/store/files.js b/src/store/files.js index 0743daae10..197bcd8e8f 100644 --- a/src/store/files.js +++ b/src/store/files.js @@ -52,7 +52,17 @@ export const useFilesStore = defineStore('files', { disableIdentifySigner() { this.identifyingSigner = false }, - isSigned() { + isPartialSigned() { + if (this.selectedNodeId === 0) { + return false + } + if (!Object.hasOwn(this.getFile(), 'signers')) { + return false + } + return this.files[this.selectedNodeId].signers + .filter(signer => signer.signed?.length > 0).length > 0 + }, + isFullSigned() { if (this.selectedNodeId === 0) { return false }