diff --git a/static/js/shop.min.js b/static/js/shop.min.js index 3faa50b..e04b8c5 100644 --- a/static/js/shop.min.js +++ b/static/js/shop.min.js @@ -182,7 +182,8 @@ var Layout = /*#__PURE__*/function (_React$PureComponent) { onClickCloseRFQFeedback: PropTypes.func, RFQBodyType: PropTypes.string, RFQBodyOrder: PropTypes.string, - onClickLoadCustomConf: PropTypes.func + onClickLoadCustomConf: PropTypes.func, + items: PropTypes.object }; } }, { @@ -206,7 +207,12 @@ var Layout = /*#__PURE__*/function (_React$PureComponent) { }; _this.handleCustomConfig = _this.handleCustomConfig.bind(_assertThisInitialized(_this)); _this.handleClickLoad = _this.handleClickLoad.bind(_assertThisInitialized(_this)); - _this.checkValidation = _this.checkValidation.bind(_assertThisInitialized(_this)); + _this.checkValidation = _this.checkValidation.bind(_assertThisInitialized(_this)); // retrieve list of available pn + + var items_keys = Object.keys(props.items); + _this.list_pn = items_keys.map(function (key) { + return props.items[key].name_number; + }); return _this; } @@ -285,6 +291,21 @@ var Layout = /*#__PURE__*/function (_React$PureComponent) { pn: item.pn }; }); + var self = this; + var unknow_pn = conf_obj.items.filter(function (item_pn) { + return self.list_pn.includes(item_pn.pn) === false; + }).map(function (item_pn) { + return item_pn.pn; + }); + + if (unknow_pn.length > 0) { + return this.setState(_objectSpread({}, this.state, { + customconf: conf, + customconf_ready: null, + error: "".concat(unknow_pn.join(', '), " unknown").concat(unknow_pn.length > 1 ? 's' : '', " pn number") + })); + } + this.setState(_objectSpread({}, this.state, { customconf: conf, error: null, @@ -536,7 +557,8 @@ var ProductCartItem = /*#__PURE__*/function (_React$PureComponent3) { onToggleProgress: PropTypes.func, onToggleWarning: PropTypes.func, onToggleOverlayRemove: PropTypes.func, - onClickRemoveItem: PropTypes.func + onClickRemoveItem: PropTypes.func, + shouldTooltipWarningClassInverted: PropTypes.bool }; } }, { @@ -642,7 +664,8 @@ var ProductCartItem = /*#__PURE__*/function (_React$PureComponent3) { hovered = _this$props3.hovered, model = _this$props3.model, data = _this$props3.data, - index = _this$props3.index; + index = _this$props3.index, + shouldTooltipWarningClassInverted = _this$props3.shouldTooltipWarningClassInverted; var warning; if (data && data.warnings) { @@ -703,8 +726,8 @@ var ProductCartItem = /*#__PURE__*/function (_React$PureComponent3) { }, warning && /*#__PURE__*/React.createElement("img", { className: "alert-warning", src: warning ? "/images".concat(warning.icon) : null - }), warning && model.showWarning && /*#__PURE__*/React.createElement("div", { - className: "k-popup-warning" + }), warning && /*#__PURE__*/React.createElement("div", { + className: "k-popup-warning ".concat(shouldTooltipWarningClassInverted ? 'inverted' : '') }, /*#__PURE__*/React.createElement("p", { className: "rule warning" }, /*#__PURE__*/React.createElement("i", null, warning.message)))), /*#__PURE__*/React.createElement("h6", null, model.name_number), /*#__PURE__*/React.createElement("div", { @@ -828,6 +851,8 @@ var Cart = /*#__PURE__*/function (_React$PureComponent5) { onToggleWarning = _this$props5.onToggleWarning, onToggleOverlayRemove = _this$props5.onToggleOverlayRemove, onClickRemoveItem = _this$props5.onClickRemoveItem; + var nbrOccupied = nbrOccupiedSlotsInCrate(data.items); + var shouldTooltipWarningClassInverted = nbrSlots - nbrOccupied < 5; var products = data.items.map(function (item, index) { var itemData; @@ -841,6 +866,7 @@ var Cart = /*#__PURE__*/function (_React$PureComponent5) { key: item.id, index: index, data: itemData, + shouldTooltipWarningClassInverted: shouldTooltipWarningClassInverted && index > 10, onToggleProgress: onToggleProgress, onToggleWarning: onToggleWarning, onToggleOverlayRemove: onToggleOverlayRemove, @@ -2320,6 +2346,7 @@ var Shop = /*#__PURE__*/function (_React$PureComponent12) { onClickToggleMobileSideMenu: this.handleClickToggleMobileSideMenu, onClickCloseRFQFeedback: this.handleClickCloseRFQFeedback, onClickLoadCustomConf: this.handleLoadCustomConf, + items: items, aside: /*#__PURE__*/React.createElement(Backlog, { currency: currency, items: items,