hl-core 0.0.10-beta.5 → 0.0.10-beta.50
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 +327 -137
- package/api/interceptors.ts +3 -5
- package/components/Dialog/Dialog.vue +5 -1
- 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 +5 -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 +1 -1
- package/components/Pages/Anketa.vue +207 -176
- package/components/Pages/ContragentForm.vue +1 -1
- package/components/Pages/Documents.vue +436 -64
- package/components/Pages/MemberForm.vue +343 -170
- package/components/Pages/ProductConditions.vue +895 -241
- package/components/Panel/PanelHandler.vue +282 -124
- package/components/Utilities/Chip.vue +1 -1
- package/components/Utilities/JsonViewer.vue +1 -2
- package/composables/classes.ts +121 -20
- package/composables/constants.ts +45 -1
- package/composables/index.ts +333 -8
- package/composables/styles.ts +8 -24
- 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/ru.json +82 -19
- package/nuxt.config.ts +10 -12
- package/package.json +12 -12
- package/plugins/head.ts +7 -1
- package/store/data.store.ts +867 -525
- package/store/member.store.ts +17 -6
- package/store/rules.ts +23 -3
- package/types/enum.ts +40 -2
- package/types/index.ts +110 -56
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,14 @@ 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',
|
|
63
69
|
isDSO: state => state.product === 'dso',
|
|
64
70
|
isUU: state => state.product === 'uu',
|
|
65
|
-
hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
71
|
+
hasClientAnketa: state => Array.isArray(state.formStore.additionalInsuranceTerms) && state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
66
72
|
isClientAnketaCondition: state =>
|
|
73
|
+
Array.isArray(state.formStore.additionalInsuranceTerms) &&
|
|
67
74
|
!state.formStore.insuredForm.find(member => member.iin === state.formStore.policyholderForm.iin) &&
|
|
68
75
|
!!state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10 && i.coverSumCode === 'included'),
|
|
69
76
|
},
|
|
@@ -138,7 +145,7 @@ export const useDataStore = defineStore('data', {
|
|
|
138
145
|
if (showError) this.showToaster('error', this.t('toaster.noUrl'));
|
|
139
146
|
}
|
|
140
147
|
},
|
|
141
|
-
|
|
148
|
+
getDocsByIIN(iin: string) {
|
|
142
149
|
return iin ? this.formStore.signedDocumentList.filter(file => file.iin === iin && file.fileTypeName === 'Удостоверение личности') : null;
|
|
143
150
|
},
|
|
144
151
|
async getNewAccessToken() {
|
|
@@ -160,22 +167,23 @@ export const useDataStore = defineStore('data', {
|
|
|
160
167
|
getUserRoles() {
|
|
161
168
|
if (this.accessToken && this.user.roles.length === 0) {
|
|
162
169
|
const decoded = jwtDecode(this.accessToken);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
if (decoded) {
|
|
171
|
+
this.user.id = String(decoded.sub);
|
|
172
|
+
this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
|
|
173
|
+
this.user.code = decoded.code;
|
|
174
|
+
this.user.branchCode = decoded.branchCode;
|
|
175
|
+
const key = getKeyWithPattern(decoded, 'role');
|
|
176
|
+
if (key) {
|
|
177
|
+
const roles = decoded[key as keyof Types.Utils.JwtToken];
|
|
178
|
+
if (typeof roles === 'string') {
|
|
179
|
+
this.user.roles.push(roles);
|
|
180
|
+
} else if (typeof roles === 'object') {
|
|
181
|
+
this.user.roles = roles;
|
|
182
|
+
}
|
|
172
183
|
}
|
|
173
184
|
}
|
|
174
185
|
}
|
|
175
186
|
},
|
|
176
|
-
getUserData() {
|
|
177
|
-
return this.accessToken ? jwtDecode(this.accessToken) : null;
|
|
178
|
-
},
|
|
179
187
|
async getUserGroups() {
|
|
180
188
|
try {
|
|
181
189
|
this.isLoading = true;
|
|
@@ -186,140 +194,17 @@ export const useDataStore = defineStore('data', {
|
|
|
186
194
|
this.isLoading = false;
|
|
187
195
|
}
|
|
188
196
|
},
|
|
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
197
|
isTask() {
|
|
309
198
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
310
199
|
},
|
|
311
200
|
validateAccess() {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
return false;
|
|
320
|
-
} catch (err) {
|
|
321
|
-
return ErrorHandler(err);
|
|
322
|
-
}
|
|
201
|
+
const hasAccess = this.hasAccess();
|
|
202
|
+
if (this.isAML) return hasAccess.toAML;
|
|
203
|
+
if (this.isLKA) return hasAccess.toLKA;
|
|
204
|
+
if (this.isEFO) return hasAccess.toEFO;
|
|
205
|
+
if (this.isAULETTI) return hasAccess.toAULETTI;
|
|
206
|
+
if (this.isLKA_A) return hasAccess.toLKA_A;
|
|
207
|
+
return false;
|
|
323
208
|
},
|
|
324
209
|
async loginUser(login: string, password: string, numAttempt: number) {
|
|
325
210
|
try {
|
|
@@ -394,53 +279,91 @@ export const useDataStore = defineStore('data', {
|
|
|
394
279
|
await this.router.replace({ name: route.name });
|
|
395
280
|
}
|
|
396
281
|
},
|
|
397
|
-
async
|
|
282
|
+
async getDoc(file: DocumentItem, mode: string = 'view', fileType: string = 'pdf') {
|
|
398
283
|
if (!file.id) return;
|
|
399
284
|
try {
|
|
400
285
|
this.isLoading = true;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
286
|
+
if (this.isPension) {
|
|
287
|
+
await this.api.file.getDocNew(file.id).then((response: any) => {
|
|
288
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
289
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
290
|
+
const url = window.URL.createObjectURL(blob);
|
|
291
|
+
const link = document.createElement('a');
|
|
292
|
+
link.href = url;
|
|
293
|
+
if (mode === 'view') {
|
|
294
|
+
setTimeout(() => {
|
|
295
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
296
|
+
});
|
|
297
|
+
} else {
|
|
298
|
+
link.setAttribute('download', file.fileName!);
|
|
299
|
+
document.body.appendChild(link);
|
|
300
|
+
link.click();
|
|
301
|
+
}
|
|
411
302
|
} 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`);
|
|
303
|
+
const blob = new Blob([response], {
|
|
304
|
+
type: `application/${fileType}`,
|
|
426
305
|
});
|
|
306
|
+
const url = window.URL.createObjectURL(blob);
|
|
307
|
+
const link = document.createElement('a');
|
|
308
|
+
link.href = url;
|
|
309
|
+
if (mode === 'view') {
|
|
310
|
+
setTimeout(() => {
|
|
311
|
+
window.open(url, '_blank', `right=100`);
|
|
312
|
+
});
|
|
313
|
+
} else {
|
|
314
|
+
link.setAttribute('download', file.fileName!);
|
|
315
|
+
document.body.appendChild(link);
|
|
316
|
+
link.click();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
} else {
|
|
321
|
+
await this.api.file.getDoc(file.id).then((response: any) => {
|
|
322
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
323
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
324
|
+
const url = window.URL.createObjectURL(blob);
|
|
325
|
+
const link = document.createElement('a');
|
|
326
|
+
link.href = url;
|
|
327
|
+
if (mode === 'view') {
|
|
328
|
+
setTimeout(() => {
|
|
329
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
330
|
+
});
|
|
331
|
+
} else {
|
|
332
|
+
link.setAttribute('download', file.fileName!);
|
|
333
|
+
document.body.appendChild(link);
|
|
334
|
+
link.click();
|
|
335
|
+
}
|
|
427
336
|
} else {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
337
|
+
const blob = new Blob([response], {
|
|
338
|
+
type: `application/${fileType}`,
|
|
339
|
+
});
|
|
340
|
+
const url = window.URL.createObjectURL(blob);
|
|
341
|
+
const link = document.createElement('a');
|
|
342
|
+
link.href = url;
|
|
343
|
+
if (mode === 'view') {
|
|
344
|
+
setTimeout(() => {
|
|
345
|
+
window.open(url, '_blank', `right=100`);
|
|
346
|
+
});
|
|
347
|
+
} else {
|
|
348
|
+
link.setAttribute('download', file.fileName!);
|
|
349
|
+
document.body.appendChild(link);
|
|
350
|
+
link.click();
|
|
351
|
+
}
|
|
431
352
|
}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
434
355
|
} catch (err) {
|
|
435
356
|
ErrorHandler(err);
|
|
436
357
|
} finally {
|
|
437
358
|
this.isLoading = false;
|
|
438
359
|
}
|
|
439
360
|
},
|
|
440
|
-
async deleteFile(data: DocumentItem) {
|
|
361
|
+
async deleteFile(data: DocumentItem, showToaster: boolean = true) {
|
|
441
362
|
try {
|
|
442
|
-
await this.api.deleteFile(data);
|
|
443
|
-
|
|
363
|
+
await this.api.file.deleteFile(data);
|
|
364
|
+
if (showToaster) {
|
|
365
|
+
this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
|
|
366
|
+
}
|
|
444
367
|
} catch (err) {
|
|
445
368
|
ErrorHandler(err);
|
|
446
369
|
}
|
|
@@ -448,7 +371,7 @@ export const useDataStore = defineStore('data', {
|
|
|
448
371
|
async uploadFiles(data: FormData, load: boolean = false) {
|
|
449
372
|
this.isLoading = load;
|
|
450
373
|
try {
|
|
451
|
-
await this.api.uploadFiles(data);
|
|
374
|
+
await this.api.file.uploadFiles(data);
|
|
452
375
|
return true;
|
|
453
376
|
} catch (err) {
|
|
454
377
|
return ErrorHandler(err);
|
|
@@ -458,14 +381,28 @@ export const useDataStore = defineStore('data', {
|
|
|
458
381
|
},
|
|
459
382
|
async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
|
|
460
383
|
this.isLoading = load;
|
|
461
|
-
|
|
384
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
385
|
+
if (isNonResident) {
|
|
386
|
+
if (!member.firstName || !member.lastName) return;
|
|
387
|
+
} else {
|
|
388
|
+
if (!member.iin) return;
|
|
389
|
+
}
|
|
462
390
|
try {
|
|
463
|
-
const queryData =
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
391
|
+
const queryData = isNonResident
|
|
392
|
+
? {
|
|
393
|
+
firstName: member.firstName ?? '',
|
|
394
|
+
lastName: member.lastName ?? '',
|
|
395
|
+
middleName: member.middleName ?? '',
|
|
396
|
+
iin: '',
|
|
397
|
+
birthDate: member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
398
|
+
}
|
|
399
|
+
: {
|
|
400
|
+
firstName: '',
|
|
401
|
+
lastName: '',
|
|
402
|
+
middleName: '',
|
|
403
|
+
iin: member.iin ? member.iin.replace(/-/g, '') : '',
|
|
404
|
+
birthDate: '',
|
|
405
|
+
};
|
|
469
406
|
const contragentResponse = await this.api.getContragent(queryData);
|
|
470
407
|
if (contragentResponse.totalItems > 0) {
|
|
471
408
|
if (contragentResponse.items.length === 1) {
|
|
@@ -474,25 +411,32 @@ export const useDataStore = defineStore('data', {
|
|
|
474
411
|
const sortedByRegistrationDate = contragentResponse.items.sort(
|
|
475
412
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
476
413
|
);
|
|
477
|
-
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
414
|
+
if (!isNonResident) await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
478
415
|
}
|
|
479
416
|
member.gotFromInsis = true;
|
|
480
417
|
} else {
|
|
481
418
|
if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
482
419
|
}
|
|
420
|
+
if (isNonResident) return contragentResponse;
|
|
483
421
|
} catch (err) {
|
|
484
422
|
ErrorHandler(err);
|
|
485
423
|
}
|
|
486
424
|
this.isLoading = false;
|
|
487
425
|
},
|
|
488
|
-
async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
|
|
426
|
+
async getContragentById(id: number, whichForm: keyof typeof StoreMembers | 'slaveInsuredForm', load: boolean = true, whichIndex: number | null = null) {
|
|
489
427
|
if (Number(id) === 0) return;
|
|
490
428
|
this.isLoading = load;
|
|
491
429
|
try {
|
|
492
|
-
const member =
|
|
430
|
+
const member =
|
|
431
|
+
this.isPension && whichForm === 'slaveInsuredForm'
|
|
432
|
+
? this.formStore.slaveInsuredForm
|
|
433
|
+
: whichIndex === null
|
|
434
|
+
? this.formStore[whichForm as Types.SingleMember]
|
|
435
|
+
: this.formStore[whichForm as Types.MultipleMember][whichIndex];
|
|
436
|
+
|
|
493
437
|
const contragentResponse = await this.api.getContragentById(id);
|
|
494
438
|
if (contragentResponse.totalItems > 0) {
|
|
495
|
-
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
439
|
+
await this.serializeContragentData(member, contragentResponse.items[0], whichForm);
|
|
496
440
|
} else {
|
|
497
441
|
this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
498
442
|
}
|
|
@@ -502,7 +446,7 @@ export const useDataStore = defineStore('data', {
|
|
|
502
446
|
this.isLoading = false;
|
|
503
447
|
}
|
|
504
448
|
},
|
|
505
|
-
async serializeContragentData(member: Member, contragent: Types.ContragentType) {
|
|
449
|
+
async serializeContragentData(member: Member, contragent: Types.ContragentType, whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm') {
|
|
506
450
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
507
451
|
this.api.getContrAgentData(contragent.id),
|
|
508
452
|
this.api.getContrAgentContacts(contragent.id),
|
|
@@ -524,23 +468,34 @@ export const useDataStore = defineStore('data', {
|
|
|
524
468
|
if (addressResponse.status === 'fulfilled' && addressResponse.value && addressResponse.value.length) {
|
|
525
469
|
member.response.addresses = addressResponse.value;
|
|
526
470
|
}
|
|
527
|
-
this.parseContragent(
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
471
|
+
this.parseContragent(
|
|
472
|
+
member,
|
|
473
|
+
{
|
|
474
|
+
personalData: contragent,
|
|
475
|
+
data: questionairesResponse.status === 'fulfilled' ? questionairesResponse.value : undefined,
|
|
476
|
+
contacts: contactsResponse.status === 'fulfilled' ? contactsResponse.value : undefined,
|
|
477
|
+
documents: documentsResponse.status === 'fulfilled' ? documentsResponse.value : undefined,
|
|
478
|
+
address: addressResponse.status === 'fulfilled' ? addressResponse.value : undefined,
|
|
479
|
+
},
|
|
480
|
+
whichForm,
|
|
481
|
+
);
|
|
534
482
|
},
|
|
535
483
|
parseContragent(
|
|
536
484
|
member: Member,
|
|
537
|
-
user: {
|
|
485
|
+
user: {
|
|
486
|
+
personalData: Types.ContragentType;
|
|
487
|
+
data?: Types.ContragentQuestionaries[];
|
|
488
|
+
contacts?: Types.ContragentContacts[];
|
|
489
|
+
documents?: Types.ContragentDocuments[];
|
|
490
|
+
address?: Types.ContragentAddress[];
|
|
491
|
+
},
|
|
492
|
+
whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm',
|
|
538
493
|
) {
|
|
539
494
|
member.verifyType = user.personalData.verifyType;
|
|
540
495
|
member.verifyDate = user.personalData.verifyDate;
|
|
541
496
|
member.iin = reformatIin(user.personalData.iin);
|
|
542
497
|
member.age = String(user.personalData.age);
|
|
543
|
-
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
498
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace ?? 'undefined', 'i')));
|
|
544
499
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
545
500
|
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
546
501
|
member.gender = gender ? gender : new Value();
|
|
@@ -557,13 +512,23 @@ export const useDataStore = defineStore('data', {
|
|
|
557
512
|
|
|
558
513
|
if ('documents' in user && user.documents && user.documents.length) {
|
|
559
514
|
member.documentsList = user.documents;
|
|
560
|
-
const documentByPriority = user.documents.find(i =>
|
|
515
|
+
const documentByPriority = user.documents.find(i => {
|
|
516
|
+
if (this.isLifetrip && (whichForm !== this.formStore.policyholderFormKey || this.formStore.isPolicyholderInsured === true)) {
|
|
517
|
+
return i.type === CoreEnums.Insis.DocTypes['PS'];
|
|
518
|
+
}
|
|
519
|
+
return i.type === CoreEnums.Insis.DocTypes['1UDL'];
|
|
520
|
+
});
|
|
561
521
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
562
522
|
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
563
523
|
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
564
524
|
member.documentType = documentType ? documentType : new Value();
|
|
565
525
|
member.documentNumber = userDocument.number;
|
|
566
526
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
527
|
+
if (userDocument.issuerNameRu === 'Другое') {
|
|
528
|
+
member.documentIssuers.issuerOtherNameRu = userDocument.issuerOtherNameRu;
|
|
529
|
+
member.documentIssuers.issuerOtherNameOrig = userDocument.issuerOtherNameOrig;
|
|
530
|
+
member.documentIssuers.issuerOtherName = userDocument.issuerOtherName;
|
|
531
|
+
}
|
|
567
532
|
member.documentDate = reformatDate(userDocument.issueDate);
|
|
568
533
|
member.documentExpire = reformatDate(userDocument.expireDate);
|
|
569
534
|
}
|
|
@@ -639,23 +604,30 @@ export const useDataStore = defineStore('data', {
|
|
|
639
604
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
640
605
|
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
641
606
|
//@ts-ignore
|
|
642
|
-
member[qData.field] = qResult
|
|
607
|
+
member[qData.field] = qResult ?? new Value();
|
|
643
608
|
}
|
|
644
609
|
},
|
|
645
610
|
async alreadyInInsis(member: Member) {
|
|
646
|
-
|
|
611
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
612
|
+
if (isNonResident) {
|
|
613
|
+
if (!member.firstName || !member.lastName) return;
|
|
614
|
+
} else {
|
|
615
|
+
if (!member.iin) return;
|
|
616
|
+
}
|
|
647
617
|
try {
|
|
648
618
|
const queryData = {
|
|
649
|
-
iin: member.iin.replaceAll('-', ''),
|
|
619
|
+
iin: !!member.iin && !isNonResident ? member.iin.replaceAll('-', '') : '',
|
|
650
620
|
firstName: !!member.firstName ? member.firstName : '',
|
|
651
621
|
lastName: !!member.lastName ? member.lastName : '',
|
|
652
622
|
middleName: !!member.middleName ? member.middleName : '',
|
|
623
|
+
birthDate: !!member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
653
624
|
};
|
|
654
625
|
const contragent = await this.api.getContragent(queryData);
|
|
655
626
|
if (contragent.totalItems > 0) {
|
|
656
627
|
if (contragent.items.length === 1) {
|
|
657
628
|
return contragent.items[0];
|
|
658
629
|
} else {
|
|
630
|
+
if (this.isPension && queryData.iin === '') return contragent.items.find(i => i.id === member.id);
|
|
659
631
|
const sortedByRegistrationDate = contragent.items.sort(
|
|
660
632
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
661
633
|
);
|
|
@@ -689,8 +661,8 @@ export const useDataStore = defineStore('data', {
|
|
|
689
661
|
}
|
|
690
662
|
},
|
|
691
663
|
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.
|
|
664
|
+
if (this.isGons && user.iin && whichForm === 'beneficiaryForm') {
|
|
665
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesActualPolicy(String(this.formStore.applicationData.processInstanceId));
|
|
694
666
|
if (doesHaveActiveContract) {
|
|
695
667
|
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
696
668
|
return false;
|
|
@@ -727,7 +699,7 @@ export const useDataStore = defineStore('data', {
|
|
|
727
699
|
const contragentData: Types.ContragentType = {
|
|
728
700
|
id: Number(user.id),
|
|
729
701
|
type: Number(user.type),
|
|
730
|
-
iin: user.iin
|
|
702
|
+
iin: user.iin ? user.iin.replace(/-/g, '') : '',
|
|
731
703
|
longName: user.longName !== null ? user.longName : (user.lastName ?? '') + (user.firstName ?? '') + (user.middleName ?? ''),
|
|
732
704
|
lastName: user.lastName ?? '',
|
|
733
705
|
firstName: user.firstName ?? '',
|
|
@@ -881,6 +853,11 @@ export const useDataStore = defineStore('data', {
|
|
|
881
853
|
verifyType: user.verifyType,
|
|
882
854
|
verifyDate: user.verifyDate,
|
|
883
855
|
};
|
|
856
|
+
if (user.documentIssuers.ids === '1') {
|
|
857
|
+
userDocument.issuerOtherName = user.documentIssuers.issuerOtherName;
|
|
858
|
+
userDocument.issuerOtherNameOrig = user.documentIssuers.issuerOtherNameOrig;
|
|
859
|
+
userDocument.issuerOtherNameRu = user.documentIssuers.issuerOtherNameRu;
|
|
860
|
+
}
|
|
884
861
|
if (hasAlreadyDocument !== -1) {
|
|
885
862
|
documentsData[hasAlreadyDocument] = userDocument;
|
|
886
863
|
} else {
|
|
@@ -955,6 +932,9 @@ export const useDataStore = defineStore('data', {
|
|
|
955
932
|
isIpdlCompliance: null,
|
|
956
933
|
isTerrorCompliance: null,
|
|
957
934
|
};
|
|
935
|
+
if (this.isPension && memberFromApplicaiton && memberFromApplicaiton.processInstanceId === this.formStore.applicationData.slave?.processInstanceId) {
|
|
936
|
+
data.processInstanceId = this.formStore.applicationData.slave.processInstanceId;
|
|
937
|
+
}
|
|
958
938
|
data.id = memberFromApplicaiton && memberFromApplicaiton.id ? memberFromApplicaiton.id : null;
|
|
959
939
|
if (whichMember === 'Client') {
|
|
960
940
|
data.isInsured = this.formStore.isPolicyholderInsured;
|
|
@@ -964,6 +944,12 @@ export const useDataStore = defineStore('data', {
|
|
|
964
944
|
data.jobName = member.jobPlace;
|
|
965
945
|
data.positionCode = member.positionCode;
|
|
966
946
|
data.familyStatusId = member.familyStatus.id;
|
|
947
|
+
if (this.isPension) {
|
|
948
|
+
data.id =
|
|
949
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
950
|
+
? this.formStore.applicationData.clientApp.id
|
|
951
|
+
: this.formStore.applicationData.slave.clientApp.id;
|
|
952
|
+
}
|
|
967
953
|
}
|
|
968
954
|
if (whichMember === 'Spokesman') {
|
|
969
955
|
if (!!memberFromApplicaiton && memberFromApplicaiton.iin !== data.iin) {
|
|
@@ -1022,6 +1008,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1022
1008
|
data.familyStatusId = member.familyStatus.id;
|
|
1023
1009
|
data.relationId = member.relationDegree.ids;
|
|
1024
1010
|
data.relationName = member.relationDegree.nameRu;
|
|
1011
|
+
if (this.isPension) {
|
|
1012
|
+
data.id =
|
|
1013
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
1014
|
+
? this.formStore.applicationData.insuredApp[0].id
|
|
1015
|
+
: this.formStore.applicationData.slave.insuredApp[0].id;
|
|
1016
|
+
}
|
|
1025
1017
|
}
|
|
1026
1018
|
if (whichMember === 'Beneficiary') {
|
|
1027
1019
|
if (
|
|
@@ -1066,10 +1058,20 @@ export const useDataStore = defineStore('data', {
|
|
|
1066
1058
|
}
|
|
1067
1059
|
}
|
|
1068
1060
|
},
|
|
1069
|
-
async setApplication(applicationData:
|
|
1061
|
+
async setApplication(applicationData: any, calculate: boolean = false) {
|
|
1070
1062
|
try {
|
|
1071
1063
|
this.isLoading = true;
|
|
1072
1064
|
this.isButtonsLoading = true;
|
|
1065
|
+
if (this.isPension) {
|
|
1066
|
+
applicationData.transferContractCompany = '';
|
|
1067
|
+
if (applicationData.slave) {
|
|
1068
|
+
applicationData.slave.guaranteedPeriod = applicationData.slave.guaranteedPeriod ?? 0;
|
|
1069
|
+
applicationData.slave.transferContractCompany = '';
|
|
1070
|
+
}
|
|
1071
|
+
if (Number(this.formStore.applicationData.processCode) === 24) {
|
|
1072
|
+
applicationData.transferContractAmount = applicationData.parentContractAmount - applicationData.refundAmount;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1073
1075
|
await this.api.setApplication(applicationData);
|
|
1074
1076
|
if (calculate) {
|
|
1075
1077
|
await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
|
|
@@ -1124,6 +1126,22 @@ export const useDataStore = defineStore('data', {
|
|
|
1124
1126
|
conditionsData.policyAppDto.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1125
1127
|
conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
|
|
1126
1128
|
}
|
|
1129
|
+
if (this.isGons) {
|
|
1130
|
+
conditionsData.policyAppDto.premiumInCurrency =
|
|
1131
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1132
|
+
conditionsData.policyAppDto.amountInCurrency =
|
|
1133
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1134
|
+
conditionsData.policyAppDto.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1135
|
+
conditionsData.policyAppDto.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1136
|
+
//@ts-ignore
|
|
1137
|
+
if (isNaN(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, ''))) {
|
|
1138
|
+
conditionsData.policyAppDto.amount = parseFloat(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, '').replace(',', '.'));
|
|
1139
|
+
}
|
|
1140
|
+
//@ts-ignore
|
|
1141
|
+
if (isNaN(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, ''))) {
|
|
1142
|
+
conditionsData.policyAppDto.premium = parseFloat(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, '').replace(',', '.'));
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1127
1145
|
if (this.isLiferenta) {
|
|
1128
1146
|
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1129
1147
|
conditionsData.policyAppDto.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1210,8 +1228,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1210
1228
|
}
|
|
1211
1229
|
if (value !== null && this.formStore.definedAnswersId[whichSurvey][filter].length) {
|
|
1212
1230
|
const answer = this.formStore.definedAnswersId[whichSurvey][filter].find((answer: any) => answer.nameRu.match(new RegExp(value, 'i')));
|
|
1213
|
-
|
|
1214
|
-
|
|
1231
|
+
if (this.formStore[whichSurvey]) {
|
|
1232
|
+
//@ts-ignore
|
|
1233
|
+
this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
|
|
1234
|
+
}
|
|
1215
1235
|
}
|
|
1216
1236
|
return this.formStore.definedAnswersId[whichSurvey];
|
|
1217
1237
|
},
|
|
@@ -1243,6 +1263,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1243
1263
|
regionPolicyName: this.formStore.RegionPolicy.nameRu ?? '',
|
|
1244
1264
|
managerPolicy: this.formStore.ManagerPolicy.ids as string,
|
|
1245
1265
|
managerPolicyName: this.formStore.ManagerPolicy.nameRu ?? '',
|
|
1266
|
+
executorGPH: (this.formStore.ExecutorGPH.ids as string) ?? undefined,
|
|
1267
|
+
executorGPHName: this.formStore.ExecutorGPH.nameRu ?? undefined,
|
|
1246
1268
|
insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
|
|
1247
1269
|
};
|
|
1248
1270
|
try {
|
|
@@ -1455,7 +1477,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1455
1477
|
return await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1456
1478
|
},
|
|
1457
1479
|
async getEconomicActivityType() {
|
|
1458
|
-
|
|
1480
|
+
const makeCall = this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension || this.isCritical;
|
|
1481
|
+
if (makeCall) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
|
|
1459
1482
|
},
|
|
1460
1483
|
async getFamilyStatuses() {
|
|
1461
1484
|
return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
|
|
@@ -1467,48 +1490,53 @@ export const useDataStore = defineStore('data', {
|
|
|
1467
1490
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1468
1491
|
},
|
|
1469
1492
|
async getBanks() {
|
|
1470
|
-
|
|
1493
|
+
const makeCall = this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO || this.isCritical;
|
|
1494
|
+
if (makeCall) return await this.getFromApi('banks', 'getBanks');
|
|
1471
1495
|
},
|
|
1472
1496
|
async getInsuranceCompanies() {
|
|
1473
1497
|
if (this.isPension) return await this.getFromApi('transferContractCompanies', 'getInsuranceCompanies');
|
|
1474
1498
|
},
|
|
1475
1499
|
async getProcessIndexRate() {
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
}
|
|
1500
|
+
const makeCall = (this.isBaiterek || this.isBolashak || this.isGons) && this.processCode;
|
|
1501
|
+
if (makeCall) return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
1479
1502
|
},
|
|
1480
1503
|
async getProcessPaymentPeriod() {
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1504
|
+
const makeCall = !this.isPension && this.processCode;
|
|
1505
|
+
if (makeCall) return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
|
|
1506
|
+
},
|
|
1507
|
+
async getProgramType() {
|
|
1508
|
+
const makeCall = this.isCritical && this.processCode;
|
|
1509
|
+
if (makeCall) return await this.getFromApi('programType', 'getProgramType', this.processCode);
|
|
1484
1510
|
},
|
|
1485
1511
|
async getQuestionRefs(id?: string) {
|
|
1486
1512
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1487
1513
|
},
|
|
1488
|
-
async getProcessTariff() {
|
|
1489
|
-
if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
|
|
1490
|
-
},
|
|
1491
1514
|
async getDicAnnuityTypeList() {
|
|
1492
1515
|
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
1493
1516
|
},
|
|
1494
1517
|
async getProcessAnnuityPaymentPeriod() {
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
}
|
|
1518
|
+
const makeCall = this.isLiferenta && this.processCode;
|
|
1519
|
+
if (makeCall) return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
|
|
1498
1520
|
},
|
|
1499
1521
|
async getInsurancePay() {
|
|
1500
1522
|
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
1501
1523
|
},
|
|
1502
1524
|
async getProcessGfot() {
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1525
|
+
const makeCall = (this.isLifeBusiness || this.isGns) && this.processCode;
|
|
1526
|
+
if (makeCall) return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
|
|
1527
|
+
},
|
|
1528
|
+
async getSource() {
|
|
1529
|
+
return await this.getFromApi('Source', 'getSource');
|
|
1506
1530
|
},
|
|
1507
1531
|
async getCurrencies() {
|
|
1508
1532
|
try {
|
|
1509
|
-
const
|
|
1510
|
-
|
|
1511
|
-
|
|
1533
|
+
const makeCall = !this.isLKA && !this.isLKA_A;
|
|
1534
|
+
if (makeCall) {
|
|
1535
|
+
const currencies = await this.api.getCurrencies();
|
|
1536
|
+
this.currencies = currencies;
|
|
1537
|
+
return currencies;
|
|
1538
|
+
}
|
|
1539
|
+
return null;
|
|
1512
1540
|
} catch (err) {
|
|
1513
1541
|
console.log(err);
|
|
1514
1542
|
}
|
|
@@ -1521,7 +1549,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1521
1549
|
return this.gender;
|
|
1522
1550
|
},
|
|
1523
1551
|
async getAuthorityBasis() {
|
|
1524
|
-
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension
|
|
1552
|
+
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension || this.isCritical)
|
|
1553
|
+
return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
|
|
1525
1554
|
},
|
|
1526
1555
|
async getWorkPosition(search: string) {
|
|
1527
1556
|
try {
|
|
@@ -1549,8 +1578,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1549
1578
|
this.getFamilyStatuses(),
|
|
1550
1579
|
this.getRelationTypes(),
|
|
1551
1580
|
this.getProcessIndexRate(),
|
|
1552
|
-
this.getProcessTariff(),
|
|
1553
1581
|
this.getProcessPaymentPeriod(),
|
|
1582
|
+
this.getProgramType(),
|
|
1554
1583
|
this.getDicFileTypeList(),
|
|
1555
1584
|
this.getDicAnnuityTypeList(),
|
|
1556
1585
|
this.getProcessAnnuityPaymentPeriod(),
|
|
@@ -1564,6 +1593,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1564
1593
|
this.getDicTripPurpose(),
|
|
1565
1594
|
this.getCurrencies(),
|
|
1566
1595
|
this.getProcessGfot(),
|
|
1596
|
+
this.getSource(),
|
|
1567
1597
|
this.getBanks(),
|
|
1568
1598
|
this.getInsuranceCompanies(),
|
|
1569
1599
|
this.getEconomicActivityType(),
|
|
@@ -1592,16 +1622,19 @@ export const useDataStore = defineStore('data', {
|
|
|
1592
1622
|
if (secondaryQuestions.status === 'fulfilled') {
|
|
1593
1623
|
const baseAnketa = this.formStore[baseField];
|
|
1594
1624
|
if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1625
|
+
const isSpecialSurvey = this.isBaiterek || this.isBolashak || this.isLiferenta;
|
|
1626
|
+
for (const i of baseAnketa.body) {
|
|
1627
|
+
if (i.second === null && secondaryQuestions.value) {
|
|
1628
|
+
i.second = isSpecialSurvey
|
|
1629
|
+
? await this.api.getQuestionListSecondById(`${surveyType}second`, processInstanceId, insuredId, i.first.id)
|
|
1630
|
+
: structuredClone(secondaryQuestions.value);
|
|
1598
1631
|
}
|
|
1599
1632
|
if (i.first.definedAnswers === 'Y' && i.second && i.second.length) {
|
|
1600
1633
|
i.second.forEach(second => {
|
|
1601
1634
|
if (second.answerType === 'D') second.answerText = reformatDate(String(second.answerText));
|
|
1602
1635
|
});
|
|
1603
1636
|
}
|
|
1604
|
-
}
|
|
1637
|
+
}
|
|
1605
1638
|
}
|
|
1606
1639
|
}
|
|
1607
1640
|
} catch (err) {
|
|
@@ -1659,16 +1692,16 @@ export const useDataStore = defineStore('data', {
|
|
|
1659
1692
|
column: column,
|
|
1660
1693
|
direction: direction,
|
|
1661
1694
|
groupCode: groupCode,
|
|
1662
|
-
processCodes:
|
|
1695
|
+
processCodes: this.isEFO
|
|
1696
|
+
? Object.values(constants.products).filter(
|
|
1697
|
+
i => i !== constants.products.pensionannuity && i !== constants.products.pensionannuityrefund && i !== constants.products.pensionannuityjoint,
|
|
1698
|
+
)
|
|
1699
|
+
: [constants.products.baiterek],
|
|
1663
1700
|
};
|
|
1664
1701
|
if (byOneProcess !== null) {
|
|
1665
1702
|
delete query.processCodes;
|
|
1666
1703
|
query.processCode = byOneProcess;
|
|
1667
1704
|
}
|
|
1668
|
-
if (byOneProcess === 19 && !useEnv().isProduction) {
|
|
1669
|
-
query.processCodes = [19, 2];
|
|
1670
|
-
delete query.processCode;
|
|
1671
|
-
}
|
|
1672
1705
|
const taskList = await this.api.getTaskList(
|
|
1673
1706
|
processInstanceId === null
|
|
1674
1707
|
? query
|
|
@@ -1782,6 +1815,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1782
1815
|
console.log(err);
|
|
1783
1816
|
}
|
|
1784
1817
|
},
|
|
1818
|
+
async filterExecutorByRegion(filterName: string) {
|
|
1819
|
+
try {
|
|
1820
|
+
this.ExecutorGPH = await this.api.filterExecutorByRegion('ExecutorGPH', filterName);
|
|
1821
|
+
} catch (err) {
|
|
1822
|
+
console.log(err);
|
|
1823
|
+
}
|
|
1824
|
+
},
|
|
1785
1825
|
async getUnderwritingCouncilData(id: string | number) {
|
|
1786
1826
|
try {
|
|
1787
1827
|
const response: any = await this.api.getUnderwritingCouncilData(id);
|
|
@@ -1804,7 +1844,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1804
1844
|
async getDefaultCalculationData(showLoader: boolean = false, product: string | null = null) {
|
|
1805
1845
|
this.isLoading = showLoader;
|
|
1806
1846
|
try {
|
|
1807
|
-
const calculationData = await this.api.getDefaultCalculationData(
|
|
1847
|
+
const calculationData = await this.api.getDefaultCalculationData(
|
|
1848
|
+
this.isCalculator ? product : undefined,
|
|
1849
|
+
this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns' ? Number(this.processCode) : undefined,
|
|
1850
|
+
);
|
|
1808
1851
|
return calculationData;
|
|
1809
1852
|
} catch (err) {
|
|
1810
1853
|
ErrorHandler(err);
|
|
@@ -1892,6 +1935,23 @@ export const useDataStore = defineStore('data', {
|
|
|
1892
1935
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1893
1936
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1894
1937
|
}
|
|
1938
|
+
if (this.isGons || product === 'gons') {
|
|
1939
|
+
calculationData.premiumInCurrency =
|
|
1940
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1941
|
+
calculationData.amountInCurrency =
|
|
1942
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1943
|
+
calculationData.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1944
|
+
|
|
1945
|
+
calculationData.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1946
|
+
//@ts-ignore
|
|
1947
|
+
if (isNaN(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, ''))) {
|
|
1948
|
+
calculationData.amount = parseFloat(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, '').replace(',', '.'));
|
|
1949
|
+
}
|
|
1950
|
+
//@ts-ignore
|
|
1951
|
+
if (isNaN(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, ''))) {
|
|
1952
|
+
calculationData.premium = parseFloat(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, '').replace(',', '.'));
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1895
1955
|
if (this.isLiferenta || product === 'liferenta') {
|
|
1896
1956
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1897
1957
|
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1909,11 +1969,20 @@ export const useDataStore = defineStore('data', {
|
|
|
1909
1969
|
calculationData.contractEndDate = formatDate(this.formStore.productConditionsForm.contractEndDate as string)!.toISOString();
|
|
1910
1970
|
calculationData.calcDate = formatDate(this.formStore.productConditionsForm.calcDate as string)!.toISOString();
|
|
1911
1971
|
}
|
|
1912
|
-
const calculationResponse = await this.api.calculateWithoutApplication(
|
|
1913
|
-
|
|
1914
|
-
|
|
1972
|
+
const calculationResponse = await this.api.calculateWithoutApplication(
|
|
1973
|
+
calculationData,
|
|
1974
|
+
this.isCalculator ? product : undefined,
|
|
1975
|
+
this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns' ? Number(this.processCode) : undefined,
|
|
1976
|
+
);
|
|
1977
|
+
if (calculationResponse.amount)
|
|
1978
|
+
this.formStore.productConditionsForm.requestedSumInsured =
|
|
1979
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.amount) : this.getNumberWithSpaces(calculationResponse.amount);
|
|
1980
|
+
if (calculationResponse.premium)
|
|
1981
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
1982
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.premium) : this.getNumberWithSpaces(calculationResponse.premium);
|
|
1983
|
+
|
|
1915
1984
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1916
|
-
if (this.isKazyna || product === 'halykkazyna') {
|
|
1985
|
+
if (this.isKazyna || product === 'halykkazyna' || this.isGons || product === 'gons') {
|
|
1917
1986
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1918
1987
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
|
|
1919
1988
|
} else {
|
|
@@ -1930,7 +1999,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1930
1999
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
|
|
1931
2000
|
}
|
|
1932
2001
|
if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
|
|
1933
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2002
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(calculationResponse.mainPremiumWithCommission as number);
|
|
1934
2003
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.mainInsSum === 0 ? null : calculationResponse.mainInsSum);
|
|
1935
2004
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1936
2005
|
if (calculationResponse.agentCommission) {
|
|
@@ -1950,17 +2019,23 @@ export const useDataStore = defineStore('data', {
|
|
|
1950
2019
|
return !!this.formStore.productConditionsForm.requestedSumInsured && !!this.formStore.productConditionsForm.insurancePremiumPerMonth;
|
|
1951
2020
|
}
|
|
1952
2021
|
},
|
|
1953
|
-
async calculate(taskId: string) {
|
|
2022
|
+
async calculate(taskId: string, isHalykBank: boolean = false) {
|
|
1954
2023
|
this.isLoading = true;
|
|
1955
2024
|
try {
|
|
1956
2025
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1957
|
-
if (!this.isPension) await this.api.setApplication(this.getConditionsData());
|
|
2026
|
+
if (!this.isPension && !(this.formStore.lfb.add && (this.isLifeBusiness || this.isGns))) await this.api.setApplication(this.getConditionsData());
|
|
1958
2027
|
const result = ref();
|
|
1959
|
-
|
|
1960
|
-
|
|
2028
|
+
let applicationData = null;
|
|
2029
|
+
if (!isHalykBank) result.value = await this.api.getCalculation(String(id));
|
|
2030
|
+
if (this.isLifeBusiness || this.isGns) {
|
|
2031
|
+
await this.getApplicationDataV2(taskId);
|
|
2032
|
+
return;
|
|
2033
|
+
} else {
|
|
2034
|
+
applicationData = await this.api.getApplicationData(taskId);
|
|
2035
|
+
}
|
|
1961
2036
|
this.formStore.applicationData = applicationData;
|
|
1962
2037
|
if (this.formStore.applicationData.addCoverDto) this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1963
|
-
if (this.isKazyna && this.currencies.usd) {
|
|
2038
|
+
if ((this.isKazyna || this.isGons) && this.currencies.usd) {
|
|
1964
2039
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1965
2040
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
|
|
1966
2041
|
} else {
|
|
@@ -1968,11 +2043,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1968
2043
|
}
|
|
1969
2044
|
}
|
|
1970
2045
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
|
|
1971
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
1972
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2046
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
2047
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
2048
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium)
|
|
2049
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium);
|
|
1973
2050
|
} else {
|
|
1974
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1975
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.
|
|
2051
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
2052
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2053
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount)
|
|
2054
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount);
|
|
1976
2055
|
}
|
|
1977
2056
|
if (this.isLiferenta) {
|
|
1978
2057
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
@@ -1985,11 +2064,22 @@ export const useDataStore = defineStore('data', {
|
|
|
1985
2064
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
1986
2065
|
}
|
|
1987
2066
|
if (this.isLifeBusiness || this.isGns) {
|
|
1988
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2067
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(result.value);
|
|
1989
2068
|
if (applicationData.insuredApp && applicationData.insuredApp.length) {
|
|
1990
2069
|
const res = await this.newInsuredList(applicationData.insuredApp);
|
|
1991
2070
|
this.formStore.lfb.clients = res;
|
|
1992
2071
|
}
|
|
2072
|
+
if (this.formStore.lfb.add) {
|
|
2073
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium);
|
|
2074
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount);
|
|
2075
|
+
if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
|
|
2076
|
+
this.formStore.productConditionsForm.amountPaid = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
2077
|
+
this.formStore.productConditionsForm.amountRefunded = null;
|
|
2078
|
+
} else {
|
|
2079
|
+
this.formStore.productConditionsForm.amountRefunded = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
2080
|
+
this.formStore.productConditionsForm.amountPaid = null;
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
1993
2083
|
}
|
|
1994
2084
|
|
|
1995
2085
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
@@ -1998,6 +2088,38 @@ export const useDataStore = defineStore('data', {
|
|
|
1998
2088
|
}
|
|
1999
2089
|
this.isLoading = false;
|
|
2000
2090
|
},
|
|
2091
|
+
async reCalculateRefund(insSum: number, insSumMain: number, guaranteedPeriod: number, isOppv: boolean, transferContractMonthCount: number | null) {
|
|
2092
|
+
this.isLoading = true;
|
|
2093
|
+
try {
|
|
2094
|
+
const data = {
|
|
2095
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2096
|
+
insSum: insSum,
|
|
2097
|
+
insSumMain: insSumMain,
|
|
2098
|
+
guaranteedPeriod: guaranteedPeriod,
|
|
2099
|
+
isOppv: isOppv,
|
|
2100
|
+
transferContractMonthCount: transferContractMonthCount,
|
|
2101
|
+
};
|
|
2102
|
+
const response = await this.api.pensionannuityNew.reCalculateRefund(data);
|
|
2103
|
+
} catch (err) {
|
|
2104
|
+
ErrorHandler(err);
|
|
2105
|
+
}
|
|
2106
|
+
this.isLoading = false;
|
|
2107
|
+
},
|
|
2108
|
+
async calcParentContractSums(closeContractCompanyCode: string, closeContractCompanyName: string, isContractClosed: boolean) {
|
|
2109
|
+
this.isLoading = true;
|
|
2110
|
+
try {
|
|
2111
|
+
const data = {
|
|
2112
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2113
|
+
closeContractCompanyCode: closeContractCompanyCode,
|
|
2114
|
+
closeContractCompanyName: closeContractCompanyName,
|
|
2115
|
+
isContractClosed: isContractClosed,
|
|
2116
|
+
};
|
|
2117
|
+
const response = await this.api.pensionannuityNew.calcParentContractSums(data);
|
|
2118
|
+
} catch (err) {
|
|
2119
|
+
ErrorHandler(err);
|
|
2120
|
+
}
|
|
2121
|
+
this.isLoading = false;
|
|
2122
|
+
},
|
|
2001
2123
|
async calculatePremium(data: any) {
|
|
2002
2124
|
this.isLoading = true;
|
|
2003
2125
|
try {
|
|
@@ -2084,11 +2206,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2084
2206
|
this.isLoading = onlyGet;
|
|
2085
2207
|
try {
|
|
2086
2208
|
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
2209
|
this.formStore.regNumber = applicationData.regNumber;
|
|
2093
2210
|
this.formStore.applicationData = applicationData;
|
|
2094
2211
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
@@ -2099,13 +2216,23 @@ export const useDataStore = defineStore('data', {
|
|
|
2099
2216
|
this.formStore.RegionPolicy.ids = applicationData.insisWorkDataApp.regionPolicy;
|
|
2100
2217
|
this.formStore.ManagerPolicy.nameRu = applicationData.insisWorkDataApp.managerPolicyName;
|
|
2101
2218
|
this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
|
|
2219
|
+
this.formStore.ExecutorGPH.nameRu = applicationData.insisWorkDataApp.executorGPHName;
|
|
2220
|
+
this.formStore.ExecutorGPH.ids = applicationData.insisWorkDataApp.executorGPH;
|
|
2102
2221
|
this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
|
|
2103
2222
|
this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
|
|
2104
2223
|
this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
|
|
2105
2224
|
this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
|
|
2225
|
+
if ('sourceId' in applicationData.insisWorkDataApp && applicationData.insisWorkDataApp.sourceId !== null) {
|
|
2226
|
+
const source = this.Source.find((i: Value) => i.id === applicationData.insisWorkDataApp.sourceId);
|
|
2227
|
+
this.formStore.Source = source ? source : new Value();
|
|
2228
|
+
} else {
|
|
2229
|
+
const sourceEfo = this.Source.find((i: Value) => i.id === '3f9e5327-328c-4bc7-8d28-fa25c36ba153');
|
|
2230
|
+
this.formStore.Source = sourceEfo ? sourceEfo : new Value();
|
|
2231
|
+
}
|
|
2106
2232
|
|
|
2107
2233
|
const clientData = applicationData.clientApp;
|
|
2108
2234
|
const insuredData: any[] = applicationData.insuredApp;
|
|
2235
|
+
const slaveInsuredData: any = applicationData.slave?.insuredApp[0] ?? null;
|
|
2109
2236
|
const beneficiaryData: any[] = applicationData.beneficiaryApp;
|
|
2110
2237
|
const beneficialOwnerData: any[] = applicationData.beneficialOwnerApp;
|
|
2111
2238
|
const spokesmanData: any = applicationData.spokesmanApp;
|
|
@@ -2119,6 +2246,21 @@ export const useDataStore = defineStore('data', {
|
|
|
2119
2246
|
this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
|
|
2120
2247
|
}
|
|
2121
2248
|
|
|
2249
|
+
if ('pensionApp' in applicationData && applicationData.pensionApp) {
|
|
2250
|
+
this.formStore.pensionApp = applicationData.pensionApp;
|
|
2251
|
+
if ('slave' in applicationData && applicationData.slave) this.formStore.pensionApp.slave = applicationData.slave.pensionApp;
|
|
2252
|
+
if (setProductConditions) {
|
|
2253
|
+
const pensionKeysWithSpace = ['compulsoryContractAmount', 'compulsoryProfContractAmount', 'voluntaryContractAmount', 'ownFundsRaisAmount'];
|
|
2254
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2255
|
+
if (/\s/g.test(this.formStore.pensionApp[key]) === false) this.formStore.pensionApp[key] = this.getNumberWithSpaces(this.formStore.pensionApp[key]);
|
|
2256
|
+
});
|
|
2257
|
+
if (this.formStore.pensionApp.slave)
|
|
2258
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2259
|
+
if (/\s/g.test(this.formStore.pensionApp.slave[key]) === false)
|
|
2260
|
+
this.formStore.pensionApp.slave[key] = this.getNumberWithSpaces(this.formStore.pensionApp.slave[key]);
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2122
2264
|
if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
|
|
2123
2265
|
this.formStore.finCenterData = applicationData.finCenterData;
|
|
2124
2266
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
@@ -2183,11 +2325,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2183
2325
|
index: null,
|
|
2184
2326
|
});
|
|
2185
2327
|
}
|
|
2186
|
-
|
|
2187
|
-
if (applicationData.slave) {
|
|
2188
|
-
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
2328
|
if (insuredData && insuredData.length) {
|
|
2192
2329
|
insuredData.forEach((member, index) => {
|
|
2193
2330
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -2201,6 +2338,13 @@ export const useDataStore = defineStore('data', {
|
|
|
2201
2338
|
}
|
|
2202
2339
|
});
|
|
2203
2340
|
}
|
|
2341
|
+
if (slaveInsuredData) {
|
|
2342
|
+
allMembers.push({
|
|
2343
|
+
...slaveInsuredData,
|
|
2344
|
+
key: 'slaveInsuredForm',
|
|
2345
|
+
index: null,
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2204
2348
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2205
2349
|
beneficiaryData.forEach((member, index) => {
|
|
2206
2350
|
const inStore = this.formStore.beneficiaryForm.find(each => each.id == member.insisId);
|
|
@@ -2238,12 +2382,14 @@ export const useDataStore = defineStore('data', {
|
|
|
2238
2382
|
this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
|
|
2239
2383
|
if (insuredData && insuredData.length) {
|
|
2240
2384
|
insuredData.forEach((each, index) => {
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2385
|
+
if (each) {
|
|
2386
|
+
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
2387
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
2388
|
+
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
2389
|
+
}
|
|
2244
2390
|
});
|
|
2245
2391
|
}
|
|
2246
|
-
|
|
2392
|
+
if (slaveInsuredData) this.setMembersFieldSlave();
|
|
2247
2393
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2248
2394
|
beneficiaryData.forEach((each, index) => {
|
|
2249
2395
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
@@ -2321,15 +2467,32 @@ export const useDataStore = defineStore('data', {
|
|
|
2321
2467
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
2322
2468
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
2323
2469
|
|
|
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
|
-
|
|
2470
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2471
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount)
|
|
2472
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount);
|
|
2473
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
2474
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium)
|
|
2475
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium);
|
|
2476
|
+
|
|
2477
|
+
if (this.isGons) {
|
|
2478
|
+
const govPremiums = await this.api.getGovernmentPremiums(String(this.formStore.applicationData.processInstanceId));
|
|
2479
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
|
|
2480
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
|
|
2481
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
|
|
2482
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
2483
|
+
const currency = constants.currencyList.find(item => item.code === applicationData.policyAppDto.currency);
|
|
2484
|
+
this.formStore.productConditionsForm.currency = currency ? currency : new Value();
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
if (this.isKazyna || this.isGons) {
|
|
2331
2488
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
|
|
2332
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
|
|
2489
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
|
|
2490
|
+
this.formStore.applicationData.processCode === constants.products.halykkazynaap
|
|
2491
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premiumInCurrency)
|
|
2492
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
|
|
2493
|
+
if (applicationData.policyAppDto.currency === 'USD' && applicationData.policyAppDto.amount !== null && applicationData.policyAppDto.premium !== null) {
|
|
2494
|
+
this.currencies.usd = applicationData.policyAppDto.currencyExchangeRate;
|
|
2495
|
+
}
|
|
2333
2496
|
}
|
|
2334
2497
|
const riskGroup = this.riskGroup.find(item => {
|
|
2335
2498
|
if (applicationData.policyAppDto.riskGroup == 0) {
|
|
@@ -2410,6 +2573,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2410
2573
|
case constants.actions.signed:
|
|
2411
2574
|
case constants.actions.rejectclient:
|
|
2412
2575
|
case constants.actions.accept:
|
|
2576
|
+
case constants.actions.recalc:
|
|
2413
2577
|
case constants.actions.payed: {
|
|
2414
2578
|
try {
|
|
2415
2579
|
const sended = await this.sendTask(taskId, action, comment);
|
|
@@ -2463,9 +2627,14 @@ export const useDataStore = defineStore('data', {
|
|
|
2463
2627
|
}
|
|
2464
2628
|
},
|
|
2465
2629
|
async createInvoice() {
|
|
2466
|
-
|
|
2630
|
+
const premium =
|
|
2631
|
+
this.isLifeBusiness || this.isGns ? this.formStore.applicationData.policyAppDto?.mainPremiumWithCommission : this.formStore.applicationData.policyAppDto?.premium;
|
|
2632
|
+
if (!premium) {
|
|
2633
|
+
this.showToaster('error', this.t('toaster.notZeroPremium'));
|
|
2634
|
+
return;
|
|
2635
|
+
}
|
|
2467
2636
|
try {
|
|
2468
|
-
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId,
|
|
2637
|
+
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId, premium);
|
|
2469
2638
|
return !!created;
|
|
2470
2639
|
} catch (err) {
|
|
2471
2640
|
this.isLoading = false;
|
|
@@ -2498,14 +2667,43 @@ export const useDataStore = defineStore('data', {
|
|
|
2498
2667
|
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
|
|
2499
2668
|
this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2500
2669
|
}
|
|
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.
|
|
2670
|
+
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.pensionApp) {
|
|
2671
|
+
this.formStore[whichForm].bankInfo.iik = this.formStore.pensionApp.account;
|
|
2672
|
+
this.formStore[whichForm].bankInfo.bik = this.formStore.pensionApp.bankBik;
|
|
2673
|
+
this.formStore[whichForm].bankInfo.bankName.id = this.formStore.pensionApp.bankId;
|
|
2674
|
+
this.formStore[whichForm].bankInfo.bankName.nameRu = this.formStore.pensionApp.bankName;
|
|
2675
|
+
this.formStore[whichForm].bankInfo.bin = reformatIin(this.formStore.pensionApp.bankBin);
|
|
2676
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.transferContractCompany);
|
|
2677
|
+
this.formStore.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2678
|
+
}
|
|
2679
|
+
},
|
|
2680
|
+
setMembersFieldSlave() {
|
|
2681
|
+
this.formStore.slaveInsuredForm.familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData.slave['insuredApp'].familyStatusId);
|
|
2682
|
+
this.formStore.slaveInsuredForm.signOfIPDL = this.findObject(
|
|
2683
|
+
'ipdl',
|
|
2684
|
+
'nameRu',
|
|
2685
|
+
this.formStore.applicationData.slave.insuredApp[0].isIpdl === null ? null : this.formStore.applicationData.slave.insuredApp[0].isIpdl == true ? 'Да' : 'Нет',
|
|
2686
|
+
);
|
|
2687
|
+
this.formStore.slaveInsuredForm.gotFromInsis = false;
|
|
2688
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].profession) this.formStore.slaveInsuredForm.job = this.formStore.applicationData.slave.insuredApp[0].profession;
|
|
2689
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].position) this.formStore.slaveInsuredForm.jobPosition = this.formStore.applicationData.slave.insuredApp[0].position;
|
|
2690
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].jobName) this.formStore.slaveInsuredForm.jobPlace = this.formStore.applicationData.slave.insuredApp[0].jobName;
|
|
2691
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].positionCode)
|
|
2692
|
+
this.formStore.slaveInsuredForm.positionCode = this.formStore.applicationData.slave.insuredApp[0].positionCode;
|
|
2693
|
+
if (typeof this.formStore.applicationData.slave.insuredApp[0].isDisability === 'boolean')
|
|
2694
|
+
this.formStore.slaveInsuredForm.isDisability = this.formStore.applicationData.slave.insuredApp[0].isDisability;
|
|
2695
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId) {
|
|
2696
|
+
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId);
|
|
2697
|
+
this.formStore.slaveInsuredForm.disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2698
|
+
}
|
|
2699
|
+
if (this.formStore.slaveInsuredForm.bankInfo) {
|
|
2700
|
+
this.formStore.slaveInsuredForm.bankInfo.iik = this.formStore.pensionApp.slave.account;
|
|
2701
|
+
this.formStore.slaveInsuredForm.bankInfo.bik = this.formStore.pensionApp.slave.bankBik;
|
|
2702
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.id = this.formStore.pensionApp.slave.bankId;
|
|
2703
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.nameRu = this.formStore.pensionApp.slave.bankName;
|
|
2704
|
+
this.formStore.slaveInsuredForm.bankInfo.bin = reformatIin(this.formStore.pensionApp.slave.bankBin);
|
|
2705
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.slave.transferContractCompany);
|
|
2706
|
+
this.formStore.pensionApp.slave.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2509
2707
|
}
|
|
2510
2708
|
},
|
|
2511
2709
|
setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
@@ -2602,94 +2800,17 @@ export const useDataStore = defineStore('data', {
|
|
|
2602
2800
|
};
|
|
2603
2801
|
const data = prepareSignDocuments();
|
|
2604
2802
|
if (type === 'qr') {
|
|
2605
|
-
const groupId = await this.api.signQR(data);
|
|
2803
|
+
const groupId = await this.api.file.signQR(data);
|
|
2606
2804
|
return groupId;
|
|
2607
2805
|
} else if (type === 'qrXml') {
|
|
2608
|
-
const signData = await this.api.signXml(data);
|
|
2806
|
+
const signData = await this.api.file.signXml(data);
|
|
2609
2807
|
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
2808
|
} else {
|
|
2688
|
-
if (this.processCode === 19 || this.processCode ===
|
|
2689
|
-
const result = await this.api.signBts(data);
|
|
2809
|
+
if (this.processCode === 19 || this.processCode === 24 || this.processCode === 25) {
|
|
2810
|
+
const result = await this.api.file.signBts(data);
|
|
2690
2811
|
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2691
2812
|
} else {
|
|
2692
|
-
const result = await this.api.signDocument(data);
|
|
2813
|
+
const result = await this.api.file.signDocument(data);
|
|
2693
2814
|
this.formStore.signUrls = result;
|
|
2694
2815
|
}
|
|
2695
2816
|
return this.formStore.signUrls;
|
|
@@ -2698,6 +2819,84 @@ export const useDataStore = defineStore('data', {
|
|
|
2698
2819
|
ErrorHandler(err);
|
|
2699
2820
|
}
|
|
2700
2821
|
},
|
|
2822
|
+
async nclayerSign(groupId: string, signType: number, isXml: boolean = false, processInstanceId?: string) {
|
|
2823
|
+
try {
|
|
2824
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2825
|
+
await ncaLayerClient.connect();
|
|
2826
|
+
const activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2827
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2828
|
+
const document = await this.getDocNew(groupId, signType, isXml);
|
|
2829
|
+
if (isXml) {
|
|
2830
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, document, 'SIGNATURE', '');
|
|
2831
|
+
const data = new FormData();
|
|
2832
|
+
data.append('processInstanceId', processInstanceId ?? String(this.formStore.applicationData.processInstanceId));
|
|
2833
|
+
data.append('xmlData', signedAgreement);
|
|
2834
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2835
|
+
data.append('format', 'xml');
|
|
2836
|
+
data.append('EdsXmlId', groupId);
|
|
2837
|
+
await this.api.file.uploadXml(data);
|
|
2838
|
+
} else {
|
|
2839
|
+
const base64EncodedSignature = await ncaLayerClient.createCAdESFromBase64(storageType, document, 'SIGNATURE', true);
|
|
2840
|
+
await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
|
|
2841
|
+
}
|
|
2842
|
+
return true;
|
|
2843
|
+
} catch (err: any) {
|
|
2844
|
+
return err.name === 'NCALayerError' ? null : ErrorHandler(err);
|
|
2845
|
+
}
|
|
2846
|
+
},
|
|
2847
|
+
async getDocNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
|
|
2848
|
+
try {
|
|
2849
|
+
let response: any = await this.api.file.generalGetDoc(groupId, xml ? 5 : documentSignType);
|
|
2850
|
+
let blob;
|
|
2851
|
+
if (response.hasOwnProperty('data')) {
|
|
2852
|
+
const document = JSON.parse(response.data).Document;
|
|
2853
|
+
blob = new Blob([document.documentXml], {
|
|
2854
|
+
type: `application/xml`,
|
|
2855
|
+
});
|
|
2856
|
+
response = document.documentXml;
|
|
2857
|
+
} else {
|
|
2858
|
+
blob = new Blob([response], {
|
|
2859
|
+
type: `application/pdf`,
|
|
2860
|
+
});
|
|
2861
|
+
}
|
|
2862
|
+
const url = window.URL.createObjectURL(blob);
|
|
2863
|
+
if (!xml) {
|
|
2864
|
+
const link = document.createElement('a');
|
|
2865
|
+
link.href = url;
|
|
2866
|
+
link.setAttribute('download', fileName ?? `Документ ПА`);
|
|
2867
|
+
document.body.appendChild(link);
|
|
2868
|
+
link.click();
|
|
2869
|
+
}
|
|
2870
|
+
window.open(url, '_blank', `right=100`);
|
|
2871
|
+
return response;
|
|
2872
|
+
} catch (err) {
|
|
2873
|
+
ErrorHandler(err);
|
|
2874
|
+
}
|
|
2875
|
+
},
|
|
2876
|
+
async generateSign(taskId: string) {
|
|
2877
|
+
try {
|
|
2878
|
+
const signatories = await this.api.file.generateSign({ taskId });
|
|
2879
|
+
if (Array.isArray(signatories)) {
|
|
2880
|
+
signatories.forEach(signatory =>
|
|
2881
|
+
signatory.fileDatas?.sort(function (a: any, b: any) {
|
|
2882
|
+
return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
|
|
2883
|
+
}),
|
|
2884
|
+
);
|
|
2885
|
+
this.formStore.signatories = signatories;
|
|
2886
|
+
}
|
|
2887
|
+
} catch (err) {
|
|
2888
|
+
ErrorHandler(err);
|
|
2889
|
+
this.formStore.signatories = [];
|
|
2890
|
+
}
|
|
2891
|
+
},
|
|
2892
|
+
async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
|
|
2893
|
+
try {
|
|
2894
|
+
const response = await this.api.file.generalSign(data);
|
|
2895
|
+
return response;
|
|
2896
|
+
} catch (err) {
|
|
2897
|
+
ErrorHandler(err);
|
|
2898
|
+
}
|
|
2899
|
+
},
|
|
2701
2900
|
async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
|
|
2702
2901
|
try {
|
|
2703
2902
|
this.isButtonsLoading = true;
|
|
@@ -2764,7 +2963,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2764
2963
|
name: 'Contract',
|
|
2765
2964
|
format: 'pdf',
|
|
2766
2965
|
};
|
|
2767
|
-
const response: any = await this.api.generateDocument(data);
|
|
2966
|
+
const response: any = await this.api.file.generateDocument(data);
|
|
2768
2967
|
const blob = new Blob([response], {
|
|
2769
2968
|
type: `application/pdf`,
|
|
2770
2969
|
});
|
|
@@ -2847,16 +3046,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2847
3046
|
this.isLoading = false;
|
|
2848
3047
|
}
|
|
2849
3048
|
},
|
|
2850
|
-
sanitize(text: string) {
|
|
2851
|
-
return text
|
|
2852
|
-
.replace(/\r?\n|\r/g, '')
|
|
2853
|
-
.replace(/\\/g, '')
|
|
2854
|
-
.replace(/"/g, '');
|
|
2855
|
-
},
|
|
2856
3049
|
async getSignedDocList(processInstanceId: string | number) {
|
|
2857
3050
|
if (processInstanceId !== 0) {
|
|
2858
3051
|
try {
|
|
2859
|
-
this.formStore.signedDocumentList = await this.api.getSignedDocList({
|
|
3052
|
+
this.formStore.signedDocumentList = await this.api.file.getSignedDocList({
|
|
2860
3053
|
processInstanceId: processInstanceId,
|
|
2861
3054
|
});
|
|
2862
3055
|
} catch (err) {
|
|
@@ -2923,6 +3116,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2923
3116
|
}
|
|
2924
3117
|
}
|
|
2925
3118
|
}
|
|
3119
|
+
} else if (applicationKey === 'slave') {
|
|
3120
|
+
if (this.formStore.slaveInsuredForm && this.formStore.applicationData.slave) {
|
|
3121
|
+
const localSlave = this.formStore.slaveInsuredForm;
|
|
3122
|
+
const applicationSlave = this.formStore.applicationData.slave.insuredApp[0];
|
|
3123
|
+
if ((localSlave.id === applicationSlave.insisId && applicationSlave.iin === localSlave.iin?.replace(/-/g, '')) === false) {
|
|
3124
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3125
|
+
return false;
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
2926
3128
|
} else {
|
|
2927
3129
|
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2928
3130
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
@@ -2941,6 +3143,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2941
3143
|
return true;
|
|
2942
3144
|
},
|
|
2943
3145
|
async validateAllMembers(taskId: string, localCheck: boolean = false) {
|
|
3146
|
+
const policyholderDoc = this.formStore.signedDocumentList.find(
|
|
3147
|
+
i => i.iin === String(this.formStore.policyholderForm.iin).replaceAll('-', '') && (i.fileTypeCode === '1' || i.fileTypeCode === '2' || i.fileTypeCode === '4'),
|
|
3148
|
+
);
|
|
2944
3149
|
if (taskId === '0') {
|
|
2945
3150
|
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
2946
3151
|
return false;
|
|
@@ -2949,6 +3154,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2949
3154
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
2950
3155
|
return false;
|
|
2951
3156
|
}
|
|
3157
|
+
if (useEnv().isProduction && this.isInitiator() && this.isEfoParent && this.formStore.policyholderForm.iin && !policyholderDoc) {
|
|
3158
|
+
this.showToaster('error', this.t('toaster.needDigDoc', { text: 'страхователя' }));
|
|
3159
|
+
return false;
|
|
3160
|
+
}
|
|
2952
3161
|
if (this.members.insuredApp.has) {
|
|
2953
3162
|
if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
|
|
2954
3163
|
return false;
|
|
@@ -2961,6 +3170,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2961
3170
|
}
|
|
2962
3171
|
}
|
|
2963
3172
|
}
|
|
3173
|
+
if (this.formStore.applicationData.slave && this.validateMultipleMembers(this.formStore.insuredFormKey, 'slave', 'застрахованных') === false) {
|
|
3174
|
+
return false;
|
|
3175
|
+
}
|
|
2964
3176
|
if (this.members.beneficiaryApp.has) {
|
|
2965
3177
|
if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
|
|
2966
3178
|
return false;
|
|
@@ -3009,7 +3221,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3009
3221
|
}
|
|
3010
3222
|
}
|
|
3011
3223
|
if (this.controls.hasAttachment) {
|
|
3012
|
-
const areValid =
|
|
3224
|
+
const areValid =
|
|
3225
|
+
this.formStore.SaleChanellPolicy.nameRu &&
|
|
3226
|
+
this.formStore.RegionPolicy.nameRu &&
|
|
3227
|
+
this.formStore.AgentData.fullName &&
|
|
3228
|
+
(this.isPension && this.isServiceManager() ? true : this.formStore.ManagerPolicy.nameRu);
|
|
3013
3229
|
if (areValid) {
|
|
3014
3230
|
if (this.isLifetrip && this.formStore.AgentData.fullName === 'Без агента') {
|
|
3015
3231
|
this.isLoading = false;
|
|
@@ -3077,7 +3293,12 @@ export const useDataStore = defineStore('data', {
|
|
|
3077
3293
|
this.isLoading = true;
|
|
3078
3294
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
3079
3295
|
if (areMembersValid) {
|
|
3080
|
-
if (
|
|
3296
|
+
if (
|
|
3297
|
+
(!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) ||
|
|
3298
|
+
(this.isPension &&
|
|
3299
|
+
this.formStore.applicationData.pensionApp.isCalculated === true &&
|
|
3300
|
+
(this.formStore.applicationData.pensionApp.slave ? this.formStore.applicationData.pensionApp.slave.isCalculated === true : true))
|
|
3301
|
+
) {
|
|
3081
3302
|
if (this.controls.hasAnketa) {
|
|
3082
3303
|
const hasCritical =
|
|
3083
3304
|
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
@@ -3244,13 +3465,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3244
3465
|
if (!this.accessToken) return null;
|
|
3245
3466
|
try {
|
|
3246
3467
|
const decoded = jwtDecode(this.accessToken);
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3468
|
+
if (decoded) {
|
|
3469
|
+
const data = {
|
|
3470
|
+
userName: decoded.code,
|
|
3471
|
+
branchName: decoded.branchCode,
|
|
3472
|
+
bin: bin.replace(/-/g, ''),
|
|
3473
|
+
};
|
|
3474
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3475
|
+
return gbdulResponse;
|
|
3476
|
+
}
|
|
3477
|
+
return null;
|
|
3254
3478
|
} catch (err) {
|
|
3255
3479
|
return ErrorHandler(err);
|
|
3256
3480
|
}
|
|
@@ -3332,69 +3556,72 @@ export const useDataStore = defineStore('data', {
|
|
|
3332
3556
|
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
3333
3557
|
if (gender) member.gender = gender;
|
|
3334
3558
|
|
|
3335
|
-
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
3559
|
+
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu ?? 'undefined', 'i')));
|
|
3336
3560
|
if (birthPlace) member.birthPlace = birthPlace;
|
|
3337
3561
|
|
|
3338
|
-
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
3562
|
+
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu ?? 'undefined', 'i')));
|
|
3339
3563
|
if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
|
|
3340
3564
|
|
|
3341
|
-
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu, 'i')));
|
|
3565
|
+
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu ?? 'undefined', 'i')));
|
|
3342
3566
|
if (regCountry) member.registrationCountry = regCountry;
|
|
3343
3567
|
|
|
3344
|
-
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
3568
|
+
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')));
|
|
3345
3569
|
if (regProvince) member.registrationProvince = regProvince;
|
|
3570
|
+
else member.registrationProvince = new Value();
|
|
3346
3571
|
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3572
|
+
let hasSetCity = false;
|
|
3573
|
+
let hasSetRegion = false;
|
|
3574
|
+
if (person.regAddress.city && String(person.regAddress.city).includes(', ')) {
|
|
3575
|
+
const personCities = String(person.regAddress.city).split(', ');
|
|
3576
|
+
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3577
|
+
const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
|
|
3578
|
+
if (possibleCity) {
|
|
3579
|
+
member.registrationCity = possibleCity;
|
|
3580
|
+
hasSetCity = true;
|
|
3581
|
+
break;
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
if (member.registrationCity.nameRu === null) {
|
|
3350
3585
|
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3351
|
-
const
|
|
3352
|
-
if (
|
|
3353
|
-
member.
|
|
3586
|
+
const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
|
|
3587
|
+
if (possibleRegion) {
|
|
3588
|
+
member.registrationRegion = possibleRegion;
|
|
3589
|
+
hasSetRegion = true;
|
|
3354
3590
|
break;
|
|
3355
3591
|
}
|
|
3356
3592
|
}
|
|
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
3593
|
}
|
|
3375
3594
|
}
|
|
3376
3595
|
|
|
3377
|
-
if (
|
|
3596
|
+
if (hasSetCity === false) {
|
|
3378
3597
|
const regCity = this.cities.find(
|
|
3379
|
-
i =>
|
|
3598
|
+
i =>
|
|
3599
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3600
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3601
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3380
3602
|
);
|
|
3381
3603
|
if (regCity) {
|
|
3382
3604
|
member.registrationCity = regCity;
|
|
3383
3605
|
const regType = this.localityTypes.find(i => String(i.nameRu) === 'город');
|
|
3384
3606
|
if (regType) member.registrationRegionType = regType;
|
|
3385
|
-
} else
|
|
3386
|
-
const regRegion = this.regions.find(
|
|
3387
|
-
i => String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu, 'i')) || String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
3388
|
-
);
|
|
3389
|
-
if (regRegion) {
|
|
3390
|
-
member.registrationRegion = regRegion;
|
|
3391
|
-
const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
|
|
3392
|
-
if (regType) member.registrationRegionType = regType;
|
|
3393
|
-
}
|
|
3394
|
-
}
|
|
3607
|
+
} else member.registrationCity = new Value();
|
|
3395
3608
|
}
|
|
3396
3609
|
|
|
3397
|
-
if (
|
|
3610
|
+
if (hasSetRegion === false) {
|
|
3611
|
+
const regRegion = this.regions.find(
|
|
3612
|
+
i =>
|
|
3613
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3614
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3615
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3616
|
+
);
|
|
3617
|
+
if (regRegion) {
|
|
3618
|
+
member.registrationRegion = regRegion;
|
|
3619
|
+
const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
|
|
3620
|
+
if (regType) member.registrationRegionType = regType;
|
|
3621
|
+
} else member.registrationRegion = new Value();
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
if (person.regAddress.street && person.regAddress.street.includes(', ')) {
|
|
3398
3625
|
const personAddress = person.regAddress.street.split(', ');
|
|
3399
3626
|
const microDistrict = personAddress.find((i: string) => i.match(new RegExp('микрорайон', 'i')));
|
|
3400
3627
|
const quarter = personAddress.find((i: string) => i.match(new RegExp('квартал', 'i')));
|
|
@@ -3409,19 +3636,28 @@ export const useDataStore = defineStore('data', {
|
|
|
3409
3636
|
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
3410
3637
|
|
|
3411
3638
|
if (Array.isArray(person.documents.document)) {
|
|
3412
|
-
const
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
(i
|
|
3417
|
-
|
|
3639
|
+
const filteredDocuments = person.documents.document.filter(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00');
|
|
3640
|
+
const validDocument = this.isLifetrip
|
|
3641
|
+
? filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3642
|
+
: filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes['1UDL']) ??
|
|
3643
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.VNZ) ??
|
|
3644
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS);
|
|
3418
3645
|
if (validDocument) {
|
|
3419
|
-
const documentType = this.documentTypes.find(
|
|
3646
|
+
const documentType = this.documentTypes.find(
|
|
3647
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(validDocument.type.code)],
|
|
3648
|
+
);
|
|
3420
3649
|
if (documentType) member.documentType = documentType;
|
|
3421
3650
|
if (validDocument.number) member.documentNumber = validDocument.number;
|
|
3422
3651
|
if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
|
|
3423
3652
|
if (validDocument.endDate) member.documentExpire = reformatDate(validDocument.endDate);
|
|
3424
|
-
const documentIssuer = this.documentIssuers.find(i =>
|
|
3653
|
+
const documentIssuer = this.documentIssuers.find(i =>
|
|
3654
|
+
(i.nameRu as string).match(
|
|
3655
|
+
new RegExp(
|
|
3656
|
+
validDocument.issueOrganization.code === '001' ? 'МЮ РК' : validDocument.issueOrganization.code === '002' ? 'МВД РК' : validDocument.issueOrganization.nameRu,
|
|
3657
|
+
'i',
|
|
3658
|
+
),
|
|
3659
|
+
),
|
|
3660
|
+
);
|
|
3425
3661
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
3426
3662
|
}
|
|
3427
3663
|
} else {
|
|
@@ -3429,9 +3665,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3429
3665
|
if (
|
|
3430
3666
|
personDoc.status.code === '00' &&
|
|
3431
3667
|
new Date(personDoc.endDate) > new Date(Date.now()) &&
|
|
3432
|
-
(personDoc.type.code ===
|
|
3668
|
+
(personDoc.type.code === CoreEnums.GBD.DocTypes['1UDL'] || personDoc.type.code === CoreEnums.GBD.DocTypes.VNZ || personDoc.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3433
3669
|
) {
|
|
3434
|
-
const documentType = this.documentTypes.find(
|
|
3670
|
+
const documentType = this.documentTypes.find(
|
|
3671
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(personDoc.type.code)],
|
|
3672
|
+
);
|
|
3435
3673
|
if (documentType) member.documentType = documentType;
|
|
3436
3674
|
const documentNumber = personDoc.number;
|
|
3437
3675
|
if (documentNumber) member.documentNumber = documentNumber;
|
|
@@ -3439,7 +3677,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3439
3677
|
if (documentDate) member.documentDate = reformatDate(documentDate);
|
|
3440
3678
|
const documentExpire = personDoc.endDate;
|
|
3441
3679
|
if (documentExpire) member.documentExpire = reformatDate(documentExpire);
|
|
3442
|
-
const documentIssuer = this.documentIssuers.find(i =>
|
|
3680
|
+
const documentIssuer = this.documentIssuers.find(i =>
|
|
3681
|
+
(i.nameRu as string).match(
|
|
3682
|
+
new RegExp(personDoc.issueOrganization.code === '001' ? 'МЮ РК' : personDoc.issueOrganization.code === '002' ? 'МВД РК' : personDoc.issueOrganization.nameRu, 'i'),
|
|
3683
|
+
),
|
|
3684
|
+
);
|
|
3443
3685
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
3444
3686
|
}
|
|
3445
3687
|
}
|
|
@@ -3463,6 +3705,24 @@ export const useDataStore = defineStore('data', {
|
|
|
3463
3705
|
});
|
|
3464
3706
|
}
|
|
3465
3707
|
},
|
|
3708
|
+
uniqPreparePersonData(local: GroupMember) {
|
|
3709
|
+
const checkForNull = (value: any) => (value ? value : '');
|
|
3710
|
+
try {
|
|
3711
|
+
(Object.keys(local) as Array<keyof GroupMember>).forEach(key => {
|
|
3712
|
+
if (key === 'actualAddress' || key === 'legalAddress') {
|
|
3713
|
+
const address = `${checkForNull(local[key].country.nameRu)}, ${checkForNull(local[key].state.nameRu)},${
|
|
3714
|
+
local[key].region.nameRu ? ` ${local[key].region.nameRu},` : ''
|
|
3715
|
+
} ${checkForNull(local[key].regionType.nameRu)} ${checkForNull(local[key].city.nameRu)},${local[key].square ? ` квартал ${local[key].square},` : ''}${
|
|
3716
|
+
local[key].microdistrict ? ` мкр ${local[key].microdistrict},` : ''
|
|
3717
|
+
} ул. ${checkForNull(local[key].street)}, д. ${checkForNull(local[key].houseNumber)}`;
|
|
3718
|
+
local[key].longName = address;
|
|
3719
|
+
local[key].longNameKz = address;
|
|
3720
|
+
}
|
|
3721
|
+
});
|
|
3722
|
+
} catch (e) {
|
|
3723
|
+
ErrorHandler(e);
|
|
3724
|
+
}
|
|
3725
|
+
},
|
|
3466
3726
|
async startApplicationV2(data: PolicyholderClass) {
|
|
3467
3727
|
const policyholder = JSON.parse(JSON.stringify(data)) as any;
|
|
3468
3728
|
this.preparePersonData(policyholder);
|
|
@@ -3478,14 +3738,17 @@ export const useDataStore = defineStore('data', {
|
|
|
3478
3738
|
'clientData.authoritedPerson.bankInfo',
|
|
3479
3739
|
'clientData.authoritedPerson.economySectorCode',
|
|
3480
3740
|
'clientData.authoritedPerson.legalAddress',
|
|
3481
|
-
'clientData.authoritedPerson.placeOfBirth',
|
|
3482
|
-
'clientData.authoritedPerson.resident',
|
|
3483
3741
|
'clientData.authoritedPerson.taxResidentCountry',
|
|
3484
3742
|
'clientData.authoritedPerson.addTaxResidency',
|
|
3485
3743
|
]);
|
|
3486
3744
|
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3745
|
+
this.uniqPreparePersonData(policyholder.clientData);
|
|
3746
|
+
if (this.formStore.lfb.add) {
|
|
3747
|
+
policyholder.parentContractNumber = localStorage.getItem('policyNo');
|
|
3748
|
+
policyholder.parentContractId = localStorage.getItem('policyId');
|
|
3749
|
+
}
|
|
3487
3750
|
try {
|
|
3488
|
-
const response = await this.api.startApplication(policyholder);
|
|
3751
|
+
const response = await this.api.startApplication(policyholder, Number(this.processCode));
|
|
3489
3752
|
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
3490
3753
|
return response.processInstanceId;
|
|
3491
3754
|
} catch (err) {
|
|
@@ -3496,6 +3759,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3496
3759
|
const policyholder = JSON.parse(JSON.stringify(data)) as any;
|
|
3497
3760
|
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3498
3761
|
this.preparePersonData(policyholder);
|
|
3762
|
+
this.uniqPreparePersonData(policyholder.clientData);
|
|
3499
3763
|
try {
|
|
3500
3764
|
await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, policyholder);
|
|
3501
3765
|
} catch (err) {
|
|
@@ -3515,7 +3779,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3515
3779
|
this.formStore.applicationData = applicationData;
|
|
3516
3780
|
this.formStore.regNumber = applicationData.regNumber;
|
|
3517
3781
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
3518
|
-
|
|
3519
3782
|
this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
|
|
3520
3783
|
this.formStore.applicationTaskId = taskId;
|
|
3521
3784
|
this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
|
|
@@ -3536,17 +3799,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3536
3799
|
|
|
3537
3800
|
this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
|
|
3538
3801
|
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
3802
|
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();
|
|
3803
|
+
this.getClientData(clientData);
|
|
3550
3804
|
|
|
3551
3805
|
if (clientData && clientData.activityTypes !== null) {
|
|
3552
3806
|
this.formStore.lfb.policyholderActivities = clientData.activityTypes;
|
|
@@ -3566,9 +3820,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3566
3820
|
});
|
|
3567
3821
|
}
|
|
3568
3822
|
|
|
3569
|
-
if (insuredApp
|
|
3570
|
-
|
|
3571
|
-
this.formStore.lfb.clients = res;
|
|
3823
|
+
if (insuredApp === null) {
|
|
3824
|
+
await this.getInsuredsData();
|
|
3572
3825
|
}
|
|
3573
3826
|
|
|
3574
3827
|
if (accidentIncidents && accidentIncidents.length) {
|
|
@@ -3579,19 +3832,43 @@ export const useDataStore = defineStore('data', {
|
|
|
3579
3832
|
});
|
|
3580
3833
|
}
|
|
3581
3834
|
|
|
3835
|
+
this.formStore.productConditionsForm.lifeMultiply = parseProcents(applicationData.policyAppDto.lifeMultiply);
|
|
3836
|
+
this.formStore.productConditionsForm.lifeAdditive = parseProcents(applicationData.policyAppDto.lifeAdditive);
|
|
3837
|
+
this.formStore.productConditionsForm.lifeMultiplyClient = parseProcents(applicationData.policyAppDto.lifeMultiplyClient);
|
|
3838
|
+
this.formStore.productConditionsForm.lifeAdditiveClient = parseProcents(applicationData.policyAppDto.lifeAdditiveClient);
|
|
3839
|
+
this.formStore.productConditionsForm.adbMultiply = parseProcents(applicationData.policyAppDto.adbMultiply);
|
|
3840
|
+
this.formStore.productConditionsForm.adbAdditive = parseProcents(applicationData.policyAppDto.adbAdditive);
|
|
3841
|
+
this.formStore.productConditionsForm.disabilityMultiply = parseProcents(applicationData.policyAppDto.disabilityMultiply);
|
|
3842
|
+
this.formStore.productConditionsForm.disabilityAdditive = parseProcents(applicationData.policyAppDto.disabilityAdditive);
|
|
3843
|
+
|
|
3582
3844
|
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.policyAppDto.calcDate);
|
|
3583
3845
|
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.policyAppDto.contractEndDate);
|
|
3584
|
-
this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission
|
|
3846
|
+
this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission;
|
|
3585
3847
|
this.formStore.productConditionsForm.fixInsSum = this.getNumberWithSpaces(applicationData.policyAppDto.fixInsSum === 0 ? null : applicationData.policyAppDto.fixInsSum);
|
|
3586
3848
|
this.formStore.productConditionsForm.coverPeriod = 12;
|
|
3587
3849
|
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
|
-
);
|
|
3850
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
3851
|
+
applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3591
3852
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
3592
3853
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
3593
3854
|
const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
|
|
3594
3855
|
this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
|
|
3856
|
+
|
|
3857
|
+
if (applicationData.parentPolicyDto !== null) {
|
|
3858
|
+
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.parentPolicyDto.contractInsrBegin);
|
|
3859
|
+
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.parentPolicyDto.contractInsrEnd);
|
|
3860
|
+
}
|
|
3861
|
+
if (this.formStore.lfb.add) {
|
|
3862
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium);
|
|
3863
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount);
|
|
3864
|
+
if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
|
|
3865
|
+
this.formStore.productConditionsForm.amountPaid = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3866
|
+
this.formStore.productConditionsForm.amountRefunded = null;
|
|
3867
|
+
} else {
|
|
3868
|
+
this.formStore.productConditionsForm.amountRefunded = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3869
|
+
this.formStore.productConditionsForm.amountPaid = null;
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3595
3872
|
} catch (err) {
|
|
3596
3873
|
ErrorHandler(err);
|
|
3597
3874
|
if (err instanceof AxiosError) {
|
|
@@ -3670,9 +3947,9 @@ export const useDataStore = defineStore('data', {
|
|
|
3670
3947
|
return ErrorHandler(err);
|
|
3671
3948
|
}
|
|
3672
3949
|
},
|
|
3673
|
-
async saveInsuredList(insuredList: any) {
|
|
3950
|
+
async saveInsuredList(insuredList: any, newInsureds: boolean) {
|
|
3674
3951
|
try {
|
|
3675
|
-
await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, insuredList);
|
|
3952
|
+
await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, newInsureds, insuredList);
|
|
3676
3953
|
return true;
|
|
3677
3954
|
} catch (err) {
|
|
3678
3955
|
return ErrorHandler(err);
|
|
@@ -3686,6 +3963,18 @@ export const useDataStore = defineStore('data', {
|
|
|
3686
3963
|
return ErrorHandler(err);
|
|
3687
3964
|
}
|
|
3688
3965
|
},
|
|
3966
|
+
async getInsuredsData() {
|
|
3967
|
+
try {
|
|
3968
|
+
const result = await this.api.getInsuredsData(this.formStore.applicationData.processInstanceId);
|
|
3969
|
+
if (result && result.length) {
|
|
3970
|
+
this.formStore.applicationData.insuredApp = result;
|
|
3971
|
+
const res = await this.newInsuredList(result);
|
|
3972
|
+
this.formStore.lfb.clients = res;
|
|
3973
|
+
}
|
|
3974
|
+
} catch (err) {
|
|
3975
|
+
return ErrorHandler(err);
|
|
3976
|
+
}
|
|
3977
|
+
},
|
|
3689
3978
|
newInsuredList(list: any) {
|
|
3690
3979
|
const clients = list.map((item: any, index: number) => {
|
|
3691
3980
|
const client = item.insuredData;
|
|
@@ -3700,6 +3989,9 @@ export const useDataStore = defineStore('data', {
|
|
|
3700
3989
|
premium: client.insuredPolicyData.premium,
|
|
3701
3990
|
premiumWithLoad: client.insuredPolicyData.premiumWithLoad,
|
|
3702
3991
|
hasAttachedFile: client.hasAttachedFile,
|
|
3992
|
+
insrBeginDate: client.insuredPolicyData.insrBeginDate ?? 'no',
|
|
3993
|
+
insrEndDate: client.insuredPolicyData.insrEndDate ?? 'no',
|
|
3994
|
+
tableNumber: client.tableNumber,
|
|
3703
3995
|
};
|
|
3704
3996
|
});
|
|
3705
3997
|
return clients;
|
|
@@ -3748,7 +4040,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3748
4040
|
return false;
|
|
3749
4041
|
}
|
|
3750
4042
|
|
|
3751
|
-
if (this.formStore.lfb.beneficialOwners) {
|
|
4043
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.beneficialOwners) {
|
|
3752
4044
|
if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
3753
4045
|
return false;
|
|
3754
4046
|
}
|
|
@@ -3759,12 +4051,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3759
4051
|
}
|
|
3760
4052
|
}
|
|
3761
4053
|
|
|
3762
|
-
if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
4054
|
+
if (!this.formStore.lfb.add && this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3763
4055
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
|
|
3764
4056
|
return false;
|
|
3765
4057
|
}
|
|
3766
4058
|
|
|
3767
|
-
|
|
4059
|
+
const isHalykBank = this.formStore.lfb.policyholder.clientData.iin.replace(/-/g, '') === '940140000385';
|
|
4060
|
+
if (this.formStore.lfb.clients.length === 0 && !isHalykBank) {
|
|
4061
|
+
await this.getInsuredsData();
|
|
4062
|
+
}
|
|
4063
|
+
if (this.formStore.lfb.clients && !isHalykBank) {
|
|
3768
4064
|
if (this.validateMultipleMembersV2('clients', 'insuredApp', 'застрахованных') === false) {
|
|
3769
4065
|
return false;
|
|
3770
4066
|
}
|
|
@@ -3775,7 +4071,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3775
4071
|
}
|
|
3776
4072
|
}
|
|
3777
4073
|
|
|
3778
|
-
if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
4074
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3779
4075
|
for (const client of this.formStore.lfb.clients) {
|
|
3780
4076
|
if (client.hasAttachedFile === false) {
|
|
3781
4077
|
this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
|
|
@@ -3784,18 +4080,75 @@ export const useDataStore = defineStore('data', {
|
|
|
3784
4080
|
}
|
|
3785
4081
|
}
|
|
3786
4082
|
|
|
3787
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
4083
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3788
4084
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
3789
4085
|
return false;
|
|
3790
4086
|
}
|
|
3791
4087
|
|
|
3792
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
4088
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3793
4089
|
this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
|
|
3794
4090
|
return false;
|
|
3795
4091
|
}
|
|
3796
4092
|
|
|
4093
|
+
if (this.controls.hasAttachment) {
|
|
4094
|
+
const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
|
|
4095
|
+
if (areValid) {
|
|
4096
|
+
if (this.isInitiator()) {
|
|
4097
|
+
await this.setINSISWorkData();
|
|
4098
|
+
}
|
|
4099
|
+
} else {
|
|
4100
|
+
this.isLoading = false;
|
|
4101
|
+
this.showToaster('error', this.t('toaster.attachManagerError'), 3000);
|
|
4102
|
+
return false;
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
|
|
3797
4106
|
return true;
|
|
3798
4107
|
},
|
|
4108
|
+
async getOnlineAccess(iin: string, documentType: string) {
|
|
4109
|
+
try {
|
|
4110
|
+
const data = {
|
|
4111
|
+
iinBin: iin.replaceAll('-', ''),
|
|
4112
|
+
documentType: documentType,
|
|
4113
|
+
};
|
|
4114
|
+
const response = await this.api.externalServices.getOnlineAccess(data);
|
|
4115
|
+
if (response.code === 'PROFILE_DIGIDOCS_INTERNAL_ERROR') {
|
|
4116
|
+
this.showToaster('error', this.t('toaster.notDigDoc'), 3000);
|
|
4117
|
+
return false;
|
|
4118
|
+
} else {
|
|
4119
|
+
return true;
|
|
4120
|
+
}
|
|
4121
|
+
} catch (err) {
|
|
4122
|
+
ErrorHandler(err);
|
|
4123
|
+
return null;
|
|
4124
|
+
}
|
|
4125
|
+
},
|
|
4126
|
+
async getDigitalDocuments(iin: string, processInstanceId: string, code: string) {
|
|
4127
|
+
try {
|
|
4128
|
+
const data = {
|
|
4129
|
+
iin: iin.replaceAll('-', ''),
|
|
4130
|
+
processInstanceId: processInstanceId,
|
|
4131
|
+
code: code.replace(/\s/g, ''),
|
|
4132
|
+
};
|
|
4133
|
+
await this.api.externalServices.getDigitalDocuments(data);
|
|
4134
|
+
return true;
|
|
4135
|
+
} catch (err) {
|
|
4136
|
+
ErrorHandler(err);
|
|
4137
|
+
return null;
|
|
4138
|
+
}
|
|
4139
|
+
},
|
|
4140
|
+
async updateDigitalDocumentsProfile(iin: string) {
|
|
4141
|
+
try {
|
|
4142
|
+
const data = {
|
|
4143
|
+
iinBin: iin.replaceAll('-', ''),
|
|
4144
|
+
};
|
|
4145
|
+
await this.api.externalServices.updateDigitalDocumentsProfile(data);
|
|
4146
|
+
this.showToaster('success', this.t('toaster.successProfile'), 3000);
|
|
4147
|
+
} catch (err) {
|
|
4148
|
+
ErrorHandler(err);
|
|
4149
|
+
return null;
|
|
4150
|
+
}
|
|
4151
|
+
},
|
|
3799
4152
|
async getVariableData(processCode: number) {
|
|
3800
4153
|
try {
|
|
3801
4154
|
const response = await this.api.getVariableData(0, processCode);
|
|
@@ -3825,6 +4178,24 @@ export const useDataStore = defineStore('data', {
|
|
|
3825
4178
|
return ErrorHandler(err);
|
|
3826
4179
|
}
|
|
3827
4180
|
},
|
|
4181
|
+
async getBankByAccountNumber(accountNumber: string) {
|
|
4182
|
+
try {
|
|
4183
|
+
const bank = await this.api.getBankByAccountNumber(accountNumber);
|
|
4184
|
+
return bank;
|
|
4185
|
+
} catch (err) {
|
|
4186
|
+
ErrorHandler(err);
|
|
4187
|
+
}
|
|
4188
|
+
},
|
|
4189
|
+
async getContractByBin(bin: string) {
|
|
4190
|
+
try {
|
|
4191
|
+
const contract = await this.api.getContractByBin(bin);
|
|
4192
|
+
contract.insrBegin = reformatDate(contract.insrBegin) ?? '';
|
|
4193
|
+
contract.insrEnd = reformatDate(contract.insrEnd) ?? '';
|
|
4194
|
+
return contract;
|
|
4195
|
+
} catch (err) {
|
|
4196
|
+
ErrorHandler(err);
|
|
4197
|
+
}
|
|
4198
|
+
},
|
|
3828
4199
|
async isCourseChanged(processInstanceId: string) {
|
|
3829
4200
|
try {
|
|
3830
4201
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -3845,8 +4216,30 @@ export const useDataStore = defineStore('data', {
|
|
|
3845
4216
|
return ErrorHandler(err);
|
|
3846
4217
|
}
|
|
3847
4218
|
},
|
|
4219
|
+
getClientData(clientData: GroupMember) {
|
|
4220
|
+
this.formStore.lfb.policyholder.clientData = clientData;
|
|
4221
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
|
|
4222
|
+
this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
|
|
4223
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
|
|
4224
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.authorityDetails.date = reformatDate(clientData.authoritedPerson.authorityDetails.date as string);
|
|
4225
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
|
|
4226
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
|
|
4227
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
|
|
4228
|
+
const gender = this.gender.find((i: Value) => i.id === Number(clientData.authoritedPerson.gender));
|
|
4229
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.gender = gender ? gender : new Value();
|
|
4230
|
+
},
|
|
4231
|
+
async getParentApplication(bin: string) {
|
|
4232
|
+
try {
|
|
4233
|
+
const response = await this.api.getParentApplication(bin);
|
|
4234
|
+
if (response) {
|
|
4235
|
+
this.getClientData(response.clientApp.clientData);
|
|
4236
|
+
}
|
|
4237
|
+
} catch (err) {
|
|
4238
|
+
return ErrorHandler(err);
|
|
4239
|
+
}
|
|
4240
|
+
},
|
|
3848
4241
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
3849
|
-
if (this.isLifetrip || this.isPension) return false;
|
|
4242
|
+
if (this.isLifetrip || this.isPension || this.isBalam || this.isTumar) return false;
|
|
3850
4243
|
switch (whichForm) {
|
|
3851
4244
|
case this.formStore.beneficiaryFormKey:
|
|
3852
4245
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -3857,7 +4250,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3857
4250
|
}
|
|
3858
4251
|
},
|
|
3859
4252
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
3860
|
-
if (this.
|
|
4253
|
+
if (this.isPension) return false;
|
|
3861
4254
|
switch (whichForm) {
|
|
3862
4255
|
case this.formStore.beneficiaryFormKey:
|
|
3863
4256
|
return false;
|
|
@@ -3865,18 +4258,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3865
4258
|
return true;
|
|
3866
4259
|
}
|
|
3867
4260
|
},
|
|
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
4261
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
3881
4262
|
if (this.isGons || this.isPension) return false;
|
|
3882
4263
|
switch (whichForm) {
|
|
@@ -3885,7 +4266,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3885
4266
|
}
|
|
3886
4267
|
},
|
|
3887
4268
|
hasBankSection(whichForm: keyof typeof StoreMembers) {
|
|
3888
|
-
if (!this.isPension) return false;
|
|
4269
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3889
4270
|
switch (whichForm) {
|
|
3890
4271
|
case 'beneficiaryForm':
|
|
3891
4272
|
return false;
|
|
@@ -3894,7 +4275,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3894
4275
|
}
|
|
3895
4276
|
},
|
|
3896
4277
|
hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
|
|
3897
|
-
if (!this.isPension) return false;
|
|
4278
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3898
4279
|
switch (whichForm) {
|
|
3899
4280
|
case 'beneficiaryForm':
|
|
3900
4281
|
return false;
|
|
@@ -3913,44 +4294,5 @@ export const useDataStore = defineStore('data', {
|
|
|
3913
4294
|
return false;
|
|
3914
4295
|
}
|
|
3915
4296
|
},
|
|
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
4297
|
},
|
|
3956
4298
|
});
|