hl-core 0.0.9-beta.2 → 0.0.9-beta.20
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.
- package/api/base.api.ts +684 -0
- package/api/index.ts +2 -620
- package/api/interceptors.ts +52 -14
- package/components/Button/Btn.vue +3 -3
- package/components/Complex/ContentBlock.vue +1 -1
- package/components/Complex/MessageBlock.vue +1 -1
- package/components/Complex/Page.vue +7 -1
- package/components/Complex/WhiteBlock.vue +7 -0
- package/components/Dialog/Dialog.vue +2 -2
- package/components/Dialog/FamilyDialog.vue +5 -5
- package/components/Form/FormBlock.vue +36 -29
- package/components/Form/FormSection.vue +2 -2
- package/components/Form/FormTextSection.vue +3 -3
- package/components/Form/FormToggle.vue +3 -3
- package/components/Form/ManagerAttachment.vue +55 -42
- package/components/Form/ProductConditionsBlock.vue +73 -20
- package/components/Input/EmptyFormField.vue +1 -1
- package/components/Input/FileInput.vue +8 -3
- package/components/Input/Monthpicker.vue +33 -0
- package/components/Input/PanelInput.vue +5 -1
- package/components/Input/RoundedEmptyField.vue +5 -0
- package/components/Input/RoundedSelect.vue +13 -0
- package/components/Layout/Drawer.vue +2 -1
- package/components/Layout/Header.vue +1 -1
- package/components/Layout/SettingsPanel.vue +5 -9
- package/components/List/ListEmpty.vue +1 -1
- package/components/Menu/MenuHover.vue +1 -1
- package/components/Menu/MenuNav.vue +1 -1
- package/components/Menu/MenuNavItem.vue +4 -4
- package/components/Pages/Anketa.vue +88 -47
- package/components/Pages/Auth.vue +9 -9
- package/components/Pages/ContragentForm.vue +505 -0
- package/components/Pages/Documents.vue +5 -5
- package/components/Pages/InvoiceInfo.vue +2 -2
- package/components/Pages/MemberForm.vue +215 -59
- package/components/Pages/ProductAgreement.vue +1 -3
- package/components/Pages/ProductConditions.vue +677 -151
- package/components/Panel/PanelHandler.vue +86 -21
- package/components/Panel/PanelSelectItem.vue +18 -3
- package/components/Utilities/IconBorder.vue +17 -0
- package/composables/axios.ts +1 -1
- package/composables/classes.ts +276 -11
- package/composables/constants.ts +43 -0
- package/composables/index.ts +40 -4
- package/composables/styles.ts +20 -10
- package/configs/i18n.ts +0 -2
- package/layouts/default.vue +5 -2
- package/layouts/full.vue +1 -1
- package/locales/ru.json +202 -6
- package/nuxt.config.ts +1 -1
- package/package.json +30 -39
- package/pages/500.vue +2 -2
- package/pages/Token.vue +1 -0
- package/plugins/helperFunctionsPlugins.ts +6 -7
- package/plugins/vuetifyPlugin.ts +2 -0
- package/store/data.store.ts +541 -211
- package/store/form.store.ts +11 -1
- package/store/member.store.ts +1 -1
- package/store/rules.ts +37 -2
- package/types/enum.ts +6 -0
- package/types/index.ts +145 -31
- package/components/Button/BtnIcon.vue +0 -47
- package/locales/kz.json +0 -585
package/store/data.store.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { rules } from './rules';
|
|
|
3
3
|
import { i18n } from '../configs/i18n';
|
|
4
4
|
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
5
5
|
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
|
|
6
|
-
import { DataStoreClass, Contragent, DocumentItem, Member, Value } from '../composables/classes';
|
|
6
|
+
import { DataStoreClass, Contragent, DocumentItem, Member, Value, CountryValue, PolicyholderV2 } from '../composables/classes';
|
|
7
7
|
import { ApiClass } from '../api';
|
|
8
8
|
import { useFormStore } from './form.store';
|
|
9
9
|
import { AxiosError } from 'axios';
|
|
@@ -39,12 +39,15 @@ 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',
|
|
47
|
+
isDas: state => state.product === 'daskamkorlyk',
|
|
46
48
|
isCalculator: state => state.product === 'calculator',
|
|
47
|
-
|
|
49
|
+
isCheckContract: state => state.product === 'checkcontract',
|
|
50
|
+
isCheckContragent: state => state.product === 'checkcontragent',
|
|
48
51
|
isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
|
|
49
52
|
hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
50
53
|
isClientAnketaCondition: state =>
|
|
@@ -71,14 +74,31 @@ export const useDataStore = defineStore('data', {
|
|
|
71
74
|
childFrame.contentWindow.postMessage({ action: action, value: value }, '*');
|
|
72
75
|
}
|
|
73
76
|
},
|
|
74
|
-
copyToClipboard(text:
|
|
77
|
+
async copyToClipboard(text: unknown) {
|
|
75
78
|
if (typeof text === 'string' || typeof text === 'number') {
|
|
76
|
-
if (
|
|
77
|
-
|
|
79
|
+
if (navigator.clipboard && window.isSecureContext) {
|
|
80
|
+
if (this.isBridge) {
|
|
81
|
+
await navigator.clipboard.writeText(String(text));
|
|
82
|
+
this.showToaster('success', this.t('toaster.copied'));
|
|
83
|
+
} else {
|
|
84
|
+
this.sendToParent(constants.postActions.clipboard, String(text));
|
|
85
|
+
}
|
|
78
86
|
} else {
|
|
79
|
-
|
|
87
|
+
const textarea = document.createElement('textarea');
|
|
88
|
+
textarea.value = String(text);
|
|
89
|
+
textarea.style.position = 'absolute';
|
|
90
|
+
textarea.style.left = '-99999999px';
|
|
91
|
+
document.body.prepend(textarea);
|
|
92
|
+
textarea.select();
|
|
93
|
+
try {
|
|
94
|
+
document.execCommand('copy');
|
|
95
|
+
this.showToaster('success', this.t('toaster.copied'));
|
|
96
|
+
} catch (err) {
|
|
97
|
+
console.log(err);
|
|
98
|
+
} finally {
|
|
99
|
+
textarea.remove();
|
|
100
|
+
}
|
|
80
101
|
}
|
|
81
|
-
this.showToaster('success', this.t('toaster.copied'));
|
|
82
102
|
} else {
|
|
83
103
|
this.showToaster('error', this.t('toaster.noUrl'));
|
|
84
104
|
}
|
|
@@ -438,9 +458,9 @@ export const useDataStore = defineStore('data', {
|
|
|
438
458
|
member.verifyDate = user.personalData.verifyDate;
|
|
439
459
|
member.iin = reformatIin(user.personalData.iin);
|
|
440
460
|
member.age = String(user.personalData.age);
|
|
441
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
461
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
442
462
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
443
|
-
const gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
|
|
463
|
+
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
444
464
|
member.gender = gender ? gender : new Value();
|
|
445
465
|
member.gender.id = user.personalData.gender;
|
|
446
466
|
member.birthDate = reformatDate(user.personalData.birthDate);
|
|
@@ -462,8 +482,8 @@ export const useDataStore = defineStore('data', {
|
|
|
462
482
|
return user.documents.find(i => i.type === '1UDL');
|
|
463
483
|
})();
|
|
464
484
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
465
|
-
const documentType = this.documentTypes.find(i => i.ids === userDocument.type);
|
|
466
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu === userDocument.issuerNameRu);
|
|
485
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
486
|
+
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
467
487
|
member.documentType = documentType ? documentType : new Value();
|
|
468
488
|
member.documentNumber = userDocument.number;
|
|
469
489
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
@@ -475,15 +495,24 @@ export const useDataStore = defineStore('data', {
|
|
|
475
495
|
user.data.forEach(questData => {
|
|
476
496
|
this.searchFromList(member, questData);
|
|
477
497
|
});
|
|
498
|
+
if (this.isLifetrip) {
|
|
499
|
+
const lastNameLat = user.data.find(obj => obj.questId === '500147');
|
|
500
|
+
const firstNameLat = user.data.find(obj => obj.questId === '500148');
|
|
501
|
+
member.lastNameLat = lastNameLat ? (lastNameLat.questAnswer as string) : null;
|
|
502
|
+
member.firstNameLat = firstNameLat ? (firstNameLat.questAnswer as string) : null;
|
|
503
|
+
}
|
|
478
504
|
}
|
|
479
505
|
if ('address' in user && user.address && user.address.length) {
|
|
480
506
|
const userAddress = user.address[0];
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
507
|
+
const countryName = userAddress.countryName;
|
|
508
|
+
if (countryName) {
|
|
509
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(countryName, 'i')));
|
|
510
|
+
member.registrationCountry = country ? country : new Value();
|
|
511
|
+
}
|
|
512
|
+
const province = this.states.find((i: Value) => i.ids === userAddress.stateCode);
|
|
513
|
+
const localityType = this.localityTypes.find((i: Value) => i.nameRu === userAddress.cityTypeName);
|
|
484
514
|
const city = this.cities.find(i => !!userAddress.cityName && i.nameRu === userAddress.cityName.replace('г.', ''));
|
|
485
515
|
const region = this.regions.find(i => !!userAddress.regionCode && i.ids == userAddress.regionCode);
|
|
486
|
-
member.registrationCountry = country ? country : new Value();
|
|
487
516
|
member.registrationStreet = userAddress.streetName;
|
|
488
517
|
member.registrationCity = city ? city : new Value();
|
|
489
518
|
member.registrationNumberApartment = userAddress.apartmentNumber;
|
|
@@ -531,7 +560,7 @@ export const useDataStore = defineStore('data', {
|
|
|
531
560
|
};
|
|
532
561
|
const qData = getQuestionariesData();
|
|
533
562
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
534
|
-
const qResult = qData.from.find(i => i.ids === searchIt.questAnswer);
|
|
563
|
+
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
535
564
|
//@ts-ignore
|
|
536
565
|
member[qData.field] = qResult ? qResult : new Value();
|
|
537
566
|
}
|
|
@@ -582,7 +611,14 @@ export const useDataStore = defineStore('data', {
|
|
|
582
611
|
this.contragentList = [];
|
|
583
612
|
}
|
|
584
613
|
},
|
|
585
|
-
async saveContragent(user: Member, whichForm: keyof typeof StoreMembers, whichIndex: number | null, onlySaveAction: boolean = true) {
|
|
614
|
+
async saveContragent(user: Member, whichForm: keyof typeof StoreMembers | 'contragent', whichIndex: number | null, onlySaveAction: boolean = true) {
|
|
615
|
+
if (this.isGons && user.iin) {
|
|
616
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesInActualPolicy(user.iin.replace(/-/g, ''));
|
|
617
|
+
if (doesHaveActiveContract) {
|
|
618
|
+
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
586
622
|
this.isLoading = !onlySaveAction;
|
|
587
623
|
const hasInsisId = await this.alreadyInInsis(user);
|
|
588
624
|
if (typeof hasInsisId === 'number') {
|
|
@@ -636,7 +672,7 @@ export const useDataStore = defineStore('data', {
|
|
|
636
672
|
}))(user);
|
|
637
673
|
const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
638
674
|
let questName = '';
|
|
639
|
-
let questionId = parseInt(
|
|
675
|
+
let questionId = parseInt(question.ids as string).toString();
|
|
640
676
|
if (questionId === '500003') {
|
|
641
677
|
questName = 'Код сектора экономики';
|
|
642
678
|
} else if (questionId === '500011') {
|
|
@@ -659,11 +695,11 @@ export const useDataStore = defineStore('data', {
|
|
|
659
695
|
user.addTaxResidency = new Value();
|
|
660
696
|
}
|
|
661
697
|
const addTaxResidency = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '507777') : undefined;
|
|
662
|
-
if (user.addTaxResidency.nameRu !== null) {
|
|
698
|
+
if (user.addTaxResidency.nameRu !== null && user.addTaxResidency.ids) {
|
|
663
699
|
questionariesData.push({
|
|
664
700
|
id: addTaxResidency ? addTaxResidency.id : 0,
|
|
665
701
|
contragentId: Number(user.id),
|
|
666
|
-
questAnswer:
|
|
702
|
+
questAnswer: user.addTaxResidency.ids,
|
|
667
703
|
questAnswerName: user.addTaxResidency.nameRu,
|
|
668
704
|
questName: 'Указать если налоговое резиденство выбрано другое',
|
|
669
705
|
questId: '507777',
|
|
@@ -680,6 +716,26 @@ export const useDataStore = defineStore('data', {
|
|
|
680
716
|
});
|
|
681
717
|
}
|
|
682
718
|
}
|
|
719
|
+
if (this.isLifetrip) {
|
|
720
|
+
const lastNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500147') : undefined;
|
|
721
|
+
const firstNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500148') : undefined;
|
|
722
|
+
questionariesData.push({
|
|
723
|
+
id: lastNameLat ? lastNameLat.id : 0,
|
|
724
|
+
contragentId: Number(user.id),
|
|
725
|
+
questAnswer: user.lastNameLat ?? '',
|
|
726
|
+
questAnswerName: null,
|
|
727
|
+
questName: 'Фамилия на латинице',
|
|
728
|
+
questId: '500147',
|
|
729
|
+
});
|
|
730
|
+
questionariesData.push({
|
|
731
|
+
id: firstNameLat ? firstNameLat.id : 0,
|
|
732
|
+
contragentId: Number(user.id),
|
|
733
|
+
questAnswer: user.firstNameLat ?? '',
|
|
734
|
+
questAnswerName: null,
|
|
735
|
+
questName: 'Имя на латинице',
|
|
736
|
+
questId: '500148',
|
|
737
|
+
});
|
|
738
|
+
}
|
|
683
739
|
|
|
684
740
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
685
741
|
const contactsData: ContragentContacts[] = [];
|
|
@@ -735,7 +791,7 @@ export const useDataStore = defineStore('data', {
|
|
|
735
791
|
issuerNameRu: user.documentIssuers.nameRu,
|
|
736
792
|
note: null,
|
|
737
793
|
number: user.documentNumber,
|
|
738
|
-
type: user.documentType.ids ?
|
|
794
|
+
type: user.documentType.ids ? (user.documentType.ids as string) : undefined,
|
|
739
795
|
typeName: user.documentType.nameRu,
|
|
740
796
|
serial: null,
|
|
741
797
|
verifyType: user.verifyType,
|
|
@@ -753,13 +809,13 @@ export const useDataStore = defineStore('data', {
|
|
|
753
809
|
addressData.push({
|
|
754
810
|
id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
|
|
755
811
|
contragentId: Number(user.id),
|
|
756
|
-
countryCode:
|
|
812
|
+
countryCode: user.registrationCountry.ids ?? undefined,
|
|
757
813
|
countryName: user.registrationCountry.nameRu ?? '',
|
|
758
|
-
stateCode:
|
|
814
|
+
stateCode: user.registrationProvince.ids ?? undefined,
|
|
759
815
|
stateName: user.registrationProvince.nameRu ?? '',
|
|
760
|
-
cityCode:
|
|
816
|
+
cityCode: user.registrationCity.code ?? undefined,
|
|
761
817
|
cityName: user.registrationCity.nameRu ?? '',
|
|
762
|
-
regionCode:
|
|
818
|
+
regionCode: user.registrationRegion.ids ?? undefined,
|
|
763
819
|
regionName: user.registrationRegion.nameRu,
|
|
764
820
|
streetName: user.registrationStreet ?? '',
|
|
765
821
|
kvartal: user.registrationQuarter,
|
|
@@ -784,8 +840,12 @@ export const useDataStore = defineStore('data', {
|
|
|
784
840
|
|
|
785
841
|
const personId = await this.api.saveContragent(data);
|
|
786
842
|
if (personId > 0) {
|
|
787
|
-
|
|
788
|
-
|
|
843
|
+
if (this.isLKA || whichForm === 'contragent') {
|
|
844
|
+
return personId;
|
|
845
|
+
} else {
|
|
846
|
+
await this.getContragentById(personId, whichForm, false, whichIndex);
|
|
847
|
+
user.otpTokenId = null;
|
|
848
|
+
}
|
|
789
849
|
} else {
|
|
790
850
|
return false;
|
|
791
851
|
}
|
|
@@ -942,9 +1002,9 @@ export const useDataStore = defineStore('data', {
|
|
|
942
1002
|
payPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
943
1003
|
annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
|
|
944
1004
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
945
|
-
?
|
|
946
|
-
:
|
|
947
|
-
paymentPeriodId:
|
|
1005
|
+
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
1006
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
1007
|
+
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id ?? undefined,
|
|
948
1008
|
lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply ?? ''),
|
|
949
1009
|
lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive ?? ''),
|
|
950
1010
|
adbMultiply: formatProcents(this.formStore.productConditionsForm.adbMultiply ?? ''),
|
|
@@ -962,9 +1022,9 @@ export const useDataStore = defineStore('data', {
|
|
|
962
1022
|
}
|
|
963
1023
|
if (this.isLiferenta) {
|
|
964
1024
|
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
965
|
-
conditionsData.policyAppDto.annuityTypeId =
|
|
1025
|
+
conditionsData.policyAppDto.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
966
1026
|
conditionsData.policyAppDto.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
967
|
-
conditionsData.policyAppDto.annuityPaymentPeriodId =
|
|
1027
|
+
conditionsData.policyAppDto.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
968
1028
|
}
|
|
969
1029
|
return conditionsData;
|
|
970
1030
|
},
|
|
@@ -984,6 +1044,8 @@ export const useDataStore = defineStore('data', {
|
|
|
984
1044
|
}
|
|
985
1045
|
},
|
|
986
1046
|
async deleteInsuredLogic() {
|
|
1047
|
+
// TODO Просмотреть
|
|
1048
|
+
if (this.isLifetrip) return;
|
|
987
1049
|
const applicationData = this.getConditionsData();
|
|
988
1050
|
const clearCovers = [{ code: 10, value: 'excluded' }];
|
|
989
1051
|
await Promise.allSettled(
|
|
@@ -1052,11 +1114,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1052
1114
|
salesChannel: this.formStore.applicationData.insisWorkDataApp.salesChannel,
|
|
1053
1115
|
salesChannelName: this.formStore.applicationData.insisWorkDataApp.salesChannelName,
|
|
1054
1116
|
insrType: this.formStore.applicationData.insisWorkDataApp.insrType,
|
|
1055
|
-
saleChanellPolicy:
|
|
1117
|
+
saleChanellPolicy: (this.formStore.SaleChanellPolicy.ids as string) ?? undefined,
|
|
1056
1118
|
saleChanellPolicyName: this.formStore.SaleChanellPolicy.nameRu ?? '',
|
|
1057
|
-
regionPolicy:
|
|
1119
|
+
regionPolicy: (this.formStore.RegionPolicy.ids as string) ?? undefined,
|
|
1058
1120
|
regionPolicyName: this.formStore.RegionPolicy.nameRu ?? '',
|
|
1059
|
-
managerPolicy:
|
|
1121
|
+
managerPolicy: this.formStore.ManagerPolicy.ids as string,
|
|
1060
1122
|
managerPolicyName: this.formStore.ManagerPolicy.nameRu ?? '',
|
|
1061
1123
|
insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
|
|
1062
1124
|
};
|
|
@@ -1090,7 +1152,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1090
1152
|
async getFromApi(whichField: string, whichRequest: string, parameter?: any, reset: boolean = false): Promise<Value[]> {
|
|
1091
1153
|
const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
|
|
1092
1154
|
const currentHour = new Date().getHours();
|
|
1093
|
-
const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / 15);
|
|
1155
|
+
const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / (this.isLKA ? 60 : 15));
|
|
1094
1156
|
|
|
1095
1157
|
const getDataCondition = () => {
|
|
1096
1158
|
if (!storageValue) return true;
|
|
@@ -1138,6 +1200,21 @@ export const useDataStore = defineStore('data', {
|
|
|
1138
1200
|
async getCountries() {
|
|
1139
1201
|
return await this.getFromApi('countries', 'getCountries');
|
|
1140
1202
|
},
|
|
1203
|
+
async getDicCountries() {
|
|
1204
|
+
if (this.isLifetrip) return await this.getFromApi('dicAllCountries', 'getArmDicts', 'DicCountry');
|
|
1205
|
+
},
|
|
1206
|
+
async getDicTripType() {
|
|
1207
|
+
if (this.isLifetrip) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
|
|
1208
|
+
},
|
|
1209
|
+
async getDicTripPurpose() {
|
|
1210
|
+
if (this.isLifetrip) return await this.getFromApi('purposes', 'getArmDicts', 'DicTripPurpose');
|
|
1211
|
+
},
|
|
1212
|
+
async getDicTripWorkType() {
|
|
1213
|
+
if (this.isLifetrip) return await this.getFromApi('workTypes', 'getArmDicts', 'DicTripWorkType');
|
|
1214
|
+
},
|
|
1215
|
+
async getDicSportsType() {
|
|
1216
|
+
if (this.isLifetrip) return await this.getFromApi('sportsTypes', 'getArmDicts', 'DicSportsType');
|
|
1217
|
+
},
|
|
1141
1218
|
async getCitizenshipCountries() {
|
|
1142
1219
|
return await this.getFromApi('citizenshipCountries', 'getCitizenshipCountries');
|
|
1143
1220
|
},
|
|
@@ -1150,15 +1227,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1150
1227
|
async getStates(key?: string, member?: Member) {
|
|
1151
1228
|
await this.getFromApi('states', 'getStates');
|
|
1152
1229
|
//@ts-ignore
|
|
1153
|
-
if (key && member[key] && member[key].ids !== null) return this.states.filter(i => i.code === member[key].ids);
|
|
1230
|
+
if (key && member[key] && member[key].ids !== null) return this.states.filter((i: Value) => i.code === member[key].ids);
|
|
1154
1231
|
return this.states;
|
|
1155
1232
|
},
|
|
1156
1233
|
async getRegions(key?: string, member?: Member) {
|
|
1157
1234
|
await this.getFromApi('regions', 'getRegions');
|
|
1158
1235
|
//@ts-ignore
|
|
1159
|
-
if (key && member[key] && member[key].ids !== null) return this.regions.filter(i => i.code === member[key].ids);
|
|
1236
|
+
if (key && member[key] && member[key].ids !== null) return this.regions.filter((i: Value) => i.code === member[key].ids);
|
|
1160
1237
|
if (member && member.registrationProvince.ids !== null) {
|
|
1161
|
-
return this.regions.filter(i => i.code === member.registrationProvince.ids);
|
|
1238
|
+
return this.regions.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1162
1239
|
} else {
|
|
1163
1240
|
return this.regions;
|
|
1164
1241
|
}
|
|
@@ -1166,13 +1243,27 @@ export const useDataStore = defineStore('data', {
|
|
|
1166
1243
|
async getCities(key?: string, member?: Member) {
|
|
1167
1244
|
await this.getFromApi('cities', 'getCities');
|
|
1168
1245
|
//@ts-ignore
|
|
1169
|
-
if (key && member[key] && member[key].ids !== null) return this.cities.filter(i => i.code === member[key].ids);
|
|
1246
|
+
if (key && member[key] && member[key].ids !== null) return this.cities.filter((i: Value) => i.code === member[key].ids);
|
|
1170
1247
|
if (member && member.registrationProvince.ids !== null) {
|
|
1171
|
-
return this.cities.filter(i => i.code === member.registrationProvince.ids);
|
|
1248
|
+
return this.cities.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1172
1249
|
} else {
|
|
1173
1250
|
return this.cities;
|
|
1174
1251
|
}
|
|
1175
1252
|
},
|
|
1253
|
+
async getCitiesEfo(key?: string, member?: PolicyholderV2, parentKey?: string) {
|
|
1254
|
+
if (this.isLifeBusiness) {
|
|
1255
|
+
await this.getFromApi('cities', 'getCities');
|
|
1256
|
+
//@ts-ignore
|
|
1257
|
+
if (key && member[parentKey][key] && member[parentKey][key].ids !== null) return this.cities.filter(i => i.code === member[parentKey][key].ids);
|
|
1258
|
+
//@ts-ignore
|
|
1259
|
+
if (member && member[parentKey].registrationProvince.ids !== null) {
|
|
1260
|
+
//@ts-ignore
|
|
1261
|
+
return this.cities.filter(i => i.code === member[parentKey].registrationProvince.ids);
|
|
1262
|
+
} else {
|
|
1263
|
+
return this.cities;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
},
|
|
1176
1267
|
async getLocalityTypes() {
|
|
1177
1268
|
return await this.getFromApi('localityTypes', 'getLocalityTypes');
|
|
1178
1269
|
},
|
|
@@ -1205,26 +1296,32 @@ export const useDataStore = defineStore('data', {
|
|
|
1205
1296
|
async getRelationTypes() {
|
|
1206
1297
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1207
1298
|
},
|
|
1208
|
-
async
|
|
1209
|
-
return await this.getFromApi('
|
|
1299
|
+
async getBanks() {
|
|
1300
|
+
if (this.isLifeBusiness) return await this.getFromApi('banks', 'getBanks');
|
|
1210
1301
|
},
|
|
1211
|
-
async
|
|
1212
|
-
|
|
1302
|
+
async getProcessIndexRate() {
|
|
1303
|
+
if (this.processCode) {
|
|
1304
|
+
return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
1305
|
+
}
|
|
1213
1306
|
},
|
|
1214
1307
|
async getProcessPaymentPeriod() {
|
|
1215
|
-
|
|
1308
|
+
if (this.processCode) {
|
|
1309
|
+
return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
|
|
1310
|
+
}
|
|
1216
1311
|
},
|
|
1217
1312
|
async getQuestionRefs(id?: string) {
|
|
1218
1313
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1219
1314
|
},
|
|
1220
1315
|
async getProcessTariff() {
|
|
1221
|
-
return await this.getFromApi('processTariff', 'getProcessTariff');
|
|
1316
|
+
return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
|
|
1222
1317
|
},
|
|
1223
1318
|
async getDicAnnuityTypeList() {
|
|
1224
1319
|
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
1225
1320
|
},
|
|
1226
1321
|
async getProcessAnnuityPaymentPeriod() {
|
|
1227
|
-
|
|
1322
|
+
if (this.processCode) {
|
|
1323
|
+
return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
|
|
1324
|
+
}
|
|
1228
1325
|
},
|
|
1229
1326
|
async getInsurancePay() {
|
|
1230
1327
|
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
@@ -1251,6 +1348,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1251
1348
|
this.getStates(),
|
|
1252
1349
|
this.getRegions(),
|
|
1253
1350
|
this.getCities(),
|
|
1351
|
+
this.getCitiesEfo(),
|
|
1254
1352
|
this.getLocalityTypes(),
|
|
1255
1353
|
this.getDocumentTypes(),
|
|
1256
1354
|
this.getDocumentIssuers(),
|
|
@@ -1267,57 +1365,55 @@ export const useDataStore = defineStore('data', {
|
|
|
1267
1365
|
this.getInsurancePay(),
|
|
1268
1366
|
this.getDictionaryItems('RegionPolicy'),
|
|
1269
1367
|
this.getDictionaryItems('SaleChanellPolicy'),
|
|
1368
|
+
this.getDicTripType(),
|
|
1369
|
+
this.getDicCountries(),
|
|
1370
|
+
this.getDicTripWorkType(),
|
|
1371
|
+
this.getDicSportsType(),
|
|
1372
|
+
this.getDicTripPurpose(),
|
|
1373
|
+
this.getCurrencies(),
|
|
1270
1374
|
]);
|
|
1271
1375
|
},
|
|
1272
1376
|
async getQuestionList(
|
|
1273
1377
|
surveyType: 'health' | 'critical',
|
|
1274
1378
|
processInstanceId: string | number,
|
|
1275
1379
|
insuredId: any,
|
|
1276
|
-
baseField:
|
|
1277
|
-
secondaryField: string,
|
|
1380
|
+
baseField: 'surveyByHealthBase' | 'surveyByCriticalBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBasePolicyholder',
|
|
1278
1381
|
whichMember: 'insured' | 'policyholder' = 'insured',
|
|
1279
1382
|
) {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
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;
|
|
1309
|
-
}
|
|
1383
|
+
try {
|
|
1384
|
+
const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
|
|
1385
|
+
whichMember === 'insured' ? this.api.getQuestionList(surveyType, processInstanceId, insuredId) : this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
|
|
1386
|
+
whichMember === 'insured'
|
|
1387
|
+
? this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId)
|
|
1388
|
+
: this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
|
|
1389
|
+
,
|
|
1390
|
+
]);
|
|
1391
|
+
if (baseQuestions.status === 'fulfilled') {
|
|
1392
|
+
this.formStore[baseField] = baseQuestions.value;
|
|
1393
|
+
}
|
|
1394
|
+
if (secondaryQuestions.status === 'fulfilled') {
|
|
1395
|
+
const baseAnketa = this.formStore[baseField];
|
|
1396
|
+
if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
|
|
1397
|
+
baseAnketa.body.forEach(i => {
|
|
1398
|
+
if (i.first.definedAnswers === 'Y' && i.second === null && secondaryQuestions.value) {
|
|
1399
|
+
i.second = structuredClone(secondaryQuestions.value);
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1310
1402
|
}
|
|
1311
|
-
} catch (err) {
|
|
1312
|
-
console.log(err);
|
|
1313
1403
|
}
|
|
1404
|
+
} catch (err) {
|
|
1405
|
+
ErrorHandler(err);
|
|
1314
1406
|
}
|
|
1315
|
-
//@ts-ignore
|
|
1316
1407
|
return this.formStore[baseField];
|
|
1317
1408
|
},
|
|
1318
1409
|
getNumberWithSpaces(n: any) {
|
|
1319
1410
|
return n === null ? null : Number((typeof n === 'string' ? n : n.toFixed().toString()).replace(/[^0-9]+/g, '')).toLocaleString('ru');
|
|
1320
1411
|
},
|
|
1412
|
+
getNumberWithSpacesAfterComma(n: number) {
|
|
1413
|
+
let parts = n.toFixed(2).split('.');
|
|
1414
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
1415
|
+
return parts.join(',');
|
|
1416
|
+
},
|
|
1321
1417
|
getNumberWithDot(n: any) {
|
|
1322
1418
|
return n === null ? null : n.toLocaleString('ru', { maximumFractionDigits: 2, minimumFractionDigits: 2 }).replace(/,/g, '.');
|
|
1323
1419
|
},
|
|
@@ -1445,7 +1541,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1445
1541
|
},
|
|
1446
1542
|
findObject(from: string, key: string, searchKey: any): any {
|
|
1447
1543
|
// @ts-ignore
|
|
1448
|
-
const found = this[from].find(i => i[key] == searchKey);
|
|
1544
|
+
const found = this[from].find((i: Value) => i[key] == searchKey);
|
|
1449
1545
|
return found || new Value();
|
|
1450
1546
|
},
|
|
1451
1547
|
async searchAgentByName(name: string) {
|
|
@@ -1496,27 +1592,78 @@ export const useDataStore = defineStore('data', {
|
|
|
1496
1592
|
this.isLoading = false;
|
|
1497
1593
|
}
|
|
1498
1594
|
},
|
|
1595
|
+
async getTripInsuredAmount(show: boolean = true) {
|
|
1596
|
+
this.isLoading = true;
|
|
1597
|
+
try {
|
|
1598
|
+
const countryID: string[] = [];
|
|
1599
|
+
for (let country = 0; country < this.formStore.productConditionsForm.calculatorForm.countries!.length; country++) {
|
|
1600
|
+
countryID.push(this.formStore.productConditionsForm.calculatorForm.countries![country].id as string);
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
const form = {
|
|
1604
|
+
tripTypeID: this.formStore.productConditionsForm.calculatorForm.type.id,
|
|
1605
|
+
countryID,
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1608
|
+
const result = await this.api.getTripInsuredAmount(form);
|
|
1609
|
+
const amounts: Value[] = [];
|
|
1610
|
+
result.amounts.forEach(amount => {
|
|
1611
|
+
amounts.push(new Value(amount['id'], amount['nameRu']));
|
|
1612
|
+
});
|
|
1613
|
+
|
|
1614
|
+
this.amountArray = amounts;
|
|
1615
|
+
this.formStore.productConditionsForm.calculatorForm.amount = new Value();
|
|
1616
|
+
this.currency = result.currency;
|
|
1617
|
+
|
|
1618
|
+
if (show) {
|
|
1619
|
+
this.showToaster('success', this.t('toaster.tripInsuredAmountCalculated'), 1000);
|
|
1620
|
+
}
|
|
1621
|
+
} catch (err) {
|
|
1622
|
+
ErrorHandler(err);
|
|
1623
|
+
}
|
|
1624
|
+
this.isLoading = false;
|
|
1625
|
+
},
|
|
1626
|
+
async getPeriod() {
|
|
1627
|
+
if (this.periodArray.length === 0) {
|
|
1628
|
+
try {
|
|
1629
|
+
const response = await this.api.getTripInsuranceDaysOptions();
|
|
1630
|
+
if (response) {
|
|
1631
|
+
const new3 = response.period;
|
|
1632
|
+
const newPeriod: Value[] = [];
|
|
1633
|
+
const newMaxDays: Value[] = [];
|
|
1634
|
+
Object.keys(new3).forEach(key => {
|
|
1635
|
+
newPeriod.push(new Value(key, key, key, key));
|
|
1636
|
+
new3[key as keyof typeof new3].forEach(item => {
|
|
1637
|
+
newMaxDays.push(new Value(item, item, item, key));
|
|
1638
|
+
});
|
|
1639
|
+
});
|
|
1640
|
+
this.periodArray = newPeriod;
|
|
1641
|
+
this.maxDaysAllArray = newMaxDays;
|
|
1642
|
+
}
|
|
1643
|
+
} catch (err) {
|
|
1644
|
+
ErrorHandler(err);
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
},
|
|
1499
1648
|
async calculateWithoutApplication(showLoader: boolean = false, product: string | null = null) {
|
|
1500
1649
|
this.isLoading = showLoader;
|
|
1501
1650
|
try {
|
|
1502
|
-
if (!this.formStore.productConditionsForm.signDate
|
|
1651
|
+
if (!this.formStore.productConditionsForm.signDate) {
|
|
1503
1652
|
return;
|
|
1504
1653
|
}
|
|
1505
1654
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1506
|
-
const birthDate = formatDate(this.formStore.productConditionsForm.birthDate);
|
|
1507
|
-
if (!signDate || !birthDate) return;
|
|
1508
1655
|
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1509
|
-
signDate: signDate.toISOString(),
|
|
1510
|
-
birthDate: birthDate.toISOString(),
|
|
1656
|
+
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1657
|
+
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1511
1658
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
1512
1659
|
amount: getNumber(String(this.formStore.productConditionsForm.requestedSumInsured)),
|
|
1513
1660
|
premium: getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonth)),
|
|
1514
1661
|
coverPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
|
|
1515
1662
|
payPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
|
|
1516
1663
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
1517
|
-
?
|
|
1518
|
-
:
|
|
1519
|
-
paymentPeriodId:
|
|
1664
|
+
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
1665
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
1666
|
+
paymentPeriodId: (this.formStore.productConditionsForm.paymentPeriod.id as string) ?? undefined,
|
|
1520
1667
|
addCovers: this.formStore.additionalInsuranceTermsWithout,
|
|
1521
1668
|
};
|
|
1522
1669
|
if (this.isKazyna || product === 'halykkazyna') {
|
|
@@ -1524,11 +1671,18 @@ export const useDataStore = defineStore('data', {
|
|
|
1524
1671
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1525
1672
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1526
1673
|
}
|
|
1527
|
-
if (this.isLiferenta) {
|
|
1674
|
+
if (this.isLiferenta || product === 'liferenta') {
|
|
1528
1675
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1529
|
-
calculationData.annuityTypeId =
|
|
1676
|
+
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
1530
1677
|
calculationData.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
1531
|
-
calculationData.annuityPaymentPeriodId =
|
|
1678
|
+
calculationData.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
1679
|
+
}
|
|
1680
|
+
if (this.isLifeBusiness || product === 'lifebusiness') {
|
|
1681
|
+
calculationData.clients = this.formStore.lfb.insurers;
|
|
1682
|
+
calculationData.insrCount = this.formStore.lfb.insurers.length;
|
|
1683
|
+
calculationData.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
|
|
1684
|
+
calculationData.fixInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
|
|
1685
|
+
calculationData.agentCommission = this.formStore.productConditionsForm.processTariff.id;
|
|
1532
1686
|
}
|
|
1533
1687
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1534
1688
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
@@ -1541,9 +1695,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1541
1695
|
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
|
|
1542
1696
|
}
|
|
1543
1697
|
}
|
|
1544
|
-
if (this.isLiferenta) {
|
|
1698
|
+
if (this.isLiferenta || product === 'liferenta') {
|
|
1545
1699
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(calculationResponse.annuityMonthPay);
|
|
1546
1700
|
}
|
|
1701
|
+
if (this.isGons || product === 'gons') {
|
|
1702
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(calculationResponse.totalAmount5);
|
|
1703
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(calculationResponse.totalAmount7);
|
|
1704
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(calculationResponse.statePremium5);
|
|
1705
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
|
|
1706
|
+
}
|
|
1707
|
+
if (this.isLifeBusiness || product === 'lifebusiness') {
|
|
1708
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremium);
|
|
1709
|
+
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1710
|
+
if (calculationResponse.clients) {
|
|
1711
|
+
this.formStore.lfb.insurers = calculationResponse.clients;
|
|
1712
|
+
}
|
|
1713
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1714
|
+
return calculationResponse;
|
|
1715
|
+
}
|
|
1547
1716
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1548
1717
|
} catch (err) {
|
|
1549
1718
|
ErrorHandler(err);
|
|
@@ -1579,6 +1748,68 @@ export const useDataStore = defineStore('data', {
|
|
|
1579
1748
|
if (this.isLiferenta) {
|
|
1580
1749
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
1581
1750
|
}
|
|
1751
|
+
|
|
1752
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1753
|
+
} catch (err) {
|
|
1754
|
+
ErrorHandler(err);
|
|
1755
|
+
}
|
|
1756
|
+
this.isLoading = false;
|
|
1757
|
+
},
|
|
1758
|
+
async calculatePrice(taskId?: string) {
|
|
1759
|
+
this.isLoading = true;
|
|
1760
|
+
try {
|
|
1761
|
+
const priceForm: {
|
|
1762
|
+
processInstanceId?: string | number | null;
|
|
1763
|
+
id?: string | null;
|
|
1764
|
+
addCoversDto?: AddCover[];
|
|
1765
|
+
insuredAmountId?: string | number | null;
|
|
1766
|
+
age?: string | number | null;
|
|
1767
|
+
lifeTripCountries?: string[] | null;
|
|
1768
|
+
tripPurposeId?: string | number | null;
|
|
1769
|
+
workTypeId?: string | number | null;
|
|
1770
|
+
sportsTypeId?: string | number | null;
|
|
1771
|
+
singleTripDays?: number;
|
|
1772
|
+
multipleTripMaxDays?: number;
|
|
1773
|
+
tripInsurancePeriod?: number;
|
|
1774
|
+
startDate?: string | null;
|
|
1775
|
+
endDate?: string | null;
|
|
1776
|
+
} = {};
|
|
1777
|
+
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
1778
|
+
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
1779
|
+
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
1780
|
+
priceForm.tripPurposeId = this.formStore.productConditionsForm.calculatorForm.purpose.id;
|
|
1781
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'WorkStudy') {
|
|
1782
|
+
priceForm.workTypeId = this.formStore.productConditionsForm.calculatorForm.workType.id;
|
|
1783
|
+
}
|
|
1784
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'Sport') {
|
|
1785
|
+
priceForm.sportsTypeId = this.formStore.productConditionsForm.calculatorForm.sportsType!.id;
|
|
1786
|
+
}
|
|
1787
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
1788
|
+
priceForm.singleTripDays = Number(this.formStore.productConditionsForm.calculatorForm.days);
|
|
1789
|
+
} else {
|
|
1790
|
+
priceForm.multipleTripMaxDays = Number(this.formStore.productConditionsForm.calculatorForm.maxDays.nameRu);
|
|
1791
|
+
priceForm.tripInsurancePeriod = Number(this.formStore.productConditionsForm.calculatorForm.period.nameRu);
|
|
1792
|
+
}
|
|
1793
|
+
if (this.isTask()) {
|
|
1794
|
+
priceForm.processInstanceId = this.formStore.applicationData.processInstanceId!;
|
|
1795
|
+
priceForm.id = taskId!;
|
|
1796
|
+
priceForm.age = Number(this.formStore.policyholderForm.age);
|
|
1797
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Multiple') {
|
|
1798
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
1799
|
+
} else {
|
|
1800
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
1801
|
+
priceForm.endDate = formatDate(this.formStore.productConditionsForm.calculatorForm.endDate!)!.toISOString();
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
const result = await this.api.getCalculator(priceForm);
|
|
1805
|
+
if (this.isTask() && taskId) {
|
|
1806
|
+
await this.api.setApplication(priceForm);
|
|
1807
|
+
const applicationData = await this.api.getApplicationData(taskId);
|
|
1808
|
+
this.formStore.applicationData = applicationData;
|
|
1809
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
1810
|
+
} else {
|
|
1811
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(result)} тг`;
|
|
1812
|
+
}
|
|
1582
1813
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1583
1814
|
} catch (err) {
|
|
1584
1815
|
ErrorHandler(err);
|
|
@@ -1644,7 +1875,49 @@ export const useDataStore = defineStore('data', {
|
|
|
1644
1875
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
1645
1876
|
this.formStore.finCenterData.date = reformatDate(applicationData.finCenterData.date);
|
|
1646
1877
|
}
|
|
1878
|
+
if ('lifeTripApp' in applicationData && setProductConditions) {
|
|
1879
|
+
const tripType = this.types.find((i: Value) => i.id === applicationData.lifeTripApp.tripTypeId);
|
|
1880
|
+
this.formStore.productConditionsForm.calculatorForm.type = tripType ? tripType : new Value();
|
|
1881
|
+
|
|
1882
|
+
const countries: CountryValue[] = [];
|
|
1883
|
+
for (let i in applicationData.lifeTripApp.lifeTripCountries) {
|
|
1884
|
+
const tripCountry = this.dicAllCountries.find(country => country.id === applicationData.lifeTripApp.lifeTripCountries[i]);
|
|
1885
|
+
if (tripCountry) {
|
|
1886
|
+
countries.push(tripCountry);
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
this.formStore.productConditionsForm.calculatorForm.countries = countries ? countries : [];
|
|
1647
1890
|
|
|
1891
|
+
if (this.formStore.productConditionsForm.calculatorForm.countries.length && this.formStore.productConditionsForm.calculatorForm.type.nameRu != null) {
|
|
1892
|
+
await this.getTripInsuredAmount(false);
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
const amount = this.amountArray.find((i: Value) => i.id === applicationData.lifeTripApp.insuredAmountId);
|
|
1896
|
+
this.formStore.productConditionsForm.calculatorForm.amount = amount ? amount : new Value();
|
|
1897
|
+
|
|
1898
|
+
const purpose = this.purposes.find((i: Value) => i.id === applicationData.lifeTripApp.tripPurposeId);
|
|
1899
|
+
this.formStore.productConditionsForm.calculatorForm.purpose = purpose ? purpose : new Value();
|
|
1900
|
+
|
|
1901
|
+
if (applicationData.lifeTripApp.workTypeId != null) {
|
|
1902
|
+
const work = this.workTypes.find((i: Value) => i.id === applicationData.lifeTripApp.workTypeId);
|
|
1903
|
+
this.formStore.productConditionsForm.calculatorForm.workType = work ? work : new Value();
|
|
1904
|
+
}
|
|
1905
|
+
if (applicationData.lifeTripApp.sportsTypeId != null) {
|
|
1906
|
+
const sport = this.sportsTypes.find((i: Value) => i.id === applicationData.lifeTripApp.sportsTypeId);
|
|
1907
|
+
this.formStore.productConditionsForm.calculatorForm.sportsType = sport ? sport : new Value();
|
|
1908
|
+
}
|
|
1909
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
1910
|
+
this.formStore.productConditionsForm.calculatorForm.days = Number(applicationData.lifeTripApp.singleTripDays);
|
|
1911
|
+
} else {
|
|
1912
|
+
await this.getPeriod();
|
|
1913
|
+
this.formStore.productConditionsForm.calculatorForm.maxDays = this.maxDaysAllArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.multipleTripMaxDays)!;
|
|
1914
|
+
this.formStore.productConditionsForm.calculatorForm.period = this.periodArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.tripInsurancePeriod)!;
|
|
1915
|
+
}
|
|
1916
|
+
this.formStore.productConditionsForm.calculatorForm.startDate = reformatDate(applicationData.lifeTripApp.startDate);
|
|
1917
|
+
this.formStore.productConditionsForm.calculatorForm.endDate = reformatDate(applicationData.lifeTripApp.endDate);
|
|
1918
|
+
|
|
1919
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
1920
|
+
}
|
|
1648
1921
|
if (fetchMembers) {
|
|
1649
1922
|
let allMembers = [
|
|
1650
1923
|
{
|
|
@@ -1714,7 +1987,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1714
1987
|
if (insuredData && insuredData.length) {
|
|
1715
1988
|
insuredData.forEach((each, index) => {
|
|
1716
1989
|
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
1717
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
1990
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1718
1991
|
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1719
1992
|
});
|
|
1720
1993
|
}
|
|
@@ -1722,11 +1995,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1722
1995
|
if (beneficiaryData && beneficiaryData.length) {
|
|
1723
1996
|
beneficiaryData.forEach((each, index) => {
|
|
1724
1997
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
1725
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
1998
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1726
1999
|
this.formStore.beneficiaryForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1727
2000
|
this.formStore.beneficiaryForm[index].percentageOfPayoutAmount = each.percentage;
|
|
1728
2001
|
if (this.isLiferenta || this.isBolashak) {
|
|
1729
|
-
const insurancePay = this.insurancePay.find(i => i.id == each.beneficiaryInsurancePayId);
|
|
2002
|
+
const insurancePay = this.insurancePay.find((i: Value) => i.id == each.beneficiaryInsurancePayId);
|
|
1730
2003
|
this.formStore.beneficiaryForm[index].insurancePay = insurancePay ? insurancePay : new Value();
|
|
1731
2004
|
}
|
|
1732
2005
|
});
|
|
@@ -1854,6 +2127,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1854
2127
|
return true;
|
|
1855
2128
|
} catch (err) {
|
|
1856
2129
|
this.isLoading = false;
|
|
2130
|
+
this.isButtonsLoading = false;
|
|
1857
2131
|
return ErrorHandler(err);
|
|
1858
2132
|
}
|
|
1859
2133
|
},
|
|
@@ -2070,6 +2344,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2070
2344
|
const recalculatedValue = await this.api.reCalculate(data);
|
|
2071
2345
|
if (!!recalculatedValue) {
|
|
2072
2346
|
await this.getApplicationData(taskId, false, false, false, true);
|
|
2347
|
+
if (this.isGons) {
|
|
2348
|
+
this.formStore.productConditionsForm.isRecalculated = true;
|
|
2349
|
+
}
|
|
2073
2350
|
this.showToaster(
|
|
2074
2351
|
'success',
|
|
2075
2352
|
`${this.t('toaster.successRecalculation')}. ${whichSum == 'insurancePremiumPerMonth' ? 'Страховая премия' : 'Страховая сумма'}: ${this.getNumberWithSpaces(
|
|
@@ -2111,7 +2388,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2111
2388
|
}
|
|
2112
2389
|
}
|
|
2113
2390
|
} else {
|
|
2114
|
-
if (this.formStore[localKey].some(
|
|
2391
|
+
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2115
2392
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
2116
2393
|
return false;
|
|
2117
2394
|
}
|
|
@@ -2209,8 +2486,8 @@ export const useDataStore = defineStore('data', {
|
|
|
2209
2486
|
}
|
|
2210
2487
|
if (localCheck === false) {
|
|
2211
2488
|
try {
|
|
2212
|
-
if (this.isInitiator() &&
|
|
2213
|
-
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2489
|
+
if (this.isInitiator() && this.members.beneficialOwnerApp.has) {
|
|
2490
|
+
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2214
2491
|
await Promise.allSettled(
|
|
2215
2492
|
this.formStore.applicationData.beneficialOwnerApp.map(async (member: any) => {
|
|
2216
2493
|
await this.api.deleteMember('BeneficialOwner', member.id);
|
|
@@ -2230,124 +2507,123 @@ export const useDataStore = defineStore('data', {
|
|
|
2230
2507
|
if (!anketa) return false;
|
|
2231
2508
|
const list = anketa.body;
|
|
2232
2509
|
if (!list || (list && list.length === 0)) return false;
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
if ((
|
|
2236
|
-
|
|
2510
|
+
const isAnketaValid = ref<boolean>(true);
|
|
2511
|
+
list.forEach(i => {
|
|
2512
|
+
if ((i.first.definedAnswers === 'N' && !i.first.answerText) || (i.first.definedAnswers === 'Y' && !i.first.answerName)) {
|
|
2513
|
+
isAnketaValid.value = false;
|
|
2514
|
+
return false;
|
|
2237
2515
|
}
|
|
2238
|
-
|
|
2239
|
-
|
|
2516
|
+
if (this.controls.isSecondAnketaRequired && i.first.definedAnswers === 'Y' && i.first.answerName?.match(new RegExp('Да', 'i'))) {
|
|
2517
|
+
if (i.second && i.second.length) {
|
|
2518
|
+
const isValid = i.second.every(second => (second.definedAnswers === 'N' ? !!second.answerText : !!second.answerName));
|
|
2519
|
+
if (!isValid) {
|
|
2520
|
+
isAnketaValid.value = false;
|
|
2521
|
+
this.showToaster('info', this.t('toaster.emptySecondAnketa', { text: i.first.name }), 5000);
|
|
2522
|
+
return false;
|
|
2523
|
+
}
|
|
2524
|
+
} else {
|
|
2525
|
+
// TODO уточнить
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
});
|
|
2529
|
+
return isAnketaValid.value;
|
|
2240
2530
|
},
|
|
2241
2531
|
async validateAllForms(taskId: string) {
|
|
2242
2532
|
this.isLoading = true;
|
|
2243
2533
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
2244
2534
|
if (areMembersValid) {
|
|
2245
2535
|
if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) {
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
this.formStore.applicationData.processInstanceId,
|
|
2252
|
-
this.
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2277
|
-
}),
|
|
2278
|
-
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2279
|
-
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2280
|
-
}),
|
|
2281
|
-
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2282
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2283
|
-
}),
|
|
2284
|
-
])
|
|
2285
|
-
: await Promise.allSettled([
|
|
2286
|
-
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2287
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2288
|
-
}),
|
|
2289
|
-
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2290
|
-
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2291
|
-
}),
|
|
2292
|
-
]);
|
|
2293
|
-
} else {
|
|
2294
|
-
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
|
-
),
|
|
2302
|
-
this.isClientAnketaCondition &&
|
|
2303
|
-
this.getQuestionList(
|
|
2304
|
-
'health',
|
|
2305
|
-
this.formStore.applicationData.processInstanceId,
|
|
2306
|
-
this.formStore.applicationData.clientApp.id,
|
|
2307
|
-
'surveyByHealthBasePolicyholder',
|
|
2308
|
-
'surveyByHealthSecond',
|
|
2309
|
-
'policyholder',
|
|
2310
|
-
),
|
|
2311
|
-
,
|
|
2312
|
-
]);
|
|
2313
|
-
this.isClientAnketaCondition
|
|
2314
|
-
? await Promise.allSettled([
|
|
2315
|
-
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2316
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2317
|
-
}),
|
|
2318
|
-
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2319
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2320
|
-
}),
|
|
2321
|
-
])
|
|
2322
|
-
: await Promise.allSettled(
|
|
2323
|
-
this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2324
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2325
|
-
}),
|
|
2326
|
-
);
|
|
2327
|
-
}
|
|
2328
|
-
if (this.validateAnketa('surveyByHealthBase')) {
|
|
2329
|
-
let hasCriticalAndItsValid = null;
|
|
2330
|
-
if (hasCritical && hasCritical.coverSumName !== 'не включено') {
|
|
2331
|
-
if (this.validateAnketa('surveyByCriticalBase')) {
|
|
2332
|
-
hasCriticalAndItsValid = true;
|
|
2333
|
-
} else {
|
|
2334
|
-
hasCriticalAndItsValid = false;
|
|
2335
|
-
this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
|
|
2336
|
-
}
|
|
2536
|
+
if (this.controls.hasAnketa) {
|
|
2537
|
+
const hasCritical =
|
|
2538
|
+
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
2539
|
+
if (hasCritical === null || (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')))) {
|
|
2540
|
+
await Promise.allSettled([
|
|
2541
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
2542
|
+
this.isClientAnketaCondition &&
|
|
2543
|
+
this.getQuestionList(
|
|
2544
|
+
'health',
|
|
2545
|
+
this.formStore.applicationData.processInstanceId,
|
|
2546
|
+
this.formStore.applicationData.clientApp.id,
|
|
2547
|
+
'surveyByHealthBasePolicyholder',
|
|
2548
|
+
'policyholder',
|
|
2549
|
+
),
|
|
2550
|
+
,
|
|
2551
|
+
]);
|
|
2552
|
+
this.isClientAnketaCondition
|
|
2553
|
+
? await Promise.allSettled([
|
|
2554
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2555
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2556
|
+
}),
|
|
2557
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2558
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2559
|
+
}),
|
|
2560
|
+
])
|
|
2561
|
+
: await Promise.allSettled(
|
|
2562
|
+
this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2563
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2564
|
+
}),
|
|
2565
|
+
);
|
|
2337
2566
|
} else {
|
|
2338
|
-
|
|
2567
|
+
await Promise.allSettled([
|
|
2568
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
2569
|
+
this.getQuestionList('critical', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByCriticalBase'),
|
|
2570
|
+
this.isClientAnketaCondition &&
|
|
2571
|
+
this.getQuestionList(
|
|
2572
|
+
'health',
|
|
2573
|
+
this.formStore.applicationData.processInstanceId,
|
|
2574
|
+
this.formStore.applicationData.clientApp.id,
|
|
2575
|
+
'surveyByHealthBasePolicyholder',
|
|
2576
|
+
'policyholder',
|
|
2577
|
+
),
|
|
2578
|
+
]);
|
|
2579
|
+
this.isClientAnketaCondition
|
|
2580
|
+
? await Promise.allSettled([
|
|
2581
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2582
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2583
|
+
}),
|
|
2584
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2585
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2586
|
+
}),
|
|
2587
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2588
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2589
|
+
}),
|
|
2590
|
+
])
|
|
2591
|
+
: await Promise.allSettled([
|
|
2592
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2593
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2594
|
+
}),
|
|
2595
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2596
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2597
|
+
}),
|
|
2598
|
+
]);
|
|
2339
2599
|
}
|
|
2340
|
-
if (
|
|
2341
|
-
|
|
2342
|
-
|
|
2600
|
+
if (this.validateAnketa('surveyByHealthBase')) {
|
|
2601
|
+
let hasCriticalAndItsValid = null;
|
|
2602
|
+
if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')) === null) {
|
|
2603
|
+
if (this.validateAnketa('surveyByCriticalBase')) {
|
|
2604
|
+
hasCriticalAndItsValid = true;
|
|
2605
|
+
} else {
|
|
2606
|
+
hasCriticalAndItsValid = false;
|
|
2607
|
+
this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
|
|
2608
|
+
}
|
|
2609
|
+
} else {
|
|
2610
|
+
hasCriticalAndItsValid = null;
|
|
2611
|
+
}
|
|
2612
|
+
if (hasCriticalAndItsValid === true || hasCriticalAndItsValid === null) {
|
|
2613
|
+
if (this.isClientAnketaCondition && this.validateAnketa('surveyByHealthBasePolicyholder') === false) {
|
|
2614
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketaPolicyholder'), 3000);
|
|
2615
|
+
this.isLoading = false;
|
|
2616
|
+
return false;
|
|
2617
|
+
}
|
|
2343
2618
|
this.isLoading = false;
|
|
2344
|
-
return
|
|
2619
|
+
return true;
|
|
2345
2620
|
}
|
|
2346
|
-
|
|
2347
|
-
|
|
2621
|
+
} else {
|
|
2622
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketa'), 3000);
|
|
2348
2623
|
}
|
|
2349
2624
|
} else {
|
|
2350
|
-
this.
|
|
2625
|
+
this.isLoading = false;
|
|
2626
|
+
return true;
|
|
2351
2627
|
}
|
|
2352
2628
|
} else {
|
|
2353
2629
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
@@ -2405,6 +2681,32 @@ export const useDataStore = defineStore('data', {
|
|
|
2405
2681
|
this.isLoading = false;
|
|
2406
2682
|
}
|
|
2407
2683
|
},
|
|
2684
|
+
async getKgd(iin: string) {
|
|
2685
|
+
try {
|
|
2686
|
+
const data = {
|
|
2687
|
+
iinBin: iin.replace(/-/g, ''),
|
|
2688
|
+
};
|
|
2689
|
+
const kgdResponse = await this.api.getKgd(data);
|
|
2690
|
+
return kgdResponse;
|
|
2691
|
+
} catch (err) {
|
|
2692
|
+
return ErrorHandler(err);
|
|
2693
|
+
}
|
|
2694
|
+
},
|
|
2695
|
+
async getGbdUl(bin: string) {
|
|
2696
|
+
if (!this.accessToken) return null;
|
|
2697
|
+
try {
|
|
2698
|
+
const decoded = jwtDecode(this.accessToken);
|
|
2699
|
+
const data = {
|
|
2700
|
+
userName: decoded.code,
|
|
2701
|
+
branchName: decoded.branchCode,
|
|
2702
|
+
bin: bin.replace(/-/g, ''),
|
|
2703
|
+
};
|
|
2704
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
2705
|
+
return gbdulResponse;
|
|
2706
|
+
} catch (err) {
|
|
2707
|
+
return ErrorHandler(err);
|
|
2708
|
+
}
|
|
2709
|
+
},
|
|
2408
2710
|
async getContragentFromGBDFL(member: Member) {
|
|
2409
2711
|
// null - ожидание
|
|
2410
2712
|
// false - ошибка или неправильно
|
|
@@ -2436,6 +2738,20 @@ export const useDataStore = defineStore('data', {
|
|
|
2436
2738
|
this.isLoading = false;
|
|
2437
2739
|
return false;
|
|
2438
2740
|
}
|
|
2741
|
+
if (!gbdResponse.content) {
|
|
2742
|
+
let errMsg: string = '';
|
|
2743
|
+
if (gbdResponse.status) {
|
|
2744
|
+
errMsg += gbdResponse.status;
|
|
2745
|
+
}
|
|
2746
|
+
if (gbdResponse.statusName) {
|
|
2747
|
+
errMsg += gbdResponse.statusName;
|
|
2748
|
+
}
|
|
2749
|
+
if (!!errMsg) {
|
|
2750
|
+
this.showToaster('error', errMsg, 5000);
|
|
2751
|
+
}
|
|
2752
|
+
this.isLoading = false;
|
|
2753
|
+
return false;
|
|
2754
|
+
}
|
|
2439
2755
|
const { person } = parseXML(gbdResponse.content, true, 'person');
|
|
2440
2756
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
2441
2757
|
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
@@ -2457,11 +2773,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2457
2773
|
member.firstName = person.name;
|
|
2458
2774
|
member.lastName = person.surname;
|
|
2459
2775
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
2776
|
+
if (this.isLifetrip) {
|
|
2777
|
+
member.firstNameLat = person.engFirstName ? person.engFirstName : '';
|
|
2778
|
+
member.lastNameLat = person.engSurname ? person.engSurname : '';
|
|
2779
|
+
}
|
|
2460
2780
|
member.longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
|
|
2461
2781
|
member.birthDate = reformatDate(person.birthDate);
|
|
2462
2782
|
member.genderName = person.gender.nameRu;
|
|
2463
2783
|
|
|
2464
|
-
const gender = this.gender.find(i => i.id == person.gender.code);
|
|
2784
|
+
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
2465
2785
|
if (gender) member.gender = gender;
|
|
2466
2786
|
|
|
2467
2787
|
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
@@ -2544,7 +2864,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2544
2864
|
if ('length' in person.documents.document) {
|
|
2545
2865
|
const validDocument = person.documents.document.find((i: any) => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2546
2866
|
if (validDocument) {
|
|
2547
|
-
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2867
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === '1UDL');
|
|
2548
2868
|
if (documentType) member.documentType = documentType;
|
|
2549
2869
|
|
|
2550
2870
|
member.documentNumber = validDocument.number;
|
|
@@ -2558,7 +2878,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2558
2878
|
} else {
|
|
2559
2879
|
const documentType =
|
|
2560
2880
|
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2561
|
-
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2881
|
+
? this.documentTypes.find((i: Value) => i.ids === '1UDL')
|
|
2562
2882
|
: this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2563
2883
|
? this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2564
2884
|
: new Value();
|
|
@@ -2577,9 +2897,18 @@ export const useDataStore = defineStore('data', {
|
|
|
2577
2897
|
const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
|
|
2578
2898
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2579
2899
|
}
|
|
2580
|
-
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2900
|
+
const economySectorCode = this.economySectorCode.find((i: Value) => i.ids === '500003.9');
|
|
2581
2901
|
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
2582
2902
|
},
|
|
2903
|
+
async checkIIN(iin: number) {
|
|
2904
|
+
try {
|
|
2905
|
+
const response = await this.api.checkIIN(iin);
|
|
2906
|
+
return response;
|
|
2907
|
+
} catch (err) {
|
|
2908
|
+
ErrorHandler(err);
|
|
2909
|
+
return null;
|
|
2910
|
+
}
|
|
2911
|
+
},
|
|
2583
2912
|
async isCourseChanged(processInstanceId: string) {
|
|
2584
2913
|
try {
|
|
2585
2914
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -2589,6 +2918,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2589
2918
|
}
|
|
2590
2919
|
},
|
|
2591
2920
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
2921
|
+
if (this.isLifetrip) return false;
|
|
2592
2922
|
switch (whichForm) {
|
|
2593
2923
|
case this.formStore.beneficiaryFormKey:
|
|
2594
2924
|
case this.formStore.beneficialOwnerFormKey:
|