hl-core 0.0.9-beta.4 → 0.0.9-beta.40

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 (61) hide show
  1. package/api/base.api.ts +904 -0
  2. package/api/index.ts +2 -620
  3. package/api/interceptors.ts +58 -14
  4. package/components/Button/Btn.vue +2 -2
  5. package/components/Complex/MessageBlock.vue +2 -2
  6. package/components/Complex/Page.vue +1 -1
  7. package/components/Dialog/Dialog.vue +60 -15
  8. package/components/Form/DynamicForm.vue +100 -0
  9. package/components/Form/FormBlock.vue +12 -3
  10. package/components/Form/FormData.vue +114 -0
  11. package/components/Form/FormToggle.vue +9 -3
  12. package/components/Form/ManagerAttachment.vue +150 -86
  13. package/components/Form/ProductConditionsBlock.vue +59 -6
  14. package/components/Input/Datepicker.vue +1 -8
  15. package/components/Input/DynamicInput.vue +23 -0
  16. package/components/Input/FileInput.vue +16 -4
  17. package/components/Input/FormInput.vue +1 -3
  18. package/components/Input/Monthpicker.vue +33 -0
  19. package/components/Input/PanelInput.vue +5 -1
  20. package/components/Input/RoundedEmptyField.vue +5 -0
  21. package/components/Input/RoundedSelect.vue +13 -0
  22. package/components/Input/SwitchInput.vue +64 -0
  23. package/components/Input/TextInput.vue +161 -0
  24. package/components/Layout/Drawer.vue +17 -4
  25. package/components/Layout/Header.vue +23 -2
  26. package/components/Layout/SettingsPanel.vue +13 -7
  27. package/components/Menu/InfoMenu.vue +35 -0
  28. package/components/Menu/MenuNav.vue +17 -2
  29. package/components/Pages/Anketa.vue +140 -52
  30. package/components/Pages/Auth.vue +12 -1
  31. package/components/Pages/ContragentForm.vue +129 -50
  32. package/components/Pages/Documents.vue +72 -7
  33. package/components/Pages/InvoiceInfo.vue +1 -1
  34. package/components/Pages/MemberForm.vue +269 -96
  35. package/components/Pages/ProductAgreement.vue +1 -8
  36. package/components/Pages/ProductConditions.vue +798 -168
  37. package/components/Panel/PanelHandler.vue +373 -45
  38. package/components/Panel/PanelSelectItem.vue +17 -2
  39. package/components/Panel/RightPanelCloser.vue +7 -0
  40. package/components/Transitions/Animation.vue +28 -0
  41. package/composables/axios.ts +2 -1
  42. package/composables/classes.ts +415 -8
  43. package/composables/constants.ts +65 -2
  44. package/composables/fields.ts +291 -0
  45. package/composables/index.ts +58 -5
  46. package/composables/styles.ts +22 -10
  47. package/layouts/default.vue +48 -3
  48. package/locales/ru.json +460 -12
  49. package/nuxt.config.ts +1 -1
  50. package/package.json +25 -22
  51. package/pages/Token.vue +1 -12
  52. package/plugins/helperFunctionsPlugins.ts +0 -3
  53. package/plugins/vuetifyPlugin.ts +2 -0
  54. package/store/data.store.ts +1031 -224
  55. package/store/extractStore.ts +17 -0
  56. package/store/form.store.ts +13 -1
  57. package/store/member.store.ts +1 -1
  58. package/store/rules.ts +53 -5
  59. package/types/enum.ts +37 -0
  60. package/types/form.ts +94 -0
  61. package/types/index.ts +216 -20
@@ -3,7 +3,7 @@ import { rules } from './rules';
3
3
  import { i18n } from '../configs/i18n';
4
4
  import { Toast, Types, Positions, ToastOptions } from './toast';
5
5
  import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
6
- import { DataStoreClass, Contragent, DocumentItem, Member, Value } from '../composables/classes';
6
+ import { DataStoreClass, Contragent, DocumentItem, Member, Value, CountryValue, MemberV2, PolicyholderActivity, BeneficialOwner } from '../composables/classes';
7
7
  import { ApiClass } from '../api';
8
8
  import { useFormStore } from './form.store';
9
9
  import { AxiosError } from 'axios';
@@ -22,6 +22,7 @@ export const useDataStore = defineStore('data', {
22
22
  formStore: useFormStore(),
23
23
  // contragent: useContragentStore(),
24
24
  api: new ApiClass(),
25
+ rController: new AbortController(),
25
26
  yearEnding: (year: number) => yearEnding(year, constants.yearTitles, constants.yearCases),
26
27
  currentDate: () => new Date(Date.now() - new Date().getTimezoneOffset() * 60 * 1000).toISOString().slice(0, -1),
27
28
  showToaster: (type: 'success' | 'error' | 'warning' | 'info', msg: string, timeout?: number) =>
@@ -44,9 +45,14 @@ export const useDataStore = defineStore('data', {
44
45
  isLiferenta: state => state.product === 'liferenta',
45
46
  isGons: state => state.product === 'gons',
46
47
  isKazyna: state => state.product === 'halykkazyna',
48
+ isDas: state => state.product === 'daskamkorlyk',
49
+ isPension: state => state.product === 'pensionannuity',
50
+ isAmulet: state => state.product === 'amuletlife',
47
51
  isCalculator: state => state.product === 'calculator',
48
52
  isCheckContract: state => state.product === 'checkcontract',
49
53
  isCheckContragent: state => state.product === 'checkcontragent',
54
+ isDSO: state => state.product === 'dso',
55
+ isUU: state => state.product === 'uu',
50
56
  isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
51
57
  hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
52
58
  isClientAnketaCondition: state =>
@@ -73,16 +79,41 @@ export const useDataStore = defineStore('data', {
73
79
  childFrame.contentWindow.postMessage({ action: action, value: value }, '*');
74
80
  }
75
81
  },
76
- copyToClipboard(text: any) {
82
+ abortRequests() {
83
+ try {
84
+ this.rController.abort();
85
+ this.rController = new AbortController();
86
+ } catch (err) {
87
+ console.log(err);
88
+ }
89
+ },
90
+ async copyToClipboard(text: unknown, showError: boolean = true) {
77
91
  if (typeof text === 'string' || typeof text === 'number') {
78
- if (this.isBridge) {
79
- navigator.clipboard.writeText(String(text));
92
+ if (navigator.clipboard && window.isSecureContext) {
93
+ if (this.isBridge) {
94
+ await navigator.clipboard.writeText(String(text));
95
+ this.showToaster('success', this.t('toaster.copied'));
96
+ } else {
97
+ this.sendToParent(constants.postActions.clipboard, String(text));
98
+ }
80
99
  } else {
81
- this.sendToParent(constants.postActions.clipboard, String(text));
100
+ const textarea = document.createElement('textarea');
101
+ textarea.value = String(text);
102
+ textarea.style.position = 'absolute';
103
+ textarea.style.left = '-99999999px';
104
+ document.body.prepend(textarea);
105
+ textarea.select();
106
+ try {
107
+ document.execCommand('copy');
108
+ this.showToaster('success', this.t('toaster.copied'));
109
+ } catch (err) {
110
+ console.log(err);
111
+ } finally {
112
+ textarea.remove();
113
+ }
82
114
  }
83
- this.showToaster('success', this.t('toaster.copied'));
84
115
  } else {
85
- this.showToaster('error', this.t('toaster.noUrl'));
116
+ if (showError) this.showToaster('error', this.t('toaster.noUrl'));
86
117
  }
87
118
  },
88
119
  getFilesByIIN(iin: string) {
@@ -185,6 +216,9 @@ export const useDataStore = defineStore('data', {
185
216
  isSupervisor() {
186
217
  return this.isRole(constants.roles.Supervisor);
187
218
  },
219
+ isHeadManager() {
220
+ return this.isRole(constants.roles.HeadManager);
221
+ },
188
222
  isProcessEditable(statusCode?: keyof typeof Statuses) {
189
223
  const getEditibleStatuses = () => {
190
224
  const defaultStatuses = constants.editableStatuses;
@@ -227,24 +261,15 @@ export const useDataStore = defineStore('data', {
227
261
  this.getUserRoles();
228
262
  }
229
263
  const checkPermission = () => {
264
+ const hasAccess = this.hasAccess();
230
265
  if (this.isAML) {
231
- return this.isCompliance() || this.isAdmin() || this.isSupport() || this.isAnalyst();
266
+ return hasAccess.toAML;
232
267
  }
233
268
  if (this.isLKA) {
234
- return this.isAgent() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
269
+ return hasAccess.toLKA;
235
270
  }
236
271
  if (this.isEFO) {
237
- return (
238
- this.isInitiator() ||
239
- this.isUnderwriter() ||
240
- this.isAdmin() ||
241
- this.isCompliance() ||
242
- this.isAnalyst() ||
243
- this.isUpk() ||
244
- this.isFinCenter() ||
245
- this.isSupervisor() ||
246
- this.isSupport()
247
- );
272
+ return hasAccess.toEFO;
248
273
  }
249
274
  return false;
250
275
  };
@@ -288,6 +313,7 @@ export const useDataStore = defineStore('data', {
288
313
  },
289
314
  async resetSelected(route: RouteType) {
290
315
  this.settings.open = false;
316
+ this.rightPanel.open = false;
291
317
  this.panel.open = false;
292
318
  this.panelAction = null;
293
319
  this.menu.selectedItem = new MenuItem();
@@ -387,6 +413,7 @@ export const useDataStore = defineStore('data', {
387
413
  this.isLoading = false;
388
414
  },
389
415
  async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
416
+ if (Number(id) === 0) return;
390
417
  this.isLoading = load;
391
418
  try {
392
419
  const member = whichIndex === null ? this.formStore[whichForm as SingleMember] : this.formStore[whichForm as MultipleMember][whichIndex];
@@ -440,9 +467,9 @@ export const useDataStore = defineStore('data', {
440
467
  member.verifyDate = user.personalData.verifyDate;
441
468
  member.iin = reformatIin(user.personalData.iin);
442
469
  member.age = String(user.personalData.age);
443
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
470
+ const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
444
471
  member.birthPlace = country && Object.keys(country).length ? country : new Value();
445
- const gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
472
+ const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
446
473
  member.gender = gender ? gender : new Value();
447
474
  member.gender.id = user.personalData.gender;
448
475
  member.birthDate = reformatDate(user.personalData.birthDate);
@@ -464,8 +491,8 @@ export const useDataStore = defineStore('data', {
464
491
  return user.documents.find(i => i.type === '1UDL');
465
492
  })();
466
493
  const userDocument = documentByPriority ? documentByPriority : user.documents[0];
467
- const documentType = this.documentTypes.find(i => i.ids === userDocument.type);
468
- const documentIssuer = this.documentIssuers.find(i => i.nameRu === userDocument.issuerNameRu);
494
+ const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
495
+ const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
469
496
  member.documentType = documentType ? documentType : new Value();
470
497
  member.documentNumber = userDocument.number;
471
498
  member.documentIssuers = documentIssuer ? documentIssuer : new Value();
@@ -477,16 +504,22 @@ export const useDataStore = defineStore('data', {
477
504
  user.data.forEach(questData => {
478
505
  this.searchFromList(member, questData);
479
506
  });
507
+ if (this.isLifetrip) {
508
+ const lastNameLat = user.data.find(obj => obj.questId === '500147');
509
+ const firstNameLat = user.data.find(obj => obj.questId === '500148');
510
+ member.lastNameLat = lastNameLat ? (lastNameLat.questAnswer as string) : null;
511
+ member.firstNameLat = firstNameLat ? (firstNameLat.questAnswer as string) : null;
512
+ }
480
513
  }
481
514
  if ('address' in user && user.address && user.address.length) {
482
515
  const userAddress = user.address[0];
483
516
  const countryName = userAddress.countryName;
484
517
  if (countryName) {
485
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(countryName, 'i')));
518
+ const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(countryName, 'i')));
486
519
  member.registrationCountry = country ? country : new Value();
487
520
  }
488
- const province = this.states.find(i => i.ids === userAddress.stateCode);
489
- const localityType = this.localityTypes.find(i => i.nameRu === userAddress.cityTypeName);
521
+ const province = this.states.find((i: Value) => i.ids === userAddress.stateCode);
522
+ const localityType = this.localityTypes.find((i: Value) => i.nameRu === userAddress.cityTypeName);
490
523
  const city = this.cities.find(i => !!userAddress.cityName && i.nameRu === userAddress.cityName.replace('г.', ''));
491
524
  const region = this.regions.find(i => !!userAddress.regionCode && i.ids == userAddress.regionCode);
492
525
  member.registrationStreet = userAddress.streetName;
@@ -536,7 +569,7 @@ export const useDataStore = defineStore('data', {
536
569
  };
537
570
  const qData = getQuestionariesData();
538
571
  if (qData && qData.from && qData.from.length && qData.field) {
539
- const qResult = qData.from.find(i => i.ids === searchIt.questAnswer);
572
+ const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
540
573
  //@ts-ignore
541
574
  member[qData.field] = qResult ? qResult : new Value();
542
575
  }
@@ -588,6 +621,13 @@ export const useDataStore = defineStore('data', {
588
621
  }
589
622
  },
590
623
  async saveContragent(user: Member, whichForm: keyof typeof StoreMembers | 'contragent', whichIndex: number | null, onlySaveAction: boolean = true) {
624
+ if (this.isGons && user.iin && whichForm === 'beneficiaryForm' && useEnv().isProduction) {
625
+ const doesHaveActiveContract = await this.api.checkBeneficiariesInActualPolicy(user.iin.replace(/-/g, ''));
626
+ if (doesHaveActiveContract) {
627
+ this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
628
+ return false;
629
+ }
630
+ }
591
631
  this.isLoading = !onlySaveAction;
592
632
  const hasInsisId = await this.alreadyInInsis(user);
593
633
  if (typeof hasInsisId === 'number') {
@@ -685,6 +725,26 @@ export const useDataStore = defineStore('data', {
685
725
  });
686
726
  }
687
727
  }
728
+ if (this.isLifetrip) {
729
+ const lastNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500147') : undefined;
730
+ const firstNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500148') : undefined;
731
+ questionariesData.push({
732
+ id: lastNameLat ? lastNameLat.id : 0,
733
+ contragentId: Number(user.id),
734
+ questAnswer: user.lastNameLat ?? '',
735
+ questAnswerName: null,
736
+ questName: 'Фамилия на латинице',
737
+ questId: '500147',
738
+ });
739
+ questionariesData.push({
740
+ id: firstNameLat ? firstNameLat.id : 0,
741
+ contragentId: Number(user.id),
742
+ questAnswer: user.firstNameLat ?? '',
743
+ questAnswerName: null,
744
+ questName: 'Имя на латинице',
745
+ questId: '500148',
746
+ });
747
+ }
688
748
 
689
749
  const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
690
750
  const contactsData: ContragentContacts[] = [];
@@ -952,7 +1012,7 @@ export const useDataStore = defineStore('data', {
952
1012
  annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
953
1013
  indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
954
1014
  ? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
955
- : this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
1015
+ : this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
956
1016
  paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id ?? undefined,
957
1017
  lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply ?? ''),
958
1018
  lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive ?? ''),
@@ -975,6 +1035,12 @@ export const useDataStore = defineStore('data', {
975
1035
  conditionsData.policyAppDto.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
976
1036
  conditionsData.policyAppDto.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
977
1037
  }
1038
+ if (this.isLifeBusiness) {
1039
+ conditionsData.policyAppDto.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
1040
+ conditionsData.policyAppDto.fixInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
1041
+ conditionsData.policyAppDto.tariffId = String(this.formStore.productConditionsForm.processTariff.id);
1042
+ conditionsData.policyAppDto.processDefinitionFgotId = (this.formStore.productConditionsForm.processGfot.id as string) ?? undefined;
1043
+ }
978
1044
  return conditionsData;
979
1045
  },
980
1046
  async clearAddCovers(coverCode: number, coverValue: string) {
@@ -993,6 +1059,8 @@ export const useDataStore = defineStore('data', {
993
1059
  }
994
1060
  },
995
1061
  async deleteInsuredLogic() {
1062
+ // TODO Просмотреть
1063
+ if (this.isLifetrip) return;
996
1064
  const applicationData = this.getConditionsData();
997
1065
  const clearCovers = [{ code: 10, value: 'excluded' }];
998
1066
  await Promise.allSettled(
@@ -1051,7 +1119,7 @@ export const useDataStore = defineStore('data', {
1051
1119
  this.isLoading = false;
1052
1120
  }
1053
1121
  },
1054
- async setINSISWorkData() {
1122
+ async setINSISWorkData(loading: boolean = true) {
1055
1123
  if (!this.formStore.applicationData.insisWorkDataApp) return;
1056
1124
  const data: InsisWorkDataApp = {
1057
1125
  id: this.formStore.applicationData.insisWorkDataApp.id,
@@ -1070,7 +1138,7 @@ export const useDataStore = defineStore('data', {
1070
1138
  insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
1071
1139
  };
1072
1140
  try {
1073
- this.isLoading = true;
1141
+ this.isLoading = loading;
1074
1142
  await this.api.setINSISWorkData(data);
1075
1143
  } catch (err) {
1076
1144
  ErrorHandler(err);
@@ -1145,7 +1213,28 @@ export const useDataStore = defineStore('data', {
1145
1213
  return this[whichField];
1146
1214
  },
1147
1215
  async getCountries() {
1148
- return await this.getFromApi('countries', 'getCountries');
1216
+ const response = await this.getFromApi('countries', 'getCountries');
1217
+ const kzIndex = response.findIndex(country => country.ids === 'KZ');
1218
+ if (kzIndex !== -1) {
1219
+ const element = response.splice(kzIndex, 1)[0];
1220
+ response.splice(0, 0, element);
1221
+ }
1222
+ return response;
1223
+ },
1224
+ async getDicCountries() {
1225
+ if (this.isLifetrip) return await this.getFromApi('dicAllCountries', 'getArmDicts', 'DicCountry');
1226
+ },
1227
+ async getDicTripType() {
1228
+ if (this.isLifetrip) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
1229
+ },
1230
+ async getDicTripPurpose() {
1231
+ if (this.isLifetrip) return await this.getFromApi('purposes', 'getArmDicts', 'DicTripPurpose');
1232
+ },
1233
+ async getDicTripWorkType() {
1234
+ if (this.isLifetrip) return await this.getFromApi('workTypes', 'getArmDicts', 'DicTripWorkType');
1235
+ },
1236
+ async getDicSportsType() {
1237
+ if (this.isLifetrip) return await this.getFromApi('sportsTypes', 'getArmDicts', 'DicSportsType');
1149
1238
  },
1150
1239
  async getCitizenshipCountries() {
1151
1240
  return await this.getFromApi('citizenshipCountries', 'getCitizenshipCountries');
@@ -1156,30 +1245,93 @@ export const useDataStore = defineStore('data', {
1156
1245
  async getAdditionalTaxCountries() {
1157
1246
  return await this.getFromApi('addTaxCountries', 'getAdditionalTaxCountries');
1158
1247
  },
1159
- async getStates(key?: string, member?: Member) {
1248
+ async getStates(key?: string, member?: Member, keys?: { key?: string; deepKey?: string; subDeepKey?: string }) {
1160
1249
  await this.getFromApi('states', 'getStates');
1161
- //@ts-ignore
1162
- if (key && member[key] && member[key].ids !== null) return this.states.filter(i => i.code === member[key].ids);
1250
+ if (!!keys) {
1251
+ if (!!keys.key) {
1252
+ if (!!keys.deepKey) {
1253
+ if (!!keys.subDeepKey) {
1254
+ //@ts-ignore
1255
+ return this.states.filter(i => i.code === member[keys.key][keys.deepKey][keys.subDeepKey].ids || i.code === member[keys.key][keys.deepKey][keys.subDeepKey].id);
1256
+ } else {
1257
+ //@ts-ignore
1258
+ return this.states.filter(i => i.code === member[keys.key][keys.deepKey].ids || i.code === member[keys.key][keys.deepKey].id);
1259
+ }
1260
+ } else {
1261
+ //@ts-ignore
1262
+ return this.states.filter(i => i.code === member[keys.key].ids || i.code === member[keys.key].id);
1263
+ }
1264
+ }
1265
+ } else {
1266
+ //@ts-ignore
1267
+ if (key && member[key] && member[key].ids !== null) return this.states.filter((i: Value) => i.code === member[key].ids);
1268
+ }
1163
1269
  return this.states;
1164
1270
  },
1165
- async getRegions(key?: string, member?: Member) {
1271
+ async getRegions(key?: string, member?: Member, keys?: { key?: string; deepKey?: string; subDeepKey?: string }) {
1166
1272
  await this.getFromApi('regions', 'getRegions');
1167
- //@ts-ignore
1168
- if (key && member[key] && member[key].ids !== null) return this.regions.filter(i => i.code === member[key].ids);
1169
- if (member && member.registrationProvince.ids !== null) {
1170
- return this.regions.filter(i => i.code === member.registrationProvince.ids);
1273
+ if (!!keys) {
1274
+ if (!!keys.key) {
1275
+ if (!!keys.deepKey) {
1276
+ if (!!keys.subDeepKey) {
1277
+ //@ts-ignore
1278
+ return this.regions.filter(i => i.code === member[keys.key][keys.deepKey][keys.subDeepKey].ids || i.code === member[keys.key][keys.deepKey][keys.subDeepKey].id);
1279
+ } else {
1280
+ //@ts-ignore
1281
+ return this.regions.filter(i => i.code === member[keys.key][keys.deepKey].ids || i.code === member[keys.key][keys.deepKey].id);
1282
+ }
1283
+ } else {
1284
+ //@ts-ignore
1285
+ return this.regions.filter(i => i.code === member[keys.key].ids || i.code === member[keys.key].id);
1286
+ }
1287
+ }
1171
1288
  } else {
1172
- return this.regions;
1289
+ //@ts-ignore
1290
+ if (key && member[key] && member[key].ids !== null) return this.regions.filter((i: Value) => i.code === member[key].ids);
1291
+ if (member && member.registrationProvince.ids !== null) {
1292
+ return this.regions.filter((i: Value) => i.code === member.registrationProvince.ids);
1293
+ }
1173
1294
  }
1295
+ return this.regions;
1174
1296
  },
1175
- async getCities(key?: string, member?: Member) {
1297
+ async getCities(key?: string, member?: Member, keys?: { key?: string; deepKey?: string; subDeepKey?: string }) {
1176
1298
  await this.getFromApi('cities', 'getCities');
1177
- //@ts-ignore
1178
- if (key && member[key] && member[key].ids !== null) return this.cities.filter(i => i.code === member[key].ids);
1179
- if (member && member.registrationProvince.ids !== null) {
1180
- return this.cities.filter(i => i.code === member.registrationProvince.ids);
1299
+ if (!!keys) {
1300
+ if (!!keys.key) {
1301
+ if (!!keys.deepKey) {
1302
+ if (!!keys.subDeepKey) {
1303
+ //@ts-ignore
1304
+ return this.cities.filter(i => i.code === member[keys.key][keys.deepKey][keys.subDeepKey].ids || i.code === member[keys.key][keys.deepKey][keys.subDeepKey].id);
1305
+ } else {
1306
+ //@ts-ignore
1307
+ return this.cities.filter(i => i.code === member[keys.key][keys.deepKey].ids || i.code === member[keys.key][keys.deepKey].id);
1308
+ }
1309
+ } else {
1310
+ //@ts-ignore
1311
+ return this.cities.filter(i => i.code === member[keys.key].ids || i.code === member[keys.key].id);
1312
+ }
1313
+ }
1181
1314
  } else {
1182
- return this.cities;
1315
+ //@ts-ignore
1316
+ if (key && member[key] && member[key].ids !== null) return this.cities.filter((i: Value) => i.code === member[key].ids);
1317
+ if (member && member.registrationProvince.ids !== null) {
1318
+ return this.cities.filter((i: Value) => i.code === member.registrationProvince.ids);
1319
+ }
1320
+ }
1321
+ return this.cities;
1322
+ },
1323
+ async getCitiesEfo(key?: string, member?: MemberV2, parentKey?: string) {
1324
+ if (this.isLifeBusiness) {
1325
+ await this.getFromApi('cities', 'getCities');
1326
+ //@ts-ignore
1327
+ if (key && member[parentKey][key] && member[parentKey][key].ids !== null) return this.cities.filter(i => i.code === member[parentKey][key].ids);
1328
+ //@ts-ignore
1329
+ if (member && member[parentKey].registrationProvince.ids !== null) {
1330
+ //@ts-ignore
1331
+ return this.cities.filter(i => i.code === member[parentKey].registrationProvince.ids);
1332
+ } else {
1333
+ return this.cities;
1334
+ }
1183
1335
  }
1184
1336
  },
1185
1337
  async getLocalityTypes() {
@@ -1208,12 +1360,18 @@ export const useDataStore = defineStore('data', {
1208
1360
  async getSectorCodeList() {
1209
1361
  return await this.getFromApi('economySectorCode', 'getSectorCode');
1210
1362
  },
1363
+ async getEconomicActivityType() {
1364
+ if (this.isLifeBusiness || this.isDas || this.isUU) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
1365
+ },
1211
1366
  async getFamilyStatuses() {
1212
1367
  return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
1213
1368
  },
1214
1369
  async getRelationTypes() {
1215
1370
  return await this.getFromApi('relations', 'getRelationTypes');
1216
1371
  },
1372
+ async getBanks() {
1373
+ if (this.isLifeBusiness || this.isDas || this.isUU) return await this.getFromApi('banks', 'getBanks');
1374
+ },
1217
1375
  async getProcessIndexRate() {
1218
1376
  if (this.processCode) {
1219
1377
  return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
@@ -1228,7 +1386,7 @@ export const useDataStore = defineStore('data', {
1228
1386
  return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
1229
1387
  },
1230
1388
  async getProcessTariff() {
1231
- return await this.getFromApi('processTariff', 'getProcessTariff');
1389
+ if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
1232
1390
  },
1233
1391
  async getDicAnnuityTypeList() {
1234
1392
  return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
@@ -1241,6 +1399,11 @@ export const useDataStore = defineStore('data', {
1241
1399
  async getInsurancePay() {
1242
1400
  return await this.getFromApi('insurancePay', 'getInsurancePay');
1243
1401
  },
1402
+ async getProcessGfot() {
1403
+ if (this.processCode) {
1404
+ return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
1405
+ }
1406
+ },
1244
1407
  async getCurrencies() {
1245
1408
  try {
1246
1409
  const currencies = await this.api.getCurrencies();
@@ -1254,6 +1417,12 @@ export const useDataStore = defineStore('data', {
1254
1417
  async getDictionaryItems(dictName: string) {
1255
1418
  return await this.getFromApi(dictName, 'getDictionaryItems', dictName);
1256
1419
  },
1420
+ getGenderList() {
1421
+ return this.gender;
1422
+ },
1423
+ async getAuthorityBasis() {
1424
+ if (this.isDas || this.isLifeBusiness || this.isUU) return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
1425
+ },
1257
1426
  async getAllFormsData() {
1258
1427
  await Promise.allSettled([
1259
1428
  this.getCountries(),
@@ -1263,6 +1432,7 @@ export const useDataStore = defineStore('data', {
1263
1432
  this.getStates(),
1264
1433
  this.getRegions(),
1265
1434
  this.getCities(),
1435
+ this.getCitiesEfo(),
1266
1436
  this.getLocalityTypes(),
1267
1437
  this.getDocumentTypes(),
1268
1438
  this.getDocumentIssuers(),
@@ -1279,59 +1449,68 @@ export const useDataStore = defineStore('data', {
1279
1449
  this.getInsurancePay(),
1280
1450
  this.getDictionaryItems('RegionPolicy'),
1281
1451
  this.getDictionaryItems('SaleChanellPolicy'),
1452
+ this.getDicTripType(),
1453
+ this.getDicCountries(),
1454
+ this.getDicTripWorkType(),
1455
+ this.getDicSportsType(),
1456
+ this.getDicTripPurpose(),
1457
+ this.getCurrencies(),
1458
+ this.getProcessGfot(),
1459
+ this.getBanks(),
1460
+ this.getEconomicActivityType(),
1461
+ this.getAuthorityBasis(),
1282
1462
  ]);
1283
1463
  },
1284
1464
  async getQuestionList(
1285
1465
  surveyType: 'health' | 'critical',
1286
1466
  processInstanceId: string | number,
1287
1467
  insuredId: any,
1288
- baseField: string,
1289
- secondaryField: string,
1468
+ baseField: 'surveyByHealthBase' | 'surveyByCriticalBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBasePolicyholder',
1290
1469
  whichMember: 'insured' | 'policyholder' = 'insured',
1291
1470
  ) {
1292
- //@ts-ignore
1293
- if (!this.formStore[baseField] || (this.formStore[baseField] && !this.formStore[baseField].length)) {
1294
- try {
1295
- if (whichMember === 'insured') {
1296
- const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1297
- this.api.getQuestionList(surveyType, processInstanceId, insuredId),
1298
- this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1299
- ]);
1300
- if (baseQuestions.status === 'fulfilled') {
1301
- //@ts-ignore
1302
- this.formStore[baseField] = baseQuestions.value;
1303
- }
1304
- if (secondaryQuestions.status === 'fulfilled') {
1305
- //@ts-ignore
1306
- this.formStore[secondaryField] = secondaryQuestions;
1307
- }
1308
- }
1309
- if (whichMember === 'policyholder') {
1310
- const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1311
- this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
1312
- this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1313
- ]);
1314
- if (baseQuestions.status === 'fulfilled') {
1315
- //@ts-ignore
1316
- this.formStore[baseField] = baseQuestions.value;
1317
- }
1318
- if (secondaryQuestions.status === 'fulfilled') {
1319
- //@ts-ignore
1320
- this.formStore[secondaryField] = secondaryQuestions;
1321
- }
1471
+ try {
1472
+ const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1473
+ whichMember === 'insured' ? this.api.getQuestionList(surveyType, processInstanceId, insuredId) : this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
1474
+ whichMember === 'insured'
1475
+ ? this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId)
1476
+ : this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1477
+ ,
1478
+ ]);
1479
+ if (baseQuestions.status === 'fulfilled') {
1480
+ this.formStore[baseField] = baseQuestions.value;
1481
+ }
1482
+ if (secondaryQuestions.status === 'fulfilled') {
1483
+ const baseAnketa = this.formStore[baseField];
1484
+ if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
1485
+ baseAnketa.body.forEach(i => {
1486
+ if (i.first.definedAnswers === 'Y' && i.second === null && secondaryQuestions.value) {
1487
+ i.second = structuredClone(secondaryQuestions.value);
1488
+ }
1489
+ });
1322
1490
  }
1323
- } catch (err) {
1324
- console.log(err);
1325
1491
  }
1492
+ } catch (err) {
1493
+ ErrorHandler(err);
1326
1494
  }
1327
- //@ts-ignore
1328
1495
  return this.formStore[baseField];
1329
1496
  },
1330
1497
  getNumberWithSpaces(n: any) {
1331
1498
  return n === null ? null : Number((typeof n === 'string' ? n : n.toFixed().toString()).replace(/[^0-9]+/g, '')).toLocaleString('ru');
1332
1499
  },
1500
+ getNumberWithSpacesAfterComma(n: number) {
1501
+ let parts = n.toFixed(2).split('.');
1502
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
1503
+ return parts.join(',');
1504
+ },
1333
1505
  getNumberWithDot(n: any) {
1334
- return n === null ? null : n.toLocaleString('ru', { maximumFractionDigits: 2, minimumFractionDigits: 2 }).replace(/,/g, '.');
1506
+ return n === null
1507
+ ? null
1508
+ : n
1509
+ .toLocaleString('ru', {
1510
+ maximumFractionDigits: 2,
1511
+ minimumFractionDigits: 2,
1512
+ })
1513
+ .replace(/,/g, '.');
1335
1514
  },
1336
1515
  async getTaskList(
1337
1516
  search: string = '',
@@ -1371,7 +1550,14 @@ export const useDataStore = defineStore('data', {
1371
1550
  delete query.processCodes;
1372
1551
  query.processCode = byOneProcess;
1373
1552
  }
1374
- const taskList = await this.api.getTaskList(processInstanceId === null ? query : { ...query, processInstanceId: processInstanceId });
1553
+ const taskList = await this.api.getTaskList(
1554
+ processInstanceId === null
1555
+ ? query
1556
+ : {
1557
+ ...query,
1558
+ processInstanceId: processInstanceId,
1559
+ },
1560
+ );
1375
1561
  if (needToReturn) {
1376
1562
  this.isLoading = false;
1377
1563
  return taskList.items;
@@ -1457,7 +1643,7 @@ export const useDataStore = defineStore('data', {
1457
1643
  },
1458
1644
  findObject(from: string, key: string, searchKey: any): any {
1459
1645
  // @ts-ignore
1460
- const found = this[from].find(i => i[key] == searchKey);
1646
+ const found = this[from].find((i: Value) => i[key] == searchKey);
1461
1647
  return found || new Value();
1462
1648
  },
1463
1649
  async searchAgentByName(name: string) {
@@ -1508,18 +1694,69 @@ export const useDataStore = defineStore('data', {
1508
1694
  this.isLoading = false;
1509
1695
  }
1510
1696
  },
1697
+ async getTripInsuredAmount(show: boolean = true) {
1698
+ this.isLoading = true;
1699
+ try {
1700
+ const countryID: string[] = [];
1701
+ for (let country = 0; country < this.formStore.productConditionsForm.calculatorForm.countries!.length; country++) {
1702
+ countryID.push(this.formStore.productConditionsForm.calculatorForm.countries![country].id as string);
1703
+ }
1704
+
1705
+ const form = {
1706
+ tripTypeID: this.formStore.productConditionsForm.calculatorForm.type.id,
1707
+ countryID,
1708
+ };
1709
+
1710
+ const result = await this.api.getTripInsuredAmount(form);
1711
+ const amounts: Value[] = [];
1712
+ result.amounts.forEach(amount => {
1713
+ amounts.push(new Value(amount['id'], amount['nameRu']));
1714
+ });
1715
+
1716
+ this.amountArray = amounts;
1717
+ this.formStore.productConditionsForm.calculatorForm.amount = new Value();
1718
+ this.currency = result.currency;
1719
+
1720
+ if (show) {
1721
+ this.showToaster('success', this.t('toaster.tripInsuredAmountCalculated'), 1000);
1722
+ }
1723
+ } catch (err) {
1724
+ ErrorHandler(err);
1725
+ }
1726
+ this.isLoading = false;
1727
+ },
1728
+ async getPeriod() {
1729
+ if (this.periodArray.length === 0) {
1730
+ try {
1731
+ const response = await this.api.getTripInsuranceDaysOptions();
1732
+ if (response) {
1733
+ const new3 = response.period;
1734
+ const newPeriod: Value[] = [];
1735
+ const newMaxDays: Value[] = [];
1736
+ Object.keys(new3).forEach(key => {
1737
+ newPeriod.push(new Value(key, key, key, key));
1738
+ new3[key as keyof typeof new3].forEach(item => {
1739
+ newMaxDays.push(new Value(item, item, item, key));
1740
+ });
1741
+ });
1742
+ this.periodArray = newPeriod;
1743
+ this.maxDaysAllArray = newMaxDays;
1744
+ }
1745
+ } catch (err) {
1746
+ ErrorHandler(err);
1747
+ }
1748
+ }
1749
+ },
1511
1750
  async calculateWithoutApplication(showLoader: boolean = false, product: string | null = null) {
1512
1751
  this.isLoading = showLoader;
1513
1752
  try {
1514
- if (!this.formStore.productConditionsForm.signDate || !this.formStore.productConditionsForm.birthDate) {
1753
+ if (!this.formStore.productConditionsForm.signDate) {
1515
1754
  return;
1516
1755
  }
1517
1756
  const signDate = formatDate(this.formStore.productConditionsForm.signDate);
1518
- const birthDate = formatDate(this.formStore.productConditionsForm.birthDate);
1519
- if (!signDate || !birthDate) return;
1520
1757
  const calculationData: RecalculationDataType & PolicyAppDto = {
1521
- signDate: signDate.toISOString(),
1522
- birthDate: birthDate.toISOString(),
1758
+ signDate: signDate ? signDate.toISOString() : undefined,
1759
+ birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
1523
1760
  gender: Number(this.formStore.productConditionsForm.gender.id),
1524
1761
  amount: getNumber(String(this.formStore.productConditionsForm.requestedSumInsured)),
1525
1762
  premium: getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonth)),
@@ -1527,7 +1764,7 @@ export const useDataStore = defineStore('data', {
1527
1764
  payPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
1528
1765
  indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
1529
1766
  ? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
1530
- : this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
1767
+ : this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
1531
1768
  paymentPeriodId: (this.formStore.productConditionsForm.paymentPeriod.id as string) ?? undefined,
1532
1769
  addCovers: this.formStore.additionalInsuranceTermsWithout,
1533
1770
  };
@@ -1536,15 +1773,23 @@ export const useDataStore = defineStore('data', {
1536
1773
  calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
1537
1774
  calculationData.currencyExchangeRate = this.currencies.usd;
1538
1775
  }
1539
- if (this.isLiferenta) {
1776
+ if (this.isLiferenta || product === 'liferenta') {
1540
1777
  calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
1541
1778
  calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
1542
1779
  calculationData.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
1543
1780
  calculationData.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
1544
1781
  }
1782
+ if (this.isLifeBusiness || product === 'lifebusiness') {
1783
+ calculationData.clients = this.formStore.lfb.clients;
1784
+ calculationData.insrCount = this.formStore.lfb.clients.length;
1785
+ calculationData.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
1786
+ calculationData.fixInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
1787
+ calculationData.agentCommission = this.formStore.productConditionsForm.processTariff.id;
1788
+ calculationData.processDefinitionFgotId = this.formStore.productConditionsForm.processGfot.id;
1789
+ }
1545
1790
  const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
1546
- this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
1547
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
1791
+ if (calculationResponse.amount) this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
1792
+ if (calculationResponse.premium) this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
1548
1793
  this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1549
1794
  if (this.isKazyna || product === 'halykkazyna') {
1550
1795
  if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
@@ -1553,9 +1798,25 @@ export const useDataStore = defineStore('data', {
1553
1798
  this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
1554
1799
  }
1555
1800
  }
1556
- if (this.isLiferenta) {
1801
+ if (this.isLiferenta || product === 'liferenta') {
1557
1802
  this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(calculationResponse.annuityMonthPay);
1558
1803
  }
1804
+ if (this.isGons || product === 'gons') {
1805
+ this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(calculationResponse.totalAmount5);
1806
+ this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(calculationResponse.totalAmount7);
1807
+ this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(calculationResponse.statePremium5);
1808
+ this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
1809
+ }
1810
+ if (this.isLifeBusiness || product === 'lifebusiness') {
1811
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremium);
1812
+ this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.fixInsSum === 0 ? null : calculationResponse.fixInsSum);
1813
+ this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1814
+ if (calculationResponse.clients) {
1815
+ this.formStore.lfb.clients = calculationResponse.clients;
1816
+ }
1817
+ this.showToaster('success', this.t('toaster.calculated'), 1000);
1818
+ return calculationResponse;
1819
+ }
1559
1820
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1560
1821
  } catch (err) {
1561
1822
  ErrorHandler(err);
@@ -1591,6 +1852,67 @@ export const useDataStore = defineStore('data', {
1591
1852
  if (this.isLiferenta) {
1592
1853
  this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
1593
1854
  }
1855
+ if (this.isGons) {
1856
+ const govPremiums = await this.api.getGovernmentPremiums(String(id));
1857
+ this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
1858
+ this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
1859
+ this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
1860
+ this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
1861
+ }
1862
+ if (this.isLifeBusiness) {
1863
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
1864
+ if (applicationData.insuredApp && applicationData.insuredApp.length) {
1865
+ const res = await this.newInsuredList(applicationData.insuredApp);
1866
+ this.formStore.lfb.clients = res;
1867
+ }
1868
+ }
1869
+
1870
+ this.showToaster('success', this.t('toaster.calculated'), 1000);
1871
+ } catch (err) {
1872
+ ErrorHandler(err);
1873
+ }
1874
+ this.isLoading = false;
1875
+ },
1876
+ async calculatePrice(taskId?: string) {
1877
+ this.isLoading = true;
1878
+ try {
1879
+ const priceForm: SetApplicationRequest = {};
1880
+ priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
1881
+ priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
1882
+ priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
1883
+ priceForm.tripPurposeId = this.formStore.productConditionsForm.calculatorForm.purpose.id;
1884
+ if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'WorkStudy') {
1885
+ priceForm.workTypeId = this.formStore.productConditionsForm.calculatorForm.workType.id;
1886
+ }
1887
+ if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'Sport') {
1888
+ priceForm.sportsTypeId = this.formStore.productConditionsForm.calculatorForm.sportsType!.id;
1889
+ }
1890
+ if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
1891
+ priceForm.singleTripDays = Number(this.formStore.productConditionsForm.calculatorForm.days);
1892
+ } else {
1893
+ priceForm.multipleTripMaxDays = Number(this.formStore.productConditionsForm.calculatorForm.maxDays.nameRu);
1894
+ priceForm.tripInsurancePeriod = Number(this.formStore.productConditionsForm.calculatorForm.period.nameRu);
1895
+ }
1896
+ if (this.isTask()) {
1897
+ priceForm.processInstanceId = this.formStore.applicationData.processInstanceId!;
1898
+ priceForm.id = taskId!;
1899
+ priceForm.age = Number(this.formStore.policyholderForm.age);
1900
+ if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Multiple') {
1901
+ priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
1902
+ } else {
1903
+ priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
1904
+ priceForm.endDate = formatDate(this.formStore.productConditionsForm.calculatorForm.endDate!)!.toISOString();
1905
+ }
1906
+ }
1907
+ const result = await this.api.getCalculator(priceForm);
1908
+ if (this.isTask() && taskId) {
1909
+ await this.api.setApplication(priceForm);
1910
+ const applicationData = await this.api.getApplicationData(taskId);
1911
+ this.formStore.applicationData = applicationData;
1912
+ this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
1913
+ } else {
1914
+ this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(result)} тг`;
1915
+ }
1594
1916
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1595
1917
  } catch (err) {
1596
1918
  ErrorHandler(err);
@@ -1623,6 +1945,7 @@ export const useDataStore = defineStore('data', {
1623
1945
  this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
1624
1946
  return;
1625
1947
  }
1948
+ this.formStore.regNumber = applicationData.regNumber;
1626
1949
  this.formStore.applicationData = applicationData;
1627
1950
  this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
1628
1951
 
@@ -1634,7 +1957,6 @@ export const useDataStore = defineStore('data', {
1634
1957
  this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
1635
1958
  this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
1636
1959
  this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
1637
-
1638
1960
  this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
1639
1961
  this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
1640
1962
 
@@ -1656,7 +1978,49 @@ export const useDataStore = defineStore('data', {
1656
1978
  this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
1657
1979
  this.formStore.finCenterData.date = reformatDate(applicationData.finCenterData.date);
1658
1980
  }
1981
+ if ('lifeTripApp' in applicationData && setProductConditions) {
1982
+ const tripType = this.types.find((i: Value) => i.id === applicationData.lifeTripApp.tripTypeId);
1983
+ this.formStore.productConditionsForm.calculatorForm.type = tripType ? tripType : new Value();
1984
+
1985
+ const countries: CountryValue[] = [];
1986
+ for (let i in applicationData.lifeTripApp.lifeTripCountries) {
1987
+ const tripCountry = this.dicAllCountries.find(country => country.id === applicationData.lifeTripApp.lifeTripCountries[i]);
1988
+ if (tripCountry) {
1989
+ countries.push(tripCountry);
1990
+ }
1991
+ }
1992
+ this.formStore.productConditionsForm.calculatorForm.countries = countries ? countries : [];
1993
+
1994
+ if (this.formStore.productConditionsForm.calculatorForm.countries.length && this.formStore.productConditionsForm.calculatorForm.type.nameRu != null) {
1995
+ await this.getTripInsuredAmount(false);
1996
+ }
1659
1997
 
1998
+ const amount = this.amountArray.find((i: Value) => i.id === applicationData.lifeTripApp.insuredAmountId);
1999
+ this.formStore.productConditionsForm.calculatorForm.amount = amount ? amount : new Value();
2000
+
2001
+ const purpose = this.purposes.find((i: Value) => i.id === applicationData.lifeTripApp.tripPurposeId);
2002
+ this.formStore.productConditionsForm.calculatorForm.purpose = purpose ? purpose : new Value();
2003
+
2004
+ if (applicationData.lifeTripApp.workTypeId != null) {
2005
+ const work = this.workTypes.find((i: Value) => i.id === applicationData.lifeTripApp.workTypeId);
2006
+ this.formStore.productConditionsForm.calculatorForm.workType = work ? work : new Value();
2007
+ }
2008
+ if (applicationData.lifeTripApp.sportsTypeId != null) {
2009
+ const sport = this.sportsTypes.find((i: Value) => i.id === applicationData.lifeTripApp.sportsTypeId);
2010
+ this.formStore.productConditionsForm.calculatorForm.sportsType = sport ? sport : new Value();
2011
+ }
2012
+ if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
2013
+ this.formStore.productConditionsForm.calculatorForm.days = Number(applicationData.lifeTripApp.singleTripDays);
2014
+ } else {
2015
+ await this.getPeriod();
2016
+ this.formStore.productConditionsForm.calculatorForm.maxDays = this.maxDaysAllArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.multipleTripMaxDays)!;
2017
+ this.formStore.productConditionsForm.calculatorForm.period = this.periodArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.tripInsurancePeriod)!;
2018
+ }
2019
+ this.formStore.productConditionsForm.calculatorForm.startDate = reformatDate(applicationData.lifeTripApp.startDate);
2020
+ this.formStore.productConditionsForm.calculatorForm.endDate = reformatDate(applicationData.lifeTripApp.endDate);
2021
+
2022
+ this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
2023
+ }
1660
2024
  if (fetchMembers) {
1661
2025
  let allMembers = [
1662
2026
  {
@@ -1726,7 +2090,7 @@ export const useDataStore = defineStore('data', {
1726
2090
  if (insuredData && insuredData.length) {
1727
2091
  insuredData.forEach((each, index) => {
1728
2092
  this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
1729
- const relationDegree = this.relations.find(i => i.ids == each.relationId);
2093
+ const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
1730
2094
  this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
1731
2095
  });
1732
2096
  }
@@ -1734,11 +2098,11 @@ export const useDataStore = defineStore('data', {
1734
2098
  if (beneficiaryData && beneficiaryData.length) {
1735
2099
  beneficiaryData.forEach((each, index) => {
1736
2100
  this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
1737
- const relationDegree = this.relations.find(i => i.ids == each.relationId);
2101
+ const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
1738
2102
  this.formStore.beneficiaryForm[index].relationDegree = relationDegree ? relationDegree : new Value();
1739
2103
  this.formStore.beneficiaryForm[index].percentageOfPayoutAmount = each.percentage;
1740
2104
  if (this.isLiferenta || this.isBolashak) {
1741
- const insurancePay = this.insurancePay.find(i => i.id == each.beneficiaryInsurancePayId);
2105
+ const insurancePay = this.insurancePay.find((i: Value) => i.id == each.beneficiaryInsurancePayId);
1742
2106
  this.formStore.beneficiaryForm[index].insurancePay = insurancePay ? insurancePay : new Value();
1743
2107
  }
1744
2108
  });
@@ -1770,7 +2134,9 @@ export const useDataStore = defineStore('data', {
1770
2134
  this.formStore.policyholdersRepresentativeForm.isNotary = spokesmanData.isNotary;
1771
2135
  }
1772
2136
  }
1773
- if (setProductConditions) {
2137
+ if (setProductConditions && !!applicationData.policyAppDto) {
2138
+ this.formStore.policyNumber = applicationData.policyAppDto.policyNumber;
2139
+ this.formStore.contractDate = reformatDate(applicationData.policyAppDto.contractDate);
1774
2140
  this.formStore.productConditionsForm.coverPeriod = applicationData.policyAppDto.coverPeriod;
1775
2141
  this.formStore.productConditionsForm.payPeriod = applicationData.policyAppDto.payPeriod;
1776
2142
  // this.formStore.productConditionsForm.annualIncome = applicationData.policyAppDto.annualIncome?.toString();
@@ -1866,6 +2232,7 @@ export const useDataStore = defineStore('data', {
1866
2232
  return true;
1867
2233
  } catch (err) {
1868
2234
  this.isLoading = false;
2235
+ this.isButtonsLoading = false;
1869
2236
  return ErrorHandler(err);
1870
2237
  }
1871
2238
  },
@@ -1887,6 +2254,7 @@ export const useDataStore = defineStore('data', {
1887
2254
  }
1888
2255
  case constants.actions.reject:
1889
2256
  case constants.actions.return:
2257
+ case constants.actions.signed:
1890
2258
  case constants.actions.rejectclient:
1891
2259
  case constants.actions.accept: {
1892
2260
  try {
@@ -1905,7 +2273,10 @@ export const useDataStore = defineStore('data', {
1905
2273
  }
1906
2274
  case constants.actions.affiliate: {
1907
2275
  try {
1908
- const sended = await this.sendUnderwritingCouncilTask({ taskId: taskId, decision: constants.actions.accept });
2276
+ const sended = await this.sendUnderwritingCouncilTask({
2277
+ taskId: taskId,
2278
+ decision: constants.actions.accept,
2279
+ });
1909
2280
  if (!sended) return;
1910
2281
  this.formStore.$reset();
1911
2282
  if (this.isEFO || this.isAML) {
@@ -1988,7 +2359,7 @@ export const useDataStore = defineStore('data', {
1988
2359
  this.formStore[whichForm][index].jobPlace = this.formStore.applicationData[whichMember][index].jobName;
1989
2360
  }
1990
2361
  },
1991
- async signDocument() {
2362
+ async signDocument(type: string = 'electronic') {
1992
2363
  try {
1993
2364
  if (this.formStore.signUrls.length) {
1994
2365
  return this.formStore.signUrls;
@@ -1996,22 +2367,110 @@ export const useDataStore = defineStore('data', {
1996
2367
  const prepareSignDocuments = (): SignDataType[] => {
1997
2368
  switch (this.formStore.applicationData.statusCode) {
1998
2369
  case 'ContractSignedFrom':
1999
- return [{ processInstanceId: String(this.formStore.applicationData.processInstanceId), name: 'Contract', format: 'pdf' }];
2370
+ return [
2371
+ {
2372
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2373
+ name: 'Contract',
2374
+ format: 'pdf',
2375
+ },
2376
+ ];
2000
2377
  default:
2001
2378
  return [
2002
- { processInstanceId: String(this.formStore.applicationData.processInstanceId), name: 'Agreement', format: 'pdf' },
2003
- { processInstanceId: String(this.formStore.applicationData.processInstanceId), name: 'Statement', format: 'pdf' },
2379
+ {
2380
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2381
+ name: 'Agreement',
2382
+ format: 'pdf',
2383
+ },
2384
+ {
2385
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2386
+ name: 'Statement',
2387
+ format: 'pdf',
2388
+ },
2004
2389
  ];
2005
2390
  }
2006
2391
  };
2007
2392
  const data = prepareSignDocuments();
2008
- const result = await this.api.signDocument(data);
2009
- this.formStore.signUrls = result;
2010
- return this.formStore.signUrls;
2393
+ if (type === 'qr') {
2394
+ const groupId = await this.api.signQR(data);
2395
+ return groupId;
2396
+ } else {
2397
+ const result = await this.api.signDocument(data);
2398
+ this.formStore.signUrls = result;
2399
+ return this.formStore.signUrls;
2400
+ }
2011
2401
  } catch (err) {
2012
2402
  ErrorHandler(err);
2013
2403
  }
2014
2404
  },
2405
+ async downloadTemplate(documentType: number, fileType: string = 'pdf') {
2406
+ try {
2407
+ this.isButtonsLoading = true;
2408
+ const response: any = await this.api.downloadTemplate(documentType);
2409
+ const blob = new Blob([response], {
2410
+ type: `application/${fileType}`,
2411
+ });
2412
+ const url = window.URL.createObjectURL(blob);
2413
+ const link = document.createElement('a');
2414
+ link.href = url;
2415
+ switch (documentType) {
2416
+ case constants.documentTypes.insuredsList:
2417
+ link.setAttribute('download', 'РФ-ДС-028 Список застрахованных ГССЖ_ГНС, изд.1.xls');
2418
+ break;
2419
+ case constants.documentTypes.statement:
2420
+ link.setAttribute('download', 'Заявление.docx');
2421
+ break;
2422
+ case constants.documentTypes.contract:
2423
+ link.setAttribute('download', 'Договор страхования.doc');
2424
+ break;
2425
+ case constants.documentTypes.application1:
2426
+ link.setAttribute('download', 'Приложение №1.xls');
2427
+ break;
2428
+ case constants.documentTypes.questionnaireInsured:
2429
+ link.setAttribute('download', 'Анкета Застрахованного.docx');
2430
+ break;
2431
+ }
2432
+ document.body.appendChild(link);
2433
+ link.click();
2434
+ } catch (err) {
2435
+ ErrorHandler(err);
2436
+ }
2437
+ this.isButtonsLoading = false;
2438
+ },
2439
+ async sendTemplateToEmail(email: string) {
2440
+ try {
2441
+ this.isButtonsLoading = true;
2442
+ await this.api.sendTemplateToEmail(email);
2443
+ this.showToaster('info', this.t('toaster.successfullyDocSent'), 5000);
2444
+ } catch (err) {
2445
+ ErrorHandler(err);
2446
+ }
2447
+ this.isButtonsLoading = false;
2448
+ },
2449
+ async generateDocument() {
2450
+ try {
2451
+ this.isButtonsLoading = true;
2452
+ this.formStore.needToScanSignedContract = true;
2453
+ const data: SignDataType = {
2454
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2455
+ name: 'Contract',
2456
+ format: 'pdf',
2457
+ };
2458
+ const response: any = await this.api.generateDocument(data);
2459
+ const blob = new Blob([response], {
2460
+ type: `application/pdf`,
2461
+ });
2462
+ this.showToaster('info', this.t('toaster.needToSignContract'), 100000);
2463
+ const url = window.URL.createObjectURL(blob);
2464
+ const link = document.createElement('a');
2465
+ link.href = url;
2466
+ link.setAttribute('download', this.formStore.regNumber + ' Договор страхования');
2467
+ document.body.appendChild(link);
2468
+ link.click();
2469
+ } catch (err) {
2470
+ ErrorHandler(err);
2471
+ }
2472
+ this.isButtonsLoading = false;
2473
+ },
2015
2474
  async registerNumber() {
2016
2475
  try {
2017
2476
  if (!this.formStore.finCenterData.date) return;
@@ -2082,6 +2541,9 @@ export const useDataStore = defineStore('data', {
2082
2541
  const recalculatedValue = await this.api.reCalculate(data);
2083
2542
  if (!!recalculatedValue) {
2084
2543
  await this.getApplicationData(taskId, false, false, false, true);
2544
+ if (this.isGons) {
2545
+ this.formStore.productConditionsForm.isRecalculated = true;
2546
+ }
2085
2547
  this.showToaster(
2086
2548
  'success',
2087
2549
  `${this.t('toaster.successRecalculation')}. ${whichSum == 'insurancePremiumPerMonth' ? 'Страховая премия' : 'Страховая сумма'}: ${this.getNumberWithSpaces(
@@ -2123,7 +2585,7 @@ export const useDataStore = defineStore('data', {
2123
2585
  }
2124
2586
  }
2125
2587
  } else {
2126
- if (this.formStore[localKey].some((i: any) => i.iin !== null)) {
2588
+ if (this.formStore[localKey].some(i => i.iin !== null)) {
2127
2589
  this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
2128
2590
  return false;
2129
2591
  }
@@ -2221,8 +2683,8 @@ export const useDataStore = defineStore('data', {
2221
2683
  }
2222
2684
  if (localCheck === false) {
2223
2685
  try {
2224
- if (this.isInitiator() && !this.isGons) {
2225
- if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
2686
+ if (this.isInitiator() && this.members.beneficialOwnerApp.has) {
2687
+ if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
2226
2688
  await Promise.allSettled(
2227
2689
  this.formStore.applicationData.beneficialOwnerApp.map(async (member: any) => {
2228
2690
  await this.api.deleteMember('BeneficialOwner', member.id);
@@ -2242,124 +2704,127 @@ export const useDataStore = defineStore('data', {
2242
2704
  if (!anketa) return false;
2243
2705
  const list = anketa.body;
2244
2706
  if (!list || (list && list.length === 0)) return false;
2245
- let notAnswered = 0;
2246
- for (let x = 0; x < list.length; x++) {
2247
- if ((list[x].first.definedAnswers === 'N' && !list[x].first.answerText) || (list[x].first.definedAnswers === 'Y' && !list[x].first.answerName)) {
2248
- notAnswered = notAnswered + 1;
2707
+ const isAnketaValid = ref<boolean>(true);
2708
+ list.forEach(i => {
2709
+ if (
2710
+ (i.first.definedAnswers === 'N' && !i.first.answerText) ||
2711
+ (i.first.definedAnswers === 'Y' && !i.first.answerName) ||
2712
+ (i.first.definedAnswers === 'D' && !i.first.answerName?.match(new RegExp('Нет', 'i')) && !i.first.answerText)
2713
+ ) {
2714
+ isAnketaValid.value = false;
2715
+ return false;
2249
2716
  }
2250
- }
2251
- return notAnswered === 0;
2717
+ if (this.controls.isSecondAnketaRequired && i.first.definedAnswers === 'Y' && i.first.answerName?.match(new RegExp('Да', 'i'))) {
2718
+ if (i.second && i.second.length) {
2719
+ const isValid = i.second.every(second => (second.definedAnswers === 'N' ? !!second.answerText : !!second.answerName));
2720
+ if (!isValid) {
2721
+ isAnketaValid.value = false;
2722
+ this.showToaster('info', this.t('toaster.emptySecondAnketa', { text: i.first.name }), 5000);
2723
+ return false;
2724
+ }
2725
+ } else {
2726
+ // TODO уточнить
2727
+ }
2728
+ }
2729
+ });
2730
+ return isAnketaValid.value;
2252
2731
  },
2253
2732
  async validateAllForms(taskId: string) {
2254
2733
  this.isLoading = true;
2255
2734
  const areMembersValid = await this.validateAllMembers(taskId);
2256
2735
  if (areMembersValid) {
2257
2736
  if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) {
2258
- const hasCritical = this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName === 'Критическое заболевание Застрахованного');
2259
- if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i'))) {
2260
- await Promise.allSettled([
2261
- this.getQuestionList(
2262
- 'health',
2263
- this.formStore.applicationData.processInstanceId,
2264
- this.formStore.applicationData.insuredApp[0].id,
2265
- 'surveyByHealthBase',
2266
- 'surveyByHealthSecond',
2267
- ),
2268
- this.getQuestionList(
2269
- 'critical',
2270
- this.formStore.applicationData.processInstanceId,
2271
- this.formStore.applicationData.insuredApp[0].id,
2272
- 'surveyByCriticalBase',
2273
- 'surveyByCriticalSecond',
2274
- ),
2275
- this.isClientAnketaCondition &&
2276
- this.getQuestionList(
2277
- 'health',
2278
- this.formStore.applicationData.processInstanceId,
2279
- this.formStore.applicationData.clientApp.id,
2280
- 'surveyByHealthBasePolicyholder',
2281
- 'surveyByHealthSecond',
2282
- 'policyholder',
2283
- ),
2284
- ]);
2285
- this.isClientAnketaCondition
2286
- ? await Promise.allSettled([
2287
- ...this.formStore.surveyByHealthBase!.body.map(async question => {
2288
- await this.definedAnswers(question.first.id, 'surveyByHealthBase');
2289
- }),
2290
- ...this.formStore.surveyByCriticalBase!.body.map(async question => {
2291
- await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
2292
- }),
2293
- ...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
2294
- await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
2295
- }),
2296
- ])
2297
- : await Promise.allSettled([
2298
- ...this.formStore.surveyByHealthBase!.body.map(async question => {
2299
- await this.definedAnswers(question.first.id, 'surveyByHealthBase');
2300
- }),
2301
- ...this.formStore.surveyByCriticalBase!.body.map(async question => {
2302
- await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
2303
- }),
2304
- ]);
2305
- } else {
2306
- await Promise.allSettled([
2307
- this.getQuestionList(
2308
- 'health',
2309
- this.formStore.applicationData.processInstanceId,
2310
- this.formStore.applicationData.insuredApp[0].id,
2311
- 'surveyByHealthBase',
2312
- 'surveyByHealthSecond',
2313
- ),
2314
- this.isClientAnketaCondition &&
2315
- this.getQuestionList(
2316
- 'health',
2317
- this.formStore.applicationData.processInstanceId,
2318
- this.formStore.applicationData.clientApp.id,
2319
- 'surveyByHealthBasePolicyholder',
2320
- 'surveyByHealthSecond',
2321
- 'policyholder',
2322
- ),
2323
- ,
2324
- ]);
2325
- this.isClientAnketaCondition
2326
- ? await Promise.allSettled([
2327
- ...this.formStore.surveyByHealthBase!.body.map(async question => {
2328
- await this.definedAnswers(question.first.id, 'surveyByHealthBase');
2329
- }),
2330
- ...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
2331
- await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
2332
- }),
2333
- ])
2334
- : await Promise.allSettled(
2335
- this.formStore.surveyByHealthBase!.body.map(async question => {
2336
- await this.definedAnswers(question.first.id, 'surveyByHealthBase');
2337
- }),
2338
- );
2339
- }
2340
- if (this.validateAnketa('surveyByHealthBase')) {
2341
- let hasCriticalAndItsValid = null;
2342
- if (hasCritical && hasCritical.coverSumName !== 'не включено') {
2343
- if (this.validateAnketa('surveyByCriticalBase')) {
2344
- hasCriticalAndItsValid = true;
2345
- } else {
2346
- hasCriticalAndItsValid = false;
2347
- this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
2348
- }
2737
+ if (this.controls.hasAnketa) {
2738
+ const hasCritical =
2739
+ this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
2740
+ if (hasCritical === null || (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')))) {
2741
+ await Promise.allSettled([
2742
+ this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
2743
+ this.isClientAnketaCondition &&
2744
+ this.getQuestionList(
2745
+ 'health',
2746
+ this.formStore.applicationData.processInstanceId,
2747
+ this.formStore.applicationData.clientApp.id,
2748
+ 'surveyByHealthBasePolicyholder',
2749
+ 'policyholder',
2750
+ ),
2751
+ ,
2752
+ ]);
2753
+ this.isClientAnketaCondition
2754
+ ? await Promise.allSettled([
2755
+ ...this.formStore.surveyByHealthBase!.body.map(async question => {
2756
+ await this.definedAnswers(question.first.id, 'surveyByHealthBase');
2757
+ }),
2758
+ ...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
2759
+ await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
2760
+ }),
2761
+ ])
2762
+ : await Promise.allSettled(
2763
+ this.formStore.surveyByHealthBase!.body.map(async question => {
2764
+ await this.definedAnswers(question.first.id, 'surveyByHealthBase');
2765
+ }),
2766
+ );
2349
2767
  } else {
2350
- hasCriticalAndItsValid = null;
2768
+ await Promise.allSettled([
2769
+ this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
2770
+ this.getQuestionList('critical', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByCriticalBase'),
2771
+ this.isClientAnketaCondition &&
2772
+ this.getQuestionList(
2773
+ 'health',
2774
+ this.formStore.applicationData.processInstanceId,
2775
+ this.formStore.applicationData.clientApp.id,
2776
+ 'surveyByHealthBasePolicyholder',
2777
+ 'policyholder',
2778
+ ),
2779
+ ]);
2780
+ this.isClientAnketaCondition
2781
+ ? await Promise.allSettled([
2782
+ ...this.formStore.surveyByHealthBase!.body.map(async question => {
2783
+ await this.definedAnswers(question.first.id, 'surveyByHealthBase');
2784
+ }),
2785
+ ...this.formStore.surveyByCriticalBase!.body.map(async question => {
2786
+ await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
2787
+ }),
2788
+ ...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
2789
+ await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
2790
+ }),
2791
+ ])
2792
+ : await Promise.allSettled([
2793
+ ...this.formStore.surveyByHealthBase!.body.map(async question => {
2794
+ await this.definedAnswers(question.first.id, 'surveyByHealthBase');
2795
+ }),
2796
+ ...this.formStore.surveyByCriticalBase!.body.map(async question => {
2797
+ await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
2798
+ }),
2799
+ ]);
2351
2800
  }
2352
- if (hasCriticalAndItsValid === true || hasCriticalAndItsValid === null) {
2353
- if (this.isClientAnketaCondition && this.validateAnketa('surveyByHealthBasePolicyholder') === false) {
2354
- this.showToaster('error', this.t('toaster.emptyHealthAnketaPolicyholder'), 3000);
2801
+ if (this.validateAnketa('surveyByHealthBase')) {
2802
+ let hasCriticalAndItsValid = null;
2803
+ if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')) === null) {
2804
+ if (this.validateAnketa('surveyByCriticalBase')) {
2805
+ hasCriticalAndItsValid = true;
2806
+ } else {
2807
+ hasCriticalAndItsValid = false;
2808
+ this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
2809
+ }
2810
+ } else {
2811
+ hasCriticalAndItsValid = null;
2812
+ }
2813
+ if (hasCriticalAndItsValid === true || hasCriticalAndItsValid === null) {
2814
+ if (this.isClientAnketaCondition && this.validateAnketa('surveyByHealthBasePolicyholder') === false) {
2815
+ this.showToaster('error', this.t('toaster.emptyHealthAnketaPolicyholder'), 3000);
2816
+ this.isLoading = false;
2817
+ return false;
2818
+ }
2355
2819
  this.isLoading = false;
2356
- return false;
2820
+ return true;
2357
2821
  }
2358
- this.isLoading = false;
2359
- return true;
2822
+ } else {
2823
+ this.showToaster('error', this.t('toaster.emptyHealthAnketa'), 3000);
2360
2824
  }
2361
2825
  } else {
2362
- this.showToaster('error', this.t('toaster.emptyHealthAnketa'), 3000);
2826
+ this.isLoading = false;
2827
+ return true;
2363
2828
  }
2364
2829
  } else {
2365
2830
  this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
@@ -2372,7 +2837,10 @@ export const useDataStore = defineStore('data', {
2372
2837
  async getFamilyInfo(iin: string, phoneNumber: string) {
2373
2838
  this.isLoading = true;
2374
2839
  try {
2375
- const familyResponse = await this.api.getFamilyInfo({ iin: iin.replace(/-/g, ''), phoneNumber: formatPhone(phoneNumber) });
2840
+ const familyResponse = await this.api.getFamilyInfo({
2841
+ iin: iin.replace(/-/g, ''),
2842
+ phoneNumber: formatPhone(phoneNumber),
2843
+ });
2376
2844
  if (familyResponse.status === 'soap:Server') {
2377
2845
  this.showToaster('error', `${familyResponse.statusName}. Отправьте запрос через некоторое время`, 5000);
2378
2846
  this.isLoading = false;
@@ -2417,6 +2885,32 @@ export const useDataStore = defineStore('data', {
2417
2885
  this.isLoading = false;
2418
2886
  }
2419
2887
  },
2888
+ async getKgd(iin: string) {
2889
+ try {
2890
+ const data = {
2891
+ iinBin: iin.replace(/-/g, ''),
2892
+ };
2893
+ const kgdResponse = await this.api.getKgd(data);
2894
+ return kgdResponse;
2895
+ } catch (err) {
2896
+ return ErrorHandler(err);
2897
+ }
2898
+ },
2899
+ async getGbdUl(bin: string) {
2900
+ if (!this.accessToken) return null;
2901
+ try {
2902
+ const decoded = jwtDecode(this.accessToken);
2903
+ const data = {
2904
+ userName: decoded.code,
2905
+ branchName: decoded.branchCode,
2906
+ bin: bin.replace(/-/g, ''),
2907
+ };
2908
+ const gbdulResponse = await this.api.getGbdUl(data);
2909
+ return gbdulResponse;
2910
+ } catch (err) {
2911
+ return ErrorHandler(err);
2912
+ }
2913
+ },
2420
2914
  async getContragentFromGBDFL(member: Member) {
2421
2915
  // null - ожидание
2422
2916
  // false - ошибка или неправильно
@@ -2448,6 +2942,20 @@ export const useDataStore = defineStore('data', {
2448
2942
  this.isLoading = false;
2449
2943
  return false;
2450
2944
  }
2945
+ if (!gbdResponse.content) {
2946
+ let errMsg: string = '';
2947
+ if (gbdResponse.status) {
2948
+ errMsg += gbdResponse.status;
2949
+ }
2950
+ if (gbdResponse.statusName) {
2951
+ errMsg += gbdResponse.statusName;
2952
+ }
2953
+ if (!!errMsg) {
2954
+ this.showToaster('error', errMsg, 5000);
2955
+ }
2956
+ this.isLoading = false;
2957
+ return false;
2958
+ }
2451
2959
  const { person } = parseXML(gbdResponse.content, true, 'person');
2452
2960
  const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
2453
2961
  if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
@@ -2469,11 +2977,15 @@ export const useDataStore = defineStore('data', {
2469
2977
  member.firstName = person.name;
2470
2978
  member.lastName = person.surname;
2471
2979
  member.middleName = person.patronymic ? person.patronymic : '';
2980
+ if (this.isLifetrip) {
2981
+ member.firstNameLat = person.engFirstName ? person.engFirstName : '';
2982
+ member.lastNameLat = person.engSurname ? person.engSurname : '';
2983
+ }
2472
2984
  member.longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
2473
2985
  member.birthDate = reformatDate(person.birthDate);
2474
2986
  member.genderName = person.gender.nameRu;
2475
2987
 
2476
- const gender = this.gender.find(i => i.id == person.gender.code);
2988
+ const gender = this.gender.find((i: Value) => i.id == person.gender.code);
2477
2989
  if (gender) member.gender = gender;
2478
2990
 
2479
2991
  const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
@@ -2556,7 +3068,7 @@ export const useDataStore = defineStore('data', {
2556
3068
  if ('length' in person.documents.document) {
2557
3069
  const validDocument = person.documents.document.find((i: any) => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
2558
3070
  if (validDocument) {
2559
- const documentType = this.documentTypes.find(i => i.ids === '1UDL');
3071
+ const documentType = this.documentTypes.find((i: Value) => i.ids === '1UDL');
2560
3072
  if (documentType) member.documentType = documentType;
2561
3073
 
2562
3074
  member.documentNumber = validDocument.number;
@@ -2570,7 +3082,7 @@ export const useDataStore = defineStore('data', {
2570
3082
  } else {
2571
3083
  const documentType =
2572
3084
  person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
2573
- ? this.documentTypes.find(i => i.ids === '1UDL')
3085
+ ? this.documentTypes.find((i: Value) => i.ids === '1UDL')
2574
3086
  : this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
2575
3087
  ? this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
2576
3088
  : new Value();
@@ -2589,9 +3101,289 @@ export const useDataStore = defineStore('data', {
2589
3101
  const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
2590
3102
  if (documentIssuer) member.documentIssuers = documentIssuer;
2591
3103
  }
2592
- const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
3104
+ const economySectorCode = this.economySectorCode.find((i: Value) => i.ids === '500003.9');
2593
3105
  if (economySectorCode) member.economySectorCode = economySectorCode;
2594
3106
  },
3107
+ async startApplicationV2(data: any) {
3108
+ const policyholder = data.clientData;
3109
+ if (!policyholder.authoritedPerson.iin) return false;
3110
+ try {
3111
+ const response = await this.api.startApplication(data);
3112
+ this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
3113
+ return response.processInstanceId;
3114
+ } catch (err) {
3115
+ return ErrorHandler(err);
3116
+ }
3117
+ },
3118
+ async saveClient(policyholder: any) {
3119
+ try {
3120
+ await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, policyholder);
3121
+ } catch (err) {
3122
+ return ErrorHandler(err);
3123
+ }
3124
+ },
3125
+ async getApplicationDataV2(taskId: string) {
3126
+ this.isLoading = true;
3127
+ try {
3128
+ const applicationData = await this.api.getApplicationData(taskId);
3129
+ if (this.processCode !== applicationData.processCode) {
3130
+ this.isLoading = false;
3131
+ this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
3132
+ return;
3133
+ }
3134
+
3135
+ this.formStore.applicationData = applicationData;
3136
+ this.formStore.regNumber = applicationData.regNumber;
3137
+ this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
3138
+
3139
+ this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
3140
+ this.formStore.applicationTaskId = taskId;
3141
+ this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
3142
+ this.formStore.RegionPolicy.ids = applicationData.insisWorkDataApp.regionPolicy;
3143
+ this.formStore.ManagerPolicy.nameRu = applicationData.insisWorkDataApp.managerPolicyName;
3144
+ this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
3145
+ this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
3146
+ this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
3147
+
3148
+ this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
3149
+ this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
3150
+
3151
+ const { clientData } = applicationData.clientApp;
3152
+ const beneficialOwnerApp = applicationData.beneficialOwnerApp;
3153
+ const insuredApp = applicationData.insuredApp;
3154
+ const accidentIncidents = applicationData.accidentIncidentDtos;
3155
+ const clientId = applicationData.clientApp.id;
3156
+
3157
+ this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
3158
+ this.formStore.lfb.policyholder.isIpdl = applicationData.clientApp.isIpdl;
3159
+ this.formStore.lfb.policyholder.clientData.company = clientData;
3160
+ this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
3161
+ this.formStore.lfb.policyholder.clientData.company.iin = reformatIin(clientData.iin);
3162
+ this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
3163
+ this.formStore.lfb.clientId = clientId;
3164
+ this.formStore.lfb.policyholder.clientData.company.authorityDetails.date = reformatDate(clientData.authorityDetails.date);
3165
+
3166
+ if (clientData && clientData.activityTypes !== null) {
3167
+ this.formStore.lfb.policyholderActivities = clientData.activityTypes;
3168
+ }
3169
+
3170
+ if (beneficialOwnerApp && beneficialOwnerApp.length) {
3171
+ this.formStore.lfb.beneficialOwners = beneficialOwnerApp;
3172
+ this.formStore.lfb.isPolicyholderBeneficialOwner = clientData.authoritedPerson.iin.replace(/-/g, '') === beneficialOwnerApp[0].beneficialOwnerData.iin ? true : false;
3173
+ this.formStore.lfb.beneficialOwners.forEach(beneficial => {
3174
+ beneficial.beneficialOwnerData.identityDocument!.validUntil = reformatDate(beneficial.beneficialOwnerData.identityDocument!.validUntil as string);
3175
+ beneficial.beneficialOwnerData.iin = reformatIin(beneficial.beneficialOwnerData.iin as string);
3176
+ });
3177
+ }
3178
+
3179
+ if (insuredApp && insuredApp.length) {
3180
+ const res = await this.newInsuredList(insuredApp);
3181
+ this.formStore.lfb.clients = res;
3182
+ }
3183
+
3184
+ if (accidentIncidents && accidentIncidents.length) {
3185
+ this.formStore.lfb.accidentIncidents = accidentIncidents;
3186
+ this.formStore.lfb.accidentIncidents.forEach(incident => {
3187
+ incident.amount = incident.amount === 0 ? null : incident.amount;
3188
+ incident.count = incident.count === 0 ? null : incident.count;
3189
+ });
3190
+ }
3191
+
3192
+ this.formStore.productConditionsForm.coverPeriod = 12;
3193
+ this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount === 0 ? null : applicationData.policyAppDto.amount);
3194
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
3195
+ applicationData.policyAppDto.mainPremium === 0 ? null : applicationData.policyAppDto.mainPremium,
3196
+ );
3197
+ const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
3198
+ this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
3199
+ const processTariff = this.processTariff.find(item => item.id == applicationData.policyAppDto.tariffId);
3200
+ this.formStore.productConditionsForm.processTariff = processTariff ? processTariff : new Value();
3201
+ const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
3202
+ this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
3203
+ } catch (err) {
3204
+ ErrorHandler(err);
3205
+ if (err instanceof AxiosError) {
3206
+ this.sendToParent(constants.postActions.toHomePage, err.response?.data);
3207
+ this.isLoading = false;
3208
+ return false;
3209
+ }
3210
+ }
3211
+ this.isLoading = false;
3212
+ },
3213
+ async saveAccidentIncidents(data: AccidentIncidents[]) {
3214
+ try {
3215
+ const response = await this.api.saveAccidentIncidents(this.formStore.applicationData.processInstanceId, data);
3216
+ return response;
3217
+ } catch (err) {
3218
+ return ErrorHandler(err);
3219
+ }
3220
+ },
3221
+ async saveClientAcivityTypes(data: PolicyholderActivity[]) {
3222
+ try {
3223
+ const response = await this.api.saveClientAcivityTypes(this.formStore.applicationData.clientApp.id, data);
3224
+ return response;
3225
+ } catch (err) {
3226
+ return ErrorHandler(err);
3227
+ }
3228
+ },
3229
+ async saveBeneficialOwnerList(beneficialOwnerList: BeneficialOwner[]) {
3230
+ try {
3231
+ const response = await this.api.saveBeneficialOwnerList(this.formStore.applicationData.processInstanceId, beneficialOwnerList);
3232
+ return response;
3233
+ } catch (err) {
3234
+ return ErrorHandler(err);
3235
+ }
3236
+ },
3237
+ async saveBeneficialOwner(beneficialOwner: BeneficialOwner) {
3238
+ try {
3239
+ const response = await this.api.saveBeneficialOwner(this.formStore.applicationData.processInstanceId, beneficialOwner.id, beneficialOwner);
3240
+ return response;
3241
+ } catch (err) {
3242
+ return ErrorHandler(err);
3243
+ }
3244
+ },
3245
+ async saveInsuredList(insuredList: any) {
3246
+ try {
3247
+ const response = await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, insuredList);
3248
+ return response;
3249
+ } catch (err) {
3250
+ return ErrorHandler(err);
3251
+ }
3252
+ },
3253
+ async saveInsured(insured: any) {
3254
+ try {
3255
+ const response = await this.api.saveInsured(this.formStore.applicationData.processInstanceId, insured.id, insured);
3256
+ return response;
3257
+ } catch (err) {
3258
+ return ErrorHandler(err);
3259
+ }
3260
+ },
3261
+ newInsuredList(list: any) {
3262
+ const clients = list.map((item: any, index: number) => {
3263
+ const client = item.insuredData;
3264
+ return {
3265
+ id: index,
3266
+ fullName: client.longName,
3267
+ gender: client.gender,
3268
+ position: item.workDetails?.position,
3269
+ birthDate: client.birthDate,
3270
+ iin: reformatIin(client.iin),
3271
+ insSum: client.insuredPolicyData.insSum,
3272
+ premium: client.insuredPolicyData.premium,
3273
+ hasAttachedFile: client.hasAttachedFile,
3274
+ };
3275
+ });
3276
+ return clients;
3277
+ },
3278
+ validateMultipleMembersV2(localKey: string, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
3279
+ // @ts-ignore
3280
+ if (this.formStore.lfb[localKey].length === this.formStore.applicationData[applicationKey].length) {
3281
+ // @ts-ignore
3282
+ if (this.formStore.lfb[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
3283
+ // @ts-ignore
3284
+ const localMembers = [...this.formStore.lfb[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
3285
+ const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.id - b.id);
3286
+ if (localMembers.every((each, index) => applicationMembers[index].iin === each.iin?.replace(/-/g, '')) === false) {
3287
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3288
+ return false;
3289
+ }
3290
+ }
3291
+ } else {
3292
+ // @ts-ignore
3293
+ if (this.formStore.lfb[localKey].some(i => i.iin !== null)) {
3294
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3295
+ return false;
3296
+ }
3297
+ if (this.formStore.applicationData[applicationKey].length !== 0) {
3298
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3299
+ return false;
3300
+ } else {
3301
+ // @ts-ignore
3302
+ if (this.formStore.lfb[localKey][0].iin !== null) {
3303
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3304
+ return false;
3305
+ }
3306
+ }
3307
+ }
3308
+ return true;
3309
+ },
3310
+ async validateAllFormsV2(taskId: string) {
3311
+ this.isLoading = true;
3312
+ if (taskId === '0') {
3313
+ this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
3314
+ return false;
3315
+ }
3316
+
3317
+ if (this.formStore.applicationData.clientApp.iin !== this.formStore.applicationData.clientApp.iin) {
3318
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
3319
+ return false;
3320
+ }
3321
+
3322
+ if (this.formStore.lfb.beneficialOwners) {
3323
+ if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
3324
+ return false;
3325
+ }
3326
+ const inStatement = this.formStore.lfb.beneficialOwners.every(i => i.id !== null);
3327
+ if (inStatement === false) {
3328
+ this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficialOwner') }));
3329
+ return false;
3330
+ }
3331
+ }
3332
+
3333
+ if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
3334
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
3335
+ return false;
3336
+ }
3337
+
3338
+ if (this.formStore.lfb.clients) {
3339
+ if (this.validateMultipleMembersV2('clients', 'insuredApp', 'застрахованных') === false) {
3340
+ return false;
3341
+ }
3342
+ const inStatement = this.formStore.lfb.clients.every(i => i.id !== null);
3343
+ if (inStatement === false) {
3344
+ this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.insured') }));
3345
+ return false;
3346
+ }
3347
+ }
3348
+
3349
+ if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
3350
+ for (const client of this.formStore.lfb.clients) {
3351
+ if (client.hasAttachedFile === false) {
3352
+ this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
3353
+ return false;
3354
+ }
3355
+ }
3356
+ }
3357
+
3358
+ if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
3359
+ this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
3360
+ return false;
3361
+ }
3362
+
3363
+ if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
3364
+ this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
3365
+ return false;
3366
+ }
3367
+
3368
+ return true;
3369
+ },
3370
+ async checkIIN(iin: string) {
3371
+ try {
3372
+ const response = await this.api.checkIIN(iin);
3373
+ return response;
3374
+ } catch (err) {
3375
+ ErrorHandler(err);
3376
+ return null;
3377
+ }
3378
+ },
3379
+ async checkAccountNumber(iik: string) {
3380
+ try {
3381
+ const checked = await this.api.checkAccountNumber(iik);
3382
+ return checked;
3383
+ } catch (err) {
3384
+ return ErrorHandler(err);
3385
+ }
3386
+ },
2595
3387
  async isCourseChanged(processInstanceId: string) {
2596
3388
  try {
2597
3389
  const response = await this.api.isCourseChanged(processInstanceId);
@@ -2601,6 +3393,7 @@ export const useDataStore = defineStore('data', {
2601
3393
  }
2602
3394
  },
2603
3395
  hasJobSection(whichForm: keyof typeof StoreMembers) {
3396
+ if (this.isLifetrip) return false;
2604
3397
  switch (whichForm) {
2605
3398
  case this.formStore.beneficiaryFormKey:
2606
3399
  case this.formStore.beneficialOwnerFormKey:
@@ -2641,8 +3434,22 @@ export const useDataStore = defineStore('data', {
2641
3434
  hasPercentageOfPayoutAmount() {
2642
3435
  return true;
2643
3436
  },
2644
- canViewInvoiceInfo() {
2645
- return this.isAdmin();
3437
+ hasAccess() {
3438
+ return {
3439
+ invoiceInfo: this.isAdmin(),
3440
+ toLKA: this.isAgent() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn(),
3441
+ toAML: this.isCompliance() || this.isAdmin() || this.isSupport() || this.isAnalyst(),
3442
+ toEFO:
3443
+ this.isInitiator() ||
3444
+ this.isUnderwriter() ||
3445
+ this.isAdmin() ||
3446
+ this.isCompliance() ||
3447
+ this.isAnalyst() ||
3448
+ this.isUpk() ||
3449
+ this.isFinCenter() ||
3450
+ this.isSupervisor() ||
3451
+ this.isSupport(),
3452
+ };
2646
3453
  },
2647
3454
  },
2648
3455
  });