hl-core 0.0.9-beta.25 → 0.0.9-beta.27
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 +77 -1
- package/api/interceptors.ts +3 -3
- package/components/Form/FormData.vue +48 -0
- package/components/Pages/ProductConditions.vue +90 -5
- package/components/Panel/PanelHandler.vue +35 -8
- package/composables/classes.ts +230 -113
- package/locales/ru.json +62 -35
- package/package.json +1 -1
- package/store/data.store.ts +339 -17
- package/store/form.store.ts +3 -1
- package/types/index.ts +43 -2
package/package.json
CHANGED
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, CountryValue,
|
|
6
|
+
import { DataStoreClass, Contragent, DocumentItem, Member, Value, CountryValue, MemberV2, PolicyholderActivity, BeneficialOwner } from '../composables/classes';
|
|
7
7
|
import { ApiClass } from '../api';
|
|
8
8
|
import { useFormStore } from './form.store';
|
|
9
9
|
import { AxiosError } from 'axios';
|
|
@@ -1018,6 +1018,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1018
1018
|
conditionsData.policyAppDto.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
1019
1019
|
conditionsData.policyAppDto.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
1020
1020
|
}
|
|
1021
|
+
if (this.isLifeBusiness) {
|
|
1022
|
+
conditionsData.policyAppDto.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
|
|
1023
|
+
conditionsData.policyAppDto.fixInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
|
|
1024
|
+
conditionsData.policyAppDto.tariffId = String(this.formStore.productConditionsForm.processTariff.id);
|
|
1025
|
+
conditionsData.policyAppDto.processDefinitionFgotId = (this.formStore.productConditionsForm.processGfot.id as string) ?? undefined;
|
|
1026
|
+
}
|
|
1021
1027
|
return conditionsData;
|
|
1022
1028
|
},
|
|
1023
1029
|
async clearAddCovers(coverCode: number, coverValue: string) {
|
|
@@ -1242,7 +1248,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1242
1248
|
return this.cities;
|
|
1243
1249
|
}
|
|
1244
1250
|
},
|
|
1245
|
-
async getCitiesEfo(key?: string, member?:
|
|
1251
|
+
async getCitiesEfo(key?: string, member?: MemberV2, parentKey?: string) {
|
|
1246
1252
|
if (this.isLifeBusiness) {
|
|
1247
1253
|
await this.getFromApi('cities', 'getCities');
|
|
1248
1254
|
//@ts-ignore
|
|
@@ -1318,6 +1324,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1318
1324
|
async getInsurancePay() {
|
|
1319
1325
|
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
1320
1326
|
},
|
|
1327
|
+
async getProcessGfot() {
|
|
1328
|
+
if (this.processCode) {
|
|
1329
|
+
return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
|
|
1330
|
+
}
|
|
1331
|
+
},
|
|
1321
1332
|
async getCurrencies() {
|
|
1322
1333
|
try {
|
|
1323
1334
|
const currencies = await this.api.getCurrencies();
|
|
@@ -1363,6 +1374,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1363
1374
|
this.getDicSportsType(),
|
|
1364
1375
|
this.getDicTripPurpose(),
|
|
1365
1376
|
this.getCurrencies(),
|
|
1377
|
+
this.getProcessGfot(),
|
|
1366
1378
|
]);
|
|
1367
1379
|
},
|
|
1368
1380
|
async getQuestionList(
|
|
@@ -1407,7 +1419,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1407
1419
|
return parts.join(',');
|
|
1408
1420
|
},
|
|
1409
1421
|
getNumberWithDot(n: any) {
|
|
1410
|
-
return n === null
|
|
1422
|
+
return n === null
|
|
1423
|
+
? null
|
|
1424
|
+
: n
|
|
1425
|
+
.toLocaleString('ru', {
|
|
1426
|
+
maximumFractionDigits: 2,
|
|
1427
|
+
minimumFractionDigits: 2,
|
|
1428
|
+
})
|
|
1429
|
+
.replace(/,/g, '.');
|
|
1411
1430
|
},
|
|
1412
1431
|
async getTaskList(
|
|
1413
1432
|
search: string = '',
|
|
@@ -1447,7 +1466,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1447
1466
|
delete query.processCodes;
|
|
1448
1467
|
query.processCode = byOneProcess;
|
|
1449
1468
|
}
|
|
1450
|
-
const taskList = await this.api.getTaskList(
|
|
1469
|
+
const taskList = await this.api.getTaskList(
|
|
1470
|
+
processInstanceId === null
|
|
1471
|
+
? query
|
|
1472
|
+
: {
|
|
1473
|
+
...query,
|
|
1474
|
+
processInstanceId: processInstanceId,
|
|
1475
|
+
},
|
|
1476
|
+
);
|
|
1451
1477
|
if (needToReturn) {
|
|
1452
1478
|
this.isLoading = false;
|
|
1453
1479
|
return taskList.items;
|
|
@@ -1670,15 +1696,16 @@ export const useDataStore = defineStore('data', {
|
|
|
1670
1696
|
calculationData.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
|
|
1671
1697
|
}
|
|
1672
1698
|
if (this.isLifeBusiness || product === 'lifebusiness') {
|
|
1673
|
-
calculationData.clients = this.formStore.lfb.
|
|
1674
|
-
calculationData.insrCount = this.formStore.lfb.
|
|
1699
|
+
calculationData.clients = this.formStore.lfb.clients;
|
|
1700
|
+
calculationData.insrCount = this.formStore.lfb.clients.length;
|
|
1675
1701
|
calculationData.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
|
|
1676
1702
|
calculationData.fixInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
|
|
1677
1703
|
calculationData.agentCommission = this.formStore.productConditionsForm.processTariff.id;
|
|
1704
|
+
calculationData.processDefinitionFgotId = this.formStore.productConditionsForm.processGfot.id;
|
|
1678
1705
|
}
|
|
1679
1706
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1680
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
1681
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
|
|
1707
|
+
if (calculationResponse.amount) this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
1708
|
+
if (calculationResponse.premium) this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
|
|
1682
1709
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1683
1710
|
if (this.isKazyna || product === 'halykkazyna') {
|
|
1684
1711
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
@@ -1698,9 +1725,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1698
1725
|
}
|
|
1699
1726
|
if (this.isLifeBusiness || product === 'lifebusiness') {
|
|
1700
1727
|
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremium);
|
|
1728
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.fixInsSum === 0 ? null : calculationResponse.fixInsSum);
|
|
1701
1729
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1702
1730
|
if (calculationResponse.clients) {
|
|
1703
|
-
this.formStore.lfb.
|
|
1731
|
+
this.formStore.lfb.clients = calculationResponse.clients;
|
|
1704
1732
|
}
|
|
1705
1733
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1706
1734
|
return calculationResponse;
|
|
@@ -1747,6 +1775,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1747
1775
|
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
|
|
1748
1776
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
1749
1777
|
}
|
|
1778
|
+
if (this.isLifeBusiness) {
|
|
1779
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1780
|
+
}
|
|
1750
1781
|
|
|
1751
1782
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1752
1783
|
} catch (err) {
|
|
@@ -2170,7 +2201,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2170
2201
|
}
|
|
2171
2202
|
case constants.actions.affiliate: {
|
|
2172
2203
|
try {
|
|
2173
|
-
const sended = await this.sendUnderwritingCouncilTask({
|
|
2204
|
+
const sended = await this.sendUnderwritingCouncilTask({
|
|
2205
|
+
taskId: taskId,
|
|
2206
|
+
decision: constants.actions.accept,
|
|
2207
|
+
});
|
|
2174
2208
|
if (!sended) return;
|
|
2175
2209
|
this.formStore.$reset();
|
|
2176
2210
|
if (this.isEFO || this.isAML) {
|
|
@@ -2261,11 +2295,25 @@ export const useDataStore = defineStore('data', {
|
|
|
2261
2295
|
const prepareSignDocuments = (): SignDataType[] => {
|
|
2262
2296
|
switch (this.formStore.applicationData.statusCode) {
|
|
2263
2297
|
case 'ContractSignedFrom':
|
|
2264
|
-
return [
|
|
2298
|
+
return [
|
|
2299
|
+
{
|
|
2300
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2301
|
+
name: 'Contract',
|
|
2302
|
+
format: 'pdf',
|
|
2303
|
+
},
|
|
2304
|
+
];
|
|
2265
2305
|
default:
|
|
2266
2306
|
return [
|
|
2267
|
-
{
|
|
2268
|
-
|
|
2307
|
+
{
|
|
2308
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2309
|
+
name: 'Agreement',
|
|
2310
|
+
format: 'pdf',
|
|
2311
|
+
},
|
|
2312
|
+
{
|
|
2313
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2314
|
+
name: 'Statement',
|
|
2315
|
+
format: 'pdf',
|
|
2316
|
+
},
|
|
2269
2317
|
];
|
|
2270
2318
|
}
|
|
2271
2319
|
};
|
|
@@ -2277,12 +2325,38 @@ export const useDataStore = defineStore('data', {
|
|
|
2277
2325
|
ErrorHandler(err);
|
|
2278
2326
|
}
|
|
2279
2327
|
},
|
|
2328
|
+
async downloadTemplate() {
|
|
2329
|
+
try {
|
|
2330
|
+
this.isButtonsLoading = true;
|
|
2331
|
+
const response: any = await this.api.downloadTemplate();
|
|
2332
|
+
const blob = new Blob([response], {
|
|
2333
|
+
type: `application/pdf`,
|
|
2334
|
+
});
|
|
2335
|
+
this.showToaster('info', this.t('toaster.needToSignContract'), 100000);
|
|
2336
|
+
const url = window.URL.createObjectURL(blob);
|
|
2337
|
+
const link = document.createElement('a');
|
|
2338
|
+
link.href = url;
|
|
2339
|
+
link.setAttribute('download', this.formStore.regNumber + ' Договор страхования');
|
|
2340
|
+
document.body.appendChild(link);
|
|
2341
|
+
link.click();
|
|
2342
|
+
} catch (err) {
|
|
2343
|
+
ErrorHandler(err);
|
|
2344
|
+
}
|
|
2345
|
+
this.isButtonsLoading = false;
|
|
2346
|
+
},
|
|
2347
|
+
async sendTemplateToEmail(email: string) {
|
|
2348
|
+
try {
|
|
2349
|
+
this.isButtonsLoading = true;
|
|
2350
|
+
await this.api.sendTemplateToEmail(email);
|
|
2351
|
+
this.showToaster('info', this.t('toaster.needToSignContract'), 100000);
|
|
2352
|
+
} catch (err) {
|
|
2353
|
+
ErrorHandler(err);
|
|
2354
|
+
}
|
|
2355
|
+
this.isButtonsLoading = false;
|
|
2356
|
+
},
|
|
2280
2357
|
async generateDocument() {
|
|
2281
2358
|
try {
|
|
2282
2359
|
this.isButtonsLoading = true;
|
|
2283
|
-
if (this.formStore.signUrls.length) {
|
|
2284
|
-
return this.formStore.signUrls;
|
|
2285
|
-
}
|
|
2286
2360
|
this.formStore.needToScanSignedContract = true;
|
|
2287
2361
|
const data: SignDataType = {
|
|
2288
2362
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
@@ -2671,7 +2745,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2671
2745
|
async getFamilyInfo(iin: string, phoneNumber: string) {
|
|
2672
2746
|
this.isLoading = true;
|
|
2673
2747
|
try {
|
|
2674
|
-
const familyResponse = await this.api.getFamilyInfo({
|
|
2748
|
+
const familyResponse = await this.api.getFamilyInfo({
|
|
2749
|
+
iin: iin.replace(/-/g, ''),
|
|
2750
|
+
phoneNumber: formatPhone(phoneNumber),
|
|
2751
|
+
});
|
|
2675
2752
|
if (familyResponse.status === 'soap:Server') {
|
|
2676
2753
|
this.showToaster('error', `${familyResponse.statusName}. Отправьте запрос через некоторое время`, 5000);
|
|
2677
2754
|
this.isLoading = false;
|
|
@@ -2935,6 +3012,251 @@ export const useDataStore = defineStore('data', {
|
|
|
2935
3012
|
const economySectorCode = this.economySectorCode.find((i: Value) => i.ids === '500003.9');
|
|
2936
3013
|
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
2937
3014
|
},
|
|
3015
|
+
async startApplicationV2(policyholder: MemberV2) {
|
|
3016
|
+
if (!policyholder.personalData.iin) return false;
|
|
3017
|
+
try {
|
|
3018
|
+
const response = await this.api.startApplication(policyholder);
|
|
3019
|
+
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
3020
|
+
return response.processInstanceId;
|
|
3021
|
+
} catch (err) {
|
|
3022
|
+
return ErrorHandler(err);
|
|
3023
|
+
}
|
|
3024
|
+
},
|
|
3025
|
+
async saveClient(policyholder: MemberV2) {
|
|
3026
|
+
try {
|
|
3027
|
+
this.formStore.applicationData.clientApp.clientData = policyholder;
|
|
3028
|
+
const response = await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, this.formStore.applicationData.clientApp);
|
|
3029
|
+
return response;
|
|
3030
|
+
} catch (err) {
|
|
3031
|
+
return ErrorHandler(err);
|
|
3032
|
+
}
|
|
3033
|
+
},
|
|
3034
|
+
async getApplicationDataV2(taskId: string) {
|
|
3035
|
+
this.isLoading = true;
|
|
3036
|
+
try {
|
|
3037
|
+
const applicationData = await this.api.getApplicationData(taskId);
|
|
3038
|
+
if (this.processCode !== applicationData.processCode) {
|
|
3039
|
+
this.isLoading = false;
|
|
3040
|
+
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
|
|
3041
|
+
return;
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
this.formStore.applicationData = applicationData;
|
|
3045
|
+
this.formStore.regNumber = applicationData.regNumber;
|
|
3046
|
+
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
3047
|
+
|
|
3048
|
+
this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
|
|
3049
|
+
this.formStore.applicationTaskId = taskId;
|
|
3050
|
+
this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
|
|
3051
|
+
this.formStore.RegionPolicy.ids = applicationData.insisWorkDataApp.regionPolicy;
|
|
3052
|
+
this.formStore.ManagerPolicy.nameRu = applicationData.insisWorkDataApp.managerPolicyName;
|
|
3053
|
+
this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
|
|
3054
|
+
this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
|
|
3055
|
+
this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
|
|
3056
|
+
|
|
3057
|
+
this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
|
|
3058
|
+
this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
|
|
3059
|
+
|
|
3060
|
+
const { clientData } = applicationData.clientApp;
|
|
3061
|
+
const beneficialOwnerApp = applicationData.beneficialOwnerApp;
|
|
3062
|
+
const insuredApp = applicationData.insuredApp;
|
|
3063
|
+
const accidentIncidents = applicationData.accidentIncidentDtos;
|
|
3064
|
+
const clientId = applicationData.clientApp.id;
|
|
3065
|
+
|
|
3066
|
+
this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
|
|
3067
|
+
this.formStore.lfb.policyholder = clientData;
|
|
3068
|
+
this.formStore.lfb.clientId = clientId;
|
|
3069
|
+
this.formStore.lfb.policyholder.clientPower.date = reformatDate(clientData.clientPower.date);
|
|
3070
|
+
|
|
3071
|
+
if (clientData && clientData.activityTypes !== null) {
|
|
3072
|
+
this.formStore.lfb.policyholderActivities = clientData.activityTypes;
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
if (beneficialOwnerApp && beneficialOwnerApp.length) {
|
|
3076
|
+
this.formStore.lfb.beneficialOwners = beneficialOwnerApp;
|
|
3077
|
+
this.formStore.lfb.beneficialOwners.forEach(beneficial => {
|
|
3078
|
+
beneficial.beneficialOwnerData.identityCard!.validity = reformatDate(beneficial.beneficialOwnerData.identityCard!.validity as string);
|
|
3079
|
+
});
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
if (insuredApp && insuredApp.length) {
|
|
3083
|
+
const res = await this.newInsuredList(insuredApp);
|
|
3084
|
+
this.formStore.lfb.clients = res;
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
if (accidentIncidents && accidentIncidents.length) {
|
|
3088
|
+
this.formStore.lfb.accidentIncidents = accidentIncidents;
|
|
3089
|
+
this.formStore.lfb.accidentIncidents.forEach(incident => {
|
|
3090
|
+
incident.amount = incident.amount === 0 ? null : incident.amount;
|
|
3091
|
+
incident.count = incident.count === 0 ? null : incident.count;
|
|
3092
|
+
});
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
this.formStore.productConditionsForm.coverPeriod = 12;
|
|
3096
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount === 0 ? null : applicationData.policyAppDto.amount);
|
|
3097
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
|
|
3098
|
+
applicationData.policyAppDto.mainPremium === 0 ? null : applicationData.policyAppDto.mainPremium,
|
|
3099
|
+
);
|
|
3100
|
+
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
3101
|
+
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
3102
|
+
const processTariff = this.processTariff.find(item => item.id == applicationData.policyAppDto.tariffId);
|
|
3103
|
+
this.formStore.productConditionsForm.processTariff = processTariff ? processTariff : new Value();
|
|
3104
|
+
const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
|
|
3105
|
+
this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
|
|
3106
|
+
} catch (err) {
|
|
3107
|
+
ErrorHandler(err);
|
|
3108
|
+
if (err instanceof AxiosError) {
|
|
3109
|
+
this.sendToParent(constants.postActions.toHomePage, err.response?.data);
|
|
3110
|
+
this.isLoading = false;
|
|
3111
|
+
return false;
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
this.isLoading = false;
|
|
3115
|
+
},
|
|
3116
|
+
async saveAccidentIncidents(data: AccidentIncidents[]) {
|
|
3117
|
+
try {
|
|
3118
|
+
const response = await this.api.saveAccidentIncidents(this.formStore.applicationData.processInstanceId, data);
|
|
3119
|
+
return response;
|
|
3120
|
+
} catch (err) {
|
|
3121
|
+
return ErrorHandler(err);
|
|
3122
|
+
}
|
|
3123
|
+
},
|
|
3124
|
+
async saveClientAcivityTypes(data: PolicyholderActivity[]) {
|
|
3125
|
+
try {
|
|
3126
|
+
const response = await this.api.saveClientAcivityTypes(this.formStore.applicationData.clientApp.id, data);
|
|
3127
|
+
return response;
|
|
3128
|
+
} catch (err) {
|
|
3129
|
+
return ErrorHandler(err);
|
|
3130
|
+
}
|
|
3131
|
+
},
|
|
3132
|
+
async saveBeneficialOwnerList(beneficialOwnerList: BeneficialOwner[]) {
|
|
3133
|
+
try {
|
|
3134
|
+
const response = await this.api.saveBeneficialOwnerList(this.formStore.applicationData.processInstanceId, beneficialOwnerList);
|
|
3135
|
+
return response;
|
|
3136
|
+
} catch (err) {
|
|
3137
|
+
return ErrorHandler(err);
|
|
3138
|
+
}
|
|
3139
|
+
},
|
|
3140
|
+
async saveBeneficialOwner(beneficialOwner: BeneficialOwner) {
|
|
3141
|
+
try {
|
|
3142
|
+
const response = await this.api.saveBeneficialOwner(this.formStore.applicationData.processInstanceId, beneficialOwner.id, beneficialOwner);
|
|
3143
|
+
return response;
|
|
3144
|
+
} catch (err) {
|
|
3145
|
+
return ErrorHandler(err);
|
|
3146
|
+
}
|
|
3147
|
+
},
|
|
3148
|
+
async saveInsuredList(insuredList: any) {
|
|
3149
|
+
try {
|
|
3150
|
+
const response = await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, insuredList);
|
|
3151
|
+
return response;
|
|
3152
|
+
} catch (err) {
|
|
3153
|
+
return ErrorHandler(err);
|
|
3154
|
+
}
|
|
3155
|
+
},
|
|
3156
|
+
async saveInsured(insuredId: any) {
|
|
3157
|
+
try {
|
|
3158
|
+
const response = await this.api.saveInsured(this.formStore.applicationData.processInstanceId, insuredId.id, insuredId);
|
|
3159
|
+
return response;
|
|
3160
|
+
} catch (err) {
|
|
3161
|
+
return ErrorHandler(err);
|
|
3162
|
+
}
|
|
3163
|
+
},
|
|
3164
|
+
newInsuredList(list: any) {
|
|
3165
|
+
const clients = list.map((item: any, index: number) => {
|
|
3166
|
+
const client = item.insuredData;
|
|
3167
|
+
return {
|
|
3168
|
+
id: index,
|
|
3169
|
+
fullName: client.personalData.longName,
|
|
3170
|
+
sex: client.personalData.sex,
|
|
3171
|
+
position: item.position,
|
|
3172
|
+
birthDate: client.personalData.birthDate,
|
|
3173
|
+
iin: client.personalData.iin,
|
|
3174
|
+
insSum: client.insuredPolicyData.insSum,
|
|
3175
|
+
premium: client.insuredPolicyData.premium,
|
|
3176
|
+
};
|
|
3177
|
+
});
|
|
3178
|
+
return clients;
|
|
3179
|
+
},
|
|
3180
|
+
validateMultipleMembersV2(localKey: string, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
3181
|
+
// @ts-ignore
|
|
3182
|
+
if (this.formStore.lfb[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
3183
|
+
// @ts-ignore
|
|
3184
|
+
if (this.formStore.lfb[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
3185
|
+
// @ts-ignore
|
|
3186
|
+
const localMembers = [...this.formStore.lfb[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
3187
|
+
const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.id - b.id);
|
|
3188
|
+
if (localMembers.every((each, index) => applicationMembers[index].iin === each.iin?.replace(/-/g, '')) === false) {
|
|
3189
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3190
|
+
return false;
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
} else {
|
|
3194
|
+
// @ts-ignore
|
|
3195
|
+
if (this.formStore.lfb[localKey].some(i => i.iin !== null)) {
|
|
3196
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3197
|
+
return false;
|
|
3198
|
+
}
|
|
3199
|
+
if (this.formStore.applicationData[applicationKey].length !== 0) {
|
|
3200
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3201
|
+
return false;
|
|
3202
|
+
} else {
|
|
3203
|
+
// @ts-ignore
|
|
3204
|
+
if (this.formStore.lfb[localKey][0].iin !== null) {
|
|
3205
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3206
|
+
return false;
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
return true;
|
|
3211
|
+
},
|
|
3212
|
+
async validateAllFormsV2(taskId: string) {
|
|
3213
|
+
this.isLoading = true;
|
|
3214
|
+
if (taskId === '0') {
|
|
3215
|
+
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
3216
|
+
return false;
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
if (this.formStore.applicationData.clientApp.iin !== this.formStore.applicationData.clientApp.iin) {
|
|
3220
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
3221
|
+
return false;
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
if (this.formStore.lfb.beneficialOwners) {
|
|
3225
|
+
if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
3226
|
+
return false;
|
|
3227
|
+
}
|
|
3228
|
+
const inStatement = this.formStore.lfb.beneficialOwners.every(i => i.id !== null);
|
|
3229
|
+
if (inStatement === false) {
|
|
3230
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficialOwner') }));
|
|
3231
|
+
return false;
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
if (this.formStore.lfb.policyholderActivities) {
|
|
3236
|
+
if (this.formStore.lfb.policyholderActivities.length !== this.formStore.applicationData.clientApp.clientData.activityTypes.length) {
|
|
3237
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
|
|
3238
|
+
return false;
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3242
|
+
if (this.formStore.lfb.clients) {
|
|
3243
|
+
if (this.validateMultipleMembersV2('clients', 'insuredApp', 'застрахованных') === false) {
|
|
3244
|
+
return false;
|
|
3245
|
+
}
|
|
3246
|
+
const inStatement = this.formStore.lfb.clients.every(i => i.id !== null);
|
|
3247
|
+
if (inStatement === false) {
|
|
3248
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.insured') }));
|
|
3249
|
+
return false;
|
|
3250
|
+
}
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3254
|
+
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
3255
|
+
return false;
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
return true;
|
|
3259
|
+
},
|
|
2938
3260
|
async checkIIN(iin: number) {
|
|
2939
3261
|
try {
|
|
2940
3262
|
const response = await this.api.checkIIN(iin);
|
package/store/form.store.ts
CHANGED
|
@@ -11,7 +11,9 @@ export const useFormStore = defineStore('forms', {
|
|
|
11
11
|
this.lfb.policyholderActivities.push(new PolicyholderActivity());
|
|
12
12
|
}
|
|
13
13
|
if (whichMember === 'beneficialOwner') {
|
|
14
|
-
this.lfb.beneficialOwners.
|
|
14
|
+
if (this.lfb.beneficialOwners.length !== 3) {
|
|
15
|
+
this.lfb.beneficialOwners.push(new BeneficialOwner());
|
|
16
|
+
}
|
|
15
17
|
}
|
|
16
18
|
},
|
|
17
19
|
},
|
package/types/index.ts
CHANGED
|
@@ -262,8 +262,10 @@ declare global {
|
|
|
262
262
|
insSumType?: number;
|
|
263
263
|
insSumMultiplier?: number;
|
|
264
264
|
fixInsSum?: number | null;
|
|
265
|
-
|
|
265
|
+
tariffId?: string | number | null;
|
|
266
266
|
clients?: ClientV2[];
|
|
267
|
+
agentCommission?: any;
|
|
268
|
+
processDefinitionFgotId?: any;
|
|
267
269
|
};
|
|
268
270
|
|
|
269
271
|
interface ClientV2 {
|
|
@@ -299,6 +301,7 @@ declare global {
|
|
|
299
301
|
annuityMonthPay: string | number | null;
|
|
300
302
|
mainPremium?: number;
|
|
301
303
|
clients?: ClientV2[];
|
|
304
|
+
fixInsSum?: number | null;
|
|
302
305
|
};
|
|
303
306
|
|
|
304
307
|
interface AddCover {
|
|
@@ -529,7 +532,6 @@ declare global {
|
|
|
529
532
|
underwritingType?: number;
|
|
530
533
|
annualIncome?: number | null;
|
|
531
534
|
calcDirect?: number;
|
|
532
|
-
tariffId?: string;
|
|
533
535
|
tariffName?: string;
|
|
534
536
|
riskGroup?: number;
|
|
535
537
|
riskGroup2?: number;
|
|
@@ -558,6 +560,12 @@ declare global {
|
|
|
558
560
|
tripInsurancePeriod?: string | number | null;
|
|
559
561
|
startDate?: string | null;
|
|
560
562
|
endDate?: string | null;
|
|
563
|
+
insTermInMonth?: number | null;
|
|
564
|
+
fixInsSum?: number | string | null;
|
|
565
|
+
tariffId?: string | null;
|
|
566
|
+
mainPremium?: number | string | null;
|
|
567
|
+
processDefinitionFgotId?: string | number;
|
|
568
|
+
mainInsSum?: number;
|
|
561
569
|
};
|
|
562
570
|
|
|
563
571
|
type InsisWorkDataApp = {
|
|
@@ -621,10 +629,43 @@ declare global {
|
|
|
621
629
|
name: string;
|
|
622
630
|
};
|
|
623
631
|
|
|
632
|
+
type AccidentIncidents = {
|
|
633
|
+
id: string | null;
|
|
634
|
+
processInstanceId: string | null;
|
|
635
|
+
coverTypeId: string | null;
|
|
636
|
+
coverTypeName: string | null;
|
|
637
|
+
coverTypeCode: number | null;
|
|
638
|
+
count: number | null;
|
|
639
|
+
amount: number | null;
|
|
640
|
+
shortDescription: string | null;
|
|
641
|
+
};
|
|
642
|
+
|
|
624
643
|
type GovPremiums = {
|
|
625
644
|
statePremium5: number | null;
|
|
626
645
|
statePremium7: number | null;
|
|
627
646
|
totalAmount5: number | null;
|
|
628
647
|
totalAmount7: number | null;
|
|
629
648
|
};
|
|
649
|
+
|
|
650
|
+
type LabelSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
|
|
651
|
+
|
|
652
|
+
type Label = {
|
|
653
|
+
value: string;
|
|
654
|
+
hideInMobile: Boolean;
|
|
655
|
+
size: LabelSize;
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
type Entry = {
|
|
659
|
+
value: string;
|
|
660
|
+
formatType?: 'iin' | 'fullName' | 'phone' | 'digits';
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
type FormBlock = {
|
|
664
|
+
title: string;
|
|
665
|
+
redirectPath: string;
|
|
666
|
+
key?: string;
|
|
667
|
+
disabled: boolean;
|
|
668
|
+
labels: Label[];
|
|
669
|
+
entries: Entry[];
|
|
670
|
+
};
|
|
630
671
|
}
|