hl-core 0.0.9-beta.5 → 0.0.9-beta.51
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 +1042 -0
- package/api/index.ts +2 -620
- package/api/interceptors.ts +53 -14
- package/components/Button/Btn.vue +2 -2
- package/components/Complex/MessageBlock.vue +2 -2
- package/components/Complex/Page.vue +1 -1
- package/components/Dialog/Dialog.vue +60 -15
- package/components/Form/DynamicForm.vue +100 -0
- package/components/Form/FormBlock.vue +12 -3
- package/components/Form/FormData.vue +110 -0
- package/components/Form/FormSection.vue +3 -3
- package/components/Form/FormToggle.vue +25 -5
- package/components/Form/ManagerAttachment.vue +150 -86
- package/components/Form/ProductConditionsBlock.vue +59 -6
- package/components/Input/Datepicker.vue +43 -7
- package/components/Input/DynamicInput.vue +23 -0
- package/components/Input/FileInput.vue +25 -5
- package/components/Input/FormInput.vue +7 -4
- package/components/Input/Monthpicker.vue +34 -0
- package/components/Input/PanelInput.vue +5 -1
- package/components/Input/RoundedEmptyField.vue +5 -0
- package/components/Input/RoundedSelect.vue +18 -0
- package/components/Input/SwitchInput.vue +64 -0
- package/components/Input/TextInput.vue +160 -0
- package/components/Layout/Drawer.vue +17 -4
- package/components/Layout/Header.vue +23 -2
- package/components/Layout/Loader.vue +1 -1
- package/components/Layout/SettingsPanel.vue +13 -7
- package/components/Menu/InfoMenu.vue +35 -0
- package/components/Menu/MenuNav.vue +17 -2
- package/components/Pages/Anketa.vue +140 -52
- package/components/Pages/Auth.vue +50 -9
- package/components/Pages/ContragentForm.vue +124 -50
- package/components/Pages/Documents.vue +179 -29
- package/components/Pages/InvoiceInfo.vue +1 -1
- package/components/Pages/MemberForm.vue +605 -116
- package/components/Pages/ProductAgreement.vue +1 -8
- package/components/Pages/ProductConditions.vue +1055 -183
- package/components/Panel/PanelHandler.vue +583 -46
- package/components/Panel/PanelSelectItem.vue +17 -2
- package/components/Panel/RightPanelCloser.vue +7 -0
- package/components/Transitions/Animation.vue +28 -0
- package/components/Utilities/Qr.vue +44 -0
- package/composables/axios.ts +1 -0
- package/composables/classes.ts +456 -8
- package/composables/constants.ts +114 -2
- package/composables/fields.ts +328 -0
- package/composables/index.ts +270 -19
- package/composables/styles.ts +29 -16
- package/layouts/default.vue +48 -3
- package/locales/ru.json +547 -14
- package/package.json +28 -24
- package/pages/Token.vue +1 -12
- package/plugins/vuetifyPlugin.ts +2 -0
- package/store/data.store.ts +1463 -275
- package/store/extractStore.ts +17 -0
- package/store/form.store.ts +13 -1
- package/store/member.store.ts +1 -1
- package/store/rules.ts +83 -5
- package/types/enum.ts +61 -0
- package/types/env.d.ts +1 -0
- package/types/form.ts +94 -0
- package/types/index.ts +259 -23
package/store/data.store.ts
CHANGED
|
@@ -3,11 +3,13 @@ import { rules } from './rules';
|
|
|
3
3
|
import { i18n } from '../configs/i18n';
|
|
4
4
|
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
5
5
|
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
|
|
6
|
-
import { DataStoreClass,
|
|
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
10
|
import { PostActions, StoreMembers, Roles, Statuses, MemberCodes, MemberAppCodes } from '../types/enum';
|
|
11
|
+
//@ts-ignore
|
|
12
|
+
import { NCALayerClient } from 'ncalayer-js-client';
|
|
11
13
|
|
|
12
14
|
export const useDataStore = defineStore('data', {
|
|
13
15
|
state: () => ({
|
|
@@ -22,6 +24,7 @@ export const useDataStore = defineStore('data', {
|
|
|
22
24
|
formStore: useFormStore(),
|
|
23
25
|
// contragent: useContragentStore(),
|
|
24
26
|
api: new ApiClass(),
|
|
27
|
+
rController: new AbortController(),
|
|
25
28
|
yearEnding: (year: number) => yearEnding(year, constants.yearTitles, constants.yearCases),
|
|
26
29
|
currentDate: () => new Date(Date.now() - new Date().getTimezoneOffset() * 60 * 1000).toISOString().slice(0, -1),
|
|
27
30
|
showToaster: (type: 'success' | 'error' | 'warning' | 'info', msg: string, timeout?: number) =>
|
|
@@ -33,9 +36,12 @@ export const useDataStore = defineStore('data', {
|
|
|
33
36
|
}),
|
|
34
37
|
getters: {
|
|
35
38
|
isEFO: state => state.product === 'efo',
|
|
39
|
+
isEfoParent: state => state.parentProduct === 'efo',
|
|
36
40
|
isAML: state => state.product === 'aml',
|
|
37
41
|
isLKA: state => state.product === 'lka',
|
|
38
|
-
|
|
42
|
+
isAULETTI: state => state.product === 'auletti',
|
|
43
|
+
isAulettiParent: state => state.parentProduct === 'auletti',
|
|
44
|
+
isBridge: state => state.product === 'efo' || state.product === 'aml' || state.product === 'lka' || state.product === 'auletti',
|
|
39
45
|
isBaiterek: state => state.product === 'baiterek',
|
|
40
46
|
isBolashak: state => state.product === 'bolashak',
|
|
41
47
|
isMycar: state => state.product === 'mycar',
|
|
@@ -44,9 +50,16 @@ export const useDataStore = defineStore('data', {
|
|
|
44
50
|
isLiferenta: state => state.product === 'liferenta',
|
|
45
51
|
isGons: state => state.product === 'gons',
|
|
46
52
|
isKazyna: state => state.product === 'halykkazyna',
|
|
53
|
+
isDas: state => state.product === 'daskamkorlyk',
|
|
54
|
+
isPension: state => state.product === 'pensionannuity',
|
|
55
|
+
isAmulet: state => state.product === 'amuletlife',
|
|
56
|
+
isGns: state => state.product === 'gns',
|
|
47
57
|
isCalculator: state => state.product === 'calculator',
|
|
48
58
|
isCheckContract: state => state.product === 'checkcontract',
|
|
49
59
|
isCheckContragent: state => state.product === 'checkcontragent',
|
|
60
|
+
isPrePension: state => state.product === 'prepensionannuity',
|
|
61
|
+
isDSO: state => state.product === 'dso',
|
|
62
|
+
isUU: state => state.product === 'uu',
|
|
50
63
|
isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
|
|
51
64
|
hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
52
65
|
isClientAnketaCondition: state =>
|
|
@@ -73,16 +86,41 @@ export const useDataStore = defineStore('data', {
|
|
|
73
86
|
childFrame.contentWindow.postMessage({ action: action, value: value }, '*');
|
|
74
87
|
}
|
|
75
88
|
},
|
|
76
|
-
|
|
89
|
+
abortRequests() {
|
|
90
|
+
try {
|
|
91
|
+
this.rController.abort();
|
|
92
|
+
this.rController = new AbortController();
|
|
93
|
+
} catch (err) {
|
|
94
|
+
console.log(err);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
async copyToClipboard(text: unknown, showError: boolean = true) {
|
|
77
98
|
if (typeof text === 'string' || typeof text === 'number') {
|
|
78
|
-
if (
|
|
79
|
-
|
|
99
|
+
if (navigator.clipboard && window.isSecureContext) {
|
|
100
|
+
if (this.isBridge) {
|
|
101
|
+
await navigator.clipboard.writeText(String(text));
|
|
102
|
+
this.showToaster('success', this.t('toaster.copied'));
|
|
103
|
+
} else {
|
|
104
|
+
this.sendToParent(constants.postActions.clipboard, String(text));
|
|
105
|
+
}
|
|
80
106
|
} else {
|
|
81
|
-
|
|
107
|
+
const textarea = document.createElement('textarea');
|
|
108
|
+
textarea.value = String(text);
|
|
109
|
+
textarea.style.position = 'absolute';
|
|
110
|
+
textarea.style.left = '-99999999px';
|
|
111
|
+
document.body.prepend(textarea);
|
|
112
|
+
textarea.select();
|
|
113
|
+
try {
|
|
114
|
+
document.execCommand('copy');
|
|
115
|
+
this.showToaster('success', this.t('toaster.copied'));
|
|
116
|
+
} catch (err) {
|
|
117
|
+
console.log(err);
|
|
118
|
+
} finally {
|
|
119
|
+
textarea.remove();
|
|
120
|
+
}
|
|
82
121
|
}
|
|
83
|
-
this.showToaster('success', this.t('toaster.copied'));
|
|
84
122
|
} else {
|
|
85
|
-
this.showToaster('error', this.t('toaster.noUrl'));
|
|
123
|
+
if (showError) this.showToaster('error', this.t('toaster.noUrl'));
|
|
86
124
|
}
|
|
87
125
|
},
|
|
88
126
|
getFilesByIIN(iin: string) {
|
|
@@ -141,7 +179,7 @@ export const useDataStore = defineStore('data', {
|
|
|
141
179
|
return !!isRole;
|
|
142
180
|
},
|
|
143
181
|
isInitiator() {
|
|
144
|
-
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager();
|
|
182
|
+
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager() || this.isAgentAuletti();
|
|
145
183
|
},
|
|
146
184
|
isManager() {
|
|
147
185
|
return this.isRole(constants.roles.Manager);
|
|
@@ -152,6 +190,9 @@ export const useDataStore = defineStore('data', {
|
|
|
152
190
|
isAdmin() {
|
|
153
191
|
return this.isRole(constants.roles.Admin);
|
|
154
192
|
},
|
|
193
|
+
isJurist() {
|
|
194
|
+
return this.isRole(constants.roles.Jurist);
|
|
195
|
+
},
|
|
155
196
|
isAgent() {
|
|
156
197
|
return this.isRole(constants.roles.Agent);
|
|
157
198
|
},
|
|
@@ -164,15 +205,30 @@ export const useDataStore = defineStore('data', {
|
|
|
164
205
|
isUnderwriter() {
|
|
165
206
|
return this.isRole(constants.roles.Underwriter);
|
|
166
207
|
},
|
|
208
|
+
isActuary() {
|
|
209
|
+
return this.isRole(constants.roles.Actuary);
|
|
210
|
+
},
|
|
167
211
|
isAgentMycar() {
|
|
168
212
|
return this.isRole(constants.roles.AgentMycar);
|
|
169
213
|
},
|
|
214
|
+
isAgentAuletti() {
|
|
215
|
+
return this.isRole(constants.roles.AgentAuletti);
|
|
216
|
+
},
|
|
170
217
|
isAnalyst() {
|
|
171
218
|
return this.isRole(constants.roles.Analyst);
|
|
172
219
|
},
|
|
173
220
|
isUpk() {
|
|
174
221
|
return this.isRole(constants.roles.UPK);
|
|
175
222
|
},
|
|
223
|
+
isUrp() {
|
|
224
|
+
return this.isRole(constants.roles.URP);
|
|
225
|
+
},
|
|
226
|
+
isUsns() {
|
|
227
|
+
return this.isRole(constants.roles.USNS);
|
|
228
|
+
},
|
|
229
|
+
isAccountant() {
|
|
230
|
+
return this.isRole(constants.roles.Accountant);
|
|
231
|
+
},
|
|
176
232
|
isDrn() {
|
|
177
233
|
return this.isRole(constants.roles.DRNSJ);
|
|
178
234
|
},
|
|
@@ -185,6 +241,21 @@ export const useDataStore = defineStore('data', {
|
|
|
185
241
|
isSupervisor() {
|
|
186
242
|
return this.isRole(constants.roles.Supervisor);
|
|
187
243
|
},
|
|
244
|
+
isHeadManager() {
|
|
245
|
+
return this.isRole(constants.roles.HeadManager);
|
|
246
|
+
},
|
|
247
|
+
isBranchDirector() {
|
|
248
|
+
return this.isRole(constants.roles.BranchDirector);
|
|
249
|
+
},
|
|
250
|
+
isUSNSACCINS() {
|
|
251
|
+
return this.isRole(constants.roles.USNSACCINS);
|
|
252
|
+
},
|
|
253
|
+
isDsuio() {
|
|
254
|
+
return this.isRole(constants.roles.Dsuio);
|
|
255
|
+
},
|
|
256
|
+
isAdjuster() {
|
|
257
|
+
return this.isRole(constants.roles.Adjuster);
|
|
258
|
+
},
|
|
188
259
|
isProcessEditable(statusCode?: keyof typeof Statuses) {
|
|
189
260
|
const getEditibleStatuses = () => {
|
|
190
261
|
const defaultStatuses = constants.editableStatuses;
|
|
@@ -206,6 +277,13 @@ export const useDataStore = defineStore('data', {
|
|
|
206
277
|
};
|
|
207
278
|
return !!getCanceleStatuses().find(status => status === statusCode);
|
|
208
279
|
},
|
|
280
|
+
isProcessReject(statusCode?: keyof typeof Statuses) {
|
|
281
|
+
const getRejectStatuses = () => {
|
|
282
|
+
const defaultStatuses = constants.rejectApplicationStatuses;
|
|
283
|
+
return defaultStatuses;
|
|
284
|
+
};
|
|
285
|
+
return !!getRejectStatuses().find(status => status === statusCode);
|
|
286
|
+
},
|
|
209
287
|
isTask() {
|
|
210
288
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
211
289
|
},
|
|
@@ -227,25 +305,11 @@ export const useDataStore = defineStore('data', {
|
|
|
227
305
|
this.getUserRoles();
|
|
228
306
|
}
|
|
229
307
|
const checkPermission = () => {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (this.
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
if (this.isEFO) {
|
|
237
|
-
return (
|
|
238
|
-
this.isInitiator() ||
|
|
239
|
-
this.isUnderwriter() ||
|
|
240
|
-
this.isAdmin() ||
|
|
241
|
-
this.isCompliance() ||
|
|
242
|
-
this.isAnalyst() ||
|
|
243
|
-
this.isUpk() ||
|
|
244
|
-
this.isFinCenter() ||
|
|
245
|
-
this.isSupervisor() ||
|
|
246
|
-
this.isSupport()
|
|
247
|
-
);
|
|
248
|
-
}
|
|
308
|
+
const hasAccess = this.hasAccess();
|
|
309
|
+
if (this.isAML) return hasAccess.toAML;
|
|
310
|
+
if (this.isLKA) return hasAccess.toLKA;
|
|
311
|
+
if (this.isEFO) return hasAccess.toEFO;
|
|
312
|
+
if (this.isAULETTI) return hasAccess.toAULETTI;
|
|
249
313
|
return false;
|
|
250
314
|
};
|
|
251
315
|
if (this.controls.onAuth) {
|
|
@@ -288,6 +352,7 @@ export const useDataStore = defineStore('data', {
|
|
|
288
352
|
},
|
|
289
353
|
async resetSelected(route: RouteType) {
|
|
290
354
|
this.settings.open = false;
|
|
355
|
+
this.rightPanel.open = false;
|
|
291
356
|
this.panel.open = false;
|
|
292
357
|
this.panelAction = null;
|
|
293
358
|
this.menu.selectedItem = new MenuItem();
|
|
@@ -357,7 +422,7 @@ export const useDataStore = defineStore('data', {
|
|
|
357
422
|
this.isLoading = false;
|
|
358
423
|
}
|
|
359
424
|
},
|
|
360
|
-
async getContragent(member: Member, load: boolean = true) {
|
|
425
|
+
async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
|
|
361
426
|
this.isLoading = load;
|
|
362
427
|
if (!member.iin) return;
|
|
363
428
|
try {
|
|
@@ -379,7 +444,7 @@ export const useDataStore = defineStore('data', {
|
|
|
379
444
|
}
|
|
380
445
|
member.gotFromInsis = true;
|
|
381
446
|
} else {
|
|
382
|
-
this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
447
|
+
if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
383
448
|
}
|
|
384
449
|
} catch (err) {
|
|
385
450
|
ErrorHandler(err);
|
|
@@ -387,6 +452,7 @@ export const useDataStore = defineStore('data', {
|
|
|
387
452
|
this.isLoading = false;
|
|
388
453
|
},
|
|
389
454
|
async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
|
|
455
|
+
if (Number(id) === 0) return;
|
|
390
456
|
this.isLoading = load;
|
|
391
457
|
try {
|
|
392
458
|
const member = whichIndex === null ? this.formStore[whichForm as SingleMember] : this.formStore[whichForm as MultipleMember][whichIndex];
|
|
@@ -440,9 +506,9 @@ export const useDataStore = defineStore('data', {
|
|
|
440
506
|
member.verifyDate = user.personalData.verifyDate;
|
|
441
507
|
member.iin = reformatIin(user.personalData.iin);
|
|
442
508
|
member.age = String(user.personalData.age);
|
|
443
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
509
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
444
510
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
445
|
-
const gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
|
|
511
|
+
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
446
512
|
member.gender = gender ? gender : new Value();
|
|
447
513
|
member.gender.id = user.personalData.gender;
|
|
448
514
|
member.birthDate = reformatDate(user.personalData.birthDate);
|
|
@@ -464,8 +530,8 @@ export const useDataStore = defineStore('data', {
|
|
|
464
530
|
return user.documents.find(i => i.type === '1UDL');
|
|
465
531
|
})();
|
|
466
532
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
467
|
-
const documentType = this.documentTypes.find(i => i.ids === userDocument.type);
|
|
468
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu === userDocument.issuerNameRu);
|
|
533
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
534
|
+
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
469
535
|
member.documentType = documentType ? documentType : new Value();
|
|
470
536
|
member.documentNumber = userDocument.number;
|
|
471
537
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
@@ -477,16 +543,22 @@ export const useDataStore = defineStore('data', {
|
|
|
477
543
|
user.data.forEach(questData => {
|
|
478
544
|
this.searchFromList(member, questData);
|
|
479
545
|
});
|
|
546
|
+
if (this.isLifetrip) {
|
|
547
|
+
const lastNameLat = user.data.find(obj => obj.questId === '500147');
|
|
548
|
+
const firstNameLat = user.data.find(obj => obj.questId === '500148');
|
|
549
|
+
member.lastNameLat = lastNameLat ? (lastNameLat.questAnswer as string) : null;
|
|
550
|
+
member.firstNameLat = firstNameLat ? (firstNameLat.questAnswer as string) : null;
|
|
551
|
+
}
|
|
480
552
|
}
|
|
481
553
|
if ('address' in user && user.address && user.address.length) {
|
|
482
554
|
const userAddress = user.address[0];
|
|
483
555
|
const countryName = userAddress.countryName;
|
|
484
556
|
if (countryName) {
|
|
485
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(countryName, 'i')));
|
|
557
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(countryName, 'i')));
|
|
486
558
|
member.registrationCountry = country ? country : new Value();
|
|
487
559
|
}
|
|
488
|
-
const province = this.states.find(i => i.ids === userAddress.stateCode);
|
|
489
|
-
const localityType = this.localityTypes.find(i => i.nameRu === userAddress.cityTypeName);
|
|
560
|
+
const province = this.states.find((i: Value) => i.ids === userAddress.stateCode);
|
|
561
|
+
const localityType = this.localityTypes.find((i: Value) => i.nameRu === userAddress.cityTypeName);
|
|
490
562
|
const city = this.cities.find(i => !!userAddress.cityName && i.nameRu === userAddress.cityName.replace('г.', ''));
|
|
491
563
|
const region = this.regions.find(i => !!userAddress.regionCode && i.ids == userAddress.regionCode);
|
|
492
564
|
member.registrationStreet = userAddress.streetName;
|
|
@@ -536,7 +608,7 @@ export const useDataStore = defineStore('data', {
|
|
|
536
608
|
};
|
|
537
609
|
const qData = getQuestionariesData();
|
|
538
610
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
539
|
-
const qResult = qData.from.find(i => i.ids === searchIt.questAnswer);
|
|
611
|
+
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
540
612
|
//@ts-ignore
|
|
541
613
|
member[qData.field] = qResult ? qResult : new Value();
|
|
542
614
|
}
|
|
@@ -553,12 +625,12 @@ export const useDataStore = defineStore('data', {
|
|
|
553
625
|
const contragent = await this.api.getContragent(queryData);
|
|
554
626
|
if (contragent.totalItems > 0) {
|
|
555
627
|
if (contragent.items.length === 1) {
|
|
556
|
-
return contragent.items[0]
|
|
628
|
+
return contragent.items[0];
|
|
557
629
|
} else {
|
|
558
630
|
const sortedByRegistrationDate = contragent.items.sort(
|
|
559
631
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
560
632
|
);
|
|
561
|
-
return sortedByRegistrationDate[0]
|
|
633
|
+
return sortedByRegistrationDate[0];
|
|
562
634
|
}
|
|
563
635
|
} else {
|
|
564
636
|
return null;
|
|
@@ -588,17 +660,27 @@ export const useDataStore = defineStore('data', {
|
|
|
588
660
|
}
|
|
589
661
|
},
|
|
590
662
|
async saveContragent(user: Member, whichForm: keyof typeof StoreMembers | 'contragent', whichIndex: number | null, onlySaveAction: boolean = true) {
|
|
663
|
+
if (this.isGons && user.iin && whichForm === 'beneficiaryForm' && useEnv().isProduction) {
|
|
664
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesInActualPolicy(user.iin.replace(/-/g, ''));
|
|
665
|
+
if (doesHaveActiveContract) {
|
|
666
|
+
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
591
670
|
this.isLoading = !onlySaveAction;
|
|
592
|
-
const
|
|
593
|
-
if (
|
|
594
|
-
user.id =
|
|
671
|
+
const hasInsis = await this.alreadyInInsis(user);
|
|
672
|
+
if (!!hasInsis) {
|
|
673
|
+
user.id = hasInsis.id;
|
|
595
674
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
596
675
|
this.api.getContrAgentData(user.id),
|
|
597
676
|
this.api.getContrAgentContacts(user.id),
|
|
598
677
|
this.api.getContrAgentDocuments(user.id),
|
|
599
678
|
this.api.getContrAgentAddress(user.id),
|
|
600
679
|
]);
|
|
601
|
-
user.response
|
|
680
|
+
if (!user.response) {
|
|
681
|
+
user.response = {};
|
|
682
|
+
user.response.contragent = hasInsis;
|
|
683
|
+
}
|
|
602
684
|
if (questionairesResponse.status === 'fulfilled' && questionairesResponse.value && questionairesResponse.value.length) {
|
|
603
685
|
user.response.questionnaires = questionairesResponse.value;
|
|
604
686
|
}
|
|
@@ -624,7 +706,11 @@ export const useDataStore = defineStore('data', {
|
|
|
624
706
|
birthDate: user.getDateByKey('birthDate')!,
|
|
625
707
|
gender: Number(user.gender.id),
|
|
626
708
|
genderName: user.genderName ? user.genderName : user.gender.nameRu ?? '',
|
|
627
|
-
birthPlace: user.birthPlace.nameRu
|
|
709
|
+
birthPlace: user.birthPlace.nameRu
|
|
710
|
+
? user.birthPlace.nameRu
|
|
711
|
+
: 'response' in user && user.response && 'contragent' in user.response && user.response.contragent && user.response.contragent.birthPlace
|
|
712
|
+
? user.response.contragent.birthPlace
|
|
713
|
+
: '',
|
|
628
714
|
age: Number(user.age),
|
|
629
715
|
registrationDate: user.registrationDate,
|
|
630
716
|
verifyType: user.verifyType,
|
|
@@ -685,6 +771,26 @@ export const useDataStore = defineStore('data', {
|
|
|
685
771
|
});
|
|
686
772
|
}
|
|
687
773
|
}
|
|
774
|
+
if (this.isLifetrip) {
|
|
775
|
+
const lastNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500147') : undefined;
|
|
776
|
+
const firstNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500148') : undefined;
|
|
777
|
+
questionariesData.push({
|
|
778
|
+
id: lastNameLat ? lastNameLat.id : 0,
|
|
779
|
+
contragentId: Number(user.id),
|
|
780
|
+
questAnswer: user.lastNameLat ?? '',
|
|
781
|
+
questAnswerName: null,
|
|
782
|
+
questName: 'Фамилия на латинице',
|
|
783
|
+
questId: '500147',
|
|
784
|
+
});
|
|
785
|
+
questionariesData.push({
|
|
786
|
+
id: firstNameLat ? firstNameLat.id : 0,
|
|
787
|
+
contragentId: Number(user.id),
|
|
788
|
+
questAnswer: user.firstNameLat ?? '',
|
|
789
|
+
questAnswerName: null,
|
|
790
|
+
questName: 'Имя на латинице',
|
|
791
|
+
questId: '500148',
|
|
792
|
+
});
|
|
793
|
+
}
|
|
688
794
|
|
|
689
795
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
690
796
|
const contactsData: ContragentContacts[] = [];
|
|
@@ -868,7 +974,7 @@ export const useDataStore = defineStore('data', {
|
|
|
868
974
|
data.isNotary = member.isNotary;
|
|
869
975
|
}
|
|
870
976
|
if (whichMember === 'Insured') {
|
|
871
|
-
if (this.formStore.applicationData && this.formStore.applicationData.insuredApp && this.formStore.applicationData.insuredApp.length) {
|
|
977
|
+
if (this.formStore.applicationData && this.formStore.applicationData.insuredApp && this.formStore.applicationData.insuredApp.length && !this.isPension) {
|
|
872
978
|
if (this.members.insuredApp.has) {
|
|
873
979
|
await this.deleteInsuredLogic();
|
|
874
980
|
}
|
|
@@ -877,7 +983,7 @@ export const useDataStore = defineStore('data', {
|
|
|
877
983
|
delete data.id;
|
|
878
984
|
}
|
|
879
985
|
}
|
|
880
|
-
data.isDisability = this.formStore.isPolicyholderInsured ? false : member.isDisability.nameRu == 'Да';
|
|
986
|
+
data.isDisability = this.formStore.isPolicyholderInsured && !this.isPension ? false : member.isDisability.nameRu == 'Да';
|
|
881
987
|
data.disabilityGroupId = data.isDisability && member.disabilityGroup ? member.disabilityGroup.id : null;
|
|
882
988
|
data.profession = member.job;
|
|
883
989
|
data.position = member.jobPosition;
|
|
@@ -929,6 +1035,24 @@ export const useDataStore = defineStore('data', {
|
|
|
929
1035
|
}
|
|
930
1036
|
}
|
|
931
1037
|
},
|
|
1038
|
+
async setApplication(calculate: boolean = false) {
|
|
1039
|
+
try {
|
|
1040
|
+
this.isLoading = true;
|
|
1041
|
+
this.isButtonsLoading = true;
|
|
1042
|
+
await this.api.setApplication(this.formStore.applicationData.pensionApp);
|
|
1043
|
+
if (calculate) {
|
|
1044
|
+
await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
|
|
1045
|
+
this.showToaster('success', this.t('toaster.successSaved'), 2000);
|
|
1046
|
+
}
|
|
1047
|
+
this.isLoading = false;
|
|
1048
|
+
this.isButtonsLoading = false;
|
|
1049
|
+
return true;
|
|
1050
|
+
} catch (err) {
|
|
1051
|
+
this.isLoading = false;
|
|
1052
|
+
this.isButtonsLoading = false;
|
|
1053
|
+
return ErrorHandler(err);
|
|
1054
|
+
}
|
|
1055
|
+
},
|
|
932
1056
|
getConditionsData() {
|
|
933
1057
|
const conditionsData: {
|
|
934
1058
|
policyAppDto: PolicyAppDto;
|
|
@@ -952,7 +1076,7 @@ export const useDataStore = defineStore('data', {
|
|
|
952
1076
|
annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
|
|
953
1077
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
954
1078
|
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
955
|
-
: this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
|
|
1079
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
956
1080
|
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id ?? undefined,
|
|
957
1081
|
lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply ?? ''),
|
|
958
1082
|
lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive ?? ''),
|
|
@@ -975,6 +1099,13 @@ export const useDataStore = defineStore('data', {
|
|
|
975
1099
|
conditionsData.policyAppDto.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
976
1100
|
conditionsData.policyAppDto.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
977
1101
|
}
|
|
1102
|
+
if (this.isLifeBusiness || this.isGns) {
|
|
1103
|
+
conditionsData.policyAppDto.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
|
|
1104
|
+
conditionsData.policyAppDto.fixInsSum = getNumber(String(this.formStore.productConditionsForm.fixInsSum));
|
|
1105
|
+
conditionsData.policyAppDto.mainInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
|
|
1106
|
+
conditionsData.policyAppDto.agentCommission = Number(this.formStore.productConditionsForm.agentCommission);
|
|
1107
|
+
conditionsData.policyAppDto.processDefinitionFgotId = (this.formStore.productConditionsForm.processGfot.id as string) ?? undefined;
|
|
1108
|
+
}
|
|
978
1109
|
return conditionsData;
|
|
979
1110
|
},
|
|
980
1111
|
async clearAddCovers(coverCode: number, coverValue: string) {
|
|
@@ -993,6 +1124,8 @@ export const useDataStore = defineStore('data', {
|
|
|
993
1124
|
}
|
|
994
1125
|
},
|
|
995
1126
|
async deleteInsuredLogic() {
|
|
1127
|
+
// TODO Просмотреть
|
|
1128
|
+
if (this.isLifetrip || this.isPension) return;
|
|
996
1129
|
const applicationData = this.getConditionsData();
|
|
997
1130
|
const clearCovers = [{ code: 10, value: 'excluded' }];
|
|
998
1131
|
await Promise.allSettled(
|
|
@@ -1023,6 +1156,16 @@ export const useDataStore = defineStore('data', {
|
|
|
1023
1156
|
}
|
|
1024
1157
|
return null;
|
|
1025
1158
|
},
|
|
1159
|
+
async getProcessCoverTypePeriod(questionId: string) {
|
|
1160
|
+
if (!this.processCode) return null;
|
|
1161
|
+
try {
|
|
1162
|
+
const answers = await this.api.getProcessCoverTypePeriod(this.processCode, questionId);
|
|
1163
|
+
return answers;
|
|
1164
|
+
} catch (err) {
|
|
1165
|
+
console.log(err);
|
|
1166
|
+
}
|
|
1167
|
+
return null;
|
|
1168
|
+
},
|
|
1026
1169
|
async definedAnswers(
|
|
1027
1170
|
filter: string,
|
|
1028
1171
|
whichSurvey: 'surveyByHealthBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBase' | 'surveyByCriticalBasePolicyholder',
|
|
@@ -1051,7 +1194,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1051
1194
|
this.isLoading = false;
|
|
1052
1195
|
}
|
|
1053
1196
|
},
|
|
1054
|
-
async setINSISWorkData() {
|
|
1197
|
+
async setINSISWorkData(loading: boolean = true) {
|
|
1055
1198
|
if (!this.formStore.applicationData.insisWorkDataApp) return;
|
|
1056
1199
|
const data: InsisWorkDataApp = {
|
|
1057
1200
|
id: this.formStore.applicationData.insisWorkDataApp.id,
|
|
@@ -1070,7 +1213,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1070
1213
|
insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
|
|
1071
1214
|
};
|
|
1072
1215
|
try {
|
|
1073
|
-
this.isLoading =
|
|
1216
|
+
this.isLoading = loading;
|
|
1074
1217
|
await this.api.setINSISWorkData(data);
|
|
1075
1218
|
} catch (err) {
|
|
1076
1219
|
ErrorHandler(err);
|
|
@@ -1110,7 +1253,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1110
1253
|
if (storageValue && (hasHourKey === false || hasMiniteKey === false || hasModeKey === false || hasValueKey === false)) return true;
|
|
1111
1254
|
if (
|
|
1112
1255
|
storageValue &&
|
|
1113
|
-
(storageValue.hour !== currentHour || storageValue.minute !== currentMinutePart || storageValue.mode !== import.meta.env.
|
|
1256
|
+
(storageValue.hour !== currentHour || storageValue.minute !== currentMinutePart || storageValue.mode !== import.meta.env.VITE_MODE || storageValue.value.length === 0)
|
|
1114
1257
|
)
|
|
1115
1258
|
return true;
|
|
1116
1259
|
};
|
|
@@ -1127,7 +1270,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1127
1270
|
value: response,
|
|
1128
1271
|
hour: currentHour,
|
|
1129
1272
|
minute: currentMinutePart,
|
|
1130
|
-
mode: import.meta.env.
|
|
1273
|
+
mode: import.meta.env.VITE_MODE,
|
|
1131
1274
|
}),
|
|
1132
1275
|
);
|
|
1133
1276
|
//@ts-ignore
|
|
@@ -1145,7 +1288,28 @@ export const useDataStore = defineStore('data', {
|
|
|
1145
1288
|
return this[whichField];
|
|
1146
1289
|
},
|
|
1147
1290
|
async getCountries() {
|
|
1148
|
-
|
|
1291
|
+
const response = await this.getFromApi('countries', 'getCountries');
|
|
1292
|
+
const kzIndex = response.findIndex(country => country.ids === 'KZ');
|
|
1293
|
+
if (kzIndex !== -1) {
|
|
1294
|
+
const element = response.splice(kzIndex, 1)[0];
|
|
1295
|
+
response.splice(0, 0, element);
|
|
1296
|
+
}
|
|
1297
|
+
return response;
|
|
1298
|
+
},
|
|
1299
|
+
async getDicCountries() {
|
|
1300
|
+
if (this.isLifetrip) return await this.getFromApi('dicAllCountries', 'getArmDicts', 'DicCountry');
|
|
1301
|
+
},
|
|
1302
|
+
async getDicTripType() {
|
|
1303
|
+
if (this.isLifetrip) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
|
|
1304
|
+
},
|
|
1305
|
+
async getDicTripPurpose() {
|
|
1306
|
+
if (this.isLifetrip) return await this.getFromApi('purposes', 'getArmDicts', 'DicTripPurpose');
|
|
1307
|
+
},
|
|
1308
|
+
async getDicTripWorkType() {
|
|
1309
|
+
if (this.isLifetrip) return await this.getFromApi('workTypes', 'getArmDicts', 'DicTripWorkType');
|
|
1310
|
+
},
|
|
1311
|
+
async getDicSportsType() {
|
|
1312
|
+
if (this.isLifetrip) return await this.getFromApi('sportsTypes', 'getArmDicts', 'DicSportsType');
|
|
1149
1313
|
},
|
|
1150
1314
|
async getCitizenshipCountries() {
|
|
1151
1315
|
return await this.getFromApi('citizenshipCountries', 'getCitizenshipCountries');
|
|
@@ -1156,31 +1320,80 @@ export const useDataStore = defineStore('data', {
|
|
|
1156
1320
|
async getAdditionalTaxCountries() {
|
|
1157
1321
|
return await this.getFromApi('addTaxCountries', 'getAdditionalTaxCountries');
|
|
1158
1322
|
},
|
|
1159
|
-
async getStates(key?: string, member?: Member) {
|
|
1323
|
+
async getStates(key?: string, member?: Member, keys?: { key?: string; deepKey?: string; subDeepKey?: string }) {
|
|
1160
1324
|
await this.getFromApi('states', 'getStates');
|
|
1161
|
-
|
|
1162
|
-
|
|
1325
|
+
if (!!keys) {
|
|
1326
|
+
if (!!keys.key) {
|
|
1327
|
+
if (!!keys.deepKey) {
|
|
1328
|
+
if (!!keys.subDeepKey) {
|
|
1329
|
+
//@ts-ignore
|
|
1330
|
+
return this.states.filter(i => i.code === member[keys.key][keys.deepKey][keys.subDeepKey].ids || i.code === member[keys.key][keys.deepKey][keys.subDeepKey].id);
|
|
1331
|
+
} else {
|
|
1332
|
+
//@ts-ignore
|
|
1333
|
+
return this.states.filter(i => i.code === member[keys.key][keys.deepKey].ids || i.code === member[keys.key][keys.deepKey].id);
|
|
1334
|
+
}
|
|
1335
|
+
} else {
|
|
1336
|
+
//@ts-ignore
|
|
1337
|
+
return this.states.filter(i => i.code === member[keys.key].ids || i.code === member[keys.key].id);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
} else {
|
|
1341
|
+
//@ts-ignore
|
|
1342
|
+
if (key && member[key] && member[key].ids !== null) return this.states.filter((i: Value) => i.code === member[key].ids);
|
|
1343
|
+
}
|
|
1163
1344
|
return this.states;
|
|
1164
1345
|
},
|
|
1165
|
-
async getRegions(key?: string, member?: Member) {
|
|
1346
|
+
async getRegions(key?: string, member?: Member, keys?: { key?: string; deepKey?: string; subDeepKey?: string }) {
|
|
1166
1347
|
await this.getFromApi('regions', 'getRegions');
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1348
|
+
if (!!keys) {
|
|
1349
|
+
if (!!keys.key) {
|
|
1350
|
+
if (!!keys.deepKey) {
|
|
1351
|
+
if (!!keys.subDeepKey) {
|
|
1352
|
+
//@ts-ignore
|
|
1353
|
+
return this.regions.filter(i => i.code === member[keys.key][keys.deepKey][keys.subDeepKey].ids || i.code === member[keys.key][keys.deepKey][keys.subDeepKey].id);
|
|
1354
|
+
} else {
|
|
1355
|
+
//@ts-ignore
|
|
1356
|
+
return this.regions.filter(i => i.code === member[keys.key][keys.deepKey].ids || i.code === member[keys.key][keys.deepKey].id);
|
|
1357
|
+
}
|
|
1358
|
+
} else {
|
|
1359
|
+
//@ts-ignore
|
|
1360
|
+
return this.regions.filter(i => i.code === member[keys.key].ids || i.code === member[keys.key].id);
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1171
1363
|
} else {
|
|
1172
|
-
|
|
1364
|
+
//@ts-ignore
|
|
1365
|
+
if (key && member[key] && member[key].ids !== null) return this.regions.filter((i: Value) => i.code === member[key].ids);
|
|
1366
|
+
if (member && member.registrationProvince.ids !== null) {
|
|
1367
|
+
return this.regions.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1368
|
+
}
|
|
1173
1369
|
}
|
|
1370
|
+
return this.regions;
|
|
1174
1371
|
},
|
|
1175
|
-
async getCities(key?: string, member?: Member) {
|
|
1372
|
+
async getCities(key?: string, member?: Member, keys?: { key?: string; deepKey?: string; subDeepKey?: string }) {
|
|
1176
1373
|
await this.getFromApi('cities', 'getCities');
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1374
|
+
if (!!keys) {
|
|
1375
|
+
if (!!keys.key) {
|
|
1376
|
+
if (!!keys.deepKey) {
|
|
1377
|
+
if (!!keys.subDeepKey) {
|
|
1378
|
+
//@ts-ignore
|
|
1379
|
+
return this.cities.filter(i => i.code === member[keys.key][keys.deepKey][keys.subDeepKey].ids || i.code === member[keys.key][keys.deepKey][keys.subDeepKey].id);
|
|
1380
|
+
} else {
|
|
1381
|
+
//@ts-ignore
|
|
1382
|
+
return this.cities.filter(i => i.code === member[keys.key][keys.deepKey].ids || i.code === member[keys.key][keys.deepKey].id);
|
|
1383
|
+
}
|
|
1384
|
+
} else {
|
|
1385
|
+
//@ts-ignore
|
|
1386
|
+
return this.cities.filter(i => i.code === member[keys.key].ids || i.code === member[keys.key].id);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1181
1389
|
} else {
|
|
1182
|
-
|
|
1390
|
+
//@ts-ignore
|
|
1391
|
+
if (key && member[key] && member[key].ids !== null) return this.cities.filter((i: Value) => i.code === member[key].ids);
|
|
1392
|
+
if (member && member.registrationProvince.ids !== null) {
|
|
1393
|
+
return this.cities.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1394
|
+
}
|
|
1183
1395
|
}
|
|
1396
|
+
return this.cities;
|
|
1184
1397
|
},
|
|
1185
1398
|
async getLocalityTypes() {
|
|
1186
1399
|
return await this.getFromApi('localityTypes', 'getLocalityTypes');
|
|
@@ -1208,12 +1421,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1208
1421
|
async getSectorCodeList() {
|
|
1209
1422
|
return await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1210
1423
|
},
|
|
1424
|
+
async getEconomicActivityType() {
|
|
1425
|
+
if (this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
|
|
1426
|
+
},
|
|
1211
1427
|
async getFamilyStatuses() {
|
|
1212
1428
|
return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
|
|
1213
1429
|
},
|
|
1430
|
+
async getDisabilityGroups() {
|
|
1431
|
+
return await this.getFromApi('disabilityGroups', 'getArmDicts', 'DicDisabilityGroup');
|
|
1432
|
+
},
|
|
1214
1433
|
async getRelationTypes() {
|
|
1215
1434
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1216
1435
|
},
|
|
1436
|
+
async getBanks() {
|
|
1437
|
+
if (this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO) return await this.getFromApi('banks', 'getBanks');
|
|
1438
|
+
},
|
|
1439
|
+
async getInsuranceCompanies() {
|
|
1440
|
+
if (this.isPension) return await this.getFromApi('insuranceCompanies', 'getInsuranceCompanies');
|
|
1441
|
+
},
|
|
1217
1442
|
async getProcessIndexRate() {
|
|
1218
1443
|
if (this.processCode) {
|
|
1219
1444
|
return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
@@ -1228,7 +1453,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1228
1453
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1229
1454
|
},
|
|
1230
1455
|
async getProcessTariff() {
|
|
1231
|
-
return await this.getFromApi('processTariff', 'getProcessTariff');
|
|
1456
|
+
if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
|
|
1232
1457
|
},
|
|
1233
1458
|
async getDicAnnuityTypeList() {
|
|
1234
1459
|
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
@@ -1241,6 +1466,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1241
1466
|
async getInsurancePay() {
|
|
1242
1467
|
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
1243
1468
|
},
|
|
1469
|
+
async getProcessGfot() {
|
|
1470
|
+
if (this.processCode) {
|
|
1471
|
+
return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1244
1474
|
async getCurrencies() {
|
|
1245
1475
|
try {
|
|
1246
1476
|
const currencies = await this.api.getCurrencies();
|
|
@@ -1254,6 +1484,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1254
1484
|
async getDictionaryItems(dictName: string) {
|
|
1255
1485
|
return await this.getFromApi(dictName, 'getDictionaryItems', dictName);
|
|
1256
1486
|
},
|
|
1487
|
+
getGenderList() {
|
|
1488
|
+
return this.gender;
|
|
1489
|
+
},
|
|
1490
|
+
async getAuthorityBasis() {
|
|
1491
|
+
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension) return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
|
|
1492
|
+
},
|
|
1257
1493
|
async getAllFormsData() {
|
|
1258
1494
|
await Promise.allSettled([
|
|
1259
1495
|
this.getCountries(),
|
|
@@ -1279,59 +1515,69 @@ export const useDataStore = defineStore('data', {
|
|
|
1279
1515
|
this.getInsurancePay(),
|
|
1280
1516
|
this.getDictionaryItems('RegionPolicy'),
|
|
1281
1517
|
this.getDictionaryItems('SaleChanellPolicy'),
|
|
1518
|
+
this.getDicTripType(),
|
|
1519
|
+
this.getDicCountries(),
|
|
1520
|
+
this.getDicTripWorkType(),
|
|
1521
|
+
this.getDicSportsType(),
|
|
1522
|
+
this.getDicTripPurpose(),
|
|
1523
|
+
this.getCurrencies(),
|
|
1524
|
+
this.getProcessGfot(),
|
|
1525
|
+
this.getBanks(),
|
|
1526
|
+
this.getInsuranceCompanies(),
|
|
1527
|
+
this.getEconomicActivityType(),
|
|
1528
|
+
this.getAuthorityBasis(),
|
|
1282
1529
|
]);
|
|
1283
1530
|
},
|
|
1284
1531
|
async getQuestionList(
|
|
1285
1532
|
surveyType: 'health' | 'critical',
|
|
1286
1533
|
processInstanceId: string | number,
|
|
1287
1534
|
insuredId: any,
|
|
1288
|
-
baseField:
|
|
1289
|
-
secondaryField: string,
|
|
1535
|
+
baseField: 'surveyByHealthBase' | 'surveyByCriticalBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBasePolicyholder',
|
|
1290
1536
|
whichMember: 'insured' | 'policyholder' = 'insured',
|
|
1291
1537
|
) {
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
|
|
1312
|
-
this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
|
|
1313
|
-
]);
|
|
1314
|
-
if (baseQuestions.status === 'fulfilled') {
|
|
1315
|
-
//@ts-ignore
|
|
1316
|
-
this.formStore[baseField] = baseQuestions.value;
|
|
1317
|
-
}
|
|
1318
|
-
if (secondaryQuestions.status === 'fulfilled') {
|
|
1319
|
-
//@ts-ignore
|
|
1320
|
-
this.formStore[secondaryField] = secondaryQuestions;
|
|
1321
|
-
}
|
|
1538
|
+
try {
|
|
1539
|
+
const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
|
|
1540
|
+
whichMember === 'insured' ? this.api.getQuestionList(surveyType, processInstanceId, insuredId) : this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
|
|
1541
|
+
whichMember === 'insured'
|
|
1542
|
+
? this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId)
|
|
1543
|
+
: this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
|
|
1544
|
+
,
|
|
1545
|
+
]);
|
|
1546
|
+
if (baseQuestions.status === 'fulfilled') {
|
|
1547
|
+
this.formStore[baseField] = baseQuestions.value;
|
|
1548
|
+
}
|
|
1549
|
+
if (secondaryQuestions.status === 'fulfilled') {
|
|
1550
|
+
const baseAnketa = this.formStore[baseField];
|
|
1551
|
+
if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
|
|
1552
|
+
baseAnketa.body.forEach(i => {
|
|
1553
|
+
if (i.first.definedAnswers === 'Y' && i.second === null && secondaryQuestions.value) {
|
|
1554
|
+
i.second = structuredClone(secondaryQuestions.value);
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1322
1557
|
}
|
|
1323
|
-
} catch (err) {
|
|
1324
|
-
console.log(err);
|
|
1325
1558
|
}
|
|
1559
|
+
} catch (err) {
|
|
1560
|
+
ErrorHandler(err);
|
|
1326
1561
|
}
|
|
1327
|
-
//@ts-ignore
|
|
1328
1562
|
return this.formStore[baseField];
|
|
1329
1563
|
},
|
|
1330
1564
|
getNumberWithSpaces(n: any) {
|
|
1331
1565
|
return n === null ? null : Number((typeof n === 'string' ? n : n.toFixed().toString()).replace(/[^0-9]+/g, '')).toLocaleString('ru');
|
|
1332
1566
|
},
|
|
1567
|
+
getNumberWithSpacesAfterComma(n: number) {
|
|
1568
|
+
let parts = n.toFixed(2).split('.');
|
|
1569
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
1570
|
+
return parts.join(',');
|
|
1571
|
+
},
|
|
1333
1572
|
getNumberWithDot(n: any) {
|
|
1334
|
-
return n === null
|
|
1573
|
+
return n === null
|
|
1574
|
+
? null
|
|
1575
|
+
: n
|
|
1576
|
+
.toLocaleString('ru', {
|
|
1577
|
+
maximumFractionDigits: 2,
|
|
1578
|
+
minimumFractionDigits: 2,
|
|
1579
|
+
})
|
|
1580
|
+
.replace(/,/g, '.');
|
|
1335
1581
|
},
|
|
1336
1582
|
async getTaskList(
|
|
1337
1583
|
search: string = '',
|
|
@@ -1371,7 +1617,18 @@ export const useDataStore = defineStore('data', {
|
|
|
1371
1617
|
delete query.processCodes;
|
|
1372
1618
|
query.processCode = byOneProcess;
|
|
1373
1619
|
}
|
|
1374
|
-
|
|
1620
|
+
if (byOneProcess === 1) {
|
|
1621
|
+
query.processCodes = [1, 2, 4];
|
|
1622
|
+
delete query.processCode;
|
|
1623
|
+
}
|
|
1624
|
+
const taskList = await this.api.getTaskList(
|
|
1625
|
+
processInstanceId === null
|
|
1626
|
+
? query
|
|
1627
|
+
: {
|
|
1628
|
+
...query,
|
|
1629
|
+
processInstanceId: processInstanceId,
|
|
1630
|
+
},
|
|
1631
|
+
);
|
|
1375
1632
|
if (needToReturn) {
|
|
1376
1633
|
this.isLoading = false;
|
|
1377
1634
|
return taskList.items;
|
|
@@ -1457,12 +1714,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1457
1714
|
},
|
|
1458
1715
|
findObject(from: string, key: string, searchKey: any): any {
|
|
1459
1716
|
// @ts-ignore
|
|
1460
|
-
const found = this[from].find(i => i[key] == searchKey);
|
|
1717
|
+
const found = this[from].find((i: Value) => i[key] == searchKey);
|
|
1461
1718
|
return found || new Value();
|
|
1462
1719
|
},
|
|
1463
|
-
async searchAgentByName(name: string) {
|
|
1720
|
+
async searchAgentByName(name: string, branchCode?: string) {
|
|
1464
1721
|
try {
|
|
1465
|
-
this.AgentData = await this.api.searchAgentByName(name);
|
|
1722
|
+
this.AgentData = await this.api.searchAgentByName(name, branchCode);
|
|
1466
1723
|
if (!this.AgentData.length) {
|
|
1467
1724
|
this.showToaster('error', this.t('toaster.notFound'), 1500);
|
|
1468
1725
|
}
|
|
@@ -1508,18 +1765,69 @@ export const useDataStore = defineStore('data', {
|
|
|
1508
1765
|
this.isLoading = false;
|
|
1509
1766
|
}
|
|
1510
1767
|
},
|
|
1768
|
+
async getTripInsuredAmount(show: boolean = true) {
|
|
1769
|
+
this.isLoading = true;
|
|
1770
|
+
try {
|
|
1771
|
+
const countryID: string[] = [];
|
|
1772
|
+
for (let country = 0; country < this.formStore.productConditionsForm.calculatorForm.countries!.length; country++) {
|
|
1773
|
+
countryID.push(this.formStore.productConditionsForm.calculatorForm.countries![country].id as string);
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
const form = {
|
|
1777
|
+
tripTypeID: this.formStore.productConditionsForm.calculatorForm.type.id,
|
|
1778
|
+
countryID,
|
|
1779
|
+
};
|
|
1780
|
+
|
|
1781
|
+
const result = await this.api.getTripInsuredAmount(form);
|
|
1782
|
+
const amounts: Value[] = [];
|
|
1783
|
+
result.amounts.forEach(amount => {
|
|
1784
|
+
amounts.push(new Value(amount['id'], amount['nameRu']));
|
|
1785
|
+
});
|
|
1786
|
+
|
|
1787
|
+
this.amountArray = amounts;
|
|
1788
|
+
this.formStore.productConditionsForm.calculatorForm.amount = new Value();
|
|
1789
|
+
this.currency = result.currency;
|
|
1790
|
+
|
|
1791
|
+
if (show) {
|
|
1792
|
+
this.showToaster('success', this.t('toaster.tripInsuredAmountCalculated'), 1000);
|
|
1793
|
+
}
|
|
1794
|
+
} catch (err) {
|
|
1795
|
+
ErrorHandler(err);
|
|
1796
|
+
}
|
|
1797
|
+
this.isLoading = false;
|
|
1798
|
+
},
|
|
1799
|
+
async getPeriod() {
|
|
1800
|
+
if (this.periodArray.length === 0) {
|
|
1801
|
+
try {
|
|
1802
|
+
const response = await this.api.getTripInsuranceDaysOptions();
|
|
1803
|
+
if (response) {
|
|
1804
|
+
const new3 = response.period;
|
|
1805
|
+
const newPeriod: Value[] = [];
|
|
1806
|
+
const newMaxDays: Value[] = [];
|
|
1807
|
+
Object.keys(new3).forEach(key => {
|
|
1808
|
+
newPeriod.push(new Value(key, key, key, key));
|
|
1809
|
+
new3[key as keyof typeof new3].forEach(item => {
|
|
1810
|
+
newMaxDays.push(new Value(item, item, item, key));
|
|
1811
|
+
});
|
|
1812
|
+
});
|
|
1813
|
+
this.periodArray = newPeriod;
|
|
1814
|
+
this.maxDaysAllArray = newMaxDays;
|
|
1815
|
+
}
|
|
1816
|
+
} catch (err) {
|
|
1817
|
+
ErrorHandler(err);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
},
|
|
1511
1821
|
async calculateWithoutApplication(showLoader: boolean = false, product: string | null = null) {
|
|
1512
1822
|
this.isLoading = showLoader;
|
|
1513
1823
|
try {
|
|
1514
|
-
if (!this.formStore.productConditionsForm.signDate
|
|
1824
|
+
if (!this.formStore.productConditionsForm.signDate) {
|
|
1515
1825
|
return;
|
|
1516
1826
|
}
|
|
1517
1827
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1518
|
-
const birthDate = formatDate(this.formStore.productConditionsForm.birthDate);
|
|
1519
|
-
if (!signDate || !birthDate) return;
|
|
1520
1828
|
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1521
|
-
signDate: signDate.toISOString(),
|
|
1522
|
-
birthDate: birthDate.toISOString(),
|
|
1829
|
+
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1830
|
+
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1523
1831
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
1524
1832
|
amount: getNumber(String(this.formStore.productConditionsForm.requestedSumInsured)),
|
|
1525
1833
|
premium: getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonth)),
|
|
@@ -1527,7 +1835,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1527
1835
|
payPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
|
|
1528
1836
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
1529
1837
|
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
1530
|
-
: this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
|
|
1838
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
1531
1839
|
paymentPeriodId: (this.formStore.productConditionsForm.paymentPeriod.id as string) ?? undefined,
|
|
1532
1840
|
addCovers: this.formStore.additionalInsuranceTermsWithout,
|
|
1533
1841
|
};
|
|
@@ -1536,15 +1844,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1536
1844
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1537
1845
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1538
1846
|
}
|
|
1539
|
-
if (this.isLiferenta) {
|
|
1847
|
+
if (this.isLiferenta || product === 'liferenta') {
|
|
1540
1848
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1541
1849
|
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
1542
1850
|
calculationData.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
1543
1851
|
calculationData.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
1544
1852
|
}
|
|
1853
|
+
if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
|
|
1854
|
+
calculationData.clients = this.formStore.lfb.clients;
|
|
1855
|
+
calculationData.insrCount = this.formStore.lfb.clients.length;
|
|
1856
|
+
calculationData.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
|
|
1857
|
+
calculationData.fixInsSum = getNumber(String(this.formStore.productConditionsForm.fixInsSum));
|
|
1858
|
+
calculationData.mainInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
|
|
1859
|
+
calculationData.agentCommission = Number(this.formStore.productConditionsForm.agentCommission);
|
|
1860
|
+
calculationData.processDefinitionFgotId = this.formStore.productConditionsForm.processGfot.id;
|
|
1861
|
+
}
|
|
1545
1862
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1546
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
1547
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
|
|
1863
|
+
if (calculationResponse.amount) this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
1864
|
+
if (calculationResponse.premium) this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
|
|
1548
1865
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1549
1866
|
if (this.isKazyna || product === 'halykkazyna') {
|
|
1550
1867
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
@@ -1553,9 +1870,28 @@ export const useDataStore = defineStore('data', {
|
|
|
1553
1870
|
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
|
|
1554
1871
|
}
|
|
1555
1872
|
}
|
|
1556
|
-
if (this.isLiferenta) {
|
|
1873
|
+
if (this.isLiferenta || product === 'liferenta') {
|
|
1557
1874
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(calculationResponse.annuityMonthPay);
|
|
1558
1875
|
}
|
|
1876
|
+
if (this.isGons || product === 'gons') {
|
|
1877
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(calculationResponse.totalAmount5);
|
|
1878
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(calculationResponse.totalAmount7);
|
|
1879
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(calculationResponse.statePremium5);
|
|
1880
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
|
|
1881
|
+
}
|
|
1882
|
+
if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
|
|
1883
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremiumWithCommission);
|
|
1884
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.mainInsSum === 0 ? null : calculationResponse.mainInsSum);
|
|
1885
|
+
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1886
|
+
if (calculationResponse.agentCommission) {
|
|
1887
|
+
this.formStore.productConditionsForm.agentCommission = calculationResponse.agentCommission;
|
|
1888
|
+
}
|
|
1889
|
+
if (calculationResponse.clients) {
|
|
1890
|
+
this.formStore.lfb.clients = calculationResponse.clients;
|
|
1891
|
+
}
|
|
1892
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1893
|
+
return calculationResponse;
|
|
1894
|
+
}
|
|
1559
1895
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1560
1896
|
} catch (err) {
|
|
1561
1897
|
ErrorHandler(err);
|
|
@@ -1568,7 +1904,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1568
1904
|
this.isLoading = true;
|
|
1569
1905
|
try {
|
|
1570
1906
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1571
|
-
await this.api.setApplication(this.getConditionsData());
|
|
1907
|
+
if (!this.isPension) await this.api.setApplication(this.getConditionsData());
|
|
1572
1908
|
const result = ref();
|
|
1573
1909
|
result.value = await this.api.getCalculation(String(id));
|
|
1574
1910
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
@@ -1591,20 +1927,99 @@ export const useDataStore = defineStore('data', {
|
|
|
1591
1927
|
if (this.isLiferenta) {
|
|
1592
1928
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
1593
1929
|
}
|
|
1930
|
+
if (this.isGons) {
|
|
1931
|
+
const govPremiums = await this.api.getGovernmentPremiums(String(id));
|
|
1932
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
|
|
1933
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
|
|
1934
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
|
|
1935
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
1936
|
+
}
|
|
1937
|
+
if (this.isLifeBusiness || this.isGns) {
|
|
1938
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1939
|
+
if (applicationData.insuredApp && applicationData.insuredApp.length) {
|
|
1940
|
+
const res = await this.newInsuredList(applicationData.insuredApp);
|
|
1941
|
+
this.formStore.lfb.clients = res;
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1946
|
+
} catch (err) {
|
|
1947
|
+
ErrorHandler(err);
|
|
1948
|
+
}
|
|
1949
|
+
this.isLoading = false;
|
|
1950
|
+
},
|
|
1951
|
+
async calculatePremium(data: any) {
|
|
1952
|
+
this.isLoading = true;
|
|
1953
|
+
try {
|
|
1954
|
+
const response = await this.api.calculatePremium(data);
|
|
1955
|
+
// @ts-ignore
|
|
1956
|
+
if (response && response.errMsg) {
|
|
1957
|
+
// @ts-ignore
|
|
1958
|
+
this.showToaster('error', response.errMsg, 1000);
|
|
1959
|
+
} else {
|
|
1960
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1961
|
+
}
|
|
1962
|
+
this.isLoading = false;
|
|
1963
|
+
return response;
|
|
1964
|
+
} catch (err) {
|
|
1965
|
+
ErrorHandler(err);
|
|
1966
|
+
}
|
|
1967
|
+
this.isLoading = false;
|
|
1968
|
+
},
|
|
1969
|
+
async calculatePrice(taskId?: string) {
|
|
1970
|
+
this.isLoading = true;
|
|
1971
|
+
try {
|
|
1972
|
+
const priceForm: SetApplicationRequest = {};
|
|
1973
|
+
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
1974
|
+
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
1975
|
+
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
1976
|
+
priceForm.tripPurposeId = this.formStore.productConditionsForm.calculatorForm.purpose.id;
|
|
1977
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'WorkStudy') {
|
|
1978
|
+
priceForm.workTypeId = this.formStore.productConditionsForm.calculatorForm.workType.id;
|
|
1979
|
+
}
|
|
1980
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'Sport') {
|
|
1981
|
+
priceForm.sportsTypeId = this.formStore.productConditionsForm.calculatorForm.sportsType!.id;
|
|
1982
|
+
}
|
|
1983
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
1984
|
+
priceForm.singleTripDays = Number(this.formStore.productConditionsForm.calculatorForm.days);
|
|
1985
|
+
} else {
|
|
1986
|
+
priceForm.multipleTripMaxDays = Number(this.formStore.productConditionsForm.calculatorForm.maxDays.nameRu);
|
|
1987
|
+
priceForm.tripInsurancePeriod = Number(this.formStore.productConditionsForm.calculatorForm.period.nameRu);
|
|
1988
|
+
}
|
|
1989
|
+
if (this.isTask()) {
|
|
1990
|
+
priceForm.processInstanceId = this.formStore.applicationData.processInstanceId!;
|
|
1991
|
+
priceForm.id = taskId!;
|
|
1992
|
+
priceForm.age = Number(this.formStore.policyholderForm.age);
|
|
1993
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Multiple') {
|
|
1994
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
1995
|
+
} else {
|
|
1996
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
1997
|
+
priceForm.endDate = formatDate(this.formStore.productConditionsForm.calculatorForm.endDate!)!.toISOString();
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
const result = await this.api.getCalculator(priceForm);
|
|
2001
|
+
if (this.isTask() && taskId) {
|
|
2002
|
+
await this.api.setApplication(priceForm);
|
|
2003
|
+
const applicationData = await this.api.getApplicationData(taskId);
|
|
2004
|
+
this.formStore.applicationData = applicationData;
|
|
2005
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
2006
|
+
} else {
|
|
2007
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(result)} тг`;
|
|
2008
|
+
}
|
|
1594
2009
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1595
2010
|
} catch (err) {
|
|
1596
2011
|
ErrorHandler(err);
|
|
1597
2012
|
}
|
|
1598
2013
|
this.isLoading = false;
|
|
1599
2014
|
},
|
|
1600
|
-
async startApplication(member: Member) {
|
|
2015
|
+
async startApplication(member: Member, processCode?: number) {
|
|
1601
2016
|
if (!member.iin) return false;
|
|
1602
2017
|
try {
|
|
1603
2018
|
const data: StartApplicationType = {
|
|
1604
2019
|
clientId: member.id,
|
|
1605
2020
|
iin: member.iin.replace(/-/g, ''),
|
|
1606
2021
|
longName: member.longName ?? '',
|
|
1607
|
-
processCode: Number(this.processCode),
|
|
2022
|
+
processCode: processCode ?? Number(this.processCode),
|
|
1608
2023
|
policyId: 0,
|
|
1609
2024
|
};
|
|
1610
2025
|
const response = await this.api.startApplication(data);
|
|
@@ -1618,11 +2033,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1618
2033
|
this.isLoading = onlyGet;
|
|
1619
2034
|
try {
|
|
1620
2035
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
1621
|
-
if (this.processCode !== applicationData.processCode) {
|
|
2036
|
+
if (this.processCode !== applicationData.processCode && !this.isPension) {
|
|
1622
2037
|
this.isLoading = false;
|
|
1623
2038
|
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
|
|
1624
2039
|
return;
|
|
1625
2040
|
}
|
|
2041
|
+
this.formStore.regNumber = applicationData.regNumber;
|
|
1626
2042
|
this.formStore.applicationData = applicationData;
|
|
1627
2043
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
1628
2044
|
|
|
@@ -1634,7 +2050,6 @@ export const useDataStore = defineStore('data', {
|
|
|
1634
2050
|
this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
|
|
1635
2051
|
this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
|
|
1636
2052
|
this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
|
|
1637
|
-
|
|
1638
2053
|
this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
|
|
1639
2054
|
this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
|
|
1640
2055
|
|
|
@@ -1656,7 +2071,49 @@ export const useDataStore = defineStore('data', {
|
|
|
1656
2071
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
1657
2072
|
this.formStore.finCenterData.date = reformatDate(applicationData.finCenterData.date);
|
|
1658
2073
|
}
|
|
2074
|
+
if ('lifeTripApp' in applicationData && setProductConditions) {
|
|
2075
|
+
const tripType = this.types.find((i: Value) => i.id === applicationData.lifeTripApp.tripTypeId);
|
|
2076
|
+
this.formStore.productConditionsForm.calculatorForm.type = tripType ? tripType : new Value();
|
|
2077
|
+
|
|
2078
|
+
const countries: CountryValue[] = [];
|
|
2079
|
+
for (let i in applicationData.lifeTripApp.lifeTripCountries) {
|
|
2080
|
+
const tripCountry = this.dicAllCountries.find(country => country.id === applicationData.lifeTripApp.lifeTripCountries[i]);
|
|
2081
|
+
if (tripCountry) {
|
|
2082
|
+
countries.push(tripCountry);
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
this.formStore.productConditionsForm.calculatorForm.countries = countries ? countries : [];
|
|
2086
|
+
|
|
2087
|
+
if (this.formStore.productConditionsForm.calculatorForm.countries.length && this.formStore.productConditionsForm.calculatorForm.type.nameRu != null) {
|
|
2088
|
+
await this.getTripInsuredAmount(false);
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
const amount = this.amountArray.find((i: Value) => i.id === applicationData.lifeTripApp.insuredAmountId);
|
|
2092
|
+
this.formStore.productConditionsForm.calculatorForm.amount = amount ? amount : new Value();
|
|
1659
2093
|
|
|
2094
|
+
const purpose = this.purposes.find((i: Value) => i.id === applicationData.lifeTripApp.tripPurposeId);
|
|
2095
|
+
this.formStore.productConditionsForm.calculatorForm.purpose = purpose ? purpose : new Value();
|
|
2096
|
+
|
|
2097
|
+
if (applicationData.lifeTripApp.workTypeId != null) {
|
|
2098
|
+
const work = this.workTypes.find((i: Value) => i.id === applicationData.lifeTripApp.workTypeId);
|
|
2099
|
+
this.formStore.productConditionsForm.calculatorForm.workType = work ? work : new Value();
|
|
2100
|
+
}
|
|
2101
|
+
if (applicationData.lifeTripApp.sportsTypeId != null) {
|
|
2102
|
+
const sport = this.sportsTypes.find((i: Value) => i.id === applicationData.lifeTripApp.sportsTypeId);
|
|
2103
|
+
this.formStore.productConditionsForm.calculatorForm.sportsType = sport ? sport : new Value();
|
|
2104
|
+
}
|
|
2105
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
2106
|
+
this.formStore.productConditionsForm.calculatorForm.days = Number(applicationData.lifeTripApp.singleTripDays);
|
|
2107
|
+
} else {
|
|
2108
|
+
await this.getPeriod();
|
|
2109
|
+
this.formStore.productConditionsForm.calculatorForm.maxDays = this.maxDaysAllArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.multipleTripMaxDays)!;
|
|
2110
|
+
this.formStore.productConditionsForm.calculatorForm.period = this.periodArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.tripInsurancePeriod)!;
|
|
2111
|
+
}
|
|
2112
|
+
this.formStore.productConditionsForm.calculatorForm.startDate = reformatDate(applicationData.lifeTripApp.startDate);
|
|
2113
|
+
this.formStore.productConditionsForm.calculatorForm.endDate = reformatDate(applicationData.lifeTripApp.endDate);
|
|
2114
|
+
|
|
2115
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
2116
|
+
}
|
|
1660
2117
|
if (fetchMembers) {
|
|
1661
2118
|
let allMembers = [
|
|
1662
2119
|
{
|
|
@@ -1674,6 +2131,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1674
2131
|
});
|
|
1675
2132
|
}
|
|
1676
2133
|
|
|
2134
|
+
if (applicationData.slave) {
|
|
2135
|
+
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2136
|
+
}
|
|
2137
|
+
|
|
1677
2138
|
if (insuredData && insuredData.length) {
|
|
1678
2139
|
insuredData.forEach((member, index) => {
|
|
1679
2140
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -1713,7 +2174,6 @@ export const useDataStore = defineStore('data', {
|
|
|
1713
2174
|
}
|
|
1714
2175
|
});
|
|
1715
2176
|
}
|
|
1716
|
-
|
|
1717
2177
|
await Promise.allSettled(
|
|
1718
2178
|
allMembers.map(async member => {
|
|
1719
2179
|
await this.getContragentById(member.insisId, member.key, false, member.index);
|
|
@@ -1726,7 +2186,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1726
2186
|
if (insuredData && insuredData.length) {
|
|
1727
2187
|
insuredData.forEach((each, index) => {
|
|
1728
2188
|
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
1729
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
2189
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1730
2190
|
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1731
2191
|
});
|
|
1732
2192
|
}
|
|
@@ -1734,11 +2194,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1734
2194
|
if (beneficiaryData && beneficiaryData.length) {
|
|
1735
2195
|
beneficiaryData.forEach((each, index) => {
|
|
1736
2196
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
1737
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
2197
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1738
2198
|
this.formStore.beneficiaryForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1739
2199
|
this.formStore.beneficiaryForm[index].percentageOfPayoutAmount = each.percentage;
|
|
1740
2200
|
if (this.isLiferenta || this.isBolashak) {
|
|
1741
|
-
const insurancePay = this.insurancePay.find(i => i.id == each.beneficiaryInsurancePayId);
|
|
2201
|
+
const insurancePay = this.insurancePay.find((i: Value) => i.id == each.beneficiaryInsurancePayId);
|
|
1742
2202
|
this.formStore.beneficiaryForm[index].insurancePay = insurancePay ? insurancePay : new Value();
|
|
1743
2203
|
}
|
|
1744
2204
|
});
|
|
@@ -1770,7 +2230,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1770
2230
|
this.formStore.policyholdersRepresentativeForm.isNotary = spokesmanData.isNotary;
|
|
1771
2231
|
}
|
|
1772
2232
|
}
|
|
1773
|
-
if (setProductConditions) {
|
|
2233
|
+
if (setProductConditions && !!applicationData.policyAppDto) {
|
|
2234
|
+
this.formStore.policyNumber = applicationData.policyAppDto.policyNumber;
|
|
2235
|
+
this.formStore.contractDate = reformatDate(applicationData.policyAppDto.contractDate);
|
|
1774
2236
|
this.formStore.productConditionsForm.coverPeriod = applicationData.policyAppDto.coverPeriod;
|
|
1775
2237
|
this.formStore.productConditionsForm.payPeriod = applicationData.policyAppDto.payPeriod;
|
|
1776
2238
|
// this.formStore.productConditionsForm.annualIncome = applicationData.policyAppDto.annualIncome?.toString();
|
|
@@ -1824,6 +2286,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1824
2286
|
});
|
|
1825
2287
|
this.formStore.productConditionsForm.riskGroup = riskGroup ? riskGroup : this.riskGroup.find(item => item.id == 1) ?? new Value();
|
|
1826
2288
|
}
|
|
2289
|
+
if (this.isPension && this.formStore.policyholderForm.bankInfo) {
|
|
2290
|
+
this.formStore.insuredForm[0].bankInfo = this.formStore.policyholderForm.bankInfo;
|
|
2291
|
+
}
|
|
1827
2292
|
} catch (err) {
|
|
1828
2293
|
ErrorHandler(err);
|
|
1829
2294
|
if (err instanceof AxiosError) {
|
|
@@ -1858,7 +2323,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1858
2323
|
try {
|
|
1859
2324
|
const data = {
|
|
1860
2325
|
taskId: taskId,
|
|
1861
|
-
decision: decision,
|
|
2326
|
+
decision: decision.replace(/custom/i, '') as keyof typeof constants.actions,
|
|
1862
2327
|
};
|
|
1863
2328
|
await this.api.sendTask(comment === null ? data : { ...data, comment: comment });
|
|
1864
2329
|
this.showToaster('success', this.t('toaster.successOperation'), 3000);
|
|
@@ -1866,6 +2331,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1866
2331
|
return true;
|
|
1867
2332
|
} catch (err) {
|
|
1868
2333
|
this.isLoading = false;
|
|
2334
|
+
this.isButtonsLoading = false;
|
|
1869
2335
|
return ErrorHandler(err);
|
|
1870
2336
|
}
|
|
1871
2337
|
},
|
|
@@ -1886,14 +2352,17 @@ export const useDataStore = defineStore('data', {
|
|
|
1886
2352
|
break;
|
|
1887
2353
|
}
|
|
1888
2354
|
case constants.actions.reject:
|
|
2355
|
+
case constants.actions.cancel:
|
|
1889
2356
|
case constants.actions.return:
|
|
2357
|
+
case constants.actions.signed:
|
|
1890
2358
|
case constants.actions.rejectclient:
|
|
1891
|
-
case constants.actions.accept:
|
|
2359
|
+
case constants.actions.accept:
|
|
2360
|
+
case constants.actions.payed: {
|
|
1892
2361
|
try {
|
|
1893
2362
|
const sended = await this.sendTask(taskId, action, comment);
|
|
1894
2363
|
if (!sended) return;
|
|
1895
2364
|
this.formStore.$reset();
|
|
1896
|
-
if (this.isEFO || this.isAML) {
|
|
2365
|
+
if (this.isEFO || this.isAML || this.isAULETTI) {
|
|
1897
2366
|
await this.router.push({ name: 'Insurance-Product' });
|
|
1898
2367
|
} else {
|
|
1899
2368
|
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.successOperation') + 'SUCCESS');
|
|
@@ -1905,10 +2374,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1905
2374
|
}
|
|
1906
2375
|
case constants.actions.affiliate: {
|
|
1907
2376
|
try {
|
|
1908
|
-
const sended = await this.sendUnderwritingCouncilTask({
|
|
2377
|
+
const sended = await this.sendUnderwritingCouncilTask({
|
|
2378
|
+
taskId: taskId,
|
|
2379
|
+
decision: constants.actions.accept,
|
|
2380
|
+
});
|
|
1909
2381
|
if (!sended) return;
|
|
1910
2382
|
this.formStore.$reset();
|
|
1911
|
-
if (this.isEFO || this.isAML) {
|
|
2383
|
+
if (this.isEFO || this.isAML || this.isAULETTI) {
|
|
1912
2384
|
await this.router.push({ name: 'Insurance-Product' });
|
|
1913
2385
|
} else {
|
|
1914
2386
|
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.successOperation') + 'SUCCESS');
|
|
@@ -1966,6 +2438,17 @@ export const useDataStore = defineStore('data', {
|
|
|
1966
2438
|
if (!!this.formStore.applicationData[whichMember].profession) this.formStore[whichForm].job = this.formStore.applicationData[whichMember].profession;
|
|
1967
2439
|
if (!!this.formStore.applicationData[whichMember].position) this.formStore[whichForm].jobPosition = this.formStore.applicationData[whichMember].position;
|
|
1968
2440
|
if (!!this.formStore.applicationData[whichMember].jobName) this.formStore[whichForm].jobPlace = this.formStore.applicationData[whichMember].jobName;
|
|
2441
|
+
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.applicationData.pensionApp) {
|
|
2442
|
+
this.formStore[whichForm].bankInfo.iik = this.formStore.applicationData.pensionApp.account;
|
|
2443
|
+
this.formStore[whichForm].bankInfo.bik = this.formStore.applicationData.pensionApp.bankBik;
|
|
2444
|
+
const bank = this.banks.find(i => i.ids === this.formStore.applicationData.pensionApp.bankBin);
|
|
2445
|
+
if (bank) {
|
|
2446
|
+
this.formStore[whichForm].bankInfo.bankName = bank;
|
|
2447
|
+
this.formStore[whichForm].bankInfo.bin = bank.ids as string;
|
|
2448
|
+
} else {
|
|
2449
|
+
this.formStore[whichForm].bankInfo.bankName = new Value();
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
1969
2452
|
},
|
|
1970
2453
|
setMembersFieldIndex(whichForm: MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
1971
2454
|
if ('familyStatus' in this.formStore[whichForm][index]) {
|
|
@@ -1988,7 +2471,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1988
2471
|
this.formStore[whichForm][index].jobPlace = this.formStore.applicationData[whichMember][index].jobName;
|
|
1989
2472
|
}
|
|
1990
2473
|
},
|
|
1991
|
-
async signDocument() {
|
|
2474
|
+
async signDocument(type: string = 'electronic') {
|
|
1992
2475
|
try {
|
|
1993
2476
|
if (this.formStore.signUrls.length) {
|
|
1994
2477
|
return this.formStore.signUrls;
|
|
@@ -1996,39 +2479,242 @@ export const useDataStore = defineStore('data', {
|
|
|
1996
2479
|
const prepareSignDocuments = (): SignDataType[] => {
|
|
1997
2480
|
switch (this.formStore.applicationData.statusCode) {
|
|
1998
2481
|
case 'ContractSignedFrom':
|
|
1999
|
-
return [
|
|
2482
|
+
return [
|
|
2483
|
+
{
|
|
2484
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2485
|
+
name: 'Contract',
|
|
2486
|
+
format: 'pdf',
|
|
2487
|
+
},
|
|
2488
|
+
];
|
|
2489
|
+
case 'AttachAppContractForm':
|
|
2490
|
+
if (type === 'qrXml') {
|
|
2491
|
+
return [
|
|
2492
|
+
{
|
|
2493
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2494
|
+
name: 'PAEnpf_Agreement',
|
|
2495
|
+
format: 'xml',
|
|
2496
|
+
},
|
|
2497
|
+
];
|
|
2498
|
+
} else {
|
|
2499
|
+
return [
|
|
2500
|
+
{
|
|
2501
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2502
|
+
name: this.processCode == 1 ? 'PA_Statement' : 'PA_RefundStatement',
|
|
2503
|
+
format: 'pdf',
|
|
2504
|
+
},
|
|
2505
|
+
];
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
case 'ContractSignedByAuthorizedPerson':
|
|
2509
|
+
return [
|
|
2510
|
+
{
|
|
2511
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2512
|
+
name: this.processCode == 1 ? 'PA_Contract' : 'PA_Contract',
|
|
2513
|
+
format: 'pdf',
|
|
2514
|
+
},
|
|
2515
|
+
];
|
|
2516
|
+
case 'ContractSignedByAuthorizedPerson':
|
|
2517
|
+
return [
|
|
2518
|
+
{
|
|
2519
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2520
|
+
name: this.processCode == 1 ? 'PA_Contract' : 'PA_Contract',
|
|
2521
|
+
format: 'pdf',
|
|
2522
|
+
},
|
|
2523
|
+
];
|
|
2000
2524
|
default:
|
|
2001
2525
|
return [
|
|
2002
|
-
{
|
|
2003
|
-
|
|
2526
|
+
{
|
|
2527
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2528
|
+
name: 'Agreement',
|
|
2529
|
+
format: 'pdf',
|
|
2530
|
+
},
|
|
2531
|
+
{
|
|
2532
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2533
|
+
name: 'Statement',
|
|
2534
|
+
format: 'pdf',
|
|
2535
|
+
},
|
|
2004
2536
|
];
|
|
2005
2537
|
}
|
|
2006
2538
|
};
|
|
2007
2539
|
const data = prepareSignDocuments();
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2540
|
+
if (type === 'qr') {
|
|
2541
|
+
const groupId = await this.api.signQR(data);
|
|
2542
|
+
return groupId;
|
|
2543
|
+
} else if (type === 'qrXml') {
|
|
2544
|
+
const signData = await this.api.signXml(data);
|
|
2545
|
+
return signData;
|
|
2546
|
+
} else if (type === 'signature') {
|
|
2547
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2548
|
+
let activeTokens;
|
|
2549
|
+
try {
|
|
2550
|
+
await ncaLayerClient.connect();
|
|
2551
|
+
activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2552
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2553
|
+
const agreementXml = await this.getDocument(this.formStore.applicationData.processInstanceId as string);
|
|
2554
|
+
const wnd = window.open('about:blank', '', '_blank');
|
|
2555
|
+
wnd?.document.write(agreementXml as any);
|
|
2556
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml, 'SIGNATURE', '');
|
|
2557
|
+
const document = {
|
|
2558
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2559
|
+
name: 'PAEnpf_Agreement',
|
|
2560
|
+
format: 'xml',
|
|
2561
|
+
};
|
|
2562
|
+
const signData = await this.api.signXml([document]);
|
|
2563
|
+
let data = new FormData();
|
|
2564
|
+
data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2565
|
+
data.append('xmlData', signedAgreement);
|
|
2566
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2567
|
+
data.append('format', 'xml');
|
|
2568
|
+
data.append('EdsXmlId', signData.data);
|
|
2569
|
+
await this.api.uploadXml(data);
|
|
2570
|
+
await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
|
|
2571
|
+
this.showToaster('success', this.t('pension.consentGiven'), 3000);
|
|
2572
|
+
} catch (error) {
|
|
2573
|
+
this.showToaster('error', String(error));
|
|
2574
|
+
return;
|
|
2575
|
+
}
|
|
2576
|
+
} else {
|
|
2577
|
+
if (this.processCode === 1 || this.processCode === 2 || this.processCode === 3) {
|
|
2578
|
+
const result = await this.api.signBts(data);
|
|
2579
|
+
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2580
|
+
} else {
|
|
2581
|
+
const result = await this.api.signDocument(data);
|
|
2582
|
+
this.formStore.signUrls = result;
|
|
2583
|
+
}
|
|
2584
|
+
return this.formStore.signUrls;
|
|
2585
|
+
}
|
|
2011
2586
|
} catch (err) {
|
|
2012
2587
|
ErrorHandler(err);
|
|
2013
2588
|
}
|
|
2014
2589
|
},
|
|
2015
|
-
async
|
|
2590
|
+
async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
|
|
2016
2591
|
try {
|
|
2017
|
-
|
|
2018
|
-
const
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2592
|
+
this.isButtonsLoading = true;
|
|
2593
|
+
const response: any = await this.api.downloadTemplate(documentType, processInstanceId);
|
|
2594
|
+
const blob = new Blob([response], {
|
|
2595
|
+
type: `application/${fileType}`,
|
|
2596
|
+
});
|
|
2597
|
+
const url = window.URL.createObjectURL(blob);
|
|
2598
|
+
const link = document.createElement('a');
|
|
2599
|
+
link.href = url;
|
|
2600
|
+
switch (documentType) {
|
|
2601
|
+
case constants.documentTypes.insuredsList:
|
|
2602
|
+
link.setAttribute('download', 'РФ-ДС-028 Список застрахованных ГССЖ_ГНС, изд.1.xls');
|
|
2603
|
+
break;
|
|
2604
|
+
case constants.documentTypes.statement:
|
|
2605
|
+
link.setAttribute('download', 'Заявление.pdf');
|
|
2606
|
+
break;
|
|
2607
|
+
case constants.documentTypes.contract:
|
|
2608
|
+
link.setAttribute('download', 'Договор страхования.pdf');
|
|
2609
|
+
break;
|
|
2610
|
+
case constants.documentTypes.application1:
|
|
2611
|
+
link.setAttribute('download', 'Приложение №1.xls');
|
|
2612
|
+
break;
|
|
2613
|
+
case constants.documentTypes.questionnaireInsured:
|
|
2614
|
+
link.setAttribute('download', 'Анкета Застрахованного.docx');
|
|
2615
|
+
break;
|
|
2616
|
+
case constants.documentTypes.invoicePayment:
|
|
2617
|
+
link.setAttribute('download', 'Счет на оплату');
|
|
2618
|
+
break;
|
|
2619
|
+
}
|
|
2620
|
+
document.body.appendChild(link);
|
|
2621
|
+
link.click();
|
|
2028
2622
|
} catch (err) {
|
|
2029
|
-
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2623
|
+
ErrorHandler(err);
|
|
2624
|
+
}
|
|
2625
|
+
this.isButtonsLoading = false;
|
|
2626
|
+
},
|
|
2627
|
+
async sendTemplateToEmail(email: string) {
|
|
2628
|
+
try {
|
|
2629
|
+
this.isButtonsLoading = true;
|
|
2630
|
+
await this.api.sendTemplateToEmail(email);
|
|
2631
|
+
this.showToaster('info', this.t('toaster.successfullyDocSent'), 5000);
|
|
2632
|
+
} catch (err) {
|
|
2633
|
+
ErrorHandler(err);
|
|
2634
|
+
}
|
|
2635
|
+
this.isButtonsLoading = false;
|
|
2636
|
+
},
|
|
2637
|
+
async sendInvoiceToEmail(processInstanceId: string | number, email: string) {
|
|
2638
|
+
try {
|
|
2639
|
+
this.isButtonsLoading = true;
|
|
2640
|
+
await this.api.sendInvoiceToEmail(processInstanceId, email);
|
|
2641
|
+
this.showToaster('info', this.t('toaster.successfullyDocSent'), 5000);
|
|
2642
|
+
} catch (err) {
|
|
2643
|
+
ErrorHandler(err);
|
|
2644
|
+
}
|
|
2645
|
+
this.isButtonsLoading = false;
|
|
2646
|
+
},
|
|
2647
|
+
async generateDocument() {
|
|
2648
|
+
try {
|
|
2649
|
+
this.isButtonsLoading = true;
|
|
2650
|
+
this.formStore.needToScanSignedContract = true;
|
|
2651
|
+
const data: SignDataType = {
|
|
2652
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2653
|
+
name: 'Contract',
|
|
2654
|
+
format: 'pdf',
|
|
2655
|
+
};
|
|
2656
|
+
const response: any = await this.api.generateDocument(data);
|
|
2657
|
+
const blob = new Blob([response], {
|
|
2658
|
+
type: `application/pdf`,
|
|
2659
|
+
});
|
|
2660
|
+
this.showToaster('info', this.t('toaster.needToSignContract'), 100000);
|
|
2661
|
+
const url = window.URL.createObjectURL(blob);
|
|
2662
|
+
const link = document.createElement('a');
|
|
2663
|
+
link.href = url;
|
|
2664
|
+
link.setAttribute('download', this.formStore.regNumber + ' Договор страхования');
|
|
2665
|
+
document.body.appendChild(link);
|
|
2666
|
+
link.click();
|
|
2667
|
+
} catch (err) {
|
|
2668
|
+
ErrorHandler(err);
|
|
2669
|
+
}
|
|
2670
|
+
this.isButtonsLoading = false;
|
|
2671
|
+
},
|
|
2672
|
+
async generatePDFDocument(name: string, code: string, format: 'pdf' | 'doc' = 'pdf', open: boolean = false) {
|
|
2673
|
+
try {
|
|
2674
|
+
this.isButtonsLoading = true;
|
|
2675
|
+
this.formStore.needToScanSignedContract = true;
|
|
2676
|
+
const data: any = {
|
|
2677
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2678
|
+
name: name,
|
|
2679
|
+
format: format,
|
|
2680
|
+
};
|
|
2681
|
+
const response: any = await this.api.generatePdfDocument(data);
|
|
2682
|
+
const blob = new Blob([response], {
|
|
2683
|
+
type: format === 'pdf' ? `application/pdf` : `application/vnd.openxmlformats-officedocument.wordprocessingml.document`,
|
|
2684
|
+
});
|
|
2685
|
+
const url = window.URL.createObjectURL(blob);
|
|
2686
|
+
const link = document.createElement('a');
|
|
2687
|
+
link.href = url;
|
|
2688
|
+
link.setAttribute('download', this.formStore.regNumber + ` ${this.dicFileTypeList.find((i: Value) => i.code == code)?.nameRu}`);
|
|
2689
|
+
document.body.appendChild(link);
|
|
2690
|
+
link.click();
|
|
2691
|
+
if (open) {
|
|
2692
|
+
window.open(url, '_blank', `right=100`);
|
|
2693
|
+
}
|
|
2694
|
+
return response;
|
|
2695
|
+
} catch (err) {
|
|
2696
|
+
ErrorHandler(err);
|
|
2697
|
+
} finally {
|
|
2698
|
+
this.isButtonsLoading = false;
|
|
2699
|
+
}
|
|
2700
|
+
},
|
|
2701
|
+
async registerNumber() {
|
|
2702
|
+
try {
|
|
2703
|
+
if (!this.formStore.finCenterData.date) return;
|
|
2704
|
+
const formattedData = formatDate(this.formStore.finCenterData.date);
|
|
2705
|
+
if (!formattedData) return;
|
|
2706
|
+
this.isLoading = true;
|
|
2707
|
+
const data: RegNumberDataType = {
|
|
2708
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2709
|
+
regNumber: String(this.formStore.finCenterData.regNumber),
|
|
2710
|
+
date: formattedData.toISOString(),
|
|
2711
|
+
};
|
|
2712
|
+
const result = await this.api.registerNumber(data);
|
|
2713
|
+
return result;
|
|
2714
|
+
} catch (err) {
|
|
2715
|
+
return ErrorHandler(err);
|
|
2716
|
+
} finally {
|
|
2717
|
+
this.isLoading = false;
|
|
2032
2718
|
}
|
|
2033
2719
|
},
|
|
2034
2720
|
async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
|
|
@@ -2082,6 +2768,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2082
2768
|
const recalculatedValue = await this.api.reCalculate(data);
|
|
2083
2769
|
if (!!recalculatedValue) {
|
|
2084
2770
|
await this.getApplicationData(taskId, false, false, false, true);
|
|
2771
|
+
if (this.isGons) {
|
|
2772
|
+
this.formStore.productConditionsForm.isRecalculated = true;
|
|
2773
|
+
}
|
|
2085
2774
|
this.showToaster(
|
|
2086
2775
|
'success',
|
|
2087
2776
|
`${this.t('toaster.successRecalculation')}. ${whichSum == 'insurancePremiumPerMonth' ? 'Страховая премия' : 'Страховая сумма'}: ${this.getNumberWithSpaces(
|
|
@@ -2123,7 +2812,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2123
2812
|
}
|
|
2124
2813
|
}
|
|
2125
2814
|
} else {
|
|
2126
|
-
if (this.formStore[localKey].some(
|
|
2815
|
+
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2127
2816
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
2128
2817
|
return false;
|
|
2129
2818
|
}
|
|
@@ -2221,8 +2910,8 @@ export const useDataStore = defineStore('data', {
|
|
|
2221
2910
|
}
|
|
2222
2911
|
if (localCheck === false) {
|
|
2223
2912
|
try {
|
|
2224
|
-
if (this.isInitiator() &&
|
|
2225
|
-
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2913
|
+
if (this.isInitiator() && this.members.beneficialOwnerApp.has) {
|
|
2914
|
+
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2226
2915
|
await Promise.allSettled(
|
|
2227
2916
|
this.formStore.applicationData.beneficialOwnerApp.map(async (member: any) => {
|
|
2228
2917
|
await this.api.deleteMember('BeneficialOwner', member.id);
|
|
@@ -2242,124 +2931,127 @@ export const useDataStore = defineStore('data', {
|
|
|
2242
2931
|
if (!anketa) return false;
|
|
2243
2932
|
const list = anketa.body;
|
|
2244
2933
|
if (!list || (list && list.length === 0)) return false;
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
if (
|
|
2248
|
-
|
|
2934
|
+
const isAnketaValid = ref<boolean>(true);
|
|
2935
|
+
list.forEach(i => {
|
|
2936
|
+
if (
|
|
2937
|
+
(i.first.definedAnswers === 'N' && !i.first.answerText) ||
|
|
2938
|
+
(i.first.definedAnswers === 'Y' && !i.first.answerName) ||
|
|
2939
|
+
(i.first.definedAnswers === 'D' && !i.first.answerName?.match(new RegExp('Нет', 'i')) && !i.first.answerText)
|
|
2940
|
+
) {
|
|
2941
|
+
isAnketaValid.value = false;
|
|
2942
|
+
return false;
|
|
2249
2943
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2944
|
+
if (this.controls.isSecondAnketaRequired && i.first.definedAnswers === 'Y' && i.first.answerName?.match(new RegExp('Да', 'i'))) {
|
|
2945
|
+
if (i.second && i.second.length) {
|
|
2946
|
+
const isValid = i.second.every(second => (second.definedAnswers === 'N' ? !!second.answerText : !!second.answerName));
|
|
2947
|
+
if (!isValid) {
|
|
2948
|
+
isAnketaValid.value = false;
|
|
2949
|
+
this.showToaster('info', this.t('toaster.emptySecondAnketa', { text: i.first.name }), 5000);
|
|
2950
|
+
return false;
|
|
2951
|
+
}
|
|
2952
|
+
} else {
|
|
2953
|
+
// TODO уточнить
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2956
|
+
});
|
|
2957
|
+
return isAnketaValid.value;
|
|
2252
2958
|
},
|
|
2253
2959
|
async validateAllForms(taskId: string) {
|
|
2254
2960
|
this.isLoading = true;
|
|
2255
2961
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
2256
2962
|
if (areMembersValid) {
|
|
2257
|
-
if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) {
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
this.formStore.applicationData.processInstanceId,
|
|
2264
|
-
this.
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2289
|
-
}),
|
|
2290
|
-
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2291
|
-
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2292
|
-
}),
|
|
2293
|
-
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2294
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2295
|
-
}),
|
|
2296
|
-
])
|
|
2297
|
-
: await Promise.allSettled([
|
|
2298
|
-
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2299
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2300
|
-
}),
|
|
2301
|
-
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2302
|
-
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2303
|
-
}),
|
|
2304
|
-
]);
|
|
2305
|
-
} else {
|
|
2306
|
-
await Promise.allSettled([
|
|
2307
|
-
this.getQuestionList(
|
|
2308
|
-
'health',
|
|
2309
|
-
this.formStore.applicationData.processInstanceId,
|
|
2310
|
-
this.formStore.applicationData.insuredApp[0].id,
|
|
2311
|
-
'surveyByHealthBase',
|
|
2312
|
-
'surveyByHealthSecond',
|
|
2313
|
-
),
|
|
2314
|
-
this.isClientAnketaCondition &&
|
|
2315
|
-
this.getQuestionList(
|
|
2316
|
-
'health',
|
|
2317
|
-
this.formStore.applicationData.processInstanceId,
|
|
2318
|
-
this.formStore.applicationData.clientApp.id,
|
|
2319
|
-
'surveyByHealthBasePolicyholder',
|
|
2320
|
-
'surveyByHealthSecond',
|
|
2321
|
-
'policyholder',
|
|
2322
|
-
),
|
|
2323
|
-
,
|
|
2324
|
-
]);
|
|
2325
|
-
this.isClientAnketaCondition
|
|
2326
|
-
? await Promise.allSettled([
|
|
2327
|
-
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2328
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2329
|
-
}),
|
|
2330
|
-
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2331
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2332
|
-
}),
|
|
2333
|
-
])
|
|
2334
|
-
: await Promise.allSettled(
|
|
2335
|
-
this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2336
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2337
|
-
}),
|
|
2338
|
-
);
|
|
2339
|
-
}
|
|
2340
|
-
if (this.validateAnketa('surveyByHealthBase')) {
|
|
2341
|
-
let hasCriticalAndItsValid = null;
|
|
2342
|
-
if (hasCritical && hasCritical.coverSumName !== 'не включено') {
|
|
2343
|
-
if (this.validateAnketa('surveyByCriticalBase')) {
|
|
2344
|
-
hasCriticalAndItsValid = true;
|
|
2345
|
-
} else {
|
|
2346
|
-
hasCriticalAndItsValid = false;
|
|
2347
|
-
this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
|
|
2348
|
-
}
|
|
2963
|
+
if ((!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) || this.isPension) {
|
|
2964
|
+
if (this.controls.hasAnketa) {
|
|
2965
|
+
const hasCritical =
|
|
2966
|
+
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
2967
|
+
if (hasCritical === null || (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')))) {
|
|
2968
|
+
await Promise.allSettled([
|
|
2969
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
2970
|
+
this.isClientAnketaCondition &&
|
|
2971
|
+
this.getQuestionList(
|
|
2972
|
+
'health',
|
|
2973
|
+
this.formStore.applicationData.processInstanceId,
|
|
2974
|
+
this.formStore.applicationData.clientApp.id,
|
|
2975
|
+
'surveyByHealthBasePolicyholder',
|
|
2976
|
+
'policyholder',
|
|
2977
|
+
),
|
|
2978
|
+
,
|
|
2979
|
+
]);
|
|
2980
|
+
this.isClientAnketaCondition
|
|
2981
|
+
? await Promise.allSettled([
|
|
2982
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2983
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2984
|
+
}),
|
|
2985
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2986
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2987
|
+
}),
|
|
2988
|
+
])
|
|
2989
|
+
: await Promise.allSettled(
|
|
2990
|
+
this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2991
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2992
|
+
}),
|
|
2993
|
+
);
|
|
2349
2994
|
} else {
|
|
2350
|
-
|
|
2995
|
+
await Promise.allSettled([
|
|
2996
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
2997
|
+
this.getQuestionList('critical', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByCriticalBase'),
|
|
2998
|
+
this.isClientAnketaCondition &&
|
|
2999
|
+
this.getQuestionList(
|
|
3000
|
+
'health',
|
|
3001
|
+
this.formStore.applicationData.processInstanceId,
|
|
3002
|
+
this.formStore.applicationData.clientApp.id,
|
|
3003
|
+
'surveyByHealthBasePolicyholder',
|
|
3004
|
+
'policyholder',
|
|
3005
|
+
),
|
|
3006
|
+
]);
|
|
3007
|
+
this.isClientAnketaCondition
|
|
3008
|
+
? await Promise.allSettled([
|
|
3009
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
3010
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
3011
|
+
}),
|
|
3012
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
3013
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
3014
|
+
}),
|
|
3015
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
3016
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
3017
|
+
}),
|
|
3018
|
+
])
|
|
3019
|
+
: await Promise.allSettled([
|
|
3020
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
3021
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
3022
|
+
}),
|
|
3023
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
3024
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
3025
|
+
}),
|
|
3026
|
+
]);
|
|
2351
3027
|
}
|
|
2352
|
-
if (
|
|
2353
|
-
|
|
2354
|
-
|
|
3028
|
+
if (this.validateAnketa('surveyByHealthBase')) {
|
|
3029
|
+
let hasCriticalAndItsValid = null;
|
|
3030
|
+
if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')) === null) {
|
|
3031
|
+
if (this.validateAnketa('surveyByCriticalBase')) {
|
|
3032
|
+
hasCriticalAndItsValid = true;
|
|
3033
|
+
} else {
|
|
3034
|
+
hasCriticalAndItsValid = false;
|
|
3035
|
+
this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
|
|
3036
|
+
}
|
|
3037
|
+
} else {
|
|
3038
|
+
hasCriticalAndItsValid = null;
|
|
3039
|
+
}
|
|
3040
|
+
if (hasCriticalAndItsValid === true || hasCriticalAndItsValid === null) {
|
|
3041
|
+
if (this.isClientAnketaCondition && this.validateAnketa('surveyByHealthBasePolicyholder') === false) {
|
|
3042
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketaPolicyholder'), 3000);
|
|
3043
|
+
this.isLoading = false;
|
|
3044
|
+
return false;
|
|
3045
|
+
}
|
|
2355
3046
|
this.isLoading = false;
|
|
2356
|
-
return
|
|
3047
|
+
return true;
|
|
2357
3048
|
}
|
|
2358
|
-
|
|
2359
|
-
|
|
3049
|
+
} else {
|
|
3050
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketa'), 3000);
|
|
2360
3051
|
}
|
|
2361
3052
|
} else {
|
|
2362
|
-
this.
|
|
3053
|
+
this.isLoading = false;
|
|
3054
|
+
return true;
|
|
2363
3055
|
}
|
|
2364
3056
|
} else {
|
|
2365
3057
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
@@ -2372,7 +3064,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2372
3064
|
async getFamilyInfo(iin: string, phoneNumber: string) {
|
|
2373
3065
|
this.isLoading = true;
|
|
2374
3066
|
try {
|
|
2375
|
-
const familyResponse = await this.api.getFamilyInfo({
|
|
3067
|
+
const familyResponse = await this.api.getFamilyInfo({
|
|
3068
|
+
iin: iin.replace(/-/g, ''),
|
|
3069
|
+
phoneNumber: formatPhone(phoneNumber),
|
|
3070
|
+
});
|
|
2376
3071
|
if (familyResponse.status === 'soap:Server') {
|
|
2377
3072
|
this.showToaster('error', `${familyResponse.statusName}. Отправьте запрос через некоторое время`, 5000);
|
|
2378
3073
|
this.isLoading = false;
|
|
@@ -2417,6 +3112,32 @@ export const useDataStore = defineStore('data', {
|
|
|
2417
3112
|
this.isLoading = false;
|
|
2418
3113
|
}
|
|
2419
3114
|
},
|
|
3115
|
+
async getKgd(iin: string) {
|
|
3116
|
+
try {
|
|
3117
|
+
const data = {
|
|
3118
|
+
iinBin: iin.replace(/-/g, ''),
|
|
3119
|
+
};
|
|
3120
|
+
const kgdResponse = await this.api.getKgd(data);
|
|
3121
|
+
return kgdResponse;
|
|
3122
|
+
} catch (err) {
|
|
3123
|
+
return ErrorHandler(err);
|
|
3124
|
+
}
|
|
3125
|
+
},
|
|
3126
|
+
async getGbdUl(bin: string) {
|
|
3127
|
+
if (!this.accessToken) return null;
|
|
3128
|
+
try {
|
|
3129
|
+
const decoded = jwtDecode(this.accessToken);
|
|
3130
|
+
const data = {
|
|
3131
|
+
userName: decoded.code,
|
|
3132
|
+
branchName: decoded.branchCode,
|
|
3133
|
+
bin: bin.replace(/-/g, ''),
|
|
3134
|
+
};
|
|
3135
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3136
|
+
return gbdulResponse;
|
|
3137
|
+
} catch (err) {
|
|
3138
|
+
return ErrorHandler(err);
|
|
3139
|
+
}
|
|
3140
|
+
},
|
|
2420
3141
|
async getContragentFromGBDFL(member: Member) {
|
|
2421
3142
|
// null - ожидание
|
|
2422
3143
|
// false - ошибка или неправильно
|
|
@@ -2448,13 +3169,27 @@ export const useDataStore = defineStore('data', {
|
|
|
2448
3169
|
this.isLoading = false;
|
|
2449
3170
|
return false;
|
|
2450
3171
|
}
|
|
3172
|
+
if (!gbdResponse.content) {
|
|
3173
|
+
let errMsg: string = '';
|
|
3174
|
+
if (gbdResponse.status) {
|
|
3175
|
+
errMsg += gbdResponse.status;
|
|
3176
|
+
}
|
|
3177
|
+
if (gbdResponse.statusName) {
|
|
3178
|
+
errMsg += gbdResponse.statusName;
|
|
3179
|
+
}
|
|
3180
|
+
if (!!errMsg) {
|
|
3181
|
+
this.showToaster('error', errMsg, 5000);
|
|
3182
|
+
}
|
|
3183
|
+
this.isLoading = false;
|
|
3184
|
+
return false;
|
|
3185
|
+
}
|
|
2451
3186
|
const { person } = parseXML(gbdResponse.content, true, 'person');
|
|
2452
3187
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
2453
3188
|
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
2454
3189
|
member.resetMember(false);
|
|
2455
3190
|
}
|
|
2456
3191
|
member.gosPersonData = person;
|
|
2457
|
-
await this.getContragent(member, false);
|
|
3192
|
+
await this.getContragent(member, false, false);
|
|
2458
3193
|
member.verifyDate = responseInfo.responseDate;
|
|
2459
3194
|
member.verifyType = 'GBDFL';
|
|
2460
3195
|
await this.saveInStoreUserGBDFL(person, member);
|
|
@@ -2469,11 +3204,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2469
3204
|
member.firstName = person.name;
|
|
2470
3205
|
member.lastName = person.surname;
|
|
2471
3206
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
3207
|
+
if (this.isLifetrip) {
|
|
3208
|
+
member.firstNameLat = person.engFirstName ? person.engFirstName : '';
|
|
3209
|
+
member.lastNameLat = person.engSurname ? person.engSurname : '';
|
|
3210
|
+
}
|
|
2472
3211
|
member.longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
|
|
2473
3212
|
member.birthDate = reformatDate(person.birthDate);
|
|
2474
3213
|
member.genderName = person.gender.nameRu;
|
|
2475
3214
|
|
|
2476
|
-
const gender = this.gender.find(i => i.id == person.gender.code);
|
|
3215
|
+
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
2477
3216
|
if (gender) member.gender = gender;
|
|
2478
3217
|
|
|
2479
3218
|
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
@@ -2556,7 +3295,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2556
3295
|
if ('length' in person.documents.document) {
|
|
2557
3296
|
const validDocument = person.documents.document.find((i: any) => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2558
3297
|
if (validDocument) {
|
|
2559
|
-
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
3298
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === '1UDL');
|
|
2560
3299
|
if (documentType) member.documentType = documentType;
|
|
2561
3300
|
|
|
2562
3301
|
member.documentNumber = validDocument.number;
|
|
@@ -2570,7 +3309,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2570
3309
|
} else {
|
|
2571
3310
|
const documentType =
|
|
2572
3311
|
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2573
|
-
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
3312
|
+
? this.documentTypes.find((i: Value) => i.ids === '1UDL')
|
|
2574
3313
|
: this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2575
3314
|
? this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2576
3315
|
: new Value();
|
|
@@ -2589,9 +3328,380 @@ export const useDataStore = defineStore('data', {
|
|
|
2589
3328
|
const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
|
|
2590
3329
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2591
3330
|
}
|
|
2592
|
-
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
3331
|
+
const economySectorCode = this.economySectorCode.find((i: Value) => i.ids === '500003.9');
|
|
2593
3332
|
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
2594
3333
|
},
|
|
3334
|
+
preparePersonData(data: any) {
|
|
3335
|
+
if (data) {
|
|
3336
|
+
Object.keys(data).forEach(key => {
|
|
3337
|
+
if (data[key] === Object(data[key]) && !!data[key]) {
|
|
3338
|
+
this.preparePersonData(data[key]);
|
|
3339
|
+
} else {
|
|
3340
|
+
if (data[key] !== null) {
|
|
3341
|
+
if (key === 'iin' || key === 'bin') data[key] = data[key].replace(/-/g, '');
|
|
3342
|
+
if (key === 'phoneNumber') data[key] = formatPhone(data[key]);
|
|
3343
|
+
if (key === 'issuedOn' || key === 'validUntil' || key === 'birthDate') data[key] = formatDate(data[key])?.toISOString() ?? '';
|
|
3344
|
+
if (key === 'nameRu' && data['ids']) data['id'] = data['ids'];
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
});
|
|
3348
|
+
}
|
|
3349
|
+
},
|
|
3350
|
+
async startApplicationV2(data: PolicyholderClass) {
|
|
3351
|
+
const policyholder = JSON.parse(JSON.stringify(data)) as any;
|
|
3352
|
+
if (!policyholder.clientData.iin) return false;
|
|
3353
|
+
this.preparePersonData(policyholder);
|
|
3354
|
+
keyDeleter(policyholder as PolicyholderClass, [
|
|
3355
|
+
'clientData.beneficalOwnerQuest',
|
|
3356
|
+
'clientData.identityDocument',
|
|
3357
|
+
'clientData.activityTypes',
|
|
3358
|
+
'clientData.citizenship',
|
|
3359
|
+
'clientData.addTaxResidency',
|
|
3360
|
+
'clientData.gender',
|
|
3361
|
+
'clientData.placeOfBirth',
|
|
3362
|
+
'clientData.authoritedPerson.actualAddress',
|
|
3363
|
+
'clientData.authoritedPerson.bankInfo',
|
|
3364
|
+
'clientData.authoritedPerson.economySectorCode',
|
|
3365
|
+
'clientData.authoritedPerson.legalAddress',
|
|
3366
|
+
'clientData.authoritedPerson.placeOfBirth',
|
|
3367
|
+
'clientData.authoritedPerson.resident',
|
|
3368
|
+
'clientData.authoritedPerson.taxResidentCountry',
|
|
3369
|
+
'clientData.authoritedPerson.addTaxResidency',
|
|
3370
|
+
]);
|
|
3371
|
+
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3372
|
+
try {
|
|
3373
|
+
const response = await this.api.startApplication(policyholder);
|
|
3374
|
+
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
3375
|
+
return response.processInstanceId;
|
|
3376
|
+
} catch (err) {
|
|
3377
|
+
return ErrorHandler(err);
|
|
3378
|
+
}
|
|
3379
|
+
},
|
|
3380
|
+
async saveClient(data: PolicyholderClass) {
|
|
3381
|
+
const policyholder = JSON.parse(JSON.stringify(data)) as any;
|
|
3382
|
+
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3383
|
+
this.preparePersonData(policyholder);
|
|
3384
|
+
try {
|
|
3385
|
+
await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, policyholder);
|
|
3386
|
+
} catch (err) {
|
|
3387
|
+
return ErrorHandler(err);
|
|
3388
|
+
}
|
|
3389
|
+
},
|
|
3390
|
+
async getApplicationDataV2(taskId: string) {
|
|
3391
|
+
this.isLoading = true;
|
|
3392
|
+
try {
|
|
3393
|
+
const applicationData = await this.api.getApplicationData(taskId);
|
|
3394
|
+
if (this.processCode !== applicationData.processCode) {
|
|
3395
|
+
this.isLoading = false;
|
|
3396
|
+
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
|
|
3397
|
+
return;
|
|
3398
|
+
}
|
|
3399
|
+
|
|
3400
|
+
this.formStore.applicationData = applicationData;
|
|
3401
|
+
this.formStore.regNumber = applicationData.regNumber;
|
|
3402
|
+
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
3403
|
+
|
|
3404
|
+
this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
|
|
3405
|
+
this.formStore.applicationTaskId = taskId;
|
|
3406
|
+
this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
|
|
3407
|
+
this.formStore.RegionPolicy.ids = applicationData.insisWorkDataApp.regionPolicy;
|
|
3408
|
+
this.formStore.ManagerPolicy.nameRu = applicationData.insisWorkDataApp.managerPolicyName;
|
|
3409
|
+
this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
|
|
3410
|
+
this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
|
|
3411
|
+
this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
|
|
3412
|
+
|
|
3413
|
+
this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
|
|
3414
|
+
this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
|
|
3415
|
+
|
|
3416
|
+
const { clientData } = applicationData.clientApp;
|
|
3417
|
+
const beneficialOwnerApp = applicationData.beneficialOwnerApp;
|
|
3418
|
+
const insuredApp = applicationData.insuredApp;
|
|
3419
|
+
const accidentIncidents = applicationData.accidentIncidentDtos;
|
|
3420
|
+
const clientId = applicationData.clientApp.id;
|
|
3421
|
+
|
|
3422
|
+
this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
|
|
3423
|
+
this.formStore.lfb.policyholder.isIpdl = applicationData.clientApp.isIpdl;
|
|
3424
|
+
this.formStore.lfb.policyholder.clientData = clientData;
|
|
3425
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
|
|
3426
|
+
this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
|
|
3427
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
|
|
3428
|
+
this.formStore.lfb.clientId = clientId;
|
|
3429
|
+
this.formStore.lfb.policyholder.clientData.authorityDetails.date = reformatDate(clientData.authorityDetails.date);
|
|
3430
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
|
|
3431
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
|
|
3432
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
|
|
3433
|
+
const gender = this.gender.find((i: Value) => i.id === clientData.authoritedPerson.gender);
|
|
3434
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.gender = gender ? gender : new Value();
|
|
3435
|
+
|
|
3436
|
+
if (clientData && clientData.activityTypes !== null) {
|
|
3437
|
+
this.formStore.lfb.policyholderActivities = clientData.activityTypes;
|
|
3438
|
+
}
|
|
3439
|
+
|
|
3440
|
+
if (beneficialOwnerApp && beneficialOwnerApp.length) {
|
|
3441
|
+
this.formStore.lfb.beneficialOwners = beneficialOwnerApp;
|
|
3442
|
+
this.formStore.lfb.isPolicyholderBeneficialOwner = clientData.authoritedPerson.iin.replace(/-/g, '') === beneficialOwnerApp[0].beneficialOwnerData.iin ? true : false;
|
|
3443
|
+
this.formStore.lfb.beneficialOwners.forEach(beneficial => {
|
|
3444
|
+
beneficial.beneficialOwnerData.birthDate = reformatDate(beneficial.beneficialOwnerData.birthDate as string) ?? '';
|
|
3445
|
+
beneficial.beneficialOwnerData.identityDocument.validUntil = reformatDate(beneficial.beneficialOwnerData.identityDocument.validUntil as string) ?? '';
|
|
3446
|
+
beneficial.beneficialOwnerData.iin = reformatIin(beneficial.beneficialOwnerData.iin as string);
|
|
3447
|
+
beneficial.beneficialOwnerData.identityDocument.issuedOn = reformatDate(beneficial.beneficialOwnerData.identityDocument.issuedOn as string) ?? '';
|
|
3448
|
+
//@ts-ignore
|
|
3449
|
+
const gender = this.gender.find((i: Value) => i.id === beneficial.beneficialOwnerData.gender);
|
|
3450
|
+
beneficial.beneficialOwnerData.gender = gender ? gender : new Value();
|
|
3451
|
+
});
|
|
3452
|
+
}
|
|
3453
|
+
|
|
3454
|
+
if (insuredApp && insuredApp.length) {
|
|
3455
|
+
const res = await this.newInsuredList(insuredApp);
|
|
3456
|
+
this.formStore.lfb.clients = res;
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3459
|
+
if (accidentIncidents && accidentIncidents.length) {
|
|
3460
|
+
this.formStore.lfb.accidentIncidents = accidentIncidents;
|
|
3461
|
+
this.formStore.lfb.accidentIncidents.forEach(incident => {
|
|
3462
|
+
incident.amount = incident.amount === 0 ? null : incident.amount;
|
|
3463
|
+
incident.count = incident.count === 0 ? null : incident.count;
|
|
3464
|
+
});
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3467
|
+
this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission === 0 ? null : applicationData.policyAppDto.agentCommission;
|
|
3468
|
+
this.formStore.productConditionsForm.fixInsSum = this.getNumberWithSpaces(applicationData.policyAppDto.fixInsSum === 0 ? null : applicationData.policyAppDto.fixInsSum);
|
|
3469
|
+
this.formStore.productConditionsForm.coverPeriod = 12;
|
|
3470
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount === 0 ? null : applicationData.policyAppDto.amount);
|
|
3471
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
|
|
3472
|
+
applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : applicationData.policyAppDto.mainPremiumWithCommission,
|
|
3473
|
+
);
|
|
3474
|
+
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
3475
|
+
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
3476
|
+
const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
|
|
3477
|
+
this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
|
|
3478
|
+
} catch (err) {
|
|
3479
|
+
ErrorHandler(err);
|
|
3480
|
+
if (err instanceof AxiosError) {
|
|
3481
|
+
this.sendToParent(constants.postActions.toHomePage, err.response?.data);
|
|
3482
|
+
this.isLoading = false;
|
|
3483
|
+
return false;
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
this.isLoading = false;
|
|
3487
|
+
},
|
|
3488
|
+
async saveAccidentIncidents(data: AccidentIncidents[]) {
|
|
3489
|
+
try {
|
|
3490
|
+
const response = await this.api.saveAccidentIncidents(this.formStore.applicationData.processInstanceId, data);
|
|
3491
|
+
return response;
|
|
3492
|
+
} catch (err) {
|
|
3493
|
+
return ErrorHandler(err);
|
|
3494
|
+
}
|
|
3495
|
+
},
|
|
3496
|
+
async saveClientActivityTypes(data: PolicyholderActivity[]) {
|
|
3497
|
+
try {
|
|
3498
|
+
const response = await this.api.saveClientActivityTypes(this.formStore.applicationData.clientApp.id, data);
|
|
3499
|
+
return response;
|
|
3500
|
+
} catch (err) {
|
|
3501
|
+
return ErrorHandler(err);
|
|
3502
|
+
}
|
|
3503
|
+
},
|
|
3504
|
+
async saveBeneficialOwnerList(data: BeneficialOwner[]) {
|
|
3505
|
+
const beneficialOwnerList = JSON.parse(JSON.stringify(data)) as any;
|
|
3506
|
+
for (const item of beneficialOwnerList) {
|
|
3507
|
+
keyDeleter(item as BeneficialOwner, [
|
|
3508
|
+
'beneficialOwnerData.activityTypes',
|
|
3509
|
+
'beneficialOwnerData.actualAddress',
|
|
3510
|
+
'beneficialOwnerData.addTaxResidency',
|
|
3511
|
+
'beneficialOwnerData.authoritedPerson',
|
|
3512
|
+
'beneficialOwnerData.authorityDetails',
|
|
3513
|
+
'beneficialOwnerData.bankInfo',
|
|
3514
|
+
'beneficialOwnerData.legalAddress',
|
|
3515
|
+
'beneficialOwnerData.placeOfBirth',
|
|
3516
|
+
'beneficialOwnerData.typeOfEconomicActivity',
|
|
3517
|
+
]);
|
|
3518
|
+
item.processInstanceId = this.formStore.applicationData.processInstanceId;
|
|
3519
|
+
item.beneficialOwnerData.gender = item.beneficialOwnerData.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3520
|
+
this.preparePersonData(item.beneficialOwnerData);
|
|
3521
|
+
}
|
|
3522
|
+
try {
|
|
3523
|
+
const response = await this.api.saveBeneficialOwnerList(this.formStore.applicationData.processInstanceId, beneficialOwnerList);
|
|
3524
|
+
return response;
|
|
3525
|
+
} catch (err) {
|
|
3526
|
+
return ErrorHandler(err);
|
|
3527
|
+
}
|
|
3528
|
+
},
|
|
3529
|
+
async saveBeneficialOwner(data: BeneficialOwner) {
|
|
3530
|
+
const beneficialOwner = JSON.parse(JSON.stringify(data)) as any;
|
|
3531
|
+
keyDeleter(beneficialOwner as BeneficialOwner, [
|
|
3532
|
+
'beneficialOwnerData.activityTypes',
|
|
3533
|
+
'beneficialOwnerData.actualAddress',
|
|
3534
|
+
'beneficialOwnerData.addTaxResidency',
|
|
3535
|
+
'beneficialOwnerData.authoritedPerson',
|
|
3536
|
+
'beneficialOwnerData.authorityDetails',
|
|
3537
|
+
'beneficialOwnerData.bankInfo',
|
|
3538
|
+
'beneficialOwnerData.legalAddress',
|
|
3539
|
+
'beneficialOwnerData.placeOfBirth',
|
|
3540
|
+
'beneficialOwnerData.typeOfEconomicActivity',
|
|
3541
|
+
]);
|
|
3542
|
+
beneficialOwner.beneficialOwnerData.gender = beneficialOwner.beneficialOwnerData.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3543
|
+
this.preparePersonData(beneficialOwner.beneficialOwnerData);
|
|
3544
|
+
try {
|
|
3545
|
+
const response = await this.api.saveBeneficialOwner(this.formStore.applicationData.processInstanceId, String(beneficialOwner.id), beneficialOwner);
|
|
3546
|
+
return response;
|
|
3547
|
+
} catch (err) {
|
|
3548
|
+
return ErrorHandler(err);
|
|
3549
|
+
}
|
|
3550
|
+
},
|
|
3551
|
+
async saveInsuredList(insuredList: any) {
|
|
3552
|
+
try {
|
|
3553
|
+
const response = await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, insuredList);
|
|
3554
|
+
return response;
|
|
3555
|
+
} catch (err) {
|
|
3556
|
+
return ErrorHandler(err);
|
|
3557
|
+
}
|
|
3558
|
+
},
|
|
3559
|
+
async saveInsured(insured: any) {
|
|
3560
|
+
try {
|
|
3561
|
+
const response = await this.api.saveInsured(this.formStore.applicationData.processInstanceId, insured.id, insured);
|
|
3562
|
+
return response;
|
|
3563
|
+
} catch (err) {
|
|
3564
|
+
return ErrorHandler(err);
|
|
3565
|
+
}
|
|
3566
|
+
},
|
|
3567
|
+
newInsuredList(list: any) {
|
|
3568
|
+
const clients = list.map((item: any, index: number) => {
|
|
3569
|
+
const client = item.insuredData;
|
|
3570
|
+
return {
|
|
3571
|
+
id: index,
|
|
3572
|
+
fullName: client.longName,
|
|
3573
|
+
gender: client.gender,
|
|
3574
|
+
position: client.workDetails.position,
|
|
3575
|
+
birthDate: client.birthDate,
|
|
3576
|
+
iin: reformatIin(client.iin),
|
|
3577
|
+
insSum: client.insuredPolicyData.insSum,
|
|
3578
|
+
premium: client.insuredPolicyData.premium,
|
|
3579
|
+
hasAttachedFile: client.hasAttachedFile,
|
|
3580
|
+
};
|
|
3581
|
+
});
|
|
3582
|
+
return clients;
|
|
3583
|
+
},
|
|
3584
|
+
validateMultipleMembersV2(localKey: string, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
3585
|
+
// @ts-ignore
|
|
3586
|
+
if (this.formStore.lfb[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
3587
|
+
// @ts-ignore
|
|
3588
|
+
if (this.formStore.lfb[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
3589
|
+
// @ts-ignore
|
|
3590
|
+
const localMembers = [...this.formStore.lfb[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
3591
|
+
const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.id - b.id);
|
|
3592
|
+
if (localMembers.every((each, index) => applicationMembers[index].iin === each.iin?.replace(/-/g, '')) === false) {
|
|
3593
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3594
|
+
return false;
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
} else {
|
|
3598
|
+
// @ts-ignore
|
|
3599
|
+
if (this.formStore.lfb[localKey].some(i => i.iin !== null)) {
|
|
3600
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3601
|
+
return false;
|
|
3602
|
+
}
|
|
3603
|
+
if (this.formStore.applicationData[applicationKey].length !== 0) {
|
|
3604
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3605
|
+
return false;
|
|
3606
|
+
} else {
|
|
3607
|
+
// @ts-ignore
|
|
3608
|
+
if (this.formStore.lfb[localKey][0].iin !== null) {
|
|
3609
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3610
|
+
return false;
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
return true;
|
|
3615
|
+
},
|
|
3616
|
+
async validateAllFormsV2(taskId: string) {
|
|
3617
|
+
this.isLoading = true;
|
|
3618
|
+
if (taskId === '0') {
|
|
3619
|
+
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
3620
|
+
return false;
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
if (this.formStore.applicationData.clientApp.iin !== this.formStore.applicationData.clientApp.iin) {
|
|
3624
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
3625
|
+
return false;
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
if (this.formStore.lfb.beneficialOwners) {
|
|
3629
|
+
if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
3630
|
+
return false;
|
|
3631
|
+
}
|
|
3632
|
+
const inStatement = this.formStore.lfb.beneficialOwners.every(i => i.beneficialOwnerData.id !== null);
|
|
3633
|
+
if (inStatement === false) {
|
|
3634
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficialOwner') }));
|
|
3635
|
+
return false;
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3640
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
|
|
3641
|
+
return false;
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3644
|
+
if (this.formStore.lfb.clients) {
|
|
3645
|
+
if (this.validateMultipleMembersV2('clients', 'insuredApp', 'застрахованных') === false) {
|
|
3646
|
+
return false;
|
|
3647
|
+
}
|
|
3648
|
+
const inStatement = this.formStore.lfb.clients.every(i => i.id !== null);
|
|
3649
|
+
if (inStatement === false) {
|
|
3650
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.insured') }));
|
|
3651
|
+
return false;
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
|
|
3655
|
+
if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3656
|
+
for (const client of this.formStore.lfb.clients) {
|
|
3657
|
+
if (client.hasAttachedFile === false) {
|
|
3658
|
+
this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
|
|
3659
|
+
return false;
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3665
|
+
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
3666
|
+
return false;
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3670
|
+
this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
|
|
3671
|
+
return false;
|
|
3672
|
+
}
|
|
3673
|
+
|
|
3674
|
+
return true;
|
|
3675
|
+
},
|
|
3676
|
+
async getVariableData(processCode: number) {
|
|
3677
|
+
try {
|
|
3678
|
+
const response = await this.api.getVariableData(0, processCode);
|
|
3679
|
+
if (response) {
|
|
3680
|
+
return response.data.slice(0, 10);
|
|
3681
|
+
}
|
|
3682
|
+
return null;
|
|
3683
|
+
} catch (err) {
|
|
3684
|
+
ErrorHandler(err);
|
|
3685
|
+
return null;
|
|
3686
|
+
}
|
|
3687
|
+
},
|
|
3688
|
+
async checkIIN(iin: string) {
|
|
3689
|
+
try {
|
|
3690
|
+
const response = await this.api.checkIIN(iin);
|
|
3691
|
+
return response;
|
|
3692
|
+
} catch (err) {
|
|
3693
|
+
ErrorHandler(err);
|
|
3694
|
+
return null;
|
|
3695
|
+
}
|
|
3696
|
+
},
|
|
3697
|
+
async checkAccountNumber(iik: string) {
|
|
3698
|
+
try {
|
|
3699
|
+
const checked = await this.api.checkAccountNumber(iik);
|
|
3700
|
+
return checked;
|
|
3701
|
+
} catch (err) {
|
|
3702
|
+
return ErrorHandler(err);
|
|
3703
|
+
}
|
|
3704
|
+
},
|
|
2595
3705
|
async isCourseChanged(processInstanceId: string) {
|
|
2596
3706
|
try {
|
|
2597
3707
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -2600,7 +3710,27 @@ export const useDataStore = defineStore('data', {
|
|
|
2600
3710
|
return ErrorHandler(err);
|
|
2601
3711
|
}
|
|
2602
3712
|
},
|
|
3713
|
+
async getDocument(id: string) {
|
|
3714
|
+
try {
|
|
3715
|
+
const response = await this.api.getDocument(id);
|
|
3716
|
+
return response;
|
|
3717
|
+
} catch (err) {
|
|
3718
|
+
return ErrorHandler(err);
|
|
3719
|
+
}
|
|
3720
|
+
},
|
|
3721
|
+
async generateShortLink(url: string) {
|
|
3722
|
+
try {
|
|
3723
|
+
const response = await this.api.generateShortLink({
|
|
3724
|
+
link: url,
|
|
3725
|
+
priority: 'low',
|
|
3726
|
+
});
|
|
3727
|
+
return response.link;
|
|
3728
|
+
} catch (err) {
|
|
3729
|
+
return ErrorHandler(err);
|
|
3730
|
+
}
|
|
3731
|
+
},
|
|
2603
3732
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
3733
|
+
if (this.isLifetrip || this.isPension) return false;
|
|
2604
3734
|
switch (whichForm) {
|
|
2605
3735
|
case this.formStore.beneficiaryFormKey:
|
|
2606
3736
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -2611,7 +3741,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2611
3741
|
}
|
|
2612
3742
|
},
|
|
2613
3743
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
2614
|
-
if (this.isGons) return false;
|
|
3744
|
+
if (this.isGons || this.isPension) return false;
|
|
2615
3745
|
switch (whichForm) {
|
|
2616
3746
|
case this.formStore.beneficiaryFormKey:
|
|
2617
3747
|
return false;
|
|
@@ -2632,17 +3762,75 @@ export const useDataStore = defineStore('data', {
|
|
|
2632
3762
|
}
|
|
2633
3763
|
},
|
|
2634
3764
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
2635
|
-
if (this.isGons) return false;
|
|
3765
|
+
if (this.isGons || this.isPension) return false;
|
|
2636
3766
|
switch (whichForm) {
|
|
2637
3767
|
default:
|
|
2638
3768
|
return true;
|
|
2639
3769
|
}
|
|
2640
3770
|
},
|
|
3771
|
+
hasBankSection(whichForm: keyof typeof StoreMembers) {
|
|
3772
|
+
if (!this.isPension) return false;
|
|
3773
|
+
switch (whichForm) {
|
|
3774
|
+
case 'beneficiaryForm':
|
|
3775
|
+
return false;
|
|
3776
|
+
default:
|
|
3777
|
+
return true;
|
|
3778
|
+
}
|
|
3779
|
+
},
|
|
3780
|
+
hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
|
|
3781
|
+
if (!this.isPension) return false;
|
|
3782
|
+
switch (whichForm) {
|
|
3783
|
+
case 'beneficiaryForm':
|
|
3784
|
+
return false;
|
|
3785
|
+
default:
|
|
3786
|
+
return true;
|
|
3787
|
+
}
|
|
3788
|
+
},
|
|
3789
|
+
hasFamilyTiesSection(whichForm: keyof typeof StoreMembers) {
|
|
3790
|
+
if (!this.isPension) return false;
|
|
3791
|
+
switch (whichForm) {
|
|
3792
|
+
case 'policyholderForm':
|
|
3793
|
+
return false;
|
|
3794
|
+
case 'beneficiaryForm':
|
|
3795
|
+
return true;
|
|
3796
|
+
default:
|
|
3797
|
+
return false;
|
|
3798
|
+
}
|
|
3799
|
+
},
|
|
2641
3800
|
hasPercentageOfPayoutAmount() {
|
|
2642
3801
|
return true;
|
|
2643
3802
|
},
|
|
2644
|
-
|
|
2645
|
-
return
|
|
3803
|
+
hasAccess() {
|
|
3804
|
+
return {
|
|
3805
|
+
invoiceInfo: this.isAdmin(),
|
|
3806
|
+
toLKA: this.isAgent() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn(),
|
|
3807
|
+
toAML: this.isCompliance() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn(),
|
|
3808
|
+
toAULETTI: this.isAgentAuletti() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn(),
|
|
3809
|
+
toEFO:
|
|
3810
|
+
this.isManager() ||
|
|
3811
|
+
this.isAgent() ||
|
|
3812
|
+
this.isAgentMycar() ||
|
|
3813
|
+
this.isManagerHalykBank() ||
|
|
3814
|
+
this.isHeadManager() ||
|
|
3815
|
+
this.isServiceManager() ||
|
|
3816
|
+
this.isUnderwriter() ||
|
|
3817
|
+
this.isActuary() ||
|
|
3818
|
+
this.isAdmin() ||
|
|
3819
|
+
this.isCompliance() ||
|
|
3820
|
+
this.isAnalyst() ||
|
|
3821
|
+
this.isUpk() ||
|
|
3822
|
+
this.isFinCenter() ||
|
|
3823
|
+
this.isSupervisor() ||
|
|
3824
|
+
this.isSupport() ||
|
|
3825
|
+
this.isDrn() ||
|
|
3826
|
+
this.isUrp() ||
|
|
3827
|
+
this.isUsns() ||
|
|
3828
|
+
this.isAccountant() ||
|
|
3829
|
+
this.isBranchDirector() ||
|
|
3830
|
+
this.isUSNSACCINS() ||
|
|
3831
|
+
this.isDsuio() ||
|
|
3832
|
+
this.isAdjuster(),
|
|
3833
|
+
};
|
|
2646
3834
|
},
|
|
2647
3835
|
},
|
|
2648
3836
|
});
|