hl-core 0.0.8 → 0.0.9-beta.2

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/index.ts +142 -101
  2. package/api/interceptors.ts +17 -13
  3. package/components/Button/Btn.vue +1 -1
  4. package/components/Button/ScrollButtons.vue +2 -2
  5. package/components/Complex/MessageBlock.vue +26 -0
  6. package/components/Complex/Page.vue +1 -1
  7. package/components/Dialog/Dialog.vue +9 -39
  8. package/components/Dialog/FamilyDialog.vue +7 -4
  9. package/components/Form/FormBlock.vue +90 -42
  10. package/components/Form/FormSection.vue +4 -1
  11. package/components/Form/FormToggle.vue +1 -2
  12. package/components/Form/ManagerAttachment.vue +197 -0
  13. package/components/Form/ProductConditionsBlock.vue +68 -14
  14. package/components/Input/Datepicker.vue +45 -0
  15. package/components/Input/FileInput.vue +2 -3
  16. package/components/Input/FormInput.vue +31 -7
  17. package/components/Input/PanelInput.vue +7 -2
  18. package/components/Input/RoundedInput.vue +2 -2
  19. package/components/Input/RoundedSelect.vue +137 -0
  20. package/components/Layout/Drawer.vue +4 -2
  21. package/components/Layout/Header.vue +40 -4
  22. package/components/Layout/Loader.vue +1 -1
  23. package/components/Layout/SettingsPanel.vue +51 -13
  24. package/components/Menu/MenuHover.vue +30 -0
  25. package/components/Menu/MenuNav.vue +29 -13
  26. package/components/Menu/MenuNavItem.vue +6 -3
  27. package/components/Pages/Anketa.vue +59 -33
  28. package/components/Pages/Auth.vue +139 -46
  29. package/components/Pages/Documents.vue +7 -7
  30. package/components/Pages/InvoiceInfo.vue +30 -0
  31. package/components/Pages/MemberForm.vue +544 -293
  32. package/components/Pages/ProductAgreement.vue +4 -2
  33. package/components/Pages/ProductConditions.vue +673 -75
  34. package/components/Panel/PanelHandler.vue +304 -0
  35. package/components/Panel/PanelSelectItem.vue +1 -1
  36. package/components/Transitions/SlideTransition.vue +5 -0
  37. package/components/Utilities/Chip.vue +27 -0
  38. package/components/Utilities/JsonViewer.vue +27 -0
  39. package/composables/axios.ts +1 -1
  40. package/composables/classes.ts +223 -101
  41. package/composables/constants.ts +26 -51
  42. package/composables/index.ts +80 -2
  43. package/composables/styles.ts +15 -3
  44. package/configs/i18n.ts +17 -0
  45. package/layouts/default.vue +6 -6
  46. package/locales/kz.json +585 -0
  47. package/locales/ru.json +587 -0
  48. package/nuxt.config.ts +13 -1
  49. package/package.json +43 -11
  50. package/pages/500.vue +2 -2
  51. package/pages/Token.vue +51 -0
  52. package/plugins/helperFunctionsPlugins.ts +6 -0
  53. package/plugins/storePlugin.ts +0 -1
  54. package/plugins/vuetifyPlugin.ts +8 -1
  55. package/store/data.store.ts +2649 -0
  56. package/store/form.store.ts +1 -1
  57. package/store/member.store.ts +164 -52
  58. package/store/{rules.js → rules.ts} +65 -34
  59. package/types/enum.ts +83 -0
  60. package/types/env.d.ts +10 -0
  61. package/types/index.ts +262 -5
  62. package/store/data.store.js +0 -2482
  63. package/store/messages.ts +0 -429
@@ -1,109 +1,354 @@
1
1
  <template>
2
2
  <section class="flex flex-col gap-4 px-[10px]">
3
3
  <v-form ref="vForm" @submit="submitForm" class="max-h-[82svh] overflow-y-scroll">
4
- <base-form-section v-if="$dataStore.isGons" :title="$t('productConditionsForm.requestedProductConditions')" :class="[$libStyles.textSimple]">
4
+ <base-form-section v-if="whichProduct === 'gons'" :title="$dataStore.t('productConditionsForm.requestedProductConditions')" :class="[$libStyles.textSimple]">
5
5
  <base-form-text-section
6
6
  class="mb-4"
7
7
  title="Инвалидность I или II группы по причине несчастного случая, начиная с третьего года по любой причине, с освобождением от уплаты страховых взносов"
8
8
  subtitle="Равна страховой сумме по основному покрытию"
9
- ></base-form-text-section>
9
+ />
10
10
  <base-form-text-section
11
11
  title="Если лицо, назначенное Выгодоприобретателем, на дату осуществления Страховщиком страховой выплаты не достигло совершеннолетия (восемнадцатилетнего возраста), страховая
12
12
  выплата подлежит осуществлению:"
13
13
  subtitle="Если несовершеннолетний не достиг возраста 14 лет - законному представителю в соответствии с законодательством Республики Казахстан"
14
- ></base-form-text-section>
14
+ />
15
15
  </base-form-section>
16
- <base-form-section :title="$t('generalConditions')">
17
- <div v-if="isRecalculation && $route.params.taskId === '0'">
16
+ <base-form-section v-if="isUnderwriterRole && $dataStore.hasClientAnketa && $dataStore.isClientAnketaCondition" :title="$dataStore.t('policyholderForm')">
17
+ <base-form-input
18
+ v-model="productConditionsForm.lifeMultiplyClient"
19
+ :maska="$maska.numbers"
20
+ :clearable="isRecalculationDisabled === false"
21
+ :label="$dataStore.t('percent') + `Life Multiply`"
22
+ :readonly="isRecalculationDisabled"
23
+ :rules="$dataStore.rules.recalculationMultiply"
24
+ />
25
+ <base-form-input
26
+ v-model="productConditionsForm.lifeAdditiveClient"
27
+ :maska="$maska.numbers"
28
+ :clearable="isRecalculationDisabled === false"
29
+ :label="$dataStore.t('percent') + `Life Additive`"
30
+ :readonly="isRecalculationDisabled"
31
+ :rules="$dataStore.rules.recalculationAdditive"
32
+ />
33
+ <base-form-input v-model="formStore.policyholderForm.longName" :label="$dataStore.t('labels.policyholderLongName')" :readonly="true" />
34
+ <base-form-input v-model="formStore.policyholderForm.job" :label="$dataStore.t('form.job')" :readonly="true" />
35
+ <base-form-input v-model="formStore.policyholderForm.jobPosition" :label="$dataStore.t('form.jobPosition')" :readonly="true" />
36
+ <base-form-input v-model="formStore.policyholderForm.birthDate" :label="$dataStore.t('form.birthDate')" :readonly="true" />
37
+ <base-form-input v-model="formStore.policyholderForm.age" :label="$dataStore.t('form.age')" :readonly="true" />
38
+ <base-form-input v-model="formStore.policyholderForm.gender.nameRu" class="mb-4" :label="$dataStore.t('form.gender')" :readonly="true" />
39
+ </base-form-section>
40
+ <base-form-section v-if="isUnderwriterRole && $dataStore.members.insuredApp.has === true" :title="$dataStore.t('insuredForm')">
41
+ <div v-for="(insured, index) of formStore.insuredForm" :key="index">
42
+ <base-form-input v-model="insured.longName" :label="$dataStore.t('labels.insurerLongName')" :readonly="true" />
43
+ <base-form-input v-model="insured.job" :label="$dataStore.t('form.job')" :readonly="true" />
44
+ <base-form-input v-model="insured.jobPosition" :label="$dataStore.t('form.jobPosition')" :readonly="true" />
45
+ <base-form-input v-model="insured.birthDate" :label="$dataStore.t('form.birthDate')" :readonly="true" />
46
+ <base-form-input v-model="insured.age" :label="$dataStore.t('form.age')" :readonly="true" />
47
+ <base-form-input v-model="insured.gender.nameRu" class="mb-4" :label="$dataStore.t('form.gender')" :readonly="true" />
48
+ </div>
49
+ </base-form-section>
50
+ <base-form-section v-if="isUnderwriterRole" :title="$dataStore.t('recalculationInfo')">
51
+ <base-form-input
52
+ v-model="productConditionsForm.lifeMultiply"
53
+ :maska="$maska.numbers"
54
+ :clearable="isRecalculationDisabled === false"
55
+ :label="$dataStore.t('percent') + `Life Multiply`"
56
+ :readonly="isRecalculationDisabled"
57
+ :rules="$dataStore.rules.recalculationMultiply"
58
+ />
59
+ <base-form-input
60
+ v-model="productConditionsForm.lifeAdditive"
61
+ :maska="$maska.numbers"
62
+ :clearable="isRecalculationDisabled === false"
63
+ :label="$dataStore.t('percent') + `Life Additive`"
64
+ :readonly="isRecalculationDisabled"
65
+ :rules="$dataStore.rules.recalculationAdditive"
66
+ />
67
+ <base-form-input
68
+ v-if="hasAdbMultiply"
69
+ v-model="productConditionsForm.adbMultiply"
70
+ :maska="$maska.numbers"
71
+ :clearable="isRecalculationDisabled === false"
72
+ :label="$dataStore.t('percent') + `Adb Multiply`"
73
+ :readonly="isRecalculationDisabled"
74
+ :rules="$dataStore.rules.recalculationMultiply"
75
+ />
76
+ <base-form-input
77
+ v-if="hasAdbAdditive"
78
+ v-model="productConditionsForm.adbAdditive"
79
+ :maska="$maska.numbers"
80
+ :clearable="isRecalculationDisabled === false"
81
+ :label="$dataStore.t('percent') + `Adb Additive`"
82
+ :readonly="isRecalculationDisabled"
83
+ :rules="$dataStore.rules.recalculationAdditive"
84
+ />
85
+ <base-form-input
86
+ v-model="productConditionsForm.disabilityMultiply"
87
+ :maska="$maska.numbers"
88
+ :clearable="isRecalculationDisabled === false"
89
+ :label="$dataStore.t('percent') + `Disability Multiply`"
90
+ :readonly="isRecalculationDisabled"
91
+ :rules="$dataStore.rules.recalculationMultiply"
92
+ />
93
+ <base-form-input
94
+ v-model="productConditionsForm.disabilityAdditive"
95
+ :maska="$maska.numbers"
96
+ :clearable="isRecalculationDisabled === false"
97
+ :label="$dataStore.t('percent') + `Disability Additive`"
98
+ :readonly="isRecalculationDisabled"
99
+ :rules="$dataStore.rules.recalculationAdditive"
100
+ />
101
+ <base-panel-input
102
+ v-if="hasRiskGroup"
103
+ v-model="productConditionsForm.riskGroup"
104
+ :value="productConditionsForm.riskGroup.nameRu"
105
+ :label="$dataStore.t('productConditionsForm.riskGroup')"
106
+ :clearable="isRecalculationDisabled === false"
107
+ :readonly="isRecalculationDisabled"
108
+ append-inner-icon="mdi mdi-chevron-right"
109
+ @append="openPanel($dataStore.t('productConditionsForm.riskGroup'), $dataStore.riskGroup, 'riskGroup')"
110
+ />
111
+ </base-form-section>
112
+ <base-form-section :title="$dataStore.t('generalConditions')">
113
+ <div v-if="isRecalculation && ($route.params.taskId === '0' || $dataStore.isCalculator)">
18
114
  <base-form-input
19
115
  v-model="productConditionsForm.signDate"
20
116
  :maska="$maska.date"
21
117
  :clearable="false"
22
118
  :readonly="true"
23
- :label="$t('form.signDate')"
119
+ :label="$dataStore.t('form.signDate')"
24
120
  append-inner-icon="mdi mdi-calendar-blank-outline"
25
- ></base-form-input>
121
+ />
26
122
  <base-form-input
27
123
  v-model="productConditionsForm.birthDate"
28
124
  :maska="$maska.date"
29
125
  :readonly="isDisabled"
30
126
  :clearable="!isDisabled"
31
- :label="$t('form.birthDate')"
127
+ :label="$dataStore.t('form.birthDate')"
32
128
  :rules="$rules.required.concat($rules.birthDate)"
33
129
  append-inner-icon="mdi mdi-calendar-blank-outline"
34
- ></base-form-input>
130
+ />
35
131
  <base-panel-input
36
132
  v-model="productConditionsForm.gender"
37
133
  :value="productConditionsForm.gender.nameRu"
38
134
  :readonly="isDisabled"
39
135
  :clearable="!isDisabled"
40
- :label="$t('form.gender')"
136
+ :label="$dataStore.t('form.gender')"
41
137
  :rules="$rules.objectRequired"
42
138
  append-inner-icon="mdi mdi-chevron-right"
43
- @append="openPanel($t('form.gender'), $dataStore.gender, 'gender')"
44
- ></base-panel-input>
139
+ @append="openPanel($dataStore.t('form.gender'), $dataStore.gender, 'gender')"
140
+ />
45
141
  </div>
46
142
  <base-form-input
47
143
  v-model="productConditionsForm.coverPeriod"
48
144
  :maska="$maska.numbers"
49
145
  :readonly="isDisabled"
50
146
  :clearable="!isDisabled"
51
- :rules="$rules.required.concat($rules.numbers, $rules.coverPeriodFrom3to20)"
52
- :label="$t('productConditionsForm.coverPeriodFrom3to20')"
53
- ></base-form-input>
147
+ :rules="coverPeriodRule"
148
+ :label="$dataStore.t(whichProduct === 'gons' ? 'productConditionsForm.coverPeriodFrom3to20' : 'productConditionsForm.coverPeriod')"
149
+ />
54
150
  <base-panel-input
151
+ v-if="hasPaymentPeriod"
55
152
  v-model="productConditionsForm.paymentPeriod"
56
153
  :value="productConditionsForm.paymentPeriod.nameRu"
57
154
  :readonly="isDisabled"
58
155
  :clearable="!isDisabled"
59
156
  :rules="$rules.objectRequired"
60
- :label="$t('productConditionsForm.processPaymentPeriod')"
157
+ :label="$dataStore.t('productConditionsForm.processPaymentPeriod')"
158
+ append-inner-icon="mdi mdi-chevron-right"
159
+ @append="openPanel($dataStore.t('productConditionsForm.processPaymentPeriod'), $dataStore.processPaymentPeriod, 'paymentPeriod', $dataStore.getProcessPaymentPeriod)"
160
+ />
161
+ <base-panel-input
162
+ v-if="hasProcessIndexRate"
163
+ v-model="productConditionsForm.processIndexRate"
164
+ :value="productConditionsForm.processIndexRate.nameRu"
165
+ :readonly="isDisabled"
166
+ :clearable="!isDisabled"
167
+ :rules="$rules.objectRequired"
168
+ :label="$dataStore.t('productConditionsForm.processIndexRate')"
61
169
  append-inner-icon="mdi mdi-chevron-right"
62
- @append="openPanel($t('productConditionsForm.processPaymentPeriod'), $dataStore.processPaymentPeriod, 'paymentPeriod', $dataStore.getProcessPaymentPeriod)"
63
- ></base-panel-input>
170
+ @append="openPanel($dataStore.t('productConditionsForm.processIndexRate'), $dataStore.processIndexRate, 'processIndexRate', $dataStore.getProcessIndexRate)"
171
+ />
64
172
  <base-form-input
65
173
  v-model="productConditionsForm.requestedSumInsured"
66
- :readonly="isDisabled"
174
+ :readonly="isDisabledSum"
67
175
  :clearable="!isDisabled"
68
176
  :rules="requestedSumInsured"
69
- :label="$t('productConditionsForm.requestedSumInsured')"
70
- ></base-form-input>
177
+ :label="requestedSumInsuredLabel"
178
+ :suffix="$constants.currencySymbols.kzt"
179
+ @input="onInputSum"
180
+ @onClear="onClearSum"
181
+ />
182
+ <base-form-input
183
+ v-if="hasRequestedSumInsuredInDollar"
184
+ v-model="productConditionsForm.requestedSumInsuredInDollar"
185
+ :readonly="isDisabledSumDollar"
186
+ :clearable="!isDisabled"
187
+ :rules="requestedSumInsured"
188
+ :label="$dataStore.t('productConditionsForm.requestedSumInsuredInDollar')"
189
+ :suffix="$constants.currencySymbols.usd"
190
+ @input="onInputSumDollar"
191
+ @onClear="onClearSumDollar"
192
+ />
71
193
  <base-form-input
72
194
  v-model="productConditionsForm.insurancePremiumPerMonth"
73
195
  :readonly="isDisabled"
74
196
  :clearable="!isDisabled"
75
197
  :rules="insurancePremiumPerMonth"
76
- :label="$t('productConditionsForm.insurancePremiumAmount')"
77
- ></base-form-input>
198
+ :label="$dataStore.t('productConditionsForm.insurancePremiumAmount')"
199
+ :suffix="$constants.currencySymbols.kzt"
200
+ @input="onInputInsurancePremiumPerMonth"
201
+ @onClear="onClearPremium"
202
+ />
203
+ <base-form-input
204
+ v-if="hasInsurancePremiumPerMonthInDollar"
205
+ v-model="productConditionsForm.insurancePremiumPerMonthInDollar"
206
+ :readonly="isDisabled"
207
+ :clearable="!isDisabled"
208
+ :rules="insurancePremiumPerMonth"
209
+ :label="$dataStore.t('productConditionsForm.insurancePremiumAmountInDollar')"
210
+ :suffix="$constants.currencySymbols.usd"
211
+ @input="onInputInsurancePremiumPerMonthInDollar"
212
+ @onClear="onClearPremiumDollar"
213
+ />
214
+ <base-form-input
215
+ v-if="hasCurrency && $dataStore.currencies.usd"
216
+ v-model="$dataStore.currencies.usd"
217
+ :readonly="true"
218
+ :label="$dataStore.t('productConditionsForm.dollarExchangeRateNBRK')"
219
+ :suffix="$constants.currencySymbols.kzt"
220
+ />
221
+ </base-form-section>
222
+ <base-form-section :title="$dataStore.t('calculationAnnuityPayments')" v-if="hasAnnuityPayments">
223
+ <base-form-toggle
224
+ v-model="productConditionsForm.additionalConditionAnnuityPayments"
225
+ :title="$dataStore.t('productConditionsForm.guaranteedTermAnnuityPayments')"
226
+ :disabled="isDisabled"
227
+ :has-border="false"
228
+ />
229
+ <base-form-input
230
+ v-if="productConditionsForm.additionalConditionAnnuityPayments"
231
+ v-model="productConditionsForm.guaranteedPeriod"
232
+ :readonly="isDisabled"
233
+ :clearable="!isDisabled"
234
+ :rules="
235
+ productConditionsForm.termAnnuityPayments
236
+ ? [$dataStore.rules.guaranteedPeriodLimit(productConditionsForm.guaranteedPeriod, productConditionsForm.termAnnuityPayments)]
237
+ : []
238
+ "
239
+ :label="$dataStore.t('productConditionsForm.guaranteedPeriod')"
240
+ />
241
+ <base-panel-input
242
+ v-model="productConditionsForm.typeAnnuityInsurance"
243
+ :value="productConditionsForm.typeAnnuityInsurance.nameRu"
244
+ :readonly="isDisabled"
245
+ :clearable="!isDisabled"
246
+ :rules="$rules.objectRequired"
247
+ :label="$dataStore.t('productConditionsForm.typeAnnuityInsurance')"
248
+ append-inner-icon="mdi mdi-chevron-right"
249
+ @append="openPanel($dataStore.t('productConditionsForm.typeAnnuityInsurance'), $dataStore.dicAnnuityTypeList, 'typeAnnuityInsurance', $dataStore.getDicAnnuityTypeList)"
250
+ />
251
+ <base-form-input
252
+ v-if="productConditionsForm.typeAnnuityInsurance.code !== 'Lifelong'"
253
+ v-model="productConditionsForm.termAnnuityPayments"
254
+ :readonly="isDisabled"
255
+ :clearable="!isDisabled"
256
+ :rules="$dataStore.rules.required.concat($dataStore.rules.numbers)"
257
+ :label="$dataStore.t('productConditionsForm.termAnnuityPayments')"
258
+ />
259
+ <base-panel-input
260
+ v-model="productConditionsForm.periodAnnuityPayment"
261
+ :value="productConditionsForm.periodAnnuityPayment.nameRu"
262
+ :readonly="isDisabled"
263
+ :clearable="!isDisabled"
264
+ :rules="$rules.objectRequired"
265
+ :label="$dataStore.t('productConditionsForm.periodAnnuityPayment')"
266
+ append-inner-icon="mdi mdi-chevron-right"
267
+ @append="
268
+ openPanel(
269
+ $dataStore.t('productConditionsForm.processPaymentPeriod'),
270
+ $dataStore.processAnnuityPaymentPeriod,
271
+ 'periodAnnuityPayment',
272
+ $dataStore.getProcessAnnuityPaymentPeriod,
273
+ )
274
+ "
275
+ />
276
+ <base-form-input
277
+ v-model="productConditionsForm.amountAnnuityPayments"
278
+ :readonly="isDisabled"
279
+ :clearable="!isDisabled"
280
+ :rules="amountAnnuityPayments"
281
+ :label="$dataStore.t('productConditionsForm.amountAnnuityPayments')"
282
+ />
283
+ </base-form-section>
284
+ <base-form-section v-if="additionalTerms && additionalTerms.length" :title="$dataStore.t('productConditionsForm.additional')">
285
+ <div v-for="(term, index) of additionalTerms" :key="index">
286
+ <base-panel-input
287
+ v-if="filterTermConditions(term)"
288
+ v-model="additionalTerms[index]"
289
+ :value="term.coverSumName"
290
+ :readonly="isTermsDisabled"
291
+ :clearable="!isTermsDisabled"
292
+ :label="term.coverTypeName"
293
+ append-inner-icon="mdi mdi-chevron-right"
294
+ :suffix="!!term.amount ? `${formatTermValue(term.amount)} ${currencySymbolsAddTerm}` : ''"
295
+ @append="openTermPanel(term.coverTypeName, $dataStore.getAdditionalInsuranceTermsAnswers, term.coverTypeId, index)"
296
+ />
297
+ </div>
78
298
  </base-form-section>
79
299
  </v-form>
80
300
  <base-btn
81
- v-if="!isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
301
+ v-if="!$dataStore.isCalculator && isRecalculation && hasCalculated"
302
+ :btn="$libStyles.greenLightBtn"
303
+ :text="$dataStore.t('buttons.toStatement')"
304
+ @click="toStatement"
305
+ />
306
+ <base-btn
307
+ v-if="$dataStore.isCalculator ? true : !isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
82
308
  :loading="isCalculating"
83
- :text="$t('buttons.calculate')"
309
+ :text="$dataStore.t('buttons.calculate')"
84
310
  @click="submitForm"
85
- ></base-btn>
311
+ />
312
+ <div v-if="$dataStore.isTask() && $dataStore.isUnderwriter() && !isRecalculationDisabled" class="flex gap-3">
313
+ <base-btn :text="$dataStore.t('buttons.calcSum')" type="submit" @click.prevent="underwriterCalculate('sum')" :loading="isCalculating" />
314
+ <base-btn :text="$dataStore.t('buttons.calcPremium')" type="submit" @click.prevent="underwriterCalculate('premium')" :loading="isCalculating" />
315
+ </div>
86
316
  <Teleport v-if="isPanelOpen" to="#panel-actions">
87
317
  <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
88
- <base-rounded-input v-model="searchQuery" :label="$t('labels.search')" class="w-full p-2" :hide-details="true"></base-rounded-input>
318
+ <base-rounded-input v-model.trim="searchQuery" :label="$dataStore.t('labels.search')" class="w-full p-2" :hide-details="true" />
89
319
  <div v-if="panelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
90
- <base-panel-select-item :text="$t('form.notChosen')" :selected="panelValue.nameRu === null" @click="pickPanelValue(new Value())"></base-panel-select-item>
320
+ <base-panel-select-item :text="$dataStore.t('form.notChosen')" :selected="panelValue.nameRu === null" @click="pickPanelValue(new Value())" />
91
321
  <base-panel-select-item
92
322
  v-for="(item, index) of panelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
93
323
  :key="index"
94
- :text="item.nameRu as string"
324
+ :text="(item.nameRu as string)"
95
325
  :selected="item.nameRu === panelValue.nameRu"
96
326
  @click="pickPanelValue(item)"
97
- ></base-panel-select-item>
327
+ />
328
+ </div>
329
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50" />
330
+ </div>
331
+ </Teleport>
332
+ <Teleport v-if="isTermsPanelOpen" to="#panel-actions">
333
+ <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
334
+ <base-rounded-input v-model.trim="searchQuery" :label="$dataStore.t('labels.search')" class="w-full p-2" :hide-details="true" />
335
+ <div v-if="panelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
336
+ <base-panel-select-item
337
+ v-for="(item, index) of panelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
338
+ :key="index"
339
+ :text="(item.nameRu as string)"
340
+ :selected="item.nameRu === termValue?.coverSumName"
341
+ @click="pickTermValue(item)"
342
+ />
98
343
  </div>
99
- <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50"></base-loader>
344
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50" />
100
345
  </div>
101
346
  </Teleport>
102
347
  </section>
103
348
  </template>
104
349
 
105
350
  <script lang="ts">
106
- import { Value } from '@/composables/classes';
351
+ import { Member, Value } from '../../composables/classes';
107
352
 
108
353
  export default defineComponent({
109
354
  props: {
@@ -111,6 +356,10 @@ export default defineComponent({
111
356
  type: Boolean,
112
357
  default: false,
113
358
  },
359
+ product: {
360
+ type: String,
361
+ default: false,
362
+ },
114
363
  },
115
364
  setup(props) {
116
365
  const vForm = ref<any>();
@@ -120,16 +369,21 @@ export default defineComponent({
120
369
  const dataStore = useDataStore();
121
370
  const memberStore = useMemberStore();
122
371
 
372
+ const whichProduct = ref<string>(dataStore.isCalculator ? props.product : dataStore.product!);
123
373
  const isCalculating = ref<boolean>(false);
124
374
  const isPanelLoading = ref<boolean>(false);
125
375
  const isPanelOpen = ref<boolean>(false);
376
+ const isTermsPanelOpen = ref<boolean>(false);
126
377
  const panelValue = ref<Value>(new Value());
378
+ const termValue = ref<AddCover>();
127
379
  const panelList = ref<Value[]>([]);
128
380
  const productConditionsForm = formStore.productConditionsForm;
129
381
  const currentPanel = ref<keyof typeof productConditionsForm>();
382
+ const currentIndex = ref<number>();
130
383
  const searchQuery = ref<string>('');
131
384
  const whichSum = ref<'insurancePremiumPerMonth' | 'requestedSumInsured' | ''>('');
132
385
 
386
+ const additionalTerms = ref<AddCover[]>([]);
133
387
  const isUnderwriterForm = computed(() => {
134
388
  if (route.params.taskId === '0 ' || props.isRecalculation === true) {
135
389
  return false;
@@ -137,27 +391,152 @@ export default defineComponent({
137
391
  return formStore.applicationData.statusCode === 'UnderwriterForm';
138
392
  }
139
393
  });
140
- const isDisabled = computed(() => !memberStore.isStatementEditible(formStore.productConditionsFormKey));
394
+ const isDisabled = computed(() => (dataStore.isCalculator ? false : !memberStore.isStatementEditible('productConditionsForm')));
395
+ const isTermsDisabled = computed(() => {
396
+ if (dataStore.isGons) {
397
+ return true;
398
+ }
399
+ return isDisabled.value;
400
+ });
141
401
  const isTask = computed(() => (route.params.taskId === '0' && props.isRecalculation === true) || dataStore.isTask());
402
+ const isRecalculationDisabled = computed(() => formStore.isDisabled.recalculationForm);
403
+ const isUnderwriterRole = computed(() => dataStore.isUnderwriter() || dataStore.isAdmin() || dataStore.isSupport());
142
404
  const insurancePremiumPerMonth = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
143
405
  const requestedSumInsured = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
406
+ const hasCalculated = computed(() => !!productConditionsForm.requestedSumInsured && !!productConditionsForm.insurancePremiumPerMonth);
407
+ const amountAnnuityPayments = computed(() => (!!productConditionsForm.amountAnnuityPayments ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
408
+ const hasProcessIndexRate = computed(() => {
409
+ if (whichProduct.value === 'gons' || whichProduct.value === 'halykkazyna' || whichProduct.value === 'liferenta') {
410
+ return false;
411
+ }
412
+ return true;
413
+ });
414
+ const hasPaymentPeriod = computed(() => {
415
+ if (whichProduct.value === 'halykkazyna') {
416
+ return false;
417
+ }
418
+ return true;
419
+ });
420
+ const hasRequestedSumInsuredInDollar = computed(() => {
421
+ if (whichProduct.value === 'halykkazyna') {
422
+ return true;
423
+ }
424
+ return false;
425
+ });
426
+ const hasInsurancePremiumPerMonthInDollar = computed(() => {
427
+ if (whichProduct.value === 'halykkazyna') {
428
+ return true;
429
+ }
430
+ return false;
431
+ });
432
+ const hasCurrency = computed(() => {
433
+ if (whichProduct.value === 'halykkazyna') {
434
+ return true;
435
+ }
436
+ return false;
437
+ });
438
+ const hasAdbMultiply = computed(() => {
439
+ if (whichProduct.value === 'gons') {
440
+ return false;
441
+ }
442
+ return true;
443
+ });
444
+ const hasAdbAdditive = computed(() => {
445
+ if (whichProduct.value === 'gons') {
446
+ return false;
447
+ }
448
+ return true;
449
+ });
450
+ const hasRiskGroup = computed(() => {
451
+ if (whichProduct.value === 'gons') {
452
+ return false;
453
+ }
454
+ return true;
455
+ });
456
+ const hasAnnuityPayments = computed(() => {
457
+ if (whichProduct.value === 'liferenta') {
458
+ return true;
459
+ }
460
+ return false;
461
+ });
462
+ const coverPeriodRule = computed(() => {
463
+ const baseCondition = dataStore.rules.required.concat(dataStore.rules.numbers);
464
+ if (whichProduct.value === 'gons') {
465
+ return baseCondition.concat(dataStore.rules.coverPeriodFrom3to20);
466
+ }
467
+ if (whichProduct.value === 'halykkazyna') {
468
+ return baseCondition.concat(dataStore.rules.coverPeriodFrom2to20);
469
+ }
470
+ return baseCondition;
471
+ });
472
+ const currencySymbolsAddTerm = computed(() => {
473
+ if (whichProduct.value === 'halykkazyna') {
474
+ return constants.currencySymbols.usd;
475
+ }
476
+ return constants.currencySymbols.kzt;
477
+ });
478
+ const requestedSumInsuredLabel = computed(() => {
479
+ if (whichProduct.value === 'halykkazyna') {
480
+ return dataStore.t('productConditionsForm.requestedSumInsuredInTenge');
481
+ }
482
+ return dataStore.t('productConditionsForm.requestedSumInsured');
483
+ });
484
+ const isDisabledSum = computed(() => {
485
+ if (whichProduct.value === 'halykkazyna') {
486
+ return true;
487
+ }
488
+ return isDisabled.value;
489
+ });
490
+ const isDisabledSumDollar = computed(() => {
491
+ if (whichProduct.value === 'halykkazyna') {
492
+ return true;
493
+ }
494
+ return isDisabled.value;
495
+ });
144
496
 
145
- const pickPanelValue = (item: Value) => {
146
- if (!isDisabled.value) {
147
- dataStore.panel.open = false;
148
- isPanelOpen.value = false;
149
- // @ts-ignore
150
- productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
151
- } else {
152
- dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
497
+ const formatTermValue = (term: number) => {
498
+ if (term !== null) {
499
+ return Number.isInteger(term) ? dataStore.getNumberWithSpaces(term) : dataStore.getNumberWithDot(term);
500
+ }
501
+ return null;
502
+ };
503
+
504
+ const toStatement = async () => {
505
+ const statementItem = dataStore.menuItems.find(i => i.id === 'statement');
506
+ if (statementItem) {
507
+ dataStore.menu.selectedItem = statementItem;
508
+ await router.replace({
509
+ name: 'taskId',
510
+ query: {
511
+ ...route.query,
512
+ tab: 'statement',
513
+ },
514
+ });
153
515
  }
154
516
  };
155
517
 
518
+ const pickPanelValue = (item: Value) => {
519
+ dataStore.panel.open = false;
520
+ isPanelOpen.value = false;
521
+ if (!currentPanel.value) return;
522
+ // @ts-ignore
523
+ productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
524
+ };
525
+
526
+ const pickTermValue = (item: Value) => {
527
+ dataStore.panel.open = false;
528
+ isTermsPanelOpen.value = false;
529
+ if (typeof currentIndex.value !== 'number') return;
530
+ additionalTerms.value[currentIndex.value].coverSumId = item.id as string;
531
+ additionalTerms.value[currentIndex.value].coverSumName = item.nameRu as string;
532
+ };
533
+
156
534
  const openPanel = async (title: string, list: Value[], key: string, asyncFunction?: Function, filterKey?: string) => {
157
- if (!isDisabled.value) {
535
+ if (!isDisabled.value || (key === 'riskGroup' && !isRecalculationDisabled.value)) {
158
536
  searchQuery.value = '';
159
537
  currentPanel.value = key as keyof typeof productConditionsForm;
160
538
  isPanelOpen.value = true;
539
+ isTermsPanelOpen.value = false;
161
540
  dataStore.panelAction = null;
162
541
  dataStore.panel.open = true;
163
542
  dataStore.panel.title = title;
@@ -167,7 +546,7 @@ export default defineComponent({
167
546
  isPanelLoading.value = true;
168
547
  newList = await asyncFunction(filterKey, formStore.productConditionsFormKey);
169
548
  }
170
- panelList.value = newList;
549
+ panelList.value = filterList(newList, key);
171
550
  // @ts-ignore
172
551
  panelValue.value = productConditionsForm[currentPanel.value];
173
552
  isPanelLoading.value = false;
@@ -176,20 +555,161 @@ export default defineComponent({
176
555
  }
177
556
  };
178
557
 
558
+ const filterList = (list: Value[], key: string) => {
559
+ if (whichProduct.value === 'baiterek') {
560
+ if (dataStore.isManagerHalykBank()) {
561
+ if (key === 'paymentPeriod') return list.filter(i => i.code !== 'single');
562
+ }
563
+ }
564
+ return list;
565
+ };
566
+
567
+ const openTermPanel = async (title: string, asyncFunction: Function, questionId: string, index: number) => {
568
+ if (!isDisabled.value) {
569
+ searchQuery.value = '';
570
+ currentIndex.value = index;
571
+ isPanelOpen.value = false;
572
+ isTermsPanelOpen.value = true;
573
+ dataStore.panelAction = null;
574
+ dataStore.panel.open = true;
575
+ dataStore.panel.title = title;
576
+
577
+ let newList;
578
+ if (asyncFunction) {
579
+ isPanelLoading.value = true;
580
+ newList = await asyncFunction(questionId);
581
+ }
582
+ panelList.value = newList;
583
+ // @ts-ignore
584
+ termValue.value = additionalTerms.value[index];
585
+ isPanelLoading.value = false;
586
+ } else {
587
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
588
+ }
589
+ };
590
+
591
+ const underwriterCalculate = async (type: 'sum' | 'premium') => {
592
+ if (!type) return;
593
+ if (type === 'sum') {
594
+ whichSum.value = 'insurancePremiumPerMonth';
595
+ }
596
+ if (type === 'premium') {
597
+ whichSum.value = 'requestedSumInsured';
598
+ }
599
+ await submitForm();
600
+ };
601
+
179
602
  const pickCalculation = async (type: 'insurancePremiumPerMonth' | 'requestedSumInsured') => {
180
603
  if (!type) return false;
181
604
  whichSum.value = type;
182
605
  await submitForm();
183
606
  };
184
607
 
608
+ const onInputInsurancePremiumPerMonth = (event: Event) => {
609
+ if (event.target && 'value' in event.target && event.target.value) {
610
+ whichSum.value = 'insurancePremiumPerMonth';
611
+ const calculatedPremiumDollar = getNumber(event.target.value as string);
612
+ if (calculatedPremiumDollar) {
613
+ productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(productConditionsForm.insurancePremiumPerMonth);
614
+ if (whichProduct.value === 'halykkazyna') {
615
+ if (typeof dataStore.currencies.usd === 'number') {
616
+ productConditionsForm.insurancePremiumPerMonthInDollar = dataStore.getNumberWithSpaces(calculatedPremiumDollar / dataStore.currencies.usd);
617
+ } else {
618
+ dataStore.showToaster('error', dataStore.t('toaster.noCurrency'));
619
+ }
620
+ }
621
+ }
622
+ }
623
+ };
624
+
625
+ const onInputInsurancePremiumPerMonthInDollar = (event: Event) => {
626
+ if (event.target && 'value' in event.target && event.target.value && dataStore.currencies.usd) {
627
+ whichSum.value = 'insurancePremiumPerMonth';
628
+ const calculatedPremium = getNumber(event.target.value as string);
629
+ if (calculatedPremium) {
630
+ productConditionsForm.insurancePremiumPerMonthInDollar = dataStore.getNumberWithSpaces(productConditionsForm.insurancePremiumPerMonthInDollar);
631
+ productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(calculatedPremium * dataStore.currencies.usd);
632
+ }
633
+ }
634
+ };
635
+
636
+ const onInputSum = (event: Event) => {
637
+ if (event.target && 'value' in event.target && event.target.value) {
638
+ whichSum.value = 'requestedSumInsured';
639
+ const calculatedSumDollar = getNumber(event.target.value as string);
640
+ if (calculatedSumDollar) {
641
+ productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(productConditionsForm.requestedSumInsured);
642
+ if (whichProduct.value === 'halykkazyna') {
643
+ if (typeof dataStore.currencies.usd === 'number') {
644
+ productConditionsForm.requestedSumInsuredInDollar = dataStore.getNumberWithSpaces(calculatedSumDollar / dataStore.currencies.usd);
645
+ } else {
646
+ dataStore.showToaster('error', dataStore.t('toaster.noCurrency'));
647
+ }
648
+ }
649
+ }
650
+ }
651
+ };
652
+
653
+ const onInputSumDollar = (event: Event) => {
654
+ if (event.target && 'value' in event.target && event.target.value && dataStore.currencies.usd) {
655
+ whichSum.value = 'requestedSumInsured';
656
+ const calculatedSum = getNumber(event.target.value as string);
657
+ if (calculatedSum) {
658
+ productConditionsForm.requestedSumInsuredInDollar = dataStore.getNumberWithSpaces(productConditionsForm.requestedSumInsuredInDollar);
659
+ productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(calculatedSum * dataStore.currencies.usd);
660
+ }
661
+ }
662
+ };
663
+
664
+ const onClearSum = () => {
665
+ productConditionsForm.requestedSumInsuredInDollar = null;
666
+ };
667
+
668
+ const onClearSumDollar = () => {
669
+ productConditionsForm.requestedSumInsured = null;
670
+ };
671
+
672
+ const onClearPremium = () => {
673
+ productConditionsForm.insurancePremiumPerMonthInDollar = null;
674
+ };
675
+
676
+ const onClearPremiumDollar = () => {
677
+ productConditionsForm.insurancePremiumPerMonth = null;
678
+ };
679
+
680
+ const clearFields = () => {
681
+ productConditionsForm.coverPeriod = null;
682
+ productConditionsForm.birthDate = null;
683
+ productConditionsForm.gender = new Value();
684
+ productConditionsForm.paymentPeriod = new Value();
685
+ productConditionsForm.processIndexRate = new Value();
686
+ productConditionsForm.requestedSumInsured = null;
687
+ productConditionsForm.requestedSumInsuredInDollar = null;
688
+ productConditionsForm.insurancePremiumPerMonth = null;
689
+ productConditionsForm.insurancePremiumPerMonthInDollar = null;
690
+ };
691
+
692
+ const filterTermConditions = (term: AddCover) => {
693
+ if (term.coverTypeCode === 10) {
694
+ return !!formStore.insuredForm.find((member: Member) => member.iin === formStore.policyholderForm.iin) === false;
695
+ }
696
+ return true;
697
+ };
698
+
185
699
  const submitForm = async () => {
186
700
  vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
187
701
  if (v.valid) {
188
702
  if (whichSum.value === 'requestedSumInsured') {
189
703
  productConditionsForm.insurancePremiumPerMonth = null;
704
+ if (whichProduct.value === 'halykkazyna') {
705
+ productConditionsForm.insurancePremiumPerMonthInDollar = null;
706
+ }
190
707
  }
191
708
  if (whichSum.value === 'insurancePremiumPerMonth') {
192
709
  productConditionsForm.requestedSumInsured = null;
710
+ if (whichProduct.value === 'halykkazyna') {
711
+ productConditionsForm.requestedSumInsuredInDollar = null;
712
+ }
193
713
  }
194
714
  if (productConditionsForm.requestedSumInsured !== '' && productConditionsForm.requestedSumInsured != null) {
195
715
  productConditionsForm.insurancePremiumPerMonth = null;
@@ -207,15 +727,17 @@ export default defineComponent({
207
727
 
208
728
  if (isUnderwriterForm.value) {
209
729
  type recalculationInfo = {
210
- lifeMultiply: string | null;
211
- lifeAdditive: string | null;
212
- adbMultiply: string | null;
213
- adbAdditive: string | null;
214
- disabilityMultiply: string | null;
215
- disabilityAdditive: string | null;
216
- amount?: number | null;
217
- premium?: number | null;
218
- riskGroup?: string | number | null;
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;
219
741
  };
220
742
  const recalculationData: recalculationInfo = (({ lifeMultiply, lifeAdditive, adbMultiply, adbAdditive, disabilityMultiply, disabilityAdditive }) => ({
221
743
  lifeMultiply,
@@ -229,18 +751,31 @@ export default defineComponent({
229
751
  // @ts-ignore
230
752
  recalculationData[key] = formatProcents(recalculationData[key]);
231
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;
232
764
  recalculationData.amount = Number((productConditionsForm.requestedSumInsured as string)?.replace(/\s/g, ''));
233
765
  recalculationData.premium = Number((productConditionsForm.insurancePremiumPerMonth as string)?.replace(/\s/g, ''));
234
766
  recalculationData.riskGroup = productConditionsForm.riskGroup?.id ? productConditionsForm.riskGroup.id : 1;
235
767
  isCalculating.value = true;
236
- await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId, whichSum.value);
768
+ await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId as string, whichSum.value);
237
769
  }
238
770
  isCalculating.value = true;
239
771
  if (props.isRecalculation) {
240
- await dataStore.calculateWithoutApplication(true);
772
+ //@ts-ignore
773
+ await dataStore.calculateWithoutApplication(true, whichProduct.value);
774
+ additionalTerms.value = formStore.additionalInsuranceTermsWithout;
241
775
  } else {
242
776
  if (dataStore.isProcessEditable(formStore.applicationData.statusCode)) {
243
- await dataStore.calculate(route.params.taskId);
777
+ await dataStore.calculate(route.params.taskId as string);
778
+ additionalTerms.value = formStore.additionalInsuranceTerms;
244
779
  }
245
780
  }
246
781
  isCalculating.value = false;
@@ -249,11 +784,11 @@ export default defineComponent({
249
784
  if (errors) {
250
785
  const errorText = errors.querySelector('.v-label.v-field-label');
251
786
  if (errorText) {
252
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorText.innerHTML?.replace(/[-<>!//.]/g, '')));
787
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorText.innerHTML?.replace(/[-<>!//.]/g, '') }));
253
788
  } else {
254
789
  const errorFieldText = errors.querySelector('.v-input__control');
255
790
  if (errorFieldText) {
256
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '')));
791
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '') }));
257
792
  }
258
793
  }
259
794
  errors.scrollIntoView({
@@ -268,8 +803,16 @@ export default defineComponent({
268
803
 
269
804
  onMounted(async () => {
270
805
  if (props.isRecalculation === true) {
271
- if (route.params.taskId === '0' && productConditionsForm.requestedSumInsured === null && productConditionsForm.insurancePremiumPerMonth === null) {
272
- const defaultData = await dataStore.getDefaultCalculationData(true);
806
+ if (dataStore.isCalculator) {
807
+ clearFields();
808
+ }
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);
273
816
  if (!defaultData) {
274
817
  dataStore.showToaster('error', 'Отсутствуют базовые данные');
275
818
  return;
@@ -277,55 +820,74 @@ export default defineComponent({
277
820
  formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
278
821
  productConditionsForm.requestedSumInsured = defaultData.amount;
279
822
  productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
280
- productConditionsForm.processIndexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
281
- productConditionsForm.paymentPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
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;
282
827
  productConditionsForm.signDate = reformatDate(defaultData.signDate);
283
828
  }
284
829
  }
830
+ additionalTerms.value = props.isRecalculation ? formStore.additionalInsuranceTermsWithout : formStore.additionalInsuranceTerms;
285
831
  if (!!productConditionsForm.insurancePremiumPerMonth) {
286
832
  whichSum.value = 'insurancePremiumPerMonth';
287
833
  }
288
834
  if (!!productConditionsForm.requestedSumInsured) {
289
835
  whichSum.value = 'requestedSumInsured';
290
836
  }
837
+ if (dataStore.isCalculator) {
838
+ dataStore.processCode = constants.products[whichProduct.value as keyof typeof constants.products];
839
+ await dataStore.getProcessPaymentPeriod();
840
+ }
841
+ if (whichProduct.value === 'halykkazyna') {
842
+ const kazynaPaymentPeriod = dataStore.processPaymentPeriod.find(i => i.code === 'single');
843
+ if (kazynaPaymentPeriod) productConditionsForm.paymentPeriod = kazynaPaymentPeriod;
844
+ await dataStore.getCurrencies();
845
+ }
291
846
  });
292
847
 
293
848
  watch(
294
- () => productConditionsForm.requestedSumInsured,
849
+ () => productConditionsForm.amountOfInsurancePremium,
295
850
  val => {
296
- if (!val && whichSum.value == 'requestedSumInsured') whichSum.value = '';
297
- if (val && whichSum.value != 'insurancePremiumPerMonth') {
298
- whichSum.value = 'requestedSumInsured';
299
- productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(val);
300
- }
851
+ if (val) productConditionsForm.amountOfInsurancePremium = dataStore.getNumberWithSpaces(val);
301
852
  },
302
853
  );
303
854
  watch(
304
- () => productConditionsForm.insurancePremiumPerMonth,
855
+ () => formStore.productConditionsForm.amountAnnuityPayments,
305
856
  val => {
306
- if (!val && whichSum.value == 'insurancePremiumPerMonth') whichSum.value = '';
307
- if (val && whichSum.value != 'requestedSumInsured') {
308
- whichSum.value = 'insurancePremiumPerMonth';
309
- productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(val);
310
- }
857
+ if (val) formStore.productConditionsForm.amountAnnuityPayments = dataStore.getNumberWithSpaces(val);
311
858
  },
312
859
  );
313
860
  watch(
314
- () => productConditionsForm.amountOfInsurancePremium,
861
+ () => formStore.productConditionsForm.typeAnnuityInsurance,
315
862
  val => {
316
- if (val) productConditionsForm.amountOfInsurancePremium = dataStore.getNumberWithSpaces(val);
863
+ if (val.code === 'Lifelong') formStore.productConditionsForm.termAnnuityPayments = null;
864
+ },
865
+ );
866
+ watch(
867
+ () => dataStore.panel.open,
868
+ () => {
869
+ if (dataStore.panel.open === false) {
870
+ isPanelOpen.value = false;
871
+ isTermsPanelOpen.value = false;
872
+ dataStore.panelAction = null;
873
+ }
317
874
  },
875
+ { immediate: true },
318
876
  );
319
877
 
320
878
  return {
321
879
  // State
322
880
  formStore,
323
881
  vForm,
882
+ whichProduct,
324
883
  productConditionsForm,
884
+ additionalTerms,
325
885
  isCalculating,
326
886
  isPanelLoading,
327
887
  isPanelOpen,
888
+ isTermsPanelOpen,
328
889
  panelValue,
890
+ termValue,
329
891
  panelList,
330
892
  searchQuery,
331
893
  whichSum,
@@ -334,15 +896,51 @@ export default defineComponent({
334
896
  // Computed
335
897
  isTask,
336
898
  isDisabled,
899
+ isTermsDisabled,
337
900
  isUnderwriterForm,
338
901
  insurancePremiumPerMonth,
339
902
  requestedSumInsured,
903
+ isRecalculationDisabled,
904
+ isUnderwriterRole,
905
+ hasProcessIndexRate,
906
+ hasPaymentPeriod,
907
+ hasRequestedSumInsuredInDollar,
908
+ hasInsurancePremiumPerMonthInDollar,
909
+ hasCurrency,
910
+ hasAdbMultiply,
911
+ hasAdbAdditive,
912
+ hasRiskGroup,
913
+ hasCalculated,
914
+ hasAnnuityPayments,
915
+ currencySymbolsAddTerm,
916
+ amountAnnuityPayments,
917
+ requestedSumInsuredLabel,
918
+ isDisabledSum,
919
+ isDisabledSumDollar,
920
+
921
+ // Rules
922
+ coverPeriodRule,
340
923
 
341
924
  // Functions
342
925
  submitForm,
343
926
  pickPanelValue,
927
+ pickTermValue,
344
928
  openPanel,
929
+ openTermPanel,
345
930
  pickCalculation,
931
+ underwriterCalculate,
932
+ onInputInsurancePremiumPerMonth,
933
+ onInputInsurancePremiumPerMonthInDollar,
934
+ onInputSum,
935
+ onInputSumDollar,
936
+ toStatement,
937
+ onClearSum,
938
+ onClearSumDollar,
939
+ onClearPremium,
940
+ onClearPremiumDollar,
941
+ clearFields,
942
+ formatTermValue,
943
+ filterTermConditions,
346
944
  };
347
945
  },
348
946
  });