@pisell/private-materials 3.2.21 → 3.2.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.
Files changed (183) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +13 -13
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/appointmentBooking/assets/guests.svg +1 -0
  12. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +83 -104
  13. package/es/components/appointmentBooking/components/Cart/Item/Total.js +1 -0
  14. package/es/components/appointmentBooking/components/Cart/Item/index.js +36 -17
  15. package/es/components/appointmentBooking/components/Cart/Item/index.less +7 -4
  16. package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  17. package/es/components/appointmentBooking/components/Content/index.js +11 -11
  18. package/es/components/appointmentBooking/components/Date/index.js +49 -32
  19. package/es/components/appointmentBooking/components/Date/index.less +5 -0
  20. package/es/components/appointmentBooking/components/Guest/index.js +8 -21
  21. package/es/components/appointmentBooking/components/Header/index.js +44 -7
  22. package/es/components/appointmentBooking/components/Resource/index.d.ts +1 -1
  23. package/es/components/appointmentBooking/components/Resource/index.js +28 -20
  24. package/es/components/appointmentBooking/components/Resource/index.less +5 -0
  25. package/es/components/appointmentBooking/components/Services/index.js +20 -9
  26. package/es/components/appointmentBooking/components/TimeSlicing/index.js +47 -32
  27. package/es/components/appointmentBooking/components/TimeSlicing/index.less +4 -0
  28. package/es/components/appointmentBooking/components/Voucher/index.d.ts +4 -0
  29. package/es/components/appointmentBooking/components/Voucher/index.js +238 -0
  30. package/es/components/appointmentBooking/components/Voucher/index.less +26 -0
  31. package/es/components/appointmentBooking/context.d.ts +2 -0
  32. package/es/components/appointmentBooking/context.js +7 -1
  33. package/es/components/appointmentBooking/hooks.d.ts +46 -9
  34. package/es/components/appointmentBooking/hooks.js +162 -121
  35. package/es/components/appointmentBooking/index.js +12 -7
  36. package/es/components/appointmentBooking/locales.d.ts +57 -0
  37. package/es/components/appointmentBooking/locales.js +60 -3
  38. package/es/components/appointmentBooking/utils.d.ts +19 -0
  39. package/es/components/appointmentBooking/utils.js +71 -2
  40. package/es/components/booking/addons/index.js +1 -0
  41. package/es/components/booking/components/TabProduct/index.d.ts +1 -0
  42. package/es/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
  43. package/es/components/booking/components/footer/index.js +5 -1
  44. package/es/components/booking/components/footer/utils.js +18 -2
  45. package/es/components/booking/components/voucher/index.d.ts +3 -0
  46. package/es/components/booking/components/voucher/index.js +238 -0
  47. package/es/components/booking/components/voucher/index.less +88 -0
  48. package/es/components/booking/components/voucher/pisellGoodPassCard/index.d.ts +47 -0
  49. package/es/components/booking/components/voucher/pisellGoodPassCard/index.js +115 -0
  50. package/es/components/booking/components/voucher/pisellGoodPassCard/index.less +52 -0
  51. package/es/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
  52. package/es/components/booking/hooks/useIsBooking4Shop.js +10 -0
  53. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
  54. package/es/components/booking/info/date/index.d.ts +1 -0
  55. package/es/components/booking/info/dateRange/index.d.ts +1 -0
  56. package/es/components/booking/info/notes/index.d.ts +1 -0
  57. package/es/components/booking/info/service/actions/index.d.ts +1 -0
  58. package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  59. package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
  60. package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
  61. package/es/components/booking/info/service2/Lists.d.ts +1 -0
  62. package/es/components/booking/info/utils.js +1 -1
  63. package/es/components/booking/info2/service/actions/index.d.ts +1 -0
  64. package/es/components/booking/info2/service/editService/index.js +9 -0
  65. package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  66. package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
  67. package/es/components/booking/locales.d.ts +18 -0
  68. package/es/components/booking/locales.js +21 -3
  69. package/es/components/booking/materiels/duration/index.d.ts +1 -0
  70. package/es/components/booking/materiels/holder/index.d.ts +1 -0
  71. package/es/components/booking/materiels/startTime/index.d.ts +1 -0
  72. package/es/components/booking/payments/index.js +1 -0
  73. package/es/components/booking/utils.d.ts +2 -2
  74. package/es/components/eftposPay/hooks.d.ts +2 -2
  75. package/es/components/eftposPay/store/index.d.ts +6 -6
  76. package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  77. package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  78. package/es/components/eventBooking/components/Provider/Information/index.d.ts +3 -0
  79. package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
  80. package/es/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
  81. package/es/components/shoppingCart/components/Cart/Product.js +3 -0
  82. package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
  83. package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
  84. package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
  85. package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  86. package/es/components/shoppingCart/hooks/useClearCart.js +4 -3
  87. package/es/components/shoppingCart/index.d.ts +1 -0
  88. package/es/components/shoppingCart/type.d.ts +1 -0
  89. package/es/components/wallet/Detail/index.js +20 -14
  90. package/es/components/wallet/Voucher/index.js +1 -0
  91. package/es/components/wallet/index.js +15 -1
  92. package/es/components/wallet/locales.d.ts +3 -0
  93. package/es/components/wallet/locales.js +3 -0
  94. package/es/components/wallet/model.d.ts +1 -1
  95. package/es/components/wallet/utils/formatUtils.js +1 -1
  96. package/es/components/walletList/index.js +5 -1
  97. package/lib/components/appointmentBooking/assets/guests.svg +1 -0
  98. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +37 -27
  99. package/lib/components/appointmentBooking/components/Cart/Item/Total.js +1 -0
  100. package/lib/components/appointmentBooking/components/Cart/Item/index.js +24 -11
  101. package/lib/components/appointmentBooking/components/Cart/Item/index.less +7 -4
  102. package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
  103. package/lib/components/appointmentBooking/components/Content/index.js +3 -5
  104. package/lib/components/appointmentBooking/components/Date/index.js +53 -47
  105. package/lib/components/appointmentBooking/components/Date/index.less +5 -0
  106. package/lib/components/appointmentBooking/components/Guest/index.js +6 -5
  107. package/lib/components/appointmentBooking/components/Header/index.js +25 -3
  108. package/lib/components/appointmentBooking/components/Resource/index.d.ts +1 -1
  109. package/lib/components/appointmentBooking/components/Resource/index.js +16 -17
  110. package/lib/components/appointmentBooking/components/Resource/index.less +5 -0
  111. package/lib/components/appointmentBooking/components/Services/index.js +21 -2
  112. package/lib/components/appointmentBooking/components/TimeSlicing/index.js +23 -21
  113. package/lib/components/appointmentBooking/components/TimeSlicing/index.less +4 -0
  114. package/lib/components/appointmentBooking/components/Voucher/index.d.ts +4 -0
  115. package/lib/components/appointmentBooking/components/Voucher/index.js +221 -0
  116. package/lib/components/appointmentBooking/components/Voucher/index.less +26 -0
  117. package/lib/components/appointmentBooking/context.d.ts +2 -0
  118. package/lib/components/appointmentBooking/context.js +4 -1
  119. package/lib/components/appointmentBooking/hooks.d.ts +46 -9
  120. package/lib/components/appointmentBooking/hooks.js +36 -43
  121. package/lib/components/appointmentBooking/index.js +11 -7
  122. package/lib/components/appointmentBooking/locales.d.ts +57 -0
  123. package/lib/components/appointmentBooking/locales.js +60 -3
  124. package/lib/components/appointmentBooking/utils.d.ts +19 -0
  125. package/lib/components/appointmentBooking/utils.js +42 -2
  126. package/lib/components/booking/addons/index.js +1 -1
  127. package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
  128. package/lib/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
  129. package/lib/components/booking/components/footer/index.js +2 -1
  130. package/lib/components/booking/components/footer/utils.js +4 -1
  131. package/lib/components/booking/components/voucher/index.d.ts +3 -0
  132. package/lib/components/booking/components/voucher/index.js +222 -0
  133. package/lib/components/booking/components/voucher/index.less +88 -0
  134. package/lib/components/booking/components/voucher/pisellGoodPassCard/index.d.ts +47 -0
  135. package/lib/components/booking/components/voucher/pisellGoodPassCard/index.js +109 -0
  136. package/lib/components/booking/components/voucher/pisellGoodPassCard/index.less +52 -0
  137. package/lib/components/booking/hooks/useIsBooking4Shop.d.ts +1 -0
  138. package/lib/components/booking/hooks/useIsBooking4Shop.js +51 -0
  139. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
  140. package/lib/components/booking/info/date/index.d.ts +1 -0
  141. package/lib/components/booking/info/dateRange/index.d.ts +1 -0
  142. package/lib/components/booking/info/notes/index.d.ts +1 -0
  143. package/lib/components/booking/info/service/actions/index.d.ts +1 -0
  144. package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
  145. package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
  146. package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
  147. package/lib/components/booking/info/service2/Lists.d.ts +1 -0
  148. package/lib/components/booking/info/utils.js +1 -1
  149. package/lib/components/booking/info2/service/actions/index.d.ts +1 -0
  150. package/lib/components/booking/info2/service/editService/index.js +8 -0
  151. package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
  152. package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
  153. package/lib/components/booking/locales.d.ts +18 -0
  154. package/lib/components/booking/locales.js +21 -3
  155. package/lib/components/booking/materiels/duration/index.d.ts +1 -0
  156. package/lib/components/booking/materiels/holder/index.d.ts +1 -0
  157. package/lib/components/booking/materiels/startTime/index.d.ts +1 -0
  158. package/lib/components/booking/payments/index.js +1 -1
  159. package/lib/components/booking/utils.d.ts +2 -2
  160. package/lib/components/eftposPay/hooks.d.ts +2 -2
  161. package/lib/components/eftposPay/store/index.d.ts +6 -6
  162. package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
  163. package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
  164. package/lib/components/eventBooking/components/Provider/Information/index.d.ts +3 -0
  165. package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
  166. package/lib/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
  167. package/lib/components/shoppingCart/components/Cart/Product.js +1 -0
  168. package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
  169. package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
  170. package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
  171. package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
  172. package/lib/components/shoppingCart/hooks/useClearCart.js +3 -2
  173. package/lib/components/shoppingCart/index.d.ts +1 -0
  174. package/lib/components/shoppingCart/type.d.ts +1 -0
  175. package/lib/components/wallet/Detail/index.js +6 -1
  176. package/lib/components/wallet/Voucher/index.js +1 -0
  177. package/lib/components/wallet/index.js +15 -1
  178. package/lib/components/wallet/locales.d.ts +3 -0
  179. package/lib/components/wallet/locales.js +3 -0
  180. package/lib/components/wallet/model.d.ts +1 -1
  181. package/lib/components/wallet/utils/formatUtils.js +1 -1
  182. package/lib/components/walletList/index.js +6 -2
  183. package/package.json +3 -3
@@ -36,19 +36,29 @@ var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
37
  var import_dayjs = __toESM(require("dayjs"));
38
38
  var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
39
- var import_state = require("./state");
40
39
  var import_classnames = __toESM(require("classnames"));
40
+ var import_utils = require("@pisell/utils");
41
41
  var import_icons = require("@ant-design/icons");
42
42
  var import_context = require("../../context");
43
43
  var import_index = require("./index.less");
44
44
  import_dayjs.default.extend(import_isSameOrBefore.default);
45
45
  var CalendarDate = (props) => {
46
+ const [loading, setLoading] = (0, import_react.useState)(false);
46
47
  const [currentDate, setCurrentDate] = (0, import_react.useState)();
47
48
  const [dateMonthList, setDateMonthList] = (0, import_react.useState)([]);
48
49
  const [currentMonth, setCurrentMonth] = (0, import_react.useState)(() => {
49
50
  return (0, import_dayjs.default)();
50
51
  });
51
52
  const { appointmentBooking } = (0, import_context.useAppointmentBookingContext)();
53
+ const weekListText = [
54
+ import_utils.locales.getText("pisell2.appointment.sunday"),
55
+ import_utils.locales.getText("pisell2.appointment.monday"),
56
+ import_utils.locales.getText("pisell2.appointment.tuesday"),
57
+ import_utils.locales.getText("pisell2.appointment.wednesday"),
58
+ import_utils.locales.getText("pisell2.appointment.thursday"),
59
+ import_utils.locales.getText("pisell2.appointment.friday"),
60
+ import_utils.locales.getText("pisell2.appointment.saturday")
61
+ ];
52
62
  const startingColumn = 0 % 7;
53
63
  const columns = Array.from(
54
64
  { length: 7 },
@@ -80,40 +90,44 @@ var CalendarDate = (props) => {
80
90
  return lastDate.isBefore((0, import_dayjs.default)(), "month");
81
91
  };
82
92
  const getDates = async (date) => {
83
- const startDate = (0, import_dayjs.default)(date).startOf("month").format("YYYY-MM-DD");
84
- const endDate = (0, import_dayjs.default)(date).endOf("month").format("YYYY-MM-DD");
85
- const params = {
86
- startDate,
87
- endDate
88
- };
89
- const data = await appointmentBooking.getAvailableDate(params);
90
- console.log(
91
- data,
92
- params,
93
- date,
94
- date.format("YYYY-MM") === (0, import_dayjs.default)().format("YYYY-MM"),
95
- "wh78968"
96
- );
97
- if (date.format("YYYY-MM") === (0, import_dayjs.default)().format("YYYY-MM")) {
98
- const firstAvailableDate = data.find(
99
- (d) => d.status === "available"
100
- );
101
- setCurrentDate(firstAvailableDate == null ? void 0 : firstAvailableDate.date);
102
- appointmentBooking.setDateRange([firstAvailableDate]);
103
- }
104
- const baseMonthData = getMonthData(date.format("YYYY-MM"));
105
- const updatedDates = baseMonthData.map((day) => {
106
- const matchedDay = data.find((d) => d.date === day.date);
107
- if (matchedDay) {
108
- return {
109
- ...day,
110
- ...matchedDay,
111
- disabled: matchedDay.status === "unavailable"
112
- };
93
+ try {
94
+ const startDate = (0, import_dayjs.default)(date).startOf("month").format("YYYY-MM-DD");
95
+ const endDate = (0, import_dayjs.default)(date).endOf("month").format("YYYY-MM-DD");
96
+ const params = {
97
+ startDate,
98
+ endDate
99
+ };
100
+ const data = await appointmentBooking.getAvailableDate(params);
101
+ const selected = await appointmentBooking.getDateRange();
102
+ if ((selected == null ? void 0 : selected.length) > 0) {
103
+ setCurrentDate(selected[0].date);
104
+ } else {
105
+ if (date.format("YYYY-MM") === (0, import_dayjs.default)().format("YYYY-MM")) {
106
+ const firstAvailableDate = data.find(
107
+ (d) => d.status === "available"
108
+ );
109
+ setCurrentDate(firstAvailableDate == null ? void 0 : firstAvailableDate.date);
110
+ appointmentBooking.setDateRange([firstAvailableDate]);
111
+ }
113
112
  }
114
- return day;
115
- });
116
- setDateMonthList(updatedDates);
113
+ const baseMonthData = getMonthData(date.format("YYYY-MM"));
114
+ const updatedDates = baseMonthData.map((day) => {
115
+ const matchedDay = data.find((d) => d.date === day.date);
116
+ if (matchedDay) {
117
+ return {
118
+ ...day,
119
+ ...matchedDay,
120
+ disabled: matchedDay.status === "unavailable"
121
+ };
122
+ }
123
+ return day;
124
+ });
125
+ setLoading(false);
126
+ setDateMonthList(updatedDates);
127
+ } catch (error) {
128
+ setLoading(false);
129
+ console.log(error, "wh978968234234");
130
+ }
117
131
  };
118
132
  (0, import_react.useEffect)(() => {
119
133
  getDates(currentMonth);
@@ -127,6 +141,7 @@ var CalendarDate = (props) => {
127
141
  let currentMonthText = currentMonth.format("YYYY-MM");
128
142
  let newNextMonth = (0, import_dayjs.default)(currentMonthText).add(1, "month");
129
143
  setCurrentMonth(newNextMonth);
144
+ setLoading(true);
130
145
  };
131
146
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-date-box" }, !dateMonthList.length ? /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading: true, active: true, style: { paddingTop: "16px" } }) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-header" }, /* @__PURE__ */ import_react.default.createElement(
132
147
  "div",
@@ -140,7 +155,7 @@ var CalendarDate = (props) => {
140
155
  }
141
156
  },
142
157
  /* @__PURE__ */ import_react.default.createElement(import_icons.CaretLeftOutlined, null)
143
- ), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-current-month" }, currentMonth.format("MMMM YYYY")), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-next-month", onClick: nextMonth }, /* @__PURE__ */ import_react.default.createElement(import_icons.CaretRightOutlined, null))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-weeks" }, columns.map((col) => /* @__PURE__ */ import_react.default.createElement("div", { key: col, className: "calendar-weeks-items" }, import_state.weekListText[Number(col)]))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-days" }, dateMonthList.map((day, index) => {
158
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-current-month" }, currentMonth.format("MMMM YYYY")), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-next-month", onClick: nextMonth }, /* @__PURE__ */ import_react.default.createElement(import_icons.CaretRightOutlined, null))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-weeks" }, columns.map((col) => /* @__PURE__ */ import_react.default.createElement("div", { key: col, className: "calendar-weeks-items" }, weekListText[Number(col)]))), /* @__PURE__ */ import_react.default.createElement("div", { className: "calendar-days" }, dateMonthList.map((day, index) => {
144
159
  const date = (0, import_dayjs.default)(day.date).format("YYYY-MM-DD");
145
160
  const isCurrentMonth = (0, import_dayjs.default)(day.date).isSame(
146
161
  currentMonth,
@@ -152,26 +167,17 @@ var CalendarDate = (props) => {
152
167
  key: index,
153
168
  className: (0, import_classnames.default)("calendar-days-items", {
154
169
  ["disabledDate"]: day == null ? void 0 : day.disabled,
155
- // ['disabledSelect']: status === 'sold_out',
156
170
  ["selectDate"]: currentDate === date,
157
- ["other-month-days"]: !isCurrentMonth
171
+ ["other-month-days"]: !isCurrentMonth,
172
+ ["loading-item"]: loading
158
173
  }),
159
174
  onClick: () => {
160
175
  if (day == null ? void 0 : day.disabled) return;
161
- console.log(day, "wh987976");
162
176
  setCurrentDate(date);
163
177
  appointmentBooking.setDateRange([day]);
164
178
  }
165
179
  },
166
- isCurrentMonth && /* @__PURE__ */ import_react.default.createElement(
167
- "div",
168
- {
169
- className: (0, import_classnames.default)("day-text", {
170
- // ['day-line']: !disabled,
171
- })
172
- },
173
- (0, import_dayjs.default)(day.date).format("D")
174
- )
180
+ isCurrentMonth && /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("day-text") }, (0, import_dayjs.default)(day.date).format("D"))
175
181
  );
176
182
  })))));
177
183
  };
@@ -128,4 +128,9 @@
128
128
  background: none;
129
129
  border: none;
130
130
  }
131
+
132
+ &.loading-item {
133
+ background: #eaecf0;
134
+ cursor: not-allowed;
135
+ }
131
136
  }
@@ -36,14 +36,12 @@ var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
37
  var import_materials = require("@pisell/materials");
38
38
  var import_utils = require("@pisell/utils");
39
- var import_hooks = require("../../hooks");
40
39
  var import_context = require("../../context");
40
+ var import_hooks = require("../../hooks");
41
41
  var import_utils2 = require("../../utils");
42
42
  var import_index = require("./index.less");
43
43
  var Guest = () => {
44
44
  const [openOption, setOpenOption] = (0, import_react.useState)(false);
45
- const [holderItem, setHolderItem] = (0, import_react.useState)(null);
46
- const [removeOpen, setRemoveOpen] = (0, import_react.useState)(false);
47
45
  const { carts, appointmentBooking } = (0, import_context.useAppointmentBookingContext)();
48
46
  const { accountLists } = (0, import_hooks.useAppointmentBookingAccount)();
49
47
  const lists = (0, import_react.useMemo)(() => {
@@ -80,7 +78,6 @@ var Guest = () => {
80
78
  {
81
79
  size: "large",
82
80
  onClick: () => {
83
- setHolderItem(item);
84
81
  setOpenOption(true);
85
82
  }
86
83
  },
@@ -93,7 +90,6 @@ var Guest = () => {
93
90
  menu: {
94
91
  items: _options,
95
92
  onClick: (e) => {
96
- setHolderItem(item);
97
93
  handleClick(e, item);
98
94
  }
99
95
  },
@@ -104,6 +100,11 @@ var Guest = () => {
104
100
  );
105
101
  };
106
102
  const handleAddGuest = () => {
103
+ if (accountLists.length >= 6) {
104
+ return (0, import_materials.PisellToast)({
105
+ content: import_utils.locales.getText("pisell2.appointment.max.guest")
106
+ });
107
+ }
107
108
  const guest = {
108
109
  id: (0, import_utils.getUniqueId)(),
109
110
  username: `Guest${accountLists.length + 1}`,
@@ -33,13 +33,35 @@ __export(Header_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(Header_exports);
35
35
  var import_react = __toESM(require("react"));
36
+ var import_utils = require("@pisell/utils");
36
37
  var import_progressBar = __toESM(require("../../../eventBooking/components/progressBar"));
37
38
  var import_context = require("../../context");
38
39
  var import_index = require("./index.less");
39
40
  var Header = () => {
40
41
  var _a, _b;
41
- const { currentStep, appointmentBooking } = (0, import_context.useAppointmentBookingContext)();
42
+ const { currentStep, appointmentBooking, resources } = (0, import_context.useAppointmentBookingContext)();
43
+ const stepName = (0, import_react.useMemo)(() => {
44
+ var _a2, _b2, _c, _d, _e;
45
+ const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
46
+ if (key === "select-resource") {
47
+ const name = ((_d = (_c = (_b2 = resources == null ? void 0 : resources[0]) == null ? void 0 : _b2.resources) == null ? void 0 : _c[0]) == null ? void 0 : _d.title) || "";
48
+ return import_utils.locales.getText("pisell2.event.select.category")(name);
49
+ }
50
+ return (_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.description;
51
+ }, [(_a = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a.key, resources]);
42
52
  const handleBack = () => {
53
+ var _a2;
54
+ const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
55
+ const types = {
56
+ "select-time": "time",
57
+ "select-resource": "resource"
58
+ };
59
+ if (types[key]) {
60
+ appointmentBooking.deleteCartItemInfo(types[key]);
61
+ }
62
+ if (key === "select-date") {
63
+ appointmentBooking.clearDateRange();
64
+ }
43
65
  appointmentBooking.back();
44
66
  };
45
67
  const handleClose = () => {
@@ -48,8 +70,8 @@ var Header = () => {
48
70
  return /* @__PURE__ */ import_react.default.createElement(
49
71
  import_progressBar.default,
50
72
  {
51
- title: (_a = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a.title,
52
- description: (_b = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _b.description,
73
+ title: (_b = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _b.title,
74
+ description: stepName,
53
75
  showBack: (currentStep == null ? void 0 : currentStep.index) > 0,
54
76
  onBack: () => handleBack(),
55
77
  onClose: () => handleClose()
@@ -1,3 +1,3 @@
1
1
  import './index.less';
2
- declare const Resource: ({ onChange }: any) => JSX.Element;
2
+ declare const Resource: () => JSX.Element;
3
3
  export default Resource;
@@ -38,32 +38,32 @@ var import_resourceDisplay = __toESM(require("../../../eventBooking/components/r
38
38
  var import_materials = require("@pisell/materials");
39
39
  var import_hooks = require("../../hooks");
40
40
  var import_context = require("../../context");
41
+ var import_guests = __toESM(require("../../assets/guests.svg"));
41
42
  var import_utils = require("@pisell/utils");
42
43
  var import_index = require("./index.less");
43
- var Resource = ({ onChange }) => {
44
+ var Resource = () => {
44
45
  const [selectedResource, setSelectedResource] = (0, import_react.useState)(0);
45
46
  const { appointmentBooking, resources, carts, resourceOtherParams } = (0, import_context.useAppointmentBookingContext)();
46
- const {
47
- getResourceList,
48
- getResourceTimeSlot,
49
- autoSelectAllProductResources
50
- } = (0, import_hooks.useAppointmentBookingResource)();
47
+ const { getResourceList, autoSelectAllProductResources } = (0, import_hooks.useAppointmentBookingResource)();
51
48
  console.log(resources, carts, appointmentBooking, "lists, products");
52
49
  (0, import_react.useEffect)(() => {
50
+ var _a, _b, _c;
53
51
  const _resources = getResourceList();
54
- autoSelectAllProductResources("resources");
52
+ const code = (_c = (_b = (_a = _resources == null ? void 0 : _resources[0]) == null ? void 0 : _a.resources) == null ? void 0 : _b[0]) == null ? void 0 : _c.code;
53
+ autoSelectAllProductResources(code);
55
54
  }, []);
56
55
  (0, import_react.useEffect)(() => {
57
56
  var _a;
58
- console.log(resourceOtherParams == null ? void 0 : resourceOtherParams.errorList, "errorListerrorListerrorList");
59
57
  if (((_a = resourceOtherParams == null ? void 0 : resourceOtherParams.errorList) == null ? void 0 : _a.length) > 0) {
60
- return;
58
+ return (0, import_materials.PisellToast)({
59
+ content: import_utils.locales.getText("pisell2.appointment.no.available.time")
60
+ });
61
61
  }
62
62
  }, [resourceOtherParams == null ? void 0 : resourceOtherParams.errorList]);
63
63
  const anyResource = [
64
64
  {
65
65
  id: 0,
66
- image: "https://cdn-partners-api.fresha.com/employee-avatars/processed/399178/medium/3b77991b-0ee2-4d0f-9d6f-a7501b39afcd-tempImageHYe20U.jpg",
66
+ image: import_guests.default,
67
67
  title: "Any professional",
68
68
  subtitle: "for maximum availability"
69
69
  }
@@ -71,7 +71,6 @@ var Resource = ({ onChange }) => {
71
71
  const currentResource = (0, import_react.useMemo)(() => {
72
72
  var _a, _b;
73
73
  if (resources.length && carts.length) {
74
- console.log(resources, carts, "lists, products");
75
74
  if (carts.length === 1) {
76
75
  return (_b = (_a = resources[0]) == null ? void 0 : _a.resources) == null ? void 0 : _b[0];
77
76
  } else {
@@ -88,12 +87,11 @@ var Resource = ({ onChange }) => {
88
87
  const onClick = (e) => {
89
88
  var _a;
90
89
  setSelectedResource(e.id);
91
- console.log(currentResource, e, "whcurrentResourcecurrentResource");
90
+ console.log(currentResource, e, carts, "whcurrentResourcecurrentResource");
92
91
  if (e.id) {
93
- getResourceTimeSlot({
94
- product: (_a = resources == null ? void 0 : resources[0]) == null ? void 0 : _a.product,
95
- resources: currentResource == null ? void 0 : currentResource.renderList,
96
- currentResourceId: e.id
92
+ return appointmentBooking.updateCart({
93
+ _id: (_a = carts == null ? void 0 : carts[0]) == null ? void 0 : _a._id,
94
+ resources: [e]
97
95
  });
98
96
  }
99
97
  };
@@ -111,7 +109,8 @@ var Resource = ({ onChange }) => {
111
109
  dataSource: item,
112
110
  direction: "vertical",
113
111
  children: !(item == null ? void 0 : item.image) ? (_a = item == null ? void 0 : item.title) == null ? void 0 : _a.charAt(0).toUpperCase() : null,
114
- selected: selectedResource === (item == null ? void 0 : item.id)
112
+ selected: selectedResource === (item == null ? void 0 : item.id),
113
+ className: !item.id ? "appointment-resource-guest-card" : ""
115
114
  }
116
115
  );
117
116
  },
@@ -3,4 +3,9 @@
3
3
  .pisell-lowcode-card {
4
4
  min-height: 166px !important;
5
5
  }
6
+
7
+ .appointment-resource-guest-card .pisell-lowcode-avatar-image img {
8
+ width: 50%;
9
+ height: 50%;
10
+ }
6
11
  }
@@ -33,22 +33,36 @@ __export(Services_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(Services_exports);
35
35
  var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
36
37
  var import_SearchLg = __toESM(require("@pisell/icon/es/SearchLg"));
37
38
  var import_utils = require("@pisell/utils");
38
39
  var import_materials = require("@pisell/materials");
39
- var import_antd = require("antd");
40
40
  var import_TabProduct = __toESM(require("../../../booking/components/TabProduct"));
41
41
  var import_utils2 = require("../../../booking/utils");
42
42
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
43
43
  var import_context = require("../../context");
44
+ var import_hooks = require("../../hooks");
45
+ var import_utils3 = require("../../utils");
44
46
  var import_index = require("./index.less");
45
47
  var Services = () => {
46
48
  const searchRef = (0, import_react.useRef)();
47
49
  const [search, setSearch] = (0, import_react.useState)("");
48
50
  const context = (0, import_useEngineContext.default)();
49
51
  const { utils } = context.appHelper || {};
50
- const { appointmentBooking, products, setProducts } = (0, import_context.useAppointmentBookingContext)();
52
+ const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
53
+ const { products, setProducts } = (0, import_context.useAppointmentBookingContext)();
54
+ const { accountLists } = (0, import_hooks.useAppointmentBookingAccount)();
55
+ const accountRef = (0, import_react.useRef)(accountLists);
56
+ const currentUser = (0, import_utils3.formatCurrentUser)();
51
57
  (0, import_react.useEffect)(() => {
58
+ console.log(accountLists, accountRef, "wh978896786");
59
+ }, [accountLists, accountRef]);
60
+ (0, import_react.useEffect)(() => {
61
+ var _a;
62
+ console.log(accountRef.current, currentUser, "accountRef");
63
+ if (!((_a = accountRef.current) == null ? void 0 : _a.length) && currentUser) {
64
+ appointmentBooking.addAccount([currentUser]);
65
+ }
52
66
  const { productModuleParams } = appointmentBooking.otherParams || {};
53
67
  appointmentBooking.loadProducts(productModuleParams).then((res) => {
54
68
  setProducts(res || []);
@@ -65,6 +79,11 @@ var Services = () => {
65
79
  const resources = ((_b = (_a = data == null ? void 0 : data.origin) == null ? void 0 : _a.product_resource) == null ? void 0 : _b.resources) || [];
66
80
  const activeStatus = resources.find((item2) => item2.status === 1);
67
81
  if (!activeStatus) {
82
+ return (0, import_materials.PisellToast)({
83
+ content: import_utils.locales.getText(
84
+ "pisell2.appointment.no.available.service"
85
+ )
86
+ });
68
87
  }
69
88
  const product = {
70
89
  ...data,
@@ -34,34 +34,31 @@ __export(TimeSlicing_exports, {
34
34
  module.exports = __toCommonJS(TimeSlicing_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_materials = require("@pisell/materials");
37
+ var import_utils = require("@pisell/utils");
37
38
  var import_context = require("../../context");
38
39
  var import_index = require("./index.less");
39
40
  var Resource = ({ params }) => {
40
41
  const [selectedResource, setSelectedResource] = (0, import_react.useState)("");
41
- const { times, resources, appointmentBooking, carts } = (0, import_context.useAppointmentBookingContext)();
42
+ const { times, resources, appointmentBooking, carts, setSelectedTime } = (0, import_context.useAppointmentBookingContext)();
42
43
  console.log(params, resources, times, "wh8765");
44
+ const getAutoSelect = async (val) => {
45
+ setSelectedTime(val);
46
+ const { errorList } = await appointmentBooking.autoSelectAllProductResources("sites", val);
47
+ const result = await appointmentBooking.submitTimeSlot(val);
48
+ console.log(errorList, result, "wh9896788");
49
+ };
50
+ (0, import_react.useEffect)(() => {
51
+ var _a;
52
+ if ((times == null ? void 0 : times.length) > 0) {
53
+ setSelectedResource((_a = times == null ? void 0 : times[0]) == null ? void 0 : _a.start_time);
54
+ getAutoSelect(times == null ? void 0 : times[0]);
55
+ }
56
+ }, [times]);
43
57
  const onClick = async (e) => {
44
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
45
58
  setSelectedResource(e == null ? void 0 : e.start_time);
46
- const data = await appointmentBooking.autoSelectResource({
47
- resourceProductData: resources == null ? void 0 : resources[0],
48
- resources: (_c = (_b = (_a = resources == null ? void 0 : resources[0]) == null ? void 0 : _a.resources) == null ? void 0 : _b[1]) == null ? void 0 : _c.renderList,
49
- timeSlots: e
50
- });
51
- if (data) {
52
- const _resources = [
53
- (_g = (_f = (_e = (_d = resources == null ? void 0 : resources[0]) == null ? void 0 : _d.resources) == null ? void 0 : _e[0]) == null ? void 0 : _f.renderList) == null ? void 0 : _g[0],
54
- (_k = (_j = (_i = (_h = resources == null ? void 0 : resources[0]) == null ? void 0 : _h.resources) == null ? void 0 : _i[1]) == null ? void 0 : _j.renderList) == null ? void 0 : _k[0]
55
- ];
56
- const aa = await appointmentBooking.submitTimeSlot({
57
- resourceProductData: resources == null ? void 0 : resources[0],
58
- selectedResources: _resources,
59
- timeSlots: e
60
- });
61
- console.log(data, _resources, aa, "wh9879676");
62
- }
59
+ getAutoSelect(e);
63
60
  };
64
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-time-slicing-wrap" }, times.map((item, index) => {
61
+ return (times == null ? void 0 : times.length) > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-time-slicing-wrap" }, times.map((item, index) => {
65
62
  return /* @__PURE__ */ import_react.default.createElement(
66
63
  "div",
67
64
  {
@@ -72,6 +69,11 @@ var Resource = ({ params }) => {
72
69
  /* @__PURE__ */ import_react.default.createElement("span", null, item == null ? void 0 : item.start_time),
73
70
  /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-chevron-right", className: `icon` })
74
71
  );
75
- }));
72
+ })) : /* @__PURE__ */ import_react.default.createElement(
73
+ import_materials.PisellEmpty,
74
+ {
75
+ description: import_utils.locales.getText("pisell2.appointment.booking.empty.time")
76
+ }
77
+ );
76
78
  };
77
79
  var TimeSlicing_default = Resource;
@@ -18,6 +18,10 @@
18
18
 
19
19
  &:hover {
20
20
  background-color: #f1f1f1;
21
+ cursor: pointer;
22
+ }
23
+ &.active {
24
+ background-color: #f1f1f1;
21
25
  }
22
26
  }
23
27
  }
@@ -0,0 +1,4 @@
1
+ import '../../../booking/components/voucher/index.less';
2
+ import './index.less';
3
+ declare const VoucherCard: (props: any) => JSX.Element;
4
+ export default VoucherCard;