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

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 +331 -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 +17 -8
  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 +800 -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 +133 -49
  35. package/composables/constants.ts +43 -0
  36. package/composables/fields.ts +6 -4
  37. package/composables/index.ts +293 -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 +79 -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 +765 -530
  48. package/store/member.store.ts +18 -6
  49. package/store/rules.ts +22 -2
  50. package/types/enum.ts +32 -2
  51. package/types/env.d.ts +2 -2
  52. package/types/form.ts +71 -74
  53. package/types/index.ts +921 -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'" :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"
@@ -249,10 +265,10 @@
249
265
  @onClear="onClearPremiumDollar"
250
266
  />
251
267
  <base-form-input
252
- v-if="hasCurrency && $dataStore.currencies.usd"
268
+ v-if="hasCurrencySymbols && $dataStore.currencies.usd"
253
269
  v-model="$dataStore.currencies.usd"
254
270
  :readonly="true"
255
- :label="$dataStore.t('productConditionsForm.dollarExchangeRateNBRK')"
271
+ :label="currencySymbolsLabel"
256
272
  :suffix="$constants.currencySymbols.kzt"
257
273
  />
258
274
  <base-form-input
@@ -289,102 +305,192 @@
289
305
  :label="$dataStore.t('productConditionsForm.agencyPart')"
290
306
  :readonly="isDisabledAgentCommission"
291
307
  :clearable="!isDisabledAgentCommission"
292
- :rules="$rules.required.concat($rules.numbers, $rules.agentCommission)"
308
+ :rules="formStore.lfb.add ? $rules.required : $rules.required.concat($rules.numbers, $rules.agentCommission)"
293
309
  />
294
310
  </base-form-section>
295
311
  <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')">
312
+ <base-animation>
313
+ <div
314
+ v-if="(formStore.applicationData.processCode === 19 || formStore.applicationData.processCode === 25) && !isDisabled"
315
+ :class="[$styles.blueBgLight]"
316
+ class="h-[52px] rounded-lg flex items-center justify-end px-2 gap-2 mt-4"
317
+ >
318
+ <base-btn class="max-w-[300px]" :text="$dataStore.t('buttons.copyToClient')" size="sm" @click="copyRedirect" />
319
+ </div>
320
+ </base-animation>
321
+ <base-form-section v-if="formStore.applicationData.statusCode === 'ActuaryForm' && isTask">
322
+ <base-content-block :class="[$styles.textSimple]">
323
+ <h5 class="text-center font-medium mb-4">{{ $dataStore.t('labels.contract') }}</h5>
324
+ <div :class="[$styles.whiteBg, $styles.rounded]" class="p-2 h-12 flex items-center relative">
325
+ <span class="ml-2">Договор {{ formStore.applicationData.processCode === 19 || formStore.applicationData.processCode === 25 ? 'страхования' : 'возврата' }}</span>
326
+ <i
327
+ class="transition-all cursor-pointer mdi mdi-tray-arrow-down pl-2 mr-3 border-l-[1px] text-xl absolute right-0"
328
+ :class="[$styles.greenTextHover]"
329
+ @click="
330
+ $dataStore.generatePDFDocument(
331
+ formStore.applicationData.processCode === 19 ? 'PA_Contract' : formStore.applicationData.processCode === 25 ? 'PAJ_Contract' : 'PA_RefundAgreement',
332
+ '38',
333
+ )
334
+ "
335
+ ></i>
336
+ </div>
337
+ </base-content-block>
338
+ </base-form-section>
339
+ <div v-if="formStore.applicationData.processCode === 25" class="flex items-center mt-[14px] h-[48px]">
340
+ <div :class="[$styles.blueBgLight]" class="flex flex-wrap items-center gap-2 p-1 rounded-t-[8px] h-full">
341
+ <div
342
+ class="h-full px-4 py-1 rounded-[8px] cursor-pointer flex items-center"
343
+ :class="[$styles.textSimple, !isSlavePensionForm ? `${$styles.blueBg} ${$styles.whiteText}` : '']"
344
+ @click="$router.replace({ query: { ...$route.query, which: undefined, upd: 'true' } })"
345
+ >
346
+ {{ !!formStore.applicationData.clientApp?.longName ? formStore.applicationData.clientApp?.longName : 'Страхователь' }}
347
+ </div>
348
+ <div
349
+ class="h-full px-4 py-1 rounded-[8px] cursor-pointer flex items-center"
350
+ :class="[$styles.textSimple, isSlavePensionForm ? `${$styles.blueBg} ${$styles.whiteText}` : '']"
351
+ @click="$router.replace({ query: { ...$route.query, which: 'slave', upd: 'true' } })"
352
+ >
353
+ {{ !!formStore.applicationData.slave.clientApp?.longName ? formStore.applicationData.slave.clientApp?.longName : 'Страхователь 2' }}
354
+ </div>
355
+ </div>
356
+ </div>
357
+ <base-form-section v-if="hasContragentData && contragentData">
358
+ <base-panel-input v-model="contragentData.gender" :readonly="true" :clearable="false" :label="$dataStore.t('form.gender')" />
359
+ <base-form-input v-model="contragentData.birthDate" :readonly="true" :clearable="false" :label="$dataStore.t('form.birthDate')" />
360
+ <base-panel-input
361
+ v-if="disabilityGroup"
362
+ v-model="disabilityGroup"
363
+ :value="disabilityGroup?.nameRu"
364
+ :readonly="true"
365
+ :clearable="false"
366
+ :label="$dataStore.t('pension.disabilityGroup')"
367
+ />
368
+ </base-form-section>
369
+ <base-form-section
370
+ v-if="formStore.applicationData.processCode !== 24"
371
+ :title="$dataStore.t('pension.compulsoryAmount&Prof')"
372
+ :class="[formStore.applicationData.processCode === 25 ? 'mt-0 rounded-tl-none' : '']"
373
+ >
298
374
  <base-form-input
299
- v-model="pensionCalculationParams.compulsoryContractAmount"
300
- :maska="$maska.numbers"
375
+ v-model="pensionForm.compulsoryContractAmount"
301
376
  :readonly="isDisabled || isEnpfSum"
302
377
  :clearable="!isDisabled && !isEnpfSum"
303
378
  :label="$dataStore.t('pension.compulsoryContractAmount')"
379
+ :rules="$dataStore.rules.sums"
380
+ :suffix="$constants.currencySymbols.kzt"
381
+ @input="onInputPension($event, 'compulsoryContractAmount')"
382
+ @onClear="onClearPension('compulsoryContractAmount')"
304
383
  />
305
384
  <base-form-input
306
- v-model="pensionCalculationParams.compulsoryProfContractAmount"
307
- :maska="$maska.numbers"
385
+ v-model="pensionForm.compulsoryProfContractAmount"
308
386
  :readonly="isDisabled || isEnpfSum"
309
387
  :clearable="!isDisabled && !isEnpfSum"
310
388
  :label="$dataStore.t('pension.compulsoryProfContractAmount')"
389
+ :rules="$dataStore.rules.sums"
390
+ :suffix="$constants.currencySymbols.kzt"
391
+ @input="onInputPension($event, 'compulsoryProfContractAmount')"
392
+ @onClear="onClearPension('compulsoryProfContractAmount')"
311
393
  />
312
394
  <base-animation>
313
395
  <base-form-input
314
- v-if="pensionCalculationParams.compulsoryProfContractAmount && pensionCalculationParams.compulsoryProfContractAmount != 0"
396
+ v-if="pensionForm.compulsoryProfContractAmount && pensionForm.compulsoryProfContractAmount != 0"
315
397
  v-model="pensionForm.compulsoryProfMonthCount"
316
398
  :maska="$maska.numbers"
317
- :readonly="isDisabled || isEnpfSum"
318
- :clearable="!isDisabled && !isEnpfSum"
399
+ :readonly="isDisabled"
400
+ :clearable="!isDisabled"
319
401
  :label="$dataStore.t('pension.compulsoryProfMonthCount')"
320
402
  />
321
403
  </base-animation>
322
404
  <base-form-input
323
- v-model="pensionCalculationParams.voluntaryContractAmount"
324
- :maska="$maska.numbers"
325
- :readonly="isDisabled"
326
- :clearable="!isDisabled"
405
+ v-model="pensionForm.voluntaryContractAmount"
406
+ :readonly="isDisabled || isEnpfSum"
407
+ :clearable="!isDisabled && !isEnpfSum"
327
408
  :label="$dataStore.t('pension.voluntaryContractAmount')"
409
+ :rules="$dataStore.rules.sums"
410
+ :suffix="$constants.currencySymbols.kzt"
411
+ @input="onInputPension($event, 'voluntaryContractAmount')"
412
+ @onClear="onClearPension('voluntaryContractAmount')"
328
413
  />
329
414
  <base-form-input
330
- v-model="pensionCalculationParams.ownFundsRaisAmount"
331
- :maska="$maska.numbers"
415
+ v-model="pensionForm.ownFundsRaisAmount"
332
416
  :readonly="isDisabled"
333
417
  :clearable="!isDisabled"
334
418
  :label="$dataStore.t('pension.ownFundsRaisAmount')"
419
+ :rules="$dataStore.rules.sums"
420
+ :suffix="$constants.currencySymbols.kzt"
421
+ @input="onInputPension($event, 'ownFundsRaisAmount')"
422
+ @onClear="onClearPension('ownFundsRaisAmount')"
335
423
  />
336
424
  </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')" />
425
+ <base-form-section v-if="formStore.applicationData.processCode !== 24" :title="$dataStore.t('pension.companyName')">
426
+ <base-btn v-if="!isDisabled" :text="$dataStore.t('buttons.add')" :disabled="isDisabled" size="sm" :btn="$styles.blueBtn" @click="addTransferContract" />
427
+ <section v-for="(contract, index) in transferContracts" class="py-2">
428
+ <base-panel-input
429
+ v-model="contract.transferContractCompany"
430
+ :value="contract.transferContractCompany?.nameRu"
431
+ :label="$dataStore.t('pension.transferContractCompany')"
432
+ :readonly="isDisabled"
433
+ :clearable="!isDisabled"
434
+ append-inner-icon="mdi mdi-chevron-right"
435
+ @append="
436
+ openPanel($dataStore.t('pension.transferContractCompany'), $dataStore.transferContractCompanies, 'transferContractCompany', $dataStore.getInsuranceCompanies)
437
+ "
438
+ @click="contractIndex = index"
439
+ />
440
+ <div class="flex flex-col">
441
+ <base-form-input
442
+ v-model="contract.transferContractDate"
443
+ :maska="$maska.date"
444
+ :label="$dataStore.t('pension.contractDate')"
445
+ :readonly="isDisabled"
446
+ :clearable="!isDisabled"
447
+ :max-date="formatDate(transferMaxDate) ?? undefined"
448
+ :rules="$dataStore.rules.required.concat($dataStore.rules.birthDate)"
449
+ append-inner-icon="mdi mdi-calendar-blank-outline"
450
+ />
451
+ <span v-if="transferMaxDate && !isDisabled" class="px-3 font-light text-sm bg-white py-0 mt-[-5px]" style="color: #a0b3d8 !important"
452
+ >до {{ transferMaxDate }} включительно</span
453
+ >
454
+ </div>
455
+ <base-form-input v-model="contract.transferContractNumber" :label="$dataStore.t('pension.globalId')" :readonly="isDisabled" :clearable="!isDisabled" />
456
+ <base-form-input
457
+ v-model="contract.transferContractRegNumber"
458
+ :label="$dataStore.t('pension.transferRegNumber')"
459
+ :rules="$rules.required"
460
+ :readonly="isDisabled"
461
+ :clearable="!isDisabled"
462
+ />
463
+ <base-form-input
464
+ v-model="contract.transferContractFirstPaymentDate"
465
+ :maska="$maska.date"
466
+ :label="$dataStore.t('pension.transferContractFirstPaymentDate')"
467
+ :rules="$dataStore.rules.required.concat($dataStore.rules.birthDate)"
468
+ append-inner-icon="mdi mdi-calendar-blank-outline"
469
+ :readonly="isDisabled"
470
+ :clearable="!isDisabled"
471
+ />
472
+ <base-form-input
473
+ v-model="contract.transferContractAmount"
474
+ :label="$dataStore.t('pension.transferContractAmount')"
475
+ :suffix="$constants.currencySymbols.kzt"
476
+ :readonly="isDisabled"
477
+ :clearable="!isDisabled"
478
+ @input="onInputPension($event, 'transferContractAmount', index)"
479
+ @onClear="onClearPension('transferContractAmount', index)"
480
+ />
481
+ <base-form-toggle v-model="contract.transferContractIsOppv" :disabled="isDisabled" :has-border="false" :title="$dataStore.t('pension.isOPPVTransfer')" />
482
+ <base-btn v-if="!isDisabled" :text="$dataStore.t('buttons.delete')" :disabled="isDisabled" size="sm" :btn="$styles.whiteBtn" @click="removeTransferContract(index)" />
483
+ </section>
379
484
  </base-form-section>
380
485
  <base-form-section :title="$dataStore.t('pension.paymentTerms')">
381
486
  <base-form-input
382
487
  v-model="contractDate"
383
488
  :maska="$maska.date"
384
489
  :rules="!isDisabled ? $rules.required.concat($rules.date) : []"
385
- :readonly="isDisabled"
490
+ :readonly="isDisabled || formStore.applicationData.processCode === 24 || isSlavePensionForm"
386
491
  :clearable="!isDisabled"
387
492
  :min-date="new Date()"
493
+ :max-date="formatDate(maxDate ?? '') ?? undefined"
388
494
  :label="$dataStore.t('pension.contractDate')"
389
495
  append-inner-icon="mdi mdi-calendar-blank-outline"
390
496
  />
@@ -403,8 +509,24 @@
403
509
  <base-form-input v-model="pensionForm.frequencyPayments" disabled :label="$dataStore.t('pension.frequencyPayments')" />
404
510
  <base-form-input v-model="pensionForm.periodPayments" disabled :label="$dataStore.t('pension.paymentPeriod')" />
405
511
  <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')" />
512
+ <base-form-input
513
+ v-if="formStore.applicationData.processCode === 25 && formStore.pensionApp?.slave?.amount"
514
+ :value="totalInsPremium"
515
+ :active="true"
516
+ :label="$dataStore.t('productConditionsForm.totalInsurancePremiumAmount')"
517
+ :disabled="$dataStore.isLoading"
518
+ readonly
519
+ />
520
+ <base-form-input
521
+ v-model="pensionForm.amount"
522
+ :value="$dataStore.getNumberWithSpaces(pensionForm.amount)"
523
+ @input="onInputPension($event, 'pensionAmount')"
524
+ @onClear="onClearPension('pensionAmount')"
525
+ @change="customPension = true"
526
+ :readonly="isDisabled || formStore.applicationData.processCode !== 25"
527
+ :label="$dataStore.t('pension.pensionAmount')"
528
+ />
529
+ <base-form-input :value="$dataStore.getNumberWithSpaces(pensionForm.payment)" :active="true" readonly :label="$dataStore.t('pension.pensionPayment')" />
408
530
  </base-form-section>
409
531
  </section>
410
532
  <base-form-section v-if="hasAnnuityPayments" :title="$dataStore.t('calculationAnnuityPayments')">
@@ -619,17 +741,46 @@
619
741
  </div>
620
742
  </base-form-section>
621
743
  </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
- />
744
+ <base-animation>
745
+ <base-btn
746
+ v-if="!$dataStore.isCalculator && isCalculator && hasCalculated"
747
+ :btn="$styles.greenLightBtn"
748
+ :text="$dataStore.t('buttons.toStatement')"
749
+ class="min-h-[60px]"
750
+ @click="toStatement"
751
+ />
752
+ </base-animation>
753
+ <base-animation>
754
+ <base-btn
755
+ v-if="!isDisabled && $dataStore.isPension && isTask"
756
+ :text="$dataStore.t('buttons.calculate')"
757
+ :loading="$dataStore.isLoading"
758
+ class="min-h-[60px]"
759
+ type="submit"
760
+ @click="submitForm"
761
+ />
762
+ </base-animation>
763
+ <base-animation>
764
+ <base-btn
765
+ v-if="$dataStore.isCalculator ? true : !isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter()) && !$dataStore.isPension"
766
+ :loading="isCalculating"
767
+ class="min-h-[60px]"
768
+ :text="$dataStore.t('buttons.calculate')"
769
+ @click="submitForm"
770
+ />
771
+ </base-animation>
630
772
  <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" />
773
+ <base-animation>
774
+ <base-btn
775
+ v-if="hasCalcSum"
776
+ class="min-h-[60px]"
777
+ :text="$dataStore.t('buttons.calcSum')"
778
+ type="submit"
779
+ @click.prevent="underwriterCalculate('sum')"
780
+ :loading="isCalculating"
781
+ />
782
+ </base-animation>
783
+ <base-btn class="min-h-[60px]" :text="$dataStore.t('buttons.calcPremium')" type="submit" @click.prevent="underwriterCalculate('premium')" :loading="isCalculating" />
633
784
  </div>
634
785
  <Teleport v-if="isPanelOpen" to="#right-panel-actions">
635
786
  <div :class="[$styles.scrollPage]" class="flex flex-col items-center">
@@ -692,10 +843,21 @@
692
843
  </div>
693
844
  </Teleport>
694
845
  </section>
846
+ <div v-if="isLoading" class="w-full h-[80dvh] flex items-center justify-center"><base-loader :size="50" /></div>
695
847
  </template>
696
848
 
697
849
  <script lang="ts">
698
- import { Member, Value, CountryValue, CalculatorForm } from '../../composables/classes';
850
+ import { Member, Value, CountryValue, CalculatorForm, TransferContract } from '../../composables/classes';
851
+ import type { Projects, AddCover, AddCoverAnswer } from '../../types';
852
+
853
+ type PensionCalculation = {
854
+ compulsoryContractAmount: number | string | null;
855
+ voluntaryContractAmount: number | string | null;
856
+ ownFundsRaisAmount: number | string | null;
857
+ compulsoryProfContractAmount: number | string | null;
858
+ transferContractAmount: number | string | null;
859
+ transferContractCompany: number | string | null;
860
+ };
699
861
 
700
862
  export default defineComponent({
701
863
  props: {
@@ -721,6 +883,7 @@ export default defineComponent({
721
883
  const isPanelLoading = ref<boolean>(false);
722
884
  const isPanelOpen = ref<boolean>(false);
723
885
  const isTermsPanelOpen = ref<boolean>(false);
886
+ const isLoading = ref<boolean>(false);
724
887
  const panelValue = ref<Value>(new Value());
725
888
  const termValue = ref<AddCover>();
726
889
  const subTermValue = ref<string>('');
@@ -736,20 +899,43 @@ export default defineComponent({
736
899
 
737
900
  const additionalTerms = ref<AddCover[]>([]);
738
901
 
739
- const maxDate = ref();
902
+ const maxDate = ref<string | null>();
903
+ const transferMaxDate = ref();
740
904
  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;
905
+ const contractDate = ref<string | null>();
906
+ const transferContractDate = ref<string | null>();
907
+ const transferContractFirstPaymentDate = ref<string | null>();
908
+ const guaranteedPeriodList = Array.from(Array(35), (_, i) => i + 1);
909
+ const isSlavePensionForm = computed(() => route.query.which === 'slave');
910
+ const pensionForm = computedWithControl(
911
+ () => formStore.pensionApp,
912
+ () => (route.query.which === 'slave' ? formStore.pensionApp?.slave : formStore.pensionApp ?? undefined),
913
+ );
747
914
 
915
+ const insuredForm = isSlavePensionForm.value
916
+ ? formStore.applicationData?.slave?.insuredApp && formStore.applicationData?.slave?.insuredApp[0]
917
+ : (formStore.applicationData?.insuredApp && Array.isArray(formStore.applicationData?.insuredApp) && formStore.applicationData?.insuredApp[0]) ?? undefined;
918
+ const disabilityGroup = computed(() => {
919
+ if (!!insuredForm.disabilityGroupId) {
920
+ const disabilityGroup = dataStore.disabilityGroups.find(i => i.id === insuredForm.disabilityGroupId);
921
+ return disabilityGroup;
922
+ }
923
+ });
924
+ const isEnpfSum = pensionForm.value?.isEnpfSum ?? false;
925
+
926
+ const transferContracts = ref<TransferContract[]>([]);
927
+ const contractsValue = ref<Value[]>([]);
928
+ const contractIndex = ref<number>(0);
748
929
  const isMultiplePanelOpen = ref<boolean>(false);
749
930
  const multiplePanelValue = ref<CountryValue>(new CountryValue());
750
931
  const multiplePanelList = ref<CountryValue[]>([]);
751
932
  const calculatorForm = productConditionsForm.calculatorForm;
752
933
  const minInsSum = computed(() => formStore.lfb.clients && formStore.lfb.clients.reduce((min, item) => Math.min(min, item.insSum), Infinity));
934
+ const contragentData = ref<any>();
935
+ const customPension = ref<boolean>(false);
936
+ const transferSum = ref<number>(0);
937
+ const firstAmount = ref<boolean>(true);
938
+
753
939
  const isShownAdditionalTerms = computed(() => {
754
940
  if (whichProduct.value === 'gons') {
755
941
  return false;
@@ -768,6 +954,9 @@ export default defineComponent({
768
954
  if (whichProduct.value === 'gons') {
769
955
  return true;
770
956
  }
957
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
958
+ return true;
959
+ }
771
960
  if ((whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') && dataStore.isUnderwriter()) {
772
961
  return false;
773
962
  }
@@ -777,7 +966,13 @@ export default defineComponent({
777
966
  const isTask = computed(() => (route.params.taskId === '0' && props.isCalculator === true) || dataStore.isTask() || fromIndexPage.value);
778
967
  const isRecalculationDisabled = computed(() => formStore.isDisabled.recalculationForm || formStore.canBeClaimed === true);
779
968
  const isUnderwriterRole = computed(() => dataStore.isUnderwriter() || dataStore.isAdmin() || dataStore.isSupport());
780
- const insurancePremiumPerMonthRule = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
969
+ const insurancePremiumPerMonthRule = computed(() =>
970
+ !!productConditionsForm.insurancePremiumPerMonth
971
+ ? whichProduct.value === 'gons' || whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns'
972
+ ? dataStore.rules.required
973
+ : dataStore.rules.required.concat(dataStore.rules.sums)
974
+ : [],
975
+ );
781
976
  const insurancePremiumPerMonthDisabled = computed(() => {
782
977
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
783
978
  return true;
@@ -787,7 +982,9 @@ export default defineComponent({
787
982
  }
788
983
  return isDisabled.value;
789
984
  });
790
- const requestedSumInsuredRule = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
985
+ const requestedSumInsuredRule = computed(() =>
986
+ !!productConditionsForm.requestedSumInsured ? (whichProduct.value === 'gons' ? dataStore.rules.required : dataStore.rules.required.concat(dataStore.rules.sums)) : [],
987
+ );
791
988
  const fixInsSumRule = computed(() =>
792
989
  !!productConditionsForm.fixInsSum
793
990
  ? dataStore.rules.required.concat(dataStore.rules.sums, dataStore.rules.fixInsSumLimit(getNumber(productConditionsForm.fixInsSum as string), minInsSum.value))
@@ -801,22 +998,16 @@ export default defineComponent({
801
998
  return !!productConditionsForm.requestedSumInsured && !!productConditionsForm.insurancePremiumPerMonth;
802
999
  });
803
1000
  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;
1001
+ if (whichProduct.value === 'baiterek' || whichProduct.value === 'bolashak') return true;
1002
+ return false;
815
1003
  });
816
1004
  const hasPaymentPeriod = computed(() => {
817
1005
  if (whichProduct.value === 'halykkazyna') {
818
1006
  return false;
819
1007
  }
1008
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1009
+ return false;
1010
+ }
820
1011
  return true;
821
1012
  });
822
1013
  const hasCoverPeriod = computed(() => {
@@ -829,18 +1020,27 @@ export default defineComponent({
829
1020
  if (whichProduct.value === 'halykkazyna') {
830
1021
  return true;
831
1022
  }
1023
+ if (whichProduct.value === 'gons' && productConditionsForm.currency.code === 'USD') {
1024
+ return true;
1025
+ }
832
1026
  return false;
833
1027
  });
834
1028
  const hasInsurancePremiumPerMonthInDollar = computed(() => {
835
1029
  if (whichProduct.value === 'halykkazyna') {
836
1030
  return true;
837
1031
  }
1032
+ if (whichProduct.value === 'gons' && productConditionsForm.currency.code === 'USD') {
1033
+ return true;
1034
+ }
838
1035
  return false;
839
1036
  });
840
- const hasCurrency = computed(() => {
1037
+ const hasCurrencySymbols = computed(() => {
841
1038
  if (whichProduct.value === 'halykkazyna') {
842
1039
  return true;
843
1040
  }
1041
+ if (whichProduct.value === 'gons' && productConditionsForm.currency.code === 'USD') {
1042
+ return true;
1043
+ }
844
1044
  return false;
845
1045
  });
846
1046
  const hasAdbMultiply = computed(() => {
@@ -877,6 +1077,15 @@ export default defineComponent({
877
1077
  if (whichProduct.value === 'gons') {
878
1078
  return false;
879
1079
  }
1080
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1081
+ return false;
1082
+ }
1083
+ return true;
1084
+ });
1085
+ const hasDisabilityAdditive = computed(() => {
1086
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1087
+ return false;
1088
+ }
880
1089
  return true;
881
1090
  });
882
1091
  const hasAnnuityPayments = computed(() => {
@@ -926,6 +1135,9 @@ export default defineComponent({
926
1135
  if (whichProduct.value === 'halykkazyna') {
927
1136
  return dataStore.t('productConditionsForm.requestedSumInsuredInTenge');
928
1137
  }
1138
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1139
+ return dataStore.t('productConditionsForm.amountRefunded');
1140
+ }
929
1141
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
930
1142
  return dataStore.t('productConditionsForm.totalRequestedSumInsured');
931
1143
  }
@@ -938,11 +1150,50 @@ export default defineComponent({
938
1150
  return dataStore.t('productConditionsForm.coverPeriod');
939
1151
  });
940
1152
  const insurancePremiumPerMonthLabel = computed(() => {
1153
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1154
+ return dataStore.t('productConditionsForm.amountPaid');
1155
+ }
941
1156
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
942
1157
  return dataStore.t('productConditionsForm.totalInsurancePremiumAmountWithCommission');
943
1158
  }
944
1159
  return dataStore.t('productConditionsForm.insurancePremiumAmount');
945
1160
  });
1161
+ const currencySymbolsLabel = computed(() => {
1162
+ if (whichProduct.value === 'gons') {
1163
+ return dataStore.t('productConditionsForm.exchangeRateSettlementDate');
1164
+ }
1165
+ return dataStore.t('productConditionsForm.dollarExchangeRateNBRK');
1166
+ });
1167
+ const lifeMultiplyLabel = computed(() => {
1168
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1169
+ return dataStore.t('percent') + `Life (смерть по любой причине) multiply`;
1170
+ }
1171
+ return dataStore.t('percent') + `Life Multiply`;
1172
+ });
1173
+ const lifeAdditiveLabel = computed(() => {
1174
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1175
+ return dataStore.t('percent') + `Life (смерть по любой причине) надбавка`;
1176
+ }
1177
+ return dataStore.t('percent') + `Life Additive`;
1178
+ });
1179
+ const disabilityMultiplyLabel = computed(() => {
1180
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1181
+ return dataStore.t('percent') + `Disability (инвалидность, временная утрата тр-ти, стойкая утрата тр-ти)`;
1182
+ }
1183
+ return dataStore.t('percent') + `Disability Multiply`;
1184
+ });
1185
+ const adbMultiplyLabel = computed(() => {
1186
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1187
+ return dataStore.t('percent') + `Accidental life multiply`;
1188
+ }
1189
+ return dataStore.t('percent') + `Adb Multiply`;
1190
+ });
1191
+ const adbAdditiveLabel = computed(() => {
1192
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1193
+ return dataStore.t('percent') + `Accidental life additional надбавка`;
1194
+ }
1195
+ return dataStore.t('percent') + `Adb Additive`;
1196
+ });
946
1197
  const isDisabledFixInsSum = computed(() => {
947
1198
  if (dataStore.isUnderwriter() && !isRecalculationDisabled.value) {
948
1199
  return false;
@@ -990,11 +1241,20 @@ export default defineComponent({
990
1241
  return true;
991
1242
  });
992
1243
  const isDisabledAgentCommission = computed(() => {
1244
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1245
+ return true;
1246
+ }
993
1247
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns' || dataStore.isUnderwriter()) {
994
1248
  return false;
995
1249
  }
996
1250
  return isDisabled.value;
997
1251
  });
1252
+ const isDisabledInsStartDate = computed(() => {
1253
+ if (formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1254
+ return true;
1255
+ }
1256
+ return isDisabled.value;
1257
+ });
998
1258
  const hasCalcSum = computed(() => {
999
1259
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1000
1260
  return false;
@@ -1002,7 +1262,7 @@ export default defineComponent({
1002
1262
  return true;
1003
1263
  });
1004
1264
  const hasFixInsSum = computed(() => {
1005
- if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1265
+ if (!formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
1006
1266
  return true;
1007
1267
  }
1008
1268
  return false;
@@ -1037,26 +1297,51 @@ export default defineComponent({
1037
1297
  }
1038
1298
  return false;
1039
1299
  });
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,
1300
+ const hasCurrency = computed(() => {
1301
+ if (whichProduct.value === 'gons') {
1302
+ return true;
1303
+ }
1304
+ return false;
1305
+ });
1306
+ const hasContragentData = computed(() => {
1307
+ if (whichProduct.value === 'pensionannuitynew') {
1308
+ return true;
1309
+ }
1310
+ return false;
1311
+ });
1312
+ const isDisabledPaymentPeriod = computed(() => {
1313
+ if (whichProduct.value === 'gons' && productConditionsForm.currency.code === 'USD') {
1314
+ return true;
1315
+ }
1316
+ return isDisabled.value;
1317
+ });
1318
+ const currencyListFiltered = computed(() => {
1319
+ return constants.currencyList;
1048
1320
  });
1049
1321
 
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,
1322
+ const totalInsPremium = computed(() =>
1323
+ dataStore.getNumberWithSpaces(formatSpacedNumber(formStore.pensionApp?.amount) + formatSpacedNumber(formStore.pensionApp.slave?.amount)),
1058
1324
  );
1059
1325
 
1326
+ const getContragent = async () => {
1327
+ const data = await dataStore.api.getContragentById(
1328
+ Number(route.query.which !== 'slave' ? formStore.applicationData.clientApp.insisId : formStore.applicationData.slave.clientApp.insisId),
1329
+ );
1330
+ if (data && data.items.length != 0) {
1331
+ contragentData.value = data.items[0];
1332
+ contragentData.value.gender = contragentData.value.gender === 1 ? dataStore.t('pension.male') : dataStore.t('pension.female');
1333
+ contragentData.value.birthDate = reformatDate(contragentData.value.birthDate);
1334
+ }
1335
+ };
1336
+
1337
+ const sumContractsAmount = (transferContracts: TransferContract[]) => {
1338
+ if (!transferContracts || !transferContracts.length) return 0;
1339
+ return transferContracts.reduce((accumulator, currentValue) => {
1340
+ const transferAmount = structuredClone(toRaw(currentValue));
1341
+ return accumulator + Number(String(transferAmount.transferContractAmount).replace(/\s/g, ''));
1342
+ }, 0);
1343
+ };
1344
+
1060
1345
  const formatTermValue = (term: number) => {
1061
1346
  if (term !== null) {
1062
1347
  const termNumber = Number(term);
@@ -1068,7 +1353,7 @@ export default defineComponent({
1068
1353
  const toStatement = async () => {
1069
1354
  const statementItem = dataStore.menuItems.find(i => i.id === 'statement');
1070
1355
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1071
- await router.push({ name: 'taskId-NewApp', params: route.params, query: { tab: 'statement' } });
1356
+ await router.push({ name: 'taskId-NewApp', params: route.params, query: { tab: 'statement', add: 'false' } });
1072
1357
  return;
1073
1358
  }
1074
1359
  if (whichProduct.value === 'gons') {
@@ -1099,8 +1384,12 @@ export default defineComponent({
1099
1384
  // @ts-ignore
1100
1385
  calculatorForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
1101
1386
  } else if (whichProduct.value === 'pensionannuitynew') {
1102
- // @ts-ignore
1103
- pensionForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
1387
+ if (currentPanel.value === 'transferContractCompany') {
1388
+ transferContracts.value[contractIndex.value].transferContractCompany = item;
1389
+ } else {
1390
+ // @ts-ignore
1391
+ pensionForm.value[currentPanel.value] = item.nameRu === null ? new Value() : item;
1392
+ }
1104
1393
  } else {
1105
1394
  // @ts-ignore
1106
1395
  productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
@@ -1330,7 +1619,7 @@ export default defineComponent({
1330
1619
  const calculatedPremiumDollar = getNumber(event.target.value as string);
1331
1620
  if (calculatedPremiumDollar) {
1332
1621
  productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(productConditionsForm.insurancePremiumPerMonth);
1333
- if (whichProduct.value === 'halykkazyna') {
1622
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
1334
1623
  if (typeof dataStore.currencies.usd === 'number') {
1335
1624
  productConditionsForm.insurancePremiumPerMonthInDollar = dataStore.getNumberWithSpaces(calculatedPremiumDollar / dataStore.currencies.usd);
1336
1625
  } else {
@@ -1358,7 +1647,7 @@ export default defineComponent({
1358
1647
  const calculatedSumDollar = getNumber(event.target.value as string);
1359
1648
  if (calculatedSumDollar) {
1360
1649
  productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(productConditionsForm.requestedSumInsured);
1361
- if (whichProduct.value === 'halykkazyna') {
1650
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
1362
1651
  if (typeof dataStore.currencies.usd === 'number') {
1363
1652
  productConditionsForm.requestedSumInsuredInDollar = dataStore.getNumberWithSpaces(calculatedSumDollar / dataStore.currencies.usd);
1364
1653
  } else {
@@ -1369,6 +1658,42 @@ export default defineComponent({
1369
1658
  }
1370
1659
  };
1371
1660
 
1661
+ const onInputPension = (event: Event, key: keyof PensionCalculation | 'pensionAmount', index?: number) => {
1662
+ if (event.target && 'value' in event.target && event.target.value) {
1663
+ const calcCheck = getNumber(event.target.value as string);
1664
+ if (calcCheck) {
1665
+ if (index !== undefined) {
1666
+ transferContracts.value[index].transferContractAmount = dataStore.getNumberWithSpaces(event.target.value) as string;
1667
+ transferSum.value = transferContracts.value.reduce((accumulator, { transferContractAmount }) => (accumulator += formatSpacedNumber(transferContractAmount)), 0);
1668
+ } else if (key === 'pensionAmount') {
1669
+ pensionForm.value.amount = dataStore.getNumberWithSpaces(event.target.value) ?? '0';
1670
+ } else {
1671
+ pensionForm.value[key] = dataStore.getNumberWithSpaces(event.target.value);
1672
+ }
1673
+ }
1674
+ } else {
1675
+ if (index !== undefined) {
1676
+ transferContracts.value[index].transferContractAmount = 0;
1677
+ transferSum.value = transferContracts.value.reduce((accumulator, { transferContractAmount }) => (accumulator += formatSpacedNumber(transferContractAmount)), 0);
1678
+ }
1679
+ }
1680
+ if (key !== 'pensionAmount' && !customPension.value) {
1681
+ if (firstAmount.value) {
1682
+ firstAmount.value = false;
1683
+ return;
1684
+ }
1685
+ pensionForm.value.amount =
1686
+ dataStore.getNumberWithSpaces(
1687
+ formatSpacedNumber(pensionForm.value.compulsoryContractAmount) +
1688
+ formatSpacedNumber(pensionForm.value.compulsoryProfContractAmount) +
1689
+ formatSpacedNumber(pensionForm.value.ownFundsRaisAmount) +
1690
+ formatSpacedNumber(pensionForm.value.transferContractAmount) +
1691
+ formatSpacedNumber(pensionForm.value.voluntaryContractAmount) +
1692
+ sumContractsAmount(transferContracts.value),
1693
+ ) ?? '';
1694
+ }
1695
+ };
1696
+
1372
1697
  const onInputFixInsSum = (event: Event) => {
1373
1698
  if (event.target && 'value' in event.target && event.target.value) {
1374
1699
  const calculatedFixInsSum = getNumber(event.target.value as string);
@@ -1393,6 +1718,16 @@ export default defineComponent({
1393
1718
  productConditionsForm.requestedSumInsuredInDollar = null;
1394
1719
  };
1395
1720
 
1721
+ const onClearPension = (key: keyof PensionCalculation | 'pensionAmount', index?: number) => {
1722
+ if (index) {
1723
+ transferContracts.value[index].transferContractAmount = 0;
1724
+ } else if (key === 'pensionAmount') {
1725
+ pensionForm.value.amount = '0';
1726
+ } else {
1727
+ pensionForm.value[key] = null;
1728
+ }
1729
+ };
1730
+
1396
1731
  const onClearSumDollar = () => {
1397
1732
  productConditionsForm.requestedSumInsured = null;
1398
1733
  };
@@ -1424,7 +1759,7 @@ export default defineComponent({
1424
1759
  };
1425
1760
 
1426
1761
  const filterTermConditions = (term: AddCover) => {
1427
- if (term.coverTypeCode === 10) {
1762
+ if (term.coverTypeCode === 10 && !props.isCalculator) {
1428
1763
  return !!formStore.insuredForm.find((member: Member) => member.iin === formStore.policyholderForm.iin) === false;
1429
1764
  }
1430
1765
  return true;
@@ -1437,6 +1772,39 @@ export default defineComponent({
1437
1772
  return term.coverTypeName;
1438
1773
  };
1439
1774
 
1775
+ const addTransferContract = () => {
1776
+ transferContracts.value.push(new TransferContract());
1777
+ };
1778
+
1779
+ const removeTransferContract = (index: number) => {
1780
+ transferContracts.value.splice(index, 1);
1781
+ transferSum.value = transferContracts.value.reduce((accumulator, { transferContractAmount }) => (accumulator += formatSpacedNumber(transferContractAmount)), 0);
1782
+ };
1783
+
1784
+ const prepareTransferContracts = (transferContracts: Array<TransferContract>) => {
1785
+ const formatedContracts: Array<TransferContract> = [];
1786
+ if (transferContracts && transferContracts.length) {
1787
+ transferContracts.forEach(i => {
1788
+ formatedContracts.push({
1789
+ ...i,
1790
+ transferContractDate: constants.regex.isoDate.test(i.transferContractDate) ? i.transferContractDate : formatDate(i.transferContractDate)?.toISOString() ?? '',
1791
+ transferContractFirstPaymentDate: constants.regex.isoDate.test(i.transferContractFirstPaymentDate)
1792
+ ? i.transferContractFirstPaymentDate
1793
+ : formatDate(i.transferContractFirstPaymentDate)?.toISOString() ?? '',
1794
+ // @ts-ignore
1795
+ transferContractCompany:
1796
+ typeof i.transferContractCompany !== 'string' && 'nameRu' in i.transferContractCompany ? String(i.transferContractCompany.nameRu) : i.transferContractCompany,
1797
+ transferContractCompanyId:
1798
+ // @ts-ignore
1799
+ typeof i.transferContractCompany !== 'string' && 'ids' in i.transferContractCompany ? i.transferContractCompany.ids : i.transferContractCompanyId,
1800
+ id: i.id ?? null,
1801
+ transferContractAmount: String(i.transferContractAmount).replace(/\s/g, ''),
1802
+ });
1803
+ });
1804
+ }
1805
+ return formatedContracts;
1806
+ };
1807
+
1440
1808
  const submitForm = async () => {
1441
1809
  vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
1442
1810
  if (v.valid) {
@@ -1444,9 +1812,12 @@ export default defineComponent({
1444
1812
  if (calculatorForm.type.code === 'Single' && calculatorForm.startDate && calculatorForm.endDate) {
1445
1813
  const formattedStartDate = formatDate(calculatorForm.startDate);
1446
1814
  const formattedEndDate = formatDate(calculatorForm.endDate);
1447
- if (formattedStartDate && formattedEndDate && formattedStartDate.getTime() > formattedEndDate.getTime()) {
1815
+ if (formattedStartDate && formattedEndDate && formattedStartDate.getTime() >= formattedEndDate.getTime()) {
1448
1816
  return dataStore.showToaster('error', dataStore.t('toaster.startMoreEnd'));
1449
1817
  }
1818
+ if (calculatorForm.days !== productConditionsForm.getSingleTripDays()) {
1819
+ return dataStore.showToaster('error', dataStore.t('toaster.daysPickAgain'));
1820
+ }
1450
1821
  }
1451
1822
  if (dataStore.isTask()) {
1452
1823
  await dataStore.calculatePrice(route.params.taskId as string);
@@ -1454,41 +1825,113 @@ export default defineComponent({
1454
1825
  await dataStore.calculatePrice();
1455
1826
  }
1456
1827
  } 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;
1828
+ if (contractDate.value && maxDate.value && formatDate(contractDate.value) && formatDate(maxDate.value)) {
1829
+ const invalidDate = (formatDate(contractDate.value) ?? new Date()) > (formatDate(maxDate.value) ?? new Date());
1830
+ if (invalidDate) {
1831
+ dataStore.showToaster('error', 'Дата заключения договора некорректна');
1832
+ return;
1833
+ }
1834
+ }
1835
+ if (transferContracts.value && transferContracts.value.length) {
1836
+ transferContracts.value.forEach(i => {
1837
+ if (formatDate(i.transferContractDate) != null && formatDate(transferMaxDate.value)) {
1838
+ const invalidDate = (formatDate(i.transferContractDate) ?? new Date()) > (formatDate(transferMaxDate.value) ?? new Date());
1839
+ if (invalidDate) {
1840
+ dataStore.showToaster('error', 'Дата заключения договора КСЖ некорректна');
1841
+ return;
1842
+ }
1843
+ }
1844
+ });
1466
1845
  }
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,
1846
+ if (!pensionForm.value.compulsoryProfContractAmount) pensionForm.value.compulsoryProfMonthCount = null;
1847
+ const pensionData = {
1848
+ ...pensionForm.value,
1849
+ ...{
1850
+ compulsoryContractAmount: formatSpacedNumber(pensionForm.value.compulsoryContractAmount),
1851
+ voluntaryContractAmount: formatSpacedNumber(pensionForm.value.voluntaryContractAmount),
1852
+ ownFundsRaisAmount: formatSpacedNumber(pensionForm.value.ownFundsRaisAmount),
1853
+ compulsoryProfContractAmount: formatSpacedNumber(pensionForm.value.compulsoryProfContractAmount),
1854
+ transferContractAmount: formatSpacedNumber(pensionForm.value.transferContractAmount),
1855
+ transferContractCompany: pensionForm.value?.transferContractCompany?.nameRu ?? '',
1856
+ },
1857
+ amount: formatSpacedNumber(pensionForm.value.amount),
1858
+ contractDate: formatDate(contractDate.value ?? ''),
1480
1859
  };
1481
- await dataStore.setApplication(data, true);
1860
+ const data = isSlavePensionForm.value
1861
+ ? {
1862
+ ...formStore.pensionApp,
1863
+ transferContracts: prepareTransferContracts(formStore.pensionApp.transferContracts),
1864
+ slave: pensionData,
1865
+ amount: formatSpacedNumber(formStore.pensionApp?.amount),
1866
+ compulsoryContractAmount: formatSpacedNumber(formStore.pensionApp?.compulsoryContractAmount),
1867
+ voluntaryContractAmount: formatSpacedNumber(formStore.pensionApp?.voluntaryContractAmount),
1868
+ ownFundsRaisAmount: formatSpacedNumber(formStore.pensionApp?.ownFundsRaisAmount),
1869
+ compulsoryProfContractAmount: formatSpacedNumber(formStore.pensionApp?.compulsoryProfContractAmount),
1870
+ transferContractAmount: formatSpacedNumber(formStore.pensionApp?.transferContractAmount),
1871
+ transferContractCompany: pensionForm.value?.transferContractCompany?.nameRu ?? '',
1872
+ }
1873
+ : {
1874
+ ...pensionData,
1875
+ transferContracts: prepareTransferContracts(transferContracts.value),
1876
+ slave: !!formStore.pensionApp?.slave
1877
+ ? {
1878
+ ...formStore.pensionApp?.slave,
1879
+ contractDate: pensionData.contractDate,
1880
+ amount: formatSpacedNumber(formStore.pensionApp?.slave?.amount),
1881
+ compulsoryContractAmount: formatSpacedNumber(formStore.pensionApp?.slave?.compulsoryContractAmount),
1882
+ voluntaryContractAmount: formatSpacedNumber(formStore.pensionApp?.slave?.voluntaryContractAmount),
1883
+ ownFundsRaisAmount: formatSpacedNumber(formStore.pensionApp?.slave?.ownFundsRaisAmount),
1884
+ compulsoryProfContractAmount: formatSpacedNumber(formStore.pensionApp?.slave?.compulsoryProfContractAmount),
1885
+ transferContractAmount: formatSpacedNumber(formStore.pensionApp?.slave?.transferContractAmount),
1886
+ transferContractCompany: pensionForm.value?.transferContractCompany?.nameRu ?? '',
1887
+ }
1888
+ : null,
1889
+ };
1890
+ if (!!data.slave) {
1891
+ data.slave.transferContracts = prepareTransferContracts(isSlavePensionForm.value ? transferContracts.value : data.slave.transferContracts);
1892
+ const difference = Math.abs(
1893
+ formatSpacedNumber(formStore.pensionApp?.amount) + formatSpacedNumber(formStore.pensionApp?.slave?.amount) - formatSpacedNumber(pensionForm.value.amount),
1894
+ );
1895
+ if (customPension.value) {
1896
+ isSlavePensionForm.value ? (data.slave.amount = formatSpacedNumber(pensionForm.value.amount)) : (data.amount = formatSpacedNumber(pensionForm.value.amount));
1897
+ const customSum = sumPensionData(data) + sumPensionData(data.slave);
1898
+ if (formatSpacedNumber(totalInsPremium.value) !== customSum) {
1899
+ return dataStore.showToaster('error', 'Cтраховая премия не соответсвует общей страховой премии');
1900
+ }
1901
+ if (!isSlavePensionForm.value) {
1902
+ data.slave.amount = difference;
1903
+ } else {
1904
+ data.amount = difference;
1905
+ }
1906
+ } else {
1907
+ const amount = isSlavePensionForm.value ? data.slave.amount : data.amount;
1908
+ if (formatSpacedNumber(pensionForm.value.amount) != amount) {
1909
+ data.slave.amount = sumPensionData(data.slave);
1910
+ data.amount = sumPensionData(data);
1911
+ }
1912
+ }
1913
+ const isParentValid = validatePensionForm(data, 'Заполните условия первого страхователя');
1914
+ const isSlaveValid = validatePensionForm(data.slave, 'Заполните условия второго страхователя');
1915
+ if (!isParentValid || !isSlaveValid) {
1916
+ return;
1917
+ }
1918
+ await dataStore.setApplication(data, true);
1919
+ customPension.value = false;
1920
+ } else {
1921
+ await dataStore.setApplication(data, true);
1922
+ }
1923
+ await dataStore.getApplicationData(String(route.params.taskId), false, false, false, true);
1924
+ dateOfBegin.value = reformatDate(formStore.applicationData.pensionApp.dateOfBegin);
1482
1925
  } else {
1483
1926
  if (whichSum.value === 'requestedSumInsured') {
1484
1927
  productConditionsForm.insurancePremiumPerMonth = null;
1485
- if (whichProduct.value === 'halykkazyna') {
1928
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
1486
1929
  productConditionsForm.insurancePremiumPerMonthInDollar = null;
1487
1930
  }
1488
1931
  }
1489
1932
  if (whichSum.value === 'insurancePremiumPerMonth') {
1490
1933
  productConditionsForm.requestedSumInsured = null;
1491
- if (whichProduct.value === 'halykkazyna') {
1934
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
1492
1935
  productConditionsForm.requestedSumInsuredInDollar = null;
1493
1936
  }
1494
1937
  }
@@ -1554,7 +1997,9 @@ export default defineComponent({
1554
1997
  recalculationData.riskGroup = productConditionsForm.riskGroup?.id ? productConditionsForm.riskGroup.id : 1;
1555
1998
  isCalculating.value = true;
1556
1999
  if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
1557
- await dataStore.calculate(route.params.taskId as string);
2000
+ const setApplicationData = dataStore.getConditionsData();
2001
+ const hasSetApplication = await dataStore.setApplication(setApplicationData);
2002
+ if (hasSetApplication) await dataStore.calculate(route.params.taskId as string);
1558
2003
  additionalTerms.value = formStore.additionalInsuranceTerms;
1559
2004
  } else {
1560
2005
  await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId as string, whichSum.value);
@@ -1573,7 +2018,6 @@ export default defineComponent({
1573
2018
  }
1574
2019
  }
1575
2020
  }
1576
-
1577
2021
  isCalculating.value = false;
1578
2022
  } else {
1579
2023
  const errors = document.querySelector('.v-input--error');
@@ -1597,75 +2041,127 @@ export default defineComponent({
1597
2041
  });
1598
2042
  };
1599
2043
 
2044
+ const validatePensionForm = (data: any, text: string) => {
2045
+ if (!data.amount || !data.guaranteedPeriod) {
2046
+ dataStore.showToaster('error', text);
2047
+ return false;
2048
+ }
2049
+ return true;
2050
+ };
2051
+
2052
+ const sumPensionData = (data: any) => {
2053
+ return (
2054
+ formatSpacedNumber(data.ownFundsRaisAmount) +
2055
+ formatSpacedNumber(data.voluntaryContractAmount) +
2056
+ formatSpacedNumber(data.compulsoryContractAmount) +
2057
+ formatSpacedNumber(data.compulsoryProfContractAmount) +
2058
+ sumContractsAmount(data.transferContracts)
2059
+ );
2060
+ };
2061
+
1600
2062
  onMounted(async () => {
1601
- if (props.isCalculator === true) {
2063
+ try {
2064
+ if (hasContragentData.value) await getContragent();
2065
+ if (props.isCalculator === true) {
2066
+ isLoading.value = true;
2067
+ if (dataStore.isCalculator) {
2068
+ clearFields();
2069
+ }
2070
+ if (whichProduct.value === 'gons') {
2071
+ formStore.isDisabled.productConditionsForm = false;
2072
+ dataStore.setFormsDisabled(false);
2073
+ }
2074
+ if (whichProduct.value !== 'lifetrip' && whichProduct.value !== 'pensionannuitynew') {
2075
+ if (
2076
+ (dataStore.isCalculator || route.params.taskId === '0' || fromIndexPage.value) &&
2077
+ productConditionsForm.requestedSumInsured === null &&
2078
+ productConditionsForm.insurancePremiumPerMonth === null
2079
+ ) {
2080
+ // @ts-ignore
2081
+ const defaultData = await dataStore.getDefaultCalculationData(true, whichProduct.value);
2082
+ if (!defaultData) {
2083
+ dataStore.showToaster('error', 'Отсутствуют базовые данные');
2084
+ return;
2085
+ }
2086
+ formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
2087
+ productConditionsForm.requestedSumInsured = defaultData.amount;
2088
+ productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
2089
+ const indexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
2090
+ if (indexRate) productConditionsForm.processIndexRate = indexRate;
2091
+ const paymendPeriod = dataStore.processPaymentPeriod.find(i => i.id === defaultData.paymentPeriodId);
2092
+ if (paymendPeriod) productConditionsForm.paymentPeriod = paymendPeriod;
2093
+ if (defaultData.signDate) {
2094
+ productConditionsForm.signDate = reformatDate(defaultData.signDate);
2095
+ }
2096
+ if (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') {
2097
+ productConditionsForm.coverPeriod = defaultData.insTermInMonth ?? null;
2098
+ productConditionsForm.insurancePremiumPerMonth = null;
2099
+ }
2100
+ }
2101
+ }
2102
+ }
2103
+ additionalTerms.value = props.isCalculator ? formStore.additionalInsuranceTermsWithout : formStore.additionalInsuranceTerms;
2104
+ if (!!productConditionsForm.insurancePremiumPerMonth) {
2105
+ whichSum.value = 'insurancePremiumPerMonth';
2106
+ }
2107
+ if (!!productConditionsForm.requestedSumInsured) {
2108
+ whichSum.value = 'requestedSumInsured';
2109
+ }
2110
+ if ((whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns') && !productConditionsForm.requestedSumInsured) {
2111
+ whichSum.value = 'requestedSumInsured';
2112
+ }
1602
2113
  if (dataStore.isCalculator) {
1603
- clearFields();
2114
+ dataStore.processCode = constants.products[whichProduct.value as keyof typeof constants.products];
2115
+ await dataStore.getProcessPaymentPeriod();
1604
2116
  }
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
- }
2117
+ if (whichProduct.value === 'halykkazyna' || whichProduct.value === 'gons') {
2118
+ await dataStore.getCurrencies();
2119
+ }
2120
+ if (whichProduct.value === 'halykkazyna') {
2121
+ const kazynaPaymentPeriod = dataStore.processPaymentPeriod.find(i => i.code === 'single');
2122
+ if (kazynaPaymentPeriod) productConditionsForm.paymentPeriod = kazynaPaymentPeriod;
2123
+ }
2124
+ if (!formStore.lfb.add && (whichProduct.value === 'lifebusiness' || whichProduct.value === 'gns')) {
2125
+ productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(
2126
+ formStore.lfb.clients.reduce((sum: number, i: any) => {
2127
+ return sum + Number(i.insSum);
2128
+ }, 0),
2129
+ );
2130
+ }
2131
+ if (whichProduct.value === 'pensionannuitynew') {
2132
+ contractDate.value = reformatDate(pensionForm.value.contractDate ?? '');
2133
+ dateOfBegin.value = reformatDate(pensionForm.value.dateOfBegin);
2134
+ transferContractDate.value = reformatDate(pensionForm.value.transferContractDate);
2135
+ transferContractFirstPaymentDate.value = reformatDate(pensionForm.value.transferContractFirstPaymentDate ?? '');
2136
+ maxDate.value = await dataStore.getVariableData(formStore.applicationData.processCode ?? 19);
2137
+ if (!transferContracts.value.length && pensionForm.value.transferContracts && pensionForm.value.transferContracts.length) {
2138
+ pensionForm.value.transferContracts.forEach((contract: TransferContract) => {
2139
+ transferContracts.value.push({
2140
+ ...contract,
2141
+ transferContractDate: constants.regex.isoDate.test(contract.transferContractDate) ? reformatDate(contract.transferContractDate)! : contract.transferContractDate,
2142
+ transferContractFirstPaymentDate: constants.regex.isoDate.test(contract.transferContractFirstPaymentDate)
2143
+ ? reformatDate(contract.transferContractFirstPaymentDate)!
2144
+ : contract.transferContractFirstPaymentDate,
2145
+ transferContractCompany:
2146
+ typeof contract.transferContractCompany === 'string' ? ({ nameRu: contract.transferContractCompany } as any) : contract.transferContractCompany,
2147
+ transferContractAmount: dataStore.getNumberWithSpaces(contract.transferContractAmount) ?? '',
2148
+ });
2149
+ });
1631
2150
  }
1632
2151
  }
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);
2152
+ } catch (err) {
2153
+ console.log(err);
2154
+ } finally {
2155
+ isLoading.value = false;
1666
2156
  }
1667
2157
  });
1668
2158
 
2159
+ watch(
2160
+ () => pensionForm.value?.amount,
2161
+ val => {
2162
+ if (val) pensionForm.value.amount = dataStore.getNumberWithSpaces(val);
2163
+ },
2164
+ );
1669
2165
  watch(
1670
2166
  () => productConditionsForm.amountOfInsurancePremium,
1671
2167
  val => {
@@ -1696,6 +2192,23 @@ export default defineComponent({
1696
2192
  { immediate: true },
1697
2193
  );
1698
2194
 
2195
+ if (hasCurrency.value) {
2196
+ watch(
2197
+ () => productConditionsForm.currency,
2198
+ async val => {
2199
+ if (val.code === 'USD') {
2200
+ if (!dataStore.processPaymentPeriod.length) {
2201
+ await dataStore.getProcessPaymentPeriod();
2202
+ }
2203
+ const paymentPeriod = dataStore.processPaymentPeriod.find(item => item.nameRu === 'единовременно');
2204
+ if (paymentPeriod) {
2205
+ productConditionsForm.paymentPeriod = paymentPeriod;
2206
+ }
2207
+ }
2208
+ },
2209
+ );
2210
+ }
2211
+
1699
2212
  if (hasInsStartDate.value) {
1700
2213
  watch(
1701
2214
  () => productConditionsForm.calcDate,
@@ -1729,6 +2242,8 @@ export default defineComponent({
1729
2242
  async val => {
1730
2243
  if (val?.length && val.every(option => option.id != 0) && calculatorForm.type?.nameRu != null) {
1731
2244
  await dataStore.getTripInsuredAmount();
2245
+ } else {
2246
+ calculatorForm.amount = new Value();
1732
2247
  }
1733
2248
  },
1734
2249
  { deep: true },
@@ -1762,8 +2277,41 @@ export default defineComponent({
1762
2277
  );
1763
2278
  }
1764
2279
 
2280
+ if (whichProduct.value === 'pensionannuitynew') {
2281
+ watch(
2282
+ () => pensionForm.value.guaranteedPeriod,
2283
+ async () => {
2284
+ if (formStore.applicationData.processCode === 24) {
2285
+ await dataStore.reCalculateRefund(
2286
+ Number(pensionForm.value.parentContractAmount),
2287
+ Number(pensionForm.value.parentContractMainAmount),
2288
+ pensionForm.value.guaranteedPeriod,
2289
+ pensionForm.value.transferContractIsOppv,
2290
+ pensionForm.value.compulsoryProfMonthCount ?? 0,
2291
+ );
2292
+ }
2293
+ },
2294
+ );
2295
+ watch(
2296
+ () => contractDate.value,
2297
+ (val, oldVal) => {
2298
+ if (val !== null && val !== undefined && val.length === 10 && oldVal != undefined && !isSlavePensionForm.value) {
2299
+ const formattedContractDate = formatDate(val);
2300
+ if (formattedContractDate) {
2301
+ const transferMax = formattedContractDate;
2302
+ transferMax.setFullYear(transferMax.getFullYear() - 2);
2303
+ transferMax.setDate(transferMax.getDate() + 1);
2304
+ transferMaxDate.value = reformatDate(String(transferMax));
2305
+ formattedContractDate.setDate(formattedContractDate.getDate() + 20);
2306
+ dateOfBegin.value = reformatDate(String(formattedContractDate));
2307
+ }
2308
+ }
2309
+ },
2310
+ );
2311
+ }
2312
+
1765
2313
  const copyRedirect = async () => {
1766
- const url = await dataStore.api.getEnpfRedirectUrl(String(formStore.applicationData.processInstanceId));
2314
+ const url = await dataStore.api.pensionannuityNew.getEnpfRedirectUrl(String(pensionForm.value.processInstanceId));
1767
2315
  dataStore.copyToClipboard(url.redirectUrl);
1768
2316
  };
1769
2317
 
@@ -1771,6 +2319,7 @@ export default defineComponent({
1771
2319
  // State
1772
2320
  formStore,
1773
2321
  vForm,
2322
+ isLoading,
1774
2323
  whichProduct,
1775
2324
  productConditionsForm,
1776
2325
  additionalTerms,
@@ -1792,20 +2341,33 @@ export default defineComponent({
1792
2341
  subTermValue,
1793
2342
  panelCodeList,
1794
2343
  pensionForm,
2344
+ insuredForm,
1795
2345
  dateOfBegin,
1796
2346
  contractDate,
1797
2347
  transferContractDate,
1798
2348
  transferContractFirstPaymentDate,
1799
2349
  enabled,
1800
2350
  maxDate,
2351
+ transferMaxDate,
1801
2352
  guaranteedPeriodList,
1802
2353
  isEnpfSum,
2354
+ transferContracts,
2355
+ contractsValue,
2356
+ contractIndex,
2357
+ contragentData,
2358
+ customPension,
1803
2359
 
1804
2360
  // Computed
1805
2361
  isTask,
1806
2362
  isDisabled,
2363
+ disabilityGroup,
2364
+ totalInsPremium,
1807
2365
  isTermsDisabled,
1808
2366
  isUnderwriterForm,
2367
+ hasCurrencySymbols,
2368
+ currencyListFiltered,
2369
+ currencySymbolsLabel,
2370
+ isDisabledPaymentPeriod,
1809
2371
  insurancePremiumPerMonthRule,
1810
2372
  insurancePremiumPerMonthDisabled,
1811
2373
  requestedSumInsuredRule,
@@ -1816,6 +2378,7 @@ export default defineComponent({
1816
2378
  hasRequestedSumInsuredInDollar,
1817
2379
  hasInsurancePremiumPerMonthInDollar,
1818
2380
  hasCurrency,
2381
+ hasContragentData,
1819
2382
  hasAdbMultiply,
1820
2383
  readonlyLifeAdditive,
1821
2384
  readonlyDisabilityMultiply,
@@ -1825,6 +2388,7 @@ export default defineComponent({
1825
2388
  hasCalculated,
1826
2389
  hasAnnuityPayments,
1827
2390
  hasAgencyPart,
2391
+ hasDisabilityAdditive,
1828
2392
  currencySymbolsAddTerm,
1829
2393
  amountAnnuityPayments,
1830
2394
  requestedSumInsuredLabel,
@@ -1834,23 +2398,28 @@ export default defineComponent({
1834
2398
  hasBirthDate,
1835
2399
  hasGender,
1836
2400
  coverPeriodLabel,
2401
+ lifeMultiplyLabel,
2402
+ lifeAdditiveLabel,
2403
+ disabilityMultiplyLabel,
2404
+ adbMultiplyLabel,
2405
+ adbAdditiveLabel,
1837
2406
  insurancePremiumPerMonthLabel,
1838
2407
  isDisabledCoverPeriod,
1839
2408
  hasDefault,
1840
2409
  isShownAdditionalTerms,
1841
2410
  hasCalcSum,
2411
+ isDisabledInsStartDate,
1842
2412
  isDisabledAgentCommission,
1843
2413
  hasFixInsSum,
1844
2414
  isDisabledFixInsSum,
1845
2415
  defaultText,
1846
2416
  hasDeathInsFromNS,
1847
- pensionAmount,
1848
- pensionCalculationParams,
1849
2417
  hasDeathInsAnyReason,
1850
2418
  fromIndexPage,
1851
2419
  hasCoverPeriod,
1852
2420
  hasInsStartDate,
1853
2421
  hasInsEndDate,
2422
+ isSlavePensionForm,
1854
2423
 
1855
2424
  // Rules
1856
2425
  coverPeriodRule,
@@ -1868,9 +2437,11 @@ export default defineComponent({
1868
2437
  onInputInsurancePremiumPerMonth,
1869
2438
  onInputInsurancePremiumPerMonthInDollar,
1870
2439
  onInputSum,
2440
+ onInputPension,
1871
2441
  onInputSumDollar,
1872
2442
  toStatement,
1873
2443
  onClearSum,
2444
+ onClearPension,
1874
2445
  onClearSumDollar,
1875
2446
  onClearPremium,
1876
2447
  onClearPremiumDollar,
@@ -1882,6 +2453,9 @@ export default defineComponent({
1882
2453
  pickSubTermValue,
1883
2454
  onInputFixInsSum,
1884
2455
  copyRedirect,
2456
+ getContragent,
2457
+ addTransferContract,
2458
+ removeTransferContract,
1885
2459
  };
1886
2460
  },
1887
2461
  });