hl-core 0.0.8 → 0.0.9-beta.10

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