hl-core 0.0.8-beta.2 → 0.0.8-beta.20
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 +42 -14
- package/api/interceptors.ts +1 -1
- package/components/Dialog/Dialog.vue +6 -3
- package/components/Form/FormBlock.vue +63 -28
- package/components/Form/FormSection.vue +4 -1
- package/components/Form/ManagerAttachment.vue +196 -0
- package/components/Form/ProductConditionsBlock.vue +64 -12
- package/components/Input/FormInput.vue +12 -3
- package/components/Input/PanelInput.vue +5 -0
- package/components/Layout/Drawer.vue +1 -0
- package/components/Layout/Header.vue +40 -4
- package/components/Layout/SettingsPanel.vue +35 -8
- package/components/Menu/MenuHover.vue +30 -0
- package/components/Menu/MenuNav.vue +27 -10
- package/components/Pages/Anketa.vue +8 -4
- package/components/Pages/Auth.vue +147 -30
- package/components/Pages/InvoiceInfo.vue +30 -0
- package/components/Pages/MemberForm.vue +274 -79
- package/components/Pages/ProductConditions.vue +291 -7
- package/components/Panel/PanelHandler.vue +74 -1
- package/components/Utilities/JsonViewer.vue +27 -0
- package/composables/classes.ts +126 -23
- package/composables/constants.ts +11 -1
- package/composables/styles.ts +9 -3
- package/configs/i18n.ts +19 -0
- package/layouts/default.vue +2 -2
- package/locales/en.json +558 -0
- package/locales/kz.json +558 -0
- package/locales/ru.json +558 -0
- package/nuxt.config.ts +8 -0
- package/package.json +7 -2
- package/pages/500.vue +1 -1
- package/pages/Token.vue +51 -0
- package/plugins/helperFunctionsPlugins.ts +2 -0
- package/plugins/storePlugin.ts +0 -1
- package/plugins/vuetifyPlugin.ts +5 -0
- package/store/data.store.js +472 -530
- package/store/member.store.ts +120 -15
- package/store/rules.js +27 -3
- package/types/index.ts +34 -0
- package/store/messages.ts +0 -434
package/store/member.store.ts
CHANGED
|
@@ -35,8 +35,13 @@ export const useMemberStore = defineStore('members', {
|
|
|
35
35
|
if (!whichForm) return false;
|
|
36
36
|
if (!this.isStatementEditible(whichForm)) return false;
|
|
37
37
|
if (!this.validateInitiator(false)) return false;
|
|
38
|
-
if (typeof whichIndex === 'number'
|
|
39
|
-
|
|
38
|
+
if (typeof whichIndex === 'number') {
|
|
39
|
+
if (whichIndex > 0) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
if (whichIndex === 0) {
|
|
43
|
+
return this.hasMemberData(whichForm, whichIndex);
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
46
|
if (this.dataStore.isTask() && this.dataStore.isProcessEditable(this.formStore.applicationData.statusCode)) {
|
|
42
47
|
if (whichForm !== this.formStore.policyholderFormKey) {
|
|
@@ -113,23 +118,38 @@ export const useMemberStore = defineStore('members', {
|
|
|
113
118
|
return 'Spokesman';
|
|
114
119
|
}
|
|
115
120
|
},
|
|
121
|
+
getMemberApplicationCode(whichForm: MemberKeys) {
|
|
122
|
+
switch (whichForm) {
|
|
123
|
+
case this.formStore.policyholderFormKey:
|
|
124
|
+
return 'clientApp';
|
|
125
|
+
case this.formStore.insuredFormKey:
|
|
126
|
+
return 'insuredApp';
|
|
127
|
+
case this.formStore.beneficiaryFormKey:
|
|
128
|
+
return 'beneficiaryApp';
|
|
129
|
+
case this.formStore.beneficialOwnerFormKey:
|
|
130
|
+
return 'beneficialOwnerApp';
|
|
131
|
+
case this.formStore.policyholdersRepresentativeFormKey:
|
|
132
|
+
return 'spokesmanApp';
|
|
133
|
+
}
|
|
134
|
+
},
|
|
116
135
|
clearMember(whichForm: MemberKeys, whichIndex?: number) {
|
|
117
136
|
if (!whichForm) return false;
|
|
118
137
|
if (!this.isStatementEditible(whichForm)) return false;
|
|
119
138
|
if (!this.validateInitiator()) return false;
|
|
120
139
|
if (whichForm === this.formStore.policyholderFormKey || whichForm === this.formStore.policyholdersRepresentativeFormKey) {
|
|
121
|
-
|
|
140
|
+
//@ts-ignore
|
|
141
|
+
this.formStore[whichForm] = this.getMemberClass(whichForm);
|
|
122
142
|
}
|
|
123
143
|
if (typeof whichIndex === 'number') {
|
|
124
144
|
if (this.formStore[whichForm].length === 1) {
|
|
125
|
-
this.formStore[whichForm][whichIndex].
|
|
145
|
+
this.formStore[whichForm][whichIndex] = this.getMemberClass(whichForm);
|
|
126
146
|
} else {
|
|
127
147
|
this.formStore[whichForm].splice(whichIndex, 1);
|
|
128
148
|
}
|
|
129
149
|
}
|
|
130
150
|
return true;
|
|
131
151
|
},
|
|
132
|
-
async deleteMember(taskId: string, whichForm: MemberKeys, whichIndex?: number) {
|
|
152
|
+
async deleteMember(taskId: string, whichForm: MemberKeys, whichIndex?: number, refetch: boolean = true) {
|
|
133
153
|
if (!whichForm) return false;
|
|
134
154
|
if (!this.isStatementEditible(whichForm)) return false;
|
|
135
155
|
if (!this.validateInitiator()) return false;
|
|
@@ -144,13 +164,95 @@ export const useMemberStore = defineStore('members', {
|
|
|
144
164
|
} else {
|
|
145
165
|
if (memberData) await this.dataStore.api.deleteMember(memberCode, memberData.id as number);
|
|
146
166
|
}
|
|
147
|
-
|
|
148
|
-
|
|
167
|
+
const cleared = this.clearMember(whichForm, whichIndex);
|
|
168
|
+
if (memberData && refetch) await this.dataStore.getApplicationData(taskId, true, true, true, false);
|
|
169
|
+
return cleared;
|
|
149
170
|
} catch (err) {
|
|
150
171
|
console.log(err);
|
|
151
172
|
return ErrorHandler(err);
|
|
152
173
|
}
|
|
153
174
|
},
|
|
175
|
+
async transferPolicyholder(to: MemberKeys) {
|
|
176
|
+
if (!to) return false;
|
|
177
|
+
if (!this.validateInitiator()) return false;
|
|
178
|
+
const fromMember = this.formStore.policyholderForm;
|
|
179
|
+
const successTranser = ref<boolean>(false);
|
|
180
|
+
const toIndex = ref<number | null>(null);
|
|
181
|
+
const taskId = useRoute().params.taskId as string;
|
|
182
|
+
|
|
183
|
+
if (this.dataStore.members[this.getMemberApplicationCode(to)!].isMultiple === false) {
|
|
184
|
+
if (this.formStore[to][0].id !== 0 && this.formStore[to][0].iin !== fromMember.iin) {
|
|
185
|
+
await this.deleteMember(taskId, to, 0, false);
|
|
186
|
+
}
|
|
187
|
+
this.formStore[to][0] = fromMember;
|
|
188
|
+
toIndex.value = 0;
|
|
189
|
+
successTranser.value = true;
|
|
190
|
+
} else {
|
|
191
|
+
if (this.formStore[to].every((member: Member) => member.id !== 0)) {
|
|
192
|
+
this.formStore[to].push(fromMember);
|
|
193
|
+
toIndex.value = this.formStore[to].length - 1;
|
|
194
|
+
successTranser.value = true;
|
|
195
|
+
} else {
|
|
196
|
+
const index = this.formStore[to].findIndex((member: Member) => member.id === 0);
|
|
197
|
+
if (index !== -1) {
|
|
198
|
+
this.formStore[to][index] = fromMember;
|
|
199
|
+
toIndex.value = index;
|
|
200
|
+
successTranser.value = true;
|
|
201
|
+
} else {
|
|
202
|
+
this.formStore[to].push(fromMember);
|
|
203
|
+
toIndex.value = this.formStore[to].length - 1;
|
|
204
|
+
successTranser.value = true;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (successTranser.value === true) {
|
|
210
|
+
if (toIndex.value !== null && taskId !== '0' && this.formStore.applicationData.processInstanceId !== 0) {
|
|
211
|
+
if (
|
|
212
|
+
typeof this.formStore[to][toIndex.value].id !== 'number' ||
|
|
213
|
+
(typeof this.formStore[to][toIndex.value].id === 'number' && this.formStore[to][toIndex.value].id > 0 === false)
|
|
214
|
+
) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
const hasSaved = await this.dataStore.saveMember(this.formStore[to][toIndex.value], this.getMemberCode(to), this.getMemberFromApplication(to, toIndex.value));
|
|
218
|
+
if (hasSaved) {
|
|
219
|
+
await this.dataStore.getApplicationData(taskId, false, true, true, false);
|
|
220
|
+
this.dataStore.showToaster('success', this.dataStore.t('toaster.successSaved'));
|
|
221
|
+
this.dataStore.showToaster('warning', this.dataStore.t('toaster.formFieldEmptyWarning'), 3000);
|
|
222
|
+
return true;
|
|
223
|
+
} else {
|
|
224
|
+
this.dataStore.showToaster('error', this.dataStore.t('error.memberSave'));
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
this.dataStore.showToaster('error', this.dataStore.t('error.memberCopy'));
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
async retransferPolicyholder(from: MemberKeys) {
|
|
236
|
+
if (!from) return false;
|
|
237
|
+
if (!this.validateInitiator()) return false;
|
|
238
|
+
const client = this.formStore.policyholderForm;
|
|
239
|
+
const index = this.formStore[from].findIndex((member: Member) => member.id === client.id);
|
|
240
|
+
const taskId = useRoute().params.taskId as string;
|
|
241
|
+
if (index !== -1) {
|
|
242
|
+
const fromCode = this.getMemberApplicationCode(from);
|
|
243
|
+
const fromMember = this.formStore[from][index];
|
|
244
|
+
const applicationList = this.formStore.applicationData[fromCode!];
|
|
245
|
+
const fromIndex = applicationList && applicationList.length ? applicationList.findIndex((member: any) => member.insisId === fromMember.id) : null;
|
|
246
|
+
if (fromMember.id !== 0 && fromIndex !== -1) {
|
|
247
|
+
await this.deleteMember(taskId, from, index);
|
|
248
|
+
} else {
|
|
249
|
+
this.clearMember(from, index);
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
// @ts-ignore
|
|
253
|
+
this.formStore[from] = [this.getMemberClass(from)];
|
|
254
|
+
}
|
|
255
|
+
},
|
|
154
256
|
addMember(whichForm: MemberKeys) {
|
|
155
257
|
if (!whichForm) return false;
|
|
156
258
|
if (!this.isStatementEditible(whichForm)) return false;
|
|
@@ -198,8 +300,14 @@ export const useMemberStore = defineStore('members', {
|
|
|
198
300
|
// TODO Доработать и менять значение hasAgreement.value => true
|
|
199
301
|
this.dataStore.showToaster(otpResponse.status !== 2 ? 'error' : 'success', otpResponse.statusName, 3000);
|
|
200
302
|
if (otpResponse.status === 2) {
|
|
303
|
+
member.otpCode = null;
|
|
201
304
|
return true;
|
|
202
305
|
}
|
|
306
|
+
if (otpResponse.status === 4 || otpResponse.status === 5) {
|
|
307
|
+
member.otpCode = null;
|
|
308
|
+
member.otpTokenId = null;
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
203
311
|
}
|
|
204
312
|
}
|
|
205
313
|
return false;
|
|
@@ -213,7 +321,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
213
321
|
async sendOtp(member: Member, processInstanceId: string | number | null = null, onInit: boolean = false) {
|
|
214
322
|
if (!this.validateInitiator()) return null;
|
|
215
323
|
this.dataStore.isLoading = true;
|
|
216
|
-
let otpStatus: boolean =
|
|
324
|
+
let otpStatus: boolean | null = null;
|
|
217
325
|
let otpResponse: SendOtpResponse = {};
|
|
218
326
|
try {
|
|
219
327
|
if (member.iin && member.phoneNumber && member.iin.length === useMask().iin.length && member.phoneNumber.length === useMask().phone.length) {
|
|
@@ -241,30 +349,27 @@ export const useMemberStore = defineStore('members', {
|
|
|
241
349
|
if (!!otpResponse) {
|
|
242
350
|
if ('errMessage' in otpResponse && otpResponse.errMessage !== null) {
|
|
243
351
|
this.dataStore.showToaster('error', otpResponse.errMessage, 3000);
|
|
244
|
-
return { otpStatus };
|
|
352
|
+
return { otpStatus: false };
|
|
245
353
|
}
|
|
246
354
|
if ('result' in otpResponse && otpResponse.result === null) {
|
|
247
355
|
if ('statusName' in otpResponse && !!otpResponse.statusName) {
|
|
248
356
|
this.dataStore.showToaster('error', otpResponse.statusName, 3000);
|
|
249
|
-
return { otpStatus };
|
|
357
|
+
return { otpStatus: false };
|
|
250
358
|
}
|
|
251
359
|
if ('status' in otpResponse && !!otpResponse.status) {
|
|
252
360
|
this.dataStore.showToaster('error', otpResponse.status, 3000);
|
|
253
|
-
return { otpStatus };
|
|
361
|
+
return { otpStatus: false };
|
|
254
362
|
}
|
|
255
363
|
}
|
|
256
364
|
if ('tokenId' in otpResponse && otpResponse.tokenId) {
|
|
257
365
|
member.otpTokenId = otpResponse.tokenId;
|
|
258
366
|
this.dataStore.showToaster('success', this.dataStore.t('toaster.successOtp'), 3000);
|
|
259
367
|
}
|
|
260
|
-
} else {
|
|
261
|
-
this.dataStore.showToaster('error', this.dataStore.t('error.noOtpResponse'), 3000);
|
|
262
|
-
return { otpStatus };
|
|
263
368
|
}
|
|
264
369
|
}
|
|
265
370
|
} else {
|
|
266
371
|
if (onInit === false) {
|
|
267
|
-
this.dataStore.showToaster('error', this.dataStore.t('toaster.errorFormField'
|
|
372
|
+
this.dataStore.showToaster('error', this.dataStore.t('toaster.errorFormField', { text: 'Номер телефона, ИИН' }));
|
|
268
373
|
this.dataStore.isLoading = false;
|
|
269
374
|
}
|
|
270
375
|
}
|
package/store/rules.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i18n } from '@/configs/i18n';
|
|
2
2
|
import { formatDate } from '../composables';
|
|
3
3
|
|
|
4
|
+
const t = i18n.t;
|
|
5
|
+
|
|
4
6
|
export const rules = {
|
|
5
|
-
recalculationMultiply: [v => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher'
|
|
6
|
-
recalculationAdditive: [v => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween'
|
|
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' })],
|
|
7
9
|
required: [v => !!v || t('rules.required')],
|
|
8
10
|
objectRequired: [
|
|
9
11
|
v => {
|
|
@@ -13,6 +15,14 @@ export const rules = {
|
|
|
13
15
|
return t('rules.required');
|
|
14
16
|
},
|
|
15
17
|
],
|
|
18
|
+
agentDataRequired: [
|
|
19
|
+
v => {
|
|
20
|
+
if (!!v && 'fullName' in v && v.fullName != null) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return t('rules.required');
|
|
24
|
+
},
|
|
25
|
+
],
|
|
16
26
|
noResident: [
|
|
17
27
|
v => {
|
|
18
28
|
if (!!v && 'nameRu' in v && v.nameRu === 'Нерезидент') {
|
|
@@ -86,6 +96,8 @@ export const rules = {
|
|
|
86
96
|
},
|
|
87
97
|
],
|
|
88
98
|
age: [v => /^\d+$/.test(v) || t('rules.age')],
|
|
99
|
+
age18: [v => v >= 18 || t('rules.age18')],
|
|
100
|
+
age18ByDate: [v => Math.abs(new Date(Date.now() - new Date(formatDate(v)).getTime()).getUTCFullYear() - 1970) >= 18 || t('rules.age18')],
|
|
89
101
|
birthDate: [
|
|
90
102
|
v => {
|
|
91
103
|
if (new Date(formatDate(v)) > new Date(Date.now())) return t('rules.exceedDate');
|
|
@@ -108,6 +120,18 @@ export const rules = {
|
|
|
108
120
|
}
|
|
109
121
|
},
|
|
110
122
|
],
|
|
123
|
+
coverPeriodFrom2to20: [
|
|
124
|
+
v => {
|
|
125
|
+
if (v !== null) {
|
|
126
|
+
if (v < 2 || v > 20) {
|
|
127
|
+
return t('productConditionsForm.coverPeriodFrom2to20');
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
} else {
|
|
131
|
+
return t('productConditionsForm.coverPeriodFrom2to20');
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
],
|
|
111
135
|
coverPeriodFrom3to20: [
|
|
112
136
|
v => {
|
|
113
137
|
if (v !== null) {
|
package/types/index.ts
CHANGED
|
@@ -271,6 +271,8 @@ declare global {
|
|
|
271
271
|
text: string;
|
|
272
272
|
};
|
|
273
273
|
|
|
274
|
+
type RegNumberDataType = { processInstanceId: string; regNumber: string; date: string };
|
|
275
|
+
|
|
274
276
|
type EpayShortResponse = {
|
|
275
277
|
id: string;
|
|
276
278
|
link: string;
|
|
@@ -300,4 +302,36 @@ declare global {
|
|
|
300
302
|
taskId: string;
|
|
301
303
|
comment?: string;
|
|
302
304
|
};
|
|
305
|
+
|
|
306
|
+
type AgentData = {
|
|
307
|
+
agentId?: number | null;
|
|
308
|
+
manId?: number;
|
|
309
|
+
fullName?: string;
|
|
310
|
+
officeId?: number | null;
|
|
311
|
+
officeCode?: string | null;
|
|
312
|
+
saleChannel?: string;
|
|
313
|
+
staffId?: number;
|
|
314
|
+
managerName?: string;
|
|
315
|
+
mainAgentId?: string | null;
|
|
316
|
+
agentNo?: string;
|
|
317
|
+
iin?: string | null;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
type UserDocument = {
|
|
321
|
+
id: number | null;
|
|
322
|
+
contragentId: number | null;
|
|
323
|
+
type: string;
|
|
324
|
+
typeName: string;
|
|
325
|
+
serial: string | number | null;
|
|
326
|
+
number: string;
|
|
327
|
+
issueDate: string;
|
|
328
|
+
expireDate: string;
|
|
329
|
+
issuerId: number;
|
|
330
|
+
issuerName: string;
|
|
331
|
+
issuerNameRu: string;
|
|
332
|
+
description: string | null;
|
|
333
|
+
note: string | null;
|
|
334
|
+
verifyType: string;
|
|
335
|
+
verifyDate: string;
|
|
336
|
+
};
|
|
303
337
|
}
|