hl-core 0.0.8-beta.2 → 0.0.8-beta.20

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 (41) hide show
  1. package/api/index.ts +42 -14
  2. package/api/interceptors.ts +1 -1
  3. package/components/Dialog/Dialog.vue +6 -3
  4. package/components/Form/FormBlock.vue +63 -28
  5. package/components/Form/FormSection.vue +4 -1
  6. package/components/Form/ManagerAttachment.vue +196 -0
  7. package/components/Form/ProductConditionsBlock.vue +64 -12
  8. package/components/Input/FormInput.vue +12 -3
  9. package/components/Input/PanelInput.vue +5 -0
  10. package/components/Layout/Drawer.vue +1 -0
  11. package/components/Layout/Header.vue +40 -4
  12. package/components/Layout/SettingsPanel.vue +35 -8
  13. package/components/Menu/MenuHover.vue +30 -0
  14. package/components/Menu/MenuNav.vue +27 -10
  15. package/components/Pages/Anketa.vue +8 -4
  16. package/components/Pages/Auth.vue +147 -30
  17. package/components/Pages/InvoiceInfo.vue +30 -0
  18. package/components/Pages/MemberForm.vue +274 -79
  19. package/components/Pages/ProductConditions.vue +291 -7
  20. package/components/Panel/PanelHandler.vue +74 -1
  21. package/components/Utilities/JsonViewer.vue +27 -0
  22. package/composables/classes.ts +126 -23
  23. package/composables/constants.ts +11 -1
  24. package/composables/styles.ts +9 -3
  25. package/configs/i18n.ts +19 -0
  26. package/layouts/default.vue +2 -2
  27. package/locales/en.json +558 -0
  28. package/locales/kz.json +558 -0
  29. package/locales/ru.json +558 -0
  30. package/nuxt.config.ts +8 -0
  31. package/package.json +7 -2
  32. package/pages/500.vue +1 -1
  33. package/pages/Token.vue +51 -0
  34. package/plugins/helperFunctionsPlugins.ts +2 -0
  35. package/plugins/storePlugin.ts +0 -1
  36. package/plugins/vuetifyPlugin.ts +5 -0
  37. package/store/data.store.js +472 -530
  38. package/store/member.store.ts +120 -15
  39. package/store/rules.js +27 -3
  40. package/types/index.ts +34 -0
  41. package/store/messages.ts +0 -434
@@ -13,6 +13,16 @@
13
13
  subtitle="Если несовершеннолетний не достиг возраста 14 лет - законному представителю в соответствии с законодательством Республики Казахстан"
14
14
  ></base-form-text-section>
15
15
  </base-form-section>
16
+ <base-form-section v-if="isUnderwriterRole && $dataStore.members.insuredApp.has === true" :title="$t('insuredForm')">
17
+ <div v-for="(insured, index) of formStore.insuredForm" :key="index">
18
+ <base-form-input v-model="insured.longName" :label="$t('labels.insurerLongName')" :readonly="true"> </base-form-input>
19
+ <base-form-input v-model="insured.job" :label="$t('form.job')" :readonly="true"> </base-form-input>
20
+ <base-form-input v-model="insured.jobPosition" :label="$t('form.jobPosition')" :readonly="true"> </base-form-input>
21
+ <base-form-input v-model="insured.birthDate" :label="$t('form.birthDate')" :readonly="true"> </base-form-input>
22
+ <base-form-input v-model="insured.age" :label="$t('form.age')" :readonly="true"> </base-form-input>
23
+ <base-form-input v-model="insured.gender.nameRu" class="mb-4" :label="$t('form.gender')" :readonly="true"> </base-form-input>
24
+ </div>
25
+ </base-form-section>
16
26
  <base-form-section v-if="isUnderwriterRole" :title="$t('recalculationInfo')">
17
27
  <base-form-input
18
28
  v-model="productConditionsForm.lifeMultiply"
@@ -31,6 +41,7 @@
31
41
  :rules="$dataStore.rules.recalculationAdditive"
32
42
  ></base-form-input>
33
43
  <base-form-input
44
+ v-if="hasAdbMultiply"
34
45
  v-model="productConditionsForm.adbMultiply"
35
46
  :maska="$maska.numbers"
36
47
  :clearable="isRecalculationDisabled === false"
@@ -39,6 +50,7 @@
39
50
  :rules="$dataStore.rules.recalculationMultiply"
40
51
  ></base-form-input>
41
52
  <base-form-input
53
+ v-if="hasAdbAdditive"
42
54
  v-model="productConditionsForm.adbAdditive"
43
55
  :maska="$maska.numbers"
44
56
  :clearable="isRecalculationDisabled === false"
@@ -64,6 +76,7 @@
64
76
  >
65
77
  </base-form-input>
66
78
  <base-panel-input
79
+ v-if="hasRiskGroup"
67
80
  v-model="productConditionsForm.riskGroup"
68
81
  :value="productConditionsForm.riskGroup.nameRu"
69
82
  :label="$t('productConditionsForm.riskGroup')"
@@ -108,10 +121,11 @@
108
121
  :maska="$maska.numbers"
109
122
  :readonly="isDisabled"
110
123
  :clearable="!isDisabled"
111
- :rules="$rules.required.concat($rules.numbers, $rules.coverPeriodFrom3to20)"
112
- :label="$t('productConditionsForm.coverPeriodFrom3to20')"
124
+ :rules="coverPeriodRule"
125
+ :label="$t($dataStore.isGons ? 'productConditionsForm.coverPeriodFrom3to20' : 'productConditionsForm.coverPeriod')"
113
126
  ></base-form-input>
114
127
  <base-panel-input
128
+ v-if="hasPaymentPeriod"
115
129
  v-model="productConditionsForm.paymentPeriod"
116
130
  :value="productConditionsForm.paymentPeriod.nameRu"
117
131
  :readonly="isDisabled"
@@ -121,12 +135,35 @@
121
135
  append-inner-icon="mdi mdi-chevron-right"
122
136
  @append="openPanel($t('productConditionsForm.processPaymentPeriod'), $dataStore.processPaymentPeriod, 'paymentPeriod', $dataStore.getProcessPaymentPeriod)"
123
137
  ></base-panel-input>
138
+ <base-panel-input
139
+ v-if="hasProcessIndexRate"
140
+ v-model="productConditionsForm.processIndexRate"
141
+ :value="productConditionsForm.processIndexRate.nameRu"
142
+ :readonly="isDisabled"
143
+ :clearable="!isDisabled"
144
+ :rules="$rules.objectRequired"
145
+ :label="$t('productConditionsForm.processIndexRate')"
146
+ append-inner-icon="mdi mdi-chevron-right"
147
+ @append="openPanel($t('productConditionsForm.processIndexRate'), $dataStore.processIndexRate, 'processIndexRate', $dataStore.getProcessIndexRate)"
148
+ ></base-panel-input>
124
149
  <base-form-input
125
150
  v-model="productConditionsForm.requestedSumInsured"
126
151
  :readonly="isDisabled"
127
152
  :clearable="!isDisabled"
128
153
  :rules="requestedSumInsured"
129
154
  :label="$t('productConditionsForm.requestedSumInsured')"
155
+ :suffix="$constants.currencySymbols.kzt"
156
+ @input="onInputSum"
157
+ ></base-form-input>
158
+ <base-form-input
159
+ v-if="hasRequestedSumInsuredInDollar"
160
+ v-model="productConditionsForm.requestedSumInsuredInDollar"
161
+ :readonly="isDisabled"
162
+ :clearable="!isDisabled"
163
+ :rules="requestedSumInsured"
164
+ :label="$t('productConditionsForm.requestedSumInsuredInDollar')"
165
+ :suffix="$constants.currencySymbols.usd"
166
+ @input="onInputSumDollar"
130
167
  ></base-form-input>
131
168
  <base-form-input
132
169
  v-model="productConditionsForm.insurancePremiumPerMonth"
@@ -134,9 +171,43 @@
134
171
  :clearable="!isDisabled"
135
172
  :rules="insurancePremiumPerMonth"
136
173
  :label="$t('productConditionsForm.insurancePremiumAmount')"
174
+ :suffix="$constants.currencySymbols.kzt"
175
+ @input="onInputInsurancePremiumPerMonth"
176
+ ></base-form-input>
177
+ <base-form-input
178
+ v-if="hasInsurancePremiumPerMonthInDollar"
179
+ v-model="productConditionsForm.insurancePremiumPerMonthInDollar"
180
+ :readonly="isDisabled"
181
+ :clearable="!isDisabled"
182
+ :rules="insurancePremiumPerMonth"
183
+ :label="$t('productConditionsForm.insurancePremiumAmountInDollar')"
184
+ :suffix="$constants.currencySymbols.usd"
185
+ @input="onInputInsurancePremiumPerMonthInDollar"
137
186
  ></base-form-input>
187
+ <base-form-input
188
+ v-if="hasCurrency && $dataStore.currencies.usd"
189
+ v-model="$dataStore.currencies.usd"
190
+ :readonly="true"
191
+ :label="$t('productConditionsForm.dollarExchangeRateNBRK')"
192
+ :suffix="$constants.currencySymbols.kzt"
193
+ ></base-form-input>
194
+ </base-form-section>
195
+ <base-form-section v-if="additionalTerms && additionalTerms.length" :title="$t('productConditionsForm.additional')">
196
+ <div v-for="(term, index) of additionalTerms" :key="index">
197
+ <base-panel-input
198
+ v-model="additionalTerms[index]"
199
+ :value="term.coverSumName"
200
+ :readonly="isDisabled"
201
+ :clearable="!isDisabled"
202
+ :label="term.coverTypeName"
203
+ append-inner-icon="mdi mdi-chevron-right"
204
+ :suffix="!!term.amount ? `${$dataStore.getNumberWithSpaces(term.amount)} ${currencySymbolsAddTerm}` : ''"
205
+ @append="openTermPanel(term.coverTypeName, $dataStore.getAdditionalInsuranceTermsAnswers, term.coverTypeId, index)"
206
+ ></base-panel-input>
207
+ </div>
138
208
  </base-form-section>
139
209
  </v-form>
210
+ <base-btn v-if="isRecalculation && hasCalculated" :btn="$libStyles.greenLightBtn" :text="$t('buttons.toStatement')" @click="toStatement"></base-btn>
140
211
  <base-btn
141
212
  v-if="!isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
142
213
  :loading="isCalculating"
@@ -163,6 +234,21 @@
163
234
  <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50"></base-loader>
164
235
  </div>
165
236
  </Teleport>
237
+ <Teleport v-if="isTermsPanelOpen" to="#panel-actions">
238
+ <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
239
+ <base-rounded-input v-model="searchQuery" :label="$t('labels.search')" class="w-full p-2" :hide-details="true"></base-rounded-input>
240
+ <div v-if="panelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
241
+ <base-panel-select-item
242
+ v-for="(item, index) of panelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
243
+ :key="index"
244
+ :text="(item.nameRu as string)"
245
+ :selected="item.nameRu === termValue?.coverSumName"
246
+ @click="pickTermValue(item)"
247
+ ></base-panel-select-item>
248
+ </div>
249
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50"></base-loader>
250
+ </div>
251
+ </Teleport>
166
252
  </section>
167
253
  </template>
168
254
 
@@ -187,13 +273,17 @@ export default defineComponent({
187
273
  const isCalculating = ref<boolean>(false);
188
274
  const isPanelLoading = ref<boolean>(false);
189
275
  const isPanelOpen = ref<boolean>(false);
276
+ const isTermsPanelOpen = ref<boolean>(false);
190
277
  const panelValue = ref<Value>(new Value());
278
+ const termValue = ref<AddCover>();
191
279
  const panelList = ref<Value[]>([]);
192
280
  const productConditionsForm = formStore.productConditionsForm;
193
281
  const currentPanel = ref<keyof typeof productConditionsForm>();
282
+ const currentIndex = ref<number>();
194
283
  const searchQuery = ref<string>('');
195
284
  const whichSum = ref<'insurancePremiumPerMonth' | 'requestedSumInsured' | ''>('');
196
285
 
286
+ const additionalTerms = ref<AddCover[]>([]);
197
287
  const isUnderwriterForm = computed(() => {
198
288
  if (route.params.taskId === '0 ' || props.isRecalculation === true) {
199
289
  return false;
@@ -207,19 +297,108 @@ export default defineComponent({
207
297
  const isUnderwriterRole = computed(() => dataStore.isUnderwriter() || dataStore.isAdmin() || dataStore.isSupport());
208
298
  const insurancePremiumPerMonth = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
209
299
  const requestedSumInsured = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
300
+ const hasCalculated = computed(() => !!productConditionsForm.requestedSumInsured && !!productConditionsForm.insurancePremiumPerMonth);
301
+ const hasProcessIndexRate = computed(() => {
302
+ if (dataStore.isGons || dataStore.isKazyna) {
303
+ return false;
304
+ }
305
+ return true;
306
+ });
307
+ const hasPaymentPeriod = computed(() => {
308
+ if (dataStore.isKazyna) {
309
+ return false;
310
+ }
311
+ return true;
312
+ });
313
+ const hasRequestedSumInsuredInDollar = computed(() => {
314
+ if (dataStore.isKazyna) {
315
+ return true;
316
+ }
317
+ return false;
318
+ });
319
+ const hasInsurancePremiumPerMonthInDollar = computed(() => {
320
+ if (dataStore.isKazyna) {
321
+ return true;
322
+ }
323
+ return false;
324
+ });
325
+ const hasCurrency = computed(() => {
326
+ if (dataStore.isKazyna) {
327
+ return true;
328
+ }
329
+ return false;
330
+ });
331
+ const hasAdbMultiply = computed(() => {
332
+ if (dataStore.isGons) {
333
+ return false;
334
+ }
335
+ return true;
336
+ });
337
+ const hasAdbAdditive = computed(() => {
338
+ if (dataStore.isGons) {
339
+ return false;
340
+ }
341
+ return true;
342
+ });
343
+ const hasRiskGroup = computed(() => {
344
+ if (dataStore.isGons) {
345
+ return false;
346
+ }
347
+ return true;
348
+ });
349
+ const coverPeriodRule = computed(() => {
350
+ const baseCondition = dataStore.rules.required.concat(dataStore.rules.numbers);
351
+ if (dataStore.isGons) {
352
+ return baseCondition.concat(dataStore.rules.coverPeriodFrom3to20);
353
+ }
354
+ if (dataStore.isKazyna) {
355
+ return baseCondition.concat(dataStore.rules.coverPeriodFrom2to20);
356
+ }
357
+ return baseCondition;
358
+ });
359
+ const currencySymbolsAddTerm = computed(() => {
360
+ if (dataStore.isKazyna) {
361
+ return constants.currencySymbols.usd;
362
+ }
363
+ return constants.currencySymbols.kzt;
364
+ });
365
+
366
+ const toStatement = async () => {
367
+ const statementItem = dataStore.menuItems.find(i => i.id === 'statement');
368
+ if (statementItem) {
369
+ dataStore.menu.selectedItem = statementItem;
370
+ await router.replace({
371
+ name: 'taskId',
372
+ query: {
373
+ ...route.query,
374
+ tab: 'statement',
375
+ },
376
+ });
377
+ }
378
+ };
210
379
 
211
380
  const pickPanelValue = (item: Value) => {
212
381
  dataStore.panel.open = false;
213
382
  isPanelOpen.value = false;
383
+ if (!currentPanel.value) return;
214
384
  // @ts-ignore
215
385
  productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
216
386
  };
217
387
 
388
+ const pickTermValue = (item: Value) => {
389
+ dataStore.panel.open = false;
390
+ isTermsPanelOpen.value = false;
391
+ if (typeof currentIndex.value !== 'number') return;
392
+ additionalTerms.value[currentIndex.value].coverSumId = item.id as string;
393
+ additionalTerms.value[currentIndex.value].coverSumName = item.nameRu as string;
394
+ };
395
+
218
396
  const openPanel = async (title: string, list: Value[], key: string, asyncFunction?: Function, filterKey?: string) => {
219
397
  if (!isDisabled.value || (key === 'riskGroup' && !isRecalculationDisabled.value)) {
220
398
  searchQuery.value = '';
221
399
  currentPanel.value = key as keyof typeof productConditionsForm;
222
400
  isPanelOpen.value = true;
401
+ isTermsPanelOpen.value = false;
223
402
  dataStore.panelAction = null;
224
403
  dataStore.panel.open = true;
225
404
  dataStore.panel.title = title;
@@ -229,7 +408,7 @@ export default defineComponent({
229
408
  isPanelLoading.value = true;
230
409
  newList = await asyncFunction(filterKey, formStore.productConditionsFormKey);
231
410
  }
232
- panelList.value = newList;
411
+ panelList.value = filterList(newList, key);
233
412
  // @ts-ignore
234
413
  panelValue.value = productConditionsForm[currentPanel.value];
235
414
  isPanelLoading.value = false;
@@ -238,6 +417,39 @@ export default defineComponent({
238
417
  }
239
418
  };
240
419
 
420
+ const filterList = (list: Value[], key: string) => {
421
+ if (dataStore.isBaiterek) {
422
+ if (dataStore.isManagerHalykBank()) {
423
+ if (key === 'paymentPeriod') return list.filter(i => i.code !== 'single');
424
+ }
425
+ }
426
+ return list;
427
+ };
428
+
429
+ const openTermPanel = async (title: string, asyncFunction: Function, questionId: string, index: number) => {
430
+ if (!isDisabled.value) {
431
+ searchQuery.value = '';
432
+ currentIndex.value = index;
433
+ isPanelOpen.value = false;
434
+ isTermsPanelOpen.value = true;
435
+ dataStore.panelAction = null;
436
+ dataStore.panel.open = true;
437
+ dataStore.panel.title = title;
438
+
439
+ let newList;
440
+ if (asyncFunction) {
441
+ isPanelLoading.value = true;
442
+ newList = await asyncFunction(questionId);
443
+ }
444
+ panelList.value = newList;
445
+ // @ts-ignore
446
+ termValue.value = additionalTerms.value[index];
447
+ isPanelLoading.value = false;
448
+ } else {
449
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
450
+ }
451
+ };
452
+
241
453
  const underwriterCalculate = async (type: 'sum' | 'premium') => {
242
454
  if (!type) return;
243
455
  if (type === 'sum') {
@@ -255,6 +467,46 @@ export default defineComponent({
255
467
  await submitForm();
256
468
  };
257
469
 
470
+ const onInputInsurancePremiumPerMonth = (event: Event) => {
471
+ if (event.target && 'value' in event.target && event.target.value && dataStore.currencies.usd) {
472
+ const calculatedPremiumDollar = getNumber(event.target.value as string);
473
+ if (calculatedPremiumDollar) {
474
+ productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(productConditionsForm.insurancePremiumPerMonth);
475
+ productConditionsForm.insurancePremiumPerMonthInDollar = dataStore.getNumberWithSpaces(calculatedPremiumDollar / dataStore.currencies.usd);
476
+ }
477
+ }
478
+ };
479
+
480
+ const onInputInsurancePremiumPerMonthInDollar = (event: Event) => {
481
+ if (event.target && 'value' in event.target && event.target.value && dataStore.currencies.usd) {
482
+ const calculatedPremium = getNumber(event.target.value as string);
483
+ if (calculatedPremium) {
484
+ productConditionsForm.insurancePremiumPerMonthInDollar = dataStore.getNumberWithSpaces(productConditionsForm.insurancePremiumPerMonthInDollar);
485
+ productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(calculatedPremium * dataStore.currencies.usd);
486
+ }
487
+ }
488
+ };
489
+
490
+ const onInputSum = (event: Event) => {
491
+ if (event.target && 'value' in event.target && event.target.value && dataStore.currencies.usd) {
492
+ const calculatedSumDollar = getNumber(event.target.value as string);
493
+ if (calculatedSumDollar) {
494
+ productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(productConditionsForm.requestedSumInsured);
495
+ productConditionsForm.requestedSumInsuredInDollar = dataStore.getNumberWithSpaces(calculatedSumDollar / dataStore.currencies.usd);
496
+ }
497
+ }
498
+ };
499
+
500
+ const onInputSumDollar = (event: Event) => {
501
+ if (event.target && 'value' in event.target && event.target.value && dataStore.currencies.usd) {
502
+ const calculatedSum = getNumber(event.target.value as string);
503
+ if (calculatedSum) {
504
+ productConditionsForm.requestedSumInsuredInDollar = dataStore.getNumberWithSpaces(productConditionsForm.requestedSumInsuredInDollar);
505
+ productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(calculatedSum * dataStore.currencies.usd);
506
+ }
507
+ }
508
+ };
509
+
258
510
  const submitForm = async () => {
259
511
  vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
260
512
  if (v.valid) {
@@ -322,11 +574,11 @@ export default defineComponent({
322
574
  if (errors) {
323
575
  const errorText = errors.querySelector('.v-label.v-field-label');
324
576
  if (errorText) {
325
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorText.innerHTML?.replace(/[-<>!//.]/g, '')));
577
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorText.innerHTML?.replace(/[-<>!//.]/g, '') }));
326
578
  } else {
327
579
  const errorFieldText = errors.querySelector('.v-input__control');
328
580
  if (errorFieldText) {
329
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '')));
581
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '') }));
330
582
  }
331
583
  }
332
584
  errors.scrollIntoView({
@@ -350,17 +602,25 @@ export default defineComponent({
350
602
  formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
351
603
  productConditionsForm.requestedSumInsured = defaultData.amount;
352
604
  productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
353
- productConditionsForm.processIndexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
354
- productConditionsForm.paymentPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
605
+ const indexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
606
+ if (indexRate) productConditionsForm.processIndexRate = indexRate;
607
+ const paymendPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
608
+ if (paymendPeriod) productConditionsForm.paymentPeriod = paymendPeriod;
355
609
  productConditionsForm.signDate = reformatDate(defaultData.signDate);
356
610
  }
357
611
  }
612
+ additionalTerms.value = props.isRecalculation ? formStore.additionalInsuranceTermsWithout : formStore.additionalInsuranceTerms;
358
613
  if (!!productConditionsForm.insurancePremiumPerMonth) {
359
614
  whichSum.value = 'insurancePremiumPerMonth';
360
615
  }
361
616
  if (!!productConditionsForm.requestedSumInsured) {
362
617
  whichSum.value = 'requestedSumInsured';
363
618
  }
619
+ if (dataStore.isKazyna) {
620
+ const kazynaPaymentPeriod = dataStore.processPaymentPeriod.find(i => i.code === 'single');
621
+ if (kazynaPaymentPeriod) productConditionsForm.paymentPeriod = kazynaPaymentPeriod;
622
+ await dataStore.getCurrencies();
623
+ }
364
624
  });
365
625
 
366
626
  watch(
@@ -395,6 +655,7 @@ export default defineComponent({
395
655
  () => {
396
656
  if (dataStore.panel.open === false) {
397
657
  isPanelOpen.value = false;
658
+ isTermsPanelOpen.value = false;
398
659
  dataStore.panelAction = null;
399
660
  }
400
661
  },
@@ -406,10 +667,13 @@ export default defineComponent({
406
667
  formStore,
407
668
  vForm,
408
669
  productConditionsForm,
670
+ additionalTerms,
409
671
  isCalculating,
410
672
  isPanelLoading,
411
673
  isPanelOpen,
674
+ isTermsPanelOpen,
412
675
  panelValue,
676
+ termValue,
413
677
  panelList,
414
678
  searchQuery,
415
679
  whichSum,
@@ -423,13 +687,33 @@ export default defineComponent({
423
687
  requestedSumInsured,
424
688
  isRecalculationDisabled,
425
689
  isUnderwriterRole,
690
+ hasProcessIndexRate,
691
+ hasPaymentPeriod,
692
+ hasRequestedSumInsuredInDollar,
693
+ hasInsurancePremiumPerMonthInDollar,
694
+ hasCurrency,
695
+ hasAdbMultiply,
696
+ hasAdbAdditive,
697
+ hasRiskGroup,
698
+ hasCalculated,
699
+ currencySymbolsAddTerm,
700
+
701
+ // Rules
702
+ coverPeriodRule,
426
703
 
427
704
  // Functions
428
705
  submitForm,
429
706
  pickPanelValue,
707
+ pickTermValue,
430
708
  openPanel,
709
+ openTermPanel,
431
710
  pickCalculation,
432
711
  underwriterCalculate,
712
+ onInputInsurancePremiumPerMonth,
713
+ onInputInsurancePremiumPerMonthInDollar,
714
+ onInputSum,
715
+ onInputSumDollar,
716
+ toStatement,
433
717
  };
434
718
  },
435
719
  });
@@ -9,7 +9,7 @@
9
9
  </section>
10
10
  <section v-if="acceptAction">
11
11
  <div :class="[$libStyles.flexColNav]">
12
- <base-content-block class="flex flex-col gap-3">
12
+ <base-content-block v-if="hasConditionsInfo" class="flex flex-col gap-3">
13
13
  <span
14
14
  >{{ `Сумма страховой премии ${paymentPeriod}:` }} <b>{{ `${insurancePremiumPerMonth}₸` }}</b></span
15
15
  >
@@ -89,6 +89,27 @@
89
89
  </base-fade-transition>
90
90
  </div>
91
91
  </section>
92
+ <section v-if="affiliateActions">
93
+ <div :class="[$libStyles.flexColNav]">
94
+ <v-form ref="vForm">
95
+ <base-content-block class="flex flex-col gap-3">
96
+ <base-form-input v-model="formStore.affilationResolution.number" :rules="$rules.required" :label="$t('form.documentNumber')"></base-form-input>
97
+ <base-form-input
98
+ v-model="formStore.affilationResolution.date"
99
+ :maska="$maska.date"
100
+ :rules="$rules.required"
101
+ :label="$t('form.date')"
102
+ append-inner-icon="mdi mdi-calendar-blank-outline"
103
+ ></base-form-input>
104
+ <base-file-input v-if="!affiliationDocument" @input.prevent="onFileChange($event)"></base-file-input>
105
+ <base-empty-form-field v-if="affiliationDocument" class="justify-between">
106
+ {{ `${affiliationDocument.fileTypeName} - ${affiliationDocument.fileName}` }}
107
+ <i class="cursor-pointer mdi mdi-file-document mr-6 text-[#a0b3d8] text-xl"></i> </base-empty-form-field
108
+ ></base-content-block>
109
+ </v-form>
110
+ <base-btn :text="buttonText" :loading="loading" @click="submitForm"></base-btn>
111
+ </div>
112
+ </section>
92
113
  </template>
93
114
 
94
115
  <script lang="ts">
@@ -103,6 +124,19 @@ export default defineComponent({
103
124
  const isSendNumberOpen = ref<boolean>(false);
104
125
  const phoneNumber = ref<string | null>(formStore.policyholderForm.phoneNumber ?? '');
105
126
  const selectedClient = ref<SignUrlType>();
127
+ const documentDict = computed(() => dataStore.dicFileTypeList.find(i => i.nameRu === 'Решение АС'));
128
+ const affiliationDocument = computed(() => formStore.signedDocumentList.find(file => file.fileTypeName === 'Решение АС'));
129
+ const affiliationData = ref<{
130
+ processInstanceId: string | number;
131
+ fileTypeId: string | number | null;
132
+ fileTypeCode: string | number | null;
133
+ fileName?: string | number | null;
134
+ }>({
135
+ processInstanceId: formStore.applicationData.processInstanceId,
136
+ fileTypeId: documentDict.value ? documentDict.value.id : '',
137
+ fileTypeCode: documentDict.value ? documentDict.value.code : '',
138
+ });
139
+ const affiliationFormData = ref(new FormData());
106
140
 
107
141
  const openSmsPanel = (signInfo: SignUrlType) => {
108
142
  if (signInfo) {
@@ -121,6 +155,17 @@ export default defineComponent({
121
155
  dataStore.panelAction = null;
122
156
  };
123
157
 
158
+ const onFileChange = (event: InputEvent) => {
159
+ if (event.target) {
160
+ const files = (event.target as HTMLInputElement).files;
161
+ if (files && files.length && files[0].name !== affiliationData.value.fileName) {
162
+ affiliationData.value.fileName = files[0].name;
163
+ affiliationFormData.value.append('file', files[0]);
164
+ affiliationFormData.value.append('fileData', JSON.stringify([affiliationData.value]));
165
+ }
166
+ }
167
+ };
168
+
124
169
  const submitForm = async () => {
125
170
  await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
126
171
  if (v.valid) {
@@ -128,8 +173,21 @@ export default defineComponent({
128
173
  switch (dataStore.panelAction) {
129
174
  case constants.actions.pay:
130
175
  await dataStore.sendSMS('PayUrl', phoneNumber.value, formStore.epayLink);
176
+ break;
131
177
  case constants.actions.sign:
132
178
  await dataStore.sendSMS('SignUrl', phoneNumber.value, selectedClient.value?.uri);
179
+ break;
180
+ case constants.actions.affiliate:
181
+ formStore.affilationResolution.processInstanceId = formStore.applicationData.processInstanceId;
182
+ let uploaded, confirmed;
183
+ confirmed = await dataStore.setConfirmation();
184
+ if (affiliationData.value.fileName) {
185
+ uploaded = await dataStore.uploadFiles(affiliationFormData.value);
186
+ }
187
+ if ((affiliationData.value.fileName && confirmed && uploaded) || (!affiliationData.value.fileName && confirmed)) {
188
+ await handleTask();
189
+ }
190
+ break;
133
191
  default:
134
192
  await handleTask();
135
193
  }
@@ -157,6 +215,10 @@ export default defineComponent({
157
215
  return dataStore.t('buttons.sign');
158
216
  case constants.actions.pay:
159
217
  return dataStore.t('buttons.pay');
218
+ case constants.actions.register:
219
+ return dataStore.t('buttons.register');
220
+ case constants.actions.affiliate:
221
+ return dataStore.t('buttons.send');
160
222
  }
161
223
  });
162
224
 
@@ -176,9 +238,16 @@ export default defineComponent({
176
238
  const acceptAction = computed(() => dataStore.panelAction === constants.actions.accept);
177
239
  const signingActions = computed(() => dataStore.panelAction === constants.actions.sign);
178
240
  const payingActions = computed(() => dataStore.panelAction === constants.actions.pay);
241
+ const affiliateActions = computed(() => dataStore.panelAction === constants.actions.affiliate);
179
242
  const paymentPeriod = computed(() => formStore.productConditionsForm.paymentPeriod.nameRu);
180
243
  const insurancePremiumPerMonth = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.insurancePremiumPerMonth));
181
244
  const requestedSumInsured = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.requestedSumInsured));
245
+ const hasConditionsInfo = computed(() => {
246
+ if (dataStore.isFinCenter()) {
247
+ return false;
248
+ }
249
+ return true;
250
+ });
182
251
 
183
252
  return {
184
253
  // State
@@ -196,6 +265,7 @@ export default defineComponent({
196
265
  handleTask,
197
266
  openSmsPanel,
198
267
  openEpayPanel,
268
+ onFileChange,
199
269
 
200
270
  // Computed
201
271
  buttonText,
@@ -203,9 +273,12 @@ export default defineComponent({
203
273
  signingActions,
204
274
  payingActions,
205
275
  acceptAction,
276
+ affiliateActions,
206
277
  paymentPeriod,
207
278
  insurancePremiumPerMonth,
208
279
  requestedSumInsured,
280
+ affiliationDocument,
281
+ hasConditionsInfo,
209
282
  };
210
283
  },
211
284
  });
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <vue-json-pretty
3
+ :data="(data as JSONDataType)"
4
+ :show-icon="true"
5
+ :show-line="true"
6
+ :show-line-number="true"
7
+ :show-double-quotes="true"
8
+ :show-key-value-space="true"
9
+ :collapsed-on-click-brackets="true"
10
+ :deep="4"
11
+ ></vue-json-pretty>
12
+ </template>
13
+
14
+ <script lang="ts">
15
+ import VueJsonPretty from 'vue-json-pretty';
16
+ import 'vue-json-pretty/lib/styles.css';
17
+ import { JSONDataType } from 'vue-json-pretty/types/utils';
18
+
19
+ export default defineComponent({
20
+ components: { VueJsonPretty },
21
+ props: {
22
+ data: {
23
+ required: false,
24
+ },
25
+ },
26
+ });
27
+ </script>