hl-core 0.0.8-beta.8 → 0.0.8-beta.9
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/Pages/MemberForm.vue +2 -2
- package/composables/classes.ts +25 -0
- package/locales/en.json +3 -1
- package/locales/kz.json +3 -1
- package/locales/ru.json +3 -1
- package/package.json +1 -1
- package/store/data.store.js +213 -444
- package/store/member.store.ts +94 -4
|
@@ -872,7 +872,7 @@ export default {
|
|
|
872
872
|
return;
|
|
873
873
|
}
|
|
874
874
|
isButtonLoading.value = true;
|
|
875
|
-
await dataStore.getContragentFromGBDFL(member.value
|
|
875
|
+
await dataStore.getContragentFromGBDFL(member.value);
|
|
876
876
|
member.value.gotFromInsis = true;
|
|
877
877
|
isButtonLoading.value = false;
|
|
878
878
|
dataStore.panel.open = false;
|
|
@@ -893,7 +893,7 @@ export default {
|
|
|
893
893
|
return;
|
|
894
894
|
}
|
|
895
895
|
isButtonLoading.value = true;
|
|
896
|
-
await dataStore.getContragent(member.value,
|
|
896
|
+
await dataStore.getContragent(member.value, false);
|
|
897
897
|
isButtonLoading.value = false;
|
|
898
898
|
dataStore.panel.open = false;
|
|
899
899
|
isSearchOpen.value = false;
|
package/composables/classes.ts
CHANGED
|
@@ -771,6 +771,17 @@ export class ProductConditions {
|
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
|
|
774
|
+
export class MemberSettings {
|
|
775
|
+
has?: boolean;
|
|
776
|
+
isMultiple?: boolean;
|
|
777
|
+
constructor(options?: { has?: boolean; isMultiple?: boolean }) {
|
|
778
|
+
if (options) {
|
|
779
|
+
this.has = options.has;
|
|
780
|
+
this.isMultiple = options.isMultiple;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
774
785
|
export class DataStoreClass {
|
|
775
786
|
// IMP Контроллер фич
|
|
776
787
|
controls: {
|
|
@@ -791,6 +802,13 @@ export class DataStoreClass {
|
|
|
791
802
|
// Блок прикрепления к менеджеру
|
|
792
803
|
hasAttachment: boolean;
|
|
793
804
|
};
|
|
805
|
+
members: {
|
|
806
|
+
clientApp: MemberSettings;
|
|
807
|
+
insuredApp: MemberSettings;
|
|
808
|
+
beneficiaryApp: MemberSettings;
|
|
809
|
+
beneficialOwnerApp: MemberSettings;
|
|
810
|
+
spokesmanApp: MemberSettings;
|
|
811
|
+
};
|
|
794
812
|
hasLayoutMargins: boolean;
|
|
795
813
|
readonly product: string | null;
|
|
796
814
|
showNav: boolean;
|
|
@@ -866,6 +884,13 @@ export class DataStoreClass {
|
|
|
866
884
|
AgentData: AgentData[];
|
|
867
885
|
riskGroup: Value[];
|
|
868
886
|
constructor() {
|
|
887
|
+
this.members = {
|
|
888
|
+
clientApp: new MemberSettings(),
|
|
889
|
+
insuredApp: new MemberSettings(),
|
|
890
|
+
beneficiaryApp: new MemberSettings(),
|
|
891
|
+
beneficialOwnerApp: new MemberSettings(),
|
|
892
|
+
spokesmanApp: new MemberSettings(),
|
|
893
|
+
};
|
|
869
894
|
this.controls = {
|
|
870
895
|
onAuth: false,
|
|
871
896
|
hasAnketa: true,
|
package/locales/en.json
CHANGED
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"connectionLost": "No connection",
|
|
17
17
|
"checkConnection": "Check your connection",
|
|
18
18
|
"noOtpResponse": "No response when sending OTP code",
|
|
19
|
-
"noOtpCode": "Fill in the fields: IIN, Phone Number, Confirmation Code"
|
|
19
|
+
"noOtpCode": "Fill in the fields: IIN, Phone Number, Confirmation Code",
|
|
20
|
+
"memberCopy": "Error while transfering data of members",
|
|
21
|
+
"memberSave": "Error while saving members"
|
|
20
22
|
},
|
|
21
23
|
"toaster": {
|
|
22
24
|
"noIinOrPhone": "Missing data to send SMS",
|
package/locales/kz.json
CHANGED
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"connectionLost": "Нет подключения к Интернету",
|
|
17
17
|
"checkConnection": "Проверьте ваше подключение",
|
|
18
18
|
"noOtpResponse": "Отсутствует ответ при отправке OTP кода",
|
|
19
|
-
"noOtpCode": "Заполните поля: ИИН, Номер телефона, Код подтверждения"
|
|
19
|
+
"noOtpCode": "Заполните поля: ИИН, Номер телефона, Код подтверждения",
|
|
20
|
+
"memberCopy": "Ошибка при копировании данных участников",
|
|
21
|
+
"memberSave": "Ошибка при сохранении данных участников"
|
|
20
22
|
},
|
|
21
23
|
"toaster": {
|
|
22
24
|
"noIinOrPhone": "Отсутствуют данные для отправки СМС",
|
package/locales/ru.json
CHANGED
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"connectionLost": "Нет подключения к Интернету",
|
|
17
17
|
"checkConnection": "Проверьте ваше подключение",
|
|
18
18
|
"noOtpResponse": "Отсутствует ответ при отправке OTP кода",
|
|
19
|
-
"noOtpCode": "Заполните поля: ИИН, Номер телефона, Код подтверждения"
|
|
19
|
+
"noOtpCode": "Заполните поля: ИИН, Номер телефона, Код подтверждения",
|
|
20
|
+
"memberCopy": "Ошибка при копировании данных участников",
|
|
21
|
+
"memberSave": "Ошибка при сохранении данных участников"
|
|
20
22
|
},
|
|
21
23
|
"toaster": {
|
|
22
24
|
"noIinOrPhone": "Отсутствуют данные для отправки СМС",
|
package/package.json
CHANGED
package/store/data.store.js
CHANGED
|
@@ -306,7 +306,7 @@ export const useDataStore = defineStore('data', {
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
},
|
|
309
|
-
async getContragent(member,
|
|
309
|
+
async getContragent(member, load = true) {
|
|
310
310
|
if (load) {
|
|
311
311
|
this.isLoading = true;
|
|
312
312
|
}
|
|
@@ -321,10 +321,10 @@ export const useDataStore = defineStore('data', {
|
|
|
321
321
|
response = await this.api.getContragent(queryData);
|
|
322
322
|
if (response.totalItems > 0) {
|
|
323
323
|
if (response.totalItems.length === 1) {
|
|
324
|
-
await this.serializeContragentData(
|
|
324
|
+
await this.serializeContragentData(member, response.items[0]);
|
|
325
325
|
} else {
|
|
326
326
|
const sortedByRegistrationDate = response.items.sort((left, right) => new Date(right.registrationDate) - new Date(left.registrationDate));
|
|
327
|
-
await this.serializeContragentData(
|
|
327
|
+
await this.serializeContragentData(member, sortedByRegistrationDate[0]);
|
|
328
328
|
}
|
|
329
329
|
member.gotFromInsis = true;
|
|
330
330
|
} else {
|
|
@@ -342,14 +342,15 @@ export const useDataStore = defineStore('data', {
|
|
|
342
342
|
this.isLoading = true;
|
|
343
343
|
}
|
|
344
344
|
try {
|
|
345
|
+
const member = whichIndex === null ? this.formStore[whichForm] : this.formStore[whichForm][whichIndex];
|
|
345
346
|
if (this.isMycar && this.isAgentMycar() && whichForm === this.formStore.beneficiaryFormKey) {
|
|
346
|
-
await this.serializeContragentData(
|
|
347
|
+
await this.serializeContragentData(member, this.formStore.applicationData.beneficiaryApp[0]);
|
|
347
348
|
this.isLoading = false;
|
|
348
349
|
return;
|
|
349
350
|
}
|
|
350
351
|
const response = await this.api.getContragentById(id);
|
|
351
352
|
if (response.totalItems > 0) {
|
|
352
|
-
await this.serializeContragentData(
|
|
353
|
+
await this.serializeContragentData(member, response.items[0]);
|
|
353
354
|
} else {
|
|
354
355
|
this.isLoading = false;
|
|
355
356
|
return false;
|
|
@@ -361,58 +362,35 @@ export const useDataStore = defineStore('data', {
|
|
|
361
362
|
this.isLoading = false;
|
|
362
363
|
}
|
|
363
364
|
},
|
|
364
|
-
async serializeContragentData(
|
|
365
|
+
async serializeContragentData(member, contragent) {
|
|
365
366
|
const [{ value: data }, { value: contacts }, { value: documents }, { value: address }] = await Promise.allSettled([
|
|
366
367
|
this.api.getContrAgentData(contragent.id),
|
|
367
368
|
this.api.getContrAgentContacts(contragent.id),
|
|
368
369
|
this.api.getContrAgentDocuments(contragent.id),
|
|
369
370
|
this.api.getContrAgentAddress(contragent.id),
|
|
370
371
|
]);
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
this.formStore[whichForm].response.questionnaires = data;
|
|
377
|
-
}
|
|
378
|
-
if (contacts && contacts.length) {
|
|
379
|
-
this.formStore[whichForm].response.contacts = contacts;
|
|
380
|
-
}
|
|
381
|
-
if (documents && documents.length) {
|
|
382
|
-
this.formStore[whichForm].response.documents = documents;
|
|
383
|
-
}
|
|
384
|
-
if (address && address.length) {
|
|
385
|
-
this.formStore[whichForm].response.addresses = address;
|
|
386
|
-
}
|
|
372
|
+
member.response = {
|
|
373
|
+
contragent: contragent,
|
|
374
|
+
};
|
|
375
|
+
if (data && data.length) {
|
|
376
|
+
member.response.questionnaires = data;
|
|
387
377
|
}
|
|
388
|
-
if (
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
}
|
|
405
|
-
this.parseContragent(
|
|
406
|
-
whichForm,
|
|
407
|
-
{
|
|
408
|
-
personalData: contragent,
|
|
409
|
-
documents: documents,
|
|
410
|
-
contacts: contacts,
|
|
411
|
-
data: data,
|
|
412
|
-
address: address,
|
|
413
|
-
},
|
|
414
|
-
whichIndex,
|
|
415
|
-
);
|
|
378
|
+
if (contacts && contacts.length) {
|
|
379
|
+
member.response.contacts = contacts;
|
|
380
|
+
}
|
|
381
|
+
if (documents && documents.length) {
|
|
382
|
+
member.response.documents = documents;
|
|
383
|
+
}
|
|
384
|
+
if (address && address.length) {
|
|
385
|
+
member.response.addresses = address;
|
|
386
|
+
}
|
|
387
|
+
this.parseContragent(member, {
|
|
388
|
+
personalData: contragent,
|
|
389
|
+
documents: documents,
|
|
390
|
+
contacts: contacts,
|
|
391
|
+
data: data,
|
|
392
|
+
address: address,
|
|
393
|
+
});
|
|
416
394
|
},
|
|
417
395
|
async searchContragent(iin) {
|
|
418
396
|
this.isLoading = true;
|
|
@@ -435,142 +413,72 @@ export const useDataStore = defineStore('data', {
|
|
|
435
413
|
}
|
|
436
414
|
this.isLoading = false;
|
|
437
415
|
},
|
|
438
|
-
parseContragent(
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
if ('address' in user && user.address.length) {
|
|
475
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address[0].countryName, 'i')));
|
|
476
|
-
const province = this.states.find(i => i.ids === user.address[0].stateCode);
|
|
477
|
-
const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
|
|
478
|
-
const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
|
|
479
|
-
const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
|
|
480
|
-
this.formStore[whichForm].registrationCountry = country ? country : new Value();
|
|
481
|
-
this.formStore[whichForm].registrationStreet = user.address[0].streetName;
|
|
482
|
-
this.formStore[whichForm].registrationCity = city ? city : new Value();
|
|
483
|
-
this.formStore[whichForm].registrationNumberApartment = user.address[0].apartmentNumber;
|
|
484
|
-
this.formStore[whichForm].registrationNumberHouse = user.address[0].blockNumber;
|
|
485
|
-
this.formStore[whichForm].registrationProvince = province ? province : new Value();
|
|
486
|
-
this.formStore[whichForm].registrationRegionType = localityType ? localityType : new Value();
|
|
487
|
-
this.formStore[whichForm].registrationRegion = region ? region : new Value();
|
|
488
|
-
this.formStore[whichForm].registrationQuarter = user.address[0].kvartal;
|
|
489
|
-
this.formStore[whichForm].registrationMicroDistrict = user.address[0].microRaion;
|
|
490
|
-
}
|
|
491
|
-
if ('contacts' in user && user.contacts.length) {
|
|
492
|
-
user.contacts.forEach(contact => {
|
|
493
|
-
if (contact.type === 'EMAIL' && contact.value) {
|
|
494
|
-
this.formStore[whichForm].email = contact.value;
|
|
495
|
-
}
|
|
496
|
-
if (contact.type === 'MOBILE' && contact.value) {
|
|
497
|
-
let phoneNumber = contact.value.substring(1);
|
|
498
|
-
this.formStore[whichForm].phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
|
|
499
|
-
}
|
|
500
|
-
if (contact.type === 'HOME' && contact.value) {
|
|
501
|
-
let homePhone = contact.value.substring(1);
|
|
502
|
-
this.formStore[whichForm].homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
}
|
|
416
|
+
parseContragent(member, user) {
|
|
417
|
+
// Save User Personal Data
|
|
418
|
+
member.verifyType = user.personalData.verifyType;
|
|
419
|
+
member.verifyDate = user.personalData.verifyDate;
|
|
420
|
+
member.iin = reformatIin(user.personalData.iin);
|
|
421
|
+
member.age = user.personalData.age;
|
|
422
|
+
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
|
|
423
|
+
member.birthPlace = country && Object.keys(country).length ? country : new Value();
|
|
424
|
+
member.gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
|
|
425
|
+
member.gender.id = user.personalData.gender;
|
|
426
|
+
member.birthDate = reformatDate(user.personalData.birthDate);
|
|
427
|
+
member.genderName = user.personalData.genderName;
|
|
428
|
+
member.lastName = user.personalData.lastName;
|
|
429
|
+
member.longName = user.personalData.longName;
|
|
430
|
+
member.middleName = user.personalData.middleName ? user.personalData.middleName : '';
|
|
431
|
+
member.firstName = user.personalData.firstName;
|
|
432
|
+
member.id = user.personalData.id;
|
|
433
|
+
member.type = user.personalData.type;
|
|
434
|
+
member.registrationDate = user.personalData.registrationDate;
|
|
435
|
+
// Save User Documents Data
|
|
436
|
+
if ('documents' in user && user.documents.length) {
|
|
437
|
+
const documentType = this.documentTypes.find(i => i.ids === user.documents[0].type);
|
|
438
|
+
const documentIssuer = this.documentIssuers.find(i => i.nameRu === user.documents[0].issuerNameRu);
|
|
439
|
+
member.documentType = documentType ? documentType : new Value();
|
|
440
|
+
member.documentNumber = user.documents[0].number;
|
|
441
|
+
member.documentIssuers = documentIssuer ? documentIssuer : new Value();
|
|
442
|
+
member.documentDate = reformatDate(user.documents[0].issueDate);
|
|
443
|
+
member.documentExpire = reformatDate(user.documents[0].expireDate);
|
|
444
|
+
}
|
|
445
|
+
// Document detail (residency, economy code, etc..)
|
|
446
|
+
if ('data' in user && user.data.length) {
|
|
447
|
+
user.data.forEach(dataObject => {
|
|
448
|
+
this.searchFromList(member, dataObject);
|
|
449
|
+
});
|
|
506
450
|
}
|
|
507
|
-
if (
|
|
508
|
-
|
|
509
|
-
this.
|
|
510
|
-
this.
|
|
511
|
-
this.
|
|
512
|
-
this.
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
user.data.forEach(dataObject => {
|
|
539
|
-
this.searchFromList(whichForm, dataObject, whichIndex);
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
if ('address' in user && user.address.length) {
|
|
543
|
-
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address[0].countryName, 'i')));
|
|
544
|
-
const province = this.states.find(i => i.ids === user.address[0].stateCode);
|
|
545
|
-
const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
|
|
546
|
-
const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
|
|
547
|
-
const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
|
|
548
|
-
this.formStore[whichForm][whichIndex].registrationCountry = country ? country : new Value();
|
|
549
|
-
this.formStore[whichForm][whichIndex].registrationStreet = user.address[0].streetName;
|
|
550
|
-
this.formStore[whichForm][whichIndex].registrationCity = city ? city : new Value();
|
|
551
|
-
this.formStore[whichForm][whichIndex].registrationNumberApartment = user.address[0].apartmentNumber;
|
|
552
|
-
this.formStore[whichForm][whichIndex].registrationNumberHouse = user.address[0].blockNumber;
|
|
553
|
-
this.formStore[whichForm][whichIndex].registrationProvince = province ? province : new Value();
|
|
554
|
-
this.formStore[whichForm][whichIndex].registrationRegionType = localityType ? localityType : new Value();
|
|
555
|
-
this.formStore[whichForm][whichIndex].registrationRegion = region ? region : new Value();
|
|
556
|
-
this.formStore[whichForm][whichIndex].registrationQuarter = user.address[0].kvartal;
|
|
557
|
-
this.formStore[whichForm][whichIndex].registrationMicroDistrict = user.address[0].microRaion;
|
|
558
|
-
}
|
|
559
|
-
if ('contacts' in user && user.contacts.length) {
|
|
560
|
-
user.contacts.forEach(contact => {
|
|
561
|
-
if (contact.type === 'EMAIL' && contact.value) {
|
|
562
|
-
this.formStore[whichForm][whichIndex].email = contact.value;
|
|
563
|
-
}
|
|
564
|
-
if (contact.type === 'MOBILE' && contact.value) {
|
|
565
|
-
let phoneNumber = contact.value.substring(1);
|
|
566
|
-
this.formStore[whichForm][whichIndex].phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
|
|
567
|
-
}
|
|
568
|
-
if (contact.type === 'HOME' && contact.value) {
|
|
569
|
-
let homePhone = contact.value.substring(1);
|
|
570
|
-
this.formStore[whichForm][whichIndex].homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
-
}
|
|
451
|
+
if ('address' in user && user.address.length) {
|
|
452
|
+
const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address[0].countryName, 'i')));
|
|
453
|
+
const province = this.states.find(i => i.ids === user.address[0].stateCode);
|
|
454
|
+
const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
|
|
455
|
+
const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
|
|
456
|
+
const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
|
|
457
|
+
member.registrationCountry = country ? country : new Value();
|
|
458
|
+
member.registrationStreet = user.address[0].streetName;
|
|
459
|
+
member.registrationCity = city ? city : new Value();
|
|
460
|
+
member.registrationNumberApartment = user.address[0].apartmentNumber;
|
|
461
|
+
member.registrationNumberHouse = user.address[0].blockNumber;
|
|
462
|
+
member.registrationProvince = province ? province : new Value();
|
|
463
|
+
member.registrationRegionType = localityType ? localityType : new Value();
|
|
464
|
+
member.registrationRegion = region ? region : new Value();
|
|
465
|
+
member.registrationQuarter = user.address[0].kvartal;
|
|
466
|
+
member.registrationMicroDistrict = user.address[0].microRaion;
|
|
467
|
+
}
|
|
468
|
+
if ('contacts' in user && user.contacts.length) {
|
|
469
|
+
user.contacts.forEach(contact => {
|
|
470
|
+
if (contact.type === 'EMAIL' && contact.value) {
|
|
471
|
+
member.email = contact.value;
|
|
472
|
+
}
|
|
473
|
+
if (contact.type === 'MOBILE' && contact.value) {
|
|
474
|
+
let phoneNumber = contact.value.substring(1);
|
|
475
|
+
member.phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
|
|
476
|
+
}
|
|
477
|
+
if (contact.type === 'HOME' && contact.value) {
|
|
478
|
+
let homePhone = contact.value.substring(1);
|
|
479
|
+
member.homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
|
|
480
|
+
}
|
|
481
|
+
});
|
|
574
482
|
}
|
|
575
483
|
},
|
|
576
484
|
async alreadyInInsis(iin, firstName, lastName, middleName) {
|
|
@@ -882,6 +790,8 @@ export const useDataStore = defineStore('data', {
|
|
|
882
790
|
data.position = member.jobPosition;
|
|
883
791
|
data.jobName = member.jobPlace;
|
|
884
792
|
data.familyStatusId = member.familyStatus.id;
|
|
793
|
+
data.relationId = member.relationDegree.ids;
|
|
794
|
+
data.relationName = member.relationDegree.nameRu;
|
|
885
795
|
}
|
|
886
796
|
if (whichMember === 'Beneficiary') {
|
|
887
797
|
if (
|
|
@@ -921,7 +831,7 @@ export const useDataStore = defineStore('data', {
|
|
|
921
831
|
return ErrorHandler(err, err.response?.data?.errors && Object.values(err.response?.data?.errors).join(' -> '));
|
|
922
832
|
}
|
|
923
833
|
},
|
|
924
|
-
searchFromList(
|
|
834
|
+
searchFromList(member, searchIt) {
|
|
925
835
|
const getQuestionariesData = () => {
|
|
926
836
|
switch (searchIt.questId) {
|
|
927
837
|
case '500003':
|
|
@@ -944,11 +854,7 @@ export const useDataStore = defineStore('data', {
|
|
|
944
854
|
const [searchFrom, whichField] = getQuestionariesData();
|
|
945
855
|
if (searchFrom && searchFrom.length) {
|
|
946
856
|
const result = searchFrom.find(i => i.ids === searchIt.questAnswer);
|
|
947
|
-
|
|
948
|
-
this.formStore[whichForm][whichField] = result ? result : new Value();
|
|
949
|
-
} else {
|
|
950
|
-
this.formStore[whichForm][whichIndex][whichField] = result ? result : new Value();
|
|
951
|
-
}
|
|
857
|
+
member[whichField] = result ? result : new Value();
|
|
952
858
|
}
|
|
953
859
|
},
|
|
954
860
|
async setSurvey(data) {
|
|
@@ -1598,6 +1504,8 @@ export const useDataStore = defineStore('data', {
|
|
|
1598
1504
|
this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
|
|
1599
1505
|
if (insuredData && insuredData.length) {
|
|
1600
1506
|
insuredData.forEach((each, index) => {
|
|
1507
|
+
const relationDegree = this.relations.find(i => i.ids == each.relationId);
|
|
1508
|
+
this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
|
|
1601
1509
|
this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
|
|
1602
1510
|
});
|
|
1603
1511
|
}
|
|
@@ -2154,12 +2062,12 @@ export const useDataStore = defineStore('data', {
|
|
|
2154
2062
|
this.isLoading = false;
|
|
2155
2063
|
}
|
|
2156
2064
|
},
|
|
2157
|
-
async getContragentFromGBDFL(
|
|
2065
|
+
async getContragentFromGBDFL(member) {
|
|
2158
2066
|
this.isLoading = true;
|
|
2159
2067
|
try {
|
|
2160
2068
|
const data = {
|
|
2161
|
-
iin: iin.replace(/-/g, ''),
|
|
2162
|
-
phoneNumber: formatPhone(phoneNumber),
|
|
2069
|
+
iin: member.iin.replace(/-/g, ''),
|
|
2070
|
+
phoneNumber: formatPhone(member.phoneNumber),
|
|
2163
2071
|
};
|
|
2164
2072
|
const gbdResponse = await this.api.getContragentFromGBDFL(data);
|
|
2165
2073
|
if (gbdResponse.status === 'soap:Server') {
|
|
@@ -2183,284 +2091,145 @@ export const useDataStore = defineStore('data', {
|
|
|
2183
2091
|
}
|
|
2184
2092
|
const { person } = parseXML(gbdResponse.content, true, 'person');
|
|
2185
2093
|
const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
|
|
2186
|
-
if (
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
}
|
|
2195
|
-
this.formStore[whichForm][whichIndex].gosPersonData = person;
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
|
-
await this.getContragent(typeof whichIndex === 'number' ? this.formStore[whichForm][whichIndex] : this.formStore[whichForm], whichForm, whichIndex, false);
|
|
2199
|
-
if (typeof whichIndex !== 'number') {
|
|
2200
|
-
this.formStore[whichForm].verifyDate = responseInfo.responseDate;
|
|
2201
|
-
this.formStore[whichForm].verifyType = 'GBDFL';
|
|
2202
|
-
} else {
|
|
2203
|
-
this.formStore[whichForm][whichIndex].verifyDate = responseInfo.responseDate;
|
|
2204
|
-
this.formStore[whichForm][whichIndex].verifyType = 'GBDFL';
|
|
2205
|
-
}
|
|
2206
|
-
await this.saveInStoreUserGBDFL(person, whichForm, whichIndex);
|
|
2094
|
+
if (member.gosPersonData !== null && member.gosPersonData.iin !== iin.replace(/-/g, '')) {
|
|
2095
|
+
member.resetMember(false);
|
|
2096
|
+
}
|
|
2097
|
+
member.gosPersonData = person;
|
|
2098
|
+
await this.getContragent(member, false);
|
|
2099
|
+
member.verifyDate = responseInfo.responseDate;
|
|
2100
|
+
member.verifyType = 'GBDFL';
|
|
2101
|
+
await this.saveInStoreUserGBDFL(person, member);
|
|
2207
2102
|
} catch (err) {
|
|
2208
2103
|
ErrorHandler(err);
|
|
2209
2104
|
}
|
|
2210
2105
|
this.isLoading = false;
|
|
2211
2106
|
},
|
|
2212
|
-
async saveInStoreUserGBDFL(person,
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
if (
|
|
2237
|
-
|
|
2238
|
-
|
|
2107
|
+
async saveInStoreUserGBDFL(person, member) {
|
|
2108
|
+
member.firstName = person.name;
|
|
2109
|
+
member.lastName = person.surname;
|
|
2110
|
+
member.middleName = person.patronymic ? person.patronymic : '';
|
|
2111
|
+
member.longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
|
|
2112
|
+
member.birthDate = reformatDate(person.birthDate);
|
|
2113
|
+
member.genderName = person.gender.nameRu;
|
|
2114
|
+
|
|
2115
|
+
const gender = this.gender.find(i => i.id == person.gender.code);
|
|
2116
|
+
if (gender) member.gender = gender;
|
|
2117
|
+
|
|
2118
|
+
const birthPlace = this.countries.find(i => i.nameRu.match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
2119
|
+
if (birthPlace) member.birthPlace = birthPlace;
|
|
2120
|
+
|
|
2121
|
+
const countryOfCitizenship = this.citizenshipCountries.find(i => i.nameRu.match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
2122
|
+
if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
|
|
2123
|
+
|
|
2124
|
+
const regCountry = this.countries.find(i => i.nameRu.match(new RegExp(person.regAddress.country.nameRu, 'i')));
|
|
2125
|
+
if (regCountry) member.registrationCountry = regCountry;
|
|
2126
|
+
|
|
2127
|
+
const regProvince = this.states.find(i => i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')));
|
|
2128
|
+
if (regProvince) member.registrationProvince = regProvince;
|
|
2129
|
+
|
|
2130
|
+
if ('city' in person.regAddress && !!person.regAddress.city) {
|
|
2131
|
+
if (person.regAddress.city.includes(', ')) {
|
|
2132
|
+
const personCities = person.regAddress.city.split(', ');
|
|
2133
|
+
for (let i = 0; i < personCities.length; ++i) {
|
|
2134
|
+
const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[i]));
|
|
2135
|
+
if (possibleCity) {
|
|
2136
|
+
member.registrationCity = possibleCity;
|
|
2137
|
+
break;
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
if (member.registrationCity.nameRu === null) {
|
|
2239
2141
|
for (let i = 0; i < personCities.length; ++i) {
|
|
2240
|
-
const
|
|
2241
|
-
if (
|
|
2242
|
-
|
|
2142
|
+
const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
|
|
2143
|
+
if (possibleRegion) {
|
|
2144
|
+
member.registrationRegion = possibleRegion;
|
|
2243
2145
|
break;
|
|
2244
2146
|
}
|
|
2245
2147
|
}
|
|
2246
|
-
if (this.formStore[whichForm].registrationCity.nameRu === null) {
|
|
2247
|
-
for (let i = 0; i < personCities.length; ++i) {
|
|
2248
|
-
const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
|
|
2249
|
-
if (possibleRegion) {
|
|
2250
|
-
this.formStore[whichForm].registrationRegion = possibleRegion;
|
|
2251
|
-
break;
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
}
|
|
2255
|
-
} else {
|
|
2256
|
-
const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
|
|
2257
|
-
if (regCity) this.formStore[whichForm].registrationCity = regCity;
|
|
2258
|
-
|
|
2259
|
-
if (this.formStore[whichForm].registrationCity.nameRu === null) {
|
|
2260
|
-
const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
|
|
2261
|
-
if (regRegion) this.formStore[whichForm].registrationRegion = regRegion;
|
|
2262
|
-
}
|
|
2263
2148
|
}
|
|
2264
|
-
}
|
|
2149
|
+
} else {
|
|
2150
|
+
const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
|
|
2151
|
+
if (regCity) member.registrationCity = regCity;
|
|
2265
2152
|
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
);
|
|
2270
|
-
if (regCity) {
|
|
2271
|
-
this.formStore[whichForm].registrationCity = regCity;
|
|
2272
|
-
const regType = this.localityTypes.find(i => i.nameRu === 'город');
|
|
2273
|
-
if (regType) this.formStore[whichForm].registrationRegionType = regType;
|
|
2274
|
-
} else {
|
|
2275
|
-
const regRegion = this.regions.find(
|
|
2276
|
-
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2277
|
-
);
|
|
2278
|
-
if (regRegion) {
|
|
2279
|
-
this.formStore[whichForm].registrationRegion = regRegion;
|
|
2280
|
-
const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
|
|
2281
|
-
if (regType) this.formStore[whichForm].registrationRegionType = regType;
|
|
2282
|
-
}
|
|
2153
|
+
if (member.registrationCity.nameRu === null) {
|
|
2154
|
+
const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
|
|
2155
|
+
if (regRegion) member.registrationRegion = regRegion;
|
|
2283
2156
|
}
|
|
2284
2157
|
}
|
|
2158
|
+
}
|
|
2285
2159
|
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
if (
|
|
2160
|
+
if (member.registrationCity.nameRu === null && member.registrationRegion.nameRu === null) {
|
|
2161
|
+
const regCity = this.cities.find(
|
|
2162
|
+
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2163
|
+
);
|
|
2164
|
+
if (regCity) {
|
|
2165
|
+
member.registrationCity = regCity;
|
|
2166
|
+
const regType = this.localityTypes.find(i => i.nameRu === 'город');
|
|
2167
|
+
if (regType) member.registrationRegionType = regType;
|
|
2294
2168
|
} else {
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2303
|
-
if (validDocument) {
|
|
2304
|
-
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2305
|
-
if (documentType) this.formStore[whichForm].documentType = documentType;
|
|
2306
|
-
|
|
2307
|
-
this.formStore[whichForm].documentNumber = validDocument.number;
|
|
2308
|
-
this.formStore[whichForm].documentExpire = reformatDate(validDocument.endDate);
|
|
2309
|
-
this.formStore[whichForm].documentDate = reformatDate(validDocument.beginDate);
|
|
2310
|
-
this.formStore[whichForm].documentNumber = validDocument.number;
|
|
2311
|
-
|
|
2312
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2313
|
-
if (documentIssuer) this.formStore[whichForm].documentIssuers = documentIssuer;
|
|
2169
|
+
const regRegion = this.regions.find(
|
|
2170
|
+
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2171
|
+
);
|
|
2172
|
+
if (regRegion) {
|
|
2173
|
+
member.registrationRegion = regRegion;
|
|
2174
|
+
const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
|
|
2175
|
+
if (regType) member.registrationRegionType = regType;
|
|
2314
2176
|
}
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
|
-
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2318
|
-
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2319
|
-
: this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2320
|
-
? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2321
|
-
: new Value();
|
|
2322
|
-
if (documentType) this.formStore[whichForm].documentType = documentType;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2323
2179
|
|
|
2324
|
-
|
|
2325
|
-
|
|
2180
|
+
if (person.regAddress.street.includes(', ')) {
|
|
2181
|
+
const personAddress = person.regAddress.street.split(', ');
|
|
2182
|
+
const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
|
|
2183
|
+
const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
|
|
2184
|
+
const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
|
|
2185
|
+
if (microDistrict) member.registrationMicroDistrict = microDistrict;
|
|
2186
|
+
if (quarter) member.registrationQuarter = quarter;
|
|
2187
|
+
if (street) member.registrationStreet = street;
|
|
2188
|
+
} else {
|
|
2189
|
+
if (person.regAddress.street) member.registrationStreet = person.regAddress.street;
|
|
2190
|
+
}
|
|
2191
|
+
if (person.regAddress.building) member.registrationNumberHouse = person.regAddress.building;
|
|
2192
|
+
if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
|
|
2326
2193
|
|
|
2327
|
-
|
|
2328
|
-
|
|
2194
|
+
// TODO Доработать логику и для остальных
|
|
2195
|
+
if ('length' in person.documents.document) {
|
|
2196
|
+
const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
|
|
2197
|
+
if (validDocument) {
|
|
2198
|
+
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2199
|
+
if (documentType) member.documentType = documentType;
|
|
2329
2200
|
|
|
2330
|
-
|
|
2331
|
-
|
|
2201
|
+
member.documentNumber = validDocument.number;
|
|
2202
|
+
member.documentExpire = reformatDate(validDocument.endDate);
|
|
2203
|
+
member.documentDate = reformatDate(validDocument.beginDate);
|
|
2204
|
+
member.documentNumber = validDocument.number;
|
|
2332
2205
|
|
|
2333
|
-
// TODO уточнить
|
|
2334
2206
|
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2335
|
-
if (documentIssuer)
|
|
2207
|
+
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2336
2208
|
}
|
|
2337
|
-
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2338
|
-
if (economySectorCode) this.formStore[whichForm].economySectorCode = economySectorCode;
|
|
2339
2209
|
} else {
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
const gender = this.gender.find(i => i.id == person.gender.code);
|
|
2348
|
-
if (gender) this.formStore[whichForm][whichIndex].gender = gender;
|
|
2349
|
-
|
|
2350
|
-
const birthPlace = this.countries.find(i => i.nameRu.match(new RegExp(person.birthPlace.country.nameRu, 'i')));
|
|
2351
|
-
if (birthPlace) this.formStore[whichForm][whichIndex].birthPlace = birthPlace;
|
|
2352
|
-
|
|
2353
|
-
const countryOfCitizenship = this.citizenshipCountries.find(i => i.nameRu.match(new RegExp(person.citizenship.nameRu, 'i')));
|
|
2354
|
-
if (countryOfCitizenship) this.formStore[whichForm][whichIndex].countryOfCitizenship = countryOfCitizenship;
|
|
2210
|
+
const documentType =
|
|
2211
|
+
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2212
|
+
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2213
|
+
: this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2214
|
+
? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2215
|
+
: new Value();
|
|
2216
|
+
if (documentType) member.documentType = documentType;
|
|
2355
2217
|
|
|
2356
|
-
const
|
|
2357
|
-
if (
|
|
2218
|
+
const documentNumber = person.documents.document.number;
|
|
2219
|
+
if (documentNumber) member.documentNumber = documentNumber;
|
|
2358
2220
|
|
|
2359
|
-
const
|
|
2360
|
-
if (
|
|
2221
|
+
const documentDate = person.documents.document.beginDate;
|
|
2222
|
+
if (documentDate) member.documentDate = reformatDate(documentDate);
|
|
2361
2223
|
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
const personCities = person.regAddress.city.split(', ');
|
|
2365
|
-
for (let i = 0; i < personCities.length; ++i) {
|
|
2366
|
-
const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[i]));
|
|
2367
|
-
if (possibleCity) {
|
|
2368
|
-
this.formStore[whichForm][whichIndex].registrationCity = possibleCity;
|
|
2369
|
-
break;
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null) {
|
|
2373
|
-
for (let i = 0; i < personCities.length; ++i) {
|
|
2374
|
-
const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
|
|
2375
|
-
if (possibleRegion) {
|
|
2376
|
-
this.formStore[whichForm][whichIndex].registrationRegion = possibleRegion;
|
|
2377
|
-
break;
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
} else {
|
|
2382
|
-
const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
|
|
2383
|
-
if (regCity) this.formStore[whichForm][whichIndex].registrationCity = regCity;
|
|
2384
|
-
if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null) {
|
|
2385
|
-
const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
|
|
2386
|
-
if (regRegion) this.formStore[whichForm][whichIndex].registrationRegion = regRegion;
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null && this.formStore[whichForm][whichIndex].registrationRegion.nameRu === null) {
|
|
2392
|
-
const regCity = this.cities.find(
|
|
2393
|
-
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2394
|
-
);
|
|
2395
|
-
if (regCity) {
|
|
2396
|
-
this.formStore[whichForm][whichIndex].registrationCity = regCity;
|
|
2397
|
-
const regType = this.localityTypes.find(i => i.nameRu === 'город');
|
|
2398
|
-
if (regType) this.formStore[whichForm][whichIndex].registrationRegionType = regType;
|
|
2399
|
-
} else {
|
|
2400
|
-
const regRegion = this.regions.find(
|
|
2401
|
-
i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
|
|
2402
|
-
);
|
|
2403
|
-
if (regRegion) {
|
|
2404
|
-
this.formStore[whichForm][whichIndex].registrationRegion = regRegion;
|
|
2405
|
-
const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
|
|
2406
|
-
if (regType) this.formStore[whichForm][whichIndex].registrationRegionType = regType;
|
|
2407
|
-
}
|
|
2408
|
-
}
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2411
|
-
if (person.regAddress.street.includes(', ')) {
|
|
2412
|
-
const personAddress = person.regAddress.street.split(', ');
|
|
2413
|
-
const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
|
|
2414
|
-
const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
|
|
2415
|
-
const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
|
|
2416
|
-
if (microDistrict) this.formStore[whichForm][whichIndex].registrationMicroDistrict = microDistrict;
|
|
2417
|
-
if (quarter) this.formStore[whichForm][whichIndex].registrationQuarter = quarter;
|
|
2418
|
-
if (street) this.formStore[whichForm][whichIndex].registrationStreet = street;
|
|
2419
|
-
} else {
|
|
2420
|
-
if (person.regAddress.street) this.formStore[whichForm][whichIndex].registrationStreet = person.regAddress.street;
|
|
2421
|
-
}
|
|
2422
|
-
if (person.regAddress.building) this.formStore[whichForm][whichIndex].registrationNumberHouse = person.regAddress.building;
|
|
2423
|
-
if (person.regAddress.flat) this.formStore[whichForm][whichIndex].registrationNumberApartment = person.regAddress.flat;
|
|
2224
|
+
const documentExpire = person.documents.document.endDate;
|
|
2225
|
+
if (documentExpire) member.documentExpire = reformatDate(documentExpire);
|
|
2424
2226
|
|
|
2425
|
-
// TODO
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
if (validDocument) {
|
|
2429
|
-
const documentType = this.documentTypes.find(i => i.ids === '1UDL');
|
|
2430
|
-
if (documentType) this.formStore[whichForm][whichIndex].documentType = documentType;
|
|
2431
|
-
this.formStore[whichForm][whichIndex].documentNumber = validDocument.number;
|
|
2432
|
-
this.formStore[whichForm][whichIndex].documentExpire = reformatDate(validDocument.endDate);
|
|
2433
|
-
this.formStore[whichForm][whichIndex].documentDate = reformatDate(validDocument.beginDate);
|
|
2434
|
-
this.formStore[whichForm][whichIndex].documentNumber = validDocument.number;
|
|
2435
|
-
|
|
2436
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2437
|
-
if (documentIssuer) this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer;
|
|
2438
|
-
}
|
|
2439
|
-
} else {
|
|
2440
|
-
const documentType =
|
|
2441
|
-
person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
|
|
2442
|
-
? this.documentTypes.find(i => i.ids === '1UDL')
|
|
2443
|
-
: this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2444
|
-
? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
|
|
2445
|
-
: new Value();
|
|
2446
|
-
if (documentType) this.formStore[whichForm][whichIndex].documentType = documentType;
|
|
2447
|
-
|
|
2448
|
-
const documentNumber = person.documents.document.number;
|
|
2449
|
-
if (documentNumber) this.formStore[whichForm][whichIndex].documentNumber = documentNumber;
|
|
2450
|
-
|
|
2451
|
-
const documentDate = person.documents.document.beginDate;
|
|
2452
|
-
if (documentDate) this.formStore[whichForm][whichIndex].documentDate = reformatDate(documentDate);
|
|
2453
|
-
|
|
2454
|
-
const documentExpire = person.documents.document.endDate;
|
|
2455
|
-
if (documentExpire) this.formStore[whichForm][whichIndex].documentExpire = reformatDate(documentExpire);
|
|
2456
|
-
|
|
2457
|
-
// TODO уточнить
|
|
2458
|
-
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2459
|
-
if (documentIssuer) this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer;
|
|
2460
|
-
}
|
|
2461
|
-
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2462
|
-
if (economySectorCode) this.formStore[whichForm][whichIndex].economySectorCode = economySectorCode;
|
|
2227
|
+
// TODO уточнить
|
|
2228
|
+
const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
|
|
2229
|
+
if (documentIssuer) member.documentIssuers = documentIssuer;
|
|
2463
2230
|
}
|
|
2231
|
+
const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
|
|
2232
|
+
if (economySectorCode) member.economySectorCode = economySectorCode;
|
|
2464
2233
|
},
|
|
2465
2234
|
hasJobSection(whichForm) {
|
|
2466
2235
|
switch (whichForm) {
|
package/store/member.store.ts
CHANGED
|
@@ -113,23 +113,38 @@ export const useMemberStore = defineStore('members', {
|
|
|
113
113
|
return 'Spokesman';
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
|
+
getMemberApplicationCode(whichForm: MemberKeys) {
|
|
117
|
+
switch (whichForm) {
|
|
118
|
+
case this.formStore.policyholderFormKey:
|
|
119
|
+
return 'clientApp';
|
|
120
|
+
case this.formStore.insuredFormKey:
|
|
121
|
+
return 'insuredApp';
|
|
122
|
+
case this.formStore.beneficiaryFormKey:
|
|
123
|
+
return 'beneficiaryApp';
|
|
124
|
+
case this.formStore.beneficialOwnerFormKey:
|
|
125
|
+
return 'beneficialOwnerApp';
|
|
126
|
+
case this.formStore.policyholdersRepresentativeFormKey:
|
|
127
|
+
return 'spokesmanApp';
|
|
128
|
+
}
|
|
129
|
+
},
|
|
116
130
|
clearMember(whichForm: MemberKeys, whichIndex?: number) {
|
|
117
131
|
if (!whichForm) return false;
|
|
118
132
|
if (!this.isStatementEditible(whichForm)) return false;
|
|
119
133
|
if (!this.validateInitiator()) return false;
|
|
120
134
|
if (whichForm === this.formStore.policyholderFormKey || whichForm === this.formStore.policyholdersRepresentativeFormKey) {
|
|
121
|
-
|
|
135
|
+
//@ts-ignore
|
|
136
|
+
this.formStore[whichForm] = this.getMemberClass(whichForm);
|
|
122
137
|
}
|
|
123
138
|
if (typeof whichIndex === 'number') {
|
|
124
139
|
if (this.formStore[whichForm].length === 1) {
|
|
125
|
-
this.formStore[whichForm][whichIndex].
|
|
140
|
+
this.formStore[whichForm][whichIndex] = this.getMemberClass(whichForm);
|
|
126
141
|
} else {
|
|
127
142
|
this.formStore[whichForm].splice(whichIndex, 1);
|
|
128
143
|
}
|
|
129
144
|
}
|
|
130
145
|
return true;
|
|
131
146
|
},
|
|
132
|
-
async deleteMember(taskId: string, whichForm: MemberKeys, whichIndex?: number) {
|
|
147
|
+
async deleteMember(taskId: string, whichForm: MemberKeys, whichIndex?: number, refetch: boolean = true) {
|
|
133
148
|
if (!whichForm) return false;
|
|
134
149
|
if (!this.isStatementEditible(whichForm)) return false;
|
|
135
150
|
if (!this.validateInitiator()) return false;
|
|
@@ -144,13 +159,88 @@ export const useMemberStore = defineStore('members', {
|
|
|
144
159
|
} else {
|
|
145
160
|
if (memberData) await this.dataStore.api.deleteMember(memberCode, memberData.id as number);
|
|
146
161
|
}
|
|
147
|
-
if (memberData) await this.dataStore.getApplicationData(taskId, true, true, true, false);
|
|
162
|
+
if (memberData && refetch) await this.dataStore.getApplicationData(taskId, true, true, true, false);
|
|
148
163
|
return this.clearMember(whichForm, whichIndex);
|
|
149
164
|
} catch (err) {
|
|
150
165
|
console.log(err);
|
|
151
166
|
return ErrorHandler(err);
|
|
152
167
|
}
|
|
153
168
|
},
|
|
169
|
+
async transferPolicyholder(to: MemberKeys) {
|
|
170
|
+
if (!to) return false;
|
|
171
|
+
if (!this.validateInitiator()) return false;
|
|
172
|
+
const fromMember = this.formStore.policyholderForm;
|
|
173
|
+
const successTranser = ref<boolean>(false);
|
|
174
|
+
const toIndex = ref<number | null>(null);
|
|
175
|
+
const taskId = useRoute().params.taskId as string;
|
|
176
|
+
|
|
177
|
+
if (this.dataStore.members[this.getMemberApplicationCode(to)!].isMultiple === false) {
|
|
178
|
+
if (this.formStore[to][0].id !== 0 && this.formStore[to][0].iin !== fromMember.iin) {
|
|
179
|
+
await this.deleteMember(taskId, to, 0, false);
|
|
180
|
+
}
|
|
181
|
+
this.formStore[to][0] = fromMember;
|
|
182
|
+
toIndex.value = 0;
|
|
183
|
+
successTranser.value = true;
|
|
184
|
+
} else {
|
|
185
|
+
if (this.formStore[to].every((member: Member) => member.id !== 0)) {
|
|
186
|
+
this.formStore[to].push(fromMember);
|
|
187
|
+
toIndex.value = this.formStore[to].length - 1;
|
|
188
|
+
successTranser.value = true;
|
|
189
|
+
} else {
|
|
190
|
+
const index = this.formStore[to].findIndex((member: Member) => member.id === 0);
|
|
191
|
+
if (index !== -1) {
|
|
192
|
+
this.formStore[to][index] = fromMember;
|
|
193
|
+
toIndex.value = index;
|
|
194
|
+
successTranser.value = true;
|
|
195
|
+
} else {
|
|
196
|
+
this.formStore[to].push(fromMember);
|
|
197
|
+
toIndex.value = this.formStore[to].length - 1;
|
|
198
|
+
successTranser.value = true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (successTranser.value === true) {
|
|
204
|
+
if (toIndex.value !== null && taskId !== '0' && this.formStore.applicationData.processInstanceId !== 0) {
|
|
205
|
+
const hasSaved = await this.dataStore.saveMember(this.formStore[to][toIndex.value], this.getMemberCode(to), this.getMemberFromApplication(to, toIndex.value));
|
|
206
|
+
if (hasSaved) {
|
|
207
|
+
await this.dataStore.getApplicationData(taskId, false, true, true, false);
|
|
208
|
+
this.dataStore.showToaster('success', this.dataStore.t('toaster.successSaved'));
|
|
209
|
+
this.dataStore.showToaster('warning', this.dataStore.t('toaster.formFieldEmptyWarning'), 3000);
|
|
210
|
+
return true;
|
|
211
|
+
} else {
|
|
212
|
+
this.dataStore.showToaster('error', this.dataStore.t('error.memberSave'));
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
} else {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
this.dataStore.showToaster('error', this.dataStore.t('error.memberCopy'));
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
async retransferPolicyholder(from: MemberKeys) {
|
|
224
|
+
if (!from) return false;
|
|
225
|
+
if (!this.validateInitiator()) return false;
|
|
226
|
+
const client = this.formStore.policyholderForm;
|
|
227
|
+
const index = this.formStore[from].findIndex((member: Member) => member.id === client.id);
|
|
228
|
+
const taskId = useRoute().params.taskId as string;
|
|
229
|
+
if (index !== -1) {
|
|
230
|
+
const fromCode = this.getMemberApplicationCode(from);
|
|
231
|
+
const fromMember = this.formStore[from][index];
|
|
232
|
+
const applicationList = this.formStore.applicationData[fromCode!];
|
|
233
|
+
const fromIndex = applicationList && applicationList.length ? applicationList.findIndex((member: any) => member.insisId === fromMember.id) : null;
|
|
234
|
+
if (fromMember.id !== 0 && fromIndex !== -1) {
|
|
235
|
+
await this.deleteMember(taskId, from, index);
|
|
236
|
+
} else {
|
|
237
|
+
this.clearMember(from, index);
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
// @ts-ignore
|
|
241
|
+
this.formStore[from] = [this.getMemberClass(from)];
|
|
242
|
+
}
|
|
243
|
+
},
|
|
154
244
|
addMember(whichForm: MemberKeys) {
|
|
155
245
|
if (!whichForm) return false;
|
|
156
246
|
if (!this.isStatementEditible(whichForm)) return false;
|