thm-p3-configurator 0.0.145 → 0.0.148

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.
@@ -12,6 +12,8 @@ require("core-js/modules/esnext.iterator.map.js");
12
12
  require("core-js/modules/web.dom-collections.iterator.js");
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _reactRouterDom = require("react-router-dom");
15
+ var _constants__ = require("../__constants__");
16
+ var _OrderSessionContext = require("../__context__/OrderSessionContext");
15
17
  var _helpers__ = require("../__helpers__");
16
18
  function _getRequireWildcardCache(e) {
17
19
  if ("function" != typeof WeakMap) return null;
@@ -47,6 +49,14 @@ const NavigationSteps = _ref => {
47
49
  onClick = () => {}
48
50
  } = _ref;
49
51
  const [stepNumber, setStepNumber] = (0, _react.useState)(defaultActiveStep);
52
+ const [{
53
+ selectedCableset,
54
+ selectedTowbar,
55
+ selectedCombiset,
56
+ currentDossierType,
57
+ existingDossierType,
58
+ selectedBranch
59
+ }] = (0, _OrderSessionContext.useOrderSession)();
50
60
  const handleClick = _ref2 => {
51
61
  let {
52
62
  to,
@@ -60,6 +70,16 @@ const NavigationSteps = _ref => {
60
70
  stepNumber
61
71
  });
62
72
  };
73
+ const currentType = currentDossierType || existingDossierType || _constants__.DOSSIER_TYPES.PlannedAppointment;
74
+ const hasCableSetAndTowbar = selectedCableset && selectedTowbar || selectedCombiset;
75
+ const isStepDisabled = index => {
76
+ if (index >= 0 && index <= 2) return !hasCableSetAndTowbar;
77
+ if (index === 3) {
78
+ const needsBranch = currentType === _constants__.DOSSIER_TYPES.PlannedAppointment || currentType === _constants__.DOSSIER_TYPES.AppointmentRequest;
79
+ return !hasCableSetAndTowbar || needsBranch && !selectedBranch;
80
+ }
81
+ return false;
82
+ };
63
83
  return /*#__PURE__*/_react.default.createElement("div", {
64
84
  className: (0, _helpers__.withStyle)('col-12')
65
85
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -74,7 +94,7 @@ const NavigationSteps = _ref => {
74
94
  } = _ref3;
75
95
  return /*#__PURE__*/_react.default.createElement(_reactRouterDom.NavLink, {
76
96
  key: title,
77
- className: "".concat((0, _helpers__.withStyle)('btn'), " ").concat(isEveryStepActive || stepNumber >= index ? (0, _helpers__.withStyle)('active') : '', " ").concat(index > 0 && isNavigationDisabled ? (0, _helpers__.withStyle)('disabled') : '', " "),
97
+ className: "".concat((0, _helpers__.withStyle)('btn'), " ").concat(isEveryStepActive || stepNumber >= index ? (0, _helpers__.withStyle)('active') : '', " ").concat(index > stepNumber && isStepDisabled(index) || index > 0 && isNavigationDisabled ? (0, _helpers__.withStyle)('disabled') : ''),
78
98
  onClick: () => handleClick({
79
99
  to,
80
100
  title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.145",
3
+ "version": "0.0.148",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",