thm-p3-configurator 0.0.89 → 0.0.91

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.
@@ -20,7 +20,6 @@ var _NavigationButton = _interopRequireDefault(require("../__components__/Button
20
20
  var _constants__ = require("../__constants__");
21
21
  var _OrderSessionContext = require("../__context__/OrderSessionContext");
22
22
  var _helpers__ = require("../__helpers__");
23
- var _InternalPriceCalculationSelector = _interopRequireDefault(require("./internal/InternalPriceCalculationSelector"));
24
23
  const _excluded = ["type"];
25
24
  function _interopRequireDefault(e) {
26
25
  return e && e.__esModule ? e : {
@@ -84,7 +83,7 @@ const ButtonByType = _ref => {
84
83
  }
85
84
  };
86
85
  const BottomNavigationBar = () => {
87
- var _history$location, _history$location2, _history$location3;
86
+ var _history$location, _history$location2;
88
87
  const history = (0, _reactRouterDom.useHistory)();
89
88
  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
89
  let [{
@@ -93,7 +92,6 @@ const BottomNavigationBar = () => {
93
92
  selectedCombiset,
94
93
  selectedBranch,
95
94
  existingDossierType,
96
- existingDossierId,
97
95
  allowLocationChange,
98
96
  currentDossierType
99
97
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
@@ -112,14 +110,12 @@ const BottomNavigationBar = () => {
112
110
  className: (0, _helpers__.withStyle)('container justify-content-center')
113
111
  }, /*#__PURE__*/_react.default.createElement("div", {
114
112
  className: (0, _helpers__.withStyle)('row justify-content-center')
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", {
113
+ }, /*#__PURE__*/_react.default.createElement("div", {
118
114
  className: (0, _helpers__.withStyle)('col-12')
119
115
  }, /*#__PURE__*/_react.default.createElement("div", {
120
116
  className: (0, _helpers__.withStyle)('row justify-content-center')
121
117
  }, buttons.map(_ref2 => {
122
- var _history$location4;
118
+ var _history$location3;
123
119
  let {
124
120
  to,
125
121
  label,
@@ -159,7 +155,7 @@ const BottomNavigationBar = () => {
159
155
  state: {
160
156
  prevPathName: history.location.pathname
161
157
  },
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
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
163
159
  })));
164
160
  })))))));
165
161
  };
@@ -147,14 +147,7 @@ const ExtraProductsOverview = () => {
147
147
  delete products[_constants__.PRODUCT_CATEGORIES.CABLESET];
148
148
  delete products[_constants__.PRODUCT_CATEGORIES.COMBISET];
149
149
  delete products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER];
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) => {
150
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, Object.entries(products).map((_ref3, index) => {
158
151
  let [productCategory, productsPerCategory] = _ref3;
159
152
  if (!productsPerCategory.length || productCategory !== _constants__.PRODUCT_CATEGORIES.EXTRAS) {
160
153
  return null;
@@ -351,6 +351,10 @@ const InternalAppointmentForm = _ref => {
351
351
  }
352
352
  });
353
353
  };
354
+ const initialChannel = channel !== null && channel !== void 0 && channel.channelId ? {
355
+ label: marketingChannels === null || marketingChannels === void 0 || (_marketingChannels$fi = marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId))) === null || _marketingChannels$fi === void 0 ? void 0 : _marketingChannels$fi.title,
356
+ value: 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))
357
+ } : null;
354
358
  return /*#__PURE__*/_react.default.createElement("div", {
355
359
  className: (0, _helpers__.withStyle)('row gx-5 mt-3 mt-lg-5')
356
360
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -365,7 +369,7 @@ const InternalAppointmentForm = _ref => {
365
369
  isDisabled: !branchById
366
370
  })), /*#__PURE__*/_react.default.createElement("div", {
367
371
  className: (0, _helpers__.withStyle)('col-12 mb-2')
368
- }, /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
372
+ }, !existingDossierId || existingDossierId && initialChannel !== null && initialChannel !== void 0 && initialChannel.value ? /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
369
373
  options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
370
374
  label: channel === null || channel === void 0 ? void 0 : channel.title,
371
375
  value: channel
@@ -377,10 +381,7 @@ const InternalAppointmentForm = _ref => {
377
381
  noOptionsMessage: "Geen opties beschikbaar",
378
382
  placeholder: "Maak een keuze",
379
383
  errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelType']) || (errors === null || errors === void 0 ? void 0 : errors['channelId']),
380
- initialValue: channel !== null && channel !== void 0 && channel.channelId ? {
381
- label: marketingChannels === null || marketingChannels === void 0 || (_marketingChannels$fi = marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId))) === null || _marketingChannels$fi === void 0 ? void 0 : _marketingChannels$fi.title,
382
- value: 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))
383
- } : null,
384
+ initialValue: initialChannel,
384
385
  onChange: _ref3 => {
385
386
  var _value$kanaalType;
386
387
  let {
@@ -398,7 +399,7 @@ const InternalAppointmentForm = _ref => {
398
399
  });
399
400
  },
400
401
  isDisabled: !!existingDossierId
401
- }), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
402
+ }) : null, /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
402
403
  name: "ownershipType",
403
404
  label: "Type:",
404
405
  initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType,
@@ -36,7 +36,14 @@ const InternalCancelDossierEdit = () => {
36
36
  shouldForceReset: true
37
37
  }
38
38
  });
39
- history.push('/dashboard');
39
+ switch (existingDossierType) {
40
+ case 'appointment':
41
+ history.push("/afspraken/".concat(existingDossierId));
42
+ break;
43
+ case 'quotation':
44
+ history.push("/offertes/".concat(existingDossierId));
45
+ break;
46
+ }
40
47
  };
41
48
  if (!existingDossierId) return null;
42
49
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -123,8 +123,16 @@ const internalQuotationFormSchema = (0, _yup.object)({
123
123
  leaseNumber: (0, _yup.string)().nullable(),
124
124
  firstName: (0, _yup.string)().nullable(),
125
125
  chassisNumber: (0, _yup.string)().nullable(),
126
- channelType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
127
- channelId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
126
+ channelType: (0, _yup.string)().when('$existingDossierId', {
127
+ is: val => !val,
128
+ then: () => (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
129
+ otherwise: () => (0, _yup.string)().nullable()
130
+ }),
131
+ channelId: (0, _yup.string)().when('$existingDossierId', {
132
+ is: val => !val,
133
+ then: () => (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
134
+ otherwise: () => (0, _yup.string)().nullable()
135
+ }),
128
136
  infix: (0, _yup.string)().nullable(),
129
137
  lastName: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
130
138
  email: (0, _yup.string)().email(_constants__.FORM_ERROR_MESSAGES.email).required(_constants__.FORM_ERROR_MESSAGES.required),
@@ -229,10 +237,14 @@ const InternalQuotationForm = _ref => {
229
237
  // However: dont submit empty strings to the API because the API doesnt accept empty strings in place of `undefined`
230
238
  // Rule in custom API: a field can be optional (can be undefined), but once you fill it in with a value, that value has to be truthy.
231
239
  channelType: (channel === null || channel === void 0 ? void 0 : channel.channelType) || '',
232
- channelId: (channel === null || channel === void 0 ? void 0 : channel.channelId) || ''
240
+ channelId: (channel === null || channel === void 0 ? void 0 : channel.channelId) || '',
241
+ $existingDossierId: existingDossierId
233
242
  }), {
234
243
  strict: false,
235
- abortEarly: false
244
+ abortEarly: false,
245
+ context: {
246
+ existingDossierId
247
+ }
236
248
  });
237
249
  await onSubmit((0, _helpers__.removeNullishProps)({
238
250
  vehicle,
@@ -286,27 +298,28 @@ const InternalQuotationForm = _ref => {
286
298
  });
287
299
  }
288
300
  };
301
+ const initialChannel = channel !== null && channel !== void 0 && channel.channelId ? {
302
+ label: marketingChannels === null || marketingChannels === void 0 || (_marketingChannels$fi = marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId))) === null || _marketingChannels$fi === void 0 ? void 0 : _marketingChannels$fi.title,
303
+ value: 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))
304
+ } : null;
289
305
  return /*#__PURE__*/_react.default.createElement(_Card.default, {
290
306
  title: '',
291
307
  isWide: true,
292
308
  isNarrow: true
293
- }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h5", null, "Vul het onderstaande formulier in om de offerte naar de klant te sturen"), /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
309
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h5", null, "Vul het onderstaande formulier in om de offerte naar de klant te sturen"), (!existingDossierId || existingDossierId && (initialChannel === null || initialChannel === void 0 ? void 0 : initialChannel.value)) && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
294
310
  options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
295
311
  label: channel === null || channel === void 0 ? void 0 : channel.title,
296
312
  value: channel
297
313
  })),
298
314
  name: "channel",
299
315
  label: "Kanaal:",
300
- isRequired: true,
316
+ isRequired: !existingDossierId,
301
317
  isDisabled: !!existingDossierId,
302
318
  isLoading: isLoadingMarketingChannels,
303
319
  noOptionsMessage: "Geen opties beschikbaar",
304
320
  placeholder: "Maak een keuze",
305
321
  errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelId']) || (errors === null || errors === void 0 ? void 0 : errors['channelType']),
306
- initialValue: channel !== null && channel !== void 0 && channel.channelId ? {
307
- label: marketingChannels === null || marketingChannels === void 0 || (_marketingChannels$fi = marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId))) === null || _marketingChannels$fi === void 0 ? void 0 : _marketingChannels$fi.title,
308
- value: 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))
309
- } : null,
322
+ initialValue: initialChannel,
310
323
  onChange: _ref3 => {
311
324
  var _value$kanaalType;
312
325
  let {
@@ -15,6 +15,7 @@ var _ProductsOverview = _interopRequireDefault(require("../../__containers__/Pro
15
15
  var _VehicleData = _interopRequireDefault(require("../../__containers__/VehicleData"));
16
16
  var _FormulaContext = require("../../__context__/FormulaContext");
17
17
  var _helpers__ = require("../../__helpers__");
18
+ var _InternalPriceCalculationSelector = _interopRequireDefault(require("../../__containers__/internal/InternalPriceCalculationSelector"));
18
19
  function _interopRequireDefault(e) {
19
20
  return e && e.__esModule ? e : {
20
21
  default: e
@@ -41,6 +42,6 @@ const InternalProductsPage = () => {
41
42
  className: (0, _helpers__.withStyle)("col-xxl")
42
43
  }, /*#__PURE__*/_react.default.createElement(_ProductsOverview.default, null)), /*#__PURE__*/_react.default.createElement("div", {
43
44
  className: (0, _helpers__.withStyle)("sidebar col-xxl-auto col-lg-12 pt-5")
44
- }, /*#__PURE__*/_react.default.createElement(_VehicleData.default, null), /*#__PURE__*/_react.default.createElement(_ProductCartSide.default, null)))), /*#__PURE__*/_react.default.createElement(_BottomNavigationBar.default, null)));
45
+ }, APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalPriceCalculationSelector.default, null), /*#__PURE__*/_react.default.createElement(_VehicleData.default, null), /*#__PURE__*/_react.default.createElement(_ProductCartSide.default, null)))), /*#__PURE__*/_react.default.createElement(_BottomNavigationBar.default, null)));
45
46
  };
46
47
  var _default = exports.default = InternalProductsPage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",