hl-core 0.0.10-beta.4 → 0.0.10-beta.41

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 (53) hide show
  1. package/README.md +0 -2
  2. package/api/base.api.ts +338 -191
  3. package/api/interceptors.ts +3 -5
  4. package/components/Complex/TextBlock.vue +2 -0
  5. package/components/Dialog/Dialog.vue +7 -1
  6. package/components/Dialog/FamilyDialog.vue +2 -0
  7. package/components/Form/DigitalDocument.vue +52 -0
  8. package/components/Form/DynamicForm.vue +1 -0
  9. package/components/Form/FormData.vue +1 -0
  10. package/components/Form/ManagerAttachment.vue +48 -10
  11. package/components/Form/ProductConditionsBlock.vue +12 -6
  12. package/components/Input/Datepicker.vue +5 -0
  13. package/components/Input/DynamicInput.vue +2 -0
  14. package/components/Input/FormInput.vue +7 -0
  15. package/components/Input/OtpInput.vue +25 -0
  16. package/components/Input/PanelInput.vue +1 -0
  17. package/components/Input/RoundedInput.vue +4 -0
  18. package/components/Input/RoundedSelect.vue +4 -0
  19. package/components/Input/SwitchInput.vue +2 -0
  20. package/components/Input/TextAreaField.vue +71 -0
  21. package/components/Input/TextInput.vue +2 -0
  22. package/components/Layout/Drawer.vue +2 -0
  23. package/components/Menu/MenuNav.vue +1 -1
  24. package/components/Pages/Anketa.vue +168 -169
  25. package/components/Pages/Auth.vue +2 -0
  26. package/components/Pages/ContragentForm.vue +2 -1
  27. package/components/Pages/Documents.vue +432 -59
  28. package/components/Pages/MemberForm.vue +334 -160
  29. package/components/Pages/ProductConditions.vue +838 -226
  30. package/components/Panel/PanelHandler.vue +280 -121
  31. package/components/Transitions/Animation.vue +2 -0
  32. package/components/Utilities/Chip.vue +3 -1
  33. package/components/Utilities/JsonViewer.vue +1 -2
  34. package/composables/classes.ts +143 -49
  35. package/composables/constants.ts +44 -0
  36. package/composables/fields.ts +6 -4
  37. package/composables/index.ts +298 -7
  38. package/composables/styles.ts +8 -24
  39. package/configs/pwa.ts +1 -7
  40. package/layouts/clear.vue +1 -1
  41. package/layouts/default.vue +1 -1
  42. package/layouts/full.vue +1 -1
  43. package/locales/ru.json +80 -19
  44. package/nuxt.config.ts +10 -13
  45. package/package.json +12 -12
  46. package/plugins/head.ts +2 -1
  47. package/store/data.store.ts +802 -531
  48. package/store/member.store.ts +18 -6
  49. package/store/rules.ts +22 -2
  50. package/types/enum.ts +33 -2
  51. package/types/env.d.ts +2 -2
  52. package/types/form.ts +71 -74
  53. package/types/index.ts +924 -873
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <section class="flex flex-col gap-4 px-[10px]">
3
- <v-form ref="vForm" @submit="submitForm" class="overflow-y-scroll" :class="[!$dataStore.isCalculator && isCalculator && hasCalculated ? 'max-h-[73svh]' : 'max-h-[80svh]']">
2
+ <section v-if="!isLoading" class="flex flex-col gap-4 px-[10px]" :class="[$styles.scrollPage]">
3
+ <v-form ref="vForm" @submit="submitForm">
4
4
  <base-message-block
5
5
  v-if="isCalculator"
6
6
  class="mt-4"
@@ -36,7 +36,14 @@
36
36
  <base-form-input v-model="formStore.policyholderForm.gender.nameRu" class="mb-4" :label="$dataStore.t('form.gender')" :readonly="true" />
37
37
  </base-form-section>
38
38
  <base-form-section
39
- v-if="isUnderwriterRole && $dataStore.members.insuredApp.has === true && whichProduct !== 'lifebusiness' && whichProduct !== 'gns' && whichProduct !== 'pensionannuitynew'"
39
+ v-if="
40
+ isUnderwriterRole &&
41
+ $dataStore.members.insuredApp.has === true &&
42
+ whichProduct !== 'lifebusiness' &&
43
+ whichProduct !== 'gns' &&
44
+ whichProduct !== 'pensionannuitynew' &&
45
+ whichProduct !== 'lifetrip'
46
+ "
40
47
  :title="$dataStore.t('insuredForm')"
41
48
  >
42
49
  <div v-for="(insured, index) of formStore.insuredForm" :key="index">
@@ -48,15 +55,12 @@
48
55
  <base-form-input v-model="insured.gender.nameRu" class="mb-4" :label="$dataStore.t('form.gender')" :readonly="true" />
49
56
  </div>
50
57
  </base-form-section>
51
- <base-form-section
52
- v-if="isUnderwriterRole && whichProduct !== 'lifebusiness' && whichProduct !== 'gns' && whichProduct !== 'pensionannuitynew'"
53
- :title="$dataStore.t('recalculationInfo')"
54
- >
58
+ <base-form-section v-if="isUnderwriterRole && whichProduct !== 'pensionannuitynew' && whichProduct !== 'balam' && whichProduct !== 'tumar'" :title="$dataStore.t('recalculationInfo')">
55
59
  <base-form-input
56
60
  v-model="productConditionsForm.lifeMultiply"
57
61
  :maska="$maska.numbers"
58
62
  :clearable="isRecalculationDisabled === false"
59
- :label="$dataStore.t('percent') + `Life Multiply`"
63
+ :label="lifeMultiplyLabel"
60
64
  :readonly="isRecalculationDisabled"
61
65
  :rules="whichProduct === 'gons' ? $dataStore.rules.recalculationMultiplyBetween : $dataStore.rules.recalculationMultiply"
62
66
  />
@@ -64,7 +68,7 @@
64
68
  v-model="productConditionsForm.lifeAdditive"
65
69
  :maska="$maska.numbers"
66
70
  :clearable="isRecalculationDisabled === false"
67
- :label="$dataStore.t('percent') + `Life Additive`"
71
+ :label="lifeAdditiveLabel"
68
72
  :readonly="readonlyLifeAdditive"
69
73
  :rules="$dataStore.rules.recalculationAdditive"
70
74
  />
@@ -73,7 +77,7 @@
73
77
  v-model="productConditionsForm.adbMultiply"
74
78
  :maska="$maska.numbers"
75
79
  :clearable="isRecalculationDisabled === false"
76
- :label="$dataStore.t('percent') + `Adb Multiply`"
80
+ :label="adbMultiplyLabel"
77
81
  :readonly="isRecalculationDisabled"
78
82
  :rules="$dataStore.rules.recalculationMultiply"
79
83
  />
@@ -82,7 +86,7 @@
82
86
  v-model="productConditionsForm.adbAdditive"
83
87
  :maska="$maska.numbers"
84
88
  :clearable="isRecalculationDisabled === false"
85
- :label="$dataStore.t('percent') + `Adb Additive`"
89
+ :label="adbAdditiveLabel"
86
90
  :readonly="isRecalculationDisabled"
87
91
  :rules="$dataStore.rules.recalculationAdditive"
88
92
  />
@@ -90,11 +94,12 @@
90
94
  v-model="productConditionsForm.disabilityMultiply"
91
95
  :maska="$maska.numbers"
92
96
  :clearable="isRecalculationDisabled === false"
93
- :label="$dataStore.t('percent') + `Disability Multiply`"
97
+ :label="disabilityMultiplyLabel"
94
98
  :readonly="readonlyDisabilityMultiply"
95
99
  :rules="whichProduct === 'gons' ? [] : $dataStore.rules.recalculationMultiply"
96
100
  />
97
101
  <base-form-input
102
+ v-if="hasDisabilityAdditive"
98
103
  v-model="productConditionsForm.disabilityAdditive"
99
104
  :maska="$maska.numbers"
100
105
  :clearable="isRecalculationDisabled === false"
@@ -145,12 +150,23 @@
145
150
  @append="openPanel($dataStore.t('form.gender'), $dataStore.gender, 'gender')"
146
151
  />
147
152
  </div>
153
+ <base-panel-input
154
+ v-if="hasCurrency"
155
+ v-model="productConditionsForm.currency"
156
+ :value="productConditionsForm.currency.nameRu"
157
+ :readonly="isDisabled"
158
+ :clearable="!isDisabled"
159
+ :label="$dataStore.t('agent.currency')"
160
+ :rules="$rules.objectRequired"
161
+ append-inner-icon="mdi mdi-chevron-right"
162
+ @append="openPanel($dataStore.t('agent.currency'), currencyListFiltered, 'currency')"
163
+ />
148
164
  <base-form-input
149
165
  v-if="hasInsStartDate"
150
166
  v-model="productConditionsForm.calcDate"
151
167
  :maska="$maska.date"
152
- :readonly="isDisabled"
153
- :clearable="!isDisabled"
168
+ :readonly="isDisabledInsStartDate"
169
+ :clearable="!isDisabledInsStartDate"
154
170
  :label="$dataStore.t('labels.insuranceStartDate')"
155
171
  :rules="$rules.required"
156
172
  append-inner-icon="mdi mdi-calendar-blank-outline"
@@ -178,8 +194,8 @@
178
194
  v-if="hasPaymentPeriod"
179
195
  v-model="productConditionsForm.paymentPeriod"
180
196
  :value="productConditionsForm.paymentPeriod?.nameRu"
181
- :readonly="isDisabled"
182
- :clearable="!isDisabled"
197
+ :readonly="isDisabledPaymentPeriod"
198
+ :clearable="!isDisabledPaymentPeriod"
183
199
  :rules="$rules.objectRequired"
184
200
  :label="$dataStore.t('productConditionsForm.processPaymentPeriod')"
185
201
  append-inner-icon="mdi mdi-chevron-right"
@@ -207,6 +223,7 @@
207
223
  @input="onInputFixInsSum"
208
224
  />
209
225
  <base-form-input
226
+ v-if="hasRequestedSumInsured"
210
227
  v-model="productConditionsForm.requestedSumInsured"
211
228
  :readonly="isDisabledSum"
212
229
  :clearable="!isDisabledSum"
@@ -228,6 +245,7 @@
228
245
  @onClear="onClearSumDollar"
229
246
  />
230
247
  <base-form-input
248
+ v-if="hasInsurancePremiumPerMonth"
231
249
  v-model="productConditionsForm.insurancePremiumPerMonth"
232
250
  :readonly="insurancePremiumPerMonthDisabled"
233
251
  :clearable="!insurancePremiumPerMonthDisabled"
@@ -237,6 +255,22 @@
237
255
  @input="onInputInsurancePremiumPerMonth"
238
256
  @onClear="onClearPremium"
239
257
  />
258
+ <base-form-input
259
+ v-if="hasPaidOrRefund"
260
+ v-model="productConditionsForm.amountRefunded"
261
+ :readonly="isDisabledSum"
262
+ :clearable="!isDisabledSum"
263
+ :label="$dataStore.t('productConditionsForm.amountRefunded')"
264
+ :suffix="$constants.currencySymbols.kzt"
265
+ />
266
+ <base-form-input
267
+ v-if="hasPaidOrRefund"
268
+ v-model="productConditionsForm.amountPaid"
269
+ :readonly="insurancePremiumPerMonthDisabled"
270
+ :clearable="!insurancePremiumPerMonthDisabled"
271
+ :label="$dataStore.t('productConditionsForm.amountPaid')"
272
+ :suffix="$constants.currencySymbols.kzt"
273
+ />
240
274
  <base-form-input
241
275
  v-if="hasInsurancePremiumPerMonthInDollar"
242
276
  v-model="productConditionsForm.insurancePremiumPerMonthInDollar"
@@ -249,10 +283,10 @@
249
283
  @onClear="onClearPremiumDollar"
250
284
  />
251
285
  <base-form-input
252
- v-if="hasCurrency && $dataStore.currencies.usd"
286
+ v-if="hasCurrencySymbols && $dataStore.currencies.usd"
253
287
  v-model="$dataStore.currencies.usd"
254
288
  :readonly="true"
255
- :label="$dataStore.t('productConditionsForm.dollarExchangeRateNBRK')"
289
+ :label="currencySymbolsLabel"
256
290
  :suffix="$constants.currencySymbols.kzt"
257
291
  />
258
292
  <base-form-input
@@ -289,102 +323,192 @@
289
323
  :label="$dataStore.t('productConditionsForm.agencyPart')"
290
324
  :readonly="isDisabledAgentCommission"
291
325
  :clearable="!isDisabledAgentCommission"
292
- :rules="$rules.required.concat($rules.numbers, $rules.agentCommission)"
326
+ :rules="formStore.lfb.add ? $rules.required : $rules.required.concat($rules.numbers, $rules.agentCommission)"
293
327
  />
294
328
  </base-form-section>
295
329
  <section v-if="whichProduct === 'pensionannuitynew'">
296
- <base-btn v-if="formStore.applicationData.processCode === 19 && !isDisabled" :text="$dataStore.t('buttons.copyToClient')" class="mt-4" @click="copyRedirect" />
297
- <base-form-section :title="$dataStore.t('pension.compulsoryAmount&Prof')">
330
+ <base-animation>
331
+ <div
332
+ v-if="(formStore.applicationData.processCode === 19 || formStore.applicationData.processCode === 25) && !isDisabled"
333
+ :class="[$styles.blueBgLight]"
334
+ class="h-[52px] rounded-lg flex items-center justify-end px-2 gap-2 mt-4"
335
+ >
336
+ <base-btn class="max-w-[300px]" :text="$dataStore.t('buttons.copyToClient')" size="sm" @click="copyRedirect" />
337
+ </div>
338
+ </base-animation>
339
+ <base-form-section v-if="formStore.applicationData.statusCode === 'ActuaryForm' && isTask">
340
+ <base-content-block :class="[$styles.textSimple]">
341
+ <h5 class="text-center font-medium mb-4">{{ $dataStore.t('labels.contract') }}</h5>
342
+ <div :class="[$styles.whiteBg, $styles.rounded]" class="p-2 h-12 flex items-center relative">
343
+ <span class="ml-2">Договор {{ formStore.applicationData.processCode === 19 || formStore.applicationData.processCode === 25 ? 'страхования' : 'возврата' }}</span>
344
+ <i
345
+ class="transition-all cursor-pointer mdi mdi-tray-arrow-down pl-2 mr-3 border-l-[1px] text-xl absolute right-0"
346
+ :class="[$styles.greenTextHover]"
347
+ @click="
348
+ $dataStore.generatePDFDocument(
349
+ formStore.applicationData.processCode === 19 ? 'PA_Contract' : formStore.applicationData.processCode === 25 ? 'PAJ_Contract' : 'PA_RefundAgreement',
350
+ '38',
351
+ )
352
+ "
353
+ ></i>
354
+ </div>
355
+ </base-content-block>
356
+ </base-form-section>
357
+ <div v-if="formStore.applicationData.processCode === 25" class="flex items-center mt-[14px] h-[48px]">
358
+ <div :class="[$styles.blueBgLight]" class="flex flex-wrap items-center gap-2 p-1 rounded-t-[8px] h-full">
359
+ <div
360
+ class="h-full px-4 py-1 rounded-[8px] cursor-pointer flex items-center"
361
+ :class="[$styles.textSimple, !isSlavePensionForm ? `${$styles.blueBg} ${$styles.whiteText}` : '']"
362
+ @click="$router.replace({ query: { ...$route.query, which: undefined, upd: 'true' } })"
363
+ >
364
+ {{ !!formStore.applicationData.clientApp?.longName ? formStore.applicationData.clientApp?.longName : 'Страхователь' }}
365
+ </div>
366
+ <div
367
+ class="h-full px-4 py-1 rounded-[8px] cursor-pointer flex items-center"
368
+ :class="[$styles.textSimple, isSlavePensionForm ? `${$styles.blueBg} ${$styles.whiteText}` : '']"
369
+ @click="$router.replace({ query: { ...$route.query, which: 'slave', upd: 'true' } })"
370
+ >
371
+ {{ !!formStore.applicationData.slave.clientApp?.longName ? formStore.applicationData.slave.clientApp?.longName : 'Страхователь 2' }}
372
+ </div>
373
+ </div>
374
+ </div>
375
+ <base-form-section v-if="hasContragentData && contragentData">
376
+ <base-panel-input v-model="contragentData.gender" :readonly="true" :clearable="false" :label="$dataStore.t('form.gender')" />
377
+ <base-form-input v-model="contragentData.birthDate" :readonly="true" :clearable="false" :label="$dataStore.t('form.birthDate')" />
378
+ <base-panel-input
379
+ v-if="disabilityGroup"
380
+ v-model="disabilityGroup"
381
+ :value="disabilityGroup?.nameRu"
382
+ :readonly="true"
383
+ :clearable="false"
384
+ :label="$dataStore.t('pension.disabilityGroup')"
385
+ />
386
+ </base-form-section>
387
+ <base-form-section
388
+ v-if="formStore.applicationData.processCode !== 24"
389
+ :title="$dataStore.t('pension.compulsoryAmount&Prof')"
390
+ :class="[formStore.applicationData.processCode === 25 ? 'mt-0 rounded-tl-none' : '']"
391
+ >
298
392
  <base-form-input
299
- v-model="pensionCalculationParams.compulsoryContractAmount"
300
- :maska="$maska.numbers"
393
+ v-model="pensionForm.compulsoryContractAmount"
301
394
  :readonly="isDisabled || isEnpfSum"
302
395
  :clearable="!isDisabled && !isEnpfSum"
303
396
  :label="$dataStore.t('pension.compulsoryContractAmount')"
397
+ :rules="$dataStore.rules.sums"
398
+ :suffix="$constants.currencySymbols.kzt"
399
+ @input="onInputPension($event, 'compulsoryContractAmount')"
400
+ @onClear="onClearPension('compulsoryContractAmount')"
304
401
  />
305
402
  <base-form-input
306
- v-model="pensionCalculationParams.compulsoryProfContractAmount"
307
- :maska="$maska.numbers"
403
+ v-model="pensionForm.compulsoryProfContractAmount"
308
404
  :readonly="isDisabled || isEnpfSum"
309
405
  :clearable="!isDisabled && !isEnpfSum"
310
406
  :label="$dataStore.t('pension.compulsoryProfContractAmount')"
407
+ :rules="$dataStore.rules.sums"
408
+ :suffix="$constants.currencySymbols.kzt"
409
+ @input="onInputPension($event, 'compulsoryProfContractAmount')"
410
+ @onClear="onClearPension('compulsoryProfContractAmount')"
311
411
  />
312
412
  <base-animation>
313
413
  <base-form-input
314
- v-if="pensionCalculationParams.compulsoryProfContractAmount && pensionCalculationParams.compulsoryProfContractAmount != 0"
414
+ v-if="pensionForm.compulsoryProfContractAmount && pensionForm.compulsoryProfContractAmount != 0"
315
415
  v-model="pensionForm.compulsoryProfMonthCount"
316
416
  :maska="$maska.numbers"
317
- :readonly="isDisabled || isEnpfSum"
318
- :clearable="!isDisabled && !isEnpfSum"
417
+ :readonly="isDisabled"
418
+ :clearable="!isDisabled"
319
419
  :label="$dataStore.t('pension.compulsoryProfMonthCount')"
320
420
  />
321
421
  </base-animation>
322
422
  <base-form-input
323
- v-model="pensionCalculationParams.voluntaryContractAmount"
324
- :maska="$maska.numbers"
325
- :readonly="isDisabled"
326
- :clearable="!isDisabled"
423
+ v-model="pensionForm.voluntaryContractAmount"
424
+ :readonly="isDisabled || isEnpfSum"
425
+ :clearable="!isDisabled && !isEnpfSum"
327
426
  :label="$dataStore.t('pension.voluntaryContractAmount')"
427
+ :rules="$dataStore.rules.sums"
428
+ :suffix="$constants.currencySymbols.kzt"
429
+ @input="onInputPension($event, 'voluntaryContractAmount')"
430
+ @onClear="onClearPension('voluntaryContractAmount')"
328
431
  />
329
432
  <base-form-input
330
- v-model="pensionCalculationParams.ownFundsRaisAmount"
331
- :maska="$maska.numbers"
433
+ v-model="pensionForm.ownFundsRaisAmount"
332
434
  :readonly="isDisabled"
333
435
  :clearable="!isDisabled"
334
436
  :label="$dataStore.t('pension.ownFundsRaisAmount')"
437
+ :rules="$dataStore.rules.sums"
438
+ :suffix="$constants.currencySymbols.kzt"
439
+ @input="onInputPension($event, 'ownFundsRaisAmount')"
440
+ @onClear="onClearPension('ownFundsRaisAmount')"
335
441
  />
336
442
  </base-form-section>
337
- <base-form-section :title="$dataStore.t('pension.companyName')">
338
- <base-panel-input
339
- v-model="pensionForm.transferContractCompany"
340
- :value="pensionForm.transferContractCompany?.nameRu"
341
- :label="$dataStore.t('pension.transferContractCompany')"
342
- :readonly="isDisabled"
343
- :clearable="!isDisabled"
344
- append-inner-icon="mdi mdi-chevron-right"
345
- @append="openPanel($dataStore.t('pension.transferContractCompany'), $dataStore.transferContractCompanies, 'transferContractCompany', $dataStore.getInsuranceCompanies)"
346
- />
347
- <base-form-input
348
- v-model="transferContractDate"
349
- :maska="$maska.date"
350
- :label="$dataStore.t('pension.contractDate')"
351
- :readonly="isDisabled"
352
- :clearable="!isDisabled"
353
- append-inner-icon="mdi mdi-calendar-blank-outline"
354
- :rules="pensionForm.transferContractCompany?.ids ? $rules.required.concat($rules.date) : []"
355
- />
356
- <base-form-input
357
- v-model="pensionForm.transferContractNumber"
358
- :label="$dataStore.t('pension.globalId')"
359
- :readonly="isDisabled"
360
- :clearable="!isDisabled"
361
- :rules="pensionForm.transferContractCompany?.ids ? $rules.required : []"
362
- />
363
- <base-form-input
364
- v-model="transferContractFirstPaymentDate"
365
- :maska="$maska.date"
366
- :label="$dataStore.t('pension.transferContractFirstPaymentDate')"
367
- append-inner-icon="mdi mdi-calendar-blank-outline"
368
- :readonly="isDisabled"
369
- :clearable="!isDisabled"
370
- :rules="pensionForm.transferContractCompany?.ids ? $rules.required.concat($rules.date) : []"
371
- />
372
- <base-form-input
373
- v-model="pensionCalculationParams.transferContractAmount"
374
- :maska="$maska.numbers"
375
- :label="$dataStore.t('pension.transferContractAmount')"
376
- :rules="pensionForm.transferContractCompany?.ids ? $rules.required : []"
377
- />
378
- <base-form-toggle v-model="pensionForm.transferContractIsOppv" :disabled="isDisabled" :has-border="false" :title="$dataStore.t('pension.isOPPVTransfer')" />
443
+ <base-form-section v-if="formStore.applicationData.processCode !== 24" :title="$dataStore.t('pension.companyName')">
444
+ <base-btn v-if="!isDisabled" :text="$dataStore.t('buttons.add')" :disabled="isDisabled" size="sm" :btn="$styles.blueBtn" @click="addTransferContract" />
445
+ <section v-for="(contract, index) in transferContracts" class="py-2">
446
+ <base-panel-input
447
+ v-model="contract.transferContractCompany"
448
+ :value="contract.transferContractCompany?.nameRu"
449
+ :label="$dataStore.t('pension.transferContractCompany')"
450
+ :readonly="isDisabled"
451
+ :clearable="!isDisabled"
452
+ append-inner-icon="mdi mdi-chevron-right"
453
+ @append="
454
+ openPanel($dataStore.t('pension.transferContractCompany'), $dataStore.transferContractCompanies, 'transferContractCompany', $dataStore.getInsuranceCompanies)
455
+ "
456
+ @click="contractIndex = index"
457
+ />
458
+ <div class="flex flex-col">
459
+ <base-form-input
460
+ v-model="contract.transferContractDate"
461
+ :maska="$maska.date"
462
+ :label="$dataStore.t('pension.contractDate')"
463
+ :readonly="isDisabled"
464
+ :clearable="!isDisabled"
465
+ :max-date="formatDate(transferMaxDate) ?? undefined"
466
+ :rules="$dataStore.rules.required.concat($dataStore.rules.birthDate)"
467
+ append-inner-icon="mdi mdi-calendar-blank-outline"
468
+ />
469
+ <span v-if="transferMaxDate && !isDisabled" class="px-3 font-light text-sm bg-white py-0 mt-[-5px]" style="color: #a0b3d8 !important"
470
+ >до {{ transferMaxDate }} включительно</span
471
+ >
472
+ </div>
473
+ <base-form-input v-model="contract.transferContractNumber" :label="$dataStore.t('pension.globalId')" :readonly="isDisabled" :clearable="!isDisabled" />
474
+ <base-form-input
475
+ v-model="contract.transferContractRegNumber"
476
+ :label="$dataStore.t('pension.transferRegNumber')"
477
+ :rules="$rules.required"
478
+ :readonly="isDisabled"
479
+ :clearable="!isDisabled"
480
+ />
481
+ <base-form-input
482
+ v-model="contract.transferContractFirstPaymentDate"
483
+ :maska="$maska.date"
484
+ :label="$dataStore.t('pension.transferContractFirstPaymentDate')"
485
+ :rules="$dataStore.rules.required.concat($dataStore.rules.birthDate)"
486
+ append-inner-icon="mdi mdi-calendar-blank-outline"
487
+ :readonly="isDisabled"
488
+ :clearable="!isDisabled"
489
+ />
490
+ <base-form-input
491
+ v-model="contract.transferContractAmount"
492
+ :label="$dataStore.t('pension.transferContractAmount')"
493
+ :suffix="$constants.currencySymbols.kzt"
494
+ :readonly="isDisabled"
495
+ :clearable="!isDisabled"
496
+ @input="onInputPension($event, 'transferContractAmount', index)"
497
+ @onClear="onClearPension('transferContractAmount', index)"
498
+ />
499
+ <base-form-toggle v-model="contract.transferContractIsOppv" :disabled="isDisabled" :has-border="false" :title="$dataStore.t('pension.isOPPVTransfer')" />
500
+ <base-btn v-if="!isDisabled" :text="$dataStore.t('buttons.delete')" :disabled="isDisabled" size="sm" :btn="$styles.whiteBtn" @click="removeTransferContract(index)" />
501
+ </section>
379
502
  </base-form-section>
380
503
  <base-form-section :title="$dataStore.t('pension.paymentTerms')">
381
504
  <base-form-input
382
505
  v-model="contractDate"
383
506
  :maska="$maska.date"
384
507
  :rules="!isDisabled ? $rules.required.concat($rules.date) : []"
385
- :readonly="isDisabled"
508
+ :readonly="isDisabled || formStore.applicationData.processCode === 24 || isSlavePensionForm"
386
509
  :clearable="!isDisabled"
387
510
  :min-date="new Date()"
511
+ :max-date="formatDate(maxDate ?? '') ?? undefined"
388
512
  :label="$dataStore.t('pension.contractDate')"
389
513
  append-inner-icon="mdi mdi-calendar-blank-outline"
390
514
  />
@@ -403,8 +527,24 @@
403
527
  <base-form-input v-model="pensionForm.frequencyPayments" disabled :label="$dataStore.t('pension.frequencyPayments')" />
404
528
  <base-form-input v-model="pensionForm.periodPayments" disabled :label="$dataStore.t('pension.paymentPeriod')" />
405
529
  <base-form-input v-model="pensionForm.insuranceProgramType" disabled :label="$dataStore.t('pension.insuranceProgramType')" />
406
- <base-form-input v-model="pensionAmount" readonly :maska="$maska.numbers" :label="$dataStore.t('pension.pensionAmount')" />
407
- <base-form-input v-model="pensionForm.payment" readonly :maska="$maska.numbers" :label="$dataStore.t('pension.pensionPayment')" />
530
+ <base-form-input
531
+ v-if="formStore.applicationData.processCode === 25 && formStore.pensionApp?.slave?.amount"
532
+ :value="totalInsPremium"
533
+ :active="true"
534
+ :label="$dataStore.t('productConditionsForm.totalInsurancePremiumAmount')"
535
+ :disabled="$dataStore.isLoading"
536
+ readonly
537
+ />
538
+ <base-form-input
539
+ v-model="pensionForm.amount"
540
+ :value="$dataStore.getNumberWithSpaces(pensionForm.amount)"
541
+ @input="onInputPension($event, 'pensionAmount')"
542
+ @onClear="onClearPension('pensionAmount')"
543
+ @change="customPension = true"
544
+ :readonly="isDisabled || formStore.applicationData.processCode !== 25"
545
+ :label="$dataStore.t('pension.pensionAmount')"
546
+ />
547
+ <base-form-input :value="$dataStore.getNumberWithSpaces(pensionForm.payment)" :active="true" readonly :label="$dataStore.t('pension.pensionPayment')" />
408
548
  </base-form-section>
409
549
  </section>
410
550
  <base-form-section v-if="hasAnnuityPayments" :title="$dataStore.t('calculationAnnuityPayments')">
@@ -619,17 +759,46 @@
619
759
  </div>
620
760
  </base-form-section>
621
761
  </v-form>
622
- <base-btn v-if="!$dataStore.isCalculator && isCalculator && hasCalculated" :btn="$styles.greenLightBtn" :text="$dataStore.t('buttons.toStatement')" @click="toStatement" />
623
- <base-btn v-if="!isDisabled && $dataStore.isPension && isTask" :text="$dataStore.t('buttons.save')" :loading="$dataStore.isLoading" type="submit" @click="submitForm" />
624
- <base-btn
625
- v-if="$dataStore.isCalculator ? true : !isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter()) && !$dataStore.isPension"
626
- :loading="isCalculating"
627
- :text="$dataStore.t('buttons.calculate')"
628
- @click="submitForm"
629
- />
762
+ <base-animation>
763
+ <base-btn
764
+ v-if="!$dataStore.isCalculator && isCalculator && hasCalculated"
765
+ :btn="$styles.greenLightBtn"
766
+ :text="$dataStore.t('buttons.toStatement')"
767
+ class="min-h-[60px]"
768
+ @click="toStatement"
769
+ />
770
+ </base-animation>
771
+ <base-animation>
772
+ <base-btn
773
+ v-if="!isDisabled && $dataStore.isPension && isTask"
774
+ :text="$dataStore.t('buttons.calculate')"
775
+ :loading="$dataStore.isLoading"
776
+ class="min-h-[60px]"
777
+ type="submit"
778
+ @click="submitForm"
779
+ />
780
+ </base-animation>
781
+ <base-animation>
782
+ <base-btn
783
+ v-if="$dataStore.isCalculator ? true : !isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter()) && !$dataStore.isPension"
784
+ :loading="isCalculating"
785
+ class="min-h-[60px]"
786
+ :text="$dataStore.t('buttons.calculate')"
787
+ @click="submitForm"
788
+ />
789
+ </base-animation>
630
790
  <div v-if="$dataStore.isTask() && $dataStore.isUnderwriter() && !isRecalculationDisabled" class="flex gap-3">
631
- <base-btn :text="$dataStore.t('buttons.calcSum')" v-if="hasCalcSum" type="submit" @click.prevent="underwriterCalculate('sum')" :loading="isCalculating" />
632
- <base-btn :text="$dataStore.t('buttons.calcPremium')" type="submit" @click.prevent="underwriterCalculate('premium')" :loading="isCalculating" />
791
+ <base-animation>
792
+ <base-btn
793
+ v-if="hasCalcSum"
794
+ class="min-h-[60px]"
795
+ :text="$dataStore.t('buttons.calcSum')"
796
+ type="submit"
797
+ @click.prevent="underwriterCalculate('sum')"
798
+ :loading="isCalculating"
799
+ />
800
+ </base-animation>
801
+ <base-btn class="min-h-[60px]" :text="$dataStore.t('buttons.calcPremium')" type="submit" @click.prevent="underwriterCalculate('premium')" :loading="isCalculating" />
633
802
  </div>
634
803
  <Teleport v-if="isPanelOpen" to="#right-panel-actions">
635
804
  <div :class="[$styles.scrollPage]" class="flex flex-col items-center">
@@ -692,10 +861,21 @@
692
861
  </div>
693
862
  </Teleport>
694
863
  </section>
864
+ <div v-if="isLoading" class="w-full h-[80dvh] flex items-center justify-center"><base-loader :size="50" /></div>
695
865
  </template>
696
866
 
697
867
  <script lang="ts">
698
- import { Member, Value, CountryValue, CalculatorForm } from '../../composables/classes';
868
+ import { Member, Value, CountryValue, CalculatorForm, TransferContract } from '../../composables/classes';
869
+ import type { Projects, AddCover, AddCoverAnswer } from '../../types';
870
+
871
+ type PensionCalculation = {
872
+ compulsoryContractAmount: number | string | null;
873
+ voluntaryContractAmount: number | string | null;
874
+ ownFundsRaisAmount: number | string | null;
875
+ compulsoryProfContractAmount: number | string | null;
876
+ transferContractAmount: number | string | null;
877
+ transferContractCompany: number | string | null;
878
+ };
699
879
 
700
880
  export default defineComponent({
701
881
  props: {
@@ -721,6 +901,7 @@ export default defineComponent({
721
901
  const isPanelLoading = ref<boolean>(false);
722
902
  const isPanelOpen = ref<boolean>(false);
723
903
  const isTermsPanelOpen = ref<boolean>(false);
904
+ const isLoading = ref<boolean>(false);
724
905
  const panelValue = ref<Value>(new Value());
725
906
  const termValue = ref<AddCover>();
726
907
  const subTermValue = ref<string>('');
@@ -733,23 +914,48 @@ export default defineComponent({
733
914
  const whichSum = ref<'insurancePremiumPerMonth' | 'requestedSumInsured' | ''>('');
734
915
  const panelCodeList = ['processcovertypesum', 'fixedinssum'];
735
916
  const enabled = 'включено';
917
+ const amountRefunded = ref<string | number | null>(null);
918
+ const amountPaid = ref<string | number | null>(null);
736
919
 
737
920
  const additionalTerms = ref<AddCover[]>([]);
738
921
 
739
- const maxDate = ref();
922
+ const maxDate = ref<string | null>();
923
+ const transferMaxDate = ref();
740
924
  const dateOfBegin = ref();
741
- const contractDate = ref();
742
- const transferContractDate = ref();
743
- const transferContractFirstPaymentDate = ref();
744
- const guaranteedPeriodList = Array.from(Array(35), (e, i) => i + 1);
745
- const pensionForm = formStore.applicationData?.pensionApp ?? undefined;
746
- const isEnpfSum = (formStore.applicationData?.isEnpfSum ?? false) && useEnv().isProduction;
925
+ const contractDate = ref<string | null>();
926
+ const transferContractDate = ref<string | null>();
927
+ const transferContractFirstPaymentDate = ref<string | null>();
928
+ const guaranteedPeriodList = Array.from(Array(35), (_, i) => i + 1);
929
+ const isSlavePensionForm = computed(() => route.query.which === 'slave');
930
+ const pensionForm = computedWithControl(
931
+ () => formStore.pensionApp,
932
+ () => (route.query.which === 'slave' ? formStore.pensionApp?.slave : formStore.pensionApp ?? undefined),
933
+ );
934
+
935
+ const insuredForm = isSlavePensionForm.value
936
+ ? formStore.applicationData?.slave?.insuredApp && formStore.applicationData?.slave?.insuredApp[0]
937
+ : (formStore.applicationData?.insuredApp && Array.isArray(formStore.applicationData?.insuredApp) && formStore.applicationData?.insuredApp[0]) ?? undefined;
938
+ const disabilityGroup = computed(() => {
939
+ if (!!insuredForm.disabilityGroupId) {
940
+ const disabilityGroup = dataStore.disabilityGroups.find(i => i.id === insuredForm.disabilityGroupId);
941
+ return disabilityGroup;
942
+ }
943
+ });
944
+ const isEnpfSum = pensionForm.value?.isEnpfSum ?? false;
747
945
 
946
+ const transferContracts = ref<TransferContract[]>([]);
947
+ const contractsValue = ref<Value[]>([]);
948
+ const contractIndex = ref<number>(0);
748
949
  const isMultiplePanelOpen = ref<boolean>(false);
749
950
  const multiplePanelValue = ref<CountryValue>(new CountryValue());
750
951
  const multiplePanelList = ref<CountryValue[]>([]);
751
952
  const calculatorForm = productConditionsForm.calculatorForm;
752
953
  const minInsSum = computed(() => formStore.lfb.clients && formStore.lfb.clients.reduce((min, item) => Math.min(min, item.insSum), Infinity));
954
+ const contragentData = ref<any>();
955
+ const customPension = ref<boolean>(false);
956
+ const transferSum = ref<number>(0);
957
+ const firstAmount = ref<boolean>(true);
958
+
753
959
  const isShownAdditionalTerms = computed(() => {
754
960
  if (whichProduct.value === 'gons') {
755
961
  return false;
@@ -768,6 +974,9 @@ export default defineComponent({
768
974
  if (whichProduct.value === 'gons') {
769
975
  return true;
770
976
  }
977
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
978
+ return true;
979
+ }
771
980
  if ((whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') && dataStore.isUnderwriter()) {
772
981
  return false;
773
982
  }
@@ -777,7 +986,13 @@ export default defineComponent({
777
986
  const isTask = computed(() => (route.params.taskId === '0' && props.isCalculator === true) || dataStore.isTask() || fromIndexPage.value);
778
987
  const isRecalculationDisabled = computed(() => formStore.isDisabled.recalculationForm || formStore.canBeClaimed === true);
779
988
  const isUnderwriterRole = computed(() => dataStore.isUnderwriter() || dataStore.isAdmin() || dataStore.isSupport());
780
- const insurancePremiumPerMonthRule = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
989
+ const insurancePremiumPerMonthRule = computed(() =>
990
+ !!productConditionsForm.insurancePremiumPerMonth
991
+ ? whichProduct.value === 'gons' || whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns'
992
+ ? dataStore.rules.required
993
+ : dataStore.rules.required.concat(dataStore.rules.sums)
994
+ : [],
995
+ );
781
996
  const insurancePremiumPerMonthDisabled = computed(() => {
782
997
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
783
998
  return true;
@@ -787,7 +1002,9 @@ export default defineComponent({
787
1002
  }
788
1003
  return isDisabled.value;
789
1004
  });
790
- const requestedSumInsuredRule = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
1005
+ const requestedSumInsuredRule = computed(() =>
1006
+ !!productConditionsForm.requestedSumInsured ? (whichProduct.value === 'gons' ? dataStore.rules.required : dataStore.rules.required.concat(dataStore.rules.sums)) : [],
1007
+ );
791
1008
  const fixInsSumRule = computed(() =>
792
1009
  !!productConditionsForm.fixInsSum
793
1010
  ? dataStore.rules.required.concat(dataStore.rules.sums, dataStore.rules.fixInsSumLimit(getNumber(productConditionsForm.fixInsSum as string), minInsSum.value))
@@ -801,22 +1018,16 @@ export default defineComponent({
801
1018
  return !!productConditionsForm.requestedSumInsured && !!productConditionsForm.insurancePremiumPerMonth;
802
1019
  });
803
1020
  const hasProcessIndexRate = computed(() => {
804
- if (
805
- whichProduct.value === 'gons' ||
806
- whichProduct.value === 'halykkazyna' ||
807
- whichProduct.value === 'liferenta' ||
808
- whichProduct.value === 'lifebusiness' ||
809
- whichProduct.value === 'amuletlife' ||
810
- whichProduct.value === 'gns'
811
- ) {
812
- return false;
813
- }
814
- return true;
1021
+ if (whichProduct.value === 'baiterek' || whichProduct.value === 'bolashak') return true;
1022
+ return false;
815
1023
  });
816
1024
  const hasPaymentPeriod = computed(() => {
817
1025
  if (whichProduct.value === 'halykkazyna') {
818
1026
  return false;
819
1027
  }
1028
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1029
+ return false;
1030
+ }
820
1031
  return true;
821
1032
  });
822
1033
  const hasCoverPeriod = computed(() => {
@@ -825,22 +1036,44 @@ export default defineComponent({
825
1036
  }
826
1037
  return true;
827
1038
  });
1039
+
1040
+ const hasRequestedSumInsured = computed(() => {
1041
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1042
+ return false;
1043
+ }
1044
+ return true;
1045
+ });
828
1046
  const hasRequestedSumInsuredInDollar = computed(() => {
829
1047
  if (whichProduct.value === 'halykkazyna') {
830
1048
  return true;
831
1049
  }
1050
+ if (whichProduct.value === 'gons' && productConditionsForm.currency.code === 'USD') {
1051
+ return true;
1052
+ }
832
1053
  return false;
833
1054
  });
1055
+ const hasInsurancePremiumPerMonth = computed(() => {
1056
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1057
+ return false;
1058
+ }
1059
+ return true;
1060
+ });
834
1061
  const hasInsurancePremiumPerMonthInDollar = computed(() => {
835
1062
  if (whichProduct.value === 'halykkazyna') {
836
1063
  return true;
837
1064
  }
1065
+ if (whichProduct.value === 'gons' && productConditionsForm.currency.code === 'USD') {
1066
+ return true;
1067
+ }
838
1068
  return false;
839
1069
  });
840
- const hasCurrency = computed(() => {
1070
+ const hasCurrencySymbols = computed(() => {
841
1071
  if (whichProduct.value === 'halykkazyna') {
842
1072
  return true;
843
1073
  }
1074
+ if (whichProduct.value === 'gons' && productConditionsForm.currency.code === 'USD') {
1075
+ return true;
1076
+ }
844
1077
  return false;
845
1078
  });
846
1079
  const hasAdbMultiply = computed(() => {
@@ -877,6 +1110,15 @@ export default defineComponent({
877
1110
  if (whichProduct.value === 'gons') {
878
1111
  return false;
879
1112
  }
1113
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1114
+ return false;
1115
+ }
1116
+ return true;
1117
+ });
1118
+ const hasDisabilityAdditive = computed(() => {
1119
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1120
+ return false;
1121
+ }
880
1122
  return true;
881
1123
  });
882
1124
  const hasAnnuityPayments = computed(() => {
@@ -943,6 +1185,42 @@ export default defineComponent({
943
1185
  }
944
1186
  return dataStore.t('productConditionsForm.insurancePremiumAmount');
945
1187
  });
1188
+ const currencySymbolsLabel = computed(() => {
1189
+ if (whichProduct.value === 'gons') {
1190
+ return dataStore.t('productConditionsForm.exchangeRateSettlementDate');
1191
+ }
1192
+ return dataStore.t('productConditionsForm.dollarExchangeRateNBRK');
1193
+ });
1194
+ const lifeMultiplyLabel = computed(() => {
1195
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1196
+ return dataStore.t('percent') + `Life (смерть по любой причине) multiply`;
1197
+ }
1198
+ return dataStore.t('percent') + `Life Multiply`;
1199
+ });
1200
+ const lifeAdditiveLabel = computed(() => {
1201
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1202
+ return dataStore.t('percent') + `Life (смерть по любой причине) надбавка`;
1203
+ }
1204
+ return dataStore.t('percent') + `Life Additive`;
1205
+ });
1206
+ const disabilityMultiplyLabel = computed(() => {
1207
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1208
+ return dataStore.t('percent') + `Disability (инвалидность, временная утрата тр-ти, стойкая утрата тр-ти)`;
1209
+ }
1210
+ return dataStore.t('percent') + `Disability Multiply`;
1211
+ });
1212
+ const adbMultiplyLabel = computed(() => {
1213
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1214
+ return dataStore.t('percent') + `Accidental life multiply`;
1215
+ }
1216
+ return dataStore.t('percent') + `Adb Multiply`;
1217
+ });
1218
+ const adbAdditiveLabel = computed(() => {
1219
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1220
+ return dataStore.t('percent') + `Accidental life additional надбавка`;
1221
+ }
1222
+ return dataStore.t('percent') + `Adb Additive`;
1223
+ });
946
1224
  const isDisabledFixInsSum = computed(() => {
947
1225
  if (dataStore.isUnderwriter() && !isRecalculationDisabled.value) {
948
1226
  return false;
@@ -990,11 +1268,20 @@ export default defineComponent({
990
1268
  return true;
991
1269
  });
992
1270
  const isDisabledAgentCommission = computed(() => {
1271
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1272
+ return true;
1273
+ }
993
1274
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns' || dataStore.isUnderwriter()) {
994
1275
  return false;
995
1276
  }
996
1277
  return isDisabled.value;
997
1278
  });
1279
+ const isDisabledInsStartDate = computed(() => {
1280
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1281
+ return true;
1282
+ }
1283
+ return isDisabled.value;
1284
+ });
998
1285
  const hasCalcSum = computed(() => {
999
1286
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1000
1287
  return false;
@@ -1002,7 +1289,13 @@ export default defineComponent({
1002
1289
  return true;
1003
1290
  });
1004
1291
  const hasFixInsSum = computed(() => {
1005
- if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1292
+ if (!formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1293
+ return true;
1294
+ }
1295
+ return false;
1296
+ });
1297
+ const hasPaidOrRefund = computed(() => {
1298
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1006
1299
  return true;
1007
1300
  }
1008
1301
  return false;
@@ -1037,26 +1330,51 @@ export default defineComponent({
1037
1330
  }
1038
1331
  return false;
1039
1332
  });
1040
-
1041
- const pensionCalculationParams = ref({
1042
- compulsoryContractAmount: pensionForm && pensionForm.compulsoryContractAmount && pensionForm.compulsoryContractAmount != 0 ? pensionForm.compulsoryContractAmount : null,
1043
- voluntaryContractAmount: pensionForm && pensionForm.voluntaryContractAmount && pensionForm.voluntaryContractAmount != 0 ? pensionForm.voluntaryContractAmount : null,
1044
- ownFundsRaisAmount: pensionForm && pensionForm.ownFundsRaisAmount && pensionForm.ownFundsRaisAmount != 0 ? pensionForm.ownFundsRaisAmount : null,
1045
- compulsoryProfContractAmount:
1046
- pensionForm && pensionForm.compulsoryProfContractAmount && pensionForm.compulsoryProfContractAmount != 0 ? pensionForm.compulsoryProfContractAmount : null,
1047
- transferContractAmount: pensionForm && pensionForm.transferContractAmount && pensionForm.transferContractAmount != 0 ? pensionForm.transferContractAmount : null,
1333
+ const hasCurrency = computed(() => {
1334
+ if (whichProduct.value === 'gons') {
1335
+ return true;
1336
+ }
1337
+ return false;
1338
+ });
1339
+ const hasContragentData = computed(() => {
1340
+ if (whichProduct.value === 'pensionannuitynew') {
1341
+ return true;
1342
+ }
1343
+ return false;
1344
+ });
1345
+ const isDisabledPaymentPeriod = computed(() => {
1346
+ if (whichProduct.value === 'gons' && productConditionsForm.currency.code === 'USD') {
1347
+ return true;
1348
+ }
1349
+ return isDisabled.value;
1350
+ });
1351
+ const currencyListFiltered = computed(() => {
1352
+ return constants.currencyList;
1048
1353
  });
1049
1354
 
1050
- const pensionAmount = computed(() =>
1051
- pensionCalculationParams.value
1052
- ? (Number(pensionCalculationParams.value.compulsoryContractAmount) ?? 0) +
1053
- (Number(pensionCalculationParams.value.voluntaryContractAmount) ?? 0) +
1054
- (Number(pensionCalculationParams.value.ownFundsRaisAmount) ?? 0) +
1055
- (Number(pensionCalculationParams.value.compulsoryProfContractAmount) ?? 0) +
1056
- (Number(pensionCalculationParams.value.transferContractAmount) ?? 0)
1057
- : 0,
1355
+ const totalInsPremium = computed(() =>
1356
+ dataStore.getNumberWithSpaces(formatSpacedNumber(formStore.pensionApp?.amount) + formatSpacedNumber(formStore.pensionApp.slave?.amount)),
1058
1357
  );
1059
1358
 
1359
+ const getContragent = async () => {
1360
+ const data = await dataStore.api.getContragentById(
1361
+ Number(route.query.which !== 'slave' ? formStore.applicationData.clientApp.insisId : formStore.applicationData.slave.clientApp.insisId),
1362
+ );
1363
+ if (data && data.items.length != 0) {
1364
+ contragentData.value = data.items[0];
1365
+ contragentData.value.gender = contragentData.value.gender === 1 ? dataStore.t('pension.male') : dataStore.t('pension.female');
1366
+ contragentData.value.birthDate = reformatDate(contragentData.value.birthDate);
1367
+ }
1368
+ };
1369
+
1370
+ const sumContractsAmount = (transferContracts: TransferContract[]) => {
1371
+ if (!transferContracts || !transferContracts.length) return 0;
1372
+ return transferContracts.reduce((accumulator, currentValue) => {
1373
+ const transferAmount = structuredClone(toRaw(currentValue));
1374
+ return accumulator + Number(String(transferAmount.transferContractAmount).replace(/\s/g, ''));
1375
+ }, 0);
1376
+ };
1377
+
1060
1378
  const formatTermValue = (term: number) => {
1061
1379
  if (term !== null) {
1062
1380
  const termNumber = Number(term);
@@ -1068,7 +1386,7 @@ export default defineComponent({
1068
1386
  const toStatement = async () => {
1069
1387
  const statementItem = dataStore.menuItems.find(i => i.id === 'statement');
1070
1388
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1071
- await router.push({ name: 'taskId-NewApp', params: route.params, query: { tab: 'statement' } });
1389
+ await router.push({ name: 'taskId-NewApp', params: route.params, query: { tab: 'statement', add: 'false' } });
1072
1390
  return;
1073
1391
  }
1074
1392
  if (whichProduct.value === 'gons') {
@@ -1099,8 +1417,12 @@ export default defineComponent({
1099
1417
  // @ts-ignore
1100
1418
  calculatorForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
1101
1419
  } else if (whichProduct.value === 'pensionannuitynew') {
1102
- // @ts-ignore
1103
- pensionForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
1420
+ if (currentPanel.value === 'transferContractCompany') {
1421
+ transferContracts.value[contractIndex.value].transferContractCompany = item;
1422
+ } else {
1423
+ // @ts-ignore
1424
+ pensionForm.value[currentPanel.value] = item.nameRu === null ? new Value() : item;
1425
+ }
1104
1426
  } else {
1105
1427
  // @ts-ignore
1106
1428
  productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
@@ -1330,7 +1652,7 @@ export default defineComponent({
1330
1652
  const calculatedPremiumDollar = getNumber(event.target.value as string);
1331
1653
  if (calculatedPremiumDollar) {
1332
1654
  productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(productConditionsForm.insurancePremiumPerMonth);
1333
- if (whichProduct.value === 'halykkazyna') {
1655
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
1334
1656
  if (typeof dataStore.currencies.usd === 'number') {
1335
1657
  productConditionsForm.insurancePremiumPerMonthInDollar = dataStore.getNumberWithSpaces(calculatedPremiumDollar / dataStore.currencies.usd);
1336
1658
  } else {
@@ -1358,7 +1680,7 @@ export default defineComponent({
1358
1680
  const calculatedSumDollar = getNumber(event.target.value as string);
1359
1681
  if (calculatedSumDollar) {
1360
1682
  productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(productConditionsForm.requestedSumInsured);
1361
- if (whichProduct.value === 'halykkazyna') {
1683
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
1362
1684
  if (typeof dataStore.currencies.usd === 'number') {
1363
1685
  productConditionsForm.requestedSumInsuredInDollar = dataStore.getNumberWithSpaces(calculatedSumDollar / dataStore.currencies.usd);
1364
1686
  } else {
@@ -1369,6 +1691,42 @@ export default defineComponent({
1369
1691
  }
1370
1692
  };
1371
1693
 
1694
+ const onInputPension = (event: Event, key: keyof PensionCalculation | 'pensionAmount', index?: number) => {
1695
+ if (event.target && 'value' in event.target && event.target.value) {
1696
+ const calcCheck = getNumber(event.target.value as string);
1697
+ if (calcCheck) {
1698
+ if (index !== undefined) {
1699
+ transferContracts.value[index].transferContractAmount = dataStore.getNumberWithSpaces(event.target.value) as string;
1700
+ transferSum.value = transferContracts.value.reduce((accumulator, { transferContractAmount }) => (accumulator += formatSpacedNumber(transferContractAmount)), 0);
1701
+ } else if (key === 'pensionAmount') {
1702
+ pensionForm.value.amount = dataStore.getNumberWithSpaces(event.target.value) ?? '0';
1703
+ } else {
1704
+ pensionForm.value[key] = dataStore.getNumberWithSpaces(event.target.value);
1705
+ }
1706
+ }
1707
+ } else {
1708
+ if (index !== undefined) {
1709
+ transferContracts.value[index].transferContractAmount = 0;
1710
+ transferSum.value = transferContracts.value.reduce((accumulator, { transferContractAmount }) => (accumulator += formatSpacedNumber(transferContractAmount)), 0);
1711
+ }
1712
+ }
1713
+ if (key !== 'pensionAmount' && !customPension.value) {
1714
+ if (firstAmount.value) {
1715
+ firstAmount.value = false;
1716
+ return;
1717
+ }
1718
+ pensionForm.value.amount =
1719
+ dataStore.getNumberWithSpaces(
1720
+ formatSpacedNumber(pensionForm.value.compulsoryContractAmount) +
1721
+ formatSpacedNumber(pensionForm.value.compulsoryProfContractAmount) +
1722
+ formatSpacedNumber(pensionForm.value.ownFundsRaisAmount) +
1723
+ formatSpacedNumber(pensionForm.value.transferContractAmount) +
1724
+ formatSpacedNumber(pensionForm.value.voluntaryContractAmount) +
1725
+ sumContractsAmount(transferContracts.value),
1726
+ ) ?? '';
1727
+ }
1728
+ };
1729
+
1372
1730
  const onInputFixInsSum = (event: Event) => {
1373
1731
  if (event.target && 'value' in event.target && event.target.value) {
1374
1732
  const calculatedFixInsSum = getNumber(event.target.value as string);
@@ -1393,6 +1751,16 @@ export default defineComponent({
1393
1751
  productConditionsForm.requestedSumInsuredInDollar = null;
1394
1752
  };
1395
1753
 
1754
+ const onClearPension = (key: keyof PensionCalculation | 'pensionAmount', index?: number) => {
1755
+ if (index) {
1756
+ transferContracts.value[index].transferContractAmount = 0;
1757
+ } else if (key === 'pensionAmount') {
1758
+ pensionForm.value.amount = '0';
1759
+ } else {
1760
+ pensionForm.value[key] = null;
1761
+ }
1762
+ };
1763
+
1396
1764
  const onClearSumDollar = () => {
1397
1765
  productConditionsForm.requestedSumInsured = null;
1398
1766
  };
@@ -1424,7 +1792,7 @@ export default defineComponent({
1424
1792
  };
1425
1793
 
1426
1794
  const filterTermConditions = (term: AddCover) => {
1427
- if (term.coverTypeCode === 10) {
1795
+ if (term.coverTypeCode === 10 && !props.isCalculator) {
1428
1796
  return !!formStore.insuredForm.find((member: Member) => member.iin === formStore.policyholderForm.iin) === false;
1429
1797
  }
1430
1798
  return true;
@@ -1437,6 +1805,39 @@ export default defineComponent({
1437
1805
  return term.coverTypeName;
1438
1806
  };
1439
1807
 
1808
+ const addTransferContract = () => {
1809
+ transferContracts.value.push(new TransferContract());
1810
+ };
1811
+
1812
+ const removeTransferContract = (index: number) => {
1813
+ transferContracts.value.splice(index, 1);
1814
+ transferSum.value = transferContracts.value.reduce((accumulator, { transferContractAmount }) => (accumulator += formatSpacedNumber(transferContractAmount)), 0);
1815
+ };
1816
+
1817
+ const prepareTransferContracts = (transferContracts: Array<TransferContract>) => {
1818
+ const formatedContracts: Array<TransferContract> = [];
1819
+ if (transferContracts && transferContracts.length) {
1820
+ transferContracts.forEach(i => {
1821
+ formatedContracts.push({
1822
+ ...i,
1823
+ transferContractDate: constants.regex.isoDate.test(i.transferContractDate) ? i.transferContractDate : formatDate(i.transferContractDate)?.toISOString() ?? '',
1824
+ transferContractFirstPaymentDate: constants.regex.isoDate.test(i.transferContractFirstPaymentDate)
1825
+ ? i.transferContractFirstPaymentDate
1826
+ : formatDate(i.transferContractFirstPaymentDate)?.toISOString() ?? '',
1827
+ // @ts-ignore
1828
+ transferContractCompany:
1829
+ typeof i.transferContractCompany !== 'string' && 'nameRu' in i.transferContractCompany ? String(i.transferContractCompany.nameRu) : i.transferContractCompany,
1830
+ transferContractCompanyId:
1831
+ // @ts-ignore
1832
+ typeof i.transferContractCompany !== 'string' && 'ids' in i.transferContractCompany ? i.transferContractCompany.ids : i.transferContractCompanyId,
1833
+ id: i.id ?? null,
1834
+ transferContractAmount: String(i.transferContractAmount).replace(/\s/g, ''),
1835
+ });
1836
+ });
1837
+ }
1838
+ return formatedContracts;
1839
+ };
1840
+
1440
1841
  const submitForm = async () => {
1441
1842
  vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
1442
1843
  if (v.valid) {
@@ -1444,9 +1845,12 @@ export default defineComponent({
1444
1845
  if (calculatorForm.type.code === 'Single' && calculatorForm.startDate && calculatorForm.endDate) {
1445
1846
  const formattedStartDate = formatDate(calculatorForm.startDate);
1446
1847
  const formattedEndDate = formatDate(calculatorForm.endDate);
1447
- if (formattedStartDate && formattedEndDate && formattedStartDate.getTime() > formattedEndDate.getTime()) {
1848
+ if (formattedStartDate && formattedEndDate && formattedStartDate.getTime() >= formattedEndDate.getTime()) {
1448
1849
  return dataStore.showToaster('error', dataStore.t('toaster.startMoreEnd'));
1449
1850
  }
1851
+ if (calculatorForm.days !== productConditionsForm.getSingleTripDays()) {
1852
+ return dataStore.showToaster('error', dataStore.t('toaster.daysPickAgain'));
1853
+ }
1450
1854
  }
1451
1855
  if (dataStore.isTask()) {
1452
1856
  await dataStore.calculatePrice(route.params.taskId as string);
@@ -1454,41 +1858,113 @@ export default defineComponent({
1454
1858
  await dataStore.calculatePrice();
1455
1859
  }
1456
1860
  } else if (whichProduct.value === 'pensionannuitynew') {
1457
- if (
1458
- pensionCalculationParams.value &&
1459
- pensionCalculationParams.value.compulsoryProfContractAmount &&
1460
- pensionForm &&
1461
- pensionForm.compulsoryProfContractAmount != 0 &&
1462
- pensionForm.compulsoryProfMonthCount < 60
1463
- ) {
1464
- dataStore.showToaster('error', 'Минимальное число дней уплаты ОППВ должно быть больше 60');
1465
- return;
1861
+ if (contractDate.value && maxDate.value && formatDate(contractDate.value) && formatDate(maxDate.value)) {
1862
+ const invalidDate = (formatDate(contractDate.value) ?? new Date()) > (formatDate(maxDate.value) ?? new Date());
1863
+ if (invalidDate) {
1864
+ dataStore.showToaster('error', 'Дата заключения договора некорректна');
1865
+ return;
1866
+ }
1867
+ }
1868
+ if (transferContracts.value && transferContracts.value.length) {
1869
+ transferContracts.value.forEach(i => {
1870
+ if (formatDate(i.transferContractDate) != null && formatDate(transferMaxDate.value)) {
1871
+ const invalidDate = (formatDate(i.transferContractDate) ?? new Date()) > (formatDate(transferMaxDate.value) ?? new Date());
1872
+ if (invalidDate) {
1873
+ dataStore.showToaster('error', 'Дата заключения договора КСЖ некорректна');
1874
+ return;
1875
+ }
1876
+ }
1877
+ });
1466
1878
  }
1467
- const data = {
1468
- ...pensionForm,
1469
- ...(pensionCalculationParams.value = {
1470
- ...pensionCalculationParams.value,
1471
- compulsoryContractAmount: Number(pensionCalculationParams.value.compulsoryContractAmount),
1472
- voluntaryContractAmount: Number(pensionCalculationParams.value.voluntaryContractAmount),
1473
- ownFundsRaisAmount: Number(pensionCalculationParams.value.ownFundsRaisAmount),
1474
- compulsoryProfContractAmount: Number(pensionCalculationParams.value.compulsoryProfContractAmount),
1475
- transferContractAmount: Number(pensionCalculationParams.value.transferContractAmount),
1476
- }),
1477
- transferContractCompany: pensionForm.transferContractCompany?.nameRu ?? null,
1478
- transferContractDate: transferContractDate.value ? formatDate(transferContractDate.value) : null,
1479
- transferContractFirstPaymentDate: transferContractFirstPaymentDate.value ? formatDate(transferContractFirstPaymentDate.value) : null,
1879
+ if (!pensionForm.value.compulsoryProfContractAmount) pensionForm.value.compulsoryProfMonthCount = null;
1880
+ const pensionData = {
1881
+ ...pensionForm.value,
1882
+ ...{
1883
+ compulsoryContractAmount: formatSpacedNumber(pensionForm.value.compulsoryContractAmount),
1884
+ voluntaryContractAmount: formatSpacedNumber(pensionForm.value.voluntaryContractAmount),
1885
+ ownFundsRaisAmount: formatSpacedNumber(pensionForm.value.ownFundsRaisAmount),
1886
+ compulsoryProfContractAmount: formatSpacedNumber(pensionForm.value.compulsoryProfContractAmount),
1887
+ transferContractAmount: formatSpacedNumber(pensionForm.value.transferContractAmount),
1888
+ transferContractCompany: pensionForm.value?.transferContractCompany?.nameRu ?? '',
1889
+ },
1890
+ amount: formatSpacedNumber(pensionForm.value.amount),
1891
+ contractDate: formatDate(contractDate.value ?? ''),
1480
1892
  };
1481
- await dataStore.setApplication(data, true);
1893
+ const data = isSlavePensionForm.value
1894
+ ? {
1895
+ ...formStore.pensionApp,
1896
+ transferContracts: prepareTransferContracts(formStore.pensionApp.transferContracts),
1897
+ slave: pensionData,
1898
+ amount: formatSpacedNumber(formStore.pensionApp?.amount),
1899
+ compulsoryContractAmount: formatSpacedNumber(formStore.pensionApp?.compulsoryContractAmount),
1900
+ voluntaryContractAmount: formatSpacedNumber(formStore.pensionApp?.voluntaryContractAmount),
1901
+ ownFundsRaisAmount: formatSpacedNumber(formStore.pensionApp?.ownFundsRaisAmount),
1902
+ compulsoryProfContractAmount: formatSpacedNumber(formStore.pensionApp?.compulsoryProfContractAmount),
1903
+ transferContractAmount: formatSpacedNumber(formStore.pensionApp?.transferContractAmount),
1904
+ transferContractCompany: pensionForm.value?.transferContractCompany?.nameRu ?? '',
1905
+ }
1906
+ : {
1907
+ ...pensionData,
1908
+ transferContracts: prepareTransferContracts(transferContracts.value),
1909
+ slave: !!formStore.pensionApp?.slave
1910
+ ? {
1911
+ ...formStore.pensionApp?.slave,
1912
+ contractDate: pensionData.contractDate,
1913
+ amount: formatSpacedNumber(formStore.pensionApp?.slave?.amount),
1914
+ compulsoryContractAmount: formatSpacedNumber(formStore.pensionApp?.slave?.compulsoryContractAmount),
1915
+ voluntaryContractAmount: formatSpacedNumber(formStore.pensionApp?.slave?.voluntaryContractAmount),
1916
+ ownFundsRaisAmount: formatSpacedNumber(formStore.pensionApp?.slave?.ownFundsRaisAmount),
1917
+ compulsoryProfContractAmount: formatSpacedNumber(formStore.pensionApp?.slave?.compulsoryProfContractAmount),
1918
+ transferContractAmount: formatSpacedNumber(formStore.pensionApp?.slave?.transferContractAmount),
1919
+ transferContractCompany: pensionForm.value?.transferContractCompany?.nameRu ?? '',
1920
+ }
1921
+ : null,
1922
+ };
1923
+ if (!!data.slave) {
1924
+ data.slave.transferContracts = prepareTransferContracts(isSlavePensionForm.value ? transferContracts.value : data.slave.transferContracts);
1925
+ const difference = Math.abs(
1926
+ formatSpacedNumber(formStore.pensionApp?.amount) + formatSpacedNumber(formStore.pensionApp?.slave?.amount) - formatSpacedNumber(pensionForm.value.amount),
1927
+ );
1928
+ if (customPension.value) {
1929
+ isSlavePensionForm.value ? (data.slave.amount = formatSpacedNumber(pensionForm.value.amount)) : (data.amount = formatSpacedNumber(pensionForm.value.amount));
1930
+ const customSum = sumPensionData(data) + sumPensionData(data.slave);
1931
+ if (formatSpacedNumber(totalInsPremium.value) !== customSum) {
1932
+ return dataStore.showToaster('error', 'Cтраховая премия не соответсвует общей страховой премии');
1933
+ }
1934
+ if (!isSlavePensionForm.value) {
1935
+ data.slave.amount = difference;
1936
+ } else {
1937
+ data.amount = difference;
1938
+ }
1939
+ } else {
1940
+ const amount = isSlavePensionForm.value ? data.slave.amount : data.amount;
1941
+ if (formatSpacedNumber(pensionForm.value.amount) != amount) {
1942
+ data.slave.amount = sumPensionData(data.slave);
1943
+ data.amount = sumPensionData(data);
1944
+ }
1945
+ }
1946
+ const isParentValid = validatePensionForm(data, 'Заполните условия первого страхователя');
1947
+ const isSlaveValid = validatePensionForm(data.slave, 'Заполните условия второго страхователя');
1948
+ if (!isParentValid || !isSlaveValid) {
1949
+ return;
1950
+ }
1951
+ await dataStore.setApplication(data, true);
1952
+ customPension.value = false;
1953
+ } else {
1954
+ await dataStore.setApplication(data, true);
1955
+ }
1956
+ await dataStore.getApplicationData(String(route.params.taskId), false, false, false, true);
1957
+ dateOfBegin.value = reformatDate(formStore.applicationData.pensionApp.dateOfBegin);
1482
1958
  } else {
1483
1959
  if (whichSum.value === 'requestedSumInsured') {
1484
1960
  productConditionsForm.insurancePremiumPerMonth = null;
1485
- if (whichProduct.value === 'halykkazyna') {
1961
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
1486
1962
  productConditionsForm.insurancePremiumPerMonthInDollar = null;
1487
1963
  }
1488
1964
  }
1489
1965
  if (whichSum.value === 'insurancePremiumPerMonth') {
1490
1966
  productConditionsForm.requestedSumInsured = null;
1491
- if (whichProduct.value === 'halykkazyna') {
1967
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
1492
1968
  productConditionsForm.requestedSumInsuredInDollar = null;
1493
1969
  }
1494
1970
  }
@@ -1554,7 +2030,9 @@ export default defineComponent({
1554
2030
  recalculationData.riskGroup = productConditionsForm.riskGroup?.id ? productConditionsForm.riskGroup.id : 1;
1555
2031
  isCalculating.value = true;
1556
2032
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1557
- await dataStore.calculate(route.params.taskId as string);
2033
+ const setApplicationData = dataStore.getConditionsData();
2034
+ const hasSetApplication = await dataStore.setApplication(setApplicationData);
2035
+ if (hasSetApplication) await dataStore.calculate(route.params.taskId as string);
1558
2036
  additionalTerms.value = formStore.additionalInsuranceTerms;
1559
2037
  } else {
1560
2038
  await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId as string, whichSum.value);
@@ -1573,7 +2051,6 @@ export default defineComponent({
1573
2051
  }
1574
2052
  }
1575
2053
  }
1576
-
1577
2054
  isCalculating.value = false;
1578
2055
  } else {
1579
2056
  const errors = document.querySelector('.v-input--error');
@@ -1597,75 +2074,127 @@ export default defineComponent({
1597
2074
  });
1598
2075
  };
1599
2076
 
2077
+ const validatePensionForm = (data: any, text: string) => {
2078
+ if (!data.amount || !data.guaranteedPeriod) {
2079
+ dataStore.showToaster('error', text);
2080
+ return false;
2081
+ }
2082
+ return true;
2083
+ };
2084
+
2085
+ const sumPensionData = (data: any) => {
2086
+ return (
2087
+ formatSpacedNumber(data.ownFundsRaisAmount) +
2088
+ formatSpacedNumber(data.voluntaryContractAmount) +
2089
+ formatSpacedNumber(data.compulsoryContractAmount) +
2090
+ formatSpacedNumber(data.compulsoryProfContractAmount) +
2091
+ sumContractsAmount(data.transferContracts)
2092
+ );
2093
+ };
2094
+
1600
2095
  onMounted(async () => {
1601
- if (props.isCalculator === true) {
2096
+ try {
2097
+ if (hasContragentData.value) await getContragent();
2098
+ if (props.isCalculator === true) {
2099
+ isLoading.value = true;
2100
+ if (dataStore.isCalculator) {
2101
+ clearFields();
2102
+ }
2103
+ if (whichProduct.value === 'gons') {
2104
+ formStore.isDisabled.productConditionsForm = false;
2105
+ dataStore.setFormsDisabled(false);
2106
+ }
2107
+ if (whichProduct.value !== 'lifetrip' && whichProduct.value !== 'pensionannuitynew') {
2108
+ if (
2109
+ (dataStore.isCalculator || route.params.taskId === '0' || fromIndexPage.value) &&
2110
+ productConditionsForm.requestedSumInsured === null &&
2111
+ productConditionsForm.insurancePremiumPerMonth === null
2112
+ ) {
2113
+ // @ts-ignore
2114
+ const defaultData = await dataStore.getDefaultCalculationData(true, whichProduct.value);
2115
+ if (!defaultData) {
2116
+ dataStore.showToaster('error', 'Отсутствуют базовые данные');
2117
+ return;
2118
+ }
2119
+ formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
2120
+ productConditionsForm.requestedSumInsured = defaultData.amount;
2121
+ productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
2122
+ const indexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
2123
+ if (indexRate) productConditionsForm.processIndexRate = indexRate;
2124
+ const paymendPeriod = dataStore.processPaymentPeriod.find(i => i.id === defaultData.paymentPeriodId);
2125
+ if (paymendPeriod) productConditionsForm.paymentPeriod = paymendPeriod;
2126
+ if (defaultData.signDate) {
2127
+ productConditionsForm.signDate = reformatDate(defaultData.signDate);
2128
+ }
2129
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
2130
+ productConditionsForm.coverPeriod = defaultData.insTermInMonth ?? null;
2131
+ productConditionsForm.insurancePremiumPerMonth = null;
2132
+ }
2133
+ }
2134
+ }
2135
+ }
2136
+ additionalTerms.value = props.isCalculator ? formStore.additionalInsuranceTermsWithout : formStore.additionalInsuranceTerms;
2137
+ if (!!productConditionsForm.insurancePremiumPerMonth) {
2138
+ whichSum.value = 'insurancePremiumPerMonth';
2139
+ }
2140
+ if (!!productConditionsForm.requestedSumInsured) {
2141
+ whichSum.value = 'requestedSumInsured';
2142
+ }
2143
+ if ((whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') && !productConditionsForm.requestedSumInsured) {
2144
+ whichSum.value = 'requestedSumInsured';
2145
+ }
1602
2146
  if (dataStore.isCalculator) {
1603
- clearFields();
2147
+ dataStore.processCode = constants.products[whichProduct.value as keyof typeof constants.products];
2148
+ await dataStore.getProcessPaymentPeriod();
1604
2149
  }
1605
- if (whichProduct.value !== 'lifetrip' && whichProduct.value !== 'pensionannuitynew') {
1606
- if (
1607
- (dataStore.isCalculator || route.params.taskId === '0' || fromIndexPage.value) &&
1608
- productConditionsForm.requestedSumInsured === null &&
1609
- productConditionsForm.insurancePremiumPerMonth === null
1610
- ) {
1611
- // @ts-ignore
1612
- const defaultData = await dataStore.getDefaultCalculationData(true, whichProduct.value);
1613
- if (!defaultData) {
1614
- dataStore.showToaster('error', 'Отсутствуют базовые данные');
1615
- return;
1616
- }
1617
- formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
1618
- productConditionsForm.requestedSumInsured = defaultData.amount;
1619
- productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
1620
- const indexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
1621
- if (indexRate) productConditionsForm.processIndexRate = indexRate;
1622
- const paymendPeriod = dataStore.processPaymentPeriod.find(i => i.id === defaultData.paymentPeriodId);
1623
- if (paymendPeriod) productConditionsForm.paymentPeriod = paymendPeriod;
1624
- if (defaultData.signDate) {
1625
- productConditionsForm.signDate = reformatDate(defaultData.signDate);
1626
- }
1627
- if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1628
- productConditionsForm.coverPeriod = defaultData.insTermInMonth ?? null;
1629
- productConditionsForm.insurancePremiumPerMonth = null;
1630
- }
2150
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
2151
+ await dataStore.getCurrencies();
2152
+ }
2153
+ if (whichProduct.value === 'halykkazyna') {
2154
+ const kazynaPaymentPeriod = dataStore.processPaymentPeriod.find(i => i.code === 'single');
2155
+ if (kazynaPaymentPeriod) productConditionsForm.paymentPeriod = kazynaPaymentPeriod;
2156
+ }
2157
+ if (!formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
2158
+ productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(
2159
+ formStore.lfb.clients.reduce((sum: number, i: any) => {
2160
+ return sum + Number(i.insSum);
2161
+ }, 0),
2162
+ );
2163
+ }
2164
+ if (whichProduct.value === 'pensionannuitynew') {
2165
+ contractDate.value = reformatDate(pensionForm.value.contractDate ?? '');
2166
+ dateOfBegin.value = reformatDate(pensionForm.value.dateOfBegin);
2167
+ transferContractDate.value = reformatDate(pensionForm.value.transferContractDate);
2168
+ transferContractFirstPaymentDate.value = reformatDate(pensionForm.value.transferContractFirstPaymentDate ?? '');
2169
+ maxDate.value = await dataStore.getVariableData(formStore.applicationData.processCode ?? 19);
2170
+ if (!transferContracts.value.length && pensionForm.value.transferContracts && pensionForm.value.transferContracts.length) {
2171
+ pensionForm.value.transferContracts.forEach((contract: TransferContract) => {
2172
+ transferContracts.value.push({
2173
+ ...contract,
2174
+ transferContractDate: constants.regex.isoDate.test(contract.transferContractDate) ? reformatDate(contract.transferContractDate)! : contract.transferContractDate,
2175
+ transferContractFirstPaymentDate: constants.regex.isoDate.test(contract.transferContractFirstPaymentDate)
2176
+ ? reformatDate(contract.transferContractFirstPaymentDate)!
2177
+ : contract.transferContractFirstPaymentDate,
2178
+ transferContractCompany:
2179
+ typeof contract.transferContractCompany === 'string' ? ({ nameRu: contract.transferContractCompany } as any) : contract.transferContractCompany,
2180
+ transferContractAmount: dataStore.getNumberWithSpaces(contract.transferContractAmount) ?? '',
2181
+ });
2182
+ });
1631
2183
  }
1632
2184
  }
1633
- }
1634
- additionalTerms.value = props.isCalculator ? formStore.additionalInsuranceTermsWithout : formStore.additionalInsuranceTerms;
1635
- if (!!productConditionsForm.insurancePremiumPerMonth) {
1636
- whichSum.value = 'insurancePremiumPerMonth';
1637
- }
1638
- if (!!productConditionsForm.requestedSumInsured) {
1639
- whichSum.value = 'requestedSumInsured';
1640
- }
1641
- if ((whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') && !productConditionsForm.requestedSumInsured) {
1642
- whichSum.value = 'requestedSumInsured';
1643
- }
1644
- if (dataStore.isCalculator) {
1645
- dataStore.processCode = constants.products[whichProduct.value as keyof typeof constants.products];
1646
- await dataStore.getProcessPaymentPeriod();
1647
- }
1648
- if (whichProduct.value === 'halykkazyna') {
1649
- const kazynaPaymentPeriod = dataStore.processPaymentPeriod.find(i => i.code === 'single');
1650
- if (kazynaPaymentPeriod) productConditionsForm.paymentPeriod = kazynaPaymentPeriod;
1651
- await dataStore.getCurrencies();
1652
- }
1653
- if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1654
- productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(
1655
- formStore.lfb.clients.reduce((sum: number, i: any) => {
1656
- return sum + Number(i.insSum);
1657
- }, 0),
1658
- );
1659
- }
1660
- if (whichProduct.value === 'pensionannuitynew') {
1661
- contractDate.value = reformatDate(formStore.applicationData.pensionApp.contractDate);
1662
- dateOfBegin.value = reformatDate(formStore.applicationData.pensionApp.dateOfBegin);
1663
- transferContractDate.value = reformatDate(formStore.applicationData.pensionApp.transferContractDate);
1664
- transferContractFirstPaymentDate.value = reformatDate(formStore.applicationData.pensionApp.transferContractFirstPaymentDate);
1665
- maxDate.value = await dataStore.getVariableData(formStore.applicationData.processCode ?? 19);
2185
+ } catch (err) {
2186
+ console.log(err);
2187
+ } finally {
2188
+ isLoading.value = false;
1666
2189
  }
1667
2190
  });
1668
2191
 
2192
+ watch(
2193
+ () => pensionForm.value?.amount,
2194
+ val => {
2195
+ if (val) pensionForm.value.amount = dataStore.getNumberWithSpaces(val);
2196
+ },
2197
+ );
1669
2198
  watch(
1670
2199
  () => productConditionsForm.amountOfInsurancePremium,
1671
2200
  val => {
@@ -1696,6 +2225,23 @@ export default defineComponent({
1696
2225
  { immediate: true },
1697
2226
  );
1698
2227
 
2228
+ if (hasCurrency.value) {
2229
+ watch(
2230
+ () => productConditionsForm.currency,
2231
+ async val => {
2232
+ if (val.code === 'USD') {
2233
+ if (!dataStore.processPaymentPeriod.length) {
2234
+ await dataStore.getProcessPaymentPeriod();
2235
+ }
2236
+ const paymentPeriod = dataStore.processPaymentPeriod.find(item => item.nameRu === 'единовременно');
2237
+ if (paymentPeriod) {
2238
+ productConditionsForm.paymentPeriod = paymentPeriod;
2239
+ }
2240
+ }
2241
+ },
2242
+ );
2243
+ }
2244
+
1699
2245
  if (hasInsStartDate.value) {
1700
2246
  watch(
1701
2247
  () => productConditionsForm.calcDate,
@@ -1729,6 +2275,8 @@ export default defineComponent({
1729
2275
  async val => {
1730
2276
  if (val?.length && val.every(option => option.id != 0) && calculatorForm.type?.nameRu != null) {
1731
2277
  await dataStore.getTripInsuredAmount();
2278
+ } else {
2279
+ calculatorForm.amount = new Value();
1732
2280
  }
1733
2281
  },
1734
2282
  { deep: true },
@@ -1762,8 +2310,41 @@ export default defineComponent({
1762
2310
  );
1763
2311
  }
1764
2312
 
2313
+ if (whichProduct.value === 'pensionannuitynew') {
2314
+ watch(
2315
+ () => pensionForm.value.guaranteedPeriod,
2316
+ async () => {
2317
+ if (formStore.applicationData.processCode === 24) {
2318
+ await dataStore.reCalculateRefund(
2319
+ Number(pensionForm.value.parentContractAmount),
2320
+ Number(pensionForm.value.parentContractMainAmount),
2321
+ pensionForm.value.guaranteedPeriod,
2322
+ pensionForm.value.transferContractIsOppv,
2323
+ pensionForm.value.compulsoryProfMonthCount ?? 0,
2324
+ );
2325
+ }
2326
+ },
2327
+ );
2328
+ watch(
2329
+ () => contractDate.value,
2330
+ (val, oldVal) => {
2331
+ if (val !== null && val !== undefined && val.length === 10 && oldVal != undefined && !isSlavePensionForm.value) {
2332
+ const formattedContractDate = formatDate(val);
2333
+ if (formattedContractDate) {
2334
+ const transferMax = formattedContractDate;
2335
+ transferMax.setFullYear(transferMax.getFullYear() - 2);
2336
+ transferMax.setDate(transferMax.getDate() + 1);
2337
+ transferMaxDate.value = reformatDate(String(transferMax));
2338
+ formattedContractDate.setDate(formattedContractDate.getDate() + 20);
2339
+ dateOfBegin.value = reformatDate(String(formattedContractDate));
2340
+ }
2341
+ }
2342
+ },
2343
+ );
2344
+ }
2345
+
1765
2346
  const copyRedirect = async () => {
1766
- const url = await dataStore.api.getEnpfRedirectUrl(String(formStore.applicationData.processInstanceId));
2347
+ const url = await dataStore.api.pensionannuityNew.getEnpfRedirectUrl(String(pensionForm.value.processInstanceId));
1767
2348
  dataStore.copyToClipboard(url.redirectUrl);
1768
2349
  };
1769
2350
 
@@ -1771,6 +2352,7 @@ export default defineComponent({
1771
2352
  // State
1772
2353
  formStore,
1773
2354
  vForm,
2355
+ isLoading,
1774
2356
  whichProduct,
1775
2357
  productConditionsForm,
1776
2358
  additionalTerms,
@@ -1792,20 +2374,35 @@ export default defineComponent({
1792
2374
  subTermValue,
1793
2375
  panelCodeList,
1794
2376
  pensionForm,
2377
+ insuredForm,
1795
2378
  dateOfBegin,
1796
2379
  contractDate,
1797
2380
  transferContractDate,
1798
2381
  transferContractFirstPaymentDate,
1799
2382
  enabled,
1800
2383
  maxDate,
2384
+ amountPaid,
2385
+ amountRefunded,
2386
+ transferMaxDate,
1801
2387
  guaranteedPeriodList,
1802
2388
  isEnpfSum,
2389
+ transferContracts,
2390
+ contractsValue,
2391
+ contractIndex,
2392
+ contragentData,
2393
+ customPension,
1803
2394
 
1804
2395
  // Computed
1805
2396
  isTask,
1806
2397
  isDisabled,
2398
+ disabilityGroup,
2399
+ totalInsPremium,
1807
2400
  isTermsDisabled,
1808
2401
  isUnderwriterForm,
2402
+ hasCurrencySymbols,
2403
+ currencyListFiltered,
2404
+ currencySymbolsLabel,
2405
+ isDisabledPaymentPeriod,
1809
2406
  insurancePremiumPerMonthRule,
1810
2407
  insurancePremiumPerMonthDisabled,
1811
2408
  requestedSumInsuredRule,
@@ -1813,9 +2410,13 @@ export default defineComponent({
1813
2410
  isUnderwriterRole,
1814
2411
  hasProcessIndexRate,
1815
2412
  hasPaymentPeriod,
2413
+ hasRequestedSumInsured,
2414
+ hasInsurancePremiumPerMonth,
1816
2415
  hasRequestedSumInsuredInDollar,
1817
2416
  hasInsurancePremiumPerMonthInDollar,
1818
2417
  hasCurrency,
2418
+ hasPaidOrRefund,
2419
+ hasContragentData,
1819
2420
  hasAdbMultiply,
1820
2421
  readonlyLifeAdditive,
1821
2422
  readonlyDisabilityMultiply,
@@ -1825,6 +2426,7 @@ export default defineComponent({
1825
2426
  hasCalculated,
1826
2427
  hasAnnuityPayments,
1827
2428
  hasAgencyPart,
2429
+ hasDisabilityAdditive,
1828
2430
  currencySymbolsAddTerm,
1829
2431
  amountAnnuityPayments,
1830
2432
  requestedSumInsuredLabel,
@@ -1834,23 +2436,28 @@ export default defineComponent({
1834
2436
  hasBirthDate,
1835
2437
  hasGender,
1836
2438
  coverPeriodLabel,
2439
+ lifeMultiplyLabel,
2440
+ lifeAdditiveLabel,
2441
+ disabilityMultiplyLabel,
2442
+ adbMultiplyLabel,
2443
+ adbAdditiveLabel,
1837
2444
  insurancePremiumPerMonthLabel,
1838
2445
  isDisabledCoverPeriod,
1839
2446
  hasDefault,
1840
2447
  isShownAdditionalTerms,
1841
2448
  hasCalcSum,
2449
+ isDisabledInsStartDate,
1842
2450
  isDisabledAgentCommission,
1843
2451
  hasFixInsSum,
1844
2452
  isDisabledFixInsSum,
1845
2453
  defaultText,
1846
2454
  hasDeathInsFromNS,
1847
- pensionAmount,
1848
- pensionCalculationParams,
1849
2455
  hasDeathInsAnyReason,
1850
2456
  fromIndexPage,
1851
2457
  hasCoverPeriod,
1852
2458
  hasInsStartDate,
1853
2459
  hasInsEndDate,
2460
+ isSlavePensionForm,
1854
2461
 
1855
2462
  // Rules
1856
2463
  coverPeriodRule,
@@ -1868,9 +2475,11 @@ export default defineComponent({
1868
2475
  onInputInsurancePremiumPerMonth,
1869
2476
  onInputInsurancePremiumPerMonthInDollar,
1870
2477
  onInputSum,
2478
+ onInputPension,
1871
2479
  onInputSumDollar,
1872
2480
  toStatement,
1873
2481
  onClearSum,
2482
+ onClearPension,
1874
2483
  onClearSumDollar,
1875
2484
  onClearPremium,
1876
2485
  onClearPremiumDollar,
@@ -1882,6 +2491,9 @@ export default defineComponent({
1882
2491
  pickSubTermValue,
1883
2492
  onInputFixInsSum,
1884
2493
  copyRedirect,
2494
+ getContragent,
2495
+ addTransferContract,
2496
+ removeTransferContract,
1885
2497
  };
1886
2498
  },
1887
2499
  });