hl-core 0.0.10-beta.2 → 0.0.10-beta.21

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.
Files changed (42) hide show
  1. package/api/base.api.ts +221 -195
  2. package/components/Complex/TextBlock.vue +2 -0
  3. package/components/Dialog/Dialog.vue +7 -1
  4. package/components/Dialog/FamilyDialog.vue +2 -0
  5. package/components/Form/DigitalDocument.vue +52 -0
  6. package/components/Form/DynamicForm.vue +1 -0
  7. package/components/Form/FormData.vue +1 -0
  8. package/components/Form/ManagerAttachment.vue +2 -4
  9. package/components/Input/DynamicInput.vue +2 -0
  10. package/components/Input/FormInput.vue +2 -0
  11. package/components/Input/OtpInput.vue +25 -0
  12. package/components/Input/PanelInput.vue +1 -0
  13. package/components/Input/RoundedInput.vue +2 -0
  14. package/components/Input/RoundedSelect.vue +4 -0
  15. package/components/Input/SwitchInput.vue +2 -0
  16. package/components/Input/TextInput.vue +2 -0
  17. package/components/Layout/Drawer.vue +2 -0
  18. package/components/Pages/Anketa.vue +165 -166
  19. package/components/Pages/Auth.vue +2 -0
  20. package/components/Pages/ContragentForm.vue +1 -0
  21. package/components/Pages/Documents.vue +237 -6
  22. package/components/Pages/MemberForm.vue +204 -56
  23. package/components/Pages/ProductConditions.vue +153 -74
  24. package/components/Panel/PanelHandler.vue +231 -105
  25. package/components/Transitions/Animation.vue +2 -0
  26. package/components/Utilities/Chip.vue +2 -0
  27. package/components/Utilities/JsonViewer.vue +1 -2
  28. package/composables/classes.ts +102 -41
  29. package/composables/fields.ts +6 -4
  30. package/composables/index.ts +220 -7
  31. package/composables/styles.ts +8 -24
  32. package/configs/pwa.ts +1 -7
  33. package/locales/ru.json +11 -4
  34. package/nuxt.config.ts +10 -13
  35. package/package.json +13 -12
  36. package/plugins/head.ts +1 -1
  37. package/store/data.store.ts +235 -357
  38. package/store/member.store.ts +3 -2
  39. package/tsconfig.json +3 -0
  40. package/types/enum.ts +17 -2
  41. package/types/form.ts +71 -75
  42. package/types/index.ts +889 -877
@@ -1,6 +1,7 @@
1
1
  import { Statuses, StoreMembers, MemberAppCodes } from '../types/enum';
2
2
  import { formatDate } from '.';
3
3
  import type { RouteLocationNormalized, RouteLocationNormalizedLoaded } from 'vue-router';
4
+ import type * as Types from '../types';
4
5
 
5
6
  type LinkType = Partial<RouteLocationNormalized> | Partial<RouteLocationNormalizedLoaded> | string | null | boolean;
6
7
 
@@ -17,7 +18,7 @@ class MenuItemConfig {
17
18
  disabled?: ComputedRef;
18
19
  color?: string;
19
20
  show?: ComputedRef;
20
- chip?: ChipComponent;
21
+ chip?: Types.ChipComponent;
21
22
 
22
23
  constructor(
23
24
  id: any = null,
@@ -32,7 +33,7 @@ class MenuItemConfig {
32
33
  disabled?: ComputedRef,
33
34
  color?: string,
34
35
  show?: ComputedRef,
35
- chip?: ChipComponent,
36
+ chip?: Types.ChipComponent,
36
37
  ) {
37
38
  this.id = id;
38
39
  this.title = title;
@@ -87,6 +88,7 @@ export class IDocument {
87
88
  iin?: string;
88
89
  fileTypeId?: string;
89
90
  fileTypeName?: string;
91
+ fileTypeNameRu?: string;
90
92
  fileId?: string;
91
93
  page?: number;
92
94
  fileName?: string;
@@ -102,6 +104,7 @@ export class IDocument {
102
104
  iin?: string,
103
105
  fileTypeId?: string,
104
106
  fileTypeName?: string,
107
+ fileTypeNameRu?: string,
105
108
  fileId?: string,
106
109
  page?: number,
107
110
  fileName?: string,
@@ -116,6 +119,7 @@ export class IDocument {
116
119
  this.iin = iin;
117
120
  this.fileTypeId = fileTypeId;
118
121
  this.fileTypeName = fileTypeName;
122
+ this.fileTypeNameRu = fileTypeNameRu;
119
123
  this.fileId = fileId;
120
124
  this.page = page;
121
125
  this.fileName = fileName;
@@ -129,9 +133,24 @@ export class IDocument {
129
133
 
130
134
  export class DocumentItem extends IDocument {
131
135
  constructor(
132
- { id, processInstanceId, iin, fileTypeId, fileTypeName, fileId, page, fileName, fileTypeCode, sharedId, signed, signId, certificateDate }: IDocument = new IDocument(),
136
+ {
137
+ id,
138
+ processInstanceId,
139
+ iin,
140
+ fileTypeId,
141
+ fileTypeName,
142
+ fileTypeNameRu,
143
+ fileId,
144
+ page,
145
+ fileName,
146
+ fileTypeCode,
147
+ sharedId,
148
+ signed,
149
+ signId,
150
+ certificateDate,
151
+ }: IDocument = new IDocument(),
133
152
  ) {
134
- super(id, processInstanceId, iin, fileTypeId, fileTypeName, fileId, page, fileName, fileTypeCode, sharedId, signed, signId, certificateDate);
153
+ super(id, processInstanceId, iin, fileTypeId, fileTypeName, fileTypeNameRu, fileId, page, fileName, fileTypeCode, sharedId, signed, signId, certificateDate);
135
154
  }
136
155
  }
137
156
 
@@ -179,13 +198,25 @@ export class User {
179
198
  roles: string[];
180
199
  id: string | null;
181
200
  fullName: string | null;
201
+ code: string;
202
+ branchCode: string;
182
203
 
183
- constructor(login: string | null = null, password: string | null = null, roles: string[] = [], id: string | null = null, fullName: string | null = null) {
204
+ constructor(
205
+ login: string | null = null,
206
+ password: string | null = null,
207
+ roles: string[] = [],
208
+ id: string | null = null,
209
+ fullName: string | null = null,
210
+ code: string = '',
211
+ branchCode: string = '',
212
+ ) {
184
213
  this.login = login;
185
214
  this.password = password;
186
215
  this.roles = roles;
187
216
  this.id = id;
188
217
  this.fullName = fullName;
218
+ this.code = code;
219
+ this.branchCode = branchCode;
189
220
  }
190
221
 
191
222
  resetUser() {
@@ -194,6 +225,8 @@ export class User {
194
225
  this.roles = [];
195
226
  this.id = null;
196
227
  this.fullName = null;
228
+ this.code = '';
229
+ this.branchCode = '';
197
230
  }
198
231
  }
199
232
 
@@ -383,11 +416,11 @@ export class Contragent extends Person {
383
416
 
384
417
  export class Member extends Person {
385
418
  response?: {
386
- contragent?: ContragentType;
387
- questionnaires?: ContragentQuestionaries[];
388
- contacts?: ContragentContacts[];
389
- documents?: ContragentDocuments[];
390
- addresses?: ContragentAddress[];
419
+ contragent?: Types.ContragentType;
420
+ questionnaires?: Types.ContragentQuestionaries[];
421
+ contacts?: Types.ContragentContacts[];
422
+ documents?: Types.ContragentDocuments[];
423
+ addresses?: Types.ContragentAddress[];
391
424
  };
392
425
  verifyType: any;
393
426
  verifyDate: any;
@@ -451,15 +484,16 @@ export class Member extends Person {
451
484
  _phonePattern: RegExp;
452
485
  _emailPattern: RegExp;
453
486
  gotFromInsis: boolean | null;
454
- gosPersonData: Api.GBD.Person | null;
487
+ gosPersonData: Types.Api.GBD.Person | null;
455
488
  parsedDocument: any;
456
489
  hasAgreement: boolean | null;
457
490
  otpTokenId: string | null;
458
- otpCode: string | null;
459
- documentsList: ContragentDocuments[];
491
+ otpCode: string;
492
+ documentsList: Types.ContragentDocuments[];
460
493
  isInsuredUnderage?: boolean = false;
461
494
  bankInfo: BankInfoClass;
462
495
  transferContractCompany: Value;
496
+ digitalDocument: IDocument | null;
463
497
  identityDocument: {
464
498
  documentType: Value;
465
499
  documentNumber: string | null;
@@ -586,7 +620,7 @@ export class Member extends Person {
586
620
  this.homePhone = homePhone;
587
621
  this.email = email;
588
622
  this.otpTokenId = null;
589
- this.otpCode = null;
623
+ this.otpCode = '';
590
624
  this.address = address;
591
625
  this.familyStatus = familyStatus;
592
626
  this.isTerror = isTerror;
@@ -604,6 +638,7 @@ export class Member extends Person {
604
638
  this.hasAgreement = null;
605
639
  this.bankInfo = new BankInfoClass();
606
640
  this.transferContractCompany = new Value();
641
+ this.digitalDocument = null;
607
642
  this.identityDocument = {
608
643
  documentType: new Value(),
609
644
  documentNumber: null,
@@ -928,7 +963,7 @@ export class MemberSettings {
928
963
  }
929
964
 
930
965
  export class DataStoreClass {
931
- projectConfig: Utils.ProjectConfig | null;
966
+ projectConfig: Types.Utils.ProjectConfig | null;
932
967
  // IMP Контроллер фич
933
968
  controls: {
934
969
  // Cтавит значения по дефолту полям
@@ -973,7 +1008,7 @@ export class DataStoreClass {
973
1008
  };
974
1009
  iframeLoading: boolean;
975
1010
  hasLayoutMargins: boolean;
976
- readonly product: Projects | null;
1011
+ readonly product: Types.Projects | null;
977
1012
  readonly parentProduct: 'efo' | 'auletti';
978
1013
  showNav: boolean;
979
1014
  showDisabledMessage: boolean;
@@ -1016,7 +1051,7 @@ export class DataStoreClass {
1016
1051
  historyTotalItems: number;
1017
1052
  isColumnAsc = { ...InitialColumns() };
1018
1053
  idleKey: number;
1019
- processList: Item[] | null;
1054
+ processList: Types.Item[] | null;
1020
1055
  countries: Value[];
1021
1056
  citizenshipCountries: Value[];
1022
1057
  taxCountries: Value[];
@@ -1045,7 +1080,6 @@ export class DataStoreClass {
1045
1080
  fontSize: number;
1046
1081
  isFontChangerOpen: boolean = false;
1047
1082
  isLoading: boolean = false;
1048
- user: User;
1049
1083
  accessToken: string | null = null;
1050
1084
  refreshToken: string | null = null;
1051
1085
  processIndexRate: Value[];
@@ -1053,18 +1087,18 @@ export class DataStoreClass {
1053
1087
  processPaymentPeriod: Value[];
1054
1088
  dicAnnuityTypeList: Value[];
1055
1089
  processAnnuityPaymentPeriod: Value[];
1056
- taskList: TaskListItem[];
1057
- processHistory: TaskHistory[];
1058
- contragentList: ContragentType[];
1090
+ taskList: Types.TaskListItem[];
1091
+ processHistory: Types.TaskHistory[];
1092
+ contragentList: Types.ContragentType[];
1059
1093
  contragentFormKey: string;
1060
1094
  processCode: number | null;
1061
1095
  groupCode: string;
1062
- userGroups: Item[];
1096
+ userGroups: Types.Item[];
1063
1097
  onMainPage: boolean;
1064
1098
  SaleChanellPolicy: Value[];
1065
1099
  RegionPolicy: Value[];
1066
1100
  ManagerPolicy: Value[];
1067
- AgentData: AgentData[];
1101
+ AgentData: Types.AgentData[];
1068
1102
  riskGroup: Value[];
1069
1103
  DicCoverTypePeriod: Value[];
1070
1104
  currencies: {
@@ -1148,7 +1182,7 @@ export class DataStoreClass {
1148
1182
  this.ManagerPolicy = [];
1149
1183
  this.AgentData = [];
1150
1184
  this.DicCoverTypePeriod = [];
1151
- this.product = import.meta.env.VITE_PRODUCT ? (import.meta.env.VITE_PRODUCT as Projects) : null;
1185
+ this.product = import.meta.env.VITE_PRODUCT ? (import.meta.env.VITE_PRODUCT as Types.Projects) : null;
1152
1186
  this.parentProduct = import.meta.env.VITE_PARENT_PRODUCT ? import.meta.env.VITE_PARENT_PRODUCT : 'efo';
1153
1187
  this.showNav = true;
1154
1188
  this.showDisabledMessage = false;
@@ -1229,7 +1263,6 @@ export class DataStoreClass {
1229
1263
  this.fontSize = 14;
1230
1264
  this.isFontChangerOpen = false;
1231
1265
  this.isLoading = false;
1232
- this.user = new User();
1233
1266
  this.accessToken = null;
1234
1267
  this.refreshToken = null;
1235
1268
  this.taskList = [];
@@ -1300,10 +1333,10 @@ export class FormStoreClass {
1300
1333
  isUploadedSignedContract: boolean;
1301
1334
  signedContractFormData: any;
1302
1335
  lfb: {
1303
- clients: ClientV2[];
1336
+ clients: Types.ClientV2[];
1304
1337
  policyholder: PolicyholderClass;
1305
1338
  hasAccidentIncidents: boolean;
1306
- accidentIncidents: AccidentIncidents[];
1339
+ accidentIncidents: Types.AccidentIncidents[];
1307
1340
  policyholderActivities: PolicyholderActivity[];
1308
1341
  beneficialOwners: BeneficialOwner[];
1309
1342
  beneficialOwnersIndex: number;
@@ -1312,11 +1345,11 @@ export class FormStoreClass {
1312
1345
  insuredFile: any;
1313
1346
  isPanelInside: boolean;
1314
1347
  };
1315
- additionalInsuranceTerms: AddCover[];
1316
- additionalInsuranceTermsWithout: AddCover[];
1317
- signUrls: SignUrlType[];
1348
+ additionalInsuranceTerms: Types.AddCover[];
1349
+ additionalInsuranceTermsWithout: Types.AddCover[];
1350
+ signUrls: Types.SignUrlType[];
1318
1351
  epayLink: string | null;
1319
- invoiceData: EpayResponse | null;
1352
+ invoiceData: Types.EpayResponse | null;
1320
1353
  affilationResolution: {
1321
1354
  id: string | number | null;
1322
1355
  processInstanceId: string | number | null;
@@ -1329,19 +1362,20 @@ export class FormStoreClass {
1329
1362
  date: string | null;
1330
1363
  };
1331
1364
  signedDocumentList: IDocument[];
1332
- surveyByHealthBase: AnketaFirst | null;
1333
- surveyByHealthBasePolicyholder: AnketaFirst | null;
1334
- surveyByCriticalBase: AnketaFirst | null;
1335
- surveyByCriticalBasePolicyholder: AnketaFirst | null;
1365
+ signatories: any[];
1366
+ surveyByHealthBase: Types.AnketaFirst | null;
1367
+ surveyByHealthBasePolicyholder: Types.AnketaFirst | null;
1368
+ surveyByCriticalBase: Types.AnketaFirst | null;
1369
+ surveyByCriticalBasePolicyholder: Types.AnketaFirst | null;
1336
1370
  definedAnswersId: {
1337
1371
  surveyByHealthBase: any;
1338
1372
  surveyByCriticalBase: any;
1339
1373
  surveyByHealthBasePolicyholder: any;
1340
1374
  surveyByCriticalBasePolicyholder: any;
1341
1375
  };
1342
- birthInfos: Api.GKB.BirthInfo[];
1376
+ birthInfos: Types.Api.GKB.BirthInfo[];
1343
1377
  SaleChanellPolicy: Value;
1344
- AgentData: AgentData;
1378
+ AgentData: Types.AgentData;
1345
1379
  RegionPolicy: Value;
1346
1380
  ManagerPolicy: Value;
1347
1381
  isDisabled: {
@@ -1380,9 +1414,9 @@ export class FormStoreClass {
1380
1414
  spokesmanApp?: any;
1381
1415
  isTask?: boolean | null;
1382
1416
  createDate?: string | null;
1383
- policyAppDto?: PolicyAppDto;
1384
- insisWorkDataApp?: InsisWorkDataApp;
1385
- addCoverDto?: AddCover[];
1417
+ policyAppDto?: Types.PolicyAppDto;
1418
+ insisWorkDataApp?: Types.InsisWorkDataApp;
1419
+ addCoverDto?: Types.AddCover[];
1386
1420
  };
1387
1421
  policyholderForm: Member;
1388
1422
  policyholderFormKey: StoreMembers.policyholderForm;
@@ -1442,6 +1476,7 @@ export class FormStoreClass {
1442
1476
  date: null,
1443
1477
  };
1444
1478
  this.signedDocumentList = [];
1479
+ this.signatories = [];
1445
1480
  this.surveyByHealthBase = null;
1446
1481
  this.surveyByHealthBasePolicyholder = null;
1447
1482
  this.surveyByCriticalBase = null;
@@ -1649,7 +1684,7 @@ export class GroupMember extends PhysGroupClass {
1649
1684
  activityTypes: { activityTypeName: string; empoloyeeCount: number }[];
1650
1685
  beneficalOwnerQuest: { order: number; text: string; answer: boolean | null }[];
1651
1686
  authoritedPerson: PhysGroupClass;
1652
- insuredPolicyData: InsuredPolicyType;
1687
+ insuredPolicyData: Types.InsuredPolicyType;
1653
1688
 
1654
1689
  constructor() {
1655
1690
  super();
@@ -1734,3 +1769,29 @@ export class BeneficialOwner {
1734
1769
  this.id = '';
1735
1770
  }
1736
1771
  }
1772
+
1773
+ export class TransferContract {
1774
+ id: string | null;
1775
+ transferContractIsOppv: boolean;
1776
+ transferContractFirstPaymentDate: string;
1777
+ transferContractAmount: number;
1778
+ transferContractDate: string;
1779
+ transferContractNumber: string;
1780
+ transferContractRegNumber: string;
1781
+ transferContract: boolean;
1782
+ transferContractCompany: Value;
1783
+ transferContractMonthCount: number;
1784
+
1785
+ constructor() {
1786
+ this.id = null;
1787
+ this.transferContractIsOppv = false;
1788
+ this.transferContractFirstPaymentDate = '';
1789
+ this.transferContractAmount = 0;
1790
+ this.transferContractDate = '';
1791
+ this.transferContractNumber = '';
1792
+ this.transferContract = false;
1793
+ this.transferContractRegNumber = '';
1794
+ this.transferContractCompany = new Value();
1795
+ this.transferContractMonthCount = 0;
1796
+ }
1797
+ }
@@ -1,6 +1,8 @@
1
1
  import { i18n } from '../configs/i18n';
2
- import { FieldTypes } from '../types/form';
2
+ import { FieldTypes, type InputBase, type InputType } from '../types/form';
3
3
  import { type ComputedRefWithControl } from '@vueuse/core';
4
+ import type { Utils } from '../types';
5
+ import type * as Types from '../types/form';
4
6
 
5
7
  const t = i18n.t;
6
8
 
@@ -37,14 +39,14 @@ export const FieldBase = ({
37
39
  fetchFrom,
38
40
  }) as InputBase;
39
41
 
40
- export const TextInput = ({ ...rest }: Partial<TextInput>): TextInput => {
42
+ export const TextInput = ({ ...rest }: Partial<Types.TextInput>): Types.TextInput => {
41
43
  return {
42
44
  ...FieldBase(rest),
43
45
  type: FieldTypes.TEXT,
44
46
  };
45
47
  };
46
48
 
47
- export const SwitchInput = ({ ...rest }: Partial<SwitchInput>): SwitchInput => {
49
+ export const SwitchInput = ({ ...rest }: Partial<Types.SwitchInput>): Types.SwitchInput => {
48
50
  return {
49
51
  ...FieldBase(rest),
50
52
  type: FieldTypes.SWITCH,
@@ -55,7 +57,7 @@ export const SwitchInput = ({ ...rest }: Partial<SwitchInput>): SwitchInput => {
55
57
  };
56
58
  };
57
59
 
58
- export const NumberInput = ({ ...rest }: Partial<NumberInput>): NumberInput => {
60
+ export const NumberInput = ({ ...rest }: Partial<Types.NumberInput>): Types.NumberInput => {
59
61
  return {
60
62
  ...FieldBase(rest),
61
63
  type: FieldTypes.NUMBER,
@@ -1,9 +1,11 @@
1
1
  import { useDisplay } from 'vuetify';
2
- import jwt_decode from 'jwt-decode';
2
+ import { jwtDecode as jwt_decode } from 'jwt-decode';
3
3
  import { XMLParser } from 'fast-xml-parser';
4
4
  import { AxiosError } from 'axios';
5
5
  import { DocumentReaderApi, Scenario, TextFieldType, LCID } from '@regulaforensics/document-reader-webclient';
6
- import { PolicyholderClass } from '../composables/classes';
6
+ import { PolicyholderClass, Value, User } from '../composables/classes';
7
+ import type { EnvModes, NestedKeyOf, ResponseStructure, Utils } from '../types';
8
+ import { Roles, Statuses } from '../types/enum';
7
9
 
8
10
  export const useEnv = () => {
9
11
  return {
@@ -16,7 +18,8 @@ export const useEnv = () => {
16
18
 
17
19
  export class Masks {
18
20
  numbers: string = '#*';
19
- otp: string = '# # # #';
21
+ otp: string = '####';
22
+ otpSixDigit: string = '######';
20
23
  spacedNumbers: string = '### ### ### ### ### ### ###';
21
24
  iin: string = '###-###-###-###';
22
25
  phone: string = '+7 (7##) ### ## ##';
@@ -101,13 +104,14 @@ export const formatPhone = (phone: string) => {
101
104
 
102
105
  export const cleanWhiteSpace = (str: string) => String(str).replace(/\s+/g, '');
103
106
 
104
- export const jwtDecode = (token: string): any => {
105
- if (token) return jwt_decode(token);
107
+ export const jwtDecode = (token?: string | null) => {
108
+ if (token) return jwt_decode<Utils.JwtToken>(token);
106
109
  else return null;
107
110
  };
108
111
 
109
112
  export const isValidToken = (token: string) => {
110
- return (new Date(jwtDecode(token).exp * 1000).getTime() - Date.now()) / 1000 > 0;
113
+ const decoded = jwtDecode(token);
114
+ return !!decoded && (new Date(Number(decoded.exp) * 1000).getTime() - Date.now()) / 1000 > 0;
111
115
  };
112
116
 
113
117
  export const isValidGUID = (value: string) => {
@@ -148,6 +152,12 @@ export const formatProcents = (val: string | number) => (val ? Number(((val as n
148
152
 
149
153
  export const sanitizeURL = (text: string) => (text ? text.replace(/\r?\n|\r|\\|"/g, '') : '');
150
154
 
155
+ export const sanitize = (text: string) =>
156
+ String(text)
157
+ .replace(/\r?\n|\r/g, '')
158
+ .replace(/\\/g, '')
159
+ .replace(/"/g, '');
160
+
151
161
  export const yearEnding = (number: number, titles: string[], cases: number[]) => {
152
162
  return titles[number % 100 > 4 && number % 100 < 20 ? 2 : cases[number % 10 < 5 ? number % 10 : 5]];
153
163
  };
@@ -273,6 +283,7 @@ export const setAddressBeneficiary = (whichIndex: number, sameAddress: boolean)
273
283
  if (beneficiary.id === 0) {
274
284
  beneficiary.registrationCity = new Value();
275
285
  beneficiary.registrationCountry = new Value();
286
+ beneficiary.birthPlace = new Value();
276
287
  beneficiary.registrationMicroDistrict = '';
277
288
  beneficiary.registrationNumberApartment = '';
278
289
  beneficiary.registrationNumberApartment = '';
@@ -295,6 +306,13 @@ export const setAddressBeneficiary = (whichIndex: number, sameAddress: boolean)
295
306
  const city = dataStore.cities.find(i => i.nameRu === cityName.replace('г.', ''));
296
307
  beneficiary.registrationCity = city ?? new Value();
297
308
  }
309
+ const contragentData = beneficiary.response.contragent;
310
+ if (contragentData) {
311
+ const country = dataStore.countries.find((i: Value) => i.nameRu?.match(new RegExp(contragentData.birthPlace, 'i')));
312
+ beneficiary.birthPlace = country ?? new Value();
313
+ } else {
314
+ beneficiary.birthPlace = new Value();
315
+ }
298
316
  const province = dataStore.states.find(i => i.ids === benAddress[0].stateCode);
299
317
  const localityType = dataStore.localityTypes.find(i => i.nameRu === benAddress[0].cityTypeName);
300
318
  const region = dataStore.regions.find(i => i.ids == benAddress[0].regionCode);
@@ -332,6 +350,7 @@ export const setAddressInsured = (whichIndex: number, sameAddress: boolean) => {
332
350
  if (insured.id === 0) {
333
351
  insured.registrationCity = new Value();
334
352
  insured.registrationCountry = new Value();
353
+ insured.birthPlace = new Value();
335
354
  insured.registrationMicroDistrict = '';
336
355
  insured.registrationNumberApartment = '';
337
356
  insured.registrationNumberApartment = '';
@@ -354,6 +373,13 @@ export const setAddressInsured = (whichIndex: number, sameAddress: boolean) => {
354
373
  const city = dataStore.cities.find(i => i.nameRu === cityName.replace('г.', ''));
355
374
  insured.registrationCity = city ?? new Value();
356
375
  }
376
+ const contragentData = insured.response.contragent;
377
+ if (contragentData) {
378
+ const country = dataStore.countries.find((i: Value) => i.nameRu?.match(new RegExp(contragentData.birthPlace, 'i')));
379
+ insured.birthPlace = country ?? new Value();
380
+ } else {
381
+ insured.birthPlace = new Value();
382
+ }
357
383
  const province = dataStore.states.find(i => i.ids === benAddress[0].stateCode);
358
384
  const localityType = dataStore.localityTypes.find(i => i.nameRu === benAddress[0].cityTypeName);
359
385
  const region = dataStore.regions.find(i => i.ids == benAddress[0].regionCode);
@@ -473,7 +499,7 @@ export const getStrValuePerEnv = (which: WhichValuePerEnv) => {
473
499
  test: 'http://aml-dev.halyklife.nb/api',
474
500
  },
475
501
  };
476
- return valuesPerEnv[which][import.meta.env.VITE_MODE];
502
+ return valuesPerEnv[which][import.meta.env.VITE_MODE as EnvModes];
477
503
  };
478
504
 
479
505
  export const getMainPageRoute = () => {
@@ -609,3 +635,190 @@ export const isEveryFormDisabled = (isDisabledForm: any) => {
609
635
  };
610
636
 
611
637
  export class ApiError extends AxiosError<any, any> {}
638
+
639
+ export class ProcessController {
640
+ isProcessEditable = (statusCode?: keyof typeof Statuses) => {
641
+ const getEditibleStatuses = () => {
642
+ const defaultStatuses = constants.editableStatuses;
643
+ return defaultStatuses;
644
+ };
645
+ return !!getEditibleStatuses().find(status => status === statusCode);
646
+ };
647
+ isProcessReturnable = (statusCode?: keyof typeof Statuses) => {
648
+ const getReturnableStatuses = () => {
649
+ const defaultStatuses = constants.returnStatementStatuses;
650
+ return defaultStatuses;
651
+ };
652
+ return !!getReturnableStatuses().find(status => status === statusCode);
653
+ };
654
+ isProcessCancel = (statusCode?: keyof typeof Statuses) => {
655
+ const getCanceleStatuses = () => {
656
+ const defaultStatuses = constants.cancelApplicationStatuses;
657
+ return defaultStatuses;
658
+ };
659
+ return !!getCanceleStatuses().find(status => status === statusCode);
660
+ };
661
+ isProcessReject = (statusCode?: keyof typeof Statuses) => {
662
+ const getRejectStatuses = () => {
663
+ const defaultStatuses = constants.rejectApplicationStatuses;
664
+ return defaultStatuses;
665
+ };
666
+ return !!getRejectStatuses().find(status => status === statusCode);
667
+ };
668
+ }
669
+
670
+ export class RoleController {
671
+ user: User = new User();
672
+
673
+ isRole = (whichRole: keyof typeof Roles) => {
674
+ if (this.user.roles.length === 0) {
675
+ const token = localStorage.getItem('accessToken') || null;
676
+ if (token) {
677
+ const decoded = jwtDecode(token);
678
+ if (decoded) {
679
+ this.user.id = String(decoded.sub);
680
+ this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
681
+ this.user.code = decoded.code;
682
+ this.user.branchCode = decoded.branchCode;
683
+ const key = getKeyWithPattern(decoded, 'role');
684
+ if (key) {
685
+ const roles = decoded[key as keyof Utils.JwtToken];
686
+ if (typeof roles === 'string') {
687
+ this.user.roles.push(roles);
688
+ } else if (typeof roles === 'object') {
689
+ this.user.roles = roles;
690
+ }
691
+ }
692
+ }
693
+ }
694
+ }
695
+ return !!this.user.roles.find(i => i === whichRole);
696
+ };
697
+ isInitiator = () => {
698
+ return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager() || this.isAgentAuletti();
699
+ };
700
+ isManager = () => {
701
+ return this.isRole(constants.roles.Manager);
702
+ };
703
+ isCompliance = () => {
704
+ return this.isRole(constants.roles.Compliance);
705
+ };
706
+ isAdmin = () => {
707
+ return this.isRole(constants.roles.Admin);
708
+ };
709
+ isJurist = () => {
710
+ return this.isRole(constants.roles.Jurist);
711
+ };
712
+ isAgent = () => {
713
+ return this.isRole(constants.roles.Agent);
714
+ };
715
+ isManagerHalykBank = () => {
716
+ return this.isRole(constants.roles.ManagerHalykBank);
717
+ };
718
+ isServiceManager = () => {
719
+ return this.isRole(constants.roles.ServiceManager);
720
+ };
721
+ isUnderwriter = () => {
722
+ return this.isRole(constants.roles.Underwriter);
723
+ };
724
+ isActuary = () => {
725
+ return this.isRole(constants.roles.Actuary);
726
+ };
727
+ isAgentMycar = () => {
728
+ return this.isRole(constants.roles.AgentMycar);
729
+ };
730
+ isAgentAuletti = () => {
731
+ return this.isRole(constants.roles.AgentAuletti);
732
+ };
733
+ isManagerAuletti = () => {
734
+ return this.isRole(constants.roles.ManagerAuletti);
735
+ };
736
+ isAnalyst = () => {
737
+ return this.isRole(constants.roles.Analyst);
738
+ };
739
+ isUpk = () => {
740
+ return this.isRole(constants.roles.UPK);
741
+ };
742
+ isUrp = () => {
743
+ return this.isRole(constants.roles.URP);
744
+ };
745
+ isUsns = () => {
746
+ return this.isRole(constants.roles.USNS);
747
+ };
748
+ isAccountant = () => {
749
+ return this.isRole(constants.roles.Accountant);
750
+ };
751
+ isDrn = () => {
752
+ return this.isRole(constants.roles.DRNSJ);
753
+ };
754
+ isSupport = () => {
755
+ return this.isRole(constants.roles.Support);
756
+ };
757
+ isFinCenter = () => {
758
+ return this.isRole(constants.roles.FinCenter);
759
+ };
760
+ isSupervisor = () => {
761
+ return this.isRole(constants.roles.Supervisor);
762
+ };
763
+ isHeadManager = () => {
764
+ return this.isRole(constants.roles.HeadManager);
765
+ };
766
+ isBranchDirector = () => {
767
+ return this.isRole(constants.roles.BranchDirector);
768
+ };
769
+ isUSNSACCINS = () => {
770
+ return this.isRole(constants.roles.USNSACCINS);
771
+ };
772
+ isDsuio = () => {
773
+ return this.isRole(constants.roles.Dsuio);
774
+ };
775
+ isAdjuster = () => {
776
+ return this.isRole(constants.roles.SettlementLosses);
777
+ };
778
+ isHeadAdjuster = () => {
779
+ return this.isRole(constants.roles.HeadSettlementLosses);
780
+ };
781
+ isDsoDirector = () => {
782
+ return this.isRole(constants.roles.DsoDirector);
783
+ };
784
+ isAccountantDirector = () => {
785
+ return this.isRole(constants.roles.AccountantDirector);
786
+ };
787
+ hasAccess = () => {
788
+ const baseAccessRoles = this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
789
+ return {
790
+ invoiceInfo: this.isAdmin(),
791
+ toLKA: this.isAgent() || this.isManagerHalykBank() || baseAccessRoles,
792
+ toAML: this.isCompliance() || baseAccessRoles,
793
+ toAULETTI: this.isAgentAuletti() || this.isManagerAuletti() || baseAccessRoles,
794
+ toLKA_A: this.isAgentAuletti() || baseAccessRoles,
795
+ toEFO:
796
+ this.isManager() ||
797
+ this.isAgent() ||
798
+ this.isAgentMycar() ||
799
+ this.isManagerHalykBank() ||
800
+ this.isHeadManager() ||
801
+ this.isServiceManager() ||
802
+ this.isUnderwriter() ||
803
+ this.isActuary() ||
804
+ this.isAdmin() ||
805
+ this.isCompliance() ||
806
+ this.isAnalyst() ||
807
+ this.isUpk() ||
808
+ this.isFinCenter() ||
809
+ this.isSupervisor() ||
810
+ this.isSupport() ||
811
+ this.isDrn() ||
812
+ this.isUrp() ||
813
+ this.isUsns() ||
814
+ this.isAccountant() ||
815
+ this.isBranchDirector() ||
816
+ this.isUSNSACCINS() ||
817
+ this.isDsuio() ||
818
+ this.isAdjuster() ||
819
+ this.isDsoDirector() ||
820
+ this.isAccountantDirector() ||
821
+ this.isHeadAdjuster(),
822
+ };
823
+ };
824
+ }