bananas-commerce-admin 0.20.3 → 0.21.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.
Files changed (70) hide show
  1. package/dist/esm/components/Card/CardFieldAutoComplete.js +2 -2
  2. package/dist/esm/components/Card/CardFieldAutoComplete.js.map +1 -1
  3. package/dist/esm/components/Card/CardFieldSelect.js +6 -3
  4. package/dist/esm/components/Card/CardFieldSelect.js.map +1 -1
  5. package/dist/esm/components/Card/index.js +17 -1
  6. package/dist/esm/components/Card/index.js.map +1 -1
  7. package/dist/esm/components/ContribInlines.js +3 -2
  8. package/dist/esm/components/ContribInlines.js.map +1 -1
  9. package/dist/esm/extensions/catalog/components/ArticleCard.js +9 -4
  10. package/dist/esm/extensions/catalog/components/ArticleCard.js.map +1 -1
  11. package/dist/esm/extensions/catalog/contrib/ProductArticles.js +48 -0
  12. package/dist/esm/extensions/catalog/contrib/ProductArticles.js.map +1 -0
  13. package/dist/esm/extensions/catalog/index.js +9 -0
  14. package/dist/esm/extensions/catalog/index.js.map +1 -1
  15. package/dist/esm/extensions/pim/components/ProductCard.js +123 -0
  16. package/dist/esm/extensions/pim/components/ProductCard.js.map +1 -0
  17. package/dist/esm/extensions/pim/components/ProductPropertiesCard.js +71 -0
  18. package/dist/esm/extensions/pim/components/ProductPropertiesCard.js.map +1 -0
  19. package/dist/esm/extensions/pim/components/ProductPropertyField.js +25 -0
  20. package/dist/esm/extensions/pim/components/ProductPropertyField.js.map +1 -0
  21. package/dist/esm/extensions/pim/components/ProductRow.js +11 -0
  22. package/dist/esm/extensions/pim/components/ProductRow.js.map +1 -0
  23. package/dist/esm/extensions/pim/contrib/ArticleProduct.js +32 -20
  24. package/dist/esm/extensions/pim/contrib/ArticleProduct.js.map +1 -1
  25. package/dist/esm/extensions/pim/index.js +30 -0
  26. package/dist/esm/extensions/pim/index.js.map +1 -1
  27. package/dist/esm/extensions/pim/pages/product/create.js +41 -0
  28. package/dist/esm/extensions/pim/pages/product/create.js.map +1 -0
  29. package/dist/esm/extensions/pim/pages/product/detail.js +46 -0
  30. package/dist/esm/extensions/pim/pages/product/detail.js.map +1 -0
  31. package/dist/esm/extensions/pim/pages/product/list.js +54 -0
  32. package/dist/esm/extensions/pim/pages/product/list.js.map +1 -0
  33. package/dist/esm/extensions/pim/types/product.js +2 -0
  34. package/dist/esm/extensions/pim/types/product.js.map +1 -0
  35. package/dist/types/components/Card/CardFieldAutoComplete.d.ts +3 -0
  36. package/dist/types/components/Card/CardFieldSelect.d.ts +1 -0
  37. package/dist/types/components/ContribInlines.d.ts +1 -0
  38. package/dist/types/extensions/catalog/components/ArticleCard.d.ts +12 -0
  39. package/dist/types/extensions/catalog/contrib/ProductArticles.d.ts +4 -0
  40. package/dist/types/extensions/catalog/types/contrib.d.ts +8 -0
  41. package/dist/types/extensions/pim/components/ProductCard.d.ts +23 -0
  42. package/dist/types/extensions/pim/components/ProductPropertiesCard.d.ts +8 -0
  43. package/dist/types/extensions/pim/components/ProductPropertyField.d.ts +8 -0
  44. package/dist/types/extensions/pim/components/ProductRow.d.ts +6 -0
  45. package/dist/types/extensions/pim/index.d.ts +6 -1
  46. package/dist/types/extensions/pim/pages/product/create.d.ts +3 -0
  47. package/dist/types/extensions/pim/pages/product/detail.d.ts +4 -0
  48. package/dist/types/extensions/pim/pages/product/list.d.ts +4 -0
  49. package/dist/types/extensions/pim/types/product.d.ts +35 -0
  50. package/dist/types/types/index.d.ts +1 -1
  51. package/package.json +1 -1
  52. package/src/components/Card/CardFieldAutoComplete.tsx +14 -1
  53. package/src/components/Card/CardFieldSelect.tsx +6 -2
  54. package/src/components/Card/index.tsx +21 -1
  55. package/src/components/ContribInlines.tsx +5 -2
  56. package/src/extensions/catalog/components/ArticleCard.tsx +22 -4
  57. package/src/extensions/catalog/contrib/ProductArticles.tsx +82 -0
  58. package/src/extensions/catalog/index.tsx +9 -0
  59. package/src/extensions/catalog/types/contrib.ts +9 -0
  60. package/src/extensions/pim/components/ProductCard.tsx +242 -0
  61. package/src/extensions/pim/components/ProductPropertiesCard.tsx +114 -0
  62. package/src/extensions/pim/components/ProductPropertyField.tsx +67 -0
  63. package/src/extensions/pim/components/ProductRow.tsx +23 -0
  64. package/src/extensions/pim/contrib/ArticleProduct.tsx +54 -30
  65. package/src/extensions/pim/index.tsx +52 -1
  66. package/src/extensions/pim/pages/product/create.tsx +63 -0
  67. package/src/extensions/pim/pages/product/detail.tsx +85 -0
  68. package/src/extensions/pim/pages/product/list.tsx +87 -0
  69. package/src/extensions/pim/types/product.ts +52 -0
  70. package/src/types/index.ts +1 -1
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useEffect, useState } from "react";
2
2
  import { TableBody, TableHead, TableRow } from "@mui/material";
3
3
  import Box from "@mui/material/Box";
4
4
  import ImageList from "@mui/material/ImageList";
@@ -7,45 +7,57 @@ import ImageListItemBar from "@mui/material/ImageListItemBar";
7
7
  import Modal from "@mui/material/Modal";
8
8
  import Card from "../../../components/Card";
9
9
  import CardContent from "../../../components/Card/CardContent";
10
+ import CardFieldSelect from "../../../components/Card/CardFieldSelect";
10
11
  import CardFieldText from "../../../components/Card/CardFieldText";
11
12
  import CardHeader from "../../../components/Card/CardHeader";
12
13
  import CardRow from "../../../components/Card/CardRow";
13
14
  import Table from "../../../components/Table";
14
15
  import { TableCell } from "../../../components/Table/TableCell";
15
16
  import TableHeading from "../../../components/Table/TableHeading";
17
+ import { useApi } from "../../../contexts/ApiContext";
16
18
  import { useI18n } from "../../../contexts/I18nContext";
17
- import { capitalize } from "../../../util";
19
+ import { ProductPropertyField } from "../components/ProductPropertyField";
18
20
  const ArticleProductCard = ({ data, params }) => {
19
21
  const { t } = useI18n();
20
- const [selectedAsset, setSelectedAsset] = React.useState(null);
22
+ const api = useApi();
23
+ const [selectedAsset, setSelectedAsset] = useState(null);
24
+ const [productItemTypes, setProductItemTypes] = useState([]);
21
25
  const { code: articleCode } = params;
22
26
  const { product, assets } = data;
23
27
  const articleAssets = assets.filter((asset) => asset.article_code == articleCode || asset.article_code == "");
24
28
  const imageAssets = articleAssets.filter((asset) => asset.asset_type == "image");
25
29
  const otherAssets = articleAssets.filter((asset) => asset.asset_type !== "image");
26
- const productProperties = Object.entries(product.properties);
27
- return (React.createElement(Card, { columns: 1, isEditable: false },
30
+ const productProperties = product.properties;
31
+ const productItemType = productItemTypes.find((itemType) => itemType.name == product.item_type);
32
+ const productPropertiesList = productItemType ? productItemType.product_properties : [];
33
+ const productPropertiesRows = productPropertiesList.reduce((rows, prop, index) => {
34
+ if (index % 2 === 0)
35
+ rows.push([prop]);
36
+ else
37
+ rows[rows.length - 1].push(prop);
38
+ return rows;
39
+ }, []);
40
+ useEffect(() => {
41
+ api.operations["pim.item_types:options"].call({}).then(async (response) => {
42
+ if (response.ok) {
43
+ setProductItemTypes(await response.json());
44
+ }
45
+ });
46
+ }, []);
47
+ return (React.createElement(Card, { columns: 2, isEditable: false },
28
48
  React.createElement(CardHeader, { title: "Product" }),
29
49
  React.createElement(CardContent, null,
30
50
  React.createElement(CardRow, null,
31
- React.createElement(CardFieldText, { formName: "name", label: t("Name"), required: true, value: product.name })),
51
+ React.createElement(CardFieldText, { formName: "name", label: t("Name"), required: true, value: product.name }),
52
+ React.createElement(CardFieldSelect, { formName: "item_type", label: t("Type"), options: productItemTypes.map((itemType) => ({
53
+ id: itemType.name,
54
+ label: itemType.name,
55
+ })), required: true, size: 1, value: product.item_type ? { id: product.item_type, label: product.item_type } : undefined })),
32
56
  React.createElement(CardRow, null,
33
57
  React.createElement(CardFieldText, { formName: "description", label: t("Description"), required: true, value: product.description }))),
34
- productProperties.length > 0 && (React.createElement(React.Fragment, null,
58
+ productPropertiesRows.length > 0 && (React.createElement(React.Fragment, null,
35
59
  React.createElement(CardHeader, { title: t("Properties") }),
36
- React.createElement(Table, { count: productProperties.length },
37
- React.createElement(TableBody, { sx: {
38
- "& .MuiTableRow-root:first-of-type .MuiTableCell-root": (theme) => ({
39
- borderTop: `1px solid ${theme.palette.divider}`,
40
- }),
41
- } }, productProperties
42
- .sort((a, b) => (a[0] < b[0] ? -1 : 1))
43
- .map((prop) => (React.createElement(TableRow, { key: prop[0] },
44
- React.createElement(TableCell, null, capitalize(prop[0])),
45
- React.createElement(TableCell, { typographyProps: {
46
- variant: "caption",
47
- color: "text.secondary",
48
- } }, prop[1])))))))),
60
+ React.createElement(CardContent, null, productPropertiesRows.map((row, index) => (React.createElement(CardRow, { key: index }, row.map((prop) => (React.createElement(ProductPropertyField, { key: prop.name, property: prop, value: productProperties[prop.name] }))))))))),
49
61
  articleAssets.length > 0 && React.createElement(CardHeader, { title: t("Assets") }),
50
62
  imageAssets.length > 0 && (React.createElement(React.Fragment, null,
51
63
  React.createElement(Modal, { "aria-describedby": "modal-modal-description", "aria-labelledby": "modal-modal-title", open: selectedAsset !== null, onClose: () => setSelectedAsset(null) },
@@ -1 +1 @@
1
- {"version":3,"file":"ArticleProduct.js","sourceRoot":"","sources":["../../../../../src/extensions/pim/contrib/ArticleProduct.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,KAAK,MAAM,qBAAqB,CAAC;AAExC,OAAO,IAAI,MAAM,0BAA0B,CAAC;AAC5C,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAC/D,OAAO,aAAa,MAAM,wCAAwC,CAAC;AACnE,OAAO,UAAU,MAAM,qCAAqC,CAAC;AAC7D,OAAO,OAAO,MAAM,kCAAkC,CAAC;AACvD,OAAO,KAAK,MAAM,2BAA2B,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC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AE,CACP,CACM;gBACZ,oBAAC,SAAS,IAAC,KAAK,EAAC,OAAO,EAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IACnC,KAAK,CAAC,UAAU,CACP;gBACZ,oBAAC,SAAS,IAAC,KAAK,EAAC,OAAO,EAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IACnC,KAAK,CAAC,OAAO,CACJ,CACH,CACZ,CAAC,CACQ,CACN,CACT,CACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,4 +1,33 @@
1
1
  import InventoryOutlinedIcon from "@mui/icons-material/InventoryOutlined";
2
+ import WorkspacesIcon from "../../assets/symbols/Workspaces";
3
+ export * from "./types/contrib";
4
+ export * from "./types/product";
5
+ const routes = {
6
+ product: {
7
+ create: { page: async () => (await import("./pages/product/create")).default, offline: true },
8
+ detail: { page: async () => (await import("./pages/product/detail")).default },
9
+ list: { page: async () => (await import("./pages/product/list")).default },
10
+ },
11
+ };
12
+ export const router = {
13
+ app: "pim",
14
+ pages: (route) => {
15
+ const { page, ...hit } = routes[route.view]?.[route.action] ?? {};
16
+ if (page != null) {
17
+ return {
18
+ page: page(),
19
+ ...hit,
20
+ };
21
+ }
22
+ return undefined;
23
+ },
24
+ };
25
+ export const navigation = {
26
+ "pim.product:list": {
27
+ icon: WorkspacesIcon,
28
+ permission: "pim.view_product",
29
+ },
30
+ };
2
31
  export const contrib = {
3
32
  catalog: {
4
33
  "catalog:article:detail:product": {
@@ -7,6 +36,7 @@ export const contrib = {
7
36
  component: async () => (await import("./contrib/ArticleProduct")).default,
8
37
  predicate: (article) => !!article.product_number,
9
38
  variant: "inline",
39
+ permission: "pim.view_product",
10
40
  },
11
41
  },
12
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/extensions/pim/index.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,uCAAuC,CAAC;AAK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MAAM,CAAC,IAAI,EAAE,CAAC;QAElE,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,OAAO;gBACL,IAAI,EAAE,IAAI,EAAE;gBACZ,GAAG,GAAG;aACP,CAAC;QACJ,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAwB;IAC7C,kBAAkB,EAAE;QAClB,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,kBAAkB;KAC/B;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,OAAO,GAAwC;IAC1D,OAAO,EAAE;QACP,gCAAgC,EAAE;YAChC,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,qBAAqB;YAC3B,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAAC,OAAO;YACzE,SAAS,EAAE,CAAC,OAAsB,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc;YAC/D,OAAO,EAAE,QAAQ;YACjB,UAAU,EAAE,kBAAkB;SAC/B;KACF;CACO,CAAC"}
@@ -0,0 +1,41 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import CategoryOutlinedIcon from "@mui/icons-material/CategoryOutlined";
3
+ import { Header } from "../../../../components/Header";
4
+ import { Page } from "../../../../components/Page";
5
+ import { Tab } from "../../../../components/Tab";
6
+ import { TabPanel } from "../../../../components/TabPanel";
7
+ import { TabPanels } from "../../../../components/TabPanels";
8
+ import { Tabs } from "../../../../components/Tabs";
9
+ import { TitleBar } from "../../../../components/TitleBar";
10
+ import Content, { LeftColumn } from "../../../../containers/Content";
11
+ import { useApi } from "../../../../contexts/ApiContext";
12
+ import { useRouter } from "../../../../contexts/RouterContext";
13
+ import { ProductCard } from "../../components/ProductCard";
14
+ const ProductCreatePage = () => {
15
+ const { navigate } = useRouter();
16
+ const api = useApi();
17
+ const [productItemTypes, setProductItemTypes] = useState([]);
18
+ useEffect(() => {
19
+ api.operations["pim.item_types:options"].call({}).then(async (response) => {
20
+ if (response.ok) {
21
+ setProductItemTypes(await response.json());
22
+ }
23
+ });
24
+ }, []);
25
+ return (React.createElement(Page, null,
26
+ React.createElement(Header, { variant: "opaque" },
27
+ React.createElement(TitleBar, { title: "Create Product" }),
28
+ React.createElement(Tabs, null,
29
+ React.createElement(Tab, { key: "default", icon: React.createElement(CategoryOutlinedIcon, null), label: "Product", value: "default" }))),
30
+ React.createElement(TabPanels, null,
31
+ React.createElement(TabPanel, { key: "default", value: "default" },
32
+ React.createElement(Content, { layout: "fixedWidth" },
33
+ React.createElement(LeftColumn, null,
34
+ React.createElement(ProductCard, { create: true, itemTypes: productItemTypes, onCreated: (product) => {
35
+ navigate(`pim.product:detail`, {
36
+ params: { id: product.id },
37
+ });
38
+ } })))))));
39
+ };
40
+ export default ProductCreatePage;
41
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../../src/extensions/pim/pages/product/create.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,oBAAoB,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,OAAO,EAAE,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,M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AE;gCACrB,QAAQ,CAAC,oBAAoB,EAAE;oCAC7B,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE;iCAC3B,CAAC,CAAC;4BACL,CAAC,GACD,CACS,CACL,CACD,CACD,CACP,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,46 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import CategoryOutlinedIcon from "@mui/icons-material/CategoryOutlined";
3
+ import Typography from "@mui/material/Typography";
4
+ import { ContribInlines } from "../../../../components/ContribInlines";
5
+ import { Header } from "../../../../components/Header";
6
+ import { Page } from "../../../../components/Page";
7
+ import { Tab } from "../../../../components/Tab";
8
+ import { TabPanel } from "../../../../components/TabPanel";
9
+ import { TabPanels } from "../../../../components/TabPanels";
10
+ import { Tabs } from "../../../../components/Tabs";
11
+ import { TitleBar } from "../../../../components/TitleBar";
12
+ import Content, { LeftColumn, RightColumn } from "../../../../containers/Content";
13
+ import { useApi } from "../../../../contexts/ApiContext";
14
+ import { ProductCard } from "../../components/ProductCard";
15
+ import { ProductPropertiesCard } from "../../components/ProductPropertiesCard";
16
+ const ProductDetailPage = ({ data }) => {
17
+ const [product, setProduct] = useState(data);
18
+ const [productItemTypes, setProductItemTypes] = useState([]);
19
+ const api = useApi();
20
+ useEffect(() => {
21
+ api.operations["pim.item_types:options"].call({}).then(async (response) => {
22
+ if (response.ok) {
23
+ setProductItemTypes(await response.json());
24
+ }
25
+ });
26
+ }, []);
27
+ const productItemType = productItemTypes.find((itemType) => itemType.name == product.item_type);
28
+ return (React.createElement(Page, null,
29
+ React.createElement(Header, { variant: "opaque" },
30
+ React.createElement(TitleBar, { title: React.createElement(React.Fragment, null,
31
+ data.name,
32
+ React.createElement(Typography, { sx: { pl: 1 }, variant: "button" }, data.number)) }),
33
+ React.createElement(Tabs, { data: product },
34
+ React.createElement(Tab, { key: "default", icon: React.createElement(CategoryOutlinedIcon, null), label: "Product", value: "default" }))),
35
+ React.createElement(TabPanels, { contribParams: { number: data.number } },
36
+ React.createElement(TabPanel, { key: "default", value: "default" },
37
+ React.createElement(Content, { layout: "fixedWidth" },
38
+ React.createElement(LeftColumn, null,
39
+ React.createElement(ProductCard, { itemTypes: productItemTypes, product: product, onUpdated: setProduct }),
40
+ productItemType && (React.createElement(ProductPropertiesCard, { itemType: productItemType, productProperties: product.properties, setProductProperties: (properties) => setProduct((previous) => ({ ...previous, properties })) })),
41
+ React.createElement(ContribInlines, { contribParams: { number: data.number }, data: data })),
42
+ React.createElement(RightColumn, null,
43
+ React.createElement(ContribInlines, { contribParams: { number: data.number }, data: data, variant: "sidebar" })))))));
44
+ };
45
+ export default ProductDetailPage;
46
+ //# sourceMappingURL=detail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detail.js","sourceRoot":"","sources":["../../../../../../src/extensions/pim/pages/product/detail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,oBAAoB,MAAM,sCAAsC,CAAC;AACxE,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,OAAO,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,MA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,EAAC,IAAI,EAAE,oBAAC,oBAAoB,OAAG,EAAE,KAAK,EAAC,SAAS,EAAC,KAAK,EAAC,SAAS,GAAG,CAChF,CACA;QAET,oBAAC,SAAS,IAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YAC/C,oBAAC,QAAQ,IAAC,GAAG,EAAC,SAAS,EAAC,KAAK,EAAC,SAAS;gBACrC,oBAAC,OAAO,IAAC,MAAM,EAAC,YAAY;oBAC1B,oBAAC,UAAU;wBACT,oBAAC,WAAW,IAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,GAAI;wBAEpF,eAAe,IAAI,CAClB,oBAAC,qBAAqB,IACpB,QAAQ,EAAE,eAAe,EACzB,iBAAiB,EAAE,OAAO,CAAC,UAAU,EACrC,oBAAoB,EAAE,CAAC,UAAU,EAAE,EAAE,CACnC,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,GAEzD,CACH;wBACD,oBAAC,cAAc,IAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,GAAI,CAC3D;oBACb,oBAAC,WAAW;wBACV,oBAAC,cAAc,IACb,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAC,SAAS,GACjB,CACU,CACN,CACD,CACD,CACP,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import { Button, TableBody } from "@mui/material";
3
+ import ActionBar from "../../../../components/ActionBar";
4
+ import { Header } from "../../../../components/Header";
5
+ import { Page } from "../../../../components/Page";
6
+ import SearchBar from "../../../../components/SearchBar";
7
+ import Table from "../../../../components/Table";
8
+ import TableHead from "../../../../components/Table/TableHead";
9
+ import TableHeading from "../../../../components/Table/TableHeading";
10
+ import TableCard from "../../../../components/TableCard";
11
+ import { TitleBar } from "../../../../components/TitleBar";
12
+ import Content, { ContentWrapperWithActionBar } from "../../../../containers/Content";
13
+ import { useI18n } from "../../../../contexts/I18nContext";
14
+ import { useRouter } from "../../../../contexts/RouterContext";
15
+ import { useUser } from "../../../../contexts/UserContext";
16
+ import { hasPermission } from "../../../../util/has_permission";
17
+ import { ProductRow } from "../../components/ProductRow";
18
+ const ProductListPage = ({ data }) => {
19
+ const { navigate } = useRouter();
20
+ const { user } = useUser();
21
+ const { t } = useI18n();
22
+ return (React.createElement(Page, null,
23
+ React.createElement(Header, null,
24
+ React.createElement(TitleBar, { title: t("Products") },
25
+ React.createElement(SearchBar, { defaultValue: new URLSearchParams(window.location.search).get("search") ?? "", placeholder: t("Search for product number or name"), onSubmit: (input) => {
26
+ if (input === "") {
27
+ navigate("pim.product:list", {
28
+ replace: true,
29
+ });
30
+ }
31
+ else {
32
+ navigate("pim.product:list", {
33
+ query: {
34
+ search: input,
35
+ },
36
+ replace: true,
37
+ });
38
+ }
39
+ } }))),
40
+ React.createElement(ContentWrapperWithActionBar, null,
41
+ React.createElement(Content, { layout: "fullWidth" },
42
+ React.createElement(TableCard, null,
43
+ React.createElement(Table, { pagination: true, count: data?.count },
44
+ React.createElement(TableHead, null,
45
+ React.createElement(TableHeading, null, t("Name")),
46
+ React.createElement(TableHeading, null, t("Type")),
47
+ React.createElement(TableHeading, null, t("Product Number")),
48
+ React.createElement(TableHeading, { align: "right" }, t("Active"))),
49
+ React.createElement(TableBody, null, data?.results.map((product) => React.createElement(ProductRow, { key: product.id, product: product })))))),
50
+ hasPermission(user, "pim.add_product") && (React.createElement(ActionBar, null,
51
+ React.createElement(Button, { color: "primary", variant: "contained", onClick: () => navigate("pim.product:create") }, t("Create product")))))));
52
+ };
53
+ export default ProductListPage;
54
+ //# sourceMappingURL=list.js.map
@@ -0,0 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C,oBAAC,SAAS;gBACR,oBAAC,MAAM,IACL,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAE5C,CAAC,CAAC,gBAAgB,CAAC,CACb,CACC,CACb,CAC2B,CACzB,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../../../../../src/extensions/pim/types/product.ts"],"names":[],"mappings":""}
@@ -5,6 +5,9 @@ export interface CardFieldAutoCompleteProps extends CardFieldBaseProps, React.Pr
5
5
  isEditable?: boolean;
6
6
  type: "autocomplete";
7
7
  value: FormOption[];
8
+ autoSelect?: boolean;
9
+ clearOnBlur?: boolean;
10
+ freeSolo?: boolean;
8
11
  }
9
12
  export declare const CardFieldAutoComplete: React.FC<Omit<CardFieldAutoCompleteProps, "type">>;
10
13
  export default CardFieldAutoComplete;
@@ -7,6 +7,7 @@ export interface CardFieldSelectProps extends React.PropsWithChildren, Omit<Sele
7
7
  emptyValue?: FormOption;
8
8
  value: FormOption | undefined;
9
9
  isEditable?: boolean;
10
+ onUpdated?: (val: string) => void;
10
11
  }
11
12
  export declare const CardFieldSelect: React.FC<Omit<CardFieldSelectProps, "type">>;
12
13
  export default CardFieldSelect;
@@ -2,5 +2,6 @@ import React from "react";
2
2
  export interface ContribInlinesProps {
3
3
  contribParams?: Record<string | number | symbol, unknown>;
4
4
  data?: unknown;
5
+ variant?: string;
5
6
  }
6
7
  export declare const ContribInlines: React.FC<ContribInlinesProps>;
@@ -11,4 +11,16 @@ export type ArticleCardProps = {
11
11
  onCreated?: never;
12
12
  onUpdated: (article: ArticleDetail) => void;
13
13
  };
14
+ export interface ArticleCardFormValues {
15
+ code: string;
16
+ item_type: string;
17
+ is_active: string;
18
+ name: string;
19
+ description: string;
20
+ product_number: string;
21
+ model_number: string;
22
+ tax_code: string;
23
+ gtin: string;
24
+ variant: string;
25
+ }
14
26
  export declare const ArticleCard: React.FC<ArticleCardProps>;
@@ -0,0 +1,4 @@
1
+ import { ContribComponent } from "../../../types";
2
+ import { ProductArticle } from "../types/contrib";
3
+ declare const ProductArticlesCard: ContribComponent<ProductArticle[]>;
4
+ export default ProductArticlesCard;
@@ -13,3 +13,11 @@ export interface SiteItem {
13
13
  export interface SiteItemsResponse {
14
14
  items: SiteItem[];
15
15
  }
16
+ export interface ProductArticle {
17
+ id: number;
18
+ item_type: string;
19
+ name: string;
20
+ variant: string;
21
+ code: string;
22
+ is_active: boolean;
23
+ }
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import { ProductCreated, ProductDetail, ProductItemTypeOption } from "../types/product";
3
+ export type ProductCardProps = {
4
+ create: true;
5
+ product?: ProductDetail;
6
+ onCreated: (product: ProductCreated) => void;
7
+ onUpdated?: never;
8
+ itemTypes: ProductItemTypeOption[];
9
+ } | {
10
+ create?: false;
11
+ product: ProductDetail;
12
+ onCreated?: never;
13
+ onUpdated: (product: ProductDetail) => void;
14
+ itemTypes: ProductItemTypeOption[];
15
+ };
16
+ export interface ProductCardFormValues {
17
+ number: string;
18
+ item_type: string;
19
+ is_active: string;
20
+ name: string;
21
+ description: string;
22
+ }
23
+ export declare const ProductCard: React.FC<ProductCardProps>;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { ProductItemTypeOption, ProductPropertiesData } from "../types/product";
3
+ export interface ProductPropertiesCardProps {
4
+ itemType: ProductItemTypeOption;
5
+ productProperties: ProductPropertiesData;
6
+ setProductProperties: (properties: ProductPropertiesData) => void;
7
+ }
8
+ export declare const ProductPropertiesCard: React.FC<ProductPropertiesCardProps>;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { ProductProperty, ProductPropertyValue } from "../types/product";
3
+ export interface ProductPropertyFieldProps {
4
+ property: ProductProperty;
5
+ value: ProductPropertyValue;
6
+ formName?: string;
7
+ }
8
+ export declare const ProductPropertyField: React.FC<ProductPropertyFieldProps>;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { ProductList } from "../types/product";
3
+ export interface ProductRowProps {
4
+ product: ProductList;
5
+ }
6
+ export declare const ProductRow: React.FC<ProductRowProps>;
@@ -1,2 +1,7 @@
1
- import { ContribComponentMap } from "../../types";
1
+ import { RouterExtension } from "../../router/Router";
2
+ import { ContribComponentMap, NavigationOverrides } from "../../types";
3
+ export * from "./types/contrib";
4
+ export * from "./types/product";
5
+ export declare const router: RouterExtension;
6
+ export declare const navigation: NavigationOverrides;
2
7
  export declare const contrib: Record<string, ContribComponentMap>;
@@ -0,0 +1,3 @@
1
+ import { PageComponent } from "../../../../types";
2
+ declare const ProductCreatePage: PageComponent;
3
+ export default ProductCreatePage;
@@ -0,0 +1,4 @@
1
+ import { PageComponent } from "../../../../types";
2
+ import { ProductDetail } from "../../types/product";
3
+ declare const ProductDetailPage: PageComponent<ProductDetail>;
4
+ export default ProductDetailPage;
@@ -0,0 +1,4 @@
1
+ import { LimitOffset, PageComponent } from "../../../../types";
2
+ import { ProductList } from "../../types/product";
3
+ declare const ProductListPage: PageComponent<LimitOffset<ProductList>>;
4
+ export default ProductListPage;
@@ -0,0 +1,35 @@
1
+ export interface ProductList {
2
+ id: number;
3
+ number: string;
4
+ item_type: string;
5
+ name: string;
6
+ description: string;
7
+ is_active: boolean;
8
+ }
9
+ export type ProductPropertyValue = string | number | boolean | string[] | number[] | boolean[] | null | undefined;
10
+ export type ProductPropertiesData = Record<string, string | number | boolean | string[] | number[] | boolean[]>;
11
+ export interface ProductDetail {
12
+ id: number;
13
+ number: string;
14
+ item_type: string;
15
+ name: string;
16
+ description: string;
17
+ is_active: boolean;
18
+ properties: ProductPropertiesData;
19
+ }
20
+ export interface ProductCreated {
21
+ id: number;
22
+ }
23
+ export interface ProductProperty {
24
+ name: string;
25
+ title: string;
26
+ type: string;
27
+ min_length?: number;
28
+ min_value?: number;
29
+ max_value?: number;
30
+ array_type?: string;
31
+ }
32
+ export interface ProductItemTypeOption {
33
+ name: string;
34
+ product_properties: ProductProperty[];
35
+ }
@@ -66,7 +66,7 @@ export type ContribComponent<T = any> = React.ComponentType<PageProps<T> & OpenA
66
66
  * The variant of the component, either a tab, inline or action menu item.
67
67
  * Still requires a `Page` that loads the contrib.
68
68
  */
69
- export type ContribVariant = "tab" | "inline" | "action";
69
+ export type ContribVariant = "tab" | "inline" | "action" | "sidebar";
70
70
  export interface PageContribComponent<T = any> extends OpenAPI.Request {
71
71
  /**
72
72
  * The title shown in the NavRail.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bananas-commerce-admin",
3
- "version": "0.20.3",
3
+ "version": "0.21.0",
4
4
  "description": "What's this, an admin for apes?",
5
5
  "keywords": [
6
6
  "admin",
@@ -16,6 +16,9 @@ export interface CardFieldAutoCompleteProps extends CardFieldBaseProps, React.Pr
16
16
  isEditable?: boolean;
17
17
  type: "autocomplete";
18
18
  value: FormOption[];
19
+ autoSelect?: boolean;
20
+ clearOnBlur?: boolean;
21
+ freeSolo?: boolean;
19
22
  }
20
23
 
21
24
  export const CardFieldAutoComplete: React.FC<Omit<CardFieldAutoCompleteProps, "type">> = ({
@@ -29,6 +32,9 @@ export const CardFieldAutoComplete: React.FC<Omit<CardFieldAutoCompleteProps, "t
29
32
  options,
30
33
  size = "grow",
31
34
  value: defaultValue,
35
+ autoSelect = false,
36
+ clearOnBlur = false,
37
+ freeSolo = false,
32
38
  ...props
33
39
  }) => {
34
40
  const { isCompact, isEditing } = useCardContext();
@@ -41,13 +47,20 @@ export const CardFieldAutoComplete: React.FC<Omit<CardFieldAutoCompleteProps, "t
41
47
  {isEditing && isEditable ? (
42
48
  <Stack alignItems="center" justifyContent="space-between">
43
49
  <Autocomplete
50
+ autoSelect={autoSelect}
51
+ clearOnBlur={clearOnBlur}
52
+ freeSolo={freeSolo}
44
53
  isOptionEqualToValue={(option: FormOption, value: FormOption) => option.id === value.id}
45
54
  multiple={true}
46
55
  options={options ?? []}
47
56
  renderInput={(props) => <TextField {...props} label={label} />}
48
57
  sx={{ width: "100%" }}
49
58
  value={selectedOptions}
50
- onChange={(_, value) => setSelectedOptions(value as FormOption[])}
59
+ onChange={(_, value) =>
60
+ setSelectedOptions(
61
+ value.map((v) => (typeof v == "string" ? { id: v, label: v } : v)) as FormOption[],
62
+ )
63
+ }
51
64
  {...props}
52
65
  />
53
66
 
@@ -21,6 +21,7 @@ export interface CardFieldSelectProps
21
21
  emptyValue?: FormOption;
22
22
  value: FormOption | undefined;
23
23
  isEditable?: boolean;
24
+ onUpdated?: (val: string) => void;
24
25
  }
25
26
 
26
27
  export const CardFieldSelect: React.FC<Omit<CardFieldSelectProps, "type">> = ({
@@ -37,6 +38,7 @@ export const CardFieldSelect: React.FC<Omit<CardFieldSelectProps, "type">> = ({
37
38
  required = false,
38
39
  size = "grow",
39
40
  value: defaultValue = undefined,
41
+ onUpdated,
40
42
  ...props
41
43
  }) => {
42
44
  const { isCompact, isEditing } = useCardContext();
@@ -44,9 +46,11 @@ export const CardFieldSelect: React.FC<Omit<CardFieldSelectProps, "type">> = ({
44
46
 
45
47
  const handleChange = useCallback(
46
48
  (event: SelectChangeEvent<unknown>) => {
47
- setValue(event.target.value as string);
49
+ const currentValue = event.target.value as string;
50
+ setValue(currentValue);
51
+ if (onUpdated) onUpdated(currentValue);
48
52
  },
49
- [setValue],
53
+ [setValue, onUpdated],
50
54
  );
51
55
 
52
56
  return (