hl-core 0.0.8-beta.16 → 0.0.8-beta.18

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.
@@ -61,7 +61,7 @@
61
61
  <div
62
62
  v-if="isMultiple && more && !isShort"
63
63
  :class="[$libStyles.blueBg, $libStyles.whiteText, $libStyles.textSimple, disabled ? $libStyles.disabled : 'cursor-pointer']"
64
- class="rounded-b-lg h-[36px] flex items-center font-medium justify-center"
64
+ class="transition-all rounded-b-lg h-[36px] flex items-center font-medium justify-center opacity-50 hover:opacity-90"
65
65
  @click="!disabled && memberStore.addMember(whichForm)"
66
66
  >
67
67
  {{ $t('buttons.add') }}
@@ -21,6 +21,7 @@
21
21
  :prepend-inner-icon="prependInnerIcon ? prependInnerIcon : ''"
22
22
  :append-inner-icon="appendInnerIcon ? appendInnerIcon : ''"
23
23
  :bg-color="bgColor ? bgColor : ''"
24
+ :suffix="suffix"
24
25
  @keyup.enter.prevent="submitted"
25
26
  @click:control="!props.readonly && $emit('append')"
26
27
  @click:clear="(props.readonly ? false : clearable) && $emit('update:modelValue', new Value())"
@@ -115,6 +116,10 @@ export default defineComponent({
115
116
  bgColor: {
116
117
  type: String,
117
118
  },
119
+ suffix: {
120
+ type: String,
121
+ default: '',
122
+ },
118
123
  },
119
124
  emits: ['update:modelValue', 'submitted', 'prepend', 'append', 'prepend-out', 'append-out', 'clear'],
120
125
 
@@ -1,8 +1,14 @@
1
1
  <template>
2
2
  <header class="relative w-full h-[70px] text-center font-medium align-middle flex items-center border-b-[1px]" :class="[$libStyles.blueBgLight, $libStyles.textSimple]">
3
- <i v-if="hasBack" @click="$emit('onBack')" class="absolute left-5 mdi text-xl cursor-pointer" :class="[backIcon]"></i>
3
+ <i v-if="hasBack" @click="$emit('onBack')" class="absolute left-5 mdi text-xl cursor-pointer transition-all" :class="[backIcon, backIconAnim]"></i>
4
4
  <span class="mx-10">{{ title }}</span>
5
- <i v-if="hasMore" @click="$emit('onMore')" class="mdi absolute right-5 text-xl cursor-pointer" :class="[moreIcon, hideMoreOnLg ? 'lg:!hidden' : '']"> </i>
5
+ <i
6
+ v-if="hasMore"
7
+ @click="$emit('onMore')"
8
+ class="mdi absolute right-5 text-xl cursor-pointer transition-all"
9
+ :class="[moreIcon, hideMoreOnLg ? 'lg:!hidden' : '', moreIconAnim]"
10
+ >
11
+ </i>
6
12
  </header>
7
13
  </template>
8
14
 
@@ -35,14 +41,44 @@ export default defineComponent({
35
41
  },
36
42
  },
37
43
  emits: ['onBack', 'onMore'],
38
- setup() {
44
+ setup(props) {
39
45
  const dataStore = useDataStore();
40
46
 
41
47
  const onClickOutside = () => {
42
48
  dataStore.settings.open = false;
43
49
  };
44
50
 
45
- return { onClickOutside };
51
+ const backIconAnim = computed(() => {
52
+ const icon = props.backIcon;
53
+ switch (icon) {
54
+ case 'mdi-arrow-left':
55
+ case 'mdi-account-arrow-left':
56
+ return 'hover:-translate-x-[2px]';
57
+ case 'mdi-close':
58
+ return 'hover:scale-110';
59
+ default:
60
+ return '';
61
+ }
62
+ });
63
+
64
+ const moreIconAnim = computed(() => {
65
+ const icon = props.moreIcon;
66
+ switch (icon) {
67
+ case 'mdi-cog-outline':
68
+ return 'hover:rotate-[30deg]';
69
+ default:
70
+ return '';
71
+ }
72
+ });
73
+
74
+ return {
75
+ // Computed
76
+ backIconAnim,
77
+ moreIconAnim,
78
+
79
+ // Functions
80
+ onClickOutside,
81
+ };
46
82
  },
47
83
  });
48
84
  </script>
@@ -45,7 +45,11 @@
45
45
  <span :class="[$libStyles.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
- <i v-if="question.first.answerName === 'Да' && secondQuestionList" class="mdi mdi-chevron-right text-2xl cursor-pointer" @click="openFirstPanel(question)"></i>
48
+ <i
49
+ v-if="question.first.answerName === 'Да' && secondQuestionList && secondQuestionList.length"
50
+ class="mdi mdi-chevron-right text-2xl cursor-pointer"
51
+ @click="openFirstPanel(question)"
52
+ ></i>
49
53
  </base-fade-transition>
50
54
  </span>
51
55
  <div class="flex items-center justify-start gap-5 px-4 pt-4" :class="[$libStyles.textSimple]">
@@ -17,7 +17,7 @@
17
17
  </aside>
18
18
  <section v-if="isLogin" class="w-full lg:w-3/4 flex flex-col justify-center">
19
19
  <img :class="{ '!block': !$display().lgAndUp.value }" draggable="false" class="hidden w-2/4 sm:w-1/3 mb-10 self-center" src="~/assets/auth-logo.svg" />
20
- <div class="flex flex-col items-center mb-8">
20
+ <div class="flex flex-col items-center mb-8 text-center">
21
21
  <h1 class="text-[28px] font-medium mb-1">{{ $t('labels.welcomeHL') }}</h1>
22
22
  <span :class="[$libStyles.greyTextDark]" class="text-[16px]">{{ $t('labels.needAuth') }}</span>
23
23
  </div>
@@ -53,8 +53,8 @@
53
53
  <h1 class="text-[28px] font-medium mb-1">{{ $t('labels.resetPassword') }}</h1>
54
54
  <span :class="[$libStyles.greyTextDark]" class="text-[16px]">{{ $t('labels.resetType') }}</span>
55
55
  </div>
56
- <div class="p-[2px] mb-8 rounded-[12px] border-[1px]" :class="[$libStyles.whiteBg]">
57
- <v-tabs v-model="resetPasswordType" density="compact" slider-color="#009c73" class="base-reset-password rounded-[12px] w-2/3 lg:w-[25vw]" :class="[$libStyles.whiteBg]">
56
+ <div class="p-[2px] mb-8 rounded-[12px] border-[1px] w-2/3 lg:w-[25vw]" :class="[$libStyles.whiteBg]">
57
+ <v-tabs v-model="resetPasswordType" density="compact" slider-color="#009c73" class="w-full base-reset-password rounded-[12px]" :class="[$libStyles.whiteBg]">
58
58
  <v-tab :ripple="false" value="phone"> {{ $t('form.phoneNumber') }} </v-tab>
59
59
  <v-tab :ripple="false" value="email"> {{ $t('form.email') }} </v-tab>
60
60
  </v-tabs>
@@ -19,20 +19,10 @@
19
19
  :readonly="isDisabled || isIinPhoneDisabled"
20
20
  :clearable="!isDisabled"
21
21
  :append-inner-icon="otpCondition ? 'mdi mdi-phone-message' : ''"
22
- @append="sendOtp(false)"
23
- @keyup.enter.prevent="otpCondition ? sendOtp(false) : null"
22
+ @append="openCustomPanel('otp')"
23
+ @keyup.enter.prevent="otpCondition ? openCustomPanel('otp') : null"
24
24
  :rules="phoneRule"
25
25
  ></base-form-input>
26
- <base-fade-transition>
27
- <base-form-input
28
- v-if="otpCondition && member.otpTokenId"
29
- v-model="member.otpCode"
30
- :label="$t('form.otpCode')"
31
- :maska="$maska.otp"
32
- :append-inner-icon="hasOtp ? 'mdi mdi-check' : ''"
33
- @keyup.enter.prevent="hasOtp ? checkOtp() : null"
34
- ></base-form-input>
35
- </base-fade-transition>
36
26
  <base-form-input
37
27
  v-model="member.lastName"
38
28
  :readonly="isDisabled || isFromGBD"
@@ -487,6 +477,23 @@
487
477
  <base-btn :disabled="documentLoading" :loading="documentLoading" text="Скачать" @click="getFile('download')"></base-btn>
488
478
  </div>
489
479
  </Teleport>
480
+ <Teleport v-if="isOtpPanelOpen && !member.hasAgreement" to="#panel-actions">
481
+ <div :class="[$libStyles.flexColNav]">
482
+ <base-fade-transition>
483
+ <base-rounded-input
484
+ v-if="otpCondition && member.otpTokenId"
485
+ v-model="member.otpCode"
486
+ :label="$t('form.otpCode')"
487
+ :maska="$maska.otp"
488
+ :append-inner-icon="hasOtp ? 'mdi-cellphone-message text-[17px]' : ''"
489
+ hide-details
490
+ @keyup.enter.prevent="hasOtp ? checkOtp() : null"
491
+ ></base-rounded-input>
492
+ </base-fade-transition>
493
+ <base-btn v-if="!member.otpTokenId" :disabled="otpSending" :loading="otpSending" :text="$t('buttons.sendOtp')" @click="sendOtp(false)"></base-btn>
494
+ <base-btn v-if="member.otpTokenId" :disabled="otpSending" :loading="otpSending" :text="$t('buttons.check')" @click="checkOtp()"></base-btn>
495
+ </div>
496
+ </Teleport>
490
497
  <base-dialog v-model="familyDialog" :title="$t('dialog.familyMember')" actions="familyDialog">
491
498
  <template #actions>
492
499
  <base-family-dialog :selected="selectedFamilyMember" @selectFamilyMember="selectFamilyMember" @reset="closeFamilyDialog(true)"></base-family-dialog>
@@ -518,8 +525,10 @@ export default {
518
525
  const isButtonLoading = ref<boolean>(false);
519
526
  const isSubmittingForm = ref<boolean>(false);
520
527
  const documentLoading = ref<boolean>(false);
528
+ const otpSending = ref<boolean>(false);
521
529
  const isSearchOpen = ref<boolean>(false);
522
530
  const isDocumentOpen = ref<boolean>(false);
531
+ const isOtpPanelOpen = ref<boolean>(false);
523
532
  const isPanelLoading = ref<boolean>(false);
524
533
  const familyDialog = ref<boolean>(false);
525
534
  const sameAddress = ref<boolean>(false);
@@ -659,6 +668,7 @@ export default {
659
668
  dataStore.panel.open = true;
660
669
  isSearchOpen.value = true;
661
670
  isDocumentOpen.value = false;
671
+ isOtpPanelOpen.value = false;
662
672
  isPanelOpen.value = false;
663
673
  } else {
664
674
  dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
@@ -669,13 +679,21 @@ export default {
669
679
  vForm.value.scrollTo({ top: direction === 'up' ? 0 : screen.height * 10, behavior: 'smooth' });
670
680
  };
671
681
 
672
- const openCustomPanel = (type: 'document' = 'document') => {
682
+ const openCustomPanel = (type: 'document' | 'otp' = 'document') => {
673
683
  dataStore.panelAction = null;
674
684
  if (type === 'document' && memberDocument.value) {
675
685
  dataStore.panel.title = memberDocument.value.fileTypeName!;
676
686
  isDocumentOpen.value = true;
677
687
  isSearchOpen.value = false;
678
688
  isPanelOpen.value = false;
689
+ isOtpPanelOpen.value = false;
690
+ }
691
+ if (type === 'otp') {
692
+ dataStore.panel.title = dataStore.t('form.otpCode');
693
+ isOtpPanelOpen.value = true;
694
+ isDocumentOpen.value = false;
695
+ isSearchOpen.value = false;
696
+ isPanelOpen.value = false;
679
697
  }
680
698
  dataStore.panel.open = true;
681
699
  };
@@ -684,6 +702,7 @@ export default {
684
702
  if (!isDisabled.value) {
685
703
  isSearchOpen.value = false;
686
704
  isDocumentOpen.value = false;
705
+ isOtpPanelOpen.value = false;
687
706
  // Feature
688
707
  // const notAllowedToChange = ['gender', 'documentType', 'documentIssuers'];
689
708
  // if (member.value.gotFromInsis === false && notAllowedToChange.includes(key)) {
@@ -870,7 +889,7 @@ export default {
870
889
  };
871
890
 
872
891
  const getContragentFromGBDFL = async () => {
873
- if (member.value.hasAgreement === false) {
892
+ if (member.value.hasAgreement !== true) {
874
893
  dataStore.showToaster('error', dataStore.t('toaster.needAgreement'), 3000);
875
894
  dataStore.panel.open = false;
876
895
  isSearchOpen.value = false;
@@ -883,15 +902,19 @@ export default {
883
902
  return;
884
903
  }
885
904
  isButtonLoading.value = true;
886
- await dataStore.getContragentFromGBDFL(member.value);
887
- member.value.gotFromInsis = true;
905
+ const response = await dataStore.getContragentFromGBDFL(member.value);
906
+ if (typeof response === 'boolean') {
907
+ if (response === true) {
908
+ member.value.gotFromInsis = true;
909
+ }
910
+ dataStore.panel.open = false;
911
+ isSearchOpen.value = false;
912
+ }
888
913
  isButtonLoading.value = false;
889
- dataStore.panel.open = false;
890
- isSearchOpen.value = false;
891
914
  };
892
915
 
893
916
  const getContragent = async () => {
894
- if (member.value.hasAgreement === false) {
917
+ if (member.value.hasAgreement !== true) {
895
918
  dataStore.showToaster('error', dataStore.t('toaster.needAgreement'), 3000);
896
919
  dataStore.panel.open = false;
897
920
  isSearchOpen.value = false;
@@ -968,6 +991,9 @@ export default {
968
991
  }
969
992
  }
970
993
  const memberFromApplicaiton = memberStore.getMemberFromApplication(whichForm.value as MemberKeys, whichIndex.value ? Number(whichIndex.value) : undefined);
994
+ if (typeof member.value.id !== 'number' || (typeof member.value.id === 'number' && member.value.id > 0 === false)) {
995
+ return false;
996
+ }
971
997
  const isSaved = await dataStore.saveMember(member.value, memberStore.getMemberCode(whichForm.value as MemberKeys), memberFromApplicaiton);
972
998
  if (!isSaved) return false;
973
999
  if (whichForm.value === formStore.policyholderFormKey) {
@@ -985,7 +1011,7 @@ export default {
985
1011
  name: route.name!,
986
1012
  query: { ...route.query, id: member.value.id },
987
1013
  });
988
- await dataStore.getApplicationData(route.params.taskId, false, true, true, false);
1014
+ await dataStore.getApplicationData(route.params.taskId, false, false, true, false);
989
1015
  if (dataStore.controls.hasCalculator) {
990
1016
  if (formStore.additionalInsuranceTermsWithout && formStore.additionalInsuranceTermsWithout.length !== 0) {
991
1017
  formStore.additionalInsuranceTerms.forEach((term: any) => {
@@ -1009,7 +1035,7 @@ export default {
1009
1035
  return true;
1010
1036
  }
1011
1037
  }
1012
- if (member.value.hasAgreement === false) {
1038
+ if (member.value.hasAgreement !== true) {
1013
1039
  dataStore.showToaster('error', dataStore.t('toaster.needAgreement'));
1014
1040
  return false;
1015
1041
  }
@@ -1073,16 +1099,59 @@ export default {
1073
1099
  dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: dataStore.t('form.otpCode') }), 3000);
1074
1100
  return;
1075
1101
  }
1102
+ otpSending.value = true;
1076
1103
  const checked = await memberStore.checkOtp(member.value);
1077
1104
  if (typeof checked !== 'undefined') {
1078
1105
  member.value.hasAgreement = checked;
1079
1106
  }
1107
+ otpSending.value = false;
1108
+ if (checked === true) {
1109
+ dataStore.panel.open = false;
1110
+ }
1080
1111
  };
1081
1112
 
1082
1113
  const sendOtp = async (onInit = false) => {
1114
+ otpSending.value = true;
1083
1115
  const response = await memberStore.sendOtp(member.value, formStore.applicationData.processInstanceId, onInit);
1084
1116
  if (response) {
1085
1117
  if (member.value.hasAgreement === null) member.value.hasAgreement = response.otpStatus;
1118
+ if (response.otpStatus === true) {
1119
+ dataStore.panel.open = false;
1120
+ }
1121
+ }
1122
+ otpSending.value = false;
1123
+ };
1124
+
1125
+ const setDefaultValues = async () => {
1126
+ const setDefaults = dataStore.controls.setDefaults;
1127
+ if (setDefaults.sectorCode) {
1128
+ await setSectorCode();
1129
+ }
1130
+ if (setDefaults.percentage) {
1131
+ setPercentage();
1132
+ }
1133
+ };
1134
+
1135
+ const setSectorCode = async () => {
1136
+ if (member.value.id === 0 && route.query.id === '0') {
1137
+ const sectorList = await dataStore.getSectorCodeList();
1138
+ const defaultValue = sectorList.find(item => item.ids === '500003.9') as Value;
1139
+ member.value.economySectorCode = defaultValue ? defaultValue : new Value();
1140
+ }
1141
+ };
1142
+
1143
+ const setPercentage = () => {
1144
+ if (whichForm.value === formStore.beneficiaryFormKey && member.value.id === 0 && route.query.id === '0' && member.value.percentageOfPayoutAmount === null) {
1145
+ if (dataStore.members.beneficiaryApp.isMultiple) {
1146
+ const availablePercentage =
1147
+ 100 -
1148
+ formStore.beneficiaryForm.reduce((sum, member) => {
1149
+ return sum + Number(member.percentageOfPayoutAmount);
1150
+ }, 0);
1151
+ if (availablePercentage >= 0 && availablePercentage <= 100) member.value.percentageOfPayoutAmount = availablePercentage;
1152
+ } else {
1153
+ member.value.percentageOfPayoutAmount = 100;
1154
+ }
1086
1155
  }
1087
1156
  };
1088
1157
 
@@ -1108,6 +1177,7 @@ export default {
1108
1177
  const filteredDocuments: DocumentItem[] = dataStore.getFilesByIIN(member.value.iin!.replace(/-/g, '')) as DocumentItem[];
1109
1178
  if (filteredDocuments && filteredDocuments.length) memberDocument.value = filteredDocuments[0];
1110
1179
  }
1180
+ await setDefaultValues();
1111
1181
  };
1112
1182
 
1113
1183
  onMounted(async () => {
@@ -1153,14 +1223,14 @@ export default {
1153
1223
  },
1154
1224
  );
1155
1225
 
1156
- watch(
1157
- () => member.value.otpCode,
1158
- async () => {
1159
- if (member.value.otpCode && member.value.otpCode.length === useMask().otp.length) {
1160
- await checkOtp();
1161
- }
1162
- },
1163
- );
1226
+ // watch(
1227
+ // () => member.value.otpCode,
1228
+ // async () => {
1229
+ // if (member.value.otpCode && member.value.otpCode.length === useMask().otp.length) {
1230
+ // await checkOtp();
1231
+ // }
1232
+ // },
1233
+ // );
1164
1234
 
1165
1235
  watch(
1166
1236
  () => dataStore.panel.open,
@@ -1169,6 +1239,7 @@ export default {
1169
1239
  isPanelOpen.value = false;
1170
1240
  isDocumentOpen.value = false;
1171
1241
  isSearchOpen.value = false;
1242
+ isOtpPanelOpen.value = false;
1172
1243
  dataStore.panelAction = null;
1173
1244
  }
1174
1245
  },
@@ -1190,10 +1261,12 @@ export default {
1190
1261
  isPanelOpen,
1191
1262
  isSearchOpen,
1192
1263
  isDocumentOpen,
1264
+ isOtpPanelOpen,
1193
1265
  isPanelLoading,
1194
1266
  isButtonLoading,
1195
1267
  isSubmittingForm,
1196
1268
  documentLoading,
1269
+ otpSending,
1197
1270
  panelValue,
1198
1271
  panelList,
1199
1272
  searchQuery,
@@ -178,7 +178,7 @@
178
178
  :clearable="!isDisabled"
179
179
  :rules="insurancePremiumPerMonth"
180
180
  :label="$t('productConditionsForm.insurancePremiumAmountInDollar')"
181
- :suffix="constants.currencySymbols.usd"
181
+ :suffix="$constants.currencySymbols.usd"
182
182
  @input="onInputInsurancePremiumPerMonthInDollar"
183
183
  ></base-form-input>
184
184
  <base-form-input
@@ -198,6 +198,7 @@
198
198
  :clearable="!isDisabled"
199
199
  :label="term.coverTypeName"
200
200
  append-inner-icon="mdi mdi-chevron-right"
201
+ :suffix="!!term.amount ? `${$dataStore.getNumberWithSpaces(term.amount)} ${currencySymbolsAddTerm}` : ''"
201
202
  @append="openTermPanel(term.coverTypeName, $dataStore.getAdditionalInsuranceTermsAnswers, term.coverTypeId, index)"
202
203
  ></base-panel-input>
203
204
  </div>
@@ -334,6 +335,12 @@ export default defineComponent({
334
335
  }
335
336
  return baseCondition;
336
337
  });
338
+ const currencySymbolsAddTerm = computed(() => {
339
+ if (dataStore.isKazyna) {
340
+ return constants.currencySymbols.usd
341
+ }
342
+ return constants.currencySymbols.kzt
343
+ });
337
344
 
338
345
  const toStatement = async () => {
339
346
  const statementItem = dataStore.menuItems.find(i => i.id === 'statement');
@@ -665,6 +672,7 @@ export default defineComponent({
665
672
  hasInsurancePremiumPerMonthInDollar,
666
673
  hasCurrency,
667
674
  hasCalculated,
675
+ currencySymbolsAddTerm,
668
676
 
669
677
  // Rules
670
678
  coverPeriodRule,
@@ -780,10 +780,16 @@ export class ProductConditions {
780
780
  export class MemberSettings {
781
781
  has?: boolean;
782
782
  isMultiple?: boolean;
783
- constructor(options?: { has?: boolean; isMultiple?: boolean }) {
783
+ required?: boolean;
784
+ constructor(options?: { has?: boolean; isMultiple?: boolean; required?: boolean }) {
784
785
  if (options) {
785
786
  this.has = options.has;
786
787
  this.isMultiple = options.isMultiple;
788
+ if (this.has === true) {
789
+ this.required = options.required;
790
+ } else {
791
+ this.required = false;
792
+ }
787
793
  }
788
794
  }
789
795
  }
@@ -791,6 +797,11 @@ export class MemberSettings {
791
797
  export class DataStoreClass {
792
798
  // IMP Контроллер фич
793
799
  controls: {
800
+ // Cтавит значения по дефолту полям
801
+ setDefaults: {
802
+ sectorCode: boolean;
803
+ percentage: boolean;
804
+ };
794
805
  // Проверка на роль при авторизации
795
806
  onAuth: boolean;
796
807
  // Согласие на главной странице
@@ -926,6 +937,10 @@ export class DataStoreClass {
926
937
  spokesmanApp: new MemberSettings(),
927
938
  };
928
939
  this.controls = {
940
+ setDefaults: {
941
+ sectorCode: true,
942
+ percentage: true,
943
+ },
929
944
  onAuth: false,
930
945
  hasAnketa: true,
931
946
  hasAgreement: true,
package/locales/en.json CHANGED
@@ -89,7 +89,13 @@
89
89
  "needToRecalculate": "You need to recalculate the product conditions",
90
90
  "noUrl": "No link available",
91
91
  "pickFamilyMember": "Pick a family member",
92
- "numberRegistered": "Регистрационный номер успешно записан в реестр"
92
+ "numberRegistered": "Регистрационный номер успешно записан в реестр",
93
+ "requiredMember": "В заявке должен присутствовать {text}",
94
+ "client": "страхователь",
95
+ "insured": "застрахованный",
96
+ "beneficiary": "выгодоприобретатель",
97
+ "beneficialOwner": "бенефициарный собственник",
98
+ "spokesman": "представитель страхователя"
93
99
  },
94
100
  "buttons": {
95
101
  "createStatement": "Create Statement",
@@ -132,6 +138,8 @@
132
138
  "fromGBDFL": "From State Database of Individuals",
133
139
  "fromGKB": "From State Credit Bureau",
134
140
  "sendSMS": "Send SMS",
141
+ "sendOtp": "Send OTP",
142
+ "check": "Check",
135
143
  "toPayment": "Go to Payment",
136
144
  "calcSum": "Calculate Sum",
137
145
  "calcPremium": "Calculate Premium",
@@ -531,7 +539,7 @@
531
539
  "otpCode": "Confirmation Code",
532
540
  "salesChanell": "Sales Channel",
533
541
  "manager": "Manager",
534
- "attachManager": "Attach to Manager",
542
+ "attachManager": "Manager",
535
543
  "agent": "Agent"
536
544
  },
537
545
  "agreementBlock": {
package/locales/kz.json CHANGED
@@ -89,7 +89,13 @@
89
89
  "needToRecalculate": "Необходимо пересчитать условия продукта",
90
90
  "noUrl": "Отсутствует ссылка",
91
91
  "pickFamilyMember": "Выберите члена семьи",
92
- "numberRegistered": "Регистрационный номер успешно записан в реестр"
92
+ "numberRegistered": "Регистрационный номер успешно записан в реестр",
93
+ "requiredMember": "В заявке должен присутствовать {text}",
94
+ "client": "страхователь",
95
+ "insured": "застрахованный",
96
+ "beneficiary": "выгодоприобретатель",
97
+ "beneficialOwner": "бенефициарный собственник",
98
+ "spokesman": "представитель страхователя"
93
99
  },
94
100
  "buttons": {
95
101
  "createStatement": "Создать заявку",
@@ -132,6 +138,8 @@
132
138
  "fromGBDFL": "Государственная база данных физических лиц",
133
139
  "fromGKB": "Государственное кредитное бюро",
134
140
  "sendSMS": "Отправить СМС",
141
+ "sendOtp": "Отправить OTP",
142
+ "check": "Проверить",
135
143
  "toPayment": "Перейти к оплате",
136
144
  "calcSum": "Рассчитать сумму",
137
145
  "calcPremium": "Рассчитать премию",
@@ -531,7 +539,7 @@
531
539
  "otpCode": "Код подтверждения",
532
540
  "salesChanell": " Канал продаж",
533
541
  "manager": "Менеджер",
534
- "attachManager": "Прикрепление к менеджеру",
542
+ "attachManager": "Менеджер",
535
543
  "agent": "Агент"
536
544
  },
537
545
  "agreementBlock": {
package/locales/ru.json CHANGED
@@ -89,7 +89,13 @@
89
89
  "needToRecalculate": "Необходимо пересчитать условия продукта",
90
90
  "noUrl": "Отсутствует ссылка",
91
91
  "pickFamilyMember": "Выберите члена семьи",
92
- "numberRegistered": "Регистрационный номер успешно записан в реестр"
92
+ "numberRegistered": "Регистрационный номер успешно записан в реестр",
93
+ "requiredMember": "В заявке должен присутствовать {text}",
94
+ "client": "страхователь",
95
+ "insured": "застрахованный",
96
+ "beneficiary": "выгодоприобретатель",
97
+ "beneficialOwner": "бенефициарный собственник",
98
+ "spokesman": "представитель страхователя"
93
99
  },
94
100
  "buttons": {
95
101
  "createStatement": "Создать заявку",
@@ -132,6 +138,8 @@
132
138
  "fromGBDFL": "Государственная база данных физических лиц",
133
139
  "fromGKB": "Государственное кредитное бюро",
134
140
  "sendSMS": "Отправить СМС",
141
+ "sendOtp": "Отправить OTP",
142
+ "check": "Проверить",
135
143
  "toPayment": "Перейти к оплате",
136
144
  "calcSum": "Рассчитать сумму",
137
145
  "calcPremium": "Рассчитать премию",
@@ -531,7 +539,7 @@
531
539
  "otpCode": "Код подтверждения",
532
540
  "salesChanell": " Канал продаж",
533
541
  "manager": "Менеджер",
534
- "attachManager": "Прикрепление к менеджеру",
542
+ "attachManager": "Менеджер",
535
543
  "agent": "Агент"
536
544
  },
537
545
  "agreementBlock": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.8-beta.16",
3
+ "version": "0.0.8-beta.18",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -712,8 +712,8 @@ export const useDataStore = defineStore('data', {
712
712
  addressData.push({
713
713
  id: 'response' in user && user.response && 'addresses' in user.response ? user.response.addresses[0].id : 0,
714
714
  contragentId: user.id,
715
- countryCode: user.birthPlace.ids,
716
- countryName: user.birthPlace.nameRu,
715
+ countryCode: user.registrationCountry.ids,
716
+ countryName: user.registrationCountry.nameRu,
717
717
  stateCode: user.registrationProvince.ids,
718
718
  stateName: user.registrationProvince.nameRu,
719
719
  cityCode: user.registrationCity.code,
@@ -727,9 +727,9 @@ export const useDataStore = defineStore('data', {
727
727
  cityTypeName: user.registrationRegionType.nameRu,
728
728
  blockNumber: user.registrationNumberHouse,
729
729
  apartmentNumber: user.registrationNumberApartment,
730
- address: `${checkForNull(user.birthPlace.nameRu)}, ${checkForNull(user.registrationRegionType.nameRu)} ${checkForNull(user.registrationCity.nameRu)}, ул. ${checkForNull(
731
- user.registrationStreet,
732
- )}, д. ${checkForNull(user.registrationNumberHouse)} кв. ${checkForNull(user.registrationNumberApartment)}`,
730
+ address: `${checkForNull(user.registrationCountry.nameRu)}, ${checkForNull(user.registrationRegionType.nameRu)} ${checkForNull(
731
+ user.registrationCity.nameRu,
732
+ )}, ул. ${checkForNull(user.registrationStreet)}, д. ${checkForNull(user.registrationNumberHouse)} кв. ${checkForNull(user.registrationNumberApartment)}`,
733
733
  type: 'H',
734
734
  });
735
735
 
@@ -742,9 +742,11 @@ export const useDataStore = defineStore('data', {
742
742
  };
743
743
 
744
744
  const personId = await this.api.saveContragent(data);
745
- if (personId) {
745
+ if (personId > 0) {
746
746
  await this.getContragentById(personId, whichForm, false, whichIndex);
747
747
  user.otpTokenId = null;
748
+ } else {
749
+ return false;
748
750
  }
749
751
  } catch (err) {
750
752
  this.isLoading = false;
@@ -1344,6 +1346,7 @@ export const useDataStore = defineStore('data', {
1344
1346
  if (this.isKazyna) {
1345
1347
  calculationData.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
1346
1348
  calculationData.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
1349
+ calculationData.currencyExchangeRate = this.currencies.usd;
1347
1350
  }
1348
1351
  const calculationResponse = await this.api.calculateWithoutApplication(calculationData);
1349
1352
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
@@ -1397,6 +1400,7 @@ export const useDataStore = defineStore('data', {
1397
1400
  if (this.isKazyna) {
1398
1401
  form1.policyAppDto.premiumInCurrency = getNumber(this.formStore.productConditionsForm.insurancePremiumPerMonthInDollar);
1399
1402
  form1.policyAppDto.amountInCurrency = getNumber(this.formStore.productConditionsForm.requestedSumInsuredInDollar);
1403
+ form1.policyAppDto.currencyExchangeRate = this.currencies.usd;
1400
1404
  }
1401
1405
  try {
1402
1406
  let id = this.formStore.applicationData.processInstanceId;
@@ -1972,22 +1976,45 @@ export const useDataStore = defineStore('data', {
1972
1976
  this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
1973
1977
  return false;
1974
1978
  }
1975
- if (!this.isGons) {
1979
+ if (this.members.insuredApp.has) {
1976
1980
  if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
1977
1981
  return false;
1978
1982
  }
1983
+ if (this.members.insuredApp.required) {
1984
+ const inStatement = this.formStore.insuredForm.every(i => i.id > 0);
1985
+ if (inStatement === false) {
1986
+ this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.insured') }));
1987
+ return false;
1988
+ }
1989
+ }
1979
1990
  }
1980
- if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
1981
- return false;
1991
+ if (this.members.beneficiaryApp.has) {
1992
+ if (this.validateMultipleMembers(this.formStore.beneficiaryFormKey, 'beneficiaryApp', 'выгодоприобретателей') === false) {
1993
+ return false;
1994
+ }
1995
+ if (this.members.beneficiaryApp.required) {
1996
+ const inStatement = this.formStore.beneficiaryForm.every(i => i.id > 0);
1997
+ if (inStatement === false) {
1998
+ this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficiary') }));
1999
+ return false;
2000
+ }
2001
+ }
1982
2002
  }
1983
- if (!this.isGons) {
2003
+ if (this.members.beneficialOwnerApp.has) {
1984
2004
  if (this.formStore.isActOwnBehalf === false) {
1985
2005
  if (this.validateMultipleMembers(this.formStore.beneficialOwnerFormKey, 'beneficialOwnerApp', 'бенефициарных собственников') === false) {
1986
2006
  return false;
1987
2007
  }
1988
2008
  }
2009
+ if (this.members.beneficialOwnerApp.required) {
2010
+ const inStatement = this.formStore.beneficialOwnerForm.every(i => i.id > 0);
2011
+ if (inStatement === false) {
2012
+ this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.beneficialOwner') }));
2013
+ return false;
2014
+ }
2015
+ }
1989
2016
  }
1990
- if (!this.isGons) {
2017
+ if (this.members.spokesmanApp.has) {
1991
2018
  if (this.formStore.hasRepresentative) {
1992
2019
  if (this.formStore.applicationData.spokesmanApp && this.formStore.policyholdersRepresentativeForm.id !== this.formStore.applicationData.spokesmanApp.insisId) {
1993
2020
  this.showToaster(
@@ -2000,6 +2027,13 @@ export const useDataStore = defineStore('data', {
2000
2027
  return false;
2001
2028
  }
2002
2029
  }
2030
+ if (this.members.spokesmanApp.required) {
2031
+ const inStatement = this.formStore.policyholdersRepresentativeForm.id > 0;
2032
+ if (inStatement === false) {
2033
+ this.showToaster('error', this.t('toaster.requiredMember', { text: this.t('toaster.spokesman') }));
2034
+ return false;
2035
+ }
2036
+ }
2003
2037
  }
2004
2038
  if (this.controls.hasAttachment) {
2005
2039
  const areValid = this.formStore.SaleChanellPolicy.nameRu && this.formStore.RegionPolicy.nameRu && this.formStore.ManagerPolicy.nameRu && this.formStore.AgentData.fullName;
@@ -2167,6 +2201,9 @@ export const useDataStore = defineStore('data', {
2167
2201
  }
2168
2202
  },
2169
2203
  async getContragentFromGBDFL(member) {
2204
+ // null - ожидание
2205
+ // false - ошибка или неправильно
2206
+ // true - успешно и данные получены
2170
2207
  this.isLoading = true;
2171
2208
  try {
2172
2209
  const data = {
@@ -2177,21 +2214,22 @@ export const useDataStore = defineStore('data', {
2177
2214
  if (gbdResponse.status === 'soap:Server') {
2178
2215
  this.showToaster('error', `${gbdResponse.statusName}. Отправьте запрос через некоторое время`, 5000);
2179
2216
  this.isLoading = false;
2180
- return;
2217
+ return false;
2181
2218
  }
2182
2219
  if (gbdResponse.status === 'PENDING') {
2183
- this.showToaster('success', this.t('toaster.waitForClient'), 5000);
2220
+ this.showToaster('info', this.t('toaster.waitForClient'), 5000);
2184
2221
  this.isLoading = false;
2185
- return;
2222
+ return null;
2186
2223
  }
2187
2224
  if (constants.gbdErrors.find(i => i === gbdResponse.status)) {
2188
2225
  if (gbdResponse.status === 'TIMEOUT') {
2189
- this.showToaster('success', `${gbdResponse.statusName}. Отправьте запрос еще раз`, 5000);
2226
+ this.showToaster('error', `${gbdResponse.statusName}. Отправьте запрос еще раз`, 5000);
2227
+ return null;
2190
2228
  } else {
2191
- this.showToaster('success', gbdResponse.statusName, 5000);
2229
+ this.showToaster('error', gbdResponse.statusName, 5000);
2192
2230
  }
2193
2231
  this.isLoading = false;
2194
- return;
2232
+ return false;
2195
2233
  }
2196
2234
  const { person } = parseXML(gbdResponse.content, true, 'person');
2197
2235
  const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
@@ -2203,10 +2241,12 @@ export const useDataStore = defineStore('data', {
2203
2241
  member.verifyDate = responseInfo.responseDate;
2204
2242
  member.verifyType = 'GBDFL';
2205
2243
  await this.saveInStoreUserGBDFL(person, member);
2244
+ return true;
2206
2245
  } catch (err) {
2207
- ErrorHandler(err);
2246
+ return ErrorHandler(err);
2247
+ } finally {
2248
+ this.isLoading = false;
2208
2249
  }
2209
- this.isLoading = false;
2210
2250
  },
2211
2251
  async saveInStoreUserGBDFL(person, member) {
2212
2252
  member.firstName = person.name;
@@ -35,8 +35,13 @@ export const useMemberStore = defineStore('members', {
35
35
  if (!whichForm) return false;
36
36
  if (!this.isStatementEditible(whichForm)) return false;
37
37
  if (!this.validateInitiator(false)) return false;
38
- if (typeof whichIndex === 'number' && whichIndex > 0) {
39
- return true;
38
+ if (typeof whichIndex === 'number') {
39
+ if (whichIndex > 0) {
40
+ return true;
41
+ }
42
+ if (whichIndex === 0) {
43
+ return this.hasMemberData(whichForm, whichIndex);
44
+ }
40
45
  }
41
46
  if (this.dataStore.isTask() && this.dataStore.isProcessEditable(this.formStore.applicationData.statusCode)) {
42
47
  if (whichForm !== this.formStore.policyholderFormKey) {
@@ -159,8 +164,9 @@ export const useMemberStore = defineStore('members', {
159
164
  } else {
160
165
  if (memberData) await this.dataStore.api.deleteMember(memberCode, memberData.id as number);
161
166
  }
167
+ const cleared = this.clearMember(whichForm, whichIndex);
162
168
  if (memberData && refetch) await this.dataStore.getApplicationData(taskId, true, true, true, false);
163
- return this.clearMember(whichForm, whichIndex);
169
+ return cleared;
164
170
  } catch (err) {
165
171
  console.log(err);
166
172
  return ErrorHandler(err);
@@ -202,6 +208,12 @@ export const useMemberStore = defineStore('members', {
202
208
 
203
209
  if (successTranser.value === true) {
204
210
  if (toIndex.value !== null && taskId !== '0' && this.formStore.applicationData.processInstanceId !== 0) {
211
+ if (
212
+ typeof this.formStore[to][toIndex.value].id !== 'number' ||
213
+ (typeof this.formStore[to][toIndex.value].id === 'number' && this.formStore[to][toIndex.value].id > 0 === false)
214
+ ) {
215
+ return false;
216
+ }
205
217
  const hasSaved = await this.dataStore.saveMember(this.formStore[to][toIndex.value], this.getMemberCode(to), this.getMemberFromApplication(to, toIndex.value));
206
218
  if (hasSaved) {
207
219
  await this.dataStore.getApplicationData(taskId, false, true, true, false);
@@ -288,8 +300,14 @@ export const useMemberStore = defineStore('members', {
288
300
  // TODO Доработать и менять значение hasAgreement.value => true
289
301
  this.dataStore.showToaster(otpResponse.status !== 2 ? 'error' : 'success', otpResponse.statusName, 3000);
290
302
  if (otpResponse.status === 2) {
303
+ member.otpCode = null;
291
304
  return true;
292
305
  }
306
+ if (otpResponse.status === 4 || otpResponse.status === 5) {
307
+ member.otpCode = null;
308
+ member.otpTokenId = null;
309
+ return false;
310
+ }
293
311
  }
294
312
  }
295
313
  return false;
@@ -303,7 +321,7 @@ export const useMemberStore = defineStore('members', {
303
321
  async sendOtp(member: Member, processInstanceId: string | number | null = null, onInit: boolean = false) {
304
322
  if (!this.validateInitiator()) return null;
305
323
  this.dataStore.isLoading = true;
306
- let otpStatus: boolean = false;
324
+ let otpStatus: boolean | null = null;
307
325
  let otpResponse: SendOtpResponse = {};
308
326
  try {
309
327
  if (member.iin && member.phoneNumber && member.iin.length === useMask().iin.length && member.phoneNumber.length === useMask().phone.length) {
@@ -331,25 +349,22 @@ export const useMemberStore = defineStore('members', {
331
349
  if (!!otpResponse) {
332
350
  if ('errMessage' in otpResponse && otpResponse.errMessage !== null) {
333
351
  this.dataStore.showToaster('error', otpResponse.errMessage, 3000);
334
- return { otpStatus };
352
+ return { otpStatus: false };
335
353
  }
336
354
  if ('result' in otpResponse && otpResponse.result === null) {
337
355
  if ('statusName' in otpResponse && !!otpResponse.statusName) {
338
356
  this.dataStore.showToaster('error', otpResponse.statusName, 3000);
339
- return { otpStatus };
357
+ return { otpStatus: false };
340
358
  }
341
359
  if ('status' in otpResponse && !!otpResponse.status) {
342
360
  this.dataStore.showToaster('error', otpResponse.status, 3000);
343
- return { otpStatus };
361
+ return { otpStatus: false };
344
362
  }
345
363
  }
346
364
  if ('tokenId' in otpResponse && otpResponse.tokenId) {
347
365
  member.otpTokenId = otpResponse.tokenId;
348
366
  this.dataStore.showToaster('success', this.dataStore.t('toaster.successOtp'), 3000);
349
367
  }
350
- } else {
351
- this.dataStore.showToaster('error', this.dataStore.t('error.noOtpResponse'), 3000);
352
- return { otpStatus };
353
368
  }
354
369
  }
355
370
  } else {