s-platform-landing-section 0.1.21 → 0.1.22

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) {
@@ -539,7 +540,8 @@ var NavBar1 = function NavBar1(props) {
539
540
  _props$useSelector = props.useSelector,
540
541
  useSelector = _props$useSelector === void 0 ? null : _props$useSelector,
541
542
  _props$logout = props.logout,
542
- logout = _props$logout === void 0 ? function () {} : _props$logout;
543
+ logout = _props$logout === void 0 ? function () {} : _props$logout,
544
+ data = props.data;
543
545
  var cartItems = useSelector === null || useSelector === void 0 ? void 0 : useSelector(function (state) {
544
546
  var _state$cart;
545
547
  return state === null || state === void 0 ? void 0 : (_state$cart = state.cart) === null || _state$cart === void 0 ? void 0 : _state$cart.items;
@@ -597,7 +599,11 @@ var NavBar1 = function NavBar1(props) {
597
599
  top: "-100px"
598
600
  }
599
601
  }, 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"
602
+ className: "hidden lg:flex justify-between items-center px-20 py-2 bg-primary"
603
+ }, /*#__PURE__*/React__default.createElement("div", {
604
+ className: "text-background text-xl"
605
+ }, data === null || data === void 0 ? void 0 : data.title), /*#__PURE__*/React__default.createElement("div", {
606
+ className: "flex gap-6 "
601
607
  }, shopConfig !== null && shopConfig !== void 0 && shopConfig.shopPhone ? /*#__PURE__*/React__default.createElement("div", {
602
608
  className: "font-medium border-r pr-6 text-background"
603
609
  }, "Hotline: ", shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopPhone) : null, /*#__PURE__*/React__default.createElement("div", {
@@ -620,7 +626,7 @@ var NavBar1 = function NavBar1(props) {
620
626
  }, /*#__PURE__*/React__default.createElement(si.SiZalo, {
621
627
  size: 24,
622
628
  className: "p-1 rounded bg-background text-primary"
623
- })))), /*#__PURE__*/React__default.createElement("div", {
629
+ }))))), /*#__PURE__*/React__default.createElement("div", {
624
630
  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
631
  }, /*#__PURE__*/React__default.createElement(LinkToPage, {
626
632
  Link: Link,
@@ -7583,6 +7589,11 @@ var ProductController = function ProductController(props) {
7583
7589
  var _res$data2, _res$data3;
7584
7590
  setProducts(res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.data);
7585
7591
  setPage(res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.page);
7592
+ var url = new URL(window.location.href);
7593
+ if (/^(\/(danh-muc))\/[^/]+-\d+$/.test(url.pathname)) {
7594
+ url.pathname = url.pathname.replace(/\/[^/]+-\d+$/, "");
7595
+ window.history.replaceState({}, '', url.pathname + url.search);
7596
+ }
7586
7597
  }
7587
7598
  setLoading(false);
7588
7599
  });
@@ -7621,6 +7632,7 @@ var ProductController = function ProductController(props) {
7621
7632
  };
7622
7633
  return {
7623
7634
  products: products,
7635
+ setProducts: setProducts,
7624
7636
  loading: loading,
7625
7637
  page: page,
7626
7638
  getProductListSearch: getProductListSearch
@@ -8900,7 +8912,9 @@ var BookingForm = function BookingForm(props) {
8900
8912
  _props$defaultValue = props.defaultValue,
8901
8913
  defaultValue = _props$defaultValue === void 0 ? [] : _props$defaultValue,
8902
8914
  _props$className = props.className,
8903
- className = _props$className === void 0 ? "" : _props$className;
8915
+ className = _props$className === void 0 ? "" : _props$className,
8916
+ _props$isModalBooking = props.isModalBooking,
8917
+ isModalBooking = _props$isModalBooking === void 0 ? false : _props$isModalBooking;
8904
8918
  var _shopConfigStyle$colo = shopConfigStyle === null || shopConfigStyle === void 0 ? void 0 : shopConfigStyle.color,
8905
8919
  _shopConfigStyle$colo5 = _shopConfigStyle$colo.background,
8906
8920
  background = _shopConfigStyle$colo5 === void 0 ? "#fff" : _shopConfigStyle$colo5;
@@ -8927,9 +8941,9 @@ var BookingForm = function BookingForm(props) {
8927
8941
  var _useState7 = React.useState(false),
8928
8942
  isOpenPopup = _useState7[0],
8929
8943
  setIsOpenPopup = _useState7[1];
8930
- var _useState8 = React.useState({}),
8931
- dataBooking = _useState8[0],
8932
- setDataBooking = _useState8[1];
8944
+ var _useState8 = React.useState(false),
8945
+ isHiddenForm = _useState8[0],
8946
+ setIsHiddenForm = _useState8[1];
8933
8947
  var _EmployeeController = EmployeeController(_extends({}, props)),
8934
8948
  _EmployeeController$l = _EmployeeController.listEmployment,
8935
8949
  listEmployment = _EmployeeController$l === void 0 ? [] : _EmployeeController$l;
@@ -9056,11 +9070,14 @@ var BookingForm = function BookingForm(props) {
9056
9070
  return Promise.resolve(createSchedule(customerName, customerPhone, scheduleDate, services, shopId)).then(function (response) {
9057
9071
  var _response$data, _response$data$status;
9058
9072
  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);
9073
+ var _inputPhoneNumberRef$3, _inputNameRef$current3, _inputDateRef$current4;
9074
+ if (isModalBooking) {
9075
+ setIsHiddenForm(true);
9076
+ }
9061
9077
  setIsOpenPopup(true);
9062
9078
  inputPhoneNumberRef === null || inputPhoneNumberRef === void 0 ? void 0 : (_inputPhoneNumberRef$3 = inputPhoneNumberRef.current) === null || _inputPhoneNumberRef$3 === void 0 ? void 0 : _inputPhoneNumberRef$3.setValue("");
9063
9079
  inputNameRef === null || inputNameRef === void 0 ? void 0 : (_inputNameRef$current3 = inputNameRef.current) === null || _inputNameRef$current3 === void 0 ? void 0 : _inputNameRef$current3.setValue("");
9080
+ inputDateRef === null || inputDateRef === void 0 ? void 0 : (_inputDateRef$current4 = inputDateRef.current) === null || _inputDateRef$current4 === void 0 ? void 0 : _inputDateRef$current4.setValue(new Date());
9064
9081
  setListProductSelected([]);
9065
9082
  }
9066
9083
  });
@@ -9073,7 +9090,7 @@ var BookingForm = function BookingForm(props) {
9073
9090
  };
9074
9091
  var handleClosePopup = function handleClosePopup() {
9075
9092
  setIsOpenPopup(false);
9076
- setDataBooking({});
9093
+ setIsHiddenForm(false);
9077
9094
  };
9078
9095
  var handleSearchProducts = function handleSearchProducts(value) {
9079
9096
  setProductsParams(function (prev) {
@@ -9082,7 +9099,7 @@ var BookingForm = function BookingForm(props) {
9082
9099
  });
9083
9100
  });
9084
9101
  };
9085
- return /*#__PURE__*/React__default.createElement("div", {
9102
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !isHiddenForm ? /*#__PURE__*/React__default.createElement("div", {
9086
9103
  className: "grid gap-4 rounded-2xl p-6 border " + className,
9087
9104
  style: {
9088
9105
  backgroundColor: background
@@ -9214,32 +9231,23 @@ var BookingForm = function BookingForm(props) {
9214
9231
  label: "Đặt lịch ngay",
9215
9232
  shopConfigStyle: shopConfigStyle,
9216
9233
  onClick: handleSubmit
9217
- })), isOpenPopup && /*#__PURE__*/React__default.createElement(ModalNotification, {
9234
+ }))) : null, isOpenPopup && /*#__PURE__*/React__default.createElement(ModalNotification, {
9218
9235
  onCloseFormBooking: onCloseFormBooking,
9219
9236
  onClose: handleClosePopup
9220
9237
  }, /*#__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 "
9238
+ 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
9239
  }, /*#__PURE__*/React__default.createElement("div", {
9223
- className: "h-20 mb-4 flex items-center justify-center"
9240
+ className: "flex items-center justify-center"
9224
9241
  }, /*#__PURE__*/React__default.createElement(fa.FaCheckCircle, {
9225
9242
  className: "h-full text-green-500",
9226
9243
  style: {
9227
- fontSize: "150px"
9244
+ fontSize: "56px"
9228
9245
  }
9229
9246
  })), /*#__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
- })))));
9247
+ className: "font-medium text-2xl"
9248
+ }, "\u0110\u1EB7t l\u1ECBch th\xE0nh c\xF4ng"), /*#__PURE__*/React__default.createElement("div", {
9249
+ className: "text-center"
9250
+ }, "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
9251
  };
9244
9252
 
9245
9253
  var TreatmentsList7 = function TreatmentsList7(props) {
@@ -9364,7 +9372,8 @@ var TreatmentsList7 = function TreatmentsList7(props) {
9364
9372
  onCloseFormBooking: handleCloseModal,
9365
9373
  defaultValue: dataBooking,
9366
9374
  shopConfig: shopConfig,
9367
- shopConfigStyle: shopConfigStyle
9375
+ shopConfigStyle: shopConfigStyle,
9376
+ isModalBooking: isOpenModal
9368
9377
  })) : null);
9369
9378
  };
9370
9379
 
@@ -10228,8 +10237,27 @@ var Products10 = function Products10(props) {
10228
10237
  })) : /*#__PURE__*/React__default.createElement(NotFoundProduct, null));
10229
10238
  };
10230
10239
 
10240
+ var listFilter = [{
10241
+ label: "Khuyến mãi",
10242
+ value: "discount",
10243
+ filter: {
10244
+ isDiscount: true
10245
+ }
10246
+ }, {
10247
+ label: "Nổi bật",
10248
+ value: "isHighlight",
10249
+ filter: {
10250
+ isHighlight: true
10251
+ }
10252
+ }, {
10253
+ label: "Giá thấp đến cao",
10254
+ value: "sortPriceDESC",
10255
+ filter: {
10256
+ isHighlight: true
10257
+ }
10258
+ }];
10231
10259
  var Products11 = function Products11(props) {
10232
- var _products$slice;
10260
+ var _productsFilter$slice;
10233
10261
  var _props$shopConfigStyl = props.shopConfigStyle,
10234
10262
  shopConfigStyle = _props$shopConfigStyl === void 0 ? {} : _props$shopConfigStyl,
10235
10263
  _props$Link = props.Link,
@@ -10251,6 +10279,9 @@ var Products11 = function Products11(props) {
10251
10279
  var _useState3 = React.useState({}),
10252
10280
  categorySelected = _useState3[0],
10253
10281
  setCategorySelected = _useState3[1];
10282
+ var _useState4 = React.useState([]),
10283
+ productsFilter = _useState4[0],
10284
+ setProductsFilter = _useState4[1];
10254
10285
  var _CategoryController = CategoryController(_extends({}, props, {
10255
10286
  params: params
10256
10287
  })),
@@ -10284,36 +10315,66 @@ var Products11 = function Products11(props) {
10284
10315
  React.useEffect(function () {
10285
10316
  if ((categories === null || categories === void 0 ? void 0 : categories.length) > 0 && params !== null && params !== void 0 && params.categoryId) {
10286
10317
  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;
10318
+ return (item === null || item === void 0 ? void 0 : item.categoryId) == (params === null || params === void 0 ? void 0 : params.categoryId);
10288
10319
  });
10289
10320
  setCategorySelected(category);
10290
10321
  }
10291
- }, [params === null || params === void 0 ? void 0 : params.categoryId, categories]);
10292
- console.log("check page:::::::", page);
10322
+ }, [categories]);
10323
+ React.useEffect(function () {
10324
+ if ((products === null || products === void 0 ? void 0 : products.length) > 0) {
10325
+ setProductsFilter(products);
10326
+ }
10327
+ }, [products]);
10328
+ var handleFilter = function handleFilter(item) {
10329
+ if ((item === null || item === void 0 ? void 0 : item.value) === "sortPriceDESC") {
10330
+ var productsCopy = [].concat(products);
10331
+ productsCopy === null || productsCopy === void 0 ? void 0 : productsCopy.sort(function (a, b) {
10332
+ var _b$productInfo, _a$productInfo;
10333
+ 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);
10334
+ });
10335
+ setProductsFilter(productsCopy);
10336
+ } else if ((item === null || item === void 0 ? void 0 : item.value) === "discount") {
10337
+ var _productsCopy = [].concat(products);
10338
+ _productsCopy === null || _productsCopy === void 0 ? void 0 : _productsCopy.filter(function (product) {
10339
+ 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);
10340
+ });
10341
+ setProductsFilter(_productsCopy);
10342
+ } else if ((item === null || item === void 0 ? void 0 : item.value) === "isHighlight") {
10343
+ var _productsCopy3;
10344
+ var _productsCopy2 = [].concat(products);
10345
+ _productsCopy2 = (_productsCopy3 = _productsCopy2) === null || _productsCopy3 === void 0 ? void 0 : _productsCopy3.filter(function (product) {
10346
+ return (product === null || product === void 0 ? void 0 : product[item === null || item === void 0 ? void 0 : item.value]) === true;
10347
+ });
10348
+ setProductsFilter(_productsCopy2);
10349
+ } else {
10350
+ setProductsFilter(products);
10351
+ }
10352
+ };
10293
10353
  return /*#__PURE__*/React__default.createElement("div", {
10294
10354
  className: SECTION_CLASS + " grid grid-cols-1 md:grid-cols-4 gap-6"
10295
10355
  }, /*#__PURE__*/React__default.createElement("div", {
10296
10356
  className: "md:sticky top-20 self-start"
10297
10357
  }, /*#__PURE__*/React__default.createElement("div", {
10298
- className: "rounded-3xl bg-bgSecondary p-4"
10358
+ className: " flex flex-col gap-2 rounded-3xl bg-bgSecondary p-4"
10299
10359
  }, 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" : ""),
10360
+ return /*#__PURE__*/React__default.createElement("div", {
10361
+ 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" : ""),
10305
10362
  onClick: function onClick() {
10306
10363
  handleChooseCategory(item);
10307
10364
  },
10308
10365
  key: "sdjfdh-" + index
10309
- }, item === null || item === void 0 ? void 0 : item.cateName));
10366
+ }, item === null || item === void 0 ? void 0 : item.cateName);
10310
10367
  }))), /*#__PURE__*/React__default.createElement("div", {
10311
10368
  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", {
10369
+ }, /*#__PURE__*/React__default.createElement(CarouselItem, {
10370
+ data: listFilter,
10371
+ isNavigateButton: false,
10372
+ onClick: handleFilter
10373
+ }), loading && firstLoading ? /*#__PURE__*/React__default.createElement("div", {
10374
+ className: "w-full h-96 mb-1 flex justify-center items-center"
10375
+ }, /*#__PURE__*/React__default.createElement(Loading, null)) : /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
10315
10376
  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) {
10377
+ }, (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
10378
  return /*#__PURE__*/React__default.createElement(LinkToPage, {
10318
10379
  href: getLinkProductDetail(product === null || product === void 0 ? void 0 : product.productInfo),
10319
10380
  Link: Link,
@@ -10326,7 +10387,7 @@ var Products11 = function Products11(props) {
10326
10387
  }));
10327
10388
  }) : /*#__PURE__*/React__default.createElement("div", {
10328
10389
  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", {
10390
+ }, /*#__PURE__*/React__default.createElement(NotFoundProduct, null)))), /*#__PURE__*/React__default.createElement("div", {
10330
10391
  className: "w-full m-auto"
10331
10392
  }, (page === null || page === void 0 ? void 0 : page.total_pages) > 1 ? /*#__PURE__*/React__default.createElement(Pagination, {
10332
10393
  total_pages: page === null || page === void 0 ? void 0 : page.total_pages,
@@ -10442,8 +10503,21 @@ var ProductSale2 = function ProductSale2(props) {
10442
10503
  })) : null;
10443
10504
  };
10444
10505
 
10506
+ var listFilter$1 = [{
10507
+ label: "Khuyến mãi",
10508
+ value: "discount",
10509
+ filter: {
10510
+ isDiscount: true
10511
+ }
10512
+ }, {
10513
+ label: "Nổi bật",
10514
+ value: "isHighlight",
10515
+ filter: {
10516
+ isHighlight: true
10517
+ }
10518
+ }];
10445
10519
  var ProductSearch1 = function ProductSearch1(props) {
10446
- var _window, _window$location;
10520
+ var _window, _window$location, _productsFilter$slice;
10447
10521
  var _props$Link = props.Link,
10448
10522
  Link = _props$Link === void 0 ? null : _props$Link,
10449
10523
  _props$SectionTitle = props.SectionTitle,
@@ -10453,12 +10527,12 @@ var ProductSearch1 = function ProductSearch1(props) {
10453
10527
  shopConfigStyle = props.shopConfigStyle;
10454
10528
  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
10529
  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];
10530
+ var _useState = React.useState([]),
10531
+ productsFilter = _useState[0],
10532
+ setProductsFilter = _useState[1];
10459
10533
  var _useState2 = React.useState({
10460
10534
  productName: keywordValue,
10461
- size: 24
10535
+ size: 12
10462
10536
  }),
10463
10537
  params = _useState2[0],
10464
10538
  setParams = _useState2[1];
@@ -10477,36 +10551,34 @@ var ProductSearch1 = function ProductSearch1(props) {
10477
10551
  });
10478
10552
  });
10479
10553
  }, [keywordValue]);
10554
+ React.useEffect(function () {
10555
+ if ((products === null || products === void 0 ? void 0 : products.length) > 0) setProductsFilter(products);
10556
+ }, [products]);
10480
10557
  var handleGetMoreProducts = function handleGetMoreProducts() {
10481
10558
  setIsGetMore(false);
10482
- setLength(function (prev) {
10483
- return prev + 4;
10559
+ setParams(function (prev) {
10560
+ return _extends({}, prev, {
10561
+ size: (prev === null || prev === void 0 ? void 0 : prev.size) + 4
10562
+ });
10484
10563
  });
10485
10564
  };
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
10565
  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
- }
10566
+ if ((item === null || item === void 0 ? void 0 : item.value) === "discount") {
10567
+ var productsCopy = [].concat(products);
10568
+ productsCopy === null || productsCopy === void 0 ? void 0 : productsCopy.filter(function (product) {
10569
+ 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
10570
  });
10508
- return _extends({}, newParams, item === null || item === void 0 ? void 0 : item.filter);
10509
- });
10571
+ setProductsFilter(productsCopy);
10572
+ } else if ((item === null || item === void 0 ? void 0 : item.value) === "isHighlight") {
10573
+ var _productsCopy2;
10574
+ var _productsCopy = [].concat(products);
10575
+ _productsCopy = (_productsCopy2 = _productsCopy) === null || _productsCopy2 === void 0 ? void 0 : _productsCopy2.filter(function (product) {
10576
+ return (product === null || product === void 0 ? void 0 : product[item === null || item === void 0 ? void 0 : item.value]) === true;
10577
+ });
10578
+ setProductsFilter(_productsCopy);
10579
+ } else {
10580
+ setProductsFilter(products);
10581
+ }
10510
10582
  };
10511
10583
  return /*#__PURE__*/React__default.createElement("div", {
10512
10584
  className: SECTION_CLASS + " flex flex-col gap-4 md:gap-6 "
@@ -10518,20 +10590,20 @@ var ProductSearch1 = function ProductSearch1(props) {
10518
10590
  }), /*#__PURE__*/React__default.createElement("div", {
10519
10591
  className: "text-lg"
10520
10592
  }, "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,
10593
+ data: listFilter$1,
10522
10594
  isNavigateButton: false,
10523
10595
  onClick: handleFilter
10524
10596
  }), loading && isGetMore ? /*#__PURE__*/React__default.createElement("div", {
10525
10597
  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", {
10598
+ }, /*#__PURE__*/React__default.createElement(Loading, null)) : (productsFilter === null || productsFilter === void 0 ? void 0 : productsFilter.length) > 0 ? /*#__PURE__*/React__default.createElement("div", {
10527
10599
  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) {
10600
+ }, 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
10601
  return /*#__PURE__*/React__default.createElement(ProductItem, {
10530
10602
  Link: Link,
10531
10603
  product: product === null || product === void 0 ? void 0 : product.productInfo,
10532
10604
  key: "htrhr-" + idx
10533
10605
  });
10534
- })) : /*#__PURE__*/React__default.createElement(NotFoundProduct, null), !loading && (products === null || products === void 0 ? void 0 : products.length) > 8 + length ? /*#__PURE__*/React__default.createElement(Button, {
10606
+ })) : /*#__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
10607
  label: "Xem thêm",
10536
10608
  onClick: handleGetMoreProducts,
10537
10609
  className: "mx-auto " + (shopConfigStyle === null || shopConfigStyle === void 0 ? void 0 : shopConfigStyle.buttonClass),
@@ -11025,7 +11097,7 @@ var ProductDetail10 = function ProductDetail10(props) {
11025
11097
  };
11026
11098
 
11027
11099
  var ProductDetail11 = function ProductDetail11(props) {
11028
- var _product$images2, _product$images3, _product$attributes, _product$attributes2;
11100
+ var _product$images2, _product$images3, _product$images4, _product$images5, _product$attributes, _product$attributes2;
11029
11101
  var shopConfigStyle = props.shopConfigStyle,
11030
11102
  shopConfig = props.shopConfig,
11031
11103
  _props$handleRedirect = props.handleRedirect,
@@ -11147,7 +11219,7 @@ var ProductDetail11 = function ProductDetail11(props) {
11147
11219
  className: "grid grid-cols-5 gap-6"
11148
11220
  }, /*#__PURE__*/React__default.createElement("div", {
11149
11221
  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) {
11222
+ }, (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
11223
  return /*#__PURE__*/React__default.createElement("img", {
11152
11224
  src: item === null || item === void 0 ? void 0 : item.imageUrl,
11153
11225
  key: item === null || item === void 0 ? void 0 : item.imageId,
@@ -11157,7 +11229,13 @@ var ProductDetail11 = function ProductDetail11(props) {
11157
11229
  handleDisplayImage(item);
11158
11230
  }
11159
11231
  });
11160
- })), /*#__PURE__*/React__default.createElement("div", {
11232
+ }) : /*#__PURE__*/React__default.createElement("div", {
11233
+ className: "p-2 border rounded-lg"
11234
+ }, /*#__PURE__*/React__default.createElement(SvgImageGallery, {
11235
+ width: "100%",
11236
+ height: "25%",
11237
+ fill: "#D9D9D9"
11238
+ }))), /*#__PURE__*/React__default.createElement("div", {
11161
11239
  className: "flex flex-col gap-4 col-span-5 lg:col-span-4 p-4 border border-stroke rounded-2xl"
11162
11240
  }, displayImage ? /*#__PURE__*/React__default.createElement("img", {
11163
11241
  src: displayImage === null || displayImage === void 0 ? void 0 : displayImage.imageUrl,
@@ -11173,7 +11251,7 @@ var ProductDetail11 = function ProductDetail11(props) {
11173
11251
  fill: "#D9D9D9"
11174
11252
  }))), /*#__PURE__*/React__default.createElement("div", {
11175
11253
  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) {
11254
+ }, (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
11255
  return /*#__PURE__*/React__default.createElement("img", {
11178
11256
  src: item === null || item === void 0 ? void 0 : item.imageUrl,
11179
11257
  key: item === null || item === void 0 ? void 0 : item.imageId,
@@ -11183,7 +11261,7 @@ var ProductDetail11 = function ProductDetail11(props) {
11183
11261
  handleDisplayImage(item);
11184
11262
  }
11185
11263
  });
11186
- }))), /*#__PURE__*/React__default.createElement("div", {
11264
+ }) : null)), /*#__PURE__*/React__default.createElement("div", {
11187
11265
  className: "mt-2 md:ms-10"
11188
11266
  }, /*#__PURE__*/React__default.createElement("p", {
11189
11267
  className: "font-semibold text-2xl"
@@ -11268,8 +11346,8 @@ var ProductDetail11 = function ProductDetail11(props) {
11268
11346
  setIsSeeMore(!isSeeMore);
11269
11347
  }
11270
11348
  })) : 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", {
11349
+ className: "text-lg text-gray3 rounded-lg p-2"
11350
+ }, "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
11351
  className: "lg:col-span-2"
11274
11352
  }, /*#__PURE__*/React__default.createElement("h2", {
11275
11353
  className: "text-3xl mb-8 font-semibold"
@@ -11676,7 +11754,7 @@ var Footer1 = function Footer1(props) {
11676
11754
  var genShopAddress = function genShopAddress() {
11677
11755
  try {
11678
11756
  var addressJson = JSON.parse(shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopAddress);
11679
- if (addressJson) {
11757
+ if (Array.isArray(addressJson) && addressJson && (addressJson === null || addressJson === void 0 ? void 0 : addressJson.length) > 0) {
11680
11758
  setShopAddressList(addressJson);
11681
11759
  } else {
11682
11760
  setShopAddressList([{
@@ -11712,7 +11790,7 @@ var Footer1 = function Footer1(props) {
11712
11790
  className: " col-span-2 flex flex-col mb-10 leading-8 sm:mb-0 "
11713
11791
  }, /*#__PURE__*/React__default.createElement("div", {
11714
11792
  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) {
11793
+ }, "Th\xF4ng tin li\xEAn h\u1EC7"), Array.isArray(shopAddressList) ? shopAddressList === null || shopAddressList === void 0 ? void 0 : shopAddressList.map(function (item, index) {
11716
11794
  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
11795
  className: "flex gap-2 items-center"
11718
11796
  }, /*#__PURE__*/React__default.createElement(hi.HiOutlineLocationMarker, {
@@ -11730,7 +11808,7 @@ var Footer1 = function Footer1(props) {
11730
11808
  color: primary
11731
11809
  }
11732
11810
  }), /*#__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", {
11811
+ }) : null), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
11734
11812
  className: "mb-3 font-semibold text-lg"
11735
11813
  }, "Li\xEAn k\u1EBFt"), /*#__PURE__*/React__default.createElement("div", {
11736
11814
  className: "leading-10 flex flex-col "
@@ -11816,7 +11894,7 @@ var Footer7 = function Footer7(props) {
11816
11894
  var genShopAddress = function genShopAddress() {
11817
11895
  try {
11818
11896
  var addressJson = JSON.parse(shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.shopAddress);
11819
- if (addressJson) {
11897
+ if (Array.isArray(addressJson) && addressJson && (addressJson === null || addressJson === void 0 ? void 0 : addressJson.length) > 0) {
11820
11898
  setShopAddressList(addressJson);
11821
11899
  } else {
11822
11900
  setShopAddressList([{
@@ -12065,7 +12143,7 @@ var CustomerRating6 = function CustomerRating6(props) {
12065
12143
  _props$SectionTitle = props.SectionTitle,
12066
12144
  SectionTitle = _props$SectionTitle === void 0 ? null : _props$SectionTitle;
12067
12145
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
12068
- className: SECTION_CLASS + " !my-0 py-12 bg-bgSecondary"
12146
+ className: SECTION_CLASS + " !my-0 py-12 bg-"
12069
12147
  }, /*#__PURE__*/React__default.createElement(SectionTitle, {
12070
12148
  data: data,
12071
12149
  shopConfigStyle: shopConfigStyle
@@ -12075,9 +12153,9 @@ var CustomerRating6 = function CustomerRating6(props) {
12075
12153
  return /*#__PURE__*/React__default.createElement("div", {
12076
12154
  key: index,
12077
12155
  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"
12156
+ }, /*#__PURE__*/React__default.createElement(md.MdOutlineFormatQuote, {
12157
+ size: 43,
12158
+ className: "absolute text-black top-[-20px] right-8"
12081
12159
  }), /*#__PURE__*/React__default.createElement("div", {
12082
12160
  className: "flex items-end gap-2"
12083
12161
  }, /*#__PURE__*/React__default.createElement("img", {
@@ -12302,7 +12380,7 @@ var Contact1 = function Contact1(props) {
12302
12380
  className: "grid grid-cols-1 lg:grid-cols-2 gap-12 mt-6"
12303
12381
  }, /*#__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
12382
  className: "flex items-center gap-2 rounded-lg overflow-hidden bg-white mt-6"
12305
- }, /*#__PURE__*/React__default.createElement(fa.FaFacebookF, {
12383
+ }, /*#__PURE__*/React__default.createElement(fa.FaPhoneAlt, {
12306
12384
  size: 40,
12307
12385
  className: "p-2 text-textButton bg-primary"
12308
12386
  }), /*#__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", {
@@ -13714,6 +13792,11 @@ var NewsController = function NewsController(props) {
13714
13792
  var _response$data2, _response$data2$data, _response$data3, _response$data3$data;
13715
13793
  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
13794
  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);
13795
+ var url = new URL(window.location.href);
13796
+ if (/^(\/(tin-tuc-theo-danh-muc))\/[^/]+-\d+$/.test(url.pathname)) {
13797
+ url.pathname = url.pathname.replace(/\/[^/]+-\d+$/, "");
13798
+ window.history.replaceState({}, '', url.pathname + url.search);
13799
+ }
13717
13800
  }
13718
13801
  setLoading(false);
13719
13802
  });
@@ -13909,13 +13992,12 @@ var News1 = function News1(props) {
13909
13992
  shopConfigStyle = _props$shopConfigStyl === void 0 ? {} : _props$shopConfigStyl,
13910
13993
  _props$Link = props.Link,
13911
13994
  Link = _props$Link === void 0 ? null : _props$Link,
13912
- _props$catId = props.catId,
13913
- catId = _props$catId === void 0 ? "" : _props$catId;
13995
+ catId = props.catId;
13914
13996
  var _useState = React.useState({
13915
13997
  page: 0,
13916
13998
  sort: "timeUpdate,DESC",
13917
- size: 10,
13918
- catId: catId
13999
+ catId: catId,
14000
+ size: 10
13919
14001
  }),
13920
14002
  params = _useState[0],
13921
14003
  setParams = _useState[1];
@@ -13945,11 +14027,11 @@ var News1 = function News1(props) {
13945
14027
  React.useEffect(function () {
13946
14028
  if ((newsCategories === null || newsCategories === void 0 ? void 0 : newsCategories.length) > 0 && params !== null && params !== void 0 && params.catId) {
13947
14029
  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;
14030
+ return (item === null || item === void 0 ? void 0 : item.catId) == (params === null || params === void 0 ? void 0 : params.catId);
13949
14031
  });
13950
14032
  setCategorySelected(category);
13951
14033
  }
13952
- }, [params === null || params === void 0 ? void 0 : params.catId, newsCategories]);
14034
+ }, [newsCategories]);
13953
14035
  return /*#__PURE__*/React__default.createElement("div", {
13954
14036
  className: SECTION_CLASS + " grid grid-cols-1 md:grid-cols-3 gap-6"
13955
14037
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -13994,18 +14076,29 @@ var News1 = function News1(props) {
13994
14076
  }) : null)), /*#__PURE__*/React__default.createElement("div", {
13995
14077
  className: "sticky top-20 self-start"
13996
14078
  }, /*#__PURE__*/React__default.createElement("div", {
13997
- className: "px-6 py-3 bg-primary rounded-t-lg text-lg text-textButton text-center"
14079
+ className: "px-6 py-3 bg-primary rounded-t-lg text-lg text-textButton text-center ",
14080
+ onClick: function onClick() {
14081
+ setParams({
14082
+ page: 0,
14083
+ sort: "timeUpdate,DESC",
14084
+ size: 10
14085
+ });
14086
+ }
13998
14087
  }, "Chuy\xEAn m\u1EE5c"), /*#__PURE__*/React__default.createElement("div", {
13999
14088
  className: "rounded-b-lg bg-bgSecondary"
14000
14089
  }, 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", {
14090
+ return /*#__PURE__*/React__default.createElement("div", {
14006
14091
  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));
14092
+ key: "sdjfdh-" + index,
14093
+ onClick: function onClick() {
14094
+ setCategorySelected(item);
14095
+ setParams(function (prev) {
14096
+ return _extends({}, prev, {
14097
+ catId: item === null || item === void 0 ? void 0 : item.catId
14098
+ });
14099
+ });
14100
+ }
14101
+ }, item === null || item === void 0 ? void 0 : item.catName);
14009
14102
  }))));
14010
14103
  };
14011
14104