thm-p3-configurator 0.0.201 → 0.0.203
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/dist/src/shared/__components__/LocationsSelector/LocationAutoComplete.js +6 -12
- package/dist/src/shared/__components__/LocationsSelector/LocationClusteredMap.js +13 -16
- package/dist/src/shared/__components__/LocationsSelector/LocationList.js +13 -8
- package/dist/src/shared/__components__/LocationsSelector/index.js +32 -20
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +131 -135
- package/package.json +1 -1
|
@@ -54,7 +54,7 @@ const LocationsLoading = () => {
|
|
|
54
54
|
};
|
|
55
55
|
const LocationAutoComplete = _ref => {
|
|
56
56
|
let {
|
|
57
|
-
|
|
57
|
+
onLocationUpdate,
|
|
58
58
|
label = 'Postcode'
|
|
59
59
|
} = _ref;
|
|
60
60
|
const [sessionToken, setSessionToken] = (0, _react.useState)();
|
|
@@ -65,21 +65,15 @@ const LocationAutoComplete = _ref => {
|
|
|
65
65
|
const [dropdownActive, setDropdownActive] = (0, _react.useState)(false);
|
|
66
66
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
67
67
|
const [error, setError] = (0, _react.useState)('');
|
|
68
|
-
const [place, setPlace] = (0, _react.useState)(null);
|
|
69
68
|
const map = (0, _reactGoogleMaps.useMap)();
|
|
70
69
|
const places = (0, _reactGoogleMaps.useMapsLibrary)('places');
|
|
71
70
|
(0, _react.useEffect)(() => {
|
|
72
|
-
var _place$geometry;
|
|
73
71
|
if (!places || !map) return;
|
|
74
72
|
setAutocompleteService(new places.AutocompleteService());
|
|
75
73
|
setPlacesService(new places.PlacesService(map));
|
|
76
74
|
setSessionToken(new places.AutocompleteSessionToken());
|
|
77
|
-
if (place && (_place$geometry = place.geometry) !== null && _place$geometry !== void 0 && _place$geometry.viewport) {
|
|
78
|
-
var _place$geometry2;
|
|
79
|
-
map.fitBounds((_place$geometry2 = place.geometry) === null || _place$geometry2 === void 0 ? void 0 : _place$geometry2.viewport);
|
|
80
|
-
}
|
|
81
75
|
return () => setAutocompleteService(null);
|
|
82
|
-
}, [map, places
|
|
76
|
+
}, [map, places]);
|
|
83
77
|
const fetchPredictions = (0, _react.useCallback)(async inputValue => {
|
|
84
78
|
if (!autocompleteService || !inputValue) {
|
|
85
79
|
setPredictionResults([]);
|
|
@@ -122,21 +116,21 @@ const LocationAutoComplete = _ref => {
|
|
|
122
116
|
setInputValue((_placeDetails$formatt = placeDetails === null || placeDetails === void 0 ? void 0 : placeDetails.formatted_address) !== null && _placeDetails$formatt !== void 0 ? _placeDetails$formatt : '');
|
|
123
117
|
setSessionToken(new places.AutocompleteSessionToken());
|
|
124
118
|
setDropdownActive(false);
|
|
125
|
-
setPlace(placeDetails);
|
|
126
119
|
if (placeDetails !== null && placeDetails !== void 0 && (_placeDetails$geometr = placeDetails.geometry) !== null && _placeDetails$geometr !== void 0 && _placeDetails$geometr.location) {
|
|
127
120
|
const {
|
|
128
121
|
lat,
|
|
129
122
|
lng
|
|
130
123
|
} = placeDetails.geometry.location;
|
|
131
|
-
|
|
124
|
+
const coordinates = {
|
|
132
125
|
lat: lat(),
|
|
133
126
|
lng: lng()
|
|
134
|
-
}
|
|
127
|
+
};
|
|
128
|
+
onLocationUpdate(coordinates, true);
|
|
135
129
|
}
|
|
136
130
|
};
|
|
137
131
|
placesService === null || placesService === void 0 || placesService.getDetails(detailRequestOptions, detailsRequestCallback);
|
|
138
132
|
(_document$querySelect = document.querySelector((0, _helpers__.withStyle)("dealer-autocomplete__list"))) === null || _document$querySelect === void 0 || _document$querySelect.scrollTo(0, 0);
|
|
139
|
-
}, [places, placesService, sessionToken,
|
|
133
|
+
}, [places, placesService, sessionToken, onLocationUpdate, predictionResults]);
|
|
140
134
|
const handleSubmit = event => {
|
|
141
135
|
event.preventDefault();
|
|
142
136
|
};
|
|
@@ -66,26 +66,23 @@ const LocationClusteredMap = /*#__PURE__*/_react.default.memo(_ref => {
|
|
|
66
66
|
}, [core]);
|
|
67
67
|
const fitBoundsToMarkers = (0, _react.useCallback)(() => {
|
|
68
68
|
if (!map || !bounds || locationIds.length === 0) return;
|
|
69
|
+
|
|
70
|
+
// Get all valid coordinates from locations
|
|
71
|
+
const validCoordinates = locationIds.map(id => locationsById[id]).map(location => (0, _geolocation.getCoordinatesByString)(location.googleMapsLocation)).filter(Boolean);
|
|
69
72
|
if (userLocation) {
|
|
70
|
-
|
|
73
|
+
map.setCenter(userLocation);
|
|
74
|
+
map.setZoom(11);
|
|
75
|
+
} else {
|
|
76
|
+
validCoordinates.forEach(_ref2 => {
|
|
77
|
+
let {
|
|
78
|
+
lat,
|
|
79
|
+
lng
|
|
80
|
+
} = _ref2;
|
|
81
|
+
bounds.extend(new core.LatLng(lat, lng));
|
|
82
|
+
});
|
|
71
83
|
map.fitBounds(bounds);
|
|
72
|
-
map.setZoom(10);
|
|
73
|
-
return;
|
|
74
84
|
}
|
|
75
|
-
|
|
76
|
-
// Batch coordinate calculations
|
|
77
|
-
const validCoordinates = locationIds.map(id => locationsById[id]).map(location => (0, _geolocation.getCoordinatesByString)(location.googleMapsLocation)).filter(Boolean);
|
|
78
|
-
validCoordinates.forEach(_ref2 => {
|
|
79
|
-
let {
|
|
80
|
-
lat,
|
|
81
|
-
lng
|
|
82
|
-
} = _ref2;
|
|
83
|
-
bounds.extend(new core.LatLng(lat, lng));
|
|
84
|
-
});
|
|
85
|
-
map.fitBounds(bounds);
|
|
86
85
|
}, [map, bounds, locationIds, locationsById, userLocation, core]);
|
|
87
|
-
|
|
88
|
-
// Debounce bounds fitting
|
|
89
86
|
(0, _react.useEffect)(() => {
|
|
90
87
|
if (!core) return;
|
|
91
88
|
const debounceFitBounds = (0, _lodash.default)(fitBoundsToMarkers, 150);
|
|
@@ -119,6 +119,7 @@ const LocationList = _ref => {
|
|
|
119
119
|
locationsById,
|
|
120
120
|
locationIds,
|
|
121
121
|
userLocation,
|
|
122
|
+
isLocationSetViaSearch = false,
|
|
122
123
|
isLoading = false
|
|
123
124
|
} = _ref;
|
|
124
125
|
const {
|
|
@@ -127,7 +128,7 @@ const LocationList = _ref => {
|
|
|
127
128
|
const [{
|
|
128
129
|
selectedBranch
|
|
129
130
|
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
130
|
-
const
|
|
131
|
+
const listRef = (0, _react.useRef)(null);
|
|
131
132
|
const locationsWithDistance = locationIds.map((locationId, index) => {
|
|
132
133
|
const location = locationsById[locationId];
|
|
133
134
|
const coordinates = location.googleMapsLocation;
|
|
@@ -146,22 +147,26 @@ const LocationList = _ref => {
|
|
|
146
147
|
});
|
|
147
148
|
}).filter(location => location !== null);
|
|
148
149
|
const sortedLocations = locationsWithDistance.sort((a, b) => {
|
|
150
|
+
const aIsSelected = a.entityId === activeMarkerId || a.entityId === selectedBranch;
|
|
151
|
+
const bIsSelected = b.entityId === activeMarkerId || b.entityId === selectedBranch;
|
|
152
|
+
if (aIsSelected && !bIsSelected) return -1; // a goes to top
|
|
153
|
+
if (!aIsSelected && bIsSelected) return 1; // b goes to top
|
|
154
|
+
|
|
149
155
|
if (a.distance === null) return 1;
|
|
150
156
|
if (b.distance === null) return -1;
|
|
151
157
|
return a.distance - b.distance;
|
|
152
158
|
});
|
|
159
|
+
|
|
160
|
+
// Handle scrolling when location is set via search
|
|
153
161
|
(0, _react.useEffect)(() => {
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
behavior: 'smooth',
|
|
157
|
-
block: 'center'
|
|
158
|
-
});
|
|
162
|
+
if (isLocationSetViaSearch && listRef.current) {
|
|
163
|
+
listRef.current.scrollTop = 0;
|
|
159
164
|
}
|
|
160
|
-
}, [
|
|
165
|
+
}, [isLocationSetViaSearch, userLocation]);
|
|
161
166
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
167
|
+
ref: listRef,
|
|
162
168
|
className: (0, _helpers__.withStyle)('dealer-list')
|
|
163
169
|
}, /*#__PURE__*/_react.default.createElement("h5", null, userLocation ? 'Dichtsbijzijnde montagelocaties' : 'Montagelocaties'), isLoading && /*#__PURE__*/_react.default.createElement(LocationsLoading, null), !isLoading && !locationIds.length && /*#__PURE__*/_react.default.createElement(NoLocationFound, null), sortedLocations.map(location => /*#__PURE__*/_react.default.createElement(_LocationListItem.default, {
|
|
164
|
-
ref: location.entityId === activeMarkerId || location.entityId === selectedBranch ? selectedRef : null,
|
|
165
170
|
openingHours: location.openingstijden,
|
|
166
171
|
title: location.naamVestiging,
|
|
167
172
|
city: location.city,
|
|
@@ -12,6 +12,7 @@ var _reactGoogleMaps = require("@vis.gl/react-google-maps");
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _queries = require("../../__api__/queries");
|
|
14
14
|
var _constants__ = require("../../__constants__");
|
|
15
|
+
var _ActiveMarkerContext = require("../../__context__/ActiveMarkerContext");
|
|
15
16
|
var _FormulaContext = require("../../__context__/FormulaContext");
|
|
16
17
|
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
17
18
|
var _helpers__ = require("../../__helpers__");
|
|
@@ -61,9 +62,13 @@ const Loaded = /*#__PURE__*/_react.default.memo(_ref => {
|
|
|
61
62
|
});
|
|
62
63
|
const LocationsSelector = /*#__PURE__*/_react.default.memo(() => {
|
|
63
64
|
const [userLocation, setUserLocation] = (0, _useUserLocation.default)();
|
|
65
|
+
const [isLocationSetViaSearch, setIsLocationSetViaSearch] = (0, _react.useState)(false);
|
|
66
|
+
const {
|
|
67
|
+
setActiveMarkerId
|
|
68
|
+
} = (0, _ActiveMarkerContext.useActiveMarker)();
|
|
69
|
+
const [, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
64
70
|
const screen = (0, _useBreakpoint.default)();
|
|
65
71
|
const isDesktop = screen.size >= 1200;
|
|
66
|
-
const [visibleIds, setVisibleIds] = (0, _react.useState)([]);
|
|
67
72
|
const formula = (0, _FormulaContext.useFormula)();
|
|
68
73
|
const [{
|
|
69
74
|
franchiseName
|
|
@@ -100,21 +105,26 @@ const LocationsSelector = /*#__PURE__*/_react.default.memo(() => {
|
|
|
100
105
|
array: locations || [],
|
|
101
106
|
key: 'entityId'
|
|
102
107
|
}), [locations]);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
|
|
109
|
+
// Handle location updates from search
|
|
110
|
+
const handleLocationUpdate = function handleLocationUpdate(newLocation) {
|
|
111
|
+
let fromSearch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
112
|
+
setUserLocation(newLocation);
|
|
113
|
+
setIsLocationSetViaSearch(fromSearch);
|
|
114
|
+
|
|
115
|
+
// Close any open marker popups when searching for a new location
|
|
116
|
+
if (fromSearch) {
|
|
117
|
+
setActiveMarkerId(null);
|
|
118
|
+
|
|
119
|
+
// Also clear any selected branch to avoid confusion
|
|
120
|
+
dispatch({
|
|
121
|
+
payload: {
|
|
122
|
+
branchId: null
|
|
123
|
+
},
|
|
124
|
+
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH
|
|
125
|
+
});
|
|
106
126
|
}
|
|
107
|
-
|
|
108
|
-
const addIdsInBatches = index => {
|
|
109
|
-
const offset = 10;
|
|
110
|
-
const nextBatch = allIds.slice(index, index + offset);
|
|
111
|
-
setVisibleIds(prev => [...prev, ...nextBatch]);
|
|
112
|
-
if (index + offset < allIds.length) {
|
|
113
|
-
requestAnimationFrame(() => addIdsInBatches(index + offset));
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
addIdsInBatches(0);
|
|
117
|
-
}, [allIds]);
|
|
127
|
+
};
|
|
118
128
|
return /*#__PURE__*/_react.default.createElement(_reactGoogleMaps.APIProvider, {
|
|
119
129
|
apiKey: APP_CONFIG.googleMapsApiKey,
|
|
120
130
|
libraries: ['marker']
|
|
@@ -125,31 +135,33 @@ const LocationsSelector = /*#__PURE__*/_react.default.memo(() => {
|
|
|
125
135
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
126
136
|
className: (0, _helpers__.withStyle)(isDesktop ? 'dealer-map__container' : 'dealer-map')
|
|
127
137
|
}, /*#__PURE__*/_react.default.createElement(_LocationClusteredMap.default, {
|
|
128
|
-
locationIds:
|
|
138
|
+
locationIds: allIds,
|
|
129
139
|
locationsById: byId,
|
|
130
140
|
userLocation: userLocation
|
|
131
141
|
}))), /*#__PURE__*/_react.default.createElement("aside", {
|
|
132
142
|
className: (0, _helpers__.withStyle)('dealer-sidebar col-xl-4 mt-3 mt-xl-0')
|
|
133
143
|
}, isDesktop && /*#__PURE__*/_react.default.createElement(_LocationAutoComplete.default, {
|
|
134
|
-
|
|
144
|
+
onLocationUpdate: handleLocationUpdate
|
|
135
145
|
}), franchiseName && /*#__PURE__*/_react.default.createElement("h6", {
|
|
136
146
|
className: (0, _helpers__.withStyle)('my-2')
|
|
137
147
|
}, "Keten: ", franchiseName), /*#__PURE__*/_react.default.createElement(_LocationList.default, {
|
|
138
148
|
locationIds: allIds,
|
|
139
149
|
locationsById: byId,
|
|
140
|
-
userLocation: userLocation
|
|
150
|
+
userLocation: userLocation,
|
|
151
|
+
isLocationSetViaSearch: isLocationSetViaSearch
|
|
141
152
|
}))) : /*#__PURE__*/_react.default.createElement("div", {
|
|
142
153
|
className: (0, _helpers__.withStyle)('row gx-5 mt-3 mt-xl-5 justify-content-center')
|
|
143
154
|
}, /*#__PURE__*/_react.default.createElement("aside", {
|
|
144
155
|
className: (0, _helpers__.withStyle)('dealer-sidebar col-xl-4 mt-3 mt-xl-0')
|
|
145
156
|
}, isDesktop && /*#__PURE__*/_react.default.createElement(_LocationAutoComplete.default, {
|
|
146
|
-
|
|
157
|
+
onLocationUpdate: handleLocationUpdate
|
|
147
158
|
}), franchiseName && /*#__PURE__*/_react.default.createElement("h6", {
|
|
148
159
|
className: (0, _helpers__.withStyle)('my-2')
|
|
149
160
|
}, "Keten: ", franchiseName), /*#__PURE__*/_react.default.createElement(_LocationList.default, {
|
|
150
161
|
locationIds: allIds,
|
|
151
162
|
locationsById: byId,
|
|
152
|
-
userLocation: userLocation
|
|
163
|
+
userLocation: userLocation,
|
|
164
|
+
isLocationSetViaSearch: isLocationSetViaSearch
|
|
153
165
|
})))));
|
|
154
166
|
});
|
|
155
167
|
var _default = exports.default = LocationsSelector;
|
|
@@ -619,7 +619,136 @@ const InternalAppointmentForm = _ref => {
|
|
|
619
619
|
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
620
620
|
isRequired: true,
|
|
621
621
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['ownershipType']
|
|
622
|
-
})
|
|
622
|
+
}), (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement("div", {
|
|
623
|
+
className: (0, _helpers__.withStyle)('company-search-container position-relative mt-2 mb-2')
|
|
624
|
+
}, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
625
|
+
placeholder: "Zoek leasemaatschappijen...",
|
|
626
|
+
value: customer.companyName,
|
|
627
|
+
name: "companyName",
|
|
628
|
+
onChange: value => {
|
|
629
|
+
dispatch({
|
|
630
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
631
|
+
payload: {
|
|
632
|
+
companyName: value
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
// Also update search term if value is different
|
|
637
|
+
if (value !== companySearchTerm) {
|
|
638
|
+
setCompanySearchTerm(value);
|
|
639
|
+
setIsCompanyInputFocused(true);
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
onFocus: () => {
|
|
643
|
+
setIsCompanyInputFocused(true);
|
|
644
|
+
},
|
|
645
|
+
onBlur: () => {
|
|
646
|
+
setTimeout(() => {
|
|
647
|
+
setIsCompanyInputFocused(false);
|
|
648
|
+
}, 300); // Increased delay for better chance of click completion
|
|
649
|
+
},
|
|
650
|
+
isRequired: false,
|
|
651
|
+
form: "quotation",
|
|
652
|
+
label: "Leasemaatschappij:",
|
|
653
|
+
errorMessage: errors === null || errors === void 0 ? void 0 : errors['companyName']
|
|
654
|
+
}), isCompanyInputFocused && companySearchTerm && companySearchTerm.length >= 3 && branchesByType && branchesByType.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
655
|
+
className: (0, _helpers__.withStyle)('dropdown-results position-absolute w-100 border rounded bg-white shadow'),
|
|
656
|
+
style: {
|
|
657
|
+
maxHeight: '200px',
|
|
658
|
+
overflowY: 'auto',
|
|
659
|
+
zIndex: 1050,
|
|
660
|
+
top: '100%',
|
|
661
|
+
left: 0,
|
|
662
|
+
right: 0
|
|
663
|
+
},
|
|
664
|
+
onMouseDown: e => {
|
|
665
|
+
e.preventDefault();
|
|
666
|
+
}
|
|
667
|
+
}, isLoadingBranchesByType && /*#__PURE__*/_react.default.createElement("div", {
|
|
668
|
+
className: (0, _helpers__.withStyle)('p-2 text-center')
|
|
669
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, "Zoeken...")), branchesByType.map(branch => /*#__PURE__*/_react.default.createElement("div", {
|
|
670
|
+
key: branch.entityId,
|
|
671
|
+
className: (0, _helpers__.withStyle)('dropdown-item p-2 border-bottom'),
|
|
672
|
+
style: {
|
|
673
|
+
cursor: 'pointer'
|
|
674
|
+
},
|
|
675
|
+
onMouseDown: e => {
|
|
676
|
+
e.preventDefault();
|
|
677
|
+
dispatch({
|
|
678
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
679
|
+
payload: {
|
|
680
|
+
companyName: branch.name
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
if (branch.postalCode) {
|
|
684
|
+
dispatch({
|
|
685
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
686
|
+
payload: {
|
|
687
|
+
zipCode: branch.postalCode
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
if (branch.street) {
|
|
692
|
+
dispatch({
|
|
693
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
694
|
+
payload: {
|
|
695
|
+
streetName: branch.street
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
if (branch.city) {
|
|
700
|
+
dispatch({
|
|
701
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
702
|
+
payload: {
|
|
703
|
+
city: branch.city
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
if (branch.street2) {
|
|
708
|
+
dispatch({
|
|
709
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
710
|
+
payload: {
|
|
711
|
+
houseNumber: branch.street2
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
if (branch.vatNumber) {
|
|
716
|
+
dispatch({
|
|
717
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
718
|
+
payload: {
|
|
719
|
+
vatNumber: branch.vatNumber
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
if (branch.kvkNumber) {
|
|
724
|
+
dispatch({
|
|
725
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
726
|
+
payload: {
|
|
727
|
+
kvkNumber: branch.kvkNumber
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
if (branch.huisnummerToevoeging) {
|
|
732
|
+
dispatch({
|
|
733
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
734
|
+
payload: {
|
|
735
|
+
houseNumberAddition: branch.huisnummerToevoeging
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
if (branch.country && branch.country.entityId) {
|
|
740
|
+
dispatch({
|
|
741
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
742
|
+
payload: {
|
|
743
|
+
countryId: branch.country.entityId
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
setRefreshKey(Date.now());
|
|
747
|
+
}
|
|
748
|
+
setCompanySearchTerm('');
|
|
749
|
+
setIsCompanyInputFocused(false);
|
|
750
|
+
}
|
|
751
|
+
}, branch.name))))), /*#__PURE__*/_react.default.createElement("h5", {
|
|
623
752
|
className: (0, _helpers__.withStyle)('my-2')
|
|
624
753
|
}, "Persoonlijke gegevens"), /*#__PURE__*/_react.default.createElement("div", {
|
|
625
754
|
className: (0, _helpers__.withStyle)('col-12 col-md-6 mb-2')
|
|
@@ -756,140 +885,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
756
885
|
form: "appointment",
|
|
757
886
|
label: "E-mailadres:",
|
|
758
887
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['email']
|
|
759
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
760
|
-
className: (0, _helpers__.withStyle)('company-search-container position-relative mt-2 mb-2')
|
|
761
|
-
}, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
762
|
-
placeholder: "Zoek leasemaatschappijen...",
|
|
763
|
-
value: customer.companyName,
|
|
764
|
-
name: "companyName",
|
|
765
|
-
onChange: value => {
|
|
766
|
-
// Update company name in state
|
|
767
|
-
dispatch({
|
|
768
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
769
|
-
payload: {
|
|
770
|
-
companyName: value
|
|
771
|
-
}
|
|
772
|
-
});
|
|
773
|
-
|
|
774
|
-
// Also update search term if value is different
|
|
775
|
-
if (value !== companySearchTerm) {
|
|
776
|
-
console.log('value', value);
|
|
777
|
-
setCompanySearchTerm(value);
|
|
778
|
-
// Force focused state when typing
|
|
779
|
-
setIsCompanyInputFocused(true);
|
|
780
|
-
}
|
|
781
|
-
},
|
|
782
|
-
onFocus: () => {
|
|
783
|
-
setIsCompanyInputFocused(true);
|
|
784
|
-
},
|
|
785
|
-
onBlur: () => {
|
|
786
|
-
// Delay hiding the dropdown to allow click events to complete
|
|
787
|
-
setTimeout(() => {
|
|
788
|
-
setIsCompanyInputFocused(false);
|
|
789
|
-
}, 300); // Increased delay for better chance of click completion
|
|
790
|
-
},
|
|
791
|
-
isRequired: false,
|
|
792
|
-
form: "quotation",
|
|
793
|
-
label: "Leasemaatschappij:",
|
|
794
|
-
errorMessage: errors === null || errors === void 0 ? void 0 : errors['companyName']
|
|
795
|
-
}), isCompanyInputFocused && companySearchTerm && companySearchTerm.length >= 3 && branchesByType && branchesByType.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
796
|
-
className: (0, _helpers__.withStyle)('dropdown-results position-absolute w-100 border rounded bg-white shadow'),
|
|
797
|
-
style: {
|
|
798
|
-
maxHeight: '200px',
|
|
799
|
-
overflowY: 'auto',
|
|
800
|
-
zIndex: 1050,
|
|
801
|
-
top: '100%',
|
|
802
|
-
left: 0,
|
|
803
|
-
right: 0
|
|
804
|
-
},
|
|
805
|
-
onMouseDown: e => {
|
|
806
|
-
e.preventDefault();
|
|
807
|
-
}
|
|
808
|
-
}, isLoadingBranchesByType && /*#__PURE__*/_react.default.createElement("div", {
|
|
809
|
-
className: (0, _helpers__.withStyle)('p-2 text-center')
|
|
810
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, "Zoeken...")), branchesByType.map(branch => /*#__PURE__*/_react.default.createElement("div", {
|
|
811
|
-
key: branch.entityId,
|
|
812
|
-
className: (0, _helpers__.withStyle)('dropdown-item p-2 border-bottom'),
|
|
813
|
-
style: {
|
|
814
|
-
cursor: 'pointer'
|
|
815
|
-
},
|
|
816
|
-
onMouseDown: e => {
|
|
817
|
-
e.preventDefault();
|
|
818
|
-
dispatch({
|
|
819
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
820
|
-
payload: {
|
|
821
|
-
companyName: branch.name
|
|
822
|
-
}
|
|
823
|
-
});
|
|
824
|
-
if (branch.postalCode) {
|
|
825
|
-
dispatch({
|
|
826
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
827
|
-
payload: {
|
|
828
|
-
zipCode: branch.postalCode
|
|
829
|
-
}
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
if (branch.street) {
|
|
833
|
-
dispatch({
|
|
834
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
835
|
-
payload: {
|
|
836
|
-
streetName: branch.street
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
if (branch.city) {
|
|
841
|
-
dispatch({
|
|
842
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
843
|
-
payload: {
|
|
844
|
-
city: branch.city
|
|
845
|
-
}
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
if (branch.street2) {
|
|
849
|
-
dispatch({
|
|
850
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
851
|
-
payload: {
|
|
852
|
-
houseNumber: branch.street2
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
if (branch.vatNumber) {
|
|
857
|
-
dispatch({
|
|
858
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
859
|
-
payload: {
|
|
860
|
-
vatNumber: branch.vatNumber
|
|
861
|
-
}
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
if (branch.kvkNumber) {
|
|
865
|
-
dispatch({
|
|
866
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
867
|
-
payload: {
|
|
868
|
-
kvkNumber: branch.kvkNumber
|
|
869
|
-
}
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
if (branch.huisnummerToevoeging) {
|
|
873
|
-
dispatch({
|
|
874
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
875
|
-
payload: {
|
|
876
|
-
houseNumberAddition: branch.huisnummerToevoeging
|
|
877
|
-
}
|
|
878
|
-
});
|
|
879
|
-
}
|
|
880
|
-
if (branch.country && branch.country.entityId) {
|
|
881
|
-
dispatch({
|
|
882
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
883
|
-
payload: {
|
|
884
|
-
countryId: branch.country.entityId
|
|
885
|
-
}
|
|
886
|
-
});
|
|
887
|
-
setRefreshKey(Date.now());
|
|
888
|
-
}
|
|
889
|
-
setCompanySearchTerm('');
|
|
890
|
-
setIsCompanyInputFocused(false);
|
|
891
|
-
}
|
|
892
|
-
}, branch.name)))), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
888
|
+
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
893
889
|
placeholder: "",
|
|
894
890
|
value: customer.phoneNumber,
|
|
895
891
|
name: "phoneNumber",
|