@salesgenterp/ui-components 0.4.384 → 0.4.386

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/index.js CHANGED
@@ -6553,6 +6553,9 @@ var CardRow = function CardRow(_ref) {
6553
6553
  }, [row]);
6554
6554
  var onChangeQuantity = function onChangeQuantity(product) {
6555
6555
  handleIncrementDecrement(product, product);
6556
+ if ((product === null || product === void 0 ? void 0 : product.quantity) <= 0 || (product === null || product === void 0 ? void 0 : product.availableQuantity) <= 0) {
6557
+ return handleRemoveProduct(product);
6558
+ }
6556
6559
  };
6557
6560
  var onChangeInput = function onChangeInput(e) {
6558
6561
  var value = e.target.value;
@@ -6609,7 +6612,7 @@ var CardRow = function CardRow(_ref) {
6609
6612
  id: row === null || row === void 0 ? void 0 : row.labelId,
6610
6613
  scope: "row",
6611
6614
  padding: "none"
6612
- }, /*#__PURE__*/React__default.createElement(ProductName, null, row.productName), ((row === null || row === void 0 ? void 0 : row.quantity) > (row === null || row === void 0 ? void 0 : row.availableQuantity) || (row === null || row === void 0 ? void 0 : row.availableQuantity) === 0) && /*#__PURE__*/React__default.createElement("p", {
6615
+ }, /*#__PURE__*/React__default.createElement(ProductName, null, row.productName), ((row === null || row === void 0 ? void 0 : row.quantity) > (row === null || row === void 0 ? void 0 : row.availableQuantity) || (row === null || row === void 0 ? void 0 : row.availableQuantity) <= 0) && /*#__PURE__*/React__default.createElement("p", {
6613
6616
  style: {
6614
6617
  color: 'red',
6615
6618
  fontWeight: 500
@@ -6676,6 +6679,8 @@ var CardRow = function CardRow(_ref) {
6676
6679
  onClick: function onClick(e) {
6677
6680
  e.stopPropagation();
6678
6681
  if (loading) return;
6682
+ var sure = confirm('Are you sure you want to remove this item from cart');
6683
+ if (!sure) return;
6679
6684
  handleRemoveProduct(row);
6680
6685
  }
6681
6686
  }, /*#__PURE__*/React__default.createElement(ri.RiDeleteBin5Line, {
@@ -6894,7 +6899,7 @@ function EnhancedTable(_ref) {
6894
6899
  styles: styles,
6895
6900
  disabledSelectAllProductCheckbox: disabledSelectAllProductCheckbox
6896
6901
  }), /*#__PURE__*/React.createElement(TableBody, null, (_sortBy = lodash.sortBy(cartArray, function (o) {
6897
- return !((o === null || o === void 0 ? void 0 : o.quantity) > (o === null || o === void 0 ? void 0 : o.availableQuantity));
6902
+ return !((o === null || o === void 0 ? void 0 : o.availableQuantity) <= 0 || (o === null || o === void 0 ? void 0 : o.quantity) > (o === null || o === void 0 ? void 0 : o.availableQuantity));
6898
6903
  })) === null || _sortBy === void 0 ? void 0 : _sortBy.map(function (row, index) {
6899
6904
  var isItemSelected = isSelected(row);
6900
6905
  return /*#__PURE__*/React.createElement(CardRow, {
@@ -6914,6 +6919,8 @@ function EnhancedTable(_ref) {
6914
6919
  onClick: function onClick() {
6915
6920
  new Promise(function (resolve, reject) {
6916
6921
  if (loading) return;
6922
+ var sure = confirm('Are you sure you want to remove these items from cart');
6923
+ if (!sure) return;
6917
6924
  handleRemoveAll(selected);
6918
6925
  resolve();
6919
6926
  });
@@ -6953,6 +6960,9 @@ var CartPageProductCard = function CartPageProductCard(_ref) {
6953
6960
  }, [item]);
6954
6961
  var onChangeQuantity = function onChangeQuantity(product) {
6955
6962
  handleIncrementDecrement(product, product);
6963
+ if ((product === null || product === void 0 ? void 0 : product.quantity) <= 0 || (product === null || product === void 0 ? void 0 : product.availableQuantity) <= 0) {
6964
+ return handleRemoveProduct(product);
6965
+ }
6956
6966
  };
6957
6967
  var onChangeInput = function onChangeInput(e) {
6958
6968
  var value = e.target.value;
@@ -7011,7 +7021,7 @@ var CartPageProductCard = function CartPageProductCard(_ref) {
7011
7021
  }
7012
7022
  }, /*#__PURE__*/React__default.createElement(ai.AiOutlinePlus, null))), /*#__PURE__*/React__default.createElement("p", {
7013
7023
  className: "subtotal"
7014
- }, "subtotal: $", (item.standardPrice * item.quantity).toFixed(2))), (item === null || item === void 0 ? void 0 : item.quantity) > (item === null || item === void 0 ? void 0 : item.availableQuantity) || (item === null || item === void 0 ? void 0 : item.availableQuantity) === 0 && /*#__PURE__*/React__default.createElement("p", {
7024
+ }, "subtotal: $", (item.standardPrice * item.quantity).toFixed(2))), ((item === null || item === void 0 ? void 0 : item.quantity) > (item === null || item === void 0 ? void 0 : item.availableQuantity) || (item === null || item === void 0 ? void 0 : item.availableQuantity) <= 0) && /*#__PURE__*/React__default.createElement("p", {
7015
7025
  style: {
7016
7026
  color: 'red',
7017
7027
  fontWeight: 500
@@ -7019,13 +7029,15 @@ var CartPageProductCard = function CartPageProductCard(_ref) {
7019
7029
  }, "Maximum available quantity is ", item === null || item === void 0 ? void 0 : item.availableQuantity)), /*#__PURE__*/React__default.createElement(CloseBtn, {
7020
7030
  onClick: function onClick() {
7021
7031
  if (loading) return;
7032
+ var sure = confirm('Are you sure you want to remove this item from cart');
7033
+ if (!sure) return;
7022
7034
  handleRemoveProduct(item);
7023
7035
  }
7024
7036
  }, /*#__PURE__*/React__default.createElement(ri.RiDeleteBin5Line, null)));
7025
7037
  };
7026
7038
 
7027
7039
  var CartPageMainRetail = function CartPageMainRetail(_ref) {
7028
- var _styles$Btn, _cartData$cartLineIte;
7040
+ var _styles$Btn, _sortBy;
7029
7041
  var retail = _ref.retail,
7030
7042
  cartData = _ref.cartData,
7031
7043
  loading = _ref.loading,
@@ -7041,7 +7053,9 @@ var CartPageMainRetail = function CartPageMainRetail(_ref) {
7041
7053
  size: 40,
7042
7054
  color: styles === null || styles === void 0 ? void 0 : (_styles$Btn = styles.Btn) === null || _styles$Btn === void 0 ? void 0 : _styles$Btn.background,
7043
7055
  loading: true
7044
- })), cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.map(function (item) {
7056
+ })), (_sortBy = lodash.sortBy(cartData === null || cartData === void 0 ? void 0 : cartData.cartLineItemDtoList, function (o) {
7057
+ return !((o === null || o === void 0 ? void 0 : o.availableQuantity) <= 0 || (o === null || o === void 0 ? void 0 : o.quantity) > (o === null || o === void 0 ? void 0 : o.availableQuantity));
7058
+ })) === null || _sortBy === void 0 ? void 0 : _sortBy.map(function (item) {
7045
7059
  return /*#__PURE__*/React__default.createElement(CartPageProductCard, {
7046
7060
  item: item,
7047
7061
  loading: loading,
@@ -7439,6 +7453,9 @@ var CartPageComponent = function CartPageComponent(_ref) {
7439
7453
  };
7440
7454
  var onChangeQuantity = function onChangeQuantity(product) {
7441
7455
  handleIncrementDecrement(product, product);
7456
+ if ((product === null || product === void 0 ? void 0 : product.quantity) <= 0 || (product === null || product === void 0 ? void 0 : product.availableQuantity) <= 0) {
7457
+ return handleRemoveProduct(product);
7458
+ }
7442
7459
  };
7443
7460
  return /*#__PURE__*/React__default.createElement(CartPageSection, {
7444
7461
  bg: styles === null || styles === void 0 ? void 0 : styles.bg,
@@ -7533,6 +7550,9 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
7533
7550
  if (imgnotfoundUrl && imgnotfoundUrl !== 'null') imgnotfoundUrlcommon = imgnotfoundUrl;
7534
7551
  var onChangeQuantity = function onChangeQuantity(product) {
7535
7552
  handleIncrementDecrement(product, product);
7553
+ if ((product === null || product === void 0 ? void 0 : product.quantity) <= 0 || (product === null || product === void 0 ? void 0 : product.availableQuantity) <= 0) {
7554
+ return handleRemoveProduct(product);
7555
+ }
7536
7556
  };
7537
7557
  var onChangeInput = function onChangeInput(e) {
7538
7558
  var value = e.target.value;
@@ -8773,7 +8793,7 @@ var CardRow$1 = function CardRow(_ref) {
8773
8793
  id: row === null || row === void 0 ? void 0 : row.labelId,
8774
8794
  scope: "row",
8775
8795
  padding: "none"
8776
- }, /*#__PURE__*/React__default.createElement(ProductName$1, null, row.productName), (row.quantity > row.availableQuantity || row.availableQuantity === 0) && /*#__PURE__*/React__default.createElement("p", {
8796
+ }, /*#__PURE__*/React__default.createElement(ProductName$1, null, row.productName), (row.quantity > row.availableQuantity || row.availableQuantity <= 0) && /*#__PURE__*/React__default.createElement("p", {
8777
8797
  style: {
8778
8798
  color: 'red',
8779
8799
  fontWeight: 500