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.
@@ -121,6 +121,24 @@ function _toPrimitive(t, r) {
121
121
  return ("string" === r ? String : Number)(t);
122
122
  }
123
123
  const licensePlateValidator = new _LicensePlateValidator.default();
124
+
125
+ // Empty customer state template
126
+ const getEmptyCustomerState = () => ({
127
+ firstName: '',
128
+ infix: '',
129
+ lastName: '',
130
+ email: '',
131
+ phoneNumber: '',
132
+ zipCode: '',
133
+ houseNumber: '',
134
+ houseNumberAddition: '',
135
+ streetName: '',
136
+ city: '',
137
+ companyName: '',
138
+ kvkNumber: '',
139
+ vatNumber: '',
140
+ countryId: ''
141
+ });
124
142
  const internalQuotationFormSchema = (0, _yup.object)({
125
143
  ownershipType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
126
144
  leaseNumber: (0, _yup.string)().nullable(),
@@ -162,7 +180,7 @@ const InternalQuotationForm = _ref => {
162
180
  } = _ref;
163
181
  const [{
164
182
  vehicle,
165
- customer,
183
+ customer: contextCustomer,
166
184
  licensePlate,
167
185
  licensePlateBrandModel,
168
186
  model,
@@ -185,11 +203,103 @@ const InternalQuotationForm = _ref => {
185
203
  selectedExtras,
186
204
  vehicleCodingDiscountPercentage,
187
205
  consumerDiscounts,
188
- montageRate
206
+ montageRate,
207
+ isTowCenterBranch
189
208
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
190
209
  const [errors, setErrors] = (0, _react.useState)({});
191
210
  const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
192
211
  const [isCompanyInputFocused, setIsCompanyInputFocused] = (0, _react.useState)(false);
212
+ const [refreshKey, setRefreshKey] = (0, _react.useState)(Date.now());
213
+
214
+ // Track the original ownership type from context
215
+ const [originalOwnershipType] = (0, _react.useState)(() => (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) || _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier);
216
+
217
+ // Current active ownership type (local state for tab switching)
218
+ const [activeOwnershipType, setActiveOwnershipType] = (0, _react.useState)(originalOwnershipType);
219
+
220
+ // Separate customer state for each ownership type
221
+ const [customerDataPerType, setCustomerDataPerType] = (0, _react.useState)(() => {
222
+ const emptyState = getEmptyCustomerState();
223
+ const initialCustomerData = {
224
+ firstName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.firstName) || '',
225
+ infix: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.infix) || '',
226
+ lastName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.lastName) || '',
227
+ email: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.email) || '',
228
+ phoneNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.phoneNumber) || '',
229
+ zipCode: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.zipCode) || '',
230
+ houseNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.houseNumber) || '',
231
+ houseNumberAddition: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.houseNumberAddition) || '',
232
+ streetName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.streetName) || '',
233
+ city: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.city) || '',
234
+ companyName: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.companyName) || '',
235
+ kvkNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.kvkNumber) || '',
236
+ vatNumber: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.vatNumber) || '',
237
+ countryId: (contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.countryId) || ''
238
+ };
239
+
240
+ // Only the original ownership type gets the initial data
241
+ return {
242
+ [_constants__.VEHICLE_OWNERSHIP_TYPE.Particulier]: originalOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier ? _objectSpread({}, initialCustomerData) : _objectSpread({}, emptyState),
243
+ [_constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk]: originalOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? _objectSpread({}, initialCustomerData) : _objectSpread({}, emptyState),
244
+ [_constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij]: originalOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? _objectSpread({}, initialCustomerData) : _objectSpread({}, emptyState)
245
+ };
246
+ });
247
+
248
+ // Get customer data for the active ownership type
249
+ const customer = customerDataPerType[activeOwnershipType];
250
+
251
+ // Helper to update customer data for the active ownership type
252
+ const updateCustomerField = (0, _react.useCallback)((field, value) => {
253
+ setCustomerDataPerType(prev => _objectSpread(_objectSpread({}, prev), {}, {
254
+ [activeOwnershipType]: _objectSpread(_objectSpread({}, prev[activeOwnershipType]), {}, {
255
+ [field]: value
256
+ })
257
+ }));
258
+ }, [activeOwnershipType]);
259
+
260
+ // Sync active ownership type to context when it changes
261
+ (0, _react.useEffect)(() => {
262
+ if (activeOwnershipType !== (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType)) {
263
+ dispatch({
264
+ type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_OWNERSHIP_TYPE,
265
+ payload: {
266
+ ownershipType: activeOwnershipType
267
+ }
268
+ });
269
+ }
270
+ }, [activeOwnershipType, vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType, dispatch]);
271
+
272
+ // Sync customer data to context when it changes (for the active tab)
273
+ (0, _react.useEffect)(() => {
274
+ const currentData = customerDataPerType[activeOwnershipType];
275
+ const actionMap = {
276
+ firstName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
277
+ infix: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
278
+ lastName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
279
+ email: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
280
+ phoneNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
281
+ zipCode: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
282
+ houseNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
283
+ houseNumberAddition: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
284
+ streetName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
285
+ city: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
286
+ companyName: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
287
+ kvkNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
288
+ vatNumber: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
289
+ countryId: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID
290
+ };
291
+ Object.entries(currentData).forEach(_ref2 => {
292
+ let [field, value] = _ref2;
293
+ if (actionMap[field]) {
294
+ dispatch({
295
+ type: actionMap[field],
296
+ payload: {
297
+ [field]: value
298
+ }
299
+ });
300
+ }
301
+ });
302
+ }, [activeOwnershipType, customerDataPerType, dispatch]);
193
303
  const [_licensePlate, _setLicensePlate] = (0, _react.useState)(licensePlate);
194
304
  const isTmg = (0, _useIsTmg.useIsTmg)();
195
305
  const {
@@ -232,9 +342,11 @@ const InternalQuotationForm = _ref => {
232
342
  branchesByType,
233
343
  isLoadingBranchesByType
234
344
  } = (0, _queries.useBranchesByType)({
345
+ isTmg,
346
+ isTowCenterBranch,
235
347
  searchTerm: companySearchTerm,
236
348
  formula,
237
- ownershipType: vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType,
349
+ ownershipType: activeOwnershipType,
238
350
  organisationType: branchType
239
351
  });
240
352
  const countryOptions = (0, _react.useMemo)(() => {
@@ -305,7 +417,7 @@ const InternalQuotationForm = _ref => {
305
417
  */
306
418
  const handleSubmit = async () => {
307
419
  try {
308
- var _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _customer$note, _customer$zipCode, _customer$companyName, _ref2;
420
+ var _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _customer$note, _customer$zipCode, _customer$companyName, _ref3;
309
421
  setErrors(null);
310
422
  if (!model) {
311
423
  // Note: this does not throw on error.
@@ -319,7 +431,7 @@ const InternalQuotationForm = _ref => {
319
431
  }
320
432
 
321
433
  // Validate lease number for lease company vehicles
322
- if ((vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij) {
434
+ if (activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij) {
323
435
  if ((!(vehicle !== null && vehicle !== void 0 && vehicle.leaseNumber) || (vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber) === '') && !(vehicle !== null && vehicle !== void 0 && vehicle.leaseNumberUnknown)) {
324
436
  setErrors(prev => _objectSpread(_objectSpread({}, prev), {}, {
325
437
  leaseNumber: _constants__.FORM_ERROR_MESSAGES.leaseNumber || 'Goedkeuringsnummer is verplicht of geef aan dat het onbekend is'
@@ -362,7 +474,7 @@ const InternalQuotationForm = _ref => {
362
474
  })),
363
475
  chassisNumber: chassisNumber !== null && chassisNumber !== void 0 ? chassisNumber : undefined,
364
476
  channel,
365
- licensePlate: (_ref2 = licensePlate || _licensePlate) === null || _ref2 === void 0 ? void 0 : _ref2.replace(/-/g, ''),
477
+ licensePlate: (_ref3 = licensePlate || _licensePlate) === null || _ref3 === void 0 ? void 0 : _ref3.replace(/-/g, ''),
366
478
  model,
367
479
  answers: (0, _helpers__.removeNullishProps)({
368
480
  duration: durationAnswer,
@@ -422,79 +534,11 @@ const InternalQuotationForm = _ref => {
422
534
  input.value = '';
423
535
  });
424
536
 
425
- // Display success message
426
- setClearSuccess(true);
427
-
428
- // Hide success message after 2 seconds
429
- setTimeout(() => {
430
- setClearSuccess(false);
431
- }, 2000);
432
- dispatch({
433
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
434
- payload: {
435
- firstName: ''
436
- }
437
- });
438
- dispatch({
439
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
440
- payload: {
441
- infix: ''
442
- }
443
- });
444
- dispatch({
445
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
446
- payload: {
447
- lastName: ''
448
- }
449
- });
450
- dispatch({
451
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
452
- payload: {
453
- email: ''
454
- }
455
- });
456
- dispatch({
457
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
458
- payload: {
459
- phoneNumber: ''
460
- }
461
- });
462
- dispatch({
463
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
464
- payload: {
465
- zipCode: ''
466
- }
467
- });
468
- dispatch({
469
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
470
- payload: {
471
- houseNumber: ''
472
- }
473
- });
474
- dispatch({
475
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
476
- payload: {
477
- houseNumberAddition: ''
478
- }
479
- });
480
- dispatch({
481
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
482
- payload: {
483
- streetName: ''
484
- }
485
- });
486
- dispatch({
487
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
488
- payload: {
489
- city: ''
490
- }
491
- });
492
- dispatch({
493
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
494
- payload: {
495
- companyName: ''
496
- }
497
- });
537
+ // Clear all customer fields in the local state for the active ownership type
538
+ const emptyState = getEmptyCustomerState();
539
+ setCustomerDataPerType(prev => _objectSpread(_objectSpread({}, prev), {}, {
540
+ [activeOwnershipType]: emptyState
541
+ }));
498
542
  };
499
543
  return /*#__PURE__*/_react.default.createElement("div", {
500
544
  className: (0, _helpers__.withStyle)('row gx-5 mt-3 mt-lg-5')
@@ -523,12 +567,12 @@ const InternalQuotationForm = _ref => {
523
567
  placeholder: "Maak een keuze",
524
568
  errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelId']) || (errors === null || errors === void 0 ? void 0 : errors['channelType']),
525
569
  initialValue: initialChannel,
526
- onChange: _ref3 => {
570
+ onChange: _ref4 => {
527
571
  var _value$kanaalType;
528
572
  let {
529
573
  label,
530
574
  value
531
- } = _ref3;
575
+ } = _ref4;
532
576
  return dispatch({
533
577
  type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
534
578
  payload: {
@@ -543,14 +587,10 @@ const InternalQuotationForm = _ref => {
543
587
  name: "ownershipType",
544
588
  form: "quotation",
545
589
  label: "Type:",
546
- initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType,
590
+ initialValue: activeOwnershipType,
547
591
  onChange: val => {
548
- dispatch({
549
- type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_OWNERSHIP_TYPE,
550
- payload: {
551
- ownershipType: val
552
- }
553
- });
592
+ // Switch to the new ownership type - each type maintains its own separate state
593
+ setActiveOwnershipType(val);
554
594
  },
555
595
  options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
556
596
  isRequired: true,
@@ -559,7 +599,7 @@ const InternalQuotationForm = _ref => {
559
599
  className: (0, _helpers__.withStyle)('my-2')
560
600
  }, "Persoonlijke gegevens"), /*#__PURE__*/_react.default.createElement("div", {
561
601
  className: (0, _helpers__.withStyle)('col-12 mb-2')
562
- }, (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk && /*#__PURE__*/_react.default.createElement("div", {
602
+ }, activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk && /*#__PURE__*/_react.default.createElement("div", {
563
603
  className: (0, _helpers__.withStyle)('company-search-container position-relative mb-3')
564
604
  }, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
565
605
  placeholder: "Placeholderbedrijf",
@@ -576,12 +616,7 @@ const InternalQuotationForm = _ref => {
576
616
  name: "companyName",
577
617
  onChange: value => {
578
618
  // Update company name in state
579
- dispatch({
580
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
581
- payload: {
582
- companyName: value
583
- }
584
- });
619
+ updateCustomerField('companyName', value);
585
620
 
586
621
  // Also update search term if value is different
587
622
  if (value !== companySearchTerm) {
@@ -627,77 +662,32 @@ const InternalQuotationForm = _ref => {
627
662
  onMouseDown: e => {
628
663
  var _branch$vatNumber, _branch$kvkNumber;
629
664
  e.preventDefault();
630
- dispatch({
631
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
632
- payload: {
633
- companyName: branch.name
634
- }
635
- });
665
+ updateCustomerField('companyName', branch.name);
636
666
  if (branch.postalCode) {
637
- dispatch({
638
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
639
- payload: {
640
- zipCode: branch.postalCode
641
- }
642
- });
667
+ updateCustomerField('zipCode', branch.postalCode);
643
668
  }
644
669
  if (branch.street) {
645
- dispatch({
646
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
647
- payload: {
648
- streetName: branch.street
649
- }
650
- });
670
+ updateCustomerField('streetName', branch.street);
651
671
  }
652
672
  if (branch.city) {
653
- dispatch({
654
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
655
- payload: {
656
- city: branch.city
657
- }
658
- });
673
+ updateCustomerField('city', branch.city);
659
674
  }
660
675
  if (branch.street2) {
661
- dispatch({
662
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
663
- payload: {
664
- houseNumber: branch.street2
665
- }
666
- });
676
+ updateCustomerField('houseNumber', branch.street2);
667
677
  }
668
678
  const vatNumber = (_branch$vatNumber = branch.vatNumber) !== null && _branch$vatNumber !== void 0 ? _branch$vatNumber : branch.btwNummer;
669
679
  if (vatNumber) {
670
- dispatch({
671
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
672
- payload: {
673
- vatNumber
674
- }
675
- });
680
+ updateCustomerField('vatNumber', vatNumber);
676
681
  }
677
682
  const kvkNumber = (_branch$kvkNumber = branch.kvkNumber) !== null && _branch$kvkNumber !== void 0 ? _branch$kvkNumber : branch.kvkNummer;
678
683
  if (kvkNumber) {
679
- dispatch({
680
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
681
- payload: {
682
- kvkNumber
683
- }
684
- });
684
+ updateCustomerField('kvkNumber', kvkNumber);
685
685
  }
686
686
  if (branch.huisnummerToevoeging) {
687
- dispatch({
688
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
689
- payload: {
690
- houseNumberAddition: branch.huisnummerToevoeging
691
- }
692
- });
687
+ updateCustomerField('houseNumberAddition', branch.huisnummerToevoeging);
693
688
  }
694
689
  if (branch.country && branch.country.entityId) {
695
- dispatch({
696
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
697
- payload: {
698
- countryId: branch.country.entityId
699
- }
700
- });
690
+ updateCustomerField('countryId', branch.country.entityId);
701
691
  setRefreshKey(Date.now());
702
692
  }
703
693
  setCompanySearchTerm('');
@@ -707,12 +697,7 @@ const InternalQuotationForm = _ref => {
707
697
  placeholder: "",
708
698
  value: customer.firstName,
709
699
  name: "firstName",
710
- onChange: value => dispatch({
711
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_FIRST_NAME,
712
- payload: {
713
- firstName: value
714
- }
715
- }),
700
+ onChange: value => updateCustomerField('firstName', value),
716
701
  isRequired: true,
717
702
  form: "quotation",
718
703
  label: "Voornaam:",
@@ -721,12 +706,7 @@ const InternalQuotationForm = _ref => {
721
706
  placeholder: "",
722
707
  value: customer.infix,
723
708
  name: "infix",
724
- onChange: value => dispatch({
725
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INFIX,
726
- payload: {
727
- infix: value
728
- }
729
- }),
709
+ onChange: value => updateCustomerField('infix', value),
730
710
  isRequired: false,
731
711
  form: "quotation",
732
712
  label: "Tussenvoegsel:",
@@ -735,12 +715,7 @@ const InternalQuotationForm = _ref => {
735
715
  placeholder: "",
736
716
  value: customer.lastName,
737
717
  name: "lastName",
738
- onChange: value => dispatch({
739
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
740
- payload: {
741
- lastName: value
742
- }
743
- }),
718
+ onChange: value => updateCustomerField('lastName', value),
744
719
  isRequired: true,
745
720
  form: "quotation",
746
721
  label: "Achternaam:",
@@ -749,17 +724,12 @@ const InternalQuotationForm = _ref => {
749
724
  placeholder: "",
750
725
  value: customer.email,
751
726
  name: "email",
752
- onChange: value => dispatch({
753
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_EMAIL,
754
- payload: {
755
- email: value
756
- }
757
- }),
727
+ onChange: value => updateCustomerField('email', value),
758
728
  isRequired: true,
759
729
  form: "quotation",
760
730
  label: "E-mailadres:",
761
731
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['email']
762
- }), (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement("div", {
732
+ }), activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement("div", {
763
733
  className: (0, _helpers__.withStyle)('company-search-container position-relative mt-2 mb-2')
764
734
  }, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
765
735
  placeholder: "Zoek leasemaatschappijen...",
@@ -767,12 +737,7 @@ const InternalQuotationForm = _ref => {
767
737
  name: "companyName",
768
738
  onChange: value => {
769
739
  // Update company name in state
770
- dispatch({
771
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
772
- payload: {
773
- companyName: value
774
- }
775
- });
740
+ updateCustomerField('companyName', value);
776
741
 
777
742
  // Also update search term if value is different
778
743
  if (value !== companySearchTerm) {
@@ -832,12 +797,7 @@ const InternalQuotationForm = _ref => {
832
797
  placeholder: "",
833
798
  value: customer.phoneNumber,
834
799
  name: "phoneNumber",
835
- onChange: value => dispatch({
836
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_PHONE_NUMBER,
837
- payload: {
838
- phoneNumber: value
839
- }
840
- }),
800
+ onChange: value => updateCustomerField('phoneNumber', value),
841
801
  isRequired: true,
842
802
  form: "quotation",
843
803
  label: "Telefoonnummer:",
@@ -850,7 +810,7 @@ const InternalQuotationForm = _ref => {
850
810
  className: (0, _helpers__.withStyle)('modal-title col-12 mb-2')
851
811
  }, "Gegevens van de auto ", /*#__PURE__*/_react.default.createElement("br", null)), /*#__PURE__*/_react.default.createElement("div", {
852
812
  className: (0, _helpers__.withStyle)('col-12')
853
- }, (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
813
+ }, activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
854
814
  placeholder: "",
855
815
  value: vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber,
856
816
  name: "leaseNumber",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.304",
3
+ "version": "0.0.306",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",