contentoh-components-library 21.3.91 → 21.3.92

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 (97) hide show
  1. package/dist/components/atoms/Avatar/index.js +3 -2
  2. package/dist/components/atoms/CheckBox/index.js +4 -1
  3. package/dist/components/atoms/CheckBox/styles.js +1 -1
  4. package/dist/components/atoms/ImageCarousel/ImgeSlider.stories.js +90 -0
  5. package/dist/components/atoms/ImageCarousel/index.js +123 -0
  6. package/dist/components/atoms/ImageCarousel/styles.js +18 -0
  7. package/dist/components/atoms/PercentTag/PercentTag.stories.js +31 -0
  8. package/dist/components/atoms/PercentTag/index.js +23 -0
  9. package/dist/components/atoms/PercentTag/styles.js +22 -0
  10. package/dist/components/atoms/RatingStars/RatingStars.stories.js +30 -0
  11. package/dist/components/atoms/RatingStars/index.js +53 -0
  12. package/dist/components/atoms/RatingStars/styles.js +18 -0
  13. package/dist/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +48 -0
  14. package/dist/components/atoms/RetailerCatalog/index.js +69 -0
  15. package/dist/components/atoms/RetailerCatalog/styles.js +20 -0
  16. package/dist/components/atoms/RetailerOption/RetailerOption.stories.js +33 -0
  17. package/dist/components/atoms/RetailerOption/index.js +62 -0
  18. package/dist/components/atoms/RetailerOption/styles.js +20 -0
  19. package/dist/components/atoms/RetailersList/RetailersList.stories.js +45 -0
  20. package/dist/components/atoms/RetailersList/index.js +44 -0
  21. package/dist/components/atoms/RetailersList/styles.js +18 -0
  22. package/dist/components/atoms/UserCatalog/UserCatalog.stories.js +72 -0
  23. package/dist/components/atoms/UserCatalog/index.js +89 -0
  24. package/dist/components/atoms/UserCatalog/styles.js +18 -0
  25. package/dist/components/atoms/UserOption/UserOption.stories.js +40 -0
  26. package/dist/components/atoms/UserOption/index.js +80 -0
  27. package/dist/components/atoms/UserOption/styles.js +20 -0
  28. package/dist/components/atoms/UserSelector/UserSelector.stories.js +40 -0
  29. package/dist/components/atoms/UserSelector/index.js +91 -0
  30. package/dist/components/atoms/UserSelector/styles.js +32 -0
  31. package/dist/components/molecules/GridItem/GridItem.stories.js +123 -0
  32. package/dist/components/molecules/GridItem/index.js +122 -0
  33. package/dist/components/molecules/GridItem/styles.js +20 -0
  34. package/dist/components/molecules/HeaderItem/ColumnItem.js +23 -0
  35. package/dist/components/molecules/HeaderItem/HeaderItem.stories.js +70 -0
  36. package/dist/components/molecules/HeaderItem/index.js +42 -0
  37. package/dist/components/molecules/HeaderItem/styles.js +30 -0
  38. package/dist/components/molecules/RowItem/ColumnItem.js +23 -0
  39. package/dist/components/molecules/RowItem/RowItem.stories.js +5242 -0
  40. package/dist/components/molecules/RowItem/index.js +59 -0
  41. package/dist/components/molecules/RowItem/styles.js +30 -0
  42. package/dist/components/organisms/GridProducts/GridProducts.stories.js +5093 -0
  43. package/dist/components/organisms/GridProducts/index.js +81 -0
  44. package/dist/components/organisms/GridProducts/styles.js +18 -0
  45. package/dist/components/organisms/GridProducts/utils.js +139 -0
  46. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +41 -28
  47. package/dist/components/pages/RetailerProductEdition/index.js +23 -0
  48. package/dist/index.js +149 -58
  49. package/package.json +2 -1
  50. package/src/components/atoms/Avatar/index.js +8 -2
  51. package/src/components/atoms/CheckBox/index.js +2 -1
  52. package/src/components/atoms/CheckBox/styles.js +2 -0
  53. package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +76 -0
  54. package/src/components/atoms/ImageCarousel/index.js +103 -0
  55. package/src/components/atoms/ImageCarousel/styles.js +79 -0
  56. package/src/components/atoms/PercentTag/PercentTag.stories.js +7 -0
  57. package/src/components/atoms/PercentTag/index.js +9 -0
  58. package/src/components/atoms/PercentTag/styles.js +69 -0
  59. package/src/components/atoms/RatingStars/RatingStars.stories.js +10 -0
  60. package/src/components/atoms/RatingStars/index.js +31 -0
  61. package/src/components/atoms/RatingStars/styles.js +28 -0
  62. package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +36 -0
  63. package/src/components/atoms/RetailerCatalog/index.js +49 -0
  64. package/src/components/atoms/RetailerCatalog/styles.js +30 -0
  65. package/src/components/atoms/RetailerOption/RetailerOption.stories.js +15 -0
  66. package/src/components/atoms/RetailerOption/index.js +53 -0
  67. package/src/components/atoms/RetailerOption/styles.js +41 -0
  68. package/src/components/atoms/RetailersList/RetailersList.stories.js +33 -0
  69. package/src/components/atoms/RetailersList/index.js +20 -0
  70. package/src/components/atoms/RetailersList/styles.js +19 -0
  71. package/src/components/atoms/UserCatalog/UserCatalog.stories.js +66 -0
  72. package/src/components/atoms/UserCatalog/index.js +77 -0
  73. package/src/components/atoms/UserCatalog/styles.js +24 -0
  74. package/src/components/atoms/UserOption/UserOption.stories.js +25 -0
  75. package/src/components/atoms/UserOption/index.js +49 -0
  76. package/src/components/atoms/UserOption/styles.js +54 -0
  77. package/src/components/atoms/UserSelector/UserSelector.stories.js +25 -0
  78. package/src/components/atoms/UserSelector/index.js +70 -0
  79. package/src/components/atoms/UserSelector/styles.js +55 -0
  80. package/src/components/molecules/GridItem/GridItem.stories.js +126 -0
  81. package/src/components/molecules/GridItem/index.js +82 -0
  82. package/src/components/molecules/GridItem/styles.js +85 -0
  83. package/src/components/molecules/HeaderItem/ColumnItem.js +9 -0
  84. package/src/components/molecules/HeaderItem/HeaderItem.stories.js +24 -0
  85. package/src/components/molecules/HeaderItem/index.js +26 -0
  86. package/src/components/molecules/HeaderItem/styles.js +25 -0
  87. package/src/components/molecules/RowItem/ColumnItem.js +9 -0
  88. package/src/components/molecules/RowItem/RowItem.stories.js +5660 -0
  89. package/src/components/molecules/RowItem/index.js +45 -0
  90. package/src/components/molecules/RowItem/styles.js +38 -0
  91. package/src/components/organisms/GridProducts/GridProducts.stories.js +5474 -0
  92. package/src/components/organisms/GridProducts/index.js +59 -0
  93. package/src/components/organisms/GridProducts/styles.js +15 -0
  94. package/src/components/organisms/GridProducts/utils.js +103 -0
  95. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +39 -21
  96. package/src/components/pages/RetailerProductEdition/index.js +12 -0
  97. package/src/index.js +8 -0
@@ -0,0 +1,59 @@
1
+ import { Container } from "./styles";
2
+ import { GridItem } from "../../molecules/GridItem";
3
+ import { HeaderItem } from "../../molecules/HeaderItem";
4
+ import { getProductsToTable } from "./utils";
5
+ import { useEffect } from "react";
6
+ import { useState } from "react";
7
+ import { RowItem } from "../../molecules/RowItem";
8
+ import { CheckBox } from "../../atoms/CheckBox";
9
+
10
+ export const GridProducts = ({
11
+ products = [],
12
+ columnsArray = [],
13
+ gridView = true,
14
+ chkOnChange,
15
+ selected = [],
16
+ chkChecked,
17
+ checkAll,
18
+ chkCheckedAll,
19
+ onGridClick,
20
+ }) => {
21
+ const [productsArray, setProductsArray] = useState([]);
22
+
23
+ useEffect(() => {
24
+ setProductsArray(products);
25
+ }, [products]);
26
+
27
+ return (
28
+ <Container>
29
+ {!gridView ? (
30
+ productsArray.map(({ gridElement, product, id }, i) => (
31
+ <GridItem
32
+ key={i}
33
+ id={id}
34
+ product={product}
35
+ gridElement={gridElement}
36
+ chkOnChange={chkOnChange}
37
+ onGridClick={onGridClick}
38
+ selected={selected}
39
+ chkChecked={chkChecked}
40
+ />
41
+ ))
42
+ ) : (
43
+ <div className="table-view">
44
+ <HeaderItem
45
+ columnsArray={columnsArray}
46
+ checkAll={checkAll}
47
+ chkCheckedAll={chkCheckedAll}
48
+ />
49
+ <RowItem
50
+ productsArray={productsArray}
51
+ chkOnChange={chkOnChange}
52
+ onGridClick={onGridClick}
53
+ chkChecked={chkChecked}
54
+ />
55
+ </div>
56
+ )}
57
+ </Container>
58
+ );
59
+ };
@@ -0,0 +1,15 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Container = styled.div`
4
+ display: flex;
5
+ flex-wrap: wrap;
6
+ gap: 10px;
7
+ height: 100%;
8
+ overflow: auto;
9
+ padding: 20px;
10
+
11
+ .table-view {
12
+ height: 100%;
13
+ width: 100%;
14
+ }
15
+ `;
@@ -0,0 +1,103 @@
1
+ import { RetailerCatalog } from "../../atoms/RetailerCatalog";
2
+ import { UserCatalog } from "../../atoms/UserCatalog";
3
+
4
+ export const getProductsToTable = (
5
+ products = [],
6
+ textSpecialists,
7
+ imagesSpecialists,
8
+ auditors,
9
+ images
10
+ ) => {
11
+ const productsTableArray = [];
12
+
13
+ products.forEach((product) => {
14
+ const { article, orderId, upc, status, version } = product;
15
+ const id = article?.id_article + "-" + orderId;
16
+ const imgArray = images[article?.id_article + "-" + version];
17
+ const element = {
18
+ id,
19
+ cols: [
20
+ { name: article?.country || "-", flex: 1, minWidth: 100 },
21
+ { name: orderId || "-", flex: 1, minWidth: 100 },
22
+ { name: upc || "-", flex: 1, minWidth: 100 },
23
+ { name: article?.name || "-", flex: 1, minWidth: 200 },
24
+ { name: "S/M" || "-", flex: 1, minWidth: 100 },
25
+ { name: status || "-", flex: 1, minWidth: 100 },
26
+ {
27
+ name: (
28
+ <RetailerCatalog
29
+ id={"retailers-" + id}
30
+ article={product}
31
+ retailers={product.retailers}
32
+ />
33
+ ),
34
+ flex: 1,
35
+ minWidth: 100,
36
+ },
37
+ { name: "none", flex: 1, minWidth: 100 },
38
+ {
39
+ name: (
40
+ <UserCatalog
41
+ datasheet={article.id_datasheet_especialist}
42
+ description={article.id_description_especialist}
43
+ images={article.id_images_especialist}
44
+ textSpecialists={textSpecialists}
45
+ imagesSpecialists={imagesSpecialists}
46
+ auditors={auditors}
47
+ id={"users-" + id}
48
+ />
49
+ ),
50
+ flex: 1,
51
+ minWidth: 100,
52
+ },
53
+ { name: "Cont.", flex: 1, minWidth: 100 },
54
+ ],
55
+ gridElement: {
56
+ images: imgArray,
57
+ info: [
58
+ { title: "name", value: article?.name || "-" },
59
+ { title: "category", value: article?.category || "-" },
60
+ { title: "company", value: article?.company_name || "-" },
61
+ { title: "price", value: article?.price || "-" },
62
+ ],
63
+ status: [
64
+ { title: "datasheet", value: product?.datasheet_status, percent: 80 },
65
+ {
66
+ title: "description",
67
+ value: product?.description_status,
68
+ percent: 80,
69
+ },
70
+ { title: "images", value: product?.images_status, percent: 80 },
71
+ ],
72
+ catalogs: {
73
+ leftSide: (
74
+ <RetailerCatalog
75
+ id={"retailers-" + id}
76
+ limit={2}
77
+ article={product}
78
+ retailers={product.retailers}
79
+ />
80
+ ),
81
+ rightSide: (
82
+ <UserCatalog
83
+ datasheet={article.id_datasheet_especialist}
84
+ description={article.id_description_especialist}
85
+ images={article.id_images_especialist}
86
+ textSpecialists={textSpecialists}
87
+ imagesSpecialists={imagesSpecialists}
88
+ auditors={auditors}
89
+ id={"users-" + id}
90
+ />
91
+ ),
92
+ },
93
+ },
94
+ showBottom: true,
95
+ product,
96
+ article,
97
+ };
98
+
99
+ productsTableArray.push(element);
100
+ });
101
+
102
+ return productsTableArray;
103
+ };
@@ -52,32 +52,50 @@ RetailerProductEditionDefault.args = {
52
52
  images: "RA/AC",
53
53
  },
54
54
  },
55
+ orderId: 15209,
56
+ status: "ACA",
57
+ datasheet_status: "ACA",
58
+ prio: "none",
59
+ version: 3,
60
+ description_status: "ACA",
61
+ images_status: "ACA",
62
+ statusByRetailer: {
63
+ 70: {
64
+ datasheet: "ACA",
65
+ description: "ACA",
66
+ images: "ACA",
67
+ },
68
+ },
55
69
  article: {
56
- category: "Puertas y Ventanas|Molduras|Molduras Madera Blanda",
57
- company_name: "Demo",
70
+ id_article: 39390,
71
+ id_category: "4311",
72
+ name: "test demo 1",
73
+ upc: "2312312313",
74
+ timestamp: "2023-05-12T20:07:42.000Z",
75
+ id_user: 133,
76
+ status: "NULL",
77
+ active: 1,
78
+ company_id: 912,
79
+ company_name: "GRUPO BRAHMA",
58
80
  country: "México",
59
- id_category: "2366",
60
- id_datasheet_especialist: null,
61
- id_datasheet_facilitator: null,
62
- id_description_especialist: null,
63
- id_description_facilitator: null,
64
- id_images_especialist: null,
65
- id_images_facilitator: null,
66
- id_order: 15160,
67
- id_article: 39290,
68
- id_auditor: 37,
69
- name: "MOLDURA MARCO MODER 11X4X244 CM",
70
- timestamp: "2023-04-19T21:36:02.000Z",
71
- upc: "100030",
81
+ id_order: 15209,
82
+ id_datasheet_especialist: 232,
83
+ id_datasheet_facilitator: 52,
84
+ id_description_especialist: 232,
85
+ id_description_facilitator: 52,
86
+ id_images_especialist: 196,
87
+ id_images_facilitator: 53,
88
+ id_auditor: 195,
89
+ id_recepcionist: null,
90
+ category: "Ropa Interior Dama|Ropa Interior|Ropa Interior",
91
+ missingAttributes: 0,
92
+ missingDescriptions: 0,
93
+ missingImages: 0,
72
94
  },
73
95
  retailers: [
74
96
  {
75
- id: 58,
76
- name: "The Home Depot Golden",
77
- },
78
- {
79
- id: 68,
80
- name: "The Home Depot Merchants",
97
+ id: 70,
98
+ name: "Bodega Aurrera",
81
99
  },
82
100
  ],
83
101
  },
@@ -226,6 +226,10 @@ export const RetailerProductEdition = ({
226
226
  const [compare, setCompare] = useState(false);
227
227
  const [valRejAll, setValRejAll] = useState(false);
228
228
 
229
+ const [desc, setDesc] = useState([]);
230
+ const [fich, setFich] = useState([]);
231
+ const [imag, setImag] = useState([]);
232
+
229
233
  useEffect(async () => {
230
234
  const { id_article } = product?.article || {};
231
235
  if (id_article)
@@ -567,6 +571,7 @@ export const RetailerProductEdition = ({
567
571
  active: images?.values?.some((value) => value?.image_id === e?.id),
568
572
  }));
569
573
  setSocketType(imageInputs);
574
+ console.log(images);
570
575
  }, [images]);
571
576
 
572
577
  const updateImages = useCallback(async () => {
@@ -1187,6 +1192,7 @@ export const RetailerProductEdition = ({
1187
1192
  };
1188
1193
 
1189
1194
  useEffect(() => {
1195
+ console.log(servicesData, "servicesData");
1190
1196
  let status = getRetailerStatus(servicesData, activeTab);
1191
1197
  setRetailerStatus(status);
1192
1198
  }, [activeTab, servicesData, activeRetailer]);
@@ -1351,6 +1357,12 @@ export const RetailerProductEdition = ({
1351
1357
  isRetailer={isRetailer}
1352
1358
  showSaveButton={auditorAssigned() || userAssigned()}
1353
1359
  version={version}
1360
+ desc={desc}
1361
+ setDesc={setDesc}
1362
+ fich={fich}
1363
+ setFich={setFich}
1364
+ imag={imag}
1365
+ setImag={setImag}
1354
1366
  updatedDescriptions={updatedDescriptions}
1355
1367
  updatedDatasheets={updatedDatasheets}
1356
1368
  images={images}
package/src/index.js CHANGED
@@ -33,6 +33,9 @@ export * from "./components/atoms/ImagePreview/index";
33
33
  export * from "./components/atoms/InputText/index";
34
34
  export * from "./components/atoms/NotFound/index";
35
35
  export * from "./components/atoms/Tooltip/index";
36
+ export * from "./components/atoms/UserCatalog/index";
37
+ export * from "./components/atoms/UserSelector/index";
38
+ export * from "./components/atoms/ImageCarousel/index";
36
39
 
37
40
  //molecules
38
41
  export * from "./components/molecules/AvatarAndValidation/index";
@@ -65,6 +68,10 @@ export * from "./components/molecules/SelectV2/index";
65
68
  export * from "./components/molecules/Dropdown/index";
66
69
  export * from "./components/molecules/StripeCardForm/index";
67
70
  export * from "./components/molecules/StripeCardSelector/index";
71
+ export * from "./components/molecules/GridItem/index";
72
+ export * from "./components/molecules/HeaderItem/index";
73
+ export * from "./components/molecules/RowItem/index";
74
+ export * from "./components/molecules/RetailerSelector/index";
68
75
 
69
76
  //organisms
70
77
  export * from "./components/organisms/ChangePassword/index";
@@ -82,6 +89,7 @@ export * from "./components/organisms/OrderDetail/index";
82
89
  export * from "./components/organisms/RangeCalendar";
83
90
  export * from "./components/organisms/TableResizable";
84
91
  export * from "./components/organisms/SideModal/index";
92
+ export * from "./components/organisms/GridProducts/index";
85
93
 
86
94
  //pages
87
95
  export * from "./components/pages/ChangePasswordLogin";