Skip to content

Commit 3ee0f46

Browse files
committed
feat: display Documents component inline in sign flow
- Show Documents component directly instead of in modal - Remove uploadDocuments modal code (no longer needed) - Provides more direct and intuitive user experience Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 2127beb commit 3ee0f46

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/views/SignPDF/_partials/Sign.vue

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
{{ t('libresign', 'Define your signature.') }}
5252
</NcButton>
5353
</div>
54+
<div v-else-if="needIdentificationDocuments" class="no-identification-warning">
55+
<Documents :sign-request-uuid="signRequestUuid" />
56+
</div>
5457
<div v-else>
5558
<p>
5659
{{ t('libresign', 'Unable to sign.') }}
@@ -155,6 +158,7 @@ import NcRichText from '@nextcloud/vue/components/NcRichText'
155158
import EmailManager from './ModalEmailManager.vue'
156159
import SMSManager from './ModalSMSManager.vue'
157160
import Draw from '../../../Components/Draw/Draw.vue'
161+
import Documents from '../../../views/Account/partials/Documents.vue'
158162
import Signatures from '../../../views/Account/partials/Signatures.vue'
159163
import CreatePassword from '../../../views/CreatePassword.vue'
160164
import ManagePassword from '../../Account/partials/ManagePassword.vue'
@@ -164,6 +168,7 @@ import { useSidebarStore } from '../../../store/sidebar.js'
164168
import { useSignStore } from '../../../store/sign.js'
165169
import { useSignatureElementsStore } from '../../../store/signatureElements.js'
166170
import { useSignMethodsStore } from '../../../store/signMethods.js'
171+
import { useIdentificationDocumentStore } from '../../../store/identificationDocument.js'
167172
168173
export default {
169174
name: 'Sign',
@@ -177,6 +182,7 @@ export default {
177182
CreatePassword,
178183
SMSManager,
179184
EmailManager,
185+
Documents,
180186
Signatures,
181187
Draw,
182188
ManagePassword,
@@ -187,7 +193,8 @@ export default {
187193
const signMethodsStore = useSignMethodsStore()
188194
const signatureElementsStore = useSignatureElementsStore()
189195
const sidebarStore = useSidebarStore()
190-
return { signStore, signMethodsStore, signatureElementsStore, sidebarStore }
196+
const identificationDocumentStore = useIdentificationDocumentStore()
197+
return { signStore, signMethodsStore, signatureElementsStore, sidebarStore, identificationDocumentStore }
191198
},
192199
data() {
193200
return {
@@ -226,6 +233,17 @@ export default {
226233
&& !this.hasSignatures
227234
&& this.canCreateSignature
228235
},
236+
needIdentificationDocuments() {
237+
const needsFromStore = this.identificationDocumentStore.needIdentificationDocument()
238+
239+
const hasError = this.errors.some(error =>
240+
error.message && error.message.includes('approved identification document')
241+
)
242+
243+
const isWaitingApproval = this.identificationDocumentStore.enabled && this.identificationDocumentStore.waitingApproval
244+
245+
return needsFromStore || hasError || isWaitingApproval
246+
},
229247
canCreateSignature() {
230248
return getCapabilities()?.libresign?.config?.['sign-elements']?.['can-create-signature'] === true
231249
},
@@ -236,6 +254,9 @@ export default {
236254
if (this.needCreateSignature) {
237255
return false
238256
}
257+
if (this.needIdentificationDocuments) {
258+
return false
259+
}
239260
if (this.signStore.errors.length > 0) {
240261
return false
241262
}
@@ -362,6 +383,10 @@ export default {
362383
},
363384
confirmSignDocument() {
364385
this.errors = []
386+
if (this.needIdentificationDocuments) {
387+
this.showModalAndResetErrors('uploadDocuments')
388+
return
389+
}
365390
if (this.signMethodsStore.needEmailCode()) {
366391
this.showModalAndResetErrors('emailToken')
367392
return
@@ -399,6 +424,10 @@ export default {
399424
margin-top: 1em;
400425
}
401426
427+
.no-identification-warning {
428+
margin-top: 1em;
429+
}
430+
402431
.button-wrapper {
403432
padding: calc(var(--default-grid-baseline, 4px)*2);
404433
}

0 commit comments

Comments
 (0)