@licklist/design 0.48.0-dev.2 → 0.48.0
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/events/event-card/utils.d.ts.map +1 -1
- package/dist/events/event-card/utils.js +1 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/product-set/product/duration/ProductDurationControl.d.ts +1 -2
- package/dist/product-set/product/duration/ProductDurationControl.d.ts.map +1 -1
- package/dist/product-set/product/duration/ProductDurationControl.js +1 -1
- package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts +1 -2
- package/dist/sales/manual-booking/summary/ManualBookingSummary.d.ts.map +1 -1
- package/dist/sales/manual-booking/summary/ManualBookingSummary.js +1 -1
- package/dist/static/switch/BooleanSwitch.d.ts +1 -3
- package/dist/static/switch/BooleanSwitch.d.ts.map +1 -1
- package/dist/static/switch/BooleanSwitch.js +1 -1
- package/dist/styles/product-set/EditProductSetElement.scss +1 -11
- package/dist/styles/sales/BookingFilter.scss +1 -3
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/styles/static/Switch.scss +0 -1
- package/dist/table/TableHelperComponent.d.ts +1 -2
- package/dist/table/TableHelperComponent.d.ts.map +1 -1
- package/dist/table/TableHelperComponent.js +1 -1
- package/package.json +3 -3
- package/src/events/event-card/utils.ts +9 -4
- package/src/product-set/form/ProductSetForm.stories.tsx +0 -53
- package/src/product-set/product/ProductControl.tsx +41 -77
- package/src/product-set/product/duration/ProductDurationControl.tsx +3 -6
- package/src/sales/manual-booking/summary/ManualBookingSummary.tsx +1 -4
- package/src/static/switch/BooleanSwitch.tsx +2 -6
- package/src/styles/product-set/EditProductSetElement.scss +1 -11
- package/src/styles/sales/BookingFilter.scss +1 -3
- package/src/styles/sales/BookingResults.scss +1 -1
- package/src/styles/static/Switch.scss +0 -1
- package/src/table/TableHelperComponent.tsx +21 -78
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAGlG,wBAAgB,aAAa,CAAC,OAAO,KAAA,EAAE,UAAU,KAAA,OAIhD;AAED,eAAO,MAAM,wBAAwB,2CAepC,CAAC;AAEF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,UACvB,MAAM,EAAE,kBACC,cAAc,KAC7B,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/events/event-card/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAGlG,wBAAgB,aAAa,CAAC,OAAO,KAAA,EAAE,UAAU,KAAA,OAIhD;AAED,eAAO,MAAM,wBAAwB,2CAepC,CAAC;AAEF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,UACvB,MAAM,EAAE,kBACC,cAAc,KAC7B,MAUF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,UAC/B,MAAM,EAAE,kBACC,cAAc,KAC7B,CAAC,MAAM,EAAE,MAAM,CAejB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,mBACX,cAAc,GAAG,IAAI,QAC/B,MAAM;gBAEA,MAAM;eACP,MAAM;iBACJ,MAAM;CA2BpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("@licklist/core/dist/Config"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("@licklist/core/dist/Config"),e=require("luxon");var o=300,n=function(t,r){return t.reduce((function(t,e){var o;return t+Object.values(null!==(o=r.views[e])&&void 0!==o?o:{}).reduce((function(t,r){return t+(r.pageViews||0)}),0)}),0)},u=function(t,r){var e=0,o=0;return t.forEach((function(t){var n;return Object.values(null!==(n=r.productCategorySummary[t])&&void 0!==n?n:{}).forEach((function(t){var r,n=t.totalPerCategory,u=t.productsSummary;o+=n||0,e+=null!==(r=null==u?void 0:u.reduce((function(t,r){return t+r.productsSold}),0))&&void 0!==r?r:0}))})),[e,o]};exports.EVENT_DESCRIPTION_SIZE=o,exports.calculateTotalSoldAndAmount=u,exports.calculateTotalViews=n,exports.formatContent=function(t,r){return t?t.length>r?"".concat(t.slice(0,r),"..."):t:""},exports.formatContentWithoutTags=function(t,r){if(void 0===r&&(r=o),!t)return"";if(t<r)return t;var e=t.replace(/<[^>]*>/g,"").trim().replace(/ |[^a-zA-Z0-9\s]/g,"").replace(/\s\s+/g," ").slice(0,r).split(" "),n=String(t).indexOf(e[e.length-2]);return t.slice(0,n).concat("...")},exports.getStatisticInfo=function(o,a){var i,l;if(!o)return{totalViews:0,totalSold:0,totalAmount:0};var c=e.DateTime.fromISO(a).toUTC().toFormat(r.DATE_FORMAT),s=e.DateTime.fromISO(a).toUTC().toFormat(r.DATE_FORMAT),d=null!==(l=null===(i=Object.keys(null==o?void 0:o.productCategorySummary))||void 0===i?void 0:i.filter((function(t){return e.DateTime.fromFormat(t,r.DATE_TIME_FULL_FORMAT).toFormat(r.DATE_FORMAT)===s})))&&void 0!==l?l:[],f=n([c],o),m=t.__read(u(d,o),2);return{totalViews:f,totalSold:m[0],totalAmount:m[1]}};
|
|
@@ -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,eA+hBxB"}
|
|
@@ -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")),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"))))))};
|
|
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"))))))};
|
|
@@ -2,7 +2,6 @@
|
|
|
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;
|
|
6
5
|
}
|
|
7
|
-
export declare const ProductDurationControl: <T>({ fieldNamePrefix, providerHasBookingManagement,
|
|
6
|
+
export declare const ProductDurationControl: <T>({ fieldNamePrefix, providerHasBookingManagement, }: ProductDurationControlProps<T>) => JSX.Element;
|
|
8
7
|
//# 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":";
|
|
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 +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"),
|
|
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))))))}})};
|
|
@@ -6,10 +6,9 @@ export interface ManualBookingSummaryProps {
|
|
|
6
6
|
orders: ManualBookingOrder[];
|
|
7
7
|
ordersSum: number;
|
|
8
8
|
orderSumIncludingFee?: number | null;
|
|
9
|
-
hasBookingCategory: boolean;
|
|
10
9
|
isFeeFetching: boolean;
|
|
11
10
|
orderDate: string;
|
|
12
11
|
relyOnPeopleType?: RelyOnPeopleType | null;
|
|
13
12
|
}
|
|
14
|
-
export declare const ManualBookingSummary: ({ eventName, orders, ordersSum, orderSumIncludingFee, isFeeFetching, orderDate, relyOnPeopleType,
|
|
13
|
+
export declare const ManualBookingSummary: ({ eventName, orders, ordersSum, orderSumIncludingFee, isFeeFetching, orderDate, relyOnPeopleType, }: ManualBookingSummaryProps) => JSX.Element;
|
|
15
14
|
//# 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,
|
|
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 +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"),
|
|
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"))))};
|
|
@@ -4,8 +4,6 @@ export interface BooleanSwitchProps {
|
|
|
4
4
|
value?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
onChange: (value: boolean) => void;
|
|
7
|
-
firstValueTitle?: string;
|
|
8
|
-
secondValueTitle?: string;
|
|
9
7
|
}
|
|
10
|
-
export declare function BooleanSwitch({ name, value, disabled, onChange,
|
|
8
|
+
export declare function BooleanSwitch({ name, value, disabled, onChange, }: BooleanSwitchProps): JSX.Element;
|
|
11
9
|
//# sourceMappingURL=BooleanSwitch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanSwitch.d.ts","sourceRoot":"","sources":["../../../src/static/switch/BooleanSwitch.tsx"],"names":[],"mappings":";AAKA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"BooleanSwitch.d.ts","sourceRoot":"","sources":["../../../src/static/switch/BooleanSwitch.tsx"],"names":[],"mappings":";AAKA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAED,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,EAAE,kBAAkB,eAwBpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,a=require("tslib"),t=require("react"),i=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-i18next"),r=require("./Switch.js");exports.BooleanSwitch=function(e){var o=e.name,u=e.value,l=e.disabled,s=e.onChange,c=n.useTranslation("Design").t,d=[{id:1,value:c("yes")},{id:0,value:c("no")}],v=t.useCallback((function(e){s(Boolean(e))}),[s]);return i.createElement(r.Switch,a.__assign({name:o},void 0!==u&&{value:Number(u)},{options:d,disabled:l,onChange:v}))};
|
|
@@ -12,17 +12,7 @@
|
|
|
12
12
|
font-size: 1.375rem;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
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
|
-
}
|
|
15
|
+
|
|
26
16
|
label {
|
|
27
17
|
color: $black;
|
|
28
18
|
font-size: 0.875rem;
|
|
@@ -164,12 +164,10 @@
|
|
|
164
164
|
|
|
165
165
|
@include media-breakpoint-down(md) {
|
|
166
166
|
flex-wrap: wrap;
|
|
167
|
-
|
|
168
167
|
.date-container {
|
|
169
168
|
width: 100%;
|
|
170
169
|
flex: 1;
|
|
171
170
|
}
|
|
172
|
-
|
|
173
171
|
.btn-primary {
|
|
174
172
|
margin-top: 1rem;
|
|
175
173
|
}
|
|
@@ -232,4 +230,4 @@
|
|
|
232
230
|
}
|
|
233
231
|
}
|
|
234
232
|
}
|
|
235
|
-
}
|
|
233
|
+
}
|
|
@@ -27,7 +27,6 @@ $btn-switch-option-padding-y: calc(#{$btn-padding-y} - #{sp(1)}) !default;
|
|
|
27
27
|
border-radius: $btn-switch-option-border-radius;
|
|
28
28
|
margin: 0;
|
|
29
29
|
padding: $btn-switch-option-padding-y $btn-switch-option-padding-x;
|
|
30
|
-
min-width: 4.25rem;
|
|
31
30
|
|
|
32
31
|
&:hover,
|
|
33
32
|
&:active,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import ILengthAwarePaginator from "@licklist/plugins/dist/types/services/Table/ILengthAwarePaginator";
|
|
3
3
|
import ITableHeader from "@licklist/plugins/dist/types/services/Table/ITableHeader";
|
|
4
4
|
import ITableProps from "@licklist/plugins/dist/types/services/Table/ITableProps";
|
|
@@ -18,7 +18,6 @@ export interface TableHelperComponentProps {
|
|
|
18
18
|
[key: string]: any;
|
|
19
19
|
};
|
|
20
20
|
initialOptions?: Partial<ITableProps>;
|
|
21
|
-
filteredOrdersOptions?: (value: SetStateAction<ITableProps>) => void;
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* TableHelperComponent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHelperComponent.d.ts","sourceRoot":"","sources":["../../src/table/TableHelperComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableHelperComponent.d.ts","sourceRoot":"","sources":["../../src/table/TableHelperComponent.tsx"],"names":[],"mappings":";AAQA,OAAO,qBAAqB,MAAM,mEAAmE,CAAC;AACtG,OAAO,YAAY,MAAM,0DAA0D,CAAC;AACpF,OAAO,WAAW,MAAM,yDAAyD,CAAC;AAQlF,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,YAAY,EAAE,QAAQ,CAAC;IACvB,SAAS,CAAC,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,eAAe,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACzC,cAAc,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACvC;AAUD;;;;;;GAMG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,eAsP7D;AAED,OAAO,EAAE,oBAAoB,EAAE,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"),n=e(r),i=require("react-router-dom"),a=e(require("@licklist/plugins/dist/services/Route/RouteService")),o=require("../static/loader/LoaderIndicator.js"),
|
|
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),i=require("react-router-dom"),a=e(require("@licklist/plugins/dist/services/Route/RouteService")),o=require("../static/loader/LoaderIndicator.js"),l=require("react-bootstrap"),s=e(require("@licklist/plugins/dist/hooks/Query/useQuery")),u=require("lodash"),c=require("./FilterHelperComponent.js"),p=require("./PaginationHelperComponent.js"),d=e(require("@licklist/plugins/dist/services/Table/TableService")),g=require("./PerPageHelperComponent.js"),f=require("./utils/index.js");exports.TableHelperComponent=function(e){var _,m,v=e.paginator,E=e.headers,y=e.renderItemFn,S=e.isLoading,h=e.onRefreshFn,C=e.refreshAt,P=e.striped,b=void 0===P||P,q=e.bordered,F=void 0===q||q,j=e.displaySearchBar,D=void 0===j||j,k=e.displayPerPageSelect,L=void 0===k||k,w=e.displayShowingSection,H=void 0===w||w,O=e.externalFilters,R=void 0===O?{}:O,T=e.initialOptions,N=void 0===T?{}:T,V=s(),K=i.useLocation().pathname,I=Number(f.getFilterOptionsValue(V,N,"page")),x=Number(f.getFilterOptionsValue(V,N,"perPage")),A=String(f.getFilterOptionsValue(V,N,"sortKey")),U=String(f.getFilterOptionsValue(V,N,"sortDirection")),Q=String(f.getFilterOptionsValue(V,N,"filter")),B=t.__read(r.useState(),2),G=B[0],M=B[1],z=t.__read(r.useState({page:I,perPage:x,sortKey:A,sortDirection:U,filter:Q}),2),J=z[0],W=z[1],X=t.__read(r.useState(0),2),Y=X[0],Z=X[1],$=t.__read(r.useState(R),2),ee=$[0],te=$[1];r.useEffect((function(){u.isEqual(G,J)&&u.isEqual(ee,R)||(M(J),te(R),h&&h(J),a.redirectTo([K,["page=".concat(J.page),"perPage=".concat(J.perPage),"sortKey=".concat(escape(J.sortKey)),"sortDirection=".concat(escape(J.sortDirection)),"filter=".concat(escape(J.filter)),new URLSearchParams(R).toString()].join("&")].join("?")))}),[K,J,h,R]),r.useEffect((function(){Y!==C&&(Z((function(e){return null!=C?C:e})),h&&h(J))}),[h,J,C,Y]);var re=function(e){var r,i;if("string"==typeof e)return n.createElement("th",{key:e.toLowerCase(),className:d.getHeaderClasses(e,A,U)},e);if("object"==typeof e){var a={width:null!==(r=e.width)&&void 0!==r?r:"auto"};return n.createElement("th",{key:null!==(i=e.key)&&void 0!==i?i:e.title.toLowerCase(),className:d.getHeaderClasses(e,A,U),style:a,onClick:function(){return e.isSortable&&(r=e.key,n=d.DEFAULT_SORT_DIRECTION,void W(A===r?function(e){return n=d.getSortDirection(e.sortDirection,n),t.__assign(t.__assign({},e),{sortKey:r,sortDirection:n})}:function(e){return t.__assign(t.__assign({},e),{sortKey:r,sortDirection:n})}));var r,n}},e.title)}return null};return n.createElement("div",{className:["table-helper",S?"py-5":"py-1"].join(" ")},n.createElement(o.LoaderIndicator,{isLoaded:!S},n.createElement(l.Row,null,n.createElement(l.Col,null,L&&n.createElement(g.PerPageHelperComponent,{onChangeFn:function(e){W((function(r){return t.__assign(t.__assign({},r),{perPage:e})}))},defaultValue:null!==(_=null==v?void 0:v.per_page)&&void 0!==_?_:d.DEFAULT_PER_PAGE})),n.createElement(l.Col,null,D&&n.createElement(c.FilterHelperComponent,{onClickFn:function(e){W((function(r){var n=r.page,i=t.__rest(r,["page"]),a=n;return(!e&&i.filter||e&&!i.filter)&&(a=1),t.__assign(t.__assign({},i),{page:a,filter:e})}))},defaultValue:null!==(m=J.filter)&&void 0!==m?m:""}))),n.createElement(l.Row,null,n.createElement(l.Col,null,n.createElement("div",{className:"table-responsive"},n.createElement(l.Table,{striped:b,bordered:F,hover:!0},n.createElement("thead",null,n.createElement("tr",null,E.map((function(e){return re(e)})))),n.createElement("tbody",null,v?v.data.map((function(e,t){return y(e,t)})):null))))),n.createElement(p.PaginationHelperComponent,{displayShowingSection:H,paginator:v,onPageChangeFn:function(e){W((function(r){return t.__assign(t.__assign({},r),{page:e})}))}})))};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licklist/design",
|
|
3
|
-
"version": "0.48.0
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@fortawesome/free-brands-svg-icons": "5.15.2",
|
|
54
54
|
"@fortawesome/free-solid-svg-icons": "5.15.2",
|
|
55
55
|
"@fortawesome/react-fontawesome": "0.1.9",
|
|
56
|
-
"@licklist/core": "
|
|
56
|
+
"@licklist/core": "0.15.x",
|
|
57
57
|
"@licklist/eslint-config": "0.3.4",
|
|
58
|
-
"@licklist/plugins": "
|
|
58
|
+
"@licklist/plugins": "0.21.x",
|
|
59
59
|
"@mdx-js/react": "1.6.22",
|
|
60
60
|
"@popperjs/core": "2.11.8",
|
|
61
61
|
"@react-aria/utils": "3.9.0",
|
|
@@ -37,11 +37,17 @@ export const EVENT_DESCRIPTION_SIZE = 300;
|
|
|
37
37
|
export const calculateTotalViews = (
|
|
38
38
|
dates: string[],
|
|
39
39
|
eventStatistic: EventStatistic
|
|
40
|
-
): number =>
|
|
41
|
-
dates.reduce(
|
|
42
|
-
(
|
|
40
|
+
): number => {
|
|
41
|
+
return dates.reduce(
|
|
42
|
+
(rootAcc, date) =>
|
|
43
|
+
rootAcc +
|
|
44
|
+
Object.values(eventStatistic.views[date] ?? {}).reduce(
|
|
45
|
+
(acc, view) => acc + (view.pageViews || 0),
|
|
46
|
+
0
|
|
47
|
+
),
|
|
43
48
|
0
|
|
44
49
|
);
|
|
50
|
+
};
|
|
45
51
|
|
|
46
52
|
/**
|
|
47
53
|
* Calculates the total number of products sold and the total amount sold
|
|
@@ -95,7 +101,6 @@ export const getStatisticInfo = (
|
|
|
95
101
|
const viewsFormattedDate = DateTime.fromISO(date)
|
|
96
102
|
.toUTC()
|
|
97
103
|
.toFormat(DATE_FORMAT);
|
|
98
|
-
|
|
99
104
|
const summaryFormattedDate = DateTime.fromISO(date)
|
|
100
105
|
.toUTC()
|
|
101
106
|
.toFormat(DATE_FORMAT);
|
|
@@ -200,59 +200,6 @@ 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
|
-
},
|
|
256
203
|
{
|
|
257
204
|
id: 3,
|
|
258
205
|
name: "Product category #3",
|
|
@@ -136,8 +136,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
136
136
|
setValue,
|
|
137
137
|
getValues,
|
|
138
138
|
watch,
|
|
139
|
-
trigger,
|
|
140
|
-
clearErrors,
|
|
141
139
|
} = useFormContext<T>();
|
|
142
140
|
|
|
143
141
|
const { setLoading, providerHasBookingManagement } = useContext(
|
|
@@ -150,8 +148,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
150
148
|
const isUnlimited = Boolean(
|
|
151
149
|
watch(`${fieldNamePrefix}.isUnlimited` as Path<T>)
|
|
152
150
|
);
|
|
153
|
-
const capacity = watch(`${fieldNamePrefix}.capacity` as Path<T>);
|
|
154
|
-
const disabledDuration = capacity === "0" || !capacity;
|
|
155
151
|
|
|
156
152
|
const advancedId = useId();
|
|
157
153
|
const nameId = useId();
|
|
@@ -233,19 +229,6 @@ export function ProductControl<T extends FormValues>({
|
|
|
233
229
|
}
|
|
234
230
|
}, [images, fieldNamePrefix, setValue]);
|
|
235
231
|
|
|
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
|
-
|
|
249
232
|
const quantitySelector = quantityValue ?? "1";
|
|
250
233
|
const quantity = QUANTITY_TYPE_LIST_DTO[quantitySelector as string];
|
|
251
234
|
return (
|
|
@@ -391,11 +374,10 @@ export function ProductControl<T extends FormValues>({
|
|
|
391
374
|
</Row>
|
|
392
375
|
|
|
393
376
|
{categoryType === CATEGORY_TYPE_FIXED_DURATION && (
|
|
394
|
-
<Row className="align-items-start
|
|
377
|
+
<Row className="align-items-start">
|
|
395
378
|
<ProductDurationControl
|
|
396
379
|
fieldNamePrefix={fieldNamePrefix}
|
|
397
380
|
providerHasBookingManagement={providerHasBookingManagement}
|
|
398
|
-
disabled={disabledDuration}
|
|
399
381
|
/>
|
|
400
382
|
|
|
401
383
|
<Col lg={4} md={4}>
|
|
@@ -404,76 +386,58 @@ export function ProductControl<T extends FormValues>({
|
|
|
404
386
|
label={t("capacity")}
|
|
405
387
|
rules={{
|
|
406
388
|
min: {
|
|
407
|
-
value:
|
|
408
|
-
message: t("Validation:
|
|
389
|
+
value: 1,
|
|
390
|
+
message: t("Validation:fieldRequired", {
|
|
409
391
|
attribute: t("capacity"),
|
|
410
|
-
min: 0,
|
|
411
392
|
}) as string,
|
|
412
393
|
},
|
|
413
394
|
}}
|
|
414
395
|
/>
|
|
415
396
|
</Col>
|
|
416
|
-
{disabledDuration && (
|
|
417
|
-
<div className="duration-hint duration-capacity-container">
|
|
418
|
-
{t("Design:forDurationEditing")}
|
|
419
|
-
</div>
|
|
420
|
-
)}
|
|
421
397
|
</Row>
|
|
422
398
|
)}
|
|
423
399
|
|
|
424
400
|
{categoryType === CATEGORY_TYPE_GAME && (
|
|
425
|
-
|
|
426
|
-
<
|
|
427
|
-
<
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
},
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
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
|
-
</>
|
|
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>
|
|
474
438
|
)}
|
|
475
439
|
|
|
476
|
-
<Row
|
|
440
|
+
<Row>
|
|
477
441
|
<Col lg={8} md={8}>
|
|
478
442
|
<Form.Group controlId={termsAndConditionsId}>
|
|
479
443
|
<Form.Label>{t("productTermsConditions")}</Form.Label>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
3
2
|
import { FieldNamePrefixPath } from "@licklist/plugins/dist/types/services/Form/hook-form-service";
|
|
4
3
|
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,15 +9,14 @@ 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;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
export const ProductDurationControl = <T,>({
|
|
16
15
|
fieldNamePrefix,
|
|
17
16
|
providerHasBookingManagement,
|
|
18
|
-
disabled,
|
|
19
17
|
}: ProductDurationControlProps<T>) => {
|
|
20
18
|
const { t } = useTranslation("Design");
|
|
19
|
+
|
|
21
20
|
const hoursId = useId();
|
|
22
21
|
const minutesId = useId();
|
|
23
22
|
|
|
@@ -31,7 +30,7 @@ export const ProductDurationControl = <T,>({
|
|
|
31
30
|
|
|
32
31
|
const setDurationValue = (value: number) =>
|
|
33
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
setValue(fieldName, value as any
|
|
33
|
+
setValue(fieldName, value as any);
|
|
35
34
|
|
|
36
35
|
const duration = useWatch({
|
|
37
36
|
control,
|
|
@@ -93,7 +92,6 @@ export const ProductDurationControl = <T,>({
|
|
|
93
92
|
min={0}
|
|
94
93
|
step={1}
|
|
95
94
|
value={durationHours}
|
|
96
|
-
disabled={disabled}
|
|
97
95
|
isInvalid={isInvalid}
|
|
98
96
|
onChange={(event) =>
|
|
99
97
|
onHoursChange(Number(event.target.value))
|
|
@@ -127,7 +125,6 @@ export const ProductDurationControl = <T,>({
|
|
|
127
125
|
type="number"
|
|
128
126
|
min={0}
|
|
129
127
|
step={1}
|
|
130
|
-
disabled={disabled}
|
|
131
128
|
value={durationMinutes}
|
|
132
129
|
isInvalid={isInvalid}
|
|
133
130
|
onChange={(event) =>
|
|
@@ -20,7 +20,6 @@ export interface ManualBookingSummaryProps {
|
|
|
20
20
|
orders: ManualBookingOrder[];
|
|
21
21
|
ordersSum: number;
|
|
22
22
|
orderSumIncludingFee?: number | null;
|
|
23
|
-
hasBookingCategory: boolean;
|
|
24
23
|
isFeeFetching: boolean;
|
|
25
24
|
orderDate: string;
|
|
26
25
|
relyOnPeopleType?: RelyOnPeopleType | null;
|
|
@@ -34,7 +33,6 @@ export const ManualBookingSummary = ({
|
|
|
34
33
|
isFeeFetching,
|
|
35
34
|
orderDate,
|
|
36
35
|
relyOnPeopleType,
|
|
37
|
-
hasBookingCategory,
|
|
38
36
|
}: ManualBookingSummaryProps) => {
|
|
39
37
|
const { t } = useTranslation(["Design", "Sale"]);
|
|
40
38
|
const { formatNumber } = useIntl();
|
|
@@ -55,7 +53,6 @@ export const ManualBookingSummary = ({
|
|
|
55
53
|
const relyOnPeopleMultiplier = getRelyOnPeopleMultiplier({
|
|
56
54
|
relyOnPeopleType,
|
|
57
55
|
capacity: order?.capacity,
|
|
58
|
-
hasBookingCategory,
|
|
59
56
|
});
|
|
60
57
|
return (
|
|
61
58
|
<div
|
|
@@ -63,7 +60,7 @@ export const ManualBookingSummary = ({
|
|
|
63
60
|
className="d-flex justify-content-between border-summary-item"
|
|
64
61
|
>
|
|
65
62
|
<div>{order.name}</div>
|
|
66
|
-
{showRelyOnPeople &&
|
|
63
|
+
{showRelyOnPeople && relyOnPeopleMultiplier && (
|
|
67
64
|
<div>
|
|
68
65
|
{`x ${order.quantity * relyOnPeopleMultiplier} ${t(
|
|
69
66
|
"people"
|
|
@@ -8,8 +8,6 @@ export interface BooleanSwitchProps {
|
|
|
8
8
|
value?: boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
onChange: (value: boolean) => void;
|
|
11
|
-
firstValueTitle?: string;
|
|
12
|
-
secondValueTitle?: string;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
export function BooleanSwitch({
|
|
@@ -17,14 +15,12 @@ export function BooleanSwitch({
|
|
|
17
15
|
value,
|
|
18
16
|
disabled,
|
|
19
17
|
onChange,
|
|
20
|
-
firstValueTitle,
|
|
21
|
-
secondValueTitle,
|
|
22
18
|
}: BooleanSwitchProps) {
|
|
23
19
|
const { t } = useTranslation("Design");
|
|
24
20
|
|
|
25
21
|
const options: SelectItem[] = [
|
|
26
|
-
{ id: 1, value:
|
|
27
|
-
{ id: 0, value:
|
|
22
|
+
{ id: 1, value: t("yes") },
|
|
23
|
+
{ id: 0, value: t("no") },
|
|
28
24
|
];
|
|
29
25
|
|
|
30
26
|
const handleChange = useCallback(
|
|
@@ -12,17 +12,7 @@
|
|
|
12
12
|
font-size: 1.375rem;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
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
|
-
}
|
|
15
|
+
|
|
26
16
|
label {
|
|
27
17
|
color: $black;
|
|
28
18
|
font-size: 0.875rem;
|
|
@@ -164,12 +164,10 @@
|
|
|
164
164
|
|
|
165
165
|
@include media-breakpoint-down(md) {
|
|
166
166
|
flex-wrap: wrap;
|
|
167
|
-
|
|
168
167
|
.date-container {
|
|
169
168
|
width: 100%;
|
|
170
169
|
flex: 1;
|
|
171
170
|
}
|
|
172
|
-
|
|
173
171
|
.btn-primary {
|
|
174
172
|
margin-top: 1rem;
|
|
175
173
|
}
|
|
@@ -232,4 +230,4 @@
|
|
|
232
230
|
}
|
|
233
231
|
}
|
|
234
232
|
}
|
|
235
|
-
}
|
|
233
|
+
}
|
|
@@ -27,7 +27,6 @@ $btn-switch-option-padding-y: calc(#{$btn-padding-y} - #{sp(1)}) !default;
|
|
|
27
27
|
border-radius: $btn-switch-option-border-radius;
|
|
28
28
|
margin: 0;
|
|
29
29
|
padding: $btn-switch-option-padding-y $btn-switch-option-padding-x;
|
|
30
|
-
min-width: 4.25rem;
|
|
31
30
|
|
|
32
31
|
&:hover,
|
|
33
32
|
&:active,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
3
|
import { Col, Row, Table } from "react-bootstrap";
|
|
4
4
|
import { useLocation } from "react-router-dom";
|
|
5
5
|
import { isEqual } from "lodash";
|
|
@@ -30,7 +30,6 @@ export interface TableHelperComponentProps {
|
|
|
30
30
|
displayShowingSection?: boolean;
|
|
31
31
|
externalFilters?: { [key: string]: any };
|
|
32
32
|
initialOptions?: Partial<ITableProps>;
|
|
33
|
-
filteredOrdersOptions?: (value: SetStateAction<ITableProps>) => void;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
// @TODO Refactor? component to get less complexity
|
|
@@ -63,7 +62,6 @@ function TableHelperComponent(props: TableHelperComponentProps) {
|
|
|
63
62
|
displayShowingSection = true,
|
|
64
63
|
externalFilters = {},
|
|
65
64
|
initialOptions = {},
|
|
66
|
-
filteredOrdersOptions,
|
|
67
65
|
} = props;
|
|
68
66
|
|
|
69
67
|
const query = useQuery();
|
|
@@ -99,9 +97,8 @@ function TableHelperComponent(props: TableHelperComponentProps) {
|
|
|
99
97
|
useEffect(
|
|
100
98
|
() => {
|
|
101
99
|
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
!!filteredOrdersOptions
|
|
100
|
+
isEqual(optionsCache, options) &&
|
|
101
|
+
isEqual(cachedExtFilters, externalFilters)
|
|
105
102
|
)
|
|
106
103
|
return;
|
|
107
104
|
|
|
@@ -127,12 +124,12 @@ function TableHelperComponent(props: TableHelperComponentProps) {
|
|
|
127
124
|
);
|
|
128
125
|
},
|
|
129
126
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
-
[pathname, options, onRefreshFn,
|
|
127
|
+
[pathname, options, onRefreshFn, externalFilters]
|
|
131
128
|
);
|
|
132
129
|
|
|
133
130
|
// Refresh table's content on manual trigger
|
|
134
131
|
useEffect(() => {
|
|
135
|
-
if (refreshedAt === refreshAt
|
|
132
|
+
if (refreshedAt === refreshAt) {
|
|
136
133
|
return;
|
|
137
134
|
}
|
|
138
135
|
|
|
@@ -141,63 +138,34 @@ function TableHelperComponent(props: TableHelperComponentProps) {
|
|
|
141
138
|
if (onRefreshFn) {
|
|
142
139
|
onRefreshFn(options);
|
|
143
140
|
}
|
|
144
|
-
}, [onRefreshFn, options, refreshAt,
|
|
141
|
+
}, [onRefreshFn, options, refreshAt, refreshedAt]);
|
|
145
142
|
|
|
146
143
|
const onSort = (key: string) => {
|
|
147
144
|
let nextDirection = TableService.DEFAULT_SORT_DIRECTION;
|
|
148
|
-
if (sortKey === key) {
|
|
149
|
-
if (filteredOrdersOptions) {
|
|
150
|
-
filteredOrdersOptions((prevOptions) => {
|
|
151
|
-
nextDirection = TableService.getSortDirection(
|
|
152
|
-
prevOptions.sortDirection,
|
|
153
|
-
nextDirection
|
|
154
|
-
);
|
|
155
145
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
} else {
|
|
163
|
-
setOptions((prevOptions) => {
|
|
164
|
-
nextDirection = TableService.getSortDirection(
|
|
165
|
-
prevOptions.sortDirection,
|
|
166
|
-
nextDirection
|
|
167
|
-
);
|
|
146
|
+
if (sortKey === key) {
|
|
147
|
+
setOptions((prevOptions) => {
|
|
148
|
+
nextDirection = TableService.getSortDirection(
|
|
149
|
+
prevOptions.sortDirection,
|
|
150
|
+
nextDirection
|
|
151
|
+
);
|
|
168
152
|
|
|
169
|
-
|
|
170
|
-
...prevOptions,
|
|
171
|
-
sortKey: key,
|
|
172
|
-
sortDirection: nextDirection,
|
|
173
|
-
};
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
if (filteredOrdersOptions) {
|
|
178
|
-
filteredOrdersOptions((prevOptions) => ({
|
|
179
|
-
...prevOptions,
|
|
180
|
-
sortKey: key,
|
|
181
|
-
sortDirection: nextDirection,
|
|
182
|
-
}));
|
|
183
|
-
} else {
|
|
184
|
-
setOptions((prevOptions) => ({
|
|
153
|
+
return {
|
|
185
154
|
...prevOptions,
|
|
186
155
|
sortKey: key,
|
|
187
156
|
sortDirection: nextDirection,
|
|
188
|
-
}
|
|
189
|
-
}
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
} else {
|
|
160
|
+
setOptions((prevOptions) => ({
|
|
161
|
+
...prevOptions,
|
|
162
|
+
sortKey: key,
|
|
163
|
+
sortDirection: nextDirection,
|
|
164
|
+
}));
|
|
190
165
|
}
|
|
191
166
|
};
|
|
192
167
|
|
|
193
168
|
const onPerPageChange = (nextPerPage: number) => {
|
|
194
|
-
if (filteredOrdersOptions) {
|
|
195
|
-
filteredOrdersOptions((prevOptions) => ({
|
|
196
|
-
...prevOptions,
|
|
197
|
-
page: nextPerPage,
|
|
198
|
-
}));
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
169
|
setOptions((prevOptions) => ({
|
|
202
170
|
...prevOptions,
|
|
203
171
|
perPage: nextPerPage,
|
|
@@ -205,13 +173,6 @@ function TableHelperComponent(props: TableHelperComponentProps) {
|
|
|
205
173
|
};
|
|
206
174
|
|
|
207
175
|
const onPageChange = (nextPage: number) => {
|
|
208
|
-
if (filteredOrdersOptions) {
|
|
209
|
-
filteredOrdersOptions((prevOptions) => ({
|
|
210
|
-
...prevOptions,
|
|
211
|
-
page: nextPage,
|
|
212
|
-
}));
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
176
|
setOptions((prevOptions) => ({
|
|
216
177
|
...prevOptions,
|
|
217
178
|
page: nextPage,
|
|
@@ -219,24 +180,6 @@ function TableHelperComponent(props: TableHelperComponentProps) {
|
|
|
219
180
|
};
|
|
220
181
|
|
|
221
182
|
const onFilterChange = (nextFilter: string) => {
|
|
222
|
-
if (filteredOrdersOptions) {
|
|
223
|
-
filteredOrdersOptions(({ page: prevPage, ...prevOptions }) => {
|
|
224
|
-
let nextPage = prevPage;
|
|
225
|
-
|
|
226
|
-
if (
|
|
227
|
-
(!nextFilter && prevOptions.filter) ||
|
|
228
|
-
(nextFilter && !prevOptions.filter)
|
|
229
|
-
) {
|
|
230
|
-
nextPage = 1;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return {
|
|
234
|
-
...prevOptions,
|
|
235
|
-
page: nextPage,
|
|
236
|
-
filter: nextFilter,
|
|
237
|
-
};
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
183
|
setOptions(({ page: prevPage, ...prevOptions }) => {
|
|
241
184
|
let nextPage = prevPage;
|
|
242
185
|
|