This commit is contained in:
sovanna 2020-04-21 11:19:21 +09:00
commit fa8638c411

39
static/js/shop.min.js vendored
View File

@ -182,7 +182,8 @@ var Layout = /*#__PURE__*/function (_React$PureComponent) {
onClickCloseRFQFeedback: PropTypes.func, onClickCloseRFQFeedback: PropTypes.func,
RFQBodyType: PropTypes.string, RFQBodyType: PropTypes.string,
RFQBodyOrder: 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.handleCustomConfig = _this.handleCustomConfig.bind(_assertThisInitialized(_this));
_this.handleClickLoad = _this.handleClickLoad.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; return _this;
} }
@ -285,6 +291,21 @@ var Layout = /*#__PURE__*/function (_React$PureComponent) {
pn: item.pn 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, { this.setState(_objectSpread({}, this.state, {
customconf: conf, customconf: conf,
error: null, error: null,
@ -536,7 +557,8 @@ var ProductCartItem = /*#__PURE__*/function (_React$PureComponent3) {
onToggleProgress: PropTypes.func, onToggleProgress: PropTypes.func,
onToggleWarning: PropTypes.func, onToggleWarning: PropTypes.func,
onToggleOverlayRemove: 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, hovered = _this$props3.hovered,
model = _this$props3.model, model = _this$props3.model,
data = _this$props3.data, data = _this$props3.data,
index = _this$props3.index; index = _this$props3.index,
shouldTooltipWarningClassInverted = _this$props3.shouldTooltipWarningClassInverted;
var warning; var warning;
if (data && data.warnings) { if (data && data.warnings) {
@ -703,8 +726,8 @@ var ProductCartItem = /*#__PURE__*/function (_React$PureComponent3) {
}, warning && /*#__PURE__*/React.createElement("img", { }, warning && /*#__PURE__*/React.createElement("img", {
className: "alert-warning", className: "alert-warning",
src: warning ? "/images".concat(warning.icon) : null src: warning ? "/images".concat(warning.icon) : null
}), warning && model.showWarning && /*#__PURE__*/React.createElement("div", { }), warning && /*#__PURE__*/React.createElement("div", {
className: "k-popup-warning" className: "k-popup-warning ".concat(shouldTooltipWarningClassInverted ? 'inverted' : '')
}, /*#__PURE__*/React.createElement("p", { }, /*#__PURE__*/React.createElement("p", {
className: "rule warning" className: "rule warning"
}, /*#__PURE__*/React.createElement("i", null, warning.message)))), /*#__PURE__*/React.createElement("h6", null, model.name_number), /*#__PURE__*/React.createElement("div", { }, /*#__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, onToggleWarning = _this$props5.onToggleWarning,
onToggleOverlayRemove = _this$props5.onToggleOverlayRemove, onToggleOverlayRemove = _this$props5.onToggleOverlayRemove,
onClickRemoveItem = _this$props5.onClickRemoveItem; onClickRemoveItem = _this$props5.onClickRemoveItem;
var nbrOccupied = nbrOccupiedSlotsInCrate(data.items);
var shouldTooltipWarningClassInverted = nbrSlots - nbrOccupied < 5;
var products = data.items.map(function (item, index) { var products = data.items.map(function (item, index) {
var itemData; var itemData;
@ -841,6 +866,7 @@ var Cart = /*#__PURE__*/function (_React$PureComponent5) {
key: item.id, key: item.id,
index: index, index: index,
data: itemData, data: itemData,
shouldTooltipWarningClassInverted: shouldTooltipWarningClassInverted && index > 10,
onToggleProgress: onToggleProgress, onToggleProgress: onToggleProgress,
onToggleWarning: onToggleWarning, onToggleWarning: onToggleWarning,
onToggleOverlayRemove: onToggleOverlayRemove, onToggleOverlayRemove: onToggleOverlayRemove,
@ -2320,6 +2346,7 @@ var Shop = /*#__PURE__*/function (_React$PureComponent12) {
onClickToggleMobileSideMenu: this.handleClickToggleMobileSideMenu, onClickToggleMobileSideMenu: this.handleClickToggleMobileSideMenu,
onClickCloseRFQFeedback: this.handleClickCloseRFQFeedback, onClickCloseRFQFeedback: this.handleClickCloseRFQFeedback,
onClickLoadCustomConf: this.handleLoadCustomConf, onClickLoadCustomConf: this.handleLoadCustomConf,
items: items,
aside: /*#__PURE__*/React.createElement(Backlog, { aside: /*#__PURE__*/React.createElement(Backlog, {
currency: currency, currency: currency,
items: items, items: items,