hl-core 0.0.8-beta.26 → 0.0.8-beta.28

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.
@@ -141,10 +141,11 @@ export const parseXML = (xml: boolean | string = true, withTag = false, tag: str
141
141
  };
142
142
 
143
143
  export const ESBDMessage = (ESBDObject: any, initialPoint: any) => {
144
+ return ESBDObject.errorMsg;
144
145
  let result;
145
146
  if (ESBDObject.errorCode === 2) {
146
147
  if (ESBDObject.errorMsg.indexOf('EMSG') === -1) {
147
- result = 'Клиент не является резидентом РК!';
148
+ result = 'Контрагент не является резидентом РК!';
148
149
  } else {
149
150
  result = ESBDObject.errorMsg.substring(ESBDObject.errorMsg.indexOf('EMSG') + 6, ESBDObject.errorMsg.lastIndexOf('EWS-100')).replace(initialPoint, '');
150
151
  }
@@ -174,3 +175,54 @@ export const ErrorHandler = (err: unknown, errorText?: string) => {
174
175
  }
175
176
  return false;
176
177
  };
178
+
179
+ export const setAddressBeneficiary = (whichIndex: number, sameAddress: boolean) => {
180
+ const formStore = useFormStore();
181
+ const dataStore = useDataStore();
182
+ const beneficiary = formStore.beneficiaryForm[Number(whichIndex)];
183
+ const policyholder = formStore.policyholderForm;
184
+ if (sameAddress === true) {
185
+ beneficiary.registrationCity = policyholder.registrationCity;
186
+ beneficiary.registrationCountry = policyholder.registrationCountry;
187
+ beneficiary.birthPlace = policyholder.birthPlace;
188
+ beneficiary.registrationMicroDistrict = policyholder.registrationMicroDistrict;
189
+ beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
190
+ beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
191
+ beneficiary.registrationNumberHouse = policyholder.registrationNumberHouse;
192
+ beneficiary.registrationProvince = policyholder.registrationProvince;
193
+ beneficiary.registrationQuarter = policyholder.registrationQuarter;
194
+ beneficiary.registrationRegion = policyholder.registrationRegion;
195
+ beneficiary.registrationRegionType = policyholder.registrationRegionType;
196
+ beneficiary.registrationStreet = policyholder.registrationStreet;
197
+ } else {
198
+ if (beneficiary.id === 0) {
199
+ beneficiary.registrationCity = new Value();
200
+ beneficiary.registrationCountry = new Value();
201
+ beneficiary.registrationMicroDistrict = '';
202
+ beneficiary.registrationNumberApartment = '';
203
+ beneficiary.registrationNumberApartment = '';
204
+ beneficiary.registrationNumberHouse = '';
205
+ beneficiary.registrationProvince = new Value();
206
+ beneficiary.registrationQuarter = '';
207
+ beneficiary.registrationRegion = new Value();
208
+ beneficiary.registrationRegionType = new Value();
209
+ beneficiary.registrationStreet = '';
210
+ } else {
211
+ const country = dataStore.countries.find(i => (i.nameRu as string).match(new RegExp(beneficiary.response?.addresses[0].countryName, 'i')));
212
+ const city = dataStore.cities.find(i => i.nameRu === beneficiary.response?.addresses[0].cityName.replace('г.', ''));
213
+ const province = dataStore.states.find(i => i.ids === beneficiary.response?.addresses[0].stateCode);
214
+ const localityType = dataStore.localityTypes.find(i => i.nameRu === beneficiary.response?.addresses[0].cityTypeName);
215
+ const region = dataStore.regions.find(i => i.ids == beneficiary.response?.addresses[0].regionCode);
216
+ beneficiary.registrationCountry = country ?? new Value();
217
+ beneficiary.registrationCity = city ?? new Value();
218
+ beneficiary.registrationMicroDistrict = beneficiary.response?.addresses[0].microRaion ?? '';
219
+ beneficiary.registrationNumberApartment = beneficiary.response?.addresses[0].apartmentNumber ?? '';
220
+ beneficiary.registrationNumberHouse = beneficiary.response?.addresses[0].blockNumber ?? '';
221
+ beneficiary.registrationProvince = province ?? new Value();
222
+ beneficiary.registrationQuarter = beneficiary.response?.addresses[0].kvartal ?? '';
223
+ beneficiary.registrationRegion = region ?? new Value();
224
+ beneficiary.registrationRegionType = localityType ?? new Value();
225
+ beneficiary.registrationStreet = beneficiary.response?.addresses[0].streetName ?? '';
226
+ }
227
+ }
228
+ };
package/locales/en.json CHANGED
@@ -21,9 +21,11 @@
21
21
  "memberSave": "Error while saving members"
22
22
  },
23
23
  "toaster": {
24
+ "membersLimit": "The number of these members has been exceeded. The limit is: {text}",
25
+ "hasAlreadyMember": "Member with such IIN is already in statement",
24
26
  "noIinOrPhone": "Missing data to send SMS",
25
27
  "ESBDErrorMessage": "Incorrect data entered for this IIN",
26
- "phoneNotFoundInBMG": "Enter a number registered in BMG or register the client in BMG",
28
+ "phoneNotFoundInBMG": "Enter a number registered in BMG or register the contragent in BMG",
27
29
  "errorSumOrPercentage": "The percentage of payout amount cannot be less than or greater than 100",
28
30
  "fileWasDeleted": "File successfully deleted",
29
31
  "attachManagerError": "Attach the request to the manager",
@@ -55,7 +57,7 @@
55
57
  "fillOneFieldError": "You need to fill in at least one of the {text} fields",
56
58
  "notSavedMember": "You need to save the current {text} data",
57
59
  "copied": "Copied",
58
- "clientNotFound": "Client with this IIN not found",
60
+ "clientNotFound": "Contragent with this IIN not found",
59
61
  "needCalculate": "You need to calculate the insurance premium",
60
62
  "incorrectInput": "The value entered is incorrect",
61
63
  "error": "An error occurred",
@@ -74,15 +76,15 @@
74
76
  "reloadEverySeconds": "Refresh can be done every {text} seconds",
75
77
  "successReload": "Refreshed",
76
78
  "sendEverySeconds": "SMS can be sent every {text} seconds",
77
- "waitForClient": "Awaiting client confirmation",
79
+ "waitForClient": "Awaiting contragent confirmation",
78
80
  "noSuchProduct": "Error when navigating: incorrect link",
79
81
  "affiliationDocumentNotUploaded": "File not attached in the underwriting board decision",
80
82
  "documentNumberWasNotFilled": "Document number and date were not filled",
81
83
  "valueShouldBeHigher": "The value should be higher than {text} percent",
82
84
  "valueShouldBeBetween": "The value should be between {floor} and {ceil} percent",
83
- "needAgreement": "You need to obtain client's consent",
85
+ "needAgreement": "You need to obtain contragent's consent",
84
86
  "successOtp": "Confirmation code sent successfully",
85
- "hasSuccessOtp": "Client has already provided consent",
87
+ "hasSuccessOtp": "Contragent has already provided consent",
86
88
  "tokenExpire": "Waiting time has expired",
87
89
  "requiredBeneficiary": "You need to specify beneficiary's data",
88
90
  "requiredInsured": "You need to specify insured person's data",
@@ -221,20 +223,20 @@
221
223
  "isMemberIPDL": "Indication of belonging to and/or connections to a public official, their spouse, and close relatives?",
222
224
  "isPolicyholderBeneficiary": "Is the policyholder also the beneficiary?",
223
225
  "hasRepresentative": "Is the contract signed by a representative?",
224
- "isActOwnBehalf": "Is the client acting on their own behalf and in their own interests?",
226
+ "isActOwnBehalf": "Is the contragent acting on their own behalf and in their own interests?",
225
227
  "coverPeriod": "Coverage Period",
226
228
  "requestedSumInsured": "Requested Sum Insured",
227
229
  "insurancePremiumPerMonth": "Insurance Premium per Month",
228
230
  "noStatementCalculator": "Cost calculator without entering data",
229
231
  "calculator": "Calculator",
230
232
  "agreement": "Agreement",
231
- "clientsStatement": "Client's Statement",
233
+ "clientsStatement": "Contragent's Statement",
232
234
  "document": "Document",
233
235
  "documents": "Documents",
234
236
  "invoiceData": "Payment info",
235
237
  "statementAndSurvey": "Statement and Questionnaire",
236
238
  "underwriterDecisionDocument": "",
237
- "clientsCard": "Client Card",
239
+ "clientsCard": "Contragent Card",
238
240
  "insuranceProduct": "Insurance Product",
239
241
  "historyStatementsAndStatuses": "Application History and Statuses",
240
242
  "applicationNumber": "Application Number: ",
@@ -282,6 +284,7 @@
282
284
  "number": "Application Number",
283
285
  "iin": "IIN",
284
286
  "client": "Client",
287
+ "contragent": "Contrangent",
285
288
  "product": "Product",
286
289
  "status": "Application Status",
287
290
  "assignee": "Assignee",
@@ -375,6 +378,7 @@
375
378
  "new": "Подать заявление"
376
379
  },
377
380
  "labels": {
381
+ "newVersion": "New",
378
382
  "code": "Code",
379
383
  "codes": "Codes",
380
384
  "listType": "List type",
@@ -463,7 +467,7 @@
463
467
  "numbers": "Field should contain only numbers",
464
468
  "numbersSymbols": "Field should contain numbers",
465
469
  "ageExceeds": "Year cannot exceed 50 years",
466
- "age18": "Client should be adult",
470
+ "age18": "Contragent should be adult",
467
471
  "sums": "Field should contain only numbers",
468
472
  "iinRight": "IIN must consist of 12 digits",
469
473
  "onlySymbols": "Field should not contain numbers",
package/locales/kz.json CHANGED
@@ -21,9 +21,11 @@
21
21
  "memberSave": "Қатысушы мәліметтерін сақтау кезіндегі қате"
22
22
  },
23
23
  "toaster": {
24
+ "membersLimit": "Количество этих участников превышено. Лимит составляет: {text}",
25
+ "hasAlreadyMember": "Участник с таким ИИН уже есть в заявке",
24
26
  "noIinOrPhone": "SMS жіберу үшін дереккөз мәліметтер жоқ",
25
27
  "ESBDErrorMessage": "Бұл ЖСН бойынша дұрыс мәліметтер енгізілмеді",
26
- "phoneNotFoundInBMG": "БМГ-де тіркелген нөмірді енгізіңіз немесе клиентті БМГ-де тіркеу",
28
+ "phoneNotFoundInBMG": "БМГ-де тіркелген нөмірді енгізіңіз немесе контрагентті БМГ-де тіркеу",
27
29
  "errorSumOrPercentage": "Төлемдің пайызы 100-ден аз немесе асушыдан көп болмауы керек",
28
30
  "fileWasDeleted": "Файл сәтті өшірілді",
29
31
  "attachManagerError": "Менеджерге өтініші байланыстырыңыз",
@@ -55,7 +57,7 @@
55
57
  "fillOneFieldError": "{text} деректерін бірін толтыру қажет",
56
58
  "notSavedMember": "{text} мәліметтерін сақтау қажет",
57
59
  "copied": "Көшірілді",
58
- "clientNotFound": "Бұл ЖСН-ге қойылатын клиент табылмады",
60
+ "clientNotFound": "Бұл ЖСН-ге қойылатын контрагент табылмады",
59
61
  "needCalculate": "Сақтандыру сыйлықақысысын қайта есептеу қажет",
60
62
  "incorrectInput": "Енгізілген мән дұрыс емес",
61
63
  "error": "Қате пайда болды",
@@ -74,15 +76,15 @@
74
76
  "reloadEverySeconds": "Көшірме еткілеу үшін {text} секунд күту мүмкін",
75
77
  "successReload": "Жаңартылды",
76
78
  "sendEverySeconds": "SMS жіберу үшін {text} секунд күту мүмкін",
77
- "waitForClient": "Клиенттің растауын күтіңіз",
79
+ "waitForClient": "Контрагенттің растауын күтіңіз",
78
80
  "noSuchProduct": "Жолды өту кезінде қате: дұрыссыз сілтеме",
79
81
  "affiliationDocumentNotUploaded": "Төлем туралы кеңес сізбен бірге берілген файл жоқ",
80
82
  "documentNumberWasNotFilled": "Документ нөмірі және күні толтырылмаған",
81
83
  "valueShouldBeHigher": "Мән {text} пайыздан асуы керек",
82
84
  "valueShouldBeBetween": "Мән {floor} және {ceil} пайыз аралығында болуы керек",
83
- "needAgreement": "Мүмкіндікті клиентпен келісу керек",
85
+ "needAgreement": "Мүмкіндікті контрагентпен келісу керек",
84
86
  "successOtp": "Растау коды сәтті жіберілді",
85
- "hasSuccessOtp": "Клиенттің келісімі бар",
87
+ "hasSuccessOtp": "Контрагенттің келісімі бар",
86
88
  "tokenExpire": "Күту уақыты аяқталды",
87
89
  "requiredBeneficiary": "Бенефициар деректері керек",
88
90
  "requiredInsured": "Зақыпталу қажет",
@@ -221,20 +223,20 @@
221
223
  "isMemberIPDL": "Социальдық тұлғалар мен олардың отбасының арасындағы өзара байланыстықты және байланысты екендігі туралы белгіленіш болатыны",
222
224
  "isPolicyholderBeneficiary": "Сақтанушы азаматтарға арналғаны екенін ма?",
223
225
  "hasRepresentative": "Шарттың имзаға алушысы - представитель екеніні білдіреді ме?",
224
- "isActOwnBehalf": "Клиент өзінің атымен және өз мүлкіншілігімен өзі жасайды ма?",
226
+ "isActOwnBehalf": "Контрагент өзінің атымен және өз мүлкіншілігімен өзі жасайды ма?",
225
227
  "coverPeriod": "Мөлшер",
226
228
  "requestedSumInsured": "Сұраулы сақталған сомасы",
227
229
  "insurancePremiumPerMonth": "Айына шығыру",
228
230
  "noStatementCalculator": "Деректерді енгізбей калғанда бағасыны таңдамау калькуляторы",
229
231
  "calculator": "Калькулятор",
230
232
  "agreement": "Келісім",
231
- "clientsStatement": "Клиенттің заявы",
233
+ "clientsStatement": "Контрагенттің заявы",
232
234
  "document": "Деректер",
233
235
  "documents": "Деректер",
234
236
  "invoiceData": "Төлем туралы ақпарат",
235
237
  "statementAndSurvey": "Заявление және сауалнама",
236
238
  "underwriterDecisionDocument": "",
237
- "clientsCard": "Клиенттің картасы",
239
+ "clientsCard": "Контрагенттің картасы",
238
240
  "insuranceProduct": "Страховой продукт",
239
241
  "historyStatementsAndStatuses": "Тарихи заявкалар және статустар",
240
242
  "applicationNumber": "Өтініш нөмірі: ",
@@ -282,6 +284,7 @@
282
284
  "number": "Өтінім нөмірі",
283
285
  "iin": "ЖСН",
284
286
  "client": "Клиент",
287
+ "contragent": "Контрагент",
285
288
  "product": "Өнім",
286
289
  "status": "Өтінім статусы",
287
290
  "assignee": "Орындаушы",
@@ -375,6 +378,7 @@
375
378
  "new": "Өтінім жасау"
376
379
  },
377
380
  "labels": {
381
+ "newVersion": "Жаңа версия",
378
382
  "code": "Код",
379
383
  "codes": "Коды",
380
384
  "listType": "Тип списка",
@@ -463,7 +467,7 @@
463
467
  "numbers": "Тек сандарды енгізіңіз",
464
468
  "numbersSymbols": "Сандарды енгізіңіз",
465
469
  "ageExceeds": "Жылдың 50-ден асапауы керек",
466
- "age18": "Клиент 18 жас болуы керек",
470
+ "age18": "Контрагент 18 жас болуы керек",
467
471
  "sums": "Тек сандарды енгізіңіз",
468
472
  "iinRight": "ЖСН/БИН 12 сандан тұруы керек",
469
473
  "onlySymbols": "Өрісте сан болмауы керек",
package/locales/ru.json CHANGED
@@ -21,9 +21,11 @@
21
21
  "memberSave": "Ошибка при сохранении данных участников"
22
22
  },
23
23
  "toaster": {
24
+ "membersLimit": "Количество этих участников превышено. Лимит составляет: {text}",
25
+ "hasAlreadyMember": "Участник с таким ИИН уже есть в заявке",
24
26
  "noIinOrPhone": "Отсутствуют данные для отправки СМС",
25
27
  "ESBDErrorMessage": "Введены не корректные данные по этому ИИН",
26
- "phoneNotFoundInBMG": "Введите номер зарегистрированный в БМГ или зарегистрируйте клиента в БМГ",
28
+ "phoneNotFoundInBMG": "Введите номер зарегистрированный в БМГ или зарегистрируйте контрагента в БМГ",
27
29
  "errorSumOrPercentage": "Процент от суммы выплат не может быть меньше или больше 100",
28
30
  "fileWasDeleted": "Файл успешно удален",
29
31
  "attachManagerError": "Прикрепите заявку менеджеру",
@@ -55,7 +57,7 @@
55
57
  "fillOneFieldError": "Нужно заполнить одно из полей {text}",
56
58
  "notSavedMember": "Нужно сохранить актуальные данные {text}",
57
59
  "copied": "Скопировано",
58
- "clientNotFound": "Клиент с таким ИИН не обнаружен",
60
+ "clientNotFound": "Контрагент с таким ИИН не обнаружен",
59
61
  "needCalculate": "Нужно рассчитать страховую премию",
60
62
  "incorrectInput": "Значение введено некорректно",
61
63
  "error": "Произошла ошибка ",
@@ -74,15 +76,15 @@
74
76
  "reloadEverySeconds": "Обновление можно делать каждые {text} секунд",
75
77
  "successReload": "Обновлено",
76
78
  "sendEverySeconds": "СМС можно отправлять каждые {text} секунд ",
77
- "waitForClient": "Ожидайте подтверждения клиента",
79
+ "waitForClient": "Ожидайте подтверждения контрагента",
78
80
  "noSuchProduct": "Ошибка при переходе: неправильная ссылка",
79
81
  "affiliationDocumentNotUploaded": "Не прикреплен файл в решении андеррайтингового совета",
80
82
  "documentNumberWasNotFilled": "Номер документа и дата не были заполнены",
81
83
  "valueShouldBeHigher": "Значение должно быть больше {text} процентов",
82
84
  "valueShouldBeBetween": "Значение должно быть в промежутке от {floor} до {ceil} процентов",
83
- "needAgreement": "Нужно получить согласие клиента",
85
+ "needAgreement": "Нужно получить согласие контрагента",
84
86
  "successOtp": "Код подтверждения отправлен успешно",
85
- "hasSuccessOtp": "По клиенту уже имеется согласие",
87
+ "hasSuccessOtp": "По контрагенту уже имеется согласие",
86
88
  "tokenExpire": "Истекло время ожидания",
87
89
  "requiredBeneficiary": "Необходимо указать данные выгодоприобретателя",
88
90
  "requiredInsured": "Необходимо указать данные застрахованного",
@@ -142,7 +144,7 @@
142
144
  "fromGBDFL": "Государственная база данных физических лиц",
143
145
  "fromGKB": "Государственное кредитное бюро",
144
146
  "sendSMS": "Отправить СМС",
145
- "sendOtp": "Отправить OTP",
147
+ "sendOtp": "Отправить код подтверждения",
146
148
  "check": "Проверить",
147
149
  "toPayment": "Перейти к оплате",
148
150
  "calcSum": "Рассчитать сумму",
@@ -221,20 +223,20 @@
221
223
  "isMemberIPDL": "Отметка о принадлежности и/или причастности к публичному должностному лицу, его супруге (супругу) и близким родственникам?",
222
224
  "isPolicyholderBeneficiary": "Является ли страхователь выгодоприобретателем?",
223
225
  "hasRepresentative": "Подписантом договора выступает представитель? ",
224
- "isActOwnBehalf": " Клиент действует от своего имени и в своих интересах?",
226
+ "isActOwnBehalf": " Контрагент действует от своего имени и в своих интересах?",
225
227
  "coverPeriod": "Срок",
226
228
  "requestedSumInsured": "Запрашиваемая сумма",
227
229
  "insurancePremiumPerMonth": "Премия в месяц",
228
230
  "noStatementCalculator": "Калькулятор стоимости без ввода данных",
229
231
  "calculator": "Калькулятор",
230
232
  "agreement": "Согласие",
231
- "clientsStatement": "Заявление клиента",
233
+ "clientsStatement": "Заявление контрагента",
232
234
  "document": "Документ",
233
235
  "documents": "Документы",
234
236
  "invoiceData": "Данные об оплате",
235
237
  "statementAndSurvey": "Заявление и анкета",
236
238
  "underwriterDecisionDocument": "",
237
- "clientsCard": "Карта клиента",
239
+ "clientsCard": "Карта контрагента",
238
240
  "insuranceProduct": "Страховой продукт",
239
241
  "historyStatementsAndStatuses": "История заявок и статусы",
240
242
  "applicationNumber": "Номер заявки: ",
@@ -282,6 +284,7 @@
282
284
  "number": "Номер заявки",
283
285
  "iin": "ИИН",
284
286
  "client": "Клиент",
287
+ "contragent": "Контрагент",
285
288
  "product": "Продукт",
286
289
  "status": "Статус заявки",
287
290
  "assignee": "Исполнитель",
@@ -375,6 +378,7 @@
375
378
  "new": "Подать заявление"
376
379
  },
377
380
  "labels": {
381
+ "newVersion": "Новая версия",
378
382
  "code": "Код",
379
383
  "codes": "Коды",
380
384
  "listType": "Тип списка",
@@ -463,7 +467,7 @@
463
467
  "numbers": "Поле должно содержать только цифры",
464
468
  "numbersSymbols": "Поле должно содержать цифры",
465
469
  "ageExceeds": "Год не может превышать больше 50 лет",
466
- "age18": "Клиент должен быть совершеннолетним",
470
+ "age18": "Контрагент должен быть совершеннолетним",
467
471
  "sums": "Поле должно содержать только цифры",
468
472
  "iinRight": "ИИН/БИН должен состоять из 12 цифр",
469
473
  "onlySymbols": "Поле не должно содержать число",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.8-beta.26",
3
+ "version": "0.0.8-beta.28",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -44,11 +44,13 @@
44
44
  "jwt-decode": "^3.1.2",
45
45
  "maska": "1.5.0",
46
46
  "pinia": "^2.1.4",
47
+ "typedoc": "^0.24.8",
48
+ "typescript": "5.0.4",
47
49
  "v-idle-3": "^0.3.14",
48
50
  "vue-i18n": "^9.2.2",
49
51
  "vue-json-pretty": "^2.2.4",
50
52
  "vue-toastification": "^2.0.0-rc.5",
51
53
  "vue-uuid": "^3.0.0",
52
- "vuetify": "^3.3.4"
54
+ "vuetify": "^3.3.6"
53
55
  }
54
56
  }
@@ -8,6 +8,7 @@ import Maska from 'maska';
8
8
  import i18n from '@/configs/i18n';
9
9
 
10
10
  export default defineNuxtPlugin(nuxtApp => {
11
+ //@ts-ignore
11
12
  nuxtApp.vueApp.use(Vidle, {});
12
13
  nuxtApp.vueApp.use(Maska);
13
14
  nuxtApp.vueApp.use(i18n);
@@ -828,12 +828,15 @@ export const useDataStore = defineStore('data', {
828
828
  if (
829
829
  this.formStore.applicationData &&
830
830
  this.formStore.applicationData.insuredApp &&
831
- this.formStore.applicationData.insuredApp.length &&
832
- this.formStore.applicationData.insuredApp.every(i => i.iin !== data.iin) &&
833
- data.id !== null
831
+ this.formStore.applicationData.insuredApp.length
834
832
  ) {
835
- await this.api.deleteMember('Insured', data.id);
836
- delete data.id;
833
+ await this.deleteInsuredLogic();
834
+ if(
835
+ this.formStore.applicationData.insuredApp.every(i => i.iin !== data.iin) &&
836
+ data.id !== null) {
837
+ await this.api.deleteMember('Insured', data.id);
838
+ delete data.id;
839
+ }
837
840
  }
838
841
  data.isDisability = this.formStore.isPolicyholderInsured ? false : member.isDisability.nameRu == 'Да';
839
842
  data.disabilityGroupId = data.isDisability ? member.disabilityGroupId.id : null;
@@ -1331,6 +1334,83 @@ export const useDataStore = defineStore('data', {
1331
1334
  }
1332
1335
  return this.formStore.definedAnswersId[whichSurvey];
1333
1336
  },
1337
+ getConditionsData() {
1338
+ const conditionsData = {
1339
+ policyAppDto: {
1340
+ id: this.formStore.applicationData.policyAppDto.id,
1341
+ processInstanceId: this.formStore.applicationData.policyAppDto.processInstanceId,
1342
+ policyId: null,
1343
+ policyNumber: null,
1344
+ contractDate: this.currentDate(),
1345
+ amount: this.formStore.productConditionsForm.requestedSumInsured != null ? Number(this.formStore.productConditionsForm.requestedSumInsured.replace(/\s/g, '')) : null,
1346
+ premium:
1347
+ this.formStore.productConditionsForm.insurancePremiumPerMonth != null ? Number(this.formStore.productConditionsForm.insurancePremiumPerMonth.replace(/\s/g, '')) : null,
1348
+ isSpokesman: this.formStore.hasRepresentative,
1349
+ coverPeriod: this.formStore.productConditionsForm.coverPeriod,
1350
+ payPeriod: this.formStore.productConditionsForm.coverPeriod,
1351
+ annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
1352
+ indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
1353
+ ? this.formStore.productConditionsForm.processIndexRate.id
1354
+ : this.processIndexRate.find(i => i.code === '0')?.id,
1355
+ paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
1356
+ lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply),
1357
+ lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive),
1358
+ adbMultiply: formatProcents(this.formStore.productConditionsForm.adbMultiply),
1359
+ adbAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
1360
+ disabilityMultiply: formatProcents(this.formStore.productConditionsForm.disabilityMultiply),
1361
+ disabilityAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
1362
+ riskGroup: this.formStore.productConditionsForm.riskGroup?.id ? this.formStore.productConditionsForm.riskGroup.id : 1,
1363
+ },
1364
+ addCoversDto: this.formStore.additionalInsuranceTerms,
1365
+ };
1366
+ if (this.isKazyna) {
1367
+ conditionsData.policyAppDto.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
1368
+ conditionsData.policyAppDto.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
1369
+ conditionsData.policyAppDto.currencyExchangeRate = this.currencies.usd;
1370
+ }
1371
+ if (this.isLiferenta) {
1372
+ conditionsData.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
1373
+ conditionsData.policyAppDto.annuityTypeId = this.formStore.productConditionsForm.typeAnnuityInsurance.id;
1374
+ conditionsData.policyAppDto.paymentPeriod = this.formStore.productConditionsForm.termAnnuityPayments;
1375
+ conditionsData.policyAppDto.annuityPaymentPeriodId = this.formStore.productConditionsForm.periodAnnuityPayment.id;
1376
+ }
1377
+ return conditionsData;
1378
+ },
1379
+ async clearAddCovers(coverCode, coverValue) {
1380
+ if (!coverCode || !coverValue) return;
1381
+ const termCoverIndex = applicationData.addCoversDto.findIndex(i => i.coverTypeCode === coverCode);
1382
+ if (termCoverIndex !== -1) {
1383
+ const answers = await this.getAdditionalInsuranceTermsAnswers(applicationData.addCoversDto[termCoverIndex].coverTypeId);
1384
+ if (answers.length) {
1385
+ const newCover = answers.find(i => i.code === coverValue);
1386
+ if (newCover) {
1387
+ applicationData.addCoversDto[termCoverIndex].coverSumId = newCover.id;
1388
+ applicationData.addCoversDto[termCoverIndex].coverSumName = newCover.nameRu;
1389
+ }
1390
+ }
1391
+ }
1392
+ },
1393
+ async deleteInsuredLogic() {
1394
+ const applicationData = this.getConditionsData();
1395
+ const clearCovers = [{ code: 10, value: 'excluded' }];
1396
+ await Promise.allSettled(
1397
+ clearCovers.map(async cover => {
1398
+ await this.clearAddCovers(cover.code, cover.value);
1399
+ }),
1400
+ );
1401
+ if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth) {
1402
+ applicationData.policyAppDto.premium = null;
1403
+ }
1404
+ if (!!this.formStore.productConditionsForm.requestedSumInsured) {
1405
+ applicationData.policyAppDto.amount = null;
1406
+ }
1407
+ try {
1408
+ await this.api.setApplication(applicationData);
1409
+ this.showToaster('info', this.t('toaster.needToRecalculate'));
1410
+ } catch (err) {
1411
+ ErrorHandler(err);
1412
+ }
1413
+ },
1334
1414
  async getPaymentTable(id) {
1335
1415
  try {
1336
1416
  const paymentResultTable = await this.api.calculatePremuim(id);
@@ -1407,80 +1487,29 @@ export const useDataStore = defineStore('data', {
1407
1487
  async calculate(taskId) {
1408
1488
  this.isLoading = true;
1409
1489
  try {
1410
- let form1 = {
1411
- policyAppDto: {
1412
- id: this.formStore.applicationData.policyAppDto.id,
1413
- processInstanceId: this.formStore.applicationData.policyAppDto.processInstanceId,
1414
- policyId: null,
1415
- policyNumber: null,
1416
- contractDate: this.currentDate(),
1417
- amount: this.formStore.productConditionsForm.requestedSumInsured != null ? Number(this.formStore.productConditionsForm.requestedSumInsured.replace(/\s/g, '')) : null,
1418
- premium:
1419
- this.formStore.productConditionsForm.insurancePremiumPerMonth != null
1420
- ? Number(this.formStore.productConditionsForm.insurancePremiumPerMonth.replace(/\s/g, ''))
1421
- : null,
1422
- isSpokesman: this.formStore.hasRepresentative,
1423
- coverPeriod: this.formStore.productConditionsForm.coverPeriod,
1424
- payPeriod: this.formStore.productConditionsForm.coverPeriod,
1425
- annualIncome: this.formStore.productConditionsForm.annualIncome ? Number(this.formStore.productConditionsForm.annualIncome.replace(/\s/g, '')) : null,
1426
- indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
1427
- ? this.formStore.productConditionsForm.processIndexRate.id
1428
- : this.processIndexRate.find(i => i.code === '0')?.id,
1429
- paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
1430
- lifeMultiply: formatProcents(this.formStore.productConditionsForm.lifeMultiply),
1431
- lifeAdditive: formatProcents(this.formStore.productConditionsForm.lifeAdditive),
1432
- adbMultiply: formatProcents(this.formStore.productConditionsForm.adbMultiply),
1433
- adbAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
1434
- disabilityMultiply: formatProcents(this.formStore.productConditionsForm.disabilityMultiply),
1435
- disabilityAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
1436
- riskGroup: this.formStore.productConditionsForm.riskGroup?.id ? this.formStore.productConditionsForm.riskGroup.id : 1,
1437
- },
1438
- addCoversDto: this.formStore.additionalInsuranceTerms,
1439
- };
1490
+ const id = this.formStore.applicationData.processInstanceId;
1491
+ await this.api.setApplication(this.getConditionsData());
1492
+ const result = ref();
1493
+ result.value = await this.api.getCalculation(id);
1494
+ const applicationData = await this.api.getApplicationData(taskId);
1495
+ this.formStore.applicationData = applicationData;
1496
+ this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
1440
1497
  if (this.isKazyna) {
1441
- form1.policyAppDto.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
1442
- form1.policyAppDto.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
1443
- form1.policyAppDto.currencyExchangeRate = this.currencies.usd;
1444
- }
1445
- if (this.isLiferenta) {
1446
- form1.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
1447
- form1.policyAppDto.annuityTypeId = this.formStore.productConditionsForm.typeAnnuityInsurance.id;
1448
- form1.policyAppDto.paymentPeriod = this.formStore.productConditionsForm.termAnnuityPayments;
1449
- form1.policyAppDto.annuityPaymentPeriodId = this.formStore.productConditionsForm.periodAnnuityPayment.id;
1450
- }
1451
- try {
1452
- let id = this.formStore.applicationData.processInstanceId;
1453
-
1454
- await this.api.setApplication(form1);
1455
- let result;
1456
- try {
1457
- result = await this.api.getCalculation(id);
1458
- } catch (err) {
1459
- ErrorHandler(err);
1460
- }
1461
-
1462
- const applicationData = await this.api.getApplicationData(taskId);
1463
- this.formStore.applicationData = applicationData;
1464
- this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
1465
- if (this.isKazyna) {
1466
- if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
1467
- this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result / this.currencies.usd);
1468
- } else {
1469
- this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(result / this.currencies.usd);
1470
- }
1471
- }
1472
- if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
1473
- this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result);
1498
+ if (this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar != null) {
1499
+ this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
1474
1500
  } else {
1475
- this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result);
1476
- }
1477
- if (this.isLiferenta) {
1478
- this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
1501
+ this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(result.value / this.currencies.usd);
1479
1502
  }
1480
- this.showToaster('success', this.t('toaster.calculated'), 1000);
1481
- } catch (err) {
1482
- ErrorHandler(err);
1483
1503
  }
1504
+ if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
1505
+ this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result.value);
1506
+ } else {
1507
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result.value);
1508
+ }
1509
+ if (this.isLiferenta) {
1510
+ this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
1511
+ }
1512
+ this.showToaster('success', this.t('toaster.calculated'), 1000);
1484
1513
  } catch (err) {
1485
1514
  ErrorHandler(err);
1486
1515
  }
@@ -1615,9 +1644,9 @@ export const useDataStore = defineStore('data', {
1615
1644
  this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
1616
1645
  if (insuredData && insuredData.length) {
1617
1646
  insuredData.forEach((each, index) => {
1647
+ this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
1618
1648
  const relationDegree = this.relations.find(i => i.ids == each.relationId);
1619
1649
  this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
1620
- this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
1621
1650
  });
1622
1651
  }
1623
1652
 
@@ -1727,13 +1756,6 @@ export const useDataStore = defineStore('data', {
1727
1756
  ErrorHandler(err);
1728
1757
  }
1729
1758
  },
1730
- async setApplication() {
1731
- try {
1732
- await this.api.setApplication(this.formStore.applicationData);
1733
- } catch (err) {
1734
- console.log(err);
1735
- }
1736
- },
1737
1759
  async deleteTask(taskId) {
1738
1760
  this.isLoading = true;
1739
1761
  try {
@@ -1774,7 +1796,7 @@ export const useDataStore = defineStore('data', {
1774
1796
  try {
1775
1797
  this.isLoading = true;
1776
1798
  await this.api.claimTask(this.formStore.applicationTaskId);
1777
- await this.getApplicationData(taskId, false, false, false);
1799
+ await this.getApplicationData(taskId, false, false, false, false);
1778
1800
  this.showToaster('success', this.t('toaster.successOperation'), 3000);
1779
1801
  } catch (err) {
1780
1802
  ErrorHandler(err);
@@ -1883,10 +1905,6 @@ export const useDataStore = defineStore('data', {
1883
1905
  this.formStore[whichForm][index].jobPlace = this.formStore.applicationData[whichMember][index].jobName;
1884
1906
  }
1885
1907
  },
1886
- findObject(from, key, searchKey) {
1887
- const found = this[from].find(i => i[key] == searchKey);
1888
- return found || new Value();
1889
- },
1890
1908
  async signDocument() {
1891
1909
  try {
1892
1910
  if (this.formStore.signUrls.length) {
@@ -1979,7 +1997,7 @@ export const useDataStore = defineStore('data', {
1979
1997
  };
1980
1998
  const recalculatedValue = await this.api.reCalculate(data);
1981
1999
  if (!!recalculatedValue) {
1982
- await this.getApplicationData(taskId, false, false, false);
2000
+ await this.getApplicationData(taskId, false, false, false, true);
1983
2001
  this.showToaster(
1984
2002
  'success',
1985
2003
  `${this.t('toaster.successRecalculation')}. ${whichSum == 'insurancePremiumPerMonth' ? 'Страховая премия' : 'Страховая сумма'}: ${this.getNumberWithSpaces(