@licklist/design 0.44.486-dev.65 → 0.44.486-dev.66

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,11 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { FieldValues, RefCallBack, UseFormClearErrors } from "react-hook-form";
3
+ import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
3
4
  import { Product, ProductCategory } from "../../../../../../types";
4
5
  interface FormOrderItem {
5
6
  id: number;
6
7
  name: string;
7
8
  price: number;
8
9
  productsCategoryId: number;
10
+ zoneId?: Zone["id"];
9
11
  deposit?: number | null;
10
12
  quantity: number;
11
13
  capacity?: number | null;
@@ -20,6 +22,6 @@ interface ProductQuantityInputProps {
20
22
  invalid: boolean;
21
23
  productInfo: FormOrderItem;
22
24
  }
23
- export declare const ProductQuantityInput: ({ product, category, onChange, clearErrors, refCallback, productInfo, invalid, deposit, }: ProductQuantityInputProps) => JSX.Element;
25
+ export declare const ProductQuantityInput: ({ product, category, onChange: _onChange, clearErrors, refCallback, productInfo, invalid, deposit, }: ProductQuantityInputProps) => JSX.Element;
24
26
  export {};
25
27
  //# sourceMappingURL=ProductQuantityInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductQuantityInput.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEnE,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,UAAU,yBAAyB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,aAAa,CAAC;CAC5B;AAED,eAAO,MAAM,oBAAoB,8FAS9B,yBAAyB,gBAqF3B,CAAC"}
1
+ {"version":3,"file":"ProductQuantityInput.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAE9E,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEnE,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,UAAU,yBAAyB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,aAAa,CAAC;CAC5B;AAED,eAAO,MAAM,oBAAoB,yGAS9B,yBAAyB,gBAgE3B,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")),i=require("react-i18next"),n=require("react-bootstrap"),a=e(require("clsx")),r=require("../NumberInput/NumberInput.js");exports.ProductQuantityInput=function(e){var o=e.product,c=e.category,u=e.onChange,d=e.clearErrors,l=e.refCallback,p=e.productInfo,s=e.invalid,y=e.deposit,m=i.useTranslation("Design").t;return o.isSoldOut?t.createElement("div",{className:"iframe-event__sold-out-wrapper"},m("Design:soldOut")):1===(null==o?void 0:o.maxAmount)?t.createElement(n.Button,{ref:l,disabled:o.isSoldOut,className:a("iframe-event__".concat((null==p?void 0:p.quantity)?"unselect-product":"select-product"),s&&"error"),onClick:function(){u({id:o.id,name:o.name,deposit:y,price:o.price,productsCategoryId:c.id,quantity:(null==p?void 0:p.quantity)?0:1,capacity:null==o?void 0:o.capacity})}},m("Design:".concat((null==p?void 0:p.quantity)?"unselect":"select"))):t.createElement(r.NumberInput,{ref:l,onChange:function(e){u({id:o.id,name:o.name,deposit:y,price:o.price,productsCategoryId:c.id,quantity:e||null,capacity:null==o?void 0:o.capacity}),d("".concat(o.id))},onArrowDown:function(){u({id:o.id,name:o.name,deposit:y,price:o.price,productsCategoryId:c.id,quantity:(null==p?void 0:p.quantity)-1||0,capacity:null==o?void 0:o.capacity}),d("".concat(o.id))},onArrowUp:function(){var e;u({id:o.id,name:o.name,deposit:y,price:o.price,productsCategoryId:c.id,quantity:(null!==(e=null==p?void 0:p.quantity)&&void 0!==e?e:0)+1,capacity:null==o?void 0:o.capacity}),d("".concat(o.id))},min:0,placeholder:"0",disabled:o.isSoldOut,value:null==p?void 0:p.quantity,className:a(s&&"error")})};
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")),n=require("react-i18next"),r=require("react-bootstrap"),o=e(require("clsx")),i=require("../NumberInput/NumberInput.js");exports.ProductQuantityInput=function(e){var u=e.product,a=e.category,l=e.onChange,c=e.clearErrors,d=e.refCallback,s=e.productInfo,p=e.invalid,v=e.deposit,f=n.useTranslation("Design").t,m=function(e){var t;l({id:u.id,name:u.name,deposit:v,price:u.price,productsCategoryId:a.id,zoneId:null===(t=a.zone)||void 0===t?void 0:t.id,quantity:e,capacity:null==u?void 0:u.capacity})};return u.isSoldOut?t.createElement("div",{className:"iframe-event__sold-out-wrapper"},f("Design:soldOut")):1===(null==u?void 0:u.maxAmount)?t.createElement(r.Button,{ref:d,disabled:u.isSoldOut,className:o("iframe-event__".concat((null==s?void 0:s.quantity)?"unselect-product":"select-product"),p&&"error"),onClick:function(){return m((null==s?void 0:s.quantity)?0:1)}},f("Design:".concat((null==s?void 0:s.quantity)?"unselect":"select"))):t.createElement(i.NumberInput,{ref:d,onChange:function(e){m(e||null),c("".concat(u.id))},onArrowDown:function(){m((null==s?void 0:s.quantity)-1||0),c("".concat(u.id))},onArrowUp:function(){var e;m((null!==(e=null==s?void 0:s.quantity)&&void 0!==e?e:0)+1),c("".concat(u.id))},min:0,placeholder:"0",disabled:u.isSoldOut,value:null==s?void 0:s.quantity,className:o(p&&"error")})};
@@ -1 +1 @@
1
- {"version":3,"file":"ProductSetForm.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductSetForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAI1F,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAC;AAC3F,OAA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c,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAsB,EACtB,YAAiB,EACjB,4BAA4B,EAC5B,KAAK,EACL,cAAc,EACd,SAAS,EACT,GAAG,MAAM,EACV,EAAE,mBAAmB,eA2HrB"}
1
+ {"version":3,"file":"ProductSetForm.d.ts","sourceRoot":"","sources":["../../../src/product-set/form/ProductSetForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAC;AAI1F,OAAO,EAAE,WAAW,EAAE,MAAM,8DAA8D,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAK5E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oFAAoF,CAAC;AACtI,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAEtF,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAG5D,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;CACZ;AACD,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,MAAM,EACN,uBAAuB;IACzB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,mBACf,SAAQ,aAAa,EACnB,uBAAuB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,mBAAmB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC5D,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC5D,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,4BAA4B,CAAC,EAAE,gCAAgC,CAAC,sBAAsB,CAAC,CAAC;IACxF,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAsB,EACtB,YAAiB,EACjB,4BAA4B,EAC5B,KAAK,EACL,cAAc,EACd,SAAS,EACT,GAAG,MAAM,EACV,EAAE,mBAAmB,eA0HrB"}
@@ -4,5 +4,5 @@ export type ZoneControlProps = {
4
4
  isLoading: boolean;
5
5
  workHours?: WorkHour[];
6
6
  };
7
- export declare const ZoneControl: ({ isLoading, }: ZoneControlProps) => JSX.Element;
7
+ export declare const ZoneControl: ({ isLoading }: ZoneControlProps) => JSX.Element;
8
8
  //# sourceMappingURL=ZoneControl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ZoneControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/ZoneControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAStF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW,mBAErB,gBAAgB,gBA0BlB,CAAC"}
1
+ {"version":3,"file":"ZoneControl.d.ts","sourceRoot":"","sources":["../../../../src/zone/form/components/ZoneControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,4DAA4D,CAAC;AAStF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW,kBAAmB,gBAAgB,gBA0B1D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.486-dev.65",
3
+ "version": "0.44.486-dev.66",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -3,6 +3,7 @@ import clsx from "clsx";
3
3
  import { Button } from "react-bootstrap";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { FieldValues, RefCallBack, UseFormClearErrors } from "react-hook-form";
6
+ import { Zone } from "@licklist/core/dist/DataMapper/Provider/ZoneDataMapper";
6
7
  import { NumberInput } from "../NumberInput";
7
8
  import { Product, ProductCategory } from "../../../../../../types";
8
9
 
@@ -11,6 +12,7 @@ interface FormOrderItem {
11
12
  name: string;
12
13
  price: number;
13
14
  productsCategoryId: number;
15
+ zoneId?: Zone["id"];
14
16
  deposit?: number | null;
15
17
  quantity: number;
16
18
  capacity?: number | null;
@@ -30,7 +32,7 @@ interface ProductQuantityInputProps {
30
32
  export const ProductQuantityInput = ({
31
33
  product,
32
34
  category,
33
- onChange,
35
+ onChange: _onChange,
34
36
  clearErrors,
35
37
  refCallback,
36
38
  productInfo,
@@ -39,14 +41,15 @@ export const ProductQuantityInput = ({
39
41
  }: ProductQuantityInputProps) => {
40
42
  const { t } = useTranslation("Design");
41
43
 
42
- const onClick = () => {
43
- onChange({
44
+ const onChange = (quantity: number | null) => {
45
+ _onChange({
44
46
  id: product.id,
45
47
  name: product.name,
46
48
  deposit,
47
49
  price: product.price,
48
50
  productsCategoryId: category.id,
49
- quantity: productInfo?.quantity ? 0 : 1,
51
+ zoneId: category.zone?.id,
52
+ quantity,
50
53
  capacity: product?.capacity,
51
54
  });
52
55
  };
@@ -58,6 +61,7 @@ export const ProductQuantityInput = ({
58
61
  </div>
59
62
  );
60
63
  }
64
+
61
65
  if (product?.maxAmount === 1) {
62
66
  return (
63
67
  <Button
@@ -69,49 +73,26 @@ export const ProductQuantityInput = ({
69
73
  }`,
70
74
  invalid && "error"
71
75
  )}
72
- onClick={onClick}
76
+ onClick={() => onChange(productInfo?.quantity ? 0 : 1)}
73
77
  >
74
78
  {t(`Design:${productInfo?.quantity ? "unselect" : "select"}`)}
75
79
  </Button>
76
80
  );
77
81
  }
82
+
78
83
  return (
79
84
  <NumberInput
80
85
  ref={refCallback}
81
86
  onChange={(val) => {
82
- onChange({
83
- id: product.id,
84
- name: product.name,
85
- deposit,
86
- price: product.price,
87
- productsCategoryId: category.id,
88
- quantity: val || null,
89
- capacity: product?.capacity,
90
- });
87
+ onChange(val || null);
91
88
  clearErrors(`${product.id}` as const);
92
89
  }}
93
90
  onArrowDown={() => {
94
- onChange({
95
- id: product.id,
96
- name: product.name,
97
- deposit,
98
- price: product.price,
99
- productsCategoryId: category.id,
100
- quantity: productInfo?.quantity - 1 || 0,
101
- capacity: product?.capacity,
102
- });
91
+ onChange(productInfo?.quantity - 1 || 0);
103
92
  clearErrors(`${product.id}` as const);
104
93
  }}
105
94
  onArrowUp={() => {
106
- onChange({
107
- id: product.id,
108
- name: product.name,
109
- deposit,
110
- price: product.price,
111
- productsCategoryId: category.id,
112
- quantity: (productInfo?.quantity ?? 0) + 1,
113
- capacity: product?.capacity,
114
- });
95
+ onChange((productInfo?.quantity ?? 0) + 1);
115
96
  clearErrors(`${product.id}` as const);
116
97
  }}
117
98
  min={0}
@@ -23,7 +23,6 @@ import { ProductSetContextProvider, ProductSetLoadingContext } from "./context";
23
23
  import { SelectItem } from "../../types/generic/SelectItem";
24
24
  import { getFilteredTemplates } from "../utils";
25
25
 
26
-
27
26
  export interface WithIsLoading {
28
27
  isLoading: boolean;
29
28
  }
@@ -79,7 +78,6 @@ export function ProductSetForm({
79
78
  onDeclineDialog,
80
79
  } = useDialogContext();
81
80
 
82
-
83
81
  const form = useForm<ProductSetFormValues>({
84
82
  defaultValues,
85
83
  mode: "onChange",
@@ -54,7 +54,7 @@ export const ZoneForm = ({
54
54
  return (
55
55
  <FormProvider {...form}>
56
56
  <Form onSubmit={handleSubmit(onFormSubmit)}>
57
- <ZoneControl isLoading={isLoading}/>
57
+ <ZoneControl isLoading={isLoading} />
58
58
  <Row>
59
59
  <Col md={6} sm={12} />
60
60
  <Col
@@ -14,9 +14,7 @@ export type ZoneControlProps = {
14
14
  workHours?: WorkHour[];
15
15
  };
16
16
 
17
- export const ZoneControl = ({
18
- isLoading,
19
- }: ZoneControlProps) => {
17
+ export const ZoneControl = ({ isLoading }: ZoneControlProps) => {
20
18
  return (
21
19
  <Row>
22
20
  <Col md={6} sm={12} className="pr-5">