@licklist/design 0.44.486-dev.18 → 0.44.486-dev.2

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 (160) hide show
  1. package/dist/collapsible-input-group/CollapsibleInputGroup.js +1 -1
  2. package/dist/date-time-button/DateTimeButton.js +1 -1
  3. package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
  4. package/dist/events/edit-event-modal/IntervalInput.js +1 -1
  5. package/dist/events/event-venue-map/hooks/useImage.d.ts.map +1 -1
  6. package/dist/events/event-venue-map/hooks/useImage.js +1 -1
  7. package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts +12 -0
  8. package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts.map +1 -0
  9. package/dist/iframe/activity-cards/activity-card/ActivityCard.js +1 -0
  10. package/dist/iframe/activity-cards/index.d.ts +3 -0
  11. package/dist/iframe/activity-cards/index.d.ts.map +1 -0
  12. package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts +12 -0
  13. package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts.map +1 -0
  14. package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.js +1 -0
  15. package/dist/iframe/event/event-calendar/EventCalendar.d.ts +3 -5
  16. package/dist/iframe/event/event-calendar/EventCalendar.d.ts.map +1 -1
  17. package/dist/iframe/event/event-calendar/EventCalendar.js +1 -1
  18. package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts +2 -3
  19. package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts.map +1 -1
  20. package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.js +1 -1
  21. package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts +3 -5
  22. package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
  23. package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.js +1 -1
  24. package/dist/iframe/index.d.ts +1 -1
  25. package/dist/iframe/index.d.ts.map +1 -1
  26. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
  27. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
  28. package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
  29. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +0 -1
  30. package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
  31. package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts +1 -1
  32. package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts.map +1 -1
  33. package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.js +1 -1
  34. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +2 -3
  35. package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
  36. package/dist/iframe/order-process/components/utils/useCategoryVerification.js +1 -1
  37. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
  38. package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
  39. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
  40. package/dist/iframe/payment/order-items-table/hooks/useTableData.js +1 -1
  41. package/dist/iframe/payment/order-items-table/types/index.d.ts +1 -7
  42. package/dist/iframe/payment/order-items-table/types/index.d.ts.map +1 -1
  43. package/dist/index.js +1 -1
  44. package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
  45. package/dist/notification/email-template/control/EmailTemplateControl.js +1 -1
  46. package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
  47. package/dist/product-set/form/ProductCategoriesControl.js +1 -1
  48. package/dist/product-set/form/ProductsControl.d.ts +1 -3
  49. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  50. package/dist/product-set/form/ProductsControl.js +1 -1
  51. package/dist/product-set/product/ProductControl.d.ts +1 -2
  52. package/dist/product-set/product/ProductControl.d.ts.map +1 -1
  53. package/dist/product-set/product/ProductControl.js +1 -1
  54. package/dist/product-set/product/duration/ProductDurationControl.js +1 -1
  55. package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
  56. package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
  57. package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
  58. package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
  59. package/dist/recurrence-input/RecurrenceEndInput.d.ts +1 -2
  60. package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
  61. package/dist/recurrence-input/RecurrenceEndInput.js +1 -1
  62. package/dist/recurrence-input/RecurrenceInput.d.ts +1 -2
  63. package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
  64. package/dist/recurrence-input/RecurrenceInput.js +1 -1
  65. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts +1 -4
  66. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
  67. package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +1 -1
  68. package/dist/snippet/snippet-template/preview/Preview.js +1 -1
  69. package/dist/static/CountryCodeSelect.d.ts.map +1 -1
  70. package/dist/static/CountryCodeSelect.js +1 -1
  71. package/dist/static/form-number-input/FormNumberInput.d.ts +1 -2
  72. package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
  73. package/dist/static/form-number-input/FormNumberInput.js +1 -1
  74. package/dist/styles/{activity-card/GridActivitiesCard.scss → iframe-customers-journey/ActivitiesCard.scss} +1 -1
  75. package/dist/styles/{activity-card/ListActivitiesCard.scss → iframe-customers-journey/ActivitiesSelectedCard.scss} +1 -2
  76. package/dist/styles/iframe-customers-journey/_index.scss +3 -0
  77. package/dist/styles/iframe-events/Calendar.scss +14 -14
  78. package/dist/styles/iframe-page/PageBody.scss +2 -3
  79. package/dist/styles/notification/Notification.scss +0 -4
  80. package/dist/styles/packages.scss +1 -2
  81. package/dist/styles/resources-blocking/_index.scss +0 -5
  82. package/dist/styles/themes/bookedit/_index.scss +0 -1
  83. package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
  84. package/dist/zone/form/components/AvailableTimesControl.js +1 -1
  85. package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
  86. package/dist/zone/form/components/ZoneControl.js +1 -1
  87. package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
  88. package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
  89. package/dist/zone/form/utils/dates.d.ts.map +1 -1
  90. package/dist/zone/form/utils/dates.js +1 -1
  91. package/package.json +1 -1
  92. package/src/collapsible-input-group/CollapsibleInputGroup.tsx +1 -1
  93. package/src/date-time-button/DateTimeButton.tsx +1 -1
  94. package/src/events/edit-event-modal/IntervalInput.tsx +0 -3
  95. package/src/events/event-venue-map/hooks/useImage.tsx +8 -17
  96. package/src/iframe/{activity-card → activity-cards/activity-card}/ActivityCard.stories.tsx +1 -24
  97. package/src/iframe/activity-cards/activity-card/ActivityCard.tsx +38 -0
  98. package/src/iframe/activity-cards/index.ts +2 -0
  99. package/src/iframe/activity-cards/list-activity-card/ListActivityCard.stories.tsx +52 -0
  100. package/src/iframe/activity-cards/list-activity-card/ListActivityCard.tsx +49 -0
  101. package/src/iframe/event/event-calendar/EventCalendar.stories.tsx +21 -20
  102. package/src/iframe/event/event-calendar/EventCalendar.tsx +3 -10
  103. package/src/iframe/event/event-calendar/components/CalendarDate/CalendarDate.tsx +2 -10
  104. package/src/iframe/event/event-calendar/components/CalendarDates/CalendarDates.tsx +2 -6
  105. package/src/iframe/index.ts +1 -1
  106. package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +0 -2
  107. package/src/iframe/order-process/components/BookingSummary/types/index.ts +0 -1
  108. package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx +2 -2
  109. package/src/iframe/order-process/components/utils/useCategoryVerification.ts +29 -28
  110. package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +1 -6
  111. package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +99 -11
  112. package/src/iframe/payment/order-items-table/types/index.ts +1 -18
  113. package/src/notification/email-template/control/EmailTemplateControl.tsx +1 -26
  114. package/src/product-set/form/ProductCategoriesControl.tsx +0 -2
  115. package/src/product-set/form/ProductSetForm.stories.tsx +0 -1
  116. package/src/product-set/form/ProductsControl.tsx +0 -10
  117. package/src/product-set/product/ProductControl.tsx +8 -31
  118. package/src/product-set/product/duration/ProductDurationControl.tsx +1 -1
  119. package/src/product-set/product-category/ProductCategoryControl.tsx +5 -15
  120. package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +8 -10
  121. package/src/recurrence-input/RecurrenceEndInput.tsx +9 -27
  122. package/src/recurrence-input/RecurrenceInput.tsx +0 -3
  123. package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +13 -23
  124. package/src/static/CountryCodeSelect.tsx +5 -3
  125. package/src/static/form-number-input/FormNumberInput.tsx +1 -8
  126. package/src/styles/{activity-card/GridActivitiesCard.scss → iframe-customers-journey/ActivitiesCard.scss} +1 -1
  127. package/src/styles/{activity-card/ListActivitiesCard.scss → iframe-customers-journey/ActivitiesSelectedCard.scss} +1 -2
  128. package/src/styles/iframe-customers-journey/_index.scss +3 -0
  129. package/src/styles/iframe-events/Calendar.scss +14 -14
  130. package/src/styles/iframe-page/PageBody.scss +2 -3
  131. package/src/styles/notification/Notification.scss +0 -4
  132. package/src/styles/packages.scss +1 -2
  133. package/src/styles/resources-blocking/_index.scss +0 -5
  134. package/src/styles/themes/bookedit/_index.scss +0 -1
  135. package/src/zone/form/components/AvailableTimesControl.tsx +9 -4
  136. package/src/zone/form/components/ZoneControl.tsx +0 -2
  137. package/src/zone/form/components/ZoneRecurrencesControl.tsx +35 -27
  138. package/src/zone/form/utils/dates.ts +36 -29
  139. package/dist/iframe/activity-card/ActivityCard.d.ts +0 -17
  140. package/dist/iframe/activity-card/ActivityCard.d.ts.map +0 -1
  141. package/dist/iframe/activity-card/ActivityCard.js +0 -1
  142. package/dist/iframe/activity-card/index.d.ts +0 -2
  143. package/dist/iframe/activity-card/index.d.ts.map +0 -1
  144. package/dist/iframe/payment/order-items-table/types/index.js +0 -1
  145. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts +0 -3
  146. package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +0 -1
  147. package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +0 -1
  148. package/dist/styles/activity-card/_index.scss +0 -2
  149. package/dist/styles/date-time-button/_index.scss +0 -1
  150. package/dist/zone/form/components/GameDurationControl.d.ts +0 -7
  151. package/dist/zone/form/components/GameDurationControl.d.ts.map +0 -1
  152. package/dist/zone/form/components/GameDurationControl.js +0 -1
  153. package/src/iframe/activity-card/ActivityCard.tsx +0 -77
  154. package/src/iframe/activity-card/index.ts +0 -1
  155. package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +0 -118
  156. package/src/styles/activity-card/_index.scss +0 -2
  157. package/src/styles/date-time-button/_index.scss +0 -1
  158. package/src/zone/form/components/GameDurationControl.tsx +0 -46
  159. /package/dist/styles/{date-time-button → iframe-customers-journey}/DateTimeButton.scss +0 -0
  160. /package/src/styles/{date-time-button → iframe-customers-journey}/DateTimeButton.scss +0 -0
@@ -1,4 +1,4 @@
1
- import React, { ReactElement } from "react";
1
+ import React from "react";
2
2
  import { Button } from "react-bootstrap";
3
3
  import { DateTime } from "luxon";
4
4
  import clsx from "clsx";
@@ -9,7 +9,6 @@ export type CalendarDateProps = {
9
9
  selectedDate?: DateTime;
10
10
  setSelectedDate: (date: DateTime) => void;
11
11
  isDisabled?: boolean;
12
- fromPrice?: string | ReactElement | null;
13
12
  };
14
13
 
15
14
  export const CalendarDate = ({
@@ -18,7 +17,6 @@ export const CalendarDate = ({
18
17
  selectedDate,
19
18
  setSelectedDate,
20
19
  isDisabled = false,
21
- fromPrice,
22
20
  }: CalendarDateProps) => {
23
21
  const onClick = () => {
24
22
  if (isDisabled) return;
@@ -39,13 +37,7 @@ export const CalendarDate = ({
39
37
  )}
40
38
  onClick={onClick}
41
39
  >
42
- <div>{currentDate.day}</div>
43
-
44
- {typeof fromPrice === "string" ? (
45
- <div>{fromPrice}</div>
46
- ) : (
47
- <>{fromPrice}</>
48
- )}
40
+ {currentDate.day}
49
41
  </Button>
50
42
  );
51
43
  };
@@ -1,4 +1,4 @@
1
- import React, { ReactElement, useContext, useMemo } from "react";
1
+ import React, { useContext, useMemo } from "react";
2
2
  import { DateTime } from "luxon";
3
3
  import { EventCalendarContext } from "@licklist/plugins/dist/context/event/EventCalendarContext";
4
4
  import { CalendarWeekdays } from "../CalendarWeekdays";
@@ -6,14 +6,11 @@ import { CalendarDate } from "../CalendarDate";
6
6
  import { CalendarBaseProps } from "../../types";
7
7
  import { isSelectedDateDisabled } from "../../utils";
8
8
 
9
- export type CalendarDatesProps = CalendarBaseProps & {
10
- fromPrice?: string | ReactElement | null;
11
- };
9
+ export type CalendarDatesProps = CalendarBaseProps;
12
10
 
13
11
  export const CalendarDates = ({
14
12
  disabledDates = [],
15
13
  isLoading = false,
16
- fromPrice,
17
14
  }: CalendarDatesProps) => {
18
15
  const { calendarDates, initialDate, selectedDate, setSelectedDate } =
19
16
  useContext(EventCalendarContext);
@@ -55,7 +52,6 @@ export const CalendarDates = ({
55
52
  selectedDate={selectedDate}
56
53
  setSelectedDate={setSelectedDate}
57
54
  isDisabled={isDisabled}
58
- fromPrice={fromPrice}
59
55
  />
60
56
  );
61
57
  })}
@@ -43,5 +43,5 @@ export {
43
43
  export { BackButton } from "./back-button";
44
44
  export { PoweredBy } from "./powered-by";
45
45
  export * from "./page";
46
- export * from "./activity-card";
46
+ export * from "./activity-cards";
47
47
  export { CustomDateField, CustomDateFieldProps } from "./custom-fields";
@@ -11,7 +11,6 @@ import { BookingSummaryAccordion } from "./components/BookingSummaryAccordion";
11
11
 
12
12
  export const BookingSummary = ({
13
13
  date,
14
- time,
15
14
  menuSteps,
16
15
  formValues,
17
16
  isNotShownPeopleAmount,
@@ -48,7 +47,6 @@ export const BookingSummary = ({
48
47
  <div className="event-info">
49
48
  <p className="m-0 title event-name">{eventName}</p>
50
49
  <p className="m-0">{date}</p>
51
- {time && <p className="m-0">{time}</p>}
52
50
  </div>
53
51
  <hr />
54
52
 
@@ -6,7 +6,6 @@ export const ACCORDION_KEY = "booking-summary";
6
6
 
7
7
  export type BookingSummaryProps = {
8
8
  date: string;
9
- time?: string;
10
9
  menuSteps?: MenuStep[];
11
10
  formValues?: {
12
11
  [key: string]: Order;
@@ -20,8 +20,8 @@ import { Step } from "@licklist/core/dist/DataMapper/Product/StepDataMapper";
20
20
  import { useTranslation } from "react-i18next";
21
21
  import { Product } from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
22
22
  import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
23
- import { MenuStep } from "@licklist/plugins/dist/types/context/sale/menuSteps";
24
23
  import { Category } from "./components/Category";
24
+ import { MenuStep } from "../../../../types";
25
25
  import { STEP_FORM_ID } from "../../constants";
26
26
  import { ErrorModal } from "../ErrorModal/ErrorModal";
27
27
  import { PageBody } from "../../../page/components/PageBody";
@@ -117,7 +117,7 @@ export const CalendarStepsForm = forwardRef<
117
117
  );
118
118
  return;
119
119
  }
120
- const categoryError = verifyCategoryItems(values, step.productCategories);
120
+ const categoryError = verifyCategoryItems(values, step);
121
121
 
122
122
  if (categoryError) {
123
123
  setStepFormError(categoryError.message);
@@ -1,6 +1,5 @@
1
- import { ProductCategory } from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
2
1
  import { useTranslation } from "react-i18next";
3
- import { Order } from "src/types";
2
+ import { MenuStep, Order } from "src/types";
4
3
 
5
4
  interface CategoryError {
6
5
  message: string;
@@ -13,39 +12,41 @@ export const useCategoryVerification = () => {
13
12
 
14
13
  return (
15
14
  values: Record<Order["id"], Order>,
16
- productCategories?: ProductCategory[]
15
+ step: MenuStep
17
16
  ): CategoryError | void => {
18
- let errorMessage: { id: number; message: string } | void;
17
+ let errorMessage;
19
18
 
20
19
  const productArray = Object.values(values).filter(
21
20
  (product) => product?.quantity > 0
22
21
  );
23
22
 
24
- productCategories.forEach(({ minSubItems, maxSubItems, id, name }) => {
25
- if (!minSubItems && !maxSubItems) return;
26
-
27
- const categoryProductsQuantity = productArray.filter(
28
- (product) => product?.productsCategoryId === id
29
- ).length;
30
-
31
- if (minSubItems && categoryProductsQuantity < minSubItems) {
32
- const message = t("Validation:fieldMinNumber", {
33
- min: minSubItems,
34
- attribute: `number of products in the ${name} category`,
35
- });
36
- errorMessage = { id, message };
37
-
38
- return;
23
+ step?.productCategories.forEach(
24
+ ({ minSubItems, maxSubItems, id, name }) => {
25
+ if (!minSubItems && !maxSubItems) return;
26
+
27
+ const categoryProductsQuantity = productArray.filter(
28
+ (product) => product?.productsCategoryId === id
29
+ ).length;
30
+
31
+ if (minSubItems && categoryProductsQuantity < minSubItems) {
32
+ const message = t("Validation:fieldMinNumber", {
33
+ min: minSubItems,
34
+ attribute: `number of products in the ${name} category`,
35
+ });
36
+ errorMessage = { id, message };
37
+
38
+ return;
39
+ }
40
+
41
+ if (maxSubItems && categoryProductsQuantity > maxSubItems) {
42
+ const message = t("Validation:fieldMaxNumber", {
43
+ max: maxSubItems,
44
+ attribute: `number of products in the ${name} category`,
45
+ });
46
+ errorMessage = { id, message };
47
+ }
39
48
  }
40
-
41
- if (maxSubItems && categoryProductsQuantity > maxSubItems) {
42
- const message = t("Validation:fieldMaxNumber", {
43
- max: maxSubItems,
44
- attribute: `number of products in the ${name} category`,
45
- });
46
- errorMessage = { id, message };
47
- }
48
- });
49
+ );
49
50
 
50
51
  return errorMessage;
51
52
  };
@@ -26,12 +26,7 @@ export const LeftBlock = ({
26
26
  <div className={clsx("left-block", className)} {...props}>
27
27
  {pageTitle && (
28
28
  <div className="navigation">
29
- {typeof pageTitle === "string" ? (
30
- <div className="title">{pageTitle}</div>
31
- ) : (
32
- pageTitle
33
- )}
34
-
29
+ <div className="title">{pageTitle}</div>
35
30
  {component}
36
31
  </div>
37
32
  )}
@@ -9,9 +9,15 @@ import {
9
9
  PAYMENT_TYPE_NET_PROFIT,
10
10
  } from "@licklist/core/dist/DataMapper/Order/PaymentDataMapper";
11
11
  import { StaticTableData } from "../../../../table";
12
- import { getProductQuantityAndPrice, getTotalSumByCategory } from "../utils";
12
+ import {
13
+ getProductQuantityAndPrice,
14
+ calculateTotalDiscount,
15
+ calculateTotalPrice,
16
+ getPaymentValueByType,
17
+ getExternalPaymentDetail,
18
+ getTotalSumByCategory,
19
+ } from "../utils";
13
20
  import { OrderItemsTableProps, SummaryItem } from "../types";
14
- import { getOrderSummaryItems } from "../utils/paymentSummary";
15
21
 
16
22
  const CURRENCY_DEFAULT = "GBP";
17
23
  export const PAYMENT_TYPE_TRANSLATE_KEYS = {
@@ -108,7 +114,9 @@ export const useTableData = ({
108
114
  );
109
115
  };
110
116
 
111
- const renderSummaryItems = (summaryItems: SummaryItem[]) => {
117
+ const renderSummaryItems = (
118
+ summaryItems: { translateKey: string; price: number }[]
119
+ ) => {
112
120
  return summaryItems.map(({ translateKey, price }) => {
113
121
  return {
114
122
  key: uniqueId(`summary-info-${translateKey}`),
@@ -119,6 +127,93 @@ export const useTableData = ({
119
127
  });
120
128
  };
121
129
 
130
+ const paymentNotProcessedSummary = () => {
131
+ const externalPaymentDetail = paymentDetail
132
+ ? getExternalPaymentDetail(paymentDetail)
133
+ : undefined;
134
+
135
+ const total = calculateTotalPrice(order, externalPaymentDetail);
136
+
137
+ const summaryItems: SummaryItem[] = [
138
+ {
139
+ translateKey: "amountTotal",
140
+ price: total,
141
+ },
142
+ ];
143
+
144
+ if (externalDiscount) {
145
+ summaryItems.push({
146
+ price: externalDiscount,
147
+ translateKey: "amountWithDiscount",
148
+ });
149
+ }
150
+
151
+ if (externalPaymentDetail) {
152
+ return [...summaryItems, ...getExternalPaymentDetail(paymentDetail)];
153
+ }
154
+
155
+ return summaryItems;
156
+ };
157
+
158
+ const processedPaymentSummary = () => {
159
+ const externalPaymentDetail =
160
+ paymentDetail && !order.payments.length
161
+ ? getExternalPaymentDetail(paymentDetail)
162
+ : Object.keys(PAYMENT_TYPE_TRANSLATE_KEYS).map((key) => {
163
+ return {
164
+ translateKey: PAYMENT_TYPE_TRANSLATE_KEYS[key],
165
+ price: getPaymentValueByType(order.payments, key),
166
+ };
167
+ });
168
+
169
+ const total = calculateTotalPrice(order, externalPaymentDetail);
170
+
171
+ const totalDiscount = calculateTotalDiscount(order.payments);
172
+ const totalWithDiscount = total - Number(totalDiscount);
173
+ let summaryItems: SummaryItem[] = [
174
+ {
175
+ translateKey: "amountTotal",
176
+ price: total,
177
+ },
178
+ ];
179
+
180
+ if (totalDiscount) {
181
+ summaryItems.push({
182
+ translateKey: "amountWithDiscount",
183
+ price: totalWithDiscount < 0 ? 0 : totalWithDiscount,
184
+ });
185
+ }
186
+
187
+ if (paymentDetail && !order.payments.length) {
188
+ return [...summaryItems, ...externalPaymentDetail];
189
+ }
190
+
191
+ summaryItems.push({
192
+ translateKey: "totalPaid",
193
+ price: totalWithDiscount <= 0 ? 0 : order.totalAmount,
194
+ });
195
+ if (totalWithDiscount <= 0) {
196
+ return summaryItems;
197
+ }
198
+ summaryItems = [...summaryItems, ...externalPaymentDetail];
199
+
200
+ if (totalWithDiscount > order.totalAmount) {
201
+ summaryItems.push({
202
+ translateKey: "remainingToPay",
203
+ price: totalWithDiscount - order.totalAmount,
204
+ });
205
+ }
206
+ return summaryItems;
207
+ };
208
+
209
+ const getOrderSummaryItems = () => {
210
+ if (!isPaymentProcessed) {
211
+ return paymentNotProcessedSummary();
212
+ }
213
+
214
+ return processedPaymentSummary();
215
+ };
216
+
122
217
  const data = useMemo(
123
218
  () => {
124
219
  if (!order) {
@@ -127,14 +222,7 @@ export const useTableData = ({
127
222
 
128
223
  return [
129
224
  ...renderProductsContent(),
130
- ...renderSummaryItems(
131
- getOrderSummaryItems({
132
- order,
133
- paymentDetail,
134
- isPaymentProcessed,
135
- externalDiscount,
136
- })
137
- ),
225
+ ...renderSummaryItems(getOrderSummaryItems()),
138
226
  ];
139
227
  },
140
228
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1,24 +1,7 @@
1
1
  import { Order } from "@licklist/core/dist/DataMapper/Order/OrderDataMapper";
2
2
  import { PaymentDetail } from "@licklist/core/dist/DataMapper/Order/PaymentDetailDataMapper";
3
3
 
4
- export const AMOUNT_TOTAL = "amountTotal";
5
- export const AMOUNT_WITH_DISCOUNT = "amountWithDiscount";
6
- export const TOTAL_PAID = "totalPaid";
7
- export const REMAINING_TO_PAY = "remainingToPay";
8
-
9
- export const SUMMARY_TRANSLATE_KEYS = [
10
- AMOUNT_TOTAL,
11
- AMOUNT_WITH_DISCOUNT,
12
- TOTAL_PAID,
13
- REMAINING_TO_PAY,
14
- ];
15
-
16
- export type SUMMARY_TRANSLATE_KEY = typeof SUMMARY_TRANSLATE_KEYS[number];
17
-
18
- export type SummaryItem = {
19
- translateKey: SUMMARY_TRANSLATE_KEY;
20
- price: number;
21
- };
4
+ export type SummaryItem = { translateKey: string; price: number };
22
5
 
23
6
  export type OrderItemsTableProps = {
24
7
  order?: Order;
@@ -314,38 +314,13 @@ export const EmailTemplateControl = React.forwardRef(
314
314
  <Row className="mb-4">
315
315
  <Form.Group as={Col}>
316
316
  <Form.Label>{t("Design:emailBody")}</Form.Label>
317
-
318
- <div className="alert alert-warning" role="alert">
319
- Due to the mail services limitations on the length of the email
320
- body that can be sent or received - maximum length is set to
321
- 65,535 characters.
322
- </div>
323
-
324
- <div className={`email-editor ${errors.body && "is-invalid"}`}>
317
+ <div className="email-editor">
325
318
  <EmailEditor
326
319
  ref={ref}
327
320
  onReady={onReadyEditor}
328
321
  style={{ height: "50rem" }}
329
322
  />
330
-
331
- <input
332
- type="hidden"
333
- name="body"
334
- {...register("body", {
335
- maxLength: {
336
- value: 65535,
337
- message: t("Validation:fieldMaxLength", {
338
- attribute: t("body"),
339
- max: 65535,
340
- }) as string,
341
- },
342
- })}
343
- />
344
323
  </div>
345
-
346
- <Form.Control.Feedback type="invalid">
347
- {errors.body?.message}
348
- </Form.Control.Feedback>
349
324
  </Form.Group>
350
325
  </Row>
351
326
  <Row>
@@ -72,7 +72,6 @@ export function ProductCategoriesControl({
72
72
  providerHasMap,
73
73
  expandedProductCategories,
74
74
  setExpandedProductCategories,
75
- zones,
76
75
  } = useContext(ProductSetLoadingContext);
77
76
  const form = useFormContext<ProductSetFormValues>();
78
77
  const [isSelectCategoryVisible, setIsSelectCategoryVisible] = useState(false);
@@ -288,7 +287,6 @@ export function ProductCategoriesControl({
288
287
  quantityType={productCategory.quantityType}
289
288
  hasTicket={productCategory?.hasTicket}
290
289
  stepIndex={stepIndex}
291
- zones={zones}
292
290
  productCategoryIndex={index}
293
291
  categoryType={productCategory.type}
294
292
  />
@@ -74,7 +74,6 @@ Default.args = {
74
74
  {
75
75
  createdAt: "2023-05-08T15:55:28.000+03:00",
76
76
  deletedAt: null,
77
- defaultDuration: 30,
78
77
  description: "Zone description 2",
79
78
  id: 2,
80
79
  image: null,
@@ -14,7 +14,6 @@ import { generateUuid } from "@licklist/core/dist/Services";
14
14
  import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
15
15
 
16
16
  import { CategoryType } from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
17
- import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
18
17
  import { ProductControl, ProductControlProps, ProductSetFormValues } from "..";
19
18
  import { SortableTree } from "../../sortable-tree";
20
19
  import { CreateProductSetItem } from "../item/CreateProductSetItem";
@@ -33,7 +32,6 @@ interface ProductsControlProps extends WithIsLoading {
33
32
  productCategoryIndex: number;
34
33
  hasTicket?: boolean;
35
34
  categoryType: CategoryType;
36
- zones?: Zone[];
37
35
  }
38
36
 
39
37
  const getDefaultProductValue = (sort: number): Product => ({
@@ -76,7 +74,6 @@ export function ProductsControl({
76
74
  productCategoryIndex,
77
75
  hasTicket,
78
76
  categoryType,
79
- zones,
80
77
  }: ProductsControlProps) {
81
78
  const { t } = useTranslation("Design");
82
79
  const form = useFormContext<ProductSetFormValues>();
@@ -92,12 +89,6 @@ export function ProductsControl({
92
89
  getValues,
93
90
  } = form;
94
91
 
95
- const zoneId = watch(
96
- `steps.${stepIndex}.productCategories.${productCategoryIndex}.zoneId`
97
- );
98
-
99
- const catergoryZone = zones?.find((zone) => zone.id === Number(zoneId));
100
-
101
92
  const productControlFieldName =
102
93
  `steps.${stepIndex}.productCategories.${productCategoryIndex}.products` as const;
103
94
 
@@ -254,7 +245,6 @@ export function ProductsControl({
254
245
  onProductNameChange={onChange}
255
246
  hasTicket={hasTicket}
256
247
  categoryType={categoryType}
257
- zoneDuration={catergoryZone?.defaultDuration}
258
248
  />
259
249
  }
260
250
  onDelete={() => onProductRemove(index)}
@@ -113,7 +113,6 @@ export interface ProductControlProps<T>
113
113
  productName: string;
114
114
  hasTicket?: boolean;
115
115
  categoryType?: CategoryType;
116
- zoneDuration?: number;
117
116
  }
118
117
 
119
118
  export function ProductControl<T extends FormValues>({
@@ -127,7 +126,6 @@ export function ProductControl<T extends FormValues>({
127
126
  productName,
128
127
  hasTicket,
129
128
  categoryType,
130
- zoneDuration,
131
129
  }: ProductControlProps<T>) {
132
130
  const {
133
131
  register,
@@ -135,7 +133,6 @@ export function ProductControl<T extends FormValues>({
135
133
  formState: { errors },
136
134
  setValue,
137
135
  getValues,
138
- setError,
139
136
  watch,
140
137
  } = useFormContext<T>();
141
138
 
@@ -193,13 +190,6 @@ export function ProductControl<T extends FormValues>({
193
190
  [handleImageUploading]
194
191
  );
195
192
 
196
- const onChangeGameCapacity = (value: number) => {
197
- setValue(
198
- `${fieldNamePrefix}.duration` as Path<T>,
199
- (value * zoneDuration) as UnpackNestedValue<PathValue<T, Path<T>>>
200
- );
201
- };
202
-
203
193
  const onImageRemove = useCallback(
204
194
  (id, path) => {
205
195
  handleImageRemove(String(id), path);
@@ -227,17 +217,6 @@ export function ProductControl<T extends FormValues>({
227
217
  }
228
218
  }, [images, fieldNamePrefix, setValue]);
229
219
 
230
- useEffect(() => {
231
- if (categoryType !== CATEGORY_TYPE_GAME || zoneDuration) {
232
- return;
233
- }
234
-
235
- setError(`${fieldNamePrefix}.duration` as Path<T>, {
236
- message: t("Validation:categoryZoneDoesntHaveDefaultDuration"),
237
- });
238
- // eslint-disable-next-line react-hooks/exhaustive-deps
239
- }, [categoryType, zoneDuration, fieldNamePrefix]);
240
-
241
220
  const quantitySelector = quantityValue ?? "1";
242
221
  const quantity = QUANTITY_TYPE_LIST_DTO[quantitySelector as string];
243
222
  return (
@@ -393,14 +372,6 @@ export function ProductControl<T extends FormValues>({
393
372
  <FormNumberInput
394
373
  fieldName={`${fieldNamePrefix}.capacity`}
395
374
  label={t("capacity")}
396
- rules={{
397
- min: {
398
- value: 1,
399
- message: t("Validation:fieldRequired", {
400
- attribute: t("capacity"),
401
- }) as string,
402
- },
403
- }}
404
375
  />
405
376
  </Col>
406
377
  </Row>
@@ -412,7 +383,6 @@ export function ProductControl<T extends FormValues>({
412
383
  <FormNumberInput
413
384
  fieldName={`${fieldNamePrefix}.capacity`}
414
385
  label={t("capacity")}
415
- onChange={onChangeGameCapacity}
416
386
  rules={{
417
387
  min: {
418
388
  value: 1,
@@ -427,7 +397,14 @@ export function ProductControl<T extends FormValues>({
427
397
  <FormNumberInput
428
398
  fieldName={`${fieldNamePrefix}.duration`}
429
399
  label={t("durationMinutes")}
430
- disabled
400
+ rules={{
401
+ min: {
402
+ value: 1,
403
+ message: t("Validation:fieldRequired", {
404
+ attribute: t("duration"),
405
+ }) as string,
406
+ },
407
+ }}
431
408
  />
432
409
  </Col>
433
410
  </Row>
@@ -66,7 +66,7 @@ export const ProductDurationControl = <T,>({
66
66
  },
67
67
  min: {
68
68
  value: 1,
69
- message: t("Validation:fieldMinNumber", {
69
+ message: t("Validation:fieldMin", {
70
70
  attribute: t("duration"),
71
71
  }),
72
72
  },
@@ -332,7 +332,7 @@ export function ProductCategoryControl({
332
332
  <Row>
333
333
  <Col>
334
334
  <Form.Group controlId={zoneId}>
335
- <Form.Label>{t("Design:zone")}</Form.Label>
335
+ <Form.Label>Zone</Form.Label>
336
336
  <Controller
337
337
  control={control}
338
338
  name={`${fieldNamePrefix}.zoneId`}
@@ -361,20 +361,10 @@ export function ProductCategoryControl({
361
361
  }),
362
362
  },
363
363
  validate: (value) => {
364
- if (category.type !== CATEGORY_TYPE_GAME) {
365
- return true;
366
- }
367
- const selelctedZone = zones?.find(
368
- (zone) => zone?.id === Number(value)
369
- );
370
-
371
- if (!selelctedZone?.defaultDuration) {
372
- return t(
373
- "Validation:zoneDoesntHaveDefaultDuration"
374
- ) as string;
375
- }
376
-
377
- return true;
364
+ if (value) return true;
365
+ return t("Validation:fieldRequired", {
366
+ attribute: t("zone"),
367
+ }) as string;
378
368
  },
379
369
  }}
380
370
  />
@@ -3,7 +3,7 @@ import React from "react";
3
3
  import { Col, Row } from "react-bootstrap";
4
4
  import { useFormContext } from "react-hook-form";
5
5
  import { useTranslation } from "react-i18next";
6
- import { TIME_FORMAT } from "@licklist/core/dist/Config";
6
+ import { useIntl } from "react-intl";
7
7
  import { WorkingHoursInputValues } from ".";
8
8
  import { useWeekdays } from "./utils";
9
9
 
@@ -12,9 +12,7 @@ export function WorkingHoursInputDescription() {
12
12
  const values = watch("workingHours");
13
13
  const weekdays = useWeekdays("short");
14
14
  const { t } = useTranslation("Design");
15
-
16
- if (!values) return null;
17
-
15
+ const { formatTime } = useIntl();
18
16
  return (
19
17
  <>
20
18
  {Array.from({ length: weekdays.length }, (_, i) => i)
@@ -28,16 +26,16 @@ export function WorkingHoursInputDescription() {
28
26
  {weekday?.end
29
27
  ? weekday.start
30
28
  ? t("timeInterval", {
31
- start: DateTime.fromISO(weekday.start).toFormat(
32
- TIME_FORMAT
29
+ start: formatTime(
30
+ DateTime.fromISO(weekday.start).toJSDate()
33
31
  ),
34
- end: DateTime.fromISO(weekday.start).toFormat(
35
- TIME_FORMAT
32
+ end: formatTime(
33
+ DateTime.fromISO(weekday.end).toJSDate()
36
34
  ),
37
35
  })
38
36
  : t("timeFrom", {
39
- start: DateTime.fromISO(weekday.start).toFormat(
40
- TIME_FORMAT
37
+ start: formatTime(
38
+ DateTime.fromISO(weekday.start).toJSDate()
41
39
  ),
42
40
  })
43
41
  : null}