@coopenomics/desktop 2.2.8 → 2.2.10
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/CHANGELOG.md +19 -0
- package/Env-testnet.ts +12 -0
- package/package.json +5 -5
- package/src/boot/init-stores.ts +8 -2
- package/src/desktops/User/model/index.ts +11 -10
- package/src/entities/Account/api/index.ts +11 -2
- package/src/entities/Account/model/store.ts +15 -5
- package/src/entities/Account/types/index.ts +9 -1
- package/src/entities/Session/model/store.ts +2 -3
- package/src/features/Account/UpdateAccount/api/index.ts +14 -0
- package/src/features/Account/UpdateAccount/index.ts +1 -0
- package/src/features/Account/UpdateAccount/model/index.ts +16 -0
- package/src/features/Branch/SelectBranch/ui/SelectBranchOverlay.vue +3 -2
- package/src/features/PaymentMethod/UpdateBankAccount/api/index.ts +1 -0
- package/src/features/PaymentMethod/UpdateBankAccount/model/index.ts +11 -4
- package/src/features/Request/CreateChildOrder/ui/CreateChildOrderButton/CreateChildOrderButton.vue +1 -1
- package/src/features/User/AddUser/ui/AddUserDialog/AddUserDialog.vue +3 -0
- package/src/features/User/Logout/model/index.ts +3 -3
- package/src/pages/Cooperative/ListOfBranches/ui/ListOfBranchesPage.vue +2 -4
- package/src/pages/Marketplace/OfferPage/ui/OfferPage.vue +2 -2
- package/src/shared/lib/composables/useEditableData.ts +1 -1
- package/src/shared/lib/consts/workspaces/index.ts +1 -0
- package/src/shared/ui/EditableEntrepreneurCard/EditableEntrepreneurCard.vue +170 -0
- package/src/shared/ui/EditableEntrepreneurCard/index.ts +1 -0
- package/src/shared/ui/EditableIndividualCard/EditableIndividualCard.vue +203 -0
- package/src/shared/ui/EditableIndividualCard/index.ts +1 -0
- package/src/shared/ui/EditableOrganizationCard/EditableOrganizationCard.vue +215 -0
- package/src/shared/ui/EditableOrganizationCard/index.ts +1 -0
- package/src/shared/ui/UserDataForm/OrganizationDataForm/OrganizationDataForm.vue +1 -0
- package/src/widgets/Cooperative/Participants/ListOfParticipants/ui/ListOfParticipantsWidget.vue +154 -71
- package/src/widgets/IndividualCard/ui/IndividualCard.vue +23 -23
- package/src/widgets/Request/RequestCard/RequestCard.vue +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,25 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.2.10](https://github.com/coopenomics/mono/compare/v2.2.9...v2.2.10) (2025-03-27)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* add Zeus type ([7bcb6e3](https://github.com/coopenomics/mono/commit/7bcb6e30a77b0ab89c5293188b58f08f19c8761e))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
## [2.2.9](https://github.com/coopenomics/mono/compare/v2.2.8...v2.2.9) (2025-03-12)
|
18
|
+
|
19
|
+
**Note:** Version bump only for package @coopenomics/desktop
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
6
25
|
## [2.2.8](https://github.com/coopenomics/monocoop/compare/v2.2.7...v2.2.8) (2025-02-10)
|
7
26
|
|
8
27
|
**Note:** Version bump only for package @coopenomics/desktop
|
package/Env-testnet.ts
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
export const BASE_URL = 'testnet.coopenomics.world';
|
2
|
+
export const NODE_ENV = 'development';
|
3
|
+
export const APP_NAME = 'COOPENOMICS';
|
4
|
+
export const BACKEND_URL = 'https://testnet.coopenomics.world/backend';
|
5
|
+
export const COOPNAME = 'voskhod';
|
6
|
+
export const CURRENCY = 'RUB';
|
7
|
+
export const STORAGE_URL = 'https://testnet.coopenomics.world/uploaded/';
|
8
|
+
export const UPLOAD_URL = 'https://testnet.coopenomics.world/upload';
|
9
|
+
export const CHAIN_URL = 'https://testnet.coopenomics.world/api';
|
10
|
+
export const COOP_SHORT_NAME = 'Цифровой Кооператив';
|
11
|
+
export const CHAIN_ID = 'f0364a3f9fd913081f1c0b05c6f8f50a59b2ba60bb928cb321ba3a9a36316624';
|
12
|
+
export const SENTRY_DSN ='https://b8151ac0239b44339e0e8c65c9aa59c4@o245142.ingest.sentry.io/5739100';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coopenomics/desktop",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.10",
|
4
4
|
"description": "A Desktop Project",
|
5
5
|
"productName": "Desktop App",
|
6
6
|
"author": "Alex Ant <dacom.dark.sun@gmail.com>",
|
@@ -20,8 +20,8 @@
|
|
20
20
|
"prepublishOnly": "npm run build:lib"
|
21
21
|
},
|
22
22
|
"dependencies": {
|
23
|
-
"@coopenomics/controller": "2.2.
|
24
|
-
"@coopenomics/sdk": "2.2.
|
23
|
+
"@coopenomics/controller": "2.2.10",
|
24
|
+
"@coopenomics/sdk": "2.2.10",
|
25
25
|
"@dicebear/collection": "^9.0.1",
|
26
26
|
"@dicebear/core": "^9.0.1",
|
27
27
|
"@fortawesome/fontawesome-svg-core": "^6.5.2",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"@wharfkit/wallet-plugin-privatekey": "^1.1.0",
|
46
46
|
"axios": "^1.2.1",
|
47
47
|
"compression": "^1.7.4",
|
48
|
-
"cooptypes": "2.2.
|
48
|
+
"cooptypes": "2.2.10",
|
49
49
|
"dompurify": "^3.1.7",
|
50
50
|
"dotenv": "^16.4.5",
|
51
51
|
"email-regex": "^5.0.0",
|
@@ -94,5 +94,5 @@
|
|
94
94
|
"npm": ">= 6.13.4",
|
95
95
|
"yarn": ">= 1.21.1"
|
96
96
|
},
|
97
|
-
"gitHead": "
|
97
|
+
"gitHead": "e5e28ff652112fe3bacb8036a898a1344ad361fa"
|
98
98
|
}
|
package/src/boot/init-stores.ts
CHANGED
@@ -28,8 +28,14 @@ export default boot(async ({ router }) => {
|
|
28
28
|
await cardStore.initWallet();
|
29
29
|
|
30
30
|
// Загрузка аккаунта
|
31
|
-
if (session.isAuth && session.username)
|
32
|
-
|
31
|
+
if (session.isAuth && session.username){
|
32
|
+
try {
|
33
|
+
await account.getAccount(session.username)
|
34
|
+
} catch(e){
|
35
|
+
session.close()
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
33
39
|
|
34
40
|
// Добавление динамических маршрутов как дочерних к 'base'
|
35
41
|
const baseRoute = router.getRoutes().find(route => route.name === 'base');
|
@@ -160,16 +160,6 @@ export const manifest = {
|
|
160
160
|
|
161
161
|
},
|
162
162
|
|
163
|
-
{
|
164
|
-
path: '/:coopname/contacts',
|
165
|
-
name: 'contacts',
|
166
|
-
component: markRaw(ContactsPage),
|
167
|
-
meta: {
|
168
|
-
title: 'Контакты',
|
169
|
-
icon: 'fa-solid fa-info',
|
170
|
-
roles: [],
|
171
|
-
},
|
172
|
-
},
|
173
163
|
// {
|
174
164
|
// path: '/:coopname/marketplace',
|
175
165
|
// name: 'marketplace',
|
@@ -251,6 +241,17 @@ export const manifest = {
|
|
251
241
|
// },
|
252
242
|
// ],
|
253
243
|
// },
|
244
|
+
{
|
245
|
+
path: '/:coopname/contacts',
|
246
|
+
name: 'contacts',
|
247
|
+
component: markRaw(ContactsPage),
|
248
|
+
meta: {
|
249
|
+
title: 'Контакты',
|
250
|
+
icon: 'fa-solid fa-info',
|
251
|
+
roles: [],
|
252
|
+
},
|
253
|
+
},
|
254
|
+
|
254
255
|
// {
|
255
256
|
// meta: {
|
256
257
|
// title: 'Поддержка',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { client } from 'src/shared/api/client';
|
2
2
|
import { Queries } from '@coopenomics/sdk';
|
3
|
-
import type { IAccount } from '../types';
|
3
|
+
import type { IAccount, IAccounts, IGetAccounts } from '../types';
|
4
4
|
|
5
5
|
async function getAccount(username: string): Promise<IAccount | undefined> {
|
6
6
|
const { [Queries.Accounts.GetAccount.name]: output } = await client.Query(Queries.Accounts.GetAccount.query, {
|
@@ -12,6 +12,15 @@ async function getAccount(username: string): Promise<IAccount | undefined> {
|
|
12
12
|
return output;
|
13
13
|
}
|
14
14
|
|
15
|
+
async function getAccounts(variables?: IGetAccounts): Promise<IAccounts> {
|
16
|
+
const { [Queries.Accounts.GetAccounts.name]: output } = await client.Query(Queries.Accounts.GetAccounts.query, {
|
17
|
+
variables
|
18
|
+
});
|
19
|
+
|
20
|
+
return output;
|
21
|
+
}
|
22
|
+
|
15
23
|
export const api ={
|
16
|
-
getAccount
|
24
|
+
getAccount,
|
25
|
+
getAccounts
|
17
26
|
}
|
@@ -1,25 +1,35 @@
|
|
1
1
|
import { defineStore } from 'pinia'
|
2
2
|
import { ref, Ref } from 'vue'
|
3
3
|
import { api } from '../api'
|
4
|
-
import type { IAccount } from '../types';
|
4
|
+
import type { IAccount, IAccounts, IGetAccounts } from '../types';
|
5
5
|
|
6
6
|
const namespace = 'accountStore';
|
7
7
|
|
8
|
-
interface
|
8
|
+
interface IAccountStore {
|
9
9
|
account: Ref<IAccount | undefined>
|
10
|
+
accounts: Ref<IAccounts>
|
10
11
|
getAccount: (username: string) => Promise<IAccount | undefined>;
|
12
|
+
getAccounts: (data?: IGetAccounts) => Promise<IAccounts>;
|
11
13
|
}
|
12
14
|
|
13
|
-
export const useAccountStore = defineStore(namespace, ():
|
15
|
+
export const useAccountStore = defineStore(namespace, (): IAccountStore => {
|
14
16
|
const account = ref<IAccount>()
|
17
|
+
const accounts = ref<IAccounts>({items: [], totalCount: 0, totalPages: 0, currentPage: 1})
|
15
18
|
|
16
|
-
const getAccount = async (username: string) => {
|
19
|
+
const getAccount = async (username: string): Promise<IAccount | undefined> => {
|
17
20
|
account.value = await api.getAccount(username);
|
18
21
|
return account.value
|
19
22
|
};
|
23
|
+
|
24
|
+
const getAccounts = async(data?: IGetAccounts): Promise<IAccounts> => {
|
25
|
+
accounts.value = await api.getAccounts(data);
|
26
|
+
return accounts.value
|
27
|
+
}
|
20
28
|
|
21
29
|
return {
|
22
30
|
account,
|
23
|
-
|
31
|
+
accounts,
|
32
|
+
getAccount,
|
33
|
+
getAccounts
|
24
34
|
}
|
25
35
|
})
|
@@ -1,3 +1,11 @@
|
|
1
|
-
import { Queries } from '@coopenomics/sdk';
|
1
|
+
import { Queries, Zeus } from '@coopenomics/sdk';
|
2
2
|
|
3
3
|
export type IAccount = Queries.Accounts.GetAccount.IOutput[typeof Queries.Accounts.GetAccount.name]
|
4
|
+
export type IAccounts = Queries.Accounts.GetAccounts.IOutput[typeof Queries.Accounts.GetAccounts.name]
|
5
|
+
export type IGetAccounts = {data?: Queries.Accounts.GetAccounts.IInput['data'], options?: Queries.Accounts.GetAccounts.IInput['options']}
|
6
|
+
|
7
|
+
export const AccountTypes = Zeus.AccountType
|
8
|
+
|
9
|
+
export type IIndividualData = Zeus.ModelTypes['Individual']
|
10
|
+
export type IOrganizationData = Zeus.ModelTypes['Organization']
|
11
|
+
export type IEntrepreneurData = Zeus.ModelTypes['Entrepreneur']
|
@@ -57,8 +57,6 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
57
57
|
await globalStore.init();
|
58
58
|
isAuth.value = globalStore.hasCreditials;
|
59
59
|
|
60
|
-
//TODO добавить более детальную проверку авторизации
|
61
|
-
|
62
60
|
getInfo();
|
63
61
|
|
64
62
|
try {
|
@@ -80,7 +78,8 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
80
78
|
} catch (e: any) {
|
81
79
|
console.error(e);
|
82
80
|
FailAlert(e.message);
|
83
|
-
|
81
|
+
close()
|
82
|
+
globalStore.logout()
|
84
83
|
}
|
85
84
|
}
|
86
85
|
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { client } from 'src/shared/api/client'
|
2
|
+
import { Mutations } from '@coopenomics/sdk'
|
3
|
+
|
4
|
+
async function updateAccount(data: Mutations.Accounts.UpdateAccount.IInput['data']): Promise<Mutations.Accounts.UpdateAccount.IOutput[[typeof Mutations.Accounts.UpdateAccount.name][number]]>{
|
5
|
+
const {[Mutations.Accounts.UpdateAccount.name]: result} = await client.Mutation(Mutations.Accounts.UpdateAccount.mutation, {variables: {
|
6
|
+
data
|
7
|
+
}})
|
8
|
+
|
9
|
+
return result
|
10
|
+
}
|
11
|
+
|
12
|
+
export const api = {
|
13
|
+
updateAccount
|
14
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './model'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { Mutations } from '@coopenomics/sdk';
|
2
|
+
import { api } from '../api'
|
3
|
+
import { IAccount } from 'src/entities/Account/types';
|
4
|
+
|
5
|
+
export type IUpdateAccountInput = Mutations.Accounts.UpdateAccount.IInput['data']
|
6
|
+
|
7
|
+
export function useUpdateAccount() {
|
8
|
+
|
9
|
+
async function updateAccount(data: IUpdateAccountInput): Promise<IAccount> {
|
10
|
+
const account = await api.updateAccount(data);
|
11
|
+
|
12
|
+
return account;
|
13
|
+
}
|
14
|
+
|
15
|
+
return { updateAccount };
|
16
|
+
}
|
@@ -60,8 +60,9 @@ div
|
|
60
60
|
}
|
61
61
|
|
62
62
|
const back = () => step.value--
|
63
|
-
|
64
|
-
|
63
|
+
|
64
|
+
if (session.isAuth)
|
65
|
+
branchStore.loadPublicBranches({ coopname: system.info.coopname })
|
65
66
|
|
66
67
|
const generate = async () => {
|
67
68
|
isLoading.value = true
|
@@ -2,6 +2,7 @@ import { client } from 'src/shared/api/client'
|
|
2
2
|
import { Mutations } from '@coopenomics/sdk'
|
3
3
|
|
4
4
|
async function updateBankAccount(data: Mutations.PaymentMethods.UpdateBankAccount.IInput['data']): Promise<Mutations.PaymentMethods.UpdateBankAccount.IOutput[typeof Mutations.PaymentMethods.UpdateBankAccount.name]>{
|
5
|
+
console.log('data on update', data)
|
5
6
|
const {updateBankAccount: result} = await client.Mutation(Mutations.PaymentMethods.UpdateBankAccount.mutation, {variables: {
|
6
7
|
data
|
7
8
|
}})
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { api } from '../api';
|
2
|
-
import { Mutations } from '@coopenomics/sdk'
|
3
2
|
|
4
3
|
export interface IBankTransferData {
|
5
4
|
account_number: string;
|
6
5
|
bank_name: string;
|
7
|
-
card_number?: string;
|
6
|
+
card_number?: string | null;
|
8
7
|
currency: string;
|
9
8
|
details: {
|
10
9
|
bik: string;
|
@@ -18,14 +17,22 @@ export interface IUpdateBranchBankAccount {
|
|
18
17
|
method_id: string;
|
19
18
|
method_type: string;
|
20
19
|
data: IBankTransferData;
|
20
|
+
is_default: boolean;
|
21
|
+
created_at: Date;
|
22
|
+
updated_at: Date;
|
21
23
|
}
|
22
24
|
|
23
25
|
|
24
26
|
export function useUpdateBranchBankAccount() {
|
25
27
|
|
26
|
-
async function updateBankAccount(data:
|
28
|
+
async function updateBankAccount(data: IUpdateBranchBankAccount) {
|
27
29
|
data.is_default = true
|
28
|
-
|
30
|
+
|
31
|
+
// Убираем ненужные поля TODO: очевидно что так делать не надо
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
33
|
+
const { created_at, updated_at, method_type, ...rest } = data;
|
34
|
+
|
35
|
+
return await api.updateBankAccount(rest)
|
29
36
|
}
|
30
37
|
|
31
38
|
return {
|
@@ -99,6 +99,7 @@ import { useSystemStore } from 'src/entities/System/model';
|
|
99
99
|
const { info } = useSystemStore()
|
100
100
|
|
101
101
|
import { notEmpty } from 'src/shared/lib/utils';
|
102
|
+
import { useAccountStore } from 'src/entities/Account/model';
|
102
103
|
|
103
104
|
const { state, addUserState, clearUserData } = useRegistratorStore()
|
104
105
|
const spread_minimum = ref(true) //TODO REPLACE IT!
|
@@ -204,6 +205,7 @@ const addUserNow = (userDataForm: any) => {
|
|
204
205
|
userDataForm.validate().then(async (success: boolean) => {
|
205
206
|
if (success) {
|
206
207
|
try {
|
208
|
+
const accountStore = useAccountStore()
|
207
209
|
loading.value = true
|
208
210
|
await addUser()
|
209
211
|
SuccessAlert('Пайщик добавлен в реестр, а приглашение отправлено на его email');
|
@@ -211,6 +213,7 @@ const addUserNow = (userDataForm: any) => {
|
|
211
213
|
addUserState.created_at = ''
|
212
214
|
clearUserData()
|
213
215
|
loading.value = false
|
216
|
+
accountStore.getAccounts()
|
214
217
|
} catch (e: any) {
|
215
218
|
loading.value = false
|
216
219
|
FailAlert(`Возникла ошибка: ${e.message}`)
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { useSessionStore } from 'src/entities/Session'
|
2
2
|
import { useGlobalStore } from 'src/shared/store'
|
3
|
-
import { api } from '../api'
|
3
|
+
// import { api } from '../api'
|
4
4
|
import { useCurrentUserStore } from 'src/entities/User'
|
5
5
|
|
6
6
|
export function useLogoutUser() {
|
7
7
|
async function logout(): Promise<void> {
|
8
8
|
const global = useGlobalStore()
|
9
|
-
|
10
|
-
if (global.tokens?.refresh.token) await api.logoutUser(global.tokens?.refresh.token)
|
9
|
+
//TODO: "начать с начала" при регистрации бажит на это - да и в целом пора бы маршруты срезать эти
|
10
|
+
// if (global.tokens?.refresh.token) await api.logoutUser(global.tokens?.refresh.token)
|
11
11
|
|
12
12
|
await global.logout()
|
13
13
|
|
@@ -53,11 +53,9 @@ div
|
|
53
53
|
BankDetailsCard(:bankDetails="props.row.bank_account")
|
54
54
|
div.col-md-4.col-xs-12.q-pa-sm
|
55
55
|
p.text-center.text-overline карточка председателя
|
56
|
-
|
56
|
+
EditableIndividualCard(:participantData="props.row.trustee" :readonly="true").q-mt-sm
|
57
57
|
div.text-wrap
|
58
58
|
p.text-grey для замены председателя участка - измените его имя аккаунта в карточке участка на аккаунт одного из пайщиков.
|
59
|
-
|
60
|
-
|
61
59
|
</template>
|
62
60
|
|
63
61
|
<script lang="ts" setup>
|
@@ -67,7 +65,7 @@ import { useEditableTableRows } from 'src/shared/lib/composables/useEditableTabl
|
|
67
65
|
import { CreateBranchButton } from 'src/features/Branch/CreateBranch';
|
68
66
|
import { getNameFromUserData } from 'src/shared/lib/utils/getNameFromUserData';
|
69
67
|
import { BranchCard } from 'src/widgets/BranchCard';
|
70
|
-
import {
|
68
|
+
import { EditableIndividualCard } from 'src/shared/ui/EditableIndividualCard';
|
71
69
|
import { BankDetailsCard } from 'src/widgets/BankDetailsCard';
|
72
70
|
import { useSystemStore } from 'src/entities/System/model';
|
73
71
|
const { info } = useSystemStore()
|
@@ -15,11 +15,11 @@ div(v-if="localRequest").row.justify-around.q-pt-lg
|
|
15
15
|
div.q-pa-md
|
16
16
|
q-input(v-model="localRequest.remain_units" :readonly="!showEdit" standout="bg-teal text-white" label="Остаток" type="number")
|
17
17
|
template(#append)
|
18
|
-
|
18
|
+
span единиц
|
19
19
|
|
20
20
|
q-input(v-model="price" :readonly="!showEdit" standout="bg-teal text-white" label="Цена" type="number" step="100" min="0")
|
21
21
|
template(#append)
|
22
|
-
|
22
|
+
span {{ symbol }}
|
23
23
|
|
24
24
|
div(v-if="isMy")
|
25
25
|
div(v-if="loggedIn")
|
@@ -21,7 +21,7 @@ export function useEditableData<T extends Record<string, any>>(
|
|
21
21
|
|
22
22
|
// Автоматически отслеживаем изменения в editableData
|
23
23
|
watch(
|
24
|
-
|
24
|
+
editableData,
|
25
25
|
(newData) => {
|
26
26
|
isEditing.value = !isEqual(newData.value, originalData.value); // Глубокое сравнение объектов
|
27
27
|
validateForm(); // Проверка валидности формы при изменении данных
|
@@ -0,0 +1,170 @@
|
|
1
|
+
<template lang="pug">
|
2
|
+
q-form(ref="form")
|
3
|
+
q-input(
|
4
|
+
dense
|
5
|
+
v-model="data.last_name"
|
6
|
+
standout="bg-teal text-white"
|
7
|
+
label="Фамилия"
|
8
|
+
:readonly="readonly"
|
9
|
+
:rules="[val => notEmpty(val), val => validatePersonalName(val)]"
|
10
|
+
autocomplete="off"
|
11
|
+
)
|
12
|
+
q-input(
|
13
|
+
dense
|
14
|
+
v-model="data.first_name"
|
15
|
+
standout="bg-teal text-white"
|
16
|
+
label="Имя"
|
17
|
+
:readonly="readonly"
|
18
|
+
:rules="[val => notEmpty(val), val => validatePersonalName(val)]"
|
19
|
+
autocomplete="off"
|
20
|
+
)
|
21
|
+
q-input(
|
22
|
+
dense
|
23
|
+
v-model="data.middle_name"
|
24
|
+
standout="bg-teal text-white"
|
25
|
+
label="Отчество"
|
26
|
+
:readonly="readonly"
|
27
|
+
:rules="[val => validatePersonalName(val)]"
|
28
|
+
autocomplete="off"
|
29
|
+
)
|
30
|
+
|
31
|
+
q-input(
|
32
|
+
dense
|
33
|
+
v-model="data.birthdate"
|
34
|
+
standout="bg-teal text-white"
|
35
|
+
mask="date"
|
36
|
+
label="Дата рождения"
|
37
|
+
placeholder="Формат: год/месяц/день"
|
38
|
+
:readonly="readonly"
|
39
|
+
:rules="['date', val => notEmpty(val)]"
|
40
|
+
autocomplete="off"
|
41
|
+
)
|
42
|
+
template(v-slot:append)
|
43
|
+
q-icon(name="event" class="cursor-pointer" v-if="!readonly")
|
44
|
+
q-popup-proxy(cover transition-show="scale" transition-hide="scale")
|
45
|
+
q-date(v-model="data.birthdate")
|
46
|
+
.row.items-center.justify-end
|
47
|
+
q-btn(v-close-popup label="Закрыть" color="primary" flat)
|
48
|
+
|
49
|
+
q-input(
|
50
|
+
dense
|
51
|
+
v-model="data.phone"
|
52
|
+
standout="bg-teal text-white"
|
53
|
+
label="Номер телефона"
|
54
|
+
mask="+7 (###) ###-##-##"
|
55
|
+
fill-mask
|
56
|
+
:readonly="readonly"
|
57
|
+
:rules="[val => notEmpty(val), val => notEmptyPhone(val)]"
|
58
|
+
autocomplete="off"
|
59
|
+
)
|
60
|
+
|
61
|
+
q-select(
|
62
|
+
dense
|
63
|
+
v-model="data.country"
|
64
|
+
standout="bg-teal text-white"
|
65
|
+
label="Страна"
|
66
|
+
:options="[{ label: 'Российская Федерация', value: 'Российская Федерация' }]"
|
67
|
+
map-options
|
68
|
+
emit-value
|
69
|
+
:readonly="readonly"
|
70
|
+
:rules="[val => notEmpty(val)]"
|
71
|
+
)
|
72
|
+
|
73
|
+
q-input(
|
74
|
+
dense
|
75
|
+
v-model="data.city"
|
76
|
+
standout="bg-teal text-white"
|
77
|
+
label="Город"
|
78
|
+
:readonly="readonly"
|
79
|
+
:rules="[val => notEmpty(val)]"
|
80
|
+
autocomplete="off"
|
81
|
+
)
|
82
|
+
|
83
|
+
q-input(
|
84
|
+
dense
|
85
|
+
v-model="data.full_address"
|
86
|
+
standout="bg-teal text-white"
|
87
|
+
label="Адрес регистрации"
|
88
|
+
:readonly="readonly"
|
89
|
+
:rules="[val => notEmpty(val)]"
|
90
|
+
autocomplete="off"
|
91
|
+
)
|
92
|
+
|
93
|
+
q-input(
|
94
|
+
dense
|
95
|
+
v-model="data.details.inn"
|
96
|
+
standout="bg-teal text-white"
|
97
|
+
mask="############"
|
98
|
+
label="ИНН предпринимателя"
|
99
|
+
:readonly="readonly"
|
100
|
+
:rules="[val => notEmpty(val), val => (val.length === 10 || val.length === 12) || 'ИНН должен содержать 10 или 12 цифр']"
|
101
|
+
autocomplete="off"
|
102
|
+
)
|
103
|
+
|
104
|
+
q-input(
|
105
|
+
dense
|
106
|
+
v-model="data.details.ogrn"
|
107
|
+
standout="bg-teal text-white"
|
108
|
+
mask="###############"
|
109
|
+
label="ОГРНИП"
|
110
|
+
:readonly="readonly"
|
111
|
+
:rules="[val => notEmpty(val), val => (val.length === 13 || val.length === 15) || 'ОГРНИП должен содержать 13 или 15 цифр']"
|
112
|
+
autocomplete="off"
|
113
|
+
)
|
114
|
+
|
115
|
+
EditableActions(
|
116
|
+
v-if="!readonly"
|
117
|
+
:isEditing="isEditing"
|
118
|
+
:isDisabled="isDisabled"
|
119
|
+
@save="saveChanges"
|
120
|
+
@cancel="cancelChanges"
|
121
|
+
)
|
122
|
+
</template>
|
123
|
+
|
124
|
+
<script setup lang="ts">
|
125
|
+
import { ref } from 'vue';
|
126
|
+
import { useEditableData } from 'src/shared/lib/composables/useEditableData';
|
127
|
+
import { notEmpty, notEmptyPhone, validatePersonalName } from 'src/shared/lib/utils';
|
128
|
+
import { failAlert, SuccessAlert } from 'src/shared/api';
|
129
|
+
import { EditableActions } from 'src/shared/ui/EditableActions';
|
130
|
+
import { type IUpdateAccountInput, useUpdateAccount } from 'src/features/Account/UpdateAccount/model';
|
131
|
+
import { type IEntrepreneurData } from 'src/entities/Account/types';
|
132
|
+
|
133
|
+
const emit = defineEmits(['update']);
|
134
|
+
const { updateAccount } = useUpdateAccount();
|
135
|
+
|
136
|
+
const props = defineProps({
|
137
|
+
participantData: {
|
138
|
+
type: Object as () => IEntrepreneurData,
|
139
|
+
required: true
|
140
|
+
},
|
141
|
+
readonly: {
|
142
|
+
type: Boolean,
|
143
|
+
default: false
|
144
|
+
}
|
145
|
+
});
|
146
|
+
|
147
|
+
const localEntrepreneurData = ref(props.participantData);
|
148
|
+
const form = ref();
|
149
|
+
|
150
|
+
const handleSave = async () => {
|
151
|
+
try {
|
152
|
+
const account_data: IUpdateAccountInput = {
|
153
|
+
username: props.participantData.username,
|
154
|
+
entrepreneur_data: data.value,
|
155
|
+
};
|
156
|
+
await updateAccount(account_data);
|
157
|
+
emit('update', JSON.parse(JSON.stringify(data.value)));
|
158
|
+
SuccessAlert('Данные аккаунта обновлены');
|
159
|
+
} catch (e) {
|
160
|
+
console.log(e);
|
161
|
+
failAlert(e);
|
162
|
+
}
|
163
|
+
};
|
164
|
+
|
165
|
+
const { editableData: data, isEditing, isDisabled, saveChanges, cancelChanges } = useEditableData(
|
166
|
+
localEntrepreneurData.value,
|
167
|
+
handleSave,
|
168
|
+
form
|
169
|
+
);
|
170
|
+
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
export {default as EditableEntrepreneurCard} from './EditableEntrepreneurCard.vue'
|