hl-core 0.0.9-beta.2 → 0.0.9-beta.20

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.
Files changed (63) hide show
  1. package/api/base.api.ts +684 -0
  2. package/api/index.ts +2 -620
  3. package/api/interceptors.ts +52 -14
  4. package/components/Button/Btn.vue +3 -3
  5. package/components/Complex/ContentBlock.vue +1 -1
  6. package/components/Complex/MessageBlock.vue +1 -1
  7. package/components/Complex/Page.vue +7 -1
  8. package/components/Complex/WhiteBlock.vue +7 -0
  9. package/components/Dialog/Dialog.vue +2 -2
  10. package/components/Dialog/FamilyDialog.vue +5 -5
  11. package/components/Form/FormBlock.vue +36 -29
  12. package/components/Form/FormSection.vue +2 -2
  13. package/components/Form/FormTextSection.vue +3 -3
  14. package/components/Form/FormToggle.vue +3 -3
  15. package/components/Form/ManagerAttachment.vue +55 -42
  16. package/components/Form/ProductConditionsBlock.vue +73 -20
  17. package/components/Input/EmptyFormField.vue +1 -1
  18. package/components/Input/FileInput.vue +8 -3
  19. package/components/Input/Monthpicker.vue +33 -0
  20. package/components/Input/PanelInput.vue +5 -1
  21. package/components/Input/RoundedEmptyField.vue +5 -0
  22. package/components/Input/RoundedSelect.vue +13 -0
  23. package/components/Layout/Drawer.vue +2 -1
  24. package/components/Layout/Header.vue +1 -1
  25. package/components/Layout/SettingsPanel.vue +5 -9
  26. package/components/List/ListEmpty.vue +1 -1
  27. package/components/Menu/MenuHover.vue +1 -1
  28. package/components/Menu/MenuNav.vue +1 -1
  29. package/components/Menu/MenuNavItem.vue +4 -4
  30. package/components/Pages/Anketa.vue +88 -47
  31. package/components/Pages/Auth.vue +9 -9
  32. package/components/Pages/ContragentForm.vue +505 -0
  33. package/components/Pages/Documents.vue +5 -5
  34. package/components/Pages/InvoiceInfo.vue +2 -2
  35. package/components/Pages/MemberForm.vue +215 -59
  36. package/components/Pages/ProductAgreement.vue +1 -3
  37. package/components/Pages/ProductConditions.vue +677 -151
  38. package/components/Panel/PanelHandler.vue +86 -21
  39. package/components/Panel/PanelSelectItem.vue +18 -3
  40. package/components/Utilities/IconBorder.vue +17 -0
  41. package/composables/axios.ts +1 -1
  42. package/composables/classes.ts +276 -11
  43. package/composables/constants.ts +43 -0
  44. package/composables/index.ts +40 -4
  45. package/composables/styles.ts +20 -10
  46. package/configs/i18n.ts +0 -2
  47. package/layouts/default.vue +5 -2
  48. package/layouts/full.vue +1 -1
  49. package/locales/ru.json +202 -6
  50. package/nuxt.config.ts +1 -1
  51. package/package.json +30 -39
  52. package/pages/500.vue +2 -2
  53. package/pages/Token.vue +1 -0
  54. package/plugins/helperFunctionsPlugins.ts +6 -7
  55. package/plugins/vuetifyPlugin.ts +2 -0
  56. package/store/data.store.ts +541 -211
  57. package/store/form.store.ts +11 -1
  58. package/store/member.store.ts +1 -1
  59. package/store/rules.ts +37 -2
  60. package/types/enum.ts +6 -0
  61. package/types/index.ts +145 -31
  62. package/components/Button/BtnIcon.vue +0 -47
  63. package/locales/kz.json +0 -585
@@ -1,7 +1,14 @@
1
1
  <template>
2
2
  <section class="flex flex-col gap-4 px-[10px]">
3
- <v-form ref="vForm" @submit="submitForm" class="max-h-[82svh] overflow-y-scroll">
4
- <base-form-section v-if="whichProduct === 'gons'" :title="$dataStore.t('productConditionsForm.requestedProductConditions')" :class="[$libStyles.textSimple]">
3
+ <v-form ref="vForm" @submit="submitForm" class="max-h-[80svh] overflow-y-scroll">
4
+ <base-message-block
5
+ v-if="isCalculator"
6
+ class="mt-4"
7
+ :color="$styles.blueBgLight"
8
+ :text="$dataStore.t('preliminaryCalculation')"
9
+ icon="mdi-alert text-[#FCB016]"
10
+ ></base-message-block>
11
+ <base-form-section v-if="whichProduct === 'gons'" :title="$dataStore.t('productConditionsForm.requestedProductConditions')" :class="[$styles.textSimple]">
5
12
  <base-form-text-section
6
13
  class="mb-4"
7
14
  title="Инвалидность I или II группы по причине несчастного случая, начиная с третьего года по любой причине, с освобождением от уплаты страховых взносов"
@@ -54,14 +61,14 @@
54
61
  :clearable="isRecalculationDisabled === false"
55
62
  :label="$dataStore.t('percent') + `Life Multiply`"
56
63
  :readonly="isRecalculationDisabled"
57
- :rules="$dataStore.rules.recalculationMultiply"
64
+ :rules="whichProduct === 'gons' ? $dataStore.rules.recalculationMultiplyBetween : $dataStore.rules.recalculationMultiply"
58
65
  />
59
66
  <base-form-input
60
67
  v-model="productConditionsForm.lifeAdditive"
61
68
  :maska="$maska.numbers"
62
69
  :clearable="isRecalculationDisabled === false"
63
70
  :label="$dataStore.t('percent') + `Life Additive`"
64
- :readonly="isRecalculationDisabled"
71
+ :readonly="readonlyLifeAdditive"
65
72
  :rules="$dataStore.rules.recalculationAdditive"
66
73
  />
67
74
  <base-form-input
@@ -87,21 +94,21 @@
87
94
  :maska="$maska.numbers"
88
95
  :clearable="isRecalculationDisabled === false"
89
96
  :label="$dataStore.t('percent') + `Disability Multiply`"
90
- :readonly="isRecalculationDisabled"
91
- :rules="$dataStore.rules.recalculationMultiply"
97
+ :readonly="readonlyDisabilityMultiply"
98
+ :rules="whichProduct === 'gons' ? [] : $dataStore.rules.recalculationMultiply"
92
99
  />
93
100
  <base-form-input
94
101
  v-model="productConditionsForm.disabilityAdditive"
95
102
  :maska="$maska.numbers"
96
103
  :clearable="isRecalculationDisabled === false"
97
104
  :label="$dataStore.t('percent') + `Disability Additive`"
98
- :readonly="isRecalculationDisabled"
105
+ :readonly="readonlyDisabilityAdditive"
99
106
  :rules="$dataStore.rules.recalculationAdditive"
100
107
  />
101
108
  <base-panel-input
102
109
  v-if="hasRiskGroup"
103
110
  v-model="productConditionsForm.riskGroup"
104
- :value="productConditionsForm.riskGroup.nameRu"
111
+ :value="productConditionsForm.riskGroup?.nameRu"
105
112
  :label="$dataStore.t('productConditionsForm.riskGroup')"
106
113
  :clearable="isRecalculationDisabled === false"
107
114
  :readonly="isRecalculationDisabled"
@@ -109,8 +116,8 @@
109
116
  @append="openPanel($dataStore.t('productConditionsForm.riskGroup'), $dataStore.riskGroup, 'riskGroup')"
110
117
  />
111
118
  </base-form-section>
112
- <base-form-section :title="$dataStore.t('generalConditions')">
113
- <div v-if="isRecalculation && ($route.params.taskId === '0' || $dataStore.isCalculator)">
119
+ <base-form-section v-if="hasDefault" :title="$dataStore.t('generalConditions')">
120
+ <div v-if="isCalculator && ($route.params.taskId === '0' || $dataStore.isCalculator)">
114
121
  <base-form-input
115
122
  v-model="productConditionsForm.signDate"
116
123
  :maska="$maska.date"
@@ -120,6 +127,7 @@
120
127
  append-inner-icon="mdi mdi-calendar-blank-outline"
121
128
  />
122
129
  <base-form-input
130
+ v-if="hasBirthDate"
123
131
  v-model="productConditionsForm.birthDate"
124
132
  :maska="$maska.date"
125
133
  :readonly="isDisabled"
@@ -129,8 +137,9 @@
129
137
  append-inner-icon="mdi mdi-calendar-blank-outline"
130
138
  />
131
139
  <base-panel-input
140
+ v-if="hasGender"
132
141
  v-model="productConditionsForm.gender"
133
- :value="productConditionsForm.gender.nameRu"
142
+ :value="productConditionsForm.gender?.nameRu"
134
143
  :readonly="isDisabled"
135
144
  :clearable="!isDisabled"
136
145
  :label="$dataStore.t('form.gender')"
@@ -142,15 +151,15 @@
142
151
  <base-form-input
143
152
  v-model="productConditionsForm.coverPeriod"
144
153
  :maska="$maska.numbers"
145
- :readonly="isDisabled"
154
+ :readonly="isDisabledCoverPeriod"
146
155
  :clearable="!isDisabled"
147
156
  :rules="coverPeriodRule"
148
- :label="$dataStore.t(whichProduct === 'gons' ? 'productConditionsForm.coverPeriodFrom3to20' : 'productConditionsForm.coverPeriod')"
157
+ :label="coverPeriodLabel"
149
158
  />
150
159
  <base-panel-input
151
160
  v-if="hasPaymentPeriod"
152
161
  v-model="productConditionsForm.paymentPeriod"
153
- :value="productConditionsForm.paymentPeriod.nameRu"
162
+ :value="productConditionsForm.paymentPeriod?.nameRu"
154
163
  :readonly="isDisabled"
155
164
  :clearable="!isDisabled"
156
165
  :rules="$rules.objectRequired"
@@ -161,7 +170,7 @@
161
170
  <base-panel-input
162
171
  v-if="hasProcessIndexRate"
163
172
  v-model="productConditionsForm.processIndexRate"
164
- :value="productConditionsForm.processIndexRate.nameRu"
173
+ :value="productConditionsForm.processIndexRate?.nameRu"
165
174
  :readonly="isDisabled"
166
175
  :clearable="!isDisabled"
167
176
  :rules="$rules.objectRequired"
@@ -172,8 +181,8 @@
172
181
  <base-form-input
173
182
  v-model="productConditionsForm.requestedSumInsured"
174
183
  :readonly="isDisabledSum"
175
- :clearable="!isDisabled"
176
- :rules="requestedSumInsured"
184
+ :clearable="!isDisabledSum"
185
+ :rules="requestedSumInsuredRule"
177
186
  :label="requestedSumInsuredLabel"
178
187
  :suffix="$constants.currencySymbols.kzt"
179
188
  @input="onInputSum"
@@ -183,8 +192,8 @@
183
192
  v-if="hasRequestedSumInsuredInDollar"
184
193
  v-model="productConditionsForm.requestedSumInsuredInDollar"
185
194
  :readonly="isDisabledSumDollar"
186
- :clearable="!isDisabled"
187
- :rules="requestedSumInsured"
195
+ :clearable="!isDisabledSumDollar"
196
+ :rules="requestedSumInsuredRule"
188
197
  :label="$dataStore.t('productConditionsForm.requestedSumInsuredInDollar')"
189
198
  :suffix="$constants.currencySymbols.usd"
190
199
  @input="onInputSumDollar"
@@ -192,10 +201,10 @@
192
201
  />
193
202
  <base-form-input
194
203
  v-model="productConditionsForm.insurancePremiumPerMonth"
195
- :readonly="isDisabled"
196
- :clearable="!isDisabled"
197
- :rules="insurancePremiumPerMonth"
198
- :label="$dataStore.t('productConditionsForm.insurancePremiumAmount')"
204
+ :readonly="insurancePremiumPerMonthDisabled"
205
+ :clearable="!insurancePremiumPerMonthDisabled"
206
+ :rules="insurancePremiumPerMonthRule"
207
+ :label="insurancePremiumPerMonthLabel"
199
208
  :suffix="$constants.currencySymbols.kzt"
200
209
  @input="onInputInsurancePremiumPerMonth"
201
210
  @onClear="onClearPremium"
@@ -203,9 +212,9 @@
203
212
  <base-form-input
204
213
  v-if="hasInsurancePremiumPerMonthInDollar"
205
214
  v-model="productConditionsForm.insurancePremiumPerMonthInDollar"
206
- :readonly="isDisabled"
207
- :clearable="!isDisabled"
208
- :rules="insurancePremiumPerMonth"
215
+ :readonly="insurancePremiumPerMonthDisabled"
216
+ :clearable="!insurancePremiumPerMonthDisabled"
217
+ :rules="insurancePremiumPerMonthRule"
209
218
  :label="$dataStore.t('productConditionsForm.insurancePremiumAmountInDollar')"
210
219
  :suffix="$constants.currencySymbols.usd"
211
220
  @input="onInputInsurancePremiumPerMonthInDollar"
@@ -218,8 +227,47 @@
218
227
  :label="$dataStore.t('productConditionsForm.dollarExchangeRateNBRK')"
219
228
  :suffix="$constants.currencySymbols.kzt"
220
229
  />
230
+ <base-form-input
231
+ v-if="whichProduct === 'gons' && isCalculator"
232
+ v-model="productConditionsForm.totalAmount5"
233
+ :readonly="true"
234
+ :label="$dataStore.t('productConditionsForm.totalAmount5')"
235
+ :suffix="$constants.currencySymbols.kzt"
236
+ />
237
+ <base-form-input
238
+ v-if="whichProduct === 'gons' && isCalculator"
239
+ v-model="productConditionsForm.statePremium5"
240
+ :readonly="true"
241
+ :label="$dataStore.t('productConditionsForm.statePremium5')"
242
+ :suffix="$constants.currencySymbols.kzt"
243
+ />
244
+ <base-form-input
245
+ v-if="whichProduct === 'gons' && isCalculator"
246
+ v-model="productConditionsForm.totalAmount7"
247
+ :readonly="true"
248
+ :label="$dataStore.t('productConditionsForm.totalAmount7')"
249
+ :suffix="$constants.currencySymbols.kzt"
250
+ />
251
+ <base-form-input
252
+ v-if="whichProduct === 'gons' && isCalculator"
253
+ v-model="productConditionsForm.statePremium7"
254
+ :readonly="true"
255
+ :label="$dataStore.t('productConditionsForm.statePremium7')"
256
+ :suffix="$constants.currencySymbols.kzt"
257
+ />
258
+ <base-panel-input
259
+ v-if="hasAgencyPart"
260
+ v-model="productConditionsForm.processTariff"
261
+ :value="productConditionsForm.processTariff?.nameRu"
262
+ :readonly="isDisabled"
263
+ :clearable="!isDisabled"
264
+ :rules="$rules.objectRequired"
265
+ :label="$dataStore.t('productConditionsForm.agencyPart')"
266
+ append-inner-icon="mdi mdi-chevron-right"
267
+ @append="openPanel($dataStore.t('productConditionsForm.agencyPart'), $dataStore.processTariff, 'processTariff', $dataStore.getProcessTariff)"
268
+ />
221
269
  </base-form-section>
222
- <base-form-section :title="$dataStore.t('calculationAnnuityPayments')" v-if="hasAnnuityPayments">
270
+ <base-form-section v-if="hasAnnuityPayments" :title="$dataStore.t('calculationAnnuityPayments')">
223
271
  <base-form-toggle
224
272
  v-model="productConditionsForm.additionalConditionAnnuityPayments"
225
273
  :title="$dataStore.t('productConditionsForm.guaranteedTermAnnuityPayments')"
@@ -240,7 +288,7 @@
240
288
  />
241
289
  <base-panel-input
242
290
  v-model="productConditionsForm.typeAnnuityInsurance"
243
- :value="productConditionsForm.typeAnnuityInsurance.nameRu"
291
+ :value="productConditionsForm.typeAnnuityInsurance?.nameRu"
244
292
  :readonly="isDisabled"
245
293
  :clearable="!isDisabled"
246
294
  :rules="$rules.objectRequired"
@@ -258,7 +306,7 @@
258
306
  />
259
307
  <base-panel-input
260
308
  v-model="productConditionsForm.periodAnnuityPayment"
261
- :value="productConditionsForm.periodAnnuityPayment.nameRu"
309
+ :value="productConditionsForm.periodAnnuityPayment?.nameRu"
262
310
  :readonly="isDisabled"
263
311
  :clearable="!isDisabled"
264
312
  :rules="$rules.objectRequired"
@@ -281,6 +329,128 @@
281
329
  :label="$dataStore.t('productConditionsForm.amountAnnuityPayments')"
282
330
  />
283
331
  </base-form-section>
332
+ <base-form-section v-if="whichProduct === 'lifetrip'" :title="$dataStore.t('generalConditions')">
333
+ <base-panel-input
334
+ v-model="calculatorForm.type"
335
+ :value="calculatorForm.type.nameRu ?? $dataStore.t('form.notChosen')"
336
+ :readonly="isDisabled"
337
+ :clearable="!isDisabled"
338
+ :rules="$rules.objectRequired"
339
+ :label="$dataStore.t('calculatorForm.type')"
340
+ append-inner-icon="mdi mdi-chevron-right"
341
+ @append="openPanel($dataStore.t('calculatorForm.type'), [], 'type', $dataStore.getDicTripType)"
342
+ />
343
+ <base-panel-input
344
+ v-model="calculatorForm.countries"
345
+ :value="calculatorForm?.countries![0]?.nameRu && calculatorForm.countries.length ? countriesComputed : $dataStore.t('form.notChosen')"
346
+ :readonly="isDisabled"
347
+ :clearable="!isDisabled"
348
+ :clear-value="[]"
349
+ :label="$dataStore.t('calculatorForm.countries')"
350
+ append-inner-icon="mdi mdi-chevron-right"
351
+ @append="openMultiplePanel($dataStore.t('calculatorForm.countries'), $dataStore.dicAllCountries, 'countries', $dataStore.getDicCountries)"
352
+ />
353
+ <base-panel-input
354
+ v-model="calculatorForm.amount"
355
+ :value="calculatorForm.amount.nameRu ? calculatorForm.amount.nameRu + $dataStore.currency : $dataStore.t('form.notChosen')"
356
+ :readonly="isDisabled"
357
+ :clearable="!isDisabled"
358
+ :rules="$rules.objectRequired"
359
+ :label="$dataStore.t('calculatorForm.amount')"
360
+ append-inner-icon="mdi mdi-chevron-right"
361
+ @append="openPanel($dataStore.t('calculatorForm.amount'), $dataStore.amountArray, 'amount')"
362
+ />
363
+ <base-panel-input
364
+ v-model="calculatorForm.purpose"
365
+ :value="calculatorForm.purpose.nameRu ?? $dataStore.t('form.notChosen')"
366
+ :readonly="isDisabled"
367
+ :clearable="!isDisabled"
368
+ :rules="$rules.objectRequired"
369
+ :label="$dataStore.t('calculatorForm.purpose')"
370
+ append-inner-icon="mdi mdi-chevron-right"
371
+ @append="openPanel($dataStore.t('calculatorForm.purpose'), [], 'purpose', $dataStore.getDicTripPurpose)"
372
+ />
373
+ <base-panel-input
374
+ v-if="calculatorForm.purpose.code === 'WorkStudy'"
375
+ v-model="calculatorForm.workType"
376
+ :value="calculatorForm.workType.nameRu ?? $dataStore.t('form.notChosen')"
377
+ :readonly="isDisabled"
378
+ :clearable="!isDisabled"
379
+ :rules="$rules.objectRequired"
380
+ :label="$dataStore.t('calculatorForm.workType')"
381
+ append-inner-icon="mdi mdi-chevron-right"
382
+ @append="openPanel($dataStore.t('calculatorForm.workType'), [], 'workType', $dataStore.getDicTripWorkType)"
383
+ />
384
+ <base-panel-input
385
+ v-if="calculatorForm.purpose.code === 'Sport'"
386
+ v-model="calculatorForm.sportsType"
387
+ :value="calculatorForm.sportsType.nameRu ?? $dataStore.t('form.notChosen')"
388
+ :readonly="isDisabled"
389
+ :clearable="!isDisabled"
390
+ :rules="$rules.objectRequired"
391
+ :label="$dataStore.t('calculatorForm.sportsType')"
392
+ append-inner-icon="mdi mdi-chevron-right"
393
+ @append="openPanel($dataStore.t('calculatorForm.sportsType'), [], 'sportsType', $dataStore.getDicSportsType)"
394
+ />
395
+ <base-panel-input
396
+ v-if="calculatorForm.type.code === 'Multiple'"
397
+ v-model="calculatorForm.period"
398
+ :value="calculatorForm.period && calculatorForm.period.nameRu ? calculatorForm.period.nameRu : $dataStore.t('form.notChosen')"
399
+ :readonly="isDisabled"
400
+ :clearable="!isDisabled"
401
+ :rules="$rules.objectRequired"
402
+ :label="$dataStore.t('calculatorForm.period')"
403
+ append-inner-icon="mdi mdi-chevron-right"
404
+ @append="openPanel($dataStore.t('calculatorForm.period'), $dataStore.periodArray, 'period')"
405
+ />
406
+ <base-panel-input
407
+ v-if="calculatorForm.type.code === 'Multiple'"
408
+ v-model="calculatorForm.maxDays"
409
+ :value="calculatorForm.period && calculatorForm.maxDays.nameRu ? calculatorForm.maxDays.nameRu : $dataStore.t('form.notChosen')"
410
+ :readonly="isDisabled"
411
+ :clearable="!isDisabled"
412
+ :rules="$rules.objectRequired"
413
+ :label="$dataStore.t('calculatorForm.maxDays')"
414
+ append-inner-icon="mdi mdi-chevron-right"
415
+ @append="openPanel($dataStore.t('calculatorForm.maxDays'), $dataStore.maxDaysFiltered, 'maxDays')"
416
+ />
417
+ <base-form-input
418
+ v-if="calculatorForm.type.code === 'Single'"
419
+ v-model="calculatorForm.days"
420
+ :readonly="isDisabled || !isCalculator"
421
+ :label="$dataStore.t('calculatorForm.days')"
422
+ :rules="$rules.required"
423
+ />
424
+ <base-form-input
425
+ v-if="isCalculator && whichProduct === 'lifetrip'"
426
+ v-model="calculatorForm.age"
427
+ :rules="$rules.required"
428
+ :readonly="isDisabledSum"
429
+ :clearable="!isDisabled"
430
+ :label="$dataStore.t('calculatorForm.age')"
431
+ />
432
+ <base-form-input
433
+ v-if="!isCalculator && whichProduct === 'lifetrip'"
434
+ v-model="calculatorForm.startDate"
435
+ :readonly="isDisabled"
436
+ :clearable="!isDisabled"
437
+ :label="$dataStore.t('calculatorForm.startDate')"
438
+ :rules="$dataStore.rules.required.concat($dataStore.rules.planDate)"
439
+ :maska="$maska.date"
440
+ append-inner-icon="mdi mdi-calendar-blank-outline"
441
+ />
442
+ <base-form-input
443
+ v-if="!isCalculator && calculatorForm.type.code != 'Multiple'"
444
+ v-model="calculatorForm.endDate"
445
+ :readonly="isDisabled"
446
+ :clearable="!isDisabled"
447
+ :label="$dataStore.t('calculatorForm.endDate')"
448
+ :rules="$dataStore.rules.required"
449
+ :maska="$maska.date"
450
+ append-inner-icon="mdi mdi-calendar-blank-outline"
451
+ />
452
+ <base-form-input v-model="calculatorForm.price" :readonly="true" :label="isCalculator ? $dataStore.t('calculatorForm.premium') : $dataStore.t('calculatorForm.price')" />
453
+ </base-form-section>
284
454
  <base-form-section v-if="additionalTerms && additionalTerms.length" :title="$dataStore.t('productConditionsForm.additional')">
285
455
  <div v-for="(term, index) of additionalTerms" :key="index">
286
456
  <base-panel-input
@@ -288,7 +458,7 @@
288
458
  v-model="additionalTerms[index]"
289
459
  :value="term.coverSumName"
290
460
  :readonly="isTermsDisabled"
291
- :clearable="!isTermsDisabled"
461
+ :clearable="false"
292
462
  :label="term.coverTypeName"
293
463
  append-inner-icon="mdi mdi-chevron-right"
294
464
  :suffix="!!term.amount ? `${formatTermValue(term.amount)} ${currencySymbolsAddTerm}` : ''"
@@ -297,12 +467,7 @@
297
467
  </div>
298
468
  </base-form-section>
299
469
  </v-form>
300
- <base-btn
301
- v-if="!$dataStore.isCalculator && isRecalculation && hasCalculated"
302
- :btn="$libStyles.greenLightBtn"
303
- :text="$dataStore.t('buttons.toStatement')"
304
- @click="toStatement"
305
- />
470
+ <base-btn v-if="!$dataStore.isCalculator && isCalculator && hasCalculated" :btn="$styles.greenLightBtn" :text="$dataStore.t('buttons.toStatement')" @click="toStatement" />
306
471
  <base-btn
307
472
  v-if="$dataStore.isCalculator ? true : !isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
308
473
  :loading="isCalculating"
@@ -314,7 +479,7 @@
314
479
  <base-btn :text="$dataStore.t('buttons.calcPremium')" type="submit" @click.prevent="underwriterCalculate('premium')" :loading="isCalculating" />
315
480
  </div>
316
481
  <Teleport v-if="isPanelOpen" to="#panel-actions">
317
- <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
482
+ <div :class="[$styles.scrollPage]" class="flex flex-col items-center">
318
483
  <base-rounded-input v-model.trim="searchQuery" :label="$dataStore.t('labels.search')" class="w-full p-2" :hide-details="true" />
319
484
  <div v-if="panelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
320
485
  <base-panel-select-item :text="$dataStore.t('form.notChosen')" :selected="panelValue.nameRu === null" @click="pickPanelValue(new Value())" />
@@ -329,8 +494,31 @@
329
494
  <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50" />
330
495
  </div>
331
496
  </Teleport>
497
+ <Teleport v-if="isMultiplePanelOpen && calculatorForm.countries !== null" to="#panel-actions">
498
+ <div :class="[$styles.scrollPage]" class="flex flex-col items-center">
499
+ <base-rounded-input v-model.trim="searchQuery" :label="$dataStore.t('labels.search')" class="w-full p-2" :hide-details="true" />
500
+ <v-fade-transition>
501
+ <base-form-section v-if="countriesComputed" class="w-[95%]" :title="$dataStore.t('calculatorForm.selectedCountries')">
502
+ <base-white-block class="text-center" :class="[$styles.textSimple]"> {{ countriesComputed }} </base-white-block>
503
+ </base-form-section>
504
+ </v-fade-transition>
505
+ <div v-if="multiplePanelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
506
+ <base-panel-select-item :text="$dataStore.t('buttons.clearOrReset')" @click="calculatorForm.countries = []" false-icon="mdi-close-circle-outline" />
507
+ <base-panel-select-item
508
+ v-for="(item, index) of multiplePanelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
509
+ :key="index"
510
+ :text="(item.nameRu as string)"
511
+ :selected="calculatorForm.countries && calculatorForm.countries.some(option => option.id === item.id)"
512
+ :disabled="calculatorForm.countries.length >= 3 && !calculatorForm.countries.some(option => option.id === item.id)"
513
+ true-icon="mdi-check-circle-outline"
514
+ @click="selectOption(item)"
515
+ />
516
+ </div>
517
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50" />
518
+ </div>
519
+ </Teleport>
332
520
  <Teleport v-if="isTermsPanelOpen" to="#panel-actions">
333
- <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
521
+ <div :class="[$styles.scrollPage]" class="flex flex-col items-center">
334
522
  <base-rounded-input v-model.trim="searchQuery" :label="$dataStore.t('labels.search')" class="w-full p-2" :hide-details="true" />
335
523
  <div v-if="panelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
336
524
  <base-panel-select-item
@@ -344,20 +532,34 @@
344
532
  <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50" />
345
533
  </div>
346
534
  </Teleport>
535
+ <Teleport v-if="isFixInsAmountPanelOpen" to="#panel-actions">
536
+ <div :class="[$styles.scrollPage]" class="flex flex-col items-center">
537
+ <base-rounded-input v-model.trim="searchQuery" :label="$dataStore.t('labels.search')" class="w-full p-2" :hide-details="true" />
538
+ <div class="w-full flex flex-col gap-2 p-2">
539
+ <base-panel-select-item
540
+ v-for="(item, index) of $constants.fixInsAmount.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
541
+ :key="index"
542
+ :text="(item.nameRu as string)"
543
+ :selected="item.code === fixInsValue"
544
+ @click="pickfixInsValue(item)"
545
+ />
546
+ </div>
547
+ </div>
548
+ </Teleport>
347
549
  </section>
348
550
  </template>
349
551
 
350
552
  <script lang="ts">
351
- import { Member, Value } from '../../composables/classes';
553
+ import { Member, Value, CountryValue, CalculatorForm } from '../../composables/classes';
352
554
 
353
555
  export default defineComponent({
354
556
  props: {
355
- isRecalculation: {
557
+ isCalculator: {
356
558
  type: Boolean,
357
559
  default: false,
358
560
  },
359
561
  product: {
360
- type: String,
562
+ type: String as PropType<Projects>,
361
563
  default: false,
362
564
  },
363
565
  },
@@ -369,11 +571,13 @@ export default defineComponent({
369
571
  const dataStore = useDataStore();
370
572
  const memberStore = useMemberStore();
371
573
 
372
- const whichProduct = ref<string>(dataStore.isCalculator ? props.product : dataStore.product!);
574
+ const whichProduct = ref<Projects | null>(dataStore.isCalculator ? props.product : dataStore.product!);
373
575
  const isCalculating = ref<boolean>(false);
374
576
  const isPanelLoading = ref<boolean>(false);
375
577
  const isPanelOpen = ref<boolean>(false);
376
578
  const isTermsPanelOpen = ref<boolean>(false);
579
+ const isFixInsAmountPanelOpen = ref<boolean>(false);
580
+ const fixInsValue = ref<string | number>();
377
581
  const panelValue = ref<Value>(new Value());
378
582
  const termValue = ref<AddCover>();
379
583
  const panelList = ref<Value[]>([]);
@@ -384,8 +588,14 @@ export default defineComponent({
384
588
  const whichSum = ref<'insurancePremiumPerMonth' | 'requestedSumInsured' | ''>('');
385
589
 
386
590
  const additionalTerms = ref<AddCover[]>([]);
591
+ const isMultiplePanelOpen = ref<boolean>(false);
592
+
593
+ const multiplePanelValue = ref<CountryValue>(new CountryValue());
594
+ const multiplePanelList = ref<CountryValue[]>([]);
595
+ const calculatorForm = productConditionsForm.calculatorForm;
596
+
387
597
  const isUnderwriterForm = computed(() => {
388
- if (route.params.taskId === '0 ' || props.isRecalculation === true) {
598
+ if (route.params.taskId === '0 ' || props.isCalculator === true) {
389
599
  return false;
390
600
  } else {
391
601
  return formStore.applicationData.statusCode === 'UnderwriterForm';
@@ -393,20 +603,26 @@ export default defineComponent({
393
603
  });
394
604
  const isDisabled = computed(() => (dataStore.isCalculator ? false : !memberStore.isStatementEditible('productConditionsForm')));
395
605
  const isTermsDisabled = computed(() => {
396
- if (dataStore.isGons) {
606
+ if (dataStore.isGons || whichProduct.value === 'gons') {
397
607
  return true;
398
608
  }
399
609
  return isDisabled.value;
400
610
  });
401
- const isTask = computed(() => (route.params.taskId === '0' && props.isRecalculation === true) || dataStore.isTask());
402
- const isRecalculationDisabled = computed(() => formStore.isDisabled.recalculationForm);
611
+ const isTask = computed(() => (route.params.taskId === '0' && props.isCalculator === true) || dataStore.isTask());
612
+ const isRecalculationDisabled = computed(() => formStore.isDisabled.recalculationForm || formStore.canBeClaimed === true);
403
613
  const isUnderwriterRole = computed(() => dataStore.isUnderwriter() || dataStore.isAdmin() || dataStore.isSupport());
404
- const insurancePremiumPerMonth = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
405
- const requestedSumInsured = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
614
+ const insurancePremiumPerMonthRule = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
615
+ const insurancePremiumPerMonthDisabled = computed(() => {
616
+ if (dataStore.isUnderwriter() && !isRecalculationDisabled.value) {
617
+ return false;
618
+ }
619
+ return isDisabled.value;
620
+ });
621
+ const requestedSumInsuredRule = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
406
622
  const hasCalculated = computed(() => !!productConditionsForm.requestedSumInsured && !!productConditionsForm.insurancePremiumPerMonth);
407
623
  const amountAnnuityPayments = computed(() => (!!productConditionsForm.amountAnnuityPayments ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
408
624
  const hasProcessIndexRate = computed(() => {
409
- if (whichProduct.value === 'gons' || whichProduct.value === 'halykkazyna' || whichProduct.value === 'liferenta') {
625
+ if (whichProduct.value === 'gons' || whichProduct.value === 'halykkazyna' || whichProduct.value === 'liferenta' || whichProduct.value === 'lifebusiness') {
410
626
  return false;
411
627
  }
412
628
  return true;
@@ -441,6 +657,24 @@ export default defineComponent({
441
657
  }
442
658
  return true;
443
659
  });
660
+ const readonlyLifeAdditive = computed(() => {
661
+ if (whichProduct.value === 'gons') {
662
+ return true;
663
+ }
664
+ return isRecalculationDisabled.value;
665
+ });
666
+ const readonlyDisabilityMultiply = computed(() => {
667
+ if (whichProduct.value === 'gons') {
668
+ return true;
669
+ }
670
+ return isRecalculationDisabled.value;
671
+ });
672
+ const readonlyDisabilityAdditive = computed(() => {
673
+ if (whichProduct.value === 'gons') {
674
+ return true;
675
+ }
676
+ return isRecalculationDisabled.value;
677
+ });
444
678
  const hasAdbAdditive = computed(() => {
445
679
  if (whichProduct.value === 'gons') {
446
680
  return false;
@@ -459,6 +693,24 @@ export default defineComponent({
459
693
  }
460
694
  return false;
461
695
  });
696
+ const hasBirthDate = computed(() => {
697
+ if (whichProduct.value === 'lifebusiness') {
698
+ return false;
699
+ }
700
+ return true;
701
+ });
702
+ const hasGender = computed(() => {
703
+ if (whichProduct.value === 'lifebusiness') {
704
+ return false;
705
+ }
706
+ return true;
707
+ });
708
+ const hasAgencyPart = computed(() => {
709
+ if (whichProduct.value === 'lifebusiness') {
710
+ return true;
711
+ }
712
+ return false;
713
+ });
462
714
  const coverPeriodRule = computed(() => {
463
715
  const baseCondition = dataStore.rules.required.concat(dataStore.rules.numbers);
464
716
  if (whichProduct.value === 'gons') {
@@ -479,30 +731,77 @@ export default defineComponent({
479
731
  if (whichProduct.value === 'halykkazyna') {
480
732
  return dataStore.t('productConditionsForm.requestedSumInsuredInTenge');
481
733
  }
734
+ if (whichProduct.value === 'lifebusiness') {
735
+ return dataStore.t('productConditionsForm.totalRequestedSumInsured');
736
+ }
482
737
  return dataStore.t('productConditionsForm.requestedSumInsured');
483
738
  });
739
+ const coverPeriodLabel = computed(() => {
740
+ if (whichProduct.value === 'gons') {
741
+ return dataStore.t('productConditionsForm.coverPeriodFrom3to20');
742
+ }
743
+ if (whichProduct.value === 'lifebusiness') {
744
+ return dataStore.t('productConditionsForm.coverPeriodMonth');
745
+ }
746
+ return dataStore.t('productConditionsForm.coverPeriod');
747
+ });
748
+ const insurancePremiumPerMonthLabel = computed(() => {
749
+ if (whichProduct.value === 'lifebusiness') {
750
+ return dataStore.t('productConditionsForm.totalInsurancePremiumAmount');
751
+ }
752
+ return dataStore.t('productConditionsForm.insurancePremiumAmount');
753
+ });
484
754
  const isDisabledSum = computed(() => {
485
755
  if (whichProduct.value === 'halykkazyna') {
486
756
  return true;
487
757
  }
758
+ if (dataStore.isUnderwriter() && !isRecalculationDisabled.value) {
759
+ return false;
760
+ }
488
761
  return isDisabled.value;
489
762
  });
490
763
  const isDisabledSumDollar = computed(() => {
491
764
  if (whichProduct.value === 'halykkazyna') {
492
765
  return true;
493
766
  }
767
+ if (dataStore.isUnderwriter() && !isRecalculationDisabled.value) {
768
+ return false;
769
+ }
494
770
  return isDisabled.value;
495
771
  });
496
-
772
+ const countriesComputed = computed(() => {
773
+ let message = '';
774
+ for (let country in calculatorForm.countries) {
775
+ message += calculatorForm.countries[country as any].nameRu + ', ';
776
+ }
777
+ return message.slice(0, -2);
778
+ });
779
+ const isDisabledCoverPeriod = computed(() => {
780
+ if (whichProduct.value === 'lifebusiness') {
781
+ return true;
782
+ }
783
+ return isDisabled.value;
784
+ });
785
+ const hasDefault = computed(() => {
786
+ if (whichProduct.value === 'lifetrip') {
787
+ return false;
788
+ }
789
+ return true;
790
+ });
497
791
  const formatTermValue = (term: number) => {
498
792
  if (term !== null) {
499
- return Number.isInteger(term) ? dataStore.getNumberWithSpaces(term) : dataStore.getNumberWithDot(term);
793
+ const termNumber = Number(term);
794
+ return Number.isInteger(termNumber) ? dataStore.getNumberWithSpaces(termNumber) : dataStore.getNumberWithDot(termNumber);
500
795
  }
501
796
  return null;
502
797
  };
503
798
 
504
799
  const toStatement = async () => {
505
800
  const statementItem = dataStore.menuItems.find(i => i.id === 'statement');
801
+ if (whichProduct.value === 'lifebusiness') {
802
+ await router.push({ name: 'taskId-NewApp', params: route.params, query: { tab: 'statement' } });
803
+ return;
804
+ }
506
805
  if (statementItem) {
507
806
  dataStore.menu.selectedItem = statementItem;
508
807
  await router.replace({
@@ -518,28 +817,80 @@ export default defineComponent({
518
817
  const pickPanelValue = (item: Value) => {
519
818
  dataStore.panel.open = false;
520
819
  isPanelOpen.value = false;
820
+ isMultiplePanelOpen.value = false;
821
+ if (item.id === null) {
822
+ calculatorForm.countries = [];
823
+ }
521
824
  if (!currentPanel.value) return;
522
- // @ts-ignore
523
- productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
825
+ if (whichProduct.value === 'lifetrip') {
826
+ // @ts-ignore
827
+ calculatorForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
828
+ } else {
829
+ // @ts-ignore
830
+ productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
831
+ }
832
+ };
833
+ const selectOption = (value: CountryValue) => {
834
+ if (calculatorForm.countries !== null) {
835
+ if (value.id == 0) {
836
+ calculatorForm.countries = [];
837
+ return (dataStore.dicCountries = dataStore.dicAllCountries);
838
+ }
839
+ if (calculatorForm.countries.some((option: CountryValue) => option.id == value.id)) {
840
+ calculatorForm.countries = calculatorForm.countries.filter((obj: CountryValue) => obj.id !== value.id);
841
+ dataStore.dicCountries = dataStore.dicAllCountries;
842
+ } else {
843
+ dataStore.dicCountries = dataStore.dicAllCountries.filter(i =>
844
+ i.id == 0 || (value.countryTypeCode == '1' && i.countryTypeCode == value.countryTypeCode) || (value.countryTypeCode != '1' && i.countryTypeCode != '1') ? true : false,
845
+ );
846
+ if (value.countryTypeCode == 1) {
847
+ dataStore.showToaster('success', dataStore.t('toaster.shengenZoneCondition'), 3000);
848
+ formStore.insuredForm.length = 1;
849
+ }
850
+ if (calculatorForm.countries.length < 3) {
851
+ calculatorForm.countries.push(value);
852
+ } else if (calculatorForm.countries.length >= 3) {
853
+ closeMultiplePanel();
854
+ }
855
+ }
856
+ }
524
857
  };
525
-
526
858
  const pickTermValue = (item: Value) => {
527
859
  dataStore.panel.open = false;
528
860
  isTermsPanelOpen.value = false;
529
861
  if (typeof currentIndex.value !== 'number') return;
530
862
  additionalTerms.value[currentIndex.value].coverSumId = item.id as string;
531
863
  additionalTerms.value[currentIndex.value].coverSumName = item.nameRu as string;
864
+ if (whichProduct.value === 'lifebusiness') {
865
+ if (item.code === 'fixedinssum') {
866
+ openFixInsPanel(dataStore.t('insurers.selectInsSum'), additionalTerms.value[currentIndex.value].amount);
867
+ } else {
868
+ additionalTerms.value[currentIndex.value].amount = 0;
869
+ }
870
+ }
532
871
  };
533
872
 
534
873
  const openPanel = async (title: string, list: Value[], key: string, asyncFunction?: Function, filterKey?: string) => {
535
874
  if (!isDisabled.value || (key === 'riskGroup' && !isRecalculationDisabled.value)) {
875
+ if (key === 'amount') {
876
+ if (calculatorForm.type.nameRu === null || !calculatorForm.countries || (calculatorForm.countries && calculatorForm.countries.length === 0)) {
877
+ return dataStore.showToaster('error', dataStore.t('toaster.noAmountBeforeTypeAndCountries'), 2000);
878
+ }
879
+ }
880
+ if (key === 'maxDays') {
881
+ if (calculatorForm.period.code === null) {
882
+ return dataStore.showToaster('error', dataStore.t('toaster.noMaxDaysBeforePeriod'), 2000);
883
+ }
884
+ }
536
885
  searchQuery.value = '';
537
886
  currentPanel.value = key as keyof typeof productConditionsForm;
538
887
  isPanelOpen.value = true;
539
888
  isTermsPanelOpen.value = false;
889
+ isFixInsAmountPanelOpen.value = false;
540
890
  dataStore.panelAction = null;
541
891
  dataStore.panel.open = true;
542
892
  dataStore.panel.title = title;
893
+ isMultiplePanelOpen.value = false;
543
894
 
544
895
  let newList = list;
545
896
  if (asyncFunction) {
@@ -547,13 +898,54 @@ export default defineComponent({
547
898
  newList = await asyncFunction(filterKey, formStore.productConditionsFormKey);
548
899
  }
549
900
  panelList.value = filterList(newList, key);
550
- // @ts-ignore
551
- panelValue.value = productConditionsForm[currentPanel.value];
901
+ if (whichProduct.value === 'lifetrip') {
902
+ // @ts-ignore
903
+ panelValue.value = calculatorForm[currentPanel.value];
904
+ } else {
905
+ // @ts-ignore
906
+ panelValue.value = productConditionsForm[currentPanel.value];
907
+ }
552
908
  isPanelLoading.value = false;
553
909
  } else {
554
910
  dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
555
911
  }
556
912
  };
913
+ const openMultiplePanel = async (title: string, list: CountryValue[], key: string, asyncFunction?: Function, filterKey?: string) => {
914
+ if (!isDisabled.value || !isRecalculationDisabled.value) {
915
+ isPanelOpen.value = false;
916
+ isFixInsAmountPanelOpen.value = false;
917
+ isMultiplePanelOpen.value = true;
918
+ isPanelLoading.value = true;
919
+ let newList = list;
920
+ if (asyncFunction !== null) {
921
+ // @ts-ignore
922
+ newList = await asyncFunction(filterKey, formStore.productConditionsFormKey);
923
+ }
924
+ if (newList[0].nameRu !== null) {
925
+ // @ts-ignore
926
+ newList.unshift(new CountryValue(0, null));
927
+ }
928
+
929
+ dataStore.panelAction = null;
930
+ dataStore.panel.open = true;
931
+ dataStore.panel.title = title;
932
+
933
+ // @ts-ignore
934
+ multiplePanelList.value = filterList(newList, key);
935
+ // @ts-ignore
936
+ multiplePanelValue.value = calculatorForm[currentPanel.value];
937
+ isPanelLoading.value = false;
938
+ } else {
939
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'), 2000);
940
+ }
941
+ };
942
+ const closeMultiplePanel = (item?: CountryValue) => {
943
+ dataStore.panel.open = false;
944
+ isMultiplePanelOpen.value = false;
945
+ if (!currentPanel.value) return;
946
+ // @ts-ignore
947
+ calculatorForm[currentPanel.value] = item?.nameRu === null ? new Value() : item;
948
+ };
557
949
 
558
950
  const filterList = (list: Value[], key: string) => {
559
951
  if (whichProduct.value === 'baiterek') {
@@ -569,6 +961,8 @@ export default defineComponent({
569
961
  searchQuery.value = '';
570
962
  currentIndex.value = index;
571
963
  isPanelOpen.value = false;
964
+ isMultiplePanelOpen.value = false;
965
+ isFixInsAmountPanelOpen.value = false;
572
966
  isTermsPanelOpen.value = true;
573
967
  dataStore.panelAction = null;
574
968
  dataStore.panel.open = true;
@@ -588,6 +982,30 @@ export default defineComponent({
588
982
  }
589
983
  };
590
984
 
985
+ const openFixInsPanel = async (title: string, amount: number) => {
986
+ if (!isDisabled.value) {
987
+ searchQuery.value = '';
988
+ isPanelOpen.value = false;
989
+ isTermsPanelOpen.value = false;
990
+ isMultiplePanelOpen.value = false;
991
+ isFixInsAmountPanelOpen.value = true;
992
+ dataStore.panelAction = null;
993
+ dataStore.panel.open = true;
994
+ dataStore.panel.title = title;
995
+ panelList.value = constants.fixInsAmount;
996
+ fixInsValue.value = amount;
997
+ } else {
998
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
999
+ }
1000
+ };
1001
+
1002
+ const pickfixInsValue = (item: Value) => {
1003
+ dataStore.panel.open = false;
1004
+ isFixInsAmountPanelOpen.value = false;
1005
+ if (typeof currentIndex.value !== 'number') return;
1006
+ additionalTerms.value[currentIndex.value].amount = Number(item.code);
1007
+ };
1008
+
591
1009
  const underwriterCalculate = async (type: 'sum' | 'premium') => {
592
1010
  if (!type) return;
593
1011
  if (type === 'sum') {
@@ -687,6 +1105,12 @@ export default defineComponent({
687
1105
  productConditionsForm.requestedSumInsuredInDollar = null;
688
1106
  productConditionsForm.insurancePremiumPerMonth = null;
689
1107
  productConditionsForm.insurancePremiumPerMonthInDollar = null;
1108
+ if (whichProduct.value === 'lifetrip') {
1109
+ Object.keys(calculatorForm).forEach(key => {
1110
+ //@ts-ignore
1111
+ calculatorForm[key] = new CalculatorForm()[key];
1112
+ });
1113
+ }
690
1114
  };
691
1115
 
692
1116
  const filterTermConditions = (term: AddCover) => {
@@ -695,89 +1119,111 @@ export default defineComponent({
695
1119
  }
696
1120
  return true;
697
1121
  };
698
-
699
1122
  const submitForm = async () => {
700
1123
  vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
701
1124
  if (v.valid) {
702
- if (whichSum.value === 'requestedSumInsured') {
703
- productConditionsForm.insurancePremiumPerMonth = null;
704
- if (whichProduct.value === 'halykkazyna') {
705
- productConditionsForm.insurancePremiumPerMonthInDollar = null;
1125
+ if (whichProduct.value === 'lifetrip') {
1126
+ if (calculatorForm.type.code === 'Single' && calculatorForm.startDate && calculatorForm.endDate) {
1127
+ const formattedStartDate = formatDate(calculatorForm.startDate);
1128
+ const formattedEndDate = formatDate(calculatorForm.endDate);
1129
+ if (formattedStartDate && formattedEndDate && formattedStartDate.getTime() > formattedEndDate.getTime()) {
1130
+ return dataStore.showToaster('error', dataStore.t('toaster.startMoreEnd'));
1131
+ }
706
1132
  }
707
- }
708
- if (whichSum.value === 'insurancePremiumPerMonth') {
709
- productConditionsForm.requestedSumInsured = null;
710
- if (whichProduct.value === 'halykkazyna') {
711
- productConditionsForm.requestedSumInsuredInDollar = null;
1133
+ if (dataStore.isTask()) {
1134
+ await dataStore.calculatePrice(route.params.taskId as string);
1135
+ } else {
1136
+ await dataStore.calculatePrice();
1137
+ }
1138
+ } else {
1139
+ if (whichSum.value === 'requestedSumInsured') {
1140
+ productConditionsForm.insurancePremiumPerMonth = null;
1141
+ if (whichProduct.value === 'halykkazyna') {
1142
+ productConditionsForm.insurancePremiumPerMonthInDollar = null;
1143
+ }
1144
+ }
1145
+ if (whichSum.value === 'insurancePremiumPerMonth') {
1146
+ productConditionsForm.requestedSumInsured = null;
1147
+ if (whichProduct.value === 'halykkazyna') {
1148
+ productConditionsForm.requestedSumInsuredInDollar = null;
1149
+ }
1150
+ }
1151
+ if (productConditionsForm.requestedSumInsured !== '' && productConditionsForm.requestedSumInsured != null) {
1152
+ productConditionsForm.insurancePremiumPerMonth = null;
1153
+ if (props.isCalculator) whichSum.value = 'requestedSumInsured';
1154
+ }
1155
+ if (productConditionsForm.insurancePremiumPerMonth !== '' && productConditionsForm.insurancePremiumPerMonth != null) {
1156
+ productConditionsForm.requestedSumInsured = null;
1157
+ if (props.isCalculator) whichSum.value = 'insurancePremiumPerMonth';
712
1158
  }
713
- }
714
- if (productConditionsForm.requestedSumInsured !== '' && productConditionsForm.requestedSumInsured != null) {
715
- productConditionsForm.insurancePremiumPerMonth = null;
716
- if (props.isRecalculation) whichSum.value = 'requestedSumInsured';
717
- }
718
- if (productConditionsForm.insurancePremiumPerMonth !== '' && productConditionsForm.insurancePremiumPerMonth != null) {
719
- productConditionsForm.requestedSumInsured = null;
720
- if (props.isRecalculation) whichSum.value = 'insurancePremiumPerMonth';
721
- }
722
1159
 
723
- if (!whichSum.value && isUnderwriterForm.value === false) {
724
- dataStore.showToaster('error', dataStore.t('toaster.emptyProductConditions'));
725
- return;
726
- }
1160
+ if (!whichSum.value && isUnderwriterForm.value === false) {
1161
+ dataStore.showToaster('error', dataStore.t('toaster.emptyProductConditions'));
1162
+ return;
1163
+ }
727
1164
 
728
- if (isUnderwriterForm.value) {
729
- type recalculationInfo = {
730
- lifeMultiply: string | null | number;
731
- lifeAdditive: string | null | number;
732
- lifeMultiplyClient?: string | number | null;
733
- lifeAdditiveClient?: string | number | null;
734
- adbMultiply: string | null | number;
735
- adbAdditive: string | null | number;
736
- disabilityMultiply: string | null | number;
737
- disabilityAdditive: string | null | number;
738
- amount?: string | number | null;
739
- premium?: string | number | null;
740
- riskGroup?: string | string | number | null;
741
- };
742
- const recalculationData: recalculationInfo = (({ lifeMultiply, lifeAdditive, adbMultiply, adbAdditive, disabilityMultiply, disabilityAdditive }) => ({
743
- lifeMultiply,
744
- lifeAdditive,
745
- adbMultiply,
746
- adbAdditive,
747
- disabilityMultiply,
748
- disabilityAdditive,
749
- }))(productConditionsForm);
750
- Object.keys(recalculationData).forEach(key => {
751
- // @ts-ignore
752
- recalculationData[key] = formatProcents(recalculationData[key]);
753
- });
754
- recalculationData.lifeMultiplyClient = dataStore.isClientAnketaCondition
755
- ? formStore.productConditionsForm.lifeMultiplyClient === null
756
- ? null
757
- : formatProcents(formStore.productConditionsForm.lifeMultiplyClient)
758
- : null;
759
- recalculationData.lifeAdditiveClient = dataStore.isClientAnketaCondition
760
- ? formStore.productConditionsForm.lifeAdditiveClient === null
761
- ? null
762
- : formatProcents(formStore.productConditionsForm.lifeAdditiveClient)
763
- : null;
764
- recalculationData.amount = Number((productConditionsForm.requestedSumInsured as string)?.replace(/\s/g, ''));
765
- recalculationData.premium = Number((productConditionsForm.insurancePremiumPerMonth as string)?.replace(/\s/g, ''));
766
- recalculationData.riskGroup = productConditionsForm.riskGroup?.id ? productConditionsForm.riskGroup.id : 1;
1165
+ if (
1166
+ whichProduct.value === 'gons' &&
1167
+ (formStore.applicationData.statusCode === 'EditForm' || formStore.applicationData.statusCode === 'StartForm') &&
1168
+ getNumber(productConditionsForm.requestedSumInsured as string)! >= 10_000_000
1169
+ ) {
1170
+ dataStore.showToaster('info', dataStore.t('toaster.calcSumForUnder'), 6000);
1171
+ }
1172
+ if (isUnderwriterForm.value) {
1173
+ type recalculationInfo = {
1174
+ lifeMultiply: string | null | number;
1175
+ lifeAdditive: string | null | number;
1176
+ lifeMultiplyClient?: string | number | null;
1177
+ lifeAdditiveClient?: string | number | null;
1178
+ adbMultiply: string | null | number;
1179
+ adbAdditive: string | null | number;
1180
+ disabilityMultiply: string | null | number;
1181
+ disabilityAdditive: string | null | number;
1182
+ amount?: string | number | null;
1183
+ premium?: string | number | null;
1184
+ riskGroup?: string | string | number | null;
1185
+ };
1186
+ const recalculationData: recalculationInfo = (({ lifeMultiply, lifeAdditive, adbMultiply, adbAdditive, disabilityMultiply, disabilityAdditive }) => ({
1187
+ lifeMultiply,
1188
+ lifeAdditive,
1189
+ adbMultiply,
1190
+ adbAdditive,
1191
+ disabilityMultiply,
1192
+ disabilityAdditive,
1193
+ }))(productConditionsForm);
1194
+ Object.keys(recalculationData).forEach(key => {
1195
+ // @ts-ignore
1196
+ recalculationData[key] = formatProcents(recalculationData[key]);
1197
+ });
1198
+ recalculationData.lifeMultiplyClient = dataStore.isClientAnketaCondition
1199
+ ? formStore.productConditionsForm.lifeMultiplyClient === null
1200
+ ? null
1201
+ : formatProcents(formStore.productConditionsForm.lifeMultiplyClient)
1202
+ : null;
1203
+ recalculationData.lifeAdditiveClient = dataStore.isClientAnketaCondition
1204
+ ? formStore.productConditionsForm.lifeAdditiveClient === null
1205
+ ? null
1206
+ : formatProcents(formStore.productConditionsForm.lifeAdditiveClient)
1207
+ : null;
1208
+ recalculationData.amount = Number((productConditionsForm.requestedSumInsured as string)?.replace(/\s/g, ''));
1209
+ recalculationData.premium = Number((productConditionsForm.insurancePremiumPerMonth as string)?.replace(/\s/g, ''));
1210
+ recalculationData.riskGroup = productConditionsForm.riskGroup?.id ? productConditionsForm.riskGroup.id : 1;
1211
+ isCalculating.value = true;
1212
+ await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId as string, whichSum.value);
1213
+ }
767
1214
  isCalculating.value = true;
768
- await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId as string, whichSum.value);
769
- }
770
- isCalculating.value = true;
771
- if (props.isRecalculation) {
772
- //@ts-ignore
773
- await dataStore.calculateWithoutApplication(true, whichProduct.value);
774
- additionalTerms.value = formStore.additionalInsuranceTermsWithout;
775
- } else {
776
- if (dataStore.isProcessEditable(formStore.applicationData.statusCode)) {
777
- await dataStore.calculate(route.params.taskId as string);
778
- additionalTerms.value = formStore.additionalInsuranceTerms;
1215
+ if (props.isCalculator) {
1216
+ //@ts-ignore
1217
+ await dataStore.calculateWithoutApplication(true, whichProduct.value);
1218
+ additionalTerms.value = formStore.additionalInsuranceTermsWithout;
1219
+ } else {
1220
+ if (dataStore.isProcessEditable(formStore.applicationData.statusCode)) {
1221
+ await dataStore.calculate(route.params.taskId as string);
1222
+ additionalTerms.value = formStore.additionalInsuranceTerms;
1223
+ }
779
1224
  }
780
1225
  }
1226
+
781
1227
  isCalculating.value = false;
782
1228
  } else {
783
1229
  const errors = document.querySelector('.v-input--error');
@@ -802,32 +1248,39 @@ export default defineComponent({
802
1248
  };
803
1249
 
804
1250
  onMounted(async () => {
805
- if (props.isRecalculation === true) {
1251
+ if (props.isCalculator === true) {
806
1252
  if (dataStore.isCalculator) {
807
1253
  clearFields();
808
1254
  }
809
- if (
810
- (dataStore.isCalculator || route.params.taskId === '0') &&
811
- productConditionsForm.requestedSumInsured === null &&
812
- productConditionsForm.insurancePremiumPerMonth === null
813
- ) {
814
- // @ts-ignore
815
- const defaultData = await dataStore.getDefaultCalculationData(true, whichProduct.value);
816
- if (!defaultData) {
817
- dataStore.showToaster('error', 'Отсутствуют базовые данные');
818
- return;
1255
+ if (whichProduct.value !== 'lifetrip') {
1256
+ if (
1257
+ (dataStore.isCalculator || route.params.taskId === '0') &&
1258
+ productConditionsForm.requestedSumInsured === null &&
1259
+ productConditionsForm.insurancePremiumPerMonth === null
1260
+ ) {
1261
+ // @ts-ignore
1262
+ const defaultData = await dataStore.getDefaultCalculationData(true, whichProduct.value);
1263
+ if (!defaultData) {
1264
+ dataStore.showToaster('error', 'Отсутствуют базовые данные');
1265
+ return;
1266
+ }
1267
+ formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
1268
+ productConditionsForm.requestedSumInsured = defaultData.amount;
1269
+ productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
1270
+ const indexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
1271
+ if (indexRate) productConditionsForm.processIndexRate = indexRate;
1272
+ const paymendPeriod = dataStore.processPaymentPeriod.find(i => i.id === defaultData.paymentPeriodId);
1273
+ if (paymendPeriod) productConditionsForm.paymentPeriod = paymendPeriod;
1274
+ if (defaultData.signDate) {
1275
+ productConditionsForm.signDate = reformatDate(defaultData.signDate);
1276
+ }
1277
+ if (dataStore.isLifeBusiness) {
1278
+ productConditionsForm.coverPeriod = defaultData.insTermInMonth ?? null;
1279
+ }
819
1280
  }
820
- formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
821
- productConditionsForm.requestedSumInsured = defaultData.amount;
822
- productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
823
- const indexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
824
- if (indexRate) productConditionsForm.processIndexRate = indexRate;
825
- const paymendPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
826
- if (paymendPeriod) productConditionsForm.paymentPeriod = paymendPeriod;
827
- productConditionsForm.signDate = reformatDate(defaultData.signDate);
828
1281
  }
829
1282
  }
830
- additionalTerms.value = props.isRecalculation ? formStore.additionalInsuranceTermsWithout : formStore.additionalInsuranceTerms;
1283
+ additionalTerms.value = props.isCalculator ? formStore.additionalInsuranceTermsWithout : formStore.additionalInsuranceTerms;
831
1284
  if (!!productConditionsForm.insurancePremiumPerMonth) {
832
1285
  whichSum.value = 'insurancePremiumPerMonth';
833
1286
  }
@@ -875,6 +1328,57 @@ export default defineComponent({
875
1328
  { immediate: true },
876
1329
  );
877
1330
 
1331
+ if (whichProduct.value === 'lifetrip') {
1332
+ watch(
1333
+ () => calculatorForm.type,
1334
+ async val => {
1335
+ if (val.code === 'Multiple') {
1336
+ await dataStore.getPeriod();
1337
+ calculatorForm.period = new Value();
1338
+ calculatorForm.endDate = null;
1339
+ }
1340
+ if (calculatorForm.countries?.length != 0) {
1341
+ await dataStore.getTripInsuredAmount();
1342
+ }
1343
+ },
1344
+ );
1345
+ watch(
1346
+ () => calculatorForm.countries,
1347
+ async val => {
1348
+ if (val?.length && val.every(option => option.id != 0) && calculatorForm.type?.nameRu != null) {
1349
+ await dataStore.getTripInsuredAmount();
1350
+ }
1351
+ },
1352
+ { deep: true },
1353
+ );
1354
+
1355
+ watch(
1356
+ () => calculatorForm.period,
1357
+ val => {
1358
+ if (val) {
1359
+ dataStore.maxDaysFiltered = dataStore.maxDaysAllArray.filter(days => days.code == val.code);
1360
+ calculatorForm.maxDays = new Value();
1361
+ }
1362
+ },
1363
+ );
1364
+
1365
+ watch(
1366
+ () => calculatorForm.startDate,
1367
+ val => {
1368
+ if (val !== null && val.length === 10 && calculatorForm.endDate != null && calculatorForm.endDate.length === 10) {
1369
+ calculatorForm.days = productConditionsForm.getSingleTripDays();
1370
+ }
1371
+ },
1372
+ );
1373
+ watch(
1374
+ () => calculatorForm.endDate,
1375
+ val => {
1376
+ if (val !== null && val.length === 10 && calculatorForm.startDate != null && calculatorForm.startDate.length === 10) {
1377
+ calculatorForm.days = productConditionsForm.getSingleTripDays();
1378
+ }
1379
+ },
1380
+ );
1381
+ }
878
1382
  return {
879
1383
  // State
880
1384
  formStore,
@@ -885,21 +1389,28 @@ export default defineComponent({
885
1389
  isCalculating,
886
1390
  isPanelLoading,
887
1391
  isPanelOpen,
1392
+ isMultiplePanelOpen,
888
1393
  isTermsPanelOpen,
889
1394
  panelValue,
890
1395
  termValue,
891
1396
  panelList,
1397
+ multiplePanelList,
1398
+ multiplePanelValue,
892
1399
  searchQuery,
893
1400
  whichSum,
894
1401
  Value,
1402
+ calculatorForm,
1403
+ isFixInsAmountPanelOpen,
1404
+ fixInsValue,
895
1405
 
896
1406
  // Computed
897
1407
  isTask,
898
1408
  isDisabled,
899
1409
  isTermsDisabled,
900
1410
  isUnderwriterForm,
901
- insurancePremiumPerMonth,
902
- requestedSumInsured,
1411
+ insurancePremiumPerMonthRule,
1412
+ insurancePremiumPerMonthDisabled,
1413
+ requestedSumInsuredRule,
903
1414
  isRecalculationDisabled,
904
1415
  isUnderwriterRole,
905
1416
  hasProcessIndexRate,
@@ -908,15 +1419,26 @@ export default defineComponent({
908
1419
  hasInsurancePremiumPerMonthInDollar,
909
1420
  hasCurrency,
910
1421
  hasAdbMultiply,
1422
+ readonlyLifeAdditive,
1423
+ readonlyDisabilityMultiply,
1424
+ readonlyDisabilityAdditive,
911
1425
  hasAdbAdditive,
912
1426
  hasRiskGroup,
913
1427
  hasCalculated,
914
1428
  hasAnnuityPayments,
1429
+ hasAgencyPart,
915
1430
  currencySymbolsAddTerm,
916
1431
  amountAnnuityPayments,
917
1432
  requestedSumInsuredLabel,
918
1433
  isDisabledSum,
919
1434
  isDisabledSumDollar,
1435
+ countriesComputed,
1436
+ hasBirthDate,
1437
+ hasGender,
1438
+ coverPeriodLabel,
1439
+ insurancePremiumPerMonthLabel,
1440
+ isDisabledCoverPeriod,
1441
+ hasDefault,
920
1442
 
921
1443
  // Rules
922
1444
  coverPeriodRule,
@@ -926,6 +1448,7 @@ export default defineComponent({
926
1448
  pickPanelValue,
927
1449
  pickTermValue,
928
1450
  openPanel,
1451
+ openMultiplePanel,
929
1452
  openTermPanel,
930
1453
  pickCalculation,
931
1454
  underwriterCalculate,
@@ -941,6 +1464,9 @@ export default defineComponent({
941
1464
  clearFields,
942
1465
  formatTermValue,
943
1466
  filterTermConditions,
1467
+ selectOption,
1468
+ pickfixInsValue,
1469
+ openFixInsPanel,
944
1470
  };
945
1471
  },
946
1472
  });