Skip to content

Commit ef3a949

Browse files
feat: add confirmation dialogs for signature requests
Added confirmation dialogs before sending signature requests to improve user awareness and prevent accidental submissions. Changes: - Added confirmation dialog for global 'Request signatures' button - Added confirmation dialog for individual signer 'Request signature' action - Created confirmRequest() and confirmRequestSigner() methods - Added state management: showConfirmRequest, showConfirmRequestSigner, selectedSigner - Modified request() to show confirmation instead of directly executing - Modified requestSignatureForSigner() to show confirmation and store selected signer The confirmation dialogs use NcDialog with @closing event for proper closing behavior when user clicks X, ESC, or Cancel button. Signed-off-by: Vitor Mattos <[email protected]>
1 parent 4315ba4 commit ef3a949

1 file changed

Lines changed: 54 additions & 1 deletion

File tree

src/Components/RightSidebar/RequestSignatureTab.vue

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,44 @@
134134
</NcAppSidebarTab>
135135
</NcAppSidebar>
136136
</NcDialog>
137+
<NcDialog v-if="showConfirmRequest"
138+
:name="t('libresign', 'Confirm')"
139+
:message="t('libresign', 'Send signature request?')"
140+
@closing="showConfirmRequest = false">
141+
<template #actions>
142+
<NcButton @click="showConfirmRequest = false">
143+
{{ t('libresign', 'Cancel') }}
144+
</NcButton>
145+
<NcButton variant="primary"
146+
:disabled="hasLoading"
147+
@click="confirmRequest">
148+
<template #icon>
149+
<NcLoadingIcon v-if="hasLoading" :size="20" />
150+
<Send v-else :size="20" />
151+
</template>
152+
{{ t('libresign', 'Send') }}
153+
</NcButton>
154+
</template>
155+
</NcDialog>
156+
<NcDialog v-if="showConfirmRequestSigner"
157+
:name="t('libresign', 'Confirm')"
158+
:message="t('libresign', 'Send signature request?')"
159+
@closing="showConfirmRequestSigner = false; selectedSigner = null">
160+
<template #actions>
161+
<NcButton @click="showConfirmRequestSigner = false; selectedSigner = null">
162+
{{ t('libresign', 'Cancel') }}
163+
</NcButton>
164+
<NcButton variant="primary"
165+
:disabled="hasLoading"
166+
@click="confirmRequestSigner">
167+
<template #icon>
168+
<NcLoadingIcon v-if="hasLoading" :size="20" />
169+
<Send v-else :size="20" />
170+
</template>
171+
{{ t('libresign', 'Send') }}
172+
</NcButton>
173+
</template>
174+
</NcDialog>
137175
</div>
138176
</template>
139177
<script>
@@ -241,6 +279,9 @@ export default {
241279
document: {},
242280
hasInfo: false,
243281
methods: [],
282+
showConfirmRequest: false,
283+
showConfirmRequestSigner: false,
284+
selectedSigner: null,
244285
}
245286
},
246287
computed: {
@@ -518,11 +559,17 @@ export default {
518559
519560
},
520561
async requestSignatureForSigner(signer) {
562+
this.selectedSigner = signer
563+
this.showConfirmRequestSigner = true
564+
},
565+
async confirmRequestSigner() {
566+
if (!this.selectedSigner) return
567+
521568
this.hasLoading = true
522569
try {
523570
const file = this.filesStore.getFile()
524571
const signers = file.signers.map(s => {
525-
if (s.signRequestId === signer.signRequestId) {
572+
if (s.signRequestId === this.selectedSigner.signRequestId) {
526573
return { ...s, status: 1 }
527574
}
528575
return s
@@ -532,6 +579,8 @@ export default {
532579
signers,
533580
})
534581
showSuccess(t('libresign', 'Signature requested'))
582+
this.showConfirmRequestSigner = false
583+
this.selectedSigner = null
535584
} catch (error) {
536585
if (error.response?.data?.ocs?.data?.message) {
537586
showError(error.response.data.ocs.data.message)
@@ -572,10 +621,14 @@ export default {
572621
this.hasLoading = false
573622
},
574623
async request() {
624+
this.showConfirmRequest = true
625+
},
626+
async confirmRequest() {
575627
this.hasLoading = true
576628
try {
577629
const response = await this.filesStore.updateSignatureRequest({ visibleElements: [], status: 1 })
578630
showSuccess(t('libresign', response.message))
631+
this.showConfirmRequest = false
579632
} catch (error) {
580633
if (error.response?.data?.ocs?.data?.message) {
581634
showError(error.response.data.ocs.data.message)

0 commit comments

Comments
 (0)