hl-core 0.0.10-beta.3 → 0.0.10-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/README.md +0 -2
- package/api/base.api.ts +300 -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 +17 -8
- package/components/Form/ProductConditionsBlock.vue +12 -6
- package/components/Input/Datepicker.vue +5 -0
- package/components/Input/DynamicInput.vue +2 -0
- package/components/Input/FormInput.vue +7 -0
- package/components/Input/OtpInput.vue +25 -0
- package/components/Input/PanelInput.vue +1 -0
- package/components/Input/RoundedInput.vue +4 -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 +429 -59
- package/components/Pages/MemberForm.vue +327 -159
- package/components/Pages/ProductConditions.vue +681 -150
- package/components/Panel/PanelHandler.vue +261 -114
- 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 +133 -42
- package/composables/constants.ts +41 -0
- package/composables/fields.ts +6 -4
- package/composables/index.ts +246 -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 +44 -14
- package/nuxt.config.ts +10 -13
- package/package.json +13 -12
- package/plugins/head.ts +2 -1
- package/store/data.store.ts +670 -480
- package/store/member.store.ts +18 -6
- package/store/rules.ts +21 -2
- package/tsconfig.json +3 -0
- package/types/enum.ts +20 -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,39 +280,75 @@ export const useDataStore = defineStore('data', {
|
|
|
397
280
|
if (!file.id) return;
|
|
398
281
|
try {
|
|
399
282
|
this.isLoading = true;
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
283
|
+
if (this.isPension) {
|
|
284
|
+
await this.api.file.getFileNew(file.id).then((response: any) => {
|
|
285
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
286
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
287
|
+
const url = window.URL.createObjectURL(blob);
|
|
288
|
+
const link = document.createElement('a');
|
|
289
|
+
link.href = url;
|
|
290
|
+
if (mode === 'view') {
|
|
291
|
+
setTimeout(() => {
|
|
292
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
293
|
+
});
|
|
294
|
+
} else {
|
|
295
|
+
link.setAttribute('download', file.fileName!);
|
|
296
|
+
document.body.appendChild(link);
|
|
297
|
+
link.click();
|
|
298
|
+
}
|
|
410
299
|
} else {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
link.click();
|
|
414
|
-
}
|
|
415
|
-
} else {
|
|
416
|
-
const blob = new Blob([response], {
|
|
417
|
-
type: `application/${fileType}`,
|
|
418
|
-
});
|
|
419
|
-
const url = window.URL.createObjectURL(blob);
|
|
420
|
-
const link = document.createElement('a');
|
|
421
|
-
link.href = url;
|
|
422
|
-
if (mode === 'view') {
|
|
423
|
-
setTimeout(() => {
|
|
424
|
-
window.open(url, '_blank', `right=100`);
|
|
300
|
+
const blob = new Blob([response], {
|
|
301
|
+
type: `application/${fileType}`,
|
|
425
302
|
});
|
|
303
|
+
const url = window.URL.createObjectURL(blob);
|
|
304
|
+
const link = document.createElement('a');
|
|
305
|
+
link.href = url;
|
|
306
|
+
if (mode === 'view') {
|
|
307
|
+
setTimeout(() => {
|
|
308
|
+
window.open(url, '_blank', `right=100`);
|
|
309
|
+
});
|
|
310
|
+
} else {
|
|
311
|
+
link.setAttribute('download', file.fileName!);
|
|
312
|
+
document.body.appendChild(link);
|
|
313
|
+
link.click();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
} else {
|
|
318
|
+
await this.api.file.getFile(file.id).then((response: any) => {
|
|
319
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
320
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
321
|
+
const url = window.URL.createObjectURL(blob);
|
|
322
|
+
const link = document.createElement('a');
|
|
323
|
+
link.href = url;
|
|
324
|
+
if (mode === 'view') {
|
|
325
|
+
setTimeout(() => {
|
|
326
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
327
|
+
});
|
|
328
|
+
} else {
|
|
329
|
+
link.setAttribute('download', file.fileName!);
|
|
330
|
+
document.body.appendChild(link);
|
|
331
|
+
link.click();
|
|
332
|
+
}
|
|
426
333
|
} else {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
334
|
+
const blob = new Blob([response], {
|
|
335
|
+
type: `application/${fileType}`,
|
|
336
|
+
});
|
|
337
|
+
const url = window.URL.createObjectURL(blob);
|
|
338
|
+
const link = document.createElement('a');
|
|
339
|
+
link.href = url;
|
|
340
|
+
if (mode === 'view') {
|
|
341
|
+
setTimeout(() => {
|
|
342
|
+
window.open(url, '_blank', `right=100`);
|
|
343
|
+
});
|
|
344
|
+
} else {
|
|
345
|
+
link.setAttribute('download', file.fileName!);
|
|
346
|
+
document.body.appendChild(link);
|
|
347
|
+
link.click();
|
|
348
|
+
}
|
|
430
349
|
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
433
352
|
} catch (err) {
|
|
434
353
|
ErrorHandler(err);
|
|
435
354
|
} finally {
|
|
@@ -438,7 +357,7 @@ export const useDataStore = defineStore('data', {
|
|
|
438
357
|
},
|
|
439
358
|
async deleteFile(data: DocumentItem) {
|
|
440
359
|
try {
|
|
441
|
-
await this.api.deleteFile(data);
|
|
360
|
+
await this.api.file.deleteFile(data);
|
|
442
361
|
this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
|
|
443
362
|
} catch (err) {
|
|
444
363
|
ErrorHandler(err);
|
|
@@ -447,7 +366,7 @@ export const useDataStore = defineStore('data', {
|
|
|
447
366
|
async uploadFiles(data: FormData, load: boolean = false) {
|
|
448
367
|
this.isLoading = load;
|
|
449
368
|
try {
|
|
450
|
-
await this.api.uploadFiles(data);
|
|
369
|
+
await this.api.file.uploadFiles(data);
|
|
451
370
|
return true;
|
|
452
371
|
} catch (err) {
|
|
453
372
|
return ErrorHandler(err);
|
|
@@ -457,14 +376,28 @@ export const useDataStore = defineStore('data', {
|
|
|
457
376
|
},
|
|
458
377
|
async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
|
|
459
378
|
this.isLoading = load;
|
|
460
|
-
|
|
379
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
380
|
+
if (isNonResident) {
|
|
381
|
+
if (!member.firstName || !member.lastName) return;
|
|
382
|
+
} else {
|
|
383
|
+
if (!member.iin) return;
|
|
384
|
+
}
|
|
461
385
|
try {
|
|
462
|
-
const queryData =
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
386
|
+
const queryData = isNonResident
|
|
387
|
+
? {
|
|
388
|
+
firstName: member.firstName ?? '',
|
|
389
|
+
lastName: member.lastName ?? '',
|
|
390
|
+
middleName: member.middleName ?? '',
|
|
391
|
+
iin: '',
|
|
392
|
+
birthDate: member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
393
|
+
}
|
|
394
|
+
: {
|
|
395
|
+
firstName: '',
|
|
396
|
+
lastName: '',
|
|
397
|
+
middleName: '',
|
|
398
|
+
iin: member.iin ? member.iin.replace(/-/g, '') : '',
|
|
399
|
+
birthDate: '',
|
|
400
|
+
};
|
|
468
401
|
const contragentResponse = await this.api.getContragent(queryData);
|
|
469
402
|
if (contragentResponse.totalItems > 0) {
|
|
470
403
|
if (contragentResponse.items.length === 1) {
|
|
@@ -473,22 +406,29 @@ export const useDataStore = defineStore('data', {
|
|
|
473
406
|
const sortedByRegistrationDate = contragentResponse.items.sort(
|
|
474
407
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
475
408
|
);
|
|
476
|
-
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
409
|
+
if (!isNonResident) await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
477
410
|
}
|
|
478
411
|
member.gotFromInsis = true;
|
|
479
412
|
} else {
|
|
480
413
|
if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
481
414
|
}
|
|
415
|
+
if (isNonResident) return contragentResponse;
|
|
482
416
|
} catch (err) {
|
|
483
417
|
ErrorHandler(err);
|
|
484
418
|
}
|
|
485
419
|
this.isLoading = false;
|
|
486
420
|
},
|
|
487
|
-
async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
|
|
421
|
+
async getContragentById(id: number, whichForm: keyof typeof StoreMembers | 'slaveInsuredForm', load: boolean = true, whichIndex: number | null = null) {
|
|
488
422
|
if (Number(id) === 0) return;
|
|
489
423
|
this.isLoading = load;
|
|
490
424
|
try {
|
|
491
|
-
const member =
|
|
425
|
+
const member =
|
|
426
|
+
this.isPension && whichForm === 'slaveInsuredForm'
|
|
427
|
+
? this.formStore.slaveInsuredForm
|
|
428
|
+
: whichIndex === null
|
|
429
|
+
? this.formStore[whichForm as Types.SingleMember]
|
|
430
|
+
: this.formStore[whichForm as Types.MultipleMember][whichIndex];
|
|
431
|
+
|
|
492
432
|
const contragentResponse = await this.api.getContragentById(id);
|
|
493
433
|
if (contragentResponse.totalItems > 0) {
|
|
494
434
|
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
@@ -501,7 +441,7 @@ export const useDataStore = defineStore('data', {
|
|
|
501
441
|
this.isLoading = false;
|
|
502
442
|
}
|
|
503
443
|
},
|
|
504
|
-
async serializeContragentData(member: Member, contragent: ContragentType) {
|
|
444
|
+
async serializeContragentData(member: Member, contragent: Types.ContragentType) {
|
|
505
445
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
506
446
|
this.api.getContrAgentData(contragent.id),
|
|
507
447
|
this.api.getContrAgentContacts(contragent.id),
|
|
@@ -533,13 +473,19 @@ export const useDataStore = defineStore('data', {
|
|
|
533
473
|
},
|
|
534
474
|
parseContragent(
|
|
535
475
|
member: Member,
|
|
536
|
-
user: {
|
|
476
|
+
user: {
|
|
477
|
+
personalData: Types.ContragentType;
|
|
478
|
+
data?: Types.ContragentQuestionaries[];
|
|
479
|
+
contacts?: Types.ContragentContacts[];
|
|
480
|
+
documents?: Types.ContragentDocuments[];
|
|
481
|
+
address?: Types.ContragentAddress[];
|
|
482
|
+
},
|
|
537
483
|
) {
|
|
538
484
|
member.verifyType = user.personalData.verifyType;
|
|
539
485
|
member.verifyDate = user.personalData.verifyDate;
|
|
540
486
|
member.iin = reformatIin(user.personalData.iin);
|
|
541
487
|
member.age = String(user.personalData.age);
|
|
542
|
-
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
488
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace ?? 'undefined', 'i')));
|
|
543
489
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
544
490
|
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
545
491
|
member.gender = gender ? gender : new Value();
|
|
@@ -556,13 +502,18 @@ export const useDataStore = defineStore('data', {
|
|
|
556
502
|
|
|
557
503
|
if ('documents' in user && user.documents && user.documents.length) {
|
|
558
504
|
member.documentsList = user.documents;
|
|
559
|
-
const documentByPriority = user.documents.find(i => i.type ===
|
|
505
|
+
const documentByPriority = user.documents.find(i => i.type === CoreEnums.Insis.DocTypes['1UDL']);
|
|
560
506
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
561
507
|
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
562
508
|
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
563
509
|
member.documentType = documentType ? documentType : new Value();
|
|
564
510
|
member.documentNumber = userDocument.number;
|
|
565
511
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
512
|
+
if (userDocument.issuerNameRu === 'Другое') {
|
|
513
|
+
member.documentIssuers.issuerOtherNameRu = userDocument.issuerOtherNameRu;
|
|
514
|
+
member.documentIssuers.issuerOtherNameOrig = userDocument.issuerOtherNameOrig;
|
|
515
|
+
member.documentIssuers.issuerOtherName = userDocument.issuerOtherName;
|
|
516
|
+
}
|
|
566
517
|
member.documentDate = reformatDate(userDocument.issueDate);
|
|
567
518
|
member.documentExpire = reformatDate(userDocument.expireDate);
|
|
568
519
|
}
|
|
@@ -615,7 +566,7 @@ export const useDataStore = defineStore('data', {
|
|
|
615
566
|
});
|
|
616
567
|
}
|
|
617
568
|
},
|
|
618
|
-
searchFromList(member: Member, searchIt: ContragentQuestionaries) {
|
|
569
|
+
searchFromList(member: Member, searchIt: Types.ContragentQuestionaries) {
|
|
619
570
|
const getQuestionariesData = () => {
|
|
620
571
|
switch (searchIt.questId) {
|
|
621
572
|
case '500003':
|
|
@@ -638,23 +589,30 @@ export const useDataStore = defineStore('data', {
|
|
|
638
589
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
639
590
|
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
640
591
|
//@ts-ignore
|
|
641
|
-
member[qData.field] = qResult
|
|
592
|
+
member[qData.field] = qResult ?? new Value();
|
|
642
593
|
}
|
|
643
594
|
},
|
|
644
595
|
async alreadyInInsis(member: Member) {
|
|
645
|
-
|
|
596
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
597
|
+
if (isNonResident) {
|
|
598
|
+
if (!member.firstName || !member.lastName) return;
|
|
599
|
+
} else {
|
|
600
|
+
if (!member.iin) return;
|
|
601
|
+
}
|
|
646
602
|
try {
|
|
647
603
|
const queryData = {
|
|
648
|
-
iin: member.iin.replaceAll('-', ''),
|
|
604
|
+
iin: !!member.iin && !isNonResident ? member.iin.replaceAll('-', '') : '',
|
|
649
605
|
firstName: !!member.firstName ? member.firstName : '',
|
|
650
606
|
lastName: !!member.lastName ? member.lastName : '',
|
|
651
607
|
middleName: !!member.middleName ? member.middleName : '',
|
|
608
|
+
birthDate: !!member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
652
609
|
};
|
|
653
610
|
const contragent = await this.api.getContragent(queryData);
|
|
654
611
|
if (contragent.totalItems > 0) {
|
|
655
612
|
if (contragent.items.length === 1) {
|
|
656
613
|
return contragent.items[0];
|
|
657
614
|
} else {
|
|
615
|
+
if (this.isPension && queryData.iin === '') return contragent.items.find(i => i.id === member.id);
|
|
658
616
|
const sortedByRegistrationDate = contragent.items.sort(
|
|
659
617
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
660
618
|
);
|
|
@@ -688,8 +646,8 @@ export const useDataStore = defineStore('data', {
|
|
|
688
646
|
}
|
|
689
647
|
},
|
|
690
648
|
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.
|
|
649
|
+
if (this.isGons && user.iin && whichForm === 'beneficiaryForm') {
|
|
650
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesActualPolicy(String(this.formStore.applicationData.processInstanceId));
|
|
693
651
|
if (doesHaveActiveContract) {
|
|
694
652
|
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
695
653
|
return false;
|
|
@@ -723,10 +681,10 @@ export const useDataStore = defineStore('data', {
|
|
|
723
681
|
}
|
|
724
682
|
}
|
|
725
683
|
try {
|
|
726
|
-
const contragentData: ContragentType = {
|
|
684
|
+
const contragentData: Types.ContragentType = {
|
|
727
685
|
id: Number(user.id),
|
|
728
686
|
type: Number(user.type),
|
|
729
|
-
iin: user.iin
|
|
687
|
+
iin: user.iin ? user.iin.replace(/-/g, '') : '',
|
|
730
688
|
longName: user.longName !== null ? user.longName : (user.lastName ?? '') + (user.firstName ?? '') + (user.middleName ?? ''),
|
|
731
689
|
lastName: user.lastName ?? '',
|
|
732
690
|
firstName: user.firstName ?? '',
|
|
@@ -753,7 +711,7 @@ export const useDataStore = defineStore('data', {
|
|
|
753
711
|
countryOfTaxResidency,
|
|
754
712
|
signOfResidency,
|
|
755
713
|
}))(user);
|
|
756
|
-
const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
714
|
+
const questionariesData: Types.ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
757
715
|
let questName = '';
|
|
758
716
|
let questionId = parseInt(question.ids as string).toString();
|
|
759
717
|
if (questionId === '500003') {
|
|
@@ -821,7 +779,7 @@ export const useDataStore = defineStore('data', {
|
|
|
821
779
|
}
|
|
822
780
|
|
|
823
781
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
824
|
-
const contactsData: ContragentContacts[] = [];
|
|
782
|
+
const contactsData: Types.ContragentContacts[] = [];
|
|
825
783
|
if (!!user.phoneNumber) {
|
|
826
784
|
contactsData.push({
|
|
827
785
|
contragentId: Number(user.id),
|
|
@@ -863,7 +821,7 @@ export const useDataStore = defineStore('data', {
|
|
|
863
821
|
|
|
864
822
|
const documentsData = user.documentsList;
|
|
865
823
|
const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
|
|
866
|
-
const userDocument: ContragentDocuments = {
|
|
824
|
+
const userDocument: Types.ContragentDocuments = {
|
|
867
825
|
contragentId: Number(user.id),
|
|
868
826
|
id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
|
|
869
827
|
description: null,
|
|
@@ -880,6 +838,11 @@ export const useDataStore = defineStore('data', {
|
|
|
880
838
|
verifyType: user.verifyType,
|
|
881
839
|
verifyDate: user.verifyDate,
|
|
882
840
|
};
|
|
841
|
+
if (user.documentIssuers.ids === '1') {
|
|
842
|
+
userDocument.issuerOtherName = user.documentIssuers.issuerOtherName;
|
|
843
|
+
userDocument.issuerOtherNameOrig = user.documentIssuers.issuerOtherNameOrig;
|
|
844
|
+
userDocument.issuerOtherNameRu = user.documentIssuers.issuerOtherNameRu;
|
|
845
|
+
}
|
|
883
846
|
if (hasAlreadyDocument !== -1) {
|
|
884
847
|
documentsData[hasAlreadyDocument] = userDocument;
|
|
885
848
|
} else {
|
|
@@ -888,7 +851,7 @@ export const useDataStore = defineStore('data', {
|
|
|
888
851
|
|
|
889
852
|
const checkForNull = (value: any) => (value ? value : '');
|
|
890
853
|
const userResponseAddress = 'response' in user && user.response && 'addresses' in user.response && user.response.addresses ? user.response.addresses : null;
|
|
891
|
-
const addressData: ContragentAddress[] = [];
|
|
854
|
+
const addressData: Types.ContragentAddress[] = [];
|
|
892
855
|
addressData.push({
|
|
893
856
|
id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
|
|
894
857
|
contragentId: Number(user.id),
|
|
@@ -954,6 +917,9 @@ export const useDataStore = defineStore('data', {
|
|
|
954
917
|
isIpdlCompliance: null,
|
|
955
918
|
isTerrorCompliance: null,
|
|
956
919
|
};
|
|
920
|
+
if (this.isPension && memberFromApplicaiton && memberFromApplicaiton.processInstanceId === this.formStore.applicationData.slave?.processInstanceId) {
|
|
921
|
+
data.processInstanceId = this.formStore.applicationData.slave.processInstanceId;
|
|
922
|
+
}
|
|
957
923
|
data.id = memberFromApplicaiton && memberFromApplicaiton.id ? memberFromApplicaiton.id : null;
|
|
958
924
|
if (whichMember === 'Client') {
|
|
959
925
|
data.isInsured = this.formStore.isPolicyholderInsured;
|
|
@@ -963,6 +929,12 @@ export const useDataStore = defineStore('data', {
|
|
|
963
929
|
data.jobName = member.jobPlace;
|
|
964
930
|
data.positionCode = member.positionCode;
|
|
965
931
|
data.familyStatusId = member.familyStatus.id;
|
|
932
|
+
if (this.isPension) {
|
|
933
|
+
data.id =
|
|
934
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
935
|
+
? this.formStore.applicationData.clientApp.id
|
|
936
|
+
: this.formStore.applicationData.slave.clientApp.id;
|
|
937
|
+
}
|
|
966
938
|
}
|
|
967
939
|
if (whichMember === 'Spokesman') {
|
|
968
940
|
if (!!memberFromApplicaiton && memberFromApplicaiton.iin !== data.iin) {
|
|
@@ -1021,6 +993,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1021
993
|
data.familyStatusId = member.familyStatus.id;
|
|
1022
994
|
data.relationId = member.relationDegree.ids;
|
|
1023
995
|
data.relationName = member.relationDegree.nameRu;
|
|
996
|
+
if (this.isPension) {
|
|
997
|
+
data.id =
|
|
998
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
999
|
+
? this.formStore.applicationData.insuredApp[0].id
|
|
1000
|
+
: this.formStore.applicationData.slave.insuredApp[0].id;
|
|
1001
|
+
}
|
|
1024
1002
|
}
|
|
1025
1003
|
if (whichMember === 'Beneficiary') {
|
|
1026
1004
|
if (
|
|
@@ -1065,10 +1043,20 @@ export const useDataStore = defineStore('data', {
|
|
|
1065
1043
|
}
|
|
1066
1044
|
}
|
|
1067
1045
|
},
|
|
1068
|
-
async setApplication(applicationData:
|
|
1046
|
+
async setApplication(applicationData: any, calculate: boolean = false) {
|
|
1069
1047
|
try {
|
|
1070
1048
|
this.isLoading = true;
|
|
1071
1049
|
this.isButtonsLoading = true;
|
|
1050
|
+
if (this.isPension) {
|
|
1051
|
+
applicationData.transferContractCompany = '';
|
|
1052
|
+
if (applicationData.slave) {
|
|
1053
|
+
applicationData.slave.guaranteedPeriod = applicationData.slave.guaranteedPeriod ?? 0;
|
|
1054
|
+
applicationData.slave.transferContractCompany = '';
|
|
1055
|
+
}
|
|
1056
|
+
if (Number(this.formStore.applicationData.processCode) === 24) {
|
|
1057
|
+
applicationData.transferContractAmount = applicationData.parentContractAmount - applicationData.refundAmount;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1072
1060
|
await this.api.setApplication(applicationData);
|
|
1073
1061
|
if (calculate) {
|
|
1074
1062
|
await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
|
|
@@ -1085,8 +1073,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1085
1073
|
},
|
|
1086
1074
|
getConditionsData() {
|
|
1087
1075
|
const conditionsData: {
|
|
1088
|
-
policyAppDto: PolicyAppDto;
|
|
1089
|
-
addCoversDto: AddCover[];
|
|
1076
|
+
policyAppDto: Types.PolicyAppDto;
|
|
1077
|
+
addCoversDto: Types.AddCover[];
|
|
1090
1078
|
} = {
|
|
1091
1079
|
policyAppDto: {
|
|
1092
1080
|
id: this.formStore.applicationData?.policyAppDto?.id,
|
|
@@ -1123,6 +1111,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1123
1111
|
conditionsData.policyAppDto.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1124
1112
|
conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
|
|
1125
1113
|
}
|
|
1114
|
+
if (this.isGons && !useEnv().isProduction) {
|
|
1115
|
+
conditionsData.policyAppDto.premiumInCurrency =
|
|
1116
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1117
|
+
conditionsData.policyAppDto.amountInCurrency =
|
|
1118
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1119
|
+
conditionsData.policyAppDto.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1120
|
+
conditionsData.policyAppDto.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1121
|
+
}
|
|
1126
1122
|
if (this.isLiferenta) {
|
|
1127
1123
|
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1128
1124
|
conditionsData.policyAppDto.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1214,7 +1210,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1214
1210
|
}
|
|
1215
1211
|
return this.formStore.definedAnswersId[whichSurvey];
|
|
1216
1212
|
},
|
|
1217
|
-
async setSurvey(data: AnketaFirst) {
|
|
1213
|
+
async setSurvey(data: Types.AnketaFirst) {
|
|
1218
1214
|
try {
|
|
1219
1215
|
this.isLoading = true;
|
|
1220
1216
|
const anketaToken = await this.api.setSurvey(data);
|
|
@@ -1228,7 +1224,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1228
1224
|
},
|
|
1229
1225
|
async setINSISWorkData(loading: boolean = true) {
|
|
1230
1226
|
if (!this.formStore.applicationData.insisWorkDataApp) return;
|
|
1231
|
-
const data: InsisWorkDataApp = {
|
|
1227
|
+
const data: Types.InsisWorkDataApp = {
|
|
1232
1228
|
id: this.formStore.applicationData.insisWorkDataApp.id,
|
|
1233
1229
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
1234
1230
|
agentId: Number(this.formStore.AgentData.agentId),
|
|
@@ -1658,16 +1654,16 @@ export const useDataStore = defineStore('data', {
|
|
|
1658
1654
|
column: column,
|
|
1659
1655
|
direction: direction,
|
|
1660
1656
|
groupCode: groupCode,
|
|
1661
|
-
processCodes:
|
|
1657
|
+
processCodes: this.isEFO
|
|
1658
|
+
? Object.values(constants.products).filter(
|
|
1659
|
+
i => i !== constants.products.pensionannuity && i !== constants.products.pensionannuityrefund && i !== constants.products.pensionannuityjoint,
|
|
1660
|
+
)
|
|
1661
|
+
: [constants.products.baiterek],
|
|
1662
1662
|
};
|
|
1663
1663
|
if (byOneProcess !== null) {
|
|
1664
1664
|
delete query.processCodes;
|
|
1665
1665
|
query.processCode = byOneProcess;
|
|
1666
1666
|
}
|
|
1667
|
-
if (byOneProcess === 19 && !useEnv().isProduction) {
|
|
1668
|
-
query.processCodes = [19, 2];
|
|
1669
|
-
delete query.processCode;
|
|
1670
|
-
}
|
|
1671
1667
|
const taskList = await this.api.getTaskList(
|
|
1672
1668
|
processInstanceId === null
|
|
1673
1669
|
? query
|
|
@@ -1872,7 +1868,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1872
1868
|
return;
|
|
1873
1869
|
}
|
|
1874
1870
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1875
|
-
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1871
|
+
const calculationData: Types.RecalculationDataType & Types.PolicyAppDto = {
|
|
1876
1872
|
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1877
1873
|
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1878
1874
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
@@ -1891,6 +1887,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1891
1887
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1892
1888
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1893
1889
|
}
|
|
1890
|
+
if (!useEnv().isProduction && (this.isGons || product === 'gons')) {
|
|
1891
|
+
calculationData.premiumInCurrency =
|
|
1892
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1893
|
+
calculationData.amountInCurrency =
|
|
1894
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1895
|
+
calculationData.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1896
|
+
|
|
1897
|
+
calculationData.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1898
|
+
}
|
|
1894
1899
|
if (this.isLiferenta || product === 'liferenta') {
|
|
1895
1900
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1896
1901
|
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1909,10 +1914,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1909
1914
|
calculationData.calcDate = formatDate(this.formStore.productConditionsForm.calcDate as string)!.toISOString();
|
|
1910
1915
|
}
|
|
1911
1916
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1912
|
-
if (calculationResponse.amount)
|
|
1913
|
-
|
|
1917
|
+
if (calculationResponse.amount)
|
|
1918
|
+
this.formStore.productConditionsForm.requestedSumInsured =
|
|
1919
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.amount) : this.getNumberWithSpaces(calculationResponse.amount);
|
|
1920
|
+
if (calculationResponse.premium)
|
|
1921
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
1922
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.premium) : this.getNumberWithSpaces(calculationResponse.premium);
|
|
1923
|
+
|
|
1914
1924
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1915
|
-
if (this.isKazyna || product === 'halykkazyna') {
|
|
1925
|
+
if (this.isKazyna || product === 'halykkazyna' || ((this.isGons || product === 'gons') && !useEnv().isProduction)) {
|
|
1916
1926
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1917
1927
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
|
|
1918
1928
|
} else {
|
|
@@ -1953,13 +1963,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1953
1963
|
this.isLoading = true;
|
|
1954
1964
|
try {
|
|
1955
1965
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1956
|
-
if (!this.isPension) await this.api.setApplication(this.getConditionsData());
|
|
1966
|
+
if (!this.isPension && !(this.formStore.lfb.add && (this.isLifeBusiness || this.isGns))) await this.api.setApplication(this.getConditionsData());
|
|
1957
1967
|
const result = ref();
|
|
1958
1968
|
result.value = await this.api.getCalculation(String(id));
|
|
1959
1969
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
1960
1970
|
this.formStore.applicationData = applicationData;
|
|
1961
1971
|
if (this.formStore.applicationData.addCoverDto) this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1962
|
-
if (this.isKazyna && this.currencies.usd) {
|
|
1972
|
+
if ((this.isKazyna || this.isGons) && this.currencies.usd) {
|
|
1963
1973
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1964
1974
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
|
|
1965
1975
|
} else {
|
|
@@ -1967,11 +1977,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1967
1977
|
}
|
|
1968
1978
|
}
|
|
1969
1979
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
|
|
1970
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
1971
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
1980
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
1981
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
1982
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium)
|
|
1983
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium);
|
|
1972
1984
|
} else {
|
|
1973
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1974
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.
|
|
1985
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
1986
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
1987
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount)
|
|
1988
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount);
|
|
1975
1989
|
}
|
|
1976
1990
|
if (this.isLiferenta) {
|
|
1977
1991
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
@@ -1989,6 +2003,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1989
2003
|
const res = await this.newInsuredList(applicationData.insuredApp);
|
|
1990
2004
|
this.formStore.lfb.clients = res;
|
|
1991
2005
|
}
|
|
2006
|
+
if (this.formStore.lfb.add) {
|
|
2007
|
+
if (result.value > 0) {
|
|
2008
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
2009
|
+
this.formStore.productConditionsForm.requestedSumInsured = null;
|
|
2010
|
+
} else {
|
|
2011
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
2012
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = null;
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
1992
2015
|
}
|
|
1993
2016
|
|
|
1994
2017
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
@@ -1997,6 +2020,38 @@ export const useDataStore = defineStore('data', {
|
|
|
1997
2020
|
}
|
|
1998
2021
|
this.isLoading = false;
|
|
1999
2022
|
},
|
|
2023
|
+
async reCalculateRefund(insSum: number, insSumMain: number, guaranteedPeriod: number, isOppv: boolean, transferContractMonthCount: number | null) {
|
|
2024
|
+
this.isLoading = true;
|
|
2025
|
+
try {
|
|
2026
|
+
const data = {
|
|
2027
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2028
|
+
insSum: insSum,
|
|
2029
|
+
insSumMain: insSumMain,
|
|
2030
|
+
guaranteedPeriod: guaranteedPeriod,
|
|
2031
|
+
isOppv: isOppv,
|
|
2032
|
+
transferContractMonthCount: transferContractMonthCount,
|
|
2033
|
+
};
|
|
2034
|
+
const response = await this.api.pensionannuityNew.reCalculateRefund(data);
|
|
2035
|
+
} catch (err) {
|
|
2036
|
+
ErrorHandler(err);
|
|
2037
|
+
}
|
|
2038
|
+
this.isLoading = false;
|
|
2039
|
+
},
|
|
2040
|
+
async calcParentContractSums(closeContractCompanyCode: string, closeContractCompanyName: string, isContractClosed: boolean) {
|
|
2041
|
+
this.isLoading = true;
|
|
2042
|
+
try {
|
|
2043
|
+
const data = {
|
|
2044
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2045
|
+
closeContractCompanyCode: closeContractCompanyCode,
|
|
2046
|
+
closeContractCompanyName: closeContractCompanyName,
|
|
2047
|
+
isContractClosed: isContractClosed,
|
|
2048
|
+
};
|
|
2049
|
+
const response = await this.api.pensionannuityNew.calcParentContractSums(data);
|
|
2050
|
+
} catch (err) {
|
|
2051
|
+
ErrorHandler(err);
|
|
2052
|
+
}
|
|
2053
|
+
this.isLoading = false;
|
|
2054
|
+
},
|
|
2000
2055
|
async calculatePremium(data: any) {
|
|
2001
2056
|
this.isLoading = true;
|
|
2002
2057
|
try {
|
|
@@ -2018,7 +2073,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2018
2073
|
async calculatePrice(taskId?: string) {
|
|
2019
2074
|
this.isLoading = true;
|
|
2020
2075
|
try {
|
|
2021
|
-
const priceForm: SetApplicationRequest = {};
|
|
2076
|
+
const priceForm: Types.SetApplicationRequest = {};
|
|
2022
2077
|
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
2023
2078
|
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
2024
2079
|
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
@@ -2065,7 +2120,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2065
2120
|
async startApplication(member: Member, processCode?: number) {
|
|
2066
2121
|
if (!member.iin) return false;
|
|
2067
2122
|
try {
|
|
2068
|
-
const data: StartApplicationType = {
|
|
2123
|
+
const data: Types.StartApplicationType = {
|
|
2069
2124
|
clientId: member.id,
|
|
2070
2125
|
iin: member.iin.replace(/-/g, ''),
|
|
2071
2126
|
longName: member.longName ?? '',
|
|
@@ -2083,11 +2138,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2083
2138
|
this.isLoading = onlyGet;
|
|
2084
2139
|
try {
|
|
2085
2140
|
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
2141
|
this.formStore.regNumber = applicationData.regNumber;
|
|
2092
2142
|
this.formStore.applicationData = applicationData;
|
|
2093
2143
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
@@ -2105,6 +2155,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2105
2155
|
|
|
2106
2156
|
const clientData = applicationData.clientApp;
|
|
2107
2157
|
const insuredData: any[] = applicationData.insuredApp;
|
|
2158
|
+
const slaveInsuredData: any = applicationData.slave?.insuredApp[0] ?? null;
|
|
2108
2159
|
const beneficiaryData: any[] = applicationData.beneficiaryApp;
|
|
2109
2160
|
const beneficialOwnerData: any[] = applicationData.beneficialOwnerApp;
|
|
2110
2161
|
const spokesmanData: any = applicationData.spokesmanApp;
|
|
@@ -2118,6 +2169,21 @@ export const useDataStore = defineStore('data', {
|
|
|
2118
2169
|
this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
|
|
2119
2170
|
}
|
|
2120
2171
|
|
|
2172
|
+
if ('pensionApp' in applicationData && applicationData.pensionApp) {
|
|
2173
|
+
this.formStore.pensionApp = applicationData.pensionApp;
|
|
2174
|
+
if ('slave' in applicationData && applicationData.slave) this.formStore.pensionApp.slave = applicationData.slave.pensionApp;
|
|
2175
|
+
if (setProductConditions) {
|
|
2176
|
+
const pensionKeysWithSpace = ['compulsoryContractAmount', 'compulsoryProfContractAmount', 'voluntaryContractAmount', 'ownFundsRaisAmount'];
|
|
2177
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2178
|
+
if (/\s/g.test(this.formStore.pensionApp[key]) === false) this.formStore.pensionApp[key] = this.getNumberWithSpaces(this.formStore.pensionApp[key]);
|
|
2179
|
+
});
|
|
2180
|
+
if (this.formStore.pensionApp.slave)
|
|
2181
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2182
|
+
if (/\s/g.test(this.formStore.pensionApp.slave[key]) === false)
|
|
2183
|
+
this.formStore.pensionApp.slave[key] = this.getNumberWithSpaces(this.formStore.pensionApp.slave[key]);
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2121
2187
|
if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
|
|
2122
2188
|
this.formStore.finCenterData = applicationData.finCenterData;
|
|
2123
2189
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
@@ -2182,11 +2248,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2182
2248
|
index: null,
|
|
2183
2249
|
});
|
|
2184
2250
|
}
|
|
2185
|
-
|
|
2186
|
-
if (applicationData.slave) {
|
|
2187
|
-
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
2251
|
if (insuredData && insuredData.length) {
|
|
2191
2252
|
insuredData.forEach((member, index) => {
|
|
2192
2253
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -2200,6 +2261,13 @@ export const useDataStore = defineStore('data', {
|
|
|
2200
2261
|
}
|
|
2201
2262
|
});
|
|
2202
2263
|
}
|
|
2264
|
+
if (slaveInsuredData) {
|
|
2265
|
+
allMembers.push({
|
|
2266
|
+
...slaveInsuredData,
|
|
2267
|
+
key: 'slaveInsuredForm',
|
|
2268
|
+
index: null,
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2203
2271
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2204
2272
|
beneficiaryData.forEach((member, index) => {
|
|
2205
2273
|
const inStore = this.formStore.beneficiaryForm.find(each => each.id == member.insisId);
|
|
@@ -2237,12 +2305,14 @@ export const useDataStore = defineStore('data', {
|
|
|
2237
2305
|
this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
|
|
2238
2306
|
if (insuredData && insuredData.length) {
|
|
2239
2307
|
insuredData.forEach((each, index) => {
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2308
|
+
if (each) {
|
|
2309
|
+
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
2310
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
2311
|
+
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
2312
|
+
}
|
|
2243
2313
|
});
|
|
2244
2314
|
}
|
|
2245
|
-
|
|
2315
|
+
if (slaveInsuredData) this.setMembersFieldSlave();
|
|
2246
2316
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2247
2317
|
beneficiaryData.forEach((each, index) => {
|
|
2248
2318
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
@@ -2320,16 +2390,29 @@ export const useDataStore = defineStore('data', {
|
|
|
2320
2390
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
2321
2391
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
2322
2392
|
|
|
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
|
-
|
|
2393
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2394
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount)
|
|
2395
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount);
|
|
2396
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
2397
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium)
|
|
2398
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium);
|
|
2399
|
+
|
|
2400
|
+
if (this.isGons) {
|
|
2401
|
+
const govPremiums = await this.api.getGovernmentPremiums(String(this.formStore.applicationData.processInstanceId));
|
|
2402
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
|
|
2403
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
|
|
2404
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
|
|
2405
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
if (this.isKazyna || this.isGons) {
|
|
2330
2409
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
|
|
2331
2410
|
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
|
|
2332
2411
|
}
|
|
2412
|
+
if (this.isGons && !useEnv().isProduction) {
|
|
2413
|
+
const currency = constants.currencyList.find(item => item.code === applicationData.policyAppDto.currency);
|
|
2414
|
+
this.formStore.productConditionsForm.currency = currency ? currency : new Value();
|
|
2415
|
+
}
|
|
2333
2416
|
const riskGroup = this.riskGroup.find(item => {
|
|
2334
2417
|
if (applicationData.policyAppDto.riskGroup == 0) {
|
|
2335
2418
|
return true;
|
|
@@ -2356,7 +2439,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2356
2439
|
async deleteTask(taskId: string) {
|
|
2357
2440
|
this.isLoading = true;
|
|
2358
2441
|
try {
|
|
2359
|
-
const data: SendTask = {
|
|
2442
|
+
const data: Types.SendTask = {
|
|
2360
2443
|
taskId: taskId,
|
|
2361
2444
|
decision: 'rejectclient',
|
|
2362
2445
|
comment: 'Клиент отказался',
|
|
@@ -2462,9 +2545,11 @@ export const useDataStore = defineStore('data', {
|
|
|
2462
2545
|
}
|
|
2463
2546
|
},
|
|
2464
2547
|
async createInvoice() {
|
|
2465
|
-
|
|
2548
|
+
const premium =
|
|
2549
|
+
this.isLifeBusiness || this.isGns ? this.formStore.applicationData.policyAppDto?.mainPremiumWithCommission : this.formStore.applicationData.policyAppDto?.premium;
|
|
2550
|
+
if (!premium) return;
|
|
2466
2551
|
try {
|
|
2467
|
-
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId,
|
|
2552
|
+
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId, premium);
|
|
2468
2553
|
return !!created;
|
|
2469
2554
|
} catch (err) {
|
|
2470
2555
|
this.isLoading = false;
|
|
@@ -2480,7 +2565,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2480
2565
|
console.log(err);
|
|
2481
2566
|
}
|
|
2482
2567
|
},
|
|
2483
|
-
setMembersField(whichForm: SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2568
|
+
setMembersField(whichForm: Types.SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2484
2569
|
this.formStore[whichForm].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember].familyStatusId);
|
|
2485
2570
|
this.formStore[whichForm].signOfIPDL = this.findObject(
|
|
2486
2571
|
'ipdl',
|
|
@@ -2497,17 +2582,46 @@ export const useDataStore = defineStore('data', {
|
|
|
2497
2582
|
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
|
|
2498
2583
|
this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2499
2584
|
}
|
|
2500
|
-
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.
|
|
2501
|
-
this.formStore[whichForm].bankInfo.iik = this.formStore.
|
|
2502
|
-
this.formStore[whichForm].bankInfo.bik = this.formStore.
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
this.formStore[whichForm].bankInfo.
|
|
2506
|
-
this.
|
|
2507
|
-
this.formStore.
|
|
2585
|
+
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.pensionApp) {
|
|
2586
|
+
this.formStore[whichForm].bankInfo.iik = this.formStore.pensionApp.account;
|
|
2587
|
+
this.formStore[whichForm].bankInfo.bik = this.formStore.pensionApp.bankBik;
|
|
2588
|
+
this.formStore[whichForm].bankInfo.bankName.id = this.formStore.pensionApp.bankId;
|
|
2589
|
+
this.formStore[whichForm].bankInfo.bankName.nameRu = this.formStore.pensionApp.bankName;
|
|
2590
|
+
this.formStore[whichForm].bankInfo.bin = reformatIin(this.formStore.pensionApp.bankBin);
|
|
2591
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.transferContractCompany);
|
|
2592
|
+
this.formStore.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2508
2593
|
}
|
|
2509
2594
|
},
|
|
2510
|
-
|
|
2595
|
+
setMembersFieldSlave() {
|
|
2596
|
+
this.formStore.slaveInsuredForm.familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData.slave['insuredApp'].familyStatusId);
|
|
2597
|
+
this.formStore.slaveInsuredForm.signOfIPDL = this.findObject(
|
|
2598
|
+
'ipdl',
|
|
2599
|
+
'nameRu',
|
|
2600
|
+
this.formStore.applicationData.slave.insuredApp[0].isIpdl === null ? null : this.formStore.applicationData.slave.insuredApp[0].isIpdl == true ? 'Да' : 'Нет',
|
|
2601
|
+
);
|
|
2602
|
+
this.formStore.slaveInsuredForm.gotFromInsis = false;
|
|
2603
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].profession) this.formStore.slaveInsuredForm.job = this.formStore.applicationData.slave.insuredApp[0].profession;
|
|
2604
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].position) this.formStore.slaveInsuredForm.jobPosition = this.formStore.applicationData.slave.insuredApp[0].position;
|
|
2605
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].jobName) this.formStore.slaveInsuredForm.jobPlace = this.formStore.applicationData.slave.insuredApp[0].jobName;
|
|
2606
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].positionCode)
|
|
2607
|
+
this.formStore.slaveInsuredForm.positionCode = this.formStore.applicationData.slave.insuredApp[0].positionCode;
|
|
2608
|
+
if (typeof this.formStore.applicationData.slave.insuredApp[0].isDisability === 'boolean')
|
|
2609
|
+
this.formStore.slaveInsuredForm.isDisability = this.formStore.applicationData.slave.insuredApp[0].isDisability;
|
|
2610
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId) {
|
|
2611
|
+
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId);
|
|
2612
|
+
this.formStore.slaveInsuredForm.disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2613
|
+
}
|
|
2614
|
+
if (this.formStore.slaveInsuredForm.bankInfo) {
|
|
2615
|
+
this.formStore.slaveInsuredForm.bankInfo.iik = this.formStore.pensionApp.slave.account;
|
|
2616
|
+
this.formStore.slaveInsuredForm.bankInfo.bik = this.formStore.pensionApp.slave.bankBik;
|
|
2617
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.id = this.formStore.pensionApp.slave.bankId;
|
|
2618
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.nameRu = this.formStore.pensionApp.slave.bankName;
|
|
2619
|
+
this.formStore.slaveInsuredForm.bankInfo.bin = reformatIin(this.formStore.pensionApp.slave.bankBin);
|
|
2620
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.slave.transferContractCompany);
|
|
2621
|
+
this.formStore.pensionApp.slave.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2622
|
+
}
|
|
2623
|
+
},
|
|
2624
|
+
setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
2511
2625
|
if ('familyStatus' in this.formStore[whichForm][index]) {
|
|
2512
2626
|
this.formStore[whichForm][index].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember][index].familyStatusId);
|
|
2513
2627
|
}
|
|
@@ -2543,7 +2657,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2543
2657
|
if (this.formStore.signUrls.length) {
|
|
2544
2658
|
return this.formStore.signUrls;
|
|
2545
2659
|
}
|
|
2546
|
-
const prepareSignDocuments = (): SignDataType[] => {
|
|
2660
|
+
const prepareSignDocuments = (): Types.SignDataType[] => {
|
|
2547
2661
|
switch (this.formStore.applicationData.statusCode) {
|
|
2548
2662
|
case 'ContractSignedFrom':
|
|
2549
2663
|
return [
|
|
@@ -2601,94 +2715,17 @@ export const useDataStore = defineStore('data', {
|
|
|
2601
2715
|
};
|
|
2602
2716
|
const data = prepareSignDocuments();
|
|
2603
2717
|
if (type === 'qr') {
|
|
2604
|
-
const groupId = await this.api.signQR(data);
|
|
2718
|
+
const groupId = await this.api.file.signQR(data);
|
|
2605
2719
|
return groupId;
|
|
2606
2720
|
} else if (type === 'qrXml') {
|
|
2607
|
-
const signData = await this.api.signXml(data);
|
|
2721
|
+
const signData = await this.api.file.signXml(data);
|
|
2608
2722
|
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
2723
|
} else {
|
|
2687
|
-
if (this.processCode === 19 || this.processCode ===
|
|
2688
|
-
const result = await this.api.signBts(data);
|
|
2724
|
+
if (this.processCode === 19 || this.processCode === 24 || this.processCode === 25) {
|
|
2725
|
+
const result = await this.api.file.signBts(data);
|
|
2689
2726
|
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2690
2727
|
} else {
|
|
2691
|
-
const result = await this.api.signDocument(data);
|
|
2728
|
+
const result = await this.api.file.signDocument(data);
|
|
2692
2729
|
this.formStore.signUrls = result;
|
|
2693
2730
|
}
|
|
2694
2731
|
return this.formStore.signUrls;
|
|
@@ -2697,6 +2734,84 @@ export const useDataStore = defineStore('data', {
|
|
|
2697
2734
|
ErrorHandler(err);
|
|
2698
2735
|
}
|
|
2699
2736
|
},
|
|
2737
|
+
async nclayerSign(groupId: string, signType: number, isXml: boolean = false, processInstanceId?: string) {
|
|
2738
|
+
try {
|
|
2739
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2740
|
+
await ncaLayerClient.connect();
|
|
2741
|
+
const activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2742
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2743
|
+
const document = await this.getFileNew(groupId, signType, isXml);
|
|
2744
|
+
if (isXml) {
|
|
2745
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, document, 'SIGNATURE', '');
|
|
2746
|
+
const data = new FormData();
|
|
2747
|
+
data.append('processInstanceId', processInstanceId ?? String(this.formStore.applicationData.processInstanceId));
|
|
2748
|
+
data.append('xmlData', signedAgreement);
|
|
2749
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2750
|
+
data.append('format', 'xml');
|
|
2751
|
+
data.append('EdsXmlId', groupId);
|
|
2752
|
+
await this.api.file.uploadXml(data);
|
|
2753
|
+
} else {
|
|
2754
|
+
const base64EncodedSignature = await ncaLayerClient.createCAdESFromBase64(storageType, document, 'SIGNATURE', true);
|
|
2755
|
+
await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
|
|
2756
|
+
}
|
|
2757
|
+
return true;
|
|
2758
|
+
} catch (err: any) {
|
|
2759
|
+
return err.name === 'NCALayerError' ? null : ErrorHandler(err);
|
|
2760
|
+
}
|
|
2761
|
+
},
|
|
2762
|
+
async getFileNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
|
|
2763
|
+
try {
|
|
2764
|
+
let response: any = await this.api.file.generalGetFile(groupId, xml ? 5 : documentSignType);
|
|
2765
|
+
let blob;
|
|
2766
|
+
if (response.hasOwnProperty('data')) {
|
|
2767
|
+
const document = JSON.parse(response.data).Document;
|
|
2768
|
+
blob = new Blob([document.documentXml], {
|
|
2769
|
+
type: `application/xml`,
|
|
2770
|
+
});
|
|
2771
|
+
response = document.documentXml;
|
|
2772
|
+
} else {
|
|
2773
|
+
blob = new Blob([response], {
|
|
2774
|
+
type: `application/pdf`,
|
|
2775
|
+
});
|
|
2776
|
+
}
|
|
2777
|
+
const url = window.URL.createObjectURL(blob);
|
|
2778
|
+
if (!xml) {
|
|
2779
|
+
const link = document.createElement('a');
|
|
2780
|
+
link.href = url;
|
|
2781
|
+
link.setAttribute('download', fileName ?? `Документ ПА`);
|
|
2782
|
+
document.body.appendChild(link);
|
|
2783
|
+
link.click();
|
|
2784
|
+
}
|
|
2785
|
+
window.open(url, '_blank', `right=100`);
|
|
2786
|
+
return response;
|
|
2787
|
+
} catch (err) {
|
|
2788
|
+
ErrorHandler(err);
|
|
2789
|
+
}
|
|
2790
|
+
},
|
|
2791
|
+
async generateSign(taskId: string) {
|
|
2792
|
+
try {
|
|
2793
|
+
const signatories = await this.api.file.generateSign({ taskId });
|
|
2794
|
+
if (Array.isArray(signatories)) {
|
|
2795
|
+
signatories.forEach(signatory =>
|
|
2796
|
+
signatory.fileDatas?.sort(function (a: any, b: any) {
|
|
2797
|
+
return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
|
|
2798
|
+
}),
|
|
2799
|
+
);
|
|
2800
|
+
this.formStore.signatories = signatories;
|
|
2801
|
+
}
|
|
2802
|
+
} catch (err) {
|
|
2803
|
+
ErrorHandler(err);
|
|
2804
|
+
this.formStore.signatories = [];
|
|
2805
|
+
}
|
|
2806
|
+
},
|
|
2807
|
+
async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
|
|
2808
|
+
try {
|
|
2809
|
+
const response = await this.api.file.generalSign(data);
|
|
2810
|
+
return response;
|
|
2811
|
+
} catch (err) {
|
|
2812
|
+
ErrorHandler(err);
|
|
2813
|
+
}
|
|
2814
|
+
},
|
|
2700
2815
|
async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
|
|
2701
2816
|
try {
|
|
2702
2817
|
this.isButtonsLoading = true;
|
|
@@ -2758,12 +2873,12 @@ export const useDataStore = defineStore('data', {
|
|
|
2758
2873
|
try {
|
|
2759
2874
|
this.isButtonsLoading = true;
|
|
2760
2875
|
this.formStore.needToScanSignedContract = true;
|
|
2761
|
-
const data: SignDataType = {
|
|
2876
|
+
const data: Types.SignDataType = {
|
|
2762
2877
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2763
2878
|
name: 'Contract',
|
|
2764
2879
|
format: 'pdf',
|
|
2765
2880
|
};
|
|
2766
|
-
const response: any = await this.api.generateDocument(data);
|
|
2881
|
+
const response: any = await this.api.file.generateDocument(data);
|
|
2767
2882
|
const blob = new Blob([response], {
|
|
2768
2883
|
type: `application/pdf`,
|
|
2769
2884
|
});
|
|
@@ -2814,7 +2929,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2814
2929
|
const formattedData = formatDate(this.formStore.finCenterData.date);
|
|
2815
2930
|
if (!formattedData) return;
|
|
2816
2931
|
this.isLoading = true;
|
|
2817
|
-
const data: RegNumberDataType = {
|
|
2932
|
+
const data: Types.RegNumberDataType = {
|
|
2818
2933
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2819
2934
|
regNumber: String(this.formStore.finCenterData.regNumber),
|
|
2820
2935
|
date: formattedData.toISOString(),
|
|
@@ -2829,7 +2944,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2829
2944
|
},
|
|
2830
2945
|
async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
|
|
2831
2946
|
if (!type || !phoneNumber || !text) return;
|
|
2832
|
-
const smsData: SmsDataType = {
|
|
2947
|
+
const smsData: Types.SmsDataType = {
|
|
2833
2948
|
iin: this.formStore.applicationData.clientApp.iin,
|
|
2834
2949
|
phoneNumber: formatPhone(phoneNumber),
|
|
2835
2950
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
@@ -2846,16 +2961,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2846
2961
|
this.isLoading = false;
|
|
2847
2962
|
}
|
|
2848
2963
|
},
|
|
2849
|
-
sanitize(text: string) {
|
|
2850
|
-
return text
|
|
2851
|
-
.replace(/\r?\n|\r/g, '')
|
|
2852
|
-
.replace(/\\/g, '')
|
|
2853
|
-
.replace(/"/g, '');
|
|
2854
|
-
},
|
|
2855
2964
|
async getSignedDocList(processInstanceId: string | number) {
|
|
2856
2965
|
if (processInstanceId !== 0) {
|
|
2857
2966
|
try {
|
|
2858
|
-
this.formStore.signedDocumentList = await this.api.getSignedDocList({
|
|
2967
|
+
this.formStore.signedDocumentList = await this.api.file.getSignedDocList({
|
|
2859
2968
|
processInstanceId: processInstanceId,
|
|
2860
2969
|
});
|
|
2861
2970
|
} catch (err) {
|
|
@@ -2895,7 +3004,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2895
3004
|
}
|
|
2896
3005
|
this.isLoading = false;
|
|
2897
3006
|
},
|
|
2898
|
-
async getValidateClientESBD(data: ESBDValidationType) {
|
|
3007
|
+
async getValidateClientESBD(data: Types.ESBDValidationType) {
|
|
2899
3008
|
try {
|
|
2900
3009
|
return await this.api.getValidateClientESBD(data);
|
|
2901
3010
|
} catch (err) {
|
|
@@ -2903,7 +3012,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2903
3012
|
return ErrorHandler(err);
|
|
2904
3013
|
}
|
|
2905
3014
|
},
|
|
2906
|
-
validateMultipleMembers(localKey: MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
3015
|
+
validateMultipleMembers(localKey: Types.MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2907
3016
|
if (this.formStore[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
2908
3017
|
if (this.formStore[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
2909
3018
|
const localMembers = [...this.formStore[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
@@ -2922,6 +3031,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2922
3031
|
}
|
|
2923
3032
|
}
|
|
2924
3033
|
}
|
|
3034
|
+
} else if (applicationKey === 'slave') {
|
|
3035
|
+
if (this.formStore.slaveInsuredForm && this.formStore.applicationData.slave) {
|
|
3036
|
+
const localSlave = this.formStore.slaveInsuredForm;
|
|
3037
|
+
const applicationSlave = this.formStore.applicationData.slave.insuredApp[0];
|
|
3038
|
+
if ((localSlave.id === applicationSlave.insisId && applicationSlave.iin === localSlave.iin?.replace(/-/g, '')) === false) {
|
|
3039
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3040
|
+
return false;
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
2925
3043
|
} else {
|
|
2926
3044
|
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2927
3045
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
@@ -2940,6 +3058,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2940
3058
|
return true;
|
|
2941
3059
|
},
|
|
2942
3060
|
async validateAllMembers(taskId: string, localCheck: boolean = false) {
|
|
3061
|
+
const policyholderDoc = this.formStore.signedDocumentList.find(
|
|
3062
|
+
i => i.iin === String(this.formStore.policyholderForm.iin).replaceAll('-', '') && (i.fileTypeCode === '1' || i.fileTypeCode === '2' || i.fileTypeCode === '4'),
|
|
3063
|
+
);
|
|
2943
3064
|
if (taskId === '0') {
|
|
2944
3065
|
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
2945
3066
|
return false;
|
|
@@ -2948,6 +3069,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2948
3069
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
2949
3070
|
return false;
|
|
2950
3071
|
}
|
|
3072
|
+
if (useEnv().isProduction && this.isInitiator() && this.isEfoParent && this.formStore.policyholderForm.iin && !policyholderDoc) {
|
|
3073
|
+
this.showToaster('error', this.t('toaster.needDigDoc', { text: 'страхователя' }));
|
|
3074
|
+
return false;
|
|
3075
|
+
}
|
|
2951
3076
|
if (this.members.insuredApp.has) {
|
|
2952
3077
|
if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
|
|
2953
3078
|
return false;
|
|
@@ -2960,6 +3085,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2960
3085
|
}
|
|
2961
3086
|
}
|
|
2962
3087
|
}
|
|
3088
|
+
if (this.formStore.applicationData.slave && this.validateMultipleMembers(this.formStore.insuredFormKey, 'slave', 'застрахованных') === false) {
|
|
3089
|
+
return false;
|
|
3090
|
+
}
|
|
2963
3091
|
if (this.members.beneficiaryApp.has) {
|
|
2964
3092
|
if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
|
|
2965
3093
|
return false;
|
|
@@ -3076,7 +3204,12 @@ export const useDataStore = defineStore('data', {
|
|
|
3076
3204
|
this.isLoading = true;
|
|
3077
3205
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
3078
3206
|
if (areMembersValid) {
|
|
3079
|
-
if (
|
|
3207
|
+
if (
|
|
3208
|
+
(!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) ||
|
|
3209
|
+
(this.isPension &&
|
|
3210
|
+
this.formStore.applicationData.pensionApp.isCalculated === true &&
|
|
3211
|
+
(this.formStore.applicationData.pensionApp.slave ? this.formStore.applicationData.pensionApp.slave.isCalculated === true : true))
|
|
3212
|
+
) {
|
|
3080
3213
|
if (this.controls.hasAnketa) {
|
|
3081
3214
|
const hasCritical =
|
|
3082
3215
|
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
@@ -3243,13 +3376,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3243
3376
|
if (!this.accessToken) return null;
|
|
3244
3377
|
try {
|
|
3245
3378
|
const decoded = jwtDecode(this.accessToken);
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3379
|
+
if (decoded) {
|
|
3380
|
+
const data = {
|
|
3381
|
+
userName: decoded.code,
|
|
3382
|
+
branchName: decoded.branchCode,
|
|
3383
|
+
bin: bin.replace(/-/g, ''),
|
|
3384
|
+
};
|
|
3385
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3386
|
+
return gbdulResponse;
|
|
3387
|
+
}
|
|
3388
|
+
return null;
|
|
3253
3389
|
} catch (err) {
|
|
3254
3390
|
return ErrorHandler(err);
|
|
3255
3391
|
}
|
|
@@ -3299,7 +3435,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3299
3435
|
this.isLoading = false;
|
|
3300
3436
|
return false;
|
|
3301
3437
|
}
|
|
3302
|
-
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Api.GBD.Person };
|
|
3438
|
+
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Types.Api.GBD.Person };
|
|
3303
3439
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
3304
3440
|
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
3305
3441
|
member.resetMember(false);
|
|
@@ -3316,7 +3452,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3316
3452
|
this.isLoading = false;
|
|
3317
3453
|
}
|
|
3318
3454
|
},
|
|
3319
|
-
async saveInStoreUserGBDFL(person: Api.GBD.Person, member: Member) {
|
|
3455
|
+
async saveInStoreUserGBDFL(person: Types.Api.GBD.Person, member: Member) {
|
|
3320
3456
|
member.firstName = person.name;
|
|
3321
3457
|
member.lastName = person.surname;
|
|
3322
3458
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
@@ -3331,69 +3467,72 @@ export const useDataStore = defineStore('data', {
|
|
|
3331
3467
|
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
3332
3468
|
if (gender) member.gender = gender;
|
|
3333
3469
|
|
|
3334
|
-
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
3470
|
+
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu ?? 'undefined', 'i')));
|
|
3335
3471
|
if (birthPlace) member.birthPlace = birthPlace;
|
|
3336
3472
|
|
|
3337
|
-
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
3473
|
+
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu ?? 'undefined', 'i')));
|
|
3338
3474
|
if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
|
|
3339
3475
|
|
|
3340
|
-
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu, 'i')));
|
|
3476
|
+
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu ?? 'undefined', 'i')));
|
|
3341
3477
|
if (regCountry) member.registrationCountry = regCountry;
|
|
3342
3478
|
|
|
3343
|
-
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
3479
|
+
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')));
|
|
3344
3480
|
if (regProvince) member.registrationProvince = regProvince;
|
|
3481
|
+
else member.registrationProvince = new Value();
|
|
3345
3482
|
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3483
|
+
let hasSetCity = false;
|
|
3484
|
+
let hasSetRegion = false;
|
|
3485
|
+
if (person.regAddress.city && String(person.regAddress.city).includes(', ')) {
|
|
3486
|
+
const personCities = String(person.regAddress.city).split(', ');
|
|
3487
|
+
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3488
|
+
const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
|
|
3489
|
+
if (possibleCity) {
|
|
3490
|
+
member.registrationCity = possibleCity;
|
|
3491
|
+
hasSetCity = true;
|
|
3492
|
+
break;
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3495
|
+
if (member.registrationCity.nameRu === null) {
|
|
3349
3496
|
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3350
|
-
const
|
|
3351
|
-
if (
|
|
3352
|
-
member.
|
|
3497
|
+
const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
|
|
3498
|
+
if (possibleRegion) {
|
|
3499
|
+
member.registrationRegion = possibleRegion;
|
|
3500
|
+
hasSetRegion = true;
|
|
3353
3501
|
break;
|
|
3354
3502
|
}
|
|
3355
3503
|
}
|
|
3356
|
-
if (member.registrationCity.nameRu === null) {
|
|
3357
|
-
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3358
|
-
const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
|
|
3359
|
-
if (possibleRegion) {
|
|
3360
|
-
member.registrationRegion = possibleRegion;
|
|
3361
|
-
break;
|
|
3362
|
-
}
|
|
3363
|
-
}
|
|
3364
|
-
}
|
|
3365
|
-
} else {
|
|
3366
|
-
const regCity = this.cities.find(i => String(i.nameRu).match(new RegExp(person.regAddress.city, 'i')));
|
|
3367
|
-
if (regCity) member.registrationCity = regCity;
|
|
3368
|
-
|
|
3369
|
-
if (member.registrationCity.nameRu === null) {
|
|
3370
|
-
const regRegion = this.regions.find(i => String(i.nameRu).match(new RegExp(person.regAddress.city, 'i')));
|
|
3371
|
-
if (regRegion) member.registrationRegion = regRegion;
|
|
3372
|
-
}
|
|
3373
3504
|
}
|
|
3374
3505
|
}
|
|
3375
3506
|
|
|
3376
|
-
if (
|
|
3507
|
+
if (hasSetCity === false) {
|
|
3377
3508
|
const regCity = this.cities.find(
|
|
3378
|
-
i =>
|
|
3509
|
+
i =>
|
|
3510
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3511
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3512
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3379
3513
|
);
|
|
3380
3514
|
if (regCity) {
|
|
3381
3515
|
member.registrationCity = regCity;
|
|
3382
3516
|
const regType = this.localityTypes.find(i => String(i.nameRu) === 'город');
|
|
3383
3517
|
if (regType) member.registrationRegionType = regType;
|
|
3384
|
-
} else
|
|
3385
|
-
const regRegion = this.regions.find(
|
|
3386
|
-
i => String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu, 'i')) || String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
3387
|
-
);
|
|
3388
|
-
if (regRegion) {
|
|
3389
|
-
member.registrationRegion = regRegion;
|
|
3390
|
-
const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
|
|
3391
|
-
if (regType) member.registrationRegionType = regType;
|
|
3392
|
-
}
|
|
3393
|
-
}
|
|
3518
|
+
} else member.registrationCity = new Value();
|
|
3394
3519
|
}
|
|
3395
3520
|
|
|
3396
|
-
if (
|
|
3521
|
+
if (hasSetRegion === false) {
|
|
3522
|
+
const regRegion = this.regions.find(
|
|
3523
|
+
i =>
|
|
3524
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3525
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3526
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3527
|
+
);
|
|
3528
|
+
if (regRegion) {
|
|
3529
|
+
member.registrationRegion = regRegion;
|
|
3530
|
+
const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
|
|
3531
|
+
if (regType) member.registrationRegionType = regType;
|
|
3532
|
+
} else member.registrationRegion = new Value();
|
|
3533
|
+
}
|
|
3534
|
+
|
|
3535
|
+
if (person.regAddress.street && person.regAddress.street.includes(', ')) {
|
|
3397
3536
|
const personAddress = person.regAddress.street.split(', ');
|
|
3398
3537
|
const microDistrict = personAddress.find((i: string) => i.match(new RegExp('микрорайон', 'i')));
|
|
3399
3538
|
const quarter = personAddress.find((i: string) => i.match(new RegExp('квартал', 'i')));
|
|
@@ -3408,14 +3547,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3408
3547
|
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
3409
3548
|
|
|
3410
3549
|
if (Array.isArray(person.documents.document)) {
|
|
3411
|
-
const
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
(i
|
|
3416
|
-
|
|
3550
|
+
const filteredDocuments = person.documents.document.filter(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00');
|
|
3551
|
+
const validDocument = this.isLifetrip
|
|
3552
|
+
? filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3553
|
+
: filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes['1UDL']) ??
|
|
3554
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.VNZ) ??
|
|
3555
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS);
|
|
3417
3556
|
if (validDocument) {
|
|
3418
|
-
const documentType = this.documentTypes.find(
|
|
3557
|
+
const documentType = this.documentTypes.find(
|
|
3558
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(validDocument.type.code)],
|
|
3559
|
+
);
|
|
3419
3560
|
if (documentType) member.documentType = documentType;
|
|
3420
3561
|
if (validDocument.number) member.documentNumber = validDocument.number;
|
|
3421
3562
|
if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
|
|
@@ -3428,9 +3569,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3428
3569
|
if (
|
|
3429
3570
|
personDoc.status.code === '00' &&
|
|
3430
3571
|
new Date(personDoc.endDate) > new Date(Date.now()) &&
|
|
3431
|
-
(personDoc.type.code ===
|
|
3572
|
+
(personDoc.type.code === CoreEnums.GBD.DocTypes['1UDL'] || personDoc.type.code === CoreEnums.GBD.DocTypes.VNZ || personDoc.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3432
3573
|
) {
|
|
3433
|
-
const documentType = this.documentTypes.find(
|
|
3574
|
+
const documentType = this.documentTypes.find(
|
|
3575
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(personDoc.type.code)],
|
|
3576
|
+
);
|
|
3434
3577
|
if (documentType) member.documentType = documentType;
|
|
3435
3578
|
const documentNumber = personDoc.number;
|
|
3436
3579
|
if (documentNumber) member.documentNumber = documentNumber;
|
|
@@ -3477,12 +3620,14 @@ export const useDataStore = defineStore('data', {
|
|
|
3477
3620
|
'clientData.authoritedPerson.bankInfo',
|
|
3478
3621
|
'clientData.authoritedPerson.economySectorCode',
|
|
3479
3622
|
'clientData.authoritedPerson.legalAddress',
|
|
3480
|
-
'clientData.authoritedPerson.placeOfBirth',
|
|
3481
|
-
'clientData.authoritedPerson.resident',
|
|
3482
3623
|
'clientData.authoritedPerson.taxResidentCountry',
|
|
3483
3624
|
'clientData.authoritedPerson.addTaxResidency',
|
|
3484
3625
|
]);
|
|
3485
3626
|
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3627
|
+
if (this.formStore.lfb.add) {
|
|
3628
|
+
policyholder.parentContractNumber = localStorage.getItem('policyNo');
|
|
3629
|
+
policyholder.parentContractId = localStorage.getItem('policyId');
|
|
3630
|
+
}
|
|
3486
3631
|
try {
|
|
3487
3632
|
const response = await this.api.startApplication(policyholder);
|
|
3488
3633
|
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
@@ -3515,6 +3660,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3515
3660
|
this.formStore.regNumber = applicationData.regNumber;
|
|
3516
3661
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
3517
3662
|
|
|
3663
|
+
if (localStorage.getItem('add') === 'true' || this.formStore.applicationData.parentPolicyDto !== null) {
|
|
3664
|
+
this.formStore.lfb.add = true;
|
|
3665
|
+
this.formStore.lfb.policyholder.clientData.iin = localStorage.getItem('bin') as string;
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3518
3668
|
this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
|
|
3519
3669
|
this.formStore.applicationTaskId = taskId;
|
|
3520
3670
|
this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
|
|
@@ -3591,6 +3741,20 @@ export const useDataStore = defineStore('data', {
|
|
|
3591
3741
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
3592
3742
|
const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
|
|
3593
3743
|
this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
|
|
3744
|
+
|
|
3745
|
+
if (applicationData.parentPolicyDto !== null) {
|
|
3746
|
+
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.parentPolicyDto.contractInsrBegin);
|
|
3747
|
+
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.parentPolicyDto.contractInsrEnd);
|
|
3748
|
+
}
|
|
3749
|
+
if (this.formStore.lfb.add) {
|
|
3750
|
+
if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
|
|
3751
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3752
|
+
this.formStore.productConditionsForm.requestedSumInsured = null;
|
|
3753
|
+
} else {
|
|
3754
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3755
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = null;
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3594
3758
|
} catch (err) {
|
|
3595
3759
|
ErrorHandler(err);
|
|
3596
3760
|
if (err instanceof AxiosError) {
|
|
@@ -3601,7 +3765,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3601
3765
|
}
|
|
3602
3766
|
this.isLoading = false;
|
|
3603
3767
|
},
|
|
3604
|
-
async saveAccidentIncidents(data: AccidentIncidents[]) {
|
|
3768
|
+
async saveAccidentIncidents(data: Types.AccidentIncidents[]) {
|
|
3605
3769
|
try {
|
|
3606
3770
|
const dataCopy = JSON.parse(JSON.stringify(data));
|
|
3607
3771
|
for (const incident of dataCopy) {
|
|
@@ -3699,6 +3863,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3699
3863
|
premium: client.insuredPolicyData.premium,
|
|
3700
3864
|
premiumWithLoad: client.insuredPolicyData.premiumWithLoad,
|
|
3701
3865
|
hasAttachedFile: client.hasAttachedFile,
|
|
3866
|
+
insrBeginDate: client.insuredPolicyData.insrBeginDate ?? 'no',
|
|
3867
|
+
insrEndDate: client.insuredPolicyData.insrEndDate ?? 'no',
|
|
3702
3868
|
};
|
|
3703
3869
|
});
|
|
3704
3870
|
return clients;
|
|
@@ -3747,7 +3913,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3747
3913
|
return false;
|
|
3748
3914
|
}
|
|
3749
3915
|
|
|
3750
|
-
if (this.formStore.lfb.beneficialOwners) {
|
|
3916
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.beneficialOwners) {
|
|
3751
3917
|
if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
3752
3918
|
return false;
|
|
3753
3919
|
}
|
|
@@ -3758,7 +3924,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3758
3924
|
}
|
|
3759
3925
|
}
|
|
3760
3926
|
|
|
3761
|
-
if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3927
|
+
if (!this.formStore.lfb.add && this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3762
3928
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
|
|
3763
3929
|
return false;
|
|
3764
3930
|
}
|
|
@@ -3774,7 +3940,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3774
3940
|
}
|
|
3775
3941
|
}
|
|
3776
3942
|
|
|
3777
|
-
if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3943
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3778
3944
|
for (const client of this.formStore.lfb.clients) {
|
|
3779
3945
|
if (client.hasAttachedFile === false) {
|
|
3780
3946
|
this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
|
|
@@ -3783,18 +3949,75 @@ export const useDataStore = defineStore('data', {
|
|
|
3783
3949
|
}
|
|
3784
3950
|
}
|
|
3785
3951
|
|
|
3786
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3952
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3787
3953
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
3788
3954
|
return false;
|
|
3789
3955
|
}
|
|
3790
3956
|
|
|
3791
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3957
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3792
3958
|
this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
|
|
3793
3959
|
return false;
|
|
3794
3960
|
}
|
|
3795
3961
|
|
|
3962
|
+
if (this.controls.hasAttachment) {
|
|
3963
|
+
const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
|
|
3964
|
+
if (areValid) {
|
|
3965
|
+
if (this.isInitiator()) {
|
|
3966
|
+
await this.setINSISWorkData();
|
|
3967
|
+
}
|
|
3968
|
+
} else {
|
|
3969
|
+
this.isLoading = false;
|
|
3970
|
+
this.showToaster('error', this.t('toaster.attachManagerError'), 3000);
|
|
3971
|
+
return false;
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
|
|
3796
3975
|
return true;
|
|
3797
3976
|
},
|
|
3977
|
+
async getOnlineAccess(iin: string, documentType: string) {
|
|
3978
|
+
try {
|
|
3979
|
+
const data = {
|
|
3980
|
+
iinBin: iin.replaceAll('-', ''),
|
|
3981
|
+
documentType: documentType,
|
|
3982
|
+
};
|
|
3983
|
+
const response = await this.api.externalServices.getOnlineAccess(data);
|
|
3984
|
+
if (response.code === 'PROFILE_DIGIDOCS_INTERNAL_ERROR') {
|
|
3985
|
+
this.showToaster('error', this.t('toaster.notDigDoc'), 3000);
|
|
3986
|
+
return false;
|
|
3987
|
+
} else {
|
|
3988
|
+
return true;
|
|
3989
|
+
}
|
|
3990
|
+
} catch (err) {
|
|
3991
|
+
ErrorHandler(err);
|
|
3992
|
+
return null;
|
|
3993
|
+
}
|
|
3994
|
+
},
|
|
3995
|
+
async getDigitalDocuments(iin: string, processInstanceId: string, code: string) {
|
|
3996
|
+
try {
|
|
3997
|
+
const data = {
|
|
3998
|
+
iin: iin.replaceAll('-', ''),
|
|
3999
|
+
processInstanceId: processInstanceId,
|
|
4000
|
+
code: code.replace(/\s/g, ''),
|
|
4001
|
+
};
|
|
4002
|
+
await this.api.externalServices.getDigitalDocuments(data);
|
|
4003
|
+
return true;
|
|
4004
|
+
} catch (err) {
|
|
4005
|
+
ErrorHandler(err);
|
|
4006
|
+
return null;
|
|
4007
|
+
}
|
|
4008
|
+
},
|
|
4009
|
+
async updateDigitalDocumentsProfile(iin: string) {
|
|
4010
|
+
try {
|
|
4011
|
+
const data = {
|
|
4012
|
+
iinBin: iin.replaceAll('-', ''),
|
|
4013
|
+
};
|
|
4014
|
+
await this.api.externalServices.updateDigitalDocumentsProfile(data);
|
|
4015
|
+
this.showToaster('success', this.t('toaster.successProfile'), 3000);
|
|
4016
|
+
} catch (err) {
|
|
4017
|
+
ErrorHandler(err);
|
|
4018
|
+
return null;
|
|
4019
|
+
}
|
|
4020
|
+
},
|
|
3798
4021
|
async getVariableData(processCode: number) {
|
|
3799
4022
|
try {
|
|
3800
4023
|
const response = await this.api.getVariableData(0, processCode);
|
|
@@ -3824,6 +4047,24 @@ export const useDataStore = defineStore('data', {
|
|
|
3824
4047
|
return ErrorHandler(err);
|
|
3825
4048
|
}
|
|
3826
4049
|
},
|
|
4050
|
+
async getBankByAccountNumber(accountNumber: string) {
|
|
4051
|
+
try {
|
|
4052
|
+
const bank = await this.api.getBankByAccountNumber(accountNumber);
|
|
4053
|
+
return bank;
|
|
4054
|
+
} catch (err) {
|
|
4055
|
+
ErrorHandler(err);
|
|
4056
|
+
}
|
|
4057
|
+
},
|
|
4058
|
+
async getContractByBin(bin: string) {
|
|
4059
|
+
try {
|
|
4060
|
+
const contract = await this.api.getContractByBin(bin);
|
|
4061
|
+
contract.insrBegin = reformatDate(contract.insrBegin) ?? '';
|
|
4062
|
+
contract.insrEnd = reformatDate(contract.insrEnd) ?? '';
|
|
4063
|
+
return contract;
|
|
4064
|
+
} catch (err) {
|
|
4065
|
+
ErrorHandler(err);
|
|
4066
|
+
}
|
|
4067
|
+
},
|
|
3827
4068
|
async isCourseChanged(processInstanceId: string) {
|
|
3828
4069
|
try {
|
|
3829
4070
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -3832,7 +4073,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3832
4073
|
return ErrorHandler(err);
|
|
3833
4074
|
}
|
|
3834
4075
|
},
|
|
3835
|
-
async generateShortLink(url: string, template?: Api.GenerateShortLink.Templates) {
|
|
4076
|
+
async generateShortLink(url: string, template?: Types.Api.GenerateShortLink.Templates) {
|
|
3836
4077
|
try {
|
|
3837
4078
|
const response = await this.api.generateShortLink({
|
|
3838
4079
|
link: url,
|
|
@@ -3845,7 +4086,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3845
4086
|
}
|
|
3846
4087
|
},
|
|
3847
4088
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
3848
|
-
if (this.isLifetrip || this.isPension) return false;
|
|
4089
|
+
if (this.isLifetrip || this.isPension || this.isBalam) return false;
|
|
3849
4090
|
switch (whichForm) {
|
|
3850
4091
|
case this.formStore.beneficiaryFormKey:
|
|
3851
4092
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -3856,7 +4097,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3856
4097
|
}
|
|
3857
4098
|
},
|
|
3858
4099
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
3859
|
-
if (this.
|
|
4100
|
+
if (this.isPension) return false;
|
|
3860
4101
|
switch (whichForm) {
|
|
3861
4102
|
case this.formStore.beneficiaryFormKey:
|
|
3862
4103
|
return false;
|
|
@@ -3864,18 +4105,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3864
4105
|
return true;
|
|
3865
4106
|
}
|
|
3866
4107
|
},
|
|
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
4108
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
3880
4109
|
if (this.isGons || this.isPension) return false;
|
|
3881
4110
|
switch (whichForm) {
|
|
@@ -3884,7 +4113,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3884
4113
|
}
|
|
3885
4114
|
},
|
|
3886
4115
|
hasBankSection(whichForm: keyof typeof StoreMembers) {
|
|
3887
|
-
if (!this.isPension) return false;
|
|
4116
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3888
4117
|
switch (whichForm) {
|
|
3889
4118
|
case 'beneficiaryForm':
|
|
3890
4119
|
return false;
|
|
@@ -3893,7 +4122,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3893
4122
|
}
|
|
3894
4123
|
},
|
|
3895
4124
|
hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
|
|
3896
|
-
if (!this.isPension) return false;
|
|
4125
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3897
4126
|
switch (whichForm) {
|
|
3898
4127
|
case 'beneficiaryForm':
|
|
3899
4128
|
return false;
|
|
@@ -3912,44 +4141,5 @@ export const useDataStore = defineStore('data', {
|
|
|
3912
4141
|
return false;
|
|
3913
4142
|
}
|
|
3914
4143
|
},
|
|
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
4144
|
},
|
|
3955
4145
|
});
|