hl-core 0.0.9-beta.50 → 0.0.9-beta.51

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.
@@ -3,22 +3,13 @@ import { rules } from './rules';
3
3
  import { i18n } from '../configs/i18n';
4
4
  import { Toast, Types, Positions, ToastOptions } from './toast';
5
5
  import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
6
- import {
7
- DataStoreClass,
8
- Contragent,
9
- DocumentItem,
10
- Member,
11
- Value,
12
- CountryValue,
13
- PolicyholderActivity,
14
- BeneficialOwner,
15
- GroupMember,
16
- PolicyholderClass,
17
- } from '../composables/classes';
6
+ import { DataStoreClass, DocumentItem, Member, Value, CountryValue, PolicyholderActivity, BeneficialOwner, PolicyholderClass } from '../composables/classes';
18
7
  import { ApiClass } from '../api';
19
8
  import { useFormStore } from './form.store';
20
9
  import { AxiosError } from 'axios';
21
10
  import { PostActions, StoreMembers, Roles, Statuses, MemberCodes, MemberAppCodes } from '../types/enum';
11
+ //@ts-ignore
12
+ import { NCALayerClient } from 'ncalayer-js-client';
22
13
 
23
14
  export const useDataStore = defineStore('data', {
24
15
  state: () => ({
@@ -66,6 +57,7 @@ export const useDataStore = defineStore('data', {
66
57
  isCalculator: state => state.product === 'calculator',
67
58
  isCheckContract: state => state.product === 'checkcontract',
68
59
  isCheckContragent: state => state.product === 'checkcontragent',
60
+ isPrePension: state => state.product === 'prepensionannuity',
69
61
  isDSO: state => state.product === 'dso',
70
62
  isUU: state => state.product === 'uu',
71
63
  isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
@@ -198,6 +190,9 @@ export const useDataStore = defineStore('data', {
198
190
  isAdmin() {
199
191
  return this.isRole(constants.roles.Admin);
200
192
  },
193
+ isJurist() {
194
+ return this.isRole(constants.roles.Jurist);
195
+ },
201
196
  isAgent() {
202
197
  return this.isRole(constants.roles.Agent);
203
198
  },
@@ -210,6 +205,9 @@ export const useDataStore = defineStore('data', {
210
205
  isUnderwriter() {
211
206
  return this.isRole(constants.roles.Underwriter);
212
207
  },
208
+ isActuary() {
209
+ return this.isRole(constants.roles.Actuary);
210
+ },
213
211
  isAgentMycar() {
214
212
  return this.isRole(constants.roles.AgentMycar);
215
213
  },
@@ -222,6 +220,15 @@ export const useDataStore = defineStore('data', {
222
220
  isUpk() {
223
221
  return this.isRole(constants.roles.UPK);
224
222
  },
223
+ isUrp() {
224
+ return this.isRole(constants.roles.URP);
225
+ },
226
+ isUsns() {
227
+ return this.isRole(constants.roles.USNS);
228
+ },
229
+ isAccountant() {
230
+ return this.isRole(constants.roles.Accountant);
231
+ },
225
232
  isDrn() {
226
233
  return this.isRole(constants.roles.DRNSJ);
227
234
  },
@@ -240,6 +247,15 @@ export const useDataStore = defineStore('data', {
240
247
  isBranchDirector() {
241
248
  return this.isRole(constants.roles.BranchDirector);
242
249
  },
250
+ isUSNSACCINS() {
251
+ return this.isRole(constants.roles.USNSACCINS);
252
+ },
253
+ isDsuio() {
254
+ return this.isRole(constants.roles.Dsuio);
255
+ },
256
+ isAdjuster() {
257
+ return this.isRole(constants.roles.Adjuster);
258
+ },
243
259
  isProcessEditable(statusCode?: keyof typeof Statuses) {
244
260
  const getEditibleStatuses = () => {
245
261
  const defaultStatuses = constants.editableStatuses;
@@ -261,6 +277,13 @@ export const useDataStore = defineStore('data', {
261
277
  };
262
278
  return !!getCanceleStatuses().find(status => status === statusCode);
263
279
  },
280
+ isProcessReject(statusCode?: keyof typeof Statuses) {
281
+ const getRejectStatuses = () => {
282
+ const defaultStatuses = constants.rejectApplicationStatuses;
283
+ return defaultStatuses;
284
+ };
285
+ return !!getRejectStatuses().find(status => status === statusCode);
286
+ },
264
287
  isTask() {
265
288
  return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
266
289
  },
@@ -951,7 +974,7 @@ export const useDataStore = defineStore('data', {
951
974
  data.isNotary = member.isNotary;
952
975
  }
953
976
  if (whichMember === 'Insured') {
954
- if (this.formStore.applicationData && this.formStore.applicationData.insuredApp && this.formStore.applicationData.insuredApp.length) {
977
+ if (this.formStore.applicationData && this.formStore.applicationData.insuredApp && this.formStore.applicationData.insuredApp.length && !this.isPension) {
955
978
  if (this.members.insuredApp.has) {
956
979
  await this.deleteInsuredLogic();
957
980
  }
@@ -960,7 +983,7 @@ export const useDataStore = defineStore('data', {
960
983
  delete data.id;
961
984
  }
962
985
  }
963
- data.isDisability = this.formStore.isPolicyholderInsured ? false : member.isDisability.nameRu == 'Да';
986
+ data.isDisability = this.formStore.isPolicyholderInsured && !this.isPension ? false : member.isDisability.nameRu == 'Да';
964
987
  data.disabilityGroupId = data.isDisability && member.disabilityGroup ? member.disabilityGroup.id : null;
965
988
  data.profession = member.job;
966
989
  data.position = member.jobPosition;
@@ -1012,6 +1035,24 @@ export const useDataStore = defineStore('data', {
1012
1035
  }
1013
1036
  }
1014
1037
  },
1038
+ async setApplication(calculate: boolean = false) {
1039
+ try {
1040
+ this.isLoading = true;
1041
+ this.isButtonsLoading = true;
1042
+ await this.api.setApplication(this.formStore.applicationData.pensionApp);
1043
+ if (calculate) {
1044
+ await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
1045
+ this.showToaster('success', this.t('toaster.successSaved'), 2000);
1046
+ }
1047
+ this.isLoading = false;
1048
+ this.isButtonsLoading = false;
1049
+ return true;
1050
+ } catch (err) {
1051
+ this.isLoading = false;
1052
+ this.isButtonsLoading = false;
1053
+ return ErrorHandler(err);
1054
+ }
1055
+ },
1015
1056
  getConditionsData() {
1016
1057
  const conditionsData: {
1017
1058
  policyAppDto: PolicyAppDto;
@@ -1084,7 +1125,7 @@ export const useDataStore = defineStore('data', {
1084
1125
  },
1085
1126
  async deleteInsuredLogic() {
1086
1127
  // TODO Просмотреть
1087
- if (this.isLifetrip) return;
1128
+ if (this.isLifetrip || this.isPension) return;
1088
1129
  const applicationData = this.getConditionsData();
1089
1130
  const clearCovers = [{ code: 10, value: 'excluded' }];
1090
1131
  await Promise.allSettled(
@@ -1381,16 +1422,22 @@ export const useDataStore = defineStore('data', {
1381
1422
  return await this.getFromApi('economySectorCode', 'getSectorCode');
1382
1423
  },
1383
1424
  async getEconomicActivityType() {
1384
- if (this.isLifeBusiness || this.isGns || this.isDas || this.isUU) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
1425
+ if (this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
1385
1426
  },
1386
1427
  async getFamilyStatuses() {
1387
1428
  return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
1388
1429
  },
1430
+ async getDisabilityGroups() {
1431
+ return await this.getFromApi('disabilityGroups', 'getArmDicts', 'DicDisabilityGroup');
1432
+ },
1389
1433
  async getRelationTypes() {
1390
1434
  return await this.getFromApi('relations', 'getRelationTypes');
1391
1435
  },
1392
1436
  async getBanks() {
1393
- if (this.isLifeBusiness || this.isGns || this.isDas || this.isUU) return await this.getFromApi('banks', 'getBanks');
1437
+ if (this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO) return await this.getFromApi('banks', 'getBanks');
1438
+ },
1439
+ async getInsuranceCompanies() {
1440
+ if (this.isPension) return await this.getFromApi('insuranceCompanies', 'getInsuranceCompanies');
1394
1441
  },
1395
1442
  async getProcessIndexRate() {
1396
1443
  if (this.processCode) {
@@ -1441,7 +1488,7 @@ export const useDataStore = defineStore('data', {
1441
1488
  return this.gender;
1442
1489
  },
1443
1490
  async getAuthorityBasis() {
1444
- if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU) return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
1491
+ if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension) return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
1445
1492
  },
1446
1493
  async getAllFormsData() {
1447
1494
  await Promise.allSettled([
@@ -1476,6 +1523,7 @@ export const useDataStore = defineStore('data', {
1476
1523
  this.getCurrencies(),
1477
1524
  this.getProcessGfot(),
1478
1525
  this.getBanks(),
1526
+ this.getInsuranceCompanies(),
1479
1527
  this.getEconomicActivityType(),
1480
1528
  this.getAuthorityBasis(),
1481
1529
  ]);
@@ -1569,6 +1617,10 @@ export const useDataStore = defineStore('data', {
1569
1617
  delete query.processCodes;
1570
1618
  query.processCode = byOneProcess;
1571
1619
  }
1620
+ if (byOneProcess === 1) {
1621
+ query.processCodes = [1, 2, 4];
1622
+ delete query.processCode;
1623
+ }
1572
1624
  const taskList = await this.api.getTaskList(
1573
1625
  processInstanceId === null
1574
1626
  ? query
@@ -1665,9 +1717,9 @@ export const useDataStore = defineStore('data', {
1665
1717
  const found = this[from].find((i: Value) => i[key] == searchKey);
1666
1718
  return found || new Value();
1667
1719
  },
1668
- async searchAgentByName(name: string) {
1720
+ async searchAgentByName(name: string, branchCode?: string) {
1669
1721
  try {
1670
- this.AgentData = await this.api.searchAgentByName(name);
1722
+ this.AgentData = await this.api.searchAgentByName(name, branchCode);
1671
1723
  if (!this.AgentData.length) {
1672
1724
  this.showToaster('error', this.t('toaster.notFound'), 1500);
1673
1725
  }
@@ -1852,7 +1904,7 @@ export const useDataStore = defineStore('data', {
1852
1904
  this.isLoading = true;
1853
1905
  try {
1854
1906
  const id = this.formStore.applicationData.processInstanceId;
1855
- await this.api.setApplication(this.getConditionsData());
1907
+ if (!this.isPension) await this.api.setApplication(this.getConditionsData());
1856
1908
  const result = ref();
1857
1909
  result.value = await this.api.getCalculation(String(id));
1858
1910
  const applicationData = await this.api.getApplicationData(taskId);
@@ -1896,6 +1948,24 @@ export const useDataStore = defineStore('data', {
1896
1948
  }
1897
1949
  this.isLoading = false;
1898
1950
  },
1951
+ async calculatePremium(data: any) {
1952
+ this.isLoading = true;
1953
+ try {
1954
+ const response = await this.api.calculatePremium(data);
1955
+ // @ts-ignore
1956
+ if (response && response.errMsg) {
1957
+ // @ts-ignore
1958
+ this.showToaster('error', response.errMsg, 1000);
1959
+ } else {
1960
+ this.showToaster('success', this.t('toaster.calculated'), 1000);
1961
+ }
1962
+ this.isLoading = false;
1963
+ return response;
1964
+ } catch (err) {
1965
+ ErrorHandler(err);
1966
+ }
1967
+ this.isLoading = false;
1968
+ },
1899
1969
  async calculatePrice(taskId?: string) {
1900
1970
  this.isLoading = true;
1901
1971
  try {
@@ -1942,14 +2012,14 @@ export const useDataStore = defineStore('data', {
1942
2012
  }
1943
2013
  this.isLoading = false;
1944
2014
  },
1945
- async startApplication(member: Member) {
2015
+ async startApplication(member: Member, processCode?: number) {
1946
2016
  if (!member.iin) return false;
1947
2017
  try {
1948
2018
  const data: StartApplicationType = {
1949
2019
  clientId: member.id,
1950
2020
  iin: member.iin.replace(/-/g, ''),
1951
2021
  longName: member.longName ?? '',
1952
- processCode: Number(this.processCode),
2022
+ processCode: processCode ?? Number(this.processCode),
1953
2023
  policyId: 0,
1954
2024
  };
1955
2025
  const response = await this.api.startApplication(data);
@@ -1963,7 +2033,7 @@ export const useDataStore = defineStore('data', {
1963
2033
  this.isLoading = onlyGet;
1964
2034
  try {
1965
2035
  const applicationData = await this.api.getApplicationData(taskId);
1966
- if (this.processCode !== applicationData.processCode) {
2036
+ if (this.processCode !== applicationData.processCode && !this.isPension) {
1967
2037
  this.isLoading = false;
1968
2038
  this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
1969
2039
  return;
@@ -2061,6 +2131,10 @@ export const useDataStore = defineStore('data', {
2061
2131
  });
2062
2132
  }
2063
2133
 
2134
+ if (applicationData.slave) {
2135
+ insuredData.push(applicationData.slave.insuredApp[0]);
2136
+ }
2137
+
2064
2138
  if (insuredData && insuredData.length) {
2065
2139
  insuredData.forEach((member, index) => {
2066
2140
  const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
@@ -2100,7 +2174,6 @@ export const useDataStore = defineStore('data', {
2100
2174
  }
2101
2175
  });
2102
2176
  }
2103
-
2104
2177
  await Promise.allSettled(
2105
2178
  allMembers.map(async member => {
2106
2179
  await this.getContragentById(member.insisId, member.key, false, member.index);
@@ -2213,6 +2286,9 @@ export const useDataStore = defineStore('data', {
2213
2286
  });
2214
2287
  this.formStore.productConditionsForm.riskGroup = riskGroup ? riskGroup : this.riskGroup.find(item => item.id == 1) ?? new Value();
2215
2288
  }
2289
+ if (this.isPension && this.formStore.policyholderForm.bankInfo) {
2290
+ this.formStore.insuredForm[0].bankInfo = this.formStore.policyholderForm.bankInfo;
2291
+ }
2216
2292
  } catch (err) {
2217
2293
  ErrorHandler(err);
2218
2294
  if (err instanceof AxiosError) {
@@ -2276,6 +2352,7 @@ export const useDataStore = defineStore('data', {
2276
2352
  break;
2277
2353
  }
2278
2354
  case constants.actions.reject:
2355
+ case constants.actions.cancel:
2279
2356
  case constants.actions.return:
2280
2357
  case constants.actions.signed:
2281
2358
  case constants.actions.rejectclient:
@@ -2361,6 +2438,17 @@ export const useDataStore = defineStore('data', {
2361
2438
  if (!!this.formStore.applicationData[whichMember].profession) this.formStore[whichForm].job = this.formStore.applicationData[whichMember].profession;
2362
2439
  if (!!this.formStore.applicationData[whichMember].position) this.formStore[whichForm].jobPosition = this.formStore.applicationData[whichMember].position;
2363
2440
  if (!!this.formStore.applicationData[whichMember].jobName) this.formStore[whichForm].jobPlace = this.formStore.applicationData[whichMember].jobName;
2441
+ if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.applicationData.pensionApp) {
2442
+ this.formStore[whichForm].bankInfo.iik = this.formStore.applicationData.pensionApp.account;
2443
+ this.formStore[whichForm].bankInfo.bik = this.formStore.applicationData.pensionApp.bankBik;
2444
+ const bank = this.banks.find(i => i.ids === this.formStore.applicationData.pensionApp.bankBin);
2445
+ if (bank) {
2446
+ this.formStore[whichForm].bankInfo.bankName = bank;
2447
+ this.formStore[whichForm].bankInfo.bin = bank.ids as string;
2448
+ } else {
2449
+ this.formStore[whichForm].bankInfo.bankName = new Value();
2450
+ }
2451
+ }
2364
2452
  },
2365
2453
  setMembersFieldIndex(whichForm: MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
2366
2454
  if ('familyStatus' in this.formStore[whichForm][index]) {
@@ -2398,6 +2486,41 @@ export const useDataStore = defineStore('data', {
2398
2486
  format: 'pdf',
2399
2487
  },
2400
2488
  ];
2489
+ case 'AttachAppContractForm':
2490
+ if (type === 'qrXml') {
2491
+ return [
2492
+ {
2493
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2494
+ name: 'PAEnpf_Agreement',
2495
+ format: 'xml',
2496
+ },
2497
+ ];
2498
+ } else {
2499
+ return [
2500
+ {
2501
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2502
+ name: this.processCode == 1 ? 'PA_Statement' : 'PA_RefundStatement',
2503
+ format: 'pdf',
2504
+ },
2505
+ ];
2506
+ }
2507
+
2508
+ case 'ContractSignedByAuthorizedPerson':
2509
+ return [
2510
+ {
2511
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2512
+ name: this.processCode == 1 ? 'PA_Contract' : 'PA_Contract',
2513
+ format: 'pdf',
2514
+ },
2515
+ ];
2516
+ case 'ContractSignedByAuthorizedPerson':
2517
+ return [
2518
+ {
2519
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2520
+ name: this.processCode == 1 ? 'PA_Contract' : 'PA_Contract',
2521
+ format: 'pdf',
2522
+ },
2523
+ ];
2401
2524
  default:
2402
2525
  return [
2403
2526
  {
@@ -2417,9 +2540,47 @@ export const useDataStore = defineStore('data', {
2417
2540
  if (type === 'qr') {
2418
2541
  const groupId = await this.api.signQR(data);
2419
2542
  return groupId;
2543
+ } else if (type === 'qrXml') {
2544
+ const signData = await this.api.signXml(data);
2545
+ return signData;
2546
+ } else if (type === 'signature') {
2547
+ const ncaLayerClient = new NCALayerClient();
2548
+ let activeTokens;
2549
+ try {
2550
+ await ncaLayerClient.connect();
2551
+ activeTokens = await ncaLayerClient.getActiveTokens();
2552
+ const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
2553
+ const agreementXml = await this.getDocument(this.formStore.applicationData.processInstanceId as string);
2554
+ const wnd = window.open('about:blank', '', '_blank');
2555
+ wnd?.document.write(agreementXml as any);
2556
+ const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml, 'SIGNATURE', '');
2557
+ const document = {
2558
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2559
+ name: 'PAEnpf_Agreement',
2560
+ format: 'xml',
2561
+ };
2562
+ const signData = await this.api.signXml([document]);
2563
+ let data = new FormData();
2564
+ data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2565
+ data.append('xmlData', signedAgreement);
2566
+ data.append('name', 'PAEnpf_Agreement');
2567
+ data.append('format', 'xml');
2568
+ data.append('EdsXmlId', signData.data);
2569
+ await this.api.uploadXml(data);
2570
+ await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
2571
+ this.showToaster('success', this.t('pension.consentGiven'), 3000);
2572
+ } catch (error) {
2573
+ this.showToaster('error', String(error));
2574
+ return;
2575
+ }
2420
2576
  } else {
2421
- const result = await this.api.signDocument(data);
2422
- this.formStore.signUrls = result;
2577
+ if (this.processCode === 1 || this.processCode === 2 || this.processCode === 3) {
2578
+ const result = await this.api.signBts(data);
2579
+ if (result.code === 0) this.formStore.signUrls = result.data;
2580
+ } else {
2581
+ const result = await this.api.signDocument(data);
2582
+ this.formStore.signUrls = result;
2583
+ }
2423
2584
  return this.formStore.signUrls;
2424
2585
  }
2425
2586
  } catch (err) {
@@ -2453,7 +2614,7 @@ export const useDataStore = defineStore('data', {
2453
2614
  link.setAttribute('download', 'Анкета Застрахованного.docx');
2454
2615
  break;
2455
2616
  case constants.documentTypes.invoicePayment:
2456
- link.setAttribute('download', 'Счет на оплату.pdf');
2617
+ link.setAttribute('download', 'Счет на оплату');
2457
2618
  break;
2458
2619
  }
2459
2620
  document.body.appendChild(link);
@@ -2508,6 +2669,35 @@ export const useDataStore = defineStore('data', {
2508
2669
  }
2509
2670
  this.isButtonsLoading = false;
2510
2671
  },
2672
+ async generatePDFDocument(name: string, code: string, format: 'pdf' | 'doc' = 'pdf', open: boolean = false) {
2673
+ try {
2674
+ this.isButtonsLoading = true;
2675
+ this.formStore.needToScanSignedContract = true;
2676
+ const data: any = {
2677
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2678
+ name: name,
2679
+ format: format,
2680
+ };
2681
+ const response: any = await this.api.generatePdfDocument(data);
2682
+ const blob = new Blob([response], {
2683
+ type: format === 'pdf' ? `application/pdf` : `application/vnd.openxmlformats-officedocument.wordprocessingml.document`,
2684
+ });
2685
+ const url = window.URL.createObjectURL(blob);
2686
+ const link = document.createElement('a');
2687
+ link.href = url;
2688
+ link.setAttribute('download', this.formStore.regNumber + ` ${this.dicFileTypeList.find((i: Value) => i.code == code)?.nameRu}`);
2689
+ document.body.appendChild(link);
2690
+ link.click();
2691
+ if (open) {
2692
+ window.open(url, '_blank', `right=100`);
2693
+ }
2694
+ return response;
2695
+ } catch (err) {
2696
+ ErrorHandler(err);
2697
+ } finally {
2698
+ this.isButtonsLoading = false;
2699
+ }
2700
+ },
2511
2701
  async registerNumber() {
2512
2702
  try {
2513
2703
  if (!this.formStore.finCenterData.date) return;
@@ -2770,7 +2960,7 @@ export const useDataStore = defineStore('data', {
2770
2960
  this.isLoading = true;
2771
2961
  const areMembersValid = await this.validateAllMembers(taskId);
2772
2962
  if (areMembersValid) {
2773
- if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) {
2963
+ if ((!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) || this.isPension) {
2774
2964
  if (this.controls.hasAnketa) {
2775
2965
  const hasCritical =
2776
2966
  this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
@@ -3483,6 +3673,18 @@ export const useDataStore = defineStore('data', {
3483
3673
 
3484
3674
  return true;
3485
3675
  },
3676
+ async getVariableData(processCode: number) {
3677
+ try {
3678
+ const response = await this.api.getVariableData(0, processCode);
3679
+ if (response) {
3680
+ return response.data.slice(0, 10);
3681
+ }
3682
+ return null;
3683
+ } catch (err) {
3684
+ ErrorHandler(err);
3685
+ return null;
3686
+ }
3687
+ },
3486
3688
  async checkIIN(iin: string) {
3487
3689
  try {
3488
3690
  const response = await this.api.checkIIN(iin);
@@ -3508,6 +3710,14 @@ export const useDataStore = defineStore('data', {
3508
3710
  return ErrorHandler(err);
3509
3711
  }
3510
3712
  },
3713
+ async getDocument(id: string) {
3714
+ try {
3715
+ const response = await this.api.getDocument(id);
3716
+ return response;
3717
+ } catch (err) {
3718
+ return ErrorHandler(err);
3719
+ }
3720
+ },
3511
3721
  async generateShortLink(url: string) {
3512
3722
  try {
3513
3723
  const response = await this.api.generateShortLink({
@@ -3520,7 +3730,7 @@ export const useDataStore = defineStore('data', {
3520
3730
  }
3521
3731
  },
3522
3732
  hasJobSection(whichForm: keyof typeof StoreMembers) {
3523
- if (this.isLifetrip) return false;
3733
+ if (this.isLifetrip || this.isPension) return false;
3524
3734
  switch (whichForm) {
3525
3735
  case this.formStore.beneficiaryFormKey:
3526
3736
  case this.formStore.beneficialOwnerFormKey:
@@ -3531,7 +3741,7 @@ export const useDataStore = defineStore('data', {
3531
3741
  }
3532
3742
  },
3533
3743
  hasBirthSection(whichForm: keyof typeof StoreMembers) {
3534
- if (this.isGons) return false;
3744
+ if (this.isGons || this.isPension) return false;
3535
3745
  switch (whichForm) {
3536
3746
  case this.formStore.beneficiaryFormKey:
3537
3747
  return false;
@@ -3552,12 +3762,41 @@ export const useDataStore = defineStore('data', {
3552
3762
  }
3553
3763
  },
3554
3764
  hasContactSection(whichForm: keyof typeof StoreMembers) {
3555
- if (this.isGons) return false;
3765
+ if (this.isGons || this.isPension) return false;
3766
+ switch (whichForm) {
3767
+ default:
3768
+ return true;
3769
+ }
3770
+ },
3771
+ hasBankSection(whichForm: keyof typeof StoreMembers) {
3772
+ if (!this.isPension) return false;
3773
+ switch (whichForm) {
3774
+ case 'beneficiaryForm':
3775
+ return false;
3776
+ default:
3777
+ return true;
3778
+ }
3779
+ },
3780
+ hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
3781
+ if (!this.isPension) return false;
3556
3782
  switch (whichForm) {
3783
+ case 'beneficiaryForm':
3784
+ return false;
3557
3785
  default:
3558
3786
  return true;
3559
3787
  }
3560
3788
  },
3789
+ hasFamilyTiesSection(whichForm: keyof typeof StoreMembers) {
3790
+ if (!this.isPension) return false;
3791
+ switch (whichForm) {
3792
+ case 'policyholderForm':
3793
+ return false;
3794
+ case 'beneficiaryForm':
3795
+ return true;
3796
+ default:
3797
+ return false;
3798
+ }
3799
+ },
3561
3800
  hasPercentageOfPayoutAmount() {
3562
3801
  return true;
3563
3802
  },
@@ -3575,6 +3814,7 @@ export const useDataStore = defineStore('data', {
3575
3814
  this.isHeadManager() ||
3576
3815
  this.isServiceManager() ||
3577
3816
  this.isUnderwriter() ||
3817
+ this.isActuary() ||
3578
3818
  this.isAdmin() ||
3579
3819
  this.isCompliance() ||
3580
3820
  this.isAnalyst() ||
@@ -3583,7 +3823,13 @@ export const useDataStore = defineStore('data', {
3583
3823
  this.isSupervisor() ||
3584
3824
  this.isSupport() ||
3585
3825
  this.isDrn() ||
3586
- this.isBranchDirector(),
3826
+ this.isUrp() ||
3827
+ this.isUsns() ||
3828
+ this.isAccountant() ||
3829
+ this.isBranchDirector() ||
3830
+ this.isUSNSACCINS() ||
3831
+ this.isDsuio() ||
3832
+ this.isAdjuster(),
3587
3833
  };
3588
3834
  },
3589
3835
  },
package/store/rules.ts CHANGED
@@ -8,6 +8,7 @@ export const rules = {
8
8
  recalculationMultiplyBetween: [(v: any) => (v !== null && v !== '' && v >= 100 && v <= 200) || t('toaster.recalculationMultiplyBetween', { floor: '100', ceil: '200' })],
9
9
  recalculationAdditive: [(v: any) => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween', { floor: '0', ceil: '100' })],
10
10
  required: [(v: any) => !!v || t('rules.required')],
11
+ notZero: [(v: any) => Number(v) !== 0 || 'Не может быть равно нулю'],
11
12
  iik: [(v: any) => v.length === 20 || t('rules.iik')],
12
13
  agentCommission: [(v: any) => v <= 50 || t('rules.agentCommission')],
13
14
  objectRequired: [
@@ -236,6 +237,22 @@ export const rules = {
236
237
  }
237
238
  },
238
239
  ],
240
+ checkDate: [
241
+ (v: any) => {
242
+ const today = new Date();
243
+ const yesterday = new Date();
244
+ yesterday.setDate(today.getDate() - 1);
245
+ const yourDate = new Date(formatDate(v)!);
246
+
247
+ if (yourDate.toDateString() === today.toDateString()) {
248
+ return true;
249
+ } else if (yourDate.toDateString() === yesterday.toDateString()) {
250
+ return true;
251
+ } else {
252
+ return t('rules.checkDate');
253
+ }
254
+ },
255
+ ],
239
256
  guaranteedPeriodLimit(v: any, termAnnuityPayments: any) {
240
257
  if (Number(v) > Number(termAnnuityPayments)) {
241
258
  return t('rules.guaranteedPeriodLimit');
package/types/enum.ts CHANGED
@@ -13,6 +13,9 @@ export enum Actions {
13
13
  rejectclient = 'rejectclient',
14
14
  rejectclientCustom = 'rejectclientCustom',
15
15
 
16
+ cancel = 'cancel',
17
+ cancelCustom = 'cancelCustom',
18
+
16
19
  reject = 'reject',
17
20
  rejectCustom = 'rejectCustom',
18
21
 
@@ -69,12 +72,15 @@ export enum PostActions {
69
72
  export enum Roles {
70
73
  Manager = 'Manager',
71
74
  Admin = 'Admin',
75
+ Jurist = 'Jurist',
72
76
  Underwriter = 'Underwriter',
77
+ Actuary = 'Actuary',
73
78
  Agent = 'Agent',
74
79
  Compliance = 'Compliance',
75
80
  AgentMycar = 'AgentMycar',
76
81
  Analyst = 'Analyst',
77
82
  UPK = 'UPK',
83
+ URP = 'URP',
78
84
  FinCenter = 'FinCenter',
79
85
  Supervisor = 'Supervisor',
80
86
  Support = 'Support',
@@ -83,7 +89,12 @@ export enum Roles {
83
89
  DRNSJ = 'DRNSJ',
84
90
  HeadManager = 'HeadManager',
85
91
  AgentAuletti = 'AgentAuletti',
92
+ USNS = 'USNS',
93
+ Accountant = 'Accountant',
86
94
  BranchDirector = 'BranchDirector',
95
+ USNSACCINS = 'USNSACCINS',
96
+ Dsuio = 'Dsuio',
97
+ Adjuster = 'Adjuster',
87
98
  }
88
99
 
89
100
  export enum Statuses {
@@ -91,6 +102,7 @@ export enum Statuses {
91
102
  EditForm = 'EditForm',
92
103
  EditBeneficiaryForm = 'EditBeneficiaryForm',
93
104
  DocumentsSignedFrom = 'DocumentsSignedFrom',
105
+ PreparationDossierForm = 'PreparationDossierForm',
94
106
  UnderwriterForm = 'UnderwriterForm',
95
107
  AffilationResolutionForm = 'AffilationResolutionForm',
96
108
  Completed = 'Completed',
@@ -102,6 +114,12 @@ export enum Statuses {
102
114
  DocumentsSignedClientFrom = 'DocumentsSignedClientFrom',
103
115
  InputDataForm = 'InputDataForm',
104
116
  ApproveForm = 'ApproveForm',
117
+ AttachAppContractForm = 'AttachAppContractForm',
118
+ ControllerDpForm = 'ControllerDpForm',
119
+ ActuaryForm = 'ActuaryForm',
120
+ DsoUsnsForm = 'DsoUsnsForm',
121
+ AccountantForm = 'AccountantForm',
122
+ ContractSignedByAuthorizedPerson = 'ContractSignedByAuthorizedPerson',
105
123
  }
106
124
 
107
125
  export enum MemberCodes {