hl-core 0.0.9-beta.2 → 0.0.9-beta.21
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 +58 -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 +21 -10
- 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 +221 -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 +561 -226
- 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
|
}
|
|
@@ -225,24 +245,15 @@ export const useDataStore = defineStore('data', {
|
|
|
225
245
|
this.getUserRoles();
|
|
226
246
|
}
|
|
227
247
|
const checkPermission = () => {
|
|
248
|
+
const hasAccess = this.hasAccess();
|
|
228
249
|
if (this.isAML) {
|
|
229
|
-
return
|
|
250
|
+
return hasAccess.toAML;
|
|
230
251
|
}
|
|
231
252
|
if (this.isLKA) {
|
|
232
|
-
return
|
|
253
|
+
return hasAccess.toLKA;
|
|
233
254
|
}
|
|
234
255
|
if (this.isEFO) {
|
|
235
|
-
return
|
|
236
|
-
this.isInitiator() ||
|
|
237
|
-
this.isUnderwriter() ||
|
|
238
|
-
this.isAdmin() ||
|
|
239
|
-
this.isCompliance() ||
|
|
240
|
-
this.isAnalyst() ||
|
|
241
|
-
this.isUpk() ||
|
|
242
|
-
this.isFinCenter() ||
|
|
243
|
-
this.isSupervisor() ||
|
|
244
|
-
this.isSupport()
|
|
245
|
-
);
|
|
256
|
+
return hasAccess.toEFO;
|
|
246
257
|
}
|
|
247
258
|
return false;
|
|
248
259
|
};
|
|
@@ -438,9 +449,9 @@ export const useDataStore = defineStore('data', {
|
|
|
438
449
|
member.verifyDate = user.personalData.verifyDate;
|
|
439
450
|
member.iin = reformatIin(user.personalData.iin);
|
|
440
451
|
member.age = String(user.personalData.age);
|
|
441
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
452
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
442
453
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
443
|
-
const gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
|
|
454
|
+
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
444
455
|
member.gender = gender ? gender : new Value();
|
|
445
456
|
member.gender.id = user.personalData.gender;
|
|
446
457
|
member.birthDate = reformatDate(user.personalData.birthDate);
|
|
@@ -462,8 +473,8 @@ export const useDataStore = defineStore('data', {
|
|
|
462
473
|
return user.documents.find(i => i.type === '1UDL');
|
|
463
474
|
})();
|
|
464
475
|
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);
|
|
476
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
477
|
+
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
467
478
|
member.documentType = documentType ? documentType : new Value();
|
|
468
479
|
member.documentNumber = userDocument.number;
|
|
469
480
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
@@ -475,15 +486,24 @@ export const useDataStore = defineStore('data', {
|
|
|
475
486
|
user.data.forEach(questData => {
|
|
476
487
|
this.searchFromList(member, questData);
|
|
477
488
|
});
|
|
489
|
+
if (this.isLifetrip) {
|
|
490
|
+
const lastNameLat = user.data.find(obj => obj.questId === '500147');
|
|
491
|
+
const firstNameLat = user.data.find(obj => obj.questId === '500148');
|
|
492
|
+
member.lastNameLat = lastNameLat ? (lastNameLat.questAnswer as string) : null;
|
|
493
|
+
member.firstNameLat = firstNameLat ? (firstNameLat.questAnswer as string) : null;
|
|
494
|
+
}
|
|
478
495
|
}
|
|
479
496
|
if ('address' in user && user.address && user.address.length) {
|
|
480
497
|
const userAddress = user.address[0];
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
498
|
+
const countryName = userAddress.countryName;
|
|
499
|
+
if (countryName) {
|
|
500
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(countryName, 'i')));
|
|
501
|
+
member.registrationCountry = country ? country : new Value();
|
|
502
|
+
}
|
|
503
|
+
const province = this.states.find((i: Value) => i.ids === userAddress.stateCode);
|
|
504
|
+
const localityType = this.localityTypes.find((i: Value) => i.nameRu === userAddress.cityTypeName);
|
|
484
505
|
const city = this.cities.find(i => !!userAddress.cityName && i.nameRu === userAddress.cityName.replace('г.', ''));
|
|
485
506
|
const region = this.regions.find(i => !!userAddress.regionCode && i.ids == userAddress.regionCode);
|
|
486
|
-
member.registrationCountry = country ? country : new Value();
|
|
487
507
|
member.registrationStreet = userAddress.streetName;
|
|
488
508
|
member.registrationCity = city ? city : new Value();
|
|
489
509
|
member.registrationNumberApartment = userAddress.apartmentNumber;
|
|
@@ -531,7 +551,7 @@ export const useDataStore = defineStore('data', {
|
|
|
531
551
|
};
|
|
532
552
|
const qData = getQuestionariesData();
|
|
533
553
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
534
|
-
const qResult = qData.from.find(i => i.ids === searchIt.questAnswer);
|
|
554
|
+
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
535
555
|
//@ts-ignore
|
|
536
556
|
member[qData.field] = qResult ? qResult : new Value();
|
|
537
557
|
}
|
|
@@ -582,7 +602,14 @@ export const useDataStore = defineStore('data', {
|
|
|
582
602
|
this.contragentList = [];
|
|
583
603
|
}
|
|
584
604
|
},
|
|
585
|
-
async saveContragent(user: Member, whichForm: keyof typeof StoreMembers, whichIndex: number | null, onlySaveAction: boolean = true) {
|
|
605
|
+
async saveContragent(user: Member, whichForm: keyof typeof StoreMembers | 'contragent', whichIndex: number | null, onlySaveAction: boolean = true) {
|
|
606
|
+
if (this.isGons && user.iin) {
|
|
607
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesInActualPolicy(user.iin.replace(/-/g, ''));
|
|
608
|
+
if (doesHaveActiveContract) {
|
|
609
|
+
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
586
613
|
this.isLoading = !onlySaveAction;
|
|
587
614
|
const hasInsisId = await this.alreadyInInsis(user);
|
|
588
615
|
if (typeof hasInsisId === 'number') {
|
|
@@ -636,7 +663,7 @@ export const useDataStore = defineStore('data', {
|
|
|
636
663
|
}))(user);
|
|
637
664
|
const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
638
665
|
let questName = '';
|
|
639
|
-
let questionId = parseInt(
|
|
666
|
+
let questionId = parseInt(question.ids as string).toString();
|
|
640
667
|
if (questionId === '500003') {
|
|
641
668
|
questName = 'Код сектора экономики';
|
|
642
669
|
} else if (questionId === '500011') {
|
|
@@ -659,11 +686,11 @@ export const useDataStore = defineStore('data', {
|
|
|
659
686
|
user.addTaxResidency = new Value();
|
|
660
687
|
}
|
|
661
688
|
const addTaxResidency = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '507777') : undefined;
|
|
662
|
-
if (user.addTaxResidency.nameRu !== null) {
|
|
689
|
+
if (user.addTaxResidency.nameRu !== null && user.addTaxResidency.ids) {
|
|
663
690
|
questionariesData.push({
|
|
664
691
|
id: addTaxResidency ? addTaxResidency.id : 0,
|
|
665
692
|
contragentId: Number(user.id),
|
|
666
|
-
questAnswer:
|
|
693
|
+
questAnswer: user.addTaxResidency.ids,
|
|
667
694
|
questAnswerName: user.addTaxResidency.nameRu,
|
|
668
695
|
questName: 'Указать если налоговое резиденство выбрано другое',
|
|
669
696
|
questId: '507777',
|
|
@@ -680,6 +707,26 @@ export const useDataStore = defineStore('data', {
|
|
|
680
707
|
});
|
|
681
708
|
}
|
|
682
709
|
}
|
|
710
|
+
if (this.isLifetrip) {
|
|
711
|
+
const lastNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500147') : undefined;
|
|
712
|
+
const firstNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500148') : undefined;
|
|
713
|
+
questionariesData.push({
|
|
714
|
+
id: lastNameLat ? lastNameLat.id : 0,
|
|
715
|
+
contragentId: Number(user.id),
|
|
716
|
+
questAnswer: user.lastNameLat ?? '',
|
|
717
|
+
questAnswerName: null,
|
|
718
|
+
questName: 'Фамилия на латинице',
|
|
719
|
+
questId: '500147',
|
|
720
|
+
});
|
|
721
|
+
questionariesData.push({
|
|
722
|
+
id: firstNameLat ? firstNameLat.id : 0,
|
|
723
|
+
contragentId: Number(user.id),
|
|
724
|
+
questAnswer: user.firstNameLat ?? '',
|
|
725
|
+
questAnswerName: null,
|
|
726
|
+
questName: 'Имя на латинице',
|
|
727
|
+
questId: '500148',
|
|
728
|
+
});
|
|
729
|
+
}
|
|
683
730
|
|
|
684
731
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
685
732
|
const contactsData: ContragentContacts[] = [];
|
|
@@ -735,7 +782,7 @@ export const useDataStore = defineStore('data', {
|
|
|
735
782
|
issuerNameRu: user.documentIssuers.nameRu,
|
|
736
783
|
note: null,
|
|
737
784
|
number: user.documentNumber,
|
|
738
|
-
type: user.documentType.ids ?
|
|
785
|
+
type: user.documentType.ids ? (user.documentType.ids as string) : undefined,
|
|
739
786
|
typeName: user.documentType.nameRu,
|
|
740
787
|
serial: null,
|
|
741
788
|
verifyType: user.verifyType,
|
|
@@ -753,13 +800,13 @@ export const useDataStore = defineStore('data', {
|
|
|
753
800
|
addressData.push({
|
|
754
801
|
id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
|
|
755
802
|
contragentId: Number(user.id),
|
|
756
|
-
countryCode:
|
|
803
|
+
countryCode: user.registrationCountry.ids ?? undefined,
|
|
757
804
|
countryName: user.registrationCountry.nameRu ?? '',
|
|
758
|
-
stateCode:
|
|
805
|
+
stateCode: user.registrationProvince.ids ?? undefined,
|
|
759
806
|
stateName: user.registrationProvince.nameRu ?? '',
|
|
760
|
-
cityCode:
|
|
807
|
+
cityCode: user.registrationCity.code ?? undefined,
|
|
761
808
|
cityName: user.registrationCity.nameRu ?? '',
|
|
762
|
-
regionCode:
|
|
809
|
+
regionCode: user.registrationRegion.ids ?? undefined,
|
|
763
810
|
regionName: user.registrationRegion.nameRu,
|
|
764
811
|
streetName: user.registrationStreet ?? '',
|
|
765
812
|
kvartal: user.registrationQuarter,
|
|
@@ -784,8 +831,12 @@ export const useDataStore = defineStore('data', {
|
|
|
784
831
|
|
|
785
832
|
const personId = await this.api.saveContragent(data);
|
|
786
833
|
if (personId > 0) {
|
|
787
|
-
|
|
788
|
-
|
|
834
|
+
if (this.isLKA || whichForm === 'contragent') {
|
|
835
|
+
return personId;
|
|
836
|
+
} else {
|
|
837
|
+
await this.getContragentById(personId, whichForm, false, whichIndex);
|
|
838
|
+
user.otpTokenId = null;
|
|
839
|
+
}
|
|
789
840
|
} else {
|
|
790
841
|
return false;
|
|
791
842
|
}
|
|
@@ -942,9 +993,9 @@ export const useDataStore = defineStore('data', {
|
|
|
942
993
|
payPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
943
994
|
annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
|
|
944
995
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
945
|
-
?
|
|
946
|
-
:
|
|
947
|
-
paymentPeriodId:
|
|
996
|
+
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
997
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
998
|
+
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id ?? undefined,
|
|
948
999
|
lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply ?? ''),
|
|
949
1000
|
lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive ?? ''),
|
|
950
1001
|
adbMultiply: formatProcents(this.formStore.productConditionsForm.adbMultiply ?? ''),
|
|
@@ -962,9 +1013,9 @@ export const useDataStore = defineStore('data', {
|
|
|
962
1013
|
}
|
|
963
1014
|
if (this.isLiferenta) {
|
|
964
1015
|
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
965
|
-
conditionsData.policyAppDto.annuityTypeId =
|
|
1016
|
+
conditionsData.policyAppDto.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
966
1017
|
conditionsData.policyAppDto.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
967
|
-
conditionsData.policyAppDto.annuityPaymentPeriodId =
|
|
1018
|
+
conditionsData.policyAppDto.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
968
1019
|
}
|
|
969
1020
|
return conditionsData;
|
|
970
1021
|
},
|
|
@@ -984,6 +1035,8 @@ export const useDataStore = defineStore('data', {
|
|
|
984
1035
|
}
|
|
985
1036
|
},
|
|
986
1037
|
async deleteInsuredLogic() {
|
|
1038
|
+
// TODO Просмотреть
|
|
1039
|
+
if (this.isLifetrip) return;
|
|
987
1040
|
const applicationData = this.getConditionsData();
|
|
988
1041
|
const clearCovers = [{ code: 10, value: 'excluded' }];
|
|
989
1042
|
await Promise.allSettled(
|
|
@@ -1052,11 +1105,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1052
1105
|
salesChannel: this.formStore.applicationData.insisWorkDataApp.salesChannel,
|
|
1053
1106
|
salesChannelName: this.formStore.applicationData.insisWorkDataApp.salesChannelName,
|
|
1054
1107
|
insrType: this.formStore.applicationData.insisWorkDataApp.insrType,
|
|
1055
|
-
saleChanellPolicy:
|
|
1108
|
+
saleChanellPolicy: (this.formStore.SaleChanellPolicy.ids as string) ?? undefined,
|
|
1056
1109
|
saleChanellPolicyName: this.formStore.SaleChanellPolicy.nameRu ?? '',
|
|
1057
|
-
regionPolicy:
|
|
1110
|
+
regionPolicy: (this.formStore.RegionPolicy.ids as string) ?? undefined,
|
|
1058
1111
|
regionPolicyName: this.formStore.RegionPolicy.nameRu ?? '',
|
|
1059
|
-
managerPolicy:
|
|
1112
|
+
managerPolicy: this.formStore.ManagerPolicy.ids as string,
|
|
1060
1113
|
managerPolicyName: this.formStore.ManagerPolicy.nameRu ?? '',
|
|
1061
1114
|
insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
|
|
1062
1115
|
};
|
|
@@ -1090,7 +1143,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1090
1143
|
async getFromApi(whichField: string, whichRequest: string, parameter?: any, reset: boolean = false): Promise<Value[]> {
|
|
1091
1144
|
const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
|
|
1092
1145
|
const currentHour = new Date().getHours();
|
|
1093
|
-
const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / 15);
|
|
1146
|
+
const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / (this.isLKA ? 60 : 15));
|
|
1094
1147
|
|
|
1095
1148
|
const getDataCondition = () => {
|
|
1096
1149
|
if (!storageValue) return true;
|
|
@@ -1138,6 +1191,21 @@ export const useDataStore = defineStore('data', {
|
|
|
1138
1191
|
async getCountries() {
|
|
1139
1192
|
return await this.getFromApi('countries', 'getCountries');
|
|
1140
1193
|
},
|
|
1194
|
+
async getDicCountries() {
|
|
1195
|
+
if (this.isLifetrip) return await this.getFromApi('dicAllCountries', 'getArmDicts', 'DicCountry');
|
|
1196
|
+
},
|
|
1197
|
+
async getDicTripType() {
|
|
1198
|
+
if (this.isLifetrip) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
|
|
1199
|
+
},
|
|
1200
|
+
async getDicTripPurpose() {
|
|
1201
|
+
if (this.isLifetrip) return await this.getFromApi('purposes', 'getArmDicts', 'DicTripPurpose');
|
|
1202
|
+
},
|
|
1203
|
+
async getDicTripWorkType() {
|
|
1204
|
+
if (this.isLifetrip) return await this.getFromApi('workTypes', 'getArmDicts', 'DicTripWorkType');
|
|
1205
|
+
},
|
|
1206
|
+
async getDicSportsType() {
|
|
1207
|
+
if (this.isLifetrip) return await this.getFromApi('sportsTypes', 'getArmDicts', 'DicSportsType');
|
|
1208
|
+
},
|
|
1141
1209
|
async getCitizenshipCountries() {
|
|
1142
1210
|
return await this.getFromApi('citizenshipCountries', 'getCitizenshipCountries');
|
|
1143
1211
|
},
|
|
@@ -1150,15 +1218,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1150
1218
|
async getStates(key?: string, member?: Member) {
|
|
1151
1219
|
await this.getFromApi('states', 'getStates');
|
|
1152
1220
|
//@ts-ignore
|
|
1153
|
-
if (key && member[key] && member[key].ids !== null) return this.states.filter(i => i.code === member[key].ids);
|
|
1221
|
+
if (key && member[key] && member[key].ids !== null) return this.states.filter((i: Value) => i.code === member[key].ids);
|
|
1154
1222
|
return this.states;
|
|
1155
1223
|
},
|
|
1156
1224
|
async getRegions(key?: string, member?: Member) {
|
|
1157
1225
|
await this.getFromApi('regions', 'getRegions');
|
|
1158
1226
|
//@ts-ignore
|
|
1159
|
-
if (key && member[key] && member[key].ids !== null) return this.regions.filter(i => i.code === member[key].ids);
|
|
1227
|
+
if (key && member[key] && member[key].ids !== null) return this.regions.filter((i: Value) => i.code === member[key].ids);
|
|
1160
1228
|
if (member && member.registrationProvince.ids !== null) {
|
|
1161
|
-
return this.regions.filter(i => i.code === member.registrationProvince.ids);
|
|
1229
|
+
return this.regions.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1162
1230
|
} else {
|
|
1163
1231
|
return this.regions;
|
|
1164
1232
|
}
|
|
@@ -1166,13 +1234,27 @@ export const useDataStore = defineStore('data', {
|
|
|
1166
1234
|
async getCities(key?: string, member?: Member) {
|
|
1167
1235
|
await this.getFromApi('cities', 'getCities');
|
|
1168
1236
|
//@ts-ignore
|
|
1169
|
-
if (key && member[key] && member[key].ids !== null) return this.cities.filter(i => i.code === member[key].ids);
|
|
1237
|
+
if (key && member[key] && member[key].ids !== null) return this.cities.filter((i: Value) => i.code === member[key].ids);
|
|
1170
1238
|
if (member && member.registrationProvince.ids !== null) {
|
|
1171
|
-
return this.cities.filter(i => i.code === member.registrationProvince.ids);
|
|
1239
|
+
return this.cities.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1172
1240
|
} else {
|
|
1173
1241
|
return this.cities;
|
|
1174
1242
|
}
|
|
1175
1243
|
},
|
|
1244
|
+
async getCitiesEfo(key?: string, member?: PolicyholderV2, parentKey?: string) {
|
|
1245
|
+
if (this.isLifeBusiness) {
|
|
1246
|
+
await this.getFromApi('cities', 'getCities');
|
|
1247
|
+
//@ts-ignore
|
|
1248
|
+
if (key && member[parentKey][key] && member[parentKey][key].ids !== null) return this.cities.filter(i => i.code === member[parentKey][key].ids);
|
|
1249
|
+
//@ts-ignore
|
|
1250
|
+
if (member && member[parentKey].registrationProvince.ids !== null) {
|
|
1251
|
+
//@ts-ignore
|
|
1252
|
+
return this.cities.filter(i => i.code === member[parentKey].registrationProvince.ids);
|
|
1253
|
+
} else {
|
|
1254
|
+
return this.cities;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
},
|
|
1176
1258
|
async getLocalityTypes() {
|
|
1177
1259
|
return await this.getFromApi('localityTypes', 'getLocalityTypes');
|
|
1178
1260
|
},
|
|
@@ -1205,26 +1287,32 @@ export const useDataStore = defineStore('data', {
|
|
|
1205
1287
|
async getRelationTypes() {
|
|
1206
1288
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1207
1289
|
},
|
|
1208
|
-
async
|
|
1209
|
-
return await this.getFromApi('
|
|
1290
|
+
async getBanks() {
|
|
1291
|
+
if (this.isLifeBusiness) return await this.getFromApi('banks', 'getBanks');
|
|
1210
1292
|
},
|
|
1211
|
-
async
|
|
1212
|
-
|
|
1293
|
+
async getProcessIndexRate() {
|
|
1294
|
+
if (this.processCode) {
|
|
1295
|
+
return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
1296
|
+
}
|
|
1213
1297
|
},
|
|
1214
1298
|
async getProcessPaymentPeriod() {
|
|
1215
|
-
|
|
1299
|
+
if (this.processCode) {
|
|
1300
|
+
return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
|
|
1301
|
+
}
|
|
1216
1302
|
},
|
|
1217
1303
|
async getQuestionRefs(id?: string) {
|
|
1218
1304
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1219
1305
|
},
|
|
1220
1306
|
async getProcessTariff() {
|
|
1221
|
-
return await this.getFromApi('processTariff', 'getProcessTariff');
|
|
1307
|
+
if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
|
|
1222
1308
|
},
|
|
1223
1309
|
async getDicAnnuityTypeList() {
|
|
1224
1310
|
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
1225
1311
|
},
|
|
1226
1312
|
async getProcessAnnuityPaymentPeriod() {
|
|
1227
|
-
|
|
1313
|
+
if (this.processCode) {
|
|
1314
|
+
return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
|
|
1315
|
+
}
|
|
1228
1316
|
},
|
|
1229
1317
|
async getInsurancePay() {
|
|
1230
1318
|
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
@@ -1251,6 +1339,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1251
1339
|
this.getStates(),
|
|
1252
1340
|
this.getRegions(),
|
|
1253
1341
|
this.getCities(),
|
|
1342
|
+
this.getCitiesEfo(),
|
|
1254
1343
|
this.getLocalityTypes(),
|
|
1255
1344
|
this.getDocumentTypes(),
|
|
1256
1345
|
this.getDocumentIssuers(),
|
|
@@ -1267,57 +1356,55 @@ export const useDataStore = defineStore('data', {
|
|
|
1267
1356
|
this.getInsurancePay(),
|
|
1268
1357
|
this.getDictionaryItems('RegionPolicy'),
|
|
1269
1358
|
this.getDictionaryItems('SaleChanellPolicy'),
|
|
1359
|
+
this.getDicTripType(),
|
|
1360
|
+
this.getDicCountries(),
|
|
1361
|
+
this.getDicTripWorkType(),
|
|
1362
|
+
this.getDicSportsType(),
|
|
1363
|
+
this.getDicTripPurpose(),
|
|
1364
|
+
this.getCurrencies(),
|
|
1270
1365
|
]);
|
|
1271
1366
|
},
|
|
1272
1367
|
async getQuestionList(
|
|
1273
1368
|
surveyType: 'health' | 'critical',
|
|
1274
1369
|
processInstanceId: string | number,
|
|
1275
1370
|
insuredId: any,
|
|
1276
|
-
baseField:
|
|
1277
|
-
secondaryField: string,
|
|
1371
|
+
baseField: 'surveyByHealthBase' | 'surveyByCriticalBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBasePolicyholder',
|
|
1278
1372
|
whichMember: 'insured' | 'policyholder' = 'insured',
|
|
1279
1373
|
) {
|
|
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
|
-
}
|
|
1374
|
+
try {
|
|
1375
|
+
const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
|
|
1376
|
+
whichMember === 'insured' ? this.api.getQuestionList(surveyType, processInstanceId, insuredId) : this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
|
|
1377
|
+
whichMember === 'insured'
|
|
1378
|
+
? this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId)
|
|
1379
|
+
: this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
|
|
1380
|
+
,
|
|
1381
|
+
]);
|
|
1382
|
+
if (baseQuestions.status === 'fulfilled') {
|
|
1383
|
+
this.formStore[baseField] = baseQuestions.value;
|
|
1384
|
+
}
|
|
1385
|
+
if (secondaryQuestions.status === 'fulfilled') {
|
|
1386
|
+
const baseAnketa = this.formStore[baseField];
|
|
1387
|
+
if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
|
|
1388
|
+
baseAnketa.body.forEach(i => {
|
|
1389
|
+
if (i.first.definedAnswers === 'Y' && i.second === null && secondaryQuestions.value) {
|
|
1390
|
+
i.second = structuredClone(secondaryQuestions.value);
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1310
1393
|
}
|
|
1311
|
-
} catch (err) {
|
|
1312
|
-
console.log(err);
|
|
1313
1394
|
}
|
|
1395
|
+
} catch (err) {
|
|
1396
|
+
ErrorHandler(err);
|
|
1314
1397
|
}
|
|
1315
|
-
//@ts-ignore
|
|
1316
1398
|
return this.formStore[baseField];
|
|
1317
1399
|
},
|
|
1318
1400
|
getNumberWithSpaces(n: any) {
|
|
1319
1401
|
return n === null ? null : Number((typeof n === 'string' ? n : n.toFixed().toString()).replace(/[^0-9]+/g, '')).toLocaleString('ru');
|
|
1320
1402
|
},
|
|
1403
|
+
getNumberWithSpacesAfterComma(n: number) {
|
|
1404
|
+
let parts = n.toFixed(2).split('.');
|
|
1405
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
1406
|
+
return parts.join(',');
|
|
1407
|
+
},
|
|
1321
1408
|
getNumberWithDot(n: any) {
|
|
1322
1409
|
return n === null ? null : n.toLocaleString('ru', { maximumFractionDigits: 2, minimumFractionDigits: 2 }).replace(/,/g, '.');
|
|
1323
1410
|
},
|
|
@@ -1445,7 +1532,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1445
1532
|
},
|
|
1446
1533
|
findObject(from: string, key: string, searchKey: any): any {
|
|
1447
1534
|
// @ts-ignore
|
|
1448
|
-
const found = this[from].find(i => i[key] == searchKey);
|
|
1535
|
+
const found = this[from].find((i: Value) => i[key] == searchKey);
|
|
1449
1536
|
return found || new Value();
|
|
1450
1537
|
},
|
|
1451
1538
|
async searchAgentByName(name: string) {
|
|
@@ -1496,27 +1583,78 @@ export const useDataStore = defineStore('data', {
|
|
|
1496
1583
|
this.isLoading = false;
|
|
1497
1584
|
}
|
|
1498
1585
|
},
|
|
1586
|
+
async getTripInsuredAmount(show: boolean = true) {
|
|
1587
|
+
this.isLoading = true;
|
|
1588
|
+
try {
|
|
1589
|
+
const countryID: string[] = [];
|
|
1590
|
+
for (let country = 0; country < this.formStore.productConditionsForm.calculatorForm.countries!.length; country++) {
|
|
1591
|
+
countryID.push(this.formStore.productConditionsForm.calculatorForm.countries![country].id as string);
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
const form = {
|
|
1595
|
+
tripTypeID: this.formStore.productConditionsForm.calculatorForm.type.id,
|
|
1596
|
+
countryID,
|
|
1597
|
+
};
|
|
1598
|
+
|
|
1599
|
+
const result = await this.api.getTripInsuredAmount(form);
|
|
1600
|
+
const amounts: Value[] = [];
|
|
1601
|
+
result.amounts.forEach(amount => {
|
|
1602
|
+
amounts.push(new Value(amount['id'], amount['nameRu']));
|
|
1603
|
+
});
|
|
1604
|
+
|
|
1605
|
+
this.amountArray = amounts;
|
|
1606
|
+
this.formStore.productConditionsForm.calculatorForm.amount = new Value();
|
|
1607
|
+
this.currency = result.currency;
|
|
1608
|
+
|
|
1609
|
+
if (show) {
|
|
1610
|
+
this.showToaster('success', this.t('toaster.tripInsuredAmountCalculated'), 1000);
|
|
1611
|
+
}
|
|
1612
|
+
} catch (err) {
|
|
1613
|
+
ErrorHandler(err);
|
|
1614
|
+
}
|
|
1615
|
+
this.isLoading = false;
|
|
1616
|
+
},
|
|
1617
|
+
async getPeriod() {
|
|
1618
|
+
if (this.periodArray.length === 0) {
|
|
1619
|
+
try {
|
|
1620
|
+
const response = await this.api.getTripInsuranceDaysOptions();
|
|
1621
|
+
if (response) {
|
|
1622
|
+
const new3 = response.period;
|
|
1623
|
+
const newPeriod: Value[] = [];
|
|
1624
|
+
const newMaxDays: Value[] = [];
|
|
1625
|
+
Object.keys(new3).forEach(key => {
|
|
1626
|
+
newPeriod.push(new Value(key, key, key, key));
|
|
1627
|
+
new3[key as keyof typeof new3].forEach(item => {
|
|
1628
|
+
newMaxDays.push(new Value(item, item, item, key));
|
|
1629
|
+
});
|
|
1630
|
+
});
|
|
1631
|
+
this.periodArray = newPeriod;
|
|
1632
|
+
this.maxDaysAllArray = newMaxDays;
|
|
1633
|
+
}
|
|
1634
|
+
} catch (err) {
|
|
1635
|
+
ErrorHandler(err);
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1499
1639
|
async calculateWithoutApplication(showLoader: boolean = false, product: string | null = null) {
|
|
1500
1640
|
this.isLoading = showLoader;
|
|
1501
1641
|
try {
|
|
1502
|
-
if (!this.formStore.productConditionsForm.signDate
|
|
1642
|
+
if (!this.formStore.productConditionsForm.signDate) {
|
|
1503
1643
|
return;
|
|
1504
1644
|
}
|
|
1505
1645
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1506
|
-
const birthDate = formatDate(this.formStore.productConditionsForm.birthDate);
|
|
1507
|
-
if (!signDate || !birthDate) return;
|
|
1508
1646
|
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1509
|
-
signDate: signDate.toISOString(),
|
|
1510
|
-
birthDate: birthDate.toISOString(),
|
|
1647
|
+
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1648
|
+
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1511
1649
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
1512
1650
|
amount: getNumber(String(this.formStore.productConditionsForm.requestedSumInsured)),
|
|
1513
1651
|
premium: getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonth)),
|
|
1514
1652
|
coverPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
|
|
1515
1653
|
payPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
|
|
1516
1654
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
1517
|
-
?
|
|
1518
|
-
:
|
|
1519
|
-
paymentPeriodId:
|
|
1655
|
+
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
1656
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
1657
|
+
paymentPeriodId: (this.formStore.productConditionsForm.paymentPeriod.id as string) ?? undefined,
|
|
1520
1658
|
addCovers: this.formStore.additionalInsuranceTermsWithout,
|
|
1521
1659
|
};
|
|
1522
1660
|
if (this.isKazyna || product === 'halykkazyna') {
|
|
@@ -1524,11 +1662,18 @@ export const useDataStore = defineStore('data', {
|
|
|
1524
1662
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1525
1663
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1526
1664
|
}
|
|
1527
|
-
if (this.isLiferenta) {
|
|
1665
|
+
if (this.isLiferenta || product === 'liferenta') {
|
|
1528
1666
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1529
|
-
calculationData.annuityTypeId =
|
|
1667
|
+
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
1530
1668
|
calculationData.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
1531
|
-
calculationData.annuityPaymentPeriodId =
|
|
1669
|
+
calculationData.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
1670
|
+
}
|
|
1671
|
+
if (this.isLifeBusiness || product === 'lifebusiness') {
|
|
1672
|
+
calculationData.clients = this.formStore.lfb.insurers;
|
|
1673
|
+
calculationData.insrCount = this.formStore.lfb.insurers.length;
|
|
1674
|
+
calculationData.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
|
|
1675
|
+
calculationData.fixInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
|
|
1676
|
+
calculationData.agentCommission = this.formStore.productConditionsForm.processTariff.id;
|
|
1532
1677
|
}
|
|
1533
1678
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1534
1679
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
@@ -1541,9 +1686,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1541
1686
|
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
|
|
1542
1687
|
}
|
|
1543
1688
|
}
|
|
1544
|
-
if (this.isLiferenta) {
|
|
1689
|
+
if (this.isLiferenta || product === 'liferenta') {
|
|
1545
1690
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(calculationResponse.annuityMonthPay);
|
|
1546
1691
|
}
|
|
1692
|
+
if (this.isGons || product === 'gons') {
|
|
1693
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(calculationResponse.totalAmount5);
|
|
1694
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(calculationResponse.totalAmount7);
|
|
1695
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(calculationResponse.statePremium5);
|
|
1696
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
|
|
1697
|
+
}
|
|
1698
|
+
if (this.isLifeBusiness || product === 'lifebusiness') {
|
|
1699
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremium);
|
|
1700
|
+
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1701
|
+
if (calculationResponse.clients) {
|
|
1702
|
+
this.formStore.lfb.insurers = calculationResponse.clients;
|
|
1703
|
+
}
|
|
1704
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1705
|
+
return calculationResponse;
|
|
1706
|
+
}
|
|
1547
1707
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1548
1708
|
} catch (err) {
|
|
1549
1709
|
ErrorHandler(err);
|
|
@@ -1579,6 +1739,68 @@ export const useDataStore = defineStore('data', {
|
|
|
1579
1739
|
if (this.isLiferenta) {
|
|
1580
1740
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
1581
1741
|
}
|
|
1742
|
+
|
|
1743
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1744
|
+
} catch (err) {
|
|
1745
|
+
ErrorHandler(err);
|
|
1746
|
+
}
|
|
1747
|
+
this.isLoading = false;
|
|
1748
|
+
},
|
|
1749
|
+
async calculatePrice(taskId?: string) {
|
|
1750
|
+
this.isLoading = true;
|
|
1751
|
+
try {
|
|
1752
|
+
const priceForm: {
|
|
1753
|
+
processInstanceId?: string | number | null;
|
|
1754
|
+
id?: string | null;
|
|
1755
|
+
addCoversDto?: AddCover[];
|
|
1756
|
+
insuredAmountId?: string | number | null;
|
|
1757
|
+
age?: string | number | null;
|
|
1758
|
+
lifeTripCountries?: string[] | null;
|
|
1759
|
+
tripPurposeId?: string | number | null;
|
|
1760
|
+
workTypeId?: string | number | null;
|
|
1761
|
+
sportsTypeId?: string | number | null;
|
|
1762
|
+
singleTripDays?: number;
|
|
1763
|
+
multipleTripMaxDays?: number;
|
|
1764
|
+
tripInsurancePeriod?: number;
|
|
1765
|
+
startDate?: string | null;
|
|
1766
|
+
endDate?: string | null;
|
|
1767
|
+
} = {};
|
|
1768
|
+
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
1769
|
+
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
1770
|
+
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
1771
|
+
priceForm.tripPurposeId = this.formStore.productConditionsForm.calculatorForm.purpose.id;
|
|
1772
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'WorkStudy') {
|
|
1773
|
+
priceForm.workTypeId = this.formStore.productConditionsForm.calculatorForm.workType.id;
|
|
1774
|
+
}
|
|
1775
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'Sport') {
|
|
1776
|
+
priceForm.sportsTypeId = this.formStore.productConditionsForm.calculatorForm.sportsType!.id;
|
|
1777
|
+
}
|
|
1778
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
1779
|
+
priceForm.singleTripDays = Number(this.formStore.productConditionsForm.calculatorForm.days);
|
|
1780
|
+
} else {
|
|
1781
|
+
priceForm.multipleTripMaxDays = Number(this.formStore.productConditionsForm.calculatorForm.maxDays.nameRu);
|
|
1782
|
+
priceForm.tripInsurancePeriod = Number(this.formStore.productConditionsForm.calculatorForm.period.nameRu);
|
|
1783
|
+
}
|
|
1784
|
+
if (this.isTask()) {
|
|
1785
|
+
priceForm.processInstanceId = this.formStore.applicationData.processInstanceId!;
|
|
1786
|
+
priceForm.id = taskId!;
|
|
1787
|
+
priceForm.age = Number(this.formStore.policyholderForm.age);
|
|
1788
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Multiple') {
|
|
1789
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
1790
|
+
} else {
|
|
1791
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
1792
|
+
priceForm.endDate = formatDate(this.formStore.productConditionsForm.calculatorForm.endDate!)!.toISOString();
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
const result = await this.api.getCalculator(priceForm);
|
|
1796
|
+
if (this.isTask() && taskId) {
|
|
1797
|
+
await this.api.setApplication(priceForm);
|
|
1798
|
+
const applicationData = await this.api.getApplicationData(taskId);
|
|
1799
|
+
this.formStore.applicationData = applicationData;
|
|
1800
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
1801
|
+
} else {
|
|
1802
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(result)} тг`;
|
|
1803
|
+
}
|
|
1582
1804
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1583
1805
|
} catch (err) {
|
|
1584
1806
|
ErrorHandler(err);
|
|
@@ -1644,7 +1866,49 @@ export const useDataStore = defineStore('data', {
|
|
|
1644
1866
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
1645
1867
|
this.formStore.finCenterData.date = reformatDate(applicationData.finCenterData.date);
|
|
1646
1868
|
}
|
|
1869
|
+
if ('lifeTripApp' in applicationData && setProductConditions) {
|
|
1870
|
+
const tripType = this.types.find((i: Value) => i.id === applicationData.lifeTripApp.tripTypeId);
|
|
1871
|
+
this.formStore.productConditionsForm.calculatorForm.type = tripType ? tripType : new Value();
|
|
1872
|
+
|
|
1873
|
+
const countries: CountryValue[] = [];
|
|
1874
|
+
for (let i in applicationData.lifeTripApp.lifeTripCountries) {
|
|
1875
|
+
const tripCountry = this.dicAllCountries.find(country => country.id === applicationData.lifeTripApp.lifeTripCountries[i]);
|
|
1876
|
+
if (tripCountry) {
|
|
1877
|
+
countries.push(tripCountry);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
this.formStore.productConditionsForm.calculatorForm.countries = countries ? countries : [];
|
|
1647
1881
|
|
|
1882
|
+
if (this.formStore.productConditionsForm.calculatorForm.countries.length && this.formStore.productConditionsForm.calculatorForm.type.nameRu != null) {
|
|
1883
|
+
await this.getTripInsuredAmount(false);
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
const amount = this.amountArray.find((i: Value) => i.id === applicationData.lifeTripApp.insuredAmountId);
|
|
1887
|
+
this.formStore.productConditionsForm.calculatorForm.amount = amount ? amount : new Value();
|
|
1888
|
+
|
|
1889
|
+
const purpose = this.purposes.find((i: Value) => i.id === applicationData.lifeTripApp.tripPurposeId);
|
|
1890
|
+
this.formStore.productConditionsForm.calculatorForm.purpose = purpose ? purpose : new Value();
|
|
1891
|
+
|
|
1892
|
+
if (applicationData.lifeTripApp.workTypeId != null) {
|
|
1893
|
+
const work = this.workTypes.find((i: Value) => i.id === applicationData.lifeTripApp.workTypeId);
|
|
1894
|
+
this.formStore.productConditionsForm.calculatorForm.workType = work ? work : new Value();
|
|
1895
|
+
}
|
|
1896
|
+
if (applicationData.lifeTripApp.sportsTypeId != null) {
|
|
1897
|
+
const sport = this.sportsTypes.find((i: Value) => i.id === applicationData.lifeTripApp.sportsTypeId);
|
|
1898
|
+
this.formStore.productConditionsForm.calculatorForm.sportsType = sport ? sport : new Value();
|
|
1899
|
+
}
|
|
1900
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
1901
|
+
this.formStore.productConditionsForm.calculatorForm.days = Number(applicationData.lifeTripApp.singleTripDays);
|
|
1902
|
+
} else {
|
|
1903
|
+
await this.getPeriod();
|
|
1904
|
+
this.formStore.productConditionsForm.calculatorForm.maxDays = this.maxDaysAllArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.multipleTripMaxDays)!;
|
|
1905
|
+
this.formStore.productConditionsForm.calculatorForm.period = this.periodArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.tripInsurancePeriod)!;
|
|
1906
|
+
}
|
|
1907
|
+
this.formStore.productConditionsForm.calculatorForm.startDate = reformatDate(applicationData.lifeTripApp.startDate);
|
|
1908
|
+
this.formStore.productConditionsForm.calculatorForm.endDate = reformatDate(applicationData.lifeTripApp.endDate);
|
|
1909
|
+
|
|
1910
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
1911
|
+
}
|
|
1648
1912
|
if (fetchMembers) {
|
|
1649
1913
|
let allMembers = [
|
|
1650
1914
|
{
|
|
@@ -1714,7 +1978,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1714
1978
|
if (insuredData && insuredData.length) {
|
|
1715
1979
|
insuredData.forEach((each, index) => {
|
|
1716
1980
|
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
1717
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
1981
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1718
1982
|
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1719
1983
|
});
|
|
1720
1984
|
}
|
|
@@ -1722,11 +1986,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1722
1986
|
if (beneficiaryData && beneficiaryData.length) {
|
|
1723
1987
|
beneficiaryData.forEach((each, index) => {
|
|
1724
1988
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
1725
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
1989
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1726
1990
|
this.formStore.beneficiaryForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1727
1991
|
this.formStore.beneficiaryForm[index].percentageOfPayoutAmount = each.percentage;
|
|
1728
1992
|
if (this.isLiferenta || this.isBolashak) {
|
|
1729
|
-
const insurancePay = this.insurancePay.find(i => i.id == each.beneficiaryInsurancePayId);
|
|
1993
|
+
const insurancePay = this.insurancePay.find((i: Value) => i.id == each.beneficiaryInsurancePayId);
|
|
1730
1994
|
this.formStore.beneficiaryForm[index].insurancePay = insurancePay ? insurancePay : new Value();
|
|
1731
1995
|
}
|
|
1732
1996
|
});
|
|
@@ -1854,6 +2118,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1854
2118
|
return true;
|
|
1855
2119
|
} catch (err) {
|
|
1856
2120
|
this.isLoading = false;
|
|
2121
|
+
this.isButtonsLoading = false;
|
|
1857
2122
|
return ErrorHandler(err);
|
|
1858
2123
|
}
|
|
1859
2124
|
},
|
|
@@ -2070,6 +2335,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2070
2335
|
const recalculatedValue = await this.api.reCalculate(data);
|
|
2071
2336
|
if (!!recalculatedValue) {
|
|
2072
2337
|
await this.getApplicationData(taskId, false, false, false, true);
|
|
2338
|
+
if (this.isGons) {
|
|
2339
|
+
this.formStore.productConditionsForm.isRecalculated = true;
|
|
2340
|
+
}
|
|
2073
2341
|
this.showToaster(
|
|
2074
2342
|
'success',
|
|
2075
2343
|
`${this.t('toaster.successRecalculation')}. ${whichSum == 'insurancePremiumPerMonth' ? 'Страховая премия' : 'Страховая сумма'}: ${this.getNumberWithSpaces(
|
|
@@ -2111,7 +2379,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2111
2379
|
}
|
|
2112
2380
|
}
|
|
2113
2381
|
} else {
|
|
2114
|
-
if (this.formStore[localKey].some(
|
|
2382
|
+
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2115
2383
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
2116
2384
|
return false;
|
|
2117
2385
|
}
|
|
@@ -2209,8 +2477,8 @@ export const useDataStore = defineStore('data', {
|
|
|
2209
2477
|
}
|
|
2210
2478
|
if (localCheck === false) {
|
|
2211
2479
|
try {
|
|
2212
|
-
if (this.isInitiator() &&
|
|
2213
|
-
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2480
|
+
if (this.isInitiator() && this.members.beneficialOwnerApp.has) {
|
|
2481
|
+
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2214
2482
|
await Promise.allSettled(
|
|
2215
2483
|
this.formStore.applicationData.beneficialOwnerApp.map(async (member: any) => {
|
|
2216
2484
|
await this.api.deleteMember('BeneficialOwner', member.id);
|
|
@@ -2230,124 +2498,123 @@ export const useDataStore = defineStore('data', {
|
|
|
2230
2498
|
if (!anketa) return false;
|
|
2231
2499
|
const list = anketa.body;
|
|
2232
2500
|
if (!list || (list && list.length === 0)) return false;
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
if ((
|
|
2236
|
-
|
|
2501
|
+
const isAnketaValid = ref<boolean>(true);
|
|
2502
|
+
list.forEach(i => {
|
|
2503
|
+
if ((i.first.definedAnswers === 'N' && !i.first.answerText) || (i.first.definedAnswers === 'Y' && !i.first.answerName)) {
|
|
2504
|
+
isAnketaValid.value = false;
|
|
2505
|
+
return false;
|
|
2237
2506
|
}
|
|
2238
|
-
|
|
2239
|
-
|
|
2507
|
+
if (this.controls.isSecondAnketaRequired && i.first.definedAnswers === 'Y' && i.first.answerName?.match(new RegExp('Да', 'i'))) {
|
|
2508
|
+
if (i.second && i.second.length) {
|
|
2509
|
+
const isValid = i.second.every(second => (second.definedAnswers === 'N' ? !!second.answerText : !!second.answerName));
|
|
2510
|
+
if (!isValid) {
|
|
2511
|
+
isAnketaValid.value = false;
|
|
2512
|
+
this.showToaster('info', this.t('toaster.emptySecondAnketa', { text: i.first.name }), 5000);
|
|
2513
|
+
return false;
|
|
2514
|
+
}
|
|
2515
|
+
} else {
|
|
2516
|
+
// TODO уточнить
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
});
|
|
2520
|
+
return isAnketaValid.value;
|
|
2240
2521
|
},
|
|
2241
2522
|
async validateAllForms(taskId: string) {
|
|
2242
2523
|
this.isLoading = true;
|
|
2243
2524
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
2244
2525
|
if (areMembersValid) {
|
|
2245
2526
|
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
|
-
}
|
|
2527
|
+
if (this.controls.hasAnketa) {
|
|
2528
|
+
const hasCritical =
|
|
2529
|
+
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
2530
|
+
if (hasCritical === null || (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')))) {
|
|
2531
|
+
await Promise.allSettled([
|
|
2532
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
2533
|
+
this.isClientAnketaCondition &&
|
|
2534
|
+
this.getQuestionList(
|
|
2535
|
+
'health',
|
|
2536
|
+
this.formStore.applicationData.processInstanceId,
|
|
2537
|
+
this.formStore.applicationData.clientApp.id,
|
|
2538
|
+
'surveyByHealthBasePolicyholder',
|
|
2539
|
+
'policyholder',
|
|
2540
|
+
),
|
|
2541
|
+
,
|
|
2542
|
+
]);
|
|
2543
|
+
this.isClientAnketaCondition
|
|
2544
|
+
? await Promise.allSettled([
|
|
2545
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2546
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2547
|
+
}),
|
|
2548
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2549
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2550
|
+
}),
|
|
2551
|
+
])
|
|
2552
|
+
: await Promise.allSettled(
|
|
2553
|
+
this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2554
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2555
|
+
}),
|
|
2556
|
+
);
|
|
2337
2557
|
} else {
|
|
2338
|
-
|
|
2558
|
+
await Promise.allSettled([
|
|
2559
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
2560
|
+
this.getQuestionList('critical', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByCriticalBase'),
|
|
2561
|
+
this.isClientAnketaCondition &&
|
|
2562
|
+
this.getQuestionList(
|
|
2563
|
+
'health',
|
|
2564
|
+
this.formStore.applicationData.processInstanceId,
|
|
2565
|
+
this.formStore.applicationData.clientApp.id,
|
|
2566
|
+
'surveyByHealthBasePolicyholder',
|
|
2567
|
+
'policyholder',
|
|
2568
|
+
),
|
|
2569
|
+
]);
|
|
2570
|
+
this.isClientAnketaCondition
|
|
2571
|
+
? await Promise.allSettled([
|
|
2572
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2573
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2574
|
+
}),
|
|
2575
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2576
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2577
|
+
}),
|
|
2578
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2579
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2580
|
+
}),
|
|
2581
|
+
])
|
|
2582
|
+
: await Promise.allSettled([
|
|
2583
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2584
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2585
|
+
}),
|
|
2586
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2587
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2588
|
+
}),
|
|
2589
|
+
]);
|
|
2339
2590
|
}
|
|
2340
|
-
if (
|
|
2341
|
-
|
|
2342
|
-
|
|
2591
|
+
if (this.validateAnketa('surveyByHealthBase')) {
|
|
2592
|
+
let hasCriticalAndItsValid = null;
|
|
2593
|
+
if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')) === null) {
|
|
2594
|
+
if (this.validateAnketa('surveyByCriticalBase')) {
|
|
2595
|
+
hasCriticalAndItsValid = true;
|
|
2596
|
+
} else {
|
|
2597
|
+
hasCriticalAndItsValid = false;
|
|
2598
|
+
this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
|
|
2599
|
+
}
|
|
2600
|
+
} else {
|
|
2601
|
+
hasCriticalAndItsValid = null;
|
|
2602
|
+
}
|
|
2603
|
+
if (hasCriticalAndItsValid === true || hasCriticalAndItsValid === null) {
|
|
2604
|
+
if (this.isClientAnketaCondition && this.validateAnketa('surveyByHealthBasePolicyholder') === false) {
|
|
2605
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketaPolicyholder'), 3000);
|
|
2606
|
+
this.isLoading = false;
|
|
2607
|
+
return false;
|
|
2608
|
+
}
|
|
2343
2609
|
this.isLoading = false;
|
|
2344
|
-
return
|
|
2610
|
+
return true;
|
|
2345
2611
|
}
|
|
2346
|
-
|
|
2347
|
-
|
|
2612
|
+
} else {
|
|
2613
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketa'), 3000);
|
|
2348
2614
|
}
|
|
2349
2615
|
} else {
|
|
2350
|
-
this.
|
|
2616
|
+
this.isLoading = false;
|
|
2617
|
+
return true;
|
|
2351
2618
|
}
|
|
2352
2619
|
} else {
|
|
2353
2620
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
@@ -2405,6 +2672,32 @@ export const useDataStore = defineStore('data', {
|
|
|
2405
2672
|
this.isLoading = false;
|
|
2406
2673
|
}
|
|
2407
2674
|
},
|
|
2675
|
+
async getKgd(iin: string) {
|
|
2676
|
+
try {
|
|
2677
|
+
const data = {
|
|
2678
|
+
iinBin: iin.replace(/-/g, ''),
|
|
2679
|
+
};
|
|
2680
|
+
const kgdResponse = await this.api.getKgd(data);
|
|
2681
|
+
return kgdResponse;
|
|
2682
|
+
} catch (err) {
|
|
2683
|
+
return ErrorHandler(err);
|
|
2684
|
+
}
|
|
2685
|
+
},
|
|
2686
|
+
async getGbdUl(bin: string) {
|
|
2687
|
+
if (!this.accessToken) return null;
|
|
2688
|
+
try {
|
|
2689
|
+
const decoded = jwtDecode(this.accessToken);
|
|
2690
|
+
const data = {
|
|
2691
|
+
userName: decoded.code,
|
|
2692
|
+
branchName: decoded.branchCode,
|
|
2693
|
+
bin: bin.replace(/-/g, ''),
|
|
2694
|
+
};
|
|
2695
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
2696
|
+
return gbdulResponse;
|
|
2697
|
+
} catch (err) {
|
|
2698
|
+
return ErrorHandler(err);
|
|
2699
|
+
}
|
|
2700
|
+
},
|
|
2408
2701
|
async getContragentFromGBDFL(member: Member) {
|
|
2409
2702
|
// null - ожидание
|
|
2410
2703
|
// false - ошибка или неправильно
|
|
@@ -2436,6 +2729,20 @@ export const useDataStore = defineStore('data', {
|
|
|
2436
2729
|
this.isLoading = false;
|
|
2437
2730
|
return false;
|
|
2438
2731
|
}
|
|
2732
|
+
if (!gbdResponse.content) {
|
|
2733
|
+
let errMsg: string = '';
|
|
2734
|
+
if (gbdResponse.status) {
|
|
2735
|
+
errMsg += gbdResponse.status;
|
|
2736
|
+
}
|
|
2737
|
+
if (gbdResponse.statusName) {
|
|
2738
|
+
errMsg += gbdResponse.statusName;
|
|
2739
|
+
}
|
|
2740
|
+
if (!!errMsg) {
|
|
2741
|
+
this.showToaster('error', errMsg, 5000);
|
|
2742
|
+
}
|
|
2743
|
+
this.isLoading = false;
|
|
2744
|
+
return false;
|
|
2745
|
+
}
|
|
2439
2746
|
const { person } = parseXML(gbdResponse.content, true, 'person');
|
|
2440
2747
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
2441
2748
|
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
@@ -2457,11 +2764,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2457
2764
|
member.firstName = person.name;
|
|
2458
2765
|
member.lastName = person.surname;
|
|
2459
2766
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
2767
|
+
if (this.isLifetrip) {
|
|
2768
|
+
member.firstNameLat = person.engFirstName ? person.engFirstName : '';
|
|
2769
|
+
member.lastNameLat = person.engSurname ? person.engSurname : '';
|
|
2770
|
+
}
|
|
2460
2771
|
member.longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
|
|
2461
2772
|
member.birthDate = reformatDate(person.birthDate);
|
|
2462
2773
|
member.genderName = person.gender.nameRu;
|
|
2463
2774
|
|
|
2464
|
-
const gender = this.gender.find(i => i.id == person.gender.code);
|
|
2775
|
+
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
2465
2776
|
if (gender) member.gender = gender;
|
|
2466
2777
|
|
|
2467
2778
|
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
@@ -2544,7 +2855,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2544
2855
|
if ('length' in person.documents.document) {
|
|
2545
2856
|
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
2857
|
if (validDocument) {
|
|
2547
|
-
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2858
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === '1UDL');
|
|
2548
2859
|
if (documentType) member.documentType = documentType;
|
|
2549
2860
|
|
|
2550
2861
|
member.documentNumber = validDocument.number;
|
|
@@ -2558,7 +2869,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2558
2869
|
} else {
|
|
2559
2870
|
const documentType =
|
|
2560
2871
|
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2561
|
-
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2872
|
+
? this.documentTypes.find((i: Value) => i.ids === '1UDL')
|
|
2562
2873
|
: this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2563
2874
|
? this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2564
2875
|
: new Value();
|
|
@@ -2577,9 +2888,18 @@ export const useDataStore = defineStore('data', {
|
|
|
2577
2888
|
const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
|
|
2578
2889
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2579
2890
|
}
|
|
2580
|
-
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2891
|
+
const economySectorCode = this.economySectorCode.find((i: Value) => i.ids === '500003.9');
|
|
2581
2892
|
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
2582
2893
|
},
|
|
2894
|
+
async checkIIN(iin: number) {
|
|
2895
|
+
try {
|
|
2896
|
+
const response = await this.api.checkIIN(iin);
|
|
2897
|
+
return response;
|
|
2898
|
+
} catch (err) {
|
|
2899
|
+
ErrorHandler(err);
|
|
2900
|
+
return null;
|
|
2901
|
+
}
|
|
2902
|
+
},
|
|
2583
2903
|
async isCourseChanged(processInstanceId: string) {
|
|
2584
2904
|
try {
|
|
2585
2905
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -2589,6 +2909,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2589
2909
|
}
|
|
2590
2910
|
},
|
|
2591
2911
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
2912
|
+
if (this.isLifetrip) return false;
|
|
2592
2913
|
switch (whichForm) {
|
|
2593
2914
|
case this.formStore.beneficiaryFormKey:
|
|
2594
2915
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -2629,8 +2950,22 @@ export const useDataStore = defineStore('data', {
|
|
|
2629
2950
|
hasPercentageOfPayoutAmount() {
|
|
2630
2951
|
return true;
|
|
2631
2952
|
},
|
|
2632
|
-
|
|
2633
|
-
return
|
|
2953
|
+
hasAccess() {
|
|
2954
|
+
return {
|
|
2955
|
+
invoiceInfo: this.isAdmin(),
|
|
2956
|
+
toLKA: this.isAgent() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn(),
|
|
2957
|
+
toAML: this.isCompliance() || this.isAdmin() || this.isSupport() || this.isAnalyst(),
|
|
2958
|
+
toEFO:
|
|
2959
|
+
this.isInitiator() ||
|
|
2960
|
+
this.isUnderwriter() ||
|
|
2961
|
+
this.isAdmin() ||
|
|
2962
|
+
this.isCompliance() ||
|
|
2963
|
+
this.isAnalyst() ||
|
|
2964
|
+
this.isUpk() ||
|
|
2965
|
+
this.isFinCenter() ||
|
|
2966
|
+
this.isSupervisor() ||
|
|
2967
|
+
this.isSupport(),
|
|
2968
|
+
};
|
|
2634
2969
|
},
|
|
2635
2970
|
},
|
|
2636
2971
|
});
|