hl-core 0.0.10-beta.3 → 0.0.10-beta.30
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/base.api.ts +259 -190
- package/api/interceptors.ts +3 -5
- package/components/Complex/TextBlock.vue +2 -0
- package/components/Dialog/Dialog.vue +7 -1
- package/components/Dialog/FamilyDialog.vue +2 -0
- package/components/Form/DigitalDocument.vue +52 -0
- package/components/Form/DynamicForm.vue +1 -0
- package/components/Form/FormData.vue +1 -0
- package/components/Form/ManagerAttachment.vue +18 -8
- package/components/Form/ProductConditionsBlock.vue +12 -6
- package/components/Input/DynamicInput.vue +2 -0
- package/components/Input/FormInput.vue +2 -0
- package/components/Input/OtpInput.vue +25 -0
- package/components/Input/PanelInput.vue +1 -0
- package/components/Input/RoundedInput.vue +2 -0
- package/components/Input/RoundedSelect.vue +4 -0
- package/components/Input/SwitchInput.vue +2 -0
- package/components/Input/TextInput.vue +2 -0
- package/components/Layout/Drawer.vue +2 -0
- package/components/Pages/Anketa.vue +166 -167
- package/components/Pages/Auth.vue +2 -0
- package/components/Pages/ContragentForm.vue +2 -1
- package/components/Pages/Documents.vue +244 -6
- package/components/Pages/MemberForm.vue +276 -96
- package/components/Pages/ProductConditions.vue +275 -96
- package/components/Panel/PanelHandler.vue +236 -108
- package/components/Transitions/Animation.vue +2 -0
- package/components/Utilities/Chip.vue +3 -1
- package/components/Utilities/JsonViewer.vue +1 -2
- package/composables/classes.ts +117 -42
- package/composables/constants.ts +33 -0
- package/composables/fields.ts +6 -4
- package/composables/index.ts +243 -7
- package/composables/styles.ts +8 -24
- package/configs/pwa.ts +1 -7
- package/layouts/clear.vue +1 -1
- package/layouts/default.vue +1 -1
- package/layouts/full.vue +1 -1
- package/locales/ru.json +34 -10
- package/nuxt.config.ts +10 -13
- package/package.json +13 -12
- package/plugins/head.ts +2 -1
- package/store/data.store.ts +380 -389
- package/store/member.store.ts +3 -2
- package/store/rules.ts +19 -0
- package/tsconfig.json +3 -0
- package/types/enum.ts +19 -2
- package/types/env.d.ts +2 -2
- package/types/form.ts +71 -74
- package/types/index.ts +916 -873
package/store/data.store.ts
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
2
|
import { rules } from './rules';
|
|
3
3
|
import { i18n } from '../configs/i18n';
|
|
4
|
-
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
5
|
-
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
|
|
4
|
+
import { Toast, Types as ToastTypes, Positions, ToastOptions } from './toast';
|
|
5
|
+
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate, RoleController, ProcessController, sanitize } from '../composables';
|
|
6
6
|
import { DataStoreClass, DocumentItem, Member, Value, CountryValue, PolicyholderActivity, BeneficialOwner, PolicyholderClass } from '../composables/classes';
|
|
7
7
|
import { ApiClass } from '../api';
|
|
8
8
|
import { useFormStore } from './form.store';
|
|
9
9
|
import { AxiosError } from 'axios';
|
|
10
|
-
import { PostActions, StoreMembers,
|
|
10
|
+
import { PostActions, StoreMembers, MemberCodes, MemberAppCodes, CoreEnums } from '../types/enum';
|
|
11
|
+
import type * as Types from '../types';
|
|
11
12
|
//@ts-ignore
|
|
12
13
|
import { NCALayerClient } from 'ncalayer-js-client';
|
|
13
14
|
|
|
14
15
|
export const useDataStore = defineStore('data', {
|
|
15
16
|
state: () => ({
|
|
16
17
|
...new DataStoreClass(),
|
|
18
|
+
...new RoleController(),
|
|
19
|
+
...new ProcessController(),
|
|
17
20
|
t: i18n.t,
|
|
18
21
|
rules: rules,
|
|
19
22
|
toast: Toast,
|
|
20
|
-
toastTypes:
|
|
23
|
+
toastTypes: ToastTypes,
|
|
21
24
|
toastPositions: Positions,
|
|
25
|
+
sanitize: sanitize,
|
|
22
26
|
isValidGUID: isValidGUID,
|
|
23
27
|
router: useRouter(),
|
|
24
28
|
formStore: useFormStore(),
|
|
@@ -30,7 +34,7 @@ export const useDataStore = defineStore('data', {
|
|
|
30
34
|
showToaster: (type: 'success' | 'error' | 'warning' | 'info', msg: string, timeout?: number) =>
|
|
31
35
|
Toast.useToast()(msg, {
|
|
32
36
|
...ToastOptions,
|
|
33
|
-
type:
|
|
37
|
+
type: ToastTypes[type.toUpperCase() as keyof typeof ToastTypes],
|
|
34
38
|
timeout: type === 'error' ? 6000 : typeof timeout === 'number' ? timeout : ToastOptions.timeout,
|
|
35
39
|
}),
|
|
36
40
|
}),
|
|
@@ -59,6 +63,7 @@ export const useDataStore = defineStore('data', {
|
|
|
59
63
|
isCheckContract: state => state.product === 'checkcontract',
|
|
60
64
|
isCheckContragent: state => state.product === 'checkcontragent',
|
|
61
65
|
isPrePension: state => state.product === 'prepensionannuity',
|
|
66
|
+
isBalam: state => state.product === 'balam',
|
|
62
67
|
isDSO: state => state.product === 'dso',
|
|
63
68
|
isUU: state => state.product === 'uu',
|
|
64
69
|
hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
@@ -159,22 +164,23 @@ export const useDataStore = defineStore('data', {
|
|
|
159
164
|
getUserRoles() {
|
|
160
165
|
if (this.accessToken && this.user.roles.length === 0) {
|
|
161
166
|
const decoded = jwtDecode(this.accessToken);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
if (decoded) {
|
|
168
|
+
this.user.id = String(decoded.sub);
|
|
169
|
+
this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
|
|
170
|
+
this.user.code = decoded.code;
|
|
171
|
+
this.user.branchCode = decoded.branchCode;
|
|
172
|
+
const key = getKeyWithPattern(decoded, 'role');
|
|
173
|
+
if (key) {
|
|
174
|
+
const roles = decoded[key as keyof Types.Utils.JwtToken];
|
|
175
|
+
if (typeof roles === 'string') {
|
|
176
|
+
this.user.roles.push(roles);
|
|
177
|
+
} else if (typeof roles === 'object') {
|
|
178
|
+
this.user.roles = roles;
|
|
179
|
+
}
|
|
171
180
|
}
|
|
172
181
|
}
|
|
173
182
|
}
|
|
174
183
|
},
|
|
175
|
-
getUserData() {
|
|
176
|
-
return this.accessToken ? jwtDecode(this.accessToken) : null;
|
|
177
|
-
},
|
|
178
184
|
async getUserGroups() {
|
|
179
185
|
try {
|
|
180
186
|
this.isLoading = true;
|
|
@@ -185,140 +191,17 @@ export const useDataStore = defineStore('data', {
|
|
|
185
191
|
this.isLoading = false;
|
|
186
192
|
}
|
|
187
193
|
},
|
|
188
|
-
isRole(whichRole: keyof typeof Roles) {
|
|
189
|
-
if (this.user.roles.length === 0) {
|
|
190
|
-
this.getUserRoles();
|
|
191
|
-
}
|
|
192
|
-
const isRole = this.user.roles.find(i => i === whichRole);
|
|
193
|
-
return !!isRole;
|
|
194
|
-
},
|
|
195
|
-
isInitiator() {
|
|
196
|
-
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager() || this.isAgentAuletti();
|
|
197
|
-
},
|
|
198
|
-
isManager() {
|
|
199
|
-
return this.isRole(constants.roles.Manager);
|
|
200
|
-
},
|
|
201
|
-
isCompliance() {
|
|
202
|
-
return this.isRole(constants.roles.Compliance);
|
|
203
|
-
},
|
|
204
|
-
isAdmin() {
|
|
205
|
-
return this.isRole(constants.roles.Admin);
|
|
206
|
-
},
|
|
207
|
-
isJurist() {
|
|
208
|
-
return this.isRole(constants.roles.Jurist);
|
|
209
|
-
},
|
|
210
|
-
isAgent() {
|
|
211
|
-
return this.isRole(constants.roles.Agent);
|
|
212
|
-
},
|
|
213
|
-
isManagerHalykBank() {
|
|
214
|
-
return this.isRole(constants.roles.ManagerHalykBank);
|
|
215
|
-
},
|
|
216
|
-
isServiceManager() {
|
|
217
|
-
return this.isRole(constants.roles.ServiceManager);
|
|
218
|
-
},
|
|
219
|
-
isUnderwriter() {
|
|
220
|
-
return this.isRole(constants.roles.Underwriter);
|
|
221
|
-
},
|
|
222
|
-
isActuary() {
|
|
223
|
-
return this.isRole(constants.roles.Actuary);
|
|
224
|
-
},
|
|
225
|
-
isAgentMycar() {
|
|
226
|
-
return this.isRole(constants.roles.AgentMycar);
|
|
227
|
-
},
|
|
228
|
-
isAgentAuletti() {
|
|
229
|
-
return this.isRole(constants.roles.AgentAuletti);
|
|
230
|
-
},
|
|
231
|
-
isAnalyst() {
|
|
232
|
-
return this.isRole(constants.roles.Analyst);
|
|
233
|
-
},
|
|
234
|
-
isUpk() {
|
|
235
|
-
return this.isRole(constants.roles.UPK);
|
|
236
|
-
},
|
|
237
|
-
isUrp() {
|
|
238
|
-
return this.isRole(constants.roles.URP);
|
|
239
|
-
},
|
|
240
|
-
isUsns() {
|
|
241
|
-
return this.isRole(constants.roles.USNS);
|
|
242
|
-
},
|
|
243
|
-
isAccountant() {
|
|
244
|
-
return this.isRole(constants.roles.Accountant);
|
|
245
|
-
},
|
|
246
|
-
isDrn() {
|
|
247
|
-
return this.isRole(constants.roles.DRNSJ);
|
|
248
|
-
},
|
|
249
|
-
isSupport() {
|
|
250
|
-
return this.isRole(constants.roles.Support);
|
|
251
|
-
},
|
|
252
|
-
isFinCenter() {
|
|
253
|
-
return this.isRole(constants.roles.FinCenter);
|
|
254
|
-
},
|
|
255
|
-
isSupervisor() {
|
|
256
|
-
return this.isRole(constants.roles.Supervisor);
|
|
257
|
-
},
|
|
258
|
-
isHeadManager() {
|
|
259
|
-
return this.isRole(constants.roles.HeadManager);
|
|
260
|
-
},
|
|
261
|
-
isBranchDirector() {
|
|
262
|
-
return this.isRole(constants.roles.BranchDirector);
|
|
263
|
-
},
|
|
264
|
-
isUSNSACCINS() {
|
|
265
|
-
return this.isRole(constants.roles.USNSACCINS);
|
|
266
|
-
},
|
|
267
|
-
isDsuio() {
|
|
268
|
-
return this.isRole(constants.roles.Dsuio);
|
|
269
|
-
},
|
|
270
|
-
isAdjuster() {
|
|
271
|
-
return this.isRole(constants.roles.Adjuster);
|
|
272
|
-
},
|
|
273
|
-
isDsoDirector() {
|
|
274
|
-
return this.isRole(constants.roles.DsoDirector);
|
|
275
|
-
},
|
|
276
|
-
isAccountantDirector() {
|
|
277
|
-
return this.isRole(constants.roles.AccountantDirector);
|
|
278
|
-
},
|
|
279
|
-
isProcessEditable(statusCode?: keyof typeof Statuses) {
|
|
280
|
-
const getEditibleStatuses = () => {
|
|
281
|
-
const defaultStatuses = constants.editableStatuses;
|
|
282
|
-
return defaultStatuses;
|
|
283
|
-
};
|
|
284
|
-
return !!getEditibleStatuses().find(status => status === statusCode);
|
|
285
|
-
},
|
|
286
|
-
isProcessReturnable(statusCode?: keyof typeof Statuses) {
|
|
287
|
-
const getReturnableStatuses = () => {
|
|
288
|
-
const defaultStatuses = constants.returnStatementStatuses;
|
|
289
|
-
return defaultStatuses;
|
|
290
|
-
};
|
|
291
|
-
return !!getReturnableStatuses().find(status => status === statusCode);
|
|
292
|
-
},
|
|
293
|
-
isProcessCancel(statusCode?: keyof typeof Statuses) {
|
|
294
|
-
const getCanceleStatuses = () => {
|
|
295
|
-
const defaultStatuses = constants.cancelApplicationStatuses;
|
|
296
|
-
return defaultStatuses;
|
|
297
|
-
};
|
|
298
|
-
return !!getCanceleStatuses().find(status => status === statusCode);
|
|
299
|
-
},
|
|
300
|
-
isProcessReject(statusCode?: keyof typeof Statuses) {
|
|
301
|
-
const getRejectStatuses = () => {
|
|
302
|
-
const defaultStatuses = constants.rejectApplicationStatuses;
|
|
303
|
-
return defaultStatuses;
|
|
304
|
-
};
|
|
305
|
-
return !!getRejectStatuses().find(status => status === statusCode);
|
|
306
|
-
},
|
|
307
194
|
isTask() {
|
|
308
195
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
309
196
|
},
|
|
310
197
|
validateAccess() {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return false;
|
|
319
|
-
} catch (err) {
|
|
320
|
-
return ErrorHandler(err);
|
|
321
|
-
}
|
|
198
|
+
const hasAccess = this.hasAccess();
|
|
199
|
+
if (this.isAML) return hasAccess.toAML;
|
|
200
|
+
if (this.isLKA) return hasAccess.toLKA;
|
|
201
|
+
if (this.isEFO) return hasAccess.toEFO;
|
|
202
|
+
if (this.isAULETTI) return hasAccess.toAULETTI;
|
|
203
|
+
if (this.isLKA_A) return hasAccess.toLKA_A;
|
|
204
|
+
return false;
|
|
322
205
|
},
|
|
323
206
|
async loginUser(login: string, password: string, numAttempt: number) {
|
|
324
207
|
try {
|
|
@@ -383,7 +266,7 @@ export const useDataStore = defineStore('data', {
|
|
|
383
266
|
return false;
|
|
384
267
|
}
|
|
385
268
|
},
|
|
386
|
-
async resetSelected(route: RouteType) {
|
|
269
|
+
async resetSelected(route: Types.RouteType) {
|
|
387
270
|
this.settings.open = false;
|
|
388
271
|
this.rightPanel.open = false;
|
|
389
272
|
this.panel.open = false;
|
|
@@ -397,7 +280,7 @@ export const useDataStore = defineStore('data', {
|
|
|
397
280
|
if (!file.id) return;
|
|
398
281
|
try {
|
|
399
282
|
this.isLoading = true;
|
|
400
|
-
await this.api.getFile(file.id).then((response: any) => {
|
|
283
|
+
await this.api.file.getFile(file.id).then((response: any) => {
|
|
401
284
|
if (!['pdf', 'docx'].includes(fileType)) {
|
|
402
285
|
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
403
286
|
const url = window.URL.createObjectURL(blob);
|
|
@@ -438,7 +321,7 @@ export const useDataStore = defineStore('data', {
|
|
|
438
321
|
},
|
|
439
322
|
async deleteFile(data: DocumentItem) {
|
|
440
323
|
try {
|
|
441
|
-
await this.api.deleteFile(data);
|
|
324
|
+
await this.api.file.deleteFile(data);
|
|
442
325
|
this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
|
|
443
326
|
} catch (err) {
|
|
444
327
|
ErrorHandler(err);
|
|
@@ -447,7 +330,7 @@ export const useDataStore = defineStore('data', {
|
|
|
447
330
|
async uploadFiles(data: FormData, load: boolean = false) {
|
|
448
331
|
this.isLoading = load;
|
|
449
332
|
try {
|
|
450
|
-
await this.api.uploadFiles(data);
|
|
333
|
+
await this.api.file.uploadFiles(data);
|
|
451
334
|
return true;
|
|
452
335
|
} catch (err) {
|
|
453
336
|
return ErrorHandler(err);
|
|
@@ -457,14 +340,27 @@ export const useDataStore = defineStore('data', {
|
|
|
457
340
|
},
|
|
458
341
|
async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
|
|
459
342
|
this.isLoading = load;
|
|
460
|
-
|
|
343
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
344
|
+
if (isNonResident) {
|
|
345
|
+
if (!member.firstName || !member.lastName) return;
|
|
346
|
+
} else {
|
|
347
|
+
if (!member.iin) return;
|
|
348
|
+
}
|
|
461
349
|
try {
|
|
462
|
-
const queryData =
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
350
|
+
const queryData = isNonResident
|
|
351
|
+
? {
|
|
352
|
+
firstName: member.firstName ?? '',
|
|
353
|
+
lastName: member.lastName ?? '',
|
|
354
|
+
middleName: member.middleName ?? '',
|
|
355
|
+
iin: '',
|
|
356
|
+
birthDate: member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
357
|
+
}
|
|
358
|
+
: {
|
|
359
|
+
firstName: '',
|
|
360
|
+
lastName: '',
|
|
361
|
+
middleName: '',
|
|
362
|
+
iin: member.iin ? member.iin.replace(/-/g, '') : '',
|
|
363
|
+
};
|
|
468
364
|
const contragentResponse = await this.api.getContragent(queryData);
|
|
469
365
|
if (contragentResponse.totalItems > 0) {
|
|
470
366
|
if (contragentResponse.items.length === 1) {
|
|
@@ -473,12 +369,13 @@ export const useDataStore = defineStore('data', {
|
|
|
473
369
|
const sortedByRegistrationDate = contragentResponse.items.sort(
|
|
474
370
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
475
371
|
);
|
|
476
|
-
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
372
|
+
if (!isNonResident) await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
477
373
|
}
|
|
478
374
|
member.gotFromInsis = true;
|
|
479
375
|
} else {
|
|
480
376
|
if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
481
377
|
}
|
|
378
|
+
if (isNonResident) return contragentResponse;
|
|
482
379
|
} catch (err) {
|
|
483
380
|
ErrorHandler(err);
|
|
484
381
|
}
|
|
@@ -488,7 +385,7 @@ export const useDataStore = defineStore('data', {
|
|
|
488
385
|
if (Number(id) === 0) return;
|
|
489
386
|
this.isLoading = load;
|
|
490
387
|
try {
|
|
491
|
-
const member = whichIndex === null ? this.formStore[whichForm as SingleMember] : this.formStore[whichForm as MultipleMember][whichIndex];
|
|
388
|
+
const member = whichIndex === null ? this.formStore[whichForm as Types.SingleMember] : this.formStore[whichForm as Types.MultipleMember][whichIndex];
|
|
492
389
|
const contragentResponse = await this.api.getContragentById(id);
|
|
493
390
|
if (contragentResponse.totalItems > 0) {
|
|
494
391
|
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
@@ -501,7 +398,7 @@ export const useDataStore = defineStore('data', {
|
|
|
501
398
|
this.isLoading = false;
|
|
502
399
|
}
|
|
503
400
|
},
|
|
504
|
-
async serializeContragentData(member: Member, contragent: ContragentType) {
|
|
401
|
+
async serializeContragentData(member: Member, contragent: Types.ContragentType) {
|
|
505
402
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
506
403
|
this.api.getContrAgentData(contragent.id),
|
|
507
404
|
this.api.getContrAgentContacts(contragent.id),
|
|
@@ -533,7 +430,13 @@ export const useDataStore = defineStore('data', {
|
|
|
533
430
|
},
|
|
534
431
|
parseContragent(
|
|
535
432
|
member: Member,
|
|
536
|
-
user: {
|
|
433
|
+
user: {
|
|
434
|
+
personalData: Types.ContragentType;
|
|
435
|
+
data?: Types.ContragentQuestionaries[];
|
|
436
|
+
contacts?: Types.ContragentContacts[];
|
|
437
|
+
documents?: Types.ContragentDocuments[];
|
|
438
|
+
address?: Types.ContragentAddress[];
|
|
439
|
+
},
|
|
537
440
|
) {
|
|
538
441
|
member.verifyType = user.personalData.verifyType;
|
|
539
442
|
member.verifyDate = user.personalData.verifyDate;
|
|
@@ -556,13 +459,18 @@ export const useDataStore = defineStore('data', {
|
|
|
556
459
|
|
|
557
460
|
if ('documents' in user && user.documents && user.documents.length) {
|
|
558
461
|
member.documentsList = user.documents;
|
|
559
|
-
const documentByPriority = user.documents.find(i => i.type ===
|
|
462
|
+
const documentByPriority = user.documents.find(i => i.type === CoreEnums.Insis.DocTypes['1UDL']);
|
|
560
463
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
561
464
|
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
562
465
|
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
563
466
|
member.documentType = documentType ? documentType : new Value();
|
|
564
467
|
member.documentNumber = userDocument.number;
|
|
565
468
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
469
|
+
if (userDocument.issuerNameRu === 'Другое') {
|
|
470
|
+
member.documentIssuers.issuerOtherNameRu = userDocument.issuerOtherNameRu;
|
|
471
|
+
member.documentIssuers.issuerOtherNameOrig = userDocument.issuerOtherNameOrig;
|
|
472
|
+
member.documentIssuers.issuerOtherName = userDocument.issuerOtherName;
|
|
473
|
+
}
|
|
566
474
|
member.documentDate = reformatDate(userDocument.issueDate);
|
|
567
475
|
member.documentExpire = reformatDate(userDocument.expireDate);
|
|
568
476
|
}
|
|
@@ -615,7 +523,7 @@ export const useDataStore = defineStore('data', {
|
|
|
615
523
|
});
|
|
616
524
|
}
|
|
617
525
|
},
|
|
618
|
-
searchFromList(member: Member, searchIt: ContragentQuestionaries) {
|
|
526
|
+
searchFromList(member: Member, searchIt: Types.ContragentQuestionaries) {
|
|
619
527
|
const getQuestionariesData = () => {
|
|
620
528
|
switch (searchIt.questId) {
|
|
621
529
|
case '500003':
|
|
@@ -638,23 +546,30 @@ export const useDataStore = defineStore('data', {
|
|
|
638
546
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
639
547
|
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
640
548
|
//@ts-ignore
|
|
641
|
-
member[qData.field] = qResult
|
|
549
|
+
member[qData.field] = qResult ?? new Value();
|
|
642
550
|
}
|
|
643
551
|
},
|
|
644
552
|
async alreadyInInsis(member: Member) {
|
|
645
|
-
|
|
553
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
554
|
+
if (isNonResident) {
|
|
555
|
+
if (!member.firstName || !member.lastName) return;
|
|
556
|
+
} else {
|
|
557
|
+
if (!member.iin) return;
|
|
558
|
+
}
|
|
646
559
|
try {
|
|
647
560
|
const queryData = {
|
|
648
|
-
iin: member.iin.replaceAll('-', ''),
|
|
561
|
+
iin: !!member.iin && !isNonResident ? member.iin.replaceAll('-', '') : '',
|
|
649
562
|
firstName: !!member.firstName ? member.firstName : '',
|
|
650
563
|
lastName: !!member.lastName ? member.lastName : '',
|
|
651
564
|
middleName: !!member.middleName ? member.middleName : '',
|
|
565
|
+
birthDate: !!member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
652
566
|
};
|
|
653
567
|
const contragent = await this.api.getContragent(queryData);
|
|
654
568
|
if (contragent.totalItems > 0) {
|
|
655
569
|
if (contragent.items.length === 1) {
|
|
656
570
|
return contragent.items[0];
|
|
657
571
|
} else {
|
|
572
|
+
if (this.isPension && queryData.iin === '') return contragent.items.find(i => i.id === member.id);
|
|
658
573
|
const sortedByRegistrationDate = contragent.items.sort(
|
|
659
574
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
660
575
|
);
|
|
@@ -688,8 +603,8 @@ export const useDataStore = defineStore('data', {
|
|
|
688
603
|
}
|
|
689
604
|
},
|
|
690
605
|
async saveContragent(user: Member, whichForm: keyof typeof StoreMembers | 'contragent', whichIndex: number | null, onlySaveAction: boolean = true) {
|
|
691
|
-
if (this.isGons && user.iin && whichForm === 'beneficiaryForm'
|
|
692
|
-
const doesHaveActiveContract = await this.api.
|
|
606
|
+
if (this.isGons && user.iin && whichForm === 'beneficiaryForm') {
|
|
607
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesActualPolicy(String(this.formStore.applicationData.processInstanceId));
|
|
693
608
|
if (doesHaveActiveContract) {
|
|
694
609
|
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
695
610
|
return false;
|
|
@@ -723,10 +638,10 @@ export const useDataStore = defineStore('data', {
|
|
|
723
638
|
}
|
|
724
639
|
}
|
|
725
640
|
try {
|
|
726
|
-
const contragentData: ContragentType = {
|
|
641
|
+
const contragentData: Types.ContragentType = {
|
|
727
642
|
id: Number(user.id),
|
|
728
643
|
type: Number(user.type),
|
|
729
|
-
iin: user.iin
|
|
644
|
+
iin: user.iin ? user.iin.replace(/-/g, '') : '',
|
|
730
645
|
longName: user.longName !== null ? user.longName : (user.lastName ?? '') + (user.firstName ?? '') + (user.middleName ?? ''),
|
|
731
646
|
lastName: user.lastName ?? '',
|
|
732
647
|
firstName: user.firstName ?? '',
|
|
@@ -753,7 +668,7 @@ export const useDataStore = defineStore('data', {
|
|
|
753
668
|
countryOfTaxResidency,
|
|
754
669
|
signOfResidency,
|
|
755
670
|
}))(user);
|
|
756
|
-
const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
671
|
+
const questionariesData: Types.ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
757
672
|
let questName = '';
|
|
758
673
|
let questionId = parseInt(question.ids as string).toString();
|
|
759
674
|
if (questionId === '500003') {
|
|
@@ -821,7 +736,7 @@ export const useDataStore = defineStore('data', {
|
|
|
821
736
|
}
|
|
822
737
|
|
|
823
738
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
824
|
-
const contactsData: ContragentContacts[] = [];
|
|
739
|
+
const contactsData: Types.ContragentContacts[] = [];
|
|
825
740
|
if (!!user.phoneNumber) {
|
|
826
741
|
contactsData.push({
|
|
827
742
|
contragentId: Number(user.id),
|
|
@@ -863,7 +778,7 @@ export const useDataStore = defineStore('data', {
|
|
|
863
778
|
|
|
864
779
|
const documentsData = user.documentsList;
|
|
865
780
|
const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
|
|
866
|
-
const userDocument: ContragentDocuments = {
|
|
781
|
+
const userDocument: Types.ContragentDocuments = {
|
|
867
782
|
contragentId: Number(user.id),
|
|
868
783
|
id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
|
|
869
784
|
description: null,
|
|
@@ -880,6 +795,11 @@ export const useDataStore = defineStore('data', {
|
|
|
880
795
|
verifyType: user.verifyType,
|
|
881
796
|
verifyDate: user.verifyDate,
|
|
882
797
|
};
|
|
798
|
+
if (user.documentIssuers.ids === '1') {
|
|
799
|
+
userDocument.issuerOtherName = user.documentIssuers.issuerOtherName;
|
|
800
|
+
userDocument.issuerOtherNameOrig = user.documentIssuers.issuerOtherNameOrig;
|
|
801
|
+
userDocument.issuerOtherNameRu = user.documentIssuers.issuerOtherNameRu;
|
|
802
|
+
}
|
|
883
803
|
if (hasAlreadyDocument !== -1) {
|
|
884
804
|
documentsData[hasAlreadyDocument] = userDocument;
|
|
885
805
|
} else {
|
|
@@ -888,7 +808,7 @@ export const useDataStore = defineStore('data', {
|
|
|
888
808
|
|
|
889
809
|
const checkForNull = (value: any) => (value ? value : '');
|
|
890
810
|
const userResponseAddress = 'response' in user && user.response && 'addresses' in user.response && user.response.addresses ? user.response.addresses : null;
|
|
891
|
-
const addressData: ContragentAddress[] = [];
|
|
811
|
+
const addressData: Types.ContragentAddress[] = [];
|
|
892
812
|
addressData.push({
|
|
893
813
|
id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
|
|
894
814
|
contragentId: Number(user.id),
|
|
@@ -1085,8 +1005,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1085
1005
|
},
|
|
1086
1006
|
getConditionsData() {
|
|
1087
1007
|
const conditionsData: {
|
|
1088
|
-
policyAppDto: PolicyAppDto;
|
|
1089
|
-
addCoversDto: AddCover[];
|
|
1008
|
+
policyAppDto: Types.PolicyAppDto;
|
|
1009
|
+
addCoversDto: Types.AddCover[];
|
|
1090
1010
|
} = {
|
|
1091
1011
|
policyAppDto: {
|
|
1092
1012
|
id: this.formStore.applicationData?.policyAppDto?.id,
|
|
@@ -1123,6 +1043,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1123
1043
|
conditionsData.policyAppDto.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1124
1044
|
conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
|
|
1125
1045
|
}
|
|
1046
|
+
if (this.isGons && !useEnv().isProduction) {
|
|
1047
|
+
conditionsData.policyAppDto.premiumInCurrency =
|
|
1048
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1049
|
+
conditionsData.policyAppDto.amountInCurrency =
|
|
1050
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1051
|
+
conditionsData.policyAppDto.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1052
|
+
conditionsData.policyAppDto.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1053
|
+
}
|
|
1126
1054
|
if (this.isLiferenta) {
|
|
1127
1055
|
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1128
1056
|
conditionsData.policyAppDto.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1214,7 +1142,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1214
1142
|
}
|
|
1215
1143
|
return this.formStore.definedAnswersId[whichSurvey];
|
|
1216
1144
|
},
|
|
1217
|
-
async setSurvey(data: AnketaFirst) {
|
|
1145
|
+
async setSurvey(data: Types.AnketaFirst) {
|
|
1218
1146
|
try {
|
|
1219
1147
|
this.isLoading = true;
|
|
1220
1148
|
const anketaToken = await this.api.setSurvey(data);
|
|
@@ -1228,7 +1156,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1228
1156
|
},
|
|
1229
1157
|
async setINSISWorkData(loading: boolean = true) {
|
|
1230
1158
|
if (!this.formStore.applicationData.insisWorkDataApp) return;
|
|
1231
|
-
const data: InsisWorkDataApp = {
|
|
1159
|
+
const data: Types.InsisWorkDataApp = {
|
|
1232
1160
|
id: this.formStore.applicationData.insisWorkDataApp.id,
|
|
1233
1161
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
1234
1162
|
agentId: Number(this.formStore.AgentData.agentId),
|
|
@@ -1658,7 +1586,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1658
1586
|
column: column,
|
|
1659
1587
|
direction: direction,
|
|
1660
1588
|
groupCode: groupCode,
|
|
1661
|
-
processCodes: Object.values(constants.products),
|
|
1589
|
+
processCodes: this.isEFO ? Object.values(constants.products) : [constants.products.baiterek],
|
|
1662
1590
|
};
|
|
1663
1591
|
if (byOneProcess !== null) {
|
|
1664
1592
|
delete query.processCodes;
|
|
@@ -1872,7 +1800,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1872
1800
|
return;
|
|
1873
1801
|
}
|
|
1874
1802
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1875
|
-
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1803
|
+
const calculationData: Types.RecalculationDataType & Types.PolicyAppDto = {
|
|
1876
1804
|
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1877
1805
|
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1878
1806
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
@@ -1891,6 +1819,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1891
1819
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1892
1820
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1893
1821
|
}
|
|
1822
|
+
if (!useEnv().isProduction && (this.isGons || product === 'gons')) {
|
|
1823
|
+
calculationData.premiumInCurrency =
|
|
1824
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1825
|
+
calculationData.amountInCurrency =
|
|
1826
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1827
|
+
calculationData.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1828
|
+
|
|
1829
|
+
calculationData.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1830
|
+
}
|
|
1894
1831
|
if (this.isLiferenta || product === 'liferenta') {
|
|
1895
1832
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1896
1833
|
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1909,10 +1846,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1909
1846
|
calculationData.calcDate = formatDate(this.formStore.productConditionsForm.calcDate as string)!.toISOString();
|
|
1910
1847
|
}
|
|
1911
1848
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1912
|
-
if (calculationResponse.amount)
|
|
1913
|
-
|
|
1849
|
+
if (calculationResponse.amount)
|
|
1850
|
+
this.formStore.productConditionsForm.requestedSumInsured =
|
|
1851
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.amount) : this.getNumberWithSpaces(calculationResponse.amount);
|
|
1852
|
+
if (calculationResponse.premium)
|
|
1853
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
1854
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.premium) : this.getNumberWithSpaces(calculationResponse.premium);
|
|
1855
|
+
|
|
1914
1856
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1915
|
-
if (this.isKazyna || product === 'halykkazyna') {
|
|
1857
|
+
if (this.isKazyna || product === 'halykkazyna' || ((this.isGons || product === 'gons') && !useEnv().isProduction)) {
|
|
1916
1858
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1917
1859
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
|
|
1918
1860
|
} else {
|
|
@@ -1953,13 +1895,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1953
1895
|
this.isLoading = true;
|
|
1954
1896
|
try {
|
|
1955
1897
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1956
|
-
if (!this.isPension) await this.api.setApplication(this.getConditionsData());
|
|
1898
|
+
if (!this.isPension && !(this.formStore.lfb.add && (this.isLifeBusiness || this.isGns))) await this.api.setApplication(this.getConditionsData());
|
|
1957
1899
|
const result = ref();
|
|
1958
1900
|
result.value = await this.api.getCalculation(String(id));
|
|
1959
1901
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
1960
1902
|
this.formStore.applicationData = applicationData;
|
|
1961
1903
|
if (this.formStore.applicationData.addCoverDto) this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1962
|
-
if (this.isKazyna && this.currencies.usd) {
|
|
1904
|
+
if ((this.isKazyna || this.isGons) && this.currencies.usd) {
|
|
1963
1905
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1964
1906
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
|
|
1965
1907
|
} else {
|
|
@@ -1967,11 +1909,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1967
1909
|
}
|
|
1968
1910
|
}
|
|
1969
1911
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
|
|
1970
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
1971
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
1912
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
1913
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
1914
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium)
|
|
1915
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium);
|
|
1972
1916
|
} else {
|
|
1973
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1974
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.
|
|
1917
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
1918
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
1919
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount)
|
|
1920
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount);
|
|
1975
1921
|
}
|
|
1976
1922
|
if (this.isLiferenta) {
|
|
1977
1923
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
@@ -1989,6 +1935,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1989
1935
|
const res = await this.newInsuredList(applicationData.insuredApp);
|
|
1990
1936
|
this.formStore.lfb.clients = res;
|
|
1991
1937
|
}
|
|
1938
|
+
if (this.formStore.lfb.add) {
|
|
1939
|
+
if (result.value > 0) {
|
|
1940
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1941
|
+
this.formStore.productConditionsForm.requestedSumInsured = null;
|
|
1942
|
+
} else {
|
|
1943
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
1944
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = null;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1992
1947
|
}
|
|
1993
1948
|
|
|
1994
1949
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
@@ -2018,7 +1973,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2018
1973
|
async calculatePrice(taskId?: string) {
|
|
2019
1974
|
this.isLoading = true;
|
|
2020
1975
|
try {
|
|
2021
|
-
const priceForm: SetApplicationRequest = {};
|
|
1976
|
+
const priceForm: Types.SetApplicationRequest = {};
|
|
2022
1977
|
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
2023
1978
|
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
2024
1979
|
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
@@ -2065,7 +2020,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2065
2020
|
async startApplication(member: Member, processCode?: number) {
|
|
2066
2021
|
if (!member.iin) return false;
|
|
2067
2022
|
try {
|
|
2068
|
-
const data: StartApplicationType = {
|
|
2023
|
+
const data: Types.StartApplicationType = {
|
|
2069
2024
|
clientId: member.id,
|
|
2070
2025
|
iin: member.iin.replace(/-/g, ''),
|
|
2071
2026
|
longName: member.longName ?? '',
|
|
@@ -2083,11 +2038,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2083
2038
|
this.isLoading = onlyGet;
|
|
2084
2039
|
try {
|
|
2085
2040
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
2086
|
-
if (this.processCode !== applicationData.processCode && !this.isPension) {
|
|
2087
|
-
this.isLoading = false;
|
|
2088
|
-
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
|
|
2089
|
-
return;
|
|
2090
|
-
}
|
|
2091
2041
|
this.formStore.regNumber = applicationData.regNumber;
|
|
2092
2042
|
this.formStore.applicationData = applicationData;
|
|
2093
2043
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
@@ -2182,11 +2132,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2182
2132
|
index: null,
|
|
2183
2133
|
});
|
|
2184
2134
|
}
|
|
2185
|
-
|
|
2186
|
-
if (applicationData.slave) {
|
|
2187
|
-
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
2135
|
if (insuredData && insuredData.length) {
|
|
2191
2136
|
insuredData.forEach((member, index) => {
|
|
2192
2137
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -2320,16 +2265,29 @@ export const useDataStore = defineStore('data', {
|
|
|
2320
2265
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
2321
2266
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
2322
2267
|
|
|
2323
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.
|
|
2324
|
-
applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount
|
|
2325
|
-
|
|
2326
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2327
|
-
applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium
|
|
2328
|
-
|
|
2329
|
-
|
|
2268
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2269
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount)
|
|
2270
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount);
|
|
2271
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
2272
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium)
|
|
2273
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium);
|
|
2274
|
+
|
|
2275
|
+
if (this.isGons) {
|
|
2276
|
+
const govPremiums = await this.api.getGovernmentPremiums(String(this.formStore.applicationData.processInstanceId));
|
|
2277
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
|
|
2278
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
|
|
2279
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
|
|
2280
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
if (this.isKazyna || this.isGons) {
|
|
2330
2284
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
|
|
2331
2285
|
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
|
|
2332
2286
|
}
|
|
2287
|
+
if (this.isGons && !useEnv().isProduction) {
|
|
2288
|
+
const currency = constants.currencyList.find(item => item.code === applicationData.policyAppDto.currency);
|
|
2289
|
+
this.formStore.productConditionsForm.currency = currency ? currency : new Value();
|
|
2290
|
+
}
|
|
2333
2291
|
const riskGroup = this.riskGroup.find(item => {
|
|
2334
2292
|
if (applicationData.policyAppDto.riskGroup == 0) {
|
|
2335
2293
|
return true;
|
|
@@ -2356,7 +2314,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2356
2314
|
async deleteTask(taskId: string) {
|
|
2357
2315
|
this.isLoading = true;
|
|
2358
2316
|
try {
|
|
2359
|
-
const data: SendTask = {
|
|
2317
|
+
const data: Types.SendTask = {
|
|
2360
2318
|
taskId: taskId,
|
|
2361
2319
|
decision: 'rejectclient',
|
|
2362
2320
|
comment: 'Клиент отказался',
|
|
@@ -2462,9 +2420,11 @@ export const useDataStore = defineStore('data', {
|
|
|
2462
2420
|
}
|
|
2463
2421
|
},
|
|
2464
2422
|
async createInvoice() {
|
|
2465
|
-
|
|
2423
|
+
const premium =
|
|
2424
|
+
this.isLifeBusiness || this.isGns ? this.formStore.applicationData.policyAppDto?.mainPremiumWithCommission : this.formStore.applicationData.policyAppDto?.premium;
|
|
2425
|
+
if (!premium) return;
|
|
2466
2426
|
try {
|
|
2467
|
-
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId,
|
|
2427
|
+
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId, premium);
|
|
2468
2428
|
return !!created;
|
|
2469
2429
|
} catch (err) {
|
|
2470
2430
|
this.isLoading = false;
|
|
@@ -2480,7 +2440,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2480
2440
|
console.log(err);
|
|
2481
2441
|
}
|
|
2482
2442
|
},
|
|
2483
|
-
setMembersField(whichForm: SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2443
|
+
setMembersField(whichForm: Types.SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2484
2444
|
this.formStore[whichForm].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember].familyStatusId);
|
|
2485
2445
|
this.formStore[whichForm].signOfIPDL = this.findObject(
|
|
2486
2446
|
'ipdl',
|
|
@@ -2507,7 +2467,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2507
2467
|
this.formStore.applicationData.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2508
2468
|
}
|
|
2509
2469
|
},
|
|
2510
|
-
setMembersFieldIndex(whichForm: MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
2470
|
+
setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
2511
2471
|
if ('familyStatus' in this.formStore[whichForm][index]) {
|
|
2512
2472
|
this.formStore[whichForm][index].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember][index].familyStatusId);
|
|
2513
2473
|
}
|
|
@@ -2543,7 +2503,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2543
2503
|
if (this.formStore.signUrls.length) {
|
|
2544
2504
|
return this.formStore.signUrls;
|
|
2545
2505
|
}
|
|
2546
|
-
const prepareSignDocuments = (): SignDataType[] => {
|
|
2506
|
+
const prepareSignDocuments = (): Types.SignDataType[] => {
|
|
2547
2507
|
switch (this.formStore.applicationData.statusCode) {
|
|
2548
2508
|
case 'ContractSignedFrom':
|
|
2549
2509
|
return [
|
|
@@ -2601,94 +2561,17 @@ export const useDataStore = defineStore('data', {
|
|
|
2601
2561
|
};
|
|
2602
2562
|
const data = prepareSignDocuments();
|
|
2603
2563
|
if (type === 'qr') {
|
|
2604
|
-
const groupId = await this.api.signQR(data);
|
|
2564
|
+
const groupId = await this.api.file.signQR(data);
|
|
2605
2565
|
return groupId;
|
|
2606
2566
|
} else if (type === 'qrXml') {
|
|
2607
|
-
const signData = await this.api.signXml(data);
|
|
2567
|
+
const signData = await this.api.file.signXml(data);
|
|
2608
2568
|
return signData;
|
|
2609
|
-
} else if (type === 'signature') {
|
|
2610
|
-
const ncaLayerClient = new NCALayerClient();
|
|
2611
|
-
const formTemplate = new FormData();
|
|
2612
|
-
formTemplate.append('format', 'pdf');
|
|
2613
|
-
formTemplate.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2614
|
-
let activeTokens;
|
|
2615
|
-
try {
|
|
2616
|
-
await ncaLayerClient.connect();
|
|
2617
|
-
activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2618
|
-
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2619
|
-
if (this.formStore.applicationData.statusCode === 'ContractSignedFrom') {
|
|
2620
|
-
const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
|
|
2621
|
-
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2622
|
-
const formData = formTemplate;
|
|
2623
|
-
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2624
|
-
formData.append('name', 'PA_Contract');
|
|
2625
|
-
try {
|
|
2626
|
-
await this.api.uploadDigitalCertifijcate(formData);
|
|
2627
|
-
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2628
|
-
} catch (e) {
|
|
2629
|
-
this.showToaster('error', String(e));
|
|
2630
|
-
return;
|
|
2631
|
-
}
|
|
2632
|
-
} else if (this.formStore.applicationData.statusCode === 'HeadManagerForm') {
|
|
2633
|
-
const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
|
|
2634
|
-
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2635
|
-
const formData = formTemplate;
|
|
2636
|
-
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2637
|
-
formData.append('name', 'PA_Contract');
|
|
2638
|
-
try {
|
|
2639
|
-
await this.api.uploadDigitalCertificatePensionAnnuityNew(formData);
|
|
2640
|
-
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2641
|
-
} catch (e) {
|
|
2642
|
-
this.showToaster('error', String(e));
|
|
2643
|
-
return;
|
|
2644
|
-
}
|
|
2645
|
-
} else {
|
|
2646
|
-
if (!!this.formStore.signedDocumentList.find(i => i.fileTypeCode === '43')?.signed) {
|
|
2647
|
-
const statement = await this.generatePDFDocument('PA_Statement', '37', 'pdf');
|
|
2648
|
-
const statementSignature = await ncaLayerClient.basicsSignCMS(storageType, statement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2649
|
-
const statementData = formTemplate;
|
|
2650
|
-
statementData.append('base64EncodedSignature', statementSignature);
|
|
2651
|
-
statementData.append('name', 'PA_Statement');
|
|
2652
|
-
await this.api.uploadDigitalCertifijcate(statementData);
|
|
2653
|
-
const agreement = await this.generatePDFDocument('Agreement', '19', 'pdf');
|
|
2654
|
-
const agreementSignature = await ncaLayerClient.basicsSignCMS(storageType, agreement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2655
|
-
const agreementData = formTemplate;
|
|
2656
|
-
agreementData.append('base64EncodedSignature', agreementSignature);
|
|
2657
|
-
agreementData.append('name', 'Agreement');
|
|
2658
|
-
await this.api.uploadDigitalCertifijcate(agreementData);
|
|
2659
|
-
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2660
|
-
} else {
|
|
2661
|
-
const document = {
|
|
2662
|
-
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2663
|
-
name: 'PAEnpf_Agreement',
|
|
2664
|
-
format: 'xml',
|
|
2665
|
-
};
|
|
2666
|
-
const signData = await this.api.signXml([document]);
|
|
2667
|
-
const agreementXml = await this.api.getDocumentsByEdsXmlId(signData.data);
|
|
2668
|
-
const wnd = window.open('about:blank', '', '_blank');
|
|
2669
|
-
wnd?.document.write(agreementXml.data.document.documentXml);
|
|
2670
|
-
const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml.data.document.documentXml, 'SIGNATURE', '');
|
|
2671
|
-
const data = new FormData();
|
|
2672
|
-
data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2673
|
-
data.append('xmlData', signedAgreement);
|
|
2674
|
-
data.append('name', 'PAEnpf_Agreement');
|
|
2675
|
-
data.append('format', 'xml');
|
|
2676
|
-
data.append('EdsXmlId', signData.data);
|
|
2677
|
-
await this.api.uploadXml(data);
|
|
2678
|
-
await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
|
|
2679
|
-
this.showToaster('success', this.t('pension.consentGiven'), 3000);
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
} catch (error) {
|
|
2683
|
-
this.showToaster('error', String(error));
|
|
2684
|
-
return;
|
|
2685
|
-
}
|
|
2686
2569
|
} else {
|
|
2687
2570
|
if (this.processCode === 19 || this.processCode === 2 || this.processCode === 4) {
|
|
2688
|
-
const result = await this.api.signBts(data);
|
|
2571
|
+
const result = await this.api.file.signBts(data);
|
|
2689
2572
|
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2690
2573
|
} else {
|
|
2691
|
-
const result = await this.api.signDocument(data);
|
|
2574
|
+
const result = await this.api.file.signDocument(data);
|
|
2692
2575
|
this.formStore.signUrls = result;
|
|
2693
2576
|
}
|
|
2694
2577
|
return this.formStore.signUrls;
|
|
@@ -2697,6 +2580,84 @@ export const useDataStore = defineStore('data', {
|
|
|
2697
2580
|
ErrorHandler(err);
|
|
2698
2581
|
}
|
|
2699
2582
|
},
|
|
2583
|
+
async nclayerSign(groupId: string, signType: number, isXml: boolean = false, processInstanceId?: string) {
|
|
2584
|
+
try {
|
|
2585
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2586
|
+
await ncaLayerClient.connect();
|
|
2587
|
+
const activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2588
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2589
|
+
const document = await this.getFileNew(groupId, signType, isXml);
|
|
2590
|
+
if (isXml) {
|
|
2591
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, document, 'SIGNATURE', '');
|
|
2592
|
+
const data = new FormData();
|
|
2593
|
+
data.append('processInstanceId', processInstanceId ?? String(this.formStore.applicationData.processInstanceId));
|
|
2594
|
+
data.append('xmlData', signedAgreement);
|
|
2595
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2596
|
+
data.append('format', 'xml');
|
|
2597
|
+
data.append('EdsXmlId', groupId);
|
|
2598
|
+
await this.api.file.uploadXml(data);
|
|
2599
|
+
} else {
|
|
2600
|
+
const base64EncodedSignature = await ncaLayerClient.createCAdESFromBase64(storageType, document, 'SIGNATURE', true);
|
|
2601
|
+
await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
|
|
2602
|
+
}
|
|
2603
|
+
return true;
|
|
2604
|
+
} catch (err) {
|
|
2605
|
+
ErrorHandler(err);
|
|
2606
|
+
return false;
|
|
2607
|
+
}
|
|
2608
|
+
},
|
|
2609
|
+
async getFileNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
|
|
2610
|
+
try {
|
|
2611
|
+
let response: any = await this.api.file.generalGetFile(groupId, xml ? 5 : documentSignType);
|
|
2612
|
+
let blob;
|
|
2613
|
+
if (response.hasOwnProperty('data')) {
|
|
2614
|
+
const document = JSON.parse(response.data).Document;
|
|
2615
|
+
blob = new Blob([document.documentXml], {
|
|
2616
|
+
type: `application/xml`,
|
|
2617
|
+
});
|
|
2618
|
+
response = document.documentXml;
|
|
2619
|
+
} else {
|
|
2620
|
+
blob = new Blob([response], {
|
|
2621
|
+
type: `application/pdf`,
|
|
2622
|
+
});
|
|
2623
|
+
}
|
|
2624
|
+
const url = window.URL.createObjectURL(blob);
|
|
2625
|
+
if (!xml) {
|
|
2626
|
+
const link = document.createElement('a');
|
|
2627
|
+
link.href = url;
|
|
2628
|
+
link.setAttribute('download', fileName ?? `Документ ПА`);
|
|
2629
|
+
document.body.appendChild(link);
|
|
2630
|
+
link.click();
|
|
2631
|
+
}
|
|
2632
|
+
window.open(url, '_blank', `right=100`);
|
|
2633
|
+
return response;
|
|
2634
|
+
} catch (err) {
|
|
2635
|
+
ErrorHandler(err);
|
|
2636
|
+
}
|
|
2637
|
+
},
|
|
2638
|
+
async generateSign(taskId: string) {
|
|
2639
|
+
try {
|
|
2640
|
+
const signatories = await this.api.file.generateSign({ taskId });
|
|
2641
|
+
if (Array.isArray(signatories)) {
|
|
2642
|
+
signatories.forEach(signatory =>
|
|
2643
|
+
signatory.fileDatas?.sort(function (a: any, b: any) {
|
|
2644
|
+
return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
|
|
2645
|
+
}),
|
|
2646
|
+
);
|
|
2647
|
+
this.formStore.signatories = signatories;
|
|
2648
|
+
}
|
|
2649
|
+
} catch (err) {
|
|
2650
|
+
ErrorHandler(err);
|
|
2651
|
+
}
|
|
2652
|
+
},
|
|
2653
|
+
async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
|
|
2654
|
+
try {
|
|
2655
|
+
const response = await this.api.file.generalSign(data);
|
|
2656
|
+
return response;
|
|
2657
|
+
} catch (err) {
|
|
2658
|
+
ErrorHandler(err);
|
|
2659
|
+
}
|
|
2660
|
+
},
|
|
2700
2661
|
async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
|
|
2701
2662
|
try {
|
|
2702
2663
|
this.isButtonsLoading = true;
|
|
@@ -2758,12 +2719,12 @@ export const useDataStore = defineStore('data', {
|
|
|
2758
2719
|
try {
|
|
2759
2720
|
this.isButtonsLoading = true;
|
|
2760
2721
|
this.formStore.needToScanSignedContract = true;
|
|
2761
|
-
const data: SignDataType = {
|
|
2722
|
+
const data: Types.SignDataType = {
|
|
2762
2723
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2763
2724
|
name: 'Contract',
|
|
2764
2725
|
format: 'pdf',
|
|
2765
2726
|
};
|
|
2766
|
-
const response: any = await this.api.generateDocument(data);
|
|
2727
|
+
const response: any = await this.api.file.generateDocument(data);
|
|
2767
2728
|
const blob = new Blob([response], {
|
|
2768
2729
|
type: `application/pdf`,
|
|
2769
2730
|
});
|
|
@@ -2814,7 +2775,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2814
2775
|
const formattedData = formatDate(this.formStore.finCenterData.date);
|
|
2815
2776
|
if (!formattedData) return;
|
|
2816
2777
|
this.isLoading = true;
|
|
2817
|
-
const data: RegNumberDataType = {
|
|
2778
|
+
const data: Types.RegNumberDataType = {
|
|
2818
2779
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2819
2780
|
regNumber: String(this.formStore.finCenterData.regNumber),
|
|
2820
2781
|
date: formattedData.toISOString(),
|
|
@@ -2829,7 +2790,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2829
2790
|
},
|
|
2830
2791
|
async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
|
|
2831
2792
|
if (!type || !phoneNumber || !text) return;
|
|
2832
|
-
const smsData: SmsDataType = {
|
|
2793
|
+
const smsData: Types.SmsDataType = {
|
|
2833
2794
|
iin: this.formStore.applicationData.clientApp.iin,
|
|
2834
2795
|
phoneNumber: formatPhone(phoneNumber),
|
|
2835
2796
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
@@ -2846,16 +2807,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2846
2807
|
this.isLoading = false;
|
|
2847
2808
|
}
|
|
2848
2809
|
},
|
|
2849
|
-
sanitize(text: string) {
|
|
2850
|
-
return text
|
|
2851
|
-
.replace(/\r?\n|\r/g, '')
|
|
2852
|
-
.replace(/\\/g, '')
|
|
2853
|
-
.replace(/"/g, '');
|
|
2854
|
-
},
|
|
2855
2810
|
async getSignedDocList(processInstanceId: string | number) {
|
|
2856
2811
|
if (processInstanceId !== 0) {
|
|
2857
2812
|
try {
|
|
2858
|
-
this.formStore.signedDocumentList = await this.api.getSignedDocList({
|
|
2813
|
+
this.formStore.signedDocumentList = await this.api.file.getSignedDocList({
|
|
2859
2814
|
processInstanceId: processInstanceId,
|
|
2860
2815
|
});
|
|
2861
2816
|
} catch (err) {
|
|
@@ -2895,7 +2850,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2895
2850
|
}
|
|
2896
2851
|
this.isLoading = false;
|
|
2897
2852
|
},
|
|
2898
|
-
async getValidateClientESBD(data: ESBDValidationType) {
|
|
2853
|
+
async getValidateClientESBD(data: Types.ESBDValidationType) {
|
|
2899
2854
|
try {
|
|
2900
2855
|
return await this.api.getValidateClientESBD(data);
|
|
2901
2856
|
} catch (err) {
|
|
@@ -2903,7 +2858,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2903
2858
|
return ErrorHandler(err);
|
|
2904
2859
|
}
|
|
2905
2860
|
},
|
|
2906
|
-
validateMultipleMembers(localKey: MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2861
|
+
validateMultipleMembers(localKey: Types.MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2907
2862
|
if (this.formStore[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
2908
2863
|
if (this.formStore[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
2909
2864
|
const localMembers = [...this.formStore[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
@@ -2940,6 +2895,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2940
2895
|
return true;
|
|
2941
2896
|
},
|
|
2942
2897
|
async validateAllMembers(taskId: string, localCheck: boolean = false) {
|
|
2898
|
+
const policyholderDoc = this.formStore.signedDocumentList.find(
|
|
2899
|
+
i => i.iin === String(this.formStore.policyholderForm.iin).replaceAll('-', '') && (i.fileTypeCode === '1' || i.fileTypeCode === '2' || i.fileTypeCode === '4'),
|
|
2900
|
+
);
|
|
2943
2901
|
if (taskId === '0') {
|
|
2944
2902
|
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
2945
2903
|
return false;
|
|
@@ -2948,6 +2906,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2948
2906
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
2949
2907
|
return false;
|
|
2950
2908
|
}
|
|
2909
|
+
if (useEnv().isProduction && this.isInitiator() && this.isEfoParent && this.formStore.policyholderForm.iin && !policyholderDoc) {
|
|
2910
|
+
this.showToaster('error', this.t('toaster.needDigDoc', { text: 'страхователя' }));
|
|
2911
|
+
return false;
|
|
2912
|
+
}
|
|
2951
2913
|
if (this.members.insuredApp.has) {
|
|
2952
2914
|
if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
|
|
2953
2915
|
return false;
|
|
@@ -3243,13 +3205,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3243
3205
|
if (!this.accessToken) return null;
|
|
3244
3206
|
try {
|
|
3245
3207
|
const decoded = jwtDecode(this.accessToken);
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3208
|
+
if (decoded) {
|
|
3209
|
+
const data = {
|
|
3210
|
+
userName: decoded.code,
|
|
3211
|
+
branchName: decoded.branchCode,
|
|
3212
|
+
bin: bin.replace(/-/g, ''),
|
|
3213
|
+
};
|
|
3214
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3215
|
+
return gbdulResponse;
|
|
3216
|
+
}
|
|
3217
|
+
return null;
|
|
3253
3218
|
} catch (err) {
|
|
3254
3219
|
return ErrorHandler(err);
|
|
3255
3220
|
}
|
|
@@ -3299,7 +3264,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3299
3264
|
this.isLoading = false;
|
|
3300
3265
|
return false;
|
|
3301
3266
|
}
|
|
3302
|
-
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Api.GBD.Person };
|
|
3267
|
+
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Types.Api.GBD.Person };
|
|
3303
3268
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
3304
3269
|
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
3305
3270
|
member.resetMember(false);
|
|
@@ -3316,7 +3281,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3316
3281
|
this.isLoading = false;
|
|
3317
3282
|
}
|
|
3318
3283
|
},
|
|
3319
|
-
async saveInStoreUserGBDFL(person: Api.GBD.Person, member: Member) {
|
|
3284
|
+
async saveInStoreUserGBDFL(person: Types.Api.GBD.Person, member: Member) {
|
|
3320
3285
|
member.firstName = person.name;
|
|
3321
3286
|
member.lastName = person.surname;
|
|
3322
3287
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
@@ -3408,14 +3373,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3408
3373
|
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
3409
3374
|
|
|
3410
3375
|
if (Array.isArray(person.documents.document)) {
|
|
3411
|
-
const
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
(i
|
|
3416
|
-
|
|
3376
|
+
const filteredDocuments = person.documents.document.filter(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00');
|
|
3377
|
+
const validDocument = this.isLifetrip
|
|
3378
|
+
? filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3379
|
+
: filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes['1UDL']) ??
|
|
3380
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.VNZ) ??
|
|
3381
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS);
|
|
3417
3382
|
if (validDocument) {
|
|
3418
|
-
const documentType = this.documentTypes.find(
|
|
3383
|
+
const documentType = this.documentTypes.find(
|
|
3384
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(validDocument.type.code)],
|
|
3385
|
+
);
|
|
3419
3386
|
if (documentType) member.documentType = documentType;
|
|
3420
3387
|
if (validDocument.number) member.documentNumber = validDocument.number;
|
|
3421
3388
|
if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
|
|
@@ -3428,9 +3395,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3428
3395
|
if (
|
|
3429
3396
|
personDoc.status.code === '00' &&
|
|
3430
3397
|
new Date(personDoc.endDate) > new Date(Date.now()) &&
|
|
3431
|
-
(personDoc.type.code ===
|
|
3398
|
+
(personDoc.type.code === CoreEnums.GBD.DocTypes['1UDL'] || personDoc.type.code === CoreEnums.GBD.DocTypes.VNZ || personDoc.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3432
3399
|
) {
|
|
3433
|
-
const documentType = this.documentTypes.find(
|
|
3400
|
+
const documentType = this.documentTypes.find(
|
|
3401
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(personDoc.type.code)],
|
|
3402
|
+
);
|
|
3434
3403
|
if (documentType) member.documentType = documentType;
|
|
3435
3404
|
const documentNumber = personDoc.number;
|
|
3436
3405
|
if (documentNumber) member.documentNumber = documentNumber;
|
|
@@ -3477,12 +3446,14 @@ export const useDataStore = defineStore('data', {
|
|
|
3477
3446
|
'clientData.authoritedPerson.bankInfo',
|
|
3478
3447
|
'clientData.authoritedPerson.economySectorCode',
|
|
3479
3448
|
'clientData.authoritedPerson.legalAddress',
|
|
3480
|
-
'clientData.authoritedPerson.placeOfBirth',
|
|
3481
|
-
'clientData.authoritedPerson.resident',
|
|
3482
3449
|
'clientData.authoritedPerson.taxResidentCountry',
|
|
3483
3450
|
'clientData.authoritedPerson.addTaxResidency',
|
|
3484
3451
|
]);
|
|
3485
3452
|
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3453
|
+
if (this.formStore.lfb.add) {
|
|
3454
|
+
policyholder.parentContractNumber = localStorage.getItem('policyNo');
|
|
3455
|
+
policyholder.parentContractId = localStorage.getItem('policyId');
|
|
3456
|
+
}
|
|
3486
3457
|
try {
|
|
3487
3458
|
const response = await this.api.startApplication(policyholder);
|
|
3488
3459
|
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
@@ -3515,6 +3486,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3515
3486
|
this.formStore.regNumber = applicationData.regNumber;
|
|
3516
3487
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
3517
3488
|
|
|
3489
|
+
if (localStorage.getItem('add') === 'true' || this.formStore.applicationData.parentPolicyDto !== null) {
|
|
3490
|
+
this.formStore.lfb.add = true;
|
|
3491
|
+
this.formStore.lfb.policyholder.clientData.iin = localStorage.getItem('bin') as string;
|
|
3492
|
+
}
|
|
3493
|
+
|
|
3518
3494
|
this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
|
|
3519
3495
|
this.formStore.applicationTaskId = taskId;
|
|
3520
3496
|
this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
|
|
@@ -3591,6 +3567,20 @@ export const useDataStore = defineStore('data', {
|
|
|
3591
3567
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
3592
3568
|
const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
|
|
3593
3569
|
this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
|
|
3570
|
+
|
|
3571
|
+
if (applicationData.parentPolicyDto !== null) {
|
|
3572
|
+
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.parentPolicyDto.contractInsrBegin);
|
|
3573
|
+
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.parentPolicyDto.contractInsrEnd);
|
|
3574
|
+
}
|
|
3575
|
+
if (this.formStore.lfb.add) {
|
|
3576
|
+
if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
|
|
3577
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3578
|
+
this.formStore.productConditionsForm.requestedSumInsured = null;
|
|
3579
|
+
} else {
|
|
3580
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3581
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = null;
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3594
3584
|
} catch (err) {
|
|
3595
3585
|
ErrorHandler(err);
|
|
3596
3586
|
if (err instanceof AxiosError) {
|
|
@@ -3601,7 +3591,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3601
3591
|
}
|
|
3602
3592
|
this.isLoading = false;
|
|
3603
3593
|
},
|
|
3604
|
-
async saveAccidentIncidents(data: AccidentIncidents[]) {
|
|
3594
|
+
async saveAccidentIncidents(data: Types.AccidentIncidents[]) {
|
|
3605
3595
|
try {
|
|
3606
3596
|
const dataCopy = JSON.parse(JSON.stringify(data));
|
|
3607
3597
|
for (const incident of dataCopy) {
|
|
@@ -3699,6 +3689,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3699
3689
|
premium: client.insuredPolicyData.premium,
|
|
3700
3690
|
premiumWithLoad: client.insuredPolicyData.premiumWithLoad,
|
|
3701
3691
|
hasAttachedFile: client.hasAttachedFile,
|
|
3692
|
+
insrBeginDate: client.insuredPolicyData.insrBeginDate ?? 'no',
|
|
3693
|
+
insrEndDate: client.insuredPolicyData.insrEndDate ?? 'no',
|
|
3702
3694
|
};
|
|
3703
3695
|
});
|
|
3704
3696
|
return clients;
|
|
@@ -3747,7 +3739,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3747
3739
|
return false;
|
|
3748
3740
|
}
|
|
3749
3741
|
|
|
3750
|
-
if (this.formStore.lfb.beneficialOwners) {
|
|
3742
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.beneficialOwners) {
|
|
3751
3743
|
if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
3752
3744
|
return false;
|
|
3753
3745
|
}
|
|
@@ -3758,7 +3750,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3758
3750
|
}
|
|
3759
3751
|
}
|
|
3760
3752
|
|
|
3761
|
-
if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3753
|
+
if (!this.formStore.lfb.add && this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3762
3754
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
|
|
3763
3755
|
return false;
|
|
3764
3756
|
}
|
|
@@ -3774,7 +3766,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3774
3766
|
}
|
|
3775
3767
|
}
|
|
3776
3768
|
|
|
3777
|
-
if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3769
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3778
3770
|
for (const client of this.formStore.lfb.clients) {
|
|
3779
3771
|
if (client.hasAttachedFile === false) {
|
|
3780
3772
|
this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
|
|
@@ -3783,18 +3775,50 @@ export const useDataStore = defineStore('data', {
|
|
|
3783
3775
|
}
|
|
3784
3776
|
}
|
|
3785
3777
|
|
|
3786
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3778
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3787
3779
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
3788
3780
|
return false;
|
|
3789
3781
|
}
|
|
3790
3782
|
|
|
3791
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3783
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3792
3784
|
this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
|
|
3793
3785
|
return false;
|
|
3794
3786
|
}
|
|
3795
3787
|
|
|
3796
3788
|
return true;
|
|
3797
3789
|
},
|
|
3790
|
+
async getOnlineAccess(iin: string, documentType: string) {
|
|
3791
|
+
try {
|
|
3792
|
+
const data = {
|
|
3793
|
+
iinBin: iin.replaceAll('-', ''),
|
|
3794
|
+
documentType: documentType,
|
|
3795
|
+
};
|
|
3796
|
+
const response = await this.api.externalServices.getOnlineAccess(data);
|
|
3797
|
+
if (response.code === 'PROFILE_DIGIDOCS_INTERNAL_ERROR') {
|
|
3798
|
+
this.showToaster('error', this.t('toaster.notDigDoc'), 3000);
|
|
3799
|
+
return false;
|
|
3800
|
+
} else {
|
|
3801
|
+
return true;
|
|
3802
|
+
}
|
|
3803
|
+
} catch (err) {
|
|
3804
|
+
ErrorHandler(err);
|
|
3805
|
+
return null;
|
|
3806
|
+
}
|
|
3807
|
+
},
|
|
3808
|
+
async getDigitalDocuments(iin: string, processInstanceId: string, code: string) {
|
|
3809
|
+
try {
|
|
3810
|
+
const data = {
|
|
3811
|
+
iin: iin.replaceAll('-', ''),
|
|
3812
|
+
processInstanceId: processInstanceId,
|
|
3813
|
+
code: code.replace(/\s/g, ''),
|
|
3814
|
+
};
|
|
3815
|
+
await this.api.externalServices.getDigitalDocuments(data);
|
|
3816
|
+
return true;
|
|
3817
|
+
} catch (err) {
|
|
3818
|
+
ErrorHandler(err);
|
|
3819
|
+
return null;
|
|
3820
|
+
}
|
|
3821
|
+
},
|
|
3798
3822
|
async getVariableData(processCode: number) {
|
|
3799
3823
|
try {
|
|
3800
3824
|
const response = await this.api.getVariableData(0, processCode);
|
|
@@ -3824,6 +3848,24 @@ export const useDataStore = defineStore('data', {
|
|
|
3824
3848
|
return ErrorHandler(err);
|
|
3825
3849
|
}
|
|
3826
3850
|
},
|
|
3851
|
+
async getBankByAccountNumber(accountNumber: string) {
|
|
3852
|
+
try {
|
|
3853
|
+
const bank = await this.api.getBankByAccountNumber(accountNumber);
|
|
3854
|
+
return bank;
|
|
3855
|
+
} catch (err) {
|
|
3856
|
+
ErrorHandler(err);
|
|
3857
|
+
}
|
|
3858
|
+
},
|
|
3859
|
+
async getContractByBin(bin: string) {
|
|
3860
|
+
try {
|
|
3861
|
+
const contract = await this.api.getContractByBin(bin);
|
|
3862
|
+
contract.insrBegin = reformatDate(contract.insrBegin) ?? '';
|
|
3863
|
+
contract.insrEnd = reformatDate(contract.insrEnd) ?? '';
|
|
3864
|
+
return contract;
|
|
3865
|
+
} catch (err) {
|
|
3866
|
+
ErrorHandler(err);
|
|
3867
|
+
}
|
|
3868
|
+
},
|
|
3827
3869
|
async isCourseChanged(processInstanceId: string) {
|
|
3828
3870
|
try {
|
|
3829
3871
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -3832,7 +3874,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3832
3874
|
return ErrorHandler(err);
|
|
3833
3875
|
}
|
|
3834
3876
|
},
|
|
3835
|
-
async generateShortLink(url: string, template?: Api.GenerateShortLink.Templates) {
|
|
3877
|
+
async generateShortLink(url: string, template?: Types.Api.GenerateShortLink.Templates) {
|
|
3836
3878
|
try {
|
|
3837
3879
|
const response = await this.api.generateShortLink({
|
|
3838
3880
|
link: url,
|
|
@@ -3845,7 +3887,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3845
3887
|
}
|
|
3846
3888
|
},
|
|
3847
3889
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
3848
|
-
if (this.isLifetrip || this.isPension) return false;
|
|
3890
|
+
if (this.isLifetrip || this.isPension || this.isBalam) return false;
|
|
3849
3891
|
switch (whichForm) {
|
|
3850
3892
|
case this.formStore.beneficiaryFormKey:
|
|
3851
3893
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -3856,7 +3898,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3856
3898
|
}
|
|
3857
3899
|
},
|
|
3858
3900
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
3859
|
-
if (this.
|
|
3901
|
+
if (this.isPension) return false;
|
|
3860
3902
|
switch (whichForm) {
|
|
3861
3903
|
case this.formStore.beneficiaryFormKey:
|
|
3862
3904
|
return false;
|
|
@@ -3864,18 +3906,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3864
3906
|
return true;
|
|
3865
3907
|
}
|
|
3866
3908
|
},
|
|
3867
|
-
hasPlaceSection(whichForm: keyof typeof StoreMembers) {
|
|
3868
|
-
switch (whichForm) {
|
|
3869
|
-
default:
|
|
3870
|
-
return true;
|
|
3871
|
-
}
|
|
3872
|
-
},
|
|
3873
|
-
hasDocumentSection(whichForm: keyof typeof StoreMembers) {
|
|
3874
|
-
switch (whichForm) {
|
|
3875
|
-
default:
|
|
3876
|
-
return true;
|
|
3877
|
-
}
|
|
3878
|
-
},
|
|
3879
3909
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
3880
3910
|
if (this.isGons || this.isPension) return false;
|
|
3881
3911
|
switch (whichForm) {
|
|
@@ -3912,44 +3942,5 @@ export const useDataStore = defineStore('data', {
|
|
|
3912
3942
|
return false;
|
|
3913
3943
|
}
|
|
3914
3944
|
},
|
|
3915
|
-
hasPercentageOfPayoutAmount() {
|
|
3916
|
-
return true;
|
|
3917
|
-
},
|
|
3918
|
-
hasAccess() {
|
|
3919
|
-
const baseAccessRoles = this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
|
|
3920
|
-
return {
|
|
3921
|
-
invoiceInfo: this.isAdmin(),
|
|
3922
|
-
toLKA: this.isAgent() || baseAccessRoles,
|
|
3923
|
-
toAML: this.isCompliance() || baseAccessRoles,
|
|
3924
|
-
toAULETTI: this.isAgentAuletti() || baseAccessRoles,
|
|
3925
|
-
toLKA_A: this.isAgentAuletti() || baseAccessRoles,
|
|
3926
|
-
toEFO:
|
|
3927
|
-
this.isManager() ||
|
|
3928
|
-
this.isAgent() ||
|
|
3929
|
-
this.isAgentMycar() ||
|
|
3930
|
-
this.isManagerHalykBank() ||
|
|
3931
|
-
this.isHeadManager() ||
|
|
3932
|
-
this.isServiceManager() ||
|
|
3933
|
-
this.isUnderwriter() ||
|
|
3934
|
-
this.isActuary() ||
|
|
3935
|
-
this.isAdmin() ||
|
|
3936
|
-
this.isCompliance() ||
|
|
3937
|
-
this.isAnalyst() ||
|
|
3938
|
-
this.isUpk() ||
|
|
3939
|
-
this.isFinCenter() ||
|
|
3940
|
-
this.isSupervisor() ||
|
|
3941
|
-
this.isSupport() ||
|
|
3942
|
-
this.isDrn() ||
|
|
3943
|
-
this.isUrp() ||
|
|
3944
|
-
this.isUsns() ||
|
|
3945
|
-
this.isAccountant() ||
|
|
3946
|
-
this.isBranchDirector() ||
|
|
3947
|
-
this.isUSNSACCINS() ||
|
|
3948
|
-
this.isDsuio() ||
|
|
3949
|
-
this.isAdjuster() ||
|
|
3950
|
-
this.isDsoDirector() ||
|
|
3951
|
-
this.isAccountantDirector(),
|
|
3952
|
-
};
|
|
3953
|
-
},
|
|
3954
3945
|
},
|
|
3955
3946
|
});
|