@licklist/design 0.44.551-dev.8 → 0.44.551
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/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
- package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -1
- package/dist/date-time-button/DateContent.d.ts +2 -2
- package/dist/date-time-button/DateContent.d.ts.map +1 -1
- package/dist/date-time-button/DateContent.js +1 -1
- package/dist/date-time-button/DateTimeButton.d.ts +6 -10
- package/dist/date-time-button/DateTimeButton.d.ts.map +1 -1
- package/dist/date-time-button/DateTimeButton.js +1 -1
- package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts +1 -1
- package/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts.map +1 -1
- package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts +2 -4
- package/dist/iframe/event/event-booking-products/EventBookingProducts.d.ts.map +1 -1
- package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts +2 -4
- package/dist/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts +1 -1
- package/dist/iframe/event/event-order-summary/EventOrderSummary.d.ts.map +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/components/ProductsByMenuStep/ProductsByMenuStep.d.ts +3 -4
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +4 -3
- 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 +2 -4
- 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/components/Category.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/Category.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +2 -2
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts +2 -2
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.js +1 -1
- package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts +2 -2
- package/dist/iframe/payment/payment-status-page/component/PaymentStatusBody.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/product-set/control/DateAndRecurrenceInput.d.ts.map +1 -1
- package/dist/report/index.d.ts +0 -3
- package/dist/report/index.d.ts.map +1 -1
- package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts +1 -4
- package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.d.ts.map +1 -1
- package/dist/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.js +1 -1
- package/dist/static/switch/BooleanSwitch.d.ts +1 -3
- package/dist/static/switch/BooleanSwitch.d.ts.map +1 -1
- package/dist/static/switch/BooleanSwitch.js +1 -1
- package/dist/styles/date-time-button/DateTimeButton.scss +4 -0
- package/dist/styles/iframe-order-process/IframeOrderProcess.scss +4 -6
- package/dist/styles/iframe-page/PageBody.scss +3 -3
- package/dist/styles/report/_index.scss +1 -3
- package/dist/styles/sales/BookingFilter.scss +1 -3
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/styles/sales/ManualBooking.scss +4 -1
- package/dist/styles/static/Switch.scss +0 -1
- package/dist/table/TableHelperComponent.d.ts +1 -2
- package/dist/table/TableHelperComponent.d.ts.map +1 -1
- package/dist/table/TableHelperComponent.js +1 -1
- package/dist/types/iframe.d.ts +50 -2
- package/dist/types/iframe.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/calendar/components/CalendarDates/CalendarDates.tsx +4 -3
- package/src/date-time-button/DateContent.tsx +9 -27
- package/src/date-time-button/DateTimeButton.stories.tsx +14 -13
- package/src/date-time-button/DateTimeButton.tsx +26 -35
- package/src/events/event-venue-map/components/MapPoint/MapPoint.tsx +1 -1
- package/src/iframe/event/event-booking-products/EventBookingProducts.tsx +3 -4
- package/src/iframe/event/event-booking-products/components/AccordionItem/AccordionItem.tsx +4 -8
- package/src/iframe/event/event-order-summary/EventOrderSummary.tsx +2 -0
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +31 -46
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +19 -12
- package/src/iframe/order-process/components/BookingSummary/components/ProductsByMenuStep/ProductsByMenuStep.tsx +66 -48
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +4 -3
- package/src/iframe/order-process/components/BookingSummary/utils/index.ts +2 -11
- package/src/iframe/order-process/components/CalendarStepsForm/components/Category.tsx +1 -1
- package/src/iframe/order-process/components/CalendarStepsForm/components/CategoryProductModal.tsx +1 -4
- package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +1 -4
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +1 -4
- package/src/iframe/order-process/components/utils/useCategoryVerification.ts +2 -3
- package/src/iframe/payment/payment-page/PaymentPage.tsx +6 -5
- package/src/iframe/payment/payment-status-page/PaymentStatusPage.tsx +26 -13
- package/src/iframe/payment/payment-status-page/component/PaymentStatusBody.tsx +2 -2
- package/src/product-set/control/DateAndRecurrenceInput.tsx +1 -2
- package/src/report/index.ts +0 -3
- package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.tsx +5 -19
- package/src/static/switch/BooleanSwitch.tsx +2 -6
- package/src/styles/date-time-button/DateTimeButton.scss +4 -0
- package/src/styles/iframe-order-process/IframeOrderProcess.scss +4 -6
- package/src/styles/iframe-page/PageBody.scss +3 -3
- package/src/styles/report/_index.scss +1 -3
- package/src/styles/sales/BookingFilter.scss +1 -3
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/styles/sales/ManualBooking.scss +4 -1
- package/src/styles/static/Switch.scss +0 -1
- package/src/table/TableHelperComponent.tsx +3 -18
- package/src/types/iframe.ts +58 -2
- package/dist/assets/dashboard/info.svg +0 -8
- package/dist/assets/dashboard/info.svg.js +0 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts +0 -10
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.d.ts.map +0 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.js +0 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts +0 -2
- package/dist/iframe/order-process/components/BookingSummary/components/ProductSummary/index.d.ts.map +0 -1
- package/dist/report/DataFieldsSelector/DataFieldsSelector.d.ts +0 -13
- package/dist/report/DataFieldsSelector/DataFieldsSelector.d.ts.map +0 -1
- package/dist/report/DataFieldsSelector/DataFieldsSelector.js +0 -1
- package/dist/report/DataFieldsSelector/index.d.ts +0 -2
- package/dist/report/DataFieldsSelector/index.d.ts.map +0 -1
- package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts +0 -22
- package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts.map +0 -1
- package/dist/report/ReportRunnerModal/ReportRunnerModal.js +0 -1
- package/dist/report/ReportRunnerModal/index.d.ts +0 -2
- package/dist/report/ReportRunnerModal/index.d.ts.map +0 -1
- package/dist/report/ReportTypeSelect/ReportTypeSelect.d.ts +0 -3
- package/dist/report/ReportTypeSelect/ReportTypeSelect.d.ts.map +0 -1
- package/dist/report/ReportTypeSelect/ReportTypeSelect.js +0 -1
- package/dist/report/ReportTypeSelect/index.d.ts +0 -2
- package/dist/report/ReportTypeSelect/index.d.ts.map +0 -1
- package/dist/styles/report/ReportEditorModal.scss +0 -98
- package/dist/styles/report/ReportRunnerModal.scss +0 -95
- package/src/assets/dashboard/info.svg +0 -8
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/ProductSummary.tsx +0 -43
- package/src/iframe/order-process/components/BookingSummary/components/ProductSummary/index.ts +0 -1
- package/src/report/DataFieldsSelector/DataFieldsSelector.tsx +0 -112
- package/src/report/DataFieldsSelector/index.ts +0 -1
- package/src/report/ReportRunnerModal/ReportRunnerModal.tsx +0 -187
- package/src/report/ReportRunnerModal/index.ts +0 -1
- package/src/report/ReportTypeSelect/ReportTypeSelect.tsx +0 -68
- package/src/report/ReportTypeSelect/index.ts +0 -1
- package/src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.stories.tsx +0 -48
- package/src/styles/report/ReportEditorModal.scss +0 -98
- package/src/styles/report/ReportRunnerModal.scss +0 -95
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Meta, Story } from "@storybook/react";
|
|
3
3
|
import { DateTime } from "luxon";
|
|
4
|
-
import { DateTimeButton, DateTimeButtonProps
|
|
4
|
+
import { DateTimeButton, DateTimeButtonProps } from "./DateTimeButton";
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
title: "DateTimeButton",
|
|
8
8
|
component: DateTimeButton,
|
|
9
9
|
} as Meta;
|
|
10
10
|
|
|
11
|
-
const date = DateTime.
|
|
11
|
+
const date = DateTime.fromISO("2023-12-28T10:10:10.000Z");
|
|
12
12
|
|
|
13
13
|
export const Default: Story<DateTimeButtonProps> = (args) => {
|
|
14
14
|
return <DateTimeButton {...args} />;
|
|
@@ -48,23 +48,22 @@ export const Time: Story<DateTimeButtonProps> = (args) => {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
Time.args = {
|
|
51
|
-
date:
|
|
51
|
+
date: "10:10",
|
|
52
52
|
isSelected: false,
|
|
53
|
-
isDisabled:
|
|
53
|
+
isDisabled: true,
|
|
54
54
|
onSelect: () => null,
|
|
55
|
-
variant: Variant.time,
|
|
56
55
|
};
|
|
57
56
|
|
|
58
|
-
export const
|
|
57
|
+
export const OnlyTime: Story<DateTimeButtonProps> = (args) => {
|
|
59
58
|
return <DateTimeButton {...args} />;
|
|
60
59
|
};
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
date:
|
|
61
|
+
OnlyTime.args = {
|
|
62
|
+
date: "10:10",
|
|
64
63
|
isSelected: false,
|
|
65
|
-
isDisabled:
|
|
64
|
+
isDisabled: true,
|
|
66
65
|
onSelect: () => null,
|
|
67
|
-
|
|
66
|
+
isOnlyTimeContainer: true,
|
|
68
67
|
};
|
|
69
68
|
|
|
70
69
|
export const WithPrice: Story<DateTimeButtonProps> = (args) => {
|
|
@@ -76,6 +75,7 @@ WithPrice.args = {
|
|
|
76
75
|
isSelected: false,
|
|
77
76
|
isDisabled: false,
|
|
78
77
|
onSelect: () => null,
|
|
78
|
+
isOnlyTimeContainer: false,
|
|
79
79
|
price: "from $8000",
|
|
80
80
|
};
|
|
81
81
|
|
|
@@ -88,9 +88,10 @@ WithAvailability.args = {
|
|
|
88
88
|
isSelected: false,
|
|
89
89
|
isDisabled: false,
|
|
90
90
|
onSelect: () => null,
|
|
91
|
-
|
|
91
|
+
isOnlyTimeContainer: false,
|
|
92
|
+
price: "from $8000",
|
|
92
93
|
resources: {
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
booked: 1,
|
|
95
|
+
total: 3,
|
|
95
96
|
},
|
|
96
97
|
};
|
|
@@ -5,44 +5,36 @@ import { ZoneResourcesAvailability } from "@licklist/core/dist/DataMapper/Order/
|
|
|
5
5
|
import { AvailabilityIndicator } from "../availability-indicator";
|
|
6
6
|
import { DateContent } from "./DateContent";
|
|
7
7
|
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
month = "month",
|
|
11
|
-
time = "time",
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type DateTimeButtonProps = {
|
|
15
|
-
date: DateTime;
|
|
8
|
+
export type DateTimeButtonProps<T = DateTime | string> = {
|
|
9
|
+
date: T;
|
|
16
10
|
isSelected?: boolean;
|
|
17
11
|
isDisabled?: boolean;
|
|
18
12
|
isSoldOut?: boolean;
|
|
19
|
-
onSelect: (date:
|
|
13
|
+
onSelect: (date: T) => void;
|
|
14
|
+
isOnlyTimeContainer?: boolean;
|
|
20
15
|
price?: string | number | ReactElement | null;
|
|
21
16
|
resources?: ZoneResourcesAvailability | null;
|
|
17
|
+
calendarView?: boolean;
|
|
22
18
|
showResources?: boolean;
|
|
23
|
-
variant: Variant;
|
|
24
19
|
};
|
|
25
20
|
|
|
26
|
-
export const DateTimeButton = ({
|
|
21
|
+
export const DateTimeButton = <T extends DateTime | string>({
|
|
27
22
|
date,
|
|
28
23
|
isDisabled: _isDisabled,
|
|
29
24
|
isSelected,
|
|
30
|
-
isSoldOut
|
|
25
|
+
isSoldOut,
|
|
31
26
|
onSelect,
|
|
27
|
+
isOnlyTimeContainer,
|
|
32
28
|
price,
|
|
33
29
|
resources,
|
|
30
|
+
calendarView,
|
|
34
31
|
showResources,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const isSoldOut =
|
|
38
|
-
_isSoldOut ||
|
|
39
|
-
(resources && resources.bookedResources >= resources.totalResources);
|
|
40
|
-
|
|
41
|
-
const isTimeVariant = variant === Variant.time;
|
|
42
|
-
|
|
43
|
-
const isTimeInPast = isTimeVariant && isDateInPast(date);
|
|
32
|
+
}: DateTimeButtonProps<T>) => {
|
|
33
|
+
const isTimeVariant = typeof date === "string";
|
|
44
34
|
|
|
45
|
-
const isDisabled =
|
|
35
|
+
const isDisabled =
|
|
36
|
+
_isDisabled ||
|
|
37
|
+
(resources && resources.bookedResources === resources.totalResources);
|
|
46
38
|
|
|
47
39
|
return (
|
|
48
40
|
<button
|
|
@@ -53,32 +45,31 @@ export const DateTimeButton = ({
|
|
|
53
45
|
"date-time-button",
|
|
54
46
|
isDisabled && "disabled",
|
|
55
47
|
isSelected && "selected",
|
|
56
|
-
// TODO refactor this
|
|
57
48
|
isTimeVariant && "time-button",
|
|
58
|
-
|
|
49
|
+
isOnlyTimeContainer && "only-time-container",
|
|
59
50
|
!isTimeVariant && "today",
|
|
60
|
-
|
|
51
|
+
calendarView && "calendar-view"
|
|
61
52
|
)}
|
|
62
53
|
>
|
|
63
|
-
|
|
64
|
-
date
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
{isTimeVariant ? (
|
|
55
|
+
date
|
|
56
|
+
) : (
|
|
57
|
+
<DateContent
|
|
58
|
+
date={date}
|
|
59
|
+
isDisabled={isDisabled}
|
|
60
|
+
isSelected={isSelected}
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
69
63
|
|
|
70
64
|
{price && !isDisabled && <div className="price">{price}</div>}
|
|
71
65
|
|
|
72
66
|
{showResources && resources && (
|
|
73
67
|
<AvailabilityIndicator
|
|
74
68
|
resources={resources}
|
|
75
|
-
isUnavailable={_isDisabled
|
|
69
|
+
isUnavailable={_isDisabled}
|
|
76
70
|
isSoldOut={isSoldOut}
|
|
77
71
|
/>
|
|
78
72
|
)}
|
|
79
73
|
</button>
|
|
80
74
|
);
|
|
81
75
|
};
|
|
82
|
-
|
|
83
|
-
const isDateInPast = (date: DateTime): boolean =>
|
|
84
|
-
date.toUTC() <= DateTime.now().toUTC();
|
|
@@ -3,7 +3,6 @@ import { Group } from "react-konva";
|
|
|
3
3
|
import Konva from "konva";
|
|
4
4
|
import { EventVenueMapContext } from "@licklist/plugins/dist/context/event/EventVenueMapContext";
|
|
5
5
|
import { Point } from "@licklist/plugins/dist/types/context/event/point";
|
|
6
|
-
import { Product } from "@licklist/plugins/dist/types/context/sale/menuSteps";
|
|
7
6
|
import { ImageOffset } from "../../types";
|
|
8
7
|
import { PointIcon } from "./components/PointIcon";
|
|
9
8
|
import {
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
calculatePointsCoordinates,
|
|
12
11
|
} from "../../utils";
|
|
13
12
|
import { ProductIcon } from "./components/ProductIcon";
|
|
13
|
+
import { Product } from "../../../../types";
|
|
14
14
|
|
|
15
15
|
type MapPointProps = Partial<Point> &
|
|
16
16
|
ImageOffset & {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
|
|
2
3
|
import Accordion from "react-bootstrap/Accordion";
|
|
3
|
-
import {
|
|
4
|
-
import { ProductCategory } from "@licklist/plugins/dist/types/context/sale/menuSteps";
|
|
5
|
-
import { SetOrderFn } from "../../../types";
|
|
4
|
+
import { ProductCategory, Order, SetOrderFn } from "../../../types";
|
|
6
5
|
import { AccordionItem } from "./components/AccordionItem";
|
|
7
6
|
|
|
8
7
|
export interface EventBookingProductsProps {
|
|
9
8
|
productsCategories?: ProductCategory[];
|
|
10
9
|
setOrder: SetOrderFn;
|
|
11
|
-
order:
|
|
10
|
+
order: Record<number, Order>;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
export function EventBookingProducts({
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
|
+
|
|
4
5
|
import Accordion from "react-bootstrap/Accordion";
|
|
5
6
|
import Card from "react-bootstrap/Card";
|
|
6
7
|
import { useAccordionToggle } from "react-bootstrap/AccordionToggle";
|
|
7
8
|
import AccordionContext from "react-bootstrap/AccordionContext";
|
|
8
|
-
import {
|
|
9
|
-
OrderItem,
|
|
10
|
-
OrderItems,
|
|
11
|
-
} from "@licklist/plugins/dist/types/context/Iframe/orderItems";
|
|
12
|
-
import { Product } from "@licklist/plugins/dist/types/context/sale/menuSteps";
|
|
13
9
|
import { NumberInput } from "../../../../../static";
|
|
14
10
|
import Icon from "../../../../../static/Icon";
|
|
15
|
-
import { SetOrderFn } from "../../../../../types";
|
|
11
|
+
import { Order, Product, SetOrderFn } from "../../../../../types";
|
|
16
12
|
|
|
17
13
|
interface CustomToggleProps {
|
|
18
14
|
eventKey: string;
|
|
@@ -23,7 +19,7 @@ interface AccordionItemProps {
|
|
|
23
19
|
name: string;
|
|
24
20
|
products: Product[];
|
|
25
21
|
setOrder: SetOrderFn;
|
|
26
|
-
order: Record<number,
|
|
22
|
+
order: Record<number, Order>;
|
|
27
23
|
productsCategoryId: number;
|
|
28
24
|
}
|
|
29
25
|
|
|
@@ -90,7 +86,7 @@ interface ProductItemProps {
|
|
|
90
86
|
name: string;
|
|
91
87
|
price: number;
|
|
92
88
|
description: string;
|
|
93
|
-
order:
|
|
89
|
+
order: Record<number, Order>;
|
|
94
90
|
setOrder: SetOrderFn;
|
|
95
91
|
productsCategoryId: number;
|
|
96
92
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
+
|
|
3
4
|
import { StaticTable, StaticTableData } from "../../../table/StaticTable";
|
|
4
5
|
|
|
6
|
+
export { Order } from "../../../types";
|
|
5
7
|
interface EventOrderSummaryProps {
|
|
6
8
|
data: StaticTableData[];
|
|
7
9
|
tableName?: string;
|
|
@@ -10,11 +10,11 @@ export default {
|
|
|
10
10
|
const productCategories = [
|
|
11
11
|
{
|
|
12
12
|
id: 1,
|
|
13
|
-
name: "
|
|
13
|
+
name: "Early Bird General Admission",
|
|
14
14
|
products: [
|
|
15
15
|
{
|
|
16
|
-
id:
|
|
17
|
-
name: "
|
|
16
|
+
id: 7,
|
|
17
|
+
name: "Beer",
|
|
18
18
|
description: `Ticket <em>is</em> valid for students and non students.
|
|
19
19
|
You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
|
|
20
20
|
Ticket valid for entry before 11.30pm for 12.30am showtime.`,
|
|
@@ -23,8 +23,8 @@ const productCategories = [
|
|
|
23
23
|
price: 1,
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
id:
|
|
27
|
-
name: "
|
|
26
|
+
id: 8,
|
|
27
|
+
name: "Wine",
|
|
28
28
|
description: `Ticket is valid for students and non students.
|
|
29
29
|
You do not need <strong>student ID</strong> for this event but do require regular age ID e.g. driving licence or passport.
|
|
30
30
|
Ticket valid for entry before 11.30pm for 12.30am showtime.`,
|
|
@@ -37,11 +37,11 @@ const productCategories = [
|
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
id: 2,
|
|
40
|
-
name: "
|
|
40
|
+
name: "Nice",
|
|
41
41
|
products: [
|
|
42
42
|
{
|
|
43
|
-
id:
|
|
44
|
-
name: "
|
|
43
|
+
id: 3,
|
|
44
|
+
name: "Beer",
|
|
45
45
|
description: `Ticket is valid for students and non students.
|
|
46
46
|
You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
|
|
47
47
|
Ticket valid for entry before 11.30pm for 12.30am showtime.`,
|
|
@@ -50,8 +50,8 @@ const productCategories = [
|
|
|
50
50
|
price: 1,
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
id:
|
|
54
|
-
name: "
|
|
53
|
+
id: 5,
|
|
54
|
+
name: "Wine",
|
|
55
55
|
description: `Ticket is valid for students and non students.
|
|
56
56
|
You do not need <strong>student ID</strong> for this event but do require regular age ID e.g. driving licence or passport.
|
|
57
57
|
Ticket valid for entry before 11.30pm for 12.30am showtime.`,
|
|
@@ -66,11 +66,11 @@ const productCategories = [
|
|
|
66
66
|
const productCategories2 = [
|
|
67
67
|
{
|
|
68
68
|
id: 3,
|
|
69
|
-
name: "
|
|
69
|
+
name: "fine",
|
|
70
70
|
products: [
|
|
71
71
|
{
|
|
72
|
-
id:
|
|
73
|
-
name: "
|
|
72
|
+
id: 9,
|
|
73
|
+
name: "Beer",
|
|
74
74
|
description: `Ticket is valid for students and non students.
|
|
75
75
|
You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
|
|
76
76
|
Ticket valid for entry before 11.30pm for 12.30am showtime.`,
|
|
@@ -79,8 +79,8 @@ const productCategories2 = [
|
|
|
79
79
|
price: 1,
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
|
-
id:
|
|
83
|
-
name: "
|
|
82
|
+
id: 10,
|
|
83
|
+
name: "Wine",
|
|
84
84
|
description: `Ticket is valid for students and non students.
|
|
85
85
|
You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
|
|
86
86
|
Ticket valid for entry before 11.30pm for 12.30am showtime.`,
|
|
@@ -90,15 +90,14 @@ const productCategories2 = [
|
|
|
90
90
|
// isRequired: true,
|
|
91
91
|
},
|
|
92
92
|
],
|
|
93
|
-
zone: 1,
|
|
94
93
|
},
|
|
95
94
|
{
|
|
96
95
|
id: 4,
|
|
97
|
-
name: "
|
|
96
|
+
name: "Twice",
|
|
98
97
|
products: [
|
|
99
98
|
{
|
|
100
|
-
id:
|
|
101
|
-
name: "
|
|
99
|
+
id: 11,
|
|
100
|
+
name: "Beer",
|
|
102
101
|
description: `Ticket is valid for students and non students.
|
|
103
102
|
You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
|
|
104
103
|
Ticket valid for entry before 11.30pm for 12.30am showtime.`,
|
|
@@ -107,8 +106,8 @@ const productCategories2 = [
|
|
|
107
106
|
price: 1,
|
|
108
107
|
},
|
|
109
108
|
{
|
|
110
|
-
id:
|
|
111
|
-
name: "
|
|
109
|
+
id: 12,
|
|
110
|
+
name: "Wine",
|
|
112
111
|
description: `Ticket is valid for students and non students.
|
|
113
112
|
You do not need student ID for this event but do require regular age ID e.g. driving licence or passport.
|
|
114
113
|
Ticket valid for entry before 11.30pm for 12.30am showtime.`,
|
|
@@ -142,40 +141,26 @@ export function Default() {
|
|
|
142
141
|
menuSteps={menuSteps as any}
|
|
143
142
|
peopleAmount={5}
|
|
144
143
|
formValues={{
|
|
145
|
-
"
|
|
146
|
-
id:
|
|
144
|
+
"3": {
|
|
145
|
+
id: 3,
|
|
147
146
|
quantity: 1,
|
|
148
|
-
name: "
|
|
147
|
+
name: "Beer",
|
|
149
148
|
price: 0,
|
|
150
|
-
productsCategoryId:
|
|
149
|
+
productsCategoryId: 2,
|
|
151
150
|
},
|
|
152
|
-
"
|
|
153
|
-
id:
|
|
151
|
+
"5": {
|
|
152
|
+
id: 5,
|
|
154
153
|
quantity: 2,
|
|
155
|
-
name: "
|
|
154
|
+
name: "Wine",
|
|
156
155
|
price: 1,
|
|
157
156
|
productsCategoryId: 2,
|
|
158
157
|
},
|
|
159
|
-
"
|
|
160
|
-
id:
|
|
158
|
+
"7": {
|
|
159
|
+
id: 7,
|
|
161
160
|
quantity: 4,
|
|
162
|
-
name: "
|
|
161
|
+
name: "Beer",
|
|
163
162
|
price: 1,
|
|
164
|
-
productsCategoryId:
|
|
165
|
-
},
|
|
166
|
-
"32": {
|
|
167
|
-
id: 32,
|
|
168
|
-
quantity: 4,
|
|
169
|
-
name: "cat 3 prod 2",
|
|
170
|
-
price: 1,
|
|
171
|
-
productsCategoryId: 3,
|
|
172
|
-
},
|
|
173
|
-
"41": {
|
|
174
|
-
id: 41,
|
|
175
|
-
quantity: 4,
|
|
176
|
-
name: "cat 4 prod 1",
|
|
177
|
-
price: 1,
|
|
178
|
-
productsCategoryId: 4,
|
|
163
|
+
productsCategoryId: 1,
|
|
179
164
|
},
|
|
180
165
|
}}
|
|
181
166
|
totalWithDiscount={5}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import * as Config from "@licklist/core/dist/Config";
|
|
5
|
-
import { values } from "lodash";
|
|
6
5
|
import { LoaderIndicator } from "../../../../static";
|
|
6
|
+
import { MenuStep, Order } from "../../../../types";
|
|
7
7
|
import { ProductsByMenuStep } from "./components/ProductsByMenuStep";
|
|
8
8
|
import { BookingSummaryProps } from "./types";
|
|
9
9
|
import { SummaryTotal } from "./components/SummaryTotal";
|
|
@@ -13,11 +13,11 @@ export const BookingSummary = ({
|
|
|
13
13
|
date,
|
|
14
14
|
time,
|
|
15
15
|
menuSteps,
|
|
16
|
-
formValues
|
|
16
|
+
formValues,
|
|
17
17
|
shouldHidePeopleAmount,
|
|
18
18
|
eventName,
|
|
19
19
|
transactionFee = 0,
|
|
20
|
-
productsWithErrors
|
|
20
|
+
productsWithErrors,
|
|
21
21
|
isLoading,
|
|
22
22
|
hasPeopleInput,
|
|
23
23
|
peopleAmount,
|
|
@@ -25,6 +25,15 @@ export const BookingSummary = ({
|
|
|
25
25
|
const { t } = useTranslation("Design");
|
|
26
26
|
const { formatNumber } = useIntl();
|
|
27
27
|
|
|
28
|
+
const orderProducts = useMemo(() => {
|
|
29
|
+
if (!formValues) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const products = Object.values(formValues).filter(Boolean) as Order[];
|
|
33
|
+
|
|
34
|
+
return products?.filter((prod) => prod?.quantity !== 0);
|
|
35
|
+
}, [formValues]);
|
|
36
|
+
|
|
28
37
|
if (isLoading) {
|
|
29
38
|
return (
|
|
30
39
|
<div className="payment-booking-summary">
|
|
@@ -43,20 +52,19 @@ export const BookingSummary = ({
|
|
|
43
52
|
</div>
|
|
44
53
|
<hr />
|
|
45
54
|
|
|
46
|
-
{
|
|
55
|
+
{orderProducts?.length > 0 ? (
|
|
47
56
|
<div>
|
|
48
57
|
<div className="cart-items">
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
{menuSteps.map((menuStep: MenuStep) => {
|
|
59
|
+
return (
|
|
51
60
|
<ProductsByMenuStep
|
|
52
61
|
key={menuStep.id}
|
|
53
|
-
|
|
62
|
+
orderProducts={orderProducts}
|
|
54
63
|
step={menuStep}
|
|
55
64
|
productsWithErrors={productsWithErrors}
|
|
56
65
|
/>
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
);
|
|
67
|
+
})}
|
|
60
68
|
{!shouldHidePeopleAmount && peopleAmount > 0 && (
|
|
61
69
|
<>
|
|
62
70
|
<hr />
|
|
@@ -66,7 +74,6 @@ export const BookingSummary = ({
|
|
|
66
74
|
</div>
|
|
67
75
|
</>
|
|
68
76
|
)}
|
|
69
|
-
|
|
70
77
|
{!!transactionFee && (
|
|
71
78
|
<>
|
|
72
79
|
<hr />
|
|
@@ -1,72 +1,90 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import * as Config from "@licklist/core/dist/Config";
|
|
2
5
|
import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
3
|
-
import {
|
|
4
|
-
OrderItem,
|
|
5
|
-
OrderItems,
|
|
6
|
-
} from "@licklist/plugins/dist/types/context/Iframe/orderItems";
|
|
7
|
-
import { MenuStep } from "@licklist/plugins/dist/types/context/sale/menuSteps";
|
|
8
|
-
import { values } from "lodash";
|
|
9
|
-
import { ProductSummary } from "../ProductSummary";
|
|
10
|
-
import { getProductError } from "../../utils";
|
|
11
|
-
|
|
12
|
-
const doesStepHaveItems = (orderItems: OrderItems, step: MenuStep): boolean => {
|
|
13
|
-
const categoriesIds = step.productCategories.map((category) => category.id);
|
|
14
|
-
|
|
15
|
-
const stepItems = values(orderItems).filter((item) =>
|
|
16
|
-
categoriesIds.includes(item.productsCategoryId)
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
return stepItems.length > 0;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const getOrderItemsForCategory = (
|
|
23
|
-
orderItems: OrderItems,
|
|
24
|
-
categoryId: number
|
|
25
|
-
): OrderItem[] =>
|
|
26
|
-
values(orderItems).filter((item) => item.productsCategoryId === categoryId);
|
|
6
|
+
import { Order, MenuStep } from "../../../../../../types";
|
|
27
7
|
|
|
28
8
|
export type ProductsByMenuStepsProps = {
|
|
29
|
-
|
|
9
|
+
orderProducts: Order[];
|
|
30
10
|
step: MenuStep;
|
|
31
11
|
productsWithErrors?: QuantityCheckProductInfo[];
|
|
32
12
|
};
|
|
33
13
|
|
|
14
|
+
const getIdFromEntity = (entities: { id: number }[]) =>
|
|
15
|
+
entities.map(({ id }) => id);
|
|
16
|
+
|
|
34
17
|
export const ProductsByMenuStep = ({
|
|
35
|
-
|
|
18
|
+
orderProducts,
|
|
36
19
|
step,
|
|
37
|
-
productsWithErrors
|
|
20
|
+
productsWithErrors,
|
|
38
21
|
}: ProductsByMenuStepsProps) => {
|
|
22
|
+
const { t } = useTranslation("Design");
|
|
23
|
+
const { formatNumber } = useIntl();
|
|
39
24
|
const { productCategories } = step;
|
|
40
25
|
|
|
41
|
-
|
|
26
|
+
const productsByCategories = useMemo(() => {
|
|
27
|
+
const productsInCategoriesIds = getIdFromEntity(productCategories);
|
|
28
|
+
|
|
29
|
+
return orderProducts.filter(({ productsCategoryId }) =>
|
|
30
|
+
productsInCategoriesIds.includes(productsCategoryId)
|
|
31
|
+
);
|
|
32
|
+
}, [productCategories, orderProducts]);
|
|
33
|
+
|
|
34
|
+
const productIds = getIdFromEntity(productsByCategories);
|
|
35
|
+
|
|
36
|
+
if (!productsByCategories.length) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
42
39
|
|
|
43
40
|
return (
|
|
44
|
-
<div className="
|
|
45
|
-
{productCategories.map((
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
category.id
|
|
41
|
+
<div className="products-by-menu-step">
|
|
42
|
+
{productCategories.map(({ name, id, products }) => {
|
|
43
|
+
const selectedProducts = products.filter(({ id: productId }) =>
|
|
44
|
+
productIds.includes(productId)
|
|
49
45
|
);
|
|
50
46
|
|
|
51
|
-
if (
|
|
47
|
+
if (!selectedProducts.length) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
52
50
|
|
|
53
51
|
return (
|
|
54
|
-
<div key={
|
|
55
|
-
<p className="m-0 title">{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
productsWithErrors,
|
|
60
|
-
orderItem.id
|
|
52
|
+
<div key={id} className="products">
|
|
53
|
+
<p className="m-0 title">{name}</p>
|
|
54
|
+
{selectedProducts.map(({ id, name }) => {
|
|
55
|
+
const orderProduct = productsByCategories.find(
|
|
56
|
+
({ id: productId }) => productId === id
|
|
61
57
|
);
|
|
62
58
|
|
|
59
|
+
const productQuantityError = (productsWithErrors ?? []).find(
|
|
60
|
+
(productWithError) =>
|
|
61
|
+
productWithError.product_id === orderProduct.id
|
|
62
|
+
)?.message;
|
|
63
|
+
|
|
63
64
|
return (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
<div className="product" key={id}>
|
|
66
|
+
<p className="m-0 name">{name}</p>
|
|
67
|
+
<div className="d-flex justify-content-between">
|
|
68
|
+
<p className="m-0">
|
|
69
|
+
{t("shortQuantity")}: {orderProduct?.quantity}
|
|
70
|
+
</p>
|
|
71
|
+
<p className="price">
|
|
72
|
+
{formatNumber(
|
|
73
|
+
(orderProduct?.deposit || orderProduct?.price || 0) *
|
|
74
|
+
orderProduct?.quantity,
|
|
75
|
+
{
|
|
76
|
+
style: "currency",
|
|
77
|
+
currency: Config.Currency.GBP,
|
|
78
|
+
}
|
|
79
|
+
)}
|
|
80
|
+
</p>
|
|
81
|
+
</div>
|
|
82
|
+
{productQuantityError && (
|
|
83
|
+
<p className="iframe-event__message-error">
|
|
84
|
+
{productQuantityError}
|
|
85
|
+
</p>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
70
88
|
);
|
|
71
89
|
})}
|
|
72
90
|
</div>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { QuantityCheckProductInfo } from "@licklist/plugins/dist/types/Api/verifyStock";
|
|
2
|
-
import {
|
|
3
|
-
import { MenuStep } from "@licklist/plugins/dist/types/context/sale/menuSteps";
|
|
2
|
+
import { MenuStep, Order } from "../../../../../types";
|
|
4
3
|
|
|
5
4
|
export const MOBILE_WIDTH = 576;
|
|
6
5
|
export const ACCORDION_KEY = "booking-summary";
|
|
@@ -9,7 +8,9 @@ export type BookingSummaryProps = {
|
|
|
9
8
|
date: string;
|
|
10
9
|
time?: string;
|
|
11
10
|
menuSteps?: MenuStep[];
|
|
12
|
-
formValues?:
|
|
11
|
+
formValues?: {
|
|
12
|
+
[key: string]: Order;
|
|
13
|
+
};
|
|
13
14
|
totalWithDiscount?: number;
|
|
14
15
|
shouldHidePeopleAmount?: boolean;
|
|
15
16
|
eventName?: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { OrderItem } from "@licklist/plugins/dist/types/context/Iframe/orderItems";
|
|
1
|
+
import { Order } from "../../../../../types";
|
|
3
2
|
|
|
4
|
-
export const cartSumByOrderProducts = (orderProducts?:
|
|
3
|
+
export const cartSumByOrderProducts = (orderProducts?: Order[]) => {
|
|
5
4
|
if (!orderProducts || !orderProducts.length) {
|
|
6
5
|
return 0;
|
|
7
6
|
}
|
|
@@ -13,11 +12,3 @@ export const cartSumByOrderProducts = (orderProducts?: OrderItem[]) => {
|
|
|
13
12
|
);
|
|
14
13
|
}, 0);
|
|
15
14
|
};
|
|
16
|
-
|
|
17
|
-
export const getProductError = (
|
|
18
|
-
productsWithErrors: QuantityCheckProductInfo[],
|
|
19
|
-
productId: OrderItem["id"]
|
|
20
|
-
): string | undefined =>
|
|
21
|
-
productsWithErrors.find(
|
|
22
|
-
(productWithError) => productWithError.product_id === productId
|
|
23
|
-
)?.message;
|