hl-core 0.0.9-beta.10 → 0.0.9-beta.11

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.
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <vue-date-picker
3
+ :model-value="modelValue"
4
+ :clearable="false"
5
+ :disabled="disabled"
6
+ :reaonly="readonly"
7
+ month-picker
8
+ locale="ru"
9
+ format="MM.yyyy"
10
+ :close-on-scroll="true"
11
+ cancel-text="Отменить"
12
+ select-text="Выбрать"
13
+ @update:modelValue="$emit('update:modelValue', $event)"
14
+ />
15
+ </template>
16
+
17
+ <script lang="ts">
18
+ export default defineComponent({
19
+ props: {
20
+ modelValue: {
21
+ required: false,
22
+ },
23
+ disabled: {
24
+ type: Boolean,
25
+ default: false,
26
+ },
27
+ readonly: {
28
+ type: Boolean,
29
+ default: false,
30
+ },
31
+ },
32
+ });
33
+ </script>
@@ -34,19 +34,19 @@
34
34
  <base-form-text-section v-for="(question, index) in firstQuestionList.filter(i => i.first.definedAnswers === 'Y')" :key="index">
35
35
  <base-fade-transition>
36
36
  <div
37
- v-if="question.first.answerName === 'Да' && secondQuestionList"
37
+ v-if="question.first.answerName === 'Да' && question.second"
38
38
  :class="[$styles.greenBg, $styles.whiteText, $styles.textSimple]"
39
39
  class="rounded-t-lg pl-6 py-1 cursor-pointer"
40
40
  @click="openFirstPanel(question)"
41
41
  >
42
- {{ $dataStore.t('questionnaireType.pleaseAnswer', { text: secondQuestionList.length }) }}
42
+ {{ $dataStore.t('questionnaireType.pleaseAnswer', { text: question.second.length }) }}
43
43
  </div>
44
44
  </base-fade-transition>
45
45
  <span :class="[$styles.textTitle]" class="border-b-[1px] border-b-[#F3F6FC] p-6 flex items-center justify-between">
46
46
  {{ question.first.name }}
47
47
  <base-fade-transition>
48
48
  <i
49
- v-if="question.first.answerName === 'Да' && secondQuestionList && secondQuestionList.length"
49
+ v-if="question.first.answerName === 'Да' && question.second && question.second.length"
50
50
  class="mdi mdi-chevron-right text-2xl cursor-pointer"
51
51
  @click="openFirstPanel(question)"
52
52
  ></i>
@@ -78,30 +78,39 @@
78
78
  />
79
79
  </section>
80
80
  <v-btn
81
- v-if="secondQuestionList && secondQuestionList.length && firstPanel"
81
+ v-if="currentQuestion && currentQuestion.second && currentQuestion.second.length && firstPanel"
82
82
  icon="mdi mdi-close"
83
83
  class="ml-3 !absolute z-10"
84
- @click="
85
- firstPanel = false;
86
- secondPanel = false;
87
- "
84
+ @click="submitSecondaryForm"
88
85
  />
89
- <section ref="firstPanelSection" v-if="secondQuestionList && secondQuestionList.length && firstPanel" class="flex flex-col px-[10px] pb-[14px]" :class="[$styles.scrollPage]">
90
- <section v-if="currentQuestion" :class="[$styles.blueBgLight, $styles.rounded]" class="mx-[10px] mt-[14px] p-4 flex flex-col gap-4">
86
+ <section ref="firstPanelSection" v-if="currentQuestion && currentQuestion.second && firstPanel" class="flex flex-col px-[10px] pb-[14px]" :class="[$styles.scrollPage]">
87
+ <v-form
88
+ v-if="currentQuestion"
89
+ :class="[$styles.blueBgLight, $styles.rounded]"
90
+ class="mx-[10px] mt-[14px] p-4 flex flex-col gap-4"
91
+ ref="vSecondaryForm"
92
+ @submit="submitSecondaryForm"
93
+ >
91
94
  <base-form-text-section v-for="question in currentQuestion.second" :title="question.name" :key="question.name">
92
95
  <base-form-input
93
96
  v-if="question.definedAnswers === 'N'"
94
97
  v-model="question.answerText"
95
98
  class="border-t-[1px] border-t-[#F3F6FC]"
96
- placeholder="Введите текст"
99
+ :placeholder="$dataStore.t('labels.inputText')"
97
100
  :readonly="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()"
101
+ :rules="isSecondRequired ? $rules.required : []"
98
102
  />
99
- <span v-else class="flex items-center justify-between p-4 cursor-pointer" :class="[$styles.textTitle, $styles.greenText]" @click="openSecondPanel(question)">
100
- {{ question.answerName ? question.answerName : 'Выбрать вариант ответа' }}
101
- <i class="mdi mdi-chevron-right text-[28px]"></i>
102
- </span>
103
+ <base-panel-input
104
+ v-else
105
+ :class="[$styles.textTitle, $styles.greenText]"
106
+ :value="question.answerName ? question.answerName : 'Выбрать вариант ответа'"
107
+ :readonly="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()"
108
+ :clearable="false"
109
+ :error-messages="isSecondRequired ? (question.answerName ? [] : ['Выбрать вариант ответа']) : []"
110
+ @click="openSecondPanel(question)"
111
+ ></base-panel-input>
103
112
  </base-form-text-section>
104
- </section>
113
+ </v-form>
105
114
  </section>
106
115
  </base-fade-transition>
107
116
  <Teleport v-if="secondPanel" to="#panel-actions">
@@ -132,6 +141,7 @@ export default defineComponent({
132
141
  const formStore = useFormStore();
133
142
  const dataStore = useDataStore();
134
143
  const vForm = ref<any>();
144
+ const vSecondaryForm = ref<any>();
135
145
  const firstPanelSection = ref<any>();
136
146
  const isButtonLoading = ref<boolean>(false);
137
147
  const answerToAll = ref<boolean>(false);
@@ -148,13 +158,13 @@ export default defineComponent({
148
158
  : 'surveyByCriticalBasePolicyholder',
149
159
  );
150
160
  const firstQuestionList = ref<AnketaBody[]>([]);
151
- const secondQuestionList = ref<AnketaSecond[]>([]);
152
161
  const currentQuestion = ref<AnketaBody>();
153
162
  const currentSecond = ref<AnketaSecond>();
154
163
  const isPanelLoading = ref<boolean>(false);
155
164
  const searchQuery = ref<string>('');
156
165
 
157
166
  const whichMember = computed(() => ('member' in route.query && !!route.query.member ? (route.query.member as 'insured' | 'policyholder') : 'insured'));
167
+ const isSecondRequired = computed(() => dataStore.controls.isSecondAnketaRequired);
158
168
  const scrollForm = (direction: 'up' | 'down') => {
159
169
  const scrollObject = { top: direction === 'up' ? 0 : screen.height * 10, behavior: 'smooth' };
160
170
  if (firstPanel.value) {
@@ -168,11 +178,25 @@ export default defineComponent({
168
178
  await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
169
179
  if (v.valid) {
170
180
  isButtonLoading.value = true;
171
- formStore[whichSurvey.value]!.body.forEach((survey: AnketaBody) => {
172
- if (survey.first.answerText === 'Нет') {
173
- survey.second = [];
174
- }
175
- });
181
+ const isValid = dataStore.validateAnketa(whichSurvey.value);
182
+ if (!isValid) {
183
+ isButtonLoading.value = false;
184
+ return false;
185
+ }
186
+ if (formStore[whichSurvey.value] && formStore[whichSurvey.value]?.body) {
187
+ formStore[whichSurvey.value]?.body.forEach(question => {
188
+ if (question.first.definedAnswers === 'Y' && question.first.answerName?.match(new RegExp('Нет', 'i')) && question.second && question.second.length) {
189
+ question.second.forEach(second => {
190
+ if (second.definedAnswers === 'N') {
191
+ second.answerText = null;
192
+ } else {
193
+ second.answerId = null;
194
+ second.answerName = null;
195
+ }
196
+ });
197
+ }
198
+ });
199
+ }
176
200
  formStore[whichSurvey.value]!.type = surveyType.value;
177
201
  const anketaToken = await dataStore.setSurvey(formStore[whichSurvey.value]!);
178
202
  if (typeof anketaToken === 'string') {
@@ -201,13 +225,36 @@ export default defineComponent({
201
225
  });
202
226
  };
203
227
 
204
- const openFirstPanel = async (question: AnketaBody) => {
205
- currentQuestion.value = question;
206
- formStore[whichSurvey.value]!.body.forEach((question_object: AnketaBody) => {
207
- if ((question_object.first.id === question.first.id && question_object.second && !question_object.second.length) || question_object.second == null) {
208
- question_object.second = JSON.parse(JSON.stringify(formStore[surveyType.value === 'health' ? 'surveyByHealthSecond' : 'surveyByCriticalSecond']));
228
+ const submitSecondaryForm = async () => {
229
+ await vSecondaryForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
230
+ if (v.valid) {
231
+ if (isSecondRequired.value && currentQuestion.value && currentQuestion.value.second) {
232
+ const hasError = currentQuestion.value.second.find(second => (second.definedAnswers === 'N' ? !second.answerText : !second.answerName));
233
+ if (hasError) {
234
+ dataStore.showToaster('error', dataStore.t('toaster.emptySecondAnketa', { text: hasError.name }), 5000);
235
+ return false;
236
+ }
237
+ }
238
+ firstPanel.value = false;
239
+ secondPanel.value = false;
240
+ } else {
241
+ const errors = document.querySelector('.v-input--error');
242
+ if (errors) {
243
+ const errorText = errors.parentElement?.children[0].innerHTML;
244
+ if (errorText) {
245
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorText?.replace(/[-<>!//.]/g, '') }));
246
+ }
247
+ errors.scrollIntoView({
248
+ behavior: 'smooth',
249
+ block: 'center',
250
+ inline: 'nearest',
251
+ });
252
+ }
209
253
  }
210
254
  });
255
+ };
256
+ const openFirstPanel = async (question: AnketaBody) => {
257
+ currentQuestion.value = question;
211
258
  firstPanel.value = true;
212
259
  secondPanel.value = false;
213
260
  };
@@ -236,7 +283,6 @@ export default defineComponent({
236
283
  };
237
284
 
238
285
  const getDefinedAnswerId = async (id: string, value: any, index: number) => {
239
- // @ts-ignore
240
286
  await dataStore.definedAnswers(id, whichSurvey.value, value, index);
241
287
  };
242
288
 
@@ -272,11 +318,9 @@ export default defineComponent({
272
318
  formStore.applicationData.processInstanceId,
273
319
  whichMember.value === 'insured' ? formStore.applicationData.insuredApp[0].id : formStore.applicationData.clientApp.id,
274
320
  whichSurvey.value,
275
- surveyType.value === 'health' ? 'surveyByHealthSecond' : 'surveyByCriticalSecond',
276
321
  whichMember.value,
277
322
  );
278
323
  firstQuestionList.value = formStore[whichSurvey.value]!.body;
279
- secondQuestionList.value = formStore[surveyType.value === 'health' ? 'surveyByHealthSecond' : 'surveyByCriticalSecond']!;
280
324
  formStore[whichSurvey.value]!.type = surveyType.value;
281
325
  const negativeAnswer = firstQuestionList.value.every(i => i.first.answerName === 'Нет');
282
326
  if (negativeAnswer) {
@@ -320,10 +364,10 @@ export default defineComponent({
320
364
  return {
321
365
  // State
322
366
  vForm,
367
+ vSecondaryForm,
323
368
  formStore,
324
369
  answerToAll,
325
370
  firstQuestionList,
326
- secondQuestionList,
327
371
  whichSurvey,
328
372
  isButtonLoading,
329
373
  firstPanel,
@@ -333,9 +377,11 @@ export default defineComponent({
333
377
  isPanelLoading,
334
378
  searchQuery,
335
379
  firstPanelSection,
380
+ isSecondRequired,
336
381
 
337
382
  // Functions
338
383
  submitForm,
384
+ submitSecondaryForm,
339
385
  getDefinedAnswerId,
340
386
  scrollForm,
341
387
  handleToggler,
@@ -1,6 +1,13 @@
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-message-block
5
+ v-if="isRecalculation"
6
+ class="mt-4"
7
+ :color="$styles.blueBgLight"
8
+ :text="$dataStore.t('preliminaryCalculation')"
9
+ icon="mdi-alert text-[#FCB016]"
10
+ ></base-message-block>
4
11
  <base-form-section v-if="whichProduct === 'gons'" :title="$dataStore.t('productConditionsForm.requestedProductConditions')" :class="[$styles.textSimple]">
5
12
  <base-form-text-section
6
13
  class="mb-4"
@@ -54,7 +61,7 @@
54
61
  :clearable="isRecalculationDisabled === false"
55
62
  :label="$dataStore.t('percent') + `Life Multiply`"
56
63
  :readonly="isRecalculationDisabled"
57
- :rules="$dataStore.rules.recalculationMultiply"
64
+ :rules="whichProduct === 'gons' ? $dataStore.rules.recalculationMultiplyBetween : $dataStore.rules.recalculationMultiply"
58
65
  />
59
66
  <base-form-input
60
67
  v-model="productConditionsForm.lifeAdditive"
@@ -88,7 +95,7 @@
88
95
  :clearable="isRecalculationDisabled === false"
89
96
  :label="$dataStore.t('percent') + `Disability Multiply`"
90
97
  :readonly="isRecalculationDisabled"
91
- :rules="$dataStore.rules.recalculationMultiply"
98
+ :rules="whichProduct === 'gons' ? [] : $dataStore.rules.recalculationMultiply"
92
99
  />
93
100
  <base-form-input
94
101
  v-model="productConditionsForm.disabilityAdditive"
@@ -200,6 +207,34 @@
200
207
  @input="onInputInsurancePremiumPerMonth"
201
208
  @onClear="onClearPremium"
202
209
  />
210
+ <base-form-input
211
+ v-if="whichProduct === 'gons' && isRecalculation"
212
+ v-model="productConditionsForm.totalAmount5"
213
+ :readonly="true"
214
+ :label="$dataStore.t('productConditionsForm.totalAmount5')"
215
+ :suffix="$constants.currencySymbols.kzt"
216
+ />
217
+ <base-form-input
218
+ v-if="whichProduct === 'gons' && isRecalculation"
219
+ v-model="productConditionsForm.statePremium5"
220
+ :readonly="true"
221
+ :label="$dataStore.t('productConditionsForm.statePremium5')"
222
+ :suffix="$constants.currencySymbols.kzt"
223
+ />
224
+ <base-form-input
225
+ v-if="whichProduct === 'gons' && isRecalculation"
226
+ v-model="productConditionsForm.totalAmount7"
227
+ :readonly="true"
228
+ :label="$dataStore.t('productConditionsForm.totalAmount7')"
229
+ :suffix="$constants.currencySymbols.kzt"
230
+ />
231
+ <base-form-input
232
+ v-if="whichProduct === 'gons' && isRecalculation"
233
+ v-model="productConditionsForm.statePremium7"
234
+ :readonly="true"
235
+ :label="$dataStore.t('productConditionsForm.statePremium7')"
236
+ :suffix="$constants.currencySymbols.kzt"
237
+ />
203
238
  <base-form-input
204
239
  v-if="hasInsurancePremiumPerMonthInDollar"
205
240
  v-model="productConditionsForm.insurancePremiumPerMonthInDollar"
@@ -388,7 +423,7 @@ export default defineComponent({
388
423
  });
389
424
  const isDisabled = computed(() => (dataStore.isCalculator ? false : !memberStore.isStatementEditible('productConditionsForm')));
390
425
  const isTermsDisabled = computed(() => {
391
- if (dataStore.isGons) {
426
+ if (dataStore.isGons || whichProduct.value === 'gons') {
392
427
  return true;
393
428
  }
394
429
  return isDisabled.value;
@@ -720,6 +755,13 @@ export default defineComponent({
720
755
  return;
721
756
  }
722
757
 
758
+ if (
759
+ whichProduct.value === 'gons' &&
760
+ (formStore.applicationData.statusCode === 'EditForm' || formStore.applicationData.statusCode === 'StartForm') &&
761
+ getNumber(productConditionsForm.requestedSumInsured as string)! >= 10_000_000
762
+ ) {
763
+ dataStore.showToaster('info', dataStore.t('toaster.calcSumForUnder'), 6000);
764
+ }
723
765
  if (isUnderwriterForm.value) {
724
766
  type recalculationInfo = {
725
767
  lifeMultiply: string | null | number;
@@ -199,6 +199,11 @@ export default defineComponent({
199
199
 
200
200
  const handleTask = async () => {
201
201
  loading.value = true;
202
+ if (needRecalculation.value) {
203
+ dataStore.showToaster('info', dataStore.t('toaster.needToRecalculate'));
204
+ loading.value = false;
205
+ return;
206
+ }
202
207
  if (dataStore.isAML || dataStore.isCheckContract || dataStore.isCheckContragent) {
203
208
  emit('task', [dataStore.panelAction, route.params.taskId as string, actionCause.value]);
204
209
  } else {
@@ -237,6 +242,13 @@ export default defineComponent({
237
242
  },
238
243
  { immediate: true },
239
244
  );
245
+ const needRecalculation = computed(
246
+ () =>
247
+ dataStore.isGons &&
248
+ formStore.applicationData.statusCode === 'UnderwriterForm' &&
249
+ dataStore.panelAction === constants.actions.accept &&
250
+ formStore.productConditionsForm.isRecalculated === false,
251
+ );
240
252
  const sendingActions = computed(
241
253
  () => dataStore.panelAction === constants.actions.reject || dataStore.panelAction === constants.actions.return || dataStore.panelAction === constants.actions.rejectclient,
242
254
  );
@@ -700,6 +700,11 @@ export class ProductConditions {
700
700
  termAnnuityPayments: number | string | null;
701
701
  periodAnnuityPayment: Value;
702
702
  amountAnnuityPayments: number | string | null;
703
+ isRecalculated: boolean;
704
+ totalAmount5: number | string | null;
705
+ totalAmount7: number | string | null;
706
+ statePremium5: number | string | null;
707
+ statePremium7: number | string | null;
703
708
  constructor(
704
709
  insuranceCase = null,
705
710
  coverPeriod = null,
@@ -735,6 +740,11 @@ export class ProductConditions {
735
740
  termAnnuityPayments = null,
736
741
  periodAnnuityPayment = new Value(),
737
742
  amountAnnuityPayments = null,
743
+ isRecalculated = false,
744
+ totalAmount5 = null,
745
+ totalAmount7 = null,
746
+ statePremium5 = null,
747
+ statePremium7 = null,
738
748
  ) {
739
749
  this.requestedSumInsuredInDollar = null;
740
750
  this.insurancePremiumPerMonthInDollar = null;
@@ -775,6 +785,11 @@ export class ProductConditions {
775
785
  this.termAnnuityPayments = termAnnuityPayments;
776
786
  this.periodAnnuityPayment = periodAnnuityPayment;
777
787
  this.amountAnnuityPayments = amountAnnuityPayments;
788
+ this.isRecalculated = isRecalculated;
789
+ this.totalAmount5 = totalAmount5;
790
+ this.totalAmount7 = totalAmount7;
791
+ this.statePremium5 = statePremium5;
792
+ this.statePremium7 = statePremium7;
778
793
  }
779
794
  }
780
795
 
@@ -811,6 +826,8 @@ export class DataStoreClass {
811
826
  hasAgreement: boolean;
812
827
  // Наличие анкеты
813
828
  hasAnketa: boolean;
829
+ // Обязательность доп анкеты
830
+ isSecondAnketaRequired: boolean;
814
831
  // Подтягивание с ГБДФЛ
815
832
  hasGBDFL: boolean;
816
833
  // Подтягивание с ГКБ
@@ -949,6 +966,7 @@ export class DataStoreClass {
949
966
  },
950
967
  onAuth: false,
951
968
  hasAnketa: true,
969
+ isSecondAnketaRequired: true,
952
970
  hasAgreement: true,
953
971
  hasGBDFL: true,
954
972
  hasGKB: false,
@@ -1100,8 +1118,6 @@ export class FormStoreClass {
1100
1118
  surveyByHealthBasePolicyholder: AnketaFirst | null;
1101
1119
  surveyByCriticalBase: AnketaFirst | null;
1102
1120
  surveyByCriticalBasePolicyholder: AnketaFirst | null;
1103
- surveyByHealthSecond: AnketaSecond[] | null;
1104
- surveyByCriticalSecond: AnketaSecond[] | null;
1105
1121
  definedAnswersId: {
1106
1122
  surveyByHealthBase: any;
1107
1123
  surveyByCriticalBase: any;
@@ -1186,8 +1202,6 @@ export class FormStoreClass {
1186
1202
  this.surveyByHealthBasePolicyholder = null;
1187
1203
  this.surveyByCriticalBase = null;
1188
1204
  this.surveyByCriticalBasePolicyholder = null;
1189
- this.surveyByHealthSecond = null;
1190
- this.surveyByCriticalSecond = null;
1191
1205
  this.definedAnswersId = {
1192
1206
  surveyByHealthBase: {},
1193
1207
  surveyByCriticalBase: {},
package/locales/ru.json CHANGED
@@ -67,6 +67,7 @@
67
67
  "emptyHealthAnketa": "Не заполнены данные анкеты по здоровью Застрахованного",
68
68
  "emptyHealthAnketaPolicyholder": "Не заполнены данные анкеты по здоровью Страхователя",
69
69
  "emptyCriticalAnketa": "Не заполнены данные анкеты по критическому заболеванию Застрахованного",
70
+ "emptySecondAnketa": "Не заполнены вопросы доп. анкеты \"{text}\"",
70
71
  "successOperation": "Операция прошла успешно",
71
72
  "noAssignee": "Нужно взять задачу в работу",
72
73
  "canDoOnlyAssignee": "Задача в работе и у вас нету доступа",
@@ -83,6 +84,7 @@
83
84
  "documentNumberWasNotFilled": "Номер документа и дата не были заполнены",
84
85
  "valueShouldBeHigher": "Значение должно быть больше {text} процентов",
85
86
  "valueShouldBeBetween": "Значение должно быть в промежутке от {floor} до {ceil} процентов",
87
+ "recalculationMultiplyBetween": "Значение должно быть в промежутке от {floor} до {ceil} процентов",
86
88
  "needAgreement": "Нужно получить согласие контрагента",
87
89
  "successOtp": "Код подтверждения отправлен успешно",
88
90
  "hasSuccessOtp": "По контрагенту уже имеется согласие",
@@ -108,7 +110,8 @@
108
110
  "wrongInn": "Неправильный ИНН",
109
111
  "underageShouldBeLess18": "Несовершеннолетний не может быть старше 18 лет",
110
112
  "needAgent": "Поле агент должно быть заполнено",
111
- "tripInsuredAmountCalculated": "Высчитана страховая сумма для выбора"
113
+ "tripInsuredAmountCalculated": "Высчитана страховая сумма для выбора",
114
+ "calcSumForUnder":"Внимание! Требуется пересчет страховой суммы андеррайтером. Заявка будет направлена Андеррайтеру"
112
115
  },
113
116
  "buttons": {
114
117
  "dataInput": "Ввод данных",
@@ -260,6 +263,7 @@
260
263
  "recalculation": "Перерасчет",
261
264
  "survey": "Анкета",
262
265
  "calculationAnnuityPayments": "Расчет аннуитетных выплат",
266
+ "preliminaryCalculation":"Расчет предварительный. Требуется заполнить все необходимые данные",
263
267
  "productConditionsForm": {
264
268
  "coverPeriod": "Срок страхования",
265
269
  "payPeriod": "Период оплаты страховой премии",
@@ -268,6 +272,10 @@
268
272
  "requestedSumInsured": "Страховая сумма",
269
273
  "requestedSumInsuredInTenge": "Страховая сумма в тенге",
270
274
  "requestedSumInsuredInDollar": "Страховая сумма в долларах",
275
+ "totalAmount5":"Общая сумма (страховая сумма с учетом Гос. премии 5 %)",
276
+ "totalAmount7":"Общая сумма (страховая сумма с учетом Гос. премии 7 %)",
277
+ "statePremium5":"Гос. премия (5 %)",
278
+ "statePremium7":"Гос. премия (7 %)",
271
279
  "sumInsured": "Страховая сумма",
272
280
  "insurancePremiumPerMonth": "Страховая премия",
273
281
  "hint": "Сумма рассчитывается автоматически",
@@ -377,6 +385,40 @@
377
385
  "reportDate": "Отчетная дата",
378
386
  "agentPolicy": "Личные продажи",
379
387
  "paymentJournal": "Журнал оплаты",
388
+ "paySlip": "Расчетный лист",
389
+ "pay-slip": {
390
+ "formationDate": "Дата формирования",
391
+ "endPeriodLevel": "Уровень на конец периода",
392
+ "reportinPeriodFrom": "Отчетный период с {text}",
393
+ "reportinPeriodTo": "Отчетный период по {text}",
394
+ "unitCalculation": "Расчет единиц",
395
+ "selfUnit": "Личн.ед.",
396
+ "groupUnit": "Груп.ед.",
397
+ "allUnit": "Общ.ед.",
398
+ "unitFrom": "На начало",
399
+ "unitTo": "На конец",
400
+ "unitChange": "Изменения",
401
+ "unitInsLife": "Страхование жизни",
402
+ "unitTotalLife": "Общее страхование",
403
+ "unitCurrent": "Текущие начисления",
404
+ "calculationAward": "Расчет вознаграждения",
405
+ "selfPr": "Личн.пр.",
406
+ "groupPr": "Груп.пр.",
407
+ "allPr": "Общ.пр.",
408
+ "accrualsSummary": "Свод начислений по ветвям и анализ перекосов развития структуры",
409
+ "beginLevel": "Ур. на начало",
410
+ "endLevel": "Ур. на конец",
411
+ "currentUnit": "Ед. текущие",
412
+ "beginUnit": "Ед. на начало",
413
+ "endUnit": "Ед. на конец",
414
+ "personalAwards": "Персональное вознаграждение",
415
+ "groupAwards": "Групповое вознаграждение",
416
+ "payPeriod": "Периодич. оплаты",
417
+ "tarrifRate": "Тарифная ставка",
418
+ "beginRate": "Нач. единицы",
419
+ "beginAward": "Нач. вознагр.",
420
+ "activeYear": "Год действия"
421
+ },
380
422
  "journal": {
381
423
  "incomeKz": "Приходы KZT",
382
424
  "outcomeKz": "Расходы KZT",
@@ -426,6 +468,8 @@
426
468
  "new": "Подать заявление"
427
469
  },
428
470
  "labels": {
471
+ "period": "Период",
472
+ "currentPerf": "Текущие показатели",
429
473
  "premium": "Премия",
430
474
  "currencySum": "Сумма валюты",
431
475
  "contractNo": "Номер контракта",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.9-beta.10",
3
+ "version": "0.0.9-beta.11",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -1285,46 +1285,37 @@ export const useDataStore = defineStore('data', {
1285
1285
  surveyType: 'health' | 'critical',
1286
1286
  processInstanceId: string | number,
1287
1287
  insuredId: any,
1288
- baseField: string,
1289
- secondaryField: string,
1288
+ baseField: 'surveyByHealthBase' | 'surveyByCriticalBase' | 'surveyByHealthBasePolicyholder' | 'surveyByCriticalBasePolicyholder',
1290
1289
  whichMember: 'insured' | 'policyholder' = 'insured',
1291
1290
  ) {
1292
- //@ts-ignore
1293
- if (!this.formStore[baseField] || (this.formStore[baseField] && !this.formStore[baseField].length)) {
1291
+ if (!this.formStore[baseField]) {
1294
1292
  try {
1295
- if (whichMember === 'insured') {
1296
- const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1297
- this.api.getQuestionList(surveyType, processInstanceId, insuredId),
1298
- this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1299
- ]);
1300
- if (baseQuestions.status === 'fulfilled') {
1301
- //@ts-ignore
1302
- this.formStore[baseField] = baseQuestions.value;
1303
- }
1304
- if (secondaryQuestions.status === 'fulfilled') {
1305
- //@ts-ignore
1306
- this.formStore[secondaryField] = secondaryQuestions;
1307
- }
1308
- }
1309
- if (whichMember === 'policyholder') {
1310
- const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1311
- this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
1312
- this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1313
- ]);
1314
- if (baseQuestions.status === 'fulfilled') {
1315
- //@ts-ignore
1316
- this.formStore[baseField] = baseQuestions.value;
1317
- }
1318
- if (secondaryQuestions.status === 'fulfilled') {
1319
- //@ts-ignore
1320
- this.formStore[secondaryField] = secondaryQuestions;
1293
+ const [baseQuestions, secondaryQuestions] = await Promise.allSettled([
1294
+ whichMember === 'insured'
1295
+ ? this.api.getQuestionList(surveyType, processInstanceId, insuredId)
1296
+ : this.api.getClientQuestionList(surveyType, processInstanceId, insuredId),
1297
+ whichMember === 'insured'
1298
+ ? this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId)
1299
+ : this.api.getClientQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1300
+ ,
1301
+ ]);
1302
+ if (baseQuestions.status === 'fulfilled') {
1303
+ this.formStore[baseField] = baseQuestions.value;
1304
+ }
1305
+ if (secondaryQuestions.status === 'fulfilled') {
1306
+ const baseAnketa = this.formStore[baseField];
1307
+ if (baseAnketa && baseAnketa.body && baseAnketa.body.length) {
1308
+ baseAnketa.body.forEach(i => {
1309
+ if (i.first.definedAnswers === 'Y' && i.second === null && secondaryQuestions.value) {
1310
+ i.second = structuredClone(secondaryQuestions.value);
1311
+ }
1312
+ });
1321
1313
  }
1322
1314
  }
1323
1315
  } catch (err) {
1324
- console.log(err);
1316
+ ErrorHandler(err);
1325
1317
  }
1326
1318
  }
1327
- //@ts-ignore
1328
1319
  return this.formStore[baseField];
1329
1320
  },
1330
1321
  getNumberWithSpaces(n: any) {
@@ -1541,7 +1532,7 @@ export const useDataStore = defineStore('data', {
1541
1532
  calculationData.amountInCurrency = getNumber(String(this.formStore.productConditionsForm.requestedSumInsuredInDollar));
1542
1533
  calculationData.currencyExchangeRate = this.currencies.usd;
1543
1534
  }
1544
- if (this.isLiferenta) {
1535
+ if (this.isLiferenta || product === 'liferenta') {
1545
1536
  calculationData.guaranteedPaymentPeriod = this.formStore.productConditionsForm.guaranteedPeriod || 0;
1546
1537
  calculationData.annuityTypeId = (this.formStore.productConditionsForm.typeAnnuityInsurance.id as string) ?? undefined;
1547
1538
  calculationData.paymentPeriod = Number(this.formStore.productConditionsForm.termAnnuityPayments);
@@ -1558,9 +1549,15 @@ export const useDataStore = defineStore('data', {
1558
1549
  this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar = this.getNumberWithSpaces(calculationResponse.premiumInCurrency);
1559
1550
  }
1560
1551
  }
1561
- if (this.isLiferenta) {
1552
+ if (this.isLiferenta || product === 'liferenta') {
1562
1553
  this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(calculationResponse.annuityMonthPay);
1563
1554
  }
1555
+ if (this.isGons || product === 'gons') {
1556
+ this.formStore.productConditionsForm.totalAmount5 = this.getNumberWithSpaces(calculationResponse.totalAmount5);
1557
+ this.formStore.productConditionsForm.totalAmount7 = this.getNumberWithSpaces(calculationResponse.totalAmount7);
1558
+ this.formStore.productConditionsForm.statePremium5 = this.getNumberWithSpaces(calculationResponse.statePremium5);
1559
+ this.formStore.productConditionsForm.statePremium7 = this.getNumberWithSpaces(calculationResponse.statePremium7);
1560
+ }
1564
1561
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1565
1562
  } catch (err) {
1566
1563
  ErrorHandler(err);
@@ -1596,6 +1593,7 @@ export const useDataStore = defineStore('data', {
1596
1593
  if (this.isLiferenta) {
1597
1594
  this.formStore.productConditionsForm.amountAnnuityPayments = this.getNumberWithSpaces(applicationData.policyAppDto.annuityMonthPay);
1598
1595
  }
1596
+
1599
1597
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1600
1598
  } catch (err) {
1601
1599
  ErrorHandler(err);
@@ -2087,6 +2085,9 @@ export const useDataStore = defineStore('data', {
2087
2085
  const recalculatedValue = await this.api.reCalculate(data);
2088
2086
  if (!!recalculatedValue) {
2089
2087
  await this.getApplicationData(taskId, false, false, false, true);
2088
+ if (this.isGons) {
2089
+ this.formStore.productConditionsForm.isRecalculated = true;
2090
+ }
2090
2091
  this.showToaster(
2091
2092
  'success',
2092
2093
  `${this.t('toaster.successRecalculation')}. ${whichSum == 'insurancePremiumPerMonth' ? 'Страховая премия' : 'Страховая сумма'}: ${this.getNumberWithSpaces(
@@ -2247,13 +2248,26 @@ export const useDataStore = defineStore('data', {
2247
2248
  if (!anketa) return false;
2248
2249
  const list = anketa.body;
2249
2250
  if (!list || (list && list.length === 0)) return false;
2250
- let notAnswered = 0;
2251
- for (let x = 0; x < list.length; x++) {
2252
- if ((list[x].first.definedAnswers === 'N' && !list[x].first.answerText) || (list[x].first.definedAnswers === 'Y' && !list[x].first.answerName)) {
2253
- notAnswered = notAnswered + 1;
2251
+ const isAnketaValid = ref<boolean>(true);
2252
+ list.forEach(i => {
2253
+ if ((i.first.definedAnswers === 'N' && !i.first.answerText) || (i.first.definedAnswers === 'Y' && !i.first.answerName)) {
2254
+ isAnketaValid.value = false;
2255
+ return false;
2254
2256
  }
2255
- }
2256
- return notAnswered === 0;
2257
+ if (this.controls.isSecondAnketaRequired && i.first.definedAnswers === 'Y' && i.first.answerName?.match(new RegExp('Да', 'i'))) {
2258
+ if (i.second && i.second.length) {
2259
+ const isValid = i.second.every(second => (second.definedAnswers === 'N' ? !!second.answerText : !!second.answerName));
2260
+ if (!isValid) {
2261
+ isAnketaValid.value = false;
2262
+ this.showToaster('info', this.t('toaster.emptySecondAnketa', { text: i.first.name }), 5000);
2263
+ return false;
2264
+ }
2265
+ } else {
2266
+ // TODO уточнить
2267
+ }
2268
+ }
2269
+ });
2270
+ return isAnketaValid.value;
2257
2271
  },
2258
2272
  async validateAllForms(taskId: string) {
2259
2273
  this.isLoading = true;
@@ -2263,27 +2277,14 @@ export const useDataStore = defineStore('data', {
2263
2277
  const hasCritical = this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName === 'Критическое заболевание Застрахованного');
2264
2278
  if (hasCritical && hasCritical.coverSumName.match(new RegExp('не включено', 'i'))) {
2265
2279
  await Promise.allSettled([
2266
- this.getQuestionList(
2267
- 'health',
2268
- this.formStore.applicationData.processInstanceId,
2269
- this.formStore.applicationData.insuredApp[0].id,
2270
- 'surveyByHealthBase',
2271
- 'surveyByHealthSecond',
2272
- ),
2273
- this.getQuestionList(
2274
- 'critical',
2275
- this.formStore.applicationData.processInstanceId,
2276
- this.formStore.applicationData.insuredApp[0].id,
2277
- 'surveyByCriticalBase',
2278
- 'surveyByCriticalSecond',
2279
- ),
2280
+ this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
2281
+ this.getQuestionList('critical', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByCriticalBase'),
2280
2282
  this.isClientAnketaCondition &&
2281
2283
  this.getQuestionList(
2282
2284
  'health',
2283
2285
  this.formStore.applicationData.processInstanceId,
2284
2286
  this.formStore.applicationData.clientApp.id,
2285
2287
  'surveyByHealthBasePolicyholder',
2286
- 'surveyByHealthSecond',
2287
2288
  'policyholder',
2288
2289
  ),
2289
2290
  ]);
@@ -2309,20 +2310,13 @@ export const useDataStore = defineStore('data', {
2309
2310
  ]);
2310
2311
  } else {
2311
2312
  await Promise.allSettled([
2312
- this.getQuestionList(
2313
- 'health',
2314
- this.formStore.applicationData.processInstanceId,
2315
- this.formStore.applicationData.insuredApp[0].id,
2316
- 'surveyByHealthBase',
2317
- 'surveyByHealthSecond',
2318
- ),
2313
+ this.getQuestionList('health', this.formStore.applicationData.processInstanceId, this.formStore.applicationData.insuredApp[0].id, 'surveyByHealthBase'),
2319
2314
  this.isClientAnketaCondition &&
2320
2315
  this.getQuestionList(
2321
2316
  'health',
2322
2317
  this.formStore.applicationData.processInstanceId,
2323
2318
  this.formStore.applicationData.clientApp.id,
2324
2319
  'surveyByHealthBasePolicyholder',
2325
- 'surveyByHealthSecond',
2326
2320
  'policyholder',
2327
2321
  ),
2328
2322
  ,
package/store/rules.ts CHANGED
@@ -5,6 +5,7 @@ const t = i18n.t;
5
5
 
6
6
  export const rules = {
7
7
  recalculationMultiply: [(v: any) => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher', { text: '100' })],
8
+ recalculationMultiplyBetween: [(v: any) => (v !== null && v !== '' && v >= 100 && v <= 200) || t('toaster.recalculationMultiplyBetween', { floor: '100', ceil: '200' })],
8
9
  recalculationAdditive: [(v: any) => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween', { floor: '0', ceil: '100' })],
9
10
  required: [(v: any) => !!v || t('rules.required')],
10
11
  objectRequired: [
package/types/index.ts CHANGED
@@ -141,7 +141,7 @@ declare global {
141
141
 
142
142
  type AnketaBody = {
143
143
  first: EachAnketa;
144
- second: any[] | null;
144
+ second: AnketaSecond[] | null;
145
145
  };
146
146
 
147
147
  type EachAnketa = {
@@ -251,6 +251,10 @@ declare global {
251
251
  type RecalculationResponseType = {
252
252
  amount: number;
253
253
  premium: number;
254
+ statePremium5?: number;
255
+ statePremium7?: number;
256
+ totalAmount5?: number;
257
+ totalAmount7?: number;
254
258
  mainCoverPremium: number;
255
259
  addCovers: AddCover[];
256
260
  amountInCurrency: number;
@@ -414,7 +418,7 @@ declare global {
414
418
  stateName?: string;
415
419
  cityCode?: string | number;
416
420
  cityName?: string;
417
- regionCode?: string | number |null;
421
+ regionCode?: string | number | null;
418
422
  regionName?: string | null;
419
423
  streetName?: string;
420
424
  blockNumber?: string;