hl-core 0.0.8-beta.7 → 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.
@@ -31,6 +31,7 @@ export const useDataStore = defineStore('data', {
31
31
  }),
32
32
  getters: {
33
33
  isEFO: state => state.product === 'efo',
34
+ isAML: state => state.product === 'aml',
34
35
  isBaiterek: state => state.product === 'baiterek',
35
36
  isBolashak: state => state.product === 'bolashak',
36
37
  isMycar: state => state.product === 'mycar',
@@ -39,6 +40,7 @@ export const useDataStore = defineStore('data', {
39
40
  isPension: state => state.product === 'pension',
40
41
  isGons: state => state.product === 'gons',
41
42
  isKazyna: state => state.product === 'halykkazyna',
43
+ isComplianceWindow: state => state.product === 'compliance',
42
44
  isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
43
45
  },
44
46
  actions: {
@@ -63,7 +65,7 @@ export const useDataStore = defineStore('data', {
63
65
  },
64
66
  copyToClipboard(text) {
65
67
  if (typeof text === 'string' || typeof text === 'number') {
66
- if (this.isEFO) {
68
+ if (this.isEFO || this.isAML) {
67
69
  navigator.clipboard.writeText(text);
68
70
  } else {
69
71
  this.sendToParent(constants.postActions.clipboard, text);
@@ -116,7 +118,7 @@ export const useDataStore = defineStore('data', {
116
118
  this.isCompliance() ||
117
119
  this.isAnalyst() ||
118
120
  this.isUpk() ||
119
- this.isFinanceCenter() ||
121
+ this.isFinCenter() ||
120
122
  this.isSupervisor() ||
121
123
  this.isSupport();
122
124
  if (hasPermission) {
@@ -197,8 +199,8 @@ export const useDataStore = defineStore('data', {
197
199
  isSupport() {
198
200
  return this.isRole(constants.roles.support);
199
201
  },
200
- isFinanceCenter() {
201
- return this.isRole(constants.roles.financeCenter);
202
+ isFinCenter() {
203
+ return this.isRole(constants.roles.finCenter);
202
204
  },
203
205
  isSupervisor() {
204
206
  return this.isRole(constants.roles.supervisor);
@@ -304,7 +306,7 @@ export const useDataStore = defineStore('data', {
304
306
  }
305
307
  }
306
308
  },
307
- async getContragent(member, whichForm, whichIndex, load = true) {
309
+ async getContragent(member, load = true) {
308
310
  if (load) {
309
311
  this.isLoading = true;
310
312
  }
@@ -319,10 +321,10 @@ export const useDataStore = defineStore('data', {
319
321
  response = await this.api.getContragent(queryData);
320
322
  if (response.totalItems > 0) {
321
323
  if (response.totalItems.length === 1) {
322
- await this.serializeContragentData(whichForm, response.items[0], whichIndex);
324
+ await this.serializeContragentData(member, response.items[0]);
323
325
  } else {
324
326
  const sortedByRegistrationDate = response.items.sort((left, right) => new Date(right.registrationDate) - new Date(left.registrationDate));
325
- await this.serializeContragentData(whichForm, sortedByRegistrationDate[0], whichIndex);
327
+ await this.serializeContragentData(member, sortedByRegistrationDate[0]);
326
328
  }
327
329
  member.gotFromInsis = true;
328
330
  } else {
@@ -340,14 +342,15 @@ export const useDataStore = defineStore('data', {
340
342
  this.isLoading = true;
341
343
  }
342
344
  try {
345
+ const member = whichIndex === null ? this.formStore[whichForm] : this.formStore[whichForm][whichIndex];
343
346
  if (this.isMycar && this.isAgentMycar() && whichForm === this.formStore.beneficiaryFormKey) {
344
- await this.serializeContragentData(whichForm, this.formStore.applicationData.beneficiaryApp[0], whichIndex);
347
+ await this.serializeContragentData(member, this.formStore.applicationData.beneficiaryApp[0]);
345
348
  this.isLoading = false;
346
349
  return;
347
350
  }
348
351
  const response = await this.api.getContragentById(id);
349
352
  if (response.totalItems > 0) {
350
- await this.serializeContragentData(whichForm, response.items[0], whichIndex);
353
+ await this.serializeContragentData(member, response.items[0]);
351
354
  } else {
352
355
  this.isLoading = false;
353
356
  return false;
@@ -359,58 +362,35 @@ export const useDataStore = defineStore('data', {
359
362
  this.isLoading = false;
360
363
  }
361
364
  },
362
- async serializeContragentData(whichForm, contragent, whichIndex = null) {
365
+ async serializeContragentData(member, contragent) {
363
366
  const [{ value: data }, { value: contacts }, { value: documents }, { value: address }] = await Promise.allSettled([
364
367
  this.api.getContrAgentData(contragent.id),
365
368
  this.api.getContrAgentContacts(contragent.id),
366
369
  this.api.getContrAgentDocuments(contragent.id),
367
370
  this.api.getContrAgentAddress(contragent.id),
368
371
  ]);
369
- if (whichIndex === null) {
370
- this.formStore[whichForm].response = {
371
- contragent: contragent,
372
- };
373
- if (data && data.length) {
374
- this.formStore[whichForm].response.questionnaires = data;
375
- }
376
- if (contacts && contacts.length) {
377
- this.formStore[whichForm].response.contacts = contacts;
378
- }
379
- if (documents && documents.length) {
380
- this.formStore[whichForm].response.documents = documents;
381
- }
382
- if (address && address.length) {
383
- this.formStore[whichForm].response.addresses = address;
384
- }
372
+ member.response = {
373
+ contragent: contragent,
374
+ };
375
+ if (data && data.length) {
376
+ member.response.questionnaires = data;
385
377
  }
386
- if (whichIndex !== null) {
387
- this.formStore[whichForm][whichIndex].response = {
388
- contragent: contragent,
389
- };
390
- if (data && data.length) {
391
- this.formStore[whichForm][whichIndex].response.questionnaires = data;
392
- }
393
- if (contacts && contacts.length) {
394
- this.formStore[whichForm][whichIndex].response.contacts = contacts;
395
- }
396
- if (documents && documents.length) {
397
- this.formStore[whichForm][whichIndex].response.documents = documents;
398
- }
399
- if (address && address.length) {
400
- this.formStore[whichForm][whichIndex].response.addresses = address;
401
- }
402
- }
403
- this.parseContragent(
404
- whichForm,
405
- {
406
- personalData: contragent,
407
- documents: documents,
408
- contacts: contacts,
409
- data: data,
410
- address: address,
411
- },
412
- whichIndex,
413
- );
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
+ });
414
394
  },
415
395
  async searchContragent(iin) {
416
396
  this.isLoading = true;
@@ -433,142 +413,72 @@ export const useDataStore = defineStore('data', {
433
413
  }
434
414
  this.isLoading = false;
435
415
  },
436
- parseContragent(whichForm, user, whichIndex = null) {
437
- if (whichIndex === null) {
438
- // Save User Personal Data
439
- this.formStore[whichForm].verifyType = user.personalData.verifyType;
440
- this.formStore[whichForm].verifyDate = user.personalData.verifyDate;
441
- this.formStore[whichForm].iin = reformatIin(user.personalData.iin);
442
- this.formStore[whichForm].age = user.personalData.age;
443
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
444
- this.formStore[whichForm].birthPlace = country && Object.keys(country).length ? country : new Value();
445
- this.formStore[whichForm].gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
446
- this.formStore[whichForm].gender.id = user.personalData.gender;
447
- this.formStore[whichForm].birthDate = reformatDate(user.personalData.birthDate);
448
- this.formStore[whichForm].genderName = user.personalData.genderName;
449
- this.formStore[whichForm].lastName = user.personalData.lastName;
450
- this.formStore[whichForm].longName = user.personalData.longName;
451
- this.formStore[whichForm].middleName = user.personalData.middleName ? user.personalData.middleName : '';
452
- this.formStore[whichForm].firstName = user.personalData.firstName;
453
- this.formStore[whichForm].id = user.personalData.id;
454
- this.formStore[whichForm].type = user.personalData.type;
455
- this.formStore[whichForm].registrationDate = user.personalData.registrationDate;
456
- // Save User Documents Data
457
- if ('documents' in user && user.documents.length) {
458
- const documentType = this.documentTypes.find(i => i.ids === user.documents[0].type);
459
- const documentIssuer = this.documentIssuers.find(i => i.nameRu === user.documents[0].issuerNameRu);
460
- this.formStore[whichForm].documentType = documentType ? documentType : new Value();
461
- this.formStore[whichForm].documentNumber = user.documents[0].number;
462
- this.formStore[whichForm].documentIssuers = documentIssuer ? documentIssuer : new Value();
463
- this.formStore[whichForm].documentDate = reformatDate(user.documents[0].issueDate);
464
- this.formStore[whichForm].documentExpire = reformatDate(user.documents[0].expireDate);
465
- }
466
- // Document detail (residency, economy code, etc..)
467
- if ('data' in user && user.data.length) {
468
- user.data.forEach(dataObject => {
469
- this.searchFromList(whichForm, dataObject);
470
- });
471
- }
472
- if ('address' in user && user.address.length) {
473
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address[0].countryName, 'i')));
474
- const province = this.states.find(i => i.ids === user.address[0].stateCode);
475
- const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
476
- const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
477
- const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
478
- this.formStore[whichForm].registrationCountry = country ? country : new Value();
479
- this.formStore[whichForm].registrationStreet = user.address[0].streetName;
480
- this.formStore[whichForm].registrationCity = city ? city : new Value();
481
- this.formStore[whichForm].registrationNumberApartment = user.address[0].apartmentNumber;
482
- this.formStore[whichForm].registrationNumberHouse = user.address[0].blockNumber;
483
- this.formStore[whichForm].registrationProvince = province ? province : new Value();
484
- this.formStore[whichForm].registrationRegionType = localityType ? localityType : new Value();
485
- this.formStore[whichForm].registrationRegion = region ? region : new Value();
486
- this.formStore[whichForm].registrationQuarter = user.address[0].kvartal;
487
- this.formStore[whichForm].registrationMicroDistrict = user.address[0].microRaion;
488
- }
489
- if ('contacts' in user && user.contacts.length) {
490
- user.contacts.forEach(contact => {
491
- if (contact.type === 'EMAIL' && contact.value) {
492
- this.formStore[whichForm].email = contact.value;
493
- }
494
- if (contact.type === 'MOBILE' && contact.value) {
495
- let phoneNumber = contact.value.substring(1);
496
- this.formStore[whichForm].phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
497
- }
498
- if (contact.type === 'HOME' && contact.value) {
499
- let homePhone = contact.value.substring(1);
500
- this.formStore[whichForm].homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
501
- }
502
- });
503
- }
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
+ });
504
450
  }
505
- if (whichIndex !== null) {
506
- // Save User Personal Data
507
- this.formStore[whichForm][whichIndex].iin = reformatIin(user.personalData.iin);
508
- this.formStore[whichForm][whichIndex].verifyType = user.personalData.verifyType;
509
- this.formStore[whichForm][whichIndex].verifyDate = user.personalData.verifyDate;
510
- this.formStore[whichForm][whichIndex].age = user.personalData.age;
511
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
512
- this.formStore[whichForm][whichIndex].birthPlace = country && Object.keys(country).length ? country : new Value();
513
- this.formStore[whichForm][whichIndex].gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
514
- this.formStore[whichForm][whichIndex].gender.id = user.personalData.gender;
515
- this.formStore[whichForm][whichIndex].birthDate = reformatDate(user.personalData.birthDate);
516
- this.formStore[whichForm][whichIndex].genderName = user.personalData.genderName;
517
- this.formStore[whichForm][whichIndex].lastName = user.personalData.lastName;
518
- this.formStore[whichForm][whichIndex].longName = user.personalData.longName;
519
- this.formStore[whichForm][whichIndex].middleName = user.personalData.middleName ? user.personalData.middleName : '';
520
- this.formStore[whichForm][whichIndex].firstName = user.personalData.firstName;
521
- this.formStore[whichForm][whichIndex].id = user.personalData.id;
522
- this.formStore[whichForm][whichIndex].type = user.personalData.type;
523
- this.formStore[whichForm][whichIndex].registrationDate = user.personalData.registrationDate;
524
- // Save User Documents Data
525
- if ('documents' in user && user.documents.length) {
526
- const documentType = this.documentTypes.find(i => i.ids === user.documents[0].type);
527
- const documentIssuer = this.documentIssuers.find(i => i.nameRu === user.documents[0].issuerNameRu);
528
- this.formStore[whichForm][whichIndex].documentType = documentType ? documentType : new Value();
529
- this.formStore[whichForm][whichIndex].documentNumber = user.documents[0].number;
530
- this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer ? documentIssuer : new Value();
531
- this.formStore[whichForm][whichIndex].documentDate = reformatDate(user.documents[0].issueDate);
532
- this.formStore[whichForm][whichIndex].documentExpire = reformatDate(user.documents[0].expireDate);
533
- }
534
- // Document detail (residency, economy code, etc..)
535
- if ('data' in user && user.data.length) {
536
- user.data.forEach(dataObject => {
537
- this.searchFromList(whichForm, dataObject, whichIndex);
538
- });
539
- }
540
- if ('address' in user && user.address.length) {
541
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address[0].countryName, 'i')));
542
- const province = this.states.find(i => i.ids === user.address[0].stateCode);
543
- const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
544
- const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
545
- const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
546
- this.formStore[whichForm][whichIndex].registrationCountry = country ? country : new Value();
547
- this.formStore[whichForm][whichIndex].registrationStreet = user.address[0].streetName;
548
- this.formStore[whichForm][whichIndex].registrationCity = city ? city : new Value();
549
- this.formStore[whichForm][whichIndex].registrationNumberApartment = user.address[0].apartmentNumber;
550
- this.formStore[whichForm][whichIndex].registrationNumberHouse = user.address[0].blockNumber;
551
- this.formStore[whichForm][whichIndex].registrationProvince = province ? province : new Value();
552
- this.formStore[whichForm][whichIndex].registrationRegionType = localityType ? localityType : new Value();
553
- this.formStore[whichForm][whichIndex].registrationRegion = region ? region : new Value();
554
- this.formStore[whichForm][whichIndex].registrationQuarter = user.address[0].kvartal;
555
- this.formStore[whichForm][whichIndex].registrationMicroDistrict = user.address[0].microRaion;
556
- }
557
- if ('contacts' in user && user.contacts.length) {
558
- user.contacts.forEach(contact => {
559
- if (contact.type === 'EMAIL' && contact.value) {
560
- this.formStore[whichForm][whichIndex].email = contact.value;
561
- }
562
- if (contact.type === 'MOBILE' && contact.value) {
563
- let phoneNumber = contact.value.substring(1);
564
- this.formStore[whichForm][whichIndex].phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
565
- }
566
- if (contact.type === 'HOME' && contact.value) {
567
- let homePhone = contact.value.substring(1);
568
- this.formStore[whichForm][whichIndex].homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
569
- }
570
- });
571
- }
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
+ });
572
482
  }
573
483
  },
574
484
  async alreadyInInsis(iin, firstName, lastName, middleName) {
@@ -762,6 +672,8 @@ export const useDataStore = defineStore('data', {
762
672
  verifyDate: user.verifyDate,
763
673
  });
764
674
 
675
+ const checkForNull = value => (value ? value : '');
676
+
765
677
  // ! SaveContragent -> Addresses
766
678
  let addressData = [];
767
679
  addressData.push({
@@ -778,11 +690,14 @@ export const useDataStore = defineStore('data', {
778
690
  streetName: user.registrationStreet,
779
691
  kvartal: user.registrationQuarter,
780
692
  microRaion: user.registrationMicroDistrict,
781
- cityTypeId: Number(user.registrationRegionType.ids),
693
+ cityTypeId: Number(user.registrationRegionType.ids) > 0 ? Number(user.registrationRegionType.ids) : null,
782
694
  cityTypeName: user.registrationRegionType.nameRu,
783
695
  blockNumber: user.registrationNumberHouse,
784
696
  apartmentNumber: user.registrationNumberApartment,
785
- address: `${user.birthPlace.nameRu}, ${user.registrationRegionType.nameRu} ${user.registrationCity.nameRu}, ул. ${user.registrationStreet}, д. ${user.registrationNumberHouse} кв. ${user.registrationNumberApartment}`,
697
+ address: `${checkForNull(user.birthPlace.nameRu)}, ${checkForNull(user.registrationRegionType.nameRu)} ${checkForNull(user.registrationCity.nameRu)}, ул. ${checkForNull(
698
+ user.registrationStreet,
699
+ )}, д. ${checkForNull(user.registrationNumberHouse)} кв. ${checkForNull(user.registrationNumberApartment)}`,
700
+
786
701
  type: 'H',
787
702
  });
788
703
 
@@ -875,6 +790,8 @@ export const useDataStore = defineStore('data', {
875
790
  data.position = member.jobPosition;
876
791
  data.jobName = member.jobPlace;
877
792
  data.familyStatusId = member.familyStatus.id;
793
+ data.relationId = member.relationDegree.ids;
794
+ data.relationName = member.relationDegree.nameRu;
878
795
  }
879
796
  if (whichMember === 'Beneficiary') {
880
797
  if (
@@ -914,7 +831,7 @@ export const useDataStore = defineStore('data', {
914
831
  return ErrorHandler(err, err.response?.data?.errors && Object.values(err.response?.data?.errors).join(' -> '));
915
832
  }
916
833
  },
917
- searchFromList(whichForm, searchIt, whichIndex = null) {
834
+ searchFromList(member, searchIt) {
918
835
  const getQuestionariesData = () => {
919
836
  switch (searchIt.questId) {
920
837
  case '500003':
@@ -937,11 +854,7 @@ export const useDataStore = defineStore('data', {
937
854
  const [searchFrom, whichField] = getQuestionariesData();
938
855
  if (searchFrom && searchFrom.length) {
939
856
  const result = searchFrom.find(i => i.ids === searchIt.questAnswer);
940
- if (whichIndex === null) {
941
- this.formStore[whichForm][whichField] = result ? result : new Value();
942
- } else {
943
- this.formStore[whichForm][whichIndex][whichField] = result ? result : new Value();
944
- }
857
+ member[whichField] = result ? result : new Value();
945
858
  }
946
859
  },
947
860
  async setSurvey(data) {
@@ -1591,6 +1504,8 @@ export const useDataStore = defineStore('data', {
1591
1504
  this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
1592
1505
  if (insuredData && insuredData.length) {
1593
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();
1594
1509
  this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
1595
1510
  });
1596
1511
  }
@@ -1726,6 +1641,7 @@ export const useDataStore = defineStore('data', {
1726
1641
  } catch (err) {
1727
1642
  ErrorHandler(err);
1728
1643
  }
1644
+ break;
1729
1645
  }
1730
1646
  case constants.actions.reject:
1731
1647
  case constants.actions.return:
@@ -1735,7 +1651,7 @@ export const useDataStore = defineStore('data', {
1735
1651
  const sended = await this.sendTask(taskId, action, comment);
1736
1652
  if (!sended) return;
1737
1653
  this.formStore.$reset();
1738
- if (this.isEFO) {
1654
+ if (this.isEFO || this.isAML) {
1739
1655
  await this.router.push({ name: 'Insurance-Product' });
1740
1656
  } else {
1741
1657
  this.sendToParent(constants.postActions.toHomePage, this.t('toaster.successOperation') + 'SUCCESS');
@@ -1743,6 +1659,7 @@ export const useDataStore = defineStore('data', {
1743
1659
  } catch (err) {
1744
1660
  ErrorHandler(err);
1745
1661
  }
1662
+ break;
1746
1663
  }
1747
1664
  }
1748
1665
  this.isButtonsLoading = false;
@@ -2145,12 +2062,12 @@ export const useDataStore = defineStore('data', {
2145
2062
  this.isLoading = false;
2146
2063
  }
2147
2064
  },
2148
- async getContragentFromGBDFL(iin, phoneNumber, whichForm, whichIndex) {
2065
+ async getContragentFromGBDFL(member) {
2149
2066
  this.isLoading = true;
2150
2067
  try {
2151
2068
  const data = {
2152
- iin: iin.replace(/-/g, ''),
2153
- phoneNumber: formatPhone(phoneNumber),
2069
+ iin: member.iin.replace(/-/g, ''),
2070
+ phoneNumber: formatPhone(member.phoneNumber),
2154
2071
  };
2155
2072
  const gbdResponse = await this.api.getContragentFromGBDFL(data);
2156
2073
  if (gbdResponse.status === 'soap:Server') {
@@ -2174,284 +2091,145 @@ export const useDataStore = defineStore('data', {
2174
2091
  }
2175
2092
  const { person } = parseXML(gbdResponse.content, true, 'person');
2176
2093
  const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
2177
- if (typeof whichIndex !== 'number') {
2178
- if (this.formStore[whichForm].gosPersonData !== null && this.formStore[whichForm].gosPersonData.iin !== iin.replace(/-/g, '')) {
2179
- this.formStore[whichForm].resetMember(false);
2180
- }
2181
- this.formStore[whichForm].gosPersonData = person;
2182
- } else {
2183
- if (this.formStore[whichForm][whichIndex].gosPersonData !== null && this.formStore[whichForm][whichIndex].gosPersonData.iin !== iin.replace(/-/g, '')) {
2184
- this.formStore[whichForm][whichIndex].resetMember(false);
2185
- }
2186
- this.formStore[whichForm][whichIndex].gosPersonData = person;
2187
- }
2188
-
2189
- await this.getContragent(typeof whichIndex === 'number' ? this.formStore[whichForm][whichIndex] : this.formStore[whichForm], whichForm, whichIndex, false);
2190
- if (typeof whichIndex !== 'number') {
2191
- this.formStore[whichForm].verifyDate = responseInfo.responseDate;
2192
- this.formStore[whichForm].verifyType = 'GBDFL';
2193
- } else {
2194
- this.formStore[whichForm][whichIndex].verifyDate = responseInfo.responseDate;
2195
- this.formStore[whichForm][whichIndex].verifyType = 'GBDFL';
2196
- }
2197
- 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);
2198
2102
  } catch (err) {
2199
2103
  ErrorHandler(err);
2200
2104
  }
2201
2105
  this.isLoading = false;
2202
2106
  },
2203
- async saveInStoreUserGBDFL(person, whichForm, whichIndex = null) {
2204
- if (whichIndex === null) {
2205
- this.formStore[whichForm].firstName = person.name;
2206
- this.formStore[whichForm].lastName = person.surname;
2207
- this.formStore[whichForm].middleName = person.patronymic ? person.patronymic : '';
2208
- this.formStore[whichForm].longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
2209
- this.formStore[whichForm].birthDate = reformatDate(person.birthDate);
2210
- this.formStore[whichForm].genderName = person.gender.nameRu;
2211
-
2212
- const gender = this.gender.find(i => i.id == person.gender.code);
2213
- if (gender) this.formStore[whichForm].gender = gender;
2214
-
2215
- const birthPlace = this.countries.find(i => i.nameRu.match(new RegExp(person.birthPlace.country.nameRu, 'i')));
2216
- if (birthPlace) this.formStore[whichForm].birthPlace = birthPlace;
2217
-
2218
- const countryOfCitizenship = this.citizenshipCountries.find(i => i.nameRu.match(new RegExp(person.citizenship.nameRu, 'i')));
2219
- if (countryOfCitizenship) this.formStore[whichForm].countryOfCitizenship = countryOfCitizenship;
2220
-
2221
- const regCountry = this.countries.find(i => i.nameRu.match(new RegExp(person.regAddress.country.nameRu, 'i')));
2222
- if (regCountry) this.formStore[whichForm].registrationCountry = regCountry;
2223
-
2224
- const regProvince = this.states.find(i => i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')));
2225
- if (regProvince) this.formStore[whichForm].registrationProvince = regProvince;
2226
-
2227
- if ('city' in person.regAddress && !!person.regAddress.city) {
2228
- if (person.regAddress.city.includes(', ')) {
2229
- const personCities = person.regAddress.city.split(', ');
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) {
2230
2141
  for (let i = 0; i < personCities.length; ++i) {
2231
- const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[i]));
2232
- if (possibleCity) {
2233
- this.formStore[whichForm].registrationCity = possibleCity;
2142
+ const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
2143
+ if (possibleRegion) {
2144
+ member.registrationRegion = possibleRegion;
2234
2145
  break;
2235
2146
  }
2236
2147
  }
2237
- if (this.formStore[whichForm].registrationCity.nameRu === null) {
2238
- for (let i = 0; i < personCities.length; ++i) {
2239
- const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
2240
- if (possibleRegion) {
2241
- this.formStore[whichForm].registrationRegion = possibleRegion;
2242
- break;
2243
- }
2244
- }
2245
- }
2246
- } else {
2247
- const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
2248
- if (regCity) this.formStore[whichForm].registrationCity = regCity;
2249
-
2250
- if (this.formStore[whichForm].registrationCity.nameRu === null) {
2251
- const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
2252
- if (regRegion) this.formStore[whichForm].registrationRegion = regRegion;
2253
- }
2254
2148
  }
2255
- }
2149
+ } else {
2150
+ const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
2151
+ if (regCity) member.registrationCity = regCity;
2256
2152
 
2257
- if (this.formStore[whichForm].registrationCity.nameRu === null && this.formStore[whichForm].registrationRegion.nameRu === null) {
2258
- const regCity = this.cities.find(
2259
- i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2260
- );
2261
- if (regCity) {
2262
- this.formStore[whichForm].registrationCity = regCity;
2263
- const regType = this.localityTypes.find(i => i.nameRu === 'город');
2264
- if (regType) this.formStore[whichForm].registrationRegionType = regType;
2265
- } else {
2266
- const regRegion = this.regions.find(
2267
- i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2268
- );
2269
- if (regRegion) {
2270
- this.formStore[whichForm].registrationRegion = regRegion;
2271
- const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
2272
- if (regType) this.formStore[whichForm].registrationRegionType = regType;
2273
- }
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;
2274
2156
  }
2275
2157
  }
2158
+ }
2276
2159
 
2277
- if (person.regAddress.street.includes(', ')) {
2278
- const personAddress = person.regAddress.street.split(', ');
2279
- const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
2280
- const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
2281
- const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
2282
- if (microDistrict) this.formStore[whichForm].registrationMicroDistrict = microDistrict;
2283
- if (quarter) this.formStore[whichForm].registrationQuarter = quarter;
2284
- if (street) this.formStore[whichForm].registrationStreet = street;
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;
2285
2168
  } else {
2286
- if (person.regAddress.street) this.formStore[whichForm].registrationStreet = person.regAddress.street;
2287
- }
2288
- if (person.regAddress.building) this.formStore[whichForm].registrationNumberHouse = person.regAddress.building;
2289
- if (person.regAddress.flat) this.formStore[whichForm].registrationNumberApartment = person.regAddress.flat;
2290
-
2291
- // TODO Доработать логику и для остальных
2292
- if ('length' in person.documents.document) {
2293
- const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
2294
- if (validDocument) {
2295
- const documentType = this.documentTypes.find(i => i.ids === '1UDL');
2296
- if (documentType) this.formStore[whichForm].documentType = documentType;
2297
-
2298
- this.formStore[whichForm].documentNumber = validDocument.number;
2299
- this.formStore[whichForm].documentExpire = reformatDate(validDocument.endDate);
2300
- this.formStore[whichForm].documentDate = reformatDate(validDocument.beginDate);
2301
- this.formStore[whichForm].documentNumber = validDocument.number;
2302
-
2303
- const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
2304
- 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;
2305
2176
  }
2306
- } else {
2307
- const documentType =
2308
- person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
2309
- ? this.documentTypes.find(i => i.ids === '1UDL')
2310
- : this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2311
- ? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2312
- : new Value();
2313
- if (documentType) this.formStore[whichForm].documentType = documentType;
2177
+ }
2178
+ }
2314
2179
 
2315
- const documentNumber = person.documents.document.number;
2316
- if (documentNumber) this.formStore[whichForm].documentNumber = documentNumber;
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;
2317
2193
 
2318
- const documentDate = person.documents.document.beginDate;
2319
- if (documentDate) this.formStore[whichForm].documentDate = reformatDate(documentDate);
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;
2320
2200
 
2321
- const documentExpire = person.documents.document.endDate;
2322
- if (documentExpire) this.formStore[whichForm].documentExpire = reformatDate(documentExpire);
2201
+ member.documentNumber = validDocument.number;
2202
+ member.documentExpire = reformatDate(validDocument.endDate);
2203
+ member.documentDate = reformatDate(validDocument.beginDate);
2204
+ member.documentNumber = validDocument.number;
2323
2205
 
2324
- // TODO уточнить
2325
2206
  const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
2326
- if (documentIssuer) this.formStore[whichForm].documentIssuers = documentIssuer;
2207
+ if (documentIssuer) member.documentIssuers = documentIssuer;
2327
2208
  }
2328
- const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
2329
- if (economySectorCode) this.formStore[whichForm].economySectorCode = economySectorCode;
2330
2209
  } else {
2331
- this.formStore[whichForm][whichIndex].firstName = person.name;
2332
- this.formStore[whichForm][whichIndex].lastName = person.surname;
2333
- this.formStore[whichForm][whichIndex].middleName = person.patronymic ? person.patronymic : '';
2334
- this.formStore[whichForm][whichIndex].longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
2335
- this.formStore[whichForm][whichIndex].birthDate = reformatDate(person.birthDate);
2336
- this.formStore[whichForm][whichIndex].genderName = person.gender.nameRu;
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;
2337
2217
 
2338
- const gender = this.gender.find(i => i.id == person.gender.code);
2339
- if (gender) this.formStore[whichForm][whichIndex].gender = gender;
2218
+ const documentNumber = person.documents.document.number;
2219
+ if (documentNumber) member.documentNumber = documentNumber;
2340
2220
 
2341
- const birthPlace = this.countries.find(i => i.nameRu.match(new RegExp(person.birthPlace.country.nameRu, 'i')));
2342
- if (birthPlace) this.formStore[whichForm][whichIndex].birthPlace = birthPlace;
2221
+ const documentDate = person.documents.document.beginDate;
2222
+ if (documentDate) member.documentDate = reformatDate(documentDate);
2343
2223
 
2344
- const countryOfCitizenship = this.citizenshipCountries.find(i => i.nameRu.match(new RegExp(person.citizenship.nameRu, 'i')));
2345
- if (countryOfCitizenship) this.formStore[whichForm][whichIndex].countryOfCitizenship = countryOfCitizenship;
2224
+ const documentExpire = person.documents.document.endDate;
2225
+ if (documentExpire) member.documentExpire = reformatDate(documentExpire);
2346
2226
 
2347
- const regCountry = this.countries.find(i => i.nameRu.match(new RegExp(person.regAddress.country.nameRu, 'i')));
2348
- if (regCountry) this.formStore[whichForm][whichIndex].registrationCountry = regCountry;
2349
-
2350
- const regProvince = this.states.find(i => i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')));
2351
- if (regProvince) this.formStore[whichForm][whichIndex].registrationProvince = regProvince;
2352
-
2353
- if ('city' in person.regAddress && !!person.regAddress.city) {
2354
- if (person.regAddress.city.includes(', ')) {
2355
- const personCities = person.regAddress.city.split(', ');
2356
- for (let i = 0; i < personCities.length; ++i) {
2357
- const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[i]));
2358
- if (possibleCity) {
2359
- this.formStore[whichForm][whichIndex].registrationCity = possibleCity;
2360
- break;
2361
- }
2362
- }
2363
- if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null) {
2364
- for (let i = 0; i < personCities.length; ++i) {
2365
- const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
2366
- if (possibleRegion) {
2367
- this.formStore[whichForm][whichIndex].registrationRegion = possibleRegion;
2368
- break;
2369
- }
2370
- }
2371
- }
2372
- } else {
2373
- const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
2374
- if (regCity) this.formStore[whichForm][whichIndex].registrationCity = regCity;
2375
- if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null) {
2376
- const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
2377
- if (regRegion) this.formStore[whichForm][whichIndex].registrationRegion = regRegion;
2378
- }
2379
- }
2380
- }
2381
-
2382
- if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null && this.formStore[whichForm][whichIndex].registrationRegion.nameRu === null) {
2383
- const regCity = this.cities.find(
2384
- i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2385
- );
2386
- if (regCity) {
2387
- this.formStore[whichForm][whichIndex].registrationCity = regCity;
2388
- const regType = this.localityTypes.find(i => i.nameRu === 'город');
2389
- if (regType) this.formStore[whichForm][whichIndex].registrationRegionType = regType;
2390
- } else {
2391
- const regRegion = this.regions.find(
2392
- i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2393
- );
2394
- if (regRegion) {
2395
- this.formStore[whichForm][whichIndex].registrationRegion = regRegion;
2396
- const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
2397
- if (regType) this.formStore[whichForm][whichIndex].registrationRegionType = regType;
2398
- }
2399
- }
2400
- }
2401
-
2402
- if (person.regAddress.street.includes(', ')) {
2403
- const personAddress = person.regAddress.street.split(', ');
2404
- const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
2405
- const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
2406
- const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
2407
- if (microDistrict) this.formStore[whichForm][whichIndex].registrationMicroDistrict = microDistrict;
2408
- if (quarter) this.formStore[whichForm][whichIndex].registrationQuarter = quarter;
2409
- if (street) this.formStore[whichForm][whichIndex].registrationStreet = street;
2410
- } else {
2411
- if (person.regAddress.street) this.formStore[whichForm][whichIndex].registrationStreet = person.regAddress.street;
2412
- }
2413
- if (person.regAddress.building) this.formStore[whichForm][whichIndex].registrationNumberHouse = person.regAddress.building;
2414
- if (person.regAddress.flat) this.formStore[whichForm][whichIndex].registrationNumberApartment = person.regAddress.flat;
2415
-
2416
- // TODO Доработать логику и для остальных
2417
- if ('length' in person.documents.document) {
2418
- const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
2419
- if (validDocument) {
2420
- const documentType = this.documentTypes.find(i => i.ids === '1UDL');
2421
- if (documentType) this.formStore[whichForm][whichIndex].documentType = documentType;
2422
- this.formStore[whichForm][whichIndex].documentNumber = validDocument.number;
2423
- this.formStore[whichForm][whichIndex].documentExpire = reformatDate(validDocument.endDate);
2424
- this.formStore[whichForm][whichIndex].documentDate = reformatDate(validDocument.beginDate);
2425
- this.formStore[whichForm][whichIndex].documentNumber = validDocument.number;
2426
-
2427
- const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
2428
- if (documentIssuer) this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer;
2429
- }
2430
- } else {
2431
- const documentType =
2432
- person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
2433
- ? this.documentTypes.find(i => i.ids === '1UDL')
2434
- : this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2435
- ? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2436
- : new Value();
2437
- if (documentType) this.formStore[whichForm][whichIndex].documentType = documentType;
2438
-
2439
- const documentNumber = person.documents.document.number;
2440
- if (documentNumber) this.formStore[whichForm][whichIndex].documentNumber = documentNumber;
2441
-
2442
- const documentDate = person.documents.document.beginDate;
2443
- if (documentDate) this.formStore[whichForm][whichIndex].documentDate = reformatDate(documentDate);
2444
-
2445
- const documentExpire = person.documents.document.endDate;
2446
- if (documentExpire) this.formStore[whichForm][whichIndex].documentExpire = reformatDate(documentExpire);
2447
-
2448
- // TODO уточнить
2449
- const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
2450
- if (documentIssuer) this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer;
2451
- }
2452
- const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
2453
- 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;
2454
2230
  }
2231
+ const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
2232
+ if (economySectorCode) member.economySectorCode = economySectorCode;
2455
2233
  },
2456
2234
  hasJobSection(whichForm) {
2457
2235
  switch (whichForm) {