hl-core 0.0.10-beta.6 → 0.0.10-beta.61
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/README.md +0 -2
- package/api/base.api.ts +361 -137
- package/api/interceptors.ts +3 -5
- package/components/Dialog/Dialog.vue +5 -1
- package/components/Dialog/FamilyDialog.vue +15 -4
- package/components/Form/DigitalDocument.vue +52 -0
- package/components/Form/FormSource.vue +30 -0
- package/components/Form/ManagerAttachment.vue +60 -11
- package/components/Form/ProductConditionsBlock.vue +12 -6
- package/components/Input/Datepicker.vue +5 -0
- package/components/Input/FileInput.vue +1 -1
- package/components/Input/FormInput.vue +7 -0
- package/components/Input/OtpInput.vue +25 -0
- package/components/Input/RoundedInput.vue +2 -0
- package/components/Input/RoundedSelect.vue +2 -0
- package/components/Input/TextAreaField.vue +71 -0
- package/components/Menu/MenuNav.vue +2 -1
- package/components/Pages/Anketa.vue +207 -176
- package/components/Pages/ContragentForm.vue +1 -1
- package/components/Pages/Documents.vue +486 -64
- package/components/Pages/MemberForm.vue +424 -182
- package/components/Pages/ProductConditions.vue +1180 -257
- package/components/Panel/PanelHandler.vue +319 -125
- package/components/Utilities/Chip.vue +1 -1
- package/components/Utilities/JsonViewer.vue +1 -2
- package/composables/classes.ts +125 -21
- package/composables/constants.ts +166 -1
- package/composables/index.ts +345 -9
- package/composables/styles.ts +8 -24
- package/configs/i18n.ts +2 -0
- package/configs/pwa.ts +1 -7
- package/layouts/clear.vue +1 -1
- package/layouts/default.vue +1 -1
- package/layouts/full.vue +1 -1
- package/locales/kz.json +1236 -0
- package/locales/ru.json +109 -20
- package/nuxt.config.ts +8 -6
- package/package.json +12 -12
- package/plugins/head.ts +7 -1
- package/plugins/helperFunctionsPlugins.ts +1 -0
- package/store/data.store.ts +948 -527
- package/store/member.store.ts +17 -6
- package/store/rules.ts +54 -3
- package/types/enum.ts +46 -2
- package/types/index.ts +126 -5
package/store/data.store.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { defineStore } from 'pinia';
|
|
|
2
2
|
import { rules } from './rules';
|
|
3
3
|
import { i18n } from '../configs/i18n';
|
|
4
4
|
import { Toast, Types as ToastTypes, Positions, ToastOptions } from './toast';
|
|
5
|
-
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
|
|
6
|
-
import { DataStoreClass, DocumentItem, Member, Value, CountryValue, PolicyholderActivity, BeneficialOwner, PolicyholderClass } from '../composables/classes';
|
|
5
|
+
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate, RoleController, ProcessController, sanitize } from '../composables';
|
|
6
|
+
import { DataStoreClass, DocumentItem, Member, Value, CountryValue, PolicyholderActivity, BeneficialOwner, PolicyholderClass, GroupMember } from '../composables/classes';
|
|
7
7
|
import { ApiClass } from '../api';
|
|
8
8
|
import { useFormStore } from './form.store';
|
|
9
9
|
import { AxiosError } from 'axios';
|
|
10
|
-
import { PostActions, StoreMembers,
|
|
10
|
+
import { PostActions, StoreMembers, MemberCodes, MemberAppCodes, CoreEnums } from '../types/enum';
|
|
11
11
|
import type * as Types from '../types';
|
|
12
12
|
//@ts-ignore
|
|
13
13
|
import { NCALayerClient } from 'ncalayer-js-client';
|
|
@@ -15,11 +15,14 @@ import { NCALayerClient } from 'ncalayer-js-client';
|
|
|
15
15
|
export const useDataStore = defineStore('data', {
|
|
16
16
|
state: () => ({
|
|
17
17
|
...new DataStoreClass(),
|
|
18
|
+
...new RoleController(),
|
|
19
|
+
...new ProcessController(),
|
|
18
20
|
t: i18n.t,
|
|
19
21
|
rules: rules,
|
|
20
22
|
toast: Toast,
|
|
21
23
|
toastTypes: ToastTypes,
|
|
22
24
|
toastPositions: Positions,
|
|
25
|
+
sanitize: sanitize,
|
|
23
26
|
isValidGUID: isValidGUID,
|
|
24
27
|
router: useRouter(),
|
|
25
28
|
formStore: useFormStore(),
|
|
@@ -60,10 +63,17 @@ export const useDataStore = defineStore('data', {
|
|
|
60
63
|
isCheckContract: state => state.product === 'checkcontract',
|
|
61
64
|
isCheckContragent: state => state.product === 'checkcontragent',
|
|
62
65
|
isPrePension: state => state.product === 'prepensionannuity',
|
|
66
|
+
isCritical: state => state.product === 'criticalillness',
|
|
67
|
+
isBalam: state => state.product === 'balam',
|
|
68
|
+
isTumar: state => state.product === 'tumar',
|
|
69
|
+
isBorrower: state => state.product === 'borrower',
|
|
63
70
|
isDSO: state => state.product === 'dso',
|
|
64
71
|
isUU: state => state.product === 'uu',
|
|
65
|
-
|
|
72
|
+
isReInsurance: state => state.product === 'reinsurance',
|
|
73
|
+
isReporting: state => state.product === 'reporting',
|
|
74
|
+
hasClientAnketa: state => Array.isArray(state.formStore.additionalInsuranceTerms) && state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
66
75
|
isClientAnketaCondition: state =>
|
|
76
|
+
Array.isArray(state.formStore.additionalInsuranceTerms) &&
|
|
67
77
|
!state.formStore.insuredForm.find(member => member.iin === state.formStore.policyholderForm.iin) &&
|
|
68
78
|
!!state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10 && i.coverSumCode === 'included'),
|
|
69
79
|
},
|
|
@@ -138,7 +148,7 @@ export const useDataStore = defineStore('data', {
|
|
|
138
148
|
if (showError) this.showToaster('error', this.t('toaster.noUrl'));
|
|
139
149
|
}
|
|
140
150
|
},
|
|
141
|
-
|
|
151
|
+
getDocsByIIN(iin: string) {
|
|
142
152
|
return iin ? this.formStore.signedDocumentList.filter(file => file.iin === iin && file.fileTypeName === 'Удостоверение личности') : null;
|
|
143
153
|
},
|
|
144
154
|
async getNewAccessToken() {
|
|
@@ -160,22 +170,23 @@ export const useDataStore = defineStore('data', {
|
|
|
160
170
|
getUserRoles() {
|
|
161
171
|
if (this.accessToken && this.user.roles.length === 0) {
|
|
162
172
|
const decoded = jwtDecode(this.accessToken);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
if (decoded) {
|
|
174
|
+
this.user.id = String(decoded.sub);
|
|
175
|
+
this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
|
|
176
|
+
this.user.code = decoded.code;
|
|
177
|
+
this.user.branchCode = decoded.branchCode;
|
|
178
|
+
const key = getKeyWithPattern(decoded, 'role');
|
|
179
|
+
if (key) {
|
|
180
|
+
const roles = decoded[key as keyof Types.Utils.JwtToken];
|
|
181
|
+
if (typeof roles === 'string') {
|
|
182
|
+
this.user.roles.push(roles);
|
|
183
|
+
} else if (typeof roles === 'object') {
|
|
184
|
+
this.user.roles = roles;
|
|
185
|
+
}
|
|
172
186
|
}
|
|
173
187
|
}
|
|
174
188
|
}
|
|
175
189
|
},
|
|
176
|
-
getUserData() {
|
|
177
|
-
return this.accessToken ? jwtDecode(this.accessToken) : null;
|
|
178
|
-
},
|
|
179
190
|
async getUserGroups() {
|
|
180
191
|
try {
|
|
181
192
|
this.isLoading = true;
|
|
@@ -186,140 +197,17 @@ export const useDataStore = defineStore('data', {
|
|
|
186
197
|
this.isLoading = false;
|
|
187
198
|
}
|
|
188
199
|
},
|
|
189
|
-
isRole(whichRole: keyof typeof Roles) {
|
|
190
|
-
if (this.user.roles.length === 0) {
|
|
191
|
-
this.getUserRoles();
|
|
192
|
-
}
|
|
193
|
-
const isRole = this.user.roles.find(i => i === whichRole);
|
|
194
|
-
return !!isRole;
|
|
195
|
-
},
|
|
196
|
-
isInitiator() {
|
|
197
|
-
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager() || this.isAgentAuletti();
|
|
198
|
-
},
|
|
199
|
-
isManager() {
|
|
200
|
-
return this.isRole(constants.roles.Manager);
|
|
201
|
-
},
|
|
202
|
-
isCompliance() {
|
|
203
|
-
return this.isRole(constants.roles.Compliance);
|
|
204
|
-
},
|
|
205
|
-
isAdmin() {
|
|
206
|
-
return this.isRole(constants.roles.Admin);
|
|
207
|
-
},
|
|
208
|
-
isJurist() {
|
|
209
|
-
return this.isRole(constants.roles.Jurist);
|
|
210
|
-
},
|
|
211
|
-
isAgent() {
|
|
212
|
-
return this.isRole(constants.roles.Agent);
|
|
213
|
-
},
|
|
214
|
-
isManagerHalykBank() {
|
|
215
|
-
return this.isRole(constants.roles.ManagerHalykBank);
|
|
216
|
-
},
|
|
217
|
-
isServiceManager() {
|
|
218
|
-
return this.isRole(constants.roles.ServiceManager);
|
|
219
|
-
},
|
|
220
|
-
isUnderwriter() {
|
|
221
|
-
return this.isRole(constants.roles.Underwriter);
|
|
222
|
-
},
|
|
223
|
-
isActuary() {
|
|
224
|
-
return this.isRole(constants.roles.Actuary);
|
|
225
|
-
},
|
|
226
|
-
isAgentMycar() {
|
|
227
|
-
return this.isRole(constants.roles.AgentMycar);
|
|
228
|
-
},
|
|
229
|
-
isAgentAuletti() {
|
|
230
|
-
return this.isRole(constants.roles.AgentAuletti);
|
|
231
|
-
},
|
|
232
|
-
isAnalyst() {
|
|
233
|
-
return this.isRole(constants.roles.Analyst);
|
|
234
|
-
},
|
|
235
|
-
isUpk() {
|
|
236
|
-
return this.isRole(constants.roles.UPK);
|
|
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
|
-
},
|
|
247
|
-
isDrn() {
|
|
248
|
-
return this.isRole(constants.roles.DRNSJ);
|
|
249
|
-
},
|
|
250
|
-
isSupport() {
|
|
251
|
-
return this.isRole(constants.roles.Support);
|
|
252
|
-
},
|
|
253
|
-
isFinCenter() {
|
|
254
|
-
return this.isRole(constants.roles.FinCenter);
|
|
255
|
-
},
|
|
256
|
-
isSupervisor() {
|
|
257
|
-
return this.isRole(constants.roles.Supervisor);
|
|
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.Adjuster);
|
|
273
|
-
},
|
|
274
|
-
isDsoDirector() {
|
|
275
|
-
return this.isRole(constants.roles.DsoDirector);
|
|
276
|
-
},
|
|
277
|
-
isAccountantDirector() {
|
|
278
|
-
return this.isRole(constants.roles.AccountantDirector);
|
|
279
|
-
},
|
|
280
|
-
isProcessEditable(statusCode?: keyof typeof Statuses) {
|
|
281
|
-
const getEditibleStatuses = () => {
|
|
282
|
-
const defaultStatuses = constants.editableStatuses;
|
|
283
|
-
return defaultStatuses;
|
|
284
|
-
};
|
|
285
|
-
return !!getEditibleStatuses().find(status => status === statusCode);
|
|
286
|
-
},
|
|
287
|
-
isProcessReturnable(statusCode?: keyof typeof Statuses) {
|
|
288
|
-
const getReturnableStatuses = () => {
|
|
289
|
-
const defaultStatuses = constants.returnStatementStatuses;
|
|
290
|
-
return defaultStatuses;
|
|
291
|
-
};
|
|
292
|
-
return !!getReturnableStatuses().find(status => status === statusCode);
|
|
293
|
-
},
|
|
294
|
-
isProcessCancel(statusCode?: keyof typeof Statuses) {
|
|
295
|
-
const getCanceleStatuses = () => {
|
|
296
|
-
const defaultStatuses = constants.cancelApplicationStatuses;
|
|
297
|
-
return defaultStatuses;
|
|
298
|
-
};
|
|
299
|
-
return !!getCanceleStatuses().find(status => status === statusCode);
|
|
300
|
-
},
|
|
301
|
-
isProcessReject(statusCode?: keyof typeof Statuses) {
|
|
302
|
-
const getRejectStatuses = () => {
|
|
303
|
-
const defaultStatuses = constants.rejectApplicationStatuses;
|
|
304
|
-
return defaultStatuses;
|
|
305
|
-
};
|
|
306
|
-
return !!getRejectStatuses().find(status => status === statusCode);
|
|
307
|
-
},
|
|
308
200
|
isTask() {
|
|
309
201
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
310
202
|
},
|
|
311
203
|
validateAccess() {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
return false;
|
|
320
|
-
} catch (err) {
|
|
321
|
-
return ErrorHandler(err);
|
|
322
|
-
}
|
|
204
|
+
const hasAccess = this.hasAccess();
|
|
205
|
+
if (this.isAML) return hasAccess.toAML;
|
|
206
|
+
if (this.isLKA) return hasAccess.toLKA;
|
|
207
|
+
if (this.isEFO) return hasAccess.toEFO;
|
|
208
|
+
if (this.isAULETTI) return hasAccess.toAULETTI;
|
|
209
|
+
if (this.isLKA_A) return hasAccess.toLKA_A;
|
|
210
|
+
return false;
|
|
323
211
|
},
|
|
324
212
|
async loginUser(login: string, password: string, numAttempt: number) {
|
|
325
213
|
try {
|
|
@@ -394,53 +282,91 @@ export const useDataStore = defineStore('data', {
|
|
|
394
282
|
await this.router.replace({ name: route.name });
|
|
395
283
|
}
|
|
396
284
|
},
|
|
397
|
-
async
|
|
285
|
+
async getDoc(file: DocumentItem, mode: string = 'view', fileType: string = 'pdf') {
|
|
398
286
|
if (!file.id) return;
|
|
399
287
|
try {
|
|
400
288
|
this.isLoading = true;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
289
|
+
if (this.isPension) {
|
|
290
|
+
await this.api.file.getDocNew(file.id).then((response: any) => {
|
|
291
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
292
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
293
|
+
const url = window.URL.createObjectURL(blob);
|
|
294
|
+
const link = document.createElement('a');
|
|
295
|
+
link.href = url;
|
|
296
|
+
if (mode === 'view') {
|
|
297
|
+
setTimeout(() => {
|
|
298
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
299
|
+
});
|
|
300
|
+
} else {
|
|
301
|
+
link.setAttribute('download', file.fileName!);
|
|
302
|
+
document.body.appendChild(link);
|
|
303
|
+
link.click();
|
|
304
|
+
}
|
|
411
305
|
} else {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
link.click();
|
|
415
|
-
}
|
|
416
|
-
} else {
|
|
417
|
-
const blob = new Blob([response], {
|
|
418
|
-
type: `application/${fileType}`,
|
|
419
|
-
});
|
|
420
|
-
const url = window.URL.createObjectURL(blob);
|
|
421
|
-
const link = document.createElement('a');
|
|
422
|
-
link.href = url;
|
|
423
|
-
if (mode === 'view') {
|
|
424
|
-
setTimeout(() => {
|
|
425
|
-
window.open(url, '_blank', `right=100`);
|
|
306
|
+
const blob = new Blob([response], {
|
|
307
|
+
type: `application/${fileType}`,
|
|
426
308
|
});
|
|
309
|
+
const url = window.URL.createObjectURL(blob);
|
|
310
|
+
const link = document.createElement('a');
|
|
311
|
+
link.href = url;
|
|
312
|
+
if (mode === 'view') {
|
|
313
|
+
setTimeout(() => {
|
|
314
|
+
window.open(url, '_blank', `right=100`);
|
|
315
|
+
});
|
|
316
|
+
} else {
|
|
317
|
+
link.setAttribute('download', file.fileName!);
|
|
318
|
+
document.body.appendChild(link);
|
|
319
|
+
link.click();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
} else {
|
|
324
|
+
await this.api.file.getDoc(file.id).then((response: any) => {
|
|
325
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
326
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
327
|
+
const url = window.URL.createObjectURL(blob);
|
|
328
|
+
const link = document.createElement('a');
|
|
329
|
+
link.href = url;
|
|
330
|
+
if (mode === 'view') {
|
|
331
|
+
setTimeout(() => {
|
|
332
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
333
|
+
});
|
|
334
|
+
} else {
|
|
335
|
+
link.setAttribute('download', file.fileName!);
|
|
336
|
+
document.body.appendChild(link);
|
|
337
|
+
link.click();
|
|
338
|
+
}
|
|
427
339
|
} else {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
340
|
+
const blob = new Blob([response], {
|
|
341
|
+
type: `application/${fileType}`,
|
|
342
|
+
});
|
|
343
|
+
const url = window.URL.createObjectURL(blob);
|
|
344
|
+
const link = document.createElement('a');
|
|
345
|
+
link.href = url;
|
|
346
|
+
if (mode === 'view') {
|
|
347
|
+
setTimeout(() => {
|
|
348
|
+
window.open(url, '_blank', `right=100`);
|
|
349
|
+
});
|
|
350
|
+
} else {
|
|
351
|
+
link.setAttribute('download', file.fileName!);
|
|
352
|
+
document.body.appendChild(link);
|
|
353
|
+
link.click();
|
|
354
|
+
}
|
|
431
355
|
}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
434
358
|
} catch (err) {
|
|
435
359
|
ErrorHandler(err);
|
|
436
360
|
} finally {
|
|
437
361
|
this.isLoading = false;
|
|
438
362
|
}
|
|
439
363
|
},
|
|
440
|
-
async deleteFile(data: DocumentItem) {
|
|
364
|
+
async deleteFile(data: DocumentItem, showToaster: boolean = true) {
|
|
441
365
|
try {
|
|
442
|
-
await this.api.deleteFile(data);
|
|
443
|
-
|
|
366
|
+
await this.api.file.deleteFile(data);
|
|
367
|
+
if (showToaster) {
|
|
368
|
+
this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
|
|
369
|
+
}
|
|
444
370
|
} catch (err) {
|
|
445
371
|
ErrorHandler(err);
|
|
446
372
|
}
|
|
@@ -448,7 +374,7 @@ export const useDataStore = defineStore('data', {
|
|
|
448
374
|
async uploadFiles(data: FormData, load: boolean = false) {
|
|
449
375
|
this.isLoading = load;
|
|
450
376
|
try {
|
|
451
|
-
await this.api.uploadFiles(data);
|
|
377
|
+
await this.api.file.uploadFiles(data);
|
|
452
378
|
return true;
|
|
453
379
|
} catch (err) {
|
|
454
380
|
return ErrorHandler(err);
|
|
@@ -458,14 +384,28 @@ export const useDataStore = defineStore('data', {
|
|
|
458
384
|
},
|
|
459
385
|
async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
|
|
460
386
|
this.isLoading = load;
|
|
461
|
-
|
|
387
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
388
|
+
if (isNonResident) {
|
|
389
|
+
if (!member.firstName || !member.lastName) return;
|
|
390
|
+
} else {
|
|
391
|
+
if (!member.iin) return;
|
|
392
|
+
}
|
|
462
393
|
try {
|
|
463
|
-
const queryData =
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
394
|
+
const queryData = isNonResident
|
|
395
|
+
? {
|
|
396
|
+
firstName: member.firstName ?? '',
|
|
397
|
+
lastName: member.lastName ?? '',
|
|
398
|
+
middleName: member.middleName ?? '',
|
|
399
|
+
iin: '',
|
|
400
|
+
birthDate: member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
401
|
+
}
|
|
402
|
+
: {
|
|
403
|
+
firstName: '',
|
|
404
|
+
lastName: '',
|
|
405
|
+
middleName: '',
|
|
406
|
+
iin: member.iin ? member.iin.replace(/-/g, '') : '',
|
|
407
|
+
birthDate: '',
|
|
408
|
+
};
|
|
469
409
|
const contragentResponse = await this.api.getContragent(queryData);
|
|
470
410
|
if (contragentResponse.totalItems > 0) {
|
|
471
411
|
if (contragentResponse.items.length === 1) {
|
|
@@ -474,25 +414,32 @@ export const useDataStore = defineStore('data', {
|
|
|
474
414
|
const sortedByRegistrationDate = contragentResponse.items.sort(
|
|
475
415
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
476
416
|
);
|
|
477
|
-
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
417
|
+
if (!isNonResident) await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
478
418
|
}
|
|
479
419
|
member.gotFromInsis = true;
|
|
480
420
|
} else {
|
|
481
421
|
if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
482
422
|
}
|
|
423
|
+
if (isNonResident) return contragentResponse;
|
|
483
424
|
} catch (err) {
|
|
484
425
|
ErrorHandler(err);
|
|
485
426
|
}
|
|
486
427
|
this.isLoading = false;
|
|
487
428
|
},
|
|
488
|
-
async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
|
|
429
|
+
async getContragentById(id: number, whichForm: keyof typeof StoreMembers | 'slaveInsuredForm', load: boolean = true, whichIndex: number | null = null) {
|
|
489
430
|
if (Number(id) === 0) return;
|
|
490
431
|
this.isLoading = load;
|
|
491
432
|
try {
|
|
492
|
-
const member =
|
|
433
|
+
const member =
|
|
434
|
+
this.isPension && whichForm === 'slaveInsuredForm'
|
|
435
|
+
? this.formStore.slaveInsuredForm
|
|
436
|
+
: whichIndex === null
|
|
437
|
+
? this.formStore[whichForm as Types.SingleMember]
|
|
438
|
+
: this.formStore[whichForm as Types.MultipleMember][whichIndex];
|
|
439
|
+
|
|
493
440
|
const contragentResponse = await this.api.getContragentById(id);
|
|
494
441
|
if (contragentResponse.totalItems > 0) {
|
|
495
|
-
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
442
|
+
await this.serializeContragentData(member, contragentResponse.items[0], whichForm);
|
|
496
443
|
} else {
|
|
497
444
|
this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
498
445
|
}
|
|
@@ -502,7 +449,7 @@ export const useDataStore = defineStore('data', {
|
|
|
502
449
|
this.isLoading = false;
|
|
503
450
|
}
|
|
504
451
|
},
|
|
505
|
-
async serializeContragentData(member: Member, contragent: Types.ContragentType) {
|
|
452
|
+
async serializeContragentData(member: Member, contragent: Types.ContragentType, whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm') {
|
|
506
453
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
507
454
|
this.api.getContrAgentData(contragent.id),
|
|
508
455
|
this.api.getContrAgentContacts(contragent.id),
|
|
@@ -524,23 +471,34 @@ export const useDataStore = defineStore('data', {
|
|
|
524
471
|
if (addressResponse.status === 'fulfilled' && addressResponse.value && addressResponse.value.length) {
|
|
525
472
|
member.response.addresses = addressResponse.value;
|
|
526
473
|
}
|
|
527
|
-
this.parseContragent(
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
474
|
+
this.parseContragent(
|
|
475
|
+
member,
|
|
476
|
+
{
|
|
477
|
+
personalData: contragent,
|
|
478
|
+
data: questionairesResponse.status === 'fulfilled' ? questionairesResponse.value : undefined,
|
|
479
|
+
contacts: contactsResponse.status === 'fulfilled' ? contactsResponse.value : undefined,
|
|
480
|
+
documents: documentsResponse.status === 'fulfilled' ? documentsResponse.value : undefined,
|
|
481
|
+
address: addressResponse.status === 'fulfilled' ? addressResponse.value : undefined,
|
|
482
|
+
},
|
|
483
|
+
whichForm,
|
|
484
|
+
);
|
|
534
485
|
},
|
|
535
486
|
parseContragent(
|
|
536
487
|
member: Member,
|
|
537
|
-
user: {
|
|
488
|
+
user: {
|
|
489
|
+
personalData: Types.ContragentType;
|
|
490
|
+
data?: Types.ContragentQuestionaries[];
|
|
491
|
+
contacts?: Types.ContragentContacts[];
|
|
492
|
+
documents?: Types.ContragentDocuments[];
|
|
493
|
+
address?: Types.ContragentAddress[];
|
|
494
|
+
},
|
|
495
|
+
whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm',
|
|
538
496
|
) {
|
|
539
497
|
member.verifyType = user.personalData.verifyType;
|
|
540
498
|
member.verifyDate = user.personalData.verifyDate;
|
|
541
499
|
member.iin = reformatIin(user.personalData.iin);
|
|
542
500
|
member.age = String(user.personalData.age);
|
|
543
|
-
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
501
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace ?? 'undefined', 'i')));
|
|
544
502
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
545
503
|
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
546
504
|
member.gender = gender ? gender : new Value();
|
|
@@ -557,13 +515,23 @@ export const useDataStore = defineStore('data', {
|
|
|
557
515
|
|
|
558
516
|
if ('documents' in user && user.documents && user.documents.length) {
|
|
559
517
|
member.documentsList = user.documents;
|
|
560
|
-
const documentByPriority = user.documents.find(i =>
|
|
518
|
+
const documentByPriority = user.documents.find(i => {
|
|
519
|
+
if (this.isLifetrip && (whichForm !== this.formStore.policyholderFormKey || this.formStore.isPolicyholderInsured === true)) {
|
|
520
|
+
return i.type === CoreEnums.Insis.DocTypes['PS'];
|
|
521
|
+
}
|
|
522
|
+
return i.type === CoreEnums.Insis.DocTypes['1UDL'];
|
|
523
|
+
});
|
|
561
524
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
562
525
|
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
563
526
|
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
564
527
|
member.documentType = documentType ? documentType : new Value();
|
|
565
528
|
member.documentNumber = userDocument.number;
|
|
566
529
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
530
|
+
if (userDocument.issuerNameRu === 'Другое') {
|
|
531
|
+
member.documentIssuers.issuerOtherNameRu = userDocument.issuerOtherNameRu;
|
|
532
|
+
member.documentIssuers.issuerOtherNameOrig = userDocument.issuerOtherNameOrig;
|
|
533
|
+
member.documentIssuers.issuerOtherName = userDocument.issuerOtherName;
|
|
534
|
+
}
|
|
567
535
|
member.documentDate = reformatDate(userDocument.issueDate);
|
|
568
536
|
member.documentExpire = reformatDate(userDocument.expireDate);
|
|
569
537
|
}
|
|
@@ -639,23 +607,30 @@ export const useDataStore = defineStore('data', {
|
|
|
639
607
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
640
608
|
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
641
609
|
//@ts-ignore
|
|
642
|
-
member[qData.field] = qResult
|
|
610
|
+
member[qData.field] = qResult ?? new Value();
|
|
643
611
|
}
|
|
644
612
|
},
|
|
645
613
|
async alreadyInInsis(member: Member) {
|
|
646
|
-
|
|
614
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
615
|
+
if (isNonResident) {
|
|
616
|
+
if (!member.firstName || !member.lastName) return;
|
|
617
|
+
} else {
|
|
618
|
+
if (!member.iin) return;
|
|
619
|
+
}
|
|
647
620
|
try {
|
|
648
621
|
const queryData = {
|
|
649
|
-
iin: member.iin.replaceAll('-', ''),
|
|
622
|
+
iin: !!member.iin && !isNonResident ? member.iin.replaceAll('-', '') : '',
|
|
650
623
|
firstName: !!member.firstName ? member.firstName : '',
|
|
651
624
|
lastName: !!member.lastName ? member.lastName : '',
|
|
652
625
|
middleName: !!member.middleName ? member.middleName : '',
|
|
626
|
+
birthDate: !!member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
653
627
|
};
|
|
654
628
|
const contragent = await this.api.getContragent(queryData);
|
|
655
629
|
if (contragent.totalItems > 0) {
|
|
656
630
|
if (contragent.items.length === 1) {
|
|
657
631
|
return contragent.items[0];
|
|
658
632
|
} else {
|
|
633
|
+
if (this.isPension && queryData.iin === '') return contragent.items.find(i => i.id === member.id);
|
|
659
634
|
const sortedByRegistrationDate = contragent.items.sort(
|
|
660
635
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
661
636
|
);
|
|
@@ -689,8 +664,8 @@ export const useDataStore = defineStore('data', {
|
|
|
689
664
|
}
|
|
690
665
|
},
|
|
691
666
|
async saveContragent(user: Member, whichForm: keyof typeof StoreMembers | 'contragent', whichIndex: number | null, onlySaveAction: boolean = true) {
|
|
692
|
-
if (this.isGons && user.iin && whichForm === 'beneficiaryForm'
|
|
693
|
-
const doesHaveActiveContract = await this.api.
|
|
667
|
+
if (this.isGons && user.iin && whichForm === 'beneficiaryForm') {
|
|
668
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesActualPolicy(String(this.formStore.applicationData.processInstanceId));
|
|
694
669
|
if (doesHaveActiveContract) {
|
|
695
670
|
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
696
671
|
return false;
|
|
@@ -727,7 +702,7 @@ export const useDataStore = defineStore('data', {
|
|
|
727
702
|
const contragentData: Types.ContragentType = {
|
|
728
703
|
id: Number(user.id),
|
|
729
704
|
type: Number(user.type),
|
|
730
|
-
iin: user.iin
|
|
705
|
+
iin: user.iin ? user.iin.replace(/-/g, '') : '',
|
|
731
706
|
longName: user.longName !== null ? user.longName : (user.lastName ?? '') + (user.firstName ?? '') + (user.middleName ?? ''),
|
|
732
707
|
lastName: user.lastName ?? '',
|
|
733
708
|
firstName: user.firstName ?? '',
|
|
@@ -881,6 +856,11 @@ export const useDataStore = defineStore('data', {
|
|
|
881
856
|
verifyType: user.verifyType,
|
|
882
857
|
verifyDate: user.verifyDate,
|
|
883
858
|
};
|
|
859
|
+
if (user.documentIssuers.ids === '1') {
|
|
860
|
+
userDocument.issuerOtherName = user.documentIssuers.issuerOtherName;
|
|
861
|
+
userDocument.issuerOtherNameOrig = user.documentIssuers.issuerOtherNameOrig;
|
|
862
|
+
userDocument.issuerOtherNameRu = user.documentIssuers.issuerOtherNameRu;
|
|
863
|
+
}
|
|
884
864
|
if (hasAlreadyDocument !== -1) {
|
|
885
865
|
documentsData[hasAlreadyDocument] = userDocument;
|
|
886
866
|
} else {
|
|
@@ -954,7 +934,12 @@ export const useDataStore = defineStore('data', {
|
|
|
954
934
|
isTerror: member.isTerror,
|
|
955
935
|
isIpdlCompliance: null,
|
|
956
936
|
isTerrorCompliance: null,
|
|
937
|
+
fromService: this.isGons && whichMember === 'Beneficiary' ? (member.chooseChild === 'Добавить выгодоприобретателя' ? false : true) : true,
|
|
957
938
|
};
|
|
939
|
+
|
|
940
|
+
if (this.isPension && memberFromApplicaiton && memberFromApplicaiton.processInstanceId === this.formStore.applicationData.slave?.processInstanceId) {
|
|
941
|
+
data.processInstanceId = this.formStore.applicationData.slave.processInstanceId;
|
|
942
|
+
}
|
|
958
943
|
data.id = memberFromApplicaiton && memberFromApplicaiton.id ? memberFromApplicaiton.id : null;
|
|
959
944
|
if (whichMember === 'Client') {
|
|
960
945
|
data.isInsured = this.formStore.isPolicyholderInsured;
|
|
@@ -964,6 +949,12 @@ export const useDataStore = defineStore('data', {
|
|
|
964
949
|
data.jobName = member.jobPlace;
|
|
965
950
|
data.positionCode = member.positionCode;
|
|
966
951
|
data.familyStatusId = member.familyStatus.id;
|
|
952
|
+
if (this.isPension) {
|
|
953
|
+
data.id =
|
|
954
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
955
|
+
? this.formStore.applicationData.clientApp.id
|
|
956
|
+
: this.formStore.applicationData.slave.clientApp.id;
|
|
957
|
+
}
|
|
967
958
|
}
|
|
968
959
|
if (whichMember === 'Spokesman') {
|
|
969
960
|
if (!!memberFromApplicaiton && memberFromApplicaiton.iin !== data.iin) {
|
|
@@ -1022,6 +1013,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1022
1013
|
data.familyStatusId = member.familyStatus.id;
|
|
1023
1014
|
data.relationId = member.relationDegree.ids;
|
|
1024
1015
|
data.relationName = member.relationDegree.nameRu;
|
|
1016
|
+
if (this.isPension) {
|
|
1017
|
+
data.id =
|
|
1018
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
1019
|
+
? this.formStore.applicationData.insuredApp[0].id
|
|
1020
|
+
: this.formStore.applicationData.slave.insuredApp[0].id;
|
|
1021
|
+
}
|
|
1025
1022
|
}
|
|
1026
1023
|
if (whichMember === 'Beneficiary') {
|
|
1027
1024
|
if (
|
|
@@ -1066,10 +1063,20 @@ export const useDataStore = defineStore('data', {
|
|
|
1066
1063
|
}
|
|
1067
1064
|
}
|
|
1068
1065
|
},
|
|
1069
|
-
async setApplication(applicationData:
|
|
1066
|
+
async setApplication(applicationData: any, calculate: boolean = false) {
|
|
1070
1067
|
try {
|
|
1071
1068
|
this.isLoading = true;
|
|
1072
1069
|
this.isButtonsLoading = true;
|
|
1070
|
+
if (this.isPension) {
|
|
1071
|
+
applicationData.transferContractCompany = '';
|
|
1072
|
+
if (applicationData.slave) {
|
|
1073
|
+
applicationData.slave.guaranteedPeriod = applicationData.slave.guaranteedPeriod ?? 0;
|
|
1074
|
+
applicationData.slave.transferContractCompany = '';
|
|
1075
|
+
}
|
|
1076
|
+
if (Number(this.formStore.applicationData.processCode) === 24) {
|
|
1077
|
+
applicationData.transferContractAmount = applicationData.parentContractAmount - applicationData.refundAmount;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1073
1080
|
await this.api.setApplication(applicationData);
|
|
1074
1081
|
if (calculate) {
|
|
1075
1082
|
await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
|
|
@@ -1124,6 +1131,22 @@ export const useDataStore = defineStore('data', {
|
|
|
1124
1131
|
conditionsData.policyAppDto.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1125
1132
|
conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
|
|
1126
1133
|
}
|
|
1134
|
+
if (this.isGons) {
|
|
1135
|
+
conditionsData.policyAppDto.premiumInCurrency =
|
|
1136
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1137
|
+
conditionsData.policyAppDto.amountInCurrency =
|
|
1138
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1139
|
+
conditionsData.policyAppDto.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1140
|
+
conditionsData.policyAppDto.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1141
|
+
//@ts-ignore
|
|
1142
|
+
if (isNaN(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, ''))) {
|
|
1143
|
+
conditionsData.policyAppDto.amount = parseFloat(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, '').replace(',', '.'));
|
|
1144
|
+
}
|
|
1145
|
+
//@ts-ignore
|
|
1146
|
+
if (isNaN(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, ''))) {
|
|
1147
|
+
conditionsData.policyAppDto.premium = parseFloat(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, '').replace(',', '.'));
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1127
1150
|
if (this.isLiferenta) {
|
|
1128
1151
|
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1129
1152
|
conditionsData.policyAppDto.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1210,8 +1233,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1210
1233
|
}
|
|
1211
1234
|
if (value !== null && this.formStore.definedAnswersId[whichSurvey][filter].length) {
|
|
1212
1235
|
const answer = this.formStore.definedAnswersId[whichSurvey][filter].find((answer: any) => answer.nameRu.match(new RegExp(value, 'i')));
|
|
1213
|
-
|
|
1214
|
-
|
|
1236
|
+
if (this.formStore[whichSurvey]) {
|
|
1237
|
+
//@ts-ignore
|
|
1238
|
+
this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
|
|
1239
|
+
}
|
|
1215
1240
|
}
|
|
1216
1241
|
return this.formStore.definedAnswersId[whichSurvey];
|
|
1217
1242
|
},
|
|
@@ -1243,6 +1268,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1243
1268
|
regionPolicyName: this.formStore.RegionPolicy.nameRu ?? '',
|
|
1244
1269
|
managerPolicy: this.formStore.ManagerPolicy.ids as string,
|
|
1245
1270
|
managerPolicyName: this.formStore.ManagerPolicy.nameRu ?? '',
|
|
1271
|
+
executorGPH: (this.formStore.ExecutorGPH.ids as string) ?? undefined,
|
|
1272
|
+
executorGPHName: this.formStore.ExecutorGPH.nameRu ?? undefined,
|
|
1246
1273
|
insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
|
|
1247
1274
|
};
|
|
1248
1275
|
try {
|
|
@@ -1333,7 +1360,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1333
1360
|
if (this.isLifetrip) return await this.getFromApi('dicAllCountries', 'getArmDicts', 'DicCountry');
|
|
1334
1361
|
},
|
|
1335
1362
|
async getDicTripType() {
|
|
1336
|
-
if (this.isLifetrip) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
|
|
1363
|
+
if (this.isLifetrip || this.isCalculator) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
|
|
1337
1364
|
},
|
|
1338
1365
|
async getDicTripPurpose() {
|
|
1339
1366
|
if (this.isLifetrip) return await this.getFromApi('purposes', 'getArmDicts', 'DicTripPurpose');
|
|
@@ -1455,7 +1482,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1455
1482
|
return await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1456
1483
|
},
|
|
1457
1484
|
async getEconomicActivityType() {
|
|
1458
|
-
|
|
1485
|
+
const makeCall = this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension || this.isCritical;
|
|
1486
|
+
if (makeCall) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
|
|
1459
1487
|
},
|
|
1460
1488
|
async getFamilyStatuses() {
|
|
1461
1489
|
return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
|
|
@@ -1467,48 +1495,53 @@ export const useDataStore = defineStore('data', {
|
|
|
1467
1495
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1468
1496
|
},
|
|
1469
1497
|
async getBanks() {
|
|
1470
|
-
|
|
1498
|
+
const makeCall = this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO || this.isCritical;
|
|
1499
|
+
if (makeCall) return await this.getFromApi('banks', 'getBanks');
|
|
1471
1500
|
},
|
|
1472
1501
|
async getInsuranceCompanies() {
|
|
1473
1502
|
if (this.isPension) return await this.getFromApi('transferContractCompanies', 'getInsuranceCompanies');
|
|
1474
1503
|
},
|
|
1475
1504
|
async getProcessIndexRate() {
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
}
|
|
1505
|
+
const makeCall = (this.isBaiterek || this.isBolashak || this.isGons || this.isCalculator) && this.processCode;
|
|
1506
|
+
if (makeCall) return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
1479
1507
|
},
|
|
1480
1508
|
async getProcessPaymentPeriod() {
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1509
|
+
const makeCall = !this.isPension && this.processCode;
|
|
1510
|
+
if (makeCall) return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
|
|
1511
|
+
},
|
|
1512
|
+
async getProgramType() {
|
|
1513
|
+
const makeCall = this.isCritical && this.processCode;
|
|
1514
|
+
if (makeCall) return await this.getFromApi('programType', 'getProgramType', this.processCode);
|
|
1484
1515
|
},
|
|
1485
1516
|
async getQuestionRefs(id?: string) {
|
|
1486
1517
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1487
1518
|
},
|
|
1488
|
-
async getProcessTariff() {
|
|
1489
|
-
if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
|
|
1490
|
-
},
|
|
1491
1519
|
async getDicAnnuityTypeList() {
|
|
1492
1520
|
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
1493
1521
|
},
|
|
1494
1522
|
async getProcessAnnuityPaymentPeriod() {
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
}
|
|
1523
|
+
const makeCall = (this.isLiferenta || this.isCalculator) && this.processCode;
|
|
1524
|
+
if (makeCall) return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
|
|
1498
1525
|
},
|
|
1499
1526
|
async getInsurancePay() {
|
|
1500
1527
|
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
1501
1528
|
},
|
|
1502
1529
|
async getProcessGfot() {
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1530
|
+
const makeCall = (this.isLifeBusiness || this.isGns) && this.processCode;
|
|
1531
|
+
if (makeCall) return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
|
|
1532
|
+
},
|
|
1533
|
+
async getSource() {
|
|
1534
|
+
return await this.getFromApi('Source', 'getSource');
|
|
1506
1535
|
},
|
|
1507
1536
|
async getCurrencies() {
|
|
1508
1537
|
try {
|
|
1509
|
-
const
|
|
1510
|
-
|
|
1511
|
-
|
|
1538
|
+
const makeCall = !this.isLKA && !this.isLKA_A;
|
|
1539
|
+
if (makeCall) {
|
|
1540
|
+
const currencies = await this.api.getCurrencies();
|
|
1541
|
+
this.currencies = currencies;
|
|
1542
|
+
return currencies;
|
|
1543
|
+
}
|
|
1544
|
+
return null;
|
|
1512
1545
|
} catch (err) {
|
|
1513
1546
|
console.log(err);
|
|
1514
1547
|
}
|
|
@@ -1521,7 +1554,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1521
1554
|
return this.gender;
|
|
1522
1555
|
},
|
|
1523
1556
|
async getAuthorityBasis() {
|
|
1524
|
-
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension
|
|
1557
|
+
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension || this.isCritical)
|
|
1558
|
+
return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
|
|
1525
1559
|
},
|
|
1526
1560
|
async getWorkPosition(search: string) {
|
|
1527
1561
|
try {
|
|
@@ -1549,8 +1583,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1549
1583
|
this.getFamilyStatuses(),
|
|
1550
1584
|
this.getRelationTypes(),
|
|
1551
1585
|
this.getProcessIndexRate(),
|
|
1552
|
-
this.getProcessTariff(),
|
|
1553
1586
|
this.getProcessPaymentPeriod(),
|
|
1587
|
+
this.getProgramType(),
|
|
1554
1588
|
this.getDicFileTypeList(),
|
|
1555
1589
|
this.getDicAnnuityTypeList(),
|
|
1556
1590
|
this.getProcessAnnuityPaymentPeriod(),
|
|
@@ -1564,6 +1598,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1564
1598
|
this.getDicTripPurpose(),
|
|
1565
1599
|
this.getCurrencies(),
|
|
1566
1600
|
this.getProcessGfot(),
|
|
1601
|
+
this.getSource(),
|
|
1567
1602
|
this.getBanks(),
|
|
1568
1603
|
this.getInsuranceCompanies(),
|
|
1569
1604
|
this.getEconomicActivityType(),
|
|
@@ -1592,16 +1627,19 @@ export const useDataStore = defineStore('data', {
|
|
|
1592
1627
|
if (secondaryQuestions.status === 'fulfilled') {
|
|
1593
1628
|
const baseAnketa = this.formStore[baseField];
|
|
1594
1629
|
if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1630
|
+
const isSpecialSurvey = this.isBaiterek || this.isBolashak || this.isLiferenta;
|
|
1631
|
+
for (const i of baseAnketa.body) {
|
|
1632
|
+
if (i.second === null && secondaryQuestions.value) {
|
|
1633
|
+
i.second = isSpecialSurvey
|
|
1634
|
+
? await this.api.getQuestionListSecondById(`${surveyType}second`, processInstanceId, insuredId, i.first.id)
|
|
1635
|
+
: structuredClone(secondaryQuestions.value);
|
|
1598
1636
|
}
|
|
1599
1637
|
if (i.first.definedAnswers === 'Y' && i.second && i.second.length) {
|
|
1600
1638
|
i.second.forEach(second => {
|
|
1601
1639
|
if (second.answerType === 'D') second.answerText = reformatDate(String(second.answerText));
|
|
1602
1640
|
});
|
|
1603
1641
|
}
|
|
1604
|
-
}
|
|
1642
|
+
}
|
|
1605
1643
|
}
|
|
1606
1644
|
}
|
|
1607
1645
|
} catch (err) {
|
|
@@ -1659,16 +1697,16 @@ export const useDataStore = defineStore('data', {
|
|
|
1659
1697
|
column: column,
|
|
1660
1698
|
direction: direction,
|
|
1661
1699
|
groupCode: groupCode,
|
|
1662
|
-
processCodes:
|
|
1700
|
+
processCodes: this.isEFO
|
|
1701
|
+
? Object.values(constants.products).filter(
|
|
1702
|
+
i => i !== constants.products.pensionannuity && i !== constants.products.pensionannuityrefund && i !== constants.products.pensionannuityjoint,
|
|
1703
|
+
)
|
|
1704
|
+
: [constants.products.baiterek],
|
|
1663
1705
|
};
|
|
1664
1706
|
if (byOneProcess !== null) {
|
|
1665
1707
|
delete query.processCodes;
|
|
1666
1708
|
query.processCode = byOneProcess;
|
|
1667
1709
|
}
|
|
1668
|
-
if (byOneProcess === 19 && !useEnv().isProduction) {
|
|
1669
|
-
query.processCodes = [19, 2];
|
|
1670
|
-
delete query.processCode;
|
|
1671
|
-
}
|
|
1672
1710
|
const taskList = await this.api.getTaskList(
|
|
1673
1711
|
processInstanceId === null
|
|
1674
1712
|
? query
|
|
@@ -1782,6 +1820,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1782
1820
|
console.log(err);
|
|
1783
1821
|
}
|
|
1784
1822
|
},
|
|
1823
|
+
async filterExecutorByRegion(filterName: string) {
|
|
1824
|
+
try {
|
|
1825
|
+
this.ExecutorGPH = await this.api.filterExecutorByRegion('ExecutorGPH', filterName);
|
|
1826
|
+
} catch (err) {
|
|
1827
|
+
console.log(err);
|
|
1828
|
+
}
|
|
1829
|
+
},
|
|
1785
1830
|
async getUnderwritingCouncilData(id: string | number) {
|
|
1786
1831
|
try {
|
|
1787
1832
|
const response: any = await this.api.getUnderwritingCouncilData(id);
|
|
@@ -1804,7 +1849,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1804
1849
|
async getDefaultCalculationData(showLoader: boolean = false, product: string | null = null) {
|
|
1805
1850
|
this.isLoading = showLoader;
|
|
1806
1851
|
try {
|
|
1807
|
-
const calculationData = await this.api.getDefaultCalculationData(
|
|
1852
|
+
const calculationData = await this.api.getDefaultCalculationData(
|
|
1853
|
+
this.isCalculator ? product : undefined,
|
|
1854
|
+
this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns' ? Number(this.processCode) : undefined,
|
|
1855
|
+
);
|
|
1808
1856
|
return calculationData;
|
|
1809
1857
|
} catch (err) {
|
|
1810
1858
|
ErrorHandler(err);
|
|
@@ -1892,6 +1940,23 @@ export const useDataStore = defineStore('data', {
|
|
|
1892
1940
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1893
1941
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1894
1942
|
}
|
|
1943
|
+
if (this.isGons || product === 'gons') {
|
|
1944
|
+
calculationData.premiumInCurrency =
|
|
1945
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1946
|
+
calculationData.amountInCurrency =
|
|
1947
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1948
|
+
calculationData.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1949
|
+
|
|
1950
|
+
calculationData.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1951
|
+
//@ts-ignore
|
|
1952
|
+
if (isNaN(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, ''))) {
|
|
1953
|
+
calculationData.amount = parseFloat(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, '').replace(',', '.'));
|
|
1954
|
+
}
|
|
1955
|
+
//@ts-ignore
|
|
1956
|
+
if (isNaN(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, ''))) {
|
|
1957
|
+
calculationData.premium = parseFloat(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, '').replace(',', '.'));
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1895
1960
|
if (this.isLiferenta || product === 'liferenta') {
|
|
1896
1961
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1897
1962
|
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1909,11 +1974,20 @@ export const useDataStore = defineStore('data', {
|
|
|
1909
1974
|
calculationData.contractEndDate = formatDate(this.formStore.productConditionsForm.contractEndDate as string)!.toISOString();
|
|
1910
1975
|
calculationData.calcDate = formatDate(this.formStore.productConditionsForm.calcDate as string)!.toISOString();
|
|
1911
1976
|
}
|
|
1912
|
-
const calculationResponse = await this.api.calculateWithoutApplication(
|
|
1913
|
-
|
|
1914
|
-
|
|
1977
|
+
const calculationResponse = await this.api.calculateWithoutApplication(
|
|
1978
|
+
calculationData,
|
|
1979
|
+
this.isCalculator ? product : undefined,
|
|
1980
|
+
this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns' ? Number(this.processCode) : undefined,
|
|
1981
|
+
);
|
|
1982
|
+
if (calculationResponse.amount)
|
|
1983
|
+
this.formStore.productConditionsForm.requestedSumInsured =
|
|
1984
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.amount) : this.getNumberWithSpaces(calculationResponse.amount);
|
|
1985
|
+
if (calculationResponse.premium)
|
|
1986
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
1987
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.premium) : this.getNumberWithSpaces(calculationResponse.premium);
|
|
1988
|
+
|
|
1915
1989
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1916
|
-
if (this.isKazyna || product === 'halykkazyna') {
|
|
1990
|
+
if (this.isKazyna || product === 'halykkazyna' || this.isGons || product === 'gons') {
|
|
1917
1991
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1918
1992
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
|
|
1919
1993
|
} else {
|
|
@@ -1930,7 +2004,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1930
2004
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
|
|
1931
2005
|
}
|
|
1932
2006
|
if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
|
|
1933
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2007
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(calculationResponse.mainPremiumWithCommission as number);
|
|
1934
2008
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.mainInsSum === 0 ? null : calculationResponse.mainInsSum);
|
|
1935
2009
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1936
2010
|
if (calculationResponse.agentCommission) {
|
|
@@ -1950,17 +2024,23 @@ export const useDataStore = defineStore('data', {
|
|
|
1950
2024
|
return !!this.formStore.productConditionsForm.requestedSumInsured && !!this.formStore.productConditionsForm.insurancePremiumPerMonth;
|
|
1951
2025
|
}
|
|
1952
2026
|
},
|
|
1953
|
-
async calculate(taskId: string) {
|
|
2027
|
+
async calculate(taskId: string, isHalykBank: boolean = false) {
|
|
1954
2028
|
this.isLoading = true;
|
|
1955
2029
|
try {
|
|
1956
2030
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1957
|
-
if (!this.isPension) await this.api.setApplication(this.getConditionsData());
|
|
2031
|
+
if (!this.isPension && !(this.formStore.lfb.add && (this.isLifeBusiness || this.isGns))) await this.api.setApplication(this.getConditionsData());
|
|
1958
2032
|
const result = ref();
|
|
1959
|
-
|
|
1960
|
-
|
|
2033
|
+
let applicationData = null;
|
|
2034
|
+
if (!isHalykBank) result.value = await this.api.getCalculation(String(id));
|
|
2035
|
+
if (this.isLifeBusiness || this.isGns) {
|
|
2036
|
+
await this.getApplicationDataV2(taskId);
|
|
2037
|
+
return;
|
|
2038
|
+
} else {
|
|
2039
|
+
applicationData = await this.api.getApplicationData(taskId);
|
|
2040
|
+
}
|
|
1961
2041
|
this.formStore.applicationData = applicationData;
|
|
1962
2042
|
if (this.formStore.applicationData.addCoverDto) this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1963
|
-
if (this.isKazyna && this.currencies.usd) {
|
|
2043
|
+
if ((this.isKazyna || this.isGons) && this.currencies.usd) {
|
|
1964
2044
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1965
2045
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
|
|
1966
2046
|
} else {
|
|
@@ -1968,11 +2048,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1968
2048
|
}
|
|
1969
2049
|
}
|
|
1970
2050
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
|
|
1971
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
1972
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2051
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
2052
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
2053
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium)
|
|
2054
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium);
|
|
1973
2055
|
} else {
|
|
1974
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1975
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.
|
|
2056
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
2057
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2058
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount)
|
|
2059
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount);
|
|
1976
2060
|
}
|
|
1977
2061
|
if (this.isLiferenta) {
|
|
1978
2062
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
@@ -1985,11 +2069,22 @@ export const useDataStore = defineStore('data', {
|
|
|
1985
2069
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
1986
2070
|
}
|
|
1987
2071
|
if (this.isLifeBusiness || this.isGns) {
|
|
1988
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2072
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(result.value);
|
|
1989
2073
|
if (applicationData.insuredApp && applicationData.insuredApp.length) {
|
|
1990
2074
|
const res = await this.newInsuredList(applicationData.insuredApp);
|
|
1991
2075
|
this.formStore.lfb.clients = res;
|
|
1992
2076
|
}
|
|
2077
|
+
if (this.formStore.lfb.add) {
|
|
2078
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium);
|
|
2079
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount);
|
|
2080
|
+
if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
|
|
2081
|
+
this.formStore.productConditionsForm.amountPaid = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
2082
|
+
this.formStore.productConditionsForm.amountRefunded = null;
|
|
2083
|
+
} else {
|
|
2084
|
+
this.formStore.productConditionsForm.amountRefunded = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
2085
|
+
this.formStore.productConditionsForm.amountPaid = null;
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
1993
2088
|
}
|
|
1994
2089
|
|
|
1995
2090
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
@@ -1998,6 +2093,68 @@ export const useDataStore = defineStore('data', {
|
|
|
1998
2093
|
}
|
|
1999
2094
|
this.isLoading = false;
|
|
2000
2095
|
},
|
|
2096
|
+
async reCalculateRefund(insSum: number, insSumMain: number, guaranteedPeriod: number, isOppv: boolean, transferContractMonthCount: number | null) {
|
|
2097
|
+
this.isLoading = true;
|
|
2098
|
+
try {
|
|
2099
|
+
const data = {
|
|
2100
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2101
|
+
insSum: insSum,
|
|
2102
|
+
insSumMain: insSumMain,
|
|
2103
|
+
guaranteedPeriod: guaranteedPeriod,
|
|
2104
|
+
isOppv: isOppv,
|
|
2105
|
+
transferContractMonthCount: transferContractMonthCount,
|
|
2106
|
+
};
|
|
2107
|
+
const response = await this.api.pensionannuityNew.reCalculateRefund(data);
|
|
2108
|
+
} catch (err) {
|
|
2109
|
+
ErrorHandler(err);
|
|
2110
|
+
}
|
|
2111
|
+
this.isLoading = false;
|
|
2112
|
+
},
|
|
2113
|
+
async getDividendSchedule() {
|
|
2114
|
+
this.isLoading = true;
|
|
2115
|
+
try {
|
|
2116
|
+
const response = await this.api.pensionannuityNew.getDividendSchedule(this.formStore.applicationData.processInstanceId);
|
|
2117
|
+
return response;
|
|
2118
|
+
} catch (err) {
|
|
2119
|
+
ErrorHandler(err);
|
|
2120
|
+
return {
|
|
2121
|
+
scheduleDividend: null,
|
|
2122
|
+
scheduleDividend2: null,
|
|
2123
|
+
};
|
|
2124
|
+
} finally {
|
|
2125
|
+
this.isLoading = false;
|
|
2126
|
+
}
|
|
2127
|
+
},
|
|
2128
|
+
async setOppvCount(data: any) {
|
|
2129
|
+
this.isLoading = true;
|
|
2130
|
+
try {
|
|
2131
|
+
const response = await this.api.pensionannuityNew.setOppvCount(this.formStore.applicationData.processInstanceId as string, data);
|
|
2132
|
+
if (response.oppvCount === 0 && response.errocCode !== 0) {
|
|
2133
|
+
return ErrorHandler(response.errorMsg);
|
|
2134
|
+
} else {
|
|
2135
|
+
return response.oppvCount;
|
|
2136
|
+
}
|
|
2137
|
+
} catch (err) {
|
|
2138
|
+
return ErrorHandler(err);
|
|
2139
|
+
} finally {
|
|
2140
|
+
this.isLoading = false;
|
|
2141
|
+
}
|
|
2142
|
+
},
|
|
2143
|
+
async calcParentContractSums(closeContractCompanyCode: string, closeContractCompanyName: string, isContractClosed: boolean) {
|
|
2144
|
+
this.isLoading = true;
|
|
2145
|
+
try {
|
|
2146
|
+
const data = {
|
|
2147
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2148
|
+
closeContractCompanyCode: closeContractCompanyCode,
|
|
2149
|
+
closeContractCompanyName: closeContractCompanyName,
|
|
2150
|
+
isContractClosed: isContractClosed,
|
|
2151
|
+
};
|
|
2152
|
+
const response = await this.api.pensionannuityNew.calcParentContractSums(data);
|
|
2153
|
+
} catch (err) {
|
|
2154
|
+
ErrorHandler(err);
|
|
2155
|
+
}
|
|
2156
|
+
this.isLoading = false;
|
|
2157
|
+
},
|
|
2001
2158
|
async calculatePremium(data: any) {
|
|
2002
2159
|
this.isLoading = true;
|
|
2003
2160
|
try {
|
|
@@ -2084,11 +2241,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2084
2241
|
this.isLoading = onlyGet;
|
|
2085
2242
|
try {
|
|
2086
2243
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
2087
|
-
if (this.processCode !== applicationData.processCode && !this.isPension) {
|
|
2088
|
-
this.isLoading = false;
|
|
2089
|
-
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
|
|
2090
|
-
return;
|
|
2091
|
-
}
|
|
2092
2244
|
this.formStore.regNumber = applicationData.regNumber;
|
|
2093
2245
|
this.formStore.applicationData = applicationData;
|
|
2094
2246
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
@@ -2099,13 +2251,23 @@ export const useDataStore = defineStore('data', {
|
|
|
2099
2251
|
this.formStore.RegionPolicy.ids = applicationData.insisWorkDataApp.regionPolicy;
|
|
2100
2252
|
this.formStore.ManagerPolicy.nameRu = applicationData.insisWorkDataApp.managerPolicyName;
|
|
2101
2253
|
this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
|
|
2254
|
+
this.formStore.ExecutorGPH.nameRu = applicationData.insisWorkDataApp.executorGPHName;
|
|
2255
|
+
this.formStore.ExecutorGPH.ids = applicationData.insisWorkDataApp.executorGPH;
|
|
2102
2256
|
this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
|
|
2103
2257
|
this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
|
|
2104
2258
|
this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
|
|
2105
2259
|
this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
|
|
2260
|
+
if ('sourceId' in applicationData.insisWorkDataApp && applicationData.insisWorkDataApp.sourceId !== null) {
|
|
2261
|
+
const source = this.Source.find((i: Value) => i.id === applicationData.insisWorkDataApp.sourceId);
|
|
2262
|
+
this.formStore.Source = source ? source : new Value();
|
|
2263
|
+
} else {
|
|
2264
|
+
const sourceEfo = this.Source.find((i: Value) => i.id === '3f9e5327-328c-4bc7-8d28-fa25c36ba153');
|
|
2265
|
+
this.formStore.Source = sourceEfo ? sourceEfo : new Value();
|
|
2266
|
+
}
|
|
2106
2267
|
|
|
2107
2268
|
const clientData = applicationData.clientApp;
|
|
2108
2269
|
const insuredData: any[] = applicationData.insuredApp;
|
|
2270
|
+
const slaveInsuredData: any = applicationData.slave?.insuredApp[0] ?? null;
|
|
2109
2271
|
const beneficiaryData: any[] = applicationData.beneficiaryApp;
|
|
2110
2272
|
const beneficialOwnerData: any[] = applicationData.beneficialOwnerApp;
|
|
2111
2273
|
const spokesmanData: any = applicationData.spokesmanApp;
|
|
@@ -2119,6 +2281,21 @@ export const useDataStore = defineStore('data', {
|
|
|
2119
2281
|
this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
|
|
2120
2282
|
}
|
|
2121
2283
|
|
|
2284
|
+
if ('pensionApp' in applicationData && applicationData.pensionApp) {
|
|
2285
|
+
this.formStore.pensionApp = applicationData.pensionApp;
|
|
2286
|
+
if ('slave' in applicationData && applicationData.slave) this.formStore.pensionApp.slave = applicationData.slave.pensionApp;
|
|
2287
|
+
if (setProductConditions) {
|
|
2288
|
+
const pensionKeysWithSpace = ['compulsoryContractAmount', 'compulsoryProfContractAmount', 'voluntaryContractAmount', 'ownFundsRaisAmount'];
|
|
2289
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2290
|
+
if (/\s/g.test(this.formStore.pensionApp[key]) === false) this.formStore.pensionApp[key] = this.getNumberWithSpaces(this.formStore.pensionApp[key]);
|
|
2291
|
+
});
|
|
2292
|
+
if (this.formStore.pensionApp.slave)
|
|
2293
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2294
|
+
if (/\s/g.test(this.formStore.pensionApp.slave[key]) === false)
|
|
2295
|
+
this.formStore.pensionApp.slave[key] = this.getNumberWithSpaces(this.formStore.pensionApp.slave[key]);
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2122
2299
|
if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
|
|
2123
2300
|
this.formStore.finCenterData = applicationData.finCenterData;
|
|
2124
2301
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
@@ -2183,11 +2360,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2183
2360
|
index: null,
|
|
2184
2361
|
});
|
|
2185
2362
|
}
|
|
2186
|
-
|
|
2187
|
-
if (applicationData.slave) {
|
|
2188
|
-
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
2363
|
if (insuredData && insuredData.length) {
|
|
2192
2364
|
insuredData.forEach((member, index) => {
|
|
2193
2365
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -2201,6 +2373,13 @@ export const useDataStore = defineStore('data', {
|
|
|
2201
2373
|
}
|
|
2202
2374
|
});
|
|
2203
2375
|
}
|
|
2376
|
+
if (slaveInsuredData) {
|
|
2377
|
+
allMembers.push({
|
|
2378
|
+
...slaveInsuredData,
|
|
2379
|
+
key: 'slaveInsuredForm',
|
|
2380
|
+
index: null,
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2204
2383
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2205
2384
|
beneficiaryData.forEach((member, index) => {
|
|
2206
2385
|
const inStore = this.formStore.beneficiaryForm.find(each => each.id == member.insisId);
|
|
@@ -2238,18 +2417,23 @@ export const useDataStore = defineStore('data', {
|
|
|
2238
2417
|
this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
|
|
2239
2418
|
if (insuredData && insuredData.length) {
|
|
2240
2419
|
insuredData.forEach((each, index) => {
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2420
|
+
if (each) {
|
|
2421
|
+
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
2422
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
2423
|
+
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
2424
|
+
}
|
|
2244
2425
|
});
|
|
2245
2426
|
}
|
|
2246
|
-
|
|
2427
|
+
if (slaveInsuredData) this.setMembersFieldSlave();
|
|
2247
2428
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2248
2429
|
beneficiaryData.forEach((each, index) => {
|
|
2249
2430
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
2250
2431
|
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
2251
2432
|
this.formStore.beneficiaryForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
2252
2433
|
this.formStore.beneficiaryForm[index].percentageOfPayoutAmount = each.percentage;
|
|
2434
|
+
if (this.isGons) {
|
|
2435
|
+
this.formStore.beneficiaryForm[index].chooseChild = each.fromService === false ? 'Добавить выгодоприобретателя' : each.longName;
|
|
2436
|
+
}
|
|
2253
2437
|
if (this.isLiferenta || this.isBolashak) {
|
|
2254
2438
|
const insurancePay = this.insurancePay.find((i: Value) => i.id == each.beneficiaryInsurancePayId);
|
|
2255
2439
|
this.formStore.beneficiaryForm[index].insurancePay = insurancePay ? insurancePay : new Value();
|
|
@@ -2321,15 +2505,32 @@ export const useDataStore = defineStore('data', {
|
|
|
2321
2505
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
2322
2506
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
2323
2507
|
|
|
2324
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.
|
|
2325
|
-
applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount
|
|
2326
|
-
|
|
2327
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2328
|
-
applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium
|
|
2329
|
-
|
|
2330
|
-
|
|
2508
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2509
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount)
|
|
2510
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount);
|
|
2511
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
2512
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium)
|
|
2513
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium);
|
|
2514
|
+
|
|
2515
|
+
if (this.isGons) {
|
|
2516
|
+
const govPremiums = await this.api.getGovernmentPremiums(String(this.formStore.applicationData.processInstanceId));
|
|
2517
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
|
|
2518
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
|
|
2519
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
|
|
2520
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
2521
|
+
const currency = constants.currencyList.find(item => item.code === applicationData.policyAppDto.currency);
|
|
2522
|
+
this.formStore.productConditionsForm.currency = currency ? currency : new Value();
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
if (this.isKazyna || this.isGons) {
|
|
2331
2526
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
|
|
2332
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
|
|
2527
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
|
|
2528
|
+
this.formStore.applicationData.processCode === constants.products.halykkazynaap
|
|
2529
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premiumInCurrency)
|
|
2530
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
|
|
2531
|
+
if (applicationData.policyAppDto.currency === 'USD' && applicationData.policyAppDto.amount !== null && applicationData.policyAppDto.premium !== null) {
|
|
2532
|
+
this.currencies.usd = applicationData.policyAppDto.currencyExchangeRate;
|
|
2533
|
+
}
|
|
2333
2534
|
}
|
|
2334
2535
|
const riskGroup = this.riskGroup.find(item => {
|
|
2335
2536
|
if (applicationData.policyAppDto.riskGroup == 0) {
|
|
@@ -2410,6 +2611,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2410
2611
|
case constants.actions.signed:
|
|
2411
2612
|
case constants.actions.rejectclient:
|
|
2412
2613
|
case constants.actions.accept:
|
|
2614
|
+
case constants.actions.recalc:
|
|
2413
2615
|
case constants.actions.payed: {
|
|
2414
2616
|
try {
|
|
2415
2617
|
const sended = await this.sendTask(taskId, action, comment);
|
|
@@ -2463,9 +2665,14 @@ export const useDataStore = defineStore('data', {
|
|
|
2463
2665
|
}
|
|
2464
2666
|
},
|
|
2465
2667
|
async createInvoice() {
|
|
2466
|
-
|
|
2668
|
+
const premium =
|
|
2669
|
+
this.isLifeBusiness || this.isGns ? this.formStore.applicationData.policyAppDto?.mainPremiumWithCommission : this.formStore.applicationData.policyAppDto?.premium;
|
|
2670
|
+
if (!premium) {
|
|
2671
|
+
this.showToaster('error', this.t('toaster.notZeroPremium'));
|
|
2672
|
+
return;
|
|
2673
|
+
}
|
|
2467
2674
|
try {
|
|
2468
|
-
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId,
|
|
2675
|
+
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId, premium);
|
|
2469
2676
|
return !!created;
|
|
2470
2677
|
} catch (err) {
|
|
2471
2678
|
this.isLoading = false;
|
|
@@ -2498,14 +2705,43 @@ export const useDataStore = defineStore('data', {
|
|
|
2498
2705
|
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
|
|
2499
2706
|
this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2500
2707
|
}
|
|
2501
|
-
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.
|
|
2502
|
-
this.formStore[whichForm].bankInfo.iik = this.formStore.
|
|
2503
|
-
this.formStore[whichForm].bankInfo.bik = this.formStore.
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
this.formStore[whichForm].bankInfo.
|
|
2507
|
-
this.
|
|
2508
|
-
this.formStore.
|
|
2708
|
+
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.pensionApp) {
|
|
2709
|
+
this.formStore[whichForm].bankInfo.iik = this.formStore.pensionApp.account;
|
|
2710
|
+
this.formStore[whichForm].bankInfo.bik = this.formStore.pensionApp.bankBik;
|
|
2711
|
+
this.formStore[whichForm].bankInfo.bankName.id = this.formStore.pensionApp.bankId;
|
|
2712
|
+
this.formStore[whichForm].bankInfo.bankName.nameRu = this.formStore.pensionApp.bankName;
|
|
2713
|
+
this.formStore[whichForm].bankInfo.bin = reformatIin(this.formStore.pensionApp.bankBin);
|
|
2714
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.transferContractCompany);
|
|
2715
|
+
this.formStore.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2716
|
+
}
|
|
2717
|
+
},
|
|
2718
|
+
setMembersFieldSlave() {
|
|
2719
|
+
this.formStore.slaveInsuredForm.familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData.slave['insuredApp'].familyStatusId);
|
|
2720
|
+
this.formStore.slaveInsuredForm.signOfIPDL = this.findObject(
|
|
2721
|
+
'ipdl',
|
|
2722
|
+
'nameRu',
|
|
2723
|
+
this.formStore.applicationData.slave.insuredApp[0].isIpdl === null ? null : this.formStore.applicationData.slave.insuredApp[0].isIpdl == true ? 'Да' : 'Нет',
|
|
2724
|
+
);
|
|
2725
|
+
this.formStore.slaveInsuredForm.gotFromInsis = false;
|
|
2726
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].profession) this.formStore.slaveInsuredForm.job = this.formStore.applicationData.slave.insuredApp[0].profession;
|
|
2727
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].position) this.formStore.slaveInsuredForm.jobPosition = this.formStore.applicationData.slave.insuredApp[0].position;
|
|
2728
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].jobName) this.formStore.slaveInsuredForm.jobPlace = this.formStore.applicationData.slave.insuredApp[0].jobName;
|
|
2729
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].positionCode)
|
|
2730
|
+
this.formStore.slaveInsuredForm.positionCode = this.formStore.applicationData.slave.insuredApp[0].positionCode;
|
|
2731
|
+
if (typeof this.formStore.applicationData.slave.insuredApp[0].isDisability === 'boolean')
|
|
2732
|
+
this.formStore.slaveInsuredForm.isDisability = this.formStore.applicationData.slave.insuredApp[0].isDisability;
|
|
2733
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId) {
|
|
2734
|
+
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId);
|
|
2735
|
+
this.formStore.slaveInsuredForm.disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2736
|
+
}
|
|
2737
|
+
if (this.formStore.slaveInsuredForm.bankInfo) {
|
|
2738
|
+
this.formStore.slaveInsuredForm.bankInfo.iik = this.formStore.pensionApp.slave.account;
|
|
2739
|
+
this.formStore.slaveInsuredForm.bankInfo.bik = this.formStore.pensionApp.slave.bankBik;
|
|
2740
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.id = this.formStore.pensionApp.slave.bankId;
|
|
2741
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.nameRu = this.formStore.pensionApp.slave.bankName;
|
|
2742
|
+
this.formStore.slaveInsuredForm.bankInfo.bin = reformatIin(this.formStore.pensionApp.slave.bankBin);
|
|
2743
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.slave.transferContractCompany);
|
|
2744
|
+
this.formStore.pensionApp.slave.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2509
2745
|
}
|
|
2510
2746
|
},
|
|
2511
2747
|
setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
@@ -2602,94 +2838,17 @@ export const useDataStore = defineStore('data', {
|
|
|
2602
2838
|
};
|
|
2603
2839
|
const data = prepareSignDocuments();
|
|
2604
2840
|
if (type === 'qr') {
|
|
2605
|
-
const groupId = await this.api.signQR(data);
|
|
2841
|
+
const groupId = await this.api.file.signQR(data);
|
|
2606
2842
|
return groupId;
|
|
2607
2843
|
} else if (type === 'qrXml') {
|
|
2608
|
-
const signData = await this.api.signXml(data);
|
|
2844
|
+
const signData = await this.api.file.signXml(data);
|
|
2609
2845
|
return signData;
|
|
2610
|
-
} else if (type === 'signature') {
|
|
2611
|
-
const ncaLayerClient = new NCALayerClient();
|
|
2612
|
-
const formTemplate = new FormData();
|
|
2613
|
-
formTemplate.append('format', 'pdf');
|
|
2614
|
-
formTemplate.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2615
|
-
let activeTokens;
|
|
2616
|
-
try {
|
|
2617
|
-
await ncaLayerClient.connect();
|
|
2618
|
-
activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2619
|
-
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2620
|
-
if (this.formStore.applicationData.statusCode === 'ContractSignedFrom') {
|
|
2621
|
-
const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
|
|
2622
|
-
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2623
|
-
const formData = formTemplate;
|
|
2624
|
-
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2625
|
-
formData.append('name', 'PA_Contract');
|
|
2626
|
-
try {
|
|
2627
|
-
await this.api.uploadDigitalCertifijcate(formData);
|
|
2628
|
-
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2629
|
-
} catch (e) {
|
|
2630
|
-
this.showToaster('error', String(e));
|
|
2631
|
-
return;
|
|
2632
|
-
}
|
|
2633
|
-
} else if (this.formStore.applicationData.statusCode === 'HeadManagerForm') {
|
|
2634
|
-
const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
|
|
2635
|
-
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2636
|
-
const formData = formTemplate;
|
|
2637
|
-
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2638
|
-
formData.append('name', 'PA_Contract');
|
|
2639
|
-
try {
|
|
2640
|
-
await this.api.uploadDigitalCertificatePensionAnnuityNew(formData);
|
|
2641
|
-
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2642
|
-
} catch (e) {
|
|
2643
|
-
this.showToaster('error', String(e));
|
|
2644
|
-
return;
|
|
2645
|
-
}
|
|
2646
|
-
} else {
|
|
2647
|
-
if (!!this.formStore.signedDocumentList.find(i => i.fileTypeCode === '43')?.signed) {
|
|
2648
|
-
const statement = await this.generatePDFDocument('PA_Statement', '37', 'pdf');
|
|
2649
|
-
const statementSignature = await ncaLayerClient.basicsSignCMS(storageType, statement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2650
|
-
const statementData = formTemplate;
|
|
2651
|
-
statementData.append('base64EncodedSignature', statementSignature);
|
|
2652
|
-
statementData.append('name', 'PA_Statement');
|
|
2653
|
-
await this.api.uploadDigitalCertifijcate(statementData);
|
|
2654
|
-
const agreement = await this.generatePDFDocument('Agreement', '19', 'pdf');
|
|
2655
|
-
const agreementSignature = await ncaLayerClient.basicsSignCMS(storageType, agreement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2656
|
-
const agreementData = formTemplate;
|
|
2657
|
-
agreementData.append('base64EncodedSignature', agreementSignature);
|
|
2658
|
-
agreementData.append('name', 'Agreement');
|
|
2659
|
-
await this.api.uploadDigitalCertifijcate(agreementData);
|
|
2660
|
-
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2661
|
-
} else {
|
|
2662
|
-
const document = {
|
|
2663
|
-
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2664
|
-
name: 'PAEnpf_Agreement',
|
|
2665
|
-
format: 'xml',
|
|
2666
|
-
};
|
|
2667
|
-
const signData = await this.api.signXml([document]);
|
|
2668
|
-
const agreementXml = await this.api.getDocumentsByEdsXmlId(signData.data);
|
|
2669
|
-
const wnd = window.open('about:blank', '', '_blank');
|
|
2670
|
-
wnd?.document.write(agreementXml.data.document.documentXml);
|
|
2671
|
-
const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml.data.document.documentXml, 'SIGNATURE', '');
|
|
2672
|
-
const data = new FormData();
|
|
2673
|
-
data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2674
|
-
data.append('xmlData', signedAgreement);
|
|
2675
|
-
data.append('name', 'PAEnpf_Agreement');
|
|
2676
|
-
data.append('format', 'xml');
|
|
2677
|
-
data.append('EdsXmlId', signData.data);
|
|
2678
|
-
await this.api.uploadXml(data);
|
|
2679
|
-
await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
|
|
2680
|
-
this.showToaster('success', this.t('pension.consentGiven'), 3000);
|
|
2681
|
-
}
|
|
2682
|
-
}
|
|
2683
|
-
} catch (error) {
|
|
2684
|
-
this.showToaster('error', String(error));
|
|
2685
|
-
return;
|
|
2686
|
-
}
|
|
2687
2846
|
} else {
|
|
2688
|
-
if (this.processCode === 19 || this.processCode ===
|
|
2689
|
-
const result = await this.api.signBts(data);
|
|
2847
|
+
if (this.processCode === 19 || this.processCode === 24 || this.processCode === 25) {
|
|
2848
|
+
const result = await this.api.file.signBts(data);
|
|
2690
2849
|
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2691
2850
|
} else {
|
|
2692
|
-
const result = await this.api.signDocument(data);
|
|
2851
|
+
const result = await this.api.file.signDocument(data);
|
|
2693
2852
|
this.formStore.signUrls = result;
|
|
2694
2853
|
}
|
|
2695
2854
|
return this.formStore.signUrls;
|
|
@@ -2698,6 +2857,84 @@ export const useDataStore = defineStore('data', {
|
|
|
2698
2857
|
ErrorHandler(err);
|
|
2699
2858
|
}
|
|
2700
2859
|
},
|
|
2860
|
+
async nclayerSign(groupId: string, signType: number, isXml: boolean = false, processInstanceId?: string) {
|
|
2861
|
+
try {
|
|
2862
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2863
|
+
await ncaLayerClient.connect();
|
|
2864
|
+
const activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2865
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2866
|
+
const document = await this.getDocNew(groupId, signType, isXml);
|
|
2867
|
+
if (isXml) {
|
|
2868
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, document, 'SIGNATURE', '');
|
|
2869
|
+
const data = new FormData();
|
|
2870
|
+
data.append('processInstanceId', processInstanceId ?? String(this.formStore.applicationData.processInstanceId));
|
|
2871
|
+
data.append('xmlData', signedAgreement);
|
|
2872
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2873
|
+
data.append('format', 'xml');
|
|
2874
|
+
data.append('EdsXmlId', groupId);
|
|
2875
|
+
await this.api.file.uploadXml(data);
|
|
2876
|
+
} else {
|
|
2877
|
+
const base64EncodedSignature = await ncaLayerClient.createCAdESFromBase64(storageType, document, 'SIGNATURE', true);
|
|
2878
|
+
await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
|
|
2879
|
+
}
|
|
2880
|
+
return true;
|
|
2881
|
+
} catch (err: any) {
|
|
2882
|
+
return err.name === 'NCALayerError' ? null : ErrorHandler(err);
|
|
2883
|
+
}
|
|
2884
|
+
},
|
|
2885
|
+
async getDocNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
|
|
2886
|
+
try {
|
|
2887
|
+
let response: any = await this.api.file.generalGetDoc(groupId, xml ? 5 : documentSignType);
|
|
2888
|
+
let blob;
|
|
2889
|
+
if (response.hasOwnProperty('data')) {
|
|
2890
|
+
const document = JSON.parse(response.data).Document;
|
|
2891
|
+
blob = new Blob([document.documentXml], {
|
|
2892
|
+
type: `application/xml`,
|
|
2893
|
+
});
|
|
2894
|
+
response = document.documentXml;
|
|
2895
|
+
} else {
|
|
2896
|
+
blob = new Blob([response], {
|
|
2897
|
+
type: `application/pdf`,
|
|
2898
|
+
});
|
|
2899
|
+
}
|
|
2900
|
+
const url = window.URL.createObjectURL(blob);
|
|
2901
|
+
if (!xml) {
|
|
2902
|
+
const link = document.createElement('a');
|
|
2903
|
+
link.href = url;
|
|
2904
|
+
link.setAttribute('download', fileName ?? `Документ ПА`);
|
|
2905
|
+
document.body.appendChild(link);
|
|
2906
|
+
link.click();
|
|
2907
|
+
}
|
|
2908
|
+
window.open(url, '_blank', `right=100`);
|
|
2909
|
+
return response;
|
|
2910
|
+
} catch (err) {
|
|
2911
|
+
ErrorHandler(err);
|
|
2912
|
+
}
|
|
2913
|
+
},
|
|
2914
|
+
async generateSign(taskId: string) {
|
|
2915
|
+
try {
|
|
2916
|
+
const signatories = await this.api.file.generateSign({ taskId });
|
|
2917
|
+
if (Array.isArray(signatories)) {
|
|
2918
|
+
signatories.forEach(signatory =>
|
|
2919
|
+
signatory.fileDatas?.sort(function (a: any, b: any) {
|
|
2920
|
+
return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
|
|
2921
|
+
}),
|
|
2922
|
+
);
|
|
2923
|
+
this.formStore.signatories = signatories;
|
|
2924
|
+
}
|
|
2925
|
+
} catch (err) {
|
|
2926
|
+
ErrorHandler(err);
|
|
2927
|
+
this.formStore.signatories = [];
|
|
2928
|
+
}
|
|
2929
|
+
},
|
|
2930
|
+
async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
|
|
2931
|
+
try {
|
|
2932
|
+
const response = await this.api.file.generalSign(data);
|
|
2933
|
+
return response;
|
|
2934
|
+
} catch (err) {
|
|
2935
|
+
ErrorHandler(err);
|
|
2936
|
+
}
|
|
2937
|
+
},
|
|
2701
2938
|
async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
|
|
2702
2939
|
try {
|
|
2703
2940
|
this.isButtonsLoading = true;
|
|
@@ -2764,7 +3001,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2764
3001
|
name: 'Contract',
|
|
2765
3002
|
format: 'pdf',
|
|
2766
3003
|
};
|
|
2767
|
-
const response: any = await this.api.generateDocument(data);
|
|
3004
|
+
const response: any = await this.api.file.generateDocument(data);
|
|
2768
3005
|
const blob = new Blob([response], {
|
|
2769
3006
|
type: `application/pdf`,
|
|
2770
3007
|
});
|
|
@@ -2847,16 +3084,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2847
3084
|
this.isLoading = false;
|
|
2848
3085
|
}
|
|
2849
3086
|
},
|
|
2850
|
-
sanitize(text: string) {
|
|
2851
|
-
return text
|
|
2852
|
-
.replace(/\r?\n|\r/g, '')
|
|
2853
|
-
.replace(/\\/g, '')
|
|
2854
|
-
.replace(/"/g, '');
|
|
2855
|
-
},
|
|
2856
3087
|
async getSignedDocList(processInstanceId: string | number) {
|
|
2857
3088
|
if (processInstanceId !== 0) {
|
|
2858
3089
|
try {
|
|
2859
|
-
this.formStore.signedDocumentList = await this.api.getSignedDocList({
|
|
3090
|
+
this.formStore.signedDocumentList = await this.api.file.getSignedDocList({
|
|
2860
3091
|
processInstanceId: processInstanceId,
|
|
2861
3092
|
});
|
|
2862
3093
|
} catch (err) {
|
|
@@ -2923,6 +3154,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2923
3154
|
}
|
|
2924
3155
|
}
|
|
2925
3156
|
}
|
|
3157
|
+
} else if (applicationKey === 'slave') {
|
|
3158
|
+
if (this.formStore.slaveInsuredForm && this.formStore.applicationData.slave) {
|
|
3159
|
+
const localSlave = this.formStore.slaveInsuredForm;
|
|
3160
|
+
const applicationSlave = this.formStore.applicationData.slave.insuredApp[0];
|
|
3161
|
+
if ((localSlave.id === applicationSlave.insisId && applicationSlave.iin === localSlave.iin?.replace(/-/g, '')) === false) {
|
|
3162
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3163
|
+
return false;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
2926
3166
|
} else {
|
|
2927
3167
|
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2928
3168
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
@@ -2941,6 +3181,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2941
3181
|
return true;
|
|
2942
3182
|
},
|
|
2943
3183
|
async validateAllMembers(taskId: string, localCheck: boolean = false) {
|
|
3184
|
+
const policyholderDoc = this.formStore.signedDocumentList.find(
|
|
3185
|
+
i => i.iin === String(this.formStore.policyholderForm.iin).replaceAll('-', '') && (i.fileTypeCode === '1' || i.fileTypeCode === '2' || i.fileTypeCode === '4'),
|
|
3186
|
+
);
|
|
2944
3187
|
if (taskId === '0') {
|
|
2945
3188
|
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
2946
3189
|
return false;
|
|
@@ -2949,6 +3192,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2949
3192
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
2950
3193
|
return false;
|
|
2951
3194
|
}
|
|
3195
|
+
if (useEnv().isProduction && this.isInitiator() && this.isEfoParent && this.formStore.policyholderForm.iin && !policyholderDoc) {
|
|
3196
|
+
this.showToaster('error', this.t('toaster.needDigDoc', { text: 'страхователя' }));
|
|
3197
|
+
return false;
|
|
3198
|
+
}
|
|
2952
3199
|
if (this.members.insuredApp.has) {
|
|
2953
3200
|
if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
|
|
2954
3201
|
return false;
|
|
@@ -2961,6 +3208,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2961
3208
|
}
|
|
2962
3209
|
}
|
|
2963
3210
|
}
|
|
3211
|
+
if (this.formStore.applicationData.slave && this.validateMultipleMembers(this.formStore.insuredFormKey, 'slave', 'застрахованных') === false) {
|
|
3212
|
+
return false;
|
|
3213
|
+
}
|
|
2964
3214
|
if (this.members.beneficiaryApp.has) {
|
|
2965
3215
|
if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
|
|
2966
3216
|
return false;
|
|
@@ -3009,7 +3259,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3009
3259
|
}
|
|
3010
3260
|
}
|
|
3011
3261
|
if (this.controls.hasAttachment) {
|
|
3012
|
-
const areValid =
|
|
3262
|
+
const areValid =
|
|
3263
|
+
this.formStore.SaleChanellPolicy.nameRu &&
|
|
3264
|
+
this.formStore.RegionPolicy.nameRu &&
|
|
3265
|
+
this.formStore.AgentData.fullName &&
|
|
3266
|
+
(this.isPension && this.isServiceManager() ? true : this.formStore.ManagerPolicy.nameRu);
|
|
3013
3267
|
if (areValid) {
|
|
3014
3268
|
if (this.isLifetrip && this.formStore.AgentData.fullName === 'Без агента') {
|
|
3015
3269
|
this.isLoading = false;
|
|
@@ -3041,6 +3295,35 @@ export const useDataStore = defineStore('data', {
|
|
|
3041
3295
|
return ErrorHandler(err);
|
|
3042
3296
|
}
|
|
3043
3297
|
}
|
|
3298
|
+
if (this.isGons) {
|
|
3299
|
+
const { relationDegree } = this.formStore.beneficiaryForm[0];
|
|
3300
|
+
const siblingRelationIds = ['14', '15', '24', '25'];
|
|
3301
|
+
const grandchildRelationIds = ['20', '21'];
|
|
3302
|
+
let hasSiblingRelationId = siblingRelationIds.includes(String(relationDegree?.ids));
|
|
3303
|
+
let hasGrandchildRelationId = grandchildRelationIds.includes(String(relationDegree?.ids));
|
|
3304
|
+
const hasRelationDoc = this.formStore.signedDocumentList.filter(i => i.fileTypeCode === '46' || i.fileTypeCode === '53').length >= 2;
|
|
3305
|
+
|
|
3306
|
+
if (hasSiblingRelationId && !hasRelationDoc) {
|
|
3307
|
+
this.isLoading = false;
|
|
3308
|
+
hasSiblingRelationId = false;
|
|
3309
|
+
this.showToaster('error', this.t('toaster.siblingRelationDoc'), 3000);
|
|
3310
|
+
return false;
|
|
3311
|
+
}
|
|
3312
|
+
if (hasGrandchildRelationId && !hasRelationDoc) {
|
|
3313
|
+
this.isLoading = false;
|
|
3314
|
+
hasGrandchildRelationId = false;
|
|
3315
|
+
this.showToaster('error', this.t('toaster.grandchildRelationDoc'), 3000);
|
|
3316
|
+
return false;
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
if (this.isPension && this.formStore.hasRepresentative) {
|
|
3320
|
+
const requiredIds = ['16', '24'];
|
|
3321
|
+
|
|
3322
|
+
const missingDocuments = requiredIds.filter(id => !this.formStore.signedDocumentList.some(i => i.fileTypeCode === id));
|
|
3323
|
+
if (missingDocuments.length > 0) {
|
|
3324
|
+
this.showToaster('error', this.t('toaster.missingDocuments'), 3000);
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3044
3327
|
return true;
|
|
3045
3328
|
},
|
|
3046
3329
|
validateAnketa(whichSurvey: 'surveyByHealthBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBase' | 'surveyByCriticalBasePolicyholder') {
|
|
@@ -3077,7 +3360,12 @@ export const useDataStore = defineStore('data', {
|
|
|
3077
3360
|
this.isLoading = true;
|
|
3078
3361
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
3079
3362
|
if (areMembersValid) {
|
|
3080
|
-
if (
|
|
3363
|
+
if (
|
|
3364
|
+
(!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) ||
|
|
3365
|
+
(this.isPension &&
|
|
3366
|
+
this.formStore.applicationData.pensionApp.isCalculated === true &&
|
|
3367
|
+
(this.formStore.applicationData.pensionApp.slave ? this.formStore.applicationData.pensionApp.slave.isCalculated === true : true))
|
|
3368
|
+
) {
|
|
3081
3369
|
if (this.controls.hasAnketa) {
|
|
3082
3370
|
const hasCritical =
|
|
3083
3371
|
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
@@ -3244,13 +3532,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3244
3532
|
if (!this.accessToken) return null;
|
|
3245
3533
|
try {
|
|
3246
3534
|
const decoded = jwtDecode(this.accessToken);
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3535
|
+
if (decoded) {
|
|
3536
|
+
const data = {
|
|
3537
|
+
userName: decoded.code,
|
|
3538
|
+
branchName: decoded.branchCode,
|
|
3539
|
+
bin: bin.replace(/-/g, ''),
|
|
3540
|
+
};
|
|
3541
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3542
|
+
return gbdulResponse;
|
|
3543
|
+
}
|
|
3544
|
+
return null;
|
|
3254
3545
|
} catch (err) {
|
|
3255
3546
|
return ErrorHandler(err);
|
|
3256
3547
|
}
|
|
@@ -3332,69 +3623,72 @@ export const useDataStore = defineStore('data', {
|
|
|
3332
3623
|
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
3333
3624
|
if (gender) member.gender = gender;
|
|
3334
3625
|
|
|
3335
|
-
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
3626
|
+
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu ?? 'undefined', 'i')));
|
|
3336
3627
|
if (birthPlace) member.birthPlace = birthPlace;
|
|
3337
3628
|
|
|
3338
|
-
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
3629
|
+
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu ?? 'undefined', 'i')));
|
|
3339
3630
|
if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
|
|
3340
3631
|
|
|
3341
|
-
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu, 'i')));
|
|
3632
|
+
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu ?? 'undefined', 'i')));
|
|
3342
3633
|
if (regCountry) member.registrationCountry = regCountry;
|
|
3343
3634
|
|
|
3344
|
-
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
3635
|
+
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')));
|
|
3345
3636
|
if (regProvince) member.registrationProvince = regProvince;
|
|
3637
|
+
else member.registrationProvince = new Value();
|
|
3346
3638
|
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3639
|
+
let hasSetCity = false;
|
|
3640
|
+
let hasSetRegion = false;
|
|
3641
|
+
if (person.regAddress.city && String(person.regAddress.city).includes(', ')) {
|
|
3642
|
+
const personCities = String(person.regAddress.city).split(', ');
|
|
3643
|
+
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3644
|
+
const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
|
|
3645
|
+
if (possibleCity) {
|
|
3646
|
+
member.registrationCity = possibleCity;
|
|
3647
|
+
hasSetCity = true;
|
|
3648
|
+
break;
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
if (member.registrationCity.nameRu === null) {
|
|
3350
3652
|
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3351
|
-
const
|
|
3352
|
-
if (
|
|
3353
|
-
member.
|
|
3653
|
+
const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
|
|
3654
|
+
if (possibleRegion) {
|
|
3655
|
+
member.registrationRegion = possibleRegion;
|
|
3656
|
+
hasSetRegion = true;
|
|
3354
3657
|
break;
|
|
3355
3658
|
}
|
|
3356
3659
|
}
|
|
3357
|
-
if (member.registrationCity.nameRu === null) {
|
|
3358
|
-
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3359
|
-
const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
|
|
3360
|
-
if (possibleRegion) {
|
|
3361
|
-
member.registrationRegion = possibleRegion;
|
|
3362
|
-
break;
|
|
3363
|
-
}
|
|
3364
|
-
}
|
|
3365
|
-
}
|
|
3366
|
-
} else {
|
|
3367
|
-
const regCity = this.cities.find(i => String(i.nameRu).match(new RegExp(person.regAddress.city, 'i')));
|
|
3368
|
-
if (regCity) member.registrationCity = regCity;
|
|
3369
|
-
|
|
3370
|
-
if (member.registrationCity.nameRu === null) {
|
|
3371
|
-
const regRegion = this.regions.find(i => String(i.nameRu).match(new RegExp(person.regAddress.city, 'i')));
|
|
3372
|
-
if (regRegion) member.registrationRegion = regRegion;
|
|
3373
|
-
}
|
|
3374
3660
|
}
|
|
3375
3661
|
}
|
|
3376
3662
|
|
|
3377
|
-
if (
|
|
3663
|
+
if (hasSetCity === false) {
|
|
3378
3664
|
const regCity = this.cities.find(
|
|
3379
|
-
i =>
|
|
3665
|
+
i =>
|
|
3666
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3667
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3668
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3380
3669
|
);
|
|
3381
3670
|
if (regCity) {
|
|
3382
3671
|
member.registrationCity = regCity;
|
|
3383
3672
|
const regType = this.localityTypes.find(i => String(i.nameRu) === 'город');
|
|
3384
3673
|
if (regType) member.registrationRegionType = regType;
|
|
3385
|
-
} else
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3674
|
+
} else member.registrationCity = new Value();
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
if (hasSetRegion === false) {
|
|
3678
|
+
const regRegion = this.regions.find(
|
|
3679
|
+
i =>
|
|
3680
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3681
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3682
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3683
|
+
);
|
|
3684
|
+
if (regRegion) {
|
|
3685
|
+
member.registrationRegion = regRegion;
|
|
3686
|
+
const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
|
|
3687
|
+
if (regType) member.registrationRegionType = regType;
|
|
3688
|
+
} else member.registrationRegion = new Value();
|
|
3395
3689
|
}
|
|
3396
3690
|
|
|
3397
|
-
if (person.regAddress.street.includes(', ')) {
|
|
3691
|
+
if (person.regAddress.street && person.regAddress.street.includes(', ')) {
|
|
3398
3692
|
const personAddress = person.regAddress.street.split(', ');
|
|
3399
3693
|
const microDistrict = personAddress.find((i: string) => i.match(new RegExp('микрорайон', 'i')));
|
|
3400
3694
|
const quarter = personAddress.find((i: string) => i.match(new RegExp('квартал', 'i')));
|
|
@@ -3409,19 +3703,28 @@ export const useDataStore = defineStore('data', {
|
|
|
3409
3703
|
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
3410
3704
|
|
|
3411
3705
|
if (Array.isArray(person.documents.document)) {
|
|
3412
|
-
const
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
(i
|
|
3417
|
-
|
|
3706
|
+
const filteredDocuments = person.documents.document.filter(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00');
|
|
3707
|
+
const validDocument = this.isLifetrip
|
|
3708
|
+
? filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3709
|
+
: filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes['1UDL']) ??
|
|
3710
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.VNZ) ??
|
|
3711
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS);
|
|
3418
3712
|
if (validDocument) {
|
|
3419
|
-
const documentType = this.documentTypes.find(
|
|
3713
|
+
const documentType = this.documentTypes.find(
|
|
3714
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(validDocument.type.code)],
|
|
3715
|
+
);
|
|
3420
3716
|
if (documentType) member.documentType = documentType;
|
|
3421
3717
|
if (validDocument.number) member.documentNumber = validDocument.number;
|
|
3422
3718
|
if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
|
|
3423
3719
|
if (validDocument.endDate) member.documentExpire = reformatDate(validDocument.endDate);
|
|
3424
|
-
const documentIssuer = this.documentIssuers.find(i =>
|
|
3720
|
+
const documentIssuer = this.documentIssuers.find(i =>
|
|
3721
|
+
(i.nameRu as string).match(
|
|
3722
|
+
new RegExp(
|
|
3723
|
+
validDocument.issueOrganization.code === '001' ? 'МЮ РК' : validDocument.issueOrganization.code === '002' ? 'МВД РК' : validDocument.issueOrganization.nameRu,
|
|
3724
|
+
'i',
|
|
3725
|
+
),
|
|
3726
|
+
),
|
|
3727
|
+
);
|
|
3425
3728
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
3426
3729
|
}
|
|
3427
3730
|
} else {
|
|
@@ -3429,9 +3732,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3429
3732
|
if (
|
|
3430
3733
|
personDoc.status.code === '00' &&
|
|
3431
3734
|
new Date(personDoc.endDate) > new Date(Date.now()) &&
|
|
3432
|
-
(personDoc.type.code ===
|
|
3735
|
+
(personDoc.type.code === CoreEnums.GBD.DocTypes['1UDL'] || personDoc.type.code === CoreEnums.GBD.DocTypes.VNZ || personDoc.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3433
3736
|
) {
|
|
3434
|
-
const documentType = this.documentTypes.find(
|
|
3737
|
+
const documentType = this.documentTypes.find(
|
|
3738
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(personDoc.type.code)],
|
|
3739
|
+
);
|
|
3435
3740
|
if (documentType) member.documentType = documentType;
|
|
3436
3741
|
const documentNumber = personDoc.number;
|
|
3437
3742
|
if (documentNumber) member.documentNumber = documentNumber;
|
|
@@ -3439,7 +3744,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3439
3744
|
if (documentDate) member.documentDate = reformatDate(documentDate);
|
|
3440
3745
|
const documentExpire = personDoc.endDate;
|
|
3441
3746
|
if (documentExpire) member.documentExpire = reformatDate(documentExpire);
|
|
3442
|
-
const documentIssuer = this.documentIssuers.find(i =>
|
|
3747
|
+
const documentIssuer = this.documentIssuers.find(i =>
|
|
3748
|
+
(i.nameRu as string).match(
|
|
3749
|
+
new RegExp(personDoc.issueOrganization.code === '001' ? 'МЮ РК' : personDoc.issueOrganization.code === '002' ? 'МВД РК' : personDoc.issueOrganization.nameRu, 'i'),
|
|
3750
|
+
),
|
|
3751
|
+
);
|
|
3443
3752
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
3444
3753
|
}
|
|
3445
3754
|
}
|
|
@@ -3463,6 +3772,24 @@ export const useDataStore = defineStore('data', {
|
|
|
3463
3772
|
});
|
|
3464
3773
|
}
|
|
3465
3774
|
},
|
|
3775
|
+
uniqPreparePersonData(local: GroupMember) {
|
|
3776
|
+
const checkForNull = (value: any) => (value ? value : '');
|
|
3777
|
+
try {
|
|
3778
|
+
(Object.keys(local) as Array<keyof GroupMember>).forEach(key => {
|
|
3779
|
+
if (key === 'actualAddress' || key === 'legalAddress') {
|
|
3780
|
+
const address = `${checkForNull(local[key].country.nameRu)}, ${checkForNull(local[key].state.nameRu)},${
|
|
3781
|
+
local[key].region.nameRu ? ` ${local[key].region.nameRu},` : ''
|
|
3782
|
+
} ${checkForNull(local[key].regionType.nameRu)} ${checkForNull(local[key].city.nameRu)},${local[key].square ? ` квартал ${local[key].square},` : ''}${
|
|
3783
|
+
local[key].microdistrict ? ` мкр ${local[key].microdistrict},` : ''
|
|
3784
|
+
} ул. ${checkForNull(local[key].street)}, д. ${checkForNull(local[key].houseNumber)}`;
|
|
3785
|
+
local[key].longName = address;
|
|
3786
|
+
local[key].longNameKz = address;
|
|
3787
|
+
}
|
|
3788
|
+
});
|
|
3789
|
+
} catch (e) {
|
|
3790
|
+
ErrorHandler(e);
|
|
3791
|
+
}
|
|
3792
|
+
},
|
|
3466
3793
|
async startApplicationV2(data: PolicyholderClass) {
|
|
3467
3794
|
const policyholder = JSON.parse(JSON.stringify(data)) as any;
|
|
3468
3795
|
this.preparePersonData(policyholder);
|
|
@@ -3478,14 +3805,17 @@ export const useDataStore = defineStore('data', {
|
|
|
3478
3805
|
'clientData.authoritedPerson.bankInfo',
|
|
3479
3806
|
'clientData.authoritedPerson.economySectorCode',
|
|
3480
3807
|
'clientData.authoritedPerson.legalAddress',
|
|
3481
|
-
'clientData.authoritedPerson.placeOfBirth',
|
|
3482
|
-
'clientData.authoritedPerson.resident',
|
|
3483
3808
|
'clientData.authoritedPerson.taxResidentCountry',
|
|
3484
3809
|
'clientData.authoritedPerson.addTaxResidency',
|
|
3485
3810
|
]);
|
|
3486
3811
|
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3812
|
+
this.uniqPreparePersonData(policyholder.clientData);
|
|
3813
|
+
if (this.formStore.lfb.add) {
|
|
3814
|
+
policyholder.parentContractNumber = localStorage.getItem('policyNo');
|
|
3815
|
+
policyholder.parentContractId = localStorage.getItem('policyId');
|
|
3816
|
+
}
|
|
3487
3817
|
try {
|
|
3488
|
-
const response = await this.api.startApplication(policyholder);
|
|
3818
|
+
const response = await this.api.startApplication(policyholder, Number(this.processCode));
|
|
3489
3819
|
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
3490
3820
|
return response.processInstanceId;
|
|
3491
3821
|
} catch (err) {
|
|
@@ -3496,6 +3826,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3496
3826
|
const policyholder = JSON.parse(JSON.stringify(data)) as any;
|
|
3497
3827
|
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3498
3828
|
this.preparePersonData(policyholder);
|
|
3829
|
+
this.uniqPreparePersonData(policyholder.clientData);
|
|
3499
3830
|
try {
|
|
3500
3831
|
await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, policyholder);
|
|
3501
3832
|
} catch (err) {
|
|
@@ -3515,7 +3846,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3515
3846
|
this.formStore.applicationData = applicationData;
|
|
3516
3847
|
this.formStore.regNumber = applicationData.regNumber;
|
|
3517
3848
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
3518
|
-
|
|
3519
3849
|
this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
|
|
3520
3850
|
this.formStore.applicationTaskId = taskId;
|
|
3521
3851
|
this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
|
|
@@ -3536,17 +3866,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3536
3866
|
|
|
3537
3867
|
this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
|
|
3538
3868
|
this.formStore.lfb.policyholder.isIpdl = applicationData.clientApp.isIpdl;
|
|
3539
|
-
this.formStore.lfb.policyholder.clientData = clientData;
|
|
3540
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
|
|
3541
|
-
this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
|
|
3542
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
|
|
3543
3869
|
this.formStore.lfb.clientId = clientId;
|
|
3544
|
-
this.
|
|
3545
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
|
|
3546
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
|
|
3547
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
|
|
3548
|
-
const gender = this.gender.find((i: Value) => i.id === clientData.authoritedPerson.gender);
|
|
3549
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.gender = gender ? gender : new Value();
|
|
3870
|
+
this.getClientData(clientData);
|
|
3550
3871
|
|
|
3551
3872
|
if (clientData && clientData.activityTypes !== null) {
|
|
3552
3873
|
this.formStore.lfb.policyholderActivities = clientData.activityTypes;
|
|
@@ -3566,9 +3887,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3566
3887
|
});
|
|
3567
3888
|
}
|
|
3568
3889
|
|
|
3569
|
-
if (insuredApp
|
|
3570
|
-
|
|
3571
|
-
this.formStore.lfb.clients = res;
|
|
3890
|
+
if (insuredApp === null) {
|
|
3891
|
+
await this.getInsuredsData();
|
|
3572
3892
|
}
|
|
3573
3893
|
|
|
3574
3894
|
if (accidentIncidents && accidentIncidents.length) {
|
|
@@ -3579,19 +3899,43 @@ export const useDataStore = defineStore('data', {
|
|
|
3579
3899
|
});
|
|
3580
3900
|
}
|
|
3581
3901
|
|
|
3902
|
+
this.formStore.productConditionsForm.lifeMultiply = parseProcents(applicationData.policyAppDto.lifeMultiply);
|
|
3903
|
+
this.formStore.productConditionsForm.lifeAdditive = parseProcents(applicationData.policyAppDto.lifeAdditive);
|
|
3904
|
+
this.formStore.productConditionsForm.lifeMultiplyClient = parseProcents(applicationData.policyAppDto.lifeMultiplyClient);
|
|
3905
|
+
this.formStore.productConditionsForm.lifeAdditiveClient = parseProcents(applicationData.policyAppDto.lifeAdditiveClient);
|
|
3906
|
+
this.formStore.productConditionsForm.adbMultiply = parseProcents(applicationData.policyAppDto.adbMultiply);
|
|
3907
|
+
this.formStore.productConditionsForm.adbAdditive = parseProcents(applicationData.policyAppDto.adbAdditive);
|
|
3908
|
+
this.formStore.productConditionsForm.disabilityMultiply = parseProcents(applicationData.policyAppDto.disabilityMultiply);
|
|
3909
|
+
this.formStore.productConditionsForm.disabilityAdditive = parseProcents(applicationData.policyAppDto.disabilityAdditive);
|
|
3910
|
+
|
|
3582
3911
|
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.policyAppDto.calcDate);
|
|
3583
3912
|
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.policyAppDto.contractEndDate);
|
|
3584
|
-
this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission
|
|
3913
|
+
this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission;
|
|
3585
3914
|
this.formStore.productConditionsForm.fixInsSum = this.getNumberWithSpaces(applicationData.policyAppDto.fixInsSum === 0 ? null : applicationData.policyAppDto.fixInsSum);
|
|
3586
3915
|
this.formStore.productConditionsForm.coverPeriod = 12;
|
|
3587
3916
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount === 0 ? null : applicationData.policyAppDto.amount);
|
|
3588
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
3589
|
-
applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : applicationData.policyAppDto.mainPremiumWithCommission
|
|
3590
|
-
);
|
|
3917
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
3918
|
+
applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3591
3919
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
3592
3920
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
3593
3921
|
const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
|
|
3594
3922
|
this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
|
|
3923
|
+
|
|
3924
|
+
if (applicationData.parentPolicyDto !== null) {
|
|
3925
|
+
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.parentPolicyDto.contractInsrBegin);
|
|
3926
|
+
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.parentPolicyDto.contractInsrEnd);
|
|
3927
|
+
}
|
|
3928
|
+
if (this.formStore.lfb.add) {
|
|
3929
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium);
|
|
3930
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount);
|
|
3931
|
+
if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
|
|
3932
|
+
this.formStore.productConditionsForm.amountPaid = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3933
|
+
this.formStore.productConditionsForm.amountRefunded = null;
|
|
3934
|
+
} else {
|
|
3935
|
+
this.formStore.productConditionsForm.amountRefunded = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3936
|
+
this.formStore.productConditionsForm.amountPaid = null;
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3595
3939
|
} catch (err) {
|
|
3596
3940
|
ErrorHandler(err);
|
|
3597
3941
|
if (err instanceof AxiosError) {
|
|
@@ -3670,12 +4014,13 @@ export const useDataStore = defineStore('data', {
|
|
|
3670
4014
|
return ErrorHandler(err);
|
|
3671
4015
|
}
|
|
3672
4016
|
},
|
|
3673
|
-
async saveInsuredList(insuredList: any) {
|
|
4017
|
+
async saveInsuredList(insuredList: any, newInsureds: boolean) {
|
|
3674
4018
|
try {
|
|
3675
|
-
await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, insuredList);
|
|
4019
|
+
await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, newInsureds, insuredList);
|
|
3676
4020
|
return true;
|
|
3677
4021
|
} catch (err) {
|
|
3678
|
-
|
|
4022
|
+
ErrorHandler(err);
|
|
4023
|
+
return false;
|
|
3679
4024
|
}
|
|
3680
4025
|
},
|
|
3681
4026
|
async saveInsured(insured: any) {
|
|
@@ -3686,6 +4031,18 @@ export const useDataStore = defineStore('data', {
|
|
|
3686
4031
|
return ErrorHandler(err);
|
|
3687
4032
|
}
|
|
3688
4033
|
},
|
|
4034
|
+
async getInsuredsData() {
|
|
4035
|
+
try {
|
|
4036
|
+
const result = await this.api.getInsuredsData(this.formStore.applicationData.processInstanceId);
|
|
4037
|
+
if (result && result.length) {
|
|
4038
|
+
this.formStore.applicationData.insuredApp = result;
|
|
4039
|
+
const res = await this.newInsuredList(result);
|
|
4040
|
+
this.formStore.lfb.clients = res;
|
|
4041
|
+
}
|
|
4042
|
+
} catch (err) {
|
|
4043
|
+
return ErrorHandler(err);
|
|
4044
|
+
}
|
|
4045
|
+
},
|
|
3689
4046
|
newInsuredList(list: any) {
|
|
3690
4047
|
const clients = list.map((item: any, index: number) => {
|
|
3691
4048
|
const client = item.insuredData;
|
|
@@ -3700,6 +4057,9 @@ export const useDataStore = defineStore('data', {
|
|
|
3700
4057
|
premium: client.insuredPolicyData.premium,
|
|
3701
4058
|
premiumWithLoad: client.insuredPolicyData.premiumWithLoad,
|
|
3702
4059
|
hasAttachedFile: client.hasAttachedFile,
|
|
4060
|
+
insrBeginDate: client.insuredPolicyData.insrBeginDate ?? 'no',
|
|
4061
|
+
insrEndDate: client.insuredPolicyData.insrEndDate ?? 'no',
|
|
4062
|
+
tableNumber: client.tableNumber,
|
|
3703
4063
|
};
|
|
3704
4064
|
});
|
|
3705
4065
|
return clients;
|
|
@@ -3748,7 +4108,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3748
4108
|
return false;
|
|
3749
4109
|
}
|
|
3750
4110
|
|
|
3751
|
-
if (this.formStore.lfb.beneficialOwners) {
|
|
4111
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.beneficialOwners) {
|
|
3752
4112
|
if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
3753
4113
|
return false;
|
|
3754
4114
|
}
|
|
@@ -3759,12 +4119,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3759
4119
|
}
|
|
3760
4120
|
}
|
|
3761
4121
|
|
|
3762
|
-
if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
4122
|
+
if (!this.formStore.lfb.add && this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3763
4123
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
|
|
3764
4124
|
return false;
|
|
3765
4125
|
}
|
|
3766
4126
|
|
|
3767
|
-
|
|
4127
|
+
const isHalykBank = this.formStore.lfb.policyholder.clientData.iin.replace(/-/g, '') === '940140000385';
|
|
4128
|
+
if (this.formStore.lfb.clients.length === 0 && !isHalykBank) {
|
|
4129
|
+
await this.getInsuredsData();
|
|
4130
|
+
}
|
|
4131
|
+
if (this.formStore.lfb.clients && !isHalykBank) {
|
|
3768
4132
|
if (this.validateMultipleMembersV2('clients', 'insuredApp', 'застрахованных') === false) {
|
|
3769
4133
|
return false;
|
|
3770
4134
|
}
|
|
@@ -3775,7 +4139,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3775
4139
|
}
|
|
3776
4140
|
}
|
|
3777
4141
|
|
|
3778
|
-
if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
4142
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3779
4143
|
for (const client of this.formStore.lfb.clients) {
|
|
3780
4144
|
if (client.hasAttachedFile === false) {
|
|
3781
4145
|
this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
|
|
@@ -3784,18 +4148,75 @@ export const useDataStore = defineStore('data', {
|
|
|
3784
4148
|
}
|
|
3785
4149
|
}
|
|
3786
4150
|
|
|
3787
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
4151
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3788
4152
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
3789
4153
|
return false;
|
|
3790
4154
|
}
|
|
3791
4155
|
|
|
3792
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
4156
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3793
4157
|
this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
|
|
3794
4158
|
return false;
|
|
3795
4159
|
}
|
|
3796
4160
|
|
|
4161
|
+
if (this.controls.hasAttachment) {
|
|
4162
|
+
const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
|
|
4163
|
+
if (areValid) {
|
|
4164
|
+
if (this.isInitiator()) {
|
|
4165
|
+
await this.setINSISWorkData();
|
|
4166
|
+
}
|
|
4167
|
+
} else {
|
|
4168
|
+
this.isLoading = false;
|
|
4169
|
+
this.showToaster('error', this.t('toaster.attachManagerError'), 3000);
|
|
4170
|
+
return false;
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
|
|
3797
4174
|
return true;
|
|
3798
4175
|
},
|
|
4176
|
+
async getOnlineAccess(iin: string, documentType: string) {
|
|
4177
|
+
try {
|
|
4178
|
+
const data = {
|
|
4179
|
+
iinBin: iin.replaceAll('-', ''),
|
|
4180
|
+
documentType: documentType,
|
|
4181
|
+
};
|
|
4182
|
+
const response = await this.api.externalServices.getOnlineAccess(data);
|
|
4183
|
+
if (response.code === 'PROFILE_DIGIDOCS_INTERNAL_ERROR') {
|
|
4184
|
+
this.showToaster('error', this.t('toaster.notDigDoc'), 3000);
|
|
4185
|
+
return false;
|
|
4186
|
+
} else {
|
|
4187
|
+
return true;
|
|
4188
|
+
}
|
|
4189
|
+
} catch (err) {
|
|
4190
|
+
ErrorHandler(err);
|
|
4191
|
+
return null;
|
|
4192
|
+
}
|
|
4193
|
+
},
|
|
4194
|
+
async getDigitalDocuments(iin: string, processInstanceId: string, code: string) {
|
|
4195
|
+
try {
|
|
4196
|
+
const data = {
|
|
4197
|
+
iin: iin.replaceAll('-', ''),
|
|
4198
|
+
processInstanceId: processInstanceId,
|
|
4199
|
+
code: code.replace(/\s/g, ''),
|
|
4200
|
+
};
|
|
4201
|
+
await this.api.externalServices.getDigitalDocuments(data);
|
|
4202
|
+
return true;
|
|
4203
|
+
} catch (err) {
|
|
4204
|
+
ErrorHandler(err);
|
|
4205
|
+
return null;
|
|
4206
|
+
}
|
|
4207
|
+
},
|
|
4208
|
+
async updateDigitalDocumentsProfile(iin: string) {
|
|
4209
|
+
try {
|
|
4210
|
+
const data = {
|
|
4211
|
+
iinBin: iin.replaceAll('-', ''),
|
|
4212
|
+
};
|
|
4213
|
+
await this.api.externalServices.updateDigitalDocumentsProfile(data);
|
|
4214
|
+
this.showToaster('success', this.t('toaster.successProfile'), 3000);
|
|
4215
|
+
} catch (err) {
|
|
4216
|
+
ErrorHandler(err);
|
|
4217
|
+
return null;
|
|
4218
|
+
}
|
|
4219
|
+
},
|
|
3799
4220
|
async getVariableData(processCode: number) {
|
|
3800
4221
|
try {
|
|
3801
4222
|
const response = await this.api.getVariableData(0, processCode);
|
|
@@ -3808,6 +4229,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3808
4229
|
return null;
|
|
3809
4230
|
}
|
|
3810
4231
|
},
|
|
4232
|
+
async getProcessDividendPeriods() {
|
|
4233
|
+
try {
|
|
4234
|
+
if (!this.processCode) return null;
|
|
4235
|
+
const response = await this.api.getProcessDividendPeriods(this.processCode);
|
|
4236
|
+
return response;
|
|
4237
|
+
} catch (err) {
|
|
4238
|
+
ErrorHandler(err);
|
|
4239
|
+
return null;
|
|
4240
|
+
}
|
|
4241
|
+
},
|
|
3811
4242
|
async checkIIN(iin: string) {
|
|
3812
4243
|
try {
|
|
3813
4244
|
const response = await this.api.checkIIN(iin);
|
|
@@ -3825,6 +4256,24 @@ export const useDataStore = defineStore('data', {
|
|
|
3825
4256
|
return ErrorHandler(err);
|
|
3826
4257
|
}
|
|
3827
4258
|
},
|
|
4259
|
+
async getBankByAccountNumber(accountNumber: string) {
|
|
4260
|
+
try {
|
|
4261
|
+
const bank = await this.api.getBankByAccountNumber(accountNumber);
|
|
4262
|
+
return bank;
|
|
4263
|
+
} catch (err) {
|
|
4264
|
+
ErrorHandler(err);
|
|
4265
|
+
}
|
|
4266
|
+
},
|
|
4267
|
+
async getContractByBin(bin: string) {
|
|
4268
|
+
try {
|
|
4269
|
+
const contract = await this.api.getContractByBin(bin);
|
|
4270
|
+
contract.insrBegin = reformatDate(contract.insrBegin) ?? '';
|
|
4271
|
+
contract.insrEnd = reformatDate(contract.insrEnd) ?? '';
|
|
4272
|
+
return contract;
|
|
4273
|
+
} catch (err) {
|
|
4274
|
+
ErrorHandler(err);
|
|
4275
|
+
}
|
|
4276
|
+
},
|
|
3828
4277
|
async isCourseChanged(processInstanceId: string) {
|
|
3829
4278
|
try {
|
|
3830
4279
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -3845,8 +4294,30 @@ export const useDataStore = defineStore('data', {
|
|
|
3845
4294
|
return ErrorHandler(err);
|
|
3846
4295
|
}
|
|
3847
4296
|
},
|
|
4297
|
+
getClientData(clientData: GroupMember) {
|
|
4298
|
+
this.formStore.lfb.policyholder.clientData = clientData;
|
|
4299
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
|
|
4300
|
+
this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
|
|
4301
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
|
|
4302
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.authorityDetails.date = reformatDate(clientData.authoritedPerson.authorityDetails.date as string);
|
|
4303
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
|
|
4304
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
|
|
4305
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
|
|
4306
|
+
const gender = this.gender.find((i: Value) => i.id === Number(clientData.authoritedPerson.gender));
|
|
4307
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.gender = gender ? gender : new Value();
|
|
4308
|
+
},
|
|
4309
|
+
async getParentApplication(bin: string) {
|
|
4310
|
+
try {
|
|
4311
|
+
const response = await this.api.getParentApplication(bin);
|
|
4312
|
+
if (response) {
|
|
4313
|
+
this.getClientData(response.clientApp.clientData);
|
|
4314
|
+
}
|
|
4315
|
+
} catch (err) {
|
|
4316
|
+
return ErrorHandler(err);
|
|
4317
|
+
}
|
|
4318
|
+
},
|
|
3848
4319
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
3849
|
-
if (this.isLifetrip || this.isPension) return false;
|
|
4320
|
+
if (this.isLifetrip || this.isPension || this.isBalam || this.isBorrower || this.isTumar) return false;
|
|
3850
4321
|
switch (whichForm) {
|
|
3851
4322
|
case this.formStore.beneficiaryFormKey:
|
|
3852
4323
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -3857,7 +4328,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3857
4328
|
}
|
|
3858
4329
|
},
|
|
3859
4330
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
3860
|
-
if (this.
|
|
4331
|
+
if (this.isPension) return false;
|
|
3861
4332
|
switch (whichForm) {
|
|
3862
4333
|
case this.formStore.beneficiaryFormKey:
|
|
3863
4334
|
return false;
|
|
@@ -3865,18 +4336,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3865
4336
|
return true;
|
|
3866
4337
|
}
|
|
3867
4338
|
},
|
|
3868
|
-
hasPlaceSection(whichForm: keyof typeof StoreMembers) {
|
|
3869
|
-
switch (whichForm) {
|
|
3870
|
-
default:
|
|
3871
|
-
return true;
|
|
3872
|
-
}
|
|
3873
|
-
},
|
|
3874
|
-
hasDocumentSection(whichForm: keyof typeof StoreMembers) {
|
|
3875
|
-
switch (whichForm) {
|
|
3876
|
-
default:
|
|
3877
|
-
return true;
|
|
3878
|
-
}
|
|
3879
|
-
},
|
|
3880
4339
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
3881
4340
|
if (this.isGons || this.isPension) return false;
|
|
3882
4341
|
switch (whichForm) {
|
|
@@ -3885,16 +4344,17 @@ export const useDataStore = defineStore('data', {
|
|
|
3885
4344
|
}
|
|
3886
4345
|
},
|
|
3887
4346
|
hasBankSection(whichForm: keyof typeof StoreMembers) {
|
|
3888
|
-
if (!this.isPension) return false;
|
|
4347
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3889
4348
|
switch (whichForm) {
|
|
3890
4349
|
case 'beneficiaryForm':
|
|
4350
|
+
case 'policyholdersRepresentativeForm':
|
|
3891
4351
|
return false;
|
|
3892
4352
|
default:
|
|
3893
4353
|
return true;
|
|
3894
4354
|
}
|
|
3895
4355
|
},
|
|
3896
4356
|
hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
|
|
3897
|
-
if (!this.isPension) return false;
|
|
4357
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3898
4358
|
switch (whichForm) {
|
|
3899
4359
|
case 'beneficiaryForm':
|
|
3900
4360
|
return false;
|
|
@@ -3913,44 +4373,5 @@ export const useDataStore = defineStore('data', {
|
|
|
3913
4373
|
return false;
|
|
3914
4374
|
}
|
|
3915
4375
|
},
|
|
3916
|
-
hasPercentageOfPayoutAmount() {
|
|
3917
|
-
return true;
|
|
3918
|
-
},
|
|
3919
|
-
hasAccess() {
|
|
3920
|
-
const baseAccessRoles = this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
|
|
3921
|
-
return {
|
|
3922
|
-
invoiceInfo: this.isAdmin(),
|
|
3923
|
-
toLKA: this.isAgent() || baseAccessRoles,
|
|
3924
|
-
toAML: this.isCompliance() || baseAccessRoles,
|
|
3925
|
-
toAULETTI: this.isAgentAuletti() || baseAccessRoles,
|
|
3926
|
-
toLKA_A: this.isAgentAuletti() || baseAccessRoles,
|
|
3927
|
-
toEFO:
|
|
3928
|
-
this.isManager() ||
|
|
3929
|
-
this.isAgent() ||
|
|
3930
|
-
this.isAgentMycar() ||
|
|
3931
|
-
this.isManagerHalykBank() ||
|
|
3932
|
-
this.isHeadManager() ||
|
|
3933
|
-
this.isServiceManager() ||
|
|
3934
|
-
this.isUnderwriter() ||
|
|
3935
|
-
this.isActuary() ||
|
|
3936
|
-
this.isAdmin() ||
|
|
3937
|
-
this.isCompliance() ||
|
|
3938
|
-
this.isAnalyst() ||
|
|
3939
|
-
this.isUpk() ||
|
|
3940
|
-
this.isFinCenter() ||
|
|
3941
|
-
this.isSupervisor() ||
|
|
3942
|
-
this.isSupport() ||
|
|
3943
|
-
this.isDrn() ||
|
|
3944
|
-
this.isUrp() ||
|
|
3945
|
-
this.isUsns() ||
|
|
3946
|
-
this.isAccountant() ||
|
|
3947
|
-
this.isBranchDirector() ||
|
|
3948
|
-
this.isUSNSACCINS() ||
|
|
3949
|
-
this.isDsuio() ||
|
|
3950
|
-
this.isAdjuster() ||
|
|
3951
|
-
this.isDsoDirector() ||
|
|
3952
|
-
this.isAccountantDirector(),
|
|
3953
|
-
};
|
|
3954
|
-
},
|
|
3955
4376
|
},
|
|
3956
4377
|
});
|