contentoh-components-library 21.3.16 → 21.3.18

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 (119) hide show
  1. package/.env.development +5 -0
  2. package/dist/assets/images/generalButton/closeIcon.svg +2 -2
  3. package/dist/components/atoms/ProgressBar/index.js +36 -6
  4. package/dist/components/atoms/ProgressBar/styles.js +11 -3
  5. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
  6. package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
  7. package/dist/components/molecules/HeaderTop/index.js +23 -6
  8. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  9. package/dist/components/molecules/ProductNameHeader/index.js +6 -4
  10. package/dist/components/organisms/FullProductNameHeader/index.js +1 -0
  11. package/dist/components/organisms/RangeCalendar/index.js +4 -3
  12. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +65 -50
  13. package/dist/components/pages/ProviderProductEdition/index.js +15 -11
  14. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +36 -44
  15. package/dist/components/pages/RetailerProductEdition/index.js +13 -12
  16. package/dist/global-files/data.js +18 -23
  17. package/dist/global-files/fonts.css +6 -0
  18. package/dist/global-files/utils.js +22 -2
  19. package/dist/global-files/variables.js +2 -0
  20. package/dist/index.js +267 -46
  21. package/package.json +12 -1
  22. package/src/assets/images/customSelect/starIcon.svg +14 -0
  23. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  24. package/src/assets/images/defaultImages/notFound.svg +124 -0
  25. package/src/assets/images/generalButton/closeIcon.svg +2 -2
  26. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
  27. package/src/components/atoms/ButtonFileChooser/index.js +68 -0
  28. package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
  29. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +53 -0
  30. package/src/components/atoms/ButtonV2/index.js +85 -0
  31. package/src/components/atoms/ButtonV2/styles.js +217 -0
  32. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
  33. package/src/components/atoms/CustomIcon/index.js +41 -0
  34. package/src/components/atoms/CustomIcon/styles.js +85 -0
  35. package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
  36. package/src/components/atoms/IconFile/index.js +119 -0
  37. package/src/components/atoms/IconFile/styles.js +67 -0
  38. package/src/components/atoms/Image/Image.stories.js +51 -0
  39. package/src/components/atoms/Image/index.js +55 -0
  40. package/src/components/atoms/Image/styles.js +34 -0
  41. package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
  42. package/src/components/atoms/ImageLink/index.js +57 -0
  43. package/src/components/atoms/ImageLink/styles.js +30 -0
  44. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
  45. package/src/components/atoms/ImagePreview/index.js +178 -0
  46. package/src/components/atoms/ImagePreview/styles.js +77 -0
  47. package/src/components/atoms/InputText/InputText.stories.js +39 -0
  48. package/src/components/atoms/InputText/index.js +61 -0
  49. package/src/components/atoms/InputText/styles.js +89 -0
  50. package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
  51. package/src/components/atoms/NotFound/index.js +52 -0
  52. package/src/components/atoms/NotFound/styles.js +55 -0
  53. package/src/components/atoms/ProgressBar/index.js +40 -5
  54. package/src/components/atoms/ProgressBar/styles.js +24 -0
  55. package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +26 -0
  56. package/src/components/atoms/SelectItemV2/index.js +61 -0
  57. package/src/components/atoms/SelectItemV2/styles.js +90 -0
  58. package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
  59. package/src/components/atoms/Tooltip/index.js +59 -0
  60. package/src/components/atoms/Tooltip/styles.js +42 -0
  61. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
  62. package/src/components/molecules/ButtonDownloadFile/index.js +109 -0
  63. package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
  64. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
  65. package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
  66. package/src/components/molecules/Dropdown/Dropdown.stories.js +103 -0
  67. package/src/components/molecules/Dropdown/index.js +150 -0
  68. package/src/components/molecules/Dropdown/styles.js +75 -0
  69. package/src/components/molecules/HeaderTop/index.js +29 -8
  70. package/src/components/molecules/HeaderTop/styles.js +4 -0
  71. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +68 -0
  72. package/src/components/molecules/ImageTooltip/index.js +63 -0
  73. package/src/components/molecules/ImageTooltip/styles.js +18 -0
  74. package/src/components/molecules/ProductNameHeader/index.js +7 -2
  75. package/src/components/molecules/SelectV2/SelectV2.stories.js +115 -0
  76. package/src/components/molecules/SelectV2/index.js +357 -0
  77. package/src/components/molecules/SelectV2/styles.js +105 -0
  78. package/src/components/molecules/SelectV2/test.js +61 -0
  79. package/src/components/molecules/SelectV2/test.stories.js +10 -0
  80. package/src/components/organisms/Chat/Chat.stories.js +147 -0
  81. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
  82. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  83. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  84. package/src/components/organisms/Chat/ChatLists/index.js +141 -0
  85. package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
  86. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
  87. package/src/components/organisms/Chat/ContainerItems/index.js +512 -0
  88. package/src/components/organisms/Chat/ContainerItems/styles.js +328 -0
  89. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
  90. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  91. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  92. package/src/components/organisms/Chat/ContentChat/index.js +897 -0
  93. package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
  94. package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
  95. package/src/components/organisms/Chat/Footer/index.js +661 -0
  96. package/src/components/organisms/Chat/Footer/styles.js +286 -0
  97. package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
  98. package/src/components/organisms/Chat/Header/index.js +94 -0
  99. package/src/components/organisms/Chat/Header/styles.js +49 -0
  100. package/src/components/organisms/Chat/index.js +235 -0
  101. package/src/components/organisms/Chat/styles.js +42 -0
  102. package/src/components/organisms/FullProductNameHeader/index.js +1 -0
  103. package/src/components/organisms/Modal/Modal.stories.js +55 -0
  104. package/src/components/organisms/Modal/index.js +97 -0
  105. package/src/components/organisms/Modal/styles.js +103 -0
  106. package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +16 -0
  107. package/src/components/organisms/RangeCalendar/index.js +121 -0
  108. package/src/components/organisms/RangeCalendar/styles.js +883 -0
  109. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +67 -49
  110. package/src/components/pages/ProviderProductEdition/index.js +16 -9
  111. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +36 -46
  112. package/src/components/pages/RetailerProductEdition/index.js +14 -10
  113. package/src/global-files/data.js +18 -23
  114. package/src/global-files/fonts.css +6 -0
  115. package/src/global-files/handle_http.js +225 -0
  116. package/src/global-files/handle_userTech.js +7 -0
  117. package/src/global-files/utils.js +330 -0
  118. package/src/global-files/variables.js +2 -0
  119. package/src/index.js +17 -0
@@ -16,74 +16,76 @@ ProviderProductEditionDefault.args = {
16
16
  Imágenes: true,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pd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gocSasU6fQg4Glh1kXWQ-fy4XaFw6cBParJjkqic2Gg1iqwB5wGbrwD4E0crZyPkgwwPydTLLu6WguGWBuQHhcoG-xg",
20
20
  articleId: 238,
21
21
  category: 846,
22
22
  version: 2,
23
23
  productSelected: {
24
- id_article: 3,
25
- id_category: 2032,
26
- name: "CORTINA BLACKOUT DE POLIÉSTER CAFÉ 2.13 X 1.06 M",
27
- upc: "161157",
28
- timestamp: "2022-11-14T16:02:47.000Z",
29
- categoryName: "Decoración|Cortinas y Persianas|Cortinas",
24
+ category: "Decoración|Accesorios Decorativos|Accesorios Decorativos",
25
+ company_name: "merchants24ene@allfreemail.net",
26
+ company_id: 918,
27
+ id_category: "2028",
28
+ id_article: 432,
29
+ name: "VELA AROMA 18 OZ MAN/CAN",
30
+ upc: "102852",
30
31
  version: 1,
31
32
  retailersAvailable: [
32
33
  {
33
- name: "The Home Depot Golden",
34
- id: 58,
34
+ id: 68,
35
+ name: "The Home Depot Merchants",
35
36
  },
36
37
  ],
37
38
  },
38
39
  productToEdit: {
39
- idCategory: 2032,
40
- ArticleId: 3,
40
+ idCategory: "2028",
41
+ ArticleId: 432,
41
42
  product: [
42
43
  {
43
- id_article: 3,
44
- id_category: 2032,
45
- name: "CORTINA BLACKOUT DE POLIÉSTER CAFÉ 2.13 X 1.06 M",
46
- upc: "161157",
47
- timestamp: "2022-11-14T16:02:47.000Z",
48
- categoryName: "Decoración|Cortinas y Persianas|Cortinas",
44
+ category: "Decoración|Accesorios Decorativos|Accesorios Decorativos",
45
+ company_name: "merchants24ene@allfreemail.net",
46
+ company_id: 918,
47
+ id_category: "2028",
48
+ id_article: 432,
49
+ name: "VELA AROMA 18 OZ MAN/CAN",
50
+ upc: "102852",
49
51
  version: 1,
50
52
  retailersAvailable: [
51
53
  {
52
- name: "The Home Depot Golden",
53
- id: 58,
54
+ id: 68,
55
+ name: "The Home Depot Merchants",
54
56
  },
55
57
  ],
56
58
  },
57
59
  ],
58
60
  },
59
61
  location: {
60
- state: { origin: "Contentoh" },
62
+ state: { origin: "Contentoh", withChat: true },
61
63
  },
62
64
  user: {
63
- id_user: 28,
64
- name: "Ismael",
65
- last_name: "López",
66
- email: "ilopez@contentoh.com",
67
- position: "Test States",
68
- telephone: "+523111366336",
65
+ id_user: 140,
66
+ name: "Prueba",
67
+ last_name: "Merchants",
68
+ email: "merchants24ene@allfreemail.net",
69
+ position: "merchants24ene@allfreemail.net",
70
+ telephone: "+521234567891",
69
71
  country: "México",
70
- id_company: 1,
71
- id_cognito: "f5927f8e-cbf7-4922-9e09-e69ec0b2731a",
72
+ id_company: 918,
73
+ id_cognito: "03eb26a0-ab56-4767-b64f-84925807702a",
72
74
  birth_Date: null,
73
- about_me: "",
74
- zip_code: "",
75
- address: "",
76
- job: "",
77
- id_stripe: "cus_KuEt6R6vwmN09f",
75
+ about_me: null,
76
+ zip_code: null,
77
+ address: null,
78
+ job: null,
79
+ id_stripe: null,
78
80
  id_role: 0,
79
81
  active: 1,
80
82
  is_retailer: 0,
81
- email_notify: 0,
82
- is_user_tech: "AS",
83
+ email_notify: 1,
84
+ is_user_tech: null,
83
85
  membership: {
84
- id: 76,
85
- start_date: "2022-01-18T17:25:35.000Z",
86
- end_date: "2023-01-18T17:25:35.000Z",
86
+ id: 109,
87
+ start_date: "2023-01-24T22:07:34.000Z",
88
+ end_date: "2024-01-24T22:07:34.000Z",
87
89
  planID: 8,
88
90
  plan: "prod_KtlhECVSFG2iro",
89
91
  name: "Plan Pro",
@@ -91,21 +93,37 @@ ProviderProductEditionDefault.args = {
91
93
  products_limit: "5000",
92
94
  type: "Enterprise",
93
95
  },
94
- src: "https://content-management-profile.s3.amazonaws.com/id-28/28.png?1669927021851",
96
+ src: "https://content-management-profile.s3.amazonaws.com/id-140/140.png?1674599807427",
95
97
  },
96
98
  company: {
97
- id_company: 1,
98
- trade_name: "GRUPO BRAHMA",
99
- company_name: "GRUPO BRAHMA",
100
- rfc: "XAXX010101000",
101
- adress: "AA",
102
- about_company: "",
103
- telephone: "",
104
- web_site: "",
105
- zip_code: "",
99
+ id_company: 918,
100
+ trade_name: "merchants24ene@allfreemail.net",
101
+ company_name: "merchants24ene@allfreemail.net",
102
+ rfc: "merchants24ene@allfreemail.net",
103
+ adress: "merchants24ene@allfreemail.net",
104
+ about_company: null,
105
+ telephone: null,
106
+ web_site: null,
107
+ zip_code: null,
106
108
  email: null,
107
- social_link: "",
109
+ social_link: null,
108
110
  is_retailer: 0,
111
+ financedRetailers: [
112
+ {
113
+ id: 68,
114
+ name: "The Home Depot Merchants",
115
+ country: "México",
116
+ id_region: 1,
117
+ active: 1,
118
+ },
119
+ ],
120
+ retailers: [
121
+ {
122
+ id: null,
123
+ name: null,
124
+ country: null,
125
+ },
126
+ ],
109
127
  },
110
128
  showSurvey: (v) => v && alert("se muestra"),
111
129
  };
@@ -42,6 +42,7 @@ import Slide1_4 from "../../../assets/images/sliderToolTip/slide4.svg";
42
42
  import Slide1_5 from "../../../assets/images/sliderToolTip/slide5.svg";
43
43
  import { VersionSelector } from "../../organisms/VersionSelector";
44
44
  import { useCloseModal } from "../../../global-files/customHooks";
45
+ import { number } from "prop-types";
45
46
 
46
47
  const reducerImages = (state, action) => {
47
48
  let { values, attrForImgs, inputsByRetailer } = state;
@@ -133,6 +134,7 @@ export const ProviderProductEdition = ({
133
134
  setShowContentohRequestModal,
134
135
  showSurvey,
135
136
  company,
137
+ withChat,
136
138
  }) => {
137
139
  const [activeTab, setActiveTab] = useState("Descripción");
138
140
  const [activeImage, setActiveImage] = useState();
@@ -272,8 +274,7 @@ export const ProviderProductEdition = ({
272
274
 
273
275
  setImages({ action: "init", init: services[2] });
274
276
  if (services[2]?.values?.length > 0) setActiveImage(0);
275
-
276
- getPercentage({ data: [product] }).then((res) => setPercentages(res));
277
+ getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
277
278
  setLoading(false);
278
279
  };
279
280
 
@@ -363,12 +364,13 @@ export const ProviderProductEdition = ({
363
364
  useEffect(() => {
364
365
  const productTemp = product;
365
366
  const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
366
- retailers?.forEach((retailer) => {
367
- retailer["percentage"] = percentages?.find(
368
- (percent) => retailer?.id === percent?.id_retailer
369
- )?.percentage;
370
- });
371
-
367
+ if (Object.keys(percentages[productTemp.id_article] ?? {})?.length > 0) {
368
+ retailers?.forEach((retailer, index) => {
369
+ retailer["percentage"] = Number(
370
+ percentages[productTemp.id_article][retailer.id].percentageRequired
371
+ );
372
+ });
373
+ }
372
374
  setProduct(productTemp);
373
375
  setActivePercentage(retailers[0]?.percentage);
374
376
  }, [percentages]);
@@ -1056,7 +1058,12 @@ export const ProviderProductEdition = ({
1056
1058
  ];
1057
1059
  return (
1058
1060
  <Container headerTop={headerTop}>
1059
- <HeaderTop setHeaderTop={setHeaderTop} />
1061
+ <HeaderTop
1062
+ setHeaderTop={setHeaderTop}
1063
+ withChat={location?.state?.withChat}
1064
+ productSelected={productSelected}
1065
+ token={token}
1066
+ />
1060
1067
  <div className="data-container">
1061
1068
  <div className="image-data-panel">
1062
1069
  <ImagePreviewer
@@ -12,54 +12,49 @@ export const RetailerProductEditionDefault = Template.bind({});
12
12
  RetailerProductEditionDefault.args = {
13
13
  tabsSections: {
14
14
  Descripción: true,
15
- "Ficha técnica": false,
16
- Imágenes: false,
15
+ "Ficha técnica": true,
16
+ Imágenes: true,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91c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Selected: {
21
21
  services: {
22
22
  datasheets: 1,
23
23
  descriptions: 1,
24
24
  images: 1,
25
25
  },
26
- orderId: 123,
27
- status: "PA",
28
- datasheet_status: "PA",
26
+ orderId: 194,
27
+ status: "AC",
28
+ datasheet_status: "AC",
29
29
  prio: "none",
30
30
  version: 3,
31
- description_status: "PA",
32
- images_status: "PA",
31
+ description_status: "AC",
32
+ images_status: "AC",
33
33
  statusByRetailer: {
34
- 4: {
35
- datasheet: "PA",
36
- description: "PA",
37
- images: "PA",
34
+ 40: {
35
+ description: "AC",
36
+ images: "AC",
37
+ datasheet: "AC",
38
38
  },
39
- 5: {
40
- datasheet: "PA",
41
- description: "PA",
42
- images: "PA",
43
- },
44
- 6: {
45
- datasheet: "PA",
46
- description: "PA",
47
- images: "PA",
39
+ 43: {
40
+ datasheet: "AC",
41
+ description: "AC",
42
+ images: "AC",
48
43
  },
49
44
  },
50
45
  article: {
51
- id_article: 127,
52
- id_category: "700",
53
- name: "prueba prod flujo",
54
- upc: "34234353324",
55
- timestamp: "2022-11-23T23:12:30.000Z",
46
+ id_article: 354,
47
+ id_category: "684",
48
+ name: "Enjuague Bucal ",
49
+ upc: "22342342",
50
+ timestamp: "2023-01-03T16:19:49.000Z",
56
51
  id_user: 28,
57
52
  status: "NULL",
58
53
  active: 1,
59
54
  company_id: 1,
60
55
  company_name: "GRUPO BRAHMA",
61
56
  country: "México",
62
- id_order: 123,
57
+ id_order: 194,
63
58
  id_datasheet_especialist: 54,
64
59
  id_datasheet_facilitator: 52,
65
60
  id_description_especialist: 54,
@@ -68,42 +63,37 @@ RetailerProductEditionDefault.args = {
68
63
  id_images_facilitator: 53,
69
64
  id_auditor: 37,
70
65
  id_recepcionist: null,
71
- category:
72
- "Salud y Belleza|Cuidado Facial|Cremas, Mascarillas y Tratamientos",
66
+ category: "Salud y Belleza|Cuidado Bucal|Pastas Dentales y Aseo Bucal",
73
67
  missingAttributes: 0,
74
68
  missingDescriptions: 0,
75
69
  missingImages: 0,
76
70
  },
77
71
  retailers: [
78
72
  {
79
- id: 4,
80
- name: "Walmart Super y Superama",
81
- },
82
- {
83
- id: 5,
84
- name: "Chedraui",
73
+ id: 40,
74
+ name: "Nadro",
85
75
  },
86
76
  {
87
- id: 6,
88
- name: "HEB",
77
+ id: 43,
78
+ name: "City Club",
89
79
  },
90
80
  ],
91
81
  country: "México",
92
- upc: "34234353324",
82
+ upc: "22342342",
93
83
  },
94
84
  location: {
95
- product: { articleId: 109485, versionId: 3 },
85
+ product: { articleId: 354, versionId: 3 },
96
86
  },
97
87
  user: {
98
- id_user: 51,
99
- name: "ADMIN PRUEBA",
100
- last_name: "",
101
- email: "etc@contentoh.com",
88
+ id_user: 65,
89
+ name: "Oscar Alberto",
90
+ last_name: "Arenas",
91
+ email: "oarenas@contentoh.com",
102
92
  position: "",
103
93
  telephone: "",
104
94
  country: "",
105
95
  id_company: 2,
106
- id_cognito: "a6c4d3d6-24a4-41d4-ad0f-d087438ab5b6",
96
+ id_cognito: "73cc8d40-c841-422a-a2f2-e69d7fe26ebf",
107
97
  birth_Date: null,
108
98
  about_me: "",
109
99
  zip_code: "",
@@ -114,7 +104,7 @@ RetailerProductEditionDefault.args = {
114
104
  active: 1,
115
105
  is_retailer: 0,
116
106
  email_notify: 1,
117
- is_user_tech: null,
107
+ is_user_tech: "AS",
118
108
  membership: {
119
109
  id: 2,
120
110
  start_date: "2021-11-05T02:35:12.000Z",
@@ -126,6 +116,6 @@ RetailerProductEditionDefault.args = {
126
116
  products_limit: "3",
127
117
  type: "PyMES",
128
118
  },
129
- src: "https://content-management-profile.s3.amazonaws.com/id-51/51.png?1669928511679",
119
+ src: "https://content-management-profile.s3.amazonaws.com/id-65/65.png?1675063399869",
130
120
  },
131
121
  };
@@ -175,6 +175,7 @@ export const RetailerProductEdition = ({
175
175
  const [percentages, setPercentages] = useState(
176
176
  new Array(product?.retailers?.length).fill({ percentage: 0 })
177
177
  );
178
+ // const [percentages, setPercentages] = useState([{ retailers: {} }]);
178
179
  const [activePercentage, setActivePercentage] = useState(0);
179
180
  const [activeRetailer, setActiveRetailer] = useState({});
180
181
  const [services, setServices] = useState([]);
@@ -225,12 +226,9 @@ export const RetailerProductEdition = ({
225
226
  //Converts the data inside the datasheets object to array
226
227
  setServices(services);
227
228
  getServices();
228
-
229
- // setActiveRetailer(product?.retailers[0]);
230
229
  setImages({ action: "init", init: services[2] });
231
230
  if (services[2]?.values?.length > 0) setActiveImage(0);
232
-
233
- getPercentage({ data: [product] }).then((res) => setPercentages(res));
231
+ getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
234
232
  setLoading(false);
235
233
  } catch (error) {
236
234
  console.log(error);
@@ -371,12 +369,18 @@ export const RetailerProductEdition = ({
371
369
  }, [userGroups]);
372
370
 
373
371
  useEffect(() => {
374
- product?.retailers?.forEach((retailer) => {
375
- retailer["percentage"] = percentages?.filter(
376
- (percent) => retailer?.id === percent?.id_retailer
377
- )[0]?.percentage;
378
- });
379
- setActivePercentage(product?.retailers[0]?.percentage);
372
+ const retailers = product?.retailersAvailable || product?.retailers;
373
+ if (
374
+ Object.keys(percentages[product.article.id_article] ?? {})?.length > 0
375
+ ) {
376
+ retailers?.forEach((retailer, index) => {
377
+ retailer["percentage"] = Number(
378
+ percentages[product.article.id_article][retailer.id]
379
+ .percentageRequired
380
+ );
381
+ });
382
+ }
383
+ setActivePercentage(retailers[0]?.percentage);
380
384
  }, [percentages]);
381
385
 
382
386
  useEffect(() => {
@@ -86,32 +86,27 @@ export const getImage = (imageGeneral, width = 250, height = 250) => {
86
86
  export const getPercentage = async (params = {}) => {
87
87
  const func = async () => {
88
88
  const dataToSend = [];
89
+ const arrayRetailers = [];
89
90
  let retailers =
90
91
  params.data[0].retailers || params.data[0].retailersAvailable;
91
- params.data.forEach((product) => {
92
+ params.data.forEach((product, i) => {
93
+ dataToSend.push(
94
+ product.article
95
+ ? {
96
+ id_article: product.article.id_article,
97
+ id_category: product.article.id_category,
98
+ version: product.version,
99
+ }
100
+ : {
101
+ id_article: product.id_article,
102
+ id_category: product.id_category,
103
+ version: product.version,
104
+ }
105
+ );
92
106
  retailers.forEach((retailer) => {
93
- dataToSend.push(
94
- product.article
95
- ? {
96
- id_article: product.article.id_article,
97
- id_category: product.article.id_category,
98
- id_retailer: retailer.id,
99
- version: product.version,
100
- upc: product.article.upc,
101
- name: product.article.name,
102
- retailerName: retailer.name,
103
- }
104
- : {
105
- id_article: product.id_article,
106
- id_category: product.id_category,
107
- id_retailer: retailer.id,
108
- version: product.version,
109
- upc: product.upc,
110
- name: product.name,
111
- retailerName: retailer.name,
112
- }
113
- );
107
+ arrayRetailers.push(retailer.id);
114
108
  });
109
+ dataToSend[i].id_retailer_array = arrayRetailers;
115
110
  });
116
111
 
117
112
  return await axios
@@ -125,7 +120,7 @@ export const getPercentage = async (params = {}) => {
125
120
  }
126
121
  )
127
122
  .then((response) => {
128
- return response.data;
123
+ return [response.data];
129
124
  })
130
125
  .catch((err) => console.log(err, "Errror"));
131
126
  };
@@ -61,3 +61,9 @@
61
61
  src: url("../assets/fonts/roboto/Roboto-Regular.ttf");
62
62
  font-weight: 400;
63
63
  }
64
+
65
+ .prueba {
66
+ color: #9e3e26;
67
+ color: #b42983;
68
+ color: #e7e7e7;
69
+ }