hl-core 0.0.9-beta.1 → 0.0.9-beta.11

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 (57) hide show
  1. package/api/index.ts +147 -147
  2. package/api/interceptors.ts +16 -14
  3. package/components/Button/Btn.vue +3 -3
  4. package/components/Complex/ContentBlock.vue +1 -1
  5. package/components/Complex/MessageBlock.vue +26 -0
  6. package/components/Complex/Page.vue +7 -1
  7. package/components/Complex/WhiteBlock.vue +7 -0
  8. package/components/Dialog/Dialog.vue +2 -2
  9. package/components/Dialog/FamilyDialog.vue +5 -5
  10. package/components/Form/FormBlock.vue +25 -27
  11. package/components/Form/FormSection.vue +2 -2
  12. package/components/Form/FormTextSection.vue +3 -3
  13. package/components/Form/FormToggle.vue +3 -3
  14. package/components/Form/ManagerAttachment.vue +55 -42
  15. package/components/Form/ProductConditionsBlock.vue +16 -16
  16. package/components/Input/EmptyFormField.vue +1 -1
  17. package/components/Input/FileInput.vue +0 -1
  18. package/components/Input/Monthpicker.vue +33 -0
  19. package/components/Input/RoundedEmptyField.vue +5 -0
  20. package/components/Input/RoundedSelect.vue +13 -0
  21. package/components/Layout/Drawer.vue +2 -1
  22. package/components/Layout/Header.vue +1 -1
  23. package/components/Layout/SettingsPanel.vue +5 -9
  24. package/components/List/ListEmpty.vue +1 -1
  25. package/components/Menu/MenuHover.vue +1 -1
  26. package/components/Menu/MenuNav.vue +1 -1
  27. package/components/Menu/MenuNavItem.vue +4 -4
  28. package/components/Pages/Anketa.vue +86 -45
  29. package/components/Pages/Auth.vue +9 -9
  30. package/components/Pages/ContragentForm.vue +505 -0
  31. package/components/Pages/Documents.vue +5 -5
  32. package/components/Pages/InvoiceInfo.vue +1 -1
  33. package/components/Pages/MemberForm.vue +35 -28
  34. package/components/Pages/ProductAgreement.vue +1 -3
  35. package/components/Pages/ProductConditions.vue +58 -21
  36. package/components/Panel/PanelHandler.vue +32 -15
  37. package/components/Panel/PanelSelectItem.vue +3 -3
  38. package/components/Utilities/IconBorder.vue +17 -0
  39. package/composables/axios.ts +1 -1
  40. package/composables/classes.ts +23 -11
  41. package/composables/constants.ts +5 -0
  42. package/composables/index.ts +30 -4
  43. package/composables/styles.ts +19 -9
  44. package/configs/i18n.ts +0 -2
  45. package/layouts/default.vue +5 -2
  46. package/layouts/full.vue +1 -1
  47. package/locales/ru.json +106 -2
  48. package/nuxt.config.ts +1 -1
  49. package/package.json +12 -21
  50. package/pages/500.vue +2 -2
  51. package/pages/Token.vue +1 -0
  52. package/plugins/helperFunctionsPlugins.ts +6 -7
  53. package/store/data.store.ts +111 -100
  54. package/store/rules.ts +12 -2
  55. package/types/index.ts +45 -27
  56. package/components/Button/BtnIcon.vue +0 -47
  57. package/locales/kz.json +0 -585
@@ -39,12 +39,14 @@ export const useDataStore = defineStore('data', {
39
39
  isBaiterek: state => state.product === 'baiterek',
40
40
  isBolashak: state => state.product === 'bolashak',
41
41
  isMycar: state => state.product === 'mycar',
42
+ isLifeBusiness: state => state.product === 'lifebusiness',
42
43
  isLifetrip: state => state.product === 'lifetrip',
43
44
  isLiferenta: state => state.product === 'liferenta',
44
45
  isGons: state => state.product === 'gons',
45
46
  isKazyna: state => state.product === 'halykkazyna',
46
47
  isCalculator: state => state.product === 'calculator',
47
- isComplianceWindow: state => state.product === 'compliance',
48
+ isCheckContract: state => state.product === 'checkcontract',
49
+ isCheckContragent: state => state.product === 'checkcontragent',
48
50
  isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
49
51
  hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
50
52
  isClientAnketaCondition: state =>
@@ -71,7 +73,7 @@ export const useDataStore = defineStore('data', {
71
73
  childFrame.contentWindow.postMessage({ action: action, value: value }, '*');
72
74
  }
73
75
  },
74
- copyToClipboard(text: any) {
76
+ copyToClipboard(text: unknown) {
75
77
  if (typeof text === 'string' || typeof text === 'number') {
76
78
  if (this.isBridge) {
77
79
  navigator.clipboard.writeText(String(text));
@@ -478,12 +480,15 @@ export const useDataStore = defineStore('data', {
478
480
  }
479
481
  if ('address' in user && user.address && user.address.length) {
480
482
  const userAddress = user.address[0];
481
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(userAddress.countryName, 'i')));
483
+ const countryName = userAddress.countryName;
484
+ if (countryName) {
485
+ const country = this.countries.find(i => i.nameRu?.match(new RegExp(countryName, 'i')));
486
+ member.registrationCountry = country ? country : new Value();
487
+ }
482
488
  const province = this.states.find(i => i.ids === userAddress.stateCode);
483
489
  const localityType = this.localityTypes.find(i => i.nameRu === userAddress.cityTypeName);
484
490
  const city = this.cities.find(i => !!userAddress.cityName && i.nameRu === userAddress.cityName.replace('г.', ''));
485
491
  const region = this.regions.find(i => !!userAddress.regionCode && i.ids == userAddress.regionCode);
486
- member.registrationCountry = country ? country : new Value();
487
492
  member.registrationStreet = userAddress.streetName;
488
493
  member.registrationCity = city ? city : new Value();
489
494
  member.registrationNumberApartment = userAddress.apartmentNumber;
@@ -582,7 +587,7 @@ export const useDataStore = defineStore('data', {
582
587
  this.contragentList = [];
583
588
  }
584
589
  },
585
- async saveContragent(user: Member, whichForm: keyof typeof StoreMembers, whichIndex: number | null, onlySaveAction: boolean = true) {
590
+ async saveContragent(user: Member, whichForm: keyof typeof StoreMembers | 'contragent', whichIndex: number | null, onlySaveAction: boolean = true) {
586
591
  this.isLoading = !onlySaveAction;
587
592
  const hasInsisId = await this.alreadyInInsis(user);
588
593
  if (typeof hasInsisId === 'number') {
@@ -636,7 +641,7 @@ export const useDataStore = defineStore('data', {
636
641
  }))(user);
637
642
  const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
638
643
  let questName = '';
639
- let questionId = parseInt(String(question.ids)).toString();
644
+ let questionId = parseInt(question.ids as string).toString();
640
645
  if (questionId === '500003') {
641
646
  questName = 'Код сектора экономики';
642
647
  } else if (questionId === '500011') {
@@ -659,11 +664,11 @@ export const useDataStore = defineStore('data', {
659
664
  user.addTaxResidency = new Value();
660
665
  }
661
666
  const addTaxResidency = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '507777') : undefined;
662
- if (user.addTaxResidency.nameRu !== null) {
667
+ if (user.addTaxResidency.nameRu !== null && user.addTaxResidency.ids) {
663
668
  questionariesData.push({
664
669
  id: addTaxResidency ? addTaxResidency.id : 0,
665
670
  contragentId: Number(user.id),
666
- questAnswer: String(user.addTaxResidency.ids ?? ''),
671
+ questAnswer: user.addTaxResidency.ids,
667
672
  questAnswerName: user.addTaxResidency.nameRu,
668
673
  questName: 'Указать если налоговое резиденство выбрано другое',
669
674
  questId: '507777',
@@ -735,7 +740,7 @@ export const useDataStore = defineStore('data', {
735
740
  issuerNameRu: user.documentIssuers.nameRu,
736
741
  note: null,
737
742
  number: user.documentNumber,
738
- type: user.documentType.ids ? String(user.documentType.ids) : '',
743
+ type: user.documentType.ids ? (user.documentType.ids as string) : undefined,
739
744
  typeName: user.documentType.nameRu,
740
745
  serial: null,
741
746
  verifyType: user.verifyType,
@@ -753,13 +758,13 @@ export const useDataStore = defineStore('data', {
753
758
  addressData.push({
754
759
  id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
755
760
  contragentId: Number(user.id),
756
- countryCode: String(user.registrationCountry.ids ?? ''),
761
+ countryCode: user.registrationCountry.ids ?? undefined,
757
762
  countryName: user.registrationCountry.nameRu ?? '',
758
- stateCode: String(user.registrationProvince.ids ?? ''),
763
+ stateCode: user.registrationProvince.ids ?? undefined,
759
764
  stateName: user.registrationProvince.nameRu ?? '',
760
- cityCode: String(user.registrationCity.code ?? ''),
765
+ cityCode: user.registrationCity.code ?? undefined,
761
766
  cityName: user.registrationCity.nameRu ?? '',
762
- regionCode: String(user.registrationRegion.ids ?? ''),
767
+ regionCode: user.registrationRegion.ids ?? undefined,
763
768
  regionName: user.registrationRegion.nameRu,
764
769
  streetName: user.registrationStreet ?? '',
765
770
  kvartal: user.registrationQuarter,
@@ -784,8 +789,12 @@ export const useDataStore = defineStore('data', {
784
789
 
785
790
  const personId = await this.api.saveContragent(data);
786
791
  if (personId > 0) {
787
- await this.getContragentById(personId, whichForm, false, whichIndex);
788
- user.otpTokenId = null;
792
+ if (this.isLKA || whichForm === 'contragent') {
793
+ return personId;
794
+ } else {
795
+ await this.getContragentById(personId, whichForm, false, whichIndex);
796
+ user.otpTokenId = null;
797
+ }
789
798
  } else {
790
799
  return false;
791
800
  }
@@ -942,9 +951,9 @@ export const useDataStore = defineStore('data', {
942
951
  payPeriod: this.formStore.productConditionsForm.coverPeriod,
943
952
  annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
944
953
  indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
945
- ? String(this.formStore.productConditionsForm.processIndexRate.id)
946
- : String(this.processIndexRate.find(i => i.code === '0')?.id ?? ''),
947
- paymentPeriodId: String(this.formStore.productConditionsForm.paymentPeriod.id ?? ''),
954
+ ? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
955
+ : this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
956
+ paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id ?? undefined,
948
957
  lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply ?? ''),
949
958
  lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive ?? ''),
950
959
  adbMultiply: formatProcents(this.formStore.productConditionsForm.adbMultiply ?? ''),
@@ -962,9 +971,9 @@ export const useDataStore = defineStore('data', {
962
971
  }
963
972
  if (this.isLiferenta) {
964
973
  conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
965
- conditionsData.policyAppDto.annuityTypeId = String(this.formStore.productConditionsForm.typeAnnuityInsurance.id ?? '');
974
+ conditionsData.policyAppDto.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
966
975
  conditionsData.policyAppDto.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
967
- conditionsData.policyAppDto.annuityPaymentPeriodId = String(this.formStore.productConditionsForm.periodAnnuityPayment.id ?? '');
976
+ conditionsData.policyAppDto.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
968
977
  }
969
978
  return conditionsData;
970
979
  },
@@ -1052,11 +1061,11 @@ export const useDataStore = defineStore('data', {
1052
1061
  salesChannel: this.formStore.applicationData.insisWorkDataApp.salesChannel,
1053
1062
  salesChannelName: this.formStore.applicationData.insisWorkDataApp.salesChannelName,
1054
1063
  insrType: this.formStore.applicationData.insisWorkDataApp.insrType,
1055
- saleChanellPolicy: String(this.formStore.SaleChanellPolicy.ids ?? ''),
1064
+ saleChanellPolicy: (this.formStore.SaleChanellPolicy.ids as string) ?? undefined,
1056
1065
  saleChanellPolicyName: this.formStore.SaleChanellPolicy.nameRu ?? '',
1057
- regionPolicy: String(this.formStore.RegionPolicy.ids ?? ''),
1066
+ regionPolicy: (this.formStore.RegionPolicy.ids as string) ?? undefined,
1058
1067
  regionPolicyName: this.formStore.RegionPolicy.nameRu ?? '',
1059
- managerPolicy: String(this.formStore.ManagerPolicy.ids),
1068
+ managerPolicy: this.formStore.ManagerPolicy.ids as string,
1060
1069
  managerPolicyName: this.formStore.ManagerPolicy.nameRu ?? '',
1061
1070
  insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
1062
1071
  };
@@ -1090,7 +1099,7 @@ export const useDataStore = defineStore('data', {
1090
1099
  async getFromApi(whichField: string, whichRequest: string, parameter?: any, reset: boolean = false): Promise<Value[]> {
1091
1100
  const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
1092
1101
  const currentHour = new Date().getHours();
1093
- const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / 15);
1102
+ const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / (this.isLKA ? 60 : 15));
1094
1103
 
1095
1104
  const getDataCondition = () => {
1096
1105
  if (!storageValue) return true;
@@ -1206,13 +1215,14 @@ export const useDataStore = defineStore('data', {
1206
1215
  return await this.getFromApi('relations', 'getRelationTypes');
1207
1216
  },
1208
1217
  async getProcessIndexRate() {
1209
- return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
1210
- },
1211
- async getProcessCoverTypeSum(type?: any) {
1212
- return await this.getFromApi('processCoverTypeSum', 'getProcessCoverTypeSum', type);
1218
+ if (this.processCode) {
1219
+ return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
1220
+ }
1213
1221
  },
1214
1222
  async getProcessPaymentPeriod() {
1215
- return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
1223
+ if (this.processCode) {
1224
+ return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
1225
+ }
1216
1226
  },
1217
1227
  async getQuestionRefs(id?: string) {
1218
1228
  return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
@@ -1224,7 +1234,9 @@ export const useDataStore = defineStore('data', {
1224
1234
  return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
1225
1235
  },
1226
1236
  async getProcessAnnuityPaymentPeriod() {
1227
- return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
1237
+ if (this.processCode) {
1238
+ return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
1239
+ }
1228
1240
  },
1229
1241
  async getInsurancePay() {
1230
1242
  return await this.getFromApi('insurancePay', 'getInsurancePay');
@@ -1273,51 +1285,47 @@ export const useDataStore = defineStore('data', {
1273
1285
  surveyType: 'health' | 'critical',
1274
1286
  processInstanceId: string | number,
1275
1287
  insuredId: any,
1276
- baseField: string,
1277
- secondaryField: string,
1288
+ baseField: 'surveyByHealthBase' | 'surveyByCriticalBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBasePolicyholder',
1278
1289
  whichMember: 'insured' | 'policyholder' = 'insured',
1279
1290
  ) {
1280
- //@ts-ignore
1281
- if (!this.formStore[baseField] || (this.formStore[baseField] && !this.formStore[baseField].length)) {
1291
+ if (!this.formStore[baseField]) {
1282
1292
  try {
1283
- if (whichMember === 'insured') {
1284
- const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1285
- this.api.getQuestionList(surveyType, processInstanceId, insuredId),
1286
- this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1287
- ]);
1288
- if (baseQuestions.status === 'fulfilled') {
1289
- //@ts-ignore
1290
- this.formStore[baseField] = baseQuestions.value;
1291
- }
1292
- if (secondaryQuestions.status === 'fulfilled') {
1293
- //@ts-ignore
1294
- this.formStore[secondaryField] = secondaryQuestions;
1295
- }
1296
- }
1297
- if (whichMember === 'policyholder') {
1298
- const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1299
- this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
1300
- this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1301
- ]);
1302
- if (baseQuestions.status === 'fulfilled') {
1303
- //@ts-ignore
1304
- this.formStore[baseField] = baseQuestions.value;
1305
- }
1306
- if (secondaryQuestions.status === 'fulfilled') {
1307
- //@ts-ignore
1308
- this.formStore[secondaryField] = secondaryQuestions;
1293
+ const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1294
+ whichMember === 'insured'
1295
+ ? this.api.getQuestionList(surveyType, processInstanceId, insuredId)
1296
+ : this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
1297
+ whichMember === 'insured'
1298
+ ? this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId)
1299
+ : this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1300
+ ,
1301
+ ]);
1302
+ if (baseQuestions.status === 'fulfilled') {
1303
+ this.formStore[baseField] = baseQuestions.value;
1304
+ }
1305
+ if (secondaryQuestions.status === 'fulfilled') {
1306
+ const baseAnketa = this.formStore[baseField];
1307
+ if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
1308
+ baseAnketa.body.forEach(i => {
1309
+ if (i.first.definedAnswers === 'Y' && i.second === null && secondaryQuestions.value) {
1310
+ i.second = structuredClone(secondaryQuestions.value);
1311
+ }
1312
+ });
1309
1313
  }
1310
1314
  }
1311
1315
  } catch (err) {
1312
- console.log(err);
1316
+ ErrorHandler(err);
1313
1317
  }
1314
1318
  }
1315
- //@ts-ignore
1316
1319
  return this.formStore[baseField];
1317
1320
  },
1318
1321
  getNumberWithSpaces(n: any) {
1319
1322
  return n === null ? null : Number((typeof n === 'string' ? n : n.toFixed().toString()).replace(/[^0-9]+/g, '')).toLocaleString('ru');
1320
1323
  },
1324
+ getNumberWithSpacesAfterComma(n: number) {
1325
+ let parts = n.toFixed(2).split('.');
1326
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
1327
+ return parts.join(',');
1328
+ },
1321
1329
  getNumberWithDot(n: any) {
1322
1330
  return n === null ? null : n.toLocaleString('ru', { maximumFractionDigits: 2, minimumFractionDigits: 2 }).replace(/,/g, '.');
1323
1331
  },
@@ -1514,9 +1522,9 @@ export const useDataStore = defineStore('data', {
1514
1522
  coverPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
1515
1523
  payPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
1516
1524
  indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
1517
- ? String(this.formStore.productConditionsForm.processIndexRate.id)
1518
- : String(this.processIndexRate.find(i => i.code === '0')?.id),
1519
- paymentPeriodId: String(this.formStore.productConditionsForm.paymentPeriod.id),
1525
+ ? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
1526
+ : this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
1527
+ paymentPeriodId: (this.formStore.productConditionsForm.paymentPeriod.id as string) ?? undefined,
1520
1528
  addCovers: this.formStore.additionalInsuranceTermsWithout,
1521
1529
  };
1522
1530
  if (this.isKazyna || product === 'halykkazyna') {
@@ -1524,11 +1532,11 @@ export const useDataStore = defineStore('data', {
1524
1532
  calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
1525
1533
  calculationData.currencyExchangeRate = this.currencies.usd;
1526
1534
  }
1527
- if (this.isLiferenta) {
1535
+ if (this.isLiferenta || product === 'liferenta') {
1528
1536
  calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
1529
- calculationData.annuityTypeId = String(this.formStore.productConditionsForm.typeAnnuityInsurance.id);
1537
+ calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
1530
1538
  calculationData.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
1531
- calculationData.annuityPaymentPeriodId = String(this.formStore.productConditionsForm.periodAnnuityPayment.id);
1539
+ calculationData.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
1532
1540
  }
1533
1541
  const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
1534
1542
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
@@ -1541,9 +1549,15 @@ export const useDataStore = defineStore('data', {
1541
1549
  this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
1542
1550
  }
1543
1551
  }
1544
- if (this.isLiferenta) {
1552
+ if (this.isLiferenta || product === 'liferenta') {
1545
1553
  this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(calculationResponse.annuityMonthPay);
1546
1554
  }
1555
+ if (this.isGons || product === 'gons') {
1556
+ this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(calculationResponse.totalAmount5);
1557
+ this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(calculationResponse.totalAmount7);
1558
+ this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(calculationResponse.statePremium5);
1559
+ this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
1560
+ }
1547
1561
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1548
1562
  } catch (err) {
1549
1563
  ErrorHandler(err);
@@ -1579,6 +1593,7 @@ export const useDataStore = defineStore('data', {
1579
1593
  if (this.isLiferenta) {
1580
1594
  this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
1581
1595
  }
1596
+
1582
1597
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1583
1598
  } catch (err) {
1584
1599
  ErrorHandler(err);
@@ -1859,7 +1874,7 @@ export const useDataStore = defineStore('data', {
1859
1874
  },
1860
1875
  async handleTask(action: keyof typeof constants.actions | null, taskId: string, comment: string | null = null) {
1861
1876
  if (!this.formStore.applicationTaskId) return;
1862
- if (action && Object.keys(constants.actions).includes(action)) {
1877
+ if (action) {
1863
1878
  this.isButtonsLoading = true;
1864
1879
  switch (action) {
1865
1880
  case constants.actions.claim: {
@@ -2070,6 +2085,9 @@ export const useDataStore = defineStore('data', {
2070
2085
  const recalculatedValue = await this.api.reCalculate(data);
2071
2086
  if (!!recalculatedValue) {
2072
2087
  await this.getApplicationData(taskId, false, false, false, true);
2088
+ if (this.isGons) {
2089
+ this.formStore.productConditionsForm.isRecalculated = true;
2090
+ }
2073
2091
  this.showToaster(
2074
2092
  'success',
2075
2093
  `${this.t('toaster.successRecalculation')}. ${whichSum == 'insurancePremiumPerMonth' ? 'Страховая премия' : 'Страховая сумма'}: ${this.getNumberWithSpaces(
@@ -2111,7 +2129,7 @@ export const useDataStore = defineStore('data', {
2111
2129
  }
2112
2130
  }
2113
2131
  } else {
2114
- if (this.formStore[localKey].some((i: any) => i.iin !== null)) {
2132
+ if (this.formStore[localKey].some(i => i.iin !== null)) {
2115
2133
  this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
2116
2134
  return false;
2117
2135
  }
@@ -2230,13 +2248,26 @@ export const useDataStore = defineStore('data', {
2230
2248
  if (!anketa) return false;
2231
2249
  const list = anketa.body;
2232
2250
  if (!list || (list && list.length === 0)) return false;
2233
- let notAnswered = 0;
2234
- for (let x = 0; x < list.length; x++) {
2235
- if ((list[x].first.definedAnswers === 'N' && !list[x].first.answerText) || (list[x].first.definedAnswers === 'Y' && !list[x].first.answerName)) {
2236
- notAnswered = notAnswered + 1;
2251
+ const isAnketaValid = ref<boolean>(true);
2252
+ list.forEach(i => {
2253
+ if ((i.first.definedAnswers === 'N' && !i.first.answerText) || (i.first.definedAnswers === 'Y' && !i.first.answerName)) {
2254
+ isAnketaValid.value = false;
2255
+ return false;
2237
2256
  }
2238
- }
2239
- return notAnswered === 0;
2257
+ if (this.controls.isSecondAnketaRequired && i.first.definedAnswers === 'Y' && i.first.answerName?.match(new RegExp('Да', 'i'))) {
2258
+ if (i.second && i.second.length) {
2259
+ const isValid = i.second.every(second => (second.definedAnswers === 'N' ? !!second.answerText : !!second.answerName));
2260
+ if (!isValid) {
2261
+ isAnketaValid.value = false;
2262
+ this.showToaster('info', this.t('toaster.emptySecondAnketa', { text: i.first.name }), 5000);
2263
+ return false;
2264
+ }
2265
+ } else {
2266
+ // TODO уточнить
2267
+ }
2268
+ }
2269
+ });
2270
+ return isAnketaValid.value;
2240
2271
  },
2241
2272
  async validateAllForms(taskId: string) {
2242
2273
  this.isLoading = true;
@@ -2246,27 +2277,14 @@ export const useDataStore = defineStore('data', {
2246
2277
  const hasCritical = this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName === 'Критическое заболевание Застрахованного');
2247
2278
  if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i'))) {
2248
2279
  await Promise.allSettled([
2249
- this.getQuestionList(
2250
- 'health',
2251
- this.formStore.applicationData.processInstanceId,
2252
- this.formStore.applicationData.insuredApp[0].id,
2253
- 'surveyByHealthBase',
2254
- 'surveyByHealthSecond',
2255
- ),
2256
- this.getQuestionList(
2257
- 'critical',
2258
- this.formStore.applicationData.processInstanceId,
2259
- this.formStore.applicationData.insuredApp[0].id,
2260
- 'surveyByCriticalBase',
2261
- 'surveyByCriticalSecond',
2262
- ),
2280
+ this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
2281
+ this.getQuestionList('critical', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByCriticalBase'),
2263
2282
  this.isClientAnketaCondition &&
2264
2283
  this.getQuestionList(
2265
2284
  'health',
2266
2285
  this.formStore.applicationData.processInstanceId,
2267
2286
  this.formStore.applicationData.clientApp.id,
2268
2287
  'surveyByHealthBasePolicyholder',
2269
- 'surveyByHealthSecond',
2270
2288
  'policyholder',
2271
2289
  ),
2272
2290
  ]);
@@ -2292,20 +2310,13 @@ export const useDataStore = defineStore('data', {
2292
2310
  ]);
2293
2311
  } else {
2294
2312
  await Promise.allSettled([
2295
- this.getQuestionList(
2296
- 'health',
2297
- this.formStore.applicationData.processInstanceId,
2298
- this.formStore.applicationData.insuredApp[0].id,
2299
- 'surveyByHealthBase',
2300
- 'surveyByHealthSecond',
2301
- ),
2313
+ this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
2302
2314
  this.isClientAnketaCondition &&
2303
2315
  this.getQuestionList(
2304
2316
  'health',
2305
2317
  this.formStore.applicationData.processInstanceId,
2306
2318
  this.formStore.applicationData.clientApp.id,
2307
2319
  'surveyByHealthBasePolicyholder',
2308
- 'surveyByHealthSecond',
2309
2320
  'policyholder',
2310
2321
  ),
2311
2322
  ,
package/store/rules.ts CHANGED
@@ -5,6 +5,7 @@ const t = i18n.t;
5
5
 
6
6
  export const rules = {
7
7
  recalculationMultiply: [(v: any) => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher', { text: '100' })],
8
+ recalculationMultiplyBetween: [(v: any) => (v !== null && v !== '' && v >= 100 && v <= 200) || t('toaster.recalculationMultiplyBetween', { floor: '100', ceil: '200' })],
8
9
  recalculationAdditive: [(v: any) => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween', { floor: '0', ceil: '100' })],
9
10
  required: [(v: any) => !!v || t('rules.required')],
10
11
  objectRequired: [
@@ -96,7 +97,11 @@ export const rules = {
96
97
  date: [
97
98
  (v: any) => {
98
99
  if (v === null || v == '') return true;
99
- if (/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])(-|\.)(0[1-9]|1[0-2])(-|\.)(19[0-9]{2}|20[0-9][0-9])$/.test(v)) {
100
+ if (
101
+ /^(?:(?:(?:(?:0[1-9]|1[0-9]|2[0-8])[\.](?:0[1-9]|1[012]))|(?:(?:29|30|31)[\.](?:0[13578]|1[02]))|(?:(?:29|30)[\.](?:0[4,6,9]|11)))[\.](?:19|[2-3][0-9])\d\d)|(?:29[\.]02[\.](?:19|[2-3][0-9])(?:00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))$/.test(
102
+ v,
103
+ )
104
+ ) {
100
105
  return true;
101
106
  } else {
102
107
  return t('rules.date');
@@ -108,8 +113,13 @@ export const rules = {
108
113
  age18ByDate: [(v: any) => Math.abs(new Date(Date.now() - new Date(formatDate(v)!).getTime()).getUTCFullYear() - 1970) >= 18 || t('rules.age18')],
109
114
  birthDate: [
110
115
  (v: any) => {
116
+ if (v === null || v == '') return true;
111
117
  if (new Date(formatDate(v)!) > new Date(Date.now())) return t('rules.exceedDate');
112
- if (/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])(-|\.)(0[1-9]|1[0-2])(-|\.)(19[0-9]{2}|20[0-9][0-9])$/.test(v)) {
118
+ if (
119
+ /^(?:(?:(?:(?:0[1-9]|1[0-9]|2[0-8])[\.](?:0[1-9]|1[012]))|(?:(?:29|30|31)[\.](?:0[13578]|1[02]))|(?:(?:29|30)[\.](?:0[4,6,9]|11)))[\.](?:19|[2-3][0-9])\d\d)|(?:29[\.]02[\.](?:19|[2-3][0-9])(?:00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))$/.test(
120
+ v,
121
+ )
122
+ ) {
113
123
  return true;
114
124
  } else {
115
125
  return t('rules.date');
package/types/index.ts CHANGED
@@ -4,7 +4,21 @@ export {};
4
4
 
5
5
  declare global {
6
6
  type EnvModes = 'development' | 'test' | 'vercel' | 'production';
7
- type Projects = 'aml' | 'baiterek' | 'bolashak' | 'calculator' | 'compliance' | 'efo' | 'gons' | 'halykkazyna' | 'liferenta' | 'lifetrip' | 'lka' | 'mycar';
7
+ type Projects =
8
+ | 'aml'
9
+ | 'baiterek'
10
+ | 'bolashak'
11
+ | 'calculator'
12
+ | 'efo'
13
+ | 'gons'
14
+ | 'halykkazyna'
15
+ | 'lifebusiness'
16
+ | 'liferenta'
17
+ | 'lifetrip'
18
+ | 'lka'
19
+ | 'mycar'
20
+ | 'checkcontract'
21
+ | 'checkcontragent';
8
22
  type MemberKeys = keyof ReturnType<typeof useFormStore>;
9
23
  type MemberFormTypes = 'policyholderForm' | 'insuredForm' | 'beneficiaryForm' | 'beneficialOwnerForm' | 'policyholdersRepresentativeForm' | 'productConditionsForm';
10
24
  type SingleMember = 'policyholderForm' | 'policyholdersRepresentativeForm';
@@ -36,7 +50,7 @@ declare global {
36
50
  | 'time'
37
51
  | 'url'
38
52
  | 'week';
39
- type TaskListItem = {
53
+ interface TaskListItem {
40
54
  addRegNumber: string | number;
41
55
  applicationTaskId: string;
42
56
  dateCreated: string;
@@ -54,7 +68,7 @@ declare global {
54
68
  status: string;
55
69
  userId: string;
56
70
  userName: string;
57
- };
71
+ }
58
72
  type TaskHistory = {
59
73
  appointmentDate: string | null;
60
74
  comment: string | null;
@@ -127,7 +141,7 @@ declare global {
127
141
 
128
142
  type AnketaBody = {
129
143
  first: EachAnketa;
130
- second: any[] | null;
144
+ second: AnketaSecond[] | null;
131
145
  };
132
146
 
133
147
  type EachAnketa = {
@@ -229,14 +243,18 @@ declare global {
229
243
  premium: number | null;
230
244
  coverPeriod: number;
231
245
  payPeriod: number;
232
- indexRateId?: string | null;
233
- paymentPeriodId: string;
246
+ indexRateId?: string | number | null;
247
+ paymentPeriodId?: string;
234
248
  addCovers: AddCover[];
235
249
  };
236
250
 
237
251
  type RecalculationResponseType = {
238
252
  amount: number;
239
253
  premium: number;
254
+ statePremium5?: number;
255
+ statePremium7?: number;
256
+ totalAmount5?: number;
257
+ totalAmount7?: number;
240
258
  mainCoverPremium: number;
241
259
  addCovers: AddCover[];
242
260
  amountInCurrency: number;
@@ -367,14 +385,14 @@ declare global {
367
385
  contragentId: number;
368
386
  questId: string;
369
387
  questName: string;
370
- questAnswer: string | null;
388
+ questAnswer: string | number | null;
371
389
  questAnswerName: string | null;
372
390
  };
373
391
 
374
392
  type ContragentDocuments = {
375
393
  id: number;
376
394
  contragentId: number;
377
- type: string;
395
+ type?: string;
378
396
  typeName: string | null;
379
397
  serial: string | null;
380
398
  number: string | null;
@@ -392,23 +410,23 @@ declare global {
392
410
  type ContragentAddress = {
393
411
  id: number;
394
412
  contragentId: number;
395
- type: string;
396
- address: string;
397
- countryCode: string;
398
- countryName: string;
399
- stateCode: string;
400
- stateName: string;
401
- cityCode: string;
402
- cityName: string;
403
- regionCode: string | null;
404
- regionName: string | null;
405
- streetName: string;
406
- blockNumber: string;
407
- apartmentNumber: string;
408
- cityTypeId: number | null;
409
- cityTypeName: string;
410
- microRaion: string | null;
411
- kvartal: string | null;
413
+ type?: string;
414
+ address?: string;
415
+ countryCode?: string | number;
416
+ countryName?: string;
417
+ stateCode?: string | number;
418
+ stateName?: string;
419
+ cityCode?: string | number;
420
+ cityName?: string;
421
+ regionCode?: string | number | null;
422
+ regionName?: string | null;
423
+ streetName?: string;
424
+ blockNumber?: string;
425
+ apartmentNumber?: string;
426
+ cityTypeId?: number | null;
427
+ cityTypeName?: string;
428
+ microRaion?: string | null;
429
+ kvartal?: string | null;
412
430
  };
413
431
 
414
432
  type ContragentContacts = {
@@ -447,10 +465,10 @@ declare global {
447
465
  isSpokesman?: boolean;
448
466
  coverPeriod?: number | null;
449
467
  payPeriod?: number | null;
450
- indexRateId?: string;
468
+ indexRateId?: string | number;
451
469
  indexRateCode?: string;
452
470
  indexRateName?: string;
453
- paymentPeriodId?: string;
471
+ paymentPeriodId?: string | number;
454
472
  paymentPeriodName?: string;
455
473
  lifeMultiply?: number;
456
474
  lifeAdditive?: number;
@@ -1,47 +0,0 @@
1
- <template>
2
- <button
3
- type="button"
4
- class="transition-all"
5
- @click="$emit('clicked')"
6
- :disabled="disabled"
7
- :class="[
8
- disabled ? 'disabled' : '',
9
- classes,
10
- btn,
11
- $libStyles[`btnH${$capitalize(size)}` as keyof typeof $libStyles],
12
- ]"
13
- >
14
- <i class="mdi" :class="icon"></i>
15
- </button>
16
- </template>
17
-
18
- <script lang="ts">
19
- export default defineComponent({
20
- name: 'BaseBtnIcon',
21
- props: {
22
- icon: { type: String, default: 'mdi-arrow-right-variant' },
23
- size: {
24
- type: String,
25
- default: 'md',
26
- },
27
- classes: {
28
- type: String,
29
- default: '',
30
- },
31
- disabled: {
32
- type: Boolean,
33
- default: false,
34
- },
35
- btn: {
36
- type: String,
37
- default: new Styles().blueBtn,
38
- },
39
- },
40
- });
41
- </script>
42
-
43
- <style scoped>
44
- .disabled {
45
- opacity: 0.3;
46
- }
47
- </style>