thm-p3-configurator 0.0.176 → 0.0.178
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/__api__/authenticatedProxyApi.js +1 -1
- package/dist/src/shared/__api__/queries.js +1 -1
- package/dist/src/shared/__components__/ProductTable/index.js +13 -3
- package/dist/src/shared/__constants__/index.js +2 -1
- package/dist/src/shared/__containers__/ProductCartSide.js +6 -1
- package/dist/src/shared/__containers__/ProductsCartOverview.js +6 -1
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +12 -0
- package/dist/src/shared/__containers__/internal/InternalCancelDossierEdit.js +1 -1
- package/dist/src/shared/__helpers__/dossier.js +21 -10
- package/dist/src/shared/__pages__/internal/InternalAppointmentPage.js +0 -2
- package/dist/src/shared/__pages__/internal/InternalSessionEditPage.js +2 -2
- package/package.json +1 -1
|
@@ -174,7 +174,7 @@ const authenticatedProxyApi = exports.authenticatedProxyApi = {
|
|
|
174
174
|
payload,
|
|
175
175
|
id
|
|
176
176
|
} = _ref4;
|
|
177
|
-
return authenticateClient("api/v1/appointment-requests/".concat(id), {
|
|
177
|
+
return authenticateClient("api/v1/appointment-requests/".concat(id, "?action=order"), {
|
|
178
178
|
method: 'PUT',
|
|
179
179
|
data: payload,
|
|
180
180
|
headers: {
|
|
@@ -693,12 +693,12 @@ const usePrivateDossierByTypeAndIdQuery = _ref4 => {
|
|
|
693
693
|
enabled: !!dossierId && !!dossierType,
|
|
694
694
|
cacheTime: 0,
|
|
695
695
|
staleTime: 0,
|
|
696
|
+
retry: false,
|
|
696
697
|
refetchOnMount: true,
|
|
697
698
|
refetchOnWindowFocus: true,
|
|
698
699
|
refetchOnReconnect: true,
|
|
699
700
|
queryFn: () => {
|
|
700
701
|
let dossierFetchFn;
|
|
701
|
-
|
|
702
702
|
// Note: Get the handler of the dossier by its type
|
|
703
703
|
switch (dossierType) {
|
|
704
704
|
case _constants__.DOSSIER_TYPES.Quotation:
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.array.includes.js");
|
|
4
|
+
require("core-js/modules/es.string.includes.js");
|
|
3
5
|
require("core-js/modules/esnext.iterator.map.js");
|
|
4
6
|
Object.defineProperty(exports, "__esModule", {
|
|
5
7
|
value: true
|
|
6
8
|
});
|
|
7
9
|
exports.default = void 0;
|
|
10
|
+
require("core-js/modules/es.array.includes.js");
|
|
11
|
+
require("core-js/modules/es.string.includes.js");
|
|
8
12
|
require("core-js/modules/esnext.iterator.map.js");
|
|
9
13
|
var _react = _interopRequireDefault(require("react"));
|
|
10
14
|
var _helpers__ = require("../../__helpers__");
|
|
@@ -28,7 +32,8 @@ const ProductTable = _ref => {
|
|
|
28
32
|
canAlterQuantity = true
|
|
29
33
|
} = _ref;
|
|
30
34
|
const {
|
|
31
|
-
selectedBranch
|
|
35
|
+
selectedBranch,
|
|
36
|
+
allArticleNumbers
|
|
32
37
|
} = (0, _OrderSessionContext.useOrderSession)();
|
|
33
38
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
34
39
|
className: (0, _helpers__.withStyle)("content col-lg")
|
|
@@ -80,10 +85,15 @@ const ProductTable = _ref => {
|
|
|
80
85
|
title,
|
|
81
86
|
image,
|
|
82
87
|
price,
|
|
83
|
-
amount
|
|
88
|
+
amount,
|
|
89
|
+
articleNumber
|
|
84
90
|
} = _ref3;
|
|
91
|
+
let canProductBeAltered = canAlterQuantity;
|
|
92
|
+
if (!canAlterQuantity && !(allArticleNumbers !== null && allArticleNumbers !== void 0 && allArticleNumbers.includes(articleNumber))) {
|
|
93
|
+
canProductBeAltered = true;
|
|
94
|
+
}
|
|
85
95
|
return /*#__PURE__*/_react.default.createElement(_ProductTableEditableRow.default, {
|
|
86
|
-
canAlterQuantity:
|
|
96
|
+
canAlterQuantity: canProductBeAltered,
|
|
87
97
|
productTitle: title,
|
|
88
98
|
productImage: image,
|
|
89
99
|
extraCells: [{}, {}, {}, {
|
|
@@ -74,7 +74,8 @@ const PRODUCT_CATEGORIES = exports.PRODUCT_CATEGORIES = {
|
|
|
74
74
|
TOWBAR: 'Trekhaak',
|
|
75
75
|
CABLESET: 'Kabelset',
|
|
76
76
|
COMBISET: 'Combiset',
|
|
77
|
-
EXTRAS: 'Extras'
|
|
77
|
+
EXTRAS: 'Extras',
|
|
78
|
+
ALL_ARTICLE_NUMBERS: 'allArticleNumbers'
|
|
78
79
|
};
|
|
79
80
|
const NAVIGATION_BUTTONS = exports.NAVIGATION_BUTTONS = {
|
|
80
81
|
'/configurator/trekhaakpakket': [{
|
|
@@ -87,6 +87,7 @@ const ProductCartSide = () => {
|
|
|
87
87
|
selectedCableset,
|
|
88
88
|
selectedCombiset,
|
|
89
89
|
selectedBoardComputer,
|
|
90
|
+
allArticleNumbers,
|
|
90
91
|
selectedExtras,
|
|
91
92
|
canAlterQuantity,
|
|
92
93
|
selectedBranch
|
|
@@ -236,8 +237,12 @@ const ProductCartSide = () => {
|
|
|
236
237
|
} = getItemPrices(cartItem);
|
|
237
238
|
const quantity = selectedExtras[product.articleNumber] || 1;
|
|
238
239
|
const price = isToggled ? purchasePrice : salesPrice;
|
|
240
|
+
let canProductBeAltered = canAlterQuantity;
|
|
241
|
+
if (!canAlterQuantity && !(allArticleNumbers !== null && allArticleNumbers !== void 0 && allArticleNumbers.includes(product.articleNumber))) {
|
|
242
|
+
canProductBeAltered = true;
|
|
243
|
+
}
|
|
239
244
|
return /*#__PURE__*/_react.default.createElement(_ProductTableEditableRow.default, {
|
|
240
|
-
canAlterQuantity:
|
|
245
|
+
canAlterQuantity: canProductBeAltered,
|
|
241
246
|
key: product.articleNumber,
|
|
242
247
|
productTitle: product.name,
|
|
243
248
|
productImage: product !== null && product !== void 0 && (_product$images3 = product.images) !== null && _product$images3 !== void 0 && _product$images3[0] ? (0, _image.getImageFromHyper)({
|
|
@@ -138,6 +138,7 @@ const ProductCartTable = () => {
|
|
|
138
138
|
selectedBoardComputer,
|
|
139
139
|
selectedExtras,
|
|
140
140
|
executionAnswer1,
|
|
141
|
+
allArticleNumbers,
|
|
141
142
|
canAlterQuantity,
|
|
142
143
|
executionAnswer2,
|
|
143
144
|
discountAmount,
|
|
@@ -390,8 +391,12 @@ const ProductCartTable = () => {
|
|
|
390
391
|
margin,
|
|
391
392
|
marginPercentage
|
|
392
393
|
} = product.priceInfo;
|
|
394
|
+
let canProductBeAltered = canAlterQuantity;
|
|
395
|
+
if (!canAlterQuantity && !(allArticleNumbers !== null && allArticleNumbers !== void 0 && allArticleNumbers.includes(product.articleNumber))) {
|
|
396
|
+
canProductBeAltered = true;
|
|
397
|
+
}
|
|
393
398
|
return /*#__PURE__*/_react.default.createElement(_ProductTableEditableRow.default, {
|
|
394
|
-
canAlterQuantity:
|
|
399
|
+
canAlterQuantity: canProductBeAltered,
|
|
395
400
|
key: product.articleNumber,
|
|
396
401
|
productTitle: product.name,
|
|
397
402
|
productImage: product !== null && product !== void 0 && (_product$images3 = product.images) !== null && _product$images3 !== void 0 && _product$images3[0] ? (0, _image.getImageFromHyper)({
|
|
@@ -447,6 +447,18 @@ const InternalAppointmentForm = _ref => {
|
|
|
447
447
|
city: branchById === null || branchById === void 0 ? void 0 : branchById.city
|
|
448
448
|
}
|
|
449
449
|
});
|
|
450
|
+
dispatch({
|
|
451
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
|
|
452
|
+
payload: {
|
|
453
|
+
kvkNumber: branchById === null || branchById === void 0 ? void 0 : branchById.kvkNummer
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
dispatch({
|
|
457
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
|
|
458
|
+
payload: {
|
|
459
|
+
vatNumber: branchById === null || branchById === void 0 ? void 0 : branchById.vatNumber
|
|
460
|
+
}
|
|
461
|
+
});
|
|
450
462
|
dispatch({
|
|
451
463
|
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
|
|
452
464
|
payload: {
|
|
@@ -55,7 +55,7 @@ const InternalCancelDossierEdit = () => {
|
|
|
55
55
|
className: (0, _helpers__.withStyle)('col-12 col-md-8 mb-1 mb-md-0')
|
|
56
56
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
57
57
|
className: (0, _helpers__.withStyle)('mb-0')
|
|
58
|
-
}, ' ', "U bewerkt het dossier
|
|
58
|
+
}, ' ', "U bewerkt het dossier", ' ', /*#__PURE__*/_react.default.createElement("strong", null, dossierById === null || dossierById === void 0 ? void 0 : dossierById.title.split(' - ')[0], " - ", dossierById === null || dossierById === void 0 ? void 0 : dossierById.voornaam, ' ', dossierById === null || dossierById === void 0 ? void 0 : dossierById.tussenvoegsel, " ", dossierById === null || dossierById === void 0 ? void 0 : dossierById.achternaam, " -", ' ', dossierById === null || dossierById === void 0 ? void 0 : dossierById.vestiging.name))), /*#__PURE__*/_react.default.createElement("div", {
|
|
59
59
|
className: (0, _helpers__.withStyle)('col-12 col-md-4')
|
|
60
60
|
}, /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
|
|
61
61
|
type: "button",
|
|
@@ -8,7 +8,6 @@ require("core-js/modules/esnext.iterator.for-each.js");
|
|
|
8
8
|
require("core-js/modules/esnext.iterator.reduce.js");
|
|
9
9
|
require("core-js/modules/esnext.iterator.some.js");
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
12
11
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
13
12
|
Object.defineProperty(exports, "__esModule", {
|
|
14
13
|
value: true
|
|
@@ -16,6 +15,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
15
|
exports.parseDossierToOrderSession = exports.extractSessionProductsByOrder = void 0;
|
|
17
16
|
require("core-js/modules/es.array.reduce.js");
|
|
18
17
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
18
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
19
19
|
require("core-js/modules/esnext.iterator.find.js");
|
|
20
20
|
require("core-js/modules/esnext.iterator.reduce.js");
|
|
21
21
|
require("core-js/modules/esnext.iterator.some.js");
|
|
@@ -86,6 +86,7 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
|
|
|
86
86
|
execution1Options: [],
|
|
87
87
|
execution2Options: [],
|
|
88
88
|
selectedExtras: {},
|
|
89
|
+
allArticleNumbers: [],
|
|
89
90
|
// Note: there is no way to make which articles found in dossier.lines is towbar/cableset/comboset
|
|
90
91
|
// Therefore: we leave them empty now, and update the order when fetching the products again from the custom API
|
|
91
92
|
selectedTowbar: null,
|
|
@@ -152,10 +153,12 @@ const extractSessionProductsByOrder = _ref => {
|
|
|
152
153
|
},
|
|
153
154
|
boardComputerUpdate = {}
|
|
154
155
|
} = _ref;
|
|
155
|
-
return lines.reduce((acc, lineItem) => {
|
|
156
|
+
return lines.filter(line => line.activeArticle).reduce((acc, lineItem) => {
|
|
157
|
+
const allArticleNumbers = [...acc.allArticleNumbers, lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber];
|
|
156
158
|
if ((lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber) === (boardComputerUpdate === null || boardComputerUpdate === void 0 ? void 0 : boardComputerUpdate.articleNumber)) {
|
|
157
159
|
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
158
|
-
selectedBoardComputer: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber
|
|
160
|
+
selectedBoardComputer: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber,
|
|
161
|
+
allArticleNumbers
|
|
159
162
|
});
|
|
160
163
|
}
|
|
161
164
|
const orderProductEntries = Object.entries(orderProducts).find(_ref2 => {
|
|
@@ -166,19 +169,22 @@ const extractSessionProductsByOrder = _ref => {
|
|
|
166
169
|
case 'towbars':
|
|
167
170
|
{
|
|
168
171
|
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
169
|
-
selectedTowbar: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber
|
|
172
|
+
selectedTowbar: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber,
|
|
173
|
+
allArticleNumbers
|
|
170
174
|
});
|
|
171
175
|
}
|
|
172
176
|
case 'cablesets':
|
|
173
177
|
{
|
|
174
178
|
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
175
|
-
selectedCableset: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber
|
|
179
|
+
selectedCableset: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber,
|
|
180
|
+
allArticleNumbers
|
|
176
181
|
});
|
|
177
182
|
}
|
|
178
183
|
case 'combisets':
|
|
179
184
|
{
|
|
180
185
|
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
181
|
-
selectedCombiset: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber
|
|
186
|
+
selectedCombiset: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber,
|
|
187
|
+
allArticleNumbers
|
|
182
188
|
});
|
|
183
189
|
}
|
|
184
190
|
case 'extras':
|
|
@@ -187,7 +193,8 @@ const extractSessionProductsByOrder = _ref => {
|
|
|
187
193
|
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
188
194
|
selectedExtras: _objectSpread(_objectSpread({}, (_acc$selectedExtras = acc === null || acc === void 0 ? void 0 : acc.selectedExtras) !== null && _acc$selectedExtras !== void 0 ? _acc$selectedExtras : {}), {}, {
|
|
189
195
|
[lineItem.articleNumber]: lineItem.quantity
|
|
190
|
-
})
|
|
196
|
+
}),
|
|
197
|
+
allArticleNumbers
|
|
191
198
|
});
|
|
192
199
|
}
|
|
193
200
|
case 'discountCode':
|
|
@@ -196,13 +203,16 @@ const extractSessionProductsByOrder = _ref => {
|
|
|
196
203
|
selectedDiscountedProducts: [...(acc === null || acc === void 0 ? void 0 : acc.selectedDiscountedProducts), {
|
|
197
204
|
articleNumber: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber,
|
|
198
205
|
quantity: lineItem === null || lineItem === void 0 ? void 0 : lineItem.quantity
|
|
199
|
-
}]
|
|
206
|
+
}],
|
|
207
|
+
allArticleNumbers
|
|
200
208
|
});
|
|
201
209
|
}
|
|
202
210
|
default:
|
|
203
211
|
{
|
|
204
212
|
console.error('Missing category for item: ', lineItem);
|
|
205
|
-
return acc
|
|
213
|
+
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
214
|
+
allArticleNumbers
|
|
215
|
+
});
|
|
206
216
|
}
|
|
207
217
|
}
|
|
208
218
|
}, {
|
|
@@ -211,7 +221,8 @@ const extractSessionProductsByOrder = _ref => {
|
|
|
211
221
|
selectedCombiset: null,
|
|
212
222
|
selectedBoardComputer: null,
|
|
213
223
|
selectedExtras: {},
|
|
214
|
-
selectedDiscountedProducts: []
|
|
224
|
+
selectedDiscountedProducts: [],
|
|
225
|
+
allArticleNumbers: []
|
|
215
226
|
});
|
|
216
227
|
};
|
|
217
228
|
exports.extractSessionProductsByOrder = extractSessionProductsByOrder;
|
|
@@ -59,14 +59,12 @@ const InternalAppointmentPage = () => {
|
|
|
59
59
|
if (payload !== null && payload !== void 0 && payload.appointmentType && payload.appointmentType === _constants__.DOSSIER_TYPES.PlannedAppointment) {
|
|
60
60
|
if (existingDossierId) {
|
|
61
61
|
await updateAppointment(payload);
|
|
62
|
-
queryClient.invalidateQueries([_constants__.DOSSIER_TYPES.PlannedAppointment, existingDossierId]);
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
65
64
|
await createPlannedAppointment(payload);
|
|
66
65
|
} else {
|
|
67
66
|
if (existingDossierId) {
|
|
68
67
|
await updateAppointmentRequest(payload);
|
|
69
|
-
queryClient.invalidateQueries([_constants__.DOSSIER_TYPES.AppointmentRequest, existingDossierId]);
|
|
70
68
|
return;
|
|
71
69
|
}
|
|
72
70
|
await createAppointmentRequest(payload);
|
|
@@ -111,7 +111,7 @@ function _toPrimitive(t, r) {
|
|
|
111
111
|
}
|
|
112
112
|
const InternalSessionEditPage = props => {
|
|
113
113
|
var _props$match;
|
|
114
|
-
const [dossierType] = (0, _useSearchParam.default)(['dossierType']); // Note: this is of type `DOSSIER_TYPES` (found in __constants__ folder)
|
|
114
|
+
const [dossiertype, dossierType] = (0, _useSearchParam.default)(['dossiertype', 'dossierType']); // Note: this is of type `DOSSIER_TYPES` (found in __constants__ folder)
|
|
115
115
|
|
|
116
116
|
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
117
117
|
const formula = (0, _FormulaContext.useFormula)();
|
|
@@ -121,7 +121,7 @@ const InternalSessionEditPage = props => {
|
|
|
121
121
|
isDossierByIdError
|
|
122
122
|
} = (0, _queries.usePrivateDossierByTypeAndIdQuery)({
|
|
123
123
|
dossierId: props === null || props === void 0 || (_props$match = props.match) === null || _props$match === void 0 || (_props$match = _props$match.params) === null || _props$match === void 0 ? void 0 : _props$match.id,
|
|
124
|
-
dossierType: dossierType
|
|
124
|
+
dossierType: dossierType ? dossierType : dossiertype
|
|
125
125
|
});
|
|
126
126
|
const [_, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
127
127
|
const history = (0, _reactRouter.useHistory)();
|