thm-p3-configurator 0.0.298 → 0.0.300

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.
@@ -9,7 +9,6 @@ require("core-js/modules/esnext.iterator.for-each.js");
9
9
  require("core-js/modules/esnext.iterator.map.js");
10
10
  require("core-js/modules/web.dom-collections.iterator.js");
11
11
  require("core-js/modules/es.weak-map.js");
12
- require("core-js/modules/esnext.iterator.filter.js");
13
12
  require("core-js/modules/esnext.iterator.for-each.js");
14
13
  Object.defineProperty(exports, "__esModule", {
15
14
  value: true
@@ -17,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
17
16
  exports.default = void 0;
18
17
  require("core-js/modules/es.promise.js");
19
18
  require("core-js/modules/esnext.iterator.constructor.js");
19
+ require("core-js/modules/esnext.iterator.filter.js");
20
20
  require("core-js/modules/esnext.iterator.find.js");
21
21
  require("core-js/modules/esnext.iterator.map.js");
22
22
  require("core-js/modules/web.dom-collections.iterator.js");
@@ -32,6 +32,7 @@ var _AddressLookupService = _interopRequireDefault(require("../../__services__/A
32
32
  var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
33
33
  var _LinkButton = _interopRequireDefault(require("../Buttons/LinkButton"));
34
34
  var _CardWide = _interopRequireDefault(require("../Cards/CardWide"));
35
+ var _CheckboxInput = _interopRequireDefault(require("../Form/CheckboxInput"));
35
36
  var _DatePickerInput = _interopRequireDefault(require("../Form/DatePickerInput"));
36
37
  var _DropdownInput = _interopRequireDefault(require("../Form/DropdownInput"));
37
38
  var _RadioButtons = _interopRequireDefault(require("../Form/RadioButtons"));
@@ -155,8 +156,13 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
155
156
  appointment,
156
157
  internalNote,
157
158
  vehicle,
158
- webshop
159
+ webshop,
160
+ isTowCenterBranch,
161
+ anderAfleveradres,
162
+ afhalenInWinkel,
163
+ singleOrderFormulaCode
159
164
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
165
+ console;
160
166
  const {
161
167
  branchById
162
168
  } = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
@@ -232,6 +238,51 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
232
238
  }
233
239
  }
234
240
  }, [isTmg, marketingChannels, channel === null || channel === void 0 ? void 0 : channel.channelId, dispatch]);
241
+
242
+ /**
243
+ * @description Auto-set checkboxes when TowCenter branch or TMG formula is selected
244
+ * Only triggers when isTowCenterBranch or singleOrderFormulaCode changes
245
+ * User can manually toggle checkboxes after auto-enable
246
+ */
247
+ (0, _react.useEffect)(() => {
248
+ const shouldEnable = isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
249
+ if (shouldEnable) {
250
+ dispatch({
251
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
252
+ payload: {
253
+ anderAfleveradres: true
254
+ }
255
+ });
256
+ dispatch({
257
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
258
+ payload: {
259
+ afhalenInWinkel: true
260
+ }
261
+ });
262
+ // Set default ownership type to Particulier if not already set
263
+ if (!(vehicle !== null && vehicle !== void 0 && vehicle.singleOrderOwnershipType) || (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty) {
264
+ dispatch({
265
+ type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE,
266
+ payload: {
267
+ singleOrderOwnershipType: _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier
268
+ }
269
+ });
270
+ }
271
+ } else {
272
+ dispatch({
273
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
274
+ payload: {
275
+ anderAfleveradres: false
276
+ }
277
+ });
278
+ dispatch({
279
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
280
+ payload: {
281
+ afhalenInWinkel: false
282
+ }
283
+ });
284
+ }
285
+ }, [isTowCenterBranch, singleOrderFormulaCode, dispatch, vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType]);
235
286
  const initialChannel = (0, _react.useMemo)(() => {
236
287
  if (!(channel !== null && channel !== void 0 && channel.channelId) || !(marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length)) return null;
237
288
  const selectedChannel = marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId));
@@ -384,7 +435,34 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
384
435
  phoneNumber: (0, _yup.string)().required('Telefoonnummer is verplicht')
385
436
  });
386
437
  }
438
+
439
+ // When TowCenter or TMG, ownership type is required (Niet van toepassing not allowed)
440
+ const isTowCenterOrTmg = isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
441
+ if (isTowCenterOrTmg) {
442
+ validationSchema = validationSchema.shape({
443
+ singleOrderOwnershipType: (0, _yup.string)().required('Type is verplicht').notOneOf([_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty], 'Type is verplicht')
444
+ });
445
+ }
446
+
447
+ // When anderAfleveradres is enabled, make address fields required
448
+ if (anderAfleveradres) {
449
+ const isZakelijk = (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk;
450
+ const requiredFields = {
451
+ firstName: (0, _yup.string)().required('Voornaam is verplicht'),
452
+ lastName: (0, _yup.string)().required('Achternaam is verplicht'),
453
+ streetName: (0, _yup.string)().required('Straatnaam is verplicht'),
454
+ houseNumber: (0, _yup.string)().required('Huisnummer is verplicht'),
455
+ zipCode: (0, _yup.string)().required('Postcode is verplicht'),
456
+ city: (0, _yup.string)().required('Stad is verplicht'),
457
+ countryId: (0, _yup.string)().required('Land is verplicht')
458
+ };
459
+ if (isZakelijk) {
460
+ requiredFields.companyName = (0, _yup.string)().required('Bedrijfsnaam is verplicht');
461
+ }
462
+ validationSchema = validationSchema.shape(requiredFields);
463
+ }
387
464
  await validationSchema.validate(_objectSpread(_objectSpread({}, customer), {}, {
465
+ singleOrderOwnershipType: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) || '',
388
466
  channelType: (channel === null || channel === void 0 ? void 0 : channel.channelType) || '',
389
467
  channelId: (channel === null || channel === void 0 ? void 0 : channel.channelId) || ''
390
468
  }), {
@@ -453,7 +531,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
453
531
  })), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
454
532
  name: "singleOrderOwnershipType",
455
533
  label: "Type:",
456
- initialValue: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) || _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty,
534
+ initialValue: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) || (isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG ? _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier : _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty),
457
535
  onChange: val => {
458
536
  dispatch({
459
537
  type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE,
@@ -462,10 +540,36 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
462
540
  }
463
541
  });
464
542
  },
465
- options: Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE),
466
- isRequired: false,
543
+ options: isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG ? Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE).filter(option => option !== _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty) : Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE),
544
+ isRequired: isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG,
467
545
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['singleOrderOwnershipType']
468
- }), /*#__PURE__*/_react.default.createElement("div", {
546
+ }), (isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
547
+ className: (0, _helpers__.withStyle)('col-12 mb-2')
548
+ }, /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
549
+ name: "anderAfleveradres",
550
+ label: "Ander afleveradres",
551
+ initialValue: anderAfleveradres,
552
+ onChange: value => dispatch({
553
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
554
+ payload: {
555
+ anderAfleveradres: value
556
+ }
557
+ }),
558
+ form: form
559
+ })), /*#__PURE__*/_react.default.createElement("div", {
560
+ className: (0, _helpers__.withStyle)('col-12 mb-2')
561
+ }, /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
562
+ name: "afhalenInWinkel",
563
+ label: "Afhalen in winkel",
564
+ initialValue: afhalenInWinkel,
565
+ onChange: value => dispatch({
566
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
567
+ payload: {
568
+ afhalenInWinkel: value
569
+ }
570
+ }),
571
+ form: form
572
+ }))), /*#__PURE__*/_react.default.createElement("div", {
469
573
  className: (0, _helpers__.withStyle)('col-12 mt-2 col-md-6')
470
574
  }, /*#__PURE__*/_react.default.createElement("h6", {
471
575
  className: (0, _helpers__.withStyle)('modal-title mb-2')
@@ -479,7 +583,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
479
583
  firstName: value
480
584
  }
481
585
  }),
482
- isRequired: webshop,
586
+ isRequired: webshop || anderAfleveradres,
483
587
  form: form,
484
588
  label: "Voornaam:",
485
589
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['firstName']
@@ -507,7 +611,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
507
611
  lastName: value
508
612
  }
509
613
  }),
510
- isRequired: webshop,
614
+ isRequired: webshop || anderAfleveradres,
511
615
  form: form,
512
616
  label: "Achternaam:",
513
617
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['lastName']
@@ -578,7 +682,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
578
682
  setIsCompanyInputFocused(false);
579
683
  }, 300);
580
684
  },
581
- isRequired: false,
685
+ isRequired: anderAfleveradres,
582
686
  form: form,
583
687
  label: "Bedrijfsnaam:",
584
688
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['companyName']
@@ -725,7 +829,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
725
829
  handleAddressLookup(value, customer.houseNumber);
726
830
  }
727
831
  },
728
- isRequired: false,
832
+ isRequired: anderAfleveradres,
729
833
  form: form,
730
834
  label: "Postcode:",
731
835
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['zipCode']
@@ -745,7 +849,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
745
849
  handleAddressLookup(customer.zipCode, value);
746
850
  }
747
851
  },
748
- isRequired: false,
852
+ isRequired: anderAfleveradres,
749
853
  form: form,
750
854
  label: "Huisnummer:",
751
855
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['houseNumber']
@@ -773,7 +877,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
773
877
  streetName: value
774
878
  }
775
879
  }),
776
- isRequired: false,
880
+ isRequired: anderAfleveradres,
777
881
  form: form,
778
882
  label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
779
883
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['streetName']
@@ -787,7 +891,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
787
891
  city: value
788
892
  }
789
893
  }),
790
- isRequired: false,
894
+ isRequired: anderAfleveradres,
791
895
  form: form,
792
896
  label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
793
897
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['city']
@@ -795,7 +899,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
795
899
  options: countryOptions,
796
900
  name: "country",
797
901
  label: "Land:",
798
- isRequired: false,
902
+ isRequired: anderAfleveradres,
799
903
  isLoading: isLoadingCountries,
800
904
  noOptionsMessage: "Geen landen beschikbaar",
801
905
  placeholder: "Selecteer een land",
@@ -624,7 +624,6 @@ const ProductCartTable = () => {
624
624
 
625
625
  const showCatalogPrice = !isThc;
626
626
  const headerColumns = (0, _cartTable2.getCartTableHeaderColumns)(displayMode, showCatalogPrice);
627
- console.log(mainProducts);
628
627
  const montageRateInputCell = isThc ? {} : {
629
628
  text: renderMontageRateInput(),
630
629
  className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
@@ -217,7 +217,8 @@ const InternalAppointmentForm = _ref => {
217
217
  webshop,
218
218
  vehicleCodingDiscountPercentage,
219
219
  consumerDiscounts,
220
- montageRate
220
+ montageRate,
221
+ hasGoedkeuringsnummerActivity
221
222
  } = order;
222
223
  const [errors, setErrors] = (0, _react.useState)({});
223
224
  const [_licensePlate, _setLicensePlate] = (0, _react.useState)();
@@ -816,19 +817,23 @@ const InternalAppointmentForm = _ref => {
816
817
  setCompanySearchTerm('');
817
818
  setIsCompanyInputFocused(false);
818
819
  }
819
- }, branch.name)))), /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
820
+ }, branch.name)))), (branchById === null || branchById === void 0 ? void 0 : branchById.towCenterVestiging) === true && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
820
821
  name: "invoicePaymentByLeaseCompany",
821
822
  label: "Factuur betaling door Leasemaatschappij",
822
823
  initialValue: invoicePaymentByLeaseCompany,
823
824
  onChange: val => {
824
- dispatch({
825
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY,
826
- payload: {
827
- invoicePaymentByLeaseCompany: val
828
- }
829
- });
825
+ // Only allow if no existingDossierId OR hasGoedkeuringsnummerActivity
826
+ if (!existingDossierId || hasGoedkeuringsnummerActivity) {
827
+ dispatch({
828
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY,
829
+ payload: {
830
+ invoicePaymentByLeaseCompany: val
831
+ }
832
+ });
833
+ }
830
834
  },
831
- isRequired: false
835
+ isRequired: false,
836
+ isDisabled: existingDossierId && !hasGoedkeuringsnummerActivity
832
837
  }))), /*#__PURE__*/_react.default.createElement("h5", {
833
838
  className: (0, _helpers__.withStyle)('my-2')
834
839
  }, "Persoonlijke gegevens"), /*#__PURE__*/_react.default.createElement("div", {
@@ -4,6 +4,7 @@ require("core-js/modules/es.json.stringify.js");
4
4
  require("core-js/modules/es.weak-map.js");
5
5
  require("core-js/modules/esnext.iterator.constructor.js");
6
6
  require("core-js/modules/esnext.iterator.filter.js");
7
+ require("core-js/modules/esnext.iterator.find.js");
7
8
  require("core-js/modules/esnext.iterator.for-each.js");
8
9
  require("core-js/modules/esnext.iterator.map.js");
9
10
  require("core-js/modules/web.dom-collections.iterator.js");
@@ -15,6 +16,7 @@ exports.default = void 0;
15
16
  require("core-js/modules/es.json.stringify.js");
16
17
  require("core-js/modules/esnext.iterator.constructor.js");
17
18
  require("core-js/modules/esnext.iterator.filter.js");
19
+ require("core-js/modules/esnext.iterator.find.js");
18
20
  require("core-js/modules/esnext.iterator.for-each.js");
19
21
  require("core-js/modules/esnext.iterator.map.js");
20
22
  require("core-js/modules/web.dom-collections.iterator.js");
@@ -74,7 +76,8 @@ const NormalPageModalContent = _ref => {
74
76
  const [_branches, _setBranches] = (0, _react.useState)([]);
75
77
  const [{
76
78
  licensePlate,
77
- model
79
+ model,
80
+ singleOrderFormulaCode
78
81
  }] = (0, _OrderSessionContext.useOrderSession)();
79
82
  const {
80
83
  myBranches,
@@ -101,7 +104,6 @@ const NormalPageModalContent = _ref => {
101
104
  if (!(_branches !== null && _branches !== void 0 && _branches.length)) return;
102
105
  if (selectedBranch) return;
103
106
  const shouldAutoSelect = !existingDossierId && !isTMGOrganization && _branches.length === 1;
104
- console.log(existingDossierId, isTMGOrganization, _branches.length);
105
107
  if (!shouldAutoSelect) return;
106
108
  const branchToSelect = (_branches$ = _branches[0]) === null || _branches$ === void 0 ? void 0 : _branches$.entityId;
107
109
  if (branchToSelect) {
@@ -113,11 +115,12 @@ const NormalPageModalContent = _ref => {
113
115
  });
114
116
  }
115
117
  }, [_branches, selectedBranch, isLocation, existingDossierId, isTMGOrganization]);
118
+ const branchOptions = _branches === null || _branches === void 0 ? void 0 : _branches.map(branch => ({
119
+ label: branch === null || branch === void 0 ? void 0 : branch.name,
120
+ value: branch === null || branch === void 0 ? void 0 : branch.entityId
121
+ }));
116
122
  return /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
117
- options: _branches === null || _branches === void 0 ? void 0 : _branches.map(branch => ({
118
- label: branch === null || branch === void 0 ? void 0 : branch.name,
119
- value: branch === null || branch === void 0 ? void 0 : branch.entityId
120
- })),
123
+ options: branchOptions,
121
124
  name: "channel",
122
125
  label: "Vestiging:",
123
126
  isRequired: true,
@@ -126,11 +129,51 @@ const NormalPageModalContent = _ref => {
126
129
  placeholder: "Maak een keuze",
127
130
  initialValue: _selectedBranchId,
128
131
  onChange: _ref2 => {
132
+ var _branches$results;
129
133
  let {
130
134
  label,
131
135
  value
132
136
  } = _ref2;
133
- return setSelectedBranchId(value);
137
+ setSelectedBranchId(value);
138
+ const selectedBranchData = isTMGOrganization ? branches === null || branches === void 0 || (_branches$results = branches.results) === null || _branches$results === void 0 ? void 0 : _branches$results.find(b => b.entityId === value) : myBranches === null || myBranches === void 0 ? void 0 : myBranches.find(b => b.entityId === value);
139
+ if (selectedBranchData) {
140
+ const isTowCenter = (selectedBranchData === null || selectedBranchData === void 0 ? void 0 : selectedBranchData.towCenterVestiging) === true;
141
+ const isTmgFormula = formula === _constants__.CONFIGURATOR_FORMULAS.TMG || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
142
+ const shouldEnable = isTowCenter || isTmgFormula;
143
+ dispatch({
144
+ type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
145
+ payload: {
146
+ isTowCenterBranch: isTowCenter
147
+ }
148
+ });
149
+ if (shouldEnable) {
150
+ dispatch({
151
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
152
+ payload: {
153
+ anderAfleveradres: true
154
+ }
155
+ });
156
+ dispatch({
157
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
158
+ payload: {
159
+ afhalenInWinkel: true
160
+ }
161
+ });
162
+ } else {
163
+ dispatch({
164
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
165
+ payload: {
166
+ anderAfleveradres: false
167
+ }
168
+ });
169
+ dispatch({
170
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
171
+ payload: {
172
+ afhalenInWinkel: false
173
+ }
174
+ });
175
+ }
176
+ }
134
177
  }
135
178
  });
136
179
  };
@@ -158,6 +201,9 @@ const SingleOrderModalContent = _ref3 => {
158
201
  limit: 500,
159
202
  offset: 0
160
203
  });
204
+ const [{
205
+ singleOrderFormulaCode
206
+ }] = (0, _OrderSessionContext.useOrderSession)();
161
207
 
162
208
  // Filter branches based on formula if not TMG
163
209
  const filteredBranches = _react.default.useMemo(() => {
@@ -174,6 +220,10 @@ const SingleOrderModalContent = _ref3 => {
174
220
  var _branch$formule$code, _branch$formule2;
175
221
  branchIdWithFormulaCode.set(branch === null || branch === void 0 ? void 0 : branch.entityId, (_branch$formule$code = branch === null || branch === void 0 || (_branch$formule2 = branch.formule) === null || _branch$formule2 === void 0 ? void 0 : _branch$formule2.code) !== null && _branch$formule$code !== void 0 ? _branch$formule$code : _constants__.CONFIGURATOR_FORMULAS.THC);
176
222
  });
223
+ const branchOptions = filteredBranches === null || filteredBranches === void 0 ? void 0 : filteredBranches.map(branch => ({
224
+ label: "".concat(branch === null || branch === void 0 ? void 0 : branch.naamVestiging, " - ").concat(branch === null || branch === void 0 ? void 0 : branch.name),
225
+ value: branch === null || branch === void 0 ? void 0 : branch.entityId
226
+ }));
177
227
  (0, _react.useEffect)(() => {
178
228
  if (isLocation && !selectedBranch && !isTMGOrganization) {
179
229
  var _authSession$branch;
@@ -207,10 +257,7 @@ const SingleOrderModalContent = _ref3 => {
207
257
  setLocalBranchId(undefined);
208
258
  }
209
259
  }), (formula === _constants__.CONFIGURATOR_FORMULAS.TMG ? singleOrderBranchType : true) && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
210
- options: filteredBranches === null || filteredBranches === void 0 ? void 0 : filteredBranches.map(branch => ({
211
- label: "".concat(branch === null || branch === void 0 ? void 0 : branch.naamVestiging, " - ").concat(branch === null || branch === void 0 ? void 0 : branch.name),
212
- value: branch === null || branch === void 0 ? void 0 : branch.entityId
213
- })),
260
+ options: branchOptions,
214
261
  name: "branch",
215
262
  label: "Vestiging:",
216
263
  isRequired: true,
@@ -225,12 +272,64 @@ const SingleOrderModalContent = _ref3 => {
225
272
  } = _ref5;
226
273
  setSelectedBranchId(value);
227
274
  setLocalBranchId(value);
275
+ const formulaCode = branchIdWithFormulaCode.get(value);
228
276
  dispatch({
229
277
  type: _OrderSessionContext.orderSessionActions.SET_SINGLE_ORDER_FORMULA_CODE,
230
278
  payload: {
231
- formulaCode: branchIdWithFormulaCode.get(value)
279
+ formulaCode
232
280
  }
233
281
  });
282
+ const selectedBranchData = filteredBranches === null || filteredBranches === void 0 ? void 0 : filteredBranches.find(b => b.entityId === value);
283
+ if (selectedBranchData) {
284
+ const isTowCenter = (selectedBranchData === null || selectedBranchData === void 0 ? void 0 : selectedBranchData.towCenterVestiging) === true;
285
+ const isTmgFormula = formula === _constants__.CONFIGURATOR_FORMULAS.TMG || formulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
286
+ const shouldEnable = isTowCenter || isTmgFormula;
287
+ dispatch({
288
+ type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
289
+ payload: {
290
+ isTowCenterBranch: isTowCenter
291
+ }
292
+ });
293
+ if (shouldEnable) {
294
+ dispatch({
295
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
296
+ payload: {
297
+ anderAfleveradres: true
298
+ }
299
+ });
300
+ dispatch({
301
+ type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
302
+ payload: {
303
+ isTowCenterBranch: isTowCenter
304
+ }
305
+ });
306
+ dispatch({
307
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
308
+ payload: {
309
+ afhalenInWinkel: true
310
+ }
311
+ });
312
+ } else {
313
+ dispatch({
314
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
315
+ payload: {
316
+ anderAfleveradres: false
317
+ }
318
+ });
319
+ dispatch({
320
+ type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
321
+ payload: {
322
+ isTowCenterBranch: isTowCenter
323
+ }
324
+ });
325
+ dispatch({
326
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
327
+ payload: {
328
+ afhalenInWinkel: false
329
+ }
330
+ });
331
+ }
332
+ }
234
333
  }
235
334
  }));
236
335
  };
@@ -256,8 +355,12 @@ const InternalBranchSelectorModal = () => {
256
355
  existingDossierId,
257
356
  orderType,
258
357
  licensePlate,
259
- model
358
+ model,
359
+ singleOrderFormulaCode
260
360
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
361
+ const {
362
+ branchById
363
+ } = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
261
364
  const {
262
365
  myBranches,
263
366
  isLoadingMyBranches
@@ -278,6 +381,45 @@ const InternalBranchSelectorModal = () => {
278
381
  });
279
382
  _setSelectedBranchId(onlyBranchId);
280
383
  }, [shouldAutoSelect, myBranches, dispatch]);
384
+ (0, _react.useEffect)(() => {
385
+ if (!selectedBranch || !branchById) return;
386
+ const isTowCenter = (branchById === null || branchById === void 0 ? void 0 : branchById.towCenterVestiging) === true;
387
+ const isTmgFormula = singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
388
+ const shouldEnable = isTowCenter || isTmgFormula;
389
+ dispatch({
390
+ type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
391
+ payload: {
392
+ isTowCenterBranch: isTowCenter
393
+ }
394
+ });
395
+ if (shouldEnable) {
396
+ dispatch({
397
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
398
+ payload: {
399
+ anderAfleveradres: true
400
+ }
401
+ });
402
+ dispatch({
403
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
404
+ payload: {
405
+ afhalenInWinkel: true
406
+ }
407
+ });
408
+ } else {
409
+ dispatch({
410
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
411
+ payload: {
412
+ anderAfleveradres: false
413
+ }
414
+ });
415
+ dispatch({
416
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
417
+ payload: {
418
+ afhalenInWinkel: false
419
+ }
420
+ });
421
+ }
422
+ }, [selectedBranch, branchById, singleOrderFormulaCode, dispatch]);
281
423
  const handlePrimaryButtonClicked = () => {
282
424
  dispatch({
283
425
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
@@ -174,7 +174,11 @@ const INITIAL_ORDER_SESSION_STATE = {
174
174
  },
175
175
  invoicePaymentByLeaseCompany: false,
176
176
  orderType: null,
177
- webshop: null
177
+ webshop: null,
178
+ isTowCenterBranch: false,
179
+ anderAfleveradres: false,
180
+ afhalenInWinkel: false,
181
+ hasGoedkeuringsnummerActivity: false
178
182
  };
179
183
  const orderSessionActions = exports.orderSessionActions = {
180
184
  INITIALIZE_NEW_ORDER: 'INITIALIZE_NEW_ORDER',
@@ -252,7 +256,10 @@ const orderSessionActions = exports.orderSessionActions = {
252
256
  SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE: 'SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE',
253
257
  SET_CONSUMER_DISCOUNT_PERCENTAGE: 'SET_CONSUMER_DISCOUNT_PERCENTAGE',
254
258
  SET_MONTAGE_RATE: 'SET_MONTAGE_RATE',
255
- SET_IS_MONTAGE_TARIFF_FIXED: 'SET_IS_MONTAGE_TARIFF_FIXED'
259
+ SET_IS_MONTAGE_TARIFF_FIXED: 'SET_IS_MONTAGE_TARIFF_FIXED',
260
+ SET_IS_TOW_CENTER_BRANCH: 'SET_IS_TOW_CENTER_BRANCH',
261
+ SET_ANDER_AFLEVERADRES: 'SET_ANDER_AFLEVERADRES',
262
+ SET_AFHALEN_IN_WINKEL: 'SET_AFHALEN_IN_WINKEL'
256
263
  };
257
264
  const orderSessionReducer = (state, action) => {
258
265
  switch (action.type) {
@@ -1136,6 +1143,33 @@ const orderSessionReducer = (state, action) => {
1136
1143
  webshop
1137
1144
  });
1138
1145
  }
1146
+ case orderSessionActions.SET_IS_TOW_CENTER_BRANCH:
1147
+ {
1148
+ const {
1149
+ isTowCenterBranch
1150
+ } = action.payload;
1151
+ return _objectSpread(_objectSpread({}, state), {}, {
1152
+ isTowCenterBranch
1153
+ });
1154
+ }
1155
+ case orderSessionActions.SET_ANDER_AFLEVERADRES:
1156
+ {
1157
+ const {
1158
+ anderAfleveradres
1159
+ } = action.payload;
1160
+ return _objectSpread(_objectSpread({}, state), {}, {
1161
+ anderAfleveradres
1162
+ });
1163
+ }
1164
+ case orderSessionActions.SET_AFHALEN_IN_WINKEL:
1165
+ {
1166
+ const {
1167
+ afhalenInWinkel
1168
+ } = action.payload;
1169
+ return _objectSpread(_objectSpread({}, state), {}, {
1170
+ afhalenInWinkel
1171
+ });
1172
+ }
1139
1173
  default:
1140
1174
  return state;
1141
1175
  }
@@ -73,7 +73,7 @@ function _toPrimitive(t, r) {
73
73
  * @description Covnerts an existing hyper dossier object into a local order session
74
74
  */
75
75
  const parseDossierToOrderSession = exports.parseDossierToOrderSession = function parseDossierToOrderSession() {
76
- var _dossier$statusBeoord, _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$statusDossie, _dossier$statusDossie2, _dossier$lines$some, _dossier$lines, _dossier$vestiging, _dossier$typeEigendom, _dossier$klant, _dossier$klant2, _dossier$klant3, _dossier$klant4, _dossier$klant$postal, _dossier$klant5, _dossier$klant$city, _dossier$klant6, _dossier$klant$street, _dossier$klant7, _dossier$klant$huisnu, _dossier$klant8, _dossier$anwbId, _dossier$bedrijfsnaam, _dossier$placeholderB, _dossier$kvkNummer, _dossier$btwNummer;
76
+ var _dossier$statusBeoord, _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$statusDossie, _dossier$statusDossie2, _dossier$lines$some, _dossier$lines, _dossier$vestiging, _dossier$typeEigendom, _dossier$klant, _dossier$klant2, _dossier$klant3, _dossier$klant4, _dossier$klant$postal, _dossier$klant5, _dossier$klant$city, _dossier$klant6, _dossier$klant$street, _dossier$klant7, _dossier$klant$huisnu, _dossier$klant8, _dossier$anwbId, _dossier$bedrijfsnaam, _dossier$placeholderB, _dossier$kvkNummer, _dossier$btwNummer, _dossier$hasGoedkeuri;
77
77
  let dossier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
78
78
  return {
79
79
  canAlterQuantity: (dossier === null || dossier === void 0 || (_dossier$statusBeoord = dossier.statusBeoordeling) === null || _dossier$statusBeoord === void 0 ? void 0 : _dossier$statusBeoord.title) === _constants__.STATUS_ASSESSMENT.Open,
@@ -143,7 +143,8 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
143
143
  companyNamePlaceholder: (_dossier$placeholderB = dossier === null || dossier === void 0 ? void 0 : dossier.placeholderBedrijfsnaam) !== null && _dossier$placeholderB !== void 0 ? _dossier$placeholderB : undefined,
144
144
  kvkNumber: (_dossier$kvkNummer = dossier === null || dossier === void 0 ? void 0 : dossier.kvkNummer) !== null && _dossier$kvkNummer !== void 0 ? _dossier$kvkNummer : undefined,
145
145
  vatNumber: (_dossier$btwNummer = dossier === null || dossier === void 0 ? void 0 : dossier.btwNummer) !== null && _dossier$btwNummer !== void 0 ? _dossier$btwNummer : undefined
146
- }
146
+ },
147
+ hasGoedkeuringsnummerActivity: (_dossier$hasGoedkeuri = dossier === null || dossier === void 0 ? void 0 : dossier.hasGoedkeuringsnummerActivity) !== null && _dossier$hasGoedkeuri !== void 0 ? _dossier$hasGoedkeuri : false
147
148
  };
148
149
  };
149
150
 
@@ -152,7 +152,9 @@ const InternalSingleOrderPage = () => {
152
152
  licensePlate,
153
153
  durationAnswer,
154
154
  model,
155
- webshop
155
+ webshop,
156
+ anderAfleveradres,
157
+ afhalenInWinkel
156
158
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
157
159
  let formula = (0, _FormulaContext.useFormula)();
158
160
  if (singleOrderFormulaCode) {
@@ -335,7 +337,10 @@ const InternalSingleOrderPage = () => {
335
337
  model: filters.model,
336
338
  cart: singleOrderCart,
337
339
  vehicle: vehiclePayload,
338
- customer,
340
+ customer: _objectSpread(_objectSpread({}, customer), {}, {
341
+ anderAfleveradres,
342
+ afhalenInWinkel
343
+ }),
339
344
  formula,
340
345
  webshop,
341
346
  branchId: selectedBranch,
@@ -354,7 +359,10 @@ const InternalSingleOrderPage = () => {
354
359
  model: filters.model,
355
360
  cart: singleOrderCart,
356
361
  vehicle: vehiclePayload,
357
- customer
362
+ customer: _objectSpread(_objectSpread({}, customer), {}, {
363
+ anderAfleveradres,
364
+ afhalenInWinkel
365
+ })
358
366
  }, formula === _constants__.CONFIGURATOR_FORMULAS.THM ? {
359
367
  formula: _constants__.CONFIGURATOR_FORMULAS.TM
360
368
  } : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.298",
3
+ "version": "0.0.300",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",