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
|
@@ -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,
|
|
@@ -218,8 +235,100 @@ const InternalAppointmentForm = _ref => {
|
|
|
218
235
|
vehicleCodingDiscountPercentage,
|
|
219
236
|
consumerDiscounts,
|
|
220
237
|
montageRate,
|
|
221
|
-
hasGoedkeuringsnummerActivity
|
|
238
|
+
hasGoedkeuringsnummerActivity,
|
|
239
|
+
isTowCenterBranch
|
|
222
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]);
|
|
223
332
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
224
333
|
const [_licensePlate, _setLicensePlate] = (0, _react.useState)();
|
|
225
334
|
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
@@ -291,7 +400,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
291
400
|
}
|
|
292
401
|
}
|
|
293
402
|
}, [customer === null || customer === void 0 ? void 0 : customer.countryId, countryOptions, dispatch]);
|
|
294
|
-
const isBusinessOwnership =
|
|
403
|
+
const isBusinessOwnership = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk;
|
|
295
404
|
const isNetherlandsSelected = (0, _react.useMemo)(() => {
|
|
296
405
|
if (!(selectedCountry !== null && selectedCountry !== void 0 && selectedCountry.label)) return false;
|
|
297
406
|
return selectedCountry.label.toUpperCase() === 'NEDERLAND';
|
|
@@ -339,7 +448,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
339
448
|
const handleSubmit = async function handleSubmit() {
|
|
340
449
|
let appointmentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _constants__.DOSSIER_TYPES.PlannedAppointment;
|
|
341
450
|
try {
|
|
342
|
-
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;
|
|
343
452
|
setErrors({});
|
|
344
453
|
if (!model) {
|
|
345
454
|
// Note: this does not throw on error.
|
|
@@ -353,7 +462,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
353
462
|
}
|
|
354
463
|
|
|
355
464
|
// Validate lease number for lease company vehicles
|
|
356
|
-
if (
|
|
465
|
+
if (activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij) {
|
|
357
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)) {
|
|
358
467
|
setErrors(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
359
468
|
leaseNumber: _constants__.FORM_ERROR_MESSAGES.leaseNumber || 'Goedkeuringsnummer is verplicht of geef aan dat het onbekend is'
|
|
@@ -381,7 +490,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
381
490
|
|
|
382
491
|
// Note: this throws on error.
|
|
383
492
|
internalAppointmentFormSchema.validateSync(_objectSpread(_objectSpread(_objectSpread({}, vehicle), customer), {}, {
|
|
384
|
-
ownershipType:
|
|
493
|
+
ownershipType: activeOwnershipType,
|
|
385
494
|
// Note: add string fallback here to prevent null check in Yup throwing weird errors
|
|
386
495
|
// However: dont submit empty strings to the API because the API doesnt accept empty strings in place of `undefined`
|
|
387
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.
|
|
@@ -421,7 +530,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
421
530
|
appointment,
|
|
422
531
|
appointmentType,
|
|
423
532
|
channel,
|
|
424
|
-
licensePlate: (
|
|
533
|
+
licensePlate: (_ref3 = licensePlate || _licensePlate) === null || _ref3 === void 0 ? void 0 : _ref3.replace(/-/g, ''),
|
|
425
534
|
model,
|
|
426
535
|
chassisNumber,
|
|
427
536
|
priceCalculationDate,
|
|
@@ -468,10 +577,11 @@ const InternalAppointmentForm = _ref => {
|
|
|
468
577
|
branchesByType,
|
|
469
578
|
isLoadingBranchesByType
|
|
470
579
|
} = (0, _queries.useBranchesByType)({
|
|
471
|
-
isTmg
|
|
580
|
+
isTmg,
|
|
581
|
+
isTowCenterBranch,
|
|
472
582
|
searchTerm: companySearchTerm,
|
|
473
583
|
formula,
|
|
474
|
-
ownershipType:
|
|
584
|
+
ownershipType: activeOwnershipType,
|
|
475
585
|
organisationType: branchType
|
|
476
586
|
});
|
|
477
587
|
|
|
@@ -480,66 +590,21 @@ const InternalAppointmentForm = _ref => {
|
|
|
480
590
|
*/
|
|
481
591
|
const handleAutofillButtonClicked = () => {
|
|
482
592
|
var _branchById$kvkNumber, _branchById$vatNumber;
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
491
|
-
payload: {
|
|
492
|
-
email: branchById === null || branchById === void 0 ? void 0 : branchById.email
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
dispatch({
|
|
496
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
497
|
-
payload: {
|
|
498
|
-
phoneNumber: branchById === null || branchById === void 0 ? void 0 : branchById.phone
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
dispatch({
|
|
502
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
503
|
-
payload: {
|
|
504
|
-
zipCode: branchById === null || branchById === void 0 ? void 0 : branchById.postalCode
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
dispatch({
|
|
508
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
509
|
-
payload: {
|
|
510
|
-
streetName: branchById === null || branchById === void 0 ? void 0 : branchById.street
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
dispatch({
|
|
514
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
515
|
-
payload: {
|
|
516
|
-
city: branchById === null || branchById === void 0 ? void 0 : branchById.city
|
|
517
|
-
}
|
|
518
|
-
});
|
|
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) || '');
|
|
519
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;
|
|
520
601
|
if (kvkNumber) {
|
|
521
|
-
|
|
522
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
523
|
-
payload: {
|
|
524
|
-
kvkNumber
|
|
525
|
-
}
|
|
526
|
-
});
|
|
602
|
+
updateCustomerField('kvkNumber', kvkNumber);
|
|
527
603
|
}
|
|
528
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;
|
|
529
605
|
if (vatNumber) {
|
|
530
|
-
|
|
531
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
532
|
-
payload: {
|
|
533
|
-
vatNumber
|
|
534
|
-
}
|
|
535
|
-
});
|
|
606
|
+
updateCustomerField('vatNumber', vatNumber);
|
|
536
607
|
}
|
|
537
|
-
dispatch({
|
|
538
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
539
|
-
payload: {
|
|
540
|
-
houseNumber: branchById === null || branchById === void 0 ? void 0 : branchById.street2
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
608
|
};
|
|
544
609
|
const handleClearAllCustomerFields = () => {
|
|
545
610
|
// Set a new timestamp to force re-renders
|
|
@@ -550,84 +615,12 @@ const InternalAppointmentForm = _ref => {
|
|
|
550
615
|
inputs.forEach(input => {
|
|
551
616
|
input.value = '';
|
|
552
617
|
});
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
});
|
|
559
|
-
dispatch({
|
|
560
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
561
|
-
payload: {
|
|
562
|
-
infix: ''
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
dispatch({
|
|
566
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
567
|
-
payload: {
|
|
568
|
-
lastName: ''
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
dispatch({
|
|
572
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
573
|
-
payload: {
|
|
574
|
-
email: ''
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
dispatch({
|
|
578
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
579
|
-
payload: {
|
|
580
|
-
phoneNumber: ''
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
dispatch({
|
|
584
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
585
|
-
payload: {
|
|
586
|
-
zipCode: ''
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
dispatch({
|
|
590
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
591
|
-
payload: {
|
|
592
|
-
houseNumber: ''
|
|
593
|
-
}
|
|
594
|
-
});
|
|
595
|
-
dispatch({
|
|
596
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
597
|
-
payload: {
|
|
598
|
-
houseNumberAddition: ''
|
|
599
|
-
}
|
|
600
|
-
});
|
|
601
|
-
dispatch({
|
|
602
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
603
|
-
payload: {
|
|
604
|
-
streetName: ''
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
dispatch({
|
|
608
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
609
|
-
payload: {
|
|
610
|
-
city: ''
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
dispatch({
|
|
614
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
615
|
-
payload: {
|
|
616
|
-
companyName: ''
|
|
617
|
-
}
|
|
618
|
-
});
|
|
619
|
-
dispatch({
|
|
620
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
621
|
-
payload: {
|
|
622
|
-
kvkNumber: ''
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
dispatch({
|
|
626
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
627
|
-
payload: {
|
|
628
|
-
vatNumber: ''
|
|
629
|
-
}
|
|
630
|
-
});
|
|
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
|
+
}));
|
|
631
624
|
};
|
|
632
625
|
const initialChannel = channel !== null && channel !== void 0 && channel.channelId ? {
|
|
633
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,
|
|
@@ -644,18 +637,8 @@ const InternalAppointmentForm = _ref => {
|
|
|
644
637
|
const addressInfo = await addressLookupService.lookup(postcode, houseNumber);
|
|
645
638
|
if (addressInfo && addressInfo.street && addressInfo.city) {
|
|
646
639
|
// Auto-fill street and city fields
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
payload: {
|
|
650
|
-
streetName: addressInfo.street
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
dispatch({
|
|
654
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
655
|
-
payload: {
|
|
656
|
-
city: addressInfo.city
|
|
657
|
-
}
|
|
658
|
-
});
|
|
640
|
+
updateCustomerField('streetName', addressInfo.street);
|
|
641
|
+
updateCustomerField('city', addressInfo.city);
|
|
659
642
|
}
|
|
660
643
|
} catch (error) {
|
|
661
644
|
console.error('Address lookup failed:', error);
|
|
@@ -719,12 +702,12 @@ const InternalAppointmentForm = _ref => {
|
|
|
719
702
|
placeholder: "Maak een keuze",
|
|
720
703
|
errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelType']) || (errors === null || errors === void 0 ? void 0 : errors['channelId']),
|
|
721
704
|
initialValue: initialChannel,
|
|
722
|
-
onChange:
|
|
705
|
+
onChange: _ref4 => {
|
|
723
706
|
var _value$kanaalType;
|
|
724
707
|
let {
|
|
725
708
|
label,
|
|
726
709
|
value
|
|
727
|
-
} =
|
|
710
|
+
} = _ref4;
|
|
728
711
|
return dispatch({
|
|
729
712
|
type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
|
|
730
713
|
payload: {
|
|
@@ -739,31 +722,22 @@ const InternalAppointmentForm = _ref => {
|
|
|
739
722
|
}) : null, /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
|
|
740
723
|
name: "ownershipType",
|
|
741
724
|
label: "Type:",
|
|
742
|
-
initialValue:
|
|
725
|
+
initialValue: activeOwnershipType,
|
|
743
726
|
onChange: val => {
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
payload: {
|
|
747
|
-
ownershipType: val
|
|
748
|
-
}
|
|
749
|
-
});
|
|
727
|
+
// Switch to the new ownership type - each type maintains its own separate state
|
|
728
|
+
setActiveOwnershipType(val);
|
|
750
729
|
},
|
|
751
730
|
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
752
731
|
isRequired: true,
|
|
753
732
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['ownershipType']
|
|
754
|
-
}),
|
|
733
|
+
}), activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
755
734
|
className: (0, _helpers__.withStyle)('company-search-container position-relative mt-2 mb-2')
|
|
756
735
|
}, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
757
736
|
placeholder: "Zoek leasemaatschappijen...",
|
|
758
737
|
value: customer.companyName,
|
|
759
738
|
name: "companyName",
|
|
760
739
|
onChange: value => {
|
|
761
|
-
|
|
762
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
763
|
-
payload: {
|
|
764
|
-
companyName: value
|
|
765
|
-
}
|
|
766
|
-
});
|
|
740
|
+
updateCustomerField('companyName', value);
|
|
767
741
|
|
|
768
742
|
// Also update search term if value is different
|
|
769
743
|
if (value !== companySearchTerm) {
|
|
@@ -808,12 +782,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
808
782
|
e.preventDefault();
|
|
809
783
|
|
|
810
784
|
// Only set company name for lease companies, no other autofills
|
|
811
|
-
|
|
812
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
813
|
-
payload: {
|
|
814
|
-
companyName: branch.name
|
|
815
|
-
}
|
|
816
|
-
});
|
|
785
|
+
updateCustomerField('companyName', branch.name);
|
|
817
786
|
setCompanySearchTerm('');
|
|
818
787
|
setIsCompanyInputFocused(false);
|
|
819
788
|
}
|
|
@@ -822,8 +791,8 @@ const InternalAppointmentForm = _ref => {
|
|
|
822
791
|
label: "Factuur betaling door Leasemaatschappij",
|
|
823
792
|
initialValue: invoicePaymentByLeaseCompany,
|
|
824
793
|
onChange: val => {
|
|
825
|
-
// Only allow if
|
|
826
|
-
if (
|
|
794
|
+
// Only allow enabling if hasGoedkeuringsnummerActivity (note with Goedkeuringsnummer attached to dossier)
|
|
795
|
+
if (hasGoedkeuringsnummerActivity) {
|
|
827
796
|
dispatch({
|
|
828
797
|
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY,
|
|
829
798
|
payload: {
|
|
@@ -833,23 +802,18 @@ const InternalAppointmentForm = _ref => {
|
|
|
833
802
|
}
|
|
834
803
|
},
|
|
835
804
|
isRequired: false,
|
|
836
|
-
isDisabled:
|
|
805
|
+
isDisabled: !hasGoedkeuringsnummerActivity
|
|
837
806
|
}))), /*#__PURE__*/_react.default.createElement("h5", {
|
|
838
807
|
className: (0, _helpers__.withStyle)('my-2')
|
|
839
808
|
}, "Persoonlijke gegevens"), /*#__PURE__*/_react.default.createElement("div", {
|
|
840
809
|
className: (0, _helpers__.withStyle)('col-12 col-md-6 mb-2')
|
|
841
|
-
},
|
|
810
|
+
}, activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h6", {
|
|
842
811
|
className: (0, _helpers__.withStyle)('modal-title mb-2')
|
|
843
812
|
}, "Gegevens klant:"), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
844
813
|
placeholder: "",
|
|
845
814
|
value: customer.firstName,
|
|
846
815
|
name: "firstName",
|
|
847
|
-
onChange: value =>
|
|
848
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
|
|
849
|
-
payload: {
|
|
850
|
-
firstName: value
|
|
851
|
-
}
|
|
852
|
-
}),
|
|
816
|
+
onChange: value => updateCustomerField('firstName', value),
|
|
853
817
|
isRequired: true,
|
|
854
818
|
form: "appointment",
|
|
855
819
|
label: "Voornaam:",
|
|
@@ -859,12 +823,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
859
823
|
placeholder: "",
|
|
860
824
|
value: customer.infix,
|
|
861
825
|
name: "infix",
|
|
862
|
-
onChange: value =>
|
|
863
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
864
|
-
payload: {
|
|
865
|
-
infix: value
|
|
866
|
-
}
|
|
867
|
-
}),
|
|
826
|
+
onChange: value => updateCustomerField('infix', value),
|
|
868
827
|
isRequired: false,
|
|
869
828
|
form: "appointment",
|
|
870
829
|
label: "Tussenvoegsel:",
|
|
@@ -873,12 +832,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
873
832
|
placeholder: "",
|
|
874
833
|
value: customer.lastName,
|
|
875
834
|
name: "lastName",
|
|
876
|
-
onChange: value =>
|
|
877
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
878
|
-
payload: {
|
|
879
|
-
lastName: value
|
|
880
|
-
}
|
|
881
|
-
}),
|
|
835
|
+
onChange: value => updateCustomerField('lastName', value),
|
|
882
836
|
isRequired: true,
|
|
883
837
|
form: "appointment",
|
|
884
838
|
label: "Achternaam:",
|
|
@@ -887,12 +841,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
887
841
|
placeholder: "",
|
|
888
842
|
value: customer.email,
|
|
889
843
|
name: "email",
|
|
890
|
-
onChange: value =>
|
|
891
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
892
|
-
payload: {
|
|
893
|
-
email: value
|
|
894
|
-
}
|
|
895
|
-
}),
|
|
844
|
+
onChange: value => updateCustomerField('email', value),
|
|
896
845
|
isRequired: true,
|
|
897
846
|
form: "appointment",
|
|
898
847
|
label: "E-mailadres:",
|
|
@@ -901,26 +850,16 @@ const InternalAppointmentForm = _ref => {
|
|
|
901
850
|
placeholder: "",
|
|
902
851
|
value: customer.phoneNumber,
|
|
903
852
|
name: "phoneNumber",
|
|
904
|
-
onChange: value =>
|
|
905
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
906
|
-
payload: {
|
|
907
|
-
phoneNumber: value
|
|
908
|
-
}
|
|
909
|
-
}),
|
|
853
|
+
onChange: value => updateCustomerField('phoneNumber', value),
|
|
910
854
|
isRequired: true,
|
|
911
855
|
label: "Telefoonnummer:",
|
|
912
856
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber'],
|
|
913
857
|
key: "phoneNumber-".concat(refreshKey)
|
|
914
|
-
})) :
|
|
858
|
+
})) : activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
915
859
|
placeholder: "",
|
|
916
860
|
value: customer.firstName,
|
|
917
861
|
name: "firstName",
|
|
918
|
-
onChange: value =>
|
|
919
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
|
|
920
|
-
payload: {
|
|
921
|
-
firstName: value
|
|
922
|
-
}
|
|
923
|
-
}),
|
|
862
|
+
onChange: value => updateCustomerField('firstName', value),
|
|
924
863
|
key: "firstName-".concat(refreshKey),
|
|
925
864
|
isRequired: true,
|
|
926
865
|
form: "appointment",
|
|
@@ -930,12 +869,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
930
869
|
placeholder: "",
|
|
931
870
|
value: customer.infix,
|
|
932
871
|
name: "infix",
|
|
933
|
-
onChange: value =>
|
|
934
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
935
|
-
payload: {
|
|
936
|
-
infix: value
|
|
937
|
-
}
|
|
938
|
-
}),
|
|
872
|
+
onChange: value => updateCustomerField('infix', value),
|
|
939
873
|
key: "infix-".concat(refreshKey),
|
|
940
874
|
isRequired: false,
|
|
941
875
|
form: "appointment",
|
|
@@ -945,12 +879,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
945
879
|
placeholder: "",
|
|
946
880
|
value: customer.lastName,
|
|
947
881
|
name: "lastName",
|
|
948
|
-
onChange: value =>
|
|
949
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
950
|
-
payload: {
|
|
951
|
-
lastName: value
|
|
952
|
-
}
|
|
953
|
-
}),
|
|
882
|
+
onChange: value => updateCustomerField('lastName', value),
|
|
954
883
|
key: "lastName-".concat(refreshKey),
|
|
955
884
|
isRequired: true,
|
|
956
885
|
form: "appointment",
|
|
@@ -960,12 +889,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
960
889
|
placeholder: "",
|
|
961
890
|
value: customer.email,
|
|
962
891
|
name: "email",
|
|
963
|
-
onChange: value =>
|
|
964
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
965
|
-
payload: {
|
|
966
|
-
email: value
|
|
967
|
-
}
|
|
968
|
-
}),
|
|
892
|
+
onChange: value => updateCustomerField('email', value),
|
|
969
893
|
key: "email-".concat(refreshKey),
|
|
970
894
|
isRequired: true,
|
|
971
895
|
form: "appointment",
|
|
@@ -975,12 +899,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
975
899
|
placeholder: "",
|
|
976
900
|
value: customer.phoneNumber,
|
|
977
901
|
name: "phoneNumber",
|
|
978
|
-
onChange: value =>
|
|
979
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
980
|
-
payload: {
|
|
981
|
-
phoneNumber: value
|
|
982
|
-
}
|
|
983
|
-
}),
|
|
902
|
+
onChange: value => updateCustomerField('phoneNumber', value),
|
|
984
903
|
isRequired: true,
|
|
985
904
|
label: "Telefoonnummer:",
|
|
986
905
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber'],
|
|
@@ -989,12 +908,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
989
908
|
placeholder: "",
|
|
990
909
|
value: customer.firstName,
|
|
991
910
|
name: "firstName",
|
|
992
|
-
onChange: value =>
|
|
993
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
|
|
994
|
-
payload: {
|
|
995
|
-
firstName: value
|
|
996
|
-
}
|
|
997
|
-
}),
|
|
911
|
+
onChange: value => updateCustomerField('firstName', value),
|
|
998
912
|
key: "firstName-".concat(refreshKey),
|
|
999
913
|
isRequired: true,
|
|
1000
914
|
form: "appointment",
|
|
@@ -1004,12 +918,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1004
918
|
placeholder: "",
|
|
1005
919
|
value: customer.infix,
|
|
1006
920
|
name: "infix",
|
|
1007
|
-
onChange: value =>
|
|
1008
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
|
|
1009
|
-
payload: {
|
|
1010
|
-
infix: value
|
|
1011
|
-
}
|
|
1012
|
-
}),
|
|
921
|
+
onChange: value => updateCustomerField('infix', value),
|
|
1013
922
|
key: "infix-".concat(refreshKey),
|
|
1014
923
|
isRequired: false,
|
|
1015
924
|
form: "appointment",
|
|
@@ -1019,12 +928,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1019
928
|
placeholder: "",
|
|
1020
929
|
value: customer.lastName,
|
|
1021
930
|
name: "lastName",
|
|
1022
|
-
onChange: value =>
|
|
1023
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
1024
|
-
payload: {
|
|
1025
|
-
lastName: value
|
|
1026
|
-
}
|
|
1027
|
-
}),
|
|
931
|
+
onChange: value => updateCustomerField('lastName', value),
|
|
1028
932
|
key: "lastName-".concat(refreshKey),
|
|
1029
933
|
isRequired: true,
|
|
1030
934
|
form: "appointment",
|
|
@@ -1034,12 +938,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1034
938
|
placeholder: "",
|
|
1035
939
|
value: customer.email,
|
|
1036
940
|
name: "email",
|
|
1037
|
-
onChange: value =>
|
|
1038
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
|
|
1039
|
-
payload: {
|
|
1040
|
-
email: value
|
|
1041
|
-
}
|
|
1042
|
-
}),
|
|
941
|
+
onChange: value => updateCustomerField('email', value),
|
|
1043
942
|
key: "email-".concat(refreshKey),
|
|
1044
943
|
isRequired: true,
|
|
1045
944
|
form: "appointment",
|
|
@@ -1047,7 +946,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1047
946
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['email']
|
|
1048
947
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
1049
948
|
className: (0, _helpers__.withStyle)('col-12 col-md-6')
|
|
1050
|
-
},
|
|
949
|
+
}, activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h6", {
|
|
1051
950
|
className: (0, _helpers__.withStyle)('modal-title mb-2')
|
|
1052
951
|
}, "Gegevens bedrijf:"), /*#__PURE__*/_react.default.createElement("div", {
|
|
1053
952
|
className: (0, _helpers__.withStyle)('company-search-container position-relative mb-3')
|
|
@@ -1066,12 +965,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1066
965
|
name: "companyName",
|
|
1067
966
|
onChange: value => {
|
|
1068
967
|
// Update company name in state
|
|
1069
|
-
|
|
1070
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
1071
|
-
payload: {
|
|
1072
|
-
companyName: value
|
|
1073
|
-
}
|
|
1074
|
-
});
|
|
968
|
+
updateCustomerField('companyName', value);
|
|
1075
969
|
|
|
1076
970
|
// Also update search term if value is different
|
|
1077
971
|
if (value !== companySearchTerm) {
|
|
@@ -1117,77 +1011,32 @@ const InternalAppointmentForm = _ref => {
|
|
|
1117
1011
|
onMouseDown: e => {
|
|
1118
1012
|
var _branch$vatNumber, _branch$kvkNumber;
|
|
1119
1013
|
e.preventDefault();
|
|
1120
|
-
|
|
1121
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
|
|
1122
|
-
payload: {
|
|
1123
|
-
companyName: branch.name
|
|
1124
|
-
}
|
|
1125
|
-
});
|
|
1014
|
+
updateCustomerField('companyName', branch.name);
|
|
1126
1015
|
if (branch.postalCode) {
|
|
1127
|
-
|
|
1128
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
1129
|
-
payload: {
|
|
1130
|
-
zipCode: branch.postalCode
|
|
1131
|
-
}
|
|
1132
|
-
});
|
|
1016
|
+
updateCustomerField('zipCode', branch.postalCode);
|
|
1133
1017
|
}
|
|
1134
1018
|
if (branch.street) {
|
|
1135
|
-
|
|
1136
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
1137
|
-
payload: {
|
|
1138
|
-
streetName: branch.street
|
|
1139
|
-
}
|
|
1140
|
-
});
|
|
1019
|
+
updateCustomerField('streetName', branch.street);
|
|
1141
1020
|
}
|
|
1142
1021
|
if (branch.city) {
|
|
1143
|
-
|
|
1144
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
1145
|
-
payload: {
|
|
1146
|
-
city: branch.city
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1022
|
+
updateCustomerField('city', branch.city);
|
|
1149
1023
|
}
|
|
1150
1024
|
if (branch.street2) {
|
|
1151
|
-
|
|
1152
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
1153
|
-
payload: {
|
|
1154
|
-
houseNumber: branch.street2
|
|
1155
|
-
}
|
|
1156
|
-
});
|
|
1025
|
+
updateCustomerField('houseNumber', branch.street2);
|
|
1157
1026
|
}
|
|
1158
1027
|
const vatNumber = (_branch$vatNumber = branch.vatNumber) !== null && _branch$vatNumber !== void 0 ? _branch$vatNumber : branch.btwNummer;
|
|
1159
1028
|
if (vatNumber) {
|
|
1160
|
-
|
|
1161
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
1162
|
-
payload: {
|
|
1163
|
-
vatNumber
|
|
1164
|
-
}
|
|
1165
|
-
});
|
|
1029
|
+
updateCustomerField('vatNumber', vatNumber);
|
|
1166
1030
|
}
|
|
1167
1031
|
const kvkNumber = (_branch$kvkNumber = branch.kvkNumber) !== null && _branch$kvkNumber !== void 0 ? _branch$kvkNumber : branch.kvkNummer;
|
|
1168
1032
|
if (kvkNumber) {
|
|
1169
|
-
|
|
1170
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
1171
|
-
payload: {
|
|
1172
|
-
kvkNumber
|
|
1173
|
-
}
|
|
1174
|
-
});
|
|
1033
|
+
updateCustomerField('kvkNumber', kvkNumber);
|
|
1175
1034
|
}
|
|
1176
1035
|
if (branch.huisnummerToevoeging) {
|
|
1177
|
-
|
|
1178
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
1179
|
-
payload: {
|
|
1180
|
-
houseNumberAddition: branch.huisnummerToevoeging
|
|
1181
|
-
}
|
|
1182
|
-
});
|
|
1036
|
+
updateCustomerField('houseNumberAddition', branch.huisnummerToevoeging);
|
|
1183
1037
|
}
|
|
1184
1038
|
if (branch.country && branch.country.entityId) {
|
|
1185
|
-
|
|
1186
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
1187
|
-
payload: {
|
|
1188
|
-
countryId: branch.country.entityId
|
|
1189
|
-
}
|
|
1190
|
-
});
|
|
1039
|
+
updateCustomerField('countryId', branch.country.entityId);
|
|
1191
1040
|
setRefreshKey(Date.now());
|
|
1192
1041
|
}
|
|
1193
1042
|
setCompanySearchTerm('');
|
|
@@ -1197,12 +1046,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1197
1046
|
placeholder: "",
|
|
1198
1047
|
value: customer.kvkNumber,
|
|
1199
1048
|
name: "kvkNumber",
|
|
1200
|
-
onChange: value =>
|
|
1201
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
1202
|
-
payload: {
|
|
1203
|
-
kvkNumber: value
|
|
1204
|
-
}
|
|
1205
|
-
}),
|
|
1049
|
+
onChange: value => updateCustomerField('kvkNumber', value),
|
|
1206
1050
|
key: "kvkNumber-".concat(refreshKey),
|
|
1207
1051
|
isRequired: shouldRequireKvkNumber,
|
|
1208
1052
|
form: "quotation",
|
|
@@ -1212,12 +1056,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1212
1056
|
placeholder: "",
|
|
1213
1057
|
value: customer.vatNumber,
|
|
1214
1058
|
name: "vatNumber",
|
|
1215
|
-
onChange: value =>
|
|
1216
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
1217
|
-
payload: {
|
|
1218
|
-
vatNumber: value
|
|
1219
|
-
}
|
|
1220
|
-
}),
|
|
1059
|
+
onChange: value => updateCustomerField('vatNumber', value),
|
|
1221
1060
|
key: "vatNumber-".concat(refreshKey),
|
|
1222
1061
|
isRequired: shouldRequireVatNumber,
|
|
1223
1062
|
form: "quotation",
|
|
@@ -1228,12 +1067,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1228
1067
|
value: customer.zipCode,
|
|
1229
1068
|
name: "zipCode",
|
|
1230
1069
|
onChange: value => {
|
|
1231
|
-
|
|
1232
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
1233
|
-
payload: {
|
|
1234
|
-
zipCode: value
|
|
1235
|
-
}
|
|
1236
|
-
});
|
|
1070
|
+
updateCustomerField('zipCode', value);
|
|
1237
1071
|
// Trigger address lookup if house number is also available
|
|
1238
1072
|
if (customer.houseNumber) {
|
|
1239
1073
|
handleAddressLookup(value, customer.houseNumber);
|
|
@@ -1248,12 +1082,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1248
1082
|
value: customer.houseNumber,
|
|
1249
1083
|
name: "houseNumber",
|
|
1250
1084
|
onChange: value => {
|
|
1251
|
-
|
|
1252
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
1253
|
-
payload: {
|
|
1254
|
-
houseNumber: value
|
|
1255
|
-
}
|
|
1256
|
-
});
|
|
1085
|
+
updateCustomerField('houseNumber', value);
|
|
1257
1086
|
// Trigger address lookup if postcode is also available
|
|
1258
1087
|
if (customer.zipCode) {
|
|
1259
1088
|
handleAddressLookup(customer.zipCode, value);
|
|
@@ -1267,12 +1096,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1267
1096
|
placeholder: "",
|
|
1268
1097
|
value: customer.houseNumberAddition,
|
|
1269
1098
|
name: "houseNumberAddition",
|
|
1270
|
-
onChange: value =>
|
|
1271
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
1272
|
-
payload: {
|
|
1273
|
-
houseNumberAddition: value
|
|
1274
|
-
}
|
|
1275
|
-
}),
|
|
1099
|
+
onChange: value => updateCustomerField('houseNumberAddition', value),
|
|
1276
1100
|
key: "houseNumberAddition-".concat(refreshKey),
|
|
1277
1101
|
isRequired: false,
|
|
1278
1102
|
label: "Huisnummer toevoeging:",
|
|
@@ -1281,12 +1105,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1281
1105
|
placeholder: addressLookupLoading ? 'Adres wordt opgezocht...' : '',
|
|
1282
1106
|
value: customer.streetName,
|
|
1283
1107
|
name: "streetName",
|
|
1284
|
-
onChange: value =>
|
|
1285
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
1286
|
-
payload: {
|
|
1287
|
-
streetName: value
|
|
1288
|
-
}
|
|
1289
|
-
}),
|
|
1108
|
+
onChange: value => updateCustomerField('streetName', value),
|
|
1290
1109
|
key: "streetName-".concat(refreshKey),
|
|
1291
1110
|
isRequired: true,
|
|
1292
1111
|
label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1295,12 +1114,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1295
1114
|
placeholder: addressLookupLoading ? 'Stad wordt opgezocht...' : '',
|
|
1296
1115
|
value: customer.city,
|
|
1297
1116
|
name: "city",
|
|
1298
|
-
onChange: value =>
|
|
1299
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
1300
|
-
payload: {
|
|
1301
|
-
city: value
|
|
1302
|
-
}
|
|
1303
|
-
}),
|
|
1117
|
+
onChange: value => updateCustomerField('city', value),
|
|
1304
1118
|
key: "city-".concat(refreshKey),
|
|
1305
1119
|
isRequired: true,
|
|
1306
1120
|
label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1316,10 +1130,10 @@ const InternalAppointmentForm = _ref => {
|
|
|
1316
1130
|
placeholder: "Selecteer een land",
|
|
1317
1131
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
|
|
1318
1132
|
initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
|
|
1319
|
-
onChange:
|
|
1133
|
+
onChange: _ref5 => {
|
|
1320
1134
|
let {
|
|
1321
1135
|
value
|
|
1322
|
-
} =
|
|
1136
|
+
} = _ref5;
|
|
1323
1137
|
return dispatch({
|
|
1324
1138
|
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
1325
1139
|
payload: {
|
|
@@ -1327,17 +1141,12 @@ const InternalAppointmentForm = _ref => {
|
|
|
1327
1141
|
}
|
|
1328
1142
|
});
|
|
1329
1143
|
}
|
|
1330
|
-
})) :
|
|
1144
|
+
})) : activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
1331
1145
|
placeholder: "",
|
|
1332
1146
|
value: customer.zipCode,
|
|
1333
1147
|
name: "zipCode",
|
|
1334
1148
|
onChange: value => {
|
|
1335
|
-
|
|
1336
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
1337
|
-
payload: {
|
|
1338
|
-
zipCode: value
|
|
1339
|
-
}
|
|
1340
|
-
});
|
|
1149
|
+
updateCustomerField('zipCode', value);
|
|
1341
1150
|
// Trigger address lookup if house number is also available
|
|
1342
1151
|
if (customer.houseNumber) {
|
|
1343
1152
|
handleAddressLookup(value, customer.houseNumber);
|
|
@@ -1352,12 +1161,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1352
1161
|
value: customer.houseNumber,
|
|
1353
1162
|
name: "houseNumber",
|
|
1354
1163
|
onChange: value => {
|
|
1355
|
-
|
|
1356
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
1357
|
-
payload: {
|
|
1358
|
-
houseNumber: value
|
|
1359
|
-
}
|
|
1360
|
-
});
|
|
1164
|
+
updateCustomerField('houseNumber', value);
|
|
1361
1165
|
// Trigger address lookup if postcode is also available
|
|
1362
1166
|
if (customer.zipCode) {
|
|
1363
1167
|
handleAddressLookup(customer.zipCode, value);
|
|
@@ -1371,12 +1175,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1371
1175
|
placeholder: "",
|
|
1372
1176
|
value: customer.houseNumberAddition,
|
|
1373
1177
|
name: "houseNumberAddition",
|
|
1374
|
-
onChange: value =>
|
|
1375
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
1376
|
-
payload: {
|
|
1377
|
-
houseNumberAddition: value
|
|
1378
|
-
}
|
|
1379
|
-
}),
|
|
1178
|
+
onChange: value => updateCustomerField('houseNumberAddition', value),
|
|
1380
1179
|
key: "houseNumberAddition-".concat(refreshKey),
|
|
1381
1180
|
isRequired: false,
|
|
1382
1181
|
label: "Huisnummer toevoeging:",
|
|
@@ -1385,12 +1184,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1385
1184
|
placeholder: addressLookupLoading ? 'Adres wordt opgezocht...' : '',
|
|
1386
1185
|
value: customer.streetName,
|
|
1387
1186
|
name: "streetName",
|
|
1388
|
-
onChange: value =>
|
|
1389
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
1390
|
-
payload: {
|
|
1391
|
-
streetName: value
|
|
1392
|
-
}
|
|
1393
|
-
}),
|
|
1187
|
+
onChange: value => updateCustomerField('streetName', value),
|
|
1394
1188
|
key: "streetName-".concat(refreshKey),
|
|
1395
1189
|
isRequired: true,
|
|
1396
1190
|
label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1399,12 +1193,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1399
1193
|
placeholder: addressLookupLoading ? 'Stad wordt opgezocht...' : '',
|
|
1400
1194
|
value: customer.city,
|
|
1401
1195
|
name: "city",
|
|
1402
|
-
onChange: value =>
|
|
1403
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
1404
|
-
payload: {
|
|
1405
|
-
city: value
|
|
1406
|
-
}
|
|
1407
|
-
}),
|
|
1196
|
+
onChange: value => updateCustomerField('city', value),
|
|
1408
1197
|
key: "city-".concat(refreshKey),
|
|
1409
1198
|
isRequired: true,
|
|
1410
1199
|
label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1420,10 +1209,10 @@ const InternalAppointmentForm = _ref => {
|
|
|
1420
1209
|
placeholder: "Selecteer een land",
|
|
1421
1210
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
|
|
1422
1211
|
initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
|
|
1423
|
-
onChange:
|
|
1212
|
+
onChange: _ref6 => {
|
|
1424
1213
|
let {
|
|
1425
1214
|
value
|
|
1426
|
-
} =
|
|
1215
|
+
} = _ref6;
|
|
1427
1216
|
return dispatch({
|
|
1428
1217
|
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
1429
1218
|
payload: {
|
|
@@ -1435,12 +1224,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1435
1224
|
placeholder: "",
|
|
1436
1225
|
value: customer.phoneNumber,
|
|
1437
1226
|
name: "phoneNumber",
|
|
1438
|
-
onChange: value =>
|
|
1439
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
|
|
1440
|
-
payload: {
|
|
1441
|
-
phoneNumber: value
|
|
1442
|
-
}
|
|
1443
|
-
}),
|
|
1227
|
+
onChange: value => updateCustomerField('phoneNumber', value),
|
|
1444
1228
|
isRequired: true,
|
|
1445
1229
|
label: "Telefoonnummer:",
|
|
1446
1230
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber'],
|
|
@@ -1450,12 +1234,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1450
1234
|
value: customer.zipCode,
|
|
1451
1235
|
name: "zipCode",
|
|
1452
1236
|
onChange: value => {
|
|
1453
|
-
|
|
1454
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
|
|
1455
|
-
payload: {
|
|
1456
|
-
zipCode: value
|
|
1457
|
-
}
|
|
1458
|
-
});
|
|
1237
|
+
updateCustomerField('zipCode', value);
|
|
1459
1238
|
// Trigger address lookup if house number is also available
|
|
1460
1239
|
if (customer.houseNumber) {
|
|
1461
1240
|
handleAddressLookup(value, customer.houseNumber);
|
|
@@ -1470,12 +1249,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1470
1249
|
value: customer.houseNumber,
|
|
1471
1250
|
name: "houseNumber",
|
|
1472
1251
|
onChange: value => {
|
|
1473
|
-
|
|
1474
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
1475
|
-
payload: {
|
|
1476
|
-
houseNumber: value
|
|
1477
|
-
}
|
|
1478
|
-
});
|
|
1252
|
+
updateCustomerField('houseNumber', value);
|
|
1479
1253
|
// Trigger address lookup if postcode is also available
|
|
1480
1254
|
if (customer.zipCode) {
|
|
1481
1255
|
handleAddressLookup(customer.zipCode, value);
|
|
@@ -1489,12 +1263,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1489
1263
|
placeholder: "",
|
|
1490
1264
|
value: customer.houseNumberAddition,
|
|
1491
1265
|
name: "houseNumberAddition",
|
|
1492
|
-
onChange: value =>
|
|
1493
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
|
|
1494
|
-
payload: {
|
|
1495
|
-
houseNumberAddition: value
|
|
1496
|
-
}
|
|
1497
|
-
}),
|
|
1266
|
+
onChange: value => updateCustomerField('houseNumberAddition', value),
|
|
1498
1267
|
key: "houseNumberAddition-".concat(refreshKey),
|
|
1499
1268
|
isRequired: false,
|
|
1500
1269
|
label: "Huisnummer toevoeging:",
|
|
@@ -1503,12 +1272,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1503
1272
|
placeholder: addressLookupLoading ? 'Adres wordt opgezocht...' : '',
|
|
1504
1273
|
value: customer.streetName,
|
|
1505
1274
|
name: "streetName",
|
|
1506
|
-
onChange: value =>
|
|
1507
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
|
|
1508
|
-
payload: {
|
|
1509
|
-
streetName: value
|
|
1510
|
-
}
|
|
1511
|
-
}),
|
|
1275
|
+
onChange: value => updateCustomerField('streetName', value),
|
|
1512
1276
|
key: "streetName-".concat(refreshKey),
|
|
1513
1277
|
isRequired: true,
|
|
1514
1278
|
label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1517,12 +1281,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1517
1281
|
placeholder: addressLookupLoading ? 'Stad wordt opgezocht...' : '',
|
|
1518
1282
|
value: customer.city,
|
|
1519
1283
|
name: "city",
|
|
1520
|
-
onChange: value =>
|
|
1521
|
-
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
|
|
1522
|
-
payload: {
|
|
1523
|
-
city: value
|
|
1524
|
-
}
|
|
1525
|
-
}),
|
|
1284
|
+
onChange: value => updateCustomerField('city', value),
|
|
1526
1285
|
key: "city-".concat(refreshKey),
|
|
1527
1286
|
isRequired: true,
|
|
1528
1287
|
label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
@@ -1538,10 +1297,10 @@ const InternalAppointmentForm = _ref => {
|
|
|
1538
1297
|
placeholder: "Selecteer een land",
|
|
1539
1298
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
|
|
1540
1299
|
initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
|
|
1541
|
-
onChange:
|
|
1300
|
+
onChange: _ref7 => {
|
|
1542
1301
|
let {
|
|
1543
1302
|
value
|
|
1544
|
-
} =
|
|
1303
|
+
} = _ref7;
|
|
1545
1304
|
return dispatch({
|
|
1546
1305
|
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
1547
1306
|
payload: {
|
|
@@ -1557,7 +1316,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1557
1316
|
className: (0, _helpers__.withStyle)('modal-title col-12 mb-2')
|
|
1558
1317
|
}, "Gegevens van de auto ", /*#__PURE__*/_react.default.createElement("br", null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
1559
1318
|
className: (0, _helpers__.withStyle)('col-12')
|
|
1560
|
-
},
|
|
1319
|
+
}, activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
1561
1320
|
key: "leaseNumber",
|
|
1562
1321
|
placeholder: "",
|
|
1563
1322
|
value: vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber,
|