@redneckz/wildless-cms-uni-blocks 0.14.666 → 0.14.667
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/api/RetailAPI/regionOffices.d.ts +16 -0
- package/bundle/bundle.umd.js +1336 -1310
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +2 -1
- package/bundle/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/bundle/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/bundle/ui-kit/FormField/Fields/{RetailAddressField.d.ts → AddressRetailField.d.ts} +1 -1
- package/{lib/ui-kit/FormField/Fields/RetailRegionField.d.ts → bundle/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
- package/bundle/ui-kit/FormField/SelectField.d.ts +2 -0
- package/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/dist/api/RetailAPI/regionOffices.d.ts +16 -0
- package/dist/api/RetailAPI/regionOffices.js +19 -0
- package/dist/api/RetailAPI/regionOffices.js.map +1 -0
- package/dist/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/dist/components/ApplicationForm/getInitialFormState.js +1 -0
- package/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +2 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/dist/components/CreditCardForm/formStateMap.js +2 -2
- package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/dist/components/CreditForm/getCreditFormTaskData.js +3 -1
- package/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/dist/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/dist/components/CreditForm/getFifthStepData.js +10 -0
- package/dist/components/CreditForm/getFifthStepData.js.map +1 -0
- package/dist/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/dist/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
- package/dist/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
- package/{lib/ui-kit/FormField/Fields/RetailAddressField.d.ts → dist/ui-kit/FormField/Fields/AddressRetailField.d.ts} +1 -1
- package/{mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js → dist/ui-kit/FormField/Fields/AddressRetailField.js} +20 -18
- package/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
- package/{bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts → dist/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
- package/dist/ui-kit/FormField/Fields/RegionRetailField.js +14 -0
- package/dist/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
- package/dist/ui-kit/FormField/SelectField.d.ts +2 -0
- package/dist/ui-kit/FormField/SelectField.js +2 -2
- package/dist/ui-kit/FormField/SelectField.js.map +1 -1
- package/dist/ui-kit/FormField/getField.js +4 -4
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/dist/ui-kit/YandexMap/YandexMap.js +4 -4
- package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/lib/api/RetailAPI/regionOffices.d.ts +16 -0
- package/lib/api/RetailAPI/regionOffices.js +16 -0
- package/lib/api/RetailAPI/regionOffices.js.map +1 -0
- package/lib/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/lib/components/ApplicationForm/getInitialFormState.js +1 -0
- package/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +2 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/lib/components/CreditCardForm/formStateMap.js +2 -2
- package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/lib/components/CreditForm/getCreditFormTaskData.js +3 -1
- package/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/lib/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/lib/components/CreditForm/getFifthStepData.js +7 -0
- package/lib/components/CreditForm/getFifthStepData.js.map +1 -0
- package/lib/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/lib/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
- package/lib/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
- package/{dist/ui-kit/FormField/Fields/RetailAddressField.d.ts → lib/ui-kit/FormField/Fields/AddressRetailField.d.ts} +1 -1
- package/lib/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
- package/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
- package/{mobile/bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts → lib/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
- package/lib/ui-kit/FormField/Fields/RegionRetailField.js +12 -0
- package/lib/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
- package/lib/ui-kit/FormField/SelectField.d.ts +2 -0
- package/lib/ui-kit/FormField/SelectField.js +2 -2
- package/lib/ui-kit/FormField/SelectField.js.map +1 -1
- package/lib/ui-kit/FormField/getField.js +4 -4
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/lib/ui-kit/YandexMap/YandexMap.js +2 -2
- package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/bundle/api/RetailAPI/regionOffices.d.ts +16 -0
- package/mobile/bundle/bundle.umd.js +1336 -1310
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +2 -1
- package/mobile/bundle/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/mobile/bundle/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/Fields/{RetailAddressField.d.ts → AddressRetailField.d.ts} +1 -1
- package/{dist/ui-kit/FormField/Fields/RetailRegionField.d.ts → mobile/bundle/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
- package/mobile/bundle/ui-kit/FormField/SelectField.d.ts +2 -0
- package/mobile/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/mobile/dist/api/RetailAPI/regionOffices.d.ts +16 -0
- package/mobile/dist/api/RetailAPI/regionOffices.js +19 -0
- package/mobile/dist/api/RetailAPI/regionOffices.js.map +1 -0
- package/mobile/dist/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/mobile/dist/components/ApplicationForm/getInitialFormState.js +1 -0
- package/mobile/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +2 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.js +2 -2
- package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/dist/components/CreditForm/getCreditFormTaskData.js +3 -1
- package/mobile/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/mobile/dist/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/mobile/dist/components/CreditForm/getFifthStepData.js +10 -0
- package/mobile/dist/components/CreditForm/getFifthStepData.js.map +1 -0
- package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.d.ts +2 -0
- package/{dist/ui-kit/FormField/Fields/RetailAddressField.js → mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js} +20 -18
- package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/Fields/RegionRetailField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/RegionRetailField.js +14 -0
- package/mobile/dist/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/SelectField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/SelectField.js +2 -2
- package/mobile/dist/ui-kit/FormField/SelectField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getField.js +4 -4
- package/mobile/dist/ui-kit/FormField/getField.js.map +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/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/mobile/dist/ui-kit/YandexMap/YandexMap.js +4 -4
- package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/lib/api/RetailAPI/regionOffices.d.ts +16 -0
- package/mobile/lib/api/RetailAPI/regionOffices.js +16 -0
- package/mobile/lib/api/RetailAPI/regionOffices.js.map +1 -0
- package/mobile/lib/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/mobile/lib/components/ApplicationForm/getInitialFormState.js +1 -0
- package/mobile/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +2 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.js +2 -2
- package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/lib/components/CreditForm/getCreditFormTaskData.js +3 -1
- package/mobile/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/mobile/lib/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/mobile/lib/components/CreditForm/getFifthStepData.js +7 -0
- package/mobile/lib/components/CreditForm/getFifthStepData.js.map +1 -0
- package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
- package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/Fields/RegionRetailField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/RegionRetailField.js +12 -0
- package/mobile/lib/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/SelectField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/SelectField.js +2 -2
- package/mobile/lib/ui-kit/FormField/SelectField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getField.js +4 -4
- package/mobile/lib/ui-kit/FormField/getField.js.map +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/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/mobile/lib/ui-kit/YandexMap/YandexMap.js +2 -2
- package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/src/api/RetailAPI/regionOffices.ts +36 -0
- package/mobile/src/components/ApplicationForm/getInitialFormState.tsx +2 -0
- package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +3 -1
- package/mobile/src/components/CreditCardForm/formStateMap.tsx +2 -2
- package/mobile/src/components/CreditForm/getCreditFormTaskData.ts +3 -1
- package/mobile/src/components/CreditForm/getFifthStepData.ts +10 -0
- package/mobile/src/components/OfficesAtmsMap/renderWorkSchedule.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/{RetailAddressField.tsx → AddressRetailField.tsx} +20 -23
- package/mobile/src/ui-kit/FormField/Fields/{RetailRegionField.tsx → RegionRetailField.tsx} +6 -8
- package/mobile/src/ui-kit/FormField/SelectField.tsx +13 -2
- package/mobile/src/ui-kit/FormField/getField.tsx +4 -4
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +1 -1
- package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +2 -2
- package/package.json +1 -1
- package/src/api/RetailAPI/regionOffices.ts +36 -0
- package/src/components/ApplicationForm/getInitialFormState.tsx +2 -0
- package/src/components/ApplicationLeadForm/getInitialFormState.tsx +3 -1
- package/src/components/CreditCardForm/formStateMap.tsx +2 -2
- package/src/components/CreditForm/getCreditFormTaskData.ts +3 -1
- package/src/components/CreditForm/getFifthStepData.ts +10 -0
- package/src/components/OfficesAtmsMap/renderWorkSchedule.tsx +1 -1
- package/src/ui-kit/FormField/Fields/{RetailAddressField.tsx → AddressRetailField.tsx} +20 -23
- package/src/ui-kit/FormField/Fields/{RetailRegionField.tsx → RegionRetailField.tsx} +6 -8
- package/src/ui-kit/FormField/SelectField.tsx +13 -2
- package/src/ui-kit/FormField/getField.tsx +4 -4
- package/src/ui-kit/FormField/getObjectValidator.tsx +1 -1
- package/src/ui-kit/YandexMap/YandexMap.tsx +2 -2
- package/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
- package/dist/ui-kit/FormField/Fields/RetailRegionField.js +0 -14
- package/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
- package/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
- package/lib/ui-kit/FormField/Fields/RetailRegionField.js +0 -12
- package/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
- package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.d.ts +0 -2
- package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
- package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.d.ts +0 -2
- package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js +0 -14
- package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
- package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.d.ts +0 -2
- package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
- package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.d.ts +0 -2
- package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js +0 -12
- package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
package/bundle/bundle.umd.js
CHANGED
|
@@ -1504,6 +1504,7 @@
|
|
|
1504
1504
|
feedbackMethod: defaultSelectValidator(),
|
|
1505
1505
|
serviceType: defaultSelectValidator(),
|
|
1506
1506
|
serviceDirection: defaultSelectValidator(),
|
|
1507
|
+
regionRetail: defaultSelectValidator('Выберите регион'),
|
|
1507
1508
|
meetingDay: defaultValidator(),
|
|
1508
1509
|
product: defaultValidator(),
|
|
1509
1510
|
localities: defaultValidator(),
|
|
@@ -1538,7 +1539,6 @@
|
|
|
1538
1539
|
legalEntityName: defaultValidator(),
|
|
1539
1540
|
bankEmployeeCode: defaultValidator(),
|
|
1540
1541
|
partInBusiness: defaultValidator(),
|
|
1541
|
-
regionRetail: defaultSelectValidator('Выберите филиал банка'),
|
|
1542
1542
|
addressRetail: defaultSelectValidator('Выберите адрес банка'),
|
|
1543
1543
|
addressMatch: defaultValidator(),
|
|
1544
1544
|
codeWord: codeWordValidator('Необходимо ввести кодовое слово'),
|
|
@@ -1796,1458 +1796,1474 @@
|
|
|
1796
1796
|
return (jsx(CheckboxWithError, { text: "\u0410\u0434\u0440\u0435\u0441 \u0444\u0430\u043A\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u0430\u0434\u0440\u0435\u0441\u043E\u043C \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438", ...getValidation(field('addressMatch'), validatorObj.addressMatch, input?.required) }));
|
|
1797
1797
|
});
|
|
1798
1798
|
|
|
1799
|
-
const
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
const handleFocus = useCallback((ev) => {
|
|
1803
|
-
setIsFocused(true);
|
|
1804
|
-
onFocus && onFocus(ev);
|
|
1805
|
-
}, []);
|
|
1806
|
-
const handleBlur = useCallback(() => {
|
|
1807
|
-
setIsFocused(false);
|
|
1808
|
-
onChange && onChange(normalize(value));
|
|
1809
|
-
onBlur && onBlur();
|
|
1810
|
-
}, [onChange, value]);
|
|
1811
|
-
return {
|
|
1812
|
-
value: (isFocused || !format ? value : format(value)),
|
|
1813
|
-
onFocus: handleFocus,
|
|
1814
|
-
onBlur: handleBlur,
|
|
1815
|
-
};
|
|
1816
|
-
};
|
|
1817
|
-
|
|
1818
|
-
const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
|
|
1819
|
-
|
|
1820
|
-
function parseDecimal(value) {
|
|
1821
|
-
const rawValue = (value || '').replace(/\D/g, '');
|
|
1822
|
-
const unsafeDecimal = parseInt(rawValue, 10);
|
|
1823
|
-
return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
|
|
1824
|
-
}
|
|
1799
|
+
const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
|
|
1800
|
+
'backdrop-blur': blur,
|
|
1801
|
+
}), children: jsx("div", { className: style('inline-block h-28 w-28', 'animate-spin rounded-full', 'border-8 border-solid border-current', 'border-r-transparent', color), role: "status" }) })));
|
|
1825
1802
|
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1803
|
+
const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
|
|
1804
|
+
const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
|
|
1805
|
+
function renderClusterer({ yandexMaps, map, points, isLoad, }) {
|
|
1806
|
+
if (isLoad || !points) {
|
|
1807
|
+
return;
|
|
1808
|
+
}
|
|
1809
|
+
map.geoObjects.removeAll();
|
|
1810
|
+
if (!points.length) {
|
|
1811
|
+
return;
|
|
1812
|
+
}
|
|
1813
|
+
const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
|
|
1814
|
+
const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
|
|
1815
|
+
if (points.length && points.every((_) => 'type' in _)) {
|
|
1816
|
+
const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
|
|
1817
|
+
const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
|
|
1818
|
+
const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
|
|
1819
|
+
officeClusterer.add(officesGeoObjects);
|
|
1820
|
+
remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
|
|
1821
|
+
map.geoObjects.add(remoteWorkplaceClusterer);
|
|
1822
|
+
map.geoObjects.add(officeClusterer);
|
|
1823
|
+
}
|
|
1824
|
+
else {
|
|
1825
|
+
const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
|
|
1826
|
+
officeClusterer.add(geoObjects);
|
|
1827
|
+
map.geoObjects.add(officeClusterer);
|
|
1828
|
+
}
|
|
1829
|
+
map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
|
|
1830
|
+
if (map.getZoom() > 10) {
|
|
1831
|
+
map.setZoom(10);
|
|
1832
|
+
}
|
|
1833
|
+
});
|
|
1838
1834
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1835
|
+
const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
|
|
1836
|
+
return new yandexMaps.Clusterer({
|
|
1837
|
+
clusterIcons: [
|
|
1838
|
+
{
|
|
1839
|
+
href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
1840
|
+
size: [78, 84],
|
|
1841
|
+
offset: [-35, -50],
|
|
1842
|
+
},
|
|
1843
|
+
],
|
|
1844
|
+
clusterIconContentLayout,
|
|
1845
|
+
clusterHideIconOnBalloonOpen: false,
|
|
1846
|
+
geoObjectHideIconOnBalloonOpen: false,
|
|
1848
1847
|
});
|
|
1849
|
-
const handleChange = useCallback((ev) => {
|
|
1850
|
-
onChange && onChange(parseDecimal(ev.target?.value));
|
|
1851
|
-
}, [onChange]);
|
|
1852
|
-
return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
|
|
1853
|
-
});
|
|
1854
|
-
const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
|
|
1855
|
-
const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
|
|
1856
|
-
|
|
1857
|
-
const MIN_CREDIT_AMOUNT = 1000;
|
|
1858
|
-
const MAX_CREDIT_AMOUNT = 1000000000;
|
|
1859
|
-
const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
|
|
1860
|
-
const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
|
|
1861
|
-
|
|
1862
|
-
const useLeadFormData = (typeField) => {
|
|
1863
|
-
const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
1864
|
-
if (data && 'errorMessage' in data) {
|
|
1865
|
-
return { error };
|
|
1866
|
-
}
|
|
1867
|
-
return { data: data, error };
|
|
1868
1848
|
};
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1871
|
-
|
|
1849
|
+
const defineGeoObjects = (pointArr, type, yandexMaps) => {
|
|
1850
|
+
return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
|
|
1851
|
+
balloonContentHeader: content?.header,
|
|
1852
|
+
balloonContentBody: content?.body,
|
|
1853
|
+
balloonContentFooter: content?.footer,
|
|
1854
|
+
hintContent: content?.hint,
|
|
1855
|
+
}, {
|
|
1856
|
+
iconLayout: 'default#image',
|
|
1857
|
+
iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
1858
|
+
iconImageSize: [78, 84],
|
|
1859
|
+
iconImageOffset: [-35, -50],
|
|
1860
|
+
}));
|
|
1872
1861
|
};
|
|
1873
1862
|
|
|
1874
|
-
const
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
[];
|
|
1881
|
-
return (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0437 \u0441\u043F\u0438\u0441\u043A\u0430", label: label, options: leadOptions, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required) }));
|
|
1882
|
-
});
|
|
1883
|
-
|
|
1884
|
-
const AmountWorkersField = JSX(({ field, input }) => {
|
|
1885
|
-
const { data: amountWorkers } = useLeadFormData('EMPLOYEES_NUMBER');
|
|
1886
|
-
return (jsx(SelectField, { field: field, source: amountWorkers, label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0445 \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "amountWorkers", input: input }));
|
|
1887
|
-
});
|
|
1888
|
-
|
|
1889
|
-
const AnnualRevenueField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0413\u043E\u0434\u043E\u0432\u0430\u044F \u0432\u044B\u0440\u0443\u0447\u043A\u0430, \u20BD", ...getValidation(field('annualRevenue'), validatorObj.annualRevenue, input?.required) })));
|
|
1890
|
-
|
|
1891
|
-
const ArmyIdFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u041D\u0430\u043B\u0438\u0447\u0438\u0435 \u0432\u043E\u0435\u043D\u043D\u043E\u0433\u043E \u0431\u0438\u043B\u0435\u0442\u0430", ...getValidation(field('armyIdFlg'), validatorObj.armyIdFlg, input?.required) })));
|
|
1892
|
-
|
|
1893
|
-
const BankEmpoleeCodeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F \u0411\u0430\u043D\u043A\u0430", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434", type: "number", ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
|
|
1894
|
-
|
|
1895
|
-
const BankEmpoleeField = JSX(({ field }) => (jsx(InputControl, { label: "\u0424\u0418\u041E \u0438\u043B\u0438 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043E \u0412\u0430\u0441 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430 \u0411\u0430\u043D\u043A\u0430", ...field('bankEmpolee') })));
|
|
1863
|
+
const defaultStyle = {
|
|
1864
|
+
focus: 'focus:border-primary-text focus:border',
|
|
1865
|
+
hover: 'hover:bg-primary-hover',
|
|
1866
|
+
active: 'active:bg-primary-active',
|
|
1867
|
+
font: 'text-center font-sans',
|
|
1868
|
+
};
|
|
1896
1869
|
|
|
1897
|
-
const
|
|
1870
|
+
const styles$1 = {
|
|
1871
|
+
...defaultStyle,
|
|
1872
|
+
border: 'border border-transparent rounded-md',
|
|
1873
|
+
position: 'absolute flex items-center justify-center',
|
|
1874
|
+
};
|
|
1875
|
+
const renderUserGeolocation = (map, yandexMaps, className) => {
|
|
1876
|
+
const setUserGeoLocation = () => {
|
|
1877
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1878
|
+
// @ts-ignore
|
|
1879
|
+
yandexMaps.geolocation
|
|
1880
|
+
.get({
|
|
1881
|
+
provider: 'yandex',
|
|
1882
|
+
autoReverseGeocode: true,
|
|
1883
|
+
mapStateAutoApply: true,
|
|
1884
|
+
})
|
|
1885
|
+
.then(function (result) {
|
|
1886
|
+
map.current.geoObjects.add(result.geoObjects);
|
|
1887
|
+
});
|
|
1888
|
+
};
|
|
1889
|
+
return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
|
|
1890
|
+
};
|
|
1898
1891
|
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1892
|
+
const getNS = (_) => globalThis[_];
|
|
1893
|
+
const initializeExternalNS = (namespaceName, url) => {
|
|
1894
|
+
const script = document.getElementById(url);
|
|
1895
|
+
if (script) {
|
|
1896
|
+
const ns = getNS(namespaceName);
|
|
1897
|
+
if (ns) {
|
|
1898
|
+
return Promise.resolve(ns);
|
|
1899
|
+
}
|
|
1900
|
+
else {
|
|
1901
|
+
return new Promise((resolve) => {
|
|
1902
|
+
script.addEventListener('load', () => {
|
|
1903
|
+
resolve(getNS(namespaceName));
|
|
1904
|
+
});
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
else {
|
|
1909
|
+
return new Promise((resolve, reject) => {
|
|
1910
|
+
const newScript = document.createElement('script');
|
|
1911
|
+
newScript.src = url;
|
|
1912
|
+
newScript.async = true;
|
|
1913
|
+
newScript.id = url;
|
|
1914
|
+
newScript.addEventListener('load', () => {
|
|
1915
|
+
resolve(getNS(namespaceName));
|
|
1916
|
+
});
|
|
1917
|
+
newScript.addEventListener('error', (error) => {
|
|
1918
|
+
reject(error);
|
|
1919
|
+
});
|
|
1920
|
+
document.head.appendChild(newScript);
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
};
|
|
1924
|
+
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
1925
|
+
const [externalNS, setExternalNS] = useState(undefined);
|
|
1901
1926
|
useEffect(() => {
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1927
|
+
let isMounted = true;
|
|
1928
|
+
initializeExternalNS(namespaceName, url)
|
|
1929
|
+
.then((ns) => {
|
|
1930
|
+
if (isMounted) {
|
|
1931
|
+
setExternalNS(ns);
|
|
1932
|
+
}
|
|
1933
|
+
})
|
|
1934
|
+
.catch((error) => {
|
|
1935
|
+
console.error(`Failed to initialize external namespace: ${error}`);
|
|
1936
|
+
});
|
|
1937
|
+
return () => {
|
|
1938
|
+
isMounted = false;
|
|
1939
|
+
if (unmountNS) {
|
|
1940
|
+
const script = document.getElementById(url);
|
|
1941
|
+
if (script) {
|
|
1942
|
+
document.head.removeChild(script);
|
|
1943
|
+
}
|
|
1944
|
+
setExternalNS(undefined);
|
|
1907
1945
|
}
|
|
1908
1946
|
};
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1947
|
+
}, [namespaceName, url, unmountNS]);
|
|
1948
|
+
return externalNS;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
const YMAPS_NAMESPACE = 'ymaps';
|
|
1952
|
+
const useYandexMaps = () => {
|
|
1953
|
+
const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
|
|
1954
|
+
return useExternalNS(YMAPS_NAMESPACE, url, false);
|
|
1914
1955
|
};
|
|
1915
1956
|
|
|
1916
|
-
const
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
let dayCounter = 1;
|
|
1921
|
-
for (let i = 0; i < DAY_COUNT; i++) {
|
|
1922
|
-
const rowCells = [];
|
|
1923
|
-
for (let j = 0; j < WEEK_COUNT; j++) {
|
|
1924
|
-
if (i === 0 && j < firstDayOfWeek) {
|
|
1925
|
-
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
1926
|
-
}
|
|
1927
|
-
else if (dayCounter > totalDays) {
|
|
1928
|
-
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
1929
|
-
}
|
|
1930
|
-
else {
|
|
1931
|
-
const currentDate = new Date(currentYear, currentMonth, dayCounter);
|
|
1932
|
-
const isToday = checkIsToday(currentDate, today);
|
|
1933
|
-
const isDisabled = checkIsDisabled(currentDate, min, max);
|
|
1934
|
-
rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
|
|
1935
|
-
dayCounter++;
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
|
|
1939
|
-
}
|
|
1940
|
-
return calendarCells;
|
|
1957
|
+
const styles = {
|
|
1958
|
+
...defaultStyle,
|
|
1959
|
+
border: 'border-b border-b-2 border-gray last:border-0',
|
|
1960
|
+
position: 'relative flex items-center justify-center',
|
|
1941
1961
|
};
|
|
1942
|
-
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
onDateSelect(date);
|
|
1952
|
-
setValue(false);
|
|
1953
|
-
}, []);
|
|
1954
|
-
const { firstDayOfWeek, totalDays } = useMemo(() => ({
|
|
1955
|
-
firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
|
|
1956
|
-
totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
|
|
1957
|
-
}), [currentYear, currentMonth]);
|
|
1958
|
-
return (jsxs("table", { className: "mx-auto", children: [jsx("thead", { className: "text-gray font-light", children: jsx("tr", { children: WEEK_DAYS.map((day, index) => (jsx("th", { className: "p-s", children: day }, String(index)))) }) }), jsx("tbody", { children: renderCalendarCells({
|
|
1959
|
-
firstDayOfWeek,
|
|
1960
|
-
today,
|
|
1961
|
-
totalDays,
|
|
1962
|
-
currentYear,
|
|
1963
|
-
currentMonth,
|
|
1964
|
-
min,
|
|
1965
|
-
max,
|
|
1966
|
-
onDateClick: handleDateClick,
|
|
1967
|
-
}) })] }));
|
|
1962
|
+
// TODO: Добавить метод определения центральной точки
|
|
1963
|
+
const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
|
|
1964
|
+
const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
|
|
1965
|
+
const changeZoom = () => {
|
|
1966
|
+
const currentZoom = yandexMaps.current.getZoom();
|
|
1967
|
+
const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
|
|
1968
|
+
yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
|
|
1969
|
+
};
|
|
1970
|
+
return (jsx("div", { onClick: changeZoom, className: `${Object.values(styles).join(' ')} bg-white select-none cursor-pointer w-12 h-12`, children: jsx(Icon, { name: iconName, width: "20", height: "16" }) }));
|
|
1968
1971
|
});
|
|
1969
1972
|
|
|
1970
|
-
const
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
'Ноябрь',
|
|
1982
|
-
'Декабрь',
|
|
1983
|
-
];
|
|
1984
|
-
|
|
1985
|
-
function normalizeWithMask(value, pattern) {
|
|
1986
|
-
const valueNumbers = value.replace(/\D/g, '');
|
|
1987
|
-
if (valueNumbers === '' || value?.length === pattern.length) {
|
|
1988
|
-
return value;
|
|
1989
|
-
}
|
|
1990
|
-
const patternInArr = [...pattern];
|
|
1991
|
-
const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
|
|
1992
|
-
const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
|
|
1993
|
-
const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
|
|
1994
|
-
const resultInArr = patternInArr.map(applyPlaceholder);
|
|
1995
|
-
const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
|
|
1996
|
-
return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
|
|
1997
|
-
}
|
|
1998
|
-
const isPlaceholder$1 = (_) => _ === '_';
|
|
1999
|
-
const isDigit$1 = (_) => /\d/.test(_);
|
|
2000
|
-
const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
|
|
2001
|
-
|
|
2002
|
-
const START_YEAR = 1940;
|
|
2003
|
-
const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
|
|
2004
|
-
|
|
2005
|
-
const ICON_PROPS$1 = {
|
|
2006
|
-
name: 'CalendarIcon',
|
|
2007
|
-
iconVersion: 'black',
|
|
2008
|
-
width: '24',
|
|
2009
|
-
height: '24',
|
|
2010
|
-
};
|
|
2011
|
-
const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
|
|
2012
|
-
const ref = useRef(null);
|
|
2013
|
-
const [inputValue, setInputValue] = useState(value || '');
|
|
2014
|
-
const handleChange = (ev) => {
|
|
2015
|
-
const val = ev.target?.value;
|
|
2016
|
-
if (typeof val === 'string' && val?.length < 11) {
|
|
2017
|
-
setInputValue(normalizeWithMask(val, '__.__.____'));
|
|
2018
|
-
}
|
|
2019
|
-
};
|
|
2020
|
-
const onBlur = () => {
|
|
2021
|
-
if (checkIsValidDate(inputValue)) {
|
|
2022
|
-
const [day, month, year] = inputValue.split('.');
|
|
2023
|
-
onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
|
|
2024
|
-
setSelectedMonth(Number(month) - 1);
|
|
2025
|
-
setSelectedYear(Number(year));
|
|
1973
|
+
const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
|
|
1974
|
+
// TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
|
|
1975
|
+
// Сейчас реализован поиск среди тестовых данных
|
|
1976
|
+
// TODO: Также выяснить что делать когда ничего не найдено
|
|
1977
|
+
// TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
|
|
1978
|
+
const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
|
|
1979
|
+
const map = useRef(null);
|
|
1980
|
+
const yandexMaps = useYandexMaps();
|
|
1981
|
+
useEffect(() => {
|
|
1982
|
+
if (map.current) {
|
|
1983
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad, selectedAddress });
|
|
2026
1984
|
}
|
|
2027
1985
|
else {
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
1986
|
+
yandexMaps?.ready(() => {
|
|
1987
|
+
// Ready function may be called few times, but must be called once
|
|
1988
|
+
if (map.current) {
|
|
1989
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
map.current = new yandexMaps.Map('map', {
|
|
1993
|
+
center: getCenterPoint(points),
|
|
1994
|
+
zoom,
|
|
1995
|
+
controls: [],
|
|
1996
|
+
suppressMapOpenBlock: true,
|
|
1997
|
+
});
|
|
1998
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
1999
|
+
});
|
|
2034
2000
|
}
|
|
2035
|
-
|
|
2036
|
-
};
|
|
2001
|
+
}, [yandexMaps, points, zoom, isLoad, selectedAddress]);
|
|
2037
2002
|
useEffect(() => {
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
const [day, month, year] = date.split('.');
|
|
2046
|
-
if (isValidYear(year)) {
|
|
2047
|
-
if (isValidMonth(month)) {
|
|
2048
|
-
const currentDate = new Date(Number(year), Number(month) - 1, 1);
|
|
2049
|
-
let maxDateOfMonth = 0;
|
|
2050
|
-
while (currentDate.getMonth() === Number(month) - 1) {
|
|
2051
|
-
currentDate.setDate(currentDate.getDate() + 1);
|
|
2052
|
-
maxDateOfMonth++;
|
|
2053
|
-
}
|
|
2054
|
-
if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
|
|
2055
|
-
return true;
|
|
2056
|
-
}
|
|
2003
|
+
if (map.current && selectedAddress) {
|
|
2004
|
+
yandexMaps?.geocode(selectedAddress).then((res) => {
|
|
2005
|
+
const firstGeoObject = res.geoObjects.get(0);
|
|
2006
|
+
const coords = firstGeoObject.geometry.getCoordinates();
|
|
2007
|
+
map.current.setCenter(coords);
|
|
2008
|
+
map.current.setZoom(18);
|
|
2009
|
+
});
|
|
2057
2010
|
}
|
|
2011
|
+
}, [selectedAddress]);
|
|
2012
|
+
if (!yandexMaps) {
|
|
2013
|
+
return null;
|
|
2058
2014
|
}
|
|
2059
|
-
|
|
2015
|
+
const zIndex = 'z-10';
|
|
2016
|
+
return (jsxs("div", { id: "map", className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
|
|
2017
|
+
});
|
|
2018
|
+
const getCenterPoint = (points) => {
|
|
2019
|
+
const centerCoords = [
|
|
2020
|
+
getArraySumAndAverage(mapByIndex(points, 0)),
|
|
2021
|
+
getArraySumAndAverage(mapByIndex(points, 1)),
|
|
2022
|
+
];
|
|
2023
|
+
return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
|
|
2060
2024
|
};
|
|
2025
|
+
const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
|
|
2026
|
+
const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
|
|
2061
2027
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2028
|
+
async function doRequest(url, method, body) {
|
|
2029
|
+
const response = await fetch(`${API_BASE_URI}${url}`, {
|
|
2030
|
+
method,
|
|
2031
|
+
headers: {
|
|
2032
|
+
'Content-Type': 'application/json',
|
|
2033
|
+
...getAuthorizationHeaders(),
|
|
2034
|
+
},
|
|
2035
|
+
credentials: 'include',
|
|
2036
|
+
body: body ? JSON.stringify(body) : null,
|
|
2037
|
+
});
|
|
2038
|
+
// TODO: add error handling
|
|
2039
|
+
return isJSON(response) ? response.json() : response;
|
|
2040
|
+
}
|
|
2041
|
+
// TODO: Need delete isJSON
|
|
2042
|
+
const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
|
|
2043
|
+
const getAuthorizationHeaders = () => {
|
|
2044
|
+
const token = sessionStorage.getItem('accessToken');
|
|
2045
|
+
return token ? { Authorization: `Bearer ${token}` } : null;
|
|
2046
|
+
};
|
|
2065
2047
|
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2048
|
+
const regionOffices = async (regionKey) => {
|
|
2049
|
+
const response = await doRequest('/public-data/regionOffices', 'POST', {
|
|
2050
|
+
regionRfCd: {
|
|
2051
|
+
key: regionKey,
|
|
2052
|
+
},
|
|
2053
|
+
cashCardFlg: true,
|
|
2054
|
+
});
|
|
2055
|
+
return await response.json().then((_) => _?.offices?.map((office) => ({
|
|
2056
|
+
...office,
|
|
2057
|
+
gpsLatitude: (office.latitude ?? DEFAULT_CENTER_COORDS[0]).toString().replace(',', '.'),
|
|
2058
|
+
gpsLongitude: (office.longitude ?? DEFAULT_CENTER_COORDS[1]).toString().replace(',', '.'),
|
|
2059
|
+
})));
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
|
|
2063
|
+
const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
|
|
2064
|
+
const onToggle = useCallback(() => {
|
|
2065
|
+
setIsUnfolded((_) => !_);
|
|
2066
|
+
}, []);
|
|
2067
|
+
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
2068
|
+
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
2069
|
+
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
2070
|
+
});
|
|
2071
|
+
|
|
2072
|
+
function useResizeObserver(callback, deps) {
|
|
2073
|
+
const ref = useRef(null);
|
|
2074
|
+
useEffect(() => {
|
|
2075
|
+
const element = ref?.current;
|
|
2076
|
+
if (!element) {
|
|
2077
|
+
return undefined;
|
|
2091
2078
|
}
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
onMonthSelect(months.indexOf(key));
|
|
2095
|
-
const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
|
|
2096
|
-
handleChangeMonth({
|
|
2097
|
-
maxDateOfMonth,
|
|
2098
|
-
selectedYear,
|
|
2099
|
-
selectedMonth: months.indexOf(key),
|
|
2100
|
-
value,
|
|
2101
|
-
onChange,
|
|
2079
|
+
const observer = new ResizeObserver((entries) => {
|
|
2080
|
+
callback(element, entries[0]);
|
|
2102
2081
|
});
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
}, [
|
|
2108
|
-
return
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2082
|
+
observer.observe(element);
|
|
2083
|
+
return () => {
|
|
2084
|
+
observer.disconnect();
|
|
2085
|
+
};
|
|
2086
|
+
}, [callback, ...deps]);
|
|
2087
|
+
return ref;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
2091
|
+
const containerRef = useRef(null);
|
|
2092
|
+
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
2093
|
+
if (containerRef.current) {
|
|
2094
|
+
containerRef.current.style.maxHeight = isUnfolded
|
|
2095
|
+
? `${childrenWrapperEl.scrollHeight}px`
|
|
2096
|
+
: '';
|
|
2097
|
+
}
|
|
2098
|
+
}, [isUnfolded]);
|
|
2099
|
+
return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} `, children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
|
|
2100
|
+
});
|
|
2101
|
+
|
|
2102
|
+
const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
|
|
2103
|
+
const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
|
|
2104
|
+
if ([textItems.length, children, subText].every((_) => !_)) {
|
|
2105
|
+
return null;
|
|
2106
|
+
}
|
|
2107
|
+
return renderCardCell({ textItems, subText, children, isPhone, ...props });
|
|
2108
|
+
});
|
|
2109
|
+
const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, isPhone = false, }) => (jsxs("div", { className: style('flex gap-2xs flex-col h-full max-w-[300px]', className), children: [label ? (jsx(Text, { color: "text-secondary-text", font: "font-light", size: labelSize, children: label })) : null, children || renderTextItems(textItems, isPhone), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
|
|
2110
|
+
const renderTextItems = (textItems, isPhone) => textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: isPhone ? jsx("a", { href: `tel:${cleanPhoneNumber(text)}`, children: text.trim() }) : text.trim() }, String(i))));
|
|
2111
|
+
const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
|
|
2112
|
+
|
|
2113
|
+
const CardRow = JSX(({ className, children }) => (jsx("div", { className: style('flex flex-col sm:flex-row sm:border-t sm:border-solid sm:border-main-divider py-xl gap-x-6xl gap-y-xl', className), children: children })));
|
|
2114
|
+
|
|
2115
|
+
const getScheduleDescription = (workScheduleWeek) => {
|
|
2116
|
+
const rows = getDateDescription(workScheduleWeek);
|
|
2117
|
+
return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
|
|
2118
2118
|
};
|
|
2119
|
-
const
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
while (date.getMonth() === selectedMonth) {
|
|
2123
|
-
maxDateOfMonth++;
|
|
2124
|
-
date.setDate(date.getDate() + 1);
|
|
2119
|
+
const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
|
|
2120
|
+
if (!workTime) {
|
|
2121
|
+
return '';
|
|
2125
2122
|
}
|
|
2126
|
-
return
|
|
2123
|
+
return [
|
|
2124
|
+
`${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
|
|
2125
|
+
lunchHour ? `перерыв: ${lunchHour}` : '',
|
|
2126
|
+
daysOff ? `не работает: ${daysOff}` : '',
|
|
2127
|
+
]
|
|
2128
|
+
.filter(Boolean)
|
|
2129
|
+
.join('; ');
|
|
2127
2130
|
};
|
|
2128
|
-
const
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
+
const getDateDescription = (workScheduleWeek) => {
|
|
2132
|
+
const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
|
|
2133
|
+
const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
|
|
2134
|
+
const daysOff = workScheduleWeek
|
|
2135
|
+
.filter((_) => !_.status)
|
|
2136
|
+
.map((_) => _.short?.toLowerCase())
|
|
2137
|
+
.join(', ');
|
|
2138
|
+
const rows = [
|
|
2139
|
+
buildScheduleText({
|
|
2140
|
+
workTime: workingWeekday?.workTime,
|
|
2141
|
+
lunchHour: workingWeekday?.lunchHour,
|
|
2142
|
+
daysOff: workingSaturday ? '' : daysOff,
|
|
2143
|
+
}),
|
|
2144
|
+
buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
|
|
2145
|
+
].filter(Boolean);
|
|
2146
|
+
return rows;
|
|
2131
2147
|
};
|
|
2132
2148
|
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2149
|
+
const WEEKDAY_MAP = [
|
|
2150
|
+
['workingMonday', 'Пн', 'Понедельник'],
|
|
2151
|
+
['workingTuesday', 'Вт', 'Вторник'],
|
|
2152
|
+
['workingWednesday', 'Ср', 'Среда'],
|
|
2153
|
+
['workingThursday', 'Чт', 'Четверг'],
|
|
2154
|
+
['workingFriday', 'Пт', 'Пятница'],
|
|
2155
|
+
['workingSaturday', 'Сб', 'Суббота'],
|
|
2156
|
+
['workingSunday', 'Вс', 'Воскресенье'],
|
|
2157
|
+
];
|
|
2158
|
+
const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
|
|
2159
|
+
key,
|
|
2160
|
+
title,
|
|
2161
|
+
short,
|
|
2162
|
+
status: Boolean(workSchedule?.[key]),
|
|
2163
|
+
get workTime() {
|
|
2164
|
+
return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
|
|
2165
|
+
},
|
|
2166
|
+
get lunchHour() {
|
|
2167
|
+
return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
|
|
2168
|
+
},
|
|
2169
|
+
get hasLunch() {
|
|
2170
|
+
return /\d+/.test(this.lunchHour ?? '');
|
|
2171
|
+
},
|
|
2172
|
+
}));
|
|
2173
|
+
|
|
2174
|
+
const renderBusinessSchedule = (scheduleDescription) => {
|
|
2175
|
+
if (!scheduleDescription) {
|
|
2176
|
+
return null;
|
|
2177
|
+
}
|
|
2178
|
+
const businessSchedule = getBusinessSchedule(scheduleDescription);
|
|
2179
|
+
return (jsxs(CardRow, { className: "border-none", children: [jsx(CardCell, { label: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: businessSchedule.map(renderAlternativeDay) }) }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: scheduleDescription }) })] }));
|
|
2138
2180
|
};
|
|
2139
|
-
const
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2181
|
+
const getBusinessSchedule = (scheduleDescription) => {
|
|
2182
|
+
const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
|
|
2183
|
+
const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
|
|
2184
|
+
const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
|
|
2185
|
+
if (!lastPartScheduleDescription?.includes('выходной')) {
|
|
2186
|
+
return weekDayMap;
|
|
2187
|
+
}
|
|
2188
|
+
return weekDayMap.map((_) => ({
|
|
2189
|
+
..._,
|
|
2190
|
+
status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
|
|
2191
|
+
}));
|
|
2143
2192
|
};
|
|
2144
|
-
const
|
|
2145
|
-
// eslint-disable-next-line max-lines-per-function
|
|
2146
|
-
({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
|
|
2147
|
-
const [showCalendar, { setValue }] = useBool(false);
|
|
2148
|
-
const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
|
|
2149
|
-
const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
|
|
2150
|
-
const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
|
|
2151
|
-
onYearSelect: setSelectedYear,
|
|
2152
|
-
onMonthSelect: setSelectedMonth,
|
|
2153
|
-
onShowCalendar: setValue,
|
|
2154
|
-
selectedYear,
|
|
2155
|
-
selectedMonth,
|
|
2156
|
-
showCalendar,
|
|
2157
|
-
onChange,
|
|
2158
|
-
value,
|
|
2159
|
-
});
|
|
2160
|
-
const spaceAbove = useElementSpace(ref, 370);
|
|
2161
|
-
return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
|
|
2162
|
-
handleChangeVisibleCalendar,
|
|
2163
|
-
value,
|
|
2164
|
-
valid,
|
|
2165
|
-
onChange,
|
|
2166
|
-
disabled,
|
|
2167
|
-
setSelectedMonth,
|
|
2168
|
-
setSelectedYear,
|
|
2169
|
-
}), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
|
|
2170
|
-
'bottom-full': spaceAbove,
|
|
2171
|
-
}), children: [jsxs("div", { className: "flex gap-s", children: [jsx("div", { className: "my-auto", onClick: handlePrevMonth, children: jsx(Icon, { ...ICON_PROPS, className: "-rotate-90 cursor-pointer" }) }), jsx(Select, { onChange: handleSelectMonth, value: { key: months[selectedMonth] }, options: monthsOptions, ...SELECT_PROPS }), jsx(Select, { onChange: handleSelectYear, value: { key: String(selectedYear) }, options: yearsOptions, ...SELECT_PROPS }), jsx("div", { className: "my-auto", onClick: handleNextMonth, children: jsx(Icon, { ...ICON_PROPS, className: "rotate-90 cursor-pointer" }) })] }), jsx(Calendar, { today: value, currentMonth: selectedMonth, currentYear: selectedYear, onDateSelect: onChange, min: minDate, max: maxDate, setValue: setValue })] })) : null] })] }));
|
|
2172
|
-
});
|
|
2193
|
+
const renderAlternativeDay = ({ short, status }, i) => (jsx("div", { className: style('w-9 h-9 rounded-md flex items-center justify-center', status ? 'bg-green-more-light text-green-dark' : 'bg-error/30 text-error'), children: jsx(Text, { size: "text-xs", children: short }) }, String(i)));
|
|
2173
2194
|
|
|
2174
|
-
const
|
|
2195
|
+
const renderCurrency = ({ currency, buyExchangeRate, saleExchangeRate }, i) => (jsxs("div", { className: "flex gap-lg h-full", children: [currency?.currency ? jsx(CardCell, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", value: currency.currency }) : null, buyExchangeRate ? jsx(CardCell, { label: "\u041A\u0443\u043F\u0438\u0442\u044C", value: String(buyExchangeRate) }) : null, saleExchangeRate ? jsx(CardCell, { label: "\u041F\u0440\u043E\u0434\u0430\u0442\u044C", value: String(saleExchangeRate) }) : null] }, String(i)));
|
|
2175
2196
|
|
|
2176
|
-
const
|
|
2197
|
+
const colorStyle = {
|
|
2198
|
+
yellow: { border: 'border-yellow-light', text: 'text-yellow' },
|
|
2199
|
+
green: { border: 'border-green-more-light', text: 'text-green-dark' },
|
|
2200
|
+
gray: { border: 'border-gray', text: 'text-secondary-text' },
|
|
2201
|
+
red: { border: 'border-error/30', text: 'text-error' },
|
|
2202
|
+
};
|
|
2203
|
+
const Badge$1 = JSX(({ className, children, color = 'gray' }) => (jsxs("div", { className: style('sm:p-s sm:border sm:border-green rounded-md flex items-center h-fit', colorStyle[color].border, className), children: [jsx("div", { className: "block pr-m sm:pr-0 sm:hidden", children: jsx(Img, { image: { icon: 'SmallClockIcon' }, width: "24", height: "24" }) }), jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children })] })));
|
|
2177
2204
|
|
|
2178
|
-
const
|
|
2179
|
-
|
|
2180
|
-
const
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
return (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$8), validatorObj.birthday, input?.required), error: isRetailForm && value && !birthdayValidate(value) ? AGE_ERROR_MESSAGE : '', disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$8) }));
|
|
2185
|
-
});
|
|
2186
|
-
const birthdayValidate = (date) => {
|
|
2187
|
-
const today = new Date();
|
|
2188
|
-
const minDate = new Date(today.getFullYear() - MIN_AGE, today.getMonth(), today.getDate());
|
|
2189
|
-
const maxDate = new Date(today.getFullYear() - MAX_AGE, today.getMonth(), today.getDate());
|
|
2190
|
-
if (!date || date > minDate || date < maxDate) {
|
|
2191
|
-
return false;
|
|
2205
|
+
const currentWeekDayIdx = new Date().getDay();
|
|
2206
|
+
//TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
|
|
2207
|
+
const renderCurrentDaySchedule = (workScheduleWeek) => {
|
|
2208
|
+
const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
|
|
2209
|
+
if (!currentWeekDay) {
|
|
2210
|
+
return null;
|
|
2192
2211
|
}
|
|
2193
|
-
|
|
2212
|
+
const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
|
|
2213
|
+
return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge$1, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge$1, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge$1, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
|
|
2194
2214
|
};
|
|
2195
2215
|
|
|
2196
|
-
const
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
});
|
|
2203
|
-
|
|
2204
|
-
const ChildrenField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('children'), validatorObj.children, input?.required), ...input })));
|
|
2205
|
-
|
|
2206
|
-
const CodeWordField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434\u043E\u0432\u043E\u0435 \u0441\u043B\u043E\u0432\u043E", ...getValidation(field('codeWord'), validatorObj.codeWord, input?.required), ...input })));
|
|
2207
|
-
|
|
2208
|
-
const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", type: "number", ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
|
|
2216
|
+
const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
|
|
2217
|
+
if (!status) {
|
|
2218
|
+
return 'Не работает';
|
|
2219
|
+
}
|
|
2220
|
+
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
2221
|
+
};
|
|
2222
|
+
const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
|
|
2209
2223
|
|
|
2210
|
-
const
|
|
2224
|
+
const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
2225
|
+
const labels = ['Подробнее', 'Скрыть'];
|
|
2226
|
+
const renderFoldButton$3 = ({ isUnfolded, onToggle }) => (jsxs("button", { className: "w-full py-2xl cursor-pointer text-primary-main flex items-center border-b border-solid border-main-divider", onClick: onToggle, type: "button", children: [jsx("div", { className: "pr-m", children: labels[Number(isUnfolded)] }), jsx(Icon, { className: "text-primary-text", name: ICONS$1[Number(isUnfolded)], width: "16", height: "16" })] }));
|
|
2211
2227
|
|
|
2212
|
-
const
|
|
2213
|
-
const
|
|
2214
|
-
|
|
2215
|
-
|
|
2228
|
+
const renderWorkSchedule = (workSchedule) => {
|
|
2229
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2230
|
+
const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
|
|
2231
|
+
const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
|
|
2232
|
+
if (!workSchedule) {
|
|
2233
|
+
return '';
|
|
2234
|
+
}
|
|
2235
|
+
if (!workSchedule.businessScheduleVisibleTag) {
|
|
2236
|
+
return renderMatchingTimeOfWork(timeOfWork);
|
|
2237
|
+
}
|
|
2238
|
+
if (workSchedule.businessScheduleVisibleTag &&
|
|
2239
|
+
workSchedule.businessScheduleDescription === null) {
|
|
2240
|
+
return renderIndividualTimeOfWork(timeOfWork);
|
|
2241
|
+
}
|
|
2242
|
+
return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
|
|
2243
|
+
};
|
|
2244
|
+
const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
|
|
2245
|
+
const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
|
|
2246
|
+
const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
|
|
2216
2247
|
|
|
2217
|
-
const
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
},
|
|
2246
|
-
};
|
|
2247
|
-
|
|
2248
|
-
async function doRequest(url, method, body) {
|
|
2249
|
-
const response = await fetch(`${API_BASE_URI}${url}`, {
|
|
2250
|
-
method,
|
|
2251
|
-
headers: {
|
|
2252
|
-
'Content-Type': 'application/json',
|
|
2253
|
-
...getAuthorizationHeaders(),
|
|
2254
|
-
},
|
|
2255
|
-
credentials: 'include',
|
|
2256
|
-
body: body ? JSON.stringify(body) : null,
|
|
2257
|
-
});
|
|
2258
|
-
// TODO: add error handling
|
|
2259
|
-
return isJSON(response) ? response.json() : response;
|
|
2260
|
-
}
|
|
2261
|
-
// TODO: Need delete isJSON
|
|
2262
|
-
const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
|
|
2263
|
-
const getAuthorizationHeaders = () => {
|
|
2264
|
-
const token = sessionStorage.getItem('accessToken');
|
|
2265
|
-
return token ? { Authorization: `Bearer ${token}` } : null;
|
|
2248
|
+
const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
|
|
2249
|
+
if (!workSchedule) {
|
|
2250
|
+
return null;
|
|
2251
|
+
}
|
|
2252
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2253
|
+
return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: name }), address ? (jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), jsx(Text, { size: "text-l", children: address })] })) : null] }), renderCurrentDaySchedule(workScheduleWeek)] }), jsx("div", { className: "hidden sm:block", children: renderCardContent$1({
|
|
2254
|
+
phone,
|
|
2255
|
+
fax,
|
|
2256
|
+
phoneBusiness,
|
|
2257
|
+
phoneNatural,
|
|
2258
|
+
phoneCallCentre,
|
|
2259
|
+
phoneCurrencyControl,
|
|
2260
|
+
workSchedule,
|
|
2261
|
+
exchangeRate,
|
|
2262
|
+
}) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
|
|
2263
|
+
return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
|
|
2264
|
+
phone,
|
|
2265
|
+
fax,
|
|
2266
|
+
phoneBusiness,
|
|
2267
|
+
phoneNatural,
|
|
2268
|
+
phoneCallCentre,
|
|
2269
|
+
phoneCurrencyControl,
|
|
2270
|
+
workSchedule,
|
|
2271
|
+
exchangeRate,
|
|
2272
|
+
}) }));
|
|
2273
|
+
},
|
|
2274
|
+
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
2275
|
+
renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
|
|
2266
2276
|
};
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
const
|
|
2270
|
-
|
|
2277
|
+
const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
|
|
2278
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2279
|
+
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
2280
|
+
? 'Для физических лиц'
|
|
2281
|
+
: 'Для физических и юридических лиц';
|
|
2282
|
+
return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness, isPhone: true }), jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), workSchedule?.isMatchesPattern ? (jsx(CardRow, { children: jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (jsxs(CardRow, { children: [jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
|
|
2283
|
+
? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
|
|
2284
|
+
: null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
|
|
2271
2285
|
};
|
|
2272
|
-
|
|
2273
|
-
const
|
|
2274
|
-
const
|
|
2275
|
-
|
|
2286
|
+
const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
|
|
2287
|
+
const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
|
|
2288
|
+
const header = capitalizedFirstLetter$1(name);
|
|
2289
|
+
const body = `${address} ${renderWorkSchedule(workSchedule)}`;
|
|
2290
|
+
return { header, body };
|
|
2276
2291
|
};
|
|
2277
2292
|
|
|
2278
|
-
const
|
|
2293
|
+
const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
|
|
2279
2294
|
|
|
2280
|
-
const
|
|
2281
|
-
|
|
2282
|
-
const handleClose = useCallback(() => {
|
|
2283
|
-
close();
|
|
2284
|
-
onClose && onClose();
|
|
2285
|
-
}, [onClose]);
|
|
2286
|
-
return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
|
|
2287
|
-
});
|
|
2295
|
+
const isClient = !isSSR();
|
|
2296
|
+
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
2288
2297
|
|
|
2289
|
-
const
|
|
2290
|
-
|
|
2291
|
-
|
|
2298
|
+
const INITIAL_FILTRATION_STATE$1 = {
|
|
2299
|
+
workingSaturday: false,
|
|
2300
|
+
premiumService: false,
|
|
2301
|
+
privateBanking: false,
|
|
2302
|
+
remoteWorkplace: false,
|
|
2303
|
+
serviceDisabledPeople: false,
|
|
2304
|
+
sellingCoins: false,
|
|
2305
|
+
buyingCoins: false,
|
|
2306
|
+
bullionOperations: false,
|
|
2307
|
+
preciousMetalsOperations: false,
|
|
2308
|
+
transferringDataToBiometricSystem: false,
|
|
2292
2309
|
};
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2310
|
+
const FILTRATION_LABELS = {
|
|
2311
|
+
safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
|
|
2312
|
+
workingSaturday: 'Открыты по субботам',
|
|
2313
|
+
terminalTypeAtms: 'Банкоматы',
|
|
2314
|
+
terminalTypeTerm: 'Терминалы',
|
|
2315
|
+
workAllTime: 'Круглосуточно',
|
|
2316
|
+
billAcceptorEnable: 'Прием наличных',
|
|
2317
|
+
premiumService: 'Премиальное обслуживание',
|
|
2318
|
+
privateBanking: 'Услуга Private banking',
|
|
2319
|
+
sellingCoins: 'Продажа монет из драгоценных металлов',
|
|
2320
|
+
buyingCoins: 'Покупка монет из драгоценных металлов',
|
|
2321
|
+
bullionOperations: 'Операции со слитками',
|
|
2322
|
+
preciousMetalsOperations: 'Операции с драгоценными металлами',
|
|
2323
|
+
transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
|
|
2324
|
+
locationDisabledPeople: 'Для маломобильных',
|
|
2325
|
+
designDisabledPeople: 'Для слабовидящих',
|
|
2326
|
+
remoteWorkplace: 'Удаленное рабочее место',
|
|
2327
|
+
serviceDisabledPeople: 'Для маломобильных граждан',
|
|
2328
|
+
};
|
|
2329
|
+
const FILTRATION_PREDICATES$1 = {
|
|
2330
|
+
workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
|
|
2331
|
+
premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
|
|
2332
|
+
privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
|
|
2333
|
+
remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
|
|
2334
|
+
serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
|
|
2335
|
+
sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
|
|
2336
|
+
buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
|
|
2337
|
+
bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
|
|
2338
|
+
preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
|
|
2339
|
+
transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
|
|
2314
2340
|
};
|
|
2315
|
-
const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
|
|
2316
2341
|
|
|
2317
|
-
|
|
2342
|
+
function useButton() {
|
|
2343
|
+
return (props) => ({
|
|
2344
|
+
...props,
|
|
2345
|
+
onClick: handlerDecorator(handleClick(props)),
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2348
|
+
function handleClick({ disabled, onClick }) {
|
|
2349
|
+
return (ev) => {
|
|
2350
|
+
!disabled && onClick && onClick(ev);
|
|
2351
|
+
};
|
|
2352
|
+
}
|
|
2318
2353
|
|
|
2319
|
-
const
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2354
|
+
const buttonStyleMap = {
|
|
2355
|
+
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
2356
|
+
secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
|
|
2357
|
+
};
|
|
2358
|
+
const secondaryButtonStyleMap = {
|
|
2359
|
+
primary: style('group-data-secondary:text-primary-main group-data-secondary:bg-white', 'group-data-secondary:hover:text-white group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
2360
|
+
secondary: style('group-data-secondary:text-white group-data-secondary:bg-white/20', 'group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
2361
|
+
};
|
|
2362
|
+
const Button = JSX(({ children, ...props }) => {
|
|
2363
|
+
const button = useButton();
|
|
2364
|
+
const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
|
|
2365
|
+
return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
|
|
2366
|
+
'text-white bg-primary-active': active,
|
|
2367
|
+
'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
|
|
2368
|
+
'rounded-md': rounded,
|
|
2369
|
+
}, !active && !disabled
|
|
2370
|
+
? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
|
|
2371
|
+
: '', className), type: type, role: role, onClick: onClick, children: children }));
|
|
2323
2372
|
});
|
|
2324
2373
|
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2327
|
-
const DependentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0436\u0434\u0438\u0432\u0435\u043D\u0446\u0435\u0432", placeholder: "\u0417\u0430 \u0438\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('dependents'), validatorObj.dependents, input?.required), ...input })));
|
|
2374
|
+
const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
|
|
2328
2375
|
|
|
2329
|
-
const
|
|
2376
|
+
const renderButtonsGroup = (data, activeButton, onButtonClick) => {
|
|
2377
|
+
const allButtonVersion = getVersion(activeButton === 'all');
|
|
2378
|
+
const businessButtonVersion = getVersion(activeButton === 'business');
|
|
2379
|
+
const handleClick = (e, key, branches) => {
|
|
2380
|
+
const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
|
|
2381
|
+
onButtonClick(key);
|
|
2382
|
+
return filteredBranches;
|
|
2383
|
+
};
|
|
2384
|
+
const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
|
|
2385
|
+
branch.workSchedule.businessScheduleVisibleTag &&
|
|
2386
|
+
!branch.workSchedule.businessScheduleDescription);
|
|
2387
|
+
return (jsxs("div", { className: "flex gap-lg flex-col sm:flex-row pb-lg", children: [jsx(Button, { "data-id": "all", onClick: (e) => handleClick(e, 'all', data), version: allButtonVersion, children: "\u0414\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" }), jsx(Button, { "data-id": "business", onClick: (e) => handleClick(e, 'business', data), version: businessButtonVersion, children: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" })] }));
|
|
2388
|
+
};
|
|
2330
2389
|
|
|
2331
|
-
const
|
|
2390
|
+
const renderDescriptionBlock$1 = ({ __html, list, richVersion }) => __html || list?.length ? (jsxs("div", { className: "mb-2xl border-b sm:border border-main-divider sm:rounded-md", children: [__html ? (jsx("div", { className: "mb-2xl", children: jsx(RichText, { __html: __html, richVersion: richVersion }) })) : null, list?.length ? (jsx("div", { className: "flex flex-col sm:flex-row gap-2xl sm:flex-wrap pb-2xl sm:pb-xl", children: list.map((item, i) => (jsxs("div", { className: "flex gap-xs items-center", children: [item?.image ? jsx(Img, { image: item.image }) : null, item?.text ? (jsx(Text, { size: "text-m", font: "font-light", children: item.text })) : null] }, String(i)))) })) : null] })) : null;
|
|
2332
2391
|
|
|
2333
|
-
const
|
|
2334
|
-
const
|
|
2392
|
+
const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
|
|
2393
|
+
const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
|
|
2394
|
+
const visibleFiltersNum = onlyOffice ? 5 : 6;
|
|
2395
|
+
const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
|
|
2396
|
+
const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
|
|
2397
|
+
? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
|
|
2398
|
+
: [filtersCheckbox, []];
|
|
2399
|
+
return (jsx("div", { children: filters?.length ? (jsx("div", { children: jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs("div", { children: [jsx("div", { className: COMMON_FILTERS_STYLES, children: visibleFilters }), jsx(FoldableSection, { className: COMMON_FILTERS_STYLES, isUnfolded: isUnfolded, children: hiddenFilters })] })), renderFoldButton: renderFoldButton$2(reset, onlyOffice) }) })) : null }));
|
|
2400
|
+
};
|
|
2401
|
+
const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
|
|
2402
|
+
const labels = ['Больше фильтров', 'Меньше фильтров'];
|
|
2403
|
+
const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
2404
|
+
return (jsxs("div", { className: "flex space-x-lg", children: [onlyOffice ? (jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", appendRight: jsx(Icon, { name: icons[Number(isUnfolded)], width: "16", height: "16" }), text: labels[Number(isUnfolded)], onClick: onToggle })) : null, jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", onClick: reset, children: renderBtnInner() })] }));
|
|
2405
|
+
};
|
|
2406
|
+
const renderBtnInner = () => (jsxs("div", { className: "flex items-center", children: ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440", jsx(Icon, { name: "CloseIcon", width: "16", height: "16", className: "ml-2xs" })] }));
|
|
2335
2407
|
|
|
2336
|
-
const
|
|
2337
|
-
const DulIssuedByField = JSX(({ field, input }) => {
|
|
2338
|
-
const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
|
|
2339
|
-
const onDaDataChange = useCallback((item) => {
|
|
2340
|
-
changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
|
|
2341
|
-
}, []);
|
|
2342
|
-
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$5), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
|
|
2343
|
-
});
|
|
2408
|
+
const renderHeading = (title, lengthItems) => (jsx("div", { className: "flex flex-col sm:flex-row gap-xs mb-2xl", children: jsxs(Heading, { headingType: "h3", children: [jsx("span", { suppressHydrationWarning: true, children: title }), lengthItems ? (jsx(Text, { size: "text-h2", color: "text-secondary-text", children: jsx("span", { suppressHydrationWarning: true, children: ` (${lengthItems})` }) })) : null] }) }));
|
|
2344
2409
|
|
|
2345
|
-
const
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2410
|
+
const defaultEmptyFunction$1 = () => void 0;
|
|
2411
|
+
const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
|
|
2412
|
+
const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
|
|
2413
|
+
const onlyOffice = title?.includes('Офис');
|
|
2414
|
+
const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
|
|
2415
|
+
const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
|
|
2416
|
+
data,
|
|
2417
|
+
remoteWorkplaces,
|
|
2418
|
+
filtrationState,
|
|
2419
|
+
getBalloon,
|
|
2420
|
+
getBalloonRemoteWorkplaces,
|
|
2421
|
+
});
|
|
2422
|
+
const [activeButton, setActiveButton] = useState('all');
|
|
2423
|
+
const filterOptions = {
|
|
2424
|
+
filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
|
|
2425
|
+
field: { field, reset },
|
|
2426
|
+
onlyOffice,
|
|
2427
|
+
labels: FILTRATION_LABELS,
|
|
2428
|
+
};
|
|
2429
|
+
return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "p-3xl pb-0", children: [renderHeading(title, lengthItems), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton), jsx("div", { className: style('pb-3xl', filtersVisibleStyles(activeButton)), children: renderFiltrationForm(filterOptions) })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full" }) }) })] }), jsxs(ClientOnly, { children: [filteredItems.map(renderCard), filteredRemoteWorkplaces.map(renderRemoteWorkplaceCard)] })] }));
|
|
2362
2430
|
});
|
|
2431
|
+
const filterItems$1 = (data, filtrationState) => {
|
|
2432
|
+
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
2433
|
+
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
|
|
2434
|
+
};
|
|
2435
|
+
const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
|
|
2363
2436
|
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2437
|
+
const defaultEmptyFunction = () => void 0;
|
|
2438
|
+
const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
|
|
2439
|
+
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
2440
|
+
const _filteredItems = filterItems$1(data, filtrationState);
|
|
2441
|
+
const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
|
|
2442
|
+
const _points = [
|
|
2443
|
+
..._filteredItems.map((_) => ({
|
|
2444
|
+
type: 'offices',
|
|
2445
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
2446
|
+
content: getBalloon(_),
|
|
2447
|
+
})),
|
|
2448
|
+
..._filteredRemoteWorkplaces.map((_) => ({
|
|
2449
|
+
type: 'workplaces',
|
|
2450
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
2451
|
+
content: getBalloonRemoteWorkplaces({
|
|
2452
|
+
address: _.address,
|
|
2453
|
+
workScheduleDescription: _.workScheduleDescription,
|
|
2454
|
+
}),
|
|
2455
|
+
})),
|
|
2456
|
+
].filter((_) => _.coords && _.coords.length === 2);
|
|
2457
|
+
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
2458
|
+
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
2459
|
+
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
2460
|
+
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
2461
|
+
};
|
|
2368
2462
|
|
|
2369
|
-
const
|
|
2370
|
-
const { data
|
|
2371
|
-
|
|
2372
|
-
|
|
2463
|
+
const useLeadFormData = (typeField) => {
|
|
2464
|
+
const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
2465
|
+
if (data && 'errorMessage' in data) {
|
|
2466
|
+
return { error };
|
|
2467
|
+
}
|
|
2468
|
+
return { data: data, error };
|
|
2469
|
+
};
|
|
2470
|
+
const fetchData = async (url) => {
|
|
2471
|
+
const result = await fetchJSON(url, { method: 'POST' });
|
|
2472
|
+
return result || [];
|
|
2473
|
+
};
|
|
2373
2474
|
|
|
2374
|
-
const
|
|
2375
|
-
const
|
|
2376
|
-
|
|
2475
|
+
const AddressRetailField = JSX(({ field, input }) => {
|
|
2476
|
+
const [offices, setOffices] = useState([]);
|
|
2477
|
+
const { data } = useLeadFormData('REGION_RF');
|
|
2478
|
+
const regionValue = field('regionRetail')?.value || {};
|
|
2479
|
+
const fieldBranch = field('addressRetail');
|
|
2480
|
+
useEffect(() => {
|
|
2481
|
+
(async () => {
|
|
2482
|
+
const officesList = await regionOffices(regionValue?.key ?? '');
|
|
2483
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
2484
|
+
setOffices(officesList || []);
|
|
2485
|
+
})();
|
|
2486
|
+
if (regionValue?.key) {
|
|
2487
|
+
field?.('addressRetail')?.onChange?.('');
|
|
2488
|
+
}
|
|
2489
|
+
}, [regionValue.key]);
|
|
2490
|
+
const { points } = useOfficesAtmsMapData({
|
|
2491
|
+
data: offices,
|
|
2492
|
+
filtrationState: {},
|
|
2493
|
+
getBalloon: getOfficePoint,
|
|
2494
|
+
});
|
|
2495
|
+
const isRegionSelected = Boolean(regionValue?.key);
|
|
2496
|
+
return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: offices.map(({ id, address = '' }) => ({
|
|
2497
|
+
key: id?.toString() || '',
|
|
2498
|
+
text: address,
|
|
2499
|
+
})), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
|
|
2377
2500
|
});
|
|
2378
2501
|
|
|
2379
|
-
const
|
|
2380
|
-
const {
|
|
2381
|
-
|
|
2382
|
-
|
|
2502
|
+
const useNormalizedInput = (props, { normalize, format }) => {
|
|
2503
|
+
const { value, onFocus, onBlur, onChange } = props;
|
|
2504
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
2505
|
+
const handleFocus = useCallback((ev) => {
|
|
2506
|
+
setIsFocused(true);
|
|
2507
|
+
onFocus && onFocus(ev);
|
|
2508
|
+
}, []);
|
|
2509
|
+
const handleBlur = useCallback(() => {
|
|
2510
|
+
setIsFocused(false);
|
|
2511
|
+
onChange && onChange(normalize(value));
|
|
2512
|
+
onBlur && onBlur();
|
|
2513
|
+
}, [onChange, value]);
|
|
2514
|
+
return {
|
|
2515
|
+
value: (isFocused || !format ? value : format(value)),
|
|
2516
|
+
onFocus: handleFocus,
|
|
2517
|
+
onBlur: handleBlur,
|
|
2518
|
+
};
|
|
2519
|
+
};
|
|
2383
2520
|
|
|
2384
|
-
const
|
|
2521
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
|
|
2385
2522
|
|
|
2386
|
-
|
|
2523
|
+
function parseDecimal(value) {
|
|
2524
|
+
const rawValue = (value || '').replace(/\D/g, '');
|
|
2525
|
+
const unsafeDecimal = parseInt(rawValue, 10);
|
|
2526
|
+
return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
|
|
2527
|
+
}
|
|
2387
2528
|
|
|
2388
|
-
|
|
2389
|
-
const
|
|
2390
|
-
const
|
|
2391
|
-
const
|
|
2392
|
-
const
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2529
|
+
function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
|
|
2530
|
+
const rangeValue = list.length ? list.indexOf(value) : value;
|
|
2531
|
+
const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
|
|
2532
|
+
const percentage = (rangeValueShift * 100) / (max - min);
|
|
2533
|
+
const inputStyle = {
|
|
2534
|
+
backgroundSize: `${percentage.toFixed(2)}% 100%`,
|
|
2535
|
+
};
|
|
2536
|
+
return (jsxs("div", { children: [list.length ? (jsx("div", { className: "absolute w-full flex justify-between -bottom-[3px] px-m", children: list.map((_, i) => (jsx("div", { className: style('w-2 h-2 rounded-full', rangeValue <= i || disabled ? 'bg-gray' : 'bg-primary-main') }, String(i)))) })) : null, jsx("div", { className: "absolute inset-x-0 -bottom-1 px-m leading-[18px]", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider relative z-10", style: inputStyle, type: "range", min: min, max: max, step: step, value: rangeValue, disabled: disabled, onChange: ((ev) => {
|
|
2537
|
+
const rawValue = parseDecimal(ev.target?.value);
|
|
2538
|
+
const newValue = list.length ? list[rawValue] : rawValue;
|
|
2539
|
+
onChange && onChange(newValue || 0);
|
|
2540
|
+
}) }) })] }));
|
|
2541
|
+
}
|
|
2400
2542
|
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2403
|
-
|
|
2543
|
+
const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
|
|
2544
|
+
const DEFAULT_MIN = 1;
|
|
2545
|
+
const DEFAULT_MAX = 100;
|
|
2546
|
+
const InputRange = JSX((props) => {
|
|
2547
|
+
const { className, title, items = [], list = [], min = list.length ? 0 : DEFAULT_MIN, max = list.length ? list.length - 1 : DEFAULT_MAX, step = 1, value = list[0] || min, disabled = false, onChange, } = props;
|
|
2548
|
+
const normalizedProps = useNormalizedInput(props, {
|
|
2549
|
+
normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
|
|
2550
|
+
format: toLocalNumberFormat(),
|
|
2551
|
+
});
|
|
2552
|
+
const handleChange = useCallback((ev) => {
|
|
2553
|
+
onChange && onChange(parseDecimal(ev.target?.value));
|
|
2554
|
+
}, [onChange]);
|
|
2555
|
+
return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
|
|
2404
2556
|
});
|
|
2557
|
+
const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
|
|
2558
|
+
const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
|
|
2405
2559
|
|
|
2406
|
-
const
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
const SERVICE_DIRECTIONS = [
|
|
2411
|
-
{ key: 'Физическое лицо' },
|
|
2412
|
-
{ key: 'Юридическое лицо / ИП' },
|
|
2413
|
-
];
|
|
2414
|
-
const FEEDBACK_METHOD = [
|
|
2415
|
-
{ key: 'phone', text: 'Телефонный звонок' },
|
|
2416
|
-
{ key: 'email', text: 'Электронное сообщение' },
|
|
2417
|
-
];
|
|
2418
|
-
|
|
2419
|
-
const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
|
|
2420
|
-
|
|
2421
|
-
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
|
|
2422
|
-
|
|
2423
|
-
const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
|
|
2560
|
+
const MIN_CREDIT_AMOUNT = 1000;
|
|
2561
|
+
const MAX_CREDIT_AMOUNT = 1000000000;
|
|
2562
|
+
const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
|
|
2563
|
+
const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
|
|
2424
2564
|
|
|
2425
|
-
const
|
|
2426
|
-
const
|
|
2427
|
-
|
|
2565
|
+
const SelectField = UniBlock(({ field, source, label, fieldName, input, placeholder = 'Выберите из списка', isSearch = false, }) => {
|
|
2566
|
+
const leadOptions = (source &&
|
|
2567
|
+
source?.map((_) => ({
|
|
2568
|
+
key: _.key || '',
|
|
2569
|
+
text: _.value,
|
|
2570
|
+
}))) ||
|
|
2571
|
+
[];
|
|
2572
|
+
return (jsx(SelectControl, { placeholder: placeholder, label: label, options: leadOptions, isSearch: isSearch, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required) }));
|
|
2428
2573
|
});
|
|
2429
2574
|
|
|
2430
|
-
const
|
|
2431
|
-
const
|
|
2432
|
-
|
|
2433
|
-
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
2434
|
-
}, []);
|
|
2435
|
-
return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
|
|
2575
|
+
const AmountWorkersField = JSX(({ field, input }) => {
|
|
2576
|
+
const { data: amountWorkers } = useLeadFormData('EMPLOYEES_NUMBER');
|
|
2577
|
+
return (jsx(SelectField, { field: field, source: amountWorkers, label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0445 \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "amountWorkers", input: input }));
|
|
2436
2578
|
});
|
|
2437
2579
|
|
|
2438
|
-
const
|
|
2439
|
-
|
|
2440
|
-
const JobsNumberField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442 \u0440\u0430\u0431\u043E\u0442\u044B \u0437\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442", type: "number", maxLength: 2, ...getValidation(field('jobsNumber'), validatorObj.jobsNumber, input?.required), ...input })));
|
|
2580
|
+
const AnnualRevenueField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0413\u043E\u0434\u043E\u0432\u0430\u044F \u0432\u044B\u0440\u0443\u0447\u043A\u0430, \u20BD", ...getValidation(field('annualRevenue'), validatorObj.annualRevenue, input?.required) })));
|
|
2441
2581
|
|
|
2442
|
-
const
|
|
2582
|
+
const ArmyIdFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u041D\u0430\u043B\u0438\u0447\u0438\u0435 \u0432\u043E\u0435\u043D\u043D\u043E\u0433\u043E \u0431\u0438\u043B\u0435\u0442\u0430", ...getValidation(field('armyIdFlg'), validatorObj.armyIdFlg, input?.required) })));
|
|
2443
2583
|
|
|
2444
|
-
const
|
|
2445
|
-
return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...input, ...getValidation(field('legalEntityName'), validatorObj.legalEntityName, input?.required) }));
|
|
2446
|
-
});
|
|
2584
|
+
const BankEmpoleeCodeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F \u0411\u0430\u043D\u043A\u0430", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434", type: "number", ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
|
|
2447
2585
|
|
|
2448
|
-
const
|
|
2586
|
+
const BankEmpoleeField = JSX(({ field }) => (jsx(InputControl, { label: "\u0424\u0418\u041E \u0438\u043B\u0438 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043E \u0412\u0430\u0441 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430 \u0411\u0430\u043D\u043A\u0430", ...field('bankEmpolee') })));
|
|
2449
2587
|
|
|
2450
|
-
const
|
|
2451
|
-
const EMPTY_REGIONS = [];
|
|
2452
|
-
async function getOutServiceRegions() {
|
|
2453
|
-
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
2454
|
-
return data && Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
2455
|
-
}
|
|
2588
|
+
const BankruptcyFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u0412 \u043E\u0442\u043D\u043E\u0448\u0435\u043D\u0438\u0438 \u043C\u0435\u043D\u044F \u0432\u0435\u0434\u0451\u0442\u0441\u044F \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0441\u0442\u0432\u043E \u043F\u043E \u0434\u0435\u043B\u0443 \u043E \u0431\u0430\u043D\u043A\u0440\u043E\u0442\u0441\u0442\u0432\u0435", ...getValidation(field('bankruptcyFlg'), validatorObj.bankruptcyFlg, input?.required) })));
|
|
2456
2589
|
|
|
2457
|
-
const
|
|
2458
|
-
const
|
|
2459
|
-
const regionKey = fieldRegion?.value?.key;
|
|
2460
|
-
const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
|
|
2461
|
-
const localities = regions
|
|
2462
|
-
?.find((_) => _.code === regionKey)
|
|
2463
|
-
?.localities?.map((_) => ({ key: _, text: _ }));
|
|
2590
|
+
const useElementSpace = (ref, heightEl) => {
|
|
2591
|
+
const [spaceAbove, setSpaceAbove] = useState(false);
|
|
2464
2592
|
useEffect(() => {
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
|
|
2479
|
-
|
|
2480
|
-
const FIELD_NAME$1 = 'middleName';
|
|
2481
|
-
const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$1), ...getValidation(field(FIELD_NAME$1), validatorObj.middleName, input?.required), ...input })));
|
|
2482
|
-
|
|
2483
|
-
const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
|
|
2484
|
-
|
|
2485
|
-
const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
|
|
2486
|
-
|
|
2487
|
-
const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
|
|
2593
|
+
const handleResize = () => {
|
|
2594
|
+
if (ref?.current) {
|
|
2595
|
+
const { top } = ref.current.getBoundingClientRect();
|
|
2596
|
+
const hasSpaceAbove = top > heightEl;
|
|
2597
|
+
setSpaceAbove(hasSpaceAbove);
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
handleResize();
|
|
2601
|
+
window.addEventListener('resize', handleResize);
|
|
2602
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
2603
|
+
}, [ref]);
|
|
2604
|
+
return spaceAbove;
|
|
2605
|
+
};
|
|
2488
2606
|
|
|
2489
|
-
const
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2607
|
+
const DAY_COUNT = 6;
|
|
2608
|
+
const WEEK_COUNT = 7;
|
|
2609
|
+
const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
|
|
2610
|
+
const calendarCells = [];
|
|
2611
|
+
let dayCounter = 1;
|
|
2612
|
+
for (let i = 0; i < DAY_COUNT; i++) {
|
|
2613
|
+
const rowCells = [];
|
|
2614
|
+
for (let j = 0; j < WEEK_COUNT; j++) {
|
|
2615
|
+
if (i === 0 && j < firstDayOfWeek) {
|
|
2616
|
+
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
2617
|
+
}
|
|
2618
|
+
else if (dayCounter > totalDays) {
|
|
2619
|
+
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
2620
|
+
}
|
|
2621
|
+
else {
|
|
2622
|
+
const currentDate = new Date(currentYear, currentMonth, dayCounter);
|
|
2623
|
+
const isToday = checkIsToday(currentDate, today);
|
|
2624
|
+
const isDisabled = checkIsDisabled(currentDate, min, max);
|
|
2625
|
+
rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
|
|
2626
|
+
dayCounter++;
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
|
|
2630
|
+
}
|
|
2631
|
+
return calendarCells;
|
|
2632
|
+
};
|
|
2633
|
+
const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
|
|
2634
|
+
const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
|
|
2635
|
+
const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
|
|
2636
|
+
'border-transparent hover:bg-gray': !isToday,
|
|
2637
|
+
}, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
|
|
2493
2638
|
|
|
2494
|
-
const
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2639
|
+
const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
|
|
2640
|
+
const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
|
|
2641
|
+
const handleDateClick = useCallback((date) => {
|
|
2642
|
+
onDateSelect(date);
|
|
2643
|
+
setValue(false);
|
|
2498
2644
|
}, []);
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
partInBusinessField?.onChange(String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''));
|
|
2514
|
-
return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", type: "number", maxLength: 3, ...partInBusinessField, ...input, onChange: handleChange, value: isBusinessOwner ? partInBusinessField?.value : '', disabled: !isBusinessOwner }));
|
|
2515
|
-
});
|
|
2516
|
-
|
|
2517
|
-
const PartnerCommentsField = JSX(({ field, input }) => {
|
|
2518
|
-
const { required, ...rest } = input;
|
|
2519
|
-
return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
|
|
2645
|
+
const { firstDayOfWeek, totalDays } = useMemo(() => ({
|
|
2646
|
+
firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
|
|
2647
|
+
totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
|
|
2648
|
+
}), [currentYear, currentMonth]);
|
|
2649
|
+
return (jsxs("table", { className: "mx-auto", children: [jsx("thead", { className: "text-gray font-light", children: jsx("tr", { children: WEEK_DAYS.map((day, index) => (jsx("th", { className: "p-s", children: day }, String(index)))) }) }), jsx("tbody", { children: renderCalendarCells({
|
|
2650
|
+
firstDayOfWeek,
|
|
2651
|
+
today,
|
|
2652
|
+
totalDays,
|
|
2653
|
+
currentYear,
|
|
2654
|
+
currentMonth,
|
|
2655
|
+
min,
|
|
2656
|
+
max,
|
|
2657
|
+
onDateClick: handleDateClick,
|
|
2658
|
+
}) })] }));
|
|
2520
2659
|
});
|
|
2521
2660
|
|
|
2522
|
-
const
|
|
2523
|
-
|
|
2524
|
-
|
|
2661
|
+
const months = [
|
|
2662
|
+
'Январь',
|
|
2663
|
+
'Февраль',
|
|
2664
|
+
'Март',
|
|
2665
|
+
'Апрель',
|
|
2666
|
+
'Май',
|
|
2667
|
+
'Июнь',
|
|
2668
|
+
'Июль',
|
|
2669
|
+
'Август',
|
|
2670
|
+
'Сентябрь',
|
|
2671
|
+
'Октябрь',
|
|
2672
|
+
'Ноябрь',
|
|
2673
|
+
'Декабрь',
|
|
2525
2674
|
];
|
|
2526
|
-
const PaymentSystemField = JSX(({ field, input }) => {
|
|
2527
|
-
const { value, onChange } = field('paymentSystem');
|
|
2528
|
-
return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: PAYMENT_SYSTEM_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('paymentSystem'), validatorObj.paymentSystem, input?.required) }));
|
|
2529
|
-
});
|
|
2530
|
-
|
|
2531
|
-
const isPlaceholder = (_) => _ === '_';
|
|
2532
|
-
const isDigit = (_) => /\d/.test(_);
|
|
2533
|
-
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
2534
|
-
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
2535
|
-
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
2536
|
-
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
2537
|
-
function normalizePhone(phone) {
|
|
2538
|
-
const phoneNumbers = phone.replace(/\D/g, '');
|
|
2539
|
-
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
2540
|
-
const result = phonePattern.map(applyPlaceholder);
|
|
2541
|
-
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
2542
|
-
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
2546
|
-
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
2547
|
-
const handleBlur = useCallback((v) => {
|
|
2548
|
-
if (v === '+7 (') {
|
|
2549
|
-
onChange && onChange('');
|
|
2550
|
-
}
|
|
2551
|
-
}, []);
|
|
2552
|
-
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
2553
|
-
});
|
|
2554
|
-
|
|
2555
|
-
const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
|
|
2556
|
-
|
|
2557
|
-
const PhoneField = JSX(({ field, input }) => {
|
|
2558
|
-
const fieldName = input?.name || 'phone';
|
|
2559
|
-
return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
|
|
2560
|
-
});
|
|
2561
|
-
|
|
2562
|
-
const PositionOrganizationField = JSX(({ field, input }) => {
|
|
2563
|
-
const { data: positionOrganization } = useLeadFormData('POSITION');
|
|
2564
|
-
return (jsx(SelectField, { field: field, source: positionOrganization, label: "\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "positionOrganization", input: input }));
|
|
2565
|
-
});
|
|
2566
|
-
|
|
2567
|
-
const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
|
|
2568
|
-
|
|
2569
|
-
const ProductField = UniBlock(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
|
|
2570
|
-
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
2571
2675
|
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2676
|
+
function normalizeWithMask(value, pattern) {
|
|
2677
|
+
const valueNumbers = value.replace(/\D/g, '');
|
|
2678
|
+
if (valueNumbers === '' || value?.length === pattern.length) {
|
|
2679
|
+
return value;
|
|
2680
|
+
}
|
|
2681
|
+
const patternInArr = [...pattern];
|
|
2682
|
+
const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
|
|
2683
|
+
const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
|
|
2684
|
+
const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
|
|
2685
|
+
const resultInArr = patternInArr.map(applyPlaceholder);
|
|
2686
|
+
const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
|
|
2687
|
+
return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
|
|
2576
2688
|
}
|
|
2689
|
+
const isPlaceholder$1 = (_) => _ === '_';
|
|
2690
|
+
const isDigit$1 = (_) => /\d/.test(_);
|
|
2691
|
+
const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
|
|
2577
2692
|
|
|
2578
|
-
const
|
|
2579
|
-
|
|
2580
|
-
return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
2581
|
-
});
|
|
2582
|
-
|
|
2583
|
-
const RegionPremiumField = JSX(({ field, input }) => {
|
|
2584
|
-
const branchByRegions = useBranchesByRegions(true);
|
|
2585
|
-
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
2586
|
-
key: region,
|
|
2587
|
-
text: region,
|
|
2588
|
-
})), [branchByRegions]);
|
|
2589
|
-
return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
2590
|
-
});
|
|
2591
|
-
|
|
2592
|
-
const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
|
|
2593
|
-
const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
|
|
2594
|
-
const onToggle = useCallback(() => {
|
|
2595
|
-
setIsUnfolded((_) => !_);
|
|
2596
|
-
}, []);
|
|
2597
|
-
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
2598
|
-
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
2599
|
-
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
2600
|
-
});
|
|
2693
|
+
const START_YEAR = 1940;
|
|
2694
|
+
const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
|
|
2601
2695
|
|
|
2602
|
-
|
|
2696
|
+
const ICON_PROPS$1 = {
|
|
2697
|
+
name: 'CalendarIcon',
|
|
2698
|
+
iconVersion: 'black',
|
|
2699
|
+
width: '24',
|
|
2700
|
+
height: '24',
|
|
2701
|
+
};
|
|
2702
|
+
const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
|
|
2603
2703
|
const ref = useRef(null);
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2704
|
+
const [inputValue, setInputValue] = useState(value || '');
|
|
2705
|
+
const handleChange = (ev) => {
|
|
2706
|
+
const val = ev.target?.value;
|
|
2707
|
+
if (typeof val === 'string' && val?.length < 11) {
|
|
2708
|
+
setInputValue(normalizeWithMask(val, '__.__.____'));
|
|
2608
2709
|
}
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
}, [callback, ...deps]);
|
|
2617
|
-
return ref;
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
2621
|
-
const containerRef = useRef(null);
|
|
2622
|
-
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
2623
|
-
if (containerRef.current) {
|
|
2624
|
-
containerRef.current.style.maxHeight = isUnfolded
|
|
2625
|
-
? `${childrenWrapperEl.scrollHeight}px`
|
|
2626
|
-
: '';
|
|
2710
|
+
};
|
|
2711
|
+
const onBlur = () => {
|
|
2712
|
+
if (checkIsValidDate(inputValue)) {
|
|
2713
|
+
const [day, month, year] = inputValue.split('.');
|
|
2714
|
+
onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
|
|
2715
|
+
setSelectedMonth(Number(month) - 1);
|
|
2716
|
+
setSelectedYear(Number(year));
|
|
2627
2717
|
}
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2718
|
+
else {
|
|
2719
|
+
setInputValue(value || '');
|
|
2720
|
+
}
|
|
2721
|
+
};
|
|
2722
|
+
const onInputClick = () => {
|
|
2723
|
+
if (ref.current !== null) {
|
|
2724
|
+
ref.current.focus();
|
|
2725
|
+
}
|
|
2726
|
+
onClick?.();
|
|
2727
|
+
};
|
|
2728
|
+
useEffect(() => {
|
|
2729
|
+
setInputValue(value || '');
|
|
2730
|
+
}, [value]);
|
|
2731
|
+
return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
|
|
2638
2732
|
});
|
|
2639
|
-
const
|
|
2640
|
-
const
|
|
2641
|
-
const
|
|
2733
|
+
const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
|
|
2734
|
+
const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
|
|
2735
|
+
const checkIsValidDate = (date) => {
|
|
2736
|
+
const [day, month, year] = date.split('.');
|
|
2737
|
+
if (isValidYear(year)) {
|
|
2738
|
+
if (isValidMonth(month)) {
|
|
2739
|
+
const currentDate = new Date(Number(year), Number(month) - 1, 1);
|
|
2740
|
+
let maxDateOfMonth = 0;
|
|
2741
|
+
while (currentDate.getMonth() === Number(month) - 1) {
|
|
2742
|
+
currentDate.setDate(currentDate.getDate() + 1);
|
|
2743
|
+
maxDateOfMonth++;
|
|
2744
|
+
}
|
|
2745
|
+
if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
|
|
2746
|
+
return true;
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
return false;
|
|
2751
|
+
};
|
|
2642
2752
|
|
|
2643
|
-
const
|
|
2753
|
+
const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
|
|
2754
|
+
'hover:border-black active:border-black focus:border-black';
|
|
2755
|
+
const renderDatePickerForm = ({ handleChangeVisibleCalendar, value, valid, onChange, setSelectedMonth, setSelectedYear, disabled = false, }) => (jsx(DatePickerInput, { onChange: onChange, disabled: disabled, onClick: handleChangeVisibleCalendar, value: value && formatDate(value), setSelectedMonth: setSelectedMonth, setSelectedYear: setSelectedYear, className: style(formStyle, valid ? 'border-gray' : 'border-error') }));
|
|
2644
2756
|
|
|
2645
|
-
const
|
|
2646
|
-
|
|
2647
|
-
|
|
2757
|
+
const MONTHS_COUNT = 11;
|
|
2758
|
+
const MONTHS_OPTIONS = months.map((key) => ({ key }));
|
|
2759
|
+
const YEARS_OPTIONS = getYears()
|
|
2760
|
+
.reverse()
|
|
2761
|
+
.map((key) => ({ key: String(key) }));
|
|
2762
|
+
const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
|
|
2763
|
+
const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
|
|
2764
|
+
const ref = useOutsideClick(close);
|
|
2765
|
+
const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
|
|
2766
|
+
const handleNextMonth = useCallback(() => {
|
|
2767
|
+
if (selectedMonth + 1 <= MONTHS_COUNT) {
|
|
2768
|
+
onMonthSelect(selectedMonth + 1);
|
|
2769
|
+
}
|
|
2770
|
+
else {
|
|
2771
|
+
onMonthSelect(0);
|
|
2772
|
+
onYearSelect(selectedYear + 1);
|
|
2773
|
+
}
|
|
2774
|
+
}, [selectedMonth]);
|
|
2775
|
+
const handlePrevMonth = useCallback(() => {
|
|
2776
|
+
if (selectedMonth - 1 >= 0) {
|
|
2777
|
+
onMonthSelect(selectedMonth - 1);
|
|
2778
|
+
}
|
|
2779
|
+
else {
|
|
2780
|
+
onMonthSelect(11);
|
|
2781
|
+
onYearSelect(selectedYear - 1);
|
|
2782
|
+
}
|
|
2783
|
+
}, [selectedMonth]);
|
|
2784
|
+
const handleSelectMonth = useCallback(({ key }) => {
|
|
2785
|
+
onMonthSelect(months.indexOf(key));
|
|
2786
|
+
const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
|
|
2787
|
+
handleChangeMonth({
|
|
2788
|
+
maxDateOfMonth,
|
|
2789
|
+
selectedYear,
|
|
2790
|
+
selectedMonth: months.indexOf(key),
|
|
2791
|
+
value,
|
|
2792
|
+
onChange,
|
|
2793
|
+
});
|
|
2794
|
+
}, [value]);
|
|
2795
|
+
const handleSelectYear = useCallback(({ key }) => {
|
|
2796
|
+
onYearSelect(Number(key));
|
|
2797
|
+
value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
|
|
2798
|
+
}, [value]);
|
|
2799
|
+
return {
|
|
2800
|
+
handleChangeVisibleCalendar,
|
|
2801
|
+
handleNextMonth,
|
|
2802
|
+
handlePrevMonth,
|
|
2803
|
+
handleSelectMonth,
|
|
2804
|
+
handleSelectYear,
|
|
2805
|
+
monthsOptions: MONTHS_OPTIONS,
|
|
2806
|
+
yearsOptions: YEARS_OPTIONS,
|
|
2807
|
+
ref,
|
|
2808
|
+
};
|
|
2648
2809
|
};
|
|
2649
|
-
const
|
|
2650
|
-
|
|
2651
|
-
|
|
2810
|
+
const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
|
|
2811
|
+
const date = new Date(selectedYear, selectedMonth, 1);
|
|
2812
|
+
let maxDateOfMonth = 0;
|
|
2813
|
+
while (date.getMonth() === selectedMonth) {
|
|
2814
|
+
maxDateOfMonth++;
|
|
2815
|
+
date.setDate(date.getDate() + 1);
|
|
2652
2816
|
}
|
|
2653
|
-
return
|
|
2654
|
-
`${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
|
|
2655
|
-
lunchHour ? `перерыв: ${lunchHour}` : '',
|
|
2656
|
-
daysOff ? `не работает: ${daysOff}` : '',
|
|
2657
|
-
]
|
|
2658
|
-
.filter(Boolean)
|
|
2659
|
-
.join('; ');
|
|
2817
|
+
return maxDateOfMonth;
|
|
2660
2818
|
};
|
|
2661
|
-
const
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
const daysOff = workScheduleWeek
|
|
2665
|
-
.filter((_) => !_.status)
|
|
2666
|
-
.map((_) => _.short?.toLowerCase())
|
|
2667
|
-
.join(', ');
|
|
2668
|
-
const rows = [
|
|
2669
|
-
buildScheduleText({
|
|
2670
|
-
workTime: workingWeekday?.workTime,
|
|
2671
|
-
lunchHour: workingWeekday?.lunchHour,
|
|
2672
|
-
daysOff: workingSaturday ? '' : daysOff,
|
|
2673
|
-
}),
|
|
2674
|
-
buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
|
|
2675
|
-
].filter(Boolean);
|
|
2676
|
-
return rows;
|
|
2819
|
+
const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
|
|
2820
|
+
value &&
|
|
2821
|
+
onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
|
|
2677
2822
|
};
|
|
2678
2823
|
|
|
2679
|
-
const
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
['workingFriday', 'Пт', 'Пятница'],
|
|
2685
|
-
['workingSaturday', 'Сб', 'Суббота'],
|
|
2686
|
-
['workingSunday', 'Вс', 'Воскресенье'],
|
|
2687
|
-
];
|
|
2688
|
-
const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
|
|
2689
|
-
key,
|
|
2690
|
-
title,
|
|
2691
|
-
short,
|
|
2692
|
-
status: Boolean(workSchedule?.[key]),
|
|
2693
|
-
get workTime() {
|
|
2694
|
-
return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
|
|
2695
|
-
},
|
|
2696
|
-
get lunchHour() {
|
|
2697
|
-
return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
|
|
2698
|
-
},
|
|
2699
|
-
get hasLunch() {
|
|
2700
|
-
return /\d+/.test(this.lunchHour ?? '');
|
|
2701
|
-
},
|
|
2702
|
-
}));
|
|
2703
|
-
|
|
2704
|
-
const renderBusinessSchedule = (scheduleDescription) => {
|
|
2705
|
-
if (!scheduleDescription) {
|
|
2706
|
-
return null;
|
|
2707
|
-
}
|
|
2708
|
-
const businessSchedule = getBusinessSchedule(scheduleDescription);
|
|
2709
|
-
return (jsxs(CardRow, { className: "border-none", children: [jsx(CardCell, { label: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: businessSchedule.map(renderAlternativeDay) }) }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: scheduleDescription }) })] }));
|
|
2824
|
+
const ICON_PROPS = {
|
|
2825
|
+
name: 'ArrowUpIcon',
|
|
2826
|
+
iconVersion: 'black',
|
|
2827
|
+
width: '24',
|
|
2828
|
+
height: '24',
|
|
2710
2829
|
};
|
|
2711
|
-
const
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
if (!lastPartScheduleDescription?.includes('выходной')) {
|
|
2716
|
-
return weekDayMap;
|
|
2717
|
-
}
|
|
2718
|
-
return weekDayMap.map((_) => ({
|
|
2719
|
-
..._,
|
|
2720
|
-
status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
|
|
2721
|
-
}));
|
|
2830
|
+
const SELECT_PROPS = {
|
|
2831
|
+
className: 'min-w-32',
|
|
2832
|
+
iconVersion: 'black',
|
|
2833
|
+
isBorder: false,
|
|
2722
2834
|
};
|
|
2723
|
-
const
|
|
2835
|
+
const DatePicker = JSX(
|
|
2836
|
+
// eslint-disable-next-line max-lines-per-function
|
|
2837
|
+
({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
|
|
2838
|
+
const [showCalendar, { setValue }] = useBool(false);
|
|
2839
|
+
const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
|
|
2840
|
+
const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
|
|
2841
|
+
const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
|
|
2842
|
+
onYearSelect: setSelectedYear,
|
|
2843
|
+
onMonthSelect: setSelectedMonth,
|
|
2844
|
+
onShowCalendar: setValue,
|
|
2845
|
+
selectedYear,
|
|
2846
|
+
selectedMonth,
|
|
2847
|
+
showCalendar,
|
|
2848
|
+
onChange,
|
|
2849
|
+
value,
|
|
2850
|
+
});
|
|
2851
|
+
const spaceAbove = useElementSpace(ref, 370);
|
|
2852
|
+
return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
|
|
2853
|
+
handleChangeVisibleCalendar,
|
|
2854
|
+
value,
|
|
2855
|
+
valid,
|
|
2856
|
+
onChange,
|
|
2857
|
+
disabled,
|
|
2858
|
+
setSelectedMonth,
|
|
2859
|
+
setSelectedYear,
|
|
2860
|
+
}), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
|
|
2861
|
+
'bottom-full': spaceAbove,
|
|
2862
|
+
}), children: [jsxs("div", { className: "flex gap-s", children: [jsx("div", { className: "my-auto", onClick: handlePrevMonth, children: jsx(Icon, { ...ICON_PROPS, className: "-rotate-90 cursor-pointer" }) }), jsx(Select, { onChange: handleSelectMonth, value: { key: months[selectedMonth] }, options: monthsOptions, ...SELECT_PROPS }), jsx(Select, { onChange: handleSelectYear, value: { key: String(selectedYear) }, options: yearsOptions, ...SELECT_PROPS }), jsx("div", { className: "my-auto", onClick: handleNextMonth, children: jsx(Icon, { ...ICON_PROPS, className: "rotate-90 cursor-pointer" }) })] }), jsx(Calendar, { today: value, currentMonth: selectedMonth, currentYear: selectedYear, onDateSelect: onChange, min: minDate, max: maxDate, setValue: setValue })] })) : null] })] }));
|
|
2863
|
+
});
|
|
2724
2864
|
|
|
2725
|
-
const
|
|
2865
|
+
const DatePickerControl = JSX(({ className, label, error, errors, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(DatePicker, { label: getRequiredLabel({ label, errors }), valid: Boolean(!error), ...rest }), renderErrorText(error)] })));
|
|
2726
2866
|
|
|
2727
|
-
const
|
|
2728
|
-
yellow: { border: 'border-yellow-light', text: 'text-yellow' },
|
|
2729
|
-
green: { border: 'border-green-more-light', text: 'text-green-dark' },
|
|
2730
|
-
gray: { border: 'border-gray', text: 'text-secondary-text' },
|
|
2731
|
-
red: { border: 'border-error/30', text: 'text-error' },
|
|
2732
|
-
};
|
|
2733
|
-
const Badge$1 = JSX(({ className, children, color = 'gray' }) => (jsxs("div", { className: style('sm:p-s sm:border sm:border-green rounded-md flex items-center h-fit', colorStyle[color].border, className), children: [jsx("div", { className: "block pr-m sm:pr-0 sm:hidden", children: jsx(Img, { image: { icon: 'SmallClockIcon' }, width: "24", height: "24" }) }), jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children })] })));
|
|
2867
|
+
const BeginDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u0440\u0430\u0431\u043E\u0442\u044B \u043D\u0430 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u043C\u0435\u0441\u0442\u0435", ...getValidation(field('beginDate'), validatorObj.beginDate, input?.required), ...input })));
|
|
2734
2868
|
|
|
2735
|
-
const
|
|
2736
|
-
|
|
2737
|
-
const
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2869
|
+
const MIN_AGE = 23;
|
|
2870
|
+
const MAX_AGE = 75;
|
|
2871
|
+
const AGE_ERROR_MESSAGE = 'Допустимый возраст заёмщика - от 23 до 75 лет';
|
|
2872
|
+
const FIELD_NAME$8 = 'birthday';
|
|
2873
|
+
const BirthdayField = JSX(({ field, input, isRetailForm = false }) => {
|
|
2874
|
+
const { value } = field(FIELD_NAME$8);
|
|
2875
|
+
return (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$8), validatorObj.birthday, input?.required), error: isRetailForm && value && !birthdayValidate(value) ? AGE_ERROR_MESSAGE : '', disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$8) }));
|
|
2876
|
+
});
|
|
2877
|
+
const birthdayValidate = (date) => {
|
|
2878
|
+
const today = new Date();
|
|
2879
|
+
const minDate = new Date(today.getFullYear() - MIN_AGE, today.getMonth(), today.getDate());
|
|
2880
|
+
const maxDate = new Date(today.getFullYear() - MAX_AGE, today.getMonth(), today.getDate());
|
|
2881
|
+
if (!date || date > minDate || date < maxDate) {
|
|
2882
|
+
return false;
|
|
2741
2883
|
}
|
|
2742
|
-
|
|
2743
|
-
return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge$1, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge$1, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge$1, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
|
|
2884
|
+
return true;
|
|
2744
2885
|
};
|
|
2745
2886
|
|
|
2746
|
-
const
|
|
2747
|
-
|
|
2748
|
-
return 'Не работает';
|
|
2749
|
-
}
|
|
2750
|
-
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
2751
|
-
};
|
|
2752
|
-
const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
|
|
2887
|
+
const FIELD_NAME$7 = 'birthPlace';
|
|
2888
|
+
const BirthPlaceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthPlace'), validatorObj.birthPlace, input?.required), ...input, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$7) })));
|
|
2753
2889
|
|
|
2754
|
-
const
|
|
2755
|
-
|
|
2756
|
-
|
|
2890
|
+
const CardCategoryField = JSX(({ field, input }) => {
|
|
2891
|
+
const { data: cardCategory } = useLeadFormData('CARD_TYPE');
|
|
2892
|
+
return (jsx(SelectField, { field: field, source: cardCategory, label: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043A\u0430\u0440\u0442\u044B", fieldName: "cardCategory", input: input }));
|
|
2893
|
+
});
|
|
2757
2894
|
|
|
2758
|
-
const
|
|
2759
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2760
|
-
const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
|
|
2761
|
-
const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
|
|
2762
|
-
if (!workSchedule) {
|
|
2763
|
-
return null;
|
|
2764
|
-
}
|
|
2765
|
-
if (!workSchedule.businessScheduleVisibleTag) {
|
|
2766
|
-
return renderMatchingTimeOfWork(timeOfWork);
|
|
2767
|
-
}
|
|
2768
|
-
if (workSchedule.businessScheduleVisibleTag &&
|
|
2769
|
-
workSchedule.businessScheduleDescription === null) {
|
|
2770
|
-
return renderIndividualTimeOfWork(timeOfWork);
|
|
2771
|
-
}
|
|
2772
|
-
return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
|
|
2773
|
-
};
|
|
2774
|
-
const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
|
|
2775
|
-
const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
|
|
2776
|
-
const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
|
|
2895
|
+
const ChildrenField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('children'), validatorObj.children, input?.required), ...input })));
|
|
2777
2896
|
|
|
2778
|
-
const
|
|
2779
|
-
if (!workSchedule) {
|
|
2780
|
-
return null;
|
|
2781
|
-
}
|
|
2782
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2783
|
-
return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: name }), address ? (jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), jsx(Text, { size: "text-l", children: address })] })) : null] }), renderCurrentDaySchedule(workScheduleWeek)] }), jsx("div", { className: "hidden sm:block", children: renderCardContent$1({
|
|
2784
|
-
phone,
|
|
2785
|
-
fax,
|
|
2786
|
-
phoneBusiness,
|
|
2787
|
-
phoneNatural,
|
|
2788
|
-
phoneCallCentre,
|
|
2789
|
-
phoneCurrencyControl,
|
|
2790
|
-
workSchedule,
|
|
2791
|
-
exchangeRate,
|
|
2792
|
-
}) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
|
|
2793
|
-
return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
|
|
2794
|
-
phone,
|
|
2795
|
-
fax,
|
|
2796
|
-
phoneBusiness,
|
|
2797
|
-
phoneNatural,
|
|
2798
|
-
phoneCallCentre,
|
|
2799
|
-
phoneCurrencyControl,
|
|
2800
|
-
workSchedule,
|
|
2801
|
-
exchangeRate,
|
|
2802
|
-
}) }));
|
|
2803
|
-
},
|
|
2804
|
-
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
2805
|
-
renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
|
|
2806
|
-
};
|
|
2807
|
-
const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
|
|
2808
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2809
|
-
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
2810
|
-
? 'Для физических лиц'
|
|
2811
|
-
: 'Для физических и юридических лиц';
|
|
2812
|
-
return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness, isPhone: true }), jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), workSchedule?.isMatchesPattern ? (jsx(CardRow, { children: jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (jsxs(CardRow, { children: [jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
|
|
2813
|
-
? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
|
|
2814
|
-
: null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
|
|
2815
|
-
};
|
|
2816
|
-
const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
|
|
2817
|
-
const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
|
|
2818
|
-
const header = capitalizedFirstLetter$1(name);
|
|
2819
|
-
const body = `${address} ${renderWorkSchedule(workSchedule)}`;
|
|
2820
|
-
return { header, body };
|
|
2821
|
-
};
|
|
2897
|
+
const CodeWordField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434\u043E\u0432\u043E\u0435 \u0441\u043B\u043E\u0432\u043E", ...getValidation(field('codeWord'), validatorObj.codeWord, input?.required), ...input })));
|
|
2822
2898
|
|
|
2823
|
-
const
|
|
2899
|
+
const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", type: "number", ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
|
|
2824
2900
|
|
|
2825
|
-
const
|
|
2826
|
-
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
2901
|
+
const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
|
|
2827
2902
|
|
|
2828
|
-
const
|
|
2829
|
-
|
|
2830
|
-
|
|
2903
|
+
const ConfirmationIncomeField = JSX(({ field, input }) => {
|
|
2904
|
+
const { data: confirmationIncome } = useLeadFormData('INCOME_CERT_UNITED');
|
|
2905
|
+
return (jsx(SelectField, { field: field, source: confirmationIncome, label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F \u0434\u043E\u0445\u043E\u0434\u0430", fieldName: "confirmationIncome", input: input }));
|
|
2906
|
+
});
|
|
2831
2907
|
|
|
2832
|
-
const
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
}
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
}
|
|
2862
|
-
});
|
|
2863
|
-
}
|
|
2864
|
-
const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
|
|
2865
|
-
return new yandexMaps.Clusterer({
|
|
2866
|
-
clusterIcons: [
|
|
2867
|
-
{
|
|
2868
|
-
href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
2869
|
-
size: [78, 84],
|
|
2870
|
-
offset: [-35, -50],
|
|
2871
|
-
},
|
|
2872
|
-
],
|
|
2873
|
-
clusterIconContentLayout,
|
|
2874
|
-
clusterHideIconOnBalloonOpen: false,
|
|
2875
|
-
geoObjectHideIconOnBalloonOpen: false,
|
|
2876
|
-
});
|
|
2908
|
+
const ConscriptionField = JSX(({ field, input }) => {
|
|
2909
|
+
const { data: conscription } = useLeadFormData('MILITARY_STATUS');
|
|
2910
|
+
return (jsx(SelectField, { field: field, source: conscription, label: "\u0421\u0442\u0430\u0442\u0443\u0441 \u0432\u043E\u0435\u043D\u043D\u043E\u043E\u0431\u044F\u0437\u0430\u043D\u043D\u043E\u0433\u043E", fieldName: "conscription", input: input }));
|
|
2911
|
+
});
|
|
2912
|
+
|
|
2913
|
+
const CONSENTS = {
|
|
2914
|
+
processPersonalDataFlg: {
|
|
2915
|
+
text: 'Согласие на обработку персональных данных',
|
|
2916
|
+
docId: 4,
|
|
2917
|
+
},
|
|
2918
|
+
consentInformFlg: {
|
|
2919
|
+
text: 'Согласие на информирование о продуктах и услугах Банка',
|
|
2920
|
+
docId: 14,
|
|
2921
|
+
},
|
|
2922
|
+
consentProviderFlg: {
|
|
2923
|
+
text: 'Согласие об использовании простой электронной подписи',
|
|
2924
|
+
docId: 5,
|
|
2925
|
+
},
|
|
2926
|
+
consentOthersFlg: {
|
|
2927
|
+
text: 'Прочие согласия',
|
|
2928
|
+
docId: 1,
|
|
2929
|
+
},
|
|
2930
|
+
consentPfrFlg: {
|
|
2931
|
+
text: 'Согласие на запрос в ПФР',
|
|
2932
|
+
docId: 3,
|
|
2933
|
+
},
|
|
2934
|
+
consentToReceiveMaterials: {
|
|
2935
|
+
text: 'Согласен на получение информационных и аналитических материалов по электронной почте',
|
|
2936
|
+
},
|
|
2877
2937
|
};
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
balloonContentFooter: content?.footer,
|
|
2883
|
-
hintContent: content?.hint,
|
|
2884
|
-
}, {
|
|
2885
|
-
iconLayout: 'default#image',
|
|
2886
|
-
iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
2887
|
-
iconImageSize: [78, 84],
|
|
2888
|
-
iconImageOffset: [-35, -50],
|
|
2889
|
-
}));
|
|
2938
|
+
|
|
2939
|
+
const feedbackById = async (id, convertToPng = false) => {
|
|
2940
|
+
const response = await doRequest(`/feedback/file?id=${encodeURIComponent(id)}&convertToPngFlg=${convertToPng}`, 'GET');
|
|
2941
|
+
return await response.blob();
|
|
2890
2942
|
};
|
|
2891
2943
|
|
|
2892
|
-
const
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
active: 'active:bg-primary-active',
|
|
2896
|
-
font: 'text-center font-sans',
|
|
2944
|
+
const getDocument = async (id, convertToPng = false) => {
|
|
2945
|
+
const response = await feedbackById(id, convertToPng);
|
|
2946
|
+
return URL.createObjectURL(response);
|
|
2897
2947
|
};
|
|
2898
2948
|
|
|
2899
|
-
const
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2949
|
+
const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
|
|
2950
|
+
|
|
2951
|
+
const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
|
|
2952
|
+
const { close } = useDialogManager();
|
|
2953
|
+
const handleClose = useCallback(() => {
|
|
2954
|
+
close();
|
|
2955
|
+
onClose && onClose();
|
|
2956
|
+
}, [onClose]);
|
|
2957
|
+
return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
|
|
2958
|
+
});
|
|
2959
|
+
|
|
2960
|
+
const openDocument = async (open, id, convertToPng = false) => {
|
|
2961
|
+
const document = await getDocument(id, convertToPng);
|
|
2962
|
+
open(jsx(Dialog, { className: "my-6xl max-w-4xl mx-auto px-0 min-h-0 pb-0", children: convertToPng ? (jsx("img", { src: document })) : (jsx("iframe", { src: `${document}#toolbar=0`, className: "w-full h-[80vh]", id: "iframe-dialog" })) }));
|
|
2903
2963
|
};
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2964
|
+
|
|
2965
|
+
const OPEN_DOC_BUTTON_TEXT = 'Ознакомиться';
|
|
2966
|
+
const CheckboxWithDoc = JSX(({ className, error, docId, ...props }) => {
|
|
2967
|
+
const { open } = useDialogManager();
|
|
2968
|
+
const isMobile = useMobileMode();
|
|
2969
|
+
return (jsxs("div", { className: className, children: [jsxs("div", { className: "flex flex-wrap gap-x-m", children: [jsx(Checkbox, { ...props }), docId ? (jsx(LinkButton, { className: "text-primary-main", onClick: () => openDocument(open, docId, isMobile), children: jsx(Text, { children: OPEN_DOC_BUTTON_TEXT }) })) : null] }), renderErrorText(error)] }));
|
|
2970
|
+
});
|
|
2971
|
+
|
|
2972
|
+
const ConsentField = JSX(({ field, input }) => input && input.name ? (jsx(CheckboxWithDoc, { text: CONSENTS[input.name]?.text, docId: CONSENTS[input.name]?.docId, ...getValidation(field(input.name), validatorObj[input.name], input?.required) })) : null);
|
|
2973
|
+
|
|
2974
|
+
const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
|
|
2975
|
+
вкладчиком с долей участия более 20% уставного капитала руководителем,
|
|
2976
|
+
которого Вы являетесь, кредит в АО «Россельхозбанк»`;
|
|
2977
|
+
const CreditInRshbCdField = JSX(({ field, input }) => {
|
|
2978
|
+
const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
|
|
2979
|
+
return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
|
|
2980
|
+
});
|
|
2981
|
+
|
|
2982
|
+
const orientationStyleMap = {
|
|
2983
|
+
horizontal: '@lg:flex-row',
|
|
2984
|
+
vertical: '',
|
|
2919
2985
|
};
|
|
2986
|
+
const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
|
|
2920
2987
|
|
|
2921
|
-
const
|
|
2922
|
-
const initializeExternalNS = (namespaceName, url) => {
|
|
2923
|
-
const script = document.getElementById(url);
|
|
2924
|
-
if (script) {
|
|
2925
|
-
const ns = getNS(namespaceName);
|
|
2926
|
-
if (ns) {
|
|
2927
|
-
return Promise.resolve(ns);
|
|
2928
|
-
}
|
|
2929
|
-
else {
|
|
2930
|
-
return new Promise((resolve) => {
|
|
2931
|
-
script.addEventListener('load', () => {
|
|
2932
|
-
resolve(getNS(namespaceName));
|
|
2933
|
-
});
|
|
2934
|
-
});
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
else {
|
|
2938
|
-
return new Promise((resolve, reject) => {
|
|
2939
|
-
const newScript = document.createElement('script');
|
|
2940
|
-
newScript.src = url;
|
|
2941
|
-
newScript.async = true;
|
|
2942
|
-
newScript.id = url;
|
|
2943
|
-
newScript.addEventListener('load', () => {
|
|
2944
|
-
resolve(getNS(namespaceName));
|
|
2945
|
-
});
|
|
2946
|
-
newScript.addEventListener('error', (error) => {
|
|
2947
|
-
reject(error);
|
|
2948
|
-
});
|
|
2949
|
-
document.head.appendChild(newScript);
|
|
2950
|
-
});
|
|
2951
|
-
}
|
|
2952
|
-
};
|
|
2953
|
-
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
2954
|
-
const [externalNS, setExternalNS] = useState(undefined);
|
|
2955
|
-
useEffect(() => {
|
|
2956
|
-
let isMounted = true;
|
|
2957
|
-
initializeExternalNS(namespaceName, url)
|
|
2958
|
-
.then((ns) => {
|
|
2959
|
-
if (isMounted) {
|
|
2960
|
-
setExternalNS(ns);
|
|
2961
|
-
}
|
|
2962
|
-
})
|
|
2963
|
-
.catch((error) => {
|
|
2964
|
-
console.error(`Failed to initialize external namespace: ${error}`);
|
|
2965
|
-
});
|
|
2966
|
-
return () => {
|
|
2967
|
-
isMounted = false;
|
|
2968
|
-
if (unmountNS) {
|
|
2969
|
-
const script = document.getElementById(url);
|
|
2970
|
-
if (script) {
|
|
2971
|
-
document.head.removeChild(script);
|
|
2972
|
-
}
|
|
2973
|
-
setExternalNS(undefined);
|
|
2974
|
-
}
|
|
2975
|
-
};
|
|
2976
|
-
}, [namespaceName, url, unmountNS]);
|
|
2977
|
-
return externalNS;
|
|
2978
|
-
}
|
|
2988
|
+
const RadioButtonGroupControl = JSX(({ className, label, onChange, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(RadioButtonGroup, { label: getRequiredLabel({ label, errors: rest?.errors }), onChange: (_) => onChange && onChange(_), ...rest }), renderErrorText(error)] })));
|
|
2979
2989
|
|
|
2980
|
-
const
|
|
2981
|
-
const
|
|
2982
|
-
const
|
|
2983
|
-
return
|
|
2984
|
-
};
|
|
2990
|
+
const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
|
|
2991
|
+
const CurrencyField = JSX(({ field, input }) => {
|
|
2992
|
+
const { value, onChange } = field('currency');
|
|
2993
|
+
return (jsx(RadioButtonGroupControl, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", orientation: "horizontal", items: CURRENCY_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('currency'), validatorObj.currency, input?.required) }));
|
|
2994
|
+
});
|
|
2985
2995
|
|
|
2986
|
-
const
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
};
|
|
2991
|
-
|
|
2992
|
-
const
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
2996
|
+
const DeliveryDateFiels = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438", ...getValidation(field('deliveryDate'), validatorObj.deliveryDate, input?.required) })));
|
|
2997
|
+
|
|
2998
|
+
const DependentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0436\u0434\u0438\u0432\u0435\u043D\u0446\u0435\u0432", placeholder: "\u0417\u0430 \u0438\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('dependents'), validatorObj.dependents, input?.required), ...input })));
|
|
2999
|
+
|
|
3000
|
+
const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.meetingDay, input?.required) })));
|
|
3001
|
+
|
|
3002
|
+
const DisablePeopleFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u0438\u043D\u0432\u0430\u043B\u0438\u0434\u043E\u043C", ...getValidation(field('disablePeopleFlg'), validatorObj.disablePeopleFlg, input?.required) })));
|
|
3003
|
+
|
|
3004
|
+
const FIELD_NAME$6 = 'dulIssueDateField';
|
|
3005
|
+
const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$6), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6) })));
|
|
3006
|
+
|
|
3007
|
+
const FIELD_NAME$5 = 'dulIssuedBy';
|
|
3008
|
+
const DulIssuedByField = JSX(({ field, input }) => {
|
|
3009
|
+
const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
|
|
3010
|
+
const onDaDataChange = useCallback((item) => {
|
|
3011
|
+
changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
|
|
3012
|
+
}, []);
|
|
3013
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$5), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
|
|
3000
3014
|
});
|
|
3001
3015
|
|
|
3002
|
-
const
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3016
|
+
const FIELD_NAME$4 = 'dulNumber';
|
|
3017
|
+
const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$4), label: "\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", maxLength: 6, ...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required) })));
|
|
3018
|
+
|
|
3019
|
+
const FIELD_NAME$3 = 'dulSerie';
|
|
3020
|
+
const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$3), label: "\u0421\u0435\u0440\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", maxLength: 4, ...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required) })));
|
|
3021
|
+
|
|
3022
|
+
const FIELD_NAME$2 = 'dulSubdivisionCode';
|
|
3023
|
+
const DulSubdivisionCodeField = JSX(({ field, input }) => {
|
|
3024
|
+
const onDaDataChange = useCallback((item) => {
|
|
3025
|
+
field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
|
|
3026
|
+
}, []);
|
|
3027
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$2), label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", type: "number", maxLength: 6, ...input, ...getValidation(field(FIELD_NAME$2), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
|
|
3028
|
+
});
|
|
3029
|
+
|
|
3030
|
+
const EducationField = JSX(({ field, input }) => {
|
|
3031
|
+
const { data: education } = useLeadFormData('EDUCATION_LEVEL');
|
|
3032
|
+
return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
|
|
3033
|
+
});
|
|
3034
|
+
|
|
3035
|
+
const EmailField = JSX(({ field, input }) => {
|
|
3036
|
+
const { required, ...rest } = input;
|
|
3037
|
+
return (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...getValidation(field('email'), validatorObj.email, required), ...rest }));
|
|
3038
|
+
});
|
|
3039
|
+
|
|
3040
|
+
const EmployerActivitiesField = JSX(({ field, input }) => {
|
|
3041
|
+
const { data: employerActivities } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
|
|
3042
|
+
return (jsx(SelectField, { field: field, source: employerActivities, label: "\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438-\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerActivities", input: input }));
|
|
3043
|
+
});
|
|
3044
|
+
|
|
3045
|
+
const EmployerOrganizationField = JSX(({ field, input }) => {
|
|
3046
|
+
const { data: employerOrganization } = useLeadFormData('ORGANIZATION_KIND');
|
|
3047
|
+
return (jsx(SelectField, { field: field, source: employerOrganization, label: "\u0412\u0438\u0434 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerOrganization", input: input }));
|
|
3048
|
+
});
|
|
3049
|
+
|
|
3050
|
+
const EmploymentField = JSX(({ field, input }) => {
|
|
3051
|
+
const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
|
|
3052
|
+
return (jsx(SelectField, { field: field, source: employment, label: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435", fieldName: "employment", input: input }));
|
|
3053
|
+
});
|
|
3054
|
+
|
|
3055
|
+
const ExpensesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u0432 \u043C\u0435\u0441\u044F\u0446", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
|
|
3056
|
+
|
|
3057
|
+
const Experience5YearsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436", placeholder: "\u0417\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('experience5Years'), validatorObj.experience5Years, input?.required), ...input })));
|
|
3058
|
+
|
|
3059
|
+
const FamilyMembersField = JSX(({ field }) => {
|
|
3060
|
+
const { value, onChange } = field('familyMembers');
|
|
3061
|
+
const familyStatusKey = field('familyStatus')?.value?.key;
|
|
3062
|
+
const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
|
|
3063
|
+
const childrenCount = Number(field('children')?.value);
|
|
3064
|
+
const dependentsCount = Number(field('dependents')?.value);
|
|
3065
|
+
const totalCount = adultsCount + childrenCount + dependentsCount;
|
|
3031
3066
|
useEffect(() => {
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
const coords = firstGeoObject.geometry.getCoordinates();
|
|
3036
|
-
map.current.setCenter(coords);
|
|
3037
|
-
map.current.setZoom(18);
|
|
3038
|
-
});
|
|
3039
|
-
}
|
|
3040
|
-
}, [selectedAddress]);
|
|
3041
|
-
if (!yandexMaps) {
|
|
3042
|
-
return null;
|
|
3043
|
-
}
|
|
3044
|
-
const zIndex = 'z-10';
|
|
3045
|
-
return (jsxs("div", { id: "map", className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
|
|
3067
|
+
field?.('familyMembers')?.onChange?.(totalCount);
|
|
3068
|
+
}, [familyStatusKey, childrenCount, dependentsCount]);
|
|
3069
|
+
return (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u043B\u0435\u043D\u043E\u0432 \u0441\u0435\u043C\u044C\u0438", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", disabled: true, value: value, onChange: (_) => onChange?.(_) }));
|
|
3046
3070
|
});
|
|
3047
|
-
const getCenterPoint = (points) => {
|
|
3048
|
-
const centerCoords = [
|
|
3049
|
-
getArraySumAndAverage(mapByIndex(points, 0)),
|
|
3050
|
-
getArraySumAndAverage(mapByIndex(points, 1)),
|
|
3051
|
-
];
|
|
3052
|
-
return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
|
|
3053
|
-
};
|
|
3054
|
-
const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
|
|
3055
|
-
const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
|
|
3056
3071
|
|
|
3057
|
-
const
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3072
|
+
const FamilyStatusField = JSX(({ field, input }) => {
|
|
3073
|
+
const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
|
|
3074
|
+
return (jsx(SelectField, { field: field, source: familyStatus, label: "\u0421\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", fieldName: "familyStatus", input: input }));
|
|
3075
|
+
});
|
|
3076
|
+
|
|
3077
|
+
const SERVICE_TYPES = [
|
|
3078
|
+
{ key: 'ULTRASERVICE', text: 'Ультра' },
|
|
3079
|
+
{ key: 'PREMIUMSERVICE', text: 'Премиум' },
|
|
3080
|
+
];
|
|
3081
|
+
const SERVICE_DIRECTIONS = [
|
|
3082
|
+
{ key: 'Физическое лицо' },
|
|
3083
|
+
{ key: 'Юридическое лицо / ИП' },
|
|
3084
|
+
];
|
|
3085
|
+
const FEEDBACK_METHOD = [
|
|
3086
|
+
{ key: 'phone', text: 'Телефонный звонок' },
|
|
3087
|
+
{ key: 'email', text: 'Электронное сообщение' },
|
|
3088
|
+
];
|
|
3089
|
+
|
|
3090
|
+
const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
|
|
3091
|
+
|
|
3092
|
+
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
|
|
3093
|
+
|
|
3094
|
+
const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
|
|
3095
|
+
|
|
3096
|
+
const HousingField = JSX(({ field, input }) => {
|
|
3097
|
+
const { data: housing } = useLeadFormData('HOUSE_TYPE');
|
|
3098
|
+
return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
|
|
3099
|
+
});
|
|
3100
|
+
|
|
3101
|
+
const InnField = JSX(({ field, input }) => {
|
|
3102
|
+
const onDaDataChange = useCallback((item) => {
|
|
3103
|
+
field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
|
|
3104
|
+
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
3105
|
+
}, []);
|
|
3106
|
+
return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
|
|
3107
|
+
});
|
|
3108
|
+
|
|
3109
|
+
const IsClientField = JSX(({ field }) => (jsx(CheckboxWithError, { ...field('isClient'), text: '\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u043C \u0431\u0430\u043D\u043A\u0430 \u0410\u041E "\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A"' })));
|
|
3110
|
+
|
|
3111
|
+
const JobsNumberField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442 \u0440\u0430\u0431\u043E\u0442\u044B \u0437\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442", type: "number", maxLength: 2, ...getValidation(field('jobsNumber'), validatorObj.jobsNumber, input?.required), ...input })));
|
|
3112
|
+
|
|
3113
|
+
const LastJobExperienceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436 \u043D\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u043C \u0440\u0430\u0431\u043E\u0447\u0435\u043C \u043C\u0435\u0441\u0442\u0435", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('lastJobExperience'), validatorObj.lastJobExperience, input?.required), ...input })));
|
|
3114
|
+
|
|
3115
|
+
const LegalEntityNameField = JSX(({ field, input }) => {
|
|
3116
|
+
return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...input, ...getValidation(field('legalEntityName'), validatorObj.legalEntityName, input?.required) }));
|
|
3117
|
+
});
|
|
3100
3118
|
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
return (ev) => {
|
|
3109
|
-
!disabled && onClick && onClick(ev);
|
|
3110
|
-
};
|
|
3119
|
+
const LegalFormField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u041F\u0424", placeholder: "\u041E\u041E\u041E, \u041F\u0410\u041E \u0438 \u0434\u0440.", ...getValidation(field('legalForm'), validatorObj.legalForm, input?.required), ...input })));
|
|
3120
|
+
|
|
3121
|
+
const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
|
|
3122
|
+
const EMPTY_REGIONS = [];
|
|
3123
|
+
async function getOutServiceRegions() {
|
|
3124
|
+
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
3125
|
+
return data && Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
3111
3126
|
}
|
|
3112
3127
|
|
|
3113
|
-
const
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
|
|
3127
|
-
'rounded-md': rounded,
|
|
3128
|
-
}, !active && !disabled
|
|
3129
|
-
? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
|
|
3130
|
-
: '', className), type: type, role: role, onClick: onClick, children: children }));
|
|
3128
|
+
const LocalitiesField = JSX(({ field, input }) => {
|
|
3129
|
+
const fieldRegion = field('region');
|
|
3130
|
+
const regionKey = fieldRegion?.value?.key;
|
|
3131
|
+
const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
|
|
3132
|
+
const localities = regions
|
|
3133
|
+
?.find((_) => _.code === regionKey)
|
|
3134
|
+
?.localities?.map((_) => ({ key: _, text: _ }));
|
|
3135
|
+
useEffect(() => {
|
|
3136
|
+
if (regionKey !== '') {
|
|
3137
|
+
field?.('localities')?.onChange?.('');
|
|
3138
|
+
}
|
|
3139
|
+
}, [regionKey]);
|
|
3140
|
+
return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
|
|
3131
3141
|
});
|
|
3132
3142
|
|
|
3133
|
-
const
|
|
3143
|
+
const MandatoryPaymentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0432\u044B\u043F\u043B\u0430\u0442\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('mandatoryPayments'), validatorObj.mandatoryPayments, input?.required), ...input })));
|
|
3134
3144
|
|
|
3135
|
-
const
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
onButtonClick(key);
|
|
3141
|
-
return filteredBranches;
|
|
3142
|
-
};
|
|
3143
|
-
const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
|
|
3144
|
-
branch.workSchedule.businessScheduleVisibleTag &&
|
|
3145
|
-
!branch.workSchedule.businessScheduleDescription);
|
|
3146
|
-
return (jsxs("div", { className: "flex gap-lg flex-col sm:flex-row pb-lg", children: [jsx(Button, { "data-id": "all", onClick: (e) => handleClick(e, 'all', data), version: allButtonVersion, children: "\u0414\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" }), jsx(Button, { "data-id": "business", onClick: (e) => handleClick(e, 'business', data), version: businessButtonVersion, children: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" })] }));
|
|
3147
|
-
};
|
|
3145
|
+
const METHODS_OF_OBTAIN = [
|
|
3146
|
+
{ id: 'office', text: 'В отделении Банка' },
|
|
3147
|
+
{ id: 'courier', text: 'Курьерская доставка' },
|
|
3148
|
+
];
|
|
3149
|
+
const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
|
|
3148
3150
|
|
|
3149
|
-
const
|
|
3151
|
+
const FIELD_NAME$1 = 'middleName';
|
|
3152
|
+
const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$1), ...getValidation(field(FIELD_NAME$1), validatorObj.middleName, input?.required), ...input })));
|
|
3150
3153
|
|
|
3151
|
-
const
|
|
3152
|
-
const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
|
|
3153
|
-
const visibleFiltersNum = onlyOffice ? 5 : 6;
|
|
3154
|
-
const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
|
|
3155
|
-
const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
|
|
3156
|
-
? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
|
|
3157
|
-
: [filtersCheckbox, []];
|
|
3158
|
-
return (jsx("div", { children: filters?.length ? (jsx("div", { children: jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs("div", { children: [jsx("div", { className: COMMON_FILTERS_STYLES, children: visibleFilters }), jsx(FoldableSection, { className: COMMON_FILTERS_STYLES, isUnfolded: isUnfolded, children: hiddenFilters })] })), renderFoldButton: renderFoldButton$2(reset, onlyOffice) }) })) : null }));
|
|
3159
|
-
};
|
|
3160
|
-
const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
|
|
3161
|
-
const labels = ['Больше фильтров', 'Меньше фильтров'];
|
|
3162
|
-
const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
3163
|
-
return (jsxs("div", { className: "flex space-x-lg", children: [onlyOffice ? (jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", appendRight: jsx(Icon, { name: icons[Number(isUnfolded)], width: "16", height: "16" }), text: labels[Number(isUnfolded)], onClick: onToggle })) : null, jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", onClick: reset, children: renderBtnInner() })] }));
|
|
3164
|
-
};
|
|
3165
|
-
const renderBtnInner = () => (jsxs("div", { className: "flex items-center", children: ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440", jsx(Icon, { name: "CloseIcon", width: "16", height: "16", className: "ml-2xs" })] }));
|
|
3154
|
+
const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
|
|
3166
3155
|
|
|
3167
|
-
const
|
|
3156
|
+
const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
|
|
3168
3157
|
|
|
3169
|
-
const
|
|
3170
|
-
|
|
3171
|
-
const
|
|
3172
|
-
const
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
});
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3158
|
+
const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
|
|
3159
|
+
|
|
3160
|
+
const OrganizationField = JSX(({ field, input }) => {
|
|
3161
|
+
const { data: organization } = useLeadFormData('ORGANIZATION_TYPE');
|
|
3162
|
+
return (jsx(SelectField, { field: field, source: organization, label: "\u0422\u0438\u043F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "organization", input: input }));
|
|
3163
|
+
});
|
|
3164
|
+
|
|
3165
|
+
const OrganizationNameField = JSX(({ field, input }) => {
|
|
3166
|
+
const onDaDataChange = useCallback((item) => {
|
|
3167
|
+
field?.('inn')?.onChange?.(item.data?.inn);
|
|
3168
|
+
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
3169
|
+
}, []);
|
|
3170
|
+
return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", ...input, ...getValidation(field('organizationName'), validatorObj.organizationName, input?.required), onDaDataChange: onDaDataChange }));
|
|
3171
|
+
});
|
|
3172
|
+
|
|
3173
|
+
const OtherIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043D\u044B\u0435 \u0434\u043E\u0445\u043E\u0434\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('otherIncome'), validatorObj.otherIncome, input?.required), ...input })));
|
|
3174
|
+
|
|
3175
|
+
const ParticipantDateRegistrationField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043F\u043E \u043C\u0435\u0441\u0442\u0443 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430", ...getValidation(field('participantDateRegistration'), validatorObj.participantDateRegistration, input?.required) })));
|
|
3176
|
+
|
|
3177
|
+
const MAX_PART = 100;
|
|
3178
|
+
const PartInBusinessField = JSX(({ field, input }) => {
|
|
3179
|
+
const isBusinessOwner = field('positionOrganization')?.value?.key === 'BUSINESS_OWNER';
|
|
3180
|
+
const partInBusinessField = {
|
|
3181
|
+
...getValidation(field('partInBusiness'), validatorObj.partInBusiness, input?.required),
|
|
3187
3182
|
};
|
|
3188
|
-
|
|
3183
|
+
const handleChange = (value) => partInBusinessField?.onChange &&
|
|
3184
|
+
partInBusinessField?.onChange(String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''));
|
|
3185
|
+
return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", type: "number", maxLength: 3, ...partInBusinessField, ...input, onChange: handleChange, value: isBusinessOwner ? partInBusinessField?.value : '', disabled: !isBusinessOwner }));
|
|
3189
3186
|
});
|
|
3190
|
-
const filterItems$1 = (data, filtrationState) => {
|
|
3191
|
-
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
3192
|
-
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
|
|
3193
|
-
};
|
|
3194
|
-
const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
|
|
3195
3187
|
|
|
3196
|
-
const
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
|
|
3201
|
-
const _points = [
|
|
3202
|
-
..._filteredItems.map((_) => ({
|
|
3203
|
-
type: 'offices',
|
|
3204
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
3205
|
-
content: getBalloon(_),
|
|
3206
|
-
})),
|
|
3207
|
-
..._filteredRemoteWorkplaces.map((_) => ({
|
|
3208
|
-
type: 'workplaces',
|
|
3209
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
3210
|
-
content: getBalloonRemoteWorkplaces({
|
|
3211
|
-
address: _.address,
|
|
3212
|
-
workScheduleDescription: _.workScheduleDescription,
|
|
3213
|
-
}),
|
|
3214
|
-
})),
|
|
3215
|
-
].filter((_) => _.coords && _.coords.length === 2);
|
|
3216
|
-
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
3217
|
-
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
3218
|
-
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
3219
|
-
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
3220
|
-
};
|
|
3188
|
+
const PartnerCommentsField = JSX(({ field, input }) => {
|
|
3189
|
+
const { required, ...rest } = input;
|
|
3190
|
+
return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
|
|
3191
|
+
});
|
|
3221
3192
|
|
|
3222
|
-
const
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
const
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3193
|
+
const PAYMENT_SYSTEM_TYPES = [
|
|
3194
|
+
{ id: 'mir', text: 'Карта МИР' },
|
|
3195
|
+
{ id: 'union_pay', text: 'UnionPay' },
|
|
3196
|
+
];
|
|
3197
|
+
const PaymentSystemField = JSX(({ field, input }) => {
|
|
3198
|
+
const { value, onChange } = field('paymentSystem');
|
|
3199
|
+
return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: PAYMENT_SYSTEM_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('paymentSystem'), validatorObj.paymentSystem, input?.required) }));
|
|
3200
|
+
});
|
|
3201
|
+
|
|
3202
|
+
const isPlaceholder = (_) => _ === '_';
|
|
3203
|
+
const isDigit = (_) => /\d/.test(_);
|
|
3204
|
+
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
3205
|
+
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
3206
|
+
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
3207
|
+
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
3208
|
+
function normalizePhone(phone) {
|
|
3209
|
+
const phoneNumbers = phone.replace(/\D/g, '');
|
|
3210
|
+
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
3211
|
+
const result = phonePattern.map(applyPlaceholder);
|
|
3212
|
+
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
3213
|
+
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
3217
|
+
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
3218
|
+
const handleBlur = useCallback((v) => {
|
|
3219
|
+
if (v === '+7 (') {
|
|
3220
|
+
onChange && onChange('');
|
|
3234
3221
|
}
|
|
3235
|
-
}, [
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3222
|
+
}, []);
|
|
3223
|
+
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
3224
|
+
});
|
|
3225
|
+
|
|
3226
|
+
const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
|
|
3227
|
+
|
|
3228
|
+
const PhoneField = JSX(({ field, input }) => {
|
|
3229
|
+
const fieldName = input?.name || 'phone';
|
|
3230
|
+
return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
|
|
3231
|
+
});
|
|
3232
|
+
|
|
3233
|
+
const PositionOrganizationField = JSX(({ field, input }) => {
|
|
3234
|
+
const { data: positionOrganization } = useLeadFormData('POSITION');
|
|
3235
|
+
return (jsx(SelectField, { field: field, source: positionOrganization, label: "\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "positionOrganization", input: input }));
|
|
3236
|
+
});
|
|
3237
|
+
|
|
3238
|
+
const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
|
|
3239
|
+
|
|
3240
|
+
const ProductField = UniBlock(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
|
|
3241
|
+
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
3242
|
+
|
|
3243
|
+
const REGIONS_URL = `${API_BASE_URI}/regions`;
|
|
3244
|
+
function useRegions(url = REGIONS_URL) {
|
|
3245
|
+
const { data } = useAsyncData(url, fetchJSONUnsafe);
|
|
3246
|
+
return Array.isArray(data) ? data : [];
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
const RegionField = JSX(({ field, input, url }) => {
|
|
3250
|
+
const regions = useRegions(url);
|
|
3251
|
+
return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
3252
|
+
});
|
|
3253
|
+
|
|
3254
|
+
const RegionPremiumField = JSX(({ field, input }) => {
|
|
3255
|
+
const branchByRegions = useBranchesByRegions(true);
|
|
3256
|
+
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
3257
|
+
key: region,
|
|
3258
|
+
text: region,
|
|
3259
|
+
})), [branchByRegions]);
|
|
3260
|
+
return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
3246
3261
|
});
|
|
3247
3262
|
|
|
3248
|
-
const
|
|
3249
|
-
const regions =
|
|
3250
|
-
|
|
3263
|
+
const RegionRetailField = JSX(({ field, input }) => {
|
|
3264
|
+
const { data: regions } = useLeadFormData('REGION_RF');
|
|
3265
|
+
const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
|
|
3266
|
+
return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", isSearch: true, options: formatRegions, ...getValidation(field('regionRetail'), validatorObj.regionRetail, input?.required) }));
|
|
3251
3267
|
});
|
|
3252
3268
|
|
|
3253
3269
|
const RetirementIncomeField = JSX(({ field, input }) => {
|
|
@@ -3429,8 +3445,8 @@
|
|
|
3429
3445
|
creditInRshbCd: jsx(CreditInRshbCdField, { field: field, input: input }),
|
|
3430
3446
|
bankEmployeeCode: jsx(BankEmpoleeCodeField, { field: field, input: input }),
|
|
3431
3447
|
partInBusiness: jsx(PartInBusinessField, { field: field, input: input }),
|
|
3432
|
-
regionRetail: jsx(
|
|
3433
|
-
addressRetail: jsx(
|
|
3448
|
+
regionRetail: jsx(RegionRetailField, { field: field, input: input }),
|
|
3449
|
+
addressRetail: jsx(AddressRetailField, { field: field, input: input }),
|
|
3434
3450
|
addressMatch: jsx(AddressMatchField, { field: field, input: input }),
|
|
3435
3451
|
paymentSystem: jsx(PaymentSystemField, { field: field, input: input }),
|
|
3436
3452
|
currency: jsx(CurrencyField, { field: field, input: input }),
|
|
@@ -3531,6 +3547,7 @@
|
|
|
3531
3547
|
posTerminal: false,
|
|
3532
3548
|
consentToReceiveMaterials: false,
|
|
3533
3549
|
consentDataProcessing: false,
|
|
3550
|
+
addressRetail: { key: '', text: '' },
|
|
3534
3551
|
};
|
|
3535
3552
|
const getInitialFormState$3 = (inputs, typeForm = '') => {
|
|
3536
3553
|
const formState = Object.fromEntries(inputs.map((_) => [
|
|
@@ -3668,6 +3685,7 @@
|
|
|
3668
3685
|
paymentSystem: '',
|
|
3669
3686
|
cardCategory: { key: '', text: '' },
|
|
3670
3687
|
codeWord: '',
|
|
3688
|
+
addressRetail: { key: '', text: '' },
|
|
3671
3689
|
};
|
|
3672
3690
|
const getInitialFormState$2 = (inputs, savedForm, typeForm = '') => {
|
|
3673
3691
|
if (savedForm) {
|
|
@@ -6244,8 +6262,8 @@
|
|
|
6244
6262
|
{
|
|
6245
6263
|
regionRetail: '',
|
|
6246
6264
|
addressRetail: {
|
|
6247
|
-
|
|
6248
|
-
|
|
6265
|
+
key: '',
|
|
6266
|
+
text: '',
|
|
6249
6267
|
},
|
|
6250
6268
|
bankEmployeeCode: undefined,
|
|
6251
6269
|
addressCourier: {
|
|
@@ -6325,7 +6343,7 @@
|
|
|
6325
6343
|
return (jsxs("div", { className: "flex justify-between gap-m", children: [jsx(Button, { onClick: onPrevStep, className: style('w-full @xl:w-auto'), type: "button", version: "secondary", disabled: isFirstStep, children: "\u041D\u0430\u0437\u0430\u0434" }), jsx(Button, { className: "w-full @xl:w-auto", type: "submit", children: "\u0414\u0430\u043B\u0435\u0435" })] }));
|
|
6326
6344
|
});
|
|
6327
6345
|
|
|
6328
|
-
const getFifthStepData = (formData) => {
|
|
6346
|
+
const getFifthStepData$1 = (formData) => {
|
|
6329
6347
|
const { bankruptcyFlg, shareholderFlg, legalEntityName, creditInRshbCd } = formData;
|
|
6330
6348
|
return {
|
|
6331
6349
|
bankruptcyFlg,
|
|
@@ -6473,7 +6491,7 @@
|
|
|
6473
6491
|
case 3:
|
|
6474
6492
|
return getFourthStepData$1(formData);
|
|
6475
6493
|
case 4:
|
|
6476
|
-
return getFifthStepData(formData);
|
|
6494
|
+
return getFifthStepData$1(formData);
|
|
6477
6495
|
case 5:
|
|
6478
6496
|
return getSixthStepData(formData);
|
|
6479
6497
|
default:
|
|
@@ -7182,6 +7200,13 @@
|
|
|
7182
7200
|
return (jsxs("div", { className: 'flex justify-between', children: [jsx(Button, { onClick: onPrevStep, className: style('w-full @xl:w-auto'), type: "button", version: "secondary", disabled: isFirstStep, children: "\u041D\u0430\u0437\u0430\u0434" }), jsx(Button, { className: style('w-full @xl:w-auto'), type: "submit", children: "\u0414\u0430\u043B\u0435\u0435" })] }));
|
|
7183
7201
|
});
|
|
7184
7202
|
|
|
7203
|
+
const getFifthStepData = (formData) => {
|
|
7204
|
+
const { addressRetail } = formData;
|
|
7205
|
+
return {
|
|
7206
|
+
office: addressRetail?.key ? { id: addressRetail.key } : undefined,
|
|
7207
|
+
};
|
|
7208
|
+
};
|
|
7209
|
+
|
|
7185
7210
|
const getFirstStepData = (formData) => {
|
|
7186
7211
|
const { name, surname, middleName, birthday = '', phone = '', email, sex, birthPlace, dulIssueDateField = '', dulIssuedBy, dulNumber, dulSerie, dulSubdivisionCode, education, participantDateRegistration = '', housing, addressRegistration, addressFact, } = formData;
|
|
7187
7212
|
return {
|
|
@@ -7287,7 +7312,7 @@
|
|
|
7287
7312
|
taskSource: globalThis.location.origin,
|
|
7288
7313
|
id: taskId,
|
|
7289
7314
|
office: {
|
|
7290
|
-
id: '
|
|
7315
|
+
id: '',
|
|
7291
7316
|
},
|
|
7292
7317
|
authorizedAgentId: formData?.bankEmployeeCode,
|
|
7293
7318
|
participants: [
|
|
@@ -7304,6 +7329,7 @@
|
|
|
7304
7329
|
},
|
|
7305
7330
|
],
|
|
7306
7331
|
...getZeroStepData(formData),
|
|
7332
|
+
...getFifthStepData(formData),
|
|
7307
7333
|
esiaAccountTypeCd: {
|
|
7308
7334
|
key: formData?.esiaAccountTypeCd?.key,
|
|
7309
7335
|
},
|
|
@@ -9952,7 +9978,7 @@
|
|
|
9952
9978
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
9953
9979
|
});
|
|
9954
9980
|
|
|
9955
|
-
const packageVersion = "0.14.
|
|
9981
|
+
const packageVersion = "0.14.666";
|
|
9956
9982
|
|
|
9957
9983
|
exports.Blocks = Blocks;
|
|
9958
9984
|
exports.ContentPage = ContentPage;
|