hl-core 0.0.8-beta.1 → 0.0.8-beta.10

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.
@@ -221,6 +221,13 @@
221
221
  <base-form-input v-model="member.jobPlace" :label="$t('form.jobPlace')" :readonly="isDisabled" :clearable="!isDisabled" :rules="$rules.required"></base-form-input>
222
222
  </base-form-section>
223
223
  <base-form-section :title="$t('form.placeRegistration')" v-if="$dataStore.hasPlaceSection(whichForm)">
224
+ <base-form-toggle
225
+ v-if="whichForm === formStore.beneficiaryFormKey"
226
+ v-model="sameAddress"
227
+ :disabled="isDisabled"
228
+ :has-border="false"
229
+ :title="$t('form.sameAddress')"
230
+ ></base-form-toggle>
224
231
  <base-panel-input
225
232
  v-model="member.registrationCountry"
226
233
  :value="member.registrationCountry.nameRu"
@@ -379,7 +386,7 @@
379
386
  :label="$t('form.signOfResidency')"
380
387
  :readonly="isDisabled"
381
388
  :clearable="!isDisabled"
382
- :rules="$rules.objectRequired"
389
+ :rules="residencyRule"
383
390
  append-inner-icon="mdi mdi-chevron-right"
384
391
  @append="openPanel($t('form.signOfResidency'), [], 'signOfResidency', $dataStore.getResidents)"
385
392
  ></base-panel-input>
@@ -459,7 +466,7 @@
459
466
  <base-panel-select-item
460
467
  v-for="(item, index) of panelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
461
468
  :key="index"
462
- :text="item.nameRu as string"
469
+ :text="(item.nameRu as string)"
463
470
  :selected="item.nameRu === panelValue.nameRu"
464
471
  @click="pickPanelValue(item)"
465
472
  ></base-panel-select-item>
@@ -515,6 +522,7 @@ export default {
515
522
  const isDocumentOpen = ref<boolean>(false);
516
523
  const isPanelLoading = ref<boolean>(false);
517
524
  const familyDialog = ref<boolean>(false);
525
+ const sameAddress = ref<boolean>(false);
518
526
  const panelValue = ref<Value>(new Value());
519
527
  const panelList = ref<Value[]>([]);
520
528
  const currentPanel = ref<keyof typeof member.value>();
@@ -603,6 +611,18 @@ export default {
603
611
  return byMemberAndProductRule();
604
612
  });
605
613
 
614
+ const residencyRule = computed(() => {
615
+ switch (whichForm.value) {
616
+ case formStore.policyholderFormKey: {
617
+ if (dataStore.isBolashak || dataStore.isBaiterek) {
618
+ return dataStore.rules.objectRequired.concat(dataStore.rules.noResident);
619
+ }
620
+ }
621
+ default:
622
+ return dataStore.rules.objectRequired;
623
+ }
624
+ });
625
+
606
626
  const getOtpConditionByMember = () => {
607
627
  switch (whichForm.value) {
608
628
  case formStore.policyholderFormKey:
@@ -671,7 +691,7 @@ export default {
671
691
  isPanelLoading.value = true;
672
692
  newList = await asyncFunction(filterKey, member.value);
673
693
  }
674
- panelList.value = newList;
694
+ panelList.value = filterList(newList, key);
675
695
  panelValue.value = member.value[currentPanel.value];
676
696
  isPanelLoading.value = false;
677
697
  } else {
@@ -679,6 +699,22 @@ export default {
679
699
  }
680
700
  };
681
701
 
702
+ const filterList = (list: Value[], key: string) => {
703
+ if (dataStore.isBolashak) {
704
+ if (key === 'relationDegree') {
705
+ if (whichForm.value === formStore.beneficiaryFormKey) {
706
+ const beneficiaryRelations = [12, 13, 14, 15, 20, 21, 22, 23];
707
+ return list.filter(i => beneficiaryRelations.includes(Number(i.ids)));
708
+ }
709
+ if (whichForm.value === formStore.insuredFormKey) {
710
+ const insuredRelations = [6, 7, 10, 11, 12, 13, 14, 15, 20, 21, 22, 23];
711
+ return list.filter(i => insuredRelations.includes(Number(i.ids)));
712
+ }
713
+ }
714
+ }
715
+ return list;
716
+ };
717
+
682
718
  const pickPanelValue = (item: Value) => {
683
719
  if (formStore.isDisabled[whichForm.value as keyof typeof formStore.isDisabled] === false) {
684
720
  dataStore.panel.open = false;
@@ -690,6 +726,55 @@ export default {
690
726
  }
691
727
  };
692
728
 
729
+ const setAddress = () => {
730
+ const beneficiary = formStore.beneficiaryForm[Number(whichIndex.value)];
731
+ const policyholder = formStore.policyholderForm;
732
+ if (sameAddress.value === true) {
733
+ beneficiary.registrationCity = policyholder.registrationCity;
734
+ beneficiary.registrationCountry = policyholder.registrationCountry;
735
+ beneficiary.birthPlace = policyholder.birthPlace;
736
+ beneficiary.registrationMicroDistrict = policyholder.registrationMicroDistrict;
737
+ beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
738
+ beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
739
+ beneficiary.registrationNumberHouse = policyholder.registrationNumberHouse;
740
+ beneficiary.registrationProvince = policyholder.registrationProvince;
741
+ beneficiary.registrationQuarter = policyholder.registrationQuarter;
742
+ beneficiary.registrationRegion = policyholder.registrationRegion;
743
+ beneficiary.registrationRegionType = policyholder.registrationRegionType;
744
+ beneficiary.registrationStreet = policyholder.registrationStreet;
745
+ } else {
746
+ if (beneficiary.id === 0) {
747
+ beneficiary.registrationCity = new Value();
748
+ beneficiary.registrationCountry = new Value();
749
+ beneficiary.registrationMicroDistrict = '';
750
+ beneficiary.registrationNumberApartment = '';
751
+ beneficiary.registrationNumberApartment = '';
752
+ beneficiary.registrationNumberHouse = '';
753
+ beneficiary.registrationProvince = new Value();
754
+ beneficiary.registrationQuarter = '';
755
+ beneficiary.registrationRegion = new Value();
756
+ beneficiary.registrationRegionType = new Value();
757
+ beneficiary.registrationStreet = '';
758
+ } else {
759
+ const country = dataStore.countries.find(i => (i.nameRu as string).match(new RegExp(beneficiary.response?.addresses[0].countryName, 'i')));
760
+ const city = dataStore.cities.find(i => i.nameRu === beneficiary.response?.addresses[0].cityName.replace('г.', ''));
761
+ const province = dataStore.states.find(i => i.ids === beneficiary.response?.addresses[0].stateCode);
762
+ const localityType = dataStore.localityTypes.find(i => i.nameRu === beneficiary.response?.addresses[0].cityTypeName);
763
+ const region = dataStore.regions.find(i => i.ids == beneficiary.response?.addresses[0].regionCode);
764
+ beneficiary.registrationCountry = country ?? new Value();
765
+ beneficiary.registrationCity = city ?? new Value();
766
+ beneficiary.registrationMicroDistrict = beneficiary.response?.addresses[0].microRaion ?? '';
767
+ beneficiary.registrationNumberApartment = beneficiary.response?.addresses[0].apartmentNumber ?? '';
768
+ beneficiary.registrationNumberHouse = beneficiary.response?.addresses[0].blockNumber ?? '';
769
+ beneficiary.registrationProvince = province ?? new Value();
770
+ beneficiary.registrationQuarter = beneficiary.response?.addresses[0].kvartal ?? '';
771
+ beneficiary.registrationRegion = region ?? new Value();
772
+ beneficiary.registrationRegionType = localityType ?? new Value();
773
+ beneficiary.registrationStreet = beneficiary.response?.addresses[0].streetName ?? '';
774
+ }
775
+ }
776
+ };
777
+
693
778
  const uploadFile = async (processInstanceId: string | number) => {
694
779
  const selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.nameRu === member.value.documentType.nameRu);
695
780
  const formData = new FormData();
@@ -781,13 +866,13 @@ export default {
781
866
  return;
782
867
  }
783
868
  if (!member.value.iin || member.value.iin.length !== useMask().iin.length || !member.value.phoneNumber || member.value.phoneNumber.length !== useMask().phone.length) {
784
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', 'Номер телефона, ИИН'), 5000);
869
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: 'Номер телефона, ИИН' }), 5000);
785
870
  dataStore.panel.open = false;
786
871
  isSearchOpen.value = false;
787
872
  return;
788
873
  }
789
874
  isButtonLoading.value = true;
790
- await dataStore.getContragentFromGBDFL(member.value.iin, member.value.phoneNumber, whichForm.value, whichIndex.value ? Number(whichIndex.value) : null);
875
+ await dataStore.getContragentFromGBDFL(member.value);
791
876
  member.value.gotFromInsis = true;
792
877
  isButtonLoading.value = false;
793
878
  dataStore.panel.open = false;
@@ -802,13 +887,13 @@ export default {
802
887
  return;
803
888
  }
804
889
  if (!member.value.iin || member.value.iin.length !== useMask().iin.length) {
805
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', 'ИИН'), 5000);
890
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: 'ИИН' }), 5000);
806
891
  dataStore.panel.open = false;
807
892
  isSearchOpen.value = false;
808
893
  return;
809
894
  }
810
895
  isButtonLoading.value = true;
811
- await dataStore.getContragent(member.value, whichForm.value, whichIndex.value, false);
896
+ await dataStore.getContragent(member.value, false);
812
897
  isButtonLoading.value = false;
813
898
  dataStore.panel.open = false;
814
899
  isSearchOpen.value = false;
@@ -933,7 +1018,7 @@ export default {
933
1018
  const initialPoint = `${member.value.iin!.replaceAll('-', '')}.`;
934
1019
  const RESPONSE = ESBDMessage(ESBDResponse, initialPoint);
935
1020
  let errorMessage = RESPONSE !== false ? RESPONSE : 'Что-то произошло не так';
936
- if (ESBDResponse.errorCode === 0) {
1021
+ if (typeof ESBDResponse === 'object' && ESBDResponse.errorCode === 0) {
937
1022
  member.value.verifyType = 'ESBD';
938
1023
  member.value.verifyDate = ESBDResponse.verifiedDate;
939
1024
  const hasMemberSaved = await saveMember();
@@ -951,11 +1036,11 @@ export default {
951
1036
  if (errors) {
952
1037
  const errorText = errors.querySelector('.v-label.v-field-label');
953
1038
  if (errorText) {
954
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorText.innerHTML?.replace(/[-<>!//.]/g, '')));
1039
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorText.innerHTML?.replace(/[-<>!//.]/g, '') }));
955
1040
  } else {
956
1041
  const errorFieldText = errors.querySelector('.v-input__control');
957
1042
  if (errorFieldText) {
958
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '')));
1043
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '') }));
959
1044
  }
960
1045
  }
961
1046
  errors.scrollIntoView({
@@ -970,7 +1055,7 @@ export default {
970
1055
 
971
1056
  const checkOtp = async () => {
972
1057
  if (!member.value.otpCode || member.value.iin?.length !== useMask().iin.length || member.value.phoneNumber?.length !== useMask().phone.length) {
973
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', dataStore.t('form.otpCode')), 3000);
1058
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: dataStore.t('form.otpCode') }), 3000);
974
1059
  return;
975
1060
  }
976
1061
  const checked = await memberStore.checkOtp(member.value);
@@ -1020,6 +1105,13 @@ export default {
1020
1105
  }
1021
1106
  });
1022
1107
 
1108
+ watch(
1109
+ () => sameAddress.value,
1110
+ () => {
1111
+ if (whichForm.value === formStore.beneficiaryFormKey) setAddress();
1112
+ },
1113
+ );
1114
+
1023
1115
  watch(
1024
1116
  () => member.value.percentageOfPayoutAmount,
1025
1117
  val => {
@@ -1094,6 +1186,7 @@ export default {
1094
1186
  memberDocument,
1095
1187
  familyDialog,
1096
1188
  selectedFamilyMember,
1189
+ sameAddress,
1097
1190
 
1098
1191
  // Computed
1099
1192
  whichForm,
@@ -1108,9 +1201,11 @@ export default {
1108
1201
  hasGBDFL,
1109
1202
  hasInsis,
1110
1203
  hasGKB,
1204
+
1111
1205
  // Rules
1112
1206
  ageRule,
1113
1207
  phoneRule,
1208
+ residencyRule,
1114
1209
 
1115
1210
  // Functions
1116
1211
  searchMember,