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

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 +89 -69
  2. package/components/Complex/TextBlock.vue +2 -0
  3. package/components/Dialog/Dialog.vue +2 -0
  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 +1 -0
  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 +2 -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 +1 -0
  19. package/components/Pages/Auth.vue +2 -0
  20. package/components/Pages/ContragentForm.vue +1 -0
  21. package/components/Pages/Documents.vue +236 -5
  22. package/components/Pages/MemberForm.vue +39 -29
  23. package/components/Pages/ProductConditions.vue +10 -2
  24. package/components/Panel/PanelHandler.vue +8 -1
  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 +74 -41
  29. package/composables/fields.ts +6 -4
  30. package/composables/index.ts +220 -7
  31. package/composables/styles.ts +5 -16
  32. package/configs/pwa.ts +1 -7
  33. package/locales/ru.json +3 -2
  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 +125 -255
  38. package/store/member.store.ts +3 -2
  39. package/tsconfig.json +3 -0
  40. package/types/enum.ts +5 -2
  41. package/types/form.ts +71 -75
  42. package/types/index.ts +852 -882
@@ -1,24 +1,28 @@
1
1
  import { defineStore } from 'pinia';
2
2
  import { rules } from './rules';
3
3
  import { i18n } from '../configs/i18n';
4
- import { Toast, Types, Positions, ToastOptions } from './toast';
5
- import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
4
+ import { Toast, Types as ToastTypes, Positions, ToastOptions } from './toast';
5
+ import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate, RoleController, ProcessController, sanitize } from '../composables';
6
6
  import { DataStoreClass, DocumentItem, Member, Value, CountryValue, PolicyholderActivity, BeneficialOwner, PolicyholderClass } from '../composables/classes';
7
7
  import { ApiClass } from '../api';
8
8
  import { useFormStore } from './form.store';
9
9
  import { AxiosError } from 'axios';
10
- import { PostActions, StoreMembers, Roles, Statuses, MemberCodes, MemberAppCodes, Enums } from '../types/enum';
10
+ import { PostActions, StoreMembers, MemberCodes, MemberAppCodes, CoreEnums } from '../types/enum';
11
+ import type * as Types from '../types';
11
12
  //@ts-ignore
12
13
  import { NCALayerClient } from 'ncalayer-js-client';
13
14
 
14
15
  export const useDataStore = defineStore('data', {
15
16
  state: () => ({
16
17
  ...new DataStoreClass(),
18
+ ...new RoleController(),
19
+ ...new ProcessController(),
17
20
  t: i18n.t,
18
21
  rules: rules,
19
22
  toast: Toast,
20
- toastTypes: Types,
23
+ toastTypes: ToastTypes,
21
24
  toastPositions: Positions,
25
+ sanitize: sanitize,
22
26
  isValidGUID: isValidGUID,
23
27
  router: useRouter(),
24
28
  formStore: useFormStore(),
@@ -30,7 +34,7 @@ export const useDataStore = defineStore('data', {
30
34
  showToaster: (type: 'success' | 'error' | 'warning' | 'info', msg: string, timeout?: number) =>
31
35
  Toast.useToast()(msg, {
32
36
  ...ToastOptions,
33
- type: Types[type.toUpperCase() as keyof typeof Types],
37
+ type: ToastTypes[type.toUpperCase() as keyof typeof ToastTypes],
34
38
  timeout: type === 'error' ? 6000 : typeof timeout === 'number' ? timeout : ToastOptions.timeout,
35
39
  }),
36
40
  }),
@@ -159,22 +163,23 @@ export const useDataStore = defineStore('data', {
159
163
  getUserRoles() {
160
164
  if (this.accessToken && this.user.roles.length === 0) {
161
165
  const decoded = jwtDecode(this.accessToken);
162
- this.user.id = decoded.sub;
163
- this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ? decoded.middleName : ''}`;
164
- const key = getKeyWithPattern(decoded, 'role');
165
- if (key) {
166
- const roles = decoded[key];
167
- if (typeof roles === 'string') {
168
- this.user.roles.push(roles);
169
- } else if (typeof roles === 'object') {
170
- this.user.roles = roles;
166
+ if (decoded) {
167
+ this.user.id = String(decoded.sub);
168
+ this.user.fullName = `${decoded.lastName} ${decoded.firstName} ${decoded.middleName ?? ''}`;
169
+ this.user.code = decoded.code;
170
+ this.user.branchCode = decoded.branchCode;
171
+ const key = getKeyWithPattern(decoded, 'role');
172
+ if (key) {
173
+ const roles = decoded[key as keyof Types.Utils.JwtToken];
174
+ if (typeof roles === 'string') {
175
+ this.user.roles.push(roles);
176
+ } else if (typeof roles === 'object') {
177
+ this.user.roles = roles;
178
+ }
171
179
  }
172
180
  }
173
181
  }
174
182
  },
175
- getUserData() {
176
- return this.accessToken ? jwtDecode(this.accessToken) : null;
177
- },
178
183
  async getUserGroups() {
179
184
  try {
180
185
  this.isLoading = true;
@@ -185,140 +190,17 @@ export const useDataStore = defineStore('data', {
185
190
  this.isLoading = false;
186
191
  }
187
192
  },
188
- isRole(whichRole: keyof typeof Roles) {
189
- if (this.user.roles.length === 0) {
190
- this.getUserRoles();
191
- }
192
- const isRole = this.user.roles.find(i => i === whichRole);
193
- return !!isRole;
194
- },
195
- isInitiator() {
196
- return this.isManager() || this.isAgent() || this.isAgentMycar() || this.isManagerHalykBank() || this.isServiceManager() || this.isAgentAuletti();
197
- },
198
- isManager() {
199
- return this.isRole(constants.roles.Manager);
200
- },
201
- isCompliance() {
202
- return this.isRole(constants.roles.Compliance);
203
- },
204
- isAdmin() {
205
- return this.isRole(constants.roles.Admin);
206
- },
207
- isJurist() {
208
- return this.isRole(constants.roles.Jurist);
209
- },
210
- isAgent() {
211
- return this.isRole(constants.roles.Agent);
212
- },
213
- isManagerHalykBank() {
214
- return this.isRole(constants.roles.ManagerHalykBank);
215
- },
216
- isServiceManager() {
217
- return this.isRole(constants.roles.ServiceManager);
218
- },
219
- isUnderwriter() {
220
- return this.isRole(constants.roles.Underwriter);
221
- },
222
- isActuary() {
223
- return this.isRole(constants.roles.Actuary);
224
- },
225
- isAgentMycar() {
226
- return this.isRole(constants.roles.AgentMycar);
227
- },
228
- isAgentAuletti() {
229
- return this.isRole(constants.roles.AgentAuletti);
230
- },
231
- isAnalyst() {
232
- return this.isRole(constants.roles.Analyst);
233
- },
234
- isUpk() {
235
- return this.isRole(constants.roles.UPK);
236
- },
237
- isUrp() {
238
- return this.isRole(constants.roles.URP);
239
- },
240
- isUsns() {
241
- return this.isRole(constants.roles.USNS);
242
- },
243
- isAccountant() {
244
- return this.isRole(constants.roles.Accountant);
245
- },
246
- isDrn() {
247
- return this.isRole(constants.roles.DRNSJ);
248
- },
249
- isSupport() {
250
- return this.isRole(constants.roles.Support);
251
- },
252
- isFinCenter() {
253
- return this.isRole(constants.roles.FinCenter);
254
- },
255
- isSupervisor() {
256
- return this.isRole(constants.roles.Supervisor);
257
- },
258
- isHeadManager() {
259
- return this.isRole(constants.roles.HeadManager);
260
- },
261
- isBranchDirector() {
262
- return this.isRole(constants.roles.BranchDirector);
263
- },
264
- isUSNSACCINS() {
265
- return this.isRole(constants.roles.USNSACCINS);
266
- },
267
- isDsuio() {
268
- return this.isRole(constants.roles.Dsuio);
269
- },
270
- isAdjuster() {
271
- return this.isRole(constants.roles.Adjuster);
272
- },
273
- isDsoDirector() {
274
- return this.isRole(constants.roles.DsoDirector);
275
- },
276
- isAccountantDirector() {
277
- return this.isRole(constants.roles.AccountantDirector);
278
- },
279
- isProcessEditable(statusCode?: keyof typeof Statuses) {
280
- const getEditibleStatuses = () => {
281
- const defaultStatuses = constants.editableStatuses;
282
- return defaultStatuses;
283
- };
284
- return !!getEditibleStatuses().find(status => status === statusCode);
285
- },
286
- isProcessReturnable(statusCode?: keyof typeof Statuses) {
287
- const getReturnableStatuses = () => {
288
- const defaultStatuses = constants.returnStatementStatuses;
289
- return defaultStatuses;
290
- };
291
- return !!getReturnableStatuses().find(status => status === statusCode);
292
- },
293
- isProcessCancel(statusCode?: keyof typeof Statuses) {
294
- const getCanceleStatuses = () => {
295
- const defaultStatuses = constants.cancelApplicationStatuses;
296
- return defaultStatuses;
297
- };
298
- return !!getCanceleStatuses().find(status => status === statusCode);
299
- },
300
- isProcessReject(statusCode?: keyof typeof Statuses) {
301
- const getRejectStatuses = () => {
302
- const defaultStatuses = constants.rejectApplicationStatuses;
303
- return defaultStatuses;
304
- };
305
- return !!getRejectStatuses().find(status => status === statusCode);
306
- },
307
193
  isTask() {
308
194
  return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
309
195
  },
310
196
  validateAccess() {
311
- try {
312
- const hasAccess = this.hasAccess();
313
- if (this.isAML) return hasAccess.toAML;
314
- if (this.isLKA) return hasAccess.toLKA;
315
- if (this.isEFO) return hasAccess.toEFO;
316
- if (this.isAULETTI) return hasAccess.toAULETTI;
317
- if (this.isLKA_A) return hasAccess.toLKA_A;
318
- return false;
319
- } catch (err) {
320
- return ErrorHandler(err);
321
- }
197
+ const hasAccess = this.hasAccess();
198
+ if (this.isAML) return hasAccess.toAML;
199
+ if (this.isLKA) return hasAccess.toLKA;
200
+ if (this.isEFO) return hasAccess.toEFO;
201
+ if (this.isAULETTI) return hasAccess.toAULETTI;
202
+ if (this.isLKA_A) return hasAccess.toLKA_A;
203
+ return false;
322
204
  },
323
205
  async loginUser(login: string, password: string, numAttempt: number) {
324
206
  try {
@@ -383,7 +265,7 @@ export const useDataStore = defineStore('data', {
383
265
  return false;
384
266
  }
385
267
  },
386
- async resetSelected(route: RouteType) {
268
+ async resetSelected(route: Types.RouteType) {
387
269
  this.settings.open = false;
388
270
  this.rightPanel.open = false;
389
271
  this.panel.open = false;
@@ -488,7 +370,7 @@ export const useDataStore = defineStore('data', {
488
370
  if (Number(id) === 0) return;
489
371
  this.isLoading = load;
490
372
  try {
491
- const member = whichIndex === null ? this.formStore[whichForm as SingleMember] : this.formStore[whichForm as MultipleMember][whichIndex];
373
+ const member = whichIndex === null ? this.formStore[whichForm as Types.SingleMember] : this.formStore[whichForm as Types.MultipleMember][whichIndex];
492
374
  const contragentResponse = await this.api.getContragentById(id);
493
375
  if (contragentResponse.totalItems > 0) {
494
376
  await this.serializeContragentData(member, contragentResponse.items[0]);
@@ -501,7 +383,7 @@ export const useDataStore = defineStore('data', {
501
383
  this.isLoading = false;
502
384
  }
503
385
  },
504
- async serializeContragentData(member: Member, contragent: ContragentType) {
386
+ async serializeContragentData(member: Member, contragent: Types.ContragentType) {
505
387
  const [questionairesResponse, contactsResponse, documentsResponse, addressResponse] = await Promise.allSettled([
506
388
  this.api.getContrAgentData(contragent.id),
507
389
  this.api.getContrAgentContacts(contragent.id),
@@ -533,7 +415,13 @@ export const useDataStore = defineStore('data', {
533
415
  },
534
416
  parseContragent(
535
417
  member: Member,
536
- user: { personalData: ContragentType; data?: ContragentQuestionaries[]; contacts?: ContragentContacts[]; documents?: ContragentDocuments[]; address?: ContragentAddress[] },
418
+ user: {
419
+ personalData: Types.ContragentType;
420
+ data?: Types.ContragentQuestionaries[];
421
+ contacts?: Types.ContragentContacts[];
422
+ documents?: Types.ContragentDocuments[];
423
+ address?: Types.ContragentAddress[];
424
+ },
537
425
  ) {
538
426
  member.verifyType = user.personalData.verifyType;
539
427
  member.verifyDate = user.personalData.verifyDate;
@@ -556,7 +444,7 @@ export const useDataStore = defineStore('data', {
556
444
 
557
445
  if ('documents' in user && user.documents && user.documents.length) {
558
446
  member.documentsList = user.documents;
559
- const documentByPriority = user.documents.find(i => i.type === Enums.Insis.DocTypes['1UDL']);
447
+ const documentByPriority = user.documents.find(i => i.type === CoreEnums.Insis.DocTypes['1UDL']);
560
448
  const userDocument = documentByPriority ? documentByPriority : user.documents[0];
561
449
  const documentType = this.documentTypes.find((i: Value) => i.ids === userDocument.type);
562
450
  const documentIssuer = this.documentIssuers.find((i: Value) => i.nameRu === userDocument.issuerNameRu);
@@ -615,7 +503,7 @@ export const useDataStore = defineStore('data', {
615
503
  });
616
504
  }
617
505
  },
618
- searchFromList(member: Member, searchIt: ContragentQuestionaries) {
506
+ searchFromList(member: Member, searchIt: Types.ContragentQuestionaries) {
619
507
  const getQuestionariesData = () => {
620
508
  switch (searchIt.questId) {
621
509
  case '500003':
@@ -638,7 +526,7 @@ export const useDataStore = defineStore('data', {
638
526
  if (qData && qData.from && qData.from.length && qData.field) {
639
527
  const qResult = qData.from.find((i: Value) => i.ids === searchIt.questAnswer);
640
528
  //@ts-ignore
641
- member[qData.field] = qResult ? qResult : new Value();
529
+ member[qData.field] = qResult ?? new Value();
642
530
  }
643
531
  },
644
532
  async alreadyInInsis(member: Member) {
@@ -723,7 +611,7 @@ export const useDataStore = defineStore('data', {
723
611
  }
724
612
  }
725
613
  try {
726
- const contragentData: ContragentType = {
614
+ const contragentData: Types.ContragentType = {
727
615
  id: Number(user.id),
728
616
  type: Number(user.type),
729
617
  iin: user.iin!.replace(/-/g, ''),
@@ -753,7 +641,7 @@ export const useDataStore = defineStore('data', {
753
641
  countryOfTaxResidency,
754
642
  signOfResidency,
755
643
  }))(user);
756
- const questionariesData: ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
644
+ const questionariesData: Types.ContragentQuestionaries[] = Object.values(userQuestionnaires).map(question => {
757
645
  let questName = '';
758
646
  let questionId = parseInt(question.ids as string).toString();
759
647
  if (questionId === '500003') {
@@ -821,7 +709,7 @@ export const useDataStore = defineStore('data', {
821
709
  }
822
710
 
823
711
  const userResponseContacts = 'response' in user && user.response && 'contacts' in user.response && user.response.contacts ? user.response.contacts : null;
824
- const contactsData: ContragentContacts[] = [];
712
+ const contactsData: Types.ContragentContacts[] = [];
825
713
  if (!!user.phoneNumber) {
826
714
  contactsData.push({
827
715
  contragentId: Number(user.id),
@@ -863,7 +751,7 @@ export const useDataStore = defineStore('data', {
863
751
 
864
752
  const documentsData = user.documentsList;
865
753
  const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
866
- const userDocument: ContragentDocuments = {
754
+ const userDocument: Types.ContragentDocuments = {
867
755
  contragentId: Number(user.id),
868
756
  id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
869
757
  description: null,
@@ -888,7 +776,7 @@ export const useDataStore = defineStore('data', {
888
776
 
889
777
  const checkForNull = (value: any) => (value ? value : '');
890
778
  const userResponseAddress = 'response' in user && user.response && 'addresses' in user.response && user.response.addresses ? user.response.addresses : null;
891
- const addressData: ContragentAddress[] = [];
779
+ const addressData: Types.ContragentAddress[] = [];
892
780
  addressData.push({
893
781
  id: userResponseAddress !== null ? userResponseAddress[0].id : 0,
894
782
  contragentId: Number(user.id),
@@ -1085,8 +973,8 @@ export const useDataStore = defineStore('data', {
1085
973
  },
1086
974
  getConditionsData() {
1087
975
  const conditionsData: {
1088
- policyAppDto: PolicyAppDto;
1089
- addCoversDto: AddCover[];
976
+ policyAppDto: Types.PolicyAppDto;
977
+ addCoversDto: Types.AddCover[];
1090
978
  } = {
1091
979
  policyAppDto: {
1092
980
  id: this.formStore.applicationData?.policyAppDto?.id,
@@ -1214,7 +1102,7 @@ export const useDataStore = defineStore('data', {
1214
1102
  }
1215
1103
  return this.formStore.definedAnswersId[whichSurvey];
1216
1104
  },
1217
- async setSurvey(data: AnketaFirst) {
1105
+ async setSurvey(data: Types.AnketaFirst) {
1218
1106
  try {
1219
1107
  this.isLoading = true;
1220
1108
  const anketaToken = await this.api.setSurvey(data);
@@ -1228,7 +1116,7 @@ export const useDataStore = defineStore('data', {
1228
1116
  },
1229
1117
  async setINSISWorkData(loading: boolean = true) {
1230
1118
  if (!this.formStore.applicationData.insisWorkDataApp) return;
1231
- const data: InsisWorkDataApp = {
1119
+ const data: Types.InsisWorkDataApp = {
1232
1120
  id: this.formStore.applicationData.insisWorkDataApp.id,
1233
1121
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
1234
1122
  agentId: Number(this.formStore.AgentData.agentId),
@@ -1658,7 +1546,7 @@ export const useDataStore = defineStore('data', {
1658
1546
  column: column,
1659
1547
  direction: direction,
1660
1548
  groupCode: groupCode,
1661
- processCodes: Object.values(constants.products),
1549
+ processCodes: this.isEFO ? Object.values(constants.products) : [constants.products.baiterek],
1662
1550
  };
1663
1551
  if (byOneProcess !== null) {
1664
1552
  delete query.processCodes;
@@ -1872,7 +1760,7 @@ export const useDataStore = defineStore('data', {
1872
1760
  return;
1873
1761
  }
1874
1762
  const signDate = formatDate(this.formStore.productConditionsForm.signDate);
1875
- const calculationData: RecalculationDataType & PolicyAppDto = {
1763
+ const calculationData: Types.RecalculationDataType & Types.PolicyAppDto = {
1876
1764
  signDate: signDate ? signDate.toISOString() : undefined,
1877
1765
  birthDate: this.formStore.productConditionsForm.birthDate ? formatDate(this.formStore.productConditionsForm.birthDate)!.toISOString() : undefined,
1878
1766
  gender: Number(this.formStore.productConditionsForm.gender.id),
@@ -2018,7 +1906,7 @@ export const useDataStore = defineStore('data', {
2018
1906
  async calculatePrice(taskId?: string) {
2019
1907
  this.isLoading = true;
2020
1908
  try {
2021
- const priceForm: SetApplicationRequest = {};
1909
+ const priceForm: Types.SetApplicationRequest = {};
2022
1910
  priceForm.insuredAmountId = this.formStore.productConditionsForm.calculatorForm.amount.id;
2023
1911
  priceForm.age = this.formStore.productConditionsForm.calculatorForm.age;
2024
1912
  priceForm.lifeTripCountries = this.formStore.productConditionsForm.calculatorForm.countries!.map(item => item.id as string);
@@ -2065,7 +1953,7 @@ export const useDataStore = defineStore('data', {
2065
1953
  async startApplication(member: Member, processCode?: number) {
2066
1954
  if (!member.iin) return false;
2067
1955
  try {
2068
- const data: StartApplicationType = {
1956
+ const data: Types.StartApplicationType = {
2069
1957
  clientId: member.id,
2070
1958
  iin: member.iin.replace(/-/g, ''),
2071
1959
  longName: member.longName ?? '',
@@ -2356,7 +2244,7 @@ export const useDataStore = defineStore('data', {
2356
2244
  async deleteTask(taskId: string) {
2357
2245
  this.isLoading = true;
2358
2246
  try {
2359
- const data: SendTask = {
2247
+ const data: Types.SendTask = {
2360
2248
  taskId: taskId,
2361
2249
  decision: 'rejectclient',
2362
2250
  comment: 'Клиент отказался',
@@ -2480,7 +2368,7 @@ export const useDataStore = defineStore('data', {
2480
2368
  console.log(err);
2481
2369
  }
2482
2370
  },
2483
- setMembersField(whichForm: SingleMember, whichMember: keyof typeof MemberAppCodes) {
2371
+ setMembersField(whichForm: Types.SingleMember, whichMember: keyof typeof MemberAppCodes) {
2484
2372
  this.formStore[whichForm].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember].familyStatusId);
2485
2373
  this.formStore[whichForm].signOfIPDL = this.findObject(
2486
2374
  'ipdl',
@@ -2507,7 +2395,7 @@ export const useDataStore = defineStore('data', {
2507
2395
  this.formStore.applicationData.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
2508
2396
  }
2509
2397
  },
2510
- setMembersFieldIndex(whichForm: MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
2398
+ setMembersFieldIndex(whichForm: Types.MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
2511
2399
  if ('familyStatus' in this.formStore[whichForm][index]) {
2512
2400
  this.formStore[whichForm][index].familyStatus = this.findObject('familyStatuses', 'id', this.formStore.applicationData[whichMember][index].familyStatusId);
2513
2401
  }
@@ -2543,7 +2431,7 @@ export const useDataStore = defineStore('data', {
2543
2431
  if (this.formStore.signUrls.length) {
2544
2432
  return this.formStore.signUrls;
2545
2433
  }
2546
- const prepareSignDocuments = (): SignDataType[] => {
2434
+ const prepareSignDocuments = (): Types.SignDataType[] => {
2547
2435
  switch (this.formStore.applicationData.statusCode) {
2548
2436
  case 'ContractSignedFrom':
2549
2437
  return [
@@ -2758,7 +2646,7 @@ export const useDataStore = defineStore('data', {
2758
2646
  try {
2759
2647
  this.isButtonsLoading = true;
2760
2648
  this.formStore.needToScanSignedContract = true;
2761
- const data: SignDataType = {
2649
+ const data: Types.SignDataType = {
2762
2650
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
2763
2651
  name: 'Contract',
2764
2652
  format: 'pdf',
@@ -2814,7 +2702,7 @@ export const useDataStore = defineStore('data', {
2814
2702
  const formattedData = formatDate(this.formStore.finCenterData.date);
2815
2703
  if (!formattedData) return;
2816
2704
  this.isLoading = true;
2817
- const data: RegNumberDataType = {
2705
+ const data: Types.RegNumberDataType = {
2818
2706
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
2819
2707
  regNumber: String(this.formStore.finCenterData.regNumber),
2820
2708
  date: formattedData.toISOString(),
@@ -2829,7 +2717,7 @@ export const useDataStore = defineStore('data', {
2829
2717
  },
2830
2718
  async sendSMS(type: 'SignUrl' | 'PayUrl', phoneNumber: string, text: string) {
2831
2719
  if (!type || !phoneNumber || !text) return;
2832
- const smsData: SmsDataType = {
2720
+ const smsData: Types.SmsDataType = {
2833
2721
  iin: this.formStore.applicationData.clientApp.iin,
2834
2722
  phoneNumber: formatPhone(phoneNumber),
2835
2723
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
@@ -2846,12 +2734,6 @@ export const useDataStore = defineStore('data', {
2846
2734
  this.isLoading = false;
2847
2735
  }
2848
2736
  },
2849
- sanitize(text: string) {
2850
- return text
2851
- .replace(/\r?\n|\r/g, '')
2852
- .replace(/\\/g, '')
2853
- .replace(/"/g, '');
2854
- },
2855
2737
  async getSignedDocList(processInstanceId: string | number) {
2856
2738
  if (processInstanceId !== 0) {
2857
2739
  try {
@@ -2895,7 +2777,7 @@ export const useDataStore = defineStore('data', {
2895
2777
  }
2896
2778
  this.isLoading = false;
2897
2779
  },
2898
- async getValidateClientESBD(data: ESBDValidationType) {
2780
+ async getValidateClientESBD(data: Types.ESBDValidationType) {
2899
2781
  try {
2900
2782
  return await this.api.getValidateClientESBD(data);
2901
2783
  } catch (err) {
@@ -2903,7 +2785,7 @@ export const useDataStore = defineStore('data', {
2903
2785
  return ErrorHandler(err);
2904
2786
  }
2905
2787
  },
2906
- validateMultipleMembers(localKey: MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
2788
+ validateMultipleMembers(localKey: Types.MultipleMember, applicationKey: keyof typeof this.formStore.applicationData, text: string) {
2907
2789
  if (this.formStore[localKey].length === this.formStore.applicationData[applicationKey].length) {
2908
2790
  if (this.formStore[localKey].length !== 0 && this.formStore.applicationData[applicationKey].length !== 0) {
2909
2791
  const localMembers = [...this.formStore[localKey]].sort((a, b) => Number(a.id) - Number(b.id));
@@ -2940,6 +2822,9 @@ export const useDataStore = defineStore('data', {
2940
2822
  return true;
2941
2823
  },
2942
2824
  async validateAllMembers(taskId: string, localCheck: boolean = false) {
2825
+ const policyholderDoc = this.formStore.signedDocumentList.find(
2826
+ i => i.iin === String(this.formStore.policyholderForm.iin).replaceAll('-', '') && (i.fileTypeCode === '1' || i.fileTypeCode === '2'),
2827
+ );
2943
2828
  if (taskId === '0') {
2944
2829
  this.showToaster('error', this.t('toaster.needToRunStatement'), 2000);
2945
2830
  return false;
@@ -2948,6 +2833,10 @@ export const useDataStore = defineStore('data', {
2948
2833
  this.showToaster('error', this.t('toaster.notSavedMember', { text: 'страхователя' }), 3000);
2949
2834
  return false;
2950
2835
  }
2836
+ if (this.isInitiator() && this.isEfoParent && this.formStore.policyholderForm.iin && !policyholderDoc) {
2837
+ this.showToaster('error', this.t('toaster.needDigDoc', { text: 'страхователя' }));
2838
+ return false;
2839
+ }
2951
2840
  if (this.members.insuredApp.has) {
2952
2841
  if (this.validateMultipleMembers(this.formStore.insuredFormKey, 'insuredApp', 'застрахованных') === false) {
2953
2842
  return false;
@@ -3243,13 +3132,16 @@ export const useDataStore = defineStore('data', {
3243
3132
  if (!this.accessToken) return null;
3244
3133
  try {
3245
3134
  const decoded = jwtDecode(this.accessToken);
3246
- const data = {
3247
- userName: decoded.code,
3248
- branchName: decoded.branchCode,
3249
- bin: bin.replace(/-/g, ''),
3250
- };
3251
- const gbdulResponse = await this.api.getGbdUl(data);
3252
- return gbdulResponse;
3135
+ if (decoded) {
3136
+ const data = {
3137
+ userName: decoded.code,
3138
+ branchName: decoded.branchCode,
3139
+ bin: bin.replace(/-/g, ''),
3140
+ };
3141
+ const gbdulResponse = await this.api.getGbdUl(data);
3142
+ return gbdulResponse;
3143
+ }
3144
+ return null;
3253
3145
  } catch (err) {
3254
3146
  return ErrorHandler(err);
3255
3147
  }
@@ -3299,7 +3191,7 @@ export const useDataStore = defineStore('data', {
3299
3191
  this.isLoading = false;
3300
3192
  return false;
3301
3193
  }
3302
- const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Api.GBD.Person };
3194
+ const { person } = parseXML(gbdResponse.content, true, 'person') as { person: Types.Api.GBD.Person };
3303
3195
  const { responseInfo } = parseXML(gbdResponse.content, true, 'responseInfo');
3304
3196
  if (member.gosPersonData !== null && member.gosPersonData.iin !== member.iin!.replace(/-/g, '')) {
3305
3197
  member.resetMember(false);
@@ -3316,7 +3208,7 @@ export const useDataStore = defineStore('data', {
3316
3208
  this.isLoading = false;
3317
3209
  }
3318
3210
  },
3319
- async saveInStoreUserGBDFL(person: Api.GBD.Person, member: Member) {
3211
+ async saveInStoreUserGBDFL(person: Types.Api.GBD.Person, member: Member) {
3320
3212
  member.firstName = person.name;
3321
3213
  member.lastName = person.surname;
3322
3214
  member.middleName = person.patronymic ? person.patronymic : '';
@@ -3408,14 +3300,15 @@ export const useDataStore = defineStore('data', {
3408
3300
  if (person.regAddress.flat) member.registrationNumberApartment = person.regAddress.flat;
3409
3301
 
3410
3302
  if (Array.isArray(person.documents.document)) {
3411
- const validDocument = person.documents.document.find(
3412
- i =>
3413
- new Date(i.endDate) > new Date(Date.now()) &&
3414
- i.status.code === '00' &&
3415
- (i.type.code === Enums.GBD.DocTypes['1UDL'] || i.type.code === Enums.GBD.DocTypes.VNZ || i.type.code === Enums.GBD.DocTypes.PS),
3416
- );
3303
+ const filteredDocuments = person.documents.document.filter(i => new Date(i.endDate) > new Date(Date.now()) && i.status.code === '00');
3304
+ const validDocument =
3305
+ filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes['1UDL']) ??
3306
+ filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.VNZ) ??
3307
+ filteredDocuments.find(i => i.type.code === CoreEnums.GBD.DocTypes.PS);
3417
3308
  if (validDocument) {
3418
- const documentType = this.documentTypes.find((i: Value) => i.ids === Object.keys(Enums.GBD.DocTypes)[Object.values(Enums.GBD.DocTypes).indexOf(validDocument.type.code)]);
3309
+ const documentType = this.documentTypes.find(
3310
+ (i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(validDocument.type.code)],
3311
+ );
3419
3312
  if (documentType) member.documentType = documentType;
3420
3313
  if (validDocument.number) member.documentNumber = validDocument.number;
3421
3314
  if (validDocument.beginDate) member.documentDate = reformatDate(validDocument.beginDate);
@@ -3428,9 +3321,11 @@ export const useDataStore = defineStore('data', {
3428
3321
  if (
3429
3322
  personDoc.status.code === '00' &&
3430
3323
  new Date(personDoc.endDate) > new Date(Date.now()) &&
3431
- (personDoc.type.code === Enums.GBD.DocTypes['1UDL'] || personDoc.type.code === Enums.GBD.DocTypes.VNZ || personDoc.type.code === Enums.GBD.DocTypes.PS)
3324
+ (personDoc.type.code === CoreEnums.GBD.DocTypes['1UDL'] || personDoc.type.code === CoreEnums.GBD.DocTypes.VNZ || personDoc.type.code === CoreEnums.GBD.DocTypes.PS)
3432
3325
  ) {
3433
- const documentType = this.documentTypes.find((i: Value) => i.ids === Object.keys(Enums.GBD.DocTypes)[Object.values(Enums.GBD.DocTypes).indexOf(personDoc.type.code)]);
3326
+ const documentType = this.documentTypes.find(
3327
+ (i: Value) => i.ids === Object.keys(CoreEnums.GBD.DocTypes)[Object.values(CoreEnums.GBD.DocTypes).indexOf(personDoc.type.code)],
3328
+ );
3434
3329
  if (documentType) member.documentType = documentType;
3435
3330
  const documentNumber = personDoc.number;
3436
3331
  if (documentNumber) member.documentNumber = documentNumber;
@@ -3478,7 +3373,6 @@ export const useDataStore = defineStore('data', {
3478
3373
  'clientData.authoritedPerson.economySectorCode',
3479
3374
  'clientData.authoritedPerson.legalAddress',
3480
3375
  'clientData.authoritedPerson.placeOfBirth',
3481
- 'clientData.authoritedPerson.resident',
3482
3376
  'clientData.authoritedPerson.taxResidentCountry',
3483
3377
  'clientData.authoritedPerson.addTaxResidency',
3484
3378
  ]);
@@ -3601,7 +3495,7 @@ export const useDataStore = defineStore('data', {
3601
3495
  }
3602
3496
  this.isLoading = false;
3603
3497
  },
3604
- async saveAccidentIncidents(data: AccidentIncidents[]) {
3498
+ async saveAccidentIncidents(data: Types.AccidentIncidents[]) {
3605
3499
  try {
3606
3500
  const dataCopy = JSON.parse(JSON.stringify(data));
3607
3501
  for (const incident of dataCopy) {
@@ -3795,6 +3689,33 @@ export const useDataStore = defineStore('data', {
3795
3689
 
3796
3690
  return true;
3797
3691
  },
3692
+ async onlineAccess(iin: string, documentType: string) {
3693
+ try {
3694
+ const data = {
3695
+ iinBin: iin.replaceAll('-', ''),
3696
+ documentType: documentType,
3697
+ };
3698
+ await this.api.externalServices.onlineAccess(data);
3699
+ return true;
3700
+ } catch (err) {
3701
+ ErrorHandler(err);
3702
+ return null;
3703
+ }
3704
+ },
3705
+ async digitalDocuments(iin: string, processInstanceId: string, code: string) {
3706
+ try {
3707
+ const data = {
3708
+ iin: iin.replaceAll('-', ''),
3709
+ processInstanceId: processInstanceId,
3710
+ code: code.replace(/\s/g, ''),
3711
+ };
3712
+ await this.api.externalServices.digitalDocuments(data);
3713
+ return true;
3714
+ } catch (err) {
3715
+ ErrorHandler(err);
3716
+ return null;
3717
+ }
3718
+ },
3798
3719
  async getVariableData(processCode: number) {
3799
3720
  try {
3800
3721
  const response = await this.api.getVariableData(0, processCode);
@@ -3832,7 +3753,7 @@ export const useDataStore = defineStore('data', {
3832
3753
  return ErrorHandler(err);
3833
3754
  }
3834
3755
  },
3835
- async generateShortLink(url: string, template?: Api.GenerateShortLink.Templates) {
3756
+ async generateShortLink(url: string, template?: Types.Api.GenerateShortLink.Templates) {
3836
3757
  try {
3837
3758
  const response = await this.api.generateShortLink({
3838
3759
  link: url,
@@ -3856,7 +3777,7 @@ export const useDataStore = defineStore('data', {
3856
3777
  }
3857
3778
  },
3858
3779
  hasBirthSection(whichForm: keyof typeof StoreMembers) {
3859
- if (this.isGons || this.isPension) return false;
3780
+ if (this.isPension) return false;
3860
3781
  switch (whichForm) {
3861
3782
  case this.formStore.beneficiaryFormKey:
3862
3783
  return false;
@@ -3864,18 +3785,6 @@ export const useDataStore = defineStore('data', {
3864
3785
  return true;
3865
3786
  }
3866
3787
  },
3867
- hasPlaceSection(whichForm: keyof typeof StoreMembers) {
3868
- switch (whichForm) {
3869
- default:
3870
- return true;
3871
- }
3872
- },
3873
- hasDocumentSection(whichForm: keyof typeof StoreMembers) {
3874
- switch (whichForm) {
3875
- default:
3876
- return true;
3877
- }
3878
- },
3879
3788
  hasContactSection(whichForm: keyof typeof StoreMembers) {
3880
3789
  if (this.isGons || this.isPension) return false;
3881
3790
  switch (whichForm) {
@@ -3912,44 +3821,5 @@ export const useDataStore = defineStore('data', {
3912
3821
  return false;
3913
3822
  }
3914
3823
  },
3915
- hasPercentageOfPayoutAmount() {
3916
- return true;
3917
- },
3918
- hasAccess() {
3919
- const baseAccessRoles = this.isAdmin() || this.isSupport() || this.isAnalyst() || this.isDrn();
3920
- return {
3921
- invoiceInfo: this.isAdmin(),
3922
- toLKA: this.isAgent() || baseAccessRoles,
3923
- toAML: this.isCompliance() || baseAccessRoles,
3924
- toAULETTI: this.isAgentAuletti() || baseAccessRoles,
3925
- toLKA_A: this.isAgentAuletti() || baseAccessRoles,
3926
- toEFO:
3927
- this.isManager() ||
3928
- this.isAgent() ||
3929
- this.isAgentMycar() ||
3930
- this.isManagerHalykBank() ||
3931
- this.isHeadManager() ||
3932
- this.isServiceManager() ||
3933
- this.isUnderwriter() ||
3934
- this.isActuary() ||
3935
- this.isAdmin() ||
3936
- this.isCompliance() ||
3937
- this.isAnalyst() ||
3938
- this.isUpk() ||
3939
- this.isFinCenter() ||
3940
- this.isSupervisor() ||
3941
- this.isSupport() ||
3942
- this.isDrn() ||
3943
- this.isUrp() ||
3944
- this.isUsns() ||
3945
- this.isAccountant() ||
3946
- this.isBranchDirector() ||
3947
- this.isUSNSACCINS() ||
3948
- this.isDsuio() ||
3949
- this.isAdjuster() ||
3950
- this.isDsoDirector() ||
3951
- this.isAccountantDirector(),
3952
- };
3953
- },
3954
3824
  },
3955
3825
  });