@licklist/design 0.44.486-dev.2 → 0.44.486-dev.21
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/assets/iframe/available.svg.js +1 -0
- package/dist/assets/iframe/limited.svg.js +1 -0
- package/dist/assets/iframe/soldOut.svg.js +1 -0
- package/dist/collapsible-input-group/CollapsibleInputGroup.js +1 -1
- package/dist/date-time-button/DateTimeButton.d.ts +5 -1
- package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
- package/dist/date-time-button/DateTimeButton.js +1 -1
- package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +1 -1
- package/dist/events/event-venue-map/hooks/useImage.d.ts.map +1 -1
- package/dist/events/event-venue-map/hooks/useImage.js +1 -1
- package/dist/iframe/activity-card/ActivityCard.d.ts +17 -0
- package/dist/iframe/activity-card/ActivityCard.d.ts.map +1 -0
- package/dist/iframe/activity-card/ActivityCard.js +1 -0
- package/dist/iframe/activity-card/index.d.ts +2 -0
- package/dist/iframe/activity-card/index.d.ts.map +1 -0
- package/dist/iframe/event/event-calendar/EventCalendar.d.ts +5 -3
- package/dist/iframe/event/event-calendar/EventCalendar.d.ts.map +1 -1
- package/dist/iframe/event/event-calendar/EventCalendar.js +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts +3 -2
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts.map +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.js +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts +5 -3
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.js +1 -1
- package/dist/iframe/index.d.ts +1 -1
- package/dist/iframe/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +1 -0
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/utils/index.js +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.js +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +3 -2
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.js +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.js +1 -1
- package/dist/iframe/payment/order-items-table/types/index.d.ts +7 -1
- package/dist/iframe/payment/order-items-table/types/index.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/types/index.js +1 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts +3 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +1 -0
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -0
- package/dist/index.js +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/ProductsControl.d.ts +3 -1
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +1 -1
- package/dist/product-set/product/ProductControl.d.ts +2 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/product-set/product/duration/ProductDurationControl.js +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts +2 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.js +1 -1
- package/dist/recurrence-input/RecurrenceInput.d.ts +2 -1
- package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceInput.js +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts +4 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +1 -1
- package/dist/report/form/ReportForm.d.ts.map +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +1 -1
- package/dist/static/CountryCodeSelect.d.ts.map +1 -1
- package/dist/static/CountryCodeSelect.js +1 -1
- package/dist/static/RestrictedAccess.d.ts.map +1 -1
- package/dist/static/form-number-input/FormNumberInput.d.ts +2 -1
- package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
- package/dist/static/form-number-input/FormNumberInput.js +1 -1
- package/dist/styles/{iframe-customers-journey/ActivitiesCard.scss → activity-card/GridActivitiesCard.scss} +1 -1
- package/dist/styles/{iframe-customers-journey/ActivitiesSelectedCard.scss → activity-card/ListActivitiesCard.scss} +2 -1
- package/dist/styles/activity-card/_index.scss +2 -0
- package/dist/styles/{iframe-customers-journey → date-time-button}/DateTimeButton.scss +3 -6
- package/dist/styles/date-time-button/_index.scss +1 -0
- package/dist/styles/iframe-events/Calendar.scss +14 -14
- package/dist/styles/iframe-page/PageBody.scss +3 -2
- package/dist/styles/notification/Notification.scss +4 -0
- package/dist/styles/packages.scss +2 -1
- package/dist/styles/resources-blocking/_index.scss +5 -0
- package/dist/styles/themes/bookedit/_index.scss +1 -0
- package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
- package/dist/zone/form/components/AvailableTimesControl.js +1 -1
- package/dist/zone/form/components/GameDurationControl.d.ts +7 -0
- package/dist/zone/form/components/GameDurationControl.d.ts.map +1 -0
- package/dist/zone/form/components/GameDurationControl.js +1 -0
- package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneControl.js +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
- package/dist/zone/form/utils/dates.d.ts.map +1 -1
- package/dist/zone/form/utils/dates.js +1 -1
- package/package.json +1 -1
- package/src/collapsible-input-group/CollapsibleInputGroup.tsx +1 -1
- package/src/date-time-button/DateTimeButton.stories.tsx +17 -0
- package/src/date-time-button/DateTimeButton.tsx +42 -20
- package/src/events/edit-event-modal/IntervalInput.tsx +3 -0
- package/src/events/event-venue-map/hooks/useImage.tsx +17 -8
- package/src/iframe/{activity-cards/activity-card → activity-card}/ActivityCard.stories.tsx +24 -1
- package/src/iframe/activity-card/ActivityCard.tsx +77 -0
- package/src/iframe/activity-card/index.ts +1 -0
- package/src/iframe/event/event-calendar/EventCalendar.stories.tsx +20 -21
- package/src/iframe/event/event-calendar/EventCalendar.tsx +10 -3
- package/src/iframe/event/event-calendar/components/CalendarDate/CalendarDate.tsx +10 -2
- package/src/iframe/event/event-calendar/components/CalendarDates/CalendarDates.tsx +6 -2
- package/src/iframe/index.ts +1 -1
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +2 -0
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +1 -0
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +2 -0
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx +2 -2
- package/src/iframe/order-process/components/utils/useCategoryVerification.ts +28 -29
- package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +6 -1
- package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +11 -99
- package/src/iframe/payment/order-items-table/types/index.ts +18 -1
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +118 -0
- package/src/iframe/payment/payment-page/PaymentPage.tsx +4 -4
- package/src/notification/email-template/control/EmailTemplateControl.tsx +26 -1
- package/src/product-set/form/ProductCategoriesControl.tsx +2 -0
- package/src/product-set/form/ProductSetForm.stories.tsx +1 -0
- package/src/product-set/form/ProductsControl.tsx +10 -0
- package/src/product-set/product/ProductControl.tsx +31 -8
- package/src/product-set/product/duration/ProductDurationControl.tsx +1 -1
- package/src/product-set/product-category/ProductCategoryControl.tsx +15 -5
- package/src/provider/location-input/LocationInputDescription.tsx +2 -2
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +10 -8
- package/src/recurrence-input/RecurrenceEndInput.tsx +27 -9
- package/src/recurrence-input/RecurrenceInput.tsx +3 -0
- package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +24 -21
- package/src/report/form/ReportForm.tsx +1 -1
- package/src/static/CountryCodeSelect.tsx +3 -5
- package/src/static/RestrictedAccess.tsx +1 -1
- package/src/static/form-number-input/FormNumberInput.tsx +8 -1
- package/src/styles/{iframe-customers-journey/ActivitiesCard.scss → activity-card/GridActivitiesCard.scss} +1 -1
- package/src/styles/{iframe-customers-journey/ActivitiesSelectedCard.scss → activity-card/ListActivitiesCard.scss} +2 -1
- package/src/styles/activity-card/_index.scss +2 -0
- package/src/styles/{iframe-customers-journey → date-time-button}/DateTimeButton.scss +3 -6
- package/src/styles/date-time-button/_index.scss +1 -0
- package/src/styles/iframe-events/Calendar.scss +14 -14
- package/src/styles/iframe-page/PageBody.scss +3 -2
- package/src/styles/notification/Notification.scss +4 -0
- package/src/styles/packages.scss +2 -1
- package/src/styles/resources-blocking/_index.scss +5 -0
- package/src/styles/themes/bookedit/_index.scss +1 -0
- package/src/typings.d.ts +11 -0
- package/src/zone/form/components/AvailableTimesControl.tsx +4 -9
- package/src/zone/form/components/GameDurationControl.tsx +46 -0
- package/src/zone/form/components/ZoneControl.tsx +2 -0
- package/src/zone/form/components/ZoneRecurrencesControl.tsx +27 -35
- package/src/zone/form/utils/dates.ts +29 -36
- package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts +0 -12
- package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts.map +0 -1
- package/dist/iframe/activity-cards/activity-card/ActivityCard.js +0 -1
- package/dist/iframe/activity-cards/index.d.ts +0 -3
- package/dist/iframe/activity-cards/index.d.ts.map +0 -1
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts +0 -12
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts.map +0 -1
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.js +0 -1
- package/dist/styles/iframe-customers-journey/_index.scss +0 -3
- package/src/iframe/activity-cards/activity-card/ActivityCard.tsx +0 -38
- package/src/iframe/activity-cards/index.ts +0 -2
- package/src/iframe/activity-cards/list-activity-card/ListActivityCard.stories.tsx +0 -52
- package/src/iframe/activity-cards/list-activity-card/ListActivityCard.tsx +0 -49
- package/src/styles/iframe-customers-journey/_index.scss +0 -3
- /package/dist/assets/iframe/{dateInfo/available.svg → available.svg} +0 -0
- /package/dist/assets/iframe/{dateInfo/limited.svg → limited.svg} +0 -0
- /package/dist/assets/iframe/{dateInfo/soldOut.svg → soldOut.svg} +0 -0
- /package/src/assets/iframe/{dateInfo/available.svg → available.svg} +0 -0
- /package/src/assets/iframe/{dateInfo/limited.svg → limited.svg} +0 -0
- /package/src/assets/iframe/{dateInfo/soldOut.svg → soldOut.svg} +0 -0
|
@@ -9,15 +9,9 @@ import {
|
|
|
9
9
|
PAYMENT_TYPE_NET_PROFIT,
|
|
10
10
|
} from "@licklist/core/dist/DataMapper/Order/PaymentDataMapper";
|
|
11
11
|
import { StaticTableData } from "../../../../table";
|
|
12
|
-
import {
|
|
13
|
-
getProductQuantityAndPrice,
|
|
14
|
-
calculateTotalDiscount,
|
|
15
|
-
calculateTotalPrice,
|
|
16
|
-
getPaymentValueByType,
|
|
17
|
-
getExternalPaymentDetail,
|
|
18
|
-
getTotalSumByCategory,
|
|
19
|
-
} from "../utils";
|
|
12
|
+
import { getProductQuantityAndPrice, getTotalSumByCategory } from "../utils";
|
|
20
13
|
import { OrderItemsTableProps, SummaryItem } from "../types";
|
|
14
|
+
import { getOrderSummaryItems } from "../utils/paymentSummary";
|
|
21
15
|
|
|
22
16
|
const CURRENCY_DEFAULT = "GBP";
|
|
23
17
|
export const PAYMENT_TYPE_TRANSLATE_KEYS = {
|
|
@@ -114,9 +108,7 @@ export const useTableData = ({
|
|
|
114
108
|
);
|
|
115
109
|
};
|
|
116
110
|
|
|
117
|
-
const renderSummaryItems = (
|
|
118
|
-
summaryItems: { translateKey: string; price: number }[]
|
|
119
|
-
) => {
|
|
111
|
+
const renderSummaryItems = (summaryItems: SummaryItem[]) => {
|
|
120
112
|
return summaryItems.map(({ translateKey, price }) => {
|
|
121
113
|
return {
|
|
122
114
|
key: uniqueId(`summary-info-${translateKey}`),
|
|
@@ -127,93 +119,6 @@ export const useTableData = ({
|
|
|
127
119
|
});
|
|
128
120
|
};
|
|
129
121
|
|
|
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
|
-
|
|
217
122
|
const data = useMemo(
|
|
218
123
|
() => {
|
|
219
124
|
if (!order) {
|
|
@@ -222,7 +127,14 @@ export const useTableData = ({
|
|
|
222
127
|
|
|
223
128
|
return [
|
|
224
129
|
...renderProductsContent(),
|
|
225
|
-
...renderSummaryItems(
|
|
130
|
+
...renderSummaryItems(
|
|
131
|
+
getOrderSummaryItems({
|
|
132
|
+
order,
|
|
133
|
+
paymentDetail,
|
|
134
|
+
isPaymentProcessed,
|
|
135
|
+
externalDiscount,
|
|
136
|
+
})
|
|
137
|
+
),
|
|
226
138
|
];
|
|
227
139
|
},
|
|
228
140
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1,7 +1,24 @@
|
|
|
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
|
|
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
|
+
};
|
|
5
22
|
|
|
6
23
|
export type OrderItemsTableProps = {
|
|
7
24
|
order?: Order;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { PAYMENT_TYPE_TRANSLATE_KEYS } from "../hooks/useTableData";
|
|
2
|
+
import {
|
|
3
|
+
AMOUNT_TOTAL,
|
|
4
|
+
AMOUNT_WITH_DISCOUNT,
|
|
5
|
+
OrderItemsTableProps,
|
|
6
|
+
REMAINING_TO_PAY,
|
|
7
|
+
SummaryItem,
|
|
8
|
+
TOTAL_PAID,
|
|
9
|
+
} from "../types";
|
|
10
|
+
import {
|
|
11
|
+
calculateTotalDiscount,
|
|
12
|
+
calculateTotalPrice,
|
|
13
|
+
getExternalPaymentDetail,
|
|
14
|
+
getPaymentValueByType,
|
|
15
|
+
} from "./index";
|
|
16
|
+
|
|
17
|
+
const paymentNotProcessedSummary = ({
|
|
18
|
+
order,
|
|
19
|
+
externalDiscount,
|
|
20
|
+
paymentDetail,
|
|
21
|
+
}: OrderItemsTableProps) => {
|
|
22
|
+
const externalPaymentDetail = paymentDetail
|
|
23
|
+
? getExternalPaymentDetail(paymentDetail)
|
|
24
|
+
: undefined;
|
|
25
|
+
|
|
26
|
+
const total = calculateTotalPrice(order, externalPaymentDetail);
|
|
27
|
+
|
|
28
|
+
const summaryItems: SummaryItem[] = [
|
|
29
|
+
{
|
|
30
|
+
translateKey: AMOUNT_TOTAL,
|
|
31
|
+
price: total,
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
if (externalDiscount) {
|
|
36
|
+
summaryItems.push({
|
|
37
|
+
price: externalDiscount,
|
|
38
|
+
translateKey: AMOUNT_WITH_DISCOUNT,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (externalPaymentDetail) {
|
|
43
|
+
return [...summaryItems, ...getExternalPaymentDetail(paymentDetail)];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return summaryItems;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const processedPaymentSummary = ({
|
|
50
|
+
order,
|
|
51
|
+
paymentDetail,
|
|
52
|
+
}: OrderItemsTableProps) => {
|
|
53
|
+
const externalPaymentDetail =
|
|
54
|
+
paymentDetail && !order.payments.length
|
|
55
|
+
? getExternalPaymentDetail(paymentDetail)
|
|
56
|
+
: Object.keys(PAYMENT_TYPE_TRANSLATE_KEYS).map((key) => {
|
|
57
|
+
return {
|
|
58
|
+
translateKey: PAYMENT_TYPE_TRANSLATE_KEYS[key],
|
|
59
|
+
price: getPaymentValueByType(order.payments, key),
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const total = calculateTotalPrice(order, externalPaymentDetail);
|
|
64
|
+
|
|
65
|
+
const totalDiscount = calculateTotalDiscount(order.payments);
|
|
66
|
+
const totalWithDiscount = total - Number(totalDiscount);
|
|
67
|
+
let summaryItems: SummaryItem[] = [
|
|
68
|
+
{
|
|
69
|
+
translateKey: AMOUNT_TOTAL,
|
|
70
|
+
price: total,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
if (totalDiscount) {
|
|
75
|
+
summaryItems.push({
|
|
76
|
+
translateKey: AMOUNT_WITH_DISCOUNT,
|
|
77
|
+
price: totalWithDiscount < 0 ? 0 : totalWithDiscount,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (paymentDetail && !order.payments.length) {
|
|
82
|
+
return [...summaryItems, ...externalPaymentDetail];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
summaryItems.push({
|
|
86
|
+
translateKey: TOTAL_PAID,
|
|
87
|
+
price: totalWithDiscount <= 0 ? 0 : order.totalAmount,
|
|
88
|
+
});
|
|
89
|
+
if (totalWithDiscount <= 0) {
|
|
90
|
+
return summaryItems;
|
|
91
|
+
}
|
|
92
|
+
summaryItems = [...summaryItems, ...externalPaymentDetail];
|
|
93
|
+
|
|
94
|
+
if (totalWithDiscount > order.totalAmount) {
|
|
95
|
+
summaryItems.push({
|
|
96
|
+
translateKey: REMAINING_TO_PAY,
|
|
97
|
+
price: totalWithDiscount - order.totalAmount,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return summaryItems;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const getOrderSummaryItems = ({
|
|
104
|
+
order,
|
|
105
|
+
externalDiscount,
|
|
106
|
+
paymentDetail,
|
|
107
|
+
isPaymentProcessed,
|
|
108
|
+
}: OrderItemsTableProps): SummaryItem[] => {
|
|
109
|
+
if (!isPaymentProcessed) {
|
|
110
|
+
return paymentNotProcessedSummary({
|
|
111
|
+
order,
|
|
112
|
+
externalDiscount,
|
|
113
|
+
paymentDetail,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return processedPaymentSummary({ order, paymentDetail });
|
|
118
|
+
};
|
|
@@ -100,18 +100,18 @@ export const PaymentPage = ({
|
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
const
|
|
103
|
+
const orderTotalAmountByFormValues = cartSumByOrderProducts(
|
|
104
104
|
bookingSummaryProps && bookingSummaryProps?.formValues
|
|
105
105
|
? Object.values(bookingSummaryProps?.formValues)
|
|
106
106
|
: undefined
|
|
107
107
|
);
|
|
108
108
|
|
|
109
|
-
// User can fill
|
|
109
|
+
// User can fill promo code only in iframe application.
|
|
110
110
|
// It didn't possible via payment link. This check will
|
|
111
111
|
// be applied when there are no metadata and in case when
|
|
112
112
|
// orderValues sum is greater than amount in order.
|
|
113
113
|
const isCalculatedAmountGreaterThanOrderAmount =
|
|
114
|
-
|
|
114
|
+
orderTotalAmountByFormValues > data?.amount;
|
|
115
115
|
|
|
116
116
|
return (
|
|
117
117
|
<Page
|
|
@@ -164,7 +164,7 @@ export const PaymentPage = ({
|
|
|
164
164
|
<SummaryTotalBlock
|
|
165
165
|
label={t("total")}
|
|
166
166
|
amount={
|
|
167
|
-
|
|
167
|
+
orderTotalAmountByFormValues +
|
|
168
168
|
(bookingSummaryProps?.transactionFee || 0)
|
|
169
169
|
}
|
|
170
170
|
/>
|
|
@@ -314,13 +314,38 @@ 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
|
-
|
|
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"}`}>
|
|
318
325
|
<EmailEditor
|
|
319
326
|
ref={ref}
|
|
320
327
|
onReady={onReadyEditor}
|
|
321
328
|
style={{ height: "50rem" }}
|
|
322
329
|
/>
|
|
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
|
+
/>
|
|
323
344
|
</div>
|
|
345
|
+
|
|
346
|
+
<Form.Control.Feedback type="invalid">
|
|
347
|
+
{errors.body?.message}
|
|
348
|
+
</Form.Control.Feedback>
|
|
324
349
|
</Form.Group>
|
|
325
350
|
</Row>
|
|
326
351
|
<Row>
|
|
@@ -72,6 +72,7 @@ export function ProductCategoriesControl({
|
|
|
72
72
|
providerHasMap,
|
|
73
73
|
expandedProductCategories,
|
|
74
74
|
setExpandedProductCategories,
|
|
75
|
+
zones,
|
|
75
76
|
} = useContext(ProductSetLoadingContext);
|
|
76
77
|
const form = useFormContext<ProductSetFormValues>();
|
|
77
78
|
const [isSelectCategoryVisible, setIsSelectCategoryVisible] = useState(false);
|
|
@@ -287,6 +288,7 @@ export function ProductCategoriesControl({
|
|
|
287
288
|
quantityType={productCategory.quantityType}
|
|
288
289
|
hasTicket={productCategory?.hasTicket}
|
|
289
290
|
stepIndex={stepIndex}
|
|
291
|
+
zones={zones}
|
|
290
292
|
productCategoryIndex={index}
|
|
291
293
|
categoryType={productCategory.type}
|
|
292
294
|
/>
|
|
@@ -14,6 +14,7 @@ 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";
|
|
17
18
|
import { ProductControl, ProductControlProps, ProductSetFormValues } from "..";
|
|
18
19
|
import { SortableTree } from "../../sortable-tree";
|
|
19
20
|
import { CreateProductSetItem } from "../item/CreateProductSetItem";
|
|
@@ -32,6 +33,7 @@ interface ProductsControlProps extends WithIsLoading {
|
|
|
32
33
|
productCategoryIndex: number;
|
|
33
34
|
hasTicket?: boolean;
|
|
34
35
|
categoryType: CategoryType;
|
|
36
|
+
zones?: Zone[];
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
const getDefaultProductValue = (sort: number): Product => ({
|
|
@@ -74,6 +76,7 @@ export function ProductsControl({
|
|
|
74
76
|
productCategoryIndex,
|
|
75
77
|
hasTicket,
|
|
76
78
|
categoryType,
|
|
79
|
+
zones,
|
|
77
80
|
}: ProductsControlProps) {
|
|
78
81
|
const { t } = useTranslation("Design");
|
|
79
82
|
const form = useFormContext<ProductSetFormValues>();
|
|
@@ -89,6 +92,12 @@ export function ProductsControl({
|
|
|
89
92
|
getValues,
|
|
90
93
|
} = form;
|
|
91
94
|
|
|
95
|
+
const zoneId = watch(
|
|
96
|
+
`steps.${stepIndex}.productCategories.${productCategoryIndex}.zoneId`
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const catergoryZone = zones?.find((zone) => zone.id === Number(zoneId));
|
|
100
|
+
|
|
92
101
|
const productControlFieldName =
|
|
93
102
|
`steps.${stepIndex}.productCategories.${productCategoryIndex}.products` as const;
|
|
94
103
|
|
|
@@ -245,6 +254,7 @@ export function ProductsControl({
|
|
|
245
254
|
onProductNameChange={onChange}
|
|
246
255
|
hasTicket={hasTicket}
|
|
247
256
|
categoryType={categoryType}
|
|
257
|
+
zoneDuration={catergoryZone?.defaultDuration}
|
|
248
258
|
/>
|
|
249
259
|
}
|
|
250
260
|
onDelete={() => onProductRemove(index)}
|
|
@@ -113,6 +113,7 @@ export interface ProductControlProps<T>
|
|
|
113
113
|
productName: string;
|
|
114
114
|
hasTicket?: boolean;
|
|
115
115
|
categoryType?: CategoryType;
|
|
116
|
+
zoneDuration?: number;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
export function ProductControl<T extends FormValues>({
|
|
@@ -126,6 +127,7 @@ export function ProductControl<T extends FormValues>({
|
|
|
126
127
|
productName,
|
|
127
128
|
hasTicket,
|
|
128
129
|
categoryType,
|
|
130
|
+
zoneDuration,
|
|
129
131
|
}: ProductControlProps<T>) {
|
|
130
132
|
const {
|
|
131
133
|
register,
|
|
@@ -133,6 +135,7 @@ export function ProductControl<T extends FormValues>({
|
|
|
133
135
|
formState: { errors },
|
|
134
136
|
setValue,
|
|
135
137
|
getValues,
|
|
138
|
+
setError,
|
|
136
139
|
watch,
|
|
137
140
|
} = useFormContext<T>();
|
|
138
141
|
|
|
@@ -190,6 +193,13 @@ export function ProductControl<T extends FormValues>({
|
|
|
190
193
|
[handleImageUploading]
|
|
191
194
|
);
|
|
192
195
|
|
|
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
|
+
|
|
193
203
|
const onImageRemove = useCallback(
|
|
194
204
|
(id, path) => {
|
|
195
205
|
handleImageRemove(String(id), path);
|
|
@@ -217,6 +227,17 @@ export function ProductControl<T extends FormValues>({
|
|
|
217
227
|
}
|
|
218
228
|
}, [images, fieldNamePrefix, setValue]);
|
|
219
229
|
|
|
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
|
+
|
|
220
241
|
const quantitySelector = quantityValue ?? "1";
|
|
221
242
|
const quantity = QUANTITY_TYPE_LIST_DTO[quantitySelector as string];
|
|
222
243
|
return (
|
|
@@ -372,6 +393,14 @@ export function ProductControl<T extends FormValues>({
|
|
|
372
393
|
<FormNumberInput
|
|
373
394
|
fieldName={`${fieldNamePrefix}.capacity`}
|
|
374
395
|
label={t("capacity")}
|
|
396
|
+
rules={{
|
|
397
|
+
min: {
|
|
398
|
+
value: 1,
|
|
399
|
+
message: t("Validation:fieldRequired", {
|
|
400
|
+
attribute: t("capacity"),
|
|
401
|
+
}) as string,
|
|
402
|
+
},
|
|
403
|
+
}}
|
|
375
404
|
/>
|
|
376
405
|
</Col>
|
|
377
406
|
</Row>
|
|
@@ -383,6 +412,7 @@ export function ProductControl<T extends FormValues>({
|
|
|
383
412
|
<FormNumberInput
|
|
384
413
|
fieldName={`${fieldNamePrefix}.capacity`}
|
|
385
414
|
label={t("capacity")}
|
|
415
|
+
onChange={onChangeGameCapacity}
|
|
386
416
|
rules={{
|
|
387
417
|
min: {
|
|
388
418
|
value: 1,
|
|
@@ -397,14 +427,7 @@ export function ProductControl<T extends FormValues>({
|
|
|
397
427
|
<FormNumberInput
|
|
398
428
|
fieldName={`${fieldNamePrefix}.duration`}
|
|
399
429
|
label={t("durationMinutes")}
|
|
400
|
-
|
|
401
|
-
min: {
|
|
402
|
-
value: 1,
|
|
403
|
-
message: t("Validation:fieldRequired", {
|
|
404
|
-
attribute: t("duration"),
|
|
405
|
-
}) as string,
|
|
406
|
-
},
|
|
407
|
-
}}
|
|
430
|
+
disabled
|
|
408
431
|
/>
|
|
409
432
|
</Col>
|
|
410
433
|
</Row>
|
|
@@ -332,7 +332,7 @@ export function ProductCategoryControl({
|
|
|
332
332
|
<Row>
|
|
333
333
|
<Col>
|
|
334
334
|
<Form.Group controlId={zoneId}>
|
|
335
|
-
<Form.Label>
|
|
335
|
+
<Form.Label>{t("Design:zone")}</Form.Label>
|
|
336
336
|
<Controller
|
|
337
337
|
control={control}
|
|
338
338
|
name={`${fieldNamePrefix}.zoneId`}
|
|
@@ -361,10 +361,20 @@ export function ProductCategoryControl({
|
|
|
361
361
|
}),
|
|
362
362
|
},
|
|
363
363
|
validate: (value) => {
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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;
|
|
368
378
|
},
|
|
369
379
|
}}
|
|
370
380
|
/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
2
|
import { useFormContext } from "react-hook-form";
|
|
3
3
|
import en from "react-phone-number-input/locale/en.json";
|
|
4
4
|
import { LocationInputValues } from ".";
|
|
@@ -13,7 +13,7 @@ export function LocationInputDescription() {
|
|
|
13
13
|
"postcode",
|
|
14
14
|
"country",
|
|
15
15
|
] as const;
|
|
16
|
-
const fields = fieldNames.reduce<
|
|
16
|
+
const fields = fieldNames.reduce<ReactElement[]>((acc, field) => {
|
|
17
17
|
const value = values?.[field];
|
|
18
18
|
if (!value) return acc;
|
|
19
19
|
|
|
@@ -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 {
|
|
6
|
+
import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
7
7
|
import { WorkingHoursInputValues } from ".";
|
|
8
8
|
import { useWeekdays } from "./utils";
|
|
9
9
|
|
|
@@ -12,7 +12,9 @@ export function WorkingHoursInputDescription() {
|
|
|
12
12
|
const values = watch("workingHours");
|
|
13
13
|
const weekdays = useWeekdays("short");
|
|
14
14
|
const { t } = useTranslation("Design");
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
if (!values) return null;
|
|
17
|
+
|
|
16
18
|
return (
|
|
17
19
|
<>
|
|
18
20
|
{Array.from({ length: weekdays.length }, (_, i) => i)
|
|
@@ -26,16 +28,16 @@ export function WorkingHoursInputDescription() {
|
|
|
26
28
|
{weekday?.end
|
|
27
29
|
? weekday.start
|
|
28
30
|
? t("timeInterval", {
|
|
29
|
-
start:
|
|
30
|
-
|
|
31
|
+
start: DateTime.fromISO(weekday.start).toFormat(
|
|
32
|
+
TIME_FORMAT
|
|
31
33
|
),
|
|
32
|
-
end:
|
|
33
|
-
|
|
34
|
+
end: DateTime.fromISO(weekday.start).toFormat(
|
|
35
|
+
TIME_FORMAT
|
|
34
36
|
),
|
|
35
37
|
})
|
|
36
38
|
: t("timeFrom", {
|
|
37
|
-
start:
|
|
38
|
-
|
|
39
|
+
start: DateTime.fromISO(weekday.start).toFormat(
|
|
40
|
+
TIME_FORMAT
|
|
39
41
|
),
|
|
40
42
|
})
|
|
41
43
|
: null}
|