hl-core 0.0.7-beta.17 → 0.0.7-beta.19

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
@@ -262,7 +262,7 @@ export class ApiClass {
262
262
  });
263
263
  }
264
264
 
265
- async getTaskList(data: any) {
265
+ async getTaskList(data: any): Promise<{ items: TaskListItem[]; totalItems: number }> {
266
266
  return this.axiosCall({
267
267
  method: Methods.POST,
268
268
  url: `/Arm/api/Bpm/TaskList`,
@@ -270,7 +270,7 @@ export class ApiClass {
270
270
  });
271
271
  }
272
272
 
273
- async getProcessHistory(id: any) {
273
+ async getProcessHistory(id: string): Promise<TaskHistory[]> {
274
274
  return this.axiosCall({
275
275
  url: `/Arm/api/Bpm/GetProcessHistory?processInstanceId=${id}`,
276
276
  });
@@ -449,6 +449,21 @@ export class ApiClass {
449
449
  });
450
450
  }
451
451
 
452
+ async calculateWithoutApplication(data: any) {
453
+ return this.axiosCall({
454
+ method: Methods.POST,
455
+ url: `/${this.productUrl}/api/Application/Calculate`,
456
+ data: data,
457
+ });
458
+ }
459
+
460
+ async getDefaultCalculationData() {
461
+ return this.axiosCall({
462
+ method: Methods.GET,
463
+ url: `/${this.productUrl}/api/Application/DefaultCalculatorValues`,
464
+ });
465
+ }
466
+
452
467
  async reCalculate(data: any) {
453
468
  return this.axiosCall({
454
469
  method: Methods.POST,
@@ -30,8 +30,6 @@ import { DocumentItem } from '@/composables/classes';
30
30
 
31
31
  export default defineComponent({
32
32
  setup() {
33
- type FileActions = 'view' | 'download';
34
-
35
33
  const dataStore = useDataStore();
36
34
  const formStore = useFormStore();
37
35
  const currentDocument = ref<DocumentItem>(new DocumentItem());
@@ -56,6 +56,8 @@
56
56
  </template>
57
57
 
58
58
  <script lang="ts">
59
+ import { Member } from '@/composables/classes';
60
+
59
61
  export default defineComponent({
60
62
  props: {
61
63
  title: {
@@ -67,7 +69,7 @@ export default defineComponent({
67
69
  default: '',
68
70
  },
69
71
  whichForm: {
70
- type: String as PropType<'policyholderForm' | 'insuredForm' | 'beneficiaryForm' | 'beneficialOwnerForm' | 'policyholdersRepresentativeForm' | 'productConditionsForm'>,
72
+ type: String as PropType<MemberFormTypes>,
71
73
  default: '',
72
74
  },
73
75
  more: {
@@ -84,14 +86,14 @@ export default defineComponent({
84
86
  const isMultiple = ref(multipleMembers.includes(props.whichForm));
85
87
  const member = formStore[props.whichForm as keyof typeof formStore];
86
88
 
87
- const getMemberInfo = (memberData: any) => {
89
+ const getMemberInfo = (memberData: Member) => {
88
90
  return {
89
91
  fullName: computed(() => (memberData && memberData.getFullNameShorted() ? memberData.getFullNameShorted() : null)).value,
90
92
  iin: computed(() => (memberData && memberData.iin ? memberData.iin : null)).value,
91
- gender: computed(() => (memberData && memberData.gender.nameRu ? memberData.gender.nameRu.charAt(0) : null)).value,
93
+ gender: computed(() => (memberData && memberData.gender.nameRu ? (memberData.gender.nameRu as string).charAt(0) : null)).value,
92
94
  birthDate: computed(() => (memberData && memberData.birthDate ? memberData.birthDate : null)).value,
93
- birthPlace: computed(() => (memberData && memberData.birthPlace.nameRu ? memberData.birthPlace.nameRu.substr(0, 3) : null)).value,
94
- sectorCode: computed(() => (memberData && memberData.economySectorCode.ids ? memberData.economySectorCode.ids.slice(-1) : null)).value,
95
+ birthPlace: computed(() => (memberData && memberData.birthPlace.nameRu ? (memberData.birthPlace.nameRu as string).substring(0, 3) : null)).value,
96
+ sectorCode: computed(() => (memberData && memberData.economySectorCode.ids ? (memberData.economySectorCode.ids as string).slice(-1) : null)).value,
95
97
  };
96
98
  };
97
99
 
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <div class="flex flex-col justify-between rounded-lg" :class="[$libStyles.whiteBg]">
3
+ <span v-if="title" class="p-4" :class="[$libStyles.textTitle]">{{ title }}</span>
4
+ <span v-if="subtitle" class="p-4 text-[#99A3B3] border-t-[1px]" :class="[$libStyles.textSimple]">{{ subtitle }}</span>
5
+ <slot></slot>
6
+ </div>
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ export default defineComponent({
11
+ props: {
12
+ title: {
13
+ type: String,
14
+ },
15
+ subtitle: {
16
+ type: String,
17
+ },
18
+ },
19
+ });
20
+ </script>
@@ -5,7 +5,7 @@
5
5
  <base-form-input
6
6
  v-model="member.iin"
7
7
  :label="$t('form.iin')"
8
- maska="###-###-###-###"
8
+ :maska="$maska.iin"
9
9
  :readonly="isDisabled || isIinPhoneDisabled"
10
10
  :clearable="!isDisabled"
11
11
  append-inner-icon="mdi mdi-magnify"
@@ -15,7 +15,7 @@
15
15
  <base-form-input
16
16
  v-model="member.phoneNumber"
17
17
  :label="$t('form.phoneNumber')"
18
- maska="+7 (7##) ### ## ##"
18
+ :maska="$maska.phone"
19
19
  :readonly="isDisabled || isIinPhoneDisabled"
20
20
  :clearable="!isDisabled"
21
21
  :append-inner-icon="otpCondition ? 'mdi mdi-phone-message' : ''"
@@ -28,7 +28,7 @@
28
28
  v-if="otpCondition && member.otpTokenId"
29
29
  v-model="member.otpCode"
30
30
  :label="$t('form.otpCode')"
31
- maska="# # # #"
31
+ :maska="$maska.otp"
32
32
  :append-inner-icon="hasOtp ? 'mdi mdi-check' : ''"
33
33
  @keyup.enter.prevent="hasOtp ? checkOtp() : null"
34
34
  ></base-form-input>
@@ -60,7 +60,7 @@
60
60
  :clearable="!isDisabled"
61
61
  :label="$t('form.birthDate')"
62
62
  :rules="$rules.required.concat($rules.birthDate)"
63
- maska="##.##.####"
63
+ :maska="$maska.date"
64
64
  append-inner-icon="mdi mdi-calendar-blank-outline"
65
65
  ></base-form-input>
66
66
  <base-form-input
@@ -153,7 +153,7 @@
153
153
  :readonly="isDisabled"
154
154
  :clearable="!isDisabled"
155
155
  :rules="$rules.date"
156
- maska="##.##.####"
156
+ :maska="$maska.date"
157
157
  append-inner-icon="mdi mdi-calendar-blank-outline"
158
158
  ></base-form-input>
159
159
  <base-form-input
@@ -162,7 +162,7 @@
162
162
  :readonly="isDisabled"
163
163
  :clearable="!isDisabled"
164
164
  :rules="$rules.date"
165
- maska="##.##.####"
165
+ :maska="$maska.date"
166
166
  append-inner-icon="mdi mdi-calendar-blank-outline"
167
167
  ></base-form-input>
168
168
  <base-form-input v-model="member.migrationCard" :label="$t('policyholdersRepresentative.numberVisa')"></base-form-input>
@@ -172,7 +172,7 @@
172
172
  :readonly="isDisabled"
173
173
  :clearable="!isDisabled"
174
174
  :rules="$rules.date"
175
- maska="##.##.####"
175
+ :maska="$maska.date"
176
176
  append-inner-icon="mdi mdi-calendar-blank-outline"
177
177
  ></base-form-input>
178
178
  <base-form-input
@@ -181,7 +181,7 @@
181
181
  :readonly="isDisabled"
182
182
  :clearable="!isDisabled"
183
183
  :rules="$rules.date"
184
- maska="##.##.####"
184
+ :maska="$maska.date"
185
185
  append-inner-icon="mdi mdi-calendar-blank-outline"
186
186
  ></base-form-input>
187
187
  <base-form-toggle
@@ -217,7 +217,7 @@
217
217
  :readonly="isDisabled"
218
218
  :clearable="!isDisabled"
219
219
  :rules="formStore.policyholdersRepresentativeForm.isNotary ? $rules.required.concat($rules.date) : []"
220
- maska="##.##.####"
220
+ :maska="$maska.date"
221
221
  append-inner-icon="mdi mdi-calendar-blank-outline"
222
222
  ></base-form-input>
223
223
  </base-form-section>
@@ -281,7 +281,7 @@
281
281
  @append="openPanel($t('form.City'), [], 'registrationCity', $dataStore.getCities, 'registrationProvince')"
282
282
  ></base-panel-input>
283
283
  <!-- <base-form-input v-if="$dataStore.isGons" v-model="member.postIndex" :readonly="isDisabled"
284
- :clearable="!isDisabled" :label="$t('form.postIndex')" maska="######"></base-form-input> -->
284
+ :clearable="!isDisabled" :label="$t('form.postIndex')" :maska="$maska.post"></base-form-input> -->
285
285
  <base-form-input v-model="member.registrationQuarter" :readonly="isDisabled" :clearable="!isDisabled" :label="$t('form.Quarter')"></base-form-input>
286
286
  <base-form-input v-model="member.registrationMicroDistrict" :readonly="isDisabled" :clearable="!isDisabled" :label="$t('form.MicroDistrict')"></base-form-input>
287
287
  <base-form-input
@@ -364,7 +364,7 @@
364
364
  :readonly="isDisabled"
365
365
  :clearable="!isDisabled"
366
366
  :rules="$rules.required.concat($rules.date)"
367
- maska="##.##.####"
367
+ :maska="$maska.date"
368
368
  append-inner-icon="mdi mdi-calendar-blank-outline"
369
369
  ></base-form-input>
370
370
  <base-fade-transition>
@@ -375,7 +375,7 @@
375
375
  :readonly="isDisabled"
376
376
  :clearable="!isDisabled"
377
377
  :rules="$rules.required.concat($rules.date)"
378
- maska="##.##.####"
378
+ :maska="$maska.date"
379
379
  append-inner-icon="mdi mdi-calendar-blank-outline"
380
380
  ></base-form-input>
381
381
  </base-fade-transition>
@@ -446,7 +446,7 @@
446
446
  <base-form-section :title="$t('form.contactsData')" v-if="$dataStore.hasContactSection(whichForm)">
447
447
  <base-form-input
448
448
  v-model="member.homePhone"
449
- maska="+7 (7##) ### ## ##"
449
+ :maska="$maska.phone"
450
450
  placeholder="+7 7"
451
451
  :label="$t('form.homePhone')"
452
452
  :readonly="isDisabled"
@@ -456,7 +456,7 @@
456
456
  <base-form-input v-model.trim="member.email" :label="$t('form.email')" :rules="$rules.email"></base-form-input>
457
457
  </base-form-section>
458
458
  </v-form>
459
- <base-btn v-if="!isDisabled && isTask && $dataStore.isInitiator()" :loading="isButtonLoading || isSubmittingForm" :text="$t('buttons.save')" @click="submitForm"></base-btn>
459
+ <base-btn v-if="showSaveButton" :loading="isButtonLoading || isSubmittingForm" :text="$t('buttons.save')" @click="submitForm"></base-btn>
460
460
  <Teleport v-if="isPanelOpen" to="#panel-actions">
461
461
  <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
462
462
  <base-rounded-input v-model="searchQuery" :label="$t('labels.search')" class="w-full p-2" :hide-details="true"></base-rounded-input>
@@ -495,8 +495,6 @@ import { uuid } from 'vue-uuid';
495
495
 
496
496
  export default {
497
497
  setup() {
498
- type FileActions = 'view' | 'download';
499
-
500
498
  const vForm = ref<any>();
501
499
  const route = useRoute();
502
500
  const router = useRouter();
@@ -522,22 +520,36 @@ export default {
522
520
 
523
521
  const whichForm = computed(() => route.query.tab);
524
522
  const whichIndex = computed(() => route.query.i);
525
- const hasOtp = computed(() => member.value.otpCode && member.value.otpCode.length === 7);
523
+ const hasOtp = computed(() => member.value.otpCode && member.value.otpCode.length === useMask().otp.length);
526
524
  const isDisabled = computed(() => !memberStore.isStatementEditible(whichForm.value as string));
527
525
  const isTask = computed(() => route.params.taskId === '0' || dataStore.isTask());
528
526
  const isIinPhoneDisabled = computed(() => formStore.applicationData && 'regNumber' in formStore.applicationData && whichForm.value === formStore.policyholderFormKey);
529
527
  const isFromGBD = computed(() => !!member.value.gosPersonData);
528
+ const showSaveButton = computed(() => {
529
+ const generalCondition = !isDisabled.value && !!isTask.value && !!dataStore.isInitiator();
530
+ const perMemberCondtion = () => {
531
+ switch (whichForm.value) {
532
+ case formStore.policyholderFormKey:
533
+ return true;
534
+ case formStore.insuredFormKey:
535
+ case formStore.beneficiaryFormKey:
536
+ case formStore.beneficialOwnerFormKey:
537
+ case formStore.policyholdersRepresentativeFormKey:
538
+ return route.params.taskId !== '0';
539
+ default:
540
+ return false;
541
+ }
542
+ };
543
+ return generalCondition && perMemberCondtion();
544
+ });
530
545
 
531
546
  const getOtpConditionByMember = () => {
532
547
  switch (whichForm.value) {
533
548
  case formStore.policyholderFormKey:
534
549
  return route.params.taskId === '0';
535
550
  case formStore.policyholdersRepresentativeFormKey:
536
- return route.query.id === '0';
537
551
  case formStore.insuredFormKey:
538
- return route.query.id === '0';
539
552
  case formStore.beneficiaryFormKey:
540
- return route.query.id === '0';
541
553
  case formStore.beneficialOwnerFormKey:
542
554
  return route.query.id === '0';
543
555
  }
@@ -545,7 +557,7 @@ export default {
545
557
  const otpCondition = computed(() => {
546
558
  // Add conditions by product
547
559
  if (member.value.hasAgreement) return false;
548
- if (!member.value.phoneNumber || (member.value.phoneNumber && member.value.phoneNumber.length !== 18)) return false;
560
+ if (!member.value.phoneNumber || (member.value.phoneNumber && member.value.phoneNumber.length !== useMask().phone.length)) return false;
549
561
  return getOtpConditionByMember();
550
562
  });
551
563
 
@@ -622,7 +634,7 @@ export default {
622
634
  if (fileData.value) {
623
635
  Object.values(fileData.value.file).map((value: any) => {
624
636
  formData.append('file', value);
625
- const ext = value.name.substr(value.name.lastIndexOf('.'));
637
+ const ext = value.name.substring(value.name.lastIndexOf('.'));
626
638
  information.push({
627
639
  identifier: `${uuidV4}${ext}`,
628
640
  iin: member.value.iin ? member.value.iin.replaceAll('-', '') : null,
@@ -661,7 +673,7 @@ export default {
661
673
  dataStore.showToaster('error', dataStore.t('toaster.needAgreement'), 3000);
662
674
  return;
663
675
  }
664
- if (!member.value.iin || member.value.iin.length !== 15 || !member.value.phoneNumber || member.value.phoneNumber.length !== 18) {
676
+ if (!member.value.iin || member.value.iin.length !== useMask().iin.length || !member.value.phoneNumber || member.value.phoneNumber.length !== useMask().phone.length) {
665
677
  dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', 'Номер телефона, ИИН'), 5000);
666
678
  return;
667
679
  }
@@ -678,7 +690,7 @@ export default {
678
690
  dataStore.showToaster('error', dataStore.t('toaster.needAgreement'), 3000);
679
691
  return;
680
692
  }
681
- if (!member.value.iin || member.value.iin.length !== 15) {
693
+ if (!member.value.iin || member.value.iin.length !== useMask().iin.length) {
682
694
  dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', 'ИИН'), 5000);
683
695
  return;
684
696
  }
@@ -774,7 +786,7 @@ export default {
774
786
  }
775
787
  dataStore.showToaster('success', dataStore.t('toaster.successSaved'));
776
788
  dataStore.isLoading = false;
777
- window.scrollTo({ top: 0, behavior: 'smooth' });
789
+ vForm.value.scrollTo({ top: 0, behavior: 'smooth' });
778
790
  };
779
791
 
780
792
  const submitForm = async () => {
@@ -832,7 +844,7 @@ export default {
832
844
  };
833
845
 
834
846
  const checkOtp = async () => {
835
- if (!member.value.otpCode || member.value.iin?.length !== 15 || member.value.phoneNumber?.length !== 18) {
847
+ if (!member.value.otpCode || member.value.iin?.length !== useMask().iin.length || member.value.phoneNumber?.length !== useMask().phone.length ) {
836
848
  dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', dataStore.t('form.otpCode')), 3000);
837
849
  return;
838
850
  }
@@ -886,11 +898,12 @@ export default {
886
898
  watch(
887
899
  () => member.value.percentageOfPayoutAmount,
888
900
  val => {
889
- if (val) {
890
- if (val < 0) {
901
+ const percentage = typeof val === 'string' ? Number(val) : val;
902
+ if (percentage) {
903
+ if (percentage < 0) {
891
904
  member.value.percentageOfPayoutAmount = 0;
892
905
  dataStore.showToaster('error', dataStore.t('toaster.incorrectInput'), 1000);
893
- } else if (val > 100) {
906
+ } else if (percentage > 100) {
894
907
  member.value.percentageOfPayoutAmount = 100;
895
908
  dataStore.showToaster('error', dataStore.t('toaster.incorrectInput'), 1000);
896
909
  }
@@ -901,7 +914,7 @@ export default {
901
914
  watch(
902
915
  () => member.value.birthDate,
903
916
  val => {
904
- if (val && val.length === 10) {
917
+ if (val && val.length === useMask().date.length) {
905
918
  const calculatedAge = member.value.getAgeByBirthDate();
906
919
  if (calculatedAge) member.value.age = calculatedAge;
907
920
  }
@@ -911,7 +924,7 @@ export default {
911
924
  watch(
912
925
  () => member.value.otpCode,
913
926
  async () => {
914
- if (member.value.otpCode && member.value.otpCode.length === 7) {
927
+ if (member.value.otpCode && member.value.otpCode.length === useMask().otp.length) {
915
928
  await checkOtp();
916
929
  }
917
930
  },
@@ -964,6 +977,7 @@ export default {
964
977
  isTask,
965
978
  isIinPhoneDisabled,
966
979
  isFromGBD,
980
+ showSaveButton,
967
981
 
968
982
  // Functions
969
983
  searchMember,
@@ -1,42 +1,342 @@
1
1
  <template>
2
2
  <section class="flex flex-col gap-4 px-[10px]">
3
- <v-form ref="vForm" @submit="submitForm">
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]">
5
+ <base-form-text-section
6
+ class="mb-4"
7
+ title="Инвалидность I или II группы по причине несчастного случая, начиная с третьего года по любой причине, с освобождением от уплаты страховых взносов"
8
+ subtitle="Равна страховой сумме по основному покрытию"
9
+ ></base-form-text-section>
10
+ <base-form-text-section
11
+ title="Если лицо, назначенное Выгодоприобретателем, на дату осуществления Страховщиком страховой выплаты не достигло совершеннолетия (восемнадцатилетнего возраста), страховая
12
+ выплата подлежит осуществлению:"
13
+ subtitle="Если несовершеннолетний не достиг возраста 14 лет - законному представителю в соответствии с законодательством Республики Казахстан"
14
+ ></base-form-text-section>
15
+ </base-form-section>
4
16
  <base-form-section :title="$t('generalConditions')">
17
+ <div v-if="isRecalculation && $route.params.taskId === '0'">
18
+ <base-form-input
19
+ v-model="formStore.productConditionsForm.signDate"
20
+ :maska="$maska.date"
21
+ :clearable="false"
22
+ :readonly="true"
23
+ :label="$t('form.signDate')"
24
+ append-inner-icon="mdi mdi-calendar-blank-outline"
25
+ ></base-form-input>
26
+ <base-form-input
27
+ v-model="formStore.productConditionsForm.birthDate"
28
+ :maska="$maska.date"
29
+ :readonly="isDisabled"
30
+ :clearable="!isDisabled"
31
+ :label="$t('form.birthDate')"
32
+ :rules="$rules.required.concat($rules.birthDate)"
33
+ append-inner-icon="mdi mdi-calendar-blank-outline"
34
+ ></base-form-input>
35
+ <base-panel-input
36
+ v-model="formStore.productConditionsForm.gender"
37
+ :value="formStore.productConditionsForm.gender.nameRu"
38
+ :readonly="isDisabled"
39
+ :clearable="!isDisabled"
40
+ :label="$t('form.gender')"
41
+ :rules="$rules.objectRequired"
42
+ append-inner-icon="mdi mdi-chevron-right"
43
+ @append="openPanel($t('form.gender'), $dataStore.gender, 'gender')"
44
+ ></base-panel-input>
45
+ </div>
46
+ <base-form-input
47
+ v-model="formStore.productConditionsForm.coverPeriod"
48
+ :maska="$maska.numbers"
49
+ :readonly="isDisabled"
50
+ :clearable="!isDisabled"
51
+ :rules="$rules.required.concat($rules.numbers, $rules.coverPeriodFrom3to20)"
52
+ :label="$t('productConditionsForm.coverPeriodFrom3to20')"
53
+ ></base-form-input>
54
+ <base-panel-input
55
+ v-model="formStore.productConditionsForm.paymentPeriod"
56
+ :value="formStore.productConditionsForm.paymentPeriod.nameRu"
57
+ :readonly="isDisabled"
58
+ :clearable="!isDisabled"
59
+ :rules="$rules.objectRequired"
60
+ :label="$t('productConditionsForm.processPaymentPeriod')"
61
+ append-inner-icon="mdi mdi-chevron-right"
62
+ @append="openPanel($t('productConditionsForm.processPaymentPeriod'), $dataStore.processPaymentPeriod, 'paymentPeriod', $dataStore.getProcessPaymentPeriod)"
63
+ ></base-panel-input>
5
64
  <base-form-input
6
65
  v-model="formStore.productConditionsForm.requestedSumInsured"
7
- :rules="$dataStore.rules.numbers"
66
+ :readonly="isDisabled"
67
+ :clearable="!isDisabled"
68
+ :rules="requestedSumInsured"
8
69
  :label="$t('productConditionsForm.requestedSumInsured')"
9
70
  ></base-form-input>
10
71
  <base-form-input
11
72
  v-model="formStore.productConditionsForm.insurancePremiumPerMonth"
12
- :rules="$dataStore.rules.numbers"
73
+ :readonly="isDisabled"
74
+ :clearable="!isDisabled"
75
+ :rules="insurancePremiumPerMonth"
13
76
  :label="$t('productConditionsForm.insurancePremiumAmount')"
14
77
  ></base-form-input>
15
78
  </base-form-section>
16
79
  </v-form>
17
- <base-btn :text="$t('buttons.calculate')" @click="submitForm"></base-btn>
80
+ <base-btn
81
+ v-if="!isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
82
+ :loading="isCalculating"
83
+ :text="$t('buttons.calculate')"
84
+ @click="submitForm"
85
+ ></base-btn>
86
+ <Teleport v-if="isPanelOpen" to="#panel-actions">
87
+ <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
88
+ <base-rounded-input v-model="searchQuery" :label="$t('labels.search')" class="w-full p-2" :hide-details="true"></base-rounded-input>
89
+ <div v-if="panelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
90
+ <base-panel-select-item :text="$t('form.notChosen')" :selected="panelValue.nameRu === null" @click="pickPanelValue(new Value())"></base-panel-select-item>
91
+ <base-panel-select-item
92
+ v-for="(item, index) of panelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
93
+ :key="index"
94
+ :text="item.nameRu as string"
95
+ :selected="item.nameRu === panelValue.nameRu"
96
+ @click="pickPanelValue(item)"
97
+ ></base-panel-select-item>
98
+ </div>
99
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50"></base-loader>
100
+ </div>
101
+ </Teleport>
18
102
  </section>
19
103
  </template>
20
104
 
21
105
  <script lang="ts">
106
+ import { Value } from '@/composables/classes';
107
+
22
108
  export default defineComponent({
23
- setup() {
24
- const formStore = useFormStore();
109
+ props: {
110
+ isRecalculation: {
111
+ type: Boolean,
112
+ default: false,
113
+ },
114
+ },
115
+ setup(props) {
25
116
  const vForm = ref<any>();
117
+ const route = useRoute();
118
+ const router = useRouter();
119
+ const formStore = useFormStore();
120
+ const dataStore = useDataStore();
121
+ const memberStore = useMemberStore();
122
+
123
+ const isCalculating = ref<boolean>(false);
124
+ const isPanelLoading = ref<boolean>(false);
125
+ const isPanelOpen = ref<boolean>(false);
126
+ const panelValue = ref<Value>(new Value());
127
+ const panelList = ref<Value[]>([]);
128
+ const currentPanel = ref<keyof typeof formStore.productConditionsForm>();
129
+ const searchQuery = ref<string>('');
130
+ const whichSum = ref<'insurancePremiumPerMonth' | 'requestedSumInsured' | ''>('');
131
+
132
+ const isUnderwriterForm = computed(() => {
133
+ if (route.params.taskId === '0 ' || props.isRecalculation === true) {
134
+ return false;
135
+ } else {
136
+ return formStore.applicationData.statusCode === 'UnderwriterForm';
137
+ }
138
+ });
139
+ const isDisabled = computed(() => !memberStore.isStatementEditible(formStore.productConditionsFormKey));
140
+ const isTask = computed(() => (route.params.taskId === '0' && props.isRecalculation === true) || dataStore.isTask());
141
+ const insurancePremiumPerMonth = computed(() => (!!formStore.productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
142
+ const requestedSumInsured = computed(() => (!!formStore.productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
143
+
144
+ const pickPanelValue = (item: Value) => {
145
+ if (!isDisabled.value) {
146
+ dataStore.panel.open = false;
147
+ isPanelOpen.value = false;
148
+ // @ts-ignore
149
+ formStore.productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
150
+ } else {
151
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
152
+ }
153
+ };
154
+
155
+ const openPanel = async (title: string, list: Value[], key: string, asyncFunction?: Function, filterKey?: string) => {
156
+ if (!isDisabled.value) {
157
+ searchQuery.value = '';
158
+ currentPanel.value = key as keyof typeof formStore.productConditionsForm;
159
+ isPanelOpen.value = true;
160
+ dataStore.panelAction = null;
161
+ dataStore.panel.open = true;
162
+ dataStore.panel.title = title;
163
+
164
+ let newList = list;
165
+ if (asyncFunction) {
166
+ isPanelLoading.value = true;
167
+ newList = await asyncFunction(filterKey, formStore.productConditionsFormKey);
168
+ }
169
+ panelList.value = newList;
170
+ // @ts-ignore
171
+ panelValue.value = formStore.productConditionsForm[currentPanel.value];
172
+ isPanelLoading.value = false;
173
+ } else {
174
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
175
+ }
176
+ };
177
+
178
+ const pickCalculation = async (type: 'insurancePremiumPerMonth' | 'requestedSumInsured') => {
179
+ if (!type) return false;
180
+ whichSum.value = type;
181
+ await submitForm();
182
+ };
26
183
 
27
184
  const submitForm = async () => {
28
185
  vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
29
- console.log(v);
186
+ if (v.valid) {
187
+ if (whichSum.value === 'requestedSumInsured') {
188
+ formStore.productConditionsForm.insurancePremiumPerMonth = null;
189
+ }
190
+ if (whichSum.value === 'insurancePremiumPerMonth') {
191
+ formStore.productConditionsForm.requestedSumInsured = null;
192
+ }
193
+ if (formStore.productConditionsForm.requestedSumInsured !== '' && formStore.productConditionsForm.requestedSumInsured != null) {
194
+ formStore.productConditionsForm.insurancePremiumPerMonth = null;
195
+ if (props.isRecalculation) whichSum.value = 'requestedSumInsured';
196
+ }
197
+ if (formStore.productConditionsForm.insurancePremiumPerMonth !== '' && formStore.productConditionsForm.insurancePremiumPerMonth != null) {
198
+ formStore.productConditionsForm.requestedSumInsured = null;
199
+ if (props.isRecalculation) whichSum.value = 'insurancePremiumPerMonth';
200
+ }
201
+
202
+ if (!whichSum.value && isUnderwriterForm.value === false) {
203
+ dataStore.showToaster('error', dataStore.t('toaster.emptyProductConditions'));
204
+ return;
205
+ }
206
+
207
+ if (isUnderwriterForm.value) {
208
+ type recalculationInfo = {
209
+ lifeMultiply: string | null;
210
+ lifeAdditive: string | null;
211
+ adbMultiply: string | null;
212
+ adbAdditive: string | null;
213
+ disabilityMultiply: string | null;
214
+ disabilityAdditive: string | null;
215
+ amount?: number | null;
216
+ premium?: number | null;
217
+ riskGroup?: string | number | null;
218
+ };
219
+ const recalculationData: recalculationInfo = (({ lifeMultiply, lifeAdditive, adbMultiply, adbAdditive, disabilityMultiply, disabilityAdditive }) => ({
220
+ lifeMultiply,
221
+ lifeAdditive,
222
+ adbMultiply,
223
+ adbAdditive,
224
+ disabilityMultiply,
225
+ disabilityAdditive,
226
+ }))(formStore.productConditionsForm);
227
+ Object.keys(recalculationData).forEach(key => {
228
+ // @ts-ignore
229
+ recalculationData[key] = formatProcents(recalculationData[key]);
230
+ });
231
+ recalculationData.amount = Number(formStore.productConditionsForm.requestedSumInsured?.replace(/\s/g, ''));
232
+ recalculationData.premium = Number(formStore.productConditionsForm.insurancePremiumPerMonth?.replace(/\s/g, ''));
233
+ recalculationData.riskGroup = formStore.productConditionsForm.riskGroup?.id ? formStore.productConditionsForm.riskGroup.id : 1;
234
+ isCalculating.value = true;
235
+ await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId, whichSum.value);
236
+ }
237
+ isCalculating.value = true;
238
+ if (props.isRecalculation) {
239
+ await dataStore.calculateWithoutApplication(true);
240
+ } else {
241
+ if (dataStore.isProcessEditable(formStore.applicationData.statusCode)) {
242
+ await dataStore.calculate(route.params.taskId);
243
+ }
244
+ }
245
+ isCalculating.value = false;
246
+ } else {
247
+ const errors = document.querySelector('.v-input--error');
248
+ if (errors) {
249
+ const errorText = errors.querySelector('.v-label.v-field-label');
250
+ if (errorText) {
251
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorText.innerHTML?.replace(/[-<>!//.]/g, '')));
252
+ } else {
253
+ const errorFieldText = errors.querySelector('.v-input__control');
254
+ if (errorFieldText) {
255
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '')));
256
+ }
257
+ }
258
+ errors.scrollIntoView({
259
+ behavior: 'smooth',
260
+ block: 'center',
261
+ inline: 'nearest',
262
+ });
263
+ }
264
+ }
30
265
  });
31
266
  };
32
267
 
268
+ onMounted(async () => {
269
+ if (props.isRecalculation === true) {
270
+ if (route.params.taskId === '0') {
271
+ const defaultData = await dataStore.getDefaultCalculationData(true);
272
+ dataStore.additionalInsuranceTermsWithout = defaultData.addCovers;
273
+ formStore.productConditionsForm.requestedSumInsured = defaultData.amount;
274
+ formStore.productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
275
+ formStore.productConditionsForm.processIndexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
276
+ formStore.productConditionsForm.paymentPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
277
+ formStore.productConditionsForm.signDate = reformatDate(defaultData.signDate);
278
+ }
279
+ }
280
+ if (!!formStore.productConditionsForm.insurancePremiumPerMonth) {
281
+ whichSum.value = 'insurancePremiumPerMonth';
282
+ }
283
+ if (!!formStore.productConditionsForm.requestedSumInsured) {
284
+ whichSum.value = 'requestedSumInsured';
285
+ }
286
+ });
287
+
288
+ watch(
289
+ () => formStore.productConditionsForm.requestedSumInsured,
290
+ val => {
291
+ if (!val && whichSum.value == 'requestedSumInsured') whichSum.value = '';
292
+ if (val && whichSum.value != 'insurancePremiumPerMonth') {
293
+ whichSum.value = 'requestedSumInsured';
294
+ formStore.productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(val);
295
+ }
296
+ },
297
+ );
298
+ watch(
299
+ () => formStore.productConditionsForm.insurancePremiumPerMonth,
300
+ val => {
301
+ if (!val && whichSum.value == 'insurancePremiumPerMonth') whichSum.value = '';
302
+ if (val && whichSum.value != 'requestedSumInsured') {
303
+ whichSum.value = 'insurancePremiumPerMonth';
304
+ formStore.productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(val);
305
+ }
306
+ },
307
+ );
308
+ watch(
309
+ () => formStore.productConditionsForm.amountOfInsurancePremium,
310
+ val => {
311
+ if (val) formStore.productConditionsForm.amountOfInsurancePremium = dataStore.getNumberWithSpaces(val);
312
+ },
313
+ );
314
+
33
315
  return {
34
316
  // State
35
317
  formStore,
36
318
  vForm,
319
+ isCalculating,
320
+ isPanelLoading,
321
+ isPanelOpen,
322
+ panelValue,
323
+ panelList,
324
+ searchQuery,
325
+ whichSum,
326
+ Value,
327
+
328
+ // Computed
329
+ isTask,
330
+ isDisabled,
331
+ isUnderwriterForm,
332
+ insurancePremiumPerMonth,
333
+ requestedSumInsured,
37
334
 
38
335
  // Functions
39
336
  submitForm,
337
+ pickPanelValue,
338
+ openPanel,
339
+ pickCalculation,
40
340
  };
41
341
  },
42
342
  });
@@ -35,10 +35,8 @@
35
35
  </template>
36
36
 
37
37
  <script lang="ts">
38
- import { InputTypes } from '@/composables/models';
39
-
40
38
  export default defineComponent({
41
- name: 'BaseRoundedInput',
39
+ name: 'BaseFormInput',
42
40
  props: {
43
41
  modelValue: {
44
42
  required: false,
@@ -87,7 +85,7 @@ export default defineComponent({
87
85
  default: 'text',
88
86
  },
89
87
  variant: {
90
- type: String as PropType<'solo' | 'filled' | 'outlined' | 'plain' | 'underlined'>,
88
+ type: String as PropType<InputVariants>,
91
89
  default: 'solo',
92
90
  },
93
91
  color: {
@@ -37,11 +37,10 @@
37
37
  </template>
38
38
 
39
39
  <script lang="ts">
40
- import { InputTypes } from '@/composables/models';
41
40
  import { Value } from '@/composables/classes';
42
41
 
43
42
  export default defineComponent({
44
- name: 'BaseRoundedInput',
43
+ name: 'BasePanelInput',
45
44
  props: {
46
45
  modelValue: {
47
46
  required: false,
@@ -90,7 +89,7 @@ export default defineComponent({
90
89
  default: 'text',
91
90
  },
92
91
  variant: {
93
- type: String as PropType<'solo' | 'filled' | 'outlined' | 'plain' | 'underlined'>,
92
+ type: String as PropType<InputVariants>,
94
93
  default: 'solo',
95
94
  },
96
95
  color: {
@@ -34,10 +34,7 @@
34
34
  </template>
35
35
 
36
36
  <script lang="ts">
37
- import { InputTypes } from '@/composables/models';
38
-
39
37
  export default defineComponent({
40
- extends: {},
41
38
  name: 'BaseRoundedInput',
42
39
  props: {
43
40
  modelValue: {
@@ -84,7 +81,7 @@ export default defineComponent({
84
81
  default: 'text',
85
82
  },
86
83
  variant: {
87
- type: String as PropType<'solo' | 'filled' | 'outlined' | 'plain' | 'underlined'>,
84
+ type: String as PropType<InputVariants>,
88
85
  default: 'solo',
89
86
  },
90
87
  color: {
@@ -22,7 +22,7 @@ export default defineComponent({
22
22
  default: '',
23
23
  },
24
24
  whichPanel: {
25
- type: String as PropType<'settings' | 'panel'>,
25
+ type: String as PropType<PanelTypes>,
26
26
  default: 'panel',
27
27
  },
28
28
  },
@@ -407,7 +407,7 @@ export class Member extends Person {
407
407
  email: string | null;
408
408
  address: string | null;
409
409
  familyStatus: Value;
410
- isTerror: Value | null;
410
+ isTerror: null;
411
411
  relationDegree: Value;
412
412
  isDisability: Value;
413
413
  disabilityGroup: Value | null;
@@ -586,7 +586,7 @@ export class Member extends Person {
586
586
  this.email = null;
587
587
  this.address = null;
588
588
  this.familyStatus = new Value();
589
- this.isTerror = new Value();
589
+ this.isTerror = null;
590
590
  this.relationDegree = new Value();
591
591
  this.isDisability = new Value();
592
592
  this.disabilityGroup = null;
@@ -669,6 +669,9 @@ export class PolicyholdersRepresentativeForm extends Member {
669
669
  }
670
670
 
671
671
  export class ProductConditions {
672
+ signDate: string | null;
673
+ birthDate: string | null;
674
+ gender: Value;
672
675
  insuranceCase: string | null;
673
676
  coverPeriod: string | null;
674
677
  payPeriod: string | null;
@@ -727,6 +730,9 @@ export class ProductConditions {
727
730
  riskGroup = new Value(),
728
731
  riskGroup2 = new Value(),
729
732
  ) {
733
+ this.signDate = null;
734
+ this.birthDate = null;
735
+ this.gender = new Value();
730
736
  this.insuranceCase = insuranceCase;
731
737
  this.coverPeriod = coverPeriod;
732
738
  this.payPeriod = payPeriod;
@@ -801,7 +807,7 @@ export class DataStoreClass {
801
807
  historyTotalItems: number;
802
808
  isColumnAsc = { ...InitialColumns() };
803
809
  idleKey: number;
804
- processList: any[] | null;
810
+ processList: Item[] | null;
805
811
  countries: Value[];
806
812
  citizenshipCountries: Value[];
807
813
  taxCountries: Value[];
@@ -833,13 +839,13 @@ export class DataStoreClass {
833
839
  processPaymentPeriod: any[];
834
840
  additionalInsuranceTerms: any[];
835
841
  additionalInsuranceTermsWithout: any[];
836
- taskList: any[];
837
- processHistory: any[];
842
+ taskList: TaskListItem[];
843
+ processHistory: TaskHistory[];
838
844
  contragentList: any[];
839
845
  contragentFormKey: string;
840
846
  processCode: number | null;
841
847
  groupCode: string;
842
- userGroups: any[];
848
+ userGroups: Item[];
843
849
  onMainPage: boolean;
844
850
  signUrl: string | null;
845
851
  SaleChanellPolicyList: any[];
@@ -866,7 +872,7 @@ export class DataStoreClass {
866
872
  this.controls = {
867
873
  onAuth: false,
868
874
  hasGBDFL: true,
869
- hasInsis: true,
875
+ hasInsis: false,
870
876
  hasCalculator: false,
871
877
  };
872
878
  this.hasLayoutMargins = true;
@@ -30,6 +30,7 @@ export const constants = Object.freeze({
30
30
  supervisor: 'Supervisor',
31
31
  support: 'Support',
32
32
  managerHalykBank: 'ManagerHalykBank',
33
+ serviceManager: 'ServiceManager',
33
34
  },
34
35
  actions: {
35
36
  accept: 'accept',
@@ -3,6 +3,17 @@ import jwt_decode from 'jwt-decode';
3
3
  import { XMLParser } from 'fast-xml-parser';
4
4
  import { AxiosError } from 'axios';
5
5
 
6
+ export class Masks {
7
+ numbers: string = '#*';
8
+ otp: string = '# # # #';
9
+ iin: string = '###-###-###-###';
10
+ phone: string = '+7 (7##) ### ## ##';
11
+ date: string = '##.##.####';
12
+ post: string = '######';
13
+ }
14
+
15
+ export const useMask = () => new Masks();
16
+
6
17
  export const useDisplayInfo = useDisplay;
7
18
 
8
19
  export const capitalize = (word: string): string => (word ? word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() : word);
@@ -15,6 +26,10 @@ const xmlParser = new XMLParser({
15
26
  },
16
27
  });
17
28
 
29
+ export const getNumber = (number: string) => {
30
+ return number ? Number(number.replace(/\s/g, '')) : null;
31
+ };
32
+
18
33
  export const formatDate = (date: string) => {
19
34
  if (date) {
20
35
  const data = date.split('.');
@@ -38,7 +38,7 @@ const openSettings = async () => {
38
38
 
39
39
  const onLink = async (item: MenuItem) => {
40
40
  if (dataStore.menu.onLink) await dataStore.menu.onLink(item);
41
- dataStore.menu.selectedItem = item;
41
+ if (typeof item.disabled === 'boolean' ? !item.disabled : true) dataStore.menu.selectedItem = item;
42
42
  };
43
43
 
44
44
  const onBack = async (item: MenuItem) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.7-beta.17",
3
+ "version": "0.0.7-beta.19",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -1,5 +1,6 @@
1
- import { capitalize, getFullNameShorted, reformatIin } from '../composables';
1
+ import { capitalize, getFullNameShorted, reformatIin, Masks } from '../composables';
2
2
  import { constants } from '../composables/constants';
3
+ import { Styles } from '../composables/styles';
3
4
  import Vidle from 'v-idle-3';
4
5
  import Maska from 'maska';
5
6
 
@@ -11,6 +12,8 @@ export default defineNuxtPlugin(nuxtApp => {
11
12
  provide: {
12
13
  capitalize: capitalize,
13
14
  getFullNameShorted: getFullNameShorted,
15
+ libStyles: new Styles(),
16
+ maska: new Masks(),
14
17
  reformatIin: reformatIin,
15
18
  constants: constants,
16
19
  },
@@ -1,7 +1,8 @@
1
1
  import { useDataStore } from '../store/data.store';
2
- import { Styles } from '../composables/styles';
3
2
 
4
3
  export default defineNuxtPlugin(nuxtApp => {
4
+ const dataStore = useDataStore();
5
+
5
6
  nuxtApp.vueApp.use(useDataStore().toast.default, {
6
7
  transition: 'Vue-Toastification__fade',
7
8
  maxToasts: 5,
@@ -10,11 +11,10 @@ export default defineNuxtPlugin(nuxtApp => {
10
11
 
11
12
  return {
12
13
  provide: {
13
- dataStore: useDataStore(),
14
- rules: useDataStore().rules,
15
- libStyles: new Styles(),
16
- t: useDataStore().t,
17
- toast: useDataStore().showToaster,
14
+ dataStore: dataStore,
15
+ rules: dataStore.rules,
16
+ t: dataStore.t,
17
+ toast: dataStore.showToaster,
18
18
  },
19
19
  };
20
20
  });
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
2
2
  import { t } from './messages';
3
3
  import { rules } from './rules';
4
4
  import { Toast, Types, Positions, ToastOptions } from './toast';
5
- import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern } from '../composables';
5
+ import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber } from '../composables';
6
6
  import { DataStoreClass, Contragent } from '../composables/classes';
7
7
  import { ApiClass } from '@/api';
8
8
  import { useFormStore } from './form.store';
@@ -52,8 +52,11 @@ export const useDataStore = defineStore('data', {
52
52
  sendToParent(action, value) {
53
53
  window.parent.postMessage({ action: action, value: value }, '*');
54
54
  },
55
+ getChildIframe() {
56
+ return document.getElementById('product-iframe');
57
+ },
55
58
  sendToChild(action, value) {
56
- const childFrame = document.getElementById('product-iframe');
59
+ const childFrame = this.getChildIframe();
57
60
  if (childFrame && childFrame.contentWindow && childFrame.contentWindow.postMessage) {
58
61
  childFrame.contentWindow.postMessage({ action: action, value: value }, '*');
59
62
  }
@@ -107,18 +110,15 @@ export const useDataStore = defineStore('data', {
107
110
  }
108
111
  if (this.controls.onAuth) {
109
112
  const hasPermission =
110
- this.isManager() ||
113
+ this.isInitiator() ||
111
114
  this.isUnderwriter() ||
112
115
  this.isAdmin() ||
113
- this.isAgent() ||
114
116
  this.isCompliance() ||
115
- this.isAgentMycar() ||
116
117
  this.isAnalyst() ||
117
118
  this.isUpk() ||
118
119
  this.isFinanceCenter() ||
119
120
  this.isSupervisor() ||
120
- this.isSupport() ||
121
- this.isManagerHalykBank();
121
+ this.isSupport();
122
122
  if (hasPermission) {
123
123
  localStorage.setItem('accessToken', this.accessToken);
124
124
  localStorage.setItem('refreshToken', this.refreshToken);
@@ -159,7 +159,7 @@ export const useDataStore = defineStore('data', {
159
159
  return !!isRole;
160
160
  },
161
161
  isInitiator() {
162
- return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank();
162
+ return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager();
163
163
  },
164
164
  isManager() {
165
165
  return this.isRole(constants.roles.manager);
@@ -176,6 +176,9 @@ export const useDataStore = defineStore('data', {
176
176
  isManagerHalykBank() {
177
177
  return this.isRole(constants.roles.managerHalykBank);
178
178
  },
179
+ isServiceManager() {
180
+ return this.isRole(constants.roles.serviceManager);
181
+ },
179
182
  isUnderwriter() {
180
183
  return this.isRole(constants.roles.underwriter);
181
184
  },
@@ -831,16 +834,21 @@ export const useDataStore = defineStore('data', {
831
834
  await this.api.deleteMember('Spokesman', this.formStore.applicationData.processInstanceId);
832
835
  }
833
836
  data.migrationCard = member.migrationCard;
834
- data.migrationCardIssueDate = formatDate(member.migrationCardIssueDate);
835
- data.migrationCardExpireDate = formatDate(member.migrationCardExpireDate);
837
+ const migrationCardIssueDate = formatDate(member.migrationCardIssueDate);
838
+ if (migrationCardIssueDate) data.migrationCardIssueDate = migrationCardIssueDate.toISOString();
839
+ const migrationCardExpireDate = formatDate(member.migrationCardExpireDate);
840
+ if (migrationCardExpireDate) data.migrationCardExpireDate = migrationCardExpireDate.toISOString();
836
841
  data.confirmDocType = member.confirmDocType;
837
842
  data.confirmDocNumber = member.confirmDocNumber;
838
- data.confirmDocIssueDate = formatDate(member.migrationCardIssueDate);
839
- data.confirmDocExpireDate = formatDate(member.migrationCardExpireDate);
843
+ const confirmDocIssueDate = formatDate(member.confirmDocIssueDate);
844
+ if (confirmDocIssueDate) data.confirmDocIssueDate = confirmDocIssueDate.toISOString();
845
+ const confirmDocExpireDate = formatDate(member.confirmDocExpireDate);
846
+ if (confirmDocExpireDate) data.confirmDocExpireDate = confirmDocExpireDate.toISOString();
840
847
  data.clientLongName = this.formStore.applicationData.clientApp.longName;
841
848
  data.notaryLongName = member.notaryLongName;
842
849
  data.notaryLicenseNumber = member.notaryLicenseNumber;
843
- data.notaryLicenseDate = formatDate(member.notaryLicenseDate);
850
+ const notaryLicenseDate = formatDate(member.notaryLicenseDate);
851
+ if (notaryLicenseDate) data.notaryLicenseDate = notaryLicenseDate.toISOString();
844
852
  data.notaryLicenseIssuer = member.notaryLicenseIssuer;
845
853
  data.jurLongName = member.jurLongName;
846
854
  data.fullNameRod = member.fullNameRod;
@@ -1322,7 +1330,7 @@ export const useDataStore = defineStore('data', {
1322
1330
  id: this.affilationResolution.id,
1323
1331
  processInstanceId: this.affilationResolution.processInstanceId,
1324
1332
  number: this.affilationResolution.number,
1325
- date: formatDate(this.affilationResolution.date),
1333
+ date: formatDate(this.affilationResolution.date)?.toISOString(),
1326
1334
  };
1327
1335
  try {
1328
1336
  this.isLoading = true;
@@ -1372,6 +1380,46 @@ export const useDataStore = defineStore('data', {
1372
1380
  console.log(err);
1373
1381
  }
1374
1382
  },
1383
+ async getDefaultCalculationData(showLoader = false) {
1384
+ this.isLoading = showLoader;
1385
+ try {
1386
+ const calculationData = await this.api.getDefaultCalculationData();
1387
+ return calculationData;
1388
+ } catch (err) {
1389
+ ErrorHandler(err);
1390
+ } finally {
1391
+ this.isLoading = false;
1392
+ }
1393
+ },
1394
+ async calculateWithoutApplication(showLoader = false) {
1395
+ this.isLoading = showLoader;
1396
+ try {
1397
+ const calculationData = {
1398
+ signDate: formatDate(this.formStore.productConditionsForm.signDate)?.toISOString(),
1399
+ birthDate: formatDate(this.formStore.productConditionsForm.birthDate)?.toISOString(),
1400
+ gender: this.formStore.productConditionsForm.gender.id,
1401
+ amount: getNumber(this.formStore.productConditionsForm.requestedSumInsured),
1402
+ premium: getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonth),
1403
+ coverPeriod: this.formStore.productConditionsForm.coverPeriod,
1404
+ payPeriod: this.formStore.productConditionsForm.coverPeriod,
1405
+ indexRateId: this.formStore.productConditionsForm.processIndexRate?.id
1406
+ ? this.formStore.productConditionsForm.processIndexRate.id
1407
+ : this.processIndexRate.find(i => i.code === '0')?.id,
1408
+ paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
1409
+ addCovers: this.additionalInsuranceTermsWithout,
1410
+ };
1411
+ const calculationResponse = await this.api.calculateWithoutApplication(calculationData);
1412
+ this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
1413
+ this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
1414
+ this.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1415
+ this.showToaster('success', this.t('toaster.calculated'), 1000);
1416
+ } catch (err) {
1417
+ ErrorHandler(err);
1418
+ } finally {
1419
+ this.isLoading = false;
1420
+ return !!this.formStore.productConditionsForm.requestedSumInsured && !!this.formStore.productConditionsForm.insurancePremiumPerMonth;
1421
+ }
1422
+ },
1375
1423
  async calculate(taskId) {
1376
1424
  this.isLoading = true;
1377
1425
  try {
@@ -1846,8 +1894,6 @@ export const useDataStore = defineStore('data', {
1846
1894
  )}₸`,
1847
1895
  4000,
1848
1896
  );
1849
- } else {
1850
- ErrorHandler(err);
1851
1897
  }
1852
1898
  } catch (err) {
1853
1899
  console.log(err);
@@ -1877,7 +1923,7 @@ export const useDataStore = defineStore('data', {
1877
1923
  const localMembers = [...this.formStore[localKey]].sort((a, b) => a.id - b.id);
1878
1924
  const applicationMembers = [...this.formStore.applicationData[applicationKey]].sort((a, b) => a.insisId - b.insisId);
1879
1925
  if (localMembers.every((each, index) => applicationMembers[index].insisId === each.id && applicationMembers[index].iin === each.iin.replace(/-/g, '')) === false) {
1880
- this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
1926
+ this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', text), 3000);
1881
1927
  return false;
1882
1928
  }
1883
1929
  if (localKey === this.formStore.beneficiaryFormKey) {
@@ -1892,15 +1938,15 @@ export const useDataStore = defineStore('data', {
1892
1938
  }
1893
1939
  } else {
1894
1940
  if (this.formStore[localKey].some(i => i.iin !== null)) {
1895
- this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
1941
+ this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', text), 3000);
1896
1942
  return false;
1897
1943
  }
1898
1944
  if (this.formStore.applicationData[applicationKey].length !== 0) {
1899
- this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
1945
+ this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', text), 3000);
1900
1946
  return false;
1901
1947
  } else {
1902
1948
  if (this.formStore[localKey][0].iin !== null) {
1903
- this.showToaster('error', this.t('toaster.notSavedMember', { text: text }), 3000);
1949
+ this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', text), 3000);
1904
1950
  return false;
1905
1951
  }
1906
1952
  }
@@ -1913,7 +1959,7 @@ export const useDataStore = defineStore('data', {
1913
1959
  return false;
1914
1960
  }
1915
1961
  if (this.formStore.policyholderForm.id !== this.formStore.applicationData.clientApp.insisId) {
1916
- this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
1962
+ this.showToaster('error', this.t('toaster.notSavedMember').replace('{text}', 'страхователя'), 3000);
1917
1963
  return false;
1918
1964
  }
1919
1965
  if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
@@ -219,7 +219,7 @@ export const useMemberStore = defineStore('members', {
219
219
  let otpStatus: boolean = false;
220
220
  let otpResponse: any = {};
221
221
  try {
222
- if (member.iin && member.phoneNumber && member.iin.length === 15 && member.phoneNumber.length === 18) {
222
+ if (member.iin && member.phoneNumber && member.iin.length === useMask().iin.length && member.phoneNumber.length === useMask().phone.length) {
223
223
  const status = await this.getOtpStatus(member.iin, member.phoneNumber, processInstanceId);
224
224
  if (status === true) {
225
225
  this.dataStore.showToaster('success', this.dataStore.t('toaster.hasSuccessOtp'), 3000);
@@ -261,7 +261,7 @@ export const useMemberStore = defineStore('members', {
261
261
  this.dataStore.showToaster('success', this.dataStore.t('toaster.successOtp'), 3000);
262
262
  }
263
263
  } else {
264
- this.dataStore.showToaster('error', this.dataStore.t('error.snoOtpResponse'), 3000);
264
+ this.dataStore.showToaster('error', this.dataStore.t('error.noOtpResponse'), 3000);
265
265
  return { otpStatus };
266
266
  }
267
267
  }
package/store/messages.ts CHANGED
@@ -101,6 +101,7 @@ export const messages = {
101
101
  tokenExpire: 'Истекло время ожидания',
102
102
  },
103
103
  buttons: {
104
+ createStatement: 'Создать заявку',
104
105
  add: 'Добавить',
105
106
  userLogin: 'Логин',
106
107
  password: 'Пароль',
@@ -205,6 +206,7 @@ export const messages = {
205
206
  coverPeriod: 'Срок',
206
207
  requestedSumInsured: 'Запрашиваемая сумма',
207
208
  insurancePremiumPerMonth: 'Премия в месяц',
209
+ noStatementCalculator: 'Калькулятор стоимости без ввода данных',
208
210
  agreement: 'Согласие',
209
211
  clientsStatement: 'Заявление клиента',
210
212
  document: 'Документ',
@@ -229,6 +231,7 @@ export const messages = {
229
231
  processIndexRate: 'Запрашиваемый размер коэффициента индексации (от 3% до 7%)',
230
232
  processPaymentPeriod: 'Периодичность оплаты страховой премии:',
231
233
  requestedSumInsured: 'Страховая сумма',
234
+ sumInsured: 'Страховая сумма',
232
235
  insurancePremiumPerMonth: 'Страховая премия',
233
236
  hint: 'Сумма рассчитывается автоматически',
234
237
  additional: 'Дополнительные условия страхования',
@@ -342,6 +345,7 @@ export const messages = {
342
345
  firstName: 'Имя',
343
346
  middleName: 'Отчество',
344
347
  birthDate: 'Дата рождения',
348
+ signDate: 'Дата расчета',
345
349
  age: 'Возраст',
346
350
  gender: 'Пол',
347
351
  familyStatus: 'Семейное положение',
package/store/rules.js CHANGED
@@ -2,7 +2,7 @@ import { t } from './messages';
2
2
  import { formatDate } from '../composables';
3
3
 
4
4
  export const rules = {
5
- recalculationMultiply: [v => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher', { text: 100 })],
5
+ recalculationMultiply: [v => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher').replace('{text}', '100')],
6
6
  recalculationAdditive: [
7
7
  v =>
8
8
  (v !== null && v !== '' && v <= 100 && v >= 0) ||
@@ -63,7 +63,7 @@ export const rules = {
63
63
  ],
64
64
  iinRight: [
65
65
  v => {
66
- if (v.length !== 15) {
66
+ if (v.length !== useMask().iin.length) {
67
67
  return t('rules.iinRight');
68
68
  }
69
69
  return true;
@@ -75,7 +75,7 @@ export const rules = {
75
75
  if (v === null || v == '') {
76
76
  return true;
77
77
  }
78
- if (v && v.length === 18) {
78
+ if (v && v.length === useMask().phone.length) {
79
79
  return true;
80
80
  } else {
81
81
  return t('rules.phoneFormat');
@@ -110,6 +110,20 @@ export const rules = {
110
110
  return t('rules.coverPeriod');
111
111
  }
112
112
  return true;
113
+ } else {
114
+ return t('rules.coverPeriod');
115
+ }
116
+ },
117
+ ],
118
+ coverPeriodFrom3to20: [
119
+ v => {
120
+ if (v !== null) {
121
+ if (v < 3 || v > 20) {
122
+ return t('productConditionsForm.coverPeriodFrom3to20');
123
+ }
124
+ return true;
125
+ } else {
126
+ return t('productConditionsForm.coverPeriodFrom3to20');
113
127
  }
114
128
  },
115
129
  ],
@@ -1,43 +0,0 @@
1
- export type InputTypes =
2
- | 'button'
3
- | 'checkbox'
4
- | 'color'
5
- | 'date'
6
- | 'datetime-local'
7
- | 'email'
8
- | 'file'
9
- | 'hidden'
10
- | 'image'
11
- | 'month'
12
- | 'number'
13
- | 'password'
14
- | 'radio'
15
- | 'range'
16
- | 'reset'
17
- | 'search'
18
- | 'submit'
19
- | 'tel'
20
- | 'text'
21
- | 'time'
22
- | 'url'
23
- | 'week';
24
-
25
- export type TaskListItem = {
26
- addRegNumber: string | number;
27
- applicationTaskId: string;
28
- dateCreated: string;
29
- historyStatus: string;
30
- historyStatusTitle: string;
31
- id: string;
32
- iin: string;
33
- insurerIin: string;
34
- insurerLongName: string;
35
- isTask: boolean | number;
36
- longName: string;
37
- number: string;
38
- processCode: number;
39
- processCodeTitle: string;
40
- status: string;
41
- userId: string;
42
- userName: string;
43
- };