@licklist/design 0.44.485-dev.65 → 0.44.485-dev.67
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/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +1 -1
- package/dist/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +1 -1
- package/dist/provider/provider-details-input/ProviderDetailsInput.d.ts.map +1 -1
- package/dist/provider/provider-details-input/ProviderDetailsInput.js +1 -1
- package/dist/styles/events/EventVenueMap.scss +1 -1
- package/package.json +1 -1
- package/src/events/edit-event-modal/IntervalInput.tsx +7 -1
- package/src/product-set/hooks/useSortableTreeFunctions.ts +1 -1
- package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +24 -27
- package/src/provider/constants.ts +1 -1
- package/src/provider/provider-details-input/ProviderDetailsInput.tsx +18 -1
- package/src/sortable-tree/SortableTreeItem.tsx +1 -1
- package/src/styles/events/EventVenueMap.scss +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntervalInput.d.ts","sourceRoot":"","sources":["../../../src/events/edit-event-modal/IntervalInput.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAC;AAIzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,UAAU,kBAAkB;IAC1B,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,WAAW,GACZ,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"IntervalInput.d.ts","sourceRoot":"","sources":["../../../src/events/edit-event-modal/IntervalInput.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAC;AAIzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,UAAU,kBAAkB;IAC1B,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,WAAW,GACZ,EAAE,kBAAkB,eAkJpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-i18next"),o=require("react-bootstrap"),i=require("react-hook-form"),l=require("@react-aria/utils"),u=require("../../static/WarningMessage.js"),d=require("luxon");require("../../static/index.js");var s=require("react-intl"),c=require("../../recurrence-input/RecurrenceInput.js");var m=function(){var e=i.useFormContext().watch,n=e("start"),a=e("end"),o=s.useIntl(),l=o.formatList,u=o.formatNumber;return r.useMemo((function(){var e=d.Interval.fromDateTimes(d.DateTime.fromISO(n),d.DateTime.fromISO(a)).toDuration(["days","hours","minutes"]);if(e.isValid){var r=function(e,t){return u(e,{style:"unit",unit:t,unitDisplay:"long"})},o=[[e.days,"day"],[e.hours,"hour"],[e.minutes,"minute"]].filter((function(e){return t.__read(e,1)[0]}));return l(o.map((function(e){return r.apply(void 0,t.__spreadArray([],t.__read(e),!1))})),{style:"long",type:"unit"})}}),[n,a])},f=function(){var e=i.useFormContext().watch,t=a.useTranslation(["Design","Validation"]).t,n=e("start"),o=e("end");return{start:r.useMemo((function(){return{required:t("Validation:fieldRequired",{attribute:t("start")}),validate:function(e){return d.DateTime.fromISO(e).diffNow().toMillis()>0||t("Validation:fieldValidEventStart")}}}),[]),end:r.useMemo((function(){return{validate:function(e){return!e||(d.DateTime.fromISO(e).diff(d.DateTime.fromISO(n)).toMillis()>0||t("Validation:fieldValidEventEnd"))}}}),[n,o])}};exports.IntervalInput=function(e){var s,v,p=e.disabled,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-i18next"),o=require("react-bootstrap"),i=require("react-hook-form"),l=require("@react-aria/utils"),u=require("../../static/WarningMessage.js"),d=require("luxon");require("../../static/index.js");var s=require("react-intl"),c=require("../../recurrence-input/RecurrenceInput.js");var m=function(){var e=i.useFormContext().watch,n=e("start"),a=e("end"),o=s.useIntl(),l=o.formatList,u=o.formatNumber;return r.useMemo((function(){var e=d.Interval.fromDateTimes(d.DateTime.fromISO(n),d.DateTime.fromISO(a)).toDuration(["days","hours","minutes"]);if(e.isValid){var r=function(e,t){return u(e,{style:"unit",unit:t,unitDisplay:"long"})},o=[[e.days,"day"],[e.hours,"hour"],[e.minutes,"minute"]].filter((function(e){return t.__read(e,1)[0]}));return l(o.map((function(e){return r.apply(void 0,t.__spreadArray([],t.__read(e),!1))})),{style:"long",type:"unit"})}}),[n,a])},f=function(){var e=i.useFormContext().watch,t=a.useTranslation(["Design","Validation"]).t,n=e("start"),o=e("end");return{start:r.useMemo((function(){return{required:t("Validation:fieldRequired",{attribute:t("start")}),validate:function(e){return d.DateTime.fromISO(e).diffNow().toMillis()>0||t("Validation:fieldValidEventStart")}}}),[]),end:r.useMemo((function(){return{validate:function(e){return!e||(d.DateTime.fromISO(e).diff(d.DateTime.fromISO(n)).toMillis()>0||t("Validation:fieldValidEventEnd"))}}}),[n,o])}};exports.IntervalInput=function(e){var s,v,p=e.disabled,g=void 0!==p&&p,E=e.editedProductSet,I=e.productSetId,F=e.productSets,C=a.useTranslation(["Design","Validation"]).t,h=i.useFormContext(),b=h.register,_=h.formState.errors,y=h.watch,q=h.control,S=h.trigger,D=h.setValue,T=m(),k=f(),x=y("rrule"),M=y("start"),O=y("end"),V=t.__read(r.useState(Boolean(x)),2),w=V[0],R=V[1],B=t.__read(r.useState(!1),2),j=B[0],G=B[1],P=l.useId(),L=r.useRef(null),N=r.useRef(null);return r.useEffect((function(){E&&R(!1)}),[E]),r.useEffect((function(){if(F){var e=F.find((function(e){return E&&(null==e?void 0:e.id)===(null==E?void 0:E.id)||Boolean(null==e?void 0:e.parentMenuId)&&(null==e?void 0:e.id)===I}));G(Boolean(e))}}),[F,I,G,E]),n.createElement(n.Fragment,null,n.createElement(o.Form.Row,{className:"interval-container"},n.createElement(o.Form.Group,{as:o.Col,controlId:"start"},n.createElement(o.Form.Label,null,C("start")),n.createElement(o.Form.Control,t.__assign({type:"datetime-local"},b("start",k.start),{value:M,name:"start",required:!0,isInvalid:Boolean(_.start),onChange:function(e){var t=e.target.value;R(!1),D("start",t),d.DateTime.fromISO(O).diff(d.DateTime.fromISO(t)).toMillis()<0&&D("end",t)},onClick:function(){var e;return null===(e=null==L?void 0:L.current)||void 0===e?void 0:e.showPicker()},ref:L,disabled:g})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(s=_.start)||void 0===s?void 0:s.message)),n.createElement(o.Form.Group,{as:o.Col,controlId:"end"},n.createElement(o.Form.Label,null,C("end")),n.createElement(o.Form.Control,t.__assign({type:"datetime-local"},b("end",k.end),{value:O,name:"end",onChange:function(e){return function(e){D("end",e),S("end")}(e.target.value)},min:M,isInvalid:Boolean(_.end),onClick:function(){var e;return null===(e=null==N?void 0:N.current)||void 0===e?void 0:e.showPicker()},ref:N,disabled:g})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(v=_.end)||void 0===v?void 0:v.message),n.createElement(o.Form.Text,{muted:!0},T&&"lasts ".concat(T)))),M&&n.createElement(o.Form.Group,{controlId:P},n.createElement(o.Form.Check,{label:"Recurrent",custom:!0,checked:w,onChange:function(e){var t=e.target.checked;R(t)},disabled:g||Boolean(E)}),!w&&n.createElement(o.Form.Text,{muted:!0},C("reccurentDescription",{item:C("event")}))),j&&n.createElement(u.default,{message:C("recurrentOverridesWarining")}),w&&M&&n.createElement(o.Form.Group,null,n.createElement(i.Controller,{control:q,name:"rrule",render:function(e){var t=e.field,r=t.value,a=t.onChange;return n.createElement(c.RecurrenceInput,{value:r,onChange:a,date:M,disabled:g})}})))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductQuantityRechargingControl.d.ts","sourceRoot":"","sources":["../../../../src/product-set/product/quantity/ProductQuantityRechargingControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAStE,MAAM,WAAW,sCAAuC,SAAQ,UAAU;IACxE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qCAAqC,CAAC,CAAC,CACtD,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,UAAU,EACnE,KAAK,EAAE,qCAAqC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"ProductQuantityRechargingControl.d.ts","sourceRoot":"","sources":["../../../../src/product-set/product/quantity/ProductQuantityRechargingControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAStE,MAAM,WAAW,sCAAuC,SAAQ,UAAU;IACxE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qCAAqC,CAAC,CAAC,CACtD,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,UAAU,EACnE,KAAK,EAAE,qCAAqC,CAAC,CAAC,CAAC,eA+FhD"}
|
|
@@ -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("
|
|
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"),a=e(r),n=require("react-i18next"),o=require("react-bootstrap"),i=require("react-hook-form"),l=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@react-aria/utils"),c=require("../../../assets/dashboard/increment.svg.js"),s=e(require("react-bootstrap/InputGroup"));exports.ProductQuantityRechargingControl=function(e){var m=e.isLoading,d=void 0!==m&&m,f=e.fieldNamePrefix,b=e.disabled,p=void 0!==b&&b,v=e.onFocus,y=i.useFormContext(),g=y.control,E=y.trigger,F=y.watch,Q=y.register,q=y.formState.errors,x=n.useTranslation("Design").t,C=u.useId(),h=F("".concat(f,".maxQuantity"));return r.useEffect((function(){E("".concat(f,".totalQuantity"))}),[h]),a.createElement(a.Fragment,null,a.createElement(o.Form.Group,{controlId:C},a.createElement(o.Form.Label,null,x("totalQuantity")),a.createElement(s,{hasValidation:!0},a.createElement(s.Prepend,null,a.createElement(s.Text,{className:"py-0 px-3"},a.createElement(c.ReactComponent,null))),a.createElement(i.Controller,{render:function(e){var r=e.field,n=r.value,i=r.onChange,u=r.ref;return a.createElement(o.Form.Control,t.__assign({ref:u,type:"number",min:0,step:1},Q("".concat(f,".totalQuantity"),{validate:function(e){var t=Number(h),r=Number(e);return r<1?x("Validation:fieldMinNumber",{attribute:x("totalQuantity"),min:1}):!(r<t)||x("Validation:fieldTotalNumber",{attribute:x("totalQuantity"),max:x("maxOrderQuantity")})}}),{value:n,onFocus:v,onChange:i,isInvalid:l.isInvalid("".concat(f,".totalQuantity"),q),disabled:d||p}))},control:g,name:"".concat(f,".totalQuantity"),rules:p?{required:!1,min:0}:{}}),a.createElement(o.Form.Control.Feedback,{type:"invalid"},l.getErrors("".concat(f,".totalQuantity"),q)))))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProviderDetailsInput.d.ts","sourceRoot":"","sources":["../../../src/provider/provider-details-input/ProviderDetailsInput.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAE7E,OAAO,EAAa,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;CACxB,GAAG,wBAAwB,CAAC;AAE7B,MAAM,MAAM,yBAAyB,GAAG;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CAClD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,gBAAqB,EACrB,SAAc,GACf,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"ProviderDetailsInput.d.ts","sourceRoot":"","sources":["../../../src/provider/provider-details-input/ProviderDetailsInput.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAE7E,OAAO,EAAa,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;CACxB,GAAG,wBAAwB,CAAC;AAE7B,MAAM,MAAM,yBAAyB,GAAG;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CAClD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,gBAAqB,EACrB,SAAc,GACf,EAAE,yBAAyB,eA8J3B"}
|
|
@@ -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 r=require("tslib"),t=require("react"),i=e(t),n=require("react-i18next"),a=e(require("@licklist/plugins/dist/context/app/hooks/useNotification")),o=require("react-bootstrap"),l=require("react-hook-form"),s=e(require("@licklist/plugins/dist/services/Form/HookFormService")),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("react"),i=e(t),n=require("react-i18next"),a=e(require("@licklist/plugins/dist/context/app/hooks/useNotification")),o=require("react-bootstrap"),l=require("react-hook-form"),s=e(require("@licklist/plugins/dist/services/Form/HookFormService")),d=require("@react-aria/utils"),m=require("../../typeahead/Typeahead.js"),u=require("../constants.js"),c=require("../provider-links-input/ProviderLinksInput.js");exports.ProviderDetailsInput=function(e){var p,E,g,v,F,I,h=e.companiesOptions,b=void 0===h?[]:h,C=e.linkTypes,_=void 0===C?[]:C,q=l.useFormContext(),y=q.register,T=q.watch,f=q.trigger,D=q.formState.errors,A=n.useTranslation(["App","Design","Validation"]).t,k=a(),R=d.useId(),M=d.useId(),S=d.useId(),L=d.useId(),w=d.useId(),G=d.useId(),H=T("description");return t.useEffect((function(){u.MAX_DESCRIPTION_CHARACTERS_LENGTH>H.length||(f("description"),k.danger({title:A("App:warning"),message:A("Validation:descriptionTooManyCharactersMessage",{max:u.MAX_DESCRIPTION_CHARACTERS_LENGTH})}))}),[H.length]),i.createElement(i.Fragment,null,i.createElement(o.Form.Group,{controlId:R},i.createElement(o.Form.Label,null,A("Design:name")),i.createElement(o.Form.Control,r.__assign({},y("name",{required:A("Validation:fieldRequired",{attribute:A("Design:name")})}),{name:"name",required:!0,isInvalid:Boolean(D.name)})),i.createElement(o.Form.Control.Feedback,{type:"invalid"},s.hasError(D.name,"required")&&(null===(p=D.name)||void 0===p?void 0:p.message))),i.createElement(o.Form.Group,{controlId:M},i.createElement(o.Form.Label,null,A("Design:description")),i.createElement(o.Form.Control,r.__assign({},y("description",{validate:function(e){return!(e.length>u.MAX_DESCRIPTION_CHARACTERS_LENGTH)||A("Validation:descriptionTooManyCharactersMessage",{max:u.MAX_DESCRIPTION_CHARACTERS_LENGTH})}}),{as:"textarea",name:"description",rows:6,isInvalid:Boolean(D.description)})),i.createElement(o.Form.Control.Feedback,{type:"invalid"},s.hasError(D.description,"validate")&&(null===(E=D.description)||void 0===E?void 0:E.message))),i.createElement(o.Form.Group,{controlId:S},i.createElement(o.Form.Label,null,A("Design:email")),i.createElement(o.Form.Control,r.__assign({},y("email",{required:A("Validation:fieldRequired",{attribute:A("Design:email")}),pattern:{value:/^\S+@\S+$/,message:A("Validation:fieldValidEmail",{attribute:A("Design:email")})}}),{name:"email",type:"email",inputMode:"email",isInvalid:Boolean(D.email)})),i.createElement(o.Form.Control.Feedback,{type:"invalid"},s.hasError(D.email,"required")&&(null===(g=D.email)||void 0===g?void 0:g.message),s.hasError(D.email,"pattern")&&(null===(v=D.email)||void 0===v?void 0:v.message))),i.createElement(o.Form.Group,{controlId:L},i.createElement(o.Form.Label,null,A("Design:phone")),i.createElement(o.Form.Control,r.__assign({},y("phone",{required:A("Validation:fieldRequired",{attribute:A("Design:phone")})}),{name:"phone",type:"tel",inputMode:"tel",isInvalid:Boolean(D.phone)})),i.createElement(o.Form.Control.Feedback,{type:"invalid"},s.hasError(D.phone,"required")&&(null===(F=D.phone)||void 0===F?void 0:F.message))),i.createElement(o.Form.Group,{controlId:w},i.createElement(o.Form.Label,null,A("Design:website")),i.createElement(o.Form.Control,r.__assign({},y("website",{pattern:{value:/\S+\.\S+/,message:A("Validation:fieldInvalid",{attribute:A("Design:website")})}}),{name:"website",type:"url",inputMode:"url",isInvalid:Boolean(D.website)})),i.createElement(o.Form.Control.Feedback,{type:"invalid"},s.hasError(D.website,"pattern")&&(null===(I=D.website)||void 0===I?void 0:I.message))),b.length>1&&i.createElement(o.Form.Group,{controlId:G},i.createElement(o.Form.Label,null,A("Design:company")),i.createElement(m.Typeahead,{name:"company",options:b,placeholder:A("App:select"),noOptionsMessage:A("App:noMatchesFound")})),_.length>0&&i.createElement(c.ProviderLinksInput,{linkTypes:_}))};
|
package/package.json
CHANGED
|
@@ -37,6 +37,7 @@ export function IntervalInput({
|
|
|
37
37
|
formState: { errors },
|
|
38
38
|
watch,
|
|
39
39
|
control,
|
|
40
|
+
trigger,
|
|
40
41
|
setValue,
|
|
41
42
|
} = useFormContext<IntervalInputValues>();
|
|
42
43
|
|
|
@@ -84,6 +85,11 @@ export function IntervalInput({
|
|
|
84
85
|
setIsOverriden(Boolean(isOverridenProductSet));
|
|
85
86
|
}, [productSets, productSetId, setIsOverriden, editedProductSet]);
|
|
86
87
|
|
|
88
|
+
const onChangeEndDate = (nextEndtDate: string) => {
|
|
89
|
+
setValue("end", nextEndtDate);
|
|
90
|
+
trigger("end");
|
|
91
|
+
};
|
|
92
|
+
|
|
87
93
|
return (
|
|
88
94
|
<>
|
|
89
95
|
<Form.Row className="interval-container">
|
|
@@ -114,7 +120,7 @@ export function IntervalInput({
|
|
|
114
120
|
value={end}
|
|
115
121
|
name="end"
|
|
116
122
|
onChange={({ target: { value: nextEndtDate } }) =>
|
|
117
|
-
|
|
123
|
+
onChangeEndDate(nextEndtDate)
|
|
118
124
|
}
|
|
119
125
|
min={start}
|
|
120
126
|
isInvalid={Boolean(errors.end)}
|
|
@@ -34,42 +34,19 @@ export function ProductQuantityRechargingControl<T extends FormValues>(
|
|
|
34
34
|
} = props;
|
|
35
35
|
const {
|
|
36
36
|
control,
|
|
37
|
-
|
|
38
|
-
setError,
|
|
37
|
+
trigger,
|
|
39
38
|
watch,
|
|
39
|
+
register,
|
|
40
40
|
formState: { errors },
|
|
41
41
|
} = useFormContext<T>();
|
|
42
42
|
const { t } = useTranslation("Design");
|
|
43
43
|
const totalQuantityId = useId();
|
|
44
44
|
|
|
45
45
|
const maxQuantityValue = watch(`${fieldNamePrefix}.maxQuantity` as Path<T>);
|
|
46
|
-
const totalQuantityValue = watch(
|
|
47
|
-
`${fieldNamePrefix}.totalQuantity` as Path<T>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
46
|
|
|
51
47
|
useEffect(() => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
type: HookFormService.manualErrorType,
|
|
55
|
-
message: t("Validation:fieldMinNumber", {
|
|
56
|
-
attribute: t("totalQuantity"),
|
|
57
|
-
min: 1,
|
|
58
|
-
}),
|
|
59
|
-
});
|
|
60
|
-
} else if (Number(maxQuantityValue) > Number(totalQuantityValue)) {
|
|
61
|
-
setError(`${fieldNamePrefix}.totalQuantity` as Path<T>, {
|
|
62
|
-
type: HookFormService.manualErrorType,
|
|
63
|
-
message: t("Validation:fieldTotalNumber", {
|
|
64
|
-
attribute: t("totalQuantity"),
|
|
65
|
-
max: t("maxOrderQuantity"),
|
|
66
|
-
}),
|
|
67
|
-
});
|
|
68
|
-
} else {
|
|
69
|
-
clearErrors(`${fieldNamePrefix}.totalQuantity` as Path<T>);
|
|
70
|
-
}
|
|
71
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
|
-
}, [totalQuantityValue, maxQuantityValue, setError, clearErrors]);
|
|
48
|
+
trigger(`${fieldNamePrefix}.totalQuantity` as Path<T>);
|
|
49
|
+
}, [maxQuantityValue]);
|
|
73
50
|
|
|
74
51
|
return (
|
|
75
52
|
<>
|
|
@@ -90,6 +67,26 @@ export function ProductQuantityRechargingControl<T extends FormValues>(
|
|
|
90
67
|
type="number"
|
|
91
68
|
min={0}
|
|
92
69
|
step={1}
|
|
70
|
+
{...register(`${fieldNamePrefix}.totalQuantity` as Path<T>, {
|
|
71
|
+
validate: (value) => {
|
|
72
|
+
const min = 1;
|
|
73
|
+
const maxQuantity = Number(maxQuantityValue);
|
|
74
|
+
const totalQuantity = Number(value);
|
|
75
|
+
if (totalQuantity < min) {
|
|
76
|
+
return t("Validation:fieldMinNumber", {
|
|
77
|
+
attribute: t("totalQuantity"),
|
|
78
|
+
min: 1,
|
|
79
|
+
}) as string;
|
|
80
|
+
}
|
|
81
|
+
if (totalQuantity < maxQuantity) {
|
|
82
|
+
return t("Validation:fieldTotalNumber", {
|
|
83
|
+
attribute: t("totalQuantity"),
|
|
84
|
+
max: t("maxOrderQuantity"),
|
|
85
|
+
}) as string;
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
},
|
|
89
|
+
})}
|
|
93
90
|
value={value as string}
|
|
94
91
|
onFocus={onFocus}
|
|
95
92
|
onChange={onChange}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const MAX_DESCRIPTION_CHARACTERS_LENGTH = 25500;
|
|
1
|
+
export const MAX_DESCRIPTION_CHARACTERS_LENGTH = 25500;
|
|
@@ -36,6 +36,7 @@ export function ProviderDetailsInput({
|
|
|
36
36
|
const {
|
|
37
37
|
register,
|
|
38
38
|
watch,
|
|
39
|
+
trigger,
|
|
39
40
|
formState: { errors },
|
|
40
41
|
} = useFormContext<ProviderDetailsInputValues>();
|
|
41
42
|
const { t } = useTranslation(["App", "Design", "Validation"]);
|
|
@@ -52,6 +53,7 @@ export function ProviderDetailsInput({
|
|
|
52
53
|
|
|
53
54
|
useEffect(() => {
|
|
54
55
|
if (MAX_DESCRIPTION_CHARACTERS_LENGTH > description.length) return;
|
|
56
|
+
trigger("description");
|
|
55
57
|
notification.danger({
|
|
56
58
|
title: t("App:warning"),
|
|
57
59
|
message: t("Validation:descriptionTooManyCharactersMessage", {
|
|
@@ -83,11 +85,26 @@ export function ProviderDetailsInput({
|
|
|
83
85
|
<Form.Group controlId={descriptionId}>
|
|
84
86
|
<Form.Label>{t("Design:description")}</Form.Label>
|
|
85
87
|
<Form.Control
|
|
86
|
-
{...register("description"
|
|
88
|
+
{...register("description", {
|
|
89
|
+
validate: (value) => {
|
|
90
|
+
const descriptionLength = value.length;
|
|
91
|
+
if (descriptionLength > MAX_DESCRIPTION_CHARACTERS_LENGTH) {
|
|
92
|
+
return t("Validation:descriptionTooManyCharactersMessage", {
|
|
93
|
+
max: MAX_DESCRIPTION_CHARACTERS_LENGTH,
|
|
94
|
+
}) as string;
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
},
|
|
98
|
+
})}
|
|
87
99
|
as="textarea"
|
|
88
100
|
name="description"
|
|
89
101
|
rows={6}
|
|
102
|
+
isInvalid={Boolean(errors.description)}
|
|
90
103
|
/>
|
|
104
|
+
<Form.Control.Feedback type="invalid">
|
|
105
|
+
{HookFormService.hasError(errors.description, "validate") &&
|
|
106
|
+
errors.description?.message}
|
|
107
|
+
</Form.Control.Feedback>
|
|
91
108
|
</Form.Group>
|
|
92
109
|
|
|
93
110
|
<Form.Group controlId={emailId}>
|