@redneckz/wildless-cms-uni-blocks 0.14.621 → 0.14.622
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +35 -27
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/bundle/components/CreditForm/CreditFormStep.d.ts +1 -2
- package/bundle/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
- package/bundle/components/CreditForm/creditFormStepsData.d.ts +2 -178
- package/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/dist/components/ApplicationForm/getInitialFormState.js +1 -1
- package/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/dist/components/ApplicationForm/renderInputs.js +2 -2
- package/dist/components/ApplicationForm/renderInputs.js.map +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +1 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/dist/components/CreditForm/CreditForm.js +3 -3
- package/dist/components/CreditForm/CreditForm.js.map +1 -1
- package/dist/components/CreditForm/CreditFormProgress.js +3 -3
- package/dist/components/CreditForm/CreditFormProgress.js.map +1 -1
- package/dist/components/CreditForm/CreditFormStep.d.ts +1 -2
- package/dist/components/CreditForm/CreditFormStep.js +3 -3
- package/dist/components/CreditForm/CreditFormStep.js.map +1 -1
- package/dist/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
- package/dist/components/CreditForm/StepsNavigationButtons.js +2 -1
- package/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
- package/dist/components/CreditForm/creditFormStepsData.d.ts +2 -178
- package/dist/components/CreditForm/creditFormStepsData.js +7 -8
- package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/PartInBusinessField.js +9 -1
- package/dist/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
- package/dist/ui-kit/FormField/getField.js +1 -1
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/lib/components/ApplicationForm/getInitialFormState.js +1 -1
- package/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/lib/components/ApplicationForm/renderInputs.js +2 -2
- package/lib/components/ApplicationForm/renderInputs.js.map +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.fixture.d.ts +0 -2
- package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +1 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/lib/components/CreditForm/CreditForm.js +3 -3
- package/lib/components/CreditForm/CreditForm.js.map +1 -1
- package/lib/components/CreditForm/CreditFormProgress.js +3 -3
- package/lib/components/CreditForm/CreditFormProgress.js.map +1 -1
- package/lib/components/CreditForm/CreditFormStep.d.ts +1 -2
- package/lib/components/CreditForm/CreditFormStep.js +3 -3
- package/lib/components/CreditForm/CreditFormStep.js.map +1 -1
- package/lib/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
- package/lib/components/CreditForm/StepsNavigationButtons.js +2 -1
- package/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
- package/lib/components/CreditForm/creditFormStepsData.d.ts +2 -178
- package/lib/components/CreditForm/creditFormStepsData.js +7 -8
- package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
- package/lib/ui-kit/FormField/Fields/PartInBusinessField.js +9 -1
- package/lib/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
- package/lib/ui-kit/FormField/getField.js +1 -1
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +35 -27
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/CreditFormStep.d.ts +1 -2
- package/mobile/bundle/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
- package/mobile/bundle/components/CreditForm/creditFormStepsData.d.ts +2 -178
- package/mobile/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/mobile/dist/components/ApplicationForm/getInitialFormState.js +1 -1
- package/mobile/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ApplicationForm/renderInputs.js +2 -2
- package/mobile/dist/components/ApplicationForm/renderInputs.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditForm.js +3 -3
- package/mobile/dist/components/CreditForm/CreditForm.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditFormProgress.js +3 -3
- package/mobile/dist/components/CreditForm/CreditFormProgress.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditFormStep.d.ts +1 -2
- package/mobile/dist/components/CreditForm/CreditFormStep.js +3 -3
- package/mobile/dist/components/CreditForm/CreditFormStep.js.map +1 -1
- package/mobile/dist/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
- package/mobile/dist/components/CreditForm/StepsNavigationButtons.js +2 -1
- package/mobile/dist/components/CreditForm/StepsNavigationButtons.js.map +1 -1
- package/mobile/dist/components/CreditForm/creditFormStepsData.d.ts +2 -178
- package/mobile/dist/components/CreditForm/creditFormStepsData.js +7 -8
- package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/PartInBusinessField.js +9 -1
- package/mobile/dist/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getField.js +1 -1
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +1 -1
- package/mobile/lib/components/ApplicationForm/getInitialFormState.js +1 -1
- package/mobile/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/renderInputs.js +2 -2
- package/mobile/lib/components/ApplicationForm/renderInputs.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditForm.js +3 -3
- package/mobile/lib/components/CreditForm/CreditForm.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditFormProgress.js +3 -3
- package/mobile/lib/components/CreditForm/CreditFormProgress.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditFormStep.d.ts +1 -2
- package/mobile/lib/components/CreditForm/CreditFormStep.js +3 -3
- package/mobile/lib/components/CreditForm/CreditFormStep.js.map +1 -1
- package/mobile/lib/components/CreditForm/StepsNavigationButtons.d.ts +0 -1
- package/mobile/lib/components/CreditForm/StepsNavigationButtons.js +2 -1
- package/mobile/lib/components/CreditForm/StepsNavigationButtons.js.map +1 -1
- package/mobile/lib/components/CreditForm/creditFormStepsData.d.ts +2 -178
- package/mobile/lib/components/CreditForm/creditFormStepsData.js +7 -8
- package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/PartInBusinessField.js +9 -1
- package/mobile/lib/ui-kit/FormField/Fields/PartInBusinessField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getField.js +1 -1
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +1 -1
- package/mobile/src/components/ApplicationForm/getInitialFormState.tsx +1 -1
- package/mobile/src/components/ApplicationForm/renderInputs.tsx +2 -2
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +1 -1
- package/mobile/src/components/ApplicationLeadForm/GroupedConsents.tsx +9 -2
- package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -1
- package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
- package/mobile/src/components/CreditForm/CreditForm.tsx +7 -5
- package/mobile/src/components/CreditForm/CreditFormProgress.tsx +5 -5
- package/mobile/src/components/CreditForm/CreditFormStep.tsx +4 -5
- package/mobile/src/components/CreditForm/StepsNavigationButtons.tsx +3 -2
- package/mobile/src/components/CreditForm/creditFormStepsData.tsx +9 -8
- package/mobile/src/ui-kit/FormField/Fields/PartInBusinessField.tsx +25 -9
- package/mobile/src/ui-kit/FormField/getField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +1 -1
- package/package.json +1 -1
- package/src/components/ApplicationForm/ApplicationFormContent.ts +1 -1
- package/src/components/ApplicationForm/getInitialFormState.tsx +1 -1
- package/src/components/ApplicationForm/renderInputs.tsx +2 -2
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +0 -121
- package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +1 -1
- package/src/components/ApplicationLeadForm/GroupedConsents.tsx +9 -2
- package/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -1
- package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
- package/src/components/CreditForm/CreditForm.tsx +7 -5
- package/src/components/CreditForm/CreditFormProgress.tsx +5 -5
- package/src/components/CreditForm/CreditFormStep.tsx +4 -5
- package/src/components/CreditForm/StepsNavigationButtons.tsx +3 -2
- package/src/components/CreditForm/creditFormStepsData.tsx +9 -8
- package/src/icons/IconName.ts +6 -360
- package/src/ui-kit/FormField/Fields/PartInBusinessField.tsx +25 -9
- package/src/ui-kit/FormField/getField.tsx +1 -1
- package/src/ui-kit/FormField/getObjectValidator.tsx +1 -1
|
@@ -4,12 +4,28 @@ import { type CustomFieldProps } from '../CustomFieldProps';
|
|
|
4
4
|
import { validatorObj } from '../getObjectValidator';
|
|
5
5
|
import { getValidation } from '../getValidation';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
const MAX_PART = 100;
|
|
8
|
+
|
|
9
|
+
export const PartInBusinessField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
10
|
+
const partInBusinessField = {
|
|
11
|
+
...getValidation(field('partInBusiness'), validatorObj.partInBusiness, input?.required),
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const handleChange = (value: string) =>
|
|
15
|
+
partInBusinessField?.onChange &&
|
|
16
|
+
partInBusinessField?.onChange(
|
|
17
|
+
String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<InputControl
|
|
22
|
+
label="Доля участия в бизнесе"
|
|
23
|
+
placeholder="в %"
|
|
24
|
+
inputLength={3}
|
|
25
|
+
type="number"
|
|
26
|
+
{...partInBusinessField}
|
|
27
|
+
{...input}
|
|
28
|
+
onChange={handleChange}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
});
|
|
@@ -96,5 +96,5 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
96
96
|
export const getObjectValidator = (inputs: FieldDef[]): Record<string, Validator> => {
|
|
97
97
|
const requiredInputs = getNamesFromInput(inputs.filter((_: FieldDef) => Boolean(_?.required)));
|
|
98
98
|
|
|
99
|
-
return Object.fromEntries(requiredInputs.map((_) => [_, validatorObj?.[_]]));
|
|
99
|
+
return Object.fromEntries(requiredInputs.map((_) => [_, validatorObj?.[_ || '']]));
|
|
100
100
|
};
|
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ export const getInitialFormState = (inputs: FieldDef[], typeForm = ''): FormStat
|
|
|
60
60
|
const formState = Object.fromEntries(
|
|
61
61
|
inputs.map((_) => [
|
|
62
62
|
_.name,
|
|
63
|
-
(_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name],
|
|
63
|
+
(_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name || ''],
|
|
64
64
|
]),
|
|
65
65
|
);
|
|
66
66
|
|
|
@@ -20,6 +20,6 @@ export const renderInputs = ({ field, typeForm = '', inputs }: GroupedConsentsPr
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const splitInputs = (inputs?: FieldDef[]) => ({
|
|
23
|
-
consentInputs: inputs?.filter((_) => Object.keys(CONSENTS).includes(_.name)) || [],
|
|
24
|
-
restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name)) || [],
|
|
23
|
+
consentInputs: inputs?.filter((_) => Object.keys(CONSENTS).includes(_.name || '')) || [],
|
|
24
|
+
restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
|
|
25
25
|
});
|
|
@@ -47,125 +47,4 @@ export default {
|
|
|
47
47
|
<DialogManager />
|
|
48
48
|
</div>
|
|
49
49
|
),
|
|
50
|
-
step1: (
|
|
51
|
-
<div className="container grid grid-cols-12">
|
|
52
|
-
<ApplicationLeadForm
|
|
53
|
-
className="col-span-12"
|
|
54
|
-
title="Заявка на кредит «Кредит на любые цели»"
|
|
55
|
-
typeForm="CORRUPTION"
|
|
56
|
-
endpoint="lead"
|
|
57
|
-
sections={[
|
|
58
|
-
{ title: 'Персональные данные', inputs: [] },
|
|
59
|
-
{
|
|
60
|
-
columns: 2,
|
|
61
|
-
inputs: [
|
|
62
|
-
{ fieldType: 'common', name: 'surname', required: true, dadata: true },
|
|
63
|
-
{ fieldType: 'common', name: 'name', required: true, dadata: true },
|
|
64
|
-
{ fieldType: 'common', name: 'middleName', dadata: true },
|
|
65
|
-
{ fieldType: 'common', name: 'sex', required: true },
|
|
66
|
-
{ fieldType: 'common', name: 'birthday', required: true },
|
|
67
|
-
{ fieldType: 'common', name: 'birthPlace', required: true },
|
|
68
|
-
{ fieldType: 'common', name: 'phone', required: true },
|
|
69
|
-
{ fieldType: 'common', name: 'email', required: true, dadata: true },
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
title: 'Паспортные данные',
|
|
74
|
-
inputs: [
|
|
75
|
-
{ fieldType: 'common', name: 'dulSerie', required: true },
|
|
76
|
-
{ fieldType: 'common', name: 'dulNumber', required: true },
|
|
77
|
-
{ fieldType: 'common', name: 'dulIssueDateField', required: true },
|
|
78
|
-
{ fieldType: 'common', name: 'dulSubdivisionCode', required: true, dadata: true },
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
inputs: [
|
|
83
|
-
{ fieldType: 'common', name: 'dulIssuedBy', required: true, dadata: true },
|
|
84
|
-
{
|
|
85
|
-
fieldType: 'common',
|
|
86
|
-
name: 'education',
|
|
87
|
-
required: true,
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
title: 'Адрес регистрации по месту жительства',
|
|
93
|
-
inputs: [],
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
inputs: [
|
|
97
|
-
{ fieldType: 'common', name: 'participantDateRegistration', required: true },
|
|
98
|
-
{ fieldType: 'common', name: 'participantAddress', required: true, dadata: true },
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
]}
|
|
102
|
-
button={button}
|
|
103
|
-
/>
|
|
104
|
-
<PopupManager />
|
|
105
|
-
<DialogManager />
|
|
106
|
-
</div>
|
|
107
|
-
),
|
|
108
|
-
employmentData: (
|
|
109
|
-
<div className="container grid grid-cols-12">
|
|
110
|
-
<ApplicationLeadForm
|
|
111
|
-
className="col-span-12"
|
|
112
|
-
title="Заявка на кредит «Кредит на любые цели»"
|
|
113
|
-
typeForm="CORRUPTION"
|
|
114
|
-
endpoint="lead"
|
|
115
|
-
sections={[
|
|
116
|
-
{
|
|
117
|
-
title: 'Данные о трудоустройстве',
|
|
118
|
-
inputs: [],
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
inputs: [
|
|
122
|
-
{ fieldType: 'common', name: 'employment', required: true },
|
|
123
|
-
{ fieldType: 'common', name: 'organizationName', required: true, dadata: true },
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
columns: 2,
|
|
128
|
-
inputs: [
|
|
129
|
-
{ fieldType: 'common', name: 'inn', required: true, dadata: true },
|
|
130
|
-
{ fieldType: 'common', name: 'legalForm', required: true },
|
|
131
|
-
],
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
inputs: [
|
|
135
|
-
{ fieldType: 'common', name: 'organization', required: true },
|
|
136
|
-
{ fieldType: 'common', name: 'amountWorkers', required: true },
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
columns: 2,
|
|
141
|
-
inputs: [
|
|
142
|
-
{ fieldType: 'common', name: 'employerActivities', required: true },
|
|
143
|
-
{ fieldType: 'common', name: 'employerOrganization', required: true },
|
|
144
|
-
{ fieldType: 'common', name: 'generalSeniority', required: true },
|
|
145
|
-
{ fieldType: 'common', name: 'lastJobExperience', required: true },
|
|
146
|
-
{ fieldType: 'common', name: 'experience5Years', required: true },
|
|
147
|
-
{ fieldType: 'common', name: 'jobsNumber', required: true },
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
inputs: [
|
|
152
|
-
{ fieldType: 'common', name: 'phone', label: 'Телефон работодателя', required: true },
|
|
153
|
-
{ fieldType: 'common', name: 'beginDate', required: true },
|
|
154
|
-
{ fieldType: 'common', name: 'positionOrganization', required: true },
|
|
155
|
-
],
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
title: 'Адрес работодателя',
|
|
159
|
-
inputs: [],
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
inputs: [{ fieldType: 'common', name: 'fullAddress', required: true }],
|
|
163
|
-
},
|
|
164
|
-
]}
|
|
165
|
-
button={button}
|
|
166
|
-
/>
|
|
167
|
-
<PopupManager />
|
|
168
|
-
<DialogManager />
|
|
169
|
-
</div>
|
|
170
|
-
),
|
|
171
50
|
};
|
|
@@ -18,7 +18,7 @@ const CONSENT_REQUIRED = 'Отметьте все обязательные со
|
|
|
18
18
|
|
|
19
19
|
export const GroupedConsents = JSX<GroupedConsentsProps>(
|
|
20
20
|
({ inputs = [], typeForm = '', field, key }) => {
|
|
21
|
-
const isChecked = inputs.every((_) => Boolean(field(_.name).value));
|
|
21
|
+
const isChecked = inputs.every((_) => Boolean(field(_.name as keyof FormState).value));
|
|
22
22
|
|
|
23
23
|
const handleGeneralToggle = (value: boolean) => {
|
|
24
24
|
for (const item of inputs) {
|
|
@@ -31,7 +31,14 @@ export const GroupedConsents = JSX<GroupedConsentsProps>(
|
|
|
31
31
|
() =>
|
|
32
32
|
inputs
|
|
33
33
|
?.filter((_) => _.required)
|
|
34
|
-
?.some((_) =>
|
|
34
|
+
?.some((_) =>
|
|
35
|
+
Boolean(
|
|
36
|
+
withValidator(
|
|
37
|
+
field(_?.name as keyof FormState),
|
|
38
|
+
validatorObj[_?.name as keyof FormState],
|
|
39
|
+
).error,
|
|
40
|
+
),
|
|
41
|
+
),
|
|
35
42
|
[inputs],
|
|
36
43
|
);
|
|
37
44
|
|
|
@@ -150,7 +150,7 @@ export const getInitialFormState = (
|
|
|
150
150
|
const formState = Object.fromEntries(
|
|
151
151
|
inputs.map((_) => [
|
|
152
152
|
_.name,
|
|
153
|
-
(_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name],
|
|
153
|
+
(_.fieldType === 'ved' && _?.defaultValue) || initialFormState[_.name || ''],
|
|
154
154
|
]),
|
|
155
155
|
);
|
|
156
156
|
|
|
@@ -7,7 +7,7 @@ export const useInitApplicationLead = (nextStepLink: string) => {
|
|
|
7
7
|
const [isLoading, setIsLoading] = useState(false);
|
|
8
8
|
const [profileId] = useLocalStorage<string>('profileId');
|
|
9
9
|
const [, setEsiaData] = useLocalStorage('esiaData');
|
|
10
|
-
const params = new URLSearchParams(decodeURIComponent(
|
|
10
|
+
const params = new URLSearchParams(decodeURIComponent(globalThis.location.search));
|
|
11
11
|
const esiaAuth = params.get('esiaAuth');
|
|
12
12
|
|
|
13
13
|
const updateEsiaProfile = useCallback(async () => {
|
|
@@ -3,8 +3,10 @@ import { useCallback, useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
|
3
3
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
4
4
|
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
5
5
|
import { style } from '../../utils/style';
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
type FieldDef,
|
|
8
|
+
type SectionsProps,
|
|
9
|
+
} from '../ApplicationLeadForm/ApplicationLeadFormContent';
|
|
8
10
|
import { type CreditFormContent } from './CreditFormContent';
|
|
9
11
|
import { CreditFormProgress } from './CreditFormProgress';
|
|
10
12
|
import { CreditFormStep } from './CreditFormStep';
|
|
@@ -22,12 +24,13 @@ const STEPS_TITLES = [
|
|
|
22
24
|
interface CreditFormProps extends CreditFormContent, UniBlockProps {}
|
|
23
25
|
|
|
24
26
|
export const CreditForm = JSX<CreditFormProps>(({ className, ...rest }) => {
|
|
25
|
-
const [step, setStep] = useState(
|
|
27
|
+
const [step, setStep] = useState(0);
|
|
26
28
|
const sections = useMemo(() => stepsSectionsMap[step], [step]);
|
|
29
|
+
|
|
27
30
|
const inputs = (sections?.flatMap((_: SectionsProps) => _?.inputs) || []) as FieldDef[];
|
|
28
31
|
|
|
29
32
|
const handleNextStep = useCallback(() => {
|
|
30
|
-
setStep((_) => Math.min(_ + 1, STEPS_COUNT));
|
|
33
|
+
setStep((_) => Math.min(_ + 1, STEPS_COUNT - 1));
|
|
31
34
|
}, []);
|
|
32
35
|
|
|
33
36
|
const handlePrevStep = useCallback(() => {
|
|
@@ -43,7 +46,6 @@ export const CreditForm = JSX<CreditFormProps>(({ className, ...rest }) => {
|
|
|
43
46
|
<CreditFormStep
|
|
44
47
|
inputs={inputs}
|
|
45
48
|
key={String(step)}
|
|
46
|
-
totalSteps={STEPS_COUNT}
|
|
47
49
|
step={step}
|
|
48
50
|
sections={sections}
|
|
49
51
|
onNextStep={handleNextStep}
|
|
@@ -9,16 +9,16 @@ export interface CreditFormProgressProps {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const CreditFormProgress = JSX<CreditFormProgressProps>(
|
|
12
|
-
({ step =
|
|
13
|
-
const progress = useMemo(() => (step / totalSteps) * 100, [step, totalSteps]);
|
|
12
|
+
({ step = 0, totalSteps = 5, stepsTitles = [] }) => {
|
|
13
|
+
const progress = useMemo(() => ((step + 1) / totalSteps) * 100, [step, totalSteps]);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<div className="py-lg px-5xl bg-white col-span-12">
|
|
17
17
|
<div>
|
|
18
18
|
<span className="font-bold">
|
|
19
|
-
Шаг {step} из {totalSteps}.
|
|
20
|
-
</span>
|
|
21
|
-
{stepsTitles[step
|
|
19
|
+
Шаг {step + 1} из {totalSteps}.
|
|
20
|
+
</span>
|
|
21
|
+
{stepsTitles[step] || null}
|
|
22
22
|
<ProgressBar step={progress} showPercentage={false} />
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
@@ -13,12 +13,11 @@ import { StepsNavigationButtons } from './StepsNavigationButtons';
|
|
|
13
13
|
import { useCreditFormApi } from './useCreditFormApi';
|
|
14
14
|
|
|
15
15
|
export interface StepProps {
|
|
16
|
-
sections
|
|
16
|
+
sections?: SectionsProps[];
|
|
17
17
|
field: FormFieldRegisterer<FormStateMap[keyof FormStateMap]>;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface CreditFormStepProps {
|
|
21
|
-
totalSteps: number;
|
|
22
21
|
step: number;
|
|
23
22
|
sections: SectionsProps[];
|
|
24
23
|
inputs: FieldDef[];
|
|
@@ -27,7 +26,7 @@ export interface CreditFormStepProps {
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
export const CreditFormStep = JSX<CreditFormStepProps>(
|
|
30
|
-
({
|
|
29
|
+
({ step, sections, onPrevStep, onNextStep, inputs }) => {
|
|
31
30
|
const [localStorageData, saveStep] = useLocalStorage<Record<string, any>>('leadForm');
|
|
32
31
|
const initialState = getInitialFormState(step as keyof FormStateMap, localStorageData);
|
|
33
32
|
|
|
@@ -42,14 +41,14 @@ export const CreditFormStep = JSX<CreditFormStepProps>(
|
|
|
42
41
|
return (
|
|
43
42
|
<form onSubmit={onSubmit} className="space-y-m">
|
|
44
43
|
{renderStep({ sections, field })}
|
|
45
|
-
<StepsNavigationButtons step={step}
|
|
44
|
+
<StepsNavigationButtons step={step} onPrevStep={onPrevStep} />
|
|
46
45
|
</form>
|
|
47
46
|
);
|
|
48
47
|
},
|
|
49
48
|
);
|
|
50
49
|
|
|
51
50
|
const renderStep = ({ sections, field }: StepProps) => {
|
|
52
|
-
return sections
|
|
51
|
+
return sections?.map((_, i) => (
|
|
53
52
|
<div key={`section-${i}`} className={style(inputColumnStyles(_.columns), 'grid gap-x-m')}>
|
|
54
53
|
{renderInfo(_?.inputs)}
|
|
55
54
|
{renderTitle(_?.title)}
|
|
@@ -4,11 +4,12 @@ import { style } from '../../utils/style';
|
|
|
4
4
|
|
|
5
5
|
export interface StepsNavigationButtonsProps {
|
|
6
6
|
step: number;
|
|
7
|
-
totalSteps: number;
|
|
8
7
|
onPrevStep?: () => void;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(({ step, onPrevStep }) => {
|
|
11
|
+
const isFirstStep = step === 0;
|
|
12
|
+
|
|
12
13
|
return (
|
|
13
14
|
<div className={'flex justify-between'}>
|
|
14
15
|
<Button
|
|
@@ -16,7 +17,7 @@ export const StepsNavigationButtons = JSX<StepsNavigationButtonsProps>(({ step,
|
|
|
16
17
|
className={style('w-full @xl:w-auto')}
|
|
17
18
|
type="button"
|
|
18
19
|
version="secondary"
|
|
19
|
-
disabled={
|
|
20
|
+
disabled={isFirstStep}
|
|
20
21
|
>
|
|
21
22
|
Назад
|
|
22
23
|
</Button>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
/* eslint-disable max-len */
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { type SectionsProps } from '../ApplicationLeadForm/ApplicationLeadFormContent';
|
|
5
|
+
|
|
6
|
+
export const stepsSectionsMap: SectionsProps[][] = [
|
|
7
|
+
[
|
|
7
8
|
{
|
|
8
9
|
title: 'Персональные данные',
|
|
9
10
|
columns: 2,
|
|
@@ -58,7 +59,7 @@ export const stepsSectionsMap = {
|
|
|
58
59
|
],
|
|
59
60
|
},
|
|
60
61
|
],
|
|
61
|
-
|
|
62
|
+
[
|
|
62
63
|
{
|
|
63
64
|
title: 'Данные о трудоустройстве',
|
|
64
65
|
inputs: [],
|
|
@@ -122,7 +123,7 @@ export const stepsSectionsMap = {
|
|
|
122
123
|
inputs: [{ fieldType: 'common', name: 'fullAddress', required: true }],
|
|
123
124
|
},
|
|
124
125
|
],
|
|
125
|
-
|
|
126
|
+
[
|
|
126
127
|
{
|
|
127
128
|
title: 'Семейное положение',
|
|
128
129
|
},
|
|
@@ -166,7 +167,7 @@ export const stepsSectionsMap = {
|
|
|
166
167
|
inputs: [{ fieldType: 'common', name: 'armyIdFlg' }],
|
|
167
168
|
},
|
|
168
169
|
],
|
|
169
|
-
|
|
170
|
+
[
|
|
170
171
|
{
|
|
171
172
|
title: 'Дополнительные сведения',
|
|
172
173
|
columns: 1,
|
|
@@ -188,7 +189,7 @@ export const stepsSectionsMap = {
|
|
|
188
189
|
inputs: [{ fieldType: 'common', name: 'creditInRshbCd' }],
|
|
189
190
|
},
|
|
190
191
|
],
|
|
191
|
-
|
|
192
|
+
[
|
|
192
193
|
{
|
|
193
194
|
title: 'Отделение Банка',
|
|
194
195
|
columns: 1,
|
|
@@ -217,4 +218,4 @@ export const stepsSectionsMap = {
|
|
|
217
218
|
inputs: [{ fieldType: 'common', name: 'bankEmployeeCode' }],
|
|
218
219
|
},
|
|
219
220
|
],
|
|
220
|
-
|
|
221
|
+
];
|