hl-core 0.0.8-beta.27 → 0.0.8-beta.29

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <v-dialog v-model="fieldModel" :persistent="true">
2
+ <v-dialog :model-value="modelValue" @update:modelValue="$emit('update:modelValue', $event)" :persistent="true">
3
3
  <v-card class="self-center w-full sm:w-3/4 md:w-2/3 lg:w-2/4 xl:w-[600px] rounded-lg !p-2">
4
4
  <v-card-title>
5
5
  <slot v-if="!title" name="title"></slot>
@@ -41,39 +41,6 @@ export default defineComponent({
41
41
  default: 'default',
42
42
  },
43
43
  },
44
- emits: ['update:modelValue', 'submitted', 'yes', 'no'],
45
- setup(props, { emit }) {
46
- const fieldModel = ref(props.modelValue);
47
-
48
- const updateValue = (event: boolean) => {
49
- fieldModel.value = event;
50
- };
51
-
52
- const submitted = (event: any) => {
53
- emit('submitted', event);
54
- };
55
-
56
- watch(
57
- fieldModel,
58
- () => {
59
- emit('update:modelValue', fieldModel.value);
60
- },
61
- { immediate: true },
62
- );
63
-
64
- watch(
65
- () => props.modelValue,
66
- () => {
67
- fieldModel.value = props.modelValue;
68
- },
69
- { immediate: true },
70
- );
71
-
72
- return {
73
- fieldModel,
74
- submitted,
75
- updateValue,
76
- };
77
- },
44
+ emits: ['update:modelValue', 'yes', 'no'],
78
45
  });
79
46
  </script>
@@ -119,7 +119,7 @@ export default defineComponent({
119
119
  const member: Member = formStore[props.whichForm as MemberKeys];
120
120
 
121
121
  const isShort = computed(() => props.type === 'short');
122
- const isActionsAvailable = computed(() => memberStore.isStatementEditible(props.whichForm) && memberStore.validateInitiator(false));
122
+ const isActionsAvailable = computed(() => memberStore.isStatementEditible(props.whichForm));
123
123
 
124
124
  const getMemberInfo = (memberData: Member) => {
125
125
  return {
@@ -117,6 +117,7 @@ export default defineComponent({
117
117
  () =>
118
118
  props.disabled ||
119
119
  route.params.taskId === '0' ||
120
+ !dataStore.isInitiator() ||
120
121
  (route.params.taskId !== '0' && (!dataStore.isProcessEditable(formStore.applicationData.statusCode) || !dataStore.isTask())),
121
122
  );
122
123
 
@@ -69,7 +69,7 @@
69
69
  </base-form-text-section>
70
70
  </section>
71
71
  </v-form>
72
- <base-btn class="my-[14px] self-center" :loading="isButtonLoading" :disabled="formStore.isDisabled[whichSurvey]" @click="submitForm" :text="$t('buttons.save')"></base-btn>
72
+ <base-btn class="my-[14px] self-center" :loading="isButtonLoading" :disabled="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()" @click="submitForm" :text="$t('buttons.save')"></base-btn>
73
73
  </section>
74
74
  <v-btn
75
75
  v-if="secondQuestionList && secondQuestionList.length && firstPanel"
@@ -1,7 +1,31 @@
1
1
  <template>
2
2
  <section class="flex flex-col gap-4 px-[10px]">
3
3
  <v-form v-if="member" ref="vForm" @submit="submitForm" class="max-h-[82svh] overflow-y-scroll">
4
- <base-form-section :title="$t('form.personalData')">
4
+ <div v-if="memberSetting.has === true && memberSetting.isMultiple === true" class="flex items-center mt-[14px] min-h-[54px]">
5
+ <div :class="[$libStyles.blueBgLight]" class="flex flex-wrap items-center gap-2 p-1 rounded-t-[8px] h-full">
6
+ <div
7
+ v-for="(each, index) of formStore[whichForm as MemberKeys]"
8
+ :key="index"
9
+ class="pl-3 pr-1 py-1 rounded-[8px] cursor-pointer flex items-center"
10
+ :class="[Number(whichIndex) === index ? `${$libStyles.blueBg} ${$libStyles.whiteText}` : '', $libStyles.textSimple]"
11
+ @click.self="index !== Number(whichIndex) ? selectMember(index) : null"
12
+ >
13
+ {{ `${$dataStore.menu.selectedItem.title} ${index + 1}` }}
14
+ <v-btn
15
+ icon="mdi-close !text-[20px]"
16
+ size="x-small"
17
+ :disabled="!memberStore.canMemberDeleted((whichForm as MemberKeys), index) && !memberStore.canMemberCleared((whichForm as MemberKeys), index)"
18
+ variant="plain"
19
+ :color="Number(whichIndex) === index ? '#FFF' : '#A0B3D8'"
20
+ @click.prevent="
21
+ memberStore.canMemberDeleted(whichForm as MemberKeys, index) || memberStore.canMemberCleared(whichForm as MemberKeys, index) ? deleteMember(index) : null
22
+ "
23
+ ></v-btn>
24
+ </div>
25
+ </div>
26
+ <v-btn class="ml-2" icon="mdi-plus !text-[24px]" @click="memberStore.addMember(whichForm as MemberKeys)" size="small" color="#A0B3D8" variant="tonal"></v-btn>
27
+ </div>
28
+ <base-form-section :title="$t('form.personalData')" :class="[memberSetting.has === true && memberSetting.isMultiple === true ? 'rounded-t-0 !mt-[-5px]' : 'mt-[14px]']">
5
29
  <base-form-input
6
30
  v-model="member.phoneNumber"
7
31
  :label="$t('form.phoneNumber')"
@@ -21,6 +45,7 @@
21
45
  :clearable="!isDisabled"
22
46
  :append-inner-icon="showSaveButton ? 'mdi mdi-magnify' : ''"
23
47
  @append="searchMember"
48
+ @input="onIinInput"
24
49
  :rules="$rules.required.concat($rules.iinRight)"
25
50
  ></base-form-input>
26
51
  <base-form-input
@@ -488,6 +513,7 @@
488
513
  :append-inner-icon="hasOtp ? 'mdi-cellphone-message text-[17px]' : ''"
489
514
  hide-details
490
515
  @keyup.enter.prevent="hasOtp ? checkOtp() : null"
516
+ @input="onOtpCodeInput"
491
517
  ></base-rounded-input>
492
518
  </base-fade-transition>
493
519
  <base-btn v-if="!member.otpTokenId" :disabled="otpSending" :loading="otpSending" :text="$t('buttons.sendOtp')" @click="sendOtp(false)"></base-btn>
@@ -505,7 +531,7 @@
505
531
 
506
532
  <script lang="ts">
507
533
  import { LocationQueryValue } from 'vue-router';
508
- import { Value, DocumentItem } from '@/composables/classes';
534
+ import { Value, DocumentItem, Member } from '@/composables/classes';
509
535
  import { uuid } from 'vue-uuid';
510
536
 
511
537
  export default {
@@ -530,6 +556,7 @@ export default {
530
556
  const isDocumentOpen = ref<boolean>(false);
531
557
  const isOtpPanelOpen = ref<boolean>(false);
532
558
  const isPanelLoading = ref<boolean>(false);
559
+ const isChangingMember = ref<boolean>(false);
533
560
  const familyDialog = ref<boolean>(false);
534
561
  const sameAddress = ref<boolean>(false);
535
562
  const panelValue = ref<Value>(new Value());
@@ -540,6 +567,7 @@ export default {
540
567
 
541
568
  const whichForm = computed(() => route.query.tab);
542
569
  const whichIndex = computed(() => route.query.i);
570
+ const memberSetting = computed(() => dataStore.members[memberStore.getMemberApplicationCode(whichForm.value as MemberKeys) as keyof typeof dataStore.members]);
543
571
  const hasOtp = computed(() => member.value.otpCode && member.value.otpCode.length === useMask().otp.length);
544
572
  const isDisabled = computed(() => !memberStore.isStatementEditible(whichForm.value as string));
545
573
  const isTask = computed(() => route.params.taskId === '0' || dataStore.isTask());
@@ -781,55 +809,6 @@ export default {
781
809
  }
782
810
  };
783
811
 
784
- const setAddress = () => {
785
- const beneficiary = formStore.beneficiaryForm[Number(whichIndex.value)];
786
- const policyholder = formStore.policyholderForm;
787
- if (sameAddress.value === true) {
788
- beneficiary.registrationCity = policyholder.registrationCity;
789
- beneficiary.registrationCountry = policyholder.registrationCountry;
790
- beneficiary.birthPlace = policyholder.birthPlace;
791
- beneficiary.registrationMicroDistrict = policyholder.registrationMicroDistrict;
792
- beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
793
- beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
794
- beneficiary.registrationNumberHouse = policyholder.registrationNumberHouse;
795
- beneficiary.registrationProvince = policyholder.registrationProvince;
796
- beneficiary.registrationQuarter = policyholder.registrationQuarter;
797
- beneficiary.registrationRegion = policyholder.registrationRegion;
798
- beneficiary.registrationRegionType = policyholder.registrationRegionType;
799
- beneficiary.registrationStreet = policyholder.registrationStreet;
800
- } else {
801
- if (beneficiary.id === 0) {
802
- beneficiary.registrationCity = new Value();
803
- beneficiary.registrationCountry = new Value();
804
- beneficiary.registrationMicroDistrict = '';
805
- beneficiary.registrationNumberApartment = '';
806
- beneficiary.registrationNumberApartment = '';
807
- beneficiary.registrationNumberHouse = '';
808
- beneficiary.registrationProvince = new Value();
809
- beneficiary.registrationQuarter = '';
810
- beneficiary.registrationRegion = new Value();
811
- beneficiary.registrationRegionType = new Value();
812
- beneficiary.registrationStreet = '';
813
- } else {
814
- const country = dataStore.countries.find(i => (i.nameRu as string).match(new RegExp(beneficiary.response?.addresses[0].countryName, 'i')));
815
- const city = dataStore.cities.find(i => i.nameRu === beneficiary.response?.addresses[0].cityName.replace('г.', ''));
816
- const province = dataStore.states.find(i => i.ids === beneficiary.response?.addresses[0].stateCode);
817
- const localityType = dataStore.localityTypes.find(i => i.nameRu === beneficiary.response?.addresses[0].cityTypeName);
818
- const region = dataStore.regions.find(i => i.ids == beneficiary.response?.addresses[0].regionCode);
819
- beneficiary.registrationCountry = country ?? new Value();
820
- beneficiary.registrationCity = city ?? new Value();
821
- beneficiary.registrationMicroDistrict = beneficiary.response?.addresses[0].microRaion ?? '';
822
- beneficiary.registrationNumberApartment = beneficiary.response?.addresses[0].apartmentNumber ?? '';
823
- beneficiary.registrationNumberHouse = beneficiary.response?.addresses[0].blockNumber ?? '';
824
- beneficiary.registrationProvince = province ?? new Value();
825
- beneficiary.registrationQuarter = beneficiary.response?.addresses[0].kvartal ?? '';
826
- beneficiary.registrationRegion = region ?? new Value();
827
- beneficiary.registrationRegionType = localityType ?? new Value();
828
- beneficiary.registrationStreet = beneficiary.response?.addresses[0].streetName ?? '';
829
- }
830
- }
831
- };
832
-
833
812
  const uploadFile = async (processInstanceId: string | number) => {
834
813
  const selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.nameRu === member.value.documentType.nameRu);
835
814
  const formData = new FormData();
@@ -1185,27 +1164,40 @@ export default {
1185
1164
  }
1186
1165
  };
1187
1166
 
1188
- const onInit = async () => {
1189
- if (route.params.taskId === '0' || (route.params.taskId !== '0' && dataStore.isProcessEditable(formStore.applicationData.statusCode))) {
1190
- await dataStore.getSignedDocList(formStore.applicationData.processInstanceId);
1167
+ const selectMember = async (index: number, update?: boolean) => {
1168
+ dataStore.panel.open = false;
1169
+ isButtonLoading.value = true;
1170
+ isChangingMember.value = true;
1171
+ //@ts-ignore
1172
+ await router.replace({ query: { ...route.query, i: index, id: getMember(route.query.tab, index).id, upd: update } });
1173
+ isChangingMember.value = false;
1174
+ isButtonLoading.value = false;
1175
+ };
1176
+
1177
+ const deleteMember = async (index: number) => {
1178
+ await memberStore.deleteMember(route.params.taskId as string, whichForm.value as MemberKeys, index);
1179
+ const currentIndex = Number(whichIndex.value);
1180
+ if (index <= currentIndex) {
1181
+ const newIndex = ref<number>(currentIndex - 1 > 0 ? currentIndex - 1 : 0);
1182
+ await selectMember(newIndex.value, index === currentIndex ? true : undefined);
1191
1183
  }
1184
+ };
1185
+
1186
+ const onInit = async () => {
1187
+ // if (route.params.taskId === '0' || (route.params.taskId !== '0' && dataStore.isProcessEditable(formStore.applicationData.statusCode))) {
1188
+ // await dataStore.getSignedDocList(formStore.applicationData.processInstanceId);
1189
+ // }
1192
1190
  if (getOtpConditionByMember()) {
1193
1191
  await sendOtp(true);
1194
1192
  } else {
1195
1193
  if (member.value.hasAgreement === null) member.value.hasAgreement = true;
1196
1194
  }
1197
- if (route.query.id !== '0' && !member.value.id) {
1198
- await dataStore.getContragentById(route.query.id, whichForm.value, true);
1199
- }
1200
- if (member.value.id && route.query.id === '0') {
1201
- await router.replace({
1202
- name: route.name!,
1203
- query: { ...route.query, id: member.value.id },
1204
- });
1205
- }
1206
- if (member.value.id) {
1207
- const filteredDocuments: DocumentItem[] = dataStore.getFilesByIIN(member.value.iin!.replace(/-/g, '')) as DocumentItem[];
1208
- if (filteredDocuments && filteredDocuments.length) memberDocument.value = filteredDocuments[0];
1195
+ if (!member.value.id) {
1196
+ await router.replace({ query: { ...route.query, id: 0 } });
1197
+ } else {
1198
+ if (route.query.id !== String(member.value.id)) await router.replace({ query: { ...route.query, id: member.value.id } });
1199
+ // const filteredDocuments: DocumentItem[] = dataStore.getFilesByIIN(member.value.iin!.replace(/-/g, '')) as DocumentItem[];
1200
+ // if (filteredDocuments && filteredDocuments.length) memberDocument.value = filteredDocuments[0];
1209
1201
  }
1210
1202
  await setDefaultValues();
1211
1203
  };
@@ -1214,30 +1206,26 @@ export default {
1214
1206
  await onInit();
1215
1207
  });
1216
1208
 
1217
- onBeforeRouteUpdate(to => {
1218
- if ('tab' in to.query && to.query.tab !== 'productConditions') {
1219
- member.value = getMember(to.query.tab, to.query.i);
1220
- }
1221
- });
1222
-
1223
1209
  watch(
1224
1210
  () => sameAddress.value,
1225
1211
  () => {
1226
- if (whichForm.value === formStore.beneficiaryFormKey) setAddress();
1212
+ if (whichForm.value === formStore.beneficiaryFormKey) setAddressBeneficiary(Number(whichIndex.value), sameAddress.value);
1227
1213
  },
1228
1214
  );
1229
1215
 
1230
1216
  watch(
1231
1217
  () => member.value.percentageOfPayoutAmount,
1232
1218
  val => {
1233
- const percentage = typeof val === 'string' ? Number(val) : val;
1234
- if (percentage) {
1235
- if (percentage < 0) {
1236
- member.value.percentageOfPayoutAmount = 0;
1237
- dataStore.showToaster('error', dataStore.t('toaster.incorrectInput'), 1000);
1238
- } else if (percentage > 100) {
1239
- member.value.percentageOfPayoutAmount = 100;
1240
- dataStore.showToaster('error', dataStore.t('toaster.incorrectInput'), 1000);
1219
+ if (isChangingMember.value === false) {
1220
+ const percentage = typeof val === 'string' ? Number(val) : val;
1221
+ if (percentage) {
1222
+ if (percentage < 0) {
1223
+ member.value.percentageOfPayoutAmount = 0;
1224
+ dataStore.showToaster('error', dataStore.t('toaster.incorrectInput'), 1000);
1225
+ } else if (percentage > 100) {
1226
+ member.value.percentageOfPayoutAmount = 100;
1227
+ dataStore.showToaster('error', dataStore.t('toaster.incorrectInput'), 1000);
1228
+ }
1241
1229
  }
1242
1230
  }
1243
1231
  },
@@ -1246,21 +1234,28 @@ export default {
1246
1234
  watch(
1247
1235
  () => member.value.birthDate,
1248
1236
  val => {
1249
- if (val && val.length === useMask().date.length) {
1237
+ if (val && val.length === useMask().date.length && isChangingMember.value === false) {
1250
1238
  const calculatedAge = member.value.getAgeByBirthDate();
1251
1239
  if (calculatedAge) member.value.age = calculatedAge;
1252
1240
  }
1253
1241
  },
1254
1242
  );
1255
1243
 
1256
- // watch(
1257
- // () => member.value.otpCode,
1258
- // async () => {
1259
- // if (member.value.otpCode && member.value.otpCode.length === useMask().otp.length) {
1260
- // await checkOtp();
1261
- // }
1262
- // },
1263
- // );
1244
+ const onIinInput = () => {
1245
+ if (!!member.value.iin && member.value.iin.length === useMask().iin.length && memberSetting.value.isMultiple === true) {
1246
+ const alreadyInStatement = formStore[whichForm.value as MemberKeys].findIndex((i: Member) => i.iin === member.value.iin);
1247
+ if (alreadyInStatement !== -1 && alreadyInStatement !== Number(whichIndex.value)) {
1248
+ dataStore.showToaster('error', dataStore.t('toaster.hasAlreadyMember'), 3000);
1249
+ member.value.iin = null;
1250
+ }
1251
+ }
1252
+ };
1253
+
1254
+ const onOtpCodeInput = async () => {
1255
+ if (member.value.otpCode && member.value.otpCode.length === useMask().otp.length) {
1256
+ await checkOtp();
1257
+ }
1258
+ };
1264
1259
 
1265
1260
  watch(
1266
1261
  () => dataStore.panel.open,
@@ -1309,6 +1304,7 @@ export default {
1309
1304
  // Computed
1310
1305
  whichForm,
1311
1306
  whichIndex,
1307
+ memberSetting,
1312
1308
  otpCondition,
1313
1309
  hasOtp,
1314
1310
  isDisabled,
@@ -1342,6 +1338,10 @@ export default {
1342
1338
  selectFamilyMember,
1343
1339
  closeFamilyDialog,
1344
1340
  scrollForm,
1341
+ onIinInput,
1342
+ onOtpCodeInput,
1343
+ deleteMember,
1344
+ selectMember,
1345
1345
  };
1346
1346
  },
1347
1347
  };
@@ -9,7 +9,6 @@ export default defineComponent({
9
9
  props: {
10
10
  chip: {
11
11
  type: Object as PropType<ChipComponent>,
12
- required: true,
13
12
  },
14
13
  color: {
15
14
  type: String,
@@ -17,7 +16,7 @@ export default defineComponent({
17
16
  },
18
17
  textSize: {
19
18
  type: String,
20
- default: '!text-[11px]',
19
+ default: '!text-[10px]',
21
20
  },
22
21
  maxWidth: {
23
22
  type: [String, Number],
@@ -802,10 +802,12 @@ export class MemberSettings {
802
802
  has?: boolean;
803
803
  isMultiple?: boolean;
804
804
  required?: boolean;
805
- constructor(options?: { has?: boolean; isMultiple?: boolean; required?: boolean }) {
805
+ limit?: number;
806
+ constructor(options?: { has?: boolean; isMultiple?: boolean; required?: boolean; limit?: number }) {
806
807
  if (options) {
807
808
  this.has = options.has;
808
809
  this.isMultiple = options.isMultiple;
810
+ this.limit = options.limit;
809
811
  if (this.has === true) {
810
812
  this.required = options.required;
811
813
  } else {
@@ -175,3 +175,54 @@ export const ErrorHandler = (err: unknown, errorText?: string) => {
175
175
  }
176
176
  return false;
177
177
  };
178
+
179
+ export const setAddressBeneficiary = (whichIndex: number, sameAddress: boolean) => {
180
+ const formStore = useFormStore();
181
+ const dataStore = useDataStore();
182
+ const beneficiary = formStore.beneficiaryForm[Number(whichIndex)];
183
+ const policyholder = formStore.policyholderForm;
184
+ if (sameAddress === true) {
185
+ beneficiary.registrationCity = policyholder.registrationCity;
186
+ beneficiary.registrationCountry = policyholder.registrationCountry;
187
+ beneficiary.birthPlace = policyholder.birthPlace;
188
+ beneficiary.registrationMicroDistrict = policyholder.registrationMicroDistrict;
189
+ beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
190
+ beneficiary.registrationNumberApartment = policyholder.registrationNumberApartment;
191
+ beneficiary.registrationNumberHouse = policyholder.registrationNumberHouse;
192
+ beneficiary.registrationProvince = policyholder.registrationProvince;
193
+ beneficiary.registrationQuarter = policyholder.registrationQuarter;
194
+ beneficiary.registrationRegion = policyholder.registrationRegion;
195
+ beneficiary.registrationRegionType = policyholder.registrationRegionType;
196
+ beneficiary.registrationStreet = policyholder.registrationStreet;
197
+ } else {
198
+ if (beneficiary.id === 0) {
199
+ beneficiary.registrationCity = new Value();
200
+ beneficiary.registrationCountry = new Value();
201
+ beneficiary.registrationMicroDistrict = '';
202
+ beneficiary.registrationNumberApartment = '';
203
+ beneficiary.registrationNumberApartment = '';
204
+ beneficiary.registrationNumberHouse = '';
205
+ beneficiary.registrationProvince = new Value();
206
+ beneficiary.registrationQuarter = '';
207
+ beneficiary.registrationRegion = new Value();
208
+ beneficiary.registrationRegionType = new Value();
209
+ beneficiary.registrationStreet = '';
210
+ } else {
211
+ const country = dataStore.countries.find(i => (i.nameRu as string).match(new RegExp(beneficiary.response?.addresses[0].countryName, 'i')));
212
+ const city = dataStore.cities.find(i => i.nameRu === beneficiary.response?.addresses[0].cityName.replace('г.', ''));
213
+ const province = dataStore.states.find(i => i.ids === beneficiary.response?.addresses[0].stateCode);
214
+ const localityType = dataStore.localityTypes.find(i => i.nameRu === beneficiary.response?.addresses[0].cityTypeName);
215
+ const region = dataStore.regions.find(i => i.ids == beneficiary.response?.addresses[0].regionCode);
216
+ beneficiary.registrationCountry = country ?? new Value();
217
+ beneficiary.registrationCity = city ?? new Value();
218
+ beneficiary.registrationMicroDistrict = beneficiary.response?.addresses[0].microRaion ?? '';
219
+ beneficiary.registrationNumberApartment = beneficiary.response?.addresses[0].apartmentNumber ?? '';
220
+ beneficiary.registrationNumberHouse = beneficiary.response?.addresses[0].blockNumber ?? '';
221
+ beneficiary.registrationProvince = province ?? new Value();
222
+ beneficiary.registrationQuarter = beneficiary.response?.addresses[0].kvartal ?? '';
223
+ beneficiary.registrationRegion = region ?? new Value();
224
+ beneficiary.registrationRegionType = localityType ?? new Value();
225
+ beneficiary.registrationStreet = beneficiary.response?.addresses[0].streetName ?? '';
226
+ }
227
+ }
228
+ };
package/locales/en.json CHANGED
@@ -21,6 +21,8 @@
21
21
  "memberSave": "Error while saving members"
22
22
  },
23
23
  "toaster": {
24
+ "membersLimit": "The number of these members has been exceeded. The limit is: {text}",
25
+ "hasAlreadyMember": "Member with such IIN is already in statement",
24
26
  "noIinOrPhone": "Missing data to send SMS",
25
27
  "ESBDErrorMessage": "Incorrect data entered for this IIN",
26
28
  "phoneNotFoundInBMG": "Enter a number registered in BMG or register the contragent in BMG",
@@ -376,6 +378,7 @@
376
378
  "new": "Подать заявление"
377
379
  },
378
380
  "labels": {
381
+ "newVersion": "New",
379
382
  "code": "Code",
380
383
  "codes": "Codes",
381
384
  "listType": "List type",
package/locales/kz.json CHANGED
@@ -21,6 +21,8 @@
21
21
  "memberSave": "Қатысушы мәліметтерін сақтау кезіндегі қате"
22
22
  },
23
23
  "toaster": {
24
+ "membersLimit": "Количество этих участников превышено. Лимит составляет: {text}",
25
+ "hasAlreadyMember": "Участник с таким ИИН уже есть в заявке",
24
26
  "noIinOrPhone": "SMS жіберу үшін дереккөз мәліметтер жоқ",
25
27
  "ESBDErrorMessage": "Бұл ЖСН бойынша дұрыс мәліметтер енгізілмеді",
26
28
  "phoneNotFoundInBMG": "БМГ-де тіркелген нөмірді енгізіңіз немесе контрагентті БМГ-де тіркеу",
@@ -376,6 +378,7 @@
376
378
  "new": "Өтінім жасау"
377
379
  },
378
380
  "labels": {
381
+ "newVersion": "Жаңа версия",
379
382
  "code": "Код",
380
383
  "codes": "Коды",
381
384
  "listType": "Тип списка",
package/locales/ru.json CHANGED
@@ -21,6 +21,8 @@
21
21
  "memberSave": "Ошибка при сохранении данных участников"
22
22
  },
23
23
  "toaster": {
24
+ "membersLimit": "Количество этих участников превышено. Лимит составляет: {text}",
25
+ "hasAlreadyMember": "Участник с таким ИИН уже есть в заявке",
24
26
  "noIinOrPhone": "Отсутствуют данные для отправки СМС",
25
27
  "ESBDErrorMessage": "Введены не корректные данные по этому ИИН",
26
28
  "phoneNotFoundInBMG": "Введите номер зарегистрированный в БМГ или зарегистрируйте контрагента в БМГ",
@@ -376,6 +378,7 @@
376
378
  "new": "Подать заявление"
377
379
  },
378
380
  "labels": {
381
+ "newVersion": "Новая версия",
379
382
  "code": "Код",
380
383
  "codes": "Коды",
381
384
  "listType": "Тип списка",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.8-beta.27",
3
+ "version": "0.0.8-beta.29",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -834,9 +834,9 @@ export const useDataStore = defineStore('data', {
834
834
  if(
835
835
  this.formStore.applicationData.insuredApp.every(i => i.iin !== data.iin) &&
836
836
  data.id !== null) {
837
- await this.api.deleteMember('Insured', data.id);
838
- delete data.id;
839
- }
837
+ await this.api.deleteMember('Insured', data.id);
838
+ delete data.id;
839
+ }
840
840
  }
841
841
  data.isDisability = this.formStore.isPolicyholderInsured ? false : member.isDisability.nameRu == 'Да';
842
842
  data.disabilityGroupId = data.isDisability ? member.disabilityGroupId.id : null;
@@ -1644,9 +1644,9 @@ export const useDataStore = defineStore('data', {
1644
1644
  this.setMembersField(this.formStore.policyholderFormKey, 'clientApp');
1645
1645
  if (insuredData && insuredData.length) {
1646
1646
  insuredData.forEach((each, index) => {
1647
+ this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
1647
1648
  const relationDegree = this.relations.find(i => i.ids == each.relationId);
1648
1649
  this.formStore.insuredForm[index].relationDegree = relationDegree ? relationDegree : new Value();
1649
- this.setMembersFieldIndex(this.formStore.insuredFormKey, 'insuredApp', index);
1650
1650
  });
1651
1651
  }
1652
1652
 
@@ -13,6 +13,7 @@ export const useMemberStore = defineStore('members', {
13
13
  }),
14
14
  actions: {
15
15
  isStatementEditible(whichForm: string, showToaster: boolean = false) {
16
+ if (!this.validateInitiator(false)) return false;
16
17
  if (this.formStore.isDisabled[whichForm as keyof typeof this.formStore.isDisabled] === true) {
17
18
  if (showToaster) this.dataStore.showToaster('error', this.dataStore.t('toaster.viewErrorText'), 2000);
18
19
  return false;
@@ -27,14 +28,21 @@ export const useMemberStore = defineStore('members', {
27
28
  return true;
28
29
  },
29
30
  hasMemberData(whichForm: MemberKeys, whichIndex?: number, key: string = 'id', emptyValue: any = 0) {
30
- if (!this.validateInitiator(false)) return false;
31
31
  if (!this.isStatementEditible(whichForm)) return false;
32
32
  return typeof whichIndex === 'number' ? this.formStore[whichForm][whichIndex][key] != emptyValue : this.formStore[whichForm][key] != emptyValue;
33
33
  },
34
+ canMemberCleared(whichForm: MemberKeys, whichIndex?: number) {
35
+ if (!whichForm) return false;
36
+ if (!this.isStatementEditible(whichForm)) return false;
37
+ if (typeof whichIndex === 'number') {
38
+ return this.formStore[whichForm][whichIndex].id === 0 && (!!this.formStore[whichForm][whichIndex].iin || !!this.formStore[whichForm][whichIndex].phoneNumber);
39
+ } else {
40
+ return this.formStore[whichForm].id === 0 && (!!this.formStore[whichForm].iin || !!this.formStore[whichForm].phoneNumber);
41
+ }
42
+ },
34
43
  canMemberDeleted(whichForm: MemberKeys, whichIndex?: number) {
35
44
  if (!whichForm) return false;
36
45
  if (!this.isStatementEditible(whichForm)) return false;
37
- if (!this.validateInitiator(false)) return false;
38
46
  if (typeof whichIndex === 'number') {
39
47
  if (whichIndex > 0) {
40
48
  return true;
@@ -135,7 +143,6 @@ export const useMemberStore = defineStore('members', {
135
143
  clearMember(whichForm: MemberKeys, whichIndex?: number) {
136
144
  if (!whichForm) return false;
137
145
  if (!this.isStatementEditible(whichForm)) return false;
138
- if (!this.validateInitiator()) return false;
139
146
  if (whichForm === this.formStore.policyholderFormKey || whichForm === this.formStore.policyholdersRepresentativeFormKey) {
140
147
  //@ts-ignore
141
148
  this.formStore[whichForm] = this.getMemberClass(whichForm);
@@ -152,7 +159,6 @@ export const useMemberStore = defineStore('members', {
152
159
  async deleteMember(taskId: string, whichForm: MemberKeys, whichIndex?: number, refetch: boolean = true) {
153
160
  if (!whichForm) return false;
154
161
  if (!this.isStatementEditible(whichForm)) return false;
155
- if (!this.validateInitiator()) return false;
156
162
  try {
157
163
  const memberCode = this.getMemberCode(whichForm);
158
164
  const memberData = this.getMemberFromApplication(whichForm, whichIndex);
@@ -262,8 +268,16 @@ export const useMemberStore = defineStore('members', {
262
268
  addMember(whichForm: MemberKeys) {
263
269
  if (!whichForm) return false;
264
270
  if (!this.isStatementEditible(whichForm)) return false;
265
- if (!this.validateInitiator()) return false;
266
- this.formStore[whichForm].push(this.getMemberClass(whichForm));
271
+ const limit = this.dataStore.members[this.getMemberApplicationCode(whichForm)!].limit;
272
+ if (typeof limit === 'number') {
273
+ if (this.formStore[whichForm].length < limit) {
274
+ this.formStore[whichForm].push(this.getMemberClass(whichForm));
275
+ } else {
276
+ this.dataStore.showToaster('error', this.dataStore.t('toaster.membersLimit', { text: limit }));
277
+ }
278
+ } else {
279
+ this.formStore[whichForm].push(this.getMemberClass(whichForm));
280
+ }
267
281
  },
268
282
  async getOtpStatus(iin: string, phone: string, processInstanceId: string | number | null = null) {
269
283
  try {