hl-core 0.0.8-beta.1 → 0.0.8-beta.11

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.
@@ -1,6 +1,6 @@
1
1
  import { defineStore } from 'pinia';
2
- import { t } from './messages';
3
2
  import { rules } from './rules';
3
+ import { i18n } from '@/configs/i18n';
4
4
  import { Toast, Types, Positions, ToastOptions } from './toast';
5
5
  import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
6
6
  import { DataStoreClass, Contragent } from '../composables/classes';
@@ -10,7 +10,7 @@ import { useFormStore } from './form.store';
10
10
  export const useDataStore = defineStore('data', {
11
11
  state: () => ({
12
12
  ...new DataStoreClass(),
13
- t: t,
13
+ t: i18n.t,
14
14
  rules: rules,
15
15
  toast: Toast,
16
16
  toastTypes: Types,
@@ -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',
@@ -38,6 +39,8 @@ export const useDataStore = defineStore('data', {
38
39
  isLiferenta: state => state.product === 'liferenta',
39
40
  isPension: state => state.product === 'pension',
40
41
  isGons: state => state.product === 'gons',
42
+ isKazyna: state => state.product === 'halykkazyna',
43
+ isComplianceWindow: state => state.product === 'compliance',
41
44
  isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
42
45
  },
43
46
  actions: {
@@ -62,7 +65,7 @@ export const useDataStore = defineStore('data', {
62
65
  },
63
66
  copyToClipboard(text) {
64
67
  if (typeof text === 'string' || typeof text === 'number') {
65
- if (this.isEFO) {
68
+ if (this.isEFO || this.isAML) {
66
69
  navigator.clipboard.writeText(text);
67
70
  } else {
68
71
  this.sendToParent(constants.postActions.clipboard, text);
@@ -115,7 +118,7 @@ export const useDataStore = defineStore('data', {
115
118
  this.isCompliance() ||
116
119
  this.isAnalyst() ||
117
120
  this.isUpk() ||
118
- this.isFinanceCenter() ||
121
+ this.isFinCenter() ||
119
122
  this.isSupervisor() ||
120
123
  this.isSupport();
121
124
  if (hasPermission) {
@@ -190,11 +193,14 @@ export const useDataStore = defineStore('data', {
190
193
  isUpk() {
191
194
  return this.isRole(constants.roles.upk);
192
195
  },
196
+ isDrn() {
197
+ return this.isRole(constants.roles.drn);
198
+ },
193
199
  isSupport() {
194
200
  return this.isRole(constants.roles.support);
195
201
  },
196
- isFinanceCenter() {
197
- return this.isRole(constants.roles.financeCenter);
202
+ isFinCenter() {
203
+ return this.isRole(constants.roles.finCenter);
198
204
  },
199
205
  isSupervisor() {
200
206
  return this.isRole(constants.roles.supervisor);
@@ -221,6 +227,7 @@ export const useDataStore = defineStore('data', {
221
227
  const token = localStorage.getItem('accessToken') || null;
222
228
  if (token) {
223
229
  this.$reset();
230
+ this.formStore.$reset();
224
231
  localStorage.clear();
225
232
 
226
233
  if (whichProduct === 'efo') {
@@ -299,7 +306,7 @@ export const useDataStore = defineStore('data', {
299
306
  }
300
307
  }
301
308
  },
302
- async getContragent(member, whichForm, whichIndex, load = true) {
309
+ async getContragent(member, load = true) {
303
310
  if (load) {
304
311
  this.isLoading = true;
305
312
  }
@@ -314,10 +321,10 @@ export const useDataStore = defineStore('data', {
314
321
  response = await this.api.getContragent(queryData);
315
322
  if (response.totalItems > 0) {
316
323
  if (response.totalItems.length === 1) {
317
- await this.serializeContragentData(whichForm, response.items[0], whichIndex);
324
+ await this.serializeContragentData(member, response.items[0]);
318
325
  } else {
319
326
  const sortedByRegistrationDate = response.items.sort((left, right) => new Date(right.registrationDate) - new Date(left.registrationDate));
320
- await this.serializeContragentData(whichForm, sortedByRegistrationDate[0], whichIndex);
327
+ await this.serializeContragentData(member, sortedByRegistrationDate[0]);
321
328
  }
322
329
  member.gotFromInsis = true;
323
330
  } else {
@@ -335,14 +342,15 @@ export const useDataStore = defineStore('data', {
335
342
  this.isLoading = true;
336
343
  }
337
344
  try {
345
+ const member = whichIndex === null ? this.formStore[whichForm] : this.formStore[whichForm][whichIndex];
338
346
  if (this.isMycar && this.isAgentMycar() && whichForm === this.formStore.beneficiaryFormKey) {
339
- await this.serializeContragentData(whichForm, this.formStore.applicationData.beneficiaryApp[0], whichIndex);
347
+ await this.serializeContragentData(member, this.formStore.applicationData.beneficiaryApp[0]);
340
348
  this.isLoading = false;
341
349
  return;
342
350
  }
343
351
  const response = await this.api.getContragentById(id);
344
352
  if (response.totalItems > 0) {
345
- await this.serializeContragentData(whichForm, response.items[0], whichIndex);
353
+ await this.serializeContragentData(member, response.items[0]);
346
354
  } else {
347
355
  this.isLoading = false;
348
356
  return false;
@@ -354,58 +362,35 @@ export const useDataStore = defineStore('data', {
354
362
  this.isLoading = false;
355
363
  }
356
364
  },
357
- async serializeContragentData(whichForm, contragent, whichIndex = null) {
365
+ async serializeContragentData(member, contragent) {
358
366
  const [{ value: data }, { value: contacts }, { value: documents }, { value: address }] = await Promise.allSettled([
359
367
  this.api.getContrAgentData(contragent.id),
360
368
  this.api.getContrAgentContacts(contragent.id),
361
369
  this.api.getContrAgentDocuments(contragent.id),
362
370
  this.api.getContrAgentAddress(contragent.id),
363
371
  ]);
364
- if (whichIndex === null) {
365
- this.formStore[whichForm].response = {
366
- contragent: contragent,
367
- };
368
- if (data && data.length) {
369
- this.formStore[whichForm].response.questionnaires = data;
370
- }
371
- if (contacts && contacts.length) {
372
- this.formStore[whichForm].response.contacts = contacts;
373
- }
374
- if (documents && documents.length) {
375
- this.formStore[whichForm].response.documents = documents;
376
- }
377
- if (address && address.length) {
378
- this.formStore[whichForm].response.addresses = address;
379
- }
372
+ member.response = {
373
+ contragent: contragent,
374
+ };
375
+ if (data && data.length) {
376
+ member.response.questionnaires = data;
380
377
  }
381
- if (whichIndex !== null) {
382
- this.formStore[whichForm][whichIndex].response = {
383
- contragent: contragent,
384
- };
385
- if (data && data.length) {
386
- this.formStore[whichForm][whichIndex].response.questionnaires = data;
387
- }
388
- if (contacts && contacts.length) {
389
- this.formStore[whichForm][whichIndex].response.contacts = contacts;
390
- }
391
- if (documents && documents.length) {
392
- this.formStore[whichForm][whichIndex].response.documents = documents;
393
- }
394
- if (address && address.length) {
395
- this.formStore[whichForm][whichIndex].response.addresses = address;
396
- }
397
- }
398
- this.parseContragent(
399
- whichForm,
400
- {
401
- personalData: contragent,
402
- documents: documents,
403
- contacts: contacts,
404
- data: data,
405
- address: address,
406
- },
407
- whichIndex,
408
- );
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
+ });
409
394
  },
410
395
  async searchContragent(iin) {
411
396
  this.isLoading = true;
@@ -428,142 +413,80 @@ export const useDataStore = defineStore('data', {
428
413
  }
429
414
  this.isLoading = false;
430
415
  },
431
- parseContragent(whichForm, user, whichIndex = null) {
432
- if (whichIndex === null) {
433
- // Save User Personal Data
434
- this.formStore[whichForm].verifyType = user.personalData.verifyType;
435
- this.formStore[whichForm].verifyDate = user.personalData.verifyDate;
436
- this.formStore[whichForm].iin = reformatIin(user.personalData.iin);
437
- this.formStore[whichForm].age = user.personalData.age;
438
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
439
- this.formStore[whichForm].birthPlace = country && Object.keys(country).length ? country : new Value();
440
- this.formStore[whichForm].gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
441
- this.formStore[whichForm].gender.id = user.personalData.gender;
442
- this.formStore[whichForm].birthDate = reformatDate(user.personalData.birthDate);
443
- this.formStore[whichForm].genderName = user.personalData.genderName;
444
- this.formStore[whichForm].lastName = user.personalData.lastName;
445
- this.formStore[whichForm].longName = user.personalData.longName;
446
- this.formStore[whichForm].middleName = user.personalData.middleName ? user.personalData.middleName : '';
447
- this.formStore[whichForm].firstName = user.personalData.firstName;
448
- this.formStore[whichForm].id = user.personalData.id;
449
- this.formStore[whichForm].type = user.personalData.type;
450
- this.formStore[whichForm].registrationDate = user.personalData.registrationDate;
451
- // Save User Documents Data
452
- if ('documents' in user && user.documents.length) {
453
- const documentType = this.documentTypes.find(i => i.ids === user.documents[0].type);
454
- const documentIssuer = this.documentIssuers.find(i => i.nameRu === user.documents[0].issuerNameRu);
455
- this.formStore[whichForm].documentType = documentType ? documentType : new Value();
456
- this.formStore[whichForm].documentNumber = user.documents[0].number;
457
- this.formStore[whichForm].documentIssuers = documentIssuer ? documentIssuer : new Value();
458
- this.formStore[whichForm].documentDate = reformatDate(user.documents[0].issueDate);
459
- this.formStore[whichForm].documentExpire = reformatDate(user.documents[0].expireDate);
460
- }
461
- // Document detail (residency, economy code, etc..)
462
- if ('data' in user && user.data.length) {
463
- user.data.forEach(dataObject => {
464
- this.searchFromList(whichForm, dataObject);
465
- });
466
- }
467
- if ('address' in user && user.address.length) {
468
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address.countryName, 'i')));
469
- const province = this.states.find(i => i.ids === user.address[0].stateCode);
470
- const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
471
- const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
472
- const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
473
- this.formStore[whichForm].registrationCountry = country ? country : new Value();
474
- this.formStore[whichForm].registrationStreet = user.address[0].streetName;
475
- this.formStore[whichForm].registrationCity = city ? city : new Value();
476
- this.formStore[whichForm].registrationNumberApartment = user.address[0].apartmentNumber;
477
- this.formStore[whichForm].registrationNumberHouse = user.address[0].blockNumber;
478
- this.formStore[whichForm].registrationProvince = province ? province : new Value();
479
- this.formStore[whichForm].registrationRegionType = localityType ? localityType : new Value();
480
- this.formStore[whichForm].registrationRegion = region ? region : new Value();
481
- this.formStore[whichForm].registrationQuarter = user.address[0].kvartal;
482
- this.formStore[whichForm].registrationMicroDistrict = user.address[0].microRaion;
483
- }
484
- if ('contacts' in user && user.contacts.length) {
485
- user.contacts.forEach(contact => {
486
- if (contact.type === 'EMAIL' && contact.value) {
487
- this.formStore[whichForm].email = contact.value;
488
- }
489
- if (contact.type === 'MOBILE' && contact.value) {
490
- let phoneNumber = contact.value.substring(1);
491
- this.formStore[whichForm].phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
492
- }
493
- if (contact.type === 'HOME' && contact.value) {
494
- let homePhone = contact.value.substring(1);
495
- this.formStore[whichForm].homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
496
- }
497
- });
498
- }
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
+ member.documentsList = user.documents;
438
+ const documentByPriority = (() => {
439
+ if (this.isLifetrip) {
440
+ return user.documents.find(i => i.type === 'PS');
441
+ }
442
+ return user.documents.find(i => i.type === '1UDL');
443
+ })();
444
+ const userDocument = documentByPriority ? documentByPriority : user.documents[0];
445
+ const documentType = this.documentTypes.find(i => i.ids === userDocument.type);
446
+ const documentIssuer = this.documentIssuers.find(i => i.nameRu === userDocument.issuerNameRu);
447
+ member.documentType = documentType ? documentType : new Value();
448
+ member.documentNumber = userDocument.number;
449
+ member.documentIssuers = documentIssuer ? documentIssuer : new Value();
450
+ member.documentDate = reformatDate(userDocument.issueDate);
451
+ member.documentExpire = reformatDate(userDocument.expireDate);
452
+ }
453
+ // Document detail (residency, economy code, etc..)
454
+ if ('data' in user && user.data.length) {
455
+ user.data.forEach(dataObject => {
456
+ this.searchFromList(member, dataObject);
457
+ });
499
458
  }
500
- if (whichIndex !== null) {
501
- // Save User Personal Data
502
- this.formStore[whichForm][whichIndex].iin = reformatIin(user.personalData.iin);
503
- this.formStore[whichForm][whichIndex].verifyType = user.personalData.verifyType;
504
- this.formStore[whichForm][whichIndex].verifyDate = user.personalData.verifyDate;
505
- this.formStore[whichForm][whichIndex].age = user.personalData.age;
506
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.personalData.birthPlace, 'i')));
507
- this.formStore[whichForm][whichIndex].birthPlace = country && Object.keys(country).length ? country : new Value();
508
- this.formStore[whichForm][whichIndex].gender = this.gender.find(i => i.nameRu === user.personalData.genderName);
509
- this.formStore[whichForm][whichIndex].gender.id = user.personalData.gender;
510
- this.formStore[whichForm][whichIndex].birthDate = reformatDate(user.personalData.birthDate);
511
- this.formStore[whichForm][whichIndex].genderName = user.personalData.genderName;
512
- this.formStore[whichForm][whichIndex].lastName = user.personalData.lastName;
513
- this.formStore[whichForm][whichIndex].longName = user.personalData.longName;
514
- this.formStore[whichForm][whichIndex].middleName = user.personalData.middleName ? user.personalData.middleName : '';
515
- this.formStore[whichForm][whichIndex].firstName = user.personalData.firstName;
516
- this.formStore[whichForm][whichIndex].id = user.personalData.id;
517
- this.formStore[whichForm][whichIndex].type = user.personalData.type;
518
- this.formStore[whichForm][whichIndex].registrationDate = user.personalData.registrationDate;
519
- // Save User Documents Data
520
- if ('documents' in user && user.documents.length) {
521
- const documentType = this.documentTypes.find(i => i.ids === user.documents[0].type);
522
- const documentIssuer = this.documentIssuers.find(i => i.nameRu === user.documents[0].issuerNameRu);
523
- this.formStore[whichForm][whichIndex].documentType = documentType ? documentType : new Value();
524
- this.formStore[whichForm][whichIndex].documentNumber = user.documents[0].number;
525
- this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer ? documentIssuer : new Value();
526
- this.formStore[whichForm][whichIndex].documentDate = reformatDate(user.documents[0].issueDate);
527
- this.formStore[whichForm][whichIndex].documentExpire = reformatDate(user.documents[0].expireDate);
528
- }
529
- // Document detail (residency, economy code, etc..)
530
- if ('data' in user && user.data.length) {
531
- user.data.forEach(dataObject => {
532
- this.searchFromList(whichForm, dataObject, whichIndex);
533
- });
534
- }
535
- if ('address' in user && user.address.length) {
536
- const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address.countryName, 'i')));
537
- const province = this.states.find(i => i.ids === user.address[0].stateCode);
538
- const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
539
- const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
540
- const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
541
- this.formStore[whichForm][whichIndex].registrationCountry = country ? country : new Value();
542
- this.formStore[whichForm][whichIndex].registrationStreet = user.address[0].streetName;
543
- this.formStore[whichForm][whichIndex].registrationCity = city ? city : new Value();
544
- this.formStore[whichForm][whichIndex].registrationNumberApartment = user.address[0].apartmentNumber;
545
- this.formStore[whichForm][whichIndex].registrationNumberHouse = user.address[0].blockNumber;
546
- this.formStore[whichForm][whichIndex].registrationProvince = province ? province : new Value();
547
- this.formStore[whichForm][whichIndex].registrationRegionType = localityType ? localityType : new Value();
548
- this.formStore[whichForm][whichIndex].registrationRegion = region ? region : new Value();
549
- this.formStore[whichForm][whichIndex].registrationQuarter = user.address[0].kvartal;
550
- this.formStore[whichForm][whichIndex].registrationMicroDistrict = user.address[0].microRaion;
551
- }
552
- if ('contacts' in user && user.contacts.length) {
553
- user.contacts.forEach(contact => {
554
- if (contact.type === 'EMAIL' && contact.value) {
555
- this.formStore[whichForm][whichIndex].email = contact.value;
556
- }
557
- if (contact.type === 'MOBILE' && contact.value) {
558
- let phoneNumber = contact.value.substring(1);
559
- this.formStore[whichForm][whichIndex].phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
560
- }
561
- if (contact.type === 'HOME' && contact.value) {
562
- let homePhone = contact.value.substring(1);
563
- this.formStore[whichForm][whichIndex].homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
564
- }
565
- });
566
- }
459
+ if ('address' in user && user.address.length) {
460
+ const country = this.countries.find(i => i.nameRu?.match(new RegExp(user.address[0].countryName, 'i')));
461
+ const province = this.states.find(i => i.ids === user.address[0].stateCode);
462
+ const localityType = this.localityTypes.find(i => i.nameRu === user.address[0].cityTypeName);
463
+ const city = this.cities.find(i => !!user.address[0].cityName && i.nameRu === user.address[0].cityName.replace('г.', ''));
464
+ const region = this.regions.find(i => !!user.address[0].regionCode && i.ids == user.address[0].regionCode);
465
+ member.registrationCountry = country ? country : new Value();
466
+ member.registrationStreet = user.address[0].streetName;
467
+ member.registrationCity = city ? city : new Value();
468
+ member.registrationNumberApartment = user.address[0].apartmentNumber;
469
+ member.registrationNumberHouse = user.address[0].blockNumber;
470
+ member.registrationProvince = province ? province : new Value();
471
+ member.registrationRegionType = localityType ? localityType : new Value();
472
+ member.registrationRegion = region ? region : new Value();
473
+ member.registrationQuarter = user.address[0].kvartal;
474
+ member.registrationMicroDistrict = user.address[0].microRaion;
475
+ }
476
+ if ('contacts' in user && user.contacts.length) {
477
+ user.contacts.forEach(contact => {
478
+ if (contact.type === 'EMAIL' && contact.value) {
479
+ member.email = contact.value;
480
+ }
481
+ if (contact.type === 'MOBILE' && contact.value) {
482
+ let phoneNumber = contact.value.substring(1);
483
+ member.phoneNumber = `+7 (${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)} ${phoneNumber.slice(6, 8)} ${phoneNumber.slice(8)}`;
484
+ }
485
+ if (contact.type === 'HOME' && contact.value) {
486
+ let homePhone = contact.value.substring(1);
487
+ member.homePhone = `+7 (${homePhone.slice(0, 3)}) ${homePhone.slice(3, 6)} ${homePhone.slice(6, 8)} ${homePhone.slice(8)}`;
488
+ }
489
+ });
567
490
  }
568
491
  },
569
492
  async alreadyInInsis(iin, firstName, lastName, middleName) {
@@ -629,7 +552,7 @@ export const useDataStore = defineStore('data', {
629
552
  gender: user.gender.id,
630
553
  genderName: user.genderName ? user.genderName : user.gender.nameRu,
631
554
  birthPlace: user.birthPlace.nameRu,
632
- age: user.age,
555
+ age: Number(user.age),
633
556
  registrationDate: user.registrationDate,
634
557
  verifyType: user.verifyType,
635
558
  verifyDate: user.verifyDate,
@@ -654,7 +577,7 @@ export const useDataStore = defineStore('data', {
654
577
  questName = 'Страна налогового резиденства';
655
578
  }
656
579
  return {
657
- id: 'response' in user && 'questionnaires' in user.response ? user.response.questionnaires?.find(i => i.questId == questionId).id : question.id,
580
+ id: 'response' in user && user.response && 'questionnaires' in user.response ? user.response.questionnaires?.find(i => i.questId == questionId).id : question.id,
658
581
  contragentId: user.id,
659
582
  questAnswer: question.ids,
660
583
  questId: questionId,
@@ -665,7 +588,7 @@ export const useDataStore = defineStore('data', {
665
588
  if (user.countryOfTaxResidency.ids !== '500014.3') {
666
589
  user.addTaxResidency = new Value();
667
590
  }
668
- const addTaxResidency = 'response' in user && 'questionnaires' in user.response && user.response.questionnaires.find(i => i.questId === '507777');
591
+ const addTaxResidency = 'response' in user && user.response && 'questionnaires' in user.response && user.response.questionnaires.find(i => i.questId === '507777');
669
592
  if (user.addTaxResidency.nameRu !== null) {
670
593
  questionariesData.push({
671
594
  id: addTaxResidency ? addTaxResidency.id : 0,
@@ -693,17 +616,21 @@ export const useDataStore = defineStore('data', {
693
616
  if (user.phoneNumber !== '' && user.phoneNumber !== null) {
694
617
  contactsData.push({
695
618
  contragentId: user.id,
696
- id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').id : 0,
619
+ id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').id : 0,
697
620
  newValue: '',
698
621
  note: '',
699
622
  primaryFlag: 'Y',
700
623
  type: 'MOBILE',
701
624
  typeName: 'Сотовый телефон',
702
625
  value: formatPhone(user.phoneNumber),
703
- verifyType: user.otpTokenId ? 'BMG' : 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').verifyType : null,
626
+ verifyType: user.otpTokenId
627
+ ? 'BMG'
628
+ : 'response' in user && user.response && 'contacts' in user.response
629
+ ? user.response.contacts.find(i => i.type === 'MOBILE').verifyType
630
+ : null,
704
631
  verifyDate: user.otpTokenId
705
632
  ? this.currentDate()
706
- : 'response' in user && 'contacts' in user.response
633
+ : 'response' in user && user.response && 'contacts' in user.response
707
634
  ? user.response.contacts.find(i => i.type === 'MOBILE').verifyDate
708
635
  : null,
709
636
  });
@@ -711,19 +638,19 @@ export const useDataStore = defineStore('data', {
711
638
  if (user.email !== '' && user.email !== null) {
712
639
  contactsData.push({
713
640
  contragentId: user.id,
714
- id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').id : 0,
641
+ id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').id : 0,
715
642
  newValue: '',
716
643
  note: '',
717
644
  primaryFlag: 'N',
718
645
  type: 'EMAIL',
719
646
  typeName: 'E-Mail',
720
- value: user.email ? user.email : 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').value : '',
647
+ value: user.email ? user.email : 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').value : '',
721
648
  });
722
649
  }
723
650
  if (user.homePhone !== '' && user.homePhone !== null) {
724
651
  contactsData.push({
725
652
  contragentId: user.id,
726
- id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'HOME').id : 0,
653
+ id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'HOME').id : 0,
727
654
  newValue: '',
728
655
  note: '',
729
656
  primaryFlag: 'N',
@@ -731,17 +658,18 @@ export const useDataStore = defineStore('data', {
731
658
  typeName: 'Домашний телефон',
732
659
  value: user.homePhone
733
660
  ? formatPhone(user.homePhone)
734
- : 'response' in user && 'contacts' in user.response
661
+ : 'response' in user && user.response && 'contacts' in user.response
735
662
  ? user.response.contacts.find(i => i.type === 'HOME').value
736
663
  : '',
737
664
  });
738
665
  }
739
666
 
740
667
  // ! SaveContragent -> Documents
741
- let documentsData = [];
742
- documentsData.push({
668
+ let documentsData = user.documentsList;
669
+ const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
670
+ const userDocument = {
743
671
  contragentId: user.id,
744
- id: 'response' in user && 'documents' in user.response ? user.response.documents[0].id : 0,
672
+ id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
745
673
  description: null,
746
674
  expireDate: user.getDateByKey('documentExpire'),
747
675
  issueDate: user.getDateByKey('documentDate'),
@@ -755,12 +683,18 @@ export const useDataStore = defineStore('data', {
755
683
  serial: null,
756
684
  verifyType: user.verifyType,
757
685
  verifyDate: user.verifyDate,
758
- });
686
+ };
687
+ if (hasAlreadyDocument !== -1) {
688
+ documentsData[hasAlreadyDocument] = userDocument;
689
+ } else {
690
+ documentsData.push(userDocument);
691
+ }
759
692
 
760
693
  // ! SaveContragent -> Addresses
694
+ const checkForNull = value => (value ? value : '');
761
695
  let addressData = [];
762
696
  addressData.push({
763
- id: 'response' in user && 'addresses' in user.response ? user.response.addresses[0].id : 0,
697
+ id: 'response' in user && user.response && 'addresses' in user.response ? user.response.addresses[0].id : 0,
764
698
  contragentId: user.id,
765
699
  countryCode: user.birthPlace.ids,
766
700
  countryName: user.birthPlace.nameRu,
@@ -773,11 +707,13 @@ export const useDataStore = defineStore('data', {
773
707
  streetName: user.registrationStreet,
774
708
  kvartal: user.registrationQuarter,
775
709
  microRaion: user.registrationMicroDistrict,
776
- cityTypeId: Number(user.registrationRegionType.ids),
710
+ cityTypeId: Number(user.registrationRegionType.ids) > 0 ? Number(user.registrationRegionType.ids) : null,
777
711
  cityTypeName: user.registrationRegionType.nameRu,
778
712
  blockNumber: user.registrationNumberHouse,
779
713
  apartmentNumber: user.registrationNumberApartment,
780
- address: `${user.birthPlace.nameRu}, ${user.registrationRegionType.nameRu} ${user.registrationCity.nameRu}, ул. ${user.registrationStreet}, д. ${user.registrationNumberHouse} кв. ${user.registrationNumberApartment}`,
714
+ address: `${checkForNull(user.birthPlace.nameRu)}, ${checkForNull(user.registrationRegionType.nameRu)} ${checkForNull(user.registrationCity.nameRu)}, ул. ${checkForNull(
715
+ user.registrationStreet,
716
+ )}, д. ${checkForNull(user.registrationNumberHouse)} кв. ${checkForNull(user.registrationNumberApartment)}`,
781
717
  type: 'H',
782
718
  });
783
719
 
@@ -870,6 +806,8 @@ export const useDataStore = defineStore('data', {
870
806
  data.position = member.jobPosition;
871
807
  data.jobName = member.jobPlace;
872
808
  data.familyStatusId = member.familyStatus.id;
809
+ data.relationId = member.relationDegree.ids;
810
+ data.relationName = member.relationDegree.nameRu;
873
811
  }
874
812
  if (whichMember === 'Beneficiary') {
875
813
  if (
@@ -909,7 +847,7 @@ export const useDataStore = defineStore('data', {
909
847
  return ErrorHandler(err, err.response?.data?.errors && Object.values(err.response?.data?.errors).join(' -> '));
910
848
  }
911
849
  },
912
- searchFromList(whichForm, searchIt, whichIndex = null) {
850
+ searchFromList(member, searchIt) {
913
851
  const getQuestionariesData = () => {
914
852
  switch (searchIt.questId) {
915
853
  case '500003':
@@ -932,11 +870,7 @@ export const useDataStore = defineStore('data', {
932
870
  const [searchFrom, whichField] = getQuestionariesData();
933
871
  if (searchFrom && searchFrom.length) {
934
872
  const result = searchFrom.find(i => i.ids === searchIt.questAnswer);
935
- if (whichIndex === null) {
936
- this.formStore[whichForm][whichField] = result ? result : new Value();
937
- } else {
938
- this.formStore[whichForm][whichIndex][whichField] = result ? result : new Value();
939
- }
873
+ member[whichField] = result ? result : new Value();
940
874
  }
941
875
  },
942
876
  async setSurvey(data) {
@@ -954,14 +888,20 @@ export const useDataStore = defineStore('data', {
954
888
  async getFromApi(whichField, whichRequest, parameter, reset = false) {
955
889
  const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
956
890
  const currentHour = new Date().getHours();
891
+ const currentMinutePart = Math.ceil((new Date().getMinutes() + 1) / 15);
957
892
 
958
893
  const getDataCondition = () => {
959
894
  if (!storageValue) return true;
960
895
  const hasHourKey = 'hour' in storageValue;
896
+ const hasMiniteKey = 'minute' in storageValue;
961
897
  const hasModeKey = 'mode' in storageValue;
962
898
  const hasValueKey = 'value' in storageValue;
963
- if (storageValue && (hasHourKey === false || hasModeKey === false || hasValueKey === false)) return true;
964
- if (storageValue && (storageValue.hour !== currentHour || storageValue.mode !== import.meta.env.MODE || storageValue.value.length === 0)) return true;
899
+ if (storageValue && (hasHourKey === false || hasMiniteKey === false || hasModeKey === false || hasValueKey === false)) return true;
900
+ if (
901
+ storageValue &&
902
+ (storageValue.hour !== currentHour || storageValue.minute !== currentMinutePart || storageValue.mode !== import.meta.env.MODE || storageValue.value.length === 0)
903
+ )
904
+ return true;
965
905
  };
966
906
  if (!!getDataCondition() || reset === true) {
967
907
  this[whichField] = [];
@@ -973,6 +913,7 @@ export const useDataStore = defineStore('data', {
973
913
  JSON.stringify({
974
914
  value: response,
975
915
  hour: currentHour,
916
+ minute: currentMinutePart,
976
917
  mode: import.meta.env.MODE,
977
918
  }),
978
919
  );
@@ -1043,16 +984,7 @@ export const useDataStore = defineStore('data', {
1043
984
  });
1044
985
  },
1045
986
  async getDicFileTypeList() {
1046
- try {
1047
- if (this.dicFileTypeList.length) {
1048
- return this.dicFileTypeList;
1049
- } else {
1050
- this.dicFileTypeList = await this.api.getDicFileTypeList();
1051
- return this.dicFileTypeList;
1052
- }
1053
- } catch (err) {
1054
- console.log(err.response.data);
1055
- }
987
+ return await this.getFromApi('dicFileTypeList', 'getDicFileTypeList');
1056
988
  },
1057
989
  async getDocumentIssuers() {
1058
990
  return await this.getFromApi('documentIssuers', 'getDocumentIssuers');
@@ -1090,6 +1022,15 @@ export const useDataStore = defineStore('data', {
1090
1022
  async getProcessTariff() {
1091
1023
  return await this.getFromApi('processTariff', 'getProcessTariff');
1092
1024
  },
1025
+ async getCurrencies() {
1026
+ try {
1027
+ const currencies = await this.api.getCurrencies();
1028
+ this.currencies = currencies;
1029
+ return currencies;
1030
+ } catch (err) {
1031
+ console.log(err);
1032
+ }
1033
+ },
1093
1034
  async getAdditionalInsuranceTermsAnswers(questionId) {
1094
1035
  try {
1095
1036
  const answers = await this.api.getAdditionalInsuranceTermsAnswers(this.processCode, questionId);
@@ -1203,6 +1144,9 @@ export const useDataStore = defineStore('data', {
1203
1144
  this.getProcessIndexRate(),
1204
1145
  this.getProcessTariff(),
1205
1146
  this.getProcessPaymentPeriod(),
1147
+ this.getDicFileTypeList(),
1148
+ this.getDictionaryItems('RegionPolicy'),
1149
+ this.getDictionaryItems('SaleChanellPolicy'),
1206
1150
  ]);
1207
1151
  },
1208
1152
  async getUserGroups() {
@@ -1250,15 +1194,12 @@ export const useDataStore = defineStore('data', {
1250
1194
  },
1251
1195
  async searchAgentByName(name) {
1252
1196
  try {
1253
- this.isLoading = true;
1254
- this.AgentDataList = await this.api.searchAgentByName(name);
1255
- if (!this.AgentDataList.length) {
1197
+ this.AgentData = await this.api.searchAgentByName(name);
1198
+ if (!this.AgentData.length) {
1256
1199
  this.showToaster('error', this.t('toaster.notFound'), 1500);
1257
1200
  }
1258
1201
  } catch (err) {
1259
1202
  console.log(err);
1260
- } finally {
1261
- this.isLoading = false;
1262
1203
  }
1263
1204
  },
1264
1205
  async setINSISWorkData() {
@@ -1287,14 +1228,14 @@ export const useDataStore = defineStore('data', {
1287
1228
  this.isLoading = false;
1288
1229
  }
1289
1230
  },
1290
- async filterManagerByRegion(dictName, filterName) {
1231
+ async getDictionaryItems(dictName) {
1232
+ return await this.getFromApi(dictName, 'getDictionaryItems', dictName);
1233
+ },
1234
+ async filterManagerByRegion(filterName) {
1291
1235
  try {
1292
- this.isLoading = true;
1293
- this[`${dictName}List`] = await this.api.filterManagerByRegion(dictName, filterName);
1236
+ this.ManagerPolicy = await this.api.filterManagerByRegion('ManagerPolicy', filterName);
1294
1237
  } catch (err) {
1295
1238
  console.log(err);
1296
- } finally {
1297
- this.isLoading = false;
1298
1239
  }
1299
1240
  },
1300
1241
  async getUnderwritingCouncilData(id) {
@@ -1390,11 +1331,18 @@ export const useDataStore = defineStore('data', {
1390
1331
  paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
1391
1332
  addCovers: this.formStore.additionalInsuranceTermsWithout,
1392
1333
  };
1393
- console.log(calculationData);
1334
+ if (this.isKazyna) {
1335
+ calculationData.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
1336
+ calculationData.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
1337
+ }
1394
1338
  const calculationResponse = await this.api.calculateWithoutApplication(calculationData);
1395
1339
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
1396
1340
  this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
1397
1341
  this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1342
+ if (this.isKazyna) {
1343
+ this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
1344
+ this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
1345
+ }
1398
1346
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1399
1347
  } catch (err) {
1400
1348
  ErrorHandler(err);
@@ -1407,7 +1355,6 @@ export const useDataStore = defineStore('data', {
1407
1355
  this.isLoading = true;
1408
1356
  try {
1409
1357
  let form1 = {
1410
- baiterekApp: null,
1411
1358
  policyAppDto: {
1412
1359
  id: this.formStore.applicationData.policyAppDto.id,
1413
1360
  processInstanceId: this.formStore.applicationData.policyAppDto.processInstanceId,
@@ -1437,7 +1384,10 @@ export const useDataStore = defineStore('data', {
1437
1384
  },
1438
1385
  addCoversDto: this.formStore.additionalInsuranceTerms,
1439
1386
  };
1440
-
1387
+ if (this.isKazyna) {
1388
+ form1.policyAppDto.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
1389
+ form1.policyAppDto.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
1390
+ }
1441
1391
  try {
1442
1392
  let id = this.formStore.applicationData.processInstanceId;
1443
1393
 
@@ -1446,12 +1396,15 @@ export const useDataStore = defineStore('data', {
1446
1396
  try {
1447
1397
  result = await this.api.getCalculation(id);
1448
1398
  } catch (err) {
1449
- this.showToaster('error', err?.response?.data, 5000);
1399
+ ErrorHandler(err);
1450
1400
  }
1451
1401
 
1452
1402
  const applicationData = await this.api.getApplicationData(taskId);
1453
1403
  this.formStore.applicationData = applicationData;
1454
1404
  this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
1405
+ if (this.isKazyna) {
1406
+ this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result / this.currencies.usd);
1407
+ }
1455
1408
  if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
1456
1409
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result);
1457
1410
  } else {
@@ -1459,11 +1412,10 @@ export const useDataStore = defineStore('data', {
1459
1412
  }
1460
1413
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1461
1414
  } catch (err) {
1462
- console.log(err);
1415
+ ErrorHandler(err);
1463
1416
  }
1464
1417
  } catch (err) {
1465
1418
  ErrorHandler(err);
1466
- console.log(err, 'error');
1467
1419
  }
1468
1420
  this.isLoading = false;
1469
1421
  },
@@ -1590,6 +1542,8 @@ export const useDataStore = defineStore('data', {
1590
1542
  this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
1591
1543
  if (insuredData && insuredData.length) {
1592
1544
  insuredData.forEach((each, index) => {
1545
+ const relationDegree = this.relations.find(i => i.ids == each.relationId);
1546
+ this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
1593
1547
  this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
1594
1548
  });
1595
1549
  }
@@ -1652,7 +1606,10 @@ export const useDataStore = defineStore('data', {
1652
1606
  this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
1653
1607
  applicationData.policyAppDto.premium === null ? null : applicationData.policyAppDto.premium,
1654
1608
  );
1655
-
1609
+ if (this.isKazyna) {
1610
+ this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.amountInCurrency);
1611
+ this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(applicationData.policyAppDto.premiumInCurrency);
1612
+ }
1656
1613
  let riskGroup = this.riskGroup.find(item => {
1657
1614
  if (applicationData.policyAppDto.riskGroup == 0) {
1658
1615
  return true;
@@ -1714,6 +1671,7 @@ export const useDataStore = defineStore('data', {
1714
1671
  },
1715
1672
  async handleTask(action, taskId, comment) {
1716
1673
  if (action && Object.keys(constants.actions).includes(action)) {
1674
+ this.isButtonsLoading = true;
1717
1675
  switch (action) {
1718
1676
  case constants.actions.claim: {
1719
1677
  try {
@@ -1724,6 +1682,7 @@ export const useDataStore = defineStore('data', {
1724
1682
  } catch (err) {
1725
1683
  ErrorHandler(err);
1726
1684
  }
1685
+ break;
1727
1686
  }
1728
1687
  case constants.actions.reject:
1729
1688
  case constants.actions.return:
@@ -1733,7 +1692,7 @@ export const useDataStore = defineStore('data', {
1733
1692
  const sended = await this.sendTask(taskId, action, comment);
1734
1693
  if (!sended) return;
1735
1694
  this.formStore.$reset();
1736
- if (this.isEFO) {
1695
+ if (this.isEFO || this.isAML) {
1737
1696
  await this.router.push({ name: 'Insurance-Product' });
1738
1697
  } else {
1739
1698
  this.sendToParent(constants.postActions.toHomePage, this.t('toaster.successOperation') + 'SUCCESS');
@@ -1741,8 +1700,10 @@ export const useDataStore = defineStore('data', {
1741
1700
  } catch (err) {
1742
1701
  ErrorHandler(err);
1743
1702
  }
1703
+ break;
1744
1704
  }
1745
1705
  }
1706
+ this.isButtonsLoading = false;
1746
1707
  } else {
1747
1708
  console.error('No handleTask action');
1748
1709
  }
@@ -1818,10 +1779,18 @@ export const useDataStore = defineStore('data', {
1818
1779
  if (this.formStore.signUrls.length) {
1819
1780
  return this.formStore.signUrls;
1820
1781
  }
1821
- const data = [
1822
- { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Agreement', format: 'pdf' },
1823
- { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Statement', format: 'pdf' },
1824
- ];
1782
+ const prepareSignDocuments = () => {
1783
+ switch (this.formStore.applicationData.statusCode) {
1784
+ case 'ContractSignedFrom':
1785
+ return [{ processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Contract', format: 'pdf' }];
1786
+ default:
1787
+ return [
1788
+ { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Agreement', format: 'pdf' },
1789
+ { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Statement', format: 'pdf' },
1790
+ ];
1791
+ }
1792
+ };
1793
+ const data = prepareSignDocuments();
1825
1794
  const result = await this.api.signDocument(data);
1826
1795
  this.formStore.signUrls = result;
1827
1796
  return this.formStore.signUrls;
@@ -1909,14 +1878,14 @@ export const useDataStore = defineStore('data', {
1909
1878
  const localMembers = [...this.formStore[localKey]].sort((a, b) => a.id - b.id);
1910
1879
  const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.insisId - b.insisId);
1911
1880
  if (localMembers.every((each, index) => applicationMembers[index].insisId === each.id && applicationMembers[index].iin === each.iin.replace(/-/g, '')) === false) {
1912
- this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', text), 3000);
1881
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
1913
1882
  return false;
1914
1883
  }
1915
1884
  if (localKey === this.formStore.beneficiaryFormKey) {
1916
1885
  const sumOfPercentage = localMembers.reduce((sum, member) => {
1917
1886
  return sum + Number(member.percentageOfPayoutAmount);
1918
1887
  }, 0);
1919
- if (sumOfPercentage !== 100) {
1888
+ if (sumOfPercentage !== 100 && this.hasPercentageOfPayoutAmount()) {
1920
1889
  this.showToaster('error', this.t('toaster.errorSumOrPercentage'), 3000);
1921
1890
  return false;
1922
1891
  }
@@ -1924,15 +1893,15 @@ export const useDataStore = defineStore('data', {
1924
1893
  }
1925
1894
  } else {
1926
1895
  if (this.formStore[localKey].some(i => i.iin !== null)) {
1927
- this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', text), 3000);
1896
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
1928
1897
  return false;
1929
1898
  }
1930
1899
  if (this.formStore.applicationData[applicationKey].length !== 0) {
1931
- this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', text), 3000);
1900
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
1932
1901
  return false;
1933
1902
  } else {
1934
1903
  if (this.formStore[localKey][0].iin !== null) {
1935
- this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', text), 3000);
1904
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
1936
1905
  return false;
1937
1906
  }
1938
1907
  }
@@ -1945,7 +1914,7 @@ export const useDataStore = defineStore('data', {
1945
1914
  return false;
1946
1915
  }
1947
1916
  if (this.formStore.policyholderForm.id !== this.formStore.applicationData.clientApp.insisId) {
1948
- this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', 'страхователя'), 3000);
1917
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
1949
1918
  return false;
1950
1919
  }
1951
1920
  if (!this.isGons) {
@@ -1977,7 +1946,7 @@ export const useDataStore = defineStore('data', {
1977
1946
  }
1978
1947
  }
1979
1948
  }
1980
- if (!this.isGons) {
1949
+ if (this.controls.hasAttachment) {
1981
1950
  const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
1982
1951
  if (areValid) {
1983
1952
  await this.setINSISWorkData();
@@ -2142,12 +2111,12 @@ export const useDataStore = defineStore('data', {
2142
2111
  this.isLoading = false;
2143
2112
  }
2144
2113
  },
2145
- async getContragentFromGBDFL(iin, phoneNumber, whichForm, whichIndex) {
2114
+ async getContragentFromGBDFL(member) {
2146
2115
  this.isLoading = true;
2147
2116
  try {
2148
2117
  const data = {
2149
- iin: iin.replace(/-/g, ''),
2150
- phoneNumber: formatPhone(phoneNumber),
2118
+ iin: member.iin.replace(/-/g, ''),
2119
+ phoneNumber: formatPhone(member.phoneNumber),
2151
2120
  };
2152
2121
  const gbdResponse = await this.api.getContragentFromGBDFL(data);
2153
2122
  if (gbdResponse.status === 'soap:Server') {
@@ -2171,284 +2140,145 @@ export const useDataStore = defineStore('data', {
2171
2140
  }
2172
2141
  const { person } = parseXML(gbdResponse.content, true, 'person');
2173
2142
  const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
2174
- if (typeof whichIndex !== 'number') {
2175
- if (this.formStore[whichForm].gosPersonData !== null && this.formStore[whichForm].gosPersonData.iin !== iin.replace(/-/g, '')) {
2176
- this.formStore[whichForm].resetMember(false);
2177
- }
2178
- this.formStore[whichForm].gosPersonData = person;
2179
- } else {
2180
- if (this.formStore[whichForm][whichIndex].gosPersonData !== null && this.formStore[whichForm][whichIndex].gosPersonData.iin !== iin.replace(/-/g, '')) {
2181
- this.formStore[whichForm][whichIndex].resetMember(false);
2182
- }
2183
- this.formStore[whichForm][whichIndex].gosPersonData = person;
2184
- }
2185
-
2186
- await this.getContragent(typeof whichIndex === 'number' ? this.formStore[whichForm][whichIndex] : this.formStore[whichForm], whichForm, whichIndex, false);
2187
- if (typeof whichIndex !== 'number') {
2188
- this.formStore[whichForm].verifyDate = responseInfo.responseDate;
2189
- this.formStore[whichForm].verifyType = 'GBDFL';
2190
- } else {
2191
- this.formStore[whichForm][whichIndex].verifyDate = responseInfo.responseDate;
2192
- this.formStore[whichForm][whichIndex].verifyType = 'GBDFL';
2193
- }
2194
- await this.saveInStoreUserGBDFL(person, whichForm, whichIndex);
2143
+ if (member.gosPersonData !== null && member.gosPersonData.iin !== iin.replace(/-/g, '')) {
2144
+ member.resetMember(false);
2145
+ }
2146
+ member.gosPersonData = person;
2147
+ await this.getContragent(member, false);
2148
+ member.verifyDate = responseInfo.responseDate;
2149
+ member.verifyType = 'GBDFL';
2150
+ await this.saveInStoreUserGBDFL(person, member);
2195
2151
  } catch (err) {
2196
2152
  ErrorHandler(err);
2197
2153
  }
2198
2154
  this.isLoading = false;
2199
2155
  },
2200
- async saveInStoreUserGBDFL(person, whichForm, whichIndex = null) {
2201
- if (whichIndex === null) {
2202
- this.formStore[whichForm].firstName = person.name;
2203
- this.formStore[whichForm].lastName = person.surname;
2204
- this.formStore[whichForm].middleName = person.patronymic ? person.patronymic : '';
2205
- this.formStore[whichForm].longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
2206
- this.formStore[whichForm].birthDate = reformatDate(person.birthDate);
2207
- this.formStore[whichForm].genderName = person.gender.nameRu;
2208
-
2209
- const gender = this.gender.find(i => i.id == person.gender.code);
2210
- if (gender) this.formStore[whichForm].gender = gender;
2211
-
2212
- const birthPlace = this.countries.find(i => i.nameRu.match(new RegExp(person.birthPlace.country.nameRu, 'i')));
2213
- if (birthPlace) this.formStore[whichForm].birthPlace = birthPlace;
2214
-
2215
- const countryOfCitizenship = this.citizenshipCountries.find(i => i.nameRu.match(new RegExp(person.citizenship.nameRu, 'i')));
2216
- if (countryOfCitizenship) this.formStore[whichForm].countryOfCitizenship = countryOfCitizenship;
2217
-
2218
- const regCountry = this.countries.find(i => i.nameRu.match(new RegExp(person.regAddress.country.nameRu, 'i')));
2219
- if (regCountry) this.formStore[whichForm].registrationCountry = regCountry;
2220
-
2221
- const regProvince = this.states.find(i => i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')));
2222
- if (regProvince) this.formStore[whichForm].registrationProvince = regProvince;
2223
-
2224
- if ('city' in person.regAddress && !!person.regAddress.city) {
2225
- if (person.regAddress.city.includes(', ')) {
2226
- const personCities = person.regAddress.city.split(', ');
2156
+ async saveInStoreUserGBDFL(person, member) {
2157
+ member.firstName = person.name;
2158
+ member.lastName = person.surname;
2159
+ member.middleName = person.patronymic ? person.patronymic : '';
2160
+ member.longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
2161
+ member.birthDate = reformatDate(person.birthDate);
2162
+ member.genderName = person.gender.nameRu;
2163
+
2164
+ const gender = this.gender.find(i => i.id == person.gender.code);
2165
+ if (gender) member.gender = gender;
2166
+
2167
+ const birthPlace = this.countries.find(i => i.nameRu.match(new RegExp(person.birthPlace.country.nameRu, 'i')));
2168
+ if (birthPlace) member.birthPlace = birthPlace;
2169
+
2170
+ const countryOfCitizenship = this.citizenshipCountries.find(i => i.nameRu.match(new RegExp(person.citizenship.nameRu, 'i')));
2171
+ if (countryOfCitizenship) member.countryOfCitizenship = countryOfCitizenship;
2172
+
2173
+ const regCountry = this.countries.find(i => i.nameRu.match(new RegExp(person.regAddress.country.nameRu, 'i')));
2174
+ if (regCountry) member.registrationCountry = regCountry;
2175
+
2176
+ const regProvince = this.states.find(i => i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')));
2177
+ if (regProvince) member.registrationProvince = regProvince;
2178
+
2179
+ if ('city' in person.regAddress && !!person.regAddress.city) {
2180
+ if (person.regAddress.city.includes(', ')) {
2181
+ const personCities = person.regAddress.city.split(', ');
2182
+ for (let i = 0; i < personCities.length; ++i) {
2183
+ const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[i]));
2184
+ if (possibleCity) {
2185
+ member.registrationCity = possibleCity;
2186
+ break;
2187
+ }
2188
+ }
2189
+ if (member.registrationCity.nameRu === null) {
2227
2190
  for (let i = 0; i < personCities.length; ++i) {
2228
- const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[i]));
2229
- if (possibleCity) {
2230
- this.formStore[whichForm].registrationCity = possibleCity;
2191
+ const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
2192
+ if (possibleRegion) {
2193
+ member.registrationRegion = possibleRegion;
2231
2194
  break;
2232
2195
  }
2233
2196
  }
2234
- if (this.formStore[whichForm].registrationCity.nameRu === null) {
2235
- for (let i = 0; i < personCities.length; ++i) {
2236
- const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
2237
- if (possibleRegion) {
2238
- this.formStore[whichForm].registrationRegion = possibleRegion;
2239
- break;
2240
- }
2241
- }
2242
- }
2243
- } else {
2244
- const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
2245
- if (regCity) this.formStore[whichForm].registrationCity = regCity;
2246
-
2247
- if (this.formStore[whichForm].registrationCity.nameRu === null) {
2248
- const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
2249
- if (regRegion) this.formStore[whichForm].registrationRegion = regRegion;
2250
- }
2251
2197
  }
2252
- }
2198
+ } else {
2199
+ const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
2200
+ if (regCity) member.registrationCity = regCity;
2253
2201
 
2254
- if (this.formStore[whichForm].registrationCity.nameRu === null && this.formStore[whichForm].registrationRegion.nameRu === null) {
2255
- const regCity = this.cities.find(
2256
- i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2257
- );
2258
- if (regCity) {
2259
- this.formStore[whichForm].registrationCity = regCity;
2260
- const regType = this.localityTypes.find(i => i.nameRu === 'город');
2261
- if (regType) this.formStore[whichForm].registrationRegionType = regType;
2262
- } else {
2263
- const regRegion = this.regions.find(
2264
- i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2265
- );
2266
- if (regRegion) {
2267
- this.formStore[whichForm].registrationRegion = regRegion;
2268
- const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
2269
- if (regType) this.formStore[whichForm].registrationRegionType = regType;
2270
- }
2202
+ if (member.registrationCity.nameRu === null) {
2203
+ const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
2204
+ if (regRegion) member.registrationRegion = regRegion;
2271
2205
  }
2272
2206
  }
2207
+ }
2273
2208
 
2274
- if (person.regAddress.street.includes(', ')) {
2275
- const personAddress = person.regAddress.street.split(', ');
2276
- const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
2277
- const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
2278
- const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
2279
- if (microDistrict) this.formStore[whichForm].registrationMicroDistrict = microDistrict;
2280
- if (quarter) this.formStore[whichForm].registrationQuarter = quarter;
2281
- if (street) this.formStore[whichForm].registrationStreet = street;
2209
+ if (member.registrationCity.nameRu === null && member.registrationRegion.nameRu === null) {
2210
+ const regCity = this.cities.find(
2211
+ i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2212
+ );
2213
+ if (regCity) {
2214
+ member.registrationCity = regCity;
2215
+ const regType = this.localityTypes.find(i => i.nameRu === 'город');
2216
+ if (regType) member.registrationRegionType = regType;
2282
2217
  } else {
2283
- if (person.regAddress.street) this.formStore[whichForm].registrationStreet = person.regAddress.street;
2284
- }
2285
- if (person.regAddress.building) this.formStore[whichForm].registrationNumberHouse = person.regAddress.building;
2286
- if (person.regAddress.flat) this.formStore[whichForm].registrationNumberApartment = person.regAddress.flat;
2287
-
2288
- // TODO Доработать логику и для остальных
2289
- if ('length' in person.documents.document) {
2290
- const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
2291
- if (validDocument) {
2292
- const documentType = this.documentTypes.find(i => i.ids === '1UDL');
2293
- if (documentType) this.formStore[whichForm].documentType = documentType;
2294
-
2295
- this.formStore[whichForm].documentNumber = validDocument.number;
2296
- this.formStore[whichForm].documentExpire = reformatDate(validDocument.endDate);
2297
- this.formStore[whichForm].documentDate = reformatDate(validDocument.beginDate);
2298
- this.formStore[whichForm].documentNumber = validDocument.number;
2299
-
2300
- const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
2301
- if (documentIssuer) this.formStore[whichForm].documentIssuers = documentIssuer;
2218
+ const regRegion = this.regions.find(
2219
+ i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2220
+ );
2221
+ if (regRegion) {
2222
+ member.registrationRegion = regRegion;
2223
+ const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
2224
+ if (regType) member.registrationRegionType = regType;
2302
2225
  }
2303
- } else {
2304
- const documentType =
2305
- person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
2306
- ? this.documentTypes.find(i => i.ids === '1UDL')
2307
- : this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2308
- ? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2309
- : new Value();
2310
- if (documentType) this.formStore[whichForm].documentType = documentType;
2226
+ }
2227
+ }
2311
2228
 
2312
- const documentNumber = person.documents.document.number;
2313
- if (documentNumber) this.formStore[whichForm].documentNumber = documentNumber;
2229
+ if (person.regAddress.street.includes(', ')) {
2230
+ const personAddress = person.regAddress.street.split(', ');
2231
+ const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
2232
+ const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
2233
+ const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
2234
+ if (microDistrict) member.registrationMicroDistrict = microDistrict;
2235
+ if (quarter) member.registrationQuarter = quarter;
2236
+ if (street) member.registrationStreet = street;
2237
+ } else {
2238
+ if (person.regAddress.street) member.registrationStreet = person.regAddress.street;
2239
+ }
2240
+ if (person.regAddress.building) member.registrationNumberHouse = person.regAddress.building;
2241
+ if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
2314
2242
 
2315
- const documentDate = person.documents.document.beginDate;
2316
- if (documentDate) this.formStore[whichForm].documentDate = reformatDate(documentDate);
2243
+ // TODO Доработать логику и для остальных
2244
+ if ('length' in person.documents.document) {
2245
+ const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
2246
+ if (validDocument) {
2247
+ const documentType = this.documentTypes.find(i => i.ids === '1UDL');
2248
+ if (documentType) member.documentType = documentType;
2317
2249
 
2318
- const documentExpire = person.documents.document.endDate;
2319
- if (documentExpire) this.formStore[whichForm].documentExpire = reformatDate(documentExpire);
2250
+ member.documentNumber = validDocument.number;
2251
+ member.documentExpire = reformatDate(validDocument.endDate);
2252
+ member.documentDate = reformatDate(validDocument.beginDate);
2253
+ member.documentNumber = validDocument.number;
2320
2254
 
2321
- // TODO уточнить
2322
2255
  const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
2323
- if (documentIssuer) this.formStore[whichForm].documentIssuers = documentIssuer;
2256
+ if (documentIssuer) member.documentIssuers = documentIssuer;
2324
2257
  }
2325
- const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
2326
- if (economySectorCode) this.formStore[whichForm].economySectorCode = economySectorCode;
2327
2258
  } else {
2328
- this.formStore[whichForm][whichIndex].firstName = person.name;
2329
- this.formStore[whichForm][whichIndex].lastName = person.surname;
2330
- this.formStore[whichForm][whichIndex].middleName = person.patronymic ? person.patronymic : '';
2331
- this.formStore[whichForm][whichIndex].longName = `${person.surname} ${person.name} ${person.patronymic ? person.patronymic : ''}`;
2332
- this.formStore[whichForm][whichIndex].birthDate = reformatDate(person.birthDate);
2333
- this.formStore[whichForm][whichIndex].genderName = person.gender.nameRu;
2334
-
2335
- const gender = this.gender.find(i => i.id == person.gender.code);
2336
- if (gender) this.formStore[whichForm][whichIndex].gender = gender;
2259
+ const documentType =
2260
+ person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
2261
+ ? this.documentTypes.find(i => i.ids === '1UDL')
2262
+ : this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2263
+ ? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2264
+ : new Value();
2265
+ if (documentType) member.documentType = documentType;
2337
2266
 
2338
- const birthPlace = this.countries.find(i => i.nameRu.match(new RegExp(person.birthPlace.country.nameRu, 'i')));
2339
- if (birthPlace) this.formStore[whichForm][whichIndex].birthPlace = birthPlace;
2267
+ const documentNumber = person.documents.document.number;
2268
+ if (documentNumber) member.documentNumber = documentNumber;
2340
2269
 
2341
- const countryOfCitizenship = this.citizenshipCountries.find(i => i.nameRu.match(new RegExp(person.citizenship.nameRu, 'i')));
2342
- if (countryOfCitizenship) this.formStore[whichForm][whichIndex].countryOfCitizenship = countryOfCitizenship;
2270
+ const documentDate = person.documents.document.beginDate;
2271
+ if (documentDate) member.documentDate = reformatDate(documentDate);
2343
2272
 
2344
- const regCountry = this.countries.find(i => i.nameRu.match(new RegExp(person.regAddress.country.nameRu, 'i')));
2345
- if (regCountry) this.formStore[whichForm][whichIndex].registrationCountry = regCountry;
2346
-
2347
- const regProvince = this.states.find(i => i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')));
2348
- if (regProvince) this.formStore[whichForm][whichIndex].registrationProvince = regProvince;
2349
-
2350
- if ('city' in person.regAddress && !!person.regAddress.city) {
2351
- if (person.regAddress.city.includes(', ')) {
2352
- const personCities = person.regAddress.city.split(', ');
2353
- for (let i = 0; i < personCities.length; ++i) {
2354
- const possibleCity = this.cities.find(i => i.nameRu.includes(personCities[i]));
2355
- if (possibleCity) {
2356
- this.formStore[whichForm][whichIndex].registrationCity = possibleCity;
2357
- break;
2358
- }
2359
- }
2360
- if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null) {
2361
- for (let i = 0; i < personCities.length; ++i) {
2362
- const possibleRegion = this.regions.find(i => i.nameRu.includes(personCities[i]));
2363
- if (possibleRegion) {
2364
- this.formStore[whichForm][whichIndex].registrationRegion = possibleRegion;
2365
- break;
2366
- }
2367
- }
2368
- }
2369
- } else {
2370
- const regCity = this.cities.find(i => i.nameRu.match(new RegExp(person.regAddress.city, 'i')));
2371
- if (regCity) this.formStore[whichForm][whichIndex].registrationCity = regCity;
2372
- if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null) {
2373
- const regRegion = this.regions.find(i => i.nameRu.match(new RegExp(person.regAddress.city), 'i'));
2374
- if (regRegion) this.formStore[whichForm][whichIndex].registrationRegion = regRegion;
2375
- }
2376
- }
2377
- }
2273
+ const documentExpire = person.documents.document.endDate;
2274
+ if (documentExpire) member.documentExpire = reformatDate(documentExpire);
2378
2275
 
2379
- if (this.formStore[whichForm][whichIndex].registrationCity.nameRu === null && this.formStore[whichForm][whichIndex].registrationRegion.nameRu === null) {
2380
- const regCity = this.cities.find(
2381
- i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu, 'i')) || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2382
- );
2383
- if (regCity) {
2384
- this.formStore[whichForm][whichIndex].registrationCity = regCity;
2385
- const regType = this.localityTypes.find(i => i.nameRu === 'город');
2386
- if (regType) this.formStore[whichForm][whichIndex].registrationRegionType = regType;
2387
- } else {
2388
- const regRegion = this.regions.find(
2389
- i => i.nameRu.match(new RegExp(person.regAddress.region.nameRu), 'i') || i.nameRu.match(new RegExp(person.regAddress.district.nameRu, 'i')),
2390
- );
2391
- if (regRegion) {
2392
- this.formStore[whichForm][whichIndex].registrationRegion = regRegion;
2393
- const regType = this.localityTypes.find(i => (i.nameRu === i.nameRu) === 'село' || i.nameRu === 'поселок');
2394
- if (regType) this.formStore[whichForm][whichIndex].registrationRegionType = regType;
2395
- }
2396
- }
2397
- }
2398
-
2399
- if (person.regAddress.street.includes(', ')) {
2400
- const personAddress = person.regAddress.street.split(', ');
2401
- const microDistrict = personAddress.find(i => i.match(new RegExp('микрорайон', 'i')));
2402
- const quarter = personAddress.find(i => i.match(new RegExp('квартал', 'i')));
2403
- const street = personAddress.find(i => i.match(new RegExp('улица', 'i')));
2404
- if (microDistrict) this.formStore[whichForm][whichIndex].registrationMicroDistrict = microDistrict;
2405
- if (quarter) this.formStore[whichForm][whichIndex].registrationQuarter = quarter;
2406
- if (street) this.formStore[whichForm][whichIndex].registrationStreet = street;
2407
- } else {
2408
- if (person.regAddress.street) this.formStore[whichForm][whichIndex].registrationStreet = person.regAddress.street;
2409
- }
2410
- if (person.regAddress.building) this.formStore[whichForm][whichIndex].registrationNumberHouse = person.regAddress.building;
2411
- if (person.regAddress.flat) this.formStore[whichForm][whichIndex].registrationNumberApartment = person.regAddress.flat;
2412
-
2413
- // TODO Доработать логику и для остальных
2414
- if ('length' in person.documents.document) {
2415
- const validDocument = person.documents.document.find(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00' && i.type.code === '002');
2416
- if (validDocument) {
2417
- const documentType = this.documentTypes.find(i => i.ids === '1UDL');
2418
- if (documentType) this.formStore[whichForm][whichIndex].documentType = documentType;
2419
- this.formStore[whichForm][whichIndex].documentNumber = validDocument.number;
2420
- this.formStore[whichForm][whichIndex].documentExpire = reformatDate(validDocument.endDate);
2421
- this.formStore[whichForm][whichIndex].documentDate = reformatDate(validDocument.beginDate);
2422
- this.formStore[whichForm][whichIndex].documentNumber = validDocument.number;
2423
-
2424
- const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
2425
- if (documentIssuer) this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer;
2426
- }
2427
- } else {
2428
- const documentType =
2429
- person.documents.document.type.nameRu === 'УДОСТОВЕРЕНИЕ РК'
2430
- ? this.documentTypes.find(i => i.ids === '1UDL')
2431
- : this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2432
- ? this.documentTypes.find(i => i.nameRu.match(new RegExp(person.documents.document.type.nameRu, 'i')))
2433
- : new Value();
2434
- if (documentType) this.formStore[whichForm][whichIndex].documentType = documentType;
2435
-
2436
- const documentNumber = person.documents.document.number;
2437
- if (documentNumber) this.formStore[whichForm][whichIndex].documentNumber = documentNumber;
2438
-
2439
- const documentDate = person.documents.document.beginDate;
2440
- if (documentDate) this.formStore[whichForm][whichIndex].documentDate = reformatDate(documentDate);
2441
-
2442
- const documentExpire = person.documents.document.endDate;
2443
- if (documentExpire) this.formStore[whichForm][whichIndex].documentExpire = reformatDate(documentExpire);
2444
-
2445
- // TODO уточнить
2446
- const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
2447
- if (documentIssuer) this.formStore[whichForm][whichIndex].documentIssuers = documentIssuer;
2448
- }
2449
- const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
2450
- if (economySectorCode) this.formStore[whichForm][whichIndex].economySectorCode = economySectorCode;
2276
+ // TODO уточнить
2277
+ const documentIssuer = this.documentIssuers.find(i => i.nameRu.match(new RegExp('МВД РК', 'i')));
2278
+ if (documentIssuer) member.documentIssuers = documentIssuer;
2451
2279
  }
2280
+ const economySectorCode = this.economySectorCode.find(i => i.ids === '500003.9');
2281
+ if (economySectorCode) member.economySectorCode = economySectorCode;
2452
2282
  },
2453
2283
  hasJobSection(whichForm) {
2454
2284
  switch (whichForm) {
@@ -2488,6 +2318,12 @@ export const useDataStore = defineStore('data', {
2488
2318
  return true;
2489
2319
  }
2490
2320
  },
2321
+ hasPercentageOfPayoutAmount() {
2322
+ if (this.isKazyna) {
2323
+ return false
2324
+ };
2325
+ return true
2326
+ },
2491
2327
  },
2492
2328
  });
2493
2329