Skip to content

Commit

Permalink
Merge pull request #2477 from LibreSign/backport/2476/stable28
Browse files Browse the repository at this point in the history
[stable28] Implement dedicated methods canvalidate and canaddsigner
  • Loading branch information
vitormattos authored Mar 7, 2024
2 parents dd3eddb + 06d06ef commit 0001a4a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/Components/Request/RequestSignature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div v-else
id="request-signature-list-signers">
<NcButton v-if="canSave"
<NcButton v-if="canAddSigner"
:type="hasSigners ? 'secondary' : 'primary'"
@click="addSigner">
{{ t('libresign', 'Add signer') }}
Expand Down Expand Up @@ -49,7 +49,7 @@
</template>
{{ t('libresign', 'Sign') }}
</NcButton>
<NcButton v-if="filesStore.isFullSigned() || !canSave"
<NcButton v-if="canValidate"
type="primary"
@click="validationFile()">
{{ t('libresign', 'Validate') }}
Expand Down Expand Up @@ -105,6 +105,15 @@ export default {
}
},
computed: {
canAddSigner() {
return this.canRequestSign
&& (
!Object.hasOwn(this.filesStore.getFile(), 'requested_by')
|| this.filesStore.getFile().requested_by.uid === getCurrentUser().uid
)
&& !this.filesStore.isPartialSigned()
&& !this.filesStore.isFullSigned()
},
canSave() {
return this.canRequestSign
&& (
Expand All @@ -118,7 +127,13 @@ export default {
canSign() {
return !this.filesStore.isFullSigned()
&& this.filesStore.getFile().status > 0
&& this.filesStore.getFile()?.signers?.filter(signer => signer.me).length === 0
&& this.filesStore.getFile()?.signers?.filter(signer => signer.me).length > 0
&& this.filesStore.getFile()?.signers?.filter(signer => signer.me)
.filter(signer => signer.signed?.length > 0).length === 0
},
canValidate() {
return this.filesStore.isPartialSigned()
|| this.filesStore.isFullSigned()
},
dataSigners() {
return this.filesStore.files[this.filesStore.selectedNodeId].signers
Expand Down

0 comments on commit 0001a4a

Please sign in to comment.