thm-p3-configurator 0.0.304 → 0.0.306
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/__api__/authenticatedProxyApi.js +3 -2
- package/dist/src/shared/__api__/queries.js +5 -3
- package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +161 -242
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +200 -441
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +147 -187
- package/package.json +1 -1
|
@@ -9,7 +9,6 @@ require("core-js/modules/esnext.iterator.for-each.js");
|
|
|
9
9
|
require("core-js/modules/esnext.iterator.map.js");
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
11
|
require("core-js/modules/es.weak-map.js");
|
|
12
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
13
12
|
Object.defineProperty(exports, "__esModule", {
|
|
14
13
|
value: true
|
|
15
14
|
});
|
|
@@ -18,6 +17,7 @@ require("core-js/modules/es.promise.js");
|
|
|
18
17
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
19
18
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
20
19
|
require("core-js/modules/esnext.iterator.find.js");
|
|
20
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
21
21
|
require("core-js/modules/esnext.iterator.map.js");
|
|
22
22
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
23
23
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -112,6 +112,23 @@ function _toPrimitive(t, r) {
|
|
|
112
112
|
}
|
|
113
113
|
return ("string" === r ? String : Number)(t);
|
|
114
114
|
}
|
|
115
|
+
// Empty customer state template
|
|
116
|
+
const getEmptyCustomerState = () => ({
|
|
117
|
+
firstName: '',
|
|
118
|
+
infix: '',
|
|
119
|
+
lastName: '',
|
|
120
|
+
email: '',
|
|
121
|
+
phoneNumber: '',
|
|
122
|
+
zipCode: '',
|
|
123
|
+
houseNumber: '',
|
|
124
|
+
houseNumberAddition: '',
|
|
125
|
+
streetName: '',
|
|
126
|
+
city: '',
|
|
127
|
+
companyName: '',
|
|
128
|
+
kvkNumber: '',
|
|
129
|
+
vatNumber: '',
|
|
130
|
+
countryId: ''
|
|
131
|
+
});
|
|
115
132
|
const customerDetailsFormSchema = (0, _yup.object)({
|
|
116
133
|
singleOrderOwnershipType: (0, _yup.string)().nullable(),
|
|
117
134
|
firstName: (0, _yup.string)().nullable(),
|
|
@@ -150,7 +167,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
150
167
|
form = 'customer-details'
|
|
151
168
|
} = _ref;
|
|
152
169
|
const [{
|
|
153
|
-
customer,
|
|
170
|
+
customer: contextCustomer,
|
|
154
171
|
channel,
|
|
155
172
|
selectedBranch,
|
|
156
173
|
appointment,
|
|
@@ -162,7 +179,6 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
162
179
|
afhalenInWinkel,
|
|
163
180
|
singleOrderFormulaCode
|
|
164
181
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
165
|
-
console;
|
|
166
182
|
const {
|
|
167
183
|
branchById
|
|
168
184
|
} = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
|
|
@@ -188,6 +204,97 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
188
204
|
const [isCompanyInputFocused, setIsCompanyInputFocused] = (0, _react.useState)(false);
|
|
189
205
|
const [addressLookupLoading, setAddressLookupLoading] = (0, _react.useState)(false);
|
|
190
206
|
const [addressLookupTimeoutId, setAddressLookupTimeoutId] = (0, _react.useState)(null);
|
|
207
|
+
|
|
208
|
+
// Track the original ownership type from context
|
|
209
|
+
const [originalOwnershipType] = (0, _react.useState)(() => (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) || _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty);
|
|
210
|
+
|
|
211
|
+
// Current active ownership type (local state for tab switching)
|
|
212
|
+
const [activeOwnershipType, setActiveOwnershipType] = (0, _react.useState)(originalOwnershipType);
|
|
213
|
+
|
|
214
|
+
// Separate customer state for each ownership type
|
|
215
|
+
const [customerDataPerType, setCustomerDataPerType] = (0, _react.useState)(() => {
|
|
216
|
+
const emptyState = getEmptyCustomerState();
|
|
217
|
+
const initialCustomerData = {
|
|
218
|
+
firstName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.firstName) || '',
|
|
219
|
+
infix: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.infix) || '',
|
|
220
|
+
lastName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.lastName) || '',
|
|
221
|
+
email: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.email) || '',
|
|
222
|
+
phoneNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.phoneNumber) || '',
|
|
223
|
+
zipCode: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.zipCode) || '',
|
|
224
|
+
houseNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.houseNumber) || '',
|
|
225
|
+
houseNumberAddition: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.houseNumberAddition) || '',
|
|
226
|
+
streetName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.streetName) || '',
|
|
227
|
+
city: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.city) || '',
|
|
228
|
+
companyName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.companyName) || '',
|
|
229
|
+
kvkNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.kvkNumber) || '',
|
|
230
|
+
vatNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.vatNumber) || '',
|
|
231
|
+
countryId: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.countryId) || ''
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// Only the original ownership type gets the initial data
|
|
235
|
+
return {
|
|
236
|
+
[_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty]: originalOwnershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty ? _objectSpread({}, initialCustomerData) : _objectSpread({}, emptyState),
|
|
237
|
+
[_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier]: originalOwnershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier ? _objectSpread({}, initialCustomerData) : _objectSpread({}, emptyState),
|
|
238
|
+
[_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk]: originalOwnershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk ? _objectSpread({}, initialCustomerData) : _objectSpread({}, emptyState)
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// Get customer data for the active ownership type
|
|
243
|
+
const customer = customerDataPerType[activeOwnershipType] || getEmptyCustomerState();
|
|
244
|
+
|
|
245
|
+
// Helper to update customer data for the active ownership type
|
|
246
|
+
const updateCustomerField = (0, _react.useCallback)((field, value) => {
|
|
247
|
+
setCustomerDataPerType(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
248
|
+
[activeOwnershipType]: _objectSpread(_objectSpread({}, prev[activeOwnershipType]), {}, {
|
|
249
|
+
[field]: value
|
|
250
|
+
})
|
|
251
|
+
}));
|
|
252
|
+
}, [activeOwnershipType]);
|
|
253
|
+
|
|
254
|
+
// Sync active ownership type to context when it changes
|
|
255
|
+
(0, _react.useEffect)(() => {
|
|
256
|
+
if (activeOwnershipType !== (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType)) {
|
|
257
|
+
dispatch({
|
|
258
|
+
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE,
|
|
259
|
+
payload: {
|
|
260
|
+
singleOrderOwnershipType: activeOwnershipType
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}, [activeOwnershipType, vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType, dispatch]);
|
|
265
|
+
|
|
266
|
+
// Sync customer data to context when it changes (for the active tab)
|
|
267
|
+
(0, _react.useEffect)(() => {
|
|
268
|
+
const currentData = customerDataPerType[activeOwnershipType];
|
|
269
|
+
if (!currentData) return;
|
|
270
|
+
const actionMap = {
|
|
271
|
+
firstName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
|
|
272
|
+
infix: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
273
|
+
lastName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
274
|
+
email: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
275
|
+
phoneNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
276
|
+
zipCode: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
277
|
+
houseNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
278
|
+
houseNumberAddition: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
279
|
+
streetName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
280
|
+
city: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
281
|
+
companyName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
282
|
+
kvkNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
283
|
+
vatNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
284
|
+
countryId: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID
|
|
285
|
+
};
|
|
286
|
+
Object.entries(currentData).forEach(_ref2 => {
|
|
287
|
+
let [field, value] = _ref2;
|
|
288
|
+
if (actionMap[field]) {
|
|
289
|
+
dispatch({
|
|
290
|
+
type: actionMap[field],
|
|
291
|
+
payload: {
|
|
292
|
+
[field]: value
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}, [activeOwnershipType, customerDataPerType, dispatch]);
|
|
191
298
|
const addressLookupService = new _AddressLookupService.default();
|
|
192
299
|
const branchType = branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut = branchTypes.byId[authSession === null || authSession === void 0 || (_authSession$branch = authSession.branch) === null || _authSession$branch === void 0 || (_authSession$branch = _authSession$branch.organisatietype) === null || _authSession$branch === void 0 ? void 0 : _authSession$branch[0]]) === null || _branchTypes$byId$aut === void 0 ? void 0 : _branchTypes$byId$aut.title;
|
|
193
300
|
const {
|
|
@@ -199,24 +306,20 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
199
306
|
isLoadingBranchesByType
|
|
200
307
|
} = (0, _queries.useBranchesByType)({
|
|
201
308
|
isTmg,
|
|
309
|
+
isTowCenterBranch,
|
|
202
310
|
searchTerm: companySearchTerm,
|
|
203
311
|
formula,
|
|
204
|
-
ownershipType:
|
|
312
|
+
ownershipType: activeOwnershipType,
|
|
205
313
|
organisationType: branchType
|
|
206
314
|
});
|
|
207
315
|
(0, _react.useEffect)(() => {
|
|
208
316
|
if (!(customer !== null && customer !== void 0 && customer.countryId) && countryOptions !== null && countryOptions !== void 0 && countryOptions.length) {
|
|
209
317
|
const defaultCountry = countryOptions.find(option => option.label === 'NEDERLAND');
|
|
210
318
|
if (defaultCountry) {
|
|
211
|
-
|
|
212
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
213
|
-
payload: {
|
|
214
|
-
countryId: defaultCountry.value
|
|
215
|
-
}
|
|
216
|
-
});
|
|
319
|
+
updateCustomerField('countryId', defaultCountry.value);
|
|
217
320
|
}
|
|
218
321
|
}
|
|
219
|
-
}, [customer === null || customer === void 0 ? void 0 : customer.countryId, countryOptions,
|
|
322
|
+
}, [customer === null || customer === void 0 ? void 0 : customer.countryId, countryOptions, updateCustomerField]);
|
|
220
323
|
|
|
221
324
|
/**
|
|
222
325
|
* @description Auto-set Partner Portal channel for non-TMG users
|
|
@@ -261,13 +364,8 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
261
364
|
}
|
|
262
365
|
});
|
|
263
366
|
// Set default ownership type to Particulier if not already set
|
|
264
|
-
if (!
|
|
265
|
-
|
|
266
|
-
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE,
|
|
267
|
-
payload: {
|
|
268
|
-
singleOrderOwnershipType: _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier
|
|
269
|
-
}
|
|
270
|
-
});
|
|
367
|
+
if (!activeOwnershipType || activeOwnershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty) {
|
|
368
|
+
setActiveOwnershipType(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier);
|
|
271
369
|
}
|
|
272
370
|
} else {
|
|
273
371
|
dispatch({
|
|
@@ -283,7 +381,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
283
381
|
}
|
|
284
382
|
});
|
|
285
383
|
}
|
|
286
|
-
}, [isTmg, isTowCenterBranch, dispatch,
|
|
384
|
+
}, [isTmg, isTowCenterBranch, dispatch, activeOwnershipType]);
|
|
287
385
|
const initialChannel = (0, _react.useMemo)(() => {
|
|
288
386
|
if (!(channel !== null && channel !== void 0 && channel.channelId) || !(marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length)) return null;
|
|
289
387
|
const selectedChannel = marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId));
|
|
@@ -294,77 +392,27 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
294
392
|
}, [channel, marketingChannels]);
|
|
295
393
|
const handleAutofillButtonClicked = () => {
|
|
296
394
|
var _branchById$kvkNumber, _branchById$vatNumber, _branchById$country;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
});
|
|
303
|
-
dispatch({
|
|
304
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
305
|
-
payload: {
|
|
306
|
-
zipCode: branchById === null || branchById === void 0 ? void 0 : branchById.postalCode
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
dispatch({
|
|
310
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
311
|
-
payload: {
|
|
312
|
-
streetName: branchById === null || branchById === void 0 ? void 0 : branchById.street
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
dispatch({
|
|
316
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
317
|
-
payload: {
|
|
318
|
-
city: branchById === null || branchById === void 0 ? void 0 : branchById.city
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
dispatch({
|
|
322
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
323
|
-
payload: {
|
|
324
|
-
houseNumber: branchById === null || branchById === void 0 ? void 0 : branchById.street2
|
|
325
|
-
}
|
|
326
|
-
});
|
|
395
|
+
updateCustomerField('companyName', (branchById === null || branchById === void 0 ? void 0 : branchById.name) || '');
|
|
396
|
+
updateCustomerField('zipCode', (branchById === null || branchById === void 0 ? void 0 : branchById.postalCode) || '');
|
|
397
|
+
updateCustomerField('streetName', (branchById === null || branchById === void 0 ? void 0 : branchById.street) || '');
|
|
398
|
+
updateCustomerField('city', (branchById === null || branchById === void 0 ? void 0 : branchById.city) || '');
|
|
399
|
+
updateCustomerField('houseNumber', (branchById === null || branchById === void 0 ? void 0 : branchById.street2) || '');
|
|
327
400
|
const kvkNumber = (_branchById$kvkNumber = branchById === null || branchById === void 0 ? void 0 : branchById.kvkNumber) !== null && _branchById$kvkNumber !== void 0 ? _branchById$kvkNumber : branchById === null || branchById === void 0 ? void 0 : branchById.kvkNummer;
|
|
328
401
|
if (kvkNumber) {
|
|
329
|
-
|
|
330
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
331
|
-
payload: {
|
|
332
|
-
kvkNumber
|
|
333
|
-
}
|
|
334
|
-
});
|
|
402
|
+
updateCustomerField('kvkNumber', kvkNumber);
|
|
335
403
|
}
|
|
336
404
|
const vatNumber = (_branchById$vatNumber = branchById === null || branchById === void 0 ? void 0 : branchById.vatNumber) !== null && _branchById$vatNumber !== void 0 ? _branchById$vatNumber : branchById === null || branchById === void 0 ? void 0 : branchById.btwNummer;
|
|
337
405
|
if (vatNumber) {
|
|
338
|
-
|
|
339
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
340
|
-
payload: {
|
|
341
|
-
vatNumber
|
|
342
|
-
}
|
|
343
|
-
});
|
|
406
|
+
updateCustomerField('vatNumber', vatNumber);
|
|
344
407
|
}
|
|
345
408
|
if (branchById !== null && branchById !== void 0 && branchById.email) {
|
|
346
|
-
|
|
347
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
348
|
-
payload: {
|
|
349
|
-
email: branchById.email
|
|
350
|
-
}
|
|
351
|
-
});
|
|
409
|
+
updateCustomerField('email', branchById.email);
|
|
352
410
|
}
|
|
353
411
|
if (branchById !== null && branchById !== void 0 && branchById.phone) {
|
|
354
|
-
|
|
355
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
356
|
-
payload: {
|
|
357
|
-
phoneNumber: branchById.phone
|
|
358
|
-
}
|
|
359
|
-
});
|
|
412
|
+
updateCustomerField('phoneNumber', branchById.phone);
|
|
360
413
|
}
|
|
361
414
|
if (branchById !== null && branchById !== void 0 && (_branchById$country = branchById.country) !== null && _branchById$country !== void 0 && _branchById$country.entityId) {
|
|
362
|
-
|
|
363
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
364
|
-
payload: {
|
|
365
|
-
countryId: branchById.country.entityId
|
|
366
|
-
}
|
|
367
|
-
});
|
|
415
|
+
updateCustomerField('countryId', branchById.country.entityId);
|
|
368
416
|
}
|
|
369
417
|
};
|
|
370
418
|
|
|
@@ -378,18 +426,8 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
378
426
|
const addressInfo = await addressLookupService.lookup(postcode, houseNumber);
|
|
379
427
|
if (addressInfo && addressInfo.street && addressInfo.city) {
|
|
380
428
|
// Auto-fill street and city fields
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
payload: {
|
|
384
|
-
streetName: addressInfo.street
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
dispatch({
|
|
388
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
389
|
-
payload: {
|
|
390
|
-
city: addressInfo.city
|
|
391
|
-
}
|
|
392
|
-
});
|
|
429
|
+
updateCustomerField('streetName', addressInfo.street);
|
|
430
|
+
updateCustomerField('city', addressInfo.city);
|
|
393
431
|
}
|
|
394
432
|
} catch (error) {
|
|
395
433
|
console.error('Address lookup failed:', error);
|
|
@@ -463,7 +501,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
463
501
|
validationSchema = validationSchema.shape(requiredFields);
|
|
464
502
|
}
|
|
465
503
|
await validationSchema.validate(_objectSpread(_objectSpread({}, customer), {}, {
|
|
466
|
-
singleOrderOwnershipType:
|
|
504
|
+
singleOrderOwnershipType: activeOwnershipType || '',
|
|
467
505
|
channelType: (channel === null || channel === void 0 ? void 0 : channel.channelType) || '',
|
|
468
506
|
channelId: (channel === null || channel === void 0 ? void 0 : channel.channelId) || ''
|
|
469
507
|
}), {
|
|
@@ -513,12 +551,12 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
513
551
|
placeholder: "Maak een keuze",
|
|
514
552
|
errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelType']) || (errors === null || errors === void 0 ? void 0 : errors['channelId']),
|
|
515
553
|
initialValue: initialChannel,
|
|
516
|
-
onChange:
|
|
554
|
+
onChange: _ref3 => {
|
|
517
555
|
var _value$kanaalType;
|
|
518
556
|
let {
|
|
519
557
|
label,
|
|
520
558
|
value
|
|
521
|
-
} =
|
|
559
|
+
} = _ref3;
|
|
522
560
|
return dispatch({
|
|
523
561
|
type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
|
|
524
562
|
payload: {
|
|
@@ -532,14 +570,10 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
532
570
|
})), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
|
|
533
571
|
name: "singleOrderOwnershipType",
|
|
534
572
|
label: "Type:",
|
|
535
|
-
initialValue:
|
|
573
|
+
initialValue: activeOwnershipType || (isTmg || isTowCenterBranch ? _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier : _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty),
|
|
536
574
|
onChange: val => {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
payload: {
|
|
540
|
-
singleOrderOwnershipType: val
|
|
541
|
-
}
|
|
542
|
-
});
|
|
575
|
+
// Switch to the new ownership type - each type maintains its own separate state
|
|
576
|
+
setActiveOwnershipType(val);
|
|
543
577
|
},
|
|
544
578
|
options: isTmg || isTowCenterBranch ? Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE).filter(option => option !== _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty) : Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE),
|
|
545
579
|
isRequired: isTmg || isTowCenterBranch,
|
|
@@ -578,12 +612,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
578
612
|
placeholder: "",
|
|
579
613
|
initialValue: customer.firstName,
|
|
580
614
|
name: "firstName",
|
|
581
|
-
onChange: value =>
|
|
582
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
|
|
583
|
-
payload: {
|
|
584
|
-
firstName: value
|
|
585
|
-
}
|
|
586
|
-
}),
|
|
615
|
+
onChange: value => updateCustomerField('firstName', value),
|
|
587
616
|
isRequired: webshop || anderAfleveradres,
|
|
588
617
|
form: form,
|
|
589
618
|
label: "Voornaam:",
|
|
@@ -592,12 +621,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
592
621
|
placeholder: "",
|
|
593
622
|
initialValue: customer.infix,
|
|
594
623
|
name: "infix",
|
|
595
|
-
onChange: value =>
|
|
596
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
597
|
-
payload: {
|
|
598
|
-
infix: value
|
|
599
|
-
}
|
|
600
|
-
}),
|
|
624
|
+
onChange: value => updateCustomerField('infix', value),
|
|
601
625
|
isRequired: false,
|
|
602
626
|
form: form,
|
|
603
627
|
label: "Tussenvoegsel:",
|
|
@@ -606,12 +630,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
606
630
|
placeholder: "",
|
|
607
631
|
initialValue: customer.lastName,
|
|
608
632
|
name: "lastName",
|
|
609
|
-
onChange: value =>
|
|
610
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
611
|
-
payload: {
|
|
612
|
-
lastName: value
|
|
613
|
-
}
|
|
614
|
-
}),
|
|
633
|
+
onChange: value => updateCustomerField('lastName', value),
|
|
615
634
|
isRequired: webshop || anderAfleveradres,
|
|
616
635
|
form: form,
|
|
617
636
|
label: "Achternaam:",
|
|
@@ -620,12 +639,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
620
639
|
placeholder: "",
|
|
621
640
|
initialValue: customer.email,
|
|
622
641
|
name: "email",
|
|
623
|
-
onChange: value =>
|
|
624
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
625
|
-
payload: {
|
|
626
|
-
email: value
|
|
627
|
-
}
|
|
628
|
-
}),
|
|
642
|
+
onChange: value => updateCustomerField('email', value),
|
|
629
643
|
isRequired: webshop,
|
|
630
644
|
form: form,
|
|
631
645
|
label: "E-mailadres:",
|
|
@@ -634,19 +648,14 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
634
648
|
placeholder: "",
|
|
635
649
|
initialValue: customer.phoneNumber,
|
|
636
650
|
name: "phoneNumber",
|
|
637
|
-
onChange: value =>
|
|
638
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
639
|
-
payload: {
|
|
640
|
-
phoneNumber: value
|
|
641
|
-
}
|
|
642
|
-
}),
|
|
651
|
+
onChange: value => updateCustomerField('phoneNumber', value),
|
|
643
652
|
form: form,
|
|
644
653
|
isRequired: webshop,
|
|
645
654
|
label: "Telefoonnummer:",
|
|
646
655
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber']
|
|
647
656
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
648
657
|
className: (0, _helpers__.withStyle)('col-12 mt-2 col-md-6')
|
|
649
|
-
},
|
|
658
|
+
}, activeOwnershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h6", {
|
|
650
659
|
className: (0, _helpers__.withStyle)('modal-title mb-2')
|
|
651
660
|
}, "Gegevens bedrijf"), /*#__PURE__*/_react.default.createElement("div", {
|
|
652
661
|
className: (0, _helpers__.withStyle)('company-search-container position-relative mb-3')
|
|
@@ -664,12 +673,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
664
673
|
initialValue: customer.companyName,
|
|
665
674
|
name: "companyName",
|
|
666
675
|
onChange: value => {
|
|
667
|
-
|
|
668
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
669
|
-
payload: {
|
|
670
|
-
companyName: value
|
|
671
|
-
}
|
|
672
|
-
});
|
|
676
|
+
updateCustomerField('companyName', value);
|
|
673
677
|
if (value !== companySearchTerm) {
|
|
674
678
|
setCompanySearchTerm(value);
|
|
675
679
|
setIsCompanyInputFocused(true);
|
|
@@ -711,77 +715,32 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
711
715
|
onMouseDown: e => {
|
|
712
716
|
var _branch$vatNumber, _branch$kvkNumber;
|
|
713
717
|
e.preventDefault();
|
|
714
|
-
|
|
715
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
716
|
-
payload: {
|
|
717
|
-
companyName: branch.name
|
|
718
|
-
}
|
|
719
|
-
});
|
|
718
|
+
updateCustomerField('companyName', branch.name);
|
|
720
719
|
if (branch.postalCode) {
|
|
721
|
-
|
|
722
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
723
|
-
payload: {
|
|
724
|
-
zipCode: branch.postalCode
|
|
725
|
-
}
|
|
726
|
-
});
|
|
720
|
+
updateCustomerField('zipCode', branch.postalCode);
|
|
727
721
|
}
|
|
728
722
|
if (branch.street) {
|
|
729
|
-
|
|
730
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
731
|
-
payload: {
|
|
732
|
-
streetName: branch.street
|
|
733
|
-
}
|
|
734
|
-
});
|
|
723
|
+
updateCustomerField('streetName', branch.street);
|
|
735
724
|
}
|
|
736
725
|
if (branch.city) {
|
|
737
|
-
|
|
738
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
739
|
-
payload: {
|
|
740
|
-
city: branch.city
|
|
741
|
-
}
|
|
742
|
-
});
|
|
726
|
+
updateCustomerField('city', branch.city);
|
|
743
727
|
}
|
|
744
728
|
if (branch.street2) {
|
|
745
|
-
|
|
746
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
747
|
-
payload: {
|
|
748
|
-
houseNumber: branch.street2
|
|
749
|
-
}
|
|
750
|
-
});
|
|
729
|
+
updateCustomerField('houseNumber', branch.street2);
|
|
751
730
|
}
|
|
752
731
|
const vatNumber = (_branch$vatNumber = branch.vatNumber) !== null && _branch$vatNumber !== void 0 ? _branch$vatNumber : branch.btwNummer;
|
|
753
732
|
if (vatNumber) {
|
|
754
|
-
|
|
755
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
756
|
-
payload: {
|
|
757
|
-
vatNumber
|
|
758
|
-
}
|
|
759
|
-
});
|
|
733
|
+
updateCustomerField('vatNumber', vatNumber);
|
|
760
734
|
}
|
|
761
735
|
const kvkNumber = (_branch$kvkNumber = branch.kvkNumber) !== null && _branch$kvkNumber !== void 0 ? _branch$kvkNumber : branch.kvkNummer;
|
|
762
736
|
if (kvkNumber) {
|
|
763
|
-
|
|
764
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
765
|
-
payload: {
|
|
766
|
-
kvkNumber
|
|
767
|
-
}
|
|
768
|
-
});
|
|
737
|
+
updateCustomerField('kvkNumber', kvkNumber);
|
|
769
738
|
}
|
|
770
739
|
if (branch.huisnummerToevoeging) {
|
|
771
|
-
|
|
772
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
773
|
-
payload: {
|
|
774
|
-
houseNumberAddition: branch.huisnummerToevoeging
|
|
775
|
-
}
|
|
776
|
-
});
|
|
740
|
+
updateCustomerField('houseNumberAddition', branch.huisnummerToevoeging);
|
|
777
741
|
}
|
|
778
742
|
if (branch.country && branch.country.entityId) {
|
|
779
|
-
|
|
780
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
781
|
-
payload: {
|
|
782
|
-
countryId: branch.country.entityId
|
|
783
|
-
}
|
|
784
|
-
});
|
|
743
|
+
updateCustomerField('countryId', branch.country.entityId);
|
|
785
744
|
}
|
|
786
745
|
setCompanySearchTerm('');
|
|
787
746
|
setIsCompanyInputFocused(false);
|
|
@@ -790,12 +749,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
790
749
|
placeholder: "",
|
|
791
750
|
initialValue: customer.kvkNumber,
|
|
792
751
|
name: "kvkNumber",
|
|
793
|
-
onChange: value =>
|
|
794
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
795
|
-
payload: {
|
|
796
|
-
kvkNumber: value
|
|
797
|
-
}
|
|
798
|
-
}),
|
|
752
|
+
onChange: value => updateCustomerField('kvkNumber', value),
|
|
799
753
|
isRequired: false,
|
|
800
754
|
form: form,
|
|
801
755
|
label: "KVK-nummer:",
|
|
@@ -804,12 +758,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
804
758
|
placeholder: "",
|
|
805
759
|
initialValue: customer.vatNumber,
|
|
806
760
|
name: "vatNumber",
|
|
807
|
-
onChange: value =>
|
|
808
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
809
|
-
payload: {
|
|
810
|
-
vatNumber: value
|
|
811
|
-
}
|
|
812
|
-
}),
|
|
761
|
+
onChange: value => updateCustomerField('vatNumber', value),
|
|
813
762
|
isRequired: false,
|
|
814
763
|
form: form,
|
|
815
764
|
label: "BTW-nummer:",
|
|
@@ -819,12 +768,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
819
768
|
initialValue: customer.zipCode,
|
|
820
769
|
name: "zipCode",
|
|
821
770
|
onChange: value => {
|
|
822
|
-
|
|
823
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
824
|
-
payload: {
|
|
825
|
-
zipCode: value
|
|
826
|
-
}
|
|
827
|
-
});
|
|
771
|
+
updateCustomerField('zipCode', value);
|
|
828
772
|
// Trigger address lookup if house number is also available
|
|
829
773
|
if (customer.houseNumber) {
|
|
830
774
|
handleAddressLookup(value, customer.houseNumber);
|
|
@@ -839,12 +783,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
839
783
|
initialValue: customer.houseNumber,
|
|
840
784
|
name: "houseNumber",
|
|
841
785
|
onChange: value => {
|
|
842
|
-
|
|
843
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
844
|
-
payload: {
|
|
845
|
-
houseNumber: value
|
|
846
|
-
}
|
|
847
|
-
});
|
|
786
|
+
updateCustomerField('houseNumber', value);
|
|
848
787
|
// Trigger address lookup if postcode is also available
|
|
849
788
|
if (customer.zipCode) {
|
|
850
789
|
handleAddressLookup(customer.zipCode, value);
|
|
@@ -858,12 +797,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
858
797
|
placeholder: "",
|
|
859
798
|
initialValue: customer.houseNumberAddition,
|
|
860
799
|
name: "houseNumberAddition",
|
|
861
|
-
onChange: value =>
|
|
862
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
863
|
-
payload: {
|
|
864
|
-
houseNumberAddition: value
|
|
865
|
-
}
|
|
866
|
-
}),
|
|
800
|
+
onChange: value => updateCustomerField('houseNumberAddition', value),
|
|
867
801
|
isRequired: false,
|
|
868
802
|
form: form,
|
|
869
803
|
label: "Huisnummer toevoeging:",
|
|
@@ -872,12 +806,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
872
806
|
placeholder: addressLookupLoading ? 'Adres wordt opgezocht...' : '',
|
|
873
807
|
initialValue: customer.streetName,
|
|
874
808
|
name: "streetName",
|
|
875
|
-
onChange: value =>
|
|
876
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
877
|
-
payload: {
|
|
878
|
-
streetName: value
|
|
879
|
-
}
|
|
880
|
-
}),
|
|
809
|
+
onChange: value => updateCustomerField('streetName', value),
|
|
881
810
|
isRequired: anderAfleveradres,
|
|
882
811
|
form: form,
|
|
883
812
|
label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -886,12 +815,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
886
815
|
placeholder: addressLookupLoading ? 'Stad wordt opgezocht...' : '',
|
|
887
816
|
initialValue: customer.city,
|
|
888
817
|
name: "city",
|
|
889
|
-
onChange: value =>
|
|
890
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
891
|
-
payload: {
|
|
892
|
-
city: value
|
|
893
|
-
}
|
|
894
|
-
}),
|
|
818
|
+
onChange: value => updateCustomerField('city', value),
|
|
895
819
|
isRequired: anderAfleveradres,
|
|
896
820
|
form: form,
|
|
897
821
|
label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -906,16 +830,11 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
906
830
|
placeholder: "Selecteer een land",
|
|
907
831
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
|
|
908
832
|
initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
|
|
909
|
-
onChange:
|
|
833
|
+
onChange: _ref4 => {
|
|
910
834
|
let {
|
|
911
835
|
value
|
|
912
|
-
} =
|
|
913
|
-
return
|
|
914
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
915
|
-
payload: {
|
|
916
|
-
countryId: value
|
|
917
|
-
}
|
|
918
|
-
});
|
|
836
|
+
} = _ref4;
|
|
837
|
+
return updateCustomerField('countryId', value);
|
|
919
838
|
}
|
|
920
839
|
}))))), !webshop && /*#__PURE__*/_react.default.createElement("div", {
|
|
921
840
|
className: (0, _helpers__.withStyle)('col-12')
|