|
32 | 32 | </template> |
33 | 33 | {{ t('libresign', 'Delete') }} |
34 | 34 | </NcActionButton> |
35 | | - <NcActionButton v-if="filesStore.canRequestSign && !signer.signed && signer.signRequestId && !signer.me" |
| 35 | + <NcActionButton v-if="filesStore.canRequestSign && !signer.signed && signer.signRequestId && !signer.me && signer.status === 0" |
| 36 | + :close-after-click="true" |
| 37 | + @click="requestSignatureForSigner(signer)"> |
| 38 | + <template #icon> |
| 39 | + <Send :size="20" /> |
| 40 | + </template> |
| 41 | + {{ t('libresign', 'Request signature') }} |
| 42 | + </NcActionButton> |
| 43 | + <NcActionButton v-if="filesStore.canRequestSign && !signer.signed && signer.signRequestId && !signer.me && signer.status === 1" |
36 | 44 | icon="icon-comment" |
37 | 45 | :close-after-click="true" |
38 | 46 | @click="sendNotify(signer)"> |
@@ -415,6 +423,31 @@ export default { |
415 | 423 | }) |
416 | 424 |
|
417 | 425 | }, |
| 426 | + async requestSignatureForSigner(signer) { |
| 427 | + this.hasLoading = true |
| 428 | + try { |
| 429 | + const file = this.filesStore.getFile() |
| 430 | + const signers = file.signers.map(s => { |
| 431 | + if (s.signRequestId === signer.signRequestId) { |
| 432 | + return { ...s, status: 1 } |
| 433 | + } |
| 434 | + return s |
| 435 | + }) |
| 436 | + await this.filesStore.updateSignatureRequest({ |
| 437 | + visibleElements: [], |
| 438 | + signers, |
| 439 | + status: 1, |
| 440 | + }) |
| 441 | + showSuccess(t('libresign', 'Signature requested')) |
| 442 | + } catch (error) { |
| 443 | + if (error.response?.data?.ocs?.data?.message) { |
| 444 | + showError(error.response.data.ocs.data.message) |
| 445 | + } else if (error.response?.data?.ocs?.data?.errors) { |
| 446 | + error.response.data.ocs.data.errors.forEach(error => showError(error.message)) |
| 447 | + } |
| 448 | + } |
| 449 | + this.hasLoading = false |
| 450 | + }, |
418 | 451 | async sign() { |
419 | 452 | const uuid = this.filesStore.getFile().signers |
420 | 453 | .reduce((accumulator, signer) => { |
@@ -448,7 +481,7 @@ export default { |
448 | 481 | async request() { |
449 | 482 | this.hasLoading = true |
450 | 483 | try { |
451 | | - const response = await this.filesStore.requestSignaturesWithVisibleElements({ visibleElements: [] }) |
| 484 | + const response = await this.filesStore.updateSignatureRequest({ visibleElements: [], status: 1 }) |
452 | 485 | showSuccess(t('libresign', response.message)) |
453 | 486 | } catch (error) { |
454 | 487 | if (error.response?.data?.ocs?.data?.message) { |
|
0 commit comments