@redneckz/wildless-cms-uni-blocks 0.14.573 → 0.14.574
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/bundle.umd.js +73 -61
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +2 -0
- package/bundle/components/OfficesAtmsMap/filters.d.ts +44 -0
- package/bundle/components/OfficesAtmsMap/renderButtonsGroup.d.ts +3 -0
- package/bundle/components/OfficesAtmsMap/renderFiltrationForm.d.ts +10 -4
- package/bundle/components/OfficesAtmsMap/renderHeading.d.ts +2 -0
- package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +2 -0
- package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +21 -25
- package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/dist/components/OfficesAtmsMap/OfficesMap.js +1 -29
- package/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/dist/components/OfficesAtmsMap/filters.d.ts +44 -0
- package/dist/components/OfficesAtmsMap/filters.js +46 -0
- package/dist/components/OfficesAtmsMap/filters.js.map +1 -0
- package/dist/components/OfficesAtmsMap/renderButtonsGroup.d.ts +3 -0
- package/dist/components/OfficesAtmsMap/renderButtonsGroup.js +21 -0
- package/dist/components/OfficesAtmsMap/renderButtonsGroup.js.map +1 -0
- package/dist/components/OfficesAtmsMap/renderFiltrationForm.d.ts +10 -4
- package/dist/components/OfficesAtmsMap/renderFiltrationForm.js +2 -21
- package/dist/components/OfficesAtmsMap/renderFiltrationForm.js.map +1 -1
- package/dist/components/OfficesAtmsMap/renderHeading.d.ts +2 -0
- package/dist/components/OfficesAtmsMap/renderHeading.js +8 -0
- package/dist/components/OfficesAtmsMap/renderHeading.js.map +1 -0
- package/dist/ui-kit/YandexMap/renderClusterer.js +4 -1
- package/dist/ui-kit/YandexMap/renderClusterer.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +2 -0
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +16 -22
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/lib/components/OfficesAtmsMap/OfficesMap.js +1 -29
- package/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/lib/components/OfficesAtmsMap/filters.d.ts +44 -0
- package/lib/components/OfficesAtmsMap/filters.js +44 -0
- package/lib/components/OfficesAtmsMap/filters.js.map +1 -0
- package/lib/components/OfficesAtmsMap/renderButtonsGroup.d.ts +2 -0
- package/lib/components/OfficesAtmsMap/renderButtonsGroup.js +18 -0
- package/lib/components/OfficesAtmsMap/renderButtonsGroup.js.map +1 -0
- package/lib/components/OfficesAtmsMap/renderFiltrationForm.d.ts +10 -4
- package/lib/components/OfficesAtmsMap/renderFiltrationForm.js +2 -21
- package/lib/components/OfficesAtmsMap/renderFiltrationForm.js.map +1 -1
- package/lib/components/OfficesAtmsMap/renderHeading.d.ts +1 -0
- package/lib/components/OfficesAtmsMap/renderHeading.js +5 -0
- package/lib/components/OfficesAtmsMap/renderHeading.js.map +1 -0
- package/lib/ui-kit/YandexMap/renderClusterer.js +4 -1
- package/lib/ui-kit/YandexMap/renderClusterer.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +73 -61
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +2 -0
- package/mobile/bundle/components/OfficesAtmsMap/filters.d.ts +44 -0
- package/mobile/bundle/components/OfficesAtmsMap/renderButtonsGroup.d.ts +3 -0
- package/mobile/bundle/components/OfficesAtmsMap/renderFiltrationForm.d.ts +10 -4
- package/mobile/bundle/components/OfficesAtmsMap/renderHeading.d.ts +2 -0
- package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +2 -0
- package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +21 -25
- package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js +1 -29
- package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/filters.d.ts +44 -0
- package/mobile/dist/components/OfficesAtmsMap/filters.js +46 -0
- package/mobile/dist/components/OfficesAtmsMap/filters.js.map +1 -0
- package/mobile/dist/components/OfficesAtmsMap/renderButtonsGroup.d.ts +3 -0
- package/mobile/dist/components/OfficesAtmsMap/renderButtonsGroup.js +21 -0
- package/mobile/dist/components/OfficesAtmsMap/renderButtonsGroup.js.map +1 -0
- package/mobile/dist/components/OfficesAtmsMap/renderFiltrationForm.d.ts +10 -4
- package/mobile/dist/components/OfficesAtmsMap/renderFiltrationForm.js +2 -21
- package/mobile/dist/components/OfficesAtmsMap/renderFiltrationForm.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderHeading.d.ts +2 -0
- package/mobile/dist/components/OfficesAtmsMap/renderHeading.js +8 -0
- package/mobile/dist/components/OfficesAtmsMap/renderHeading.js.map +1 -0
- package/mobile/dist/ui-kit/YandexMap/renderClusterer.js +4 -1
- package/mobile/dist/ui-kit/YandexMap/renderClusterer.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +2 -0
- package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +16 -22
- package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js +1 -29
- package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/filters.d.ts +44 -0
- package/mobile/lib/components/OfficesAtmsMap/filters.js +44 -0
- package/mobile/lib/components/OfficesAtmsMap/filters.js.map +1 -0
- package/mobile/lib/components/OfficesAtmsMap/renderButtonsGroup.d.ts +3 -0
- package/mobile/lib/components/OfficesAtmsMap/renderButtonsGroup.js +18 -0
- package/mobile/lib/components/OfficesAtmsMap/renderButtonsGroup.js.map +1 -0
- package/mobile/lib/components/OfficesAtmsMap/renderFiltrationForm.d.ts +10 -4
- package/mobile/lib/components/OfficesAtmsMap/renderFiltrationForm.js +2 -21
- package/mobile/lib/components/OfficesAtmsMap/renderFiltrationForm.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderHeading.d.ts +2 -0
- package/mobile/lib/components/OfficesAtmsMap/renderHeading.js +5 -0
- package/mobile/lib/components/OfficesAtmsMap/renderHeading.js.map +1 -0
- package/mobile/lib/ui-kit/YandexMap/renderClusterer.js +4 -1
- package/mobile/lib/ui-kit/YandexMap/renderClusterer.js.map +1 -1
- package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +22 -58
- package/mobile/src/components/OfficesAtmsMap/OfficesMap.tsx +0 -47
- package/mobile/src/components/OfficesAtmsMap/filters.ts +56 -0
- package/mobile/src/components/OfficesAtmsMap/renderButtonsGroup.tsx +43 -0
- package/mobile/src/components/OfficesAtmsMap/renderFiltrationForm.tsx +14 -26
- package/mobile/src/components/OfficesAtmsMap/renderHeading.tsx +15 -0
- package/mobile/src/ui-kit/YandexMap/renderClusterer.ts +6 -2
- package/package.json +1 -1
- package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +22 -58
- package/src/components/OfficesAtmsMap/OfficesMap.tsx +0 -47
- package/src/components/OfficesAtmsMap/filters.ts +56 -0
- package/src/components/OfficesAtmsMap/renderButtonsGroup.tsx +43 -0
- package/src/components/OfficesAtmsMap/renderFiltrationForm.tsx +14 -26
- package/src/components/OfficesAtmsMap/renderHeading.tsx +15 -0
- package/src/ui-kit/YandexMap/renderClusterer.ts +6 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderHeading.js","sourceRoot":"","sources":["../../../src/components/OfficesAtmsMap/renderHeading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAE,WAAoB,EAAE,EAAE,CAAC,CACrE,cAAK,SAAS,EAAC,yCAAyC,YACtD,MAAC,OAAO,IAAC,WAAW,EAAC,IAAI,aACvB,eAAM,wBAAwB,EAAE,IAAI,YAAG,KAAK,GAAQ,EACnD,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,IAAI,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAC,qBAAqB,YAC9C,eAAM,wBAAwB,EAAE,IAAI,YAAG,KAAK,WAAW,GAAG,GAAQ,GAC7D,CACR,CAAC,CAAC,CAAC,IAAI,IACA,GACN,CACP,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
|
|
2
2
|
const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
|
|
3
3
|
export function renderClusterer({ yandexMaps, map, points, isLoad, }) {
|
|
4
|
-
if (isLoad || !points
|
|
4
|
+
if (isLoad || !points) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
7
|
map.geoObjects.removeAll();
|
|
8
|
+
if (!points.length) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
8
11
|
const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
|
|
9
12
|
const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
|
|
10
13
|
if (points.length && points.every((_) => 'type' in _)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderClusterer.js","sourceRoot":"","sources":["../../../src/ui-kit/YandexMap/renderClusterer.ts"],"names":[],"mappings":"AAMA,MAAM,oBAAoB,GAAG,iCAAiC,CAAC;AAC/D,MAAM,0BAA0B,GAAG,uCAAuC,CAAC;AAE3E,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,GAAG,EACH,MAAM,EACN,MAAM,GAMP;IACC,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"renderClusterer.js","sourceRoot":"","sources":["../../../src/ui-kit/YandexMap/renderClusterer.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,21 +2,19 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import { useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useForm } from '../../hooks/useForm';
|
|
4
4
|
import { type VNode } from '../../model/VNode';
|
|
5
|
-
import { Button } from '../../ui-kit/Button/Button';
|
|
6
5
|
import { ClientOnly } from '../../ui-kit/ClientOnly';
|
|
7
|
-
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
8
|
-
import { Text } from '../../ui-kit/Text/Text';
|
|
9
6
|
import { YandexMap } from '../../ui-kit/YandexMap/YandexMap';
|
|
10
|
-
import { getVersion } from '../../utils/getVersion';
|
|
11
7
|
import { style } from '../../utils/style';
|
|
8
|
+
import { FILTRATION_LABELS, FILTRATION_PREDICATES, INITIAL_FILTRATION_STATE } from './filters';
|
|
12
9
|
import { type AtmsDef } from './OfficesAtmsMapContent';
|
|
13
10
|
import { type Atm, type Branch, type RemoteWorkplace } from './OfficesAtmsMapProps';
|
|
11
|
+
import { renderButtonsGroup } from './renderButtonsGroup';
|
|
14
12
|
import { renderDescriptionBlock } from './renderDescriptionBlock';
|
|
15
|
-
import { renderFiltrationForm } from './renderFiltrationForm';
|
|
13
|
+
import { renderFiltrationForm, type RenderFiltrationFormOptions } from './renderFiltrationForm';
|
|
14
|
+
import { renderHeading } from './renderHeading';
|
|
16
15
|
import { type BalloonContent } from './YandexMapProps';
|
|
17
16
|
|
|
18
17
|
const defaultEmptyFunction = () => void 0;
|
|
19
|
-
const defaultFilterItems = () => [];
|
|
20
18
|
|
|
21
19
|
export type InitFilterState = Record<string, boolean>;
|
|
22
20
|
|
|
@@ -46,15 +44,13 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
46
44
|
remoteWorkplaces = [],
|
|
47
45
|
renderCard = defaultEmptyFunction,
|
|
48
46
|
renderRemoteWorkplaceCard = defaultEmptyFunction,
|
|
49
|
-
filterItems = defaultFilterItems,
|
|
50
47
|
getBalloon = defaultEmptyFunction,
|
|
51
48
|
getBalloonRemoteWorkplaces = defaultEmptyFunction,
|
|
52
|
-
initFilterState = {},
|
|
53
49
|
descriptionData,
|
|
54
50
|
title,
|
|
55
51
|
}) => {
|
|
56
52
|
const onlyOffice = title?.includes('Офис');
|
|
57
|
-
const [filtrationState, { field, reset }] = useForm(
|
|
53
|
+
const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE);
|
|
58
54
|
|
|
59
55
|
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
60
56
|
const _filteredItems = filterItems(data, filtrationState);
|
|
@@ -83,6 +79,13 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
83
79
|
|
|
84
80
|
const [activeButton, setActiveButton] = useState('all');
|
|
85
81
|
|
|
82
|
+
const filterOptions: RenderFiltrationFormOptions = {
|
|
83
|
+
filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
|
|
84
|
+
field: { field, reset },
|
|
85
|
+
onlyOffice,
|
|
86
|
+
labels: FILTRATION_LABELS,
|
|
87
|
+
};
|
|
88
|
+
|
|
86
89
|
return (
|
|
87
90
|
<div className={style('space-y-1', className)}>
|
|
88
91
|
<div className="bg-white">
|
|
@@ -91,7 +94,7 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
91
94
|
{descriptionData ? renderDescriptionBlock(descriptionData) : null}
|
|
92
95
|
{onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton)}
|
|
93
96
|
<div className={style('pb-3xl', filtersVisibleStyles(activeButton))}>
|
|
94
|
-
{renderFiltrationForm(
|
|
97
|
+
{renderFiltrationForm(filterOptions)}
|
|
95
98
|
</div>
|
|
96
99
|
</div>
|
|
97
100
|
<div className="h-[600px]">
|
|
@@ -109,55 +112,16 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
109
112
|
},
|
|
110
113
|
);
|
|
111
114
|
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<span suppressHydrationWarning={true}>{title}</span>
|
|
116
|
-
{lengthItems ? (
|
|
117
|
-
<Text size="text-h2" color="text-secondary-text">
|
|
118
|
-
<span suppressHydrationWarning={true}>{` (${lengthItems})`}</span>
|
|
119
|
-
</Text>
|
|
120
|
-
) : null}
|
|
121
|
-
</Heading>
|
|
122
|
-
</div>
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
const renderButtonsGroup = (
|
|
126
|
-
data: Branch[],
|
|
127
|
-
activeButton: string,
|
|
128
|
-
onButtonClick: (item: string) => void,
|
|
115
|
+
export const filterItems = (
|
|
116
|
+
data: (Branch | RemoteWorkplace)[],
|
|
117
|
+
filtrationState: Record<string, boolean>,
|
|
129
118
|
) => {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
const businessButtonVersion = getVersion(activeButton === 'business');
|
|
119
|
+
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
133
120
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
branches.filter(
|
|
137
|
-
(branch) =>
|
|
138
|
-
branch.workSchedule &&
|
|
139
|
-
branch.workSchedule.businessScheduleVisibleTag &&
|
|
140
|
-
!branch.workSchedule.businessScheduleDescription,
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
onButtonClick(key);
|
|
145
|
-
|
|
146
|
-
return branches;
|
|
147
|
-
};
|
|
121
|
+
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES[_](item)));
|
|
122
|
+
};
|
|
148
123
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
Для физических лиц
|
|
153
|
-
</Button>
|
|
154
|
-
<Button
|
|
155
|
-
data-id="business"
|
|
156
|
-
onClick={(e) => handleClick(e, 'business', data)}
|
|
157
|
-
version={businessButtonVersion}
|
|
158
|
-
>
|
|
159
|
-
Для юридических лиц
|
|
160
|
-
</Button>
|
|
161
|
-
</div>
|
|
124
|
+
export const getFiltersWithNonEmptyData = (data: (Branch | Atm | RemoteWorkplace)[]) =>
|
|
125
|
+
Object.keys(INITIAL_FILTRATION_STATE).filter(
|
|
126
|
+
(_) => data.filter((item) => FILTRATION_PREDICATES[_](item)).length,
|
|
162
127
|
);
|
|
163
|
-
};
|
|
@@ -1,46 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocation } from '../../hooks/useLocation';
|
|
3
3
|
import { OfficesAtmsMapLayout } from './OfficesAtmsMapLayout';
|
|
4
|
-
import { type Branch, type RemoteWorkplace } from './OfficesAtmsMapProps';
|
|
5
4
|
import { getOfficePoint, renderOfficeCard } from './renderOfficeCard';
|
|
6
5
|
import { getRemoteWorkplacePoint, renderRemoteWorkplaceCard } from './renderRemoteWorkplaceCard';
|
|
7
6
|
import { useOffices } from './useOffices';
|
|
8
7
|
|
|
9
|
-
const INITIAL_FILTRATION_STATE = {
|
|
10
|
-
workingSaturday: false,
|
|
11
|
-
premiumService: false,
|
|
12
|
-
privateBanking: false,
|
|
13
|
-
remoteWorkplace: false,
|
|
14
|
-
serviceDisabledPeople: false,
|
|
15
|
-
sellingCoins: false,
|
|
16
|
-
buyingCoins: false,
|
|
17
|
-
bullionOperations: false,
|
|
18
|
-
preciousMetalsOperations: false,
|
|
19
|
-
transferringDataToBiometricSystem: false,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const FILTRATION_PREDICATES = {
|
|
23
|
-
workingSaturday: (item: Branch | RemoteWorkplace) =>
|
|
24
|
-
Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
|
|
25
|
-
premiumService: (item: Branch | RemoteWorkplace) =>
|
|
26
|
-
Boolean('premiumService' in item && item.premiumService),
|
|
27
|
-
privateBanking: (item: Branch | RemoteWorkplace) =>
|
|
28
|
-
Boolean('privateBanking' in item && item.privateBanking),
|
|
29
|
-
remoteWorkplace: (item: Branch | RemoteWorkplace) => Boolean('workScheduleDescription' in item),
|
|
30
|
-
serviceDisabledPeople: (item: Branch | RemoteWorkplace) =>
|
|
31
|
-
Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
|
|
32
|
-
sellingCoins: (item: Branch | RemoteWorkplace) =>
|
|
33
|
-
Boolean('sellingCoins' in item && item.sellingCoins),
|
|
34
|
-
buyingCoins: (item: Branch | RemoteWorkplace) =>
|
|
35
|
-
Boolean('buyingCoins' in item && item.buyingCoins),
|
|
36
|
-
bullionOperations: (item: Branch | RemoteWorkplace) =>
|
|
37
|
-
Boolean('bullionOperations' in item && item.bullionOperations),
|
|
38
|
-
preciousMetalsOperations: (item: Branch | RemoteWorkplace) =>
|
|
39
|
-
Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
|
|
40
|
-
transferringDataToBiometricSystem: (item: Branch | RemoteWorkplace) =>
|
|
41
|
-
Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
|
|
42
|
-
};
|
|
43
|
-
|
|
44
8
|
export interface OfficesMapProps {
|
|
45
9
|
className?: string;
|
|
46
10
|
}
|
|
@@ -53,11 +17,9 @@ export const OfficesMap = JSX<OfficesMapProps>(({ className }) => {
|
|
|
53
17
|
return (
|
|
54
18
|
<OfficesAtmsMapLayout
|
|
55
19
|
className={className}
|
|
56
|
-
filterItems={filterItems}
|
|
57
20
|
data={data?.branches}
|
|
58
21
|
isLoad={isLoad}
|
|
59
22
|
remoteWorkplaces={data?.remoteWorkplaces}
|
|
60
|
-
initFilterState={INITIAL_FILTRATION_STATE}
|
|
61
23
|
renderCard={renderOfficeCard}
|
|
62
24
|
renderRemoteWorkplaceCard={renderRemoteWorkplaceCard}
|
|
63
25
|
getBalloon={getOfficePoint}
|
|
@@ -66,12 +28,3 @@ export const OfficesMap = JSX<OfficesMapProps>(({ className }) => {
|
|
|
66
28
|
/>
|
|
67
29
|
);
|
|
68
30
|
});
|
|
69
|
-
|
|
70
|
-
const filterItems = (
|
|
71
|
-
data: (Branch | RemoteWorkplace)[],
|
|
72
|
-
filtrationState: Record<string, boolean>,
|
|
73
|
-
) => {
|
|
74
|
-
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
75
|
-
|
|
76
|
-
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES[_](item)));
|
|
77
|
-
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Branch, RemoteWorkplace } from './OfficesAtmsMapProps';
|
|
2
|
+
|
|
3
|
+
export const INITIAL_FILTRATION_STATE = {
|
|
4
|
+
workingSaturday: false,
|
|
5
|
+
premiumService: false,
|
|
6
|
+
privateBanking: false,
|
|
7
|
+
remoteWorkplace: false,
|
|
8
|
+
serviceDisabledPeople: false,
|
|
9
|
+
sellingCoins: false,
|
|
10
|
+
buyingCoins: false,
|
|
11
|
+
bullionOperations: false,
|
|
12
|
+
preciousMetalsOperations: false,
|
|
13
|
+
transferringDataToBiometricSystem: false,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const FILTRATION_LABELS = {
|
|
17
|
+
safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
|
|
18
|
+
workingSaturday: 'Открыты по субботам',
|
|
19
|
+
terminalTypeAtms: 'Банкоматы',
|
|
20
|
+
terminalTypeTerm: 'Терминалы',
|
|
21
|
+
workAllTime: 'Круглосуточно',
|
|
22
|
+
billAcceptorEnable: 'Прием наличных',
|
|
23
|
+
premiumService: 'Премиальное обслуживание',
|
|
24
|
+
privateBanking: 'Услуга Private banking',
|
|
25
|
+
sellingCoins: 'Продажа монет из драгоценных металлов',
|
|
26
|
+
buyingCoins: 'Покупка монет из драгоценных металлов',
|
|
27
|
+
bullionOperations: 'Операции со слитками',
|
|
28
|
+
preciousMetalsOperations: 'Операции с драгоценными металлами',
|
|
29
|
+
transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
|
|
30
|
+
locationDisabledPeople: 'Для маломобильных',
|
|
31
|
+
designDisabledPeople: 'Для слабовидящих',
|
|
32
|
+
remoteWorkplace: 'Удаленное рабочее место',
|
|
33
|
+
serviceDisabledPeople: 'Для маломобильных граждан',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const FILTRATION_PREDICATES = {
|
|
37
|
+
workingSaturday: (item: Branch | RemoteWorkplace) =>
|
|
38
|
+
Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
|
|
39
|
+
premiumService: (item: Branch | RemoteWorkplace) =>
|
|
40
|
+
Boolean('premiumService' in item && item.premiumService),
|
|
41
|
+
privateBanking: (item: Branch | RemoteWorkplace) =>
|
|
42
|
+
Boolean('privateBanking' in item && item.privateBanking),
|
|
43
|
+
remoteWorkplace: (item: Branch | RemoteWorkplace) => Boolean('workScheduleDescription' in item),
|
|
44
|
+
serviceDisabledPeople: (item: Branch | RemoteWorkplace) =>
|
|
45
|
+
Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
|
|
46
|
+
sellingCoins: (item: Branch | RemoteWorkplace) =>
|
|
47
|
+
Boolean('sellingCoins' in item && item.sellingCoins),
|
|
48
|
+
buyingCoins: (item: Branch | RemoteWorkplace) =>
|
|
49
|
+
Boolean('buyingCoins' in item && item.buyingCoins),
|
|
50
|
+
bullionOperations: (item: Branch | RemoteWorkplace) =>
|
|
51
|
+
Boolean('bullionOperations' in item && item.bullionOperations),
|
|
52
|
+
preciousMetalsOperations: (item: Branch | RemoteWorkplace) =>
|
|
53
|
+
Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
|
|
54
|
+
transferringDataToBiometricSystem: (item: Branch | RemoteWorkplace) =>
|
|
55
|
+
Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
|
|
56
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Button } from '../../ui-kit/Button/Button';
|
|
2
|
+
import { getVersion } from '../../utils/getVersion';
|
|
3
|
+
import type { Branch } from './OfficesAtmsMapProps';
|
|
4
|
+
|
|
5
|
+
export const renderButtonsGroup = (
|
|
6
|
+
data: Branch[],
|
|
7
|
+
activeButton: string,
|
|
8
|
+
onButtonClick: (item: string) => void,
|
|
9
|
+
) => {
|
|
10
|
+
const allButtonVersion = getVersion(activeButton === 'all');
|
|
11
|
+
|
|
12
|
+
const businessButtonVersion = getVersion(activeButton === 'business');
|
|
13
|
+
|
|
14
|
+
const handleClick = (e: any, key: string, branches: Branch[]) => {
|
|
15
|
+
if (e.currentTarget === e.target && key === 'business') {
|
|
16
|
+
branches.filter(
|
|
17
|
+
(branch) =>
|
|
18
|
+
branch.workSchedule &&
|
|
19
|
+
branch.workSchedule.businessScheduleVisibleTag &&
|
|
20
|
+
!branch.workSchedule.businessScheduleDescription,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
onButtonClick(key);
|
|
25
|
+
|
|
26
|
+
return branches;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="flex gap-lg flex-col sm:flex-row pb-lg">
|
|
31
|
+
<Button data-id="all" onClick={(e) => handleClick(e, 'all', data)} version={allButtonVersion}>
|
|
32
|
+
Для физических лиц
|
|
33
|
+
</Button>
|
|
34
|
+
<Button
|
|
35
|
+
data-id="business"
|
|
36
|
+
onClick={(e) => handleClick(e, 'business', data)}
|
|
37
|
+
version={businessButtonVersion}
|
|
38
|
+
>
|
|
39
|
+
Для юридических лиц
|
|
40
|
+
</Button>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -8,37 +8,25 @@ import { Icon } from '../../ui-kit/Icon/Icon';
|
|
|
8
8
|
import { type IconName } from '../../ui-kit/Icon/IconProps';
|
|
9
9
|
import { LinkButton } from '../../ui-kit/LinkButton/LinkButton';
|
|
10
10
|
|
|
11
|
-
const FILTRATION_LABELS = {
|
|
12
|
-
safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
|
|
13
|
-
workingSaturday: 'Открыты по субботам',
|
|
14
|
-
terminalTypeAtms: 'Банкоматы',
|
|
15
|
-
terminalTypeTerm: 'Терминалы',
|
|
16
|
-
workAllTime: 'Круглосуточно',
|
|
17
|
-
billAcceptorEnable: 'Прием наличных',
|
|
18
|
-
premiumService: 'Премиальное обслуживание',
|
|
19
|
-
privateBanking: 'Услуга Private banking',
|
|
20
|
-
sellingCoins: 'Продажа монет из драгоценных металлов',
|
|
21
|
-
buyingCoins: 'Покупка монет из драгоценных металлов',
|
|
22
|
-
bullionOperations: 'Операции со слитками',
|
|
23
|
-
preciousMetalsOperations: 'Операции с драгоценными металлами',
|
|
24
|
-
transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
|
|
25
|
-
locationDisabledPeople: 'Для маломобильных',
|
|
26
|
-
designDisabledPeople: 'Для слабовидящих',
|
|
27
|
-
remoteWorkplace: 'Удаленное рабочее место',
|
|
28
|
-
serviceDisabledPeople: 'Для маломобильных граждан',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
11
|
const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
|
|
32
12
|
|
|
33
|
-
export
|
|
34
|
-
filters: string[]
|
|
35
|
-
|
|
36
|
-
onlyOffice?: boolean
|
|
37
|
-
|
|
13
|
+
export interface RenderFiltrationFormOptions {
|
|
14
|
+
filters: string[];
|
|
15
|
+
field: { field: FormFieldRegisterer<any>; reset: () => void };
|
|
16
|
+
onlyOffice?: boolean;
|
|
17
|
+
labels: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const renderFiltrationForm = ({
|
|
21
|
+
filters,
|
|
22
|
+
field: { field, reset },
|
|
23
|
+
onlyOffice,
|
|
24
|
+
labels,
|
|
25
|
+
}: RenderFiltrationFormOptions) => {
|
|
38
26
|
const visibleFiltersNum = onlyOffice ? 5 : 6;
|
|
39
27
|
|
|
40
28
|
const filtersCheckbox = (filters || []).map((key) => (
|
|
41
|
-
<Checkbox key={key} text={
|
|
29
|
+
<Checkbox key={key} text={labels[key]} {...field(key)} />
|
|
42
30
|
));
|
|
43
31
|
|
|
44
32
|
const [visibleFilters, hiddenFilters] =
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
2
|
+
import { Text } from '../../ui-kit/Text/Text';
|
|
3
|
+
|
|
4
|
+
export const renderHeading = (title?: string, lengthItems?: number) => (
|
|
5
|
+
<div className="flex flex-col sm:flex-row gap-xs mb-2xl">
|
|
6
|
+
<Heading headingType="h3">
|
|
7
|
+
<span suppressHydrationWarning={true}>{title}</span>
|
|
8
|
+
{lengthItems ? (
|
|
9
|
+
<Text size="text-h2" color="text-secondary-text">
|
|
10
|
+
<span suppressHydrationWarning={true}>{` (${lengthItems})`}</span>
|
|
11
|
+
</Text>
|
|
12
|
+
) : null}
|
|
13
|
+
</Heading>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
4
4
|
import type ymaps from 'yandex-maps';
|
|
5
|
-
import { type BalloonPoints } from '../../components/OfficesAtmsMap/YandexMapProps';
|
|
5
|
+
import { type BalloonPoints } from '../../components/OfficesAtmsMap/YandexMapProps';
|
|
6
6
|
|
|
7
7
|
const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
|
|
8
8
|
const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
|
|
@@ -18,12 +18,16 @@ export function renderClusterer({
|
|
|
18
18
|
points: BalloonPoints[];
|
|
19
19
|
isLoad: boolean;
|
|
20
20
|
}) {
|
|
21
|
-
if (isLoad || !points
|
|
21
|
+
if (isLoad || !points) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
map.geoObjects.removeAll();
|
|
26
26
|
|
|
27
|
+
if (!points.length) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
27
31
|
const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass(
|
|
28
32
|
'<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>',
|
|
29
33
|
);
|
package/package.json
CHANGED
|
@@ -2,21 +2,19 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import { useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { useForm } from '../../hooks/useForm';
|
|
4
4
|
import { type VNode } from '../../model/VNode';
|
|
5
|
-
import { Button } from '../../ui-kit/Button/Button';
|
|
6
5
|
import { ClientOnly } from '../../ui-kit/ClientOnly';
|
|
7
|
-
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
8
|
-
import { Text } from '../../ui-kit/Text/Text';
|
|
9
6
|
import { YandexMap } from '../../ui-kit/YandexMap/YandexMap';
|
|
10
|
-
import { getVersion } from '../../utils/getVersion';
|
|
11
7
|
import { style } from '../../utils/style';
|
|
8
|
+
import { FILTRATION_LABELS, FILTRATION_PREDICATES, INITIAL_FILTRATION_STATE } from './filters';
|
|
12
9
|
import { type AtmsDef } from './OfficesAtmsMapContent';
|
|
13
10
|
import { type Atm, type Branch, type RemoteWorkplace } from './OfficesAtmsMapProps';
|
|
11
|
+
import { renderButtonsGroup } from './renderButtonsGroup';
|
|
14
12
|
import { renderDescriptionBlock } from './renderDescriptionBlock';
|
|
15
|
-
import { renderFiltrationForm } from './renderFiltrationForm';
|
|
13
|
+
import { renderFiltrationForm, type RenderFiltrationFormOptions } from './renderFiltrationForm';
|
|
14
|
+
import { renderHeading } from './renderHeading';
|
|
16
15
|
import { type BalloonContent } from './YandexMapProps';
|
|
17
16
|
|
|
18
17
|
const defaultEmptyFunction = () => void 0;
|
|
19
|
-
const defaultFilterItems = () => [];
|
|
20
18
|
|
|
21
19
|
export type InitFilterState = Record<string, boolean>;
|
|
22
20
|
|
|
@@ -46,15 +44,13 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
46
44
|
remoteWorkplaces = [],
|
|
47
45
|
renderCard = defaultEmptyFunction,
|
|
48
46
|
renderRemoteWorkplaceCard = defaultEmptyFunction,
|
|
49
|
-
filterItems = defaultFilterItems,
|
|
50
47
|
getBalloon = defaultEmptyFunction,
|
|
51
48
|
getBalloonRemoteWorkplaces = defaultEmptyFunction,
|
|
52
|
-
initFilterState = {},
|
|
53
49
|
descriptionData,
|
|
54
50
|
title,
|
|
55
51
|
}) => {
|
|
56
52
|
const onlyOffice = title?.includes('Офис');
|
|
57
|
-
const [filtrationState, { field, reset }] = useForm(
|
|
53
|
+
const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE);
|
|
58
54
|
|
|
59
55
|
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
60
56
|
const _filteredItems = filterItems(data, filtrationState);
|
|
@@ -83,6 +79,13 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
83
79
|
|
|
84
80
|
const [activeButton, setActiveButton] = useState('all');
|
|
85
81
|
|
|
82
|
+
const filterOptions: RenderFiltrationFormOptions = {
|
|
83
|
+
filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
|
|
84
|
+
field: { field, reset },
|
|
85
|
+
onlyOffice,
|
|
86
|
+
labels: FILTRATION_LABELS,
|
|
87
|
+
};
|
|
88
|
+
|
|
86
89
|
return (
|
|
87
90
|
<div className={style('space-y-1', className)}>
|
|
88
91
|
<div className="bg-white">
|
|
@@ -91,7 +94,7 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
91
94
|
{descriptionData ? renderDescriptionBlock(descriptionData) : null}
|
|
92
95
|
{onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton)}
|
|
93
96
|
<div className={style('pb-3xl', filtersVisibleStyles(activeButton))}>
|
|
94
|
-
{renderFiltrationForm(
|
|
97
|
+
{renderFiltrationForm(filterOptions)}
|
|
95
98
|
</div>
|
|
96
99
|
</div>
|
|
97
100
|
<div className="h-[600px]">
|
|
@@ -109,55 +112,16 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
|
|
|
109
112
|
},
|
|
110
113
|
);
|
|
111
114
|
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<span suppressHydrationWarning={true}>{title}</span>
|
|
116
|
-
{lengthItems ? (
|
|
117
|
-
<Text size="text-h2" color="text-secondary-text">
|
|
118
|
-
<span suppressHydrationWarning={true}>{` (${lengthItems})`}</span>
|
|
119
|
-
</Text>
|
|
120
|
-
) : null}
|
|
121
|
-
</Heading>
|
|
122
|
-
</div>
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
const renderButtonsGroup = (
|
|
126
|
-
data: Branch[],
|
|
127
|
-
activeButton: string,
|
|
128
|
-
onButtonClick: (item: string) => void,
|
|
115
|
+
export const filterItems = (
|
|
116
|
+
data: (Branch | RemoteWorkplace)[],
|
|
117
|
+
filtrationState: Record<string, boolean>,
|
|
129
118
|
) => {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
const businessButtonVersion = getVersion(activeButton === 'business');
|
|
119
|
+
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
133
120
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
branches.filter(
|
|
137
|
-
(branch) =>
|
|
138
|
-
branch.workSchedule &&
|
|
139
|
-
branch.workSchedule.businessScheduleVisibleTag &&
|
|
140
|
-
!branch.workSchedule.businessScheduleDescription,
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
onButtonClick(key);
|
|
145
|
-
|
|
146
|
-
return branches;
|
|
147
|
-
};
|
|
121
|
+
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES[_](item)));
|
|
122
|
+
};
|
|
148
123
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
Для физических лиц
|
|
153
|
-
</Button>
|
|
154
|
-
<Button
|
|
155
|
-
data-id="business"
|
|
156
|
-
onClick={(e) => handleClick(e, 'business', data)}
|
|
157
|
-
version={businessButtonVersion}
|
|
158
|
-
>
|
|
159
|
-
Для юридических лиц
|
|
160
|
-
</Button>
|
|
161
|
-
</div>
|
|
124
|
+
export const getFiltersWithNonEmptyData = (data: (Branch | Atm | RemoteWorkplace)[]) =>
|
|
125
|
+
Object.keys(INITIAL_FILTRATION_STATE).filter(
|
|
126
|
+
(_) => data.filter((item) => FILTRATION_PREDICATES[_](item)).length,
|
|
162
127
|
);
|
|
163
|
-
};
|
|
@@ -1,46 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useLocation } from '../../hooks/useLocation';
|
|
3
3
|
import { OfficesAtmsMapLayout } from './OfficesAtmsMapLayout';
|
|
4
|
-
import { type Branch, type RemoteWorkplace } from './OfficesAtmsMapProps';
|
|
5
4
|
import { getOfficePoint, renderOfficeCard } from './renderOfficeCard';
|
|
6
5
|
import { getRemoteWorkplacePoint, renderRemoteWorkplaceCard } from './renderRemoteWorkplaceCard';
|
|
7
6
|
import { useOffices } from './useOffices';
|
|
8
7
|
|
|
9
|
-
const INITIAL_FILTRATION_STATE = {
|
|
10
|
-
workingSaturday: false,
|
|
11
|
-
premiumService: false,
|
|
12
|
-
privateBanking: false,
|
|
13
|
-
remoteWorkplace: false,
|
|
14
|
-
serviceDisabledPeople: false,
|
|
15
|
-
sellingCoins: false,
|
|
16
|
-
buyingCoins: false,
|
|
17
|
-
bullionOperations: false,
|
|
18
|
-
preciousMetalsOperations: false,
|
|
19
|
-
transferringDataToBiometricSystem: false,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const FILTRATION_PREDICATES = {
|
|
23
|
-
workingSaturday: (item: Branch | RemoteWorkplace) =>
|
|
24
|
-
Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
|
|
25
|
-
premiumService: (item: Branch | RemoteWorkplace) =>
|
|
26
|
-
Boolean('premiumService' in item && item.premiumService),
|
|
27
|
-
privateBanking: (item: Branch | RemoteWorkplace) =>
|
|
28
|
-
Boolean('privateBanking' in item && item.privateBanking),
|
|
29
|
-
remoteWorkplace: (item: Branch | RemoteWorkplace) => Boolean('workScheduleDescription' in item),
|
|
30
|
-
serviceDisabledPeople: (item: Branch | RemoteWorkplace) =>
|
|
31
|
-
Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
|
|
32
|
-
sellingCoins: (item: Branch | RemoteWorkplace) =>
|
|
33
|
-
Boolean('sellingCoins' in item && item.sellingCoins),
|
|
34
|
-
buyingCoins: (item: Branch | RemoteWorkplace) =>
|
|
35
|
-
Boolean('buyingCoins' in item && item.buyingCoins),
|
|
36
|
-
bullionOperations: (item: Branch | RemoteWorkplace) =>
|
|
37
|
-
Boolean('bullionOperations' in item && item.bullionOperations),
|
|
38
|
-
preciousMetalsOperations: (item: Branch | RemoteWorkplace) =>
|
|
39
|
-
Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
|
|
40
|
-
transferringDataToBiometricSystem: (item: Branch | RemoteWorkplace) =>
|
|
41
|
-
Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
|
|
42
|
-
};
|
|
43
|
-
|
|
44
8
|
export interface OfficesMapProps {
|
|
45
9
|
className?: string;
|
|
46
10
|
}
|
|
@@ -53,11 +17,9 @@ export const OfficesMap = JSX<OfficesMapProps>(({ className }) => {
|
|
|
53
17
|
return (
|
|
54
18
|
<OfficesAtmsMapLayout
|
|
55
19
|
className={className}
|
|
56
|
-
filterItems={filterItems}
|
|
57
20
|
data={data?.branches}
|
|
58
21
|
isLoad={isLoad}
|
|
59
22
|
remoteWorkplaces={data?.remoteWorkplaces}
|
|
60
|
-
initFilterState={INITIAL_FILTRATION_STATE}
|
|
61
23
|
renderCard={renderOfficeCard}
|
|
62
24
|
renderRemoteWorkplaceCard={renderRemoteWorkplaceCard}
|
|
63
25
|
getBalloon={getOfficePoint}
|
|
@@ -66,12 +28,3 @@ export const OfficesMap = JSX<OfficesMapProps>(({ className }) => {
|
|
|
66
28
|
/>
|
|
67
29
|
);
|
|
68
30
|
});
|
|
69
|
-
|
|
70
|
-
const filterItems = (
|
|
71
|
-
data: (Branch | RemoteWorkplace)[],
|
|
72
|
-
filtrationState: Record<string, boolean>,
|
|
73
|
-
) => {
|
|
74
|
-
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
75
|
-
|
|
76
|
-
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES[_](item)));
|
|
77
|
-
};
|