hl-core 0.0.9-beta.9 → 0.0.10-beta.2
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 +1109 -0
- package/api/index.ts +2 -620
- package/api/interceptors.ts +38 -1
- package/components/Button/Btn.vue +1 -6
- package/components/Complex/MessageBlock.vue +1 -1
- package/components/Complex/Page.vue +1 -1
- package/components/Complex/TextBlock.vue +23 -0
- package/components/Dialog/Dialog.vue +70 -16
- package/components/Dialog/FamilyDialog.vue +1 -1
- package/components/Form/DynamicForm.vue +100 -0
- package/components/Form/FormBlock.vue +12 -3
- package/components/Form/FormData.vue +110 -0
- package/components/Form/FormSection.vue +3 -3
- package/components/Form/FormTextSection.vue +11 -3
- package/components/Form/FormToggle.vue +25 -5
- package/components/Form/ManagerAttachment.vue +177 -89
- package/components/Form/ProductConditionsBlock.vue +59 -6
- package/components/Input/Datepicker.vue +43 -7
- package/components/Input/DynamicInput.vue +23 -0
- package/components/Input/FileInput.vue +25 -5
- package/components/Input/FormInput.vue +7 -4
- package/components/Input/Monthpicker.vue +34 -0
- package/components/Input/PanelInput.vue +5 -1
- package/components/Input/RoundedSelect.vue +7 -2
- package/components/Input/SwitchInput.vue +64 -0
- package/components/Input/TextInput.vue +160 -0
- package/components/Layout/Drawer.vue +16 -4
- package/components/Layout/Header.vue +23 -2
- package/components/Layout/Loader.vue +2 -1
- package/components/Layout/SettingsPanel.vue +24 -11
- package/components/Menu/InfoMenu.vue +35 -0
- package/components/Menu/MenuNav.vue +25 -3
- package/components/Pages/Anketa.vue +254 -65
- package/components/Pages/Auth.vue +56 -9
- package/components/Pages/ContragentForm.vue +9 -9
- package/components/Pages/Documents.vue +266 -30
- package/components/Pages/InvoiceInfo.vue +1 -1
- package/components/Pages/MemberForm.vue +774 -102
- package/components/Pages/ProductAgreement.vue +1 -8
- package/components/Pages/ProductConditions.vue +1132 -180
- package/components/Panel/PanelHandler.vue +626 -49
- package/components/Panel/PanelSelectItem.vue +17 -2
- package/components/Panel/RightPanelCloser.vue +7 -0
- package/components/Transitions/Animation.vue +28 -0
- package/components/Utilities/JsonViewer.vue +3 -2
- package/components/Utilities/Qr.vue +44 -0
- package/composables/axios.ts +1 -0
- package/composables/classes.ts +501 -14
- package/composables/constants.ts +126 -6
- package/composables/fields.ts +328 -0
- package/composables/index.ts +355 -20
- package/composables/styles.ts +23 -6
- package/configs/pwa.ts +63 -0
- package/layouts/clear.vue +21 -0
- package/layouts/default.vue +62 -3
- package/layouts/full.vue +21 -0
- package/locales/ru.json +558 -16
- package/nuxt.config.ts +11 -15
- package/package.json +37 -39
- package/pages/Token.vue +0 -13
- package/plugins/head.ts +26 -0
- package/plugins/vuetifyPlugin.ts +1 -5
- package/store/data.store.ts +1610 -321
- package/store/extractStore.ts +17 -0
- package/store/form.store.ts +13 -1
- package/store/member.store.ts +1 -1
- package/store/rules.ts +97 -3
- package/store/toast.ts +1 -1
- package/types/enum.ts +81 -0
- package/types/env.d.ts +2 -0
- package/types/form.ts +94 -0
- package/types/index.ts +419 -24
package/composables/constants.ts
CHANGED
|
@@ -2,35 +2,67 @@ import { Actions, PostActions, Roles, Statuses } from '../types/enum';
|
|
|
2
2
|
|
|
3
3
|
export const constants = Object.freeze({
|
|
4
4
|
products: {
|
|
5
|
+
pensionannuity: 1,
|
|
6
|
+
pensionannuityrefund: 2,
|
|
5
7
|
baiterek: 3,
|
|
8
|
+
pensionannuityjoint: 4,
|
|
6
9
|
halykmycar: 5,
|
|
7
10
|
lifetrip: 7,
|
|
8
11
|
bolashak: 8,
|
|
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,
|
|
20
|
+
pensionannuitynew: 19,
|
|
13
21
|
},
|
|
14
22
|
amlProducts: {
|
|
15
23
|
checkcontragent: 1,
|
|
16
24
|
checkcontract: 2,
|
|
17
25
|
},
|
|
18
|
-
|
|
26
|
+
extractedProducts: ['dso', 'uu'],
|
|
27
|
+
editableStatuses: [Statuses.StartForm, Statuses.EditBeneficiaryForm, Statuses.EditForm, Statuses.InputDataForm],
|
|
19
28
|
documentsLinkVisibleStatuses: [
|
|
20
|
-
Statuses.
|
|
29
|
+
Statuses.Completed,
|
|
21
30
|
Statuses.UnderwriterForm,
|
|
31
|
+
Statuses.DocumentsSignedFrom,
|
|
22
32
|
Statuses.AffilationResolutionForm,
|
|
23
|
-
Statuses.
|
|
33
|
+
Statuses.DocumentsSignedClientFrom,
|
|
24
34
|
Statuses.InsurancePremiumOnlinePaid,
|
|
25
35
|
],
|
|
26
|
-
returnStatementStatuses: [
|
|
36
|
+
returnStatementStatuses: [
|
|
37
|
+
Statuses.ApproveForm,
|
|
38
|
+
Statuses.ActuaryForm,
|
|
39
|
+
Statuses.DsoUsnsForm,
|
|
40
|
+
Statuses.AccountantForm,
|
|
41
|
+
Statuses.UnderwriterForm,
|
|
42
|
+
Statuses.ControllerDpForm,
|
|
43
|
+
Statuses.ContractSignedFrom,
|
|
44
|
+
Statuses.DocumentsSignedFrom,
|
|
45
|
+
Statuses.DocumentsSignedClientFrom,
|
|
46
|
+
Statuses.WaitingInsurancePremiumForm,
|
|
47
|
+
],
|
|
27
48
|
cancelApplicationStatuses: [
|
|
28
|
-
Statuses.StartForm,
|
|
29
49
|
Statuses.EditForm,
|
|
50
|
+
Statuses.StartForm,
|
|
51
|
+
Statuses.ContractSignedFrom,
|
|
30
52
|
Statuses.EditBeneficiaryForm,
|
|
31
|
-
Statuses.WaitingInsurancePremiumForm,
|
|
32
53
|
Statuses.DocumentsSignedFrom,
|
|
54
|
+
Statuses.AttachAppContractForm,
|
|
55
|
+
Statuses.PreparationDossierForm,
|
|
56
|
+
Statuses.DocumentsSignedClientFrom,
|
|
57
|
+
Statuses.WaitingInsurancePremiumForm,
|
|
58
|
+
],
|
|
59
|
+
rejectApplicationStatuses: [
|
|
60
|
+
Statuses.StartForm,
|
|
61
|
+
Statuses.DsoUsnsForm,
|
|
62
|
+
Statuses.AccountantForm,
|
|
63
|
+
Statuses.HeadManagerForm,
|
|
33
64
|
Statuses.ContractSignedFrom,
|
|
65
|
+
Statuses.AttachAppContractForm,
|
|
34
66
|
],
|
|
35
67
|
gbdErrors: ['INVALID', 'TIMEOUT', 'ERROR', 'NOT_FOUND'],
|
|
36
68
|
roles: Roles,
|
|
@@ -42,4 +74,92 @@ export const constants = Object.freeze({
|
|
|
42
74
|
kzt: '₸',
|
|
43
75
|
usd: '$',
|
|
44
76
|
},
|
|
77
|
+
documentTypes: {
|
|
78
|
+
statement: 5,
|
|
79
|
+
contract: 6,
|
|
80
|
+
underConclusion: 12,
|
|
81
|
+
complianceFinMonitoring: 14,
|
|
82
|
+
agreement: 19,
|
|
83
|
+
acceptLetter: 22,
|
|
84
|
+
rejectLetter: 23,
|
|
85
|
+
application1: 33,
|
|
86
|
+
insuredsList: 34,
|
|
87
|
+
questionnaireInsured: 35,
|
|
88
|
+
invoicePayment: 36,
|
|
89
|
+
},
|
|
90
|
+
regex: {
|
|
91
|
+
isoDate: /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)((-(\d{2}):(\d{2})|Z)?)$/,
|
|
92
|
+
},
|
|
93
|
+
fixInsAmount: [
|
|
94
|
+
{
|
|
95
|
+
code: '500000',
|
|
96
|
+
id: '1',
|
|
97
|
+
nameKz: '500 000',
|
|
98
|
+
nameRu: '500 000',
|
|
99
|
+
ids: '',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
code: '1000000',
|
|
103
|
+
id: '2',
|
|
104
|
+
nameKz: '1 000 000',
|
|
105
|
+
nameRu: '1 000 000',
|
|
106
|
+
ids: '',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
code: '1500000',
|
|
110
|
+
id: '3',
|
|
111
|
+
nameKz: '1 500 000',
|
|
112
|
+
nameRu: '1 500 000',
|
|
113
|
+
ids: '',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
code: '2000000',
|
|
117
|
+
id: '4',
|
|
118
|
+
nameKz: '2 000 000',
|
|
119
|
+
nameRu: '2 000 000',
|
|
120
|
+
ids: '',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
code: '2500000',
|
|
124
|
+
id: '5',
|
|
125
|
+
nameKz: '2 500 000',
|
|
126
|
+
nameRu: '2 500 000',
|
|
127
|
+
ids: '',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
code: '3000000',
|
|
131
|
+
id: '6',
|
|
132
|
+
nameKz: '3 000 000',
|
|
133
|
+
nameRu: '3 000 000',
|
|
134
|
+
ids: '',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
code: '3500000',
|
|
138
|
+
id: '7',
|
|
139
|
+
nameKz: '3 500 000',
|
|
140
|
+
nameRu: '3 500 000',
|
|
141
|
+
ids: '',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
code: '4000000',
|
|
145
|
+
id: '8',
|
|
146
|
+
nameKz: '4 000 000',
|
|
147
|
+
nameRu: '4 000 000',
|
|
148
|
+
ids: '',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
code: '4500000',
|
|
152
|
+
id: '8',
|
|
153
|
+
nameKz: '4 500 000',
|
|
154
|
+
nameRu: '4 500 000',
|
|
155
|
+
ids: '',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
code: '5000000',
|
|
159
|
+
id: '9',
|
|
160
|
+
nameKz: '5 000 000',
|
|
161
|
+
nameRu: '5 000 000',
|
|
162
|
+
ids: '',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
45
165
|
});
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { i18n } from '../configs/i18n';
|
|
2
|
+
import { FieldTypes } from '../types/form';
|
|
3
|
+
import { type 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: Utils.LabelSize = 1;
|
|
209
|
+
hideOnMobile: boolean = false;
|
|
210
|
+
constructor(options: { text: string; size?: Utils.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
|
+
};
|