hl-core 0.0.10-beta.6 → 0.0.10-beta.61
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/README.md +0 -2
- package/api/base.api.ts +361 -137
- package/api/interceptors.ts +3 -5
- package/components/Dialog/Dialog.vue +5 -1
- package/components/Dialog/FamilyDialog.vue +15 -4
- package/components/Form/DigitalDocument.vue +52 -0
- package/components/Form/FormSource.vue +30 -0
- package/components/Form/ManagerAttachment.vue +60 -11
- package/components/Form/ProductConditionsBlock.vue +12 -6
- package/components/Input/Datepicker.vue +5 -0
- package/components/Input/FileInput.vue +1 -1
- package/components/Input/FormInput.vue +7 -0
- package/components/Input/OtpInput.vue +25 -0
- package/components/Input/RoundedInput.vue +2 -0
- package/components/Input/RoundedSelect.vue +2 -0
- package/components/Input/TextAreaField.vue +71 -0
- package/components/Menu/MenuNav.vue +2 -1
- package/components/Pages/Anketa.vue +207 -176
- package/components/Pages/ContragentForm.vue +1 -1
- package/components/Pages/Documents.vue +486 -64
- package/components/Pages/MemberForm.vue +424 -182
- package/components/Pages/ProductConditions.vue +1180 -257
- package/components/Panel/PanelHandler.vue +319 -125
- package/components/Utilities/Chip.vue +1 -1
- package/components/Utilities/JsonViewer.vue +1 -2
- package/composables/classes.ts +125 -21
- package/composables/constants.ts +166 -1
- package/composables/index.ts +345 -9
- package/composables/styles.ts +8 -24
- package/configs/i18n.ts +2 -0
- package/configs/pwa.ts +1 -7
- package/layouts/clear.vue +1 -1
- package/layouts/default.vue +1 -1
- package/layouts/full.vue +1 -1
- package/locales/kz.json +1236 -0
- package/locales/ru.json +109 -20
- package/nuxt.config.ts +8 -6
- package/package.json +12 -12
- package/plugins/head.ts +7 -1
- package/plugins/helperFunctionsPlugins.ts +1 -0
- package/store/data.store.ts +948 -527
- package/store/member.store.ts +17 -6
- package/store/rules.ts +54 -3
- package/types/enum.ts +46 -2
- package/types/index.ts +126 -5
package/composables/constants.ts
CHANGED
|
@@ -18,12 +18,21 @@ export const constants = Object.freeze({
|
|
|
18
18
|
gns: 16,
|
|
19
19
|
prepensionannuity: 18,
|
|
20
20
|
pensionannuitynew: 19,
|
|
21
|
+
halykkazynaap: 20,
|
|
22
|
+
balam: 21,
|
|
23
|
+
borrower: 40,
|
|
24
|
+
halykkazynaapsms: 23,
|
|
25
|
+
pensionannuityrefundnew: 24,
|
|
26
|
+
pensionannuityjointnew: 25,
|
|
27
|
+
gonsadd: 26,
|
|
28
|
+
tumar: 27,
|
|
29
|
+
criticalillness: 29,
|
|
21
30
|
},
|
|
22
31
|
amlProducts: {
|
|
23
32
|
checkcontragent: 1,
|
|
24
33
|
checkcontract: 2,
|
|
25
34
|
},
|
|
26
|
-
extractedProducts: ['dso', 'uu'],
|
|
35
|
+
extractedProducts: ['dso', 'uu', 'lka', 'reinsurance', 'reporting'],
|
|
27
36
|
editableStatuses: [Statuses.StartForm, Statuses.EditBeneficiaryForm, Statuses.EditForm, Statuses.InputDataForm],
|
|
28
37
|
documentsLinkVisibleStatuses: [
|
|
29
38
|
Statuses.Completed,
|
|
@@ -36,6 +45,7 @@ export const constants = Object.freeze({
|
|
|
36
45
|
returnStatementStatuses: [
|
|
37
46
|
Statuses.ApproveForm,
|
|
38
47
|
Statuses.ActuaryForm,
|
|
48
|
+
Statuses.JuristForm,
|
|
39
49
|
Statuses.DsoUsnsForm,
|
|
40
50
|
Statuses.AccountantForm,
|
|
41
51
|
Statuses.UnderwriterForm,
|
|
@@ -57,6 +67,7 @@ export const constants = Object.freeze({
|
|
|
57
67
|
Statuses.WaitingInsurancePremiumForm,
|
|
58
68
|
],
|
|
59
69
|
rejectApplicationStatuses: [
|
|
70
|
+
Statuses.EditForm,
|
|
60
71
|
Statuses.StartForm,
|
|
61
72
|
Statuses.DsoUsnsForm,
|
|
62
73
|
Statuses.AccountantForm,
|
|
@@ -74,6 +85,20 @@ export const constants = Object.freeze({
|
|
|
74
85
|
kzt: '₸',
|
|
75
86
|
usd: '$',
|
|
76
87
|
},
|
|
88
|
+
pensionAge: {
|
|
89
|
+
man: 68,
|
|
90
|
+
woman: 68,
|
|
91
|
+
},
|
|
92
|
+
genderByIIN: {
|
|
93
|
+
'0': 'Ж',
|
|
94
|
+
'3': 'М',
|
|
95
|
+
'4': 'Ж',
|
|
96
|
+
'5': 'М',
|
|
97
|
+
'6': 'Ж',
|
|
98
|
+
'7': 'М',
|
|
99
|
+
'8': 'Ж',
|
|
100
|
+
'9': 'М',
|
|
101
|
+
},
|
|
77
102
|
documentTypes: {
|
|
78
103
|
statement: 5,
|
|
79
104
|
contract: 6,
|
|
@@ -87,6 +112,11 @@ export const constants = Object.freeze({
|
|
|
87
112
|
questionnaireInsured: 35,
|
|
88
113
|
invoicePayment: 36,
|
|
89
114
|
},
|
|
115
|
+
fileTypes: {
|
|
116
|
+
pdf: 'application/pdf',
|
|
117
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
118
|
+
doc: 'application/msword',
|
|
119
|
+
},
|
|
90
120
|
regex: {
|
|
91
121
|
isoDate: /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)((-(\d{2}):(\d{2})|Z)?)$/,
|
|
92
122
|
},
|
|
@@ -161,5 +191,140 @@ export const constants = Object.freeze({
|
|
|
161
191
|
nameRu: '5 000 000',
|
|
162
192
|
ids: '',
|
|
163
193
|
},
|
|
194
|
+
{
|
|
195
|
+
code: '5500000',
|
|
196
|
+
id: '10',
|
|
197
|
+
nameKz: '5 500 000',
|
|
198
|
+
nameRu: '5 500 000',
|
|
199
|
+
ids: '',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
code: '6000000',
|
|
203
|
+
id: '11',
|
|
204
|
+
nameKz: '6 000 000',
|
|
205
|
+
nameRu: '6 000 000',
|
|
206
|
+
ids: '',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
code: '6500000',
|
|
210
|
+
id: '12',
|
|
211
|
+
nameKz: '6 500 000',
|
|
212
|
+
nameRu: '6 500 000',
|
|
213
|
+
ids: '',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
code: '7000000',
|
|
217
|
+
id: '13',
|
|
218
|
+
nameKz: '7 000 000',
|
|
219
|
+
nameRu: '7 000 000',
|
|
220
|
+
ids: '',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
code: '7500000',
|
|
224
|
+
id: '14',
|
|
225
|
+
nameKz: '7 500 000',
|
|
226
|
+
nameRu: '7 500 000',
|
|
227
|
+
ids: '',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
code: '8000000',
|
|
231
|
+
id: '15',
|
|
232
|
+
nameKz: '8 000 000',
|
|
233
|
+
nameRu: '8 000 000',
|
|
234
|
+
ids: '',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
code: '8500000',
|
|
238
|
+
id: '16',
|
|
239
|
+
nameKz: '8 500 000',
|
|
240
|
+
nameRu: '8 500 000',
|
|
241
|
+
ids: '',
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
code: '9000000',
|
|
245
|
+
id: '17',
|
|
246
|
+
nameKz: '9 000 000',
|
|
247
|
+
nameRu: '9 000 000',
|
|
248
|
+
ids: '',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
code: '9500000',
|
|
252
|
+
id: '18',
|
|
253
|
+
nameKz: '9 500 000',
|
|
254
|
+
nameRu: '9 500 000',
|
|
255
|
+
ids: '',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
code: '10000000',
|
|
259
|
+
id: '19',
|
|
260
|
+
nameKz: '10 000 000',
|
|
261
|
+
nameRu: '10 000 000',
|
|
262
|
+
ids: '',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
code: '10500000',
|
|
266
|
+
id: '20',
|
|
267
|
+
nameKz: '10 500 000',
|
|
268
|
+
nameRu: '10 500 000',
|
|
269
|
+
ids: '',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
code: '11000000',
|
|
273
|
+
id: '21',
|
|
274
|
+
nameKz: '11 000 000',
|
|
275
|
+
nameRu: '11 000 000',
|
|
276
|
+
ids: '',
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
code: '11500000',
|
|
280
|
+
id: '22',
|
|
281
|
+
nameKz: '11 500 000',
|
|
282
|
+
nameRu: '11 500 000',
|
|
283
|
+
ids: '',
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
code: '12000000',
|
|
287
|
+
id: '23',
|
|
288
|
+
nameKz: '12 000 000',
|
|
289
|
+
nameRu: '12 000 000',
|
|
290
|
+
ids: '',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
code: '12500000',
|
|
294
|
+
id: '24',
|
|
295
|
+
nameKz: '12 500 000',
|
|
296
|
+
nameRu: '12 500 000',
|
|
297
|
+
ids: '',
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
code: '13000000',
|
|
301
|
+
id: '25',
|
|
302
|
+
nameKz: '13 000 000',
|
|
303
|
+
nameRu: '13 000 000',
|
|
304
|
+
ids: '',
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
code: '13500000',
|
|
308
|
+
id: '26',
|
|
309
|
+
nameKz: '13 500 000',
|
|
310
|
+
nameRu: '13 500 000',
|
|
311
|
+
ids: '',
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
currencyList: [
|
|
315
|
+
{
|
|
316
|
+
code: 'KZT',
|
|
317
|
+
id: '1',
|
|
318
|
+
nameKz: 'Теңге',
|
|
319
|
+
nameRu: 'Тенге',
|
|
320
|
+
ids: '',
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
code: 'USD',
|
|
324
|
+
id: '2',
|
|
325
|
+
nameKz: 'USD бағамына индексациямен',
|
|
326
|
+
nameRu: 'С индексацией на курс USD',
|
|
327
|
+
ids: '',
|
|
328
|
+
},
|
|
164
329
|
],
|
|
165
330
|
});
|
package/composables/index.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useDisplay } from 'vuetify';
|
|
2
|
-
import jwt_decode from 'jwt-decode';
|
|
2
|
+
import { jwtDecode as jwt_decode } from 'jwt-decode';
|
|
3
3
|
import { XMLParser } from 'fast-xml-parser';
|
|
4
4
|
import { AxiosError } from 'axios';
|
|
5
5
|
import { DocumentReaderApi, Scenario, TextFieldType, LCID } from '@regulaforensics/document-reader-webclient';
|
|
6
|
-
import { PolicyholderClass } from '../composables/classes';
|
|
7
|
-
import type { EnvModes, NestedKeyOf, ResponseStructure } from '../types';
|
|
6
|
+
import { PolicyholderClass, Value, User } from '../composables/classes';
|
|
7
|
+
import type { EnvModes, NestedKeyOf, Projects, ResponseStructure, Utils, RouteType } from '../types';
|
|
8
|
+
import { Roles, Statuses } from '../types/enum';
|
|
8
9
|
|
|
9
10
|
export const useEnv = () => {
|
|
10
11
|
return {
|
|
@@ -17,7 +18,8 @@ export const useEnv = () => {
|
|
|
17
18
|
|
|
18
19
|
export class Masks {
|
|
19
20
|
numbers: string = '#*';
|
|
20
|
-
otp: string = '
|
|
21
|
+
otp: string = '####';
|
|
22
|
+
otpSixDigit: string = '######';
|
|
21
23
|
spacedNumbers: string = '### ### ### ### ### ### ###';
|
|
22
24
|
iin: string = '###-###-###-###';
|
|
23
25
|
phone: string = '+7 (7##) ### ## ##';
|
|
@@ -87,6 +89,29 @@ export const reformatDate = (date: string) => {
|
|
|
87
89
|
}
|
|
88
90
|
};
|
|
89
91
|
|
|
92
|
+
export const reformatDateWithHours = (date: string) => {
|
|
93
|
+
if (date) {
|
|
94
|
+
const data = new Date(date);
|
|
95
|
+
let day: string | number = data.getDate();
|
|
96
|
+
let month: string | number = data.getMonth() + 1;
|
|
97
|
+
let hour: string | number = data.getHours();
|
|
98
|
+
let minute: string | number = data.getMinutes();
|
|
99
|
+
if (month < 10) {
|
|
100
|
+
month = '0' + month;
|
|
101
|
+
}
|
|
102
|
+
if (day < 10) {
|
|
103
|
+
day = '0' + day;
|
|
104
|
+
}
|
|
105
|
+
if (minute < 10) {
|
|
106
|
+
minute = '0' + minute;
|
|
107
|
+
}
|
|
108
|
+
const year = data.getFullYear();
|
|
109
|
+
return `${day}.${month}.${year} - ${hour}:${minute}`;
|
|
110
|
+
} else {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
90
115
|
export const reformatIin = (iin: string) => {
|
|
91
116
|
if (!!iin) {
|
|
92
117
|
const matched = iin.match(/.{1,3}/g);
|
|
@@ -102,13 +127,22 @@ export const formatPhone = (phone: string) => {
|
|
|
102
127
|
|
|
103
128
|
export const cleanWhiteSpace = (str: string) => String(str).replace(/\s+/g, '');
|
|
104
129
|
|
|
105
|
-
export const jwtDecode = (token
|
|
106
|
-
if (token) return jwt_decode(token);
|
|
130
|
+
export const jwtDecode = (token?: string | null) => {
|
|
131
|
+
if (token) return jwt_decode<Utils.JwtToken>(token);
|
|
107
132
|
else return null;
|
|
108
133
|
};
|
|
109
134
|
|
|
110
135
|
export const isValidToken = (token: string) => {
|
|
111
|
-
|
|
136
|
+
try {
|
|
137
|
+
if (token) {
|
|
138
|
+
const decoded = jwtDecode(token);
|
|
139
|
+
return !!decoded && (new Date(Number(decoded.exp) * 1000).getTime() - Date.now()) / 1000 > 0;
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
} catch (err) {
|
|
143
|
+
console.log(err);
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
112
146
|
};
|
|
113
147
|
|
|
114
148
|
export const isValidGUID = (value: string) => {
|
|
@@ -147,8 +181,16 @@ export const parseProcents = (val: string | number) => (val ? Number(((val as nu
|
|
|
147
181
|
|
|
148
182
|
export const formatProcents = (val: string | number) => (val ? Number(((val as number) / 100).toFixed(2)) : Number(val));
|
|
149
183
|
|
|
184
|
+
export const formatSpacedNumber = (val: any) => ((!isNaN(val) && val !== null) || typeof val === 'string' ? Number(String(val).replace(/\s/g, '')) : 0);
|
|
185
|
+
|
|
150
186
|
export const sanitizeURL = (text: string) => (text ? text.replace(/\r?\n|\r|\\|"/g, '') : '');
|
|
151
187
|
|
|
188
|
+
export const sanitize = (text: string) =>
|
|
189
|
+
String(text)
|
|
190
|
+
.replace(/\r?\n|\r/g, '')
|
|
191
|
+
.replace(/\\/g, '')
|
|
192
|
+
.replace(/"/g, '');
|
|
193
|
+
|
|
152
194
|
export const yearEnding = (number: number, titles: string[], cases: number[]) => {
|
|
153
195
|
return titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[number % 10 < 5 ? number % 10 : 5]];
|
|
154
196
|
};
|
|
@@ -222,7 +264,7 @@ export const policyholderToBeneficialOwner = (isPolicyholderBeneficialOwner: boo
|
|
|
222
264
|
beneficialOwner.citizenship = policyholder.clientData.authoritedPerson.citizenship;
|
|
223
265
|
beneficialOwner.birthDate = policyholder.clientData.authoritedPerson.birthDate;
|
|
224
266
|
beneficialOwner.gender = policyholder.clientData.authoritedPerson.gender;
|
|
225
|
-
beneficialOwner.resident = policyholder.clientData.resident;
|
|
267
|
+
beneficialOwner.resident = policyholder.clientData.authoritedPerson.resident;
|
|
226
268
|
beneficialOwner.taxResidentCountry = policyholder.clientData.taxResidentCountry;
|
|
227
269
|
beneficialOwner.economySectorCode = policyholder.clientData.economySectorCode;
|
|
228
270
|
beneficialOwner.identityDocument.issuedOn = policyholder.clientData.authoritedPerson.identityDocument.issuedOn;
|
|
@@ -274,6 +316,7 @@ export const setAddressBeneficiary = (whichIndex: number, sameAddress: boolean)
|
|
|
274
316
|
if (beneficiary.id === 0) {
|
|
275
317
|
beneficiary.registrationCity = new Value();
|
|
276
318
|
beneficiary.registrationCountry = new Value();
|
|
319
|
+
beneficiary.birthPlace = new Value();
|
|
277
320
|
beneficiary.registrationMicroDistrict = '';
|
|
278
321
|
beneficiary.registrationNumberApartment = '';
|
|
279
322
|
beneficiary.registrationNumberApartment = '';
|
|
@@ -296,6 +339,13 @@ export const setAddressBeneficiary = (whichIndex: number, sameAddress: boolean)
|
|
|
296
339
|
const city = dataStore.cities.find(i => i.nameRu === cityName.replace('г.', ''));
|
|
297
340
|
beneficiary.registrationCity = city ?? new Value();
|
|
298
341
|
}
|
|
342
|
+
const contragentData = beneficiary.response.contragent;
|
|
343
|
+
if (contragentData) {
|
|
344
|
+
const country = dataStore.countries.find((i: Value) => i.nameRu?.match(new RegExp(contragentData.birthPlace, 'i')));
|
|
345
|
+
beneficiary.birthPlace = country ?? new Value();
|
|
346
|
+
} else {
|
|
347
|
+
beneficiary.birthPlace = new Value();
|
|
348
|
+
}
|
|
299
349
|
const province = dataStore.states.find(i => i.ids === benAddress[0].stateCode);
|
|
300
350
|
const localityType = dataStore.localityTypes.find(i => i.nameRu === benAddress[0].cityTypeName);
|
|
301
351
|
const region = dataStore.regions.find(i => i.ids == benAddress[0].regionCode);
|
|
@@ -333,6 +383,7 @@ export const setAddressInsured = (whichIndex: number, sameAddress: boolean) => {
|
|
|
333
383
|
if (insured.id === 0) {
|
|
334
384
|
insured.registrationCity = new Value();
|
|
335
385
|
insured.registrationCountry = new Value();
|
|
386
|
+
insured.birthPlace = new Value();
|
|
336
387
|
insured.registrationMicroDistrict = '';
|
|
337
388
|
insured.registrationNumberApartment = '';
|
|
338
389
|
insured.registrationNumberApartment = '';
|
|
@@ -355,6 +406,13 @@ export const setAddressInsured = (whichIndex: number, sameAddress: boolean) => {
|
|
|
355
406
|
const city = dataStore.cities.find(i => i.nameRu === cityName.replace('г.', ''));
|
|
356
407
|
insured.registrationCity = city ?? new Value();
|
|
357
408
|
}
|
|
409
|
+
const contragentData = insured.response.contragent;
|
|
410
|
+
if (contragentData) {
|
|
411
|
+
const country = dataStore.countries.find((i: Value) => i.nameRu?.match(new RegExp(contragentData.birthPlace, 'i')));
|
|
412
|
+
insured.birthPlace = country ?? new Value();
|
|
413
|
+
} else {
|
|
414
|
+
insured.birthPlace = new Value();
|
|
415
|
+
}
|
|
358
416
|
const province = dataStore.states.find(i => i.ids === benAddress[0].stateCode);
|
|
359
417
|
const localityType = dataStore.localityTypes.find(i => i.nameRu === benAddress[0].cityTypeName);
|
|
360
418
|
const region = dataStore.regions.find(i => i.ids == benAddress[0].regionCode);
|
|
@@ -410,7 +468,8 @@ type WhichValuePerEnv =
|
|
|
410
468
|
| 'efoBaseApi'
|
|
411
469
|
| 'efoBaseApiLocal'
|
|
412
470
|
| 'amlBaseApi'
|
|
413
|
-
| 'amlBaseApiLocal'
|
|
471
|
+
| 'amlBaseApiLocal'
|
|
472
|
+
| 'lkaUrl';
|
|
414
473
|
|
|
415
474
|
export const getStrValuePerEnv = (which: WhichValuePerEnv) => {
|
|
416
475
|
const valuesPerEnv: {
|
|
@@ -473,6 +532,11 @@ export const getStrValuePerEnv = (which: WhichValuePerEnv) => {
|
|
|
473
532
|
development: 'http://aml-dev.halyklife.nb/api',
|
|
474
533
|
test: 'http://aml-dev.halyklife.nb/api',
|
|
475
534
|
},
|
|
535
|
+
lkaUrl: {
|
|
536
|
+
production: '/#/efo',
|
|
537
|
+
development: '/#/efo',
|
|
538
|
+
test: '/#/efo',
|
|
539
|
+
},
|
|
476
540
|
};
|
|
477
541
|
return valuesPerEnv[which][import.meta.env.VITE_MODE as EnvModes];
|
|
478
542
|
};
|
|
@@ -491,6 +555,83 @@ export const getMainPageRoute = () => {
|
|
|
491
555
|
return 'index';
|
|
492
556
|
};
|
|
493
557
|
|
|
558
|
+
export const validateToken = (to: RouteType) => {
|
|
559
|
+
const dataStore = useDataStore();
|
|
560
|
+
if (to.query) {
|
|
561
|
+
if ('token' in to.query) {
|
|
562
|
+
const token = to.query.token as string;
|
|
563
|
+
if (isValidToken(token)) {
|
|
564
|
+
localStorage.setItem('accessToken', token);
|
|
565
|
+
dataStore.accessToken = token;
|
|
566
|
+
dataStore.getUserRoles();
|
|
567
|
+
}
|
|
568
|
+
} else {
|
|
569
|
+
const token = localStorage.getItem('accessToken') || null;
|
|
570
|
+
if (token && isValidToken(token)) {
|
|
571
|
+
dataStore.accessToken = token;
|
|
572
|
+
dataStore.getUserRoles();
|
|
573
|
+
} else {
|
|
574
|
+
dataStore.sendToParent(constants.postActions.toHomePage, dataStore.t('toaster.tokenExpire'));
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
export const validateRoute = (to: RouteType) => {
|
|
581
|
+
const dataStore = useDataStore();
|
|
582
|
+
const token = localStorage.getItem('accessToken') || null;
|
|
583
|
+
if (to && to.meta && 'requiresAuth' in to.meta && to.meta.requiresAuth && (!token || (token && isValidToken(token) === false))) {
|
|
584
|
+
localStorage.clear();
|
|
585
|
+
dataStore.sendToParent(constants.postActions.toHomePage, dataStore.t('toaster.tokenExpire'));
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
export const validateSettingsPanel = () => {
|
|
590
|
+
const dataStore = useDataStore();
|
|
591
|
+
const formStore = useFormStore();
|
|
592
|
+
const hasPanelItem = (id: string) => {
|
|
593
|
+
return !!Object.values(dataStore.settings.items).find(i => i.id === id);
|
|
594
|
+
};
|
|
595
|
+
// Bug in getApplicationData, if there is empty member it didn't update
|
|
596
|
+
// if (!hasPanelItem('reload') && route.params.taskId !== '0') {
|
|
597
|
+
// dataStore.settings.items.push(
|
|
598
|
+
// new MenuItem({
|
|
599
|
+
// id: 'reload',
|
|
600
|
+
// title: dataStore.t('buttons.reload'),
|
|
601
|
+
// icon: 'mdi-reload',
|
|
602
|
+
// action: async () => await dataStore.getApplicationData(route.params.taskId),
|
|
603
|
+
// }),
|
|
604
|
+
// );
|
|
605
|
+
// }
|
|
606
|
+
if (!hasPanelItem('reject') && dataStore.isInitiator()) {
|
|
607
|
+
dataStore.settings.items.push(
|
|
608
|
+
new MenuItem({
|
|
609
|
+
id: 'reject',
|
|
610
|
+
title: dataStore.t('buttons.cancelApplication'),
|
|
611
|
+
icon: 'mdi-close',
|
|
612
|
+
action: () => (dataStore.panelAction = constants.actions.rejectclient),
|
|
613
|
+
show: computed(() => dataStore.isTask() && dataStore.isProcessCancel(formStore.applicationData.statusCode)),
|
|
614
|
+
}),
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
if (!hasPanelItem('return') && (dataStore.isInitiator() || dataStore.isUnderwriter())) {
|
|
618
|
+
dataStore.settings.items.push(
|
|
619
|
+
new MenuItem({
|
|
620
|
+
id: 'return',
|
|
621
|
+
title: dataStore.t('buttons.returnStatement'),
|
|
622
|
+
icon: 'mdi-restore',
|
|
623
|
+
action: () => (dataStore.panelAction = constants.actions.return),
|
|
624
|
+
show: computed(() => dataStore.isTask() && dataStore.isProcessReturnable(formStore.applicationData.statusCode)),
|
|
625
|
+
}),
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
export const isIframe = () => {
|
|
631
|
+
if (window.location.hostname !== 'localhost' && useEnv().isProduction) return window.self !== window.top;
|
|
632
|
+
return true;
|
|
633
|
+
};
|
|
634
|
+
|
|
494
635
|
export const keyDeleter = <T extends object>(data: T, keys: Array<NestedKeyOf<T>>) => {
|
|
495
636
|
if (typeof data === 'object' && !!data && keys && Array.isArray(keys) && keys.length) {
|
|
496
637
|
keys.forEach(key => {
|
|
@@ -610,3 +751,198 @@ export const isEveryFormDisabled = (isDisabledForm: any) => {
|
|
|
610
751
|
};
|
|
611
752
|
|
|
612
753
|
export class ApiError extends AxiosError<any, any> {}
|
|
754
|
+
|
|
755
|
+
export class ProcessController {
|
|
756
|
+
isProcessEditable = (statusCode?: keyof typeof Statuses) => {
|
|
757
|
+
const getEditibleStatuses = () => {
|
|
758
|
+
const defaultStatuses = constants.editableStatuses;
|
|
759
|
+
return defaultStatuses;
|
|
760
|
+
};
|
|
761
|
+
return !!getEditibleStatuses().find(status => status === statusCode);
|
|
762
|
+
};
|
|
763
|
+
isProcessReturnable = (statusCode?: keyof typeof Statuses) => {
|
|
764
|
+
const getReturnableStatuses = () => {
|
|
765
|
+
const defaultStatuses = constants.returnStatementStatuses;
|
|
766
|
+
return defaultStatuses;
|
|
767
|
+
};
|
|
768
|
+
return !!getReturnableStatuses().find(status => status === statusCode);
|
|
769
|
+
};
|
|
770
|
+
isProcessCancel = (statusCode?: keyof typeof Statuses) => {
|
|
771
|
+
const getCanceleStatuses = () => {
|
|
772
|
+
const defaultStatuses = constants.cancelApplicationStatuses;
|
|
773
|
+
return defaultStatuses;
|
|
774
|
+
};
|
|
775
|
+
return !!getCanceleStatuses().find(status => status === statusCode);
|
|
776
|
+
};
|
|
777
|
+
isProcessReject = (statusCode?: keyof typeof Statuses) => {
|
|
778
|
+
const getRejectStatuses = () => {
|
|
779
|
+
const defaultStatuses = constants.rejectApplicationStatuses;
|
|
780
|
+
return defaultStatuses;
|
|
781
|
+
};
|
|
782
|
+
return !!getRejectStatuses().find(status => status === statusCode);
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
export class RoleController {
|
|
787
|
+
user: User = new User();
|
|
788
|
+
|
|
789
|
+
isRole = (whichRole: keyof typeof Roles) => {
|
|
790
|
+
if (this.user.roles.length === 0) {
|
|
791
|
+
const token = localStorage.getItem('accessToken') || null;
|
|
792
|
+
if (token) {
|
|
793
|
+
const decoded = jwtDecode(token);
|
|
794
|
+
if (decoded) {
|
|
795
|
+
this.user.id = String(decoded.sub);
|
|
796
|
+
this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
|
|
797
|
+
this.user.code = decoded.code;
|
|
798
|
+
this.user.branchCode = decoded.branchCode;
|
|
799
|
+
const key = getKeyWithPattern(decoded, 'role');
|
|
800
|
+
if (key) {
|
|
801
|
+
const roles = decoded[key as keyof Utils.JwtToken];
|
|
802
|
+
if (typeof roles === 'string') {
|
|
803
|
+
this.user.roles.push(roles);
|
|
804
|
+
} else if (typeof roles === 'object') {
|
|
805
|
+
this.user.roles = roles;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return !!this.user.roles.find(i => i === whichRole);
|
|
812
|
+
};
|
|
813
|
+
isInitiator = (productFromExternal?: string) => {
|
|
814
|
+
const env = useEnv();
|
|
815
|
+
const dataStore = useDataStore();
|
|
816
|
+
const hasAccessByProduct = (() => {
|
|
817
|
+
const product = productFromExternal as Projects;
|
|
818
|
+
if (dataStore.isLifetrip || product === 'lifetrip') return this.isBranchDirector() || this.isTravelAgent();
|
|
819
|
+
if (dataStore.isPension || product === 'pensionannuitynew') return this.isBranchDirector() || this.isExecutor() || this.isRegionDirector();
|
|
820
|
+
if (dataStore.isLifeBusiness || product === 'lifebusiness') return this.isHeadManager() || this.isBranchDirector() || this.isRegionDirector();
|
|
821
|
+
if (dataStore.isCritical || product === 'criticalillness') return this.isBranchDirector();
|
|
822
|
+
return false;
|
|
823
|
+
})();
|
|
824
|
+
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager() || this.isAgentAuletti() || hasAccessByProduct;
|
|
825
|
+
};
|
|
826
|
+
isManager = () => this.isRole(constants.roles.Manager);
|
|
827
|
+
isCompliance = () => this.isRole(constants.roles.Compliance);
|
|
828
|
+
isAdmin = () => this.isRole(constants.roles.Admin);
|
|
829
|
+
isJurist = () => this.isRole(constants.roles.Jurist);
|
|
830
|
+
isAgent = () => this.isRole(constants.roles.Agent);
|
|
831
|
+
isManagerHalykBank = () => this.isRole(constants.roles.ManagerHalykBank);
|
|
832
|
+
isServiceManager = () => this.isRole(constants.roles.ServiceManager);
|
|
833
|
+
isUSNSsanctioner = () => this.isRole(constants.roles.USNSsanctioner);
|
|
834
|
+
isUnderwriter = () => this.isRole(constants.roles.Underwriter);
|
|
835
|
+
isActuary = () => this.isRole(constants.roles.Actuary);
|
|
836
|
+
isAgentMycar = () => this.isRole(constants.roles.AgentMycar);
|
|
837
|
+
isAgentAuletti = () => this.isRole(constants.roles.AgentAuletti);
|
|
838
|
+
isManagerAuletti = () => this.isRole(constants.roles.ManagerAuletti);
|
|
839
|
+
isAnalyst = () => this.isRole(constants.roles.Analyst);
|
|
840
|
+
isAuditor = () => this.isRole(constants.roles.Auditor);
|
|
841
|
+
isUpk = () => this.isRole(constants.roles.UPK);
|
|
842
|
+
isUrp = () => this.isRole(constants.roles.URP);
|
|
843
|
+
isUsns = () => this.isRole(constants.roles.USNS);
|
|
844
|
+
isNotAccumulativeSanctionerUSNS = () => this.isRole(constants.roles.NotAccumulativeSanctionerUSNS);
|
|
845
|
+
isAccountant = () => this.isRole(constants.roles.Accountant);
|
|
846
|
+
isDrn = () => this.isRole(constants.roles.DRNSJ);
|
|
847
|
+
isSupport = () => this.isRole(constants.roles.Support);
|
|
848
|
+
isFinCenter = () => this.isRole(constants.roles.FinCenter);
|
|
849
|
+
isSupervisor = () => this.isRole(constants.roles.Supervisor);
|
|
850
|
+
isHeadManager = () => this.isRole(constants.roles.HeadManager);
|
|
851
|
+
isBranchDirector = () => this.isRole(constants.roles.BranchDirector);
|
|
852
|
+
isRegionDirector = () => this.isRole(constants.roles.RegionDirector);
|
|
853
|
+
isUSNSACCINS = () => this.isRole(constants.roles.USNSACCINS);
|
|
854
|
+
isDsuio = () => this.isRole(constants.roles.Dsuio);
|
|
855
|
+
isHeadDso = () => this.isRole(constants.roles.HEADDSO);
|
|
856
|
+
isAdjuster = () => this.isRole(constants.roles.SettlementLosses);
|
|
857
|
+
isHeadAdjuster = () => this.isRole(constants.roles.HeadSettlementLosses);
|
|
858
|
+
isDsoDirector = () => this.isRole(constants.roles.DsoDirector);
|
|
859
|
+
isArchivist = () => this.isRole(constants.roles.Archivist);
|
|
860
|
+
isAccountantDirector = () => this.isRole(constants.roles.AccountantDirector);
|
|
861
|
+
isHeadOfDso = () => this.isRole(constants.roles.HeadOfDso);
|
|
862
|
+
isUrsp = () => this.isRole(constants.roles.URSP);
|
|
863
|
+
isExecutor = () => this.isRole(constants.roles.ExecutorGPH);
|
|
864
|
+
isDsuioOrv = () => this.isRole(constants.roles.DsuioOrv);
|
|
865
|
+
isUKP = () => this.isRole(constants.roles.UKP);
|
|
866
|
+
isDpDirector = () => this.isRole(constants.roles.DpDirector);
|
|
867
|
+
isSecurity = () => this.isRole(constants.roles.Security);
|
|
868
|
+
isURAP = () => this.isRole(constants.roles.URAP);
|
|
869
|
+
isTravelAgent = () => this.isRole(constants.roles.TravelAgent);
|
|
870
|
+
isHR = () => this.isRole(constants.roles.HR);
|
|
871
|
+
isReInsurer = () => this.isRole(constants.roles.ReInsurer);
|
|
872
|
+
hasAccess = () => {
|
|
873
|
+
const baseAccessRoles = this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn() || this.isDsuioOrv() || this.isAuditor();
|
|
874
|
+
return {
|
|
875
|
+
invoiceInfo: this.isAdmin() || this.isSupport(),
|
|
876
|
+
toLKA: this.isAgent() || this.isManagerHalykBank() || baseAccessRoles,
|
|
877
|
+
toLKAv2: this.isHR() || baseAccessRoles,
|
|
878
|
+
toAML: this.isCompliance() || baseAccessRoles,
|
|
879
|
+
toAULETTI: this.isAgentAuletti() || this.isManagerAuletti() || baseAccessRoles,
|
|
880
|
+
toLKA_A: this.isAgentAuletti() || baseAccessRoles,
|
|
881
|
+
toUU:
|
|
882
|
+
this.isDsuio() ||
|
|
883
|
+
this.isActuary() ||
|
|
884
|
+
this.isUSNSACCINS() ||
|
|
885
|
+
this.isServiceManager() ||
|
|
886
|
+
this.isAccountant() ||
|
|
887
|
+
this.isAdjuster() ||
|
|
888
|
+
this.isHeadAdjuster() ||
|
|
889
|
+
this.isArchivist() ||
|
|
890
|
+
this.isSecurity() ||
|
|
891
|
+
baseAccessRoles,
|
|
892
|
+
toReinsurance: this.isReInsurer() || this.isAdjuster() || this.isHeadAdjuster() || baseAccessRoles,
|
|
893
|
+
toReporting: this.isServiceManager() || baseAccessRoles,
|
|
894
|
+
toDSO:
|
|
895
|
+
this.isUsns() ||
|
|
896
|
+
this.isDsuio() ||
|
|
897
|
+
this.isActuary() ||
|
|
898
|
+
this.isHeadOfDso() ||
|
|
899
|
+
this.isAccountant() ||
|
|
900
|
+
this.isUSNSACCINS() ||
|
|
901
|
+
this.isDsoDirector() ||
|
|
902
|
+
this.isNotAccumulativeSanctionerUSNS() ||
|
|
903
|
+
this.isServiceManager() ||
|
|
904
|
+
this.isUSNSsanctioner() ||
|
|
905
|
+
this.isAccountantDirector() ||
|
|
906
|
+
baseAccessRoles,
|
|
907
|
+
toEFO:
|
|
908
|
+
this.isManager() ||
|
|
909
|
+
this.isAgent() ||
|
|
910
|
+
this.isAgentMycar() ||
|
|
911
|
+
this.isManagerHalykBank() ||
|
|
912
|
+
this.isHeadManager() ||
|
|
913
|
+
this.isServiceManager() ||
|
|
914
|
+
this.isUSNSsanctioner() ||
|
|
915
|
+
this.isUnderwriter() ||
|
|
916
|
+
this.isActuary() ||
|
|
917
|
+
this.isCompliance() ||
|
|
918
|
+
this.isUpk() ||
|
|
919
|
+
this.isFinCenter() ||
|
|
920
|
+
this.isSupervisor() ||
|
|
921
|
+
this.isUrp() ||
|
|
922
|
+
this.isUsns() ||
|
|
923
|
+
this.isJurist() ||
|
|
924
|
+
this.isAccountant() ||
|
|
925
|
+
this.isBranchDirector() ||
|
|
926
|
+
this.isRegionDirector() ||
|
|
927
|
+
this.isUSNSACCINS() ||
|
|
928
|
+
this.isDsuio() ||
|
|
929
|
+
this.isAdjuster() ||
|
|
930
|
+
this.isDsoDirector() ||
|
|
931
|
+
this.isAccountantDirector() ||
|
|
932
|
+
this.isHeadAdjuster() ||
|
|
933
|
+
this.isHeadOfDso() ||
|
|
934
|
+
this.isUrsp() ||
|
|
935
|
+
this.isExecutor() ||
|
|
936
|
+
this.isArchivist() ||
|
|
937
|
+
this.isUKP() ||
|
|
938
|
+
this.isDpDirector() ||
|
|
939
|
+
this.isSecurity() ||
|
|
940
|
+
this.isURAP() ||
|
|
941
|
+
this.isTravelAgent() ||
|
|
942
|
+
this.isHR() ||
|
|
943
|
+
this.isNotAccumulativeSanctionerUSNS() ||
|
|
944
|
+
this.isReInsurer() ||
|
|
945
|
+
baseAccessRoles,
|
|
946
|
+
};
|
|
947
|
+
};
|
|
948
|
+
}
|