thm-p3-configurator 0.0.229 → 0.0.231
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 +7 -0
- package/dist/src/shared/__api__/mutations.js +58 -16
- package/dist/src/shared/__api__/queries.js +50 -7
- package/dist/src/shared/__components__/SingleOrderProductCard.js +14 -9
- package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +20 -8
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +21 -5
- package/dist/src/shared/__containers__/internal/InternalBranchSelectorModal.js +15 -10
- package/dist/src/shared/__containers__/internal/InternalSingleOrderProductOverview.js +20 -6
- package/dist/src/shared/__containers__/internal/OrderTypeSelectorModal.js +136 -0
- package/dist/src/shared/__context__/OrderSessionContext.js +43 -4
- package/dist/src/shared/__pages__/internal/InternalSingleOrderPage.js +58 -26
- package/package.json +1 -1
|
@@ -136,6 +136,13 @@ const authenticatedProxyApi = exports.authenticatedProxyApi = {
|
|
|
136
136
|
'Content-Type': 'application/json'
|
|
137
137
|
}
|
|
138
138
|
}),
|
|
139
|
+
postShopifyOrder: shopifyOrderPayload => authenticateClient("api/v1/single-orders/shopify", {
|
|
140
|
+
method: 'POST',
|
|
141
|
+
data: shopifyOrderPayload,
|
|
142
|
+
headers: {
|
|
143
|
+
'Content-Type': 'application/json'
|
|
144
|
+
}
|
|
145
|
+
}),
|
|
139
146
|
postAppointment: appointmentPayload => authenticateClient("api/v1/appointments", {
|
|
140
147
|
method: 'POST',
|
|
141
148
|
data: appointmentPayload,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useUpdatePrivateQuotationByIdMutation = exports.useUpdatePrivateAppointmentRequestByIdMutation = exports.useUpdatePrivateAppointmentByIdMutation = exports.useCreateSingleOrderMutation = exports.useCreateQuotationMutation = exports.useCreatePrivateQuotationMutation = exports.useCreatePrivateAppointmentRequestMutation = exports.useCreatePrivateAppointmentMutation = exports.useCreateAppointmentRequestMutation = void 0;
|
|
6
|
+
exports.useUpdatePrivateQuotationByIdMutation = exports.useUpdatePrivateAppointmentRequestByIdMutation = exports.useUpdatePrivateAppointmentByIdMutation = exports.useCreateSingleOrderMutation = exports.useCreateShopifyOrderMutation = exports.useCreateQuotationMutation = exports.useCreatePrivateQuotationMutation = exports.useCreatePrivateAppointmentRequestMutation = exports.useCreatePrivateAppointmentMutation = exports.useCreateAppointmentRequestMutation = void 0;
|
|
7
7
|
var _reactQuery = require("react-query");
|
|
8
8
|
var _authenticatedProxyApi = require("./authenticatedProxyApi");
|
|
9
9
|
var _publicProxyApi = require("./publicProxyApi");
|
|
@@ -128,13 +128,53 @@ const useCreateSingleOrderMutation = () => {
|
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @description Creates a Shopify order for webshop orders
|
|
133
|
+
*/
|
|
134
|
+
exports.useCreateSingleOrderMutation = useCreateSingleOrderMutation;
|
|
135
|
+
const useCreateShopifyOrderMutation = () => {
|
|
136
|
+
const createShopifyOrderMutation = (0, _reactQuery.useMutation)(_ref4 => {
|
|
137
|
+
let {
|
|
138
|
+
licensePlate,
|
|
139
|
+
model,
|
|
140
|
+
cart,
|
|
141
|
+
customer,
|
|
142
|
+
channel,
|
|
143
|
+
formula,
|
|
144
|
+
branchId,
|
|
145
|
+
vehicle,
|
|
146
|
+
internalNote,
|
|
147
|
+
webshop
|
|
148
|
+
} = _ref4;
|
|
149
|
+
return _authenticatedProxyApi.authenticatedProxyApi.postShopifyOrder({
|
|
150
|
+
licensePlate,
|
|
151
|
+
model,
|
|
152
|
+
cart,
|
|
153
|
+
customer,
|
|
154
|
+
channel,
|
|
155
|
+
formula,
|
|
156
|
+
branchId,
|
|
157
|
+
vehicle,
|
|
158
|
+
internalNote,
|
|
159
|
+
webshop
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
isCreatingShopifyOrder: createShopifyOrderMutation.isLoading,
|
|
164
|
+
isCreateShopifyOrderError: createShopifyOrderMutation.isError,
|
|
165
|
+
isCreateShopifyOrderSuccess: createShopifyOrderMutation.isSuccess,
|
|
166
|
+
resetShopifyOrderCreation: createShopifyOrderMutation.reset,
|
|
167
|
+
createShopifyOrder: createShopifyOrderMutation.mutate
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
|
|
131
171
|
/**
|
|
132
172
|
* @description Creates a quotation within the private order API
|
|
133
173
|
* Signs the request with the accessToken
|
|
134
174
|
*/
|
|
135
|
-
exports.
|
|
175
|
+
exports.useCreateShopifyOrderMutation = useCreateShopifyOrderMutation;
|
|
136
176
|
const useCreatePrivateQuotationMutation = () => {
|
|
137
|
-
const createQuotationMutation = (0, _reactQuery.useMutation)(
|
|
177
|
+
const createQuotationMutation = (0, _reactQuery.useMutation)(_ref5 => {
|
|
138
178
|
let {
|
|
139
179
|
vehicle,
|
|
140
180
|
customer,
|
|
@@ -149,7 +189,7 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
149
189
|
formula,
|
|
150
190
|
discount,
|
|
151
191
|
isExitIntent = false
|
|
152
|
-
} =
|
|
192
|
+
} = _ref5;
|
|
153
193
|
return _authenticatedProxyApi.authenticatedProxyApi.postQuotation({
|
|
154
194
|
isExitIntent,
|
|
155
195
|
model,
|
|
@@ -181,7 +221,7 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
181
221
|
*/
|
|
182
222
|
exports.useCreatePrivateQuotationMutation = useCreatePrivateQuotationMutation;
|
|
183
223
|
const useCreatePrivateAppointmentMutation = () => {
|
|
184
|
-
const createPlannedAppointmentMutation = (0, _reactQuery.useMutation)(
|
|
224
|
+
const createPlannedAppointmentMutation = (0, _reactQuery.useMutation)(_ref6 => {
|
|
185
225
|
let {
|
|
186
226
|
vehicle,
|
|
187
227
|
customer,
|
|
@@ -196,8 +236,9 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
196
236
|
branchId,
|
|
197
237
|
formula,
|
|
198
238
|
discount,
|
|
199
|
-
customerAgreed
|
|
200
|
-
|
|
239
|
+
customerAgreed,
|
|
240
|
+
invoicePaymentByLeaseCompany
|
|
241
|
+
} = _ref6;
|
|
201
242
|
return _authenticatedProxyApi.authenticatedProxyApi.postAppointment({
|
|
202
243
|
appointment,
|
|
203
244
|
model,
|
|
@@ -212,7 +253,8 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
212
253
|
selectBoardComputerUpdate,
|
|
213
254
|
customer: customer,
|
|
214
255
|
branchId,
|
|
215
|
-
customerAgreed
|
|
256
|
+
customerAgreed,
|
|
257
|
+
invoicePaymentByLeaseCompany
|
|
216
258
|
});
|
|
217
259
|
});
|
|
218
260
|
return {
|
|
@@ -230,7 +272,7 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
230
272
|
*/
|
|
231
273
|
exports.useCreatePrivateAppointmentMutation = useCreatePrivateAppointmentMutation;
|
|
232
274
|
const useCreatePrivateAppointmentRequestMutation = () => {
|
|
233
|
-
const createAppointmentRequestMutation = (0, _reactQuery.useMutation)(
|
|
275
|
+
const createAppointmentRequestMutation = (0, _reactQuery.useMutation)(_ref7 => {
|
|
234
276
|
let {
|
|
235
277
|
vehicle,
|
|
236
278
|
customer,
|
|
@@ -246,7 +288,7 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
246
288
|
formula,
|
|
247
289
|
discount,
|
|
248
290
|
customerAgreed
|
|
249
|
-
} =
|
|
291
|
+
} = _ref7;
|
|
250
292
|
return _authenticatedProxyApi.authenticatedProxyApi.postAppointmentRequest({
|
|
251
293
|
appointment,
|
|
252
294
|
model,
|
|
@@ -279,7 +321,7 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
279
321
|
*/
|
|
280
322
|
exports.useCreatePrivateAppointmentRequestMutation = useCreatePrivateAppointmentRequestMutation;
|
|
281
323
|
const useUpdatePrivateAppointmentRequestByIdMutation = id => {
|
|
282
|
-
const updateAppointmentRequestByIdMutation = (0, _reactQuery.useMutation)(
|
|
324
|
+
const updateAppointmentRequestByIdMutation = (0, _reactQuery.useMutation)(_ref8 => {
|
|
283
325
|
let {
|
|
284
326
|
vehicle,
|
|
285
327
|
customer,
|
|
@@ -296,7 +338,7 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
|
|
|
296
338
|
discount,
|
|
297
339
|
priceCalculationDate,
|
|
298
340
|
customerAgreed
|
|
299
|
-
} =
|
|
341
|
+
} = _ref8;
|
|
300
342
|
return _authenticatedProxyApi.authenticatedProxyApi.putAppointmentRequestById({
|
|
301
343
|
id,
|
|
302
344
|
payload: {
|
|
@@ -333,7 +375,7 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
|
|
|
333
375
|
*/
|
|
334
376
|
exports.useUpdatePrivateAppointmentRequestByIdMutation = useUpdatePrivateAppointmentRequestByIdMutation;
|
|
335
377
|
const useUpdatePrivateQuotationByIdMutation = id => {
|
|
336
|
-
const updateQuotationMutation = (0, _reactQuery.useMutation)(
|
|
378
|
+
const updateQuotationMutation = (0, _reactQuery.useMutation)(_ref9 => {
|
|
337
379
|
let {
|
|
338
380
|
vehicle,
|
|
339
381
|
customer,
|
|
@@ -347,7 +389,7 @@ const useUpdatePrivateQuotationByIdMutation = id => {
|
|
|
347
389
|
formula,
|
|
348
390
|
discount,
|
|
349
391
|
priceCalculationDate
|
|
350
|
-
} =
|
|
392
|
+
} = _ref9;
|
|
351
393
|
return _authenticatedProxyApi.authenticatedProxyApi.putQuotationById({
|
|
352
394
|
id,
|
|
353
395
|
payload: {
|
|
@@ -381,7 +423,7 @@ const useUpdatePrivateQuotationByIdMutation = id => {
|
|
|
381
423
|
*/
|
|
382
424
|
exports.useUpdatePrivateQuotationByIdMutation = useUpdatePrivateQuotationByIdMutation;
|
|
383
425
|
const useUpdatePrivateAppointmentByIdMutation = id => {
|
|
384
|
-
const updateAppointmentByIdMutation = (0, _reactQuery.useMutation)(
|
|
426
|
+
const updateAppointmentByIdMutation = (0, _reactQuery.useMutation)(_ref10 => {
|
|
385
427
|
let {
|
|
386
428
|
vehicle,
|
|
387
429
|
customer,
|
|
@@ -398,7 +440,7 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
|
|
|
398
440
|
discount,
|
|
399
441
|
priceCalculationDate,
|
|
400
442
|
customerAgreed
|
|
401
|
-
} =
|
|
443
|
+
} = _ref10;
|
|
402
444
|
return _authenticatedProxyApi.authenticatedProxyApi.putAppointmentById({
|
|
403
445
|
id,
|
|
404
446
|
payload: {
|
|
@@ -7,6 +7,7 @@ require("core-js/modules/es.promise.js");
|
|
|
7
7
|
require("core-js/modules/es.regexp.to-string.js");
|
|
8
8
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
9
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
10
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
10
11
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
11
12
|
require("core-js/modules/esnext.iterator.map.js");
|
|
12
13
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -22,6 +23,7 @@ require("core-js/modules/es.object.from-entries.js");
|
|
|
22
23
|
require("core-js/modules/es.promise.js");
|
|
23
24
|
require("core-js/modules/es.regexp.to-string.js");
|
|
24
25
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
26
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
25
27
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
26
28
|
require("core-js/modules/esnext.iterator.map.js");
|
|
27
29
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -246,9 +248,10 @@ const useSingleOrderArticles = exports.useSingleOrderArticles = function useSing
|
|
|
246
248
|
let filters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
247
249
|
let formula = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
248
250
|
let branchId = arguments.length > 2 ? arguments[2] : undefined;
|
|
249
|
-
|
|
251
|
+
let webshop = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
252
|
+
const articlesQuery = (0, _reactQuery.useQuery)(['singleOrderArticles', filters, branchId, webshop], {
|
|
250
253
|
queryFn: async () => {
|
|
251
|
-
if (!branchId) {
|
|
254
|
+
if (!branchId && !webshop) {
|
|
252
255
|
return {
|
|
253
256
|
articles: [],
|
|
254
257
|
totalArticles: 0
|
|
@@ -284,7 +287,13 @@ const useSingleOrderArticles = exports.useSingleOrderArticles = function useSing
|
|
|
284
287
|
totalArticles: 0
|
|
285
288
|
};
|
|
286
289
|
}
|
|
287
|
-
|
|
290
|
+
let currentArticles;
|
|
291
|
+
if (branchId) {
|
|
292
|
+
currentArticles = await (0, _singleOrderArticles.enrichArticlesWithBrandsAndPrices)(articles, branchId, formula);
|
|
293
|
+
} else {
|
|
294
|
+
// If webshop is selected (online order), use formula 'THC' to fetch standard prices
|
|
295
|
+
currentArticles = await (0, _singleOrderArticles.enrichArticlesWithBrandsAndPrices)(articles, null, 'THL');
|
|
296
|
+
}
|
|
288
297
|
return {
|
|
289
298
|
articles: currentArticles,
|
|
290
299
|
totalArticles: totalCount
|
|
@@ -319,7 +328,8 @@ exports.useCountriesQuery = useCountriesQuery;
|
|
|
319
328
|
const useSingleOrderCart = () => {
|
|
320
329
|
const [{
|
|
321
330
|
singleOrderCart,
|
|
322
|
-
singleOrderFormulaCode
|
|
331
|
+
singleOrderFormulaCode,
|
|
332
|
+
webshop
|
|
323
333
|
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
324
334
|
|
|
325
335
|
// Create lookup map for cart totals
|
|
@@ -355,15 +365,48 @@ const useSingleOrderCart = () => {
|
|
|
355
365
|
isSingle: true,
|
|
356
366
|
cart: JSON.stringify(singleOrderCart)
|
|
357
367
|
})).toString();
|
|
358
|
-
const cartQuery = (0, _reactQuery.useQuery)(['singleOrderCart', cartOrderQuery], {
|
|
368
|
+
const cartQuery = (0, _reactQuery.useQuery)(['singleOrderCart', cartOrderQuery, webshop], {
|
|
359
369
|
queryFn: async () => {
|
|
360
|
-
var _articles$
|
|
370
|
+
var _articles$articles2;
|
|
361
371
|
if (!singleOrderCart.length) {
|
|
362
372
|
return {
|
|
363
373
|
articles: [],
|
|
364
374
|
totals: []
|
|
365
375
|
};
|
|
366
376
|
}
|
|
377
|
+
|
|
378
|
+
// If webshop is selected, use Shopify prices directly without API call
|
|
379
|
+
if (webshop) {
|
|
380
|
+
var _articles$articles;
|
|
381
|
+
const articles = await (0, _singleOrderArticles.fetchArticlesByArticleNumbers)(singleOrderCart.map(article => article.articleNumber));
|
|
382
|
+
const articlesWithPrice = articles === null || articles === void 0 || (_articles$articles = articles.articles) === null || _articles$articles === void 0 ? void 0 : _articles$articles.map(article => {
|
|
383
|
+
const cartItem = singleOrderCart.find(item => item.articleNumber === article.articleNumber);
|
|
384
|
+
const totals = cartTotalsLookup[article.articleNumber];
|
|
385
|
+
return _objectSpread(_objectSpread({}, article), {}, {
|
|
386
|
+
price: cartItem !== null && cartItem !== void 0 && cartItem.productPriceInclVat ? Math.round(Number(cartItem === null || cartItem === void 0 ? void 0 : cartItem.productPriceInclVat) * 100) / 100 : 0,
|
|
387
|
+
quantity: Number(cartItem === null || cartItem === void 0 ? void 0 : cartItem.quantity),
|
|
388
|
+
// Add the calculated totals using Shopify prices
|
|
389
|
+
productBtw: totals === null || totals === void 0 ? void 0 : totals.productBtw,
|
|
390
|
+
productTotalExclVat: totals === null || totals === void 0 ? void 0 : totals.productTotalExclVat,
|
|
391
|
+
productTotalInclVat: totals === null || totals === void 0 ? void 0 : totals.productTotalInclVat,
|
|
392
|
+
productPrice: totals === null || totals === void 0 ? void 0 : totals.productPrice,
|
|
393
|
+
productPriceInclVat: totals === null || totals === void 0 ? void 0 : totals.productPriceInclVat,
|
|
394
|
+
individualPriceInclVat: totals === null || totals === void 0 ? void 0 : totals.individualPriceInclVat,
|
|
395
|
+
individualPriceExclVat: totals === null || totals === void 0 ? void 0 : totals.individualPriceExclVat
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
return {
|
|
399
|
+
articles: articlesWithPrice,
|
|
400
|
+
totals: {
|
|
401
|
+
totalQuantity: Math.round(totalQuantity * 100) / 100,
|
|
402
|
+
totalBtw: Math.round(totalBtw * 100) / 100,
|
|
403
|
+
totalExclVat: Math.round(totalExclVat * 100) / 100,
|
|
404
|
+
totalInclVat: Math.round(totalInclVat * 100) / 100
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Original logic for non-webshop orders
|
|
367
410
|
const orderResults = await _authenticatedProxyApi.authenticatedProxyApi.getOrder(cartOrderQuery).then(res => res.data);
|
|
368
411
|
if (!orderResults.data.cart) {
|
|
369
412
|
return {
|
|
@@ -373,7 +416,7 @@ const useSingleOrderCart = () => {
|
|
|
373
416
|
const cart = orderResults.data.cart;
|
|
374
417
|
const articles = await (0, _singleOrderArticles.fetchArticlesByArticleNumbers)(cart.map(article => article.articleNumber));
|
|
375
418
|
const cartLookup = Object.fromEntries(cart.map(item => [item.articleNumber, item]));
|
|
376
|
-
const articlesWithPrice = articles === null || articles === void 0 || (_articles$
|
|
419
|
+
const articlesWithPrice = articles === null || articles === void 0 || (_articles$articles2 = articles.articles) === null || _articles$articles2 === void 0 ? void 0 : _articles$articles2.map(article => {
|
|
377
420
|
const cartItem = cartLookup[article.articleNumber];
|
|
378
421
|
const totals = cartTotalsLookup[article.articleNumber];
|
|
379
422
|
return _objectSpread(_objectSpread({}, article), {}, {
|
|
@@ -85,21 +85,22 @@ const ProductActions = _ref2 => {
|
|
|
85
85
|
productPrice,
|
|
86
86
|
showPartStockLevel,
|
|
87
87
|
setShowPartStockLevel,
|
|
88
|
-
productPriceInclVat
|
|
88
|
+
productPriceInclVat,
|
|
89
|
+
isWebshop = false
|
|
89
90
|
} = _ref2;
|
|
90
91
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
91
92
|
className: (0, _helpers__.withStyle)('d-flex justify-content-end')
|
|
92
93
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
93
94
|
className: (0, _helpers__.withStyle)('d-flex flex-column align-items-end')
|
|
94
|
-
}, isOutOfStock ? /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
}, !isWebshop && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isOutOfStock ? /*#__PURE__*/_react.default.createElement("div", {
|
|
95
96
|
className: (0, _helpers__.withStyle)('text-danger mb-1')
|
|
96
97
|
}, "Niet op voorraad") : stock === _constants__.StockStatus.InsufficientStock ? /*#__PURE__*/_react.default.createElement("div", {
|
|
97
98
|
className: (0, _helpers__.withStyle)('text-warning mb-1')
|
|
98
99
|
}, isTmg ? "".concat(stock, " op voorraad") : 'Weinig op voorraad') : /*#__PURE__*/_react.default.createElement("div", {
|
|
99
100
|
className: (0, _helpers__.withStyle)('text-success mb-1')
|
|
100
|
-
}, isTmg ? "".concat(stock, " op voorraad") : 'Op voorraad'), /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
}, isTmg ? "".concat(stock, " op voorraad") : 'Op voorraad')), /*#__PURE__*/_react.default.createElement("div", {
|
|
101
102
|
className: (0, _helpers__.withStyle)('d-flex align-items-center')
|
|
102
|
-
}, /*#__PURE__*/_react.default.createElement(_OutlinedButton.default, {
|
|
103
|
+
}, !isWebshop && /*#__PURE__*/_react.default.createElement(_OutlinedButton.default, {
|
|
103
104
|
style: {
|
|
104
105
|
marginRight: '1rem'
|
|
105
106
|
},
|
|
@@ -129,7 +130,8 @@ const ProductCategories = _ref3 => {
|
|
|
129
130
|
preferredPart = null,
|
|
130
131
|
partStockLevels = null,
|
|
131
132
|
showPartStockLevel = false,
|
|
132
|
-
brandName = null
|
|
133
|
+
brandName = null,
|
|
134
|
+
isWebshop = false
|
|
133
135
|
} = _ref3;
|
|
134
136
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
135
137
|
className: (0, _helpers__.withStyle)('col-md-6')
|
|
@@ -143,7 +145,7 @@ const ProductCategories = _ref3 => {
|
|
|
143
145
|
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
144
146
|
}, /*#__PURE__*/_react.default.createElement("strong", null, "Subgroep:"), " ", productSubgroup), preferredPart && /*#__PURE__*/_react.default.createElement("p", {
|
|
145
147
|
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
146
|
-
}, /*#__PURE__*/_react.default.createElement("strong", null, "Voorkeur onderdeel:"), " ", preferredPart.preferredPart), showPartStockLevel && (partStockLevels === null || partStockLevels === void 0 ? void 0 : partStockLevels.status) && /*#__PURE__*/_react.default.createElement("p", {
|
|
148
|
+
}, /*#__PURE__*/_react.default.createElement("strong", null, "Voorkeur onderdeel:"), " ", preferredPart.preferredPart), !isWebshop && showPartStockLevel && (partStockLevels === null || partStockLevels === void 0 ? void 0 : partStockLevels.status) && /*#__PURE__*/_react.default.createElement("p", {
|
|
147
149
|
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
148
150
|
}, /*#__PURE__*/_react.default.createElement("small", {
|
|
149
151
|
className: (0, _helpers__.withStyle)(partStockLevels.status === _constants__.StockStatus.OutOfStock ? 'text-danger' : partStockLevels.status === _constants__.StockStatus.InsufficientStock ? 'text-warning' : 'text-success')
|
|
@@ -174,7 +176,8 @@ const SingleOrderProductCard = _ref4 => {
|
|
|
174
176
|
isTmg = false,
|
|
175
177
|
parts = [],
|
|
176
178
|
branchId,
|
|
177
|
-
brandName = null
|
|
179
|
+
brandName = null,
|
|
180
|
+
isWebshop = false
|
|
178
181
|
} = _ref4;
|
|
179
182
|
const {
|
|
180
183
|
productFieldLabels
|
|
@@ -246,7 +249,8 @@ const SingleOrderProductCard = _ref4 => {
|
|
|
246
249
|
articleNumber: articleNumber,
|
|
247
250
|
preferredPart: preferredPart,
|
|
248
251
|
partStockLevels: partStockLevels,
|
|
249
|
-
showPartStockLevel: showPartStockLevel
|
|
252
|
+
showPartStockLevel: showPartStockLevel,
|
|
253
|
+
isWebshop: isWebshop
|
|
250
254
|
}), (filteredProductSpecifications === null || filteredProductSpecifications === void 0 ? void 0 : filteredProductSpecifications.length) > 0 && /*#__PURE__*/_react.default.createElement(_ProductCardSpecifications.default, {
|
|
251
255
|
specifications: filteredProductSpecifications,
|
|
252
256
|
className: isModelArticle ? '' : 'w-100'
|
|
@@ -265,7 +269,8 @@ const SingleOrderProductCard = _ref4 => {
|
|
|
265
269
|
handleSelected: handleSelected,
|
|
266
270
|
removeFromCart: removeFromCart,
|
|
267
271
|
productPrice: productPrice,
|
|
268
|
-
productPriceInclVat: productPriceInclVat
|
|
272
|
+
productPriceInclVat: productPriceInclVat,
|
|
273
|
+
isWebshop: isWebshop
|
|
269
274
|
})))));
|
|
270
275
|
};
|
|
271
276
|
var _default = exports.default = SingleOrderProductCard;
|
|
@@ -137,7 +137,8 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
137
137
|
selectedBranch,
|
|
138
138
|
appointment,
|
|
139
139
|
internalNote,
|
|
140
|
-
vehicle
|
|
140
|
+
vehicle,
|
|
141
|
+
webshop
|
|
141
142
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
142
143
|
const {
|
|
143
144
|
branchById
|
|
@@ -205,7 +206,18 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
205
206
|
};
|
|
206
207
|
const validateForm = async () => {
|
|
207
208
|
try {
|
|
208
|
-
|
|
209
|
+
let validationSchema = webshop ? customerDetailsFormSchema.omit(['channelType', 'channelId']) : customerDetailsFormSchema;
|
|
210
|
+
|
|
211
|
+
// For webshop orders, make certain customer fields required
|
|
212
|
+
if (webshop) {
|
|
213
|
+
validationSchema = validationSchema.shape({
|
|
214
|
+
firstName: (0, _yup.string)().required('Voornaam is verplicht'),
|
|
215
|
+
lastName: (0, _yup.string)().required('Achternaam is verplicht'),
|
|
216
|
+
email: (0, _yup.string)().required('E-mailadres is verplicht').email('E-mailadres is ongeldig'),
|
|
217
|
+
phoneNumber: (0, _yup.string)().required('Telefoonnummer is verplicht')
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
await validationSchema.validate(_objectSpread(_objectSpread({}, customer), {}, {
|
|
209
221
|
channelType: (channel === null || channel === void 0 ? void 0 : channel.channelType) || '',
|
|
210
222
|
channelId: (channel === null || channel === void 0 ? void 0 : channel.channelId) || ''
|
|
211
223
|
}), {
|
|
@@ -237,7 +249,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
237
249
|
label: 'Vestiginggegevens invullen?',
|
|
238
250
|
onClick: handleAutofillButtonClicked,
|
|
239
251
|
isDisabled: !branchById
|
|
240
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
252
|
+
})), !webshop && /*#__PURE__*/_react.default.createElement("div", {
|
|
241
253
|
className: (0, _helpers__.withStyle)('col-12 mb-2')
|
|
242
254
|
}, /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
243
255
|
options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
|
|
@@ -294,7 +306,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
294
306
|
firstName: value
|
|
295
307
|
}
|
|
296
308
|
}),
|
|
297
|
-
isRequired:
|
|
309
|
+
isRequired: webshop,
|
|
298
310
|
form: form,
|
|
299
311
|
label: "Voornaam:",
|
|
300
312
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['firstName']
|
|
@@ -324,7 +336,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
324
336
|
lastName: value
|
|
325
337
|
}
|
|
326
338
|
}),
|
|
327
|
-
isRequired:
|
|
339
|
+
isRequired: webshop,
|
|
328
340
|
form: form,
|
|
329
341
|
label: "Achternaam:",
|
|
330
342
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['lastName']
|
|
@@ -339,7 +351,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
339
351
|
email: value
|
|
340
352
|
}
|
|
341
353
|
}),
|
|
342
|
-
isRequired:
|
|
354
|
+
isRequired: webshop,
|
|
343
355
|
form: form,
|
|
344
356
|
label: "E-mailadres:",
|
|
345
357
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['email']
|
|
@@ -355,7 +367,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
355
367
|
}
|
|
356
368
|
}),
|
|
357
369
|
form: form,
|
|
358
|
-
isRequired:
|
|
370
|
+
isRequired: webshop,
|
|
359
371
|
label: "Telefoonnummer:",
|
|
360
372
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber']
|
|
361
373
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
@@ -418,7 +430,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
418
430
|
form: form,
|
|
419
431
|
label: "Stad:",
|
|
420
432
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['city']
|
|
421
|
-
})))), /*#__PURE__*/_react.default.createElement("div", {
|
|
433
|
+
})))), !webshop && /*#__PURE__*/_react.default.createElement("div", {
|
|
422
434
|
className: (0, _helpers__.withStyle)('col-12')
|
|
423
435
|
}, /*#__PURE__*/_react.default.createElement(_CardWide.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
424
436
|
className: (0, _helpers__.withStyle)('row')
|
|
@@ -203,7 +203,9 @@ const InternalAppointmentForm = _ref => {
|
|
|
203
203
|
executionAnswer1,
|
|
204
204
|
executionAnswer2,
|
|
205
205
|
priceCalculationDate,
|
|
206
|
-
selectedExtras
|
|
206
|
+
selectedExtras,
|
|
207
|
+
invoicePaymentByLeaseCompany,
|
|
208
|
+
webshop
|
|
207
209
|
} = order;
|
|
208
210
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
209
211
|
const [_licensePlate, _setLicensePlate] = (0, _react.useState)();
|
|
@@ -354,6 +356,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
354
356
|
vatNumber: (_customer$vatNumber = customer === null || customer === void 0 ? void 0 : customer.vatNumber) !== null && _customer$vatNumber !== void 0 ? _customer$vatNumber : undefined
|
|
355
357
|
})),
|
|
356
358
|
customerAgreed,
|
|
359
|
+
invoicePaymentByLeaseCompany: invoicePaymentByLeaseCompany !== null && invoicePaymentByLeaseCompany !== void 0 ? invoicePaymentByLeaseCompany : undefined,
|
|
357
360
|
appointment,
|
|
358
361
|
appointmentType,
|
|
359
362
|
channel,
|
|
@@ -679,7 +682,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
679
682
|
options: Object.values(_constants__.VEHICLE_OWNERSHIP_TYPE),
|
|
680
683
|
isRequired: true,
|
|
681
684
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['ownershipType']
|
|
682
|
-
}), (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement("div", {
|
|
685
|
+
}), (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
683
686
|
className: (0, _helpers__.withStyle)('company-search-container position-relative mt-2 mb-2')
|
|
684
687
|
}, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
685
688
|
placeholder: "Zoek leasemaatschappijen...",
|
|
@@ -808,7 +811,20 @@ const InternalAppointmentForm = _ref => {
|
|
|
808
811
|
setCompanySearchTerm('');
|
|
809
812
|
setIsCompanyInputFocused(false);
|
|
810
813
|
}
|
|
811
|
-
}, branch.name))))
|
|
814
|
+
}, branch.name)))), /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
|
|
815
|
+
name: "invoicePaymentByLeaseCompany",
|
|
816
|
+
label: "Factuur betaling door Leasemaatschappij",
|
|
817
|
+
initialValue: invoicePaymentByLeaseCompany,
|
|
818
|
+
onChange: val => {
|
|
819
|
+
dispatch({
|
|
820
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY,
|
|
821
|
+
payload: {
|
|
822
|
+
invoicePaymentByLeaseCompany: val
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
},
|
|
826
|
+
isRequired: false
|
|
827
|
+
}))), /*#__PURE__*/_react.default.createElement("h5", {
|
|
812
828
|
className: (0, _helpers__.withStyle)('my-2')
|
|
813
829
|
}, "Persoonlijke gegevens"), /*#__PURE__*/_react.default.createElement("div", {
|
|
814
830
|
className: (0, _helpers__.withStyle)('col-12 col-md-6 mb-2')
|
|
@@ -1601,7 +1617,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1601
1617
|
label: /*#__PURE__*/_react.default.createElement("strong", null, "Bovenstaande gecommuniceerd naar en akkoord bevonden door klant")
|
|
1602
1618
|
})) : /*#__PURE__*/_react.default.createElement("div", {
|
|
1603
1619
|
className: (0, _helpers__.withStyle)('text-muted my-2')
|
|
1604
|
-
}, "Geen opties gevonden..."))), ' ')), /*#__PURE__*/_react.default.createElement("div", {
|
|
1620
|
+
}, "Geen opties gevonden..."))), ' ')), !webshop && /*#__PURE__*/_react.default.createElement("div", {
|
|
1605
1621
|
className: (0, _helpers__.withStyle)('col-12')
|
|
1606
1622
|
}, /*#__PURE__*/_react.default.createElement(_CardWide.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
1607
1623
|
className: (0, _helpers__.withStyle)('row')
|
|
@@ -1665,7 +1681,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1665
1681
|
state: {
|
|
1666
1682
|
prevPathName: history.location.pathname
|
|
1667
1683
|
}
|
|
1668
|
-
}), !existingDossierId ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
1684
|
+
}), !existingDossierId ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isTmg && /*#__PURE__*/_react.default.createElement("div", {
|
|
1669
1685
|
className: (0, _helpers__.withStyle)('me-1')
|
|
1670
1686
|
}, /*#__PURE__*/_react.default.createElement(_PrimaryButton.default, {
|
|
1671
1687
|
onClick: () => {
|
|
@@ -27,7 +27,9 @@ var _constants__ = require("../../__constants__");
|
|
|
27
27
|
var _FormulaContext = require("../../__context__/FormulaContext");
|
|
28
28
|
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
29
29
|
var _useIsSingleOrder = _interopRequireDefault(require("../../__hooks__/useIsSingleOrder"));
|
|
30
|
+
var _useIsTmg = require("../../__hooks__/useIsTmg");
|
|
30
31
|
var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
|
|
32
|
+
var _OrderTypeSelectorModal = _interopRequireWildcard(require("./OrderTypeSelectorModal"));
|
|
31
33
|
function _interopRequireDefault(e) {
|
|
32
34
|
return e && e.__esModule ? e : {
|
|
33
35
|
default: e
|
|
@@ -236,20 +238,18 @@ const InternalBranchSelectorModal = () => {
|
|
|
236
238
|
const authSession = _LocalStorageWorker.lsw.getJson(_constants__.AUTH_SESSION_KEY);
|
|
237
239
|
const isSingleOrderPage = (0, _useIsSingleOrder.default)();
|
|
238
240
|
const formula = (0, _FormulaContext.useFormula)();
|
|
239
|
-
const isTMGOrganization =
|
|
240
|
-
var _branchTypes$byId$aut, _authSession$branch2;
|
|
241
|
-
return (branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut = 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$aut === void 0 ? void 0 : _branchTypes$byId$aut.title) === _constants__.TMG_ORGANIZATION_TYPE;
|
|
242
|
-
}, [branchTypes, authSession]);
|
|
241
|
+
const isTMGOrganization = (0, _useIsTmg.useIsTmg)();
|
|
243
242
|
(0, _react.useEffect)(() => {
|
|
244
243
|
_setSelectedBranchId(undefined);
|
|
245
244
|
}, [isSingleOrderPage]);
|
|
246
245
|
const isLocation = _react.default.useMemo(() => {
|
|
247
|
-
var _branchTypes$byId$
|
|
248
|
-
return (branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$
|
|
246
|
+
var _branchTypes$byId$aut, _authSession$branch2;
|
|
247
|
+
return (branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut = 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$aut === void 0 ? void 0 : _branchTypes$byId$aut.title) === _constants__.LOCATION_TYPE;
|
|
249
248
|
}, [branchTypes, authSession]);
|
|
250
249
|
const [{
|
|
251
250
|
selectedBranch,
|
|
252
|
-
existingDossierId
|
|
251
|
+
existingDossierId,
|
|
252
|
+
orderType
|
|
253
253
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
254
254
|
const {
|
|
255
255
|
myBranches,
|
|
@@ -267,15 +267,20 @@ const InternalBranchSelectorModal = () => {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
};
|
|
270
|
-
const shouldShowModalForSingleOrder = APP_CONFIG.internal && !selectedBranch && !existingDossierId && isSingleOrderPage;
|
|
271
|
-
const shouldShowModalForOtherPages = APP_CONFIG.internal && !selectedBranch && !existingDossierId && !isSingleOrderPage && !isTMGOrganization && !shouldAutoSelect && !isLoadingMyBranches;
|
|
270
|
+
const shouldShowModalForSingleOrder = APP_CONFIG.internal && formula === _constants__.CONFIGURATOR_FORMULAS.TMG && !selectedBranch && !existingDossierId && isSingleOrderPage;
|
|
271
|
+
const shouldShowModalForOtherPages = APP_CONFIG.internal && formula === _constants__.CONFIGURATOR_FORMULAS.TMG && !selectedBranch && !existingDossierId && !isSingleOrderPage && !isTMGOrganization && !shouldAutoSelect && !isLoadingMyBranches;
|
|
272
272
|
if (isLoadingBranchTypes || isLoadingMyBranches) {
|
|
273
273
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
274
274
|
className: "thm-configurator-wrapper--offset"
|
|
275
275
|
}, /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null));
|
|
276
276
|
}
|
|
277
|
+
if ((shouldShowModalForSingleOrder || shouldShowModalForOtherPages) && isTMGOrganization && !orderType) {
|
|
278
|
+
return /*#__PURE__*/_react.default.createElement(_OrderTypeSelectorModal.default, {
|
|
279
|
+
isOpen: true
|
|
280
|
+
});
|
|
281
|
+
}
|
|
277
282
|
return /*#__PURE__*/_react.default.createElement(_Modal.default, {
|
|
278
|
-
isOpen: shouldShowModalForSingleOrder || shouldShowModalForOtherPages,
|
|
283
|
+
isOpen: (shouldShowModalForSingleOrder || shouldShowModalForOtherPages) && !(isTMGOrganization && orderType === _OrderTypeSelectorModal.ORDER_TYPES.ONLINE),
|
|
279
284
|
title: 'Kies een vestiging:',
|
|
280
285
|
size: "wide",
|
|
281
286
|
hasSecondaryButton: false,
|
|
@@ -95,8 +95,13 @@ const InternalSingleOrderProductOverview = _ref => {
|
|
|
95
95
|
durationAnswer,
|
|
96
96
|
executionAnswer1,
|
|
97
97
|
singleOrderFormulaCode,
|
|
98
|
-
executionAnswer2
|
|
98
|
+
executionAnswer2,
|
|
99
|
+
webshop
|
|
99
100
|
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
101
|
+
const orderSession = {
|
|
102
|
+
webshop
|
|
103
|
+
}; // Added for filter access
|
|
104
|
+
|
|
100
105
|
let formula = (0, _FormulaContext.useFormula)();
|
|
101
106
|
if (singleOrderFormulaCode) {
|
|
102
107
|
formula = singleOrderFormulaCode;
|
|
@@ -114,7 +119,7 @@ const InternalSingleOrderProductOverview = _ref => {
|
|
|
114
119
|
articles,
|
|
115
120
|
areArticlesError,
|
|
116
121
|
areArticlesLoaded
|
|
117
|
-
} = (0, _queries.useSingleOrderArticles)(mergedFilters, formula, selectedBranch);
|
|
122
|
+
} = (0, _queries.useSingleOrderArticles)(mergedFilters, formula, selectedBranch, orderSession.webshop);
|
|
118
123
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
119
124
|
className: (0, _helpers__.withStyle)('flex-grow-1 h-100')
|
|
120
125
|
}, !hasActiveFilters && /*#__PURE__*/_react.default.createElement(_EmptyState.default, {
|
|
@@ -126,9 +131,17 @@ const InternalSingleOrderProductOverview = _ref => {
|
|
|
126
131
|
}), articles && hasActiveFilters && (articles === null || articles === void 0 || (_articles$articles2 = articles.articles) === null || _articles$articles2 === void 0 ? void 0 : _articles$articles2.length) > 0 && (articles === null || articles === void 0 || (_articles$articles3 = articles.articles) === null || _articles$articles3 === void 0 || (_articles$articles3 = _articles$articles3.filter(article => {
|
|
127
132
|
var _article$locationPric;
|
|
128
133
|
const productPrice = Number(article === null || article === void 0 || (_article$locationPric = article.locationPrices) === null || _article$locationPric === void 0 ? void 0 : _article$locationPric.priceExclVat);
|
|
134
|
+
// If webshop is selected, only show products with a price from Shopify
|
|
135
|
+
if (orderSession.webshop) {
|
|
136
|
+
return productPrice > 0;
|
|
137
|
+
}
|
|
138
|
+
// Otherwise, show if TMG or has price
|
|
129
139
|
return isTmg || productPrice > 0;
|
|
130
140
|
})) === null || _articles$articles3 === void 0 ? void 0 : _articles$articles3.map(article => {
|
|
131
|
-
var
|
|
141
|
+
var _article$locationPric2, _article$locationPric3, _article$locationPric4, _cart$find$quantity, _cart$find, _article$locationPric7, _article$locationPric8;
|
|
142
|
+
// Hide stock for webshops (online orders)
|
|
143
|
+
const stockQuantity = orderSession.webshop || isTmg ? 0 : (_article$locationPric2 = article === null || article === void 0 || (_article$locationPric3 = article.locationPrices) === null || _article$locationPric3 === void 0 || (_article$locationPric3 = _article$locationPric3.stock) === null || _article$locationPric3 === void 0 ? void 0 : _article$locationPric3.quantity) !== null && _article$locationPric2 !== void 0 ? _article$locationPric2 : 0;
|
|
144
|
+
const isOutOfStock = !orderSession.webshop && !isTmg && (article === null || article === void 0 || (_article$locationPric4 = article.locationPrices) === null || _article$locationPric4 === void 0 || (_article$locationPric4 = _article$locationPric4.stock) === null || _article$locationPric4 === void 0 ? void 0 : _article$locationPric4.status) == _constants__.StockStatus.OutOfStock;
|
|
132
145
|
return /*#__PURE__*/_react.default.createElement(_SingleOrderProductCard.default, {
|
|
133
146
|
isTmg: isTmg,
|
|
134
147
|
branchId: selectedBranch,
|
|
@@ -141,8 +154,8 @@ const InternalSingleOrderProductOverview = _ref => {
|
|
|
141
154
|
productId: article.articleNumber,
|
|
142
155
|
quantity: (_cart$find$quantity = (_cart$find = cart.find(product => product.articleNumber === article.articleNumber)) === null || _cart$find === void 0 ? void 0 : _cart$find.quantity) !== null && _cart$find$quantity !== void 0 ? _cart$find$quantity : 0,
|
|
143
156
|
isSelected: false,
|
|
144
|
-
stock:
|
|
145
|
-
isOutOfStock:
|
|
157
|
+
stock: stockQuantity,
|
|
158
|
+
isOutOfStock: isOutOfStock,
|
|
146
159
|
handleSelected: () => {
|
|
147
160
|
var _article$locationPric5, _article$locationPric6;
|
|
148
161
|
return handleQuantityChange(article.articleNumber, 1, article === null || article === void 0 || (_article$locationPric5 = article.locationPrices) === null || _article$locationPric5 === void 0 ? void 0 : _article$locationPric5.priceExclVat, article === null || article === void 0 || (_article$locationPric6 = article.locationPrices) === null || _article$locationPric6 === void 0 ? void 0 : _article$locationPric6.priceInclVat);
|
|
@@ -167,7 +180,8 @@ const InternalSingleOrderProductOverview = _ref => {
|
|
|
167
180
|
productPriceInclVat: Number(article === null || article === void 0 || (_article$locationPric8 = article.locationPrices) === null || _article$locationPric8 === void 0 ? void 0 : _article$locationPric8.priceInclVat).toFixed(2),
|
|
168
181
|
productType: article === null || article === void 0 ? void 0 : article.type,
|
|
169
182
|
productGroup: article === null || article === void 0 ? void 0 : article.group,
|
|
170
|
-
productSubgroup: article === null || article === void 0 ? void 0 : article.subgroup
|
|
183
|
+
productSubgroup: article === null || article === void 0 ? void 0 : article.subgroup,
|
|
184
|
+
isWebshop: !!orderSession.webshop
|
|
171
185
|
});
|
|
172
186
|
})), !articles && hasActiveFilters && !areArticlesLoaded && !areArticlesError && /*#__PURE__*/_react.default.createElement("div", {
|
|
173
187
|
className: (0, _helpers__.withStyle)('flex-grow-1 h-100')
|
|
@@ -0,0 +1,136 @@
|
|
|
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 = exports.WEBSHOPS = exports.ORDER_TYPES = void 0;
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _Modal = _interopRequireDefault(require("../../__components__/Modal"));
|
|
13
|
+
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
14
|
+
var _helpers__ = require("../../__helpers__");
|
|
15
|
+
function _interopRequireDefault(e) {
|
|
16
|
+
return e && e.__esModule ? e : {
|
|
17
|
+
default: e
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function _getRequireWildcardCache(e) {
|
|
21
|
+
if ("function" != typeof WeakMap) return null;
|
|
22
|
+
var r = new WeakMap(),
|
|
23
|
+
t = new WeakMap();
|
|
24
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
25
|
+
return e ? t : r;
|
|
26
|
+
})(e);
|
|
27
|
+
}
|
|
28
|
+
function _interopRequireWildcard(e, r) {
|
|
29
|
+
if (!r && e && e.__esModule) return e;
|
|
30
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return {
|
|
31
|
+
default: e
|
|
32
|
+
};
|
|
33
|
+
var t = _getRequireWildcardCache(r);
|
|
34
|
+
if (t && t.has(e)) return t.get(e);
|
|
35
|
+
var n = {
|
|
36
|
+
__proto__: null
|
|
37
|
+
},
|
|
38
|
+
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
39
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
40
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
41
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
42
|
+
}
|
|
43
|
+
return n.default = e, t && t.set(e, n), n;
|
|
44
|
+
}
|
|
45
|
+
const ORDER_TYPES = exports.ORDER_TYPES = {
|
|
46
|
+
ONLINE: 'online',
|
|
47
|
+
OFFLINE: 'offline'
|
|
48
|
+
};
|
|
49
|
+
const WEBSHOPS = exports.WEBSHOPS = {
|
|
50
|
+
TREKHAAKLAND: 'Trekhaakland',
|
|
51
|
+
TREKHAKEN_NL: 'Trekhaken.nl'
|
|
52
|
+
};
|
|
53
|
+
const OrderTypeSelectorModal = _ref => {
|
|
54
|
+
let {
|
|
55
|
+
isOpen
|
|
56
|
+
} = _ref;
|
|
57
|
+
const [, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
58
|
+
const [step, setStep] = (0, _react.useState)('type'); // 'type' or 'webshop'
|
|
59
|
+
|
|
60
|
+
const handleTypeSelect = type => {
|
|
61
|
+
if (type === ORDER_TYPES.ONLINE) {
|
|
62
|
+
setStep('webshop');
|
|
63
|
+
} else {
|
|
64
|
+
dispatch({
|
|
65
|
+
type: _OrderSessionContext.orderSessionActions.SET_ORDER_TYPE,
|
|
66
|
+
payload: {
|
|
67
|
+
orderType: type
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const handleWebshopSelect = webshop => {
|
|
73
|
+
dispatch({
|
|
74
|
+
type: _OrderSessionContext.orderSessionActions.SET_WEBSHOP,
|
|
75
|
+
payload: {
|
|
76
|
+
webshop
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
dispatch({
|
|
80
|
+
type: _OrderSessionContext.orderSessionActions.SET_ORDER_TYPE,
|
|
81
|
+
payload: {
|
|
82
|
+
orderType: ORDER_TYPES.ONLINE
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const handleBack = () => {
|
|
87
|
+
setStep('type');
|
|
88
|
+
};
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement(_Modal.default, {
|
|
90
|
+
isOpen: isOpen,
|
|
91
|
+
title: step === 'type' ? 'Bestellings type:' : 'Kies een webshop:',
|
|
92
|
+
size: "regular",
|
|
93
|
+
hasPrimaryButton: false,
|
|
94
|
+
hasSecondaryButton: false,
|
|
95
|
+
onClose: step === 'webshop' ? handleBack : undefined
|
|
96
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
97
|
+
className: (0, _helpers__.withStyle)('d-flex flex-column gap-3 p-2')
|
|
98
|
+
}, step === 'type' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
99
|
+
type: "button",
|
|
100
|
+
className: (0, _helpers__.withStyle)('btn btn-outline-primary btn-lg w-100 d-flex align-items-center justify-content-center p-4'),
|
|
101
|
+
style: {
|
|
102
|
+
minHeight: '100px',
|
|
103
|
+
fontSize: '1.2rem'
|
|
104
|
+
},
|
|
105
|
+
onClick: () => handleTypeSelect(ORDER_TYPES.ONLINE)
|
|
106
|
+
}, "Online order"), /*#__PURE__*/_react.default.createElement("button", {
|
|
107
|
+
type: "button",
|
|
108
|
+
className: (0, _helpers__.withStyle)('btn btn-outline-secondary btn-lg w-100 d-flex align-items-center justify-content-center p-4'),
|
|
109
|
+
style: {
|
|
110
|
+
minHeight: '100px',
|
|
111
|
+
fontSize: '1.2rem'
|
|
112
|
+
},
|
|
113
|
+
onClick: () => handleTypeSelect(ORDER_TYPES.OFFLINE)
|
|
114
|
+
}, "Offline order")), step === 'webshop' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
115
|
+
type: "button",
|
|
116
|
+
className: (0, _helpers__.withStyle)('btn btn-outline-primary btn-lg w-100 d-flex align-items-center justify-content-center p-4'),
|
|
117
|
+
style: {
|
|
118
|
+
minHeight: '80px'
|
|
119
|
+
},
|
|
120
|
+
onClick: () => handleWebshopSelect(WEBSHOPS.TREKHAAKLAND)
|
|
121
|
+
}, "Trekhaakland"), /*#__PURE__*/_react.default.createElement("button", {
|
|
122
|
+
type: "button",
|
|
123
|
+
className: (0, _helpers__.withStyle)('btn btn-outline-primary btn-lg w-100 d-flex align-items-center justify-content-center p-4'),
|
|
124
|
+
style: {
|
|
125
|
+
minHeight: '80px'
|
|
126
|
+
},
|
|
127
|
+
onClick: () => handleWebshopSelect(WEBSHOPS.TREKHAKEN_NL)
|
|
128
|
+
}, "Trekhaken.nl"), /*#__PURE__*/_react.default.createElement("button", {
|
|
129
|
+
type: "button",
|
|
130
|
+
className: (0, _helpers__.withStyle)('btn btn-link text-muted mt-2'),
|
|
131
|
+
onClick: handleBack
|
|
132
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
133
|
+
className: "fas fa-arrow-left me-2"
|
|
134
|
+
}), "Terug"))));
|
|
135
|
+
};
|
|
136
|
+
var _default = exports.default = OrderTypeSelectorModal;
|
|
@@ -165,13 +165,18 @@ const INITIAL_ORDER_SESSION_STATE = {
|
|
|
165
165
|
countryId: null,
|
|
166
166
|
vatNumber: '',
|
|
167
167
|
anwbId: null
|
|
168
|
-
}
|
|
168
|
+
},
|
|
169
|
+
invoicePaymentByLeaseCompany: false,
|
|
170
|
+
orderType: null,
|
|
171
|
+
webshop: null
|
|
169
172
|
};
|
|
170
173
|
const orderSessionActions = exports.orderSessionActions = {
|
|
171
174
|
INITIALIZE_NEW_ORDER: 'INITIALIZE_NEW_ORDER',
|
|
172
175
|
INITIALIZE_EXISTING_ORDER: 'INITIALIZE_EXISTING_ORDER',
|
|
173
176
|
RESET_LICENSEPLATE_FILTERS: 'RESET_LICENSEPLATE_FILTERS',
|
|
174
177
|
SET_LICENSEPLATE_FILTERS: 'SET_LICENSEPLATE_FILTERS',
|
|
178
|
+
SET_ORDER_TYPE: 'SET_ORDER_TYPE',
|
|
179
|
+
SET_WEBSHOP: 'SET_WEBSHOP',
|
|
175
180
|
SET_IS_TOUCHED: 'SET_IS_TOUCHED',
|
|
176
181
|
SET_LICENSE_PLATE: 'SET_LICENSE_PLATE',
|
|
177
182
|
SET_BUILD_YEAR: 'SET_BUILD_YEAR',
|
|
@@ -236,7 +241,8 @@ const orderSessionActions = exports.orderSessionActions = {
|
|
|
236
241
|
SET_CUSTOMER_COMPANY_NAME: 'SET_CUSTOMER_COMPANY_NAME',
|
|
237
242
|
SET_CUSTOMER_KVK_NUMBER: 'SET_CUSTOMER_KVK_NUMBER',
|
|
238
243
|
SET_CUSTOMER_VAT_NUMBER: 'SET_CUSTOMER_VAT_NUMBER',
|
|
239
|
-
SET_CUSTOMER_HOUSE_NUMBER_ADDITION: 'SET_CUSTOMER_HOUSE_NUMBER_ADDITION'
|
|
244
|
+
SET_CUSTOMER_HOUSE_NUMBER_ADDITION: 'SET_CUSTOMER_HOUSE_NUMBER_ADDITION',
|
|
245
|
+
SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY: 'SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY'
|
|
240
246
|
};
|
|
241
247
|
const orderSessionReducer = (state, action) => {
|
|
242
248
|
switch (action.type) {
|
|
@@ -317,7 +323,12 @@ const orderSessionReducer = (state, action) => {
|
|
|
317
323
|
{
|
|
318
324
|
return _objectSpread(_objectSpread({}, INITIAL_ORDER_SESSION_STATE), {}, {
|
|
319
325
|
singleOrderCart: [],
|
|
320
|
-
isTouched: true
|
|
326
|
+
isTouched: true,
|
|
327
|
+
// Preserve these to prevent OrderTypeSelectorModal from reopening
|
|
328
|
+
selectedBranch: state.selectedBranch,
|
|
329
|
+
orderType: state.orderType,
|
|
330
|
+
webshop: state.webshop,
|
|
331
|
+
singleOrderFormulaCode: state.singleOrderFormulaCode
|
|
321
332
|
});
|
|
322
333
|
}
|
|
323
334
|
case orderSessionActions.SET_VEHICLE_CHASSIS_NUMBER:
|
|
@@ -603,6 +614,15 @@ const orderSessionReducer = (state, action) => {
|
|
|
603
614
|
})
|
|
604
615
|
});
|
|
605
616
|
}
|
|
617
|
+
case orderSessionActions.SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY:
|
|
618
|
+
{
|
|
619
|
+
const {
|
|
620
|
+
invoicePaymentByLeaseCompany
|
|
621
|
+
} = action.payload;
|
|
622
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
623
|
+
invoicePaymentByLeaseCompany
|
|
624
|
+
});
|
|
625
|
+
}
|
|
606
626
|
case orderSessionActions.SET_CUSTOMER_PHONE_NUMBER:
|
|
607
627
|
{
|
|
608
628
|
const {
|
|
@@ -848,7 +868,8 @@ const orderSessionReducer = (state, action) => {
|
|
|
848
868
|
vehicle: {
|
|
849
869
|
ownershipType,
|
|
850
870
|
leaseNumber: null
|
|
851
|
-
}
|
|
871
|
+
},
|
|
872
|
+
invoicePaymentByLeaseCompany: false
|
|
852
873
|
});
|
|
853
874
|
}
|
|
854
875
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -1038,6 +1059,24 @@ const orderSessionReducer = (state, action) => {
|
|
|
1038
1059
|
})
|
|
1039
1060
|
});
|
|
1040
1061
|
}
|
|
1062
|
+
case orderSessionActions.SET_ORDER_TYPE:
|
|
1063
|
+
{
|
|
1064
|
+
const {
|
|
1065
|
+
orderType
|
|
1066
|
+
} = action.payload;
|
|
1067
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1068
|
+
orderType
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
case orderSessionActions.SET_WEBSHOP:
|
|
1072
|
+
{
|
|
1073
|
+
const {
|
|
1074
|
+
webshop
|
|
1075
|
+
} = action.payload;
|
|
1076
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1077
|
+
webshop
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1041
1080
|
default:
|
|
1042
1081
|
return state;
|
|
1043
1082
|
}
|
|
@@ -131,6 +131,12 @@ const InternalSingleOrderPage = () => {
|
|
|
131
131
|
isCreateSingleOrderError,
|
|
132
132
|
isCreateSingleOrderSuccess
|
|
133
133
|
} = (0, _mutations.useCreateSingleOrderMutation)();
|
|
134
|
+
const {
|
|
135
|
+
createShopifyOrder,
|
|
136
|
+
isCreatingShopifyOrder,
|
|
137
|
+
isCreateShopifyOrderError,
|
|
138
|
+
isCreateShopifyOrderSuccess
|
|
139
|
+
} = (0, _mutations.useCreateShopifyOrderMutation)();
|
|
134
140
|
const [{
|
|
135
141
|
singleOrderCart,
|
|
136
142
|
channel,
|
|
@@ -142,7 +148,8 @@ const InternalSingleOrderPage = () => {
|
|
|
142
148
|
singleOrderFormulaCode,
|
|
143
149
|
licensePlate,
|
|
144
150
|
durationAnswer,
|
|
145
|
-
model
|
|
151
|
+
model,
|
|
152
|
+
webshop
|
|
146
153
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
147
154
|
let formula = (0, _FormulaContext.useFormula)();
|
|
148
155
|
if (singleOrderFormulaCode) {
|
|
@@ -154,13 +161,15 @@ const InternalSingleOrderPage = () => {
|
|
|
154
161
|
isLoadingBranchById
|
|
155
162
|
} = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
|
|
156
163
|
(0, _react.useEffect)(() => {
|
|
157
|
-
if (isCreateSingleOrderSuccess) {
|
|
164
|
+
if (isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess) {
|
|
165
|
+
setIsDirectSelectorModalOpen(false);
|
|
166
|
+
setHasUserDismissedModal(true);
|
|
158
167
|
dispatch({
|
|
159
168
|
type: _OrderSessionContext.orderSessionActions.EMPTY_SINGLE_ORDER_CART
|
|
160
169
|
});
|
|
161
170
|
setShowProductOverview(true);
|
|
162
171
|
}
|
|
163
|
-
}, [isCreateSingleOrderSuccess]);
|
|
172
|
+
}, [isCreateSingleOrderSuccess, isCreateShopifyOrderSuccess]);
|
|
164
173
|
|
|
165
174
|
// Reset dismissed state when branch changes
|
|
166
175
|
(0, _react.useEffect)(() => {
|
|
@@ -170,15 +179,18 @@ const InternalSingleOrderPage = () => {
|
|
|
170
179
|
}, [selectedBranch]);
|
|
171
180
|
(0, _react.useEffect)(() => {
|
|
172
181
|
const hasActiveFilters = filters.type || filters.group || filters.subgroup || filters.articleNumber || filters.showAllArticles;
|
|
173
|
-
|
|
182
|
+
|
|
183
|
+
// Don't open modal if order was just successfully created
|
|
184
|
+
const orderJustCompleted = isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess;
|
|
185
|
+
if (showProductOverview && selectedBranch && !licensePlate && !model && !hasActiveFilters && !isLoadingBranchById && !hasUserDismissedModal && !orderJustCompleted) {
|
|
174
186
|
setIsDirectSelectorModalOpen(true);
|
|
175
187
|
} else {
|
|
176
|
-
// Close modal if filters become active
|
|
177
|
-
if (hasActiveFilters && isDirectSelectorModalOpen) {
|
|
188
|
+
// Close modal if filters become active or we're on details page
|
|
189
|
+
if ((hasActiveFilters || !showProductOverview) && isDirectSelectorModalOpen) {
|
|
178
190
|
setIsDirectSelectorModalOpen(false);
|
|
179
191
|
}
|
|
180
192
|
}
|
|
181
|
-
}, [selectedBranch, licensePlate, model, filters, isLoadingBranchById, isDirectSelectorModalOpen, hasUserDismissedModal]);
|
|
193
|
+
}, [selectedBranch, licensePlate, model, filters, isLoadingBranchById, isDirectSelectorModalOpen, hasUserDismissedModal, isCreateSingleOrderSuccess, isCreateShopifyOrderSuccess, showProductOverview]);
|
|
182
194
|
const resetOrderSession = (0, _react.useCallback)(() => {
|
|
183
195
|
dispatch({
|
|
184
196
|
type: _OrderSessionContext.orderSessionActions.RESET_SINGLE_ORDER
|
|
@@ -307,31 +319,51 @@ const InternalSingleOrderPage = () => {
|
|
|
307
319
|
var _customerFormRef$curr;
|
|
308
320
|
const isValid = await ((_customerFormRef$curr = customerFormRef.current) === null || _customerFormRef$curr === void 0 ? void 0 : _customerFormRef$curr.validateForm());
|
|
309
321
|
if (isValid) {
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
delete vehicle.singleOrderOwnershipType;
|
|
313
|
-
createSingleOrder({
|
|
314
|
-
licensePlate: filters.licensePlate,
|
|
315
|
-
model: filters.model,
|
|
316
|
-
cart: singleOrderCart,
|
|
317
|
-
vehicle,
|
|
318
|
-
customer,
|
|
319
|
-
formula,
|
|
320
|
-
branchId: selectedBranch,
|
|
321
|
-
channel,
|
|
322
|
-
preferredDateTime,
|
|
323
|
-
internalNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
|
|
322
|
+
const vehiclePayload = _objectSpread(_objectSpread({}, vehicle), {}, {
|
|
323
|
+
ownershipType: vehicle.singleOrderOwnershipType || vehicle.ownershipType
|
|
324
324
|
});
|
|
325
|
+
delete vehiclePayload.singleOrderOwnershipType;
|
|
326
|
+
|
|
327
|
+
// If webshop is selected, create Shopify order instead
|
|
328
|
+
if (webshop) {
|
|
329
|
+
createShopifyOrder({
|
|
330
|
+
licensePlate: filters.licensePlate,
|
|
331
|
+
model: filters.model,
|
|
332
|
+
cart: singleOrderCart,
|
|
333
|
+
vehicle: vehiclePayload,
|
|
334
|
+
customer,
|
|
335
|
+
formula,
|
|
336
|
+
webshop,
|
|
337
|
+
branchId: selectedBranch,
|
|
338
|
+
channel,
|
|
339
|
+
internalNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
|
|
340
|
+
});
|
|
341
|
+
} else {
|
|
342
|
+
// Regular flow for offline orders
|
|
343
|
+
const preferredDateTime = appointment !== null && appointment !== void 0 && appointment.date && appointment !== null && appointment !== void 0 && appointment.time ? (0, _helpers__.parseDateAndTimeToTimestamp)(appointment === null || appointment === void 0 ? void 0 : appointment.date, appointment === null || appointment === void 0 ? void 0 : appointment.time) : null;
|
|
344
|
+
createSingleOrder({
|
|
345
|
+
licensePlate: filters.licensePlate,
|
|
346
|
+
model: filters.model,
|
|
347
|
+
cart: singleOrderCart,
|
|
348
|
+
vehicle: vehiclePayload,
|
|
349
|
+
customer,
|
|
350
|
+
formula,
|
|
351
|
+
branchId: selectedBranch,
|
|
352
|
+
channel,
|
|
353
|
+
preferredDateTime,
|
|
354
|
+
internalNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
|
|
355
|
+
});
|
|
356
|
+
}
|
|
325
357
|
}
|
|
326
358
|
};
|
|
327
359
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
328
360
|
className: (0, _helpers__.withStyle)('vh-100')
|
|
329
|
-
}, isCreateSingleOrderSuccess && /*#__PURE__*/_react.default.createElement(_InternalSingleOrderSuccessModal.default, {
|
|
330
|
-
isOpen: isCreateSingleOrderSuccess
|
|
361
|
+
}, (isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess) && /*#__PURE__*/_react.default.createElement(_InternalSingleOrderSuccessModal.default, {
|
|
362
|
+
isOpen: isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess
|
|
331
363
|
}), /*#__PURE__*/_react.default.createElement(_Header.default, {
|
|
332
364
|
title: "Losse producten bestellen",
|
|
333
365
|
subtitle: branchById !== null && branchById !== void 0 && branchById.name ? "Vestiging: ".concat(branchById === null || branchById === void 0 ? void 0 : branchById.name) : ''
|
|
334
|
-
}), /*#__PURE__*/_react.default.createElement(_DirectVehicleSelectorModal.default, {
|
|
366
|
+
}), showProductOverview && !isCreateSingleOrderSuccess && !isCreateShopifyOrderSuccess && /*#__PURE__*/_react.default.createElement(_DirectVehicleSelectorModal.default, {
|
|
335
367
|
isOpen: isDirectSelectorModalOpen,
|
|
336
368
|
onSubmit: filterModelOrLicenseplate,
|
|
337
369
|
handleSelectedFilterChange: handleSelectedFilterChange,
|
|
@@ -364,7 +396,7 @@ const InternalSingleOrderPage = () => {
|
|
|
364
396
|
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
|
|
365
397
|
label: "Terug naar producten",
|
|
366
398
|
onClick: () => setShowProductOverview(true)
|
|
367
|
-
}), !isCreateSingleOrderSuccess && isCreateSingleOrderError && /*#__PURE__*/_react.default.createElement(_DangerAlert.default, {
|
|
399
|
+
}), !(isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess) && (isCreateSingleOrderError || isCreateShopifyOrderError) && /*#__PURE__*/_react.default.createElement(_DangerAlert.default, {
|
|
368
400
|
className: "mt-2 mx-0",
|
|
369
401
|
message: "Er is iets fout gegaan bij het bestellen. Probeer het opnieuw. Momenteel kunnen in hyper alleen losse orders worden gemaakt als een kenteken of model is geselecteerd in de filters."
|
|
370
402
|
}), /*#__PURE__*/_react.default.createElement(_InternalCustomerDetailsForm.default, {
|
|
@@ -382,7 +414,7 @@ const InternalSingleOrderPage = () => {
|
|
|
382
414
|
handleQuantityChange: handleQuantityChange,
|
|
383
415
|
showProductOverview: showProductOverview,
|
|
384
416
|
handleSubmit: handleSubmit,
|
|
385
|
-
disabledCreateOrder: !singleOrderCart.length || isCreatingSingleOrder,
|
|
417
|
+
disabledCreateOrder: !singleOrderCart.length || isCreatingSingleOrder || isCreatingShopifyOrder,
|
|
386
418
|
toggleOverview: () => setShowProductOverview(false)
|
|
387
419
|
})))), /*#__PURE__*/_react.default.createElement(_BottomNavigationBar.default, null)));
|
|
388
420
|
};
|