hl-core 0.0.9-beta.24 → 0.0.9-beta.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/locales/ru.json CHANGED
@@ -2,7 +2,16 @@
2
2
  "title": "Заголовок",
3
3
  "confirm": {
4
4
  "yes": "Да",
5
- "no": "Нет"
5
+ "no": "Нет",
6
+ "cancel": "Отменить",
7
+ "exit": "Выйти",
8
+ "delete": "Удалить",
9
+ "pay": "Оплатить",
10
+ "clear": "Очистить",
11
+ "choose": "Выбрать",
12
+ "add": "Добавить",
13
+ "sign": "Подписать",
14
+ "send": "Отправить"
6
15
  },
7
16
  "settings": {
8
17
  "statement": "Список операций над заявкой",
@@ -117,7 +126,10 @@
117
126
  "doesHaveActiveContract": "Заключение договора невозможно. У Выгодоприобретателя имеется действующий договор",
118
127
  "needToSignContract": "Документ скачан. После подписи, необходимо вложить договор в разделе “Документы”",
119
128
  "successfullyDocSent": "Отправка документа прошла успешно",
129
+ "templateDownloaded": "Шаблон скачан",
130
+ "templateSentToEmail": "Шаблона отправлен на почту",
120
131
  "fileOnlyBelow5mb": "Максимальный размер документа для загрузки - 5 МБ.",
132
+ "fileOnlyBelow20mb": "Максимальный размер документа для загрузки - 20 МБ.",
121
133
  "onlyPDF": "Загружать документы можно только в формате PDF"
122
134
  },
123
135
  "notSignedContract": "Неподписанный Договор",
@@ -189,11 +201,23 @@
189
201
  "sendToSign": "Отправить на подпись",
190
202
  "downloadContract": "Скачать договор",
191
203
  "sendElectronically": "Отправить в электронном виде",
204
+ "goTo": "Перейти",
192
205
  "sendOnPaper": "Отправить на бумажном носителе",
193
- "export": "Экспорт"
206
+ "export": "Экспорт",
207
+ "fromGBDUL": "ГБДЮЛ",
208
+ "fromKGD": "КГД"
194
209
  },
195
210
  "dialog": {
196
211
  "title": "Подтверждение",
212
+ "confirmDo": "Подтвердите действие",
213
+ "confirmDelete": "Подтвердите удаление",
214
+ "confirmCancel": "Подтвердите отмену",
215
+ "confirmClear": "Подтвердите очистку",
216
+ "confirmExit": "Подтвердите выход",
217
+ "confirmChoose": "Подтвердите выбор",
218
+ "confirmSign": "Подтвердите подписание",
219
+ "confirmSend": "Подтвердите отправку",
220
+ "confirmPay": "Подтвердите оплату",
197
221
  "do": "Вы действительно хотите сделать данное действие?",
198
222
  "exit": "Вы действительно хотите выйти?",
199
223
  "exitApp": "Вы действительно хотите выйти? Данные будут очищены.",
@@ -209,6 +233,8 @@
209
233
  "continue": "Продолжить",
210
234
  "correctSum": "Корректна ли сумма страховой премии?",
211
235
  "sign": "Вы действительно хотите подписать?",
236
+ "send": "Вы действительно хотите отправить?",
237
+ "chooseSign": "Вы действительно хотите выбрать метод подписания?",
212
238
  "signed": "Вы действительно хотите отправить на следующий этап?",
213
239
  "pay": "Вы действительно хотите оплатить?",
214
240
  "familyMember": "Выберите члена семьи",
@@ -245,8 +271,11 @@
245
271
  "childInfo": "Данные о ребенке",
246
272
  "policyholderForm": "Страхователь",
247
273
  "policyholderAndInsured": "Застрахованный / Страхователь",
274
+ "insuranceConditions": "Условия страхования",
248
275
  "policyholderAndInsuredSame": "Застрахованный / Страхователь является одним лицом",
249
276
  "insuredForm": "Застрахованный",
277
+ "confidant": "Доверенное лицо",
278
+ "bankDetails": "Банковские реквизиты",
250
279
  "beneficiaryForm": "Выгодоприобретатель",
251
280
  "beneficialOwnerForm": "Бенефициарный собственник",
252
281
  "policyholdersRepresentativeForm": "Представитель страхователя",
@@ -260,7 +289,7 @@
260
289
  "isMemberIPDL": "Отметка о принадлежности и/или причастности к публичному должностному лицу, его супруге (супругу) и близким родственникам?",
261
290
  "isPolicyholderBeneficiary": "Является ли страхователь выгодоприобретателем?",
262
291
  "hasRepresentative": "Подписантом договора выступает представитель? ",
263
- "isActOwnBehalf": " Контрагент действует от своего имени и в своих интересах?",
292
+ "isActOwnBehalf": "Контрагент действует от своего имени и в своих интересах?",
264
293
  "coverPeriod": "Срок",
265
294
  "requestedSumInsured": "Запрашиваемая сумма",
266
295
  "insurancePremiumPerMonth": "Премия в месяц",
@@ -290,6 +319,7 @@
290
319
  "createNewApp": "Создать новую заявку",
291
320
  "template": "Шаблон",
292
321
  "downloadDocument": "Скачать документ",
322
+ "downloadTemplate": "Скачать шаблон",
293
323
  "countriesLength": "Число выбранных стран",
294
324
  "productConditionsForm": {
295
325
  "coverPeriod": "Срок страхования",
@@ -365,13 +395,6 @@
365
395
  "decision": "Статус",
366
396
  "userFullName": "Исполнитель"
367
397
  },
368
- "dso": {
369
- "project": "ДСО",
370
- "generalInfo": "Общая информация",
371
- "prevStatements": "Ранее оформленные заявки",
372
- "title": "Сопровождение договоров/полисов",
373
- "warningNSJ": "На данный момент сопровождение договоров/полисов только для НСЖ"
374
- },
375
398
  "aml": {
376
399
  "contractSignDate": "Дата заключение контракта",
377
400
  "contractEndDate": "Дата завершения контракта",
@@ -385,8 +408,8 @@
385
408
  "productCode": "Код продукта",
386
409
  "contract": "Контракт",
387
410
  "checks": "Проверки",
388
- "threeLetterCode": "Трехбуквенный код",
389
- "twoLetterCode": "Двухбуквенный код",
411
+ "threeLetter": "Трехбуквенный код",
412
+ "twoLetter": "Двухбуквенный код",
390
413
  "risk": "Риск:",
391
414
  "note": "Примечание",
392
415
  "name": "Наименование",
@@ -397,9 +420,9 @@
397
420
  "to": "До",
398
421
  "reasonForAffiliation": "Основание для признания аффилированности",
399
422
  "reasonForRelation": "Основание для признания связанности",
400
- "affiliationDate": "Дата появления аффилированности",
423
+ "affCreateDate": "Дата появления аффилированности",
401
424
  "relationDate": "Дата появления связанности",
402
- "expulsionDate": "Дата исключения",
425
+ "affDeletedDate": "Дата исключения",
403
426
  "applicationDate": "Дата заявки",
404
427
  "wrongData": "Некорректные данные обнаружены",
405
428
  "legalName": "Название организации",
@@ -412,7 +435,7 @@
412
435
  "controllerCheck": "Проверенно контроллером",
413
436
  "amountCurrency": "Сумма в валюте",
414
437
  "isAnotherContract ": "Подозрение что у клиента есть договор страхования в другой иностранной компании",
415
- "opf": "Организационно-правовая форма",
438
+ "shortNameRu": "Организационно-правовая форма",
416
439
  "checkType": "Тип проверки",
417
440
  "personType": "Тип клиента",
418
441
  "operationtype": "Тип операции",
@@ -420,6 +443,8 @@
420
443
  "export": "Экспорт",
421
444
  "overlapType": "Тип совпадения",
422
445
  "system": "Система",
446
+ "modifiedDate": "Дата редактирования",
447
+ "createdDate": "Дата добавления",
423
448
  "isActive": "Активен"
424
449
  },
425
450
  "agent": {
@@ -570,6 +595,8 @@
570
595
  "editDate": "Дата редактирования",
571
596
  "addDate": "Дата добавления",
572
597
  "type": "Тип",
598
+ "number": "Номер",
599
+ "dateFrom": "Дата от",
573
600
  "naming": "Наименование",
574
601
  "countryName": "Наименование страны",
575
602
  "dicts": "Справочники",
@@ -660,6 +687,7 @@
660
687
  "latin": "Поле должно содержать только латинские символы",
661
688
  "email": "Неправильный адрес электронной почты",
662
689
  "numbers": "Поле должно содержать только цифры",
690
+ "latinAndNumber": "Поле должно содержать только цифры и латинские символы",
663
691
  "numbersSymbols": "Поле должно содержать цифры",
664
692
  "ageExceeds": "Год не может превышать больше 50 лет",
665
693
  "ageExceeds80": "Возраст не может превышать больше 80 лет",
@@ -769,8 +797,9 @@
769
797
  "phoneNumber": "Номер телефона",
770
798
  "homePhone": "Домашний номер телефон",
771
799
  "email": "Email адрес",
800
+ "sendToEmail": "Отправить на почту",
772
801
  "otpCode": "Код подтверждения",
773
- "salesChanell": " Канал продаж",
802
+ "salesChanell": "Канал продаж",
774
803
  "manager": "Менеджер",
775
804
  "attachManager": "Менеджер",
776
805
  "agent": "Агент",
@@ -778,7 +807,19 @@
778
807
  "firstNameLat": "Имя (На латинице)",
779
808
  "lastNameLat": "Фамилия (На латинице)"
780
809
  },
781
- "insurers": {
810
+ "bankDetailsForm": {
811
+ "title": "Банковские реквизиты",
812
+ "name": "Название банка",
813
+ "BIN": "БИН банка",
814
+ "ownerIIN": "ИИН владельца",
815
+ "BIK": "БИК банка",
816
+ "IBANBank": "IBAN банка",
817
+ "IBANClient": "IBAN клиента",
818
+ "accountHolderName": "ФИО владельца счета",
819
+ "accountHolderIIN": "ИИН владельца счета",
820
+ "accountHolderAddress": "Адрес владельца счета"
821
+ },
822
+ "clients": {
782
823
  "listInsured": "Список Застрахованных",
783
824
  "templateInsured": "Шаблон для заполнения данных Застрахованных",
784
825
  "sendListToFill": "Отправить список Страхователю для заполнения",
@@ -829,9 +870,52 @@
829
870
  "isFirstManager": "Бенефициарный собственник является первым руководителем",
830
871
  "iin": "ИИН (при наличии)",
831
872
  "isPublicForeignOfficial": "Отметка о принадлежности и/или причастности к публичному иностранному должностному лицу, его супруге (супругу) и близким родственникам?",
832
- "series": "Серия"
873
+ "series": "Серия",
874
+ "count":"Количество случаев",
875
+ "amount":"Сумма выплаты",
876
+ "shortDescription":"Краткое описание",
877
+ "questionnaireInsured": "Анкета Застрахованного",
878
+ "recalculationSection": "Раздел переменных для перерасчета"
833
879
  }
834
880
  },
881
+ "dso": {
882
+ "project": "ДСО",
883
+ "generalInfo": "Общая информация",
884
+ "prevStatements": "Ранее оформленные заявки",
885
+ "title": "Сопровождение договоров/полисов",
886
+ "warningNSJ": "На данный момент сопровождение договоров/полисов только для НСЖ",
887
+ "coming": "Приход",
888
+ "consumption": "Расход",
889
+ "remainder": "Остаток",
890
+ "loans": "Займы",
891
+ "paymentJournal": "Журнал оплат",
892
+ "startDate": "Дата начала",
893
+ "loanAmount": "Сумма займа",
894
+ "loanStatus": "Статус займа",
895
+ "numberContract": "Номер полиса / договора: ",
896
+ "createStatement": "Создать заявление",
897
+ "redemptionAmount": "Выкупная сумма",
898
+ "bonusAmount": "Бонусная сумма",
899
+ "statementName": "Наименование Заявление ",
900
+ "termination": "Расторжение",
901
+ "change": "Изменение",
902
+ "recovery": "Восстановление",
903
+ "statementType": "Тип Заявление",
904
+ "number": "Номер",
905
+ "reasonsTerminationOfContract": {
906
+ "title": "Причина возврата денежных сумм",
907
+ "refundPremium": "Расторжение договора страхования и возврат страховой премии",
908
+ "redemptionAmount": "Расторжение договора страхования и выплата выкупной суммы",
909
+ "terminateContract": "Расторжение договора страхования",
910
+ "refundPremiumWithin30days": "Расторжение договора страхования и возврат страховой премии в течении 30/40 дней с даты заключения договора страхования",
911
+ "transferPremiumOrAmount": "Расторжение договора страхования и перенос выкупной суммы/страховой премии"
912
+ },
913
+ "needDocuments": "Необходимо вложить оригинал страхового полиса в разделе “Документы”",
914
+ "hasOriginalContract": "Имеется ли оригинал страхового полиса? Да",
915
+ "byAttorney": "По доверенности? Нет",
916
+ "changePolicyholder": "Изменить Страхователя? Нет",
917
+ "Contract/Policy/Statement": "Договор/Полис/Заявление"
918
+ },
835
919
  "agreementBlock": {
836
920
  "title": "Согласие на сбор и обработку пресональных данных",
837
921
  "text": "Я, предоставляю АО «Халык-Life» (БИН 051140004354) и (или) организациям, входящими в состав финансовой Группы «Халык» (Акционеру АО «Халык-Life» (БИН 940140000385) и его дочерним организациям), перестраховочным организациям, организации по формированию и ведению базы данных по страхованию (БИН 120940011577), юридическому лицу, осуществляющему деятельность по привлечению пенсионных взносов и пенсионным выплатам (БИН 971240002115), юридическому лицу, осуществляющему по решению Правительства Республики Казахстан деятельность по оказанию государственных услуг (БИН 160440007161), операторам/владельцам государственных баз данных согласие на сбор и обработку, трансграничную передачу и распространение моих персональных данных и информации, связанных со мной и моими близкими родственниками, из всех источников и баз данных, в том числе содержащих врачебную, налоговую, банковскую тайну, тайну пенсионных накоплений, и иную охраняемую законом тайну, зафиксированных на электронном, бумажном и (или) ином материальном носителе, с целью оказания АО «Халык-Life» функций страховой организации и вышеуказанными организациями финансовых и иных услуг, в том числе необходимых для заполнения/формирования заявлений и договоров, а также моей надлежащей идентификации, включая, но не ограничиваясь: фамилия, имя, отчество, гражданство, данные документа, удостоверяющего личность, индивидуальный идентификационный номер, дата и данные о рождении, пол, национальность, фото, биометрические данные, состояние здоровья, банковские реквизиты, сведения о дееспособности, сведения, необходимые для поддержания связи, сведения о размере суммы пенсионных накоплений и размере выкупной суммы, иные данные/информация, полученные и переданные на текущий момент и которые могут быть получены и переданы в будущем, из всех/во все возможных(-хабарлама ые) источников(-хабарлама и), в том числе любых(-хабарлама е) баз(-хабарлама ы) данных, в том числе баз данных: владельцев государственных баз данных, организации по формированию и ведению базы данных по страхованию, юридического лица, осуществляющего деятельность по привлечению пенсионных взносов и пенсионным выплатам, юридического лица, осуществляющего по решению Правительства Республики Казахстан деятельность по оказанию государственных услуг, которые будут или стали известны АО «Халык-Life» в процессе его деятельности и/или в рамках гражданско-хабарлама правовых и иных отношений с контрагентами в рамках соответствующего договора, предоставляю АО «Халык-Life» возможность передачи моих персональных данных уполномоченным органам, Акционеру АО «Халык-Life» и его дочерним организациям, аффилированным лицам АО «Халык-Life», организации по формированию и ведению базы данных по страхованию, операторам государственных баз данных, и иным третьим лицам, связанным, как в настоящее время, так и в будущем, с АО «Халык-Life» обстоятельствами или правоотношениями, и любым третьим лицам, когда АО «Халык-Life» обязан или вправе совершить такие действия в соответствии с требованиями законодательства и (или) внутренними документами. Настоящее согласие действует в период правоспособности АО «Халык-Life» (его правопреемника)."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.9-beta.24",
3
+ "version": "0.0.9-beta.26",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -3,7 +3,7 @@ import { rules } from './rules';
3
3
  import { i18n } from '../configs/i18n';
4
4
  import { Toast, Types, Positions, ToastOptions } from './toast';
5
5
  import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
6
- import { DataStoreClass, Contragent, DocumentItem, Member, Value, CountryValue, PolicyholderV2 } from '../composables/classes';
6
+ import { DataStoreClass, Contragent, DocumentItem, Member, Value, CountryValue, MemberV2, PolicyholderActivity, BeneficialOwner } from '../composables/classes';
7
7
  import { ApiClass } from '../api';
8
8
  import { useFormStore } from './form.store';
9
9
  import { AxiosError } from 'axios';
@@ -1018,6 +1018,11 @@ export const useDataStore = defineStore('data', {
1018
1018
  conditionsData.policyAppDto.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
1019
1019
  conditionsData.policyAppDto.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
1020
1020
  }
1021
+ if (this.isLifeBusiness) {
1022
+ conditionsData.policyAppDto.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
1023
+ conditionsData.policyAppDto.fixInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
1024
+ conditionsData.policyAppDto.tariffId = String(this.formStore.productConditionsForm.processTariff.id);
1025
+ }
1021
1026
  return conditionsData;
1022
1027
  },
1023
1028
  async clearAddCovers(coverCode: number, coverValue: string) {
@@ -1242,7 +1247,7 @@ export const useDataStore = defineStore('data', {
1242
1247
  return this.cities;
1243
1248
  }
1244
1249
  },
1245
- async getCitiesEfo(key?: string, member?: PolicyholderV2, parentKey?: string) {
1250
+ async getCitiesEfo(key?: string, member?: MemberV2, parentKey?: string) {
1246
1251
  if (this.isLifeBusiness) {
1247
1252
  await this.getFromApi('cities', 'getCities');
1248
1253
  //@ts-ignore
@@ -1670,15 +1675,15 @@ export const useDataStore = defineStore('data', {
1670
1675
  calculationData.annuityPaymentPeriodId = (this.formStore.productConditionsForm.periodAnnuityPayment.id as string) ?? undefined;
1671
1676
  }
1672
1677
  if (this.isLifeBusiness || product === 'lifebusiness') {
1673
- calculationData.clients = this.formStore.lfb.insurers;
1674
- calculationData.insrCount = this.formStore.lfb.insurers.length;
1678
+ calculationData.clients = this.formStore.lfb.clients;
1679
+ calculationData.insrCount = this.formStore.lfb.clients.length;
1675
1680
  calculationData.insTermInMonth = Number(this.formStore.productConditionsForm.coverPeriod);
1676
1681
  calculationData.fixInsSum = getNumber(String(this.formStore.productConditionsForm.requestedSumInsured));
1677
1682
  calculationData.agentCommission = this.formStore.productConditionsForm.processTariff.id;
1678
1683
  }
1679
1684
  const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
1680
- this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
1681
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
1685
+ if (calculationResponse.amount) this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
1686
+ if (calculationResponse.premium) this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
1682
1687
  this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1683
1688
  if (this.isKazyna || product === 'halykkazyna') {
1684
1689
  if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
@@ -1700,7 +1705,7 @@ export const useDataStore = defineStore('data', {
1700
1705
  this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.mainPremium);
1701
1706
  this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1702
1707
  if (calculationResponse.clients) {
1703
- this.formStore.lfb.insurers = calculationResponse.clients;
1708
+ this.formStore.lfb.clients = calculationResponse.clients;
1704
1709
  }
1705
1710
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1706
1711
  return calculationResponse;
@@ -1747,6 +1752,9 @@ export const useDataStore = defineStore('data', {
1747
1752
  this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(govPremiums.statePremium5 === null ? null : govPremiums.statePremium5);
1748
1753
  this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(govPremiums.statePremium7 === null ? null : govPremiums.statePremium7);
1749
1754
  }
1755
+ if (this.isLifeBusiness) {
1756
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
1757
+ }
1750
1758
 
1751
1759
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1752
1760
  } catch (err) {
@@ -2277,12 +2285,38 @@ export const useDataStore = defineStore('data', {
2277
2285
  ErrorHandler(err);
2278
2286
  }
2279
2287
  },
2288
+ async downloadTemplate() {
2289
+ try {
2290
+ this.isButtonsLoading = true;
2291
+ const response: any = await this.api.downloadTemplate();
2292
+ const blob = new Blob([response], {
2293
+ type: `application/pdf`,
2294
+ });
2295
+ this.showToaster('info', this.t('toaster.needToSignContract'), 100000);
2296
+ const url = window.URL.createObjectURL(blob);
2297
+ const link = document.createElement('a');
2298
+ link.href = url;
2299
+ link.setAttribute('download', this.formStore.regNumber + ' Договор страхования');
2300
+ document.body.appendChild(link);
2301
+ link.click();
2302
+ } catch (err) {
2303
+ ErrorHandler(err);
2304
+ }
2305
+ this.isButtonsLoading = false;
2306
+ },
2307
+ async sendTemplateToEmail(email: string) {
2308
+ try {
2309
+ this.isButtonsLoading = true;
2310
+ await this.api.sendTemplateToEmail(email);
2311
+ this.showToaster('info', this.t('toaster.needToSignContract'), 100000);
2312
+ } catch (err) {
2313
+ ErrorHandler(err);
2314
+ }
2315
+ this.isButtonsLoading = false;
2316
+ },
2280
2317
  async generateDocument() {
2281
2318
  try {
2282
2319
  this.isButtonsLoading = true;
2283
- if (this.formStore.signUrls.length) {
2284
- return this.formStore.signUrls;
2285
- }
2286
2320
  this.formStore.needToScanSignedContract = true;
2287
2321
  const data: SignDataType = {
2288
2322
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
@@ -2935,6 +2969,241 @@ export const useDataStore = defineStore('data', {
2935
2969
  const economySectorCode = this.economySectorCode.find((i: Value) => i.ids === '500003.9');
2936
2970
  if (economySectorCode) member.economySectorCode = economySectorCode;
2937
2971
  },
2972
+ async startApplicationV2(policyholder: MemberV2) {
2973
+ if (!policyholder.personalData.iin) return false;
2974
+ try {
2975
+ const response = await this.api.startApplication(policyholder);
2976
+ this.sendToParent(constants.postActions.applicationCreated, response.processInstanceId);
2977
+ return response.processInstanceId;
2978
+ } catch (err) {
2979
+ return ErrorHandler(err);
2980
+ }
2981
+ },
2982
+ async saveClient(policyholder: MemberV2) {
2983
+ try {
2984
+ this.formStore.applicationData.clientApp.clientData = policyholder;
2985
+ const response = await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, this.formStore.applicationData.clientApp);
2986
+ return response;
2987
+ } catch (err) {
2988
+ return ErrorHandler(err);
2989
+ }
2990
+ },
2991
+ async getApplicationDataV2(taskId: string) {
2992
+ this.isLoading = true;
2993
+ try {
2994
+ const applicationData = await this.api.getApplicationData(taskId);
2995
+ if (this.processCode !== applicationData.processCode) {
2996
+ this.isLoading = false;
2997
+ this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
2998
+ return;
2999
+ }
3000
+
3001
+ this.formStore.applicationData = applicationData;
3002
+ this.formStore.regNumber = applicationData.regNumber;
3003
+ this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
3004
+
3005
+ this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
3006
+ this.formStore.applicationTaskId = taskId;
3007
+ this.formStore.RegionPolicy.nameRu = applicationData.insisWorkDataApp.regionPolicyName;
3008
+ this.formStore.RegionPolicy.ids = applicationData.insisWorkDataApp.regionPolicy;
3009
+ this.formStore.ManagerPolicy.nameRu = applicationData.insisWorkDataApp.managerPolicyName;
3010
+ this.formStore.ManagerPolicy.ids = applicationData.insisWorkDataApp.managerPolicy;
3011
+ this.formStore.SaleChanellPolicy.nameRu = applicationData.insisWorkDataApp.saleChanellPolicyName;
3012
+ this.formStore.SaleChanellPolicy.ids = applicationData.insisWorkDataApp.saleChanellPolicy;
3013
+
3014
+ this.formStore.AgentData.fullName = applicationData.insisWorkDataApp.agentName;
3015
+ this.formStore.AgentData.agentId = applicationData.insisWorkDataApp.agentId;
3016
+
3017
+ const { clientData } = applicationData.clientApp;
3018
+ const beneficialOwnerApp = applicationData.beneficialOwnerApp;
3019
+ const insuredApp = applicationData.insuredApp;
3020
+ const accidentIncidents = applicationData.accidentIncidentDtos;
3021
+ const clientId = applicationData.clientApp.id;
3022
+
3023
+ this.formStore.applicationData.processInstanceId = applicationData.processInstanceId;
3024
+ this.formStore.lfb.policyholder = clientData;
3025
+ this.formStore.lfb.clientId = clientId;
3026
+ this.formStore.lfb.policyholder.clientPower.date = reformatDate(clientData.clientPower.date);
3027
+ this.formStore.lfb.accidentIncidents = accidentIncidents;
3028
+
3029
+ if (clientData && clientData.activityTypes !== null) {
3030
+ this.formStore.lfb.policyholderActivities = clientData.activityTypes;
3031
+ }
3032
+
3033
+ if (beneficialOwnerApp && beneficialOwnerApp.length) {
3034
+ this.formStore.lfb.beneficialOwners = beneficialOwnerApp;
3035
+ }
3036
+
3037
+ if (insuredApp && insuredApp.length) {
3038
+ const res = await this.newInsuredList(insuredApp);
3039
+ this.formStore.lfb.clients = res;
3040
+ }
3041
+
3042
+ this.formStore.productConditionsForm.coverPeriod = 12;
3043
+ this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(
3044
+ applicationData.policyAppDto.amount === null ? null : applicationData.policyAppDto.amount,
3045
+ );
3046
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(
3047
+ applicationData.policyAppDto.mainPremium === 0 ? null : applicationData.policyAppDto.mainPremium,
3048
+ );
3049
+ const paymentPeriod = this.processPaymentPeriod.find(item => item.id == applicationData.policyAppDto.paymentPeriodId);
3050
+ this.formStore.productConditionsForm.paymentPeriod = paymentPeriod ? paymentPeriod : new Value();
3051
+ const processTariff = this.processTariff.find(item => item.id == applicationData.policyAppDto.tariffId);
3052
+ this.formStore.productConditionsForm.processTariff = processTariff ? processTariff : new Value();
3053
+ } catch (err) {
3054
+ ErrorHandler(err);
3055
+ if (err instanceof AxiosError) {
3056
+ this.sendToParent(constants.postActions.toHomePage, err.response?.data);
3057
+ this.isLoading = false;
3058
+ return false;
3059
+ }
3060
+ }
3061
+ this.isLoading = false;
3062
+ },
3063
+ async saveAccidentIncidents(data: AccidentIncidents[]) {
3064
+ try {
3065
+ const response = await this.api.saveAccidentIncidents(this.formStore.applicationData.processInstanceId, data);
3066
+ return response;
3067
+ } catch (err) {
3068
+ return ErrorHandler(err);
3069
+ }
3070
+ },
3071
+ async saveClientAcivityTypes(data: PolicyholderActivity[]) {
3072
+ try {
3073
+ const response = await this.api.saveClientAcivityTypes(this.formStore.applicationData.clientApp.id, data);
3074
+ return response;
3075
+ } catch (err) {
3076
+ return ErrorHandler(err);
3077
+ }
3078
+ },
3079
+ async saveBeneficialOwnerList(beneficialOwnerList: BeneficialOwner[]) {
3080
+ try {
3081
+ const response = await this.api.saveBeneficialOwnerList(this.formStore.applicationData.processInstanceId, beneficialOwnerList);
3082
+ return response;
3083
+ } catch (err) {
3084
+ return ErrorHandler(err);
3085
+ }
3086
+ },
3087
+ async saveBeneficialOwner(beneficialOwner: BeneficialOwner) {
3088
+ try {
3089
+ const response = await this.api.saveBeneficialOwner(this.formStore.applicationData.processInstanceId, beneficialOwner.id, beneficialOwner);
3090
+ return response;
3091
+ } catch (err) {
3092
+ return ErrorHandler(err);
3093
+ }
3094
+ },
3095
+ async saveInsuredList(insuredList: any) {
3096
+ try {
3097
+ const response = await this.api.saveInsuredList(this.formStore.applicationData.processInstanceId, insuredList);
3098
+ return response;
3099
+ } catch (err) {
3100
+ return ErrorHandler(err);
3101
+ }
3102
+ },
3103
+ async saveInsured(insuredId: any) {
3104
+ try {
3105
+ const response = await this.api.saveInsured(this.formStore.applicationData.processInstanceId, insuredId.id, insuredId);
3106
+ return response;
3107
+ } catch (err) {
3108
+ return ErrorHandler(err);
3109
+ }
3110
+ },
3111
+ newInsuredList(list: any) {
3112
+ const clients = list.map((item: any, index: number) => {
3113
+ const client = item.insuredData;
3114
+ return {
3115
+ id: index,
3116
+ fullName: client.personalData.longName,
3117
+ sex: client.personalData.sex,
3118
+ position: item.position,
3119
+ birthDate: client.personalData.birthDate,
3120
+ iin: client.personalData.iin,
3121
+ insSum: client.insuredPolicyData.insSum,
3122
+ premium: client.insuredPolicyData.premium,
3123
+ };
3124
+ });
3125
+ return clients;
3126
+ },
3127
+ validateMultipleMembersV2(localKey: string, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
3128
+ // @ts-ignore
3129
+ if (this.formStore.lfb[localKey].length === this.formStore.applicationData[applicationKey].length) {
3130
+ // @ts-ignore
3131
+ if (this.formStore.lfb[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
3132
+ // @ts-ignore
3133
+ const localMembers = [...this.formStore.lfb[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
3134
+ const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.id - b.id);
3135
+ if (localMembers.every((each, index) => applicationMembers[index].iin === each.iin?.replace(/-/g, '')) === false) {
3136
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3137
+ return false;
3138
+ }
3139
+ }
3140
+ } else {
3141
+ // @ts-ignore
3142
+ if (this.formStore.lfb[localKey].some(i => i.iin !== null)) {
3143
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3144
+ return false;
3145
+ }
3146
+ if (this.formStore.applicationData[applicationKey].length !== 0) {
3147
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3148
+ return false;
3149
+ } else {
3150
+ // @ts-ignore
3151
+ if (this.formStore.lfb[localKey][0].iin !== null) {
3152
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
3153
+ return false;
3154
+ }
3155
+ }
3156
+ }
3157
+ return true;
3158
+ },
3159
+ async validateAllFormsV2(taskId: string) {
3160
+ this.isLoading = true;
3161
+ if (taskId === '0') {
3162
+ this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
3163
+ return false;
3164
+ }
3165
+
3166
+ if (this.formStore.applicationData.clientApp.iin !== this.formStore.applicationData.clientApp.iin) {
3167
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
3168
+ return false;
3169
+ }
3170
+
3171
+ if (this.formStore.lfb.beneficialOwners) {
3172
+ if (this.validateMultipleMembersV2('beneficialOwners', 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
3173
+ return false;
3174
+ }
3175
+ const inStatement = this.formStore.lfb.beneficialOwners.every(i => i.id !== null);
3176
+ if (inStatement === false) {
3177
+ this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficialOwner') }));
3178
+ return false;
3179
+ }
3180
+ }
3181
+
3182
+ if (this.formStore.lfb.policyholderActivities) {
3183
+ if (this.formStore.lfb.policyholderActivities.length !== this.formStore.applicationData.clientApp.clientData.activityTypes.length) {
3184
+ this.showToaster('error', this.t('toaster.notSavedMember', { text: 'деятельности Страхователя' }), 3000);
3185
+ return false;
3186
+ }
3187
+ }
3188
+
3189
+ if (this.formStore.lfb.clients) {
3190
+ if (this.validateMultipleMembersV2('clients', 'insuredApp', 'застрахованных') === false) {
3191
+ return false;
3192
+ }
3193
+ const inStatement = this.formStore.lfb.clients.every(i => i.id !== null);
3194
+ if (inStatement === false) {
3195
+ this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.insured') }));
3196
+ return false;
3197
+ }
3198
+ }
3199
+
3200
+ if (!this.formStore.productConditionsForm.insurancePremiumPerMonth && !this.formStore.productConditionsForm.requestedSumInsured) {
3201
+ this.showToaster('error', this.t('toaster.emptyProductConditions'), 3000);
3202
+ return false;
3203
+ }
3204
+
3205
+ return true;
3206
+ },
2938
3207
  async checkIIN(iin: number) {
2939
3208
  try {
2940
3209
  const response = await this.api.checkIIN(iin);
@@ -11,7 +11,9 @@ export const useFormStore = defineStore('forms', {
11
11
  this.lfb.policyholderActivities.push(new PolicyholderActivity());
12
12
  }
13
13
  if (whichMember === 'beneficialOwner') {
14
- this.lfb.beneficialOwners.push(new BeneficialOwner());
14
+ if (this.lfb.beneficialOwners.length !== 3) {
15
+ this.lfb.beneficialOwners.push(new BeneficialOwner());
16
+ }
15
17
  }
16
18
  },
17
19
  },