thm-p3-configurator 0.0.74 → 0.0.76

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.
@@ -84,6 +84,7 @@ const ProductSpecifications = _ref3 => {
84
84
  const ProductActions = _ref4 => {
85
85
  let {
86
86
  isOutOfStock,
87
+ stock,
87
88
  quantity,
88
89
  productId,
89
90
  handleQuantityChange,
@@ -94,9 +95,11 @@ const ProductActions = _ref4 => {
94
95
  className: (0, _helpers__.withStyle)('d-flex justify-content-end')
95
96
  }, /*#__PURE__*/_react.default.createElement("div", {
96
97
  className: (0, _helpers__.withStyle)('d-flex flex-column align-items-end')
97
- }, isOutOfStock && /*#__PURE__*/_react.default.createElement("div", {
98
+ }, isOutOfStock ? /*#__PURE__*/_react.default.createElement("div", {
98
99
  className: (0, _helpers__.withStyle)('text-danger mb-1')
99
- }, "Niet op voorraad"), /*#__PURE__*/_react.default.createElement("div", {
100
+ }, "Niet op voorraad") : /*#__PURE__*/_react.default.createElement("div", {
101
+ className: (0, _helpers__.withStyle)('text-success mb-1')
102
+ }, stock, " op voorraad"), /*#__PURE__*/_react.default.createElement("div", {
100
103
  className: (0, _helpers__.withStyle)('d-flex align-items-center')
101
104
  }, /*#__PURE__*/_react.default.createElement(_NumericInput.default, {
102
105
  className: (0, _helpers__.withStyle)('me-2 rounded'),
@@ -136,6 +139,7 @@ const SingleOrderProductCard = _ref6 => {
136
139
  let {
137
140
  productId,
138
141
  isSelected,
142
+ stock,
139
143
  isOutOfStock,
140
144
  handleSelected,
141
145
  productImage,
@@ -177,6 +181,7 @@ const SingleOrderProductCard = _ref6 => {
177
181
  specifications: productSpecifications
178
182
  })), /*#__PURE__*/_react.default.createElement(ProductActions, {
179
183
  isOutOfStock: isOutOfStock,
184
+ stock: stock,
180
185
  quantity: quantity,
181
186
  productId: productId,
182
187
  handleQuantityChange: handleQuantityChange,
@@ -20,10 +20,11 @@ var _DangerAlert = _interopRequireDefault(require("../../__components__/DangerAl
20
20
  var _CheckboxInput = _interopRequireDefault(require("../../__components__/Form/CheckboxInput"));
21
21
  var _DropdownInput = _interopRequireDefault(require("../../__components__/Form/DropdownInput"));
22
22
  var _TextInput = _interopRequireDefault(require("../../__components__/Form/TextInput"));
23
+ var _constants__ = require("../../__constants__");
23
24
  var _FormulaContext = require("../../__context__/FormulaContext");
24
- var _helpers__ = require("../../__helpers__");
25
25
  var _OrderSessionContext = require("../../__context__/OrderSessionContext");
26
- var _constants__ = require("../../__constants__");
26
+ var _helpers__ = require("../../__helpers__");
27
+ var _useAuthSession = require("../../__hooks__/useAuthSession");
27
28
  function _interopRequireDefault(e) {
28
29
  return e && e.__esModule ? e : {
29
30
  default: e
@@ -73,6 +74,19 @@ function InternalSingleOrderFilters(_ref) {
73
74
  isLoadingArticleTypes,
74
75
  articleTypesError
75
76
  } = (0, _queries.useArticleTypes)();
77
+ const {
78
+ branchTypes,
79
+ isLoadingBranchTypes,
80
+ branchTypesError
81
+ } = (0, _queries.useBranchTypes)();
82
+ const {
83
+ branch
84
+ } = (0, _useAuthSession.useAuthSession)();
85
+ const isTmg = (0, _react.useMemo)(() => {
86
+ var _branchTypes$byId;
87
+ const branchType = branchTypes === null || branchTypes === void 0 || (_branchTypes$byId = branchTypes.byId) === null || _branchTypes$byId === void 0 ? void 0 : _branchTypes$byId[branch === null || branch === void 0 ? void 0 : branch.organisatietype];
88
+ return (branchType === null || branchType === void 0 ? void 0 : branchType.title) === _constants__.TMG_ORGANIZATION_TYPE;
89
+ }, [branchTypes, branch]);
76
90
  const [selectedArticleType, setSelectedArticleType] = (0, _react.useState)('');
77
91
  const [selectedArticleGroup, setSelectedArticleGroup] = (0, _react.useState)('');
78
92
  const [selectedArticleSubGroup, setSelectedArticleSubGroup] = (0, _react.useState)('');
@@ -195,7 +209,7 @@ function InternalSingleOrderFilters(_ref) {
195
209
  placeholder: "Zoeken",
196
210
  onChange: value => setSelectedArticleNumber(value),
197
211
  className: "w-100"
198
- })), baseFormula === _constants__.CONFIGURATOR_FORMULAS.TMG && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
212
+ })), isTmg && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
199
213
  name: 'showAllArticles',
200
214
  initialValue: showAllArticles,
201
215
  onChange: value => setShowAllArticles(value),
@@ -124,14 +124,15 @@ const InternalSingleOrderProductOverview = _ref => {
124
124
  message: "Geen producten gevonden.",
125
125
  subMessage: "Probeer een ander filter toe te passen."
126
126
  }), 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 ? void 0 : _articles$articles3.map(article => {
127
- var _cart$find$quantity, _cart$find, _article$locationPric, _article$consumerPric;
127
+ var _cart$find$quantity, _cart$find, _article$locationPric, _article$locationPric2, _article$locationPric3, _article$consumerPric;
128
128
  return /*#__PURE__*/_react.default.createElement(_SingleOrderProductCard.default, {
129
129
  key: article.articleNumber,
130
130
  removeFromCart: () => _removeFromCart(article.articleNumber),
131
131
  productId: article.articleNumber,
132
132
  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,
133
133
  isSelected: false,
134
- isOutOfStock: (article === null || article === void 0 || (_article$locationPric = article.locationPrices) === null || _article$locationPric === void 0 || (_article$locationPric = _article$locationPric.stock) === null || _article$locationPric === void 0 ? void 0 : _article$locationPric.status) == _constants__.StockStatus.OutOfStock,
134
+ stock: (_article$locationPric = article === null || article === void 0 || (_article$locationPric2 = article.locationPrices) === null || _article$locationPric2 === void 0 || (_article$locationPric2 = _article$locationPric2.stock) === null || _article$locationPric2 === void 0 ? void 0 : _article$locationPric2.quantity) !== null && _article$locationPric !== void 0 ? _article$locationPric : 0,
135
+ isOutOfStock: (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.status) == _constants__.StockStatus.OutOfStock,
135
136
  handleSelected: () => handleQuantityChange(article.articleNumber, 1),
136
137
  articleNumber: article.articleNumber,
137
138
  handleQuantityChange: handleQuantityChange,
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useAuthSession = void 0;
7
+ var _constants__ = require("../__constants__");
8
+ var _LocalStorageWorker = require("../__services__/LocalStorageWorker");
9
+ const useAuthSession = () => {
10
+ const authSession = _LocalStorageWorker.lsw.getJson(_constants__.AUTH_SESSION_KEY);
11
+ return authSession;
12
+ };
13
+ exports.useAuthSession = useAuthSession;
@@ -7,6 +7,7 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _reactRouterDom = require("react-router-dom");
9
9
  var _ = require(".");
10
+ var _internal = require("../../__containers__/internal");
10
11
  var _NoProductsPage = _interopRequireDefault(require("../NoProductsPage"));
11
12
  var _NotFoundPage = _interopRequireDefault(require("../NotFoundPage"));
12
13
  var _QuotationThanksPage = _interopRequireDefault(require("../QuotationThanksPage"));
@@ -25,7 +26,7 @@ const TEST_ONLY_INTERNAL_ROUTES = () => {
25
26
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
26
27
  exact: true,
27
28
  path: "/configurator/single-order",
28
- render: props => /*#__PURE__*/_react.default.createElement(_.InternalSingleOrderPage, props)
29
+ render: props => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_internal.InternalBranchSelectorModal, null), /*#__PURE__*/_react.default.createElement(_.InternalSingleOrderPage, props))
29
30
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
30
31
  exact: true,
31
32
  path: "/configurator/geen-producten",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.74",
3
+ "version": "0.0.76",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",