Skip to content

Commit

Permalink
fix: sing from action
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos committed Oct 24, 2024
1 parent d380c5d commit 17adce7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
6 changes: 0 additions & 6 deletions src/store/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ export const useFilesStore = function(...args) {
},
isPartialSigned(file) {
file = this.getFile(file)
if (this.selectedNodeId === 0) {
return false
}
if (!Object.hasOwn(file, 'signers')) {
return false
}
Expand All @@ -87,9 +84,6 @@ export const useFilesStore = function(...args) {
},
isFullSigned(file) {
file = this.getFile(file)
if (this.selectedNodeId === 0) {
return false
}
if (!Object.hasOwn(file, 'signers')) {
return false
}
Expand Down
29 changes: 16 additions & 13 deletions src/views/FilesList/FileEntry/FileEntryActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default {
},
},
visibleMenu() {
return this.enabledMenuActions.filter(action => this.visibleIf(action.id))
return this.enabledMenuActions.filter(action => this.visibleIf(action))
},
},
mounted() {
Expand All @@ -131,36 +131,39 @@ export default {
})
},
methods: {
visibleIf(id) {
visibleIf(action) {
const file = this.filesStore.files[this.source.nodeId]
let visible = false
if (id === 'sign') {
if (action.id === 'sign') {
visible = this.filesStore.canSign(file)
} else if (id === 'validate') {
} else if (action.id === 'validate') {
visible = this.filesStore.canValidate(file)
} else if (id === 'delete') {
} else if (action.id === 'delete') {
visible = this.filesStore.canDelete(file)
}
return visible
},
async onActionClick(id) {
const uuid = this.source.uuid
async onActionClick(action) {
this.openedMenu = null
this.sidebarStore.hideSidebar()
if (id === 'sign') {
this.source.signers
if (action.id === 'sign') {
const signer = this.source.signers
.reduce((accumulator, signer) => {
if (signer.me) {
return signer.sign_uuid
}
return accumulator
}, '')
this.signStore.setDocumentToSign(this.source)
this.$router.push({ name: 'SignPDF', params: { uuid } })
this.$router.push({ name: 'SignPDF', params: {

Check failure on line 158 in src/views/FilesList/FileEntry/FileEntryActions.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected a line break after this opening brace

Check failure on line 158 in src/views/FilesList/FileEntry/FileEntryActions.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Object properties must go on a new line if they aren't all on the same line
uuid: signer.sign_uui

Check warning on line 159 in src/views/FilesList/FileEntry/FileEntryActions.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Missing trailing comma
}})

Check failure on line 160 in src/views/FilesList/FileEntry/FileEntryActions.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected a line break before this closing brace

Check failure on line 160 in src/views/FilesList/FileEntry/FileEntryActions.vue

View workflow job for this annotation

GitHub Actions / NPM lint

A space is required before '}'
this.filesStore.selectFile(this.source.nodeId)
} else if (id === 'validate') {
this.$router.push({ name: 'ValidationFile', params: { uuid } })
} else if (id === 'delete') {
} else if (action.id === 'validate') {
this.$router.push({ name: 'ValidationFile', params: {

Check failure on line 163 in src/views/FilesList/FileEntry/FileEntryActions.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected a line break after this opening brace

Check failure on line 163 in src/views/FilesList/FileEntry/FileEntryActions.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Object properties must go on a new line if they aren't all on the same line
uuid: this.source.uuid,
} })

Check failure on line 165 in src/views/FilesList/FileEntry/FileEntryActions.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected a line break before this closing brace
} else if (action.id === 'delete') {
this.confirmDelete = true
}
},
Expand Down

0 comments on commit 17adce7

Please sign in to comment.