Skip to content

Commit 2c2fcaa

Browse files
committed
refactor: update envelope and signature components to use id semantics
- EnvelopeFilesList.vue: update file keying and store references - RequestSignatureTab.vue: update envelope and file ID handling - Request.vue: update to work with new store structure - SignPDF.vue: update file reference handling All envelope and signature-related components now use consistent id-based semantics. Signed-off-by: Vitor Mattos <[email protected]>
1 parent 0f57b5e commit 2c2fcaa

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/Components/RightSidebar/EnvelopeFilesList.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
:details="file.statusText">
5858
<template #icon>
5959
<NcCheckboxRadioSwitch v-if="canDelete"
60-
:checked="isSelected(file.nodeId)"
61-
@update:checked="toggleSelect(file.nodeId)" />
60+
:checked="isSelected(file.id)"
61+
@update:checked="toggleSelect(file.id)" />
6262
<img v-if="getPreviewUrl(file)"
6363
:src="getPreviewUrl(file)"
6464
alt=""
@@ -189,8 +189,8 @@ export default {
189189
envelopeUuid() {
190190
return this.envelope?.uuid || ''
191191
},
192-
envelopeNodeId() {
193-
return this.envelope?.nodeId || null
192+
envelopeId() {
193+
return this.envelope?.id || null
194194
},
195195
canDelete() {
196196
return this.envelope?.status === SIGN_STATUS.DRAFT && this.files.length >= 1
@@ -386,11 +386,11 @@ export default {
386386
this.hasLoading = true
387387
const nodeIds = [...this.selectedFiles]
388388
389-
const result = await this.filesStore.removeFilesFromEnvelope(this.envelopeNodeId, nodeIds)
389+
const result = await this.filesStore.removeFilesFromEnvelope(this.envelopeId, nodeIds)
390390
391391
if (result.success) {
392392
// Remover arquivos da lista local
393-
this.files = this.files.filter(f => !nodeIds.includes(f.nodeId))
393+
this.files = this.files.filter(f => !nodeIds.includes(f.id))
394394
this.selectedFiles = []
395395
this.totalFiles = Math.max(0, this.totalFiles - result.removedCount)
396396
this.showSuccess(this.t('libresign', result.message))
@@ -473,11 +473,11 @@ export default {
473473
async confirmDelete(file) {
474474
this.hasLoading = true
475475
476-
const result = await this.filesStore.removeFilesFromEnvelope(this.envelopeNodeId, file.nodeId)
476+
const result = await this.filesStore.removeFilesFromEnvelope(this.envelopeId, file.id)
477477
478478
if (result.success) {
479479
this.showSuccess(this.t('libresign', result.message))
480-
this.files = this.files.filter(f => f.nodeId !== file.nodeId)
480+
this.files = this.files.filter(f => f.id !== file.id)
481481
this.totalFiles = Math.max(0, this.totalFiles - result.removedCount)
482482
} else {
483483
this.showError(this.t('libresign', result.message))

src/Components/RightSidebar/RequestSignatureTab.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ export default {
594594
signers(signers) {
595595
this.init(signers)
596596
},
597-
'filesStore.selectedNodeId': {
597+
'filesStore.selectedId': {
598598
handler(newFileId, oldFileId) {
599599
if (newFileId && newFileId !== this.lastSyncedFileId) {
600600
this.syncPreserveOrderWithFile()
@@ -684,7 +684,7 @@ export default {
684684
685685
const flow = file.signatureFlow
686686
687-
this.lastSyncedFileId = this.filesStore.selectedNodeId
687+
this.lastSyncedFileId = this.filesStore.selectedId
688688
689689
if ((flow === 'ordered_numeric' || flow === 2) && !this.isAdminFlowForced) {
690690
this.preserveOrder = true
@@ -845,7 +845,7 @@ export default {
845845
},
846846
async sendNotify(signer) {
847847
const body = {
848-
fileId: this.filesStore.selectedNodeId,
848+
fileId: this.filesStore.selectedId,
849849
signRequestId: signer.signRequestId,
850850
}
851851

src/views/Request.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</p>
1313
</header>
1414
<div class="content-request">
15-
<File v-show="filesStore.selectedNodeId > 0"
15+
<File v-show="filesStore.selectedId > 0"
1616
status="0"
1717
status-text="none" />
1818
<ReqestPicker v-if="!sidebarStore.isVisible()"

src/views/SignPDF/SignPDF.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ export default {
114114
const files = await this.fileStore.getAllFiles({
115115
signer_uuid: this.$route.params.uuid,
116116
})
117-
for (const nodeId in files) {
118-
const signer = files[nodeId].signers.find(row => row.me) || {}
117+
for (const fileId in files) {
118+
const signer = files[fileId].signers.find(row => row.me) || {}
119119
if (Object.keys(signer).length > 0) {
120-
this.signStore.setFileToSign(files[nodeId])
121-
this.fileStore.selectedNodeId = nodeId
120+
this.signStore.setFileToSign(files[fileId])
121+
this.fileStore.selectedId = parseInt(fileId)
122122
return
123123
}
124124
}
@@ -128,7 +128,7 @@ export default {
128128
generateOcsUrl('/apps/libresign/api/v1/file/validate/uuid/{uuid}', { uuid: this.$route.params.uuid })
129129
)
130130
this.signStore.setFileToSign(response.data.ocs.data)
131-
this.fileStore.selectedNodeId = response.data.ocs.data.nodeId
131+
this.fileStore.selectedId = response.data.ocs.data.id
132132
},
133133
async handleInitialStatePdfs(urls) {
134134
if (!Array.isArray(urls) || urls.length === 0) {

0 commit comments

Comments
 (0)