hl-core 0.0.7-beta.14 → 0.0.7-beta.16
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/components/Form/Documents.vue +109 -0
- package/components/Form/FormBlock.vue +22 -8
- package/components/Form/FormSection.vue +18 -0
- package/components/Form/FormToggle.vue +8 -1
- package/components/Form/MemberForm.vue +983 -0
- package/components/Form/ProductConditions.vue +43 -0
- package/components/Form/ProductConditionsBlock.vue +2 -2
- package/components/Input/EmptyFormField.vue +5 -0
- package/components/Input/FileInput.vue +71 -0
- package/components/Input/FormInput.vue +65 -15
- package/components/Input/PanelInput.vue +133 -0
- package/components/Input/RoundedInput.vue +31 -8
- package/components/Layout/Drawer.vue +1 -1
- package/components/Layout/SettingsPanel.vue +6 -1
- package/components/List/ListEmpty.vue +22 -0
- package/components/Menu/MenuNav.vue +8 -26
- package/components/Panel/PanelSelectItem.vue +20 -0
- package/composables/classes.ts +126 -110
- package/composables/constants.ts +2 -0
- package/composables/index.ts +7 -6
- package/layouts/default.vue +14 -4
- package/package.json +8 -6
- package/pages/500.vue +38 -1
- package/plugins/storePlugin.ts +1 -0
- package/store/data.store.js +255 -503
- package/store/member.store.ts +169 -18
- package/store/messages.ts +17 -7
- package/store/rules.js +1 -0
package/store/data.store.js
CHANGED
|
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
|
|
|
2
2
|
import { t } from './messages';
|
|
3
3
|
import { rules } from './rules';
|
|
4
4
|
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
5
|
-
import { isValidGUID, yearEnding, jwtDecode } from '../composables';
|
|
5
|
+
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern } from '../composables';
|
|
6
6
|
import { DataStoreClass, Contragent } from '../composables/classes';
|
|
7
7
|
import { ApiClass } from '@/api';
|
|
8
8
|
import { useFormStore } from './form.store';
|
|
@@ -16,6 +16,7 @@ export const useDataStore = defineStore('data', {
|
|
|
16
16
|
toastTypes: Types,
|
|
17
17
|
toastPositions: Positions,
|
|
18
18
|
isValidGUID: isValidGUID,
|
|
19
|
+
route: useRoute(),
|
|
19
20
|
router: useRouter(),
|
|
20
21
|
formStore: useFormStore(),
|
|
21
22
|
contragent: useContragentStore(),
|
|
@@ -26,7 +27,7 @@ export const useDataStore = defineStore('data', {
|
|
|
26
27
|
Toast.useToast()(msg, {
|
|
27
28
|
...ToastOptions,
|
|
28
29
|
type: Types[type.toUpperCase()],
|
|
29
|
-
timeout: typeof timeout ===
|
|
30
|
+
timeout: type === 'error' ? 6000 : typeof timeout === 'number' ? timeout : ToastOptions.timeout,
|
|
30
31
|
}),
|
|
31
32
|
}),
|
|
32
33
|
getters: {
|
|
@@ -37,9 +38,17 @@ export const useDataStore = defineStore('data', {
|
|
|
37
38
|
isLifetrip: state => state.product === 'lifetrip',
|
|
38
39
|
isLiferenta: state => state.product === 'liferenta',
|
|
39
40
|
isPension: state => state.product === 'pension',
|
|
41
|
+
isGons: state => state.product === 'gons',
|
|
40
42
|
isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
|
|
41
43
|
},
|
|
42
44
|
actions: {
|
|
45
|
+
isIframe() {
|
|
46
|
+
try {
|
|
47
|
+
return window.self !== window.top;
|
|
48
|
+
} catch (err) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
43
52
|
sendToParent(action, value) {
|
|
44
53
|
window.parent.postMessage({ action: action, value: value }, '*');
|
|
45
54
|
},
|
|
@@ -50,7 +59,7 @@ export const useDataStore = defineStore('data', {
|
|
|
50
59
|
}
|
|
51
60
|
},
|
|
52
61
|
getFilesByIIN(iin) {
|
|
53
|
-
return this.signedDocumentList.filter(file => file.iin === iin && file.fileTypeName === 'Удостоверение личности');
|
|
62
|
+
return iin ? this.signedDocumentList.filter(file => file.iin === iin && file.fileTypeName === 'Удостоверение личности') : null;
|
|
54
63
|
},
|
|
55
64
|
async getNewAccessToken() {
|
|
56
65
|
try {
|
|
@@ -82,7 +91,6 @@ export const useDataStore = defineStore('data', {
|
|
|
82
91
|
async loginUser(login, password, numAttempt) {
|
|
83
92
|
try {
|
|
84
93
|
const token = localStorage.getItem('accessToken') || null;
|
|
85
|
-
|
|
86
94
|
if (token && isValidToken(token)) {
|
|
87
95
|
this.accessToken = token;
|
|
88
96
|
this.getUserRoles();
|
|
@@ -97,28 +105,34 @@ export const useDataStore = defineStore('data', {
|
|
|
97
105
|
this.refreshToken = response.refreshToken;
|
|
98
106
|
this.getUserRoles();
|
|
99
107
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
if (this.controls.onAuth) {
|
|
109
|
+
const hasPermission =
|
|
110
|
+
this.isManager() ||
|
|
111
|
+
this.isUnderwriter() ||
|
|
112
|
+
this.isAdmin() ||
|
|
113
|
+
this.isAgent() ||
|
|
114
|
+
this.isCompliance() ||
|
|
115
|
+
this.isAgentMycar() ||
|
|
116
|
+
this.isAnalyst() ||
|
|
117
|
+
this.isUpk() ||
|
|
118
|
+
this.isFinanceCenter() ||
|
|
119
|
+
this.isSupervisor() ||
|
|
120
|
+
this.isSupport() ||
|
|
121
|
+
this.isManagerHalykBank();
|
|
122
|
+
if (hasPermission) {
|
|
123
|
+
localStorage.setItem('accessToken', this.accessToken);
|
|
124
|
+
localStorage.setItem('refreshToken', this.refreshToken);
|
|
125
|
+
} else {
|
|
126
|
+
this.showToaster('error', this.t('toaster.noProductPermission'), 5000);
|
|
127
|
+
this.accessToken = null;
|
|
128
|
+
this.refreshToken = null;
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
112
131
|
localStorage.setItem('accessToken', this.accessToken);
|
|
113
132
|
localStorage.setItem('refreshToken', this.refreshToken);
|
|
114
|
-
} else {
|
|
115
|
-
this.showToaster('error', this.t('toaster.noProductPermission'), 5000);
|
|
116
133
|
}
|
|
117
134
|
} catch (err) {
|
|
118
|
-
|
|
119
|
-
if ('response' in err) {
|
|
120
|
-
this.showToaster('error', err.response.data, 3000);
|
|
121
|
-
}
|
|
135
|
+
ErrorHandler(err);
|
|
122
136
|
}
|
|
123
137
|
},
|
|
124
138
|
getUserRoles() {
|
|
@@ -145,7 +159,7 @@ export const useDataStore = defineStore('data', {
|
|
|
145
159
|
return !!isRole;
|
|
146
160
|
},
|
|
147
161
|
isInitiator() {
|
|
148
|
-
return this.
|
|
162
|
+
return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank();
|
|
149
163
|
},
|
|
150
164
|
isManager() {
|
|
151
165
|
return this.isRole(constants.roles.manager);
|
|
@@ -159,6 +173,9 @@ export const useDataStore = defineStore('data', {
|
|
|
159
173
|
isAgent() {
|
|
160
174
|
return this.isRole(constants.roles.agent);
|
|
161
175
|
},
|
|
176
|
+
isManagerHalykBank() {
|
|
177
|
+
return this.isRole(constants.roles.managerHalykBank);
|
|
178
|
+
},
|
|
162
179
|
isUnderwriter() {
|
|
163
180
|
return this.isRole(constants.roles.underwriter);
|
|
164
181
|
},
|
|
@@ -171,18 +188,29 @@ export const useDataStore = defineStore('data', {
|
|
|
171
188
|
isUpk() {
|
|
172
189
|
return this.isRole(constants.roles.upk);
|
|
173
190
|
},
|
|
191
|
+
isSupport() {
|
|
192
|
+
return this.isRole(constants.roles.support);
|
|
193
|
+
},
|
|
174
194
|
isFinanceCenter() {
|
|
175
195
|
return this.isRole(constants.roles.financeCenter);
|
|
176
196
|
},
|
|
177
197
|
isSupervisor() {
|
|
178
198
|
return this.isRole(constants.roles.supervisor);
|
|
179
199
|
},
|
|
180
|
-
|
|
181
200
|
isProcessEditable(statusCode) {
|
|
182
201
|
return !!constants.editableStatuses.find(status => status === statusCode);
|
|
183
202
|
},
|
|
184
203
|
isTask() {
|
|
185
|
-
return this.formStore.applicationData.processInstanceId
|
|
204
|
+
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
205
|
+
},
|
|
206
|
+
async resetSelected(route) {
|
|
207
|
+
this.settings.open = false;
|
|
208
|
+
this.panel.open = false;
|
|
209
|
+
this.panelAction = null;
|
|
210
|
+
this.menu.selectedItem = new MenuItem();
|
|
211
|
+
if (route && route.name) {
|
|
212
|
+
await this.router.replace({ name: route.name });
|
|
213
|
+
}
|
|
186
214
|
},
|
|
187
215
|
async logoutUser() {
|
|
188
216
|
this.isLoading = true;
|
|
@@ -213,7 +241,17 @@ export const useDataStore = defineStore('data', {
|
|
|
213
241
|
if (!['pdf', 'docx'].includes(fileType)) {
|
|
214
242
|
const blob = new Blob([response], { type: `image/${fileType}` });
|
|
215
243
|
const url = window.URL.createObjectURL(blob);
|
|
216
|
-
|
|
244
|
+
const link = document.createElement('a');
|
|
245
|
+
link.href = url;
|
|
246
|
+
if (mode === 'view') {
|
|
247
|
+
setTimeout(() => {
|
|
248
|
+
window.open(url, '_blank', `width=${screen.width},height=${screen.height},top=70`);
|
|
249
|
+
});
|
|
250
|
+
} else {
|
|
251
|
+
link.setAttribute('download', file.fileName);
|
|
252
|
+
document.body.appendChild(link);
|
|
253
|
+
link.click();
|
|
254
|
+
}
|
|
217
255
|
} else {
|
|
218
256
|
const blob = new Blob([response], {
|
|
219
257
|
type: `application/${fileType}`,
|
|
@@ -233,7 +271,7 @@ export const useDataStore = defineStore('data', {
|
|
|
233
271
|
}
|
|
234
272
|
});
|
|
235
273
|
} catch (err) {
|
|
236
|
-
|
|
274
|
+
ErrorHandler(err);
|
|
237
275
|
} finally {
|
|
238
276
|
this.isLoading = false;
|
|
239
277
|
}
|
|
@@ -246,7 +284,7 @@ export const useDataStore = defineStore('data', {
|
|
|
246
284
|
this.showToaster('error', err.response.data, 2000);
|
|
247
285
|
}
|
|
248
286
|
},
|
|
249
|
-
async uploadFiles(data, load =
|
|
287
|
+
async uploadFiles(data, load = false) {
|
|
250
288
|
try {
|
|
251
289
|
if (load) {
|
|
252
290
|
this.isLoading = true;
|
|
@@ -254,15 +292,14 @@ export const useDataStore = defineStore('data', {
|
|
|
254
292
|
await this.api.uploadFiles(data);
|
|
255
293
|
return true;
|
|
256
294
|
} catch (err) {
|
|
257
|
-
|
|
258
|
-
return false;
|
|
295
|
+
return ErrorHandler(err);
|
|
259
296
|
} finally {
|
|
260
297
|
if (load) {
|
|
261
298
|
this.isLoading = false;
|
|
262
299
|
}
|
|
263
300
|
}
|
|
264
301
|
},
|
|
265
|
-
async getContragent(whichForm, whichIndex
|
|
302
|
+
async getContragent(member, whichForm, whichIndex, load = true) {
|
|
266
303
|
if (load) {
|
|
267
304
|
this.isLoading = true;
|
|
268
305
|
}
|
|
@@ -273,14 +310,8 @@ export const useDataStore = defineStore('data', {
|
|
|
273
310
|
lastName: '',
|
|
274
311
|
middleName: '',
|
|
275
312
|
};
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
response = await this.api.getContragent(queryData);
|
|
279
|
-
}
|
|
280
|
-
if (whichIndex !== null) {
|
|
281
|
-
queryData.iin = this.formStore[whichForm][whichIndex].iin.replace(/-/g, '');
|
|
282
|
-
response = await this.api.getContragent(queryData);
|
|
283
|
-
}
|
|
313
|
+
queryData.iin = member.iin.replace(/-/g, '');
|
|
314
|
+
response = await this.api.getContragent(queryData);
|
|
284
315
|
if (response.totalItems > 0) {
|
|
285
316
|
if (response.totalItems.length === 1) {
|
|
286
317
|
await this.serializeContragentData(whichForm, response.items[0], whichIndex);
|
|
@@ -288,11 +319,7 @@ export const useDataStore = defineStore('data', {
|
|
|
288
319
|
const sortedByRegistrationDate = response.items.sort((left, right) => new Date(right.registrationDate) - new Date(left.registrationDate));
|
|
289
320
|
await this.serializeContragentData(whichForm, sortedByRegistrationDate[0], whichIndex);
|
|
290
321
|
}
|
|
291
|
-
|
|
292
|
-
this.formStore[whichForm].gotFromInsis = true;
|
|
293
|
-
} else {
|
|
294
|
-
this.formStore[whichForm][whichIndex].gotFromInsis = true;
|
|
295
|
-
}
|
|
322
|
+
member.gotFromInsis = true;
|
|
296
323
|
} else {
|
|
297
324
|
this.userNotFound = true;
|
|
298
325
|
}
|
|
@@ -308,7 +335,7 @@ export const useDataStore = defineStore('data', {
|
|
|
308
335
|
this.isLoading = true;
|
|
309
336
|
}
|
|
310
337
|
try {
|
|
311
|
-
if (this.isAgentMycar() && whichForm
|
|
338
|
+
if (this.isMycar && this.isAgentMycar() && whichForm === this.formStore.beneficiaryFormKey) {
|
|
312
339
|
await this.serializeContragentData(whichForm, this.formStore.applicationData.beneficiaryApp[0], whichIndex);
|
|
313
340
|
this.isLoading = false;
|
|
314
341
|
return;
|
|
@@ -563,65 +590,29 @@ export const useDataStore = defineStore('data', {
|
|
|
563
590
|
return false;
|
|
564
591
|
}
|
|
565
592
|
},
|
|
566
|
-
async saveContragent(user, whichForm, onlySaveAction = true
|
|
567
|
-
this.isLoading =
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
this.
|
|
573
|
-
this.
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
this.api.getContrAgentDocuments(user.id),
|
|
581
|
-
this.api.getContrAgentAddress(user.id),
|
|
582
|
-
]);
|
|
583
|
-
this.formStore[whichForm].response = {};
|
|
584
|
-
if (data && data.length) {
|
|
585
|
-
this.formStore[whichForm].response.questionnaires = data;
|
|
586
|
-
}
|
|
587
|
-
if (contacts && contacts.length) {
|
|
588
|
-
this.formStore[whichForm].response.contacts = contacts;
|
|
589
|
-
}
|
|
590
|
-
if (documents && documents.length) {
|
|
591
|
-
this.formStore[whichForm].response.documents = documents;
|
|
592
|
-
}
|
|
593
|
-
if (address && address.length) {
|
|
594
|
-
this.formStore[whichForm].response.addresses = address;
|
|
595
|
-
}
|
|
593
|
+
async saveContragent(user, whichForm, whichIndex, onlySaveAction = true) {
|
|
594
|
+
this.isLoading = !onlySaveAction;
|
|
595
|
+
const hasInsisId = await this.alreadyInInsis(user.iin, user.firstName, user.lastName, user.middleName);
|
|
596
|
+
if (hasInsisId !== false) {
|
|
597
|
+
user.id = hasInsisId;
|
|
598
|
+
const [{ value: data }, { value: contacts }, { value: documents }, { value: address }] = await Promise.allSettled([
|
|
599
|
+
this.api.getContrAgentData(user.id),
|
|
600
|
+
this.api.getContrAgentContacts(user.id),
|
|
601
|
+
this.api.getContrAgentDocuments(user.id),
|
|
602
|
+
this.api.getContrAgentAddress(user.id),
|
|
603
|
+
]);
|
|
604
|
+
user.response = {};
|
|
605
|
+
if (data && data.length) {
|
|
606
|
+
user.response.questionnaires = data;
|
|
596
607
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
)
|
|
604
|
-
|
|
605
|
-
user.id = hasInsisId;
|
|
606
|
-
const [{ value: data }, { value: contacts }, { value: documents }, { value: address }] = await Promise.allSettled([
|
|
607
|
-
this.api.getContrAgentData(user.id),
|
|
608
|
-
this.api.getContrAgentContacts(user.id),
|
|
609
|
-
this.api.getContrAgentDocuments(user.id),
|
|
610
|
-
this.api.getContrAgentAddress(user.id),
|
|
611
|
-
]);
|
|
612
|
-
this.formStore[whichForm][whichIndex].response = {};
|
|
613
|
-
if (data && data.length) {
|
|
614
|
-
this.formStore[whichForm][whichIndex].response.questionnaires = data;
|
|
615
|
-
}
|
|
616
|
-
if (contacts && contacts.length) {
|
|
617
|
-
this.formStore[whichForm][whichIndex].response.contacts = contacts;
|
|
618
|
-
}
|
|
619
|
-
if (documents && documents.length) {
|
|
620
|
-
this.formStore[whichForm][whichIndex].response.documents = documents;
|
|
621
|
-
}
|
|
622
|
-
if (address && address.length) {
|
|
623
|
-
this.formStore[whichForm][whichIndex].response.addresses = address;
|
|
624
|
-
}
|
|
608
|
+
if (contacts && contacts.length) {
|
|
609
|
+
user.response.contacts = contacts;
|
|
610
|
+
}
|
|
611
|
+
if (documents && documents.length) {
|
|
612
|
+
user.response.documents = documents;
|
|
613
|
+
}
|
|
614
|
+
if (address && address.length) {
|
|
615
|
+
user.response.addresses = address;
|
|
625
616
|
}
|
|
626
617
|
}
|
|
627
618
|
try {
|
|
@@ -709,12 +700,8 @@ export const useDataStore = defineStore('data', {
|
|
|
709
700
|
type: 'MOBILE',
|
|
710
701
|
typeName: 'Сотовый телефон',
|
|
711
702
|
value: formatPhone(user.phoneNumber),
|
|
712
|
-
verifyType:
|
|
713
|
-
|
|
714
|
-
: 'response' in user && 'contacts' in user.response
|
|
715
|
-
? user.response.contacts.find(i => i.type === 'MOBILE').verifyType
|
|
716
|
-
: null,
|
|
717
|
-
verifyDate: this.formStore.otpTokenId
|
|
703
|
+
verifyType: user.otpTokenId ? 'BMG' : 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').verifyType : null,
|
|
704
|
+
verifyDate: user.otpTokenId
|
|
718
705
|
? this.currentDate()
|
|
719
706
|
: 'response' in user && 'contacts' in user.response
|
|
720
707
|
? user.response.contacts.find(i => i.type === 'MOBILE').verifyDate
|
|
@@ -801,148 +788,120 @@ export const useDataStore = defineStore('data', {
|
|
|
801
788
|
documents: documentsData,
|
|
802
789
|
addresses: addressData,
|
|
803
790
|
};
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}
|
|
810
|
-
} catch (saveErr) {
|
|
811
|
-
console.log(saveErr);
|
|
812
|
-
if ('response' in saveErr) {
|
|
813
|
-
this.showToaster('error', saveErr.response.data, 5000);
|
|
814
|
-
this.isLoading = false;
|
|
815
|
-
return false;
|
|
816
|
-
}
|
|
791
|
+
|
|
792
|
+
const personId = await this.api.saveContragent(data);
|
|
793
|
+
if (personId) {
|
|
794
|
+
await this.getContragentById(personId, whichForm, false, whichIndex);
|
|
795
|
+
user.otpTokenId = null;
|
|
817
796
|
}
|
|
818
797
|
} catch (err) {
|
|
819
|
-
console.log(err);
|
|
820
798
|
this.isLoading = false;
|
|
821
|
-
|
|
822
|
-
return false;
|
|
799
|
+
return ErrorHandler(err);
|
|
823
800
|
}
|
|
824
801
|
if (onlySaveAction) {
|
|
825
802
|
this.isLoading = false;
|
|
826
803
|
}
|
|
827
804
|
return true;
|
|
828
805
|
},
|
|
829
|
-
async saveMember(
|
|
806
|
+
async saveMember(member, whichMember, memberFromApplicaiton) {
|
|
830
807
|
let data = {};
|
|
831
808
|
try {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
if (
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
data.
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
if (
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
)
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
data.
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
data.relationName = this.formStore[whichForm][whichIndex].relationDegree.nameRu;
|
|
924
|
-
}
|
|
925
|
-
if (whichMember == 'BeneficialOwner') {
|
|
926
|
-
if (data.id === 0) {
|
|
927
|
-
data.id = null;
|
|
928
|
-
}
|
|
929
|
-
if (
|
|
930
|
-
this.formStore.applicationData &&
|
|
931
|
-
this.formStore.applicationData.beneficialOwnerApp &&
|
|
932
|
-
this.formStore.applicationData.beneficialOwnerApp.length &&
|
|
933
|
-
this.formStore.applicationData.beneficialOwnerApp.every(i => i.iin !== data.iin) &&
|
|
934
|
-
data.id !== null
|
|
935
|
-
) {
|
|
936
|
-
await this.api.deleteMember('BeneficialOwner', data.id);
|
|
937
|
-
delete data.id;
|
|
938
|
-
}
|
|
939
|
-
data.familyStatusId = this.formStore[whichForm][whichIndex].familyStatus.id;
|
|
940
|
-
}
|
|
809
|
+
data = {
|
|
810
|
+
processInstanceId: this.formStore.applicationData.processInstanceId,
|
|
811
|
+
insisId: member.id,
|
|
812
|
+
iin: member.iin.replace(/-/g, ''),
|
|
813
|
+
longName: member.longName,
|
|
814
|
+
isIpdl: member.signOfIPDL.nameRu == 'Да' ? true : false,
|
|
815
|
+
isTerror: member.isTerror,
|
|
816
|
+
isIpdlCompliance: null,
|
|
817
|
+
isTerrorCompliance: null,
|
|
818
|
+
};
|
|
819
|
+
data.id = memberFromApplicaiton && memberFromApplicaiton.id ? memberFromApplicaiton.id : null;
|
|
820
|
+
if (whichMember === 'Client') {
|
|
821
|
+
data.isInsured = this.formStore.isPolicyholderInsured;
|
|
822
|
+
data.isActOwnBehalf = this.formStore.isActOwnBehalf;
|
|
823
|
+
data.profession = member.job;
|
|
824
|
+
data.position = member.jobPosition;
|
|
825
|
+
data.jobName = member.jobPlace;
|
|
826
|
+
data.familyStatusId = member.familyStatus.id;
|
|
827
|
+
}
|
|
828
|
+
if (whichMember === 'Spokesman') {
|
|
829
|
+
if (!!memberFromApplicaiton && memberFromApplicaiton.iin !== data.iin) {
|
|
830
|
+
delete data.id;
|
|
831
|
+
await this.api.deleteMember('Spokesman', this.formStore.applicationData.processInstanceId);
|
|
832
|
+
}
|
|
833
|
+
data.migrationCard = member.migrationCard;
|
|
834
|
+
data.migrationCardIssueDate = formatDate(member.migrationCardIssueDate);
|
|
835
|
+
data.migrationCardExpireDate = formatDate(member.migrationCardExpireDate);
|
|
836
|
+
data.confirmDocType = member.confirmDocType;
|
|
837
|
+
data.confirmDocNumber = member.confirmDocNumber;
|
|
838
|
+
data.confirmDocIssueDate = formatDate(member.migrationCardIssueDate);
|
|
839
|
+
data.confirmDocExpireDate = formatDate(member.migrationCardExpireDate);
|
|
840
|
+
data.clientLongName = this.formStore.applicationData.clientApp.longName;
|
|
841
|
+
data.notaryLongName = member.notaryLongName;
|
|
842
|
+
data.notaryLicenseNumber = member.notaryLicenseNumber;
|
|
843
|
+
data.notaryLicenseDate = formatDate(member.notaryLicenseDate);
|
|
844
|
+
data.notaryLicenseIssuer = member.notaryLicenseIssuer;
|
|
845
|
+
data.jurLongName = member.jurLongName;
|
|
846
|
+
data.fullNameRod = member.fullNameRod;
|
|
847
|
+
data.confirmDocTypeKz = member.confirmDocTypeKz;
|
|
848
|
+
data.confirmDocTypeRod = member.confirmDocTypeRod;
|
|
849
|
+
data.isNotary = member.isNotary;
|
|
850
|
+
}
|
|
851
|
+
if (whichMember === 'Insured') {
|
|
852
|
+
if (
|
|
853
|
+
this.formStore.applicationData &&
|
|
854
|
+
this.formStore.applicationData.insuredApp &&
|
|
855
|
+
this.formStore.applicationData.insuredApp.length &&
|
|
856
|
+
this.formStore.applicationData.insuredApp.every(i => i.iin !== data.iin) &&
|
|
857
|
+
data.id !== null
|
|
858
|
+
) {
|
|
859
|
+
await this.api.deleteMember('Insured', data.id);
|
|
860
|
+
delete data.id;
|
|
861
|
+
}
|
|
862
|
+
data.isDisability = this.formStore.isPolicyholderInsured ? false : member.isDisability.nameRu == 'Да';
|
|
863
|
+
data.disabilityGroupId = data.isDisability ? member.disabilityGroupId.id : null;
|
|
864
|
+
data.profession = member.job;
|
|
865
|
+
data.position = member.jobPosition;
|
|
866
|
+
data.jobName = member.jobPlace;
|
|
867
|
+
data.familyStatusId = member.familyStatus.id;
|
|
868
|
+
}
|
|
869
|
+
if (whichMember === 'Beneficiary') {
|
|
870
|
+
if (
|
|
871
|
+
this.formStore.applicationData &&
|
|
872
|
+
this.formStore.applicationData.beneficiaryApp &&
|
|
873
|
+
this.formStore.applicationData.beneficiaryApp.length &&
|
|
874
|
+
this.formStore.applicationData.beneficiaryApp.every(i => i.iin !== data.iin) &&
|
|
875
|
+
data.id !== null
|
|
876
|
+
) {
|
|
877
|
+
await this.api.deleteMember('Beneficiary', data.id);
|
|
878
|
+
delete data.id;
|
|
879
|
+
}
|
|
880
|
+
data.familyStatusId = member.familyStatus.id == 0 ? null : member.familyStatus.id;
|
|
881
|
+
data.percentage = Number(member.percentageOfPayoutAmount);
|
|
882
|
+
data.relationId = member.relationDegree.ids;
|
|
883
|
+
data.relationName = member.relationDegree.nameRu;
|
|
884
|
+
}
|
|
885
|
+
if (whichMember === 'BeneficialOwner') {
|
|
886
|
+
if (data.id === 0) {
|
|
887
|
+
data.id = null;
|
|
888
|
+
}
|
|
889
|
+
if (
|
|
890
|
+
this.formStore.applicationData &&
|
|
891
|
+
this.formStore.applicationData.beneficialOwnerApp &&
|
|
892
|
+
this.formStore.applicationData.beneficialOwnerApp.length &&
|
|
893
|
+
this.formStore.applicationData.beneficialOwnerApp.every(i => i.iin !== data.iin) &&
|
|
894
|
+
data.id !== null
|
|
895
|
+
) {
|
|
896
|
+
await this.api.deleteMember('BeneficialOwner', data.id);
|
|
897
|
+
delete data.id;
|
|
898
|
+
}
|
|
899
|
+
data.familyStatusId = member.familyStatus.id;
|
|
941
900
|
}
|
|
942
901
|
await this.api.setMember(whichMember, data);
|
|
943
902
|
return true;
|
|
944
903
|
} catch (err) {
|
|
945
|
-
|
|
904
|
+
return ErrorHandler(err, err.response?.data?.errors && Object.values(err.response?.data?.errors).join(' -> '));
|
|
946
905
|
}
|
|
947
906
|
},
|
|
948
907
|
searchFromList(whichForm, searchIt, whichIndex = null) {
|
|
@@ -983,7 +942,7 @@ export const useDataStore = defineStore('data', {
|
|
|
983
942
|
this.showToaster('success', this.t('toaster.successSaved'), 2000);
|
|
984
943
|
return anketaToken;
|
|
985
944
|
} catch (error) {
|
|
986
|
-
|
|
945
|
+
ErrorHandler(err);
|
|
987
946
|
} finally {
|
|
988
947
|
this.isLoading = false;
|
|
989
948
|
}
|
|
@@ -1002,7 +961,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1002
961
|
};
|
|
1003
962
|
|
|
1004
963
|
if (getDataCondition()) {
|
|
1005
|
-
this
|
|
964
|
+
this[whichField] = [];
|
|
1006
965
|
try {
|
|
1007
966
|
const response = await this.api[whichRequest](parameter);
|
|
1008
967
|
if (response) {
|
|
@@ -1015,9 +974,6 @@ export const useDataStore = defineStore('data', {
|
|
|
1015
974
|
}),
|
|
1016
975
|
);
|
|
1017
976
|
this[whichField] = response;
|
|
1018
|
-
if (this[whichField].length && this[whichField][this[whichField].length - 1].nameRu == 'невключено') {
|
|
1019
|
-
this[whichField].unshift(this[whichField].pop());
|
|
1020
|
-
}
|
|
1021
977
|
}
|
|
1022
978
|
} catch (err) {
|
|
1023
979
|
console.log(err);
|
|
@@ -1040,33 +996,31 @@ export const useDataStore = defineStore('data', {
|
|
|
1040
996
|
async getAdditionalTaxCountries() {
|
|
1041
997
|
return await this.getFromApi('addTaxCountries', 'getAdditionalTaxCountries');
|
|
1042
998
|
},
|
|
1043
|
-
async getStates(key) {
|
|
999
|
+
async getStates(key, member) {
|
|
1044
1000
|
await this.getFromApi('states', 'getStates');
|
|
1045
|
-
if (key &&
|
|
1046
|
-
return this.states.filter(i => i.code ===
|
|
1001
|
+
if (key && member[key] && member[key].ids !== null) {
|
|
1002
|
+
return this.states.filter(i => i.code === member[key].ids);
|
|
1047
1003
|
}
|
|
1048
1004
|
return this.states;
|
|
1049
1005
|
},
|
|
1050
|
-
async getRegions(key) {
|
|
1006
|
+
async getRegions(key, member) {
|
|
1051
1007
|
await this.getFromApi('regions', 'getRegions');
|
|
1052
|
-
if (key &&
|
|
1053
|
-
return this.regions.filter(i => i.code ===
|
|
1008
|
+
if (key && member[key] && member[key].ids !== null) {
|
|
1009
|
+
return this.regions.filter(i => i.code === member[key].ids);
|
|
1054
1010
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
return this.regions.filter(i => i.code === registrationProvince.ids);
|
|
1011
|
+
if (member.registrationProvince.ids !== null) {
|
|
1012
|
+
return this.regions.filter(i => i.code === member.registrationProvince.ids);
|
|
1058
1013
|
} else {
|
|
1059
1014
|
return this.regions;
|
|
1060
1015
|
}
|
|
1061
1016
|
},
|
|
1062
|
-
async getCities(key) {
|
|
1017
|
+
async getCities(key, member) {
|
|
1063
1018
|
await this.getFromApi('cities', 'getCities');
|
|
1064
|
-
if (key &&
|
|
1065
|
-
return this.cities.filter(i => i.code ===
|
|
1019
|
+
if (key && member[key] && member[key].ids !== null) {
|
|
1020
|
+
return this.cities.filter(i => i.code === member[key].ids);
|
|
1066
1021
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
return this.cities.filter(i => i.code === registrationProvince.ids);
|
|
1022
|
+
if (member.registrationProvince.ids !== null) {
|
|
1023
|
+
return this.cities.filter(i => i.code === member.registrationProvince.ids);
|
|
1070
1024
|
} else {
|
|
1071
1025
|
return this.cities;
|
|
1072
1026
|
}
|
|
@@ -1105,15 +1059,13 @@ export const useDataStore = defineStore('data', {
|
|
|
1105
1059
|
},
|
|
1106
1060
|
async getSectorCodeList() {
|
|
1107
1061
|
await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1108
|
-
if (this.economySectorCode[1].ids != '500003.9') {
|
|
1109
|
-
this.economySectorCode = this.economySectorCode.reverse();
|
|
1110
|
-
}
|
|
1111
1062
|
return this.economySectorCode;
|
|
1112
1063
|
},
|
|
1113
1064
|
async getFamilyStatuses() {
|
|
1114
1065
|
return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
|
|
1115
1066
|
},
|
|
1116
1067
|
async getRelationTypes() {
|
|
1068
|
+
// TODO Remove this & add filtering in openPanel method
|
|
1117
1069
|
await this.getFromApi('relations', 'getRelationTypes');
|
|
1118
1070
|
const filteredRelations = this.relations.filter(i => Number(i.ids) >= 6 && Number(i.ids) <= 15);
|
|
1119
1071
|
const otherRelations = this.relations.filter(i => Number(i.ids) < 6 || Number(i.ids) > 15);
|
|
@@ -1261,107 +1213,6 @@ export const useDataStore = defineStore('data', {
|
|
|
1261
1213
|
this.isLoading = false;
|
|
1262
1214
|
}
|
|
1263
1215
|
},
|
|
1264
|
-
async getOtpStatus(iin, phone, processInstanceId = null) {
|
|
1265
|
-
try {
|
|
1266
|
-
const otpData = {
|
|
1267
|
-
iin: iin.replace(/-/g, ''),
|
|
1268
|
-
phoneNumber: formatPhone(phone),
|
|
1269
|
-
type: 'AgreementOtp',
|
|
1270
|
-
};
|
|
1271
|
-
return await this.api.getOtpStatus(
|
|
1272
|
-
processInstanceId !== null && processInstanceId != 0
|
|
1273
|
-
? {
|
|
1274
|
-
...otpData,
|
|
1275
|
-
processInstanceId: processInstanceId,
|
|
1276
|
-
}
|
|
1277
|
-
: otpData,
|
|
1278
|
-
);
|
|
1279
|
-
} catch (err) {
|
|
1280
|
-
console.log(err);
|
|
1281
|
-
this.showToaster('error', err.response.data, 3000);
|
|
1282
|
-
}
|
|
1283
|
-
},
|
|
1284
|
-
async sendOtp(iin, phone, processInstanceId = null, onInit = false) {
|
|
1285
|
-
this.isLoading = true;
|
|
1286
|
-
let otpStatus = false;
|
|
1287
|
-
let otpResponse = {};
|
|
1288
|
-
try {
|
|
1289
|
-
if (iin && iin.length === 15 && phone && phone.length === 18) {
|
|
1290
|
-
const status = await this.getOtpStatus(iin, phone, processInstanceId);
|
|
1291
|
-
if (status === true) {
|
|
1292
|
-
this.showToaster('success', this.t('toaster.hasSuccessOtp'), 3000);
|
|
1293
|
-
otpStatus = true;
|
|
1294
|
-
this.isLoading = false;
|
|
1295
|
-
return { otpStatus, otpResponse };
|
|
1296
|
-
} else if (status === false && onInit === false) {
|
|
1297
|
-
const otpData = {
|
|
1298
|
-
iin: iin.replace(/-/g, ''),
|
|
1299
|
-
phoneNumber: formatPhone(phone),
|
|
1300
|
-
type: 'AgreementOtp',
|
|
1301
|
-
};
|
|
1302
|
-
otpResponse = await this.api.sendOtp(
|
|
1303
|
-
processInstanceId !== null && processInstanceId != 0
|
|
1304
|
-
? {
|
|
1305
|
-
...otpData,
|
|
1306
|
-
processInstanceId: processInstanceId,
|
|
1307
|
-
}
|
|
1308
|
-
: otpData,
|
|
1309
|
-
);
|
|
1310
|
-
this.isLoading = false;
|
|
1311
|
-
if (!!otpResponse) {
|
|
1312
|
-
if ('errMessage' in otpResponse && otpResponse.errMessage !== null) {
|
|
1313
|
-
this.showToaster('error', otpResponse.errMessage, 3000);
|
|
1314
|
-
return { otpStatus };
|
|
1315
|
-
}
|
|
1316
|
-
if ('result' in otpResponse && otpResponse.result === null) {
|
|
1317
|
-
if ('statusName' in otpResponse && !!otpResponse.statusName) {
|
|
1318
|
-
this.showToaster('error', otpResponse.statusName, 3000);
|
|
1319
|
-
return { otpStatus };
|
|
1320
|
-
}
|
|
1321
|
-
if ('status' in otpResponse && !!otpResponse.status) {
|
|
1322
|
-
this.showToaster('error', otpResponse.status, 3000);
|
|
1323
|
-
return { otpStatus };
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
if ('tokenId' in otpResponse && otpResponse.tokenId) {
|
|
1327
|
-
this.contragent.otpTokenId = otpResponse.tokenId;
|
|
1328
|
-
this.showToaster('success', this.t('toaster.successOtp'), 3000);
|
|
1329
|
-
}
|
|
1330
|
-
} else {
|
|
1331
|
-
this.showToaster('error', this.t('toaster.undefinedError'), 3000);
|
|
1332
|
-
return { otpStatus };
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
} else {
|
|
1336
|
-
if (onInit === false) {
|
|
1337
|
-
this.showToaster(
|
|
1338
|
-
'error',
|
|
1339
|
-
this.t('toaster.errorFormField', {
|
|
1340
|
-
text: 'Номер телефона, ИИН',
|
|
1341
|
-
}),
|
|
1342
|
-
);
|
|
1343
|
-
this.isLoading = false;
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
return { otpStatus, otpResponse };
|
|
1347
|
-
} catch (err) {
|
|
1348
|
-
this.isLoading = false;
|
|
1349
|
-
if ('response' in err) {
|
|
1350
|
-
if ('statusName' in err.response.data && !!err.response.data.statusName) {
|
|
1351
|
-
this.showToaster('error', this.t('toaster.phoneNotFoundInBMG'), 3000);
|
|
1352
|
-
return { otpStatus };
|
|
1353
|
-
}
|
|
1354
|
-
if ('status' in err.response.data && !!err.response.data.status) {
|
|
1355
|
-
this.showToaster('error', err.response.data.status, 3000);
|
|
1356
|
-
return { otpStatus };
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
} finally {
|
|
1360
|
-
this.isLoading = false;
|
|
1361
|
-
}
|
|
1362
|
-
this.isLoading = false;
|
|
1363
|
-
return { otpStatus, otpResponse };
|
|
1364
|
-
},
|
|
1365
1216
|
async getProcessList() {
|
|
1366
1217
|
this.isLoading = true;
|
|
1367
1218
|
try {
|
|
@@ -1580,17 +1431,17 @@ export const useDataStore = defineStore('data', {
|
|
|
1580
1431
|
console.log(err);
|
|
1581
1432
|
}
|
|
1582
1433
|
} catch (err) {
|
|
1583
|
-
|
|
1434
|
+
ErrorHandler(err);
|
|
1584
1435
|
console.log(err, 'error');
|
|
1585
1436
|
}
|
|
1586
1437
|
this.isLoading = false;
|
|
1587
1438
|
},
|
|
1588
|
-
async startApplication(
|
|
1439
|
+
async startApplication(member) {
|
|
1589
1440
|
try {
|
|
1590
1441
|
const data = {
|
|
1591
|
-
clientId:
|
|
1592
|
-
iin:
|
|
1593
|
-
longName:
|
|
1442
|
+
clientId: member.id,
|
|
1443
|
+
iin: member.iin.replace(/-/g, ''),
|
|
1444
|
+
longName: member.longName,
|
|
1594
1445
|
processCode: this.processCode,
|
|
1595
1446
|
policyId: 0,
|
|
1596
1447
|
};
|
|
@@ -1598,11 +1449,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1598
1449
|
this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
|
|
1599
1450
|
return response.processInstanceId;
|
|
1600
1451
|
} catch (err) {
|
|
1601
|
-
|
|
1602
|
-
if ('response' in err && err.response.data) {
|
|
1603
|
-
this.showToaster('error', err.response.data, 0);
|
|
1604
|
-
}
|
|
1605
|
-
return null;
|
|
1452
|
+
return ErrorHandler(err);
|
|
1606
1453
|
}
|
|
1607
1454
|
},
|
|
1608
1455
|
async getApplicationData(taskId, onlyGet = true, setMembersField = true, fetchMembers = true, setProductConditions = true) {
|
|
@@ -2000,7 +1847,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2000
1847
|
4000,
|
|
2001
1848
|
);
|
|
2002
1849
|
} else {
|
|
2003
|
-
|
|
1850
|
+
ErrorHandler(err);
|
|
2004
1851
|
}
|
|
2005
1852
|
} catch (err) {
|
|
2006
1853
|
console.log(err);
|
|
@@ -2205,7 +2052,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2205
2052
|
this.isLoading = false;
|
|
2206
2053
|
return false;
|
|
2207
2054
|
},
|
|
2208
|
-
async getContragentFromGBDFL(iin, phoneNumber, whichForm, whichIndex
|
|
2055
|
+
async getContragentFromGBDFL(iin, phoneNumber, whichForm, whichIndex) {
|
|
2209
2056
|
this.isLoading = true;
|
|
2210
2057
|
try {
|
|
2211
2058
|
const data = {
|
|
@@ -2229,13 +2076,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2229
2076
|
}
|
|
2230
2077
|
const { person } = parseXML(gbdResponse.content, true, 'person');
|
|
2231
2078
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
2232
|
-
if (whichIndex
|
|
2079
|
+
if (typeof whichIndex !== 'number') {
|
|
2233
2080
|
if (this.formStore[whichForm].gosPersonData !== null && this.formStore[whichForm].gosPersonData.iin !== iin.replace(/-/g, '')) {
|
|
2234
|
-
|
|
2235
|
-
this.formStore[whichForm].resetMember(false);
|
|
2236
|
-
} else {
|
|
2237
|
-
this.formStore[whichForm].resetForm(false);
|
|
2238
|
-
}
|
|
2081
|
+
this.formStore[whichForm].resetForm(false);
|
|
2239
2082
|
}
|
|
2240
2083
|
this.formStore[whichForm].gosPersonData = person;
|
|
2241
2084
|
} else {
|
|
@@ -2245,8 +2088,8 @@ export const useDataStore = defineStore('data', {
|
|
|
2245
2088
|
this.formStore[whichForm][whichIndex].gosPersonData = person;
|
|
2246
2089
|
}
|
|
2247
2090
|
|
|
2248
|
-
await this.getContragent(whichForm, whichIndex, false);
|
|
2249
|
-
if (whichIndex
|
|
2091
|
+
await this.getContragent(typeof whichIndex === 'number' ? this.formStore[whichForm][whichIndex] : this.formStore[whichForm], whichForm, whichIndex, false);
|
|
2092
|
+
if (typeof whichIndex !== 'number') {
|
|
2250
2093
|
this.formStore[whichForm].verifyDate = responseInfo.responseDate;
|
|
2251
2094
|
this.formStore[whichForm].verifyType = 'GBDFL';
|
|
2252
2095
|
} else {
|
|
@@ -2515,134 +2358,43 @@ export const useDataStore = defineStore('data', {
|
|
|
2515
2358
|
if (economySectorCode) this.formStore[whichForm][whichIndex].economySectorCode = economySectorCode;
|
|
2516
2359
|
}
|
|
2517
2360
|
},
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
processInstanceId !== null && processInstanceId != 0
|
|
2527
|
-
? {
|
|
2528
|
-
...otpData,
|
|
2529
|
-
processInstanceId: processInstanceId,
|
|
2530
|
-
}
|
|
2531
|
-
: otpData,
|
|
2532
|
-
);
|
|
2533
|
-
} catch (err) {
|
|
2534
|
-
console.log(err);
|
|
2535
|
-
this.showToaster('error', err.response.data, 3000);
|
|
2361
|
+
hasJobSection(whichForm) {
|
|
2362
|
+
switch (whichForm) {
|
|
2363
|
+
case this.formStore.beneficiaryFormKey:
|
|
2364
|
+
case this.formStore.beneficialOwnerFormKey:
|
|
2365
|
+
case this.formStore.policyholdersRepresentativeFormKey:
|
|
2366
|
+
return false;
|
|
2367
|
+
default:
|
|
2368
|
+
return true;
|
|
2536
2369
|
}
|
|
2537
2370
|
},
|
|
2538
|
-
|
|
2539
|
-
this.
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
if (status === true) {
|
|
2546
|
-
this.showToaster('success', this.t('toaster.hasSuccessOtp'), 3000);
|
|
2547
|
-
otpStatus = true;
|
|
2548
|
-
this.isLoading = false;
|
|
2549
|
-
return { otpStatus, otpResponse };
|
|
2550
|
-
} else if (status === false && onInit === false) {
|
|
2551
|
-
const otpData = {
|
|
2552
|
-
iin: iin.replace(/-/g, ''),
|
|
2553
|
-
phoneNumber: formatPhone(phone),
|
|
2554
|
-
type: 'AgreementOtp',
|
|
2555
|
-
};
|
|
2556
|
-
otpResponse = await api.sendOtp(
|
|
2557
|
-
processInstanceId !== null && processInstanceId != 0
|
|
2558
|
-
? {
|
|
2559
|
-
...otpData,
|
|
2560
|
-
processInstanceId: processInstanceId,
|
|
2561
|
-
}
|
|
2562
|
-
: otpData,
|
|
2563
|
-
);
|
|
2564
|
-
this.isLoading = false;
|
|
2565
|
-
if (!!otpResponse) {
|
|
2566
|
-
if ('errMessage' in otpResponse && otpResponse.errMessage !== null) {
|
|
2567
|
-
this.showToaster('error', otpResponse.errMessage, 3000);
|
|
2568
|
-
return { otpStatus };
|
|
2569
|
-
}
|
|
2570
|
-
if ('result' in otpResponse && otpResponse.result === null) {
|
|
2571
|
-
if ('statusName' in otpResponse && !!otpResponse.statusName) {
|
|
2572
|
-
this.showToaster('error', otpResponse.statusName, 3000);
|
|
2573
|
-
return { otpStatus };
|
|
2574
|
-
}
|
|
2575
|
-
if ('status' in otpResponse && !!otpResponse.status) {
|
|
2576
|
-
this.showToaster('error', otpResponse.status, 3000);
|
|
2577
|
-
return { otpStatus };
|
|
2578
|
-
}
|
|
2579
|
-
}
|
|
2580
|
-
if ('tokenId' in otpResponse && otpResponse.tokenId) {
|
|
2581
|
-
this.formStore.otpTokenId = otpResponse.tokenId;
|
|
2582
|
-
this.showToaster('success', this.t('toaster.successOtp'), 3000);
|
|
2583
|
-
}
|
|
2584
|
-
} else {
|
|
2585
|
-
this.showToaster('error', this.t('toaster.undefinedError'), 3000);
|
|
2586
|
-
return { otpStatus };
|
|
2587
|
-
}
|
|
2588
|
-
}
|
|
2589
|
-
} else {
|
|
2590
|
-
if (onInit === false) {
|
|
2591
|
-
this.showToaster('error', this.t('toaster.errorFormField', { text: 'Номер телефона, ИИН' }));
|
|
2592
|
-
this.isLoading = false;
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
return { otpStatus, otpResponse };
|
|
2596
|
-
} catch (err) {
|
|
2597
|
-
this.isLoading = false;
|
|
2598
|
-
if ('response' in err) {
|
|
2599
|
-
if ('statusName' in err.response.data && !!err.response.data.statusName) {
|
|
2600
|
-
this.showToaster('error', this.t('toaster.phoneNotFoundInBMG'), 3000);
|
|
2601
|
-
return { otpStatus };
|
|
2602
|
-
}
|
|
2603
|
-
if ('status' in err.response.data && !!err.response.data.status) {
|
|
2604
|
-
this.showToaster('error', err.response.data.status, 3000);
|
|
2605
|
-
return { otpStatus };
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
} finally {
|
|
2609
|
-
this.isLoading = false;
|
|
2371
|
+
hasBirthSection(whichForm) {
|
|
2372
|
+
if (this.isGons) return false;
|
|
2373
|
+
switch (whichForm) {
|
|
2374
|
+
case this.formStore.beneficiaryFormKey:
|
|
2375
|
+
return false;
|
|
2376
|
+
default:
|
|
2377
|
+
return true;
|
|
2610
2378
|
}
|
|
2611
|
-
this.isLoading = false;
|
|
2612
|
-
return { otpStatus, otpResponse };
|
|
2613
2379
|
},
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
if (otpResponse.status === 2) {
|
|
2632
|
-
return true;
|
|
2633
|
-
}
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
return false;
|
|
2637
|
-
} catch (err) {
|
|
2638
|
-
console.log(err);
|
|
2639
|
-
if ('response' in err) {
|
|
2640
|
-
this.showToaster('error', err.response.data, 3000);
|
|
2641
|
-
}
|
|
2642
|
-
} finally {
|
|
2643
|
-
this.isLoading = false;
|
|
2380
|
+
hasPlaceSection(whichForm) {
|
|
2381
|
+
switch (whichForm) {
|
|
2382
|
+
default:
|
|
2383
|
+
return true;
|
|
2384
|
+
}
|
|
2385
|
+
},
|
|
2386
|
+
hasDocumentSection(whichForm) {
|
|
2387
|
+
switch (whichForm) {
|
|
2388
|
+
default:
|
|
2389
|
+
return true;
|
|
2390
|
+
}
|
|
2391
|
+
},
|
|
2392
|
+
hasContactSection(whichForm) {
|
|
2393
|
+
if (this.isGons) return false;
|
|
2394
|
+
switch (whichForm) {
|
|
2395
|
+
default:
|
|
2396
|
+
return true;
|
|
2644
2397
|
}
|
|
2645
|
-
return null;
|
|
2646
2398
|
},
|
|
2647
2399
|
},
|
|
2648
2400
|
});
|