hl-core 0.0.10-beta.4 → 0.0.10-beta.41
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 +338 -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 +48 -10
- 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 +838 -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 +143 -49
- package/composables/constants.ts +44 -0
- package/composables/fields.ts +6 -4
- package/composables/index.ts +298 -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 +80 -19
- package/nuxt.config.ts +10 -13
- package/package.json +12 -12
- package/plugins/head.ts +2 -1
- package/store/data.store.ts +802 -531
- package/store/member.store.ts +18 -6
- package/store/rules.ts +22 -2
- package/types/enum.ts +33 -2
- package/types/env.d.ts +2 -2
- package/types/form.ts +71 -74
- package/types/index.ts +924 -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,14 @@ 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',
|
|
68
|
+
isTumar: state => state.product === 'tumar',
|
|
62
69
|
isDSO: state => state.product === 'dso',
|
|
63
70
|
isUU: state => state.product === 'uu',
|
|
64
|
-
hasClientAnketa: state => state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
71
|
+
hasClientAnketa: state => Array.isArray(state.formStore.additionalInsuranceTerms) && state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10),
|
|
65
72
|
isClientAnketaCondition: state =>
|
|
73
|
+
Array.isArray(state.formStore.additionalInsuranceTerms) &&
|
|
66
74
|
!state.formStore.insuredForm.find(member => member.iin === state.formStore.policyholderForm.iin) &&
|
|
67
75
|
!!state.formStore.additionalInsuranceTerms.find(i => i.coverTypeCode === 10 && i.coverSumCode === 'included'),
|
|
68
76
|
},
|
|
@@ -159,22 +167,23 @@ export const useDataStore = defineStore('data', {
|
|
|
159
167
|
getUserRoles() {
|
|
160
168
|
if (this.accessToken && this.user.roles.length === 0) {
|
|
161
169
|
const decoded = jwtDecode(this.accessToken);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
if (decoded) {
|
|
171
|
+
this.user.id = String(decoded.sub);
|
|
172
|
+
this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
|
|
173
|
+
this.user.code = decoded.code;
|
|
174
|
+
this.user.branchCode = decoded.branchCode;
|
|
175
|
+
const key = getKeyWithPattern(decoded, 'role');
|
|
176
|
+
if (key) {
|
|
177
|
+
const roles = decoded[key as keyof Types.Utils.JwtToken];
|
|
178
|
+
if (typeof roles === 'string') {
|
|
179
|
+
this.user.roles.push(roles);
|
|
180
|
+
} else if (typeof roles === 'object') {
|
|
181
|
+
this.user.roles = roles;
|
|
182
|
+
}
|
|
171
183
|
}
|
|
172
184
|
}
|
|
173
185
|
}
|
|
174
186
|
},
|
|
175
|
-
getUserData() {
|
|
176
|
-
return this.accessToken ? jwtDecode(this.accessToken) : null;
|
|
177
|
-
},
|
|
178
187
|
async getUserGroups() {
|
|
179
188
|
try {
|
|
180
189
|
this.isLoading = true;
|
|
@@ -185,140 +194,17 @@ export const useDataStore = defineStore('data', {
|
|
|
185
194
|
this.isLoading = false;
|
|
186
195
|
}
|
|
187
196
|
},
|
|
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
197
|
isTask() {
|
|
308
198
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
309
199
|
},
|
|
310
200
|
validateAccess() {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return false;
|
|
319
|
-
} catch (err) {
|
|
320
|
-
return ErrorHandler(err);
|
|
321
|
-
}
|
|
201
|
+
const hasAccess = this.hasAccess();
|
|
202
|
+
if (this.isAML) return hasAccess.toAML;
|
|
203
|
+
if (this.isLKA) return hasAccess.toLKA;
|
|
204
|
+
if (this.isEFO) return hasAccess.toEFO;
|
|
205
|
+
if (this.isAULETTI) return hasAccess.toAULETTI;
|
|
206
|
+
if (this.isLKA_A) return hasAccess.toLKA_A;
|
|
207
|
+
return false;
|
|
322
208
|
},
|
|
323
209
|
async loginUser(login: string, password: string, numAttempt: number) {
|
|
324
210
|
try {
|
|
@@ -383,7 +269,7 @@ export const useDataStore = defineStore('data', {
|
|
|
383
269
|
return false;
|
|
384
270
|
}
|
|
385
271
|
},
|
|
386
|
-
async resetSelected(route: RouteType) {
|
|
272
|
+
async resetSelected(route: Types.RouteType) {
|
|
387
273
|
this.settings.open = false;
|
|
388
274
|
this.rightPanel.open = false;
|
|
389
275
|
this.panel.open = false;
|
|
@@ -397,39 +283,75 @@ export const useDataStore = defineStore('data', {
|
|
|
397
283
|
if (!file.id) return;
|
|
398
284
|
try {
|
|
399
285
|
this.isLoading = true;
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
286
|
+
if (this.isPension) {
|
|
287
|
+
await this.api.file.getFileNew(file.id).then((response: any) => {
|
|
288
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
289
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
290
|
+
const url = window.URL.createObjectURL(blob);
|
|
291
|
+
const link = document.createElement('a');
|
|
292
|
+
link.href = url;
|
|
293
|
+
if (mode === 'view') {
|
|
294
|
+
setTimeout(() => {
|
|
295
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
296
|
+
});
|
|
297
|
+
} else {
|
|
298
|
+
link.setAttribute('download', file.fileName!);
|
|
299
|
+
document.body.appendChild(link);
|
|
300
|
+
link.click();
|
|
301
|
+
}
|
|
410
302
|
} 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`);
|
|
303
|
+
const blob = new Blob([response], {
|
|
304
|
+
type: `application/${fileType}`,
|
|
425
305
|
});
|
|
306
|
+
const url = window.URL.createObjectURL(blob);
|
|
307
|
+
const link = document.createElement('a');
|
|
308
|
+
link.href = url;
|
|
309
|
+
if (mode === 'view') {
|
|
310
|
+
setTimeout(() => {
|
|
311
|
+
window.open(url, '_blank', `right=100`);
|
|
312
|
+
});
|
|
313
|
+
} else {
|
|
314
|
+
link.setAttribute('download', file.fileName!);
|
|
315
|
+
document.body.appendChild(link);
|
|
316
|
+
link.click();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
} else {
|
|
321
|
+
await this.api.file.getFile(file.id).then((response: any) => {
|
|
322
|
+
if (!['pdf', 'docx'].includes(fileType)) {
|
|
323
|
+
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
324
|
+
const url = window.URL.createObjectURL(blob);
|
|
325
|
+
const link = document.createElement('a');
|
|
326
|
+
link.href = url;
|
|
327
|
+
if (mode === 'view') {
|
|
328
|
+
setTimeout(() => {
|
|
329
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
330
|
+
});
|
|
331
|
+
} else {
|
|
332
|
+
link.setAttribute('download', file.fileName!);
|
|
333
|
+
document.body.appendChild(link);
|
|
334
|
+
link.click();
|
|
335
|
+
}
|
|
426
336
|
} else {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
337
|
+
const blob = new Blob([response], {
|
|
338
|
+
type: `application/${fileType}`,
|
|
339
|
+
});
|
|
340
|
+
const url = window.URL.createObjectURL(blob);
|
|
341
|
+
const link = document.createElement('a');
|
|
342
|
+
link.href = url;
|
|
343
|
+
if (mode === 'view') {
|
|
344
|
+
setTimeout(() => {
|
|
345
|
+
window.open(url, '_blank', `right=100`);
|
|
346
|
+
});
|
|
347
|
+
} else {
|
|
348
|
+
link.setAttribute('download', file.fileName!);
|
|
349
|
+
document.body.appendChild(link);
|
|
350
|
+
link.click();
|
|
351
|
+
}
|
|
430
352
|
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
433
355
|
} catch (err) {
|
|
434
356
|
ErrorHandler(err);
|
|
435
357
|
} finally {
|
|
@@ -438,7 +360,7 @@ export const useDataStore = defineStore('data', {
|
|
|
438
360
|
},
|
|
439
361
|
async deleteFile(data: DocumentItem) {
|
|
440
362
|
try {
|
|
441
|
-
await this.api.deleteFile(data);
|
|
363
|
+
await this.api.file.deleteFile(data);
|
|
442
364
|
this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
|
|
443
365
|
} catch (err) {
|
|
444
366
|
ErrorHandler(err);
|
|
@@ -447,7 +369,7 @@ export const useDataStore = defineStore('data', {
|
|
|
447
369
|
async uploadFiles(data: FormData, load: boolean = false) {
|
|
448
370
|
this.isLoading = load;
|
|
449
371
|
try {
|
|
450
|
-
await this.api.uploadFiles(data);
|
|
372
|
+
await this.api.file.uploadFiles(data);
|
|
451
373
|
return true;
|
|
452
374
|
} catch (err) {
|
|
453
375
|
return ErrorHandler(err);
|
|
@@ -457,14 +379,28 @@ export const useDataStore = defineStore('data', {
|
|
|
457
379
|
},
|
|
458
380
|
async getContragent(member: Member, load: boolean = true, showToaster: boolean = true) {
|
|
459
381
|
this.isLoading = load;
|
|
460
|
-
|
|
382
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
383
|
+
if (isNonResident) {
|
|
384
|
+
if (!member.firstName || !member.lastName) return;
|
|
385
|
+
} else {
|
|
386
|
+
if (!member.iin) return;
|
|
387
|
+
}
|
|
461
388
|
try {
|
|
462
|
-
const queryData =
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
389
|
+
const queryData = isNonResident
|
|
390
|
+
? {
|
|
391
|
+
firstName: member.firstName ?? '',
|
|
392
|
+
lastName: member.lastName ?? '',
|
|
393
|
+
middleName: member.middleName ?? '',
|
|
394
|
+
iin: '',
|
|
395
|
+
birthDate: member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
396
|
+
}
|
|
397
|
+
: {
|
|
398
|
+
firstName: '',
|
|
399
|
+
lastName: '',
|
|
400
|
+
middleName: '',
|
|
401
|
+
iin: member.iin ? member.iin.replace(/-/g, '') : '',
|
|
402
|
+
birthDate: '',
|
|
403
|
+
};
|
|
468
404
|
const contragentResponse = await this.api.getContragent(queryData);
|
|
469
405
|
if (contragentResponse.totalItems > 0) {
|
|
470
406
|
if (contragentResponse.items.length === 1) {
|
|
@@ -473,25 +409,32 @@ export const useDataStore = defineStore('data', {
|
|
|
473
409
|
const sortedByRegistrationDate = contragentResponse.items.sort(
|
|
474
410
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
475
411
|
);
|
|
476
|
-
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
412
|
+
if (!isNonResident) await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
477
413
|
}
|
|
478
414
|
member.gotFromInsis = true;
|
|
479
415
|
} else {
|
|
480
416
|
if (showToaster) this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
481
417
|
}
|
|
418
|
+
if (isNonResident) return contragentResponse;
|
|
482
419
|
} catch (err) {
|
|
483
420
|
ErrorHandler(err);
|
|
484
421
|
}
|
|
485
422
|
this.isLoading = false;
|
|
486
423
|
},
|
|
487
|
-
async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
|
|
424
|
+
async getContragentById(id: number, whichForm: keyof typeof StoreMembers | 'slaveInsuredForm', load: boolean = true, whichIndex: number | null = null) {
|
|
488
425
|
if (Number(id) === 0) return;
|
|
489
426
|
this.isLoading = load;
|
|
490
427
|
try {
|
|
491
|
-
const member =
|
|
428
|
+
const member =
|
|
429
|
+
this.isPension && whichForm === 'slaveInsuredForm'
|
|
430
|
+
? this.formStore.slaveInsuredForm
|
|
431
|
+
: whichIndex === null
|
|
432
|
+
? this.formStore[whichForm as Types.SingleMember]
|
|
433
|
+
: this.formStore[whichForm as Types.MultipleMember][whichIndex];
|
|
434
|
+
|
|
492
435
|
const contragentResponse = await this.api.getContragentById(id);
|
|
493
436
|
if (contragentResponse.totalItems > 0) {
|
|
494
|
-
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
437
|
+
await this.serializeContragentData(member, contragentResponse.items[0], whichForm);
|
|
495
438
|
} else {
|
|
496
439
|
this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
497
440
|
}
|
|
@@ -501,7 +444,7 @@ export const useDataStore = defineStore('data', {
|
|
|
501
444
|
this.isLoading = false;
|
|
502
445
|
}
|
|
503
446
|
},
|
|
504
|
-
async serializeContragentData(member: Member, contragent: ContragentType) {
|
|
447
|
+
async serializeContragentData(member: Member, contragent: Types.ContragentType, whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm') {
|
|
505
448
|
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
506
449
|
this.api.getContrAgentData(contragent.id),
|
|
507
450
|
this.api.getContrAgentContacts(contragent.id),
|
|
@@ -523,23 +466,34 @@ export const useDataStore = defineStore('data', {
|
|
|
523
466
|
if (addressResponse.status === 'fulfilled' && addressResponse.value && addressResponse.value.length) {
|
|
524
467
|
member.response.addresses = addressResponse.value;
|
|
525
468
|
}
|
|
526
|
-
this.parseContragent(
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
469
|
+
this.parseContragent(
|
|
470
|
+
member,
|
|
471
|
+
{
|
|
472
|
+
personalData: contragent,
|
|
473
|
+
data: questionairesResponse.status === 'fulfilled' ? questionairesResponse.value : undefined,
|
|
474
|
+
contacts: contactsResponse.status === 'fulfilled' ? contactsResponse.value : undefined,
|
|
475
|
+
documents: documentsResponse.status === 'fulfilled' ? documentsResponse.value : undefined,
|
|
476
|
+
address: addressResponse.status === 'fulfilled' ? addressResponse.value : undefined,
|
|
477
|
+
},
|
|
478
|
+
whichForm,
|
|
479
|
+
);
|
|
533
480
|
},
|
|
534
481
|
parseContragent(
|
|
535
482
|
member: Member,
|
|
536
|
-
user: {
|
|
483
|
+
user: {
|
|
484
|
+
personalData: Types.ContragentType;
|
|
485
|
+
data?: Types.ContragentQuestionaries[];
|
|
486
|
+
contacts?: Types.ContragentContacts[];
|
|
487
|
+
documents?: Types.ContragentDocuments[];
|
|
488
|
+
address?: Types.ContragentAddress[];
|
|
489
|
+
},
|
|
490
|
+
whichForm?: keyof typeof StoreMembers | 'slaveInsuredForm',
|
|
537
491
|
) {
|
|
538
492
|
member.verifyType = user.personalData.verifyType;
|
|
539
493
|
member.verifyDate = user.personalData.verifyDate;
|
|
540
494
|
member.iin = reformatIin(user.personalData.iin);
|
|
541
495
|
member.age = String(user.personalData.age);
|
|
542
|
-
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
496
|
+
const country = this.countries.find((i: Value) => i.nameRu?.match(new RegExp(user.personalData.birthPlace ?? 'undefined', 'i')));
|
|
543
497
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
544
498
|
const gender = this.gender.find((i: Value) => i.nameRu === user.personalData.genderName);
|
|
545
499
|
member.gender = gender ? gender : new Value();
|
|
@@ -556,13 +510,23 @@ export const useDataStore = defineStore('data', {
|
|
|
556
510
|
|
|
557
511
|
if ('documents' in user && user.documents && user.documents.length) {
|
|
558
512
|
member.documentsList = user.documents;
|
|
559
|
-
const documentByPriority = user.documents.find(i =>
|
|
513
|
+
const documentByPriority = user.documents.find(i => {
|
|
514
|
+
if (this.isLifetrip && (whichForm !== this.formStore.policyholderFormKey || this.formStore.isPolicyholderInsured === true)) {
|
|
515
|
+
return i.type === CoreEnums.Insis.DocTypes['PS'];
|
|
516
|
+
}
|
|
517
|
+
return i.type === CoreEnums.Insis.DocTypes['1UDL'];
|
|
518
|
+
});
|
|
560
519
|
const userDocument = documentByPriority ? documentByPriority : user.documents[0];
|
|
561
520
|
const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
|
|
562
521
|
const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
|
|
563
522
|
member.documentType = documentType ? documentType : new Value();
|
|
564
523
|
member.documentNumber = userDocument.number;
|
|
565
524
|
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
525
|
+
if (userDocument.issuerNameRu === 'Другое') {
|
|
526
|
+
member.documentIssuers.issuerOtherNameRu = userDocument.issuerOtherNameRu;
|
|
527
|
+
member.documentIssuers.issuerOtherNameOrig = userDocument.issuerOtherNameOrig;
|
|
528
|
+
member.documentIssuers.issuerOtherName = userDocument.issuerOtherName;
|
|
529
|
+
}
|
|
566
530
|
member.documentDate = reformatDate(userDocument.issueDate);
|
|
567
531
|
member.documentExpire = reformatDate(userDocument.expireDate);
|
|
568
532
|
}
|
|
@@ -615,7 +579,7 @@ export const useDataStore = defineStore('data', {
|
|
|
615
579
|
});
|
|
616
580
|
}
|
|
617
581
|
},
|
|
618
|
-
searchFromList(member: Member, searchIt: ContragentQuestionaries) {
|
|
582
|
+
searchFromList(member: Member, searchIt: Types.ContragentQuestionaries) {
|
|
619
583
|
const getQuestionariesData = () => {
|
|
620
584
|
switch (searchIt.questId) {
|
|
621
585
|
case '500003':
|
|
@@ -638,23 +602,30 @@ export const useDataStore = defineStore('data', {
|
|
|
638
602
|
if (qData && qData.from && qData.from.length && qData.field) {
|
|
639
603
|
const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
|
|
640
604
|
//@ts-ignore
|
|
641
|
-
member[qData.field] = qResult
|
|
605
|
+
member[qData.field] = qResult ?? new Value();
|
|
642
606
|
}
|
|
643
607
|
},
|
|
644
608
|
async alreadyInInsis(member: Member) {
|
|
645
|
-
|
|
609
|
+
const isNonResident = this.isPension && member.signOfResidency.ids === '500011.2';
|
|
610
|
+
if (isNonResident) {
|
|
611
|
+
if (!member.firstName || !member.lastName) return;
|
|
612
|
+
} else {
|
|
613
|
+
if (!member.iin) return;
|
|
614
|
+
}
|
|
646
615
|
try {
|
|
647
616
|
const queryData = {
|
|
648
|
-
iin: member.iin.replaceAll('-', ''),
|
|
617
|
+
iin: !!member.iin && !isNonResident ? member.iin.replaceAll('-', '') : '',
|
|
649
618
|
firstName: !!member.firstName ? member.firstName : '',
|
|
650
619
|
lastName: !!member.lastName ? member.lastName : '',
|
|
651
620
|
middleName: !!member.middleName ? member.middleName : '',
|
|
621
|
+
birthDate: !!member.birthDate ? formatDate(member.birthDate)?.toISOString() ?? '' : '',
|
|
652
622
|
};
|
|
653
623
|
const contragent = await this.api.getContragent(queryData);
|
|
654
624
|
if (contragent.totalItems > 0) {
|
|
655
625
|
if (contragent.items.length === 1) {
|
|
656
626
|
return contragent.items[0];
|
|
657
627
|
} else {
|
|
628
|
+
if (this.isPension && queryData.iin === '') return contragent.items.find(i => i.id === member.id);
|
|
658
629
|
const sortedByRegistrationDate = contragent.items.sort(
|
|
659
630
|
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
660
631
|
);
|
|
@@ -688,8 +659,8 @@ export const useDataStore = defineStore('data', {
|
|
|
688
659
|
}
|
|
689
660
|
},
|
|
690
661
|
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.
|
|
662
|
+
if (this.isGons && user.iin && whichForm === 'beneficiaryForm') {
|
|
663
|
+
const doesHaveActiveContract = await this.api.checkBeneficiariesActualPolicy(String(this.formStore.applicationData.processInstanceId));
|
|
693
664
|
if (doesHaveActiveContract) {
|
|
694
665
|
this.showToaster('error', this.t('toaster.doesHaveActiveContract'), 6000);
|
|
695
666
|
return false;
|
|
@@ -723,10 +694,10 @@ export const useDataStore = defineStore('data', {
|
|
|
723
694
|
}
|
|
724
695
|
}
|
|
725
696
|
try {
|
|
726
|
-
const contragentData: ContragentType = {
|
|
697
|
+
const contragentData: Types.ContragentType = {
|
|
727
698
|
id: Number(user.id),
|
|
728
699
|
type: Number(user.type),
|
|
729
|
-
iin: user.iin
|
|
700
|
+
iin: user.iin ? user.iin.replace(/-/g, '') : '',
|
|
730
701
|
longName: user.longName !== null ? user.longName : (user.lastName ?? '') + (user.firstName ?? '') + (user.middleName ?? ''),
|
|
731
702
|
lastName: user.lastName ?? '',
|
|
732
703
|
firstName: user.firstName ?? '',
|
|
@@ -753,7 +724,7 @@ export const useDataStore = defineStore('data', {
|
|
|
753
724
|
countryOfTaxResidency,
|
|
754
725
|
signOfResidency,
|
|
755
726
|
}))(user);
|
|
756
|
-
const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
727
|
+
const questionariesData: Types.ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
757
728
|
let questName = '';
|
|
758
729
|
let questionId = parseInt(question.ids as string).toString();
|
|
759
730
|
if (questionId === '500003') {
|
|
@@ -821,7 +792,7 @@ export const useDataStore = defineStore('data', {
|
|
|
821
792
|
}
|
|
822
793
|
|
|
823
794
|
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
824
|
-
const contactsData: ContragentContacts[] = [];
|
|
795
|
+
const contactsData: Types.ContragentContacts[] = [];
|
|
825
796
|
if (!!user.phoneNumber) {
|
|
826
797
|
contactsData.push({
|
|
827
798
|
contragentId: Number(user.id),
|
|
@@ -863,7 +834,7 @@ export const useDataStore = defineStore('data', {
|
|
|
863
834
|
|
|
864
835
|
const documentsData = user.documentsList;
|
|
865
836
|
const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
|
|
866
|
-
const userDocument: ContragentDocuments = {
|
|
837
|
+
const userDocument: Types.ContragentDocuments = {
|
|
867
838
|
contragentId: Number(user.id),
|
|
868
839
|
id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
|
|
869
840
|
description: null,
|
|
@@ -880,6 +851,11 @@ export const useDataStore = defineStore('data', {
|
|
|
880
851
|
verifyType: user.verifyType,
|
|
881
852
|
verifyDate: user.verifyDate,
|
|
882
853
|
};
|
|
854
|
+
if (user.documentIssuers.ids === '1') {
|
|
855
|
+
userDocument.issuerOtherName = user.documentIssuers.issuerOtherName;
|
|
856
|
+
userDocument.issuerOtherNameOrig = user.documentIssuers.issuerOtherNameOrig;
|
|
857
|
+
userDocument.issuerOtherNameRu = user.documentIssuers.issuerOtherNameRu;
|
|
858
|
+
}
|
|
883
859
|
if (hasAlreadyDocument !== -1) {
|
|
884
860
|
documentsData[hasAlreadyDocument] = userDocument;
|
|
885
861
|
} else {
|
|
@@ -888,7 +864,7 @@ export const useDataStore = defineStore('data', {
|
|
|
888
864
|
|
|
889
865
|
const checkForNull = (value: any) => (value ? value : '');
|
|
890
866
|
const userResponseAddress = 'response' in user && user.response && 'addresses' in user.response && user.response.addresses ? user.response.addresses : null;
|
|
891
|
-
const addressData: ContragentAddress[] = [];
|
|
867
|
+
const addressData: Types.ContragentAddress[] = [];
|
|
892
868
|
addressData.push({
|
|
893
869
|
id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
|
|
894
870
|
contragentId: Number(user.id),
|
|
@@ -954,6 +930,9 @@ export const useDataStore = defineStore('data', {
|
|
|
954
930
|
isIpdlCompliance: null,
|
|
955
931
|
isTerrorCompliance: null,
|
|
956
932
|
};
|
|
933
|
+
if (this.isPension && memberFromApplicaiton && memberFromApplicaiton.processInstanceId === this.formStore.applicationData.slave?.processInstanceId) {
|
|
934
|
+
data.processInstanceId = this.formStore.applicationData.slave.processInstanceId;
|
|
935
|
+
}
|
|
957
936
|
data.id = memberFromApplicaiton && memberFromApplicaiton.id ? memberFromApplicaiton.id : null;
|
|
958
937
|
if (whichMember === 'Client') {
|
|
959
938
|
data.isInsured = this.formStore.isPolicyholderInsured;
|
|
@@ -963,6 +942,12 @@ export const useDataStore = defineStore('data', {
|
|
|
963
942
|
data.jobName = member.jobPlace;
|
|
964
943
|
data.positionCode = member.positionCode;
|
|
965
944
|
data.familyStatusId = member.familyStatus.id;
|
|
945
|
+
if (this.isPension) {
|
|
946
|
+
data.id =
|
|
947
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
948
|
+
? this.formStore.applicationData.clientApp.id
|
|
949
|
+
: this.formStore.applicationData.slave.clientApp.id;
|
|
950
|
+
}
|
|
966
951
|
}
|
|
967
952
|
if (whichMember === 'Spokesman') {
|
|
968
953
|
if (!!memberFromApplicaiton && memberFromApplicaiton.iin !== data.iin) {
|
|
@@ -1021,6 +1006,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1021
1006
|
data.familyStatusId = member.familyStatus.id;
|
|
1022
1007
|
data.relationId = member.relationDegree.ids;
|
|
1023
1008
|
data.relationName = member.relationDegree.nameRu;
|
|
1009
|
+
if (this.isPension) {
|
|
1010
|
+
data.id =
|
|
1011
|
+
memberFromApplicaiton.processInstanceId === this.formStore.applicationData.processInstanceId
|
|
1012
|
+
? this.formStore.applicationData.insuredApp[0].id
|
|
1013
|
+
: this.formStore.applicationData.slave.insuredApp[0].id;
|
|
1014
|
+
}
|
|
1024
1015
|
}
|
|
1025
1016
|
if (whichMember === 'Beneficiary') {
|
|
1026
1017
|
if (
|
|
@@ -1065,10 +1056,20 @@ export const useDataStore = defineStore('data', {
|
|
|
1065
1056
|
}
|
|
1066
1057
|
}
|
|
1067
1058
|
},
|
|
1068
|
-
async setApplication(applicationData:
|
|
1059
|
+
async setApplication(applicationData: any, calculate: boolean = false) {
|
|
1069
1060
|
try {
|
|
1070
1061
|
this.isLoading = true;
|
|
1071
1062
|
this.isButtonsLoading = true;
|
|
1063
|
+
if (this.isPension) {
|
|
1064
|
+
applicationData.transferContractCompany = '';
|
|
1065
|
+
if (applicationData.slave) {
|
|
1066
|
+
applicationData.slave.guaranteedPeriod = applicationData.slave.guaranteedPeriod ?? 0;
|
|
1067
|
+
applicationData.slave.transferContractCompany = '';
|
|
1068
|
+
}
|
|
1069
|
+
if (Number(this.formStore.applicationData.processCode) === 24) {
|
|
1070
|
+
applicationData.transferContractAmount = applicationData.parentContractAmount - applicationData.refundAmount;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1072
1073
|
await this.api.setApplication(applicationData);
|
|
1073
1074
|
if (calculate) {
|
|
1074
1075
|
await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
|
|
@@ -1085,8 +1086,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1085
1086
|
},
|
|
1086
1087
|
getConditionsData() {
|
|
1087
1088
|
const conditionsData: {
|
|
1088
|
-
policyAppDto: PolicyAppDto;
|
|
1089
|
-
addCoversDto: AddCover[];
|
|
1089
|
+
policyAppDto: Types.PolicyAppDto;
|
|
1090
|
+
addCoversDto: Types.AddCover[];
|
|
1090
1091
|
} = {
|
|
1091
1092
|
policyAppDto: {
|
|
1092
1093
|
id: this.formStore.applicationData?.policyAppDto?.id,
|
|
@@ -1123,6 +1124,22 @@ export const useDataStore = defineStore('data', {
|
|
|
1123
1124
|
conditionsData.policyAppDto.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1124
1125
|
conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
|
|
1125
1126
|
}
|
|
1127
|
+
if (this.isGons) {
|
|
1128
|
+
conditionsData.policyAppDto.premiumInCurrency =
|
|
1129
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1130
|
+
conditionsData.policyAppDto.amountInCurrency =
|
|
1131
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1132
|
+
conditionsData.policyAppDto.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1133
|
+
conditionsData.policyAppDto.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1134
|
+
//@ts-ignore
|
|
1135
|
+
if (isNaN(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, ''))) {
|
|
1136
|
+
conditionsData.policyAppDto.amount = parseFloat(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, '').replace(',', '.'));
|
|
1137
|
+
}
|
|
1138
|
+
//@ts-ignore
|
|
1139
|
+
if (isNaN(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, ''))) {
|
|
1140
|
+
conditionsData.policyAppDto.premium = parseFloat(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, '').replace(',', '.'));
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1126
1143
|
if (this.isLiferenta) {
|
|
1127
1144
|
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1128
1145
|
conditionsData.policyAppDto.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1209,12 +1226,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1209
1226
|
}
|
|
1210
1227
|
if (value !== null && this.formStore.definedAnswersId[whichSurvey][filter].length) {
|
|
1211
1228
|
const answer = this.formStore.definedAnswersId[whichSurvey][filter].find((answer: any) => answer.nameRu.match(new RegExp(value, 'i')));
|
|
1212
|
-
|
|
1213
|
-
|
|
1229
|
+
if (this.formStore[whichSurvey]) {
|
|
1230
|
+
//@ts-ignore
|
|
1231
|
+
this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
|
|
1232
|
+
}
|
|
1214
1233
|
}
|
|
1215
1234
|
return this.formStore.definedAnswersId[whichSurvey];
|
|
1216
1235
|
},
|
|
1217
|
-
async setSurvey(data: AnketaFirst) {
|
|
1236
|
+
async setSurvey(data: Types.AnketaFirst) {
|
|
1218
1237
|
try {
|
|
1219
1238
|
this.isLoading = true;
|
|
1220
1239
|
const anketaToken = await this.api.setSurvey(data);
|
|
@@ -1228,7 +1247,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1228
1247
|
},
|
|
1229
1248
|
async setINSISWorkData(loading: boolean = true) {
|
|
1230
1249
|
if (!this.formStore.applicationData.insisWorkDataApp) return;
|
|
1231
|
-
const data: InsisWorkDataApp = {
|
|
1250
|
+
const data: Types.InsisWorkDataApp = {
|
|
1232
1251
|
id: this.formStore.applicationData.insisWorkDataApp.id,
|
|
1233
1252
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
1234
1253
|
agentId: Number(this.formStore.AgentData.agentId),
|
|
@@ -1242,6 +1261,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1242
1261
|
regionPolicyName: this.formStore.RegionPolicy.nameRu ?? '',
|
|
1243
1262
|
managerPolicy: this.formStore.ManagerPolicy.ids as string,
|
|
1244
1263
|
managerPolicyName: this.formStore.ManagerPolicy.nameRu ?? '',
|
|
1264
|
+
executorGPH: (this.formStore.ExecutorGPH.ids as string) ?? undefined,
|
|
1265
|
+
executorGPHName: this.formStore.ExecutorGPH.nameRu ?? undefined,
|
|
1245
1266
|
insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
|
|
1246
1267
|
};
|
|
1247
1268
|
try {
|
|
@@ -1454,7 +1475,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1454
1475
|
return await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1455
1476
|
},
|
|
1456
1477
|
async getEconomicActivityType() {
|
|
1457
|
-
|
|
1478
|
+
const makeCall = this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension || this.isCritical;
|
|
1479
|
+
if (makeCall) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
|
|
1458
1480
|
},
|
|
1459
1481
|
async getFamilyStatuses() {
|
|
1460
1482
|
return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
|
|
@@ -1466,42 +1488,40 @@ export const useDataStore = defineStore('data', {
|
|
|
1466
1488
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1467
1489
|
},
|
|
1468
1490
|
async getBanks() {
|
|
1469
|
-
|
|
1491
|
+
const makeCall = this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO || this.isCritical;
|
|
1492
|
+
if (makeCall) return await this.getFromApi('banks', 'getBanks');
|
|
1470
1493
|
},
|
|
1471
1494
|
async getInsuranceCompanies() {
|
|
1472
1495
|
if (this.isPension) return await this.getFromApi('transferContractCompanies', 'getInsuranceCompanies');
|
|
1473
1496
|
},
|
|
1474
1497
|
async getProcessIndexRate() {
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
}
|
|
1498
|
+
const makeCall = (this.isBaiterek || this.isBolashak || this.isGons) && this.processCode;
|
|
1499
|
+
if (makeCall) return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
1478
1500
|
},
|
|
1479
1501
|
async getProcessPaymentPeriod() {
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1502
|
+
const makeCall = !this.isPension && this.processCode;
|
|
1503
|
+
if (makeCall) return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
|
|
1504
|
+
},
|
|
1505
|
+
async getProgramType() {
|
|
1506
|
+
const makeCall = this.isCritical && this.processCode;
|
|
1507
|
+
if (makeCall) return await this.getFromApi('programType', 'getProgramType', this.processCode);
|
|
1483
1508
|
},
|
|
1484
1509
|
async getQuestionRefs(id?: string) {
|
|
1485
1510
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1486
1511
|
},
|
|
1487
|
-
async getProcessTariff() {
|
|
1488
|
-
if (this.processCode) return await this.getFromApi('processTariff', 'getProcessTariff', this.processCode);
|
|
1489
|
-
},
|
|
1490
1512
|
async getDicAnnuityTypeList() {
|
|
1491
1513
|
return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
|
|
1492
1514
|
},
|
|
1493
1515
|
async getProcessAnnuityPaymentPeriod() {
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
}
|
|
1516
|
+
const makeCall = this.isLiferenta && this.processCode;
|
|
1517
|
+
if (makeCall) return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
|
|
1497
1518
|
},
|
|
1498
1519
|
async getInsurancePay() {
|
|
1499
1520
|
return await this.getFromApi('insurancePay', 'getInsurancePay');
|
|
1500
1521
|
},
|
|
1501
1522
|
async getProcessGfot() {
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
}
|
|
1523
|
+
const makeCall = (this.isLifeBusiness || this.isGns) && this.processCode;
|
|
1524
|
+
if (makeCall) return await this.getFromApi('processGfot', 'getProcessGfot', this.processCode);
|
|
1505
1525
|
},
|
|
1506
1526
|
async getCurrencies() {
|
|
1507
1527
|
try {
|
|
@@ -1520,7 +1540,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1520
1540
|
return this.gender;
|
|
1521
1541
|
},
|
|
1522
1542
|
async getAuthorityBasis() {
|
|
1523
|
-
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension
|
|
1543
|
+
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension || this.isCritical)
|
|
1544
|
+
return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
|
|
1524
1545
|
},
|
|
1525
1546
|
async getWorkPosition(search: string) {
|
|
1526
1547
|
try {
|
|
@@ -1548,8 +1569,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1548
1569
|
this.getFamilyStatuses(),
|
|
1549
1570
|
this.getRelationTypes(),
|
|
1550
1571
|
this.getProcessIndexRate(),
|
|
1551
|
-
this.getProcessTariff(),
|
|
1552
1572
|
this.getProcessPaymentPeriod(),
|
|
1573
|
+
this.getProgramType(),
|
|
1553
1574
|
this.getDicFileTypeList(),
|
|
1554
1575
|
this.getDicAnnuityTypeList(),
|
|
1555
1576
|
this.getProcessAnnuityPaymentPeriod(),
|
|
@@ -1658,16 +1679,16 @@ export const useDataStore = defineStore('data', {
|
|
|
1658
1679
|
column: column,
|
|
1659
1680
|
direction: direction,
|
|
1660
1681
|
groupCode: groupCode,
|
|
1661
|
-
processCodes:
|
|
1682
|
+
processCodes: this.isEFO
|
|
1683
|
+
? Object.values(constants.products).filter(
|
|
1684
|
+
i => i !== constants.products.pensionannuity && i !== constants.products.pensionannuityrefund && i !== constants.products.pensionannuityjoint,
|
|
1685
|
+
)
|
|
1686
|
+
: [constants.products.baiterek],
|
|
1662
1687
|
};
|
|
1663
1688
|
if (byOneProcess !== null) {
|
|
1664
1689
|
delete query.processCodes;
|
|
1665
1690
|
query.processCode = byOneProcess;
|
|
1666
1691
|
}
|
|
1667
|
-
if (byOneProcess === 19 && !useEnv().isProduction) {
|
|
1668
|
-
query.processCodes = [19, 2];
|
|
1669
|
-
delete query.processCode;
|
|
1670
|
-
}
|
|
1671
1692
|
const taskList = await this.api.getTaskList(
|
|
1672
1693
|
processInstanceId === null
|
|
1673
1694
|
? query
|
|
@@ -1781,6 +1802,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1781
1802
|
console.log(err);
|
|
1782
1803
|
}
|
|
1783
1804
|
},
|
|
1805
|
+
async filterExecutorByRegion(filterName: string) {
|
|
1806
|
+
try {
|
|
1807
|
+
this.ExecutorGPH = await this.api.filterExecutorByRegion('ExecutorGPH', filterName);
|
|
1808
|
+
} catch (err) {
|
|
1809
|
+
console.log(err);
|
|
1810
|
+
}
|
|
1811
|
+
},
|
|
1784
1812
|
async getUnderwritingCouncilData(id: string | number) {
|
|
1785
1813
|
try {
|
|
1786
1814
|
const response: any = await this.api.getUnderwritingCouncilData(id);
|
|
@@ -1872,7 +1900,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1872
1900
|
return;
|
|
1873
1901
|
}
|
|
1874
1902
|
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1875
|
-
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1903
|
+
const calculationData: Types.RecalculationDataType & Types.PolicyAppDto = {
|
|
1876
1904
|
signDate: signDate ? signDate.toISOString() : undefined,
|
|
1877
1905
|
birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
|
|
1878
1906
|
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
@@ -1891,6 +1919,23 @@ export const useDataStore = defineStore('data', {
|
|
|
1891
1919
|
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1892
1920
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1893
1921
|
}
|
|
1922
|
+
if (this.isGons || product === 'gons') {
|
|
1923
|
+
calculationData.premiumInCurrency =
|
|
1924
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1925
|
+
calculationData.amountInCurrency =
|
|
1926
|
+
this.formStore.productConditionsForm.currency.code === 'KZT' ? null : getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1927
|
+
calculationData.currencyExchangeRate = this.formStore.productConditionsForm.currency.code === 'KZT' ? null : this.currencies.usd;
|
|
1928
|
+
|
|
1929
|
+
calculationData.currency = this.formStore.productConditionsForm.currency.code as string;
|
|
1930
|
+
//@ts-ignore
|
|
1931
|
+
if (isNaN(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, ''))) {
|
|
1932
|
+
calculationData.amount = parseFloat(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, '').replace(',', '.'));
|
|
1933
|
+
}
|
|
1934
|
+
//@ts-ignore
|
|
1935
|
+
if (isNaN(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, ''))) {
|
|
1936
|
+
calculationData.premium = parseFloat(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, '').replace(',', '.'));
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1894
1939
|
if (this.isLiferenta || product === 'liferenta') {
|
|
1895
1940
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1896
1941
|
calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
|
|
@@ -1909,10 +1954,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1909
1954
|
calculationData.calcDate = formatDate(this.formStore.productConditionsForm.calcDate as string)!.toISOString();
|
|
1910
1955
|
}
|
|
1911
1956
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1912
|
-
if (calculationResponse.amount)
|
|
1913
|
-
|
|
1957
|
+
if (calculationResponse.amount)
|
|
1958
|
+
this.formStore.productConditionsForm.requestedSumInsured =
|
|
1959
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.amount) : this.getNumberWithSpaces(calculationResponse.amount);
|
|
1960
|
+
if (calculationResponse.premium)
|
|
1961
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
1962
|
+
this.isGons || product === 'gons' ? this.getNumberWithSpacesAfterComma(calculationResponse.premium) : this.getNumberWithSpaces(calculationResponse.premium);
|
|
1963
|
+
|
|
1914
1964
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1915
|
-
if (this.isKazyna || product === 'halykkazyna') {
|
|
1965
|
+
if (this.isKazyna || product === 'halykkazyna' || ((this.isGons || product === 'gons') && !useEnv().isProduction)) {
|
|
1916
1966
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1917
1967
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
|
|
1918
1968
|
} else {
|
|
@@ -1929,7 +1979,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1929
1979
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
|
|
1930
1980
|
}
|
|
1931
1981
|
if (this.isLifeBusiness || product === 'lifebusiness' || this.isGns || product === 'gns') {
|
|
1932
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
1982
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(calculationResponse.mainPremiumWithCommission as number);
|
|
1933
1983
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.mainInsSum === 0 ? null : calculationResponse.mainInsSum);
|
|
1934
1984
|
this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
|
|
1935
1985
|
if (calculationResponse.agentCommission) {
|
|
@@ -1953,13 +2003,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1953
2003
|
this.isLoading = true;
|
|
1954
2004
|
try {
|
|
1955
2005
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1956
|
-
if (!this.isPension) await this.api.setApplication(this.getConditionsData());
|
|
2006
|
+
if (!this.isPension && !(this.formStore.lfb.add && (this.isLifeBusiness || this.isGns))) await this.api.setApplication(this.getConditionsData());
|
|
1957
2007
|
const result = ref();
|
|
1958
2008
|
result.value = await this.api.getCalculation(String(id));
|
|
1959
2009
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
1960
2010
|
this.formStore.applicationData = applicationData;
|
|
1961
2011
|
if (this.formStore.applicationData.addCoverDto) this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1962
|
-
if (this.isKazyna && this.currencies.usd) {
|
|
2012
|
+
if ((this.isKazyna || this.isGons) && this.currencies.usd) {
|
|
1963
2013
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1964
2014
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
|
|
1965
2015
|
} else {
|
|
@@ -1967,11 +2017,15 @@ export const useDataStore = defineStore('data', {
|
|
|
1967
2017
|
}
|
|
1968
2018
|
}
|
|
1969
2019
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
|
|
1970
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
|
|
1971
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2020
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
2021
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
2022
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium)
|
|
2023
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium);
|
|
1972
2024
|
} else {
|
|
1973
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
|
|
1974
|
-
this.formStore.productConditionsForm.requestedSumInsured = this.
|
|
2025
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons ? this.getNumberWithSpacesAfterComma(result.value) : this.getNumberWithSpaces(result.value);
|
|
2026
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2027
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount)
|
|
2028
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount);
|
|
1975
2029
|
}
|
|
1976
2030
|
if (this.isLiferenta) {
|
|
1977
2031
|
this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
|
|
@@ -1984,11 +2038,22 @@ export const useDataStore = defineStore('data', {
|
|
|
1984
2038
|
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
1985
2039
|
}
|
|
1986
2040
|
if (this.isLifeBusiness || this.isGns) {
|
|
1987
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.
|
|
2041
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(result.value);
|
|
1988
2042
|
if (applicationData.insuredApp && applicationData.insuredApp.length) {
|
|
1989
2043
|
const res = await this.newInsuredList(applicationData.insuredApp);
|
|
1990
2044
|
this.formStore.lfb.clients = res;
|
|
1991
2045
|
}
|
|
2046
|
+
if (this.formStore.lfb.add) {
|
|
2047
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium);
|
|
2048
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount);
|
|
2049
|
+
if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
|
|
2050
|
+
this.formStore.productConditionsForm.amountPaid = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
2051
|
+
this.formStore.productConditionsForm.amountRefunded = null;
|
|
2052
|
+
} else {
|
|
2053
|
+
this.formStore.productConditionsForm.amountRefunded = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
2054
|
+
this.formStore.productConditionsForm.amountPaid = null;
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
1992
2057
|
}
|
|
1993
2058
|
|
|
1994
2059
|
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
@@ -1997,6 +2062,38 @@ export const useDataStore = defineStore('data', {
|
|
|
1997
2062
|
}
|
|
1998
2063
|
this.isLoading = false;
|
|
1999
2064
|
},
|
|
2065
|
+
async reCalculateRefund(insSum: number, insSumMain: number, guaranteedPeriod: number, isOppv: boolean, transferContractMonthCount: number | null) {
|
|
2066
|
+
this.isLoading = true;
|
|
2067
|
+
try {
|
|
2068
|
+
const data = {
|
|
2069
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2070
|
+
insSum: insSum,
|
|
2071
|
+
insSumMain: insSumMain,
|
|
2072
|
+
guaranteedPeriod: guaranteedPeriod,
|
|
2073
|
+
isOppv: isOppv,
|
|
2074
|
+
transferContractMonthCount: transferContractMonthCount,
|
|
2075
|
+
};
|
|
2076
|
+
const response = await this.api.pensionannuityNew.reCalculateRefund(data);
|
|
2077
|
+
} catch (err) {
|
|
2078
|
+
ErrorHandler(err);
|
|
2079
|
+
}
|
|
2080
|
+
this.isLoading = false;
|
|
2081
|
+
},
|
|
2082
|
+
async calcParentContractSums(closeContractCompanyCode: string, closeContractCompanyName: string, isContractClosed: boolean) {
|
|
2083
|
+
this.isLoading = true;
|
|
2084
|
+
try {
|
|
2085
|
+
const data = {
|
|
2086
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2087
|
+
closeContractCompanyCode: closeContractCompanyCode,
|
|
2088
|
+
closeContractCompanyName: closeContractCompanyName,
|
|
2089
|
+
isContractClosed: isContractClosed,
|
|
2090
|
+
};
|
|
2091
|
+
const response = await this.api.pensionannuityNew.calcParentContractSums(data);
|
|
2092
|
+
} catch (err) {
|
|
2093
|
+
ErrorHandler(err);
|
|
2094
|
+
}
|
|
2095
|
+
this.isLoading = false;
|
|
2096
|
+
},
|
|
2000
2097
|
async calculatePremium(data: any) {
|
|
2001
2098
|
this.isLoading = true;
|
|
2002
2099
|
try {
|
|
@@ -2018,7 +2115,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2018
2115
|
async calculatePrice(taskId?: string) {
|
|
2019
2116
|
this.isLoading = true;
|
|
2020
2117
|
try {
|
|
2021
|
-
const priceForm: SetApplicationRequest = {};
|
|
2118
|
+
const priceForm: Types.SetApplicationRequest = {};
|
|
2022
2119
|
priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
|
|
2023
2120
|
priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
|
|
2024
2121
|
priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
|
|
@@ -2065,7 +2162,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2065
2162
|
async startApplication(member: Member, processCode?: number) {
|
|
2066
2163
|
if (!member.iin) return false;
|
|
2067
2164
|
try {
|
|
2068
|
-
const data: StartApplicationType = {
|
|
2165
|
+
const data: Types.StartApplicationType = {
|
|
2069
2166
|
clientId: member.id,
|
|
2070
2167
|
iin: member.iin.replace(/-/g, ''),
|
|
2071
2168
|
longName: member.longName ?? '',
|
|
@@ -2083,11 +2180,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2083
2180
|
this.isLoading = onlyGet;
|
|
2084
2181
|
try {
|
|
2085
2182
|
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
2183
|
this.formStore.regNumber = applicationData.regNumber;
|
|
2092
2184
|
this.formStore.applicationData = applicationData;
|
|
2093
2185
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
@@ -2098,6 +2190,8 @@ export const useDataStore = defineStore('data', {
|
|
|
2098
2190
|
this.formStore.RegionPolicy.ids = applicationData.insisWorkDataApp.regionPolicy;
|
|
2099
2191
|
this.formStore.ManagerPolicy.nameRu = applicationData.insisWorkDataApp.managerPolicyName;
|
|
2100
2192
|
this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
|
|
2193
|
+
this.formStore.ExecutorGPH.nameRu = applicationData.insisWorkDataApp.executorGPHName;
|
|
2194
|
+
this.formStore.ExecutorGPH.ids = applicationData.insisWorkDataApp.executorGPH;
|
|
2101
2195
|
this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
|
|
2102
2196
|
this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
|
|
2103
2197
|
this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
|
|
@@ -2105,6 +2199,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2105
2199
|
|
|
2106
2200
|
const clientData = applicationData.clientApp;
|
|
2107
2201
|
const insuredData: any[] = applicationData.insuredApp;
|
|
2202
|
+
const slaveInsuredData: any = applicationData.slave?.insuredApp[0] ?? null;
|
|
2108
2203
|
const beneficiaryData: any[] = applicationData.beneficiaryApp;
|
|
2109
2204
|
const beneficialOwnerData: any[] = applicationData.beneficialOwnerApp;
|
|
2110
2205
|
const spokesmanData: any = applicationData.spokesmanApp;
|
|
@@ -2118,6 +2213,21 @@ export const useDataStore = defineStore('data', {
|
|
|
2118
2213
|
this.formStore.isPolicyholderBeneficiary = beneficiaryPolicyholderIndex !== -1;
|
|
2119
2214
|
}
|
|
2120
2215
|
|
|
2216
|
+
if ('pensionApp' in applicationData && applicationData.pensionApp) {
|
|
2217
|
+
this.formStore.pensionApp = applicationData.pensionApp;
|
|
2218
|
+
if ('slave' in applicationData && applicationData.slave) this.formStore.pensionApp.slave = applicationData.slave.pensionApp;
|
|
2219
|
+
if (setProductConditions) {
|
|
2220
|
+
const pensionKeysWithSpace = ['compulsoryContractAmount', 'compulsoryProfContractAmount', 'voluntaryContractAmount', 'ownFundsRaisAmount'];
|
|
2221
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2222
|
+
if (/\s/g.test(this.formStore.pensionApp[key]) === false) this.formStore.pensionApp[key] = this.getNumberWithSpaces(this.formStore.pensionApp[key]);
|
|
2223
|
+
});
|
|
2224
|
+
if (this.formStore.pensionApp.slave)
|
|
2225
|
+
pensionKeysWithSpace.forEach(key => {
|
|
2226
|
+
if (/\s/g.test(this.formStore.pensionApp.slave[key]) === false)
|
|
2227
|
+
this.formStore.pensionApp.slave[key] = this.getNumberWithSpaces(this.formStore.pensionApp.slave[key]);
|
|
2228
|
+
});
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2121
2231
|
if ('finCenterData' in applicationData && !!applicationData.finCenterData) {
|
|
2122
2232
|
this.formStore.finCenterData = applicationData.finCenterData;
|
|
2123
2233
|
this.formStore.finCenterData.regNumber = applicationData.finCenterData.regNumber;
|
|
@@ -2182,11 +2292,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2182
2292
|
index: null,
|
|
2183
2293
|
});
|
|
2184
2294
|
}
|
|
2185
|
-
|
|
2186
|
-
if (applicationData.slave) {
|
|
2187
|
-
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
2295
|
if (insuredData && insuredData.length) {
|
|
2191
2296
|
insuredData.forEach((member, index) => {
|
|
2192
2297
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -2200,6 +2305,13 @@ export const useDataStore = defineStore('data', {
|
|
|
2200
2305
|
}
|
|
2201
2306
|
});
|
|
2202
2307
|
}
|
|
2308
|
+
if (slaveInsuredData) {
|
|
2309
|
+
allMembers.push({
|
|
2310
|
+
...slaveInsuredData,
|
|
2311
|
+
key: 'slaveInsuredForm',
|
|
2312
|
+
index: null,
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2203
2315
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2204
2316
|
beneficiaryData.forEach((member, index) => {
|
|
2205
2317
|
const inStore = this.formStore.beneficiaryForm.find(each => each.id == member.insisId);
|
|
@@ -2237,12 +2349,14 @@ export const useDataStore = defineStore('data', {
|
|
|
2237
2349
|
this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
|
|
2238
2350
|
if (insuredData && insuredData.length) {
|
|
2239
2351
|
insuredData.forEach((each, index) => {
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2352
|
+
if (each) {
|
|
2353
|
+
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
2354
|
+
const relationDegree = this.relations.find((i: Value) => i.ids == each.relationId);
|
|
2355
|
+
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
2356
|
+
}
|
|
2243
2357
|
});
|
|
2244
2358
|
}
|
|
2245
|
-
|
|
2359
|
+
if (slaveInsuredData) this.setMembersFieldSlave();
|
|
2246
2360
|
if (beneficiaryData && beneficiaryData.length) {
|
|
2247
2361
|
beneficiaryData.forEach((each, index) => {
|
|
2248
2362
|
this.setMembersFieldIndex(this.formStore.beneficiaryFormKey, 'beneficiaryApp', index);
|
|
@@ -2320,15 +2434,29 @@ export const useDataStore = defineStore('data', {
|
|
|
2320
2434
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
2321
2435
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
2322
2436
|
|
|
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
|
-
|
|
2437
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.isGons
|
|
2438
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount)
|
|
2439
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount);
|
|
2440
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.isGons
|
|
2441
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium)
|
|
2442
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium);
|
|
2443
|
+
|
|
2444
|
+
if (this.isGons) {
|
|
2445
|
+
const govPremiums = await this.api.getGovernmentPremiums(String(this.formStore.applicationData.processInstanceId));
|
|
2446
|
+
this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(govPremiums.totalAmount5 === null ? null : govPremiums.totalAmount5);
|
|
2447
|
+
this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(govPremiums.totalAmount7 === null ? null : govPremiums.totalAmount7);
|
|
2448
|
+
this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
|
|
2449
|
+
this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
|
|
2450
|
+
const currency = constants.currencyList.find(item => item.code === applicationData.policyAppDto.currency);
|
|
2451
|
+
this.formStore.productConditionsForm.currency = currency ? currency : new Value();
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
if (this.isKazyna || this.isGons) {
|
|
2330
2455
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
|
|
2331
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
|
|
2456
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar =
|
|
2457
|
+
this.formStore.applicationData.processCode === constants.products.halykkazynaap
|
|
2458
|
+
? this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premiumInCurrency)
|
|
2459
|
+
: this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
|
|
2332
2460
|
}
|
|
2333
2461
|
const riskGroup = this.riskGroup.find(item => {
|
|
2334
2462
|
if (applicationData.policyAppDto.riskGroup == 0) {
|
|
@@ -2356,7 +2484,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2356
2484
|
async deleteTask(taskId: string) {
|
|
2357
2485
|
this.isLoading = true;
|
|
2358
2486
|
try {
|
|
2359
|
-
const data: SendTask = {
|
|
2487
|
+
const data: Types.SendTask = {
|
|
2360
2488
|
taskId: taskId,
|
|
2361
2489
|
decision: 'rejectclient',
|
|
2362
2490
|
comment: 'Клиент отказался',
|
|
@@ -2409,6 +2537,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2409
2537
|
case constants.actions.signed:
|
|
2410
2538
|
case constants.actions.rejectclient:
|
|
2411
2539
|
case constants.actions.accept:
|
|
2540
|
+
case constants.actions.recalc:
|
|
2412
2541
|
case constants.actions.payed: {
|
|
2413
2542
|
try {
|
|
2414
2543
|
const sended = await this.sendTask(taskId, action, comment);
|
|
@@ -2462,9 +2591,14 @@ export const useDataStore = defineStore('data', {
|
|
|
2462
2591
|
}
|
|
2463
2592
|
},
|
|
2464
2593
|
async createInvoice() {
|
|
2465
|
-
|
|
2594
|
+
const premium =
|
|
2595
|
+
this.isLifeBusiness || this.isGns ? this.formStore.applicationData.policyAppDto?.mainPremiumWithCommission : this.formStore.applicationData.policyAppDto?.premium;
|
|
2596
|
+
if (!premium) {
|
|
2597
|
+
this.showToaster('error', this.t('toaster.notZeroPremium'));
|
|
2598
|
+
return;
|
|
2599
|
+
}
|
|
2466
2600
|
try {
|
|
2467
|
-
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId,
|
|
2601
|
+
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId, premium);
|
|
2468
2602
|
return !!created;
|
|
2469
2603
|
} catch (err) {
|
|
2470
2604
|
this.isLoading = false;
|
|
@@ -2480,7 +2614,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2480
2614
|
console.log(err);
|
|
2481
2615
|
}
|
|
2482
2616
|
},
|
|
2483
|
-
setMembersField(whichForm: SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2617
|
+
setMembersField(whichForm: Types.SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
2484
2618
|
this.formStore[whichForm].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember].familyStatusId);
|
|
2485
2619
|
this.formStore[whichForm].signOfIPDL = this.findObject(
|
|
2486
2620
|
'ipdl',
|
|
@@ -2497,17 +2631,46 @@ export const useDataStore = defineStore('data', {
|
|
|
2497
2631
|
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
|
|
2498
2632
|
this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2499
2633
|
}
|
|
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.
|
|
2634
|
+
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.pensionApp) {
|
|
2635
|
+
this.formStore[whichForm].bankInfo.iik = this.formStore.pensionApp.account;
|
|
2636
|
+
this.formStore[whichForm].bankInfo.bik = this.formStore.pensionApp.bankBik;
|
|
2637
|
+
this.formStore[whichForm].bankInfo.bankName.id = this.formStore.pensionApp.bankId;
|
|
2638
|
+
this.formStore[whichForm].bankInfo.bankName.nameRu = this.formStore.pensionApp.bankName;
|
|
2639
|
+
this.formStore[whichForm].bankInfo.bin = reformatIin(this.formStore.pensionApp.bankBin);
|
|
2640
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.transferContractCompany);
|
|
2641
|
+
this.formStore.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2508
2642
|
}
|
|
2509
2643
|
},
|
|
2510
|
-
|
|
2644
|
+
setMembersFieldSlave() {
|
|
2645
|
+
this.formStore.slaveInsuredForm.familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData.slave['insuredApp'].familyStatusId);
|
|
2646
|
+
this.formStore.slaveInsuredForm.signOfIPDL = this.findObject(
|
|
2647
|
+
'ipdl',
|
|
2648
|
+
'nameRu',
|
|
2649
|
+
this.formStore.applicationData.slave.insuredApp[0].isIpdl === null ? null : this.formStore.applicationData.slave.insuredApp[0].isIpdl == true ? 'Да' : 'Нет',
|
|
2650
|
+
);
|
|
2651
|
+
this.formStore.slaveInsuredForm.gotFromInsis = false;
|
|
2652
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].profession) this.formStore.slaveInsuredForm.job = this.formStore.applicationData.slave.insuredApp[0].profession;
|
|
2653
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].position) this.formStore.slaveInsuredForm.jobPosition = this.formStore.applicationData.slave.insuredApp[0].position;
|
|
2654
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].jobName) this.formStore.slaveInsuredForm.jobPlace = this.formStore.applicationData.slave.insuredApp[0].jobName;
|
|
2655
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].positionCode)
|
|
2656
|
+
this.formStore.slaveInsuredForm.positionCode = this.formStore.applicationData.slave.insuredApp[0].positionCode;
|
|
2657
|
+
if (typeof this.formStore.applicationData.slave.insuredApp[0].isDisability === 'boolean')
|
|
2658
|
+
this.formStore.slaveInsuredForm.isDisability = this.formStore.applicationData.slave.insuredApp[0].isDisability;
|
|
2659
|
+
if (!!this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId) {
|
|
2660
|
+
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData.slave.insuredApp[0].disabilityGroupId);
|
|
2661
|
+
this.formStore.slaveInsuredForm.disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2662
|
+
}
|
|
2663
|
+
if (this.formStore.slaveInsuredForm.bankInfo) {
|
|
2664
|
+
this.formStore.slaveInsuredForm.bankInfo.iik = this.formStore.pensionApp.slave.account;
|
|
2665
|
+
this.formStore.slaveInsuredForm.bankInfo.bik = this.formStore.pensionApp.slave.bankBik;
|
|
2666
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.id = this.formStore.pensionApp.slave.bankId;
|
|
2667
|
+
this.formStore.slaveInsuredForm.bankInfo.bankName.nameRu = this.formStore.pensionApp.slave.bankName;
|
|
2668
|
+
this.formStore.slaveInsuredForm.bankInfo.bin = reformatIin(this.formStore.pensionApp.slave.bankBin);
|
|
2669
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.pensionApp.slave.transferContractCompany);
|
|
2670
|
+
this.formStore.pensionApp.slave.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2671
|
+
}
|
|
2672
|
+
},
|
|
2673
|
+
setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
2511
2674
|
if ('familyStatus' in this.formStore[whichForm][index]) {
|
|
2512
2675
|
this.formStore[whichForm][index].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember][index].familyStatusId);
|
|
2513
2676
|
}
|
|
@@ -2543,7 +2706,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2543
2706
|
if (this.formStore.signUrls.length) {
|
|
2544
2707
|
return this.formStore.signUrls;
|
|
2545
2708
|
}
|
|
2546
|
-
const prepareSignDocuments = (): SignDataType[] => {
|
|
2709
|
+
const prepareSignDocuments = (): Types.SignDataType[] => {
|
|
2547
2710
|
switch (this.formStore.applicationData.statusCode) {
|
|
2548
2711
|
case 'ContractSignedFrom':
|
|
2549
2712
|
return [
|
|
@@ -2601,94 +2764,17 @@ export const useDataStore = defineStore('data', {
|
|
|
2601
2764
|
};
|
|
2602
2765
|
const data = prepareSignDocuments();
|
|
2603
2766
|
if (type === 'qr') {
|
|
2604
|
-
const groupId = await this.api.signQR(data);
|
|
2767
|
+
const groupId = await this.api.file.signQR(data);
|
|
2605
2768
|
return groupId;
|
|
2606
2769
|
} else if (type === 'qrXml') {
|
|
2607
|
-
const signData = await this.api.signXml(data);
|
|
2770
|
+
const signData = await this.api.file.signXml(data);
|
|
2608
2771
|
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
2772
|
} else {
|
|
2687
|
-
if (this.processCode === 19 || this.processCode ===
|
|
2688
|
-
const result = await this.api.signBts(data);
|
|
2773
|
+
if (this.processCode === 19 || this.processCode === 24 || this.processCode === 25) {
|
|
2774
|
+
const result = await this.api.file.signBts(data);
|
|
2689
2775
|
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2690
2776
|
} else {
|
|
2691
|
-
const result = await this.api.signDocument(data);
|
|
2777
|
+
const result = await this.api.file.signDocument(data);
|
|
2692
2778
|
this.formStore.signUrls = result;
|
|
2693
2779
|
}
|
|
2694
2780
|
return this.formStore.signUrls;
|
|
@@ -2697,6 +2783,84 @@ export const useDataStore = defineStore('data', {
|
|
|
2697
2783
|
ErrorHandler(err);
|
|
2698
2784
|
}
|
|
2699
2785
|
},
|
|
2786
|
+
async nclayerSign(groupId: string, signType: number, isXml: boolean = false, processInstanceId?: string) {
|
|
2787
|
+
try {
|
|
2788
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2789
|
+
await ncaLayerClient.connect();
|
|
2790
|
+
const activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2791
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2792
|
+
const document = await this.getFileNew(groupId, signType, isXml);
|
|
2793
|
+
if (isXml) {
|
|
2794
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, document, 'SIGNATURE', '');
|
|
2795
|
+
const data = new FormData();
|
|
2796
|
+
data.append('processInstanceId', processInstanceId ?? String(this.formStore.applicationData.processInstanceId));
|
|
2797
|
+
data.append('xmlData', signedAgreement);
|
|
2798
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2799
|
+
data.append('format', 'xml');
|
|
2800
|
+
data.append('EdsXmlId', groupId);
|
|
2801
|
+
await this.api.file.uploadXml(data);
|
|
2802
|
+
} else {
|
|
2803
|
+
const base64EncodedSignature = await ncaLayerClient.createCAdESFromBase64(storageType, document, 'SIGNATURE', true);
|
|
2804
|
+
await this.api.file.uploadDigitalCertificateNca(groupId, { Base64EncodedSignature: base64EncodedSignature });
|
|
2805
|
+
}
|
|
2806
|
+
return true;
|
|
2807
|
+
} catch (err: any) {
|
|
2808
|
+
return err.name === 'NCALayerError' ? null : ErrorHandler(err);
|
|
2809
|
+
}
|
|
2810
|
+
},
|
|
2811
|
+
async getFileNew(groupId: string, documentSignType: number, xml: boolean, fileName?: string) {
|
|
2812
|
+
try {
|
|
2813
|
+
let response: any = await this.api.file.generalGetFile(groupId, xml ? 5 : documentSignType);
|
|
2814
|
+
let blob;
|
|
2815
|
+
if (response.hasOwnProperty('data')) {
|
|
2816
|
+
const document = JSON.parse(response.data).Document;
|
|
2817
|
+
blob = new Blob([document.documentXml], {
|
|
2818
|
+
type: `application/xml`,
|
|
2819
|
+
});
|
|
2820
|
+
response = document.documentXml;
|
|
2821
|
+
} else {
|
|
2822
|
+
blob = new Blob([response], {
|
|
2823
|
+
type: `application/pdf`,
|
|
2824
|
+
});
|
|
2825
|
+
}
|
|
2826
|
+
const url = window.URL.createObjectURL(blob);
|
|
2827
|
+
if (!xml) {
|
|
2828
|
+
const link = document.createElement('a');
|
|
2829
|
+
link.href = url;
|
|
2830
|
+
link.setAttribute('download', fileName ?? `Документ ПА`);
|
|
2831
|
+
document.body.appendChild(link);
|
|
2832
|
+
link.click();
|
|
2833
|
+
}
|
|
2834
|
+
window.open(url, '_blank', `right=100`);
|
|
2835
|
+
return response;
|
|
2836
|
+
} catch (err) {
|
|
2837
|
+
ErrorHandler(err);
|
|
2838
|
+
}
|
|
2839
|
+
},
|
|
2840
|
+
async generateSign(taskId: string) {
|
|
2841
|
+
try {
|
|
2842
|
+
const signatories = await this.api.file.generateSign({ taskId });
|
|
2843
|
+
if (Array.isArray(signatories)) {
|
|
2844
|
+
signatories.forEach(signatory =>
|
|
2845
|
+
signatory.fileDatas?.sort(function (a: any, b: any) {
|
|
2846
|
+
return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
|
|
2847
|
+
}),
|
|
2848
|
+
);
|
|
2849
|
+
this.formStore.signatories = signatories;
|
|
2850
|
+
}
|
|
2851
|
+
} catch (err) {
|
|
2852
|
+
ErrorHandler(err);
|
|
2853
|
+
this.formStore.signatories = [];
|
|
2854
|
+
}
|
|
2855
|
+
},
|
|
2856
|
+
async generalSign(data: Types.Api.Sign.New.GeneralResponse) {
|
|
2857
|
+
try {
|
|
2858
|
+
const response = await this.api.file.generalSign(data);
|
|
2859
|
+
return response;
|
|
2860
|
+
} catch (err) {
|
|
2861
|
+
ErrorHandler(err);
|
|
2862
|
+
}
|
|
2863
|
+
},
|
|
2700
2864
|
async downloadTemplate(documentType: number, fileType: string = 'pdf', processInstanceId?: string | number) {
|
|
2701
2865
|
try {
|
|
2702
2866
|
this.isButtonsLoading = true;
|
|
@@ -2758,12 +2922,12 @@ export const useDataStore = defineStore('data', {
|
|
|
2758
2922
|
try {
|
|
2759
2923
|
this.isButtonsLoading = true;
|
|
2760
2924
|
this.formStore.needToScanSignedContract = true;
|
|
2761
|
-
const data: SignDataType = {
|
|
2925
|
+
const data: Types.SignDataType = {
|
|
2762
2926
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2763
2927
|
name: 'Contract',
|
|
2764
2928
|
format: 'pdf',
|
|
2765
2929
|
};
|
|
2766
|
-
const response: any = await this.api.generateDocument(data);
|
|
2930
|
+
const response: any = await this.api.file.generateDocument(data);
|
|
2767
2931
|
const blob = new Blob([response], {
|
|
2768
2932
|
type: `application/pdf`,
|
|
2769
2933
|
});
|
|
@@ -2814,7 +2978,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2814
2978
|
const formattedData = formatDate(this.formStore.finCenterData.date);
|
|
2815
2979
|
if (!formattedData) return;
|
|
2816
2980
|
this.isLoading = true;
|
|
2817
|
-
const data: RegNumberDataType = {
|
|
2981
|
+
const data: Types.RegNumberDataType = {
|
|
2818
2982
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2819
2983
|
regNumber: String(this.formStore.finCenterData.regNumber),
|
|
2820
2984
|
date: formattedData.toISOString(),
|
|
@@ -2829,7 +2993,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2829
2993
|
},
|
|
2830
2994
|
async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
|
|
2831
2995
|
if (!type || !phoneNumber || !text) return;
|
|
2832
|
-
const smsData: SmsDataType = {
|
|
2996
|
+
const smsData: Types.SmsDataType = {
|
|
2833
2997
|
iin: this.formStore.applicationData.clientApp.iin,
|
|
2834
2998
|
phoneNumber: formatPhone(phoneNumber),
|
|
2835
2999
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
@@ -2846,16 +3010,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2846
3010
|
this.isLoading = false;
|
|
2847
3011
|
}
|
|
2848
3012
|
},
|
|
2849
|
-
sanitize(text: string) {
|
|
2850
|
-
return text
|
|
2851
|
-
.replace(/\r?\n|\r/g, '')
|
|
2852
|
-
.replace(/\\/g, '')
|
|
2853
|
-
.replace(/"/g, '');
|
|
2854
|
-
},
|
|
2855
3013
|
async getSignedDocList(processInstanceId: string | number) {
|
|
2856
3014
|
if (processInstanceId !== 0) {
|
|
2857
3015
|
try {
|
|
2858
|
-
this.formStore.signedDocumentList = await this.api.getSignedDocList({
|
|
3016
|
+
this.formStore.signedDocumentList = await this.api.file.getSignedDocList({
|
|
2859
3017
|
processInstanceId: processInstanceId,
|
|
2860
3018
|
});
|
|
2861
3019
|
} catch (err) {
|
|
@@ -2895,7 +3053,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2895
3053
|
}
|
|
2896
3054
|
this.isLoading = false;
|
|
2897
3055
|
},
|
|
2898
|
-
async getValidateClientESBD(data: ESBDValidationType) {
|
|
3056
|
+
async getValidateClientESBD(data: Types.ESBDValidationType) {
|
|
2899
3057
|
try {
|
|
2900
3058
|
return await this.api.getValidateClientESBD(data);
|
|
2901
3059
|
} catch (err) {
|
|
@@ -2903,7 +3061,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2903
3061
|
return ErrorHandler(err);
|
|
2904
3062
|
}
|
|
2905
3063
|
},
|
|
2906
|
-
validateMultipleMembers(localKey: MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
3064
|
+
validateMultipleMembers(localKey: Types.MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2907
3065
|
if (this.formStore[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
2908
3066
|
if (this.formStore[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
2909
3067
|
const localMembers = [...this.formStore[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
@@ -2922,6 +3080,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2922
3080
|
}
|
|
2923
3081
|
}
|
|
2924
3082
|
}
|
|
3083
|
+
} else if (applicationKey === 'slave') {
|
|
3084
|
+
if (this.formStore.slaveInsuredForm && this.formStore.applicationData.slave) {
|
|
3085
|
+
const localSlave = this.formStore.slaveInsuredForm;
|
|
3086
|
+
const applicationSlave = this.formStore.applicationData.slave.insuredApp[0];
|
|
3087
|
+
if ((localSlave.id === applicationSlave.insisId && applicationSlave.iin === localSlave.iin?.replace(/-/g, '')) === false) {
|
|
3088
|
+
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
3089
|
+
return false;
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
2925
3092
|
} else {
|
|
2926
3093
|
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2927
3094
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
@@ -2940,6 +3107,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2940
3107
|
return true;
|
|
2941
3108
|
},
|
|
2942
3109
|
async validateAllMembers(taskId: string, localCheck: boolean = false) {
|
|
3110
|
+
const policyholderDoc = this.formStore.signedDocumentList.find(
|
|
3111
|
+
i => i.iin === String(this.formStore.policyholderForm.iin).replaceAll('-', '') && (i.fileTypeCode === '1' || i.fileTypeCode === '2' || i.fileTypeCode === '4'),
|
|
3112
|
+
);
|
|
2943
3113
|
if (taskId === '0') {
|
|
2944
3114
|
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
2945
3115
|
return false;
|
|
@@ -2948,6 +3118,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2948
3118
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
|
|
2949
3119
|
return false;
|
|
2950
3120
|
}
|
|
3121
|
+
if (useEnv().isProduction && this.isInitiator() && this.isEfoParent && this.formStore.policyholderForm.iin && !policyholderDoc) {
|
|
3122
|
+
this.showToaster('error', this.t('toaster.needDigDoc', { text: 'страхователя' }));
|
|
3123
|
+
return false;
|
|
3124
|
+
}
|
|
2951
3125
|
if (this.members.insuredApp.has) {
|
|
2952
3126
|
if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
|
|
2953
3127
|
return false;
|
|
@@ -2960,6 +3134,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2960
3134
|
}
|
|
2961
3135
|
}
|
|
2962
3136
|
}
|
|
3137
|
+
if (this.formStore.applicationData.slave && this.validateMultipleMembers(this.formStore.insuredFormKey, 'slave', 'застрахованных') === false) {
|
|
3138
|
+
return false;
|
|
3139
|
+
}
|
|
2963
3140
|
if (this.members.beneficiaryApp.has) {
|
|
2964
3141
|
if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
|
|
2965
3142
|
return false;
|
|
@@ -3008,7 +3185,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3008
3185
|
}
|
|
3009
3186
|
}
|
|
3010
3187
|
if (this.controls.hasAttachment) {
|
|
3011
|
-
const areValid =
|
|
3188
|
+
const areValid =
|
|
3189
|
+
this.formStore.SaleChanellPolicy.nameRu &&
|
|
3190
|
+
this.formStore.RegionPolicy.nameRu &&
|
|
3191
|
+
this.formStore.AgentData.fullName &&
|
|
3192
|
+
(this.isPension && this.isServiceManager() ? true : this.formStore.ManagerPolicy.nameRu);
|
|
3012
3193
|
if (areValid) {
|
|
3013
3194
|
if (this.isLifetrip && this.formStore.AgentData.fullName === 'Без агента') {
|
|
3014
3195
|
this.isLoading = false;
|
|
@@ -3076,7 +3257,12 @@ export const useDataStore = defineStore('data', {
|
|
|
3076
3257
|
this.isLoading = true;
|
|
3077
3258
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
3078
3259
|
if (areMembersValid) {
|
|
3079
|
-
if (
|
|
3260
|
+
if (
|
|
3261
|
+
(!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) ||
|
|
3262
|
+
(this.isPension &&
|
|
3263
|
+
this.formStore.applicationData.pensionApp.isCalculated === true &&
|
|
3264
|
+
(this.formStore.applicationData.pensionApp.slave ? this.formStore.applicationData.pensionApp.slave.isCalculated === true : true))
|
|
3265
|
+
) {
|
|
3080
3266
|
if (this.controls.hasAnketa) {
|
|
3081
3267
|
const hasCritical =
|
|
3082
3268
|
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
@@ -3243,13 +3429,16 @@ export const useDataStore = defineStore('data', {
|
|
|
3243
3429
|
if (!this.accessToken) return null;
|
|
3244
3430
|
try {
|
|
3245
3431
|
const decoded = jwtDecode(this.accessToken);
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3432
|
+
if (decoded) {
|
|
3433
|
+
const data = {
|
|
3434
|
+
userName: decoded.code,
|
|
3435
|
+
branchName: decoded.branchCode,
|
|
3436
|
+
bin: bin.replace(/-/g, ''),
|
|
3437
|
+
};
|
|
3438
|
+
const gbdulResponse = await this.api.getGbdUl(data);
|
|
3439
|
+
return gbdulResponse;
|
|
3440
|
+
}
|
|
3441
|
+
return null;
|
|
3253
3442
|
} catch (err) {
|
|
3254
3443
|
return ErrorHandler(err);
|
|
3255
3444
|
}
|
|
@@ -3299,7 +3488,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3299
3488
|
this.isLoading = false;
|
|
3300
3489
|
return false;
|
|
3301
3490
|
}
|
|
3302
|
-
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Api.GBD.Person };
|
|
3491
|
+
const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Types.Api.GBD.Person };
|
|
3303
3492
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
3304
3493
|
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
3305
3494
|
member.resetMember(false);
|
|
@@ -3316,7 +3505,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3316
3505
|
this.isLoading = false;
|
|
3317
3506
|
}
|
|
3318
3507
|
},
|
|
3319
|
-
async saveInStoreUserGBDFL(person: Api.GBD.Person, member: Member) {
|
|
3508
|
+
async saveInStoreUserGBDFL(person: Types.Api.GBD.Person, member: Member) {
|
|
3320
3509
|
member.firstName = person.name;
|
|
3321
3510
|
member.lastName = person.surname;
|
|
3322
3511
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
@@ -3331,69 +3520,72 @@ export const useDataStore = defineStore('data', {
|
|
|
3331
3520
|
const gender = this.gender.find((i: Value) => i.id == person.gender.code);
|
|
3332
3521
|
if (gender) member.gender = gender;
|
|
3333
3522
|
|
|
3334
|
-
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
3523
|
+
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu ?? 'undefined', 'i')));
|
|
3335
3524
|
if (birthPlace) member.birthPlace = birthPlace;
|
|
3336
3525
|
|
|
3337
|
-
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
3526
|
+
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu ?? 'undefined', 'i')));
|
|
3338
3527
|
if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
|
|
3339
3528
|
|
|
3340
|
-
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu, 'i')));
|
|
3529
|
+
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu ?? 'undefined', 'i')));
|
|
3341
3530
|
if (regCountry) member.registrationCountry = regCountry;
|
|
3342
3531
|
|
|
3343
|
-
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
3532
|
+
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')));
|
|
3344
3533
|
if (regProvince) member.registrationProvince = regProvince;
|
|
3534
|
+
else member.registrationProvince = new Value();
|
|
3345
3535
|
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3536
|
+
let hasSetCity = false;
|
|
3537
|
+
let hasSetRegion = false;
|
|
3538
|
+
if (person.regAddress.city && String(person.regAddress.city).includes(', ')) {
|
|
3539
|
+
const personCities = String(person.regAddress.city).split(', ');
|
|
3540
|
+
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3541
|
+
const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
|
|
3542
|
+
if (possibleCity) {
|
|
3543
|
+
member.registrationCity = possibleCity;
|
|
3544
|
+
hasSetCity = true;
|
|
3545
|
+
break;
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
if (member.registrationCity.nameRu === null) {
|
|
3349
3549
|
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
3350
|
-
const
|
|
3351
|
-
if (
|
|
3352
|
-
member.
|
|
3550
|
+
const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
|
|
3551
|
+
if (possibleRegion) {
|
|
3552
|
+
member.registrationRegion = possibleRegion;
|
|
3553
|
+
hasSetRegion = true;
|
|
3353
3554
|
break;
|
|
3354
3555
|
}
|
|
3355
3556
|
}
|
|
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
3557
|
}
|
|
3374
3558
|
}
|
|
3375
3559
|
|
|
3376
|
-
if (
|
|
3560
|
+
if (hasSetCity === false) {
|
|
3377
3561
|
const regCity = this.cities.find(
|
|
3378
|
-
i =>
|
|
3562
|
+
i =>
|
|
3563
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3564
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3565
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3379
3566
|
);
|
|
3380
3567
|
if (regCity) {
|
|
3381
3568
|
member.registrationCity = regCity;
|
|
3382
3569
|
const regType = this.localityTypes.find(i => String(i.nameRu) === 'город');
|
|
3383
3570
|
if (regType) member.registrationRegionType = regType;
|
|
3384
|
-
} else
|
|
3385
|
-
const regRegion = this.regions.find(
|
|
3386
|
-
i => String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu, 'i')) || String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
3387
|
-
);
|
|
3388
|
-
if (regRegion) {
|
|
3389
|
-
member.registrationRegion = regRegion;
|
|
3390
|
-
const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
|
|
3391
|
-
if (regType) member.registrationRegionType = regType;
|
|
3392
|
-
}
|
|
3393
|
-
}
|
|
3571
|
+
} else member.registrationCity = new Value();
|
|
3394
3572
|
}
|
|
3395
3573
|
|
|
3396
|
-
if (
|
|
3574
|
+
if (hasSetRegion === false) {
|
|
3575
|
+
const regRegion = this.regions.find(
|
|
3576
|
+
i =>
|
|
3577
|
+
String(i.nameRu).match(new RegExp(person.regAddress.city ?? 'undefined', 'i')) ||
|
|
3578
|
+
String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu ?? 'undefined', 'i')) ||
|
|
3579
|
+
String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu ?? 'undefined', 'i')),
|
|
3580
|
+
);
|
|
3581
|
+
if (regRegion) {
|
|
3582
|
+
member.registrationRegion = regRegion;
|
|
3583
|
+
const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
|
|
3584
|
+
if (regType) member.registrationRegionType = regType;
|
|
3585
|
+
} else member.registrationRegion = new Value();
|
|
3586
|
+
}
|
|
3587
|
+
|
|
3588
|
+
if (person.regAddress.street && person.regAddress.street.includes(', ')) {
|
|
3397
3589
|
const personAddress = person.regAddress.street.split(', ');
|
|
3398
3590
|
const microDistrict = personAddress.find((i: string) => i.match(new RegExp('микрорайон', 'i')));
|
|
3399
3591
|
const quarter = personAddress.find((i: string) => i.match(new RegExp('квартал', 'i')));
|
|
@@ -3408,19 +3600,28 @@ export const useDataStore = defineStore('data', {
|
|
|
3408
3600
|
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
3409
3601
|
|
|
3410
3602
|
if (Array.isArray(person.documents.document)) {
|
|
3411
|
-
const
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
(i
|
|
3416
|
-
|
|
3603
|
+
const filteredDocuments = person.documents.document.filter(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00');
|
|
3604
|
+
const validDocument = this.isLifetrip
|
|
3605
|
+
? filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3606
|
+
: filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes['1UDL']) ??
|
|
3607
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.VNZ) ??
|
|
3608
|
+
filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS);
|
|
3417
3609
|
if (validDocument) {
|
|
3418
|
-
const documentType = this.documentTypes.find(
|
|
3610
|
+
const documentType = this.documentTypes.find(
|
|
3611
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(validDocument.type.code)],
|
|
3612
|
+
);
|
|
3419
3613
|
if (documentType) member.documentType = documentType;
|
|
3420
3614
|
if (validDocument.number) member.documentNumber = validDocument.number;
|
|
3421
3615
|
if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
|
|
3422
3616
|
if (validDocument.endDate) member.documentExpire = reformatDate(validDocument.endDate);
|
|
3423
|
-
const documentIssuer = this.documentIssuers.find(i =>
|
|
3617
|
+
const documentIssuer = this.documentIssuers.find(i =>
|
|
3618
|
+
(i.nameRu as string).match(
|
|
3619
|
+
new RegExp(
|
|
3620
|
+
validDocument.issueOrganization.code === '001' ? 'МЮ РК' : validDocument.issueOrganization.code === '002' ? 'МВД РК' : validDocument.issueOrganization.nameRu,
|
|
3621
|
+
'i',
|
|
3622
|
+
),
|
|
3623
|
+
),
|
|
3624
|
+
);
|
|
3424
3625
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
3425
3626
|
}
|
|
3426
3627
|
} else {
|
|
@@ -3428,9 +3629,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3428
3629
|
if (
|
|
3429
3630
|
personDoc.status.code === '00' &&
|
|
3430
3631
|
new Date(personDoc.endDate) > new Date(Date.now()) &&
|
|
3431
|
-
(personDoc.type.code ===
|
|
3632
|
+
(personDoc.type.code === CoreEnums.GBD.DocTypes['1UDL'] || personDoc.type.code === CoreEnums.GBD.DocTypes.VNZ || personDoc.type.code === CoreEnums.GBD.DocTypes.PS)
|
|
3432
3633
|
) {
|
|
3433
|
-
const documentType = this.documentTypes.find(
|
|
3634
|
+
const documentType = this.documentTypes.find(
|
|
3635
|
+
(i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(personDoc.type.code)],
|
|
3636
|
+
);
|
|
3434
3637
|
if (documentType) member.documentType = documentType;
|
|
3435
3638
|
const documentNumber = personDoc.number;
|
|
3436
3639
|
if (documentNumber) member.documentNumber = documentNumber;
|
|
@@ -3438,7 +3641,11 @@ export const useDataStore = defineStore('data', {
|
|
|
3438
3641
|
if (documentDate) member.documentDate = reformatDate(documentDate);
|
|
3439
3642
|
const documentExpire = personDoc.endDate;
|
|
3440
3643
|
if (documentExpire) member.documentExpire = reformatDate(documentExpire);
|
|
3441
|
-
const documentIssuer = this.documentIssuers.find(i =>
|
|
3644
|
+
const documentIssuer = this.documentIssuers.find(i =>
|
|
3645
|
+
(i.nameRu as string).match(
|
|
3646
|
+
new RegExp(personDoc.issueOrganization.code === '001' ? 'МЮ РК' : personDoc.issueOrganization.code === '002' ? 'МВД РК' : personDoc.issueOrganization.nameRu, 'i'),
|
|
3647
|
+
),
|
|
3648
|
+
);
|
|
3442
3649
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
3443
3650
|
}
|
|
3444
3651
|
}
|
|
@@ -3477,12 +3684,14 @@ export const useDataStore = defineStore('data', {
|
|
|
3477
3684
|
'clientData.authoritedPerson.bankInfo',
|
|
3478
3685
|
'clientData.authoritedPerson.economySectorCode',
|
|
3479
3686
|
'clientData.authoritedPerson.legalAddress',
|
|
3480
|
-
'clientData.authoritedPerson.placeOfBirth',
|
|
3481
|
-
'clientData.authoritedPerson.resident',
|
|
3482
3687
|
'clientData.authoritedPerson.taxResidentCountry',
|
|
3483
3688
|
'clientData.authoritedPerson.addTaxResidency',
|
|
3484
3689
|
]);
|
|
3485
3690
|
policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
|
|
3691
|
+
if (this.formStore.lfb.add) {
|
|
3692
|
+
policyholder.parentContractNumber = localStorage.getItem('policyNo');
|
|
3693
|
+
policyholder.parentContractId = localStorage.getItem('policyId');
|
|
3694
|
+
}
|
|
3486
3695
|
try {
|
|
3487
3696
|
const response = await this.api.startApplication(policyholder);
|
|
3488
3697
|
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
@@ -3514,7 +3723,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3514
3723
|
this.formStore.applicationData = applicationData;
|
|
3515
3724
|
this.formStore.regNumber = applicationData.regNumber;
|
|
3516
3725
|
this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
|
|
3517
|
-
|
|
3518
3726
|
this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
|
|
3519
3727
|
this.formStore.applicationTaskId = taskId;
|
|
3520
3728
|
this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
|
|
@@ -3535,17 +3743,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3535
3743
|
|
|
3536
3744
|
this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
|
|
3537
3745
|
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
3746
|
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();
|
|
3747
|
+
this.getClientData(clientData);
|
|
3549
3748
|
|
|
3550
3749
|
if (clientData && clientData.activityTypes !== null) {
|
|
3551
3750
|
this.formStore.lfb.policyholderActivities = clientData.activityTypes;
|
|
@@ -3578,19 +3777,43 @@ export const useDataStore = defineStore('data', {
|
|
|
3578
3777
|
});
|
|
3579
3778
|
}
|
|
3580
3779
|
|
|
3780
|
+
this.formStore.productConditionsForm.lifeMultiply = parseProcents(applicationData.policyAppDto.lifeMultiply);
|
|
3781
|
+
this.formStore.productConditionsForm.lifeAdditive = parseProcents(applicationData.policyAppDto.lifeAdditive);
|
|
3782
|
+
this.formStore.productConditionsForm.lifeMultiplyClient = parseProcents(applicationData.policyAppDto.lifeMultiplyClient);
|
|
3783
|
+
this.formStore.productConditionsForm.lifeAdditiveClient = parseProcents(applicationData.policyAppDto.lifeAdditiveClient);
|
|
3784
|
+
this.formStore.productConditionsForm.adbMultiply = parseProcents(applicationData.policyAppDto.adbMultiply);
|
|
3785
|
+
this.formStore.productConditionsForm.adbAdditive = parseProcents(applicationData.policyAppDto.adbAdditive);
|
|
3786
|
+
this.formStore.productConditionsForm.disabilityMultiply = parseProcents(applicationData.policyAppDto.disabilityMultiply);
|
|
3787
|
+
this.formStore.productConditionsForm.disabilityAdditive = parseProcents(applicationData.policyAppDto.disabilityAdditive);
|
|
3788
|
+
|
|
3581
3789
|
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.policyAppDto.calcDate);
|
|
3582
3790
|
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.policyAppDto.contractEndDate);
|
|
3583
3791
|
this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission === 0 ? null : applicationData.policyAppDto.agentCommission;
|
|
3584
3792
|
this.formStore.productConditionsForm.fixInsSum = this.getNumberWithSpaces(applicationData.policyAppDto.fixInsSum === 0 ? null : applicationData.policyAppDto.fixInsSum);
|
|
3585
3793
|
this.formStore.productConditionsForm.coverPeriod = 12;
|
|
3586
3794
|
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
|
-
);
|
|
3795
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth =
|
|
3796
|
+
applicationData.policyAppDto.mainPremiumWithCommission === 0 ? null : this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3590
3797
|
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
3591
3798
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
3592
3799
|
const processGfot = this.processGfot.find(item => item.id == applicationData.policyAppDto.processDefinitionFgotId);
|
|
3593
3800
|
this.formStore.productConditionsForm.processGfot = processGfot ? processGfot : new Value();
|
|
3801
|
+
|
|
3802
|
+
if (applicationData.parentPolicyDto !== null) {
|
|
3803
|
+
this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.parentPolicyDto.contractInsrBegin);
|
|
3804
|
+
this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.parentPolicyDto.contractInsrEnd);
|
|
3805
|
+
}
|
|
3806
|
+
if (this.formStore.lfb.add) {
|
|
3807
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.premium);
|
|
3808
|
+
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.amount);
|
|
3809
|
+
if (applicationData.policyAppDto.mainPremiumWithCommission > 0) {
|
|
3810
|
+
this.formStore.productConditionsForm.amountPaid = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3811
|
+
this.formStore.productConditionsForm.amountRefunded = null;
|
|
3812
|
+
} else {
|
|
3813
|
+
this.formStore.productConditionsForm.amountRefunded = this.getNumberWithSpacesAfterComma(applicationData.policyAppDto.mainPremiumWithCommission);
|
|
3814
|
+
this.formStore.productConditionsForm.amountPaid = null;
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3594
3817
|
} catch (err) {
|
|
3595
3818
|
ErrorHandler(err);
|
|
3596
3819
|
if (err instanceof AxiosError) {
|
|
@@ -3601,7 +3824,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3601
3824
|
}
|
|
3602
3825
|
this.isLoading = false;
|
|
3603
3826
|
},
|
|
3604
|
-
async saveAccidentIncidents(data: AccidentIncidents[]) {
|
|
3827
|
+
async saveAccidentIncidents(data: Types.AccidentIncidents[]) {
|
|
3605
3828
|
try {
|
|
3606
3829
|
const dataCopy = JSON.parse(JSON.stringify(data));
|
|
3607
3830
|
for (const incident of dataCopy) {
|
|
@@ -3699,6 +3922,8 @@ export const useDataStore = defineStore('data', {
|
|
|
3699
3922
|
premium: client.insuredPolicyData.premium,
|
|
3700
3923
|
premiumWithLoad: client.insuredPolicyData.premiumWithLoad,
|
|
3701
3924
|
hasAttachedFile: client.hasAttachedFile,
|
|
3925
|
+
insrBeginDate: client.insuredPolicyData.insrBeginDate ?? 'no',
|
|
3926
|
+
insrEndDate: client.insuredPolicyData.insrEndDate ?? 'no',
|
|
3702
3927
|
};
|
|
3703
3928
|
});
|
|
3704
3929
|
return clients;
|
|
@@ -3747,7 +3972,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3747
3972
|
return false;
|
|
3748
3973
|
}
|
|
3749
3974
|
|
|
3750
|
-
if (this.formStore.lfb.beneficialOwners) {
|
|
3975
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.beneficialOwners) {
|
|
3751
3976
|
if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
|
|
3752
3977
|
return false;
|
|
3753
3978
|
}
|
|
@@ -3758,7 +3983,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3758
3983
|
}
|
|
3759
3984
|
}
|
|
3760
3985
|
|
|
3761
|
-
if (this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3986
|
+
if (!this.formStore.lfb.add && this.formStore.applicationData.clientApp.clientData.activityTypes === null) {
|
|
3762
3987
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
|
|
3763
3988
|
return false;
|
|
3764
3989
|
}
|
|
@@ -3774,7 +3999,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3774
3999
|
}
|
|
3775
4000
|
}
|
|
3776
4001
|
|
|
3777
|
-
if (this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
4002
|
+
if (!this.formStore.lfb.add && this.formStore.lfb.clients && this.formStore.lfb.clients.length <= 10) {
|
|
3778
4003
|
for (const client of this.formStore.lfb.clients) {
|
|
3779
4004
|
if (client.hasAttachedFile === false) {
|
|
3780
4005
|
this.showToaster('error', this.t('toaster.needAttachQuestionnaire'), 3000);
|
|
@@ -3783,18 +4008,75 @@ export const useDataStore = defineStore('data', {
|
|
|
3783
4008
|
}
|
|
3784
4009
|
}
|
|
3785
4010
|
|
|
3786
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
4011
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === null) {
|
|
3787
4012
|
this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
|
|
3788
4013
|
return false;
|
|
3789
4014
|
}
|
|
3790
4015
|
|
|
3791
|
-
if (this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
4016
|
+
if (!this.formStore.lfb.add && this.formStore.productConditionsForm.insurancePremiumPerMonth === '0') {
|
|
3792
4017
|
this.showToaster('error', this.t('toaster.notZeroPremium'), 3000);
|
|
3793
4018
|
return false;
|
|
3794
4019
|
}
|
|
3795
4020
|
|
|
4021
|
+
if (this.controls.hasAttachment) {
|
|
4022
|
+
const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
|
|
4023
|
+
if (areValid) {
|
|
4024
|
+
if (this.isInitiator()) {
|
|
4025
|
+
await this.setINSISWorkData();
|
|
4026
|
+
}
|
|
4027
|
+
} else {
|
|
4028
|
+
this.isLoading = false;
|
|
4029
|
+
this.showToaster('error', this.t('toaster.attachManagerError'), 3000);
|
|
4030
|
+
return false;
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
|
|
3796
4034
|
return true;
|
|
3797
4035
|
},
|
|
4036
|
+
async getOnlineAccess(iin: string, documentType: string) {
|
|
4037
|
+
try {
|
|
4038
|
+
const data = {
|
|
4039
|
+
iinBin: iin.replaceAll('-', ''),
|
|
4040
|
+
documentType: documentType,
|
|
4041
|
+
};
|
|
4042
|
+
const response = await this.api.externalServices.getOnlineAccess(data);
|
|
4043
|
+
if (response.code === 'PROFILE_DIGIDOCS_INTERNAL_ERROR') {
|
|
4044
|
+
this.showToaster('error', this.t('toaster.notDigDoc'), 3000);
|
|
4045
|
+
return false;
|
|
4046
|
+
} else {
|
|
4047
|
+
return true;
|
|
4048
|
+
}
|
|
4049
|
+
} catch (err) {
|
|
4050
|
+
ErrorHandler(err);
|
|
4051
|
+
return null;
|
|
4052
|
+
}
|
|
4053
|
+
},
|
|
4054
|
+
async getDigitalDocuments(iin: string, processInstanceId: string, code: string) {
|
|
4055
|
+
try {
|
|
4056
|
+
const data = {
|
|
4057
|
+
iin: iin.replaceAll('-', ''),
|
|
4058
|
+
processInstanceId: processInstanceId,
|
|
4059
|
+
code: code.replace(/\s/g, ''),
|
|
4060
|
+
};
|
|
4061
|
+
await this.api.externalServices.getDigitalDocuments(data);
|
|
4062
|
+
return true;
|
|
4063
|
+
} catch (err) {
|
|
4064
|
+
ErrorHandler(err);
|
|
4065
|
+
return null;
|
|
4066
|
+
}
|
|
4067
|
+
},
|
|
4068
|
+
async updateDigitalDocumentsProfile(iin: string) {
|
|
4069
|
+
try {
|
|
4070
|
+
const data = {
|
|
4071
|
+
iinBin: iin.replaceAll('-', ''),
|
|
4072
|
+
};
|
|
4073
|
+
await this.api.externalServices.updateDigitalDocumentsProfile(data);
|
|
4074
|
+
this.showToaster('success', this.t('toaster.successProfile'), 3000);
|
|
4075
|
+
} catch (err) {
|
|
4076
|
+
ErrorHandler(err);
|
|
4077
|
+
return null;
|
|
4078
|
+
}
|
|
4079
|
+
},
|
|
3798
4080
|
async getVariableData(processCode: number) {
|
|
3799
4081
|
try {
|
|
3800
4082
|
const response = await this.api.getVariableData(0, processCode);
|
|
@@ -3824,6 +4106,24 @@ export const useDataStore = defineStore('data', {
|
|
|
3824
4106
|
return ErrorHandler(err);
|
|
3825
4107
|
}
|
|
3826
4108
|
},
|
|
4109
|
+
async getBankByAccountNumber(accountNumber: string) {
|
|
4110
|
+
try {
|
|
4111
|
+
const bank = await this.api.getBankByAccountNumber(accountNumber);
|
|
4112
|
+
return bank;
|
|
4113
|
+
} catch (err) {
|
|
4114
|
+
ErrorHandler(err);
|
|
4115
|
+
}
|
|
4116
|
+
},
|
|
4117
|
+
async getContractByBin(bin: string) {
|
|
4118
|
+
try {
|
|
4119
|
+
const contract = await this.api.getContractByBin(bin);
|
|
4120
|
+
contract.insrBegin = reformatDate(contract.insrBegin) ?? '';
|
|
4121
|
+
contract.insrEnd = reformatDate(contract.insrEnd) ?? '';
|
|
4122
|
+
return contract;
|
|
4123
|
+
} catch (err) {
|
|
4124
|
+
ErrorHandler(err);
|
|
4125
|
+
}
|
|
4126
|
+
},
|
|
3827
4127
|
async isCourseChanged(processInstanceId: string) {
|
|
3828
4128
|
try {
|
|
3829
4129
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
@@ -3832,7 +4132,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3832
4132
|
return ErrorHandler(err);
|
|
3833
4133
|
}
|
|
3834
4134
|
},
|
|
3835
|
-
async generateShortLink(url: string, template?: Api.GenerateShortLink.Templates) {
|
|
4135
|
+
async generateShortLink(url: string, template?: Types.Api.GenerateShortLink.Templates) {
|
|
3836
4136
|
try {
|
|
3837
4137
|
const response = await this.api.generateShortLink({
|
|
3838
4138
|
link: url,
|
|
@@ -3844,8 +4144,30 @@ export const useDataStore = defineStore('data', {
|
|
|
3844
4144
|
return ErrorHandler(err);
|
|
3845
4145
|
}
|
|
3846
4146
|
},
|
|
4147
|
+
getClientData(clientData: GroupMember) {
|
|
4148
|
+
this.formStore.lfb.policyholder.clientData = clientData;
|
|
4149
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson = clientData.authoritedPerson;
|
|
4150
|
+
this.formStore.lfb.policyholder.clientData.iin = reformatIin(clientData.iin);
|
|
4151
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.iin = reformatIin(clientData.authoritedPerson.iin);
|
|
4152
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.authorityDetails.date = reformatDate(clientData.authoritedPerson.authorityDetails.date as string);
|
|
4153
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.birthDate = reformatDate(clientData.authoritedPerson.birthDate) ?? '';
|
|
4154
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.issuedOn = reformatDate(clientData.authoritedPerson.identityDocument.issuedOn) ?? '';
|
|
4155
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.identityDocument.validUntil = reformatDate(clientData.authoritedPerson.identityDocument.validUntil) ?? '';
|
|
4156
|
+
const gender = this.gender.find((i: Value) => i.id === Number(clientData.authoritedPerson.gender));
|
|
4157
|
+
this.formStore.lfb.policyholder.clientData.authoritedPerson.gender = gender ? gender : new Value();
|
|
4158
|
+
},
|
|
4159
|
+
async getParentApplication(bin: string) {
|
|
4160
|
+
try {
|
|
4161
|
+
const response = await this.api.getParentApplication(bin);
|
|
4162
|
+
if (response) {
|
|
4163
|
+
this.getClientData(response.clientApp.clientData);
|
|
4164
|
+
}
|
|
4165
|
+
} catch (err) {
|
|
4166
|
+
return ErrorHandler(err);
|
|
4167
|
+
}
|
|
4168
|
+
},
|
|
3847
4169
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
3848
|
-
if (this.isLifetrip || this.isPension) return false;
|
|
4170
|
+
if (this.isLifetrip || this.isPension || this.isBalam || this.isTumar) return false;
|
|
3849
4171
|
switch (whichForm) {
|
|
3850
4172
|
case this.formStore.beneficiaryFormKey:
|
|
3851
4173
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -3856,7 +4178,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3856
4178
|
}
|
|
3857
4179
|
},
|
|
3858
4180
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
3859
|
-
if (this.
|
|
4181
|
+
if (this.isPension) return false;
|
|
3860
4182
|
switch (whichForm) {
|
|
3861
4183
|
case this.formStore.beneficiaryFormKey:
|
|
3862
4184
|
return false;
|
|
@@ -3864,18 +4186,6 @@ export const useDataStore = defineStore('data', {
|
|
|
3864
4186
|
return true;
|
|
3865
4187
|
}
|
|
3866
4188
|
},
|
|
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
4189
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
3880
4190
|
if (this.isGons || this.isPension) return false;
|
|
3881
4191
|
switch (whichForm) {
|
|
@@ -3884,7 +4194,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3884
4194
|
}
|
|
3885
4195
|
},
|
|
3886
4196
|
hasBankSection(whichForm: keyof typeof StoreMembers) {
|
|
3887
|
-
if (!this.isPension) return false;
|
|
4197
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3888
4198
|
switch (whichForm) {
|
|
3889
4199
|
case 'beneficiaryForm':
|
|
3890
4200
|
return false;
|
|
@@ -3893,7 +4203,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3893
4203
|
}
|
|
3894
4204
|
},
|
|
3895
4205
|
hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
|
|
3896
|
-
if (!this.isPension) return false;
|
|
4206
|
+
if (!this.isPension || Number(this.formStore.applicationData.processCode) === 24) return false;
|
|
3897
4207
|
switch (whichForm) {
|
|
3898
4208
|
case 'beneficiaryForm':
|
|
3899
4209
|
return false;
|
|
@@ -3912,44 +4222,5 @@ export const useDataStore = defineStore('data', {
|
|
|
3912
4222
|
return false;
|
|
3913
4223
|
}
|
|
3914
4224
|
},
|
|
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
4225
|
},
|
|
3955
4226
|
});
|