hl-core 0.0.8-beta.3 → 0.0.8-beta.31
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 +77 -21
- package/api/interceptors.ts +17 -13
- package/components/Dialog/Dialog.vue +7 -37
- package/components/Form/FormBlock.vue +65 -28
- package/components/Form/FormSection.vue +4 -1
- package/components/Form/ManagerAttachment.vue +197 -0
- package/components/Form/ProductConditionsBlock.vue +64 -12
- package/components/Input/Datepicker.vue +5 -1
- package/components/Input/FormInput.vue +28 -7
- package/components/Input/PanelInput.vue +5 -0
- package/components/Input/RoundedSelect.vue +137 -0
- package/components/Layout/Drawer.vue +1 -0
- package/components/Layout/Header.vue +40 -4
- package/components/Layout/SettingsPanel.vue +39 -9
- package/components/Menu/MenuHover.vue +30 -0
- package/components/Menu/MenuNav.vue +28 -11
- package/components/Menu/MenuNavItem.vue +5 -2
- package/components/Pages/Anketa.vue +38 -21
- package/components/Pages/Auth.vue +145 -30
- package/components/Pages/InvoiceInfo.vue +30 -0
- package/components/Pages/MemberForm.vue +381 -144
- package/components/Pages/ProductConditions.vue +496 -17
- package/components/Panel/PanelHandler.vue +75 -2
- package/components/Utilities/Chip.vue +27 -0
- package/components/Utilities/JsonViewer.vue +27 -0
- package/composables/classes.ts +165 -25
- package/composables/constants.ts +13 -1
- package/composables/index.ts +58 -2
- package/composables/styles.ts +9 -3
- package/configs/i18n.ts +19 -0
- package/layouts/default.vue +2 -2
- package/locales/en.json +583 -0
- package/locales/kz.json +583 -0
- package/locales/ru.json +585 -0
- package/nuxt.config.ts +8 -0
- package/package.json +15 -9
- package/pages/500.vue +1 -1
- package/pages/Token.vue +51 -0
- package/plugins/helperFunctionsPlugins.ts +3 -0
- package/plugins/storePlugin.ts +0 -1
- package/plugins/vuetifyPlugin.ts +8 -1
- package/store/data.store.js +705 -624
- package/store/member.store.ts +147 -22
- package/store/rules.js +41 -3
- package/types/index.ts +39 -0
- package/store/messages.ts +0 -434
package/store/data.store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
|
-
import { t } from './messages';
|
|
3
2
|
import { rules } from './rules';
|
|
3
|
+
import { i18n } from '@/configs/i18n';
|
|
4
4
|
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
5
5
|
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
|
|
6
6
|
import { DataStoreClass, Contragent } from '../composables/classes';
|
|
@@ -10,7 +10,7 @@ import { useFormStore } from './form.store';
|
|
|
10
10
|
export const useDataStore = defineStore('data', {
|
|
11
11
|
state: () => ({
|
|
12
12
|
...new DataStoreClass(),
|
|
13
|
-
t: t,
|
|
13
|
+
t: i18n.t,
|
|
14
14
|
rules: rules,
|
|
15
15
|
toast: Toast,
|
|
16
16
|
toastTypes: Types,
|
|
@@ -31,6 +31,9 @@ export const useDataStore = defineStore('data', {
|
|
|
31
31
|
}),
|
|
32
32
|
getters: {
|
|
33
33
|
isEFO: state => state.product === 'efo',
|
|
34
|
+
isAML: state => state.product === 'aml',
|
|
35
|
+
isLKA: state => state.product === 'lka',
|
|
36
|
+
isBridge: state => state.product === 'efo' || state.product === 'aml' || state.product === 'lka',
|
|
34
37
|
isBaiterek: state => state.product === 'baiterek',
|
|
35
38
|
isBolashak: state => state.product === 'bolashak',
|
|
36
39
|
isMycar: state => state.product === 'mycar',
|
|
@@ -38,7 +41,14 @@ export const useDataStore = defineStore('data', {
|
|
|
38
41
|
isLiferenta: state => state.product === 'liferenta',
|
|
39
42
|
isPension: state => state.product === 'pension',
|
|
40
43
|
isGons: state => state.product === 'gons',
|
|
44
|
+
isKazyna: state => state.product === 'halykkazyna',
|
|
45
|
+
isCalculator: state => state.product === 'calculator',
|
|
46
|
+
isComplianceWindow: state => state.product === 'compliance',
|
|
41
47
|
isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
|
|
48
|
+
hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
49
|
+
isClientAnketaCondition: state =>
|
|
50
|
+
!state.formStore.insuredForm.find(member => member.iin === state.formStore.policyholderForm.iin) &&
|
|
51
|
+
!!state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10 && i.coverSumCode === 'included'),
|
|
42
52
|
},
|
|
43
53
|
actions: {
|
|
44
54
|
isIframe() {
|
|
@@ -62,7 +72,7 @@ export const useDataStore = defineStore('data', {
|
|
|
62
72
|
},
|
|
63
73
|
copyToClipboard(text) {
|
|
64
74
|
if (typeof text === 'string' || typeof text === 'number') {
|
|
65
|
-
if (this.
|
|
75
|
+
if (this.isBridge) {
|
|
66
76
|
navigator.clipboard.writeText(text);
|
|
67
77
|
} else {
|
|
68
78
|
this.sendToParent(constants.postActions.clipboard, text);
|
|
@@ -107,17 +117,30 @@ export const useDataStore = defineStore('data', {
|
|
|
107
117
|
this.refreshToken = response.refreshToken;
|
|
108
118
|
this.getUserRoles();
|
|
109
119
|
}
|
|
120
|
+
const checkPermission = () => {
|
|
121
|
+
if (this.isAML) {
|
|
122
|
+
return this.isCompliance() || this.isAdmin() || this.isSupport() || this.isAnalyst();
|
|
123
|
+
}
|
|
124
|
+
if (this.isLKA) {
|
|
125
|
+
return this.isAgent() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
|
|
126
|
+
}
|
|
127
|
+
if (this.isEFO) {
|
|
128
|
+
return (
|
|
129
|
+
this.isInitiator() ||
|
|
130
|
+
this.isUnderwriter() ||
|
|
131
|
+
this.isAdmin() ||
|
|
132
|
+
this.isCompliance() ||
|
|
133
|
+
this.isAnalyst() ||
|
|
134
|
+
this.isUpk() ||
|
|
135
|
+
this.isFinCenter() ||
|
|
136
|
+
this.isSupervisor() ||
|
|
137
|
+
this.isSupport()
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
141
|
+
};
|
|
110
142
|
if (this.controls.onAuth) {
|
|
111
|
-
const hasPermission =
|
|
112
|
-
this.isInitiator() ||
|
|
113
|
-
this.isUnderwriter() ||
|
|
114
|
-
this.isAdmin() ||
|
|
115
|
-
this.isCompliance() ||
|
|
116
|
-
this.isAnalyst() ||
|
|
117
|
-
this.isUpk() ||
|
|
118
|
-
this.isFinanceCenter() ||
|
|
119
|
-
this.isSupervisor() ||
|
|
120
|
-
this.isSupport();
|
|
143
|
+
const hasPermission = checkPermission();
|
|
121
144
|
if (hasPermission) {
|
|
122
145
|
localStorage.setItem('accessToken', this.accessToken);
|
|
123
146
|
localStorage.setItem('refreshToken', this.refreshToken);
|
|
@@ -150,6 +173,9 @@ export const useDataStore = defineStore('data', {
|
|
|
150
173
|
}
|
|
151
174
|
}
|
|
152
175
|
},
|
|
176
|
+
getUserData() {
|
|
177
|
+
return this.accessToken ? jwtDecode(this.accessToken) : null;
|
|
178
|
+
},
|
|
153
179
|
isRole(whichRole) {
|
|
154
180
|
if (this.user.roles.length === 0) {
|
|
155
181
|
this.getUserRoles();
|
|
@@ -196,8 +222,8 @@ export const useDataStore = defineStore('data', {
|
|
|
196
222
|
isSupport() {
|
|
197
223
|
return this.isRole(constants.roles.support);
|
|
198
224
|
},
|
|
199
|
-
|
|
200
|
-
return this.isRole(constants.roles.
|
|
225
|
+
isFinCenter() {
|
|
226
|
+
return this.isRole(constants.roles.finCenter);
|
|
201
227
|
},
|
|
202
228
|
isSupervisor() {
|
|
203
229
|
return this.isRole(constants.roles.supervisor);
|
|
@@ -205,6 +231,20 @@ export const useDataStore = defineStore('data', {
|
|
|
205
231
|
isProcessEditable(statusCode) {
|
|
206
232
|
return !!constants.editableStatuses.find(status => status === statusCode);
|
|
207
233
|
},
|
|
234
|
+
isProcessReturnable(statusCode) {
|
|
235
|
+
const getReturnableStatuses = () => {
|
|
236
|
+
const defaultStatuses = constants.returnStatementStatuses;
|
|
237
|
+
return defaultStatuses;
|
|
238
|
+
};
|
|
239
|
+
return !!getReturnableStatuses().find(status => status === statusCode);
|
|
240
|
+
},
|
|
241
|
+
isProcessCancel(statusCode) {
|
|
242
|
+
const getCanceleStatuses = () => {
|
|
243
|
+
const defaultStatuses = constants.cancelApplicationStatuses;
|
|
244
|
+
return defaultStatuses;
|
|
245
|
+
};
|
|
246
|
+
return !!getCanceleStatuses().find(status => status === statusCode);
|
|
247
|
+
},
|
|
208
248
|
isTask() {
|
|
209
249
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
210
250
|
},
|
|
@@ -303,7 +343,7 @@ export const useDataStore = defineStore('data', {
|
|
|
303
343
|
}
|
|
304
344
|
}
|
|
305
345
|
},
|
|
306
|
-
async getContragent(member,
|
|
346
|
+
async getContragent(member, load = true) {
|
|
307
347
|
if (load) {
|
|
308
348
|
this.isLoading = true;
|
|
309
349
|
}
|
|
@@ -318,10 +358,10 @@ export const useDataStore = defineStore('data', {
|
|
|
318
358
|
response = await this.api.getContragent(queryData);
|
|
319
359
|
if (response.totalItems > 0) {
|
|
320
360
|
if (response.totalItems.length === 1) {
|
|
321
|
-
await this.serializeContragentData(
|
|
361
|
+
await this.serializeContragentData(member, response.items[0]);
|
|
322
362
|
} else {
|
|
323
363
|
const sortedByRegistrationDate = response.items.sort((left, right) => new Date(right.registrationDate) - new Date(left.registrationDate));
|
|
324
|
-
await this.serializeContragentData(
|
|
364
|
+
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
325
365
|
}
|
|
326
366
|
member.gotFromInsis = true;
|
|
327
367
|
} else {
|
|
@@ -339,14 +379,15 @@ export const useDataStore = defineStore('data', {
|
|
|
339
379
|
this.isLoading = true;
|
|
340
380
|
}
|
|
341
381
|
try {
|
|
382
|
+
const member = whichIndex === null ? this.formStore[whichForm] : this.formStore[whichForm][whichIndex];
|
|
342
383
|
if (this.isMycar && this.isAgentMycar() && whichForm === this.formStore.beneficiaryFormKey) {
|
|
343
|
-
await this.serializeContragentData(
|
|
384
|
+
await this.serializeContragentData(member, this.formStore.applicationData.beneficiaryApp[0]);
|
|
344
385
|
this.isLoading = false;
|
|
345
386
|
return;
|
|
346
387
|
}
|
|
347
388
|
const response = await this.api.getContragentById(id);
|
|
348
389
|
if (response.totalItems > 0) {
|
|
349
|
-
await this.serializeContragentData(
|
|
390
|
+
await this.serializeContragentData(member, response.items[0]);
|
|
350
391
|
} else {
|
|
351
392
|
this.isLoading = false;
|
|
352
393
|
return false;
|
|
@@ -358,58 +399,35 @@ export const useDataStore = defineStore('data', {
|
|
|
358
399
|
this.isLoading = false;
|
|
359
400
|
}
|
|
360
401
|
},
|
|
361
|
-
async serializeContragentData(
|
|
402
|
+
async serializeContragentData(member, contragent) {
|
|
362
403
|
const [{ value: data }, { value: contacts }, { value: documents }, { value: address }] = await Promise.allSettled([
|
|
363
404
|
this.api.getContrAgentData(contragent.id),
|
|
364
405
|
this.api.getContrAgentContacts(contragent.id),
|
|
365
406
|
this.api.getContrAgentDocuments(contragent.id),
|
|
366
407
|
this.api.getContrAgentAddress(contragent.id),
|
|
367
408
|
]);
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
this.formStore[whichForm].response.questionnaires = data;
|
|
374
|
-
}
|
|
375
|
-
if (contacts && contacts.length) {
|
|
376
|
-
this.formStore[whichForm].response.contacts = contacts;
|
|
377
|
-
}
|
|
378
|
-
if (documents && documents.length) {
|
|
379
|
-
this.formStore[whichForm].response.documents = documents;
|
|
380
|
-
}
|
|
381
|
-
if (address && address.length) {
|
|
382
|
-
this.formStore[whichForm].response.addresses = address;
|
|
383
|
-
}
|
|
409
|
+
member.response = {
|
|
410
|
+
contragent: contragent,
|
|
411
|
+
};
|
|
412
|
+
if (data && data.length) {
|
|
413
|
+
member.response.questionnaires = data;
|
|
384
414
|
}
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
contragent: contragent,
|
|
388
|
-
};
|
|
389
|
-
if (data && data.length) {
|
|
390
|
-
this.formStore[whichForm][whichIndex].response.questionnaires = data;
|
|
391
|
-
}
|
|
392
|
-
if (contacts && contacts.length) {
|
|
393
|
-
this.formStore[whichForm][whichIndex].response.contacts = contacts;
|
|
394
|
-
}
|
|
395
|
-
if (documents && documents.length) {
|
|
396
|
-
this.formStore[whichForm][whichIndex].response.documents = documents;
|
|
397
|
-
}
|
|
398
|
-
if (address && address.length) {
|
|
399
|
-
this.formStore[whichForm][whichIndex].response.addresses = address;
|
|
400
|
-
}
|
|
415
|
+
if (contacts && contacts.length) {
|
|
416
|
+
member.response.contacts = contacts;
|
|
401
417
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
418
|
+
if (documents && documents.length) {
|
|
419
|
+
member.response.documents = documents;
|
|
420
|
+
}
|
|
421
|
+
if (address && address.length) {
|
|
422
|
+
member.response.addresses = address;
|
|
423
|
+
}
|
|
424
|
+
this.parseContragent(member, {
|
|
425
|
+
personalData: contragent,
|
|
426
|
+
documents: documents,
|
|
427
|
+
contacts: contacts,
|
|
428
|
+
data: data,
|
|
429
|
+
address: address,
|
|
430
|
+
});
|
|
413
431
|
},
|
|
414
432
|
async searchContragent(iin) {
|
|
415
433
|
this.isLoading = true;
|
|
@@ -432,142 +450,80 @@ export const useDataStore = defineStore('data', {
|
|
|
432
450
|
}
|
|
433
451
|
this.isLoading = false;
|
|
434
452
|
},
|
|
435
|
-
parseContragent(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
this.formStore[whichForm].registrationCountry = country ? country : new Value();
|
|
478
|
-
this.formStore[whichForm].registrationStreet = user.address[0].streetName;
|
|
479
|
-
this.formStore[whichForm].registrationCity = city ? city : new Value();
|
|
480
|
-
this.formStore[whichForm].registrationNumberApartment = user.address[0].apartmentNumber;
|
|
481
|
-
this.formStore[whichForm].registrationNumberHouse = user.address[0].blockNumber;
|
|
482
|
-
this.formStore[whichForm].registrationProvince = province ? province : new Value();
|
|
483
|
-
this.formStore[whichForm].registrationRegionType = localityType ? localityType : new Value();
|
|
484
|
-
this.formStore[whichForm].registrationRegion = region ? region : new Value();
|
|
485
|
-
this.formStore[whichForm].registrationQuarter = user.address[0].kvartal;
|
|
486
|
-
this.formStore[whichForm].registrationMicroDistrict = user.address[0].microRaion;
|
|
487
|
-
}
|
|
488
|
-
if ('contacts' in user && user.contacts.length) {
|
|
489
|
-
user.contacts.forEach(contact => {
|
|
490
|
-
if (contact.type === 'EMAIL' && contact.value) {
|
|
491
|
-
this.formStore[whichForm].email = contact.value;
|
|
492
|
-
}
|
|
493
|
-
if (contact.type === 'MOBILE' && contact.value) {
|
|
494
|
-
let phoneNumber = contact.value.substring(1);
|
|
495
|
-
this.formStore[whichForm].phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
|
|
496
|
-
}
|
|
497
|
-
if (contact.type === 'HOME' && contact.value) {
|
|
498
|
-
let homePhone = contact.value.substring(1);
|
|
499
|
-
this.formStore[whichForm].homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
}
|
|
453
|
+
parseContragent(member, user) {
|
|
454
|
+
// Save User Personal Data
|
|
455
|
+
member.verifyType = user.personalData.verifyType;
|
|
456
|
+
member.verifyDate = user.personalData.verifyDate;
|
|
457
|
+
member.iin = reformatIin(user.personalData.iin);
|
|
458
|
+
member.age = user.personalData.age;
|
|
459
|
+
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
460
|
+
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
461
|
+
member.gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
|
|
462
|
+
member.gender.id = user.personalData.gender;
|
|
463
|
+
member.birthDate = reformatDate(user.personalData.birthDate);
|
|
464
|
+
member.genderName = user.personalData.genderName;
|
|
465
|
+
member.lastName = user.personalData.lastName;
|
|
466
|
+
member.longName = user.personalData.longName;
|
|
467
|
+
member.middleName = user.personalData.middleName ? user.personalData.middleName : '';
|
|
468
|
+
member.firstName = user.personalData.firstName;
|
|
469
|
+
member.id = user.personalData.id;
|
|
470
|
+
member.type = user.personalData.type;
|
|
471
|
+
member.registrationDate = user.personalData.registrationDate;
|
|
472
|
+
// Save User Documents Data
|
|
473
|
+
if ('documents' in user && user.documents.length) {
|
|
474
|
+
member.documentsList = user.documents;
|
|
475
|
+
const documentByPriority = (() => {
|
|
476
|
+
if (this.isLifetrip) {
|
|
477
|
+
return user.documents.find(i => i.type === 'PS');
|
|
478
|
+
}
|
|
479
|
+
return user.documents.find(i => i.type === '1UDL');
|
|
480
|
+
})();
|
|
481
|
+
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
482
|
+
const documentType = this.documentTypes.find(i => i.ids === userDocument.type);
|
|
483
|
+
const documentIssuer = this.documentIssuers.find(i => i.nameRu === userDocument.issuerNameRu);
|
|
484
|
+
member.documentType = documentType ? documentType : new Value();
|
|
485
|
+
member.documentNumber = userDocument.number;
|
|
486
|
+
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
487
|
+
member.documentDate = reformatDate(userDocument.issueDate);
|
|
488
|
+
member.documentExpire = reformatDate(userDocument.expireDate);
|
|
489
|
+
}
|
|
490
|
+
// Document detail (residency, economy code, etc..)
|
|
491
|
+
if ('data' in user && user.data.length) {
|
|
492
|
+
user.data.forEach(dataObject => {
|
|
493
|
+
this.searchFromList(member, dataObject);
|
|
494
|
+
});
|
|
503
495
|
}
|
|
504
|
-
if (
|
|
505
|
-
|
|
506
|
-
this.
|
|
507
|
-
this.
|
|
508
|
-
this.
|
|
509
|
-
this.
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
user.data.forEach(dataObject => {
|
|
536
|
-
this.searchFromList(whichForm, dataObject, whichIndex);
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
if ('address' in user && user.address.length) {
|
|
540
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address.countryName, 'i')));
|
|
541
|
-
const province = this.states.find(i => i.ids === user.address[0].stateCode);
|
|
542
|
-
const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
|
|
543
|
-
const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
|
|
544
|
-
const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
|
|
545
|
-
this.formStore[whichForm][whichIndex].registrationCountry = country ? country : new Value();
|
|
546
|
-
this.formStore[whichForm][whichIndex].registrationStreet = user.address[0].streetName;
|
|
547
|
-
this.formStore[whichForm][whichIndex].registrationCity = city ? city : new Value();
|
|
548
|
-
this.formStore[whichForm][whichIndex].registrationNumberApartment = user.address[0].apartmentNumber;
|
|
549
|
-
this.formStore[whichForm][whichIndex].registrationNumberHouse = user.address[0].blockNumber;
|
|
550
|
-
this.formStore[whichForm][whichIndex].registrationProvince = province ? province : new Value();
|
|
551
|
-
this.formStore[whichForm][whichIndex].registrationRegionType = localityType ? localityType : new Value();
|
|
552
|
-
this.formStore[whichForm][whichIndex].registrationRegion = region ? region : new Value();
|
|
553
|
-
this.formStore[whichForm][whichIndex].registrationQuarter = user.address[0].kvartal;
|
|
554
|
-
this.formStore[whichForm][whichIndex].registrationMicroDistrict = user.address[0].microRaion;
|
|
555
|
-
}
|
|
556
|
-
if ('contacts' in user && user.contacts.length) {
|
|
557
|
-
user.contacts.forEach(contact => {
|
|
558
|
-
if (contact.type === 'EMAIL' && contact.value) {
|
|
559
|
-
this.formStore[whichForm][whichIndex].email = contact.value;
|
|
560
|
-
}
|
|
561
|
-
if (contact.type === 'MOBILE' && contact.value) {
|
|
562
|
-
let phoneNumber = contact.value.substring(1);
|
|
563
|
-
this.formStore[whichForm][whichIndex].phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
|
|
564
|
-
}
|
|
565
|
-
if (contact.type === 'HOME' && contact.value) {
|
|
566
|
-
let homePhone = contact.value.substring(1);
|
|
567
|
-
this.formStore[whichForm][whichIndex].homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
}
|
|
496
|
+
if ('address' in user && user.address.length) {
|
|
497
|
+
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address[0].countryName, 'i')));
|
|
498
|
+
const province = this.states.find(i => i.ids === user.address[0].stateCode);
|
|
499
|
+
const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
|
|
500
|
+
const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
|
|
501
|
+
const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
|
|
502
|
+
member.registrationCountry = country ? country : new Value();
|
|
503
|
+
member.registrationStreet = user.address[0].streetName;
|
|
504
|
+
member.registrationCity = city ? city : new Value();
|
|
505
|
+
member.registrationNumberApartment = user.address[0].apartmentNumber;
|
|
506
|
+
member.registrationNumberHouse = user.address[0].blockNumber;
|
|
507
|
+
member.registrationProvince = province ? province : new Value();
|
|
508
|
+
member.registrationRegionType = localityType ? localityType : new Value();
|
|
509
|
+
member.registrationRegion = region ? region : new Value();
|
|
510
|
+
member.registrationQuarter = user.address[0].kvartal;
|
|
511
|
+
member.registrationMicroDistrict = user.address[0].microRaion;
|
|
512
|
+
}
|
|
513
|
+
if ('contacts' in user && user.contacts.length) {
|
|
514
|
+
user.contacts.forEach(contact => {
|
|
515
|
+
if (contact.type === 'EMAIL' && contact.value) {
|
|
516
|
+
member.email = contact.value;
|
|
517
|
+
}
|
|
518
|
+
if (contact.type === 'MOBILE' && contact.value && !member.phoneNumber) {
|
|
519
|
+
let phoneNumber = contact.value.substring(1);
|
|
520
|
+
member.phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
|
|
521
|
+
}
|
|
522
|
+
if (contact.type === 'HOME' && contact.value) {
|
|
523
|
+
let homePhone = contact.value.substring(1);
|
|
524
|
+
member.homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
|
|
525
|
+
}
|
|
526
|
+
});
|
|
571
527
|
}
|
|
572
528
|
},
|
|
573
529
|
async alreadyInInsis(iin, firstName, lastName, middleName) {
|
|
@@ -633,7 +589,7 @@ export const useDataStore = defineStore('data', {
|
|
|
633
589
|
gender: user.gender.id,
|
|
634
590
|
genderName: user.genderName ? user.genderName : user.gender.nameRu,
|
|
635
591
|
birthPlace: user.birthPlace.nameRu,
|
|
636
|
-
age: user.age,
|
|
592
|
+
age: Number(user.age),
|
|
637
593
|
registrationDate: user.registrationDate,
|
|
638
594
|
verifyType: user.verifyType,
|
|
639
595
|
verifyDate: user.verifyDate,
|
|
@@ -658,7 +614,7 @@ export const useDataStore = defineStore('data', {
|
|
|
658
614
|
questName = 'Страна налогового резиденства';
|
|
659
615
|
}
|
|
660
616
|
return {
|
|
661
|
-
id: 'response' in user && 'questionnaires' in user.response ? user.response.questionnaires?.find(i => i.questId == questionId).id : question.id,
|
|
617
|
+
id: 'response' in user && user.response && 'questionnaires' in user.response ? user.response.questionnaires?.find(i => i.questId == questionId).id : question.id,
|
|
662
618
|
contragentId: user.id,
|
|
663
619
|
questAnswer: question.ids,
|
|
664
620
|
questId: questionId,
|
|
@@ -669,7 +625,7 @@ export const useDataStore = defineStore('data', {
|
|
|
669
625
|
if (user.countryOfTaxResidency.ids !== '500014.3') {
|
|
670
626
|
user.addTaxResidency = new Value();
|
|
671
627
|
}
|
|
672
|
-
const addTaxResidency = 'response' in user && 'questionnaires' in user.response && user.response.questionnaires.find(i => i.questId === '507777');
|
|
628
|
+
const addTaxResidency = 'response' in user && user.response && 'questionnaires' in user.response && user.response.questionnaires.find(i => i.questId === '507777');
|
|
673
629
|
if (user.addTaxResidency.nameRu !== null) {
|
|
674
630
|
questionariesData.push({
|
|
675
631
|
id: addTaxResidency ? addTaxResidency.id : 0,
|
|
@@ -697,17 +653,21 @@ export const useDataStore = defineStore('data', {
|
|
|
697
653
|
if (user.phoneNumber !== '' && user.phoneNumber !== null) {
|
|
698
654
|
contactsData.push({
|
|
699
655
|
contragentId: user.id,
|
|
700
|
-
id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').id : 0,
|
|
656
|
+
id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').id : 0,
|
|
701
657
|
newValue: '',
|
|
702
658
|
note: '',
|
|
703
659
|
primaryFlag: 'Y',
|
|
704
660
|
type: 'MOBILE',
|
|
705
661
|
typeName: 'Сотовый телефон',
|
|
706
662
|
value: formatPhone(user.phoneNumber),
|
|
707
|
-
verifyType: user.otpTokenId
|
|
663
|
+
verifyType: user.otpTokenId
|
|
664
|
+
? 'BMG'
|
|
665
|
+
: 'response' in user && user.response && 'contacts' in user.response
|
|
666
|
+
? user.response.contacts.find(i => i.type === 'MOBILE').verifyType
|
|
667
|
+
: null,
|
|
708
668
|
verifyDate: user.otpTokenId
|
|
709
669
|
? this.currentDate()
|
|
710
|
-
: 'response' in user && 'contacts' in user.response
|
|
670
|
+
: 'response' in user && user.response && 'contacts' in user.response
|
|
711
671
|
? user.response.contacts.find(i => i.type === 'MOBILE').verifyDate
|
|
712
672
|
: null,
|
|
713
673
|
});
|
|
@@ -715,19 +675,19 @@ export const useDataStore = defineStore('data', {
|
|
|
715
675
|
if (user.email !== '' && user.email !== null) {
|
|
716
676
|
contactsData.push({
|
|
717
677
|
contragentId: user.id,
|
|
718
|
-
id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').id : 0,
|
|
678
|
+
id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').id : 0,
|
|
719
679
|
newValue: '',
|
|
720
680
|
note: '',
|
|
721
681
|
primaryFlag: 'N',
|
|
722
682
|
type: 'EMAIL',
|
|
723
683
|
typeName: 'E-Mail',
|
|
724
|
-
value: user.email ? user.email : 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').value : '',
|
|
684
|
+
value: user.email ? user.email : 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').value : '',
|
|
725
685
|
});
|
|
726
686
|
}
|
|
727
687
|
if (user.homePhone !== '' && user.homePhone !== null) {
|
|
728
688
|
contactsData.push({
|
|
729
689
|
contragentId: user.id,
|
|
730
|
-
id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'HOME').id : 0,
|
|
690
|
+
id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'HOME').id : 0,
|
|
731
691
|
newValue: '',
|
|
732
692
|
note: '',
|
|
733
693
|
primaryFlag: 'N',
|
|
@@ -735,17 +695,18 @@ export const useDataStore = defineStore('data', {
|
|
|
735
695
|
typeName: 'Домашний телефон',
|
|
736
696
|
value: user.homePhone
|
|
737
697
|
? formatPhone(user.homePhone)
|
|
738
|
-
: 'response' in user && 'contacts' in user.response
|
|
698
|
+
: 'response' in user && user.response && 'contacts' in user.response
|
|
739
699
|
? user.response.contacts.find(i => i.type === 'HOME').value
|
|
740
700
|
: '',
|
|
741
701
|
});
|
|
742
702
|
}
|
|
743
703
|
|
|
744
704
|
// ! SaveContragent -> Documents
|
|
745
|
-
let documentsData =
|
|
746
|
-
documentsData.
|
|
705
|
+
let documentsData = user.documentsList;
|
|
706
|
+
const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
|
|
707
|
+
const userDocument = {
|
|
747
708
|
contragentId: user.id,
|
|
748
|
-
id:
|
|
709
|
+
id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
|
|
749
710
|
description: null,
|
|
750
711
|
expireDate: user.getDateByKey('documentExpire'),
|
|
751
712
|
issueDate: user.getDateByKey('documentDate'),
|
|
@@ -759,15 +720,21 @@ export const useDataStore = defineStore('data', {
|
|
|
759
720
|
serial: null,
|
|
760
721
|
verifyType: user.verifyType,
|
|
761
722
|
verifyDate: user.verifyDate,
|
|
762
|
-
}
|
|
723
|
+
};
|
|
724
|
+
if (hasAlreadyDocument !== -1) {
|
|
725
|
+
documentsData[hasAlreadyDocument] = userDocument;
|
|
726
|
+
} else {
|
|
727
|
+
documentsData.push(userDocument);
|
|
728
|
+
}
|
|
763
729
|
|
|
764
730
|
// ! SaveContragent -> Addresses
|
|
731
|
+
const checkForNull = value => (value ? value : '');
|
|
765
732
|
let addressData = [];
|
|
766
733
|
addressData.push({
|
|
767
|
-
id: 'response' in user && 'addresses' in user.response ? user.response.addresses[0].id : 0,
|
|
734
|
+
id: 'response' in user && user.response && 'addresses' in user.response ? user.response.addresses[0].id : 0,
|
|
768
735
|
contragentId: user.id,
|
|
769
|
-
countryCode: user.
|
|
770
|
-
countryName: user.
|
|
736
|
+
countryCode: user.registrationCountry.ids,
|
|
737
|
+
countryName: user.registrationCountry.nameRu,
|
|
771
738
|
stateCode: user.registrationProvince.ids,
|
|
772
739
|
stateName: user.registrationProvince.nameRu,
|
|
773
740
|
cityCode: user.registrationCity.code,
|
|
@@ -777,11 +744,13 @@ export const useDataStore = defineStore('data', {
|
|
|
777
744
|
streetName: user.registrationStreet,
|
|
778
745
|
kvartal: user.registrationQuarter,
|
|
779
746
|
microRaion: user.registrationMicroDistrict,
|
|
780
|
-
cityTypeId: Number(user.registrationRegionType.ids),
|
|
747
|
+
cityTypeId: Number(user.registrationRegionType.ids) > 0 ? Number(user.registrationRegionType.ids) : null,
|
|
781
748
|
cityTypeName: user.registrationRegionType.nameRu,
|
|
782
749
|
blockNumber: user.registrationNumberHouse,
|
|
783
750
|
apartmentNumber: user.registrationNumberApartment,
|
|
784
|
-
address: `${user.
|
|
751
|
+
address: `${checkForNull(user.registrationCountry.nameRu)}, ${checkForNull(user.registrationRegionType.nameRu)} ${checkForNull(
|
|
752
|
+
user.registrationCity.nameRu,
|
|
753
|
+
)}, ул. ${checkForNull(user.registrationStreet)}, д. ${checkForNull(user.registrationNumberHouse)} кв. ${checkForNull(user.registrationNumberApartment)}`,
|
|
785
754
|
type: 'H',
|
|
786
755
|
});
|
|
787
756
|
|
|
@@ -794,9 +763,11 @@ export const useDataStore = defineStore('data', {
|
|
|
794
763
|
};
|
|
795
764
|
|
|
796
765
|
const personId = await this.api.saveContragent(data);
|
|
797
|
-
if (personId) {
|
|
766
|
+
if (personId > 0) {
|
|
798
767
|
await this.getContragentById(personId, whichForm, false, whichIndex);
|
|
799
768
|
user.otpTokenId = null;
|
|
769
|
+
} else {
|
|
770
|
+
return false;
|
|
800
771
|
}
|
|
801
772
|
} catch (err) {
|
|
802
773
|
this.isLoading = false;
|
|
@@ -858,15 +829,12 @@ export const useDataStore = defineStore('data', {
|
|
|
858
829
|
data.isNotary = member.isNotary;
|
|
859
830
|
}
|
|
860
831
|
if (whichMember === 'Insured') {
|
|
861
|
-
if (
|
|
862
|
-
this.
|
|
863
|
-
this.formStore.applicationData.insuredApp &&
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
) {
|
|
868
|
-
await this.api.deleteMember('Insured', data.id);
|
|
869
|
-
delete data.id;
|
|
832
|
+
if (this.formStore.applicationData && this.formStore.applicationData.insuredApp && this.formStore.applicationData.insuredApp.length) {
|
|
833
|
+
await this.deleteInsuredLogic();
|
|
834
|
+
if (this.formStore.applicationData.insuredApp.every(i => i.iin !== data.iin) && data.id !== null) {
|
|
835
|
+
await this.api.deleteMember('Insured', data.id);
|
|
836
|
+
delete data.id;
|
|
837
|
+
}
|
|
870
838
|
}
|
|
871
839
|
data.isDisability = this.formStore.isPolicyholderInsured ? false : member.isDisability.nameRu == 'Да';
|
|
872
840
|
data.disabilityGroupId = data.isDisability ? member.disabilityGroupId.id : null;
|
|
@@ -874,6 +842,8 @@ export const useDataStore = defineStore('data', {
|
|
|
874
842
|
data.position = member.jobPosition;
|
|
875
843
|
data.jobName = member.jobPlace;
|
|
876
844
|
data.familyStatusId = member.familyStatus.id;
|
|
845
|
+
data.relationId = member.relationDegree.ids;
|
|
846
|
+
data.relationName = member.relationDegree.nameRu;
|
|
877
847
|
}
|
|
878
848
|
if (whichMember === 'Beneficiary') {
|
|
879
849
|
if (
|
|
@@ -890,6 +860,9 @@ export const useDataStore = defineStore('data', {
|
|
|
890
860
|
data.percentage = Number(member.percentageOfPayoutAmount);
|
|
891
861
|
data.relationId = member.relationDegree.ids;
|
|
892
862
|
data.relationName = member.relationDegree.nameRu;
|
|
863
|
+
if (this.isLiferenta || this.isBolashak) {
|
|
864
|
+
data.beneficiaryInsurancePayId = member.insurancePay.id;
|
|
865
|
+
}
|
|
893
866
|
}
|
|
894
867
|
if (whichMember === 'BeneficialOwner') {
|
|
895
868
|
if (data.id === 0) {
|
|
@@ -913,7 +886,7 @@ export const useDataStore = defineStore('data', {
|
|
|
913
886
|
return ErrorHandler(err, err.response?.data?.errors && Object.values(err.response?.data?.errors).join(' -> '));
|
|
914
887
|
}
|
|
915
888
|
},
|
|
916
|
-
searchFromList(
|
|
889
|
+
searchFromList(member, searchIt) {
|
|
917
890
|
const getQuestionariesData = () => {
|
|
918
891
|
switch (searchIt.questId) {
|
|
919
892
|
case '500003':
|
|
@@ -936,11 +909,7 @@ export const useDataStore = defineStore('data', {
|
|
|
936
909
|
const [searchFrom, whichField] = getQuestionariesData();
|
|
937
910
|
if (searchFrom && searchFrom.length) {
|
|
938
911
|
const result = searchFrom.find(i => i.ids === searchIt.questAnswer);
|
|
939
|
-
|
|
940
|
-
this.formStore[whichForm][whichField] = result ? result : new Value();
|
|
941
|
-
} else {
|
|
942
|
-
this.formStore[whichForm][whichIndex][whichField] = result ? result : new Value();
|
|
943
|
-
}
|
|
912
|
+
member[whichField] = result ? result : new Value();
|
|
944
913
|
}
|
|
945
914
|
},
|
|
946
915
|
async setSurvey(data) {
|
|
@@ -958,14 +927,20 @@ export const useDataStore = defineStore('data', {
|
|
|
958
927
|
async getFromApi(whichField, whichRequest, parameter, reset = false) {
|
|
959
928
|
const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
|
|
960
929
|
const currentHour = new Date().getHours();
|
|
930
|
+
const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / 15);
|
|
961
931
|
|
|
962
932
|
const getDataCondition = () => {
|
|
963
933
|
if (!storageValue) return true;
|
|
964
934
|
const hasHourKey = 'hour' in storageValue;
|
|
935
|
+
const hasMiniteKey = 'minute' in storageValue;
|
|
965
936
|
const hasModeKey = 'mode' in storageValue;
|
|
966
937
|
const hasValueKey = 'value' in storageValue;
|
|
967
|
-
if (storageValue && (hasHourKey === false || hasModeKey === false || hasValueKey === false)) return true;
|
|
968
|
-
if (
|
|
938
|
+
if (storageValue && (hasHourKey === false || hasMiniteKey === false || hasModeKey === false || hasValueKey === false)) return true;
|
|
939
|
+
if (
|
|
940
|
+
storageValue &&
|
|
941
|
+
(storageValue.hour !== currentHour || storageValue.minute !== currentMinutePart || storageValue.mode !== import.meta.env.MODE || storageValue.value.length === 0)
|
|
942
|
+
)
|
|
943
|
+
return true;
|
|
969
944
|
};
|
|
970
945
|
if (!!getDataCondition() || reset === true) {
|
|
971
946
|
this[whichField] = [];
|
|
@@ -977,6 +952,7 @@ export const useDataStore = defineStore('data', {
|
|
|
977
952
|
JSON.stringify({
|
|
978
953
|
value: response,
|
|
979
954
|
hour: currentHour,
|
|
955
|
+
minute: currentMinutePart,
|
|
980
956
|
mode: import.meta.env.MODE,
|
|
981
957
|
}),
|
|
982
958
|
);
|
|
@@ -1047,16 +1023,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1047
1023
|
});
|
|
1048
1024
|
},
|
|
1049
1025
|
async getDicFileTypeList() {
|
|
1050
|
-
|
|
1051
|
-
if (this.dicFileTypeList.length) {
|
|
1052
|
-
return this.dicFileTypeList;
|
|
1053
|
-
} else {
|
|
1054
|
-
this.dicFileTypeList = await this.api.getDicFileTypeList();
|
|
1055
|
-
return this.dicFileTypeList;
|
|
1056
|
-
}
|
|
1057
|
-
} catch (err) {
|
|
1058
|
-
console.log(err.response.data);
|
|
1059
|
-
}
|
|
1026
|
+
return await this.getFromApi('dicFileTypeList', 'getDicFileTypeList');
|
|
1060
1027
|
},
|
|
1061
1028
|
async getDocumentIssuers() {
|
|
1062
1029
|
return await this.getFromApi('documentIssuers', 'getDocumentIssuers');
|
|
@@ -1094,6 +1061,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1094
1061
|
async getProcessTariff() {
|
|
1095
1062
|
return await this.getFromApi('processTariff', 'getProcessTariff');
|
|
1096
1063
|
},
|
|
1064
|
+
async getDicAnnuityTypeList() {
|
|
1065
|
+
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
1066
|
+
},
|
|
1067
|
+
async getProcessAnnuityPaymentPeriod() {
|
|
1068
|
+
return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
|
|
1069
|
+
},
|
|
1070
|
+
async getInsurancePay() {
|
|
1071
|
+
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
1072
|
+
},
|
|
1073
|
+
async getCurrencies() {
|
|
1074
|
+
try {
|
|
1075
|
+
const currencies = await this.api.getCurrencies();
|
|
1076
|
+
this.currencies = currencies;
|
|
1077
|
+
return currencies;
|
|
1078
|
+
} catch (err) {
|
|
1079
|
+
console.log(err);
|
|
1080
|
+
}
|
|
1081
|
+
},
|
|
1097
1082
|
async getAdditionalInsuranceTermsAnswers(questionId) {
|
|
1098
1083
|
try {
|
|
1099
1084
|
const answers = await this.api.getAdditionalInsuranceTermsAnswers(this.processCode, questionId);
|
|
@@ -1102,15 +1087,25 @@ export const useDataStore = defineStore('data', {
|
|
|
1102
1087
|
console.log(err);
|
|
1103
1088
|
}
|
|
1104
1089
|
},
|
|
1105
|
-
async getQuestionList(surveyType, processInstanceId, insuredId, baseField, secondaryField) {
|
|
1090
|
+
async getQuestionList(surveyType, processInstanceId, insuredId, baseField, secondaryField, whichMember = 'insured') {
|
|
1106
1091
|
if (!this.formStore[baseField] || (this.formStore[baseField] && !this.formStore[baseField].length)) {
|
|
1107
1092
|
try {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1093
|
+
if (whichMember === 'insured') {
|
|
1094
|
+
const [{ value: baseQuestions }, { value: secondaryQuestions }] = await Promise.allSettled([
|
|
1095
|
+
this.api.getQuestionList(surveyType, processInstanceId, insuredId),
|
|
1096
|
+
this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
|
|
1097
|
+
]);
|
|
1098
|
+
this.formStore[baseField] = baseQuestions;
|
|
1099
|
+
this.formStore[secondaryField] = secondaryQuestions;
|
|
1100
|
+
}
|
|
1101
|
+
if (whichMember === 'policyholder') {
|
|
1102
|
+
const [{ value: baseQuestions }, { value: secondaryQuestions }] = await Promise.allSettled([
|
|
1103
|
+
this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
|
|
1104
|
+
this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
|
|
1105
|
+
]);
|
|
1106
|
+
this.formStore[baseField] = baseQuestions;
|
|
1107
|
+
this.formStore[secondaryField] = secondaryQuestions;
|
|
1108
|
+
}
|
|
1114
1109
|
} catch (err) {
|
|
1115
1110
|
console.log(err);
|
|
1116
1111
|
}
|
|
@@ -1120,6 +1115,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1120
1115
|
getNumberWithSpaces(n) {
|
|
1121
1116
|
return n === null ? null : Number((typeof n === 'string' ? n : n.toFixed().toString()).replace(/[^0-9]+/g, '')).toLocaleString('ru');
|
|
1122
1117
|
},
|
|
1118
|
+
getNumberWithDot(n) {
|
|
1119
|
+
return n === null ? null : n.toLocaleString('ru', { maximumFractionDigits: 2, minimumFractionDigits: 2 }).replace(/,/g, '.');
|
|
1120
|
+
},
|
|
1123
1121
|
async getTaskList(search = '', groupCode = 'Work', onlyGet = false, needToReturn = false, key = 'dateCreated', processInstanceId = null, byOneProcess = null) {
|
|
1124
1122
|
if (onlyGet === false) {
|
|
1125
1123
|
this.isLoading = true;
|
|
@@ -1207,6 +1205,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1207
1205
|
this.getProcessIndexRate(),
|
|
1208
1206
|
this.getProcessTariff(),
|
|
1209
1207
|
this.getProcessPaymentPeriod(),
|
|
1208
|
+
this.getDicFileTypeList(),
|
|
1209
|
+
this.getDicAnnuityTypeList(),
|
|
1210
|
+
this.getProcessAnnuityPaymentPeriod(),
|
|
1211
|
+
this.getInsurancePay(),
|
|
1212
|
+
this.getDictionaryItems('RegionPolicy'),
|
|
1213
|
+
this.getDictionaryItems('SaleChanellPolicy'),
|
|
1210
1214
|
]);
|
|
1211
1215
|
},
|
|
1212
1216
|
async getUserGroups() {
|
|
@@ -1254,15 +1258,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1254
1258
|
},
|
|
1255
1259
|
async searchAgentByName(name) {
|
|
1256
1260
|
try {
|
|
1257
|
-
this.
|
|
1258
|
-
|
|
1259
|
-
if (!this.AgentDataList.length) {
|
|
1261
|
+
this.AgentData = await this.api.searchAgentByName(name);
|
|
1262
|
+
if (!this.AgentData.length) {
|
|
1260
1263
|
this.showToaster('error', this.t('toaster.notFound'), 1500);
|
|
1261
1264
|
}
|
|
1262
1265
|
} catch (err) {
|
|
1263
1266
|
console.log(err);
|
|
1264
|
-
} finally {
|
|
1265
|
-
this.isLoading = false;
|
|
1266
1267
|
}
|
|
1267
1268
|
},
|
|
1268
1269
|
async setINSISWorkData() {
|
|
@@ -1291,14 +1292,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1291
1292
|
this.isLoading = false;
|
|
1292
1293
|
}
|
|
1293
1294
|
},
|
|
1294
|
-
async
|
|
1295
|
+
async getDictionaryItems(dictName) {
|
|
1296
|
+
return await this.getFromApi(dictName, 'getDictionaryItems', dictName);
|
|
1297
|
+
},
|
|
1298
|
+
async filterManagerByRegion(filterName) {
|
|
1295
1299
|
try {
|
|
1296
|
-
this.
|
|
1297
|
-
this[`${dictName}List`] = await this.api.filterManagerByRegion(dictName, filterName);
|
|
1300
|
+
this.ManagerPolicy = await this.api.filterManagerByRegion('ManagerPolicy', filterName);
|
|
1298
1301
|
} catch (err) {
|
|
1299
1302
|
console.log(err);
|
|
1300
|
-
} finally {
|
|
1301
|
-
this.isLoading = false;
|
|
1302
1303
|
}
|
|
1303
1304
|
},
|
|
1304
1305
|
async getUnderwritingCouncilData(id) {
|
|
@@ -1324,24 +1325,18 @@ export const useDataStore = defineStore('data', {
|
|
|
1324
1325
|
this.showToaster('success', this.t('toaster.successSaved'));
|
|
1325
1326
|
return true;
|
|
1326
1327
|
} catch (err) {
|
|
1327
|
-
|
|
1328
|
-
return false;
|
|
1328
|
+
return ErrorHandler(err);
|
|
1329
1329
|
} finally {
|
|
1330
1330
|
this.isLoading = false;
|
|
1331
1331
|
}
|
|
1332
1332
|
},
|
|
1333
1333
|
async sendUnderwritingCouncilTask(data) {
|
|
1334
1334
|
try {
|
|
1335
|
-
this.isLoading = true;
|
|
1336
1335
|
await this.api.sendUnderwritingCouncilTask(data);
|
|
1337
1336
|
this.showToaster('success', this.t('toaster.successOperation'), 5000);
|
|
1338
1337
|
return true;
|
|
1339
1338
|
} catch (err) {
|
|
1340
|
-
|
|
1341
|
-
this.showToaster('error', this.t('toaster.error'), 5000);
|
|
1342
|
-
return false;
|
|
1343
|
-
} finally {
|
|
1344
|
-
this.isLoading = false;
|
|
1339
|
+
return ErrorHandler(err);
|
|
1345
1340
|
}
|
|
1346
1341
|
},
|
|
1347
1342
|
async definedAnswers(filter, whichSurvey, value = null, index = null) {
|
|
@@ -1349,11 +1344,89 @@ export const useDataStore = defineStore('data', {
|
|
|
1349
1344
|
this.formStore.definedAnswersId[whichSurvey][filter] = await this.api.definedAnswers(filter);
|
|
1350
1345
|
}
|
|
1351
1346
|
if (value !== null && this.formStore.definedAnswersId[whichSurvey][filter].length) {
|
|
1352
|
-
const answer = this.formStore.definedAnswersId[whichSurvey][filter].find(answer => answer.nameRu
|
|
1347
|
+
const answer = this.formStore.definedAnswersId[whichSurvey][filter].find(answer => answer.nameRu.match(new RegExp(value, 'i')));
|
|
1353
1348
|
this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
|
|
1354
1349
|
}
|
|
1355
1350
|
return this.formStore.definedAnswersId[whichSurvey];
|
|
1356
1351
|
},
|
|
1352
|
+
getConditionsData() {
|
|
1353
|
+
const conditionsData = {
|
|
1354
|
+
policyAppDto: {
|
|
1355
|
+
id: this.formStore.applicationData.policyAppDto.id,
|
|
1356
|
+
processInstanceId: this.formStore.applicationData.policyAppDto.processInstanceId,
|
|
1357
|
+
policyId: null,
|
|
1358
|
+
policyNumber: null,
|
|
1359
|
+
contractDate: this.currentDate(),
|
|
1360
|
+
amount: this.formStore.productConditionsForm.requestedSumInsured != null ? Number(this.formStore.productConditionsForm.requestedSumInsured.replace(/\s/g, '')) : null,
|
|
1361
|
+
premium:
|
|
1362
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth != null ? Number(this.formStore.productConditionsForm.insurancePremiumPerMonth.replace(/\s/g, '')) : null,
|
|
1363
|
+
isSpokesman: this.formStore.hasRepresentative,
|
|
1364
|
+
coverPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
1365
|
+
payPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
1366
|
+
annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
|
|
1367
|
+
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
1368
|
+
? this.formStore.productConditionsForm.processIndexRate.id
|
|
1369
|
+
: this.processIndexRate.find(i => i.code === '0')?.id,
|
|
1370
|
+
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
|
|
1371
|
+
lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply),
|
|
1372
|
+
lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive),
|
|
1373
|
+
adbMultiply: formatProcents(this.formStore.productConditionsForm.adbMultiply),
|
|
1374
|
+
adbAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
|
|
1375
|
+
disabilityMultiply: formatProcents(this.formStore.productConditionsForm.disabilityMultiply),
|
|
1376
|
+
disabilityAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
|
|
1377
|
+
riskGroup: this.formStore.productConditionsForm.riskGroup?.id ? this.formStore.productConditionsForm.riskGroup.id : 1,
|
|
1378
|
+
},
|
|
1379
|
+
addCoversDto: this.formStore.additionalInsuranceTerms,
|
|
1380
|
+
};
|
|
1381
|
+
if (this.isKazyna) {
|
|
1382
|
+
conditionsData.policyAppDto.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
|
|
1383
|
+
conditionsData.policyAppDto.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
|
|
1384
|
+
conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
|
|
1385
|
+
}
|
|
1386
|
+
if (this.isLiferenta) {
|
|
1387
|
+
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1388
|
+
conditionsData.policyAppDto.annuityTypeId = this.formStore.productConditionsForm.typeAnnuityInsurance.id;
|
|
1389
|
+
conditionsData.policyAppDto.paymentPeriod = this.formStore.productConditionsForm.termAnnuityPayments;
|
|
1390
|
+
conditionsData.policyAppDto.annuityPaymentPeriodId = this.formStore.productConditionsForm.periodAnnuityPayment.id;
|
|
1391
|
+
}
|
|
1392
|
+
return conditionsData;
|
|
1393
|
+
},
|
|
1394
|
+
async clearAddCovers(coverCode, coverValue) {
|
|
1395
|
+
if (!coverCode || !coverValue) return;
|
|
1396
|
+
const applicationData = this.getConditionsData();
|
|
1397
|
+
const termCoverIndex = applicationData.addCoversDto.findIndex(i => i.coverTypeCode === coverCode);
|
|
1398
|
+
if (termCoverIndex !== -1) {
|
|
1399
|
+
const answers = await this.getAdditionalInsuranceTermsAnswers(applicationData.addCoversDto[termCoverIndex].coverTypeId);
|
|
1400
|
+
if (answers.length) {
|
|
1401
|
+
const newCover = answers.find(i => i.code === coverValue);
|
|
1402
|
+
if (newCover) {
|
|
1403
|
+
applicationData.addCoversDto[termCoverIndex].coverSumId = newCover.id;
|
|
1404
|
+
applicationData.addCoversDto[termCoverIndex].coverSumName = newCover.nameRu;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
},
|
|
1409
|
+
async deleteInsuredLogic() {
|
|
1410
|
+
const applicationData = this.getConditionsData();
|
|
1411
|
+
const clearCovers = [{ code: 10, value: 'excluded' }];
|
|
1412
|
+
await Promise.allSettled(
|
|
1413
|
+
clearCovers.map(async cover => {
|
|
1414
|
+
await this.clearAddCovers(cover.code, cover.value);
|
|
1415
|
+
}),
|
|
1416
|
+
);
|
|
1417
|
+
if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth) {
|
|
1418
|
+
applicationData.policyAppDto.premium = null;
|
|
1419
|
+
}
|
|
1420
|
+
if (!!this.formStore.productConditionsForm.requestedSumInsured) {
|
|
1421
|
+
applicationData.policyAppDto.amount = null;
|
|
1422
|
+
}
|
|
1423
|
+
try {
|
|
1424
|
+
await this.api.setApplication(applicationData);
|
|
1425
|
+
this.showToaster('info', this.t('toaster.needToRecalculate'));
|
|
1426
|
+
} catch (err) {
|
|
1427
|
+
ErrorHandler(err);
|
|
1428
|
+
}
|
|
1429
|
+
},
|
|
1357
1430
|
async getPaymentTable(id) {
|
|
1358
1431
|
try {
|
|
1359
1432
|
const paymentResultTable = await this.api.calculatePremuim(id);
|
|
@@ -1366,10 +1439,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1366
1439
|
console.log(err);
|
|
1367
1440
|
}
|
|
1368
1441
|
},
|
|
1369
|
-
async getDefaultCalculationData(showLoader = false) {
|
|
1442
|
+
async getDefaultCalculationData(showLoader = false, product = null) {
|
|
1370
1443
|
this.isLoading = showLoader;
|
|
1371
1444
|
try {
|
|
1372
|
-
const calculationData = await this.api.getDefaultCalculationData();
|
|
1445
|
+
const calculationData = await this.api.getDefaultCalculationData(this.isCalculator ? product : undefined);
|
|
1373
1446
|
return calculationData;
|
|
1374
1447
|
} catch (err) {
|
|
1375
1448
|
ErrorHandler(err);
|
|
@@ -1377,7 +1450,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1377
1450
|
this.isLoading = false;
|
|
1378
1451
|
}
|
|
1379
1452
|
},
|
|
1380
|
-
async calculateWithoutApplication(showLoader = false) {
|
|
1453
|
+
async calculateWithoutApplication(showLoader = false, product = null) {
|
|
1381
1454
|
this.isLoading = showLoader;
|
|
1382
1455
|
try {
|
|
1383
1456
|
const calculationData = {
|
|
@@ -1394,10 +1467,31 @@ export const useDataStore = defineStore('data', {
|
|
|
1394
1467
|
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
|
|
1395
1468
|
addCovers: this.formStore.additionalInsuranceTermsWithout,
|
|
1396
1469
|
};
|
|
1397
|
-
|
|
1470
|
+
if (this.isKazyna || product === 'halykkazyna') {
|
|
1471
|
+
calculationData.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
|
|
1472
|
+
calculationData.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
|
|
1473
|
+
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1474
|
+
}
|
|
1475
|
+
if (this.isLiferenta) {
|
|
1476
|
+
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1477
|
+
calculationData.annuityTypeId = this.formStore.productConditionsForm.typeAnnuityInsurance.id;
|
|
1478
|
+
calculationData.paymentPeriod = this.formStore.productConditionsForm.termAnnuityPayments;
|
|
1479
|
+
calculationData.annuityPaymentPeriodId = this.formStore.productConditionsForm.periodAnnuityPayment.id;
|
|
1480
|
+
}
|
|
1481
|
+
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1398
1482
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
1399
1483
|
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
|
|
1400
1484
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1485
|
+
if (this.isKazyna || product === 'halykkazyna') {
|
|
1486
|
+
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1487
|
+
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
|
|
1488
|
+
} else {
|
|
1489
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
if (this.isLiferenta) {
|
|
1493
|
+
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(calculationResponse.annuityMonthPay);
|
|
1494
|
+
}
|
|
1401
1495
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1402
1496
|
} catch (err) {
|
|
1403
1497
|
ErrorHandler(err);
|
|
@@ -1409,61 +1503,29 @@ export const useDataStore = defineStore('data', {
|
|
|
1409
1503
|
async calculate(taskId) {
|
|
1410
1504
|
this.isLoading = true;
|
|
1411
1505
|
try {
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth != null
|
|
1423
|
-
? Number(this.formStore.productConditionsForm.insurancePremiumPerMonth.replace(/\s/g, ''))
|
|
1424
|
-
: null,
|
|
1425
|
-
isSpokesman: this.formStore.hasRepresentative,
|
|
1426
|
-
coverPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
1427
|
-
payPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
1428
|
-
annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
|
|
1429
|
-
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
1430
|
-
? this.formStore.productConditionsForm.processIndexRate.id
|
|
1431
|
-
: this.processIndexRate.find(i => i.code === '0')?.id,
|
|
1432
|
-
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
|
|
1433
|
-
lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply),
|
|
1434
|
-
lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive),
|
|
1435
|
-
adbMultiply: formatProcents(this.formStore.productConditionsForm.adbMultiply),
|
|
1436
|
-
adbAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
|
|
1437
|
-
disabilityMultiply: formatProcents(this.formStore.productConditionsForm.disabilityMultiply),
|
|
1438
|
-
disabilityAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
|
|
1439
|
-
riskGroup: this.formStore.productConditionsForm.riskGroup?.id ? this.formStore.productConditionsForm.riskGroup.id : 1,
|
|
1440
|
-
},
|
|
1441
|
-
addCoversDto: this.formStore.additionalInsuranceTerms,
|
|
1442
|
-
};
|
|
1443
|
-
|
|
1444
|
-
try {
|
|
1445
|
-
let id = this.formStore.applicationData.processInstanceId;
|
|
1446
|
-
|
|
1447
|
-
await this.api.setApplication(form1);
|
|
1448
|
-
let result;
|
|
1449
|
-
try {
|
|
1450
|
-
result = await this.api.getCalculation(id);
|
|
1451
|
-
} catch (err) {
|
|
1452
|
-
ErrorHandler(err);
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
const applicationData = await this.api.getApplicationData(taskId);
|
|
1456
|
-
this.formStore.applicationData = applicationData;
|
|
1457
|
-
this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1458
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
|
|
1459
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result);
|
|
1506
|
+
const id = this.formStore.applicationData.processInstanceId;
|
|
1507
|
+
await this.api.setApplication(this.getConditionsData());
|
|
1508
|
+
const result = ref();
|
|
1509
|
+
result.value = await this.api.getCalculation(id);
|
|
1510
|
+
const applicationData = await this.api.getApplicationData(taskId);
|
|
1511
|
+
this.formStore.applicationData = applicationData;
|
|
1512
|
+
this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1513
|
+
if (this.isKazyna) {
|
|
1514
|
+
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1515
|
+
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
|
|
1460
1516
|
} else {
|
|
1461
|
-
this.formStore.productConditionsForm.
|
|
1517
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
|
|
1462
1518
|
}
|
|
1463
|
-
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1464
|
-
} catch (err) {
|
|
1465
|
-
ErrorHandler(err);
|
|
1466
1519
|
}
|
|
1520
|
+
if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
|
|
1521
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
1522
|
+
} else {
|
|
1523
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1524
|
+
}
|
|
1525
|
+
if (this.isLiferenta) {
|
|
1526
|
+
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
1527
|
+
}
|
|
1528
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1467
1529
|
} catch (err) {
|
|
1468
1530
|
ErrorHandler(err);
|
|
1469
1531
|
}
|
|
@@ -1524,6 +1586,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1524
1586
|
const beneficiaryPolicyholderIndex = beneficiaryData.findIndex(i => i.insisId === clientData.insisId);
|
|
1525
1587
|
this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
|
|
1526
1588
|
|
|
1589
|
+
if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
|
|
1590
|
+
this.formStore.finCenterData = applicationData.finCenterData;
|
|
1591
|
+
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
1592
|
+
this.formStore.finCenterData.date = reformatDate(applicationData.finCenterData.date);
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1527
1595
|
if (fetchMembers) {
|
|
1528
1596
|
let allMembers = [
|
|
1529
1597
|
{
|
|
@@ -1593,6 +1661,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1593
1661
|
if (insuredData && insuredData.length) {
|
|
1594
1662
|
insuredData.forEach((each, index) => {
|
|
1595
1663
|
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
1664
|
+
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
1665
|
+
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1596
1666
|
});
|
|
1597
1667
|
}
|
|
1598
1668
|
|
|
@@ -1602,6 +1672,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1602
1672
|
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
1603
1673
|
this.formStore.beneficiaryForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1604
1674
|
this.formStore.beneficiaryForm[index].percentageOfPayoutAmount = each.percentage;
|
|
1675
|
+
if (this.isLiferenta || this.isBolashak) {
|
|
1676
|
+
const insurancePay = this.insurancePay.find(i => i.id == each.beneficiaryInsurancePayId);
|
|
1677
|
+
this.formStore.beneficiaryForm[index].insurancePay = insurancePay ? insurancePay : new Value();
|
|
1678
|
+
}
|
|
1605
1679
|
});
|
|
1606
1680
|
}
|
|
1607
1681
|
|
|
@@ -1637,11 +1711,30 @@ export const useDataStore = defineStore('data', {
|
|
|
1637
1711
|
// this.formStore.productConditionsForm.annualIncome = applicationData.policyAppDto.annualIncome?.toString();
|
|
1638
1712
|
this.formStore.productConditionsForm.lifeMultiply = parseProcents(applicationData.policyAppDto.lifeMultiply);
|
|
1639
1713
|
this.formStore.productConditionsForm.lifeAdditive = parseProcents(applicationData.policyAppDto.lifeAdditive);
|
|
1714
|
+
this.formStore.productConditionsForm.lifeMultiplyClient = parseProcents(applicationData.policyAppDto.lifeMultiplyClient);
|
|
1715
|
+
this.formStore.productConditionsForm.lifeAdditiveClient = parseProcents(applicationData.policyAppDto.lifeAdditiveClient);
|
|
1640
1716
|
this.formStore.productConditionsForm.adbMultiply = parseProcents(applicationData.policyAppDto.adbMultiply);
|
|
1641
1717
|
this.formStore.productConditionsForm.adbAdditive = parseProcents(applicationData.policyAppDto.adbAdditive);
|
|
1642
1718
|
this.formStore.productConditionsForm.disabilityMultiply = parseProcents(applicationData.policyAppDto.disabilityMultiply);
|
|
1643
1719
|
this.formStore.productConditionsForm.disabilityAdditive = parseProcents(applicationData.policyAppDto.disabilityAdditive);
|
|
1644
1720
|
|
|
1721
|
+
if (this.isLiferenta) {
|
|
1722
|
+
this.formStore.productConditionsForm.additionalConditionAnnuityPayments =
|
|
1723
|
+
applicationData.policyAppDto.guaranteedPaymentPeriod === null || applicationData.policyAppDto.guaranteedPaymentPeriod === 0 ? false : true;
|
|
1724
|
+
this.formStore.productConditionsForm.guaranteedPeriod =
|
|
1725
|
+
applicationData.policyAppDto.guaranteedPaymentPeriod === 0 ? null : applicationData.policyAppDto.guaranteedPaymentPeriod;
|
|
1726
|
+
this.formStore.productConditionsForm.termAnnuityPayments = applicationData.policyAppDto.paymentPeriod;
|
|
1727
|
+
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(
|
|
1728
|
+
applicationData.policyAppDto.annuityMonthPay === 0 ? null : applicationData.policyAppDto.annuityMonthPay,
|
|
1729
|
+
);
|
|
1730
|
+
|
|
1731
|
+
let annuityType = this.dicAnnuityTypeList.find(item => item.id == applicationData.policyAppDto.annuityTypeId);
|
|
1732
|
+
this.formStore.productConditionsForm.typeAnnuityInsurance = annuityType ? annuityType : new Value();
|
|
1733
|
+
|
|
1734
|
+
let annuityPaymentPeriod = this.processAnnuityPaymentPeriod.find(item => item.id == applicationData.policyAppDto.annuityPaymentPeriodId);
|
|
1735
|
+
this.formStore.productConditionsForm.periodAnnuityPayment = annuityPaymentPeriod ? annuityPaymentPeriod : new Value();
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1645
1738
|
let processIndexRate = this.processIndexRate.find(item => item.id == applicationData.policyAppDto.indexRateId);
|
|
1646
1739
|
this.formStore.productConditionsForm.processIndexRate = processIndexRate ? processIndexRate : this.processIndexRate.find(item => item.code === '0');
|
|
1647
1740
|
|
|
@@ -1654,7 +1747,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1654
1747
|
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
|
|
1655
1748
|
applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium,
|
|
1656
1749
|
);
|
|
1657
|
-
|
|
1750
|
+
if (this.isKazyna) {
|
|
1751
|
+
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
|
|
1752
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
|
|
1753
|
+
}
|
|
1658
1754
|
let riskGroup = this.riskGroup.find(item => {
|
|
1659
1755
|
if (applicationData.policyAppDto.riskGroup == 0) {
|
|
1660
1756
|
return true;
|
|
@@ -1675,11 +1771,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1675
1771
|
this.isLoading = false;
|
|
1676
1772
|
}
|
|
1677
1773
|
},
|
|
1678
|
-
async
|
|
1774
|
+
async getProcessHistoryLog(taskId) {
|
|
1679
1775
|
try {
|
|
1680
|
-
await this.api.
|
|
1776
|
+
return await this.api.getProcessHistoryLog(taskId);
|
|
1681
1777
|
} catch (err) {
|
|
1682
|
-
|
|
1778
|
+
ErrorHandler(err);
|
|
1683
1779
|
}
|
|
1684
1780
|
},
|
|
1685
1781
|
async deleteTask(taskId) {
|
|
@@ -1722,11 +1818,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1722
1818
|
try {
|
|
1723
1819
|
this.isLoading = true;
|
|
1724
1820
|
await this.api.claimTask(this.formStore.applicationTaskId);
|
|
1725
|
-
await this.getApplicationData(taskId, false, false, false);
|
|
1821
|
+
await this.getApplicationData(taskId, false, false, false, false);
|
|
1726
1822
|
this.showToaster('success', this.t('toaster.successOperation'), 3000);
|
|
1727
1823
|
} catch (err) {
|
|
1728
1824
|
ErrorHandler(err);
|
|
1729
1825
|
}
|
|
1826
|
+
break;
|
|
1730
1827
|
}
|
|
1731
1828
|
case constants.actions.reject:
|
|
1732
1829
|
case constants.actions.return:
|
|
@@ -1736,7 +1833,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1736
1833
|
const sended = await this.sendTask(taskId, action, comment);
|
|
1737
1834
|
if (!sended) return;
|
|
1738
1835
|
this.formStore.$reset();
|
|
1739
|
-
if (this.isEFO) {
|
|
1836
|
+
if (this.isEFO || this.isAML) {
|
|
1740
1837
|
await this.router.push({ name: 'Insurance-Product' });
|
|
1741
1838
|
} else {
|
|
1742
1839
|
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.successOperation') + 'SUCCESS');
|
|
@@ -1744,6 +1841,22 @@ export const useDataStore = defineStore('data', {
|
|
|
1744
1841
|
} catch (err) {
|
|
1745
1842
|
ErrorHandler(err);
|
|
1746
1843
|
}
|
|
1844
|
+
break;
|
|
1845
|
+
}
|
|
1846
|
+
case constants.actions.affiliate: {
|
|
1847
|
+
try {
|
|
1848
|
+
const sended = await this.sendUnderwritingCouncilTask({ taskId: taskId, decision: constants.actions.accept });
|
|
1849
|
+
if (!sended) return;
|
|
1850
|
+
this.formStore.$reset();
|
|
1851
|
+
if (this.isEFO || this.isAML) {
|
|
1852
|
+
await this.router.push({ name: 'Insurance-Product' });
|
|
1853
|
+
} else {
|
|
1854
|
+
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.successOperation') + 'SUCCESS');
|
|
1855
|
+
}
|
|
1856
|
+
} catch (err) {
|
|
1857
|
+
ErrorHandler(err);
|
|
1858
|
+
}
|
|
1859
|
+
break;
|
|
1747
1860
|
}
|
|
1748
1861
|
}
|
|
1749
1862
|
this.isButtonsLoading = false;
|
|
@@ -1755,6 +1868,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1755
1868
|
try {
|
|
1756
1869
|
const response = await this.api.getInvoiceData(processInstanceId);
|
|
1757
1870
|
if (response) {
|
|
1871
|
+
this.formStore.invoiceData = response;
|
|
1758
1872
|
return response;
|
|
1759
1873
|
} else {
|
|
1760
1874
|
return false;
|
|
@@ -1813,19 +1927,23 @@ export const useDataStore = defineStore('data', {
|
|
|
1813
1927
|
this.formStore[whichForm][index].jobPlace = this.formStore.applicationData[whichMember][index].jobName;
|
|
1814
1928
|
}
|
|
1815
1929
|
},
|
|
1816
|
-
findObject(from, key, searchKey) {
|
|
1817
|
-
const found = this[from].find(i => i[key] == searchKey);
|
|
1818
|
-
return found || new Value();
|
|
1819
|
-
},
|
|
1820
1930
|
async signDocument() {
|
|
1821
1931
|
try {
|
|
1822
1932
|
if (this.formStore.signUrls.length) {
|
|
1823
1933
|
return this.formStore.signUrls;
|
|
1824
1934
|
}
|
|
1825
|
-
const
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1935
|
+
const prepareSignDocuments = () => {
|
|
1936
|
+
switch (this.formStore.applicationData.statusCode) {
|
|
1937
|
+
case 'ContractSignedFrom':
|
|
1938
|
+
return [{ processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Contract', format: 'pdf' }];
|
|
1939
|
+
default:
|
|
1940
|
+
return [
|
|
1941
|
+
{ processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Agreement', format: 'pdf' },
|
|
1942
|
+
{ processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Statement', format: 'pdf' },
|
|
1943
|
+
];
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
const data = prepareSignDocuments();
|
|
1829
1947
|
const result = await this.api.signDocument(data);
|
|
1830
1948
|
this.formStore.signUrls = result;
|
|
1831
1949
|
return this.formStore.signUrls;
|
|
@@ -1833,6 +1951,22 @@ export const useDataStore = defineStore('data', {
|
|
|
1833
1951
|
ErrorHandler(err);
|
|
1834
1952
|
}
|
|
1835
1953
|
},
|
|
1954
|
+
async registerNumber() {
|
|
1955
|
+
try {
|
|
1956
|
+
this.isLoading = true;
|
|
1957
|
+
const data = {
|
|
1958
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
1959
|
+
regNumber: this.formStore.finCenterData.regNumber,
|
|
1960
|
+
date: formatDate(this.formStore.finCenterData.date),
|
|
1961
|
+
};
|
|
1962
|
+
const result = await this.api.registerNumber(data);
|
|
1963
|
+
return result;
|
|
1964
|
+
} catch (err) {
|
|
1965
|
+
return ErrorHandler(err);
|
|
1966
|
+
} finally {
|
|
1967
|
+
this.isLoading = false;
|
|
1968
|
+
}
|
|
1969
|
+
},
|
|
1836
1970
|
async sendSMS(type, phoneNumber, text) {
|
|
1837
1971
|
if (!type || !phoneNumber || !text) return;
|
|
1838
1972
|
const smsData = {
|
|
@@ -1885,7 +2019,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1885
2019
|
};
|
|
1886
2020
|
const recalculatedValue = await this.api.reCalculate(data);
|
|
1887
2021
|
if (!!recalculatedValue) {
|
|
1888
|
-
await this.getApplicationData(taskId, false, false, false);
|
|
2022
|
+
await this.getApplicationData(taskId, false, false, false, true);
|
|
1889
2023
|
this.showToaster(
|
|
1890
2024
|
'success',
|
|
1891
2025
|
`${this.t('toaster.successRecalculation')}. ${whichSum == 'insurancePremiumPerMonth' ? 'Страховая премия' : 'Страховая сумма'}: ${this.getNumberWithSpaces(
|
|
@@ -1913,7 +2047,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1913
2047
|
const localMembers = [...this.formStore[localKey]].sort((a, b) => a.id - b.id);
|
|
1914
2048
|
const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.insisId - b.insisId);
|
|
1915
2049
|
if (localMembers.every((each, index) => applicationMembers[index].insisId === each.id && applicationMembers[index].iin === each.iin.replace(/-/g, '')) === false) {
|
|
1916
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
2050
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
1917
2051
|
return false;
|
|
1918
2052
|
}
|
|
1919
2053
|
if (localKey === this.formStore.beneficiaryFormKey) {
|
|
@@ -1928,15 +2062,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1928
2062
|
}
|
|
1929
2063
|
} else {
|
|
1930
2064
|
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
1931
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
2065
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
1932
2066
|
return false;
|
|
1933
2067
|
}
|
|
1934
2068
|
if (this.formStore.applicationData[applicationKey].length !== 0) {
|
|
1935
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
2069
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
1936
2070
|
return false;
|
|
1937
2071
|
} else {
|
|
1938
2072
|
if (this.formStore[localKey][0].iin !== null) {
|
|
1939
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
2073
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
1940
2074
|
return false;
|
|
1941
2075
|
}
|
|
1942
2076
|
}
|
|
@@ -1949,25 +2083,48 @@ export const useDataStore = defineStore('data', {
|
|
|
1949
2083
|
return false;
|
|
1950
2084
|
}
|
|
1951
2085
|
if (this.formStore.policyholderForm.id !== this.formStore.applicationData.clientApp.insisId) {
|
|
1952
|
-
this.showToaster('error', this.t('toaster.notSavedMember'
|
|
2086
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
1953
2087
|
return false;
|
|
1954
2088
|
}
|
|
1955
|
-
if (
|
|
2089
|
+
if (this.members.insuredApp.has) {
|
|
1956
2090
|
if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
|
|
1957
2091
|
return false;
|
|
1958
2092
|
}
|
|
2093
|
+
if (this.members.insuredApp.required) {
|
|
2094
|
+
const inStatement = this.formStore.insuredForm.every(i => i.id > 0);
|
|
2095
|
+
if (inStatement === false) {
|
|
2096
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.insured') }));
|
|
2097
|
+
return false;
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
1959
2100
|
}
|
|
1960
|
-
if (this.
|
|
1961
|
-
|
|
2101
|
+
if (this.members.beneficiaryApp.has) {
|
|
2102
|
+
if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
|
|
2103
|
+
return false;
|
|
2104
|
+
}
|
|
2105
|
+
if (this.members.beneficiaryApp.required) {
|
|
2106
|
+
const inStatement = this.formStore.beneficiaryForm.every(i => i.id > 0);
|
|
2107
|
+
if (inStatement === false) {
|
|
2108
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficiary') }));
|
|
2109
|
+
return false;
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
1962
2112
|
}
|
|
1963
|
-
if (
|
|
2113
|
+
if (this.members.beneficialOwnerApp.has) {
|
|
1964
2114
|
if (this.formStore.isActOwnBehalf === false) {
|
|
1965
2115
|
if (this.validateMultipleMembers(this.formStore.beneficialOwnerFormKey, 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
1966
2116
|
return false;
|
|
1967
2117
|
}
|
|
1968
2118
|
}
|
|
2119
|
+
if (this.members.beneficialOwnerApp.required) {
|
|
2120
|
+
const inStatement = this.formStore.beneficialOwnerForm.every(i => i.id > 0);
|
|
2121
|
+
if (inStatement === false) {
|
|
2122
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficialOwner') }));
|
|
2123
|
+
return false;
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
1969
2126
|
}
|
|
1970
|
-
if (
|
|
2127
|
+
if (this.members.spokesmanApp.has) {
|
|
1971
2128
|
if (this.formStore.hasRepresentative) {
|
|
1972
2129
|
if (this.formStore.applicationData.spokesmanApp && this.formStore.policyholdersRepresentativeForm.id !== this.formStore.applicationData.spokesmanApp.insisId) {
|
|
1973
2130
|
this.showToaster(
|
|
@@ -1980,8 +2137,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1980
2137
|
return false;
|
|
1981
2138
|
}
|
|
1982
2139
|
}
|
|
2140
|
+
if (this.members.spokesmanApp.required) {
|
|
2141
|
+
const inStatement = this.formStore.policyholdersRepresentativeForm.id > 0;
|
|
2142
|
+
if (inStatement === false) {
|
|
2143
|
+
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.spokesman') }));
|
|
2144
|
+
return false;
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
1983
2147
|
}
|
|
1984
|
-
if (
|
|
2148
|
+
if (this.controls.hasAttachment) {
|
|
1985
2149
|
const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
|
|
1986
2150
|
if (areValid) {
|
|
1987
2151
|
await this.setINSISWorkData();
|
|
@@ -2029,7 +2193,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2029
2193
|
if (areMembersValid) {
|
|
2030
2194
|
if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) {
|
|
2031
2195
|
const hasCritical = this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName === 'Критическое заболевание Застрахованного');
|
|
2032
|
-
if (hasCritical && hasCritical.coverSumName
|
|
2196
|
+
if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i'))) {
|
|
2033
2197
|
await Promise.allSettled([
|
|
2034
2198
|
this.getQuestionList(
|
|
2035
2199
|
'health',
|
|
@@ -2045,15 +2209,36 @@ export const useDataStore = defineStore('data', {
|
|
|
2045
2209
|
'surveyByCriticalBase',
|
|
2046
2210
|
'surveyByCriticalSecond',
|
|
2047
2211
|
),
|
|
2212
|
+
this.isClientAnketaCondition &&
|
|
2213
|
+
this.getQuestionList(
|
|
2214
|
+
'health',
|
|
2215
|
+
this.formStore.applicationData.processInstanceId,
|
|
2216
|
+
this.formStore.applicationData.clientApp.id,
|
|
2217
|
+
'surveyByHealthBasePolicyholder',
|
|
2218
|
+
'surveyByHealthSecond',
|
|
2219
|
+
'policyholder',
|
|
2220
|
+
),
|
|
2048
2221
|
]);
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2222
|
+
this.isClientAnketaCondition
|
|
2223
|
+
? await Promise.allSettled([
|
|
2224
|
+
...this.formStore.surveyByHealthBase.body.map(async question => {
|
|
2225
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2226
|
+
}),
|
|
2227
|
+
...this.formStore.surveyByCriticalBase.body.map(async question => {
|
|
2228
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2229
|
+
}),
|
|
2230
|
+
...this.formStore.surveyByHealthBasePolicyholder.body.map(async question => {
|
|
2231
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2232
|
+
}),
|
|
2233
|
+
])
|
|
2234
|
+
: await Promise.allSettled([
|
|
2235
|
+
...this.formStore.surveyByHealthBase.body.map(async question => {
|
|
2236
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2237
|
+
}),
|
|
2238
|
+
...this.formStore.surveyByCriticalBase.body.map(async question => {
|
|
2239
|
+
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2240
|
+
}),
|
|
2241
|
+
]);
|
|
2057
2242
|
} else {
|
|
2058
2243
|
await Promise.allSettled([
|
|
2059
2244
|
this.getQuestionList(
|
|
@@ -2063,14 +2248,32 @@ export const useDataStore = defineStore('data', {
|
|
|
2063
2248
|
'surveyByHealthBase',
|
|
2064
2249
|
'surveyByHealthSecond',
|
|
2065
2250
|
),
|
|
2251
|
+
this.isClientAnketaCondition &&
|
|
2252
|
+
this.getQuestionList(
|
|
2253
|
+
'health',
|
|
2254
|
+
this.formStore.applicationData.processInstanceId,
|
|
2255
|
+
this.formStore.applicationData.clientApp.id,
|
|
2256
|
+
'surveyByHealthBasePolicyholder',
|
|
2257
|
+
'surveyByHealthSecond',
|
|
2258
|
+
'policyholder',
|
|
2259
|
+
),
|
|
2260
|
+
,
|
|
2066
2261
|
]);
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2262
|
+
this.isClientAnketaCondition
|
|
2263
|
+
? await Promise.allSettled([
|
|
2264
|
+
...this.formStore.surveyByHealthBase.body.map(async question => {
|
|
2265
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2266
|
+
}),
|
|
2267
|
+
...this.formStore.surveyByHealthBasePolicyholder.body.map(async question => {
|
|
2268
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2269
|
+
}),
|
|
2270
|
+
])
|
|
2271
|
+
: await Promise.allSettled(
|
|
2272
|
+
this.formStore.surveyByHealthBase.body.map(async question => {
|
|
2273
|
+
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2274
|
+
}),
|
|
2275
|
+
);
|
|
2072
2276
|
}
|
|
2073
|
-
|
|
2074
2277
|
if (this.validateAnketa('surveyByHealthBase')) {
|
|
2075
2278
|
let hasCriticalAndItsValid = null;
|
|
2076
2279
|
if (hasCritical && hasCritical.coverSumName !== 'не включено') {
|
|
@@ -2084,6 +2287,11 @@ export const useDataStore = defineStore('data', {
|
|
|
2084
2287
|
hasCriticalAndItsValid = null;
|
|
2085
2288
|
}
|
|
2086
2289
|
if (hasCriticalAndItsValid === true || hasCriticalAndItsValid === null) {
|
|
2290
|
+
if (this.isClientAnketaCondition && this.validateAnketa('surveyByHealthBasePolicyholder') === false) {
|
|
2291
|
+
this.showToaster('error', this.t('toaster.emptyHealthAnketaPolicyholder'), 3000);
|
|
2292
|
+
this.isLoading = false;
|
|
2293
|
+
return false;
|
|
2294
|
+
}
|
|
2087
2295
|
this.isLoading = false;
|
|
2088
2296
|
return true;
|
|
2089
2297
|
}
|
|
@@ -2146,313 +2354,180 @@ export const useDataStore = defineStore('data', {
|
|
|
2146
2354
|
this.isLoading = false;
|
|
2147
2355
|
}
|
|
2148
2356
|
},
|
|
2149
|
-
async getContragentFromGBDFL(
|
|
2357
|
+
async getContragentFromGBDFL(member) {
|
|
2358
|
+
// null - ожидание
|
|
2359
|
+
// false - ошибка или неправильно
|
|
2360
|
+
// true - успешно и данные получены
|
|
2150
2361
|
this.isLoading = true;
|
|
2151
2362
|
try {
|
|
2152
2363
|
const data = {
|
|
2153
|
-
iin: iin.replace(/-/g, ''),
|
|
2154
|
-
phoneNumber: formatPhone(phoneNumber),
|
|
2364
|
+
iin: member.iin.replace(/-/g, ''),
|
|
2365
|
+
phoneNumber: formatPhone(member.phoneNumber),
|
|
2155
2366
|
};
|
|
2156
2367
|
const gbdResponse = await this.api.getContragentFromGBDFL(data);
|
|
2157
2368
|
if (gbdResponse.status === 'soap:Server') {
|
|
2158
2369
|
this.showToaster('error', `${gbdResponse.statusName}. Отправьте запрос через некоторое время`, 5000);
|
|
2159
2370
|
this.isLoading = false;
|
|
2160
|
-
return;
|
|
2371
|
+
return false;
|
|
2161
2372
|
}
|
|
2162
2373
|
if (gbdResponse.status === 'PENDING') {
|
|
2163
|
-
this.showToaster('
|
|
2374
|
+
this.showToaster('info', this.t('toaster.waitForClient'), 5000);
|
|
2164
2375
|
this.isLoading = false;
|
|
2165
|
-
return;
|
|
2376
|
+
return null;
|
|
2166
2377
|
}
|
|
2167
2378
|
if (constants.gbdErrors.find(i => i === gbdResponse.status)) {
|
|
2168
2379
|
if (gbdResponse.status === 'TIMEOUT') {
|
|
2169
|
-
this.showToaster('
|
|
2380
|
+
this.showToaster('error', `${gbdResponse.statusName}. Отправьте запрос еще раз`, 5000);
|
|
2381
|
+
return null;
|
|
2170
2382
|
} else {
|
|
2171
|
-
this.showToaster('
|
|
2383
|
+
this.showToaster('error', gbdResponse.statusName, 5000);
|
|
2172
2384
|
}
|
|
2173
2385
|
this.isLoading = false;
|
|
2174
|
-
return;
|
|
2386
|
+
return false;
|
|
2175
2387
|
}
|
|
2176
2388
|
const { person } = parseXML(gbdResponse.content, true, 'person');
|
|
2177
2389
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
2178
|
-
if (
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
this.formStore[whichForm][whichIndex].gosPersonData = person;
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
|
-
await this.getContragent(typeof whichIndex === 'number' ? this.formStore[whichForm][whichIndex] : this.formStore[whichForm], whichForm, whichIndex, false);
|
|
2191
|
-
if (typeof whichIndex !== 'number') {
|
|
2192
|
-
this.formStore[whichForm].verifyDate = responseInfo.responseDate;
|
|
2193
|
-
this.formStore[whichForm].verifyType = 'GBDFL';
|
|
2194
|
-
} else {
|
|
2195
|
-
this.formStore[whichForm][whichIndex].verifyDate = responseInfo.responseDate;
|
|
2196
|
-
this.formStore[whichForm][whichIndex].verifyType = 'GBDFL';
|
|
2197
|
-
}
|
|
2198
|
-
await this.saveInStoreUserGBDFL(person, whichForm, whichIndex);
|
|
2390
|
+
if (member.gosPersonData !== null && member.gosPersonData.iin !== iin.replace(/-/g, '')) {
|
|
2391
|
+
member.resetMember(false);
|
|
2392
|
+
}
|
|
2393
|
+
member.gosPersonData = person;
|
|
2394
|
+
await this.getContragent(member, false);
|
|
2395
|
+
member.verifyDate = responseInfo.responseDate;
|
|
2396
|
+
member.verifyType = 'GBDFL';
|
|
2397
|
+
await this.saveInStoreUserGBDFL(person, member);
|
|
2398
|
+
return true;
|
|
2199
2399
|
} catch (err) {
|
|
2200
|
-
ErrorHandler(err);
|
|
2400
|
+
return ErrorHandler(err);
|
|
2401
|
+
} finally {
|
|
2402
|
+
this.isLoading = false;
|
|
2201
2403
|
}
|
|
2202
|
-
this.isLoading = false;
|
|
2203
2404
|
},
|
|
2204
|
-
async saveInStoreUserGBDFL(person,
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
this.formStore[whichForm].genderName = person.gender.nameRu;
|
|
2405
|
+
async saveInStoreUserGBDFL(person, member) {
|
|
2406
|
+
member.firstName = person.name;
|
|
2407
|
+
member.lastName = person.surname;
|
|
2408
|
+
member.middleName = person.patronymic ? person.patronymic : '';
|
|
2409
|
+
member.longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
|
|
2410
|
+
member.birthDate = reformatDate(person.birthDate);
|
|
2411
|
+
member.genderName = person.gender.nameRu;
|
|
2212
2412
|
|
|
2213
|
-
|
|
2214
|
-
|
|
2413
|
+
const gender = this.gender.find(i => i.id == person.gender.code);
|
|
2414
|
+
if (gender) member.gender = gender;
|
|
2215
2415
|
|
|
2216
|
-
|
|
2217
|
-
|
|
2416
|
+
const birthPlace = this.countries.find(i => i.nameRu.match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
2417
|
+
if (birthPlace) member.birthPlace = birthPlace;
|
|
2218
2418
|
|
|
2219
|
-
|
|
2220
|
-
|
|
2419
|
+
const countryOfCitizenship = this.citizenshipCountries.find(i => i.nameRu.match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
2420
|
+
if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
|
|
2221
2421
|
|
|
2222
|
-
|
|
2223
|
-
|
|
2422
|
+
const regCountry = this.countries.find(i => i.nameRu.match(new RegExp(person.regAddress.country.nameRu, 'i')));
|
|
2423
|
+
if (regCountry) member.registrationCountry = regCountry;
|
|
2224
2424
|
|
|
2225
|
-
|
|
2226
|
-
|
|
2425
|
+
const regProvince = this.states.find(i => i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
2426
|
+
if (regProvince) member.registrationProvince = regProvince;
|
|
2227
2427
|
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2428
|
+
if ('city' in person.regAddress && !!person.regAddress.city) {
|
|
2429
|
+
if (person.regAddress.city.includes(', ')) {
|
|
2430
|
+
const personCities = person.regAddress.city.split(', ');
|
|
2431
|
+
for (let i = 0; i < personCities.length; ++i) {
|
|
2432
|
+
const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[i]));
|
|
2433
|
+
if (possibleCity) {
|
|
2434
|
+
member.registrationCity = possibleCity;
|
|
2435
|
+
break;
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
if (member.registrationCity.nameRu === null) {
|
|
2231
2439
|
for (let i = 0; i < personCities.length; ++i) {
|
|
2232
|
-
const
|
|
2233
|
-
if (
|
|
2234
|
-
|
|
2440
|
+
const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
|
|
2441
|
+
if (possibleRegion) {
|
|
2442
|
+
member.registrationRegion = possibleRegion;
|
|
2235
2443
|
break;
|
|
2236
2444
|
}
|
|
2237
2445
|
}
|
|
2238
|
-
if (this.formStore[whichForm].registrationCity.nameRu === null) {
|
|
2239
|
-
for (let i = 0; i < personCities.length; ++i) {
|
|
2240
|
-
const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
|
|
2241
|
-
if (possibleRegion) {
|
|
2242
|
-
this.formStore[whichForm].registrationRegion = possibleRegion;
|
|
2243
|
-
break;
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
} else {
|
|
2248
|
-
const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
|
|
2249
|
-
if (regCity) this.formStore[whichForm].registrationCity = regCity;
|
|
2250
|
-
|
|
2251
|
-
if (this.formStore[whichForm].registrationCity.nameRu === null) {
|
|
2252
|
-
const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
|
|
2253
|
-
if (regRegion) this.formStore[whichForm].registrationRegion = regRegion;
|
|
2254
|
-
}
|
|
2255
2446
|
}
|
|
2256
|
-
}
|
|
2447
|
+
} else {
|
|
2448
|
+
const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
|
|
2449
|
+
if (regCity) member.registrationCity = regCity;
|
|
2257
2450
|
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
);
|
|
2262
|
-
if (regCity) {
|
|
2263
|
-
this.formStore[whichForm].registrationCity = regCity;
|
|
2264
|
-
const regType = this.localityTypes.find(i => i.nameRu === 'город');
|
|
2265
|
-
if (regType) this.formStore[whichForm].registrationRegionType = regType;
|
|
2266
|
-
} else {
|
|
2267
|
-
const regRegion = this.regions.find(
|
|
2268
|
-
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2269
|
-
);
|
|
2270
|
-
if (regRegion) {
|
|
2271
|
-
this.formStore[whichForm].registrationRegion = regRegion;
|
|
2272
|
-
const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
|
|
2273
|
-
if (regType) this.formStore[whichForm].registrationRegionType = regType;
|
|
2274
|
-
}
|
|
2451
|
+
if (member.registrationCity.nameRu === null) {
|
|
2452
|
+
const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
|
|
2453
|
+
if (regRegion) member.registrationRegion = regRegion;
|
|
2275
2454
|
}
|
|
2276
2455
|
}
|
|
2456
|
+
}
|
|
2277
2457
|
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
if (
|
|
2458
|
+
if (member.registrationCity.nameRu === null && member.registrationRegion.nameRu === null) {
|
|
2459
|
+
const regCity = this.cities.find(
|
|
2460
|
+
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2461
|
+
);
|
|
2462
|
+
if (regCity) {
|
|
2463
|
+
member.registrationCity = regCity;
|
|
2464
|
+
const regType = this.localityTypes.find(i => i.nameRu === 'город');
|
|
2465
|
+
if (regType) member.registrationRegionType = regType;
|
|
2286
2466
|
} else {
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2295
|
-
if (validDocument) {
|
|
2296
|
-
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2297
|
-
if (documentType) this.formStore[whichForm].documentType = documentType;
|
|
2298
|
-
|
|
2299
|
-
this.formStore[whichForm].documentNumber = validDocument.number;
|
|
2300
|
-
this.formStore[whichForm].documentExpire = reformatDate(validDocument.endDate);
|
|
2301
|
-
this.formStore[whichForm].documentDate = reformatDate(validDocument.beginDate);
|
|
2302
|
-
this.formStore[whichForm].documentNumber = validDocument.number;
|
|
2303
|
-
|
|
2304
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2305
|
-
if (documentIssuer) this.formStore[whichForm].documentIssuers = documentIssuer;
|
|
2467
|
+
const regRegion = this.regions.find(
|
|
2468
|
+
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2469
|
+
);
|
|
2470
|
+
if (regRegion) {
|
|
2471
|
+
member.registrationRegion = regRegion;
|
|
2472
|
+
const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
|
|
2473
|
+
if (regType) member.registrationRegionType = regType;
|
|
2306
2474
|
}
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2310
|
-
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2311
|
-
: this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2312
|
-
? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2313
|
-
: new Value();
|
|
2314
|
-
if (documentType) this.formStore[whichForm].documentType = documentType;
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2315
2477
|
|
|
2316
|
-
|
|
2317
|
-
|
|
2478
|
+
if (person.regAddress.street.includes(', ')) {
|
|
2479
|
+
const personAddress = person.regAddress.street.split(', ');
|
|
2480
|
+
const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
|
|
2481
|
+
const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
|
|
2482
|
+
const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
|
|
2483
|
+
if (microDistrict) member.registrationMicroDistrict = microDistrict;
|
|
2484
|
+
if (quarter) member.registrationQuarter = quarter;
|
|
2485
|
+
if (street) member.registrationStreet = street;
|
|
2486
|
+
} else {
|
|
2487
|
+
if (person.regAddress.street) member.registrationStreet = person.regAddress.street;
|
|
2488
|
+
}
|
|
2489
|
+
if (person.regAddress.building) member.registrationNumberHouse = person.regAddress.building;
|
|
2490
|
+
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
2318
2491
|
|
|
2319
|
-
|
|
2320
|
-
|
|
2492
|
+
// TODO Доработать логику и для остальных
|
|
2493
|
+
if ('length' in person.documents.document) {
|
|
2494
|
+
const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2495
|
+
if (validDocument) {
|
|
2496
|
+
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2497
|
+
if (documentType) member.documentType = documentType;
|
|
2321
2498
|
|
|
2322
|
-
|
|
2323
|
-
|
|
2499
|
+
member.documentNumber = validDocument.number;
|
|
2500
|
+
member.documentExpire = reformatDate(validDocument.endDate);
|
|
2501
|
+
member.documentDate = reformatDate(validDocument.beginDate);
|
|
2502
|
+
member.documentNumber = validDocument.number;
|
|
2324
2503
|
|
|
2325
|
-
// TODO уточнить
|
|
2326
2504
|
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2327
|
-
if (documentIssuer)
|
|
2505
|
+
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2328
2506
|
}
|
|
2329
|
-
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2330
|
-
if (economySectorCode) this.formStore[whichForm].economySectorCode = economySectorCode;
|
|
2331
2507
|
} else {
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2508
|
+
const documentType =
|
|
2509
|
+
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2510
|
+
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2511
|
+
: this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2512
|
+
? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2513
|
+
: new Value();
|
|
2514
|
+
if (documentType) member.documentType = documentType;
|
|
2338
2515
|
|
|
2339
|
-
const
|
|
2340
|
-
if (
|
|
2516
|
+
const documentNumber = person.documents.document.number;
|
|
2517
|
+
if (documentNumber) member.documentNumber = documentNumber;
|
|
2341
2518
|
|
|
2342
|
-
const
|
|
2343
|
-
if (
|
|
2519
|
+
const documentDate = person.documents.document.beginDate;
|
|
2520
|
+
if (documentDate) member.documentDate = reformatDate(documentDate);
|
|
2344
2521
|
|
|
2345
|
-
const
|
|
2346
|
-
if (
|
|
2522
|
+
const documentExpire = person.documents.document.endDate;
|
|
2523
|
+
if (documentExpire) member.documentExpire = reformatDate(documentExpire);
|
|
2347
2524
|
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
const regProvince = this.states.find(i => i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
2352
|
-
if (regProvince) this.formStore[whichForm][whichIndex].registrationProvince = regProvince;
|
|
2353
|
-
|
|
2354
|
-
if ('city' in person.regAddress && !!person.regAddress.city) {
|
|
2355
|
-
if (person.regAddress.city.includes(', ')) {
|
|
2356
|
-
const personCities = person.regAddress.city.split(', ');
|
|
2357
|
-
for (let i = 0; i < personCities.length; ++i) {
|
|
2358
|
-
const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[i]));
|
|
2359
|
-
if (possibleCity) {
|
|
2360
|
-
this.formStore[whichForm][whichIndex].registrationCity = possibleCity;
|
|
2361
|
-
break;
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
2364
|
-
if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null) {
|
|
2365
|
-
for (let i = 0; i < personCities.length; ++i) {
|
|
2366
|
-
const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
|
|
2367
|
-
if (possibleRegion) {
|
|
2368
|
-
this.formStore[whichForm][whichIndex].registrationRegion = possibleRegion;
|
|
2369
|
-
break;
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
}
|
|
2373
|
-
} else {
|
|
2374
|
-
const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
|
|
2375
|
-
if (regCity) this.formStore[whichForm][whichIndex].registrationCity = regCity;
|
|
2376
|
-
if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null) {
|
|
2377
|
-
const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
|
|
2378
|
-
if (regRegion) this.formStore[whichForm][whichIndex].registrationRegion = regRegion;
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null && this.formStore[whichForm][whichIndex].registrationRegion.nameRu === null) {
|
|
2384
|
-
const regCity = this.cities.find(
|
|
2385
|
-
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2386
|
-
);
|
|
2387
|
-
if (regCity) {
|
|
2388
|
-
this.formStore[whichForm][whichIndex].registrationCity = regCity;
|
|
2389
|
-
const regType = this.localityTypes.find(i => i.nameRu === 'город');
|
|
2390
|
-
if (regType) this.formStore[whichForm][whichIndex].registrationRegionType = regType;
|
|
2391
|
-
} else {
|
|
2392
|
-
const regRegion = this.regions.find(
|
|
2393
|
-
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2394
|
-
);
|
|
2395
|
-
if (regRegion) {
|
|
2396
|
-
this.formStore[whichForm][whichIndex].registrationRegion = regRegion;
|
|
2397
|
-
const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
|
|
2398
|
-
if (regType) this.formStore[whichForm][whichIndex].registrationRegionType = regType;
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
if (person.regAddress.street.includes(', ')) {
|
|
2404
|
-
const personAddress = person.regAddress.street.split(', ');
|
|
2405
|
-
const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
|
|
2406
|
-
const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
|
|
2407
|
-
const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
|
|
2408
|
-
if (microDistrict) this.formStore[whichForm][whichIndex].registrationMicroDistrict = microDistrict;
|
|
2409
|
-
if (quarter) this.formStore[whichForm][whichIndex].registrationQuarter = quarter;
|
|
2410
|
-
if (street) this.formStore[whichForm][whichIndex].registrationStreet = street;
|
|
2411
|
-
} else {
|
|
2412
|
-
if (person.regAddress.street) this.formStore[whichForm][whichIndex].registrationStreet = person.regAddress.street;
|
|
2413
|
-
}
|
|
2414
|
-
if (person.regAddress.building) this.formStore[whichForm][whichIndex].registrationNumberHouse = person.regAddress.building;
|
|
2415
|
-
if (person.regAddress.flat) this.formStore[whichForm][whichIndex].registrationNumberApartment = person.regAddress.flat;
|
|
2416
|
-
|
|
2417
|
-
// TODO Доработать логику и для остальных
|
|
2418
|
-
if ('length' in person.documents.document) {
|
|
2419
|
-
const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2420
|
-
if (validDocument) {
|
|
2421
|
-
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2422
|
-
if (documentType) this.formStore[whichForm][whichIndex].documentType = documentType;
|
|
2423
|
-
this.formStore[whichForm][whichIndex].documentNumber = validDocument.number;
|
|
2424
|
-
this.formStore[whichForm][whichIndex].documentExpire = reformatDate(validDocument.endDate);
|
|
2425
|
-
this.formStore[whichForm][whichIndex].documentDate = reformatDate(validDocument.beginDate);
|
|
2426
|
-
this.formStore[whichForm][whichIndex].documentNumber = validDocument.number;
|
|
2427
|
-
|
|
2428
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2429
|
-
if (documentIssuer) this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer;
|
|
2430
|
-
}
|
|
2431
|
-
} else {
|
|
2432
|
-
const documentType =
|
|
2433
|
-
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2434
|
-
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2435
|
-
: this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2436
|
-
? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2437
|
-
: new Value();
|
|
2438
|
-
if (documentType) this.formStore[whichForm][whichIndex].documentType = documentType;
|
|
2439
|
-
|
|
2440
|
-
const documentNumber = person.documents.document.number;
|
|
2441
|
-
if (documentNumber) this.formStore[whichForm][whichIndex].documentNumber = documentNumber;
|
|
2442
|
-
|
|
2443
|
-
const documentDate = person.documents.document.beginDate;
|
|
2444
|
-
if (documentDate) this.formStore[whichForm][whichIndex].documentDate = reformatDate(documentDate);
|
|
2445
|
-
|
|
2446
|
-
const documentExpire = person.documents.document.endDate;
|
|
2447
|
-
if (documentExpire) this.formStore[whichForm][whichIndex].documentExpire = reformatDate(documentExpire);
|
|
2448
|
-
|
|
2449
|
-
// TODO уточнить
|
|
2450
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2451
|
-
if (documentIssuer) this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer;
|
|
2452
|
-
}
|
|
2453
|
-
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2454
|
-
if (economySectorCode) this.formStore[whichForm][whichIndex].economySectorCode = economySectorCode;
|
|
2525
|
+
// TODO уточнить
|
|
2526
|
+
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2527
|
+
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2455
2528
|
}
|
|
2529
|
+
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2530
|
+
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
2456
2531
|
},
|
|
2457
2532
|
hasJobSection(whichForm) {
|
|
2458
2533
|
switch (whichForm) {
|
|
@@ -2492,6 +2567,12 @@ export const useDataStore = defineStore('data', {
|
|
|
2492
2567
|
return true;
|
|
2493
2568
|
}
|
|
2494
2569
|
},
|
|
2570
|
+
hasPercentageOfPayoutAmount() {
|
|
2571
|
+
return true;
|
|
2572
|
+
},
|
|
2573
|
+
canViewInvoiceInfo() {
|
|
2574
|
+
return this.isAdmin();
|
|
2575
|
+
},
|
|
2495
2576
|
},
|
|
2496
2577
|
});
|
|
2497
2578
|
|