hl-core 0.0.10-beta.30 → 0.0.10-beta.32

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.
@@ -66,8 +66,9 @@ export const useDataStore = defineStore('data', {
66
66
  isBalam: state => state.product === 'balam',
67
67
  isDSO: state => state.product === 'dso',
68
68
  isUU: state => state.product === 'uu',
69
- hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
69
+ hasClientAnketa: state => Array.isArray(state.formStore.additionalInsuranceTerms) && state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
70
70
  isClientAnketaCondition: state =>
71
+ Array.isArray(state.formStore.additionalInsuranceTerms) &&
71
72
  !state.formStore.insuredForm.find(member => member.iin === state.formStore.policyholderForm.iin) &&
72
73
  !!state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10 && i.coverSumCode === 'included'),
73
74
  },
@@ -280,39 +281,75 @@ export const useDataStore = defineStore('data', {
280
281
  if (!file.id) return;
281
282
  try {
282
283
  this.isLoading = true;
283
- await this.api.file.getFile(file.id).then((response: any) => {
284
- if (!['pdf', 'docx'].includes(fileType)) {
285
- const blob = new Blob([response], { type: `image/${fileType}` });
286
- const url = window.URL.createObjectURL(blob);
287
- const link = document.createElement('a');
288
- link.href = url;
289
- if (mode === 'view') {
290
- setTimeout(() => {
291
- window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
292
- });
284
+ if (this.isPension) {
285
+ await this.api.file.getFileNew(file.id).then((response: any) => {
286
+ if (!['pdf', 'docx'].includes(fileType)) {
287
+ const blob = new Blob([response], { type: `image/${fileType}` });
288
+ const url = window.URL.createObjectURL(blob);
289
+ const link = document.createElement('a');
290
+ link.href = url;
291
+ if (mode === 'view') {
292
+ setTimeout(() => {
293
+ window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
294
+ });
295
+ } else {
296
+ link.setAttribute('download', file.fileName!);
297
+ document.body.appendChild(link);
298
+ link.click();
299
+ }
293
300
  } else {
294
- link.setAttribute('download', file.fileName!);
295
- document.body.appendChild(link);
296
- link.click();
297
- }
298
- } else {
299
- const blob = new Blob([response], {
300
- type: `application/${fileType}`,
301
- });
302
- const url = window.URL.createObjectURL(blob);
303
- const link = document.createElement('a');
304
- link.href = url;
305
- if (mode === 'view') {
306
- setTimeout(() => {
307
- window.open(url, '_blank', `right=100`);
301
+ const blob = new Blob([response], {
302
+ type: `application/${fileType}`,
308
303
  });
304
+ const url = window.URL.createObjectURL(blob);
305
+ const link = document.createElement('a');
306
+ link.href = url;
307
+ if (mode === 'view') {
308
+ setTimeout(() => {
309
+ window.open(url, '_blank', `right=100`);
310
+ });
311
+ } else {
312
+ link.setAttribute('download', file.fileName!);
313
+ document.body.appendChild(link);
314
+ link.click();
315
+ }
316
+ }
317
+ });
318
+ } else {
319
+ await this.api.file.getFile(file.id).then((response: any) => {
320
+ if (!['pdf', 'docx'].includes(fileType)) {
321
+ const blob = new Blob([response], { type: `image/${fileType}` });
322
+ const url = window.URL.createObjectURL(blob);
323
+ const link = document.createElement('a');
324
+ link.href = url;
325
+ if (mode === 'view') {
326
+ setTimeout(() => {
327
+ window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
328
+ });
329
+ } else {
330
+ link.setAttribute('download', file.fileName!);
331
+ document.body.appendChild(link);
332
+ link.click();
333
+ }
309
334
  } else {
310
- link.setAttribute('download', file.fileName!);
311
- document.body.appendChild(link);
312
- link.click();
335
+ const blob = new Blob([response], {
336
+ type: `application/${fileType}`,
337
+ });
338
+ const url = window.URL.createObjectURL(blob);
339
+ const link = document.createElement('a');
340
+ link.href = url;
341
+ if (mode === 'view') {
342
+ setTimeout(() => {
343
+ window.open(url, '_blank', `right=100`);
344
+ });
345
+ } else {
346
+ link.setAttribute('download', file.fileName!);
347
+ document.body.appendChild(link);
348
+ link.click();
349
+ }
313
350
  }
314
- }
315
- });
351
+ });
352
+ }
316
353
  } catch (err) {
317
354
  ErrorHandler(err);
318
355
  } finally {
@@ -360,6 +397,7 @@ export const useDataStore = defineStore('data', {
360
397
  lastName: '',
361
398
  middleName: '',
362
399
  iin: member.iin ? member.iin.replace(/-/g, '') : '',
400
+ birthDate: '',
363
401
  };
364
402
  const contragentResponse = await this.api.getContragent(queryData);
365
403
  if (contragentResponse.totalItems > 0) {
@@ -381,11 +419,17 @@ export const useDataStore = defineStore('data', {
381
419
  }
382
420
  this.isLoading = false;
383
421
  },
384
- async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
422
+ async getContragentById(id: number, whichForm: keyof typeof StoreMembers | 'slaveInsuredForm', load: boolean = true, whichIndex: number | null = null) {
385
423
  if (Number(id) === 0) return;
386
424
  this.isLoading = load;
387
425
  try {
388
- const member = whichIndex === null ? this.formStore[whichForm as Types.SingleMember] : this.formStore[whichForm as Types.MultipleMember][whichIndex];
426
+ const member =
427
+ this.isPension && whichForm === 'slaveInsuredForm'
428
+ ? this.formStore.slaveInsuredForm
429
+ : whichIndex === null
430
+ ? this.formStore[whichForm as Types.SingleMember]
431
+ : this.formStore[whichForm as Types.MultipleMember][whichIndex];
432
+
389
433
  const contragentResponse = await this.api.getContragentById(id);
390
434
  if (contragentResponse.totalItems > 0) {
391
435
  await this.serializeContragentData(member, contragentResponse.items[0]);
@@ -442,7 +486,7 @@ export const useDataStore = defineStore('data', {
442
486
  member.verifyDate = user.personalData.verifyDate;
443
487
  member.iin = reformatIin(user.personalData.iin);
444
488
  member.age = String(user.personalData.age);
445
- const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
489
+ const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace ?? 'undefined', 'i')));
446
490
  member.birthPlace = country && Object.keys(country).length ? country : new Value();
447
491
  const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
448
492
  member.gender = gender ? gender : new Value();
@@ -874,6 +918,9 @@ export const useDataStore = defineStore('data', {
874
918
  isIpdlCompliance: null,
875
919
  isTerrorCompliance: null,
876
920
  };
921
+ if (this.isPension && memberFromApplicaiton && memberFromApplicaiton.processInstanceId === this.formStore.applicationData.slave?.processInstanceId) {
922
+ data.processInstanceId = this.formStore.applicationData.slave.processInstanceId;
923
+ }
877
924
  data.id = memberFromApplicaiton && memberFromApplicaiton.id ? memberFromApplicaiton.id : null;
878
925
  if (whichMember === 'Client') {
879
926
  data.isInsured = this.formStore.isPolicyholderInsured;
@@ -883,6 +930,12 @@ export const useDataStore = defineStore('data', {
883
930
  data.jobName = member.jobPlace;
884
931
  data.positionCode = member.positionCode;
885
932
  data.familyStatusId = member.familyStatus.id;
933
+ if (this.isPension) {
934
+ data.id =
935
+ memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
936
+ ? this.formStore.applicationData.clientApp.id
937
+ : this.formStore.applicationData.slave.clientApp.id;
938
+ }
886
939
  }
887
940
  if (whichMember === 'Spokesman') {
888
941
  if (!!memberFromApplicaiton && memberFromApplicaiton.iin !== data.iin) {
@@ -941,6 +994,12 @@ export const useDataStore = defineStore('data', {
941
994
  data.familyStatusId = member.familyStatus.id;
942
995
  data.relationId = member.relationDegree.ids;
943
996
  data.relationName = member.relationDegree.nameRu;
997
+ if (this.isPension) {
998
+ data.id =
999
+ memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
1000
+ ? this.formStore.applicationData.insuredApp[0].id
1001
+ : this.formStore.applicationData.slave.insuredApp[0].id;
1002
+ }
944
1003
  }
945
1004
  if (whichMember === 'Beneficiary') {
946
1005
  if (
@@ -985,10 +1044,20 @@ export const useDataStore = defineStore('data', {
985
1044
  }
986
1045
  }
987
1046
  },
988
- async setApplication(applicationData: object, calculate: boolean = false) {
1047
+ async setApplication(applicationData: any, calculate: boolean = false) {
989
1048
  try {
990
1049
  this.isLoading = true;
991
1050
  this.isButtonsLoading = true;
1051
+ if (this.isPension) {
1052
+ applicationData.transferContractCompany = '';
1053
+ if (applicationData.slave) {
1054
+ applicationData.slave.guaranteedPeriod = applicationData.slave.guaranteedPeriod ?? 0;
1055
+ applicationData.slave.transferContractCompany = '';
1056
+ }
1057
+ if (Number(this.formStore.applicationData.processCode) === 24) {
1058
+ applicationData.transferContractAmount = applicationData.parentContractAmount - applicationData.refundAmount;
1059
+ }
1060
+ }
992
1061
  await this.api.setApplication(applicationData);
993
1062
  if (calculate) {
994
1063
  await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
@@ -1382,7 +1451,8 @@ export const useDataStore = defineStore('data', {
1382
1451
  return await this.getFromApi('economySectorCode', 'getSectorCode');
1383
1452
  },
1384
1453
  async getEconomicActivityType() {
1385
- if (this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
1454
+ const makeCall = this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension;
1455
+ if (makeCall) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
1386
1456
  },
1387
1457
  async getFamilyStatuses() {
1388
1458
  return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
@@ -1394,42 +1464,36 @@ export const useDataStore = defineStore('data', {
1394
1464
  return await this.getFromApi('relations', 'getRelationTypes');
1395
1465
  },
1396
1466
  async getBanks() {
1397
- if (this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO) return await this.getFromApi('banks', 'getBanks');
1467
+ const makeCall = this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO;
1468
+ if (makeCall) return await this.getFromApi('banks', 'getBanks');
1398
1469
  },
1399
1470
  async getInsuranceCompanies() {
1400
1471
  if (this.isPension) return await this.getFromApi('transferContractCompanies', 'getInsuranceCompanies');
1401
1472
  },
1402
1473
  async getProcessIndexRate() {
1403
- if (this.processCode) {
1404
- return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
1405
- }
1474
+ const makeCall = (this.isBaiterek || this.isBolashak || this.isGons) && this.processCode;
1475
+ if (makeCall) return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
1406
1476
  },
1407
1477
  async getProcessPaymentPeriod() {
1408
- if (this.processCode) {
1409
- return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
1410
- }
1478
+ const makeCall = !this.isPension && this.processCode;
1479
+ if (makeCall) return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
1411
1480
  },
1412
1481
  async getQuestionRefs(id?: string) {
1413
1482
  return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
1414
1483
  },
1415
- async getProcessTariff() {
1416
- if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
1417
- },
1418
1484
  async getDicAnnuityTypeList() {
1419
1485
  return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
1420
1486
  },
1421
1487
  async getProcessAnnuityPaymentPeriod() {
1422
- if (this.processCode) {
1423
- return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
1424
- }
1488
+ const makeCall = this.isLiferenta && this.processCode;
1489
+ if (makeCall) return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
1425
1490
  },
1426
1491
  async getInsurancePay() {
1427
1492
  return await this.getFromApi('insurancePay', 'getInsurancePay');
1428
1493
  },
1429
1494
  async getProcessGfot() {
1430
- if (this.processCode) {
1431
- return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
1432
- }
1495
+ const makeCall = (this.isLifeBusiness || this.isGns) && this.processCode;
1496
+ if (makeCall) return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
1433
1497
  },
1434
1498
  async getCurrencies() {
1435
1499
  try {
@@ -1476,7 +1540,6 @@ export const useDataStore = defineStore('data', {
1476
1540
  this.getFamilyStatuses(),
1477
1541
  this.getRelationTypes(),
1478
1542
  this.getProcessIndexRate(),
1479
- this.getProcessTariff(),
1480
1543
  this.getProcessPaymentPeriod(),
1481
1544
  this.getDicFileTypeList(),
1482
1545
  this.getDicAnnuityTypeList(),
@@ -1586,16 +1649,16 @@ export const useDataStore = defineStore('data', {
1586
1649
  column: column,
1587
1650
  direction: direction,
1588
1651
  groupCode: groupCode,
1589
- processCodes: this.isEFO ? Object.values(constants.products) : [constants.products.baiterek],
1652
+ processCodes: this.isEFO
1653
+ ? Object.values(constants.products).filter(
1654
+ i => i !== constants.products.pensionannuity && i !== constants.products.pensionannuityrefund && i !== constants.products.pensionannuityjoint,
1655
+ )
1656
+ : [constants.products.baiterek],
1590
1657
  };
1591
1658
  if (byOneProcess !== null) {
1592
1659
  delete query.processCodes;
1593
1660
  query.processCode = byOneProcess;
1594
1661
  }
1595
- if (byOneProcess === 19 && !useEnv().isProduction) {
1596
- query.processCodes = [19, 2];
1597
- delete query.processCode;
1598
- }
1599
1662
  const taskList = await this.api.getTaskList(
1600
1663
  processInstanceId === null
1601
1664
  ? query
@@ -1871,7 +1934,7 @@ export const useDataStore = defineStore('data', {
1871
1934
  this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
1872
1935
  }
1873
1936
  if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
1874
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremiumWithCommission);
1937
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(calculationResponse.mainPremiumWithCommission as number);
1875
1938
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.mainInsSum === 0 ? null : calculationResponse.mainInsSum);
1876
1939
  this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1877
1940
  if (calculationResponse.agentCommission) {
@@ -1930,7 +1993,7 @@ export const useDataStore = defineStore('data', {
1930
1993
  this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
1931
1994
  }
1932
1995
  if (this.isLifeBusiness || this.isGns) {
1933
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
1996
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(result.value);
1934
1997
  if (applicationData.insuredApp && applicationData.insuredApp.length) {
1935
1998
  const res = await this.newInsuredList(applicationData.insuredApp);
1936
1999
  this.formStore.lfb.clients = res;
@@ -1952,6 +2015,38 @@ export const useDataStore = defineStore('data', {
1952
2015
  }
1953
2016
  this.isLoading = false;
1954
2017
  },
2018
+ async reCalculateRefund(insSum: number, insSumMain: number, guaranteedPeriod: number, isOppv: boolean, transferContractMonthCount: number | null) {
2019
+ this.isLoading = true;
2020
+ try {
2021
+ const data = {
2022
+ processInstanceId: this.formStore.applicationData.processInstanceId,
2023
+ insSum: insSum,
2024
+ insSumMain: insSumMain,
2025
+ guaranteedPeriod: guaranteedPeriod,
2026
+ isOppv: isOppv,
2027
+ transferContractMonthCount: transferContractMonthCount,
2028
+ };
2029
+ const response = await this.api.pensionannuityNew.reCalculateRefund(data);
2030
+ } catch (err) {
2031
+ ErrorHandler(err);
2032
+ }
2033
+ this.isLoading = false;
2034
+ },
2035
+ async calcParentContractSums(closeContractCompanyCode: string, closeContractCompanyName: string, isContractClosed: boolean) {
2036
+ this.isLoading = true;
2037
+ try {
2038
+ const data = {
2039
+ processInstanceId: this.formStore.applicationData.processInstanceId,
2040
+ closeContractCompanyCode: closeContractCompanyCode,
2041
+ closeContractCompanyName: closeContractCompanyName,
2042
+ isContractClosed: isContractClosed,
2043
+ };
2044
+ const response = await this.api.pensionannuityNew.calcParentContractSums(data);
2045
+ } catch (err) {
2046
+ ErrorHandler(err);
2047
+ }
2048
+ this.isLoading = false;
2049
+ },
1955
2050
  async calculatePremium(data: any) {
1956
2051
  this.isLoading = true;
1957
2052
  try {
@@ -2055,6 +2150,7 @@ export const useDataStore = defineStore('data', {
2055
2150
 
2056
2151
  const clientData = applicationData.clientApp;
2057
2152
  const insuredData: any[] = applicationData.insuredApp;
2153
+ const slaveInsuredData: any = applicationData.slave?.insuredApp[0] ?? null;
2058
2154
  const beneficiaryData: any[] = applicationData.beneficiaryApp;
2059
2155
  const beneficialOwnerData: any[] = applicationData.beneficialOwnerApp;
2060
2156
  const spokesmanData: any = applicationData.spokesmanApp;
@@ -2068,6 +2164,21 @@ export const useDataStore = defineStore('data', {
2068
2164
  this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
2069
2165
  }
2070
2166
 
2167
+ if ('pensionApp' in applicationData && applicationData.pensionApp) {
2168
+ this.formStore.pensionApp = applicationData.pensionApp;
2169
+ if ('slave' in applicationData && applicationData.slave) this.formStore.pensionApp.slave = applicationData.slave.pensionApp;
2170
+ if (setProductConditions) {
2171
+ const pensionKeysWithSpace = ['compulsoryContractAmount', 'compulsoryProfContractAmount', 'voluntaryContractAmount', 'ownFundsRaisAmount'];
2172
+ pensionKeysWithSpace.forEach(key => {
2173
+ if (/\s/g.test(this.formStore.pensionApp[key]) === false) this.formStore.pensionApp[key] = this.getNumberWithSpaces(this.formStore.pensionApp[key]);
2174
+ });
2175
+ if (this.formStore.pensionApp.slave)
2176
+ pensionKeysWithSpace.forEach(key => {
2177
+ if (/\s/g.test(this.formStore.pensionApp.slave[key]) === false)
2178
+ this.formStore.pensionApp.slave[key] = this.getNumberWithSpaces(this.formStore.pensionApp.slave[key]);
2179
+ });
2180
+ }
2181
+ }
2071
2182
  if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
2072
2183
  this.formStore.finCenterData = applicationData.finCenterData;
2073
2184
  this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
@@ -2145,6 +2256,13 @@ export const useDataStore = defineStore('data', {
2145
2256
  }
2146
2257
  });
2147
2258
  }
2259
+ if (slaveInsuredData) {
2260
+ allMembers.push({
2261
+ ...slaveInsuredData,
2262
+ key: 'slaveInsuredForm',
2263
+ index: null,
2264
+ });
2265
+ }
2148
2266
  if (beneficiaryData && beneficiaryData.length) {
2149
2267
  beneficiaryData.forEach((member, index) => {
2150
2268
  const inStore = this.formStore.beneficiaryForm.find(each => each.id == member.insisId);
@@ -2182,12 +2300,14 @@ export const useDataStore = defineStore('data', {
2182
2300
  this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
2183
2301
  if (insuredData && insuredData.length) {
2184
2302
  insuredData.forEach((each, index) => {
2185
- this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
2186
- const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
2187
- this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
2303
+ if (each) {
2304
+ this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
2305
+ const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
2306
+ this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
2307
+ }
2188
2308
  });
2189
2309
  }
2190
-
2310
+ if (slaveInsuredData) this.setMembersFieldSlave();
2191
2311
  if (beneficiaryData && beneficiaryData.length) {
2192
2312
  beneficiaryData.forEach((each, index) => {
2193
2313
  this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
@@ -2282,7 +2402,10 @@ export const useDataStore = defineStore('data', {
2282
2402
 
2283
2403
  if (this.isKazyna || this.isGons) {
2284
2404
  this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
2285
- this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
2405
+ this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
2406
+ this.formStore.applicationData.processCode === constants.products.halykkazynaap
2407
+ ? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premiumInCurrency)
2408
+ : this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
2286
2409
  }
2287
2410
  if (this.isGons && !useEnv().isProduction) {
2288
2411
  const currency = constants.currencyList.find(item => item.code === applicationData.policyAppDto.currency);
@@ -2457,14 +2580,43 @@ export const useDataStore = defineStore('data', {
2457
2580
  const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
2458
2581
  this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
2459
2582
  }
2460
- if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.applicationData.pensionApp) {
2461
- this.formStore[whichForm].bankInfo.iik = this.formStore.applicationData.pensionApp.account;
2462
- this.formStore[whichForm].bankInfo.bik = this.formStore.applicationData.pensionApp.bankBik;
2463
- const bank = this.banks.find(i => i.ids === this.formStore.applicationData.pensionApp.bankBin);
2464
- const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.applicationData.pensionApp.transferContractCompany);
2465
- this.formStore[whichForm].bankInfo.bankName = bank ? bank : new Value();
2466
- this.formStore[whichForm].bankInfo.bin = bank ? String(bank.ids) : '';
2467
- this.formStore.applicationData.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
2583
+ if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.pensionApp) {
2584
+ this.formStore[whichForm].bankInfo.iik = this.formStore.pensionApp.account;
2585
+ this.formStore[whichForm].bankInfo.bik = this.formStore.pensionApp.bankBik;
2586
+ this.formStore[whichForm].bankInfo.bankName.id = this.formStore.pensionApp.bankId;
2587
+ this.formStore[whichForm].bankInfo.bankName.nameRu = this.formStore.pensionApp.bankName;
2588
+ this.formStore[whichForm].bankInfo.bin = reformatIin(this.formStore.pensionApp.bankBin);
2589
+ const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.transferContractCompany);
2590
+ this.formStore.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
2591
+ }
2592
+ },
2593
+ setMembersFieldSlave() {
2594
+ this.formStore.slaveInsuredForm.familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData.slave['insuredApp'].familyStatusId);
2595
+ this.formStore.slaveInsuredForm.signOfIPDL = this.findObject(
2596
+ 'ipdl',
2597
+ 'nameRu',
2598
+ this.formStore.applicationData.slave.insuredApp[0].isIpdl === null ? null : this.formStore.applicationData.slave.insuredApp[0].isIpdl == true ? 'Да' : 'Нет',
2599
+ );
2600
+ this.formStore.slaveInsuredForm.gotFromInsis = false;
2601
+ if (!!this.formStore.applicationData.slave.insuredApp[0].profession) this.formStore.slaveInsuredForm.job = this.formStore.applicationData.slave.insuredApp[0].profession;
2602
+ if (!!this.formStore.applicationData.slave.insuredApp[0].position) this.formStore.slaveInsuredForm.jobPosition = this.formStore.applicationData.slave.insuredApp[0].position;
2603
+ if (!!this.formStore.applicationData.slave.insuredApp[0].jobName) this.formStore.slaveInsuredForm.jobPlace = this.formStore.applicationData.slave.insuredApp[0].jobName;
2604
+ if (!!this.formStore.applicationData.slave.insuredApp[0].positionCode)
2605
+ this.formStore.slaveInsuredForm.positionCode = this.formStore.applicationData.slave.insuredApp[0].positionCode;
2606
+ if (typeof this.formStore.applicationData.slave.insuredApp[0].isDisability === 'boolean')
2607
+ this.formStore.slaveInsuredForm.isDisability = this.formStore.applicationData.slave.insuredApp[0].isDisability;
2608
+ if (!!this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId) {
2609
+ const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId);
2610
+ this.formStore.slaveInsuredForm.disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
2611
+ }
2612
+ if (this.formStore.slaveInsuredForm.bankInfo) {
2613
+ this.formStore.slaveInsuredForm.bankInfo.iik = this.formStore.pensionApp.slave.account;
2614
+ this.formStore.slaveInsuredForm.bankInfo.bik = this.formStore.pensionApp.slave.bankBik;
2615
+ this.formStore.slaveInsuredForm.bankInfo.bankName.id = this.formStore.pensionApp.slave.bankId;
2616
+ this.formStore.slaveInsuredForm.bankInfo.bankName.nameRu = this.formStore.pensionApp.slave.bankName;
2617
+ this.formStore.slaveInsuredForm.bankInfo.bin = reformatIin(this.formStore.pensionApp.slave.bankBin);
2618
+ const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.slave.transferContractCompany);
2619
+ this.formStore.pensionApp.slave.transferContractCompany = transferCompany ? transferCompany : new Value();
2468
2620
  }
2469
2621
  },
2470
2622
  setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
@@ -2567,7 +2719,7 @@ export const useDataStore = defineStore('data', {
2567
2719
  const signData = await this.api.file.signXml(data);
2568
2720
  return signData;
2569
2721
  } else {
2570
- if (this.processCode === 19 || this.processCode === 2 || this.processCode === 4) {
2722
+ if (this.processCode === 19 || this.processCode === 24 || this.processCode === 25) {
2571
2723
  const result = await this.api.file.signBts(data);
2572
2724
  if (result.code === 0) this.formStore.signUrls = result.data;
2573
2725
  } else {
@@ -2601,9 +2753,8 @@ export const useDataStore = defineStore('data', {
2601
2753
  await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
2602
2754
  }
2603
2755
  return true;
2604
- } catch (err) {
2605
- ErrorHandler(err);
2606
- return false;
2756
+ } catch (err: any) {
2757
+ return err.name === 'NCALayerError' ? null : ErrorHandler(err);
2607
2758
  }
2608
2759
  },
2609
2760
  async getFileNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
@@ -2648,6 +2799,7 @@ export const useDataStore = defineStore('data', {
2648
2799
  }
2649
2800
  } catch (err) {
2650
2801
  ErrorHandler(err);
2802
+ this.formStore.signatories = [];
2651
2803
  }
2652
2804
  },
2653
2805
  async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
@@ -2877,6 +3029,15 @@ export const useDataStore = defineStore('data', {
2877
3029
  }
2878
3030
  }
2879
3031
  }
3032
+ } else if (applicationKey === 'slave') {
3033
+ if (this.formStore.slaveInsuredForm && this.formStore.applicationData.slave) {
3034
+ const localSlave = this.formStore.slaveInsuredForm;
3035
+ const applicationSlave = this.formStore.applicationData.slave.insuredApp[0];
3036
+ if ((localSlave.id === applicationSlave.insisId && applicationSlave.iin === localSlave.iin?.replace(/-/g, '')) === false) {
3037
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3038
+ return false;
3039
+ }
3040
+ }
2880
3041
  } else {
2881
3042
  if (this.formStore[localKey].some(i => i.iin !== null)) {
2882
3043
  this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
@@ -2922,6 +3083,9 @@ export const useDataStore = defineStore('data', {
2922
3083
  }
2923
3084
  }
2924
3085
  }
3086
+ if (this.formStore.applicationData.slave && this.validateMultipleMembers(this.formStore.insuredFormKey, 'slave', 'застрахованных') === false) {
3087
+ return false;
3088
+ }
2925
3089
  if (this.members.beneficiaryApp.has) {
2926
3090
  if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
2927
3091
  return false;
@@ -3038,7 +3202,12 @@ export const useDataStore = defineStore('data', {
3038
3202
  this.isLoading = true;
3039
3203
  const areMembersValid = await this.validateAllMembers(taskId);
3040
3204
  if (areMembersValid) {
3041
- if ((!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) || this.isPension) {
3205
+ if (
3206
+ (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) ||
3207
+ (this.isPension &&
3208
+ this.formStore.applicationData.pensionApp.isCalculated === true &&
3209
+ (this.formStore.applicationData.pensionApp.slave ? this.formStore.applicationData.pensionApp.slave.isCalculated === true : true))
3210
+ ) {
3042
3211
  if (this.controls.hasAnketa) {
3043
3212
  const hasCritical =
3044
3213
  this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
@@ -3296,69 +3465,72 @@ export const useDataStore = defineStore('data', {
3296
3465
  const gender = this.gender.find((i: Value) => i.id == person.gender.code);
3297
3466
  if (gender) member.gender = gender;
3298
3467
 
3299
- const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
3468
+ const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu ?? 'undefined', 'i')));
3300
3469
  if (birthPlace) member.birthPlace = birthPlace;
3301
3470
 
3302
- const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu, 'i')));
3471
+ const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu ?? 'undefined', 'i')));
3303
3472
  if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
3304
3473
 
3305
- const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu, 'i')));
3474
+ const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu ?? 'undefined', 'i')));
3306
3475
  if (regCountry) member.registrationCountry = regCountry;
3307
3476
 
3308
- const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu, 'i')));
3477
+ const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')));
3309
3478
  if (regProvince) member.registrationProvince = regProvince;
3479
+ else member.registrationProvince = new Value();
3310
3480
 
3311
- if ('city' in person.regAddress && !!person.regAddress.city) {
3312
- if (person.regAddress.city.includes(', ')) {
3313
- const personCities = person.regAddress.city.split(', ');
3481
+ let hasSetCity = false;
3482
+ let hasSetRegion = false;
3483
+ if (person.regAddress.city && String(person.regAddress.city).includes(', ')) {
3484
+ const personCities = String(person.regAddress.city).split(', ');
3485
+ for (let ind = 0; ind < personCities.length; ++ind) {
3486
+ const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
3487
+ if (possibleCity) {
3488
+ member.registrationCity = possibleCity;
3489
+ hasSetCity = true;
3490
+ break;
3491
+ }
3492
+ }
3493
+ if (member.registrationCity.nameRu === null) {
3314
3494
  for (let ind = 0; ind < personCities.length; ++ind) {
3315
- const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
3316
- if (possibleCity) {
3317
- member.registrationCity = possibleCity;
3495
+ const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
3496
+ if (possibleRegion) {
3497
+ member.registrationRegion = possibleRegion;
3498
+ hasSetRegion = true;
3318
3499
  break;
3319
3500
  }
3320
3501
  }
3321
- if (member.registrationCity.nameRu === null) {
3322
- for (let ind = 0; ind < personCities.length; ++ind) {
3323
- const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
3324
- if (possibleRegion) {
3325
- member.registrationRegion = possibleRegion;
3326
- break;
3327
- }
3328
- }
3329
- }
3330
- } else {
3331
- const regCity = this.cities.find(i => String(i.nameRu).match(new RegExp(person.regAddress.city, 'i')));
3332
- if (regCity) member.registrationCity = regCity;
3333
-
3334
- if (member.registrationCity.nameRu === null) {
3335
- const regRegion = this.regions.find(i => String(i.nameRu).match(new RegExp(person.regAddress.city, 'i')));
3336
- if (regRegion) member.registrationRegion = regRegion;
3337
- }
3338
3502
  }
3339
3503
  }
3340
3504
 
3341
- if (member.registrationCity.nameRu === null && member.registrationRegion.nameRu === null) {
3505
+ if (hasSetCity === false) {
3342
3506
  const regCity = this.cities.find(
3343
- i => String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu, 'i')) || String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu, 'i')),
3507
+ i =>
3508
+ String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
3509
+ String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
3510
+ String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
3344
3511
  );
3345
3512
  if (regCity) {
3346
3513
  member.registrationCity = regCity;
3347
3514
  const regType = this.localityTypes.find(i => String(i.nameRu) === 'город');
3348
3515
  if (regType) member.registrationRegionType = regType;
3349
- } else {
3350
- const regRegion = this.regions.find(
3351
- i => String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu, 'i')) || String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu, 'i')),
3352
- );
3353
- if (regRegion) {
3354
- member.registrationRegion = regRegion;
3355
- const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
3356
- if (regType) member.registrationRegionType = regType;
3357
- }
3358
- }
3516
+ } else member.registrationCity = new Value();
3517
+ }
3518
+
3519
+ if (hasSetRegion === false) {
3520
+ const regRegion = this.regions.find(
3521
+ i =>
3522
+ String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
3523
+ String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
3524
+ String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
3525
+ );
3526
+ if (regRegion) {
3527
+ member.registrationRegion = regRegion;
3528
+ const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
3529
+ if (regType) member.registrationRegionType = regType;
3530
+ } else member.registrationRegion = new Value();
3359
3531
  }
3360
3532
 
3361
- if (person.regAddress.street.includes(', ')) {
3533
+ if (person.regAddress.street && person.regAddress.street.includes(', ')) {
3362
3534
  const personAddress = person.regAddress.street.split(', ');
3363
3535
  const microDistrict = personAddress.find((i: string) => i.match(new RegExp('микрорайон', 'i')));
3364
3536
  const quarter = personAddress.find((i: string) => i.match(new RegExp('квартал', 'i')));
@@ -3554,15 +3726,23 @@ export const useDataStore = defineStore('data', {
3554
3726
  });
3555
3727
  }
3556
3728
 
3729
+ this.formStore.productConditionsForm.lifeMultiply = parseProcents(applicationData.policyAppDto.lifeMultiply);
3730
+ this.formStore.productConditionsForm.lifeAdditive = parseProcents(applicationData.policyAppDto.lifeAdditive);
3731
+ this.formStore.productConditionsForm.lifeMultiplyClient = parseProcents(applicationData.policyAppDto.lifeMultiplyClient);
3732
+ this.formStore.productConditionsForm.lifeAdditiveClient = parseProcents(applicationData.policyAppDto.lifeAdditiveClient);
3733
+ this.formStore.productConditionsForm.adbMultiply = parseProcents(applicationData.policyAppDto.adbMultiply);
3734
+ this.formStore.productConditionsForm.adbAdditive = parseProcents(applicationData.policyAppDto.adbAdditive);
3735
+ this.formStore.productConditionsForm.disabilityMultiply = parseProcents(applicationData.policyAppDto.disabilityMultiply);
3736
+ this.formStore.productConditionsForm.disabilityAdditive = parseProcents(applicationData.policyAppDto.disabilityAdditive);
3737
+
3557
3738
  this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.policyAppDto.calcDate);
3558
3739
  this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.policyAppDto.contractEndDate);
3559
3740
  this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission === 0 ? null : applicationData.policyAppDto.agentCommission;
3560
3741
  this.formStore.productConditionsForm.fixInsSum = this.getNumberWithSpaces(applicationData.policyAppDto.fixInsSum === 0 ? null : applicationData.policyAppDto.fixInsSum);
3561
3742
  this.formStore.productConditionsForm.coverPeriod = 12;
3562
3743
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount === 0 ? null : applicationData.policyAppDto.amount);
3563
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
3564
- applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : applicationData.policyAppDto.mainPremiumWithCommission,
3565
- );
3744
+ this.formStore.productConditionsForm.insurancePremiumPerMonth =
3745
+ applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
3566
3746
  const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
3567
3747
  this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
3568
3748
  const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
@@ -3785,6 +3965,19 @@ export const useDataStore = defineStore('data', {
3785
3965
  return false;
3786
3966
  }
3787
3967
 
3968
+ if (this.controls.hasAttachment) {
3969
+ const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
3970
+ if (areValid) {
3971
+ if (this.isInitiator()) {
3972
+ await this.setINSISWorkData();
3973
+ }
3974
+ } else {
3975
+ this.isLoading = false;
3976
+ this.showToaster('error', this.t('toaster.attachManagerError'), 3000);
3977
+ return false;
3978
+ }
3979
+ }
3980
+
3788
3981
  return true;
3789
3982
  },
3790
3983
  async getOnlineAccess(iin: string, documentType: string) {
@@ -3819,6 +4012,18 @@ export const useDataStore = defineStore('data', {
3819
4012
  return null;
3820
4013
  }
3821
4014
  },
4015
+ async updateDigitalDocumentsProfile(iin: string) {
4016
+ try {
4017
+ const data = {
4018
+ iinBin: iin.replaceAll('-', ''),
4019
+ };
4020
+ await this.api.externalServices.updateDigitalDocumentsProfile(data);
4021
+ this.showToaster('success', this.t('toaster.successProfile'), 3000);
4022
+ } catch (err) {
4023
+ ErrorHandler(err);
4024
+ return null;
4025
+ }
4026
+ },
3822
4027
  async getVariableData(processCode: number) {
3823
4028
  try {
3824
4029
  const response = await this.api.getVariableData(0, processCode);
@@ -3914,7 +4119,7 @@ export const useDataStore = defineStore('data', {
3914
4119
  }
3915
4120
  },
3916
4121
  hasBankSection(whichForm: keyof typeof StoreMembers) {
3917
- if (!this.isPension) return false;
4122
+ if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
3918
4123
  switch (whichForm) {
3919
4124
  case 'beneficiaryForm':
3920
4125
  return false;
@@ -3923,7 +4128,7 @@ export const useDataStore = defineStore('data', {
3923
4128
  }
3924
4129
  },
3925
4130
  hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
3926
- if (!this.isPension) return false;
4131
+ if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
3927
4132
  switch (whichForm) {
3928
4133
  case 'beneficiaryForm':
3929
4134
  return false;