@licklist/design 0.44.469 → 0.44.470
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/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.d.ts.map +1 -1
- package/dist/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +2 -2
- 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/BookingSummaryAccordion/BookingSummaryAccordion.d.ts +2 -1
- package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.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/styles/iframe-events/Event.scss +12 -0
- package/dist/styles/iframe-page/PageBody.scss +3 -0
- package/package.json +1 -1
- package/src/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.tsx +1 -4
- package/src/iframe/order-process/OrderProcess.stories.tsx +53 -3
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +2 -1
- package/src/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.tsx +5 -1
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +1 -0
- package/src/styles/iframe-events/Event.scss +12 -0
- package/src/styles/iframe-page/PageBody.scss +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderNumberOfPeopleInputComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.tsx"],"names":[],"mappings":";AAOA,UAAU,uCAAuC;IAC/C,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,kCAAkC,+DAI5C,uCAAuC,
|
|
1
|
+
{"version":3,"file":"RenderNumberOfPeopleInputComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent.tsx"],"names":[],"mappings":";AAOA,UAAU,uCAAuC;IAC/C,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,kCAAkC,+DAI5C,uCAAuC,gBAoCzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("react")),t=require("react-i18next"),n=e(require("clsx")),a=require("../../../../../order-process/components/CategoryProduct/components/NumberInput/NumberInput.js");exports.RenderNumberOfPeopleInputComponent=function(e){var o=e.onChangePeopleAmount,u=e.peopleAmount,m=e.peopleAmountError,l=t.useTranslation("Design").t;return r.createElement("div",{id:"numberOfPeople",className:"people-input"},r.createElement("div",{className:"d-flex align-items-center input-wrapper"},r.createElement("h3",{className:"iframe-event__name"},l("people")),r.createElement(a.NumberInput,{onChange:o,onArrowDown:function(){return o(Number(u)-1)},onArrowUp:function(){return o(Number(u)+1)},min:0,value:Number(u),className:n("iframe-event__product-count")})),r.createElement("div",{className:"iframe-event__message-error"},m&&r.createElement("div",{className:"mt-3"},r.createElement("p",null,r.createElement(t.Trans,{t:l,i18nKey:"pleaseSelectAtLeastFrom",values:{min:1,type:"item",from:"this category"}})))))};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BookingSummaryProps } from "./types";
|
|
3
3
|
export declare const BookingSummary: {
|
|
4
|
-
({ date, menuSteps, formValues, isNotShownPeopleAmount, eventName, transactionFee, productsWithErrors, isLoading, }: Omit<BookingSummaryProps, "totallWithDiscount">): JSX.Element;
|
|
4
|
+
({ date, menuSteps, formValues, isNotShownPeopleAmount, eventName, transactionFee, productsWithErrors, isLoading, hasPeopleInput, }: Omit<BookingSummaryProps, "totallWithDiscount">): JSX.Element;
|
|
5
5
|
SummaryTotal: ({ formValues, totalWithDiscount, transactionFee, isFreePayment, }: Pick<BookingSummaryProps, "formValues" | "totalWithDiscount" | "transactionFee" | "isFreePayment">) => JSX.Element;
|
|
6
|
-
Accordion: ({ children, title, showTitleOnlyOnMobile, }: import("./components/BookingSummaryAccordion").BookingSummaryAccordionProps) => JSX.Element;
|
|
6
|
+
Accordion: ({ children, title, showTitleOnlyOnMobile, hasPeopleInput, }: import("./components/BookingSummaryAccordion").BookingSummaryAccordionProps) => JSX.Element;
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=BookingSummary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingSummary.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/BookingSummary/BookingSummary.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAK9C,eAAO,MAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"BookingSummary.d.ts","sourceRoot":"","sources":["../../../../../src/iframe/order-process/components/BookingSummary/BookingSummary.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAK9C,eAAO,MAAM,cAAc;yIAUxB,KAAK,mBAAmB,EAAE,oBAAoB,CAAC;;;CAgFjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),a=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@licklist/core/dist/Config"),m=require("../../../../static/loader/LoaderIndicator.js"),c=require("react-i18next");require("../../../../static/index.js");var o=require("react-intl");require("./components/SummaryTotal/components/SummaryTotalBlock.js");var s=require("./components/ProductsByMenuStep/ProductsByMenuStep.js"),l=require("./utils/index.js"),i=require("./components/SummaryTotal/SummaryTotal.js"),u=require("./components/BookingSummaryAccordion/BookingSummaryAccordion.js"),d=function(e){var i=e.date,d=e.menuSteps,p=e.formValues,y=e.isNotShownPeopleAmount,E=e.eventName,f=e.transactionFee,v=void 0===f?0:f,N=e.productsWithErrors,S=e.isLoading,g=c.useTranslation("Design").t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),a=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@licklist/core/dist/Config"),m=require("../../../../static/loader/LoaderIndicator.js"),c=require("react-i18next");require("../../../../static/index.js");var o=require("react-intl");require("./components/SummaryTotal/components/SummaryTotalBlock.js");var s=require("./components/ProductsByMenuStep/ProductsByMenuStep.js"),l=require("./utils/index.js"),i=require("./components/SummaryTotal/SummaryTotal.js"),u=require("./components/BookingSummaryAccordion/BookingSummaryAccordion.js"),d=function(e){var i=e.date,d=e.menuSteps,p=e.formValues,y=e.isNotShownPeopleAmount,E=e.eventName,f=e.transactionFee,v=void 0===f?0:f,N=e.productsWithErrors,S=e.isLoading,g=e.hasPeopleInput,q=c.useTranslation("Design").t,j=o.useIntl().formatNumber,k=t.__read(r.useMemo((function(){var e=l.sanitizeFormValues(p),r=e.numberOfPeople,a=t.__rest(e,["numberOfPeople"]);return[r,Object.keys(a).map((function(e){return a[e]})).filter((function(e){return 0!==e.quantity}))]}),[p]),2),b=k[0],B=void 0===b?0:b,P=k[1];return S?a.createElement("div",{className:"payment-booking-summary"},a.createElement(m.LoaderIndicator,{isLoaded:!1})):a.createElement("div",{className:"payment-booking-summary"},a.createElement(u.BookingSummaryAccordion,{hasPeopleInput:g},a.createElement("div",{className:"event-info"},a.createElement("p",{className:"m-0 title event-name"},E),a.createElement("p",{className:"m-0"},i)),a.createElement("hr",null),P.length>0?a.createElement("div",null,a.createElement("div",{className:"cart-items"},d.map((function(e){return a.createElement(s.ProductsByMenuStep,{key:e.id,orderProducts:P,step:e,productsWithErrors:N})})),!y&&B>0&&a.createElement(a.Fragment,null,a.createElement("hr",null),a.createElement("div",{className:"d-flex justify-content-between mt-3"},a.createElement("p",{className:"m-0"},q("people"),":"),a.createElement("p",{className:"price"},B))),!!v&&a.createElement(a.Fragment,null,a.createElement("hr",null),a.createElement("div",{className:"d-flex justify-content-between mt-3"},a.createElement("p",{className:"m-0"},q("transactionFee"),":"),a.createElement("p",{className:"price"},j(v,{style:"currency",currency:n.Currency.GBP})))))):a.createElement("div",{className:"cart-items"},a.createElement("p",{className:"empty-cart"},q("emptyBasket")))))};d.SummaryTotal=i.SummaryTotal,d.Accordion=u.BookingSummaryAccordion,exports.BookingSummary=d;
|
|
@@ -2,6 +2,7 @@ import { PropsWithChildren } from "react";
|
|
|
2
2
|
export declare type BookingSummaryAccordionProps = PropsWithChildren<{
|
|
3
3
|
title?: string;
|
|
4
4
|
showTitleOnlyOnMobile?: boolean;
|
|
5
|
+
hasPeopleInput?: boolean;
|
|
5
6
|
}>;
|
|
6
|
-
export declare const BookingSummaryAccordion: ({ children, title, showTitleOnlyOnMobile, }: BookingSummaryAccordionProps) => JSX.Element;
|
|
7
|
+
export declare const BookingSummaryAccordion: ({ children, title, showTitleOnlyOnMobile, hasPeopleInput, }: BookingSummaryAccordionProps) => JSX.Element;
|
|
7
8
|
//# sourceMappingURL=BookingSummaryAccordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingSummaryAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.tsx"],"names":[],"mappings":"AAAA,OAAc,EAGZ,iBAAiB,EAElB,MAAM,OAAO,CAAC;AAaf,oBAAY,4BAA4B,GAAG,iBAAiB,CAAC;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BookingSummaryAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.tsx"],"names":[],"mappings":"AAAA,OAAc,EAGZ,iBAAiB,EAElB,MAAM,OAAO,CAAC;AAaf,oBAAY,4BAA4B,GAAG,iBAAiB,CAAC;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC,CAAC;AAEH,eAAO,MAAM,uBAAuB,gEAKjC,4BAA4B,gBA6D9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),n=require("react"),o=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-bootstrap"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),n=require("react"),o=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-bootstrap"),a=require("@licklist/plugins/dist/hooks/Media/useWindowDimensions"),s=require("../../types/index.js"),r=require("../../../../../page/components/PageBody/constants.js"),c=require("../ToggleHeader/ToggleHeader.js"),l=require("../../../../../page/components/PageBody/hooks/useResizePageBody.js");exports.BookingSummaryAccordion=function(e){var d=e.children,u=e.title,E=e.showTitleOnlyOnMobile,p=void 0!==E&&E,C=e.hasPeopleInput,w=a.useWindowDimensions().width,O=t.__read(n.useState(w<=s.MOBILE_WIDTH),2),_=O[0],g=O[1],v=l.useResizePageBody().rightBlockContentStyles,h=w<=s.MOBILE_WIDTH,m=n.useCallback((function(e){g(e===s.ACCORDION_KEY)}),[]),f=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_EXPAND))}),[]),y=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_EXPANDED))}),[]),B=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_COLLAPSE))}),[]),I=n.useCallback((function(){window.dispatchEvent(new Event(r.RIGHT_BLOCK_COLLAPSED))}),[]);n.useEffect((function(){w>s.MOBILE_WIDTH?g(!0):g(!1)}),[w,g]);var D=!p||p&&h;return o.createElement(i.Accordion,{defaultActiveKey:s.ACCORDION_KEY,onSelect:m},o.createElement(c.ToggleHeader,{showExpandButton:h,isExpanded:_,title:u,hideComponent:!D}),o.createElement(i.Accordion.Collapse,{eventKey:s.ACCORDION_KEY,onEnter:f,onEntered:y,onExit:B,onExited:I,className:"".concat(D&&"has-toggler"," ").concat(C&&"collapse-with-people-input"),style:v},o.createElement("div",{className:"summary-wrapper"},d)))};
|
|
@@ -11,6 +11,7 @@ export declare type BookingSummaryProps = {
|
|
|
11
11
|
totalWithDiscount?: number;
|
|
12
12
|
isNotShownPeopleAmount?: boolean;
|
|
13
13
|
eventName: string;
|
|
14
|
+
hasPeopleInput?: boolean;
|
|
14
15
|
transactionFee?: number;
|
|
15
16
|
isFreePayment?: boolean;
|
|
16
17
|
productsWithErrors?: ProductQuantityCheckResponse["products"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEvD,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;KAC/B,CAAC;IACF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/BookingSummary/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEvD,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;KAC/B,CAAC;IACF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC"}
|
|
@@ -285,6 +285,14 @@
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
.people-input {
|
|
288
|
+
margin-bottom: 1rem;
|
|
289
|
+
h3 {
|
|
290
|
+
font-size: 1rem;
|
|
291
|
+
}
|
|
292
|
+
input[type="number"] {
|
|
293
|
+
height: 2rem;
|
|
294
|
+
}
|
|
295
|
+
|
|
288
296
|
.input-wrapper {
|
|
289
297
|
justify-content: center;
|
|
290
298
|
}
|
|
@@ -359,6 +367,7 @@
|
|
|
359
367
|
}
|
|
360
368
|
|
|
361
369
|
.people-input {
|
|
370
|
+
margin-bottom: 0;
|
|
362
371
|
.input-wrapper {
|
|
363
372
|
justify-content: space-between;
|
|
364
373
|
}
|
|
@@ -367,6 +376,9 @@
|
|
|
367
376
|
&__name {
|
|
368
377
|
margin-bottom: 1rem;
|
|
369
378
|
}
|
|
379
|
+
&__message-error {
|
|
380
|
+
padding-bottom: 0.5rem;
|
|
381
|
+
}
|
|
370
382
|
}
|
|
371
383
|
}
|
|
372
384
|
}
|
package/package.json
CHANGED
|
@@ -19,10 +19,7 @@ export const RenderNumberOfPeopleInputComponent = ({
|
|
|
19
19
|
const { t } = useTranslation("Design");
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<div
|
|
23
|
-
id={NUMBER_OF_PEOPLE}
|
|
24
|
-
className="people-input calendar-people-input pt-5 mb-5"
|
|
25
|
-
>
|
|
22
|
+
<div id={NUMBER_OF_PEOPLE} className="people-input">
|
|
26
23
|
<div className="d-flex align-items-center input-wrapper">
|
|
27
24
|
<h3 className="iframe-event__name">{t("people")}</h3>
|
|
28
25
|
|
|
@@ -4,6 +4,7 @@ import React, {
|
|
|
4
4
|
useContext,
|
|
5
5
|
createContext,
|
|
6
6
|
useRef,
|
|
7
|
+
useMemo,
|
|
7
8
|
} from "react";
|
|
8
9
|
import { MemoryRouter, Route, useHistory } from "react-router-dom";
|
|
9
10
|
import { Meta } from "@storybook/react";
|
|
@@ -14,6 +15,10 @@ import { StepsForm } from "./components/StepsForm";
|
|
|
14
15
|
import { Page, PageBody, PageHeader } from "../page";
|
|
15
16
|
import { StepsFormRef } from "./components/StepsForm/StepsForm";
|
|
16
17
|
import { BookingSummaryFooter } from "./components/BookingSummaryFooter";
|
|
18
|
+
import { sanitizeFormValues } from "./components/BookingSummary/utils";
|
|
19
|
+
import { Order } from "../../types";
|
|
20
|
+
// eslint-disable-next-line max-len
|
|
21
|
+
import { RenderNumberOfPeopleInputComponent } from "../event/event-details/components/number-of-people-input/component/RenderNumberOfPeopleInputComponent";
|
|
17
22
|
|
|
18
23
|
const ROUTES = [
|
|
19
24
|
{ pathname: "/step1", key: "/step1", name: "Burger" },
|
|
@@ -175,7 +180,12 @@ const OrderProcessContextProvider: React.FC = ({ children }) => {
|
|
|
175
180
|
|
|
176
181
|
return (
|
|
177
182
|
<OrderProcessContext.Provider
|
|
178
|
-
value={{
|
|
183
|
+
value={{
|
|
184
|
+
orderFormValues,
|
|
185
|
+
setOrderFormValues,
|
|
186
|
+
formValues,
|
|
187
|
+
setFormValues,
|
|
188
|
+
}}
|
|
179
189
|
>
|
|
180
190
|
{children}
|
|
181
191
|
</OrderProcessContext.Provider>
|
|
@@ -211,6 +221,8 @@ const TimerWrapper = () => {
|
|
|
211
221
|
export function Default() {
|
|
212
222
|
const externalHistory = useHistory();
|
|
213
223
|
const formRef = useRef<StepsFormRef | null>(null);
|
|
224
|
+
const [peopleAmount, setPeopleAmount] = useState(0);
|
|
225
|
+
const [peopleAmountError, setPeopleAmountError] = useState(false);
|
|
214
226
|
|
|
215
227
|
return (
|
|
216
228
|
<MemoryRouter initialEntries={ROUTES} initialIndex={0}>
|
|
@@ -231,7 +243,7 @@ export function Default() {
|
|
|
231
243
|
formValues,
|
|
232
244
|
setFormValues,
|
|
233
245
|
} = useContext(OrderProcessContext);
|
|
234
|
-
|
|
246
|
+
const relyOnPeopleCategoryIds = [4];
|
|
235
247
|
const onPrevStep = () => {
|
|
236
248
|
if (formRef.current?.getFormValues()) {
|
|
237
249
|
setFormValues(formRef.current?.getFormValues());
|
|
@@ -254,6 +266,37 @@ export function Default() {
|
|
|
254
266
|
}
|
|
255
267
|
};
|
|
256
268
|
|
|
269
|
+
const shouldShowPeopleInput = useMemo(() => {
|
|
270
|
+
const { numberOfPeople, ...orderProducts } =
|
|
271
|
+
sanitizeFormValues(formValues);
|
|
272
|
+
|
|
273
|
+
const values = Object.values(orderProducts).filter(
|
|
274
|
+
Boolean
|
|
275
|
+
) as Order[];
|
|
276
|
+
const filteredValues = values.filter(
|
|
277
|
+
(product) =>
|
|
278
|
+
relyOnPeopleCategoryIds.includes(
|
|
279
|
+
product.productsCategoryId
|
|
280
|
+
) && product.quantity > 0
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
return Boolean(filteredValues.length);
|
|
284
|
+
}, [formValues, relyOnPeopleCategoryIds]);
|
|
285
|
+
const onChangePeopleAmount = (value: number) => {
|
|
286
|
+
if (!setPeopleAmount) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
setPeopleAmount(value);
|
|
290
|
+
if (value > 0) {
|
|
291
|
+
if (peopleAmountError) {
|
|
292
|
+
setPeopleAmountError(false);
|
|
293
|
+
}
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
setPeopleAmountError(true);
|
|
298
|
+
};
|
|
299
|
+
|
|
257
300
|
return (
|
|
258
301
|
<Page
|
|
259
302
|
headerBlock={
|
|
@@ -277,7 +320,6 @@ export function Default() {
|
|
|
277
320
|
setFormValues={setFormValues}
|
|
278
321
|
defaultValues={orderFormValues}
|
|
279
322
|
onSubmit={onNextStep}
|
|
280
|
-
relyOnPeopleCategoryIds={[4]}
|
|
281
323
|
ref={formRef}
|
|
282
324
|
/>
|
|
283
325
|
</PageBody.LeftBlock>
|
|
@@ -286,6 +328,13 @@ export function Default() {
|
|
|
286
328
|
<PageBody.RightBlock
|
|
287
329
|
bottomBlock={
|
|
288
330
|
<BookingSummaryFooter>
|
|
331
|
+
{shouldShowPeopleInput && (
|
|
332
|
+
<RenderNumberOfPeopleInputComponent
|
|
333
|
+
peopleAmount={peopleAmount || 0}
|
|
334
|
+
onChangePeopleAmount={onChangePeopleAmount}
|
|
335
|
+
peopleAmountError={peopleAmountError}
|
|
336
|
+
/>
|
|
337
|
+
)}
|
|
289
338
|
<BookingSummary.SummaryTotal
|
|
290
339
|
formValues={formValues}
|
|
291
340
|
totalWithDiscount={5}
|
|
@@ -294,6 +343,7 @@ export function Default() {
|
|
|
294
343
|
}
|
|
295
344
|
>
|
|
296
345
|
<BookingSummary
|
|
346
|
+
hasPeopleInput={shouldShowPeopleInput}
|
|
297
347
|
date="29 Sept 2022 at 09:00"
|
|
298
348
|
menuSteps={menuSteps as any}
|
|
299
349
|
formValues={formValues}
|
|
@@ -19,6 +19,7 @@ export const BookingSummary = ({
|
|
|
19
19
|
transactionFee = 0,
|
|
20
20
|
productsWithErrors,
|
|
21
21
|
isLoading,
|
|
22
|
+
hasPeopleInput,
|
|
22
23
|
}: Omit<BookingSummaryProps, "totallWithDiscount">) => {
|
|
23
24
|
const { t } = useTranslation("Design");
|
|
24
25
|
const { formatNumber } = useIntl();
|
|
@@ -46,7 +47,7 @@ export const BookingSummary = ({
|
|
|
46
47
|
|
|
47
48
|
return (
|
|
48
49
|
<div className="payment-booking-summary">
|
|
49
|
-
<BookingSummaryAccordion>
|
|
50
|
+
<BookingSummaryAccordion hasPeopleInput={hasPeopleInput}>
|
|
50
51
|
<div className="event-info">
|
|
51
52
|
<p className="m-0 title event-name">{eventName}</p>
|
|
52
53
|
<p className="m-0">{date}</p>
|
|
@@ -19,12 +19,14 @@ import { useResizePageBody } from "../../../../../page/components/PageBody/hooks
|
|
|
19
19
|
export type BookingSummaryAccordionProps = PropsWithChildren<{
|
|
20
20
|
title?: string;
|
|
21
21
|
showTitleOnlyOnMobile?: boolean;
|
|
22
|
+
hasPeopleInput?: boolean;
|
|
22
23
|
}>;
|
|
23
24
|
|
|
24
25
|
export const BookingSummaryAccordion = ({
|
|
25
26
|
children,
|
|
26
27
|
title,
|
|
27
28
|
showTitleOnlyOnMobile = false,
|
|
29
|
+
hasPeopleInput,
|
|
28
30
|
}: BookingSummaryAccordionProps) => {
|
|
29
31
|
const { width } = useWindowDimensions();
|
|
30
32
|
const [isExpanded, setIsExpanded] = useState(width <= MOBILE_WIDTH);
|
|
@@ -77,7 +79,9 @@ export const BookingSummaryAccordion = ({
|
|
|
77
79
|
onEntered={onExpanded}
|
|
78
80
|
onExit={onCollapse}
|
|
79
81
|
onExited={onCollapsed}
|
|
80
|
-
className={showToggleHeader && "has-toggler"}
|
|
82
|
+
className={`${showToggleHeader && "has-toggler"} ${
|
|
83
|
+
hasPeopleInput && "collapse-with-people-input"
|
|
84
|
+
}`}
|
|
81
85
|
style={rightBlockContentStyles}
|
|
82
86
|
>
|
|
83
87
|
<div className="summary-wrapper">{children}</div>
|
|
@@ -13,6 +13,7 @@ export type BookingSummaryProps = {
|
|
|
13
13
|
totalWithDiscount?: number;
|
|
14
14
|
isNotShownPeopleAmount?: boolean;
|
|
15
15
|
eventName: string;
|
|
16
|
+
hasPeopleInput?: boolean;
|
|
16
17
|
transactionFee?: number;
|
|
17
18
|
isFreePayment?: boolean;
|
|
18
19
|
productsWithErrors?: ProductQuantityCheckResponse["products"];
|
|
@@ -285,6 +285,14 @@
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
.people-input {
|
|
288
|
+
margin-bottom: 1rem;
|
|
289
|
+
h3 {
|
|
290
|
+
font-size: 1rem;
|
|
291
|
+
}
|
|
292
|
+
input[type="number"] {
|
|
293
|
+
height: 2rem;
|
|
294
|
+
}
|
|
295
|
+
|
|
288
296
|
.input-wrapper {
|
|
289
297
|
justify-content: center;
|
|
290
298
|
}
|
|
@@ -359,6 +367,7 @@
|
|
|
359
367
|
}
|
|
360
368
|
|
|
361
369
|
.people-input {
|
|
370
|
+
margin-bottom: 0;
|
|
362
371
|
.input-wrapper {
|
|
363
372
|
justify-content: space-between;
|
|
364
373
|
}
|
|
@@ -367,6 +376,9 @@
|
|
|
367
376
|
&__name {
|
|
368
377
|
margin-bottom: 1rem;
|
|
369
378
|
}
|
|
379
|
+
&__message-error {
|
|
380
|
+
padding-bottom: 0.5rem;
|
|
381
|
+
}
|
|
370
382
|
}
|
|
371
383
|
}
|
|
372
384
|
}
|