thm-p3-configurator 0.0.87 → 0.0.89

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.
@@ -107,7 +107,8 @@ const DropdownInput = _ref => {
107
107
  form,
108
108
  initialValue = '',
109
109
  errorMessage = '',
110
- isClearable = false
110
+ isClearable = false,
111
+ isDisabled = false
111
112
  } = _ref;
112
113
  const [value, setValue] = (0, _react.useState)(() => {
113
114
  if (!initialValue || !(options !== null && options !== void 0 && options.length)) return null;
@@ -152,6 +153,7 @@ const DropdownInput = _ref => {
152
153
  classNamePrefix: (0, _helpers__.withStyle)('form-select'),
153
154
  onChange: option => handleChange(option),
154
155
  isLoading: isLoading,
156
+ isDisabled: isDisabled,
155
157
  styles: {
156
158
  menuList: base => _objectSpread(_objectSpread({}, base), {}, {
157
159
  maxHeight: lgSize ? '20vh' : xxlSize ? '10vh' : '18vh'
@@ -84,7 +84,7 @@ const ButtonByType = _ref => {
84
84
  }
85
85
  };
86
86
  const BottomNavigationBar = () => {
87
- var _history$location, _history$location2;
87
+ var _history$location, _history$location2, _history$location3;
88
88
  const history = (0, _reactRouterDom.useHistory)();
89
89
  const buttons = _constants__.NAVIGATION_BUTTONS === null || _constants__.NAVIGATION_BUTTONS === void 0 ? void 0 : _constants__.NAVIGATION_BUTTONS[history === null || history === void 0 || (_history$location = history.location) === null || _history$location === void 0 ? void 0 : _history$location.pathname];
90
90
  let [{
@@ -112,10 +112,14 @@ const BottomNavigationBar = () => {
112
112
  className: (0, _helpers__.withStyle)('container justify-content-center')
113
113
  }, /*#__PURE__*/_react.default.createElement("div", {
114
114
  className: (0, _helpers__.withStyle)('row justify-content-center')
115
- }, APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement("div", {
116
- className: (0, _helpers__.withStyle)('col-12 mt-2 mb-1')
117
- }, /*#__PURE__*/_react.default.createElement(_InternalPriceCalculationSelector.default, null)), buttons.map(_ref2 => {
118
- var _history$location3;
115
+ }, APP_CONFIG.internal && (history === null || history === void 0 || (_history$location3 = history.location) === null || _history$location3 === void 0 ? void 0 : _history$location3.pathname) === '/configurator/trekhaakpakket' && /*#__PURE__*/_react.default.createElement("div", {
116
+ className: (0, _helpers__.withStyle)('col-7 mt-2 mb-1')
117
+ }, /*#__PURE__*/_react.default.createElement(_InternalPriceCalculationSelector.default, null)), /*#__PURE__*/_react.default.createElement("div", {
118
+ className: (0, _helpers__.withStyle)('col-12')
119
+ }, /*#__PURE__*/_react.default.createElement("div", {
120
+ className: (0, _helpers__.withStyle)('row justify-content-center')
121
+ }, buttons.map(_ref2 => {
122
+ var _history$location4;
119
123
  let {
120
124
  to,
121
125
  label,
@@ -155,8 +159,8 @@ const BottomNavigationBar = () => {
155
159
  state: {
156
160
  prevPathName: history.location.pathname
157
161
  },
158
- isDisabled: (!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || type === 'next' && (history === null || history === void 0 || (_history$location3 = history.location) === null || _history$location3 === void 0 ? void 0 : _history$location3.pathname) === '/configurator/montagelocatie' && !selectedBranch
162
+ isDisabled: (!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || type === 'next' && (history === null || history === void 0 || (_history$location4 = history.location) === null || _history$location4 === void 0 ? void 0 : _history$location4.pathname) === '/configurator/montagelocatie' && !selectedBranch
159
163
  })));
160
- })))));
164
+ })))))));
161
165
  };
162
166
  var _default = exports.default = BottomNavigationBar;
@@ -26,6 +26,8 @@ var _OrderSessionContext = require("../__context__/OrderSessionContext");
26
26
  var _helpers__ = require("../__helpers__");
27
27
  var _image = require("../__helpers__/image");
28
28
  var _product = require("../__helpers__/product");
29
+ var _useIsTmg = require("../__hooks__/useIsTmg");
30
+ var _CheckboxInput = _interopRequireDefault(require("../__components__/Form/CheckboxInput"));
29
31
  function _interopRequireDefault(e) {
30
32
  return e && e.__esModule ? e : {
31
33
  default: e
@@ -60,6 +62,8 @@ const ExtraProductsOverview = () => {
60
62
  var _products$Extras;
61
63
  const isProductsInitialLoad = (0, _react.useRef)(true);
62
64
  const formula = (0, _FormulaContext.useFormula)();
65
+ const isTmg = (0, _useIsTmg.useIsTmg)();
66
+ const [skipFilters, setSkipFilters] = (0, _react.useState)(false);
63
67
  const [{
64
68
  licensePlate,
65
69
  model,
@@ -102,7 +106,8 @@ const ExtraProductsOverview = () => {
102
106
  selectBoardComputerUpdate: selectedBoardComputer != null,
103
107
  cart: cartInput ? JSON.stringify(cartInput) : undefined,
104
108
  formula,
105
- discountCode
109
+ discountCode,
110
+ skipFilters
106
111
  });
107
112
  if (isLoadingProducts && isProductsInitialLoad.current === true) {
108
113
  isProductsInitialLoad.current = false;
@@ -142,7 +147,14 @@ const ExtraProductsOverview = () => {
142
147
  delete products[_constants__.PRODUCT_CATEGORIES.CABLESET];
143
148
  delete products[_constants__.PRODUCT_CATEGORIES.COMBISET];
144
149
  delete products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER];
145
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, Object.entries(products).map((_ref3, index) => {
150
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isTmg && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
151
+ name: 'skipFilters',
152
+ initialValue: skipFilters,
153
+ onChange: value => {
154
+ setSkipFilters(value);
155
+ },
156
+ label: "Toon alle artikelen"
157
+ }), Object.entries(products).map((_ref3, index) => {
146
158
  let [productCategory, productsPerCategory] = _ref3;
147
159
  if (!productsPerCategory.length || productCategory !== _constants__.PRODUCT_CATEGORIES.EXTRAS) {
148
160
  return null;
@@ -32,11 +32,13 @@ var _ProductCard = _interopRequireDefault(require("../__components__/ProductCard
32
32
  var _FullPageSpinner = _interopRequireDefault(require("../__components__/Spinners/FullPageSpinner"));
33
33
  var _constants__ = require("../__constants__");
34
34
  var _FormulaContext = require("../__context__/FormulaContext");
35
+ var _useIsTmg = require("../__hooks__/useIsTmg");
35
36
  var _OrderSessionContext = require("../__context__/OrderSessionContext");
36
37
  var _helpers__ = require("../__helpers__");
37
38
  var _image = require("../__helpers__/image");
38
39
  var _product = require("../__helpers__/product");
39
40
  var _BoardComputerCard = _interopRequireDefault(require("./BoardComputerCard"));
41
+ var _CheckboxInput = _interopRequireDefault(require("../__components__/Form/CheckboxInput"));
40
42
  function _interopRequireDefault(e) {
41
43
  return e && e.__esModule ? e : {
42
44
  default: e
@@ -71,6 +73,8 @@ const ProductsOverview = () => {
71
73
  var _products$Trekhaak, _products$Kabelset, _products$Combiset;
72
74
  const isProductsInitialLoad = (0, _react.useRef)(true);
73
75
  const formula = (0, _FormulaContext.useFormula)();
76
+ const isTmg = (0, _useIsTmg.useIsTmg)();
77
+ const [skipFilters, setSkipFilters] = (0, _react.useState)(false);
74
78
  const [{
75
79
  licensePlate,
76
80
  model,
@@ -116,7 +120,8 @@ const ProductsOverview = () => {
116
120
  cart: cartInput ? JSON.stringify(cartInput) : undefined,
117
121
  formula,
118
122
  discountCode,
119
- priceCalculationDate
123
+ priceCalculationDate,
124
+ skipFilters
120
125
  });
121
126
  if (isLoadingProducts && isProductsInitialLoad.current === true) {
122
127
  isProductsInitialLoad.current = false;
@@ -183,7 +188,14 @@ const ProductsOverview = () => {
183
188
 
184
189
  // Filter out Extras category from products object
185
190
  delete products[_constants__.PRODUCT_CATEGORIES.EXTRAS];
186
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, Object.entries(products).map((_ref3, index) => {
191
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isTmg && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
192
+ name: 'skipFilters',
193
+ initialValue: skipFilters,
194
+ onChange: value => {
195
+ setSkipFilters(value);
196
+ },
197
+ label: "Toon alle artikelen"
198
+ }), Object.entries(products).map((_ref3, index) => {
187
199
  let [productCategory, productsPerCategory] = _ref3;
188
200
  if (!productsPerCategory.length) {
189
201
  return null;
@@ -164,6 +164,7 @@ const InternalAppointmentForm = _ref => {
164
164
  channel,
165
165
  durationAnswer,
166
166
  allowLocationChange,
167
+ existingDossierId,
167
168
  selectedBoardComputer,
168
169
  selectedCableset,
169
170
  selectedCombiset,
@@ -395,7 +396,8 @@ const InternalAppointmentForm = _ref => {
395
396
  }
396
397
  }
397
398
  });
398
- }
399
+ },
400
+ isDisabled: !!existingDossierId
399
401
  }), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
400
402
  name: "ownershipType",
401
403
  label: "Type:",
@@ -47,7 +47,7 @@ const InternalCancelDossierEdit = () => {
47
47
  className: (0, _helpers__.withStyle)('col-12 col-md-8 mb-1 mb-md-0')
48
48
  }, /*#__PURE__*/_react.default.createElement("p", {
49
49
  className: (0, _helpers__.withStyle)('mb-0')
50
- }, ' ', "U bewerkt het dossier", ' ', /*#__PURE__*/_react.default.createElement("strong", null, (dossierById === null || dossierById === void 0 ? void 0 : dossierById.title) || existingDossierId, " "))), /*#__PURE__*/_react.default.createElement("div", {
50
+ }, ' ', "U bewerkt het dossier ", /*#__PURE__*/_react.default.createElement("strong", null, dossierById === null || dossierById === void 0 ? void 0 : dossierById.title, " "))), /*#__PURE__*/_react.default.createElement("div", {
51
51
  className: (0, _helpers__.withStyle)('col-12 col-md-4')
52
52
  }, /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
53
53
  type: "button",
@@ -56,6 +56,6 @@ const InternalCancelDossierEdit = () => {
56
56
  className: "fa fa-times"
57
57
  }), " Wijzigingen annuleren"),
58
58
  onClick: handleCancel
59
- }))));
59
+ }), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("em", null, "Dossier ID: ", (dossierById === null || dossierById === void 0 ? void 0 : dossierById.dossierId) || existingDossierId))));
60
60
  };
61
61
  var _default = exports.default = InternalCancelDossierEdit;
@@ -149,6 +149,7 @@ const InternalQuotationForm = _ref => {
149
149
  executionAnswer2,
150
150
  priceCalculationDate,
151
151
  durationAnswer,
152
+ existingDossierId,
152
153
  selectedBoardComputer,
153
154
  selectedCableset,
154
155
  selectedCombiset,
@@ -297,6 +298,7 @@ const InternalQuotationForm = _ref => {
297
298
  name: "channel",
298
299
  label: "Kanaal:",
299
300
  isRequired: true,
301
+ isDisabled: !!existingDossierId,
300
302
  isLoading: isLoadingMarketingChannels,
301
303
  noOptionsMessage: "Geen opties beschikbaar",
302
304
  placeholder: "Maak een keuze",
@@ -18,11 +18,11 @@ var _DangerAlert = _interopRequireDefault(require("../../__components__/DangerAl
18
18
  var _CheckboxInput = _interopRequireDefault(require("../../__components__/Form/CheckboxInput"));
19
19
  var _DropdownInput = _interopRequireDefault(require("../../__components__/Form/DropdownInput"));
20
20
  var _TextInput = _interopRequireDefault(require("../../__components__/Form/TextInput"));
21
- var _constants__ = require("../../__constants__");
22
21
  var _FormulaContext = require("../../__context__/FormulaContext");
23
22
  var _OrderSessionContext = require("../../__context__/OrderSessionContext");
24
23
  var _helpers__ = require("../../__helpers__");
25
24
  var _useAuthSession = require("../../__hooks__/useAuthSession");
25
+ var _useIsTmg = require("../../__hooks__/useIsTmg");
26
26
  function _interopRequireDefault(e) {
27
27
  return e && e.__esModule ? e : {
28
28
  default: e
@@ -82,11 +82,7 @@ const InternalSingleOrderFilters = /*#__PURE__*/(0, _react.forwardRef)((_ref, re
82
82
  const {
83
83
  branch
84
84
  } = (0, _useAuthSession.useAuthSession)();
85
- const isTmg = (0, _react.useMemo)(() => {
86
- var _branchTypes$byId;
87
- const branchType = branchTypes === null || branchTypes === void 0 || (_branchTypes$byId = branchTypes.byId) === null || _branchTypes$byId === void 0 ? void 0 : _branchTypes$byId[branch === null || branch === void 0 ? void 0 : branch.organisatietype];
88
- return (branchType === null || branchType === void 0 ? void 0 : branchType.title) === _constants__.TMG_ORGANIZATION_TYPE;
89
- }, [branchTypes, branch]);
85
+ const isTmg = (0, _useIsTmg.useIsTmg)();
90
86
  const [selectedArticleType, setSelectedArticleType] = (0, _react.useState)('');
91
87
  const [selectedArticleGroup, setSelectedArticleGroup] = (0, _react.useState)('');
92
88
  const [selectedArticleSubGroup, setSelectedArticleSubGroup] = (0, _react.useState)('');
@@ -131,9 +127,7 @@ const InternalSingleOrderFilters = /*#__PURE__*/(0, _react.forwardRef)((_ref, re
131
127
  }
132
128
  }, [selectedArticleGroup]);
133
129
  (0, _react.useEffect)(() => {
134
- if (!licensePlate && !model) {
135
- onFilterChange('showAllArticles', showAllArticles);
136
- }
130
+ onFilterChange('showAllArticles', showAllArticles);
137
131
  }, [showAllArticles]);
138
132
  (0, _react.useEffect)(() => {
139
133
  if (!licensePlate && !model) {
@@ -245,7 +239,6 @@ const InternalSingleOrderFilters = /*#__PURE__*/(0, _react.forwardRef)((_ref, re
245
239
  name: 'showAllArticles',
246
240
  initialValue: showAllArticles,
247
241
  onChange: value => {
248
- resetLicensePlateFilters();
249
242
  setShowAllArticles(value);
250
243
  },
251
244
  label: "Toon alle artikelen"
@@ -156,7 +156,8 @@ const INITIAL_ORDER_SESSION_STATE = {
156
156
  note: '',
157
157
  zipCode: '',
158
158
  houseNumber: '',
159
- companyName: ''
159
+ companyName: '',
160
+ anwbId: null
160
161
  }
161
162
  };
162
163
  const orderSessionActions = exports.orderSessionActions = {
@@ -67,7 +67,7 @@ function _toPrimitive(t, r) {
67
67
  * @description Covnerts an existing hyper dossier object into a local order session
68
68
  */
69
69
  const parseDossierToOrderSession = exports.parseDossierToOrderSession = function parseDossierToOrderSession() {
70
- var _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$statusDossie, _dossier$statusDossie2, _dossier$vestiging, _dossier$typeEigendom, _Date, _dossier$klant, _dossier$klant2, _dossier$klant3, _dossier$klant4, _dossier$klant5, _dossier$klant$postal, _dossier$klant6, _dossier$klant$city, _dossier$klant7, _dossier$klant$street, _dossier$klant8, _dossier$klant$huisnu, _dossier$klant9;
70
+ var _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$statusDossie, _dossier$statusDossie2, _dossier$vestiging, _dossier$typeEigendom, _Date, _dossier$klant, _dossier$klant2, _dossier$klant3, _dossier$klant4, _dossier$klant5, _dossier$klant$postal, _dossier$klant6, _dossier$klant$city, _dossier$klant7, _dossier$klant$street, _dossier$klant8, _dossier$klant$huisnu, _dossier$klant9, _dossier$anwbId;
71
71
  let dossier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
72
72
  return {
73
73
  licensePlate: dossier === null || dossier === void 0 ? void 0 : dossier.kenteken,
@@ -123,7 +123,8 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
123
123
  zipCode: (_dossier$klant$postal = dossier === null || dossier === void 0 || (_dossier$klant6 = dossier.klant) === null || _dossier$klant6 === void 0 ? void 0 : _dossier$klant6.postalCode) !== null && _dossier$klant$postal !== void 0 ? _dossier$klant$postal : undefined,
124
124
  city: (_dossier$klant$city = dossier === null || dossier === void 0 || (_dossier$klant7 = dossier.klant) === null || _dossier$klant7 === void 0 ? void 0 : _dossier$klant7.city) !== null && _dossier$klant$city !== void 0 ? _dossier$klant$city : undefined,
125
125
  streetName: (_dossier$klant$street = dossier === null || dossier === void 0 || (_dossier$klant8 = dossier.klant) === null || _dossier$klant8 === void 0 ? void 0 : _dossier$klant8.street) !== null && _dossier$klant$street !== void 0 ? _dossier$klant$street : undefined,
126
- houseNumber: (_dossier$klant$huisnu = dossier === null || dossier === void 0 || (_dossier$klant9 = dossier.klant) === null || _dossier$klant9 === void 0 ? void 0 : _dossier$klant9.huisnummer) !== null && _dossier$klant$huisnu !== void 0 ? _dossier$klant$huisnu : undefined
126
+ houseNumber: (_dossier$klant$huisnu = dossier === null || dossier === void 0 || (_dossier$klant9 = dossier.klant) === null || _dossier$klant9 === void 0 ? void 0 : _dossier$klant9.huisnummer) !== null && _dossier$klant$huisnu !== void 0 ? _dossier$klant$huisnu : undefined,
127
+ anwbId: (_dossier$anwbId = dossier === null || dossier === void 0 ? void 0 : dossier.anwbId) !== null && _dossier$anwbId !== void 0 ? _dossier$anwbId : undefined
127
128
  }
128
129
  };
129
130
  };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useIsTmg = void 0;
7
+ var _react = require("react");
8
+ var _queries = require("../__api__/queries");
9
+ var _constants__ = require("../__constants__");
10
+ var _useAuthSession = require("./useAuthSession");
11
+ const useIsTmg = () => {
12
+ const {
13
+ branchTypes
14
+ } = (0, _queries.useBranchTypes)();
15
+ const {
16
+ branch
17
+ } = (0, _useAuthSession.useAuthSession)();
18
+ return (0, _react.useMemo)(() => {
19
+ var _branchTypes$byId;
20
+ const branchType = branchTypes === null || branchTypes === void 0 || (_branchTypes$byId = branchTypes.byId) === null || _branchTypes$byId === void 0 ? void 0 : _branchTypes$byId[branch === null || branch === void 0 ? void 0 : branch.organisatietype];
21
+ return (branchType === null || branchType === void 0 ? void 0 : branchType.title) === _constants__.TMG_ORGANIZATION_TYPE;
22
+ }, [branchTypes, branch]);
23
+ };
24
+ exports.useIsTmg = useIsTmg;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",