-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathsidebar.js
More file actions
56 lines (52 loc) · 1.11 KB
/
sidebar.js
File metadata and controls
56 lines (52 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { defineStore } from 'pinia'
export const useSidebarStore = defineStore('sidebar', {
state: () => ({
show: false,
activeTab: '',
sidebarRoutes: ['fileslist', 'SignPDF', 'SignPDFExternal', 'ValidationFile', 'IdDocsApprove'],
}),
getters: {
canShow() {
return this.show === false && this.activeTab.length > 0
},
isVisible() {
return this.show === true && this.activeTab.length > 0
},
},
actions: {
showSidebar() {
this.show = true
},
activeSignTab() {
this.activeTab = 'sign-tab'
this.showSidebar()
},
activeRequestSignatureTab() {
this.activeTab = 'request-signature-tab'
this.showSidebar()
},
setActiveTab(id) {
this.activeTab = id ?? ''
if (id) {
this.showSidebar()
} else {
this.hideSidebar()
}
},
hideSidebar() {
this.show = false
},
handleRouteChange(routeName) {
if (routeName && !this.sidebarRoutes.includes(routeName)) {
this.hideSidebar()
}
},
toggleSidebar() {
this.show = !this.show
},
},
})