thm-p3-configurator 0.0.70 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/shared/__components__/LocationsSelector/index.js +27 -8
- package/dist/src/shared/__components__/Pagination.js +6 -36
- package/dist/src/shared/__components__/SingleOrderProductCard.js +26 -3
- package/dist/src/shared/__constants__/index.js +14 -2
- package/dist/src/shared/__containers__/BottomNavigationBar.js +8 -1
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +4 -3
- package/dist/src/shared/__containers__/internal/InternalBranchSelectorModal.js +0 -3
- package/dist/src/shared/__containers__/internal/InternalSingleOrderProductOverview.js +5 -1
- package/dist/src/shared/__context__/OrderSessionContext.js +2 -0
- package/dist/src/shared/__helpers__/dossier.js +2 -1
- package/dist/src/shared/__helpers__/singleOrderArticles.js +13 -6
- package/dist/src/shared/__pages__/internal/InternalLocationsPage.js +10 -1
- package/dist/src/shared/__pages__/internal/InternalSingleOrderPage.js +8 -1
- package/package.json +1 -1
|
@@ -11,11 +11,13 @@ 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
13
|
var _queries = require("../../__api__/queries");
|
|
14
|
+
var _constants__ = require("../../__constants__");
|
|
14
15
|
var _FormulaContext = require("../../__context__/FormulaContext");
|
|
15
16
|
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
16
17
|
var _helpers__ = require("../../__helpers__");
|
|
17
18
|
var _useBreakpoint = _interopRequireDefault(require("../../__hooks__/useBreakpoint"));
|
|
18
19
|
var _useUserLocation = _interopRequireDefault(require("../../__hooks__/useUserLocation"));
|
|
20
|
+
var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
|
|
19
21
|
var _LocationAutoComplete = _interopRequireDefault(require("./LocationAutoComplete"));
|
|
20
22
|
var _LocationClusteredMap = _interopRequireDefault(require("./LocationClusteredMap"));
|
|
21
23
|
var _LocationList = _interopRequireDefault(require("./LocationList"));
|
|
@@ -66,19 +68,36 @@ const LocationsSelector = /*#__PURE__*/_react.default.memo(() => {
|
|
|
66
68
|
const [{
|
|
67
69
|
franchiseName
|
|
68
70
|
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
71
|
+
const authSession = _LocalStorageWorker.lsw.getJson(_constants__.AUTH_SESSION_KEY);
|
|
69
72
|
const {
|
|
70
|
-
|
|
71
|
-
} = (0, _queries.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
branchTypes
|
|
74
|
+
} = (0, _queries.useBranchTypes)();
|
|
75
|
+
const isTMGOrganization = _react.default.useMemo(() => {
|
|
76
|
+
var _branchTypes$byId$aut, _authSession$branch;
|
|
77
|
+
return (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;
|
|
78
|
+
}, [branchTypes, authSession]);
|
|
79
|
+
let locations;
|
|
80
|
+
if (isTMGOrganization) {
|
|
81
|
+
const {
|
|
82
|
+
branches
|
|
83
|
+
} = (0, _queries.useBranchesQuery)({
|
|
84
|
+
offset: 0,
|
|
85
|
+
limit: 400,
|
|
86
|
+
formula,
|
|
87
|
+
franchiseName
|
|
88
|
+
});
|
|
89
|
+
locations = (branches === null || branches === void 0 ? void 0 : branches.results) || [];
|
|
90
|
+
} else {
|
|
91
|
+
const {
|
|
92
|
+
myBranches
|
|
93
|
+
} = (0, _queries.useMyBranches)(formula);
|
|
94
|
+
locations = myBranches || [];
|
|
95
|
+
}
|
|
77
96
|
const {
|
|
78
97
|
byId,
|
|
79
98
|
allIds
|
|
80
99
|
} = (0, _react.useMemo)(() => (0, _helpers__.normalizeArray)({
|
|
81
|
-
array:
|
|
100
|
+
array: locations || [],
|
|
82
101
|
key: 'entityId'
|
|
83
102
|
}), [locations]);
|
|
84
103
|
(0, _react.useEffect)(() => {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
7
4
|
value: true
|
|
8
5
|
});
|
|
9
6
|
exports.default = void 0;
|
|
10
|
-
require("
|
|
11
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
8
|
var _reactPaginate = _interopRequireDefault(require("react-paginate"));
|
|
13
9
|
var _helpers__ = require("../__helpers__");
|
|
14
10
|
function _interopRequireDefault(e) {
|
|
@@ -16,46 +12,19 @@ function _interopRequireDefault(e) {
|
|
|
16
12
|
default: e
|
|
17
13
|
};
|
|
18
14
|
}
|
|
19
|
-
function _getRequireWildcardCache(e) {
|
|
20
|
-
if ("function" != typeof WeakMap) return null;
|
|
21
|
-
var r = new WeakMap(),
|
|
22
|
-
t = new WeakMap();
|
|
23
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
24
|
-
return e ? t : r;
|
|
25
|
-
})(e);
|
|
26
|
-
}
|
|
27
|
-
function _interopRequireWildcard(e, r) {
|
|
28
|
-
if (!r && e && e.__esModule) return e;
|
|
29
|
-
if (null === e || "object" != typeof e && "function" != typeof e) return {
|
|
30
|
-
default: e
|
|
31
|
-
};
|
|
32
|
-
var t = _getRequireWildcardCache(r);
|
|
33
|
-
if (t && t.has(e)) return t.get(e);
|
|
34
|
-
var n = {
|
|
35
|
-
__proto__: null
|
|
36
|
-
},
|
|
37
|
-
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
38
|
-
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
39
|
-
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
40
|
-
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
41
|
-
}
|
|
42
|
-
return n.default = e, t && t.set(e, n), n;
|
|
43
|
-
}
|
|
44
15
|
const Pagination = _ref => {
|
|
45
16
|
let {
|
|
46
|
-
|
|
17
|
+
currentPage = 0,
|
|
47
18
|
label = 'resultaten',
|
|
48
|
-
count =
|
|
19
|
+
count = 0,
|
|
49
20
|
pageSize = 1,
|
|
50
21
|
className = '',
|
|
51
22
|
onPageChange = selectedPage => {}
|
|
52
23
|
} = _ref;
|
|
53
|
-
const [page, setPage] = (0, _react.useState)(initialPage);
|
|
54
24
|
const handlePageChange = _ref2 => {
|
|
55
25
|
let {
|
|
56
26
|
selected
|
|
57
27
|
} = _ref2;
|
|
58
|
-
setPage(selected);
|
|
59
28
|
onPageChange(selected);
|
|
60
29
|
};
|
|
61
30
|
return /*#__PURE__*/_react.default.createElement("nav", {
|
|
@@ -73,10 +42,11 @@ const Pagination = _ref => {
|
|
|
73
42
|
pageLinkClassName: (0, _helpers__.withStyle)('page-link'),
|
|
74
43
|
pageRangeDisplayed: 3,
|
|
75
44
|
previousLabel: 'Vorige',
|
|
76
|
-
subContainerClassName: (0, _helpers__.withStyle)('pages pagination')
|
|
45
|
+
subContainerClassName: (0, _helpers__.withStyle)('pages pagination'),
|
|
46
|
+
forcePage: currentPage
|
|
77
47
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
78
48
|
className: (0, _helpers__.withStyle)('mt-2 section__pagination-caption')
|
|
79
|
-
}, /*#__PURE__*/_react.default.createElement("p", null, (
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, (currentPage + 1) * pageSize - pageSize + 1, " to", ' ', (currentPage + 1) * pageSize <= count ? (currentPage + 1) * pageSize : count, ' ', "van ", count, " ", label)));
|
|
80
50
|
};
|
|
81
51
|
|
|
82
52
|
// we can optimise cause right now it re-renders on every state change (count)
|
|
@@ -113,13 +113,32 @@ const ProductActions = _ref4 => {
|
|
|
113
113
|
label: "Verwijder"
|
|
114
114
|
}))));
|
|
115
115
|
};
|
|
116
|
-
const
|
|
116
|
+
const ProductCategories = _ref5 => {
|
|
117
|
+
let {
|
|
118
|
+
productType = null,
|
|
119
|
+
productGroup = null,
|
|
120
|
+
productSubgroup = null
|
|
121
|
+
} = _ref5;
|
|
122
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
className: (0, _helpers__.withStyle)('mb-3')
|
|
124
|
+
}, productType && /*#__PURE__*/_react.default.createElement("p", {
|
|
125
|
+
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
126
|
+
}, /*#__PURE__*/_react.default.createElement("strong", null, "Type:"), " ", productType), productGroup && /*#__PURE__*/_react.default.createElement("p", {
|
|
127
|
+
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement("strong", null, "Groep:"), " ", productGroup), productSubgroup && /*#__PURE__*/_react.default.createElement("p", {
|
|
129
|
+
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement("strong", null, "Subgroep:"), " ", productSubgroup));
|
|
131
|
+
};
|
|
132
|
+
const SingleOrderProductCard = _ref6 => {
|
|
117
133
|
let {
|
|
118
134
|
productId,
|
|
119
135
|
isSelected,
|
|
120
136
|
isOutOfStock,
|
|
121
137
|
handleSelected,
|
|
122
138
|
productImage,
|
|
139
|
+
productType,
|
|
140
|
+
productGroup,
|
|
141
|
+
productSubgroup,
|
|
123
142
|
productTitle,
|
|
124
143
|
productDescription,
|
|
125
144
|
productPrice,
|
|
@@ -127,7 +146,7 @@ const SingleOrderProductCard = _ref5 => {
|
|
|
127
146
|
quantity = 0,
|
|
128
147
|
handleQuantityChange,
|
|
129
148
|
removeFromCart
|
|
130
|
-
} =
|
|
149
|
+
} = _ref6;
|
|
131
150
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
132
151
|
key: productId + "-".concat(Date.now()),
|
|
133
152
|
className: (0, _helpers__.withStyle)("card card__horizontal card__link ".concat(isSelected ? 'active' : '', " container-fluid p-0 my-3"))
|
|
@@ -143,7 +162,11 @@ const SingleOrderProductCard = _ref5 => {
|
|
|
143
162
|
className: (0, _helpers__.withStyle)('card-title mb-3')
|
|
144
163
|
}, productTitle, /*#__PURE__*/_react.default.createElement("span", {
|
|
145
164
|
className: (0, _helpers__.withStyle)('ms-2')
|
|
146
|
-
}, "\u20AC", productPrice)), /*#__PURE__*/_react.default.createElement(
|
|
165
|
+
}, "\u20AC", productPrice)), (productType || productGroup || productSubgroup) && /*#__PURE__*/_react.default.createElement(ProductCategories, {
|
|
166
|
+
productType: productType,
|
|
167
|
+
productGroup: productGroup,
|
|
168
|
+
productSubgroup: productSubgroup
|
|
169
|
+
}), /*#__PURE__*/_react.default.createElement(ProductDescription, {
|
|
147
170
|
description: productDescription
|
|
148
171
|
}), /*#__PURE__*/_react.default.createElement(ProductSpecifications, {
|
|
149
172
|
specifications: productSpecifications
|
|
@@ -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.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = 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.LOCATION_TYPE = exports.LOCALE = exports.FORM_ERROR_MESSAGES = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = 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.StockStatus = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = 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.LOCATION_TYPE = exports.LOCATION_CHANGE_BUTTON_LABEL = exports.LOCALE = exports.FORM_ERROR_MESSAGES = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = 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 DOSSIER_TYPES = exports.DOSSIER_TYPES = {
|
|
8
8
|
Quotation: 'quotation',
|
|
9
9
|
AppointmentRequest: 'appointment-request',
|
|
@@ -90,6 +90,11 @@ const NAVIGATION_BUTTONS = exports.NAVIGATION_BUTTONS = {
|
|
|
90
90
|
label: 'Maak een afspraak',
|
|
91
91
|
type: 'next',
|
|
92
92
|
shouldShowForDossierTypes: [DOSSIER_TYPES.AppointmentRequest, DOSSIER_TYPES.PlannedAppointment]
|
|
93
|
+
}, {
|
|
94
|
+
to: '/configurator/montagelocatie',
|
|
95
|
+
label: 'Wijzig de locatie',
|
|
96
|
+
type: 'next',
|
|
97
|
+
shouldShowForDossierTypes: [DOSSIER_TYPES.Quotation]
|
|
93
98
|
}],
|
|
94
99
|
'/configurator/montagelocatie': [{
|
|
95
100
|
to: '/configurator/overzicht',
|
|
@@ -98,7 +103,13 @@ const NAVIGATION_BUTTONS = exports.NAVIGATION_BUTTONS = {
|
|
|
98
103
|
}, {
|
|
99
104
|
to: '/configurator/gegevens',
|
|
100
105
|
label: 'Maak een afspraak',
|
|
101
|
-
type: 'next'
|
|
106
|
+
type: 'next',
|
|
107
|
+
shouldShowForDossierTypes: [DOSSIER_TYPES.AppointmentRequest, DOSSIER_TYPES.PlannedAppointment]
|
|
108
|
+
}, {
|
|
109
|
+
to: '/configurator/offerte',
|
|
110
|
+
label: 'Mail mij de offerte',
|
|
111
|
+
type: 'next',
|
|
112
|
+
shouldShowForDossierTypes: [DOSSIER_TYPES.Quotation]
|
|
102
113
|
}]
|
|
103
114
|
};
|
|
104
115
|
const DEFAULT_MAP_LATITUDE = exports.DEFAULT_MAP_LATITUDE = 52.090736;
|
|
@@ -130,6 +141,7 @@ const CONFIGURATOR_FORMULAS = exports.CONFIGURATOR_FORMULAS = {
|
|
|
130
141
|
THC: 'THC',
|
|
131
142
|
TMG: 'TMG'
|
|
132
143
|
};
|
|
144
|
+
const LOCATION_CHANGE_BUTTON_LABEL = exports.LOCATION_CHANGE_BUTTON_LABEL = 'Wijzig de locatie';
|
|
133
145
|
const TMG_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = 'TowMotive Group';
|
|
134
146
|
const LOCATION_TYPE = exports.LOCATION_TYPE = 'Vestiging';
|
|
135
147
|
const ANWB_DISCOUNT_CODE = exports.ANWB_DISCOUNT_CODE = 'ANWBTHC25';
|
|
@@ -94,7 +94,8 @@ const BottomNavigationBar = () => {
|
|
|
94
94
|
selectedCableset,
|
|
95
95
|
selectedCombiset,
|
|
96
96
|
selectedBranch,
|
|
97
|
-
existingDossierType
|
|
97
|
+
existingDossierType,
|
|
98
|
+
allowLocationChange
|
|
98
99
|
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
99
100
|
if (!(buttons !== null && buttons !== void 0 && buttons.length)) {
|
|
100
101
|
return null;
|
|
@@ -119,6 +120,12 @@ const BottomNavigationBar = () => {
|
|
|
119
120
|
if (existingDossierType && shouldShowForDossierTypes.length && !shouldShowForDossierTypes.includes(existingDossierType)) {
|
|
120
121
|
return null;
|
|
121
122
|
}
|
|
123
|
+
if (label === _constants__.LOCATION_CHANGE_BUTTON_LABEL && to === '/configurator/montagelocatie' && allowLocationChange === false) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
if (to === '/configurator/montagelocatie' && existingDossierType && !allowLocationChange) {
|
|
127
|
+
to = '/configurator/gegevens';
|
|
128
|
+
}
|
|
122
129
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
123
130
|
key: 'link-' + label,
|
|
124
131
|
className: (0, _helpers__.withStyle)("col-12 col-sm-auto d-flex order-2 order-sm-0 justify-content-".concat(buttons.length > 1 ? 'center' : 'end', " mt-1"))
|
|
@@ -164,6 +164,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
164
164
|
chassisNumber,
|
|
165
165
|
channel,
|
|
166
166
|
durationAnswer,
|
|
167
|
+
allowLocationChange,
|
|
167
168
|
selectedBoardComputer,
|
|
168
169
|
selectedCableset,
|
|
169
170
|
selectedCombiset,
|
|
@@ -256,7 +257,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
256
257
|
});
|
|
257
258
|
await onSubmit((0, _helpers__.removeNullishProps)({
|
|
258
259
|
vehicle,
|
|
259
|
-
customer: _objectSpread(_objectSpread({}, customer), {}, {
|
|
260
|
+
customer: (0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({}, customer), {}, {
|
|
260
261
|
firstName: (_customer$firstName = customer === null || customer === void 0 ? void 0 : customer.firstName) !== null && _customer$firstName !== void 0 ? _customer$firstName : undefined,
|
|
261
262
|
lastName: (_customer$lastName = customer === null || customer === void 0 ? void 0 : customer.lastName) !== null && _customer$lastName !== void 0 ? _customer$lastName : undefined,
|
|
262
263
|
phoneNumber: (_customer$phoneNumber = customer === null || customer === void 0 ? void 0 : customer.phoneNumber) !== null && _customer$phoneNumber !== void 0 ? _customer$phoneNumber : undefined,
|
|
@@ -269,7 +270,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
269
270
|
zipCode: (_customer$zipCode = customer === null || customer === void 0 ? void 0 : customer.zipCode) !== null && _customer$zipCode !== void 0 ? _customer$zipCode : undefined,
|
|
270
271
|
companyName: (_customer$companyName = customer === null || customer === void 0 ? void 0 : customer.companyName) !== null && _customer$companyName !== void 0 ? _customer$companyName : undefined,
|
|
271
272
|
invoiceEmail: (_customer$invoiceEmai = customer === null || customer === void 0 ? void 0 : customer.invoiceEmail) !== null && _customer$invoiceEmai !== void 0 ? _customer$invoiceEmai : undefined
|
|
272
|
-
}),
|
|
273
|
+
})),
|
|
273
274
|
customerAgreed,
|
|
274
275
|
appointment,
|
|
275
276
|
channel,
|
|
@@ -690,7 +691,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
690
691
|
className: (0, _helpers__.withStyle)('d-flex align-items-center justify-content-end mt-4')
|
|
691
692
|
}, /*#__PURE__*/_react.default.createElement(_NavigationButton.default, {
|
|
692
693
|
variant: "link",
|
|
693
|
-
to: '/configurator/montagelocatie',
|
|
694
|
+
to: allowLocationChange ? '/configurator/montagelocatie' : '/configurator/overzicht',
|
|
694
695
|
label: 'Vorige',
|
|
695
696
|
state: {
|
|
696
697
|
prevPathName: history.location.pathname
|
|
@@ -68,9 +68,6 @@ const NormalPageModalContent = _ref => {
|
|
|
68
68
|
const [_selectedBranchId, _setSelectedBranchId] = (0, _react.useState)();
|
|
69
69
|
const [_branches, _setBranches] = (0, _react.useState)([]);
|
|
70
70
|
const formula = (0, _FormulaContext.useFormula)();
|
|
71
|
-
const {
|
|
72
|
-
branchTypes
|
|
73
|
-
} = (0, _queries.useBranchTypes)();
|
|
74
71
|
const {
|
|
75
72
|
myBranches,
|
|
76
73
|
isLoadingMyBranches
|
|
@@ -138,7 +138,10 @@ const InternalSingleOrderProductOverview = _ref => {
|
|
|
138
138
|
productDescription: article === null || article === void 0 ? void 0 : article.description,
|
|
139
139
|
productImage: article.image,
|
|
140
140
|
productTitle: article.name,
|
|
141
|
-
productPrice: Number(article === null || article === void 0 || (_article$locationPric2 = article.locationPrices) === null || _article$locationPric2 === void 0 ? void 0 : _article$locationPric2.priceInclVat).toFixed(2)
|
|
141
|
+
productPrice: Number(article === null || article === void 0 || (_article$locationPric2 = article.locationPrices) === null || _article$locationPric2 === void 0 ? void 0 : _article$locationPric2.priceInclVat).toFixed(2),
|
|
142
|
+
productType: article === null || article === void 0 ? void 0 : article.type,
|
|
143
|
+
productGroup: article === null || article === void 0 ? void 0 : article.group,
|
|
144
|
+
productSubgroup: article === null || article === void 0 ? void 0 : article.subgroup
|
|
142
145
|
});
|
|
143
146
|
})), !articles && hasActiveFilters && !areArticlesLoaded && !areArticlesError && /*#__PURE__*/_react.default.createElement("div", {
|
|
144
147
|
className: (0, _helpers__.withStyle)('flex-grow-1 h-100')
|
|
@@ -149,6 +152,7 @@ const InternalSingleOrderProductOverview = _ref => {
|
|
|
149
152
|
className: (0, _helpers__.withStyle)('mt-4'),
|
|
150
153
|
count: articles === null || articles === void 0 ? void 0 : articles.totalArticles,
|
|
151
154
|
pageSize: 10,
|
|
155
|
+
currentPage: filters.page,
|
|
152
156
|
onPageChange: page => paginationChange('page', page)
|
|
153
157
|
}));
|
|
154
158
|
};
|
|
@@ -112,6 +112,7 @@ const INITIAL_ORDER_SESSION_STATE = {
|
|
|
112
112
|
executionAnswer1: null,
|
|
113
113
|
executionAnswer2: null,
|
|
114
114
|
priceCalculationDate: new Date().getTime(),
|
|
115
|
+
allowLocationChange: false,
|
|
115
116
|
durationOptions: [],
|
|
116
117
|
execution1Options: [],
|
|
117
118
|
execution2Options: [],
|
|
@@ -367,6 +368,7 @@ const orderSessionReducer = (state, action) => {
|
|
|
367
368
|
brand,
|
|
368
369
|
selectedBranch: (state === null || state === void 0 ? void 0 : state.selectedBranch) || (INITIAL_ORDER_SESSION_STATE === null || INITIAL_ORDER_SESSION_STATE === void 0 ? void 0 : INITIAL_ORDER_SESSION_STATE.selectedBranch),
|
|
369
370
|
discountCode: (state === null || state === void 0 ? void 0 : state.discountCode) || (INITIAL_ORDER_SESSION_STATE === null || INITIAL_ORDER_SESSION_STATE === void 0 ? void 0 : INITIAL_ORDER_SESSION_STATE.discountCode),
|
|
371
|
+
singleOrderCart: (state === null || state === void 0 ? void 0 : state.singleOrderCart) || (INITIAL_ORDER_SESSION_STATE === null || INITIAL_ORDER_SESSION_STATE === void 0 ? void 0 : INITIAL_ORDER_SESSION_STATE.singleOrderCart),
|
|
370
372
|
isTouched: true
|
|
371
373
|
});
|
|
372
374
|
}
|
|
@@ -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$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;
|
|
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,
|
|
@@ -92,6 +92,7 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
|
|
|
92
92
|
selectedDiscountedProducts: [],
|
|
93
93
|
// TODO
|
|
94
94
|
selectedBoardComputer: null,
|
|
95
|
+
allowLocationChange: (_dossier$statusDossie = dossier === null || dossier === void 0 || (_dossier$statusDossie2 = dossier.statusDossier) === null || _dossier$statusDossie2 === void 0 ? void 0 : _dossier$statusDossie2.vestigingWijzigenToegestaan) !== null && _dossier$statusDossie !== void 0 ? _dossier$statusDossie : false,
|
|
95
96
|
// Static:
|
|
96
97
|
franchiseName: null,
|
|
97
98
|
buildYear: null,
|
|
@@ -181,9 +181,9 @@ const enrichArticlesWithBrandsAndPrices = async (articles, branchId, formula) =>
|
|
|
181
181
|
throw new Error('Failed to fetch the brands of the articles');
|
|
182
182
|
}
|
|
183
183
|
const articlesWithBrands = articles.map(article => {
|
|
184
|
-
var _brandResponse$data$f;
|
|
184
|
+
var _brandResponse$data$f, _brandResponse$data$f2;
|
|
185
185
|
return _objectSpread(_objectSpread({}, article), {}, {
|
|
186
|
-
brand: (_brandResponse$data$f = brandResponse.data.find(brand => brand.article === article.articleNumber)) === null || _brandResponse$data$
|
|
186
|
+
brand: (_brandResponse$data$f = (_brandResponse$data$f2 = brandResponse.data.find(brand => brand.article === article.articleNumber)) === null || _brandResponse$data$f2 === void 0 ? void 0 : _brandResponse$data$f2.articleBrandId) !== null && _brandResponse$data$f !== void 0 ? _brandResponse$data$f : _index2.DEFAULT_ARTICLE_BRAND
|
|
187
187
|
});
|
|
188
188
|
}).filter(article => article.brand);
|
|
189
189
|
const parts = articlesWithBrands.map(article => {
|
|
@@ -216,7 +216,8 @@ const enrichArticlesWithBrandsAndPrices = async (articles, branchId, formula) =>
|
|
|
216
216
|
};
|
|
217
217
|
exports.enrichArticlesWithBrandsAndPrices = enrichArticlesWithBrandsAndPrices;
|
|
218
218
|
const formatModelArticle = article => {
|
|
219
|
-
var _ref3, _article$name, _ref4, _article$description$, _article$description, _article$boldDescript, _article$boldDescript2, _article$specificatio, _article$images, _article$images2, _article$articleNumbe;
|
|
219
|
+
var _ref3, _article$name, _ref4, _article$description$, _article$description, _article$boldDescript, _article$boldDescript2, _article$specificatio, _article$images, _article$images2, _article$articleNumbe, _article$type, _article$group, _article$subgroup;
|
|
220
|
+
console.log('article', article);
|
|
220
221
|
return {
|
|
221
222
|
name: (_ref3 = (_article$name = article.name) !== null && _article$name !== void 0 ? _article$name : article === null || article === void 0 ? void 0 : article.title) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
222
223
|
description: (_ref4 = (_article$description$ = article === null || article === void 0 || (_article$description = article.description) === null || _article$description === void 0 || (_article$description = _article$description.ops) === null || _article$description === void 0 || (_article$description = _article$description[0]) === null || _article$description === void 0 ? void 0 : _article$description.insert) !== null && _article$description$ !== void 0 ? _article$description$ : article === null || article === void 0 ? void 0 : article.remark) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
@@ -225,11 +226,14 @@ const formatModelArticle = article => {
|
|
|
225
226
|
image: article !== null && article !== void 0 && (_article$images = article.images) !== null && _article$images !== void 0 && _article$images[0] ? (0, _image.getImageFromHyper)({
|
|
226
227
|
imageId: article === null || article === void 0 || (_article$images2 = article.images) === null || _article$images2 === void 0 ? void 0 : _article$images2[0]
|
|
227
228
|
}) : _logoPrimary.default,
|
|
228
|
-
articleNumber: (_article$articleNumbe = article.articleNumber) !== null && _article$articleNumbe !== void 0 ? _article$articleNumbe : ''
|
|
229
|
+
articleNumber: (_article$articleNumbe = article.articleNumber) !== null && _article$articleNumbe !== void 0 ? _article$articleNumbe : '',
|
|
230
|
+
type: article === null || article === void 0 || (_article$type = article.type) === null || _article$type === void 0 ? void 0 : _article$type.title,
|
|
231
|
+
group: article === null || article === void 0 || (_article$group = article.group) === null || _article$group === void 0 ? void 0 : _article$group.title,
|
|
232
|
+
subgroup: article === null || article === void 0 || (_article$subgroup = article.subgroup) === null || _article$subgroup === void 0 ? void 0 : _article$subgroup.title
|
|
229
233
|
};
|
|
230
234
|
};
|
|
231
235
|
const formatGenericArticle = article => {
|
|
232
|
-
var _article$images3, _article$images4, _article$articleNumbe2;
|
|
236
|
+
var _article$images3, _article$images4, _article$articleNumbe2, _article$type2, _article$group2, _article$subgroup2;
|
|
233
237
|
const specificationPairs = [['C2 module', article === null || article === void 0 ? void 0 : article.c2Module], ['Check control', article === null || article === void 0 ? void 0 : article.checkControl], ['Direct current', article === null || article === void 0 ? void 0 : article.directCurrent], ['Draw weight', article === null || article === void 0 ? void 0 : article.drawWeight], ['D value', article === null || article === void 0 ? void 0 : article.dValue], ['Foglight shutdown', article === null || article === void 0 ? void 0 : article.foglightShutdown], ['PDC shutdown', article === null || article === void 0 ? void 0 : article.pdcShutdown], ['Switched PSU', article === null || article === void 0 ? void 0 : article.switchedPsu], ['LED', article === null || article === void 0 ? void 0 : article.led]];
|
|
234
238
|
const specification = specificationPairs.filter(_ref5 => {
|
|
235
239
|
let [_, value] = _ref5;
|
|
@@ -246,6 +250,9 @@ const formatGenericArticle = article => {
|
|
|
246
250
|
image: article !== null && article !== void 0 && (_article$images3 = article.images) !== null && _article$images3 !== void 0 && _article$images3[0] ? (0, _image.getImageFromHyper)({
|
|
247
251
|
imageId: article === null || article === void 0 || (_article$images4 = article.images) === null || _article$images4 === void 0 ? void 0 : _article$images4[0]
|
|
248
252
|
}) : _logoPrimary.default,
|
|
249
|
-
articleNumber: (_article$articleNumbe2 = article.articleNumber) !== null && _article$articleNumbe2 !== void 0 ? _article$articleNumbe2 : ''
|
|
253
|
+
articleNumber: (_article$articleNumbe2 = article.articleNumber) !== null && _article$articleNumbe2 !== void 0 ? _article$articleNumbe2 : '',
|
|
254
|
+
type: article === null || article === void 0 || (_article$type2 = article.type) === null || _article$type2 === void 0 ? void 0 : _article$type2.title,
|
|
255
|
+
group: article === null || article === void 0 || (_article$group2 = article.group) === null || _article$group2 === void 0 ? void 0 : _article$group2.title,
|
|
256
|
+
subgroup: article === null || article === void 0 || (_article$subgroup2 = article.subgroup) === null || _article$subgroup2 === void 0 ? void 0 : _article$subgroup2.title
|
|
250
257
|
};
|
|
251
258
|
};
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
require("core-js/modules/es.weak-map.js");
|
|
4
4
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
5
|
require("core-js/modules/es.weak-map.js");
|
|
6
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
7
6
|
Object.defineProperty(exports, "__esModule", {
|
|
8
7
|
value: true
|
|
9
8
|
});
|
|
10
9
|
exports.default = void 0;
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _reactRouter = require("react-router");
|
|
13
13
|
var _queries = require("../../__api__/queries");
|
|
14
14
|
var _Header = _interopRequireDefault(require("../../__components__/Header"));
|
|
15
15
|
var _LocationsSelector = _interopRequireDefault(require("../../__components__/LocationsSelector"));
|
|
16
16
|
var _NavigationSteps = _interopRequireDefault(require("../../__components__/NavigationSteps"));
|
|
17
|
+
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
17
18
|
var _constants__ = require("../../__constants__");
|
|
18
19
|
var _BottomNavigationBar = _interopRequireDefault(require("../../__containers__/BottomNavigationBar"));
|
|
19
20
|
var _internal = require("../../__containers__/internal");
|
|
@@ -60,6 +61,10 @@ const InternalLocationsPage = _ref => {
|
|
|
60
61
|
const history = (0, _reactRouter.useHistory)();
|
|
61
62
|
const formula = (0, _FormulaContext.useFormula)();
|
|
62
63
|
const authSession = _LocalStorageWorker.lsw.getJson(_constants__.AUTH_SESSION_KEY);
|
|
64
|
+
const [{
|
|
65
|
+
allowLocationChange,
|
|
66
|
+
existingDossierId
|
|
67
|
+
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
63
68
|
(0, _react.useEffect)(() => {
|
|
64
69
|
var _branchTypes$byId$aut, _authSession$branch, _location$state;
|
|
65
70
|
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;
|
|
@@ -69,6 +74,10 @@ const InternalLocationsPage = _ref => {
|
|
|
69
74
|
return;
|
|
70
75
|
}
|
|
71
76
|
|
|
77
|
+
// if we are editing an existing dossier and allowLocationChange is truethy, allowthe user to edit the location
|
|
78
|
+
if (allowLocationChange && existingDossierId) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
72
81
|
// Step 2: skip this page if the branch type is not TowMotive Group
|
|
73
82
|
// If the previous page is appointment page ("gegevens") -> go back to overview ("overzicht")
|
|
74
83
|
// Otherwise: proceed to the appointment page ("gegevens")
|
|
@@ -120,7 +120,7 @@ const InternalSingleOrderPage = () => {
|
|
|
120
120
|
articleNumber: null,
|
|
121
121
|
model: null,
|
|
122
122
|
showAllArticles: false,
|
|
123
|
-
page:
|
|
123
|
+
page: 0
|
|
124
124
|
});
|
|
125
125
|
const customerFormRef = (0, _react.useRef)();
|
|
126
126
|
const {
|
|
@@ -170,7 +170,14 @@ const InternalSingleOrderPage = () => {
|
|
|
170
170
|
type: _OrderSessionContext.orderSessionActions.RESET_LICENSEPLATE_FILTERS
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
+
if (filter === 'page') {
|
|
174
|
+
setFilters(_objectSpread(_objectSpread({}, filters), {}, {
|
|
175
|
+
[filter]: value
|
|
176
|
+
}));
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
173
179
|
setFilters(_objectSpread(_objectSpread({}, filters), {}, {
|
|
180
|
+
page: 0,
|
|
174
181
|
[filter]: value
|
|
175
182
|
}));
|
|
176
183
|
}, [filters]);
|