@licklist/design 0.44.486-dev.24 → 0.44.486-dev.26
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,
|
|
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,eA0hBxB"}
|
|
@@ -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")),m=require("@react-aria/utils"),u=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"),T=require("../../tiptap-editor/TipTapEditor.js"),q=require("./fixed-duration-fields/FixedDurationOptions.js"),y=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,R=e.hasBookingManagement,G=void 0!==R&&R,j=e.zoneList,w=void 0===j?[]:j,M=e.onCopy,O=e.onProductNameChange,B=e.productName,Y=e.hasTicket,U=e.categoryType,H=e.zoneDuration,Q=s.useFormContext(),V=Q.register,X=Q.control,z=Q.formState.errors,Z=Q.setValue,W=Q.getValues,J=Q.setError,K=Q.watch,$=a.useContext(p.ProductSetLoadingContext),ee=$.setLoading,te=$.providerHasBookingManagement,ae=r.useTranslation(["Design","Validation"]).t,ne=t.__read(a.useState(!1),2),re=ne[0],oe=ne[1],le=t.__read(a.useState(null),2),ie=le[0],ce=le[1],se=Boolean(K("".concat(L,".isUnlimited"))),de=m.useId(),me=m.useId(),ue=m.useId(),Ee=m.useId(),pe=m.useId(),ge=m.useId(),Ce=m.useId(),fe=m.useId(),ve=m.useId(),be=m.useId(),he=m.useId(),Ie=[{id:1,value:ae("quantitySelector")},{id:2,value:ae("stockControl")}],Fe=a.useCallback((function(){return oe((function(e){return!e}))}),[]),Pe=s.useWatch({control:X,name:"".concat(L,".quantitySelector")}),Ne=F.useImages(ie),Te=Ne.images,qe=Ne.handleImageRemove,ye=Ne.handleImageUploading,_e=Ne.isLoading,ke=a.useCallback((function(e){ye(e,P.IMAGE_TYPE_IMAGE)}),[ye]),xe=a.useCallback((function(e,t){qe(String(e),t)}),[qe]),Ae=function(e){return e.target.select()};a.useEffect((function(){ee(_e)}),[ee,_e]),a.useEffect((function(){var e=W("".concat(L,".images"));ce(e)}),[W,ce,L]),a.useEffect((function(){Array.isArray(Te)&&Z("".concat(L,".images"),Te)}),[Te,L,Z]),a.useEffect((function(){U!==g.CATEGORY_TYPE_GAME||H||J("".concat(L,".duration"),{message:ae("Validation:categoryZoneDoesntHaveDefaultDuration")})}),[U,H,L]);var Le=null!=Pe?Pe:"1",Se=g.QUANTITY_TYPE_LIST_DTO[Le];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:me},n.createElement(i.Form.Label,null,ae("name")),n.createElement(i.Form.Control,t.__assign({},V("".concat(L,".name")),{value:B,onChange:O,isInvalid:d.isInvalid("".concat(L,".name"),z),disabled:A,placeholder:ae("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,ae("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(T.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:A})},rules:{maxLength:{value:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH,message:ae("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(f.ProductDepositControl,{isLoading:A,fieldNamePrefix:L}),n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price"),title:ae("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:Ae}),Se===g.QUANTITY_TYPE_CONSTANT&&n.createElement(b.ProductQuantityConstantControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae,disabled:se}),Se===g.QUANTITY_TYPE_RECHARGING&&n.createElement(h.ProductQuantityRechargingControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae,disabled:se}),n.createElement(i.Form.Group,{controlId:be,className:"custom-checkbox"},n.createElement(i.Form.Check,t.__assign({custom:!0,type:"checkbox"},V("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:A})),n.createElement(i.Form.Check.Label,null,ae("isUnlimited")))),n.createElement(i.Form.Group,{controlId:fe},n.createElement(i.Form.Label,null,ae("quantitySelectorType")),n.createElement(i.Form.Control,t.__assign({as:"select",defaultValue:Y?Ie[0].id:void 0},V("".concat(L,".quantitySelector")),{isInvalid:d.isInvalid("".concat(L,".quantitySelector"),z),disabled:A||Y}),Ie.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))))),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start"},n.createElement(y.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:te}),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:ae("capacity"),rules:{min:{value:1,message:ae("Validation:fieldRequired",{attribute:ae("capacity")})}}}))),U===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:ae("capacity"),onChange:function(e){Z("".concat(L,".duration"),e*H)},rules:{min:{value:1,message:ae("Validation:fieldRequired",{attribute:ae("capacity")})}}})),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:ae("durationMinutes"),disabled:!0}))),n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:Ee},n.createElement(i.Form.Label,null,ae("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:ke,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:xe,defaultFiles:Te,isLoading:_e,withIcon:!0,title:ae("addImage")}))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(i.Form.Group,{controlId:pe,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isAvailable")})),n.createElement(i.Form.Group,{controlId:ge,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isSoldOut")})),n.createElement(i.Form.Group,{controlId:de,className:"custom-checkbox"},n.createElement(i.Form.Check,{custom:!0,type:"checkbox",name:de,disabled:A},n.createElement(i.Form.Check.Input,{checked:re,onChange:Fe,type:"checkbox"}),n.createElement(i.Form.Check.Label,null,ae("showAdvancedOptions"))))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(I,{in:re},n.createElement("div",null,n.createElement(i.Form.Group,{controlId:Ce,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isRequired")})),n.createElement(i.Form.Group,{controlId:ve,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.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(U)&&n.createElement(q.FixedDurationOptions,{fieldNamePrefix:L}),n.createElement(i.Form.Group,{controlId:he,className:"advanced-switch-container"},n.createElement(_.ProductPriceControl,{title:ae("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:A,fieldNamePrefix:"".concat(L,".minSpend")})))),n.createElement(o,null,n.createElement(l,{xs:12},G&&n.createElement(C.ProductBookingManagementControl,{isLoading:A,zoneList:w,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"})," ",ae("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")),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")),m=require("@react-aria/utils"),u=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"),h=require("./quantity/ProductQuantityConstantControl.js"),b=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"),T=require("../../tiptap-editor/TipTapEditor.js"),q=require("./fixed-duration-fields/FixedDurationOptions.js"),y=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,R=e.hasBookingManagement,G=void 0!==R&&R,j=e.zoneList,w=void 0===j?[]:j,M=e.onCopy,O=e.onProductNameChange,B=e.productName,Y=e.hasTicket,U=e.categoryType,H=e.zoneDuration,Q=s.useFormContext(),V=Q.register,X=Q.control,z=Q.formState.errors,Z=Q.setValue,W=Q.getValues,J=Q.setError,K=Q.watch,$=a.useContext(p.ProductSetLoadingContext),ee=$.setLoading,te=$.providerHasBookingManagement,ae=r.useTranslation(["Design","Validation"]).t,ne=t.__read(a.useState(!1),2),re=ne[0],oe=ne[1],le=t.__read(a.useState(null),2),ie=le[0],ce=le[1],se=Boolean(K("".concat(L,".isUnlimited"))),de=m.useId(),me=m.useId(),ue=m.useId(),Ee=m.useId(),pe=m.useId(),ge=m.useId(),Ce=m.useId(),fe=m.useId(),ve=m.useId(),he=m.useId(),be=m.useId(),Ie=[{id:1,value:ae("quantitySelector")},{id:2,value:ae("stockControl")}],Fe=a.useCallback((function(){return oe((function(e){return!e}))}),[]),Pe=s.useWatch({control:X,name:"".concat(L,".quantitySelector")}),Ne=F.useImages(ie),Te=Ne.images,qe=Ne.handleImageRemove,ye=Ne.handleImageUploading,_e=Ne.isLoading,ke=a.useCallback((function(e){ye(e,P.IMAGE_TYPE_IMAGE)}),[ye]),xe=a.useCallback((function(e,t){qe(String(e),t)}),[qe]),Ae=function(e){return e.target.select()};a.useEffect((function(){ee(_e)}),[ee,_e]),a.useEffect((function(){var e=W("".concat(L,".images"));ce(e)}),[W,ce,L]),a.useEffect((function(){Array.isArray(Te)&&Z("".concat(L,".images"),Te)}),[Te,L,Z]),a.useEffect((function(){U!==g.CATEGORY_TYPE_GAME||H||J("".concat(L,".duration"),{message:ae("Validation:categoryZoneDoesntHaveDefaultDuration")})}),[U,H,L]);var Le=null!=Pe?Pe:"1",Se=g.QUANTITY_TYPE_LIST_DTO[Le];return n.createElement(n.Fragment,null,n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:me},n.createElement(i.Form.Label,null,ae("name")),n.createElement(i.Form.Control,t.__assign({},V("".concat(L,".name")),{value:B,onChange:O,isInvalid:d.isInvalid("".concat(L,".name"),z),disabled:A,placeholder:ae("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,ae("description")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange;return n.createElement(T.TipTapEditor,{withEmoji:!1,viewMode:!1,onUpdate:r,content:a,disabled:A})},rules:{maxLength:{value:k.MAX_PRODUCT_DESCRIPTION_CHARACTERS_LENGTH,message:ae("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(f.ProductDepositControl,{isLoading:A,fieldNamePrefix:L}),n.createElement(_.ProductPriceControl,{isLoading:A,fieldNamePrefix:"".concat(L,".price"),title:ae("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:Ae}),Se===g.QUANTITY_TYPE_CONSTANT&&n.createElement(h.ProductQuantityConstantControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae,disabled:se}),Se===g.QUANTITY_TYPE_RECHARGING&&n.createElement(b.ProductQuantityRechargingControl,{isLoading:A,fieldNamePrefix:L,onFocus:Ae,disabled:se}),n.createElement(i.Form.Group,{controlId:he,className:"custom-checkbox"},n.createElement(i.Form.Check,t.__assign({custom:!0,type:"checkbox"},V("".concat(L,".isUnlimited")),{name:"".concat(L,".isUnlimited"),disabled:A})),n.createElement(i.Form.Check.Label,null,ae("isUnlimited")))),n.createElement(i.Form.Group,{controlId:fe},n.createElement(i.Form.Label,null,ae("quantitySelectorType")),n.createElement(i.Form.Control,t.__assign({as:"select",defaultValue:Y?Ie[0].id:void 0},V("".concat(L,".quantitySelector")),{isInvalid:d.isInvalid("".concat(L,".quantitySelector"),z),disabled:A||Y}),Ie.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))))),U===g.CATEGORY_TYPE_FIXED_DURATION&&n.createElement(o,{className:"align-items-start"},n.createElement(y.ProductDurationControl,{fieldNamePrefix:L,providerHasBookingManagement:te}),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".capacity"),label:ae("capacity"),rules:{min:{value:1,message:ae("Validation:fieldRequired",{attribute:ae("capacity")})}}}))),U===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:ae("capacity"),onChange:function(e){Z("".concat(L,".duration"),e*H)},rules:{min:{value:1,message:ae("Validation:fieldRequired",{attribute:ae("capacity")})}}})),n.createElement(l,{lg:4,md:4},n.createElement(E.FormNumberInput,{fieldName:"".concat(L,".duration"),label:ae("durationMinutes")}))),n.createElement(o,null,n.createElement(l,{lg:8,md:8},n.createElement(i.Form.Group,{controlId:Ee},n.createElement(i.Form.Label,null,ae("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:ke,allowedExtensions:["jpeg","jpg","png"],subTitle:".jpeg .jpg .png",enablePreview:!0,onFileRemove:xe,defaultFiles:Te,isLoading:_e,withIcon:!0,title:ae("addImage")}))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(i.Form.Group,{controlId:pe,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isAvailable")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isAvailable")})),n.createElement(i.Form.Group,{controlId:ge,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isSoldOut")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isSoldOut")})),n.createElement(i.Form.Group,{controlId:de,className:"custom-checkbox"},n.createElement(i.Form.Check,{custom:!0,type:"checkbox",name:de,disabled:A},n.createElement(i.Form.Check.Input,{checked:re,onChange:Fe,type:"checkbox"}),n.createElement(i.Form.Check.Label,null,ae("showAdvancedOptions"))))),n.createElement(l,{lg:12,md:12,xl:!0,className:"p-0"},n.createElement(I,{in:re},n.createElement("div",null,n.createElement(i.Form.Group,{controlId:Ce,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("isRequired")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.BooleanSwitch,{name:o,value:Boolean(a),onChange:r,disabled:A})},control:X,name:"".concat(L,".isRequired")})),n.createElement(i.Form.Group,{controlId:ve,className:"advanced-switch-container"},n.createElement(i.Form.Label,null,ae("hasSpecialNotes")),n.createElement(s.Controller,{render:function(e){var t=e.field,a=t.value,r=t.onChange,o=t.name;return n.createElement(u.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(U)&&n.createElement(q.FixedDurationOptions,{fieldNamePrefix:L}),n.createElement(i.Form.Group,{controlId:be,className:"advanced-switch-container"},n.createElement(_.ProductPriceControl,{title:ae("minSpend"),isRequired:!1,isMoreThanZero:!0,allowDeposits:!1,isLoading:A,fieldNamePrefix:"".concat(L,".minSpend")})))),n.createElement(o,null,n.createElement(l,{xs:12},G&&n.createElement(C.ProductBookingManagementControl,{isLoading:A,zoneList:w,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"})," ",ae("copy"))))))};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licklist/design",
|
|
3
|
-
"version": "0.44.486-dev.
|
|
3
|
+
"version": "0.44.486-dev.26",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/core": "7.13.8",
|
|
47
|
-
"@babel/plugin-proposal-private-property-in-object": "7.16.
|
|
47
|
+
"@babel/plugin-proposal-private-property-in-object": "7.16.7",
|
|
48
48
|
"@dnd-kit/core": "3.1.1",
|
|
49
49
|
"@dnd-kit/modifiers": "4.0.0",
|
|
50
50
|
"@dnd-kit/sortable": "4.0.0",
|