hl-core 0.0.10-beta.4 → 0.0.10-beta.40
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 +331 -191
- 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/TextAreaField.vue +71 -0
- package/components/Input/TextInput.vue +2 -0
- package/components/Layout/Drawer.vue +2 -0
- package/components/Menu/MenuNav.vue +1 -1
- package/components/Pages/Anketa.vue +168 -169
- package/components/Pages/Auth.vue +2 -0
- package/components/Pages/ContragentForm.vue +2 -1
- package/components/Pages/Documents.vue +432 -59
- package/components/Pages/MemberForm.vue +334 -160
- package/components/Pages/ProductConditions.vue +800 -226
- package/components/Panel/PanelHandler.vue +280 -121
- 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 -49
- package/composables/constants.ts +43 -0
- package/composables/fields.ts +6 -4
- package/composables/index.ts +293 -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 +79 -19
- package/nuxt.config.ts +10 -13
- package/package.json +12 -12
- package/plugins/head.ts +2 -1
- package/store/data.store.ts +765 -530
- package/store/member.store.ts +18 -6
- package/store/rules.ts +22 -2
- package/types/enum.ts +32 -2
- package/types/env.d.ts +2 -2
- package/types/form.ts +71 -74
- package/types/index.ts +921 -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';
|
|
6
|
-
import { DataStoreClass, DocumentItem, Member, Value, CountryValue, PolicyholderActivity, BeneficialOwner, PolicyholderClass } from '../composables/classes';
|
|
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
|
+
import { DataStoreClass, DocumentItem, Member, Value, CountryValue, PolicyholderActivity, BeneficialOwner, PolicyholderClass, GroupMember } 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,10 +63,13 @@ 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
|
+
isCritical: state => state.product === 'criticalillness',
|
|
67
|
+
isBalam: state => state.product === 'balam',
|
|
62
68
|
isDSO: state => state.product === 'dso',
|
|
63
69
|
isUU: state => state.product === 'uu',
|
|
64
|
-
hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
70
|
+
hasClientAnketa: state => Array.isArray(state.formStore.additionalInsuranceTerms) && state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
65
71
|
isClientAnketaCondition: state =>
|
|
72
|
+
Array.isArray(state.formStore.additionalInsuranceTerms) &&
|
|
66
73
|
!state.formStore.insuredForm.find(member => member.iin === state.formStore.policyholderForm.iin) &&
|
|
67
74
|
!!state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10 && i.coverSumCode === 'included'),
|
|
68
75
|
},
|
|
@@ -159,22 +166,23 @@ export const useDataStore = defineStore('data', {
|
|
|
159
166
|
getUserRoles() {
|
|
160
167
|
if (this.accessToken && this.user.roles.length === 0) {
|
|
161
168
|
const decoded = jwtDecode(this.accessToken);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
if (decoded) {
|
|
170
|
+
this.user.id = String(decoded.sub);
|
|
171
|
+
this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
|
|
172
|
+
this.user.code = decoded.code;
|
|
173
|
+
this.user.branchCode = decoded.branchCode;
|
|
174
|
+
const key = getKeyWithPattern(decoded, 'role');
|
|
175
|
+
if (key) {
|
|
176
|
+
const roles = decoded[key as keyof Types.Utils.JwtToken];
|
|
177
|
+
if (typeof roles === 'string') {
|
|
178
|
+
this.user.roles.push(roles);
|
|
179
|
+
} else if (typeof roles === 'object') {
|
|
180
|
+
this.user.roles = roles;
|
|
181
|
+
}
|
|
171
182
|
}
|
|
172
183
|
}
|
|
173
184
|
}
|
|
174
185
|
},
|
|
175
|
-
getUserData() {
|
|
176
|
-
return this.accessToken ? jwtDecode(this.accessToken) : null;
|
|
177
|
-
},
|
|
178
186
|
async getUserGroups() {
|
|
179
187
|
try {
|
|
180
188
|
this.isLoading = true;
|
|
@@ -185,140 +193,17 @@ export const useDataStore = defineStore('data', {
|
|
|
185
193
|
this.isLoading = false;
|
|
186
194
|
}
|
|
187
195
|
},
|
|
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
196
|
isTask() {
|
|
308
197
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
309
198
|
},
|
|
310
199
|
validateAccess() {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return false;
|
|
319
|
-
} catch (err) {
|
|
320
|
-
return ErrorHandler(err);
|
|
321
|
-
}
|
|
200
|
+
const hasAccess = this.hasAccess();
|
|
201
|
+
if (this.isAML) return hasAccess.toAML;
|
|
202
|
+
if (this.isLKA) return hasAccess.toLKA;
|
|
203
|
+
if (this.isEFO) return hasAccess.toEFO;
|
|
204
|
+
if (this.isAULETTI) return hasAccess.toAULETTI;
|
|
205
|
+
if (this.isLKA_A) return hasAccess.toLKA_A;
|
|
206
|
+
return false;
|
|
322
207
|
},
|
|
323
208
|
async loginUser(login: string, password: string, numAttempt: number) {
|
|
324
209
|
try {
|
|
@@ -383,7 +268,7 @@ export const useDataStore = defineStore('data', {
|
|
|
383
268
|
return false;
|
|
384
269
|
}
|
|
385
270
|
},
|
|
386
|
-
async resetSelected(route: RouteType) {
|
|
271
|
+
async resetSelected(route: Types.RouteType) {
|
|
387
272
|
this.settings.open = false;
|
|
388
273
|
this.rightPanel.open = false;
|
|
389
274
|
this.panel.open = false;
|
|
@@ -397,39 +282,75 @@ export const useDataStore = defineStore('data', {
|
|
|
397
282
|
if (!file.id) return;
|
|
398
283
|
try {
|
|
399
284
|
this.isLoading = true;
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
285
|
+
if (this.isPension) {
|
|
286
|
+
await this.api.file.getFileNew(file.id).then((response: any) => {
|
|
287
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
288
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
289
|
+
const url = window.URL.createObjectURL(blob);
|
|
290
|
+
const link = document.createElement('a');
|
|
291
|
+
link.href = url;
|
|
292
|
+
if (mode === 'view') {
|
|
293
|
+
setTimeout(() => {
|
|
294
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
295
|
+
});
|
|
296
|
+
} else {
|
|
297
|
+
link.setAttribute('download', file.fileName!);
|
|
298
|
+
document.body.appendChild(link);
|
|
299
|
+
link.click();
|
|
300
|
+
}
|
|
410
301
|
} 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`);
|
|
302
|
+
const blob = new Blob([response], {
|
|
303
|
+
type: `application/${fileType}`,
|
|
425
304
|
});
|
|
305
|
+
const url = window.URL.createObjectURL(blob);
|
|
306
|
+
const link = document.createElement('a');
|
|
307
|
+
link.href = url;
|
|
308
|
+
if (mode === 'view') {
|
|
309
|
+
setTimeout(() => {
|
|
310
|
+
window.open(url, '_blank', `right=100`);
|
|
311
|
+
});
|
|
312
|
+
} else {
|
|
313
|
+
link.setAttribute('download', file.fileName!);
|
|
314
|
+
document.body.appendChild(link);
|
|
315
|
+
link.click();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
} else {
|
|
320
|
+
await this.api.file.getFile(file.id).then((response: any) => {
|
|
321
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
322
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
323
|
+
const url = window.URL.createObjectURL(blob);
|
|
324
|
+
const link = document.createElement('a');
|
|
325
|
+
link.href = url;
|
|
326
|
+
if (mode === 'view') {
|
|
327
|
+
setTimeout(() => {
|
|
328
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
329
|
+
});
|
|
330
|
+
} else {
|
|
331
|
+
link.setAttribute('download', file.fileName!);
|
|
332
|
+
document.body.appendChild(link);
|
|
333
|
+
link.click();
|
|
334
|
+
}
|
|
426
335
|
} else {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
336
|
+
const blob = new Blob([response], {
|
|
337
|
+
type: `application/${fileType}`,
|
|
338
|
+
});
|
|
339
|
+
const url = window.URL.createObjectURL(blob);
|
|
340
|
+
const link = document.createElement('a');
|
|
341
|
+
link.href = url;
|
|
342
|
+
if (mode === 'view') {
|
|
343
|
+
setTimeout(() => {
|
|
344
|
+
window.open(url, '_blank', `right=100`);
|
|
345
|
+
});
|
|
346
|
+
} else {
|
|
347
|
+
link.setAttribute('download', file.fileName!);
|
|
348
|
+
document.body.appendChild(link);
|
|
349
|
+
link.click();
|
|
350
|
+
}
|
|
430
351
|
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
352
|
+
});
|
|
353
|
+
}
|
|
433
354
|
} catch (err) {
|
|
434
355
|
ErrorHandler(err);
|
|
435
356
|
} finally {
|
|
@@ -438,7 +359,7 @@ export const useDataStore = defineStore('data', {
|
|
|
438
359
|
},
|
|
439
360
|
async deleteFile(data: DocumentItem) {
|
|
440
361
|
try {
|
|
441
|
-
await this.api.deleteFile(data);
|
|
362
|
+
await this.api.file.deleteFile(data);
|
|
442
363
|
this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
|
|
443
364
|
} catch (err) {
|
|
444
365
|
ErrorHandler(err);
|
|
@@ -447,7 +368,7 @@ export const useDataStore = defineStore('data', {
|
|
|
447
368
|
async uploadFiles(data: FormData, load: boolean = false) {
|
|
448
369
|
this.isLoading = load;
|
|
449
370
|
try {
|
|
450
|
-
await this.api.uploadFiles(data);
|
|
371
|
+
await this.api.file.uploadFiles(data);
|
|
451
372
|
return true;
|
|
452
373
|
} catch (err) {
|
|
453
374
|
return ErrorHandler(err);
|
|
@@ -457,14 +378,28 @@ export const useDataStore = defineStore('data', {
|
|
|
457
378
|
},
|
|
458
379
|
async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
|
|
459
380
|
this.isLoading = load;
|
|
460
|
-
|
|
381
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
382
|
+
if (isNonResident) {
|
|
383
|
+
if (!member.firstName || !member.lastName) return;
|
|
384
|
+
} else {
|
|
385
|
+
if (!member.iin) return;
|
|
386
|
+
}
|
|
461
387
|
try {
|
|
462
|
-
const queryData =
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
388
|
+
const queryData = isNonResident
|
|
389
|
+
? {
|
|
390
|
+
firstName: member.firstName ?? '',
|
|
391
|
+
lastName: member.lastName ?? '',
|
|
392
|
+
middleName: member.middleName ?? '',
|
|
393
|
+
iin: '',
|
|
394
|
+
birthDate: member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
395
|
+
}
|
|
396
|
+
: {
|
|
397
|
+
firstName: '',
|
|
398
|
+
lastName: '',
|
|
399
|
+
middleName: '',
|
|
400
|
+
iin: member.iin ? member.iin.replace(/-/g, '') : '',
|
|
401
|
+
birthDate: '',
|
|
402
|
+
};
|
|
468
403
|
const contragentResponse = await this.api.getContragent(queryData);
|
|
469
404
|
if (contragentResponse.totalItems > 0) {
|
|
470
405
|
if (contragentResponse.items.length === 1) {
|
|
@@ -473,25 +408,32 @@ export const useDataStore = defineStore('data', {
|
|
|
473
408
|
const sortedByRegistrationDate = contragentResponse.items.sort(
|
|
474
409
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
475
410
|
);
|
|
476
|
-
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
411
|
+
if (!isNonResident) await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
477
412
|
}
|
|
478
413
|
member.gotFromInsis = true;
|
|
479
414
|
} else {
|
|
480
415
|
if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
481
416
|
}
|
|
417
|
+
if (isNonResident) return contragentResponse;
|
|
482
418
|
} catch (err) {
|
|
483
419
|
ErrorHandler(err);
|
|
484
420
|
}
|
|
485
421
|
this.isLoading = false;
|
|
486
422
|
},
|
|
487
|
-
async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
|
|
423
|
+
async getContragentById(id: number, whichForm: keyof typeof StoreMembers | 'slaveInsuredForm', load: boolean = true, whichIndex: number | null = null) {
|
|
488
424
|
if (Number(id) === 0) return;
|
|
489
425
|
this.isLoading = load;
|
|
490
426
|
try {
|
|
491
|
-
const member =
|
|
427
|
+
const member =
|
|
428
|
+
this.isPension && whichForm === 'slaveInsuredForm'
|
|
429
|
+
? this.formStore.slaveInsuredForm
|
|
430
|
+
: whichIndex === null
|
|
431
|
+
? this.formStore[whichForm as Types.SingleMember]
|
|
432
|
+
: this.formStore[whichForm as Types.MultipleMember][whichIndex];
|
|
433
|
+
|
|
492
434
|
const contragentResponse = await this.api.getContragentById(id);
|
|
493
435
|
if (contragentResponse.totalItems > 0) {
|
|
494
|
-
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
436
|
+
await this.serializeContragentData(member, contragentResponse.items[0], whichForm);
|
|
495
437
|
} else {
|
|
496
438
|
this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
497
439
|
}
|
|
@@ -501,7 +443,7 @@ export const useDataStore = defineStore('data', {
|
|
|
501
443
|
this.isLoading = false;
|
|
502
444
|
}
|
|
503
445
|
},
|
|
504
|
-
async serializeContragentData(member: Member, contragent: ContragentType) {
|
|
446
|
+
async serializeContragentData(member: Member, contragent: Types.ContragentType, whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm') {
|
|
505
447
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
506
448
|
this.api.getContrAgentData(contragent.id),
|
|
507
449
|
this.api.getContrAgentContacts(contragent.id),
|
|
@@ -523,23 +465,34 @@ export const useDataStore = defineStore('data', {
|
|
|
523
465
|
if (addressResponse.status === 'fulfilled' && addressResponse.value && addressResponse.value.length) {
|
|
524
466
|
member.response.addresses = addressResponse.value;
|
|
525
467
|
}
|
|
526
|
-
this.parseContragent(
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
468
|
+
this.parseContragent(
|
|
469
|
+
member,
|
|
470
|
+
{
|
|
471
|
+
personalData: contragent,
|
|
472
|
+
data: questionairesResponse.status === 'fulfilled' ? questionairesResponse.value : undefined,
|
|
473
|
+
contacts: contactsResponse.status === 'fulfilled' ? contactsResponse.value : undefined,
|
|
474
|
+
documents: documentsResponse.status === 'fulfilled' ? documentsResponse.value : undefined,
|
|
475
|
+
address: addressResponse.status === 'fulfilled' ? addressResponse.value : undefined,
|
|
476
|
+
},
|
|
477
|
+
whichForm,
|
|
478
|
+
);
|
|
533
479
|
},
|
|
534
480
|
parseContragent(
|
|
535
481
|
member: Member,
|
|
536
|
-
user: {
|
|
482
|
+
user: {
|
|
483
|
+
personalData: Types.ContragentType;
|
|
484
|
+
data?: Types.ContragentQuestionaries[];
|
|
485
|
+
contacts?: Types.ContragentContacts[];
|
|
486
|
+
documents?: Types.ContragentDocuments[];
|
|
487
|
+
address?: Types.ContragentAddress[];
|
|
488
|
+
},
|
|
489
|
+
whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm',
|
|
537
490
|
) {
|
|
538
491
|
member.verifyType = user.personalData.verifyType;
|
|
539
492
|
member.verifyDate = user.personalData.verifyDate;
|
|
540
493
|
member.iin = reformatIin(user.personalData.iin);
|
|
541
494
|
member.age = String(user.personalData.age);
|
|
542
|
-
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
495
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace ?? 'undefined', 'i')));
|
|
543
496
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
544
497
|
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
545
498
|
member.gender = gender ? gender : new Value();
|
|
@@ -556,13 +509,23 @@ export const useDataStore = defineStore('data', {
|
|
|
556
509
|
|
|
557
510
|
if ('documents' in user && user.documents && user.documents.length) {
|
|
558
511
|
member.documentsList = user.documents;
|
|
559
|
-
const documentByPriority = user.documents.find(i =>
|
|
512
|
+
const documentByPriority = user.documents.find(i => {
|
|
513
|
+
if (this.isLifetrip && (whichForm !== this.formStore.policyholderFormKey || this.formStore.isPolicyholderInsured === true)) {
|
|
514
|
+
return i.type === CoreEnums.Insis.DocTypes['PS'];
|
|
515
|
+
}
|
|
516
|
+
return i.type === CoreEnums.Insis.DocTypes['1UDL'];
|
|
517
|
+
});
|
|
560
518
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
561
519
|
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
562
520
|
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
563
521
|
member.documentType = documentType ? documentType : new Value();
|
|
564
522
|
member.documentNumber = userDocument.number;
|
|
565
523
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
524
|
+
if (userDocument.issuerNameRu === 'Другое') {
|
|
525
|
+
member.documentIssuers.issuerOtherNameRu = userDocument.issuerOtherNameRu;
|
|
526
|
+
member.documentIssuers.issuerOtherNameOrig = userDocument.issuerOtherNameOrig;
|
|
527
|
+
member.documentIssuers.issuerOtherName = userDocument.issuerOtherName;
|
|
528
|
+
}
|
|
566
529
|
member.documentDate = reformatDate(userDocument.issueDate);
|
|
567
530
|
member.documentExpire = reformatDate(userDocument.expireDate);
|
|
568
531
|
}
|
|
@@ -615,7 +578,7 @@ export const useDataStore = defineStore('data', {
|
|
|
615
578
|
});
|
|
616
579
|
}
|
|
617
580
|
},
|
|
618
|
-
searchFromList(member: Member, searchIt: ContragentQuestionaries) {
|
|
581
|
+
searchFromList(member: Member, searchIt: Types.ContragentQuestionaries) {
|
|
619
582
|
const getQuestionariesData = () => {
|
|
620
583
|
switch (searchIt.questId) {
|
|
621
584
|
case '500003':
|
|
@@ -638,23 +601,30 @@ export const useDataStore = defineStore('data', {
|
|
|
638
601
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
639
602
|
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
640
603
|
//@ts-ignore
|
|
641
|
-
member[qData.field] = qResult
|
|
604
|
+
member[qData.field] = qResult ?? new Value();
|
|
642
605
|
}
|
|
643
606
|
},
|
|
644
607
|
async alreadyInInsis(member: Member) {
|
|
645
|
-
|
|
608
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
609
|
+
if (isNonResident) {
|
|
610
|
+
if (!member.firstName || !member.lastName) return;
|
|
611
|
+
} else {
|
|
612
|
+
if (!member.iin) return;
|
|
613
|
+
}
|
|
646
614
|
try {
|
|
647
615
|
const queryData = {
|
|
648
|
-
iin: member.iin.replaceAll('-', ''),
|
|
616
|
+
iin: !!member.iin && !isNonResident ? member.iin.replaceAll('-', '') : '',
|
|
649
617
|
firstName: !!member.firstName ? member.firstName : '',
|
|
650
618
|
lastName: !!member.lastName ? member.lastName : '',
|
|
651
619
|
middleName: !!member.middleName ? member.middleName : '',
|
|
620
|
+
birthDate: !!member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
652
621
|
};
|
|
653
622
|
const contragent = await this.api.getContragent(queryData);
|
|
654
623
|
if (contragent.totalItems > 0) {
|
|
655
624
|
if (contragent.items.length === 1) {
|
|
656
625
|
return contragent.items[0];
|
|
657
626
|
} else {
|
|
627
|
+
if (this.isPension && queryData.iin === '') return contragent.items.find(i => i.id === member.id);
|
|
658
628
|
const sortedByRegistrationDate = contragent.items.sort(
|
|
659
629
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
660
630
|
);
|
|
@@ -688,8 +658,8 @@ export const useDataStore = defineStore('data', {
|
|
|
688
658
|
}
|
|
689
659
|
},
|
|
690
660
|
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.
|
|
661
|
+
if (this.isGons && user.iin && whichForm === 'beneficiaryForm') {
|
|
662
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesActualPolicy(String(this.formStore.applicationData.processInstanceId));
|
|
693
663
|
if (doesHaveActiveContract) {
|
|
694
664
|
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
695
665
|
return false;
|
|
@@ -723,10 +693,10 @@ export const useDataStore = defineStore('data', {
|
|
|
723
693
|
}
|
|
724
694
|
}
|
|
725
695
|
try {
|
|
726
|
-
const contragentData: ContragentType = {
|
|
696
|
+
const contragentData: Types.ContragentType = {
|
|
727
697
|
id: Number(user.id),
|
|
728
698
|
type: Number(user.type),
|
|
729
|
-
iin: user.iin
|
|
699
|
+
iin: user.iin ? user.iin.replace(/-/g, '') : '',
|
|
730
700
|
longName: user.longName !== null ? user.longName : (user.lastName ?? '') + (user.firstName ?? '') + (user.middleName ?? ''),
|
|
731
701
|
lastName: user.lastName ?? '',
|
|
732
702
|
firstName: user.firstName ?? '',
|
|
@@ -753,7 +723,7 @@ export const useDataStore = defineStore('data', {
|
|
|
753
723
|
countryOfTaxResidency,
|
|
754
724
|
signOfResidency,
|
|
755
725
|
}))(user);
|
|
756
|
-
const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
726
|
+
const questionariesData: Types.ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
757
727
|
let questName = '';
|
|
758
728
|
let questionId = parseInt(question.ids as string).toString();
|
|
759
729
|
if (questionId === '500003') {
|
|
@@ -821,7 +791,7 @@ export const useDataStore = defineStore('data', {
|
|
|
821
791
|
}
|
|
822
792
|
|
|
823
793
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
824
|
-
const contactsData: ContragentContacts[] = [];
|
|
794
|
+
const contactsData: Types.ContragentContacts[] = [];
|
|
825
795
|
if (!!user.phoneNumber) {
|
|
826
796
|
contactsData.push({
|
|
827
797
|
contragentId: Number(user.id),
|
|
@@ -863,7 +833,7 @@ export const useDataStore = defineStore('data', {
|
|
|
863
833
|
|
|
864
834
|
const documentsData = user.documentsList;
|
|
865
835
|
const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
|
|
866
|
-
const userDocument: ContragentDocuments = {
|
|
836
|
+
const userDocument: Types.ContragentDocuments = {
|
|
867
837
|
contragentId: Number(user.id),
|
|
868
838
|
id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
|
|
869
839
|
description: null,
|
|
@@ -880,6 +850,11 @@ export const useDataStore = defineStore('data', {
|
|
|
880
850
|
verifyType: user.verifyType,
|
|
881
851
|
verifyDate: user.verifyDate,
|
|
882
852
|
};
|
|
853
|
+
if (user.documentIssuers.ids === '1') {
|
|
854
|
+
userDocument.issuerOtherName = user.documentIssuers.issuerOtherName;
|
|
855
|
+
userDocument.issuerOtherNameOrig = user.documentIssuers.issuerOtherNameOrig;
|
|
856
|
+
userDocument.issuerOtherNameRu = user.documentIssuers.issuerOtherNameRu;
|
|
857
|
+
}
|
|
883
858
|
if (hasAlreadyDocument !== -1) {
|
|
884
859
|
documentsData[hasAlreadyDocument] = userDocument;
|
|
885
860
|
} else {
|
|
@@ -888,7 +863,7 @@ export const useDataStore = defineStore('data', {
|
|
|
888
863
|
|
|
889
864
|
const checkForNull = (value: any) => (value ? value : '');
|
|
890
865
|
const userResponseAddress = 'response' in user && user.response && 'addresses' in user.response && user.response.addresses ? user.response.addresses : null;
|
|
891
|
-
const addressData: ContragentAddress[] = [];
|
|
866
|
+
const addressData: Types.ContragentAddress[] = [];
|
|
892
867
|
addressData.push({
|
|
893
868
|
id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
|
|
894
869
|
contragentId: Number(user.id),
|
|
@@ -954,6 +929,9 @@ export const useDataStore = defineStore('data', {
|
|
|
954
929
|
isIpdlCompliance: null,
|
|
955
930
|
isTerrorCompliance: null,
|
|
956
931
|
};
|
|
932
|
+
if (this.isPension && memberFromApplicaiton && memberFromApplicaiton.processInstanceId === this.formStore.applicationData.slave?.processInstanceId) {
|
|
933
|
+
data.processInstanceId = this.formStore.applicationData.slave.processInstanceId;
|
|
934
|
+
}
|
|
957
935
|
data.id = memberFromApplicaiton && memberFromApplicaiton.id ? memberFromApplicaiton.id : null;
|
|
958
936
|
if (whichMember === 'Client') {
|
|
959
937
|
data.isInsured = this.formStore.isPolicyholderInsured;
|
|
@@ -963,6 +941,12 @@ export const useDataStore = defineStore('data', {
|
|
|
963
941
|
data.jobName = member.jobPlace;
|
|
964
942
|
data.positionCode = member.positionCode;
|
|
965
943
|
data.familyStatusId = member.familyStatus.id;
|
|
944
|
+
if (this.isPension) {
|
|
945
|
+
data.id =
|
|
946
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
947
|
+
? this.formStore.applicationData.clientApp.id
|
|
948
|
+
: this.formStore.applicationData.slave.clientApp.id;
|
|
949
|
+
}
|
|
966
950
|
}
|
|
967
951
|
if (whichMember === 'Spokesman') {
|
|
968
952
|
if (!!memberFromApplicaiton && memberFromApplicaiton.iin !== data.iin) {
|
|
@@ -1021,6 +1005,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1021
1005
|
data.familyStatusId = member.familyStatus.id;
|
|
1022
1006
|
data.relationId = member.relationDegree.ids;
|
|
1023
1007
|
data.relationName = member.relationDegree.nameRu;
|
|
1008
|
+
if (this.isPension) {
|
|
1009
|
+
data.id =
|
|
1010
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
1011
|
+
? this.formStore.applicationData.insuredApp[0].id
|
|
1012
|
+
: this.formStore.applicationData.slave.insuredApp[0].id;
|
|
1013
|
+
}
|
|
1024
1014
|
}
|
|
1025
1015
|
if (whichMember === 'Beneficiary') {
|
|
1026
1016
|
if (
|
|
@@ -1065,10 +1055,20 @@ export const useDataStore = defineStore('data', {
|
|
|
1065
1055
|
}
|
|
1066
1056
|
}
|
|
1067
1057
|
},
|
|
1068
|
-
async setApplication(applicationData:
|
|
1058
|
+
async setApplication(applicationData: any, calculate: boolean = false) {
|
|
1069
1059
|
try {
|
|
1070
1060
|
this.isLoading = true;
|
|
1071
1061
|
this.isButtonsLoading = true;
|
|
1062
|
+
if (this.isPension) {
|
|
1063
|
+
applicationData.transferContractCompany = '';
|
|
1064
|
+
if (applicationData.slave) {
|
|
1065
|
+
applicationData.slave.guaranteedPeriod = applicationData.slave.guaranteedPeriod ?? 0;
|
|
1066
|
+
applicationData.slave.transferContractCompany = '';
|
|
1067
|
+
}
|
|
1068
|
+
if (Number(this.formStore.applicationData.processCode) === 24) {
|
|
1069
|
+
applicationData.transferContractAmount = applicationData.parentContractAmount - applicationData.refundAmount;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
1072
|
await this.api.setApplication(applicationData);
|
|
1073
1073
|
if (calculate) {
|
|
1074
1074
|
await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
|
|
@@ -1085,8 +1085,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1085
1085
|
},
|
|
1086
1086
|
getConditionsData() {
|
|
1087
1087
|
const conditionsData: {
|
|
1088
|
-
policyAppDto: PolicyAppDto;
|
|
1089
|
-
addCoversDto: AddCover[];
|
|
1088
|
+
policyAppDto: Types.PolicyAppDto;
|
|
1089
|
+
addCoversDto: Types.AddCover[];
|
|
1090
1090
|
} = {
|
|
1091
1091
|
policyAppDto: {
|
|
1092
1092
|
id: this.formStore.applicationData?.policyAppDto?.id,
|
|
@@ -1123,6 +1123,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1123
1123
|
conditionsData.policyAppDto.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1124
1124
|
conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
|
|
1125
1125
|
}
|
|
1126
|
+
if (this.isGons) {
|
|
1127
|
+
conditionsData.policyAppDto.premiumInCurrency =
|
|
1128
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1129
|
+
conditionsData.policyAppDto.amountInCurrency =
|
|
1130
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1131
|
+
conditionsData.policyAppDto.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1132
|
+
conditionsData.policyAppDto.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1133
|
+
}
|
|
1126
1134
|
if (this.isLiferenta) {
|
|
1127
1135
|
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1128
1136
|
conditionsData.policyAppDto.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1209,12 +1217,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1209
1217
|
}
|
|
1210
1218
|
if (value !== null && this.formStore.definedAnswersId[whichSurvey][filter].length) {
|
|
1211
1219
|
const answer = this.formStore.definedAnswersId[whichSurvey][filter].find((answer: any) => answer.nameRu.match(new RegExp(value, 'i')));
|
|
1212
|
-
|
|
1213
|
-
|
|
1220
|
+
if (this.formStore[whichSurvey]) {
|
|
1221
|
+
//@ts-ignore
|
|
1222
|
+
this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
|
|
1223
|
+
}
|
|
1214
1224
|
}
|
|
1215
1225
|
return this.formStore.definedAnswersId[whichSurvey];
|
|
1216
1226
|
},
|
|
1217
|
-
async setSurvey(data: AnketaFirst) {
|
|
1227
|
+
async setSurvey(data: Types.AnketaFirst) {
|
|
1218
1228
|
try {
|
|
1219
1229
|
this.isLoading = true;
|
|
1220
1230
|
const anketaToken = await this.api.setSurvey(data);
|
|
@@ -1228,7 +1238,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1228
1238
|
},
|
|
1229
1239
|
async setINSISWorkData(loading: boolean = true) {
|
|
1230
1240
|
if (!this.formStore.applicationData.insisWorkDataApp) return;
|
|
1231
|
-
const data: InsisWorkDataApp = {
|
|
1241
|
+
const data: Types.InsisWorkDataApp = {
|
|
1232
1242
|
id: this.formStore.applicationData.insisWorkDataApp.id,
|
|
1233
1243
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
1234
1244
|
agentId: Number(this.formStore.AgentData.agentId),
|
|
@@ -1454,7 +1464,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1454
1464
|
return await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1455
1465
|
},
|
|
1456
1466
|
async getEconomicActivityType() {
|
|
1457
|
-
|
|
1467
|
+
const makeCall = this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension || this.isCritical;
|
|
1468
|
+
if (makeCall) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
|
|
1458
1469
|
},
|
|
1459
1470
|
async getFamilyStatuses() {
|
|
1460
1471
|
return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
|
|
@@ -1466,42 +1477,40 @@ export const useDataStore = defineStore('data', {
|
|
|
1466
1477
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1467
1478
|
},
|
|
1468
1479
|
async getBanks() {
|
|
1469
|
-
|
|
1480
|
+
const makeCall = this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO || this.isCritical;
|
|
1481
|
+
if (makeCall) return await this.getFromApi('banks', 'getBanks');
|
|
1470
1482
|
},
|
|
1471
1483
|
async getInsuranceCompanies() {
|
|
1472
1484
|
if (this.isPension) return await this.getFromApi('transferContractCompanies', 'getInsuranceCompanies');
|
|
1473
1485
|
},
|
|
1474
1486
|
async getProcessIndexRate() {
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
}
|
|
1487
|
+
const makeCall = (this.isBaiterek || this.isBolashak || this.isGons) && this.processCode;
|
|
1488
|
+
if (makeCall) return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
1478
1489
|
},
|
|
1479
1490
|
async getProcessPaymentPeriod() {
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1491
|
+
const makeCall = !this.isPension && this.processCode;
|
|
1492
|
+
if (makeCall) return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
|
|
1493
|
+
},
|
|
1494
|
+
async getProgramType() {
|
|
1495
|
+
const makeCall = this.isCritical && this.processCode;
|
|
1496
|
+
if (makeCall) return await this.getFromApi('programType', 'getProgramType', this.processCode);
|
|
1483
1497
|
},
|
|
1484
1498
|
async getQuestionRefs(id?: string) {
|
|
1485
1499
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1486
1500
|
},
|
|
1487
|
-
async getProcessTariff() {
|
|
1488
|
-
if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
|
|
1489
|
-
},
|
|
1490
1501
|
async getDicAnnuityTypeList() {
|
|
1491
1502
|
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
1492
1503
|
},
|
|
1493
1504
|
async getProcessAnnuityPaymentPeriod() {
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
}
|
|
1505
|
+
const makeCall = this.isLiferenta && this.processCode;
|
|
1506
|
+
if (makeCall) return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
|
|
1497
1507
|
},
|
|
1498
1508
|
async getInsurancePay() {
|
|
1499
1509
|
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
1500
1510
|
},
|
|
1501
1511
|
async getProcessGfot() {
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
}
|
|
1512
|
+
const makeCall = (this.isLifeBusiness || this.isGns) && this.processCode;
|
|
1513
|
+
if (makeCall) return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
|
|
1505
1514
|
},
|
|
1506
1515
|
async getCurrencies() {
|
|
1507
1516
|
try {
|
|
@@ -1520,7 +1529,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1520
1529
|
return this.gender;
|
|
1521
1530
|
},
|
|
1522
1531
|
async getAuthorityBasis() {
|
|
1523
|
-
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension
|
|
1532
|
+
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension || this.isCritical)
|
|
1533
|
+
return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
|
|
1524
1534
|
},
|
|
1525
1535
|
async getWorkPosition(search: string) {
|
|
1526
1536
|
try {
|
|
@@ -1548,8 +1558,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1548
1558
|
this.getFamilyStatuses(),
|
|
1549
1559
|
this.getRelationTypes(),
|
|
1550
1560
|
this.getProcessIndexRate(),
|
|
1551
|
-
this.getProcessTariff(),
|
|
1552
1561
|
this.getProcessPaymentPeriod(),
|
|
1562
|
+
this.getProgramType(),
|
|
1553
1563
|
this.getDicFileTypeList(),
|
|
1554
1564
|
this.getDicAnnuityTypeList(),
|
|
1555
1565
|
this.getProcessAnnuityPaymentPeriod(),
|
|
@@ -1658,16 +1668,16 @@ export const useDataStore = defineStore('data', {
|
|
|
1658
1668
|
column: column,
|
|
1659
1669
|
direction: direction,
|
|
1660
1670
|
groupCode: groupCode,
|
|
1661
|
-
processCodes:
|
|
1671
|
+
processCodes: this.isEFO
|
|
1672
|
+
? Object.values(constants.products).filter(
|
|
1673
|
+
i => i !== constants.products.pensionannuity && i !== constants.products.pensionannuityrefund && i !== constants.products.pensionannuityjoint,
|
|
1674
|
+
)
|
|
1675
|
+
: [constants.products.baiterek],
|
|
1662
1676
|
};
|
|
1663
1677
|
if (byOneProcess !== null) {
|
|
1664
1678
|
delete query.processCodes;
|
|
1665
1679
|
query.processCode = byOneProcess;
|
|
1666
1680
|
}
|
|
1667
|
-
if (byOneProcess === 19 && !useEnv().isProduction) {
|
|
1668
|
-
query.processCodes = [19, 2];
|
|
1669
|
-
delete query.processCode;
|
|
1670
|
-
}
|
|
1671
1681
|
const taskList = await this.api.getTaskList(
|
|
1672
1682
|
processInstanceId === null
|
|
1673
1683
|
? query
|
|
@@ -1872,7 +1882,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1872
1882
|
return;
|
|
1873
1883
|
}
|
|
1874
1884
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1875
|
-
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1885
|
+
const calculationData: Types.RecalculationDataType & Types.PolicyAppDto = {
|
|
1876
1886
|
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1877
1887
|
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1878
1888
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
@@ -1891,6 +1901,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1891
1901
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1892
1902
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1893
1903
|
}
|
|
1904
|
+
if (this.isGons || product === 'gons') {
|
|
1905
|
+
calculationData.premiumInCurrency =
|
|
1906
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1907
|
+
calculationData.amountInCurrency =
|
|
1908
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1909
|
+
calculationData.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1910
|
+
|
|
1911
|
+
calculationData.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1912
|
+
}
|
|
1894
1913
|
if (this.isLiferenta || product === 'liferenta') {
|
|
1895
1914
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1896
1915
|
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1909,10 +1928,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1909
1928
|
calculationData.calcDate = formatDate(this.formStore.productConditionsForm.calcDate as string)!.toISOString();
|
|
1910
1929
|
}
|
|
1911
1930
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1912
|
-
if (calculationResponse.amount)
|
|
1913
|
-
|
|
1931
|
+
if (calculationResponse.amount)
|
|
1932
|
+
this.formStore.productConditionsForm.requestedSumInsured =
|
|
1933
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.amount) : this.getNumberWithSpaces(calculationResponse.amount);
|
|
1934
|
+
if (calculationResponse.premium)
|
|
1935
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
1936
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.premium) : this.getNumberWithSpaces(calculationResponse.premium);
|
|
1937
|
+
|
|
1914
1938
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1915
|
-
if (this.isKazyna || product === 'halykkazyna') {
|
|
1939
|
+
if (this.isKazyna || product === 'halykkazyna' || ((this.isGons || product === 'gons') && !useEnv().isProduction)) {
|
|
1916
1940
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1917
1941
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
|
|
1918
1942
|
} else {
|
|
@@ -1929,7 +1953,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1929
1953
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
|
|
1930
1954
|
}
|
|
1931
1955
|
if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
|
|
1932
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
1956
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(calculationResponse.mainPremiumWithCommission as number);
|
|
1933
1957
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.mainInsSum === 0 ? null : calculationResponse.mainInsSum);
|
|
1934
1958
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1935
1959
|
if (calculationResponse.agentCommission) {
|
|
@@ -1953,13 +1977,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1953
1977
|
this.isLoading = true;
|
|
1954
1978
|
try {
|
|
1955
1979
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1956
|
-
if (!this.isPension) await this.api.setApplication(this.getConditionsData());
|
|
1980
|
+
if (!this.isPension && !(this.formStore.lfb.add && (this.isLifeBusiness || this.isGns))) await this.api.setApplication(this.getConditionsData());
|
|
1957
1981
|
const result = ref();
|
|
1958
1982
|
result.value = await this.api.getCalculation(String(id));
|
|
1959
1983
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
1960
1984
|
this.formStore.applicationData = applicationData;
|
|
1961
1985
|
if (this.formStore.applicationData.addCoverDto) this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1962
|
-
if (this.isKazyna && this.currencies.usd) {
|
|
1986
|
+
if ((this.isKazyna || this.isGons) && this.currencies.usd) {
|
|
1963
1987
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1964
1988
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
|
|
1965
1989
|
} else {
|
|
@@ -1967,11 +1991,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1967
1991
|
}
|
|
1968
1992
|
}
|
|
1969
1993
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
|
|
1970
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
1971
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
1994
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
1995
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
1996
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium)
|
|
1997
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium);
|
|
1972
1998
|
} else {
|
|
1973
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1974
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.
|
|
1999
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
2000
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2001
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount)
|
|
2002
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount);
|
|
1975
2003
|
}
|
|
1976
2004
|
if (this.isLiferenta) {
|
|
1977
2005
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
@@ -1984,11 +2012,20 @@ export const useDataStore = defineStore('data', {
|
|
|
1984
2012
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
1985
2013
|
}
|
|
1986
2014
|
if (this.isLifeBusiness || this.isGns) {
|
|
1987
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2015
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(result.value);
|
|
1988
2016
|
if (applicationData.insuredApp && applicationData.insuredApp.length) {
|
|
1989
2017
|
const res = await this.newInsuredList(applicationData.insuredApp);
|
|
1990
2018
|
this.formStore.lfb.clients = res;
|
|
1991
2019
|
}
|
|
2020
|
+
if (this.formStore.lfb.add) {
|
|
2021
|
+
if (result.value > 0) {
|
|
2022
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
2023
|
+
this.formStore.productConditionsForm.requestedSumInsured = null;
|
|
2024
|
+
} else {
|
|
2025
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
2026
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = null;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
1992
2029
|
}
|
|
1993
2030
|
|
|
1994
2031
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
@@ -1997,6 +2034,38 @@ export const useDataStore = defineStore('data', {
|
|
|
1997
2034
|
}
|
|
1998
2035
|
this.isLoading = false;
|
|
1999
2036
|
},
|
|
2037
|
+
async reCalculateRefund(insSum: number, insSumMain: number, guaranteedPeriod: number, isOppv: boolean, transferContractMonthCount: number | null) {
|
|
2038
|
+
this.isLoading = true;
|
|
2039
|
+
try {
|
|
2040
|
+
const data = {
|
|
2041
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2042
|
+
insSum: insSum,
|
|
2043
|
+
insSumMain: insSumMain,
|
|
2044
|
+
guaranteedPeriod: guaranteedPeriod,
|
|
2045
|
+
isOppv: isOppv,
|
|
2046
|
+
transferContractMonthCount: transferContractMonthCount,
|
|
2047
|
+
};
|
|
2048
|
+
const response = await this.api.pensionannuityNew.reCalculateRefund(data);
|
|
2049
|
+
} catch (err) {
|
|
2050
|
+
ErrorHandler(err);
|
|
2051
|
+
}
|
|
2052
|
+
this.isLoading = false;
|
|
2053
|
+
},
|
|
2054
|
+
async calcParentContractSums(closeContractCompanyCode: string, closeContractCompanyName: string, isContractClosed: boolean) {
|
|
2055
|
+
this.isLoading = true;
|
|
2056
|
+
try {
|
|
2057
|
+
const data = {
|
|
2058
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2059
|
+
closeContractCompanyCode: closeContractCompanyCode,
|
|
2060
|
+
closeContractCompanyName: closeContractCompanyName,
|
|
2061
|
+
isContractClosed: isContractClosed,
|
|
2062
|
+
};
|
|
2063
|
+
const response = await this.api.pensionannuityNew.calcParentContractSums(data);
|
|
2064
|
+
} catch (err) {
|
|
2065
|
+
ErrorHandler(err);
|
|
2066
|
+
}
|
|
2067
|
+
this.isLoading = false;
|
|
2068
|
+
},
|
|
2000
2069
|
async calculatePremium(data: any) {
|
|
2001
2070
|
this.isLoading = true;
|
|
2002
2071
|
try {
|
|
@@ -2018,7 +2087,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2018
2087
|
async calculatePrice(taskId?: string) {
|
|
2019
2088
|
this.isLoading = true;
|
|
2020
2089
|
try {
|
|
2021
|
-
const priceForm: SetApplicationRequest = {};
|
|
2090
|
+
const priceForm: Types.SetApplicationRequest = {};
|
|
2022
2091
|
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
2023
2092
|
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
2024
2093
|
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
@@ -2065,7 +2134,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2065
2134
|
async startApplication(member: Member, processCode?: number) {
|
|
2066
2135
|
if (!member.iin) return false;
|
|
2067
2136
|
try {
|
|
2068
|
-
const data: StartApplicationType = {
|
|
2137
|
+
const data: Types.StartApplicationType = {
|
|
2069
2138
|
clientId: member.id,
|
|
2070
2139
|
iin: member.iin.replace(/-/g, ''),
|
|
2071
2140
|
longName: member.longName ?? '',
|
|
@@ -2083,11 +2152,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2083
2152
|
this.isLoading = onlyGet;
|
|
2084
2153
|
try {
|
|
2085
2154
|
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
2155
|
this.formStore.regNumber = applicationData.regNumber;
|
|
2092
2156
|
this.formStore.applicationData = applicationData;
|
|
2093
2157
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
@@ -2105,6 +2169,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2105
2169
|
|
|
2106
2170
|
const clientData = applicationData.clientApp;
|
|
2107
2171
|
const insuredData: any[] = applicationData.insuredApp;
|
|
2172
|
+
const slaveInsuredData: any = applicationData.slave?.insuredApp[0] ?? null;
|
|
2108
2173
|
const beneficiaryData: any[] = applicationData.beneficiaryApp;
|
|
2109
2174
|
const beneficialOwnerData: any[] = applicationData.beneficialOwnerApp;
|
|
2110
2175
|
const spokesmanData: any = applicationData.spokesmanApp;
|
|
@@ -2118,6 +2183,21 @@ export const useDataStore = defineStore('data', {
|
|
|
2118
2183
|
this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
|
|
2119
2184
|
}
|
|
2120
2185
|
|
|
2186
|
+
if ('pensionApp' in applicationData && applicationData.pensionApp) {
|
|
2187
|
+
this.formStore.pensionApp = applicationData.pensionApp;
|
|
2188
|
+
if ('slave' in applicationData && applicationData.slave) this.formStore.pensionApp.slave = applicationData.slave.pensionApp;
|
|
2189
|
+
if (setProductConditions) {
|
|
2190
|
+
const pensionKeysWithSpace = ['compulsoryContractAmount', 'compulsoryProfContractAmount', 'voluntaryContractAmount', 'ownFundsRaisAmount'];
|
|
2191
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2192
|
+
if (/\s/g.test(this.formStore.pensionApp[key]) === false) this.formStore.pensionApp[key] = this.getNumberWithSpaces(this.formStore.pensionApp[key]);
|
|
2193
|
+
});
|
|
2194
|
+
if (this.formStore.pensionApp.slave)
|
|
2195
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2196
|
+
if (/\s/g.test(this.formStore.pensionApp.slave[key]) === false)
|
|
2197
|
+
this.formStore.pensionApp.slave[key] = this.getNumberWithSpaces(this.formStore.pensionApp.slave[key]);
|
|
2198
|
+
});
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2121
2201
|
if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
|
|
2122
2202
|
this.formStore.finCenterData = applicationData.finCenterData;
|
|
2123
2203
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
@@ -2182,11 +2262,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2182
2262
|
index: null,
|
|
2183
2263
|
});
|
|
2184
2264
|
}
|
|
2185
|
-
|
|
2186
|
-
if (applicationData.slave) {
|
|
2187
|
-
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
2265
|
if (insuredData && insuredData.length) {
|
|
2191
2266
|
insuredData.forEach((member, index) => {
|
|
2192
2267
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -2200,6 +2275,13 @@ export const useDataStore = defineStore('data', {
|
|
|
2200
2275
|
}
|
|
2201
2276
|
});
|
|
2202
2277
|
}
|
|
2278
|
+
if (slaveInsuredData) {
|
|
2279
|
+
allMembers.push({
|
|
2280
|
+
...slaveInsuredData,
|
|
2281
|
+
key: 'slaveInsuredForm',
|
|
2282
|
+
index: null,
|
|
2283
|
+
});
|
|
2284
|
+
}
|
|
2203
2285
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2204
2286
|
beneficiaryData.forEach((member, index) => {
|
|
2205
2287
|
const inStore = this.formStore.beneficiaryForm.find(each => each.id == member.insisId);
|
|
@@ -2237,12 +2319,14 @@ export const useDataStore = defineStore('data', {
|
|
|
2237
2319
|
this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
|
|
2238
2320
|
if (insuredData && insuredData.length) {
|
|
2239
2321
|
insuredData.forEach((each, index) => {
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2322
|
+
if (each) {
|
|
2323
|
+
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
2324
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
2325
|
+
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
2326
|
+
}
|
|
2243
2327
|
});
|
|
2244
2328
|
}
|
|
2245
|
-
|
|
2329
|
+
if (slaveInsuredData) this.setMembersFieldSlave();
|
|
2246
2330
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2247
2331
|
beneficiaryData.forEach((each, index) => {
|
|
2248
2332
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
@@ -2320,15 +2404,29 @@ export const useDataStore = defineStore('data', {
|
|
|
2320
2404
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
2321
2405
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
2322
2406
|
|
|
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
|
-
|
|
2407
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2408
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount)
|
|
2409
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount);
|
|
2410
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
2411
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium)
|
|
2412
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium);
|
|
2413
|
+
|
|
2414
|
+
if (this.isGons) {
|
|
2415
|
+
const govPremiums = await this.api.getGovernmentPremiums(String(this.formStore.applicationData.processInstanceId));
|
|
2416
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
|
|
2417
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
|
|
2418
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
|
|
2419
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
2420
|
+
const currency = constants.currencyList.find(item => item.code === applicationData.policyAppDto.currency);
|
|
2421
|
+
this.formStore.productConditionsForm.currency = currency ? currency : new Value();
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
if (this.isKazyna || this.isGons) {
|
|
2330
2425
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
|
|
2331
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
|
|
2426
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
|
|
2427
|
+
this.formStore.applicationData.processCode === constants.products.halykkazynaap
|
|
2428
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premiumInCurrency)
|
|
2429
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
|
|
2332
2430
|
}
|
|
2333
2431
|
const riskGroup = this.riskGroup.find(item => {
|
|
2334
2432
|
if (applicationData.policyAppDto.riskGroup == 0) {
|
|
@@ -2356,7 +2454,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2356
2454
|
async deleteTask(taskId: string) {
|
|
2357
2455
|
this.isLoading = true;
|
|
2358
2456
|
try {
|
|
2359
|
-
const data: SendTask = {
|
|
2457
|
+
const data: Types.SendTask = {
|
|
2360
2458
|
taskId: taskId,
|
|
2361
2459
|
decision: 'rejectclient',
|
|
2362
2460
|
comment: 'Клиент отказался',
|
|
@@ -2409,6 +2507,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2409
2507
|
case constants.actions.signed:
|
|
2410
2508
|
case constants.actions.rejectclient:
|
|
2411
2509
|
case constants.actions.accept:
|
|
2510
|
+
case constants.actions.recalc:
|
|
2412
2511
|
case constants.actions.payed: {
|
|
2413
2512
|
try {
|
|
2414
2513
|
const sended = await this.sendTask(taskId, action, comment);
|
|
@@ -2462,9 +2561,14 @@ export const useDataStore = defineStore('data', {
|
|
|
2462
2561
|
}
|
|
2463
2562
|
},
|
|
2464
2563
|
async createInvoice() {
|
|
2465
|
-
|
|
2564
|
+
const premium =
|
|
2565
|
+
this.isLifeBusiness || this.isGns ? this.formStore.applicationData.policyAppDto?.mainPremiumWithCommission : this.formStore.applicationData.policyAppDto?.premium;
|
|
2566
|
+
if (!premium) {
|
|
2567
|
+
this.showToaster('error', this.t('toaster.notZeroPremium'));
|
|
2568
|
+
return;
|
|
2569
|
+
}
|
|
2466
2570
|
try {
|
|
2467
|
-
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId,
|
|
2571
|
+
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId, premium);
|
|
2468
2572
|
return !!created;
|
|
2469
2573
|
} catch (err) {
|
|
2470
2574
|
this.isLoading = false;
|
|
@@ -2480,7 +2584,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2480
2584
|
console.log(err);
|
|
2481
2585
|
}
|
|
2482
2586
|
},
|
|
2483
|
-
setMembersField(whichForm: SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2587
|
+
setMembersField(whichForm: Types.SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2484
2588
|
this.formStore[whichForm].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember].familyStatusId);
|
|
2485
2589
|
this.formStore[whichForm].signOfIPDL = this.findObject(
|
|
2486
2590
|
'ipdl',
|
|
@@ -2497,17 +2601,46 @@ export const useDataStore = defineStore('data', {
|
|
|
2497
2601
|
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
|
|
2498
2602
|
this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2499
2603
|
}
|
|
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.
|
|
2604
|
+
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.pensionApp) {
|
|
2605
|
+
this.formStore[whichForm].bankInfo.iik = this.formStore.pensionApp.account;
|
|
2606
|
+
this.formStore[whichForm].bankInfo.bik = this.formStore.pensionApp.bankBik;
|
|
2607
|
+
this.formStore[whichForm].bankInfo.bankName.id = this.formStore.pensionApp.bankId;
|
|
2608
|
+
this.formStore[whichForm].bankInfo.bankName.nameRu = this.formStore.pensionApp.bankName;
|
|
2609
|
+
this.formStore[whichForm].bankInfo.bin = reformatIin(this.formStore.pensionApp.bankBin);
|
|
2610
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.transferContractCompany);
|
|
2611
|
+
this.formStore.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2508
2612
|
}
|
|
2509
2613
|
},
|
|
2510
|
-
|
|
2614
|
+
setMembersFieldSlave() {
|
|
2615
|
+
this.formStore.slaveInsuredForm.familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData.slave['insuredApp'].familyStatusId);
|
|
2616
|
+
this.formStore.slaveInsuredForm.signOfIPDL = this.findObject(
|
|
2617
|
+
'ipdl',
|
|
2618
|
+
'nameRu',
|
|
2619
|
+
this.formStore.applicationData.slave.insuredApp[0].isIpdl === null ? null : this.formStore.applicationData.slave.insuredApp[0].isIpdl == true ? 'Да' : 'Нет',
|
|
2620
|
+
);
|
|
2621
|
+
this.formStore.slaveInsuredForm.gotFromInsis = false;
|
|
2622
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].profession) this.formStore.slaveInsuredForm.job = this.formStore.applicationData.slave.insuredApp[0].profession;
|
|
2623
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].position) this.formStore.slaveInsuredForm.jobPosition = this.formStore.applicationData.slave.insuredApp[0].position;
|
|
2624
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].jobName) this.formStore.slaveInsuredForm.jobPlace = this.formStore.applicationData.slave.insuredApp[0].jobName;
|
|
2625
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].positionCode)
|
|
2626
|
+
this.formStore.slaveInsuredForm.positionCode = this.formStore.applicationData.slave.insuredApp[0].positionCode;
|
|
2627
|
+
if (typeof this.formStore.applicationData.slave.insuredApp[0].isDisability === 'boolean')
|
|
2628
|
+
this.formStore.slaveInsuredForm.isDisability = this.formStore.applicationData.slave.insuredApp[0].isDisability;
|
|
2629
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId) {
|
|
2630
|
+
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId);
|
|
2631
|
+
this.formStore.slaveInsuredForm.disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2632
|
+
}
|
|
2633
|
+
if (this.formStore.slaveInsuredForm.bankInfo) {
|
|
2634
|
+
this.formStore.slaveInsuredForm.bankInfo.iik = this.formStore.pensionApp.slave.account;
|
|
2635
|
+
this.formStore.slaveInsuredForm.bankInfo.bik = this.formStore.pensionApp.slave.bankBik;
|
|
2636
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.id = this.formStore.pensionApp.slave.bankId;
|
|
2637
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.nameRu = this.formStore.pensionApp.slave.bankName;
|
|
2638
|
+
this.formStore.slaveInsuredForm.bankInfo.bin = reformatIin(this.formStore.pensionApp.slave.bankBin);
|
|
2639
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.slave.transferContractCompany);
|
|
2640
|
+
this.formStore.pensionApp.slave.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2641
|
+
}
|
|
2642
|
+
},
|
|
2643
|
+
setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
2511
2644
|
if ('familyStatus' in this.formStore[whichForm][index]) {
|
|
2512
2645
|
this.formStore[whichForm][index].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember][index].familyStatusId);
|
|
2513
2646
|
}
|
|
@@ -2543,7 +2676,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2543
2676
|
if (this.formStore.signUrls.length) {
|
|
2544
2677
|
return this.formStore.signUrls;
|
|
2545
2678
|
}
|
|
2546
|
-
const prepareSignDocuments = (): SignDataType[] => {
|
|
2679
|
+
const prepareSignDocuments = (): Types.SignDataType[] => {
|
|
2547
2680
|
switch (this.formStore.applicationData.statusCode) {
|
|
2548
2681
|
case 'ContractSignedFrom':
|
|
2549
2682
|
return [
|
|
@@ -2601,94 +2734,17 @@ export const useDataStore = defineStore('data', {
|
|
|
2601
2734
|
};
|
|
2602
2735
|
const data = prepareSignDocuments();
|
|
2603
2736
|
if (type === 'qr') {
|
|
2604
|
-
const groupId = await this.api.signQR(data);
|
|
2737
|
+
const groupId = await this.api.file.signQR(data);
|
|
2605
2738
|
return groupId;
|
|
2606
2739
|
} else if (type === 'qrXml') {
|
|
2607
|
-
const signData = await this.api.signXml(data);
|
|
2740
|
+
const signData = await this.api.file.signXml(data);
|
|
2608
2741
|
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
2742
|
} else {
|
|
2687
|
-
if (this.processCode === 19 || this.processCode ===
|
|
2688
|
-
const result = await this.api.signBts(data);
|
|
2743
|
+
if (this.processCode === 19 || this.processCode === 24 || this.processCode === 25) {
|
|
2744
|
+
const result = await this.api.file.signBts(data);
|
|
2689
2745
|
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2690
2746
|
} else {
|
|
2691
|
-
const result = await this.api.signDocument(data);
|
|
2747
|
+
const result = await this.api.file.signDocument(data);
|
|
2692
2748
|
this.formStore.signUrls = result;
|
|
2693
2749
|
}
|
|
2694
2750
|
return this.formStore.signUrls;
|
|
@@ -2697,6 +2753,84 @@ export const useDataStore = defineStore('data', {
|
|
|
2697
2753
|
ErrorHandler(err);
|
|
2698
2754
|
}
|
|
2699
2755
|
},
|
|
2756
|
+
async nclayerSign(groupId: string, signType: number, isXml: boolean = false, processInstanceId?: string) {
|
|
2757
|
+
try {
|
|
2758
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2759
|
+
await ncaLayerClient.connect();
|
|
2760
|
+
const activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2761
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2762
|
+
const document = await this.getFileNew(groupId, signType, isXml);
|
|
2763
|
+
if (isXml) {
|
|
2764
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, document, 'SIGNATURE', '');
|
|
2765
|
+
const data = new FormData();
|
|
2766
|
+
data.append('processInstanceId', processInstanceId ?? String(this.formStore.applicationData.processInstanceId));
|
|
2767
|
+
data.append('xmlData', signedAgreement);
|
|
2768
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2769
|
+
data.append('format', 'xml');
|
|
2770
|
+
data.append('EdsXmlId', groupId);
|
|
2771
|
+
await this.api.file.uploadXml(data);
|
|
2772
|
+
} else {
|
|
2773
|
+
const base64EncodedSignature = await ncaLayerClient.createCAdESFromBase64(storageType, document, 'SIGNATURE', true);
|
|
2774
|
+
await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
|
|
2775
|
+
}
|
|
2776
|
+
return true;
|
|
2777
|
+
} catch (err: any) {
|
|
2778
|
+
return err.name === 'NCALayerError' ? null : ErrorHandler(err);
|
|
2779
|
+
}
|
|
2780
|
+
},
|
|
2781
|
+
async getFileNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
|
|
2782
|
+
try {
|
|
2783
|
+
let response: any = await this.api.file.generalGetFile(groupId, xml ? 5 : documentSignType);
|
|
2784
|
+
let blob;
|
|
2785
|
+
if (response.hasOwnProperty('data')) {
|
|
2786
|
+
const document = JSON.parse(response.data).Document;
|
|
2787
|
+
blob = new Blob([document.documentXml], {
|
|
2788
|
+
type: `application/xml`,
|
|
2789
|
+
});
|
|
2790
|
+
response = document.documentXml;
|
|
2791
|
+
} else {
|
|
2792
|
+
blob = new Blob([response], {
|
|
2793
|
+
type: `application/pdf`,
|
|
2794
|
+
});
|
|
2795
|
+
}
|
|
2796
|
+
const url = window.URL.createObjectURL(blob);
|
|
2797
|
+
if (!xml) {
|
|
2798
|
+
const link = document.createElement('a');
|
|
2799
|
+
link.href = url;
|
|
2800
|
+
link.setAttribute('download', fileName ?? `Документ ПА`);
|
|
2801
|
+
document.body.appendChild(link);
|
|
2802
|
+
link.click();
|
|
2803
|
+
}
|
|
2804
|
+
window.open(url, '_blank', `right=100`);
|
|
2805
|
+
return response;
|
|
2806
|
+
} catch (err) {
|
|
2807
|
+
ErrorHandler(err);
|
|
2808
|
+
}
|
|
2809
|
+
},
|
|
2810
|
+
async generateSign(taskId: string) {
|
|
2811
|
+
try {
|
|
2812
|
+
const signatories = await this.api.file.generateSign({ taskId });
|
|
2813
|
+
if (Array.isArray(signatories)) {
|
|
2814
|
+
signatories.forEach(signatory =>
|
|
2815
|
+
signatory.fileDatas?.sort(function (a: any, b: any) {
|
|
2816
|
+
return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
|
|
2817
|
+
}),
|
|
2818
|
+
);
|
|
2819
|
+
this.formStore.signatories = signatories;
|
|
2820
|
+
}
|
|
2821
|
+
} catch (err) {
|
|
2822
|
+
ErrorHandler(err);
|
|
2823
|
+
this.formStore.signatories = [];
|
|
2824
|
+
}
|
|
2825
|
+
},
|
|
2826
|
+
async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
|
|
2827
|
+
try {
|
|
2828
|
+
const response = await this.api.file.generalSign(data);
|
|
2829
|
+
return response;
|
|
2830
|
+
} catch (err) {
|
|
2831
|
+
ErrorHandler(err);
|
|
2832
|
+
}
|
|
2833
|
+
},
|
|
2700
2834
|
async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
|
|
2701
2835
|
try {
|
|
2702
2836
|
this.isButtonsLoading = true;
|
|
@@ -2758,12 +2892,12 @@ export const useDataStore = defineStore('data', {
|
|
|
2758
2892
|
try {
|
|
2759
2893
|
this.isButtonsLoading = true;
|
|
2760
2894
|
this.formStore.needToScanSignedContract = true;
|
|
2761
|
-
const data: SignDataType = {
|
|
2895
|
+
const data: Types.SignDataType = {
|
|
2762
2896
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2763
2897
|
name: 'Contract',
|
|
2764
2898
|
format: 'pdf',
|
|
2765
2899
|
};
|
|
2766
|
-
const response: any = await this.api.generateDocument(data);
|
|
2900
|
+
const response: any = await this.api.file.generateDocument(data);
|
|
2767
2901
|
const blob = new Blob([response], {
|
|
2768
2902
|
type: `application/pdf`,
|
|
2769
2903
|
});
|
|
@@ -2814,7 +2948,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2814
2948
|
const formattedData = formatDate(this.formStore.finCenterData.date);
|
|
2815
2949
|
if (!formattedData) return;
|
|
2816
2950
|
this.isLoading = true;
|
|
2817
|
-
const data: RegNumberDataType = {
|
|
2951
|
+
const data: Types.RegNumberDataType = {
|
|
2818
2952
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2819
2953
|
regNumber: String(this.formStore.finCenterData.regNumber),
|
|
2820
2954
|
date: formattedData.toISOString(),
|
|
@@ -2829,7 +2963,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2829
2963
|
},
|
|
2830
2964
|
async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
|
|
2831
2965
|
if (!type || !phoneNumber || !text) return;
|
|
2832
|
-
const smsData: SmsDataType = {
|
|
2966
|
+
const smsData: Types.SmsDataType = {
|
|
2833
2967
|
iin: this.formStore.applicationData.clientApp.iin,
|
|
2834
2968
|
phoneNumber: formatPhone(phoneNumber),
|
|
2835
2969
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
@@ -2846,16 +2980,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2846
2980
|
this.isLoading = false;
|
|
2847
2981
|
}
|
|
2848
2982
|
},
|
|
2849
|
-
sanitize(text: string) {
|
|
2850
|
-
return text
|
|
2851
|
-
.replace(/\r?\n|\r/g, '')
|
|
2852
|
-
.replace(/\\/g, '')
|
|
2853
|
-
.replace(/"/g, '');
|
|
2854
|
-
},
|
|
2855
2983
|
async getSignedDocList(processInstanceId: string | number) {
|
|
2856
2984
|
if (processInstanceId !== 0) {
|
|
2857
2985
|
try {
|
|
2858
|
-
this.formStore.signedDocumentList = await this.api.getSignedDocList({
|
|
2986
|
+
this.formStore.signedDocumentList = await this.api.file.getSignedDocList({
|
|
2859
2987
|
processInstanceId: processInstanceId,
|
|
2860
2988
|
});
|
|
2861
2989
|
} catch (err) {
|
|
@@ -2895,7 +3023,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2895
3023
|
}
|
|
2896
3024
|
this.isLoading = false;
|
|
2897
3025
|
},
|
|
2898
|
-
async getValidateClientESBD(data: ESBDValidationType) {
|
|
3026
|
+
async getValidateClientESBD(data: Types.ESBDValidationType) {
|
|
2899
3027
|
try {
|
|
2900
3028
|
return await this.api.getValidateClientESBD(data);
|
|
2901
3029
|
} catch (err) {
|
|
@@ -2903,7 +3031,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2903
3031
|
return ErrorHandler(err);
|
|
2904
3032
|
}
|
|
2905
3033
|
},
|
|
2906
|
-
validateMultipleMembers(localKey: MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
3034
|
+
validateMultipleMembers(localKey: Types.MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2907
3035
|
if (this.formStore[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
2908
3036
|
if (this.formStore[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
2909
3037
|
const localMembers = [...this.formStore[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
@@ -2922,6 +3050,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2922
3050
|
}
|
|
2923
3051
|
}
|
|
2924
3052
|
}
|
|
3053
|
+
} else if (applicationKey === 'slave') {
|
|
3054
|
+
if (this.formStore.slaveInsuredForm && this.formStore.applicationData.slave) {
|
|
3055
|
+
const localSlave = this.formStore.slaveInsuredForm;
|
|
3056
|
+
const applicationSlave = this.formStore.applicationData.slave.insuredApp[0];
|
|
3057
|
+
if ((localSlave.id === applicationSlave.insisId && applicationSlave.iin === localSlave.iin?.replace(/-/g, '')) === false) {
|
|
3058
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3059
|
+
return false;
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
2925
3062
|
} else {
|
|
2926
3063
|
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2927
3064
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
@@ -2940,6 +3077,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2940
3077
|
return true;
|
|
2941
3078
|
},
|
|
2942
3079
|
async validateAllMembers(taskId: string, localCheck: boolean = false) {
|
|
3080
|
+
const policyholderDoc = this.formStore.signedDocumentList.find(
|
|
3081
|
+
i => i.iin === String(this.formStore.policyholderForm.iin).replaceAll('-', '') && (i.fileTypeCode === '1' || i.fileTypeCode === '2' || i.fileTypeCode === '4'),
|
|
3082
|
+
);
|
|
2943
3083
|
if (taskId === '0') {
|
|
2944
3084
|
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
2945
3085
|
return false;
|
|
@@ -2948,6 +3088,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2948
3088
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
2949
3089
|
return false;
|
|
2950
3090
|
}
|
|
3091
|
+
if (useEnv().isProduction && this.isInitiator() && this.isEfoParent && this.formStore.policyholderForm.iin && !policyholderDoc) {
|
|
3092
|
+
this.showToaster('error', this.t('toaster.needDigDoc', { text: 'страхователя' }));
|
|
3093
|
+
return false;
|
|
3094
|
+
}
|
|
2951
3095
|
if (this.members.insuredApp.has) {
|
|
2952
3096
|
if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
|
|
2953
3097
|
return false;
|
|
@@ -2960,6 +3104,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2960
3104
|
}
|
|
2961
3105
|
}
|
|
2962
3106
|
}
|
|
3107
|
+
if (this.formStore.applicationData.slave && this.validateMultipleMembers(this.formStore.insuredFormKey, 'slave', 'застрахованных') === false) {
|
|
3108
|
+
return false;
|
|
3109
|
+
}
|
|
2963
3110
|
if (this.members.beneficiaryApp.has) {
|
|
2964
3111
|
if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
|
|
2965
3112
|
return false;
|
|
@@ -3076,7 +3223,12 @@ export const useDataStore = defineStore('data', {
|
|
|
3076
3223
|
this.isLoading = true;
|
|
3077
3224
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
3078
3225
|
if (areMembersValid) {
|
|
3079
|
-
if (
|
|
3226
|
+
if (
|
|
3227
|
+
(!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) ||
|
|
3228
|
+
(this.isPension &&
|
|
3229
|
+
this.formStore.applicationData.pensionApp.isCalculated === true &&
|
|
3230
|
+
(this.formStore.applicationData.pensionApp.slave ? this.formStore.applicationData.pensionApp.slave.isCalculated === true : true))
|
|
3231
|
+
) {
|
|
3080
3232
|
if (this.controls.hasAnketa) {
|
|
3081
3233
|
const hasCritical =
|
|
3082
3234
|
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
@@ -3243,13 +3395,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3243
3395
|
if (!this.accessToken) return null;
|
|
3244
3396
|
try {
|
|
3245
3397
|
const decoded = jwtDecode(this.accessToken);
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3398
|
+
if (decoded) {
|
|
3399
|
+
const data = {
|
|
3400
|
+
userName: decoded.code,
|
|
3401
|
+
branchName: decoded.branchCode,
|
|
3402
|
+
bin: bin.replace(/-/g, ''),
|
|
3403
|
+
};
|
|
3404
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3405
|
+
return gbdulResponse;
|
|
3406
|
+
}
|
|
3407
|
+
return null;
|
|
3253
3408
|
} catch (err) {
|
|
3254
3409
|
return ErrorHandler(err);
|
|
3255
3410
|
}
|
|
@@ -3299,7 +3454,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3299
3454
|
this.isLoading = false;
|
|
3300
3455
|
return false;
|
|
3301
3456
|
}
|
|
3302
|
-
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Api.GBD.Person };
|
|
3457
|
+
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Types.Api.GBD.Person };
|
|
3303
3458
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
3304
3459
|
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
3305
3460
|
member.resetMember(false);
|
|
@@ -3316,7 +3471,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3316
3471
|
this.isLoading = false;
|
|
3317
3472
|
}
|
|
3318
3473
|
},
|
|
3319
|
-
async saveInStoreUserGBDFL(person: Api.GBD.Person, member: Member) {
|
|
3474
|
+
async saveInStoreUserGBDFL(person: Types.Api.GBD.Person, member: Member) {
|
|
3320
3475
|
member.firstName = person.name;
|
|
3321
3476
|
member.lastName = person.surname;
|
|
3322
3477
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
@@ -3331,69 +3486,72 @@ export const useDataStore = defineStore('data', {
|
|
|
3331
3486
|
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
3332
3487
|
if (gender) member.gender = gender;
|
|
3333
3488
|
|
|
3334
|
-
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
3489
|
+
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu ?? 'undefined', 'i')));
|
|
3335
3490
|
if (birthPlace) member.birthPlace = birthPlace;
|
|
3336
3491
|
|
|
3337
|
-
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
3492
|
+
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu ?? 'undefined', 'i')));
|
|
3338
3493
|
if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
|
|
3339
3494
|
|
|
3340
|
-
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu, 'i')));
|
|
3495
|
+
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu ?? 'undefined', 'i')));
|
|
3341
3496
|
if (regCountry) member.registrationCountry = regCountry;
|
|
3342
3497
|
|
|
3343
|
-
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
3498
|
+
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')));
|
|
3344
3499
|
if (regProvince) member.registrationProvince = regProvince;
|
|
3500
|
+
else member.registrationProvince = new Value();
|
|
3345
3501
|
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3502
|
+
let hasSetCity = false;
|
|
3503
|
+
let hasSetRegion = false;
|
|
3504
|
+
if (person.regAddress.city && String(person.regAddress.city).includes(', ')) {
|
|
3505
|
+
const personCities = String(person.regAddress.city).split(', ');
|
|
3506
|
+
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3507
|
+
const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
|
|
3508
|
+
if (possibleCity) {
|
|
3509
|
+
member.registrationCity = possibleCity;
|
|
3510
|
+
hasSetCity = true;
|
|
3511
|
+
break;
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
if (member.registrationCity.nameRu === null) {
|
|
3349
3515
|
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3350
|
-
const
|
|
3351
|
-
if (
|
|
3352
|
-
member.
|
|
3516
|
+
const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
|
|
3517
|
+
if (possibleRegion) {
|
|
3518
|
+
member.registrationRegion = possibleRegion;
|
|
3519
|
+
hasSetRegion = true;
|
|
3353
3520
|
break;
|
|
3354
3521
|
}
|
|
3355
3522
|
}
|
|
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
3523
|
}
|
|
3374
3524
|
}
|
|
3375
3525
|
|
|
3376
|
-
if (
|
|
3526
|
+
if (hasSetCity === false) {
|
|
3377
3527
|
const regCity = this.cities.find(
|
|
3378
|
-
i =>
|
|
3528
|
+
i =>
|
|
3529
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3530
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3531
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3379
3532
|
);
|
|
3380
3533
|
if (regCity) {
|
|
3381
3534
|
member.registrationCity = regCity;
|
|
3382
3535
|
const regType = this.localityTypes.find(i => String(i.nameRu) === 'город');
|
|
3383
3536
|
if (regType) member.registrationRegionType = regType;
|
|
3384
|
-
} else
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3537
|
+
} else member.registrationCity = new Value();
|
|
3538
|
+
}
|
|
3539
|
+
|
|
3540
|
+
if (hasSetRegion === false) {
|
|
3541
|
+
const regRegion = this.regions.find(
|
|
3542
|
+
i =>
|
|
3543
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3544
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3545
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3546
|
+
);
|
|
3547
|
+
if (regRegion) {
|
|
3548
|
+
member.registrationRegion = regRegion;
|
|
3549
|
+
const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
|
|
3550
|
+
if (regType) member.registrationRegionType = regType;
|
|
3551
|
+
} else member.registrationRegion = new Value();
|
|
3394
3552
|
}
|
|
3395
3553
|
|
|
3396
|
-
if (person.regAddress.street.includes(', ')) {
|
|
3554
|
+
if (person.regAddress.street && person.regAddress.street.includes(', ')) {
|
|
3397
3555
|
const personAddress = person.regAddress.street.split(', ');
|
|
3398
3556
|
const microDistrict = personAddress.find((i: string) => i.match(new RegExp('микрорайон', 'i')));
|
|
3399
3557
|
const quarter = personAddress.find((i: string) => i.match(new RegExp('квартал', 'i')));
|
|
@@ -3408,19 +3566,28 @@ export const useDataStore = defineStore('data', {
|
|
|
3408
3566
|
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
3409
3567
|
|
|
3410
3568
|
if (Array.isArray(person.documents.document)) {
|
|
3411
|
-
const
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
(i
|
|
3416
|
-
|
|
3569
|
+
const filteredDocuments = person.documents.document.filter(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00');
|
|
3570
|
+
const validDocument = this.isLifetrip
|
|
3571
|
+
? filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3572
|
+
: filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes['1UDL']) ??
|
|
3573
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.VNZ) ??
|
|
3574
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS);
|
|
3417
3575
|
if (validDocument) {
|
|
3418
|
-
const documentType = this.documentTypes.find(
|
|
3576
|
+
const documentType = this.documentTypes.find(
|
|
3577
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(validDocument.type.code)],
|
|
3578
|
+
);
|
|
3419
3579
|
if (documentType) member.documentType = documentType;
|
|
3420
3580
|
if (validDocument.number) member.documentNumber = validDocument.number;
|
|
3421
3581
|
if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
|
|
3422
3582
|
if (validDocument.endDate) member.documentExpire = reformatDate(validDocument.endDate);
|
|
3423
|
-
const documentIssuer = this.documentIssuers.find(i =>
|
|
3583
|
+
const documentIssuer = this.documentIssuers.find(i =>
|
|
3584
|
+
(i.nameRu as string).match(
|
|
3585
|
+
new RegExp(
|
|
3586
|
+
validDocument.issueOrganization.code === '001' ? 'МЮ РК' : validDocument.issueOrganization.code === '002' ? 'МВД РК' : validDocument.issueOrganization.nameRu,
|
|
3587
|
+
'i',
|
|
3588
|
+
),
|
|
3589
|
+
),
|
|
3590
|
+
);
|
|
3424
3591
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
3425
3592
|
}
|
|
3426
3593
|
} else {
|
|
@@ -3428,9 +3595,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3428
3595
|
if (
|
|
3429
3596
|
personDoc.status.code === '00' &&
|
|
3430
3597
|
new Date(personDoc.endDate) > new Date(Date.now()) &&
|
|
3431
|
-
(personDoc.type.code ===
|
|
3598
|
+
(personDoc.type.code === CoreEnums.GBD.DocTypes['1UDL'] || personDoc.type.code === CoreEnums.GBD.DocTypes.VNZ || personDoc.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3432
3599
|
) {
|
|
3433
|
-
const documentType = this.documentTypes.find(
|
|
3600
|
+
const documentType = this.documentTypes.find(
|
|
3601
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(personDoc.type.code)],
|
|
3602
|
+
);
|
|
3434
3603
|
if (documentType) member.documentType = documentType;
|
|
3435
3604
|
const documentNumber = personDoc.number;
|
|
3436
3605
|
if (documentNumber) member.documentNumber = documentNumber;
|
|
@@ -3438,7 +3607,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3438
3607
|
if (documentDate) member.documentDate = reformatDate(documentDate);
|
|
3439
3608
|
const documentExpire = personDoc.endDate;
|
|
3440
3609
|
if (documentExpire) member.documentExpire = reformatDate(documentExpire);
|
|
3441
|
-
const documentIssuer = this.documentIssuers.find(i =>
|
|
3610
|
+
const documentIssuer = this.documentIssuers.find(i =>
|
|
3611
|
+
(i.nameRu as string).match(
|
|
3612
|
+
new RegExp(personDoc.issueOrganization.code === '001' ? 'МЮ РК' : personDoc.issueOrganization.code === '002' ? 'МВД РК' : personDoc.issueOrganization.nameRu, 'i'),
|
|
3613
|
+
),
|
|
3614
|
+
);
|
|
3442
3615
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
3443
3616
|
}
|
|
3444
3617
|
}
|
|
@@ -3477,12 +3650,14 @@ export const useDataStore = defineStore('data', {
|
|
|
3477
3650
|
'clientData.authoritedPerson.bankInfo',
|
|
3478
3651
|
'clientData.authoritedPerson.economySectorCode',
|
|
3479
3652
|
'clientData.authoritedPerson.legalAddress',
|
|
3480
|
-
'clientData.authoritedPerson.placeOfBirth',
|
|
3481
|
-
'clientData.authoritedPerson.resident',
|
|
3482
3653
|
'clientData.authoritedPerson.taxResidentCountry',
|
|
3483
3654
|
'clientData.authoritedPerson.addTaxResidency',
|
|
3484
3655
|
]);
|
|
3485
3656
|
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3657
|
+
if (this.formStore.lfb.add) {
|
|
3658
|
+
policyholder.parentContractNumber = localStorage.getItem('policyNo');
|
|
3659
|
+
policyholder.parentContractId = localStorage.getItem('policyId');
|
|
3660
|
+
}
|
|
3486
3661
|
try {
|
|
3487
3662
|
const response = await this.api.startApplication(policyholder);
|
|
3488
3663
|
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
@@ -3514,7 +3689,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3514
3689
|
this.formStore.applicationData = applicationData;
|
|
3515
3690
|
this.formStore.regNumber = applicationData.regNumber;
|
|
3516
3691
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
3517
|
-
|
|
3518
3692
|
this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
|
|
3519
3693
|
this.formStore.applicationTaskId = taskId;
|
|
3520
3694
|
this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
|
|
@@ -3535,17 +3709,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3535
3709
|
|
|
3536
3710
|
this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
|
|
3537
3711
|
this.formStore.lfb.policyholder.isIpdl = applicationData.clientApp.isIpdl;
|
|
3538
|
-
this.formStore.lfb.policyholder.clientData = clientData;
|
|
3539
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
|
|
3540
|
-
this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
|
|
3541
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
|
|
3542
3712
|
this.formStore.lfb.clientId = clientId;
|
|
3543
|
-
this.
|
|
3544
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
|
|
3545
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
|
|
3546
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
|
|
3547
|
-
const gender = this.gender.find((i: Value) => i.id === clientData.authoritedPerson.gender);
|
|
3548
|
-
this.formStore.lfb.policyholder.clientData.authoritedPerson.gender = gender ? gender : new Value();
|
|
3713
|
+
this.getClientData(clientData);
|
|
3549
3714
|
|
|
3550
3715
|
if (clientData && clientData.activityTypes !== null) {
|
|
3551
3716
|
this.formStore.lfb.policyholderActivities = clientData.activityTypes;
|
|
@@ -3578,19 +3743,41 @@ export const useDataStore = defineStore('data', {
|
|
|
3578
3743
|
});
|
|
3579
3744
|
}
|
|
3580
3745
|
|
|
3746
|
+
this.formStore.productConditionsForm.lifeMultiply = parseProcents(applicationData.policyAppDto.lifeMultiply);
|
|
3747
|
+
this.formStore.productConditionsForm.lifeAdditive = parseProcents(applicationData.policyAppDto.lifeAdditive);
|
|
3748
|
+
this.formStore.productConditionsForm.lifeMultiplyClient = parseProcents(applicationData.policyAppDto.lifeMultiplyClient);
|
|
3749
|
+
this.formStore.productConditionsForm.lifeAdditiveClient = parseProcents(applicationData.policyAppDto.lifeAdditiveClient);
|
|
3750
|
+
this.formStore.productConditionsForm.adbMultiply = parseProcents(applicationData.policyAppDto.adbMultiply);
|
|
3751
|
+
this.formStore.productConditionsForm.adbAdditive = parseProcents(applicationData.policyAppDto.adbAdditive);
|
|
3752
|
+
this.formStore.productConditionsForm.disabilityMultiply = parseProcents(applicationData.policyAppDto.disabilityMultiply);
|
|
3753
|
+
this.formStore.productConditionsForm.disabilityAdditive = parseProcents(applicationData.policyAppDto.disabilityAdditive);
|
|
3754
|
+
|
|
3581
3755
|
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.policyAppDto.calcDate);
|
|
3582
3756
|
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.policyAppDto.contractEndDate);
|
|
3583
3757
|
this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission === 0 ? null : applicationData.policyAppDto.agentCommission;
|
|
3584
3758
|
this.formStore.productConditionsForm.fixInsSum = this.getNumberWithSpaces(applicationData.policyAppDto.fixInsSum === 0 ? null : applicationData.policyAppDto.fixInsSum);
|
|
3585
3759
|
this.formStore.productConditionsForm.coverPeriod = 12;
|
|
3586
3760
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount === 0 ? null : applicationData.policyAppDto.amount);
|
|
3587
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
3588
|
-
applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : applicationData.policyAppDto.mainPremiumWithCommission
|
|
3589
|
-
);
|
|
3761
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
3762
|
+
applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3590
3763
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
3591
3764
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
3592
3765
|
const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
|
|
3593
3766
|
this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
|
|
3767
|
+
|
|
3768
|
+
if (applicationData.parentPolicyDto !== null) {
|
|
3769
|
+
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.parentPolicyDto.contractInsrBegin);
|
|
3770
|
+
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.parentPolicyDto.contractInsrEnd);
|
|
3771
|
+
}
|
|
3772
|
+
if (this.formStore.lfb.add) {
|
|
3773
|
+
if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
|
|
3774
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3775
|
+
this.formStore.productConditionsForm.requestedSumInsured = null;
|
|
3776
|
+
} else {
|
|
3777
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3778
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = null;
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3594
3781
|
} catch (err) {
|
|
3595
3782
|
ErrorHandler(err);
|
|
3596
3783
|
if (err instanceof AxiosError) {
|
|
@@ -3601,7 +3788,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3601
3788
|
}
|
|
3602
3789
|
this.isLoading = false;
|
|
3603
3790
|
},
|
|
3604
|
-
async saveAccidentIncidents(data: AccidentIncidents[]) {
|
|
3791
|
+
async saveAccidentIncidents(data: Types.AccidentIncidents[]) {
|
|
3605
3792
|
try {
|
|
3606
3793
|
const dataCopy = JSON.parse(JSON.stringify(data));
|
|
3607
3794
|
for (const incident of dataCopy) {
|
|
@@ -3699,6 +3886,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3699
3886
|
premium: client.insuredPolicyData.premium,
|
|
3700
3887
|
premiumWithLoad: client.insuredPolicyData.premiumWithLoad,
|
|
3701
3888
|
hasAttachedFile: client.hasAttachedFile,
|
|
3889
|
+
insrBeginDate: client.insuredPolicyData.insrBeginDate ?? 'no',
|
|
3890
|
+
insrEndDate: client.insuredPolicyData.insrEndDate ?? 'no',
|
|
3702
3891
|
};
|
|
3703
3892
|
});
|
|
3704
3893
|
return clients;
|
|
@@ -3747,7 +3936,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3747
3936
|
return false;
|
|
3748
3937
|
}
|
|
3749
3938
|
|
|
3750
|
-
if (this.formStore.lfb.beneficialOwners) {
|
|
3939
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.beneficialOwners) {
|
|
3751
3940
|
if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
3752
3941
|
return false;
|
|
3753
3942
|
}
|
|
@@ -3758,7 +3947,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3758
3947
|
}
|
|
3759
3948
|
}
|
|
3760
3949
|
|
|
3761
|
-
if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3950
|
+
if (!this.formStore.lfb.add && this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3762
3951
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
|
|
3763
3952
|
return false;
|
|
3764
3953
|
}
|
|
@@ -3774,7 +3963,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3774
3963
|
}
|
|
3775
3964
|
}
|
|
3776
3965
|
|
|
3777
|
-
if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3966
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3778
3967
|
for (const client of this.formStore.lfb.clients) {
|
|
3779
3968
|
if (client.hasAttachedFile === false) {
|
|
3780
3969
|
this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
|
|
@@ -3783,18 +3972,75 @@ export const useDataStore = defineStore('data', {
|
|
|
3783
3972
|
}
|
|
3784
3973
|
}
|
|
3785
3974
|
|
|
3786
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3975
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3787
3976
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
3788
3977
|
return false;
|
|
3789
3978
|
}
|
|
3790
3979
|
|
|
3791
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3980
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3792
3981
|
this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
|
|
3793
3982
|
return false;
|
|
3794
3983
|
}
|
|
3795
3984
|
|
|
3985
|
+
if (this.controls.hasAttachment) {
|
|
3986
|
+
const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
|
|
3987
|
+
if (areValid) {
|
|
3988
|
+
if (this.isInitiator()) {
|
|
3989
|
+
await this.setINSISWorkData();
|
|
3990
|
+
}
|
|
3991
|
+
} else {
|
|
3992
|
+
this.isLoading = false;
|
|
3993
|
+
this.showToaster('error', this.t('toaster.attachManagerError'), 3000);
|
|
3994
|
+
return false;
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
|
|
3796
3998
|
return true;
|
|
3797
3999
|
},
|
|
4000
|
+
async getOnlineAccess(iin: string, documentType: string) {
|
|
4001
|
+
try {
|
|
4002
|
+
const data = {
|
|
4003
|
+
iinBin: iin.replaceAll('-', ''),
|
|
4004
|
+
documentType: documentType,
|
|
4005
|
+
};
|
|
4006
|
+
const response = await this.api.externalServices.getOnlineAccess(data);
|
|
4007
|
+
if (response.code === 'PROFILE_DIGIDOCS_INTERNAL_ERROR') {
|
|
4008
|
+
this.showToaster('error', this.t('toaster.notDigDoc'), 3000);
|
|
4009
|
+
return false;
|
|
4010
|
+
} else {
|
|
4011
|
+
return true;
|
|
4012
|
+
}
|
|
4013
|
+
} catch (err) {
|
|
4014
|
+
ErrorHandler(err);
|
|
4015
|
+
return null;
|
|
4016
|
+
}
|
|
4017
|
+
},
|
|
4018
|
+
async getDigitalDocuments(iin: string, processInstanceId: string, code: string) {
|
|
4019
|
+
try {
|
|
4020
|
+
const data = {
|
|
4021
|
+
iin: iin.replaceAll('-', ''),
|
|
4022
|
+
processInstanceId: processInstanceId,
|
|
4023
|
+
code: code.replace(/\s/g, ''),
|
|
4024
|
+
};
|
|
4025
|
+
await this.api.externalServices.getDigitalDocuments(data);
|
|
4026
|
+
return true;
|
|
4027
|
+
} catch (err) {
|
|
4028
|
+
ErrorHandler(err);
|
|
4029
|
+
return null;
|
|
4030
|
+
}
|
|
4031
|
+
},
|
|
4032
|
+
async updateDigitalDocumentsProfile(iin: string) {
|
|
4033
|
+
try {
|
|
4034
|
+
const data = {
|
|
4035
|
+
iinBin: iin.replaceAll('-', ''),
|
|
4036
|
+
};
|
|
4037
|
+
await this.api.externalServices.updateDigitalDocumentsProfile(data);
|
|
4038
|
+
this.showToaster('success', this.t('toaster.successProfile'), 3000);
|
|
4039
|
+
} catch (err) {
|
|
4040
|
+
ErrorHandler(err);
|
|
4041
|
+
return null;
|
|
4042
|
+
}
|
|
4043
|
+
},
|
|
3798
4044
|
async getVariableData(processCode: number) {
|
|
3799
4045
|
try {
|
|
3800
4046
|
const response = await this.api.getVariableData(0, processCode);
|
|
@@ -3824,6 +4070,24 @@ export const useDataStore = defineStore('data', {
|
|
|
3824
4070
|
return ErrorHandler(err);
|
|
3825
4071
|
}
|
|
3826
4072
|
},
|
|
4073
|
+
async getBankByAccountNumber(accountNumber: string) {
|
|
4074
|
+
try {
|
|
4075
|
+
const bank = await this.api.getBankByAccountNumber(accountNumber);
|
|
4076
|
+
return bank;
|
|
4077
|
+
} catch (err) {
|
|
4078
|
+
ErrorHandler(err);
|
|
4079
|
+
}
|
|
4080
|
+
},
|
|
4081
|
+
async getContractByBin(bin: string) {
|
|
4082
|
+
try {
|
|
4083
|
+
const contract = await this.api.getContractByBin(bin);
|
|
4084
|
+
contract.insrBegin = reformatDate(contract.insrBegin) ?? '';
|
|
4085
|
+
contract.insrEnd = reformatDate(contract.insrEnd) ?? '';
|
|
4086
|
+
return contract;
|
|
4087
|
+
} catch (err) {
|
|
4088
|
+
ErrorHandler(err);
|
|
4089
|
+
}
|
|
4090
|
+
},
|
|
3827
4091
|
async isCourseChanged(processInstanceId: string) {
|
|
3828
4092
|
try {
|
|
3829
4093
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -3832,7 +4096,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3832
4096
|
return ErrorHandler(err);
|
|
3833
4097
|
}
|
|
3834
4098
|
},
|
|
3835
|
-
async generateShortLink(url: string, template?: Api.GenerateShortLink.Templates) {
|
|
4099
|
+
async generateShortLink(url: string, template?: Types.Api.GenerateShortLink.Templates) {
|
|
3836
4100
|
try {
|
|
3837
4101
|
const response = await this.api.generateShortLink({
|
|
3838
4102
|
link: url,
|
|
@@ -3844,8 +4108,30 @@ export const useDataStore = defineStore('data', {
|
|
|
3844
4108
|
return ErrorHandler(err);
|
|
3845
4109
|
}
|
|
3846
4110
|
},
|
|
4111
|
+
getClientData(clientData: GroupMember) {
|
|
4112
|
+
this.formStore.lfb.policyholder.clientData = clientData;
|
|
4113
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
|
|
4114
|
+
this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
|
|
4115
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
|
|
4116
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.authorityDetails.date = reformatDate(clientData.authoritedPerson.authorityDetails.date as string);
|
|
4117
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
|
|
4118
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
|
|
4119
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
|
|
4120
|
+
const gender = this.gender.find((i: Value) => i.id === Number(clientData.authoritedPerson.gender));
|
|
4121
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.gender = gender ? gender : new Value();
|
|
4122
|
+
},
|
|
4123
|
+
async getParentApplication(bin: string) {
|
|
4124
|
+
try {
|
|
4125
|
+
const response = await this.api.getParentApplication(bin);
|
|
4126
|
+
if (response) {
|
|
4127
|
+
this.getClientData(response.clientApp.clientData);
|
|
4128
|
+
}
|
|
4129
|
+
} catch (err) {
|
|
4130
|
+
return ErrorHandler(err);
|
|
4131
|
+
}
|
|
4132
|
+
},
|
|
3847
4133
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
3848
|
-
if (this.isLifetrip || this.isPension) return false;
|
|
4134
|
+
if (this.isLifetrip || this.isPension || this.isBalam) return false;
|
|
3849
4135
|
switch (whichForm) {
|
|
3850
4136
|
case this.formStore.beneficiaryFormKey:
|
|
3851
4137
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -3856,7 +4142,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3856
4142
|
}
|
|
3857
4143
|
},
|
|
3858
4144
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
3859
|
-
if (this.
|
|
4145
|
+
if (this.isPension) return false;
|
|
3860
4146
|
switch (whichForm) {
|
|
3861
4147
|
case this.formStore.beneficiaryFormKey:
|
|
3862
4148
|
return false;
|
|
@@ -3864,18 +4150,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3864
4150
|
return true;
|
|
3865
4151
|
}
|
|
3866
4152
|
},
|
|
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
4153
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
3880
4154
|
if (this.isGons || this.isPension) return false;
|
|
3881
4155
|
switch (whichForm) {
|
|
@@ -3884,7 +4158,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3884
4158
|
}
|
|
3885
4159
|
},
|
|
3886
4160
|
hasBankSection(whichForm: keyof typeof StoreMembers) {
|
|
3887
|
-
if (!this.isPension) return false;
|
|
4161
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3888
4162
|
switch (whichForm) {
|
|
3889
4163
|
case 'beneficiaryForm':
|
|
3890
4164
|
return false;
|
|
@@ -3893,7 +4167,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3893
4167
|
}
|
|
3894
4168
|
},
|
|
3895
4169
|
hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
|
|
3896
|
-
if (!this.isPension) return false;
|
|
4170
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3897
4171
|
switch (whichForm) {
|
|
3898
4172
|
case 'beneficiaryForm':
|
|
3899
4173
|
return false;
|
|
@@ -3912,44 +4186,5 @@ export const useDataStore = defineStore('data', {
|
|
|
3912
4186
|
return false;
|
|
3913
4187
|
}
|
|
3914
4188
|
},
|
|
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
4189
|
},
|
|
3955
4190
|
});
|