thm-p3-configurator 0.0.10 → 0.0.12
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/index.js +7 -7
- package/dist/src/shared/App.js +2 -2
- package/dist/src/shared/__api__/orderApi.js +1 -4
- package/dist/src/shared/__components__/Buttons/PrimaryButton.js +2 -1
- package/dist/src/shared/__components__/Form/CheckboxInput.js +3 -2
- package/dist/src/shared/__components__/Form/NumericInput.js +11 -6
- package/dist/src/shared/__components__/LocationsSelector/index.js +2 -4
- package/dist/src/shared/__constants__/index.js +6 -1
- package/dist/src/shared/__containers__/ANWBMembershipInput.js +1 -1
- package/dist/src/shared/__containers__/BottomNavigationBar.js +1 -1
- package/dist/src/shared/__containers__/DiscountProductsSelector.js +90 -0
- package/dist/src/shared/__containers__/ProductDiscountCard.js +15 -8
- package/dist/src/shared/__containers__/ProductsCartOverview.js +2 -1
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +46 -43
- package/dist/src/shared/__containers__/{BranchSelectorModal.js → internal/InternalBranchSelectorModal.js} +36 -16
- package/dist/src/shared/__containers__/internal/InternalDiscountForm.js +154 -0
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +43 -40
- package/dist/src/shared/__context__/OrderSessionContext.js +74 -6
- package/dist/src/shared/__pages__/index.js +11 -10
- package/dist/src/shared/__pages__/internal/InternalLocationsPage.js +1 -1
- package/dist/src/shared/__style__/components/_buttons.scss +8 -0
- package/dist/src/shared/__style__/components/dealer/_dealer-item.scss +7 -1
- package/dist/src/shared/__style__/components/dealer/_dealer-map.scss +6 -0
- package/dist/src/shared/__style__/components/form/_form-radio.scss +1 -0
- package/dist/src/shared/__style__/configurator/_configurator-thc.scss +11 -0
- package/package.json +1 -16
package/dist/index.js
CHANGED
|
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "ActiveMarkerProvider", {
|
|
|
9
9
|
return _ActiveMarkerContext.ActiveMarkerProvider;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "BranchSelectorModal", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _BranchSelectorModal.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
Object.defineProperty(exports, "CountryController", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function get() {
|
|
@@ -33,6 +27,12 @@ Object.defineProperty(exports, "InternalAppointmentPage", {
|
|
|
33
27
|
return _index.InternalAppointmentPage;
|
|
34
28
|
}
|
|
35
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "InternalBranchSelectorModal", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _InternalBranchSelectorModal.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
36
|
Object.defineProperty(exports, "InternalExtraProductsPage", {
|
|
37
37
|
enumerable: true,
|
|
38
38
|
get: function get() {
|
|
@@ -147,7 +147,7 @@ Object.defineProperty(exports, "useOrderSession", {
|
|
|
147
147
|
return _OrderSessionContext.useOrderSession;
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
|
-
var
|
|
150
|
+
var _InternalBranchSelectorModal = _interopRequireDefault(require("./src/shared/__containers__/InternalBranchSelectorModal.js"));
|
|
151
151
|
var _StyleWrapper = _interopRequireDefault(require("./src/shared/__containers__/StyleWrapper.js"));
|
|
152
152
|
var _ActiveMarkerContext = require("./src/shared/__context__/ActiveMarkerContext.js");
|
|
153
153
|
var _CountryContext = require("./src/shared/__context__/CountryContext.js");
|
package/dist/src/shared/App.js
CHANGED
|
@@ -16,7 +16,7 @@ var _reactQuery = require("react-query");
|
|
|
16
16
|
var _reactRouterDom = require("react-router-dom");
|
|
17
17
|
var _Navbar = _interopRequireDefault(require("./__components__/Navbar"));
|
|
18
18
|
var _constants__ = require("./__constants__");
|
|
19
|
-
var
|
|
19
|
+
var _InternalBranchSelectorModal = _interopRequireDefault(require("./__containers__/Internal/InternalBranchSelectorModal"));
|
|
20
20
|
var _SentryWrapper = _interopRequireDefault(require("./__containers__/SentryWrapper"));
|
|
21
21
|
var _StyleWrapper = _interopRequireDefault(require("./__containers__/StyleWrapper"));
|
|
22
22
|
var _ActiveMarkerContext = require("./__context__/ActiveMarkerContext");
|
|
@@ -74,6 +74,6 @@ const App = () => {
|
|
|
74
74
|
defaultCountry: APP_CONFIG.country
|
|
75
75
|
}, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
|
|
76
76
|
client: _queryClient.default
|
|
77
|
-
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_reactHotLoader.AppContainer, null, /*#__PURE__*/_react.default.createElement(_ActiveMarkerContext.ActiveMarkerProvider, null, /*#__PURE__*/_react.default.createElement(_StyleWrapper.default, null, !APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_Navbar.default, null), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_reactHotLoader.AppContainer, null, /*#__PURE__*/_react.default.createElement(_ActiveMarkerContext.ActiveMarkerProvider, null, /*#__PURE__*/_react.default.createElement(_StyleWrapper.default, null, !APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_Navbar.default, null), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalBranchSelectorModal.default, null), /*#__PURE__*/_react.default.createElement(_pages__.default, null))))))))));
|
|
78
78
|
};
|
|
79
79
|
var _default = exports.default = App;
|
|
@@ -30,10 +30,7 @@ orderClient.interceptors.request.use(config => {
|
|
|
30
30
|
return config;
|
|
31
31
|
});
|
|
32
32
|
const orderApi = exports.orderApi = {
|
|
33
|
-
getOrder: orderParameters => orderClient(
|
|
34
|
-
// `api/public/order?${orderParameters}`
|
|
35
|
-
// TODO: There are CORS issues within Hyper at the moment, if the following doesnt work: uncomment the previous line and comment the next (calls the public custom order API instead of the private)
|
|
36
|
-
"api".concat(APP_CONFIG.internal ? '' : '/public', "/order?").concat(orderParameters) // Remove the `/public` param if the configurator is internal,
|
|
33
|
+
getOrder: orderParameters => orderClient("api".concat(APP_CONFIG.internal ? '' : '/public', "/order?").concat(orderParameters) // Remove the `/public` param if the configurator is internal,
|
|
37
34
|
),
|
|
38
35
|
getBrands: () => orderClient('api/public/makes'),
|
|
39
36
|
getBuildYears: brand => orderClient("api/public/makes/".concat(brand, "/years")),
|
|
@@ -38,12 +38,13 @@ function _interopRequireWildcard(e, r) {
|
|
|
38
38
|
const PrimaryButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
39
39
|
let {
|
|
40
40
|
type = 'button',
|
|
41
|
+
isNarrow = false,
|
|
41
42
|
isDisabled,
|
|
42
43
|
onClick,
|
|
43
44
|
label
|
|
44
45
|
} = _ref;
|
|
45
46
|
return /*#__PURE__*/_react.default.createElement("button", {
|
|
46
|
-
className: (0, _helpers__.withStyle)("btn btn-primary"),
|
|
47
|
+
className: (0, _helpers__.withStyle)("btn btn-primary ".concat(isNarrow ? 'btn-narrow' : '')),
|
|
47
48
|
type: type,
|
|
48
49
|
ref: ref,
|
|
49
50
|
disabled: isDisabled,
|
|
@@ -43,6 +43,7 @@ function _interopRequireWildcard(e, r) {
|
|
|
43
43
|
}
|
|
44
44
|
const CheckboxInput = _ref => {
|
|
45
45
|
let {
|
|
46
|
+
labelSize = 'sm',
|
|
46
47
|
isRequired,
|
|
47
48
|
name,
|
|
48
49
|
initialValue = false,
|
|
@@ -59,7 +60,7 @@ const CheckboxInput = _ref => {
|
|
|
59
60
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
60
61
|
className: (0, _helpers__.withStyle)('form-group')
|
|
61
62
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
62
|
-
className: (0, _helpers__.withStyle)(
|
|
63
|
+
className: (0, _helpers__.withStyle)("form-check form-check--".concat(labelSize))
|
|
63
64
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
64
65
|
type: "checkbox",
|
|
65
66
|
id: name,
|
|
@@ -71,7 +72,7 @@ const CheckboxInput = _ref => {
|
|
|
71
72
|
handleChange(isChecked);
|
|
72
73
|
}
|
|
73
74
|
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
74
|
-
className: (0, _helpers__.withStyle)(
|
|
75
|
+
className: (0, _helpers__.withStyle)("form-check-label"),
|
|
75
76
|
htmlFor: name
|
|
76
77
|
}, label, isRequired && /*#__PURE__*/_react.default.createElement("span", null, "*"))), errorMessage && /*#__PURE__*/_react.default.createElement(_ErrorMessage.default, {
|
|
77
78
|
message: errorMessage
|
|
@@ -45,7 +45,7 @@ const BORDER_STYLE = 'none';
|
|
|
45
45
|
const BORDER_WIDTH = 0;
|
|
46
46
|
const MAIN_THEME = '#294795';
|
|
47
47
|
const HEIGHT = '1.8rem';
|
|
48
|
-
const WIDTH = '
|
|
48
|
+
const WIDTH = '6.5rem';
|
|
49
49
|
_reactNumericInput.default.style.input.color = MAIN_THEME;
|
|
50
50
|
_reactNumericInput.default.style.input.height = HEIGHT;
|
|
51
51
|
_reactNumericInput.default.style.input.width = WIDTH;
|
|
@@ -69,7 +69,9 @@ const NumericInput = _ref => {
|
|
|
69
69
|
max = 99,
|
|
70
70
|
isDisabled,
|
|
71
71
|
isRequired,
|
|
72
|
-
form
|
|
72
|
+
form,
|
|
73
|
+
name,
|
|
74
|
+
label
|
|
73
75
|
} = _ref;
|
|
74
76
|
const [value, setValue] = (0, _react.useState)(defaultValue);
|
|
75
77
|
const inputRef = (0, _react.useRef)();
|
|
@@ -77,7 +79,10 @@ const NumericInput = _ref => {
|
|
|
77
79
|
setValue(value);
|
|
78
80
|
onChange(value);
|
|
79
81
|
};
|
|
80
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("label", {
|
|
83
|
+
htmlFor: name,
|
|
84
|
+
className: (0, _helpers__.withStyle)('form-label')
|
|
85
|
+
}, label, isRequired && /*#__PURE__*/_react.default.createElement("span", null, "*")), ' ', /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement(_reactNumericInput.default, {
|
|
81
86
|
mobile: true,
|
|
82
87
|
strict: true,
|
|
83
88
|
className: (0, _helpers__.withStyle)('form-control react-numeric-input'),
|
|
@@ -86,7 +91,7 @@ const NumericInput = _ref => {
|
|
|
86
91
|
ref: inputRef,
|
|
87
92
|
max: max,
|
|
88
93
|
form: form,
|
|
89
|
-
maxLength:
|
|
94
|
+
maxLength: 4,
|
|
90
95
|
required: isRequired,
|
|
91
96
|
onChange: handleChange,
|
|
92
97
|
disabled: isDisabled
|
|
@@ -95,7 +100,7 @@ const NumericInput = _ref => {
|
|
|
95
100
|
|
|
96
101
|
style: {
|
|
97
102
|
wrap: {
|
|
98
|
-
width: '
|
|
103
|
+
width: '6.5rem',
|
|
99
104
|
textAlign: 'center',
|
|
100
105
|
color: '#294795',
|
|
101
106
|
borderRadius: 0.9,
|
|
@@ -103,6 +108,6 @@ const NumericInput = _ref => {
|
|
|
103
108
|
height: HEIGHT
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
|
-
});
|
|
111
|
+
}));
|
|
107
112
|
};
|
|
108
113
|
var _default = exports.default = NumericInput;
|
|
@@ -10,7 +10,6 @@ exports.default = void 0;
|
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
11
|
var _reactGoogleMaps = require("@vis.gl/react-google-maps");
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var _reactStickynode = _interopRequireDefault(require("react-stickynode"));
|
|
14
13
|
var _queries = require("../../__api__/queries");
|
|
15
14
|
var _FormulaContext = require("../../__context__/FormulaContext");
|
|
16
15
|
var _helpers__ = require("../../__helpers__");
|
|
@@ -98,9 +97,8 @@ const LocationsSelector = /*#__PURE__*/_react.default.memo(() => {
|
|
|
98
97
|
className: "".concat((0, _helpers__.withStyle)('row gx-5 mt-3 mt-xl-5'))
|
|
99
98
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
100
99
|
className: "".concat((0, _helpers__.withStyle)('content col-xl-8'))
|
|
101
|
-
}, isDesktop ? /*#__PURE__*/_react.default.createElement(
|
|
102
|
-
|
|
103
|
-
bottomBoundary: ".".concat((0, _helpers__.withStyle)('dealer-sidebar'))
|
|
100
|
+
}, isDesktop ? /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
className: "".concat((0, _helpers__.withStyle)('dealer-map__container'))
|
|
104
102
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
105
103
|
className: "".concat((0, _helpers__.withStyle)('dealer-map'))
|
|
106
104
|
}, /*#__PURE__*/_react.default.createElement(_LocationClusteredMap.default, {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.VEHICLE_OWNERSHIP_TYPE = exports.USER_GEOLOCATION_KEY = exports.PRODUCT_CATEGORIES = exports.ORDER_SESSION_KEY = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCALE = exports.FORM_ERROR_MESSAGES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.CONFIGURATOR_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.AUTH_SESSION_KEY = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
|
|
6
|
+
exports.VEHICLE_OWNERSHIP_TYPE = exports.USER_GEOLOCATION_KEY = exports.TMG_ORGANIZATION_TYPE = exports.PRODUCT_CATEGORIES = exports.ORDER_SESSION_KEY = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCALE = exports.FORM_ERROR_MESSAGES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.CONFIGURATOR_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.AUTH_SESSION_KEY = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
|
|
7
7
|
const USER_GEOLOCATION_KEY = exports.USER_GEOLOCATION_KEY = '_userGeolocation';
|
|
8
8
|
const FORM_ERROR_MESSAGES = exports.FORM_ERROR_MESSAGES = {
|
|
9
9
|
required: 'Verplicht',
|
|
@@ -115,10 +115,15 @@ const CONFIGURATOR_FORMULAS = exports.CONFIGURATOR_FORMULAS = {
|
|
|
115
115
|
THM: 'THM',
|
|
116
116
|
THC: 'THC'
|
|
117
117
|
};
|
|
118
|
+
const TMG_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = 'TowMotive Group';
|
|
118
119
|
const ANWB_DISCOUNT_CODE = exports.ANWB_DISCOUNT_CODE = 'ANWBTHC23';
|
|
119
120
|
const AUTH_SESSION_KEY = exports.AUTH_SESSION_KEY = '__authSession';
|
|
120
121
|
const VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = {
|
|
121
122
|
Particulier: 'Particulier',
|
|
122
123
|
Zakelijk: 'Zakelijk',
|
|
123
124
|
Leasemaatschappij: 'Leasemaatschappij'
|
|
125
|
+
};
|
|
126
|
+
const DISCOUNT_TYPES = exports.DISCOUNT_TYPES = {
|
|
127
|
+
Percentage: '%',
|
|
128
|
+
Amount: '€'
|
|
124
129
|
};
|
|
@@ -121,7 +121,7 @@ const ANWBMembershipValidator = () => {
|
|
|
121
121
|
return null;
|
|
122
122
|
}
|
|
123
123
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
-
className: (0, _helpers__.withStyle)('container')
|
|
124
|
+
className: (0, _helpers__.withStyle)('container my-4')
|
|
125
125
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
126
126
|
className: (0, _helpers__.withStyle)('row')
|
|
127
127
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -124,7 +124,7 @@ const BottomNavigationBar = () => {
|
|
|
124
124
|
state: {
|
|
125
125
|
prevPathName: history.location.pathname
|
|
126
126
|
},
|
|
127
|
-
isDisabled: (!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || (history === null || history === void 0 || (_history$location2 = history.location) === null || _history$location2 === void 0 ? void 0 : _history$location2.pathname) === '/configurator/montagelocatie' && !selectedBranch
|
|
127
|
+
isDisabled: (!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || type === 'next' && (history === null || history === void 0 || (_history$location2 = history.location) === null || _history$location2 === void 0 ? void 0 : _history$location2.pathname) === '/configurator/montagelocatie' && !selectedBranch
|
|
128
128
|
}));
|
|
129
129
|
})))));
|
|
130
130
|
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _queries = require("../__api__/queries");
|
|
11
|
+
var _NumericInput = _interopRequireDefault(require("../__components__/Form/NumericInput"));
|
|
12
|
+
var _FormulaContext = require("../__context__/FormulaContext");
|
|
13
|
+
var _OrderSessionContext = require("../__context__/OrderSessionContext");
|
|
14
|
+
var _helpers__ = require("../__helpers__");
|
|
15
|
+
function _interopRequireDefault(obj) {
|
|
16
|
+
return obj && obj.__esModule ? obj : {
|
|
17
|
+
default: obj
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const DiscountProductsSelector = () => {
|
|
21
|
+
const [{
|
|
22
|
+
customer,
|
|
23
|
+
licensePlate,
|
|
24
|
+
model,
|
|
25
|
+
answers,
|
|
26
|
+
durationAnswer,
|
|
27
|
+
selectedBoardComputer,
|
|
28
|
+
selectedCableset,
|
|
29
|
+
selectedCombiset,
|
|
30
|
+
selectedTowbar,
|
|
31
|
+
selectedBranch,
|
|
32
|
+
discountCode,
|
|
33
|
+
selectedDiscountedProducts
|
|
34
|
+
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
35
|
+
const formula = (0, _FormulaContext.useFormula)();
|
|
36
|
+
const {
|
|
37
|
+
discountProducts
|
|
38
|
+
} = (0, _queries.useProductsQuery)({
|
|
39
|
+
licensePlate,
|
|
40
|
+
model,
|
|
41
|
+
executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
|
|
42
|
+
executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
|
|
43
|
+
durationAnswer: durationAnswer,
|
|
44
|
+
formula,
|
|
45
|
+
discountCode
|
|
46
|
+
});
|
|
47
|
+
const handleProductUpdated = _ref => {
|
|
48
|
+
let {
|
|
49
|
+
articleNumber,
|
|
50
|
+
quantity
|
|
51
|
+
} = _ref;
|
|
52
|
+
if (!quantity) {
|
|
53
|
+
dispatch({
|
|
54
|
+
type: _OrderSessionContext.orderSessionActions.REMOVE_DISCOUNTED_PRODUCT,
|
|
55
|
+
payload: {
|
|
56
|
+
articleNumber
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
dispatch({
|
|
62
|
+
type: _OrderSessionContext.orderSessionActions.ADD_DISCOUNTED_PRODUCT,
|
|
63
|
+
payload: {
|
|
64
|
+
articleNumber,
|
|
65
|
+
quantity
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
if (!(discountProducts !== null && discountProducts !== void 0 && discountProducts.length)) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement("ol", null, discountProducts === null || discountProducts === void 0 ? void 0 : discountProducts.map(product => {
|
|
73
|
+
const selectedProductAmount = selectedDiscountedProducts.find(selectedProduct => (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.articleNumber) === (product === null || product === void 0 ? void 0 : product.articleNumber));
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
75
|
+
key: product === null || product === void 0 ? void 0 : product.articleNumber
|
|
76
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
+
className: (0, _helpers__.withStyle)('d-flex justify-content-between')
|
|
78
|
+
}, ' ', product === null || product === void 0 ? void 0 : product.name, " (", !(product !== null && product !== void 0 && product.price) ? 'Gratis' : (0, _helpers__.formatPrice)(product.price), ")", /*#__PURE__*/_react.default.createElement(_NumericInput.default, {
|
|
79
|
+
defaultValue: (selectedProductAmount === null || selectedProductAmount === void 0 ? void 0 : selectedProductAmount.quantity) || 0,
|
|
80
|
+
isDisabled: false,
|
|
81
|
+
onChange: quantity => handleProductUpdated({
|
|
82
|
+
quantity,
|
|
83
|
+
articleNumber: product === null || product === void 0 ? void 0 : product.articleNumber
|
|
84
|
+
}),
|
|
85
|
+
min: 0,
|
|
86
|
+
max: product === null || product === void 0 ? void 0 : product.maxQuantity
|
|
87
|
+
})));
|
|
88
|
+
}));
|
|
89
|
+
};
|
|
90
|
+
var _default = exports.default = DiscountProductsSelector;
|
|
@@ -18,6 +18,7 @@ var _OrderSessionContext = require("../__context__/OrderSessionContext");
|
|
|
18
18
|
var _helpers__ = require("../__helpers__");
|
|
19
19
|
var _image = require("../__helpers__/image");
|
|
20
20
|
var _ANWBMembershipInput = _interopRequireDefault(require("./ANWBMembershipInput"));
|
|
21
|
+
var _DiscountProductsSelector = _interopRequireDefault(require("./DiscountProductsSelector"));
|
|
21
22
|
function _interopRequireDefault(obj) {
|
|
22
23
|
return obj && obj.__esModule ? obj : {
|
|
23
24
|
default: obj
|
|
@@ -65,7 +66,8 @@ const ProductDiscountCard = () => {
|
|
|
65
66
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
66
67
|
const formula = (0, _FormulaContext.useFormula)();
|
|
67
68
|
const {
|
|
68
|
-
discountCodeInfo
|
|
69
|
+
discountCodeInfo,
|
|
70
|
+
discountProducts
|
|
69
71
|
} = (0, _queries.useProductsQuery)({
|
|
70
72
|
licensePlate,
|
|
71
73
|
model,
|
|
@@ -93,20 +95,25 @@ const ProductDiscountCard = () => {
|
|
|
93
95
|
}
|
|
94
96
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
95
97
|
className: (0, _helpers__.withStyle)('my-2')
|
|
96
|
-
}, /*#__PURE__*/_react.default.createElement(_CardWide.default, null, /*#__PURE__*/_react.default.createElement("
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement(_CardWide.default, null, /*#__PURE__*/_react.default.createElement("h4", {
|
|
97
99
|
className: (0, _helpers__.withStyle)('mb-2')
|
|
98
100
|
}, discountCodeInfo === null || discountCodeInfo === void 0 ? void 0 : discountCodeInfo.name), /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
-
className: (0, _helpers__.withStyle)('container')
|
|
101
|
+
className: (0, _helpers__.withStyle)('container px-0')
|
|
100
102
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
101
103
|
className: (0, _helpers__.withStyle)('row')
|
|
102
104
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
103
105
|
className: (0, _helpers__.withStyle)('col-12')
|
|
106
|
+
}, /*#__PURE__*/_react.default.createElement("ul", null, ((_discountCodeInfo$des = discountCodeInfo === null || discountCodeInfo === void 0 || (_discountCodeInfo$des2 = discountCodeInfo.description) === null || _discountCodeInfo$des2 === void 0 || (_discountCodeInfo$des2 = _discountCodeInfo$des2.ops) === null || _discountCodeInfo$des2 === void 0 || (_discountCodeInfo$des2 = _discountCodeInfo$des2[0]) === null || _discountCodeInfo$des2 === void 0 ? void 0 : _discountCodeInfo$des2.insert) !== null && _discountCodeInfo$des !== void 0 ? _discountCodeInfo$des : '').split('\n').map(line => /*#__PURE__*/_react.default.createElement("li", {
|
|
107
|
+
key: line
|
|
108
|
+
}, line))), /*#__PURE__*/_react.default.createElement(_ANWBMembershipInput.default, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
109
|
+
className: (0, _helpers__.withStyle)('col-12 col-md-6')
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
111
|
+
className: (0, _helpers__.withStyle)('fw-bold mb-2')
|
|
112
|
+
}, ' ', "Selecteer de producten"), /*#__PURE__*/_react.default.createElement(_DiscountProductsSelector.default, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
113
|
+
className: (0, _helpers__.withStyle)('col-12 col-md-6')
|
|
104
114
|
}, discountImage && /*#__PURE__*/_react.default.createElement("img", {
|
|
105
115
|
src: discountImage,
|
|
106
|
-
alt: "Discount image"
|
|
107
|
-
|
|
108
|
-
}), /*#__PURE__*/_react.default.createElement("ul", null, ((_discountCodeInfo$des = discountCodeInfo === null || discountCodeInfo === void 0 || (_discountCodeInfo$des2 = discountCodeInfo.description) === null || _discountCodeInfo$des2 === void 0 || (_discountCodeInfo$des2 = _discountCodeInfo$des2.ops) === null || _discountCodeInfo$des2 === void 0 || (_discountCodeInfo$des2 = _discountCodeInfo$des2[0]) === null || _discountCodeInfo$des2 === void 0 ? void 0 : _discountCodeInfo$des2.insert) !== null && _discountCodeInfo$des !== void 0 ? _discountCodeInfo$des : '').split('\n').map(line => /*#__PURE__*/_react.default.createElement("li", {
|
|
109
|
-
key: line
|
|
110
|
-
}, line)))))), /*#__PURE__*/_react.default.createElement(_ANWBMembershipInput.default, null)));
|
|
116
|
+
alt: "Discount image"
|
|
117
|
+
}))))));
|
|
111
118
|
};
|
|
112
119
|
var _default = exports.default = ProductDiscountCard;
|
|
@@ -14,6 +14,7 @@ var _ProductTableSectionTotal = _interopRequireDefault(require("../__components_
|
|
|
14
14
|
var _ProductTableStaticRow = _interopRequireDefault(require("../__components__/ProductTable/ProductTableStaticRow"));
|
|
15
15
|
var _ProductTableTotal = _interopRequireDefault(require("../__components__/ProductTable/ProductTableTotal"));
|
|
16
16
|
var _helpers__ = require("../__helpers__");
|
|
17
|
+
var _InternalDiscountForm = _interopRequireDefault(require("./internal/InternalDiscountForm"));
|
|
17
18
|
function _interopRequireDefault(obj) {
|
|
18
19
|
return obj && obj.__esModule ? obj : {
|
|
19
20
|
default: obj
|
|
@@ -106,6 +107,6 @@ const ProductCartTable = () => {
|
|
|
106
107
|
text: (0, _helpers__.formatPrice)(100),
|
|
107
108
|
className: 'fw-bold text-end pt-2'
|
|
108
109
|
}]]
|
|
109
|
-
})))));
|
|
110
|
+
}))), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null)));
|
|
110
111
|
};
|
|
111
112
|
var _default = exports.default = ProductCartTable;
|
|
@@ -121,10 +121,8 @@ const internalAppointmentFormSchema = (0, _yup.object)({
|
|
|
121
121
|
ownershipType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
122
122
|
leaseNumber: (0, _yup.string)().nullable(),
|
|
123
123
|
firstName: (0, _yup.string)().nullable(),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
partnerId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required)
|
|
127
|
-
}).required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
124
|
+
channelId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
125
|
+
channelPartnerId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
128
126
|
infix: (0, _yup.string)().nullable(),
|
|
129
127
|
lastName: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
130
128
|
email: (0, _yup.string)().email(_constants__.FORM_ERROR_MESSAGES.email).required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
@@ -152,6 +150,8 @@ const InternalAppointmentForm = () => {
|
|
|
152
150
|
selectedBranch,
|
|
153
151
|
appointment,
|
|
154
152
|
discountCode,
|
|
153
|
+
discountPercentage,
|
|
154
|
+
discountAmount,
|
|
155
155
|
selectedDiscountedProducts = []
|
|
156
156
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
157
157
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
@@ -209,7 +209,8 @@ const InternalAppointmentForm = () => {
|
|
|
209
209
|
|
|
210
210
|
// Note: this throws on error.
|
|
211
211
|
internalAppointmentFormSchema.validateSync(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, vehicle), customer), appointment), {}, {
|
|
212
|
-
channel
|
|
212
|
+
channelId: channel === null || channel === void 0 ? void 0 : channel.id,
|
|
213
|
+
channelPartnerId: channel === null || channel === void 0 ? void 0 : channel.partnerId
|
|
213
214
|
}), {
|
|
214
215
|
strict: false,
|
|
215
216
|
abortEarly: false
|
|
@@ -230,9 +231,11 @@ const InternalAppointmentForm = () => {
|
|
|
230
231
|
execution1: answers === null || answers === void 0 ? void 0 : answers['0'],
|
|
231
232
|
execution2: answers === null || answers === void 0 ? void 0 : answers['1']
|
|
232
233
|
}),
|
|
233
|
-
discount:
|
|
234
|
-
code: discountCode
|
|
235
|
-
|
|
234
|
+
discount: (0, _helpers__.removeNullishProps)({
|
|
235
|
+
code: discountCode,
|
|
236
|
+
amount: discountAmount,
|
|
237
|
+
percentage: discountPercentage
|
|
238
|
+
}),
|
|
236
239
|
formula,
|
|
237
240
|
branchId: selectedBranch,
|
|
238
241
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
@@ -311,38 +314,7 @@ const InternalAppointmentForm = () => {
|
|
|
311
314
|
isDisabled: !branchById
|
|
312
315
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
313
316
|
className: (0, _helpers__.withStyle)('col-12 mb-2')
|
|
314
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
315
|
-
name: "ownershipType",
|
|
316
|
-
label: "Type:",
|
|
317
|
-
initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType,
|
|
318
|
-
onChange: val => {
|
|
319
|
-
dispatch({
|
|
320
|
-
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_OWNERSHIP_TYPE,
|
|
321
|
-
payload: {
|
|
322
|
-
ownershipType: val
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
},
|
|
326
|
-
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
327
|
-
isRequired: true,
|
|
328
|
-
errorMessage: errors === null || errors === void 0 ? void 0 : errors['ownershipType']
|
|
329
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
330
|
-
className: (0, _helpers__.withStyle)('col-12 col-md-6')
|
|
331
|
-
}, (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
332
|
-
placeholder: "",
|
|
333
|
-
initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber,
|
|
334
|
-
name: "leaseNumber",
|
|
335
|
-
onChange: value => dispatch({
|
|
336
|
-
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_LEASE_NUMBER,
|
|
337
|
-
payload: {
|
|
338
|
-
leaseNumber: value
|
|
339
|
-
}
|
|
340
|
-
}),
|
|
341
|
-
isRequired: false,
|
|
342
|
-
form: "quotation",
|
|
343
|
-
label: "Code van de leasemaatschappij:",
|
|
344
|
-
errorMessage: errors === null || errors === void 0 ? void 0 : errors['leaseNumber']
|
|
345
|
-
}), /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
317
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
346
318
|
options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
|
|
347
319
|
label: channel === null || channel === void 0 ? void 0 : channel.title,
|
|
348
320
|
value: channel
|
|
@@ -353,7 +325,7 @@ const InternalAppointmentForm = () => {
|
|
|
353
325
|
isLoading: isLoadingMarketingChannels,
|
|
354
326
|
noOptionsMessage: "Geen opties beschikbaar",
|
|
355
327
|
placeholder: "Maak een keuze",
|
|
356
|
-
errorMessage: (errors === null || errors === void 0 ? void 0 : errors['
|
|
328
|
+
errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelId']) || (errors === null || errors === void 0 ? void 0 : errors['channelPartnerId']),
|
|
357
329
|
initialValue: () => {
|
|
358
330
|
const foundChannel = marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.partnerId));
|
|
359
331
|
return {
|
|
@@ -377,6 +349,37 @@ const InternalAppointmentForm = () => {
|
|
|
377
349
|
}
|
|
378
350
|
});
|
|
379
351
|
}
|
|
352
|
+
}), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
|
|
353
|
+
name: "ownershipType",
|
|
354
|
+
label: "Type:",
|
|
355
|
+
initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType,
|
|
356
|
+
onChange: val => {
|
|
357
|
+
dispatch({
|
|
358
|
+
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_OWNERSHIP_TYPE,
|
|
359
|
+
payload: {
|
|
360
|
+
ownershipType: val
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
},
|
|
364
|
+
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
365
|
+
isRequired: true,
|
|
366
|
+
errorMessage: errors === null || errors === void 0 ? void 0 : errors['ownershipType']
|
|
367
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
368
|
+
className: (0, _helpers__.withStyle)('col-12 col-md-6')
|
|
369
|
+
}, (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
370
|
+
placeholder: "",
|
|
371
|
+
initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber,
|
|
372
|
+
name: "leaseNumber",
|
|
373
|
+
onChange: value => dispatch({
|
|
374
|
+
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_LEASE_NUMBER,
|
|
375
|
+
payload: {
|
|
376
|
+
leaseNumber: value
|
|
377
|
+
}
|
|
378
|
+
}),
|
|
379
|
+
isRequired: false,
|
|
380
|
+
form: "quotation",
|
|
381
|
+
label: "Code van de leasemaatschappij:",
|
|
382
|
+
errorMessage: errors === null || errors === void 0 ? void 0 : errors['leaseNumber']
|
|
380
383
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
381
384
|
placeholder: "",
|
|
382
385
|
initialValue: customer.firstName,
|
|
@@ -527,7 +530,7 @@ const InternalAppointmentForm = () => {
|
|
|
527
530
|
name: 'Datum',
|
|
528
531
|
isRequired: true,
|
|
529
532
|
label: "Datum",
|
|
530
|
-
initialValue: new Date(appointment === null || appointment === void 0 ? void 0 : appointment.date),
|
|
533
|
+
initialValue: appointment !== null && appointment !== void 0 && appointment.data ? new Date(appointment === null || appointment === void 0 ? void 0 : appointment.date) : null,
|
|
531
534
|
isStrict: false,
|
|
532
535
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['date']
|
|
533
536
|
}), /*#__PURE__*/_react.default.createElement(_TimePickerInput.default, {
|
|
@@ -537,7 +540,7 @@ const InternalAppointmentForm = () => {
|
|
|
537
540
|
time: value
|
|
538
541
|
}
|
|
539
542
|
}),
|
|
540
|
-
initialValue: new Date(appointment === null || appointment === void 0 ? void 0 : appointment.time),
|
|
543
|
+
initialValue: appointment !== null && appointment !== void 0 && appointment.time ? new Date(appointment === null || appointment === void 0 ? void 0 : appointment.time) : null,
|
|
541
544
|
name: 'Tijd',
|
|
542
545
|
isRequired: true,
|
|
543
546
|
label: "Tijd",
|
|
@@ -9,14 +9,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.default = void 0;
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _queries = require("
|
|
13
|
-
var _DropdownInput = _interopRequireDefault(require("
|
|
14
|
-
var _Modal = _interopRequireDefault(require("
|
|
15
|
-
var _FullPageSpinner = _interopRequireDefault(require("
|
|
16
|
-
var _constants__ = require("
|
|
17
|
-
var _FormulaContext = require("
|
|
18
|
-
var _OrderSessionContext = require("
|
|
19
|
-
var _LocalStorageWorker = require("
|
|
12
|
+
var _queries = require("../../__api__/queries");
|
|
13
|
+
var _DropdownInput = _interopRequireDefault(require("../../__components__/Form/DropdownInput"));
|
|
14
|
+
var _Modal = _interopRequireDefault(require("../../__components__/Modal"));
|
|
15
|
+
var _FullPageSpinner = _interopRequireDefault(require("../../__components__/Spinners/FullPageSpinner"));
|
|
16
|
+
var _constants__ = require("../../__constants__");
|
|
17
|
+
var _FormulaContext = require("../../__context__/FormulaContext");
|
|
18
|
+
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
19
|
+
var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
|
|
20
20
|
function _interopRequireDefault(obj) {
|
|
21
21
|
return obj && obj.__esModule ? obj : {
|
|
22
22
|
default: obj
|
|
@@ -47,13 +47,13 @@ function _interopRequireWildcard(e, r) {
|
|
|
47
47
|
}
|
|
48
48
|
return n.default = e, t && t.set(e, n), n;
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
var _branchTypes$byId$
|
|
50
|
+
const InternalBranchSelectorModal = () => {
|
|
51
|
+
var _branchTypes$byId$aut2, _authSession$branch2;
|
|
52
52
|
const {
|
|
53
53
|
branchTypes,
|
|
54
54
|
isLoadingBranchTypes
|
|
55
55
|
} = (0, _queries.useBranchTypes)();
|
|
56
|
-
const [
|
|
56
|
+
const [_selectedBranchId, _setSelectedBranchId] = (0, _react.useState)();
|
|
57
57
|
const authSession = _LocalStorageWorker.lsw.getJson(_constants__.AUTH_SESSION_KEY);
|
|
58
58
|
const formula = (0, _FormulaContext.useFormula)();
|
|
59
59
|
const {
|
|
@@ -68,16 +68,36 @@ const BranchSelectorModal = () => {
|
|
|
68
68
|
dispatch({
|
|
69
69
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
|
|
70
70
|
payload: {
|
|
71
|
-
branchId:
|
|
71
|
+
branchId: _selectedBranchId
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
|
+
(0, _react.useEffect)(() => {
|
|
76
|
+
var _branchTypes$byId$aut, _authSession$branch, _myBranches$;
|
|
77
|
+
// If it's a TMG group, do nothing
|
|
78
|
+
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) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// If no branches found, or more than 1 branch, or if a selected branch already exists: do nothing
|
|
83
|
+
if (!(myBranches !== null && myBranches !== void 0 && myBranches.length) || (myBranches === null || myBranches === void 0 ? void 0 : myBranches.length) > 1 || selectedBranch) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Set the only branch as the selected branch, which skips the modal
|
|
88
|
+
dispatch({
|
|
89
|
+
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
|
|
90
|
+
payload: {
|
|
91
|
+
branchId: myBranches === null || myBranches === void 0 || (_myBranches$ = myBranches[0]) === null || _myBranches$ === void 0 ? void 0 : _myBranches$.entityId
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}, [selectedBranch, myBranches, branchTypes, authSession]);
|
|
75
95
|
if (isLoadingBranchTypes) {
|
|
76
96
|
return /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null);
|
|
77
97
|
}
|
|
78
98
|
|
|
79
99
|
// Note: if the current formula is TowMotive Group, do not show the modal (the branch selection happens on the step before the appointment)
|
|
80
|
-
if ((branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$
|
|
100
|
+
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) {
|
|
81
101
|
return null;
|
|
82
102
|
}
|
|
83
103
|
return /*#__PURE__*/_react.default.createElement(_Modal.default, {
|
|
@@ -85,7 +105,7 @@ const BranchSelectorModal = () => {
|
|
|
85
105
|
title: 'Kies een vestiging:',
|
|
86
106
|
size: "wide",
|
|
87
107
|
hasSecondaryButton: false,
|
|
88
|
-
isPrimaryButtonDisabled: !
|
|
108
|
+
isPrimaryButtonDisabled: !_selectedBranchId,
|
|
89
109
|
primaryButtonText: 'Ga door',
|
|
90
110
|
onPrimaryButtonClicked: handlePrimaryButtonClicked
|
|
91
111
|
}, /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
@@ -104,8 +124,8 @@ const BranchSelectorModal = () => {
|
|
|
104
124
|
label,
|
|
105
125
|
value
|
|
106
126
|
} = _ref;
|
|
107
|
-
return
|
|
127
|
+
return _setSelectedBranchId(value);
|
|
108
128
|
}
|
|
109
129
|
}));
|
|
110
130
|
};
|
|
111
|
-
var _default = exports.default =
|
|
131
|
+
var _default = exports.default = InternalBranchSelectorModal;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
|
+
require("core-js/modules/es.weak-map.js");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = void 0;
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _LinkButton = _interopRequireDefault(require("../../__components__/Buttons/LinkButton"));
|
|
13
|
+
var _PrimaryButton = _interopRequireDefault(require("../../__components__/Buttons/PrimaryButton"));
|
|
14
|
+
var _DropdownInput = _interopRequireDefault(require("../../__components__/Form/DropdownInput"));
|
|
15
|
+
var _constants__ = require("../../__constants__");
|
|
16
|
+
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
17
|
+
var _helpers__ = require("../../__helpers__");
|
|
18
|
+
function _interopRequireDefault(obj) {
|
|
19
|
+
return obj && obj.__esModule ? obj : {
|
|
20
|
+
default: obj
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function _getRequireWildcardCache(e) {
|
|
24
|
+
if ("function" != typeof WeakMap) return null;
|
|
25
|
+
var r = new WeakMap(),
|
|
26
|
+
t = new WeakMap();
|
|
27
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
28
|
+
return e ? t : r;
|
|
29
|
+
})(e);
|
|
30
|
+
}
|
|
31
|
+
function _interopRequireWildcard(e, r) {
|
|
32
|
+
if (!r && e && e.__esModule) return e;
|
|
33
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return {
|
|
34
|
+
default: e
|
|
35
|
+
};
|
|
36
|
+
var t = _getRequireWildcardCache(r);
|
|
37
|
+
if (t && t.has(e)) return t.get(e);
|
|
38
|
+
var n = {
|
|
39
|
+
__proto__: null
|
|
40
|
+
},
|
|
41
|
+
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
42
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
43
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
44
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
45
|
+
}
|
|
46
|
+
return n.default = e, t && t.set(e, n), n;
|
|
47
|
+
}
|
|
48
|
+
const InternalDiscountForm = () => {
|
|
49
|
+
const [{
|
|
50
|
+
discountAmount,
|
|
51
|
+
discountPercentage
|
|
52
|
+
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
53
|
+
const [discountType, setDiscountType] = (0, _react.useState)(discountPercentage ? _constants__.DISCOUNT_TYPES.Percentage : discountAmount ? _constants__.DISCOUNT_TYPES.Amount : null);
|
|
54
|
+
const [discountValue, setDiscountValue] = (0, _react.useState)(discountType === _constants__.DISCOUNT_TYPES.Amount ? discountAmount : discountPercentage);
|
|
55
|
+
(0, _react.useEffect)(() => {
|
|
56
|
+
setDiscountValue((discountType === _constants__.DISCOUNT_TYPES.Amount ? discountAmount : discountPercentage) || '');
|
|
57
|
+
}, [discountType]);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @description Parses the discounted value change and sets it:
|
|
61
|
+
* - If the value is not numerical,
|
|
62
|
+
*/
|
|
63
|
+
const handleDiscountChange = value => {
|
|
64
|
+
if (discountType === _constants__.DISCOUNT_TYPES.Percentage) {
|
|
65
|
+
setDiscountValue(Math.min(value, 100)); // Note: set 100 as max percentage
|
|
66
|
+
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
setDiscountValue(Number(value));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @description Saves the discount:
|
|
74
|
+
* - as a discountAmount if discount type is of amount
|
|
75
|
+
* - as a discountPercentage if discount type is of percentage
|
|
76
|
+
*/
|
|
77
|
+
const handleDiscountSubmit = () => {
|
|
78
|
+
if (discountType === _constants__.DISCOUNT_TYPES.Amount) {
|
|
79
|
+
dispatch({
|
|
80
|
+
type: _OrderSessionContext.orderSessionActions.SET_DISCOUNT_AMOUNT,
|
|
81
|
+
payload: {
|
|
82
|
+
amount: discountValue
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
dispatch({
|
|
88
|
+
type: _OrderSessionContext.orderSessionActions.SET_DISCOUNT_PERCENTAGE,
|
|
89
|
+
payload: {
|
|
90
|
+
percentage: discountValue
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @description Clears the discount
|
|
97
|
+
*/
|
|
98
|
+
const handleDiscountClear = () => {
|
|
99
|
+
setDiscountValue('');
|
|
100
|
+
dispatch({
|
|
101
|
+
type: _OrderSessionContext.orderSessionActions.CLEAR_DISCOUNT
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
105
|
+
className: (0, _helpers__.withStyle)('mx-1')
|
|
106
|
+
}, /*#__PURE__*/_react.default.createElement("h5", {
|
|
107
|
+
className: (0, _helpers__.withStyle)('mb-3')
|
|
108
|
+
}, "Korting:"), /*#__PURE__*/_react.default.createElement("div", {
|
|
109
|
+
className: (0, _helpers__.withStyle)('d-flex gap-3')
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
111
|
+
options: Object.values(_constants__.DISCOUNT_TYPES).map(val => ({
|
|
112
|
+
label: val,
|
|
113
|
+
value: val
|
|
114
|
+
})),
|
|
115
|
+
name: "brand",
|
|
116
|
+
label: "Type",
|
|
117
|
+
isRequired: false,
|
|
118
|
+
noOptionsMessage: "Geen opties beschikbaar",
|
|
119
|
+
placeholder: "Maak een keuze",
|
|
120
|
+
onChange: _ref => {
|
|
121
|
+
let {
|
|
122
|
+
value
|
|
123
|
+
} = _ref;
|
|
124
|
+
return setDiscountType(value);
|
|
125
|
+
},
|
|
126
|
+
initialValue: !discountType ? null : {
|
|
127
|
+
value: discountType,
|
|
128
|
+
label: discountType
|
|
129
|
+
}
|
|
130
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
+
className: (0, _helpers__.withStyle)('d-flex align-items-end gap-2')
|
|
132
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
133
|
+
as: 'input',
|
|
134
|
+
id: 'discount-value',
|
|
135
|
+
name: 'discount-value',
|
|
136
|
+
type: 'number',
|
|
137
|
+
value: discountValue,
|
|
138
|
+
disabled: !discountType,
|
|
139
|
+
onChange: e => handleDiscountChange(e.target.value),
|
|
140
|
+
required: false,
|
|
141
|
+
className: "".concat((0, _helpers__.withStyle)('form-control')),
|
|
142
|
+
max: discountType === _constants__.DISCOUNT_TYPES.Percentage ? 100 : Infinity // Set 100% as max if percentage, otherwise: infinite
|
|
143
|
+
}), /*#__PURE__*/_react.default.createElement(_PrimaryButton.default, {
|
|
144
|
+
isDisabled: !discountValue,
|
|
145
|
+
onClick: handleDiscountSubmit,
|
|
146
|
+
label: "Toepassen",
|
|
147
|
+
isNarrow: true
|
|
148
|
+
}), /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
|
|
149
|
+
isDisabled: !discountAmount && !discountPercentage,
|
|
150
|
+
onClick: handleDiscountClear,
|
|
151
|
+
label: "Verwijderen"
|
|
152
|
+
}))));
|
|
153
|
+
};
|
|
154
|
+
var _default = exports.default = InternalDiscountForm;
|
|
@@ -116,10 +116,8 @@ const internalQuotationFormSchema = (0, _yup.object)({
|
|
|
116
116
|
ownershipType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
117
117
|
leaseNumber: (0, _yup.string)().nullable(),
|
|
118
118
|
firstName: (0, _yup.string)().nullable(),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
partnerId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required)
|
|
122
|
-
}).required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
119
|
+
channelId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
120
|
+
channelPartnerId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
123
121
|
infix: (0, _yup.string)().nullable(),
|
|
124
122
|
lastName: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
125
123
|
email: (0, _yup.string)().email(_constants__.FORM_ERROR_MESSAGES.email).required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
@@ -139,6 +137,8 @@ const InternalQuotationForm = () => {
|
|
|
139
137
|
selectedTowbar,
|
|
140
138
|
selectedBranch,
|
|
141
139
|
discountCode,
|
|
140
|
+
discountAmount,
|
|
141
|
+
discountPercentage,
|
|
142
142
|
selectedDiscountedProducts = [],
|
|
143
143
|
channel
|
|
144
144
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
@@ -194,7 +194,8 @@ const InternalQuotationForm = () => {
|
|
|
194
194
|
|
|
195
195
|
// Note: this throws on error.
|
|
196
196
|
internalQuotationFormSchema.validateSync(_objectSpread(_objectSpread(_objectSpread({}, vehicle), customer), {}, {
|
|
197
|
-
channel
|
|
197
|
+
channelId: channel === null || channel === void 0 ? void 0 : channel.id,
|
|
198
|
+
channelPartnerId: channel === null || channel === void 0 ? void 0 : channel.partnerId
|
|
198
199
|
}), {
|
|
199
200
|
strict: false,
|
|
200
201
|
abortEarly: false
|
|
@@ -214,9 +215,11 @@ const InternalQuotationForm = () => {
|
|
|
214
215
|
execution1: answers === null || answers === void 0 ? void 0 : answers['0'],
|
|
215
216
|
execution2: answers === null || answers === void 0 ? void 0 : answers['1']
|
|
216
217
|
}),
|
|
217
|
-
discount:
|
|
218
|
-
code: discountCode
|
|
219
|
-
|
|
218
|
+
discount: (0, _helpers__.removeNullishProps)({
|
|
219
|
+
code: discountCode,
|
|
220
|
+
amount: discountAmount,
|
|
221
|
+
percentage: discountPercentage
|
|
222
|
+
}),
|
|
220
223
|
formula,
|
|
221
224
|
branchId: selectedBranch,
|
|
222
225
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
@@ -243,37 +246,7 @@ const InternalQuotationForm = () => {
|
|
|
243
246
|
title: '',
|
|
244
247
|
isWide: true,
|
|
245
248
|
isNarrow: true
|
|
246
|
-
}, /*#__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(
|
|
247
|
-
name: "ownershipType",
|
|
248
|
-
form: "quotation",
|
|
249
|
-
label: "Type:",
|
|
250
|
-
initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType,
|
|
251
|
-
onChange: val => {
|
|
252
|
-
dispatch({
|
|
253
|
-
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_OWNERSHIP_TYPE,
|
|
254
|
-
payload: {
|
|
255
|
-
ownershipType: val
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
},
|
|
259
|
-
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
260
|
-
isRequired: true,
|
|
261
|
-
errorMessage: errors === null || errors === void 0 ? void 0 : errors['ownershipType']
|
|
262
|
-
}), (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
263
|
-
placeholder: "",
|
|
264
|
-
initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber,
|
|
265
|
-
name: "leaseNumber",
|
|
266
|
-
onChange: value => dispatch({
|
|
267
|
-
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_LEASE_NUMBER,
|
|
268
|
-
payload: {
|
|
269
|
-
leaseNumber: value
|
|
270
|
-
}
|
|
271
|
-
}),
|
|
272
|
-
isRequired: false,
|
|
273
|
-
form: "quotation",
|
|
274
|
-
label: "Code van de leasemaatschappij:",
|
|
275
|
-
errorMessage: errors === null || errors === void 0 ? void 0 : errors['leaseNumber']
|
|
276
|
-
}), /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
249
|
+
}, /*#__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, {
|
|
277
250
|
options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
|
|
278
251
|
label: channel === null || channel === void 0 ? void 0 : channel.title,
|
|
279
252
|
value: channel
|
|
@@ -284,7 +257,7 @@ const InternalQuotationForm = () => {
|
|
|
284
257
|
isLoading: isLoadingMarketingChannels,
|
|
285
258
|
noOptionsMessage: "Geen opties beschikbaar",
|
|
286
259
|
placeholder: "Maak een keuze",
|
|
287
|
-
errorMessage: (errors === null || errors === void 0 ? void 0 : errors['
|
|
260
|
+
errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelId']) || (errors === null || errors === void 0 ? void 0 : errors['channelPartnerId']),
|
|
288
261
|
initialValue: () => {
|
|
289
262
|
const foundChannel = marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.partnerId));
|
|
290
263
|
return {
|
|
@@ -308,6 +281,36 @@ const InternalQuotationForm = () => {
|
|
|
308
281
|
}
|
|
309
282
|
});
|
|
310
283
|
}
|
|
284
|
+
}), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
|
|
285
|
+
name: "ownershipType",
|
|
286
|
+
form: "quotation",
|
|
287
|
+
label: "Type:",
|
|
288
|
+
initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType,
|
|
289
|
+
onChange: val => {
|
|
290
|
+
dispatch({
|
|
291
|
+
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_OWNERSHIP_TYPE,
|
|
292
|
+
payload: {
|
|
293
|
+
ownershipType: val
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
},
|
|
297
|
+
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
298
|
+
isRequired: true,
|
|
299
|
+
errorMessage: errors === null || errors === void 0 ? void 0 : errors['ownershipType']
|
|
300
|
+
}), (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
301
|
+
placeholder: "",
|
|
302
|
+
initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.leaseNumber,
|
|
303
|
+
name: "leaseNumber",
|
|
304
|
+
onChange: value => dispatch({
|
|
305
|
+
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_LEASE_NUMBER,
|
|
306
|
+
payload: {
|
|
307
|
+
leaseNumber: value
|
|
308
|
+
}
|
|
309
|
+
}),
|
|
310
|
+
isRequired: false,
|
|
311
|
+
form: "quotation",
|
|
312
|
+
label: "Code van de leasemaatschappij:",
|
|
313
|
+
errorMessage: errors === null || errors === void 0 ? void 0 : errors['leaseNumber']
|
|
311
314
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
312
315
|
placeholder: "",
|
|
313
316
|
initialValue: customer.firstName,
|
|
@@ -111,6 +111,8 @@ const INITIAL_ORDER_SESSION_STATE = {
|
|
|
111
111
|
ownershipType: _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier,
|
|
112
112
|
leaseNumber: ''
|
|
113
113
|
},
|
|
114
|
+
discountAmount: null,
|
|
115
|
+
discountPercentage: null,
|
|
114
116
|
appointment: {
|
|
115
117
|
date: new Date(),
|
|
116
118
|
time: new Date(),
|
|
@@ -137,7 +139,8 @@ const orderSessionActions = exports.orderSessionActions = {
|
|
|
137
139
|
SET_SELECTED_TOWBAR: 'SET_SELECTED_TOWBAR',
|
|
138
140
|
SET_SELECTED_CABLESET: 'SET_SELECTED_CABLESET',
|
|
139
141
|
SET_SELECTED_COMBISET: 'SET_SELECTED_COMBISET',
|
|
140
|
-
|
|
142
|
+
ADD_DISCOUNTED_PRODUCT: 'ADD_DISCOUNTED_PRODUCT',
|
|
143
|
+
REMOVE_DISCOUNTED_PRODUCT: 'REMOVE_DISCOUNTED_PRODUCT',
|
|
141
144
|
ADD_EXTRA: 'ADD_EXTRA',
|
|
142
145
|
REMOVE_EXTRA: 'REMOVE_EXTRA',
|
|
143
146
|
UPDATE_EXTRA_QUANTITY: 'UPDATE_EXTRA_QUANTITY',
|
|
@@ -160,7 +163,10 @@ const orderSessionActions = exports.orderSessionActions = {
|
|
|
160
163
|
SET_CUSTOMER_HOUSE_NUMBER: 'SET_CUSTOMER_HOUSE_NUMBER',
|
|
161
164
|
SET_APPOINTMENT_TIME: 'SET_APPOINTMENT_TIME',
|
|
162
165
|
SET_APPOINTMENT_DATE: 'SET_APPOINTMENT_DATE',
|
|
163
|
-
SET_APPOINTMENT_NOTE: 'SET_APPOINTMENT_NOTE'
|
|
166
|
+
SET_APPOINTMENT_NOTE: 'SET_APPOINTMENT_NOTE',
|
|
167
|
+
SET_DISCOUNT_AMOUNT: 'SET_DISCOUNT_AMOUNT',
|
|
168
|
+
SET_DISCOUNT_PERCENTAGE: 'SET_DISCOUNT_PERCENTAGE',
|
|
169
|
+
CLEAR_DISCOUNT: 'CLEAR_DISCOUNT'
|
|
164
170
|
};
|
|
165
171
|
const orderSessionReducer = (state, action) => {
|
|
166
172
|
switch (action.type) {
|
|
@@ -541,14 +547,76 @@ const orderSessionReducer = (state, action) => {
|
|
|
541
547
|
})
|
|
542
548
|
});
|
|
543
549
|
}
|
|
544
|
-
case orderSessionActions.
|
|
550
|
+
case orderSessionActions.REMOVE_DISCOUNTED_PRODUCT:
|
|
545
551
|
{
|
|
552
|
+
var _state$selectedDiscou;
|
|
546
553
|
const {
|
|
547
|
-
|
|
554
|
+
articleNumber
|
|
548
555
|
} = action.payload;
|
|
549
|
-
const discountedProductsWithQuantity = selectedDiscountedProducts.filter(product => product.quantity); // Note: this filters out products with 0 quantity
|
|
550
556
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
551
|
-
selectedDiscountedProducts:
|
|
557
|
+
selectedDiscountedProducts: ((_state$selectedDiscou = state === null || state === void 0 ? void 0 : state.selectedDiscountedProducts) !== null && _state$selectedDiscou !== void 0 ? _state$selectedDiscou : []).filter(product => (product === null || product === void 0 ? void 0 : product.articleNumber) !== articleNumber)
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
case orderSessionActions.ADD_DISCOUNTED_PRODUCT:
|
|
561
|
+
{
|
|
562
|
+
var _state$selectedDiscou3;
|
|
563
|
+
const {
|
|
564
|
+
articleNumber,
|
|
565
|
+
quantity
|
|
566
|
+
} = action.payload;
|
|
567
|
+
|
|
568
|
+
// Remove the product if no quantity was selected
|
|
569
|
+
if (!quantity) {
|
|
570
|
+
var _state$selectedDiscou2;
|
|
571
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
572
|
+
selectedDiscountedProducts: ((_state$selectedDiscou2 = state === null || state === void 0 ? void 0 : state.selectedDiscountedProducts) !== null && _state$selectedDiscou2 !== void 0 ? _state$selectedDiscou2 : []).filter(product => (product === null || product === void 0 ? void 0 : product.articleNumber) !== articleNumber)
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
const productExistsAlready = ((_state$selectedDiscou3 = state === null || state === void 0 ? void 0 : state.selectedDiscountedProducts) !== null && _state$selectedDiscou3 !== void 0 ? _state$selectedDiscou3 : []).some(product => product.articleNumber === articleNumber);
|
|
576
|
+
if (productExistsAlready) {
|
|
577
|
+
var _state$selectedDiscou4;
|
|
578
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
579
|
+
selectedDiscountedProducts: state === null || state === void 0 || (_state$selectedDiscou4 = state.selectedDiscountedProducts) === null || _state$selectedDiscou4 === void 0 ? void 0 : _state$selectedDiscou4.map(product => {
|
|
580
|
+
if (product.articleNumber !== articleNumber) return product;
|
|
581
|
+
return {
|
|
582
|
+
articleNumber,
|
|
583
|
+
quantity
|
|
584
|
+
};
|
|
585
|
+
})
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
589
|
+
selectedDiscountedProducts: [...(state === null || state === void 0 ? void 0 : state.selectedDiscountedProducts), {
|
|
590
|
+
quantity,
|
|
591
|
+
articleNumber
|
|
592
|
+
}]
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
case orderSessionActions.SET_DISCOUNT_AMOUNT:
|
|
596
|
+
{
|
|
597
|
+
const {
|
|
598
|
+
amount
|
|
599
|
+
} = action.payload;
|
|
600
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
601
|
+
discountPercentage: null,
|
|
602
|
+
discountAmount: amount
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
case orderSessionActions.SET_DISCOUNT_PERCENTAGE:
|
|
606
|
+
{
|
|
607
|
+
const {
|
|
608
|
+
percentage
|
|
609
|
+
} = action.payload;
|
|
610
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
611
|
+
discountPercentage: percentage,
|
|
612
|
+
discountAmount: null
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
case orderSessionActions.CLEAR_DISCOUNT:
|
|
616
|
+
{
|
|
617
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
618
|
+
discountPercentage: null,
|
|
619
|
+
discountAmount: null
|
|
552
620
|
});
|
|
553
621
|
}
|
|
554
622
|
default:
|
|
@@ -90,6 +90,7 @@ var _OverviewPage = _interopRequireDefault(require("./OverviewPage"));
|
|
|
90
90
|
var _ProductsPage = _interopRequireDefault(require("./ProductsPage"));
|
|
91
91
|
var _QuotationPage = _interopRequireDefault(require("./QuotationPage"));
|
|
92
92
|
var _QuotationThanksPage = _interopRequireDefault(require("./QuotationThanksPage"));
|
|
93
|
+
var _internal = require("./internal");
|
|
93
94
|
function _interopRequireDefault(obj) {
|
|
94
95
|
return obj && obj.__esModule ? obj : {
|
|
95
96
|
default: obj
|
|
@@ -101,7 +102,7 @@ const Routes = () => {
|
|
|
101
102
|
return /*#__PURE__*/_react.default.createElement(_reactRouterDom.Switch, null, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
102
103
|
exact: true,
|
|
103
104
|
path: "/",
|
|
104
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
105
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalLicensePlatePage, props)
|
|
105
106
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
106
107
|
exact: true,
|
|
107
108
|
path: "/configurator/geen-producten",
|
|
@@ -109,40 +110,40 @@ const Routes = () => {
|
|
|
109
110
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
110
111
|
exact: true,
|
|
111
112
|
path: "/configurator/montagelocatie",
|
|
112
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
113
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalLocationsPage, props)
|
|
113
114
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
114
115
|
exact: true,
|
|
115
116
|
path: "/configurator/gegevens/bedankt",
|
|
116
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
117
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalAppointmentPage, props)
|
|
117
118
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
118
119
|
exact: true,
|
|
119
120
|
path: "/configurator/offerte/bedankt",
|
|
120
121
|
render: props => /*#__PURE__*/_react.default.createElement(_QuotationThanksPage.default, props)
|
|
121
122
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
122
123
|
path: "/configurator/trekhaakpakket",
|
|
123
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
124
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalProductsPage, null)
|
|
124
125
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
125
126
|
path: "/configurator/manual",
|
|
126
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
127
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalManualSelectionPage, props)
|
|
127
128
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
128
129
|
exact: true,
|
|
129
130
|
path: "/configurator/overzicht",
|
|
130
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
131
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalOverviewPage, null)
|
|
131
132
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
132
133
|
exact: true,
|
|
133
134
|
path: "/configurator/offerte",
|
|
134
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
135
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalQuotationPage, null)
|
|
135
136
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
136
137
|
exact: true,
|
|
137
138
|
path: "/configurator/gegevens",
|
|
138
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
139
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalAppointmentPage, null)
|
|
139
140
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
140
141
|
exact: true,
|
|
141
142
|
path: "/configurator/toebehoren",
|
|
142
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
143
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalExtraProductsPage, null)
|
|
143
144
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
144
145
|
path: "/configurator",
|
|
145
|
-
render: props => /*#__PURE__*/_react.default.createElement(
|
|
146
|
+
render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalLicensePlatePage, null)
|
|
146
147
|
}), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
147
148
|
path: "/niet-gevonden",
|
|
148
149
|
render: () => /*#__PURE__*/_react.default.createElement(_NotFoundPage.default, null)
|
|
@@ -62,7 +62,7 @@ const InternalLocationsPage = _ref => {
|
|
|
62
62
|
(0, _react.useEffect)(() => {
|
|
63
63
|
var _branchTypes$byId$aut, _authSession$branch, _location$state;
|
|
64
64
|
const branchType = 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;
|
|
65
|
-
if (!branchType || branchType ===
|
|
65
|
+
if (!branchType || branchType === _constants__.TMG_ORGANIZATION_TYPE) {
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -29,6 +29,14 @@ Button Link
|
|
|
29
29
|
opacity: 0.25;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/* ==========================================================================
|
|
33
|
+
Narrow button
|
|
34
|
+
========================================================================== */
|
|
35
|
+
|
|
36
|
+
.btn-narrow {
|
|
37
|
+
padding: 0.625rem 1.25rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
/* ==========================================================================
|
|
33
41
|
Button Check
|
|
34
42
|
========================================================================== */
|
|
@@ -11,7 +11,13 @@ Dealer Item
|
|
|
11
11
|
margin-bottom: 0 !important;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.form-check {
|
|
14
|
+
.form-check--lg {
|
|
15
|
+
@extend .text-primary;
|
|
16
|
+
|
|
17
|
+
@include font-size($font-size-lg);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.form-check--sm {
|
|
15
21
|
@extend .text-primary;
|
|
16
22
|
|
|
17
23
|
@include font-size($font-size-sm);
|
|
@@ -12,6 +12,12 @@ Dealer Map
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
.dealer-map__container {
|
|
16
|
+
position: -webkit-sticky;
|
|
17
|
+
position: sticky;
|
|
18
|
+
top: 90px;
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
/* ==========================================================================
|
|
16
22
|
Dealer Map Infowindow
|
|
17
23
|
========================================================================== */
|
|
@@ -3,6 +3,10 @@ Configurator THC theme
|
|
|
3
3
|
========================================================================== */
|
|
4
4
|
|
|
5
5
|
.thc {
|
|
6
|
+
.hero {
|
|
7
|
+
@extend .align-items-center, .bg-custom-primary, .d-flex, .text-white;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
.btn-primary {
|
|
7
11
|
@extend .btn-custom-primary, .text-white;
|
|
8
12
|
}
|
|
@@ -35,7 +39,14 @@ Configurator THC theme
|
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
.form-check--sm {
|
|
43
|
+
@extend .text-primary;
|
|
44
|
+
|
|
45
|
+
@include font-size($font-size-sm);
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
.form-check {
|
|
49
|
+
@include font-size($font-size-base);
|
|
39
50
|
@extend .text-custom-primary;
|
|
40
51
|
|
|
41
52
|
color: $custom-primary;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thm-p3-configurator",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"author": "EnoRm.",
|
|
@@ -35,37 +35,22 @@
|
|
|
35
35
|
"date-fns": "^2.23.0",
|
|
36
36
|
"dotenv": "^10.0.0",
|
|
37
37
|
"express": "^4.17.1",
|
|
38
|
-
"formik": "^2.2.9",
|
|
39
|
-
"formik-persist": "^1.1.0",
|
|
40
|
-
"google-maps-react": "^2.0.6",
|
|
41
|
-
"imagekitio-react": "^1.0.10",
|
|
42
38
|
"lodash": "^4.17.21",
|
|
43
39
|
"moment": "^2.29.1",
|
|
44
40
|
"node-gyp": "^10.0.1",
|
|
45
41
|
"path": "^0.12.7",
|
|
46
|
-
"prop-types": "^15.7.2",
|
|
47
|
-
"query-string": "^7.0.1",
|
|
48
42
|
"react": "^17.0.2",
|
|
49
|
-
"react-cookiebot": "^1.0.10",
|
|
50
43
|
"react-datepicker": "^4.2.0",
|
|
51
|
-
"react-device-detect": "^2.1.2",
|
|
52
44
|
"react-dom": "^17.0.2",
|
|
53
45
|
"react-gtm-module": "^2.0.11",
|
|
54
46
|
"react-lottie": "^1.2.3",
|
|
55
47
|
"react-numeric-input": "^2.2.3",
|
|
56
|
-
"react-paginate": "^8.1.3",
|
|
57
|
-
"react-places-autocomplete": "^7.3.0",
|
|
58
48
|
"react-router": "^5.2.0",
|
|
59
49
|
"react-router-dom": "^5.2.0",
|
|
60
|
-
"react-router-hash-link": "^2.4.3",
|
|
61
50
|
"react-select": "^4.3.1",
|
|
62
|
-
"react-stickynode": "^4.0.0",
|
|
63
51
|
"react-truncate": "^2.4.0",
|
|
64
52
|
"sass": "^1.69.5",
|
|
65
53
|
"slugify": "^1.6.5",
|
|
66
|
-
"universal-cookie": "^4.0.4",
|
|
67
|
-
"use-local-storage-state": "^11.0.0",
|
|
68
|
-
"xml-js": "^1.6.11",
|
|
69
54
|
"yup": "^0.32.9"
|
|
70
55
|
},
|
|
71
56
|
"devDependencies": {
|