mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-18 05:20:45 +01:00
refactor: update frontend to use IdDocs routes and components
- Rename AccountValidation to IdDocsValidation component - Update router paths from /docs/accounts to /docs/id-docs - Update route names: DocsAccountValidation -> DocsIdDocsValidation - Update action handlers to use IdDocsApprove route - Update LeftSidebar navigation links Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This commit is contained in:
parent
ffa9af720b
commit
8886414f18
5 changed files with 37 additions and 17 deletions
|
|
@ -33,7 +33,7 @@
|
|||
</NcAppNavigationItem>
|
||||
|
||||
<NcAppNavigationItem v-if="config.identificationDocumentsFlow && config.isApprover"
|
||||
:to="{name: 'DocsAccountValidation'}"
|
||||
:to="{name: 'DocsIdDocsValidation'}"
|
||||
:name="t('libresign', 'Documents Validation')">
|
||||
<template #icon>
|
||||
<AccountCheckIcon :size="20" />
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ export const selectAction = (action, to, from) => {
|
|||
return 'SignPDF' + external
|
||||
case 2625: // ACTION_SIGN_INTERNAL
|
||||
return 'SignPDF' + external
|
||||
case 2750: // ACTION_SIGN_ACCOUNT_FILE
|
||||
return 'AccountFileApprove' + external
|
||||
case 2750: // ACTION_SIGN_ID_DOC
|
||||
return 'IdDocsApprove' + external
|
||||
case 3000: // ACTION_SHOW_ERROR
|
||||
return 'DefaultPageError' + external
|
||||
case 3500: // ACTION_SIGNED
|
||||
|
|
|
|||
|
|
@ -165,8 +165,8 @@ const router = new Router({
|
|||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/f/account/files/approve/:uuid',
|
||||
name: 'AccountFileApprove',
|
||||
path: '/f/id-docs/approve/:uuid',
|
||||
name: 'IdDocsApprove',
|
||||
component: () => import('../views/SignPDF/SignPDF.vue'),
|
||||
props: true,
|
||||
},
|
||||
|
|
@ -176,9 +176,9 @@ const router = new Router({
|
|||
component: () => import('../views/Account/Account.vue'),
|
||||
},
|
||||
{
|
||||
path: '/f/docs/accounts/validation',
|
||||
name: 'DocsAccountValidation',
|
||||
component: () => import('../views/Documents/AccountValidation.vue'),
|
||||
path: '/f/docs/id-docs/validation',
|
||||
name: 'DocsIdDocsValidation',
|
||||
component: () => import('../views/Documents/IdDocsValidation.vue'),
|
||||
},
|
||||
{
|
||||
path: '/f/crl/management',
|
||||
|
|
|
|||
|
|
@ -100,6 +100,13 @@ export default {
|
|||
FilePicker,
|
||||
ProgressBar,
|
||||
},
|
||||
props: {
|
||||
signRequestUuid: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
documentList: [],
|
||||
|
|
@ -138,7 +145,11 @@ export default {
|
|||
},
|
||||
async loadDocuments() {
|
||||
this.loading = true
|
||||
await axios.get(generateOcsUrl('/apps/libresign/api/v1/account/files'))
|
||||
const params = {};
|
||||
if (this.signRequestUuid) {
|
||||
params.uuid = this.signRequestUuid
|
||||
}
|
||||
await axios.get(generateOcsUrl('/apps/libresign/api/v1/id-docs'), { params })
|
||||
.then(({ data }) => {
|
||||
this.documentList = data.ocs.data.data
|
||||
})
|
||||
|
|
@ -156,7 +167,7 @@ export default {
|
|||
|
||||
this.loading = true
|
||||
|
||||
await axios.post(generateOcsUrl('/apps/libresign/api/v1/account/files'), {
|
||||
const params = {
|
||||
files: [{
|
||||
type: this.selectedType,
|
||||
name: path.match(/([^/]*?)(?:\.[^.]*)?$/)[1] ?? '',
|
||||
|
|
@ -164,7 +175,12 @@ export default {
|
|||
path,
|
||||
},
|
||||
}],
|
||||
})
|
||||
}
|
||||
if (this.signRequestUuid) {
|
||||
params.uuid = this.signRequestUuid;
|
||||
}
|
||||
|
||||
await axios.post(generateOcsUrl('/apps/libresign/api/v1/id-docs'), params)
|
||||
.then(() => {
|
||||
showSuccess(t('libresign', 'File was sent.'))
|
||||
})
|
||||
|
|
@ -176,7 +192,7 @@ export default {
|
|||
async uploadFile(type, inputFile) {
|
||||
this.loading = true
|
||||
const raw = await loadFileToBase64(inputFile)
|
||||
await axios.post(generateOcsUrl('/apps/libresign/api/v1/account/files'), {
|
||||
const params = {
|
||||
files: [{
|
||||
type,
|
||||
name: inputFile.name,
|
||||
|
|
@ -184,7 +200,11 @@ export default {
|
|||
base64: raw,
|
||||
},
|
||||
}],
|
||||
})
|
||||
}
|
||||
if (this.signRequestUuid) {
|
||||
params.uuid = this.signRequestUuid;
|
||||
}
|
||||
await axios.post(generateOcsUrl('/apps/libresign/api/v1/id-docs'), params)
|
||||
.then(() => {
|
||||
showSuccess(t('libresign', 'File was sent.'))
|
||||
})
|
||||
|
|
@ -194,7 +214,7 @@ export default {
|
|||
this.loading = false
|
||||
},
|
||||
async deleteFile({ nodeId }) {
|
||||
await axios.delete(generateOcsUrl('/apps/libresign/api/v1/account/files'), {
|
||||
await axios.delete(generateOcsUrl('/apps/libresign/api/v1/id-docs'), {
|
||||
data: { nodeId },
|
||||
})
|
||||
.then(async () => {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import { generateOcsUrl } from '@nextcloud/router'
|
|||
import ProgressBar from '../../Components/ProgressBar.vue'
|
||||
|
||||
export default {
|
||||
name: 'AccountValidation',
|
||||
name: 'IdDocsValidation',
|
||||
components: {
|
||||
ProgressBar,
|
||||
},
|
||||
|
|
@ -60,7 +60,7 @@ export default {
|
|||
methods: {
|
||||
async loadDocuments() {
|
||||
this.loading = true
|
||||
await axios.get(generateOcsUrl('/apps/libresign/api/v1/account/files/approval/list'))
|
||||
await axios.get(generateOcsUrl('/apps/libresign/api/v1/id-docs/approval/list'))
|
||||
.then(({ data }) => {
|
||||
this.documentList = data.ocs.data.data
|
||||
})
|
||||
|
|
@ -71,7 +71,7 @@ export default {
|
|||
},
|
||||
|
||||
openApprove(doc) {
|
||||
const route = this.$router.resolve({ name: 'AccountFileApprove', params: { uuid: doc.uuid } })
|
||||
const route = this.$router.resolve({ name: 'IdDocsApprove', params: { uuid: doc.uuid } })
|
||||
const url = new URL(window.location.toString())
|
||||
|
||||
url.pathname = route.href
|
||||
Loading…
Add table
Reference in a new issue