hl-core 0.0.8-beta.39 → 0.0.8-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.ts +32 -25
- package/components/Form/FormBlock.vue +28 -17
- package/components/Form/ManagerAttachment.vue +1 -1
- package/components/Form/ProductConditionsBlock.vue +3 -1
- package/components/Pages/Anketa.vue +9 -3
- package/components/Pages/MemberForm.vue +32 -34
- package/components/Pages/ProductConditions.vue +14 -14
- package/components/Panel/PanelHandler.vue +3 -3
- package/composables/classes.ts +61 -81
- package/composables/constants.ts +22 -59
- package/composables/index.ts +18 -15
- package/package.json +1 -1
- package/store/{data.store.js → data.store.ts} +813 -765
- package/store/member.store.ts +50 -63
- package/store/{rules.js → rules.ts} +30 -30
- package/types/enum.ts +83 -0
- package/types/index.ts +181 -18
|
@@ -3,9 +3,11 @@ import { rules } from './rules';
|
|
|
3
3
|
import { i18n } from '../configs/i18n';
|
|
4
4
|
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
5
5
|
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
|
|
6
|
-
import { DataStoreClass, Contragent } from '../composables/classes';
|
|
6
|
+
import { DataStoreClass, Contragent, DocumentItem, Member, Value } from '../composables/classes';
|
|
7
7
|
import { ApiClass } from '../api';
|
|
8
8
|
import { useFormStore } from './form.store';
|
|
9
|
+
import { AxiosError } from 'axios';
|
|
10
|
+
import { PostActions, StoreMembers, Roles, Statuses, MemberCodes, MemberAppCodes } from '../types/enum';
|
|
9
11
|
|
|
10
12
|
export const useDataStore = defineStore('data', {
|
|
11
13
|
state: () => ({
|
|
@@ -18,14 +20,14 @@ export const useDataStore = defineStore('data', {
|
|
|
18
20
|
isValidGUID: isValidGUID,
|
|
19
21
|
router: useRouter(),
|
|
20
22
|
formStore: useFormStore(),
|
|
21
|
-
contragent: useContragentStore(),
|
|
23
|
+
// contragent: useContragentStore(),
|
|
22
24
|
api: new ApiClass(),
|
|
23
|
-
yearEnding: year => yearEnding(year, constants.yearTitles, constants.yearCases),
|
|
25
|
+
yearEnding: (year: number) => yearEnding(year, constants.yearTitles, constants.yearCases),
|
|
24
26
|
currentDate: () => new Date(Date.now() - new Date().getTimezoneOffset() * 60 * 1000).toISOString().slice(0, -1),
|
|
25
|
-
showToaster: (type, msg, timeout) =>
|
|
27
|
+
showToaster: (type: 'success' | 'error' | 'warning' | 'info', msg: string, timeout?: number) =>
|
|
26
28
|
Toast.useToast()(msg, {
|
|
27
29
|
...ToastOptions,
|
|
28
|
-
type: Types[type.toUpperCase()],
|
|
30
|
+
type: Types[type.toUpperCase() as keyof typeof Types],
|
|
29
31
|
timeout: type === 'error' ? 6000 : typeof timeout === 'number' ? timeout : ToastOptions.timeout,
|
|
30
32
|
}),
|
|
31
33
|
}),
|
|
@@ -39,7 +41,6 @@ export const useDataStore = defineStore('data', {
|
|
|
39
41
|
isMycar: state => state.product === 'mycar',
|
|
40
42
|
isLifetrip: state => state.product === 'lifetrip',
|
|
41
43
|
isLiferenta: state => state.product === 'liferenta',
|
|
42
|
-
isPension: state => state.product === 'pension',
|
|
43
44
|
isGons: state => state.product === 'gons',
|
|
44
45
|
isKazyna: state => state.product === 'halykkazyna',
|
|
45
46
|
isCalculator: state => state.product === 'calculator',
|
|
@@ -58,101 +59,45 @@ export const useDataStore = defineStore('data', {
|
|
|
58
59
|
return true;
|
|
59
60
|
}
|
|
60
61
|
},
|
|
61
|
-
sendToParent(action, value) {
|
|
62
|
-
window.parent.postMessage({ action: action, value: value }, '*');
|
|
63
|
-
},
|
|
64
62
|
getChildIframe() {
|
|
65
63
|
return document.getElementById('product-iframe');
|
|
66
64
|
},
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
sendToParent(action: keyof typeof PostActions, value: any) {
|
|
66
|
+
window.parent.postMessage({ action: action, value: value }, '*');
|
|
67
|
+
},
|
|
68
|
+
sendToChild(action: keyof typeof PostActions, value: any) {
|
|
69
|
+
const childFrame = this.getChildIframe() as HTMLIFrameElement;
|
|
69
70
|
if (childFrame && childFrame.contentWindow && childFrame.contentWindow.postMessage) {
|
|
70
71
|
childFrame.contentWindow.postMessage({ action: action, value: value }, '*');
|
|
71
72
|
}
|
|
72
73
|
},
|
|
73
|
-
copyToClipboard(text) {
|
|
74
|
+
copyToClipboard(text: any) {
|
|
74
75
|
if (typeof text === 'string' || typeof text === 'number') {
|
|
75
76
|
if (this.isBridge) {
|
|
76
|
-
navigator.clipboard.writeText(text);
|
|
77
|
+
navigator.clipboard.writeText(String(text));
|
|
77
78
|
} else {
|
|
78
|
-
this.sendToParent(constants.postActions.clipboard, text);
|
|
79
|
+
this.sendToParent(constants.postActions.clipboard, String(text));
|
|
79
80
|
}
|
|
80
81
|
this.showToaster('success', this.t('toaster.copied'));
|
|
81
82
|
} else {
|
|
82
83
|
this.showToaster('error', this.t('toaster.noUrl'));
|
|
83
84
|
}
|
|
84
85
|
},
|
|
85
|
-
getFilesByIIN(iin) {
|
|
86
|
+
getFilesByIIN(iin: string) {
|
|
86
87
|
return iin ? this.formStore.signedDocumentList.filter(file => file.iin === iin && file.fileTypeName === 'Удостоверение личности') : null;
|
|
87
88
|
},
|
|
88
89
|
async getNewAccessToken() {
|
|
89
90
|
try {
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
const accessToken = localStorage.getItem('accessToken') || null;
|
|
92
|
+
const refreshToken = localStorage.getItem('refreshToken') || null;
|
|
93
|
+
if (!accessToken || !refreshToken) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const response = await this.api.getNewAccessToken({ accessToken: accessToken, refreshToken: refreshToken });
|
|
95
97
|
this.accessToken = response.accessToken;
|
|
96
98
|
this.refreshToken = response.refreshToken;
|
|
97
99
|
localStorage.setItem('accessToken', this.accessToken);
|
|
98
100
|
localStorage.setItem('refreshToken', this.refreshToken);
|
|
99
|
-
} catch (err) {
|
|
100
|
-
console.error(err);
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
async loginUser(login, password, numAttempt) {
|
|
104
|
-
try {
|
|
105
|
-
const token = localStorage.getItem('accessToken') || null;
|
|
106
|
-
if (token && isValidToken(token)) {
|
|
107
|
-
this.accessToken = token;
|
|
108
|
-
this.getUserRoles();
|
|
109
|
-
} else {
|
|
110
|
-
const response = await this.api.loginUser({
|
|
111
|
-
login: login,
|
|
112
|
-
password: password,
|
|
113
|
-
numAttempt: numAttempt,
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
this.accessToken = response.accessToken;
|
|
117
|
-
this.refreshToken = response.refreshToken;
|
|
118
|
-
this.getUserRoles();
|
|
119
|
-
}
|
|
120
|
-
const checkPermission = () => {
|
|
121
|
-
if (this.isAML) {
|
|
122
|
-
return this.isCompliance() || this.isAdmin() || this.isSupport() || this.isAnalyst();
|
|
123
|
-
}
|
|
124
|
-
if (this.isLKA) {
|
|
125
|
-
return this.isAgent() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
|
|
126
|
-
}
|
|
127
|
-
if (this.isEFO) {
|
|
128
|
-
return (
|
|
129
|
-
this.isInitiator() ||
|
|
130
|
-
this.isUnderwriter() ||
|
|
131
|
-
this.isAdmin() ||
|
|
132
|
-
this.isCompliance() ||
|
|
133
|
-
this.isAnalyst() ||
|
|
134
|
-
this.isUpk() ||
|
|
135
|
-
this.isFinCenter() ||
|
|
136
|
-
this.isSupervisor() ||
|
|
137
|
-
this.isSupport()
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
return false;
|
|
141
|
-
};
|
|
142
|
-
if (this.controls.onAuth) {
|
|
143
|
-
const hasPermission = checkPermission();
|
|
144
|
-
if (hasPermission) {
|
|
145
|
-
localStorage.setItem('accessToken', this.accessToken);
|
|
146
|
-
localStorage.setItem('refreshToken', this.refreshToken);
|
|
147
|
-
} else {
|
|
148
|
-
this.showToaster('error', this.t('toaster.noProductPermission'), 5000);
|
|
149
|
-
this.accessToken = null;
|
|
150
|
-
this.refreshToken = null;
|
|
151
|
-
}
|
|
152
|
-
} else {
|
|
153
|
-
localStorage.setItem('accessToken', this.accessToken);
|
|
154
|
-
localStorage.setItem('refreshToken', this.refreshToken);
|
|
155
|
-
}
|
|
156
101
|
} catch (err) {
|
|
157
102
|
ErrorHandler(err);
|
|
158
103
|
}
|
|
@@ -165,9 +110,9 @@ export const useDataStore = defineStore('data', {
|
|
|
165
110
|
const key = getKeyWithPattern(decoded, 'role');
|
|
166
111
|
if (key) {
|
|
167
112
|
const roles = decoded[key];
|
|
168
|
-
if (typeof roles ===
|
|
113
|
+
if (typeof roles === 'string') {
|
|
169
114
|
this.user.roles.push(roles);
|
|
170
|
-
} else if (typeof roles ===
|
|
115
|
+
} else if (typeof roles === 'object') {
|
|
171
116
|
this.user.roles = roles;
|
|
172
117
|
}
|
|
173
118
|
}
|
|
@@ -176,7 +121,17 @@ export const useDataStore = defineStore('data', {
|
|
|
176
121
|
getUserData() {
|
|
177
122
|
return this.accessToken ? jwtDecode(this.accessToken) : null;
|
|
178
123
|
},
|
|
179
|
-
|
|
124
|
+
async getUserGroups() {
|
|
125
|
+
try {
|
|
126
|
+
this.isLoading = true;
|
|
127
|
+
this.userGroups = await this.api.getUserGroups();
|
|
128
|
+
} catch (err) {
|
|
129
|
+
console.log(err);
|
|
130
|
+
} finally {
|
|
131
|
+
this.isLoading = false;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
isRole(whichRole: keyof typeof Roles) {
|
|
180
135
|
if (this.user.roles.length === 0) {
|
|
181
136
|
this.getUserRoles();
|
|
182
137
|
}
|
|
@@ -187,58 +142,62 @@ export const useDataStore = defineStore('data', {
|
|
|
187
142
|
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager();
|
|
188
143
|
},
|
|
189
144
|
isManager() {
|
|
190
|
-
return this.isRole(constants.roles.
|
|
145
|
+
return this.isRole(constants.roles.Manager);
|
|
191
146
|
},
|
|
192
147
|
isCompliance() {
|
|
193
|
-
return this.isRole(constants.roles.
|
|
148
|
+
return this.isRole(constants.roles.Compliance);
|
|
194
149
|
},
|
|
195
150
|
isAdmin() {
|
|
196
|
-
return this.isRole(constants.roles.
|
|
151
|
+
return this.isRole(constants.roles.Admin);
|
|
197
152
|
},
|
|
198
153
|
isAgent() {
|
|
199
|
-
return this.isRole(constants.roles.
|
|
154
|
+
return this.isRole(constants.roles.Agent);
|
|
200
155
|
},
|
|
201
156
|
isManagerHalykBank() {
|
|
202
|
-
return this.isRole(constants.roles.
|
|
157
|
+
return this.isRole(constants.roles.ManagerHalykBank);
|
|
203
158
|
},
|
|
204
159
|
isServiceManager() {
|
|
205
|
-
return this.isRole(constants.roles.
|
|
160
|
+
return this.isRole(constants.roles.ServiceManager);
|
|
206
161
|
},
|
|
207
162
|
isUnderwriter() {
|
|
208
|
-
return this.isRole(constants.roles.
|
|
163
|
+
return this.isRole(constants.roles.Underwriter);
|
|
209
164
|
},
|
|
210
165
|
isAgentMycar() {
|
|
211
|
-
return this.isRole(constants.roles.
|
|
166
|
+
return this.isRole(constants.roles.AgentMycar);
|
|
212
167
|
},
|
|
213
168
|
isAnalyst() {
|
|
214
|
-
return this.isRole(constants.roles.
|
|
169
|
+
return this.isRole(constants.roles.Analyst);
|
|
215
170
|
},
|
|
216
171
|
isUpk() {
|
|
217
|
-
return this.isRole(constants.roles.
|
|
172
|
+
return this.isRole(constants.roles.UPK);
|
|
218
173
|
},
|
|
219
174
|
isDrn() {
|
|
220
|
-
return this.isRole(constants.roles.
|
|
175
|
+
return this.isRole(constants.roles.DRNSJ);
|
|
221
176
|
},
|
|
222
177
|
isSupport() {
|
|
223
|
-
return this.isRole(constants.roles.
|
|
178
|
+
return this.isRole(constants.roles.Support);
|
|
224
179
|
},
|
|
225
180
|
isFinCenter() {
|
|
226
|
-
return this.isRole(constants.roles.
|
|
181
|
+
return this.isRole(constants.roles.FinCenter);
|
|
227
182
|
},
|
|
228
183
|
isSupervisor() {
|
|
229
|
-
return this.isRole(constants.roles.
|
|
184
|
+
return this.isRole(constants.roles.Supervisor);
|
|
230
185
|
},
|
|
231
|
-
isProcessEditable(statusCode) {
|
|
232
|
-
|
|
186
|
+
isProcessEditable(statusCode?: keyof typeof Statuses) {
|
|
187
|
+
const getEditibleStatuses = () => {
|
|
188
|
+
const defaultStatuses = constants.editableStatuses;
|
|
189
|
+
return defaultStatuses;
|
|
190
|
+
};
|
|
191
|
+
return !!getEditibleStatuses().find(status => status === statusCode);
|
|
233
192
|
},
|
|
234
|
-
isProcessReturnable(statusCode) {
|
|
193
|
+
isProcessReturnable(statusCode?: keyof typeof Statuses) {
|
|
235
194
|
const getReturnableStatuses = () => {
|
|
236
195
|
const defaultStatuses = constants.returnStatementStatuses;
|
|
237
196
|
return defaultStatuses;
|
|
238
197
|
};
|
|
239
198
|
return !!getReturnableStatuses().find(status => status === statusCode);
|
|
240
199
|
},
|
|
241
|
-
isProcessCancel(statusCode) {
|
|
200
|
+
isProcessCancel(statusCode?: keyof typeof Statuses) {
|
|
242
201
|
const getCanceleStatuses = () => {
|
|
243
202
|
const defaultStatuses = constants.cancelApplicationStatuses;
|
|
244
203
|
return defaultStatuses;
|
|
@@ -248,13 +207,61 @@ export const useDataStore = defineStore('data', {
|
|
|
248
207
|
isTask() {
|
|
249
208
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
250
209
|
},
|
|
251
|
-
async
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
210
|
+
async loginUser(login: string, password: string, numAttempt: number) {
|
|
211
|
+
try {
|
|
212
|
+
const token = localStorage.getItem('accessToken') || null;
|
|
213
|
+
if (token && isValidToken(token)) {
|
|
214
|
+
this.accessToken = token;
|
|
215
|
+
this.getUserRoles();
|
|
216
|
+
} else {
|
|
217
|
+
const loginResponse = await this.api.loginUser({
|
|
218
|
+
login: login,
|
|
219
|
+
password: password,
|
|
220
|
+
numAttempt: numAttempt,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
this.accessToken = loginResponse.accessToken;
|
|
224
|
+
this.refreshToken = loginResponse.refreshToken;
|
|
225
|
+
this.getUserRoles();
|
|
226
|
+
}
|
|
227
|
+
const checkPermission = () => {
|
|
228
|
+
if (this.isAML) {
|
|
229
|
+
return this.isCompliance() || this.isAdmin() || this.isSupport() || this.isAnalyst();
|
|
230
|
+
}
|
|
231
|
+
if (this.isLKA) {
|
|
232
|
+
return this.isAgent() || this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
|
|
233
|
+
}
|
|
234
|
+
if (this.isEFO) {
|
|
235
|
+
return (
|
|
236
|
+
this.isInitiator() ||
|
|
237
|
+
this.isUnderwriter() ||
|
|
238
|
+
this.isAdmin() ||
|
|
239
|
+
this.isCompliance() ||
|
|
240
|
+
this.isAnalyst() ||
|
|
241
|
+
this.isUpk() ||
|
|
242
|
+
this.isFinCenter() ||
|
|
243
|
+
this.isSupervisor() ||
|
|
244
|
+
this.isSupport()
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
return false;
|
|
248
|
+
};
|
|
249
|
+
if (this.controls.onAuth) {
|
|
250
|
+
const hasPermission = checkPermission();
|
|
251
|
+
if (hasPermission) {
|
|
252
|
+
localStorage.setItem('accessToken', this.accessToken);
|
|
253
|
+
localStorage.setItem('refreshToken', String(this.refreshToken));
|
|
254
|
+
} else {
|
|
255
|
+
this.showToaster('error', this.t('toaster.noProductPermission'), 5000);
|
|
256
|
+
this.accessToken = null;
|
|
257
|
+
this.refreshToken = null;
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
localStorage.setItem('accessToken', this.accessToken);
|
|
261
|
+
localStorage.setItem('refreshToken', String(this.refreshToken));
|
|
262
|
+
}
|
|
263
|
+
} catch (err) {
|
|
264
|
+
ErrorHandler(err);
|
|
258
265
|
}
|
|
259
266
|
},
|
|
260
267
|
async logoutUser() {
|
|
@@ -266,22 +273,31 @@ export const useDataStore = defineStore('data', {
|
|
|
266
273
|
this.$reset();
|
|
267
274
|
this.formStore.$reset();
|
|
268
275
|
localStorage.clear();
|
|
269
|
-
|
|
270
|
-
if (whichProduct === 'efo') {
|
|
276
|
+
if (whichProduct === 'efo' || whichProduct === 'aml' || whichProduct === 'lka') {
|
|
271
277
|
await this.router.push({ name: 'Auth' });
|
|
272
278
|
} else {
|
|
273
279
|
this.sendToParent(constants.postActions.toAuth, null);
|
|
274
280
|
}
|
|
275
281
|
}
|
|
276
282
|
} catch (err) {
|
|
277
|
-
|
|
283
|
+
ErrorHandler(err);
|
|
278
284
|
}
|
|
279
285
|
this.isLoading = false;
|
|
280
286
|
},
|
|
281
|
-
async
|
|
287
|
+
async resetSelected(route: RouteType) {
|
|
288
|
+
this.settings.open = false;
|
|
289
|
+
this.panel.open = false;
|
|
290
|
+
this.panelAction = null;
|
|
291
|
+
this.menu.selectedItem = new MenuItem();
|
|
292
|
+
if (route && route.name) {
|
|
293
|
+
await this.router.replace({ name: route.name });
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
async getFile(file: DocumentItem, mode: string = 'view', fileType: string = 'pdf') {
|
|
297
|
+
if (!file.id) return;
|
|
282
298
|
try {
|
|
283
299
|
this.isLoading = true;
|
|
284
|
-
await this.api.getFile(file.id).then(response => {
|
|
300
|
+
await this.api.getFile(file.id).then((response: any) => {
|
|
285
301
|
if (!['pdf', 'docx'].includes(fileType)) {
|
|
286
302
|
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
287
303
|
const url = window.URL.createObjectURL(blob);
|
|
@@ -292,7 +308,7 @@ export const useDataStore = defineStore('data', {
|
|
|
292
308
|
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
293
309
|
});
|
|
294
310
|
} else {
|
|
295
|
-
link.setAttribute('download', file.fileName);
|
|
311
|
+
link.setAttribute('download', file.fileName!);
|
|
296
312
|
document.body.appendChild(link);
|
|
297
313
|
link.click();
|
|
298
314
|
}
|
|
@@ -308,7 +324,7 @@ export const useDataStore = defineStore('data', {
|
|
|
308
324
|
window.open(url, '_blank', `right=100`);
|
|
309
325
|
});
|
|
310
326
|
} else {
|
|
311
|
-
link.setAttribute('download', file.fileName);
|
|
327
|
+
link.setAttribute('download', file.fileName!);
|
|
312
328
|
document.body.appendChild(link);
|
|
313
329
|
link.click();
|
|
314
330
|
}
|
|
@@ -320,87 +336,72 @@ export const useDataStore = defineStore('data', {
|
|
|
320
336
|
this.isLoading = false;
|
|
321
337
|
}
|
|
322
338
|
},
|
|
323
|
-
async deleteFile(data) {
|
|
339
|
+
async deleteFile(data: DocumentItem) {
|
|
324
340
|
try {
|
|
325
341
|
await this.api.deleteFile(data);
|
|
326
342
|
this.showToaster('success', this.t('toaster.fileWasDeleted'), 3000);
|
|
327
343
|
} catch (err) {
|
|
328
|
-
|
|
344
|
+
ErrorHandler(err);
|
|
329
345
|
}
|
|
330
346
|
},
|
|
331
|
-
async uploadFiles(data, load = false) {
|
|
347
|
+
async uploadFiles(data: FormData, load: boolean = false) {
|
|
348
|
+
this.isLoading = load;
|
|
332
349
|
try {
|
|
333
|
-
if (load) {
|
|
334
|
-
this.isLoading = true;
|
|
335
|
-
}
|
|
336
350
|
await this.api.uploadFiles(data);
|
|
337
351
|
return true;
|
|
338
352
|
} catch (err) {
|
|
339
353
|
return ErrorHandler(err);
|
|
340
354
|
} finally {
|
|
341
|
-
|
|
342
|
-
this.isLoading = false;
|
|
343
|
-
}
|
|
355
|
+
this.isLoading = false;
|
|
344
356
|
}
|
|
345
357
|
},
|
|
346
|
-
async getContragent(member, load = true) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
358
|
+
async getContragent(member: Member, load: boolean = true) {
|
|
359
|
+
this.isLoading = load;
|
|
360
|
+
if (!member.iin) return;
|
|
350
361
|
try {
|
|
351
|
-
|
|
352
|
-
let queryData = {
|
|
362
|
+
const queryData = {
|
|
353
363
|
firstName: '',
|
|
354
364
|
lastName: '',
|
|
355
365
|
middleName: '',
|
|
366
|
+
iin: member.iin.replace(/-/g, ''),
|
|
356
367
|
};
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
await this.serializeContragentData(member, response.items[0]);
|
|
368
|
+
const contragentResponse = await this.api.getContragent(queryData);
|
|
369
|
+
if (contragentResponse.totalItems > 0) {
|
|
370
|
+
if (contragentResponse.items.length === 1) {
|
|
371
|
+
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
362
372
|
} else {
|
|
363
|
-
const sortedByRegistrationDate =
|
|
373
|
+
const sortedByRegistrationDate = contragentResponse.items.sort(
|
|
374
|
+
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
375
|
+
);
|
|
364
376
|
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
365
377
|
}
|
|
366
378
|
member.gotFromInsis = true;
|
|
367
379
|
} else {
|
|
368
|
-
this.
|
|
380
|
+
this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
369
381
|
}
|
|
370
382
|
} catch (err) {
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
if (load) {
|
|
374
|
-
this.isLoading = false;
|
|
383
|
+
ErrorHandler(err);
|
|
375
384
|
}
|
|
385
|
+
this.isLoading = false;
|
|
376
386
|
},
|
|
377
|
-
async getContragentById(id, whichForm,
|
|
378
|
-
|
|
379
|
-
this.isLoading = true;
|
|
380
|
-
}
|
|
387
|
+
async getContragentById(id: number, whichForm: keyof typeof StoreMembers, load: boolean = true, whichIndex: number | null = null) {
|
|
388
|
+
this.isLoading = load;
|
|
381
389
|
try {
|
|
382
|
-
const member = whichIndex === null ? this.formStore[whichForm] : this.formStore[whichForm][whichIndex];
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
this.
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
const response = await this.api.getContragentById(id);
|
|
389
|
-
if (response.totalItems > 0) {
|
|
390
|
-
await this.serializeContragentData(member, response.items[0]);
|
|
390
|
+
const member = whichIndex === null ? this.formStore[whichForm as SingleMember] : this.formStore[whichForm as MultipleMember][whichIndex];
|
|
391
|
+
const contragentResponse = await this.api.getContragentById(id);
|
|
392
|
+
if (contragentResponse.totalItems > 0) {
|
|
393
|
+
await this.serializeContragentData(member, contragentResponse.items[0]);
|
|
391
394
|
} else {
|
|
392
|
-
this.
|
|
393
|
-
return false;
|
|
395
|
+
this.showToaster('error', this.t('toaster.notFoundUser'));
|
|
394
396
|
}
|
|
395
397
|
} catch (err) {
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
if (onlyGet) {
|
|
398
|
+
ErrorHandler(err);
|
|
399
|
+
} finally {
|
|
399
400
|
this.isLoading = false;
|
|
400
401
|
}
|
|
401
402
|
},
|
|
402
|
-
async serializeContragentData(member, contragent) {
|
|
403
|
-
const [
|
|
403
|
+
async serializeContragentData(member: Member, contragent: ContragentType) {
|
|
404
|
+
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
404
405
|
this.api.getContrAgentData(contragent.id),
|
|
405
406
|
this.api.getContrAgentContacts(contragent.id),
|
|
406
407
|
this.api.getContrAgentDocuments(contragent.id),
|
|
@@ -409,56 +410,38 @@ export const useDataStore = defineStore('data', {
|
|
|
409
410
|
member.response = {
|
|
410
411
|
contragent: contragent,
|
|
411
412
|
};
|
|
412
|
-
if (
|
|
413
|
-
member.response.questionnaires =
|
|
413
|
+
if (questionairesResponse.status === 'fulfilled' && questionairesResponse.value && questionairesResponse.value.length) {
|
|
414
|
+
member.response.questionnaires = questionairesResponse.value;
|
|
414
415
|
}
|
|
415
|
-
if (
|
|
416
|
-
member.response.contacts =
|
|
416
|
+
if (contactsResponse.status === 'fulfilled' && contactsResponse.value && contactsResponse.value.length) {
|
|
417
|
+
member.response.contacts = contactsResponse.value;
|
|
417
418
|
}
|
|
418
|
-
if (
|
|
419
|
-
member.response.documents =
|
|
419
|
+
if (documentsResponse.status === 'fulfilled' && documentsResponse.value && documentsResponse.value.length) {
|
|
420
|
+
member.response.documents = documentsResponse.value;
|
|
420
421
|
}
|
|
421
|
-
if (
|
|
422
|
-
member.response.addresses =
|
|
422
|
+
if (addressResponse.status === 'fulfilled' && addressResponse.value && addressResponse.value.length) {
|
|
423
|
+
member.response.addresses = addressResponse.value;
|
|
423
424
|
}
|
|
424
425
|
this.parseContragent(member, {
|
|
425
426
|
personalData: contragent,
|
|
426
|
-
|
|
427
|
-
contacts:
|
|
428
|
-
|
|
429
|
-
address:
|
|
427
|
+
data: questionairesResponse.status === 'fulfilled' ? questionairesResponse.value : undefined,
|
|
428
|
+
contacts: contactsResponse.status === 'fulfilled' ? contactsResponse.value : undefined,
|
|
429
|
+
documents: documentsResponse.status === 'fulfilled' ? documentsResponse.value : undefined,
|
|
430
|
+
address: addressResponse.status === 'fulfilled' ? addressResponse.value : undefined,
|
|
430
431
|
});
|
|
431
432
|
},
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
iin: iin.replace(/-/g, ''),
|
|
437
|
-
firstName: '',
|
|
438
|
-
lastName: '',
|
|
439
|
-
middleName: '',
|
|
440
|
-
};
|
|
441
|
-
const response = await this.api.getContragent(queryData);
|
|
442
|
-
if (response.totalItems > 0) {
|
|
443
|
-
this.contragentList = response.items;
|
|
444
|
-
} else {
|
|
445
|
-
this.contragentList = [];
|
|
446
|
-
}
|
|
447
|
-
} catch (err) {
|
|
448
|
-
console.log(err);
|
|
449
|
-
this.contragentList = [];
|
|
450
|
-
}
|
|
451
|
-
this.isLoading = false;
|
|
452
|
-
},
|
|
453
|
-
parseContragent(member, user) {
|
|
454
|
-
// Save User Personal Data
|
|
433
|
+
parseContragent(
|
|
434
|
+
member: Member,
|
|
435
|
+
user: { personalData: ContragentType; data?: ContragentQuestionaries[]; contacts?: ContragentContacts[]; documents?: ContragentDocuments[]; address?: ContragentAddress[] },
|
|
436
|
+
) {
|
|
455
437
|
member.verifyType = user.personalData.verifyType;
|
|
456
438
|
member.verifyDate = user.personalData.verifyDate;
|
|
457
439
|
member.iin = reformatIin(user.personalData.iin);
|
|
458
|
-
member.age = user.personalData.age;
|
|
440
|
+
member.age = String(user.personalData.age);
|
|
459
441
|
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
460
442
|
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
461
|
-
|
|
443
|
+
const gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
|
|
444
|
+
member.gender = gender ? gender : new Value();
|
|
462
445
|
member.gender.id = user.personalData.gender;
|
|
463
446
|
member.birthDate = reformatDate(user.personalData.birthDate);
|
|
464
447
|
member.genderName = user.personalData.genderName;
|
|
@@ -469,8 +452,8 @@ export const useDataStore = defineStore('data', {
|
|
|
469
452
|
member.id = user.personalData.id;
|
|
470
453
|
member.type = user.personalData.type;
|
|
471
454
|
member.registrationDate = user.personalData.registrationDate;
|
|
472
|
-
|
|
473
|
-
if ('documents' in user && user.documents.length) {
|
|
455
|
+
|
|
456
|
+
if ('documents' in user && user.documents && user.documents.length) {
|
|
474
457
|
member.documentsList = user.documents;
|
|
475
458
|
const documentByPriority = (() => {
|
|
476
459
|
if (this.isLifetrip) {
|
|
@@ -487,30 +470,31 @@ export const useDataStore = defineStore('data', {
|
|
|
487
470
|
member.documentDate = reformatDate(userDocument.issueDate);
|
|
488
471
|
member.documentExpire = reformatDate(userDocument.expireDate);
|
|
489
472
|
}
|
|
490
|
-
|
|
491
|
-
if ('data' in user && user.data.length) {
|
|
492
|
-
user.data.forEach(
|
|
493
|
-
this.searchFromList(member,
|
|
473
|
+
|
|
474
|
+
if ('data' in user && user.data && user.data.length) {
|
|
475
|
+
user.data.forEach(questData => {
|
|
476
|
+
this.searchFromList(member, questData);
|
|
494
477
|
});
|
|
495
478
|
}
|
|
496
|
-
if ('address' in user && user.address.length) {
|
|
497
|
-
const
|
|
498
|
-
const
|
|
499
|
-
const
|
|
500
|
-
const
|
|
501
|
-
const
|
|
479
|
+
if ('address' in user && user.address && user.address.length) {
|
|
480
|
+
const userAddress = user.address[0];
|
|
481
|
+
const country = this.countries.find(i => i.nameRu?.match(new RegExp(userAddress.countryName, 'i')));
|
|
482
|
+
const province = this.states.find(i => i.ids === userAddress.stateCode);
|
|
483
|
+
const localityType = this.localityTypes.find(i => i.nameRu === userAddress.cityTypeName);
|
|
484
|
+
const city = this.cities.find(i => !!userAddress.cityName && i.nameRu === userAddress.cityName.replace('г.', ''));
|
|
485
|
+
const region = this.regions.find(i => !!userAddress.regionCode && i.ids == userAddress.regionCode);
|
|
502
486
|
member.registrationCountry = country ? country : new Value();
|
|
503
|
-
member.registrationStreet =
|
|
487
|
+
member.registrationStreet = userAddress.streetName;
|
|
504
488
|
member.registrationCity = city ? city : new Value();
|
|
505
|
-
member.registrationNumberApartment =
|
|
506
|
-
member.registrationNumberHouse =
|
|
489
|
+
member.registrationNumberApartment = userAddress.apartmentNumber;
|
|
490
|
+
member.registrationNumberHouse = userAddress.blockNumber;
|
|
507
491
|
member.registrationProvince = province ? province : new Value();
|
|
508
492
|
member.registrationRegionType = localityType ? localityType : new Value();
|
|
509
493
|
member.registrationRegion = region ? region : new Value();
|
|
510
|
-
member.registrationQuarter =
|
|
511
|
-
member.registrationMicroDistrict =
|
|
494
|
+
member.registrationQuarter = userAddress.kvartal;
|
|
495
|
+
member.registrationMicroDistrict = userAddress.microRaion;
|
|
512
496
|
}
|
|
513
|
-
if ('contacts' in user && user.contacts.length) {
|
|
497
|
+
if ('contacts' in user && user.contacts && user.contacts.length) {
|
|
514
498
|
user.contacts.forEach(contact => {
|
|
515
499
|
if (contact.type === 'EMAIL' && contact.value) {
|
|
516
500
|
member.email = contact.value;
|
|
@@ -526,84 +510,133 @@ export const useDataStore = defineStore('data', {
|
|
|
526
510
|
});
|
|
527
511
|
}
|
|
528
512
|
},
|
|
529
|
-
|
|
513
|
+
searchFromList(member: Member, searchIt: ContragentQuestionaries) {
|
|
514
|
+
const getQuestionariesData = () => {
|
|
515
|
+
switch (searchIt.questId) {
|
|
516
|
+
case '500003':
|
|
517
|
+
return { from: this.economySectorCode, field: 'economySectorCode' };
|
|
518
|
+
case '500011':
|
|
519
|
+
return { from: this.residents, field: 'signOfResidency' };
|
|
520
|
+
case '500012':
|
|
521
|
+
return { from: this.citizenshipCountries, field: 'countryOfCitizenship' };
|
|
522
|
+
case '500014':
|
|
523
|
+
return { from: this.taxCountries, field: 'countryOfTaxResidency' };
|
|
524
|
+
case '507777':
|
|
525
|
+
return { from: this.addTaxCountries, field: 'addTaxResidency' };
|
|
526
|
+
case '500147':
|
|
527
|
+
return { from: [] };
|
|
528
|
+
case '500148':
|
|
529
|
+
return { from: [] };
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
const qData = getQuestionariesData();
|
|
533
|
+
if (qData && qData.from && qData.from.length && qData.field) {
|
|
534
|
+
const qResult = qData.from.find(i => i.ids === searchIt.questAnswer);
|
|
535
|
+
//@ts-ignore
|
|
536
|
+
member[qData.field] = qResult ? qResult : new Value();
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
async alreadyInInsis(member: Member) {
|
|
540
|
+
if (!member.iin) return null;
|
|
530
541
|
try {
|
|
531
542
|
const queryData = {
|
|
532
|
-
iin: iin.replaceAll('-', ''),
|
|
533
|
-
firstName: !!firstName ? firstName : '',
|
|
534
|
-
lastName: !!lastName ? lastName : '',
|
|
535
|
-
middleName: !!middleName ? middleName : '',
|
|
543
|
+
iin: member.iin.replaceAll('-', ''),
|
|
544
|
+
firstName: !!member.firstName ? member.firstName : '',
|
|
545
|
+
lastName: !!member.lastName ? member.lastName : '',
|
|
546
|
+
middleName: !!member.middleName ? member.middleName : '',
|
|
536
547
|
};
|
|
537
548
|
const contragent = await this.api.getContragent(queryData);
|
|
538
549
|
if (contragent.totalItems > 0) {
|
|
539
|
-
if (contragent.
|
|
550
|
+
if (contragent.items.length === 1) {
|
|
540
551
|
return contragent.items[0].id;
|
|
541
552
|
} else {
|
|
542
|
-
const sortedByRegistrationDate = contragent.items.sort(
|
|
553
|
+
const sortedByRegistrationDate = contragent.items.sort(
|
|
554
|
+
(left, right) => new Date(right.registrationDate).getMilliseconds() - new Date(left.registrationDate).getMilliseconds(),
|
|
555
|
+
);
|
|
543
556
|
return sortedByRegistrationDate[0].id;
|
|
544
557
|
}
|
|
545
558
|
} else {
|
|
546
|
-
return
|
|
559
|
+
return null;
|
|
547
560
|
}
|
|
548
561
|
} catch (err) {
|
|
549
|
-
|
|
550
|
-
return
|
|
562
|
+
ErrorHandler(err);
|
|
563
|
+
return null;
|
|
551
564
|
}
|
|
552
565
|
},
|
|
553
|
-
async
|
|
566
|
+
async searchContragent(iin: string) {
|
|
567
|
+
try {
|
|
568
|
+
const queryData = {
|
|
569
|
+
iin: iin.replace(/-/g, ''),
|
|
570
|
+
firstName: '',
|
|
571
|
+
lastName: '',
|
|
572
|
+
middleName: '',
|
|
573
|
+
};
|
|
574
|
+
const contragentResponse = await this.api.getContragent(queryData);
|
|
575
|
+
if (contragentResponse.totalItems > 0) {
|
|
576
|
+
this.contragentList = contragentResponse.items;
|
|
577
|
+
} else {
|
|
578
|
+
this.contragentList = [];
|
|
579
|
+
}
|
|
580
|
+
} catch (err) {
|
|
581
|
+
ErrorHandler(err);
|
|
582
|
+
this.contragentList = [];
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
async saveContragent(user: Member, whichForm: keyof typeof StoreMembers, whichIndex: number | null, onlySaveAction: boolean = true) {
|
|
554
586
|
this.isLoading = !onlySaveAction;
|
|
555
|
-
const hasInsisId = await this.alreadyInInsis(user
|
|
556
|
-
if (hasInsisId
|
|
587
|
+
const hasInsisId = await this.alreadyInInsis(user);
|
|
588
|
+
if (typeof hasInsisId === 'number') {
|
|
557
589
|
user.id = hasInsisId;
|
|
558
|
-
const [
|
|
590
|
+
const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
|
|
559
591
|
this.api.getContrAgentData(user.id),
|
|
560
592
|
this.api.getContrAgentContacts(user.id),
|
|
561
593
|
this.api.getContrAgentDocuments(user.id),
|
|
562
594
|
this.api.getContrAgentAddress(user.id),
|
|
563
595
|
]);
|
|
564
596
|
user.response = {};
|
|
565
|
-
if (
|
|
566
|
-
user.response.questionnaires =
|
|
597
|
+
if (questionairesResponse.status === 'fulfilled' && questionairesResponse.value && questionairesResponse.value.length) {
|
|
598
|
+
user.response.questionnaires = questionairesResponse.value;
|
|
567
599
|
}
|
|
568
|
-
if (
|
|
569
|
-
user.response.contacts =
|
|
600
|
+
if (contactsResponse.status === 'fulfilled' && contactsResponse.value && contactsResponse.value.length) {
|
|
601
|
+
user.response.contacts = contactsResponse.value;
|
|
570
602
|
}
|
|
571
|
-
if (
|
|
572
|
-
user.response.documents =
|
|
603
|
+
if (documentsResponse.status === 'fulfilled' && documentsResponse.value && documentsResponse.value.length) {
|
|
604
|
+
user.response.documents = documentsResponse.value;
|
|
573
605
|
}
|
|
574
|
-
if (
|
|
575
|
-
user.response.addresses =
|
|
606
|
+
if (addressResponse.status === 'fulfilled' && addressResponse.value && addressResponse.value.length) {
|
|
607
|
+
user.response.addresses = addressResponse.value;
|
|
576
608
|
}
|
|
577
609
|
}
|
|
578
610
|
try {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
birthPlace: user.birthPlace.nameRu,
|
|
611
|
+
const contragentData: ContragentType = {
|
|
612
|
+
id: Number(user.id),
|
|
613
|
+
type: Number(user.type),
|
|
614
|
+
iin: user.iin!.replace(/-/g, ''),
|
|
615
|
+
longName: user.longName !== null ? user.longName : (user.lastName ?? '') + (user.firstName ?? '') + (user.middleName ?? ''),
|
|
616
|
+
lastName: user.lastName ?? '',
|
|
617
|
+
firstName: user.firstName ?? '',
|
|
618
|
+
middleName: user.middleName ?? '',
|
|
619
|
+
birthDate: user.getDateByKey('birthDate')!,
|
|
620
|
+
gender: Number(user.gender.id),
|
|
621
|
+
genderName: user.genderName ? user.genderName : user.gender.nameRu ?? '',
|
|
622
|
+
birthPlace: user.birthPlace.nameRu ?? '',
|
|
592
623
|
age: Number(user.age),
|
|
593
624
|
registrationDate: user.registrationDate,
|
|
594
625
|
verifyType: user.verifyType,
|
|
595
626
|
verifyDate: user.verifyDate,
|
|
596
627
|
};
|
|
597
|
-
|
|
598
|
-
|
|
628
|
+
|
|
629
|
+
const userResponseQuestionnaires =
|
|
630
|
+
'response' in user && user.response && 'questionnaires' in user.response && user.response.questionnaires ? user.response.questionnaires : null;
|
|
631
|
+
const userQuestionnaires = (({ economySectorCode, countryOfCitizenship, countryOfTaxResidency, signOfResidency }) => ({
|
|
599
632
|
economySectorCode,
|
|
600
633
|
countryOfCitizenship,
|
|
601
634
|
countryOfTaxResidency,
|
|
602
635
|
signOfResidency,
|
|
603
636
|
}))(user);
|
|
604
|
-
|
|
637
|
+
const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
|
|
605
638
|
let questName = '';
|
|
606
|
-
let questionId = parseInt(question.ids).toString();
|
|
639
|
+
let questionId = parseInt(String(question.ids)).toString();
|
|
607
640
|
if (questionId === '500003') {
|
|
608
641
|
questName = 'Код сектора экономики';
|
|
609
642
|
} else if (questionId === '500011') {
|
|
@@ -614,23 +647,23 @@ export const useDataStore = defineStore('data', {
|
|
|
614
647
|
questName = 'Страна налогового резиденства';
|
|
615
648
|
}
|
|
616
649
|
return {
|
|
617
|
-
id:
|
|
618
|
-
contragentId: user.id,
|
|
619
|
-
questAnswer: question.ids,
|
|
650
|
+
id: userResponseQuestionnaires !== null ? Number(userResponseQuestionnaires.find(i => i.questId == questionId)?.id) : Number(question.id),
|
|
651
|
+
contragentId: Number(user.id),
|
|
652
|
+
questAnswer: String(question.ids ?? ''),
|
|
620
653
|
questId: questionId,
|
|
621
|
-
questAnswerName: question.nameRu,
|
|
654
|
+
questAnswerName: question.nameRu ?? '',
|
|
622
655
|
questName: questName,
|
|
623
656
|
};
|
|
624
657
|
});
|
|
625
658
|
if (user.countryOfTaxResidency.ids !== '500014.3') {
|
|
626
659
|
user.addTaxResidency = new Value();
|
|
627
660
|
}
|
|
628
|
-
const addTaxResidency =
|
|
661
|
+
const addTaxResidency = userResponseQuestionnaires !== null ? userResponseQuestionnaires.find(i => i.questId === '507777') : undefined;
|
|
629
662
|
if (user.addTaxResidency.nameRu !== null) {
|
|
630
663
|
questionariesData.push({
|
|
631
664
|
id: addTaxResidency ? addTaxResidency.id : 0,
|
|
632
|
-
contragentId: user.id,
|
|
633
|
-
questAnswer: user.addTaxResidency.ids,
|
|
665
|
+
contragentId: Number(user.id),
|
|
666
|
+
questAnswer: String(user.addTaxResidency.ids ?? ''),
|
|
634
667
|
questAnswerName: user.addTaxResidency.nameRu,
|
|
635
668
|
questName: 'Указать если налоговое резиденство выбрано другое',
|
|
636
669
|
questId: '507777',
|
|
@@ -639,7 +672,7 @@ export const useDataStore = defineStore('data', {
|
|
|
639
672
|
if (addTaxResidency && addTaxResidency.questAnswer !== null) {
|
|
640
673
|
questionariesData.push({
|
|
641
674
|
id: addTaxResidency.id,
|
|
642
|
-
contragentId: user.id,
|
|
675
|
+
contragentId: Number(user.id),
|
|
643
676
|
questAnswer: null,
|
|
644
677
|
questAnswerName: null,
|
|
645
678
|
questName: 'Указать если налоговое резиденство выбрано другое',
|
|
@@ -648,74 +681,61 @@ export const useDataStore = defineStore('data', {
|
|
|
648
681
|
}
|
|
649
682
|
}
|
|
650
683
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
if (user.phoneNumber
|
|
684
|
+
const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
|
|
685
|
+
const contactsData: ContragentContacts[] = [];
|
|
686
|
+
if (!!user.phoneNumber) {
|
|
654
687
|
contactsData.push({
|
|
655
|
-
contragentId: user.id,
|
|
656
|
-
id:
|
|
688
|
+
contragentId: Number(user.id),
|
|
689
|
+
id: userResponseContacts !== null ? Number(userResponseContacts.find(i => i.type === 'MOBILE')?.id) : 0,
|
|
657
690
|
newValue: '',
|
|
658
691
|
note: '',
|
|
659
692
|
primaryFlag: 'Y',
|
|
660
693
|
type: 'MOBILE',
|
|
661
694
|
typeName: 'Сотовый телефон',
|
|
662
695
|
value: formatPhone(user.phoneNumber),
|
|
663
|
-
verifyType: user.otpTokenId
|
|
664
|
-
|
|
665
|
-
: 'response' in user && user.response && 'contacts' in user.response
|
|
666
|
-
? user.response.contacts.find(i => i.type === 'MOBILE').verifyType
|
|
667
|
-
: null,
|
|
668
|
-
verifyDate: user.otpTokenId
|
|
669
|
-
? this.currentDate()
|
|
670
|
-
: 'response' in user && user.response && 'contacts' in user.response
|
|
671
|
-
? user.response.contacts.find(i => i.type === 'MOBILE').verifyDate
|
|
672
|
-
: null,
|
|
696
|
+
verifyType: user.otpTokenId ? 'BMG' : userResponseContacts !== null ? userResponseContacts.find(i => i.type === 'MOBILE')?.verifyType : null,
|
|
697
|
+
verifyDate: user.otpTokenId ? this.currentDate() : userResponseContacts !== null ? userResponseContacts.find(i => i.type === 'MOBILE')?.verifyDate : null,
|
|
673
698
|
});
|
|
674
699
|
}
|
|
675
|
-
if (user.email
|
|
700
|
+
if (!!user.email) {
|
|
676
701
|
contactsData.push({
|
|
677
|
-
contragentId: user.id,
|
|
678
|
-
id:
|
|
702
|
+
contragentId: Number(user.id),
|
|
703
|
+
id: userResponseContacts !== null ? Number(userResponseContacts.find(i => i.type === 'EMAIL')?.id) : 0,
|
|
679
704
|
newValue: '',
|
|
680
705
|
note: '',
|
|
681
706
|
primaryFlag: 'N',
|
|
682
707
|
type: 'EMAIL',
|
|
683
708
|
typeName: 'E-Mail',
|
|
684
|
-
value: user.email ? user.email :
|
|
709
|
+
value: user.email ? user.email : userResponseContacts !== null ? userResponseContacts.find(i => i.type === 'EMAIL')?.value ?? '' : '',
|
|
685
710
|
});
|
|
686
711
|
}
|
|
687
|
-
if (user.homePhone
|
|
712
|
+
if (!!user.homePhone) {
|
|
688
713
|
contactsData.push({
|
|
689
|
-
contragentId: user.id,
|
|
690
|
-
id:
|
|
714
|
+
contragentId: Number(user.id),
|
|
715
|
+
id: userResponseContacts !== null ? Number(userResponseContacts.find(i => i.type === 'HOME')?.id) : 0,
|
|
691
716
|
newValue: '',
|
|
692
717
|
note: '',
|
|
693
718
|
primaryFlag: 'N',
|
|
694
719
|
type: 'HOME',
|
|
695
720
|
typeName: 'Домашний телефон',
|
|
696
|
-
value: user.homePhone
|
|
697
|
-
? formatPhone(user.homePhone)
|
|
698
|
-
: 'response' in user && user.response && 'contacts' in user.response
|
|
699
|
-
? user.response.contacts.find(i => i.type === 'HOME').value
|
|
700
|
-
: '',
|
|
721
|
+
value: user.homePhone ? formatPhone(user.homePhone) : userResponseContacts !== null ? userResponseContacts.find(i => i.type === 'HOME')?.value ?? '' : '',
|
|
701
722
|
});
|
|
702
723
|
}
|
|
703
724
|
|
|
704
|
-
|
|
705
|
-
let documentsData = user.documentsList;
|
|
725
|
+
const documentsData = user.documentsList;
|
|
706
726
|
const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
|
|
707
|
-
const userDocument = {
|
|
708
|
-
contragentId: user.id,
|
|
727
|
+
const userDocument: ContragentDocuments = {
|
|
728
|
+
contragentId: Number(user.id),
|
|
709
729
|
id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
|
|
710
730
|
description: null,
|
|
711
|
-
expireDate: user.getDateByKey('documentExpire')
|
|
712
|
-
issueDate: user.getDateByKey('documentDate')
|
|
731
|
+
expireDate: user.getDateByKey('documentExpire')!,
|
|
732
|
+
issueDate: user.getDateByKey('documentDate')!,
|
|
713
733
|
issuerId: Number(user.documentIssuers.ids),
|
|
714
734
|
issuerName: user.documentIssuers.nameKz,
|
|
715
735
|
issuerNameRu: user.documentIssuers.nameRu,
|
|
716
736
|
note: null,
|
|
717
737
|
number: user.documentNumber,
|
|
718
|
-
type: user.documentType.ids,
|
|
738
|
+
type: user.documentType.ids ? String(user.documentType.ids) : '',
|
|
719
739
|
typeName: user.documentType.nameRu,
|
|
720
740
|
serial: null,
|
|
721
741
|
verifyType: user.verifyType,
|
|
@@ -727,27 +747,27 @@ export const useDataStore = defineStore('data', {
|
|
|
727
747
|
documentsData.push(userDocument);
|
|
728
748
|
}
|
|
729
749
|
|
|
730
|
-
|
|
731
|
-
const
|
|
732
|
-
|
|
750
|
+
const checkForNull = (value: any) => (value ? value : '');
|
|
751
|
+
const userResponseAddress = 'response' in user && user.response && 'addresses' in user.response && user.response.addresses ? user.response.addresses : null;
|
|
752
|
+
const addressData: ContragentAddress[] = [];
|
|
733
753
|
addressData.push({
|
|
734
|
-
id:
|
|
735
|
-
contragentId: user.id,
|
|
736
|
-
countryCode: user.registrationCountry.ids,
|
|
737
|
-
countryName: user.registrationCountry.nameRu,
|
|
738
|
-
stateCode: user.registrationProvince.ids,
|
|
739
|
-
stateName: user.registrationProvince.nameRu,
|
|
740
|
-
cityCode: user.registrationCity.code,
|
|
741
|
-
cityName: user.registrationCity.nameRu,
|
|
742
|
-
regionCode: user.registrationRegion.ids,
|
|
754
|
+
id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
|
|
755
|
+
contragentId: Number(user.id),
|
|
756
|
+
countryCode: String(user.registrationCountry.ids ?? ''),
|
|
757
|
+
countryName: user.registrationCountry.nameRu ?? '',
|
|
758
|
+
stateCode: String(user.registrationProvince.ids ?? ''),
|
|
759
|
+
stateName: user.registrationProvince.nameRu ?? '',
|
|
760
|
+
cityCode: String(user.registrationCity.code ?? ''),
|
|
761
|
+
cityName: user.registrationCity.nameRu ?? '',
|
|
762
|
+
regionCode: String(user.registrationRegion.ids ?? ''),
|
|
743
763
|
regionName: user.registrationRegion.nameRu,
|
|
744
|
-
streetName: user.registrationStreet,
|
|
764
|
+
streetName: user.registrationStreet ?? '',
|
|
745
765
|
kvartal: user.registrationQuarter,
|
|
746
766
|
microRaion: user.registrationMicroDistrict,
|
|
747
767
|
cityTypeId: Number(user.registrationRegionType.ids) > 0 ? Number(user.registrationRegionType.ids) : null,
|
|
748
|
-
cityTypeName: user.registrationRegionType.nameRu,
|
|
749
|
-
blockNumber: user.registrationNumberHouse,
|
|
750
|
-
apartmentNumber: user.registrationNumberApartment,
|
|
768
|
+
cityTypeName: user.registrationRegionType.nameRu ?? '',
|
|
769
|
+
blockNumber: user.registrationNumberHouse ?? '',
|
|
770
|
+
apartmentNumber: user.registrationNumberApartment ?? '',
|
|
751
771
|
address: `${checkForNull(user.registrationCountry.nameRu)}, ${checkForNull(user.registrationRegionType.nameRu)} ${checkForNull(
|
|
752
772
|
user.registrationCity.nameRu,
|
|
753
773
|
)}, ул. ${checkForNull(user.registrationStreet)}, д. ${checkForNull(user.registrationNumberHouse)} кв. ${checkForNull(user.registrationNumberApartment)}`,
|
|
@@ -778,13 +798,13 @@ export const useDataStore = defineStore('data', {
|
|
|
778
798
|
}
|
|
779
799
|
return true;
|
|
780
800
|
},
|
|
781
|
-
async saveMember(member, whichMember, memberFromApplicaiton) {
|
|
782
|
-
let data = {};
|
|
801
|
+
async saveMember(member: Member, whichMember: keyof typeof MemberCodes, memberFromApplicaiton: any) {
|
|
802
|
+
let data: any = {};
|
|
783
803
|
try {
|
|
784
804
|
data = {
|
|
785
805
|
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
786
806
|
insisId: member.id,
|
|
787
|
-
iin: member.iin
|
|
807
|
+
iin: member.iin?.replace(/-/g, ''),
|
|
788
808
|
longName: member.longName,
|
|
789
809
|
isIpdl: member.signOfIPDL.nameRu == 'Да' ? true : false,
|
|
790
810
|
isTerror: member.isTerror,
|
|
@@ -806,21 +826,31 @@ export const useDataStore = defineStore('data', {
|
|
|
806
826
|
await this.api.deleteMember('Spokesman', this.formStore.applicationData.processInstanceId);
|
|
807
827
|
}
|
|
808
828
|
data.migrationCard = member.migrationCard;
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
829
|
+
if (member.migrationCardIssueDate) {
|
|
830
|
+
const migrationCardIssueDate = formatDate(member.migrationCardIssueDate);
|
|
831
|
+
if (migrationCardIssueDate) data.migrationCardIssueDate = migrationCardIssueDate.toISOString();
|
|
832
|
+
}
|
|
833
|
+
if (member.migrationCardExpireDate) {
|
|
834
|
+
const migrationCardExpireDate = formatDate(member.migrationCardExpireDate);
|
|
835
|
+
if (migrationCardExpireDate) data.migrationCardExpireDate = migrationCardExpireDate.toISOString();
|
|
836
|
+
}
|
|
813
837
|
data.confirmDocType = member.confirmDocType;
|
|
814
838
|
data.confirmDocNumber = member.confirmDocNumber;
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
839
|
+
if (member.confirmDocIssueDate) {
|
|
840
|
+
const confirmDocIssueDate = formatDate(member.confirmDocIssueDate);
|
|
841
|
+
if (confirmDocIssueDate) data.confirmDocIssueDate = confirmDocIssueDate.toISOString();
|
|
842
|
+
}
|
|
843
|
+
if (member.confirmDocExpireDate) {
|
|
844
|
+
const confirmDocExpireDate = formatDate(member.confirmDocExpireDate);
|
|
845
|
+
if (confirmDocExpireDate) data.confirmDocExpireDate = confirmDocExpireDate.toISOString();
|
|
846
|
+
}
|
|
819
847
|
data.clientLongName = this.formStore.applicationData.clientApp.longName;
|
|
820
848
|
data.notaryLongName = member.notaryLongName;
|
|
821
849
|
data.notaryLicenseNumber = member.notaryLicenseNumber;
|
|
822
|
-
|
|
823
|
-
|
|
850
|
+
if (member.notaryLicenseDate) {
|
|
851
|
+
const notaryLicenseDate = formatDate(member.notaryLicenseDate);
|
|
852
|
+
if (notaryLicenseDate) data.notaryLicenseDate = notaryLicenseDate.toISOString();
|
|
853
|
+
}
|
|
824
854
|
data.notaryLicenseIssuer = member.notaryLicenseIssuer;
|
|
825
855
|
data.jurLongName = member.jurLongName;
|
|
826
856
|
data.fullNameRod = member.fullNameRod;
|
|
@@ -833,13 +863,13 @@ export const useDataStore = defineStore('data', {
|
|
|
833
863
|
if (this.members.insuredApp.has) {
|
|
834
864
|
await this.deleteInsuredLogic();
|
|
835
865
|
}
|
|
836
|
-
if (this.formStore.applicationData.insuredApp.every(i => i.iin !== data.iin) && data.id !== null) {
|
|
866
|
+
if (this.formStore.applicationData.insuredApp.every((i: any) => i.iin !== data.iin) && data.id !== null) {
|
|
837
867
|
await this.api.deleteMember('Insured', data.id);
|
|
838
868
|
delete data.id;
|
|
839
869
|
}
|
|
840
870
|
}
|
|
841
871
|
data.isDisability = this.formStore.isPolicyholderInsured ? false : member.isDisability.nameRu == 'Да';
|
|
842
|
-
data.disabilityGroupId = data.isDisability ? member.
|
|
872
|
+
data.disabilityGroupId = data.isDisability && member.disabilityGroup ? member.disabilityGroup.id : null;
|
|
843
873
|
data.profession = member.job;
|
|
844
874
|
data.position = member.jobPosition;
|
|
845
875
|
data.jobName = member.jobPlace;
|
|
@@ -852,7 +882,7 @@ export const useDataStore = defineStore('data', {
|
|
|
852
882
|
this.formStore.applicationData &&
|
|
853
883
|
this.formStore.applicationData.beneficiaryApp &&
|
|
854
884
|
this.formStore.applicationData.beneficiaryApp.length &&
|
|
855
|
-
this.formStore.applicationData.beneficiaryApp.every(i => i.iin !== data.iin) &&
|
|
885
|
+
this.formStore.applicationData.beneficiaryApp.every((i: any) => i.iin !== data.iin) &&
|
|
856
886
|
data.id !== null
|
|
857
887
|
) {
|
|
858
888
|
await this.api.deleteMember('Beneficiary', data.id);
|
|
@@ -874,7 +904,7 @@ export const useDataStore = defineStore('data', {
|
|
|
874
904
|
this.formStore.applicationData &&
|
|
875
905
|
this.formStore.applicationData.beneficialOwnerApp &&
|
|
876
906
|
this.formStore.applicationData.beneficialOwnerApp.length &&
|
|
877
|
-
this.formStore.applicationData.beneficialOwnerApp.every(i => i.iin !== data.iin) &&
|
|
907
|
+
this.formStore.applicationData.beneficialOwnerApp.every((i: any) => i.iin !== data.iin) &&
|
|
878
908
|
data.id !== null
|
|
879
909
|
) {
|
|
880
910
|
await this.api.deleteMember('BeneficialOwner', data.id);
|
|
@@ -885,48 +915,179 @@ export const useDataStore = defineStore('data', {
|
|
|
885
915
|
await this.api.setMember(whichMember, data);
|
|
886
916
|
return true;
|
|
887
917
|
} catch (err) {
|
|
888
|
-
|
|
918
|
+
if (err instanceof AxiosError) {
|
|
919
|
+
return ErrorHandler(err, err.response?.data?.errors && Object.values(err.response?.data?.errors).join(' -> '));
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
},
|
|
923
|
+
getConditionsData() {
|
|
924
|
+
const conditionsData: {
|
|
925
|
+
policyAppDto: PolicyAppDto;
|
|
926
|
+
addCoversDto: AddCover[];
|
|
927
|
+
} = {
|
|
928
|
+
policyAppDto: {
|
|
929
|
+
id: this.formStore.applicationData?.policyAppDto?.id,
|
|
930
|
+
processInstanceId: this.formStore.applicationData?.policyAppDto?.processInstanceId,
|
|
931
|
+
policyId: null,
|
|
932
|
+
policyNumber: null,
|
|
933
|
+
contractDate: this.currentDate(),
|
|
934
|
+
amount:
|
|
935
|
+
this.formStore.productConditionsForm.requestedSumInsured != null ? Number(String(this.formStore.productConditionsForm.requestedSumInsured).replace(/\s/g, '')) : null,
|
|
936
|
+
premium:
|
|
937
|
+
this.formStore.productConditionsForm.insurancePremiumPerMonth != null
|
|
938
|
+
? Number(String(this.formStore.productConditionsForm.insurancePremiumPerMonth).replace(/\s/g, ''))
|
|
939
|
+
: null,
|
|
940
|
+
isSpokesman: this.formStore.hasRepresentative,
|
|
941
|
+
coverPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
942
|
+
payPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
943
|
+
annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
|
|
944
|
+
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
945
|
+
? String(this.formStore.productConditionsForm.processIndexRate.id)
|
|
946
|
+
: String(this.processIndexRate.find(i => i.code === '0')?.id ?? ''),
|
|
947
|
+
paymentPeriodId: String(this.formStore.productConditionsForm.paymentPeriod.id ?? ''),
|
|
948
|
+
lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply ?? ''),
|
|
949
|
+
lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive ?? ''),
|
|
950
|
+
adbMultiply: formatProcents(this.formStore.productConditionsForm.adbMultiply ?? ''),
|
|
951
|
+
adbAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive ?? ''),
|
|
952
|
+
disabilityMultiply: formatProcents(this.formStore.productConditionsForm.disabilityMultiply ?? ''),
|
|
953
|
+
disabilityAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive ?? ''),
|
|
954
|
+
riskGroup: this.formStore.productConditionsForm.riskGroup?.id ? Number(this.formStore.productConditionsForm.riskGroup.id) : 1,
|
|
955
|
+
},
|
|
956
|
+
addCoversDto: this.formStore.additionalInsuranceTerms,
|
|
957
|
+
};
|
|
958
|
+
if (this.isKazyna) {
|
|
959
|
+
conditionsData.policyAppDto.premiumInCurrency = getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
960
|
+
conditionsData.policyAppDto.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
961
|
+
conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
|
|
962
|
+
}
|
|
963
|
+
if (this.isLiferenta) {
|
|
964
|
+
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
965
|
+
conditionsData.policyAppDto.annuityTypeId = String(this.formStore.productConditionsForm.typeAnnuityInsurance.id ?? '');
|
|
966
|
+
conditionsData.policyAppDto.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
967
|
+
conditionsData.policyAppDto.annuityPaymentPeriodId = String(this.formStore.productConditionsForm.periodAnnuityPayment.id ?? '');
|
|
968
|
+
}
|
|
969
|
+
return conditionsData;
|
|
970
|
+
},
|
|
971
|
+
async clearAddCovers(coverCode: number, coverValue: string) {
|
|
972
|
+
if (!coverCode || !coverValue) return;
|
|
973
|
+
const applicationData = this.getConditionsData();
|
|
974
|
+
const termCoverIndex = applicationData.addCoversDto.findIndex(i => i.coverTypeCode === coverCode);
|
|
975
|
+
if (termCoverIndex !== -1) {
|
|
976
|
+
const answers = await this.getAdditionalInsuranceTermsAnswers(applicationData.addCoversDto[termCoverIndex].coverTypeId);
|
|
977
|
+
if (answers && answers.length) {
|
|
978
|
+
const newCover = answers.find(i => i.code === coverValue);
|
|
979
|
+
if (newCover) {
|
|
980
|
+
applicationData.addCoversDto[termCoverIndex].coverSumId = newCover.id;
|
|
981
|
+
applicationData.addCoversDto[termCoverIndex].coverSumName = newCover.nameRu;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
async deleteInsuredLogic() {
|
|
987
|
+
const applicationData = this.getConditionsData();
|
|
988
|
+
const clearCovers = [{ code: 10, value: 'excluded' }];
|
|
989
|
+
await Promise.allSettled(
|
|
990
|
+
clearCovers.map(async cover => {
|
|
991
|
+
await this.clearAddCovers(cover.code, cover.value);
|
|
992
|
+
}),
|
|
993
|
+
);
|
|
994
|
+
if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth) {
|
|
995
|
+
applicationData.policyAppDto.premium = null;
|
|
996
|
+
}
|
|
997
|
+
if (!!this.formStore.productConditionsForm.requestedSumInsured) {
|
|
998
|
+
applicationData.policyAppDto.amount = null;
|
|
999
|
+
}
|
|
1000
|
+
try {
|
|
1001
|
+
await this.api.setApplication(applicationData);
|
|
1002
|
+
this.showToaster('info', this.t('toaster.needToRecalculate'));
|
|
1003
|
+
} catch (err) {
|
|
1004
|
+
ErrorHandler(err);
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
async getAdditionalInsuranceTermsAnswers(questionId: string) {
|
|
1008
|
+
if (!this.processCode) return null;
|
|
1009
|
+
try {
|
|
1010
|
+
const answers = await this.api.getAdditionalInsuranceTermsAnswers(this.processCode, questionId);
|
|
1011
|
+
return answers;
|
|
1012
|
+
} catch (err) {
|
|
1013
|
+
console.log(err);
|
|
1014
|
+
}
|
|
1015
|
+
return null;
|
|
1016
|
+
},
|
|
1017
|
+
async definedAnswers(
|
|
1018
|
+
filter: string,
|
|
1019
|
+
whichSurvey: 'surveyByHealthBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBase' | 'surveyByCriticalBasePolicyholder',
|
|
1020
|
+
value: any = null,
|
|
1021
|
+
index: number | null = null,
|
|
1022
|
+
) {
|
|
1023
|
+
if (!this.formStore.definedAnswersId[whichSurvey].hasOwnProperty(filter)) {
|
|
1024
|
+
this.formStore.definedAnswersId[whichSurvey][filter] = await this.api.definedAnswers(filter);
|
|
1025
|
+
}
|
|
1026
|
+
if (value !== null && this.formStore.definedAnswersId[whichSurvey][filter].length) {
|
|
1027
|
+
const answer = this.formStore.definedAnswersId[whichSurvey][filter].find((answer: any) => answer.nameRu.match(new RegExp(value, 'i')));
|
|
1028
|
+
//@ts-ignore
|
|
1029
|
+
this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
|
|
1030
|
+
}
|
|
1031
|
+
return this.formStore.definedAnswersId[whichSurvey];
|
|
1032
|
+
},
|
|
1033
|
+
async setSurvey(data: AnketaFirst) {
|
|
1034
|
+
try {
|
|
1035
|
+
this.isLoading = true;
|
|
1036
|
+
const anketaToken = await this.api.setSurvey(data);
|
|
1037
|
+
this.showToaster('success', this.t('toaster.successSaved'), 2000);
|
|
1038
|
+
return anketaToken;
|
|
1039
|
+
} catch (err) {
|
|
1040
|
+
return ErrorHandler(err);
|
|
1041
|
+
} finally {
|
|
1042
|
+
this.isLoading = false;
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
async setINSISWorkData() {
|
|
1046
|
+
if (!this.formStore.applicationData.insisWorkDataApp) return;
|
|
1047
|
+
const data: InsisWorkDataApp = {
|
|
1048
|
+
id: this.formStore.applicationData.insisWorkDataApp.id,
|
|
1049
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
1050
|
+
agentId: Number(this.formStore.AgentData.agentId),
|
|
1051
|
+
agentName: this.formStore.AgentData.fullName,
|
|
1052
|
+
salesChannel: this.formStore.applicationData.insisWorkDataApp.salesChannel,
|
|
1053
|
+
salesChannelName: this.formStore.applicationData.insisWorkDataApp.salesChannelName,
|
|
1054
|
+
insrType: this.formStore.applicationData.insisWorkDataApp.insrType,
|
|
1055
|
+
saleChanellPolicy: String(this.formStore.SaleChanellPolicy.ids ?? ''),
|
|
1056
|
+
saleChanellPolicyName: this.formStore.SaleChanellPolicy.nameRu ?? '',
|
|
1057
|
+
regionPolicy: String(this.formStore.RegionPolicy.ids ?? ''),
|
|
1058
|
+
regionPolicyName: this.formStore.RegionPolicy.nameRu ?? '',
|
|
1059
|
+
managerPolicy: String(this.formStore.ManagerPolicy.ids),
|
|
1060
|
+
managerPolicyName: this.formStore.ManagerPolicy.nameRu ?? '',
|
|
1061
|
+
insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
|
|
1062
|
+
};
|
|
1063
|
+
try {
|
|
1064
|
+
this.isLoading = true;
|
|
1065
|
+
await this.api.setINSISWorkData(data);
|
|
1066
|
+
} catch (err) {
|
|
1067
|
+
ErrorHandler(err);
|
|
1068
|
+
} finally {
|
|
1069
|
+
this.isLoading = false;
|
|
889
1070
|
}
|
|
890
1071
|
},
|
|
891
|
-
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
return [this.residents, 'signOfResidency'];
|
|
898
|
-
case '500012':
|
|
899
|
-
return [this.citizenshipCountries, 'countryOfCitizenship'];
|
|
900
|
-
case '500014':
|
|
901
|
-
return [this.taxCountries, 'countryOfTaxResidency'];
|
|
902
|
-
case '507777':
|
|
903
|
-
return [this.addTaxCountries, 'addTaxResidency'];
|
|
904
|
-
case '500147':
|
|
905
|
-
return [[]];
|
|
906
|
-
case '500148':
|
|
907
|
-
return [[]];
|
|
908
|
-
}
|
|
1072
|
+
async setConfirmation() {
|
|
1073
|
+
const data = {
|
|
1074
|
+
id: this.formStore.affilationResolution.id,
|
|
1075
|
+
processInstanceId: this.formStore.affilationResolution.processInstanceId,
|
|
1076
|
+
number: this.formStore.affilationResolution.number,
|
|
1077
|
+
date: formatDate(this.formStore.affilationResolution.date!)?.toISOString(),
|
|
909
1078
|
};
|
|
910
|
-
|
|
911
|
-
const [searchFrom, whichField] = getQuestionariesData();
|
|
912
|
-
if (searchFrom && searchFrom.length) {
|
|
913
|
-
const result = searchFrom.find(i => i.ids === searchIt.questAnswer);
|
|
914
|
-
member[whichField] = result ? result : new Value();
|
|
915
|
-
}
|
|
916
|
-
},
|
|
917
|
-
async setSurvey(data) {
|
|
918
1079
|
try {
|
|
919
1080
|
this.isLoading = true;
|
|
920
|
-
|
|
921
|
-
this.showToaster('success', this.t('toaster.successSaved')
|
|
922
|
-
return
|
|
923
|
-
} catch (
|
|
1081
|
+
await this.api.setConfirmation(data);
|
|
1082
|
+
this.showToaster('success', this.t('toaster.successSaved'));
|
|
1083
|
+
return true;
|
|
1084
|
+
} catch (err) {
|
|
924
1085
|
return ErrorHandler(err);
|
|
925
1086
|
} finally {
|
|
926
1087
|
this.isLoading = false;
|
|
927
1088
|
}
|
|
928
1089
|
},
|
|
929
|
-
async getFromApi(whichField, whichRequest, parameter, reset = false) {
|
|
1090
|
+
async getFromApi(whichField: string, whichRequest: string, parameter?: any, reset: boolean = false): Promise<Value[]> {
|
|
930
1091
|
const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
|
|
931
1092
|
const currentHour = new Date().getHours();
|
|
932
1093
|
const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / 15);
|
|
@@ -945,9 +1106,11 @@ export const useDataStore = defineStore('data', {
|
|
|
945
1106
|
return true;
|
|
946
1107
|
};
|
|
947
1108
|
if (!!getDataCondition() || reset === true) {
|
|
1109
|
+
//@ts-ignore
|
|
948
1110
|
this[whichField] = [];
|
|
949
1111
|
try {
|
|
950
|
-
|
|
1112
|
+
//@ts-ignore
|
|
1113
|
+
const response: Value[] = await this.api[whichRequest](parameter);
|
|
951
1114
|
if (response) {
|
|
952
1115
|
localStorage.setItem(
|
|
953
1116
|
whichField,
|
|
@@ -958,15 +1121,18 @@ export const useDataStore = defineStore('data', {
|
|
|
958
1121
|
mode: import.meta.env.MODE,
|
|
959
1122
|
}),
|
|
960
1123
|
);
|
|
1124
|
+
//@ts-ignore
|
|
961
1125
|
this[whichField] = response;
|
|
962
1126
|
}
|
|
963
1127
|
} catch (err) {
|
|
964
1128
|
console.log(err);
|
|
965
1129
|
}
|
|
966
1130
|
} else {
|
|
1131
|
+
//@ts-ignore
|
|
967
1132
|
this[whichField] = storageValue.value;
|
|
968
1133
|
}
|
|
969
1134
|
|
|
1135
|
+
//@ts-ignore
|
|
970
1136
|
return this[whichField];
|
|
971
1137
|
},
|
|
972
1138
|
async getCountries() {
|
|
@@ -981,30 +1147,27 @@ export const useDataStore = defineStore('data', {
|
|
|
981
1147
|
async getAdditionalTaxCountries() {
|
|
982
1148
|
return await this.getFromApi('addTaxCountries', 'getAdditionalTaxCountries');
|
|
983
1149
|
},
|
|
984
|
-
async getStates(key, member) {
|
|
1150
|
+
async getStates(key?: string, member?: Member) {
|
|
985
1151
|
await this.getFromApi('states', 'getStates');
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
}
|
|
1152
|
+
//@ts-ignore
|
|
1153
|
+
if (key && member[key] && member[key].ids !== null) return this.states.filter(i => i.code === member[key].ids);
|
|
989
1154
|
return this.states;
|
|
990
1155
|
},
|
|
991
|
-
async getRegions(key, member) {
|
|
1156
|
+
async getRegions(key?: string, member?: Member) {
|
|
992
1157
|
await this.getFromApi('regions', 'getRegions');
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
if (member.registrationProvince.ids !== null) {
|
|
1158
|
+
//@ts-ignore
|
|
1159
|
+
if (key && member[key] && member[key].ids !== null) return this.regions.filter(i => i.code === member[key].ids);
|
|
1160
|
+
if (member && member.registrationProvince.ids !== null) {
|
|
997
1161
|
return this.regions.filter(i => i.code === member.registrationProvince.ids);
|
|
998
1162
|
} else {
|
|
999
1163
|
return this.regions;
|
|
1000
1164
|
}
|
|
1001
1165
|
},
|
|
1002
|
-
async getCities(key, member) {
|
|
1166
|
+
async getCities(key?: string, member?: Member) {
|
|
1003
1167
|
await this.getFromApi('cities', 'getCities');
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
if (member.registrationProvince.ids !== null) {
|
|
1168
|
+
//@ts-ignore
|
|
1169
|
+
if (key && member[key] && member[key].ids !== null) return this.cities.filter(i => i.code === member[key].ids);
|
|
1170
|
+
if (member && member.registrationProvince.ids !== null) {
|
|
1008
1171
|
return this.cities.filter(i => i.code === member.registrationProvince.ids);
|
|
1009
1172
|
} else {
|
|
1010
1173
|
return this.cities;
|
|
@@ -1013,6 +1176,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1013
1176
|
async getLocalityTypes() {
|
|
1014
1177
|
return await this.getFromApi('localityTypes', 'getLocalityTypes');
|
|
1015
1178
|
},
|
|
1179
|
+
async getDicFileTypeList() {
|
|
1180
|
+
return await this.getFromApi('dicFileTypeList', 'getDicFileTypeList');
|
|
1181
|
+
},
|
|
1016
1182
|
async getDocumentTypes() {
|
|
1017
1183
|
const document_list = await this.getFromApi('documentTypes', 'getDocumentTypes');
|
|
1018
1184
|
await this.getDicFileTypeList();
|
|
@@ -1024,9 +1190,6 @@ export const useDataStore = defineStore('data', {
|
|
|
1024
1190
|
}
|
|
1025
1191
|
});
|
|
1026
1192
|
},
|
|
1027
|
-
async getDicFileTypeList() {
|
|
1028
|
-
return await this.getFromApi('dicFileTypeList', 'getDicFileTypeList');
|
|
1029
|
-
},
|
|
1030
1193
|
async getDocumentIssuers() {
|
|
1031
1194
|
return await this.getFromApi('documentIssuers', 'getDocumentIssuers');
|
|
1032
1195
|
},
|
|
@@ -1034,30 +1197,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1034
1197
|
return await this.getFromApi('residents', 'getResidents');
|
|
1035
1198
|
},
|
|
1036
1199
|
async getSectorCodeList() {
|
|
1037
|
-
await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1038
|
-
return this.economySectorCode;
|
|
1200
|
+
return await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1039
1201
|
},
|
|
1040
1202
|
async getFamilyStatuses() {
|
|
1041
1203
|
return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
|
|
1042
1204
|
},
|
|
1043
1205
|
async getRelationTypes() {
|
|
1044
|
-
|
|
1045
|
-
await this.getFromApi('relations', 'getRelationTypes');
|
|
1046
|
-
const filteredRelations = this.relations.filter(i => Number(i.ids) >= 6 && Number(i.ids) <= 15);
|
|
1047
|
-
const otherRelations = this.relations.filter(i => Number(i.ids) < 6 || Number(i.ids) > 15);
|
|
1048
|
-
return [...filteredRelations, ...otherRelations];
|
|
1206
|
+
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1049
1207
|
},
|
|
1050
1208
|
async getProcessIndexRate() {
|
|
1051
|
-
|
|
1052
|
-
return response ? response : [];
|
|
1209
|
+
return await this.getFromApi('processIndexRate', 'getProcessIndexRate', this.processCode);
|
|
1053
1210
|
},
|
|
1054
|
-
async getProcessCoverTypeSum(type) {
|
|
1211
|
+
async getProcessCoverTypeSum(type?: any) {
|
|
1055
1212
|
return await this.getFromApi('processCoverTypeSum', 'getProcessCoverTypeSum', type);
|
|
1056
1213
|
},
|
|
1057
1214
|
async getProcessPaymentPeriod() {
|
|
1058
1215
|
return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
|
|
1059
1216
|
},
|
|
1060
|
-
async getQuestionRefs(id) {
|
|
1217
|
+
async getQuestionRefs(id?: string) {
|
|
1061
1218
|
return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
|
|
1062
1219
|
},
|
|
1063
1220
|
async getProcessTariff() {
|
|
@@ -1080,54 +1237,116 @@ export const useDataStore = defineStore('data', {
|
|
|
1080
1237
|
} catch (err) {
|
|
1081
1238
|
console.log(err);
|
|
1082
1239
|
}
|
|
1240
|
+
return null;
|
|
1083
1241
|
},
|
|
1084
|
-
async
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1242
|
+
async getDictionaryItems(dictName: string) {
|
|
1243
|
+
return await this.getFromApi(dictName, 'getDictionaryItems', dictName);
|
|
1244
|
+
},
|
|
1245
|
+
async getAllFormsData() {
|
|
1246
|
+
await Promise.allSettled([
|
|
1247
|
+
this.getCountries(),
|
|
1248
|
+
this.getCitizenshipCountries(),
|
|
1249
|
+
this.getTaxCountries(),
|
|
1250
|
+
this.getAdditionalTaxCountries(),
|
|
1251
|
+
this.getStates(),
|
|
1252
|
+
this.getRegions(),
|
|
1253
|
+
this.getCities(),
|
|
1254
|
+
this.getLocalityTypes(),
|
|
1255
|
+
this.getDocumentTypes(),
|
|
1256
|
+
this.getDocumentIssuers(),
|
|
1257
|
+
this.getResidents(),
|
|
1258
|
+
this.getSectorCodeList(),
|
|
1259
|
+
this.getFamilyStatuses(),
|
|
1260
|
+
this.getRelationTypes(),
|
|
1261
|
+
this.getProcessIndexRate(),
|
|
1262
|
+
this.getProcessTariff(),
|
|
1263
|
+
this.getProcessPaymentPeriod(),
|
|
1264
|
+
this.getDicFileTypeList(),
|
|
1265
|
+
this.getDicAnnuityTypeList(),
|
|
1266
|
+
this.getProcessAnnuityPaymentPeriod(),
|
|
1267
|
+
this.getInsurancePay(),
|
|
1268
|
+
this.getDictionaryItems('RegionPolicy'),
|
|
1269
|
+
this.getDictionaryItems('SaleChanellPolicy'),
|
|
1270
|
+
]);
|
|
1091
1271
|
},
|
|
1092
|
-
async getQuestionList(
|
|
1272
|
+
async getQuestionList(
|
|
1273
|
+
surveyType: 'health' | 'critical',
|
|
1274
|
+
processInstanceId: string | number,
|
|
1275
|
+
insuredId: any,
|
|
1276
|
+
baseField: string,
|
|
1277
|
+
secondaryField: string,
|
|
1278
|
+
whichMember: 'insured' | 'policyholder' = 'insured',
|
|
1279
|
+
) {
|
|
1280
|
+
//@ts-ignore
|
|
1093
1281
|
if (!this.formStore[baseField] || (this.formStore[baseField] && !this.formStore[baseField].length)) {
|
|
1094
1282
|
try {
|
|
1095
1283
|
if (whichMember === 'insured') {
|
|
1096
|
-
const [
|
|
1284
|
+
const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
|
|
1097
1285
|
this.api.getQuestionList(surveyType, processInstanceId, insuredId),
|
|
1098
1286
|
this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
|
|
1099
1287
|
]);
|
|
1100
|
-
|
|
1101
|
-
|
|
1288
|
+
if (baseQuestions.status === 'fulfilled') {
|
|
1289
|
+
//@ts-ignore
|
|
1290
|
+
this.formStore[baseField] = baseQuestions.value;
|
|
1291
|
+
}
|
|
1292
|
+
if (secondaryQuestions.status === 'fulfilled') {
|
|
1293
|
+
//@ts-ignore
|
|
1294
|
+
this.formStore[secondaryField] = secondaryQuestions;
|
|
1295
|
+
}
|
|
1102
1296
|
}
|
|
1103
1297
|
if (whichMember === 'policyholder') {
|
|
1104
|
-
const [
|
|
1298
|
+
const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
|
|
1105
1299
|
this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
|
|
1106
1300
|
this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
|
|
1107
1301
|
]);
|
|
1108
|
-
|
|
1109
|
-
|
|
1302
|
+
if (baseQuestions.status === 'fulfilled') {
|
|
1303
|
+
//@ts-ignore
|
|
1304
|
+
this.formStore[baseField] = baseQuestions.value;
|
|
1305
|
+
}
|
|
1306
|
+
if (secondaryQuestions.status === 'fulfilled') {
|
|
1307
|
+
//@ts-ignore
|
|
1308
|
+
this.formStore[secondaryField] = secondaryQuestions;
|
|
1309
|
+
}
|
|
1110
1310
|
}
|
|
1111
1311
|
} catch (err) {
|
|
1112
1312
|
console.log(err);
|
|
1113
1313
|
}
|
|
1114
1314
|
}
|
|
1315
|
+
//@ts-ignore
|
|
1115
1316
|
return this.formStore[baseField];
|
|
1116
1317
|
},
|
|
1117
|
-
getNumberWithSpaces(n) {
|
|
1318
|
+
getNumberWithSpaces(n: any) {
|
|
1118
1319
|
return n === null ? null : Number((typeof n === 'string' ? n : n.toFixed().toString()).replace(/[^0-9]+/g, '')).toLocaleString('ru');
|
|
1119
1320
|
},
|
|
1120
|
-
getNumberWithDot(n) {
|
|
1321
|
+
getNumberWithDot(n: any) {
|
|
1121
1322
|
return n === null ? null : n.toLocaleString('ru', { maximumFractionDigits: 2, minimumFractionDigits: 2 }).replace(/,/g, '.');
|
|
1122
1323
|
},
|
|
1123
|
-
async getTaskList(
|
|
1324
|
+
async getTaskList(
|
|
1325
|
+
search: string = '',
|
|
1326
|
+
groupCode: string = 'Work',
|
|
1327
|
+
onlyGet: boolean = false,
|
|
1328
|
+
needToReturn: boolean = false,
|
|
1329
|
+
key: string = 'dateCreated',
|
|
1330
|
+
processInstanceId: string | number | null = null,
|
|
1331
|
+
byOneProcess: number | null = null,
|
|
1332
|
+
) {
|
|
1124
1333
|
if (onlyGet === false) {
|
|
1125
1334
|
this.isLoading = true;
|
|
1126
1335
|
}
|
|
1127
1336
|
try {
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1130
|
-
const
|
|
1337
|
+
type ColumnKey = keyof typeof this.isColumnAsc;
|
|
1338
|
+
const column = this.isColumnAsc[key as ColumnKey] === null ? 'dateCreated' : key;
|
|
1339
|
+
const direction = this.isColumnAsc[key as ColumnKey] === null ? 'desc' : this.isColumnAsc[key as ColumnKey] === true ? 'asc' : 'desc';
|
|
1340
|
+
const query: {
|
|
1341
|
+
pageIndex: number;
|
|
1342
|
+
pageSize: number;
|
|
1343
|
+
search: string;
|
|
1344
|
+
column: string;
|
|
1345
|
+
direction: string;
|
|
1346
|
+
groupCode: string;
|
|
1347
|
+
processCode?: number;
|
|
1348
|
+
processCodes?: number[];
|
|
1349
|
+
} = {
|
|
1131
1350
|
pageIndex: processInstanceId === null ? this.historyPageIndex - 1 : 0,
|
|
1132
1351
|
pageSize: this.historyPageSize,
|
|
1133
1352
|
search: search ? search.replace(/-/g, '') : '',
|
|
@@ -1149,8 +1368,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1149
1368
|
this.historyTotalItems = taskList.totalItems;
|
|
1150
1369
|
}
|
|
1151
1370
|
} catch (err) {
|
|
1152
|
-
|
|
1153
|
-
console.log(err);
|
|
1371
|
+
ErrorHandler(err);
|
|
1154
1372
|
} finally {
|
|
1155
1373
|
this.isLoading = false;
|
|
1156
1374
|
}
|
|
@@ -1158,7 +1376,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1158
1376
|
this.isLoading = false;
|
|
1159
1377
|
}
|
|
1160
1378
|
},
|
|
1161
|
-
async getProcessHistoryList(id) {
|
|
1379
|
+
async getProcessHistoryList(id: string) {
|
|
1162
1380
|
try {
|
|
1163
1381
|
const processHistory = await this.api.getProcessHistory(id);
|
|
1164
1382
|
if (processHistory.length > 0) {
|
|
@@ -1170,7 +1388,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1170
1388
|
console.log(err);
|
|
1171
1389
|
}
|
|
1172
1390
|
},
|
|
1173
|
-
async getProcessHistory(id) {
|
|
1391
|
+
async getProcessHistory(id: string) {
|
|
1174
1392
|
this.isLoading = true;
|
|
1175
1393
|
try {
|
|
1176
1394
|
const processHistory = await this.api.getProcessHistory(id);
|
|
@@ -1184,45 +1402,11 @@ export const useDataStore = defineStore('data', {
|
|
|
1184
1402
|
}
|
|
1185
1403
|
this.isLoading = false;
|
|
1186
1404
|
},
|
|
1187
|
-
|
|
1188
|
-
const found = this[from].find(i => i[key] == searchKey);
|
|
1189
|
-
return found || new Value();
|
|
1190
|
-
},
|
|
1191
|
-
async getAllFormsData() {
|
|
1192
|
-
await Promise.allSettled([
|
|
1193
|
-
this.getCountries(),
|
|
1194
|
-
this.getCitizenshipCountries(),
|
|
1195
|
-
this.getTaxCountries(),
|
|
1196
|
-
this.getAdditionalTaxCountries(),
|
|
1197
|
-
this.getStates(),
|
|
1198
|
-
this.getRegions(),
|
|
1199
|
-
this.getCities(),
|
|
1200
|
-
this.getLocalityTypes(),
|
|
1201
|
-
this.getDocumentTypes(),
|
|
1202
|
-
this.getDocumentIssuers(),
|
|
1203
|
-
this.getResidents(),
|
|
1204
|
-
this.getSectorCodeList(),
|
|
1205
|
-
this.getFamilyStatuses(),
|
|
1206
|
-
this.getRelationTypes(),
|
|
1207
|
-
this.getProcessIndexRate(),
|
|
1208
|
-
this.getProcessTariff(),
|
|
1209
|
-
this.getProcessPaymentPeriod(),
|
|
1210
|
-
this.getDicFileTypeList(),
|
|
1211
|
-
this.getDicAnnuityTypeList(),
|
|
1212
|
-
this.getProcessAnnuityPaymentPeriod(),
|
|
1213
|
-
this.getInsurancePay(),
|
|
1214
|
-
this.getDictionaryItems('RegionPolicy'),
|
|
1215
|
-
this.getDictionaryItems('SaleChanellPolicy'),
|
|
1216
|
-
]);
|
|
1217
|
-
},
|
|
1218
|
-
async getUserGroups() {
|
|
1405
|
+
async getProcessHistoryLog(taskId: string) {
|
|
1219
1406
|
try {
|
|
1220
|
-
this.
|
|
1221
|
-
this.userGroups = await this.api.getUserGroups();
|
|
1407
|
+
return await this.api.getProcessHistoryLog(taskId);
|
|
1222
1408
|
} catch (err) {
|
|
1223
|
-
|
|
1224
|
-
} finally {
|
|
1225
|
-
this.isLoading = false;
|
|
1409
|
+
ErrorHandler(err);
|
|
1226
1410
|
}
|
|
1227
1411
|
},
|
|
1228
1412
|
async getProcessList() {
|
|
@@ -1237,28 +1421,34 @@ export const useDataStore = defineStore('data', {
|
|
|
1237
1421
|
}
|
|
1238
1422
|
this.isLoading = false;
|
|
1239
1423
|
},
|
|
1240
|
-
sortTaskList(key) {
|
|
1424
|
+
sortTaskList(key: string) {
|
|
1241
1425
|
if (this.taskList.length !== 0) {
|
|
1242
1426
|
if (key in this.isColumnAsc) {
|
|
1243
|
-
|
|
1427
|
+
type ColumnKey = keyof typeof this.isColumnAsc;
|
|
1428
|
+
if (this.isColumnAsc[key as ColumnKey] === true) {
|
|
1244
1429
|
this.isColumnAsc = { ...InitialColumns() };
|
|
1245
|
-
this.isColumnAsc[key] = false;
|
|
1430
|
+
this.isColumnAsc[key as ColumnKey] = false;
|
|
1246
1431
|
return;
|
|
1247
1432
|
}
|
|
1248
|
-
if (this.isColumnAsc[key] === false) {
|
|
1433
|
+
if (this.isColumnAsc[key as ColumnKey] === false) {
|
|
1249
1434
|
this.isColumnAsc = { ...InitialColumns() };
|
|
1250
|
-
this.isColumnAsc[key] = null;
|
|
1435
|
+
this.isColumnAsc[key as ColumnKey] = null;
|
|
1251
1436
|
return;
|
|
1252
1437
|
}
|
|
1253
|
-
if (this.isColumnAsc[key] === null) {
|
|
1438
|
+
if (this.isColumnAsc[key as ColumnKey] === null) {
|
|
1254
1439
|
this.isColumnAsc = { ...InitialColumns() };
|
|
1255
|
-
this.isColumnAsc[key] = true;
|
|
1440
|
+
this.isColumnAsc[key as ColumnKey] = true;
|
|
1256
1441
|
return;
|
|
1257
1442
|
}
|
|
1258
1443
|
}
|
|
1259
1444
|
}
|
|
1260
1445
|
},
|
|
1261
|
-
|
|
1446
|
+
findObject(from: string, key: string, searchKey: any): any {
|
|
1447
|
+
// @ts-ignore
|
|
1448
|
+
const found = this[from].find(i => i[key] == searchKey);
|
|
1449
|
+
return found || new Value();
|
|
1450
|
+
},
|
|
1451
|
+
async searchAgentByName(name: string) {
|
|
1262
1452
|
try {
|
|
1263
1453
|
this.AgentData = await this.api.searchAgentByName(name);
|
|
1264
1454
|
if (!this.AgentData.length) {
|
|
@@ -1268,45 +1458,16 @@ export const useDataStore = defineStore('data', {
|
|
|
1268
1458
|
console.log(err);
|
|
1269
1459
|
}
|
|
1270
1460
|
},
|
|
1271
|
-
async
|
|
1272
|
-
const data = {
|
|
1273
|
-
id: this.formStore.applicationData.insisWorkDataApp.id,
|
|
1274
|
-
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
1275
|
-
agentId: this.formStore.AgentData.agentId,
|
|
1276
|
-
agentName: this.formStore.AgentData.fullName,
|
|
1277
|
-
salesChannel: this.formStore.applicationData.insisWorkDataApp.salesChannel,
|
|
1278
|
-
salesChannelName: this.formStore.applicationData.insisWorkDataApp.salesChannelName,
|
|
1279
|
-
insrType: this.formStore.applicationData.insisWorkDataApp.insrType,
|
|
1280
|
-
saleChanellPolicy: this.formStore.SaleChanellPolicy.ids,
|
|
1281
|
-
saleChanellPolicyName: this.formStore.SaleChanellPolicy.nameRu,
|
|
1282
|
-
regionPolicy: this.formStore.RegionPolicy.ids,
|
|
1283
|
-
regionPolicyName: this.formStore.RegionPolicy.nameRu,
|
|
1284
|
-
managerPolicy: this.formStore.ManagerPolicy.ids,
|
|
1285
|
-
managerPolicyName: this.formStore.ManagerPolicy.nameRu,
|
|
1286
|
-
insuranceProgramType: this.formStore.applicationData.insisWorkDataApp.insuranceProgramType,
|
|
1287
|
-
};
|
|
1288
|
-
try {
|
|
1289
|
-
this.isLoading = true;
|
|
1290
|
-
await this.api.setINSISWorkData(data);
|
|
1291
|
-
} catch (err) {
|
|
1292
|
-
console.log(err);
|
|
1293
|
-
} finally {
|
|
1294
|
-
this.isLoading = false;
|
|
1295
|
-
}
|
|
1296
|
-
},
|
|
1297
|
-
async getDictionaryItems(dictName) {
|
|
1298
|
-
return await this.getFromApi(dictName, 'getDictionaryItems', dictName);
|
|
1299
|
-
},
|
|
1300
|
-
async filterManagerByRegion(filterName) {
|
|
1461
|
+
async filterManagerByRegion(filterName: string) {
|
|
1301
1462
|
try {
|
|
1302
1463
|
this.ManagerPolicy = await this.api.filterManagerByRegion('ManagerPolicy', filterName);
|
|
1303
1464
|
} catch (err) {
|
|
1304
1465
|
console.log(err);
|
|
1305
1466
|
}
|
|
1306
1467
|
},
|
|
1307
|
-
async getUnderwritingCouncilData(id) {
|
|
1468
|
+
async getUnderwritingCouncilData(id: string | number) {
|
|
1308
1469
|
try {
|
|
1309
|
-
const response = await this.api.getUnderwritingCouncilData(id);
|
|
1470
|
+
const response: any = await this.api.getUnderwritingCouncilData(id);
|
|
1310
1471
|
this.formStore.affilationResolution.id = response.underwritingCouncilAppDto.id;
|
|
1311
1472
|
this.formStore.affilationResolution.date = response.underwritingCouncilAppDto.date ? reformatDate(response.underwritingCouncilAppDto.date) : null;
|
|
1312
1473
|
this.formStore.affilationResolution.number = response.underwritingCouncilAppDto.number ? response.underwritingCouncilAppDto.number : null;
|
|
@@ -1314,25 +1475,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1314
1475
|
console.log(err);
|
|
1315
1476
|
}
|
|
1316
1477
|
},
|
|
1317
|
-
async
|
|
1318
|
-
const data = {
|
|
1319
|
-
id: this.formStore.affilationResolution.id,
|
|
1320
|
-
processInstanceId: this.formStore.affilationResolution.processInstanceId,
|
|
1321
|
-
number: this.formStore.affilationResolution.number,
|
|
1322
|
-
date: formatDate(this.formStore.affilationResolution.date)?.toISOString(),
|
|
1323
|
-
};
|
|
1324
|
-
try {
|
|
1325
|
-
this.isLoading = true;
|
|
1326
|
-
await this.api.setConfirmation(data);
|
|
1327
|
-
this.showToaster('success', this.t('toaster.successSaved'));
|
|
1328
|
-
return true;
|
|
1329
|
-
} catch (err) {
|
|
1330
|
-
return ErrorHandler(err);
|
|
1331
|
-
} finally {
|
|
1332
|
-
this.isLoading = false;
|
|
1333
|
-
}
|
|
1334
|
-
},
|
|
1335
|
-
async sendUnderwritingCouncilTask(data) {
|
|
1478
|
+
async sendUnderwritingCouncilTask(data: any) {
|
|
1336
1479
|
try {
|
|
1337
1480
|
await this.api.sendUnderwritingCouncilTask(data);
|
|
1338
1481
|
this.showToaster('success', this.t('toaster.successOperation'), 5000);
|
|
@@ -1341,144 +1484,51 @@ export const useDataStore = defineStore('data', {
|
|
|
1341
1484
|
return ErrorHandler(err);
|
|
1342
1485
|
}
|
|
1343
1486
|
},
|
|
1344
|
-
async
|
|
1345
|
-
if (!this.formStore.definedAnswersId[whichSurvey].hasOwnProperty(filter)) {
|
|
1346
|
-
this.formStore.definedAnswersId[whichSurvey][filter] = await this.api.definedAnswers(filter);
|
|
1347
|
-
}
|
|
1348
|
-
if (value !== null && this.formStore.definedAnswersId[whichSurvey][filter].length) {
|
|
1349
|
-
const answer = this.formStore.definedAnswersId[whichSurvey][filter].find(answer => answer.nameRu.match(new RegExp(value, 'i')));
|
|
1350
|
-
this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
|
|
1351
|
-
}
|
|
1352
|
-
return this.formStore.definedAnswersId[whichSurvey];
|
|
1353
|
-
},
|
|
1354
|
-
getConditionsData() {
|
|
1355
|
-
const conditionsData = {
|
|
1356
|
-
policyAppDto: {
|
|
1357
|
-
id: this.formStore.applicationData.policyAppDto.id,
|
|
1358
|
-
processInstanceId: this.formStore.applicationData.policyAppDto.processInstanceId,
|
|
1359
|
-
policyId: null,
|
|
1360
|
-
policyNumber: null,
|
|
1361
|
-
contractDate: this.currentDate(),
|
|
1362
|
-
amount: this.formStore.productConditionsForm.requestedSumInsured != null ? Number(this.formStore.productConditionsForm.requestedSumInsured.replace(/\s/g, '')) : null,
|
|
1363
|
-
premium:
|
|
1364
|
-
this.formStore.productConditionsForm.insurancePremiumPerMonth != null ? Number(this.formStore.productConditionsForm.insurancePremiumPerMonth.replace(/\s/g, '')) : null,
|
|
1365
|
-
isSpokesman: this.formStore.hasRepresentative,
|
|
1366
|
-
coverPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
1367
|
-
payPeriod: this.formStore.productConditionsForm.coverPeriod,
|
|
1368
|
-
annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
|
|
1369
|
-
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
1370
|
-
? this.formStore.productConditionsForm.processIndexRate.id
|
|
1371
|
-
: this.processIndexRate.find(i => i.code === '0')?.id,
|
|
1372
|
-
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
|
|
1373
|
-
lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply),
|
|
1374
|
-
lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive),
|
|
1375
|
-
adbMultiply: formatProcents(this.formStore.productConditionsForm.adbMultiply),
|
|
1376
|
-
adbAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
|
|
1377
|
-
disabilityMultiply: formatProcents(this.formStore.productConditionsForm.disabilityMultiply),
|
|
1378
|
-
disabilityAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
|
|
1379
|
-
riskGroup: this.formStore.productConditionsForm.riskGroup?.id ? this.formStore.productConditionsForm.riskGroup.id : 1,
|
|
1380
|
-
},
|
|
1381
|
-
addCoversDto: this.formStore.additionalInsuranceTerms,
|
|
1382
|
-
};
|
|
1383
|
-
if (this.isKazyna) {
|
|
1384
|
-
conditionsData.policyAppDto.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
|
|
1385
|
-
conditionsData.policyAppDto.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
|
|
1386
|
-
conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
|
|
1387
|
-
}
|
|
1388
|
-
if (this.isLiferenta) {
|
|
1389
|
-
conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1390
|
-
conditionsData.policyAppDto.annuityTypeId = this.formStore.productConditionsForm.typeAnnuityInsurance.id;
|
|
1391
|
-
conditionsData.policyAppDto.paymentPeriod = this.formStore.productConditionsForm.termAnnuityPayments;
|
|
1392
|
-
conditionsData.policyAppDto.annuityPaymentPeriodId = this.formStore.productConditionsForm.periodAnnuityPayment.id;
|
|
1393
|
-
}
|
|
1394
|
-
return conditionsData;
|
|
1395
|
-
},
|
|
1396
|
-
async clearAddCovers(coverCode, coverValue) {
|
|
1397
|
-
if (!coverCode || !coverValue) return;
|
|
1398
|
-
const applicationData = this.getConditionsData();
|
|
1399
|
-
const termCoverIndex = applicationData.addCoversDto.findIndex(i => i.coverTypeCode === coverCode);
|
|
1400
|
-
if (termCoverIndex !== -1) {
|
|
1401
|
-
const answers = await this.getAdditionalInsuranceTermsAnswers(applicationData.addCoversDto[termCoverIndex].coverTypeId);
|
|
1402
|
-
if (answers.length) {
|
|
1403
|
-
const newCover = answers.find(i => i.code === coverValue);
|
|
1404
|
-
if (newCover) {
|
|
1405
|
-
applicationData.addCoversDto[termCoverIndex].coverSumId = newCover.id;
|
|
1406
|
-
applicationData.addCoversDto[termCoverIndex].coverSumName = newCover.nameRu;
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
},
|
|
1411
|
-
async deleteInsuredLogic() {
|
|
1412
|
-
const applicationData = this.getConditionsData();
|
|
1413
|
-
const clearCovers = [{ code: 10, value: 'excluded' }];
|
|
1414
|
-
await Promise.allSettled(
|
|
1415
|
-
clearCovers.map(async cover => {
|
|
1416
|
-
await this.clearAddCovers(cover.code, cover.value);
|
|
1417
|
-
}),
|
|
1418
|
-
);
|
|
1419
|
-
if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth) {
|
|
1420
|
-
applicationData.policyAppDto.premium = null;
|
|
1421
|
-
}
|
|
1422
|
-
if (!!this.formStore.productConditionsForm.requestedSumInsured) {
|
|
1423
|
-
applicationData.policyAppDto.amount = null;
|
|
1424
|
-
}
|
|
1425
|
-
try {
|
|
1426
|
-
await this.api.setApplication(applicationData);
|
|
1427
|
-
this.showToaster('info', this.t('toaster.needToRecalculate'));
|
|
1428
|
-
} catch (err) {
|
|
1429
|
-
ErrorHandler(err);
|
|
1430
|
-
}
|
|
1431
|
-
},
|
|
1432
|
-
async getPaymentTable(id) {
|
|
1433
|
-
try {
|
|
1434
|
-
const paymentResultTable = await this.api.calculatePremuim(id);
|
|
1435
|
-
if (paymentResultTable.length > 0) {
|
|
1436
|
-
this.paymentResultTable = paymentResultTable;
|
|
1437
|
-
} else {
|
|
1438
|
-
this.paymentResultTable = [];
|
|
1439
|
-
}
|
|
1440
|
-
} catch (err) {
|
|
1441
|
-
console.log(err);
|
|
1442
|
-
}
|
|
1443
|
-
},
|
|
1444
|
-
async getDefaultCalculationData(showLoader = false, product = null) {
|
|
1487
|
+
async getDefaultCalculationData(showLoader: boolean = false, product: string | null = null) {
|
|
1445
1488
|
this.isLoading = showLoader;
|
|
1446
1489
|
try {
|
|
1447
1490
|
const calculationData = await this.api.getDefaultCalculationData(this.isCalculator ? product : undefined);
|
|
1448
1491
|
return calculationData;
|
|
1449
1492
|
} catch (err) {
|
|
1450
1493
|
ErrorHandler(err);
|
|
1494
|
+
return null;
|
|
1451
1495
|
} finally {
|
|
1452
1496
|
this.isLoading = false;
|
|
1453
1497
|
}
|
|
1454
1498
|
},
|
|
1455
|
-
async calculateWithoutApplication(showLoader = false, product = null) {
|
|
1499
|
+
async calculateWithoutApplication(showLoader: boolean = false, product: string | null = null) {
|
|
1456
1500
|
this.isLoading = showLoader;
|
|
1457
1501
|
try {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1502
|
+
if (!this.formStore.productConditionsForm.signDate || !this.formStore.productConditionsForm.birthDate) {
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
const signDate = formatDate(this.formStore.productConditionsForm.signDate);
|
|
1506
|
+
const birthDate = formatDate(this.formStore.productConditionsForm.birthDate);
|
|
1507
|
+
if (!signDate || !birthDate) return;
|
|
1508
|
+
const calculationData: RecalculationDataType & PolicyAppDto = {
|
|
1509
|
+
signDate: signDate.toISOString(),
|
|
1510
|
+
birthDate: birthDate.toISOString(),
|
|
1511
|
+
gender: Number(this.formStore.productConditionsForm.gender.id),
|
|
1512
|
+
amount: getNumber(String(this.formStore.productConditionsForm.requestedSumInsured)),
|
|
1513
|
+
premium: getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonth)),
|
|
1514
|
+
coverPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
|
|
1515
|
+
payPeriod: Number(this.formStore.productConditionsForm.coverPeriod),
|
|
1466
1516
|
indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
|
|
1467
|
-
? this.formStore.productConditionsForm.processIndexRate.id
|
|
1468
|
-
: this.processIndexRate.find(i => i.code === '0')?.id,
|
|
1469
|
-
paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
|
|
1517
|
+
? String(this.formStore.productConditionsForm.processIndexRate.id)
|
|
1518
|
+
: String(this.processIndexRate.find(i => i.code === '0')?.id),
|
|
1519
|
+
paymentPeriodId: String(this.formStore.productConditionsForm.paymentPeriod.id),
|
|
1470
1520
|
addCovers: this.formStore.additionalInsuranceTermsWithout,
|
|
1471
1521
|
};
|
|
1472
1522
|
if (this.isKazyna || product === 'halykkazyna') {
|
|
1473
|
-
calculationData.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
|
|
1474
|
-
calculationData.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
|
|
1523
|
+
calculationData.premiumInCurrency = getNumber(String(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar));
|
|
1524
|
+
calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
|
|
1475
1525
|
calculationData.currencyExchangeRate = this.currencies.usd;
|
|
1476
1526
|
}
|
|
1477
1527
|
if (this.isLiferenta) {
|
|
1478
1528
|
calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
|
|
1479
|
-
calculationData.annuityTypeId = this.formStore.productConditionsForm.typeAnnuityInsurance.id;
|
|
1480
|
-
calculationData.paymentPeriod = this.formStore.productConditionsForm.termAnnuityPayments;
|
|
1481
|
-
calculationData.annuityPaymentPeriodId = this.formStore.productConditionsForm.periodAnnuityPayment.id;
|
|
1529
|
+
calculationData.annuityTypeId = String(this.formStore.productConditionsForm.typeAnnuityInsurance.id);
|
|
1530
|
+
calculationData.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
|
|
1531
|
+
calculationData.annuityPaymentPeriodId = String(this.formStore.productConditionsForm.periodAnnuityPayment.id);
|
|
1482
1532
|
}
|
|
1483
1533
|
const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
|
|
1484
1534
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
|
|
@@ -1502,17 +1552,17 @@ export const useDataStore = defineStore('data', {
|
|
|
1502
1552
|
return !!this.formStore.productConditionsForm.requestedSumInsured && !!this.formStore.productConditionsForm.insurancePremiumPerMonth;
|
|
1503
1553
|
}
|
|
1504
1554
|
},
|
|
1505
|
-
async calculate(taskId) {
|
|
1555
|
+
async calculate(taskId: string) {
|
|
1506
1556
|
this.isLoading = true;
|
|
1507
1557
|
try {
|
|
1508
1558
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1509
1559
|
await this.api.setApplication(this.getConditionsData());
|
|
1510
1560
|
const result = ref();
|
|
1511
|
-
result.value = await this.api.getCalculation(id);
|
|
1561
|
+
result.value = await this.api.getCalculation(String(id));
|
|
1512
1562
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
1513
1563
|
this.formStore.applicationData = applicationData;
|
|
1514
|
-
this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1515
|
-
if (this.isKazyna) {
|
|
1564
|
+
if (this.formStore.applicationData.addCoverDto) this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
|
|
1565
|
+
if (this.isKazyna && this.currencies.usd) {
|
|
1516
1566
|
if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
|
|
1517
1567
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
|
|
1518
1568
|
} else {
|
|
@@ -1535,13 +1585,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1535
1585
|
}
|
|
1536
1586
|
this.isLoading = false;
|
|
1537
1587
|
},
|
|
1538
|
-
async startApplication(member) {
|
|
1588
|
+
async startApplication(member: Member) {
|
|
1589
|
+
if (!member.iin) return false;
|
|
1539
1590
|
try {
|
|
1540
|
-
const data = {
|
|
1591
|
+
const data: StartApplicationType = {
|
|
1541
1592
|
clientId: member.id,
|
|
1542
1593
|
iin: member.iin.replace(/-/g, ''),
|
|
1543
|
-
longName: member.longName,
|
|
1544
|
-
processCode: this.processCode,
|
|
1594
|
+
longName: member.longName ?? '',
|
|
1595
|
+
processCode: Number(this.processCode),
|
|
1545
1596
|
policyId: 0,
|
|
1546
1597
|
};
|
|
1547
1598
|
const response = await this.api.startApplication(data);
|
|
@@ -1551,10 +1602,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1551
1602
|
return ErrorHandler(err);
|
|
1552
1603
|
}
|
|
1553
1604
|
},
|
|
1554
|
-
async getApplicationData(taskId, onlyGet = true, setMembersField = true, fetchMembers = true, setProductConditions = true) {
|
|
1555
|
-
|
|
1556
|
-
this.isLoading = true;
|
|
1557
|
-
}
|
|
1605
|
+
async getApplicationData(taskId: string, onlyGet: boolean = true, setMembersField: boolean = true, fetchMembers: boolean = true, setProductConditions: boolean = true) {
|
|
1606
|
+
this.isLoading = onlyGet;
|
|
1558
1607
|
try {
|
|
1559
1608
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
1560
1609
|
if (this.processCode !== applicationData.processCode) {
|
|
@@ -1578,10 +1627,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1578
1627
|
this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
|
|
1579
1628
|
|
|
1580
1629
|
const clientData = applicationData.clientApp;
|
|
1581
|
-
const insuredData = applicationData.insuredApp;
|
|
1582
|
-
const
|
|
1583
|
-
const
|
|
1584
|
-
const
|
|
1630
|
+
const insuredData: any[] = applicationData.insuredApp;
|
|
1631
|
+
const beneficiaryData: any[] = applicationData.beneficiaryApp;
|
|
1632
|
+
const beneficialOwnerData: any[] = applicationData.beneficialOwnerApp;
|
|
1633
|
+
const spokesmanData: any = applicationData.spokesmanApp;
|
|
1585
1634
|
|
|
1586
1635
|
this.formStore.isPolicyholderInsured = clientData.isInsured;
|
|
1587
1636
|
this.formStore.isActOwnBehalf = clientData.isActOwnBehalf;
|
|
@@ -1621,7 +1670,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1621
1670
|
member.index = index;
|
|
1622
1671
|
allMembers.push(member);
|
|
1623
1672
|
if (this.formStore.insuredForm.length - 1 < index) {
|
|
1624
|
-
this.formStore.insuredForm.push(new
|
|
1673
|
+
this.formStore.insuredForm.push(new Member());
|
|
1625
1674
|
}
|
|
1626
1675
|
}
|
|
1627
1676
|
});
|
|
@@ -1634,7 +1683,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1634
1683
|
member.index = index;
|
|
1635
1684
|
allMembers.push(member);
|
|
1636
1685
|
if (this.formStore.beneficiaryForm.length - 1 < index) {
|
|
1637
|
-
this.formStore.beneficiaryForm.push(new
|
|
1686
|
+
this.formStore.beneficiaryForm.push(new Member());
|
|
1638
1687
|
}
|
|
1639
1688
|
}
|
|
1640
1689
|
});
|
|
@@ -1647,7 +1696,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1647
1696
|
member.index = index;
|
|
1648
1697
|
allMembers.push(member);
|
|
1649
1698
|
if (this.formStore.beneficialOwnerForm.length - 1 < index) {
|
|
1650
|
-
this.formStore.beneficialOwnerForm.push(new
|
|
1699
|
+
this.formStore.beneficialOwnerForm.push(new Member());
|
|
1651
1700
|
}
|
|
1652
1701
|
}
|
|
1653
1702
|
});
|
|
@@ -1732,17 +1781,17 @@ export const useDataStore = defineStore('data', {
|
|
|
1732
1781
|
applicationData.policyAppDto.annuityMonthPay === 0 ? null : applicationData.policyAppDto.annuityMonthPay,
|
|
1733
1782
|
);
|
|
1734
1783
|
|
|
1735
|
-
|
|
1784
|
+
const annuityType = this.dicAnnuityTypeList.find(item => item.id == applicationData.policyAppDto.annuityTypeId);
|
|
1736
1785
|
this.formStore.productConditionsForm.typeAnnuityInsurance = annuityType ? annuityType : new Value();
|
|
1737
1786
|
|
|
1738
|
-
|
|
1787
|
+
const annuityPaymentPeriod = this.processAnnuityPaymentPeriod.find(item => item.id == applicationData.policyAppDto.annuityPaymentPeriodId);
|
|
1739
1788
|
this.formStore.productConditionsForm.periodAnnuityPayment = annuityPaymentPeriod ? annuityPaymentPeriod : new Value();
|
|
1740
1789
|
}
|
|
1741
1790
|
|
|
1742
|
-
|
|
1743
|
-
this.formStore.productConditionsForm.processIndexRate = processIndexRate ? processIndexRate : this.processIndexRate.find(item => item.code === '0');
|
|
1791
|
+
const processIndexRate = this.processIndexRate.find(item => item.id == applicationData.policyAppDto.indexRateId);
|
|
1792
|
+
this.formStore.productConditionsForm.processIndexRate = processIndexRate ? processIndexRate : this.processIndexRate.find(item => item.code === '0') ?? new Value();
|
|
1744
1793
|
|
|
1745
|
-
|
|
1794
|
+
const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
|
|
1746
1795
|
this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
|
|
1747
1796
|
|
|
1748
1797
|
this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(
|
|
@@ -1755,18 +1804,18 @@ export const useDataStore = defineStore('data', {
|
|
|
1755
1804
|
this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
|
|
1756
1805
|
this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
|
|
1757
1806
|
}
|
|
1758
|
-
|
|
1807
|
+
const riskGroup = this.riskGroup.find(item => {
|
|
1759
1808
|
if (applicationData.policyAppDto.riskGroup == 0) {
|
|
1760
1809
|
return true;
|
|
1761
1810
|
}
|
|
1762
1811
|
return item.id == applicationData.policyAppDto.riskGroup;
|
|
1763
1812
|
});
|
|
1764
|
-
this.formStore.productConditionsForm.riskGroup = riskGroup ? riskGroup : this.riskGroup.find(item => item.id == 1);
|
|
1813
|
+
this.formStore.productConditionsForm.riskGroup = riskGroup ? riskGroup : this.riskGroup.find(item => item.id == 1) ?? new Value();
|
|
1765
1814
|
}
|
|
1766
1815
|
} catch (err) {
|
|
1767
|
-
|
|
1768
|
-
if (
|
|
1769
|
-
this.sendToParent(constants.postActions.toHomePage, err.response
|
|
1816
|
+
ErrorHandler(err);
|
|
1817
|
+
if (err instanceof AxiosError) {
|
|
1818
|
+
this.sendToParent(constants.postActions.toHomePage, err.response?.data);
|
|
1770
1819
|
this.isLoading = false;
|
|
1771
1820
|
return false;
|
|
1772
1821
|
}
|
|
@@ -1775,17 +1824,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1775
1824
|
this.isLoading = false;
|
|
1776
1825
|
}
|
|
1777
1826
|
},
|
|
1778
|
-
async
|
|
1779
|
-
try {
|
|
1780
|
-
return await this.api.getProcessHistoryLog(taskId);
|
|
1781
|
-
} catch (err) {
|
|
1782
|
-
ErrorHandler(err);
|
|
1783
|
-
}
|
|
1784
|
-
},
|
|
1785
|
-
async deleteTask(taskId) {
|
|
1827
|
+
async deleteTask(taskId: string) {
|
|
1786
1828
|
this.isLoading = true;
|
|
1787
1829
|
try {
|
|
1788
|
-
const data = {
|
|
1830
|
+
const data: SendTask = {
|
|
1789
1831
|
taskId: taskId,
|
|
1790
1832
|
decision: 'rejectclient',
|
|
1791
1833
|
comment: 'Клиент отказался',
|
|
@@ -1798,7 +1840,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1798
1840
|
}
|
|
1799
1841
|
this.isLoading = false;
|
|
1800
1842
|
},
|
|
1801
|
-
async sendTask(taskId, decision, comment = null) {
|
|
1843
|
+
async sendTask(taskId: string, decision: keyof typeof constants.actions | null, comment: string | null = null) {
|
|
1844
|
+
if (!decision) return;
|
|
1802
1845
|
this.isLoading = true;
|
|
1803
1846
|
try {
|
|
1804
1847
|
const data = {
|
|
@@ -1814,7 +1857,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1814
1857
|
return ErrorHandler(err);
|
|
1815
1858
|
}
|
|
1816
1859
|
},
|
|
1817
|
-
async handleTask(action, taskId, comment) {
|
|
1860
|
+
async handleTask(action: keyof typeof constants.actions | null, taskId: string, comment: string | null = null) {
|
|
1861
|
+
if (!this.formStore.applicationTaskId) return;
|
|
1818
1862
|
if (action && Object.keys(constants.actions).includes(action)) {
|
|
1819
1863
|
this.isButtonsLoading = true;
|
|
1820
1864
|
switch (action) {
|
|
@@ -1868,7 +1912,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1868
1912
|
console.error('No handleTask action');
|
|
1869
1913
|
}
|
|
1870
1914
|
},
|
|
1871
|
-
async getInvoiceData(processInstanceId) {
|
|
1915
|
+
async getInvoiceData(processInstanceId: string | number) {
|
|
1872
1916
|
try {
|
|
1873
1917
|
const response = await this.api.getInvoiceData(processInstanceId);
|
|
1874
1918
|
if (response) {
|
|
@@ -1882,6 +1926,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1882
1926
|
}
|
|
1883
1927
|
},
|
|
1884
1928
|
async createInvoice() {
|
|
1929
|
+
if (!this.formStore.applicationData.policyAppDto?.premium) return;
|
|
1885
1930
|
try {
|
|
1886
1931
|
const created = await this.api.createInvoice(this.formStore.applicationData.processInstanceId, this.formStore.applicationData.policyAppDto.premium);
|
|
1887
1932
|
return !!created;
|
|
@@ -1899,7 +1944,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1899
1944
|
console.log(err);
|
|
1900
1945
|
}
|
|
1901
1946
|
},
|
|
1902
|
-
setMembersField(whichForm, whichMember) {
|
|
1947
|
+
setMembersField(whichForm: SingleMember, whichMember: keyof typeof MemberAppCodes) {
|
|
1903
1948
|
this.formStore[whichForm].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember].familyStatusId);
|
|
1904
1949
|
this.formStore[whichForm].signOfIPDL = this.findObject(
|
|
1905
1950
|
'ipdl',
|
|
@@ -1910,7 +1955,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1910
1955
|
if (!!this.formStore.applicationData[whichMember].position) this.formStore[whichForm].jobPosition = this.formStore.applicationData[whichMember].position;
|
|
1911
1956
|
if (!!this.formStore.applicationData[whichMember].jobName) this.formStore[whichForm].jobPlace = this.formStore.applicationData[whichMember].jobName;
|
|
1912
1957
|
},
|
|
1913
|
-
setMembersFieldIndex(whichForm, whichMember, index) {
|
|
1958
|
+
setMembersFieldIndex(whichForm: MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
1914
1959
|
if ('familyStatus' in this.formStore[whichForm][index]) {
|
|
1915
1960
|
this.formStore[whichForm][index].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember][index].familyStatusId);
|
|
1916
1961
|
}
|
|
@@ -1936,14 +1981,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1936
1981
|
if (this.formStore.signUrls.length) {
|
|
1937
1982
|
return this.formStore.signUrls;
|
|
1938
1983
|
}
|
|
1939
|
-
const prepareSignDocuments = () => {
|
|
1984
|
+
const prepareSignDocuments = (): SignDataType[] => {
|
|
1940
1985
|
switch (this.formStore.applicationData.statusCode) {
|
|
1941
1986
|
case 'ContractSignedFrom':
|
|
1942
|
-
return [{ processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Contract', format: 'pdf' }];
|
|
1987
|
+
return [{ processInstanceId: String(this.formStore.applicationData.processInstanceId), name: 'Contract', format: 'pdf' }];
|
|
1943
1988
|
default:
|
|
1944
1989
|
return [
|
|
1945
|
-
{ processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Agreement', format: 'pdf' },
|
|
1946
|
-
{ processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Statement', format: 'pdf' },
|
|
1990
|
+
{ processInstanceId: String(this.formStore.applicationData.processInstanceId), name: 'Agreement', format: 'pdf' },
|
|
1991
|
+
{ processInstanceId: String(this.formStore.applicationData.processInstanceId), name: 'Statement', format: 'pdf' },
|
|
1947
1992
|
];
|
|
1948
1993
|
}
|
|
1949
1994
|
};
|
|
@@ -1957,11 +2002,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1957
2002
|
},
|
|
1958
2003
|
async registerNumber() {
|
|
1959
2004
|
try {
|
|
2005
|
+
if (!this.formStore.finCenterData.date) return;
|
|
2006
|
+
const formattedData = formatDate(this.formStore.finCenterData.date);
|
|
2007
|
+
if (!formattedData) return;
|
|
1960
2008
|
this.isLoading = true;
|
|
1961
|
-
const data = {
|
|
1962
|
-
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
1963
|
-
regNumber: this.formStore.finCenterData.regNumber,
|
|
1964
|
-
date:
|
|
2009
|
+
const data: RegNumberDataType = {
|
|
2010
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2011
|
+
regNumber: String(this.formStore.finCenterData.regNumber),
|
|
2012
|
+
date: formattedData.toISOString(),
|
|
1965
2013
|
};
|
|
1966
2014
|
const result = await this.api.registerNumber(data);
|
|
1967
2015
|
return result;
|
|
@@ -1971,12 +2019,12 @@ export const useDataStore = defineStore('data', {
|
|
|
1971
2019
|
this.isLoading = false;
|
|
1972
2020
|
}
|
|
1973
2021
|
},
|
|
1974
|
-
async sendSMS(type, phoneNumber, text) {
|
|
2022
|
+
async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
|
|
1975
2023
|
if (!type || !phoneNumber || !text) return;
|
|
1976
|
-
const smsData = {
|
|
2024
|
+
const smsData: SmsDataType = {
|
|
1977
2025
|
iin: this.formStore.applicationData.clientApp.iin,
|
|
1978
2026
|
phoneNumber: formatPhone(phoneNumber),
|
|
1979
|
-
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
2027
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
1980
2028
|
text: text,
|
|
1981
2029
|
type: type,
|
|
1982
2030
|
};
|
|
@@ -1990,15 +2038,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1990
2038
|
this.isLoading = false;
|
|
1991
2039
|
}
|
|
1992
2040
|
},
|
|
1993
|
-
sanitize(text) {
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
.replace(/"/g, '');
|
|
1999
|
-
}
|
|
2041
|
+
sanitize(text: string) {
|
|
2042
|
+
return text
|
|
2043
|
+
.replace(/\r?\n|\r/g, '')
|
|
2044
|
+
.replace(/\\/g, '')
|
|
2045
|
+
.replace(/"/g, '');
|
|
2000
2046
|
},
|
|
2001
|
-
async getSignedDocList(processInstanceId) {
|
|
2047
|
+
async getSignedDocList(processInstanceId: string | number) {
|
|
2002
2048
|
if (processInstanceId !== 0) {
|
|
2003
2049
|
try {
|
|
2004
2050
|
this.formStore.signedDocumentList = await this.api.getSignedDocList({
|
|
@@ -2009,12 +2055,12 @@ export const useDataStore = defineStore('data', {
|
|
|
2009
2055
|
}
|
|
2010
2056
|
}
|
|
2011
2057
|
},
|
|
2012
|
-
setFormsDisabled(isDisabled) {
|
|
2058
|
+
setFormsDisabled(isDisabled: boolean) {
|
|
2013
2059
|
Object.keys(this.formStore.isDisabled).forEach(key => {
|
|
2014
|
-
this.formStore.isDisabled[key] = !!isDisabled;
|
|
2060
|
+
this.formStore.isDisabled[key as keyof typeof this.formStore.isDisabled] = !!isDisabled;
|
|
2015
2061
|
});
|
|
2016
2062
|
},
|
|
2017
|
-
async reCalculate(processInstanceId, recalculationData, taskId, whichSum) {
|
|
2063
|
+
async reCalculate(processInstanceId: string | number, recalculationData: any, taskId: string, whichSum: string) {
|
|
2018
2064
|
this.isLoading = true;
|
|
2019
2065
|
try {
|
|
2020
2066
|
const data = {
|
|
@@ -2037,7 +2083,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2037
2083
|
}
|
|
2038
2084
|
this.isLoading = false;
|
|
2039
2085
|
},
|
|
2040
|
-
async getValidateClientESBD(data) {
|
|
2086
|
+
async getValidateClientESBD(data: ESBDValidationType) {
|
|
2041
2087
|
try {
|
|
2042
2088
|
return await this.api.getValidateClientESBD(data);
|
|
2043
2089
|
} catch (err) {
|
|
@@ -2045,12 +2091,12 @@ export const useDataStore = defineStore('data', {
|
|
|
2045
2091
|
return ErrorHandler(err);
|
|
2046
2092
|
}
|
|
2047
2093
|
},
|
|
2048
|
-
validateMultipleMembers(localKey, applicationKey, text) {
|
|
2094
|
+
validateMultipleMembers(localKey: MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
|
|
2049
2095
|
if (this.formStore[localKey].length === this.formStore.applicationData[applicationKey].length) {
|
|
2050
2096
|
if (this.formStore[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
|
|
2051
|
-
const localMembers = [...this.formStore[localKey]].sort((a, b) => a.id - b.id);
|
|
2097
|
+
const localMembers = [...this.formStore[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
|
|
2052
2098
|
const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.insisId - b.insisId);
|
|
2053
|
-
if (localMembers.every((each, index) => applicationMembers[index].insisId === each.id && applicationMembers[index].iin === each.iin
|
|
2099
|
+
if (localMembers.every((each, index) => applicationMembers[index].insisId === each.id && applicationMembers[index].iin === each.iin?.replace(/-/g, '')) === false) {
|
|
2054
2100
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
2055
2101
|
return false;
|
|
2056
2102
|
}
|
|
@@ -2065,7 +2111,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2065
2111
|
}
|
|
2066
2112
|
}
|
|
2067
2113
|
} else {
|
|
2068
|
-
if (this.formStore[localKey].some(i => i.iin !== null)) {
|
|
2114
|
+
if (this.formStore[localKey].some((i: any) => i.iin !== null)) {
|
|
2069
2115
|
this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
|
|
2070
2116
|
return false;
|
|
2071
2117
|
}
|
|
@@ -2081,7 +2127,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2081
2127
|
}
|
|
2082
2128
|
return true;
|
|
2083
2129
|
},
|
|
2084
|
-
async validateAllMembers(taskId, localCheck = false) {
|
|
2130
|
+
async validateAllMembers(taskId: string, localCheck: boolean = false) {
|
|
2085
2131
|
if (taskId === '0') {
|
|
2086
2132
|
this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
|
|
2087
2133
|
return false;
|
|
@@ -2095,7 +2141,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2095
2141
|
return false;
|
|
2096
2142
|
}
|
|
2097
2143
|
if (this.members.insuredApp.required) {
|
|
2098
|
-
const inStatement = this.formStore.insuredForm.every(i => i.id > 0);
|
|
2144
|
+
const inStatement = this.formStore.insuredForm.every(i => Number(i.id) > 0);
|
|
2099
2145
|
if (inStatement === false) {
|
|
2100
2146
|
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.insured') }));
|
|
2101
2147
|
return false;
|
|
@@ -2107,7 +2153,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2107
2153
|
return false;
|
|
2108
2154
|
}
|
|
2109
2155
|
if (this.members.beneficiaryApp.required) {
|
|
2110
|
-
const inStatement = this.formStore.beneficiaryForm.every(i => i.id > 0);
|
|
2156
|
+
const inStatement = this.formStore.beneficiaryForm.every(i => Number(i.id) > 0);
|
|
2111
2157
|
if (inStatement === false) {
|
|
2112
2158
|
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficiary') }));
|
|
2113
2159
|
return false;
|
|
@@ -2121,7 +2167,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2121
2167
|
}
|
|
2122
2168
|
}
|
|
2123
2169
|
if (this.members.beneficialOwnerApp.required) {
|
|
2124
|
-
const inStatement = this.formStore.beneficialOwnerForm.every(i => i.id > 0);
|
|
2170
|
+
const inStatement = this.formStore.beneficialOwnerForm.every(i => Number(i.id) > 0);
|
|
2125
2171
|
if (inStatement === false) {
|
|
2126
2172
|
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficialOwner') }));
|
|
2127
2173
|
return false;
|
|
@@ -2142,7 +2188,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2142
2188
|
}
|
|
2143
2189
|
}
|
|
2144
2190
|
if (this.members.spokesmanApp.required) {
|
|
2145
|
-
const inStatement = this.formStore.policyholdersRepresentativeForm.id > 0;
|
|
2191
|
+
const inStatement = Number(this.formStore.policyholdersRepresentativeForm.id) > 0;
|
|
2146
2192
|
if (inStatement === false) {
|
|
2147
2193
|
this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.spokesman') }));
|
|
2148
2194
|
return false;
|
|
@@ -2152,7 +2198,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2152
2198
|
if (this.controls.hasAttachment) {
|
|
2153
2199
|
const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
|
|
2154
2200
|
if (areValid) {
|
|
2155
|
-
|
|
2201
|
+
if (this.isInitiator()) {
|
|
2202
|
+
await this.setINSISWorkData();
|
|
2203
|
+
}
|
|
2156
2204
|
} else {
|
|
2157
2205
|
this.isLoading = false;
|
|
2158
2206
|
this.showToaster('error', this.t('toaster.attachManagerError'), 3000);
|
|
@@ -2161,10 +2209,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2161
2209
|
}
|
|
2162
2210
|
if (localCheck === false) {
|
|
2163
2211
|
try {
|
|
2164
|
-
if (!this.isGons) {
|
|
2212
|
+
if (this.isInitiator() && !this.isGons) {
|
|
2165
2213
|
if (this.formStore.isActOwnBehalf === true && this.formStore.applicationData.beneficialOwnerApp.length !== 0) {
|
|
2166
2214
|
await Promise.allSettled(
|
|
2167
|
-
this.formStore.applicationData.beneficialOwnerApp.map(async member => {
|
|
2215
|
+
this.formStore.applicationData.beneficialOwnerApp.map(async (member: any) => {
|
|
2168
2216
|
await this.api.deleteMember('BeneficialOwner', member.id);
|
|
2169
2217
|
}),
|
|
2170
2218
|
);
|
|
@@ -2172,16 +2220,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2172
2220
|
}
|
|
2173
2221
|
await this.getApplicationData(taskId, false);
|
|
2174
2222
|
} catch (err) {
|
|
2175
|
-
|
|
2176
|
-
this.showToaster('error', err, 5000);
|
|
2177
|
-
return false;
|
|
2223
|
+
return ErrorHandler(err);
|
|
2178
2224
|
}
|
|
2179
2225
|
}
|
|
2180
|
-
|
|
2181
2226
|
return true;
|
|
2182
2227
|
},
|
|
2183
|
-
validateAnketa(whichSurvey) {
|
|
2184
|
-
const
|
|
2228
|
+
validateAnketa(whichSurvey: 'surveyByHealthBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBase' | 'surveyByCriticalBasePolicyholder') {
|
|
2229
|
+
const anketa = this.formStore[whichSurvey];
|
|
2230
|
+
if (!anketa) return false;
|
|
2231
|
+
const list = anketa.body;
|
|
2185
2232
|
if (!list || (list && list.length === 0)) return false;
|
|
2186
2233
|
let notAnswered = 0;
|
|
2187
2234
|
for (let x = 0; x < list.length; x++) {
|
|
@@ -2191,7 +2238,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2191
2238
|
}
|
|
2192
2239
|
return notAnswered === 0;
|
|
2193
2240
|
},
|
|
2194
|
-
async validateAllForms(taskId) {
|
|
2241
|
+
async validateAllForms(taskId: string) {
|
|
2195
2242
|
this.isLoading = true;
|
|
2196
2243
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
2197
2244
|
if (areMembersValid) {
|
|
@@ -2225,21 +2272,21 @@ export const useDataStore = defineStore('data', {
|
|
|
2225
2272
|
]);
|
|
2226
2273
|
this.isClientAnketaCondition
|
|
2227
2274
|
? await Promise.allSettled([
|
|
2228
|
-
...this.formStore.surveyByHealthBase
|
|
2275
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2229
2276
|
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2230
2277
|
}),
|
|
2231
|
-
...this.formStore.surveyByCriticalBase
|
|
2278
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2232
2279
|
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2233
2280
|
}),
|
|
2234
|
-
...this.formStore.surveyByHealthBasePolicyholder
|
|
2281
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2235
2282
|
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2236
2283
|
}),
|
|
2237
2284
|
])
|
|
2238
2285
|
: await Promise.allSettled([
|
|
2239
|
-
...this.formStore.surveyByHealthBase
|
|
2286
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2240
2287
|
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2241
2288
|
}),
|
|
2242
|
-
...this.formStore.surveyByCriticalBase
|
|
2289
|
+
...this.formStore.surveyByCriticalBase!.body.map(async question => {
|
|
2243
2290
|
await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
|
|
2244
2291
|
}),
|
|
2245
2292
|
]);
|
|
@@ -2265,15 +2312,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2265
2312
|
]);
|
|
2266
2313
|
this.isClientAnketaCondition
|
|
2267
2314
|
? await Promise.allSettled([
|
|
2268
|
-
...this.formStore.surveyByHealthBase
|
|
2315
|
+
...this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2269
2316
|
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2270
2317
|
}),
|
|
2271
|
-
...this.formStore.surveyByHealthBasePolicyholder
|
|
2318
|
+
...this.formStore.surveyByHealthBasePolicyholder!.body.map(async question => {
|
|
2272
2319
|
await this.definedAnswers(question.first.id, 'surveyByHealthBasePolicyholder');
|
|
2273
2320
|
}),
|
|
2274
2321
|
])
|
|
2275
2322
|
: await Promise.allSettled(
|
|
2276
|
-
this.formStore.surveyByHealthBase
|
|
2323
|
+
this.formStore.surveyByHealthBase!.body.map(async question => {
|
|
2277
2324
|
await this.definedAnswers(question.first.id, 'surveyByHealthBase');
|
|
2278
2325
|
}),
|
|
2279
2326
|
);
|
|
@@ -2310,7 +2357,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2310
2357
|
this.isLoading = false;
|
|
2311
2358
|
return false;
|
|
2312
2359
|
},
|
|
2313
|
-
async getFamilyInfo(iin, phoneNumber) {
|
|
2360
|
+
async getFamilyInfo(iin: string, phoneNumber: string) {
|
|
2314
2361
|
this.isLoading = true;
|
|
2315
2362
|
try {
|
|
2316
2363
|
const familyResponse = await this.api.getFamilyInfo({ iin: iin.replace(/-/g, ''), phoneNumber: formatPhone(phoneNumber) });
|
|
@@ -2339,7 +2386,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2339
2386
|
if (this.isBolashak) return 15;
|
|
2340
2387
|
})();
|
|
2341
2388
|
const baseCondition = !!member.childBirthDate && typeof member.childLifeStatus === 'number' && member.childLifeStatus === 0;
|
|
2342
|
-
return typeof filterAge === 'number' ? baseCondition && getAgeByBirthDate(member.childBirthDate) <= filterAge : baseCondition;
|
|
2389
|
+
return typeof filterAge === 'number' ? baseCondition && getAgeByBirthDate(member.childBirthDate!)! <= filterAge : baseCondition;
|
|
2343
2390
|
});
|
|
2344
2391
|
if (filteredBirthInfos && filteredBirthInfos.length) {
|
|
2345
2392
|
this.formStore.birthInfos = filteredBirthInfos;
|
|
@@ -2358,15 +2405,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2358
2405
|
this.isLoading = false;
|
|
2359
2406
|
}
|
|
2360
2407
|
},
|
|
2361
|
-
async getContragentFromGBDFL(member) {
|
|
2408
|
+
async getContragentFromGBDFL(member: Member) {
|
|
2362
2409
|
// null - ожидание
|
|
2363
2410
|
// false - ошибка или неправильно
|
|
2364
2411
|
// true - успешно и данные получены
|
|
2365
2412
|
this.isLoading = true;
|
|
2366
2413
|
try {
|
|
2367
2414
|
const data = {
|
|
2368
|
-
iin: member.iin
|
|
2369
|
-
phoneNumber: formatPhone(member.phoneNumber),
|
|
2415
|
+
iin: member.iin!.replace(/-/g, ''),
|
|
2416
|
+
phoneNumber: formatPhone(member.phoneNumber!),
|
|
2370
2417
|
};
|
|
2371
2418
|
const gbdResponse = await this.api.getContragentFromGBDFL(data);
|
|
2372
2419
|
if (gbdResponse.status === 'soap:Server') {
|
|
@@ -2391,7 +2438,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2391
2438
|
}
|
|
2392
2439
|
const { person } = parseXML(gbdResponse.content, true, 'person');
|
|
2393
2440
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
2394
|
-
if (member.gosPersonData !== null && member.gosPersonData.iin !== iin
|
|
2441
|
+
if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
|
|
2395
2442
|
member.resetMember(false);
|
|
2396
2443
|
}
|
|
2397
2444
|
member.gosPersonData = person;
|
|
@@ -2406,7 +2453,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2406
2453
|
this.isLoading = false;
|
|
2407
2454
|
}
|
|
2408
2455
|
},
|
|
2409
|
-
async saveInStoreUserGBDFL(person, member) {
|
|
2456
|
+
async saveInStoreUserGBDFL(person: any, member: Member) {
|
|
2410
2457
|
member.firstName = person.name;
|
|
2411
2458
|
member.lastName = person.surname;
|
|
2412
2459
|
member.middleName = person.patronymic ? person.patronymic : '';
|
|
@@ -2417,31 +2464,31 @@ export const useDataStore = defineStore('data', {
|
|
|
2417
2464
|
const gender = this.gender.find(i => i.id == person.gender.code);
|
|
2418
2465
|
if (gender) member.gender = gender;
|
|
2419
2466
|
|
|
2420
|
-
const birthPlace = this.countries.find(i => i.nameRu.match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
2467
|
+
const birthPlace = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
2421
2468
|
if (birthPlace) member.birthPlace = birthPlace;
|
|
2422
2469
|
|
|
2423
|
-
const countryOfCitizenship = this.citizenshipCountries.find(i => i.nameRu.match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
2470
|
+
const countryOfCitizenship = this.citizenshipCountries.find(i => (i.nameRu as string).match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
2424
2471
|
if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
|
|
2425
2472
|
|
|
2426
|
-
const regCountry = this.countries.find(i => i.nameRu.match(new RegExp(person.regAddress.country.nameRu, 'i')));
|
|
2473
|
+
const regCountry = this.countries.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.country.nameRu, 'i')));
|
|
2427
2474
|
if (regCountry) member.registrationCountry = regCountry;
|
|
2428
2475
|
|
|
2429
|
-
const regProvince = this.states.find(i => i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
2476
|
+
const regProvince = this.states.find(i => (i.nameRu as string).match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
2430
2477
|
if (regProvince) member.registrationProvince = regProvince;
|
|
2431
2478
|
|
|
2432
2479
|
if ('city' in person.regAddress && !!person.regAddress.city) {
|
|
2433
2480
|
if (person.regAddress.city.includes(', ')) {
|
|
2434
2481
|
const personCities = person.regAddress.city.split(', ');
|
|
2435
|
-
for (let
|
|
2436
|
-
const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[
|
|
2482
|
+
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
2483
|
+
const possibleCity = this.cities.find(i => (i.nameRu as string).includes(personCities[ind]));
|
|
2437
2484
|
if (possibleCity) {
|
|
2438
2485
|
member.registrationCity = possibleCity;
|
|
2439
2486
|
break;
|
|
2440
2487
|
}
|
|
2441
2488
|
}
|
|
2442
2489
|
if (member.registrationCity.nameRu === null) {
|
|
2443
|
-
for (let
|
|
2444
|
-
const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[
|
|
2490
|
+
for (let ind = 0; ind < personCities.length; ++ind) {
|
|
2491
|
+
const possibleRegion = this.regions.find(i => String(i.nameRu).includes(personCities[ind]));
|
|
2445
2492
|
if (possibleRegion) {
|
|
2446
2493
|
member.registrationRegion = possibleRegion;
|
|
2447
2494
|
break;
|
|
@@ -2449,11 +2496,11 @@ export const useDataStore = defineStore('data', {
|
|
|
2449
2496
|
}
|
|
2450
2497
|
}
|
|
2451
2498
|
} else {
|
|
2452
|
-
const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
|
|
2499
|
+
const regCity = this.cities.find(i => String(i.nameRu).match(new RegExp(person.regAddress.city, 'i')));
|
|
2453
2500
|
if (regCity) member.registrationCity = regCity;
|
|
2454
2501
|
|
|
2455
2502
|
if (member.registrationCity.nameRu === null) {
|
|
2456
|
-
const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city
|
|
2503
|
+
const regRegion = this.regions.find(i => String(i.nameRu).match(new RegExp(person.regAddress.city, 'i')));
|
|
2457
2504
|
if (regRegion) member.registrationRegion = regRegion;
|
|
2458
2505
|
}
|
|
2459
2506
|
}
|
|
@@ -2461,19 +2508,19 @@ export const useDataStore = defineStore('data', {
|
|
|
2461
2508
|
|
|
2462
2509
|
if (member.registrationCity.nameRu === null && member.registrationRegion.nameRu === null) {
|
|
2463
2510
|
const regCity = this.cities.find(
|
|
2464
|
-
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2511
|
+
i => String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu, 'i')) || String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2465
2512
|
);
|
|
2466
2513
|
if (regCity) {
|
|
2467
2514
|
member.registrationCity = regCity;
|
|
2468
|
-
const regType = this.localityTypes.find(i => i.nameRu === 'город');
|
|
2515
|
+
const regType = this.localityTypes.find(i => String(i.nameRu) === 'город');
|
|
2469
2516
|
if (regType) member.registrationRegionType = regType;
|
|
2470
2517
|
} else {
|
|
2471
2518
|
const regRegion = this.regions.find(
|
|
2472
|
-
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu
|
|
2519
|
+
i => String(i.nameRu).match(new RegExp(person.regAddress.region.nameRu, 'i')) || String(i.nameRu).match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2473
2520
|
);
|
|
2474
2521
|
if (regRegion) {
|
|
2475
2522
|
member.registrationRegion = regRegion;
|
|
2476
|
-
const regType = this.localityTypes.find(i => (i.nameRu
|
|
2523
|
+
const regType = this.localityTypes.find(i => String(i.nameRu) === 'село' || String(i.nameRu) === 'поселок');
|
|
2477
2524
|
if (regType) member.registrationRegionType = regType;
|
|
2478
2525
|
}
|
|
2479
2526
|
}
|
|
@@ -2481,9 +2528,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2481
2528
|
|
|
2482
2529
|
if (person.regAddress.street.includes(', ')) {
|
|
2483
2530
|
const personAddress = person.regAddress.street.split(', ');
|
|
2484
|
-
const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
|
|
2485
|
-
const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
|
|
2486
|
-
const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
|
|
2531
|
+
const microDistrict = personAddress.find((i: string) => i.match(new RegExp('микрорайон', 'i')));
|
|
2532
|
+
const quarter = personAddress.find((i: string) => i.match(new RegExp('квартал', 'i')));
|
|
2533
|
+
const street = personAddress.find((i: string) => i.match(new RegExp('улица', 'i')));
|
|
2487
2534
|
if (microDistrict) member.registrationMicroDistrict = microDistrict;
|
|
2488
2535
|
if (quarter) member.registrationQuarter = quarter;
|
|
2489
2536
|
if (street) member.registrationStreet = street;
|
|
@@ -2495,7 +2542,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2495
2542
|
|
|
2496
2543
|
// TODO Доработать логику и для остальных
|
|
2497
2544
|
if ('length' in person.documents.document) {
|
|
2498
|
-
const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2545
|
+
const validDocument = person.documents.document.find((i: any) => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2499
2546
|
if (validDocument) {
|
|
2500
2547
|
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2501
2548
|
if (documentType) member.documentType = documentType;
|
|
@@ -2505,15 +2552,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2505
2552
|
member.documentDate = reformatDate(validDocument.beginDate);
|
|
2506
2553
|
member.documentNumber = validDocument.number;
|
|
2507
2554
|
|
|
2508
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2555
|
+
const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
|
|
2509
2556
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2510
2557
|
}
|
|
2511
2558
|
} else {
|
|
2512
2559
|
const documentType =
|
|
2513
2560
|
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2514
2561
|
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2515
|
-
: this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2516
|
-
? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2562
|
+
: this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2563
|
+
? this.documentTypes.find(i => (i.nameRu as string).match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2517
2564
|
: new Value();
|
|
2518
2565
|
if (documentType) member.documentType = documentType;
|
|
2519
2566
|
|
|
@@ -2527,13 +2574,13 @@ export const useDataStore = defineStore('data', {
|
|
|
2527
2574
|
if (documentExpire) member.documentExpire = reformatDate(documentExpire);
|
|
2528
2575
|
|
|
2529
2576
|
// TODO уточнить
|
|
2530
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2577
|
+
const documentIssuer = this.documentIssuers.find(i => (i.nameRu as string).match(new RegExp('МВД РК', 'i')));
|
|
2531
2578
|
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2532
2579
|
}
|
|
2533
2580
|
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2534
2581
|
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
2535
2582
|
},
|
|
2536
|
-
async isCourseChanged(processInstanceId) {
|
|
2583
|
+
async isCourseChanged(processInstanceId: string) {
|
|
2537
2584
|
try {
|
|
2538
2585
|
const response = await this.api.isCourseChanged(processInstanceId);
|
|
2539
2586
|
return response;
|
|
@@ -2541,7 +2588,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2541
2588
|
return ErrorHandler(err);
|
|
2542
2589
|
}
|
|
2543
2590
|
},
|
|
2544
|
-
hasJobSection(whichForm) {
|
|
2591
|
+
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
2545
2592
|
switch (whichForm) {
|
|
2546
2593
|
case this.formStore.beneficiaryFormKey:
|
|
2547
2594
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -2551,7 +2598,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2551
2598
|
return true;
|
|
2552
2599
|
}
|
|
2553
2600
|
},
|
|
2554
|
-
hasBirthSection(whichForm) {
|
|
2601
|
+
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
2555
2602
|
if (this.isGons) return false;
|
|
2556
2603
|
switch (whichForm) {
|
|
2557
2604
|
case this.formStore.beneficiaryFormKey:
|
|
@@ -2560,19 +2607,19 @@ export const useDataStore = defineStore('data', {
|
|
|
2560
2607
|
return true;
|
|
2561
2608
|
}
|
|
2562
2609
|
},
|
|
2563
|
-
hasPlaceSection(whichForm) {
|
|
2610
|
+
hasPlaceSection(whichForm: keyof typeof StoreMembers) {
|
|
2564
2611
|
switch (whichForm) {
|
|
2565
2612
|
default:
|
|
2566
2613
|
return true;
|
|
2567
2614
|
}
|
|
2568
2615
|
},
|
|
2569
|
-
hasDocumentSection(whichForm) {
|
|
2616
|
+
hasDocumentSection(whichForm: keyof typeof StoreMembers) {
|
|
2570
2617
|
switch (whichForm) {
|
|
2571
2618
|
default:
|
|
2572
2619
|
return true;
|
|
2573
2620
|
}
|
|
2574
2621
|
},
|
|
2575
|
-
hasContactSection(whichForm) {
|
|
2622
|
+
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
2576
2623
|
if (this.isGons) return false;
|
|
2577
2624
|
switch (whichForm) {
|
|
2578
2625
|
default:
|
|
@@ -2588,14 +2635,15 @@ export const useDataStore = defineStore('data', {
|
|
|
2588
2635
|
},
|
|
2589
2636
|
});
|
|
2590
2637
|
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
})
|
|
2638
|
+
// Для карты клиента
|
|
2639
|
+
// export const useContragentStore = defineStore('contragent', {
|
|
2640
|
+
// state: () => ({
|
|
2641
|
+
// ...new Contragent(),
|
|
2642
|
+
// formatDate: new Contragent().formatDate,
|
|
2643
|
+
// getDateByKey: new Contragent().getDateByKey,
|
|
2644
|
+
// getBirthDate: new Contragent().getBirthDate,
|
|
2645
|
+
// getDocumentExpireDate: new Contragent().getDocumentExpireDate,
|
|
2646
|
+
// getDocumentDate: new Contragent().getDocumentDate,
|
|
2647
|
+
// getAgeByBirthDate: new Contragent().getAgeByBirthDate,
|
|
2648
|
+
// }),
|
|
2649
|
+
// });
|