hl-core 0.0.8-beta.21 → 0.0.8-beta.23

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.
package/api/index.ts CHANGED
@@ -13,7 +13,10 @@ export class ApiClass {
13
13
 
14
14
  private async axiosCall<T>(config: AxiosRequestConfig): Promise<T> {
15
15
  const dataStore = useDataStore();
16
- if ((dataStore.isBridge && !this.baseURL) || (!dataStore.isEFO && !dataStore.isAML && !dataStore.isLKA && (!this.baseURL || !this.productUrl))) {
16
+ if (dataStore.isBridge && !this.baseURL) {
17
+ console.error('No Axios baseURL');
18
+ }
19
+ if (!dataStore.isBridge && !dataStore.isCalculator && (!this.baseURL || !this.productUrl)) {
17
20
  console.error('No Axios baseURL or productURL');
18
21
  }
19
22
  const { data } = await useAxios(this.baseURL).request<T>(config);
@@ -137,6 +140,13 @@ export class ApiClass {
137
140
  });
138
141
  }
139
142
 
143
+ async getDicAnnuityTypeList(): Promise<Value[]> {
144
+ return this.axiosCall({
145
+ method: Methods.GET,
146
+ url: '/Arm/api/Dictionary/GetDictionaryItems/DicAnnuityType',
147
+ });
148
+ }
149
+
140
150
  async getCurrencies(): Promise<{ eur: number; usd: number }> {
141
151
  return this.axiosCall({
142
152
  method: Methods.GET,
@@ -208,6 +218,13 @@ export class ApiClass {
208
218
  });
209
219
  }
210
220
 
221
+ async getProcessAnnuityPaymentPeriod(processCode: string | number) {
222
+ return this.axiosCall({
223
+ method: Methods.GET,
224
+ url: `/Arm/api/Dictionary/ProcessAnnuityPaymentPeriod/${processCode}`,
225
+ });
226
+ }
227
+
211
228
  async getContragentById(id: any) {
212
229
  return this.axiosCall({
213
230
  method: Methods.GET,
@@ -455,18 +472,18 @@ export class ApiClass {
455
472
  });
456
473
  }
457
474
 
458
- async calculateWithoutApplication(data: RecalculationDataType): Promise<RecalculationResponseType> {
475
+ async calculateWithoutApplication(data: RecalculationDataType, product = this.productUrl): Promise<RecalculationResponseType> {
459
476
  return this.axiosCall({
460
477
  method: Methods.POST,
461
- url: `/${this.productUrl}/api/Application/Calculate`,
478
+ url: `/${product}/api/Application/Calculate`,
462
479
  data: data,
463
480
  });
464
481
  }
465
482
 
466
- async getDefaultCalculationData(): Promise<RecalculationDataType> {
483
+ async getDefaultCalculationData(product = this.productUrl): Promise<RecalculationDataType> {
467
484
  return this.axiosCall({
468
485
  method: Methods.GET,
469
- url: `/${this.productUrl}/api/Application/DefaultCalculatorValues`,
486
+ url: `/${product}/api/Application/DefaultCalculatorValues`,
470
487
  });
471
488
  }
472
489
 
@@ -4,7 +4,9 @@ export default function (axios: AxiosInstance) {
4
4
  axios.interceptors.request.use(
5
5
  request => {
6
6
  const dataStore = useDataStore();
7
- request.headers.Authorization = `Bearer ${dataStore.accessToken}`;
7
+ if (dataStore.accessToken) {
8
+ request.headers.Authorization = `Bearer ${dataStore.accessToken}`;
9
+ }
8
10
  return request;
9
11
  },
10
12
  error => {
@@ -17,19 +19,21 @@ export default function (axios: AxiosInstance) {
17
19
  },
18
20
  error => {
19
21
  const dataStore = useDataStore();
20
- const router = useRouter();
21
- if (error.response.status === 401) {
22
- dataStore.$reset();
23
- localStorage.clear();
24
- if (dataStore.isBridge) {
25
- router.push({ name: 'Auth', query: { error: 401 } });
26
- } else {
27
- dataStore.sendToParent(constants.postActions.Error401, 401);
22
+ if (!dataStore.isCalculator) {
23
+ const router = useRouter();
24
+ if (error.response.status === 401) {
25
+ dataStore.$reset();
26
+ localStorage.clear();
27
+ if (dataStore.isBridge) {
28
+ router.push({ name: 'Auth', query: { error: 401 } });
29
+ } else {
30
+ dataStore.sendToParent(constants.postActions.Error401, 401);
31
+ }
28
32
  }
29
- }
30
- if (error.response.status >= 500) {
31
- if (router.currentRoute.value.name !== 'Auth') {
32
- dataStore.showToaster('error', error.stack, 5000);
33
+ if (error.response.status >= 500) {
34
+ if (router.currentRoute.value.name !== 'Auth') {
35
+ dataStore.showToaster('error', error.stack, 5000);
36
+ }
33
37
  }
34
38
  }
35
39
  return Promise.reject(error);
@@ -74,7 +74,7 @@
74
74
  <v-btn
75
75
  v-if="secondQuestionList && secondQuestionList.length && firstPanel"
76
76
  icon="mdi mdi-close"
77
- class="ml-3 !absolute"
77
+ class="ml-3 !absolute z-10"
78
78
  @click="
79
79
  firstPanel = false;
80
80
  secondPanel = false;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <section class="flex flex-col gap-4 px-[10px]">
3
3
  <v-form ref="vForm" @submit="submitForm" class="max-h-[82svh] overflow-y-scroll">
4
- <base-form-section v-if="$dataStore.isGons" :title="$t('productConditionsForm.requestedProductConditions')" :class="[$libStyles.textSimple]">
4
+ <base-form-section v-if="whichProduct === 'gons'" :title="$t('productConditionsForm.requestedProductConditions')" :class="[$libStyles.textSimple]">
5
5
  <base-form-text-section
6
6
  class="mb-4"
7
7
  title="Инвалидность I или II группы по причине несчастного случая, начиная с третьего года по любой причине, с освобождением от уплаты страховых взносов"
@@ -87,7 +87,7 @@
87
87
  ></base-panel-input>
88
88
  </base-form-section>
89
89
  <base-form-section :title="$t('generalConditions')">
90
- <div v-if="isRecalculation && $route.params.taskId === '0'">
90
+ <div v-if="isRecalculation && ($route.params.taskId === '0' || $dataStore.isCalculator)">
91
91
  <base-form-input
92
92
  v-model="productConditionsForm.signDate"
93
93
  :maska="$maska.date"
@@ -122,7 +122,7 @@
122
122
  :readonly="isDisabled"
123
123
  :clearable="!isDisabled"
124
124
  :rules="coverPeriodRule"
125
- :label="$t($dataStore.isGons ? 'productConditionsForm.coverPeriodFrom3to20' : 'productConditionsForm.coverPeriod')"
125
+ :label="$t(whichProduct === 'gons' ? 'productConditionsForm.coverPeriodFrom3to20' : 'productConditionsForm.coverPeriod')"
126
126
  ></base-form-input>
127
127
  <base-panel-input
128
128
  v-if="hasPaymentPeriod"
@@ -192,6 +192,58 @@
192
192
  :suffix="$constants.currencySymbols.kzt"
193
193
  ></base-form-input>
194
194
  </base-form-section>
195
+ <base-form-section :title="$t('calculationAnnuityPayments')" v-if="hasAnnuityPayments">
196
+ <base-form-toggle
197
+ v-model="productConditionsForm.additionalConditionAnnuityPayments"
198
+ :title="$t('productConditionsForm.guaranteedTermAnnuityPayments')"
199
+ :disabled="isDisabled"
200
+ :has-border="false"
201
+ @clicked="handleToggler"
202
+ ></base-form-toggle>
203
+ <base-form-input
204
+ v-if="productConditionsForm.additionalConditionAnnuityPayments"
205
+ v-model="productConditionsForm.guaranteedPeriod"
206
+ :readonly="isDisabled"
207
+ :clearable="!isDisabled"
208
+ :rules="productConditionsForm.termAnnuityPayments ? [$dataStore.rules.guaranteedPeriodLimit(productConditionsForm.guaranteedPeriod, productConditionsForm.termAnnuityPayments)] : []"
209
+ :label="$t('productConditionsForm.guaranteedPeriod')"
210
+ ></base-form-input>
211
+ <base-panel-input
212
+ v-model="productConditionsForm.typeAnnuityInsurance"
213
+ :value="productConditionsForm.typeAnnuityInsurance.nameRu"
214
+ :readonly="isDisabled"
215
+ :clearable="!isDisabled"
216
+ :rules="$rules.objectRequired"
217
+ :label="$t('productConditionsForm.typeAnnuityInsurance')"
218
+ append-inner-icon="mdi mdi-chevron-right"
219
+ @append="openPanel($t('productConditionsForm.typeAnnuityInsurance'), $dataStore.dicAnnuityTypeList, 'typeAnnuityInsurance', $dataStore.getDicAnnuityTypeList)"
220
+ ></base-panel-input>
221
+ <base-form-input
222
+ v-if="productConditionsForm.typeAnnuityInsurance.code !== 'Lifelong'"
223
+ v-model="productConditionsForm.termAnnuityPayments"
224
+ :readonly="isDisabled"
225
+ :clearable="!isDisabled"
226
+ :rules="$dataStore.rules.required.concat($dataStore.rules.numbers)"
227
+ :label="$t('productConditionsForm.termAnnuityPayments')"
228
+ ></base-form-input>
229
+ <base-panel-input
230
+ v-model="productConditionsForm.periodAnnuityPayment"
231
+ :value="productConditionsForm.periodAnnuityPayment.nameRu"
232
+ :readonly="isDisabled"
233
+ :clearable="!isDisabled"
234
+ :rules="$rules.objectRequired"
235
+ :label="$t('productConditionsForm.periodAnnuityPayment')"
236
+ append-inner-icon="mdi mdi-chevron-right"
237
+ @append="openPanel($t('productConditionsForm.processPaymentPeriod'), $dataStore.processAnnuityPaymentPeriod, 'periodAnnuityPayment', $dataStore.getProcessAnnuityPaymentPeriod)"
238
+ ></base-panel-input>
239
+ <base-form-input
240
+ v-model="productConditionsForm.amountAnnuityPayments"
241
+ :readonly="isDisabled"
242
+ :clearable="!isDisabled"
243
+ :rules="amountAnnuityPayments"
244
+ :label="$t('productConditionsForm.amountAnnuityPayments')"
245
+ ></base-form-input>
246
+ </base-form-section>
195
247
  <base-form-section v-if="additionalTerms && additionalTerms.length" :title="$t('productConditionsForm.additional')">
196
248
  <div v-for="(term, index) of additionalTerms" :key="index">
197
249
  <base-panel-input
@@ -207,9 +259,9 @@
207
259
  </div>
208
260
  </base-form-section>
209
261
  </v-form>
210
- <base-btn v-if="isRecalculation && hasCalculated" :btn="$libStyles.greenLightBtn" :text="$t('buttons.toStatement')" @click="toStatement"></base-btn>
262
+ <base-btn v-if="!$dataStore.isCalculator && isRecalculation && hasCalculated" :btn="$libStyles.greenLightBtn" :text="$t('buttons.toStatement')" @click="toStatement"></base-btn>
211
263
  <base-btn
212
- v-if="!isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
264
+ v-if="$dataStore.isCalculator ? true : !isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
213
265
  :loading="isCalculating"
214
266
  :text="$t('buttons.calculate')"
215
267
  @click="submitForm"
@@ -261,6 +313,10 @@ export default defineComponent({
261
313
  type: Boolean,
262
314
  default: false,
263
315
  },
316
+ product: {
317
+ type: String,
318
+ default: false,
319
+ },
264
320
  },
265
321
  setup(props) {
266
322
  const vForm = ref<any>();
@@ -270,6 +326,7 @@ export default defineComponent({
270
326
  const dataStore = useDataStore();
271
327
  const memberStore = useMemberStore();
272
328
 
329
+ const whichProduct = ref<string>(dataStore.isCalculator ? props.product : dataStore.product!);
273
330
  const isCalculating = ref<boolean>(false);
274
331
  const isPanelLoading = ref<boolean>(false);
275
332
  const isPanelOpen = ref<boolean>(false);
@@ -291,73 +348,80 @@ export default defineComponent({
291
348
  return formStore.applicationData.statusCode === 'UnderwriterForm';
292
349
  }
293
350
  });
294
- const isDisabled = computed(() => !memberStore.isStatementEditible(formStore.productConditionsFormKey));
351
+ const isDisabled = computed(() => (dataStore.isCalculator ? false : !memberStore.isStatementEditible(formStore.productConditionsFormKey)));
295
352
  const isTask = computed(() => (route.params.taskId === '0' && props.isRecalculation === true) || dataStore.isTask());
296
353
  const isRecalculationDisabled = computed(() => formStore.isDisabled.recalculationForm);
297
354
  const isUnderwriterRole = computed(() => dataStore.isUnderwriter() || dataStore.isAdmin() || dataStore.isSupport());
298
355
  const insurancePremiumPerMonth = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
299
356
  const requestedSumInsured = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
300
357
  const hasCalculated = computed(() => !!productConditionsForm.requestedSumInsured && !!productConditionsForm.insurancePremiumPerMonth);
358
+ const amountAnnuityPayments = computed(() => (!!productConditionsForm.amountAnnuityPayments ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
301
359
  const hasProcessIndexRate = computed(() => {
302
- if (dataStore.isGons || dataStore.isKazyna) {
360
+ if (whichProduct.value === 'gons' || whichProduct.value === 'halykkazyna' || whichProduct.value === 'liferenta') {
303
361
  return false;
304
362
  }
305
363
  return true;
306
364
  });
307
365
  const hasPaymentPeriod = computed(() => {
308
- if (dataStore.isKazyna) {
366
+ if (whichProduct.value === 'halykkazyna') {
309
367
  return false;
310
368
  }
311
369
  return true;
312
370
  });
313
371
  const hasRequestedSumInsuredInDollar = computed(() => {
314
- if (dataStore.isKazyna) {
372
+ if (whichProduct.value === 'halykkazyna') {
315
373
  return true;
316
374
  }
317
375
  return false;
318
376
  });
319
377
  const hasInsurancePremiumPerMonthInDollar = computed(() => {
320
- if (dataStore.isKazyna) {
378
+ if (whichProduct.value === 'halykkazyna') {
321
379
  return true;
322
380
  }
323
381
  return false;
324
382
  });
325
383
  const hasCurrency = computed(() => {
326
- if (dataStore.isKazyna) {
384
+ if (whichProduct.value === 'halykkazyna') {
327
385
  return true;
328
386
  }
329
387
  return false;
330
388
  });
331
389
  const hasAdbMultiply = computed(() => {
332
- if (dataStore.isGons) {
390
+ if (whichProduct.value === 'gons') {
333
391
  return false;
334
392
  }
335
393
  return true;
336
394
  });
337
395
  const hasAdbAdditive = computed(() => {
338
- if (dataStore.isGons) {
396
+ if (whichProduct.value === 'gons') {
339
397
  return false;
340
398
  }
341
399
  return true;
342
400
  });
343
401
  const hasRiskGroup = computed(() => {
344
- if (dataStore.isGons) {
402
+ if (whichProduct.value === 'gons') {
345
403
  return false;
346
404
  }
347
405
  return true;
348
406
  });
407
+ const hasAnnuityPayments = computed(() => {
408
+ if (whichProduct.value === 'liferenta') {
409
+ return true;
410
+ }
411
+ return false;
412
+ });
349
413
  const coverPeriodRule = computed(() => {
350
414
  const baseCondition = dataStore.rules.required.concat(dataStore.rules.numbers);
351
- if (dataStore.isGons) {
415
+ if (whichProduct.value === 'gons') {
352
416
  return baseCondition.concat(dataStore.rules.coverPeriodFrom3to20);
353
417
  }
354
- if (dataStore.isKazyna) {
418
+ if (whichProduct.value === 'halykkazyna') {
355
419
  return baseCondition.concat(dataStore.rules.coverPeriodFrom2to20);
356
420
  }
357
421
  return baseCondition;
358
422
  });
359
423
  const currencySymbolsAddTerm = computed(() => {
360
- if (dataStore.isKazyna) {
424
+ if (whichProduct.value === 'halykkazyna') {
361
425
  return constants.currencySymbols.usd;
362
426
  }
363
427
  return constants.currencySymbols.kzt;
@@ -562,7 +626,7 @@ export default defineComponent({
562
626
  }
563
627
  isCalculating.value = true;
564
628
  if (props.isRecalculation) {
565
- await dataStore.calculateWithoutApplication(true);
629
+ await dataStore.calculateWithoutApplication(true, whichProduct.value);
566
630
  } else {
567
631
  if (dataStore.isProcessEditable(formStore.applicationData.statusCode)) {
568
632
  await dataStore.calculate(route.params.taskId);
@@ -593,8 +657,13 @@ export default defineComponent({
593
657
 
594
658
  onMounted(async () => {
595
659
  if (props.isRecalculation === true) {
596
- if (route.params.taskId === '0' && productConditionsForm.requestedSumInsured === null && productConditionsForm.insurancePremiumPerMonth === null) {
597
- const defaultData = await dataStore.getDefaultCalculationData(true);
660
+ if (
661
+ (dataStore.isCalculator || route.params.taskId === '0') &&
662
+ productConditionsForm.requestedSumInsured === null &&
663
+ productConditionsForm.insurancePremiumPerMonth === null
664
+ ) {
665
+ // @ts-ignore
666
+ const defaultData = await dataStore.getDefaultCalculationData(true, whichProduct.value);
598
667
  if (!defaultData) {
599
668
  dataStore.showToaster('error', 'Отсутствуют базовые данные');
600
669
  return;
@@ -616,7 +685,11 @@ export default defineComponent({
616
685
  if (!!productConditionsForm.requestedSumInsured) {
617
686
  whichSum.value = 'requestedSumInsured';
618
687
  }
619
- if (dataStore.isKazyna) {
688
+ if(dataStore.isCalculator) {
689
+ dataStore.processCode = constants.products[whichProduct.value];
690
+ await dataStore.getProcessPaymentPeriod();
691
+ }
692
+ if (whichProduct.value === 'halykkazyna') {
620
693
  const kazynaPaymentPeriod = dataStore.processPaymentPeriod.find(i => i.code === 'single');
621
694
  if (kazynaPaymentPeriod) productConditionsForm.paymentPeriod = kazynaPaymentPeriod;
622
695
  await dataStore.getCurrencies();
@@ -649,6 +722,18 @@ export default defineComponent({
649
722
  if (val) productConditionsForm.amountOfInsurancePremium = dataStore.getNumberWithSpaces(val);
650
723
  },
651
724
  );
725
+ watch(
726
+ () => formStore.productConditionsForm.amountAnnuityPayments,
727
+ val => {
728
+ if (val) formStore.productConditionsForm.amountAnnuityPayments = dataStore.getNumberWithSpaces(val);
729
+ },
730
+ );
731
+ watch(
732
+ () => formStore.productConditionsForm.typeAnnuityInsurance,
733
+ val => {
734
+ if (val.code === 'Lifelong') formStore.productConditionsForm.termAnnuityPayments = null;
735
+ },
736
+ );
652
737
 
653
738
  watch(
654
739
  () => dataStore.panel.open,
@@ -666,6 +751,7 @@ export default defineComponent({
666
751
  // State
667
752
  formStore,
668
753
  vForm,
754
+ whichProduct,
669
755
  productConditionsForm,
670
756
  additionalTerms,
671
757
  isCalculating,
@@ -696,7 +782,9 @@ export default defineComponent({
696
782
  hasAdbAdditive,
697
783
  hasRiskGroup,
698
784
  hasCalculated,
785
+ hasAnnuityPayments,
699
786
  currencySymbolsAddTerm,
787
+ amountAnnuityPayments,
700
788
 
701
789
  // Rules
702
790
  coverPeriodRule,
@@ -711,6 +711,12 @@ export class ProductConditions {
711
711
  processTariff: Value;
712
712
  riskGroup: Value;
713
713
  riskGroup2: Value;
714
+ additionalConditionAnnuityPayments: boolean;
715
+ guaranteedPeriod: number | string | null;
716
+ typeAnnuityInsurance: Value;
717
+ termAnnuityPayments: number | string | null;
718
+ periodAnnuityPayment: Value;
719
+ amountAnnuityPayments: number | string | null;
714
720
  constructor(
715
721
  insuranceCase = null,
716
722
  coverPeriod = null,
@@ -740,6 +746,12 @@ export class ProductConditions {
740
746
  processTariff = new Value(),
741
747
  riskGroup = new Value(),
742
748
  riskGroup2 = new Value(),
749
+ additionalConditionAnnuityPayments = false,
750
+ guaranteedPeriod = null,
751
+ typeAnnuityInsurance = new Value(),
752
+ termAnnuityPayments = null,
753
+ periodAnnuityPayment = new Value(),
754
+ amountAnnuityPayments = null,
743
755
  ) {
744
756
  this.requestedSumInsuredInDollar = null;
745
757
  this.insurancePremiumPerMonthInDollar = null;
@@ -774,6 +786,12 @@ export class ProductConditions {
774
786
  this.processTariff = processTariff;
775
787
  this.riskGroup = riskGroup;
776
788
  this.riskGroup2 = riskGroup2;
789
+ this.additionalConditionAnnuityPayments = additionalConditionAnnuityPayments;
790
+ this.guaranteedPeriod = guaranteedPeriod;
791
+ this.typeAnnuityInsurance = typeAnnuityInsurance;
792
+ this.termAnnuityPayments = termAnnuityPayments;
793
+ this.periodAnnuityPayment = periodAnnuityPayment;
794
+ this.amountAnnuityPayments = amountAnnuityPayments;
777
795
  }
778
796
  }
779
797
 
@@ -891,6 +909,8 @@ export class DataStoreClass {
891
909
  processCoverTypeSum: Value[];
892
910
  processIndexRate: Value[];
893
911
  processPaymentPeriod: Value[];
912
+ dicAnnuityTypeList: Value[];
913
+ processAnnuityPaymentPeriod: Value[];
894
914
  taskList: TaskListItem[];
895
915
  processHistory: TaskHistory[];
896
916
  contragentList: any[];
@@ -957,6 +977,8 @@ export class DataStoreClass {
957
977
  this.hasLayoutMargins = true;
958
978
  this.processIndexRate = [];
959
979
  this.processPaymentPeriod = [];
980
+ this.dicAnnuityTypeList = [];
981
+ this.processAnnuityPaymentPeriod = [];
960
982
  this.questionRefs = [];
961
983
  this.SaleChanellPolicy = [];
962
984
  this.RegionPolicy = [];
@@ -60,6 +60,7 @@ export const constants = Object.freeze({
60
60
  postActions: {
61
61
  font: 'font',
62
62
  route: 'route',
63
+ onRouteChange: 'onRouteChange',
63
64
  applicationCreated: 'applicationCreated',
64
65
  clipboard: 'clipboard',
65
66
  toHomePage: 'toHomePage',
package/locales/en.json CHANGED
@@ -246,6 +246,7 @@
246
246
  "sumAndPremium": "Insurance Premium {paymentPeriod}: {insurancePremiumPerMonth}₸\nRequested Sum Insured: {requestedSumInsured}₸",
247
247
  "recalculation": "Recalculation",
248
248
  "survey": "Questionnaire",
249
+ "calculationAnnuityPayments": "Calculation of annuity payments",
249
250
  "productConditionsForm": {
250
251
  "coverPeriod": "Insurance Period",
251
252
  "payPeriod": "Insurance Premium Payment Period",
@@ -267,7 +268,13 @@
267
268
  "insurancePremiumAmountInDollar": "Amount of the Insurance premium (insurance fee) in dollars",
268
269
  "coverPeriodFrom2to22": "Cover Period (from 2y to 20y)",
269
270
  "dollarExchangeRateNBRK": "NBRK dollar exchange rate",
270
- "contractDate": "Contract date"
271
+ "contractDate": "Contract date",
272
+ "guaranteedTermAnnuityPayments": "Guaranteed term of annuity payments",
273
+ "guaranteedPeriod": "Specify the period of the guaranteed period",
274
+ "typeAnnuityInsurance": "Requested type of annuity insurance",
275
+ "termAnnuityPayments": "Requested term of annuity payments",
276
+ "periodAnnuityPayment": "Requested annuity payment period",
277
+ "amountAnnuityPayments": "The requested amount of annuity payments"
271
278
  },
272
279
  "history": {
273
280
  "addRegNumber": "Number",
package/locales/kz.json CHANGED
@@ -246,6 +246,7 @@
246
246
  "sumAndPremium": "Сақтандыру сыйлықақысы {paymentPeriod}: {insurancePremiumPerMonth}₸\nСұрауланатын страховая сумма: {requestedSumInsured}₸",
247
247
  "recalculation": "Перерасчет",
248
248
  "survey": "Сауалнама",
249
+ "calculationAnnuityPayments": "Аннуитеттік төлемдерді есептеу",
249
250
  "productConditionsForm": {
250
251
  "coverPeriod": "Страховық мерзім",
251
252
  "payPeriod": "Cақтандыру сыйлықақысы төлеу мерзімі",
@@ -267,7 +268,13 @@
267
268
  "insurancePremiumAmount": "Сақтандыру сыйлықақысы өлшемі (страховой взнос) в тенге",
268
269
  "insurancePremiumAmountInDollar": "Сақтандыру сыйлықақысы өлшемі доллармен (страховой взнос)",
269
270
  "dollarExchangeRateNBRK": "Доллардың НБРК айырымы",
270
- "contractDate": "Контракт күні"
271
+ "contractDate": "Контракт күні",
272
+ "guaranteedTermAnnuityPayments": "Аннуитеттік төлемдердің кепілдендірілген мерзімі",
273
+ "guaranteedPeriod": "Кепілдендірілген мерзім кезеңін көрсетіңіз",
274
+ "typeAnnuityInsurance": "Аннуитеттік сақтандырудың сұратылған түрі",
275
+ "termAnnuityPayments": "Аннуитеттік төлемдердің сұралатын мерзімі",
276
+ "periodAnnuityPayment": "Аннуитеттік төлемнің сұратылған кезеңі",
277
+ "amountAnnuityPayments": "Аннуитеттік төлемдердің сұралатын мөлшері"
271
278
  },
272
279
  "history": {
273
280
  "addRegNumber": "Нөмір",
package/locales/ru.json CHANGED
@@ -246,6 +246,7 @@
246
246
  "sumAndPremium": "Сумма страховой премии {paymentPeriod}: {insurancePremiumPerMonth}₸\nЗапрашиваемая страховая сумма: {requestedSumInsured}₸",
247
247
  "recalculation": "Перерасчет",
248
248
  "survey": "Анкета",
249
+ "calculationAnnuityPayments": "Расчет аннуитетных выплат",
249
250
  "productConditionsForm": {
250
251
  "coverPeriod": "Срок страхования",
251
252
  "payPeriod": "Период оплаты страховой премии",
@@ -267,7 +268,13 @@
267
268
  "insurancePremiumAmount": "Размер Страховой премии (страховой взнос) в тенге",
268
269
  "insurancePremiumAmountInDollar": "Размер Страховой премии (страховой взнос) в долларах",
269
270
  "dollarExchangeRateNBRK": "Курс доллара НБРК",
270
- "contractDate": "Дата контракта"
271
+ "contractDate": "Дата контракта",
272
+ "guaranteedTermAnnuityPayments": "Гарантированный срок аннуитетных выплат",
273
+ "guaranteedPeriod": "Укажите период гарантированного срока",
274
+ "typeAnnuityInsurance": "Запрашиваемый вид аннуитетного страхования",
275
+ "termAnnuityPayments": "Запрашиваемый срок аннуитетных выплат",
276
+ "periodAnnuityPayment": "Запрашиваемый период аннуитетной выплаты",
277
+ "amountAnnuityPayments": "Запрашиваемый размер аннуитетных выплат"
271
278
  },
272
279
  "history": {
273
280
  "addRegNumber": "Номер",
@@ -460,7 +467,8 @@
460
467
  "ageMycar": "Пороговое значение по возрасту с 21 по 65",
461
468
  "noResident": "Нерезидентам отказано",
462
469
  "policyholderAgeLimit": "Возраст Застрахованного должен быть не менее 18-ти лет",
463
- "beneficiaryAgeLimit": "На дату подписания полиса возраст Выгодоприобретателя должен быть не более 15 лет"
470
+ "beneficiaryAgeLimit": "На дату подписания полиса возраст Выгодоприобретателя должен быть не более 15 лет",
471
+ "guaranteedPeriodLimit": "Период гарантированного срока не может быть больше срока аннуитетных выплат",
464
472
  },
465
473
  "code": "КЭС",
466
474
  "fontSize": "Размер шрифта",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.8-beta.21",
3
+ "version": "0.0.8-beta.23",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -42,6 +42,7 @@ export const useDataStore = defineStore('data', {
42
42
  isPension: state => state.product === 'pension',
43
43
  isGons: state => state.product === 'gons',
44
44
  isKazyna: state => state.product === 'halykkazyna',
45
+ isCalculator: state => state.product === 'calculator',
45
46
  isComplianceWindow: state => state.product === 'compliance',
46
47
  isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
47
48
  },
@@ -1056,6 +1057,12 @@ export const useDataStore = defineStore('data', {
1056
1057
  async getProcessTariff() {
1057
1058
  return await this.getFromApi('processTariff', 'getProcessTariff');
1058
1059
  },
1060
+ async getDicAnnuityTypeList() {
1061
+ return await this.getFromApi('dicAnnuityTypeList', 'getDicAnnuityTypeList');
1062
+ },
1063
+ async getProcessAnnuityPaymentPeriod() {
1064
+ return await this.getFromApi('processAnnuityPaymentPeriod', 'getProcessAnnuityPaymentPeriod', this.processCode);
1065
+ },
1059
1066
  async getCurrencies() {
1060
1067
  try {
1061
1068
  const currencies = await this.api.getCurrencies();
@@ -1179,6 +1186,8 @@ export const useDataStore = defineStore('data', {
1179
1186
  this.getProcessTariff(),
1180
1187
  this.getProcessPaymentPeriod(),
1181
1188
  this.getDicFileTypeList(),
1189
+ this.getDicAnnuityTypeList(),
1190
+ this.getProcessAnnuityPaymentPeriod(),
1182
1191
  this.getDictionaryItems('RegionPolicy'),
1183
1192
  this.getDictionaryItems('SaleChanellPolicy'),
1184
1193
  ]);
@@ -1331,10 +1340,10 @@ export const useDataStore = defineStore('data', {
1331
1340
  console.log(err);
1332
1341
  }
1333
1342
  },
1334
- async getDefaultCalculationData(showLoader = false) {
1343
+ async getDefaultCalculationData(showLoader = false, product = null) {
1335
1344
  this.isLoading = showLoader;
1336
1345
  try {
1337
- const calculationData = await this.api.getDefaultCalculationData();
1346
+ const calculationData = await this.api.getDefaultCalculationData(this.isCalculator ? product : undefined);
1338
1347
  return calculationData;
1339
1348
  } catch (err) {
1340
1349
  ErrorHandler(err);
@@ -1342,7 +1351,7 @@ export const useDataStore = defineStore('data', {
1342
1351
  this.isLoading = false;
1343
1352
  }
1344
1353
  },
1345
- async calculateWithoutApplication(showLoader = false) {
1354
+ async calculateWithoutApplication(showLoader = false, product = null) {
1346
1355
  this.isLoading = showLoader;
1347
1356
  try {
1348
1357
  const calculationData = {
@@ -1359,19 +1368,28 @@ export const useDataStore = defineStore('data', {
1359
1368
  paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
1360
1369
  addCovers: this.formStore.additionalInsuranceTermsWithout,
1361
1370
  };
1362
- if (this.isKazyna) {
1371
+ if (this.isKazyna || product === 'halykkazyna') {
1363
1372
  calculationData.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
1364
1373
  calculationData.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
1365
1374
  calculationData.currencyExchangeRate = this.currencies.usd;
1366
1375
  }
1367
- const calculationResponse = await this.api.calculateWithoutApplication(calculationData);
1376
+ if (this.isLiferenta) {
1377
+ calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
1378
+ calculationData.annuityTypeId = this.formStore.productConditionsForm.typeAnnuityInsurance.id;
1379
+ calculationData.paymentPeriod = this.formStore.productConditionsForm.termAnnuityPayments;
1380
+ calculationData.annuityPaymentPeriodId = this.formStore.productConditionsForm.periodAnnuityPayment.id;
1381
+ }
1382
+ const calculationResponse = await this.api.calculateWithoutApplication(calculationData, this.isCalculator ? product : undefined);
1368
1383
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
1369
1384
  this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
1370
1385
  this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1371
- if (this.isKazyna) {
1386
+ if (this.isKazyna || product === 'halykkazyna') {
1372
1387
  this.formStore.productConditionsForm.requestedSumInsuredInDollar = this.getNumberWithSpaces(calculationResponse.amountInCurrency);
1373
1388
  this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
1374
1389
  }
1390
+ if (this.isLiferenta) {
1391
+ this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(calculationResponse.annuityMonthPay);
1392
+ }
1375
1393
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1376
1394
  } catch (err) {
1377
1395
  ErrorHandler(err);
@@ -1418,6 +1436,12 @@ export const useDataStore = defineStore('data', {
1418
1436
  form1.policyAppDto.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
1419
1437
  form1.policyAppDto.currencyExchangeRate = this.currencies.usd;
1420
1438
  }
1439
+ if (this.isLiferenta) {
1440
+ form1.policyAppDto.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
1441
+ form1.policyAppDto.annuityTypeId = this.formStore.productConditionsForm.typeAnnuityInsurance.id;
1442
+ form1.policyAppDto.paymentPeriod = this.formStore.productConditionsForm.termAnnuityPayments;
1443
+ form1.policyAppDto.annuityPaymentPeriodId = this.formStore.productConditionsForm.periodAnnuityPayment.id;
1444
+ }
1421
1445
  try {
1422
1446
  let id = this.formStore.applicationData.processInstanceId;
1423
1447
 
@@ -1440,6 +1464,9 @@ export const useDataStore = defineStore('data', {
1440
1464
  } else {
1441
1465
  this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(result);
1442
1466
  }
1467
+ if (this.isLiferenta) {
1468
+ this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
1469
+ }
1443
1470
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1444
1471
  } catch (err) {
1445
1472
  ErrorHandler(err);
@@ -1630,6 +1657,23 @@ export const useDataStore = defineStore('data', {
1630
1657
  this.formStore.productConditionsForm.disabilityMultiply = parseProcents(applicationData.policyAppDto.disabilityMultiply);
1631
1658
  this.formStore.productConditionsForm.disabilityAdditive = parseProcents(applicationData.policyAppDto.disabilityAdditive);
1632
1659
 
1660
+ if (this.isLiferenta) {
1661
+ this.formStore.productConditionsForm.additionalConditionAnnuityPayments =
1662
+ applicationData.policyAppDto.guaranteedPaymentPeriod === null || applicationData.policyAppDto.guaranteedPaymentPeriod === 0 ? false : true;
1663
+ this.formStore.productConditionsForm.guaranteedPeriod =
1664
+ applicationData.policyAppDto.guaranteedPaymentPeriod === 0 ? null : applicationData.policyAppDto.guaranteedPaymentPeriod;
1665
+ this.formStore.productConditionsForm.termAnnuityPayments = applicationData.policyAppDto.paymentPeriod;
1666
+ this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(
1667
+ applicationData.policyAppDto.annuityMonthPay === 0 ? null : applicationData.policyAppDto.annuityMonthPay,
1668
+ );
1669
+
1670
+ let annuityType = this.dicAnnuityTypeList.find(item => item.id == applicationData.policyAppDto.annuityTypeId);
1671
+ this.formStore.productConditionsForm.typeAnnuityInsurance = annuityType ? annuityType : new Value();
1672
+
1673
+ let annuityPaymentPeriod = this.processAnnuityPaymentPeriod.find(item => item.id == applicationData.policyAppDto.annuityPaymentPeriodId);
1674
+ this.formStore.productConditionsForm.periodAnnuityPayment = annuityPaymentPeriod ? annuityPaymentPeriod : new Value();
1675
+ }
1676
+
1633
1677
  let processIndexRate = this.processIndexRate.find(item => item.id == applicationData.policyAppDto.indexRateId);
1634
1678
  this.formStore.productConditionsForm.processIndexRate = processIndexRate ? processIndexRate : this.processIndexRate.find(item => item.code === '0');
1635
1679
 
package/store/rules.js CHANGED
@@ -167,4 +167,10 @@ export const rules = {
167
167
  ],
168
168
  policyholderAgeLimit: [v => v >= 18 || t('rules.policyholderAgeLimit')],
169
169
  beneficiaryAgeLimit: [v => v <= 15 || t('rules.beneficiaryAgeLimit')],
170
+ guaranteedPeriodLimit(v, termAnnuityPayments) {
171
+ if (Number(v) > Number(termAnnuityPayments)) {
172
+ return t('rules.guaranteedPeriodLimit');
173
+ }
174
+ return true;
175
+ },
170
176
  };