@coopenomics/desktop 2025.5.5 → 2025.5.14-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/index.html +21 -2
- package/package.json +5 -5
- package/src/entities/Registrator/model/store.ts +16 -11
- package/src/entities/Wallet/api/index.ts +5 -3
- package/src/features/Agreementer/SignAgreementDialog/model/index.ts +5 -3
- package/src/features/Agreementer/SignAgreementDialog/ui/SignAgreementDialog.vue +1 -1
- package/src/features/Decision/AuthorizeAndExecDecision/model/index.ts +6 -9
- package/src/features/Decision/CreateProject/model/index.ts +1 -1
- package/src/features/Decision/VoteAgainstDecision/model/index.ts +14 -2
- package/src/features/Decision/VoteForDecision/model/index.ts +9 -5
- package/src/features/FreeDecision/CreateProject/model/index.ts +1 -1
- package/src/features/Meet/CloseMeetWithDecision/model/index.ts +13 -13
- package/src/features/Meet/CreateMeet/model/index.ts +1 -1
- package/src/features/Meet/RestartMeet/model/index.ts +6 -3
- package/src/features/Request/AcceptRequest/api/index.ts +3 -10
- package/src/features/Request/ConfirmRecieveOnRequest/api/index.ts +4 -9
- package/src/features/Request/ConfirmSupplyOnRequest/api/index.ts +6 -11
- package/src/features/Request/ConfirmSupplyOnRequest/ui/ConfirmSupplyOnRequestButton.vue +1 -1
- package/src/features/Request/CreateChildOrder/model/index.ts +35 -30
- package/src/features/Request/CreateChildOrder/ui/CreateChildOrderButton/CreateChildOrderButton.vue +20 -15
- package/src/features/Request/DisputeOnRequest/api/index.ts +19 -24
- package/src/features/Request/DisputeOnRequest/ui/DisputeOnRequestButton.vue +1 -1
- package/src/features/Request/RecieveOnRequest/api/index.ts +6 -11
- package/src/features/Request/RecieveOnRequest/ui/RecieveOnRequestButton.vue +1 -1
- package/src/features/Request/SupplyOnRequest/api/index.ts +18 -27
- package/src/features/Union/AddCooperative/ui/AddCooperativeForm.vue +7 -5
- package/src/features/User/CreateUser/api/index.ts +28 -10
- package/src/features/User/CreateUser/model/index.ts +39 -31
- package/src/pages/Cooperative/ListOfAgenda/ui/ListOfAgendaQuestions.vue +8 -8
- package/src/pages/Cooperative/ListOfParticipants/ui/ListOfParticipantsPage.vue +3 -3
- package/src/pages/Registrator/SignUp/EmailInput.vue +0 -7
- package/src/pages/Union/ConnectionAgreement/ConnectionAgreementPage.vue +1 -1
- package/src/processes/init-app/index.ts +2 -0
- package/src/processes/process-decisions/index.ts +32 -29
- package/src/processes/select-branch/index.ts +1 -1
- package/src/shared/api/indexDB.ts +0 -1
- package/src/shared/lib/document/model/const.ts +30 -0
- package/src/shared/lib/document/model/entity.ts +33 -21
- package/src/shared/lib/document/model/index.ts +1 -1
- package/src/shared/lib/document/model/types.ts +2 -3
- package/src/shared/lib/types/document/index.ts +11 -13
- package/src/shared/lib/types/user/IUserData.ts +5 -6
- package/src/shared/lib/types/user/index.ts +1 -11
- package/src/shared/lib/utils/account.ts +24 -0
- package/src/shared/lib/utils/index.ts +2 -0
- package/src/shared/lib/utils/theme.ts +30 -0
- package/src/shared/store/index.ts +9 -5
- package/src/shared/ui/BaseDocument/BaseDocument.vue +43 -42
- package/src/shared/ui/ComplexDocument/ComplexDocument.vue +7 -5
- package/src/shared/ui/ToogleDarkLight/ToogleDarkLight.vue +8 -1
- package/src/shared/ui/ZodForm/ZodForm.vue +1 -1
- package/src/widgets/Cooperative/Documents/ListOfDocuments/ui/DocumentsTable.vue +3 -2
- package/src/widgets/Cooperative/Payments/ListOfPayments/ui/ListOfPaymentsWidget.vue +9 -10
- package/src/widgets/Meets/MeetDetailsVoting/model.ts +4 -4
- package/src/widgets/Participants/ui/ParticipantCard.vue +17 -9
- package/src/widgets/Participants/ui/ParticipantDetails.vue +7 -6
- package/src/widgets/Participants/ui/ParticipantsTable.vue +29 -23
- package/src/widgets/Questions/ui/QuestionsTable/QuestionsTable.vue +8 -8
- package/src/widgets/RequireAgreements/ui/RequireAgreements.vue +1 -1
package/index.html
CHANGED
@@ -20,6 +20,25 @@
|
|
20
20
|
<meta property="og:image" content="<%- SITE_IMAGE %>" />
|
21
21
|
</head>
|
22
22
|
<body>
|
23
|
+
<script>
|
24
|
+
try {
|
25
|
+
var theme = localStorage.getItem('theme-mode');
|
26
|
+
if (theme === 'dark') {
|
27
|
+
document.body.style.background = '#121212';
|
28
|
+
} else if (theme === 'light') {
|
29
|
+
document.body.style.background = '#f5f5f5';
|
30
|
+
}
|
31
|
+
} catch (e) {
|
32
|
+
console.log('error on set theme', e);
|
33
|
+
}
|
34
|
+
// Показываем лоадер только после того, как DOM готов
|
35
|
+
document.addEventListener('DOMContentLoaded', function() {
|
36
|
+
try {
|
37
|
+
var loader = document.querySelector('.loader-container');
|
38
|
+
if (loader) loader.style.display = 'flex';
|
39
|
+
} catch (e) {}
|
40
|
+
});
|
41
|
+
</script>
|
23
42
|
<style>
|
24
43
|
body {
|
25
44
|
margin: 0;
|
@@ -42,7 +61,7 @@
|
|
42
61
|
}
|
43
62
|
|
44
63
|
.loader-container {
|
45
|
-
display:
|
64
|
+
display: none;
|
46
65
|
justify-content: center;
|
47
66
|
align-items: center;
|
48
67
|
height: 100%;
|
@@ -57,7 +76,7 @@
|
|
57
76
|
border-radius: 50%;
|
58
77
|
position: relative;
|
59
78
|
animation: rotate 2s linear infinite;
|
60
|
-
border-top: 3px solid
|
79
|
+
border-top: 3px solid rgb(131, 130, 130);
|
61
80
|
border-right: 3px solid transparent;
|
62
81
|
}
|
63
82
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coopenomics/desktop",
|
3
|
-
"version": "2025.5.
|
3
|
+
"version": "2025.5.14-1",
|
4
4
|
"description": "A Desktop Project",
|
5
5
|
"productName": "Desktop App",
|
6
6
|
"author": "Alex Ant <dacom.dark.sun@gmail.com>",
|
@@ -24,8 +24,8 @@
|
|
24
24
|
"start": "node -r ./alias-resolver.js dist/ssr/index.js"
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
|
-
"@coopenomics/controller": "2025.5.
|
28
|
-
"@coopenomics/sdk": "2025.5.
|
27
|
+
"@coopenomics/controller": "2025.5.14-1",
|
28
|
+
"@coopenomics/sdk": "2025.5.14-1",
|
29
29
|
"@dicebear/collection": "^9.0.1",
|
30
30
|
"@dicebear/core": "^9.0.1",
|
31
31
|
"@fortawesome/fontawesome-svg-core": "^6.5.2",
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"@wharfkit/wallet-plugin-privatekey": "^1.1.0",
|
50
50
|
"axios": "^1.2.1",
|
51
51
|
"compression": "^1.7.4",
|
52
|
-
"cooptypes": "2025.5.
|
52
|
+
"cooptypes": "2025.5.14-1",
|
53
53
|
"dompurify": "^3.1.7",
|
54
54
|
"dotenv": "^16.4.5",
|
55
55
|
"email-regex": "^5.0.0",
|
@@ -101,5 +101,5 @@
|
|
101
101
|
"npm": ">= 6.13.4",
|
102
102
|
"yarn": ">= 1.21.1"
|
103
103
|
},
|
104
|
-
"gitHead": "
|
104
|
+
"gitHead": "9d204ba496638eb0ecf93d585273dbf57687f2ec"
|
105
105
|
}
|
@@ -1,9 +1,12 @@
|
|
1
1
|
import { defineStore } from 'pinia';
|
2
2
|
import { computed, reactive } from 'vue';
|
3
3
|
import { IGeneratedAccount } from 'src/shared/lib/types/user';
|
4
|
-
import { type
|
4
|
+
import { type IRegisterAccount } from 'src/shared/lib/types/user/IUserData';
|
5
5
|
import type { Cooperative } from 'cooptypes';
|
6
6
|
import { useSystemStore } from 'src/entities/System/model';
|
7
|
+
import type { IDocument, ISignatureInfo } from 'src/shared/lib/types/document';
|
8
|
+
import { Zeus } from '@coopenomics/sdk';
|
9
|
+
import { AccountTypes } from 'src/entities/Account/types';
|
7
10
|
|
8
11
|
const namespace = 'registrator';
|
9
12
|
|
@@ -15,8 +18,11 @@ const initialAccountState: IGeneratedAccount = {
|
|
15
18
|
};
|
16
19
|
|
17
20
|
// Начальное состояние для userData
|
18
|
-
const initialUserDataState:
|
19
|
-
|
21
|
+
const initialUserDataState: IRegisterAccount = {
|
22
|
+
email: '',
|
23
|
+
username: '',
|
24
|
+
public_key: '',
|
25
|
+
type: AccountTypes.individual,
|
20
26
|
individual_data: {
|
21
27
|
first_name: '',
|
22
28
|
last_name: '',
|
@@ -24,10 +30,9 @@ const initialUserDataState: ICreateUserData = {
|
|
24
30
|
birthdate: '',
|
25
31
|
full_address: '',
|
26
32
|
phone: '',
|
27
|
-
email: '',
|
28
33
|
},
|
29
34
|
organization_data: {
|
30
|
-
type:
|
35
|
+
type: Zeus.OrganizationType.COOP,
|
31
36
|
short_name: '',
|
32
37
|
full_name: '',
|
33
38
|
represented_by: {
|
@@ -42,7 +47,6 @@ const initialUserDataState: ICreateUserData = {
|
|
42
47
|
full_address: '',
|
43
48
|
fact_address: '',
|
44
49
|
phone: '',
|
45
|
-
email: '',
|
46
50
|
details: {
|
47
51
|
kpp: '',
|
48
52
|
inn: '',
|
@@ -66,8 +70,7 @@ const initialUserDataState: ICreateUserData = {
|
|
66
70
|
middle_name: '',
|
67
71
|
birthdate: '',
|
68
72
|
phone: '',
|
69
|
-
|
70
|
-
country: 'Russia',
|
73
|
+
country: Zeus.Country.Russia,
|
71
74
|
city: '',
|
72
75
|
full_address: '',
|
73
76
|
details: {
|
@@ -89,11 +92,13 @@ const initialUserDataState: ICreateUserData = {
|
|
89
92
|
};
|
90
93
|
|
91
94
|
// Начальное состояние для любого документа
|
92
|
-
const initialDocumentState = {
|
95
|
+
const initialDocumentState: IDocument = {
|
93
96
|
hash: '',
|
94
97
|
meta: {} as Cooperative.Document.IMetaDocument,
|
95
|
-
|
96
|
-
|
98
|
+
meta_hash: '',
|
99
|
+
version: '',
|
100
|
+
doc_hash: '',
|
101
|
+
signatures: [] as ISignatureInfo[],
|
97
102
|
};
|
98
103
|
|
99
104
|
// Начальное состояние для payment
|
@@ -147,8 +147,9 @@ async function loadMethods(params: IGetPaymentMethods): Promise<IPaymentMethodDa
|
|
147
147
|
}
|
148
148
|
|
149
149
|
async function loadUserAgreements(coopname: string, username: string): Promise<SovietContract.Tables.Agreements.IAgreement[]> {
|
150
|
-
|
151
|
-
|
150
|
+
|
151
|
+
console.log('coopname: ', coopname, 'username: ', username)
|
152
|
+
const result = await fetchTable(
|
152
153
|
SovietContract.contractName.production,
|
153
154
|
coopname,
|
154
155
|
SovietContract.Tables.Agreements.tableName,
|
@@ -157,7 +158,8 @@ async function loadUserAgreements(coopname: string, username: string): Promise<S
|
|
157
158
|
LimitsList.None,
|
158
159
|
'secondary'
|
159
160
|
)
|
160
|
-
|
161
|
+
console.log('result: ', result)
|
162
|
+
return result as SovietContract.Tables.Agreements.IAgreement[];
|
161
163
|
|
162
164
|
}
|
163
165
|
|
@@ -1,18 +1,20 @@
|
|
1
1
|
import { DigitalDocument, type IGeneratedDocument } from 'src/shared/lib/document';
|
2
2
|
import { api } from '../api';
|
3
3
|
import { useSystemStore } from 'src/entities/System/model';
|
4
|
+
import { useSessionStore } from 'src/entities/Session/model';
|
4
5
|
|
5
6
|
export const useSignAgreement = () => {
|
6
7
|
const { info } = useSystemStore()
|
8
|
+
const { username } = useSessionStore()
|
7
9
|
|
8
|
-
const signAgreement = async(
|
10
|
+
const signAgreement = async(agreement_type: string, agreement: IGeneratedDocument) => {
|
9
11
|
const document = new DigitalDocument(agreement);
|
10
|
-
await document.sign();
|
12
|
+
await document.sign(username);
|
11
13
|
|
12
14
|
if (!document.signedDocument)
|
13
15
|
throw new Error('Ошибка подписи документа')
|
14
16
|
|
15
|
-
|
17
|
+
// Проверяем типы и преобразуем документ
|
16
18
|
await api.sendAgreement({
|
17
19
|
coopname: info.coopname,
|
18
20
|
administrator: info.coopname,
|
@@ -55,7 +55,7 @@ const sign = async () => {
|
|
55
55
|
|
56
56
|
try {
|
57
57
|
isSubmitting.value = true
|
58
|
-
await signAgreement(
|
58
|
+
await signAgreement(props.agreement.type, agreementOnSign.value)
|
59
59
|
await useWalletStore().loadUserWallet({coopname: info.coopname, username: session.username})
|
60
60
|
isSubmitting.value = false
|
61
61
|
show.value = false
|
@@ -29,21 +29,18 @@ export function useAuthorizeAndExecDecision() {
|
|
29
29
|
throw new Error('Ошибка при генерации документа решения');
|
30
30
|
}
|
31
31
|
|
32
|
-
const
|
33
|
-
|
34
|
-
const chainDocument: Cooperative.Document.IChainDocument = {
|
35
|
-
hash: document.hash,
|
36
|
-
meta: JSON.stringify(document.meta),
|
37
|
-
signature: signed_hash_of_document.signature,
|
38
|
-
public_key: signed_hash_of_document.public_key,
|
39
|
-
};
|
32
|
+
const rawDocument = new DigitalDocument(document)
|
33
|
+
const signedDocument = await rawDocument.sign<any>(username)
|
40
34
|
|
41
35
|
const authorizeData: SovietContract.Actions.Decisions.Authorize.IAuthorize =
|
42
36
|
{
|
43
37
|
coopname: info.coopname,
|
44
38
|
chairman: session.username,
|
45
39
|
decision_id,
|
46
|
-
document:
|
40
|
+
document: {
|
41
|
+
...signedDocument,
|
42
|
+
meta: JSON.stringify(signedDocument.meta),
|
43
|
+
},
|
47
44
|
};
|
48
45
|
|
49
46
|
const execData: SovietContract.Actions.Decisions.Exec.IExec = {
|
@@ -24,7 +24,7 @@ export function useCreateProjectOfFreeDecision() {
|
|
24
24
|
|
25
25
|
const { signDocument } = useSignDocument()
|
26
26
|
|
27
|
-
const signedDocument = await signDocument(generatedDocument)
|
27
|
+
const signedDocument = await signDocument(generatedDocument, username)
|
28
28
|
|
29
29
|
await publishProjectOfFreeDecision({
|
30
30
|
coopname: coopname,
|
@@ -2,13 +2,25 @@ import { TransactResult } from '@wharfkit/session';
|
|
2
2
|
import { SovietContract } from 'cooptypes';
|
3
3
|
import { useSessionStore } from 'src/entities/Session';
|
4
4
|
import { useGlobalStore } from 'src/shared/store';
|
5
|
+
import { useSystemStore } from 'src/entities/System/model';
|
6
|
+
import { client } from 'src/shared/api/client';
|
5
7
|
|
6
8
|
export function useVoteAgainstDecision() {
|
9
|
+
const { info } = useSystemStore()
|
10
|
+
|
7
11
|
async function voteAgainstDecision(
|
8
|
-
|
12
|
+
decision_id: number
|
9
13
|
): Promise<TransactResult | undefined> {
|
10
14
|
const session = useSessionStore();
|
11
15
|
|
16
|
+
// Создаем подпись голоса с помощью SDK Vote
|
17
|
+
const voteData = await client.Vote.voteAgainst(
|
18
|
+
info.coopname,
|
19
|
+
session.username,
|
20
|
+
decision_id
|
21
|
+
);
|
22
|
+
|
23
|
+
// Отправляем транзакцию с подписанными данными
|
12
24
|
const result = useGlobalStore().transact({
|
13
25
|
account: SovietContract.contractName.production,
|
14
26
|
name: SovietContract.Actions.Decisions.VoteAgainst.actionName,
|
@@ -18,7 +30,7 @@ export function useVoteAgainstDecision() {
|
|
18
30
|
permission: 'active',
|
19
31
|
},
|
20
32
|
],
|
21
|
-
data,
|
33
|
+
data: voteData,
|
22
34
|
});
|
23
35
|
|
24
36
|
return result;
|
@@ -3,6 +3,7 @@ import { SovietContract } from 'cooptypes';
|
|
3
3
|
import { useSessionStore } from 'src/entities/Session';
|
4
4
|
import { useGlobalStore } from 'src/shared/store';
|
5
5
|
import { useSystemStore } from 'src/entities/System/model';
|
6
|
+
import { client } from 'src/shared/api/client';
|
6
7
|
|
7
8
|
export function useVoteForDecision() {
|
8
9
|
const { info } = useSystemStore()
|
@@ -12,6 +13,13 @@ export function useVoteForDecision() {
|
|
12
13
|
): Promise<TransactResult | undefined> {
|
13
14
|
const session = useSessionStore();
|
14
15
|
|
16
|
+
// Создаем подпись голоса с помощью SDK Vote
|
17
|
+
const voteData = await client.Vote.voteFor(
|
18
|
+
info.coopname,
|
19
|
+
session.username,
|
20
|
+
decision_id
|
21
|
+
);
|
22
|
+
// Отправляем транзакцию с подписанными данными
|
15
23
|
const result = useGlobalStore().transact({
|
16
24
|
account: SovietContract.contractName.production,
|
17
25
|
name: SovietContract.Actions.Decisions.VoteFor.actionName,
|
@@ -21,11 +29,7 @@ export function useVoteForDecision() {
|
|
21
29
|
permission: 'active',
|
22
30
|
},
|
23
31
|
],
|
24
|
-
data:
|
25
|
-
member: session.username,
|
26
|
-
coopname: info.coopname,
|
27
|
-
decision_id: decision_id,
|
28
|
-
},
|
32
|
+
data: voteData,
|
29
33
|
});
|
30
34
|
|
31
35
|
return result;
|
@@ -27,7 +27,7 @@ export function useCreateProjectOfFreeDecision() {
|
|
27
27
|
|
28
28
|
const { signDocument } = useSignDocument()
|
29
29
|
|
30
|
-
const signedDocument = await signDocument(generatedDocument)
|
30
|
+
const signedDocument = await signDocument(generatedDocument, username)
|
31
31
|
|
32
32
|
await publishProjectOfFreeDecision({
|
33
33
|
coopname: coopname,
|
@@ -14,14 +14,14 @@ interface ICloseMeetWithDecisionInput {
|
|
14
14
|
|
15
15
|
export async function signBySecretaryOnAnnualGeneralMeetWithDecision(data: ICloseMeetWithDecisionInput): Promise<ISignBySecretaryResult> {
|
16
16
|
const { signDocument } = useSignDocument()
|
17
|
-
|
17
|
+
|
18
18
|
const variables: Mutations.Meet.GenerateAnnualGeneralMeetDecisionDocument.IInput = {
|
19
|
-
data: {
|
19
|
+
data: {
|
20
20
|
coopname: data.coopname,
|
21
21
|
username: data.username,
|
22
22
|
}
|
23
23
|
}
|
24
|
-
|
24
|
+
|
25
25
|
// Генерируем документ решения
|
26
26
|
const { [Mutations.Meet.GenerateAnnualGeneralMeetDecisionDocument.name]: generatedDocument } = await client.Mutation(
|
27
27
|
Mutations.Meet.GenerateAnnualGeneralMeetDecisionDocument.mutation,
|
@@ -29,9 +29,9 @@ export async function signBySecretaryOnAnnualGeneralMeetWithDecision(data: IClos
|
|
29
29
|
variables
|
30
30
|
}
|
31
31
|
)
|
32
|
-
|
32
|
+
|
33
33
|
// Подписываем документ
|
34
|
-
const signedDocument = await signDocument(generatedDocument)
|
34
|
+
const signedDocument = await signDocument(generatedDocument, data.username)
|
35
35
|
|
36
36
|
const variables2: Mutations.Meet.SignBySecretaryOnAnnualGeneralMeet.IInput = {
|
37
37
|
data: {
|
@@ -48,15 +48,15 @@ export async function signBySecretaryOnAnnualGeneralMeetWithDecision(data: IClos
|
|
48
48
|
variables: variables2
|
49
49
|
}
|
50
50
|
)
|
51
|
-
|
51
|
+
|
52
52
|
return result
|
53
53
|
}
|
54
54
|
|
55
55
|
export async function signByPresiderOnAnnualGeneralMeetWithDecision(data: ICloseMeetWithDecisionInput): Promise<ISignByPresiderResult> {
|
56
56
|
const { signDocument } = useSignDocument()
|
57
|
-
|
57
|
+
|
58
58
|
const variables: Mutations.Meet.GenerateAnnualGeneralMeetDecisionDocument.IInput = {
|
59
|
-
data: {
|
59
|
+
data: {
|
60
60
|
coopname: data.coopname,
|
61
61
|
username: data.username,
|
62
62
|
}
|
@@ -68,16 +68,16 @@ export async function signByPresiderOnAnnualGeneralMeetWithDecision(data: IClose
|
|
68
68
|
variables
|
69
69
|
}
|
70
70
|
)
|
71
|
-
|
71
|
+
|
72
72
|
// Подписываем документ
|
73
|
-
const signedDocument = await signDocument(generatedDocument)
|
74
|
-
|
73
|
+
const signedDocument = await signDocument(generatedDocument, data.username)
|
74
|
+
|
75
75
|
const variables2: Mutations.Meet.SignByPresiderOnAnnualGeneralMeet.IInput = {
|
76
76
|
data: {
|
77
77
|
coopname: data.coopname,
|
78
78
|
hash: data.hash,
|
79
79
|
username: data.username,
|
80
|
-
presider_decision: signedDocument
|
80
|
+
presider_decision: signedDocument
|
81
81
|
}
|
82
82
|
}
|
83
83
|
// Закрываем собрание с подписанным решением председателя
|
@@ -87,6 +87,6 @@ export async function signByPresiderOnAnnualGeneralMeetWithDecision(data: IClose
|
|
87
87
|
variables: variables2
|
88
88
|
}
|
89
89
|
)
|
90
|
-
|
90
|
+
|
91
91
|
return result
|
92
92
|
}
|
@@ -43,7 +43,7 @@ export async function createMeetWithAgenda(data: ICreateMeetWithAgendaInput): Pr
|
|
43
43
|
username: data.username
|
44
44
|
})
|
45
45
|
// Подписываем документ
|
46
|
-
const signedDocument = await signDocument(generatedDocument)
|
46
|
+
const signedDocument = await signDocument(generatedDocument, data.username)
|
47
47
|
|
48
48
|
// Создаем собрание
|
49
49
|
const result = await createMeet({
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import { client } from 'src/shared/api/client';
|
2
2
|
import { Mutations } from '@coopenomics/sdk';
|
3
3
|
import { generateAgenda } from 'src/features/Meet/GenerateAgenda/model'
|
4
|
-
import {
|
4
|
+
import { DigitalDocument } from 'src/shared/lib/document'
|
5
|
+
import { useSessionStore } from 'src/entities/Session';
|
6
|
+
import type { Cooperative } from 'cooptypes';
|
5
7
|
|
6
8
|
export type IRestartMeetInput = Mutations.Meet.RestartAnnualGeneralMeet.IInput['data'];
|
7
9
|
export type IRestartMeetResult = Mutations.Meet.RestartAnnualGeneralMeet.IOutput[typeof Mutations.Meet.RestartAnnualGeneralMeet.name];
|
@@ -33,14 +35,15 @@ export async function restartMeet(data: IRestartMeetInput): Promise<IRestartMeet
|
|
33
35
|
}
|
34
36
|
|
35
37
|
export async function restartMeetWithProposal(data: IRestartMeetWithProposalInput): Promise<IRestartMeetResult> {
|
36
|
-
const {
|
38
|
+
const { username } = useSessionStore()
|
37
39
|
// Генерируем документ повестки
|
38
40
|
const generatedDocument = await generateAgenda({
|
39
41
|
coopname: data.coopname,
|
40
42
|
username: data.username
|
41
43
|
})
|
42
44
|
// Подписываем документ
|
43
|
-
const
|
45
|
+
const rawDocument = new DigitalDocument(generatedDocument)
|
46
|
+
const signedDocument = await rawDocument.sign<Cooperative.Registry.AnnualGeneralMeetingAgenda.Meta>(username)
|
44
47
|
|
45
48
|
// Перезапускаем собрание
|
46
49
|
const result = await restartMeet({
|
@@ -4,22 +4,15 @@ import { transact } from 'src/shared/api';
|
|
4
4
|
import { ContractsList } from 'src/shared/config';
|
5
5
|
import { useRequestStore } from 'src/entities/Request/model/stores';
|
6
6
|
import { IUpdateOneRequest } from 'src/entities/Request';
|
7
|
-
import { IDocument } from 'src/shared/lib/types/document';
|
8
7
|
import { MarketContract } from 'cooptypes';
|
8
|
+
import { fakeDocument } from 'src/shared/lib/document/model/const';
|
9
9
|
|
10
10
|
async function acceptRequest(
|
11
11
|
params: IAcceptRequest
|
12
12
|
): Promise<TransactResult | undefined> {
|
13
13
|
//TODO здесь нужно получить подписанный документ (заявление на взнос имуществом) и подставить
|
14
14
|
//сейчас установлены фейковые данные
|
15
|
-
const document =
|
16
|
-
hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
17
|
-
public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
18
|
-
signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
19
|
-
meta: '',
|
20
|
-
} as IDocument;
|
21
|
-
|
22
|
-
console.log(params)
|
15
|
+
const document = fakeDocument
|
23
16
|
|
24
17
|
const result = await transact({
|
25
18
|
account: ContractsList.Marketplace,
|
@@ -34,7 +27,7 @@ async function acceptRequest(
|
|
34
27
|
username: params.username,
|
35
28
|
coopname: params.coopname,
|
36
29
|
exchange_id: params.request_id,
|
37
|
-
document,
|
30
|
+
document: {...document, meta: JSON.stringify(document.meta)},
|
38
31
|
} as MarketContract.Actions.AcceptRequest.IAcceptRequest,
|
39
32
|
});
|
40
33
|
|
@@ -6,19 +6,14 @@ import { useRequestStore } from 'src/entities/Request/model/stores';
|
|
6
6
|
import { IUpdateOneRequest } from 'src/entities/Request';
|
7
7
|
import { IDocument } from 'src/shared/lib/types/document';
|
8
8
|
import { MarketContract } from 'cooptypes';
|
9
|
-
|
9
|
+
import { fakeDocument } from 'src/shared/lib/document/model/const';
|
10
10
|
async function confirmRecieve(
|
11
11
|
params: IConfirmRecieveOnRequest
|
12
12
|
): Promise<TransactResult | undefined> {
|
13
13
|
//TODO здесь нужно получить подписанный документ (акт приёма-передачи) и подставить
|
14
|
-
|
15
|
-
hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
16
|
-
public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
17
|
-
signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
18
|
-
meta: '',
|
19
|
-
} as IDocument;
|
14
|
+
const document: IDocument = fakeDocument
|
20
15
|
|
21
|
-
|
16
|
+
const result = await transact({
|
22
17
|
account: ContractsList.Marketplace,
|
23
18
|
name: MarketContract.Actions.ConfirmReceive.actionName,
|
24
19
|
authorization: [
|
@@ -31,7 +26,7 @@ async function confirmRecieve(
|
|
31
26
|
username: params.username,
|
32
27
|
coopname: params.coopname,
|
33
28
|
exchange_id: params.request_id,
|
34
|
-
document,
|
29
|
+
document: {...document, meta: JSON.stringify(document.meta)},
|
35
30
|
} as MarketContract.Actions.ConfirmReceive.IConfirmReceive,
|
36
31
|
});
|
37
32
|
|
@@ -4,19 +4,14 @@ import { transact } from 'src/shared/api';
|
|
4
4
|
import { ContractsList } from 'src/shared/config';
|
5
5
|
import { useRequestStore } from 'src/entities/Request/model/stores';
|
6
6
|
import { IUpdateOneRequest } from 'src/entities/Request';
|
7
|
-
import { IDocument } from 'src/shared/lib/types/document';
|
8
7
|
import { MarketContract } from 'cooptypes';
|
8
|
+
import { fakeDocument } from 'src/shared/lib/document/model/const';
|
9
9
|
|
10
|
-
async function
|
10
|
+
async function confirmSupply(
|
11
11
|
params: IConfirmSupplyOnRequest
|
12
12
|
): Promise<TransactResult | undefined> {
|
13
|
-
//TODO получить подписанный
|
14
|
-
const document =
|
15
|
-
hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
16
|
-
public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
17
|
-
signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
18
|
-
meta: '',
|
19
|
-
} as IDocument;
|
13
|
+
//TODO здесь нужно получить подписанный документ (товарная накладная) и подставить
|
14
|
+
const document = fakeDocument;
|
20
15
|
|
21
16
|
const result = await transact({
|
22
17
|
account: ContractsList.Marketplace,
|
@@ -31,7 +26,7 @@ async function confirmSupplyOnRequest(
|
|
31
26
|
username: params.username,
|
32
27
|
coopname: params.coopname,
|
33
28
|
exchange_id: params.request_id,
|
34
|
-
document,
|
29
|
+
document: {...document, meta: JSON.stringify(document.meta)},
|
35
30
|
} as MarketContract.Actions.ConfirmSupply.IConfirmSupply,
|
36
31
|
});
|
37
32
|
|
@@ -45,5 +40,5 @@ async function confirmSupplyOnRequest(
|
|
45
40
|
}
|
46
41
|
|
47
42
|
export const api = {
|
48
|
-
|
43
|
+
confirmSupply,
|
49
44
|
};
|
@@ -24,7 +24,7 @@ q-btn(color="green" @click="supply") Подписать акт передачи
|
|
24
24
|
|
25
25
|
const supply = async () => {
|
26
26
|
try {
|
27
|
-
await api.
|
27
|
+
await api.confirmSupply({
|
28
28
|
coopname: props.coopname,
|
29
29
|
username: props.username,
|
30
30
|
request_id: props.requestId,
|
@@ -1,47 +1,52 @@
|
|
1
1
|
import { Mutations } from '@coopenomics/sdk';
|
2
|
-
import { useRequestStore } from 'src/entities/Request/model/stores';
|
3
|
-
import { api } from '../api';
|
4
|
-
import { client } from 'src/shared/api/client';
|
2
|
+
// import { useRequestStore } from 'src/entities/Request/model/stores';
|
3
|
+
// import { api } from '../api';
|
4
|
+
// import { client } from 'src/shared/api/client';
|
5
|
+
// import { DigitalDocument } from 'src/shared/lib/document';
|
6
|
+
// import type { Cooperative } from 'cooptypes';
|
5
7
|
|
6
8
|
export * from './types'
|
7
9
|
|
8
10
|
export function useCreateChildOrder() {
|
9
11
|
async function createChildOrder(
|
10
12
|
//TODO перевести id на хэши
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
11
14
|
data: Mutations.Cooplace.GenerateReturnByAssetStatement.IInput['data'] & {parent_id: number}
|
12
15
|
): Promise<Mutations.Cooplace.CreateChildOrder.IOutput[typeof Mutations.Cooplace.CreateChildOrder.name]> {
|
13
16
|
|
14
|
-
const returnByAssetStatement = await api.generateReturnByAssetStatement({
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
})
|
17
|
+
// const returnByAssetStatement = await api.generateReturnByAssetStatement({
|
18
|
+
// coopname: data.coopname,
|
19
|
+
// username: data.username,
|
20
|
+
// request: data.request,
|
21
|
+
// })
|
19
22
|
|
20
|
-
const document =
|
23
|
+
// const document = new DigitalDocument(returnByAssetStatement)
|
24
|
+
// const signedDocument = await document.sign<Cooperative.Registry.ReturnByAssetStatement.Meta>(data.username)
|
21
25
|
|
22
26
|
//TODO здесь же нужно передать распоряжение на использование средств цифрового кошелька
|
23
27
|
|
24
|
-
const result = await api.createChildOrder({
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
})
|
36
|
-
|
37
|
-
const requestsStore = useRequestStore();
|
38
|
-
requestsStore.loadUserChildOrders({
|
39
|
-
|
40
|
-
|
41
|
-
});
|
42
|
-
|
43
|
-
|
44
|
-
return result;
|
28
|
+
// const result = await api.createChildOrder({
|
29
|
+
// coopname: data.coopname,
|
30
|
+
// data: '',
|
31
|
+
// meta: '',
|
32
|
+
// parent_id: data.parent_id,
|
33
|
+
// product_lifecycle_secs: 0,
|
34
|
+
// program_id: data.request.program_id,
|
35
|
+
// unit_cost: data.request.unit_cost,
|
36
|
+
// units: data.request.units,
|
37
|
+
// username: data.username,
|
38
|
+
// document: signedDocument,
|
39
|
+
// })
|
40
|
+
|
41
|
+
// const requestsStore = useRequestStore();
|
42
|
+
// requestsStore.loadUserChildOrders({
|
43
|
+
// coopname: data.coopname,
|
44
|
+
// username: data.username,
|
45
|
+
// });
|
46
|
+
|
47
|
+
|
48
|
+
// return result;
|
49
|
+
return {} as any
|
45
50
|
}
|
46
51
|
return { createChildOrder };
|
47
52
|
}
|