contentoh-components-library 21.4.62 → 21.4.64

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 (157) hide show
  1. package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
  2. package/dist/components/atoms/Avatar/index.js +3 -2
  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 +120 -0
  6. package/dist/components/atoms/ImageCarousel/styles.js +18 -0
  7. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  8. package/dist/components/atoms/PercentTag/PercentTag.stories.js +31 -0
  9. package/dist/components/atoms/PercentTag/index.js +23 -0
  10. package/dist/components/atoms/PercentTag/styles.js +22 -0
  11. package/dist/components/atoms/RatingStars/RatingStars.stories.js +30 -0
  12. package/dist/components/atoms/RatingStars/index.js +53 -0
  13. package/dist/components/atoms/RatingStars/styles.js +18 -0
  14. package/dist/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +48 -0
  15. package/dist/components/atoms/RetailerCatalog/index.js +69 -0
  16. package/dist/components/atoms/RetailerCatalog/styles.js +20 -0
  17. package/dist/components/atoms/RetailerOption/RetailerOption.stories.js +33 -0
  18. package/dist/components/atoms/RetailerOption/index.js +62 -0
  19. package/dist/components/atoms/RetailerOption/styles.js +20 -0
  20. package/dist/components/atoms/RetailersList/RetailersList.stories.js +45 -0
  21. package/dist/components/atoms/RetailersList/index.js +46 -0
  22. package/dist/components/atoms/RetailersList/styles.js +18 -0
  23. package/dist/components/atoms/SliderToolTip/styles.js +1 -1
  24. package/dist/components/atoms/UserCatalog/UserCatalog.stories.js +73 -0
  25. package/dist/components/atoms/UserCatalog/index.js +101 -0
  26. package/dist/components/atoms/UserCatalog/styles.js +18 -0
  27. package/dist/components/atoms/UserOption/UserOption.stories.js +40 -0
  28. package/dist/components/atoms/UserOption/index.js +130 -0
  29. package/dist/components/atoms/UserOption/styles.js +20 -0
  30. package/dist/components/atoms/UserSelector/UserSelector.stories.js +40 -0
  31. package/dist/components/atoms/UserSelector/index.js +98 -0
  32. package/dist/components/atoms/UserSelector/styles.js +32 -0
  33. package/dist/components/molecules/BoxAttribute/index.js +3 -3
  34. package/dist/components/molecules/BoxAttribute/styles.js +1 -1
  35. package/dist/components/molecules/BoxButtons/index.js +0 -1
  36. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  37. package/dist/components/molecules/GridItem/GridItem.stories.js +123 -0
  38. package/dist/components/molecules/GridItem/index.js +152 -0
  39. package/dist/components/molecules/GridItem/styles.js +20 -0
  40. package/dist/components/molecules/HeaderItem/ColumnItem.js +23 -0
  41. package/dist/components/molecules/HeaderItem/HeaderItem.stories.js +70 -0
  42. package/dist/components/molecules/HeaderItem/index.js +42 -0
  43. package/dist/components/molecules/HeaderItem/styles.js +30 -0
  44. package/dist/components/molecules/HeaderTop/index.js +68 -11
  45. package/dist/components/molecules/RowItem/ColumnItem.js +23 -0
  46. package/dist/components/molecules/RowItem/RowItem.stories.js +5242 -0
  47. package/dist/components/molecules/RowItem/index.js +58 -0
  48. package/dist/components/molecules/RowItem/styles.js +30 -0
  49. package/dist/components/molecules/SignInLogin/index.js +36 -28
  50. package/dist/components/molecules/StripeCardSelector/CardSelector.stories.js +1 -2
  51. package/dist/components/organisms/Chat/Chat.stories.js +27 -8
  52. package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
  53. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  54. package/dist/components/organisms/Chat/ContentChat/index.js +350 -197
  55. package/dist/components/organisms/Chat/Footer/index.js +48 -39
  56. package/dist/components/organisms/Chat/index.js +49 -4
  57. package/dist/components/organisms/Chat/styles.js +1 -1
  58. package/dist/components/organisms/DashboardMetric/index.js +12 -6
  59. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  60. package/dist/components/organisms/GridProducts/GridProducts.stories.js +5097 -0
  61. package/dist/components/organisms/GridProducts/index.js +63 -0
  62. package/dist/components/organisms/GridProducts/styles.js +18 -0
  63. package/dist/components/organisms/GridProducts/utils.js +149 -0
  64. package/dist/components/organisms/InputGroup/index.js +1 -10
  65. package/dist/components/organisms/Modal/styles.js +1 -1
  66. package/dist/components/pages/Dashboard/Dashboard.stories.js +33 -36
  67. package/dist/components/pages/Dashboard/index.js +35 -8
  68. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +3 -3
  69. package/dist/components/pages/ProviderProductEdition/index.js +120 -144
  70. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  71. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +7 -3
  72. package/dist/components/pages/RetailerProductEdition/index.js +276 -274
  73. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  74. package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
  75. package/dist/global-files/data.js +11 -3
  76. package/dist/global-files/variables.js +5 -1
  77. package/dist/index.js +201 -58
  78. package/package.json +2 -1
  79. package/src/components/atoms/Avatar/index.js +8 -2
  80. package/src/components/atoms/CheckBox/styles.js +2 -0
  81. package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +76 -0
  82. package/src/components/atoms/ImageCarousel/index.js +103 -0
  83. package/src/components/atoms/ImageCarousel/styles.js +79 -0
  84. package/src/components/atoms/InputFormatter/styles.js +2 -1
  85. package/src/components/atoms/PercentTag/PercentTag.stories.js +7 -0
  86. package/src/components/atoms/PercentTag/index.js +9 -0
  87. package/src/components/atoms/PercentTag/styles.js +69 -0
  88. package/src/components/atoms/RatingStars/RatingStars.stories.js +10 -0
  89. package/src/components/atoms/RatingStars/index.js +31 -0
  90. package/src/components/atoms/RatingStars/styles.js +28 -0
  91. package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +36 -0
  92. package/src/components/atoms/RetailerCatalog/index.js +49 -0
  93. package/src/components/atoms/RetailerCatalog/styles.js +30 -0
  94. package/src/components/atoms/RetailerOption/RetailerOption.stories.js +15 -0
  95. package/src/components/atoms/RetailerOption/index.js +53 -0
  96. package/src/components/atoms/RetailerOption/styles.js +41 -0
  97. package/src/components/atoms/RetailersList/RetailersList.stories.js +33 -0
  98. package/src/components/atoms/RetailersList/index.js +20 -0
  99. package/src/components/atoms/RetailersList/styles.js +19 -0
  100. package/src/components/atoms/SliderToolTip/styles.js +1 -1
  101. package/src/components/atoms/TabSection/styles.js +1 -1
  102. package/src/components/atoms/UserCatalog/UserCatalog.stories.js +67 -0
  103. package/src/components/atoms/UserCatalog/index.js +100 -0
  104. package/src/components/atoms/UserCatalog/styles.js +24 -0
  105. package/src/components/atoms/UserOption/UserOption.stories.js +25 -0
  106. package/src/components/atoms/UserOption/index.js +95 -0
  107. package/src/components/atoms/UserOption/styles.js +61 -0
  108. package/src/components/atoms/UserSelector/UserSelector.stories.js +25 -0
  109. package/src/components/atoms/UserSelector/index.js +86 -0
  110. package/src/components/atoms/UserSelector/styles.js +55 -0
  111. package/src/components/molecules/BoxAttribute/index.js +32 -25
  112. package/src/components/molecules/BoxAttribute/styles.js +1 -1
  113. package/src/components/molecules/BoxButtons/index.js +23 -22
  114. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  115. package/src/components/molecules/GridItem/GridItem.stories.js +126 -0
  116. package/src/components/molecules/GridItem/index.js +105 -0
  117. package/src/components/molecules/GridItem/styles.js +104 -0
  118. package/src/components/molecules/HeaderItem/ColumnItem.js +9 -0
  119. package/src/components/molecules/HeaderItem/HeaderItem.stories.js +24 -0
  120. package/src/components/molecules/HeaderItem/index.js +26 -0
  121. package/src/components/molecules/HeaderItem/styles.js +27 -0
  122. package/src/components/molecules/HeaderTop/index.js +52 -6
  123. package/src/components/molecules/RowItem/ColumnItem.js +9 -0
  124. package/src/components/molecules/RowItem/RowItem.stories.js +5660 -0
  125. package/src/components/molecules/RowItem/index.js +45 -0
  126. package/src/components/molecules/RowItem/styles.js +40 -0
  127. package/src/components/molecules/SignInLogin/index.js +11 -11
  128. package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +1 -2
  129. package/src/components/molecules/TagAndInput/index.js +6 -5
  130. package/src/components/organisms/Chat/Chat.stories.js +27 -7
  131. package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
  132. package/src/components/organisms/Chat/ContainerItems/styles.js +14 -2
  133. package/src/components/organisms/Chat/ContentChat/index.js +88 -12
  134. package/src/components/organisms/Chat/Footer/index.js +11 -0
  135. package/src/components/organisms/Chat/index.js +46 -4
  136. package/src/components/organisms/Chat/styles.js +4 -0
  137. package/src/components/organisms/DashboardMetric/index.js +6 -3
  138. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  139. package/src/components/organisms/GridProducts/GridProducts.stories.js +5485 -0
  140. package/src/components/organisms/GridProducts/index.js +50 -0
  141. package/src/components/organisms/GridProducts/styles.js +14 -0
  142. package/src/components/organisms/GridProducts/utils.js +111 -0
  143. package/src/components/organisms/InputGroup/index.js +131 -119
  144. package/src/components/organisms/Modal/styles.js +4 -1
  145. package/src/components/organisms/OrderDetail/utils/Table/utils.js +6 -16
  146. package/src/components/pages/Dashboard/Dashboard.stories.js +33 -38
  147. package/src/components/pages/Dashboard/index.js +33 -5
  148. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +100 -83
  149. package/src/components/pages/ProviderProductEdition/index.js +100 -131
  150. package/src/components/pages/ProviderProductEdition/styles.js +5 -1
  151. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +6 -2
  152. package/src/components/pages/RetailerProductEdition/index.js +111 -142
  153. package/src/components/pages/RetailerProductEdition/styles.js +4 -0
  154. package/src/components/pages/RetailerProductEdition/utils.js +37 -0
  155. package/src/global-files/data.js +7 -13
  156. package/src/global-files/variables.js +4 -0
  157. package/src/index.js +11 -0
@@ -40,6 +40,8 @@ export const Dashboard = ({ jwt, user, company }) => {
40
40
  const [applicantsFilter, setApplicantsFilter] = useState([]);
41
41
  const [totalCount, setTotalCount] = useState(0);
42
42
  const [isProviderFinanced] = useState(company?.financedRetailers?.length > 0);
43
+ const [trades, setTrades] = useState([]);
44
+ const [tradesSelected, setTradesSelected] = useState([]);
43
45
 
44
46
  const loadProductVersions = async (queryObject) => {
45
47
  const keys = Object.keys(queryObject);
@@ -84,9 +86,10 @@ export const Dashboard = ({ jwt, user, company }) => {
84
86
  const isRetailer = user.is_retailer && company.retailers;
85
87
  const isProvider = !user.is_retailer && user.id_role === 0;
86
88
  const isCollaborator = user.id_role > 0;
87
- const { ordersBydate, ordersByStatus } =
89
+ const { ordersBydate, ordersByStatus, ordersByActive, companyTrades } =
88
90
  (await loadProductVersions(orderByStatus)) || {};
89
91
 
92
+ if (trades.length === 0) setTrades(companyTrades);
90
93
  const { total = 0, R = 0, PA = 0, Ex = 0, ACA = 0 } = ordersByStatus;
91
94
  let productsFinished = 0;
92
95
  if (isRetailer) productsFinished = Ex;
@@ -100,13 +103,18 @@ export const Dashboard = ({ jwt, user, company }) => {
100
103
  : prev,
101
104
  0
102
105
  );
106
+
107
+ const registeredProducts = ordersByActive.registered;
103
108
  let metricsArray = [
104
109
  metricsData[0]
105
110
  ? metricsData[0]
106
111
  : { label: "Productos totales", value: total },
107
112
  ];
108
113
 
114
+ console.log(registeredProducts);
115
+
109
116
  metricsArray.push(
117
+ { label: "Productos activos", value: registeredProducts },
110
118
  { label: "Productos filtrados", value: total },
111
119
  { label: "Productos sin asignar", value: PA + R },
112
120
  { label: "Productos en proceso", value: inProcess },
@@ -229,14 +237,23 @@ export const Dashboard = ({ jwt, user, company }) => {
229
237
  startDate: startDate,
230
238
  endDate: endDate,
231
239
  };
232
- companyId.length > 0 && (queryObject["companyId"] = companyId.join(","));
233
- retailerId.length > 0 && (queryObject["retailerId"] = retailerId.join(","));
234
- categoryId.length > 0 && (queryObject["categoryId"] = categoryId.join(","));
240
+ if (companyId.length > 0) queryObject["companyId"] = companyId.join(",");
241
+ if (retailerId.length > 0) queryObject["retailerId"] = retailerId.join(",");
242
+ if (categoryId.length > 0) queryObject["categoryId"] = categoryId.join(",");
243
+ if (tradesSelected.length > 0)
244
+ queryObject["trades"] = encodeURIComponent(tradesSelected.join(","));
235
245
  applicantsFilter.length > 0 &&
236
246
  (queryObject["requestedBy"] = applicantsFilter.join(","));
237
247
 
238
248
  await loadProductsByStatus(queryObject, true);
239
- }, [companyId, retailerId, categoryId, datesRange, applicantsFilter]);
249
+ }, [
250
+ companyId,
251
+ retailerId,
252
+ categoryId,
253
+ datesRange,
254
+ applicantsFilter,
255
+ tradesSelected,
256
+ ]);
240
257
 
241
258
  return loading ? (
242
259
  <Loading />
@@ -301,6 +318,17 @@ export const Dashboard = ({ jwt, user, company }) => {
301
318
  defaultOption="Todos los solicitantes"
302
319
  />
303
320
  )}
321
+ {user.id_role === 0 && trades?.length > 0 && (
322
+ <CustomSelect
323
+ showSearchBar={true}
324
+ options={trades}
325
+ selectLabel="Todas las marcas"
326
+ placeHolder="Buscar marca"
327
+ customSelectId="trade-select"
328
+ parameterArray={tradesSelected}
329
+ setParameterArray={setTradesSelected}
330
+ />
331
+ )}
304
332
  </div>
305
333
  <div className="metric-cards">
306
334
  {metricsData.map((metric, index) => (
@@ -21,39 +21,41 @@ ProviderProductEditionDefault.args = {
21
21
  category: 287,
22
22
  version: 1,
23
23
  productSelected: {
24
- id_article:39550,
25
- upc:43654697,
26
- name:"Campana de Cocina",
27
- timestamp:"2023-08-04T22:23:40.000Z",
28
- categoryName:"Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
29
- id_category:287,
30
- version:1,
31
- retailersAvailable:[
32
- {name:"The Home Depot Golden","id":58},
33
- {name:"The Home Depot Onboarding","id":68}],
34
- percentage:"89"
35
- },
24
+ id_article: 39550,
25
+ upc: 43654697,
26
+ name: "Campana de Cocina",
27
+ timestamp: "2023-08-04T22:23:40.000Z",
28
+ categoryName:
29
+ "Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
30
+ id_category: 287,
31
+ version: 1,
32
+ retailersAvailable: [
33
+ { name: "The Home Depot Golden", id: 58 },
34
+ { name: "The Home Depot Onboarding", id: 68 },
35
+ ],
36
+ percentage: "89",
37
+ },
36
38
  productToEdit: {
37
- idCategory:287,
38
- ArticleId:39550,
39
- product:[{
40
- id_article:39550,
41
- upc:43654697,
42
- name:"Campana de Cocina",
43
- timestamp:"2023-08-04T22:23:40.000Z",
44
- categoryName:"Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
45
- id_category:287,
46
- version:1,
47
- retailersAvailable:[
48
- {name:"The Home Depot Golden",
49
- id:58,
50
- percentage:100},
51
- {name:"The Home Depot Onboarding",
52
- id:68,
53
- percentage:78}
54
- ],
55
- percentage:"89"}]
56
- },
39
+ idCategory: 287,
40
+ ArticleId: 39550,
41
+ product: [
42
+ {
43
+ id_article: 39550,
44
+ upc: 43654697,
45
+ name: "Campana de Cocina",
46
+ timestamp: "2023-08-04T22:23:40.000Z",
47
+ categoryName:
48
+ "Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
49
+ id_category: 287,
50
+ version: 1,
51
+ retailersAvailable: [
52
+ { name: "The Home Depot Golden", id: 58, percentage: 100 },
53
+ { name: "The Home Depot Onboarding", id: 68, percentage: 78 },
54
+ ],
55
+ percentage: "89",
56
+ },
57
+ ],
58
+ },
57
59
  location: {
58
60
  pathname: "/EditProducts",
59
61
  search: "",
@@ -66,57 +68,72 @@ ProviderProductEditionDefault.args = {
66
68
  key: "24vwut",
67
69
  },
68
70
  user: {
69
- id_user:191,
70
- name:"Demo",
71
- last_name:"Demo",
72
- email:"merchants24feb@allfreemail.net",
73
- position:"Test",
74
- telephone:"+52123456789",
75
- country:"México",
76
- id_company:923,
77
- id_cognito:"c3cd160c-76c2-497c-9357-5ef949307e1e",
78
- birth_Date:null,
79
- about_me:null,
80
- zip_code:null,
81
- address:null,
82
- job:null,
83
- id_stripe:null,
84
- id_role:0,
85
- active:1,
86
- is_retailer:0,
87
- email_notify:1,
88
- is_user_tech:null,
89
- membership:
90
- {id:114,
91
- start_date:"2023-02-24T18:14:43.000Z",
92
- end_date:"2024-02-24T18:14:43.000Z",
93
- planID:8,
94
- plan:"prod_KtlhECVSFG2iro",
95
- name:"Plan Pro",
96
- user_limit:"50",
97
- products_limit:"5000",
98
- type:"Enterprise"},
99
- src:"https://content-management-profile.s3.amazonaws.com/id-191/191.png?1697171804447"},
71
+ id_user: 191,
72
+ name: "Demo",
73
+ last_name: "Demo",
74
+ email: "merchants24feb@allfreemail.net",
75
+ position: "Test",
76
+ telephone: "+52123456789",
77
+ country: "México",
78
+ id_company: 923,
79
+ id_cognito: "c3cd160c-76c2-497c-9357-5ef949307e1e",
80
+ birth_Date: null,
81
+ about_me: null,
82
+ zip_code: null,
83
+ address: null,
84
+ job: null,
85
+ id_stripe: null,
86
+ id_role: 0,
87
+ active: 1,
88
+ is_retailer: 0,
89
+ email_notify: 1,
90
+ is_user_tech: null,
91
+ membership: {
92
+ id: 114,
93
+ start_date: "2023-02-24T18:14:43.000Z",
94
+ end_date: "2024-02-24T18:14:43.000Z",
95
+ planID: 8,
96
+ plan: "prod_KtlhECVSFG2iro",
97
+ name: "Plan Pro",
98
+ user_limit: "50",
99
+ products_limit: "5000",
100
+ type: "Enterprise",
101
+ },
102
+ src: "https://content-management-profile.s3.amazonaws.com/id-191/191.png?1697171804447",
103
+ },
100
104
  company: {
101
- id_company:923,
102
- trade_name:"Demo",
103
- company_name:"Demo",
104
- rfc:"Demo",
105
- adress:"Demo",
106
- about_company:null,
107
- telephone:null,
108
- web_site:null,
109
- zip_code:null,
110
- email:null,
111
- social_link:null,
112
- is_retailer:0,
113
- financedRetailers:
114
- [{id:68,
115
- name:"The Home Depot Onboarding",
116
- country:"México",
117
- id_region:1,
118
- active:1,
119
- flow:1}],
120
- retailers:[{id:68,name:"The Home Depot Onboarding",country:"México",id_region:1,"active":1,flow:1}]},
105
+ id_company: 923,
106
+ trade_name: "Demo",
107
+ company_name: "Demo",
108
+ rfc: "Demo",
109
+ adress: "Demo",
110
+ about_company: null,
111
+ telephone: null,
112
+ web_site: null,
113
+ zip_code: null,
114
+ email: null,
115
+ social_link: null,
116
+ is_retailer: 0,
117
+ financedRetailers: [
118
+ {
119
+ id: 68,
120
+ name: "The Home Depot Onboarding",
121
+ country: "México",
122
+ id_region: 1,
123
+ active: 1,
124
+ flow: 1,
125
+ },
126
+ ],
127
+ retailers: [
128
+ {
129
+ id: 68,
130
+ name: "The Home Depot Onboarding",
131
+ country: "México",
132
+ id_region: 1,
133
+ active: 1,
134
+ flow: 1,
135
+ },
136
+ ],
137
+ },
121
138
  showSurvey: (v) => v && alert("se muestra"),
122
139
  };
@@ -39,6 +39,10 @@ import Slide1_4 from "../../../assets/images/sliderToolTip/slide4.svg";
39
39
  import Slide1_5 from "../../../assets/images/sliderToolTip/slide5.svg";
40
40
  import { VersionSelector } from "../../organisms/VersionSelector";
41
41
  import { useCloseModal } from "../../../global-files/customHooks";
42
+ import { createMessage, sendMessage } from "../RetailerProductEdition/utils";
43
+ import { Modal } from "../../organisms/Modal";
44
+ import { ButtonV2 } from "../../atoms/ButtonV2";
45
+ import { Box } from "../../organisms/Box";
42
46
 
43
47
  const reducerImages = (state, action) => {
44
48
  let { values, attrForImgs, inputsByRetailer } = state;
@@ -215,6 +219,7 @@ export const ProviderProductEdition = ({
215
219
  const isRetailer = user?.is_retailer;
216
220
  const [loading, setLoading] = useState(true);
217
221
  const [validatedAll, setValidatedAll] = useState(false);
222
+ const [showRejectModal, setShowRejectModal] = useState(false);
218
223
 
219
224
  const [origin, setOrigin] = useState({
220
225
  "Ficha técnica": null,
@@ -344,28 +349,6 @@ export const ProviderProductEdition = ({
344
349
  (type) => {
345
350
  const formatter = new Intl.ListFormat("es", { type: "conjunction" });
346
351
  switch (type) {
347
- case "error":
348
- setGlobalModal({
349
- message: `${activeTab} rechazada`,
350
- detail: "Agrega tu comentarios para enviar el rechazo",
351
- img: errorModal,
352
- textArea: true,
353
- button1: {
354
- name: "Enviar",
355
- action: (e) => {
356
- const textArea = document.querySelector("#area");
357
- if (textArea.value) {
358
- textArea.style.border = "none";
359
- createComment(e, textArea.value);
360
- showGlobalModal("commentsSent");
361
- validatedAll ? validateAll("R") : sendEvaluation("R");
362
- } else {
363
- textArea.style.border = "2px solid red";
364
- }
365
- },
366
- },
367
- });
368
- break;
369
352
  case "generic":
370
353
  setGlobalModal(dataGenericModal);
371
354
  break;
@@ -526,7 +509,9 @@ export const ProviderProductEdition = ({
526
509
  );
527
510
  setServicesData(parsedResponse);
528
511
  }
529
- !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
512
+ retailers &&
513
+ !activeRetailer.id &&
514
+ setActiveRetailer(active ? active : retailers[0]);
530
515
  };
531
516
 
532
517
  const isRevision = () => {
@@ -602,7 +587,7 @@ export const ProviderProductEdition = ({
602
587
  });
603
588
  }
604
589
  setProduct(productTemp);
605
- setActivePercentage(retailers[0]?.percentage);
590
+ retailers && setActivePercentage(retailers[0]?.percentage);
606
591
  }, [percentages]);
607
592
 
608
593
  const loadInputs = () => {
@@ -862,33 +847,21 @@ export const ProviderProductEdition = ({
862
847
  return "images";
863
848
  }
864
849
  };
850
+
865
851
 
866
- const createComment = async (e, body, tab) => {
867
- let concept = "";
868
- switch (activeTab) {
869
- case "Ficha técnica":
870
- concept = "datasheet";
871
- break;
872
- case "Imágenes":
873
- concept = "images";
874
- break;
875
-
876
- default:
877
- concept = "description";
878
- break;
879
- }
852
+ const createComment = async (messages = [], retailerId) => {
880
853
  const data = {
881
- articleId: product?.id_article,
882
- orderId: product?.orderId,
883
- message: body,
884
- concept: concept,
885
- version: version,
886
- };
887
- await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
888
- headers: {
889
- Authorization: token,
854
+ paramsBody: {
855
+ id: product.article.id_article || productEdit.ArticleId,
856
+ version: version,
857
+ items: messages,
858
+ retailerId: retailerId,
859
+ status: product.status || productEdit.product.status,
890
860
  },
891
- });
861
+ paramsHeader: { Authorization: token },
862
+ };
863
+ setMessage("");
864
+ return sendMessage(data);
892
865
  };
893
866
 
894
867
  useEffect(() => {
@@ -1224,8 +1197,6 @@ export const ProviderProductEdition = ({
1224
1197
 
1225
1198
  const enableActions = (versionStatus) => {
1226
1199
  try {
1227
- if (user.is_retailer) return false;
1228
-
1229
1200
  if (versionStatus) {
1230
1201
  return ["AP", "ACA", "RCA", null].includes(versionStatus);
1231
1202
  }
@@ -1309,8 +1280,7 @@ export const ProviderProductEdition = ({
1309
1280
  return;
1310
1281
  } else if (user.is_retailer) {
1311
1282
  if (product.id_order || product.orderId) {
1312
- setValidatedAll(true);
1313
- showGlobalModal("error");
1283
+ sendEvaluation("R");
1314
1284
  } else {
1315
1285
  setDataGenericModal((prev) => ({
1316
1286
  ...prev,
@@ -1322,8 +1292,7 @@ export const ProviderProductEdition = ({
1322
1292
  showGlobalModal("generic");
1323
1293
  }
1324
1294
  } else {
1325
- setValidatedAll(true);
1326
- showGlobalModal("error");
1295
+ sendEvaluation("R");
1327
1296
  }
1328
1297
  }
1329
1298
  };
@@ -1333,6 +1302,7 @@ export const ProviderProductEdition = ({
1333
1302
  <HeaderTop
1334
1303
  setHeaderTop={setHeaderTop}
1335
1304
  withChat={location?.state?.withChat}
1305
+ chatType={location?.state?.chatType}
1336
1306
  productSelected={productSelected}
1337
1307
  token={token}
1338
1308
  activeRetailer={activeRetailer}
@@ -1411,7 +1381,7 @@ export const ProviderProductEdition = ({
1411
1381
  } else if (user.is_retailer) {
1412
1382
  if (product.id_order || product.orderId) {
1413
1383
  setValidatedAll(true);
1414
- showGlobalModal("error");
1384
+ setShowRejectModal(true);
1415
1385
  } else {
1416
1386
  setDataGenericModal((prev) => ({
1417
1387
  ...prev,
@@ -1423,12 +1393,14 @@ export const ProviderProductEdition = ({
1423
1393
  showGlobalModal("generic");
1424
1394
  }
1425
1395
  } else {
1396
+ setShowRejectModal(true);
1426
1397
  setValidatedAll(true);
1427
- showGlobalModal("error");
1428
1398
  }
1429
1399
  }}
1430
1400
  approve={() => sendToEvaluation("A")}
1431
- reject={() => sendToEvaluation("R")}
1401
+ reject={() => {
1402
+ setShowRejectModal(true);
1403
+ }}
1432
1404
  />
1433
1405
  <FullTabsMenu
1434
1406
  tabsSections={tabsSections}
@@ -1531,6 +1503,7 @@ export const ProviderProductEdition = ({
1531
1503
  setUpdatedDescriptions={setUpdatedDescriptions}
1532
1504
  articleId={product?.id_article}
1533
1505
  version={version}
1506
+ isShowbox={false}
1534
1507
  dinamicHeight={true}
1535
1508
  />
1536
1509
  ) : (
@@ -1557,87 +1530,41 @@ export const ProviderProductEdition = ({
1557
1530
  </>
1558
1531
  )}
1559
1532
  </div>
1560
- {isRevision() && getSectionStatus() ? (
1561
- <div className="commentary-box">
1562
- {!comment ? (
1563
- <div className="commentary">
1564
- <TagAndInput
1565
- label={"Caja de Comentario"}
1566
- inputType={"textarea"}
1567
- inputCols={80}
1568
- inputRows={4}
1569
- inputId={"commentary-box"}
1570
- index={0}
1571
- />
1572
- <div className="buttons-box">
1573
- <Button
1574
- buttonType={"general-transparent-button"}
1575
- label={"Enviar comentario"}
1576
- onClick={(e) =>
1577
- createComment(
1578
- e,
1579
- document.querySelector(
1580
- "#description-commentary-box-0 .ql-container .ql-editor > p"
1581
- ).innerHTML,
1582
- activeTab
1583
- )
1584
- }
1585
- />
1586
- </div>
1587
- </div>
1533
+ {!(isRevision() && getSectionStatus()) && !revision && (
1534
+ <div className="required-inputs-message">
1535
+ <div>
1536
+ <p>
1537
+ Los atributos son requeridos por las plataformas de las
1538
+ cadenas, es muy importante completar los campos requeridos ya
1539
+ que pueden rechazar el producto por falta de información.
1540
+ </p>
1541
+ </div>
1542
+ {inCart ? (
1543
+ <button type="button">
1544
+ <Link to="/checkout">
1545
+ <p>Articulo en carrito</p>
1546
+ <p>Ir a checkout</p>
1547
+ </Link>
1548
+ </button>
1588
1549
  ) : (
1589
- <div className="feedback-box">
1590
- <Commentary
1591
- comment={comment.message}
1592
- reviewed={crossComment}
1550
+ <>
1551
+ <SliderToolTip
1552
+ infoIcon={InfoIcon}
1553
+ slidefront={slidefront}
1554
+ iconSize={"big-image"}
1555
+ slidePosition={"top-slide"}
1593
1556
  />
1594
1557
  <Button
1595
- buttonType={"circular-button accept-button"}
1596
- onClick={async () => {
1597
- setCrossComment(true);
1598
- commentRevised();
1558
+ onClick={() => {
1559
+ setShowContentohRequestModal &&
1560
+ setShowContentohRequestModal(true);
1599
1561
  }}
1562
+ buttonType="general-default-button"
1563
+ label="Enviar a Content-oh!"
1600
1564
  />
1601
- </div>
1565
+ </>
1602
1566
  )}
1603
1567
  </div>
1604
- ) : (
1605
- !revision && (
1606
- <div className="required-inputs-message">
1607
- <div>
1608
- <p>
1609
- Los atributos son requeridos por las plataformas de las
1610
- cadenas, es muy importante completar los campos requeridos
1611
- ya que pueden rechazar el producto por falta de información.
1612
- </p>
1613
- </div>
1614
- {inCart ? (
1615
- <button type="button">
1616
- <Link to="/checkout">
1617
- <p>Articulo en carrito</p>
1618
- <p>Ir a checkout</p>
1619
- </Link>
1620
- </button>
1621
- ) : (
1622
- <>
1623
- <SliderToolTip
1624
- infoIcon={InfoIcon}
1625
- slidefront={slidefront}
1626
- iconSize={"big-image"}
1627
- slidePosition={"top-slide"}
1628
- />
1629
- <Button
1630
- onClick={() => {
1631
- setShowContentohRequestModal &&
1632
- setShowContentohRequestModal(true);
1633
- }}
1634
- buttonType="general-default-button"
1635
- label="Enviar a Content-oh!"
1636
- />
1637
- </>
1638
- )}
1639
- </div>
1640
- )
1641
1568
  )}
1642
1569
  </div>
1643
1570
  </div>
@@ -1680,6 +1607,48 @@ export const ProviderProductEdition = ({
1680
1607
  jwt={token}
1681
1608
  />
1682
1609
  )}
1610
+ {showRejectModal && (
1611
+ <Modal
1612
+ title={"Agregar mensaje de rechazo"}
1613
+ show={showRejectModal}
1614
+ customComponent={
1615
+ <TagAndInput
1616
+ inputType={"textarea"}
1617
+ inputId={"modal-message-box"}
1618
+ index={0}
1619
+ color={"white"}
1620
+ />
1621
+ }
1622
+ buttons={[
1623
+ <ButtonV2
1624
+ key={"btn-Cancelar"}
1625
+ type={"white"}
1626
+ label={"Cancelar"}
1627
+ size={12}
1628
+ onClick={() => {
1629
+ setShowRejectModal(false);
1630
+ }}
1631
+ />,
1632
+ <ButtonV2
1633
+ key={"btn-Aceptar"}
1634
+ type={"pink"}
1635
+ label={"Aceptar"}
1636
+ size={12}
1637
+ onClick={async () => {
1638
+ const body = document.querySelector(
1639
+ "#modal-message-box .ql-container .ql-editor > p"
1640
+ ).innerHTML;
1641
+ const messages = [
1642
+ { type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
1643
+ ];
1644
+ await createComment(messages, activeRetailer.id);
1645
+ validatedAll ? validateAll("R") : sendToEvaluation("R");
1646
+ setShowRejectModal(false);
1647
+ }}
1648
+ />,
1649
+ ]}
1650
+ />
1651
+ )}
1683
1652
  </Container>
1684
1653
  );
1685
1654
  };
@@ -107,6 +107,10 @@ export const Container = styled.div`
107
107
  }
108
108
  }
109
109
  }
110
+ #modal-message-box {
111
+ width: 400px;
112
+ height: 100px;
113
+ }
110
114
  .container {
111
115
  width: 100%;
112
116
  height: 100%;
@@ -115,4 +119,4 @@ export const Container = styled.div`
115
119
  width: 100%;
116
120
  }
117
121
  }
118
- `;
122
+ `;
@@ -16,7 +16,7 @@ RetailerProductEditionDefault.args = {
16
16
  Imágenes: false,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp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: "7543453453",
74
74
  },
75
75
  location: {
76
- product: { articleId: 39290, versionId: 7 },
76
+ product: { articleId: 354, versionId: 3 },
77
+ state: {
78
+ withChat: true,
79
+ chatType: "product_status",
80
+ },
77
81
  },
78
82
  user: {
79
83
  id_user: 37,