@coopenomics/desktop 2025.11.17-alpha-4 → 2025.11.18-alpha-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/capital/features/Commit/CreateCommit/ui/CreateCommitButton.vue +4 -4
- package/extensions/capital/pages/ProjectsListPage/ui/ProjectsListPage.vue +3 -3
- package/package.json +6 -6
- package/src/app/layouts/useDefaultLayoutLogic.ts +1 -3
- package/src/entities/CmdkMenu/model/store.ts +6 -6
- package/src/entities/Desktop/model/store.ts +5 -5
- package/src/entities/Session/index.ts +0 -1
- package/src/entities/Session/model/store.ts +31 -0
- package/src/entities/User/index.ts +0 -3
- package/src/features/User/CreateUser/model/index.ts +1 -3
- package/src/features/User/LoginUser/model/index.ts +8 -11
- package/src/features/User/LoginUser/ui/LoginForm/LoginForm.vue +2 -5
- package/src/features/User/Logout/model/index.ts +3 -3
- package/src/features/User/Logout/ui/LogoutButton/LogoutButton.vue +1 -3
- package/src/pages/Cooperative/ListOfAgenda/ui/ListOfAgendaQuestions.vue +4 -3
- package/src/pages/Cooperative/ListOfMeets/ui/ListOfMeetsPage.vue +4 -4
- package/src/pages/PermissionDenied/PermissionDenied.vue +1 -3
- package/src/pages/Registrator/SignIn/ui/SignInPage.vue +4 -3
- package/src/pages/Registrator/SignUp/SignUp.vue +3 -6
- package/src/pages/Registrator/SignUp/WaitingRegistration.vue +4 -4
- package/src/pages/User/PaymentMethodsPage/ui/PaymentMethods.vue +3 -3
- package/src/pages/User/ProfilePage/ui/ProfilePage.vue +10 -10
- package/src/pages/User/WalletPage/ui/WalletPage.vue +0 -2
- package/src/processes/navigation-guard-setup/index.ts +3 -5
- package/src/widgets/Desktop/SecondLevelMenuList/SecondLevelMenuList.vue +8 -8
- package/src/widgets/Desktop/WorkspaceMenu/WorkspaceMenu.vue +3 -3
- package/src/widgets/Header/CommonHeader/MainHeader.vue +2 -3
- package/src/widgets/Header/SettingsDropdown/SettingsDropdown.vue +1 -3
- package/src/widgets/NotificationCenter/NotificationCenter.vue +5 -5
- package/src/widgets/Questions/ui/QuestionCard/QuestionCard.vue +3 -3
- package/src/widgets/User/CoopCard/ui/CoopCard.vue +12 -12
- package/src/widgets/Wallet/MicroWallet/ui/MicroWallet.vue +7 -7
- package/src/widgets/Wallet/WalletWidget/ui/WalletWidget.vue +5 -5
- package/src/entities/Session/composables/useCurrentUser.ts +0 -39
|
@@ -33,7 +33,7 @@ q-btn(
|
|
|
33
33
|
import { ref, watch } from 'vue';
|
|
34
34
|
import { useCreateCommit } from '../model';
|
|
35
35
|
import { useSystemStore } from 'src/entities/System/model';
|
|
36
|
-
import {
|
|
36
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
37
37
|
import { generateUniqueHash } from 'src/shared/lib/utils/generateUniqueHash';
|
|
38
38
|
import { FailAlert, SuccessAlert } from 'src/shared/api/alerts';
|
|
39
39
|
import { ModalBase } from 'src/shared/ui/ModalBase';
|
|
@@ -49,8 +49,8 @@ const props = defineProps<{
|
|
|
49
49
|
}>();
|
|
50
50
|
|
|
51
51
|
const system = useSystemStore();
|
|
52
|
-
const
|
|
53
|
-
const { createCommit, createCommitInput } = useCreateCommit(props.projectHash, username);
|
|
52
|
+
const session = useSessionStore();
|
|
53
|
+
const { createCommit, createCommitInput } = useCreateCommit(props.projectHash, session.username);
|
|
54
54
|
|
|
55
55
|
const loading = ref(false);
|
|
56
56
|
const showDialog = ref(false);
|
|
@@ -88,7 +88,7 @@ const handleCreateCommit = async () => {
|
|
|
88
88
|
coopname: system.info.coopname,
|
|
89
89
|
commit_hours: formData.value.creator_hours,
|
|
90
90
|
project_hash: props.projectHash || createCommitInput.value.project_hash,
|
|
91
|
-
username: username || createCommitInput.value.username,
|
|
91
|
+
username: session.username || createCommitInput.value.username,
|
|
92
92
|
description: formData.value.description,
|
|
93
93
|
meta: JSON.stringify({}),
|
|
94
94
|
};
|
|
@@ -38,7 +38,7 @@ div
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
// Floating Action Button для создания проекта
|
|
41
|
-
Fab(v-if='
|
|
41
|
+
Fab(v-if='session.isChairman || session.isMember')
|
|
42
42
|
template(#actions)
|
|
43
43
|
CreateProjectFabAction
|
|
44
44
|
</template>
|
|
@@ -53,11 +53,11 @@ import { Fab } from 'src/shared/ui';
|
|
|
53
53
|
import { CreateProjectFabAction } from 'app/extensions/capital/features/Project/CreateProject';
|
|
54
54
|
import { ProjectsListWidget, ComponentsListWidget, IssuesListWidget, ListFilterWidget } from 'app/extensions/capital/widgets';
|
|
55
55
|
import { useProjectFilters } from 'app/extensions/capital/widgets/ListFilterWidget/useProjectFilters';
|
|
56
|
-
import {
|
|
56
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
57
57
|
import { useProjectStore } from 'app/extensions/capital/entities/Project/model';
|
|
58
58
|
|
|
59
59
|
const router = useRouter();
|
|
60
|
-
const
|
|
60
|
+
const session = useSessionStore();
|
|
61
61
|
const projectStore = useProjectStore();
|
|
62
62
|
|
|
63
63
|
// Используем композабл для управления фильтрами
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopenomics/desktop",
|
|
3
|
-
"version": "2025.11.
|
|
3
|
+
"version": "2025.11.18-alpha-1",
|
|
4
4
|
"description": "A Desktop Project",
|
|
5
5
|
"productName": "Desktop App",
|
|
6
6
|
"author": "Alex Ant <dacom.dark.sun@gmail.com>",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"start": "node -r ./alias-resolver.js dist/ssr/index.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@coopenomics/controller": "2025.11.
|
|
29
|
-
"@coopenomics/notifications": "2025.11.
|
|
30
|
-
"@coopenomics/sdk": "2025.11.
|
|
28
|
+
"@coopenomics/controller": "2025.11.18-alpha-1",
|
|
29
|
+
"@coopenomics/notifications": "2025.11.18-alpha-1",
|
|
30
|
+
"@coopenomics/sdk": "2025.11.18-alpha-1",
|
|
31
31
|
"@dicebear/collection": "^9.0.1",
|
|
32
32
|
"@dicebear/core": "^9.0.1",
|
|
33
33
|
"@editorjs/code": "^2.9.3",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@wharfkit/wallet-plugin-privatekey": "^1.1.0",
|
|
60
60
|
"axios": "^1.2.1",
|
|
61
61
|
"compression": "^1.7.4",
|
|
62
|
-
"cooptypes": "2025.11.
|
|
62
|
+
"cooptypes": "2025.11.18-alpha-1",
|
|
63
63
|
"dompurify": "^3.1.7",
|
|
64
64
|
"dotenv": "^16.4.5",
|
|
65
65
|
"email-regex": "^5.0.0",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"npm": ">= 6.13.4",
|
|
124
124
|
"yarn": ">= 1.21.1"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "86172790d1a19def4062384a0aa1f67f40ca51cf"
|
|
127
127
|
}
|
|
@@ -4,7 +4,6 @@ import { useRoute } from 'vue-router';
|
|
|
4
4
|
import { useWindowSize } from 'vue-window-size';
|
|
5
5
|
import { useSystemStore } from 'src/entities/System/model';
|
|
6
6
|
import { useSessionStore } from 'src/entities/Session';
|
|
7
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
8
7
|
import { useDesktopStore } from 'src/entities/Desktop/model';
|
|
9
8
|
|
|
10
9
|
export function useDefaultLayoutLogic() {
|
|
@@ -12,7 +11,6 @@ export function useDefaultLayoutLogic() {
|
|
|
12
11
|
const { width } = useWindowSize();
|
|
13
12
|
const route = useRoute();
|
|
14
13
|
const session = useSessionStore();
|
|
15
|
-
const currentUser = useCurrentUser();
|
|
16
14
|
const system = useSystemStore();
|
|
17
15
|
const desktop = useDesktopStore();
|
|
18
16
|
|
|
@@ -32,7 +30,7 @@ export function useDefaultLayoutLogic() {
|
|
|
32
30
|
);
|
|
33
31
|
|
|
34
32
|
const isRegistrationComplete = computed(
|
|
35
|
-
() =>
|
|
33
|
+
() => session.isRegistrationComplete,
|
|
36
34
|
);
|
|
37
35
|
|
|
38
36
|
const loggedIn = computed(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
2
|
import { computed, ref, nextTick } from 'vue';
|
|
3
3
|
import { useRouter } from 'vue-router';
|
|
4
|
-
import {
|
|
4
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
5
5
|
import { useDesktopStore } from 'src/entities/Desktop/model';
|
|
6
6
|
import { useSystemStore } from 'src/entities/System/model';
|
|
7
7
|
import type { PageItem, GroupedItem } from './types';
|
|
@@ -11,7 +11,7 @@ const namespace = 'cmdk-menu';
|
|
|
11
11
|
export const useCmdkMenuStore = defineStore(namespace, () => {
|
|
12
12
|
// Composables
|
|
13
13
|
const router = useRouter();
|
|
14
|
-
const
|
|
14
|
+
const session = useSessionStore();
|
|
15
15
|
const desktop = useDesktopStore();
|
|
16
16
|
const { info } = useSystemStore();
|
|
17
17
|
|
|
@@ -71,7 +71,7 @@ export const useCmdkMenuStore = defineStore(namespace, () => {
|
|
|
71
71
|
|
|
72
72
|
// Вычисляем роль пользователя
|
|
73
73
|
const userRole = computed(() =>
|
|
74
|
-
|
|
74
|
+
session.isChairman ? 'chairman' : session.isMember ? 'member' : 'user'
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
// Группировка воркспейсов с их страницами
|
|
@@ -100,10 +100,10 @@ const groupedItems = computed<GroupedItem[]>(() => {
|
|
|
100
100
|
page.meta.roles.length === 0;
|
|
101
101
|
const conditionMatch = page.meta?.conditions
|
|
102
102
|
? evaluateCondition(page.meta.conditions, {
|
|
103
|
-
isCoop:
|
|
104
|
-
|
|
103
|
+
isCoop: session.privateAccount?.type === 'organization' &&
|
|
104
|
+
session.privateAccount?.organization_data?.type?.toUpperCase() === 'COOP',
|
|
105
105
|
userRole: userRole.value,
|
|
106
|
-
userAccount:
|
|
106
|
+
userAccount: session.privateAccount,
|
|
107
107
|
coopname: info.coopname,
|
|
108
108
|
})
|
|
109
109
|
: true;
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from './types';
|
|
8
8
|
import { api } from '../api';
|
|
9
9
|
import { useSystemStore } from 'src/entities/System/model';
|
|
10
|
-
import {
|
|
10
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
11
11
|
|
|
12
12
|
interface WorkspaceMenuItem {
|
|
13
13
|
workspaceName: string;
|
|
@@ -139,12 +139,12 @@ export const useDesktopStore = defineStore(namespace, () => {
|
|
|
139
139
|
|
|
140
140
|
// Получаем настройки системы
|
|
141
141
|
const systemStore = useSystemStore();
|
|
142
|
-
const
|
|
142
|
+
const session = useSessionStore();
|
|
143
143
|
|
|
144
144
|
let defaultWorkspace = 'participant'; // дефолтное значение
|
|
145
145
|
|
|
146
146
|
// Определяем, какие настройки использовать (авторизованный или неавторизованный пользователь)
|
|
147
|
-
if (
|
|
147
|
+
if (session.isAuth) {
|
|
148
148
|
// Для авторизованных пользователей используем authorized_default_workspace
|
|
149
149
|
defaultWorkspace = systemStore.info?.settings?.authorized_default_workspace || 'participant';
|
|
150
150
|
} else {
|
|
@@ -242,7 +242,7 @@ export const useDesktopStore = defineStore(namespace, () => {
|
|
|
242
242
|
params: Record<string, any>;
|
|
243
243
|
} | null {
|
|
244
244
|
const { info } = useSystemStore();
|
|
245
|
-
const
|
|
245
|
+
const session = useSessionStore();
|
|
246
246
|
|
|
247
247
|
if (!currentDesktop.value || !activeWorkspaceName.value) {
|
|
248
248
|
return null;
|
|
@@ -260,7 +260,7 @@ export const useDesktopStore = defineStore(namespace, () => {
|
|
|
260
260
|
// Проверяем, есть ли настроенный маршрут для текущего рабочего стола
|
|
261
261
|
let configuredRoute: string | undefined;
|
|
262
262
|
|
|
263
|
-
if (
|
|
263
|
+
if (session.isAuth) {
|
|
264
264
|
// Для авторизованных пользователей используем authorized_default_route
|
|
265
265
|
configuredRoute = info?.settings?.authorized_default_route;
|
|
266
266
|
} else {
|
|
@@ -19,10 +19,17 @@ interface ISessionStore {
|
|
|
19
19
|
// Добавляю данные текущего пользователя
|
|
20
20
|
currentUserAccount: Ref<IAccount | undefined>;
|
|
21
21
|
setCurrentUserAccount: (account: IAccount | undefined) => void;
|
|
22
|
+
clearAccount: () => void;
|
|
22
23
|
// Computed свойства для текущего пользователя
|
|
23
24
|
isRegistrationComplete: ComputedRef<boolean>;
|
|
24
25
|
isChairman: ComputedRef<boolean>;
|
|
25
26
|
isMember: ComputedRef<boolean>;
|
|
27
|
+
// Удобные геттеры для различных типов данных
|
|
28
|
+
userAccount: ComputedRef<IAccount['user_account'] | undefined>;
|
|
29
|
+
privateAccount: ComputedRef<IAccount['private_account'] | undefined>;
|
|
30
|
+
blockchainAccount: ComputedRef<IAccount['blockchain_account'] | undefined>;
|
|
31
|
+
participantAccount: ComputedRef<IAccount['participant_account'] | undefined>;
|
|
32
|
+
providerAccount: ComputedRef<IAccount['provider_account'] | undefined>;
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
@@ -37,6 +44,10 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
|
37
44
|
currentUserAccount.value = account;
|
|
38
45
|
};
|
|
39
46
|
|
|
47
|
+
const clearAccount = () => {
|
|
48
|
+
setCurrentUserAccount(undefined);
|
|
49
|
+
};
|
|
50
|
+
|
|
40
51
|
const close = async (): Promise<void> => {
|
|
41
52
|
isAuth.value = false;
|
|
42
53
|
session.value = undefined;
|
|
@@ -87,6 +98,19 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
|
87
98
|
() => currentUserAccount.value?.provider_account?.role === 'member',
|
|
88
99
|
);
|
|
89
100
|
|
|
101
|
+
// Удобные геттеры для различных типов данных
|
|
102
|
+
const userAccount = computed(() => currentUserAccount.value?.user_account);
|
|
103
|
+
const privateAccount = computed(() => currentUserAccount.value?.private_account);
|
|
104
|
+
const blockchainAccount = computed(
|
|
105
|
+
() => currentUserAccount.value?.blockchain_account,
|
|
106
|
+
);
|
|
107
|
+
const participantAccount = computed(
|
|
108
|
+
() => currentUserAccount.value?.participant_account,
|
|
109
|
+
);
|
|
110
|
+
const providerAccount = computed(
|
|
111
|
+
() => currentUserAccount.value?.provider_account,
|
|
112
|
+
);
|
|
113
|
+
|
|
90
114
|
const username = computed(() => globalStore.username);
|
|
91
115
|
|
|
92
116
|
return {
|
|
@@ -98,8 +122,15 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
|
98
122
|
loadComplete,
|
|
99
123
|
currentUserAccount,
|
|
100
124
|
setCurrentUserAccount,
|
|
125
|
+
clearAccount,
|
|
101
126
|
isRegistrationComplete,
|
|
102
127
|
isChairman,
|
|
103
128
|
isMember,
|
|
129
|
+
// Удобные геттеры для различных типов данных
|
|
130
|
+
userAccount,
|
|
131
|
+
privateAccount,
|
|
132
|
+
blockchainAccount,
|
|
133
|
+
participantAccount,
|
|
134
|
+
providerAccount,
|
|
104
135
|
};
|
|
105
136
|
});
|
|
@@ -9,7 +9,6 @@ import { useGlobalStore } from 'src/shared/store';
|
|
|
9
9
|
import { useSystemStore } from 'src/entities/System/model';
|
|
10
10
|
|
|
11
11
|
import type { IInitialPaymentOrder } from 'src/shared/lib/types/payments';
|
|
12
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
13
12
|
import { useRegistratorStore } from 'src/entities/Registrator';
|
|
14
13
|
import {
|
|
15
14
|
IEntrepreneurData,
|
|
@@ -233,14 +232,13 @@ export function useCreateUser() {
|
|
|
233
232
|
|
|
234
233
|
await sessionStore.init();
|
|
235
234
|
|
|
236
|
-
const currentUser = useCurrentUser();
|
|
237
235
|
const accountStore = useAccountStore();
|
|
238
236
|
// После создания пользователя обновляем данные в сессии
|
|
239
237
|
const updatedAccount = await accountStore.getAccount(account.username);
|
|
240
238
|
if (updatedAccount) {
|
|
241
239
|
console.log('updatedAccount: ', updatedAccount);
|
|
242
240
|
|
|
243
|
-
|
|
241
|
+
sessionStore.setCurrentUserAccount(updatedAccount);
|
|
244
242
|
}
|
|
245
243
|
}
|
|
246
244
|
|
|
@@ -2,7 +2,6 @@ import { useSessionStore } from 'src/entities/Session';
|
|
|
2
2
|
import { useGlobalStore } from 'src/shared/store';
|
|
3
3
|
import { api } from '../api';
|
|
4
4
|
import { client } from 'src/shared/api/client';
|
|
5
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
6
5
|
import { useRegistratorStore } from 'src/entities/Registrator';
|
|
7
6
|
import type { ITokens } from 'src/shared/lib/types/user';
|
|
8
7
|
import { useInitWalletProcess } from 'src/processes/init-wallet';
|
|
@@ -10,7 +9,7 @@ import type { Zeus } from '@coopenomics/sdk';
|
|
|
10
9
|
|
|
11
10
|
export function useLoginUser() {
|
|
12
11
|
const globalStore = useGlobalStore();
|
|
13
|
-
const
|
|
12
|
+
const session = useSessionStore();
|
|
14
13
|
|
|
15
14
|
async function login(email: string, wif: string): Promise<void> {
|
|
16
15
|
const auth = await api.loginUser(email, wif);
|
|
@@ -30,17 +29,15 @@ export function useLoginUser() {
|
|
|
30
29
|
await globalStore.setWif(account.username, wif);
|
|
31
30
|
await globalStore.setTokens(adaptedTokens);
|
|
32
31
|
|
|
33
|
-
const session = useSessionStore();
|
|
34
32
|
await session.init();
|
|
35
33
|
client.setToken(auth.tokens.access.token);
|
|
36
34
|
|
|
37
35
|
const { run } = useInitWalletProcess();
|
|
38
36
|
await run(); //запускаем фоновое обновление кошелька - заменить на подписку потом
|
|
39
|
-
if (!
|
|
37
|
+
if (!session.isRegistrationComplete) {
|
|
40
38
|
const { state, steps } = useRegistratorStore();
|
|
41
|
-
state.userData.type =
|
|
42
|
-
|
|
43
|
-
const privateData = currentUser.privateAccount.value;
|
|
39
|
+
state.userData.type = session?.privateAccount?.type as Zeus.AccountType;
|
|
40
|
+
const privateData = session?.privateAccount;
|
|
44
41
|
|
|
45
42
|
// Для каждого типа пользователя берём нужное поле и, если оно существует, переносим совпадающие ключи
|
|
46
43
|
const dataMap = {
|
|
@@ -59,15 +56,15 @@ export function useLoginUser() {
|
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
//continue registration process here
|
|
62
|
-
state.account.username =
|
|
59
|
+
state.account.username = session.username as string;
|
|
63
60
|
state.account.private_key = wif;
|
|
64
|
-
state.account.public_key =
|
|
61
|
+
state.account.public_key = session.providerAccount
|
|
65
62
|
?.public_key as string;
|
|
66
63
|
|
|
67
|
-
state.email =
|
|
64
|
+
state.email = session.providerAccount?.email as string;
|
|
68
65
|
|
|
69
66
|
// Статус берем из userAccount, не providerAccount
|
|
70
|
-
const userStatus =
|
|
67
|
+
const userStatus = session.userAccount?.status;
|
|
71
68
|
if (userStatus === 'created') state.step = steps.ReadStatement;
|
|
72
69
|
else if (userStatus === 'joined') state.step = steps.PayInitial;
|
|
73
70
|
else if (userStatus === 'payed') state.step = steps.WaitingRegistration;
|
|
@@ -34,7 +34,6 @@ form.full-width(@submit.prevent='submit')
|
|
|
34
34
|
)
|
|
35
35
|
</template>
|
|
36
36
|
<script lang="ts" setup>
|
|
37
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
38
37
|
import { useSessionStore } from 'src/entities/Session';
|
|
39
38
|
import { useLoginUser } from 'src/features/User/LoginUser';
|
|
40
39
|
import { useNotificationPermissionDialog } from 'src/features/NotificationPermissionDialog';
|
|
@@ -49,7 +48,7 @@ const router = useRouter();
|
|
|
49
48
|
const email = ref('');
|
|
50
49
|
const privateKey = ref('');
|
|
51
50
|
const loading = ref(false);
|
|
52
|
-
const
|
|
51
|
+
const session = useSessionStore();
|
|
53
52
|
|
|
54
53
|
// Диалог разрешения уведомлений
|
|
55
54
|
const { showDialog } = useNotificationPermissionDialog();
|
|
@@ -104,13 +103,11 @@ const submit = async () => {
|
|
|
104
103
|
const { login } = useLoginUser();
|
|
105
104
|
await login(email.value, privateKey.value);
|
|
106
105
|
|
|
107
|
-
if (!
|
|
106
|
+
if (!session.isRegistrationComplete) {
|
|
108
107
|
// Если регистрация не завершена, выключаем лоадер и идем на signup
|
|
109
108
|
desktops.setWorkspaceChanging(false);
|
|
110
109
|
router.push({ name: 'signup' });
|
|
111
110
|
} else {
|
|
112
|
-
const session = useSessionStore();
|
|
113
|
-
|
|
114
111
|
// Дожидаемся завершения загрузки данных пользователя (включая роль)
|
|
115
112
|
let attempts = 0;
|
|
116
113
|
const maxAttempts = 50; // 5 секунд максимум
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useSessionStore } from 'src/entities/Session';
|
|
2
2
|
import { useGlobalStore } from 'src/shared/store';
|
|
3
3
|
// import { api } from '../api'
|
|
4
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
5
4
|
import { useRegistratorStore } from 'src/entities/Registrator';
|
|
6
5
|
|
|
7
6
|
export function useLogoutUser() {
|
|
@@ -12,8 +11,9 @@ export function useLogoutUser() {
|
|
|
12
11
|
|
|
13
12
|
await global.logout();
|
|
14
13
|
|
|
15
|
-
useSessionStore()
|
|
16
|
-
|
|
14
|
+
const session = useSessionStore();
|
|
15
|
+
session.close();
|
|
16
|
+
session.clearAccount();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return {
|
|
@@ -11,15 +11,13 @@ import { computed } from 'vue';
|
|
|
11
11
|
import { useRouter } from 'vue-router';
|
|
12
12
|
import { useLogoutUser } from '../../model';
|
|
13
13
|
import { FailAlert } from 'src/shared/api';
|
|
14
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
15
14
|
import { useSessionStore } from 'src/entities/Session';
|
|
16
15
|
|
|
17
16
|
const router = useRouter();
|
|
18
17
|
const session = useSessionStore();
|
|
19
|
-
const currentUser = useCurrentUser();
|
|
20
18
|
|
|
21
19
|
const loggedIn = computed(
|
|
22
|
-
() =>
|
|
20
|
+
() => session.isRegistrationComplete && session.isAuth,
|
|
23
21
|
);
|
|
24
22
|
|
|
25
23
|
const logout = async () => {
|
|
@@ -3,7 +3,7 @@ q-card(flat)
|
|
|
3
3
|
QuestionsTable(
|
|
4
4
|
:decisions='decisions',
|
|
5
5
|
:loading='loading',
|
|
6
|
-
:isChairman='
|
|
6
|
+
:isChairman='session.isChairman',
|
|
7
7
|
:format-decision-title='formatDecisionTitle',
|
|
8
8
|
:is-voted-for='isVotedFor',
|
|
9
9
|
:is-voted-against='isVotedAgainst',
|
|
@@ -18,7 +18,7 @@ q-card(flat)
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
19
|
import { onBeforeUnmount, computed, ref, onMounted } from 'vue';
|
|
20
20
|
import { useRoute } from 'vue-router';
|
|
21
|
-
import {
|
|
21
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
22
22
|
import { CreateProjectButton } from 'src/features/Decision/CreateProject';
|
|
23
23
|
import { useDecisionProcessor } from 'src/processes/process-decisions';
|
|
24
24
|
import { FailAlert, SuccessAlert } from 'src/shared/api';
|
|
@@ -26,7 +26,8 @@ import { QuestionsTable } from 'src/widgets/Questions';
|
|
|
26
26
|
import { useHeaderActions } from 'src/shared/hooks';
|
|
27
27
|
|
|
28
28
|
const route = useRoute();
|
|
29
|
-
const
|
|
29
|
+
const session = useSessionStore();
|
|
30
|
+
|
|
30
31
|
const processingDecisions = ref<Record<number, boolean>>({});
|
|
31
32
|
|
|
32
33
|
// Инжектим кнопку создания решения в заголовок
|
|
@@ -14,7 +14,7 @@ import { useRoute } from 'vue-router';
|
|
|
14
14
|
import { MeetCardsList } from 'src/widgets/Meets/MeetCardsList';
|
|
15
15
|
import { CreateMeetButton } from 'src/features/Meet/CreateMeet';
|
|
16
16
|
import { useMeetStore } from 'src/entities/Meet';
|
|
17
|
-
import {
|
|
17
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
18
18
|
import { useHeaderActions } from 'src/shared/hooks';
|
|
19
19
|
import { FailAlert } from 'src/shared/api';
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ const route = useRoute();
|
|
|
22
22
|
const coopname = computed(() => route.params.coopname as string);
|
|
23
23
|
const meetStore = useMeetStore();
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const session = useSessionStore();
|
|
26
26
|
|
|
27
27
|
// Данные напрямую из стора
|
|
28
28
|
const meets = computed(() => meetStore.meets);
|
|
@@ -45,7 +45,7 @@ const loadMeets = async () => {
|
|
|
45
45
|
|
|
46
46
|
// Проверка разрешений
|
|
47
47
|
const canCreateMeet = computed(() => {
|
|
48
|
-
return
|
|
48
|
+
return session.isMember || session.isChairman;
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
// Функция для регистрации кнопки
|
|
@@ -55,7 +55,7 @@ const registerCreateMeetButton = () => {
|
|
|
55
55
|
id: CREATE_MEET_BUTTON_ID,
|
|
56
56
|
component: CreateMeetButton,
|
|
57
57
|
props: {
|
|
58
|
-
isChairman:
|
|
58
|
+
isChairman: session.isChairman,
|
|
59
59
|
},
|
|
60
60
|
order: 1,
|
|
61
61
|
});
|
|
@@ -19,16 +19,14 @@
|
|
|
19
19
|
import { useRouter } from 'vue-router';
|
|
20
20
|
import { useDesktopStore } from 'src/entities/Desktop/model';
|
|
21
21
|
import { useSessionStore } from 'src/entities/Session';
|
|
22
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
23
22
|
|
|
24
23
|
const router = useRouter();
|
|
25
24
|
const desktops = useDesktopStore();
|
|
26
25
|
const session = useSessionStore();
|
|
27
|
-
const currentUser = useCurrentUser();
|
|
28
26
|
|
|
29
27
|
function goBack() {
|
|
30
28
|
// Если пользователь авторизован, пытаемся перейти на безопасную страницу
|
|
31
|
-
if (session.isAuth &&
|
|
29
|
+
if (session.isAuth && session.isRegistrationComplete) {
|
|
32
30
|
// Пытаемся перейти на participant workspace как самый безопасный вариант
|
|
33
31
|
const hasParticipantWorkspace = desktops.currentDesktop?.workspaces.some(
|
|
34
32
|
(ws) => ws.name === 'participant',
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
<script lang="ts" setup>
|
|
16
16
|
import { useSessionStore } from 'src/entities/Session';
|
|
17
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
18
17
|
import { SignIn } from 'src/widgets/Registrator/SignIn';
|
|
19
18
|
import { computed } from 'vue';
|
|
20
19
|
import { useRouter } from 'vue-router';
|
|
@@ -23,10 +22,12 @@ const store = useRegistratorStore().state;
|
|
|
23
22
|
|
|
24
23
|
const router = useRouter();
|
|
25
24
|
|
|
25
|
+
const session = useSessionStore();
|
|
26
|
+
|
|
26
27
|
const registeredAndloggedIn = computed(() => {
|
|
27
28
|
return (
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
session.isRegistrationComplete &&
|
|
30
|
+
session.isAuth &&
|
|
30
31
|
store.step == 1
|
|
31
32
|
);
|
|
32
33
|
});
|
|
@@ -43,8 +43,6 @@ import SelectBranch from './SelectBranch.vue';
|
|
|
43
43
|
import { useSystemStore } from 'src/entities/System/model';
|
|
44
44
|
const { info } = useSystemStore();
|
|
45
45
|
|
|
46
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
47
|
-
|
|
48
46
|
import { useRegistratorStore } from 'src/entities/Registrator';
|
|
49
47
|
import { useLogoutUser } from 'src/features/User/Logout';
|
|
50
48
|
import { useSessionStore } from 'src/entities/Session';
|
|
@@ -56,7 +54,6 @@ import { useInitWalletProcess } from 'src/processes/init-wallet';
|
|
|
56
54
|
import { useDesktopStore } from 'src/entities/Desktop';
|
|
57
55
|
import { Zeus } from '@coopenomics/sdk';
|
|
58
56
|
|
|
59
|
-
const currentUser = useCurrentUser();
|
|
60
57
|
const session = useSessionStore();
|
|
61
58
|
const router = useRouter();
|
|
62
59
|
const { state, clearUserData, steps } = useRegistratorStore();
|
|
@@ -69,8 +66,8 @@ const { showDialog } = useNotificationPermissionDialog();
|
|
|
69
66
|
|
|
70
67
|
onMounted(() => {
|
|
71
68
|
agreementer.loadCooperativeAgreements(info.coopname);
|
|
72
|
-
if (!
|
|
73
|
-
const userStatus =
|
|
69
|
+
if (!session.isRegistrationComplete) {
|
|
70
|
+
const userStatus = session.providerAccount?.status;
|
|
74
71
|
if (
|
|
75
72
|
userStatus === Zeus.UserStatus.Registered ||
|
|
76
73
|
userStatus === Zeus.UserStatus.Active ||
|
|
@@ -156,7 +153,7 @@ watch(
|
|
|
156
153
|
|
|
157
154
|
const registeredAndloggedIn = computed(() => {
|
|
158
155
|
return (
|
|
159
|
-
|
|
156
|
+
session.isRegistrationComplete &&
|
|
160
157
|
session.isAuth &&
|
|
161
158
|
store.step == steps.EmailInput
|
|
162
159
|
);
|
|
@@ -5,7 +5,7 @@ div
|
|
|
5
5
|
title='Получите решение совета о приёме Вас в пайщики кооператива',
|
|
6
6
|
:done='store.isStepDone("WaitingRegistration")'
|
|
7
7
|
)
|
|
8
|
-
template(v-if='
|
|
8
|
+
template(v-if='session?.userAccount?.status !== "failed"')
|
|
9
9
|
p Ваш платеж принят. Ожидаем, когда совет рассмотрит Ваше заявление и примет решение о приёме Вас в пайщики. Это может занять до 24 часов. Вы получите уведомление, когда решение будет принято.
|
|
10
10
|
span Эту страницу можно закрыть, а при необходимости, войти с другого устройства с помощью ключа доступа, который был сохранён ранее.
|
|
11
11
|
Loader
|
|
@@ -15,7 +15,7 @@ div
|
|
|
15
15
|
|
|
16
16
|
<script lang="ts" setup>
|
|
17
17
|
import { ref, computed, watch, onBeforeUnmount, onMounted } from 'vue';
|
|
18
|
-
import {
|
|
18
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
19
19
|
import { Loader } from 'src/shared/ui/Loader';
|
|
20
20
|
import { useRegistratorStore } from 'src/entities/Registrator';
|
|
21
21
|
|
|
@@ -33,9 +33,9 @@ watch(step, (newValue) => {
|
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const session = useSessionStore();
|
|
37
37
|
|
|
38
|
-
const participantAccount = computed(() =>
|
|
38
|
+
const participantAccount = computed(() => session.participantAccount);
|
|
39
39
|
|
|
40
40
|
onMounted(() => {
|
|
41
41
|
if (participantAccount.value && step.value === currentStep) store.next();
|
|
@@ -6,11 +6,11 @@ PaymentMethodsCard(:username='username')
|
|
|
6
6
|
import { PaymentMethodsCard } from 'src/widgets/User/PaymentMethods';
|
|
7
7
|
import { AddPaymentButton } from 'src/features/PaymentMethod/AddPaymentMethod';
|
|
8
8
|
import { computed, onMounted } from 'vue';
|
|
9
|
-
import {
|
|
9
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
10
10
|
import { useHeaderActions } from 'src/shared/hooks';
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
const username = computed(() =>
|
|
12
|
+
const session = useSessionStore();
|
|
13
|
+
const username = computed(() => session.username);
|
|
14
14
|
|
|
15
15
|
// Инжектим кнопку добавления реквизитов в заголовок
|
|
16
16
|
const { registerAction } = useHeaderActions();
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
.info-item
|
|
23
23
|
.info-label Имя аккаунта
|
|
24
24
|
.info-value.username-value
|
|
25
|
-
span.username-text {{
|
|
25
|
+
span.username-text {{ session.username || '' }}
|
|
26
26
|
q-btn.copy-btn(
|
|
27
27
|
icon='content_copy',
|
|
28
28
|
flat,
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
</template>
|
|
146
146
|
|
|
147
147
|
<script lang="ts" setup>
|
|
148
|
-
import {
|
|
148
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
149
149
|
import type {
|
|
150
150
|
IEntrepreneurData,
|
|
151
151
|
IIndividualData,
|
|
@@ -157,17 +157,17 @@ import { copyToClipboard } from 'quasar';
|
|
|
157
157
|
import { SuccessAlert, FailAlert } from 'src/shared/api';
|
|
158
158
|
import 'src/shared/ui/CardStyles/index.scss';
|
|
159
159
|
|
|
160
|
-
const
|
|
160
|
+
const session = useSessionStore();
|
|
161
161
|
|
|
162
162
|
const userType = computed(() => {
|
|
163
|
-
return
|
|
163
|
+
return session.privateAccount?.type;
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
const userProfile = computed(() => {
|
|
167
167
|
return (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
session.privateAccount?.individual_data ||
|
|
169
|
+
session.privateAccount?.organization_data ||
|
|
170
|
+
session.privateAccount?.entrepreneur_data ||
|
|
171
171
|
null
|
|
172
172
|
);
|
|
173
173
|
});
|
|
@@ -205,8 +205,8 @@ const currentProfile = computed(() => {
|
|
|
205
205
|
const { displayName, isIP } = useDisplayName(currentProfile.value);
|
|
206
206
|
|
|
207
207
|
const role = computed(() => {
|
|
208
|
-
if (
|
|
209
|
-
else if (
|
|
208
|
+
if (session.isChairman) return 'Председатель совета';
|
|
209
|
+
else if (session.isMember) return 'Член совета';
|
|
210
210
|
else return 'Пайщик';
|
|
211
211
|
});
|
|
212
212
|
|
|
@@ -241,7 +241,7 @@ const getUserTypeLabel = () => {
|
|
|
241
241
|
|
|
242
242
|
// Копирование имени аккаунта
|
|
243
243
|
const copyUsername = async () => {
|
|
244
|
-
const username =
|
|
244
|
+
const username = session.username || '';
|
|
245
245
|
try {
|
|
246
246
|
await copyToClipboard(username);
|
|
247
247
|
SuccessAlert('Имя аккаунта скопировано в буфер обмена');
|
|
@@ -11,10 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
<script lang="ts" setup>
|
|
13
13
|
import { WalletWidget, WalletProgramWidget } from 'src/widgets/Wallet';
|
|
14
|
-
// import { useCurrentUser } from 'src/entities/Session';
|
|
15
14
|
import 'src/shared/ui/CardStyles';
|
|
16
15
|
|
|
17
|
-
// const currentUser = useCurrentUser();
|
|
18
16
|
</script>
|
|
19
17
|
|
|
20
18
|
<style lang="scss" scoped>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Router } from 'vue-router';
|
|
2
2
|
import { useSessionStore } from 'src/entities/Session';
|
|
3
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
4
3
|
import { useDesktopStore } from 'src/entities/Desktop/model';
|
|
5
4
|
import { useSystemStore } from 'src/entities/System/model';
|
|
6
5
|
import { LocalStorage } from 'quasar';
|
|
@@ -25,7 +24,6 @@ export function setupNavigationGuard(router: Router) {
|
|
|
25
24
|
const systemStore = useSystemStore();
|
|
26
25
|
|
|
27
26
|
router.beforeEach(async (to, from, next) => {
|
|
28
|
-
const currentUser = useCurrentUser();
|
|
29
27
|
// если требуется установка
|
|
30
28
|
const allowedRoutesDuringInstall = ['install', 'invite'];
|
|
31
29
|
if ((systemStore.info.system_status === Zeus.SystemStatus.install || systemStore.info.system_status === Zeus.SystemStatus.initialized) && !allowedRoutesDuringInstall.includes(to.name as string)) {
|
|
@@ -54,9 +52,9 @@ export function setupNavigationGuard(router: Router) {
|
|
|
54
52
|
// Определяем роль пользователя при каждом запросе
|
|
55
53
|
let userRole: string | null = null;
|
|
56
54
|
if (session.isAuth) {
|
|
57
|
-
if (
|
|
55
|
+
if (session.isChairman) {
|
|
58
56
|
userRole = 'chairman';
|
|
59
|
-
} else if (
|
|
57
|
+
} else if (session.isMember) {
|
|
60
58
|
userRole = 'member';
|
|
61
59
|
} else {
|
|
62
60
|
userRole = 'user'; // Авторизованный пользователь без специальной роли
|
|
@@ -66,7 +64,7 @@ export function setupNavigationGuard(router: Router) {
|
|
|
66
64
|
// редирект с index
|
|
67
65
|
if (to.name === 'index') {
|
|
68
66
|
// Убеждаемся, что правильный рабочий стол выбран
|
|
69
|
-
if (session.isAuth &&
|
|
67
|
+
if (session.isAuth && session.isRegistrationComplete) {
|
|
70
68
|
// Если рабочий стол не выбран - выбираем по правам пользователя
|
|
71
69
|
if (!desktops.activeWorkspaceName) {
|
|
72
70
|
desktops.selectDefaultWorkspace();
|
|
@@ -22,7 +22,7 @@ div
|
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<script lang="ts" setup>
|
|
25
|
-
import {
|
|
25
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
26
26
|
import { computed } from 'vue';
|
|
27
27
|
import { useRouter } from 'vue-router';
|
|
28
28
|
import { useDesktopStore } from 'src/entities/Desktop/model';
|
|
@@ -32,7 +32,7 @@ import { Zeus } from '@coopenomics/sdk';
|
|
|
32
32
|
|
|
33
33
|
const desktop = useDesktopStore();
|
|
34
34
|
const router = useRouter();
|
|
35
|
-
const
|
|
35
|
+
const session = useSessionStore();
|
|
36
36
|
const { info } = useSystemStore();
|
|
37
37
|
|
|
38
38
|
// Функция для проверки условия
|
|
@@ -51,22 +51,22 @@ const evaluateCondition = (
|
|
|
51
51
|
|
|
52
52
|
// Вычисляем роль пользователя
|
|
53
53
|
const userRole = computed(() =>
|
|
54
|
-
|
|
54
|
+
session.isChairman ? 'chairman' : session.isMember ? 'member' : 'user'
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
// Контекст для evaluateCondition и проверки ролей
|
|
58
58
|
const context = computed(() => {
|
|
59
59
|
const isCoop =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
'type' in
|
|
63
|
-
|
|
60
|
+
session.currentUserAccount?.private_account?.type === Zeus.AccountType.organization &&
|
|
61
|
+
session.currentUserAccount?.private_account?.organization_data &&
|
|
62
|
+
'type' in session.currentUserAccount?.private_account?.organization_data &&
|
|
63
|
+
session.currentUserAccount?.private_account?.organization_data.type.toUpperCase() ===
|
|
64
64
|
Zeus.OrganizationType.COOP;
|
|
65
65
|
|
|
66
66
|
return {
|
|
67
67
|
isCoop,
|
|
68
68
|
userRole: userRole.value,
|
|
69
|
-
userAccount:
|
|
69
|
+
userAccount: session.currentUserAccount?.private_account,
|
|
70
70
|
coopname: info.coopname,
|
|
71
71
|
};
|
|
72
72
|
});
|
|
@@ -79,7 +79,7 @@ div
|
|
|
79
79
|
<script setup lang="ts">
|
|
80
80
|
import { ref, computed, onMounted, watch } from 'vue';
|
|
81
81
|
import { useRouter } from 'vue-router';
|
|
82
|
-
import {
|
|
82
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
83
83
|
import { useDesktopStore } from 'src/entities/Desktop/model';
|
|
84
84
|
import { ModalBase } from 'src/shared/ui/ModalBase';
|
|
85
85
|
|
|
@@ -100,7 +100,7 @@ interface GroupedApp {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
const router = useRouter();
|
|
103
|
-
const
|
|
103
|
+
const session = useSessionStore();
|
|
104
104
|
const desktop = useDesktopStore();
|
|
105
105
|
|
|
106
106
|
// Состояние карусели и диалога
|
|
@@ -150,7 +150,7 @@ const workspaceMenus = computed(() => desktop.workspaceMenus);
|
|
|
150
150
|
|
|
151
151
|
// Вычисляем роль пользователя
|
|
152
152
|
const userRole = computed(() =>
|
|
153
|
-
|
|
153
|
+
session.isChairman ? 'chairman' : session.isMember ? 'member' : 'user'
|
|
154
154
|
);
|
|
155
155
|
|
|
156
156
|
// Фильтрация по ролям
|
|
@@ -87,7 +87,6 @@ q-header.header(bordered, :class='headerClass')
|
|
|
87
87
|
import { computed, ref, nextTick, onMounted, onUpdated, watch } from 'vue';
|
|
88
88
|
import { useRouter, useRoute } from 'vue-router';
|
|
89
89
|
import { useQuasar } from 'quasar';
|
|
90
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
91
90
|
import { useSessionStore } from 'src/entities/Session';
|
|
92
91
|
import config from 'src/app/config';
|
|
93
92
|
import { useWindowSize, useHeaderActionsReader } from 'src/shared/hooks';
|
|
@@ -127,9 +126,9 @@ const isDark = computed(() => $q.dark.isActive);
|
|
|
127
126
|
const headerClass = computed(() =>
|
|
128
127
|
isDark.value ? 'text-white bg-dark' : 'text-black bg-light',
|
|
129
128
|
);
|
|
130
|
-
|
|
129
|
+
|
|
131
130
|
const loggedIn = computed(() => {
|
|
132
|
-
return
|
|
131
|
+
return session.isRegistrationComplete && session.isAuth;
|
|
133
132
|
});
|
|
134
133
|
|
|
135
134
|
const showRegisterButton = computed(() => {
|
|
@@ -36,15 +36,13 @@ q-btn-dropdown(
|
|
|
36
36
|
<script lang="ts" setup>
|
|
37
37
|
import { useRouter } from 'vue-router';
|
|
38
38
|
import { ToogleDarkLight } from '../../../shared/ui/ToogleDarkLight';
|
|
39
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
40
39
|
import { computed } from 'vue';
|
|
41
40
|
import { useSessionStore } from 'src/entities/Session';
|
|
42
41
|
|
|
43
42
|
const session = useSessionStore();
|
|
44
43
|
|
|
45
|
-
const currentUser = useCurrentUser();
|
|
46
44
|
const loggedIn = computed(
|
|
47
|
-
() =>
|
|
45
|
+
() => session.isRegistrationComplete && session.isAuth,
|
|
48
46
|
);
|
|
49
47
|
|
|
50
48
|
defineProps({
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
|
-
import {
|
|
6
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
7
7
|
import { useQuasar } from 'quasar';
|
|
8
8
|
import { env } from 'src/shared/config';
|
|
9
9
|
import { NotifyAlert } from 'src/shared/api';
|
|
10
10
|
import { computed, onMounted, onBeforeUnmount, watch, ref } from 'vue';
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const session = useSessionStore();
|
|
13
13
|
const $q = useQuasar();
|
|
14
14
|
const isDark = computed(() => $q.dark.isActive);
|
|
15
15
|
|
|
16
16
|
// Определяем роль пользователя
|
|
17
17
|
const userRole = computed((): string => {
|
|
18
|
-
if (
|
|
18
|
+
if (session.isChairman) {
|
|
19
19
|
return 'chairman';
|
|
20
20
|
}
|
|
21
|
-
if (
|
|
21
|
+
if (session.isMember) {
|
|
22
22
|
return 'member';
|
|
23
23
|
}
|
|
24
24
|
return 'user';
|
|
@@ -66,7 +66,7 @@ async function mountNovu() {
|
|
|
66
66
|
const { dark } = await import('@novu/js/themes');
|
|
67
67
|
|
|
68
68
|
// Получаем данные подписчика из providerAccount
|
|
69
|
-
const providerAccount =
|
|
69
|
+
const providerAccount = session.providerAccount;
|
|
70
70
|
|
|
71
71
|
if (!providerAccount?.subscriber_id || !providerAccount?.subscriber_hash) {
|
|
72
72
|
console.error(
|
|
@@ -69,7 +69,7 @@ import { ComplexDocument } from 'src/shared/ui/ComplexDocument';
|
|
|
69
69
|
import { formatToFromNow } from 'src/shared/lib/utils/dates/formatToFromNow';
|
|
70
70
|
import { getShortNameFromCertificate } from 'src/shared/lib/utils/getNameFromCertificate';
|
|
71
71
|
import { VotingButtons } from '../VotingButtons';
|
|
72
|
-
import {
|
|
72
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
73
73
|
import type { IAgenda } from 'src/entities/Agenda/model';
|
|
74
74
|
import { Cooperative } from 'cooptypes';
|
|
75
75
|
import 'src/shared/ui/CardStyles/index.scss';
|
|
@@ -105,8 +105,8 @@ const props = defineProps({
|
|
|
105
105
|
|
|
106
106
|
defineEmits(['toggle-expand', 'authorize', 'vote-for', 'vote-against']);
|
|
107
107
|
|
|
108
|
-
const
|
|
109
|
-
const isChairman = computed(() =>
|
|
108
|
+
const session = useSessionStore();
|
|
109
|
+
const isChairman = computed(() => session.isChairman);
|
|
110
110
|
|
|
111
111
|
// Получение заголовка документа с поддержкой агрегатов
|
|
112
112
|
function getDocumentTitle() {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
.col-12.col-md-3.flex.justify-center
|
|
8
8
|
AutoAvatar(
|
|
9
9
|
style='width: 60px; border-radius: 50%',
|
|
10
|
-
:username='
|
|
10
|
+
:username='session.username'
|
|
11
11
|
)
|
|
12
12
|
.col-12.col-md-9.q-mt-sm.q-mt-md-0
|
|
13
13
|
q-badge(
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
q-item
|
|
28
28
|
q-item-section
|
|
29
29
|
q-item-label(caption) Имя аккаунта
|
|
30
|
-
q-item-label.text-bold(style='font-size: 20px') {{
|
|
30
|
+
q-item-label.text-bold(style='font-size: 20px') {{ session.username }}
|
|
31
31
|
|
|
32
32
|
//- q-item
|
|
33
33
|
//- q-item-section
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
q-item
|
|
38
38
|
q-item-section
|
|
39
39
|
q-item-label(caption) Минимальный паевый счёт
|
|
40
|
-
q-item-label.text-bold(style='font-size: 20px') {{
|
|
40
|
+
q-item-label.text-bold(style='font-size: 20px') {{ session.participantAccount?.minimum_amount }}
|
|
41
41
|
|
|
42
42
|
//- q-item
|
|
43
43
|
//- q-item-section
|
|
@@ -61,41 +61,41 @@ import { DepositButton } from 'src/features/Wallet/DepositToWallet';
|
|
|
61
61
|
import { WithdrawButton } from 'src/features/Wallet/WithdrawFromWallet';
|
|
62
62
|
import { AutoAvatar } from 'src/shared/ui/AutoAvatar';
|
|
63
63
|
import { useWalletStore } from 'src/entities/Wallet';
|
|
64
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
64
65
|
const walletStore = useWalletStore();
|
|
66
|
+
const session = useSessionStore();
|
|
65
67
|
|
|
66
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
67
68
|
import { computed } from 'vue';
|
|
68
|
-
const currentUser = useCurrentUser();
|
|
69
69
|
|
|
70
|
-
const userType = computed(() =>
|
|
70
|
+
const userType = computed(() => session.privateAccount?.type);
|
|
71
71
|
|
|
72
72
|
const isIP = computed(
|
|
73
|
-
() =>
|
|
73
|
+
() => session.privateAccount?.type === 'entrepreneur',
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
const role = computed(() => {
|
|
77
|
-
if (
|
|
78
|
-
else if (
|
|
77
|
+
if (session.isChairman) return 'Председатель совета';
|
|
78
|
+
else if (session.isMember) return 'Член совета';
|
|
79
79
|
else return 'Пайщик';
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
const individualProfile = computed(() => {
|
|
83
83
|
if (userType.value === 'individual') {
|
|
84
|
-
return
|
|
84
|
+
return session.privateAccount?.individual_data;
|
|
85
85
|
}
|
|
86
86
|
return null;
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
const entrepreneurProfile = computed(() => {
|
|
90
90
|
if (userType.value === 'entrepreneur') {
|
|
91
|
-
return
|
|
91
|
+
return session.privateAccount?.entrepreneur_data;
|
|
92
92
|
}
|
|
93
93
|
return null;
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
const organizationProfile = computed(() => {
|
|
97
97
|
if (userType.value === 'organization') {
|
|
98
|
-
return
|
|
98
|
+
return session.privateAccount?.organization_data;
|
|
99
99
|
}
|
|
100
100
|
return null;
|
|
101
101
|
});
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<script lang="ts" setup>
|
|
27
27
|
import { computed } from 'vue';
|
|
28
28
|
import { useRouter } from 'vue-router';
|
|
29
|
-
import {
|
|
29
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
30
30
|
import { useWalletStore } from 'src/entities/Wallet';
|
|
31
31
|
import { useSystemStore } from 'src/entities/System/model';
|
|
32
32
|
import { ColorCard } from 'src/shared/ui';
|
|
@@ -35,7 +35,7 @@ import { DepositButton } from 'src/features/Wallet/DepositToWallet';
|
|
|
35
35
|
import { WithdrawButton } from 'src/features/Wallet/WithdrawFromWallet';
|
|
36
36
|
|
|
37
37
|
const router = useRouter();
|
|
38
|
-
const
|
|
38
|
+
const session = useSessionStore();
|
|
39
39
|
const walletStore = useWalletStore();
|
|
40
40
|
const { info } = useSystemStore();
|
|
41
41
|
|
|
@@ -48,9 +48,9 @@ const formattedBalance = computed(() => {
|
|
|
48
48
|
// Профиль
|
|
49
49
|
const currentProfile = computed(() => {
|
|
50
50
|
return (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
session.privateAccount?.individual_data ||
|
|
52
|
+
session.privateAccount?.entrepreneur_data ||
|
|
53
|
+
session.privateAccount?.organization_data ||
|
|
54
54
|
null
|
|
55
55
|
);
|
|
56
56
|
});
|
|
@@ -81,8 +81,8 @@ const isIP = computed(() => {
|
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
const role = computed(() => {
|
|
84
|
-
if (
|
|
85
|
-
else if (
|
|
84
|
+
if (session.isChairman) return 'Председатель';
|
|
85
|
+
else if (session.isMember) return 'Член совета';
|
|
86
86
|
else return 'Пайщик';
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -27,7 +27,7 @@ q-card.main-wallet-card(flat)
|
|
|
27
27
|
|
|
28
28
|
ColorCard(
|
|
29
29
|
color='orange'
|
|
30
|
-
v-if='
|
|
30
|
+
v-if='session.participantAccount?.minimum_amount'
|
|
31
31
|
).minimum-balance.q-mt-md
|
|
32
32
|
.minimum-balance-info
|
|
33
33
|
.info-icon
|
|
@@ -42,19 +42,19 @@ import { computed } from 'vue';
|
|
|
42
42
|
import { DepositButton } from 'src/features/Wallet/DepositToWallet';
|
|
43
43
|
import { WithdrawButton } from 'src/features/Wallet/WithdrawFromWallet';
|
|
44
44
|
import { useWalletStore } from 'src/entities/Wallet';
|
|
45
|
-
import {
|
|
45
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
46
46
|
import { useSystemStore } from 'src/entities/System/model';
|
|
47
47
|
import { ColorCard } from 'src/shared/ui';
|
|
48
48
|
import { formatAsset2Digits } from 'src/shared/lib/utils/formatAsset2Digits';
|
|
49
49
|
|
|
50
50
|
const walletStore = useWalletStore();
|
|
51
|
-
const
|
|
51
|
+
const session = useSessionStore();
|
|
52
52
|
const { info } = useSystemStore();
|
|
53
53
|
|
|
54
54
|
// Сумма заблокированных средств и минимального неснижаемого остатка
|
|
55
55
|
const totalBlocked = computed(() => {
|
|
56
56
|
const blocked = parseFloat(walletStore.program_wallets[0]?.blocked || '0');
|
|
57
|
-
const minimum = parseFloat(
|
|
57
|
+
const minimum = parseFloat(session.participantAccount?.minimum_amount || '0');
|
|
58
58
|
const total = (blocked + minimum).toString();
|
|
59
59
|
return formatAsset2Digits(`${total} ${info.symbols.root_govern_symbol}`);
|
|
60
60
|
});
|
|
@@ -67,7 +67,7 @@ const availableBalance = computed(() => {
|
|
|
67
67
|
|
|
68
68
|
// Минимальный остаток с форматированием
|
|
69
69
|
const minimumBalance = computed(() => {
|
|
70
|
-
const minimum =
|
|
70
|
+
const minimum = session.participantAccount?.minimum_amount || '0';
|
|
71
71
|
return formatAsset2Digits(`${minimum} ${info.symbols.root_govern_symbol}`);
|
|
72
72
|
});
|
|
73
73
|
</script>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import { useSessionStore } from '../model/store';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Композабл для работы с данными текущего пользователя
|
|
6
|
-
* Заменяет устаревший useCurrentUserStore
|
|
7
|
-
*/
|
|
8
|
-
export function useCurrentUser() {
|
|
9
|
-
const session = useSessionStore();
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
// Основные данные
|
|
13
|
-
username: session.username,
|
|
14
|
-
currentUserAccount: session.currentUserAccount,
|
|
15
|
-
|
|
16
|
-
// Удобные геттеры для различных типов данных
|
|
17
|
-
userAccount: computed(() => session.currentUserAccount?.user_account),
|
|
18
|
-
privateAccount: computed(() => session.currentUserAccount?.private_account),
|
|
19
|
-
blockchainAccount: computed(
|
|
20
|
-
() => session.currentUserAccount?.blockchain_account,
|
|
21
|
-
),
|
|
22
|
-
participantAccount: computed(
|
|
23
|
-
() => session.currentUserAccount?.participant_account,
|
|
24
|
-
),
|
|
25
|
-
providerAccount: computed(
|
|
26
|
-
() => session.currentUserAccount?.provider_account,
|
|
27
|
-
),
|
|
28
|
-
|
|
29
|
-
// Computed свойства для проверки статуса
|
|
30
|
-
isRegistrationComplete: computed(() => session.isRegistrationComplete),
|
|
31
|
-
isChairman: computed(() => session.isChairman),
|
|
32
|
-
isMember: computed(() => session.isMember),
|
|
33
|
-
isAuth: computed(() => session.isAuth),
|
|
34
|
-
|
|
35
|
-
// Методы
|
|
36
|
-
setCurrentUserAccount: session.setCurrentUserAccount,
|
|
37
|
-
clearAccount: () => session.setCurrentUserAccount(undefined),
|
|
38
|
-
};
|
|
39
|
-
}
|