thm-p3-configurator 0.0.297 → 0.0.299
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +80 -9
- package/dist/src/shared/__containers__/ProductsCartOverview.js +1 -1
- package/dist/src/shared/__containers__/internal/InternalBranchSelectorModal.js +104 -13
- package/dist/src/shared/__context__/OrderSessionContext.js +35 -2
- package/dist/src/shared/__pages__/internal/InternalSingleOrderPage.js +11 -3
- package/package.json +1 -1
|
@@ -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,7 +156,11 @@ 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)();
|
|
160
165
|
const {
|
|
161
166
|
branchById
|
|
@@ -232,6 +237,29 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
232
237
|
}
|
|
233
238
|
}
|
|
234
239
|
}, [isTmg, marketingChannels, channel === null || channel === void 0 ? void 0 : channel.channelId, dispatch]);
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @description Auto-set checkboxes when TowCenter branch or TMG formula is selected
|
|
243
|
+
*/
|
|
244
|
+
(0, _react.useEffect)(() => {
|
|
245
|
+
const shouldEnable = isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
|
|
246
|
+
if (shouldEnable && !anderAfleveradres) {
|
|
247
|
+
dispatch({
|
|
248
|
+
type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
|
|
249
|
+
payload: {
|
|
250
|
+
anderAfleveradres: true
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
if (shouldEnable && !afhalenInWinkel) {
|
|
255
|
+
dispatch({
|
|
256
|
+
type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
|
|
257
|
+
payload: {
|
|
258
|
+
afhalenInWinkel: true
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}, [isTowCenterBranch, singleOrderFormulaCode, anderAfleveradres, afhalenInWinkel, dispatch]);
|
|
235
263
|
const initialChannel = (0, _react.useMemo)(() => {
|
|
236
264
|
if (!(channel !== null && channel !== void 0 && channel.channelId) || !(marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length)) return null;
|
|
237
265
|
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,6 +412,23 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
384
412
|
phoneNumber: (0, _yup.string)().required('Telefoonnummer is verplicht')
|
|
385
413
|
});
|
|
386
414
|
}
|
|
415
|
+
|
|
416
|
+
// When anderAfleveradres is enabled, make address fields required
|
|
417
|
+
if (anderAfleveradres) {
|
|
418
|
+
const isZakelijk = (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk;
|
|
419
|
+
const requiredFields = {
|
|
420
|
+
firstName: (0, _yup.string)().required('Voornaam is verplicht'),
|
|
421
|
+
lastName: (0, _yup.string)().required('Achternaam is verplicht'),
|
|
422
|
+
streetName: (0, _yup.string)().required('Straatnaam is verplicht'),
|
|
423
|
+
zipCode: (0, _yup.string)().required('Postcode is verplicht'),
|
|
424
|
+
city: (0, _yup.string)().required('Stad is verplicht'),
|
|
425
|
+
countryId: (0, _yup.string)().required('Land is verplicht')
|
|
426
|
+
};
|
|
427
|
+
if (isZakelijk) {
|
|
428
|
+
requiredFields.companyName = (0, _yup.string)().required('Bedrijfsnaam is verplicht');
|
|
429
|
+
}
|
|
430
|
+
validationSchema = validationSchema.shape(requiredFields);
|
|
431
|
+
}
|
|
387
432
|
await validationSchema.validate(_objectSpread(_objectSpread({}, customer), {}, {
|
|
388
433
|
channelType: (channel === null || channel === void 0 ? void 0 : channel.channelType) || '',
|
|
389
434
|
channelId: (channel === null || channel === void 0 ? void 0 : channel.channelId) || ''
|
|
@@ -465,7 +510,33 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
465
510
|
options: Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE),
|
|
466
511
|
isRequired: false,
|
|
467
512
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['singleOrderOwnershipType']
|
|
468
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
513
|
+
}), (isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
514
|
+
className: (0, _helpers__.withStyle)('col-12 mb-2')
|
|
515
|
+
}, /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
516
|
+
name: "anderAfleveradres",
|
|
517
|
+
label: "Ander afleveradres",
|
|
518
|
+
initialValue: anderAfleveradres,
|
|
519
|
+
onChange: value => dispatch({
|
|
520
|
+
type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
|
|
521
|
+
payload: {
|
|
522
|
+
anderAfleveradres: value
|
|
523
|
+
}
|
|
524
|
+
}),
|
|
525
|
+
form: form
|
|
526
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
527
|
+
className: (0, _helpers__.withStyle)('col-12 mb-2')
|
|
528
|
+
}, /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
529
|
+
name: "afhalenInWinkel",
|
|
530
|
+
label: "Afhalen in winkel",
|
|
531
|
+
initialValue: afhalenInWinkel,
|
|
532
|
+
onChange: value => dispatch({
|
|
533
|
+
type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
|
|
534
|
+
payload: {
|
|
535
|
+
afhalenInWinkel: value
|
|
536
|
+
}
|
|
537
|
+
}),
|
|
538
|
+
form: form
|
|
539
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
469
540
|
className: (0, _helpers__.withStyle)('col-12 mt-2 col-md-6')
|
|
470
541
|
}, /*#__PURE__*/_react.default.createElement("h6", {
|
|
471
542
|
className: (0, _helpers__.withStyle)('modal-title mb-2')
|
|
@@ -479,7 +550,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
479
550
|
firstName: value
|
|
480
551
|
}
|
|
481
552
|
}),
|
|
482
|
-
isRequired: webshop,
|
|
553
|
+
isRequired: webshop || anderAfleveradres,
|
|
483
554
|
form: form,
|
|
484
555
|
label: "Voornaam:",
|
|
485
556
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['firstName']
|
|
@@ -507,7 +578,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
507
578
|
lastName: value
|
|
508
579
|
}
|
|
509
580
|
}),
|
|
510
|
-
isRequired: webshop,
|
|
581
|
+
isRequired: webshop || anderAfleveradres,
|
|
511
582
|
form: form,
|
|
512
583
|
label: "Achternaam:",
|
|
513
584
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['lastName']
|
|
@@ -578,7 +649,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
578
649
|
setIsCompanyInputFocused(false);
|
|
579
650
|
}, 300);
|
|
580
651
|
},
|
|
581
|
-
isRequired:
|
|
652
|
+
isRequired: anderAfleveradres,
|
|
582
653
|
form: form,
|
|
583
654
|
label: "Bedrijfsnaam:",
|
|
584
655
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['companyName']
|
|
@@ -725,7 +796,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
725
796
|
handleAddressLookup(value, customer.houseNumber);
|
|
726
797
|
}
|
|
727
798
|
},
|
|
728
|
-
isRequired:
|
|
799
|
+
isRequired: anderAfleveradres,
|
|
729
800
|
form: form,
|
|
730
801
|
label: "Postcode:",
|
|
731
802
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['zipCode']
|
|
@@ -773,7 +844,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
773
844
|
streetName: value
|
|
774
845
|
}
|
|
775
846
|
}),
|
|
776
|
-
isRequired:
|
|
847
|
+
isRequired: anderAfleveradres,
|
|
777
848
|
form: form,
|
|
778
849
|
label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
779
850
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['streetName']
|
|
@@ -787,7 +858,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
787
858
|
city: value
|
|
788
859
|
}
|
|
789
860
|
}),
|
|
790
|
-
isRequired:
|
|
861
|
+
isRequired: anderAfleveradres,
|
|
791
862
|
form: form,
|
|
792
863
|
label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
793
864
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['city']
|
|
@@ -795,7 +866,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
795
866
|
options: countryOptions,
|
|
796
867
|
name: "country",
|
|
797
868
|
label: "Land:",
|
|
798
|
-
isRequired:
|
|
869
|
+
isRequired: anderAfleveradres,
|
|
799
870
|
isLoading: isLoadingCountries,
|
|
800
871
|
noOptionsMessage: "Geen landen beschikbaar",
|
|
801
872
|
placeholder: "Selecteer een land",
|
|
@@ -795,6 +795,6 @@ const ProductCartTable = () => {
|
|
|
795
795
|
value: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
|
|
796
796
|
className: 'fw-bold text-end'
|
|
797
797
|
}, showCatalogPrice)]
|
|
798
|
-
})))), APP_CONFIG.internal &&
|
|
798
|
+
})))), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null)));
|
|
799
799
|
};
|
|
800
800
|
var _default = exports.default = ProductCartTable;
|
|
@@ -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:
|
|
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,38 @@ 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
|
-
|
|
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
|
+
}
|
|
163
|
+
}
|
|
134
164
|
}
|
|
135
165
|
});
|
|
136
166
|
};
|
|
@@ -158,6 +188,9 @@ const SingleOrderModalContent = _ref3 => {
|
|
|
158
188
|
limit: 500,
|
|
159
189
|
offset: 0
|
|
160
190
|
});
|
|
191
|
+
const [{
|
|
192
|
+
singleOrderFormulaCode
|
|
193
|
+
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
161
194
|
|
|
162
195
|
// Filter branches based on formula if not TMG
|
|
163
196
|
const filteredBranches = _react.default.useMemo(() => {
|
|
@@ -174,6 +207,10 @@ const SingleOrderModalContent = _ref3 => {
|
|
|
174
207
|
var _branch$formule$code, _branch$formule2;
|
|
175
208
|
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
209
|
});
|
|
210
|
+
const branchOptions = 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
|
+
}));
|
|
177
214
|
(0, _react.useEffect)(() => {
|
|
178
215
|
if (isLocation && !selectedBranch && !isTMGOrganization) {
|
|
179
216
|
var _authSession$branch;
|
|
@@ -207,10 +244,7 @@ const SingleOrderModalContent = _ref3 => {
|
|
|
207
244
|
setLocalBranchId(undefined);
|
|
208
245
|
}
|
|
209
246
|
}), (formula === _constants__.CONFIGURATOR_FORMULAS.TMG ? singleOrderBranchType : true) && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
210
|
-
options:
|
|
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
|
-
})),
|
|
247
|
+
options: branchOptions,
|
|
214
248
|
name: "branch",
|
|
215
249
|
label: "Vestiging:",
|
|
216
250
|
isRequired: true,
|
|
@@ -225,12 +259,39 @@ const SingleOrderModalContent = _ref3 => {
|
|
|
225
259
|
} = _ref5;
|
|
226
260
|
setSelectedBranchId(value);
|
|
227
261
|
setLocalBranchId(value);
|
|
262
|
+
const formulaCode = branchIdWithFormulaCode.get(value);
|
|
228
263
|
dispatch({
|
|
229
264
|
type: _OrderSessionContext.orderSessionActions.SET_SINGLE_ORDER_FORMULA_CODE,
|
|
230
265
|
payload: {
|
|
231
|
-
formulaCode
|
|
266
|
+
formulaCode
|
|
232
267
|
}
|
|
233
268
|
});
|
|
269
|
+
const selectedBranchData = filteredBranches === null || filteredBranches === void 0 ? void 0 : filteredBranches.find(b => b.entityId === value);
|
|
270
|
+
if (selectedBranchData) {
|
|
271
|
+
const isTowCenter = (selectedBranchData === null || selectedBranchData === void 0 ? void 0 : selectedBranchData.towCenterVestiging) === true;
|
|
272
|
+
const isTmgFormula = formula === _constants__.CONFIGURATOR_FORMULAS.TMG || formulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
|
|
273
|
+
const shouldEnable = isTowCenter || isTmgFormula;
|
|
274
|
+
dispatch({
|
|
275
|
+
type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
|
|
276
|
+
payload: {
|
|
277
|
+
isTowCenterBranch: isTowCenter
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
if (shouldEnable) {
|
|
281
|
+
dispatch({
|
|
282
|
+
type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
|
|
283
|
+
payload: {
|
|
284
|
+
anderAfleveradres: true
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
dispatch({
|
|
288
|
+
type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
|
|
289
|
+
payload: {
|
|
290
|
+
afhalenInWinkel: true
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
234
295
|
}
|
|
235
296
|
}));
|
|
236
297
|
};
|
|
@@ -256,8 +317,12 @@ const InternalBranchSelectorModal = () => {
|
|
|
256
317
|
existingDossierId,
|
|
257
318
|
orderType,
|
|
258
319
|
licensePlate,
|
|
259
|
-
model
|
|
320
|
+
model,
|
|
321
|
+
singleOrderFormulaCode
|
|
260
322
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
323
|
+
const {
|
|
324
|
+
branchById
|
|
325
|
+
} = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
|
|
261
326
|
const {
|
|
262
327
|
myBranches,
|
|
263
328
|
isLoadingMyBranches
|
|
@@ -278,6 +343,32 @@ const InternalBranchSelectorModal = () => {
|
|
|
278
343
|
});
|
|
279
344
|
_setSelectedBranchId(onlyBranchId);
|
|
280
345
|
}, [shouldAutoSelect, myBranches, dispatch]);
|
|
346
|
+
(0, _react.useEffect)(() => {
|
|
347
|
+
if (!selectedBranch || !branchById) return;
|
|
348
|
+
const isTowCenter = (branchById === null || branchById === void 0 ? void 0 : branchById.towCenterVestiging) === true;
|
|
349
|
+
const isTmgFormula = singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
|
|
350
|
+
const shouldEnable = isTowCenter || isTmgFormula;
|
|
351
|
+
dispatch({
|
|
352
|
+
type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
|
|
353
|
+
payload: {
|
|
354
|
+
isTowCenterBranch: isTowCenter
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
if (shouldEnable) {
|
|
358
|
+
dispatch({
|
|
359
|
+
type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
|
|
360
|
+
payload: {
|
|
361
|
+
anderAfleveradres: true
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
dispatch({
|
|
365
|
+
type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
|
|
366
|
+
payload: {
|
|
367
|
+
afhalenInWinkel: true
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}, [selectedBranch, branchById, singleOrderFormulaCode, dispatch]);
|
|
281
372
|
const handlePrimaryButtonClicked = () => {
|
|
282
373
|
dispatch({
|
|
283
374
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
|
|
@@ -174,7 +174,10 @@ 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
|
|
178
181
|
};
|
|
179
182
|
const orderSessionActions = exports.orderSessionActions = {
|
|
180
183
|
INITIALIZE_NEW_ORDER: 'INITIALIZE_NEW_ORDER',
|
|
@@ -252,7 +255,10 @@ const orderSessionActions = exports.orderSessionActions = {
|
|
|
252
255
|
SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE: 'SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE',
|
|
253
256
|
SET_CONSUMER_DISCOUNT_PERCENTAGE: 'SET_CONSUMER_DISCOUNT_PERCENTAGE',
|
|
254
257
|
SET_MONTAGE_RATE: 'SET_MONTAGE_RATE',
|
|
255
|
-
SET_IS_MONTAGE_TARIFF_FIXED: 'SET_IS_MONTAGE_TARIFF_FIXED'
|
|
258
|
+
SET_IS_MONTAGE_TARIFF_FIXED: 'SET_IS_MONTAGE_TARIFF_FIXED',
|
|
259
|
+
SET_IS_TOW_CENTER_BRANCH: 'SET_IS_TOW_CENTER_BRANCH',
|
|
260
|
+
SET_ANDER_AFLEVERADRES: 'SET_ANDER_AFLEVERADRES',
|
|
261
|
+
SET_AFHALEN_IN_WINKEL: 'SET_AFHALEN_IN_WINKEL'
|
|
256
262
|
};
|
|
257
263
|
const orderSessionReducer = (state, action) => {
|
|
258
264
|
switch (action.type) {
|
|
@@ -1136,6 +1142,33 @@ const orderSessionReducer = (state, action) => {
|
|
|
1136
1142
|
webshop
|
|
1137
1143
|
});
|
|
1138
1144
|
}
|
|
1145
|
+
case orderSessionActions.SET_IS_TOW_CENTER_BRANCH:
|
|
1146
|
+
{
|
|
1147
|
+
const {
|
|
1148
|
+
isTowCenterBranch
|
|
1149
|
+
} = action.payload;
|
|
1150
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1151
|
+
isTowCenterBranch
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
case orderSessionActions.SET_ANDER_AFLEVERADRES:
|
|
1155
|
+
{
|
|
1156
|
+
const {
|
|
1157
|
+
anderAfleveradres
|
|
1158
|
+
} = action.payload;
|
|
1159
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1160
|
+
anderAfleveradres
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
case orderSessionActions.SET_AFHALEN_IN_WINKEL:
|
|
1164
|
+
{
|
|
1165
|
+
const {
|
|
1166
|
+
afhalenInWinkel
|
|
1167
|
+
} = action.payload;
|
|
1168
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1169
|
+
afhalenInWinkel
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1139
1172
|
default:
|
|
1140
1173
|
return state;
|
|
1141
1174
|
}
|
|
@@ -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
|
} : {
|