hl-core 0.0.10-beta.20 → 0.0.10-beta.22

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.
@@ -81,10 +81,10 @@
81
81
  :maska="$maska.iin"
82
82
  :readonly="!!isDisabled || !!isIinPhoneDisabled || !!member.parsedDocument?.iin"
83
83
  :clearable="!isDisabled"
84
- :append-inner-icon="hasMemberSearch ? (hasDocumentReader ? 'mdi mdi-credit-card-scan-outline' : 'mdi mdi-magnify') : ''"
84
+ :append-inner-icon="hasMemberSearch || !isNonResident ? (hasDocumentReader ? 'mdi mdi-credit-card-scan-outline' : 'mdi mdi-magnify') : ''"
85
85
  @append="searchMember"
86
86
  @input="onIinInput"
87
- :rules="$rules.required.concat($rules.iinRight)"
87
+ :rules="isNonResident ? [] : $rules.required.concat($rules.iinRight)"
88
88
  />
89
89
  <base-form-input
90
90
  v-model.trim="member.lastName"
@@ -99,6 +99,8 @@
99
99
  :clearable="!isDisabled"
100
100
  :label="$dataStore.t('form.firstName')"
101
101
  :rules="$rules.required.concat($rules.cyrillic)"
102
+ :append-inner-icon="hasMemberSearch || isNonResident ? 'mdi mdi-magnify' : ''"
103
+ @append="isNonResident && searchMember"
102
104
  />
103
105
  <base-form-input
104
106
  v-if="hasMiddleName"
@@ -623,24 +625,27 @@
623
625
  :disabled="isDisabled"
624
626
  :clearable="!isDisabled"
625
627
  icon="mdi-paperclip"
626
- @input="attachFile($event, '1')"
628
+ @input="attachAdditionalFile($event, '1')"
627
629
  :rules="$rules.required"
630
+ @onClear="clearAdditionalFile('1')"
628
631
  />
629
632
  <base-file-input
630
633
  :label="$dataStore.t('form.bankStatement')"
631
634
  :disabled="isDisabled"
632
635
  :clearable="!isDisabled"
633
636
  icon="mdi-paperclip"
634
- @input="attachFile($event, '10')"
637
+ @input="attachAdditionalFile($event, '10')"
635
638
  :rules="$rules.required"
639
+ @onClear="clearAdditionalFile('10')"
636
640
  />
637
641
  <base-file-input
638
642
  :label="$dataStore.t('pension.ENPFnote')"
639
643
  :disabled="isDisabled"
640
644
  :clearable="!isDisabled"
641
645
  icon="mdi-paperclip"
642
- @input="attachFile($event, '8')"
646
+ @input="attachAdditionalFile($event, '8')"
643
647
  :rules="$rules.required"
648
+ @onClear="clearAdditionalFile('8')"
644
649
  />
645
650
  </base-form-section>
646
651
  <base-form-section :title="$dataStore.t('form.contactsData')" v-if="$dataStore.hasContactSection(whichForm)">
@@ -678,6 +683,7 @@
678
683
  <base-btn v-if="hasGBDFL" :loading="isButtonLoading" :text="$dataStore.t('buttons.fromGBDFL')" @click="getContragentFromGBDFL" />
679
684
  <base-btn v-if="hasInsis" :loading="isButtonLoading" :text="$dataStore.t('buttons.fromInsis')" @click="getContragent" />
680
685
  <base-btn v-if="hasGKB" :loading="isButtonLoading" :text="$dataStore.t('buttons.fromGKB')" @click="getFamilyInfo" />
686
+ <base-btn v-if="isNonResident" :loading="isButtonLoading" :text="$dataStore.t('buttons.searchByFio')" @click="getContragent" />
681
687
  <base-form-section v-if="hasDocumentReader" class="!mt-0">
682
688
  <base-file-input
683
689
  :disabled="isDisabled"
@@ -781,6 +787,27 @@
781
787
  <base-list-empty class="w-full" v-else @click="documentChooseDialog = false" />
782
788
  </template>
783
789
  </base-dialog>
790
+ <base-dialog
791
+ v-model="fioChooseDialog"
792
+ :title="$dataStore.t('pension.contragentSelect')"
793
+ :icon="{ mdi: 'format-list-bulleted-type', color: '#A0B3D8' }"
794
+ actions="fioChooseDialog"
795
+ :persistent="false"
796
+ >
797
+ <template #actions>
798
+ <v-list lines="two" v-if="contragents && contragents.length" class="w-full !py-0">
799
+ <v-list-item v-for="person of contragents" :key="person.id" @click="getContragentClick(person)">
800
+ <v-list-item-title :class="[$styles.greenText, $styles.textTitle]">
801
+ {{ person.longName }}
802
+ </v-list-item-title>
803
+ <v-list-item-subtitle :class="[$styles.textSimple]">
804
+ {{ reformatDate(person.birthDate) }} - {{ person.genderName }} - Рег: {{ reformatDate(person.registrationDate) }}
805
+ </v-list-item-subtitle>
806
+ </v-list-item>
807
+ </v-list>
808
+ <base-list-empty class="w-full" v-else @click="fioChooseDialog = false" />
809
+ </template>
810
+ </base-dialog>
784
811
  </section>
785
812
  <base-scroll-buttons @up="scrollForm('up')" @down="scrollForm('down')" />
786
813
  </template>
@@ -789,7 +816,7 @@
789
816
  import { Value, DocumentItem, Member } from '../../composables/classes';
790
817
  import { uuid } from 'vue-uuid';
791
818
  import { StoreMembers, CoreEnums } from '../../types/enum';
792
- import type { Api, Dicts, ESBDValidationType, FileActions, MultipleMember } from '../../types';
819
+ import type { Api, ContragentType, Dicts, ESBDValidationType, FileActions, MultipleMember } from '../../types';
793
820
 
794
821
  export default {
795
822
  setup() {
@@ -816,9 +843,11 @@ export default {
816
843
  const isPositionPanelOpen = ref<boolean>(false);
817
844
  const isPanelLoading = ref<boolean>(false);
818
845
  const isChangingMember = ref<boolean>(false);
846
+ const isNonResident = computed(() => !useEnv().isProduction && dataStore.isPension && member.value.signOfResidency.ids === '500011.2');
819
847
  const familyDialog = ref<boolean>(false);
820
848
  const deletionDialog = ref<boolean>(false);
821
849
  const documentChooseDialog = ref<boolean>(false);
850
+ const fioChooseDialog = ref<boolean>(false);
822
851
  const selectedIndex = ref<number>(0);
823
852
  const sameAddress = ref<boolean>(false);
824
853
  const panelValue = ref<Value>(new Value());
@@ -829,6 +858,9 @@ export default {
829
858
  const fileData = ref<{ file: any }>();
830
859
  const imageDataList = ref<string[]>([]);
831
860
  const isRelative = ref<boolean>(false);
861
+ const additionalDocuments = ref<any[]>([]);
862
+ const requiredDocuments = ref<string[]>(['10']);
863
+ const contragents = ref<ContragentType[]>([]);
832
864
 
833
865
  const currentPanelDeep = ref<string>();
834
866
  const currentPanelSubDeep = ref<string>();
@@ -1050,7 +1082,7 @@ export default {
1050
1082
  case formStore.policyholderFormKey:
1051
1083
  return route.params.taskId === '0';
1052
1084
  case formStore.insuredFormKey:
1053
- if (dataStore.isPension) return route.params.taskId === '0';
1085
+ if (dataStore.isPension && formStore.applicationData.processCode === 19) return route.params.taskId === '0';
1054
1086
  return route.query.id === '0';
1055
1087
  case formStore.policyholdersRepresentativeFormKey:
1056
1088
  case formStore.beneficiaryFormKey:
@@ -1255,12 +1287,49 @@ export default {
1255
1287
  }
1256
1288
  };
1257
1289
 
1258
- const attachFile = (event: InputEvent, code?: string) => {
1290
+ const uploadAdditionalFiles = async (processInstanceId: string | number) => {
1291
+ const formData = new FormData();
1292
+ const information: any = [];
1293
+ const uuidV4 = uuid.v4();
1294
+ if (additionalDocuments.value) {
1295
+ Object.values(additionalDocuments.value).map((value: any) => {
1296
+ formData.append('file', value);
1297
+ const ext = value.name.substring(value.name.lastIndexOf('.'));
1298
+ const selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === value.code);
1299
+ information.push({
1300
+ identifier: `${uuidV4}${ext}`,
1301
+ iin: member.value.iin ? member.value.iin.replaceAll('-', '') : null,
1302
+ processInstanceId: processInstanceId,
1303
+ fileTypeCode: selectedDocument ? selectedDocument.code : null,
1304
+ fileTypeId: selectedDocument ? selectedDocument.id : null,
1305
+ fileName: value.name,
1306
+ });
1307
+ });
1308
+ formData.append('fileData', JSON.stringify(information));
1309
+ await dataStore.uploadFiles(formData, false);
1310
+ }
1311
+ };
1312
+
1313
+ const attachFile = (event: InputEvent) => {
1259
1314
  if (event.target) {
1260
- fileData.value = code ? { file: (event.target as HTMLInputElement).files } : { file: (event.target as HTMLInputElement).files };
1315
+ fileData.value = { file: (event.target as HTMLInputElement).files };
1261
1316
  } else {
1262
1317
  if (event.dataTransfer) {
1263
- fileData.value = code ? { file: (event.dataTransfer as DataTransfer).files } : { file: (event.dataTransfer as DataTransfer).files };
1318
+ fileData.value = { file: (event.dataTransfer as DataTransfer).files };
1319
+ }
1320
+ }
1321
+ };
1322
+
1323
+ const attachAdditionalFile = (event: InputEvent, code: string) => {
1324
+ if (event.target) {
1325
+ const files = (event.target as HTMLInputElement).files;
1326
+ if (files && files.length && files[0]) {
1327
+ if (files[0].type !== 'application/pdf') {
1328
+ return dataStore.showToaster('error', dataStore.t('toaster.onlyPDF'), 6000);
1329
+ }
1330
+ const file = Object.assign(files[0]);
1331
+ file.code = code;
1332
+ additionalDocuments.value.push(file);
1264
1333
  }
1265
1334
  }
1266
1335
  };
@@ -1452,21 +1521,45 @@ export default {
1452
1521
  isSearchOpen.value = false;
1453
1522
  };
1454
1523
 
1524
+ const getContragentClick = async (contragent: ContragentType) => {
1525
+ await dataStore.serializeContragentData(member.value, contragent);
1526
+ fioChooseDialog.value = false;
1527
+ isButtonLoading.value = false;
1528
+ dataStore.rightPanel.open = false;
1529
+ isSearchOpen.value = false;
1530
+ };
1531
+
1455
1532
  const getContragent = async () => {
1456
- if (member.value.hasAgreement !== true) {
1457
- dataStore.showToaster('error', dataStore.t('toaster.needAgreement'), 3000);
1458
- dataStore.rightPanel.open = false;
1459
- isSearchOpen.value = false;
1460
- return;
1461
- }
1462
- if (!member.value.iin || member.value.iin.length !== useMask().iin.length) {
1463
- dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: 'ИИН' }), 5000);
1464
- dataStore.rightPanel.open = false;
1465
- isSearchOpen.value = false;
1466
- return;
1533
+ if (isNonResident.value) {
1534
+ if (!member.value.lastName || !member.value.firstName) {
1535
+ dataStore.showToaster('error', 'Заполните поля Имя и Фамилия', 3000);
1536
+ dataStore.rightPanel.open = false;
1537
+ isSearchOpen.value = false;
1538
+ return;
1539
+ }
1540
+ } else {
1541
+ if (member.value.hasAgreement !== true) {
1542
+ dataStore.showToaster('error', dataStore.t('toaster.needAgreement'), 3000);
1543
+ dataStore.rightPanel.open = false;
1544
+ isSearchOpen.value = false;
1545
+ return;
1546
+ }
1547
+ if (!member.value.iin || member.value.iin.length !== useMask().iin.length) {
1548
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField', { text: 'ИИН' }), 5000);
1549
+ dataStore.rightPanel.open = false;
1550
+ isSearchOpen.value = false;
1551
+ return;
1552
+ }
1467
1553
  }
1468
1554
  isButtonLoading.value = true;
1469
- await dataStore.getContragent(member.value, false);
1555
+ if (isNonResident.value) {
1556
+ const response = await dataStore.getContragent(member.value, false);
1557
+ if (response) contragents.value = response.items;
1558
+ else dataStore.showToaster('error', 'Не найдено совпадений', 3000);
1559
+ fioChooseDialog.value = true;
1560
+ } else {
1561
+ await dataStore.getContragent(member.value, false);
1562
+ }
1470
1563
  isButtonLoading.value = false;
1471
1564
  dataStore.rightPanel.open = false;
1472
1565
  isSearchOpen.value = false;
@@ -1529,6 +1622,26 @@ export default {
1529
1622
  if (fileData.value && fileData.value.file) {
1530
1623
  await uploadFile(formStore.applicationData.processInstanceId);
1531
1624
  }
1625
+ if (additionalDocuments.value && additionalDocuments.value.length) {
1626
+ if (
1627
+ (!formStore.applicationData.isEnpfSum && formStore.applicationData?.pensionApp.transferContracts && formStore.applicationData?.pensionApp.transferContracts.length) ||
1628
+ (formStore.applicationData?.pensionApp.compulsoryProfMonthCount && formStore.applicationData?.pensionApp.compulsoryProfMonthCount >= 60)
1629
+ )
1630
+ requiredDocuments.value.push('8');
1631
+ if (isNonResident.value) requiredDocuments.value.push('1');
1632
+ if (requiredDocuments.value && requiredDocuments.value.length != 0) {
1633
+ const hasAllDocs = requiredDocuments.value.every(fileCode => {
1634
+ const result = additionalDocuments.value.map(i => i.code).indexOf(fileCode) !== -1;
1635
+ if (!result) {
1636
+ const missingFile = dataStore.dicFileTypeList.find((i: Value) => i.code === fileCode);
1637
+ dataStore.showToaster('error', `Необходимо вложить ${missingFile?.nameRu}`, 8000);
1638
+ }
1639
+ return result;
1640
+ });
1641
+ if (!hasAllDocs) return;
1642
+ }
1643
+ await uploadAdditionalFiles(formStore.applicationData.processInstanceId);
1644
+ }
1532
1645
  }
1533
1646
  const memberFromApplicaiton = memberStore.getMemberFromApplication(whichForm.value, whichIndex.value ? Number(whichIndex.value) : undefined);
1534
1647
  if (typeof member.value.id !== 'number' || (typeof member.value.id === 'number' && member.value.id > 0 === false)) {
@@ -1562,12 +1675,6 @@ export default {
1562
1675
  bankBin: member.value.bankInfo.bankName.ids,
1563
1676
  bankId: member.value.bankInfo.bankName.id,
1564
1677
  bankName: member.value.bankInfo.bankName.nameRu,
1565
- guaranteedPeriod: 0,
1566
- amount: 0,
1567
- compulsoryContractAmount: 0,
1568
- voluntaryContractAmount: 0,
1569
- ownFundsRaisAmount: 0,
1570
- compulsoryProfContractAmount: 0,
1571
1678
  };
1572
1679
  const data = {
1573
1680
  ...formStore.applicationData.pensionApp,
@@ -1614,6 +1721,7 @@ export default {
1614
1721
  }
1615
1722
  }
1616
1723
  if (member.value.hasAgreement !== true) {
1724
+ if (isNonResident.value) return true;
1617
1725
  dataStore.showToaster('error', dataStore.t('toaster.needAgreement'));
1618
1726
  return false;
1619
1727
  }
@@ -1674,6 +1782,23 @@ export default {
1674
1782
  dataStore.isLoading = false;
1675
1783
  dataStore.showToaster('error', errorMessage, 5000);
1676
1784
  }
1785
+ } else if (isNonResident.value) {
1786
+ if (member.value.bankInfo.iik.length === useMask().iik.length) {
1787
+ const isValidIik = await dataStore.checkAccountNumber(member.value.bankInfo.iik);
1788
+ if (isValidIik === false) {
1789
+ dataStore.showToaster('error', dataStore.t('error.notValidIik'));
1790
+ member.value.bankInfo.iik = '';
1791
+ isSubmittingForm.value = false;
1792
+ return;
1793
+ }
1794
+ if (formStore.applicationData.pensionApp) {
1795
+ formStore.applicationData.pensionApp.account = member.value.bankInfo.iik;
1796
+ formStore.applicationData.pensionApp.bankBik = member.value.bankInfo.bik;
1797
+ formStore.applicationData.pensionApp.bankBin = member.value.bankInfo.bin;
1798
+ formStore.applicationData.pensionApp.bankId = member.value.bankInfo.bankName.id;
1799
+ }
1800
+ }
1801
+ const hasMemberSaved = await saveMember();
1677
1802
  } else {
1678
1803
  member.value.gotFromInsis = true;
1679
1804
  const hasMemberSaved = await saveMember();
@@ -1816,6 +1941,13 @@ export default {
1816
1941
  deletionDialog.value = false;
1817
1942
  };
1818
1943
 
1944
+ const clearAdditionalFile = (code: string) => {
1945
+ const index = additionalDocuments.value.indexOf(additionalDocuments.value.find((i: any) => i.code == code));
1946
+ if (index > -1) {
1947
+ additionalDocuments.value.splice(index, 1);
1948
+ }
1949
+ };
1950
+
1819
1951
  const onInit = async () => {
1820
1952
  // if (route.params.taskId === '0' || (route.params.taskId !== '0' && dataStore.isProcessEditable(formStore.applicationData.statusCode))) {
1821
1953
  // await dataStore.getSignedDocList(formStore.applicationData.processInstanceId);
@@ -2009,11 +2141,13 @@ export default {
2009
2141
  familyDialog,
2010
2142
  deletionDialog,
2011
2143
  documentChooseDialog,
2144
+ fioChooseDialog,
2012
2145
  selectedIndex,
2013
2146
  selectedFamilyMember,
2014
2147
  sameAddress,
2015
2148
  isRelative,
2016
2149
  imageDataList,
2150
+ contragents,
2017
2151
  // Computed
2018
2152
  whichForm,
2019
2153
  whichIndex,
@@ -2039,6 +2173,7 @@ export default {
2039
2173
  hasWorkPositionDict,
2040
2174
  gbdDocuments,
2041
2175
  hasGBDFLDocSelection,
2176
+ isNonResident,
2042
2177
 
2043
2178
  // Rules
2044
2179
  ageRule,
@@ -2058,6 +2193,7 @@ export default {
2058
2193
  getContragentFromGBDFL,
2059
2194
  getContragent,
2060
2195
  attachFile,
2196
+ attachAdditionalFile,
2061
2197
  attachDocumentReader,
2062
2198
  getDocumentReader,
2063
2199
  getFile,
@@ -2072,6 +2208,8 @@ export default {
2072
2208
  searchPositions,
2073
2209
  selectGbdDocument,
2074
2210
  pickPosition,
2211
+ clearAdditionalFile,
2212
+ getContragentClick,
2075
2213
  };
2076
2214
  },
2077
2215
  };