thm-p3-configurator 0.0.305 → 0.0.307
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__/internal/InternalCustomerDetailsForm.js +160 -242
- package/dist/src/shared/__constants__/cartTable.js +5 -2
- package/dist/src/shared/__containers__/ProductsCartOverview.js +42 -3
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +193 -436
- package/dist/src/shared/__containers__/internal/InternalExtraPriceForm.js +141 -0
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +143 -186
- package/dist/src/shared/__context__/OrderSessionContext.js +24 -0
- package/dist/src/shared/__helpers__/cartTable.js +46 -7
- package/package.json +1 -1
|
@@ -171,6 +171,23 @@ const internalAppointmentFormSchema = (0, _yup.object)({
|
|
|
171
171
|
/**
|
|
172
172
|
* TODO: Split this component - file is too long at the moment.
|
|
173
173
|
*/
|
|
174
|
+
// Empty customer state template
|
|
175
|
+
const getEmptyCustomerState = () => ({
|
|
176
|
+
firstName: '',
|
|
177
|
+
infix: '',
|
|
178
|
+
lastName: '',
|
|
179
|
+
email: '',
|
|
180
|
+
phoneNumber: '',
|
|
181
|
+
zipCode: '',
|
|
182
|
+
houseNumber: '',
|
|
183
|
+
houseNumberAddition: '',
|
|
184
|
+
streetName: '',
|
|
185
|
+
city: '',
|
|
186
|
+
companyName: '',
|
|
187
|
+
kvkNumber: '',
|
|
188
|
+
vatNumber: '',
|
|
189
|
+
countryId: ''
|
|
190
|
+
});
|
|
174
191
|
const InternalAppointmentForm = _ref => {
|
|
175
192
|
var _branchTypes$byId$aut, _authSession$branch, _marketingChannels$fi;
|
|
176
193
|
let {
|
|
@@ -188,7 +205,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
188
205
|
const [addressLookupTimeoutId, setAddressLookupTimeoutId] = (0, _react.useState)(null);
|
|
189
206
|
const {
|
|
190
207
|
customerAgreed,
|
|
191
|
-
customer,
|
|
208
|
+
customer: contextCustomer,
|
|
192
209
|
licensePlate,
|
|
193
210
|
licensePlateBrandModel,
|
|
194
211
|
model,
|
|
@@ -221,6 +238,97 @@ const InternalAppointmentForm = _ref => {
|
|
|
221
238
|
hasGoedkeuringsnummerActivity,
|
|
222
239
|
isTowCenterBranch
|
|
223
240
|
} = order;
|
|
241
|
+
|
|
242
|
+
// Track the original ownership type from context
|
|
243
|
+
const [originalOwnershipType] = (0, _react.useState)(() => (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) || _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier);
|
|
244
|
+
|
|
245
|
+
// Current active ownership type (local state for tab switching)
|
|
246
|
+
const [activeOwnershipType, setActiveOwnershipType] = (0, _react.useState)(originalOwnershipType);
|
|
247
|
+
|
|
248
|
+
// Separate customer state for each ownership type
|
|
249
|
+
const [customerDataPerType, setCustomerDataPerType] = (0, _react.useState)(() => {
|
|
250
|
+
const emptyState = getEmptyCustomerState();
|
|
251
|
+
const initialCustomerData = {
|
|
252
|
+
firstName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.firstName) || '',
|
|
253
|
+
infix: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.infix) || '',
|
|
254
|
+
lastName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.lastName) || '',
|
|
255
|
+
email: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.email) || '',
|
|
256
|
+
phoneNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.phoneNumber) || '',
|
|
257
|
+
zipCode: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.zipCode) || '',
|
|
258
|
+
houseNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.houseNumber) || '',
|
|
259
|
+
houseNumberAddition: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.houseNumberAddition) || '',
|
|
260
|
+
streetName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.streetName) || '',
|
|
261
|
+
city: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.city) || '',
|
|
262
|
+
companyName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.companyName) || '',
|
|
263
|
+
kvkNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.kvkNumber) || '',
|
|
264
|
+
vatNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.vatNumber) || '',
|
|
265
|
+
countryId: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.countryId) || ''
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// Only the original ownership type gets the initial data
|
|
269
|
+
return {
|
|
270
|
+
[_constants__.VEHICLE_OWNERSHIP_TYPE.Particulier]: originalOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier ? _objectSpread({}, initialCustomerData) : _objectSpread({}, emptyState),
|
|
271
|
+
[_constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk]: originalOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? _objectSpread({}, initialCustomerData) : _objectSpread({}, emptyState),
|
|
272
|
+
[_constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij]: originalOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? _objectSpread({}, initialCustomerData) : _objectSpread({}, emptyState)
|
|
273
|
+
};
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
// Get customer data for the active ownership type
|
|
277
|
+
const customer = customerDataPerType[activeOwnershipType];
|
|
278
|
+
|
|
279
|
+
// Helper to update customer data for the active ownership type
|
|
280
|
+
const updateCustomerField = (0, _react.useCallback)((field, value) => {
|
|
281
|
+
setCustomerDataPerType(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
282
|
+
[activeOwnershipType]: _objectSpread(_objectSpread({}, prev[activeOwnershipType]), {}, {
|
|
283
|
+
[field]: value
|
|
284
|
+
})
|
|
285
|
+
}));
|
|
286
|
+
}, [activeOwnershipType]);
|
|
287
|
+
|
|
288
|
+
// Sync active ownership type to context when it changes
|
|
289
|
+
(0, _react.useEffect)(() => {
|
|
290
|
+
if (activeOwnershipType !== (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType)) {
|
|
291
|
+
dispatch({
|
|
292
|
+
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_OWNERSHIP_TYPE,
|
|
293
|
+
payload: {
|
|
294
|
+
ownershipType: activeOwnershipType
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}, [activeOwnershipType, vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType, dispatch]);
|
|
299
|
+
|
|
300
|
+
// Sync customer data to context when it changes (for the active tab)
|
|
301
|
+
(0, _react.useEffect)(() => {
|
|
302
|
+
const currentData = customerDataPerType[activeOwnershipType];
|
|
303
|
+
// Batch update context with current tab's customer data
|
|
304
|
+
Object.entries(currentData).forEach(_ref2 => {
|
|
305
|
+
let [field, value] = _ref2;
|
|
306
|
+
const actionMap = {
|
|
307
|
+
firstName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
|
|
308
|
+
infix: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
309
|
+
lastName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
310
|
+
email: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
311
|
+
phoneNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
312
|
+
zipCode: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
313
|
+
houseNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
314
|
+
houseNumberAddition: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
315
|
+
streetName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
316
|
+
city: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
317
|
+
companyName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
318
|
+
kvkNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
319
|
+
vatNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
320
|
+
countryId: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID
|
|
321
|
+
};
|
|
322
|
+
if (actionMap[field]) {
|
|
323
|
+
dispatch({
|
|
324
|
+
type: actionMap[field],
|
|
325
|
+
payload: {
|
|
326
|
+
[field]: value
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}, [activeOwnershipType, customerDataPerType, dispatch]);
|
|
224
332
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
225
333
|
const [_licensePlate, _setLicensePlate] = (0, _react.useState)();
|
|
226
334
|
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
@@ -292,7 +400,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
292
400
|
}
|
|
293
401
|
}
|
|
294
402
|
}, [customer === null || customer === void 0 ? void 0 : customer.countryId, countryOptions, dispatch]);
|
|
295
|
-
const isBusinessOwnership =
|
|
403
|
+
const isBusinessOwnership = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk;
|
|
296
404
|
const isNetherlandsSelected = (0, _react.useMemo)(() => {
|
|
297
405
|
if (!(selectedCountry !== null && selectedCountry !== void 0 && selectedCountry.label)) return false;
|
|
298
406
|
return selectedCountry.label.toUpperCase() === 'NEDERLAND';
|
|
@@ -340,7 +448,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
340
448
|
const handleSubmit = async function handleSubmit() {
|
|
341
449
|
let appointmentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _constants__.DOSSIER_TYPES.PlannedAppointment;
|
|
342
450
|
try {
|
|
343
|
-
var _customer$kvkNumber, _customer$vatNumber, _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _customer$note, _customer$zipCode, _customer$companyName, _customer$kvkNumber2, _customer$vatNumber2,
|
|
451
|
+
var _customer$kvkNumber, _customer$vatNumber, _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _customer$note, _customer$zipCode, _customer$companyName, _customer$kvkNumber2, _customer$vatNumber2, _ref3;
|
|
344
452
|
setErrors({});
|
|
345
453
|
if (!model) {
|
|
346
454
|
// Note: this does not throw on error.
|
|
@@ -354,7 +462,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
354
462
|
}
|
|
355
463
|
|
|
356
464
|
// Validate lease number for lease company vehicles
|
|
357
|
-
if (
|
|
465
|
+
if (activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij) {
|
|
358
466
|
if ((!(vehicle !== null && vehicle !== void 0 && vehicle.leaseNumber) || (vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber) === '') && !(vehicle !== null && vehicle !== void 0 && vehicle.leaseNumberUnknown)) {
|
|
359
467
|
setErrors(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
360
468
|
leaseNumber: _constants__.FORM_ERROR_MESSAGES.leaseNumber || 'Goedkeuringsnummer is verplicht of geef aan dat het onbekend is'
|
|
@@ -382,7 +490,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
382
490
|
|
|
383
491
|
// Note: this throws on error.
|
|
384
492
|
internalAppointmentFormSchema.validateSync(_objectSpread(_objectSpread(_objectSpread({}, vehicle), customer), {}, {
|
|
385
|
-
ownershipType:
|
|
493
|
+
ownershipType: activeOwnershipType,
|
|
386
494
|
// Note: add string fallback here to prevent null check in Yup throwing weird errors
|
|
387
495
|
// However: dont submit empty strings to the API because the API doesnt accept empty strings in place of `undefined`
|
|
388
496
|
// Rule in custom API: a field can be optional (can be undefined), but once you fill it in with a value, that value has to be truthy.
|
|
@@ -422,7 +530,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
422
530
|
appointment,
|
|
423
531
|
appointmentType,
|
|
424
532
|
channel,
|
|
425
|
-
licensePlate: (
|
|
533
|
+
licensePlate: (_ref3 = licensePlate || _licensePlate) === null || _ref3 === void 0 ? void 0 : _ref3.replace(/-/g, ''),
|
|
426
534
|
model,
|
|
427
535
|
chassisNumber,
|
|
428
536
|
priceCalculationDate,
|
|
@@ -473,7 +581,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
473
581
|
isTowCenterBranch,
|
|
474
582
|
searchTerm: companySearchTerm,
|
|
475
583
|
formula,
|
|
476
|
-
ownershipType:
|
|
584
|
+
ownershipType: activeOwnershipType,
|
|
477
585
|
organisationType: branchType
|
|
478
586
|
});
|
|
479
587
|
|
|
@@ -482,66 +590,21 @@ const InternalAppointmentForm = _ref => {
|
|
|
482
590
|
*/
|
|
483
591
|
const handleAutofillButtonClicked = () => {
|
|
484
592
|
var _branchById$kvkNumber, _branchById$vatNumber;
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
493
|
-
payload: {
|
|
494
|
-
email: branchById === null || branchById === void 0 ? void 0 : branchById.email
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
dispatch({
|
|
498
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
499
|
-
payload: {
|
|
500
|
-
phoneNumber: branchById === null || branchById === void 0 ? void 0 : branchById.phone
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
dispatch({
|
|
504
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
505
|
-
payload: {
|
|
506
|
-
zipCode: branchById === null || branchById === void 0 ? void 0 : branchById.postalCode
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
dispatch({
|
|
510
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
511
|
-
payload: {
|
|
512
|
-
streetName: branchById === null || branchById === void 0 ? void 0 : branchById.street
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
dispatch({
|
|
516
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
517
|
-
payload: {
|
|
518
|
-
city: branchById === null || branchById === void 0 ? void 0 : branchById.city
|
|
519
|
-
}
|
|
520
|
-
});
|
|
593
|
+
updateCustomerField('companyName', (branchById === null || branchById === void 0 ? void 0 : branchById.name) || '');
|
|
594
|
+
updateCustomerField('email', (branchById === null || branchById === void 0 ? void 0 : branchById.email) || '');
|
|
595
|
+
updateCustomerField('phoneNumber', (branchById === null || branchById === void 0 ? void 0 : branchById.phone) || '');
|
|
596
|
+
updateCustomerField('zipCode', (branchById === null || branchById === void 0 ? void 0 : branchById.postalCode) || '');
|
|
597
|
+
updateCustomerField('streetName', (branchById === null || branchById === void 0 ? void 0 : branchById.street) || '');
|
|
598
|
+
updateCustomerField('city', (branchById === null || branchById === void 0 ? void 0 : branchById.city) || '');
|
|
599
|
+
updateCustomerField('houseNumber', (branchById === null || branchById === void 0 ? void 0 : branchById.street2) || '');
|
|
521
600
|
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;
|
|
522
601
|
if (kvkNumber) {
|
|
523
|
-
|
|
524
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
525
|
-
payload: {
|
|
526
|
-
kvkNumber
|
|
527
|
-
}
|
|
528
|
-
});
|
|
602
|
+
updateCustomerField('kvkNumber', kvkNumber);
|
|
529
603
|
}
|
|
530
604
|
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;
|
|
531
605
|
if (vatNumber) {
|
|
532
|
-
|
|
533
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
534
|
-
payload: {
|
|
535
|
-
vatNumber
|
|
536
|
-
}
|
|
537
|
-
});
|
|
606
|
+
updateCustomerField('vatNumber', vatNumber);
|
|
538
607
|
}
|
|
539
|
-
dispatch({
|
|
540
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
541
|
-
payload: {
|
|
542
|
-
houseNumber: branchById === null || branchById === void 0 ? void 0 : branchById.street2
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
608
|
};
|
|
546
609
|
const handleClearAllCustomerFields = () => {
|
|
547
610
|
// Set a new timestamp to force re-renders
|
|
@@ -552,84 +615,12 @@ const InternalAppointmentForm = _ref => {
|
|
|
552
615
|
inputs.forEach(input => {
|
|
553
616
|
input.value = '';
|
|
554
617
|
});
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
});
|
|
561
|
-
dispatch({
|
|
562
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
563
|
-
payload: {
|
|
564
|
-
infix: ''
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
dispatch({
|
|
568
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
569
|
-
payload: {
|
|
570
|
-
lastName: ''
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
-
dispatch({
|
|
574
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
575
|
-
payload: {
|
|
576
|
-
email: ''
|
|
577
|
-
}
|
|
578
|
-
});
|
|
579
|
-
dispatch({
|
|
580
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
581
|
-
payload: {
|
|
582
|
-
phoneNumber: ''
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
|
-
dispatch({
|
|
586
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
587
|
-
payload: {
|
|
588
|
-
zipCode: ''
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
dispatch({
|
|
592
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
593
|
-
payload: {
|
|
594
|
-
houseNumber: ''
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
dispatch({
|
|
598
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
599
|
-
payload: {
|
|
600
|
-
houseNumberAddition: ''
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
dispatch({
|
|
604
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
605
|
-
payload: {
|
|
606
|
-
streetName: ''
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
dispatch({
|
|
610
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
611
|
-
payload: {
|
|
612
|
-
city: ''
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
dispatch({
|
|
616
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
617
|
-
payload: {
|
|
618
|
-
companyName: ''
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
dispatch({
|
|
622
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
623
|
-
payload: {
|
|
624
|
-
kvkNumber: ''
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
dispatch({
|
|
628
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
629
|
-
payload: {
|
|
630
|
-
vatNumber: ''
|
|
631
|
-
}
|
|
632
|
-
});
|
|
618
|
+
|
|
619
|
+
// Clear all customer fields in the local state for the active ownership type
|
|
620
|
+
const emptyState = getEmptyCustomerState();
|
|
621
|
+
setCustomerDataPerType(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
622
|
+
[activeOwnershipType]: emptyState
|
|
623
|
+
}));
|
|
633
624
|
};
|
|
634
625
|
const initialChannel = channel !== null && channel !== void 0 && channel.channelId ? {
|
|
635
626
|
label: marketingChannels === null || marketingChannels === void 0 || (_marketingChannels$fi = marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId))) === null || _marketingChannels$fi === void 0 ? void 0 : _marketingChannels$fi.title,
|
|
@@ -646,18 +637,8 @@ const InternalAppointmentForm = _ref => {
|
|
|
646
637
|
const addressInfo = await addressLookupService.lookup(postcode, houseNumber);
|
|
647
638
|
if (addressInfo && addressInfo.street && addressInfo.city) {
|
|
648
639
|
// Auto-fill street and city fields
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
payload: {
|
|
652
|
-
streetName: addressInfo.street
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
dispatch({
|
|
656
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
657
|
-
payload: {
|
|
658
|
-
city: addressInfo.city
|
|
659
|
-
}
|
|
660
|
-
});
|
|
640
|
+
updateCustomerField('streetName', addressInfo.street);
|
|
641
|
+
updateCustomerField('city', addressInfo.city);
|
|
661
642
|
}
|
|
662
643
|
} catch (error) {
|
|
663
644
|
console.error('Address lookup failed:', error);
|
|
@@ -721,12 +702,12 @@ const InternalAppointmentForm = _ref => {
|
|
|
721
702
|
placeholder: "Maak een keuze",
|
|
722
703
|
errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelType']) || (errors === null || errors === void 0 ? void 0 : errors['channelId']),
|
|
723
704
|
initialValue: initialChannel,
|
|
724
|
-
onChange:
|
|
705
|
+
onChange: _ref4 => {
|
|
725
706
|
var _value$kanaalType;
|
|
726
707
|
let {
|
|
727
708
|
label,
|
|
728
709
|
value
|
|
729
|
-
} =
|
|
710
|
+
} = _ref4;
|
|
730
711
|
return dispatch({
|
|
731
712
|
type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
|
|
732
713
|
payload: {
|
|
@@ -741,31 +722,22 @@ const InternalAppointmentForm = _ref => {
|
|
|
741
722
|
}) : null, /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
|
|
742
723
|
name: "ownershipType",
|
|
743
724
|
label: "Type:",
|
|
744
|
-
initialValue:
|
|
725
|
+
initialValue: activeOwnershipType,
|
|
745
726
|
onChange: val => {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
payload: {
|
|
749
|
-
ownershipType: val
|
|
750
|
-
}
|
|
751
|
-
});
|
|
727
|
+
// Switch to the new ownership type - each type maintains its own separate state
|
|
728
|
+
setActiveOwnershipType(val);
|
|
752
729
|
},
|
|
753
730
|
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
754
731
|
isRequired: true,
|
|
755
732
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['ownershipType']
|
|
756
|
-
}),
|
|
733
|
+
}), activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
757
734
|
className: (0, _helpers__.withStyle)('company-search-container position-relative mt-2 mb-2')
|
|
758
735
|
}, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
759
736
|
placeholder: "Zoek leasemaatschappijen...",
|
|
760
737
|
value: customer.companyName,
|
|
761
738
|
name: "companyName",
|
|
762
739
|
onChange: value => {
|
|
763
|
-
|
|
764
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
765
|
-
payload: {
|
|
766
|
-
companyName: value
|
|
767
|
-
}
|
|
768
|
-
});
|
|
740
|
+
updateCustomerField('companyName', value);
|
|
769
741
|
|
|
770
742
|
// Also update search term if value is different
|
|
771
743
|
if (value !== companySearchTerm) {
|
|
@@ -810,12 +782,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
810
782
|
e.preventDefault();
|
|
811
783
|
|
|
812
784
|
// Only set company name for lease companies, no other autofills
|
|
813
|
-
|
|
814
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
815
|
-
payload: {
|
|
816
|
-
companyName: branch.name
|
|
817
|
-
}
|
|
818
|
-
});
|
|
785
|
+
updateCustomerField('companyName', branch.name);
|
|
819
786
|
setCompanySearchTerm('');
|
|
820
787
|
setIsCompanyInputFocused(false);
|
|
821
788
|
}
|
|
@@ -840,18 +807,13 @@ const InternalAppointmentForm = _ref => {
|
|
|
840
807
|
className: (0, _helpers__.withStyle)('my-2')
|
|
841
808
|
}, "Persoonlijke gegevens"), /*#__PURE__*/_react.default.createElement("div", {
|
|
842
809
|
className: (0, _helpers__.withStyle)('col-12 col-md-6 mb-2')
|
|
843
|
-
},
|
|
810
|
+
}, activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h6", {
|
|
844
811
|
className: (0, _helpers__.withStyle)('modal-title mb-2')
|
|
845
812
|
}, "Gegevens klant:"), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
846
813
|
placeholder: "",
|
|
847
814
|
value: customer.firstName,
|
|
848
815
|
name: "firstName",
|
|
849
|
-
onChange: value =>
|
|
850
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
|
|
851
|
-
payload: {
|
|
852
|
-
firstName: value
|
|
853
|
-
}
|
|
854
|
-
}),
|
|
816
|
+
onChange: value => updateCustomerField('firstName', value),
|
|
855
817
|
isRequired: true,
|
|
856
818
|
form: "appointment",
|
|
857
819
|
label: "Voornaam:",
|
|
@@ -861,12 +823,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
861
823
|
placeholder: "",
|
|
862
824
|
value: customer.infix,
|
|
863
825
|
name: "infix",
|
|
864
|
-
onChange: value =>
|
|
865
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
866
|
-
payload: {
|
|
867
|
-
infix: value
|
|
868
|
-
}
|
|
869
|
-
}),
|
|
826
|
+
onChange: value => updateCustomerField('infix', value),
|
|
870
827
|
isRequired: false,
|
|
871
828
|
form: "appointment",
|
|
872
829
|
label: "Tussenvoegsel:",
|
|
@@ -875,12 +832,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
875
832
|
placeholder: "",
|
|
876
833
|
value: customer.lastName,
|
|
877
834
|
name: "lastName",
|
|
878
|
-
onChange: value =>
|
|
879
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
880
|
-
payload: {
|
|
881
|
-
lastName: value
|
|
882
|
-
}
|
|
883
|
-
}),
|
|
835
|
+
onChange: value => updateCustomerField('lastName', value),
|
|
884
836
|
isRequired: true,
|
|
885
837
|
form: "appointment",
|
|
886
838
|
label: "Achternaam:",
|
|
@@ -889,12 +841,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
889
841
|
placeholder: "",
|
|
890
842
|
value: customer.email,
|
|
891
843
|
name: "email",
|
|
892
|
-
onChange: value =>
|
|
893
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
894
|
-
payload: {
|
|
895
|
-
email: value
|
|
896
|
-
}
|
|
897
|
-
}),
|
|
844
|
+
onChange: value => updateCustomerField('email', value),
|
|
898
845
|
isRequired: true,
|
|
899
846
|
form: "appointment",
|
|
900
847
|
label: "E-mailadres:",
|
|
@@ -903,26 +850,16 @@ const InternalAppointmentForm = _ref => {
|
|
|
903
850
|
placeholder: "",
|
|
904
851
|
value: customer.phoneNumber,
|
|
905
852
|
name: "phoneNumber",
|
|
906
|
-
onChange: value =>
|
|
907
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
908
|
-
payload: {
|
|
909
|
-
phoneNumber: value
|
|
910
|
-
}
|
|
911
|
-
}),
|
|
853
|
+
onChange: value => updateCustomerField('phoneNumber', value),
|
|
912
854
|
isRequired: true,
|
|
913
855
|
label: "Telefoonnummer:",
|
|
914
856
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber'],
|
|
915
857
|
key: "phoneNumber-".concat(refreshKey)
|
|
916
|
-
})) :
|
|
858
|
+
})) : activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
917
859
|
placeholder: "",
|
|
918
860
|
value: customer.firstName,
|
|
919
861
|
name: "firstName",
|
|
920
|
-
onChange: value =>
|
|
921
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
|
|
922
|
-
payload: {
|
|
923
|
-
firstName: value
|
|
924
|
-
}
|
|
925
|
-
}),
|
|
862
|
+
onChange: value => updateCustomerField('firstName', value),
|
|
926
863
|
key: "firstName-".concat(refreshKey),
|
|
927
864
|
isRequired: true,
|
|
928
865
|
form: "appointment",
|
|
@@ -932,12 +869,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
932
869
|
placeholder: "",
|
|
933
870
|
value: customer.infix,
|
|
934
871
|
name: "infix",
|
|
935
|
-
onChange: value =>
|
|
936
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
937
|
-
payload: {
|
|
938
|
-
infix: value
|
|
939
|
-
}
|
|
940
|
-
}),
|
|
872
|
+
onChange: value => updateCustomerField('infix', value),
|
|
941
873
|
key: "infix-".concat(refreshKey),
|
|
942
874
|
isRequired: false,
|
|
943
875
|
form: "appointment",
|
|
@@ -947,12 +879,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
947
879
|
placeholder: "",
|
|
948
880
|
value: customer.lastName,
|
|
949
881
|
name: "lastName",
|
|
950
|
-
onChange: value =>
|
|
951
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
952
|
-
payload: {
|
|
953
|
-
lastName: value
|
|
954
|
-
}
|
|
955
|
-
}),
|
|
882
|
+
onChange: value => updateCustomerField('lastName', value),
|
|
956
883
|
key: "lastName-".concat(refreshKey),
|
|
957
884
|
isRequired: true,
|
|
958
885
|
form: "appointment",
|
|
@@ -962,12 +889,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
962
889
|
placeholder: "",
|
|
963
890
|
value: customer.email,
|
|
964
891
|
name: "email",
|
|
965
|
-
onChange: value =>
|
|
966
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
967
|
-
payload: {
|
|
968
|
-
email: value
|
|
969
|
-
}
|
|
970
|
-
}),
|
|
892
|
+
onChange: value => updateCustomerField('email', value),
|
|
971
893
|
key: "email-".concat(refreshKey),
|
|
972
894
|
isRequired: true,
|
|
973
895
|
form: "appointment",
|
|
@@ -977,12 +899,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
977
899
|
placeholder: "",
|
|
978
900
|
value: customer.phoneNumber,
|
|
979
901
|
name: "phoneNumber",
|
|
980
|
-
onChange: value =>
|
|
981
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
982
|
-
payload: {
|
|
983
|
-
phoneNumber: value
|
|
984
|
-
}
|
|
985
|
-
}),
|
|
902
|
+
onChange: value => updateCustomerField('phoneNumber', value),
|
|
986
903
|
isRequired: true,
|
|
987
904
|
label: "Telefoonnummer:",
|
|
988
905
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber'],
|
|
@@ -991,12 +908,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
991
908
|
placeholder: "",
|
|
992
909
|
value: customer.firstName,
|
|
993
910
|
name: "firstName",
|
|
994
|
-
onChange: value =>
|
|
995
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
|
|
996
|
-
payload: {
|
|
997
|
-
firstName: value
|
|
998
|
-
}
|
|
999
|
-
}),
|
|
911
|
+
onChange: value => updateCustomerField('firstName', value),
|
|
1000
912
|
key: "firstName-".concat(refreshKey),
|
|
1001
913
|
isRequired: true,
|
|
1002
914
|
form: "appointment",
|
|
@@ -1006,12 +918,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1006
918
|
placeholder: "",
|
|
1007
919
|
value: customer.infix,
|
|
1008
920
|
name: "infix",
|
|
1009
|
-
onChange: value =>
|
|
1010
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
1011
|
-
payload: {
|
|
1012
|
-
infix: value
|
|
1013
|
-
}
|
|
1014
|
-
}),
|
|
921
|
+
onChange: value => updateCustomerField('infix', value),
|
|
1015
922
|
key: "infix-".concat(refreshKey),
|
|
1016
923
|
isRequired: false,
|
|
1017
924
|
form: "appointment",
|
|
@@ -1021,12 +928,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1021
928
|
placeholder: "",
|
|
1022
929
|
value: customer.lastName,
|
|
1023
930
|
name: "lastName",
|
|
1024
|
-
onChange: value =>
|
|
1025
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
1026
|
-
payload: {
|
|
1027
|
-
lastName: value
|
|
1028
|
-
}
|
|
1029
|
-
}),
|
|
931
|
+
onChange: value => updateCustomerField('lastName', value),
|
|
1030
932
|
key: "lastName-".concat(refreshKey),
|
|
1031
933
|
isRequired: true,
|
|
1032
934
|
form: "appointment",
|
|
@@ -1036,12 +938,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1036
938
|
placeholder: "",
|
|
1037
939
|
value: customer.email,
|
|
1038
940
|
name: "email",
|
|
1039
|
-
onChange: value =>
|
|
1040
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
1041
|
-
payload: {
|
|
1042
|
-
email: value
|
|
1043
|
-
}
|
|
1044
|
-
}),
|
|
941
|
+
onChange: value => updateCustomerField('email', value),
|
|
1045
942
|
key: "email-".concat(refreshKey),
|
|
1046
943
|
isRequired: true,
|
|
1047
944
|
form: "appointment",
|
|
@@ -1049,7 +946,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1049
946
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['email']
|
|
1050
947
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
1051
948
|
className: (0, _helpers__.withStyle)('col-12 col-md-6')
|
|
1052
|
-
},
|
|
949
|
+
}, activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h6", {
|
|
1053
950
|
className: (0, _helpers__.withStyle)('modal-title mb-2')
|
|
1054
951
|
}, "Gegevens bedrijf:"), /*#__PURE__*/_react.default.createElement("div", {
|
|
1055
952
|
className: (0, _helpers__.withStyle)('company-search-container position-relative mb-3')
|
|
@@ -1068,12 +965,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1068
965
|
name: "companyName",
|
|
1069
966
|
onChange: value => {
|
|
1070
967
|
// Update company name in state
|
|
1071
|
-
|
|
1072
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
1073
|
-
payload: {
|
|
1074
|
-
companyName: value
|
|
1075
|
-
}
|
|
1076
|
-
});
|
|
968
|
+
updateCustomerField('companyName', value);
|
|
1077
969
|
|
|
1078
970
|
// Also update search term if value is different
|
|
1079
971
|
if (value !== companySearchTerm) {
|
|
@@ -1119,77 +1011,32 @@ const InternalAppointmentForm = _ref => {
|
|
|
1119
1011
|
onMouseDown: e => {
|
|
1120
1012
|
var _branch$vatNumber, _branch$kvkNumber;
|
|
1121
1013
|
e.preventDefault();
|
|
1122
|
-
|
|
1123
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
1124
|
-
payload: {
|
|
1125
|
-
companyName: branch.name
|
|
1126
|
-
}
|
|
1127
|
-
});
|
|
1014
|
+
updateCustomerField('companyName', branch.name);
|
|
1128
1015
|
if (branch.postalCode) {
|
|
1129
|
-
|
|
1130
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
1131
|
-
payload: {
|
|
1132
|
-
zipCode: branch.postalCode
|
|
1133
|
-
}
|
|
1134
|
-
});
|
|
1016
|
+
updateCustomerField('zipCode', branch.postalCode);
|
|
1135
1017
|
}
|
|
1136
1018
|
if (branch.street) {
|
|
1137
|
-
|
|
1138
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
1139
|
-
payload: {
|
|
1140
|
-
streetName: branch.street
|
|
1141
|
-
}
|
|
1142
|
-
});
|
|
1019
|
+
updateCustomerField('streetName', branch.street);
|
|
1143
1020
|
}
|
|
1144
1021
|
if (branch.city) {
|
|
1145
|
-
|
|
1146
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
1147
|
-
payload: {
|
|
1148
|
-
city: branch.city
|
|
1149
|
-
}
|
|
1150
|
-
});
|
|
1022
|
+
updateCustomerField('city', branch.city);
|
|
1151
1023
|
}
|
|
1152
1024
|
if (branch.street2) {
|
|
1153
|
-
|
|
1154
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
1155
|
-
payload: {
|
|
1156
|
-
houseNumber: branch.street2
|
|
1157
|
-
}
|
|
1158
|
-
});
|
|
1025
|
+
updateCustomerField('houseNumber', branch.street2);
|
|
1159
1026
|
}
|
|
1160
1027
|
const vatNumber = (_branch$vatNumber = branch.vatNumber) !== null && _branch$vatNumber !== void 0 ? _branch$vatNumber : branch.btwNummer;
|
|
1161
1028
|
if (vatNumber) {
|
|
1162
|
-
|
|
1163
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
1164
|
-
payload: {
|
|
1165
|
-
vatNumber
|
|
1166
|
-
}
|
|
1167
|
-
});
|
|
1029
|
+
updateCustomerField('vatNumber', vatNumber);
|
|
1168
1030
|
}
|
|
1169
1031
|
const kvkNumber = (_branch$kvkNumber = branch.kvkNumber) !== null && _branch$kvkNumber !== void 0 ? _branch$kvkNumber : branch.kvkNummer;
|
|
1170
1032
|
if (kvkNumber) {
|
|
1171
|
-
|
|
1172
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
1173
|
-
payload: {
|
|
1174
|
-
kvkNumber
|
|
1175
|
-
}
|
|
1176
|
-
});
|
|
1033
|
+
updateCustomerField('kvkNumber', kvkNumber);
|
|
1177
1034
|
}
|
|
1178
1035
|
if (branch.huisnummerToevoeging) {
|
|
1179
|
-
|
|
1180
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
1181
|
-
payload: {
|
|
1182
|
-
houseNumberAddition: branch.huisnummerToevoeging
|
|
1183
|
-
}
|
|
1184
|
-
});
|
|
1036
|
+
updateCustomerField('houseNumberAddition', branch.huisnummerToevoeging);
|
|
1185
1037
|
}
|
|
1186
1038
|
if (branch.country && branch.country.entityId) {
|
|
1187
|
-
|
|
1188
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
1189
|
-
payload: {
|
|
1190
|
-
countryId: branch.country.entityId
|
|
1191
|
-
}
|
|
1192
|
-
});
|
|
1039
|
+
updateCustomerField('countryId', branch.country.entityId);
|
|
1193
1040
|
setRefreshKey(Date.now());
|
|
1194
1041
|
}
|
|
1195
1042
|
setCompanySearchTerm('');
|
|
@@ -1199,12 +1046,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1199
1046
|
placeholder: "",
|
|
1200
1047
|
value: customer.kvkNumber,
|
|
1201
1048
|
name: "kvkNumber",
|
|
1202
|
-
onChange: value =>
|
|
1203
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
1204
|
-
payload: {
|
|
1205
|
-
kvkNumber: value
|
|
1206
|
-
}
|
|
1207
|
-
}),
|
|
1049
|
+
onChange: value => updateCustomerField('kvkNumber', value),
|
|
1208
1050
|
key: "kvkNumber-".concat(refreshKey),
|
|
1209
1051
|
isRequired: shouldRequireKvkNumber,
|
|
1210
1052
|
form: "quotation",
|
|
@@ -1214,12 +1056,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1214
1056
|
placeholder: "",
|
|
1215
1057
|
value: customer.vatNumber,
|
|
1216
1058
|
name: "vatNumber",
|
|
1217
|
-
onChange: value =>
|
|
1218
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
1219
|
-
payload: {
|
|
1220
|
-
vatNumber: value
|
|
1221
|
-
}
|
|
1222
|
-
}),
|
|
1059
|
+
onChange: value => updateCustomerField('vatNumber', value),
|
|
1223
1060
|
key: "vatNumber-".concat(refreshKey),
|
|
1224
1061
|
isRequired: shouldRequireVatNumber,
|
|
1225
1062
|
form: "quotation",
|
|
@@ -1230,12 +1067,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1230
1067
|
value: customer.zipCode,
|
|
1231
1068
|
name: "zipCode",
|
|
1232
1069
|
onChange: value => {
|
|
1233
|
-
|
|
1234
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
1235
|
-
payload: {
|
|
1236
|
-
zipCode: value
|
|
1237
|
-
}
|
|
1238
|
-
});
|
|
1070
|
+
updateCustomerField('zipCode', value);
|
|
1239
1071
|
// Trigger address lookup if house number is also available
|
|
1240
1072
|
if (customer.houseNumber) {
|
|
1241
1073
|
handleAddressLookup(value, customer.houseNumber);
|
|
@@ -1250,12 +1082,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1250
1082
|
value: customer.houseNumber,
|
|
1251
1083
|
name: "houseNumber",
|
|
1252
1084
|
onChange: value => {
|
|
1253
|
-
|
|
1254
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
1255
|
-
payload: {
|
|
1256
|
-
houseNumber: value
|
|
1257
|
-
}
|
|
1258
|
-
});
|
|
1085
|
+
updateCustomerField('houseNumber', value);
|
|
1259
1086
|
// Trigger address lookup if postcode is also available
|
|
1260
1087
|
if (customer.zipCode) {
|
|
1261
1088
|
handleAddressLookup(customer.zipCode, value);
|
|
@@ -1269,12 +1096,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1269
1096
|
placeholder: "",
|
|
1270
1097
|
value: customer.houseNumberAddition,
|
|
1271
1098
|
name: "houseNumberAddition",
|
|
1272
|
-
onChange: value =>
|
|
1273
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
1274
|
-
payload: {
|
|
1275
|
-
houseNumberAddition: value
|
|
1276
|
-
}
|
|
1277
|
-
}),
|
|
1099
|
+
onChange: value => updateCustomerField('houseNumberAddition', value),
|
|
1278
1100
|
key: "houseNumberAddition-".concat(refreshKey),
|
|
1279
1101
|
isRequired: false,
|
|
1280
1102
|
label: "Huisnummer toevoeging:",
|
|
@@ -1283,12 +1105,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1283
1105
|
placeholder: addressLookupLoading ? 'Adres wordt opgezocht...' : '',
|
|
1284
1106
|
value: customer.streetName,
|
|
1285
1107
|
name: "streetName",
|
|
1286
|
-
onChange: value =>
|
|
1287
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
1288
|
-
payload: {
|
|
1289
|
-
streetName: value
|
|
1290
|
-
}
|
|
1291
|
-
}),
|
|
1108
|
+
onChange: value => updateCustomerField('streetName', value),
|
|
1292
1109
|
key: "streetName-".concat(refreshKey),
|
|
1293
1110
|
isRequired: true,
|
|
1294
1111
|
label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1297,12 +1114,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1297
1114
|
placeholder: addressLookupLoading ? 'Stad wordt opgezocht...' : '',
|
|
1298
1115
|
value: customer.city,
|
|
1299
1116
|
name: "city",
|
|
1300
|
-
onChange: value =>
|
|
1301
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
1302
|
-
payload: {
|
|
1303
|
-
city: value
|
|
1304
|
-
}
|
|
1305
|
-
}),
|
|
1117
|
+
onChange: value => updateCustomerField('city', value),
|
|
1306
1118
|
key: "city-".concat(refreshKey),
|
|
1307
1119
|
isRequired: true,
|
|
1308
1120
|
label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1318,10 +1130,10 @@ const InternalAppointmentForm = _ref => {
|
|
|
1318
1130
|
placeholder: "Selecteer een land",
|
|
1319
1131
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
|
|
1320
1132
|
initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
|
|
1321
|
-
onChange:
|
|
1133
|
+
onChange: _ref5 => {
|
|
1322
1134
|
let {
|
|
1323
1135
|
value
|
|
1324
|
-
} =
|
|
1136
|
+
} = _ref5;
|
|
1325
1137
|
return dispatch({
|
|
1326
1138
|
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
1327
1139
|
payload: {
|
|
@@ -1329,17 +1141,12 @@ const InternalAppointmentForm = _ref => {
|
|
|
1329
1141
|
}
|
|
1330
1142
|
});
|
|
1331
1143
|
}
|
|
1332
|
-
})) :
|
|
1144
|
+
})) : activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
1333
1145
|
placeholder: "",
|
|
1334
1146
|
value: customer.zipCode,
|
|
1335
1147
|
name: "zipCode",
|
|
1336
1148
|
onChange: value => {
|
|
1337
|
-
|
|
1338
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
1339
|
-
payload: {
|
|
1340
|
-
zipCode: value
|
|
1341
|
-
}
|
|
1342
|
-
});
|
|
1149
|
+
updateCustomerField('zipCode', value);
|
|
1343
1150
|
// Trigger address lookup if house number is also available
|
|
1344
1151
|
if (customer.houseNumber) {
|
|
1345
1152
|
handleAddressLookup(value, customer.houseNumber);
|
|
@@ -1354,12 +1161,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1354
1161
|
value: customer.houseNumber,
|
|
1355
1162
|
name: "houseNumber",
|
|
1356
1163
|
onChange: value => {
|
|
1357
|
-
|
|
1358
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
1359
|
-
payload: {
|
|
1360
|
-
houseNumber: value
|
|
1361
|
-
}
|
|
1362
|
-
});
|
|
1164
|
+
updateCustomerField('houseNumber', value);
|
|
1363
1165
|
// Trigger address lookup if postcode is also available
|
|
1364
1166
|
if (customer.zipCode) {
|
|
1365
1167
|
handleAddressLookup(customer.zipCode, value);
|
|
@@ -1373,12 +1175,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1373
1175
|
placeholder: "",
|
|
1374
1176
|
value: customer.houseNumberAddition,
|
|
1375
1177
|
name: "houseNumberAddition",
|
|
1376
|
-
onChange: value =>
|
|
1377
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
1378
|
-
payload: {
|
|
1379
|
-
houseNumberAddition: value
|
|
1380
|
-
}
|
|
1381
|
-
}),
|
|
1178
|
+
onChange: value => updateCustomerField('houseNumberAddition', value),
|
|
1382
1179
|
key: "houseNumberAddition-".concat(refreshKey),
|
|
1383
1180
|
isRequired: false,
|
|
1384
1181
|
label: "Huisnummer toevoeging:",
|
|
@@ -1387,12 +1184,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1387
1184
|
placeholder: addressLookupLoading ? 'Adres wordt opgezocht...' : '',
|
|
1388
1185
|
value: customer.streetName,
|
|
1389
1186
|
name: "streetName",
|
|
1390
|
-
onChange: value =>
|
|
1391
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
1392
|
-
payload: {
|
|
1393
|
-
streetName: value
|
|
1394
|
-
}
|
|
1395
|
-
}),
|
|
1187
|
+
onChange: value => updateCustomerField('streetName', value),
|
|
1396
1188
|
key: "streetName-".concat(refreshKey),
|
|
1397
1189
|
isRequired: true,
|
|
1398
1190
|
label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1401,12 +1193,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1401
1193
|
placeholder: addressLookupLoading ? 'Stad wordt opgezocht...' : '',
|
|
1402
1194
|
value: customer.city,
|
|
1403
1195
|
name: "city",
|
|
1404
|
-
onChange: value =>
|
|
1405
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
1406
|
-
payload: {
|
|
1407
|
-
city: value
|
|
1408
|
-
}
|
|
1409
|
-
}),
|
|
1196
|
+
onChange: value => updateCustomerField('city', value),
|
|
1410
1197
|
key: "city-".concat(refreshKey),
|
|
1411
1198
|
isRequired: true,
|
|
1412
1199
|
label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1422,10 +1209,10 @@ const InternalAppointmentForm = _ref => {
|
|
|
1422
1209
|
placeholder: "Selecteer een land",
|
|
1423
1210
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
|
|
1424
1211
|
initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
|
|
1425
|
-
onChange:
|
|
1212
|
+
onChange: _ref6 => {
|
|
1426
1213
|
let {
|
|
1427
1214
|
value
|
|
1428
|
-
} =
|
|
1215
|
+
} = _ref6;
|
|
1429
1216
|
return dispatch({
|
|
1430
1217
|
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
1431
1218
|
payload: {
|
|
@@ -1437,12 +1224,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1437
1224
|
placeholder: "",
|
|
1438
1225
|
value: customer.phoneNumber,
|
|
1439
1226
|
name: "phoneNumber",
|
|
1440
|
-
onChange: value =>
|
|
1441
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
1442
|
-
payload: {
|
|
1443
|
-
phoneNumber: value
|
|
1444
|
-
}
|
|
1445
|
-
}),
|
|
1227
|
+
onChange: value => updateCustomerField('phoneNumber', value),
|
|
1446
1228
|
isRequired: true,
|
|
1447
1229
|
label: "Telefoonnummer:",
|
|
1448
1230
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber'],
|
|
@@ -1452,12 +1234,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1452
1234
|
value: customer.zipCode,
|
|
1453
1235
|
name: "zipCode",
|
|
1454
1236
|
onChange: value => {
|
|
1455
|
-
|
|
1456
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
1457
|
-
payload: {
|
|
1458
|
-
zipCode: value
|
|
1459
|
-
}
|
|
1460
|
-
});
|
|
1237
|
+
updateCustomerField('zipCode', value);
|
|
1461
1238
|
// Trigger address lookup if house number is also available
|
|
1462
1239
|
if (customer.houseNumber) {
|
|
1463
1240
|
handleAddressLookup(value, customer.houseNumber);
|
|
@@ -1472,12 +1249,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1472
1249
|
value: customer.houseNumber,
|
|
1473
1250
|
name: "houseNumber",
|
|
1474
1251
|
onChange: value => {
|
|
1475
|
-
|
|
1476
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
1477
|
-
payload: {
|
|
1478
|
-
houseNumber: value
|
|
1479
|
-
}
|
|
1480
|
-
});
|
|
1252
|
+
updateCustomerField('houseNumber', value);
|
|
1481
1253
|
// Trigger address lookup if postcode is also available
|
|
1482
1254
|
if (customer.zipCode) {
|
|
1483
1255
|
handleAddressLookup(customer.zipCode, value);
|
|
@@ -1491,12 +1263,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1491
1263
|
placeholder: "",
|
|
1492
1264
|
value: customer.houseNumberAddition,
|
|
1493
1265
|
name: "houseNumberAddition",
|
|
1494
|
-
onChange: value =>
|
|
1495
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
1496
|
-
payload: {
|
|
1497
|
-
houseNumberAddition: value
|
|
1498
|
-
}
|
|
1499
|
-
}),
|
|
1266
|
+
onChange: value => updateCustomerField('houseNumberAddition', value),
|
|
1500
1267
|
key: "houseNumberAddition-".concat(refreshKey),
|
|
1501
1268
|
isRequired: false,
|
|
1502
1269
|
label: "Huisnummer toevoeging:",
|
|
@@ -1505,12 +1272,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1505
1272
|
placeholder: addressLookupLoading ? 'Adres wordt opgezocht...' : '',
|
|
1506
1273
|
value: customer.streetName,
|
|
1507
1274
|
name: "streetName",
|
|
1508
|
-
onChange: value =>
|
|
1509
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
1510
|
-
payload: {
|
|
1511
|
-
streetName: value
|
|
1512
|
-
}
|
|
1513
|
-
}),
|
|
1275
|
+
onChange: value => updateCustomerField('streetName', value),
|
|
1514
1276
|
key: "streetName-".concat(refreshKey),
|
|
1515
1277
|
isRequired: true,
|
|
1516
1278
|
label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1519,12 +1281,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1519
1281
|
placeholder: addressLookupLoading ? 'Stad wordt opgezocht...' : '',
|
|
1520
1282
|
value: customer.city,
|
|
1521
1283
|
name: "city",
|
|
1522
|
-
onChange: value =>
|
|
1523
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
1524
|
-
payload: {
|
|
1525
|
-
city: value
|
|
1526
|
-
}
|
|
1527
|
-
}),
|
|
1284
|
+
onChange: value => updateCustomerField('city', value),
|
|
1528
1285
|
key: "city-".concat(refreshKey),
|
|
1529
1286
|
isRequired: true,
|
|
1530
1287
|
label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1540,10 +1297,10 @@ const InternalAppointmentForm = _ref => {
|
|
|
1540
1297
|
placeholder: "Selecteer een land",
|
|
1541
1298
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
|
|
1542
1299
|
initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
|
|
1543
|
-
onChange:
|
|
1300
|
+
onChange: _ref7 => {
|
|
1544
1301
|
let {
|
|
1545
1302
|
value
|
|
1546
|
-
} =
|
|
1303
|
+
} = _ref7;
|
|
1547
1304
|
return dispatch({
|
|
1548
1305
|
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
1549
1306
|
payload: {
|
|
@@ -1559,7 +1316,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1559
1316
|
className: (0, _helpers__.withStyle)('modal-title col-12 mb-2')
|
|
1560
1317
|
}, "Gegevens van de auto ", /*#__PURE__*/_react.default.createElement("br", null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
1561
1318
|
className: (0, _helpers__.withStyle)('col-12')
|
|
1562
|
-
},
|
|
1319
|
+
}, activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
1563
1320
|
key: "leaseNumber",
|
|
1564
1321
|
placeholder: "",
|
|
1565
1322
|
value: vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber,
|