hl-core 0.0.9-beta.16 → 0.0.9-beta.17
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 +62 -2
- package/api/index.ts +1 -2
- package/api/interceptors.ts +29 -0
- package/components/Form/ProductConditionsBlock.vue +59 -6
- package/components/Input/PanelInput.vue +5 -1
- package/components/Pages/MemberForm.vue +164 -23
- package/components/Pages/ProductConditions.vue +520 -108
- package/components/Panel/PanelHandler.vue +12 -0
- package/components/Panel/PanelSelectItem.vue +17 -2
- package/composables/classes.ts +253 -0
- package/composables/constants.ts +37 -0
- package/composables/index.ts +13 -3
- package/locales/ru.json +64 -11
- package/package.json +1 -1
- package/store/data.store.ts +395 -111
- package/store/form.store.ts +11 -1
- package/store/member.store.ts +1 -1
- package/store/rules.ts +25 -0
- package/types/index.ts +94 -5
- package/api/efo.api.ts +0 -27
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';
|
|
@@ -441,9 +441,9 @@ export const useDataStore = defineStore('data', {
|
|
|
441
441
|
member.verifyDate = user.personalData.verifyDate;
|
|
442
442
|
member.iin = reformatIin(user.personalData.iin);
|
|
443
443
|
member.age = String(user.personalData.age);
|
|
444
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
444
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
445
445
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
446
|
-
const gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
|
|
446
|
+
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
447
447
|
member.gender = gender ? gender : new Value();
|
|
448
448
|
member.gender.id = user.personalData.gender;
|
|
449
449
|
member.birthDate = reformatDate(user.personalData.birthDate);
|
|
@@ -465,8 +465,8 @@ export const useDataStore = defineStore('data', {
|
|
|
465
465
|
return user.documents.find(i => i.type === '1UDL');
|
|
466
466
|
})();
|
|
467
467
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
468
|
-
const documentType = this.documentTypes.find(i => i.ids === userDocument.type);
|
|
469
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu === userDocument.issuerNameRu);
|
|
468
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
469
|
+
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
470
470
|
member.documentType = documentType ? documentType : new Value();
|
|
471
471
|
member.documentNumber = userDocument.number;
|
|
472
472
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
@@ -478,16 +478,22 @@ export const useDataStore = defineStore('data', {
|
|
|
478
478
|
user.data.forEach(questData => {
|
|
479
479
|
this.searchFromList(member, questData);
|
|
480
480
|
});
|
|
481
|
+
if (this.isLifetrip) {
|
|
482
|
+
const lastNameLat = user.data.find(obj => obj.questId === '500147');
|
|
483
|
+
const firstNameLat = user.data.find(obj => obj.questId === '500148');
|
|
484
|
+
member.lastNameLat = lastNameLat ? (lastNameLat.questAnswer as string) : null;
|
|
485
|
+
member.firstNameLat = firstNameLat ? (firstNameLat.questAnswer as string) : null;
|
|
486
|
+
}
|
|
481
487
|
}
|
|
482
488
|
if ('address' in user && user.address && user.address.length) {
|
|
483
489
|
const userAddress = user.address[0];
|
|
484
490
|
const countryName = userAddress.countryName;
|
|
485
491
|
if (countryName) {
|
|
486
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(countryName, 'i')));
|
|
492
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(countryName, 'i')));
|
|
487
493
|
member.registrationCountry = country ? country : new Value();
|
|
488
494
|
}
|
|
489
|
-
const province = this.states.find(i => i.ids === userAddress.stateCode);
|
|
490
|
-
const localityType = this.localityTypes.find(i => i.nameRu === userAddress.cityTypeName);
|
|
495
|
+
const province = this.states.find((i: Value) => i.ids === userAddress.stateCode);
|
|
496
|
+
const localityType = this.localityTypes.find((i: Value) => i.nameRu === userAddress.cityTypeName);
|
|
491
497
|
const city = this.cities.find(i => !!userAddress.cityName && i.nameRu === userAddress.cityName.replace('г.', ''));
|
|
492
498
|
const region = this.regions.find(i => !!userAddress.regionCode && i.ids == userAddress.regionCode);
|
|
493
499
|
member.registrationStreet = userAddress.streetName;
|
|
@@ -537,7 +543,7 @@ export const useDataStore = defineStore('data', {
|
|
|
537
543
|
};
|
|
538
544
|
const qData = getQuestionariesData();
|
|
539
545
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
540
|
-
const qResult = qData.from.find(i => i.ids === searchIt.questAnswer);
|
|
546
|
+
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
541
547
|
//@ts-ignore
|
|
542
548
|
member[qData.field] = qResult ? qResult : new Value();
|
|
543
549
|
}
|
|
@@ -693,6 +699,26 @@ export const useDataStore = defineStore('data', {
|
|
|
693
699
|
});
|
|
694
700
|
}
|
|
695
701
|
}
|
|
702
|
+
if (this.isLifetrip) {
|
|
703
|
+
const lastNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500147') : undefined;
|
|
704
|
+
const firstNameLat = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '500148') : undefined;
|
|
705
|
+
questionariesData.push({
|
|
706
|
+
id: lastNameLat ? lastNameLat.id : 0,
|
|
707
|
+
contragentId: Number(user.id),
|
|
708
|
+
questAnswer: user.lastNameLat ?? '',
|
|
709
|
+
questAnswerName: null,
|
|
710
|
+
questName: 'Фамилия на латинице',
|
|
711
|
+
questId: '500147',
|
|
712
|
+
});
|
|
713
|
+
questionariesData.push({
|
|
714
|
+
id: firstNameLat ? firstNameLat.id : 0,
|
|
715
|
+
contragentId: Number(user.id),
|
|
716
|
+
questAnswer: user.firstNameLat ?? '',
|
|
717
|
+
questAnswerName: null,
|
|
718
|
+
questName: 'Имя на латинице',
|
|
719
|
+
questId: '500148',
|
|
720
|
+
});
|
|
721
|
+
}
|
|
696
722
|
|
|
697
723
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
698
724
|
const contactsData: ContragentContacts[] = [];
|
|
@@ -960,7 +986,7 @@ export const useDataStore = defineStore('data', {
|
|
|
960
986
|
annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
|
|
961
987
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
962
988
|
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
963
|
-
: this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
|
|
989
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
964
990
|
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id ?? undefined,
|
|
965
991
|
lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply ?? ''),
|
|
966
992
|
lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive ?? ''),
|
|
@@ -1001,6 +1027,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1001
1027
|
}
|
|
1002
1028
|
},
|
|
1003
1029
|
async deleteInsuredLogic() {
|
|
1030
|
+
// TODO Просмотреть
|
|
1031
|
+
if (this.isLifetrip) return;
|
|
1004
1032
|
const applicationData = this.getConditionsData();
|
|
1005
1033
|
const clearCovers = [{ code: 10, value: 'excluded' }];
|
|
1006
1034
|
await Promise.allSettled(
|
|
@@ -1155,6 +1183,21 @@ export const useDataStore = defineStore('data', {
|
|
|
1155
1183
|
async getCountries() {
|
|
1156
1184
|
return await this.getFromApi('countries', 'getCountries');
|
|
1157
1185
|
},
|
|
1186
|
+
async getDicCountries() {
|
|
1187
|
+
if (this.isLifetrip) return await this.getFromApi('dicAllCountries', 'getArmDicts', 'DicCountry');
|
|
1188
|
+
},
|
|
1189
|
+
async getDicTripType() {
|
|
1190
|
+
if (this.isLifetrip) return await this.getFromApi('types', 'getArmDicts', 'DicTripType');
|
|
1191
|
+
},
|
|
1192
|
+
async getDicTripPurpose() {
|
|
1193
|
+
if (this.isLifetrip) return await this.getFromApi('purposes', 'getArmDicts', 'DicTripPurpose');
|
|
1194
|
+
},
|
|
1195
|
+
async getDicTripWorkType() {
|
|
1196
|
+
if (this.isLifetrip) return await this.getFromApi('workTypes', 'getArmDicts', 'DicTripWorkType');
|
|
1197
|
+
},
|
|
1198
|
+
async getDicSportsType() {
|
|
1199
|
+
if (this.isLifetrip) return await this.getFromApi('sportsTypes', 'getArmDicts', 'DicSportsType');
|
|
1200
|
+
},
|
|
1158
1201
|
async getCitizenshipCountries() {
|
|
1159
1202
|
return await this.getFromApi('citizenshipCountries', 'getCitizenshipCountries');
|
|
1160
1203
|
},
|
|
@@ -1167,15 +1210,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1167
1210
|
async getStates(key?: string, member?: Member) {
|
|
1168
1211
|
await this.getFromApi('states', 'getStates');
|
|
1169
1212
|
//@ts-ignore
|
|
1170
|
-
if (key && member[key] && member[key].ids !== null) return this.states.filter(i => i.code === member[key].ids);
|
|
1213
|
+
if (key && member[key] && member[key].ids !== null) return this.states.filter((i: Value) => i.code === member[key].ids);
|
|
1171
1214
|
return this.states;
|
|
1172
1215
|
},
|
|
1173
1216
|
async getRegions(key?: string, member?: Member) {
|
|
1174
1217
|
await this.getFromApi('regions', 'getRegions');
|
|
1175
1218
|
//@ts-ignore
|
|
1176
|
-
if (key && member[key] && member[key].ids !== null) return this.regions.filter(i => i.code === member[key].ids);
|
|
1219
|
+
if (key && member[key] && member[key].ids !== null) return this.regions.filter((i: Value) => i.code === member[key].ids);
|
|
1177
1220
|
if (member && member.registrationProvince.ids !== null) {
|
|
1178
|
-
return this.regions.filter(i => i.code === member.registrationProvince.ids);
|
|
1221
|
+
return this.regions.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1179
1222
|
} else {
|
|
1180
1223
|
return this.regions;
|
|
1181
1224
|
}
|
|
@@ -1183,13 +1226,27 @@ export const useDataStore = defineStore('data', {
|
|
|
1183
1226
|
async getCities(key?: string, member?: Member) {
|
|
1184
1227
|
await this.getFromApi('cities', 'getCities');
|
|
1185
1228
|
//@ts-ignore
|
|
1186
|
-
if (key && member[key] && member[key].ids !== null) return this.cities.filter(i => i.code === member[key].ids);
|
|
1229
|
+
if (key && member[key] && member[key].ids !== null) return this.cities.filter((i: Value) => i.code === member[key].ids);
|
|
1187
1230
|
if (member && member.registrationProvince.ids !== null) {
|
|
1188
|
-
return this.cities.filter(i => i.code === member.registrationProvince.ids);
|
|
1231
|
+
return this.cities.filter((i: Value) => i.code === member.registrationProvince.ids);
|
|
1189
1232
|
} else {
|
|
1190
1233
|
return this.cities;
|
|
1191
1234
|
}
|
|
1192
1235
|
},
|
|
1236
|
+
async getCitiesEfo(key?: string, member?: PolicyholderV2, parentKey?: string) {
|
|
1237
|
+
if (this.isLifeBusiness) {
|
|
1238
|
+
await this.getFromApi('cities', 'getCities');
|
|
1239
|
+
//@ts-ignore
|
|
1240
|
+
if (key && member[parentKey][key] && member[parentKey][key].ids !== null) return this.cities.filter(i => i.code === member[parentKey][key].ids);
|
|
1241
|
+
//@ts-ignore
|
|
1242
|
+
if (member && member[parentKey].registrationProvince.ids !== null) {
|
|
1243
|
+
//@ts-ignore
|
|
1244
|
+
return this.cities.filter(i => i.code === member[parentKey].registrationProvince.ids);
|
|
1245
|
+
} else {
|
|
1246
|
+
return this.cities;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1193
1250
|
async getLocalityTypes() {
|
|
1194
1251
|
return await this.getFromApi('localityTypes', 'getLocalityTypes');
|
|
1195
1252
|
},
|
|
@@ -1222,6 +1279,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1222
1279
|
async getRelationTypes() {
|
|
1223
1280
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1224
1281
|
},
|
|
1282
|
+
async getBanks() {
|
|
1283
|
+
if (this.isLifeBusiness) return await this.getFromApi('banks', 'getBanks');
|
|
1284
|
+
},
|
|
1225
1285
|
async getProcessIndexRate() {
|
|
1226
1286
|
if (this.processCode) {
|
|
1227
1287
|
return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
@@ -1236,7 +1296,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1236
1296
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1237
1297
|
},
|
|
1238
1298
|
async getProcessTariff() {
|
|
1239
|
-
return await this.getFromApi('processTariff', 'getProcessTariff');
|
|
1299
|
+
return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
|
|
1240
1300
|
},
|
|
1241
1301
|
async getDicAnnuityTypeList() {
|
|
1242
1302
|
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
@@ -1271,6 +1331,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1271
1331
|
this.getStates(),
|
|
1272
1332
|
this.getRegions(),
|
|
1273
1333
|
this.getCities(),
|
|
1334
|
+
this.getCitiesEfo(),
|
|
1274
1335
|
this.getLocalityTypes(),
|
|
1275
1336
|
this.getDocumentTypes(),
|
|
1276
1337
|
this.getDocumentIssuers(),
|
|
@@ -1287,6 +1348,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1287
1348
|
this.getInsurancePay(),
|
|
1288
1349
|
this.getDictionaryItems('RegionPolicy'),
|
|
1289
1350
|
this.getDictionaryItems('SaleChanellPolicy'),
|
|
1351
|
+
this.getDicTripType(),
|
|
1352
|
+
this.getDicCountries(),
|
|
1353
|
+
this.getDicTripWorkType(),
|
|
1354
|
+
this.getDicSportsType(),
|
|
1355
|
+
this.getDicTripPurpose(),
|
|
1356
|
+
this.getCurrencies(),
|
|
1290
1357
|
]);
|
|
1291
1358
|
},
|
|
1292
1359
|
async getQuestionList(
|
|
@@ -1457,7 +1524,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1457
1524
|
},
|
|
1458
1525
|
findObject(from: string, key: string, searchKey: any): any {
|
|
1459
1526
|
// @ts-ignore
|
|
1460
|
-
const found = this[from].find(i => i[key] == searchKey);
|
|
1527
|
+
const found = this[from].find((i: Value) => i[key] == searchKey);
|
|
1461
1528
|
return found || new Value();
|
|
1462
1529
|
},
|
|
1463
1530
|
async searchAgentByName(name: string) {
|
|
@@ -1508,18 +1575,69 @@ export const useDataStore = defineStore('data', {
|
|
|
1508
1575
|
this.isLoading = false;
|
|
1509
1576
|
}
|
|
1510
1577
|
},
|
|
1578
|
+
async getTripInsuredAmount(show: boolean = true) {
|
|
1579
|
+
this.isLoading = true;
|
|
1580
|
+
try {
|
|
1581
|
+
const countryID: string[] = [];
|
|
1582
|
+
for (let country = 0; country < this.formStore.productConditionsForm.calculatorForm.countries!.length; country++) {
|
|
1583
|
+
countryID.push(this.formStore.productConditionsForm.calculatorForm.countries![country].id as string);
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
const form = {
|
|
1587
|
+
tripTypeID: this.formStore.productConditionsForm.calculatorForm.type.id,
|
|
1588
|
+
countryID,
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
const result = await this.api.getTripInsuredAmount(form);
|
|
1592
|
+
const amounts: Value[] = [];
|
|
1593
|
+
result.amounts.forEach(amount => {
|
|
1594
|
+
amounts.push(new Value(amount['id'], amount['nameRu']));
|
|
1595
|
+
});
|
|
1596
|
+
|
|
1597
|
+
this.amountArray = amounts;
|
|
1598
|
+
this.formStore.productConditionsForm.calculatorForm.amount = new Value();
|
|
1599
|
+
this.currency = result.currency;
|
|
1600
|
+
|
|
1601
|
+
if (show) {
|
|
1602
|
+
this.showToaster('success', this.t('toaster.tripInsuredAmountCalculated'), 1000);
|
|
1603
|
+
}
|
|
1604
|
+
} catch (err) {
|
|
1605
|
+
ErrorHandler(err);
|
|
1606
|
+
}
|
|
1607
|
+
this.isLoading = false;
|
|
1608
|
+
},
|
|
1609
|
+
async getPeriod() {
|
|
1610
|
+
if (this.periodArray.length === 0) {
|
|
1611
|
+
try {
|
|
1612
|
+
const response = await this.api.getTripInsuranceDaysOptions();
|
|
1613
|
+
if (response) {
|
|
1614
|
+
const new3 = response.period;
|
|
1615
|
+
const newPeriod: Value[] = [];
|
|
1616
|
+
const newMaxDays: Value[] = [];
|
|
1617
|
+
Object.keys(new3).forEach(key => {
|
|
1618
|
+
newPeriod.push(new Value(key, key, key, key));
|
|
1619
|
+
new3[key as keyof typeof new3].forEach(item => {
|
|
1620
|
+
newMaxDays.push(new Value(item, item, item, key));
|
|
1621
|
+
});
|
|
1622
|
+
});
|
|
1623
|
+
this.periodArray = newPeriod;
|
|
1624
|
+
this.maxDaysAllArray = newMaxDays;
|
|
1625
|
+
}
|
|
1626
|
+
} catch (err) {
|
|
1627
|
+
ErrorHandler(err);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
},
|
|
1511
1631
|
async calculateWithoutApplication(showLoader: boolean = false, product: string | null = null) {
|
|
1512
1632
|
this.isLoading = showLoader;
|
|
1513
1633
|
try {
|
|
1514
|
-
if (!this.formStore.productConditionsForm.signDate
|
|
1634
|
+
if (!this.formStore.productConditionsForm.signDate) {
|
|
1515
1635
|
return;
|
|
1516
1636
|
}
|
|
1517
1637
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1518
|
-
const birthDate = formatDate(this.formStore.productConditionsForm.birthDate);
|
|
1519
|
-
if (!signDate || !birthDate) return;
|
|
1520
1638
|
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1521
|
-
signDate: signDate.toISOString(),
|
|
1522
|
-
birthDate: birthDate.toISOString(),
|
|
1639
|
+
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1640
|
+
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1523
1641
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
1524
1642
|
amount: getNumber(String(this.formStore.productConditionsForm.requestedSumInsured)),
|
|
1525
1643
|
premium: getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonth)),
|
|
@@ -1527,7 +1645,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1527
1645
|
payPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
|
|
1528
1646
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
1529
1647
|
? this.formStore.productConditionsForm.processIndexRate.id ?? undefined
|
|
1530
|
-
: this.processIndexRate.find(i => i.code === '0')?.id ?? undefined,
|
|
1648
|
+
: this.processIndexRate.find((i: Value) => i.code === '0')?.id ?? undefined,
|
|
1531
1649
|
paymentPeriodId: (this.formStore.productConditionsForm.paymentPeriod.id as string) ?? undefined,
|
|
1532
1650
|
addCovers: this.formStore.additionalInsuranceTermsWithout,
|
|
1533
1651
|
};
|
|
@@ -1542,6 +1660,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1542
1660
|
calculationData.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
1543
1661
|
calculationData.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
1544
1662
|
}
|
|
1663
|
+
if (this.isLifeBusiness || product === 'lifebusiness') {
|
|
1664
|
+
calculationData.clients = this.formStore.lfb.insurers;
|
|
1665
|
+
calculationData.insrCount = this.formStore.lfb.insurers.length;
|
|
1666
|
+
calculationData.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
|
|
1667
|
+
calculationData.fixInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
|
|
1668
|
+
calculationData.agentCommission = this.formStore.productConditionsForm.processTariff.id;
|
|
1669
|
+
}
|
|
1545
1670
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1546
1671
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
1547
1672
|
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
|
|
@@ -1562,6 +1687,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1562
1687
|
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(calculationResponse.statePremium5);
|
|
1563
1688
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
|
|
1564
1689
|
}
|
|
1690
|
+
if (this.isLifeBusiness || product === 'lifebusiness') {
|
|
1691
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremium);
|
|
1692
|
+
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1693
|
+
if (calculationResponse.clients) {
|
|
1694
|
+
this.formStore.lfb.insurers = calculationResponse.clients;
|
|
1695
|
+
}
|
|
1696
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1697
|
+
return calculationResponse;
|
|
1698
|
+
}
|
|
1565
1699
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1566
1700
|
} catch (err) {
|
|
1567
1701
|
ErrorHandler(err);
|
|
@@ -1604,6 +1738,67 @@ export const useDataStore = defineStore('data', {
|
|
|
1604
1738
|
}
|
|
1605
1739
|
this.isLoading = false;
|
|
1606
1740
|
},
|
|
1741
|
+
async calculatePrice(taskId?: string) {
|
|
1742
|
+
this.isLoading = true;
|
|
1743
|
+
try {
|
|
1744
|
+
const priceForm: {
|
|
1745
|
+
processInstanceId?: string | number | null;
|
|
1746
|
+
id?: string | null;
|
|
1747
|
+
addCoversDto?: AddCover[];
|
|
1748
|
+
insuredAmountId?: string | number | null;
|
|
1749
|
+
age?: string | number | null;
|
|
1750
|
+
lifeTripCountries?: string[] | null;
|
|
1751
|
+
tripPurposeId?: string | number | null;
|
|
1752
|
+
workTypeId?: string | number | null;
|
|
1753
|
+
sportsTypeId?: string | number | null;
|
|
1754
|
+
singleTripDays?: number;
|
|
1755
|
+
multipleTripMaxDays?: number;
|
|
1756
|
+
tripInsurancePeriod?: number;
|
|
1757
|
+
startDate?: string | null;
|
|
1758
|
+
endDate?: string | null;
|
|
1759
|
+
} = {};
|
|
1760
|
+
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
1761
|
+
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
1762
|
+
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
1763
|
+
priceForm.tripPurposeId = this.formStore.productConditionsForm.calculatorForm.purpose.id;
|
|
1764
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'WorkStudy') {
|
|
1765
|
+
priceForm.workTypeId = this.formStore.productConditionsForm.calculatorForm.workType.id;
|
|
1766
|
+
}
|
|
1767
|
+
if (this.formStore.productConditionsForm.calculatorForm.purpose.code === 'Sport') {
|
|
1768
|
+
priceForm.sportsTypeId = this.formStore.productConditionsForm.calculatorForm.sportsType!.id;
|
|
1769
|
+
}
|
|
1770
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
1771
|
+
priceForm.singleTripDays = Number(this.formStore.productConditionsForm.calculatorForm.days);
|
|
1772
|
+
} else {
|
|
1773
|
+
priceForm.multipleTripMaxDays = Number(this.formStore.productConditionsForm.calculatorForm.maxDays.nameRu);
|
|
1774
|
+
priceForm.tripInsurancePeriod = Number(this.formStore.productConditionsForm.calculatorForm.period.nameRu);
|
|
1775
|
+
}
|
|
1776
|
+
if (this.isTask()) {
|
|
1777
|
+
priceForm.processInstanceId = this.formStore.applicationData.processInstanceId!;
|
|
1778
|
+
priceForm.id = taskId!;
|
|
1779
|
+
priceForm.age = Number(this.formStore.policyholderForm.age);
|
|
1780
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Multiple') {
|
|
1781
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
1782
|
+
} else {
|
|
1783
|
+
priceForm.startDate = formatDate(this.formStore.productConditionsForm.calculatorForm.startDate!)!.toISOString();
|
|
1784
|
+
priceForm.endDate = formatDate(this.formStore.productConditionsForm.calculatorForm.endDate!)!.toISOString();
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
const result = await this.api.getCalculator(priceForm);
|
|
1788
|
+
if (this.isTask() && taskId) {
|
|
1789
|
+
await this.api.setApplication(priceForm);
|
|
1790
|
+
const applicationData = await this.api.getApplicationData(taskId);
|
|
1791
|
+
this.formStore.applicationData = applicationData;
|
|
1792
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
1793
|
+
} else {
|
|
1794
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(result)} тг`;
|
|
1795
|
+
}
|
|
1796
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1797
|
+
} catch (err) {
|
|
1798
|
+
ErrorHandler(err);
|
|
1799
|
+
}
|
|
1800
|
+
this.isLoading = false;
|
|
1801
|
+
},
|
|
1607
1802
|
async startApplication(member: Member) {
|
|
1608
1803
|
if (!member.iin) return false;
|
|
1609
1804
|
try {
|
|
@@ -1663,7 +1858,49 @@ export const useDataStore = defineStore('data', {
|
|
|
1663
1858
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
1664
1859
|
this.formStore.finCenterData.date = reformatDate(applicationData.finCenterData.date);
|
|
1665
1860
|
}
|
|
1861
|
+
if ('lifeTripApp' in applicationData && setProductConditions) {
|
|
1862
|
+
const tripType = this.types.find((i: Value) => i.id === applicationData.lifeTripApp.tripTypeId);
|
|
1863
|
+
this.formStore.productConditionsForm.calculatorForm.type = tripType ? tripType : new Value();
|
|
1864
|
+
|
|
1865
|
+
const countries: CountryValue[] = [];
|
|
1866
|
+
for (let i in applicationData.lifeTripApp.lifeTripCountries) {
|
|
1867
|
+
const tripCountry = this.dicAllCountries.find(country => country.id === applicationData.lifeTripApp.lifeTripCountries[i]);
|
|
1868
|
+
if (tripCountry) {
|
|
1869
|
+
countries.push(tripCountry);
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
this.formStore.productConditionsForm.calculatorForm.countries = countries ? countries : [];
|
|
1873
|
+
|
|
1874
|
+
if (this.formStore.productConditionsForm.calculatorForm.countries.length && this.formStore.productConditionsForm.calculatorForm.type.nameRu != null) {
|
|
1875
|
+
await this.getTripInsuredAmount(false);
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
const amount = this.amountArray.find((i: Value) => i.id === applicationData.lifeTripApp.insuredAmountId);
|
|
1879
|
+
this.formStore.productConditionsForm.calculatorForm.amount = amount ? amount : new Value();
|
|
1666
1880
|
|
|
1881
|
+
const purpose = this.purposes.find((i: Value) => i.id === applicationData.lifeTripApp.tripPurposeId);
|
|
1882
|
+
this.formStore.productConditionsForm.calculatorForm.purpose = purpose ? purpose : new Value();
|
|
1883
|
+
|
|
1884
|
+
if (applicationData.lifeTripApp.workTypeId != null) {
|
|
1885
|
+
const work = this.workTypes.find((i: Value) => i.id === applicationData.lifeTripApp.workTypeId);
|
|
1886
|
+
this.formStore.productConditionsForm.calculatorForm.workType = work ? work : new Value();
|
|
1887
|
+
}
|
|
1888
|
+
if (applicationData.lifeTripApp.sportsTypeId != null) {
|
|
1889
|
+
const sport = this.sportsTypes.find((i: Value) => i.id === applicationData.lifeTripApp.sportsTypeId);
|
|
1890
|
+
this.formStore.productConditionsForm.calculatorForm.sportsType = sport ? sport : new Value();
|
|
1891
|
+
}
|
|
1892
|
+
if (this.formStore.productConditionsForm.calculatorForm.type.code === 'Single') {
|
|
1893
|
+
this.formStore.productConditionsForm.calculatorForm.days = Number(applicationData.lifeTripApp.singleTripDays);
|
|
1894
|
+
} else {
|
|
1895
|
+
await this.getPeriod();
|
|
1896
|
+
this.formStore.productConditionsForm.calculatorForm.maxDays = this.maxDaysAllArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.multipleTripMaxDays)!;
|
|
1897
|
+
this.formStore.productConditionsForm.calculatorForm.period = this.periodArray.find((i: Value) => i.nameRu == applicationData.lifeTripApp.tripInsurancePeriod)!;
|
|
1898
|
+
}
|
|
1899
|
+
this.formStore.productConditionsForm.calculatorForm.startDate = reformatDate(applicationData.lifeTripApp.startDate);
|
|
1900
|
+
this.formStore.productConditionsForm.calculatorForm.endDate = reformatDate(applicationData.lifeTripApp.endDate);
|
|
1901
|
+
|
|
1902
|
+
this.formStore.productConditionsForm.calculatorForm.price = `${Math.ceil(applicationData.lifeTripApp.totalPremiumKZT)} тг`;
|
|
1903
|
+
}
|
|
1667
1904
|
if (fetchMembers) {
|
|
1668
1905
|
let allMembers = [
|
|
1669
1906
|
{
|
|
@@ -1733,7 +1970,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1733
1970
|
if (insuredData && insuredData.length) {
|
|
1734
1971
|
insuredData.forEach((each, index) => {
|
|
1735
1972
|
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
1736
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
1973
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1737
1974
|
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1738
1975
|
});
|
|
1739
1976
|
}
|
|
@@ -1741,11 +1978,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1741
1978
|
if (beneficiaryData && beneficiaryData.length) {
|
|
1742
1979
|
beneficiaryData.forEach((each, index) => {
|
|
1743
1980
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
1744
|
-
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
1981
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
1745
1982
|
this.formStore.beneficiaryForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1746
1983
|
this.formStore.beneficiaryForm[index].percentageOfPayoutAmount = each.percentage;
|
|
1747
1984
|
if (this.isLiferenta || this.isBolashak) {
|
|
1748
|
-
const insurancePay = this.insurancePay.find(i => i.id == each.beneficiaryInsurancePayId);
|
|
1985
|
+
const insurancePay = this.insurancePay.find((i: Value) => i.id == each.beneficiaryInsurancePayId);
|
|
1749
1986
|
this.formStore.beneficiaryForm[index].insurancePay = insurancePay ? insurancePay : new Value();
|
|
1750
1987
|
}
|
|
1751
1988
|
});
|
|
@@ -1873,6 +2110,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1873
2110
|
return true;
|
|
1874
2111
|
} catch (err) {
|
|
1875
2112
|
this.isLoading = false;
|
|
2113
|
+
this.isButtonsLoading = false;
|
|
1876
2114
|
return ErrorHandler(err);
|
|
1877
2115
|
}
|
|
1878
2116
|
},
|
|
@@ -2231,8 +2469,8 @@ export const useDataStore = defineStore('data', {
|
|
|
2231
2469
|
}
|
|
2232
2470
|
if (localCheck === false) {
|
|
2233
2471
|
try {
|
|
2234
|
-
if (this.isInitiator() &&
|
|
2235
|
-
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2472
|
+
if (this.isInitiator() && this.members.beneficialOwnerApp.has) {
|
|
2473
|
+
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2236
2474
|
await Promise.allSettled(
|
|
2237
2475
|
this.formStore.applicationData.beneficialOwnerApp.map(async (member: any) => {
|
|
2238
2476
|
await this.api.deleteMember('BeneficialOwner', member.id);
|
|
@@ -2278,91 +2516,97 @@ export const useDataStore = defineStore('data', {
|
|
|
2278
2516
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
2279
2517
|
if (areMembersValid) {
|
|
2280
2518
|
if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) {
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
this.getQuestionList(
|
|
2287
|
-
|
|
2288
|
-
this.
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
2312
|
-
this.getQuestionList('critical', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByCriticalBase'),
|
|
2313
|
-
this.isClientAnketaCondition &&
|
|
2314
|
-
this.getQuestionList(
|
|
2315
|
-
'health',
|
|
2316
|
-
this.formStore.applicationData.processInstanceId,
|
|
2317
|
-
this.formStore.applicationData.clientApp.id,
|
|
2318
|
-
'surveyByHealthBasePolicyholder',
|
|
2319
|
-
'policyholder',
|
|
2320
|
-
),
|
|
2321
|
-
]);
|
|
2322
|
-
this.isClientAnketaCondition
|
|
2323
|
-
? await Promise.allSettled([
|
|
2324
|
-
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2325
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2326
|
-
}),
|
|
2327
|
-
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2328
|
-
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2329
|
-
}),
|
|
2330
|
-
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2331
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2332
|
-
}),
|
|
2333
|
-
])
|
|
2334
|
-
: await Promise.allSettled([
|
|
2335
|
-
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2336
|
-
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2337
|
-
}),
|
|
2338
|
-
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2339
|
-
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2340
|
-
}),
|
|
2341
|
-
]);
|
|
2342
|
-
}
|
|
2343
|
-
if (this.validateAnketa('surveyByHealthBase')) {
|
|
2344
|
-
let hasCriticalAndItsValid = null;
|
|
2345
|
-
if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')) === null) {
|
|
2346
|
-
if (this.validateAnketa('surveyByCriticalBase')) {
|
|
2347
|
-
hasCriticalAndItsValid = true;
|
|
2348
|
-
} else {
|
|
2349
|
-
hasCriticalAndItsValid = false;
|
|
2350
|
-
this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
|
|
2351
|
-
}
|
|
2519
|
+
if (this.controls.hasAnketa) {
|
|
2520
|
+
const hasCritical =
|
|
2521
|
+
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
2522
|
+
if (hasCritical === null || (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')))) {
|
|
2523
|
+
await Promise.allSettled([
|
|
2524
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
2525
|
+
this.isClientAnketaCondition &&
|
|
2526
|
+
this.getQuestionList(
|
|
2527
|
+
'health',
|
|
2528
|
+
this.formStore.applicationData.processInstanceId,
|
|
2529
|
+
this.formStore.applicationData.clientApp.id,
|
|
2530
|
+
'surveyByHealthBasePolicyholder',
|
|
2531
|
+
'policyholder',
|
|
2532
|
+
),
|
|
2533
|
+
,
|
|
2534
|
+
]);
|
|
2535
|
+
this.isClientAnketaCondition
|
|
2536
|
+
? await Promise.allSettled([
|
|
2537
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2538
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2539
|
+
}),
|
|
2540
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2541
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2542
|
+
}),
|
|
2543
|
+
])
|
|
2544
|
+
: await Promise.allSettled(
|
|
2545
|
+
this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2546
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2547
|
+
}),
|
|
2548
|
+
);
|
|
2352
2549
|
} else {
|
|
2353
|
-
|
|
2550
|
+
await Promise.allSettled([
|
|
2551
|
+
this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
|
|
2552
|
+
this.getQuestionList('critical', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByCriticalBase'),
|
|
2553
|
+
this.isClientAnketaCondition &&
|
|
2554
|
+
this.getQuestionList(
|
|
2555
|
+
'health',
|
|
2556
|
+
this.formStore.applicationData.processInstanceId,
|
|
2557
|
+
this.formStore.applicationData.clientApp.id,
|
|
2558
|
+
'surveyByHealthBasePolicyholder',
|
|
2559
|
+
'policyholder',
|
|
2560
|
+
),
|
|
2561
|
+
]);
|
|
2562
|
+
this.isClientAnketaCondition
|
|
2563
|
+
? await Promise.allSettled([
|
|
2564
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2565
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2566
|
+
}),
|
|
2567
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2568
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2569
|
+
}),
|
|
2570
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2571
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2572
|
+
}),
|
|
2573
|
+
])
|
|
2574
|
+
: await Promise.allSettled([
|
|
2575
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2576
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2577
|
+
}),
|
|
2578
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2579
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2580
|
+
}),
|
|
2581
|
+
]);
|
|
2354
2582
|
}
|
|
2355
|
-
if (
|
|
2356
|
-
|
|
2357
|
-
|
|
2583
|
+
if (this.validateAnketa('surveyByHealthBase')) {
|
|
2584
|
+
let hasCriticalAndItsValid = null;
|
|
2585
|
+
if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i')) === null) {
|
|
2586
|
+
if (this.validateAnketa('surveyByCriticalBase')) {
|
|
2587
|
+
hasCriticalAndItsValid = true;
|
|
2588
|
+
} else {
|
|
2589
|
+
hasCriticalAndItsValid = false;
|
|
2590
|
+
this.showToaster('error', this.t('toaster.emptyCriticalAnketa'), 3000);
|
|
2591
|
+
}
|
|
2592
|
+
} else {
|
|
2593
|
+
hasCriticalAndItsValid = null;
|
|
2594
|
+
}
|
|
2595
|
+
if (hasCriticalAndItsValid === true || hasCriticalAndItsValid === null) {
|
|
2596
|
+
if (this.isClientAnketaCondition && this.validateAnketa('surveyByHealthBasePolicyholder') === false) {
|
|
2597
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketaPolicyholder'), 3000);
|
|
2598
|
+
this.isLoading = false;
|
|
2599
|
+
return false;
|
|
2600
|
+
}
|
|
2358
2601
|
this.isLoading = false;
|
|
2359
|
-
return
|
|
2602
|
+
return true;
|
|
2360
2603
|
}
|
|
2361
|
-
|
|
2362
|
-
|
|
2604
|
+
} else {
|
|
2605
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketa'), 3000);
|
|
2363
2606
|
}
|
|
2364
2607
|
} else {
|
|
2365
|
-
this.
|
|
2608
|
+
this.isLoading = false;
|
|
2609
|
+
return true;
|
|
2366
2610
|
}
|
|
2367
2611
|
} else {
|
|
2368
2612
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
@@ -2420,6 +2664,32 @@ export const useDataStore = defineStore('data', {
|
|
|
2420
2664
|
this.isLoading = false;
|
|
2421
2665
|
}
|
|
2422
2666
|
},
|
|
2667
|
+
async getKgd(iin: string) {
|
|
2668
|
+
try {
|
|
2669
|
+
const data = {
|
|
2670
|
+
iinBin: iin.replace(/-/g, ''),
|
|
2671
|
+
};
|
|
2672
|
+
const kgdResponse = await this.api.getKgd(data);
|
|
2673
|
+
return kgdResponse;
|
|
2674
|
+
} catch (err) {
|
|
2675
|
+
return ErrorHandler(err);
|
|
2676
|
+
}
|
|
2677
|
+
},
|
|
2678
|
+
async getGbdUl(bin: string) {
|
|
2679
|
+
if (!this.accessToken) return null;
|
|
2680
|
+
try {
|
|
2681
|
+
const decoded = jwtDecode(this.accessToken);
|
|
2682
|
+
const data = {
|
|
2683
|
+
userName: decoded.code,
|
|
2684
|
+
branchName: decoded.branchCode,
|
|
2685
|
+
bin: bin.replace(/-/g, ''),
|
|
2686
|
+
};
|
|
2687
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
2688
|
+
return gbdulResponse;
|
|
2689
|
+
} catch (err) {
|
|
2690
|
+
return ErrorHandler(err);
|
|
2691
|
+
}
|
|
2692
|
+
},
|
|
2423
2693
|
async getContragentFromGBDFL(member: Member) {
|
|
2424
2694
|
// null - ожидание
|
|
2425
2695
|
// false - ошибка или неправильно
|
|
@@ -2486,11 +2756,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2486
2756
|
member.firstName = person.name;
|
|
2487
2757
|
member.lastName = person.surname;
|
|
2488
2758
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
2759
|
+
if (this.isLifetrip) {
|
|
2760
|
+
member.firstNameLat = person.engFirstName ? person.engFirstName : '';
|
|
2761
|
+
member.lastNameLat = person.engSurname ? person.engSurname : '';
|
|
2762
|
+
}
|
|
2489
2763
|
member.longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
|
|
2490
2764
|
member.birthDate = reformatDate(person.birthDate);
|
|
2491
2765
|
member.genderName = person.gender.nameRu;
|
|
2492
2766
|
|
|
2493
|
-
const gender = this.gender.find(i => i.id == person.gender.code);
|
|
2767
|
+
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
2494
2768
|
if (gender) member.gender = gender;
|
|
2495
2769
|
|
|
2496
2770
|
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
@@ -2573,7 +2847,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2573
2847
|
if ('length' in person.documents.document) {
|
|
2574
2848
|
const validDocument = person.documents.document.find((i: any) => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2575
2849
|
if (validDocument) {
|
|
2576
|
-
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2850
|
+
const documentType = this.documentTypes.find((i: Value) => i.ids === '1UDL');
|
|
2577
2851
|
if (documentType) member.documentType = documentType;
|
|
2578
2852
|
|
|
2579
2853
|
member.documentNumber = validDocument.number;
|
|
@@ -2587,7 +2861,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2587
2861
|
} else {
|
|
2588
2862
|
const documentType =
|
|
2589
2863
|
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2590
|
-
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2864
|
+
? this.documentTypes.find((i: Value) => i.ids === '1UDL')
|
|
2591
2865
|
: this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2592
2866
|
? this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2593
2867
|
: new Value();
|
|
@@ -2606,9 +2880,18 @@ export const useDataStore = defineStore('data', {
|
|
|
2606
2880
|
const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
|
|
2607
2881
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2608
2882
|
}
|
|
2609
|
-
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2883
|
+
const economySectorCode = this.economySectorCode.find((i: Value) => i.ids === '500003.9');
|
|
2610
2884
|
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
2611
2885
|
},
|
|
2886
|
+
async checkIIN(iin: number) {
|
|
2887
|
+
try {
|
|
2888
|
+
const response = await this.api.checkIIN(iin);
|
|
2889
|
+
return response;
|
|
2890
|
+
} catch (err) {
|
|
2891
|
+
ErrorHandler(err);
|
|
2892
|
+
return null;
|
|
2893
|
+
}
|
|
2894
|
+
},
|
|
2612
2895
|
async isCourseChanged(processInstanceId: string) {
|
|
2613
2896
|
try {
|
|
2614
2897
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -2618,6 +2901,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2618
2901
|
}
|
|
2619
2902
|
},
|
|
2620
2903
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
2904
|
+
if (this.isLifetrip) return false;
|
|
2621
2905
|
switch (whichForm) {
|
|
2622
2906
|
case this.formStore.beneficiaryFormKey:
|
|
2623
2907
|
case this.formStore.beneficialOwnerFormKey:
|