hl-core 0.0.7-beta.15 → 0.0.7-beta.16
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/components/Form/Documents.vue +109 -0
- package/components/Form/FormToggle.vue +8 -1
- package/components/Form/MemberForm.vue +711 -104
- package/components/Input/EmptyFormField.vue +5 -0
- package/components/Input/FileInput.vue +71 -0
- package/components/Input/PanelInput.vue +1 -0
- package/components/Input/RoundedInput.vue +0 -3
- package/components/Layout/Drawer.vue +1 -1
- package/components/Layout/SettingsPanel.vue +6 -1
- package/components/List/ListEmpty.vue +22 -0
- package/components/Menu/MenuNav.vue +8 -26
- package/components/Panel/PanelSelectItem.vue +20 -0
- package/composables/classes.ts +103 -87
- package/composables/index.ts +7 -6
- package/layouts/default.vue +13 -3
- package/package.json +8 -6
- package/pages/500.vue +38 -1
- package/store/data.store.js +219 -480
- package/store/member.store.ts +137 -7
- package/store/messages.ts +13 -7
- package/store/rules.js +1 -0
package/store/member.store.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { defineStore } from 'pinia';
|
|
|
2
2
|
import { useDataStore } from './data.store';
|
|
3
3
|
import { useFormStore } from './form.store';
|
|
4
4
|
import { ErrorHandler } from '../composables';
|
|
5
|
+
import { AxiosError } from 'axios';
|
|
6
|
+
import { Member } from '../composables/classes';
|
|
5
7
|
|
|
6
8
|
export const useMemberStore = defineStore('members', {
|
|
7
9
|
state: () => ({
|
|
@@ -10,7 +12,6 @@ export const useMemberStore = defineStore('members', {
|
|
|
10
12
|
dataStore: useDataStore(),
|
|
11
13
|
formStore: useFormStore(),
|
|
12
14
|
}),
|
|
13
|
-
getters: {},
|
|
14
15
|
actions: {
|
|
15
16
|
isStatementEditible(whichForm: string, showToaster: boolean = false) {
|
|
16
17
|
if (this.formStore.isDisabled[whichForm as keyof typeof this.formStore.isDisabled] === true) {
|
|
@@ -45,7 +46,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
45
46
|
}
|
|
46
47
|
return false;
|
|
47
48
|
},
|
|
48
|
-
getMemberFromStore(whichForm: keyof typeof this.formStore, whichIndex?: number) {
|
|
49
|
+
getMemberFromStore(whichForm: keyof typeof this.formStore, whichIndex?: number): Member | null {
|
|
49
50
|
switch (whichForm) {
|
|
50
51
|
case this.formStore.policyholderFormKey:
|
|
51
52
|
return this.formStore.policyholderForm;
|
|
@@ -58,7 +59,7 @@ export const useMemberStore = defineStore('members', {
|
|
|
58
59
|
case this.formStore.beneficialOwnerFormKey:
|
|
59
60
|
return this.formStore.beneficialOwnerForm[whichIndex!];
|
|
60
61
|
default:
|
|
61
|
-
return
|
|
62
|
+
return null;
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
65
|
getMemberFromApplication(whichForm: keyof typeof this.formStore, whichIndex?: number) {
|
|
@@ -101,6 +102,8 @@ export const useMemberStore = defineStore('members', {
|
|
|
101
102
|
},
|
|
102
103
|
getMemberCode(whichForm: keyof typeof this.formStore) {
|
|
103
104
|
switch (whichForm) {
|
|
105
|
+
case this.formStore.policyholderFormKey:
|
|
106
|
+
return 'Client';
|
|
104
107
|
case this.formStore.insuredFormKey:
|
|
105
108
|
return 'Insured';
|
|
106
109
|
case this.formStore.beneficiaryFormKey:
|
|
@@ -117,12 +120,9 @@ export const useMemberStore = defineStore('members', {
|
|
|
117
120
|
if (!this.validateInitiator()) return false;
|
|
118
121
|
const memberClass = this.getMemberClass(whichForm);
|
|
119
122
|
if (!memberClass) return false;
|
|
120
|
-
if (whichForm === this.formStore.policyholderFormKey) {
|
|
123
|
+
if (whichForm === this.formStore.policyholderFormKey || whichForm === this.formStore.policyholdersRepresentativeFormKey) {
|
|
121
124
|
this.formStore[whichForm].resetForm();
|
|
122
125
|
}
|
|
123
|
-
if (whichForm === this.formStore.policyholdersRepresentativeFormKey) {
|
|
124
|
-
this.formStore[whichForm].resetMember();
|
|
125
|
-
}
|
|
126
126
|
if (typeof whichIndex === 'number') {
|
|
127
127
|
if (this.formStore[whichForm].length === 1) {
|
|
128
128
|
this.formStore[whichForm][whichIndex] = memberClass;
|
|
@@ -160,5 +160,135 @@ export const useMemberStore = defineStore('members', {
|
|
|
160
160
|
if (!this.validateInitiator()) return false;
|
|
161
161
|
this.formStore[whichForm].push(this.getMemberClass(whichForm));
|
|
162
162
|
},
|
|
163
|
+
async getOtpStatus(iin: string, phone: string, processInstanceId: string | number | null = null) {
|
|
164
|
+
try {
|
|
165
|
+
const otpData = {
|
|
166
|
+
iin: iin.replace(/-/g, ''),
|
|
167
|
+
phoneNumber: formatPhone(phone),
|
|
168
|
+
type: 'AgreementOtp',
|
|
169
|
+
};
|
|
170
|
+
return await this.dataStore.api.getOtpStatus(
|
|
171
|
+
processInstanceId !== null && processInstanceId !== 0
|
|
172
|
+
? {
|
|
173
|
+
...otpData,
|
|
174
|
+
processInstanceId: processInstanceId,
|
|
175
|
+
}
|
|
176
|
+
: otpData,
|
|
177
|
+
);
|
|
178
|
+
} catch (err) {
|
|
179
|
+
return ErrorHandler(err);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
async checkOtp(member: Member) {
|
|
183
|
+
if (!member.otpTokenId || !member.otpCode || !member.phoneNumber) {
|
|
184
|
+
this.dataStore.showToaster('error', this.dataStore.t('error.noOtpCode'));
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
this.dataStore.isLoading = true;
|
|
189
|
+
const otpData = {
|
|
190
|
+
tokenId: member.otpTokenId,
|
|
191
|
+
phoneNumber: formatPhone(member.phoneNumber),
|
|
192
|
+
code: member.otpCode.replace(/\s/g, ''),
|
|
193
|
+
};
|
|
194
|
+
const otpResponse = await this.dataStore.api.checkOtp(otpData);
|
|
195
|
+
if (otpResponse !== null) {
|
|
196
|
+
if ('errMessage' in otpResponse && otpResponse.errMessage !== null) {
|
|
197
|
+
this.dataStore.showToaster('error', otpResponse.errMessage, 3000);
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
if ('status' in otpResponse && !!otpResponse.status) {
|
|
201
|
+
// TODO Доработать и менять значение hasAgreement.value => true
|
|
202
|
+
this.dataStore.showToaster(otpResponse.status !== 2 ? 'error' : 'success', otpResponse.statusName, 3000);
|
|
203
|
+
if (otpResponse.status === 2) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return false;
|
|
209
|
+
} catch (err) {
|
|
210
|
+
ErrorHandler(err);
|
|
211
|
+
} finally {
|
|
212
|
+
this.dataStore.isLoading = false;
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
},
|
|
216
|
+
async sendOtp(member: Member, processInstanceId: string | number | null = null, onInit: boolean = false) {
|
|
217
|
+
if (!this.validateInitiator()) return null;
|
|
218
|
+
this.dataStore.isLoading = true;
|
|
219
|
+
let otpStatus: boolean = false;
|
|
220
|
+
let otpResponse: any = {};
|
|
221
|
+
try {
|
|
222
|
+
if (member.iin && member.phoneNumber && member.iin.length === 15 && member.phoneNumber.length === 18) {
|
|
223
|
+
const status = await this.getOtpStatus(member.iin, member.phoneNumber, processInstanceId);
|
|
224
|
+
if (status === true) {
|
|
225
|
+
this.dataStore.showToaster('success', this.dataStore.t('toaster.hasSuccessOtp'), 3000);
|
|
226
|
+
otpStatus = true;
|
|
227
|
+
this.dataStore.isLoading = false;
|
|
228
|
+
return { otpStatus, otpResponse };
|
|
229
|
+
} else if (status === false && onInit === false) {
|
|
230
|
+
const otpData = {
|
|
231
|
+
iin: member.iin.replace(/-/g, ''),
|
|
232
|
+
phoneNumber: formatPhone(member.phoneNumber),
|
|
233
|
+
type: 'AgreementOtp',
|
|
234
|
+
};
|
|
235
|
+
otpResponse = await this.dataStore.api.sendOtp(
|
|
236
|
+
processInstanceId !== null && processInstanceId !== 0
|
|
237
|
+
? {
|
|
238
|
+
...otpData,
|
|
239
|
+
processInstanceId: processInstanceId,
|
|
240
|
+
}
|
|
241
|
+
: otpData,
|
|
242
|
+
);
|
|
243
|
+
this.dataStore.isLoading = false;
|
|
244
|
+
if (!!otpResponse) {
|
|
245
|
+
if ('errMessage' in otpResponse && otpResponse.errMessage !== null) {
|
|
246
|
+
this.dataStore.showToaster('error', otpResponse.errMessage, 3000);
|
|
247
|
+
return { otpStatus };
|
|
248
|
+
}
|
|
249
|
+
if ('result' in otpResponse && otpResponse.result === null) {
|
|
250
|
+
if ('statusName' in otpResponse && !!otpResponse.statusName) {
|
|
251
|
+
this.dataStore.showToaster('error', otpResponse.statusName, 3000);
|
|
252
|
+
return { otpStatus };
|
|
253
|
+
}
|
|
254
|
+
if ('status' in otpResponse && !!otpResponse.status) {
|
|
255
|
+
this.dataStore.showToaster('error', otpResponse.status, 3000);
|
|
256
|
+
return { otpStatus };
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if ('tokenId' in otpResponse && otpResponse.tokenId) {
|
|
260
|
+
member.otpTokenId = otpResponse.tokenId;
|
|
261
|
+
this.dataStore.showToaster('success', this.dataStore.t('toaster.successOtp'), 3000);
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
this.dataStore.showToaster('error', this.dataStore.t('error.snoOtpResponse'), 3000);
|
|
265
|
+
return { otpStatus };
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
} else {
|
|
269
|
+
if (onInit === false) {
|
|
270
|
+
this.dataStore.showToaster('error', this.dataStore.t('toaster.errorFormField').replace('{text}', 'Номер телефона, ИИН'));
|
|
271
|
+
this.dataStore.isLoading = false;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return { otpStatus, otpResponse };
|
|
275
|
+
} catch (err) {
|
|
276
|
+
this.dataStore.isLoading = false;
|
|
277
|
+
if (err instanceof AxiosError)
|
|
278
|
+
if ('response' in err && err.response && err.response.data) {
|
|
279
|
+
if ('statusName' in err.response.data && !!err.response.data.statusName) {
|
|
280
|
+
this.dataStore.showToaster('error', this.dataStore.t('toaster.phoneNotFoundInBMG'), 3000);
|
|
281
|
+
return { otpStatus };
|
|
282
|
+
}
|
|
283
|
+
if ('status' in err.response.data && !!err.response.data.status) {
|
|
284
|
+
this.dataStore.showToaster('error', err.response.data.status, 3000);
|
|
285
|
+
return { otpStatus };
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
} finally {
|
|
289
|
+
this.dataStore.isLoading = false;
|
|
290
|
+
}
|
|
291
|
+
return { otpStatus, otpResponse };
|
|
292
|
+
},
|
|
163
293
|
},
|
|
164
294
|
});
|
package/store/messages.ts
CHANGED
|
@@ -28,7 +28,16 @@ export const messages = {
|
|
|
28
28
|
rejectCause: 'Причина отказа',
|
|
29
29
|
returnCause: 'Причина возврата на доработку',
|
|
30
30
|
},
|
|
31
|
+
error: {
|
|
32
|
+
title: 'Ошибка 404',
|
|
33
|
+
description: 'Страница, которую вы запрашиваете, не существует либо устарела.',
|
|
34
|
+
connectionLost: 'Нет подключения к Интернету',
|
|
35
|
+
checkConnection: 'Проверьте ваше подключение',
|
|
36
|
+
noOtpResponse: 'Отсутствует ответ при отправке OTP кода',
|
|
37
|
+
noOtpCode: 'Заполните поля: ИИН, Номер телефона, Код подтверждения',
|
|
38
|
+
},
|
|
31
39
|
toaster: {
|
|
40
|
+
noIinOrPhone: 'Отсутствуют данные для отправки СМС',
|
|
32
41
|
ESBDErrorMessage: 'Введены не корректные данные по этому ИИН',
|
|
33
42
|
phoneNotFoundInBMG: 'Введите номер зарегистрированный в БМГ или зарегистрируйте клиента в БМГ',
|
|
34
43
|
errorSumOrPercentage: 'Процент от суммы выплат не может быть меньше или больше 100',
|
|
@@ -135,12 +144,6 @@ export const messages = {
|
|
|
135
144
|
accept: 'Одобрить',
|
|
136
145
|
reject: 'Отказать',
|
|
137
146
|
},
|
|
138
|
-
error: {
|
|
139
|
-
title: 'Ошибка 404',
|
|
140
|
-
description: 'Страница, которую вы запрашиваете, не существует либо устарела.',
|
|
141
|
-
connectionLost: 'Нет подключения к Интернету',
|
|
142
|
-
checkConnection: 'Проверьте ваше подключение',
|
|
143
|
-
},
|
|
144
147
|
dialog: {
|
|
145
148
|
title: 'Подтверждение',
|
|
146
149
|
exit: 'Вы действительно хотите выйти?',
|
|
@@ -195,6 +198,7 @@ export const messages = {
|
|
|
195
198
|
generalConditions: 'Основные условия страхования',
|
|
196
199
|
isPolicyholderInsured: 'Является ли страхователь застрахованным?',
|
|
197
200
|
isPolicyholderIPDL: 'Принадлежит ли и/или причастен ли Застрахованный / Страхователь или его члены семьи и близкие родственники к иностранному публичному должностному лицу?',
|
|
201
|
+
isMemberIPDL: 'Отметка о принадлежности и/или причастности к публичному должностному лицу, его супруге (супругу) и близким родственникам?',
|
|
198
202
|
isPolicyholderBeneficiary: 'Является ли страхователь выгодоприобретателем?',
|
|
199
203
|
hasRepresentative: 'Подписантом договора выступает представитель? ',
|
|
200
204
|
isActOwnBehalf: ' Клиент действует от своего имени и в своих интересах?',
|
|
@@ -305,7 +309,7 @@ export const messages = {
|
|
|
305
309
|
basisDocRu: 'Действует на основании документа (рус)',
|
|
306
310
|
basisDocRuParentCase: 'Действует на основании документа в родительском падеже (рус)',
|
|
307
311
|
numberDoc: 'Номер документа подтверждающий полномочия',
|
|
308
|
-
numberVisa: 'Номер
|
|
312
|
+
numberVisa: 'Номер миграционный карточки',
|
|
309
313
|
numberLicense: 'Номер лицензии',
|
|
310
314
|
confirmAuthority: 'Лицо, подписавшего документ, подтверждающий полномочия, -Нотариус?',
|
|
311
315
|
documentIssuers: 'Наименование органа, выдавшего документ',
|
|
@@ -326,6 +330,8 @@ export const messages = {
|
|
|
326
330
|
recipientNumber: 'Номер получателя СМС',
|
|
327
331
|
},
|
|
328
332
|
form: {
|
|
333
|
+
migrationCard: '',
|
|
334
|
+
postIndex: 'Почтовый индекс',
|
|
329
335
|
name: 'Наименование',
|
|
330
336
|
bin: 'БИН',
|
|
331
337
|
fullName: 'ФИО',
|