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/form.store.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
|
-
import { FormStoreClass } from '../composables/classes';
|
|
2
|
+
import { BeneficialOwner, FormStoreClass, PolicyholderActivity } from '../composables/classes';
|
|
3
3
|
|
|
4
4
|
export const useFormStore = defineStore('forms', {
|
|
5
5
|
state: () => ({
|
|
6
6
|
...new FormStoreClass(),
|
|
7
7
|
}),
|
|
8
|
+
actions: {
|
|
9
|
+
addMember(whichMember: 'policyholder' | 'beneficialOwner') {
|
|
10
|
+
if (whichMember === 'policyholder') {
|
|
11
|
+
this.lfb.policyholderActivities.push(new PolicyholderActivity());
|
|
12
|
+
}
|
|
13
|
+
if (whichMember === 'beneficialOwner') {
|
|
14
|
+
this.lfb.beneficialOwners.push(new BeneficialOwner());
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
},
|
|
8
18
|
});
|
package/store/member.store.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
13
13
|
formStore: useFormStore(),
|
|
14
14
|
}),
|
|
15
15
|
actions: {
|
|
16
|
-
isStatementEditible(whichForm: keyof typeof StoreMembers | 'productConditionsForm', showToaster: boolean = false) {
|
|
16
|
+
isStatementEditible(whichForm: keyof typeof StoreMembers | 'productConditionsForm' | 'calculatorForm', showToaster: boolean = false) {
|
|
17
17
|
if (!this.validateInitiator(false)) return false;
|
|
18
18
|
if (this.formStore.isDisabled[whichForm as keyof typeof this.formStore.isDisabled] === true) {
|
|
19
19
|
if (showToaster) this.dataStore.showToaster('error', this.dataStore.t('toaster.viewErrorText'), 2000);
|
package/store/rules.ts
CHANGED
|
@@ -16,6 +16,7 @@ export const rules = {
|
|
|
16
16
|
return t('rules.required');
|
|
17
17
|
},
|
|
18
18
|
],
|
|
19
|
+
arrayRequired: [(v: any) => (v && v.length > 0) || t('rules.required')],
|
|
19
20
|
agentDataRequired: [
|
|
20
21
|
(v: any) => {
|
|
21
22
|
if (!!v && 'fullName' in v && v.fullName != null) {
|
|
@@ -35,7 +36,19 @@ export const rules = {
|
|
|
35
36
|
return t('rules.required');
|
|
36
37
|
},
|
|
37
38
|
],
|
|
39
|
+
noResidentOffline: [
|
|
40
|
+
(v: any) => {
|
|
41
|
+
if (!!v && 'nameRu' in v && v.nameRu === 'Нерезидент') {
|
|
42
|
+
return t('rules.noResidentOffline');
|
|
43
|
+
}
|
|
44
|
+
if (!!v && 'nameRu' in v && !!v.nameRu) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return t('rules.required');
|
|
48
|
+
},
|
|
49
|
+
],
|
|
38
50
|
cyrillic: [(v: any) => v === null || /^[\u0400-\u04FF ]+$/.test(v) || t('rules.cyrillic')],
|
|
51
|
+
latin: [(v: any) => v === null || /^[a-zA-Z]+$/.test(v) || t('rules.latin')],
|
|
39
52
|
cyrillicNonRequired: [
|
|
40
53
|
(v: any) => {
|
|
41
54
|
if (!v) return true;
|
|
@@ -64,6 +77,8 @@ export const rules = {
|
|
|
64
77
|
numbers: [(v: any) => /^[0-9]+$/.test(v) || t('rules.numbers')],
|
|
65
78
|
numbersSymbols: [(v: any) => /^([0-9])|(\W|_)+$/.test(v) || t('rules.numbersSymbols')],
|
|
66
79
|
ageExceeds: [(v: any) => v < 50 || t('rules.ageExceeds')],
|
|
80
|
+
ageExceeds80: [(v: any) => v <= 80 || t('rules.ageExceeds80')],
|
|
81
|
+
ageExceeds80ByDate: [(v: any) => Math.abs(new Date(Date.now() - new Date(formatDate(v)!).getTime()).getUTCFullYear() - 1970) <= 80 || t('rules.ageExceeds80')],
|
|
67
82
|
sums: [
|
|
68
83
|
(v: any) => {
|
|
69
84
|
let str = v.replace(/\s/g, '');
|
|
@@ -73,6 +88,16 @@ export const rules = {
|
|
|
73
88
|
return t('rules.sums');
|
|
74
89
|
},
|
|
75
90
|
],
|
|
91
|
+
planDate: [
|
|
92
|
+
(v: any) => {
|
|
93
|
+
if (new Date(formatDate(v)!) < new Date(Date.now())) return t('rules.planDate');
|
|
94
|
+
if (/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])(-|\.)(0[1-9]|1[0-2])(-|\.)(19[0-9]{2}|20[0-9][0-9])$/.test(v)) {
|
|
95
|
+
return true;
|
|
96
|
+
} else {
|
|
97
|
+
return t('rules.date');
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
],
|
|
76
101
|
iinRight: [
|
|
77
102
|
(v: any) => {
|
|
78
103
|
if (v.length !== useMask().iin.length) {
|
package/types/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CountryValue, Value } from '../composables/classes';
|
|
1
2
|
import { RouteLocationNormalizedLoaded, RouteLocationNormalized } from 'vue-router';
|
|
2
3
|
import { AxiosRequestConfig } from 'axios';
|
|
3
4
|
import { Methods } from './enum';
|
|
@@ -53,6 +54,11 @@ declare global {
|
|
|
53
54
|
| 'time'
|
|
54
55
|
| 'url'
|
|
55
56
|
| 'week';
|
|
57
|
+
|
|
58
|
+
interface AxiosRequestLocalConfig extends AxiosRequestConfig {
|
|
59
|
+
method: Methods | keyof typeof Methods;
|
|
60
|
+
}
|
|
61
|
+
|
|
56
62
|
interface TaskListItem {
|
|
57
63
|
addRegNumber: string | number;
|
|
58
64
|
applicationTaskId: string;
|
|
@@ -239,8 +245,8 @@ declare global {
|
|
|
239
245
|
};
|
|
240
246
|
|
|
241
247
|
type RecalculationDataType = {
|
|
242
|
-
signDate
|
|
243
|
-
birthDate
|
|
248
|
+
signDate?: string;
|
|
249
|
+
birthDate?: string;
|
|
244
250
|
gender: number;
|
|
245
251
|
amount: number | null;
|
|
246
252
|
premium: number | null;
|
|
@@ -249,8 +255,34 @@ declare global {
|
|
|
249
255
|
indexRateId?: string | number | null;
|
|
250
256
|
paymentPeriodId?: string;
|
|
251
257
|
addCovers: AddCover[];
|
|
258
|
+
insrCount?: number;
|
|
259
|
+
insTermInMonth?: number;
|
|
260
|
+
insSumType?: number;
|
|
261
|
+
insSumMultiplier?: number;
|
|
262
|
+
fixInsSum?: number | null;
|
|
263
|
+
agentCommission?: string | number | null;
|
|
264
|
+
clients?: ClientV2[];
|
|
252
265
|
};
|
|
253
266
|
|
|
267
|
+
interface ClientV2 {
|
|
268
|
+
id: string | number;
|
|
269
|
+
iin: string;
|
|
270
|
+
fullName: string;
|
|
271
|
+
sex: number;
|
|
272
|
+
birthDate: string;
|
|
273
|
+
insSum: number;
|
|
274
|
+
premium?: number;
|
|
275
|
+
position?: string;
|
|
276
|
+
lifeMultiply?: number;
|
|
277
|
+
lifeAdditive?: number;
|
|
278
|
+
disabilityMultiply?: number;
|
|
279
|
+
traumaTableMultiple?: number;
|
|
280
|
+
accidentalLifeMultiply?: number;
|
|
281
|
+
accidentalLifeAdditive?: number;
|
|
282
|
+
criticalMultiply?: string;
|
|
283
|
+
criticalAdditive?: string;
|
|
284
|
+
}
|
|
285
|
+
|
|
254
286
|
type RecalculationResponseType = {
|
|
255
287
|
amount: number;
|
|
256
288
|
premium: number;
|
|
@@ -263,6 +295,8 @@ declare global {
|
|
|
263
295
|
amountInCurrency: number;
|
|
264
296
|
premiumInCurrency: number;
|
|
265
297
|
annuityMonthPay: string | number | null;
|
|
298
|
+
mainPremium?: number;
|
|
299
|
+
clients?: ClientV2[];
|
|
266
300
|
};
|
|
267
301
|
|
|
268
302
|
interface AddCover {
|
|
@@ -277,6 +311,10 @@ declare global {
|
|
|
277
311
|
amount: number;
|
|
278
312
|
premium: number;
|
|
279
313
|
isMigrate: boolean;
|
|
314
|
+
coverPeriodId?: string;
|
|
315
|
+
coverPeriodName?: string;
|
|
316
|
+
coverPeriodCode?: string;
|
|
317
|
+
calculatorValue?: number;
|
|
280
318
|
}
|
|
281
319
|
|
|
282
320
|
type SignUrlType = {
|
|
@@ -507,6 +545,17 @@ declare global {
|
|
|
507
545
|
amountInCurrency?: number | null;
|
|
508
546
|
premiumInCurrency?: number | null;
|
|
509
547
|
currencyExchangeRate?: number | null;
|
|
548
|
+
age?: string | number | null;
|
|
549
|
+
lifeTripCountries?: string[] | null;
|
|
550
|
+
tripPurposeId?: string | number | null;
|
|
551
|
+
insuredAmountId?: string | number | null;
|
|
552
|
+
workTypeId?: string | number | null;
|
|
553
|
+
sportsTypeId?: string | number | null;
|
|
554
|
+
singleTripDays?: string | number | null;
|
|
555
|
+
multipleTripMaxDays?: string | number | null;
|
|
556
|
+
tripInsurancePeriod?: string | number | null;
|
|
557
|
+
startDate?: string | null;
|
|
558
|
+
endDate?: string | null;
|
|
510
559
|
};
|
|
511
560
|
|
|
512
561
|
type InsisWorkDataApp = {
|
|
@@ -526,7 +575,47 @@ declare global {
|
|
|
526
575
|
insuranceProgramType?: string;
|
|
527
576
|
};
|
|
528
577
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
578
|
+
type TripInsuranceAmount = {
|
|
579
|
+
amounts: Value[];
|
|
580
|
+
currency: string;
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
type TripInsuranceDaysOptions = {
|
|
584
|
+
period: {
|
|
585
|
+
'90': string[];
|
|
586
|
+
'180': string[];
|
|
587
|
+
'270': string[];
|
|
588
|
+
'365': string[];
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
type getTripInsuredAmountRequest = {
|
|
592
|
+
tripTypeID: string | number | null;
|
|
593
|
+
countryID: string[];
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
type SetApplicationRequest = {
|
|
597
|
+
processInstanceId?: string | number | null;
|
|
598
|
+
id?: string | null;
|
|
599
|
+
addCoversDto?: AddCover[];
|
|
600
|
+
insuredAmountId?: string | number | null;
|
|
601
|
+
age?: string | number | null;
|
|
602
|
+
lifeTripCountries?: string[] | null;
|
|
603
|
+
tripPurposeId?: string | number | null;
|
|
604
|
+
workTypeId?: string | number | null;
|
|
605
|
+
sportsTypeId?: string | number | null;
|
|
606
|
+
singleTripDays?: number;
|
|
607
|
+
multipleTripMaxDays?: number;
|
|
608
|
+
tripInsurancePeriod?: number;
|
|
609
|
+
startDate?: string | null;
|
|
610
|
+
endDate?: string | null;
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
type KGDResponse = {
|
|
614
|
+
responseCode: string;
|
|
615
|
+
content: string | null;
|
|
616
|
+
lastName: string;
|
|
617
|
+
firstName: string;
|
|
618
|
+
middleName: string;
|
|
619
|
+
name: string;
|
|
620
|
+
};
|
|
532
621
|
}
|
package/api/efo.api.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Methods } from '../types/enum';
|
|
2
|
-
import { useAxiosInstance } from '../composables/axios';
|
|
3
|
-
|
|
4
|
-
export class EfoApiClass {
|
|
5
|
-
private readonly baseURL = import.meta.env.VITE_MODE === 'production' ? 'https://products.halyklife.kz/efo/api/' : 'https://products.halyklife.kz/dev/efo/api/';
|
|
6
|
-
private readonly productUrl: string = import.meta.env.VITE_PRODUCT_URL as string;
|
|
7
|
-
|
|
8
|
-
private async axiosCall<T>(config: AxiosRequestLocalConfig): Promise<T> {
|
|
9
|
-
const { data } = await useAxiosInstance(this.baseURL + this.productUrl).request<T>(config);
|
|
10
|
-
return data;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async getDefaultCalculationData<T>() {
|
|
14
|
-
return await this.axiosCall<T>({
|
|
15
|
-
method: Methods.GET,
|
|
16
|
-
url: `/DefaultCalculatorValues`,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async getCalculation<T, U>(data: U) {
|
|
21
|
-
return await this.axiosCall<T>({
|
|
22
|
-
method: Methods.POST,
|
|
23
|
-
url: `/Calculator`,
|
|
24
|
-
data: data,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|