hl-core 0.0.8-beta.39 → 0.0.8-beta.40
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/index.ts +32 -25
- package/components/Form/FormBlock.vue +28 -17
- package/components/Form/ManagerAttachment.vue +1 -1
- package/components/Form/ProductConditionsBlock.vue +3 -1
- package/components/Pages/Anketa.vue +9 -3
- package/components/Pages/MemberForm.vue +32 -34
- package/components/Pages/ProductConditions.vue +14 -14
- package/components/Panel/PanelHandler.vue +3 -3
- package/composables/classes.ts +61 -81
- package/composables/constants.ts +22 -59
- package/composables/index.ts +18 -15
- package/package.json +1 -1
- package/store/{data.store.js → data.store.ts} +813 -765
- package/store/member.store.ts +50 -63
- package/store/{rules.js → rules.ts} +30 -30
- package/types/enum.ts +83 -0
- package/types/index.ts +181 -18
package/store/member.store.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { useFormStore } from './form.store';
|
|
|
4
4
|
import { ErrorHandler } from '../composables';
|
|
5
5
|
import { AxiosError } from 'axios';
|
|
6
6
|
import { Member } from '../composables/classes';
|
|
7
|
+
import { MemberAppCodes, MemberCodes, StoreMembers } from '../types/enum';
|
|
7
8
|
|
|
8
9
|
export const useMemberStore = defineStore('members', {
|
|
9
10
|
state: () => ({
|
|
@@ -12,7 +13,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
12
13
|
formStore: useFormStore(),
|
|
13
14
|
}),
|
|
14
15
|
actions: {
|
|
15
|
-
isStatementEditible(whichForm:
|
|
16
|
+
isStatementEditible(whichForm: keyof typeof StoreMembers | 'productConditionsForm', showToaster: boolean = false) {
|
|
16
17
|
if (!this.validateInitiator(false)) return false;
|
|
17
18
|
if (this.formStore.isDisabled[whichForm as keyof typeof this.formStore.isDisabled] === true) {
|
|
18
19
|
if (showToaster) this.dataStore.showToaster('error', this.dataStore.t('toaster.viewErrorText'), 2000);
|
|
@@ -27,22 +28,24 @@ export const useMemberStore = defineStore('members', {
|
|
|
27
28
|
}
|
|
28
29
|
return true;
|
|
29
30
|
},
|
|
30
|
-
hasMemberData(whichForm:
|
|
31
|
-
if (!this.isStatementEditible(whichForm
|
|
32
|
-
return
|
|
31
|
+
hasMemberData(whichForm: keyof typeof StoreMembers, whichIndex?: number, key: keyof typeof this.formStore.policyholderForm = 'id', emptyValue: any = 0) {
|
|
32
|
+
if (!this.isStatementEditible(whichForm)) return false;
|
|
33
|
+
return whichForm !== 'policyholderForm' && whichForm !== 'policyholdersRepresentativeForm'
|
|
34
|
+
? this.formStore[whichForm][whichIndex!][key] != emptyValue
|
|
35
|
+
: this.formStore[whichForm][key] != emptyValue;
|
|
33
36
|
},
|
|
34
|
-
canMemberCleared(whichForm:
|
|
37
|
+
canMemberCleared(whichForm: keyof typeof StoreMembers, whichIndex?: number) {
|
|
35
38
|
if (!whichForm) return false;
|
|
36
|
-
if (!this.isStatementEditible(whichForm
|
|
37
|
-
if (
|
|
38
|
-
return this.formStore[whichForm][whichIndex].id === 0 && (!!this.formStore[whichForm][whichIndex].iin || !!this.formStore[whichForm][whichIndex].phoneNumber);
|
|
39
|
+
if (!this.isStatementEditible(whichForm)) return false;
|
|
40
|
+
if (whichForm !== 'policyholderForm' && whichForm !== 'policyholdersRepresentativeForm') {
|
|
41
|
+
return this.formStore[whichForm][whichIndex!].id === 0 && (!!this.formStore[whichForm][whichIndex!].iin || !!this.formStore[whichForm][whichIndex!].phoneNumber);
|
|
39
42
|
} else {
|
|
40
43
|
return this.formStore[whichForm].id === 0 && (!!this.formStore[whichForm].iin || !!this.formStore[whichForm].phoneNumber);
|
|
41
44
|
}
|
|
42
45
|
},
|
|
43
|
-
canMemberDeleted(whichForm:
|
|
46
|
+
canMemberDeleted(whichForm: keyof typeof StoreMembers, whichIndex?: number) {
|
|
44
47
|
if (!whichForm) return false;
|
|
45
|
-
if (!this.isStatementEditible(whichForm
|
|
48
|
+
if (!this.isStatementEditible(whichForm)) return false;
|
|
46
49
|
if (typeof whichIndex === 'number') {
|
|
47
50
|
if (whichIndex > 0) {
|
|
48
51
|
return true;
|
|
@@ -58,7 +61,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
58
61
|
}
|
|
59
62
|
return false;
|
|
60
63
|
},
|
|
61
|
-
getMemberFromStore(whichForm:
|
|
64
|
+
getMemberFromStore(whichForm: keyof typeof StoreMembers, whichIndex?: number): Member | null {
|
|
62
65
|
switch (whichForm) {
|
|
63
66
|
case this.formStore.policyholderFormKey:
|
|
64
67
|
return this.formStore.policyholderForm;
|
|
@@ -74,8 +77,8 @@ export const useMemberStore = defineStore('members', {
|
|
|
74
77
|
return null;
|
|
75
78
|
}
|
|
76
79
|
},
|
|
77
|
-
getMemberFromApplication(whichForm:
|
|
78
|
-
const id =
|
|
80
|
+
getMemberFromApplication(whichForm: keyof typeof StoreMembers, whichIndex?: number) {
|
|
81
|
+
const id = whichForm !== 'policyholderForm' && whichForm !== 'policyholdersRepresentativeForm' ? this.formStore[whichForm][whichIndex!].id : this.formStore[whichForm].id;
|
|
79
82
|
switch (whichForm) {
|
|
80
83
|
case this.formStore.policyholderFormKey:
|
|
81
84
|
return this.formStore.applicationData.clientApp;
|
|
@@ -95,70 +98,53 @@ export const useMemberStore = defineStore('members', {
|
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
},
|
|
98
|
-
|
|
99
|
-
if (!whichForm) return false;
|
|
100
|
-
switch (whichForm) {
|
|
101
|
-
case this.formStore.policyholderFormKey:
|
|
102
|
-
return new PolicyholderForm();
|
|
103
|
-
case this.formStore.insuredFormKey:
|
|
104
|
-
return new InsuredForm();
|
|
105
|
-
case this.formStore.beneficiaryFormKey:
|
|
106
|
-
return new BeneficiaryForm();
|
|
107
|
-
case this.formStore.beneficialOwnerFormKey:
|
|
108
|
-
return new BeneficialOwnerForm();
|
|
109
|
-
case this.formStore.policyholdersRepresentativeFormKey:
|
|
110
|
-
return new PolicyholdersRepresentativeForm();
|
|
111
|
-
default:
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
getMemberCode(whichForm: MemberKeys) {
|
|
101
|
+
getMemberCode(whichForm: keyof typeof StoreMembers) {
|
|
116
102
|
switch (whichForm) {
|
|
117
103
|
case this.formStore.policyholderFormKey:
|
|
118
|
-
return
|
|
104
|
+
return MemberCodes.Client;
|
|
119
105
|
case this.formStore.insuredFormKey:
|
|
120
|
-
return
|
|
106
|
+
return MemberCodes.Insured;
|
|
121
107
|
case this.formStore.beneficiaryFormKey:
|
|
122
|
-
return
|
|
108
|
+
return MemberCodes.Beneficiary;
|
|
123
109
|
case this.formStore.beneficialOwnerFormKey:
|
|
124
|
-
return
|
|
110
|
+
return MemberCodes.BeneficialOwner;
|
|
125
111
|
case this.formStore.policyholdersRepresentativeFormKey:
|
|
126
|
-
return
|
|
112
|
+
return MemberCodes.Spokesman;
|
|
127
113
|
}
|
|
128
114
|
},
|
|
129
|
-
getMemberApplicationCode(whichForm:
|
|
115
|
+
getMemberApplicationCode(whichForm: keyof typeof StoreMembers) {
|
|
130
116
|
switch (whichForm) {
|
|
131
117
|
case this.formStore.policyholderFormKey:
|
|
132
|
-
return
|
|
118
|
+
return MemberAppCodes.clientApp;
|
|
133
119
|
case this.formStore.insuredFormKey:
|
|
134
|
-
return
|
|
120
|
+
return MemberAppCodes.insuredApp;
|
|
135
121
|
case this.formStore.beneficiaryFormKey:
|
|
136
|
-
return
|
|
122
|
+
return MemberAppCodes.beneficiaryApp;
|
|
137
123
|
case this.formStore.beneficialOwnerFormKey:
|
|
138
|
-
return
|
|
124
|
+
return MemberAppCodes.beneficialOwnerApp;
|
|
139
125
|
case this.formStore.policyholdersRepresentativeFormKey:
|
|
140
|
-
return
|
|
126
|
+
return MemberAppCodes.spokesmanApp;
|
|
141
127
|
}
|
|
142
128
|
},
|
|
143
|
-
clearMember(whichForm:
|
|
129
|
+
clearMember(whichForm: keyof typeof StoreMembers, whichIndex?: number) {
|
|
144
130
|
if (!whichForm) return false;
|
|
145
|
-
if (!this.isStatementEditible(whichForm
|
|
131
|
+
if (!this.isStatementEditible(whichForm)) return false;
|
|
146
132
|
if (whichForm === this.formStore.policyholderFormKey || whichForm === this.formStore.policyholdersRepresentativeFormKey) {
|
|
147
133
|
//@ts-ignore
|
|
148
|
-
this.formStore[whichForm] =
|
|
134
|
+
this.formStore[whichForm] = new Member();
|
|
149
135
|
}
|
|
150
|
-
if (
|
|
136
|
+
if (whichForm !== 'policyholderForm' && whichForm !== 'policyholdersRepresentativeForm') {
|
|
151
137
|
if (this.formStore[whichForm].length === 1) {
|
|
152
|
-
this.formStore[whichForm][whichIndex] =
|
|
138
|
+
this.formStore[whichForm][whichIndex!] = new Member();
|
|
153
139
|
} else {
|
|
154
|
-
this.formStore[whichForm].splice(whichIndex
|
|
140
|
+
this.formStore[whichForm].splice(whichIndex!, 1);
|
|
155
141
|
}
|
|
156
142
|
}
|
|
157
143
|
return true;
|
|
158
144
|
},
|
|
159
|
-
async deleteMember(taskId: string, whichForm:
|
|
145
|
+
async deleteMember(taskId: string, whichForm: keyof typeof StoreMembers, whichIndex?: number, refetch: boolean = true) {
|
|
160
146
|
if (!whichForm) return false;
|
|
161
|
-
if (!this.isStatementEditible(whichForm
|
|
147
|
+
if (!this.isStatementEditible(whichForm)) return false;
|
|
162
148
|
try {
|
|
163
149
|
const memberCode = this.getMemberCode(whichForm);
|
|
164
150
|
const memberData = this.getMemberFromApplication(whichForm, whichIndex);
|
|
@@ -183,7 +169,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
183
169
|
return ErrorHandler(err);
|
|
184
170
|
}
|
|
185
171
|
},
|
|
186
|
-
async transferPolicyholder(to:
|
|
172
|
+
async transferPolicyholder(to: MultipleMember) {
|
|
187
173
|
if (!to) return false;
|
|
188
174
|
if (!this.validateInitiator()) return false;
|
|
189
175
|
const fromMember = this.formStore.policyholderForm;
|
|
@@ -222,11 +208,11 @@ export const useMemberStore = defineStore('members', {
|
|
|
222
208
|
if (toIndex.value !== null && taskId !== '0' && this.formStore.applicationData.processInstanceId !== 0) {
|
|
223
209
|
if (
|
|
224
210
|
typeof this.formStore[to][toIndex.value].id !== 'number' ||
|
|
225
|
-
(typeof this.formStore[to][toIndex.value].id === 'number' && this.formStore[to][toIndex.value].id > 0 === false)
|
|
211
|
+
(typeof this.formStore[to][toIndex.value].id === 'number' && Number(this.formStore[to][toIndex.value].id) > 0 === false)
|
|
226
212
|
) {
|
|
227
213
|
return false;
|
|
228
214
|
}
|
|
229
|
-
const hasSaved = await this.dataStore.saveMember(this.formStore[to][toIndex.value], this.getMemberCode(to)
|
|
215
|
+
const hasSaved = await this.dataStore.saveMember(this.formStore[to][toIndex.value], this.getMemberCode(to)!, this.getMemberFromApplication(to, toIndex.value));
|
|
230
216
|
if (hasSaved) {
|
|
231
217
|
await this.dataStore.getApplicationData(taskId, false, true, true, deletedBefore.value);
|
|
232
218
|
this.dataStore.showToaster('warning', this.dataStore.t('toaster.formFieldEmptyWarning'));
|
|
@@ -244,7 +230,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
244
230
|
return false;
|
|
245
231
|
}
|
|
246
232
|
},
|
|
247
|
-
async retransferPolicyholder(from:
|
|
233
|
+
async retransferPolicyholder(from: MultipleMember) {
|
|
248
234
|
if (!from) return false;
|
|
249
235
|
if (!this.validateInitiator()) return false;
|
|
250
236
|
const client = this.formStore.policyholderForm;
|
|
@@ -262,21 +248,22 @@ export const useMemberStore = defineStore('members', {
|
|
|
262
248
|
}
|
|
263
249
|
} else {
|
|
264
250
|
// @ts-ignore
|
|
265
|
-
this.formStore[from] = [
|
|
251
|
+
this.formStore[from] = [new Member()];
|
|
266
252
|
}
|
|
267
253
|
},
|
|
268
|
-
addMember(whichForm:
|
|
254
|
+
addMember(whichForm: keyof typeof StoreMembers) {
|
|
269
255
|
if (!whichForm) return false;
|
|
270
|
-
if (!this.isStatementEditible(whichForm
|
|
256
|
+
if (!this.isStatementEditible(whichForm)) return false;
|
|
257
|
+
if (whichForm === 'policyholderForm' || whichForm === 'policyholdersRepresentativeForm') return false;
|
|
271
258
|
const limit = this.dataStore.members[this.getMemberApplicationCode(whichForm)!].limit;
|
|
272
259
|
if (typeof limit === 'number') {
|
|
273
260
|
if (this.formStore[whichForm].length < limit) {
|
|
274
|
-
this.formStore[whichForm].push(
|
|
261
|
+
this.formStore[whichForm].push(new Member());
|
|
275
262
|
} else {
|
|
276
263
|
this.dataStore.showToaster('error', this.dataStore.t('toaster.membersLimit', { text: limit }));
|
|
277
264
|
}
|
|
278
265
|
} else {
|
|
279
|
-
this.formStore[whichForm].push(
|
|
266
|
+
this.formStore[whichForm].push(new Member());
|
|
280
267
|
}
|
|
281
268
|
},
|
|
282
269
|
async getOtpStatus(iin: string, phone: string, processInstanceId: string | number | null = null) {
|
|
@@ -312,11 +299,11 @@ export const useMemberStore = defineStore('members', {
|
|
|
312
299
|
};
|
|
313
300
|
const otpResponse = await this.dataStore.api.checkOtp(otpData);
|
|
314
301
|
if (otpResponse !== null) {
|
|
315
|
-
if ('errMessage' in otpResponse && otpResponse.errMessage
|
|
302
|
+
if ('errMessage' in otpResponse && otpResponse.errMessage) {
|
|
316
303
|
this.dataStore.showToaster('error', otpResponse.errMessage, 3000);
|
|
317
304
|
return false;
|
|
318
305
|
}
|
|
319
|
-
if ('status' in otpResponse && !!otpResponse.status) {
|
|
306
|
+
if ('status' in otpResponse && !!otpResponse.status && otpResponse.statusName) {
|
|
320
307
|
// TODO Доработать и менять значение hasAgreement.value => true
|
|
321
308
|
this.dataStore.showToaster(otpResponse.status !== 2 ? 'error' : 'success', otpResponse.statusName, 3000);
|
|
322
309
|
if (otpResponse.status === 2) {
|
|
@@ -367,7 +354,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
367
354
|
);
|
|
368
355
|
this.dataStore.isLoading = false;
|
|
369
356
|
if (!!otpResponse) {
|
|
370
|
-
if ('errMessage' in otpResponse && otpResponse.errMessage
|
|
357
|
+
if ('errMessage' in otpResponse && otpResponse.errMessage) {
|
|
371
358
|
this.dataStore.showToaster('error', otpResponse.errMessage, 3000);
|
|
372
359
|
return { otpStatus: false };
|
|
373
360
|
}
|
|
@@ -377,7 +364,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
377
364
|
return { otpStatus: false };
|
|
378
365
|
}
|
|
379
366
|
if ('status' in otpResponse && !!otpResponse.status) {
|
|
380
|
-
this.dataStore.showToaster('error', otpResponse.status, 3000);
|
|
367
|
+
this.dataStore.showToaster('error', String(otpResponse.status), 3000);
|
|
381
368
|
return { otpStatus: false };
|
|
382
369
|
}
|
|
383
370
|
}
|
|
@@ -4,11 +4,11 @@ import { formatDate } from '../composables';
|
|
|
4
4
|
const t = i18n.t;
|
|
5
5
|
|
|
6
6
|
export const rules = {
|
|
7
|
-
recalculationMultiply: [v => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher', { text: '100' })],
|
|
8
|
-
recalculationAdditive: [v => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween', { floor: '0', ceil: '100' })],
|
|
9
|
-
required: [v => !!v || t('rules.required')],
|
|
7
|
+
recalculationMultiply: [(v: any) => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher', { text: '100' })],
|
|
8
|
+
recalculationAdditive: [(v: any) => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween', { floor: '0', ceil: '100' })],
|
|
9
|
+
required: [(v: any) => !!v || t('rules.required')],
|
|
10
10
|
objectRequired: [
|
|
11
|
-
v => {
|
|
11
|
+
(v: any) => {
|
|
12
12
|
if (!!v && 'nameRu' in v && v.nameRu != null) {
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ export const rules = {
|
|
|
16
16
|
},
|
|
17
17
|
],
|
|
18
18
|
agentDataRequired: [
|
|
19
|
-
v => {
|
|
19
|
+
(v: any) => {
|
|
20
20
|
if (!!v && 'fullName' in v && v.fullName != null) {
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
@@ -24,7 +24,7 @@ export const rules = {
|
|
|
24
24
|
},
|
|
25
25
|
],
|
|
26
26
|
noResident: [
|
|
27
|
-
v => {
|
|
27
|
+
(v: any) => {
|
|
28
28
|
if (!!v && 'nameRu' in v && v.nameRu === 'Нерезидент') {
|
|
29
29
|
return t('rules.noResident');
|
|
30
30
|
}
|
|
@@ -34,9 +34,9 @@ export const rules = {
|
|
|
34
34
|
return t('rules.required');
|
|
35
35
|
},
|
|
36
36
|
],
|
|
37
|
-
cyrillic: [v => v === null || /^[\u0400-\u04FF ]+$/.test(v) || t('rules.cyrillic')],
|
|
37
|
+
cyrillic: [(v: any) => v === null || /^[\u0400-\u04FF ]+$/.test(v) || t('rules.cyrillic')],
|
|
38
38
|
cyrillicNonRequired: [
|
|
39
|
-
v => {
|
|
39
|
+
(v: any) => {
|
|
40
40
|
if (!v) return true;
|
|
41
41
|
else {
|
|
42
42
|
return /^[\u0400-\u04FF ]+$/.test(v) || t('rules.cyrillic');
|
|
@@ -44,7 +44,7 @@ export const rules = {
|
|
|
44
44
|
},
|
|
45
45
|
],
|
|
46
46
|
email: [
|
|
47
|
-
v => {
|
|
47
|
+
(v: any) => {
|
|
48
48
|
if (v === '' || v === null) {
|
|
49
49
|
return true;
|
|
50
50
|
} else {
|
|
@@ -60,11 +60,11 @@ export const rules = {
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
],
|
|
63
|
-
numbers: [v => /^[0-9]+$/.test(v) || t('rules.numbers')],
|
|
64
|
-
numbersSymbols: [v => /^([0-9])|(\W|_)+$/.test(v) || t('rules.numbersSymbols')],
|
|
65
|
-
ageExceeds: [v => v < 50 || t('rules.ageExceeds')],
|
|
63
|
+
numbers: [(v: any) => /^[0-9]+$/.test(v) || t('rules.numbers')],
|
|
64
|
+
numbersSymbols: [(v: any) => /^([0-9])|(\W|_)+$/.test(v) || t('rules.numbersSymbols')],
|
|
65
|
+
ageExceeds: [(v: any) => v < 50 || t('rules.ageExceeds')],
|
|
66
66
|
sums: [
|
|
67
|
-
v => {
|
|
67
|
+
(v: any) => {
|
|
68
68
|
let str = v.replace(/\s/g, '');
|
|
69
69
|
if (/^[0-9]+$/.test(str)) {
|
|
70
70
|
return true;
|
|
@@ -73,16 +73,16 @@ export const rules = {
|
|
|
73
73
|
},
|
|
74
74
|
],
|
|
75
75
|
iinRight: [
|
|
76
|
-
v => {
|
|
76
|
+
(v: any) => {
|
|
77
77
|
if (v.length !== useMask().iin.length) {
|
|
78
78
|
return t('rules.iinRight');
|
|
79
79
|
}
|
|
80
80
|
return true;
|
|
81
81
|
},
|
|
82
82
|
],
|
|
83
|
-
onlySymbols: [v => !/^\d+$/.test(v) || t('rules.onlySymbols')],
|
|
83
|
+
onlySymbols: [(v: any) => !/^\d+$/.test(v) || t('rules.onlySymbols')],
|
|
84
84
|
phoneFormat: [
|
|
85
|
-
v => {
|
|
85
|
+
(v: any) => {
|
|
86
86
|
if (v === null || v == '') {
|
|
87
87
|
return true;
|
|
88
88
|
}
|
|
@@ -94,7 +94,7 @@ export const rules = {
|
|
|
94
94
|
},
|
|
95
95
|
],
|
|
96
96
|
date: [
|
|
97
|
-
v => {
|
|
97
|
+
(v: any) => {
|
|
98
98
|
if (v === null || v == '') return true;
|
|
99
99
|
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)) {
|
|
100
100
|
return true;
|
|
@@ -103,12 +103,12 @@ export const rules = {
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
],
|
|
106
|
-
age: [v => /^\d+$/.test(v) || t('rules.age')],
|
|
107
|
-
age18: [v => v >= 18 || t('rules.age18')],
|
|
108
|
-
age18ByDate: [v => Math.abs(new Date(Date.now() - new Date(formatDate(v)).getTime()).getUTCFullYear() - 1970) >= 18 || t('rules.age18')],
|
|
106
|
+
age: [(v: any) => /^\d+$/.test(v) || t('rules.age')],
|
|
107
|
+
age18: [(v: any) => v >= 18 || t('rules.age18')],
|
|
108
|
+
age18ByDate: [(v: any) => Math.abs(new Date(Date.now() - new Date(formatDate(v)!).getTime()).getUTCFullYear() - 1970) >= 18 || t('rules.age18')],
|
|
109
109
|
birthDate: [
|
|
110
|
-
v => {
|
|
111
|
-
if (new Date(formatDate(v)) > new Date(Date.now())) return t('rules.exceedDate');
|
|
110
|
+
(v: any) => {
|
|
111
|
+
if (new Date(formatDate(v)!) > new Date(Date.now())) return t('rules.exceedDate');
|
|
112
112
|
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)) {
|
|
113
113
|
return true;
|
|
114
114
|
} else {
|
|
@@ -117,7 +117,7 @@ export const rules = {
|
|
|
117
117
|
},
|
|
118
118
|
],
|
|
119
119
|
coverPeriod: [
|
|
120
|
-
v => {
|
|
120
|
+
(v: any) => {
|
|
121
121
|
if (v !== null) {
|
|
122
122
|
if (v < 5) {
|
|
123
123
|
return t('rules.coverPeriod');
|
|
@@ -129,7 +129,7 @@ export const rules = {
|
|
|
129
129
|
},
|
|
130
130
|
],
|
|
131
131
|
coverPeriodFrom2to20: [
|
|
132
|
-
v => {
|
|
132
|
+
(v: any) => {
|
|
133
133
|
if (v !== null) {
|
|
134
134
|
if (v < 2 || v > 20) {
|
|
135
135
|
return t('productConditionsForm.coverPeriodFrom2to20');
|
|
@@ -141,7 +141,7 @@ export const rules = {
|
|
|
141
141
|
},
|
|
142
142
|
],
|
|
143
143
|
coverPeriodFrom3to20: [
|
|
144
|
-
v => {
|
|
144
|
+
(v: any) => {
|
|
145
145
|
if (v !== null) {
|
|
146
146
|
if (v < 3 || v > 20) {
|
|
147
147
|
return t('productConditionsForm.coverPeriodFrom3to20');
|
|
@@ -153,7 +153,7 @@ export const rules = {
|
|
|
153
153
|
},
|
|
154
154
|
],
|
|
155
155
|
requestedSumInsuredMycar: [
|
|
156
|
-
v => {
|
|
156
|
+
(v: any) => {
|
|
157
157
|
if (v !== null) {
|
|
158
158
|
if (v.replace(/\s/g, '') > 60000000) {
|
|
159
159
|
return t('rules.requestedSumInsuredMycar');
|
|
@@ -163,7 +163,7 @@ export const rules = {
|
|
|
163
163
|
},
|
|
164
164
|
],
|
|
165
165
|
ageMycar: [
|
|
166
|
-
v => {
|
|
166
|
+
(v: any) => {
|
|
167
167
|
if (v !== null) {
|
|
168
168
|
let n = Number(v);
|
|
169
169
|
if (n <= 21 || n >= 65) {
|
|
@@ -173,9 +173,9 @@ export const rules = {
|
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
175
|
],
|
|
176
|
-
policyholderAgeLimit: [v => v >= 18 || t('rules.policyholderAgeLimit')],
|
|
177
|
-
beneficiaryAgeLimit: [v => v <= 15 || t('rules.beneficiaryAgeLimit')],
|
|
178
|
-
guaranteedPeriodLimit(v, termAnnuityPayments) {
|
|
176
|
+
policyholderAgeLimit: [(v: any) => v >= 18 || t('rules.policyholderAgeLimit')],
|
|
177
|
+
beneficiaryAgeLimit: [(v: any) => v <= 15 || t('rules.beneficiaryAgeLimit')],
|
|
178
|
+
guaranteedPeriodLimit(v: any, termAnnuityPayments: any) {
|
|
179
179
|
if (Number(v) > Number(termAnnuityPayments)) {
|
|
180
180
|
return t('rules.guaranteedPeriodLimit');
|
|
181
181
|
}
|
package/types/enum.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export enum StoreMembers {
|
|
2
|
+
policyholderForm = 'policyholderForm',
|
|
3
|
+
insuredForm = 'insuredForm',
|
|
4
|
+
beneficiaryForm = 'beneficiaryForm',
|
|
5
|
+
beneficialOwnerForm = 'beneficialOwnerForm',
|
|
6
|
+
policyholdersRepresentativeForm = 'policyholdersRepresentativeForm',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum Actions {
|
|
10
|
+
accept = 'accept',
|
|
11
|
+
rejectclient = 'rejectclient',
|
|
12
|
+
reject = 'reject',
|
|
13
|
+
return = 'return',
|
|
14
|
+
claim = 'claim',
|
|
15
|
+
sign = 'sign',
|
|
16
|
+
pay = 'pay',
|
|
17
|
+
register = 'register',
|
|
18
|
+
send = 'send',
|
|
19
|
+
affiliate = 'affiliate',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export enum PostActions {
|
|
23
|
+
font = 'font',
|
|
24
|
+
route = 'route',
|
|
25
|
+
onRouteChange = 'onRouteChange',
|
|
26
|
+
applicationCreated = 'applicationCreated',
|
|
27
|
+
clipboard = 'clipboard',
|
|
28
|
+
toHomePage = 'toHomePage',
|
|
29
|
+
toStatementHistory = 'toStatementHistory',
|
|
30
|
+
toAuth = 'toAuth',
|
|
31
|
+
DOMevent = 'DOMevent',
|
|
32
|
+
Error401 = 'Error401',
|
|
33
|
+
Error500 = 'Error500',
|
|
34
|
+
iframeLoaded = 'iframeLoaded',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export enum Roles {
|
|
38
|
+
Manager = 'Manager',
|
|
39
|
+
Admin = 'Admin',
|
|
40
|
+
Underwriter = 'Underwriter',
|
|
41
|
+
Agent = 'Agent',
|
|
42
|
+
Compliance = 'Compliance',
|
|
43
|
+
AgentMycar = 'AgentMycar',
|
|
44
|
+
Analyst = 'Analyst',
|
|
45
|
+
UPK = 'UPK',
|
|
46
|
+
FinCenter = 'FinCenter',
|
|
47
|
+
Supervisor = 'Supervisor',
|
|
48
|
+
Support = 'Support',
|
|
49
|
+
ManagerHalykBank = 'ManagerHalykBank',
|
|
50
|
+
ServiceManager = 'ServiceManager',
|
|
51
|
+
DRNSJ = 'DRNSJ',
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export enum Statuses {
|
|
55
|
+
StartForm = 'StartForm',
|
|
56
|
+
EditForm = 'EditForm',
|
|
57
|
+
EditBeneficiaryForm = 'EditBeneficiaryForm',
|
|
58
|
+
DocumentsSignedFrom = 'DocumentsSignedFrom',
|
|
59
|
+
UnderwriterForm = 'UnderwriterForm',
|
|
60
|
+
AffilationResolutionForm = 'AffilationResolutionForm',
|
|
61
|
+
Completed = 'Completed',
|
|
62
|
+
InsurancePremiumOnlinePaid = 'InsurancePremiumOnlinePaid',
|
|
63
|
+
ContractSignedFrom = 'ContractSignedFrom',
|
|
64
|
+
WaitingInsurancePremiumForm = 'WaitingInsurancePremiumForm',
|
|
65
|
+
CheckFinCenterForm = 'CheckFinCenterForm',
|
|
66
|
+
RegistryFinCenterForm = 'RegistryFinCenterForm',
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export enum MemberCodes {
|
|
70
|
+
Client = 'Client',
|
|
71
|
+
Insured = 'Insured',
|
|
72
|
+
Beneficiary = 'Beneficiary',
|
|
73
|
+
BeneficialOwner = 'BeneficialOwner',
|
|
74
|
+
Spokesman = 'Spokesman',
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export enum MemberAppCodes {
|
|
78
|
+
clientApp = 'clientApp',
|
|
79
|
+
insuredApp = 'insuredApp',
|
|
80
|
+
beneficiaryApp = 'beneficiaryApp',
|
|
81
|
+
beneficialOwnerApp = 'beneficialOwnerApp',
|
|
82
|
+
spokesmanApp = 'spokesmanApp',
|
|
83
|
+
}
|