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

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.
@@ -280,39 +280,75 @@ export const useDataStore = defineStore('data', {
280
280
  if (!file.id) return;
281
281
  try {
282
282
  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
- });
283
+ if (this.isPension) {
284
+ await this.api.file.getFileNew(file.id).then((response: any) => {
285
+ if (!['pdf', 'docx'].includes(fileType)) {
286
+ const blob = new Blob([response], { type: `image/${fileType}` });
287
+ const url = window.URL.createObjectURL(blob);
288
+ const link = document.createElement('a');
289
+ link.href = url;
290
+ if (mode === 'view') {
291
+ setTimeout(() => {
292
+ window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
293
+ });
294
+ } else {
295
+ link.setAttribute('download', file.fileName!);
296
+ document.body.appendChild(link);
297
+ link.click();
298
+ }
293
299
  } 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`);
300
+ const blob = new Blob([response], {
301
+ type: `application/${fileType}`,
308
302
  });
303
+ const url = window.URL.createObjectURL(blob);
304
+ const link = document.createElement('a');
305
+ link.href = url;
306
+ if (mode === 'view') {
307
+ setTimeout(() => {
308
+ window.open(url, '_blank', `right=100`);
309
+ });
310
+ } else {
311
+ link.setAttribute('download', file.fileName!);
312
+ document.body.appendChild(link);
313
+ link.click();
314
+ }
315
+ }
316
+ });
317
+ } else {
318
+ await this.api.file.getFile(file.id).then((response: any) => {
319
+ if (!['pdf', 'docx'].includes(fileType)) {
320
+ const blob = new Blob([response], { type: `image/${fileType}` });
321
+ const url = window.URL.createObjectURL(blob);
322
+ const link = document.createElement('a');
323
+ link.href = url;
324
+ if (mode === 'view') {
325
+ setTimeout(() => {
326
+ window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
327
+ });
328
+ } else {
329
+ link.setAttribute('download', file.fileName!);
330
+ document.body.appendChild(link);
331
+ link.click();
332
+ }
309
333
  } else {
310
- link.setAttribute('download', file.fileName!);
311
- document.body.appendChild(link);
312
- link.click();
334
+ const blob = new Blob([response], {
335
+ type: `application/${fileType}`,
336
+ });
337
+ const url = window.URL.createObjectURL(blob);
338
+ const link = document.createElement('a');
339
+ link.href = url;
340
+ if (mode === 'view') {
341
+ setTimeout(() => {
342
+ window.open(url, '_blank', `right=100`);
343
+ });
344
+ } else {
345
+ link.setAttribute('download', file.fileName!);
346
+ document.body.appendChild(link);
347
+ link.click();
348
+ }
313
349
  }
314
- }
315
- });
350
+ });
351
+ }
316
352
  } catch (err) {
317
353
  ErrorHandler(err);
318
354
  } finally {
@@ -360,6 +396,7 @@ export const useDataStore = defineStore('data', {
360
396
  lastName: '',
361
397
  middleName: '',
362
398
  iin: member.iin ? member.iin.replace(/-/g, '') : '',
399
+ birthDate: '',
363
400
  };
364
401
  const contragentResponse = await this.api.getContragent(queryData);
365
402
  if (contragentResponse.totalItems > 0) {
@@ -381,11 +418,17 @@ export const useDataStore = defineStore('data', {
381
418
  }
382
419
  this.isLoading = false;
383
420
  },
384
- async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
421
+ async getContragentById(id: number, whichForm: keyof typeof StoreMembers | 'slaveInsuredForm', load: boolean = true, whichIndex: number | null = null) {
385
422
  if (Number(id) === 0) return;
386
423
  this.isLoading = load;
387
424
  try {
388
- const member = whichIndex === null ? this.formStore[whichForm as Types.SingleMember] : this.formStore[whichForm as Types.MultipleMember][whichIndex];
425
+ const member =
426
+ this.isPension && whichForm === 'slaveInsuredForm'
427
+ ? this.formStore.slaveInsuredForm
428
+ : whichIndex === null
429
+ ? this.formStore[whichForm as Types.SingleMember]
430
+ : this.formStore[whichForm as Types.MultipleMember][whichIndex];
431
+
389
432
  const contragentResponse = await this.api.getContragentById(id);
390
433
  if (contragentResponse.totalItems > 0) {
391
434
  await this.serializeContragentData(member, contragentResponse.items[0]);
@@ -442,7 +485,7 @@ export const useDataStore = defineStore('data', {
442
485
  member.verifyDate = user.personalData.verifyDate;
443
486
  member.iin = reformatIin(user.personalData.iin);
444
487
  member.age = String(user.personalData.age);
445
- const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
488
+ const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace ?? 'undefined', 'i')));
446
489
  member.birthPlace = country && Object.keys(country).length ? country : new Value();
447
490
  const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
448
491
  member.gender = gender ? gender : new Value();
@@ -874,6 +917,9 @@ export const useDataStore = defineStore('data', {
874
917
  isIpdlCompliance: null,
875
918
  isTerrorCompliance: null,
876
919
  };
920
+ if (this.isPension && memberFromApplicaiton && memberFromApplicaiton.processInstanceId === this.formStore.applicationData.slave?.processInstanceId) {
921
+ data.processInstanceId = this.formStore.applicationData.slave.processInstanceId;
922
+ }
877
923
  data.id = memberFromApplicaiton && memberFromApplicaiton.id ? memberFromApplicaiton.id : null;
878
924
  if (whichMember === 'Client') {
879
925
  data.isInsured = this.formStore.isPolicyholderInsured;
@@ -883,6 +929,12 @@ export const useDataStore = defineStore('data', {
883
929
  data.jobName = member.jobPlace;
884
930
  data.positionCode = member.positionCode;
885
931
  data.familyStatusId = member.familyStatus.id;
932
+ if (this.isPension) {
933
+ data.id =
934
+ memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
935
+ ? this.formStore.applicationData.clientApp.id
936
+ : this.formStore.applicationData.slave.clientApp.id;
937
+ }
886
938
  }
887
939
  if (whichMember === 'Spokesman') {
888
940
  if (!!memberFromApplicaiton && memberFromApplicaiton.iin !== data.iin) {
@@ -941,6 +993,12 @@ export const useDataStore = defineStore('data', {
941
993
  data.familyStatusId = member.familyStatus.id;
942
994
  data.relationId = member.relationDegree.ids;
943
995
  data.relationName = member.relationDegree.nameRu;
996
+ if (this.isPension) {
997
+ data.id =
998
+ memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
999
+ ? this.formStore.applicationData.insuredApp[0].id
1000
+ : this.formStore.applicationData.slave.insuredApp[0].id;
1001
+ }
944
1002
  }
945
1003
  if (whichMember === 'Beneficiary') {
946
1004
  if (
@@ -985,10 +1043,20 @@ export const useDataStore = defineStore('data', {
985
1043
  }
986
1044
  }
987
1045
  },
988
- async setApplication(applicationData: object, calculate: boolean = false) {
1046
+ async setApplication(applicationData: any, calculate: boolean = false) {
989
1047
  try {
990
1048
  this.isLoading = true;
991
1049
  this.isButtonsLoading = true;
1050
+ if (this.isPension) {
1051
+ applicationData.transferContractCompany = '';
1052
+ if (applicationData.slave) {
1053
+ applicationData.slave.guaranteedPeriod = applicationData.slave.guaranteedPeriod ?? 0;
1054
+ applicationData.slave.transferContractCompany = '';
1055
+ }
1056
+ if (Number(this.formStore.applicationData.processCode) === 24) {
1057
+ applicationData.transferContractAmount = applicationData.parentContractAmount - applicationData.refundAmount;
1058
+ }
1059
+ }
992
1060
  await this.api.setApplication(applicationData);
993
1061
  if (calculate) {
994
1062
  await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
@@ -1586,16 +1654,16 @@ export const useDataStore = defineStore('data', {
1586
1654
  column: column,
1587
1655
  direction: direction,
1588
1656
  groupCode: groupCode,
1589
- processCodes: this.isEFO ? Object.values(constants.products) : [constants.products.baiterek],
1657
+ processCodes: this.isEFO
1658
+ ? Object.values(constants.products).filter(
1659
+ i => i !== constants.products.pensionannuity && i !== constants.products.pensionannuityrefund && i !== constants.products.pensionannuityjoint,
1660
+ )
1661
+ : [constants.products.baiterek],
1590
1662
  };
1591
1663
  if (byOneProcess !== null) {
1592
1664
  delete query.processCodes;
1593
1665
  query.processCode = byOneProcess;
1594
1666
  }
1595
- if (byOneProcess === 19 && !useEnv().isProduction) {
1596
- query.processCodes = [19, 2];
1597
- delete query.processCode;
1598
- }
1599
1667
  const taskList = await this.api.getTaskList(
1600
1668
  processInstanceId === null
1601
1669
  ? query
@@ -1952,6 +2020,38 @@ export const useDataStore = defineStore('data', {
1952
2020
  }
1953
2021
  this.isLoading = false;
1954
2022
  },
2023
+ async reCalculateRefund(insSum: number, insSumMain: number, guaranteedPeriod: number, isOppv: boolean, transferContractMonthCount: number | null) {
2024
+ this.isLoading = true;
2025
+ try {
2026
+ const data = {
2027
+ processInstanceId: this.formStore.applicationData.processInstanceId,
2028
+ insSum: insSum,
2029
+ insSumMain: insSumMain,
2030
+ guaranteedPeriod: guaranteedPeriod,
2031
+ isOppv: isOppv,
2032
+ transferContractMonthCount: transferContractMonthCount,
2033
+ };
2034
+ const response = await this.api.pensionannuityNew.reCalculateRefund(data);
2035
+ } catch (err) {
2036
+ ErrorHandler(err);
2037
+ }
2038
+ this.isLoading = false;
2039
+ },
2040
+ async calcParentContractSums(closeContractCompanyCode: string, closeContractCompanyName: string, isContractClosed: boolean) {
2041
+ this.isLoading = true;
2042
+ try {
2043
+ const data = {
2044
+ processInstanceId: this.formStore.applicationData.processInstanceId,
2045
+ closeContractCompanyCode: closeContractCompanyCode,
2046
+ closeContractCompanyName: closeContractCompanyName,
2047
+ isContractClosed: isContractClosed,
2048
+ };
2049
+ const response = await this.api.pensionannuityNew.calcParentContractSums(data);
2050
+ } catch (err) {
2051
+ ErrorHandler(err);
2052
+ }
2053
+ this.isLoading = false;
2054
+ },
1955
2055
  async calculatePremium(data: any) {
1956
2056
  this.isLoading = true;
1957
2057
  try {
@@ -2055,6 +2155,7 @@ export const useDataStore = defineStore('data', {
2055
2155
 
2056
2156
  const clientData = applicationData.clientApp;
2057
2157
  const insuredData: any[] = applicationData.insuredApp;
2158
+ const slaveInsuredData: any = applicationData.slave?.insuredApp[0] ?? null;
2058
2159
  const beneficiaryData: any[] = applicationData.beneficiaryApp;
2059
2160
  const beneficialOwnerData: any[] = applicationData.beneficialOwnerApp;
2060
2161
  const spokesmanData: any = applicationData.spokesmanApp;
@@ -2068,6 +2169,21 @@ export const useDataStore = defineStore('data', {
2068
2169
  this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
2069
2170
  }
2070
2171
 
2172
+ if ('pensionApp' in applicationData && applicationData.pensionApp) {
2173
+ this.formStore.pensionApp = applicationData.pensionApp;
2174
+ if ('slave' in applicationData && applicationData.slave) this.formStore.pensionApp.slave = applicationData.slave.pensionApp;
2175
+ if (setProductConditions) {
2176
+ const pensionKeysWithSpace = ['compulsoryContractAmount', 'compulsoryProfContractAmount', 'voluntaryContractAmount', 'ownFundsRaisAmount'];
2177
+ pensionKeysWithSpace.forEach(key => {
2178
+ if (/\s/g.test(this.formStore.pensionApp[key]) === false) this.formStore.pensionApp[key] = this.getNumberWithSpaces(this.formStore.pensionApp[key]);
2179
+ });
2180
+ if (this.formStore.pensionApp.slave)
2181
+ pensionKeysWithSpace.forEach(key => {
2182
+ if (/\s/g.test(this.formStore.pensionApp.slave[key]) === false)
2183
+ this.formStore.pensionApp.slave[key] = this.getNumberWithSpaces(this.formStore.pensionApp.slave[key]);
2184
+ });
2185
+ }
2186
+ }
2071
2187
  if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
2072
2188
  this.formStore.finCenterData = applicationData.finCenterData;
2073
2189
  this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
@@ -2145,6 +2261,13 @@ export const useDataStore = defineStore('data', {
2145
2261
  }
2146
2262
  });
2147
2263
  }
2264
+ if (slaveInsuredData) {
2265
+ allMembers.push({
2266
+ ...slaveInsuredData,
2267
+ key: 'slaveInsuredForm',
2268
+ index: null,
2269
+ });
2270
+ }
2148
2271
  if (beneficiaryData && beneficiaryData.length) {
2149
2272
  beneficiaryData.forEach((member, index) => {
2150
2273
  const inStore = this.formStore.beneficiaryForm.find(each => each.id == member.insisId);
@@ -2182,12 +2305,14 @@ export const useDataStore = defineStore('data', {
2182
2305
  this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
2183
2306
  if (insuredData && insuredData.length) {
2184
2307
  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();
2308
+ if (each) {
2309
+ this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
2310
+ const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
2311
+ this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
2312
+ }
2188
2313
  });
2189
2314
  }
2190
-
2315
+ if (slaveInsuredData) this.setMembersFieldSlave();
2191
2316
  if (beneficiaryData && beneficiaryData.length) {
2192
2317
  beneficiaryData.forEach((each, index) => {
2193
2318
  this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
@@ -2457,14 +2582,43 @@ export const useDataStore = defineStore('data', {
2457
2582
  const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
2458
2583
  this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
2459
2584
  }
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();
2585
+ if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.pensionApp) {
2586
+ this.formStore[whichForm].bankInfo.iik = this.formStore.pensionApp.account;
2587
+ this.formStore[whichForm].bankInfo.bik = this.formStore.pensionApp.bankBik;
2588
+ this.formStore[whichForm].bankInfo.bankName.id = this.formStore.pensionApp.bankId;
2589
+ this.formStore[whichForm].bankInfo.bankName.nameRu = this.formStore.pensionApp.bankName;
2590
+ this.formStore[whichForm].bankInfo.bin = reformatIin(this.formStore.pensionApp.bankBin);
2591
+ const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.transferContractCompany);
2592
+ this.formStore.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
2593
+ }
2594
+ },
2595
+ setMembersFieldSlave() {
2596
+ this.formStore.slaveInsuredForm.familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData.slave['insuredApp'].familyStatusId);
2597
+ this.formStore.slaveInsuredForm.signOfIPDL = this.findObject(
2598
+ 'ipdl',
2599
+ 'nameRu',
2600
+ this.formStore.applicationData.slave.insuredApp[0].isIpdl === null ? null : this.formStore.applicationData.slave.insuredApp[0].isIpdl == true ? 'Да' : 'Нет',
2601
+ );
2602
+ this.formStore.slaveInsuredForm.gotFromInsis = false;
2603
+ if (!!this.formStore.applicationData.slave.insuredApp[0].profession) this.formStore.slaveInsuredForm.job = this.formStore.applicationData.slave.insuredApp[0].profession;
2604
+ if (!!this.formStore.applicationData.slave.insuredApp[0].position) this.formStore.slaveInsuredForm.jobPosition = this.formStore.applicationData.slave.insuredApp[0].position;
2605
+ if (!!this.formStore.applicationData.slave.insuredApp[0].jobName) this.formStore.slaveInsuredForm.jobPlace = this.formStore.applicationData.slave.insuredApp[0].jobName;
2606
+ if (!!this.formStore.applicationData.slave.insuredApp[0].positionCode)
2607
+ this.formStore.slaveInsuredForm.positionCode = this.formStore.applicationData.slave.insuredApp[0].positionCode;
2608
+ if (typeof this.formStore.applicationData.slave.insuredApp[0].isDisability === 'boolean')
2609
+ this.formStore.slaveInsuredForm.isDisability = this.formStore.applicationData.slave.insuredApp[0].isDisability;
2610
+ if (!!this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId) {
2611
+ const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId);
2612
+ this.formStore.slaveInsuredForm.disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
2613
+ }
2614
+ if (this.formStore.slaveInsuredForm.bankInfo) {
2615
+ this.formStore.slaveInsuredForm.bankInfo.iik = this.formStore.pensionApp.slave.account;
2616
+ this.formStore.slaveInsuredForm.bankInfo.bik = this.formStore.pensionApp.slave.bankBik;
2617
+ this.formStore.slaveInsuredForm.bankInfo.bankName.id = this.formStore.pensionApp.slave.bankId;
2618
+ this.formStore.slaveInsuredForm.bankInfo.bankName.nameRu = this.formStore.pensionApp.slave.bankName;
2619
+ this.formStore.slaveInsuredForm.bankInfo.bin = reformatIin(this.formStore.pensionApp.slave.bankBin);
2620
+ const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.slave.transferContractCompany);
2621
+ this.formStore.pensionApp.slave.transferContractCompany = transferCompany ? transferCompany : new Value();
2468
2622
  }
2469
2623
  },
2470
2624
  setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
@@ -2567,7 +2721,7 @@ export const useDataStore = defineStore('data', {
2567
2721
  const signData = await this.api.file.signXml(data);
2568
2722
  return signData;
2569
2723
  } else {
2570
- if (this.processCode === 19 || this.processCode === 2 || this.processCode === 4) {
2724
+ if (this.processCode === 19 || this.processCode === 24 || this.processCode === 25) {
2571
2725
  const result = await this.api.file.signBts(data);
2572
2726
  if (result.code === 0) this.formStore.signUrls = result.data;
2573
2727
  } else {
@@ -2601,9 +2755,8 @@ export const useDataStore = defineStore('data', {
2601
2755
  await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
2602
2756
  }
2603
2757
  return true;
2604
- } catch (err) {
2605
- ErrorHandler(err);
2606
- return false;
2758
+ } catch (err: any) {
2759
+ return err.name === 'NCALayerError' ? null : ErrorHandler(err);
2607
2760
  }
2608
2761
  },
2609
2762
  async getFileNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
@@ -2648,6 +2801,7 @@ export const useDataStore = defineStore('data', {
2648
2801
  }
2649
2802
  } catch (err) {
2650
2803
  ErrorHandler(err);
2804
+ this.formStore.signatories = [];
2651
2805
  }
2652
2806
  },
2653
2807
  async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
@@ -2877,6 +3031,15 @@ export const useDataStore = defineStore('data', {
2877
3031
  }
2878
3032
  }
2879
3033
  }
3034
+ } else if (applicationKey === 'slave') {
3035
+ if (this.formStore.slaveInsuredForm && this.formStore.applicationData.slave) {
3036
+ const localSlave = this.formStore.slaveInsuredForm;
3037
+ const applicationSlave = this.formStore.applicationData.slave.insuredApp[0];
3038
+ if ((localSlave.id === applicationSlave.insisId && applicationSlave.iin === localSlave.iin?.replace(/-/g, '')) === false) {
3039
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3040
+ return false;
3041
+ }
3042
+ }
2880
3043
  } else {
2881
3044
  if (this.formStore[localKey].some(i => i.iin !== null)) {
2882
3045
  this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
@@ -2922,6 +3085,9 @@ export const useDataStore = defineStore('data', {
2922
3085
  }
2923
3086
  }
2924
3087
  }
3088
+ if (this.formStore.applicationData.slave && this.validateMultipleMembers(this.formStore.insuredFormKey, 'slave', 'застрахованных') === false) {
3089
+ return false;
3090
+ }
2925
3091
  if (this.members.beneficiaryApp.has) {
2926
3092
  if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
2927
3093
  return false;
@@ -3038,7 +3204,12 @@ export const useDataStore = defineStore('data', {
3038
3204
  this.isLoading = true;
3039
3205
  const areMembersValid = await this.validateAllMembers(taskId);
3040
3206
  if (areMembersValid) {
3041
- if ((!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) || this.isPension) {
3207
+ if (
3208
+ (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) ||
3209
+ (this.isPension &&
3210
+ this.formStore.applicationData.pensionApp.isCalculated === true &&
3211
+ (this.formStore.applicationData.pensionApp.slave ? this.formStore.applicationData.pensionApp.slave.isCalculated === true : true))
3212
+ ) {
3042
3213
  if (this.controls.hasAnketa) {
3043
3214
  const hasCritical =
3044
3215
  this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
@@ -3296,69 +3467,72 @@ export const useDataStore = defineStore('data', {
3296
3467
  const gender = this.gender.find((i: Value) => i.id == person.gender.code);
3297
3468
  if (gender) member.gender = gender;
3298
3469
 
3299
- const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
3470
+ const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu ?? 'undefined', 'i')));
3300
3471
  if (birthPlace) member.birthPlace = birthPlace;
3301
3472
 
3302
- const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu, 'i')));
3473
+ const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu ?? 'undefined', 'i')));
3303
3474
  if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
3304
3475
 
3305
- const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu, 'i')));
3476
+ const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu ?? 'undefined', 'i')));
3306
3477
  if (regCountry) member.registrationCountry = regCountry;
3307
3478
 
3308
- const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu, 'i')));
3479
+ const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')));
3309
3480
  if (regProvince) member.registrationProvince = regProvince;
3481
+ else member.registrationProvince = new Value();
3310
3482
 
3311
- if ('city' in person.regAddress && !!person.regAddress.city) {
3312
- if (person.regAddress.city.includes(', ')) {
3313
- const personCities = person.regAddress.city.split(', ');
3483
+ let hasSetCity = false;
3484
+ let hasSetRegion = false;
3485
+ if (person.regAddress.city && String(person.regAddress.city).includes(', ')) {
3486
+ const personCities = String(person.regAddress.city).split(', ');
3487
+ for (let ind = 0; ind < personCities.length; ++ind) {
3488
+ const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
3489
+ if (possibleCity) {
3490
+ member.registrationCity = possibleCity;
3491
+ hasSetCity = true;
3492
+ break;
3493
+ }
3494
+ }
3495
+ if (member.registrationCity.nameRu === null) {
3314
3496
  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;
3497
+ const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
3498
+ if (possibleRegion) {
3499
+ member.registrationRegion = possibleRegion;
3500
+ hasSetRegion = true;
3318
3501
  break;
3319
3502
  }
3320
3503
  }
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
3504
  }
3339
3505
  }
3340
3506
 
3341
- if (member.registrationCity.nameRu === null && member.registrationRegion.nameRu === null) {
3507
+ if (hasSetCity === false) {
3342
3508
  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')),
3509
+ i =>
3510
+ String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
3511
+ String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
3512
+ String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
3344
3513
  );
3345
3514
  if (regCity) {
3346
3515
  member.registrationCity = regCity;
3347
3516
  const regType = this.localityTypes.find(i => String(i.nameRu) === 'город');
3348
3517
  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
- }
3518
+ } else member.registrationCity = new Value();
3519
+ }
3520
+
3521
+ if (hasSetRegion === false) {
3522
+ const regRegion = this.regions.find(
3523
+ i =>
3524
+ String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
3525
+ String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
3526
+ String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
3527
+ );
3528
+ if (regRegion) {
3529
+ member.registrationRegion = regRegion;
3530
+ const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
3531
+ if (regType) member.registrationRegionType = regType;
3532
+ } else member.registrationRegion = new Value();
3359
3533
  }
3360
3534
 
3361
- if (person.regAddress.street.includes(', ')) {
3535
+ if (person.regAddress.street && person.regAddress.street.includes(', ')) {
3362
3536
  const personAddress = person.regAddress.street.split(', ');
3363
3537
  const microDistrict = personAddress.find((i: string) => i.match(new RegExp('микрорайон', 'i')));
3364
3538
  const quarter = personAddress.find((i: string) => i.match(new RegExp('квартал', 'i')));
@@ -3785,6 +3959,19 @@ export const useDataStore = defineStore('data', {
3785
3959
  return false;
3786
3960
  }
3787
3961
 
3962
+ if (this.controls.hasAttachment) {
3963
+ const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
3964
+ if (areValid) {
3965
+ if (this.isInitiator()) {
3966
+ await this.setINSISWorkData();
3967
+ }
3968
+ } else {
3969
+ this.isLoading = false;
3970
+ this.showToaster('error', this.t('toaster.attachManagerError'), 3000);
3971
+ return false;
3972
+ }
3973
+ }
3974
+
3788
3975
  return true;
3789
3976
  },
3790
3977
  async getOnlineAccess(iin: string, documentType: string) {
@@ -3819,6 +4006,18 @@ export const useDataStore = defineStore('data', {
3819
4006
  return null;
3820
4007
  }
3821
4008
  },
4009
+ async updateDigitalDocumentsProfile(iin: string) {
4010
+ try {
4011
+ const data = {
4012
+ iinBin: iin.replaceAll('-', ''),
4013
+ };
4014
+ await this.api.externalServices.updateDigitalDocumentsProfile(data);
4015
+ this.showToaster('success', this.t('toaster.successProfile'), 3000);
4016
+ } catch (err) {
4017
+ ErrorHandler(err);
4018
+ return null;
4019
+ }
4020
+ },
3822
4021
  async getVariableData(processCode: number) {
3823
4022
  try {
3824
4023
  const response = await this.api.getVariableData(0, processCode);
@@ -3914,7 +4113,7 @@ export const useDataStore = defineStore('data', {
3914
4113
  }
3915
4114
  },
3916
4115
  hasBankSection(whichForm: keyof typeof StoreMembers) {
3917
- if (!this.isPension) return false;
4116
+ if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
3918
4117
  switch (whichForm) {
3919
4118
  case 'beneficiaryForm':
3920
4119
  return false;
@@ -3923,7 +4122,7 @@ export const useDataStore = defineStore('data', {
3923
4122
  }
3924
4123
  },
3925
4124
  hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
3926
- if (!this.isPension) return false;
4125
+ if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
3927
4126
  switch (whichForm) {
3928
4127
  case 'beneficiaryForm':
3929
4128
  return false;