Skip to content

Commit 4315ba4

Browse files
refactor: change VisibleElements modal button from Send to Save
The button in the signature positions modal now always shows 'Save' instead of conditionally showing 'Send' or 'Save' based on draft status. Changes: - Button always calls save() method without changing status - Removed confirmation dialog (showConfirm) from VisibleElements - Removed request() method that was changing status to ABLE_TO_SIGN - Removed unused Send icon component import - Simplified button logic by removing isDraft condition This improves UX by making the modal's purpose clear: it's for positioning signatures, not for requesting them. Signed-off-by: Vitor Mattos <[email protected]>
1 parent 55f62c6 commit 4315ba4

1 file changed

Lines changed: 2 additions & 53 deletions

File tree

src/Components/Request/VisibleElements.vue

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
:variant="variantOfSaveButton"
4343
:wide="true"
4444
:class="{ disabled: signerSelected }"
45-
@click="isDraft ? save() : showConfirm = true">
46-
{{ isDraft ? t('libresign', 'Save') : t('libresign', 'Send') }}
45+
@click="save()">
46+
{{ t('libresign', 'Save') }}
4747
</NcButton>
4848

4949
<NcButton v-if="canSign"
@@ -61,31 +61,6 @@
6161
@pdf-editor:end-init="updateSigners"
6262
@pdf-editor:on-delete-signer="onDeleteSigner" />
6363
</div>
64-
<NcDialog v-if="showConfirm"
65-
:open.sync="showConfirm"
66-
:name="t('libresign', 'Confirm')"
67-
:no-close="loading"
68-
:message="t('libresign', 'Send signature request?')">
69-
<NcNoteCard v-if="errorConfirmRequest.length > 0"
70-
type="error">
71-
{{ errorConfirmRequest }}
72-
</NcNoteCard>
73-
<template #actions>
74-
<NcButton :disabled="loading"
75-
@click="showConfirm = false">
76-
{{ t('libresign', 'Cancel') }}
77-
</NcButton>
78-
<NcButton variant="primary"
79-
:disabled="loading"
80-
@click="request">
81-
<template #icon>
82-
<NcLoadingIcon v-if="loading" :size="20" name="Loading" />
83-
<Send v-else :size="20" />
84-
</template>
85-
{{ t('libresign', 'Send') }}
86-
</NcButton>
87-
</template>
88-
</NcDialog>
8964
</NcDialog>
9065
</template>
9166

@@ -102,8 +77,6 @@ import NcDialog from '@nextcloud/vue/components/NcDialog'
10277
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
10378
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
10479
105-
import Send from 'vue-material-design-icons/Send.vue'
106-
10780
import Chip from '../Chip.vue'
10881
import PdfEditor from '../PdfEditor/PdfEditor.vue'
10982
import Signer from '../Signers/Signer.vue'
@@ -121,7 +94,6 @@ export default {
12194
NcButton,
12295
NcLoadingIcon,
12396
PdfEditor,
124-
Send,
12597
},
12698
setup() {
12799
const filesStore = useFilesStore()
@@ -131,9 +103,7 @@ export default {
131103
return {
132104
canRequestSign: loadState('libresign', 'can_request_sign', false),
133105
modal: false,
134-
showConfirm: false,
135106
loading: false,
136-
errorConfirmRequest: '',
137107
signerSelected: null,
138108
width: getCapabilities().libresign.config['sign-elements']['full-signature-width'],
139109
height: getCapabilities().libresign.config['sign-elements']['full-signature-height'],
@@ -204,7 +174,6 @@ export default {
204174
this.filesStore.loading = true
205175
},
206176
closeModal() {
207-
this.errorConfirmRequest = ''
208177
this.modal = false
209178
this.filesStore.loading = false
210179
},
@@ -306,26 +275,6 @@ export default {
306275
return false
307276
}
308277
},
309-
async request() {
310-
this.loading = true
311-
this.errorConfirmRequest = ''
312-
const visibleElements = this.buildVisibleElements()
313-
314-
try {
315-
const response = await this.filesStore.updateSignatureRequest({ visibleElements, status: 1 })
316-
this.filesStore.addFile(response.data)
317-
this.showConfirm = false
318-
showSuccess(t('libresign', response.message))
319-
this.closeModal()
320-
emit('libresign:visible-elements-saved')
321-
this.loading = false
322-
return true
323-
} catch (error) {
324-
this.errorConfirmRequest = error.response?.data?.ocs?.data?.message || t('libresign', 'An error occurred')
325-
this.loading = false
326-
return false
327-
}
328-
},
329278
buildVisibleElements() {
330279
const visibleElements = []
331280
const scale = this.$refs.pdfEditor.$refs.vuePdfEditor.scale || 1

0 commit comments

Comments
 (0)