@licklist/design 0.44.485-dev.52 → 0.44.485-dev.54
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":"CouponFormControl.d.ts","sourceRoot":"","sources":["../../../../src/sales/coupon/control/CouponFormControl.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAOL,eAAe,EACf,UAAU,EACX,MAAM,yDAAyD,CAAC;AAYjE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,UAAU,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,kCAG3B,eAAe,
|
|
1
|
+
{"version":3,"file":"CouponFormControl.d.ts","sourceRoot":"","sources":["../../../../src/sales/coupon/control/CouponFormControl.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAC7F,OAAO,EAOL,eAAe,EACf,UAAU,EACX,MAAM,yDAAyD,CAAC;AAYjE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,UAAU,CAAC;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,kCAG3B,eAAe,gBA4WjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),l=require("react"),n=(e=l)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-i18next"),o=require("react-bootstrap"),a=require("react-hook-form"),i=require("luxon"),m=require("@licklist/core/dist/DataMapper/Product/CouponDataMapper");exports.CouponFormControl=function(e){var u,s,d,c,E,p,g,F,v,C=e.isLoading,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),l=require("react"),n=(e=l)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-i18next"),o=require("react-bootstrap"),a=require("react-hook-form"),i=require("luxon"),m=require("@licklist/core/dist/DataMapper/Product/CouponDataMapper");exports.CouponFormControl=function(e){var u,s,d,c,E,p,g,F,v,C=e.isLoading,_=void 0!==C&&C,b=e.productGroups,f=a.useFormContext(),D=f.register,y=f.setValue,T=f.getValues,P=f.formState.errors,x=f.watch,O=r.useTranslation(["Design","Notification","App"]).t,G=t.__read(l.useState([]),2),N=G[0],R=G[1],k=x("startFrom"),L=x("validTill"),A=l.useRef(null),h=l.useRef(null),w=((u={})[m.COUPON_TYPE_FIXED]=O("Design:fixed"),u[m.COUPON_TYPE_FIXED_PER_PERSON]=O("Design:fixedPerPerson"),u[m.COUPON_TYPE_PERCENTAGE]=O("Design:percentage"),u[m.COUPON_TYPE_PERCENTAGE_PER_PERSON]=O("Design:percentagePerPerson"),u),q=((s={})[m.COUPON_TOTAL_TYPE_GROSS]=O("Design:grossTotal"),s[m.COUPON_TOTAL_TYPE_TOTAL]=O("Design:depositTotal"),s);return l.useEffect((function(){R(T("productGroupIds"))}),[T]),l.useEffect((function(){y("productGroupIds",N)}),[T,y,N]),n.createElement(o.Row,null,n.createElement(o.Col,{md:5},n.createElement("h2",{className:"mb-5"},O("Design:coupon")),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:name")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==P.name},D("name",{required:O("Validation:fieldRequired",{attribute:O("Design:name")})}),{disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(d=null==P?void 0:P.name)||void 0===d?void 0:d.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:couponCode")),n.createElement(o.Form.Control,t.__assign({isInvalid:void 0!==P.code},D("code",{required:O("Validation:fieldRequired",{attribute:O("Design:code")})}),{disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(c=null==P?void 0:P.code)||void 0===c?void 0:c.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:discountType")),n.createElement(o.Form.Control,t.__assign({},D("discountType",{required:!0}),{as:"select",defaultValue:null!==(E=T("discountType"))&&void 0!==E?E:1,disabled:_}),Object.keys(w).map((function(e){return n.createElement("option",{value:e,key:e},w[e])}))))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:discount")),n.createElement(o.Form.Control,t.__assign({type:"number",isInvalid:void 0!==P.discount},D("discount",{required:O("Validation:fieldRequired",{attribute:O("Design:discount")})}),{disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(p=null==P?void 0:P.discount)||void 0===p?void 0:p.message)))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:applyOn")),n.createElement(o.Form.Control,t.__assign({},D("totalType",{required:!0}),{as:"select",defaultValue:null!==(g=T("totalType"))&&void 0!==g?g:1,disabled:_}),Object.keys(q).map((function(e){return n.createElement("option",{value:e,key:e},q[e])}))))))),n.createElement(o.Col,{md:{span:5,offset:1}},n.createElement("h2",{className:"mb-5"},O("Design:limitations")),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:startFrom")),n.createElement(o.Form.Control,t.__assign({type:"date"},D("startFrom"),{value:k,isInvalid:void 0!==P.startFrom,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();y("startFrom",t)},className:k&&"date-input-with-value",ref:A,onClick:function(){var e;return null===(e=null==A?void 0:A.current)||void 0===e?void 0:e.showPicker()},disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(F=null==P?void 0:P.startFrom)||void 0===F?void 0:F.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:validTill")),n.createElement(o.Form.Control,t.__assign({type:"date"},D("validTill"),{value:L,onChange:function(e){var t=i.DateTime.fromSQL(e.target.value).toISODate();y("validTill",t)},ref:h,className:L&&"date-input-with-value",onClick:function(){var e;return null===(e=null==h?void 0:h.current)||void 0===e?void 0:e.showPicker()},disabled:_}))))),b&&(null==b?void 0:b.length)>0&&n.createElement(o.Row,null,n.createElement(o.Col,{md:12},n.createElement("h5",{className:"mt-4"},O("Design:productGroups")),n.createElement(o.Form.Group,{className:"d-flex flex-wrap justify-content-between mt-4 mb-5"},null==b?void 0:b.map((function(e){var l,r,a=null!==(r=null===(l=T("productGroupIds"))||void 0===l?void 0:l.includes(String(e.id)))&&void 0!==r&&r;return n.createElement(o.Form.Check,{key:e.id,label:e.name,defaultChecked:a,disabled:_,onChange:function(l){l.target.checked?R((function(l){return Array.from(new Set(t.__spreadArray(t.__spreadArray([],t.__read(l),!1),[String(e.id)],!1)))})):R((function(t){return t.filter((function(t){return String(e.id)!==t}))}))}})})),n.createElement(o.Form.Control,t.__assign({},D("productGroupIds"),{hidden:!0,value:N,disabled:_}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:totalCoupons")),n.createElement(o.Form.Control,t.__assign({},D("totalCoupons"),{type:"number",isInvalid:void 0!==P.totalCoupons,disabled:_})),n.createElement(o.Form.Control.Feedback,{type:"invalid"},null===(v=null==P?void 0:P.totalCoupons)||void 0===v?void 0:v.message))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:usesPerUser")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("usesPerUser"),{disabled:_}))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:useAgain")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("useAgain"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:useAgainExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:usesPerUserDay")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("usesPerUserDay"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:usesPerUserDayExplanation"))))),n.createElement(o.Row,null,n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:minAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("minAmount"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:minAmountExplanation")))),n.createElement(o.Col,{md:6},n.createElement(o.Form.Group,null,n.createElement(o.Form.Label,null,O("Design:maxAmount")),n.createElement(o.Form.Control,t.__assign({type:"number"},D("maxAmount"),{disabled:_})),n.createElement(o.Form.Text,{className:"text-muted"},O("Design:maxAmountExplanation")))))))};
|
package/package.json
CHANGED
|
@@ -233,6 +233,7 @@ export const CouponFormControl = ({
|
|
|
233
233
|
<Form.Control
|
|
234
234
|
type="date"
|
|
235
235
|
{...register("validTill")}
|
|
236
|
+
value={validTillValue}
|
|
236
237
|
onChange={(e) => {
|
|
237
238
|
const date = DateTime.fromSQL(e.target.value).toISODate();
|
|
238
239
|
setValue("validTill", date);
|
|
@@ -331,6 +332,7 @@ export const CouponFormControl = ({
|
|
|
331
332
|
<Form.Group>
|
|
332
333
|
<Form.Label>{t("Design:totalCoupons")}</Form.Label>
|
|
333
334
|
<Form.Control
|
|
335
|
+
{...register("totalCoupons")}
|
|
334
336
|
type="number"
|
|
335
337
|
isInvalid={errors.totalCoupons !== undefined}
|
|
336
338
|
disabled={isLoading}
|