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

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 (63) hide show
  1. package/api/base.api.ts +935 -0
  2. package/api/index.ts +2 -620
  3. package/api/interceptors.ts +53 -14
  4. package/components/Button/Btn.vue +2 -2
  5. package/components/Complex/MessageBlock.vue +2 -2
  6. package/components/Complex/Page.vue +1 -1
  7. package/components/Dialog/Dialog.vue +60 -15
  8. package/components/Form/DynamicForm.vue +100 -0
  9. package/components/Form/FormBlock.vue +12 -3
  10. package/components/Form/FormData.vue +110 -0
  11. package/components/Form/FormSection.vue +3 -3
  12. package/components/Form/FormToggle.vue +25 -5
  13. package/components/Form/ManagerAttachment.vue +150 -86
  14. package/components/Form/ProductConditionsBlock.vue +59 -6
  15. package/components/Input/Datepicker.vue +39 -8
  16. package/components/Input/DynamicInput.vue +23 -0
  17. package/components/Input/FileInput.vue +25 -5
  18. package/components/Input/FormInput.vue +2 -4
  19. package/components/Input/Monthpicker.vue +34 -0
  20. package/components/Input/PanelInput.vue +5 -1
  21. package/components/Input/RoundedEmptyField.vue +5 -0
  22. package/components/Input/RoundedSelect.vue +13 -0
  23. package/components/Input/SwitchInput.vue +64 -0
  24. package/components/Input/TextInput.vue +160 -0
  25. package/components/Layout/Drawer.vue +17 -4
  26. package/components/Layout/Header.vue +23 -2
  27. package/components/Layout/Loader.vue +1 -1
  28. package/components/Layout/SettingsPanel.vue +13 -7
  29. package/components/Menu/InfoMenu.vue +35 -0
  30. package/components/Menu/MenuNav.vue +17 -2
  31. package/components/Pages/Anketa.vue +140 -52
  32. package/components/Pages/Auth.vue +42 -7
  33. package/components/Pages/ContragentForm.vue +124 -50
  34. package/components/Pages/Documents.vue +72 -7
  35. package/components/Pages/InvoiceInfo.vue +1 -1
  36. package/components/Pages/MemberForm.vue +369 -100
  37. package/components/Pages/ProductAgreement.vue +1 -8
  38. package/components/Pages/ProductConditions.vue +888 -181
  39. package/components/Panel/PanelHandler.vue +414 -45
  40. package/components/Panel/PanelSelectItem.vue +17 -2
  41. package/components/Panel/RightPanelCloser.vue +7 -0
  42. package/components/Transitions/Animation.vue +28 -0
  43. package/components/Utilities/Qr.vue +44 -0
  44. package/composables/axios.ts +1 -0
  45. package/composables/classes.ts +433 -8
  46. package/composables/constants.ts +102 -2
  47. package/composables/fields.ts +328 -0
  48. package/composables/index.ts +257 -12
  49. package/composables/styles.ts +29 -16
  50. package/layouts/default.vue +48 -3
  51. package/locales/ru.json +480 -14
  52. package/package.json +27 -24
  53. package/pages/Token.vue +1 -12
  54. package/plugins/vuetifyPlugin.ts +2 -0
  55. package/store/data.store.ts +1190 -248
  56. package/store/extractStore.ts +17 -0
  57. package/store/form.store.ts +13 -1
  58. package/store/member.store.ts +1 -1
  59. package/store/rules.ts +66 -5
  60. package/types/enum.ts +43 -0
  61. package/types/env.d.ts +1 -0
  62. package/types/form.ts +94 -0
  63. package/types/index.ts +254 -21
@@ -0,0 +1,17 @@
1
+ import type { PiniaCustomStateProperties, StoreActions, StoreGeneric, StoreGetters, StoreState } from 'pinia';
2
+ import type { ToRefs } from 'vue';
3
+ import { isReactive, isRef, toRaw, toRef } from 'vue';
4
+ type Extracted<SS> = ToRefs<StoreState<SS> & StoreGetters<SS> & PiniaCustomStateProperties<StoreState<SS>>> & StoreActions<SS>;
5
+ export function extractStore<SS extends StoreGeneric>(store: SS): Extracted<SS> {
6
+ const rawStore = toRaw(store);
7
+ const refs: Record<string, unknown> = {};
8
+
9
+ for (const [key, value] of Object.entries(rawStore)) {
10
+ if (isRef(value) || isReactive(value)) {
11
+ refs[key] = toRef(store, key);
12
+ } else if (typeof value === 'function') {
13
+ refs[key] = value;
14
+ }
15
+ }
16
+ return refs as Extracted<SS>;
17
+ }
@@ -1,8 +1,20 @@
1
1
  import { defineStore } from 'pinia';
2
- import { FormStoreClass } from '../composables/classes';
2
+ import { BeneficialOwner, FormStoreClass, PolicyholderActivity } from '../composables/classes';
3
3
 
4
4
  export const useFormStore = defineStore('forms', {
5
5
  state: () => ({
6
6
  ...new FormStoreClass(),
7
7
  }),
8
+ actions: {
9
+ addMember(whichMember: 'policyholder' | 'beneficialOwner') {
10
+ if (whichMember === 'policyholder') {
11
+ this.lfb.policyholderActivities.push(new PolicyholderActivity());
12
+ }
13
+ if (whichMember === 'beneficialOwner') {
14
+ if (this.lfb.beneficialOwners.length !== 3) {
15
+ this.lfb.beneficialOwners.push(new BeneficialOwner());
16
+ }
17
+ }
18
+ },
19
+ },
8
20
  });
@@ -13,7 +13,7 @@ export const useMemberStore = defineStore('members', {
13
13
  formStore: useFormStore(),
14
14
  }),
15
15
  actions: {
16
- isStatementEditible(whichForm: keyof typeof StoreMembers | 'productConditionsForm', showToaster: boolean = false) {
16
+ isStatementEditible(whichForm: keyof typeof StoreMembers | 'productConditionsForm' | 'calculatorForm', showToaster: boolean = false) {
17
17
  if (!this.validateInitiator(false)) return false;
18
18
  if (this.formStore.isDisabled[whichForm as keyof typeof this.formStore.isDisabled] === true) {
19
19
  if (showToaster) this.dataStore.showToaster('error', this.dataStore.t('toaster.viewErrorText'), 2000);
package/store/rules.ts CHANGED
@@ -1,12 +1,15 @@
1
1
  import { i18n } from '../configs/i18n';
2
- import { formatDate } from '../composables';
2
+ import { formatDate, useMask } from '../composables';
3
3
 
4
4
  const t = i18n.t;
5
5
 
6
6
  export const rules = {
7
7
  recalculationMultiply: [(v: any) => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher', { text: '100' })],
8
+ recalculationMultiplyBetween: [(v: any) => (v !== null && v !== '' && v >= 100 && v <= 200) || t('toaster.recalculationMultiplyBetween', { floor: '100', ceil: '200' })],
8
9
  recalculationAdditive: [(v: any) => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween', { floor: '0', ceil: '100' })],
9
10
  required: [(v: any) => !!v || t('rules.required')],
11
+ iik: [(v: any) => v.length === 20 || t('rules.iik')],
12
+ agentCommission: [(v: any) => v <= 50 || t('rules.agentCommission')],
10
13
  objectRequired: [
11
14
  (v: any) => {
12
15
  if (!!v && 'nameRu' in v && v.nameRu != null) {
@@ -15,6 +18,7 @@ export const rules = {
15
18
  return t('rules.required');
16
19
  },
17
20
  ],
21
+ arrayRequired: [(v: any) => (v && v.length > 0) || t('rules.required')],
18
22
  agentDataRequired: [
19
23
  (v: any) => {
20
24
  if (!!v && 'fullName' in v && v.fullName != null) {
@@ -34,12 +38,25 @@ export const rules = {
34
38
  return t('rules.required');
35
39
  },
36
40
  ],
37
- cyrillic: [(v: any) => v === null || /^[\u0400-\u04FF ]+$/.test(v) || t('rules.cyrillic')],
41
+ noResidentOffline: [
42
+ (v: any) => {
43
+ if (!!v && 'nameRu' in v && v.nameRu === 'Нерезидент') {
44
+ return t('rules.noResidentOffline');
45
+ }
46
+ if (!!v && 'nameRu' in v && !!v.nameRu) {
47
+ return true;
48
+ }
49
+ return t('rules.required');
50
+ },
51
+ ],
52
+ cyrillic: [(v: any) => v === null || /^[\u0400-\u04FF -]+$/.test(v) || t('rules.cyrillic')],
53
+ latin: [(v: any) => v === null || /^[a-zA-Z]+$/.test(v) || t('rules.latin')],
54
+ latinAndNumber: [(v: any) => v === null || /^[0-9a-zA-Z]+$/.test(v) || t('rules.latinAndNumber')],
38
55
  cyrillicNonRequired: [
39
56
  (v: any) => {
40
57
  if (!v) return true;
41
58
  else {
42
- return /^[\u0400-\u04FF ]+$/.test(v) || t('rules.cyrillic');
59
+ return /^[\u0400-\u04FF -]+$/.test(v) || t('rules.cyrillic');
43
60
  }
44
61
  },
45
62
  ],
@@ -63,6 +80,8 @@ export const rules = {
63
80
  numbers: [(v: any) => /^[0-9]+$/.test(v) || t('rules.numbers')],
64
81
  numbersSymbols: [(v: any) => /^([0-9])|(\W|_)+$/.test(v) || t('rules.numbersSymbols')],
65
82
  ageExceeds: [(v: any) => v < 50 || t('rules.ageExceeds')],
83
+ ageExceeds80: [(v: any) => v <= 80 || t('rules.ageExceeds80')],
84
+ ageExceeds80ByDate: [(v: any) => Math.abs(new Date(Date.now() - new Date(formatDate(v)!).getTime()).getUTCFullYear() - 1970) <= 80 || t('rules.ageExceeds80')],
66
85
  sums: [
67
86
  (v: any) => {
68
87
  let str = v.replace(/\s/g, '');
@@ -72,6 +91,16 @@ export const rules = {
72
91
  return t('rules.sums');
73
92
  },
74
93
  ],
94
+ planDate: [
95
+ (v: any) => {
96
+ if (new Date(formatDate(v)!) < new Date(Date.now())) return t('rules.planDate');
97
+ if (/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])(-|\.)(0[1-9]|1[0-2])(-|\.)(19[0-9]{2}|20[0-9][0-9])$/.test(v)) {
98
+ return true;
99
+ } else {
100
+ return t('rules.date');
101
+ }
102
+ },
103
+ ],
75
104
  iinRight: [
76
105
  (v: any) => {
77
106
  if (v.length !== useMask().iin.length) {
@@ -96,7 +125,11 @@ export const rules = {
96
125
  date: [
97
126
  (v: any) => {
98
127
  if (v === null || v == '') return true;
99
- if (/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])(-|\.)(0[1-9]|1[0-2])(-|\.)(19[0-9]{2}|20[0-9][0-9])$/.test(v)) {
128
+ if (
129
+ /^(?:(?:(?:(?:0[1-9]|1[0-9]|2[0-8])[\.](?:0[1-9]|1[012]))|(?:(?:29|30|31)[\.](?:0[13578]|1[02]))|(?:(?:29|30)[\.](?:0[4,6,9]|11)))[\.](?:19|[2-3][0-9])\d\d)|(?:29[\.]02[\.](?:19|[2-3][0-9])(?:00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))$/.test(
130
+ v,
131
+ )
132
+ ) {
100
133
  return true;
101
134
  } else {
102
135
  return t('rules.date');
@@ -108,8 +141,13 @@ export const rules = {
108
141
  age18ByDate: [(v: any) => Math.abs(new Date(Date.now() - new Date(formatDate(v)!).getTime()).getUTCFullYear() - 1970) >= 18 || t('rules.age18')],
109
142
  birthDate: [
110
143
  (v: any) => {
144
+ if (v === null || v == '') return true;
111
145
  if (new Date(formatDate(v)!) > new Date(Date.now())) return t('rules.exceedDate');
112
- if (/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])(-|\.)(0[1-9]|1[0-2])(-|\.)(19[0-9]{2}|20[0-9][0-9])$/.test(v)) {
146
+ if (
147
+ /^(?:(?:(?:(?:0[1-9]|1[0-9]|2[0-8])[\.](?:0[1-9]|1[012]))|(?:(?:29|30|31)[\.](?:0[13578]|1[02]))|(?:(?:29|30)[\.](?:0[4,6,9]|11)))[\.](?:19|[2-3][0-9])\d\d)|(?:29[\.]02[\.](?:19|[2-3][0-9])(?:00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))$/.test(
148
+ v,
149
+ )
150
+ ) {
113
151
  return true;
114
152
  } else {
115
153
  return t('rules.date');
@@ -152,6 +190,18 @@ export const rules = {
152
190
  }
153
191
  },
154
192
  ],
193
+ coverPeriodFrom1or5to15: [
194
+ (v: any) => {
195
+ if (v !== null) {
196
+ if (v == 1 || (v >= 5 && v <= 15)) {
197
+ return true;
198
+ }
199
+ return t('productConditionsForm.coverPeriodFrom1or5to15');
200
+ } else {
201
+ return t('productConditionsForm.coverPeriodFrom1or5to15');
202
+ }
203
+ },
204
+ ],
155
205
  requestedSumInsuredMycar: [
156
206
  (v: any) => {
157
207
  if (v !== null) {
@@ -175,6 +225,17 @@ export const rules = {
175
225
  ],
176
226
  policyholderAgeLimit: [(v: any) => v >= 18 || t('rules.policyholderAgeLimit')],
177
227
  beneficiaryAgeLimit: [(v: any) => v <= 15 || t('rules.beneficiaryAgeLimit')],
228
+ dateInPast: [
229
+ (v: any) => {
230
+ const givenDate = new Date(formatDate(v)!);
231
+ const currentDate = new Date();
232
+ if (givenDate.getTime() < currentDate.getTime()) {
233
+ return t('rules.dataInPast');
234
+ } else {
235
+ return true;
236
+ }
237
+ },
238
+ ],
178
239
  guaranteedPeriodLimit(v: any, termAnnuityPayments: any) {
179
240
  if (Number(v) > Number(termAnnuityPayments)) {
180
241
  return t('rules.guaranteedPeriodLimit');
package/types/enum.ts CHANGED
@@ -8,15 +8,46 @@ export enum StoreMembers {
8
8
 
9
9
  export enum Actions {
10
10
  accept = 'accept',
11
+ acceptCustom = 'acceptCustom',
12
+
11
13
  rejectclient = 'rejectclient',
14
+ rejectclientCustom = 'rejectclientCustom',
15
+
12
16
  reject = 'reject',
17
+ rejectCustom = 'rejectCustom',
18
+
13
19
  return = 'return',
20
+ returnCustom = 'returnCustom',
21
+
14
22
  claim = 'claim',
23
+ claimCustom = 'claimCustom',
24
+
15
25
  sign = 'sign',
26
+ signCustom = 'signCustom',
27
+
28
+ signed = 'signed',
29
+ signedCustom = 'signedCustom',
30
+
16
31
  pay = 'pay',
32
+ payCustom = 'payCustom',
33
+
17
34
  register = 'register',
35
+ registerCustom = 'registerCustom',
36
+
18
37
  send = 'send',
38
+ sendCustom = 'sendCustom',
39
+
19
40
  affiliate = 'affiliate',
41
+ affiliateCustom = 'affiliateCustom',
42
+
43
+ chooseSign = 'chooseSign',
44
+ chooseSignCustom = 'chooseSignCustom',
45
+
46
+ choosePay = 'choosePay',
47
+ choosePayCustom = 'choosePayCustom',
48
+
49
+ payed = 'payed',
50
+ payedCustom = 'payedCustom',
20
51
  }
21
52
 
22
53
  export enum PostActions {
@@ -32,6 +63,7 @@ export enum PostActions {
32
63
  Error401 = 'Error401',
33
64
  Error500 = 'Error500',
34
65
  iframeLoaded = 'iframeLoaded',
66
+ goToProject = 'goToProject',
35
67
  }
36
68
 
37
69
  export enum Roles {
@@ -49,6 +81,9 @@ export enum Roles {
49
81
  ManagerHalykBank = 'ManagerHalykBank',
50
82
  ServiceManager = 'ServiceManager',
51
83
  DRNSJ = 'DRNSJ',
84
+ HeadManager = 'HeadManager',
85
+ AgentAuletti = 'AgentAuletti',
86
+ BranchDirector = 'BranchDirector',
52
87
  }
53
88
 
54
89
  export enum Statuses {
@@ -64,6 +99,9 @@ export enum Statuses {
64
99
  WaitingInsurancePremiumForm = 'WaitingInsurancePremiumForm',
65
100
  CheckFinCenterForm = 'CheckFinCenterForm',
66
101
  RegistryFinCenterForm = 'RegistryFinCenterForm',
102
+ DocumentsSignedClientFrom = 'DocumentsSignedClientFrom',
103
+ InputDataForm = 'InputDataForm',
104
+ ApproveForm = 'ApproveForm',
67
105
  }
68
106
 
69
107
  export enum MemberCodes {
@@ -81,3 +119,8 @@ export enum MemberAppCodes {
81
119
  beneficialOwnerApp = 'beneficialOwnerApp',
82
120
  spokesmanApp = 'spokesmanApp',
83
121
  }
122
+
123
+ export enum Methods {
124
+ GET = 'GET',
125
+ POST = 'POST',
126
+ }
package/types/env.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  interface ImportMetaEnv {
4
4
  readonly VITE_MODE: EnvModes;
5
5
  readonly VITE_PRODUCT?: Projects;
6
+ readonly VITE_PARENT_PRODUCT?: 'efo' | 'auletti';
6
7
  }
7
8
 
8
9
  interface ImportMeta {
package/types/form.ts ADDED
@@ -0,0 +1,94 @@
1
+ export {};
2
+
3
+ export enum FieldTypes {
4
+ TEXT = 'text',
5
+ NUMBER = 'number',
6
+ SWITCH = 'switch',
7
+ EMAIL = 'email',
8
+ PASSWORD = 'password',
9
+ FILE = 'file',
10
+ }
11
+
12
+ declare global {
13
+ type InputType = TextInput | NumberInput | FileInput | SwitchInput;
14
+ type FormMasks = 'numbers' | 'iin' | 'otp' | 'phone' | 'date' | 'post' | 'threeDigit' | 'iik';
15
+ type FormIcons = 'arrowRight' | 'search' | 'sms' | null;
16
+ type Suffix = 'kzt' | 'usd' | 'percent' | null;
17
+
18
+ type FetchFunctions =
19
+ | 'getResidents'
20
+ | 'getFamilyStatuses'
21
+ | 'getRelationTypes'
22
+ | 'getCountries'
23
+ | 'getStates'
24
+ | 'getLocalityTypes'
25
+ | 'getRegions'
26
+ | 'getCities'
27
+ | 'getDocumentTypes'
28
+ | 'getTaxCountries'
29
+ | 'getCitizenshipCountries'
30
+ | 'getSectorCodeList'
31
+ | 'getInsurancePay'
32
+ | 'getEconomicActivityType'
33
+ | 'getBanks'
34
+ | 'getDocumentIssuers'
35
+ | 'getGenderList';
36
+
37
+ export interface DynamicForm {
38
+ formRef: any;
39
+ sections: SectionType[];
40
+ fieldOrder?: string[];
41
+ }
42
+
43
+ type InputBase = {
44
+ key?: any;
45
+ modelValue?: any;
46
+ clearable?: boolean;
47
+ label?: string;
48
+ placeholder?: string;
49
+ readonly?: boolean;
50
+ disabled?: boolean;
51
+ arrowRight?: boolean;
52
+ maxLength?: number | null;
53
+ rules?: ValidationRule[];
54
+ iconName?: FormIcons;
55
+ value?: number;
56
+ suffix?: Suffix | null;
57
+ hint?: string | undefined;
58
+ maska?: FormMasks | null;
59
+ fetchFrom?: FetchFunctions | null;
60
+ };
61
+
62
+ type FormControl<T extends InputType> = T & {
63
+ valid: boolean;
64
+ dirty: boolean;
65
+ touched: boolean;
66
+ };
67
+
68
+ type FileInput = InputBase & {
69
+ type: FieldTypes.FILE;
70
+ };
71
+
72
+ type TextInput = InputBase & {
73
+ type: FieldTypes.TEXT;
74
+ };
75
+
76
+ type SwitchInput = InputBase & {
77
+ type: FieldTypes.SWITCH;
78
+ labeling: boolean | null;
79
+ direction: 'horizontal' | 'vertical';
80
+ falseValue: boolean | string | null;
81
+ trueValue: boolean | string | null;
82
+ };
83
+
84
+ type NumberInput = InputBase & {
85
+ type: FieldTypes.NUMBER;
86
+ };
87
+
88
+ type ValidationRule = (value: string) => boolean | string;
89
+
90
+ type SectionType = {
91
+ title?: string;
92
+ fields: InputType[];
93
+ };
94
+ }