hl-core 0.0.8-beta.3 → 0.0.8-beta.30

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