@salesgenterp/ui-components 0.4.506 → 0.4.508

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
@@ -7331,6 +7331,35 @@ if (process.env.NODE_ENV !== 'production') {
7331
7331
  }
7332
7332
  });
7333
7333
 
7334
+ var CouponDiscountName = function CouponDiscountName(_ref) {
7335
+ var discountName = _ref.discountName,
7336
+ discountAmount = _ref.discountAmount;
7337
+ return discountName ? /*#__PURE__*/React.createElement("div", {
7338
+ style: {
7339
+ display: 'flex',
7340
+ gap: 2
7341
+ }
7342
+ }, /*#__PURE__*/React.createElement("span", {
7343
+ style: {
7344
+ display: 'flex'
7345
+ }
7346
+ }, /*#__PURE__*/React.createElement(ri.RiDiscountPercentLine, null)), /*#__PURE__*/React.createElement("h5", null, discountName), discountAmount > 0 && /*#__PURE__*/React.createElement("span", {
7347
+ style: {
7348
+ fontSize: 12
7349
+ }
7350
+ }, "(", renderMoney(discountAmount * -1), ")")) : /*#__PURE__*/React.createElement(React.Fragment, null);
7351
+ };
7352
+ var TotalAfterDiscount = function TotalAfterDiscount(_ref2) {
7353
+ var totalAmount = _ref2.totalAmount,
7354
+ discountAmount = _ref2.discountAmount;
7355
+ var total = totalAmount - discountAmount > 0 ? totalAmount - discountAmount : 0;
7356
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, discountAmount > 0 ? /*#__PURE__*/React.createElement("del", {
7357
+ style: {
7358
+ fontSize: 12
7359
+ }
7360
+ }, renderMoney(totalAmount)) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement("b", null, renderMoney(total))));
7361
+ };
7362
+
7334
7363
  var _templateObject$t, _templateObject2$l, _templateObject3$f, _templateObject4$c, _templateObject5$8, _templateObject6$6;
7335
7364
  var ProductImage = styled__default.img(_templateObject$t || (_templateObject$t = _taggedTemplateLiteralLoose(["\n min-width: 60px;\n min-height: 60px;\n object-fit: contain;\n @media only screen and (max-width: 600px) {\n margin: 0.5em 0;\n padding-right: 0.5em;\n }\n"])));
7336
7365
  var ProductName = styled__default.h6(_templateObject2$l || (_templateObject2$l = _taggedTemplateLiteralLoose(["\n font-size: ", ";\n padding: 0;\n line-height: 1.3em;\n overflow: hidden;\n text-overflow: ellipsis;\n height: fit-content;\n cursor: pointer;\n"])), function (props) {
@@ -7437,7 +7466,10 @@ var CardRow = function CardRow(_ref) {
7437
7466
  event.stopPropagation();
7438
7467
  clickRedirect(row);
7439
7468
  }
7440
- }, 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", {
7469
+ }, row.productName), /*#__PURE__*/React__default.createElement(CouponDiscountName, {
7470
+ discountAmount: row === null || row === void 0 ? void 0 : row.discountAmount,
7471
+ discountName: row === null || row === void 0 ? void 0 : row.couponDiscount
7472
+ }), ((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", {
7441
7473
  style: {
7442
7474
  color: 'red',
7443
7475
  fontWeight: 500
@@ -7452,14 +7484,10 @@ var CardRow = function CardRow(_ref) {
7452
7484
  className: "CartnoBelowSm"
7453
7485
  }, /*#__PURE__*/React__default.createElement("p", {
7454
7486
  className: "price"
7455
- }, (row === null || row === void 0 ? void 0 : row.standardPrice) > (row === null || row === void 0 ? void 0 : row.standardPrice) - (row === null || row === void 0 ? void 0 : row.discountAmount) && /*#__PURE__*/React__default.createElement("span", {
7456
- style: {
7457
- fontSize: '1rem',
7458
- color: 'grey',
7459
- textDecoration: 'line-through',
7460
- marginRight: '0.5rem'
7461
- }
7462
- }, "$", row === null || row === void 0 ? void 0 : row.standardPrice.toFixed(2)), "$", ((row === null || row === void 0 ? void 0 : row.standardPrice) - (row === null || row === void 0 ? void 0 : row.discountAmount)).toFixed(2))), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
7487
+ }, /*#__PURE__*/React__default.createElement(TotalAfterDiscount, {
7488
+ totalAmount: row === null || row === void 0 ? void 0 : row.standardPrice,
7489
+ discountAmount: row === null || row === void 0 ? void 0 : row.discountAmount
7490
+ }))), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
7463
7491
  align: "center"
7464
7492
  }, /*#__PURE__*/React__default.createElement(QuantityBox, null, /*#__PURE__*/React__default.createElement("span", {
7465
7493
  className: "icon",
@@ -7512,7 +7540,10 @@ var CardRow = function CardRow(_ref) {
7512
7540
  className: "CartnoPaddingSm"
7513
7541
  }, /*#__PURE__*/React__default.createElement("p", {
7514
7542
  className: "price"
7515
- }, "$", ((row === null || row === void 0 ? void 0 : row.standardPrice) * (row === null || row === void 0 ? void 0 : row.quantity) - (row === null || row === void 0 ? void 0 : row.discountAmount) * (row === null || row === void 0 ? void 0 : row.quantity)).toFixed(2))), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
7543
+ }, /*#__PURE__*/React__default.createElement(TotalAfterDiscount, {
7544
+ totalAmount: ((row === null || row === void 0 ? void 0 : row.standardPrice) - (row === null || row === void 0 ? void 0 : row.discountAmount)) * (row === null || row === void 0 ? void 0 : row.quantity),
7545
+ discountAmount: row === null || row === void 0 ? void 0 : row.couponDiscount
7546
+ }))), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
7516
7547
  alig: "center"
7517
7548
  }, /*#__PURE__*/React__default.createElement(DeleteBtn, {
7518
7549
  onClick: function onClick(e) {
@@ -7789,7 +7820,7 @@ var CartPageImg = styled__default.img(_templateObject2$m || (_templateObject2$m
7789
7820
  });
7790
7821
  var NameAndQtBox = styled__default.div(_templateObject3$g || (_templateObject3$g = _taggedTemplateLiteralLoose(["\n width: 90%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n position: relative;\n"])));
7791
7822
  var CartPageCardName = styled__default.div(_templateObject4$d || (_templateObject4$d = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n width: 90%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 0.6em;\n h6 {\n color: #323232;\n font-size: 0.9em;\n margin-bottom: 0.6em;\n line-height: 1.3em;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n p {\n font-size: 1.1em;\n font-weight: 600;\n color: #323232;\n }\n"])));
7792
- var QtAndPriceBox = styled__default.div(_templateObject5$9 || (_templateObject5$9 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n width: 100%;\n .subtotal {\n color: #323232;\n text-transform: capitalize;\n font-weight: bold;\n font-size: 1em;\n }\n"])));
7823
+ var QtAndPriceBox = styled__default.div(_templateObject5$9 || (_templateObject5$9 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n width: 100%;\n font-size: 1.1em;\n"])));
7793
7824
  var CartPageQtBox = styled__default.div(_templateObject6$7 || (_templateObject6$7 = _taggedTemplateLiteralLoose(["\n height: 30px;\n width: 86px;\n border: 1px solid rgb(211, 210, 210);\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 13.5px;\n color: #323232;\n padding: 0 0.5rem;\n border-radius: 5px;\n max-width: 100%;\n .icon {\n cursor: pointer;\n height: 100%;\n display: grid;\n place-items: center;\n }\n .qt {\n font-size: 12px;\n color: black;\n font-weight: 500;\n cursor: auto;\n height: 100%;\n input {\n width: 40px;\n height: 100%;\n text-align: center;\n border: none;\n }\n }\n"])));
7794
7825
  var CloseBtn = styled__default.div(_templateObject7$5 || (_templateObject7$5 = _taggedTemplateLiteralLoose(["\n width: 25px;\n height: 25px;\n display: grid;\n place-items: center;\n position: absolute;\n top: 1em;\n right: 1em;\n cursor: pointer;\n border-radius: 50%;\n background: #eef1f4;\n font-size: 12px;\n &:hover {\n color: #ffffff;\n background: red;\n }\n"])));
7795
7826
 
@@ -7842,7 +7873,7 @@ var CartPageProductCard = function CartPageProductCard(_ref) {
7842
7873
  alt: 'img',
7843
7874
  width: imgSize === null || imgSize === void 0 ? void 0 : imgSize.width,
7844
7875
  height: imgSize === null || imgSize === void 0 ? void 0 : imgSize.height
7845
- }), /*#__PURE__*/React__default.createElement(NameAndQtBox, null, /*#__PURE__*/React__default.createElement(CartPageCardName, null, /*#__PURE__*/React__default.createElement(material.Tooltip, {
7876
+ }), /*#__PURE__*/React__default.createElement(NameAndQtBox, null, /*#__PURE__*/React__default.createElement(CartPageCardName, null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(material.Tooltip, {
7846
7877
  title: item.productName,
7847
7878
  placement: "top",
7848
7879
  arrow: true
@@ -7850,7 +7881,13 @@ var CartPageProductCard = function CartPageProductCard(_ref) {
7850
7881
  onClick: function onClick() {
7851
7882
  return clickRedirect(item);
7852
7883
  }
7853
- }, item.productName)), !doNotShowPrice && /*#__PURE__*/React__default.createElement("p", null, renderMoney(item.standardPrice))), /*#__PURE__*/React__default.createElement(QtAndPriceBox, null, /*#__PURE__*/React__default.createElement(CartPageQtBox, null, /*#__PURE__*/React__default.createElement("span", {
7884
+ }, item.productName)), /*#__PURE__*/React__default.createElement(CouponDiscountName, {
7885
+ discountAmount: item === null || item === void 0 ? void 0 : item.discountAmount,
7886
+ discountName: item === null || item === void 0 ? void 0 : item.couponDiscount
7887
+ })), !doNotShowPrice && /*#__PURE__*/React__default.createElement("p", null, /*#__PURE__*/React__default.createElement(TotalAfterDiscount, {
7888
+ totalAmount: item === null || item === void 0 ? void 0 : item.standardPrice,
7889
+ discountAmount: item === null || item === void 0 ? void 0 : item.discountAmount
7890
+ }))), /*#__PURE__*/React__default.createElement(QtAndPriceBox, null, /*#__PURE__*/React__default.createElement(CartPageQtBox, null, /*#__PURE__*/React__default.createElement("span", {
7854
7891
  className: "icon",
7855
7892
  onClick: function onClick() {
7856
7893
  if (loading) return;
@@ -7880,9 +7917,10 @@ var CartPageProductCard = function CartPageProductCard(_ref) {
7880
7917
  })
7881
7918
  }));
7882
7919
  }
7883
- }, /*#__PURE__*/React__default.createElement(ai.AiOutlinePlus, null))), !doNotShowPrice && /*#__PURE__*/React__default.createElement("p", {
7884
- className: "subtotal"
7885
- }, "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", {
7920
+ }, /*#__PURE__*/React__default.createElement(ai.AiOutlinePlus, null))), !doNotShowPrice && /*#__PURE__*/React__default.createElement("p", null, /*#__PURE__*/React__default.createElement(TotalAfterDiscount, {
7921
+ totalAmount: ((item === null || item === void 0 ? void 0 : item.standardPrice) - (item === null || item === void 0 ? void 0 : item.discountAmount)) * item.quantity,
7922
+ discountAmount: item === null || item === void 0 ? void 0 : item.couponDiscount
7923
+ }))), ((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", {
7886
7924
  style: {
7887
7925
  color: 'red',
7888
7926
  fontWeight: 500
@@ -8418,7 +8456,7 @@ var checkMinMaxQty = function checkMinMaxQty(_ref2) {
8418
8456
  };
8419
8457
 
8420
8458
  var _templateObject$w, _templateObject2$o, _templateObject3$i;
8421
- var CartDrawerProduct = styled__default.div(_templateObject$w || (_templateObject$w = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n height: 100px;\n justify-content: space-around;\n align-items: center;\n overflow: hidden;\n margin-bottom: 1rem;\n user-select: none;\n background: #f2f2f290;\n border: 1px solid #f2f2f290;\n padding: 0.5rem;\n border-radius: 12px;\n\n img {\n width: 20%;\n max-height: 100%;\n /* aspect-ratio: 1; */\n object-fit: contain;\n }\n .middleSection {\n width: 60%;\n padding-left: 0.8rem;\n height: 100%;\n h6 {\n font-size: 1.1rem;\n font-weight: bold;\n margin: 0;\n\n span {\n font-size: 0.8rem;\n color: grey;\n text-decoration: line-through;\n margin-right: 0.5rem;\n }\n }\n .name {\n font-size: 0.9rem;\n line-height: 1.2rem;\n width: 100%;\n word-wrap: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n transition: 0.3s;\n cursor: pointer;\n &:hover {\n color: ", ";\n }\n }\n }\n .endSection {\n // width: 20%;\n height: 95%;\n .icon {\n cursor: pointer;\n transition: 0.4s;\n &:hover {\n color: red;\n }\n }\n }\n @media only screen and (max-width: 768px) {\n .closeIcon {\n font-size: 1rem;\n }\n }\n @media only screen and (max-width: 340px) {\n .middleSection {\n h6 {\n font-size: 0.9rem;\n }\n }\n }\n"])), function (props) {
8459
+ var CartDrawerProduct = styled__default.div(_templateObject$w || (_templateObject$w = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n height: 100px;\n justify-content: space-around;\n align-items: center;\n overflow: hidden;\n margin-bottom: 1rem;\n user-select: none;\n background: #f2f2f290;\n border: 1px solid #f2f2f290;\n padding: 0.5rem;\n border-radius: 12px;\n\n img {\n width: 20%;\n max-height: 100%;\n /* aspect-ratio: 1; */\n object-fit: contain;\n }\n .middleSection {\n width: 60%;\n padding-left: 0.8rem;\n height: 100%;\n h6 {\n font-size: 1.1rem;\n font-weight: bold;\n margin: 0;\n }\n .name {\n font-size: 0.9rem;\n line-height: 1.2rem;\n width: 100%;\n word-wrap: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n transition: 0.3s;\n cursor: pointer;\n &:hover {\n color: ", ";\n }\n }\n }\n .endSection {\n // width: 20%;\n height: 95%;\n .icon {\n cursor: pointer;\n transition: 0.4s;\n &:hover {\n color: red;\n }\n }\n }\n @media only screen and (max-width: 768px) {\n .closeIcon {\n font-size: 1rem;\n }\n }\n @media only screen and (max-width: 340px) {\n .middleSection {\n h6 {\n font-size: 0.9rem;\n }\n }\n }\n"])), function (props) {
8422
8460
  return props.color || 'grey';
8423
8461
  });
8424
8462
  var CartDrawerQtBox = styled__default.div(_templateObject2$o || (_templateObject2$o = _taggedTemplateLiteralLoose(["\n height: 30px;\n width: 86px;\n border: 1px solid rgb(211, 210, 210);\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 13.5px;\n color: #323232;\n padding: 0 0.5rem;\n border-radius: 5px;\n max-width: 100%;\n span {\n cursor: pointer;\n height: 100%;\n display: grid;\n place-items: center;\n }\n .qt {\n font-size: 12px;\n color: black;\n font-weight: 500;\n cursor: auto;\n input {\n width: 40px;\n height: 100%;\n text-align: center;\n border: none;\n }\n }\n @media only screen and (max-width: 600px) {\n min-width: 55px;\n aspect-ratio: 1/2;\n font-size: 10px;\n }\n @media only screen and (max-width: 340px) {\n min-width: 50px;\n aspect-ratio: 1/2;\n height: 22px;\n font-size: 8px;\n }\n"])));
@@ -8478,7 +8516,7 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
8478
8516
  justifyContent: "space-between",
8479
8517
  alignItems: "flex-start",
8480
8518
  className: "middleSection"
8481
- }, /*#__PURE__*/React__default.createElement(material.Tooltip, {
8519
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(material.Tooltip, {
8482
8520
  title: product === null || product === void 0 ? void 0 : product.productName,
8483
8521
  placement: "top",
8484
8522
  arrow: true
@@ -8487,7 +8525,13 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
8487
8525
  onClick: function onClick() {
8488
8526
  return handleRedirect(product);
8489
8527
  }
8490
- }, product === null || product === void 0 ? void 0 : product.productName)), !doNotShowPrice && /*#__PURE__*/React__default.createElement("h6", null, !((product === null || product === void 0 ? void 0 : product.standardPrice) > (product === null || product === void 0 ? void 0 : product.standardPrice) - (product === null || product === void 0 ? void 0 : product.discountAmount)) ? "$" + ((product === null || product === void 0 ? void 0 : product.standardPrice) - (product === null || product === void 0 ? void 0 : product.discountAmount)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", null, renderMoney(product === null || product === void 0 ? void 0 : product.standardPrice)), renderMoney((product === null || product === void 0 ? void 0 : product.standardPrice) - (product === null || product === void 0 ? void 0 : product.discountAmount))))), /*#__PURE__*/React__default.createElement(material.Stack, {
8528
+ }, product === null || product === void 0 ? void 0 : product.productName)), /*#__PURE__*/React__default.createElement(CouponDiscountName, {
8529
+ discountName: product === null || product === void 0 ? void 0 : product.discountName,
8530
+ discountAmount: product === null || product === void 0 ? void 0 : product.couponDiscount
8531
+ })), !doNotShowPrice && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h6", null, /*#__PURE__*/React__default.createElement(TotalAfterDiscount, {
8532
+ totalAmount: product === null || product === void 0 ? void 0 : product.standardPrice,
8533
+ discountAmount: product === null || product === void 0 ? void 0 : product.discountAmount
8534
+ })))), /*#__PURE__*/React__default.createElement(material.Stack, {
8491
8535
  flexDirection: "column",
8492
8536
  justifyContent: "space-between",
8493
8537
  alignItems: "flex-end",
@@ -12761,7 +12805,7 @@ var Step4 = function Step4(_ref) {
12761
12805
  },
12762
12806
  size: "small"
12763
12807
  }, /*#__PURE__*/React__default.createElement(material.TableBody, null, cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.map(function (row, i) {
12764
- var _styles$input, _row$standardPrice, _ref2;
12808
+ var _styles$input;
12765
12809
  return /*#__PURE__*/React__default.createElement(StyledTableRow, {
12766
12810
  key: row.name,
12767
12811
  colored: i % 2 === 0,
@@ -12783,13 +12827,16 @@ var Step4 = function Step4(_ref) {
12783
12827
  color: styles === null || styles === void 0 ? void 0 : styles.bg
12784
12828
  }, /*#__PURE__*/React__default.createElement("p", {
12785
12829
  className: "price max"
12786
- }, (_row$standardPrice = row.standardPrice) === null || _row$standardPrice === void 0 ? void 0 : _row$standardPrice.toFixed(2), /*#__PURE__*/React__default.createElement("span", {
12830
+ }, renderMoney(row.standardPrice), /*#__PURE__*/React__default.createElement("span", {
12787
12831
  className: "red primaryColor"
12788
12832
  }, ' ', "x ", row.quantity))), /*#__PURE__*/React__default.createElement(StyledTableCell, {
12789
12833
  align: "right"
12790
12834
  }, /*#__PURE__*/React__default.createElement("p", {
12791
12835
  className: "price max"
12792
- }, "$", (_ref2 = row.quantity * (row === null || row === void 0 ? void 0 : row.standardPrice)) === null || _ref2 === void 0 ? void 0 : _ref2.toFixed(2)))));
12836
+ }, /*#__PURE__*/React__default.createElement(TotalAfterDiscount, {
12837
+ totalAmount: (row === null || row === void 0 ? void 0 : row.standardPrice) * row.quantity,
12838
+ discountAmount: 0
12839
+ })))));
12793
12840
  }), doNotShowPrice ? /*#__PURE__*/React__default.createElement(StyledTableRow, null, /*#__PURE__*/React__default.createElement(StyledTableCell, {
12794
12841
  colSpan: 1,
12795
12842
  noSmall: true