contentoh-components-library 21.4.17 → 21.4.19

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 (114) hide show
  1. package/.env.development +5 -1
  2. package/.env.production +3 -1
  3. package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
  4. package/dist/components/atoms/Avatar/index.js +3 -2
  5. package/dist/components/atoms/Card/index.js +46 -5
  6. package/dist/components/atoms/Card/styles.js +3 -1
  7. package/dist/components/atoms/CheckBox/index.js +7 -2
  8. package/dist/components/atoms/CheckBox/styles.js +1 -1
  9. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  10. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  11. package/dist/components/molecules/HeaderTop/index.js +68 -11
  12. package/dist/components/molecules/TagAndInput/index.js +1 -1
  13. package/dist/components/organisms/Chat/Chat.stories.js +27 -8
  14. package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
  15. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  16. package/dist/components/organisms/Chat/ContentChat/index.js +350 -197
  17. package/dist/components/organisms/Chat/Footer/index.js +48 -39
  18. package/dist/components/organisms/Chat/index.js +49 -4
  19. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  20. package/dist/components/organisms/Modal/styles.js +1 -1
  21. package/dist/components/organisms/PanelLayout/PanelLayout.stories.js +1 -1
  22. package/dist/components/organisms/PanelLayout/index.js +7 -5
  23. package/dist/components/organisms/PanelLayout/styles.js +3 -3
  24. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +88 -120
  25. package/dist/components/pages/ProviderProductEdition/index.js +216 -200
  26. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  27. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +56 -52
  28. package/dist/components/pages/RetailerProductEdition/index.js +318 -300
  29. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  30. package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
  31. package/dist/index.js +247 -52
  32. package/package.json +4 -1
  33. package/src/components/atoms/Avatar/index.js +8 -2
  34. package/src/components/atoms/Card/index.js +35 -2
  35. package/src/components/atoms/Card/styles.js +41 -5
  36. package/src/components/atoms/CheckBox/index.js +4 -1
  37. package/src/components/atoms/CheckBox/styles.js +2 -0
  38. package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +76 -0
  39. package/src/components/atoms/ImageCarousel/index.js +103 -0
  40. package/src/components/atoms/ImageCarousel/styles.js +79 -0
  41. package/src/components/atoms/InputFormatter/styles.js +2 -1
  42. package/src/components/atoms/PercentTag/PercentTag.stories.js +7 -0
  43. package/src/components/atoms/PercentTag/index.js +9 -0
  44. package/src/components/atoms/PercentTag/styles.js +69 -0
  45. package/src/components/atoms/RatingStars/RatingStars.stories.js +10 -0
  46. package/src/components/atoms/RatingStars/index.js +31 -0
  47. package/src/components/atoms/RatingStars/styles.js +28 -0
  48. package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +36 -0
  49. package/src/components/atoms/RetailerCatalog/index.js +49 -0
  50. package/src/components/atoms/RetailerCatalog/styles.js +30 -0
  51. package/src/components/atoms/RetailerOption/RetailerOption.stories.js +15 -0
  52. package/src/components/atoms/RetailerOption/index.js +53 -0
  53. package/src/components/atoms/RetailerOption/styles.js +41 -0
  54. package/src/components/atoms/RetailersList/RetailersList.stories.js +33 -0
  55. package/src/components/atoms/RetailersList/index.js +20 -0
  56. package/src/components/atoms/RetailersList/styles.js +19 -0
  57. package/src/components/atoms/UserCatalog/UserCatalog.stories.js +67 -0
  58. package/src/components/atoms/UserCatalog/index.js +100 -0
  59. package/src/components/atoms/UserCatalog/styles.js +24 -0
  60. package/src/components/atoms/UserOption/UserOption.stories.js +25 -0
  61. package/src/components/atoms/UserOption/index.js +95 -0
  62. package/src/components/atoms/UserOption/styles.js +61 -0
  63. package/src/components/atoms/UserSelector/UserSelector.stories.js +25 -0
  64. package/src/components/atoms/UserSelector/index.js +86 -0
  65. package/src/components/atoms/UserSelector/styles.js +55 -0
  66. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  67. package/src/components/molecules/GridItem/GridItem.stories.js +126 -0
  68. package/src/components/molecules/GridItem/index.js +105 -0
  69. package/src/components/molecules/GridItem/styles.js +104 -0
  70. package/src/components/molecules/HeaderItem/ColumnItem.js +9 -0
  71. package/src/components/molecules/HeaderItem/HeaderItem.stories.js +24 -0
  72. package/src/components/molecules/HeaderItem/index.js +26 -0
  73. package/src/components/molecules/HeaderItem/styles.js +27 -0
  74. package/src/components/molecules/HeaderTop/index.js +52 -6
  75. package/src/components/molecules/RowItem/ColumnItem.js +9 -0
  76. package/src/components/molecules/RowItem/RowItem.stories.js +5660 -0
  77. package/src/components/molecules/RowItem/index.js +45 -0
  78. package/src/components/molecules/RowItem/styles.js +40 -0
  79. package/src/components/molecules/StripeCardForm/StripeCardForm.stories.js +13 -0
  80. package/src/components/molecules/StripeCardForm/index.js +42 -0
  81. package/src/components/molecules/StripeCardForm/paymentForm.js +124 -0
  82. package/src/components/molecules/StripeCardForm/styles.js +73 -0
  83. package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +12 -0
  84. package/src/components/molecules/StripeCardSelector/index.js +44 -0
  85. package/src/components/molecules/StripeCardSelector/styles.js +4 -0
  86. package/src/components/molecules/StripeCardSelector/utils.js +17 -0
  87. package/src/components/molecules/TagAndInput/index.js +10 -8
  88. package/src/components/organisms/Chat/Chat.stories.js +27 -7
  89. package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
  90. package/src/components/organisms/Chat/ContainerItems/styles.js +10 -2
  91. package/src/components/organisms/Chat/ContentChat/index.js +88 -12
  92. package/src/components/organisms/Chat/Footer/index.js +11 -0
  93. package/src/components/organisms/Chat/index.js +46 -4
  94. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  95. package/src/components/organisms/GridProducts/GridProducts.stories.js +5485 -0
  96. package/src/components/organisms/GridProducts/index.js +50 -0
  97. package/src/components/organisms/GridProducts/styles.js +14 -0
  98. package/src/components/organisms/GridProducts/utils.js +111 -0
  99. package/src/components/organisms/Modal/styles.js +4 -1
  100. package/src/components/organisms/OrderDetail/utils/Table/utils.js +6 -16
  101. package/src/components/organisms/PanelLayout/PanelLayout.stories.js +63 -0
  102. package/src/components/organisms/PanelLayout/index.js +11 -0
  103. package/src/components/organisms/PanelLayout/styles.js +39 -0
  104. package/src/components/organisms/SideModal/SideModal.stories.js +23 -0
  105. package/src/components/organisms/SideModal/index.js +50 -0
  106. package/src/components/organisms/SideModal/styles.js +30 -0
  107. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +95 -127
  108. package/src/components/pages/ProviderProductEdition/index.js +135 -129
  109. package/src/components/pages/ProviderProductEdition/styles.js +5 -1
  110. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +55 -52
  111. package/src/components/pages/RetailerProductEdition/index.js +124 -136
  112. package/src/components/pages/RetailerProductEdition/styles.js +4 -0
  113. package/src/components/pages/RetailerProductEdition/utils.js +37 -0
  114. package/src/index.js +16 -0
@@ -16,142 +16,122 @@ ProviderProductEditionDefault.args = {
16
16
  Imágenes: false,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI1ODg0YWUzNC01OWQ2LTQ0NTQtYjk4ZS04MjE1MThiY2MzYTciLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6IjU4ODRhZTM0LTU5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,
23
23
  productSelected: {
24
- orderId: 15195,
25
- article_status: "AP",
26
- datasheet_status: "AP",
27
- description_status: "AP",
28
- images_status: "AP",
29
- prio: "none",
30
- version: 3,
31
- brand: null,
32
- article: {
33
- category:
34
- "Abarrotes Básicos|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
35
- company_name: "Financiado Bodega",
36
- id_company: 912,
37
- country: "México",
38
- id_category: "4004",
39
- id_article: 39372,
40
- name: "PRUEBA04BA",
41
- upc: "001213",
42
- },
43
- retailers: [
24
+ id_article: 43,
25
+ id_category: 2126,
26
+ name: "LIMA CERRAJERO 6 PULGADAS ACERO BELLOTA",
27
+ upc: "137915",
28
+ timestamp: "2022-11-14T16:03:56.000Z",
29
+ categoryName:
30
+ "Herramientas|Herramientas Manuales|Herramientas de Corte y Desbaste",
31
+ version: 1,
32
+ retailersAvailable: [
44
33
  {
45
- id: 70,
46
- name: "Bodega Aurrera",
34
+ name: "The Home Depot Golden",
35
+ id: 58,
47
36
  },
48
37
  ],
49
- services: {
50
- datasheets: 1,
51
- descriptions: 1,
52
- images: 1,
53
- },
54
38
  statusByRetailer: {
55
- 70: {
56
- datasheet: "AP",
57
- description: "AP",
58
- images: "AP",
39
+ 12: {
40
+ datasheet: "AA",
41
+ description: "AA",
42
+ images: "AA",
43
+ },
44
+ 29: {
45
+ datasheet: "AA",
46
+ description: "AA",
47
+ images: "AA",
48
+ },
49
+ 63: {
50
+ datasheet: "AA",
51
+ description: "AA",
52
+ images: "AA",
59
53
  },
60
54
  },
61
- retailersWithService: ["70"],
62
- id_article: 39372,
55
+ checked: false,
63
56
  retailersAvailable: [
64
57
  {
65
- id: 70,
66
- name: "Bodega Aurrera",
58
+ id: 12,
59
+ name: "La Comer",
60
+ },
61
+ {
62
+ id: 29,
63
+ name: "Farmacias del Ahorro",
64
+ },
65
+ {
66
+ id: 63,
67
+ name: "DAX",
67
68
  },
68
69
  ],
70
+ categoryName:
71
+ "Salud y Belleza|Cuidado del Cabello|Shampoos y Acondicionadores",
72
+ upc: "750955287656712",
73
+ id_article: 39270,
74
+ id_order: 15142,
69
75
  },
70
76
  productToEdit: {
71
- ArticleId: 39372,
72
- idCategory: "4004",
73
- product: {
74
- orderId: 15195,
75
- article_status: "AP",
76
- datasheet_status: "AP",
77
- description_status: "AP",
78
- images_status: "AP",
79
- prio: "none",
80
- version: 3,
81
- brand: null,
82
- article: {
83
- category:
84
- "Abarrotes Básicos|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
85
- company_name: "Financiado Bodega",
86
- id_company: 912,
87
- country: "México",
88
- id_category: "4004",
89
- id_article: 39372,
90
- name: "PRUEBA04BA",
91
- upc: "001213",
92
- },
93
- retailers: [
94
- {
95
- id: 70,
96
- name: "Bodega Aurrera",
97
- },
98
- ],
99
- services: {
100
- datasheets: 1,
101
- descriptions: 1,
102
- images: 1,
103
- },
104
- statusByRetailer: {
105
- 70: {
106
- datasheet: "AP",
107
- description: "AP",
108
- images: "AP",
109
- },
77
+ idCategory: 2126,
78
+ ArticleId: 43,
79
+ product: [
80
+ {
81
+ id_article: 43,
82
+ id_category: 2126,
83
+ name: "LIMA CERRAJERO 6 PULGADAS ACERO BELLOTA",
84
+ upc: "137915",
85
+ timestamp: "2022-11-14T16:03:56.000Z",
86
+ categoryName:
87
+ "Herramientas|Herramientas Manuales|Herramientas de Corte y Desbaste",
88
+ version: 1,
89
+ retailersAvailable: [
90
+ {
91
+ name: "The Home Depot Golden",
92
+ id: 58,
93
+ percentage: 2,
94
+ },
95
+ ],
110
96
  },
111
- retailersWithService: ["70"],
112
- id_article: 39372,
113
- retailersAvailable: [
114
- {
115
- id: 70,
116
- name: "Bodega Aurrera",
117
- },
118
- ],
119
- },
97
+ ],
120
98
  },
121
99
  location: {
122
100
  pathname: "/EditProducts",
123
101
  search: "",
124
102
  hash: "",
125
103
  state: {
104
+ withChat: true,
105
+ chatType: "product_status",
126
106
  origin: "RequestWithContentoh",
127
107
  },
128
108
  key: "24vwut",
129
109
  },
130
110
  user: {
131
- id_user: 132,
132
- name: "Bodega",
133
- last_name: "Aurrera",
134
- email: "cadenabodega@allfreemail.net",
135
- position: "TI",
136
- telephone: "+529999999999",
111
+ id_user: 28,
112
+ name: "Ismael",
113
+ last_name: "López",
114
+ email: "ilopez@contentoh.com",
115
+ position: "Test States",
116
+ telephone: "+523111366336",
137
117
  country: "México",
138
- id_company: 912,
139
- id_cognito: "fb2304ef-e1a2-4c2b-8874-eb754e4f6332",
118
+ id_company: 1,
119
+ id_cognito: "f5927f8e-cbf7-4922-9e09-e69ec0b2731a",
140
120
  birth_Date: null,
141
- about_me: null,
142
- zip_code: null,
143
- address: null,
144
- job: null,
145
- id_stripe: null,
121
+ about_me: "",
122
+ zip_code: "",
123
+ address: "",
124
+ job: "",
125
+ id_stripe: "cus_KuEt6R6vwmN09f",
146
126
  id_role: 0,
147
127
  active: 1,
148
- is_retailer: 1,
128
+ is_retailer: 0,
149
129
  email_notify: 1,
150
- is_user_tech: null,
130
+ is_user_tech: "ADMIN-AS",
151
131
  membership: {
152
- id: 101,
153
- start_date: "2022-12-22T19:16:53.000Z",
154
- end_date: "2023-12-22T19:16:53.000Z",
132
+ id: 76,
133
+ start_date: "2022-01-18T17:25:35.000Z",
134
+ end_date: "2023-01-18T17:25:35.000Z",
155
135
  planID: 8,
156
136
  plan: "prod_KtlhECVSFG2iro",
157
137
  name: "Plan Pro",
@@ -159,35 +139,23 @@ ProviderProductEditionDefault.args = {
159
139
  products_limit: "5000",
160
140
  type: "Enterprise",
161
141
  },
162
- src: "https://content-management-profile.s3.amazonaws.com/id-132/132.png?1685370125086",
142
+ src: "https://content-management-profile.s3.amazonaws.com/id-28/28.png?1691179745418",
163
143
  },
164
144
  company: {
165
- id_company: 912,
166
- trade_name: "Financiado Bodega",
167
- company_name: "Bodega",
168
- rfc: "9395jwhs",
169
- adress: "Toluca",
170
- about_company: null,
171
- telephone: null,
172
- web_site: null,
173
- zip_code: null,
145
+ id_company: 1,
146
+ trade_name: "GRUPO BRAHMA",
147
+ company_name: "GRUPO BRAHMA",
148
+ rfc: "XAXX010101000",
149
+ adress: "AA",
150
+ about_company: "",
151
+ telephone: "",
152
+ web_site: "",
153
+ zip_code: "",
174
154
  email: null,
175
- social_link: null,
155
+ social_link: "",
176
156
  is_retailer: 0,
177
- financedRetailers: [
178
- {
179
- id: 70,
180
- name: "Bodega Aurrera",
181
- country: "México",
182
- },
183
- ],
184
- retailers: [
185
- {
186
- id: 70,
187
- name: "Bodega Aurrera",
188
- country: "México",
189
- },
190
- ],
157
+ financedRetailers: [],
158
+ retailers: [],
191
159
  },
192
160
  showSurvey: (v) => v && alert("se muestra"),
193
161
  };
@@ -39,6 +39,9 @@ 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";
42
45
 
43
46
  const reducerImages = (state, action) => {
44
47
  let { values, attrForImgs, inputsByRetailer } = state;
@@ -214,6 +217,7 @@ export const ProviderProductEdition = ({
214
217
  const isRetailer = user?.is_retailer;
215
218
  const [loading, setLoading] = useState(true);
216
219
  const [validatedAll, setValidatedAll] = useState(false);
220
+ const [showRejectModal, setShowRejectModal] = useState(false);
217
221
 
218
222
  const [origin, setOrigin] = useState({
219
223
  "Ficha técnica": null,
@@ -343,28 +347,6 @@ export const ProviderProductEdition = ({
343
347
  (type) => {
344
348
  const formatter = new Intl.ListFormat("es", { type: "conjunction" });
345
349
  switch (type) {
346
- case "error":
347
- setGlobalModal({
348
- message: `${activeTab} rechazada`,
349
- detail: "Agrega tu comentarios para enviar el rechazo",
350
- img: errorModal,
351
- textArea: true,
352
- button1: {
353
- name: "Enviar",
354
- action: (e) => {
355
- const textArea = document.querySelector("#area");
356
- if (textArea.value) {
357
- textArea.style.border = "none";
358
- createComment(e, textArea.value);
359
- showGlobalModal("commentsSent");
360
- validatedAll ? validateAll("R") : sendEvaluation("R");
361
- } else {
362
- textArea.style.border = "2px solid red";
363
- }
364
- },
365
- },
366
- });
367
- break;
368
350
  case "generic":
369
351
  setGlobalModal(dataGenericModal);
370
352
  break;
@@ -524,7 +506,9 @@ export const ProviderProductEdition = ({
524
506
  );
525
507
  setServicesData(parsedResponse);
526
508
  }
527
- !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
509
+ retailers &&
510
+ !activeRetailer.id &&
511
+ setActiveRetailer(active ? active : retailers[0]);
528
512
  };
529
513
 
530
514
  const isRevision = () => {
@@ -600,7 +584,7 @@ export const ProviderProductEdition = ({
600
584
  });
601
585
  }
602
586
  setProduct(productTemp);
603
- setActivePercentage(retailers[0]?.percentage);
587
+ retailers && setActivePercentage(retailers[0]?.percentage);
604
588
  }, [percentages]);
605
589
 
606
590
  const loadInputs = () => {
@@ -684,6 +668,7 @@ export const ProviderProductEdition = ({
684
668
  }
685
669
  );
686
670
  if (res.data.statusCode === 200) {
671
+ setUpdatedDescriptions([]);
687
672
  setMessage("Descripciones guardadas con éxito");
688
673
  await loadData();
689
674
  }
@@ -710,6 +695,7 @@ export const ProviderProductEdition = ({
710
695
  }
711
696
  );
712
697
  if (res.data.statusCode === 200) {
698
+ setUpdatedDatasheets([]);
713
699
  setMessage("Fichas técnicas guardadas");
714
700
  await loadData();
715
701
  }
@@ -820,6 +806,7 @@ export const ProviderProductEdition = ({
820
806
  }
821
807
  );
822
808
  if (res.data.statusCode === 200) {
809
+ setImages({});
823
810
  setMessage("Imágenes guardadas con éxito");
824
811
  sessionStorage.removeItem("imagesList");
825
812
  await loadData();
@@ -841,32 +828,19 @@ export const ProviderProductEdition = ({
841
828
  }
842
829
  };
843
830
 
844
- const createComment = async (e, body, tab) => {
845
- let concept = "";
846
- switch (activeTab) {
847
- case "Ficha técnica":
848
- concept = "datasheet";
849
- break;
850
- case "Imágenes":
851
- concept = "images";
852
- break;
853
-
854
- default:
855
- concept = "description";
856
- break;
857
- }
831
+ const createComment = async (messages = [], retailerId) => {
858
832
  const data = {
859
- articleId: product?.id_article,
860
- orderId: product?.orderId,
861
- message: body,
862
- concept: concept,
863
- version: version,
864
- };
865
- await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
866
- headers: {
867
- Authorization: token,
833
+ paramsBody: {
834
+ id: product.article.id_article || productEdit.ArticleId,
835
+ version: version,
836
+ items: messages,
837
+ retailerId: retailerId,
838
+ status: product.status || productEdit.product.status,
868
839
  },
869
- });
840
+ paramsHeader: { Authorization: token },
841
+ };
842
+ setMessage("");
843
+ return sendMessage(data);
870
844
  };
871
845
 
872
846
  useEffect(() => {
@@ -1066,6 +1040,27 @@ export const ProviderProductEdition = ({
1066
1040
  const { newArticleStatus, newServiceStatus, newStatus } = JSON.parse(
1067
1041
  res.data.body
1068
1042
  );
1043
+
1044
+ const message = createMessage(
1045
+ product.retailers || product.retailersAvailable,
1046
+ activeRetailer.id,
1047
+ product[sectionStatusKey],
1048
+ newStatus,
1049
+ activeTab
1050
+ );
1051
+
1052
+ const messageData = {
1053
+ paramsBody: {
1054
+ id: product.article.id_article || productEdit.ArticleId,
1055
+ version: version,
1056
+ items: [{ type: "status", value: message }],
1057
+ retailerId: activeRetailer.id,
1058
+ status: product.status || productEdit.product.status,
1059
+ },
1060
+ paramsHeader: { Authorization: token },
1061
+ };
1062
+ await sendMessage(messageData);
1063
+
1069
1064
  if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
1070
1065
  const retailerStatusCopy = { ...retailerStatus };
1071
1066
  retailerStatusCopy[activeRetailer.id][concept] = newStatus;
@@ -1097,6 +1092,7 @@ export const ProviderProductEdition = ({
1097
1092
  result,
1098
1093
  isAproved: result === "A",
1099
1094
  };
1095
+ const messages = [];
1100
1096
  servicesData?.forEach((ret) => {
1101
1097
  const { service, id_retailer } = ret;
1102
1098
  let data = {};
@@ -1113,6 +1109,18 @@ export const ProviderProductEdition = ({
1113
1109
  },
1114
1110
  })
1115
1111
  );
1112
+ if (product[`${ret.service}_status`] !== "NS") {
1113
+ const message = createMessage(
1114
+ product.retailers,
1115
+ ret.id_retailer,
1116
+ product[`${ret.service}_status`],
1117
+ `${result}A`,
1118
+ ret.service
1119
+ );
1120
+ messages.push(
1121
+ createComment([{ type: "status", value: message }], ret.id_retailer)
1122
+ );
1123
+ }
1116
1124
  });
1117
1125
  await Promise.all(evaluationArray);
1118
1126
  const userType = user.is_retailer === 1 ? "CA" : "P";
@@ -1152,6 +1160,7 @@ export const ProviderProductEdition = ({
1152
1160
  product: productTemp,
1153
1161
  })
1154
1162
  );
1163
+ await Promise.all(messages);
1155
1164
 
1156
1165
  await loadData();
1157
1166
  } catch (error) {
@@ -1280,8 +1289,7 @@ export const ProviderProductEdition = ({
1280
1289
  return;
1281
1290
  } else if (user.is_retailer) {
1282
1291
  if (product.id_order || product.orderId) {
1283
- setValidatedAll(true);
1284
- showGlobalModal("error");
1292
+ sendEvaluation("R");
1285
1293
  } else {
1286
1294
  setDataGenericModal((prev) => ({
1287
1295
  ...prev,
@@ -1293,8 +1301,7 @@ export const ProviderProductEdition = ({
1293
1301
  showGlobalModal("generic");
1294
1302
  }
1295
1303
  } else {
1296
- setValidatedAll(true);
1297
- showGlobalModal("error");
1304
+ sendEvaluation("R");
1298
1305
  }
1299
1306
  }
1300
1307
  };
@@ -1304,6 +1311,7 @@ export const ProviderProductEdition = ({
1304
1311
  <HeaderTop
1305
1312
  setHeaderTop={setHeaderTop}
1306
1313
  withChat={location?.state?.withChat}
1314
+ chatType={location?.state?.chatType}
1307
1315
  productSelected={productSelected}
1308
1316
  token={token}
1309
1317
  activeRetailer={activeRetailer}
@@ -1382,7 +1390,7 @@ export const ProviderProductEdition = ({
1382
1390
  } else if (user.is_retailer) {
1383
1391
  if (product.id_order || product.orderId) {
1384
1392
  setValidatedAll(true);
1385
- showGlobalModal("error");
1393
+ setShowRejectModal(true);
1386
1394
  } else {
1387
1395
  setDataGenericModal((prev) => ({
1388
1396
  ...prev,
@@ -1394,12 +1402,14 @@ export const ProviderProductEdition = ({
1394
1402
  showGlobalModal("generic");
1395
1403
  }
1396
1404
  } else {
1405
+ setShowRejectModal(true);
1397
1406
  setValidatedAll(true);
1398
- showGlobalModal("error");
1399
1407
  }
1400
1408
  }}
1401
1409
  approve={() => sendToEvaluation("A")}
1402
- reject={() => sendToEvaluation("R")}
1410
+ reject={() => {
1411
+ setShowRejectModal(true);
1412
+ }}
1403
1413
  />
1404
1414
  <FullTabsMenu
1405
1415
  tabsSections={tabsSections}
@@ -1519,87 +1529,41 @@ export const ProviderProductEdition = ({
1519
1529
  </>
1520
1530
  )}
1521
1531
  </div>
1522
- {isRevision() && getSectionStatus() ? (
1523
- <div className="commentary-box">
1524
- {!comment ? (
1525
- <div className="commentary">
1526
- <TagAndInput
1527
- label={"Caja de Comentario"}
1528
- inputType={"textarea"}
1529
- inputCols={80}
1530
- inputRows={4}
1531
- inputId={"commentary-box"}
1532
- index={0}
1533
- />
1534
- <div className="buttons-box">
1535
- <Button
1536
- buttonType={"general-transparent-button"}
1537
- label={"Enviar comentario"}
1538
- onClick={(e) =>
1539
- createComment(
1540
- e,
1541
- document.querySelector(
1542
- "#description-commentary-box-0 .ql-container .ql-editor > p"
1543
- ).innerHTML,
1544
- activeTab
1545
- )
1546
- }
1547
- />
1548
- </div>
1549
- </div>
1532
+ {!(isRevision() && getSectionStatus()) && !revision && (
1533
+ <div className="required-inputs-message">
1534
+ <div>
1535
+ <p>
1536
+ Los atributos son requeridos por las plataformas de las
1537
+ cadenas, es muy importante completar los campos requeridos ya
1538
+ que pueden rechazar el producto por falta de información.
1539
+ </p>
1540
+ </div>
1541
+ {inCart ? (
1542
+ <button type="button">
1543
+ <Link to="/checkout">
1544
+ <p>Articulo en carrito</p>
1545
+ <p>Ir a checkout</p>
1546
+ </Link>
1547
+ </button>
1550
1548
  ) : (
1551
- <div className="feedback-box">
1552
- <Commentary
1553
- comment={comment.message}
1554
- reviewed={crossComment}
1549
+ <>
1550
+ <SliderToolTip
1551
+ infoIcon={InfoIcon}
1552
+ slidefront={slidefront}
1553
+ iconSize={"big-image"}
1554
+ slidePosition={"top-slide"}
1555
1555
  />
1556
1556
  <Button
1557
- buttonType={"circular-button accept-button"}
1558
- onClick={async () => {
1559
- setCrossComment(true);
1560
- commentRevised();
1557
+ onClick={() => {
1558
+ setShowContentohRequestModal &&
1559
+ setShowContentohRequestModal(true);
1561
1560
  }}
1561
+ buttonType="general-default-button"
1562
+ label="Enviar a Content-oh!"
1562
1563
  />
1563
- </div>
1564
+ </>
1564
1565
  )}
1565
1566
  </div>
1566
- ) : (
1567
- !revision && (
1568
- <div className="required-inputs-message">
1569
- <div>
1570
- <p>
1571
- Los atributos son requeridos por las plataformas de las
1572
- cadenas, es muy importante completar los campos requeridos
1573
- ya que pueden rechazar el producto por falta de información.
1574
- </p>
1575
- </div>
1576
- {inCart ? (
1577
- <button type="button">
1578
- <Link to="/checkout">
1579
- <p>Articulo en carrito</p>
1580
- <p>Ir a checkout</p>
1581
- </Link>
1582
- </button>
1583
- ) : (
1584
- <>
1585
- <SliderToolTip
1586
- infoIcon={InfoIcon}
1587
- slidefront={slidefront}
1588
- iconSize={"big-image"}
1589
- slidePosition={"top-slide"}
1590
- />
1591
- <Button
1592
- onClick={() => {
1593
- setShowContentohRequestModal &&
1594
- setShowContentohRequestModal(true);
1595
- }}
1596
- buttonType="general-default-button"
1597
- label="Enviar a Content-oh!"
1598
- />
1599
- </>
1600
- )}
1601
- </div>
1602
- )
1603
1567
  )}
1604
1568
  </div>
1605
1569
  </div>
@@ -1642,6 +1606,48 @@ export const ProviderProductEdition = ({
1642
1606
  jwt={token}
1643
1607
  />
1644
1608
  )}
1609
+ {showRejectModal && (
1610
+ <Modal
1611
+ title={"Agregar mensaje de rechazo"}
1612
+ show={showRejectModal}
1613
+ customComponent={
1614
+ <TagAndInput
1615
+ inputType={"textarea"}
1616
+ inputId={"modal-message-box"}
1617
+ index={0}
1618
+ color={"white"}
1619
+ />
1620
+ }
1621
+ buttons={[
1622
+ <ButtonV2
1623
+ key={"btn-Cancelar"}
1624
+ type={"white"}
1625
+ label={"Cancelar"}
1626
+ size={12}
1627
+ onClick={() => {
1628
+ setShowRejectModal(false);
1629
+ }}
1630
+ />,
1631
+ <ButtonV2
1632
+ key={"btn-Aceptar"}
1633
+ type={"pink"}
1634
+ label={"Aceptar"}
1635
+ size={12}
1636
+ onClick={async () => {
1637
+ const body = document.querySelector(
1638
+ "#modal-message-box .ql-container .ql-editor > p"
1639
+ ).innerHTML;
1640
+ const messages = [
1641
+ { type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
1642
+ ];
1643
+ await createComment(messages, activeRetailer.id);
1644
+ validatedAll ? validateAll("R") : sendToEvaluation("R");
1645
+ setShowRejectModal(false);
1646
+ }}
1647
+ />,
1648
+ ]}
1649
+ />
1650
+ )}
1645
1651
  </Container>
1646
1652
  );
1647
1653
  };