mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-17 21:12:16 +01:00
refactor: extract signer action conditions to computed properties
- Add canEditSigningOrder, canDelete, canRequestSignature, canSendReminder - Improve code readability and maintainability - Ensure consistent reactive behavior across all conditions Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This commit is contained in:
parent
a25ccf5279
commit
7513bb2869
1 changed files with 35 additions and 4 deletions
|
|
@ -12,7 +12,7 @@
|
|||
<Signers event="libresign:edit-signer"
|
||||
@signing-order-changed="debouncedSave">
|
||||
<template #actions="{signer, closeActions}">
|
||||
<NcActionInput v-if="isOrderedNumeric && totalSigners > 1 && filesStore.canSave() && !signer.signed"
|
||||
<NcActionInput v-if="canEditSigningOrder(signer)"
|
||||
:label="t('libresign', 'Signing order')"
|
||||
type="number"
|
||||
:value="signer.signingOrder || 1"
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<OrderNumericAscending :size="20" />
|
||||
</template>
|
||||
</NcActionInput>
|
||||
<NcActionButton v-if="filesStore.canSave() && !signer.signed"
|
||||
<NcActionButton v-if="canDelete(signer)"
|
||||
aria-label="Delete"
|
||||
:close-after-click="true"
|
||||
@click="filesStore.deleteSigner(signer)">
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
</template>
|
||||
{{ t('libresign', 'Delete') }}
|
||||
</NcActionButton>
|
||||
<NcActionButton v-if="filesStore.canRequestSign && !signer.signed && signer.signRequestId && !signer.me && signer.status === 0"
|
||||
<NcActionButton v-if="canRequestSignature(signer)"
|
||||
:close-after-click="true"
|
||||
@click="requestSignatureForSigner(signer)">
|
||||
<template #icon>
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
</template>
|
||||
{{ t('libresign', 'Request signature') }}
|
||||
</NcActionButton>
|
||||
<NcActionButton v-if="filesStore.canRequestSign && !signer.signed && signer.signRequestId && !signer.me && signer.status === 1"
|
||||
<NcActionButton v-if="canSendReminder(signer)"
|
||||
icon="icon-comment"
|
||||
:close-after-click="true"
|
||||
@click="sendNotify(signer)">
|
||||
|
|
@ -248,6 +248,37 @@ export default {
|
|||
isOrderedNumeric() {
|
||||
return this.signatureFlow === 'ordered_numeric'
|
||||
},
|
||||
canEditSigningOrder() {
|
||||
return (signer) => {
|
||||
return this.isOrderedNumeric
|
||||
&& this.totalSigners > 1
|
||||
&& this.filesStore.canSave()
|
||||
&& !signer.signed
|
||||
}
|
||||
},
|
||||
canDelete() {
|
||||
return (signer) => {
|
||||
return this.filesStore.canSave() && !signer.signed
|
||||
}
|
||||
},
|
||||
canRequestSignature() {
|
||||
return (signer) => {
|
||||
return this.filesStore.canRequestSign
|
||||
&& !signer.signed
|
||||
&& signer.signRequestId
|
||||
&& !signer.me
|
||||
&& signer.status === 0
|
||||
}
|
||||
},
|
||||
canSendReminder() {
|
||||
return (signer) => {
|
||||
return this.filesStore.canRequestSign
|
||||
&& !signer.signed
|
||||
&& signer.signRequestId
|
||||
&& !signer.me
|
||||
&& signer.status === 1
|
||||
}
|
||||
},
|
||||
showSaveButton() {
|
||||
if (!this.filesStore.canSave()) {
|
||||
return false
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue