hl-core 0.0.10-beta.2 → 0.0.10-beta.21
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/api/base.api.ts +221 -195
- package/components/Complex/TextBlock.vue +2 -0
- package/components/Dialog/Dialog.vue +7 -1
- package/components/Dialog/FamilyDialog.vue +2 -0
- package/components/Form/DigitalDocument.vue +52 -0
- package/components/Form/DynamicForm.vue +1 -0
- package/components/Form/FormData.vue +1 -0
- package/components/Form/ManagerAttachment.vue +2 -4
- package/components/Input/DynamicInput.vue +2 -0
- package/components/Input/FormInput.vue +2 -0
- package/components/Input/OtpInput.vue +25 -0
- package/components/Input/PanelInput.vue +1 -0
- package/components/Input/RoundedInput.vue +2 -0
- package/components/Input/RoundedSelect.vue +4 -0
- package/components/Input/SwitchInput.vue +2 -0
- package/components/Input/TextInput.vue +2 -0
- package/components/Layout/Drawer.vue +2 -0
- package/components/Pages/Anketa.vue +165 -166
- package/components/Pages/Auth.vue +2 -0
- package/components/Pages/ContragentForm.vue +1 -0
- package/components/Pages/Documents.vue +237 -6
- package/components/Pages/MemberForm.vue +204 -56
- package/components/Pages/ProductConditions.vue +153 -74
- package/components/Panel/PanelHandler.vue +231 -105
- package/components/Transitions/Animation.vue +2 -0
- package/components/Utilities/Chip.vue +2 -0
- package/components/Utilities/JsonViewer.vue +1 -2
- package/composables/classes.ts +102 -41
- package/composables/fields.ts +6 -4
- package/composables/index.ts +220 -7
- package/composables/styles.ts +8 -24
- package/configs/pwa.ts +1 -7
- package/locales/ru.json +11 -4
- package/nuxt.config.ts +10 -13
- package/package.json +13 -12
- package/plugins/head.ts +1 -1
- package/store/data.store.ts +235 -357
- package/store/member.store.ts +3 -2
- package/tsconfig.json +3 -0
- package/types/enum.ts +17 -2
- package/types/form.ts +71 -75
- package/types/index.ts +889 -877
package/store/data.store.ts
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
2
|
import { rules } from './rules';
|
|
3
3
|
import { i18n } from '../configs/i18n';
|
|
4
|
-
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
5
|
-
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
|
|
4
|
+
import { Toast, Types as ToastTypes, Positions, ToastOptions } from './toast';
|
|
5
|
+
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate, RoleController, ProcessController, sanitize } from '../composables';
|
|
6
6
|
import { DataStoreClass, DocumentItem, Member, Value, CountryValue, PolicyholderActivity, BeneficialOwner, PolicyholderClass } from '../composables/classes';
|
|
7
7
|
import { ApiClass } from '../api';
|
|
8
8
|
import { useFormStore } from './form.store';
|
|
9
9
|
import { AxiosError } from 'axios';
|
|
10
|
-
import { PostActions, StoreMembers,
|
|
10
|
+
import { PostActions, StoreMembers, MemberCodes, MemberAppCodes, CoreEnums } from '../types/enum';
|
|
11
|
+
import type * as Types from '../types';
|
|
11
12
|
//@ts-ignore
|
|
12
13
|
import { NCALayerClient } from 'ncalayer-js-client';
|
|
13
14
|
|
|
14
15
|
export const useDataStore = defineStore('data', {
|
|
15
16
|
state: () => ({
|
|
16
17
|
...new DataStoreClass(),
|
|
18
|
+
...new RoleController(),
|
|
19
|
+
...new ProcessController(),
|
|
17
20
|
t: i18n.t,
|
|
18
21
|
rules: rules,
|
|
19
22
|
toast: Toast,
|
|
20
|
-
toastTypes:
|
|
23
|
+
toastTypes: ToastTypes,
|
|
21
24
|
toastPositions: Positions,
|
|
25
|
+
sanitize: sanitize,
|
|
22
26
|
isValidGUID: isValidGUID,
|
|
23
27
|
router: useRouter(),
|
|
24
28
|
formStore: useFormStore(),
|
|
@@ -30,7 +34,7 @@ export const useDataStore = defineStore('data', {
|
|
|
30
34
|
showToaster: (type: 'success' | 'error' | 'warning' | 'info', msg: string, timeout?: number) =>
|
|
31
35
|
Toast.useToast()(msg, {
|
|
32
36
|
...ToastOptions,
|
|
33
|
-
type:
|
|
37
|
+
type: ToastTypes[type.toUpperCase() as keyof typeof ToastTypes],
|
|
34
38
|
timeout: type === 'error' ? 6000 : typeof timeout === 'number' ? timeout : ToastOptions.timeout,
|
|
35
39
|
}),
|
|
36
40
|
}),
|
|
@@ -159,22 +163,23 @@ export const useDataStore = defineStore('data', {
|
|
|
159
163
|
getUserRoles() {
|
|
160
164
|
if (this.accessToken && this.user.roles.length === 0) {
|
|
161
165
|
const decoded = jwtDecode(this.accessToken);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
if (decoded) {
|
|
167
|
+
this.user.id = String(decoded.sub);
|
|
168
|
+
this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
|
|
169
|
+
this.user.code = decoded.code;
|
|
170
|
+
this.user.branchCode = decoded.branchCode;
|
|
171
|
+
const key = getKeyWithPattern(decoded, 'role');
|
|
172
|
+
if (key) {
|
|
173
|
+
const roles = decoded[key as keyof Types.Utils.JwtToken];
|
|
174
|
+
if (typeof roles === 'string') {
|
|
175
|
+
this.user.roles.push(roles);
|
|
176
|
+
} else if (typeof roles === 'object') {
|
|
177
|
+
this.user.roles = roles;
|
|
178
|
+
}
|
|
171
179
|
}
|
|
172
180
|
}
|
|
173
181
|
}
|
|
174
182
|
},
|
|
175
|
-
getUserData() {
|
|
176
|
-
return this.accessToken ? jwtDecode(this.accessToken) : null;
|
|
177
|
-
},
|
|
178
183
|
async getUserGroups() {
|
|
179
184
|
try {
|
|
180
185
|
this.isLoading = true;
|
|
@@ -185,140 +190,17 @@ export const useDataStore = defineStore('data', {
|
|
|
185
190
|
this.isLoading = false;
|
|
186
191
|
}
|
|
187
192
|
},
|
|
188
|
-
isRole(whichRole: keyof typeof Roles) {
|
|
189
|
-
if (this.user.roles.length === 0) {
|
|
190
|
-
this.getUserRoles();
|
|
191
|
-
}
|
|
192
|
-
const isRole = this.user.roles.find(i => i === whichRole);
|
|
193
|
-
return !!isRole;
|
|
194
|
-
},
|
|
195
|
-
isInitiator() {
|
|
196
|
-
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager() || this.isAgentAuletti();
|
|
197
|
-
},
|
|
198
|
-
isManager() {
|
|
199
|
-
return this.isRole(constants.roles.Manager);
|
|
200
|
-
},
|
|
201
|
-
isCompliance() {
|
|
202
|
-
return this.isRole(constants.roles.Compliance);
|
|
203
|
-
},
|
|
204
|
-
isAdmin() {
|
|
205
|
-
return this.isRole(constants.roles.Admin);
|
|
206
|
-
},
|
|
207
|
-
isJurist() {
|
|
208
|
-
return this.isRole(constants.roles.Jurist);
|
|
209
|
-
},
|
|
210
|
-
isAgent() {
|
|
211
|
-
return this.isRole(constants.roles.Agent);
|
|
212
|
-
},
|
|
213
|
-
isManagerHalykBank() {
|
|
214
|
-
return this.isRole(constants.roles.ManagerHalykBank);
|
|
215
|
-
},
|
|
216
|
-
isServiceManager() {
|
|
217
|
-
return this.isRole(constants.roles.ServiceManager);
|
|
218
|
-
},
|
|
219
|
-
isUnderwriter() {
|
|
220
|
-
return this.isRole(constants.roles.Underwriter);
|
|
221
|
-
},
|
|
222
|
-
isActuary() {
|
|
223
|
-
return this.isRole(constants.roles.Actuary);
|
|
224
|
-
},
|
|
225
|
-
isAgentMycar() {
|
|
226
|
-
return this.isRole(constants.roles.AgentMycar);
|
|
227
|
-
},
|
|
228
|
-
isAgentAuletti() {
|
|
229
|
-
return this.isRole(constants.roles.AgentAuletti);
|
|
230
|
-
},
|
|
231
|
-
isAnalyst() {
|
|
232
|
-
return this.isRole(constants.roles.Analyst);
|
|
233
|
-
},
|
|
234
|
-
isUpk() {
|
|
235
|
-
return this.isRole(constants.roles.UPK);
|
|
236
|
-
},
|
|
237
|
-
isUrp() {
|
|
238
|
-
return this.isRole(constants.roles.URP);
|
|
239
|
-
},
|
|
240
|
-
isUsns() {
|
|
241
|
-
return this.isRole(constants.roles.USNS);
|
|
242
|
-
},
|
|
243
|
-
isAccountant() {
|
|
244
|
-
return this.isRole(constants.roles.Accountant);
|
|
245
|
-
},
|
|
246
|
-
isDrn() {
|
|
247
|
-
return this.isRole(constants.roles.DRNSJ);
|
|
248
|
-
},
|
|
249
|
-
isSupport() {
|
|
250
|
-
return this.isRole(constants.roles.Support);
|
|
251
|
-
},
|
|
252
|
-
isFinCenter() {
|
|
253
|
-
return this.isRole(constants.roles.FinCenter);
|
|
254
|
-
},
|
|
255
|
-
isSupervisor() {
|
|
256
|
-
return this.isRole(constants.roles.Supervisor);
|
|
257
|
-
},
|
|
258
|
-
isHeadManager() {
|
|
259
|
-
return this.isRole(constants.roles.HeadManager);
|
|
260
|
-
},
|
|
261
|
-
isBranchDirector() {
|
|
262
|
-
return this.isRole(constants.roles.BranchDirector);
|
|
263
|
-
},
|
|
264
|
-
isUSNSACCINS() {
|
|
265
|
-
return this.isRole(constants.roles.USNSACCINS);
|
|
266
|
-
},
|
|
267
|
-
isDsuio() {
|
|
268
|
-
return this.isRole(constants.roles.Dsuio);
|
|
269
|
-
},
|
|
270
|
-
isAdjuster() {
|
|
271
|
-
return this.isRole(constants.roles.Adjuster);
|
|
272
|
-
},
|
|
273
|
-
isDsoDirector() {
|
|
274
|
-
return this.isRole(constants.roles.DsoDirector);
|
|
275
|
-
},
|
|
276
|
-
isAccountantDirector() {
|
|
277
|
-
return this.isRole(constants.roles.AccountantDirector);
|
|
278
|
-
},
|
|
279
|
-
isProcessEditable(statusCode?: keyof typeof Statuses) {
|
|
280
|
-
const getEditibleStatuses = () => {
|
|
281
|
-
const defaultStatuses = constants.editableStatuses;
|
|
282
|
-
return defaultStatuses;
|
|
283
|
-
};
|
|
284
|
-
return !!getEditibleStatuses().find(status => status === statusCode);
|
|
285
|
-
},
|
|
286
|
-
isProcessReturnable(statusCode?: keyof typeof Statuses) {
|
|
287
|
-
const getReturnableStatuses = () => {
|
|
288
|
-
const defaultStatuses = constants.returnStatementStatuses;
|
|
289
|
-
return defaultStatuses;
|
|
290
|
-
};
|
|
291
|
-
return !!getReturnableStatuses().find(status => status === statusCode);
|
|
292
|
-
},
|
|
293
|
-
isProcessCancel(statusCode?: keyof typeof Statuses) {
|
|
294
|
-
const getCanceleStatuses = () => {
|
|
295
|
-
const defaultStatuses = constants.cancelApplicationStatuses;
|
|
296
|
-
return defaultStatuses;
|
|
297
|
-
};
|
|
298
|
-
return !!getCanceleStatuses().find(status => status === statusCode);
|
|
299
|
-
},
|
|
300
|
-
isProcessReject(statusCode?: keyof typeof Statuses) {
|
|
301
|
-
const getRejectStatuses = () => {
|
|
302
|
-
const defaultStatuses = constants.rejectApplicationStatuses;
|
|
303
|
-
return defaultStatuses;
|
|
304
|
-
};
|
|
305
|
-
return !!getRejectStatuses().find(status => status === statusCode);
|
|
306
|
-
},
|
|
307
193
|
isTask() {
|
|
308
194
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
309
195
|
},
|
|
310
196
|
validateAccess() {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return false;
|
|
319
|
-
} catch (err) {
|
|
320
|
-
return ErrorHandler(err);
|
|
321
|
-
}
|
|
197
|
+
const hasAccess = this.hasAccess();
|
|
198
|
+
if (this.isAML) return hasAccess.toAML;
|
|
199
|
+
if (this.isLKA) return hasAccess.toLKA;
|
|
200
|
+
if (this.isEFO) return hasAccess.toEFO;
|
|
201
|
+
if (this.isAULETTI) return hasAccess.toAULETTI;
|
|
202
|
+
if (this.isLKA_A) return hasAccess.toLKA_A;
|
|
203
|
+
return false;
|
|
322
204
|
},
|
|
323
205
|
async loginUser(login: string, password: string, numAttempt: number) {
|
|
324
206
|
try {
|
|
@@ -383,7 +265,7 @@ export const useDataStore = defineStore('data', {
|
|
|
383
265
|
return false;
|
|
384
266
|
}
|
|
385
267
|
},
|
|
386
|
-
async resetSelected(route: RouteType) {
|
|
268
|
+
async resetSelected(route: Types.RouteType) {
|
|
387
269
|
this.settings.open = false;
|
|
388
270
|
this.rightPanel.open = false;
|
|
389
271
|
this.panel.open = false;
|
|
@@ -397,7 +279,7 @@ export const useDataStore = defineStore('data', {
|
|
|
397
279
|
if (!file.id) return;
|
|
398
280
|
try {
|
|
399
281
|
this.isLoading = true;
|
|
400
|
-
await this.api.getFile(file.id).then((response: any) => {
|
|
282
|
+
await this.api.file.getFile(file.id).then((response: any) => {
|
|
401
283
|
if (!['pdf', 'docx'].includes(fileType)) {
|
|
402
284
|
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
403
285
|
const url = window.URL.createObjectURL(blob);
|
|
@@ -438,7 +320,7 @@ export const useDataStore = defineStore('data', {
|
|
|
438
320
|
},
|
|
439
321
|
async deleteFile(data: DocumentItem) {
|
|
440
322
|
try {
|
|
441
|
-
await this.api.deleteFile(data);
|
|
323
|
+
await this.api.file.deleteFile(data);
|
|
442
324
|
this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
|
|
443
325
|
} catch (err) {
|
|
444
326
|
ErrorHandler(err);
|
|
@@ -447,7 +329,7 @@ export const useDataStore = defineStore('data', {
|
|
|
447
329
|
async uploadFiles(data: FormData, load: boolean = false) {
|
|
448
330
|
this.isLoading = load;
|
|
449
331
|
try {
|
|
450
|
-
await this.api.uploadFiles(data);
|
|
332
|
+
await this.api.file.uploadFiles(data);
|
|
451
333
|
return true;
|
|
452
334
|
} catch (err) {
|
|
453
335
|
return ErrorHandler(err);
|
|
@@ -457,14 +339,23 @@ export const useDataStore = defineStore('data', {
|
|
|
457
339
|
},
|
|
458
340
|
async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
|
|
459
341
|
this.isLoading = load;
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
342
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
343
|
+
if (!member.iin || (isNonResident && (!member.firstName || !member.lastName))) return;
|
|
344
|
+
try {
|
|
345
|
+
const queryData = isNonResident
|
|
346
|
+
? {
|
|
347
|
+
firstName: member.firstName ?? '',
|
|
348
|
+
lastName: member.lastName ?? '',
|
|
349
|
+
middleName: member.middleName ?? '',
|
|
350
|
+
iin: member.iin ? member.iin.replace(/-/g, '') : '',
|
|
351
|
+
birthDate: member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
352
|
+
}
|
|
353
|
+
: {
|
|
354
|
+
firstName: '',
|
|
355
|
+
lastName: '',
|
|
356
|
+
middleName: '',
|
|
357
|
+
iin: member.iin ? member.iin.replace(/-/g, '') : '',
|
|
358
|
+
};
|
|
468
359
|
const contragentResponse = await this.api.getContragent(queryData);
|
|
469
360
|
if (contragentResponse.totalItems > 0) {
|
|
470
361
|
if (contragentResponse.items.length === 1) {
|
|
@@ -473,12 +364,13 @@ export const useDataStore = defineStore('data', {
|
|
|
473
364
|
const sortedByRegistrationDate = contragentResponse.items.sort(
|
|
474
365
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
475
366
|
);
|
|
476
|
-
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
367
|
+
if (!isNonResident) await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
477
368
|
}
|
|
478
369
|
member.gotFromInsis = true;
|
|
479
370
|
} else {
|
|
480
371
|
if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
481
372
|
}
|
|
373
|
+
if (isNonResident) return contragentResponse;
|
|
482
374
|
} catch (err) {
|
|
483
375
|
ErrorHandler(err);
|
|
484
376
|
}
|
|
@@ -488,7 +380,7 @@ export const useDataStore = defineStore('data', {
|
|
|
488
380
|
if (Number(id) === 0) return;
|
|
489
381
|
this.isLoading = load;
|
|
490
382
|
try {
|
|
491
|
-
const member = whichIndex === null ? this.formStore[whichForm as SingleMember] : this.formStore[whichForm as MultipleMember][whichIndex];
|
|
383
|
+
const member = whichIndex === null ? this.formStore[whichForm as Types.SingleMember] : this.formStore[whichForm as Types.MultipleMember][whichIndex];
|
|
492
384
|
const contragentResponse = await this.api.getContragentById(id);
|
|
493
385
|
if (contragentResponse.totalItems > 0) {
|
|
494
386
|
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
@@ -501,7 +393,7 @@ export const useDataStore = defineStore('data', {
|
|
|
501
393
|
this.isLoading = false;
|
|
502
394
|
}
|
|
503
395
|
},
|
|
504
|
-
async serializeContragentData(member: Member, contragent: ContragentType) {
|
|
396
|
+
async serializeContragentData(member: Member, contragent: Types.ContragentType) {
|
|
505
397
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
506
398
|
this.api.getContrAgentData(contragent.id),
|
|
507
399
|
this.api.getContrAgentContacts(contragent.id),
|
|
@@ -533,7 +425,13 @@ export const useDataStore = defineStore('data', {
|
|
|
533
425
|
},
|
|
534
426
|
parseContragent(
|
|
535
427
|
member: Member,
|
|
536
|
-
user: {
|
|
428
|
+
user: {
|
|
429
|
+
personalData: Types.ContragentType;
|
|
430
|
+
data?: Types.ContragentQuestionaries[];
|
|
431
|
+
contacts?: Types.ContragentContacts[];
|
|
432
|
+
documents?: Types.ContragentDocuments[];
|
|
433
|
+
address?: Types.ContragentAddress[];
|
|
434
|
+
},
|
|
537
435
|
) {
|
|
538
436
|
member.verifyType = user.personalData.verifyType;
|
|
539
437
|
member.verifyDate = user.personalData.verifyDate;
|
|
@@ -556,7 +454,7 @@ export const useDataStore = defineStore('data', {
|
|
|
556
454
|
|
|
557
455
|
if ('documents' in user && user.documents && user.documents.length) {
|
|
558
456
|
member.documentsList = user.documents;
|
|
559
|
-
const documentByPriority = user.documents.find(i => i.type ===
|
|
457
|
+
const documentByPriority = user.documents.find(i => i.type === CoreEnums.Insis.DocTypes['1UDL']);
|
|
560
458
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
561
459
|
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
562
460
|
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
@@ -615,7 +513,7 @@ export const useDataStore = defineStore('data', {
|
|
|
615
513
|
});
|
|
616
514
|
}
|
|
617
515
|
},
|
|
618
|
-
searchFromList(member: Member, searchIt: ContragentQuestionaries) {
|
|
516
|
+
searchFromList(member: Member, searchIt: Types.ContragentQuestionaries) {
|
|
619
517
|
const getQuestionariesData = () => {
|
|
620
518
|
switch (searchIt.questId) {
|
|
621
519
|
case '500003':
|
|
@@ -638,17 +536,19 @@ export const useDataStore = defineStore('data', {
|
|
|
638
536
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
639
537
|
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
640
538
|
//@ts-ignore
|
|
641
|
-
member[qData.field] = qResult
|
|
539
|
+
member[qData.field] = qResult ?? new Value();
|
|
642
540
|
}
|
|
643
541
|
},
|
|
644
542
|
async alreadyInInsis(member: Member) {
|
|
645
|
-
|
|
543
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
544
|
+
if (!member.iin || (isNonResident && (!member.firstName || !member.lastName))) return;
|
|
646
545
|
try {
|
|
647
546
|
const queryData = {
|
|
648
|
-
iin: member.iin.replaceAll('-', ''),
|
|
547
|
+
iin: !!member.iin ? member.iin.replaceAll('-', '') : '',
|
|
649
548
|
firstName: !!member.firstName ? member.firstName : '',
|
|
650
549
|
lastName: !!member.lastName ? member.lastName : '',
|
|
651
550
|
middleName: !!member.middleName ? member.middleName : '',
|
|
551
|
+
birthDate: !!member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
652
552
|
};
|
|
653
553
|
const contragent = await this.api.getContragent(queryData);
|
|
654
554
|
if (contragent.totalItems > 0) {
|
|
@@ -723,7 +623,7 @@ export const useDataStore = defineStore('data', {
|
|
|
723
623
|
}
|
|
724
624
|
}
|
|
725
625
|
try {
|
|
726
|
-
const contragentData: ContragentType = {
|
|
626
|
+
const contragentData: Types.ContragentType = {
|
|
727
627
|
id: Number(user.id),
|
|
728
628
|
type: Number(user.type),
|
|
729
629
|
iin: user.iin!.replace(/-/g, ''),
|
|
@@ -753,7 +653,7 @@ export const useDataStore = defineStore('data', {
|
|
|
753
653
|
countryOfTaxResidency,
|
|
754
654
|
signOfResidency,
|
|
755
655
|
}))(user);
|
|
756
|
-
const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
656
|
+
const questionariesData: Types.ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
757
657
|
let questName = '';
|
|
758
658
|
let questionId = parseInt(question.ids as string).toString();
|
|
759
659
|
if (questionId === '500003') {
|
|
@@ -821,7 +721,7 @@ export const useDataStore = defineStore('data', {
|
|
|
821
721
|
}
|
|
822
722
|
|
|
823
723
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
824
|
-
const contactsData: ContragentContacts[] = [];
|
|
724
|
+
const contactsData: Types.ContragentContacts[] = [];
|
|
825
725
|
if (!!user.phoneNumber) {
|
|
826
726
|
contactsData.push({
|
|
827
727
|
contragentId: Number(user.id),
|
|
@@ -863,7 +763,7 @@ export const useDataStore = defineStore('data', {
|
|
|
863
763
|
|
|
864
764
|
const documentsData = user.documentsList;
|
|
865
765
|
const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
|
|
866
|
-
const userDocument: ContragentDocuments = {
|
|
766
|
+
const userDocument: Types.ContragentDocuments = {
|
|
867
767
|
contragentId: Number(user.id),
|
|
868
768
|
id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
|
|
869
769
|
description: null,
|
|
@@ -888,7 +788,7 @@ export const useDataStore = defineStore('data', {
|
|
|
888
788
|
|
|
889
789
|
const checkForNull = (value: any) => (value ? value : '');
|
|
890
790
|
const userResponseAddress = 'response' in user && user.response && 'addresses' in user.response && user.response.addresses ? user.response.addresses : null;
|
|
891
|
-
const addressData: ContragentAddress[] = [];
|
|
791
|
+
const addressData: Types.ContragentAddress[] = [];
|
|
892
792
|
addressData.push({
|
|
893
793
|
id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
|
|
894
794
|
contragentId: Number(user.id),
|
|
@@ -1085,8 +985,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1085
985
|
},
|
|
1086
986
|
getConditionsData() {
|
|
1087
987
|
const conditionsData: {
|
|
1088
|
-
policyAppDto: PolicyAppDto;
|
|
1089
|
-
addCoversDto: AddCover[];
|
|
988
|
+
policyAppDto: Types.PolicyAppDto;
|
|
989
|
+
addCoversDto: Types.AddCover[];
|
|
1090
990
|
} = {
|
|
1091
991
|
policyAppDto: {
|
|
1092
992
|
id: this.formStore.applicationData?.policyAppDto?.id,
|
|
@@ -1214,7 +1114,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1214
1114
|
}
|
|
1215
1115
|
return this.formStore.definedAnswersId[whichSurvey];
|
|
1216
1116
|
},
|
|
1217
|
-
async setSurvey(data: AnketaFirst) {
|
|
1117
|
+
async setSurvey(data: Types.AnketaFirst) {
|
|
1218
1118
|
try {
|
|
1219
1119
|
this.isLoading = true;
|
|
1220
1120
|
const anketaToken = await this.api.setSurvey(data);
|
|
@@ -1228,7 +1128,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1228
1128
|
},
|
|
1229
1129
|
async setINSISWorkData(loading: boolean = true) {
|
|
1230
1130
|
if (!this.formStore.applicationData.insisWorkDataApp) return;
|
|
1231
|
-
const data: InsisWorkDataApp = {
|
|
1131
|
+
const data: Types.InsisWorkDataApp = {
|
|
1232
1132
|
id: this.formStore.applicationData.insisWorkDataApp.id,
|
|
1233
1133
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
1234
1134
|
agentId: Number(this.formStore.AgentData.agentId),
|
|
@@ -1658,7 +1558,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1658
1558
|
column: column,
|
|
1659
1559
|
direction: direction,
|
|
1660
1560
|
groupCode: groupCode,
|
|
1661
|
-
processCodes: Object.values(constants.products),
|
|
1561
|
+
processCodes: this.isEFO ? Object.values(constants.products) : [constants.products.baiterek],
|
|
1662
1562
|
};
|
|
1663
1563
|
if (byOneProcess !== null) {
|
|
1664
1564
|
delete query.processCodes;
|
|
@@ -1872,7 +1772,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1872
1772
|
return;
|
|
1873
1773
|
}
|
|
1874
1774
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1875
|
-
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1775
|
+
const calculationData: Types.RecalculationDataType & Types.PolicyAppDto = {
|
|
1876
1776
|
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1877
1777
|
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1878
1778
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
@@ -2018,7 +1918,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2018
1918
|
async calculatePrice(taskId?: string) {
|
|
2019
1919
|
this.isLoading = true;
|
|
2020
1920
|
try {
|
|
2021
|
-
const priceForm: SetApplicationRequest = {};
|
|
1921
|
+
const priceForm: Types.SetApplicationRequest = {};
|
|
2022
1922
|
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
2023
1923
|
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
2024
1924
|
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
@@ -2065,7 +1965,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2065
1965
|
async startApplication(member: Member, processCode?: number) {
|
|
2066
1966
|
if (!member.iin) return false;
|
|
2067
1967
|
try {
|
|
2068
|
-
const data: StartApplicationType = {
|
|
1968
|
+
const data: Types.StartApplicationType = {
|
|
2069
1969
|
clientId: member.id,
|
|
2070
1970
|
iin: member.iin.replace(/-/g, ''),
|
|
2071
1971
|
longName: member.longName ?? '',
|
|
@@ -2182,11 +2082,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2182
2082
|
index: null,
|
|
2183
2083
|
});
|
|
2184
2084
|
}
|
|
2185
|
-
|
|
2186
|
-
if (applicationData.slave) {
|
|
2187
|
-
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
2085
|
if (insuredData && insuredData.length) {
|
|
2191
2086
|
insuredData.forEach((member, index) => {
|
|
2192
2087
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -2356,7 +2251,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2356
2251
|
async deleteTask(taskId: string) {
|
|
2357
2252
|
this.isLoading = true;
|
|
2358
2253
|
try {
|
|
2359
|
-
const data: SendTask = {
|
|
2254
|
+
const data: Types.SendTask = {
|
|
2360
2255
|
taskId: taskId,
|
|
2361
2256
|
decision: 'rejectclient',
|
|
2362
2257
|
comment: 'Клиент отказался',
|
|
@@ -2480,7 +2375,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2480
2375
|
console.log(err);
|
|
2481
2376
|
}
|
|
2482
2377
|
},
|
|
2483
|
-
setMembersField(whichForm: SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2378
|
+
setMembersField(whichForm: Types.SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2484
2379
|
this.formStore[whichForm].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember].familyStatusId);
|
|
2485
2380
|
this.formStore[whichForm].signOfIPDL = this.findObject(
|
|
2486
2381
|
'ipdl',
|
|
@@ -2507,7 +2402,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2507
2402
|
this.formStore.applicationData.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2508
2403
|
}
|
|
2509
2404
|
},
|
|
2510
|
-
setMembersFieldIndex(whichForm: MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
2405
|
+
setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
2511
2406
|
if ('familyStatus' in this.formStore[whichForm][index]) {
|
|
2512
2407
|
this.formStore[whichForm][index].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember][index].familyStatusId);
|
|
2513
2408
|
}
|
|
@@ -2543,7 +2438,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2543
2438
|
if (this.formStore.signUrls.length) {
|
|
2544
2439
|
return this.formStore.signUrls;
|
|
2545
2440
|
}
|
|
2546
|
-
const prepareSignDocuments = (): SignDataType[] => {
|
|
2441
|
+
const prepareSignDocuments = (): Types.SignDataType[] => {
|
|
2547
2442
|
switch (this.formStore.applicationData.statusCode) {
|
|
2548
2443
|
case 'ContractSignedFrom':
|
|
2549
2444
|
return [
|
|
@@ -2601,94 +2496,17 @@ export const useDataStore = defineStore('data', {
|
|
|
2601
2496
|
};
|
|
2602
2497
|
const data = prepareSignDocuments();
|
|
2603
2498
|
if (type === 'qr') {
|
|
2604
|
-
const groupId = await this.api.signQR(data);
|
|
2499
|
+
const groupId = await this.api.file.signQR(data);
|
|
2605
2500
|
return groupId;
|
|
2606
2501
|
} else if (type === 'qrXml') {
|
|
2607
|
-
const signData = await this.api.signXml(data);
|
|
2502
|
+
const signData = await this.api.file.signXml(data);
|
|
2608
2503
|
return signData;
|
|
2609
|
-
} else if (type === 'signature') {
|
|
2610
|
-
const ncaLayerClient = new NCALayerClient();
|
|
2611
|
-
const formTemplate = new FormData();
|
|
2612
|
-
formTemplate.append('format', 'pdf');
|
|
2613
|
-
formTemplate.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2614
|
-
let activeTokens;
|
|
2615
|
-
try {
|
|
2616
|
-
await ncaLayerClient.connect();
|
|
2617
|
-
activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2618
|
-
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2619
|
-
if (this.formStore.applicationData.statusCode === 'ContractSignedFrom') {
|
|
2620
|
-
const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
|
|
2621
|
-
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2622
|
-
const formData = formTemplate;
|
|
2623
|
-
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2624
|
-
formData.append('name', 'PA_Contract');
|
|
2625
|
-
try {
|
|
2626
|
-
await this.api.uploadDigitalCertifijcate(formData);
|
|
2627
|
-
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2628
|
-
} catch (e) {
|
|
2629
|
-
this.showToaster('error', String(e));
|
|
2630
|
-
return;
|
|
2631
|
-
}
|
|
2632
|
-
} else if (this.formStore.applicationData.statusCode === 'HeadManagerForm') {
|
|
2633
|
-
const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
|
|
2634
|
-
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2635
|
-
const formData = formTemplate;
|
|
2636
|
-
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2637
|
-
formData.append('name', 'PA_Contract');
|
|
2638
|
-
try {
|
|
2639
|
-
await this.api.uploadDigitalCertificatePensionAnnuityNew(formData);
|
|
2640
|
-
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2641
|
-
} catch (e) {
|
|
2642
|
-
this.showToaster('error', String(e));
|
|
2643
|
-
return;
|
|
2644
|
-
}
|
|
2645
|
-
} else {
|
|
2646
|
-
if (!!this.formStore.signedDocumentList.find(i => i.fileTypeCode === '43')?.signed) {
|
|
2647
|
-
const statement = await this.generatePDFDocument('PA_Statement', '37', 'pdf');
|
|
2648
|
-
const statementSignature = await ncaLayerClient.basicsSignCMS(storageType, statement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2649
|
-
const statementData = formTemplate;
|
|
2650
|
-
statementData.append('base64EncodedSignature', statementSignature);
|
|
2651
|
-
statementData.append('name', 'PA_Statement');
|
|
2652
|
-
await this.api.uploadDigitalCertifijcate(statementData);
|
|
2653
|
-
const agreement = await this.generatePDFDocument('Agreement', '19', 'pdf');
|
|
2654
|
-
const agreementSignature = await ncaLayerClient.basicsSignCMS(storageType, agreement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2655
|
-
const agreementData = formTemplate;
|
|
2656
|
-
agreementData.append('base64EncodedSignature', agreementSignature);
|
|
2657
|
-
agreementData.append('name', 'Agreement');
|
|
2658
|
-
await this.api.uploadDigitalCertifijcate(agreementData);
|
|
2659
|
-
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2660
|
-
} else {
|
|
2661
|
-
const document = {
|
|
2662
|
-
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2663
|
-
name: 'PAEnpf_Agreement',
|
|
2664
|
-
format: 'xml',
|
|
2665
|
-
};
|
|
2666
|
-
const signData = await this.api.signXml([document]);
|
|
2667
|
-
const agreementXml = await this.api.getDocumentsByEdsXmlId(signData.data);
|
|
2668
|
-
const wnd = window.open('about:blank', '', '_blank');
|
|
2669
|
-
wnd?.document.write(agreementXml.data.document.documentXml);
|
|
2670
|
-
const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml.data.document.documentXml, 'SIGNATURE', '');
|
|
2671
|
-
const data = new FormData();
|
|
2672
|
-
data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2673
|
-
data.append('xmlData', signedAgreement);
|
|
2674
|
-
data.append('name', 'PAEnpf_Agreement');
|
|
2675
|
-
data.append('format', 'xml');
|
|
2676
|
-
data.append('EdsXmlId', signData.data);
|
|
2677
|
-
await this.api.uploadXml(data);
|
|
2678
|
-
await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
|
|
2679
|
-
this.showToaster('success', this.t('pension.consentGiven'), 3000);
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
} catch (error) {
|
|
2683
|
-
this.showToaster('error', String(error));
|
|
2684
|
-
return;
|
|
2685
|
-
}
|
|
2686
2504
|
} else {
|
|
2687
2505
|
if (this.processCode === 19 || this.processCode === 2 || this.processCode === 4) {
|
|
2688
|
-
const result = await this.api.signBts(data);
|
|
2506
|
+
const result = await this.api.file.signBts(data);
|
|
2689
2507
|
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2690
2508
|
} else {
|
|
2691
|
-
const result = await this.api.signDocument(data);
|
|
2509
|
+
const result = await this.api.file.signDocument(data);
|
|
2692
2510
|
this.formStore.signUrls = result;
|
|
2693
2511
|
}
|
|
2694
2512
|
return this.formStore.signUrls;
|
|
@@ -2697,6 +2515,84 @@ export const useDataStore = defineStore('data', {
|
|
|
2697
2515
|
ErrorHandler(err);
|
|
2698
2516
|
}
|
|
2699
2517
|
},
|
|
2518
|
+
async nclayerSign(groupId: string, signType: number, isXml: boolean = false) {
|
|
2519
|
+
try {
|
|
2520
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2521
|
+
await ncaLayerClient.connect();
|
|
2522
|
+
const activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2523
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2524
|
+
const document = await this.getFileNew(groupId, signType, isXml);
|
|
2525
|
+
if (isXml) {
|
|
2526
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, document, 'SIGNATURE', '');
|
|
2527
|
+
const data = new FormData();
|
|
2528
|
+
data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2529
|
+
data.append('xmlData', signedAgreement);
|
|
2530
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2531
|
+
data.append('format', 'xml');
|
|
2532
|
+
data.append('EdsXmlId', groupId);
|
|
2533
|
+
await this.api.file.uploadXml(data);
|
|
2534
|
+
} else {
|
|
2535
|
+
const base64EncodedSignature = await ncaLayerClient.createCAdESFromBase64(storageType, document, 'SIGNATURE', true);
|
|
2536
|
+
await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
|
|
2537
|
+
}
|
|
2538
|
+
return true;
|
|
2539
|
+
} catch (err) {
|
|
2540
|
+
ErrorHandler(err);
|
|
2541
|
+
return false;
|
|
2542
|
+
}
|
|
2543
|
+
},
|
|
2544
|
+
async getFileNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
|
|
2545
|
+
try {
|
|
2546
|
+
let response: any = await this.api.file.generalGetFile(groupId, xml ? 5 : documentSignType);
|
|
2547
|
+
let blob;
|
|
2548
|
+
if (response.hasOwnProperty('data')) {
|
|
2549
|
+
const document = JSON.parse(response.data).Document;
|
|
2550
|
+
blob = new Blob([document.documentXml], {
|
|
2551
|
+
type: `application/xml`,
|
|
2552
|
+
});
|
|
2553
|
+
response = document.documentXml;
|
|
2554
|
+
} else {
|
|
2555
|
+
blob = new Blob([response], {
|
|
2556
|
+
type: `application/pdf`,
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
const url = window.URL.createObjectURL(blob);
|
|
2560
|
+
if (!xml) {
|
|
2561
|
+
const link = document.createElement('a');
|
|
2562
|
+
link.href = url;
|
|
2563
|
+
link.setAttribute('download', fileName ?? `Документ ПА`);
|
|
2564
|
+
document.body.appendChild(link);
|
|
2565
|
+
link.click();
|
|
2566
|
+
}
|
|
2567
|
+
window.open(url, '_blank', `right=100`);
|
|
2568
|
+
return response;
|
|
2569
|
+
} catch (err) {
|
|
2570
|
+
ErrorHandler(err);
|
|
2571
|
+
}
|
|
2572
|
+
},
|
|
2573
|
+
async generateSign(taskId: string) {
|
|
2574
|
+
try {
|
|
2575
|
+
const signatories = await this.api.file.generateSign({ taskId });
|
|
2576
|
+
if (Array.isArray(signatories)) {
|
|
2577
|
+
signatories.forEach(signatory =>
|
|
2578
|
+
signatory.fileDatas?.sort(function (a: any, b: any) {
|
|
2579
|
+
return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
|
|
2580
|
+
}),
|
|
2581
|
+
);
|
|
2582
|
+
this.formStore.signatories = signatories;
|
|
2583
|
+
}
|
|
2584
|
+
} catch (err) {
|
|
2585
|
+
ErrorHandler(err);
|
|
2586
|
+
}
|
|
2587
|
+
},
|
|
2588
|
+
async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
|
|
2589
|
+
try {
|
|
2590
|
+
const response = await this.api.file.generalSign(data);
|
|
2591
|
+
return response;
|
|
2592
|
+
} catch (err) {
|
|
2593
|
+
ErrorHandler(err);
|
|
2594
|
+
}
|
|
2595
|
+
},
|
|
2700
2596
|
async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
|
|
2701
2597
|
try {
|
|
2702
2598
|
this.isButtonsLoading = true;
|
|
@@ -2758,12 +2654,12 @@ export const useDataStore = defineStore('data', {
|
|
|
2758
2654
|
try {
|
|
2759
2655
|
this.isButtonsLoading = true;
|
|
2760
2656
|
this.formStore.needToScanSignedContract = true;
|
|
2761
|
-
const data: SignDataType = {
|
|
2657
|
+
const data: Types.SignDataType = {
|
|
2762
2658
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2763
2659
|
name: 'Contract',
|
|
2764
2660
|
format: 'pdf',
|
|
2765
2661
|
};
|
|
2766
|
-
const response: any = await this.api.generateDocument(data);
|
|
2662
|
+
const response: any = await this.api.file.generateDocument(data);
|
|
2767
2663
|
const blob = new Blob([response], {
|
|
2768
2664
|
type: `application/pdf`,
|
|
2769
2665
|
});
|
|
@@ -2814,7 +2710,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2814
2710
|
const formattedData = formatDate(this.formStore.finCenterData.date);
|
|
2815
2711
|
if (!formattedData) return;
|
|
2816
2712
|
this.isLoading = true;
|
|
2817
|
-
const data: RegNumberDataType = {
|
|
2713
|
+
const data: Types.RegNumberDataType = {
|
|
2818
2714
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2819
2715
|
regNumber: String(this.formStore.finCenterData.regNumber),
|
|
2820
2716
|
date: formattedData.toISOString(),
|
|
@@ -2829,7 +2725,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2829
2725
|
},
|
|
2830
2726
|
async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
|
|
2831
2727
|
if (!type || !phoneNumber || !text) return;
|
|
2832
|
-
const smsData: SmsDataType = {
|
|
2728
|
+
const smsData: Types.SmsDataType = {
|
|
2833
2729
|
iin: this.formStore.applicationData.clientApp.iin,
|
|
2834
2730
|
phoneNumber: formatPhone(phoneNumber),
|
|
2835
2731
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
@@ -2846,16 +2742,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2846
2742
|
this.isLoading = false;
|
|
2847
2743
|
}
|
|
2848
2744
|
},
|
|
2849
|
-
sanitize(text: string) {
|
|
2850
|
-
return text
|
|
2851
|
-
.replace(/\r?\n|\r/g, '')
|
|
2852
|
-
.replace(/\\/g, '')
|
|
2853
|
-
.replace(/"/g, '');
|
|
2854
|
-
},
|
|
2855
2745
|
async getSignedDocList(processInstanceId: string | number) {
|
|
2856
2746
|
if (processInstanceId !== 0) {
|
|
2857
2747
|
try {
|
|
2858
|
-
this.formStore.signedDocumentList = await this.api.getSignedDocList({
|
|
2748
|
+
this.formStore.signedDocumentList = await this.api.file.getSignedDocList({
|
|
2859
2749
|
processInstanceId: processInstanceId,
|
|
2860
2750
|
});
|
|
2861
2751
|
} catch (err) {
|
|
@@ -2895,7 +2785,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2895
2785
|
}
|
|
2896
2786
|
this.isLoading = false;
|
|
2897
2787
|
},
|
|
2898
|
-
async getValidateClientESBD(data: ESBDValidationType) {
|
|
2788
|
+
async getValidateClientESBD(data: Types.ESBDValidationType) {
|
|
2899
2789
|
try {
|
|
2900
2790
|
return await this.api.getValidateClientESBD(data);
|
|
2901
2791
|
} catch (err) {
|
|
@@ -2903,7 +2793,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2903
2793
|
return ErrorHandler(err);
|
|
2904
2794
|
}
|
|
2905
2795
|
},
|
|
2906
|
-
validateMultipleMembers(localKey: MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2796
|
+
validateMultipleMembers(localKey: Types.MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2907
2797
|
if (this.formStore[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
2908
2798
|
if (this.formStore[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
2909
2799
|
const localMembers = [...this.formStore[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
@@ -2940,6 +2830,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2940
2830
|
return true;
|
|
2941
2831
|
},
|
|
2942
2832
|
async validateAllMembers(taskId: string, localCheck: boolean = false) {
|
|
2833
|
+
const policyholderDoc = this.formStore.signedDocumentList.find(
|
|
2834
|
+
i => i.iin === String(this.formStore.policyholderForm.iin).replaceAll('-', '') && (i.fileTypeCode === '1' || i.fileTypeCode === '2'),
|
|
2835
|
+
);
|
|
2943
2836
|
if (taskId === '0') {
|
|
2944
2837
|
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
2945
2838
|
return false;
|
|
@@ -2948,6 +2841,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2948
2841
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
2949
2842
|
return false;
|
|
2950
2843
|
}
|
|
2844
|
+
if (this.isInitiator() && this.isEfoParent && this.formStore.policyholderForm.iin && !policyholderDoc) {
|
|
2845
|
+
this.showToaster('error', this.t('toaster.needDigDoc', { text: 'страхователя' }));
|
|
2846
|
+
return false;
|
|
2847
|
+
}
|
|
2951
2848
|
if (this.members.insuredApp.has) {
|
|
2952
2849
|
if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
|
|
2953
2850
|
return false;
|
|
@@ -3243,13 +3140,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3243
3140
|
if (!this.accessToken) return null;
|
|
3244
3141
|
try {
|
|
3245
3142
|
const decoded = jwtDecode(this.accessToken);
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3143
|
+
if (decoded) {
|
|
3144
|
+
const data = {
|
|
3145
|
+
userName: decoded.code,
|
|
3146
|
+
branchName: decoded.branchCode,
|
|
3147
|
+
bin: bin.replace(/-/g, ''),
|
|
3148
|
+
};
|
|
3149
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3150
|
+
return gbdulResponse;
|
|
3151
|
+
}
|
|
3152
|
+
return null;
|
|
3253
3153
|
} catch (err) {
|
|
3254
3154
|
return ErrorHandler(err);
|
|
3255
3155
|
}
|
|
@@ -3299,7 +3199,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3299
3199
|
this.isLoading = false;
|
|
3300
3200
|
return false;
|
|
3301
3201
|
}
|
|
3302
|
-
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Api.GBD.Person };
|
|
3202
|
+
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Types.Api.GBD.Person };
|
|
3303
3203
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
3304
3204
|
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
3305
3205
|
member.resetMember(false);
|
|
@@ -3316,7 +3216,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3316
3216
|
this.isLoading = false;
|
|
3317
3217
|
}
|
|
3318
3218
|
},
|
|
3319
|
-
async saveInStoreUserGBDFL(person: Api.GBD.Person, member: Member) {
|
|
3219
|
+
async saveInStoreUserGBDFL(person: Types.Api.GBD.Person, member: Member) {
|
|
3320
3220
|
member.firstName = person.name;
|
|
3321
3221
|
member.lastName = person.surname;
|
|
3322
3222
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
@@ -3408,14 +3308,15 @@ export const useDataStore = defineStore('data', {
|
|
|
3408
3308
|
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
3409
3309
|
|
|
3410
3310
|
if (Array.isArray(person.documents.document)) {
|
|
3411
|
-
const
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
);
|
|
3311
|
+
const filteredDocuments = person.documents.document.filter(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00');
|
|
3312
|
+
const validDocument =
|
|
3313
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes['1UDL']) ??
|
|
3314
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.VNZ) ??
|
|
3315
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS);
|
|
3417
3316
|
if (validDocument) {
|
|
3418
|
-
const documentType = this.documentTypes.find(
|
|
3317
|
+
const documentType = this.documentTypes.find(
|
|
3318
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(validDocument.type.code)],
|
|
3319
|
+
);
|
|
3419
3320
|
if (documentType) member.documentType = documentType;
|
|
3420
3321
|
if (validDocument.number) member.documentNumber = validDocument.number;
|
|
3421
3322
|
if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
|
|
@@ -3428,9 +3329,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3428
3329
|
if (
|
|
3429
3330
|
personDoc.status.code === '00' &&
|
|
3430
3331
|
new Date(personDoc.endDate) > new Date(Date.now()) &&
|
|
3431
|
-
(personDoc.type.code ===
|
|
3332
|
+
(personDoc.type.code === CoreEnums.GBD.DocTypes['1UDL'] || personDoc.type.code === CoreEnums.GBD.DocTypes.VNZ || personDoc.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3432
3333
|
) {
|
|
3433
|
-
const documentType = this.documentTypes.find(
|
|
3334
|
+
const documentType = this.documentTypes.find(
|
|
3335
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(personDoc.type.code)],
|
|
3336
|
+
);
|
|
3434
3337
|
if (documentType) member.documentType = documentType;
|
|
3435
3338
|
const documentNumber = personDoc.number;
|
|
3436
3339
|
if (documentNumber) member.documentNumber = documentNumber;
|
|
@@ -3478,7 +3381,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3478
3381
|
'clientData.authoritedPerson.economySectorCode',
|
|
3479
3382
|
'clientData.authoritedPerson.legalAddress',
|
|
3480
3383
|
'clientData.authoritedPerson.placeOfBirth',
|
|
3481
|
-
'clientData.authoritedPerson.resident',
|
|
3482
3384
|
'clientData.authoritedPerson.taxResidentCountry',
|
|
3483
3385
|
'clientData.authoritedPerson.addTaxResidency',
|
|
3484
3386
|
]);
|
|
@@ -3601,7 +3503,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3601
3503
|
}
|
|
3602
3504
|
this.isLoading = false;
|
|
3603
3505
|
},
|
|
3604
|
-
async saveAccidentIncidents(data: AccidentIncidents[]) {
|
|
3506
|
+
async saveAccidentIncidents(data: Types.AccidentIncidents[]) {
|
|
3605
3507
|
try {
|
|
3606
3508
|
const dataCopy = JSON.parse(JSON.stringify(data));
|
|
3607
3509
|
for (const incident of dataCopy) {
|
|
@@ -3795,6 +3697,33 @@ export const useDataStore = defineStore('data', {
|
|
|
3795
3697
|
|
|
3796
3698
|
return true;
|
|
3797
3699
|
},
|
|
3700
|
+
async onlineAccess(iin: string, documentType: string) {
|
|
3701
|
+
try {
|
|
3702
|
+
const data = {
|
|
3703
|
+
iinBin: iin.replaceAll('-', ''),
|
|
3704
|
+
documentType: documentType,
|
|
3705
|
+
};
|
|
3706
|
+
await this.api.externalServices.onlineAccess(data);
|
|
3707
|
+
return true;
|
|
3708
|
+
} catch (err) {
|
|
3709
|
+
ErrorHandler(err);
|
|
3710
|
+
return null;
|
|
3711
|
+
}
|
|
3712
|
+
},
|
|
3713
|
+
async digitalDocuments(iin: string, processInstanceId: string, code: string) {
|
|
3714
|
+
try {
|
|
3715
|
+
const data = {
|
|
3716
|
+
iin: iin.replaceAll('-', ''),
|
|
3717
|
+
processInstanceId: processInstanceId,
|
|
3718
|
+
code: code.replace(/\s/g, ''),
|
|
3719
|
+
};
|
|
3720
|
+
await this.api.externalServices.digitalDocuments(data);
|
|
3721
|
+
return true;
|
|
3722
|
+
} catch (err) {
|
|
3723
|
+
ErrorHandler(err);
|
|
3724
|
+
return null;
|
|
3725
|
+
}
|
|
3726
|
+
},
|
|
3798
3727
|
async getVariableData(processCode: number) {
|
|
3799
3728
|
try {
|
|
3800
3729
|
const response = await this.api.getVariableData(0, processCode);
|
|
@@ -3832,7 +3761,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3832
3761
|
return ErrorHandler(err);
|
|
3833
3762
|
}
|
|
3834
3763
|
},
|
|
3835
|
-
async generateShortLink(url: string, template?: Api.GenerateShortLink.Templates) {
|
|
3764
|
+
async generateShortLink(url: string, template?: Types.Api.GenerateShortLink.Templates) {
|
|
3836
3765
|
try {
|
|
3837
3766
|
const response = await this.api.generateShortLink({
|
|
3838
3767
|
link: url,
|
|
@@ -3856,7 +3785,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3856
3785
|
}
|
|
3857
3786
|
},
|
|
3858
3787
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
3859
|
-
if (this.
|
|
3788
|
+
if (this.isPension) return false;
|
|
3860
3789
|
switch (whichForm) {
|
|
3861
3790
|
case this.formStore.beneficiaryFormKey:
|
|
3862
3791
|
return false;
|
|
@@ -3864,18 +3793,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3864
3793
|
return true;
|
|
3865
3794
|
}
|
|
3866
3795
|
},
|
|
3867
|
-
hasPlaceSection(whichForm: keyof typeof StoreMembers) {
|
|
3868
|
-
switch (whichForm) {
|
|
3869
|
-
default:
|
|
3870
|
-
return true;
|
|
3871
|
-
}
|
|
3872
|
-
},
|
|
3873
|
-
hasDocumentSection(whichForm: keyof typeof StoreMembers) {
|
|
3874
|
-
switch (whichForm) {
|
|
3875
|
-
default:
|
|
3876
|
-
return true;
|
|
3877
|
-
}
|
|
3878
|
-
},
|
|
3879
3796
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
3880
3797
|
if (this.isGons || this.isPension) return false;
|
|
3881
3798
|
switch (whichForm) {
|
|
@@ -3912,44 +3829,5 @@ export const useDataStore = defineStore('data', {
|
|
|
3912
3829
|
return false;
|
|
3913
3830
|
}
|
|
3914
3831
|
},
|
|
3915
|
-
hasPercentageOfPayoutAmount() {
|
|
3916
|
-
return true;
|
|
3917
|
-
},
|
|
3918
|
-
hasAccess() {
|
|
3919
|
-
const baseAccessRoles = this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
|
|
3920
|
-
return {
|
|
3921
|
-
invoiceInfo: this.isAdmin(),
|
|
3922
|
-
toLKA: this.isAgent() || baseAccessRoles,
|
|
3923
|
-
toAML: this.isCompliance() || baseAccessRoles,
|
|
3924
|
-
toAULETTI: this.isAgentAuletti() || baseAccessRoles,
|
|
3925
|
-
toLKA_A: this.isAgentAuletti() || baseAccessRoles,
|
|
3926
|
-
toEFO:
|
|
3927
|
-
this.isManager() ||
|
|
3928
|
-
this.isAgent() ||
|
|
3929
|
-
this.isAgentMycar() ||
|
|
3930
|
-
this.isManagerHalykBank() ||
|
|
3931
|
-
this.isHeadManager() ||
|
|
3932
|
-
this.isServiceManager() ||
|
|
3933
|
-
this.isUnderwriter() ||
|
|
3934
|
-
this.isActuary() ||
|
|
3935
|
-
this.isAdmin() ||
|
|
3936
|
-
this.isCompliance() ||
|
|
3937
|
-
this.isAnalyst() ||
|
|
3938
|
-
this.isUpk() ||
|
|
3939
|
-
this.isFinCenter() ||
|
|
3940
|
-
this.isSupervisor() ||
|
|
3941
|
-
this.isSupport() ||
|
|
3942
|
-
this.isDrn() ||
|
|
3943
|
-
this.isUrp() ||
|
|
3944
|
-
this.isUsns() ||
|
|
3945
|
-
this.isAccountant() ||
|
|
3946
|
-
this.isBranchDirector() ||
|
|
3947
|
-
this.isUSNSACCINS() ||
|
|
3948
|
-
this.isDsuio() ||
|
|
3949
|
-
this.isAdjuster() ||
|
|
3950
|
-
this.isDsoDirector() ||
|
|
3951
|
-
this.isAccountantDirector(),
|
|
3952
|
-
};
|
|
3953
|
-
},
|
|
3954
3832
|
},
|
|
3955
3833
|
});
|