@licklist/design 0.48.0-dev.1 → 0.48.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AAEvF,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAEtE,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAef,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAO9D,OAAO,EAEL,oCAAoC,EACpC,qCAAqC,EACtC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,2BAA2B,EAC3B,qCAAqC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CACpC,SAAQ,gBAAgB,EACtB,mBAAmB,CAAC,CAAC,CAAC,EACtB,oCAAoC,CAAC,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,EACnD,SAAiB,EACjB,eAAe,EACf,aAAqB,EACrB,oBAA4B,EAC5B,QAAa,EACb,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,GACb,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA+hBxB"}
1
+ {"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AAEvF,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAEtE,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAef,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAO9D,OAAO,EAEL,oCAAoC,EACpC,qCAAqC,EACtC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,2BAA2B,EAC3B,qCAAqC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CACpC,SAAQ,gBAAgB,EACtB,mBAAmB,CAAC,CAAC,CAAC,EACtB,oCAAoC,CAAC,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,EACnD,SAAiB,EACjB,eAAe,EACf,aAAqB,EACrB,oBAA4B,EAC5B,QAAa,EACb,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,GACb,EAAE,mBAAmB,CAAC,CAAC,CAAC,eAmkBxB"}
@@ -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"),n=e(a),r=require("react-i18next"),o=e(require("react-bootstrap/Row")),l=e(require("react-bootstrap/Col")),i=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),d=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@react-aria/utils"),m=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var p=require("../form/context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),C=require("./booking-management/ProductBookingManagementControl.js"),f=require("./deposit/ProductDepositControl.js"),v=require("./quantity/ProductQuantityControl.js"),b=require("./quantity/ProductQuantityConstantControl.js"),h=require("./quantity/ProductQuantityRechargingControl.js"),I=e(require("react-bootstrap/Collapse")),F=require("@licklist/plugins/dist/hooks/Media/useImages"),P=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),N=require("../../file-upload/FileUpload.js"),q=require("../../tiptap-editor/TipTapEditor.js"),y=require("./fixed-duration-fields/FixedDurationOptions.js"),T=require("./duration/ProductDurationControl.js"),_=require("./price/ProductPriceControl.js"),k=require("./constants.js");exports.ProductControl=function(e){var x=e.isLoading,A=void 0!==x&&x,L=e.fieldNamePrefix,R=e.allowDeposits,S=void 0!==R&&R,j=e.hasBookingManagement,w=void 0!==j&&j,D=e.zoneList,G=void 0===D?[]:D,M=e.onCopy,O=e.onProductNameChange,B=e.productName,U=e.hasTicket,Y=e.categoryType,V=e.zoneDuration,Q=s.useFormContext(),H=Q.register,X=Q.control,z=Q.formState.errors,W=Q.setValue,Z=Q.getValues,J=Q.watch,K=a.useContext(p.ProductSetLoadingContext),$=K.setLoading,ee=K.providerHasBookingManagement,te=r.useTranslation(["Design","Validation"]).t,ae=t.__read(a.useState(!1),2),ne=ae[0],re=ae[1],oe=t.__read(a.useState(null),2),le=oe[0],ie=oe[1],ce=Boolean(J("".concat(L,".isUnlimited"))),se=u.useId(),de=u.useId(),ue=u.useId(),me=u.useId(),Ee=u.useId(),pe=u.useId(),ge=u.useId(),Ce=u.useId(),fe=u.useId(),ve=u.useId(),be=u.useId(),he=[{id:1,value:te("quantitySelector")},{id:2,value:te("stockControl")}],Ie=a.useCallback((function(){return re((function(e){return!e}))}),[]),Fe=s.useWatch({control:X,name:"".concat(L,".quantitySelector")}),Pe=F.useImages(le),Ne=Pe.images,qe=Pe.handleImageRemove,ye=Pe.handleImageUploading,Te=Pe.isLoading,_e=a.useCallback((function(e){ye(e,P.IMAGE_TYPE_IMAGE)}),[ye]),ke=a.useCallback((function(e,t){qe(String(e),t)}),[qe]),xe=function(e){return e.target.select()};a.useEffect((function(){$(Te)}),[$,Te]),a.useEffect((function(){var e=Z("".concat(L,".images"));ie(e)}),[Z,ie,L]),a.useEffect((function(){Array.isArray(Ne)&&W("".concat(L,".images"),Ne)}),[Ne,L,W]);var Ae=null!=Fe?Fe:"1",Le=g.QUANTITY_TYPE_LIST_DTO[Ae];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:de},n.createElement(i.Form.Label,null,te("name")),n.createElement(i.Form.Control,t.__assign({},H("".concat(L,".name")),{value:B,onChange:O,isInvalid:d.isInvalid("".concat(L,".name"),z),disabled:A,placeholder:te("name")})),n.createElement(i.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".name"),z))),n.createElement(i.Form.Group,{controlId:ue},n.createElement(i.Form.Label,null,te("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(q.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:A})},rules:{maxLength:{value:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH,message:te("Validation:descriptionTooManyCharactersMessage",{max:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH})}},control:X,name:"".concat(L,".description")})),n.createElement("div",{className:"invalid-feedback field-values-error d-block"},d.getErrors("".concat(L,".description"),z)),S?n.createElement(o,null,n.createElement(f.ProductDepositControl,{isLoading:A,fieldNamePrefix:L}),n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price"),title:te("totalPrice"),allowDeposits:S})):n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price")}),n.createElement("div",null,n.createElement(v.ProductQuantityControl,{isLoading:A,fieldNamePrefix:L,onFocus:xe}),Le===g.QUANTITY_TYPE_CONSTANT&&n.createElement(b.ProductQuantityConstantControl,{isLoading:A,fieldNamePrefix:L,onFocus:xe,disabled:ce}),Le===g.QUANTITY_TYPE_RECHARGING&&n.createElement(h.ProductQuantityRechargingControl,{isLoading:A,fieldNamePrefix:L,onFocus:xe,disabled:ce}),n.createElement(i.Form.Group,{controlId:ve,className:"custom-checkbox"},n.createElement(i.Form.Check,t.__assign({custom:!0,type:"checkbox"},H("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:A})),n.createElement(i.Form.Check.Label,null,te("isUnlimited")))),n.createElement(i.Form.Group,{controlId:Ce},n.createElement(i.Form.Label,null,te("quantitySelectorType")),n.createElement(i.Form.Control,t.__assign({as:"select",defaultValue:U?he[0].id:void 0},H("".concat(L,".quantitySelector")),{isInvalid:d.isInvalid("".concat(L,".quantitySelector"),z),disabled:A||U}),he.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(i.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".quantitySelector"),z))))),Y===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start"},n.createElement(T.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:ee}),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:te("capacity"),rules:{min:{value:1,message:te("Validation:fieldRequired",{attribute:te("capacity")})}}}))),Y===g.CATEGORY_TYPE_GAME&&n.createElement(o,{className:"align-items-start"},n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:te("capacity"),onChange:function(e){V&&W("".concat(L,".duration"),e*V)},rules:{required:te("Validation:fieldRequired",{attribute:te("capacity")}),min:{value:1,message:te("Validation:fieldRequired",{attribute:te("capacity")})}}})),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:te("durationMinutes"),rules:{required:te("Validation:fieldRequired",{attribute:te("capacity")}),min:{value:1,message:te("Validation:fieldRequired",{attribute:te("capacity")})}}}))),n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:me},n.createElement(i.Form.Label,null,te("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,l=t.ref;return n.createElement(i.Form.Control,{ref:l,as:"textarea",rows:3,value:a,onChange:r,isInvalid:d.isInvalid("".concat(L,".termsAndConditions"),z),disabled:A,name:o})},control:X,name:"".concat(L,".termsAndConditions")}),n.createElement(i.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".termsAndConditions"),z)))),n.createElement(l,{lg:4,md:4,className:"licklist-file-upload-wrapper"},n.createElement(N.FileUpload,{onFilesChange:_e,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:ke,defaultFiles:Ne,isLoading:Te,withIcon:!0,title:te("addImage")}))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(i.Form.Group,{controlId:Ee,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,te("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(m.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isAvailable")})),n.createElement(i.Form.Group,{controlId:pe,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,te("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(m.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isSoldOut")})),n.createElement(i.Form.Group,{controlId:se,className:"custom-checkbox"},n.createElement(i.Form.Check,{custom:!0,type:"checkbox",name:se,disabled:A},n.createElement(i.Form.Check.Input,{checked:ne,onChange:Ie,type:"checkbox"}),n.createElement(i.Form.Check.Label,null,te("showAdvancedOptions"))))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(I,{in:ne},n.createElement("div",null,n.createElement(i.Form.Group,{controlId:ge,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,te("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(m.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isRequired")})),n.createElement(i.Form.Group,{controlId:fe,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,te("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(m.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".hasSpecialNotes")})),[g.CATEGORY_TYPE_GAME,g.CATEGORY_TYPE_FIXED_DURATION].includes(Y)&&n.createElement(y.FixedDurationOptions,{fieldNamePrefix:L}),n.createElement(i.Form.Group,{controlId:be,className:"advanced-switch-container"},n.createElement(_.ProductPriceControl,{title:te("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:A,fieldNamePrefix:"".concat(L,".minSpend")})))),n.createElement(o,null,n.createElement(l,{xs:12},w&&n.createElement(C.ProductBookingManagementControl,{isLoading:A,zoneList:G,fieldNamePrefix:L})))),n.createElement(o,null,n.createElement(l,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(M)&&n.createElement(i.Button,{onClick:M,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",te("copy"))))))};
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"),o=e(require("react-bootstrap/Row")),i=e(require("react-bootstrap/Col")),l=require("react-bootstrap"),c=require("../../static/Icon.js"),s=require("react-hook-form"),d=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@react-aria/utils"),m=require("../../static/switch/BooleanSwitch.js"),E=require("../../static/form-number-input/FormNumberInput.js");require("../../static/index.js");var p=require("../form/context.js"),g=require("@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper"),f=require("./booking-management/ProductBookingManagementControl.js"),C=require("./deposit/ProductDepositControl.js"),v=require("./quantity/ProductQuantityControl.js"),b=require("./quantity/ProductQuantityConstantControl.js"),h=require("./quantity/ProductQuantityRechargingControl.js"),I=e(require("react-bootstrap/Collapse")),N=require("@licklist/plugins/dist/hooks/Media/useImages"),F=require("@licklist/core/dist/DataMapper/Media/ImageDataMapper"),P=require("../../file-upload/FileUpload.js"),y=require("../../tiptap-editor/TipTapEditor.js"),T=require("./fixed-duration-fields/FixedDurationOptions.js"),q=require("./duration/ProductDurationControl.js"),_=require("./price/ProductPriceControl.js"),k=require("./constants.js");exports.ProductControl=function(e){var x=e.isLoading,A=void 0!==x&&x,L=e.fieldNamePrefix,S=e.allowDeposits,D=void 0!==S&&S,M=e.hasBookingManagement,R=void 0!==M&&M,j=e.zoneList,w=void 0===j?[]:j,G=e.onCopy,O=e.onProductNameChange,B=e.productName,U=e.hasTicket,Y=e.categoryType,Q=e.zoneDuration,V=s.useFormContext(),H=V.register,X=V.control,z=V.formState.errors,W=V.setValue,Z=V.getValues,J=V.watch,K=V.trigger,$=V.clearErrors,ee=a.useContext(p.ProductSetLoadingContext),te=ee.setLoading,ae=ee.providerHasBookingManagement,ne=r.useTranslation(["Design","Validation"]).t,re=t.__read(a.useState(!1),2),oe=re[0],ie=re[1],le=t.__read(a.useState(null),2),ce=le[0],se=le[1],de=Boolean(J("".concat(L,".isUnlimited"))),ue=J("".concat(L,".capacity")),me="0"===ue||!ue,Ee=u.useId(),pe=u.useId(),ge=u.useId(),fe=u.useId(),Ce=u.useId(),ve=u.useId(),be=u.useId(),he=u.useId(),Ie=u.useId(),Ne=u.useId(),Fe=u.useId(),Pe=[{id:1,value:ne("quantitySelector")},{id:2,value:ne("stockControl")}],ye=a.useCallback((function(){return ie((function(e){return!e}))}),[]),Te=s.useWatch({control:X,name:"".concat(L,".quantitySelector")}),qe=N.useImages(ce),_e=qe.images,ke=qe.handleImageRemove,xe=qe.handleImageUploading,Ae=qe.isLoading,Le=a.useCallback((function(e){xe(e,F.IMAGE_TYPE_IMAGE)}),[xe]),Se=a.useCallback((function(e,t){ke(String(e),t)}),[ke]),De=function(e){return e.target.select()};a.useEffect((function(){te(Ae)}),[te,Ae]),a.useEffect((function(){var e=Z("".concat(L,".images"));se(e)}),[Z,se,L]),a.useEffect((function(){Array.isArray(_e)&&W("".concat(L,".images"),_e)}),[_e,L,W]),a.useEffect((function(){me?(W("".concat(L,".duration"),0),$("".concat(L,".duration"))):K("".concat(L,".duration"))}),[me]);var Me=null!=Te?Te:"1",Re=g.QUANTITY_TYPE_LIST_DTO[Me];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(i,{lg:8,md:8},n.createElement(l.Form.Group,{controlId:pe},n.createElement(l.Form.Label,null,ne("name")),n.createElement(l.Form.Control,t.__assign({},H("".concat(L,".name")),{value:B,onChange:O,isInvalid:d.isInvalid("".concat(L,".name"),z),disabled:A,placeholder:ne("name")})),n.createElement(l.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".name"),z))),n.createElement(l.Form.Group,{controlId:ge},n.createElement(l.Form.Label,null,ne("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(y.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:A})},rules:{maxLength:{value:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH,message:ne("Validation:descriptionTooManyCharactersMessage",{max:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH})}},control:X,name:"".concat(L,".description")})),n.createElement("div",{className:"invalid-feedback field-values-error d-block"},d.getErrors("".concat(L,".description"),z)),D?n.createElement(o,null,n.createElement(C.ProductDepositControl,{isLoading:A,fieldNamePrefix:L}),n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price"),title:ne("totalPrice"),allowDeposits:D})):n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price")}),n.createElement("div",null,n.createElement(v.ProductQuantityControl,{isLoading:A,fieldNamePrefix:L,onFocus:De}),Re===g.QUANTITY_TYPE_CONSTANT&&n.createElement(b.ProductQuantityConstantControl,{isLoading:A,fieldNamePrefix:L,onFocus:De,disabled:de}),Re===g.QUANTITY_TYPE_RECHARGING&&n.createElement(h.ProductQuantityRechargingControl,{isLoading:A,fieldNamePrefix:L,onFocus:De,disabled:de}),n.createElement(l.Form.Group,{controlId:Ne,className:"custom-checkbox"},n.createElement(l.Form.Check,t.__assign({custom:!0,type:"checkbox"},H("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:A})),n.createElement(l.Form.Check.Label,null,ne("isUnlimited")))),n.createElement(l.Form.Group,{controlId:he},n.createElement(l.Form.Label,null,ne("quantitySelectorType")),n.createElement(l.Form.Control,t.__assign({as:"select",defaultValue:U?Pe[0].id:void 0},H("".concat(L,".quantitySelector")),{isInvalid:d.isInvalid("".concat(L,".quantitySelector"),z),disabled:A||U}),Pe.map((function(e){return n.createElement("option",{value:e.id,key:e.id},e.value)}))),n.createElement(l.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".quantitySelector"),z))))),Y===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start duration-capacity-container"},n.createElement(q.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:ae,disabled:me}),n.createElement(i,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:ne("capacity"),rules:{min:{value:0,message:ne("Validation:fieldMinNumber",{attribute:ne("capacity"),min:0})}}})),me&&n.createElement("div",{className:"duration-hint duration-capacity-container"},ne("Design:forDurationEditing"))),Y===g.CATEGORY_TYPE_GAME&&n.createElement(n.Fragment,null,n.createElement(o,{className:"align-items-start duration-capacity-container"},n.createElement(i,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:ne("capacity"),onChange:function(e){Q&&W("".concat(L,".duration"),e*Q)},rules:{min:{value:0,message:ne("Validation:fieldMinNumber",{attribute:ne("capacity"),min:1})}}})),n.createElement(i,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:ne("durationMinutes"),disabled:me,rules:{min:{value:0,message:ne("Validation:fieldMinNumber",{attribute:ne("duration"),min:0})},validate:function(e){return!(!me&&(!e||e<1))||ne("Validation:fieldRequired",{attribute:ne("duration")})}}}))),me&&n.createElement("div",{className:"duration-hint pl-0"},ne("Design:forDurationEditing"))),n.createElement(o,{className:"mt-4"},n.createElement(i,{lg:8,md:8},n.createElement(l.Form.Group,{controlId:fe},n.createElement(l.Form.Label,null,ne("productTermsConditions")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name,i=t.ref;return n.createElement(l.Form.Control,{ref:i,as:"textarea",rows:3,value:a,onChange:r,isInvalid:d.isInvalid("".concat(L,".termsAndConditions"),z),disabled:A,name:o})},control:X,name:"".concat(L,".termsAndConditions")}),n.createElement(l.Form.Control.Feedback,{type:"invalid"},d.getErrors("".concat(L,".termsAndConditions"),z)))),n.createElement(i,{lg:4,md:4,className:"licklist-file-upload-wrapper"},n.createElement(P.FileUpload,{onFilesChange:Le,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:Se,defaultFiles:_e,isLoading:Ae,withIcon:!0,title:ne("addImage")}))),n.createElement(i,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(l.Form.Group,{controlId:Ce,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ne("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(m.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isAvailable")})),n.createElement(l.Form.Group,{controlId:ve,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ne("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(m.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isSoldOut")})),n.createElement(l.Form.Group,{controlId:Ee,className:"custom-checkbox"},n.createElement(l.Form.Check,{custom:!0,type:"checkbox",name:Ee,disabled:A},n.createElement(l.Form.Check.Input,{checked:oe,onChange:ye,type:"checkbox"}),n.createElement(l.Form.Check.Label,null,ne("showAdvancedOptions"))))),n.createElement(i,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(I,{in:oe},n.createElement("div",null,n.createElement(l.Form.Group,{controlId:be,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ne("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(m.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isRequired")})),n.createElement(l.Form.Group,{controlId:Ie,className:"advanced-switch-container"},n.createElement(l.Form.Label,null,ne("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(m.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".hasSpecialNotes")})),[g.CATEGORY_TYPE_GAME,g.CATEGORY_TYPE_FIXED_DURATION].includes(Y)&&n.createElement(T.FixedDurationOptions,{fieldNamePrefix:L}),n.createElement(l.Form.Group,{controlId:Fe,className:"advanced-switch-container"},n.createElement(_.ProductPriceControl,{title:ne("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:A,fieldNamePrefix:"".concat(L,".minSpend")})))),n.createElement(o,null,n.createElement(i,{xs:12},R&&n.createElement(f.ProductBookingManagementControl,{isLoading:A,zoneList:w,fieldNamePrefix:L})))),n.createElement(o,null,n.createElement(i,{xs:!0},n.createElement("div",{className:"d-flex justify-content-end mt-4"},Boolean(G)&&n.createElement(l.Button,{onClick:G,variant:"link",className:"d-flex align-items-center"},n.createElement(c.default,{type:"clipboard",height:"1rem",className:"mr-2"})," ",ne("copy"))))))};
@@ -2,6 +2,7 @@
2
2
  import { FieldNamePrefixPath } from "@licklist/plugins/dist/types/services/Form/hook-form-service";
3
3
  export interface ProductDurationControlProps<T> extends FieldNamePrefixPath<T> {
4
4
  providerHasBookingManagement: boolean;
5
+ disabled: boolean;
5
6
  }
6
- export declare const ProductDurationControl: <T>({ fieldNamePrefix, providerHasBookingManagement, }: ProductDurationControlProps<T>) => JSX.Element;
7
+ export declare const ProductDurationControl: <T>({ fieldNamePrefix, providerHasBookingManagement, disabled, }: ProductDurationControlProps<T>) => JSX.Element;
7
8
  //# sourceMappingURL=ProductDurationControl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductDurationControl.d.ts","sourceRoot":"","sources":["../../../../src/product-set/product/duration/ProductDurationControl.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAC;AAQnG,MAAM,WAAW,2BAA2B,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC5E,4BAA4B,EAAE,OAAO,CAAC;CACvC;AAED,eAAO,MAAM,sBAAsB,wGAoIlC,CAAC"}
1
+ {"version":3,"file":"ProductDurationControl.d.ts","sourceRoot":"","sources":["../../../../src/product-set/product/duration/ProductDurationControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAC;AAOnG,MAAM,WAAW,2BAA2B,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC5E,4BAA4B,EAAE,OAAO,CAAC;IACtC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,sBAAsB,kHAsIlC,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=e(require("react")),r=require("react-i18next"),n=require("react-bootstrap"),o=require("react-hook-form"),a=e(require("@licklist/plugins/dist/services/Form/HookFormService")),l=require("@react-aria/utils"),u=require("../../../assets/dashboard/increment.svg.js");exports.ProductDurationControl=function(e){var i=e.fieldNamePrefix,c=e.providerHasBookingManagement,s=r.useTranslation("Design").t,m=l.useId(),d=l.useId(),p=o.useFormContext(),f=p.control,E=p.formState.errors,v=p.setValue,b="".concat(i,".duration"),g=function(e){return v(b,e)},F=o.useWatch({control:f,name:b}),C=Math.floor(F/60),I=F%60,N=function(e){g(60*e+I)},q=function(e){g(60*C+(e>59?59:e))},x=a.isInvalid(b,E),h=function(e){return e.target.select()};return t.createElement(o.Controller,{control:f,name:b,rules:{required:{value:Boolean(c),message:s("Validation:fieldRequired",{attribute:s("duration")})},min:{value:1,message:s("Validation:fieldMinNumber",{attribute:s("duration")})}},render:function(e){var r=e.field;return t.createElement(t.Fragment,null,t.createElement(n.Col,{lg:4,md:4,sm:6},t.createElement(n.Form.Group,{controlId:m,className:"position-relative"},t.createElement(n.Form.Label,null,s("durationHours")),t.createElement(n.InputGroup,{hasValidation:!0},t.createElement(n.InputGroup.Prepend,{className:"arrow-up-btn",onClick:function(){return N(C+1)}},t.createElement(n.InputGroup.Text,{className:"py-0 px-3"},t.createElement(u.ReactComponent,null))),t.createElement(n.Form.Control,{type:"number",min:0,step:1,value:C,isInvalid:x,onChange:function(e){return N(Number(e.target.value))},ref:r.ref,onFocus:h}),t.createElement(n.Form.Control.Feedback,{type:"invalid"},a.getErrors(b,E))))),t.createElement(n.Col,{lg:4,md:4,sm:6},t.createElement(n.Form.Group,{controlId:d,className:"position-relative"},t.createElement(n.Form.Label,null,s("durationMinutes")),t.createElement(n.InputGroup,{hasValidation:!0},t.createElement(n.InputGroup.Prepend,{className:"arrow-up-btn",onClick:function(){return q(I+1)}},t.createElement(n.InputGroup.Text,{className:"py-0 px-3"},t.createElement(u.ReactComponent,null))),t.createElement(n.Form.Control,{type:"number",min:0,step:1,value:I,isInvalid:x,onChange:function(e){return q(Number(e.target.value))},onFocus:h}),t.createElement(n.Form.Control.Feedback,{type:"invalid"},a.getErrors(b,E))))))}})};
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=e(require("react")),r=require("react-i18next"),n=require("react-bootstrap"),a=require("react-hook-form"),o=e(require("@licklist/plugins/dist/services/Form/HookFormService")),l=require("@react-aria/utils"),u=require("../../../assets/dashboard/increment.svg.js");exports.ProductDurationControl=function(e){var i=e.fieldNamePrefix,c=e.providerHasBookingManagement,s=e.disabled,m=r.useTranslation("Design").t,d=l.useId(),p=l.useId(),f=a.useFormContext(),E=f.control,v=f.formState.errors,b=f.setValue,g="".concat(i,".duration"),F=function(e){return b(g,e,{shouldValidate:!0})},C=a.useWatch({control:E,name:g}),I=Math.floor(C/60),N=C%60,h=function(e){F(60*e+N)},q=function(e){F(60*I+(e>59?59:e))},x=o.isInvalid(g,v),k=function(e){return e.target.select()};return t.createElement(a.Controller,{control:E,name:g,rules:{required:{value:Boolean(c),message:m("Validation:fieldRequired",{attribute:m("duration")})},min:{value:1,message:m("Validation:fieldMinNumber",{attribute:m("duration")})}},render:function(e){var r=e.field;return t.createElement(t.Fragment,null,t.createElement(n.Col,{lg:4,md:4,sm:6},t.createElement(n.Form.Group,{controlId:d,className:"position-relative"},t.createElement(n.Form.Label,null,m("durationHours")),t.createElement(n.InputGroup,{hasValidation:!0},t.createElement(n.InputGroup.Prepend,{className:"arrow-up-btn",onClick:function(){return h(I+1)}},t.createElement(n.InputGroup.Text,{className:"py-0 px-3"},t.createElement(u.ReactComponent,null))),t.createElement(n.Form.Control,{type:"number",min:0,step:1,value:I,disabled:s,isInvalid:x,onChange:function(e){return h(Number(e.target.value))},ref:r.ref,onFocus:k}),t.createElement(n.Form.Control.Feedback,{type:"invalid"},o.getErrors(g,v))))),t.createElement(n.Col,{lg:4,md:4,sm:6},t.createElement(n.Form.Group,{controlId:p,className:"position-relative"},t.createElement(n.Form.Label,null,m("durationMinutes")),t.createElement(n.InputGroup,{hasValidation:!0},t.createElement(n.InputGroup.Prepend,{className:"arrow-up-btn",onClick:function(){return q(N+1)}},t.createElement(n.InputGroup.Text,{className:"py-0 px-3"},t.createElement(u.ReactComponent,null))),t.createElement(n.Form.Control,{type:"number",min:0,step:1,disabled:s,value:N,isInvalid:x,onChange:function(e){return q(Number(e.target.value))},onFocus:k}),t.createElement(n.Form.Control.Feedback,{type:"invalid"},o.getErrors(g,v))))))}})};
@@ -6,9 +6,10 @@ export interface ManualBookingSummaryProps {
6
6
  orders: ManualBookingOrder[];
7
7
  ordersSum: number;
8
8
  orderSumIncludingFee?: number | null;
9
+ hasBookingCategory: boolean;
9
10
  isFeeFetching: boolean;
10
11
  orderDate: string;
11
12
  relyOnPeopleType?: RelyOnPeopleType | null;
12
13
  }
13
- export declare const ManualBookingSummary: ({ eventName, orders, ordersSum, orderSumIncludingFee, isFeeFetching, orderDate, relyOnPeopleType, }: ManualBookingSummaryProps) => JSX.Element;
14
+ export declare const ManualBookingSummary: ({ eventName, orders, ordersSum, orderSumIncludingFee, isFeeFetching, orderDate, relyOnPeopleType, hasBookingCategory, }: ManualBookingSummaryProps) => JSX.Element;
14
15
  //# sourceMappingURL=ManualBookingSummary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ManualBookingSummary.d.ts","sourceRoot":"","sources":["../../../../src/sales/manual-booking/summary/ManualBookingSummary.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+DAA+D,CAAC;AAQnG,OAAO,EAEL,gBAAgB,EACjB,MAAM,6DAA6D,CAAC;AAIrE,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,oBAAoB,wGAQ9B,yBAAyB,gBAiF3B,CAAC"}
1
+ {"version":3,"file":"ManualBookingSummary.d.ts","sourceRoot":"","sources":["../../../../src/sales/manual-booking/summary/ManualBookingSummary.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+DAA+D,CAAC;AAQnG,OAAO,EAEL,gBAAgB,EACjB,MAAM,6DAA6D,CAAC;AAIrE,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,oBAAoB,4HAS9B,yBAAyB,gBAkF3B,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,a=require("@licklist/core/dist/Config");require("../../../static/loader/LoaderIndicator.js");var l=require("../../../static/loader/BlockLoader.js"),n=require("react-i18next");require("../../../static/loader/ButtonLoader.js"),require("../../../static/loader/SnippetLoader.js"),require("../../../static/loader/PaymentLoader.js");var c=require("luxon"),i=require("@licklist/core/dist/DataMapper/Product/ProductSetDataMapper"),m=require("react-intl"),o=require("@licklist/plugins/dist/utils/relyOnPeople");exports.ManualBookingSummary=function(e){var t=e.eventName,s=e.orders,u=e.ordersSum,d=e.orderSumIncludingFee,y=e.isFeeFetching,p=e.orderDate,v=e.relyOnPeopleType,E=n.useTranslation(["Design","Sale"]).t,N=m.useIntl().formatNumber,q=v&&v!==i.RELY_ON_PEOPLE_QUANTITY,O=c.DateTime.fromISO(p),P=O.toFormat(a.DATE_TIME_MANUAL_BOOKING_FORMAT),g=O.toFormat(a.TIME_FORMAT);return r.createElement("div",{className:"manual-booking-summary"},r.createElement("div",{className:"receipt-title"},E("Sale:receipt")),r.createElement("div",{className:"event-name border-summary-item"},t),r.createElement("div",{className:"border-summary-item"},P),r.createElement("div",{className:"border-summary-item"},g),s.length>0?r.createElement("div",{className:"summary-item-container"},s.map((function(e){var t=o.getRelyOnPeopleMultiplier({relyOnPeopleType:v,capacity:null==e?void 0:e.capacity});return r.createElement("div",{key:e.id,className:"d-flex justify-content-between border-summary-item"},r.createElement("div",null,e.name),q&&t&&r.createElement("div",null,"x ".concat(e.quantity*t," ").concat(E("people"))),r.createElement("div",null,N(e.quantity*e.price,{style:"currency",currency:a.Currency.GBP})))})),r.createElement("div",null,r.createElement("div",{className:"total-container"},r.createElement("div",null,E("Sale:total")),r.createElement("div",{className:"total-amount"},N(u,{style:"currency",currency:a.Currency.GBP}))),d&&r.createElement("div",{className:"total-container ".concat(y?"mt-6":"mt-4")},y||!d?r.createElement(l.BlockLoader,null):r.createElement(r.Fragment,null,r.createElement("div",null,E("Sale:includingOperationalCost")),r.createElement("div",{className:"total-amount"},N(d,{style:"currency",currency:a.Currency.GBP})))))):r.createElement("div",{className:"cart-items"},r.createElement("p",{className:"empty-cart"},E("Design:emptyBasket"))))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,a=require("@licklist/core/dist/Config");require("../../../static/loader/LoaderIndicator.js");var l=require("../../../static/loader/BlockLoader.js"),n=require("react-i18next");require("../../../static/loader/ButtonLoader.js"),require("../../../static/loader/SnippetLoader.js"),require("../../../static/loader/PaymentLoader.js");var c=require("luxon"),i=require("@licklist/core/dist/DataMapper/Product/ProductSetDataMapper"),o=require("react-intl"),m=require("@licklist/plugins/dist/utils/relyOnPeople");exports.ManualBookingSummary=function(e){var t=e.eventName,s=e.orders,u=e.ordersSum,d=e.orderSumIncludingFee,y=e.isFeeFetching,p=e.orderDate,v=e.relyOnPeopleType,E=e.hasBookingCategory,N=n.useTranslation(["Design","Sale"]).t,g=o.useIntl().formatNumber,q=v&&v!==i.RELY_ON_PEOPLE_QUANTITY,O=c.DateTime.fromISO(p),P=O.toFormat(a.DATE_TIME_MANUAL_BOOKING_FORMAT),f=O.toFormat(a.TIME_FORMAT);return r.createElement("div",{className:"manual-booking-summary"},r.createElement("div",{className:"receipt-title"},N("Sale:receipt")),r.createElement("div",{className:"event-name border-summary-item"},t),r.createElement("div",{className:"border-summary-item"},P),r.createElement("div",{className:"border-summary-item"},f),s.length>0?r.createElement("div",{className:"summary-item-container"},s.map((function(e){var t=m.getRelyOnPeopleMultiplier({relyOnPeopleType:v,capacity:null==e?void 0:e.capacity,hasBookingCategory:E});return r.createElement("div",{key:e.id,className:"d-flex justify-content-between border-summary-item"},r.createElement("div",null,e.name),q&&!!t&&r.createElement("div",null,"x ".concat(e.quantity*t," ").concat(N("people"))),r.createElement("div",null,g(e.quantity*e.price,{style:"currency",currency:a.Currency.GBP})))})),r.createElement("div",null,r.createElement("div",{className:"total-container"},r.createElement("div",null,N("Sale:total")),r.createElement("div",{className:"total-amount"},g(u,{style:"currency",currency:a.Currency.GBP}))),d&&r.createElement("div",{className:"total-container ".concat(y?"mt-6":"mt-4")},y||!d?r.createElement(l.BlockLoader,null):r.createElement(r.Fragment,null,r.createElement("div",null,N("Sale:includingOperationalCost")),r.createElement("div",{className:"total-amount"},g(d,{style:"currency",currency:a.Currency.GBP})))))):r.createElement("div",{className:"cart-items"},r.createElement("p",{className:"empty-cart"},N("Design:emptyBasket"))))};
@@ -12,7 +12,17 @@
12
12
  font-size: 1.375rem;
13
13
  }
14
14
  }
15
-
15
+ .duration-capacity-container {
16
+ .form-group {
17
+ margin-bottom: 0;
18
+ }
19
+ }
20
+ .duration-hint {
21
+ font-size: 0.875rem;
22
+ color: $gray-600;
23
+ padding-left: 1rem;
24
+ margin-top: 1rem;
25
+ }
16
26
  label {
17
27
  color: $black;
18
28
  font-size: 0.875rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.48.0-dev.1",
3
+ "version": "0.48.0-dev.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -200,6 +200,59 @@ Default.args = {
200
200
  id: 3,
201
201
  name: "Step #3",
202
202
  productCategories: [
203
+ {
204
+ id: 22,
205
+ uniqueId: "product-category24",
206
+ name: "Game zone",
207
+ minSubItems: null,
208
+ maxSubItems: null,
209
+ quantityType: "standard",
210
+ type: "game",
211
+ isTimeRelated: false,
212
+ collectUserInfo: false,
213
+ hasTicket: false,
214
+ allowDeposits: false,
215
+ hasBookingManagement: false,
216
+ weight: 0,
217
+ isReusable: false,
218
+ hasSubEvents: false,
219
+ products: [
220
+ {
221
+ id: 5,
222
+ name: "Product 1",
223
+ termsAndConditions: "",
224
+ productGroupId: null,
225
+ description: "",
226
+ price: "5",
227
+ deposit: 0,
228
+ minQuantity: null,
229
+ maxQuantity: null,
230
+ totalQuantity: "5",
231
+ capacity: 2,
232
+ duration: 0,
233
+ isAvailable: true,
234
+ isSoldOut: false,
235
+ isRequired: false,
236
+ isUnlimited: true,
237
+ quantitySelector: 1,
238
+ hasSpecialNotes: false,
239
+ weight: 0,
240
+ type: "sale",
241
+ tierId: 25,
242
+ zoneId: null,
243
+ subProducts: [],
244
+ images: [],
245
+ uuid: "ccff82d8-1896-40fc-a140-c70e4edf4e90",
246
+ subSlots: null,
247
+ offset: null,
248
+ pause: null,
249
+ serviceTime: null,
250
+ sort: 0,
251
+ },
252
+ ],
253
+ zoneId: "1",
254
+ sort: 2,
255
+ },
203
256
  {
204
257
  id: 3,
205
258
  name: "Product category #3",
@@ -136,6 +136,8 @@ export function ProductControl<T extends FormValues>({
136
136
  setValue,
137
137
  getValues,
138
138
  watch,
139
+ trigger,
140
+ clearErrors,
139
141
  } = useFormContext<T>();
140
142
 
141
143
  const { setLoading, providerHasBookingManagement } = useContext(
@@ -148,6 +150,8 @@ export function ProductControl<T extends FormValues>({
148
150
  const isUnlimited = Boolean(
149
151
  watch(`${fieldNamePrefix}.isUnlimited` as Path<T>)
150
152
  );
153
+ const capacity = watch(`${fieldNamePrefix}.capacity` as Path<T>);
154
+ const disabledDuration = capacity === "0" || !capacity;
151
155
 
152
156
  const advancedId = useId();
153
157
  const nameId = useId();
@@ -229,6 +233,19 @@ export function ProductControl<T extends FormValues>({
229
233
  }
230
234
  }, [images, fieldNamePrefix, setValue]);
231
235
 
236
+ useEffect(() => {
237
+ if (!disabledDuration) {
238
+ trigger(`${fieldNamePrefix}.duration` as Path<T>);
239
+ return;
240
+ }
241
+ setValue(
242
+ `${fieldNamePrefix}.duration` as Path<T>,
243
+ 0 as UnpackNestedValue<PathValue<T, Path<T>>>
244
+ );
245
+ clearErrors(`${fieldNamePrefix}.duration` as Path<T>);
246
+ // eslint-disable-next-line react-hooks/exhaustive-deps
247
+ }, [disabledDuration]);
248
+
232
249
  const quantitySelector = quantityValue ?? "1";
233
250
  const quantity = QUANTITY_TYPE_LIST_DTO[quantitySelector as string];
234
251
  return (
@@ -374,10 +391,11 @@ export function ProductControl<T extends FormValues>({
374
391
  </Row>
375
392
 
376
393
  {categoryType === CATEGORY_TYPE_FIXED_DURATION && (
377
- <Row className="align-items-start">
394
+ <Row className="align-items-start duration-capacity-container">
378
395
  <ProductDurationControl
379
396
  fieldNamePrefix={fieldNamePrefix}
380
397
  providerHasBookingManagement={providerHasBookingManagement}
398
+ disabled={disabledDuration}
381
399
  />
382
400
 
383
401
  <Col lg={4} md={4}>
@@ -386,58 +404,76 @@ export function ProductControl<T extends FormValues>({
386
404
  label={t("capacity")}
387
405
  rules={{
388
406
  min: {
389
- value: 1,
390
- message: t("Validation:fieldRequired", {
407
+ value: 0,
408
+ message: t("Validation:fieldMinNumber", {
391
409
  attribute: t("capacity"),
410
+ min: 0,
392
411
  }) as string,
393
412
  },
394
413
  }}
395
414
  />
396
415
  </Col>
416
+ {disabledDuration && (
417
+ <div className="duration-hint duration-capacity-container">
418
+ {t("Design:forDurationEditing")}
419
+ </div>
420
+ )}
397
421
  </Row>
398
422
  )}
399
423
 
400
424
  {categoryType === CATEGORY_TYPE_GAME && (
401
- <Row className="align-items-start">
402
- <Col lg={4} md={4}>
403
- <FormNumberInput
404
- fieldName={`${fieldNamePrefix}.capacity`}
405
- label={t("capacity")}
406
- onChange={onChangeGameCapacity}
407
- rules={{
408
- required: t("Validation:fieldRequired", {
409
- attribute: t("capacity"),
410
- }) as string,
411
- min: {
412
- value: 1,
413
- message: t("Validation:fieldRequired", {
414
- attribute: t("capacity"),
415
- }) as string,
416
- },
417
- }}
418
- />
419
- </Col>
420
- <Col lg={4} md={4}>
421
- <FormNumberInput
422
- fieldName={`${fieldNamePrefix}.duration`}
423
- label={t("durationMinutes")}
424
- rules={{
425
- required: t("Validation:fieldRequired", {
426
- attribute: t("capacity"),
427
- }) as string,
428
- min: {
429
- value: 1,
430
- message: t("Validation:fieldRequired", {
431
- attribute: t("capacity"),
432
- }) as string,
433
- },
434
- }}
435
- />
436
- </Col>
437
- </Row>
425
+ <>
426
+ <Row className="align-items-start duration-capacity-container">
427
+ <Col lg={4} md={4}>
428
+ <FormNumberInput
429
+ fieldName={`${fieldNamePrefix}.capacity`}
430
+ label={t("capacity")}
431
+ onChange={onChangeGameCapacity}
432
+ rules={{
433
+ min: {
434
+ value: 0,
435
+ message: t("Validation:fieldMinNumber", {
436
+ attribute: t("capacity"),
437
+ min: 1,
438
+ }) as string,
439
+ },
440
+ }}
441
+ />
442
+ </Col>
443
+ <Col lg={4} md={4}>
444
+ <FormNumberInput
445
+ fieldName={`${fieldNamePrefix}.duration`}
446
+ label={t("durationMinutes")}
447
+ disabled={disabledDuration}
448
+ rules={{
449
+ min: {
450
+ value: 0,
451
+ message: t("Validation:fieldMinNumber", {
452
+ attribute: t("duration"),
453
+ min: 0,
454
+ }) as string,
455
+ },
456
+ validate: (val) => {
457
+ if (!disabledDuration && (!val || val < 1)) {
458
+ return t("Validation:fieldRequired", {
459
+ attribute: t("duration"),
460
+ }) as string;
461
+ }
462
+ return true;
463
+ },
464
+ }}
465
+ />
466
+ </Col>
467
+ </Row>
468
+ {disabledDuration && (
469
+ <div className="duration-hint pl-0">
470
+ {t("Design:forDurationEditing")}
471
+ </div>
472
+ )}
473
+ </>
438
474
  )}
439
475
 
440
- <Row>
476
+ <Row className="mt-4">
441
477
  <Col lg={8} md={8}>
442
478
  <Form.Group controlId={termsAndConditionsId}>
443
479
  <Form.Label>{t("productTermsConditions")}</Form.Label>
@@ -1,7 +1,7 @@
1
+ import React from "react";
1
2
  import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
2
3
  import { FieldNamePrefixPath } from "@licklist/plugins/dist/types/services/Form/hook-form-service";
3
4
  import { useId } from "@react-aria/utils";
4
- import React from "react";
5
5
  import { Col, Form, InputGroup } from "react-bootstrap";
6
6
  import { Controller, Path, useFormContext, useWatch } from "react-hook-form";
7
7
  import { useTranslation } from "react-i18next";
@@ -9,14 +9,15 @@ import { ReactComponent as IncrementIcon } from "../../../assets/dashboard/incre
9
9
 
10
10
  export interface ProductDurationControlProps<T> extends FieldNamePrefixPath<T> {
11
11
  providerHasBookingManagement: boolean;
12
+ disabled: boolean;
12
13
  }
13
14
 
14
15
  export const ProductDurationControl = <T,>({
15
16
  fieldNamePrefix,
16
17
  providerHasBookingManagement,
18
+ disabled,
17
19
  }: ProductDurationControlProps<T>) => {
18
20
  const { t } = useTranslation("Design");
19
-
20
21
  const hoursId = useId();
21
22
  const minutesId = useId();
22
23
 
@@ -30,7 +31,7 @@ export const ProductDurationControl = <T,>({
30
31
 
31
32
  const setDurationValue = (value: number) =>
32
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- setValue(fieldName, value as any);
34
+ setValue(fieldName, value as any, { shouldValidate: true });
34
35
 
35
36
  const duration = useWatch({
36
37
  control,
@@ -92,6 +93,7 @@ export const ProductDurationControl = <T,>({
92
93
  min={0}
93
94
  step={1}
94
95
  value={durationHours}
96
+ disabled={disabled}
95
97
  isInvalid={isInvalid}
96
98
  onChange={(event) =>
97
99
  onHoursChange(Number(event.target.value))
@@ -125,6 +127,7 @@ export const ProductDurationControl = <T,>({
125
127
  type="number"
126
128
  min={0}
127
129
  step={1}
130
+ disabled={disabled}
128
131
  value={durationMinutes}
129
132
  isInvalid={isInvalid}
130
133
  onChange={(event) =>
@@ -20,6 +20,7 @@ export interface ManualBookingSummaryProps {
20
20
  orders: ManualBookingOrder[];
21
21
  ordersSum: number;
22
22
  orderSumIncludingFee?: number | null;
23
+ hasBookingCategory: boolean;
23
24
  isFeeFetching: boolean;
24
25
  orderDate: string;
25
26
  relyOnPeopleType?: RelyOnPeopleType | null;
@@ -33,6 +34,7 @@ export const ManualBookingSummary = ({
33
34
  isFeeFetching,
34
35
  orderDate,
35
36
  relyOnPeopleType,
37
+ hasBookingCategory,
36
38
  }: ManualBookingSummaryProps) => {
37
39
  const { t } = useTranslation(["Design", "Sale"]);
38
40
  const { formatNumber } = useIntl();
@@ -53,6 +55,7 @@ export const ManualBookingSummary = ({
53
55
  const relyOnPeopleMultiplier = getRelyOnPeopleMultiplier({
54
56
  relyOnPeopleType,
55
57
  capacity: order?.capacity,
58
+ hasBookingCategory,
56
59
  });
57
60
  return (
58
61
  <div
@@ -60,7 +63,7 @@ export const ManualBookingSummary = ({
60
63
  className="d-flex justify-content-between border-summary-item"
61
64
  >
62
65
  <div>{order.name}</div>
63
- {showRelyOnPeople && relyOnPeopleMultiplier && (
66
+ {showRelyOnPeople && !!relyOnPeopleMultiplier && (
64
67
  <div>
65
68
  {`x ${order.quantity * relyOnPeopleMultiplier} ${t(
66
69
  "people"
@@ -23,7 +23,7 @@ export function BooleanSwitch({
23
23
  const { t } = useTranslation("Design");
24
24
 
25
25
  const options: SelectItem[] = [
26
- { id: 1, value: firstValueTitle ?? t("yes") },
26
+ { id: 1, value: firstValueTitle ?? t("yes") },
27
27
  { id: 0, value: secondValueTitle ?? t("no") },
28
28
  ];
29
29
 
@@ -12,7 +12,17 @@
12
12
  font-size: 1.375rem;
13
13
  }
14
14
  }
15
-
15
+ .duration-capacity-container {
16
+ .form-group {
17
+ margin-bottom: 0;
18
+ }
19
+ }
20
+ .duration-hint {
21
+ font-size: 0.875rem;
22
+ color: $gray-600;
23
+ padding-left: 1rem;
24
+ margin-top: 1rem;
25
+ }
16
26
  label {
17
27
  color: $black;
18
28
  font-size: 0.875rem;