s-platform-landing-section 0.1.21 → 0.1.23

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
@@ -22,6 +22,7 @@ require('slick-carousel/slick/slick-theme.css');
22
22
  var ai = require('react-icons/ai');
23
23
  var go = require('react-icons/go');
24
24
  var hi = require('react-icons/hi');
25
+ var md = require('react-icons/md');
25
26
  var ri = require('react-icons/ri');
26
27
  var gi = require('react-icons/gi');
27
28
 
@@ -132,7 +133,7 @@ var getLinkNewsDetail = function getLinkNewsDetail(news) {
132
133
  };
133
134
  var getLinkNewsByCategory = function getLinkNewsByCategory(news) {
134
135
  var slug = genProductSlugVi(news === null || news === void 0 ? void 0 : news.catName, news === null || news === void 0 ? void 0 : news.catId);
135
- return "/tin-tuc/" + slug;
136
+ return "/tin-tuc-theo-danh-muc/" + slug;
136
137
  };
137
138
  var getLinkProductsByCategory = function getLinkProductsByCategory(product) {
138
139
  if (product !== null && product !== void 0 && product.categoryName) {
@@ -149,7 +150,6 @@ var LinkToPage = function LinkToPage(props) {
149
150
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
150
151
  return Link ? /*#__PURE__*/React__default.createElement(Link, otherProps, props.children) : /*#__PURE__*/React__default.createElement("a", otherProps, props.children);
151
152
  };
152
- var SSHOP_SPA_TOKEN = "sshop-spa-token";
153
153
  var genLinkSearch = function genLinkSearch(keyword) {
154
154
  return "/tim-kiem?tu-khoa=" + keyword;
155
155
  };
@@ -539,7 +539,8 @@ var NavBar1 = function NavBar1(props) {
539
539
  _props$useSelector = props.useSelector,
540
540
  useSelector = _props$useSelector === void 0 ? null : _props$useSelector,
541
541
  _props$logout = props.logout,
542
- logout = _props$logout === void 0 ? function () {} : _props$logout;
542
+ logout = _props$logout === void 0 ? function () {} : _props$logout,
543
+ data = props.data;
543
544
  var cartItems = useSelector === null || useSelector === void 0 ? void 0 : useSelector(function (state) {
544
545
  var _state$cart;
545
546
  return state === null || state === void 0 ? void 0 : (_state$cart = state.cart) === null || _state$cart === void 0 ? void 0 : _state$cart.items;
@@ -597,7 +598,11 @@ var NavBar1 = function NavBar1(props) {
597
598
  top: "-100px"
598
599
  }
599
600
  }, shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.defaultDomain, " | ", shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopName), /*#__PURE__*/React__default.createElement("div", {
600
- className: "hidden lg:flex justify-end items-center gap-6 px-20 py-2 bg-primary"
601
+ className: "hidden lg:flex justify-between items-center px-20 py-2 bg-primary"
602
+ }, /*#__PURE__*/React__default.createElement("div", {
603
+ className: "text-background text-xl"
604
+ }, data === null || data === void 0 ? void 0 : data.title), /*#__PURE__*/React__default.createElement("div", {
605
+ className: "flex gap-6 "
601
606
  }, shopConfig !== null && shopConfig !== void 0 && shopConfig.shopPhone ? /*#__PURE__*/React__default.createElement("div", {
602
607
  className: "font-medium border-r pr-6 text-background"
603
608
  }, "Hotline: ", shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopPhone) : null, /*#__PURE__*/React__default.createElement("div", {
@@ -620,7 +625,7 @@ var NavBar1 = function NavBar1(props) {
620
625
  }, /*#__PURE__*/React__default.createElement(si.SiZalo, {
621
626
  size: 24,
622
627
  className: "p-1 rounded bg-background text-primary"
623
- })))), /*#__PURE__*/React__default.createElement("div", {
628
+ }))))), /*#__PURE__*/React__default.createElement("div", {
624
629
  className: "hidden lg:flex gap-6 justify-between items-center py-2 px-4 xl:px-20 sticky top-0 z-50 bg-background shadow "
625
630
  }, /*#__PURE__*/React__default.createElement(LinkToPage, {
626
631
  Link: Link,
@@ -879,6 +884,8 @@ var Input = React.forwardRef(function (props, ref) {
879
884
  style = _props$style === void 0 ? {} : _props$style,
880
885
  _props$onChange = props.onChange,
881
886
  onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
887
+ _props$onKeyDown = props.onKeyDown,
888
+ onKeyDown = _props$onKeyDown === void 0 ? function () {} : _props$onKeyDown,
882
889
  _props$disabled = props.disabled,
883
890
  disabled = _props$disabled === void 0 ? false : _props$disabled,
884
891
  _props$defaultValue = props.defaultValue,
@@ -957,6 +964,9 @@ var Input = React.forwardRef(function (props, ref) {
957
964
  _setValue(value);
958
965
  onChange === null || onChange === void 0 ? void 0 : onChange(value);
959
966
  };
967
+ var handleOnKeyDown = function handleOnKeyDown(e) {
968
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
969
+ };
960
970
  var changeQuantity = function changeQuantity(quantity) {
961
971
  var newValue = parseInt(value) + quantity;
962
972
  if (!disabled && newValue > min && (max === null || newValue <= max)) {
@@ -997,7 +1007,10 @@ var Input = React.forwardRef(function (props, ref) {
997
1007
  onChange: handleOnChange,
998
1008
  required: required,
999
1009
  className: _inputClassName,
1000
- ref: refInput
1010
+ ref: refInput,
1011
+ onKeyDown: function onKeyDown(e) {
1012
+ handleOnKeyDown(e);
1013
+ }
1001
1014
  }), suffix ? /*#__PURE__*/React__default.createElement("div", null, suffix) : null, isHidden ? /*#__PURE__*/React__default.createElement("button", {
1002
1015
  onClick: function onClick() {
1003
1016
  changeHidden();
@@ -1017,12 +1030,19 @@ var Hero1 = function Hero1(props) {
1017
1030
  var _sectionData$, _sectionData$$srcImag, _sectionData$2, _sectionData$3, _sectionData$4, _sectionData$4$button, _sectionData$4$button2, _sectionData$5, _sectionData$5$button, _sectionData$5$button2, _sectionData$6, _sectionData$6$button, _sectionData$6$button2;
1018
1031
  var shopConfigStyle = props.shopConfigStyle,
1019
1032
  data = props.data,
1033
+ _props$router = props.router,
1034
+ router = _props$router === void 0 ? function () {} : _props$router,
1020
1035
  _props$Link = props.Link,
1021
1036
  Link = _props$Link === void 0 ? null : _props$Link;
1022
1037
  var _useState = React.useState(""),
1023
1038
  value = _useState[0],
1024
1039
  setValue = _useState[1];
1025
1040
  var sectionData = data === null || data === void 0 ? void 0 : data.data;
1041
+ var handleSearch = function handleSearch(e) {
1042
+ if ((e === null || e === void 0 ? void 0 : e.key) === "Enter" && value && value.length > 0) {
1043
+ router === null || router === void 0 ? void 0 : router.push(genLinkSearch(value));
1044
+ }
1045
+ };
1026
1046
  return /*#__PURE__*/React__default.createElement("div", {
1027
1047
  style: {
1028
1048
  backgroundImage: "url(" + (sectionData === null || sectionData === void 0 ? void 0 : (_sectionData$ = sectionData[0]) === null || _sectionData$ === void 0 ? void 0 : (_sectionData$$srcImag = _sectionData$.srcImages) === null || _sectionData$$srcImag === void 0 ? void 0 : _sectionData$$srcImag[0]) + ")"
@@ -1050,6 +1070,9 @@ var Hero1 = function Hero1(props) {
1050
1070
  icons: /*#__PURE__*/React__default.createElement(io5.IoSearchOutline, null),
1051
1071
  wrapClassName: "w-full",
1052
1072
  inputClassName: "w-full",
1073
+ onKeyDown: function onKeyDown(e) {
1074
+ handleSearch(e);
1075
+ },
1053
1076
  onChange: setValue
1054
1077
  }), value && (value === null || value === void 0 ? void 0 : value.length) > 0 ? /*#__PURE__*/React__default.createElement(LinkToPage, {
1055
1078
  Link: Link,
@@ -1076,7 +1099,7 @@ var Hero2 = function Hero2(props) {
1076
1099
  alt: data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : (_data$data2$ = _data$data2[0]) === null || _data$data2$ === void 0 ? void 0 : _data$data2$.title,
1077
1100
  className: "w-full object-cover min-h-[30vh] md:min-h-[50vh] max-h-[100vh]"
1078
1101
  }), /*#__PURE__*/React__default.createElement("div", {
1079
- className: "absolute flex flex-col gap-1 md:gap-4 absolute w-1/2 lg:w-1/3 top-2 sm:top-[20%] xl:top-1/4 right-[2%] lg:right-[15%]"
1102
+ className: "absolute flex flex-col gap-1 md:gap-4 absolute w-1/2 lg:w-[40%] top-2 sm:top-[20%] xl:top-1/4 right-[2%] lg:right-[15%]"
1080
1103
  }, /*#__PURE__*/React__default.createElement("img", {
1081
1104
  src: shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.logoUrl,
1082
1105
  alt: shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopName,
@@ -7583,6 +7606,11 @@ var ProductController = function ProductController(props) {
7583
7606
  var _res$data2, _res$data3;
7584
7607
  setProducts(res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.data);
7585
7608
  setPage(res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.page);
7609
+ var url = new URL(window.location.href);
7610
+ if (/^(\/(danh-muc))\/[^/]+-\d+$/.test(url.pathname)) {
7611
+ url.pathname = url.pathname.replace(/\/[^/]+-\d+$/, "");
7612
+ window.history.replaceState({}, '', url.pathname + url.search);
7613
+ }
7586
7614
  }
7587
7615
  setLoading(false);
7588
7616
  });
@@ -7621,6 +7649,7 @@ var ProductController = function ProductController(props) {
7621
7649
  };
7622
7650
  return {
7623
7651
  products: products,
7652
+ setProducts: setProducts,
7624
7653
  loading: loading,
7625
7654
  page: page,
7626
7655
  getProductListSearch: getProductListSearch
@@ -8021,10 +8050,12 @@ var TreatmentsCategory7 = function TreatmentsCategory7(props) {
8021
8050
  }, /*#__PURE__*/React__default.createElement(Loading, null)) : products !== null && products !== void 0 && products.length ? /*#__PURE__*/React__default.createElement("div", {
8022
8051
  className: "grid grid-cols-1 md:grid-cols-2 gap-10 mt-6"
8023
8052
  }, products === null || products === void 0 ? void 0 : products.map(function (product, index) {
8024
- return /*#__PURE__*/React__default.createElement(ProductItem1, {
8053
+ return /*#__PURE__*/React__default.createElement(LinkToPage, {
8025
8054
  key: index,
8055
+ href: getLinkServiceDetail(product === null || product === void 0 ? void 0 : product.productInfo)
8056
+ }, /*#__PURE__*/React__default.createElement(ProductItem1, {
8026
8057
  product: product === null || product === void 0 ? void 0 : product.productInfo
8027
- });
8058
+ }));
8028
8059
  })) : /*#__PURE__*/React__default.createElement("div", {
8029
8060
  className: "text-gray3 text-center p-12"
8030
8061
  }, "Kh\xF4ng c\xF3 d\u1ECBch v\u1EE5")), /*#__PURE__*/React__default.createElement(Dash, {
@@ -8111,6 +8142,12 @@ var ModalNotification = function ModalNotification(props) {
8111
8142
  style = _props$style === void 0 ? {} : _props$style,
8112
8143
  _props$buttonClassNam = props.buttonClassName,
8113
8144
  buttonClassName = _props$buttonClassNam === void 0 ? "" : _props$buttonClassNam;
8145
+ React.useEffect(function () {
8146
+ document.body.style.overflow = "hidden";
8147
+ return function () {
8148
+ document.body.style.overflow = "auto";
8149
+ };
8150
+ }, []);
8114
8151
  var handleClickOutside = function handleClickOutside(event) {
8115
8152
  event.stopPropagation();
8116
8153
  if (onClose) {
@@ -8122,7 +8159,9 @@ var ModalNotification = function ModalNotification(props) {
8122
8159
  };
8123
8160
  return /*#__PURE__*/React__default.createElement("div", {
8124
8161
  className: "fixed inset-0 bg-black flex items-center justify-center bg-opacity-50 z-50 ",
8125
- onClick: handleClickOutside
8162
+ onClick: function onClick(e) {
8163
+ return handleClickOutside(e);
8164
+ }
8126
8165
  }, /*#__PURE__*/React__default.createElement("div", {
8127
8166
  className: "flex items-center justify-center relative " + className,
8128
8167
  onClick: function onClick(e) {
@@ -8132,7 +8171,9 @@ var ModalNotification = function ModalNotification(props) {
8132
8171
  ref: modalRef
8133
8172
  }, props === null || props === void 0 ? void 0 : props.children, isButtonClose && /*#__PURE__*/React__default.createElement("button", {
8134
8173
  className: "absolute top-4 right-4 " + buttonClassName,
8135
- onClick: onClose
8174
+ onClick: function onClick(e) {
8175
+ return handleClickOutside(e);
8176
+ }
8136
8177
  }, /*#__PURE__*/React__default.createElement(rx.RxCross2, null))));
8137
8178
  };
8138
8179
 
@@ -8900,7 +8941,9 @@ var BookingForm = function BookingForm(props) {
8900
8941
  _props$defaultValue = props.defaultValue,
8901
8942
  defaultValue = _props$defaultValue === void 0 ? [] : _props$defaultValue,
8902
8943
  _props$className = props.className,
8903
- className = _props$className === void 0 ? "" : _props$className;
8944
+ className = _props$className === void 0 ? "" : _props$className,
8945
+ _props$isModalBooking = props.isModalBooking,
8946
+ isModalBooking = _props$isModalBooking === void 0 ? false : _props$isModalBooking;
8904
8947
  var _shopConfigStyle$colo = shopConfigStyle === null || shopConfigStyle === void 0 ? void 0 : shopConfigStyle.color,
8905
8948
  _shopConfigStyle$colo5 = _shopConfigStyle$colo.background,
8906
8949
  background = _shopConfigStyle$colo5 === void 0 ? "#fff" : _shopConfigStyle$colo5;
@@ -8927,13 +8970,12 @@ var BookingForm = function BookingForm(props) {
8927
8970
  var _useState7 = React.useState(false),
8928
8971
  isOpenPopup = _useState7[0],
8929
8972
  setIsOpenPopup = _useState7[1];
8930
- var _useState8 = React.useState({}),
8931
- dataBooking = _useState8[0],
8932
- setDataBooking = _useState8[1];
8973
+ var _useState8 = React.useState(false),
8974
+ isHiddenForm = _useState8[0],
8975
+ setIsHiddenForm = _useState8[1];
8933
8976
  var _EmployeeController = EmployeeController(_extends({}, props)),
8934
8977
  _EmployeeController$l = _EmployeeController.listEmployment,
8935
8978
  listEmployment = _EmployeeController$l === void 0 ? [] : _EmployeeController$l;
8936
- var token = js_cookie === null || js_cookie === void 0 ? void 0 : js_cookie.get(SSHOP_SPA_TOKEN);
8937
8979
  var _ProductController = ProductController(_extends({}, props, {
8938
8980
  params: productsParams
8939
8981
  })),
@@ -9056,11 +9098,14 @@ var BookingForm = function BookingForm(props) {
9056
9098
  return Promise.resolve(createSchedule(customerName, customerPhone, scheduleDate, services, shopId)).then(function (response) {
9057
9099
  var _response$data, _response$data$status;
9058
9100
  if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$status = _response$data.status) === null || _response$data$status === void 0 ? void 0 : _response$data$status.code) === '200') {
9059
- var _response$data2, _inputPhoneNumberRef$3, _inputNameRef$current3;
9060
- setDataBooking(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.data);
9101
+ var _inputPhoneNumberRef$3, _inputNameRef$current3, _inputDateRef$current4;
9102
+ if (isModalBooking) {
9103
+ setIsHiddenForm(true);
9104
+ }
9061
9105
  setIsOpenPopup(true);
9062
9106
  inputPhoneNumberRef === null || inputPhoneNumberRef === void 0 ? void 0 : (_inputPhoneNumberRef$3 = inputPhoneNumberRef.current) === null || _inputPhoneNumberRef$3 === void 0 ? void 0 : _inputPhoneNumberRef$3.setValue("");
9063
9107
  inputNameRef === null || inputNameRef === void 0 ? void 0 : (_inputNameRef$current3 = inputNameRef.current) === null || _inputNameRef$current3 === void 0 ? void 0 : _inputNameRef$current3.setValue("");
9108
+ inputDateRef === null || inputDateRef === void 0 ? void 0 : (_inputDateRef$current4 = inputDateRef.current) === null || _inputDateRef$current4 === void 0 ? void 0 : _inputDateRef$current4.setValue(new Date());
9064
9109
  setListProductSelected([]);
9065
9110
  }
9066
9111
  });
@@ -9073,7 +9118,7 @@ var BookingForm = function BookingForm(props) {
9073
9118
  };
9074
9119
  var handleClosePopup = function handleClosePopup() {
9075
9120
  setIsOpenPopup(false);
9076
- setDataBooking({});
9121
+ setIsHiddenForm(false);
9077
9122
  };
9078
9123
  var handleSearchProducts = function handleSearchProducts(value) {
9079
9124
  setProductsParams(function (prev) {
@@ -9082,7 +9127,7 @@ var BookingForm = function BookingForm(props) {
9082
9127
  });
9083
9128
  });
9084
9129
  };
9085
- return /*#__PURE__*/React__default.createElement("div", {
9130
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !isHiddenForm ? /*#__PURE__*/React__default.createElement("div", {
9086
9131
  className: "grid gap-4 rounded-2xl p-6 border " + className,
9087
9132
  style: {
9088
9133
  backgroundColor: background
@@ -9101,6 +9146,7 @@ var BookingForm = function BookingForm(props) {
9101
9146
  inputClassName: "w-full focus:outline-none focus:ring-0"
9102
9147
  }), /*#__PURE__*/React__default.createElement(InputPhoneNumber, {
9103
9148
  ref: inputPhoneNumberRef,
9149
+ name: "customerPhone",
9104
9150
  label: "Số điện thoại",
9105
9151
  placeholder: "Nhập số điện thoại",
9106
9152
  rules: [{
@@ -9214,32 +9260,23 @@ var BookingForm = function BookingForm(props) {
9214
9260
  label: "Đặt lịch ngay",
9215
9261
  shopConfigStyle: shopConfigStyle,
9216
9262
  onClick: handleSubmit
9217
- })), isOpenPopup && /*#__PURE__*/React__default.createElement(ModalNotification, {
9263
+ }))) : null, isOpenPopup && /*#__PURE__*/React__default.createElement(ModalNotification, {
9218
9264
  onCloseFormBooking: onCloseFormBooking,
9219
9265
  onClose: handleClosePopup
9220
9266
  }, /*#__PURE__*/React__default.createElement("div", {
9221
- className: "bg-white rounded-lg shadow-lg p-6 max-w-sm flex flex-col items-center justify-center min-w-[320px] md:min-w-[650px] min-h-[420px] md:min-h-[380px] lg:h-auto "
9267
+ className: "bg-white rounded-lg shadow-lg p-6 lg:px-16 lg:pb-10 max-w-sm flex gap-4 flex-col items-center justify-center"
9222
9268
  }, /*#__PURE__*/React__default.createElement("div", {
9223
- className: "h-20 mb-4 flex items-center justify-center"
9269
+ className: "flex items-center justify-center"
9224
9270
  }, /*#__PURE__*/React__default.createElement(fa.FaCheckCircle, {
9225
9271
  className: "h-full text-green-500",
9226
9272
  style: {
9227
- fontSize: "150px"
9273
+ fontSize: "56px"
9228
9274
  }
9229
9275
  })), /*#__PURE__*/React__default.createElement("div", {
9230
- className: "mb-2"
9231
- }, "Kh\xE1ch h\xE0ng: ", dataBooking === null || dataBooking === void 0 ? void 0 : dataBooking.customerName), /*#__PURE__*/React__default.createElement("div", {
9232
- className: "mb-2"
9233
- }, "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i: ", dataBooking === null || dataBooking === void 0 ? void 0 : dataBooking.customerPhone), /*#__PURE__*/React__default.createElement("div", {
9234
- className: "mb-4"
9235
- }, "Th\u1EDDi gian: ", dayjs_min(dataBooking === null || dataBooking === void 0 ? void 0 : dataBooking.scheduleDate).format("DD/MM/YYYY")), token ? /*#__PURE__*/React__default.createElement("div", null) : /*#__PURE__*/React__default.createElement("div", {
9236
- className: "flex flex-col items-center"
9237
- }, /*#__PURE__*/React__default.createElement("p", {
9238
- className: "mb-4 text-center"
9239
- }, "B\u1EA1n \u0111\xE3 c\xF3 t\xE0i kho\u1EA3n, vui l\xF2ng \u0111\u0103ng nh\u1EADp \u0111\u1EC3 xem chi ti\u1EBFt c\xE1c s\u1EA3n ph\u1EA9m, d\u1ECBch v\u1EE5 li\u1EC7u tr\xECnh m\xE0 b\u1EA1n \u0111ang s\u1EDF h\u1EEFu"), /*#__PURE__*/React__default.createElement(Button, {
9240
- label: "Đăng nhập",
9241
- shopConfigStyle: shopConfigStyle
9242
- })))));
9276
+ className: "font-medium text-2xl"
9277
+ }, "\u0110\u1EB7t l\u1ECBch th\xE0nh c\xF4ng"), /*#__PURE__*/React__default.createElement("div", {
9278
+ className: "text-center"
9279
+ }, "Ch\xFAng t\xF4i \u0111\xE3 ghi nh\u1EADn th\xF4ng tin c\u1EE7a b\u1EA1n v\xE0 s\u1EBD li\xEAn h\u1EC7 l\u1EA1i ngay"))));
9243
9280
  };
9244
9281
 
9245
9282
  var TreatmentsList7 = function TreatmentsList7(props) {
@@ -9364,7 +9401,8 @@ var TreatmentsList7 = function TreatmentsList7(props) {
9364
9401
  onCloseFormBooking: handleCloseModal,
9365
9402
  defaultValue: dataBooking,
9366
9403
  shopConfig: shopConfig,
9367
- shopConfigStyle: shopConfigStyle
9404
+ shopConfigStyle: shopConfigStyle,
9405
+ isModalBooking: isOpenModal
9368
9406
  })) : null);
9369
9407
  };
9370
9408
 
@@ -9403,44 +9441,6 @@ var ProductDetailController = function ProductDetailController(props) {
9403
9441
  };
9404
9442
  };
9405
9443
 
9406
- var ServiceDetail1 = function ServiceDetail1(props) {
9407
- var shopConfigStyle = props.shopConfigStyle;
9408
- var _ProductDetailControl = ProductDetailController(props),
9409
- product = _ProductDetailControl.product;
9410
- console.log('product', product);
9411
- return /*#__PURE__*/React__default.createElement("div", {
9412
- className: SECTION_DEFAULT_CLASS + " !py-0"
9413
- }, /*#__PURE__*/React__default.createElement("div", {
9414
- className: "p-6 rounded-2xl grid grid-cols-1 md:grid-cols-3 gap-6 bg-bgSecondary"
9415
- }, /*#__PURE__*/React__default.createElement(ProductImage, {
9416
- product: product,
9417
- className: "w-full aspect-square rounded-2xl"
9418
- }), /*#__PURE__*/React__default.createElement("div", {
9419
- className: "col-span-2"
9420
- }, /*#__PURE__*/React__default.createElement("p", {
9421
- className: "font-semibold text-2xl"
9422
- }, product === null || product === void 0 ? void 0 : product.productName), /*#__PURE__*/React__default.createElement(ProductPrice, {
9423
- product: product,
9424
- className: "mt-6"
9425
- }), /*#__PURE__*/React__default.createElement("div", {
9426
- className: "flex gap-4 mt-6"
9427
- }, /*#__PURE__*/React__default.createElement("div", null, "Th\u1EDDi l\u01B0\u1EE3ng: "), /*#__PURE__*/React__default.createElement("div", null, getDurationValue(product === null || product === void 0 ? void 0 : product.attributes))), /*#__PURE__*/React__default.createElement("div", {
9428
- className: "flex gap-4 mt-6"
9429
- }, /*#__PURE__*/React__default.createElement(Button, {
9430
- label: "ĐẶT LỊCH",
9431
- shopConfigStyle: shopConfigStyle
9432
- })), /*#__PURE__*/React__default.createElement("p", {
9433
- className: "text-lg mt-12 pt-6 border-t border-stroke"
9434
- }, "M\xF4 t\u1EA3"), product !== null && product !== void 0 && product.description ? /*#__PURE__*/React__default.createElement("div", {
9435
- className: "mt-6",
9436
- dangerouslySetInnerHTML: {
9437
- __html: product === null || product === void 0 ? void 0 : product.description
9438
- }
9439
- }) : /*#__PURE__*/React__default.createElement("div", {
9440
- className: "text-gray3 mt-2"
9441
- }, "Kh\xF4ng c\xF3 th\xF4ng tin"))));
9442
- };
9443
-
9444
9444
  var CartController = function CartController(props) {
9445
9445
  var addToCart = props.addToCart,
9446
9446
  dispatch = props.dispatch;
@@ -9466,7 +9466,7 @@ var CartController = function CartController(props) {
9466
9466
  };
9467
9467
  };
9468
9468
 
9469
- var TreatmentDetail1 = function TreatmentDetail1(props) {
9469
+ var ServiceDetail1 = function ServiceDetail1(props) {
9470
9470
  var _product$images;
9471
9471
  var shopConfigStyle = props.shopConfigStyle,
9472
9472
  shopConfig = props.shopConfig;
@@ -9523,34 +9523,168 @@ var TreatmentDetail1 = function TreatmentDetail1(props) {
9523
9523
  return /*#__PURE__*/React__default.createElement("div", {
9524
9524
  className: SECTION_CLASS + " mt-6 mb-12 " + ((shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode) === 'fashion_1' ? "bg-bgSecondary pb-8" : "bg-background")
9525
9525
  }, /*#__PURE__*/React__default.createElement("div", {
9526
- className: "p-6 rounded-2xl grid grid-cols-1 md:grid-cols-5 gap-6 bg-bgSecondary"
9526
+ className: "p-6 rounded-2xl grid grid-cols-1 md:grid-cols-5 md:gap-6 bg-bgSecondary"
9527
9527
  }, /*#__PURE__*/React__default.createElement("div", {
9528
9528
  className: "flex flex-col gap-4 col-span-2"
9529
+ }, /*#__PURE__*/React__default.createElement("div", {
9530
+ className: "rounded-2xl p-2 border"
9529
9531
  }, displayImage ? /*#__PURE__*/React__default.createElement("img", {
9530
9532
  src: displayImage === null || displayImage === void 0 ? void 0 : displayImage.imageUrl,
9531
- className: "w-full aspect-square object-cover rounded-2xl"
9533
+ className: "w-full aspect-square object-contain rounded-2xl"
9532
9534
  }) : /*#__PURE__*/React__default.createElement(ProductImage, {
9533
9535
  product: product,
9534
- className: "w-full aspect-square object-contain rounded-2xl"
9536
+ className: "w-full aspect-square !object-contain rounded-2xl"
9537
+ })), /*#__PURE__*/React__default.createElement("div", {
9538
+ className: "flex gap-1 w-[80vw] overflow-x-auto md:w-full md:gap-2 md:flex-wrap"
9539
+ }, product === null || product === void 0 ? void 0 : (_product$images = product.images) === null || _product$images === void 0 ? void 0 : _product$images.map(function (item) {
9540
+ return /*#__PURE__*/React__default.createElement("img", {
9541
+ src: item === null || item === void 0 ? void 0 : item.imageUrl,
9542
+ key: item === null || item === void 0 ? void 0 : item.imageId,
9543
+ alt: "",
9544
+ className: (displayImage ? "" : "first:border first:opacity-100 first:brightness-100") + " h-16 w-16 object-cover rounded-lg \n " + ((displayImage === null || displayImage === void 0 ? void 0 : displayImage.imageId) === (item === null || item === void 0 ? void 0 : item.imageId) ? "border" : "opacity-50 brightness-75 bg-background"),
9545
+ onClick: function onClick() {
9546
+ handleDisplayImage(item);
9547
+ }
9548
+ });
9549
+ }))), /*#__PURE__*/React__default.createElement("div", {
9550
+ className: "col-span-3 mt-4 lg:mt-0"
9551
+ }, /*#__PURE__*/React__default.createElement("p", {
9552
+ className: "font-semibold text-2xl"
9553
+ }, product === null || product === void 0 ? void 0 : product.productName), /*#__PURE__*/React__default.createElement(ProductPrice, {
9554
+ product: product,
9555
+ className: "mt-3 md:mt-6 text-[22px]"
9535
9556
  }), /*#__PURE__*/React__default.createElement("div", {
9557
+ className: " text-lg py-3"
9558
+ }, "Th\u1EDDi gian: " + getDurationValue(product === null || product === void 0 ? void 0 : product.attributes)), /*#__PURE__*/React__default.createElement(Button, {
9559
+ label: "ĐẶT LỊCH NGAY",
9560
+ shopConfigStyle: shopConfigStyle,
9561
+ onClick: function onClick(e) {
9562
+ return handleOpenModalBooking(e);
9563
+ }
9564
+ }), /*#__PURE__*/React__default.createElement("p", {
9565
+ className: "text-lg mt-12 text-xl pb-1 pt-6 border-t border-stroke"
9566
+ }, "M\xF4 t\u1EA3 s\u1EA3n ph\u1EA9m"), product !== null && product !== void 0 && product.description ? /*#__PURE__*/React__default.createElement("div", {
9567
+ className: "h-max"
9568
+ }, /*#__PURE__*/React__default.createElement("div", {
9569
+ ref: descriptionRef,
9570
+ className: "" + (isSeeMore && !hiddenButton ? "h-full mb-4" : "max-h-[700px] overflow-hidden"),
9571
+ dangerouslySetInnerHTML: {
9572
+ __html: product === null || product === void 0 ? void 0 : product.description
9573
+ }
9574
+ }), !isSeeMore && !hiddenButton ? /*#__PURE__*/React__default.createElement("div", {
9575
+ className: "h-10 relative -mt-10 rounded-b-lg",
9576
+ style: {
9577
+ background: "linear-gradient(to top, #81818169 0%, #00000003 50%)"
9578
+ }
9579
+ }) : null, !hiddenButton ? /*#__PURE__*/React__default.createElement("div", {
9580
+ className: "w-full flex justify-center mt-2"
9581
+ }, /*#__PURE__*/React__default.createElement(Button, {
9582
+ label: isSeeMore ? "Thu nhỏ" : "Xem thêm",
9583
+ className: " bottom-0 z-50",
9584
+ onClick: function onClick() {
9585
+ setIsSeeMore(!isSeeMore);
9586
+ }
9587
+ })) : null) : /*#__PURE__*/React__default.createElement("div", {
9588
+ className: "text-gray3 mt-2"
9589
+ }, "Kh\xF4ng c\xF3 th\xF4ng tin"))), isBooking ? /*#__PURE__*/React__default.createElement(ModalNotification, {
9590
+ onClose: handleCloseModal
9591
+ }, /*#__PURE__*/React__default.createElement(BookingForm, {
9592
+ isModalBooking: isBooking,
9593
+ className: "overflow-y-auto hide-scrollbar max-h-[80vh]",
9594
+ onCloseFormBooking: handleCloseModal,
9595
+ defaultValue: dataBooking,
9596
+ shopConfig: shopConfig,
9597
+ shopConfigStyle: shopConfigStyle
9598
+ })) : null);
9599
+ };
9600
+
9601
+ var TreatmentDetail1 = function TreatmentDetail1(props) {
9602
+ var _product$images;
9603
+ var shopConfigStyle = props.shopConfigStyle,
9604
+ shopConfig = props.shopConfig;
9605
+ var _ProductDetailControl = ProductDetailController(props),
9606
+ product = _ProductDetailControl.product;
9607
+ var _useState = React.useState(),
9608
+ displayImage = _useState[0],
9609
+ setDisplayImage = _useState[1];
9610
+ var _useState2 = React.useState(false),
9611
+ isSeeMore = _useState2[0],
9612
+ setIsSeeMore = _useState2[1];
9613
+ var _useState3 = React.useState(true),
9614
+ hiddenButton = _useState3[0],
9615
+ setHiddenButton = _useState3[1];
9616
+ var descriptionRef = React.useRef();
9617
+ var _useState4 = React.useState(false),
9618
+ isBooking = _useState4[0],
9619
+ setIsBooking = _useState4[1];
9620
+ var _useState5 = React.useState([]),
9621
+ dataBooking = _useState5[0],
9622
+ setDataBooking = _useState5[1];
9623
+ React.useEffect(function () {
9624
+ if (product) {
9625
+ if (descriptionRef.current) {
9626
+ var descriptionHeight = descriptionRef.current.offsetHeight;
9627
+ if (descriptionHeight >= 700) {
9628
+ setHiddenButton(false);
9629
+ }
9630
+ }
9631
+ }
9632
+ }, [product]);
9633
+ var handleDisplayImage = function handleDisplayImage(item) {
9634
+ setDisplayImage(item);
9635
+ };
9636
+ var handleOpenModalBooking = function handleOpenModalBooking(event) {
9637
+ try {
9638
+ event.stopPropagation();
9639
+ setDataBooking([_extends({}, product, {
9640
+ quantity: 1,
9641
+ technical: {},
9642
+ oldService: false,
9643
+ label: product === null || product === void 0 ? void 0 : product.productName,
9644
+ value: product === null || product === void 0 ? void 0 : product.productId
9645
+ })]);
9646
+ setIsBooking(true);
9647
+ } catch (error) {
9648
+ console.log("::::::::::errrorrrrr::::::", error);
9649
+ }
9650
+ };
9651
+ var handleCloseModal = function handleCloseModal() {
9652
+ setIsBooking(false);
9653
+ setDataBooking([]);
9654
+ };
9655
+ return /*#__PURE__*/React__default.createElement("div", {
9656
+ className: SECTION_CLASS + " mt-6 mb-12 " + ((shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingTemplateCode) === 'fashion_1' ? "bg-bgSecondary pb-8" : "bg-background")
9657
+ }, /*#__PURE__*/React__default.createElement("div", {
9658
+ className: "p-6 rounded-2xl grid grid-cols-1 md:grid-cols-5 md:gap-6 bg-bgSecondary"
9659
+ }, /*#__PURE__*/React__default.createElement("div", {
9660
+ className: "flex flex-col gap-4 col-span-2"
9661
+ }, /*#__PURE__*/React__default.createElement("div", {
9662
+ className: "rounded-2xl p-2 border"
9663
+ }, displayImage ? /*#__PURE__*/React__default.createElement("img", {
9664
+ src: displayImage === null || displayImage === void 0 ? void 0 : displayImage.imageUrl,
9665
+ className: "w-full aspect-square object-contain rounded-2xl"
9666
+ }) : /*#__PURE__*/React__default.createElement(ProductImage, {
9667
+ product: product,
9668
+ className: "w-full aspect-square !object-contain rounded-2xl"
9669
+ })), /*#__PURE__*/React__default.createElement("div", {
9536
9670
  className: "flex gap-1 w-[80vw] overflow-x-auto md:w-full md:gap-2 md:flex-wrap"
9537
9671
  }, product === null || product === void 0 ? void 0 : (_product$images = product.images) === null || _product$images === void 0 ? void 0 : _product$images.map(function (item) {
9538
9672
  return /*#__PURE__*/React__default.createElement("img", {
9539
9673
  src: item === null || item === void 0 ? void 0 : item.imageUrl,
9540
9674
  key: item === null || item === void 0 ? void 0 : item.imageId,
9541
9675
  alt: "",
9542
- className: (displayImage ? "" : "first:border first:opacity-100 first:brightness-100") + " h-16 w-16 rounded-lg \n " + ((displayImage === null || displayImage === void 0 ? void 0 : displayImage.imageId) === (item === null || item === void 0 ? void 0 : item.imageId) ? "border" : "opacity-50 brightness-75 bg-background"),
9676
+ className: (displayImage ? "" : "first:border first:opacity-100 first:brightness-100") + " h-16 w-16 object-cover rounded-lg \n " + ((displayImage === null || displayImage === void 0 ? void 0 : displayImage.imageId) === (item === null || item === void 0 ? void 0 : item.imageId) ? "border" : "opacity-50 brightness-75 bg-background"),
9543
9677
  onClick: function onClick() {
9544
9678
  handleDisplayImage(item);
9545
9679
  }
9546
9680
  });
9547
9681
  }))), /*#__PURE__*/React__default.createElement("div", {
9548
- className: "col-span-3"
9682
+ className: "col-span-3 mt-4 lg:mt-0"
9549
9683
  }, /*#__PURE__*/React__default.createElement("p", {
9550
9684
  className: "font-semibold text-2xl"
9551
9685
  }, product === null || product === void 0 ? void 0 : product.productName), /*#__PURE__*/React__default.createElement(ProductPrice, {
9552
9686
  product: product,
9553
- className: "mt-6 text-[22px]"
9687
+ className: "mt-3 md:mt-6 text-[22px]"
9554
9688
  }), /*#__PURE__*/React__default.createElement("div", {
9555
9689
  className: " text-lg py-3"
9556
9690
  }, "Th\u1EDDi gian: " + getDurationValue(product === null || product === void 0 ? void 0 : product.attributes)), /*#__PURE__*/React__default.createElement(Button, {
@@ -9587,6 +9721,7 @@ var TreatmentDetail1 = function TreatmentDetail1(props) {
9587
9721
  }, "Kh\xF4ng c\xF3 th\xF4ng tin"))), isBooking ? /*#__PURE__*/React__default.createElement(ModalNotification, {
9588
9722
  onClose: handleCloseModal
9589
9723
  }, /*#__PURE__*/React__default.createElement(BookingForm, {
9724
+ isModalBooking: isBooking,
9590
9725
  className: "overflow-y-auto hide-scrollbar max-h-[80vh]",
9591
9726
  onCloseFormBooking: handleCloseModal,
9592
9727
  defaultValue: dataBooking,
@@ -10228,8 +10363,21 @@ var Products10 = function Products10(props) {
10228
10363
  })) : /*#__PURE__*/React__default.createElement(NotFoundProduct, null));
10229
10364
  };
10230
10365
 
10366
+ var listFilter = [{
10367
+ label: "Tất cả",
10368
+ value: "all"
10369
+ }, {
10370
+ label: "Khuyến mãi",
10371
+ value: "discount"
10372
+ }, {
10373
+ label: "Nổi bật",
10374
+ value: "isHighlight"
10375
+ }, {
10376
+ label: "Giá thấp đến cao",
10377
+ value: "sortPriceDESC"
10378
+ }];
10231
10379
  var Products11 = function Products11(props) {
10232
- var _products$slice;
10380
+ var _productsFilter$slice;
10233
10381
  var _props$shopConfigStyl = props.shopConfigStyle,
10234
10382
  shopConfigStyle = _props$shopConfigStyl === void 0 ? {} : _props$shopConfigStyl,
10235
10383
  _props$Link = props.Link,
@@ -10251,6 +10399,12 @@ var Products11 = function Products11(props) {
10251
10399
  var _useState3 = React.useState({}),
10252
10400
  categorySelected = _useState3[0],
10253
10401
  setCategorySelected = _useState3[1];
10402
+ var _useState4 = React.useState([]),
10403
+ productsFilter = _useState4[0],
10404
+ setProductsFilter = _useState4[1];
10405
+ var _useState5 = React.useState(listFilter === null || listFilter === void 0 ? void 0 : listFilter[0]),
10406
+ filterItem = _useState5[0],
10407
+ setFilterItem = _useState5[1];
10254
10408
  var _CategoryController = CategoryController(_extends({}, props, {
10255
10409
  params: params
10256
10410
  })),
@@ -10274,6 +10428,7 @@ var Products11 = function Products11(props) {
10274
10428
  var handleChooseCategory = function handleChooseCategory(category) {
10275
10429
  setCategorySelected(category);
10276
10430
  setFirstLoading(true);
10431
+ setFilterItem(listFilter === null || listFilter === void 0 ? void 0 : listFilter[0]);
10277
10432
  setParams(function (prev) {
10278
10433
  return _extends({}, prev, {
10279
10434
  categoryId: category === null || category === void 0 ? void 0 : category.categoryId,
@@ -10284,36 +10439,73 @@ var Products11 = function Products11(props) {
10284
10439
  React.useEffect(function () {
10285
10440
  if ((categories === null || categories === void 0 ? void 0 : categories.length) > 0 && params !== null && params !== void 0 && params.categoryId) {
10286
10441
  var category = categories === null || categories === void 0 ? void 0 : categories.find(function (item) {
10287
- return (item === null || item === void 0 ? void 0 : item.categoryId) == categoryId;
10442
+ return (item === null || item === void 0 ? void 0 : item.categoryId) == (params === null || params === void 0 ? void 0 : params.categoryId);
10288
10443
  });
10289
10444
  setCategorySelected(category);
10290
10445
  }
10291
- }, [params === null || params === void 0 ? void 0 : params.categoryId, categories]);
10292
- console.log("check page:::::::", page);
10446
+ }, [categories]);
10447
+ React.useEffect(function () {
10448
+ if ((products === null || products === void 0 ? void 0 : products.length) > 0) {
10449
+ setProductsFilter(products);
10450
+ }
10451
+ }, [products]);
10452
+ var handleFilter = function handleFilter(item) {
10453
+ setFilterItem(item);
10454
+ if ((item === null || item === void 0 ? void 0 : item.value) === "sortPriceDESC") {
10455
+ var productsCopy = [].concat(products);
10456
+ productsCopy === null || productsCopy === void 0 ? void 0 : productsCopy.sort(function (a, b) {
10457
+ var _b$productInfo, _a$productInfo;
10458
+ return +(b === null || b === void 0 ? void 0 : (_b$productInfo = b.productInfo) === null || _b$productInfo === void 0 ? void 0 : _b$productInfo.price) - (a === null || a === void 0 ? void 0 : (_a$productInfo = a.productInfo) === null || _a$productInfo === void 0 ? void 0 : _a$productInfo.price);
10459
+ });
10460
+ setProductsFilter(productsCopy);
10461
+ } else if ((item === null || item === void 0 ? void 0 : item.value) === "discount") {
10462
+ var _productsCopy = [].concat(products);
10463
+ _productsCopy === null || _productsCopy === void 0 ? void 0 : _productsCopy.filter(function (product) {
10464
+ return (product === null || product === void 0 ? void 0 : product.priceBeforeDiscount) && (product === null || product === void 0 ? void 0 : product.priceBeforeDiscount) !== (product === null || product === void 0 ? void 0 : product.price);
10465
+ });
10466
+ setProductsFilter(_productsCopy);
10467
+ } else if ((item === null || item === void 0 ? void 0 : item.value) === "isHighlight") {
10468
+ var _productsCopy3;
10469
+ var _productsCopy2 = [].concat(products);
10470
+ _productsCopy2 = (_productsCopy3 = _productsCopy2) === null || _productsCopy3 === void 0 ? void 0 : _productsCopy3.filter(function (product) {
10471
+ return (product === null || product === void 0 ? void 0 : product[item === null || item === void 0 ? void 0 : item.value]) === true;
10472
+ });
10473
+ setProductsFilter(_productsCopy2);
10474
+ } else {
10475
+ setProductsFilter(products);
10476
+ }
10477
+ };
10293
10478
  return /*#__PURE__*/React__default.createElement("div", {
10294
- className: SECTION_CLASS + " grid grid-cols-1 md:grid-cols-4 gap-6"
10479
+ className: SECTION_CLASS + " grid grid-cols-1 !mt-0 md:grid-cols-4 gap-6"
10295
10480
  }, /*#__PURE__*/React__default.createElement("div", {
10296
- className: "md:sticky top-20 self-start"
10481
+ className: "md:sticky top-0 self-start"
10297
10482
  }, /*#__PURE__*/React__default.createElement("div", {
10298
- className: "rounded-3xl bg-bgSecondary p-4"
10483
+ className: " flex flex-col gap-2 rounded-3xl bg-bgSecondary p-4"
10299
10484
  }, categories === null || categories === void 0 ? void 0 : categories.map(function (item, index) {
10300
- return /*#__PURE__*/React__default.createElement(LinkToPage, {
10301
- href: getLinkProductsByCategory(item),
10302
- Link: Link
10303
- }, /*#__PURE__*/React__default.createElement("div", {
10304
- className: "px-6 py-3 hover:bg-gray-100 hover:text-primary cursor-pointer rounded-lg " + ((categorySelected === null || categorySelected === void 0 ? void 0 : categorySelected.categoryId) === (item === null || item === void 0 ? void 0 : item.categoryId) ? " bg-primary text-textButton" : ""),
10485
+ return /*#__PURE__*/React__default.createElement("div", {
10486
+ className: "px-6 py-2 hover:bg-gray-100 hover:text-primary cursor-pointer rounded-lg " + ((categorySelected === null || categorySelected === void 0 ? void 0 : categorySelected.categoryId) === (item === null || item === void 0 ? void 0 : item.categoryId) ? " bg-primary text-textButton" : ""),
10487
+ key: "sdjfdh-" + index,
10305
10488
  onClick: function onClick() {
10306
10489
  handleChooseCategory(item);
10307
- },
10308
- key: "sdjfdh-" + index
10309
- }, item === null || item === void 0 ? void 0 : item.cateName));
10490
+ }
10491
+ }, item === null || item === void 0 ? void 0 : item.cateName);
10310
10492
  }))), /*#__PURE__*/React__default.createElement("div", {
10311
- className: "md:col-span-3 flex flex-col gap-8"
10312
- }, loading && firstLoading ? /*#__PURE__*/React__default.createElement("div", {
10313
- className: "w-full h-80 flex justify-center items-center"
10314
- }, /*#__PURE__*/React__default.createElement(Loading, null)) : /*#__PURE__*/React__default.createElement("div", {
10493
+ className: "md:col-span-3 flex flex-col gap-6"
10494
+ }, /*#__PURE__*/React__default.createElement("div", {
10495
+ className: "flex gap-4"
10496
+ }, listFilter === null || listFilter === void 0 ? void 0 : listFilter.map(function (item, index) {
10497
+ return /*#__PURE__*/React__default.createElement("div", {
10498
+ key: "kgkf-" + index,
10499
+ className: ((filterItem === null || filterItem === void 0 ? void 0 : filterItem.value) === (item === null || item === void 0 ? void 0 : item.value) ? "bg-primary text-textButton" : "bg-background") + " \n w-max border border-primary py-1 px-2 md:py-2 md:px-3 rounded-lg cursor-pointer whitespace-nowrap",
10500
+ onClick: function onClick() {
10501
+ handleFilter(item);
10502
+ }
10503
+ }, item === null || item === void 0 ? void 0 : item.label);
10504
+ })), loading && firstLoading ? /*#__PURE__*/React__default.createElement("div", {
10505
+ className: "w-full h-96 mb-1 flex justify-center items-center"
10506
+ }, /*#__PURE__*/React__default.createElement(Loading, null)) : /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
10315
10507
  className: "grid grid-cols-2 md:grid-cols-2 lg:grid-cols-3 gap-3 md:gap-6 lg:gap-8"
10316
- }, (products === null || products === void 0 ? void 0 : products.length) > 0 ? products === null || products === void 0 ? void 0 : (_products$slice = products.slice(0, (params === null || params === void 0 ? void 0 : params.size) - 4)) === null || _products$slice === void 0 ? void 0 : _products$slice.map(function (product, index) {
10508
+ }, (productsFilter === null || productsFilter === void 0 ? void 0 : productsFilter.length) > 0 ? productsFilter === null || productsFilter === void 0 ? void 0 : (_productsFilter$slice = productsFilter.slice(0, (params === null || params === void 0 ? void 0 : params.size) - 4)) === null || _productsFilter$slice === void 0 ? void 0 : _productsFilter$slice.map(function (product, index) {
10317
10509
  return /*#__PURE__*/React__default.createElement(LinkToPage, {
10318
10510
  href: getLinkProductDetail(product === null || product === void 0 ? void 0 : product.productInfo),
10319
10511
  Link: Link,
@@ -10326,7 +10518,7 @@ var Products11 = function Products11(props) {
10326
10518
  }));
10327
10519
  }) : /*#__PURE__*/React__default.createElement("div", {
10328
10520
  className: "md:col-span-2 lg:col-span-3 mt-20 m-auto"
10329
- }, /*#__PURE__*/React__default.createElement(NotFoundProduct, null))), /*#__PURE__*/React__default.createElement("div", {
10521
+ }, /*#__PURE__*/React__default.createElement(NotFoundProduct, null)))), /*#__PURE__*/React__default.createElement("div", {
10330
10522
  className: "w-full m-auto"
10331
10523
  }, (page === null || page === void 0 ? void 0 : page.total_pages) > 1 ? /*#__PURE__*/React__default.createElement(Pagination, {
10332
10524
  total_pages: page === null || page === void 0 ? void 0 : page.total_pages,
@@ -10442,8 +10634,21 @@ var ProductSale2 = function ProductSale2(props) {
10442
10634
  })) : null;
10443
10635
  };
10444
10636
 
10637
+ var listFilter$1 = [{
10638
+ label: "Khuyến mãi",
10639
+ value: "discount",
10640
+ filter: {
10641
+ isDiscount: true
10642
+ }
10643
+ }, {
10644
+ label: "Nổi bật",
10645
+ value: "isHighlight",
10646
+ filter: {
10647
+ isHighlight: true
10648
+ }
10649
+ }];
10445
10650
  var ProductSearch1 = function ProductSearch1(props) {
10446
- var _window, _window$location;
10651
+ var _window, _window$location, _productsFilter$slice;
10447
10652
  var _props$Link = props.Link,
10448
10653
  Link = _props$Link === void 0 ? null : _props$Link,
10449
10654
  _props$SectionTitle = props.SectionTitle,
@@ -10453,12 +10658,12 @@ var ProductSearch1 = function ProductSearch1(props) {
10453
10658
  shopConfigStyle = props.shopConfigStyle;
10454
10659
  var queryParams = new URLSearchParams((_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.search);
10455
10660
  var keywordValue = queryParams === null || queryParams === void 0 ? void 0 : queryParams.get('tu-khoa');
10456
- var _useState = React.useState(0),
10457
- length = _useState[0],
10458
- setLength = _useState[1];
10661
+ var _useState = React.useState([]),
10662
+ productsFilter = _useState[0],
10663
+ setProductsFilter = _useState[1];
10459
10664
  var _useState2 = React.useState({
10460
10665
  productName: keywordValue,
10461
- size: 24
10666
+ size: 12
10462
10667
  }),
10463
10668
  params = _useState2[0],
10464
10669
  setParams = _useState2[1];
@@ -10477,36 +10682,34 @@ var ProductSearch1 = function ProductSearch1(props) {
10477
10682
  });
10478
10683
  });
10479
10684
  }, [keywordValue]);
10685
+ React.useEffect(function () {
10686
+ if ((products === null || products === void 0 ? void 0 : products.length) > 0) setProductsFilter(products);
10687
+ }, [products]);
10480
10688
  var handleGetMoreProducts = function handleGetMoreProducts() {
10481
10689
  setIsGetMore(false);
10482
- setLength(function (prev) {
10483
- return prev + 4;
10690
+ setParams(function (prev) {
10691
+ return _extends({}, prev, {
10692
+ size: (prev === null || prev === void 0 ? void 0 : prev.size) + 4
10693
+ });
10484
10694
  });
10485
10695
  };
10486
- var listFilter = [{
10487
- label: "Khuyến mãi",
10488
- value: "discount",
10489
- filter: {
10490
- isDiscount: true
10491
- }
10492
- }, {
10493
- label: "Nổi bật",
10494
- value: "highlight",
10495
- filter: {
10496
- isHighlight: true
10497
- }
10498
- }];
10499
10696
  var handleFilter = function handleFilter(item) {
10500
- setParams(function (prev) {
10501
- var _Object$keys;
10502
- var newParams = _extends({}, prev);
10503
- Object === null || Object === void 0 ? void 0 : (_Object$keys = Object.keys(newParams)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (key) {
10504
- if (key !== 'productName' && key !== 'size') {
10505
- delete newParams[key];
10506
- }
10697
+ if ((item === null || item === void 0 ? void 0 : item.value) === "discount") {
10698
+ var productsCopy = [].concat(products);
10699
+ productsCopy === null || productsCopy === void 0 ? void 0 : productsCopy.filter(function (product) {
10700
+ return (product === null || product === void 0 ? void 0 : product.priceBeforeDiscount) && (product === null || product === void 0 ? void 0 : product.priceBeforeDiscount) !== (product === null || product === void 0 ? void 0 : product.price);
10507
10701
  });
10508
- return _extends({}, newParams, item === null || item === void 0 ? void 0 : item.filter);
10509
- });
10702
+ setProductsFilter(productsCopy);
10703
+ } else if ((item === null || item === void 0 ? void 0 : item.value) === "isHighlight") {
10704
+ var _productsCopy2;
10705
+ var _productsCopy = [].concat(products);
10706
+ _productsCopy = (_productsCopy2 = _productsCopy) === null || _productsCopy2 === void 0 ? void 0 : _productsCopy2.filter(function (product) {
10707
+ return (product === null || product === void 0 ? void 0 : product[item === null || item === void 0 ? void 0 : item.value]) === true;
10708
+ });
10709
+ setProductsFilter(_productsCopy);
10710
+ } else {
10711
+ setProductsFilter(products);
10712
+ }
10510
10713
  };
10511
10714
  return /*#__PURE__*/React__default.createElement("div", {
10512
10715
  className: SECTION_CLASS + " flex flex-col gap-4 md:gap-6 "
@@ -10518,20 +10721,20 @@ var ProductSearch1 = function ProductSearch1(props) {
10518
10721
  }), /*#__PURE__*/React__default.createElement("div", {
10519
10722
  className: "text-lg"
10520
10723
  }, "T\u1EEB kh\xF3a \"", keywordValue, "\" (", products === null || products === void 0 ? void 0 : products.length, " s\u1EA3n ph\u1EA9m)"), /*#__PURE__*/React__default.createElement(CarouselItem, {
10521
- data: listFilter,
10724
+ data: listFilter$1,
10522
10725
  isNavigateButton: false,
10523
10726
  onClick: handleFilter
10524
10727
  }), loading && isGetMore ? /*#__PURE__*/React__default.createElement("div", {
10525
10728
  className: "m-auto mt-20 min-h-32"
10526
- }, /*#__PURE__*/React__default.createElement(Loading, null)) : (products === null || products === void 0 ? void 0 : products.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
10729
+ }, /*#__PURE__*/React__default.createElement(Loading, null)) : (productsFilter === null || productsFilter === void 0 ? void 0 : productsFilter.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
10527
10730
  className: "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-x-2 gap-y-4 md:gap-4 xl:gap-6"
10528
- }, products.slice(0, 8 + length).map(function (product, idx) {
10731
+ }, productsFilter === null || productsFilter === void 0 ? void 0 : (_productsFilter$slice = productsFilter.slice(0, (params === null || params === void 0 ? void 0 : params.size) - 4)) === null || _productsFilter$slice === void 0 ? void 0 : _productsFilter$slice.map(function (product, idx) {
10529
10732
  return /*#__PURE__*/React__default.createElement(ProductItem, {
10530
10733
  Link: Link,
10531
10734
  product: product === null || product === void 0 ? void 0 : product.productInfo,
10532
10735
  key: "htrhr-" + idx
10533
10736
  });
10534
- })) : /*#__PURE__*/React__default.createElement(NotFoundProduct, null), !loading && (products === null || products === void 0 ? void 0 : products.length) > 8 + length ? /*#__PURE__*/React__default.createElement(Button, {
10737
+ })) : /*#__PURE__*/React__default.createElement(NotFoundProduct, null), !loading && (productsFilter === null || productsFilter === void 0 ? void 0 : productsFilter.length) > (params === null || params === void 0 ? void 0 : params.size) - 4 ? /*#__PURE__*/React__default.createElement(Button, {
10535
10738
  label: "Xem thêm",
10536
10739
  onClick: handleGetMoreProducts,
10537
10740
  className: "mx-auto " + (shopConfigStyle === null || shopConfigStyle === void 0 ? void 0 : shopConfigStyle.buttonClass),
@@ -10799,8 +11002,8 @@ var ProductDetail10 = function ProductDetail10(props) {
10799
11002
  var _product$images2;
10800
11003
  var shopConfigStyle = props.shopConfigStyle,
10801
11004
  shopConfig = props.shopConfig,
10802
- _props$handleRedirect = props.handleRedirect,
10803
- handleRedirect = _props$handleRedirect === void 0 ? function () {} : _props$handleRedirect;
11005
+ _props$router = props.router,
11006
+ router = _props$router === void 0 ? function () {} : _props$router;
10804
11007
  var _ProductDetailControl = ProductDetailController(props),
10805
11008
  product = _ProductDetailControl.product;
10806
11009
  var _useState = React.useState(),
@@ -10898,7 +11101,7 @@ var ProductDetail10 = function ProductDetail10(props) {
10898
11101
  var _refInputQuantity$cur3;
10899
11102
  var quantity = refInputQuantity === null || refInputQuantity === void 0 ? void 0 : (_refInputQuantity$cur3 = refInputQuantity.current) === null || _refInputQuantity$cur3 === void 0 ? void 0 : _refInputQuantity$cur3.getValue();
10900
11103
  return Promise.resolve(addProductToCart(product, variant, quantity)).then(function () {
10901
- handleRedirect("/gio-hang");
11104
+ router === null || router === void 0 ? void 0 : router.push("/gio-hang");
10902
11105
  });
10903
11106
  }
10904
11107
  }();
@@ -11025,11 +11228,11 @@ var ProductDetail10 = function ProductDetail10(props) {
11025
11228
  };
11026
11229
 
11027
11230
  var ProductDetail11 = function ProductDetail11(props) {
11028
- var _product$images2, _product$images3, _product$attributes, _product$attributes2;
11231
+ var _product$images2, _product$images3, _product$images4, _product$images5, _product$attributes, _product$attributes2;
11029
11232
  var shopConfigStyle = props.shopConfigStyle,
11030
11233
  shopConfig = props.shopConfig,
11031
- _props$handleRedirect = props.handleRedirect,
11032
- handleRedirect = _props$handleRedirect === void 0 ? function () {} : _props$handleRedirect;
11234
+ _props$router = props.router,
11235
+ router = _props$router === void 0 ? function () {} : _props$router;
11033
11236
  var _ProductDetailControl = ProductDetailController(props),
11034
11237
  product = _ProductDetailControl.product;
11035
11238
  var _useState = React.useState(),
@@ -11127,7 +11330,7 @@ var ProductDetail11 = function ProductDetail11(props) {
11127
11330
  var _refInputQuantity$cur3;
11128
11331
  var quantity = refInputQuantity === null || refInputQuantity === void 0 ? void 0 : (_refInputQuantity$cur3 = refInputQuantity.current) === null || _refInputQuantity$cur3 === void 0 ? void 0 : _refInputQuantity$cur3.getValue();
11129
11332
  return Promise.resolve(addProductToCart(product, variant, quantity)).then(function () {
11130
- handleRedirect("/gio-hang");
11333
+ router === null || router === void 0 ? void 0 : router.push("/gio-hang");
11131
11334
  });
11132
11335
  }
11133
11336
  }();
@@ -11147,7 +11350,7 @@ var ProductDetail11 = function ProductDetail11(props) {
11147
11350
  className: "grid grid-cols-5 gap-6"
11148
11351
  }, /*#__PURE__*/React__default.createElement("div", {
11149
11352
  className: "hidden lg:block col-span-1 lg:min-h-[240px] lg:max-h-[400px] xl:min-h-[400px] xl:max-h-[480px] overflow-y-auto overflow-hidden no-scrollbar"
11150
- }, product === null || product === void 0 ? void 0 : (_product$images2 = product.images) === null || _product$images2 === void 0 ? void 0 : _product$images2.map(function (item) {
11353
+ }, (product === null || product === void 0 ? void 0 : (_product$images2 = product.images) === null || _product$images2 === void 0 ? void 0 : _product$images2.length) > 0 ? product === null || product === void 0 ? void 0 : (_product$images3 = product.images) === null || _product$images3 === void 0 ? void 0 : _product$images3.map(function (item) {
11151
11354
  return /*#__PURE__*/React__default.createElement("img", {
11152
11355
  src: item === null || item === void 0 ? void 0 : item.imageUrl,
11153
11356
  key: item === null || item === void 0 ? void 0 : item.imageId,
@@ -11157,7 +11360,13 @@ var ProductDetail11 = function ProductDetail11(props) {
11157
11360
  handleDisplayImage(item);
11158
11361
  }
11159
11362
  });
11160
- })), /*#__PURE__*/React__default.createElement("div", {
11363
+ }) : /*#__PURE__*/React__default.createElement("div", {
11364
+ className: "p-2 border rounded-lg"
11365
+ }, /*#__PURE__*/React__default.createElement(SvgImageGallery, {
11366
+ width: "100%",
11367
+ height: "25%",
11368
+ fill: "#D9D9D9"
11369
+ }))), /*#__PURE__*/React__default.createElement("div", {
11161
11370
  className: "flex flex-col gap-4 col-span-5 lg:col-span-4 p-4 border border-stroke rounded-2xl"
11162
11371
  }, displayImage ? /*#__PURE__*/React__default.createElement("img", {
11163
11372
  src: displayImage === null || displayImage === void 0 ? void 0 : displayImage.imageUrl,
@@ -11173,7 +11382,7 @@ var ProductDetail11 = function ProductDetail11(props) {
11173
11382
  fill: "#D9D9D9"
11174
11383
  }))), /*#__PURE__*/React__default.createElement("div", {
11175
11384
  className: " block lg:hidden w-full flex gap-4 col-span-5 overflow-x-auto overflow-hidden no-scrollbar"
11176
- }, product === null || product === void 0 ? void 0 : (_product$images3 = product.images) === null || _product$images3 === void 0 ? void 0 : _product$images3.map(function (item) {
11385
+ }, (product === null || product === void 0 ? void 0 : (_product$images4 = product.images) === null || _product$images4 === void 0 ? void 0 : _product$images4.length) > 0 ? product === null || product === void 0 ? void 0 : (_product$images5 = product.images) === null || _product$images5 === void 0 ? void 0 : _product$images5.map(function (item) {
11177
11386
  return /*#__PURE__*/React__default.createElement("img", {
11178
11387
  src: item === null || item === void 0 ? void 0 : item.imageUrl,
11179
11388
  key: item === null || item === void 0 ? void 0 : item.imageId,
@@ -11183,7 +11392,7 @@ var ProductDetail11 = function ProductDetail11(props) {
11183
11392
  handleDisplayImage(item);
11184
11393
  }
11185
11394
  });
11186
- }))), /*#__PURE__*/React__default.createElement("div", {
11395
+ }) : null)), /*#__PURE__*/React__default.createElement("div", {
11187
11396
  className: "mt-2 md:ms-10"
11188
11397
  }, /*#__PURE__*/React__default.createElement("p", {
11189
11398
  className: "font-semibold text-2xl"
@@ -11268,8 +11477,8 @@ var ProductDetail11 = function ProductDetail11(props) {
11268
11477
  setIsSeeMore(!isSeeMore);
11269
11478
  }
11270
11479
  })) : null) : /*#__PURE__*/React__default.createElement("div", {
11271
- className: "text-gray3 bg-bgSecondary mt-2"
11272
- }, "Kh\xF4ng c\xF3 th\xF4ng tin")), (product === null || product === void 0 ? void 0 : (_product$attributes = product.attributes) === null || _product$attributes === void 0 ? void 0 : _product$attributes.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
11480
+ className: "text-lg text-gray3 rounded-lg p-2"
11481
+ }, "Kh\xF4ng c\xF3 th\xF4ng tin s\u1EA3n ph\u1EA9m")), (product === null || product === void 0 ? void 0 : (_product$attributes = product.attributes) === null || _product$attributes === void 0 ? void 0 : _product$attributes.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
11273
11482
  className: "lg:col-span-2"
11274
11483
  }, /*#__PURE__*/React__default.createElement("h2", {
11275
11484
  className: "text-3xl mb-8 font-semibold"
@@ -11676,7 +11885,7 @@ var Footer1 = function Footer1(props) {
11676
11885
  var genShopAddress = function genShopAddress() {
11677
11886
  try {
11678
11887
  var addressJson = JSON.parse(shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopAddress);
11679
- if (addressJson) {
11888
+ if (Array.isArray(addressJson) && addressJson && (addressJson === null || addressJson === void 0 ? void 0 : addressJson.length) > 0) {
11680
11889
  setShopAddressList(addressJson);
11681
11890
  } else {
11682
11891
  setShopAddressList([{
@@ -11712,7 +11921,7 @@ var Footer1 = function Footer1(props) {
11712
11921
  className: " col-span-2 flex flex-col mb-10 leading-8 sm:mb-0 "
11713
11922
  }, /*#__PURE__*/React__default.createElement("div", {
11714
11923
  className: "mb-3 font-semibold text-md md:text-lg"
11715
- }, "Th\xF4ng tin li\xEAn h\u1EC7"), shopAddressList === null || shopAddressList === void 0 ? void 0 : shopAddressList.map(function (item, index) {
11924
+ }, "Th\xF4ng tin li\xEAn h\u1EC7"), Array.isArray(shopAddressList) ? shopAddressList === null || shopAddressList === void 0 ? void 0 : shopAddressList.map(function (item, index) {
11716
11925
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", null, "C\u01A1 s\u1EDF ", index + 1), /*#__PURE__*/React__default.createElement("div", {
11717
11926
  className: "flex gap-2 items-center"
11718
11927
  }, /*#__PURE__*/React__default.createElement(hi.HiOutlineLocationMarker, {
@@ -11730,7 +11939,7 @@ var Footer1 = function Footer1(props) {
11730
11939
  color: primary
11731
11940
  }
11732
11941
  }), /*#__PURE__*/React__default.createElement("div", null, item === null || item === void 0 ? void 0 : item.phone)));
11733
- })), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
11942
+ }) : null), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
11734
11943
  className: "mb-3 font-semibold text-lg"
11735
11944
  }, "Li\xEAn k\u1EBFt"), /*#__PURE__*/React__default.createElement("div", {
11736
11945
  className: "leading-10 flex flex-col "
@@ -11816,7 +12025,7 @@ var Footer7 = function Footer7(props) {
11816
12025
  var genShopAddress = function genShopAddress() {
11817
12026
  try {
11818
12027
  var addressJson = JSON.parse(shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopAddress);
11819
- if (addressJson) {
12028
+ if (Array.isArray(addressJson) && addressJson && (addressJson === null || addressJson === void 0 ? void 0 : addressJson.length) > 0) {
11820
12029
  setShopAddressList(addressJson);
11821
12030
  } else {
11822
12031
  setShopAddressList([{
@@ -12065,7 +12274,7 @@ var CustomerRating6 = function CustomerRating6(props) {
12065
12274
  _props$SectionTitle = props.SectionTitle,
12066
12275
  SectionTitle = _props$SectionTitle === void 0 ? null : _props$SectionTitle;
12067
12276
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
12068
- className: SECTION_CLASS + " !my-0 py-12 bg-bgSecondary"
12277
+ className: SECTION_CLASS + " !my-0 py-12 bg-"
12069
12278
  }, /*#__PURE__*/React__default.createElement(SectionTitle, {
12070
12279
  data: data,
12071
12280
  shopConfigStyle: shopConfigStyle
@@ -12075,9 +12284,9 @@ var CustomerRating6 = function CustomerRating6(props) {
12075
12284
  return /*#__PURE__*/React__default.createElement("div", {
12076
12285
  key: index,
12077
12286
  className: "relative bg-primary rounded-lg text-textButton px-6 py-4"
12078
- }, /*#__PURE__*/React__default.createElement(io.IoMdQuote, {
12079
- size: 30,
12080
- className: "absolute text-textButton top-[-15px] right-8"
12287
+ }, /*#__PURE__*/React__default.createElement(md.MdOutlineFormatQuote, {
12288
+ size: 43,
12289
+ className: "absolute text-black top-[-20px] right-8"
12081
12290
  }), /*#__PURE__*/React__default.createElement("div", {
12082
12291
  className: "flex items-end gap-2"
12083
12292
  }, /*#__PURE__*/React__default.createElement("img", {
@@ -12302,7 +12511,7 @@ var Contact1 = function Contact1(props) {
12302
12511
  className: "grid grid-cols-1 lg:grid-cols-2 gap-12 mt-6"
12303
12512
  }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", null, "Trong qu\xE1 tr\xECnh gh\xE9 th\u0103m website, n\u1EBFu qu\xFD kh\xE1ch c\xF3 b\u1EA5t k\u1EF3 th\u1EAFc m\u1EAFc hay c\u1EA7n s\u1EF1 h\u1ED7 tr\u1EE3 n\xE0o, h\xE3y li\xEAn h\u1EC7 v\u1EDBi ch\xFAng t\xF4i theo c\xE1c k\xEAnh sau: "), shopConfig !== null && shopConfig !== void 0 && shopConfig.shopPhone ? /*#__PURE__*/React__default.createElement("div", {
12304
12513
  className: "flex items-center gap-2 rounded-lg overflow-hidden bg-white mt-6"
12305
- }, /*#__PURE__*/React__default.createElement(fa.FaFacebookF, {
12514
+ }, /*#__PURE__*/React__default.createElement(fa.FaPhoneAlt, {
12306
12515
  size: 40,
12307
12516
  className: "p-2 text-textButton bg-primary"
12308
12517
  }), /*#__PURE__*/React__default.createElement("div", null, "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i: ", shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopPhone)) : null, shopConfig !== null && shopConfig !== void 0 && shopConfig.shopZalo ? /*#__PURE__*/React__default.createElement("div", {
@@ -13282,7 +13491,7 @@ var SearchProduct1 = function SearchProduct1(props) {
13282
13491
  }
13283
13492
  }))
13284
13493
  }), (listProducts === null || listProducts === void 0 ? void 0 : listProducts.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
13285
- className: "max-h-64 overflow-y-auto flex flex-col gap-2 pr-3"
13494
+ className: "max-h-64 overflow-y-auto flex flex-col scroll-container gap-2 pr-3"
13286
13495
  }, listProducts === null || listProducts === void 0 ? void 0 : listProducts.map(function (item) {
13287
13496
  var _item$productInfo, _item$productInfo2;
13288
13497
  return /*#__PURE__*/React__default.createElement(LinkToPage, {
@@ -13370,7 +13579,7 @@ var SearchBar2 = function SearchBar2(props) {
13370
13579
  placeholder: data !== null && data !== void 0 && data.sectionTitle ? data === null || data === void 0 ? void 0 : data.sectionTitle : "Tìm kiếm sản phẩm",
13371
13580
  onChange: setSearchValue
13372
13581
  }), (products === null || products === void 0 ? void 0 : products.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
13373
- className: "max-h-64 overflow-y-auto flex flex-col gap-2"
13582
+ className: "max-h-64 overflow-y-auto scroll-container flex flex-col gap-2"
13374
13583
  }, products === null || products === void 0 ? void 0 : products.map(function (item, index) {
13375
13584
  var _item$productInfo;
13376
13585
  return /*#__PURE__*/React__default.createElement(LinkToPage, {
@@ -13397,10 +13606,17 @@ var SearchBar5 = function SearchBar5(props) {
13397
13606
  var _data$data, _data$data2, _data$data3, _data$data4, _data$data5;
13398
13607
  var _props$Link = props.Link,
13399
13608
  Link = _props$Link === void 0 ? null : _props$Link,
13609
+ _props$router = props.router,
13610
+ router = _props$router === void 0 ? function () {} : _props$router,
13400
13611
  data = props.data;
13401
13612
  var _useState = React.useState(""),
13402
13613
  value = _useState[0],
13403
13614
  setValue = _useState[1];
13615
+ var handleSearch = function handleSearch(e) {
13616
+ if ((e === null || e === void 0 ? void 0 : e.key) === "Enter" && value && value.length > 0) {
13617
+ router === null || router === void 0 ? void 0 : router.push(genLinkSearch(value));
13618
+ }
13619
+ };
13404
13620
  return /*#__PURE__*/React__default.createElement("div", {
13405
13621
  className: SECTION_CLASS + " md:mt-6"
13406
13622
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -13421,6 +13637,9 @@ var SearchBar5 = function SearchBar5(props) {
13421
13637
  }),
13422
13638
  wrapClassName: "w-full sm:w-[60%] md:w-[50%] lg:w-[40%]",
13423
13639
  className: "w-full bg-bgSecondary mb-2 md:h-12",
13640
+ onKeyDown: function onKeyDown(e) {
13641
+ handleSearch(e);
13642
+ },
13424
13643
  style: {
13425
13644
  borderRadius: "32px"
13426
13645
  },
@@ -13443,10 +13662,17 @@ var SearchBar6 = function SearchBar6(props) {
13443
13662
  var _data$data, _data$data2, _data$data3, _data$data4, _data$data5;
13444
13663
  var _props$Link = props.Link,
13445
13664
  Link = _props$Link === void 0 ? null : _props$Link,
13665
+ _props$router = props.router,
13666
+ router = _props$router === void 0 ? function () {} : _props$router,
13446
13667
  data = props.data;
13447
13668
  var _useState = React.useState(""),
13448
13669
  value = _useState[0],
13449
13670
  setValue = _useState[1];
13671
+ var handleSearch = function handleSearch(e) {
13672
+ if ((e === null || e === void 0 ? void 0 : e.key) === "Enter" && value && value.length > 0) {
13673
+ router === null || router === void 0 ? void 0 : router.push(genLinkSearch(value));
13674
+ }
13675
+ };
13450
13676
  return /*#__PURE__*/React__default.createElement("div", {
13451
13677
  className: "w-full flex flex-col justify-center px-3 md:px-6 gap-2 lg:gap-3 items-center h-32 lg:h-44 ",
13452
13678
  style: {
@@ -13468,7 +13694,10 @@ var SearchBar6 = function SearchBar6(props) {
13468
13694
  wrapClassName: " w-full h-full",
13469
13695
  inputClassName: "w-full",
13470
13696
  placeholder: data !== null && data !== void 0 && data.sectionTitle ? data === null || data === void 0 ? void 0 : data.sectionTitle : "Tìm kiếm sản phẩm",
13471
- onChange: setValue
13697
+ onChange: setValue,
13698
+ onKeyDown: function onKeyDown(e) {
13699
+ handleSearch(e);
13700
+ }
13472
13701
  }), /*#__PURE__*/React__default.createElement(React__default.Fragment, null, value && (value === null || value === void 0 ? void 0 : value.length) > 0 ? /*#__PURE__*/React__default.createElement(LinkToPage, {
13473
13702
  Link: Link,
13474
13703
  href: genLinkSearch(value)
@@ -13714,6 +13943,11 @@ var NewsController = function NewsController(props) {
13714
13943
  var _response$data2, _response$data2$data, _response$data3, _response$data3$data;
13715
13944
  setNewsArticles(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$data = _response$data2.data) === null || _response$data2$data === void 0 ? void 0 : _response$data2$data.content);
13716
13945
  setPage(response === null || response === void 0 ? void 0 : (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : (_response$data3$data = _response$data3.data) === null || _response$data3$data === void 0 ? void 0 : _response$data3$data.totalElements);
13946
+ var url = new URL(window.location.href);
13947
+ if (/^(\/(tin-tuc-theo-danh-muc))\/[^/]+-\d+$/.test(url.pathname)) {
13948
+ url.pathname = url.pathname.replace(/\/[^/]+-\d+$/, "");
13949
+ window.history.replaceState({}, '', url.pathname + url.search);
13950
+ }
13717
13951
  }
13718
13952
  setLoading(false);
13719
13953
  });
@@ -13909,13 +14143,12 @@ var News1 = function News1(props) {
13909
14143
  shopConfigStyle = _props$shopConfigStyl === void 0 ? {} : _props$shopConfigStyl,
13910
14144
  _props$Link = props.Link,
13911
14145
  Link = _props$Link === void 0 ? null : _props$Link,
13912
- _props$catId = props.catId,
13913
- catId = _props$catId === void 0 ? "" : _props$catId;
14146
+ catId = props.catId;
13914
14147
  var _useState = React.useState({
13915
14148
  page: 0,
13916
14149
  sort: "timeUpdate,DESC",
13917
- size: 10,
13918
- catId: catId
14150
+ catId: catId,
14151
+ size: 10
13919
14152
  }),
13920
14153
  params = _useState[0],
13921
14154
  setParams = _useState[1];
@@ -13945,11 +14178,11 @@ var News1 = function News1(props) {
13945
14178
  React.useEffect(function () {
13946
14179
  if ((newsCategories === null || newsCategories === void 0 ? void 0 : newsCategories.length) > 0 && params !== null && params !== void 0 && params.catId) {
13947
14180
  var category = newsCategories === null || newsCategories === void 0 ? void 0 : newsCategories.find(function (item) {
13948
- return (item === null || item === void 0 ? void 0 : item.catId) == catId;
14181
+ return (item === null || item === void 0 ? void 0 : item.catId) == (params === null || params === void 0 ? void 0 : params.catId);
13949
14182
  });
13950
14183
  setCategorySelected(category);
13951
14184
  }
13952
- }, [params === null || params === void 0 ? void 0 : params.catId, newsCategories]);
14185
+ }, [newsCategories]);
13953
14186
  return /*#__PURE__*/React__default.createElement("div", {
13954
14187
  className: SECTION_CLASS + " grid grid-cols-1 md:grid-cols-3 gap-6"
13955
14188
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -13994,18 +14227,29 @@ var News1 = function News1(props) {
13994
14227
  }) : null)), /*#__PURE__*/React__default.createElement("div", {
13995
14228
  className: "sticky top-20 self-start"
13996
14229
  }, /*#__PURE__*/React__default.createElement("div", {
13997
- className: "px-6 py-3 bg-primary rounded-t-lg text-lg text-textButton text-center"
14230
+ className: "px-6 py-3 bg-primary rounded-t-lg text-lg text-textButton text-center ",
14231
+ onClick: function onClick() {
14232
+ setParams({
14233
+ page: 0,
14234
+ sort: "timeUpdate,DESC",
14235
+ size: 10
14236
+ });
14237
+ }
13998
14238
  }, "Chuy\xEAn m\u1EE5c"), /*#__PURE__*/React__default.createElement("div", {
13999
14239
  className: "rounded-b-lg bg-bgSecondary"
14000
14240
  }, newsCategories === null || newsCategories === void 0 ? void 0 : newsCategories.map(function (item, index) {
14001
- return /*#__PURE__*/React__default.createElement(LinkToPage, {
14002
- href: getLinkNewsByCategory(item),
14003
- Link: Link,
14004
- key: "fjhnfg-" + index
14005
- }, /*#__PURE__*/React__default.createElement("div", {
14241
+ return /*#__PURE__*/React__default.createElement("div", {
14006
14242
  className: "px-6 py-3 hover:bg-gray-100 hover:text-primary cursor-pointer",
14007
- key: "sdjfdh-" + index
14008
- }, item === null || item === void 0 ? void 0 : item.catName));
14243
+ key: "sdjfdh-" + index,
14244
+ onClick: function onClick() {
14245
+ setCategorySelected(item);
14246
+ setParams(function (prev) {
14247
+ return _extends({}, prev, {
14248
+ catId: item === null || item === void 0 ? void 0 : item.catId
14249
+ });
14250
+ });
14251
+ }
14252
+ }, item === null || item === void 0 ? void 0 : item.catName);
14009
14253
  }))));
14010
14254
  };
14011
14255