hl-core 0.0.9-beta.9 → 0.0.10-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/base.api.ts +1110 -0
- package/api/index.ts +2 -620
- package/api/interceptors.ts +38 -1
- package/components/Button/Btn.vue +1 -6
- package/components/Complex/MessageBlock.vue +1 -1
- package/components/Complex/Page.vue +1 -1
- package/components/Complex/TextBlock.vue +25 -0
- package/components/Dialog/Dialog.vue +72 -16
- package/components/Dialog/FamilyDialog.vue +3 -1
- package/components/Form/DynamicForm.vue +101 -0
- package/components/Form/FormBlock.vue +12 -3
- package/components/Form/FormData.vue +111 -0
- package/components/Form/FormSection.vue +3 -3
- package/components/Form/FormTextSection.vue +11 -3
- package/components/Form/FormToggle.vue +25 -5
- package/components/Form/ManagerAttachment.vue +178 -89
- package/components/Form/ProductConditionsBlock.vue +59 -6
- package/components/Input/Datepicker.vue +43 -7
- package/components/Input/DynamicInput.vue +25 -0
- package/components/Input/FileInput.vue +25 -5
- package/components/Input/FormInput.vue +9 -4
- package/components/Input/Monthpicker.vue +34 -0
- package/components/Input/PanelInput.vue +6 -1
- package/components/Input/RoundedInput.vue +2 -0
- package/components/Input/RoundedSelect.vue +9 -2
- package/components/Input/SwitchInput.vue +66 -0
- package/components/Input/TextInput.vue +162 -0
- package/components/Layout/Drawer.vue +18 -4
- package/components/Layout/Header.vue +23 -2
- package/components/Layout/Loader.vue +2 -1
- package/components/Layout/SettingsPanel.vue +24 -11
- package/components/Menu/InfoMenu.vue +35 -0
- package/components/Menu/MenuNav.vue +25 -3
- package/components/Pages/Anketa.vue +255 -65
- package/components/Pages/Auth.vue +58 -9
- package/components/Pages/ContragentForm.vue +10 -9
- package/components/Pages/Documents.vue +267 -30
- package/components/Pages/InvoiceInfo.vue +1 -1
- package/components/Pages/MemberForm.vue +775 -102
- package/components/Pages/ProductAgreement.vue +1 -8
- package/components/Pages/ProductConditions.vue +1133 -180
- package/components/Panel/PanelHandler.vue +627 -49
- package/components/Panel/PanelSelectItem.vue +17 -2
- package/components/Panel/RightPanelCloser.vue +7 -0
- package/components/Transitions/Animation.vue +30 -0
- package/components/Utilities/Chip.vue +2 -0
- package/components/Utilities/JsonViewer.vue +2 -2
- package/components/Utilities/Qr.vue +44 -0
- package/composables/axios.ts +1 -0
- package/composables/classes.ts +550 -44
- package/composables/constants.ts +126 -6
- package/composables/fields.ts +330 -0
- package/composables/index.ts +356 -20
- package/composables/styles.ts +23 -6
- package/configs/pwa.ts +63 -0
- package/layouts/clear.vue +21 -0
- package/layouts/default.vue +62 -3
- package/layouts/full.vue +21 -0
- package/locales/ru.json +558 -16
- package/nuxt.config.ts +6 -15
- package/package.json +38 -39
- package/pages/Token.vue +0 -13
- package/plugins/head.ts +26 -0
- package/plugins/vuetifyPlugin.ts +1 -5
- package/store/data.store.ts +1647 -348
- package/store/extractStore.ts +17 -0
- package/store/form.store.ts +13 -1
- package/store/member.store.ts +2 -1
- package/store/rules.ts +97 -3
- package/store/toast.ts +1 -1
- package/tsconfig.json +3 -0
- package/types/enum.ts +82 -0
- package/types/env.d.ts +2 -0
- package/types/form.ts +90 -0
- package/types/index.ts +847 -506
package/store/data.store.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
2
|
import { rules } from './rules';
|
|
3
3
|
import { i18n } from '../configs/i18n';
|
|
4
|
-
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
4
|
+
import { Toast, Types as ToastTypes, 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
|
-
import { PostActions, StoreMembers, Roles, Statuses, MemberCodes, MemberAppCodes } from '../types/enum';
|
|
10
|
+
import { PostActions, StoreMembers, Roles, Statuses, MemberCodes, MemberAppCodes, Enums } from '../types/enum';
|
|
11
|
+
import type * as Types from '../types';
|
|
12
|
+
//@ts-ignore
|
|
13
|
+
import { NCALayerClient } from 'ncalayer-js-client';
|
|
11
14
|
|
|
12
15
|
export const useDataStore = defineStore('data', {
|
|
13
16
|
state: () => ({
|
|
@@ -15,27 +18,32 @@ export const useDataStore = defineStore('data', {
|
|
|
15
18
|
t: i18n.t,
|
|
16
19
|
rules: rules,
|
|
17
20
|
toast: Toast,
|
|
18
|
-
toastTypes:
|
|
21
|
+
toastTypes: ToastTypes,
|
|
19
22
|
toastPositions: Positions,
|
|
20
23
|
isValidGUID: isValidGUID,
|
|
21
24
|
router: useRouter(),
|
|
22
25
|
formStore: useFormStore(),
|
|
23
26
|
// contragent: useContragentStore(),
|
|
24
27
|
api: new ApiClass(),
|
|
28
|
+
rController: new AbortController(),
|
|
25
29
|
yearEnding: (year: number) => yearEnding(year, constants.yearTitles, constants.yearCases),
|
|
26
30
|
currentDate: () => new Date(Date.now() - new Date().getTimezoneOffset() * 60 * 1000).toISOString().slice(0, -1),
|
|
27
31
|
showToaster: (type: 'success' | 'error' | 'warning' | 'info', msg: string, timeout?: number) =>
|
|
28
32
|
Toast.useToast()(msg, {
|
|
29
33
|
...ToastOptions,
|
|
30
|
-
type:
|
|
34
|
+
type: ToastTypes[type.toUpperCase() as keyof typeof ToastTypes],
|
|
31
35
|
timeout: type === 'error' ? 6000 : typeof timeout === 'number' ? timeout : ToastOptions.timeout,
|
|
32
36
|
}),
|
|
33
37
|
}),
|
|
34
38
|
getters: {
|
|
35
39
|
isEFO: state => state.product === 'efo',
|
|
40
|
+
isEfoParent: state => state.parentProduct === 'efo',
|
|
36
41
|
isAML: state => state.product === 'aml',
|
|
37
42
|
isLKA: state => state.product === 'lka',
|
|
38
|
-
|
|
43
|
+
isAULETTI: state => state.product === 'auletti',
|
|
44
|
+
isLKA_A: state => state.product === 'lka-auletti',
|
|
45
|
+
isAulettiParent: state => state.parentProduct === 'auletti',
|
|
46
|
+
isBridge: state => state.product === 'efo' || state.product === 'aml' || state.product === 'lka' || state.product === 'auletti',
|
|
39
47
|
isBaiterek: state => state.product === 'baiterek',
|
|
40
48
|
isBolashak: state => state.product === 'bolashak',
|
|
41
49
|
isMycar: state => state.product === 'mycar',
|
|
@@ -44,16 +52,36 @@ export const useDataStore = defineStore('data', {
|
|
|
44
52
|
isLiferenta: state => state.product === 'liferenta',
|
|
45
53
|
isGons: state => state.product === 'gons',
|
|
46
54
|
isKazyna: state => state.product === 'halykkazyna',
|
|
55
|
+
isDas: state => state.product === 'daskamkorlyk',
|
|
56
|
+
isPension: state => state.product === 'pensionannuitynew',
|
|
57
|
+
isAmulet: state => state.product === 'amuletlife',
|
|
58
|
+
isGns: state => state.product === 'gns',
|
|
47
59
|
isCalculator: state => state.product === 'calculator',
|
|
48
60
|
isCheckContract: state => state.product === 'checkcontract',
|
|
49
61
|
isCheckContragent: state => state.product === 'checkcontragent',
|
|
50
|
-
|
|
62
|
+
isPrePension: state => state.product === 'prepensionannuity',
|
|
63
|
+
isDSO: state => state.product === 'dso',
|
|
64
|
+
isUU: state => state.product === 'uu',
|
|
51
65
|
hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
52
66
|
isClientAnketaCondition: state =>
|
|
53
67
|
!state.formStore.insuredForm.find(member => member.iin === state.formStore.policyholderForm.iin) &&
|
|
54
68
|
!!state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10 && i.coverSumCode === 'included'),
|
|
55
69
|
},
|
|
56
70
|
actions: {
|
|
71
|
+
async getProjectConfig() {
|
|
72
|
+
try {
|
|
73
|
+
const projectConfig = await this.api.getProjectConfig();
|
|
74
|
+
if (projectConfig) {
|
|
75
|
+
this.projectConfig = projectConfig;
|
|
76
|
+
return true;
|
|
77
|
+
} else {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
} catch (err) {
|
|
81
|
+
this.projectConfig = null;
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
57
85
|
isIframe() {
|
|
58
86
|
try {
|
|
59
87
|
return window.self !== window.top;
|
|
@@ -73,16 +101,41 @@ export const useDataStore = defineStore('data', {
|
|
|
73
101
|
childFrame.contentWindow.postMessage({ action: action, value: value }, '*');
|
|
74
102
|
}
|
|
75
103
|
},
|
|
76
|
-
|
|
104
|
+
abortRequests() {
|
|
105
|
+
try {
|
|
106
|
+
this.rController.abort();
|
|
107
|
+
this.rController = new AbortController();
|
|
108
|
+
} catch (err) {
|
|
109
|
+
console.log(err);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
async copyToClipboard(text: unknown, showError: boolean = true) {
|
|
77
113
|
if (typeof text === 'string' || typeof text === 'number') {
|
|
78
|
-
if (
|
|
79
|
-
|
|
114
|
+
if (navigator.clipboard && window.isSecureContext) {
|
|
115
|
+
if (this.isBridge) {
|
|
116
|
+
await navigator.clipboard.writeText(String(text));
|
|
117
|
+
this.showToaster('success', this.t('toaster.copied'));
|
|
118
|
+
} else {
|
|
119
|
+
this.sendToParent(constants.postActions.clipboard, String(text));
|
|
120
|
+
}
|
|
80
121
|
} else {
|
|
81
|
-
|
|
122
|
+
const textarea = document.createElement('textarea');
|
|
123
|
+
textarea.value = String(text);
|
|
124
|
+
textarea.style.position = 'absolute';
|
|
125
|
+
textarea.style.left = '-99999999px';
|
|
126
|
+
document.body.prepend(textarea);
|
|
127
|
+
textarea.select();
|
|
128
|
+
try {
|
|
129
|
+
document.execCommand('copy');
|
|
130
|
+
this.showToaster('success', this.t('toaster.copied'));
|
|
131
|
+
} catch (err) {
|
|
132
|
+
console.log(err);
|
|
133
|
+
} finally {
|
|
134
|
+
textarea.remove();
|
|
135
|
+
}
|
|
82
136
|
}
|
|
83
|
-
this.showToaster('success', this.t('toaster.copied'));
|
|
84
137
|
} else {
|
|
85
|
-
this.showToaster('error', this.t('toaster.noUrl'));
|
|
138
|
+
if (showError) this.showToaster('error', this.t('toaster.noUrl'));
|
|
86
139
|
}
|
|
87
140
|
},
|
|
88
141
|
getFilesByIIN(iin: string) {
|
|
@@ -141,7 +194,7 @@ export const useDataStore = defineStore('data', {
|
|
|
141
194
|
return !!isRole;
|
|
142
195
|
},
|
|
143
196
|
isInitiator() {
|
|
144
|
-
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager();
|
|
197
|
+
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager() || this.isAgentAuletti();
|
|
145
198
|
},
|
|
146
199
|
isManager() {
|
|
147
200
|
return this.isRole(constants.roles.Manager);
|
|
@@ -152,6 +205,9 @@ export const useDataStore = defineStore('data', {
|
|
|
152
205
|
isAdmin() {
|
|
153
206
|
return this.isRole(constants.roles.Admin);
|
|
154
207
|
},
|
|
208
|
+
isJurist() {
|
|
209
|
+
return this.isRole(constants.roles.Jurist);
|
|
210
|
+
},
|
|
155
211
|
isAgent() {
|
|
156
212
|
return this.isRole(constants.roles.Agent);
|
|
157
213
|
},
|
|
@@ -164,15 +220,30 @@ export const useDataStore = defineStore('data', {
|
|
|
164
220
|
isUnderwriter() {
|
|
165
221
|
return this.isRole(constants.roles.Underwriter);
|
|
166
222
|
},
|
|
223
|
+
isActuary() {
|
|
224
|
+
return this.isRole(constants.roles.Actuary);
|
|
225
|
+
},
|
|
167
226
|
isAgentMycar() {
|
|
168
227
|
return this.isRole(constants.roles.AgentMycar);
|
|
169
228
|
},
|
|
229
|
+
isAgentAuletti() {
|
|
230
|
+
return this.isRole(constants.roles.AgentAuletti);
|
|
231
|
+
},
|
|
170
232
|
isAnalyst() {
|
|
171
233
|
return this.isRole(constants.roles.Analyst);
|
|
172
234
|
},
|
|
173
235
|
isUpk() {
|
|
174
236
|
return this.isRole(constants.roles.UPK);
|
|
175
237
|
},
|
|
238
|
+
isUrp() {
|
|
239
|
+
return this.isRole(constants.roles.URP);
|
|
240
|
+
},
|
|
241
|
+
isUsns() {
|
|
242
|
+
return this.isRole(constants.roles.USNS);
|
|
243
|
+
},
|
|
244
|
+
isAccountant() {
|
|
245
|
+
return this.isRole(constants.roles.Accountant);
|
|
246
|
+
},
|
|
176
247
|
isDrn() {
|
|
177
248
|
return this.isRole(constants.roles.DRNSJ);
|
|
178
249
|
},
|
|
@@ -185,6 +256,30 @@ export const useDataStore = defineStore('data', {
|
|
|
185
256
|
isSupervisor() {
|
|
186
257
|
return this.isRole(constants.roles.Supervisor);
|
|
187
258
|
},
|
|
259
|
+
isHeadManager() {
|
|
260
|
+
return this.isRole(constants.roles.HeadManager);
|
|
261
|
+
},
|
|
262
|
+
isBranchDirector() {
|
|
263
|
+
return this.isRole(constants.roles.BranchDirector);
|
|
264
|
+
},
|
|
265
|
+
isUSNSACCINS() {
|
|
266
|
+
return this.isRole(constants.roles.USNSACCINS);
|
|
267
|
+
},
|
|
268
|
+
isDsuio() {
|
|
269
|
+
return this.isRole(constants.roles.Dsuio);
|
|
270
|
+
},
|
|
271
|
+
isAdjuster() {
|
|
272
|
+
return this.isRole(constants.roles.SettlementLosses);
|
|
273
|
+
},
|
|
274
|
+
isHeadAdjuster() {
|
|
275
|
+
return this.isRole(constants.roles.HeadSettlementLosses);
|
|
276
|
+
},
|
|
277
|
+
isDsoDirector() {
|
|
278
|
+
return this.isRole(constants.roles.DsoDirector);
|
|
279
|
+
},
|
|
280
|
+
isAccountantDirector() {
|
|
281
|
+
return this.isRole(constants.roles.AccountantDirector);
|
|
282
|
+
},
|
|
188
283
|
isProcessEditable(statusCode?: keyof typeof Statuses) {
|
|
189
284
|
const getEditibleStatuses = () => {
|
|
190
285
|
const defaultStatuses = constants.editableStatuses;
|
|
@@ -206,9 +301,29 @@ export const useDataStore = defineStore('data', {
|
|
|
206
301
|
};
|
|
207
302
|
return !!getCanceleStatuses().find(status => status === statusCode);
|
|
208
303
|
},
|
|
304
|
+
isProcessReject(statusCode?: keyof typeof Statuses) {
|
|
305
|
+
const getRejectStatuses = () => {
|
|
306
|
+
const defaultStatuses = constants.rejectApplicationStatuses;
|
|
307
|
+
return defaultStatuses;
|
|
308
|
+
};
|
|
309
|
+
return !!getRejectStatuses().find(status => status === statusCode);
|
|
310
|
+
},
|
|
209
311
|
isTask() {
|
|
210
312
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
211
313
|
},
|
|
314
|
+
validateAccess() {
|
|
315
|
+
try {
|
|
316
|
+
const hasAccess = this.hasAccess();
|
|
317
|
+
if (this.isAML) return hasAccess.toAML;
|
|
318
|
+
if (this.isLKA) return hasAccess.toLKA;
|
|
319
|
+
if (this.isEFO) return hasAccess.toEFO;
|
|
320
|
+
if (this.isAULETTI) return hasAccess.toAULETTI;
|
|
321
|
+
if (this.isLKA_A) return hasAccess.toLKA_A;
|
|
322
|
+
return false;
|
|
323
|
+
} catch (err) {
|
|
324
|
+
return ErrorHandler(err);
|
|
325
|
+
}
|
|
326
|
+
},
|
|
212
327
|
async loginUser(login: string, password: string, numAttempt: number) {
|
|
213
328
|
try {
|
|
214
329
|
const token = localStorage.getItem('accessToken') || null;
|
|
@@ -221,35 +336,12 @@ export const useDataStore = defineStore('data', {
|
|
|
221
336
|
password: password,
|
|
222
337
|
numAttempt: numAttempt,
|
|
223
338
|
});
|
|
224
|
-
|
|
225
339
|
this.accessToken = loginResponse.accessToken;
|
|
226
340
|
this.refreshToken = loginResponse.refreshToken;
|
|
227
341
|
this.getUserRoles();
|
|
228
342
|
}
|
|
229
|
-
const checkPermission = () => {
|
|
230
|
-
if (this.isAML) {
|
|
231
|
-
return this.isCompliance() || this.isAdmin() || this.isSupport() || this.isAnalyst();
|
|
232
|
-
}
|
|
233
|
-
if (this.isLKA) {
|
|
234
|
-
return this.isAgent() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
|
|
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
|
-
}
|
|
249
|
-
return false;
|
|
250
|
-
};
|
|
251
343
|
if (this.controls.onAuth) {
|
|
252
|
-
const hasPermission =
|
|
344
|
+
const hasPermission = this.validateAccess();
|
|
253
345
|
if (hasPermission) {
|
|
254
346
|
localStorage.setItem('accessToken', this.accessToken);
|
|
255
347
|
localStorage.setItem('refreshToken', String(this.refreshToken));
|
|
@@ -286,8 +378,18 @@ export const useDataStore = defineStore('data', {
|
|
|
286
378
|
}
|
|
287
379
|
this.isLoading = false;
|
|
288
380
|
},
|
|
289
|
-
async
|
|
381
|
+
async checkToken() {
|
|
382
|
+
try {
|
|
383
|
+
await this.api.checkToken();
|
|
384
|
+
return true;
|
|
385
|
+
} catch (err) {
|
|
386
|
+
ErrorHandler(err);
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
async resetSelected(route: Types.RouteType) {
|
|
290
391
|
this.settings.open = false;
|
|
392
|
+
this.rightPanel.open = false;
|
|
291
393
|
this.panel.open = false;
|
|
292
394
|
this.panelAction = null;
|
|
293
395
|
this.menu.selectedItem = new MenuItem();
|
|
@@ -357,7 +459,7 @@ export const useDataStore = defineStore('data', {
|
|
|
357
459
|
this.isLoading = false;
|
|
358
460
|
}
|
|
359
461
|
},
|
|
360
|
-
async getContragent(member: Member, load: boolean = true) {
|
|
462
|
+
async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
|
|
361
463
|
this.isLoading = load;
|
|
362
464
|
if (!member.iin) return;
|
|
363
465
|
try {
|
|
@@ -379,7 +481,7 @@ export const useDataStore = defineStore('data', {
|
|
|
379
481
|
}
|
|
380
482
|
member.gotFromInsis = true;
|
|
381
483
|
} else {
|
|
382
|
-
this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
484
|
+
if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
383
485
|
}
|
|
384
486
|
} catch (err) {
|
|
385
487
|
ErrorHandler(err);
|
|
@@ -387,9 +489,10 @@ export const useDataStore = defineStore('data', {
|
|
|
387
489
|
this.isLoading = false;
|
|
388
490
|
},
|
|
389
491
|
async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
|
|
492
|
+
if (Number(id) === 0) return;
|
|
390
493
|
this.isLoading = load;
|
|
391
494
|
try {
|
|
392
|
-
const member = whichIndex === null ? this.formStore[whichForm as SingleMember] : this.formStore[whichForm as MultipleMember][whichIndex];
|
|
495
|
+
const member = whichIndex === null ? this.formStore[whichForm as Types.SingleMember] : this.formStore[whichForm as Types.MultipleMember][whichIndex];
|
|
393
496
|
const contragentResponse = await this.api.getContragentById(id);
|
|
394
497
|
if (contragentResponse.totalItems > 0) {
|
|
395
498
|
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
@@ -402,7 +505,7 @@ export const useDataStore = defineStore('data', {
|
|
|
402
505
|
this.isLoading = false;
|
|
403
506
|
}
|
|
404
507
|
},
|
|
405
|
-
async serializeContragentData(member: Member, contragent: ContragentType) {
|
|
508
|
+
async serializeContragentData(member: Member, contragent: Types.ContragentType) {
|
|
406
509
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
407
510
|
this.api.getContrAgentData(contragent.id),
|
|
408
511
|
this.api.getContrAgentContacts(contragent.id),
|
|
@@ -434,15 +537,21 @@ export const useDataStore = defineStore('data', {
|
|
|
434
537
|
},
|
|
435
538
|
parseContragent(
|
|
436
539
|
member: Member,
|
|
437
|
-
user: {
|
|
540
|
+
user: {
|
|
541
|
+
personalData: Types.ContragentType;
|
|
542
|
+
data?: Types.ContragentQuestionaries[];
|
|
543
|
+
contacts?: Types.ContragentContacts[];
|
|
544
|
+
documents?: Types.ContragentDocuments[];
|
|
545
|
+
address?: Types.ContragentAddress[];
|
|
546
|
+
},
|
|
438
547
|
) {
|
|
439
548
|
member.verifyType = user.personalData.verifyType;
|
|
440
549
|
member.verifyDate = user.personalData.verifyDate;
|
|
441
550
|
member.iin = reformatIin(user.personalData.iin);
|
|
442
551
|
member.age = String(user.personalData.age);
|
|
443
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
552
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
444
553
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
445
|
-
const gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
|
|
554
|
+
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
446
555
|
member.gender = gender ? gender : new Value();
|
|
447
556
|
member.gender.id = user.personalData.gender;
|
|
448
557
|
member.birthDate = reformatDate(user.personalData.birthDate);
|
|
@@ -457,15 +566,10 @@ export const useDataStore = defineStore('data', {
|
|
|
457
566
|
|
|
458
567
|
if ('documents' in user && user.documents && user.documents.length) {
|
|
459
568
|
member.documentsList = user.documents;
|
|
460
|
-
const documentByPriority = (
|
|
461
|
-
if (this.isLifetrip) {
|
|
462
|
-
return user.documents.find(i => i.type === 'PS');
|
|
463
|
-
}
|
|
464
|
-
return user.documents.find(i => i.type === '1UDL');
|
|
465
|
-
})();
|
|
569
|
+
const documentByPriority = user.documents.find(i => i.type === Enums.Insis.DocTypes['1UDL']);
|
|
466
570
|
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);
|
|
571
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
572
|
+
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
469
573
|
member.documentType = documentType ? documentType : new Value();
|
|
470
574
|
member.documentNumber = userDocument.number;
|
|
471
575
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
@@ -477,16 +581,22 @@ export const useDataStore = defineStore('data', {
|
|
|
477
581
|
user.data.forEach(questData => {
|
|
478
582
|
this.searchFromList(member, questData);
|
|
479
583
|
});
|
|
584
|
+
if (this.isLifetrip) {
|
|
585
|
+
const lastNameLat = user.data.find(obj => obj.questId === '500147');
|
|
586
|
+
const firstNameLat = user.data.find(obj => obj.questId === '500148');
|
|
587
|
+
member.lastNameLat = lastNameLat ? (lastNameLat.questAnswer as string) : null;
|
|
588
|
+
member.firstNameLat = firstNameLat ? (firstNameLat.questAnswer as string) : null;
|
|
589
|
+
}
|
|
480
590
|
}
|
|
481
591
|
if ('address' in user && user.address && user.address.length) {
|
|
482
592
|
const userAddress = user.address[0];
|
|
483
593
|
const countryName = userAddress.countryName;
|
|
484
594
|
if (countryName) {
|
|
485
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(countryName, 'i')));
|
|
595
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(countryName, 'i')));
|
|
486
596
|
member.registrationCountry = country ? country : new Value();
|
|
487
597
|
}
|
|
488
|
-
const province = this.states.find(i => i.ids === userAddress.stateCode);
|
|
489
|
-
const localityType = this.localityTypes.find(i => i.nameRu === userAddress.cityTypeName);
|
|
598
|
+
const province = this.states.find((i: Value) => i.ids === userAddress.stateCode);
|
|
599
|
+
const localityType = this.localityTypes.find((i: Value) => i.nameRu === userAddress.cityTypeName);
|
|
490
600
|
const city = this.cities.find(i => !!userAddress.cityName && i.nameRu === userAddress.cityName.replace('г.', ''));
|
|
491
601
|
const region = this.regions.find(i => !!userAddress.regionCode && i.ids == userAddress.regionCode);
|
|
492
602
|
member.registrationStreet = userAddress.streetName;
|
|
@@ -515,7 +625,7 @@ export const useDataStore = defineStore('data', {
|
|
|
515
625
|
});
|
|
516
626
|
}
|
|
517
627
|
},
|
|
518
|
-
searchFromList(member: Member, searchIt: ContragentQuestionaries) {
|
|
628
|
+
searchFromList(member: Member, searchIt: Types.ContragentQuestionaries) {
|
|
519
629
|
const getQuestionariesData = () => {
|
|
520
630
|
switch (searchIt.questId) {
|
|
521
631
|
case '500003':
|
|
@@ -536,7 +646,7 @@ export const useDataStore = defineStore('data', {
|
|
|
536
646
|
};
|
|
537
647
|
const qData = getQuestionariesData();
|
|
538
648
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
539
|
-
const qResult = qData.from.find(i => i.ids === searchIt.questAnswer);
|
|
649
|
+
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
540
650
|
//@ts-ignore
|
|
541
651
|
member[qData.field] = qResult ? qResult : new Value();
|
|
542
652
|
}
|
|
@@ -553,12 +663,12 @@ export const useDataStore = defineStore('data', {
|
|
|
553
663
|
const contragent = await this.api.getContragent(queryData);
|
|
554
664
|
if (contragent.totalItems > 0) {
|
|
555
665
|
if (contragent.items.length === 1) {
|
|
556
|
-
return contragent.items[0]
|
|
666
|
+
return contragent.items[0];
|
|
557
667
|
} else {
|
|
558
668
|
const sortedByRegistrationDate = contragent.items.sort(
|
|
559
669
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
560
670
|
);
|
|
561
|
-
return sortedByRegistrationDate[0]
|
|
671
|
+
return sortedByRegistrationDate[0];
|
|
562
672
|
}
|
|
563
673
|
} else {
|
|
564
674
|
return null;
|
|
@@ -588,17 +698,27 @@ export const useDataStore = defineStore('data', {
|
|
|
588
698
|
}
|
|
589
699
|
},
|
|
590
700
|
async saveContragent(user: Member, whichForm: keyof typeof StoreMembers | 'contragent', whichIndex: number | null, onlySaveAction: boolean = true) {
|
|
701
|
+
if (this.isGons && user.iin && whichForm === 'beneficiaryForm' && useEnv().isProduction) {
|
|
702
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesInActualPolicy(user.iin.replace(/-/g, ''));
|
|
703
|
+
if (doesHaveActiveContract) {
|
|
704
|
+
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
591
708
|
this.isLoading = !onlySaveAction;
|
|
592
|
-
const
|
|
593
|
-
if (
|
|
594
|
-
user.id =
|
|
709
|
+
const hasInsis = await this.alreadyInInsis(user);
|
|
710
|
+
if (!!hasInsis) {
|
|
711
|
+
user.id = hasInsis.id;
|
|
595
712
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
596
713
|
this.api.getContrAgentData(user.id),
|
|
597
714
|
this.api.getContrAgentContacts(user.id),
|
|
598
715
|
this.api.getContrAgentDocuments(user.id),
|
|
599
716
|
this.api.getContrAgentAddress(user.id),
|
|
600
717
|
]);
|
|
601
|
-
user.response
|
|
718
|
+
if (!user.response) {
|
|
719
|
+
user.response = {};
|
|
720
|
+
user.response.contragent = hasInsis;
|
|
721
|
+
}
|
|
602
722
|
if (questionairesResponse.status === 'fulfilled' && questionairesResponse.value && questionairesResponse.value.length) {
|
|
603
723
|
user.response.questionnaires = questionairesResponse.value;
|
|
604
724
|
}
|
|
@@ -613,7 +733,7 @@ export const useDataStore = defineStore('data', {
|
|
|
613
733
|
}
|
|
614
734
|
}
|
|
615
735
|
try {
|
|
616
|
-
const contragentData: ContragentType = {
|
|
736
|
+
const contragentData: Types.ContragentType = {
|
|
617
737
|
id: Number(user.id),
|
|
618
738
|
type: Number(user.type),
|
|
619
739
|
iin: user.iin!.replace(/-/g, ''),
|
|
@@ -624,7 +744,11 @@ export const useDataStore = defineStore('data', {
|
|
|
624
744
|
birthDate: user.getDateByKey('birthDate')!,
|
|
625
745
|
gender: Number(user.gender.id),
|
|
626
746
|
genderName: user.genderName ? user.genderName : user.gender.nameRu ?? '',
|
|
627
|
-
birthPlace: user.birthPlace.nameRu
|
|
747
|
+
birthPlace: user.birthPlace.nameRu
|
|
748
|
+
? user.birthPlace.nameRu
|
|
749
|
+
: 'response' in user && user.response && 'contragent' in user.response && user.response.contragent && user.response.contragent.birthPlace
|
|
750
|
+
? user.response.contragent.birthPlace
|
|
751
|
+
: '',
|
|
628
752
|
age: Number(user.age),
|
|
629
753
|
registrationDate: user.registrationDate,
|
|
630
754
|
verifyType: user.verifyType,
|
|
@@ -639,7 +763,7 @@ export const useDataStore = defineStore('data', {
|
|
|
639
763
|
countryOfTaxResidency,
|
|
640
764
|
signOfResidency,
|
|
641
765
|
}))(user);
|
|
642
|
-
const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
766
|
+
const questionariesData: Types.ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
643
767
|
let questName = '';
|
|
644
768
|
let questionId = parseInt(question.ids as string).toString();
|
|
645
769
|
if (questionId === '500003') {
|
|
@@ -685,9 +809,29 @@ export const useDataStore = defineStore('data', {
|
|
|
685
809
|
});
|
|
686
810
|
}
|
|
687
811
|
}
|
|
812
|
+
if (this.isLifetrip) {
|
|
813
|
+
const lastNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500147') : undefined;
|
|
814
|
+
const firstNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500148') : undefined;
|
|
815
|
+
questionariesData.push({
|
|
816
|
+
id: lastNameLat ? lastNameLat.id : 0,
|
|
817
|
+
contragentId: Number(user.id),
|
|
818
|
+
questAnswer: user.lastNameLat ?? '',
|
|
819
|
+
questAnswerName: null,
|
|
820
|
+
questName: 'Фамилия на латинице',
|
|
821
|
+
questId: '500147',
|
|
822
|
+
});
|
|
823
|
+
questionariesData.push({
|
|
824
|
+
id: firstNameLat ? firstNameLat.id : 0,
|
|
825
|
+
contragentId: Number(user.id),
|
|
826
|
+
questAnswer: user.firstNameLat ?? '',
|
|
827
|
+
questAnswerName: null,
|
|
828
|
+
questName: 'Имя на латинице',
|
|
829
|
+
questId: '500148',
|
|
830
|
+
});
|
|
831
|
+
}
|
|
688
832
|
|
|
689
833
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
690
|
-
const contactsData: ContragentContacts[] = [];
|
|
834
|
+
const contactsData: Types.ContragentContacts[] = [];
|
|
691
835
|
if (!!user.phoneNumber) {
|
|
692
836
|
contactsData.push({
|
|
693
837
|
contragentId: Number(user.id),
|
|
@@ -729,7 +873,7 @@ export const useDataStore = defineStore('data', {
|
|
|
729
873
|
|
|
730
874
|
const documentsData = user.documentsList;
|
|
731
875
|
const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
|
|
732
|
-
const userDocument: ContragentDocuments = {
|
|
876
|
+
const userDocument: Types.ContragentDocuments = {
|
|
733
877
|
contragentId: Number(user.id),
|
|
734
878
|
id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
|
|
735
879
|
description: null,
|
|
@@ -754,7 +898,7 @@ export const useDataStore = defineStore('data', {
|
|
|
754
898
|
|
|
755
899
|
const checkForNull = (value: any) => (value ? value : '');
|
|
756
900
|
const userResponseAddress = 'response' in user && user.response && 'addresses' in user.response && user.response.addresses ? user.response.addresses : null;
|
|
757
|
-
const addressData: ContragentAddress[] = [];
|
|
901
|
+
const addressData: Types.ContragentAddress[] = [];
|
|
758
902
|
addressData.push({
|
|
759
903
|
id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
|
|
760
904
|
contragentId: Number(user.id),
|
|
@@ -789,7 +933,7 @@ export const useDataStore = defineStore('data', {
|
|
|
789
933
|
|
|
790
934
|
const personId = await this.api.saveContragent(data);
|
|
791
935
|
if (personId > 0) {
|
|
792
|
-
if (this.isLKA || whichForm === 'contragent') {
|
|
936
|
+
if (this.isLKA || this.isLKA_A || whichForm === 'contragent') {
|
|
793
937
|
return personId;
|
|
794
938
|
} else {
|
|
795
939
|
await this.getContragentById(personId, whichForm, false, whichIndex);
|
|
@@ -827,6 +971,7 @@ export const useDataStore = defineStore('data', {
|
|
|
827
971
|
data.profession = member.job;
|
|
828
972
|
data.position = member.jobPosition;
|
|
829
973
|
data.jobName = member.jobPlace;
|
|
974
|
+
data.positionCode = member.positionCode;
|
|
830
975
|
data.familyStatusId = member.familyStatus.id;
|
|
831
976
|
}
|
|
832
977
|
if (whichMember === 'Spokesman') {
|
|
@@ -868,7 +1013,7 @@ export const useDataStore = defineStore('data', {
|
|
|
868
1013
|
data.isNotary = member.isNotary;
|
|
869
1014
|
}
|
|
870
1015
|
if (whichMember === 'Insured') {
|
|
871
|
-
if (this.formStore.applicationData && this.formStore.applicationData.insuredApp && this.formStore.applicationData.insuredApp.length) {
|
|
1016
|
+
if (this.formStore.applicationData && this.formStore.applicationData.insuredApp && this.formStore.applicationData.insuredApp.length && !this.isPension) {
|
|
872
1017
|
if (this.members.insuredApp.has) {
|
|
873
1018
|
await this.deleteInsuredLogic();
|
|
874
1019
|
}
|
|
@@ -877,11 +1022,12 @@ export const useDataStore = defineStore('data', {
|
|
|
877
1022
|
delete data.id;
|
|
878
1023
|
}
|
|
879
1024
|
}
|
|
880
|
-
data.isDisability = this.formStore.isPolicyholderInsured ? false : member.isDisability
|
|
1025
|
+
data.isDisability = this.formStore.isPolicyholderInsured && !this.isPension ? false : !!member.isDisability;
|
|
881
1026
|
data.disabilityGroupId = data.isDisability && member.disabilityGroup ? member.disabilityGroup.id : null;
|
|
882
1027
|
data.profession = member.job;
|
|
883
1028
|
data.position = member.jobPosition;
|
|
884
1029
|
data.jobName = member.jobPlace;
|
|
1030
|
+
data.positionCode = member.positionCode;
|
|
885
1031
|
data.familyStatusId = member.familyStatus.id;
|
|
886
1032
|
data.relationId = member.relationDegree.ids;
|
|
887
1033
|
data.relationName = member.relationDegree.nameRu;
|
|
@@ -929,10 +1075,28 @@ export const useDataStore = defineStore('data', {
|
|
|
929
1075
|
}
|
|
930
1076
|
}
|
|
931
1077
|
},
|
|
1078
|
+
async setApplication(applicationData: object, calculate: boolean = false) {
|
|
1079
|
+
try {
|
|
1080
|
+
this.isLoading = true;
|
|
1081
|
+
this.isButtonsLoading = true;
|
|
1082
|
+
await this.api.setApplication(applicationData);
|
|
1083
|
+
if (calculate) {
|
|
1084
|
+
await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
|
|
1085
|
+
this.showToaster('success', this.t('toaster.successSaved'), 2000);
|
|
1086
|
+
}
|
|
1087
|
+
this.isLoading = false;
|
|
1088
|
+
this.isButtonsLoading = false;
|
|
1089
|
+
return true;
|
|
1090
|
+
} catch (err) {
|
|
1091
|
+
this.isLoading = false;
|
|
1092
|
+
this.isButtonsLoading = false;
|
|
1093
|
+
return ErrorHandler(err);
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
932
1096
|
getConditionsData() {
|
|
933
1097
|
const conditionsData: {
|
|
934
|
-
policyAppDto: PolicyAppDto;
|
|
935
|
-
addCoversDto: AddCover[];
|
|
1098
|
+
policyAppDto: Types.PolicyAppDto;
|
|
1099
|
+
addCoversDto: Types.AddCover[];
|
|
936
1100
|
} = {
|
|
937
1101
|
policyAppDto: {
|
|
938
1102
|
id: this.formStore.applicationData?.policyAppDto?.id,
|
|
@@ -952,7 +1116,7 @@ export const useDataStore = defineStore('data', {
|
|
|
952
1116
|
annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
|
|
953
1117
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
954
1118
|
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
955
|
-
: this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
|
|
1119
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
956
1120
|
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id ?? undefined,
|
|
957
1121
|
lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply ?? ''),
|
|
958
1122
|
lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive ?? ''),
|
|
@@ -975,6 +1139,15 @@ export const useDataStore = defineStore('data', {
|
|
|
975
1139
|
conditionsData.policyAppDto.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
976
1140
|
conditionsData.policyAppDto.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
977
1141
|
}
|
|
1142
|
+
if (this.isLifeBusiness || this.isGns) {
|
|
1143
|
+
conditionsData.policyAppDto.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
|
|
1144
|
+
conditionsData.policyAppDto.fixInsSum = getNumber(String(this.formStore.productConditionsForm.fixInsSum));
|
|
1145
|
+
conditionsData.policyAppDto.mainInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
|
|
1146
|
+
conditionsData.policyAppDto.agentCommission = Number(this.formStore.productConditionsForm.agentCommission);
|
|
1147
|
+
conditionsData.policyAppDto.processDefinitionFgotId = (this.formStore.productConditionsForm.processGfot.id as string) ?? undefined;
|
|
1148
|
+
conditionsData.policyAppDto.contractEndDate = formatDate(this.formStore.productConditionsForm.contractEndDate as string)!.toISOString();
|
|
1149
|
+
conditionsData.policyAppDto.calcDate = formatDate(this.formStore.productConditionsForm.calcDate as string)!.toISOString();
|
|
1150
|
+
}
|
|
978
1151
|
return conditionsData;
|
|
979
1152
|
},
|
|
980
1153
|
async clearAddCovers(coverCode: number, coverValue: string) {
|
|
@@ -993,6 +1166,8 @@ export const useDataStore = defineStore('data', {
|
|
|
993
1166
|
}
|
|
994
1167
|
},
|
|
995
1168
|
async deleteInsuredLogic() {
|
|
1169
|
+
// TODO Просмотреть
|
|
1170
|
+
if (this.isLifetrip || this.isPension) return;
|
|
996
1171
|
const applicationData = this.getConditionsData();
|
|
997
1172
|
const clearCovers = [{ code: 10, value: 'excluded' }];
|
|
998
1173
|
await Promise.allSettled(
|
|
@@ -1023,6 +1198,16 @@ export const useDataStore = defineStore('data', {
|
|
|
1023
1198
|
}
|
|
1024
1199
|
return null;
|
|
1025
1200
|
},
|
|
1201
|
+
async getProcessCoverTypePeriod(questionId: string) {
|
|
1202
|
+
if (!this.processCode) return null;
|
|
1203
|
+
try {
|
|
1204
|
+
const answers = await this.api.getProcessCoverTypePeriod(this.processCode, questionId);
|
|
1205
|
+
return answers;
|
|
1206
|
+
} catch (err) {
|
|
1207
|
+
console.log(err);
|
|
1208
|
+
}
|
|
1209
|
+
return null;
|
|
1210
|
+
},
|
|
1026
1211
|
async definedAnswers(
|
|
1027
1212
|
filter: string,
|
|
1028
1213
|
whichSurvey: 'surveyByHealthBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBase' | 'surveyByCriticalBasePolicyholder',
|
|
@@ -1039,7 +1224,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1039
1224
|
}
|
|
1040
1225
|
return this.formStore.definedAnswersId[whichSurvey];
|
|
1041
1226
|
},
|
|
1042
|
-
async setSurvey(data: AnketaFirst) {
|
|
1227
|
+
async setSurvey(data: Types.AnketaFirst) {
|
|
1043
1228
|
try {
|
|
1044
1229
|
this.isLoading = true;
|
|
1045
1230
|
const anketaToken = await this.api.setSurvey(data);
|
|
@@ -1051,9 +1236,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1051
1236
|
this.isLoading = false;
|
|
1052
1237
|
}
|
|
1053
1238
|
},
|
|
1054
|
-
async setINSISWorkData() {
|
|
1239
|
+
async setINSISWorkData(loading: boolean = true) {
|
|
1055
1240
|
if (!this.formStore.applicationData.insisWorkDataApp) return;
|
|
1056
|
-
const data: InsisWorkDataApp = {
|
|
1241
|
+
const data: Types.InsisWorkDataApp = {
|
|
1057
1242
|
id: this.formStore.applicationData.insisWorkDataApp.id,
|
|
1058
1243
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
1059
1244
|
agentId: Number(this.formStore.AgentData.agentId),
|
|
@@ -1070,7 +1255,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1070
1255
|
insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
|
|
1071
1256
|
};
|
|
1072
1257
|
try {
|
|
1073
|
-
this.isLoading =
|
|
1258
|
+
this.isLoading = loading;
|
|
1074
1259
|
await this.api.setINSISWorkData(data);
|
|
1075
1260
|
} catch (err) {
|
|
1076
1261
|
ErrorHandler(err);
|
|
@@ -1099,7 +1284,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1099
1284
|
async getFromApi(whichField: string, whichRequest: string, parameter?: any, reset: boolean = false): Promise<Value[]> {
|
|
1100
1285
|
const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
|
|
1101
1286
|
const currentHour = new Date().getHours();
|
|
1102
|
-
const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / (this.isLKA ? 60 : 15));
|
|
1287
|
+
const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / (this.isLKA || this.isLKA_A ? 60 : 15));
|
|
1103
1288
|
|
|
1104
1289
|
const getDataCondition = () => {
|
|
1105
1290
|
if (!storageValue) return true;
|
|
@@ -1110,7 +1295,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1110
1295
|
if (storageValue && (hasHourKey === false || hasMiniteKey === false || hasModeKey === false || hasValueKey === false)) return true;
|
|
1111
1296
|
if (
|
|
1112
1297
|
storageValue &&
|
|
1113
|
-
(storageValue.hour !== currentHour || storageValue.minute !== currentMinutePart || storageValue.mode !== import.meta.env.
|
|
1298
|
+
(storageValue.hour !== currentHour || storageValue.minute !== currentMinutePart || storageValue.mode !== import.meta.env.VITE_MODE || storageValue.value.length === 0)
|
|
1114
1299
|
)
|
|
1115
1300
|
return true;
|
|
1116
1301
|
};
|
|
@@ -1127,7 +1312,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1127
1312
|
value: response,
|
|
1128
1313
|
hour: currentHour,
|
|
1129
1314
|
minute: currentMinutePart,
|
|
1130
|
-
mode: import.meta.env.
|
|
1315
|
+
mode: import.meta.env.VITE_MODE,
|
|
1131
1316
|
}),
|
|
1132
1317
|
);
|
|
1133
1318
|
//@ts-ignore
|
|
@@ -1145,7 +1330,28 @@ export const useDataStore = defineStore('data', {
|
|
|
1145
1330
|
return this[whichField];
|
|
1146
1331
|
},
|
|
1147
1332
|
async getCountries() {
|
|
1148
|
-
|
|
1333
|
+
const response = await this.getFromApi('countries', 'getCountries');
|
|
1334
|
+
const kzIndex = response.findIndex(country => country.ids === 'KZ');
|
|
1335
|
+
if (kzIndex !== -1) {
|
|
1336
|
+
const element = response.splice(kzIndex, 1)[0];
|
|
1337
|
+
response.splice(0, 0, element);
|
|
1338
|
+
}
|
|
1339
|
+
return response;
|
|
1340
|
+
},
|
|
1341
|
+
async getDicCountries() {
|
|
1342
|
+
if (this.isLifetrip) return await this.getFromApi('dicAllCountries', 'getArmDicts', 'DicCountry');
|
|
1343
|
+
},
|
|
1344
|
+
async getDicTripType() {
|
|
1345
|
+
if (this.isLifetrip) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
|
|
1346
|
+
},
|
|
1347
|
+
async getDicTripPurpose() {
|
|
1348
|
+
if (this.isLifetrip) return await this.getFromApi('purposes', 'getArmDicts', 'DicTripPurpose');
|
|
1349
|
+
},
|
|
1350
|
+
async getDicTripWorkType() {
|
|
1351
|
+
if (this.isLifetrip) return await this.getFromApi('workTypes', 'getArmDicts', 'DicTripWorkType');
|
|
1352
|
+
},
|
|
1353
|
+
async getDicSportsType() {
|
|
1354
|
+
if (this.isLifetrip) return await this.getFromApi('sportsTypes', 'getArmDicts', 'DicSportsType');
|
|
1149
1355
|
},
|
|
1150
1356
|
async getCitizenshipCountries() {
|
|
1151
1357
|
return await this.getFromApi('citizenshipCountries', 'getCitizenshipCountries');
|
|
@@ -1156,31 +1362,80 @@ export const useDataStore = defineStore('data', {
|
|
|
1156
1362
|
async getAdditionalTaxCountries() {
|
|
1157
1363
|
return await this.getFromApi('addTaxCountries', 'getAdditionalTaxCountries');
|
|
1158
1364
|
},
|
|
1159
|
-
async getStates(key?: string, member?: Member) {
|
|
1365
|
+
async getStates(key?: string, member?: Member, keys?: { key?: string; deepKey?: string; subDeepKey?: string }) {
|
|
1160
1366
|
await this.getFromApi('states', 'getStates');
|
|
1161
|
-
|
|
1162
|
-
|
|
1367
|
+
if (!!keys) {
|
|
1368
|
+
if (!!keys.key) {
|
|
1369
|
+
if (!!keys.deepKey) {
|
|
1370
|
+
if (!!keys.subDeepKey) {
|
|
1371
|
+
//@ts-ignore
|
|
1372
|
+
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);
|
|
1373
|
+
} else {
|
|
1374
|
+
//@ts-ignore
|
|
1375
|
+
return this.states.filter(i => i.code === member[keys.key][keys.deepKey].ids || i.code === member[keys.key][keys.deepKey].id);
|
|
1376
|
+
}
|
|
1377
|
+
} else {
|
|
1378
|
+
//@ts-ignore
|
|
1379
|
+
return this.states.filter(i => i.code === member[keys.key].ids || i.code === member[keys.key].id);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
} else {
|
|
1383
|
+
//@ts-ignore
|
|
1384
|
+
if (key && member[key] && member[key].ids !== null) return this.states.filter((i: Value) => i.code === member[key].ids);
|
|
1385
|
+
}
|
|
1163
1386
|
return this.states;
|
|
1164
1387
|
},
|
|
1165
|
-
async getRegions(key?: string, member?: Member) {
|
|
1388
|
+
async getRegions(key?: string, member?: Member, keys?: { key?: string; deepKey?: string; subDeepKey?: string }) {
|
|
1166
1389
|
await this.getFromApi('regions', 'getRegions');
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1390
|
+
if (!!keys) {
|
|
1391
|
+
if (!!keys.key) {
|
|
1392
|
+
if (!!keys.deepKey) {
|
|
1393
|
+
if (!!keys.subDeepKey) {
|
|
1394
|
+
//@ts-ignore
|
|
1395
|
+
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);
|
|
1396
|
+
} else {
|
|
1397
|
+
//@ts-ignore
|
|
1398
|
+
return this.regions.filter(i => i.code === member[keys.key][keys.deepKey].ids || i.code === member[keys.key][keys.deepKey].id);
|
|
1399
|
+
}
|
|
1400
|
+
} else {
|
|
1401
|
+
//@ts-ignore
|
|
1402
|
+
return this.regions.filter(i => i.code === member[keys.key].ids || i.code === member[keys.key].id);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1171
1405
|
} else {
|
|
1172
|
-
|
|
1406
|
+
//@ts-ignore
|
|
1407
|
+
if (key && member[key] && member[key].ids !== null) return this.regions.filter((i: Value) => i.code === member[key].ids);
|
|
1408
|
+
if (member && member.registrationProvince.ids !== null) {
|
|
1409
|
+
return this.regions.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1410
|
+
}
|
|
1173
1411
|
}
|
|
1412
|
+
return this.regions;
|
|
1174
1413
|
},
|
|
1175
|
-
async getCities(key?: string, member?: Member) {
|
|
1414
|
+
async getCities(key?: string, member?: Member, keys?: { key?: string; deepKey?: string; subDeepKey?: string }) {
|
|
1176
1415
|
await this.getFromApi('cities', 'getCities');
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1416
|
+
if (!!keys) {
|
|
1417
|
+
if (!!keys.key) {
|
|
1418
|
+
if (!!keys.deepKey) {
|
|
1419
|
+
if (!!keys.subDeepKey) {
|
|
1420
|
+
//@ts-ignore
|
|
1421
|
+
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);
|
|
1422
|
+
} else {
|
|
1423
|
+
//@ts-ignore
|
|
1424
|
+
return this.cities.filter(i => i.code === member[keys.key][keys.deepKey].ids || i.code === member[keys.key][keys.deepKey].id);
|
|
1425
|
+
}
|
|
1426
|
+
} else {
|
|
1427
|
+
//@ts-ignore
|
|
1428
|
+
return this.cities.filter(i => i.code === member[keys.key].ids || i.code === member[keys.key].id);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1181
1431
|
} else {
|
|
1182
|
-
|
|
1432
|
+
//@ts-ignore
|
|
1433
|
+
if (key && member[key] && member[key].ids !== null) return this.cities.filter((i: Value) => i.code === member[key].ids);
|
|
1434
|
+
if (member && member.registrationProvince.ids !== null) {
|
|
1435
|
+
return this.cities.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1436
|
+
}
|
|
1183
1437
|
}
|
|
1438
|
+
return this.cities;
|
|
1184
1439
|
},
|
|
1185
1440
|
async getLocalityTypes() {
|
|
1186
1441
|
return await this.getFromApi('localityTypes', 'getLocalityTypes');
|
|
@@ -1208,12 +1463,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1208
1463
|
async getSectorCodeList() {
|
|
1209
1464
|
return await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1210
1465
|
},
|
|
1466
|
+
async getEconomicActivityType() {
|
|
1467
|
+
if (this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
|
|
1468
|
+
},
|
|
1211
1469
|
async getFamilyStatuses() {
|
|
1212
1470
|
return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
|
|
1213
1471
|
},
|
|
1472
|
+
async getDisabilityGroups() {
|
|
1473
|
+
return await this.getFromApi('disabilityGroups', 'getArmDicts', 'DicDisabilityGroup');
|
|
1474
|
+
},
|
|
1214
1475
|
async getRelationTypes() {
|
|
1215
1476
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1216
1477
|
},
|
|
1478
|
+
async getBanks() {
|
|
1479
|
+
if (this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO) return await this.getFromApi('banks', 'getBanks');
|
|
1480
|
+
},
|
|
1481
|
+
async getInsuranceCompanies() {
|
|
1482
|
+
if (this.isPension) return await this.getFromApi('transferContractCompanies', 'getInsuranceCompanies');
|
|
1483
|
+
},
|
|
1217
1484
|
async getProcessIndexRate() {
|
|
1218
1485
|
if (this.processCode) {
|
|
1219
1486
|
return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
@@ -1228,7 +1495,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1228
1495
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1229
1496
|
},
|
|
1230
1497
|
async getProcessTariff() {
|
|
1231
|
-
return await this.getFromApi('processTariff', 'getProcessTariff');
|
|
1498
|
+
if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
|
|
1232
1499
|
},
|
|
1233
1500
|
async getDicAnnuityTypeList() {
|
|
1234
1501
|
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
@@ -1241,6 +1508,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1241
1508
|
async getInsurancePay() {
|
|
1242
1509
|
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
1243
1510
|
},
|
|
1511
|
+
async getProcessGfot() {
|
|
1512
|
+
if (this.processCode) {
|
|
1513
|
+
return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
|
|
1514
|
+
}
|
|
1515
|
+
},
|
|
1244
1516
|
async getCurrencies() {
|
|
1245
1517
|
try {
|
|
1246
1518
|
const currencies = await this.api.getCurrencies();
|
|
@@ -1254,6 +1526,21 @@ export const useDataStore = defineStore('data', {
|
|
|
1254
1526
|
async getDictionaryItems(dictName: string) {
|
|
1255
1527
|
return await this.getFromApi(dictName, 'getDictionaryItems', dictName);
|
|
1256
1528
|
},
|
|
1529
|
+
getGenderList() {
|
|
1530
|
+
return this.gender;
|
|
1531
|
+
},
|
|
1532
|
+
async getAuthorityBasis() {
|
|
1533
|
+
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension) return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
|
|
1534
|
+
},
|
|
1535
|
+
async getWorkPosition(search: string) {
|
|
1536
|
+
try {
|
|
1537
|
+
const workPositions = await this.api.getWorkPosition(search);
|
|
1538
|
+
return workPositions;
|
|
1539
|
+
} catch (err) {
|
|
1540
|
+
ErrorHandler(err);
|
|
1541
|
+
return [];
|
|
1542
|
+
}
|
|
1543
|
+
},
|
|
1257
1544
|
async getAllFormsData() {
|
|
1258
1545
|
await Promise.allSettled([
|
|
1259
1546
|
this.getCountries(),
|
|
@@ -1279,52 +1566,56 @@ export const useDataStore = defineStore('data', {
|
|
|
1279
1566
|
this.getInsurancePay(),
|
|
1280
1567
|
this.getDictionaryItems('RegionPolicy'),
|
|
1281
1568
|
this.getDictionaryItems('SaleChanellPolicy'),
|
|
1569
|
+
this.getDicTripType(),
|
|
1570
|
+
this.getDicCountries(),
|
|
1571
|
+
this.getDicTripWorkType(),
|
|
1572
|
+
this.getDicSportsType(),
|
|
1573
|
+
this.getDicTripPurpose(),
|
|
1574
|
+
this.getCurrencies(),
|
|
1575
|
+
this.getProcessGfot(),
|
|
1576
|
+
this.getBanks(),
|
|
1577
|
+
this.getInsuranceCompanies(),
|
|
1578
|
+
this.getEconomicActivityType(),
|
|
1579
|
+
this.getAuthorityBasis(),
|
|
1580
|
+
this.getDisabilityGroups(),
|
|
1282
1581
|
]);
|
|
1283
1582
|
},
|
|
1284
1583
|
async getQuestionList(
|
|
1285
1584
|
surveyType: 'health' | 'critical',
|
|
1286
1585
|
processInstanceId: string | number,
|
|
1287
1586
|
insuredId: any,
|
|
1288
|
-
baseField:
|
|
1289
|
-
secondaryField: string,
|
|
1587
|
+
baseField: 'surveyByHealthBase' | 'surveyByCriticalBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBasePolicyholder',
|
|
1290
1588
|
whichMember: 'insured' | 'policyholder' = 'insured',
|
|
1291
1589
|
) {
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
this.formStore[baseField] = baseQuestions.value;
|
|
1317
|
-
}
|
|
1318
|
-
if (secondaryQuestions.status === 'fulfilled') {
|
|
1319
|
-
//@ts-ignore
|
|
1320
|
-
this.formStore[secondaryField] = secondaryQuestions;
|
|
1321
|
-
}
|
|
1590
|
+
try {
|
|
1591
|
+
const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
|
|
1592
|
+
whichMember === 'insured' ? this.api.getQuestionList(surveyType, processInstanceId, insuredId) : this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
|
|
1593
|
+
whichMember === 'insured'
|
|
1594
|
+
? this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId)
|
|
1595
|
+
: this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
|
|
1596
|
+
,
|
|
1597
|
+
]);
|
|
1598
|
+
if (baseQuestions.status === 'fulfilled') {
|
|
1599
|
+
this.formStore[baseField] = baseQuestions.value;
|
|
1600
|
+
}
|
|
1601
|
+
if (secondaryQuestions.status === 'fulfilled') {
|
|
1602
|
+
const baseAnketa = this.formStore[baseField];
|
|
1603
|
+
if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
|
|
1604
|
+
baseAnketa.body.forEach(i => {
|
|
1605
|
+
if (i.first.definedAnswers === 'Y' && i.second === null && secondaryQuestions.value) {
|
|
1606
|
+
i.second = structuredClone(secondaryQuestions.value);
|
|
1607
|
+
}
|
|
1608
|
+
if (i.first.definedAnswers === 'Y' && i.second && i.second.length) {
|
|
1609
|
+
i.second.forEach(second => {
|
|
1610
|
+
if (second.answerType === 'D') second.answerText = reformatDate(String(second.answerText));
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
});
|
|
1322
1614
|
}
|
|
1323
|
-
} catch (err) {
|
|
1324
|
-
console.log(err);
|
|
1325
1615
|
}
|
|
1616
|
+
} catch (err) {
|
|
1617
|
+
ErrorHandler(err);
|
|
1326
1618
|
}
|
|
1327
|
-
//@ts-ignore
|
|
1328
1619
|
return this.formStore[baseField];
|
|
1329
1620
|
},
|
|
1330
1621
|
getNumberWithSpaces(n: any) {
|
|
@@ -1336,7 +1627,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1336
1627
|
return parts.join(',');
|
|
1337
1628
|
},
|
|
1338
1629
|
getNumberWithDot(n: any) {
|
|
1339
|
-
return n === null
|
|
1630
|
+
return n === null
|
|
1631
|
+
? null
|
|
1632
|
+
: n
|
|
1633
|
+
.toLocaleString('ru', {
|
|
1634
|
+
maximumFractionDigits: 2,
|
|
1635
|
+
minimumFractionDigits: 2,
|
|
1636
|
+
})
|
|
1637
|
+
.replace(/,/g, '.');
|
|
1340
1638
|
},
|
|
1341
1639
|
async getTaskList(
|
|
1342
1640
|
search: string = '',
|
|
@@ -1376,7 +1674,18 @@ export const useDataStore = defineStore('data', {
|
|
|
1376
1674
|
delete query.processCodes;
|
|
1377
1675
|
query.processCode = byOneProcess;
|
|
1378
1676
|
}
|
|
1379
|
-
|
|
1677
|
+
if (byOneProcess === 19 && !useEnv().isProduction) {
|
|
1678
|
+
query.processCodes = [19, 2];
|
|
1679
|
+
delete query.processCode;
|
|
1680
|
+
}
|
|
1681
|
+
const taskList = await this.api.getTaskList(
|
|
1682
|
+
processInstanceId === null
|
|
1683
|
+
? query
|
|
1684
|
+
: {
|
|
1685
|
+
...query,
|
|
1686
|
+
processInstanceId: processInstanceId,
|
|
1687
|
+
},
|
|
1688
|
+
);
|
|
1380
1689
|
if (needToReturn) {
|
|
1381
1690
|
this.isLoading = false;
|
|
1382
1691
|
return taskList.items;
|
|
@@ -1462,12 +1771,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1462
1771
|
},
|
|
1463
1772
|
findObject(from: string, key: string, searchKey: any): any {
|
|
1464
1773
|
// @ts-ignore
|
|
1465
|
-
const found = this[from].find(i => i[key] == searchKey);
|
|
1774
|
+
const found = this[from].find((i: Value) => i[key] == searchKey);
|
|
1466
1775
|
return found || new Value();
|
|
1467
1776
|
},
|
|
1468
|
-
async searchAgentByName(name: string) {
|
|
1777
|
+
async searchAgentByName(name: string, branchCode?: string) {
|
|
1469
1778
|
try {
|
|
1470
|
-
this.AgentData = await this.api.searchAgentByName(name);
|
|
1779
|
+
this.AgentData = await this.api.searchAgentByName(name, branchCode);
|
|
1471
1780
|
if (!this.AgentData.length) {
|
|
1472
1781
|
this.showToaster('error', this.t('toaster.notFound'), 1500);
|
|
1473
1782
|
}
|
|
@@ -1513,18 +1822,69 @@ export const useDataStore = defineStore('data', {
|
|
|
1513
1822
|
this.isLoading = false;
|
|
1514
1823
|
}
|
|
1515
1824
|
},
|
|
1825
|
+
async getTripInsuredAmount(show: boolean = true) {
|
|
1826
|
+
this.isLoading = true;
|
|
1827
|
+
try {
|
|
1828
|
+
const countryID: string[] = [];
|
|
1829
|
+
for (let country = 0; country < this.formStore.productConditionsForm.calculatorForm.countries!.length; country++) {
|
|
1830
|
+
countryID.push(this.formStore.productConditionsForm.calculatorForm.countries![country].id as string);
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
const form = {
|
|
1834
|
+
tripTypeID: this.formStore.productConditionsForm.calculatorForm.type.id,
|
|
1835
|
+
countryID,
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
const result = await this.api.getTripInsuredAmount(form);
|
|
1839
|
+
const amounts: Value[] = [];
|
|
1840
|
+
result.amounts.forEach(amount => {
|
|
1841
|
+
amounts.push(new Value(amount['id'], amount['nameRu']));
|
|
1842
|
+
});
|
|
1843
|
+
|
|
1844
|
+
this.amountArray = amounts;
|
|
1845
|
+
this.formStore.productConditionsForm.calculatorForm.amount = new Value();
|
|
1846
|
+
this.currency = result.currency;
|
|
1847
|
+
|
|
1848
|
+
if (show) {
|
|
1849
|
+
this.showToaster('success', this.t('toaster.tripInsuredAmountCalculated'), 1000);
|
|
1850
|
+
}
|
|
1851
|
+
} catch (err) {
|
|
1852
|
+
ErrorHandler(err);
|
|
1853
|
+
}
|
|
1854
|
+
this.isLoading = false;
|
|
1855
|
+
},
|
|
1856
|
+
async getPeriod() {
|
|
1857
|
+
if (this.periodArray.length === 0) {
|
|
1858
|
+
try {
|
|
1859
|
+
const response = await this.api.getTripInsuranceDaysOptions();
|
|
1860
|
+
if (response) {
|
|
1861
|
+
const new3 = response.period;
|
|
1862
|
+
const newPeriod: Value[] = [];
|
|
1863
|
+
const newMaxDays: Value[] = [];
|
|
1864
|
+
Object.keys(new3).forEach(key => {
|
|
1865
|
+
newPeriod.push(new Value(key, key, key, key));
|
|
1866
|
+
new3[key as keyof typeof new3].forEach(item => {
|
|
1867
|
+
newMaxDays.push(new Value(item, item, item, key));
|
|
1868
|
+
});
|
|
1869
|
+
});
|
|
1870
|
+
this.periodArray = newPeriod;
|
|
1871
|
+
this.maxDaysAllArray = newMaxDays;
|
|
1872
|
+
}
|
|
1873
|
+
} catch (err) {
|
|
1874
|
+
ErrorHandler(err);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
},
|
|
1516
1878
|
async calculateWithoutApplication(showLoader: boolean = false, product: string | null = null) {
|
|
1517
1879
|
this.isLoading = showLoader;
|
|
1518
1880
|
try {
|
|
1519
|
-
if (!this.formStore.productConditionsForm.signDate
|
|
1881
|
+
if (!this.formStore.productConditionsForm.signDate) {
|
|
1520
1882
|
return;
|
|
1521
1883
|
}
|
|
1522
1884
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
signDate: signDate.toISOString(),
|
|
1527
|
-
birthDate: birthDate.toISOString(),
|
|
1885
|
+
const calculationData: Types.RecalculationDataType & Types.PolicyAppDto = {
|
|
1886
|
+
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1887
|
+
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1528
1888
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
1529
1889
|
amount: getNumber(String(this.formStore.productConditionsForm.requestedSumInsured)),
|
|
1530
1890
|
premium: getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonth)),
|
|
@@ -1532,7 +1892,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1532
1892
|
payPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
|
|
1533
1893
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
1534
1894
|
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
1535
|
-
: this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
|
|
1895
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
1536
1896
|
paymentPeriodId: (this.formStore.productConditionsForm.paymentPeriod.id as string) ?? undefined,
|
|
1537
1897
|
addCovers: this.formStore.additionalInsuranceTermsWithout,
|
|
1538
1898
|
};
|
|
@@ -1541,15 +1901,26 @@ export const useDataStore = defineStore('data', {
|
|
|
1541
1901
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1542
1902
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1543
1903
|
}
|
|
1544
|
-
if (this.isLiferenta) {
|
|
1904
|
+
if (this.isLiferenta || product === 'liferenta') {
|
|
1545
1905
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1546
1906
|
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
1547
1907
|
calculationData.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
1548
1908
|
calculationData.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
1549
1909
|
}
|
|
1910
|
+
if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
|
|
1911
|
+
calculationData.clients = this.formStore.lfb.clients;
|
|
1912
|
+
calculationData.insrCount = this.formStore.lfb.clients.length;
|
|
1913
|
+
calculationData.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
|
|
1914
|
+
calculationData.fixInsSum = getNumber(String(this.formStore.productConditionsForm.fixInsSum));
|
|
1915
|
+
calculationData.mainInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
|
|
1916
|
+
calculationData.agentCommission = Number(this.formStore.productConditionsForm.agentCommission);
|
|
1917
|
+
calculationData.processDefinitionFgotId = this.formStore.productConditionsForm.processGfot.id;
|
|
1918
|
+
calculationData.contractEndDate = formatDate(this.formStore.productConditionsForm.contractEndDate as string)!.toISOString();
|
|
1919
|
+
calculationData.calcDate = formatDate(this.formStore.productConditionsForm.calcDate as string)!.toISOString();
|
|
1920
|
+
}
|
|
1550
1921
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1551
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
1552
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
|
|
1922
|
+
if (calculationResponse.amount) this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
1923
|
+
if (calculationResponse.premium) this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
|
|
1553
1924
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1554
1925
|
if (this.isKazyna || product === 'halykkazyna') {
|
|
1555
1926
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
@@ -1558,9 +1929,28 @@ export const useDataStore = defineStore('data', {
|
|
|
1558
1929
|
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
|
|
1559
1930
|
}
|
|
1560
1931
|
}
|
|
1561
|
-
if (this.isLiferenta) {
|
|
1932
|
+
if (this.isLiferenta || product === 'liferenta') {
|
|
1562
1933
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(calculationResponse.annuityMonthPay);
|
|
1563
1934
|
}
|
|
1935
|
+
if (this.isGons || product === 'gons') {
|
|
1936
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(calculationResponse.totalAmount5);
|
|
1937
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(calculationResponse.totalAmount7);
|
|
1938
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(calculationResponse.statePremium5);
|
|
1939
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
|
|
1940
|
+
}
|
|
1941
|
+
if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
|
|
1942
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremiumWithCommission);
|
|
1943
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.mainInsSum === 0 ? null : calculationResponse.mainInsSum);
|
|
1944
|
+
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1945
|
+
if (calculationResponse.agentCommission) {
|
|
1946
|
+
this.formStore.productConditionsForm.agentCommission = calculationResponse.agentCommission;
|
|
1947
|
+
}
|
|
1948
|
+
if (calculationResponse.clients) {
|
|
1949
|
+
this.formStore.lfb.clients = calculationResponse.clients;
|
|
1950
|
+
}
|
|
1951
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1952
|
+
return calculationResponse;
|
|
1953
|
+
}
|
|
1564
1954
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1565
1955
|
} catch (err) {
|
|
1566
1956
|
ErrorHandler(err);
|
|
@@ -1573,7 +1963,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1573
1963
|
this.isLoading = true;
|
|
1574
1964
|
try {
|
|
1575
1965
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1576
|
-
await this.api.setApplication(this.getConditionsData());
|
|
1966
|
+
if (!this.isPension) await this.api.setApplication(this.getConditionsData());
|
|
1577
1967
|
const result = ref();
|
|
1578
1968
|
result.value = await this.api.getCalculation(String(id));
|
|
1579
1969
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
@@ -1596,20 +1986,100 @@ export const useDataStore = defineStore('data', {
|
|
|
1596
1986
|
if (this.isLiferenta) {
|
|
1597
1987
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
1598
1988
|
}
|
|
1989
|
+
if (this.isGons) {
|
|
1990
|
+
const govPremiums = await this.api.getGovernmentPremiums(String(id));
|
|
1991
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
|
|
1992
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
|
|
1993
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
|
|
1994
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
1995
|
+
}
|
|
1996
|
+
if (this.isLifeBusiness || this.isGns) {
|
|
1997
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1998
|
+
if (applicationData.insuredApp && applicationData.insuredApp.length) {
|
|
1999
|
+
const res = await this.newInsuredList(applicationData.insuredApp);
|
|
2000
|
+
this.formStore.lfb.clients = res;
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
2005
|
+
} catch (err) {
|
|
2006
|
+
ErrorHandler(err);
|
|
2007
|
+
}
|
|
2008
|
+
this.isLoading = false;
|
|
2009
|
+
},
|
|
2010
|
+
async calculatePremium(data: any) {
|
|
2011
|
+
this.isLoading = true;
|
|
2012
|
+
try {
|
|
2013
|
+
const response = await this.api.calculatePremium(data);
|
|
2014
|
+
// @ts-ignore
|
|
2015
|
+
if (response && response.errMsg) {
|
|
2016
|
+
// @ts-ignore
|
|
2017
|
+
this.showToaster('error', response.errMsg, 1000);
|
|
2018
|
+
} else {
|
|
2019
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
2020
|
+
}
|
|
2021
|
+
this.isLoading = false;
|
|
2022
|
+
return response;
|
|
2023
|
+
} catch (err) {
|
|
2024
|
+
ErrorHandler(err);
|
|
2025
|
+
}
|
|
2026
|
+
this.isLoading = false;
|
|
2027
|
+
},
|
|
2028
|
+
async calculatePrice(taskId?: string) {
|
|
2029
|
+
this.isLoading = true;
|
|
2030
|
+
try {
|
|
2031
|
+
const priceForm: Types.SetApplicationRequest = {};
|
|
2032
|
+
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
2033
|
+
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
2034
|
+
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
2035
|
+
priceForm.tripPurposeId = this.formStore.productConditionsForm.calculatorForm.purpose.id;
|
|
2036
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'WorkStudy') {
|
|
2037
|
+
priceForm.workTypeId = this.formStore.productConditionsForm.calculatorForm.workType.id;
|
|
2038
|
+
}
|
|
2039
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'Sport') {
|
|
2040
|
+
priceForm.sportsTypeId = this.formStore.productConditionsForm.calculatorForm.sportsType!.id;
|
|
2041
|
+
}
|
|
2042
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
2043
|
+
priceForm.singleTripDays = Number(this.formStore.productConditionsForm.calculatorForm.days);
|
|
2044
|
+
} else {
|
|
2045
|
+
priceForm.multipleTripMaxDays = Number(this.formStore.productConditionsForm.calculatorForm.maxDays.nameRu);
|
|
2046
|
+
priceForm.tripInsurancePeriod = Number(this.formStore.productConditionsForm.calculatorForm.period.nameRu);
|
|
2047
|
+
}
|
|
2048
|
+
if (this.isTask()) {
|
|
2049
|
+
priceForm.processInstanceId = this.formStore.applicationData.processInstanceId!;
|
|
2050
|
+
priceForm.id = taskId!;
|
|
2051
|
+
priceForm.age = Number(this.formStore.policyholderForm.age);
|
|
2052
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Multiple') {
|
|
2053
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
2054
|
+
} else {
|
|
2055
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
2056
|
+
priceForm.endDate = formatDate(this.formStore.productConditionsForm.calculatorForm.endDate!)!.toISOString();
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
if (this.isTask() && taskId) {
|
|
2060
|
+
await this.api.setApplication(priceForm);
|
|
2061
|
+
await this.api.getCalculator(priceForm);
|
|
2062
|
+
const applicationData = await this.api.getApplicationData(taskId);
|
|
2063
|
+
this.formStore.applicationData = applicationData;
|
|
2064
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
2065
|
+
} else {
|
|
2066
|
+
const result = await this.api.getCalculator(priceForm);
|
|
2067
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(result)} тг`;
|
|
2068
|
+
}
|
|
1599
2069
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1600
2070
|
} catch (err) {
|
|
1601
2071
|
ErrorHandler(err);
|
|
1602
2072
|
}
|
|
1603
2073
|
this.isLoading = false;
|
|
1604
2074
|
},
|
|
1605
|
-
async startApplication(member: Member) {
|
|
2075
|
+
async startApplication(member: Member, processCode?: number) {
|
|
1606
2076
|
if (!member.iin) return false;
|
|
1607
2077
|
try {
|
|
1608
|
-
const data: StartApplicationType = {
|
|
2078
|
+
const data: Types.StartApplicationType = {
|
|
1609
2079
|
clientId: member.id,
|
|
1610
2080
|
iin: member.iin.replace(/-/g, ''),
|
|
1611
2081
|
longName: member.longName ?? '',
|
|
1612
|
-
processCode: Number(this.processCode),
|
|
2082
|
+
processCode: processCode ?? Number(this.processCode),
|
|
1613
2083
|
policyId: 0,
|
|
1614
2084
|
};
|
|
1615
2085
|
const response = await this.api.startApplication(data);
|
|
@@ -1623,11 +2093,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1623
2093
|
this.isLoading = onlyGet;
|
|
1624
2094
|
try {
|
|
1625
2095
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
1626
|
-
if (this.processCode !== applicationData.processCode) {
|
|
2096
|
+
if (this.processCode !== applicationData.processCode && !this.isPension) {
|
|
1627
2097
|
this.isLoading = false;
|
|
1628
2098
|
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
|
|
1629
2099
|
return;
|
|
1630
2100
|
}
|
|
2101
|
+
this.formStore.regNumber = applicationData.regNumber;
|
|
1631
2102
|
this.formStore.applicationData = applicationData;
|
|
1632
2103
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
1633
2104
|
|
|
@@ -1639,7 +2110,6 @@ export const useDataStore = defineStore('data', {
|
|
|
1639
2110
|
this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
|
|
1640
2111
|
this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
|
|
1641
2112
|
this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
|
|
1642
|
-
|
|
1643
2113
|
this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
|
|
1644
2114
|
this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
|
|
1645
2115
|
|
|
@@ -1653,15 +2123,59 @@ export const useDataStore = defineStore('data', {
|
|
|
1653
2123
|
this.formStore.isActOwnBehalf = clientData.isActOwnBehalf;
|
|
1654
2124
|
this.formStore.hasRepresentative = !!applicationData.spokesmanApp;
|
|
1655
2125
|
|
|
1656
|
-
|
|
1657
|
-
|
|
2126
|
+
if (beneficiaryData) {
|
|
2127
|
+
const beneficiaryPolicyholderIndex = beneficiaryData.findIndex(i => i.insisId === clientData.insisId);
|
|
2128
|
+
this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
|
|
2129
|
+
}
|
|
1658
2130
|
|
|
1659
2131
|
if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
|
|
1660
2132
|
this.formStore.finCenterData = applicationData.finCenterData;
|
|
1661
2133
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
1662
2134
|
this.formStore.finCenterData.date = reformatDate(applicationData.finCenterData.date);
|
|
1663
2135
|
}
|
|
2136
|
+
if ('lifeTripApp' in applicationData && setProductConditions) {
|
|
2137
|
+
const tripType = this.types.find((i: Value) => i.id === applicationData.lifeTripApp.tripTypeId);
|
|
2138
|
+
this.formStore.productConditionsForm.calculatorForm.type = tripType ? tripType : new Value();
|
|
2139
|
+
|
|
2140
|
+
const countries: CountryValue[] = [];
|
|
2141
|
+
for (let i in applicationData.lifeTripApp.lifeTripCountries) {
|
|
2142
|
+
const tripCountry = this.dicAllCountries.find(country => country.id === applicationData.lifeTripApp.lifeTripCountries[i]);
|
|
2143
|
+
if (tripCountry) {
|
|
2144
|
+
countries.push(tripCountry);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
this.formStore.productConditionsForm.calculatorForm.countries = countries ? countries : [];
|
|
2148
|
+
|
|
2149
|
+
if (this.formStore.productConditionsForm.calculatorForm.countries.length && this.formStore.productConditionsForm.calculatorForm.type.nameRu != null) {
|
|
2150
|
+
await this.getTripInsuredAmount(false);
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
const amount = this.amountArray.find((i: Value) => i.id === applicationData.lifeTripApp.insuredAmountId);
|
|
2154
|
+
this.formStore.productConditionsForm.calculatorForm.amount = amount ? amount : new Value();
|
|
2155
|
+
|
|
2156
|
+
const purpose = this.purposes.find((i: Value) => i.id === applicationData.lifeTripApp.tripPurposeId);
|
|
2157
|
+
this.formStore.productConditionsForm.calculatorForm.purpose = purpose ? purpose : new Value();
|
|
2158
|
+
|
|
2159
|
+
if (applicationData.lifeTripApp.workTypeId != null) {
|
|
2160
|
+
const work = this.workTypes.find((i: Value) => i.id === applicationData.lifeTripApp.workTypeId);
|
|
2161
|
+
this.formStore.productConditionsForm.calculatorForm.workType = work ? work : new Value();
|
|
2162
|
+
}
|
|
2163
|
+
if (applicationData.lifeTripApp.sportsTypeId != null) {
|
|
2164
|
+
const sport = this.sportsTypes.find((i: Value) => i.id === applicationData.lifeTripApp.sportsTypeId);
|
|
2165
|
+
this.formStore.productConditionsForm.calculatorForm.sportsType = sport ? sport : new Value();
|
|
2166
|
+
}
|
|
2167
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
2168
|
+
this.formStore.productConditionsForm.calculatorForm.days = Number(applicationData.lifeTripApp.singleTripDays);
|
|
2169
|
+
} else {
|
|
2170
|
+
await this.getPeriod();
|
|
2171
|
+
this.formStore.productConditionsForm.calculatorForm.maxDays = this.maxDaysAllArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.multipleTripMaxDays)!;
|
|
2172
|
+
this.formStore.productConditionsForm.calculatorForm.period = this.periodArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.tripInsurancePeriod)!;
|
|
2173
|
+
}
|
|
2174
|
+
this.formStore.productConditionsForm.calculatorForm.startDate = reformatDate(applicationData.lifeTripApp.startDate);
|
|
2175
|
+
this.formStore.productConditionsForm.calculatorForm.endDate = reformatDate(applicationData.lifeTripApp.endDate);
|
|
1664
2176
|
|
|
2177
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
2178
|
+
}
|
|
1665
2179
|
if (fetchMembers) {
|
|
1666
2180
|
let allMembers = [
|
|
1667
2181
|
{
|
|
@@ -1679,6 +2193,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1679
2193
|
});
|
|
1680
2194
|
}
|
|
1681
2195
|
|
|
2196
|
+
if (applicationData.slave) {
|
|
2197
|
+
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2198
|
+
}
|
|
2199
|
+
|
|
1682
2200
|
if (insuredData && insuredData.length) {
|
|
1683
2201
|
insuredData.forEach((member, index) => {
|
|
1684
2202
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -1718,7 +2236,6 @@ export const useDataStore = defineStore('data', {
|
|
|
1718
2236
|
}
|
|
1719
2237
|
});
|
|
1720
2238
|
}
|
|
1721
|
-
|
|
1722
2239
|
await Promise.allSettled(
|
|
1723
2240
|
allMembers.map(async member => {
|
|
1724
2241
|
await this.getContragentById(member.insisId, member.key, false, member.index);
|
|
@@ -1731,7 +2248,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1731
2248
|
if (insuredData && insuredData.length) {
|
|
1732
2249
|
insuredData.forEach((each, index) => {
|
|
1733
2250
|
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
1734
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
2251
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1735
2252
|
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1736
2253
|
});
|
|
1737
2254
|
}
|
|
@@ -1739,11 +2256,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1739
2256
|
if (beneficiaryData && beneficiaryData.length) {
|
|
1740
2257
|
beneficiaryData.forEach((each, index) => {
|
|
1741
2258
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
1742
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
2259
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1743
2260
|
this.formStore.beneficiaryForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1744
2261
|
this.formStore.beneficiaryForm[index].percentageOfPayoutAmount = each.percentage;
|
|
1745
2262
|
if (this.isLiferenta || this.isBolashak) {
|
|
1746
|
-
const insurancePay = this.insurancePay.find(i => i.id == each.beneficiaryInsurancePayId);
|
|
2263
|
+
const insurancePay = this.insurancePay.find((i: Value) => i.id == each.beneficiaryInsurancePayId);
|
|
1747
2264
|
this.formStore.beneficiaryForm[index].insurancePay = insurancePay ? insurancePay : new Value();
|
|
1748
2265
|
}
|
|
1749
2266
|
});
|
|
@@ -1775,7 +2292,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1775
2292
|
this.formStore.policyholdersRepresentativeForm.isNotary = spokesmanData.isNotary;
|
|
1776
2293
|
}
|
|
1777
2294
|
}
|
|
1778
|
-
if (setProductConditions) {
|
|
2295
|
+
if (setProductConditions && !!applicationData.policyAppDto) {
|
|
2296
|
+
this.formStore.policyNumber = applicationData.policyAppDto.policyNumber;
|
|
2297
|
+
this.formStore.contractDate = reformatDate(applicationData.policyAppDto.contractDate);
|
|
1779
2298
|
this.formStore.productConditionsForm.coverPeriod = applicationData.policyAppDto.coverPeriod;
|
|
1780
2299
|
this.formStore.productConditionsForm.payPeriod = applicationData.policyAppDto.payPeriod;
|
|
1781
2300
|
// this.formStore.productConditionsForm.annualIncome = applicationData.policyAppDto.annualIncome?.toString();
|
|
@@ -1829,6 +2348,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1829
2348
|
});
|
|
1830
2349
|
this.formStore.productConditionsForm.riskGroup = riskGroup ? riskGroup : this.riskGroup.find(item => item.id == 1) ?? new Value();
|
|
1831
2350
|
}
|
|
2351
|
+
if (this.isPension && this.formStore.policyholderForm.bankInfo && this.formStore.policyholderForm.bankInfo.bik) {
|
|
2352
|
+
this.formStore.insuredForm[0].bankInfo = this.formStore.policyholderForm.bankInfo;
|
|
2353
|
+
}
|
|
1832
2354
|
} catch (err) {
|
|
1833
2355
|
ErrorHandler(err);
|
|
1834
2356
|
if (err instanceof AxiosError) {
|
|
@@ -1844,7 +2366,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1844
2366
|
async deleteTask(taskId: string) {
|
|
1845
2367
|
this.isLoading = true;
|
|
1846
2368
|
try {
|
|
1847
|
-
const data: SendTask = {
|
|
2369
|
+
const data: Types.SendTask = {
|
|
1848
2370
|
taskId: taskId,
|
|
1849
2371
|
decision: 'rejectclient',
|
|
1850
2372
|
comment: 'Клиент отказался',
|
|
@@ -1863,7 +2385,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1863
2385
|
try {
|
|
1864
2386
|
const data = {
|
|
1865
2387
|
taskId: taskId,
|
|
1866
|
-
decision: decision,
|
|
2388
|
+
decision: decision.replace(/custom/i, '') as keyof typeof constants.actions,
|
|
1867
2389
|
};
|
|
1868
2390
|
await this.api.sendTask(comment === null ? data : { ...data, comment: comment });
|
|
1869
2391
|
this.showToaster('success', this.t('toaster.successOperation'), 3000);
|
|
@@ -1871,6 +2393,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1871
2393
|
return true;
|
|
1872
2394
|
} catch (err) {
|
|
1873
2395
|
this.isLoading = false;
|
|
2396
|
+
this.isButtonsLoading = false;
|
|
1874
2397
|
return ErrorHandler(err);
|
|
1875
2398
|
}
|
|
1876
2399
|
},
|
|
@@ -1891,14 +2414,17 @@ export const useDataStore = defineStore('data', {
|
|
|
1891
2414
|
break;
|
|
1892
2415
|
}
|
|
1893
2416
|
case constants.actions.reject:
|
|
2417
|
+
case constants.actions.cancel:
|
|
1894
2418
|
case constants.actions.return:
|
|
2419
|
+
case constants.actions.signed:
|
|
1895
2420
|
case constants.actions.rejectclient:
|
|
1896
|
-
case constants.actions.accept:
|
|
2421
|
+
case constants.actions.accept:
|
|
2422
|
+
case constants.actions.payed: {
|
|
1897
2423
|
try {
|
|
1898
2424
|
const sended = await this.sendTask(taskId, action, comment);
|
|
1899
2425
|
if (!sended) return;
|
|
1900
2426
|
this.formStore.$reset();
|
|
1901
|
-
if (this.isEFO || this.isAML) {
|
|
2427
|
+
if (this.isEFO || this.isAML || this.isAULETTI) {
|
|
1902
2428
|
await this.router.push({ name: 'Insurance-Product' });
|
|
1903
2429
|
} else {
|
|
1904
2430
|
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.successOperation') + 'SUCCESS');
|
|
@@ -1910,10 +2436,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1910
2436
|
}
|
|
1911
2437
|
case constants.actions.affiliate: {
|
|
1912
2438
|
try {
|
|
1913
|
-
const sended = await this.sendUnderwritingCouncilTask({
|
|
2439
|
+
const sended = await this.sendUnderwritingCouncilTask({
|
|
2440
|
+
taskId: taskId,
|
|
2441
|
+
decision: constants.actions.accept,
|
|
2442
|
+
});
|
|
1914
2443
|
if (!sended) return;
|
|
1915
2444
|
this.formStore.$reset();
|
|
1916
|
-
if (this.isEFO || this.isAML) {
|
|
2445
|
+
if (this.isEFO || this.isAML || this.isAULETTI) {
|
|
1917
2446
|
await this.router.push({ name: 'Insurance-Product' });
|
|
1918
2447
|
} else {
|
|
1919
2448
|
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.successOperation') + 'SUCCESS');
|
|
@@ -1961,7 +2490,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1961
2490
|
console.log(err);
|
|
1962
2491
|
}
|
|
1963
2492
|
},
|
|
1964
|
-
setMembersField(whichForm: SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2493
|
+
setMembersField(whichForm: Types.SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
1965
2494
|
this.formStore[whichForm].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember].familyStatusId);
|
|
1966
2495
|
this.formStore[whichForm].signOfIPDL = this.findObject(
|
|
1967
2496
|
'ipdl',
|
|
@@ -1971,8 +2500,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1971
2500
|
if (!!this.formStore.applicationData[whichMember].profession) this.formStore[whichForm].job = this.formStore.applicationData[whichMember].profession;
|
|
1972
2501
|
if (!!this.formStore.applicationData[whichMember].position) this.formStore[whichForm].jobPosition = this.formStore.applicationData[whichMember].position;
|
|
1973
2502
|
if (!!this.formStore.applicationData[whichMember].jobName) this.formStore[whichForm].jobPlace = this.formStore.applicationData[whichMember].jobName;
|
|
1974
|
-
|
|
1975
|
-
|
|
2503
|
+
if (!!this.formStore.applicationData[whichMember].positionCode) this.formStore[whichForm].positionCode = this.formStore.applicationData[whichMember].positionCode;
|
|
2504
|
+
if (typeof this.formStore.applicationData[whichMember].isDisability === 'boolean')
|
|
2505
|
+
this.formStore[whichForm].isDisability = this.formStore.applicationData[whichMember].isDisability;
|
|
2506
|
+
if (!!this.formStore.applicationData[whichMember].disabilityGroupId) {
|
|
2507
|
+
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
|
|
2508
|
+
this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2509
|
+
}
|
|
2510
|
+
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.applicationData.pensionApp) {
|
|
2511
|
+
this.formStore[whichForm].bankInfo.iik = this.formStore.applicationData.pensionApp.account;
|
|
2512
|
+
this.formStore[whichForm].bankInfo.bik = this.formStore.applicationData.pensionApp.bankBik;
|
|
2513
|
+
const bank = this.banks.find(i => i.ids === this.formStore.applicationData.pensionApp.bankBin);
|
|
2514
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.applicationData.pensionApp.transferContractCompany);
|
|
2515
|
+
this.formStore[whichForm].bankInfo.bankName = bank ? bank : new Value();
|
|
2516
|
+
this.formStore[whichForm].bankInfo.bin = bank ? String(bank.ids) : '';
|
|
2517
|
+
this.formStore.applicationData.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2518
|
+
}
|
|
2519
|
+
},
|
|
2520
|
+
setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
1976
2521
|
if ('familyStatus' in this.formStore[whichForm][index]) {
|
|
1977
2522
|
this.formStore[whichForm][index].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember][index].familyStatusId);
|
|
1978
2523
|
}
|
|
@@ -1992,38 +2537,294 @@ export const useDataStore = defineStore('data', {
|
|
|
1992
2537
|
if ('jobPlace' in this.formStore[whichForm][index] && !!this.formStore.applicationData[whichMember][index].jobName) {
|
|
1993
2538
|
this.formStore[whichForm][index].jobPlace = this.formStore.applicationData[whichMember][index].jobName;
|
|
1994
2539
|
}
|
|
2540
|
+
if ('positionCode' in this.formStore[whichForm][index] && !!this.formStore.applicationData[whichMember][index].positionCode) {
|
|
2541
|
+
this.formStore[whichForm][index].positionCode = this.formStore.applicationData[whichMember][index].positionCode;
|
|
2542
|
+
}
|
|
2543
|
+
if (typeof this.formStore.applicationData[whichMember][index].isDisability === 'boolean') {
|
|
2544
|
+
this.formStore[whichForm][index].isDisability = this.formStore.applicationData[whichMember][index].isDisability;
|
|
2545
|
+
}
|
|
2546
|
+
if (!!this.formStore.applicationData[whichMember][index].disabilityGroupId) {
|
|
2547
|
+
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember][index].disabilityGroupId);
|
|
2548
|
+
this.formStore[whichForm][index].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2549
|
+
}
|
|
1995
2550
|
},
|
|
1996
|
-
async signDocument() {
|
|
2551
|
+
async signDocument(type: string = 'electronic') {
|
|
1997
2552
|
try {
|
|
1998
2553
|
if (this.formStore.signUrls.length) {
|
|
1999
2554
|
return this.formStore.signUrls;
|
|
2000
2555
|
}
|
|
2001
|
-
const prepareSignDocuments = (): SignDataType[] => {
|
|
2556
|
+
const prepareSignDocuments = (): Types.SignDataType[] => {
|
|
2002
2557
|
switch (this.formStore.applicationData.statusCode) {
|
|
2003
2558
|
case 'ContractSignedFrom':
|
|
2004
|
-
return [{ processInstanceId: String(this.formStore.applicationData.processInstanceId), name: 'Contract', format: 'pdf' }];
|
|
2005
|
-
default:
|
|
2006
2559
|
return [
|
|
2007
|
-
{
|
|
2008
|
-
|
|
2560
|
+
{
|
|
2561
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2562
|
+
name: 'Contract',
|
|
2563
|
+
format: 'pdf',
|
|
2564
|
+
},
|
|
2009
2565
|
];
|
|
2010
|
-
|
|
2011
|
-
|
|
2566
|
+
case 'AttachAppContractForm':
|
|
2567
|
+
if (type === 'qrXml') {
|
|
2568
|
+
return [
|
|
2569
|
+
{
|
|
2570
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2571
|
+
name: 'PAEnpf_Agreement',
|
|
2572
|
+
format: 'xml',
|
|
2573
|
+
},
|
|
2574
|
+
];
|
|
2575
|
+
} else {
|
|
2576
|
+
return [
|
|
2577
|
+
{
|
|
2578
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2579
|
+
name: this.processCode == 19 ? 'PA_Statement' : 'PA_RefundStatement',
|
|
2580
|
+
format: 'pdf',
|
|
2581
|
+
},
|
|
2582
|
+
{
|
|
2583
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2584
|
+
name: 'Agreement',
|
|
2585
|
+
format: 'pdf',
|
|
2586
|
+
},
|
|
2587
|
+
];
|
|
2588
|
+
}
|
|
2589
|
+
case 'HeadManagerForm':
|
|
2590
|
+
return [
|
|
2591
|
+
{
|
|
2592
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2593
|
+
name: 'PA_Contract',
|
|
2594
|
+
format: 'pdf',
|
|
2595
|
+
},
|
|
2596
|
+
];
|
|
2597
|
+
default:
|
|
2598
|
+
return [
|
|
2599
|
+
{
|
|
2600
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2601
|
+
name: 'Agreement',
|
|
2602
|
+
format: 'pdf',
|
|
2603
|
+
},
|
|
2604
|
+
{
|
|
2605
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2606
|
+
name: 'Statement',
|
|
2607
|
+
format: 'pdf',
|
|
2608
|
+
},
|
|
2609
|
+
];
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2012
2612
|
const data = prepareSignDocuments();
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2613
|
+
if (type === 'qr') {
|
|
2614
|
+
const groupId = await this.api.signQR(data);
|
|
2615
|
+
return groupId;
|
|
2616
|
+
} else if (type === 'qrXml') {
|
|
2617
|
+
const signData = await this.api.signXml(data);
|
|
2618
|
+
return signData;
|
|
2619
|
+
} else if (type === 'signature') {
|
|
2620
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2621
|
+
const formTemplate = new FormData();
|
|
2622
|
+
formTemplate.append('format', 'pdf');
|
|
2623
|
+
formTemplate.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2624
|
+
let activeTokens;
|
|
2625
|
+
try {
|
|
2626
|
+
await ncaLayerClient.connect();
|
|
2627
|
+
activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2628
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2629
|
+
if (this.formStore.applicationData.statusCode === 'ContractSignedFrom') {
|
|
2630
|
+
const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
|
|
2631
|
+
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2632
|
+
const formData = formTemplate;
|
|
2633
|
+
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2634
|
+
formData.append('name', 'PA_Contract');
|
|
2635
|
+
try {
|
|
2636
|
+
await this.api.uploadDigitalCertifijcate(formData);
|
|
2637
|
+
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2638
|
+
} catch (e) {
|
|
2639
|
+
this.showToaster('error', String(e));
|
|
2640
|
+
return;
|
|
2641
|
+
}
|
|
2642
|
+
} else if (this.formStore.applicationData.statusCode === 'HeadManagerForm') {
|
|
2643
|
+
const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
|
|
2644
|
+
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2645
|
+
const formData = formTemplate;
|
|
2646
|
+
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2647
|
+
formData.append('name', 'PA_Contract');
|
|
2648
|
+
try {
|
|
2649
|
+
await this.api.uploadDigitalCertificatePensionAnnuityNew(formData);
|
|
2650
|
+
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2651
|
+
} catch (e) {
|
|
2652
|
+
this.showToaster('error', String(e));
|
|
2653
|
+
return;
|
|
2654
|
+
}
|
|
2655
|
+
} else {
|
|
2656
|
+
if (!!this.formStore.signedDocumentList.find(i => i.fileTypeCode === '43')?.signed) {
|
|
2657
|
+
const statement = await this.generatePDFDocument('PA_Statement', '37', 'pdf');
|
|
2658
|
+
const statementSignature = await ncaLayerClient.basicsSignCMS(storageType, statement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2659
|
+
const statementData = formTemplate;
|
|
2660
|
+
statementData.append('base64EncodedSignature', statementSignature);
|
|
2661
|
+
statementData.append('name', 'PA_Statement');
|
|
2662
|
+
await this.api.uploadDigitalCertifijcate(statementData);
|
|
2663
|
+
const agreement = await this.generatePDFDocument('Agreement', '19', 'pdf');
|
|
2664
|
+
const agreementSignature = await ncaLayerClient.basicsSignCMS(storageType, agreement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2665
|
+
const agreementData = formTemplate;
|
|
2666
|
+
agreementData.append('base64EncodedSignature', agreementSignature);
|
|
2667
|
+
agreementData.append('name', 'Agreement');
|
|
2668
|
+
await this.api.uploadDigitalCertifijcate(agreementData);
|
|
2669
|
+
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2670
|
+
} else {
|
|
2671
|
+
const document = {
|
|
2672
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2673
|
+
name: 'PAEnpf_Agreement',
|
|
2674
|
+
format: 'xml',
|
|
2675
|
+
};
|
|
2676
|
+
const signData = await this.api.signXml([document]);
|
|
2677
|
+
const agreementXml = await this.api.getDocumentsByEdsXmlId(signData.data);
|
|
2678
|
+
const wnd = window.open('about:blank', '', '_blank');
|
|
2679
|
+
wnd?.document.write(agreementXml.data.document.documentXml);
|
|
2680
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml.data.document.documentXml, 'SIGNATURE', '');
|
|
2681
|
+
const data = new FormData();
|
|
2682
|
+
data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2683
|
+
data.append('xmlData', signedAgreement);
|
|
2684
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2685
|
+
data.append('format', 'xml');
|
|
2686
|
+
data.append('EdsXmlId', signData.data);
|
|
2687
|
+
await this.api.uploadXml(data);
|
|
2688
|
+
await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
|
|
2689
|
+
this.showToaster('success', this.t('pension.consentGiven'), 3000);
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
} catch (error) {
|
|
2693
|
+
this.showToaster('error', String(error));
|
|
2694
|
+
return;
|
|
2695
|
+
}
|
|
2696
|
+
} else {
|
|
2697
|
+
if (this.processCode === 19 || this.processCode === 2 || this.processCode === 4) {
|
|
2698
|
+
const result = await this.api.signBts(data);
|
|
2699
|
+
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2700
|
+
} else {
|
|
2701
|
+
const result = await this.api.signDocument(data);
|
|
2702
|
+
this.formStore.signUrls = result;
|
|
2703
|
+
}
|
|
2704
|
+
return this.formStore.signUrls;
|
|
2705
|
+
}
|
|
2016
2706
|
} catch (err) {
|
|
2017
2707
|
ErrorHandler(err);
|
|
2018
2708
|
}
|
|
2019
2709
|
},
|
|
2710
|
+
async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
|
|
2711
|
+
try {
|
|
2712
|
+
this.isButtonsLoading = true;
|
|
2713
|
+
const response: any = await this.api.downloadTemplate(documentType, processInstanceId);
|
|
2714
|
+
const blob = new Blob([response], {
|
|
2715
|
+
type: `application/${fileType}`,
|
|
2716
|
+
});
|
|
2717
|
+
const url = window.URL.createObjectURL(blob);
|
|
2718
|
+
const link = document.createElement('a');
|
|
2719
|
+
link.href = url;
|
|
2720
|
+
switch (documentType) {
|
|
2721
|
+
case constants.documentTypes.insuredsList:
|
|
2722
|
+
link.setAttribute('download', 'РФ-ДС-028 Список застрахованных ГССЖ_ГНС, изд.1.xls');
|
|
2723
|
+
break;
|
|
2724
|
+
case constants.documentTypes.statement:
|
|
2725
|
+
link.setAttribute('download', 'Заявление.pdf');
|
|
2726
|
+
break;
|
|
2727
|
+
case constants.documentTypes.contract:
|
|
2728
|
+
link.setAttribute('download', 'Договор страхования.pdf');
|
|
2729
|
+
break;
|
|
2730
|
+
case constants.documentTypes.application1:
|
|
2731
|
+
link.setAttribute('download', 'Приложение №1.pdf');
|
|
2732
|
+
break;
|
|
2733
|
+
case constants.documentTypes.questionnaireInsured:
|
|
2734
|
+
link.setAttribute('download', 'Анкета Застрахованного.docx');
|
|
2735
|
+
break;
|
|
2736
|
+
case constants.documentTypes.invoicePayment:
|
|
2737
|
+
link.setAttribute('download', 'Счет на оплату');
|
|
2738
|
+
break;
|
|
2739
|
+
}
|
|
2740
|
+
document.body.appendChild(link);
|
|
2741
|
+
link.click();
|
|
2742
|
+
} catch (err) {
|
|
2743
|
+
ErrorHandler(err);
|
|
2744
|
+
}
|
|
2745
|
+
this.isButtonsLoading = false;
|
|
2746
|
+
},
|
|
2747
|
+
async sendTemplateToEmail(email: string) {
|
|
2748
|
+
try {
|
|
2749
|
+
this.isButtonsLoading = true;
|
|
2750
|
+
await this.api.sendTemplateToEmail(email);
|
|
2751
|
+
this.showToaster('info', this.t('toaster.successfullyDocSent'), 5000);
|
|
2752
|
+
} catch (err) {
|
|
2753
|
+
ErrorHandler(err);
|
|
2754
|
+
}
|
|
2755
|
+
this.isButtonsLoading = false;
|
|
2756
|
+
},
|
|
2757
|
+
async sendInvoiceToEmail(processInstanceId: string | number, email: string) {
|
|
2758
|
+
try {
|
|
2759
|
+
this.isButtonsLoading = true;
|
|
2760
|
+
await this.api.sendInvoiceToEmail(processInstanceId, email);
|
|
2761
|
+
this.showToaster('info', this.t('toaster.successfullyDocSent'), 5000);
|
|
2762
|
+
} catch (err) {
|
|
2763
|
+
ErrorHandler(err);
|
|
2764
|
+
}
|
|
2765
|
+
this.isButtonsLoading = false;
|
|
2766
|
+
},
|
|
2767
|
+
async generateDocument() {
|
|
2768
|
+
try {
|
|
2769
|
+
this.isButtonsLoading = true;
|
|
2770
|
+
this.formStore.needToScanSignedContract = true;
|
|
2771
|
+
const data: Types.SignDataType = {
|
|
2772
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2773
|
+
name: 'Contract',
|
|
2774
|
+
format: 'pdf',
|
|
2775
|
+
};
|
|
2776
|
+
const response: any = await this.api.generateDocument(data);
|
|
2777
|
+
const blob = new Blob([response], {
|
|
2778
|
+
type: `application/pdf`,
|
|
2779
|
+
});
|
|
2780
|
+
this.showToaster('info', this.t('toaster.needToSignContract'), 100000);
|
|
2781
|
+
const url = window.URL.createObjectURL(blob);
|
|
2782
|
+
const link = document.createElement('a');
|
|
2783
|
+
link.href = url;
|
|
2784
|
+
link.setAttribute('download', this.formStore.regNumber + ' Договор страхования');
|
|
2785
|
+
document.body.appendChild(link);
|
|
2786
|
+
link.click();
|
|
2787
|
+
} catch (err) {
|
|
2788
|
+
ErrorHandler(err);
|
|
2789
|
+
}
|
|
2790
|
+
this.isButtonsLoading = false;
|
|
2791
|
+
},
|
|
2792
|
+
async generatePDFDocument(name: string, code: string, format: 'pdf' | 'doc' = 'pdf', open: boolean = false) {
|
|
2793
|
+
try {
|
|
2794
|
+
this.isButtonsLoading = true;
|
|
2795
|
+
this.formStore.needToScanSignedContract = true;
|
|
2796
|
+
const data: any = {
|
|
2797
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2798
|
+
name: name,
|
|
2799
|
+
format: format,
|
|
2800
|
+
};
|
|
2801
|
+
const response: any = await this.api.generatePdfDocument(data);
|
|
2802
|
+
const blob = new Blob([response], {
|
|
2803
|
+
type: format === 'pdf' ? `application/pdf` : `application/vnd.openxmlformats-officedocument.wordprocessingml.document`,
|
|
2804
|
+
});
|
|
2805
|
+
const url = window.URL.createObjectURL(blob);
|
|
2806
|
+
const link = document.createElement('a');
|
|
2807
|
+
link.href = url;
|
|
2808
|
+
link.setAttribute('download', this.formStore.regNumber + ` ${this.dicFileTypeList.find((i: Value) => i.code == code)?.nameRu}`);
|
|
2809
|
+
document.body.appendChild(link);
|
|
2810
|
+
link.click();
|
|
2811
|
+
if (open) {
|
|
2812
|
+
window.open(url, '_blank', `right=100`);
|
|
2813
|
+
}
|
|
2814
|
+
return response;
|
|
2815
|
+
} catch (err) {
|
|
2816
|
+
ErrorHandler(err);
|
|
2817
|
+
} finally {
|
|
2818
|
+
this.isButtonsLoading = false;
|
|
2819
|
+
}
|
|
2820
|
+
},
|
|
2020
2821
|
async registerNumber() {
|
|
2021
2822
|
try {
|
|
2022
2823
|
if (!this.formStore.finCenterData.date) return;
|
|
2023
2824
|
const formattedData = formatDate(this.formStore.finCenterData.date);
|
|
2024
2825
|
if (!formattedData) return;
|
|
2025
2826
|
this.isLoading = true;
|
|
2026
|
-
const data: RegNumberDataType = {
|
|
2827
|
+
const data: Types.RegNumberDataType = {
|
|
2027
2828
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2028
2829
|
regNumber: String(this.formStore.finCenterData.regNumber),
|
|
2029
2830
|
date: formattedData.toISOString(),
|
|
@@ -2038,7 +2839,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2038
2839
|
},
|
|
2039
2840
|
async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
|
|
2040
2841
|
if (!type || !phoneNumber || !text) return;
|
|
2041
|
-
const smsData: SmsDataType = {
|
|
2842
|
+
const smsData: Types.SmsDataType = {
|
|
2042
2843
|
iin: this.formStore.applicationData.clientApp.iin,
|
|
2043
2844
|
phoneNumber: formatPhone(phoneNumber),
|
|
2044
2845
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
@@ -2076,6 +2877,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2076
2877
|
Object.keys(this.formStore.isDisabled).forEach(key => {
|
|
2077
2878
|
this.formStore.isDisabled[key as keyof typeof this.formStore.isDisabled] = !!isDisabled;
|
|
2078
2879
|
});
|
|
2880
|
+
this.showDisabledMessage = !!isDisabled;
|
|
2079
2881
|
},
|
|
2080
2882
|
async reCalculate(processInstanceId: string | number, recalculationData: any, taskId: string, whichSum: string) {
|
|
2081
2883
|
this.isLoading = true;
|
|
@@ -2087,6 +2889,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2087
2889
|
const recalculatedValue = await this.api.reCalculate(data);
|
|
2088
2890
|
if (!!recalculatedValue) {
|
|
2089
2891
|
await this.getApplicationData(taskId, false, false, false, true);
|
|
2892
|
+
if (this.isGons) {
|
|
2893
|
+
this.formStore.productConditionsForm.isRecalculated = true;
|
|
2894
|
+
}
|
|
2090
2895
|
this.showToaster(
|
|
2091
2896
|
'success',
|
|
2092
2897
|
`${this.t('toaster.successRecalculation')}. ${whichSum == 'insurancePremiumPerMonth' ? 'Страховая премия' : 'Страховая сумма'}: ${this.getNumberWithSpaces(
|
|
@@ -2100,7 +2905,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2100
2905
|
}
|
|
2101
2906
|
this.isLoading = false;
|
|
2102
2907
|
},
|
|
2103
|
-
async getValidateClientESBD(data: ESBDValidationType) {
|
|
2908
|
+
async getValidateClientESBD(data: Types.ESBDValidationType) {
|
|
2104
2909
|
try {
|
|
2105
2910
|
return await this.api.getValidateClientESBD(data);
|
|
2106
2911
|
} catch (err) {
|
|
@@ -2108,7 +2913,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2108
2913
|
return ErrorHandler(err);
|
|
2109
2914
|
}
|
|
2110
2915
|
},
|
|
2111
|
-
validateMultipleMembers(localKey: MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2916
|
+
validateMultipleMembers(localKey: Types.MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2112
2917
|
if (this.formStore[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
2113
2918
|
if (this.formStore[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
2114
2919
|
const localMembers = [...this.formStore[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
@@ -2128,7 +2933,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2128
2933
|
}
|
|
2129
2934
|
}
|
|
2130
2935
|
} else {
|
|
2131
|
-
if (this.formStore[localKey].some(
|
|
2936
|
+
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2132
2937
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
2133
2938
|
return false;
|
|
2134
2939
|
}
|
|
@@ -2215,6 +3020,11 @@ export const useDataStore = defineStore('data', {
|
|
|
2215
3020
|
if (this.controls.hasAttachment) {
|
|
2216
3021
|
const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
|
|
2217
3022
|
if (areValid) {
|
|
3023
|
+
if (this.isLifetrip && this.formStore.AgentData.fullName === 'Без агента') {
|
|
3024
|
+
this.isLoading = false;
|
|
3025
|
+
this.showToaster('error', this.t('toaster.attachAgentError'), 3000);
|
|
3026
|
+
return false;
|
|
3027
|
+
}
|
|
2218
3028
|
if (this.isInitiator()) {
|
|
2219
3029
|
await this.setINSISWorkData();
|
|
2220
3030
|
}
|
|
@@ -2226,8 +3036,8 @@ export const useDataStore = defineStore('data', {
|
|
|
2226
3036
|
}
|
|
2227
3037
|
if (localCheck === false) {
|
|
2228
3038
|
try {
|
|
2229
|
-
if (this.isInitiator() &&
|
|
2230
|
-
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
3039
|
+
if (this.isInitiator() && this.members.beneficialOwnerApp.has) {
|
|
3040
|
+
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2231
3041
|
await Promise.allSettled(
|
|
2232
3042
|
this.formStore.applicationData.beneficialOwnerApp.map(async (member: any) => {
|
|
2233
3043
|
await this.api.deleteMember('BeneficialOwner', member.id);
|
|
@@ -2247,124 +3057,127 @@ export const useDataStore = defineStore('data', {
|
|
|
2247
3057
|
if (!anketa) return false;
|
|
2248
3058
|
const list = anketa.body;
|
|
2249
3059
|
if (!list || (list && list.length === 0)) return false;
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
if (
|
|
2253
|
-
|
|
3060
|
+
const isAnketaValid = ref<boolean>(true);
|
|
3061
|
+
list.forEach(i => {
|
|
3062
|
+
if (
|
|
3063
|
+
(i.first.definedAnswers === 'N' && !i.first.answerText) ||
|
|
3064
|
+
(i.first.definedAnswers === 'Y' && !i.first.answerName) ||
|
|
3065
|
+
(i.first.definedAnswers === 'D' && !i.first.answerName?.match(new RegExp('Нет', 'i')) && !i.first.answerText)
|
|
3066
|
+
) {
|
|
3067
|
+
isAnketaValid.value = false;
|
|
3068
|
+
return false;
|
|
2254
3069
|
}
|
|
2255
|
-
|
|
2256
|
-
|
|
3070
|
+
if (this.controls.isSecondAnketaRequired && i.first.definedAnswers === 'Y' && i.first.answerName?.match(new RegExp('Да', 'i'))) {
|
|
3071
|
+
if (i.second && i.second.length) {
|
|
3072
|
+
const isValid = i.second.every(second => (second.definedAnswers === 'N' ? !!second.answerText : !!second.answerName));
|
|
3073
|
+
if (!isValid) {
|
|
3074
|
+
isAnketaValid.value = false;
|
|
3075
|
+
this.showToaster('info', this.t('toaster.emptySecondAnketa', { text: i.first.name }), 5000);
|
|
3076
|
+
return false;
|
|
3077
|
+
}
|
|
3078
|
+
} else {
|
|
3079
|
+
// TODO уточнить
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3082
|
+
});
|
|
3083
|
+
return isAnketaValid.value;
|
|
2257
3084
|
},
|
|
2258
3085
|
async validateAllForms(taskId: string) {
|
|
2259
3086
|
this.isLoading = true;
|
|
2260
3087
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
2261
3088
|
if (areMembersValid) {
|
|
2262
|
-
if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) {
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
this.formStore.applicationData.processInstanceId,
|
|
2269
|
-
this.
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2294
|
-
}),
|
|
2295
|
-
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2296
|
-
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2297
|
-
}),
|
|
2298
|
-
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2299
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2300
|
-
}),
|
|
2301
|
-
])
|
|
2302
|
-
: await Promise.allSettled([
|
|
2303
|
-
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2304
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2305
|
-
}),
|
|
2306
|
-
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2307
|
-
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2308
|
-
}),
|
|
2309
|
-
]);
|
|
2310
|
-
} else {
|
|
2311
|
-
await Promise.allSettled([
|
|
2312
|
-
this.getQuestionList(
|
|
2313
|
-
'health',
|
|
2314
|
-
this.formStore.applicationData.processInstanceId,
|
|
2315
|
-
this.formStore.applicationData.insuredApp[0].id,
|
|
2316
|
-
'surveyByHealthBase',
|
|
2317
|
-
'surveyByHealthSecond',
|
|
2318
|
-
),
|
|
2319
|
-
this.isClientAnketaCondition &&
|
|
2320
|
-
this.getQuestionList(
|
|
2321
|
-
'health',
|
|
2322
|
-
this.formStore.applicationData.processInstanceId,
|
|
2323
|
-
this.formStore.applicationData.clientApp.id,
|
|
2324
|
-
'surveyByHealthBasePolicyholder',
|
|
2325
|
-
'surveyByHealthSecond',
|
|
2326
|
-
'policyholder',
|
|
2327
|
-
),
|
|
2328
|
-
,
|
|
2329
|
-
]);
|
|
2330
|
-
this.isClientAnketaCondition
|
|
2331
|
-
? await Promise.allSettled([
|
|
2332
|
-
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2333
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2334
|
-
}),
|
|
2335
|
-
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2336
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2337
|
-
}),
|
|
2338
|
-
])
|
|
2339
|
-
: await Promise.allSettled(
|
|
2340
|
-
this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2341
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2342
|
-
}),
|
|
2343
|
-
);
|
|
2344
|
-
}
|
|
2345
|
-
if (this.validateAnketa('surveyByHealthBase')) {
|
|
2346
|
-
let hasCriticalAndItsValid = null;
|
|
2347
|
-
if (hasCritical && hasCritical.coverSumName !== 'не включено') {
|
|
2348
|
-
if (this.validateAnketa('surveyByCriticalBase')) {
|
|
2349
|
-
hasCriticalAndItsValid = true;
|
|
2350
|
-
} else {
|
|
2351
|
-
hasCriticalAndItsValid = false;
|
|
2352
|
-
this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
|
|
2353
|
-
}
|
|
3089
|
+
if ((!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) || this.isPension) {
|
|
3090
|
+
if (this.controls.hasAnketa) {
|
|
3091
|
+
const hasCritical =
|
|
3092
|
+
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
3093
|
+
if (hasCritical === null || (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')))) {
|
|
3094
|
+
await Promise.allSettled([
|
|
3095
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
3096
|
+
this.isClientAnketaCondition &&
|
|
3097
|
+
this.getQuestionList(
|
|
3098
|
+
'health',
|
|
3099
|
+
this.formStore.applicationData.processInstanceId,
|
|
3100
|
+
this.formStore.applicationData.clientApp.id,
|
|
3101
|
+
'surveyByHealthBasePolicyholder',
|
|
3102
|
+
'policyholder',
|
|
3103
|
+
),
|
|
3104
|
+
,
|
|
3105
|
+
]);
|
|
3106
|
+
this.isClientAnketaCondition
|
|
3107
|
+
? await Promise.allSettled([
|
|
3108
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
3109
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
3110
|
+
}),
|
|
3111
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
3112
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
3113
|
+
}),
|
|
3114
|
+
])
|
|
3115
|
+
: await Promise.allSettled(
|
|
3116
|
+
this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
3117
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
3118
|
+
}),
|
|
3119
|
+
);
|
|
2354
3120
|
} else {
|
|
2355
|
-
|
|
3121
|
+
await Promise.allSettled([
|
|
3122
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
3123
|
+
this.getQuestionList('critical', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByCriticalBase'),
|
|
3124
|
+
this.isClientAnketaCondition &&
|
|
3125
|
+
this.getQuestionList(
|
|
3126
|
+
'health',
|
|
3127
|
+
this.formStore.applicationData.processInstanceId,
|
|
3128
|
+
this.formStore.applicationData.clientApp.id,
|
|
3129
|
+
'surveyByHealthBasePolicyholder',
|
|
3130
|
+
'policyholder',
|
|
3131
|
+
),
|
|
3132
|
+
]);
|
|
3133
|
+
this.isClientAnketaCondition
|
|
3134
|
+
? await Promise.allSettled([
|
|
3135
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
3136
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
3137
|
+
}),
|
|
3138
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
3139
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
3140
|
+
}),
|
|
3141
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
3142
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
3143
|
+
}),
|
|
3144
|
+
])
|
|
3145
|
+
: await Promise.allSettled([
|
|
3146
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
3147
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
3148
|
+
}),
|
|
3149
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
3150
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
3151
|
+
}),
|
|
3152
|
+
]);
|
|
2356
3153
|
}
|
|
2357
|
-
if (
|
|
2358
|
-
|
|
2359
|
-
|
|
3154
|
+
if (this.validateAnketa('surveyByHealthBase')) {
|
|
3155
|
+
let hasCriticalAndItsValid = null;
|
|
3156
|
+
if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')) === null) {
|
|
3157
|
+
if (this.validateAnketa('surveyByCriticalBase')) {
|
|
3158
|
+
hasCriticalAndItsValid = true;
|
|
3159
|
+
} else {
|
|
3160
|
+
hasCriticalAndItsValid = false;
|
|
3161
|
+
this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
|
|
3162
|
+
}
|
|
3163
|
+
} else {
|
|
3164
|
+
hasCriticalAndItsValid = null;
|
|
3165
|
+
}
|
|
3166
|
+
if (hasCriticalAndItsValid === true || hasCriticalAndItsValid === null) {
|
|
3167
|
+
if (this.isClientAnketaCondition && this.validateAnketa('surveyByHealthBasePolicyholder') === false) {
|
|
3168
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketaPolicyholder'), 3000);
|
|
3169
|
+
this.isLoading = false;
|
|
3170
|
+
return false;
|
|
3171
|
+
}
|
|
2360
3172
|
this.isLoading = false;
|
|
2361
|
-
return
|
|
3173
|
+
return true;
|
|
2362
3174
|
}
|
|
2363
|
-
|
|
2364
|
-
|
|
3175
|
+
} else {
|
|
3176
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketa'), 3000);
|
|
2365
3177
|
}
|
|
2366
3178
|
} else {
|
|
2367
|
-
this.
|
|
3179
|
+
this.isLoading = false;
|
|
3180
|
+
return true;
|
|
2368
3181
|
}
|
|
2369
3182
|
} else {
|
|
2370
3183
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
@@ -2377,7 +3190,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2377
3190
|
async getFamilyInfo(iin: string, phoneNumber: string) {
|
|
2378
3191
|
this.isLoading = true;
|
|
2379
3192
|
try {
|
|
2380
|
-
const familyResponse = await this.api.getFamilyInfo({
|
|
3193
|
+
const familyResponse = await this.api.getFamilyInfo({
|
|
3194
|
+
iin: iin.replace(/-/g, ''),
|
|
3195
|
+
phoneNumber: formatPhone(phoneNumber),
|
|
3196
|
+
});
|
|
2381
3197
|
if (familyResponse.status === 'soap:Server') {
|
|
2382
3198
|
this.showToaster('error', `${familyResponse.statusName}. Отправьте запрос через некоторое время`, 5000);
|
|
2383
3199
|
this.isLoading = false;
|
|
@@ -2422,6 +3238,32 @@ export const useDataStore = defineStore('data', {
|
|
|
2422
3238
|
this.isLoading = false;
|
|
2423
3239
|
}
|
|
2424
3240
|
},
|
|
3241
|
+
async getKgd(iin: string) {
|
|
3242
|
+
try {
|
|
3243
|
+
const data = {
|
|
3244
|
+
iinBin: iin.replace(/-/g, ''),
|
|
3245
|
+
};
|
|
3246
|
+
const kgdResponse = await this.api.getKgd(data);
|
|
3247
|
+
return kgdResponse;
|
|
3248
|
+
} catch (err) {
|
|
3249
|
+
return ErrorHandler(err);
|
|
3250
|
+
}
|
|
3251
|
+
},
|
|
3252
|
+
async getGbdUl(bin: string) {
|
|
3253
|
+
if (!this.accessToken) return null;
|
|
3254
|
+
try {
|
|
3255
|
+
const decoded = jwtDecode(this.accessToken);
|
|
3256
|
+
const data = {
|
|
3257
|
+
userName: decoded.code,
|
|
3258
|
+
branchName: decoded.branchCode,
|
|
3259
|
+
bin: bin.replace(/-/g, ''),
|
|
3260
|
+
};
|
|
3261
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3262
|
+
return gbdulResponse;
|
|
3263
|
+
} catch (err) {
|
|
3264
|
+
return ErrorHandler(err);
|
|
3265
|
+
}
|
|
3266
|
+
},
|
|
2425
3267
|
async getContragentFromGBDFL(member: Member) {
|
|
2426
3268
|
// null - ожидание
|
|
2427
3269
|
// false - ошибка или неправильно
|
|
@@ -2453,13 +3295,27 @@ export const useDataStore = defineStore('data', {
|
|
|
2453
3295
|
this.isLoading = false;
|
|
2454
3296
|
return false;
|
|
2455
3297
|
}
|
|
2456
|
-
|
|
3298
|
+
if (!gbdResponse.content) {
|
|
3299
|
+
let errMsg: string = '';
|
|
3300
|
+
if (gbdResponse.status) {
|
|
3301
|
+
errMsg += gbdResponse.status;
|
|
3302
|
+
}
|
|
3303
|
+
if (gbdResponse.statusName) {
|
|
3304
|
+
errMsg += gbdResponse.statusName;
|
|
3305
|
+
}
|
|
3306
|
+
if (!!errMsg) {
|
|
3307
|
+
this.showToaster('error', errMsg, 5000);
|
|
3308
|
+
}
|
|
3309
|
+
this.isLoading = false;
|
|
3310
|
+
return false;
|
|
3311
|
+
}
|
|
3312
|
+
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Types.Api.GBD.Person };
|
|
2457
3313
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
2458
3314
|
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
2459
3315
|
member.resetMember(false);
|
|
2460
3316
|
}
|
|
2461
3317
|
member.gosPersonData = person;
|
|
2462
|
-
await this.getContragent(member, false);
|
|
3318
|
+
await this.getContragent(member, false, false);
|
|
2463
3319
|
member.verifyDate = responseInfo.responseDate;
|
|
2464
3320
|
member.verifyType = 'GBDFL';
|
|
2465
3321
|
await this.saveInStoreUserGBDFL(person, member);
|
|
@@ -2470,15 +3326,19 @@ export const useDataStore = defineStore('data', {
|
|
|
2470
3326
|
this.isLoading = false;
|
|
2471
3327
|
}
|
|
2472
3328
|
},
|
|
2473
|
-
async saveInStoreUserGBDFL(person:
|
|
3329
|
+
async saveInStoreUserGBDFL(person: Types.Api.GBD.Person, member: Member) {
|
|
2474
3330
|
member.firstName = person.name;
|
|
2475
3331
|
member.lastName = person.surname;
|
|
2476
3332
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
3333
|
+
if (this.isLifetrip) {
|
|
3334
|
+
member.firstNameLat = person.engFirstName ? person.engFirstName : '';
|
|
3335
|
+
member.lastNameLat = person.engSurname ? person.engSurname : '';
|
|
3336
|
+
}
|
|
2477
3337
|
member.longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
|
|
2478
3338
|
member.birthDate = reformatDate(person.birthDate);
|
|
2479
3339
|
member.genderName = person.gender.nameRu;
|
|
2480
3340
|
|
|
2481
|
-
const gender = this.gender.find(i => i.id == person.gender.code);
|
|
3341
|
+
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
2482
3342
|
if (gender) member.gender = gender;
|
|
2483
3343
|
|
|
2484
3344
|
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
@@ -2557,45 +3417,422 @@ export const useDataStore = defineStore('data', {
|
|
|
2557
3417
|
if (person.regAddress.building) member.registrationNumberHouse = person.regAddress.building;
|
|
2558
3418
|
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
2559
3419
|
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
3420
|
+
if (Array.isArray(person.documents.document)) {
|
|
3421
|
+
const validDocument = person.documents.document.find(
|
|
3422
|
+
i =>
|
|
3423
|
+
new Date(i.endDate) > new Date(Date.now()) &&
|
|
3424
|
+
i.status.code === '00' &&
|
|
3425
|
+
(i.type.code === Enums.GBD.DocTypes['1UDL'] || i.type.code === Enums.GBD.DocTypes.VNZ || i.type.code === Enums.GBD.DocTypes.PS),
|
|
3426
|
+
);
|
|
2563
3427
|
if (validDocument) {
|
|
2564
|
-
const documentType = this.documentTypes.find(i => i.ids ===
|
|
3428
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === Object.keys(Enums.GBD.DocTypes)[Object.values(Enums.GBD.DocTypes).indexOf(validDocument.type.code)]);
|
|
2565
3429
|
if (documentType) member.documentType = documentType;
|
|
2566
|
-
|
|
2567
|
-
member.
|
|
2568
|
-
member.documentExpire = reformatDate(validDocument.endDate);
|
|
2569
|
-
member.documentDate = reformatDate(validDocument.beginDate);
|
|
2570
|
-
member.documentNumber = validDocument.number;
|
|
2571
|
-
|
|
3430
|
+
if (validDocument.number) member.documentNumber = validDocument.number;
|
|
3431
|
+
if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
|
|
3432
|
+
if (validDocument.endDate) member.documentExpire = reformatDate(validDocument.endDate);
|
|
2572
3433
|
const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
|
|
2573
3434
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2574
3435
|
}
|
|
2575
3436
|
} else {
|
|
2576
|
-
const
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
3437
|
+
const personDoc = person.documents.document;
|
|
3438
|
+
if (
|
|
3439
|
+
personDoc.status.code === '00' &&
|
|
3440
|
+
new Date(personDoc.endDate) > new Date(Date.now()) &&
|
|
3441
|
+
(personDoc.type.code === Enums.GBD.DocTypes['1UDL'] || personDoc.type.code === Enums.GBD.DocTypes.VNZ || personDoc.type.code === Enums.GBD.DocTypes.PS)
|
|
3442
|
+
) {
|
|
3443
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === Object.keys(Enums.GBD.DocTypes)[Object.values(Enums.GBD.DocTypes).indexOf(personDoc.type.code)]);
|
|
3444
|
+
if (documentType) member.documentType = documentType;
|
|
3445
|
+
const documentNumber = personDoc.number;
|
|
3446
|
+
if (documentNumber) member.documentNumber = documentNumber;
|
|
3447
|
+
const documentDate = personDoc.beginDate;
|
|
3448
|
+
if (documentDate) member.documentDate = reformatDate(documentDate);
|
|
3449
|
+
const documentExpire = personDoc.endDate;
|
|
3450
|
+
if (documentExpire) member.documentExpire = reformatDate(documentExpire);
|
|
3451
|
+
const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
|
|
3452
|
+
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
const economySectorCode = this.economySectorCode.find((i: Value) => i.ids === '500003.9');
|
|
3456
|
+
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
3457
|
+
},
|
|
3458
|
+
preparePersonData(data: any) {
|
|
3459
|
+
if (data) {
|
|
3460
|
+
Object.keys(data).forEach(key => {
|
|
3461
|
+
if (data[key] === Object(data[key]) && !!data[key]) {
|
|
3462
|
+
this.preparePersonData(data[key]);
|
|
3463
|
+
} else {
|
|
3464
|
+
if (data[key] !== null) {
|
|
3465
|
+
if (key === 'iin' || key === 'bin') data[key] = data[key].replace(/-/g, '');
|
|
3466
|
+
if (key === 'phoneNumber') data[key] = formatPhone(data[key]);
|
|
3467
|
+
if (key === 'issuedOn' || key === 'validUntil' || key === 'birthDate' || key === 'date') data[key] = formatDate(data[key])?.toISOString() ?? '';
|
|
3468
|
+
if (key === 'nameRu' && data['ids']) data['id'] = data['ids'];
|
|
3469
|
+
if (key === 'positionRu') data['positionKz'] = data['positionRu'];
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
});
|
|
3473
|
+
}
|
|
3474
|
+
},
|
|
3475
|
+
async startApplicationV2(data: PolicyholderClass) {
|
|
3476
|
+
const policyholder = JSON.parse(JSON.stringify(data)) as any;
|
|
3477
|
+
this.preparePersonData(policyholder);
|
|
3478
|
+
keyDeleter(policyholder as PolicyholderClass, [
|
|
3479
|
+
'clientData.beneficalOwnerQuest',
|
|
3480
|
+
'clientData.identityDocument',
|
|
3481
|
+
'clientData.activityTypes',
|
|
3482
|
+
'clientData.citizenship',
|
|
3483
|
+
'clientData.addTaxResidency',
|
|
3484
|
+
'clientData.gender',
|
|
3485
|
+
'clientData.placeOfBirth',
|
|
3486
|
+
'clientData.authoritedPerson.actualAddress',
|
|
3487
|
+
'clientData.authoritedPerson.bankInfo',
|
|
3488
|
+
'clientData.authoritedPerson.economySectorCode',
|
|
3489
|
+
'clientData.authoritedPerson.legalAddress',
|
|
3490
|
+
'clientData.authoritedPerson.placeOfBirth',
|
|
3491
|
+
'clientData.authoritedPerson.resident',
|
|
3492
|
+
'clientData.authoritedPerson.taxResidentCountry',
|
|
3493
|
+
'clientData.authoritedPerson.addTaxResidency',
|
|
3494
|
+
]);
|
|
3495
|
+
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3496
|
+
try {
|
|
3497
|
+
const response = await this.api.startApplication(policyholder);
|
|
3498
|
+
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
3499
|
+
return response.processInstanceId;
|
|
3500
|
+
} catch (err) {
|
|
3501
|
+
return ErrorHandler(err);
|
|
3502
|
+
}
|
|
3503
|
+
},
|
|
3504
|
+
async saveClient(data: PolicyholderClass) {
|
|
3505
|
+
const policyholder = JSON.parse(JSON.stringify(data)) as any;
|
|
3506
|
+
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3507
|
+
this.preparePersonData(policyholder);
|
|
3508
|
+
try {
|
|
3509
|
+
await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, policyholder);
|
|
3510
|
+
} catch (err) {
|
|
3511
|
+
return ErrorHandler(err);
|
|
3512
|
+
}
|
|
3513
|
+
},
|
|
3514
|
+
async getApplicationDataV2(taskId: string) {
|
|
3515
|
+
this.isLoading = true;
|
|
3516
|
+
try {
|
|
3517
|
+
const applicationData = await this.api.getApplicationData(taskId);
|
|
3518
|
+
if (this.processCode !== applicationData.processCode) {
|
|
3519
|
+
this.isLoading = false;
|
|
3520
|
+
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
|
|
3521
|
+
return;
|
|
3522
|
+
}
|
|
2583
3523
|
|
|
2584
|
-
|
|
2585
|
-
|
|
3524
|
+
this.formStore.applicationData = applicationData;
|
|
3525
|
+
this.formStore.regNumber = applicationData.regNumber;
|
|
3526
|
+
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
2586
3527
|
|
|
2587
|
-
|
|
2588
|
-
|
|
3528
|
+
this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
|
|
3529
|
+
this.formStore.applicationTaskId = taskId;
|
|
3530
|
+
this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
|
|
3531
|
+
this.formStore.RegionPolicy.ids = applicationData.insisWorkDataApp.regionPolicy;
|
|
3532
|
+
this.formStore.ManagerPolicy.nameRu = applicationData.insisWorkDataApp.managerPolicyName;
|
|
3533
|
+
this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
|
|
3534
|
+
this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
|
|
3535
|
+
this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
|
|
3536
|
+
|
|
3537
|
+
this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
|
|
3538
|
+
this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
|
|
3539
|
+
|
|
3540
|
+
const { clientData } = applicationData.clientApp;
|
|
3541
|
+
const beneficialOwnerApp = applicationData.beneficialOwnerApp;
|
|
3542
|
+
const insuredApp = applicationData.insuredApp;
|
|
3543
|
+
const accidentIncidents = applicationData.accidentIncidentDtos;
|
|
3544
|
+
const clientId = applicationData.clientApp.id;
|
|
2589
3545
|
|
|
2590
|
-
|
|
2591
|
-
|
|
3546
|
+
this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
|
|
3547
|
+
this.formStore.lfb.policyholder.isIpdl = applicationData.clientApp.isIpdl;
|
|
3548
|
+
this.formStore.lfb.policyholder.clientData = clientData;
|
|
3549
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
|
|
3550
|
+
this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
|
|
3551
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
|
|
3552
|
+
this.formStore.lfb.clientId = clientId;
|
|
3553
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.authorityDetails.date = reformatDate(clientData.authoritedPerson.authorityDetails.date);
|
|
3554
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
|
|
3555
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
|
|
3556
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
|
|
3557
|
+
const gender = this.gender.find((i: Value) => i.id === clientData.authoritedPerson.gender);
|
|
3558
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.gender = gender ? gender : new Value();
|
|
3559
|
+
|
|
3560
|
+
if (clientData && clientData.activityTypes !== null) {
|
|
3561
|
+
this.formStore.lfb.policyholderActivities = clientData.activityTypes;
|
|
3562
|
+
}
|
|
2592
3563
|
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
3564
|
+
if (beneficialOwnerApp && beneficialOwnerApp.length) {
|
|
3565
|
+
this.formStore.lfb.beneficialOwners = beneficialOwnerApp;
|
|
3566
|
+
this.formStore.lfb.isPolicyholderBeneficialOwner = clientData.authoritedPerson.iin.replace(/-/g, '') === beneficialOwnerApp[0].beneficialOwnerData.iin ? true : false;
|
|
3567
|
+
this.formStore.lfb.beneficialOwners.forEach(beneficial => {
|
|
3568
|
+
beneficial.beneficialOwnerData.birthDate = reformatDate(beneficial.beneficialOwnerData.birthDate as string) ?? '';
|
|
3569
|
+
beneficial.beneficialOwnerData.identityDocument.validUntil = reformatDate(beneficial.beneficialOwnerData.identityDocument.validUntil as string) ?? '';
|
|
3570
|
+
beneficial.beneficialOwnerData.iin = reformatIin(beneficial.beneficialOwnerData.iin as string);
|
|
3571
|
+
beneficial.beneficialOwnerData.identityDocument.issuedOn = reformatDate(beneficial.beneficialOwnerData.identityDocument.issuedOn as string) ?? '';
|
|
3572
|
+
//@ts-ignore
|
|
3573
|
+
const gender = this.gender.find((i: Value) => i.id === beneficial.beneficialOwnerData.gender);
|
|
3574
|
+
beneficial.beneficialOwnerData.gender = gender ? gender : new Value();
|
|
3575
|
+
});
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
if (insuredApp && insuredApp.length) {
|
|
3579
|
+
const res = await this.newInsuredList(insuredApp);
|
|
3580
|
+
this.formStore.lfb.clients = res;
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3583
|
+
if (accidentIncidents && accidentIncidents.length) {
|
|
3584
|
+
this.formStore.lfb.accidentIncidents = accidentIncidents;
|
|
3585
|
+
this.formStore.lfb.accidentIncidents.forEach(incident => {
|
|
3586
|
+
incident.amount = incident.amount === 0 ? '' : incident.amount;
|
|
3587
|
+
incident.count = incident.count === 0 ? '' : incident.count;
|
|
3588
|
+
});
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3591
|
+
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.policyAppDto.calcDate);
|
|
3592
|
+
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.policyAppDto.contractEndDate);
|
|
3593
|
+
this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission === 0 ? null : applicationData.policyAppDto.agentCommission;
|
|
3594
|
+
this.formStore.productConditionsForm.fixInsSum = this.getNumberWithSpaces(applicationData.policyAppDto.fixInsSum === 0 ? null : applicationData.policyAppDto.fixInsSum);
|
|
3595
|
+
this.formStore.productConditionsForm.coverPeriod = 12;
|
|
3596
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount === 0 ? null : applicationData.policyAppDto.amount);
|
|
3597
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
|
|
3598
|
+
applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : applicationData.policyAppDto.mainPremiumWithCommission,
|
|
3599
|
+
);
|
|
3600
|
+
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
3601
|
+
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
3602
|
+
const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
|
|
3603
|
+
this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
|
|
3604
|
+
} catch (err) {
|
|
3605
|
+
ErrorHandler(err);
|
|
3606
|
+
if (err instanceof AxiosError) {
|
|
3607
|
+
this.sendToParent(constants.postActions.toHomePage, err.response?.data);
|
|
3608
|
+
this.isLoading = false;
|
|
3609
|
+
return false;
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
this.isLoading = false;
|
|
3613
|
+
},
|
|
3614
|
+
async saveAccidentIncidents(data: Types.AccidentIncidents[]) {
|
|
3615
|
+
try {
|
|
3616
|
+
const dataCopy = JSON.parse(JSON.stringify(data));
|
|
3617
|
+
for (const incident of dataCopy) {
|
|
3618
|
+
incident.count = !!incident.count ? incident.count : 0;
|
|
3619
|
+
incident.amount = incident.amount ? incident.amount : 0;
|
|
3620
|
+
}
|
|
3621
|
+
const response = await this.api.saveAccidentIncidents(this.formStore.applicationData.processInstanceId, dataCopy);
|
|
3622
|
+
return response;
|
|
3623
|
+
} catch (err) {
|
|
3624
|
+
return ErrorHandler(err);
|
|
3625
|
+
}
|
|
3626
|
+
},
|
|
3627
|
+
async saveClientActivityTypes(data: PolicyholderActivity[]) {
|
|
3628
|
+
try {
|
|
3629
|
+
const response = await this.api.saveClientActivityTypes(this.formStore.applicationData.clientApp.id, data);
|
|
3630
|
+
return response;
|
|
3631
|
+
} catch (err) {
|
|
3632
|
+
return ErrorHandler(err);
|
|
3633
|
+
}
|
|
3634
|
+
},
|
|
3635
|
+
async saveBeneficialOwnerList(data: BeneficialOwner[]) {
|
|
3636
|
+
const beneficialOwnerList = JSON.parse(JSON.stringify(data)) as any;
|
|
3637
|
+
for (const item of beneficialOwnerList) {
|
|
3638
|
+
keyDeleter(item as BeneficialOwner, [
|
|
3639
|
+
'beneficialOwnerData.activityTypes',
|
|
3640
|
+
'beneficialOwnerData.actualAddress',
|
|
3641
|
+
'beneficialOwnerData.addTaxResidency',
|
|
3642
|
+
'beneficialOwnerData.authoritedPerson',
|
|
3643
|
+
'beneficialOwnerData.authorityDetails',
|
|
3644
|
+
'beneficialOwnerData.bankInfo',
|
|
3645
|
+
'beneficialOwnerData.legalAddress',
|
|
3646
|
+
'beneficialOwnerData.placeOfBirth',
|
|
3647
|
+
'beneficialOwnerData.typeOfEconomicActivity',
|
|
3648
|
+
]);
|
|
3649
|
+
item.processInstanceId = this.formStore.applicationData.processInstanceId;
|
|
3650
|
+
item.beneficialOwnerData.gender = item.beneficialOwnerData.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3651
|
+
this.preparePersonData(item.beneficialOwnerData);
|
|
3652
|
+
}
|
|
3653
|
+
try {
|
|
3654
|
+
const response = await this.api.saveBeneficialOwnerList(this.formStore.applicationData.processInstanceId, beneficialOwnerList);
|
|
3655
|
+
return response;
|
|
3656
|
+
} catch (err) {
|
|
3657
|
+
return ErrorHandler(err);
|
|
3658
|
+
}
|
|
3659
|
+
},
|
|
3660
|
+
async saveBeneficialOwner(data: BeneficialOwner) {
|
|
3661
|
+
const beneficialOwner = JSON.parse(JSON.stringify(data)) as any;
|
|
3662
|
+
keyDeleter(beneficialOwner as BeneficialOwner, [
|
|
3663
|
+
'beneficialOwnerData.activityTypes',
|
|
3664
|
+
'beneficialOwnerData.actualAddress',
|
|
3665
|
+
'beneficialOwnerData.addTaxResidency',
|
|
3666
|
+
'beneficialOwnerData.authoritedPerson',
|
|
3667
|
+
'beneficialOwnerData.authorityDetails',
|
|
3668
|
+
'beneficialOwnerData.bankInfo',
|
|
3669
|
+
'beneficialOwnerData.legalAddress',
|
|
3670
|
+
'beneficialOwnerData.placeOfBirth',
|
|
3671
|
+
'beneficialOwnerData.typeOfEconomicActivity',
|
|
3672
|
+
]);
|
|
3673
|
+
beneficialOwner.beneficialOwnerData.gender = beneficialOwner.beneficialOwnerData.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3674
|
+
this.preparePersonData(beneficialOwner.beneficialOwnerData);
|
|
3675
|
+
try {
|
|
3676
|
+
const response = await this.api.saveBeneficialOwner(this.formStore.applicationData.processInstanceId, String(beneficialOwner.id), beneficialOwner);
|
|
3677
|
+
return response;
|
|
3678
|
+
} catch (err) {
|
|
3679
|
+
return ErrorHandler(err);
|
|
3680
|
+
}
|
|
3681
|
+
},
|
|
3682
|
+
async saveInsuredList(insuredList: any) {
|
|
3683
|
+
try {
|
|
3684
|
+
await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, insuredList);
|
|
3685
|
+
return true;
|
|
3686
|
+
} catch (err) {
|
|
3687
|
+
return ErrorHandler(err);
|
|
3688
|
+
}
|
|
3689
|
+
},
|
|
3690
|
+
async saveInsured(insured: any) {
|
|
3691
|
+
try {
|
|
3692
|
+
const response = await this.api.saveInsured(this.formStore.applicationData.processInstanceId, insured.id, insured);
|
|
3693
|
+
return response;
|
|
3694
|
+
} catch (err) {
|
|
3695
|
+
return ErrorHandler(err);
|
|
3696
|
+
}
|
|
3697
|
+
},
|
|
3698
|
+
newInsuredList(list: any) {
|
|
3699
|
+
const clients = list.map((item: any, index: number) => {
|
|
3700
|
+
const client = item.insuredData;
|
|
3701
|
+
return {
|
|
3702
|
+
id: index,
|
|
3703
|
+
fullName: client.longName,
|
|
3704
|
+
gender: client.gender,
|
|
3705
|
+
position: client.workDetails.positionRu,
|
|
3706
|
+
birthDate: client.birthDate,
|
|
3707
|
+
iin: reformatIin(client.iin),
|
|
3708
|
+
insSum: client.insuredPolicyData.insSum,
|
|
3709
|
+
premium: client.insuredPolicyData.premium,
|
|
3710
|
+
premiumWithLoad: client.insuredPolicyData.premiumWithLoad,
|
|
3711
|
+
hasAttachedFile: client.hasAttachedFile,
|
|
3712
|
+
};
|
|
3713
|
+
});
|
|
3714
|
+
return clients;
|
|
3715
|
+
},
|
|
3716
|
+
validateMultipleMembersV2(localKey: string, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
3717
|
+
// @ts-ignore
|
|
3718
|
+
if (this.formStore.lfb[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
3719
|
+
// @ts-ignore
|
|
3720
|
+
if (this.formStore.lfb[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
3721
|
+
// @ts-ignore
|
|
3722
|
+
const localMembers = [...this.formStore.lfb[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
3723
|
+
const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.id - b.id);
|
|
3724
|
+
if (localMembers.every((each, index) => applicationMembers[index].iin === each.iin?.replace(/-/g, '')) === false) {
|
|
3725
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3726
|
+
return false;
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
} else {
|
|
3730
|
+
// @ts-ignore
|
|
3731
|
+
if (this.formStore.lfb[localKey].some(i => i.iin !== null)) {
|
|
3732
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3733
|
+
return false;
|
|
3734
|
+
}
|
|
3735
|
+
if (this.formStore.applicationData[applicationKey].length !== 0) {
|
|
3736
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3737
|
+
return false;
|
|
3738
|
+
} else {
|
|
3739
|
+
// @ts-ignore
|
|
3740
|
+
if (this.formStore.lfb[localKey][0].iin !== null) {
|
|
3741
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3742
|
+
return false;
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
return true;
|
|
3747
|
+
},
|
|
3748
|
+
async validateAllFormsV2(taskId: string) {
|
|
3749
|
+
this.isLoading = true;
|
|
3750
|
+
if (taskId === '0') {
|
|
3751
|
+
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
3752
|
+
return false;
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
if (this.formStore.applicationData.clientApp.iin !== this.formStore.applicationData.clientApp.iin) {
|
|
3756
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
3757
|
+
return false;
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
if (this.formStore.lfb.beneficialOwners) {
|
|
3761
|
+
if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
3762
|
+
return false;
|
|
3763
|
+
}
|
|
3764
|
+
const inStatement = this.formStore.lfb.beneficialOwners.every(i => i.beneficialOwnerData.id !== null);
|
|
3765
|
+
if (inStatement === false) {
|
|
3766
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficialOwner') }));
|
|
3767
|
+
return false;
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
|
|
3771
|
+
if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3772
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
|
|
3773
|
+
return false;
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
if (this.formStore.lfb.clients) {
|
|
3777
|
+
if (this.validateMultipleMembersV2('clients', 'insuredApp', 'застрахованных') === false) {
|
|
3778
|
+
return false;
|
|
3779
|
+
}
|
|
3780
|
+
const inStatement = this.formStore.lfb.clients.every(i => i.id !== null);
|
|
3781
|
+
if (inStatement === false) {
|
|
3782
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.insured') }));
|
|
3783
|
+
return false;
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3788
|
+
for (const client of this.formStore.lfb.clients) {
|
|
3789
|
+
if (client.hasAttachedFile === false) {
|
|
3790
|
+
this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
|
|
3791
|
+
return false;
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3797
|
+
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
3798
|
+
return false;
|
|
3799
|
+
}
|
|
3800
|
+
|
|
3801
|
+
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3802
|
+
this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
|
|
3803
|
+
return false;
|
|
3804
|
+
}
|
|
3805
|
+
|
|
3806
|
+
return true;
|
|
3807
|
+
},
|
|
3808
|
+
async getVariableData(processCode: number) {
|
|
3809
|
+
try {
|
|
3810
|
+
const response = await this.api.getVariableData(0, processCode);
|
|
3811
|
+
if (response) {
|
|
3812
|
+
return response.data.slice(0, 10);
|
|
3813
|
+
}
|
|
3814
|
+
return null;
|
|
3815
|
+
} catch (err) {
|
|
3816
|
+
ErrorHandler(err);
|
|
3817
|
+
return null;
|
|
3818
|
+
}
|
|
3819
|
+
},
|
|
3820
|
+
async checkIIN(iin: string) {
|
|
3821
|
+
try {
|
|
3822
|
+
const response = await this.api.checkIIN(iin);
|
|
3823
|
+
return response;
|
|
3824
|
+
} catch (err) {
|
|
3825
|
+
ErrorHandler(err);
|
|
3826
|
+
return null;
|
|
3827
|
+
}
|
|
3828
|
+
},
|
|
3829
|
+
async checkAccountNumber(iik: string) {
|
|
3830
|
+
try {
|
|
3831
|
+
const checked = await this.api.checkAccountNumber(iik);
|
|
3832
|
+
return checked;
|
|
3833
|
+
} catch (err) {
|
|
3834
|
+
return ErrorHandler(err);
|
|
2596
3835
|
}
|
|
2597
|
-
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2598
|
-
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
2599
3836
|
},
|
|
2600
3837
|
async isCourseChanged(processInstanceId: string) {
|
|
2601
3838
|
try {
|
|
@@ -2605,7 +3842,20 @@ export const useDataStore = defineStore('data', {
|
|
|
2605
3842
|
return ErrorHandler(err);
|
|
2606
3843
|
}
|
|
2607
3844
|
},
|
|
3845
|
+
async generateShortLink(url: string, template?: Types.Api.GenerateShortLink.Templates) {
|
|
3846
|
+
try {
|
|
3847
|
+
const response = await this.api.generateShortLink({
|
|
3848
|
+
link: url,
|
|
3849
|
+
priority: 'low',
|
|
3850
|
+
template: template,
|
|
3851
|
+
});
|
|
3852
|
+
return response.link;
|
|
3853
|
+
} catch (err) {
|
|
3854
|
+
return ErrorHandler(err);
|
|
3855
|
+
}
|
|
3856
|
+
},
|
|
2608
3857
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
3858
|
+
if (this.isLifetrip || this.isPension) return false;
|
|
2609
3859
|
switch (whichForm) {
|
|
2610
3860
|
case this.formStore.beneficiaryFormKey:
|
|
2611
3861
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -2616,7 +3866,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2616
3866
|
}
|
|
2617
3867
|
},
|
|
2618
3868
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
2619
|
-
if (this.isGons) return false;
|
|
3869
|
+
if (this.isGons || this.isPension) return false;
|
|
2620
3870
|
switch (whichForm) {
|
|
2621
3871
|
case this.formStore.beneficiaryFormKey:
|
|
2622
3872
|
return false;
|
|
@@ -2637,30 +3887,79 @@ export const useDataStore = defineStore('data', {
|
|
|
2637
3887
|
}
|
|
2638
3888
|
},
|
|
2639
3889
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
2640
|
-
if (this.isGons) return false;
|
|
3890
|
+
if (this.isGons || this.isPension) return false;
|
|
2641
3891
|
switch (whichForm) {
|
|
2642
3892
|
default:
|
|
2643
3893
|
return true;
|
|
2644
3894
|
}
|
|
2645
3895
|
},
|
|
3896
|
+
hasBankSection(whichForm: keyof typeof StoreMembers) {
|
|
3897
|
+
if (!this.isPension) return false;
|
|
3898
|
+
switch (whichForm) {
|
|
3899
|
+
case 'beneficiaryForm':
|
|
3900
|
+
return false;
|
|
3901
|
+
default:
|
|
3902
|
+
return true;
|
|
3903
|
+
}
|
|
3904
|
+
},
|
|
3905
|
+
hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
|
|
3906
|
+
if (!this.isPension) return false;
|
|
3907
|
+
switch (whichForm) {
|
|
3908
|
+
case 'beneficiaryForm':
|
|
3909
|
+
return false;
|
|
3910
|
+
default:
|
|
3911
|
+
return true;
|
|
3912
|
+
}
|
|
3913
|
+
},
|
|
3914
|
+
hasFamilyTiesSection(whichForm: keyof typeof StoreMembers) {
|
|
3915
|
+
if (!this.isPension) return false;
|
|
3916
|
+
switch (whichForm) {
|
|
3917
|
+
case 'policyholderForm':
|
|
3918
|
+
return false;
|
|
3919
|
+
case 'beneficiaryForm':
|
|
3920
|
+
return true;
|
|
3921
|
+
default:
|
|
3922
|
+
return false;
|
|
3923
|
+
}
|
|
3924
|
+
},
|
|
2646
3925
|
hasPercentageOfPayoutAmount() {
|
|
2647
3926
|
return true;
|
|
2648
3927
|
},
|
|
2649
|
-
|
|
2650
|
-
|
|
3928
|
+
hasAccess() {
|
|
3929
|
+
const baseAccessRoles = this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
|
|
3930
|
+
return {
|
|
3931
|
+
invoiceInfo: this.isAdmin(),
|
|
3932
|
+
toLKA: this.isAgent() || baseAccessRoles,
|
|
3933
|
+
toAML: this.isCompliance() || baseAccessRoles,
|
|
3934
|
+
toAULETTI: this.isAgentAuletti() || baseAccessRoles,
|
|
3935
|
+
toLKA_A: this.isAgentAuletti() || baseAccessRoles,
|
|
3936
|
+
toEFO:
|
|
3937
|
+
this.isManager() ||
|
|
3938
|
+
this.isAgent() ||
|
|
3939
|
+
this.isAgentMycar() ||
|
|
3940
|
+
this.isManagerHalykBank() ||
|
|
3941
|
+
this.isHeadManager() ||
|
|
3942
|
+
this.isServiceManager() ||
|
|
3943
|
+
this.isUnderwriter() ||
|
|
3944
|
+
this.isActuary() ||
|
|
3945
|
+
this.isAdmin() ||
|
|
3946
|
+
this.isCompliance() ||
|
|
3947
|
+
this.isAnalyst() ||
|
|
3948
|
+
this.isUpk() ||
|
|
3949
|
+
this.isFinCenter() ||
|
|
3950
|
+
this.isSupervisor() ||
|
|
3951
|
+
this.isSupport() ||
|
|
3952
|
+
this.isDrn() ||
|
|
3953
|
+
this.isUrp() ||
|
|
3954
|
+
this.isUsns() ||
|
|
3955
|
+
this.isAccountant() ||
|
|
3956
|
+
this.isBranchDirector() ||
|
|
3957
|
+
this.isUSNSACCINS() ||
|
|
3958
|
+
this.isDsuio() ||
|
|
3959
|
+
this.isAdjuster() ||
|
|
3960
|
+
this.isDsoDirector() ||
|
|
3961
|
+
this.isAccountantDirector(),
|
|
3962
|
+
};
|
|
2651
3963
|
},
|
|
2652
3964
|
},
|
|
2653
3965
|
});
|
|
2654
|
-
|
|
2655
|
-
// Для карты клиента
|
|
2656
|
-
// export const useContragentStore = defineStore('contragent', {
|
|
2657
|
-
// state: () => ({
|
|
2658
|
-
// ...new Contragent(),
|
|
2659
|
-
// formatDate: new Contragent().formatDate,
|
|
2660
|
-
// getDateByKey: new Contragent().getDateByKey,
|
|
2661
|
-
// getBirthDate: new Contragent().getBirthDate,
|
|
2662
|
-
// getDocumentExpireDate: new Contragent().getDocumentExpireDate,
|
|
2663
|
-
// getDocumentDate: new Contragent().getDocumentDate,
|
|
2664
|
-
// getAgeByBirthDate: new Contragent().getAgeByBirthDate,
|
|
2665
|
-
// }),
|
|
2666
|
-
// });
|