@licklist/design 0.44.469 → 0.44.471
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/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/context.d.ts +4 -2
- package/dist/product-set/form/context.d.ts.map +1 -1
- package/dist/product-set/form/context.js +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts +1 -1
- package/dist/product-set/utils/index.d.ts +5 -0
- package/dist/product-set/utils/index.d.ts.map +1 -0
- package/dist/product-set/utils/index.js +1 -0
- package/dist/sortable-tree/SortableTreeItem.d.ts +2 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +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/product-set/form/ProductCategoriesControl.tsx +67 -18
- package/src/product-set/form/context.tsx +18 -1
- package/src/product-set/product-category/ProductCategoryControl.tsx +1 -1
- package/src/product-set/utils/index.ts +16 -0
- package/src/sortable-tree/SortableTreeItem.tsx +13 -2
- 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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCategoriesControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductCategoriesControl.tsx"],"names":[],"mappings":";AAYA,OAAO,EAKL,YAAY,EACb,MAAM,kEAAkE,CAAC;AAQ1E,OAAO,EAAwB,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductCategoriesControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductCategoriesControl.tsx"],"names":[],"mappings":";AAYA,OAAO,EAKL,YAAY,EACb,MAAM,kEAAkE,CAAC;AAQ1E,OAAO,EAAwB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQvE,UAAU,6BAA8B,SAAQ,aAAa;IAC3D,SAAS,EAAE,MAAM,CAAC;CACnB;AA4BD,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,SAAS,GACV,EAAE,6BAA6B,eAqR/B;AAED,eAAO,MAAM,cAAc,iBACX,YAAY,SACnB,MAAM;WACH,MAAM;eAAa,MAAM;CAcpC,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 t=require("tslib"),r=require("react"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),n=e(r),o=require("react-i18next"),i=require("react-bootstrap"),a=require("react-hook-form"),u=e(require("@licklist/plugins/dist/services/Form/HookFormService")),d=e(require("clsx")),l=require("@dnd-kit/core"),s=require("lodash"),c=require("../../sortable-tree/SortableTreeItem.js"),m=require("../../sortable-tree/SortableTree.js"),p=require("../item/CreateProductSetItem.js"),v=require("./context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),f=require("../product-category/ProductCategoryControl.js"),y=require("./ProductsControl.js"),C=require("./SelectCategoryModal.js"),E=require("./VenueMapSetModal.js"),b=require("../utils/index.js");var I=function(e,t){return e===g.CATEGORY_TYPE_GAME?{className:"game-badge",label:t}:e===g.CATEGORY_TYPE_FIXED_DURATION?{className:"fixed-duration-badge",label:t}:null};exports.ProductCategoriesControl=function(e){var _,S,q,T,x,P,N=e.isLoading,M=e.stepIndex,A=o.useTranslation("Design").t,h=r.useContext(v.ProductSetLoadingContext),k=h.providerHasMap,j=h.expandedProductCategories,D=h.setExpandedProductCategories,R=a.useFormContext(),V=t.__read(r.useState(!1),2),Y=V[0],F=V[1],O=t.__read(r.useState(!1),2),B=O[0],L=O[1],w=t.__read(r.useState(!1),2),G=w[0],H=w[1],Q=R.control,U=R.formState.errors,K=R.clearErrors,z=R.watch,W=R.trigger,X=R.getValues,J=R.setValue,Z=z("steps.".concat(M,".hasMap"))||!1,$="steps.".concat(M,".productCategories"),ee=a.useFieldArray({name:$,control:Q,keyName:"_id"}),te=ee.fields,re=ee.append,ne=ee.remove,oe=t.__read(r.useState([]),2),ie=oe[0],ae=oe[1],ue=a.useWatch({control:Q,name:$}),de=null===(S=null===(_=null==U?void 0:U.steps)||void 0===_?void 0:_[M])||void 0===S?void 0:S.productCategories,le=null===(T=null===(q=null==U?void 0:U.steps)||void 0===q?void 0:q[M])||void 0===T?void 0:T.venueMapSetId,se=null===(P=null===(x=null==U?void 0:U.steps)||void 0===x?void 0:x[M])||void 0===P?void 0:P.pointProducts,ce=Boolean(le||se),me=l.useSensor(l.MouseSensor,{activationConstraint:{distance:10}});return r.useEffect((function(){ue&&ue.length&&ue.forEach((function(e){var t,r,n,o=null===(r=e.products)||void 0===r?void 0:r.reduce((function(e,t){return e+Number(t.price)*Number(t.totalQuantity)}),0),i=null===(n=e.products)||void 0===n?void 0:n.reduce((function(e,t){return e+Number(t.totalQuantity)}),0);ae(((t={})[(null==e?void 0:e.id)||e.uniqueId]={price:o,quantity:i},t))}))}),[ue]),r.useEffect((function(){1===te.length&&D((function(e){var r,n,o;return t.__assign(t.__assign({},e),((r={})[String((null===(n=te[0])||void 0===n?void 0:n.id)||(null===(o=te[0])||void 0===o?void 0:o.uniqueId))]=!0,r))}))}),[te]),n.createElement(n.Fragment,null,n.createElement(m.SortableTree,{sensors:[me],items:te.map((function(e){return String(e._id)})),onDragEnd:function(e){var t=e.active,r=e.over;if(t&&r&&(null==t?void 0:t.id)&&(null==r?void 0:r.id)){var n=te.findIndex((function(e){return e._id===t.id})),o=te.findIndex((function(e){return e._id===r.id}));if(n!==o){var i=X($);if(i){var a=b.sortArrayByIndex(b.moveArrayElements(i,n,o));J($,a)}}}}},te.map((function(e,r){var o=(null==e?void 0:e.id)?String(e.id):e.uniqueId,u=function(){!function(e){D((function(r){var n;return t.__assign(t.__assign({},r),((n={})[e]=!r[e],n))}))}(o)};return n.createElement(a.Controller,{key:"product-category-".concat(e._id),name:"".concat($,".").concat(r,".name"),control:Q,rules:{required:A("Validation:fieldRequired",{attribute:A("name")})},render:function(t){var a,d,l,s=t.field,p=s.value,v=s.onChange;return n.createElement(m.SortableTree.Item,{id:e._id,title:p,isExpanded:j[o],setIsExpanded:u,isInvalid:!!de,badge:n.createElement(i.Badge,{className:"category-badge"},A("productCategory")),isIconInHeader:!1,subTitle:n.createElement("div",{className:"product-set-badges-container"},n.createElement("div",{className:"product-set-subtitle-dot product-set-subtitle-category-dot"}),n.createElement("span",null,null!==(l=null===(d=ie[null!==(a=null==e?void 0:e.id)&&void 0!==a?a:e.uniqueId])||void 0===d?void 0:d.quantity)&&void 0!==l?l:"N/A"," ",A("products"))),treeLineIconColor:"#1A93AA",modalLabel:A("addNewCategory"),secondaryBadge:I(e.type,A(e.type)),modalClass:c.ProductSetModalClasses.category,isNewAdded:G,body:n.createElement(f.ProductCategoryControl,{isLoading:N,onCategoryNameChange:v,categoryName:p,stepIndex:M,productCategoryIndex:r}),onDelete:function(){return ne(r)},validate:function(){return W("steps.".concat(M,".productCategories.").concat(r))},sortableItems:e.products?e.products.filter((function(e){return e.id})).map((function(e){var t=e.id;return String(t)})):[]},n.createElement(y.ProductsControl,{isLoading:N,quantityType:e.quantityType,hasTicket:null==e?void 0:e.hasTicket,stepIndex:M,productCategoryIndex:r,categoryType:e.type}))}})}))),n.createElement(p.CreateProductSetItem,{title:A("addCategory"),onClick:function(){F(!0)}}),n.createElement(C.SelectCategoryModal,{isVisible:Y,onHide:function(){return F(!1)},onCategorySelect:function(e){re(function(e,t){return{id:null,uniqueId:s.uniqueId("product-category"),name:"",minSubItems:null,maxSubItems:null,quantityType:g.QUANTITY_TYPE_STANDARD,type:e,isRelyOnPeople:e===g.CATEGORY_TYPE_TICKETS,isTimeRelated:!1,collectUserInfo:!1,hasTicket:e===g.CATEGORY_TYPE_TICKETS,allowDeposits:!1,remainderExpireAfter:void 0,hasBookingManagement:!1,weight:0,isReusable:!1,hasSubEvents:!1,products:[],zoneId:null,sort:t}}(e,te.length)),H(!0),(null==de?void 0:de.type)===u.manualErrorType&&K($)}}),k&&Z&&n.createElement(n.Fragment,null,n.createElement(p.CreateProductSetItem,{title:A("editMap"),onClick:function(){L(!0)},className:d("mt-3",ce&&"mb-3",ce&&"is-invalid")}),ce&&n.createElement("div",{className:"manual-form-error"},le&&A("Validation:fieldRequired",{attribute:A("Design:venueMapSet")}),se&&A("Validation:fieldMinNumber",{attribute:A("pointProduct"),min:1})),n.createElement(E.VenueMapSetModal,{isVisible:B,setIsVisible:L,stepIndex:M})),n.createElement("div",{className:"manual-form-error"},de&&de.message))},exports.getBadgeConfig=I;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "react";
|
|
1
|
+
import React, { PropsWithChildren, SetStateAction, Dispatch } from "react";
|
|
2
2
|
import { VenueMapSet } from "@licklist/core/dist/DataMapper/Product/VenueMapSetDataMapper";
|
|
3
3
|
import { ProviderBookingManagementSetting } from "@licklist/core/dist/DataMapper/Provider/ProviderBookingManagementSettingDataMapper";
|
|
4
4
|
import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
|
|
@@ -11,9 +11,11 @@ interface LoadingContext {
|
|
|
11
11
|
venueMapSets?: VenueMapSet[];
|
|
12
12
|
providerHasBookingManagement?: ProviderBookingManagementSetting["hasBookingManagement"];
|
|
13
13
|
zones?: Zone[] | null;
|
|
14
|
+
expandedProductCategories: Record<string, boolean>;
|
|
15
|
+
setExpandedProductCategories: Dispatch<SetStateAction<Record<string, boolean>>>;
|
|
14
16
|
}
|
|
15
17
|
export declare const ProductSetLoadingContext: React.Context<LoadingContext>;
|
|
16
|
-
declare type ProductSetContextProviderProps = PropsWithChildren<Omit<LoadingContext, "isLoading" | "setLoading">>;
|
|
18
|
+
declare type ProductSetContextProviderProps = PropsWithChildren<Omit<LoadingContext, "isLoading" | "setLoading" | "expandedProductCategories" | "setExpandedProductCategories">>;
|
|
17
19
|
export declare function ProductSetContextProvider({ children, productGroupList, providerHasMap, venueMapSets, providerHasBookingManagement, zones, }: ProductSetContextProviderProps): JSX.Element;
|
|
18
20
|
export {};
|
|
19
21
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,iBAAiB,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,iBAAiB,EACjB,cAAc,EAId,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAC;AAE3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,oFAAoF,CAAC;AACtI,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,UAAU,cAAc;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,4BAA4B,CAAC,EAAE,gCAAgC,CAAC,sBAAsB,CAAC,CAAC;IACxF,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,4BAA4B,EAAE,QAAQ,CACpC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CACxC,CAAC;CACH;AAED,eAAO,MAAM,wBAAwB,+BAEpC,CAAC;AAEF,aAAK,8BAA8B,GAAG,iBAAiB,CACrD,IAAI,CACF,cAAc,EACZ,WAAW,GACX,YAAY,GACZ,2BAA2B,GAC3B,8BAA8B,CACjC,CACF,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,gBAAqB,EACrB,cAAsB,EACtB,YAAiB,EACjB,4BAA4B,EAC5B,KAAK,GACN,EAAE,8BAA8B,eA0BhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),o=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=r.createContext(null);exports.ProductSetContextProvider=function(e){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),o=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=r.createContext(null);exports.ProductSetContextProvider=function(e){var d=e.children,i=e.productGroupList,n=void 0===i?[]:i,u=e.providerHasMap,s=void 0!==u&&u,p=e.venueMapSets,c=void 0===p?[]:p,v=e.providerHasBookingManagement,l=e.zones,g=t.__read(r.useState(void 0),2),f=g[0],x=g[1],_=t.__read(r.useState(!1),2),M=_[0],P=_[1],S=t.__read(r.useState({}),2),C=S[0],L=S[1];return r.useEffect((function(){return x(l)}),[l]),o.createElement(a.Provider,{value:{isLoading:M,setLoading:P,productGroupList:n,providerHasMap:s,venueMapSets:c,providerHasBookingManagement:v,zones:f,expandedProductCategories:C,setExpandedProductCategories:L}},d)},exports.ProductSetLoadingContext=a;
|
|
@@ -5,7 +5,7 @@ import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
|
|
|
5
5
|
import { IsDeletableEvent } from "../types";
|
|
6
6
|
export interface ProductCategoryControlValues extends FormValues {
|
|
7
7
|
id: number;
|
|
8
|
-
uniqueId?:
|
|
8
|
+
uniqueId?: string;
|
|
9
9
|
name: string;
|
|
10
10
|
minSubItems: number | null;
|
|
11
11
|
maxSubItems: number | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product-set/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,6BAEjB,MAAM,aACN,MAAM,QAQlB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;IAE5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib");exports.moveArrayElements=function(e,s,t){var n=r.__spreadArray([],r.__read(e),!1);return n.splice(t,0,n.splice(s,1)[0]),n},exports.sortArrayByIndex=function(e){return e.map((function(e,s){return r.__assign(r.__assign({},e),{sort:s})}))};
|
|
@@ -28,6 +28,7 @@ export interface SortableTreeItemProps {
|
|
|
28
28
|
label: string;
|
|
29
29
|
className: string;
|
|
30
30
|
};
|
|
31
|
+
setIsExpanded?: () => void;
|
|
31
32
|
}
|
|
32
|
-
export declare function SortableTreeItem({ id, title, badge, subTitle, body, children, preItem, postItem, sortableItems, isExpanded, isInvalid, isIconInHeader, treeLineIconColor, modalLabel, modalClass, isNewAdded, onDelete, validate, secondaryBadge, }: SortableTreeItemProps): JSX.Element;
|
|
33
|
+
export declare function SortableTreeItem({ id, title, badge, subTitle, body, children, preItem, postItem, sortableItems, isExpanded, isInvalid, isIconInHeader, treeLineIconColor, modalLabel, modalClass, isNewAdded, onDelete, validate, secondaryBadge, setIsExpanded, }: SortableTreeItemProps): JSX.Element;
|
|
33
34
|
//# sourceMappingURL=SortableTreeItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableTreeItem.d.ts","sourceRoot":"","sources":["../../src/sortable-tree/SortableTreeItem.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"SortableTreeItem.d.ts","sourceRoot":"","sources":["../../src/sortable-tree/SortableTreeItem.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAoC,MAAM,OAAO,CAAC;AAkB3E,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAEX,oBAAY,0BAA0B,GACpC,OAAO,sBAAsB,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,KAAK,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAkB,EAClB,SAAiB,EACjB,cAAqB,EACrB,iBAAsB,EACtB,UAAe,EACf,UAAU,EACV,UAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,aAAa,GACd,EAAE,qBAAqB,eA6RvB"}
|
|
@@ -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 t=require("tslib"),a=require("react"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),a=require("react"),n=e(a),r=require("react-i18next"),l=require("react-bootstrap"),o=require("../static/Icon.js"),s=e(require("clsx")),i=require("@dnd-kit/core"),c=require("@dnd-kit/sortable"),d=require("@dnd-kit/utilities"),m=require("../modals/confirmation/ConfirmModal.js");require("../modals/dialog/Dialog.js"),require("../modals/dialog/DialogContext.js");var u=require("../product-set/elements/DeleteFieldButton.js"),p={step:"edit-product-step",category:"edit-product-category",product:"edit-product"};exports.ProductSetModalClasses=p,exports.SortableTreeItem=function(e){var b=this,g=e.id,v=e.title,E=e.badge,f=e.subTitle,N=e.body,y=e.children,h=e.preItem,w=e.postItem,C=e.sortableItems,_=e.isExpanded,x=void 0!==_&&_,D=e.isInvalid,S=void 0!==D&&D,q=e.isIconInHeader,M=void 0===q||q,k=e.treeLineIconColor,I=void 0===k?"":k,B=e.modalLabel,j=void 0===B?"":B,P=e.modalClass,T=e.isNewAdded,X=void 0!==T&&T,Y=e.onDelete,A=e.validate,L=e.secondaryBadge,R=e.setIsExpanded,U=t.__read(a.useState(x),2),z=U[0],F=U[1],H=t.__read(a.useState(X),2),K=H[0],V=H[1],O=r.useTranslation("Design").t,G=c.useSortable({id:g}),J=G.attributes,Q=G.listeners,W=G.setNodeRef,Z=G.transform,$=G.transition,ee=t.__read(a.useState({pageX:0,pageY:0}),2),te=ee[0],ae=ee[1],ne=i.useDraggable({id:g}),re=ne.isDragging,le=ne.attributes,oe=ne.listeners,se=ne.setNodeRef,ie=ne.transform,ce=a.useCallback((function(e){var t=e.pageX-te.pageX,a=e.pageY-te.pageY;Math.sqrt(t*t+a*a)>5||(R?R():F((function(e){return!e})))}),[te,R]),de=a.useCallback((function(e){ae({pageX:e.pageX,pageY:e.pageY})}),[]),me=function(){return t.__awaiter(b,void 0,void 0,(function(){return t.__generator(this,(function(e){switch(e.label){case 0:return A||V(!1),[4,null==A?void 0:A()];case 1:return e.sent()&&V(!1),[2]}}))}))};return a.useEffect((function(){F(x)}),[x]),n.createElement("div",t.__assign({className:"sortable-tree-root",style:{transform:d.CSS.Translate.toString(Z),transition:$}},le,oe,{ref:W}),n.createElement("div",t.__assign({className:"sortable-tree-wrapper",ref:se},le,oe,{onKeyDown:function(e){return e.stopPropagation()},onMouseDown:function(e){K&&e.stopPropagation()},onMouseUp:function(e){K&&e.stopPropagation()},role:"button",tabIndex:0,style:P===p.step?{transform:d.CSS.Translate.toString(ie),opacity:re?.7:1}:null}),n.createElement("div",{className:"sortable-tree-line"},n.createElement(l.Button,{variant:"link",size:"sm",onMouseDown:de,onMouseUp:ce},z?n.createElement(o.default,{type:"minus",width:".7rem"}):n.createElement("div",{className:"expand-icon-container"},n.createElement("div",null),n.createElement("div",null),n.createElement("div",null))),z&&n.createElement("svg",{className:"sortable-tree-line-icon",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none"},n.createElement("g",null,n.createElement("path",{className:s("sortable-tree-line-icon-path",I&&"sortable-tree-line-product-element"),style:{stroke:I},d:"M 50 0 V 100"})))),n.createElement("div",{className:"sortable-tree-item-wrapper"},n.createElement("div",{className:s("sortable-tree-item",S?"invalid":"")},n.createElement("div",{className:"sortable-tree-item-header"},M&&n.createElement(l.Button,t.__assign({variant:"link",className:"sortable-tree-item-handle"},J,Q),n.createElement(o.default,{type:"grip-vertical"})),n.createElement(l.Button,{className:"sortable-tree-item-toggle",variant:"link",onMouseDown:de,onMouseUp:ce},E&&n.createElement("span",{className:"sortable-tree-item-badge"},E),n.createElement("div",{className:s(j?"sortable-tree-product-set-title-container":"sortable-tree-title-container")},n.createElement("span",{className:s("sortable-tree-item-title",j&&"sortable-tree-product-set-element-title")},v),!z&&n.createElement("span",{className:"sortable-tree-item-subtitle"},f)),n.createElement("div",{className:"border-0 open-edit-right-modal-button",role:"button",tabIndex:0,onClick:function(e){e.stopPropagation(),V(!0)},onKeyDown:function(e){return e.stopPropagation()}},n.createElement(o.default,{type:"ellipsis-h",color:"#0E8CE2",height:"1rem"})))),M?n.createElement(l.Collapse,{in:z},n.createElement("div",null,n.createElement("div",{className:"sortable-tree-item-body"},N))):n.createElement(l.Modal,{size:"lg",show:K,className:s("m-0 edit-product-set-element-modal edit-right-form-modal h-100",P),dialogClassName:"edit-event-dialog edit-step-dialog",onHide:me},n.createElement("div",{className:"edit-step-modal-header"},n.createElement("button",{className:"p-0 cancel-add-step-btn border-0",type:"button",onClick:me},n.createElement("span",null,O("Design:cancel"))),L&&n.createElement("div",{className:"secondary-badge ".concat(null==L?void 0:L.className)},null==L?void 0:L.label)),n.createElement(l.Modal.Body,{as:"form",noValidate:!0},n.createElement("div",{className:"top-label-container"},n.createElement("span",null,j)),N,n.createElement("div",{className:"d-flex product-set-element-control-btns justify-content-between"},n.createElement(l.Button,{className:"step-save-btn mt-4",type:"button",onClick:me},O("saveAndAdd")),n.createElement("div",{className:"d-flex justify-content-end mt-4 delete-btn"},Boolean(Y)&&n.createElement(m.ConfirmModal,null,(function(e){return n.createElement(u.DeleteFieldButton,{onDelete:function(){return e(Y)}})}))))))),C&&n.createElement("div",{className:"sortable-tree-subitems"},h,n.createElement(i.DndContext,null,n.createElement(c.SortableContext,{items:C,strategy:c.verticalListSortingStrategy},n.createElement(l.Collapse,{in:z},n.createElement("div",{className:"ml-0"},y)))),w))))};
|
|
@@ -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"];
|
|
@@ -28,6 +28,7 @@ import { ProductSetFormValues, WithIsLoading } from "./ProductSetForm";
|
|
|
28
28
|
import { SelectCategoryModal } from "./SelectCategoryModal";
|
|
29
29
|
import { ProductSetLoadingContext } from "./context";
|
|
30
30
|
import { VenueMapSetModal } from "./VenueMapSetModal";
|
|
31
|
+
import { moveArrayElements, sortArrayByIndex } from "../utils";
|
|
31
32
|
// @TODO not for first release
|
|
32
33
|
// import Popover from "./ProductSetFormPopover";
|
|
33
34
|
|
|
@@ -40,7 +41,7 @@ const getCategoryDefaultValue = (
|
|
|
40
41
|
sort: number
|
|
41
42
|
): ProductCategory => ({
|
|
42
43
|
id: null,
|
|
43
|
-
uniqueId:
|
|
44
|
+
uniqueId: uniqueId("product-category"),
|
|
44
45
|
name: "",
|
|
45
46
|
minSubItems: null,
|
|
46
47
|
maxSubItems: null,
|
|
@@ -66,7 +67,11 @@ export function ProductCategoriesControl({
|
|
|
66
67
|
stepIndex,
|
|
67
68
|
}: ProductCategoriesControlProps) {
|
|
68
69
|
const { t } = useTranslation("Design");
|
|
69
|
-
const {
|
|
70
|
+
const {
|
|
71
|
+
providerHasMap,
|
|
72
|
+
expandedProductCategories,
|
|
73
|
+
setExpandedProductCategories,
|
|
74
|
+
} = useContext(ProductSetLoadingContext);
|
|
70
75
|
const form = useFormContext<ProductSetFormValues>();
|
|
71
76
|
const [isSelectCategoryVisible, setIsSelectCategoryVisible] = useState(false);
|
|
72
77
|
const [isVenueMapSetModalVisible, setIsVenueMapSetModalVisible] =
|
|
@@ -78,6 +83,8 @@ export function ProductCategoriesControl({
|
|
|
78
83
|
clearErrors,
|
|
79
84
|
watch,
|
|
80
85
|
trigger,
|
|
86
|
+
getValues,
|
|
87
|
+
setValue,
|
|
81
88
|
} = form;
|
|
82
89
|
|
|
83
90
|
const hasMap: boolean = watch(`steps.${stepIndex}.hasMap` as const) || false;
|
|
@@ -94,8 +101,6 @@ export function ProductCategoriesControl({
|
|
|
94
101
|
Record<number, { price: number; quantity: number }>
|
|
95
102
|
>([]);
|
|
96
103
|
|
|
97
|
-
const isFirstCategoryAdded = fields.length === 1;
|
|
98
|
-
|
|
99
104
|
const productCategories: ProductCategory[] = useWatch({
|
|
100
105
|
control,
|
|
101
106
|
name: productCategoriesFieldName,
|
|
@@ -117,17 +122,39 @@ export function ProductCategoriesControl({
|
|
|
117
122
|
},
|
|
118
123
|
});
|
|
119
124
|
|
|
120
|
-
const handleDragEnd = (
|
|
125
|
+
const handleDragEnd = (event) => {
|
|
121
126
|
// @TODO uncomment when will be fix for change sort index
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
const { active, over } = event;
|
|
128
|
+
|
|
129
|
+
if (!active || !over || !active?.id || !over?.id) return;
|
|
130
|
+
|
|
131
|
+
const prevIndex = fields.findIndex((field) => field._id === active.id);
|
|
132
|
+
const nextIndex = fields.findIndex((field) => field._id === over.id);
|
|
133
|
+
|
|
134
|
+
if (prevIndex === nextIndex) return;
|
|
135
|
+
|
|
136
|
+
const productCategories = getValues(productCategoriesFieldName);
|
|
137
|
+
|
|
138
|
+
if (!productCategories) return;
|
|
139
|
+
|
|
140
|
+
const nextProductCategories = sortArrayByIndex<ProductCategory>(
|
|
141
|
+
moveArrayElements<ProductCategory>(
|
|
142
|
+
productCategories,
|
|
143
|
+
prevIndex,
|
|
144
|
+
nextIndex
|
|
145
|
+
)
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
setValue(productCategoriesFieldName, nextProductCategories);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const setIsExpanded = (productCategoryId: string) => {
|
|
152
|
+
setExpandedProductCategories((prevValues: Record<string, any>) => {
|
|
153
|
+
return {
|
|
154
|
+
...prevValues,
|
|
155
|
+
[productCategoryId]: !prevValues[productCategoryId],
|
|
156
|
+
};
|
|
157
|
+
});
|
|
131
158
|
};
|
|
132
159
|
|
|
133
160
|
useEffect(() => {
|
|
@@ -142,7 +169,9 @@ export function ProductCategoriesControl({
|
|
|
142
169
|
}, 0);
|
|
143
170
|
|
|
144
171
|
setProductCategoryState({
|
|
145
|
-
|
|
172
|
+
// New added categories will have uniqueId
|
|
173
|
+
// but existing have already assigned Id.
|
|
174
|
+
[productCategory?.id || productCategory.uniqueId]: {
|
|
146
175
|
price,
|
|
147
176
|
quantity,
|
|
148
177
|
},
|
|
@@ -150,6 +179,16 @@ export function ProductCategoriesControl({
|
|
|
150
179
|
});
|
|
151
180
|
}, [productCategories]);
|
|
152
181
|
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
if (fields.length !== 1) return;
|
|
184
|
+
|
|
185
|
+
setExpandedProductCategories((prevValues) => ({
|
|
186
|
+
...prevValues,
|
|
187
|
+
[String(fields[0]?.id || fields[0]?.uniqueId)]: true,
|
|
188
|
+
}));
|
|
189
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
190
|
+
}, [fields]);
|
|
191
|
+
|
|
153
192
|
return (
|
|
154
193
|
<>
|
|
155
194
|
<SortableTree
|
|
@@ -158,6 +197,14 @@ export function ProductCategoriesControl({
|
|
|
158
197
|
onDragEnd={handleDragEnd}
|
|
159
198
|
>
|
|
160
199
|
{fields.map((productCategory, index) => {
|
|
200
|
+
const productCategoryId = productCategory?.id
|
|
201
|
+
? String(productCategory.id)
|
|
202
|
+
: productCategory.uniqueId;
|
|
203
|
+
|
|
204
|
+
const onSetIsExpanded = () => {
|
|
205
|
+
setIsExpanded(productCategoryId);
|
|
206
|
+
};
|
|
207
|
+
|
|
161
208
|
return (
|
|
162
209
|
<Controller
|
|
163
210
|
key={`product-category-${productCategory._id}`}
|
|
@@ -172,7 +219,8 @@ export function ProductCategoriesControl({
|
|
|
172
219
|
<SortableTree.Item
|
|
173
220
|
id={productCategory._id}
|
|
174
221
|
title={value}
|
|
175
|
-
isExpanded={
|
|
222
|
+
isExpanded={expandedProductCategories[productCategoryId]}
|
|
223
|
+
setIsExpanded={onSetIsExpanded}
|
|
176
224
|
isInvalid={!!productCategoriesErrors}
|
|
177
225
|
badge={
|
|
178
226
|
<Badge className="category-badge">
|
|
@@ -184,8 +232,9 @@ export function ProductCategoriesControl({
|
|
|
184
232
|
<div className="product-set-badges-container">
|
|
185
233
|
<div className="product-set-subtitle-dot product-set-subtitle-category-dot" />
|
|
186
234
|
<span>
|
|
187
|
-
{productCategoryState[
|
|
188
|
-
?.
|
|
235
|
+
{productCategoryState[
|
|
236
|
+
productCategory?.id ?? productCategory.uniqueId
|
|
237
|
+
]?.quantity ?? "N/A"}{" "}
|
|
189
238
|
{t("products")}
|
|
190
239
|
</span>
|
|
191
240
|
</div>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, {
|
|
2
2
|
PropsWithChildren,
|
|
3
|
+
SetStateAction,
|
|
3
4
|
createContext,
|
|
4
5
|
useEffect,
|
|
5
6
|
useState,
|
|
7
|
+
Dispatch,
|
|
6
8
|
} from "react";
|
|
7
9
|
import { VenueMapSet } from "@licklist/core/dist/DataMapper/Product/VenueMapSetDataMapper";
|
|
8
10
|
// eslint-disable-next-line max-len
|
|
@@ -18,6 +20,10 @@ interface LoadingContext {
|
|
|
18
20
|
venueMapSets?: VenueMapSet[];
|
|
19
21
|
providerHasBookingManagement?: ProviderBookingManagementSetting["hasBookingManagement"];
|
|
20
22
|
zones?: Zone[] | null;
|
|
23
|
+
expandedProductCategories: Record<string, boolean>;
|
|
24
|
+
setExpandedProductCategories: Dispatch<
|
|
25
|
+
SetStateAction<Record<string, boolean>>
|
|
26
|
+
>;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
export const ProductSetLoadingContext = createContext<LoadingContext | null>(
|
|
@@ -25,7 +31,13 @@ export const ProductSetLoadingContext = createContext<LoadingContext | null>(
|
|
|
25
31
|
);
|
|
26
32
|
|
|
27
33
|
type ProductSetContextProviderProps = PropsWithChildren<
|
|
28
|
-
Omit<
|
|
34
|
+
Omit<
|
|
35
|
+
LoadingContext,
|
|
36
|
+
| "isLoading"
|
|
37
|
+
| "setLoading"
|
|
38
|
+
| "expandedProductCategories"
|
|
39
|
+
| "setExpandedProductCategories"
|
|
40
|
+
>
|
|
29
41
|
>;
|
|
30
42
|
|
|
31
43
|
export function ProductSetContextProvider({
|
|
@@ -38,6 +50,9 @@ export function ProductSetContextProvider({
|
|
|
38
50
|
}: ProductSetContextProviderProps) {
|
|
39
51
|
const [zonesState, setZonesState] = useState<Zone[] | undefined>(undefined);
|
|
40
52
|
const [loading, setLoading] = useState(false);
|
|
53
|
+
const [expandedProductCategories, setExpandedProductCategories] = useState<
|
|
54
|
+
Record<string, boolean>
|
|
55
|
+
>({});
|
|
41
56
|
|
|
42
57
|
useEffect(() => setZonesState(zones), [zones]);
|
|
43
58
|
|
|
@@ -51,6 +66,8 @@ export function ProductSetContextProvider({
|
|
|
51
66
|
venueMapSets,
|
|
52
67
|
providerHasBookingManagement,
|
|
53
68
|
zones: zonesState,
|
|
69
|
+
expandedProductCategories,
|
|
70
|
+
setExpandedProductCategories,
|
|
54
71
|
}}
|
|
55
72
|
>
|
|
56
73
|
{children}
|
|
@@ -22,7 +22,7 @@ import { ProductSetLoadingContext } from "../form/context";
|
|
|
22
22
|
|
|
23
23
|
export interface ProductCategoryControlValues extends FormValues {
|
|
24
24
|
id: number;
|
|
25
|
-
uniqueId?:
|
|
25
|
+
uniqueId?: string;
|
|
26
26
|
name: string;
|
|
27
27
|
minSubItems: number | null;
|
|
28
28
|
maxSubItems: number | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const moveArrayElements = <T>(
|
|
2
|
+
array: T[],
|
|
3
|
+
prevIndex: number,
|
|
4
|
+
nextIndex: number
|
|
5
|
+
) => {
|
|
6
|
+
const nextArray = [...array];
|
|
7
|
+
// We move there elements in array
|
|
8
|
+
// by set and change indexes
|
|
9
|
+
nextArray.splice(nextIndex, 0, nextArray.splice(prevIndex, 1)[0]);
|
|
10
|
+
|
|
11
|
+
return nextArray;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const sortArrayByIndex = <T>(array: T[]) => {
|
|
15
|
+
return array.map((element: T, index) => ({ ...element, sort: index }));
|
|
16
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode, useCallback, useState } from "react";
|
|
1
|
+
import React, { ReactNode, useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { DndContext, useDraggable } from "@dnd-kit/core";
|
|
3
3
|
import {
|
|
4
4
|
SortableContext,
|
|
@@ -48,6 +48,7 @@ export interface SortableTreeItemProps {
|
|
|
48
48
|
label: string;
|
|
49
49
|
className: string;
|
|
50
50
|
};
|
|
51
|
+
setIsExpanded?: () => void;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
export function SortableTreeItem({
|
|
@@ -70,6 +71,7 @@ export function SortableTreeItem({
|
|
|
70
71
|
onDelete,
|
|
71
72
|
validate,
|
|
72
73
|
secondaryBadge,
|
|
74
|
+
setIsExpanded,
|
|
73
75
|
}: SortableTreeItemProps) {
|
|
74
76
|
const [expanded, setExpanded] = useState(isExpanded);
|
|
75
77
|
const [isModalVisible, setIsModalVisible] = useState(isNewAdded);
|
|
@@ -102,9 +104,14 @@ export function SortableTreeItem({
|
|
|
102
104
|
return;
|
|
103
105
|
}
|
|
104
106
|
|
|
107
|
+
if (setIsExpanded) {
|
|
108
|
+
setIsExpanded();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
105
112
|
setExpanded((expanded) => !expanded);
|
|
106
113
|
},
|
|
107
|
-
[position]
|
|
114
|
+
[position, setIsExpanded]
|
|
108
115
|
);
|
|
109
116
|
|
|
110
117
|
const onButtonMouseDown = useCallback((event) => {
|
|
@@ -118,6 +125,10 @@ export function SortableTreeItem({
|
|
|
118
125
|
if (success) setIsModalVisible(false);
|
|
119
126
|
};
|
|
120
127
|
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
setExpanded(isExpanded);
|
|
130
|
+
}, [isExpanded]);
|
|
131
|
+
|
|
121
132
|
return (
|
|
122
133
|
<div
|
|
123
134
|
className="sortable-tree-root"
|
|
@@ -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
|
}
|