thm-p3-configurator 0.0.32 → 0.0.34
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__/Form/LicensePlateInput.js +5 -2
- package/dist/src/shared/__components__/LocationsSelector/LocationList.js +1 -1
- package/dist/src/shared/__components__/LocationsSelector/index.js +1 -1
- package/dist/src/shared/__containers__/LicensePlateForm.js +2 -2
- package/dist/src/shared/__containers__/internal/InternalBranchSelectorModal.js +13 -12
- package/dist/src/shared/__containers__/internal/InternalCancelDossierEdit.js +1 -1
- package/dist/src/shared/__context__/OrderSessionContext.js +4 -0
- package/dist/src/shared/__helpers__/dossier.js +2 -2
- package/package.json +1 -1
|
@@ -50,13 +50,16 @@ const LicensePlateInput = _ref => {
|
|
|
50
50
|
onChange = () => {},
|
|
51
51
|
onSubmit = () => {}
|
|
52
52
|
} = _ref;
|
|
53
|
-
const [value, setValue] = (0, _react.useState)(licensePlateValidator.init(initialValue));
|
|
53
|
+
const [value, setValue] = (0, _react.useState)(licensePlateValidator.init(initialValue) || '');
|
|
54
54
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
55
55
|
const handleChange = value => {
|
|
56
|
-
const parsedLicensePlate = licensePlateValidator.init(value);
|
|
56
|
+
const parsedLicensePlate = licensePlateValidator.init(value) || '';
|
|
57
57
|
setValue(parsedLicensePlate);
|
|
58
58
|
onChange(parsedLicensePlate);
|
|
59
59
|
};
|
|
60
|
+
(0, _react.useEffect)(() => {
|
|
61
|
+
handleChange(initialValue);
|
|
62
|
+
}, [initialValue]);
|
|
60
63
|
const handleKeyDown = key => {
|
|
61
64
|
if (isFocused) {
|
|
62
65
|
setIsFocused(false);
|
|
@@ -128,7 +128,7 @@ const LocationList = _ref => {
|
|
|
128
128
|
selectedBranch
|
|
129
129
|
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
130
130
|
const selectedRef = (0, _react.useRef)(null);
|
|
131
|
-
const locationsWithDistance = locationIds.map(locationId => {
|
|
131
|
+
const locationsWithDistance = locationIds.map((locationId, index) => {
|
|
132
132
|
const location = locationsById[locationId];
|
|
133
133
|
const coordinates = location.googleMapsLocation;
|
|
134
134
|
if (!coordinates) return null;
|
|
@@ -123,7 +123,7 @@ const LocationsSelector = /*#__PURE__*/_react.default.memo(() => {
|
|
|
123
123
|
}), franchiseName && /*#__PURE__*/_react.default.createElement("h6", {
|
|
124
124
|
className: (0, _helpers__.withStyle)('my-2')
|
|
125
125
|
}, "Keten: ", franchiseName), /*#__PURE__*/_react.default.createElement(_LocationList.default, {
|
|
126
|
-
locationIds:
|
|
126
|
+
locationIds: allIds,
|
|
127
127
|
locationsById: byId,
|
|
128
128
|
userLocation: userLocation
|
|
129
129
|
})))));
|
|
@@ -78,7 +78,7 @@ const LicensePlateForm = _ref => {
|
|
|
78
78
|
} = (0, _reactRouter.useLocation)();
|
|
79
79
|
const searchParams = new URLSearchParams(search);
|
|
80
80
|
(0, _react.useEffect)(() => {
|
|
81
|
-
|
|
81
|
+
handleLicensePlateChange(initialValue);
|
|
82
82
|
}, [initialValue]);
|
|
83
83
|
const handleManualSwitch = () => {
|
|
84
84
|
history.push("/configurator/manual".concat(searchParams !== null && searchParams !== void 0 && searchParams.size ? "?".concat(searchParams.toString()) : '') // append search params if found
|
|
@@ -118,7 +118,7 @@ const LicensePlateForm = _ref => {
|
|
|
118
118
|
className: (0, _helpers__.withStyle)('btn btn-primary'),
|
|
119
119
|
type: "button",
|
|
120
120
|
onClick: onSubmit,
|
|
121
|
-
isDisabled: !licensePlate || licensePlate.length < 6,
|
|
121
|
+
isDisabled: !licensePlate || (licensePlate === null || licensePlate === void 0 ? void 0 : licensePlate.length) < 6,
|
|
122
122
|
label: 'Volgende'
|
|
123
123
|
})))));
|
|
124
124
|
};
|
|
@@ -64,20 +64,13 @@ const InternalBranchSelectorModal = () => {
|
|
|
64
64
|
myBranchesError
|
|
65
65
|
} = (0, _queries.useMyBranches)(formula);
|
|
66
66
|
const [{
|
|
67
|
-
selectedBranch
|
|
67
|
+
selectedBranch,
|
|
68
|
+
existingDossierId
|
|
68
69
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
69
|
-
const handlePrimaryButtonClicked = () => {
|
|
70
|
-
dispatch({
|
|
71
|
-
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
|
|
72
|
-
payload: {
|
|
73
|
-
branchId: _selectedBranchId
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
70
|
(0, _react.useEffect)(() => {
|
|
78
71
|
var _branchTypes$byId$aut, _authSession$branch, _myBranches$;
|
|
79
72
|
// If it's a TMG group, do nothing
|
|
80
|
-
if ((branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut = branchTypes.byId[authSession === null || authSession === void 0 || (_authSession$branch = authSession.branch) === null || _authSession$branch === void 0 || (_authSession$branch = _authSession$branch.organisatietype) === null || _authSession$branch === void 0 ? void 0 : _authSession$branch[0]]) === null || _branchTypes$byId$aut === void 0 ? void 0 : _branchTypes$byId$aut.title) === _constants__.TMG_ORGANIZATION_TYPE) {
|
|
73
|
+
if (existingDossierId || (branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut = branchTypes.byId[authSession === null || authSession === void 0 || (_authSession$branch = authSession.branch) === null || _authSession$branch === void 0 || (_authSession$branch = _authSession$branch.organisatietype) === null || _authSession$branch === void 0 ? void 0 : _authSession$branch[0]]) === null || _branchTypes$byId$aut === void 0 ? void 0 : _branchTypes$byId$aut.title) === _constants__.TMG_ORGANIZATION_TYPE) {
|
|
81
74
|
return;
|
|
82
75
|
}
|
|
83
76
|
|
|
@@ -93,7 +86,15 @@ const InternalBranchSelectorModal = () => {
|
|
|
93
86
|
branchId: myBranches === null || myBranches === void 0 || (_myBranches$ = myBranches[0]) === null || _myBranches$ === void 0 ? void 0 : _myBranches$.entityId
|
|
94
87
|
}
|
|
95
88
|
});
|
|
96
|
-
}, [selectedBranch, myBranches, branchTypes, authSession]);
|
|
89
|
+
}, [selectedBranch, myBranches, branchTypes, authSession, existingDossierId]);
|
|
90
|
+
const handlePrimaryButtonClicked = () => {
|
|
91
|
+
dispatch({
|
|
92
|
+
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
|
|
93
|
+
payload: {
|
|
94
|
+
branchId: _selectedBranchId
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
};
|
|
97
98
|
if (isLoadingBranchTypes) {
|
|
98
99
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
99
100
|
className: "thm-configurator-wrapper--offset"
|
|
@@ -101,7 +102,7 @@ const InternalBranchSelectorModal = () => {
|
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
// Note: if the current formula is TowMotive Group, do not show the modal (the branch selection happens on the step before the appointment)
|
|
104
|
-
if ((branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut2 = branchTypes.byId[authSession === null || authSession === void 0 || (_authSession$branch2 = authSession.branch) === null || _authSession$branch2 === void 0 || (_authSession$branch2 = _authSession$branch2.organisatietype) === null || _authSession$branch2 === void 0 ? void 0 : _authSession$branch2[0]]) === null || _branchTypes$byId$aut2 === void 0 ? void 0 : _branchTypes$byId$aut2.title) === _constants__.TMG_ORGANIZATION_TYPE) {
|
|
105
|
+
if (existingDossierId || (branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut2 = branchTypes.byId[authSession === null || authSession === void 0 || (_authSession$branch2 = authSession.branch) === null || _authSession$branch2 === void 0 || (_authSession$branch2 = _authSession$branch2.organisatietype) === null || _authSession$branch2 === void 0 ? void 0 : _authSession$branch2[0]]) === null || _branchTypes$byId$aut2 === void 0 ? void 0 : _branchTypes$byId$aut2.title) === _constants__.TMG_ORGANIZATION_TYPE) {
|
|
105
106
|
return null;
|
|
106
107
|
}
|
|
107
108
|
return /*#__PURE__*/_react.default.createElement(_Modal.default, {
|
|
@@ -74,8 +74,8 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
|
|
|
74
74
|
model: dossier !== null && dossier !== void 0 && dossier.kenteken ? null : dossier === null || dossier === void 0 ? void 0 : dossier.model,
|
|
75
75
|
// Note: only fill in when license plate is empty
|
|
76
76
|
channel: {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
channelType: dossier === null || dossier === void 0 || (_dossier$kanaal = dossier.kanaal) === null || _dossier$kanaal === void 0 ? void 0 : _dossier$kanaal.entityId,
|
|
78
|
+
channelId: dossier === null || dossier === void 0 || (_dossier$kanaalPartne = dossier.kanaalPartner) === null || _dossier$kanaalPartne === void 0 ? void 0 : _dossier$kanaalPartne.entityId
|
|
79
79
|
},
|
|
80
80
|
durationAnswer: dossier === null || dossier === void 0 ? void 0 : dossier.looptijd,
|
|
81
81
|
executionAnswer1: dossier === null || dossier === void 0 ? void 0 : dossier.uitvoeringTrekhaakExecuton1,
|