hl-core 0.0.10-beta.42 → 0.0.10-beta.44

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.
package/api/base.api.ts CHANGED
@@ -221,6 +221,13 @@ export class ApiClass {
221
221
  });
222
222
  }
223
223
 
224
+ async getQuestionListSecondById(surveyType: string, processInstanceId: string | number, insuredId: number | string, id: string) {
225
+ return await this.axiosCall<Types.AnketaSecond[]>({
226
+ method: Methods.GET,
227
+ url: `/${this.productUrl}/api/Application/Anketa/${surveyType}/${processInstanceId}/${insuredId}/${id}`,
228
+ });
229
+ }
230
+
224
231
  async definedAnswers(filter: string) {
225
232
  return await this.axiosCall({
226
233
  method: Methods.GET,
@@ -1021,6 +1028,17 @@ export class ApiClass {
1021
1028
  });
1022
1029
  }
1023
1030
 
1031
+ async acceptDeclaration(insuredId: string, accept: boolean) {
1032
+ return await this.axiosCall<boolean>({
1033
+ method: Methods.POST,
1034
+ url: `/${this.productUrl}/api/Application/AcceptDeclaration`,
1035
+ params: {
1036
+ insuredId,
1037
+ accept,
1038
+ },
1039
+ });
1040
+ }
1041
+
1024
1042
  async getParentContractData(policyId: string) {
1025
1043
  return await this.axiosCall<{ bin: string; name: string }>({
1026
1044
  method: Methods.GET,
@@ -83,7 +83,7 @@
83
83
  />
84
84
  <div v-if="isPanelLoading === false" class="w-full">
85
85
  <div v-if="currentDictName === 'AgentData'" class="w-full flex flex-col gap-2 p-2">
86
- <div v-for="(agent, index) of $dataStore[currentDictName]" :key="index">
86
+ <div v-for="(agent, index) of agentDataFiltered" :key="index">
87
87
  <div
88
88
  class="flex justify-between p-4 items-center cursor-pointer"
89
89
  :class="[$styles.rounded, $styles.blueBgLight, $styles.blueBgLightHover]"
@@ -199,6 +199,13 @@ export default defineComponent({
199
199
  if (dataStore.isGons) return !dataStore.isAgent();
200
200
  return true;
201
201
  });
202
+ const agentDataFiltered = computed(() => {
203
+ if (formStore.RegionPolicy?.nameRu && searchQuery.value === 'Без агента') {
204
+ return dataStore.AgentData.filter(i => String(i.officeId) === String(formStore.RegionPolicy.ids));
205
+ } else {
206
+ return dataStore.AgentData;
207
+ }
208
+ });
202
209
  const isExecutorShown = dataStore.isPension;
203
210
  const openPanel = async (currentDict: ManagerAttachmentFiels, title: string) => {
204
211
  searchQuery.value = '';
@@ -306,6 +313,7 @@ export default defineComponent({
306
313
  isManagerShown,
307
314
  isAgentShown,
308
315
  isExecutorShown,
316
+ agentDataFiltered,
309
317
 
310
318
  // Functions
311
319
  openPanel,
@@ -55,7 +55,10 @@
55
55
  <base-form-input v-model="insured.gender.nameRu" class="mb-4" :label="$dataStore.t('form.gender')" :readonly="true" />
56
56
  </div>
57
57
  </base-form-section>
58
- <base-form-section v-if="isUnderwriterRole && whichProduct !== 'pensionannuitynew' && whichProduct !== 'balam' && whichProduct !== 'tumar'" :title="$dataStore.t('recalculationInfo')">
58
+ <base-form-section
59
+ v-if="isUnderwriterRole && whichProduct !== 'pensionannuitynew' && whichProduct !== 'balam' && whichProduct !== 'tumar'"
60
+ :title="$dataStore.t('recalculationInfo')"
61
+ >
59
62
  <base-form-input
60
63
  v-model="productConditionsForm.lifeMultiply"
61
64
  :maska="$maska.numbers"
@@ -323,7 +326,7 @@
323
326
  :label="$dataStore.t('productConditionsForm.agencyPart')"
324
327
  :readonly="isDisabledAgentCommission"
325
328
  :clearable="!isDisabledAgentCommission"
326
- :rules="formStore.lfb.add ? $rules.required : $rules.required.concat($rules.numbers, $rules.agentCommission)"
329
+ :rules="!formStore.lfb.add ? $rules.required.concat($rules.numbers, $rules.agentCommission) : productConditionsForm.agentCommission === 0 ? [] : $rules.required"
327
330
  />
328
331
  </base-form-section>
329
332
  <section v-if="whichProduct === 'pensionannuitynew'">
@@ -504,7 +507,7 @@
504
507
  <base-form-input
505
508
  v-model="contractDate"
506
509
  :maska="$maska.date"
507
- :rules="!isDisabled ? $rules.required.concat($rules.date) : []"
510
+ :rules="!isDisabled ? $rules.required.concat($rules.date, [validateContractDate]) : []"
508
511
  :readonly="isDisabled || formStore.applicationData.processCode === 24 || isSlavePensionForm"
509
512
  :clearable="!isDisabled"
510
513
  :min-date="new Date()"
@@ -1838,6 +1841,14 @@ export default defineComponent({
1838
1841
  return formatedContracts;
1839
1842
  };
1840
1843
 
1844
+ const validateContractDate = (v: any) => {
1845
+ if (v && maxDate.value && formatDate(v) && formatDate(maxDate.value)) {
1846
+ const invalidDate = (formatDate(v) ?? new Date()) > (formatDate(maxDate.value) ?? new Date());
1847
+ if (invalidDate) return 'Дата заключения договора некорректна';
1848
+ }
1849
+ return true;
1850
+ };
1851
+
1841
1852
  const submitForm = async () => {
1842
1853
  vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
1843
1854
  if (v.valid) {
@@ -2474,6 +2485,7 @@ export default defineComponent({
2474
2485
  underwriterCalculate,
2475
2486
  onInputInsurancePremiumPerMonth,
2476
2487
  onInputInsurancePremiumPerMonthInDollar,
2488
+ validateContractDate,
2477
2489
  onInputSum,
2478
2490
  onInputPension,
2479
2491
  onInputSumDollar,
@@ -23,8 +23,8 @@
23
23
  >
24
24
  </base-content-block>
25
25
  <div class="flex flex-col gap-3" v-if="hasConditionsAction">
26
- <base-btn :text="$dataStore.t('confirm.yes')" @click="handleTask" />
27
- <base-btn :btn="$styles.blueLightBtn" :text="$dataStore.t('confirm.no')" @click="closePanel" />
26
+ <base-btn :text="$dataStore.t('confirm.yes')" :loading="loading" @click="handleTask" />
27
+ <base-btn :btn="$styles.blueLightBtn" :loading="loading" :text="$dataStore.t('confirm.no')" @click="closePanel" />
28
28
  </div>
29
29
  </div>
30
30
  </section>
@@ -1715,7 +1715,7 @@ export class PhysGroupClass extends BaseGroupClass {
1715
1715
 
1716
1716
  export class GroupMember extends PhysGroupClass {
1717
1717
  isLeader: boolean;
1718
-
1718
+ organizationStartDate: string;
1719
1719
  typeOfEconomicActivity: Value;
1720
1720
  activityTypes: { activityTypeName: string; empoloyeeCount: number }[];
1721
1721
  beneficalOwnerQuest: { order: number; text: string; answer: boolean | null }[];
@@ -1726,6 +1726,7 @@ export class GroupMember extends PhysGroupClass {
1726
1726
  super();
1727
1727
  // Client
1728
1728
  this.isLeader = false;
1729
+ this.organizationStartDate = '';
1729
1730
  this.typeOfEconomicActivity = new Value();
1730
1731
  this.activityTypes = [];
1731
1732
  this.beneficalOwnerQuest = [
@@ -31,7 +31,7 @@ export const constants = Object.freeze({
31
31
  checkcontragent: 1,
32
32
  checkcontract: 2,
33
33
  },
34
- extractedProducts: ['dso', 'uu'],
34
+ extractedProducts: ['dso', 'uu', 'lka'],
35
35
  editableStatuses: [Statuses.StartForm, Statuses.EditBeneficiaryForm, Statuses.EditForm, Statuses.InputDataForm],
36
36
  documentsLinkVisibleStatuses: [
37
37
  Statuses.Completed,
@@ -4,7 +4,7 @@ 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
6
  import { PolicyholderClass, Value, User } from '../composables/classes';
7
- import type { EnvModes, NestedKeyOf, Projects, ResponseStructure, Utils } from '../types';
7
+ import type { EnvModes, NestedKeyOf, Projects, ResponseStructure, Utils, RouteType } from '../types';
8
8
  import { Roles, Statuses } from '../types/enum';
9
9
 
10
10
  export const useEnv = () => {
@@ -468,7 +468,8 @@ type WhichValuePerEnv =
468
468
  | 'efoBaseApi'
469
469
  | 'efoBaseApiLocal'
470
470
  | 'amlBaseApi'
471
- | 'amlBaseApiLocal';
471
+ | 'amlBaseApiLocal'
472
+ | 'lkaUrl';
472
473
 
473
474
  export const getStrValuePerEnv = (which: WhichValuePerEnv) => {
474
475
  const valuesPerEnv: {
@@ -531,6 +532,11 @@ export const getStrValuePerEnv = (which: WhichValuePerEnv) => {
531
532
  development: 'http://aml-dev.halyklife.nb/api',
532
533
  test: 'http://aml-dev.halyklife.nb/api',
533
534
  },
535
+ lkaUrl: {
536
+ production: 'https://dev.lka-web.halyklife.nb/efo',
537
+ development: 'https://dev.lka-web.halyklife.nb/efo',
538
+ test: 'https://dev.lka-web.halyklife.nb/efo',
539
+ },
534
540
  };
535
541
  return valuesPerEnv[which][import.meta.env.VITE_MODE as EnvModes];
536
542
  };
@@ -549,6 +555,83 @@ export const getMainPageRoute = () => {
549
555
  return 'index';
550
556
  };
551
557
 
558
+ export const validateToken = (to: RouteType) => {
559
+ const dataStore = useDataStore();
560
+ if (to.query) {
561
+ if ('token' in to.query) {
562
+ const token = to.query.token as string;
563
+ if (isValidToken(token)) {
564
+ localStorage.setItem('accessToken', token);
565
+ dataStore.accessToken = token;
566
+ dataStore.getUserRoles();
567
+ }
568
+ } else {
569
+ const token = localStorage.getItem('accessToken') || null;
570
+ if (token && isValidToken(token)) {
571
+ dataStore.accessToken = token;
572
+ dataStore.getUserRoles();
573
+ } else {
574
+ dataStore.sendToParent(constants.postActions.toHomePage, dataStore.t('toaster.tokenExpire'));
575
+ }
576
+ }
577
+ }
578
+ };
579
+
580
+ export const validateRoute = (to: RouteType) => {
581
+ const dataStore = useDataStore();
582
+ const token = localStorage.getItem('accessToken') || null;
583
+ if (to && to.meta && 'requiresAuth' in to.meta && to.meta.requiresAuth && (!token || (token && isValidToken(token) === false))) {
584
+ localStorage.clear();
585
+ dataStore.sendToParent(constants.postActions.toHomePage, dataStore.t('toaster.tokenExpire'));
586
+ }
587
+ };
588
+
589
+ export const validateSettingsPanel = () => {
590
+ const dataStore = useDataStore();
591
+ const formStore = useFormStore();
592
+ const hasPanelItem = (id: string) => {
593
+ return !!Object.values(dataStore.settings.items).find(i => i.id === id);
594
+ };
595
+ // Bug in getApplicationData, if there is empty member it didn't update
596
+ // if (!hasPanelItem('reload') && route.params.taskId !== '0') {
597
+ // dataStore.settings.items.push(
598
+ // new MenuItem({
599
+ // id: 'reload',
600
+ // title: dataStore.t('buttons.reload'),
601
+ // icon: 'mdi-reload',
602
+ // action: async () => await dataStore.getApplicationData(route.params.taskId),
603
+ // }),
604
+ // );
605
+ // }
606
+ if (!hasPanelItem('reject') && dataStore.isInitiator()) {
607
+ dataStore.settings.items.push(
608
+ new MenuItem({
609
+ id: 'reject',
610
+ title: dataStore.t('buttons.cancelApplication'),
611
+ icon: 'mdi-close',
612
+ action: () => (dataStore.panelAction = constants.actions.rejectclient),
613
+ show: computed(() => dataStore.isTask() && dataStore.isProcessCancel(formStore.applicationData.statusCode)),
614
+ }),
615
+ );
616
+ }
617
+ if (!hasPanelItem('return') && (dataStore.isInitiator() || dataStore.isUnderwriter())) {
618
+ dataStore.settings.items.push(
619
+ new MenuItem({
620
+ id: 'return',
621
+ title: dataStore.t('buttons.returnStatement'),
622
+ icon: 'mdi-restore',
623
+ action: () => (dataStore.panelAction = constants.actions.return),
624
+ show: computed(() => dataStore.isTask() && dataStore.isProcessReturnable(formStore.applicationData.statusCode)),
625
+ }),
626
+ );
627
+ }
628
+ };
629
+
630
+ export const isIframe = () => {
631
+ if (window.location.hostname !== 'localhost' && useEnv().isProduction) return window.self !== window.top;
632
+ return true;
633
+ };
634
+
552
635
  export const keyDeleter = <T extends object>(data: T, keys: Array<NestedKeyOf<T>>) => {
553
636
  if (typeof data === 'object' && !!data && keys && Array.isArray(keys) && keys.length) {
554
637
  keys.forEach(key => {
@@ -783,6 +866,7 @@ export class RoleController {
783
866
  return {
784
867
  invoiceInfo: this.isAdmin() || this.isSupport(),
785
868
  toLKA: this.isAgent() || this.isManagerHalykBank() || baseAccessRoles,
869
+ toLKAv2: this.isAgent() || this.isManagerHalykBank() || this.isServiceManager() || baseAccessRoles,
786
870
  toAML: this.isCompliance() || baseAccessRoles,
787
871
  toAULETTI: this.isAgentAuletti() || this.isManagerAuletti() || baseAccessRoles,
788
872
  toLKA_A: this.isAgentAuletti() || baseAccessRoles,
@@ -808,14 +892,10 @@ export class RoleController {
808
892
  this.isUSNSsanctioner() ||
809
893
  this.isUnderwriter() ||
810
894
  this.isActuary() ||
811
- this.isAdmin() ||
812
895
  this.isCompliance() ||
813
- this.isAnalyst() ||
814
896
  this.isUpk() ||
815
897
  this.isFinCenter() ||
816
898
  this.isSupervisor() ||
817
- this.isSupport() ||
818
- this.isDrn() ||
819
899
  this.isUrp() ||
820
900
  this.isUsns() ||
821
901
  this.isJurist() ||
@@ -832,7 +912,9 @@ export class RoleController {
832
912
  this.isExecutor() ||
833
913
  this.isArchivist() ||
834
914
  this.isUKP() ||
835
- this.isDpDirector(),
915
+ this.isDpDirector() ||
916
+ this.isSecurity() ||
917
+ baseAccessRoles,
836
918
  };
837
919
  };
838
920
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.10-beta.42",
3
+ "version": "0.0.10-beta.44",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -3680,6 +3680,24 @@ export const useDataStore = defineStore('data', {
3680
3680
  });
3681
3681
  }
3682
3682
  },
3683
+ uniqPreparePersonData(local: GroupMember) {
3684
+ const checkForNull = (value: any) => (value ? value : '');
3685
+ try {
3686
+ (Object.keys(local) as Array<keyof GroupMember>).forEach(key => {
3687
+ if (key === 'actualAddress' || key === 'legalAddress') {
3688
+ const address = `${checkForNull(local[key].country.nameRu)}, ${checkForNull(local[key].state.nameRu)},${
3689
+ local[key].region.nameRu ? ` ${local[key].region.nameRu},` : ''
3690
+ } ${checkForNull(local[key].regionType.nameRu)} ${checkForNull(local[key].city.nameRu)},${local[key].square ? ` квартал ${local[key].square},` : ''}${
3691
+ local[key].microdistrict ? ` мкр ${local[key].microdistrict},` : ''
3692
+ } ул. ${checkForNull(local[key].street)}, д. ${checkForNull(local[key].houseNumber)}`;
3693
+ local[key].longName = address;
3694
+ local[key].longNameKz = address;
3695
+ }
3696
+ });
3697
+ } catch (e) {
3698
+ ErrorHandler(e);
3699
+ }
3700
+ },
3683
3701
  async startApplicationV2(data: PolicyholderClass) {
3684
3702
  const policyholder = JSON.parse(JSON.stringify(data)) as any;
3685
3703
  this.preparePersonData(policyholder);
@@ -3699,6 +3717,7 @@ export const useDataStore = defineStore('data', {
3699
3717
  'clientData.authoritedPerson.addTaxResidency',
3700
3718
  ]);
3701
3719
  policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
3720
+ this.uniqPreparePersonData(policyholder.clientData);
3702
3721
  if (this.formStore.lfb.add) {
3703
3722
  policyholder.parentContractNumber = localStorage.getItem('policyNo');
3704
3723
  policyholder.parentContractId = localStorage.getItem('policyId');
@@ -3715,6 +3734,7 @@ export const useDataStore = defineStore('data', {
3715
3734
  const policyholder = JSON.parse(JSON.stringify(data)) as any;
3716
3735
  policyholder.clientData.authoritedPerson.gender = policyholder.clientData.authoritedPerson.gender.nameRu === 'Мужской' ? 1 : 2;
3717
3736
  this.preparePersonData(policyholder);
3737
+ this.uniqPreparePersonData(policyholder.clientData);
3718
3738
  try {
3719
3739
  await this.api.saveClient(this.formStore.applicationData.processInstanceId, this.formStore.lfb.clientId, policyholder);
3720
3740
  } catch (err) {
@@ -3799,7 +3819,7 @@ export const useDataStore = defineStore('data', {
3799
3819
 
3800
3820
  this.formStore.productConditionsForm.calcDate = reformatDate(applicationData.policyAppDto.calcDate);
3801
3821
  this.formStore.productConditionsForm.contractEndDate = reformatDate(applicationData.policyAppDto.contractEndDate);
3802
- this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission === 0 ? null : applicationData.policyAppDto.agentCommission;
3822
+ this.formStore.productConditionsForm.agentCommission = applicationData.policyAppDto.agentCommission;
3803
3823
  this.formStore.productConditionsForm.fixInsSum = this.getNumberWithSpaces(applicationData.policyAppDto.fixInsSum === 0 ? null : applicationData.policyAppDto.fixInsSum);
3804
3824
  this.formStore.productConditionsForm.coverPeriod = 12;
3805
3825
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(applicationData.policyAppDto.amount === 0 ? null : applicationData.policyAppDto.amount);