@redneckz/wildless-cms-uni-blocks 0.14.623 → 0.14.624
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 +1033 -978
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CreditForm/getInitialFormState.d.ts +2 -2
- package/bundle/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
- package/bundle/hooks/useRegions.d.ts +2 -0
- package/bundle/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
- package/bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
- package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/bundle/ui-kit/FormField/validators.d.ts +1 -1
- package/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/dist/components/CreditForm/creditFormStepsData.js +2 -2
- package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/dist/components/CreditForm/getInitialFormState.d.ts +2 -2
- package/dist/components/CreditForm/getInitialFormState.js +2 -2
- package/dist/components/CreditForm/getInitialFormState.js.map +1 -1
- package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -21
- package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
- package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +31 -0
- package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
- package/dist/hooks/useRegions.d.ts +2 -0
- package/dist/hooks/useRegions.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/RetailAddressField.js +38 -0
- package/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
- package/dist/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/RetailRegionField.js +14 -0
- package/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
- package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/dist/ui-kit/FormField/getField.js +4 -1
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +8 -6
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/dist/ui-kit/FormField/validators.d.ts +1 -1
- package/dist/ui-kit/FormField/validators.js +6 -5
- package/dist/ui-kit/FormField/validators.js.map +1 -1
- package/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/dist/ui-kit/YandexMap/YandexMap.js +12 -2
- package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/lib/components/CreditForm/creditFormStepsData.js +2 -2
- package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/lib/components/CreditForm/getInitialFormState.d.ts +2 -2
- package/lib/components/CreditForm/getInitialFormState.js +2 -2
- package/lib/components/CreditForm/getInitialFormState.js.map +1 -1
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +9 -22
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
- package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +28 -0
- package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
- package/lib/hooks/useRegions.d.ts +2 -0
- package/lib/hooks/useRegions.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/RetailAddressField.js +36 -0
- package/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
- package/lib/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/RetailRegionField.js +12 -0
- package/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
- package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/lib/ui-kit/FormField/getField.js +4 -1
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +8 -6
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/ui-kit/FormField/validators.d.ts +1 -1
- package/lib/ui-kit/FormField/validators.js +5 -5
- package/lib/ui-kit/FormField/validators.js.map +1 -1
- package/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/lib/ui-kit/YandexMap/YandexMap.js +12 -2
- package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +1072 -1017
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CreditForm/getInitialFormState.d.ts +2 -2
- package/mobile/bundle/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
- package/mobile/bundle/hooks/useRegions.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/validators.d.ts +1 -1
- package/mobile/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/mobile/dist/components/CreditForm/creditFormStepsData.js +2 -2
- package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/dist/components/CreditForm/getInitialFormState.d.ts +2 -2
- package/mobile/dist/components/CreditForm/getInitialFormState.js +2 -2
- package/mobile/dist/components/CreditForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -21
- package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
- package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +31 -0
- package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
- package/mobile/dist/hooks/useRegions.d.ts +2 -0
- package/mobile/dist/hooks/useRegions.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js +38 -0
- package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js +14 -0
- package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/getField.js +4 -1
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +8 -6
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/validators.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/validators.js +6 -5
- package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/mobile/dist/ui-kit/YandexMap/YandexMap.js +12 -2
- package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/lib/components/CreditForm/creditFormStepsData.js +2 -2
- package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/lib/components/CreditForm/getInitialFormState.d.ts +2 -2
- package/mobile/lib/components/CreditForm/getInitialFormState.js +2 -2
- package/mobile/lib/components/CreditForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +9 -22
- package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
- package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +28 -0
- package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
- package/mobile/lib/hooks/useRegions.d.ts +2 -0
- package/mobile/lib/hooks/useRegions.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.js +36 -0
- package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js +12 -0
- package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/getField.js +4 -1
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +8 -6
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/validators.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/validators.js +5 -5
- package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/mobile/lib/ui-kit/YandexMap/YandexMap.js +12 -2
- package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/src/components/CreditForm/creditFormStepsData.tsx +2 -2
- package/mobile/src/components/CreditForm/getInitialFormState.tsx +4 -4
- package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +9 -25
- package/mobile/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +49 -0
- package/mobile/src/hooks/useRegions.ts +2 -0
- package/mobile/src/ui-kit/FormField/Fields/RetailAddressField.tsx +66 -0
- package/mobile/src/ui-kit/FormField/Fields/RetailRegionField.tsx +24 -0
- package/mobile/src/ui-kit/FormField/NameFieldDef.ts +3 -1
- package/mobile/src/ui-kit/FormField/getField.tsx +4 -1
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +8 -6
- package/mobile/src/ui-kit/FormField/validators.ts +6 -6
- package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +59 -45
- package/package.json +1 -1
- package/src/components/CreditForm/creditFormStepsData.tsx +2 -2
- package/src/components/CreditForm/getInitialFormState.tsx +4 -4
- package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +9 -25
- package/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +49 -0
- package/src/hooks/useRegions.ts +2 -0
- package/src/ui-kit/FormField/Fields/RetailAddressField.tsx +66 -0
- package/src/ui-kit/FormField/Fields/RetailRegionField.tsx +24 -0
- package/src/ui-kit/FormField/NameFieldDef.ts +3 -1
- package/src/ui-kit/FormField/getField.tsx +4 -1
- package/src/ui-kit/FormField/getObjectValidator.tsx +8 -6
- package/src/ui-kit/FormField/validators.ts +6 -6
- package/src/ui-kit/YandexMap/YandexMap.tsx +59 -45
|
@@ -196,10 +196,10 @@ export const stepsSectionsMap: SectionsProps[][] = [
|
|
|
196
196
|
inputs: [],
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
|
-
inputs: [{ fieldType: 'common', name: '
|
|
199
|
+
inputs: [{ fieldType: 'common', name: 'regionRetail', required: true }],
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
|
-
inputs: [{ fieldType: 'common', name: '
|
|
202
|
+
inputs: [{ fieldType: 'common', name: 'addressRetail', required: true }],
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
title: 'Код представителя Банка',
|
|
@@ -55,8 +55,8 @@ export interface FormStateMap {
|
|
|
55
55
|
creditInRshbCd?: string;
|
|
56
56
|
};
|
|
57
57
|
5: {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
regionRetail?: string;
|
|
59
|
+
addressRetail?: string;
|
|
60
60
|
bankEmployeeCode?: string;
|
|
61
61
|
};
|
|
62
62
|
}
|
|
@@ -116,8 +116,8 @@ const formStateMap: FormStateMap = {
|
|
|
116
116
|
creditInRshbCd: '',
|
|
117
117
|
},
|
|
118
118
|
5: {
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
regionRetail: '',
|
|
120
|
+
addressRetail: '',
|
|
121
121
|
bankEmployeeCode: '',
|
|
122
122
|
},
|
|
123
123
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useForm } from '../../hooks/useForm';
|
|
4
4
|
import { type VNode } from '../../model/VNode';
|
|
5
5
|
import { ClientOnly } from '../../ui-kit/ClientOnly';
|
|
@@ -12,6 +12,7 @@ import { renderButtonsGroup } from './renderButtonsGroup';
|
|
|
12
12
|
import { renderDescriptionBlock } from './renderDescriptionBlock';
|
|
13
13
|
import { renderFiltrationForm, type RenderFiltrationFormOptions } from './renderFiltrationForm';
|
|
14
14
|
import { renderHeading } from './renderHeading';
|
|
15
|
+
import { useOfficesAtmsMapData } from './useOfficesAtmsMapData';
|
|
15
16
|
import { type BalloonContent } from './YandexMapProps';
|
|
16
17
|
|
|
17
18
|
const defaultEmptyFunction = () => void 0;
|
|
@@ -52,30 +53,13 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
52
53
|
const onlyOffice = title?.includes('Офис');
|
|
53
54
|
const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE);
|
|
54
55
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
63
|
-
content: getBalloon(_),
|
|
64
|
-
})),
|
|
65
|
-
..._filteredRemoteWorkplaces.map((_: RemoteWorkplace) => ({
|
|
66
|
-
type: 'workplaces',
|
|
67
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
68
|
-
content: getBalloonRemoteWorkplaces({
|
|
69
|
-
address: _.address,
|
|
70
|
-
workScheduleDescription: _.workScheduleDescription,
|
|
71
|
-
}),
|
|
72
|
-
})),
|
|
73
|
-
].filter((_) => _.coords && _.coords.length === 2);
|
|
74
|
-
|
|
75
|
-
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
76
|
-
|
|
77
|
-
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
78
|
-
}, [data, remoteWorkplaces, filtrationState]);
|
|
56
|
+
const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
|
|
57
|
+
data,
|
|
58
|
+
remoteWorkplaces,
|
|
59
|
+
filtrationState,
|
|
60
|
+
getBalloon,
|
|
61
|
+
getBalloonRemoteWorkplaces,
|
|
62
|
+
});
|
|
79
63
|
|
|
80
64
|
const [activeButton, setActiveButton] = useState('all');
|
|
81
65
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useMemo } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { filterItems } from './OfficesAtmsMapLayout';
|
|
3
|
+
import { type Atm, type Branch, type RemoteWorkplace } from './OfficesAtmsMapProps';
|
|
4
|
+
import { type BalloonContent } from './YandexMapProps';
|
|
5
|
+
|
|
6
|
+
const defaultEmptyFunction = () => void 0;
|
|
7
|
+
|
|
8
|
+
interface UseOfficesAtmsMapDataProps {
|
|
9
|
+
data: (Branch | RemoteWorkplace)[];
|
|
10
|
+
remoteWorkplaces?: (Branch | RemoteWorkplace)[];
|
|
11
|
+
filtrationState?: Record<string, boolean>;
|
|
12
|
+
getBalloon?: (item: Branch | Atm | RemoteWorkplace) => BalloonContent | undefined;
|
|
13
|
+
getBalloonRemoteWorkplaces?: (item: RemoteWorkplace) => BalloonContent | undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const useOfficesAtmsMapData = ({
|
|
17
|
+
data,
|
|
18
|
+
remoteWorkplaces = [],
|
|
19
|
+
filtrationState = {},
|
|
20
|
+
getBalloon = defaultEmptyFunction,
|
|
21
|
+
getBalloonRemoteWorkplaces = defaultEmptyFunction,
|
|
22
|
+
}: UseOfficesAtmsMapDataProps) => {
|
|
23
|
+
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
24
|
+
const _filteredItems = filterItems(data, filtrationState);
|
|
25
|
+
const _filteredRemoteWorkplaces = filterItems(remoteWorkplaces, filtrationState);
|
|
26
|
+
|
|
27
|
+
const _points = [
|
|
28
|
+
..._filteredItems.map((_) => ({
|
|
29
|
+
type: 'offices',
|
|
30
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
31
|
+
content: getBalloon(_),
|
|
32
|
+
})),
|
|
33
|
+
..._filteredRemoteWorkplaces.map((_: RemoteWorkplace) => ({
|
|
34
|
+
type: 'workplaces',
|
|
35
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
36
|
+
content: getBalloonRemoteWorkplaces({
|
|
37
|
+
address: _.address,
|
|
38
|
+
workScheduleDescription: _.workScheduleDescription,
|
|
39
|
+
}),
|
|
40
|
+
})),
|
|
41
|
+
].filter((_) => _.coords && _.coords.length === 2);
|
|
42
|
+
|
|
43
|
+
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
44
|
+
|
|
45
|
+
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
46
|
+
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
47
|
+
|
|
48
|
+
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
49
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { getOfficePoint } from '../../../components/OfficesAtmsMap/renderOfficeCard';
|
|
4
|
+
import { useOfficesAtmsMapData } from '../../../components/OfficesAtmsMap/useOfficesAtmsMapData';
|
|
5
|
+
import { type Branch } from '../../../hooks/useBranches';
|
|
6
|
+
import { useBranchesByRegions } from '../../../hooks/useBranchesByRegions';
|
|
7
|
+
import { ClientOnly } from '../../ClientOnly';
|
|
8
|
+
import { SelectControl } from '../../Select/SelectControl';
|
|
9
|
+
import { YandexMap } from '../../YandexMap/YandexMap';
|
|
10
|
+
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
11
|
+
import { validatorObj } from '../getObjectValidator';
|
|
12
|
+
import { getValidation } from '../getValidation';
|
|
13
|
+
|
|
14
|
+
type RegionFieldProps = CustomFieldProps;
|
|
15
|
+
|
|
16
|
+
export const RetailAddressField = JSX<RegionFieldProps>(({ field, input }) => {
|
|
17
|
+
const fieldRegion = field('regionRetail');
|
|
18
|
+
const fieldBranch = field('addressRetail');
|
|
19
|
+
const regions = useBranchesByRegions();
|
|
20
|
+
const regionKey = fieldRegion?.value?.key as string;
|
|
21
|
+
const selectedRegion = regions.find(({ region }) => region === regionKey);
|
|
22
|
+
|
|
23
|
+
const isLoad = !regions;
|
|
24
|
+
|
|
25
|
+
const regionText = fieldRegion?.value?.text as string;
|
|
26
|
+
const addressBranchRetail = useBranchesByRegions()?.find(
|
|
27
|
+
(_) => _?.region === regionText,
|
|
28
|
+
)?.branches;
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (fieldRegion?.value?.key !== '') {
|
|
32
|
+
field?.('addressRetail')?.onChange?.('');
|
|
33
|
+
}
|
|
34
|
+
}, [fieldRegion?.value]);
|
|
35
|
+
|
|
36
|
+
const { points } = useOfficesAtmsMapData({
|
|
37
|
+
data: (selectedRegion?.branches as Branch[]) || [],
|
|
38
|
+
filtrationState: {},
|
|
39
|
+
getBalloon: getOfficePoint,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div>
|
|
44
|
+
<SelectControl
|
|
45
|
+
label="Адрес отделения"
|
|
46
|
+
placeholder="Выберите отделение"
|
|
47
|
+
options={(addressBranchRetail || []).map(({ address = '' }) => ({
|
|
48
|
+
key: address,
|
|
49
|
+
text: address,
|
|
50
|
+
}))}
|
|
51
|
+
{...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required)}
|
|
52
|
+
isSearch={true}
|
|
53
|
+
/>
|
|
54
|
+
<div className="h-[600px]">
|
|
55
|
+
<ClientOnly>
|
|
56
|
+
<YandexMap
|
|
57
|
+
points={points}
|
|
58
|
+
isLoad={isLoad}
|
|
59
|
+
className="h-full"
|
|
60
|
+
selectedAddress={fieldBranch?.value?.text}
|
|
61
|
+
/>
|
|
62
|
+
</ClientOnly>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useMemo } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { useBranchesByRegions } from '../../../hooks/useBranchesByRegions';
|
|
4
|
+
import { SelectControl } from '../../Select/SelectControl';
|
|
5
|
+
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
6
|
+
import { validatorObj } from '../getObjectValidator';
|
|
7
|
+
import { getValidation } from '../getValidation';
|
|
8
|
+
|
|
9
|
+
export const RetailRegionField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
10
|
+
const regions = useBranchesByRegions();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<SelectControl
|
|
14
|
+
label="Филиал банка"
|
|
15
|
+
placeholder="Выберите филиал банка"
|
|
16
|
+
isSearch={true}
|
|
17
|
+
options={useMemo(
|
|
18
|
+
() => regions?.map(({ region = '' }) => ({ key: region, text: region })),
|
|
19
|
+
[regions],
|
|
20
|
+
)}
|
|
21
|
+
{...getValidation(field('regionRetail'), validatorObj.regionRetail, input?.required)}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
});
|
|
@@ -68,6 +68,8 @@ import { PosTerminalField } from './Fields/PosTerminalField';
|
|
|
68
68
|
import { ProductField } from './Fields/ProductField';
|
|
69
69
|
import { RegionField } from './Fields/RegionField';
|
|
70
70
|
import { RegionPremiumField } from './Fields/RegionPremiumField';
|
|
71
|
+
import { RetailAddressField } from './Fields/RetailAddressField';
|
|
72
|
+
import { RetailRegionField } from './Fields/RetailRegionField';
|
|
71
73
|
import { RetirementIncomeField } from './Fields/RetirementIncomeField';
|
|
72
74
|
import { SecondaryPhoneField } from './Fields/SecondaryPhoneField';
|
|
73
75
|
import { ServiceDirectionField } from './Fields/ServiceDirectionField';
|
|
@@ -163,7 +165,6 @@ export const getField =
|
|
|
163
165
|
armyIdFlg: <ArmyIdFlgField field={field} input={input} />,
|
|
164
166
|
dulSerie: <DulSerieField field={field} input={input} />,
|
|
165
167
|
dulNumber: <DulNumberField field={field} input={input} />,
|
|
166
|
-
// eslint-disable-next-line max-lines
|
|
167
168
|
dulIssueDateField: <DulIssueDateField field={field} input={input} />,
|
|
168
169
|
dulSubdivisionCode: <DulSubdivisionCodeField field={field} input={input} />,
|
|
169
170
|
dulIssuedBy: <DulIssuedByField field={field} input={input} />,
|
|
@@ -180,6 +181,8 @@ export const getField =
|
|
|
180
181
|
creditInRshbCd: <CreditInRshbCdField field={field} input={input} />,
|
|
181
182
|
bankEmployeeCode: <BankEmpoleeCodeField field={field} input={input} />,
|
|
182
183
|
partInBusiness: <PartInBusinessField field={field} input={input} />,
|
|
184
|
+
regionRetail: <RetailRegionField field={field} input={input} />,
|
|
185
|
+
addressRetail: <RetailAddressField field={field} input={input} />,
|
|
183
186
|
};
|
|
184
187
|
|
|
185
188
|
return isRenderField({ input, field }) ? (
|
|
@@ -21,8 +21,8 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
21
21
|
surname: nameValidator('Укажите свою фамилию'),
|
|
22
22
|
name: nameValidator('Укажите своё имя'),
|
|
23
23
|
middleName: nameValidator('Укажите своё отчество'),
|
|
24
|
-
region: defaultSelectValidator,
|
|
25
|
-
addressBranch: defaultSelectValidator,
|
|
24
|
+
region: defaultSelectValidator(),
|
|
25
|
+
addressBranch: defaultSelectValidator(),
|
|
26
26
|
phone: phoneValidator('Укажите номер телефона'),
|
|
27
27
|
secondaryPhone: phoneValidator('Укажите номер телефона'),
|
|
28
28
|
birthday: defaultValidator('Укажите дату рождения'),
|
|
@@ -54,10 +54,10 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
54
54
|
partnerComments: defaultValidator(),
|
|
55
55
|
collectionCount: defaultValidator(),
|
|
56
56
|
comment: defaultValidator(),
|
|
57
|
-
acquiringType: defaultSelectValidator,
|
|
58
|
-
feedbackMethod: defaultSelectValidator,
|
|
59
|
-
serviceType: defaultSelectValidator,
|
|
60
|
-
serviceDirection: defaultSelectValidator,
|
|
57
|
+
acquiringType: defaultSelectValidator(),
|
|
58
|
+
feedbackMethod: defaultSelectValidator(),
|
|
59
|
+
serviceType: defaultSelectValidator(),
|
|
60
|
+
serviceDirection: defaultSelectValidator(),
|
|
61
61
|
meetingDay: defaultValidator(),
|
|
62
62
|
product: defaultValidator(),
|
|
63
63
|
localities: defaultValidator(),
|
|
@@ -91,6 +91,8 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
91
91
|
legalEntityName: defaultValidator(),
|
|
92
92
|
bankEmployeeCode: defaultValidator(),
|
|
93
93
|
partInBusiness: defaultValidator(),
|
|
94
|
+
regionRetail: defaultSelectValidator('Выберите филиал банка'),
|
|
95
|
+
addressRetail: defaultSelectValidator('Выберите адрес банка'),
|
|
94
96
|
};
|
|
95
97
|
|
|
96
98
|
export const getObjectValidator = (inputs: FieldDef[]): Record<string, Validator> => {
|
|
@@ -4,22 +4,22 @@ import { validator } from '../../validation/validator';
|
|
|
4
4
|
|
|
5
5
|
const ERROR_MESSAGE = 'Некорректно заполненное поле';
|
|
6
6
|
|
|
7
|
-
export const defaultValidator = (errorMsg?: string) =>
|
|
8
|
-
required(errorMsg ? errorMsg : ERROR_MESSAGE);
|
|
7
|
+
export const defaultValidator = (errorMsg?: string) => required(errorMsg ?? ERROR_MESSAGE);
|
|
9
8
|
|
|
10
|
-
export const defaultSelectValidator =
|
|
9
|
+
export const defaultSelectValidator = (errorMsg?: string) =>
|
|
10
|
+
validator((_) => _?.key && _?.key !== '')(errorMsg ?? ERROR_MESSAGE);
|
|
11
11
|
|
|
12
12
|
export const jobNumberValidator = (errorMsg?: string) =>
|
|
13
13
|
validator((_) => typeof _ === 'string' && _.length > 0 && _.length <= 2)(
|
|
14
|
-
errorMsg
|
|
14
|
+
errorMsg ?? ERROR_MESSAGE,
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
export const nameValidator = (errorMsg?: string) =>
|
|
18
|
-
validator((_) => typeof _ === 'string' && _.length > 1)(errorMsg
|
|
18
|
+
validator((_) => typeof _ === 'string' && _.length > 1)(errorMsg ?? ERROR_MESSAGE);
|
|
19
19
|
|
|
20
20
|
export const lengthStringValidator = (maxLength: number, errorMsg?: string) =>
|
|
21
21
|
validator((_) => typeof _ === 'string' && _.length >= 1 && _.length <= maxLength)(
|
|
22
|
-
errorMsg
|
|
22
|
+
errorMsg ?? ERROR_MESSAGE,
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
export const serieValidator = (errorMsg: string) =>
|
|
@@ -16,6 +16,7 @@ interface YandexMapProps {
|
|
|
16
16
|
className?: string;
|
|
17
17
|
zoom?: number;
|
|
18
18
|
isLoad?: boolean;
|
|
19
|
+
selectedAddress?: string;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
|
|
@@ -24,57 +25,70 @@ const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
|
|
|
24
25
|
// Сейчас реализован поиск среди тестовых данных
|
|
25
26
|
// TODO: Также выяснить что делать когда ничего не найдено
|
|
26
27
|
// TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
|
|
27
|
-
export const YandexMap = JSX<YandexMapProps>(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
export const YandexMap = JSX<YandexMapProps>(
|
|
29
|
+
({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
|
|
30
|
+
const map = useRef<ymaps.Map | null>(null);
|
|
31
|
+
|
|
32
|
+
const yandexMaps = useYandexMaps();
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (map.current) {
|
|
36
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
37
|
+
} else {
|
|
38
|
+
yandexMaps?.ready(() => {
|
|
39
|
+
// Ready function may be called few times, but must be called once
|
|
40
|
+
if (map.current) {
|
|
41
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
42
|
+
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
map.current = new yandexMaps.Map('map', {
|
|
47
|
+
center: getCenterPoint(points),
|
|
48
|
+
zoom,
|
|
49
|
+
controls: [],
|
|
50
|
+
suppressMapOpenBlock: true,
|
|
51
|
+
});
|
|
43
52
|
|
|
44
|
-
|
|
45
|
-
center: getCenterPoint(points),
|
|
46
|
-
zoom,
|
|
47
|
-
controls: [],
|
|
48
|
-
suppressMapOpenBlock: true,
|
|
53
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
49
54
|
});
|
|
55
|
+
}
|
|
56
|
+
}, [yandexMaps, points, zoom, isLoad, selectedAddress]);
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (map.current && selectedAddress) {
|
|
60
|
+
yandexMaps?.geocode(selectedAddress).then((res) => {
|
|
61
|
+
const firstGeoObject = res.geoObjects.get(0);
|
|
62
|
+
const coords = firstGeoObject.geometry.getCoordinates() as number[];
|
|
63
|
+
map.current.setCenter(coords);
|
|
64
|
+
map.current.setZoom(18);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}, [selectedAddress]);
|
|
68
|
+
|
|
69
|
+
if (!yandexMaps) {
|
|
70
|
+
return null;
|
|
53
71
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
)}
|
|
70
|
-
>
|
|
71
|
-
<ZoomButton yandexMaps={map} />
|
|
72
|
-
<ZoomButton yandexMaps={map} direction="out" />
|
|
72
|
+
|
|
73
|
+
const zIndex = 'z-10';
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div id="map" className={style('relative', 'w-full', className)}>
|
|
77
|
+
{isLoad ? <Loader /> : null}
|
|
78
|
+
<div
|
|
79
|
+
className={style(
|
|
80
|
+
'absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md',
|
|
81
|
+
zIndex,
|
|
82
|
+
)}
|
|
83
|
+
>
|
|
84
|
+
<ZoomButton yandexMaps={map} />
|
|
85
|
+
<ZoomButton yandexMaps={map} direction="out" />
|
|
86
|
+
</div>
|
|
87
|
+
{renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))}
|
|
73
88
|
</div>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
});
|
|
89
|
+
);
|
|
90
|
+
},
|
|
91
|
+
);
|
|
78
92
|
|
|
79
93
|
const getCenterPoint = (points?: BalloonPoints[]) => {
|
|
80
94
|
const centerCoords = [
|
package/package.json
CHANGED
|
@@ -196,10 +196,10 @@ export const stepsSectionsMap: SectionsProps[][] = [
|
|
|
196
196
|
inputs: [],
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
|
-
inputs: [{ fieldType: 'common', name: '
|
|
199
|
+
inputs: [{ fieldType: 'common', name: 'regionRetail', required: true }],
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
|
-
inputs: [{ fieldType: 'common', name: '
|
|
202
|
+
inputs: [{ fieldType: 'common', name: 'addressRetail', required: true }],
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
title: 'Код представителя Банка',
|
|
@@ -55,8 +55,8 @@ export interface FormStateMap {
|
|
|
55
55
|
creditInRshbCd?: string;
|
|
56
56
|
};
|
|
57
57
|
5: {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
regionRetail?: string;
|
|
59
|
+
addressRetail?: string;
|
|
60
60
|
bankEmployeeCode?: string;
|
|
61
61
|
};
|
|
62
62
|
}
|
|
@@ -116,8 +116,8 @@ const formStateMap: FormStateMap = {
|
|
|
116
116
|
creditInRshbCd: '',
|
|
117
117
|
},
|
|
118
118
|
5: {
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
regionRetail: '',
|
|
120
|
+
addressRetail: '',
|
|
121
121
|
bankEmployeeCode: '',
|
|
122
122
|
},
|
|
123
123
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import {
|
|
2
|
+
import { useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useForm } from '../../hooks/useForm';
|
|
4
4
|
import { type VNode } from '../../model/VNode';
|
|
5
5
|
import { ClientOnly } from '../../ui-kit/ClientOnly';
|
|
@@ -12,6 +12,7 @@ import { renderButtonsGroup } from './renderButtonsGroup';
|
|
|
12
12
|
import { renderDescriptionBlock } from './renderDescriptionBlock';
|
|
13
13
|
import { renderFiltrationForm, type RenderFiltrationFormOptions } from './renderFiltrationForm';
|
|
14
14
|
import { renderHeading } from './renderHeading';
|
|
15
|
+
import { useOfficesAtmsMapData } from './useOfficesAtmsMapData';
|
|
15
16
|
import { type BalloonContent } from './YandexMapProps';
|
|
16
17
|
|
|
17
18
|
const defaultEmptyFunction = () => void 0;
|
|
@@ -52,30 +53,13 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
52
53
|
const onlyOffice = title?.includes('Офис');
|
|
53
54
|
const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE);
|
|
54
55
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
63
|
-
content: getBalloon(_),
|
|
64
|
-
})),
|
|
65
|
-
..._filteredRemoteWorkplaces.map((_: RemoteWorkplace) => ({
|
|
66
|
-
type: 'workplaces',
|
|
67
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
68
|
-
content: getBalloonRemoteWorkplaces({
|
|
69
|
-
address: _.address,
|
|
70
|
-
workScheduleDescription: _.workScheduleDescription,
|
|
71
|
-
}),
|
|
72
|
-
})),
|
|
73
|
-
].filter((_) => _.coords && _.coords.length === 2);
|
|
74
|
-
|
|
75
|
-
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
76
|
-
|
|
77
|
-
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
78
|
-
}, [data, remoteWorkplaces, filtrationState]);
|
|
56
|
+
const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
|
|
57
|
+
data,
|
|
58
|
+
remoteWorkplaces,
|
|
59
|
+
filtrationState,
|
|
60
|
+
getBalloon,
|
|
61
|
+
getBalloonRemoteWorkplaces,
|
|
62
|
+
});
|
|
79
63
|
|
|
80
64
|
const [activeButton, setActiveButton] = useState('all');
|
|
81
65
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useMemo } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { filterItems } from './OfficesAtmsMapLayout';
|
|
3
|
+
import { type Atm, type Branch, type RemoteWorkplace } from './OfficesAtmsMapProps';
|
|
4
|
+
import { type BalloonContent } from './YandexMapProps';
|
|
5
|
+
|
|
6
|
+
const defaultEmptyFunction = () => void 0;
|
|
7
|
+
|
|
8
|
+
interface UseOfficesAtmsMapDataProps {
|
|
9
|
+
data: (Branch | RemoteWorkplace)[];
|
|
10
|
+
remoteWorkplaces?: (Branch | RemoteWorkplace)[];
|
|
11
|
+
filtrationState?: Record<string, boolean>;
|
|
12
|
+
getBalloon?: (item: Branch | Atm | RemoteWorkplace) => BalloonContent | undefined;
|
|
13
|
+
getBalloonRemoteWorkplaces?: (item: RemoteWorkplace) => BalloonContent | undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const useOfficesAtmsMapData = ({
|
|
17
|
+
data,
|
|
18
|
+
remoteWorkplaces = [],
|
|
19
|
+
filtrationState = {},
|
|
20
|
+
getBalloon = defaultEmptyFunction,
|
|
21
|
+
getBalloonRemoteWorkplaces = defaultEmptyFunction,
|
|
22
|
+
}: UseOfficesAtmsMapDataProps) => {
|
|
23
|
+
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
24
|
+
const _filteredItems = filterItems(data, filtrationState);
|
|
25
|
+
const _filteredRemoteWorkplaces = filterItems(remoteWorkplaces, filtrationState);
|
|
26
|
+
|
|
27
|
+
const _points = [
|
|
28
|
+
..._filteredItems.map((_) => ({
|
|
29
|
+
type: 'offices',
|
|
30
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
31
|
+
content: getBalloon(_),
|
|
32
|
+
})),
|
|
33
|
+
..._filteredRemoteWorkplaces.map((_: RemoteWorkplace) => ({
|
|
34
|
+
type: 'workplaces',
|
|
35
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
36
|
+
content: getBalloonRemoteWorkplaces({
|
|
37
|
+
address: _.address,
|
|
38
|
+
workScheduleDescription: _.workScheduleDescription,
|
|
39
|
+
}),
|
|
40
|
+
})),
|
|
41
|
+
].filter((_) => _.coords && _.coords.length === 2);
|
|
42
|
+
|
|
43
|
+
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
44
|
+
|
|
45
|
+
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
46
|
+
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
47
|
+
|
|
48
|
+
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
49
|
+
};
|