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.
- package/api/base.api.ts +1042 -0
- package/api/index.ts +2 -620
- package/api/interceptors.ts +53 -14
- package/components/Button/Btn.vue +2 -2
- package/components/Complex/MessageBlock.vue +2 -2
- package/components/Complex/Page.vue +1 -1
- package/components/Dialog/Dialog.vue +60 -15
- 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/FormToggle.vue +25 -5
- package/components/Form/ManagerAttachment.vue +150 -86
- 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/RoundedEmptyField.vue +5 -0
- package/components/Input/RoundedSelect.vue +18 -0
- package/components/Input/SwitchInput.vue +64 -0
- package/components/Input/TextInput.vue +160 -0
- package/components/Layout/Drawer.vue +17 -4
- package/components/Layout/Header.vue +23 -2
- package/components/Layout/Loader.vue +1 -1
- package/components/Layout/SettingsPanel.vue +13 -7
- package/components/Menu/InfoMenu.vue +35 -0
- package/components/Menu/MenuNav.vue +17 -2
- package/components/Pages/Anketa.vue +140 -52
- package/components/Pages/Auth.vue +50 -9
- package/components/Pages/ContragentForm.vue +124 -50
- package/components/Pages/Documents.vue +179 -29
- package/components/Pages/InvoiceInfo.vue +1 -1
- package/components/Pages/MemberForm.vue +605 -116
- package/components/Pages/ProductAgreement.vue +1 -8
- package/components/Pages/ProductConditions.vue +1055 -183
- package/components/Panel/PanelHandler.vue +583 -46
- package/components/Panel/PanelSelectItem.vue +17 -2
- package/components/Panel/RightPanelCloser.vue +7 -0
- package/components/Transitions/Animation.vue +28 -0
- package/components/Utilities/Qr.vue +44 -0
- package/composables/axios.ts +1 -0
- package/composables/classes.ts +456 -8
- package/composables/constants.ts +114 -2
- package/composables/fields.ts +328 -0
- package/composables/index.ts +270 -19
- package/composables/styles.ts +29 -16
- package/layouts/default.vue +48 -3
- package/locales/ru.json +547 -14
- package/package.json +28 -24
- package/pages/Token.vue +1 -12
- package/plugins/vuetifyPlugin.ts +2 -0
- package/store/data.store.ts +1463 -275
- package/store/extractStore.ts +17 -0
- package/store/form.store.ts +13 -1
- package/store/member.store.ts +1 -1
- package/store/rules.ts +83 -5
- package/types/enum.ts +61 -0
- package/types/env.d.ts +1 -0
- package/types/form.ts +94 -0
- package/types/index.ts +259 -23
|
@@ -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
|
+
}
|
package/store/form.store.ts
CHANGED
|
@@ -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
|
});
|
package/store/member.store.ts
CHANGED
|
@@ -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,16 @@
|
|
|
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
|
+
notZero: [(v: any) => Number(v) !== 0 || 'Не может быть равно нулю'],
|
|
12
|
+
iik: [(v: any) => v.length === 20 || t('rules.iik')],
|
|
13
|
+
agentCommission: [(v: any) => v <= 50 || t('rules.agentCommission')],
|
|
10
14
|
objectRequired: [
|
|
11
15
|
(v: any) => {
|
|
12
16
|
if (!!v && 'nameRu' in v && v.nameRu != null) {
|
|
@@ -15,6 +19,7 @@ export const rules = {
|
|
|
15
19
|
return t('rules.required');
|
|
16
20
|
},
|
|
17
21
|
],
|
|
22
|
+
arrayRequired: [(v: any) => (v && v.length > 0) || t('rules.required')],
|
|
18
23
|
agentDataRequired: [
|
|
19
24
|
(v: any) => {
|
|
20
25
|
if (!!v && 'fullName' in v && v.fullName != null) {
|
|
@@ -34,12 +39,25 @@ export const rules = {
|
|
|
34
39
|
return t('rules.required');
|
|
35
40
|
},
|
|
36
41
|
],
|
|
37
|
-
|
|
42
|
+
noResidentOffline: [
|
|
43
|
+
(v: any) => {
|
|
44
|
+
if (!!v && 'nameRu' in v && v.nameRu === 'Нерезидент') {
|
|
45
|
+
return t('rules.noResidentOffline');
|
|
46
|
+
}
|
|
47
|
+
if (!!v && 'nameRu' in v && !!v.nameRu) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return t('rules.required');
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
cyrillic: [(v: any) => v === null || /^[\u0400-\u04FF -]+$/.test(v) || t('rules.cyrillic')],
|
|
54
|
+
latin: [(v: any) => v === null || /^[a-zA-Z]+$/.test(v) || t('rules.latin')],
|
|
55
|
+
latinAndNumber: [(v: any) => v === null || /^[0-9a-zA-Z]+$/.test(v) || t('rules.latinAndNumber')],
|
|
38
56
|
cyrillicNonRequired: [
|
|
39
57
|
(v: any) => {
|
|
40
58
|
if (!v) return true;
|
|
41
59
|
else {
|
|
42
|
-
return /^[\u0400-\u04FF ]+$/.test(v) || t('rules.cyrillic');
|
|
60
|
+
return /^[\u0400-\u04FF -]+$/.test(v) || t('rules.cyrillic');
|
|
43
61
|
}
|
|
44
62
|
},
|
|
45
63
|
],
|
|
@@ -63,6 +81,8 @@ export const rules = {
|
|
|
63
81
|
numbers: [(v: any) => /^[0-9]+$/.test(v) || t('rules.numbers')],
|
|
64
82
|
numbersSymbols: [(v: any) => /^([0-9])|(\W|_)+$/.test(v) || t('rules.numbersSymbols')],
|
|
65
83
|
ageExceeds: [(v: any) => v < 50 || t('rules.ageExceeds')],
|
|
84
|
+
ageExceeds80: [(v: any) => v <= 80 || t('rules.ageExceeds80')],
|
|
85
|
+
ageExceeds80ByDate: [(v: any) => Math.abs(new Date(Date.now() - new Date(formatDate(v)!).getTime()).getUTCFullYear() - 1970) <= 80 || t('rules.ageExceeds80')],
|
|
66
86
|
sums: [
|
|
67
87
|
(v: any) => {
|
|
68
88
|
let str = v.replace(/\s/g, '');
|
|
@@ -72,6 +92,16 @@ export const rules = {
|
|
|
72
92
|
return t('rules.sums');
|
|
73
93
|
},
|
|
74
94
|
],
|
|
95
|
+
planDate: [
|
|
96
|
+
(v: any) => {
|
|
97
|
+
if (new Date(formatDate(v)!) < new Date(Date.now())) return t('rules.planDate');
|
|
98
|
+
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)) {
|
|
99
|
+
return true;
|
|
100
|
+
} else {
|
|
101
|
+
return t('rules.date');
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
],
|
|
75
105
|
iinRight: [
|
|
76
106
|
(v: any) => {
|
|
77
107
|
if (v.length !== useMask().iin.length) {
|
|
@@ -96,7 +126,11 @@ export const rules = {
|
|
|
96
126
|
date: [
|
|
97
127
|
(v: any) => {
|
|
98
128
|
if (v === null || v == '') return true;
|
|
99
|
-
if (
|
|
129
|
+
if (
|
|
130
|
+
/^(?:(?:(?:(?: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(
|
|
131
|
+
v,
|
|
132
|
+
)
|
|
133
|
+
) {
|
|
100
134
|
return true;
|
|
101
135
|
} else {
|
|
102
136
|
return t('rules.date');
|
|
@@ -108,8 +142,13 @@ export const rules = {
|
|
|
108
142
|
age18ByDate: [(v: any) => Math.abs(new Date(Date.now() - new Date(formatDate(v)!).getTime()).getUTCFullYear() - 1970) >= 18 || t('rules.age18')],
|
|
109
143
|
birthDate: [
|
|
110
144
|
(v: any) => {
|
|
145
|
+
if (v === null || v == '') return true;
|
|
111
146
|
if (new Date(formatDate(v)!) > new Date(Date.now())) return t('rules.exceedDate');
|
|
112
|
-
if (
|
|
147
|
+
if (
|
|
148
|
+
/^(?:(?:(?:(?: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(
|
|
149
|
+
v,
|
|
150
|
+
)
|
|
151
|
+
) {
|
|
113
152
|
return true;
|
|
114
153
|
} else {
|
|
115
154
|
return t('rules.date');
|
|
@@ -152,6 +191,18 @@ export const rules = {
|
|
|
152
191
|
}
|
|
153
192
|
},
|
|
154
193
|
],
|
|
194
|
+
coverPeriodFrom1or5to15: [
|
|
195
|
+
(v: any) => {
|
|
196
|
+
if (v !== null) {
|
|
197
|
+
if (v == 1 || (v >= 5 && v <= 15)) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
return t('productConditionsForm.coverPeriodFrom1or5to15');
|
|
201
|
+
} else {
|
|
202
|
+
return t('productConditionsForm.coverPeriodFrom1or5to15');
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
],
|
|
155
206
|
requestedSumInsuredMycar: [
|
|
156
207
|
(v: any) => {
|
|
157
208
|
if (v !== null) {
|
|
@@ -175,6 +226,33 @@ export const rules = {
|
|
|
175
226
|
],
|
|
176
227
|
policyholderAgeLimit: [(v: any) => v >= 18 || t('rules.policyholderAgeLimit')],
|
|
177
228
|
beneficiaryAgeLimit: [(v: any) => v <= 15 || t('rules.beneficiaryAgeLimit')],
|
|
229
|
+
dateInPast: [
|
|
230
|
+
(v: any) => {
|
|
231
|
+
const givenDate = new Date(formatDate(v)!);
|
|
232
|
+
const currentDate = new Date();
|
|
233
|
+
if (givenDate.getTime() < currentDate.getTime()) {
|
|
234
|
+
return t('rules.dataInPast');
|
|
235
|
+
} else {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
checkDate: [
|
|
241
|
+
(v: any) => {
|
|
242
|
+
const today = new Date();
|
|
243
|
+
const yesterday = new Date();
|
|
244
|
+
yesterday.setDate(today.getDate() - 1);
|
|
245
|
+
const yourDate = new Date(formatDate(v)!);
|
|
246
|
+
|
|
247
|
+
if (yourDate.toDateString() === today.toDateString()) {
|
|
248
|
+
return true;
|
|
249
|
+
} else if (yourDate.toDateString() === yesterday.toDateString()) {
|
|
250
|
+
return true;
|
|
251
|
+
} else {
|
|
252
|
+
return t('rules.checkDate');
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
],
|
|
178
256
|
guaranteedPeriodLimit(v: any, termAnnuityPayments: any) {
|
|
179
257
|
if (Number(v) > Number(termAnnuityPayments)) {
|
|
180
258
|
return t('rules.guaranteedPeriodLimit');
|
package/types/enum.ts
CHANGED
|
@@ -8,15 +8,49 @@ 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
|
+
|
|
16
|
+
cancel = 'cancel',
|
|
17
|
+
cancelCustom = 'cancelCustom',
|
|
18
|
+
|
|
12
19
|
reject = 'reject',
|
|
20
|
+
rejectCustom = 'rejectCustom',
|
|
21
|
+
|
|
13
22
|
return = 'return',
|
|
23
|
+
returnCustom = 'returnCustom',
|
|
24
|
+
|
|
14
25
|
claim = 'claim',
|
|
26
|
+
claimCustom = 'claimCustom',
|
|
27
|
+
|
|
15
28
|
sign = 'sign',
|
|
29
|
+
signCustom = 'signCustom',
|
|
30
|
+
|
|
31
|
+
signed = 'signed',
|
|
32
|
+
signedCustom = 'signedCustom',
|
|
33
|
+
|
|
16
34
|
pay = 'pay',
|
|
35
|
+
payCustom = 'payCustom',
|
|
36
|
+
|
|
17
37
|
register = 'register',
|
|
38
|
+
registerCustom = 'registerCustom',
|
|
39
|
+
|
|
18
40
|
send = 'send',
|
|
41
|
+
sendCustom = 'sendCustom',
|
|
42
|
+
|
|
19
43
|
affiliate = 'affiliate',
|
|
44
|
+
affiliateCustom = 'affiliateCustom',
|
|
45
|
+
|
|
46
|
+
chooseSign = 'chooseSign',
|
|
47
|
+
chooseSignCustom = 'chooseSignCustom',
|
|
48
|
+
|
|
49
|
+
choosePay = 'choosePay',
|
|
50
|
+
choosePayCustom = 'choosePayCustom',
|
|
51
|
+
|
|
52
|
+
payed = 'payed',
|
|
53
|
+
payedCustom = 'payedCustom',
|
|
20
54
|
}
|
|
21
55
|
|
|
22
56
|
export enum PostActions {
|
|
@@ -32,23 +66,35 @@ export enum PostActions {
|
|
|
32
66
|
Error401 = 'Error401',
|
|
33
67
|
Error500 = 'Error500',
|
|
34
68
|
iframeLoaded = 'iframeLoaded',
|
|
69
|
+
goToProject = 'goToProject',
|
|
35
70
|
}
|
|
36
71
|
|
|
37
72
|
export enum Roles {
|
|
38
73
|
Manager = 'Manager',
|
|
39
74
|
Admin = 'Admin',
|
|
75
|
+
Jurist = 'Jurist',
|
|
40
76
|
Underwriter = 'Underwriter',
|
|
77
|
+
Actuary = 'Actuary',
|
|
41
78
|
Agent = 'Agent',
|
|
42
79
|
Compliance = 'Compliance',
|
|
43
80
|
AgentMycar = 'AgentMycar',
|
|
44
81
|
Analyst = 'Analyst',
|
|
45
82
|
UPK = 'UPK',
|
|
83
|
+
URP = 'URP',
|
|
46
84
|
FinCenter = 'FinCenter',
|
|
47
85
|
Supervisor = 'Supervisor',
|
|
48
86
|
Support = 'Support',
|
|
49
87
|
ManagerHalykBank = 'ManagerHalykBank',
|
|
50
88
|
ServiceManager = 'ServiceManager',
|
|
51
89
|
DRNSJ = 'DRNSJ',
|
|
90
|
+
HeadManager = 'HeadManager',
|
|
91
|
+
AgentAuletti = 'AgentAuletti',
|
|
92
|
+
USNS = 'USNS',
|
|
93
|
+
Accountant = 'Accountant',
|
|
94
|
+
BranchDirector = 'BranchDirector',
|
|
95
|
+
USNSACCINS = 'USNSACCINS',
|
|
96
|
+
Dsuio = 'Dsuio',
|
|
97
|
+
Adjuster = 'Adjuster',
|
|
52
98
|
}
|
|
53
99
|
|
|
54
100
|
export enum Statuses {
|
|
@@ -56,6 +102,7 @@ export enum Statuses {
|
|
|
56
102
|
EditForm = 'EditForm',
|
|
57
103
|
EditBeneficiaryForm = 'EditBeneficiaryForm',
|
|
58
104
|
DocumentsSignedFrom = 'DocumentsSignedFrom',
|
|
105
|
+
PreparationDossierForm = 'PreparationDossierForm',
|
|
59
106
|
UnderwriterForm = 'UnderwriterForm',
|
|
60
107
|
AffilationResolutionForm = 'AffilationResolutionForm',
|
|
61
108
|
Completed = 'Completed',
|
|
@@ -64,6 +111,15 @@ export enum Statuses {
|
|
|
64
111
|
WaitingInsurancePremiumForm = 'WaitingInsurancePremiumForm',
|
|
65
112
|
CheckFinCenterForm = 'CheckFinCenterForm',
|
|
66
113
|
RegistryFinCenterForm = 'RegistryFinCenterForm',
|
|
114
|
+
DocumentsSignedClientFrom = 'DocumentsSignedClientFrom',
|
|
115
|
+
InputDataForm = 'InputDataForm',
|
|
116
|
+
ApproveForm = 'ApproveForm',
|
|
117
|
+
AttachAppContractForm = 'AttachAppContractForm',
|
|
118
|
+
ControllerDpForm = 'ControllerDpForm',
|
|
119
|
+
ActuaryForm = 'ActuaryForm',
|
|
120
|
+
DsoUsnsForm = 'DsoUsnsForm',
|
|
121
|
+
AccountantForm = 'AccountantForm',
|
|
122
|
+
ContractSignedByAuthorizedPerson = 'ContractSignedByAuthorizedPerson',
|
|
67
123
|
}
|
|
68
124
|
|
|
69
125
|
export enum MemberCodes {
|
|
@@ -81,3 +137,8 @@ export enum MemberAppCodes {
|
|
|
81
137
|
beneficialOwnerApp = 'beneficialOwnerApp',
|
|
82
138
|
spokesmanApp = 'spokesmanApp',
|
|
83
139
|
}
|
|
140
|
+
|
|
141
|
+
export enum Methods {
|
|
142
|
+
GET = 'GET',
|
|
143
|
+
POST = 'POST',
|
|
144
|
+
}
|
package/types/env.d.ts
CHANGED
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
|
+
}
|