hl-core 0.0.10-beta.7 → 0.0.10-beta.71

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.
Files changed (49) hide show
  1. package/README.md +0 -2
  2. package/api/base.api.ts +425 -134
  3. package/api/interceptors.ts +162 -62
  4. package/components/Dialog/Dialog.vue +5 -1
  5. package/components/Dialog/DigitalDocumentsDialog.vue +129 -0
  6. package/components/Dialog/FamilyDialog.vue +15 -4
  7. package/components/Form/DigitalDocument.vue +52 -0
  8. package/components/Form/FormSource.vue +30 -0
  9. package/components/Form/ManagerAttachment.vue +85 -11
  10. package/components/Form/ProductConditionsBlock.vue +12 -6
  11. package/components/Input/Datepicker.vue +5 -0
  12. package/components/Input/FileInput.vue +1 -1
  13. package/components/Input/FormInput.vue +7 -0
  14. package/components/Input/OtpInput.vue +25 -0
  15. package/components/Input/RoundedInput.vue +2 -0
  16. package/components/Input/RoundedSelect.vue +2 -0
  17. package/components/Input/TextAreaField.vue +71 -0
  18. package/components/Input/TextHint.vue +13 -0
  19. package/components/Layout/SettingsPanel.vue +2 -1
  20. package/components/Menu/MenuNav.vue +2 -1
  21. package/components/Pages/Anketa.vue +207 -176
  22. package/components/Pages/Auth.vue +10 -3
  23. package/components/Pages/ContragentForm.vue +24 -18
  24. package/components/Pages/Documents.vue +488 -66
  25. package/components/Pages/MemberForm.vue +1009 -268
  26. package/components/Pages/ProductConditions.vue +1424 -273
  27. package/components/Panel/PanelHandler.vue +329 -126
  28. package/components/Utilities/Chip.vue +1 -1
  29. package/components/Utilities/JsonViewer.vue +1 -2
  30. package/composables/classes.ts +136 -20
  31. package/composables/constants.ts +168 -1
  32. package/composables/index.ts +467 -9
  33. package/composables/styles.ts +8 -24
  34. package/configs/i18n.ts +2 -0
  35. package/configs/pwa.ts +1 -7
  36. package/layouts/clear.vue +1 -1
  37. package/layouts/default.vue +2 -2
  38. package/layouts/full.vue +1 -1
  39. package/locales/kz.json +1239 -0
  40. package/locales/ru.json +133 -21
  41. package/nuxt.config.ts +8 -6
  42. package/package.json +14 -13
  43. package/plugins/head.ts +7 -1
  44. package/plugins/helperFunctionsPlugins.ts +1 -0
  45. package/store/data.store.ts +1080 -552
  46. package/store/member.store.ts +19 -8
  47. package/store/rules.ts +75 -8
  48. package/types/enum.ts +52 -2
  49. package/types/index.ts +143 -6
@@ -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, Roles, Statuses, MemberCodes, MemberAppCodes, Enums } from '../types/enum';
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(),
@@ -46,7 +49,7 @@ export const useDataStore = defineStore('data', {
46
49
  isBridge: state => state.product === 'efo' || state.product === 'aml' || state.product === 'lka' || state.product === 'auletti',
47
50
  isBaiterek: state => state.product === 'baiterek',
48
51
  isBolashak: state => state.product === 'bolashak',
49
- isMycar: state => state.product === 'mycar',
52
+ isMycar: state => state.product === 'halykmycar',
50
53
  isLifeBusiness: state => state.product === 'lifebusiness',
51
54
  isLifetrip: state => state.product === 'lifetrip',
52
55
  isLiferenta: state => state.product === 'liferenta',
@@ -60,10 +63,17 @@ export const useDataStore = defineStore('data', {
60
63
  isCheckContract: state => state.product === 'checkcontract',
61
64
  isCheckContragent: state => state.product === 'checkcontragent',
62
65
  isPrePension: state => state.product === 'prepensionannuity',
66
+ isCritical: state => state.product === 'criticalillness',
67
+ isBalam: state => state.product === 'balam',
68
+ isTumar: state => state.product === 'tumar',
69
+ isBorrower: state => state.product === 'borrower',
63
70
  isDSO: state => state.product === 'dso',
64
71
  isUU: state => state.product === 'uu',
65
- hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
72
+ isReInsurance: state => state.product === 'reinsurance',
73
+ isReporting: state => state.product === 'reporting',
74
+ hasClientAnketa: state => Array.isArray(state.formStore.additionalInsuranceTerms) && state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
66
75
  isClientAnketaCondition: state =>
76
+ Array.isArray(state.formStore.additionalInsuranceTerms) &&
67
77
  !state.formStore.insuredForm.find(member => member.iin === state.formStore.policyholderForm.iin) &&
68
78
  !!state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10 && i.coverSumCode === 'included'),
69
79
  },
@@ -138,7 +148,7 @@ export const useDataStore = defineStore('data', {
138
148
  if (showError) this.showToaster('error', this.t('toaster.noUrl'));
139
149
  }
140
150
  },
141
- getFilesByIIN(iin: string) {
151
+ getDocsByIIN(iin: string) {
142
152
  return iin ? this.formStore.signedDocumentList.filter(file => file.iin === iin && file.fileTypeName === 'Удостоверение личности') : null;
143
153
  },
144
154
  async getNewAccessToken() {
@@ -160,22 +170,23 @@ export const useDataStore = defineStore('data', {
160
170
  getUserRoles() {
161
171
  if (this.accessToken && this.user.roles.length === 0) {
162
172
  const decoded = jwtDecode(this.accessToken);
163
- this.user.id = decoded.sub;
164
- this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ? decoded.middleName : ''}`;
165
- const key = getKeyWithPattern(decoded, 'role');
166
- if (key) {
167
- const roles = decoded[key];
168
- if (typeof roles === 'string') {
169
- this.user.roles.push(roles);
170
- } else if (typeof roles === 'object') {
171
- this.user.roles = roles;
173
+ if (decoded) {
174
+ this.user.id = String(decoded.sub);
175
+ this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
176
+ this.user.code = decoded.code;
177
+ this.user.branchCode = decoded.branchCode;
178
+ const key = getKeyWithPattern(decoded, 'role');
179
+ if (key) {
180
+ const roles = decoded[key as keyof Types.Utils.JwtToken];
181
+ if (typeof roles === 'string') {
182
+ this.user.roles.push(roles);
183
+ } else if (typeof roles === 'object') {
184
+ this.user.roles = roles;
185
+ }
172
186
  }
173
187
  }
174
188
  }
175
189
  },
176
- getUserData() {
177
- return this.accessToken ? jwtDecode(this.accessToken) : null;
178
- },
179
190
  async getUserGroups() {
180
191
  try {
181
192
  this.isLoading = true;
@@ -186,140 +197,17 @@ export const useDataStore = defineStore('data', {
186
197
  this.isLoading = false;
187
198
  }
188
199
  },
189
- isRole(whichRole: keyof typeof Roles) {
190
- if (this.user.roles.length === 0) {
191
- this.getUserRoles();
192
- }
193
- const isRole = this.user.roles.find(i => i === whichRole);
194
- return !!isRole;
195
- },
196
- isInitiator() {
197
- return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager() || this.isAgentAuletti();
198
- },
199
- isManager() {
200
- return this.isRole(constants.roles.Manager);
201
- },
202
- isCompliance() {
203
- return this.isRole(constants.roles.Compliance);
204
- },
205
- isAdmin() {
206
- return this.isRole(constants.roles.Admin);
207
- },
208
- isJurist() {
209
- return this.isRole(constants.roles.Jurist);
210
- },
211
- isAgent() {
212
- return this.isRole(constants.roles.Agent);
213
- },
214
- isManagerHalykBank() {
215
- return this.isRole(constants.roles.ManagerHalykBank);
216
- },
217
- isServiceManager() {
218
- return this.isRole(constants.roles.ServiceManager);
219
- },
220
- isUnderwriter() {
221
- return this.isRole(constants.roles.Underwriter);
222
- },
223
- isActuary() {
224
- return this.isRole(constants.roles.Actuary);
225
- },
226
- isAgentMycar() {
227
- return this.isRole(constants.roles.AgentMycar);
228
- },
229
- isAgentAuletti() {
230
- return this.isRole(constants.roles.AgentAuletti);
231
- },
232
- isAnalyst() {
233
- return this.isRole(constants.roles.Analyst);
234
- },
235
- isUpk() {
236
- return this.isRole(constants.roles.UPK);
237
- },
238
- isUrp() {
239
- return this.isRole(constants.roles.URP);
240
- },
241
- isUsns() {
242
- return this.isRole(constants.roles.USNS);
243
- },
244
- isAccountant() {
245
- return this.isRole(constants.roles.Accountant);
246
- },
247
- isDrn() {
248
- return this.isRole(constants.roles.DRNSJ);
249
- },
250
- isSupport() {
251
- return this.isRole(constants.roles.Support);
252
- },
253
- isFinCenter() {
254
- return this.isRole(constants.roles.FinCenter);
255
- },
256
- isSupervisor() {
257
- return this.isRole(constants.roles.Supervisor);
258
- },
259
- isHeadManager() {
260
- return this.isRole(constants.roles.HeadManager);
261
- },
262
- isBranchDirector() {
263
- return this.isRole(constants.roles.BranchDirector);
264
- },
265
- isUSNSACCINS() {
266
- return this.isRole(constants.roles.USNSACCINS);
267
- },
268
- isDsuio() {
269
- return this.isRole(constants.roles.Dsuio);
270
- },
271
- isAdjuster() {
272
- return this.isRole(constants.roles.Adjuster);
273
- },
274
- isDsoDirector() {
275
- return this.isRole(constants.roles.DsoDirector);
276
- },
277
- isAccountantDirector() {
278
- return this.isRole(constants.roles.AccountantDirector);
279
- },
280
- isProcessEditable(statusCode?: keyof typeof Statuses) {
281
- const getEditibleStatuses = () => {
282
- const defaultStatuses = constants.editableStatuses;
283
- return defaultStatuses;
284
- };
285
- return !!getEditibleStatuses().find(status => status === statusCode);
286
- },
287
- isProcessReturnable(statusCode?: keyof typeof Statuses) {
288
- const getReturnableStatuses = () => {
289
- const defaultStatuses = constants.returnStatementStatuses;
290
- return defaultStatuses;
291
- };
292
- return !!getReturnableStatuses().find(status => status === statusCode);
293
- },
294
- isProcessCancel(statusCode?: keyof typeof Statuses) {
295
- const getCanceleStatuses = () => {
296
- const defaultStatuses = constants.cancelApplicationStatuses;
297
- return defaultStatuses;
298
- };
299
- return !!getCanceleStatuses().find(status => status === statusCode);
300
- },
301
- isProcessReject(statusCode?: keyof typeof Statuses) {
302
- const getRejectStatuses = () => {
303
- const defaultStatuses = constants.rejectApplicationStatuses;
304
- return defaultStatuses;
305
- };
306
- return !!getRejectStatuses().find(status => status === statusCode);
307
- },
308
200
  isTask() {
309
201
  return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
310
202
  },
311
203
  validateAccess() {
312
- try {
313
- const hasAccess = this.hasAccess();
314
- if (this.isAML) return hasAccess.toAML;
315
- if (this.isLKA) return hasAccess.toLKA;
316
- if (this.isEFO) return hasAccess.toEFO;
317
- if (this.isAULETTI) return hasAccess.toAULETTI;
318
- if (this.isLKA_A) return hasAccess.toLKA_A;
319
- return false;
320
- } catch (err) {
321
- return ErrorHandler(err);
322
- }
204
+ const hasAccess = this.hasAccess();
205
+ if (this.isAML) return hasAccess.toAML;
206
+ if (this.isLKA) return hasAccess.toLKA;
207
+ if (this.isEFO) return hasAccess.toEFO;
208
+ if (this.isAULETTI) return hasAccess.toAULETTI;
209
+ if (this.isLKA_A) return hasAccess.toLKA_A;
210
+ return false;
323
211
  },
324
212
  async loginUser(login: string, password: string, numAttempt: number) {
325
213
  try {
@@ -394,53 +282,91 @@ export const useDataStore = defineStore('data', {
394
282
  await this.router.replace({ name: route.name });
395
283
  }
396
284
  },
397
- async getFile(file: DocumentItem, mode: string = 'view', fileType: string = 'pdf') {
285
+ async getDoc(file: DocumentItem, mode: string = 'view', fileType: string = 'pdf') {
398
286
  if (!file.id) return;
399
287
  try {
400
288
  this.isLoading = true;
401
- await this.api.getFile(file.id).then((response: any) => {
402
- if (!['pdf', 'docx'].includes(fileType)) {
403
- const blob = new Blob([response], { type: `image/${fileType}` });
404
- const url = window.URL.createObjectURL(blob);
405
- const link = document.createElement('a');
406
- link.href = url;
407
- if (mode === 'view') {
408
- setTimeout(() => {
409
- window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
410
- });
289
+ if (this.isPension) {
290
+ await this.api.file.getDocNew(file.id).then((response: any) => {
291
+ if (!['pdf', 'docx'].includes(fileType)) {
292
+ const blob = new Blob([response], { type: `image/${fileType}` });
293
+ const url = window.URL.createObjectURL(blob);
294
+ const link = document.createElement('a');
295
+ link.href = url;
296
+ if (mode === 'view') {
297
+ setTimeout(() => {
298
+ window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
299
+ });
300
+ } else {
301
+ link.setAttribute('download', file.fileName!);
302
+ document.body.appendChild(link);
303
+ link.click();
304
+ }
411
305
  } else {
412
- link.setAttribute('download', file.fileName!);
413
- document.body.appendChild(link);
414
- link.click();
415
- }
416
- } else {
417
- const blob = new Blob([response], {
418
- type: `application/${fileType}`,
419
- });
420
- const url = window.URL.createObjectURL(blob);
421
- const link = document.createElement('a');
422
- link.href = url;
423
- if (mode === 'view') {
424
- setTimeout(() => {
425
- window.open(url, '_blank', `right=100`);
306
+ const blob = new Blob([response], {
307
+ type: `application/${fileType}`,
426
308
  });
309
+ const url = window.URL.createObjectURL(blob);
310
+ const link = document.createElement('a');
311
+ link.href = url;
312
+ if (mode === 'view') {
313
+ setTimeout(() => {
314
+ window.open(url, '_blank', `right=100`);
315
+ });
316
+ } else {
317
+ link.setAttribute('download', file.fileName!);
318
+ document.body.appendChild(link);
319
+ link.click();
320
+ }
321
+ }
322
+ });
323
+ } else {
324
+ await this.api.file.getDoc(file.id).then((response: any) => {
325
+ if (!['pdf', 'docx'].includes(fileType)) {
326
+ const blob = new Blob([response], { type: `image/${fileType}` });
327
+ const url = window.URL.createObjectURL(blob);
328
+ const link = document.createElement('a');
329
+ link.href = url;
330
+ if (mode === 'view') {
331
+ setTimeout(() => {
332
+ window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
333
+ });
334
+ } else {
335
+ link.setAttribute('download', file.fileName!);
336
+ document.body.appendChild(link);
337
+ link.click();
338
+ }
427
339
  } else {
428
- link.setAttribute('download', file.fileName!);
429
- document.body.appendChild(link);
430
- link.click();
340
+ const blob = new Blob([response], {
341
+ type: `application/${fileType}`,
342
+ });
343
+ const url = window.URL.createObjectURL(blob);
344
+ const link = document.createElement('a');
345
+ link.href = url;
346
+ if (mode === 'view') {
347
+ setTimeout(() => {
348
+ window.open(url, '_blank', `right=100`);
349
+ });
350
+ } else {
351
+ link.setAttribute('download', file.fileName!);
352
+ document.body.appendChild(link);
353
+ link.click();
354
+ }
431
355
  }
432
- }
433
- });
356
+ });
357
+ }
434
358
  } catch (err) {
435
359
  ErrorHandler(err);
436
360
  } finally {
437
361
  this.isLoading = false;
438
362
  }
439
363
  },
440
- async deleteFile(data: DocumentItem) {
364
+ async deleteFile(data: DocumentItem, showToaster: boolean = true) {
441
365
  try {
442
- await this.api.deleteFile(data);
443
- this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
366
+ await this.api.file.deleteFile(data);
367
+ if (showToaster) {
368
+ this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
369
+ }
444
370
  } catch (err) {
445
371
  ErrorHandler(err);
446
372
  }
@@ -448,7 +374,7 @@ export const useDataStore = defineStore('data', {
448
374
  async uploadFiles(data: FormData, load: boolean = false) {
449
375
  this.isLoading = load;
450
376
  try {
451
- await this.api.uploadFiles(data);
377
+ await this.api.file.uploadFiles(data);
452
378
  return true;
453
379
  } catch (err) {
454
380
  return ErrorHandler(err);
@@ -458,14 +384,28 @@ export const useDataStore = defineStore('data', {
458
384
  },
459
385
  async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
460
386
  this.isLoading = load;
461
- if (!member.iin) return;
387
+ const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
388
+ if (isNonResident) {
389
+ if (!member.firstName || !member.lastName) return;
390
+ } else {
391
+ if (!member.iin) return;
392
+ }
462
393
  try {
463
- const queryData = {
464
- firstName: '',
465
- lastName: '',
466
- middleName: '',
467
- iin: member.iin.replace(/-/g, ''),
468
- };
394
+ const queryData = isNonResident
395
+ ? {
396
+ firstName: member.firstName ?? '',
397
+ lastName: member.lastName ?? '',
398
+ middleName: member.middleName ?? '',
399
+ iin: '',
400
+ birthDate: member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
401
+ }
402
+ : {
403
+ firstName: '',
404
+ lastName: '',
405
+ middleName: '',
406
+ iin: member.iin ? member.iin.replace(/-/g, '') : '',
407
+ birthDate: '',
408
+ };
469
409
  const contragentResponse = await this.api.getContragent(queryData);
470
410
  if (contragentResponse.totalItems > 0) {
471
411
  if (contragentResponse.items.length === 1) {
@@ -474,25 +414,32 @@ export const useDataStore = defineStore('data', {
474
414
  const sortedByRegistrationDate = contragentResponse.items.sort(
475
415
  (left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
476
416
  );
477
- await this.serializeContragentData(member, sortedByRegistrationDate[0]);
417
+ if (!isNonResident) await this.serializeContragentData(member, sortedByRegistrationDate[0]);
478
418
  }
479
419
  member.gotFromInsis = true;
480
420
  } else {
481
421
  if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
482
422
  }
423
+ if (isNonResident) return contragentResponse;
483
424
  } catch (err) {
484
425
  ErrorHandler(err);
485
426
  }
486
427
  this.isLoading = false;
487
428
  },
488
- async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
429
+ async getContragentById(id: number, whichForm: keyof typeof StoreMembers | 'slaveInsuredForm', load: boolean = true, whichIndex: number | null = null) {
489
430
  if (Number(id) === 0) return;
490
431
  this.isLoading = load;
491
432
  try {
492
- const member = whichIndex === null ? this.formStore[whichForm as Types.SingleMember] : this.formStore[whichForm as Types.MultipleMember][whichIndex];
433
+ const member =
434
+ this.isPension && whichForm === 'slaveInsuredForm'
435
+ ? this.formStore.slaveInsuredForm
436
+ : whichIndex === null
437
+ ? this.formStore[whichForm as Types.SingleMember]
438
+ : this.formStore[whichForm as Types.MultipleMember][whichIndex];
439
+
493
440
  const contragentResponse = await this.api.getContragentById(id);
494
441
  if (contragentResponse.totalItems > 0) {
495
- await this.serializeContragentData(member, contragentResponse.items[0]);
442
+ await this.serializeContragentData(member, contragentResponse.items[0], whichForm);
496
443
  } else {
497
444
  this.showToaster('error', this.t('toaster.notFoundUser'));
498
445
  }
@@ -502,7 +449,7 @@ export const useDataStore = defineStore('data', {
502
449
  this.isLoading = false;
503
450
  }
504
451
  },
505
- async serializeContragentData(member: Member, contragent: Types.ContragentType) {
452
+ async serializeContragentData(member: Member, contragent: Types.ContragentType, whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm') {
506
453
  const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
507
454
  this.api.getContrAgentData(contragent.id),
508
455
  this.api.getContrAgentContacts(contragent.id),
@@ -524,23 +471,34 @@ export const useDataStore = defineStore('data', {
524
471
  if (addressResponse.status === 'fulfilled' && addressResponse.value && addressResponse.value.length) {
525
472
  member.response.addresses = addressResponse.value;
526
473
  }
527
- this.parseContragent(member, {
528
- personalData: contragent,
529
- data: questionairesResponse.status === 'fulfilled' ? questionairesResponse.value : undefined,
530
- contacts: contactsResponse.status === 'fulfilled' ? contactsResponse.value : undefined,
531
- documents: documentsResponse.status === 'fulfilled' ? documentsResponse.value : undefined,
532
- address: addressResponse.status === 'fulfilled' ? addressResponse.value : undefined,
533
- });
474
+ this.parseContragent(
475
+ member,
476
+ {
477
+ personalData: contragent,
478
+ data: questionairesResponse.status === 'fulfilled' ? questionairesResponse.value : undefined,
479
+ contacts: contactsResponse.status === 'fulfilled' ? contactsResponse.value : undefined,
480
+ documents: documentsResponse.status === 'fulfilled' ? documentsResponse.value : undefined,
481
+ address: addressResponse.status === 'fulfilled' ? addressResponse.value : undefined,
482
+ },
483
+ whichForm,
484
+ );
534
485
  },
535
486
  parseContragent(
536
487
  member: Member,
537
- user: { personalData: Types.ContragentType; data?: Types.ContragentQuestionaries[]; contacts?: Types.ContragentContacts[]; documents?: Types.ContragentDocuments[]; address?: Types.ContragentAddress[] },
488
+ user: {
489
+ personalData: Types.ContragentType;
490
+ data?: Types.ContragentQuestionaries[];
491
+ contacts?: Types.ContragentContacts[];
492
+ documents?: Types.ContragentDocuments[];
493
+ address?: Types.ContragentAddress[];
494
+ },
495
+ whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm',
538
496
  ) {
539
497
  member.verifyType = user.personalData.verifyType;
540
498
  member.verifyDate = user.personalData.verifyDate;
541
499
  member.iin = reformatIin(user.personalData.iin);
542
500
  member.age = String(user.personalData.age);
543
- const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
501
+ const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace ?? 'undefined', 'i')));
544
502
  member.birthPlace = country && Object.keys(country).length ? country : new Value();
545
503
  const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
546
504
  member.gender = gender ? gender : new Value();
@@ -557,13 +515,23 @@ export const useDataStore = defineStore('data', {
557
515
 
558
516
  if ('documents' in user && user.documents && user.documents.length) {
559
517
  member.documentsList = user.documents;
560
- const documentByPriority = user.documents.find(i => i.type === Enums.Insis.DocTypes['1UDL']);
518
+ const documentByPriority = user.documents.find(i => {
519
+ if (this.isLifetrip && (whichForm !== this.formStore.policyholderFormKey || this.formStore.isPolicyholderInsured === true)) {
520
+ return i.type === CoreEnums.Insis.DocTypes['PS'];
521
+ }
522
+ return i.type === CoreEnums.Insis.DocTypes['1UDL'];
523
+ });
561
524
  const userDocument = documentByPriority ? documentByPriority : user.documents[0];
562
525
  const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
563
526
  const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
564
527
  member.documentType = documentType ? documentType : new Value();
565
528
  member.documentNumber = userDocument.number;
566
529
  member.documentIssuers = documentIssuer ? documentIssuer : new Value();
530
+ if (userDocument.issuerNameRu === 'Другое') {
531
+ member.documentIssuers.issuerOtherNameRu = userDocument.issuerOtherNameRu;
532
+ member.documentIssuers.issuerOtherNameOrig = userDocument.issuerOtherNameOrig;
533
+ member.documentIssuers.issuerOtherName = userDocument.issuerOtherName;
534
+ }
567
535
  member.documentDate = reformatDate(userDocument.issueDate);
568
536
  member.documentExpire = reformatDate(userDocument.expireDate);
569
537
  }
@@ -639,23 +607,30 @@ export const useDataStore = defineStore('data', {
639
607
  if (qData && qData.from && qData.from.length && qData.field) {
640
608
  const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
641
609
  //@ts-ignore
642
- member[qData.field] = qResult ? qResult : new Value();
610
+ member[qData.field] = qResult ?? new Value();
643
611
  }
644
612
  },
645
613
  async alreadyInInsis(member: Member) {
646
- if (!member.iin) return null;
614
+ const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
615
+ if (isNonResident) {
616
+ if (!member.firstName || !member.lastName) return;
617
+ } else {
618
+ if (!member.iin) return;
619
+ }
647
620
  try {
648
621
  const queryData = {
649
- iin: member.iin.replaceAll('-', ''),
622
+ iin: !!member.iin && !isNonResident ? member.iin.replaceAll('-', '') : '',
650
623
  firstName: !!member.firstName ? member.firstName : '',
651
624
  lastName: !!member.lastName ? member.lastName : '',
652
625
  middleName: !!member.middleName ? member.middleName : '',
626
+ birthDate: !!member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
653
627
  };
654
628
  const contragent = await this.api.getContragent(queryData);
655
629
  if (contragent.totalItems > 0) {
656
630
  if (contragent.items.length === 1) {
657
631
  return contragent.items[0];
658
632
  } else {
633
+ if (this.isPension && queryData.iin === '') return contragent.items.find(i => i.id === member.id);
659
634
  const sortedByRegistrationDate = contragent.items.sort(
660
635
  (left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
661
636
  );
@@ -689,8 +664,8 @@ export const useDataStore = defineStore('data', {
689
664
  }
690
665
  },
691
666
  async saveContragent(user: Member, whichForm: keyof typeof StoreMembers | 'contragent', whichIndex: number | null, onlySaveAction: boolean = true) {
692
- if (this.isGons && user.iin && whichForm === 'beneficiaryForm' && useEnv().isProduction) {
693
- const doesHaveActiveContract = await this.api.checkBeneficiariesInActualPolicy(user.iin.replace(/-/g, ''));
667
+ if (this.isGons && user.iin && whichForm === 'beneficiaryForm') {
668
+ const doesHaveActiveContract = await this.api.checkBeneficiariesActualPolicy(String(this.formStore.applicationData.processInstanceId));
694
669
  if (doesHaveActiveContract) {
695
670
  this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
696
671
  return false;
@@ -727,7 +702,7 @@ export const useDataStore = defineStore('data', {
727
702
  const contragentData: Types.ContragentType = {
728
703
  id: Number(user.id),
729
704
  type: Number(user.type),
730
- iin: user.iin!.replace(/-/g, ''),
705
+ iin: user.iin ? user.iin.replace(/-/g, '') : '',
731
706
  longName: user.longName !== null ? user.longName : (user.lastName ?? '') + (user.firstName ?? '') + (user.middleName ?? ''),
732
707
  lastName: user.lastName ?? '',
733
708
  firstName: user.firstName ?? '',
@@ -881,6 +856,11 @@ export const useDataStore = defineStore('data', {
881
856
  verifyType: user.verifyType,
882
857
  verifyDate: user.verifyDate,
883
858
  };
859
+ if (user.documentIssuers.ids === '1') {
860
+ userDocument.issuerOtherName = user.documentIssuers.issuerOtherName;
861
+ userDocument.issuerOtherNameOrig = user.documentIssuers.issuerOtherNameOrig;
862
+ userDocument.issuerOtherNameRu = user.documentIssuers.issuerOtherNameRu;
863
+ }
884
864
  if (hasAlreadyDocument !== -1) {
885
865
  documentsData[hasAlreadyDocument] = userDocument;
886
866
  } else {
@@ -954,7 +934,12 @@ export const useDataStore = defineStore('data', {
954
934
  isTerror: member.isTerror,
955
935
  isIpdlCompliance: null,
956
936
  isTerrorCompliance: null,
937
+ fromService: this.isGons && whichMember === 'Beneficiary' ? (member.chooseChild === 'Добавить выгодоприобретателя' ? false : true) : true,
957
938
  };
939
+
940
+ if (this.isPension && memberFromApplicaiton && memberFromApplicaiton.processInstanceId === this.formStore.applicationData.slave?.processInstanceId) {
941
+ data.processInstanceId = this.formStore.applicationData.slave.processInstanceId;
942
+ }
958
943
  data.id = memberFromApplicaiton && memberFromApplicaiton.id ? memberFromApplicaiton.id : null;
959
944
  if (whichMember === 'Client') {
960
945
  data.isInsured = this.formStore.isPolicyholderInsured;
@@ -964,6 +949,12 @@ export const useDataStore = defineStore('data', {
964
949
  data.jobName = member.jobPlace;
965
950
  data.positionCode = member.positionCode;
966
951
  data.familyStatusId = member.familyStatus.id;
952
+ if (this.isPension) {
953
+ data.id =
954
+ memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
955
+ ? this.formStore.applicationData.clientApp.id
956
+ : this.formStore.applicationData.slave.clientApp.id;
957
+ }
967
958
  }
968
959
  if (whichMember === 'Spokesman') {
969
960
  if (!!memberFromApplicaiton && memberFromApplicaiton.iin !== data.iin) {
@@ -1022,6 +1013,12 @@ export const useDataStore = defineStore('data', {
1022
1013
  data.familyStatusId = member.familyStatus.id;
1023
1014
  data.relationId = member.relationDegree.ids;
1024
1015
  data.relationName = member.relationDegree.nameRu;
1016
+ if (this.isPension) {
1017
+ data.id =
1018
+ memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
1019
+ ? this.formStore.applicationData.insuredApp[0].id
1020
+ : this.formStore.applicationData.slave.insuredApp[0].id;
1021
+ }
1025
1022
  }
1026
1023
  if (whichMember === 'Beneficiary') {
1027
1024
  if (
@@ -1066,10 +1063,20 @@ export const useDataStore = defineStore('data', {
1066
1063
  }
1067
1064
  }
1068
1065
  },
1069
- async setApplication(applicationData: object, calculate: boolean = false) {
1066
+ async setApplication(applicationData: any, calculate: boolean = false) {
1070
1067
  try {
1071
1068
  this.isLoading = true;
1072
1069
  this.isButtonsLoading = true;
1070
+ if (this.isPension) {
1071
+ applicationData.transferContractCompany = '';
1072
+ if (applicationData.slave) {
1073
+ applicationData.slave.guaranteedPeriod = applicationData.slave.guaranteedPeriod ?? 0;
1074
+ applicationData.slave.transferContractCompany = '';
1075
+ }
1076
+ if (Number(this.formStore.applicationData.processCode) === 24) {
1077
+ applicationData.transferContractAmount = applicationData.parentContractAmount - applicationData.refundAmount;
1078
+ }
1079
+ }
1073
1080
  await this.api.setApplication(applicationData);
1074
1081
  if (calculate) {
1075
1082
  await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
@@ -1123,6 +1130,25 @@ export const useDataStore = defineStore('data', {
1123
1130
  conditionsData.policyAppDto.premiumInCurrency = getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
1124
1131
  conditionsData.policyAppDto.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
1125
1132
  conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
1133
+ conditionsData.policyAppDto.hasEnhancedGift = !!this.formStore.productConditionsForm.hasEnhancedGift;
1134
+ conditionsData.policyAppDto.managerHelped = this.formStore.productConditionsForm.managerHelped;
1135
+ }
1136
+ if (this.isGons) {
1137
+ conditionsData.policyAppDto.premiumInCurrency =
1138
+ this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
1139
+ conditionsData.policyAppDto.amountInCurrency =
1140
+ this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
1141
+ conditionsData.policyAppDto.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
1142
+ conditionsData.policyAppDto.currency = this.formStore.productConditionsForm.currency.code as string;
1143
+ //@ts-ignore
1144
+ if (isNaN(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, ''))) {
1145
+ conditionsData.policyAppDto.amount = parseFloat(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, '').replace(',', '.'));
1146
+ }
1147
+ //@ts-ignore
1148
+ if (isNaN(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, ''))) {
1149
+ conditionsData.policyAppDto.premium = parseFloat(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, '').replace(',', '.'));
1150
+ }
1151
+ conditionsData.policyAppDto.accureStartEducationCapital = this.formStore.productConditionsForm.accureStartEducationCapital;
1126
1152
  }
1127
1153
  if (this.isLiferenta) {
1128
1154
  conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
@@ -1210,8 +1236,10 @@ export const useDataStore = defineStore('data', {
1210
1236
  }
1211
1237
  if (value !== null && this.formStore.definedAnswersId[whichSurvey][filter].length) {
1212
1238
  const answer = this.formStore.definedAnswersId[whichSurvey][filter].find((answer: any) => answer.nameRu.match(new RegExp(value, 'i')));
1213
- //@ts-ignore
1214
- this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
1239
+ if (this.formStore[whichSurvey]) {
1240
+ //@ts-ignore
1241
+ this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
1242
+ }
1215
1243
  }
1216
1244
  return this.formStore.definedAnswersId[whichSurvey];
1217
1245
  },
@@ -1243,13 +1271,17 @@ export const useDataStore = defineStore('data', {
1243
1271
  regionPolicyName: this.formStore.RegionPolicy.nameRu ?? '',
1244
1272
  managerPolicy: this.formStore.ManagerPolicy.ids as string,
1245
1273
  managerPolicyName: this.formStore.ManagerPolicy.nameRu ?? '',
1274
+ executorGPH: (this.formStore.ExecutorGPH.ids as string) ?? undefined,
1275
+ executorGPHName: this.formStore.ExecutorGPH.nameRu ?? undefined,
1246
1276
  insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
1247
1277
  };
1248
1278
  try {
1249
1279
  this.isLoading = loading;
1250
1280
  await this.api.setINSISWorkData(data);
1281
+ return true;
1251
1282
  } catch (err) {
1252
1283
  ErrorHandler(err);
1284
+ return false;
1253
1285
  } finally {
1254
1286
  this.isLoading = false;
1255
1287
  }
@@ -1333,7 +1365,7 @@ export const useDataStore = defineStore('data', {
1333
1365
  if (this.isLifetrip) return await this.getFromApi('dicAllCountries', 'getArmDicts', 'DicCountry');
1334
1366
  },
1335
1367
  async getDicTripType() {
1336
- if (this.isLifetrip) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
1368
+ if (this.isLifetrip || this.isCalculator) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
1337
1369
  },
1338
1370
  async getDicTripPurpose() {
1339
1371
  if (this.isLifetrip) return await this.getFromApi('purposes', 'getArmDicts', 'DicTripPurpose');
@@ -1455,7 +1487,8 @@ export const useDataStore = defineStore('data', {
1455
1487
  return await this.getFromApi('economySectorCode', 'getSectorCode');
1456
1488
  },
1457
1489
  async getEconomicActivityType() {
1458
- if (this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
1490
+ const makeCall = this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension || this.isCritical;
1491
+ if (makeCall) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
1459
1492
  },
1460
1493
  async getFamilyStatuses() {
1461
1494
  return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
@@ -1466,49 +1499,57 @@ export const useDataStore = defineStore('data', {
1466
1499
  async getRelationTypes() {
1467
1500
  return await this.getFromApi('relations', 'getRelationTypes');
1468
1501
  },
1502
+ async getEkkDisabilityGroup() {
1503
+ return await this.getFromApi('ekkDisabilityGroups', 'getEkkDisabilityGroup');
1504
+ },
1469
1505
  async getBanks() {
1470
- if (this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO) return await this.getFromApi('banks', 'getBanks');
1506
+ const makeCall = this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO || this.isCritical;
1507
+ if (makeCall) return await this.getFromApi('banks', 'getBanks');
1471
1508
  },
1472
1509
  async getInsuranceCompanies() {
1473
1510
  if (this.isPension) return await this.getFromApi('transferContractCompanies', 'getInsuranceCompanies');
1474
1511
  },
1475
1512
  async getProcessIndexRate() {
1476
- if (this.processCode) {
1477
- return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
1478
- }
1513
+ const makeCall = (this.isBaiterek || this.isBolashak || this.isGons || this.isCalculator || this.isMycar) && this.processCode;
1514
+ if (makeCall) return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
1479
1515
  },
1480
1516
  async getProcessPaymentPeriod() {
1481
- if (this.processCode) {
1482
- return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
1483
- }
1517
+ const makeCall = !this.isPension && this.processCode;
1518
+ if (makeCall) return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
1519
+ },
1520
+ async getProgramType() {
1521
+ const makeCall = this.isCritical && this.processCode;
1522
+ if (makeCall) return await this.getFromApi('programType', 'getProgramType', this.processCode);
1484
1523
  },
1485
1524
  async getQuestionRefs(id?: string) {
1486
1525
  return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
1487
1526
  },
1488
- async getProcessTariff() {
1489
- if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
1490
- },
1491
1527
  async getDicAnnuityTypeList() {
1492
1528
  return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
1493
1529
  },
1494
1530
  async getProcessAnnuityPaymentPeriod() {
1495
- if (this.processCode) {
1496
- return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
1497
- }
1531
+ const makeCall = (this.isLiferenta || this.isCalculator) && this.processCode;
1532
+ if (makeCall) return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
1498
1533
  },
1499
1534
  async getInsurancePay() {
1500
1535
  return await this.getFromApi('insurancePay', 'getInsurancePay');
1501
1536
  },
1502
1537
  async getProcessGfot() {
1503
- if (this.processCode) {
1504
- return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
1505
- }
1538
+ const makeCall = (this.isLifeBusiness || this.isGns) && this.processCode;
1539
+ if (makeCall) return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
1540
+ },
1541
+ async getSource() {
1542
+ return await this.getFromApi('Source', 'getSource');
1506
1543
  },
1507
1544
  async getCurrencies() {
1508
1545
  try {
1509
- const currencies = await this.api.getCurrencies();
1510
- this.currencies = currencies;
1511
- return currencies;
1546
+ const makeCall = !this.isLKA && !this.isLKA_A;
1547
+ if (makeCall) {
1548
+ const currencies = await this.api.getCurrencies();
1549
+ this.currencies = currencies;
1550
+ return currencies;
1551
+ }
1552
+ return null;
1512
1553
  } catch (err) {
1513
1554
  console.log(err);
1514
1555
  }
@@ -1521,7 +1562,8 @@ export const useDataStore = defineStore('data', {
1521
1562
  return this.gender;
1522
1563
  },
1523
1564
  async getAuthorityBasis() {
1524
- if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension) return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
1565
+ if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension || this.isCritical)
1566
+ return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
1525
1567
  },
1526
1568
  async getWorkPosition(search: string) {
1527
1569
  try {
@@ -1549,8 +1591,8 @@ export const useDataStore = defineStore('data', {
1549
1591
  this.getFamilyStatuses(),
1550
1592
  this.getRelationTypes(),
1551
1593
  this.getProcessIndexRate(),
1552
- this.getProcessTariff(),
1553
1594
  this.getProcessPaymentPeriod(),
1595
+ this.getProgramType(),
1554
1596
  this.getDicFileTypeList(),
1555
1597
  this.getDicAnnuityTypeList(),
1556
1598
  this.getProcessAnnuityPaymentPeriod(),
@@ -1564,11 +1606,13 @@ export const useDataStore = defineStore('data', {
1564
1606
  this.getDicTripPurpose(),
1565
1607
  this.getCurrencies(),
1566
1608
  this.getProcessGfot(),
1609
+ this.getSource(),
1567
1610
  this.getBanks(),
1568
1611
  this.getInsuranceCompanies(),
1569
1612
  this.getEconomicActivityType(),
1570
1613
  this.getAuthorityBasis(),
1571
1614
  this.getDisabilityGroups(),
1615
+ this.getEkkDisabilityGroup(),
1572
1616
  ]);
1573
1617
  },
1574
1618
  async getQuestionList(
@@ -1579,12 +1623,20 @@ export const useDataStore = defineStore('data', {
1579
1623
  whichMember: 'insured' | 'policyholder' = 'insured',
1580
1624
  ) {
1581
1625
  try {
1582
- const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1583
- whichMember === 'insured' ? this.api.getQuestionList(surveyType, processInstanceId, insuredId) : this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
1626
+ const basePromise: Promise<Types.AnketaFirst> =
1584
1627
  whichMember === 'insured'
1628
+ ? this.api.getQuestionList(surveyType, processInstanceId, insuredId)
1629
+ : this.api.getClientQuestionList(surveyType, processInstanceId, insuredId);
1630
+
1631
+ const secondPromise: Promise<Types.AnketaSecond[] | null> = !this.isMycar
1632
+ ? (whichMember === 'insured'
1585
1633
  ? this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId)
1586
- : this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1587
- ,
1634
+ : this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId))
1635
+ : Promise.resolve(null);
1636
+
1637
+ const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1638
+ basePromise,
1639
+ secondPromise,
1588
1640
  ]);
1589
1641
  if (baseQuestions.status === 'fulfilled') {
1590
1642
  this.formStore[baseField] = baseQuestions.value;
@@ -1592,16 +1644,19 @@ export const useDataStore = defineStore('data', {
1592
1644
  if (secondaryQuestions.status === 'fulfilled') {
1593
1645
  const baseAnketa = this.formStore[baseField];
1594
1646
  if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
1595
- baseAnketa.body.forEach(i => {
1596
- if (i.first.definedAnswers === 'Y' && i.second === null && secondaryQuestions.value) {
1597
- i.second = structuredClone(secondaryQuestions.value);
1647
+ const isSpecialSurvey = this.isBaiterek || this.isBolashak || this.isLiferenta || this.isMycar;
1648
+ for (const i of baseAnketa.body) {
1649
+ if (i.second === null && secondaryQuestions.value) {
1650
+ i.second = isSpecialSurvey
1651
+ ? await this.api.getQuestionListSecondById(`${surveyType}second`, processInstanceId, insuredId, i.first.id)
1652
+ : structuredClone(secondaryQuestions.value);
1598
1653
  }
1599
1654
  if (i.first.definedAnswers === 'Y' && i.second && i.second.length) {
1600
1655
  i.second.forEach(second => {
1601
1656
  if (second.answerType === 'D') second.answerText = reformatDate(String(second.answerText));
1602
1657
  });
1603
1658
  }
1604
- });
1659
+ }
1605
1660
  }
1606
1661
  }
1607
1662
  } catch (err) {
@@ -1659,16 +1714,16 @@ export const useDataStore = defineStore('data', {
1659
1714
  column: column,
1660
1715
  direction: direction,
1661
1716
  groupCode: groupCode,
1662
- processCodes: Object.values(constants.products),
1717
+ processCodes: this.isEFO
1718
+ ? Object.values(constants.products).filter(
1719
+ i => i !== constants.products.pensionannuity && i !== constants.products.pensionannuityrefund && i !== constants.products.pensionannuityjoint,
1720
+ )
1721
+ : [constants.products.baiterek],
1663
1722
  };
1664
1723
  if (byOneProcess !== null) {
1665
1724
  delete query.processCodes;
1666
1725
  query.processCode = byOneProcess;
1667
1726
  }
1668
- if (byOneProcess === 19 && !useEnv().isProduction) {
1669
- query.processCodes = [19, 2];
1670
- delete query.processCode;
1671
- }
1672
1727
  const taskList = await this.api.getTaskList(
1673
1728
  processInstanceId === null
1674
1729
  ? query
@@ -1782,6 +1837,13 @@ export const useDataStore = defineStore('data', {
1782
1837
  console.log(err);
1783
1838
  }
1784
1839
  },
1840
+ async filterExecutorByRegion(filterName: string) {
1841
+ try {
1842
+ this.ExecutorGPH = await this.api.filterExecutorByRegion('ExecutorGPH', filterName);
1843
+ } catch (err) {
1844
+ console.log(err);
1845
+ }
1846
+ },
1785
1847
  async getUnderwritingCouncilData(id: string | number) {
1786
1848
  try {
1787
1849
  const response: any = await this.api.getUnderwritingCouncilData(id);
@@ -1804,7 +1866,10 @@ export const useDataStore = defineStore('data', {
1804
1866
  async getDefaultCalculationData(showLoader: boolean = false, product: string | null = null) {
1805
1867
  this.isLoading = showLoader;
1806
1868
  try {
1807
- const calculationData = await this.api.getDefaultCalculationData(this.isCalculator ? product : undefined);
1869
+ const calculationData = await this.api.getDefaultCalculationData(
1870
+ this.isCalculator ? product : undefined,
1871
+ this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns' ? Number(this.processCode) : undefined,
1872
+ );
1808
1873
  return calculationData;
1809
1874
  } catch (err) {
1810
1875
  ErrorHandler(err);
@@ -1891,6 +1956,25 @@ export const useDataStore = defineStore('data', {
1891
1956
  calculationData.premiumInCurrency = getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
1892
1957
  calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
1893
1958
  calculationData.currencyExchangeRate = this.currencies.usd;
1959
+ calculationData.hasEnhancedGift = this.formStore.productConditionsForm.hasEnhancedGift;
1960
+ calculationData.managerHelped = this.formStore.productConditionsForm.managerHelped;
1961
+ }
1962
+ if (this.isGons || product === 'gons') {
1963
+ calculationData.premiumInCurrency =
1964
+ this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
1965
+ calculationData.amountInCurrency =
1966
+ this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
1967
+ calculationData.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
1968
+
1969
+ calculationData.currency = this.formStore.productConditionsForm.currency.code as string;
1970
+ //@ts-ignore
1971
+ if (isNaN(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, ''))) {
1972
+ calculationData.amount = parseFloat(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, '').replace(',', '.'));
1973
+ }
1974
+ //@ts-ignore
1975
+ if (isNaN(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, ''))) {
1976
+ calculationData.premium = parseFloat(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, '').replace(',', '.'));
1977
+ }
1894
1978
  }
1895
1979
  if (this.isLiferenta || product === 'liferenta') {
1896
1980
  calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
@@ -1909,11 +1993,20 @@ export const useDataStore = defineStore('data', {
1909
1993
  calculationData.contractEndDate = formatDate(this.formStore.productConditionsForm.contractEndDate as string)!.toISOString();
1910
1994
  calculationData.calcDate = formatDate(this.formStore.productConditionsForm.calcDate as string)!.toISOString();
1911
1995
  }
1912
- const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
1913
- if (calculationResponse.amount) this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
1914
- if (calculationResponse.premium) this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
1996
+ const calculationResponse = await this.api.calculateWithoutApplication(
1997
+ calculationData,
1998
+ this.isCalculator ? product : undefined,
1999
+ this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns' ? Number(this.processCode) : undefined,
2000
+ );
2001
+ if (calculationResponse.amount)
2002
+ this.formStore.productConditionsForm.requestedSumInsured =
2003
+ this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.amount) : this.getNumberWithSpaces(calculationResponse.amount);
2004
+ if (calculationResponse.premium)
2005
+ this.formStore.productConditionsForm.insurancePremiumPerMonth =
2006
+ this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.premium) : this.getNumberWithSpaces(calculationResponse.premium);
2007
+
1915
2008
  this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1916
- if (this.isKazyna || product === 'halykkazyna') {
2009
+ if (this.isKazyna || product === 'halykkazyna' || this.isGons || product === 'gons') {
1917
2010
  if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
1918
2011
  this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
1919
2012
  } else {
@@ -1930,9 +2023,13 @@ export const useDataStore = defineStore('data', {
1930
2023
  this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
1931
2024
  }
1932
2025
  if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
1933
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremiumWithCommission);
2026
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(calculationResponse.mainPremiumWithCommission as number);
1934
2027
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.mainInsSum === 0 ? null : calculationResponse.mainInsSum);
1935
- this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
2028
+ const updatedCovers = calculationResponse.addCovers.map((item: any) => ({
2029
+ ...item,
2030
+ premium: 0,
2031
+ }));
2032
+ this.formStore.additionalInsuranceTermsWithout = updatedCovers;
1936
2033
  if (calculationResponse.agentCommission) {
1937
2034
  this.formStore.productConditionsForm.agentCommission = calculationResponse.agentCommission;
1938
2035
  }
@@ -1950,29 +2047,42 @@ export const useDataStore = defineStore('data', {
1950
2047
  return !!this.formStore.productConditionsForm.requestedSumInsured && !!this.formStore.productConditionsForm.insurancePremiumPerMonth;
1951
2048
  }
1952
2049
  },
1953
- async calculate(taskId: string) {
2050
+ async calculate(taskId: string, isHalykBank: boolean = false) {
1954
2051
  this.isLoading = true;
1955
2052
  try {
1956
2053
  const id = this.formStore.applicationData.processInstanceId;
1957
- if (!this.isPension) await this.api.setApplication(this.getConditionsData());
2054
+ if (!this.isPension && !(this.formStore.lfb.add && (this.isLifeBusiness || this.isGns))) await this.api.setApplication(this.getConditionsData());
1958
2055
  const result = ref();
1959
- result.value = await this.api.getCalculation(String(id));
1960
- const applicationData = await this.api.getApplicationData(taskId);
2056
+ let applicationData = null;
2057
+ if (!isHalykBank) result.value = await this.api.getCalculation(String(id));
2058
+ if (this.isLifeBusiness || this.isGns) {
2059
+ await this.getApplicationDataV2(taskId);
2060
+ return;
2061
+ } else {
2062
+ applicationData = await this.api.getApplicationData(taskId);
2063
+ }
1961
2064
  this.formStore.applicationData = applicationData;
1962
2065
  if (this.formStore.applicationData.addCoverDto) this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
1963
- if (this.isKazyna && this.currencies.usd) {
2066
+ if ((this.isKazyna || this.isGons) && this.currencies.usd) {
1964
2067
  if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
1965
2068
  this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
1966
2069
  } else {
1967
2070
  this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
1968
2071
  }
1969
2072
  }
2073
+ if (this.isKazyna) {
2074
+ this.formStore.productConditionsForm.isCalculated = applicationData.policyAppDto.isCalculated;
2075
+ }
1970
2076
  if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
1971
- this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
1972
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(applicationData.policyAppDto.premium);
2077
+ this.formStore.productConditionsForm.requestedSumInsured = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
2078
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
2079
+ ? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium)
2080
+ : this.getNumberWithSpaces(applicationData.policyAppDto.premium);
1973
2081
  } else {
1974
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
1975
- this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount);
2082
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
2083
+ this.formStore.productConditionsForm.requestedSumInsured = this.isGons
2084
+ ? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount)
2085
+ : this.getNumberWithSpaces(applicationData.policyAppDto.amount);
1976
2086
  }
1977
2087
  if (this.isLiferenta) {
1978
2088
  this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
@@ -1985,11 +2095,22 @@ export const useDataStore = defineStore('data', {
1985
2095
  this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
1986
2096
  }
1987
2097
  if (this.isLifeBusiness || this.isGns) {
1988
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
2098
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(result.value);
1989
2099
  if (applicationData.insuredApp && applicationData.insuredApp.length) {
1990
2100
  const res = await this.newInsuredList(applicationData.insuredApp);
1991
2101
  this.formStore.lfb.clients = res;
1992
2102
  }
2103
+ if (this.formStore.lfb.add) {
2104
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium);
2105
+ this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount);
2106
+ if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
2107
+ this.formStore.productConditionsForm.amountPaid = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
2108
+ this.formStore.productConditionsForm.amountRefunded = null;
2109
+ } else {
2110
+ this.formStore.productConditionsForm.amountRefunded = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
2111
+ this.formStore.productConditionsForm.amountPaid = null;
2112
+ }
2113
+ }
1993
2114
  }
1994
2115
 
1995
2116
  this.showToaster('success', this.t('toaster.calculated'), 1000);
@@ -1998,6 +2119,71 @@ export const useDataStore = defineStore('data', {
1998
2119
  }
1999
2120
  this.isLoading = false;
2000
2121
  },
2122
+ async reCalculateRefund(insSum: number, insSumMain: number, guaranteedPeriod: number, isOppv: boolean, transferContractMonthCount: number | null) {
2123
+ this.isLoading = true;
2124
+ try {
2125
+ const data = {
2126
+ processInstanceId: this.formStore.applicationData.processInstanceId,
2127
+ insSum: insSum,
2128
+ insSumMain: insSumMain,
2129
+ guaranteedPeriod: guaranteedPeriod,
2130
+ isOppv: isOppv,
2131
+ transferContractMonthCount: transferContractMonthCount,
2132
+ };
2133
+ const response = await this.api.pensionannuityNew.reCalculateRefund(data);
2134
+ } catch (err) {
2135
+ ErrorHandler(err);
2136
+ }
2137
+ this.isLoading = false;
2138
+ },
2139
+ async setIsNotCalculated(processInstanceId: string | number) {
2140
+ await this.api.setIsNotCalculated(processInstanceId);
2141
+ },
2142
+ async getDividendSchedule() {
2143
+ this.isLoading = true;
2144
+ try {
2145
+ const response = await this.api.pensionannuityNew.getDividendSchedule(this.formStore.applicationData.processInstanceId);
2146
+ return response;
2147
+ } catch (err) {
2148
+ ErrorHandler(err);
2149
+ return {
2150
+ scheduleDividend: null,
2151
+ scheduleDividend2: null,
2152
+ };
2153
+ } finally {
2154
+ this.isLoading = false;
2155
+ }
2156
+ },
2157
+ async setOppvCount(data: any, processInstanceId: string) {
2158
+ this.isLoading = true;
2159
+ try {
2160
+ const response = await this.api.pensionannuityNew.setOppvCount(processInstanceId, data);
2161
+ if (response.oppvCount === 0 && response.errocCode !== 0) {
2162
+ return ErrorHandler(response.errorMsg);
2163
+ } else {
2164
+ return response.oppvCount;
2165
+ }
2166
+ } catch (err) {
2167
+ return ErrorHandler(err);
2168
+ } finally {
2169
+ this.isLoading = false;
2170
+ }
2171
+ },
2172
+ async calcParentContractSums(closeContractCompanyCode: string, closeContractCompanyName: string, isContractClosed: boolean) {
2173
+ this.isLoading = true;
2174
+ try {
2175
+ const data = {
2176
+ processInstanceId: this.formStore.applicationData.processInstanceId,
2177
+ closeContractCompanyCode: closeContractCompanyCode,
2178
+ closeContractCompanyName: closeContractCompanyName,
2179
+ isContractClosed: isContractClosed,
2180
+ };
2181
+ const response = await this.api.pensionannuityNew.calcParentContractSums(data);
2182
+ } catch (err) {
2183
+ ErrorHandler(err);
2184
+ }
2185
+ this.isLoading = false;
2186
+ },
2001
2187
  async calculatePremium(data: any) {
2002
2188
  this.isLoading = true;
2003
2189
  try {
@@ -2084,11 +2270,6 @@ export const useDataStore = defineStore('data', {
2084
2270
  this.isLoading = onlyGet;
2085
2271
  try {
2086
2272
  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
2273
  this.formStore.regNumber = applicationData.regNumber;
2093
2274
  this.formStore.applicationData = applicationData;
2094
2275
  this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
@@ -2099,13 +2280,23 @@ export const useDataStore = defineStore('data', {
2099
2280
  this.formStore.RegionPolicy.ids = applicationData.insisWorkDataApp.regionPolicy;
2100
2281
  this.formStore.ManagerPolicy.nameRu = applicationData.insisWorkDataApp.managerPolicyName;
2101
2282
  this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
2283
+ this.formStore.ExecutorGPH.nameRu = applicationData.insisWorkDataApp.executorGPHName;
2284
+ this.formStore.ExecutorGPH.ids = applicationData.insisWorkDataApp.executorGPH;
2102
2285
  this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
2103
2286
  this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
2104
2287
  this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
2105
2288
  this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
2289
+ if ('sourceId' in applicationData.insisWorkDataApp && applicationData.insisWorkDataApp.sourceId !== null) {
2290
+ const source = this.Source.find((i: Value) => i.id === applicationData.insisWorkDataApp.sourceId);
2291
+ this.formStore.Source = source ? source : new Value();
2292
+ } else {
2293
+ const sourceEfo = this.Source.find((i: Value) => i.id === '3f9e5327-328c-4bc7-8d28-fa25c36ba153');
2294
+ this.formStore.Source = sourceEfo ? sourceEfo : new Value();
2295
+ }
2106
2296
 
2107
2297
  const clientData = applicationData.clientApp;
2108
2298
  const insuredData: any[] = applicationData.insuredApp;
2299
+ const slaveInsuredData: any = applicationData.slave?.insuredApp[0] ?? null;
2109
2300
  const beneficiaryData: any[] = applicationData.beneficiaryApp;
2110
2301
  const beneficialOwnerData: any[] = applicationData.beneficialOwnerApp;
2111
2302
  const spokesmanData: any = applicationData.spokesmanApp;
@@ -2119,6 +2310,21 @@ export const useDataStore = defineStore('data', {
2119
2310
  this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
2120
2311
  }
2121
2312
 
2313
+ if ('pensionApp' in applicationData && applicationData.pensionApp) {
2314
+ this.formStore.pensionApp = applicationData.pensionApp;
2315
+ if ('slave' in applicationData && applicationData.slave) this.formStore.pensionApp.slave = applicationData.slave.pensionApp;
2316
+ if (setProductConditions) {
2317
+ const pensionKeysWithSpace = ['compulsoryContractAmount', 'compulsoryProfContractAmount', 'voluntaryContractAmount', 'ownFundsRaisAmount'];
2318
+ pensionKeysWithSpace.forEach(key => {
2319
+ if (/\s/g.test(this.formStore.pensionApp[key]) === false) this.formStore.pensionApp[key] = this.getNumberWithSpaces(this.formStore.pensionApp[key]);
2320
+ });
2321
+ if (this.formStore.pensionApp.slave)
2322
+ pensionKeysWithSpace.forEach(key => {
2323
+ if (/\s/g.test(this.formStore.pensionApp.slave[key]) === false)
2324
+ this.formStore.pensionApp.slave[key] = this.getNumberWithSpaces(this.formStore.pensionApp.slave[key]);
2325
+ });
2326
+ }
2327
+ }
2122
2328
  if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
2123
2329
  this.formStore.finCenterData = applicationData.finCenterData;
2124
2330
  this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
@@ -2183,11 +2389,6 @@ export const useDataStore = defineStore('data', {
2183
2389
  index: null,
2184
2390
  });
2185
2391
  }
2186
-
2187
- if (applicationData.slave) {
2188
- insuredData.push(applicationData.slave.insuredApp[0]);
2189
- }
2190
-
2191
2392
  if (insuredData && insuredData.length) {
2192
2393
  insuredData.forEach((member, index) => {
2193
2394
  const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
@@ -2201,6 +2402,13 @@ export const useDataStore = defineStore('data', {
2201
2402
  }
2202
2403
  });
2203
2404
  }
2405
+ if (slaveInsuredData) {
2406
+ allMembers.push({
2407
+ ...slaveInsuredData,
2408
+ key: 'slaveInsuredForm',
2409
+ index: null,
2410
+ });
2411
+ }
2204
2412
  if (beneficiaryData && beneficiaryData.length) {
2205
2413
  beneficiaryData.forEach((member, index) => {
2206
2414
  const inStore = this.formStore.beneficiaryForm.find(each => each.id == member.insisId);
@@ -2238,18 +2446,23 @@ export const useDataStore = defineStore('data', {
2238
2446
  this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
2239
2447
  if (insuredData && insuredData.length) {
2240
2448
  insuredData.forEach((each, index) => {
2241
- this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
2242
- const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
2243
- this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
2449
+ if (each) {
2450
+ this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
2451
+ const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
2452
+ this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
2453
+ }
2244
2454
  });
2245
2455
  }
2246
-
2456
+ if (slaveInsuredData) this.setMembersFieldSlave();
2247
2457
  if (beneficiaryData && beneficiaryData.length) {
2248
2458
  beneficiaryData.forEach((each, index) => {
2249
2459
  this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
2250
2460
  const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
2251
2461
  this.formStore.beneficiaryForm[index].relationDegree = relationDegree ? relationDegree : new Value();
2252
2462
  this.formStore.beneficiaryForm[index].percentageOfPayoutAmount = each.percentage;
2463
+ if (this.isGons) {
2464
+ this.formStore.beneficiaryForm[index].chooseChild = each.fromService === false ? 'Добавить выгодоприобретателя' : each.longName;
2465
+ }
2253
2466
  if (this.isLiferenta || this.isBolashak) {
2254
2467
  const insurancePay = this.insurancePay.find((i: Value) => i.id == each.beneficiaryInsurancePayId);
2255
2468
  this.formStore.beneficiaryForm[index].insurancePay = insurancePay ? insurancePay : new Value();
@@ -2321,16 +2534,44 @@ export const useDataStore = defineStore('data', {
2321
2534
  const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
2322
2535
  this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
2323
2536
 
2324
- this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(
2325
- applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount,
2326
- );
2327
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
2328
- applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium,
2329
- );
2330
- if (this.isKazyna) {
2537
+ this.formStore.productConditionsForm.requestedSumInsured = this.isGons
2538
+ ? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount)
2539
+ : this.getNumberWithSpaces(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount);
2540
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
2541
+ ? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium)
2542
+ : this.getNumberWithSpaces(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium);
2543
+
2544
+ if (this.isGons) {
2545
+ const govPremiums = await this.api.getGovernmentPremiums(String(this.formStore.applicationData.processInstanceId));
2546
+ this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
2547
+ this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
2548
+ this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
2549
+ this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
2550
+ const currency = constants.currencyList.find(item => item.code === applicationData.policyAppDto.currency);
2551
+ this.formStore.productConditionsForm.currency = currency ? currency : new Value();
2552
+ this.formStore.productConditionsForm.accureStartEducationCapital = applicationData.policyAppDto.accureStartEducationCapital;
2553
+ }
2554
+
2555
+ if (this.isKazyna || this.isGons) {
2331
2556
  this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
2332
- this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
2557
+ this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
2558
+ this.formStore.applicationData.processCode === constants.products.halykkazynaap
2559
+ ? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premiumInCurrency)
2560
+ : this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
2561
+ if (applicationData.policyAppDto.currency === 'USD' && applicationData.policyAppDto.amount !== null && applicationData.policyAppDto.premium !== null) {
2562
+ this.currencies.usd = applicationData.policyAppDto.currencyExchangeRate;
2563
+ }
2564
+ this.formStore.productConditionsForm.hasEnhancedGift = applicationData.policyAppDto.hasEnhancedGift;
2565
+ this.formStore.productConditionsForm.isCalculated = applicationData.policyAppDto.isCalculated;
2566
+ this.formStore.productConditionsForm.managerHelped = applicationData.policyAppDto.managerHelped ?? false;
2567
+ }
2568
+
2569
+ if (this.isMycar) {
2570
+ this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.policyAppDto.contractDate);
2571
+ this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.policyAppDto.contractEndDate);
2572
+ this.formStore.productConditionsForm.tariffName = applicationData.policyAppDto.tariffName;
2333
2573
  }
2574
+
2334
2575
  const riskGroup = this.riskGroup.find(item => {
2335
2576
  if (applicationData.policyAppDto.riskGroup == 0) {
2336
2577
  return true;
@@ -2410,6 +2651,7 @@ export const useDataStore = defineStore('data', {
2410
2651
  case constants.actions.signed:
2411
2652
  case constants.actions.rejectclient:
2412
2653
  case constants.actions.accept:
2654
+ case constants.actions.recalc:
2413
2655
  case constants.actions.payed: {
2414
2656
  try {
2415
2657
  const sended = await this.sendTask(taskId, action, comment);
@@ -2463,9 +2705,14 @@ export const useDataStore = defineStore('data', {
2463
2705
  }
2464
2706
  },
2465
2707
  async createInvoice() {
2466
- if (!this.formStore.applicationData.policyAppDto?.premium) return;
2708
+ const premium =
2709
+ this.isLifeBusiness || this.isGns ? this.formStore.applicationData.policyAppDto?.mainPremiumWithCommission : this.formStore.applicationData.policyAppDto?.premium;
2710
+ if (!premium) {
2711
+ this.showToaster('error', this.t('toaster.notZeroPremium'));
2712
+ return;
2713
+ }
2467
2714
  try {
2468
- const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId, this.formStore.applicationData.policyAppDto.premium);
2715
+ const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId, premium);
2469
2716
  return !!created;
2470
2717
  } catch (err) {
2471
2718
  this.isLoading = false;
@@ -2498,14 +2745,43 @@ export const useDataStore = defineStore('data', {
2498
2745
  const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
2499
2746
  this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
2500
2747
  }
2501
- if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.applicationData.pensionApp) {
2502
- this.formStore[whichForm].bankInfo.iik = this.formStore.applicationData.pensionApp.account;
2503
- this.formStore[whichForm].bankInfo.bik = this.formStore.applicationData.pensionApp.bankBik;
2504
- const bank = this.banks.find(i => i.ids === this.formStore.applicationData.pensionApp.bankBin);
2505
- const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.applicationData.pensionApp.transferContractCompany);
2506
- this.formStore[whichForm].bankInfo.bankName = bank ? bank : new Value();
2507
- this.formStore[whichForm].bankInfo.bin = bank ? String(bank.ids) : '';
2508
- this.formStore.applicationData.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
2748
+ if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.pensionApp) {
2749
+ this.formStore[whichForm].bankInfo.iik = this.formStore.pensionApp.account;
2750
+ this.formStore[whichForm].bankInfo.bik = this.formStore.pensionApp.bankBik;
2751
+ this.formStore[whichForm].bankInfo.bankName.id = this.formStore.pensionApp.bankId;
2752
+ this.formStore[whichForm].bankInfo.bankName.nameRu = this.formStore.pensionApp.bankName;
2753
+ this.formStore[whichForm].bankInfo.bin = reformatIin(this.formStore.pensionApp.bankBin);
2754
+ const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.transferContractCompany);
2755
+ this.formStore.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
2756
+ }
2757
+ },
2758
+ setMembersFieldSlave() {
2759
+ this.formStore.slaveInsuredForm.familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData.slave['insuredApp'].familyStatusId);
2760
+ this.formStore.slaveInsuredForm.signOfIPDL = this.findObject(
2761
+ 'ipdl',
2762
+ 'nameRu',
2763
+ this.formStore.applicationData.slave.insuredApp[0].isIpdl === null ? null : this.formStore.applicationData.slave.insuredApp[0].isIpdl == true ? 'Да' : 'Нет',
2764
+ );
2765
+ this.formStore.slaveInsuredForm.gotFromInsis = false;
2766
+ if (!!this.formStore.applicationData.slave.insuredApp[0].profession) this.formStore.slaveInsuredForm.job = this.formStore.applicationData.slave.insuredApp[0].profession;
2767
+ if (!!this.formStore.applicationData.slave.insuredApp[0].position) this.formStore.slaveInsuredForm.jobPosition = this.formStore.applicationData.slave.insuredApp[0].position;
2768
+ if (!!this.formStore.applicationData.slave.insuredApp[0].jobName) this.formStore.slaveInsuredForm.jobPlace = this.formStore.applicationData.slave.insuredApp[0].jobName;
2769
+ if (!!this.formStore.applicationData.slave.insuredApp[0].positionCode)
2770
+ this.formStore.slaveInsuredForm.positionCode = this.formStore.applicationData.slave.insuredApp[0].positionCode;
2771
+ if (typeof this.formStore.applicationData.slave.insuredApp[0].isDisability === 'boolean')
2772
+ this.formStore.slaveInsuredForm.isDisability = this.formStore.applicationData.slave.insuredApp[0].isDisability;
2773
+ if (!!this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId) {
2774
+ const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId);
2775
+ this.formStore.slaveInsuredForm.disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
2776
+ }
2777
+ if (this.formStore.slaveInsuredForm.bankInfo) {
2778
+ this.formStore.slaveInsuredForm.bankInfo.iik = this.formStore.pensionApp.slave.account;
2779
+ this.formStore.slaveInsuredForm.bankInfo.bik = this.formStore.pensionApp.slave.bankBik;
2780
+ this.formStore.slaveInsuredForm.bankInfo.bankName.id = this.formStore.pensionApp.slave.bankId;
2781
+ this.formStore.slaveInsuredForm.bankInfo.bankName.nameRu = this.formStore.pensionApp.slave.bankName;
2782
+ this.formStore.slaveInsuredForm.bankInfo.bin = reformatIin(this.formStore.pensionApp.slave.bankBin);
2783
+ const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.slave.transferContractCompany);
2784
+ this.formStore.pensionApp.slave.transferContractCompany = transferCompany ? transferCompany : new Value();
2509
2785
  }
2510
2786
  },
2511
2787
  setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
@@ -2602,94 +2878,17 @@ export const useDataStore = defineStore('data', {
2602
2878
  };
2603
2879
  const data = prepareSignDocuments();
2604
2880
  if (type === 'qr') {
2605
- const groupId = await this.api.signQR(data);
2881
+ const groupId = await this.api.file.signQR(data);
2606
2882
  return groupId;
2607
2883
  } else if (type === 'qrXml') {
2608
- const signData = await this.api.signXml(data);
2884
+ const signData = await this.api.file.signXml(data);
2609
2885
  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
2886
  } else {
2688
- if (this.processCode === 19 || this.processCode === 2 || this.processCode === 4) {
2689
- const result = await this.api.signBts(data);
2887
+ if (this.processCode === 19 || this.processCode === 24 || this.processCode === 25) {
2888
+ const result = await this.api.file.signBts(data);
2690
2889
  if (result.code === 0) this.formStore.signUrls = result.data;
2691
2890
  } else {
2692
- const result = await this.api.signDocument(data);
2891
+ const result = await this.api.file.signDocument(data);
2693
2892
  this.formStore.signUrls = result;
2694
2893
  }
2695
2894
  return this.formStore.signUrls;
@@ -2698,6 +2897,84 @@ export const useDataStore = defineStore('data', {
2698
2897
  ErrorHandler(err);
2699
2898
  }
2700
2899
  },
2900
+ async nclayerSign(groupId: string, signType: number, isXml: boolean = false, processInstanceId?: string) {
2901
+ try {
2902
+ const ncaLayerClient = new NCALayerClient();
2903
+ await ncaLayerClient.connect();
2904
+ const activeTokens = await ncaLayerClient.getActiveTokens();
2905
+ const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
2906
+ const document = await this.getDocNew(groupId, signType, isXml);
2907
+ if (isXml) {
2908
+ const signedAgreement = await ncaLayerClient.signXml(storageType, document, 'SIGNATURE', '');
2909
+ const data = new FormData();
2910
+ data.append('processInstanceId', processInstanceId ?? String(this.formStore.applicationData.processInstanceId));
2911
+ data.append('xmlData', signedAgreement);
2912
+ data.append('name', 'PAEnpf_Agreement');
2913
+ data.append('format', 'xml');
2914
+ data.append('EdsXmlId', groupId);
2915
+ await this.api.file.uploadXml(data);
2916
+ } else {
2917
+ const base64EncodedSignature = await ncaLayerClient.createCMSSignatureFromBase64(storageType, document, 'SIGNATURE', true);
2918
+ await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
2919
+ }
2920
+ return true;
2921
+ } catch (err: any) {
2922
+ return err.name === 'NCALayerError' ? null : ErrorHandler(err);
2923
+ }
2924
+ },
2925
+ async getDocNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
2926
+ try {
2927
+ let response: any = await this.api.file.generalGetDoc(groupId, xml ? 5 : documentSignType);
2928
+ let blob;
2929
+ if (response.hasOwnProperty('data')) {
2930
+ const document = JSON.parse(response.data).Document;
2931
+ blob = new Blob([document.documentXml], {
2932
+ type: `application/xml`,
2933
+ });
2934
+ response = document.documentXml;
2935
+ } else {
2936
+ blob = new Blob([response], {
2937
+ type: `application/pdf`,
2938
+ });
2939
+ }
2940
+ const url = window.URL.createObjectURL(blob);
2941
+ if (!xml) {
2942
+ const link = document.createElement('a');
2943
+ link.href = url;
2944
+ link.setAttribute('download', fileName ?? `Документ ПА`);
2945
+ document.body.appendChild(link);
2946
+ link.click();
2947
+ }
2948
+ window.open(url, '_blank', `right=100`);
2949
+ return response;
2950
+ } catch (err) {
2951
+ ErrorHandler(err);
2952
+ }
2953
+ },
2954
+ async generateSign(taskId: string) {
2955
+ try {
2956
+ const signatories = await this.api.file.generateSign({ taskId });
2957
+ if (Array.isArray(signatories)) {
2958
+ signatories.forEach(signatory =>
2959
+ signatory.fileDatas?.sort(function (a: any, b: any) {
2960
+ return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
2961
+ }),
2962
+ );
2963
+ this.formStore.signatories = signatories;
2964
+ }
2965
+ } catch (err) {
2966
+ ErrorHandler(err);
2967
+ this.formStore.signatories = [];
2968
+ }
2969
+ },
2970
+ async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
2971
+ try {
2972
+ const response = await this.api.file.generalSign(data);
2973
+ return response;
2974
+ } catch (err) {
2975
+ ErrorHandler(err);
2976
+ }
2977
+ },
2701
2978
  async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
2702
2979
  try {
2703
2980
  this.isButtonsLoading = true;
@@ -2710,6 +2987,7 @@ export const useDataStore = defineStore('data', {
2710
2987
  link.href = url;
2711
2988
  switch (documentType) {
2712
2989
  case constants.documentTypes.insuredsList:
2990
+ case constants.documentTypes.insuredsListDopik:
2713
2991
  link.setAttribute('download', 'РФ-ДС-028 Список застрахованных ГССЖ_ГНС, изд.1.xls');
2714
2992
  break;
2715
2993
  case constants.documentTypes.statement:
@@ -2764,7 +3042,7 @@ export const useDataStore = defineStore('data', {
2764
3042
  name: 'Contract',
2765
3043
  format: 'pdf',
2766
3044
  };
2767
- const response: any = await this.api.generateDocument(data);
3045
+ const response: any = await this.api.file.generateDocument(data);
2768
3046
  const blob = new Blob([response], {
2769
3047
  type: `application/pdf`,
2770
3048
  });
@@ -2828,10 +3106,10 @@ export const useDataStore = defineStore('data', {
2828
3106
  this.isLoading = false;
2829
3107
  }
2830
3108
  },
2831
- async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
3109
+ async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string, iin: string = '') {
2832
3110
  if (!type || !phoneNumber || !text) return;
2833
3111
  const smsData: Types.SmsDataType = {
2834
- iin: this.formStore.applicationData.clientApp.iin,
3112
+ iin: iin === '' ? this.formStore.applicationData.clientApp.iin : iin,
2835
3113
  phoneNumber: formatPhone(phoneNumber),
2836
3114
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
2837
3115
  text: text,
@@ -2847,21 +3125,17 @@ export const useDataStore = defineStore('data', {
2847
3125
  this.isLoading = false;
2848
3126
  }
2849
3127
  },
2850
- sanitize(text: string) {
2851
- return text
2852
- .replace(/\r?\n|\r/g, '')
2853
- .replace(/\\/g, '')
2854
- .replace(/"/g, '');
2855
- },
2856
- async getSignedDocList(processInstanceId: string | number) {
2857
- if (processInstanceId !== 0) {
2858
- try {
2859
- this.formStore.signedDocumentList = await this.api.getSignedDocList({
2860
- processInstanceId: processInstanceId,
2861
- });
2862
- } catch (err) {
2863
- console.log(err);
3128
+ async getSignedDocList(...processInstanceIds: (string | number | undefined)[]) {
3129
+ const validIds = processInstanceIds.filter(id => id && id !== 0);
3130
+ try {
3131
+ for (const id of validIds) {
3132
+ const result = await this.api.file.getSignedDocList({ processInstanceId: id });
3133
+ const existingIds = new Set(this.formStore.signedDocumentList.map(doc => doc.id));
3134
+ const newDocs = result.filter(doc => !existingIds.has(doc.id));
3135
+ this.formStore.signedDocumentList.push(...newDocs);
2864
3136
  }
3137
+ } catch (err) {
3138
+ console.log(err);
2865
3139
  }
2866
3140
  },
2867
3141
  setFormsDisabled(isDisabled: boolean) {
@@ -2923,6 +3197,15 @@ export const useDataStore = defineStore('data', {
2923
3197
  }
2924
3198
  }
2925
3199
  }
3200
+ } else if (applicationKey === 'slave') {
3201
+ if (this.formStore.slaveInsuredForm && this.formStore.applicationData.slave) {
3202
+ const localSlave = this.formStore.slaveInsuredForm;
3203
+ const applicationSlave = this.formStore.applicationData.slave.insuredApp[0];
3204
+ if ((localSlave.id === applicationSlave.insisId && applicationSlave.iin === localSlave.iin?.replace(/-/g, '')) === false) {
3205
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3206
+ return false;
3207
+ }
3208
+ }
2926
3209
  } else {
2927
3210
  if (this.formStore[localKey].some(i => i.iin !== null)) {
2928
3211
  this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
@@ -2941,6 +3224,9 @@ export const useDataStore = defineStore('data', {
2941
3224
  return true;
2942
3225
  },
2943
3226
  async validateAllMembers(taskId: string, localCheck: boolean = false) {
3227
+ const policyholderDoc = this.formStore.signedDocumentList.find(
3228
+ i => i.iin === String(this.formStore.policyholderForm.iin).replaceAll('-', '') && (i.fileTypeCode === '1' || i.fileTypeCode === '2' || i.fileTypeCode === '4'),
3229
+ );
2944
3230
  if (taskId === '0') {
2945
3231
  this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
2946
3232
  return false;
@@ -2949,6 +3235,10 @@ export const useDataStore = defineStore('data', {
2949
3235
  this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
2950
3236
  return false;
2951
3237
  }
3238
+ if (useEnv().isProduction && this.isInitiator() && this.isEfoParent && this.formStore.policyholderForm.iin && !policyholderDoc) {
3239
+ this.showToaster('error', this.t('toaster.needDigDoc', { text: 'страхователя' }));
3240
+ return false;
3241
+ }
2952
3242
  if (this.members.insuredApp.has) {
2953
3243
  if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
2954
3244
  return false;
@@ -2961,6 +3251,9 @@ export const useDataStore = defineStore('data', {
2961
3251
  }
2962
3252
  }
2963
3253
  }
3254
+ if (this.formStore.applicationData.slave && this.validateMultipleMembers(this.formStore.insuredFormKey, 'slave', 'застрахованных') === false) {
3255
+ return false;
3256
+ }
2964
3257
  if (this.members.beneficiaryApp.has) {
2965
3258
  if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
2966
3259
  return false;
@@ -3009,7 +3302,11 @@ export const useDataStore = defineStore('data', {
3009
3302
  }
3010
3303
  }
3011
3304
  if (this.controls.hasAttachment) {
3012
- const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
3305
+ const areValid =
3306
+ this.formStore.SaleChanellPolicy.nameRu &&
3307
+ this.formStore.RegionPolicy.nameRu &&
3308
+ this.formStore.AgentData.fullName &&
3309
+ (this.isPension && this.isServiceManager() ? true : this.formStore.ManagerPolicy.nameRu);
3013
3310
  if (areValid) {
3014
3311
  if (this.isLifetrip && this.formStore.AgentData.fullName === 'Без агента') {
3015
3312
  this.isLoading = false;
@@ -3017,7 +3314,8 @@ export const useDataStore = defineStore('data', {
3017
3314
  return false;
3018
3315
  }
3019
3316
  if (this.isInitiator()) {
3020
- await this.setINSISWorkData();
3317
+ const isSetInsisWorkData = await this.setINSISWorkData();
3318
+ if (isSetInsisWorkData === false) return false;
3021
3319
  }
3022
3320
  } else {
3023
3321
  this.isLoading = false;
@@ -3041,6 +3339,35 @@ export const useDataStore = defineStore('data', {
3041
3339
  return ErrorHandler(err);
3042
3340
  }
3043
3341
  }
3342
+ if (this.isGons) {
3343
+ const { relationDegree } = this.formStore.beneficiaryForm[0];
3344
+ const siblingRelationIds = ['14', '15', '24', '25'];
3345
+ const grandchildRelationIds = ['20', '21'];
3346
+ let hasSiblingRelationId = siblingRelationIds.includes(String(relationDegree?.ids));
3347
+ let hasGrandchildRelationId = grandchildRelationIds.includes(String(relationDegree?.ids));
3348
+ const hasRelationDoc = this.formStore.signedDocumentList.filter(i => i.fileTypeCode === '46' || i.fileTypeCode === '53').length >= 2;
3349
+
3350
+ if (hasSiblingRelationId && !hasRelationDoc) {
3351
+ this.isLoading = false;
3352
+ hasSiblingRelationId = false;
3353
+ this.showToaster('error', this.t('toaster.siblingRelationDoc'), 3000);
3354
+ return false;
3355
+ }
3356
+ if (hasGrandchildRelationId && !hasRelationDoc) {
3357
+ this.isLoading = false;
3358
+ hasGrandchildRelationId = false;
3359
+ this.showToaster('error', this.t('toaster.grandchildRelationDoc'), 3000);
3360
+ return false;
3361
+ }
3362
+ }
3363
+ if (this.isPension && this.formStore.hasRepresentative) {
3364
+ const requiredIds = ['16', '24'];
3365
+
3366
+ const missingDocuments = requiredIds.filter(id => !this.formStore.signedDocumentList.some(i => i.fileTypeCode === id));
3367
+ if (missingDocuments.length > 0) {
3368
+ this.showToaster('error', this.t('toaster.missingDocuments'), 3000);
3369
+ }
3370
+ }
3044
3371
  return true;
3045
3372
  },
3046
3373
  validateAnketa(whichSurvey: 'surveyByHealthBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBase' | 'surveyByCriticalBasePolicyholder') {
@@ -3077,7 +3404,12 @@ export const useDataStore = defineStore('data', {
3077
3404
  this.isLoading = true;
3078
3405
  const areMembersValid = await this.validateAllMembers(taskId);
3079
3406
  if (areMembersValid) {
3080
- if ((!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) || this.isPension) {
3407
+ if (
3408
+ (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) ||
3409
+ (this.isPension &&
3410
+ this.formStore.applicationData.pensionApp.isCalculated === true &&
3411
+ (this.formStore.applicationData.pensionApp.slave ? this.formStore.applicationData.pensionApp.slave.isCalculated === true : true))
3412
+ ) {
3081
3413
  if (this.controls.hasAnketa) {
3082
3414
  const hasCritical =
3083
3415
  this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
@@ -3229,6 +3561,22 @@ export const useDataStore = defineStore('data', {
3229
3561
  this.isLoading = false;
3230
3562
  }
3231
3563
  },
3564
+ async getChildren(iin: string) {
3565
+ this.isLoading = true;
3566
+ try {
3567
+ const res = await this.api.externalServices.getOnlineChildAccess({
3568
+ iinBin: iin.replace(/-/g, ''),
3569
+ methodName: "CHILDREN"
3570
+ })
3571
+ if(res.children && res.children.length) {
3572
+ this.formStore.children = res.children;
3573
+ }
3574
+ } catch (err) {
3575
+ ErrorHandler(err);
3576
+ } finally {
3577
+ this.isLoading = false;
3578
+ }
3579
+ },
3232
3580
  async getKgd(iin: string) {
3233
3581
  try {
3234
3582
  const data = {
@@ -3244,13 +3592,16 @@ export const useDataStore = defineStore('data', {
3244
3592
  if (!this.accessToken) return null;
3245
3593
  try {
3246
3594
  const decoded = jwtDecode(this.accessToken);
3247
- const data = {
3248
- userName: decoded.code,
3249
- branchName: decoded.branchCode,
3250
- bin: bin.replace(/-/g, ''),
3251
- };
3252
- const gbdulResponse = await this.api.getGbdUl(data);
3253
- return gbdulResponse;
3595
+ if (decoded) {
3596
+ const data = {
3597
+ userName: decoded.code,
3598
+ branchName: decoded.branchCode,
3599
+ bin: bin.replace(/-/g, ''),
3600
+ };
3601
+ const gbdulResponse = await this.api.getGbdUl(data);
3602
+ return gbdulResponse;
3603
+ }
3604
+ return null;
3254
3605
  } catch (err) {
3255
3606
  return ErrorHandler(err);
3256
3607
  }
@@ -3332,69 +3683,72 @@ export const useDataStore = defineStore('data', {
3332
3683
  const gender = this.gender.find((i: Value) => i.id == person.gender.code);
3333
3684
  if (gender) member.gender = gender;
3334
3685
 
3335
- const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
3686
+ const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu ?? 'undefined', 'i')));
3336
3687
  if (birthPlace) member.birthPlace = birthPlace;
3337
3688
 
3338
- const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu, 'i')));
3689
+ const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu ?? 'undefined', 'i')));
3339
3690
  if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
3340
3691
 
3341
- const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu, 'i')));
3692
+ const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu ?? 'undefined', 'i')));
3342
3693
  if (regCountry) member.registrationCountry = regCountry;
3343
3694
 
3344
- const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu, 'i')));
3695
+ const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')));
3345
3696
  if (regProvince) member.registrationProvince = regProvince;
3697
+ else member.registrationProvince = new Value();
3346
3698
 
3347
- if ('city' in person.regAddress && !!person.regAddress.city) {
3348
- if (person.regAddress.city.includes(', ')) {
3349
- const personCities = person.regAddress.city.split(', ');
3699
+ let hasSetCity = false;
3700
+ let hasSetRegion = false;
3701
+ if (person.regAddress.city && String(person.regAddress.city).includes(', ')) {
3702
+ const personCities = String(person.regAddress.city).split(', ');
3703
+ for (let ind = 0; ind < personCities.length; ++ind) {
3704
+ const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
3705
+ if (possibleCity) {
3706
+ member.registrationCity = possibleCity;
3707
+ hasSetCity = true;
3708
+ break;
3709
+ }
3710
+ }
3711
+ if (member.registrationCity.nameRu === null) {
3350
3712
  for (let ind = 0; ind < personCities.length; ++ind) {
3351
- const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
3352
- if (possibleCity) {
3353
- member.registrationCity = possibleCity;
3713
+ const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
3714
+ if (possibleRegion) {
3715
+ member.registrationRegion = possibleRegion;
3716
+ hasSetRegion = true;
3354
3717
  break;
3355
3718
  }
3356
3719
  }
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
3720
  }
3375
3721
  }
3376
3722
 
3377
- if (member.registrationCity.nameRu === null && member.registrationRegion.nameRu === null) {
3723
+ if (hasSetCity === false) {
3378
3724
  const regCity = this.cities.find(
3379
- i => String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu, 'i')) || String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu, 'i')),
3725
+ i =>
3726
+ String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
3727
+ String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
3728
+ String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
3380
3729
  );
3381
3730
  if (regCity) {
3382
3731
  member.registrationCity = regCity;
3383
3732
  const regType = this.localityTypes.find(i => String(i.nameRu) === 'город');
3384
3733
  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
- }
3734
+ } else member.registrationCity = new Value();
3735
+ }
3736
+
3737
+ if (hasSetRegion === false) {
3738
+ const regRegion = this.regions.find(
3739
+ i =>
3740
+ String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
3741
+ String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
3742
+ String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
3743
+ );
3744
+ if (regRegion) {
3745
+ member.registrationRegion = regRegion;
3746
+ const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
3747
+ if (regType) member.registrationRegionType = regType;
3748
+ } else member.registrationRegion = new Value();
3395
3749
  }
3396
3750
 
3397
- if (person.regAddress.street.includes(', ')) {
3751
+ if (person.regAddress.street && person.regAddress.street.includes(', ')) {
3398
3752
  const personAddress = person.regAddress.street.split(', ');
3399
3753
  const microDistrict = personAddress.find((i: string) => i.match(new RegExp('микрорайон', 'i')));
3400
3754
  const quarter = personAddress.find((i: string) => i.match(new RegExp('квартал', 'i')));
@@ -3409,19 +3763,28 @@ export const useDataStore = defineStore('data', {
3409
3763
  if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
3410
3764
 
3411
3765
  if (Array.isArray(person.documents.document)) {
3412
- const validDocument = person.documents.document.find(
3413
- i =>
3414
- new Date(i.endDate) > new Date(Date.now()) &&
3415
- i.status.code === '00' &&
3416
- (i.type.code === Enums.GBD.DocTypes['1UDL'] || i.type.code === Enums.GBD.DocTypes.VNZ || i.type.code === Enums.GBD.DocTypes.PS),
3417
- );
3766
+ const filteredDocuments = person.documents.document.filter(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00');
3767
+ const validDocument = this.isLifetrip
3768
+ ? filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS)
3769
+ : filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes['1UDL']) ??
3770
+ filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.VNZ) ??
3771
+ filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS);
3418
3772
  if (validDocument) {
3419
- const documentType = this.documentTypes.find((i: Value) => i.ids === Object.keys(Enums.GBD.DocTypes)[Object.values(Enums.GBD.DocTypes).indexOf(validDocument.type.code)]);
3773
+ const documentType = this.documentTypes.find(
3774
+ (i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(validDocument.type.code)],
3775
+ );
3420
3776
  if (documentType) member.documentType = documentType;
3421
3777
  if (validDocument.number) member.documentNumber = validDocument.number;
3422
3778
  if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
3423
3779
  if (validDocument.endDate) member.documentExpire = reformatDate(validDocument.endDate);
3424
- const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
3780
+ const documentIssuer = this.documentIssuers.find(i =>
3781
+ (i.nameRu as string).match(
3782
+ new RegExp(
3783
+ validDocument.issueOrganization.code === '001' ? 'МЮ РК' : validDocument.issueOrganization.code === '002' ? 'МВД РК' : validDocument.issueOrganization.nameRu,
3784
+ 'i',
3785
+ ),
3786
+ ),
3787
+ );
3425
3788
  if (documentIssuer) member.documentIssuers = documentIssuer;
3426
3789
  }
3427
3790
  } else {
@@ -3429,9 +3792,11 @@ export const useDataStore = defineStore('data', {
3429
3792
  if (
3430
3793
  personDoc.status.code === '00' &&
3431
3794
  new Date(personDoc.endDate) > new Date(Date.now()) &&
3432
- (personDoc.type.code === Enums.GBD.DocTypes['1UDL'] || personDoc.type.code === Enums.GBD.DocTypes.VNZ || personDoc.type.code === Enums.GBD.DocTypes.PS)
3795
+ (personDoc.type.code === CoreEnums.GBD.DocTypes['1UDL'] || personDoc.type.code === CoreEnums.GBD.DocTypes.VNZ || personDoc.type.code === CoreEnums.GBD.DocTypes.PS)
3433
3796
  ) {
3434
- const documentType = this.documentTypes.find((i: Value) => i.ids === Object.keys(Enums.GBD.DocTypes)[Object.values(Enums.GBD.DocTypes).indexOf(personDoc.type.code)]);
3797
+ const documentType = this.documentTypes.find(
3798
+ (i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(personDoc.type.code)],
3799
+ );
3435
3800
  if (documentType) member.documentType = documentType;
3436
3801
  const documentNumber = personDoc.number;
3437
3802
  if (documentNumber) member.documentNumber = documentNumber;
@@ -3439,7 +3804,11 @@ export const useDataStore = defineStore('data', {
3439
3804
  if (documentDate) member.documentDate = reformatDate(documentDate);
3440
3805
  const documentExpire = personDoc.endDate;
3441
3806
  if (documentExpire) member.documentExpire = reformatDate(documentExpire);
3442
- const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
3807
+ const documentIssuer = this.documentIssuers.find(i =>
3808
+ (i.nameRu as string).match(
3809
+ new RegExp(personDoc.issueOrganization.code === '001' ? 'МЮ РК' : personDoc.issueOrganization.code === '002' ? 'МВД РК' : personDoc.issueOrganization.nameRu, 'i'),
3810
+ ),
3811
+ );
3443
3812
  if (documentIssuer) member.documentIssuers = documentIssuer;
3444
3813
  }
3445
3814
  }
@@ -3463,6 +3832,24 @@ export const useDataStore = defineStore('data', {
3463
3832
  });
3464
3833
  }
3465
3834
  },
3835
+ uniqPreparePersonData(local: GroupMember) {
3836
+ const checkForNull = (value: any) => (value ? value : '');
3837
+ try {
3838
+ (Object.keys(local) as Array<keyof GroupMember>).forEach(key => {
3839
+ if (key === 'actualAddress' || key === 'legalAddress') {
3840
+ const address = `${checkForNull(local[key].country.nameRu)}, ${checkForNull(local[key].state.nameRu)},${
3841
+ local[key].region.nameRu ? ` ${local[key].region.nameRu},` : ''
3842
+ } ${checkForNull(local[key].regionType.nameRu)} ${checkForNull(local[key].city.nameRu)},${local[key].square ? ` квартал ${local[key].square},` : ''}${
3843
+ local[key].microdistrict ? ` мкр ${local[key].microdistrict},` : ''
3844
+ } ул. ${checkForNull(local[key].street)}, д. ${checkForNull(local[key].houseNumber)}`;
3845
+ local[key].longName = address;
3846
+ local[key].longNameKz = address;
3847
+ }
3848
+ });
3849
+ } catch (e) {
3850
+ ErrorHandler(e);
3851
+ }
3852
+ },
3466
3853
  async startApplicationV2(data: PolicyholderClass) {
3467
3854
  const policyholder = JSON.parse(JSON.stringify(data)) as any;
3468
3855
  this.preparePersonData(policyholder);
@@ -3474,18 +3861,18 @@ export const useDataStore = defineStore('data', {
3474
3861
  'clientData.addTaxResidency',
3475
3862
  'clientData.gender',
3476
3863
  'clientData.placeOfBirth',
3477
- 'clientData.authoritedPerson.actualAddress',
3478
3864
  'clientData.authoritedPerson.bankInfo',
3479
3865
  'clientData.authoritedPerson.economySectorCode',
3480
- 'clientData.authoritedPerson.legalAddress',
3481
- 'clientData.authoritedPerson.placeOfBirth',
3482
- 'clientData.authoritedPerson.resident',
3483
- 'clientData.authoritedPerson.taxResidentCountry',
3484
3866
  'clientData.authoritedPerson.addTaxResidency',
3485
3867
  ]);
3486
3868
  policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
3869
+ this.uniqPreparePersonData(policyholder.clientData);
3870
+ if (this.formStore.lfb.add) {
3871
+ policyholder.parentContractNumber = localStorage.getItem('policyNo');
3872
+ policyholder.parentContractId = localStorage.getItem('policyId');
3873
+ }
3487
3874
  try {
3488
- const response = await this.api.startApplication(policyholder);
3875
+ const response = await this.api.startApplication(policyholder, Number(this.processCode));
3489
3876
  this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
3490
3877
  return response.processInstanceId;
3491
3878
  } catch (err) {
@@ -3496,6 +3883,7 @@ export const useDataStore = defineStore('data', {
3496
3883
  const policyholder = JSON.parse(JSON.stringify(data)) as any;
3497
3884
  policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
3498
3885
  this.preparePersonData(policyholder);
3886
+ this.uniqPreparePersonData(policyholder.clientData);
3499
3887
  try {
3500
3888
  await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, policyholder);
3501
3889
  } catch (err) {
@@ -3511,11 +3899,13 @@ export const useDataStore = defineStore('data', {
3511
3899
  this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
3512
3900
  return;
3513
3901
  }
3514
-
3515
3902
  this.formStore.applicationData = applicationData;
3516
3903
  this.formStore.regNumber = applicationData.regNumber;
3517
- this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
3518
-
3904
+ const updatedCovers = applicationData.addCoverDto.map((item: any) => ({
3905
+ ...item,
3906
+ premium: 0,
3907
+ }));
3908
+ this.formStore.additionalInsuranceTerms = updatedCovers;
3519
3909
  this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
3520
3910
  this.formStore.applicationTaskId = taskId;
3521
3911
  this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
@@ -3536,17 +3926,8 @@ export const useDataStore = defineStore('data', {
3536
3926
 
3537
3927
  this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
3538
3928
  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
3929
  this.formStore.lfb.clientId = clientId;
3544
- this.formStore.lfb.policyholder.clientData.authoritedPerson.authorityDetails.date = reformatDate(clientData.authoritedPerson.authorityDetails.date);
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();
3930
+ this.getClientData(clientData);
3550
3931
 
3551
3932
  if (clientData && clientData.activityTypes !== null) {
3552
3933
  this.formStore.lfb.policyholderActivities = clientData.activityTypes;
@@ -3566,9 +3947,8 @@ export const useDataStore = defineStore('data', {
3566
3947
  });
3567
3948
  }
3568
3949
 
3569
- if (insuredApp && insuredApp.length) {
3570
- const res = await this.newInsuredList(insuredApp);
3571
- this.formStore.lfb.clients = res;
3950
+ if (insuredApp === null) {
3951
+ await this.getInsuredsData();
3572
3952
  }
3573
3953
 
3574
3954
  if (accidentIncidents && accidentIncidents.length) {
@@ -3579,19 +3959,43 @@ export const useDataStore = defineStore('data', {
3579
3959
  });
3580
3960
  }
3581
3961
 
3962
+ this.formStore.productConditionsForm.lifeMultiply = parseProcents(applicationData.policyAppDto.lifeMultiply);
3963
+ this.formStore.productConditionsForm.lifeAdditive = parseProcents(applicationData.policyAppDto.lifeAdditive);
3964
+ this.formStore.productConditionsForm.lifeMultiplyClient = parseProcents(applicationData.policyAppDto.lifeMultiplyClient);
3965
+ this.formStore.productConditionsForm.lifeAdditiveClient = parseProcents(applicationData.policyAppDto.lifeAdditiveClient);
3966
+ this.formStore.productConditionsForm.adbMultiply = parseProcents(applicationData.policyAppDto.adbMultiply);
3967
+ this.formStore.productConditionsForm.adbAdditive = parseProcents(applicationData.policyAppDto.adbAdditive);
3968
+ this.formStore.productConditionsForm.disabilityMultiply = parseProcents(applicationData.policyAppDto.disabilityMultiply);
3969
+ this.formStore.productConditionsForm.disabilityAdditive = parseProcents(applicationData.policyAppDto.disabilityAdditive);
3970
+
3582
3971
  this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.policyAppDto.calcDate);
3583
3972
  this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.policyAppDto.contractEndDate);
3584
- this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission === 0 ? null : applicationData.policyAppDto.agentCommission;
3973
+ this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission;
3585
3974
  this.formStore.productConditionsForm.fixInsSum = this.getNumberWithSpaces(applicationData.policyAppDto.fixInsSum === 0 ? null : applicationData.policyAppDto.fixInsSum);
3586
3975
  this.formStore.productConditionsForm.coverPeriod = 12;
3587
3976
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount === 0 ? null : applicationData.policyAppDto.amount);
3588
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
3589
- applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : applicationData.policyAppDto.mainPremiumWithCommission,
3590
- );
3977
+ this.formStore.productConditionsForm.insurancePremiumPerMonth =
3978
+ applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
3591
3979
  const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
3592
3980
  this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
3593
3981
  const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
3594
3982
  this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
3983
+
3984
+ if (applicationData.parentPolicyDto !== null) {
3985
+ this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.parentPolicyDto.contractInsrBegin);
3986
+ this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.parentPolicyDto.contractInsrEnd);
3987
+ }
3988
+ if (this.formStore.lfb.add) {
3989
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium);
3990
+ this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount);
3991
+ if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
3992
+ this.formStore.productConditionsForm.amountPaid = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
3993
+ this.formStore.productConditionsForm.amountRefunded = null;
3994
+ } else {
3995
+ this.formStore.productConditionsForm.amountRefunded = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
3996
+ this.formStore.productConditionsForm.amountPaid = null;
3997
+ }
3998
+ }
3595
3999
  } catch (err) {
3596
4000
  ErrorHandler(err);
3597
4001
  if (err instanceof AxiosError) {
@@ -3670,12 +4074,13 @@ export const useDataStore = defineStore('data', {
3670
4074
  return ErrorHandler(err);
3671
4075
  }
3672
4076
  },
3673
- async saveInsuredList(insuredList: any) {
4077
+ async saveInsuredList(insuredList: any, newInsureds: boolean) {
3674
4078
  try {
3675
- await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, insuredList);
4079
+ await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, newInsureds, insuredList);
3676
4080
  return true;
3677
4081
  } catch (err) {
3678
- return ErrorHandler(err);
4082
+ ErrorHandler(err);
4083
+ return false;
3679
4084
  }
3680
4085
  },
3681
4086
  async saveInsured(insured: any) {
@@ -3686,6 +4091,18 @@ export const useDataStore = defineStore('data', {
3686
4091
  return ErrorHandler(err);
3687
4092
  }
3688
4093
  },
4094
+ async getInsuredsData() {
4095
+ try {
4096
+ const result = await this.api.getInsuredsData(this.formStore.applicationData.processInstanceId);
4097
+ if (result && result.length) {
4098
+ this.formStore.applicationData.insuredApp = result;
4099
+ const res = await this.newInsuredList(result);
4100
+ this.formStore.lfb.clients = res;
4101
+ }
4102
+ } catch (err) {
4103
+ return ErrorHandler(err);
4104
+ }
4105
+ },
3689
4106
  newInsuredList(list: any) {
3690
4107
  const clients = list.map((item: any, index: number) => {
3691
4108
  const client = item.insuredData;
@@ -3700,6 +4117,9 @@ export const useDataStore = defineStore('data', {
3700
4117
  premium: client.insuredPolicyData.premium,
3701
4118
  premiumWithLoad: client.insuredPolicyData.premiumWithLoad,
3702
4119
  hasAttachedFile: client.hasAttachedFile,
4120
+ insrBeginDate: client.insuredPolicyData.insrBeginDate ?? 'no',
4121
+ insrEndDate: client.insuredPolicyData.insrEndDate ?? 'no',
4122
+ tableNumber: client.tableNumber,
3703
4123
  };
3704
4124
  });
3705
4125
  return clients;
@@ -3748,7 +4168,7 @@ export const useDataStore = defineStore('data', {
3748
4168
  return false;
3749
4169
  }
3750
4170
 
3751
- if (this.formStore.lfb.beneficialOwners) {
4171
+ if (!this.formStore.lfb.add && this.formStore.lfb.beneficialOwners) {
3752
4172
  if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
3753
4173
  return false;
3754
4174
  }
@@ -3759,12 +4179,16 @@ export const useDataStore = defineStore('data', {
3759
4179
  }
3760
4180
  }
3761
4181
 
3762
- if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
4182
+ if (!this.formStore.lfb.add && this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
3763
4183
  this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
3764
4184
  return false;
3765
4185
  }
3766
4186
 
3767
- if (this.formStore.lfb.clients) {
4187
+ const isHalykBank = this.formStore.lfb.policyholder.clientData.iin.replace(/-/g, '') === '940140000385';
4188
+ if (this.formStore.lfb.clients.length === 0 && !isHalykBank) {
4189
+ await this.getInsuredsData();
4190
+ }
4191
+ if (this.formStore.lfb.clients && !isHalykBank) {
3768
4192
  if (this.validateMultipleMembersV2('clients', 'insuredApp', 'застрахованных') === false) {
3769
4193
  return false;
3770
4194
  }
@@ -3775,7 +4199,7 @@ export const useDataStore = defineStore('data', {
3775
4199
  }
3776
4200
  }
3777
4201
 
3778
- if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
4202
+ if (!this.formStore.lfb.add && this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
3779
4203
  for (const client of this.formStore.lfb.clients) {
3780
4204
  if (client.hasAttachedFile === false) {
3781
4205
  this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
@@ -3784,18 +4208,88 @@ export const useDataStore = defineStore('data', {
3784
4208
  }
3785
4209
  }
3786
4210
 
3787
- if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
4211
+ if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
3788
4212
  this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
3789
4213
  return false;
3790
4214
  }
3791
4215
 
3792
- if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
4216
+ if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
3793
4217
  this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
3794
4218
  return false;
3795
4219
  }
3796
4220
 
4221
+ if (this.controls.hasAttachment) {
4222
+ const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
4223
+ if (areValid) {
4224
+ if (this.isInitiator()) {
4225
+ const isSetInsisWorkData = await this.setINSISWorkData();
4226
+ if (isSetInsisWorkData === false) return false;
4227
+ }
4228
+ } else {
4229
+ this.isLoading = false;
4230
+ this.showToaster('error', this.t('toaster.attachManagerError'), 3000);
4231
+ return false;
4232
+ }
4233
+ }
4234
+
3797
4235
  return true;
3798
4236
  },
4237
+ async getOnlineAccess(iin: string, documentType: string) {
4238
+ try {
4239
+ const data = {
4240
+ iinBin: iin.replaceAll('-', ''),
4241
+ documentType: documentType,
4242
+ };
4243
+ const response = await this.api.externalServices.getOnlineAccess(data);
4244
+ if (response.code === 'PROFILE_DIGIDOCS_INTERNAL_ERROR') {
4245
+ this.showToaster('error', this.t('toaster.notDigDoc'), 3000);
4246
+ return false;
4247
+ } else {
4248
+ return true;
4249
+ }
4250
+ } catch (err) {
4251
+ ErrorHandler(err);
4252
+ return null;
4253
+ }
4254
+ },
4255
+ async getOnlineChildAccess(iin: string, documentType: string, childId: string) {
4256
+ try {
4257
+ const data = {
4258
+ iinBin: iin.replaceAll('-', ''),
4259
+ documentType: documentType,
4260
+ childId: childId,
4261
+ }
4262
+ return await this.api.externalServices.getOnlineChildAccess(data);
4263
+ } catch (err) {
4264
+ ErrorHandler(err);
4265
+ return null;
4266
+ }
4267
+ },
4268
+ async getDigitalDocuments(iin: string, code: string, processInstanceId?: string) {
4269
+ try {
4270
+ const data = {
4271
+ iin: iin.replaceAll('-', ''),
4272
+ ...(processInstanceId ? { processInstanceId } : {}),
4273
+ code: code.replace(/\s/g, ''),
4274
+ };
4275
+ return await this.api.externalServices.getDigitalDocuments(data);
4276
+ } catch (err) {
4277
+ ErrorHandler(err);
4278
+ return null;
4279
+ }
4280
+ },
4281
+ async updateDigitalDocumentsProfile(iin: string) {
4282
+ try {
4283
+ const data = {
4284
+ iinBin: iin.replaceAll('-', ''),
4285
+ };
4286
+ await this.api.externalServices.updateDigitalDocumentsProfile(data);
4287
+ this.showToaster('success', this.t('toaster.successProfile'), 3000);
4288
+ } catch (err) {
4289
+ ErrorHandler(err);
4290
+ return null;
4291
+ }
4292
+ },
3799
4293
  async getVariableData(processCode: number) {
3800
4294
  try {
3801
4295
  const response = await this.api.getVariableData(0, processCode);
@@ -3808,6 +4302,28 @@ export const useDataStore = defineStore('data', {
3808
4302
  return null;
3809
4303
  }
3810
4304
  },
4305
+ async getProcessDividendPeriods() {
4306
+ try {
4307
+ if (!this.processCode) return null;
4308
+ const response = await this.api.getProcessDividendPeriods(this.processCode);
4309
+ return response;
4310
+ } catch (err) {
4311
+ ErrorHandler(err);
4312
+ return null;
4313
+ }
4314
+ },
4315
+ async checkExistProcess(iin: string, processCode: number) {
4316
+ try {
4317
+ const response = await this.api.checkExistProcess(iin, processCode);
4318
+ if (!!response) {
4319
+ ErrorHandler(response);
4320
+ }
4321
+ return !!response;
4322
+ } catch (err) {
4323
+ ErrorHandler(err);
4324
+ return true;
4325
+ }
4326
+ },
3811
4327
  async checkIIN(iin: string) {
3812
4328
  try {
3813
4329
  const response = await this.api.checkIIN(iin);
@@ -3825,6 +4341,24 @@ export const useDataStore = defineStore('data', {
3825
4341
  return ErrorHandler(err);
3826
4342
  }
3827
4343
  },
4344
+ async getBankByAccountNumber(accountNumber: string) {
4345
+ try {
4346
+ const bank = await this.api.getBankByAccountNumber(accountNumber);
4347
+ return bank;
4348
+ } catch (err) {
4349
+ ErrorHandler(err);
4350
+ }
4351
+ },
4352
+ async getContractByBin(bin: string) {
4353
+ try {
4354
+ const contract = await this.api.getContractByBin(bin);
4355
+ contract.insrBegin = reformatDate(contract.insrBegin) ?? '';
4356
+ contract.insrEnd = reformatDate(contract.insrEnd) ?? '';
4357
+ return contract;
4358
+ } catch (err) {
4359
+ ErrorHandler(err);
4360
+ }
4361
+ },
3828
4362
  async isCourseChanged(processInstanceId: string) {
3829
4363
  try {
3830
4364
  const response = await this.api.isCourseChanged(processInstanceId);
@@ -3845,8 +4379,54 @@ export const useDataStore = defineStore('data', {
3845
4379
  return ErrorHandler(err);
3846
4380
  }
3847
4381
  },
4382
+ getClientData(clientData: GroupMember) {
4383
+ this.formStore.lfb.policyholder.clientData = clientData;
4384
+ this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
4385
+ this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
4386
+ const person = this.formStore.lfb.policyholder.clientData.authoritedPerson;
4387
+ person.iin = reformatIin(clientData.authoritedPerson.iin);
4388
+ person.authorityDetails.date = reformatDate(clientData.authoritedPerson.authorityDetails.date as string);
4389
+ person.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
4390
+ person.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
4391
+ person.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
4392
+ const gender = this.gender.find((i: Value) => i.id === Number(clientData.authoritedPerson.gender));
4393
+ person.gender = gender ? gender : new Value();
4394
+ person.legalAddress ??= new Address();
4395
+ person.actualAddress ??= new Address();
4396
+ person.taxResidentCountry ??= new Value();
4397
+ },
4398
+ async getParentApplication(bin: string) {
4399
+ try {
4400
+ const response = await this.api.getParentApplication(bin);
4401
+ if (response) {
4402
+ this.getClientData(response.clientApp.clientData);
4403
+ }
4404
+ } catch (err) {
4405
+ return ErrorHandler(err);
4406
+ }
4407
+ },
4408
+ async saveDocumentIssuer(name: string, insisId: number) {
4409
+ try {
4410
+ await this.api.saveDocumentIssuer(name, insisId);
4411
+ } catch (err) {
4412
+ ErrorHandler(err);
4413
+ return null;
4414
+ }
4415
+ },
4416
+ hasPersonalDataSection(whichForm: keyof typeof StoreMembers) {
4417
+ if (!this.isMycar) return true;
4418
+ return whichForm !== this.formStore.beneficiaryFormKey;
4419
+ },
4420
+ hasPlaceRegistrationSection(whichForm: keyof typeof StoreMembers) {
4421
+ if (!this.isMycar) return true;
4422
+ return whichForm !== this.formStore.beneficiaryFormKey;
4423
+ },
4424
+ hasDocumentDataSection(whichForm: keyof typeof StoreMembers) {
4425
+ if (!this.isMycar) return true;
4426
+ return whichForm !== this.formStore.beneficiaryFormKey;
4427
+ },
3848
4428
  hasJobSection(whichForm: keyof typeof StoreMembers) {
3849
- if (this.isLifetrip || this.isPension) return false;
4429
+ if (this.isLifetrip || this.isPension || this.isBalam || this.isBorrower || this.isTumar) return false;
3850
4430
  switch (whichForm) {
3851
4431
  case this.formStore.beneficiaryFormKey:
3852
4432
  case this.formStore.beneficialOwnerFormKey:
@@ -3857,7 +4437,7 @@ export const useDataStore = defineStore('data', {
3857
4437
  }
3858
4438
  },
3859
4439
  hasBirthSection(whichForm: keyof typeof StoreMembers) {
3860
- if (this.isGons || this.isPension) return false;
4440
+ if (this.isPension) return false;
3861
4441
  switch (whichForm) {
3862
4442
  case this.formStore.beneficiaryFormKey:
3863
4443
  return false;
@@ -3865,36 +4445,23 @@ export const useDataStore = defineStore('data', {
3865
4445
  return true;
3866
4446
  }
3867
4447
  },
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
4448
  hasContactSection(whichForm: keyof typeof StoreMembers) {
3881
4449
  if (this.isGons || this.isPension) return false;
3882
- switch (whichForm) {
3883
- default:
3884
- return true;
3885
- }
4450
+ if (this.isMycar && whichForm === this.formStore.beneficiaryFormKey) return false;
4451
+ return true;
3886
4452
  },
3887
4453
  hasBankSection(whichForm: keyof typeof StoreMembers) {
3888
- if (!this.isPension) return false;
4454
+ if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
3889
4455
  switch (whichForm) {
3890
4456
  case 'beneficiaryForm':
4457
+ case 'policyholdersRepresentativeForm':
3891
4458
  return false;
3892
4459
  default:
3893
4460
  return true;
3894
4461
  }
3895
4462
  },
3896
4463
  hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
3897
- if (!this.isPension) return false;
4464
+ if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
3898
4465
  switch (whichForm) {
3899
4466
  case 'beneficiaryForm':
3900
4467
  return false;
@@ -3913,44 +4480,5 @@ export const useDataStore = defineStore('data', {
3913
4480
  return false;
3914
4481
  }
3915
4482
  },
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
4483
  },
3956
4484
  });