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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/api/base.api.ts +1042 -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 +43 -7
  16. package/components/Input/DynamicInput.vue +23 -0
  17. package/components/Input/FileInput.vue +25 -5
  18. package/components/Input/FormInput.vue +7 -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 +18 -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 +50 -9
  33. package/components/Pages/ContragentForm.vue +124 -50
  34. package/components/Pages/Documents.vue +179 -29
  35. package/components/Pages/InvoiceInfo.vue +1 -1
  36. package/components/Pages/MemberForm.vue +605 -116
  37. package/components/Pages/ProductAgreement.vue +1 -8
  38. package/components/Pages/ProductConditions.vue +1055 -183
  39. package/components/Panel/PanelHandler.vue +583 -46
  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 +456 -8
  46. package/composables/constants.ts +114 -2
  47. package/composables/fields.ts +328 -0
  48. package/composables/index.ts +270 -19
  49. package/composables/styles.ts +29 -16
  50. package/layouts/default.vue +48 -3
  51. package/locales/ru.json +547 -14
  52. package/package.json +28 -24
  53. package/pages/Token.vue +1 -12
  54. package/plugins/vuetifyPlugin.ts +2 -0
  55. package/store/data.store.ts +1463 -275
  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 +83 -5
  60. package/types/enum.ts +61 -0
  61. package/types/env.d.ts +1 -0
  62. package/types/form.ts +94 -0
  63. package/types/index.ts +259 -23
@@ -2,6 +2,9 @@ import { Actions, PostActions, Roles, Statuses } from '../types/enum';
2
2
 
3
3
  export const constants = Object.freeze({
4
4
  products: {
5
+ pensionannuity: 1,
6
+ pa_refund: 2,
7
+ pa_joint: 4,
5
8
  baiterek: 3,
6
9
  halykmycar: 5,
7
10
  lifetrip: 7,
@@ -9,29 +12,53 @@ export const constants = Object.freeze({
9
12
  liferenta: 9,
10
13
  gons: 10,
11
14
  halykkazyna: 11,
15
+ daskamkorlyk: 13,
12
16
  lifebusiness: 14,
17
+ amuletlife: 15,
18
+ gns: 16,
19
+ prepensionannuity: 18,
13
20
  },
14
21
  amlProducts: {
15
22
  checkcontragent: 1,
16
23
  checkcontract: 2,
17
24
  },
18
- editableStatuses: [Statuses.StartForm, Statuses.EditBeneficiaryForm, Statuses.EditForm],
25
+ extractedProducts: ['dso', 'uu'],
26
+ editableStatuses: [Statuses.StartForm, Statuses.EditBeneficiaryForm, Statuses.EditForm, Statuses.InputDataForm],
19
27
  documentsLinkVisibleStatuses: [
20
28
  Statuses.DocumentsSignedFrom,
29
+ Statuses.DocumentsSignedClientFrom,
21
30
  Statuses.UnderwriterForm,
22
31
  Statuses.AffilationResolutionForm,
23
32
  Statuses.Completed,
24
33
  Statuses.InsurancePremiumOnlinePaid,
25
34
  ],
26
- returnStatementStatuses: [Statuses.DocumentsSignedFrom, Statuses.ContractSignedFrom, Statuses.WaitingInsurancePremiumForm, Statuses.UnderwriterForm],
35
+ returnStatementStatuses: [
36
+ Statuses.DocumentsSignedFrom,
37
+ Statuses.DocumentsSignedClientFrom,
38
+ Statuses.ContractSignedFrom,
39
+ Statuses.WaitingInsurancePremiumForm,
40
+ Statuses.UnderwriterForm,
41
+ Statuses.ApproveForm,
42
+ Statuses.ActuaryForm,
43
+ Statuses.ControllerDpForm,
44
+ Statuses.DsoUsnsForm,
45
+ Statuses.AccountantForm,
46
+ ],
27
47
  cancelApplicationStatuses: [
28
48
  Statuses.StartForm,
29
49
  Statuses.EditForm,
30
50
  Statuses.EditBeneficiaryForm,
31
51
  Statuses.WaitingInsurancePremiumForm,
32
52
  Statuses.DocumentsSignedFrom,
53
+ Statuses.DocumentsSignedClientFrom,
33
54
  Statuses.ContractSignedFrom,
55
+ Statuses.AttachAppContractForm,
56
+ Statuses.PreparationDossierForm,
57
+ Statuses.DsoUsnsForm,
58
+ Statuses.AccountantForm,
59
+ Statuses.ContractSignedByAuthorizedPerson,
34
60
  ],
61
+ rejectApplicationStatuses: [Statuses.StartForm, Statuses.AttachAppContractForm],
35
62
  gbdErrors: ['INVALID', 'TIMEOUT', 'ERROR', 'NOT_FOUND'],
36
63
  roles: Roles,
37
64
  actions: Actions,
@@ -42,4 +69,89 @@ export const constants = Object.freeze({
42
69
  kzt: '₸',
43
70
  usd: '$',
44
71
  },
72
+ documentTypes: {
73
+ statement: 5,
74
+ contract: 6,
75
+ underConclusion: 12,
76
+ complianceFinMonitoring: 14,
77
+ agreement: 19,
78
+ acceptLetter: 22,
79
+ rejectLetter: 23,
80
+ application1: 33,
81
+ insuredsList: 34,
82
+ questionnaireInsured: 35,
83
+ invoicePayment: 36,
84
+ },
85
+ fixInsAmount: [
86
+ {
87
+ code: '500000',
88
+ id: '1',
89
+ nameKz: '500 000',
90
+ nameRu: '500 000',
91
+ ids: '',
92
+ },
93
+ {
94
+ code: '1000000',
95
+ id: '2',
96
+ nameKz: '1 000 000',
97
+ nameRu: '1 000 000',
98
+ ids: '',
99
+ },
100
+ {
101
+ code: '1500000',
102
+ id: '3',
103
+ nameKz: '1 500 000',
104
+ nameRu: '1 500 000',
105
+ ids: '',
106
+ },
107
+ {
108
+ code: '2000000',
109
+ id: '4',
110
+ nameKz: '2 000 000',
111
+ nameRu: '2 000 000',
112
+ ids: '',
113
+ },
114
+ {
115
+ code: '2500000',
116
+ id: '5',
117
+ nameKz: '2 500 000',
118
+ nameRu: '2 500 000',
119
+ ids: '',
120
+ },
121
+ {
122
+ code: '3000000',
123
+ id: '6',
124
+ nameKz: '3 000 000',
125
+ nameRu: '3 000 000',
126
+ ids: '',
127
+ },
128
+ {
129
+ code: '3500000',
130
+ id: '7',
131
+ nameKz: '3 500 000',
132
+ nameRu: '3 500 000',
133
+ ids: '',
134
+ },
135
+ {
136
+ code: '4000000',
137
+ id: '8',
138
+ nameKz: '4 000 000',
139
+ nameRu: '4 000 000',
140
+ ids: '',
141
+ },
142
+ {
143
+ code: '4500000',
144
+ id: '8',
145
+ nameKz: '4 500 000',
146
+ nameRu: '4 500 000',
147
+ ids: '',
148
+ },
149
+ {
150
+ code: '5000000',
151
+ id: '9',
152
+ nameKz: '5 000 000',
153
+ nameRu: '5 000 000',
154
+ ids: '',
155
+ },
156
+ ],
45
157
  });
@@ -0,0 +1,328 @@
1
+ import { i18n } from '../configs/i18n';
2
+ import { FieldTypes } from '../types/form';
3
+ import { ComputedRefWithControl } from '@vueuse/core';
4
+
5
+ const t = i18n.t;
6
+
7
+ export const FieldBase = ({
8
+ label = '',
9
+ placeholder = '',
10
+ readonly = false,
11
+ disabled = false,
12
+ modelValue = null,
13
+ iconName = null,
14
+ rules = [],
15
+ maxLength = null,
16
+ clearable = true,
17
+ hint = undefined,
18
+ suffix = null,
19
+ maska = null,
20
+ key = '',
21
+ fetchFrom = null,
22
+ }: InputBase): InputBase =>
23
+ ({
24
+ label,
25
+ placeholder,
26
+ readonly,
27
+ disabled,
28
+ modelValue,
29
+ iconName,
30
+ rules,
31
+ maxLength,
32
+ clearable,
33
+ hint,
34
+ suffix,
35
+ maska,
36
+ key,
37
+ fetchFrom,
38
+ } as InputBase);
39
+
40
+ export const TextInput = ({ ...rest }: Partial<TextInput>): TextInput => {
41
+ return {
42
+ ...FieldBase(rest),
43
+ type: FieldTypes.TEXT,
44
+ };
45
+ };
46
+
47
+ export const SwitchInput = ({ ...rest }: Partial<SwitchInput>): SwitchInput => {
48
+ return {
49
+ ...FieldBase(rest),
50
+ type: FieldTypes.SWITCH,
51
+ direction: 'horizontal',
52
+ trueValue: null,
53
+ falseValue: null,
54
+ labeling: false,
55
+ };
56
+ };
57
+
58
+ export const NumberInput = ({ ...rest }: Partial<NumberInput>): NumberInput => {
59
+ return {
60
+ ...FieldBase(rest),
61
+ type: FieldTypes.NUMBER,
62
+ };
63
+ };
64
+
65
+ export const dynamic = <T>(obj: T, key: keyof T) => {
66
+ return computed({
67
+ get: () => {
68
+ const value = obj[key];
69
+ if (typeof value === 'object' && value) {
70
+ if ('nameRu' in value) return value.nameRu as any;
71
+ }
72
+ return value;
73
+ },
74
+ set: (val: any) => {
75
+ obj[key] = val;
76
+ },
77
+ });
78
+ };
79
+
80
+ type PersonalDataKeys = 'iin' | 'phoneNumber' | 'lastName' | 'firstName' | 'middleName' | 'citizenship' | 'position' | 'email' | 'gender';
81
+ type PersonalData = Record<PersonalDataKeys, InputType>;
82
+
83
+ type AddressesKeys = 'country' | 'province' | 'regionType' | 'city' | 'quarter' | 'microDistrict' | 'street' | 'houseNumber';
84
+ type Address = Record<AddressesKeys, InputType>;
85
+
86
+ type RepeatedFields = {
87
+ personalData: PersonalData;
88
+ address: Address;
89
+ };
90
+
91
+ export const RepeatedFields: RepeatedFields = {
92
+ personalData: {
93
+ iin: TextInput({
94
+ label: t('form.iin'),
95
+ maska: 'iin',
96
+ }),
97
+ phoneNumber: TextInput({
98
+ label: t('form.phoneNumber'),
99
+ maska: 'phone',
100
+ }),
101
+ lastName: TextInput({
102
+ label: t('form.lastName'),
103
+ }),
104
+ firstName: TextInput({
105
+ label: t('form.firstName'),
106
+ }),
107
+ middleName: TextInput({
108
+ label: t('form.middleName'),
109
+ }),
110
+ citizenship: TextInput({
111
+ label: t('clients.form.citizenship'),
112
+ iconName: 'arrowRight',
113
+ fetchFrom: 'getCountries',
114
+ }),
115
+ position: TextInput({
116
+ label: t('clients.form.namePosition'),
117
+ }),
118
+ email: TextInput({
119
+ label: t('form.email'),
120
+ }),
121
+ gender: TextInput({
122
+ label: t('form.gender'),
123
+ }),
124
+ },
125
+ address: {
126
+ country: TextInput({
127
+ label: t('form.Country'),
128
+ iconName: 'arrowRight',
129
+ fetchFrom: 'getCountries',
130
+ }),
131
+ province: TextInput({
132
+ label: t('form.Province'),
133
+ iconName: 'arrowRight',
134
+ fetchFrom: 'getStates',
135
+ }),
136
+ regionType: TextInput({
137
+ label: t('form.RegionType'),
138
+ iconName: 'arrowRight',
139
+ fetchFrom: 'getLocalityTypes',
140
+ }),
141
+ city: TextInput({
142
+ label: t('form.City'),
143
+ iconName: 'arrowRight',
144
+ fetchFrom: 'getCities',
145
+ }),
146
+ quarter: TextInput({
147
+ label: t('form.Quarter'),
148
+ }),
149
+ microDistrict: TextInput({
150
+ label: t('form.MicroDistrict'),
151
+ }),
152
+ street: TextInput({
153
+ label: t('form.Street'),
154
+ }),
155
+ houseNumber: TextInput({
156
+ label: t('form.NumberHouse'),
157
+ }),
158
+ },
159
+ };
160
+
161
+ export class BaseFields {
162
+ public mutatedList: InputType[] = [];
163
+ public fieldsLength: number = 0;
164
+
165
+ init<T extends keyof RepeatedFields>(sectionName: T, fieldsOrder?: (keyof RepeatedFields[T])[] | null, excludeFields?: (keyof RepeatedFields[T])[] | null): InputType[] {
166
+ const inputsWithDefinedKey = Object.entries(RepeatedFields[sectionName]).map(([key, field]: [string, InputType]) => {
167
+ return { ...field, key };
168
+ });
169
+
170
+ const originalFields = Object.values(RepeatedFields[sectionName]);
171
+
172
+ if (fieldsOrder && !excludeFields) {
173
+ this.fieldsLength = fieldsOrder.length;
174
+ return inputsWithDefinedKey
175
+ .filter((field: InputType) => fieldsOrder.includes(field.key))
176
+ .sort((a: InputType, b: InputType) => {
177
+ return fieldsOrder.indexOf(a.key) - fieldsOrder.indexOf(b.key);
178
+ });
179
+ }
180
+
181
+ if (!fieldsOrder && excludeFields) {
182
+ this.fieldsLength = originalFields.length - excludeFields.length;
183
+ return inputsWithDefinedKey.filter((field: InputType) => !excludeFields.includes(field.key));
184
+ }
185
+
186
+ this.fieldsLength = originalFields.length;
187
+ return originalFields;
188
+ }
189
+
190
+ setModels(modelList: any[]) {
191
+ if (modelList.length !== this.fieldsLength) {
192
+ throw new Error('Invalid v-models');
193
+ } else {
194
+ return this.mutatedList.map((field: InputType, index: number) => {
195
+ return { ...field, modelValue: modelList[index] };
196
+ });
197
+ }
198
+ }
199
+
200
+ getFields<T extends keyof RepeatedFields>(sectionName: T, fieldsOrder?: (keyof RepeatedFields[T])[] | null, excludeFields?: (keyof RepeatedFields[T])[] | null): this {
201
+ this.mutatedList = this.init(sectionName, fieldsOrder, excludeFields);
202
+ return this;
203
+ }
204
+ }
205
+
206
+ export class FormBlockLabel {
207
+ text: string;
208
+ size: LabelSize = 1;
209
+ hideOnMobile: boolean = false;
210
+ constructor(options: { text: string; size?: LabelSize; hideOnMobile?: boolean }) {
211
+ this.text = options.text;
212
+ if (typeof options.size === 'number') this.size = options.size;
213
+ if (typeof options.hideOnMobile === 'boolean') this.hideOnMobile = options.hideOnMobile;
214
+ }
215
+ }
216
+
217
+ export class FormBlock {
218
+ title: string;
219
+ subtitle?: string;
220
+ noValueText?: string;
221
+ headerBtn?: {
222
+ text: string;
223
+ action: () => void;
224
+ showBtn?: ComputedRef;
225
+ };
226
+ labels: FormBlockLabel[];
227
+ data: ComputedRefWithControl<any> | string[][];
228
+ shrinkLabels: boolean = true;
229
+ disabled: ComputedRef;
230
+ show: ComputedRef;
231
+ btn: {
232
+ icon: string;
233
+ showBtn: ComputedRef;
234
+ action: ({ value, index }: { value: any; index: number }) => void;
235
+ };
236
+ constructor(options: {
237
+ title: string;
238
+ subtitle?: string;
239
+ noValueText?: string;
240
+ headerBtn?: { text: string; action: () => void; showBtn?: ComputedRef };
241
+ labels: FormBlockLabel[];
242
+ data: ComputedRefWithControl<any> | string[][];
243
+ shrinkLabels?: boolean;
244
+ disabled?: ComputedRef;
245
+ show?: ComputedRef;
246
+ btn?: { icon?: string; showBtn?: ComputedRef; action: ({ value, index }: { value: any; index: number }) => void };
247
+ }) {
248
+ this.title = options.title;
249
+ if (typeof options.subtitle === 'string') this.subtitle = options.subtitle;
250
+ if (typeof options.noValueText === 'string') this.noValueText = options.noValueText;
251
+ else this.noValueText = t('clients.necessaryFillForm');
252
+ this.labels = options.labels;
253
+ this.data = options.data;
254
+ if (typeof options.shrinkLabels === 'boolean') this.shrinkLabels = options.shrinkLabels;
255
+ if (options.disabled !== undefined) this.disabled = options.disabled;
256
+ else this.disabled = computed(() => false);
257
+ if (options.show !== undefined) this.show = options.show;
258
+ else this.show = computed(() => true);
259
+ if (typeof options.headerBtn === 'object') this.headerBtn = options.headerBtn;
260
+ if (typeof options.btn === 'object') {
261
+ this.btn = { icon: options.btn.icon ?? 'mdi-dots-vertical', showBtn: options.btn.showBtn ?? computed(() => true), action: options.btn.action };
262
+ } else this.btn = { icon: 'mdi-dots-vertical', showBtn: computed(() => true), action: () => {} };
263
+ }
264
+ }
265
+
266
+ export const getFormDataFrom = <T>(
267
+ data: T | T[],
268
+ keys: Array<keyof T>,
269
+ modifiers?: {
270
+ [key in keyof T]?: (val: any) => any;
271
+ },
272
+ ) => {
273
+ const getValuesFromKeys = (member: T) => {
274
+ const each: any[] = [];
275
+ keys.forEach(key => {
276
+ const data = member[key];
277
+ const value = data && typeof data === 'object' && 'nameRu' in data ? (data['nameRu'] as any) : data;
278
+ //@ts-ignore
279
+ each.push(modifiers && modifiers[key] ? modifiers[key](value ?? '') : value);
280
+ });
281
+ return each;
282
+ };
283
+ const getData = () => {
284
+ const result: any[][] = [];
285
+ Array.isArray(data) ? data.forEach(member => result.push(getValuesFromKeys(member))) : result.push(getValuesFromKeys(data));
286
+ return result;
287
+ };
288
+ return computedWithControl(
289
+ () => getData(),
290
+ () => getData(),
291
+ );
292
+ };
293
+
294
+ export const getFormDataDefaults = () => {
295
+ const dataStore = useDataStore();
296
+ const baseFormData = {
297
+ membersLabels: [
298
+ new FormBlockLabel({
299
+ text: dataStore.t('form.fullName'),
300
+ }),
301
+ new FormBlockLabel({
302
+ text: dataStore.t('form.iin'),
303
+ }),
304
+ new FormBlockLabel({
305
+ text: dataStore.t('form.birthDate'),
306
+ }),
307
+ new FormBlockLabel({
308
+ text: dataStore.t('form.gender'),
309
+ hideOnMobile: true,
310
+ }),
311
+ new FormBlockLabel({
312
+ text: dataStore.t('form.Country'),
313
+ hideOnMobile: true,
314
+ }),
315
+ new FormBlockLabel({
316
+ text: dataStore.t('code'),
317
+ hideOnMobile: true,
318
+ }),
319
+ ],
320
+ modifiers: {
321
+ longName: (longName: any) => getFullNameShorted(longName),
322
+ gender: (gender: any) => gender[0],
323
+ birthPlace: (birthPlace: any) => birthPlace.substring(0, 3),
324
+ economySectorCode: (economySectorCode: any) => economySectorCode[0],
325
+ },
326
+ };
327
+ return { ...baseFormData };
328
+ };