contentoh-components-library 21.5.2 → 21.5.3

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 (293) hide show
  1. package/dist/components/organisms/Table/styles.js +1 -1
  2. package/dist/components/pages/MultipleEdition/saveData.js +19 -9
  3. package/dist/components/pages/MultipleEdition/styles.js +1 -1
  4. package/dist/components/pages/MultipleEdition/utils.js +153 -86
  5. package/package.json +1 -4
  6. package/src/components/atoms/Avatar/index.js +2 -8
  7. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +0 -1
  8. package/src/components/atoms/ButtonV2/index.js +0 -1
  9. package/src/components/atoms/ButtonV2/styles.js +0 -16
  10. package/src/components/atoms/CheckBox/CheckBox.stories.js +0 -5
  11. package/src/components/atoms/CheckBox/index.js +1 -5
  12. package/src/components/atoms/CheckBox/styles.js +3 -9
  13. package/src/components/atoms/GeneralButton/styles.js +0 -46
  14. package/src/components/atoms/GeneralInput/index.js +0 -3
  15. package/src/components/atoms/GeneralInput/styles.js +1 -19
  16. package/src/components/atoms/InputFormatter/index.js +1 -2
  17. package/src/components/atoms/InputFormatter/styles.js +4 -9
  18. package/src/components/atoms/ProductImage/index.js +11 -24
  19. package/src/components/atoms/ProductImage/styles.js +0 -7
  20. package/src/components/atoms/SliderToolTip/styles.js +1 -1
  21. package/src/components/atoms/TabSection/index.js +1 -1
  22. package/src/components/atoms/TabSection/styles.js +3 -0
  23. package/src/components/molecules/BoxAttribute/index.js +25 -32
  24. package/src/components/molecules/BoxAttribute/styles.js +1 -1
  25. package/src/components/molecules/BoxButtons/index.js +22 -23
  26. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  27. package/src/components/molecules/GalleryElement/index.js +1 -76
  28. package/src/components/molecules/GalleryHeader/index.js +0 -1
  29. package/src/components/molecules/HeaderTop/index.js +6 -52
  30. package/src/components/molecules/ProductNameHeader/index.js +1 -19
  31. package/src/components/molecules/SignInLogin/index.js +11 -11
  32. package/src/components/molecules/StatusAsignationInfo/FinancedCompanies.js +63 -501
  33. package/src/components/molecules/StatusAsignationInfo/index.js +1 -1
  34. package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +2 -1
  35. package/src/components/molecules/TagAndInput/index.js +6 -8
  36. package/src/components/organisms/Chat/Chat.stories.js +7 -27
  37. package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
  38. package/src/components/organisms/Chat/ContainerItems/styles.js +2 -14
  39. package/src/components/organisms/Chat/ContentChat/index.js +12 -88
  40. package/src/components/organisms/Chat/Footer/index.js +0 -11
  41. package/src/components/organisms/Chat/index.js +4 -46
  42. package/src/components/organisms/Chat/styles.js +0 -4
  43. package/src/components/organisms/DashboardMetric/index.js +3 -6
  44. package/src/components/organisms/FullProductNameHeader/index.js +1 -13
  45. package/src/components/organisms/GridProducts/GridProducts.stories.js +107 -682
  46. package/src/components/organisms/InputGroup/index.js +144 -292
  47. package/src/components/organisms/InputGroup/styles.js +0 -31
  48. package/src/components/organisms/Modal/Modal.stories.js +1 -2
  49. package/src/components/organisms/Modal/index.js +2 -9
  50. package/src/components/organisms/Modal/styles.js +1 -8
  51. package/src/components/organisms/OrderDetail/utils/Table/utils.js +16 -6
  52. package/src/components/pages/Dashboard/Dashboard.stories.js +38 -33
  53. package/src/components/pages/Dashboard/index.js +7 -36
  54. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +60 -56
  55. package/src/components/pages/ProviderProductEdition/index.js +133 -148
  56. package/src/components/pages/ProviderProductEdition/styles.js +1 -5
  57. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +0 -4
  58. package/src/components/pages/RetailerProductEdition/index.js +300 -293
  59. package/src/components/pages/RetailerProductEdition/styles.js +0 -4
  60. package/src/components/pages/RetailerProductEdition/utils.js +0 -37
  61. package/src/global-files/data.js +10 -6
  62. package/src/global-files/variables.js +0 -6
  63. package/src/index.js +0 -12
  64. package/src/assets/images/Icons/addv2.svg +0 -8
  65. package/src/assets/images/Icons/beenhere.svg +0 -9
  66. package/src/assets/images/Icons/checkv2.svg +0 -8
  67. package/src/assets/images/Icons/close-magenta.svg +0 -9
  68. package/src/assets/images/Icons/close.svg +0 -8
  69. package/src/assets/images/Icons/closeCircle.svg +0 -8
  70. package/src/assets/images/Icons/delete-forever-red.svg +0 -9
  71. package/src/assets/images/Icons/delete-forever-white.svg +0 -10
  72. package/src/assets/images/Icons/edit.svg +0 -8
  73. package/src/assets/images/Icons/fullscreen.svg +0 -3
  74. package/src/assets/images/Icons/infoNR.svg +0 -8
  75. package/src/assets/images/Icons/options.svg +0 -3
  76. package/src/assets/images/Icons/save-white-gray.svg +0 -9
  77. package/src/assets/images/Icons/save-white.svg +0 -9
  78. package/src/assets/images/Icons/save.svg +0 -8
  79. package/src/assets/images/Icons/search.svg +0 -3
  80. package/src/assets/images/Icons/settings.svg +0 -8
  81. package/src/assets/images/Icons/trash.svg +0 -8
  82. package/src/assets/images/Icons/undo.svg +0 -8
  83. package/src/assets/images/Icons/upload-file-white.svg +0 -4
  84. package/src/assets/images/Icons/upload-file.svg +0 -10
  85. package/src/assets/images/Icons/upload_file.svg +0 -10
  86. package/src/assets/images/Icons/warningv2.svg +0 -3
  87. package/src/assets/images/checkBox/checkrosa.svg +0 -3
  88. package/src/assets/images/checkBox/checkverde.svg +0 -3
  89. package/src/assets/images/flagsv2/highPriority.svg +0 -3
  90. package/src/assets/images/flagsv2/lowPriority.svg +0 -3
  91. package/src/assets/images/flagsv2/mediumPriority.svg +0 -3
  92. package/src/assets/images/flagsv2/noPriority.svg +0 -3
  93. package/src/assets/images/generalButton/closeIconWhite.svg +0 -4
  94. package/src/assets/images/generalButton/closeIconv2.svg +0 -4
  95. package/src/assets/images/generalButton/saveIconpink.svg +0 -3
  96. package/src/components/atoms/CharsMissing/Wysiwyg.stories.js +0 -12
  97. package/src/components/atoms/CharsMissing/index.js +0 -60
  98. package/src/components/atoms/CharsMissing/styles.js +0 -44
  99. package/src/components/atoms/CustomChip/CustomChip.stories.js +0 -16
  100. package/src/components/atoms/CustomChip/index.js +0 -34
  101. package/src/components/atoms/CustomChip/styles.js +0 -6
  102. package/src/components/atoms/FeatureTagv2/FeatureTagv2.stories.js +0 -16
  103. package/src/components/atoms/FeatureTagv2/index.js +0 -10
  104. package/src/components/atoms/FeatureTagv2/styles.js +0 -56
  105. package/src/components/atoms/GeneralInputv2/GeneralInputv2.stories.js +0 -33
  106. package/src/components/atoms/GeneralInputv2/index.js +0 -155
  107. package/src/components/atoms/GeneralInputv2/styles.js +0 -67
  108. package/src/components/atoms/InputFormatterv2/Wysiwyg.stories.js +0 -12
  109. package/src/components/atoms/InputFormatterv2/index.js +0 -148
  110. package/src/components/atoms/InputFormatterv2/styles.js +0 -39
  111. package/src/components/atoms/InputImages/InputImages.stories.js +0 -19
  112. package/src/components/atoms/InputImages/index.js +0 -25
  113. package/src/components/atoms/InputImages/styles.js +0 -17
  114. package/src/components/atoms/Multiselect/Multiselect.stories.js +0 -364
  115. package/src/components/atoms/Multiselect/index.js +0 -351
  116. package/src/components/atoms/Multiselect/styles.js +0 -33
  117. package/src/components/atoms/NumberMandatory/NumberMandatory.stories.js +0 -19
  118. package/src/components/atoms/NumberMandatory/index.js +0 -16
  119. package/src/components/atoms/NumberMandatory/styles.js +0 -11
  120. package/src/components/atoms/ObservationFlag/ObservationFlag.stories.js +0 -20
  121. package/src/components/atoms/ObservationFlag/index.js +0 -167
  122. package/src/components/atoms/ObservationFlag/styles.js +0 -104
  123. package/src/components/atoms/PriorityFlagv2/PriorityFlagv2.stories.js +0 -20
  124. package/src/components/atoms/PriorityFlagv2/index.js +0 -20
  125. package/src/components/atoms/PriorityFlagv2/styles.js +0 -6
  126. package/src/components/atoms/ProductImagev2/ProductImagev2.stories.js +0 -28
  127. package/src/components/atoms/ProductImagev2/index.js +0 -16
  128. package/src/components/atoms/ProductImagev2/styles.js +0 -62
  129. package/src/components/atoms/Progress/Progress.stories.js +0 -25
  130. package/src/components/atoms/Progress/index.js +0 -74
  131. package/src/components/atoms/Progress/styles.js +0 -98
  132. package/src/components/atoms/ScreenHeaderv2/ScreenHeaderv2.stories.js +0 -53
  133. package/src/components/atoms/ScreenHeaderv2/index.js +0 -134
  134. package/src/components/atoms/ScreenHeaderv2/styles.js +0 -103
  135. package/src/components/atoms/Selectv2/VersionSelect.js +0 -27
  136. package/src/components/atoms/Selectv2/index.js +0 -35
  137. package/src/components/atoms/Selectv2/style.js +0 -93
  138. package/src/components/atoms/TabSectionv2/TabSection.stories.js +0 -25
  139. package/src/components/atoms/TabSectionv2/index.js +0 -9
  140. package/src/components/atoms/TabSectionv2/styles.js +0 -20
  141. package/src/components/atoms/TooltipLight/Tooltip.stories.js +0 -20
  142. package/src/components/atoms/TooltipLight/index.js +0 -46
  143. package/src/components/atoms/TooltipLight/styles.js +0 -65
  144. package/src/components/atoms/WordsMissing/Wysiwyg.stories.js +0 -12
  145. package/src/components/atoms/WordsMissing/index.js +0 -60
  146. package/src/components/atoms/WordsMissing/styles.js +0 -10
  147. package/src/components/molecules/AddGroup/AddGroup.stories.js +0 -15
  148. package/src/components/molecules/AddGroup/index.js +0 -84
  149. package/src/components/molecules/AddGroup/styles.js +0 -141
  150. package/src/components/molecules/AsignationInfo/AsignationInfo.stories.js +0 -17
  151. package/src/components/molecules/AsignationInfo/index.js +0 -108
  152. package/src/components/molecules/AsignationInfo/styles.js +0 -86
  153. package/src/components/molecules/EditionActiveImagev2/EditionActiveImagev2.stories.js +0 -12
  154. package/src/components/molecules/EditionActiveImagev2/index.js +0 -15
  155. package/src/components/molecules/EditionActiveImagev2/styles.js +0 -7
  156. package/src/components/molecules/EditionTabs/EditionTabs.stories.js +0 -12
  157. package/src/components/molecules/EditionTabs/index.js +0 -33
  158. package/src/components/molecules/EditionTabs/styles.js +0 -24
  159. package/src/components/molecules/FeaturesBarv2/FeaturesBarv2.stories.js +0 -20
  160. package/src/components/molecules/FeaturesBarv2/index.js +0 -32
  161. package/src/components/molecules/FeaturesBarv2/styles.js +0 -17
  162. package/src/components/molecules/GalleryElementv2/GalleryElementv2.stories.js +0 -30
  163. package/src/components/molecules/GalleryElementv2/index.js +0 -142
  164. package/src/components/molecules/GalleryElementv2/styles.js +0 -119
  165. package/src/components/molecules/GalleryHeaderv2/GalleryHeaderv2.stories.js +0 -10
  166. package/src/components/molecules/GalleryHeaderv2/index.js +0 -25
  167. package/src/components/molecules/GalleryHeaderv2/styles.js +0 -47
  168. package/src/components/molecules/GroupSelect/GroupSelect.stories.js +0 -35
  169. package/src/components/molecules/GroupSelect/SelectItem.js +0 -105
  170. package/src/components/molecules/GroupSelect/index.js +0 -190
  171. package/src/components/molecules/GroupSelect/styles.js +0 -124
  172. package/src/components/molecules/HeaderTopv2/HeaderTopv2.stories.js +0 -10
  173. package/src/components/molecules/HeaderTopv2/index.js +0 -100
  174. package/src/components/molecules/HeaderTopv2/styles.js +0 -33
  175. package/src/components/molecules/ImageSelectorv2/ImageSelectorv2.stories.js +0 -46
  176. package/src/components/molecules/ImageSelectorv2/index.js +0 -22
  177. package/src/components/molecules/ImageSelectorv2/styles.js +0 -15
  178. package/src/components/molecules/Phase/Phase.stories.js +0 -107
  179. package/src/components/molecules/Phase/index.js +0 -391
  180. package/src/components/molecules/Phase/styles.js +0 -97
  181. package/src/components/molecules/ProductNameHeaderv2/ProductNameHeaderv2.stories.js +0 -37
  182. package/src/components/molecules/ProductNameHeaderv2/index.js +0 -12
  183. package/src/components/molecules/ProductNameHeaderv2/styles.js +0 -10
  184. package/src/components/molecules/ProductSkuStatus/ProductSkuStatus.stories.js +0 -37
  185. package/src/components/molecules/ProductSkuStatus/index.js +0 -26
  186. package/src/components/molecules/ProductSkuStatus/styles.js +0 -7
  187. package/src/components/molecules/RetailerSelectorv2/RetailerSelectorv2.stories.js +0 -35
  188. package/src/components/molecules/RetailerSelectorv2/index.js +0 -80
  189. package/src/components/molecules/RetailerSelectorv2/styles.js +0 -21
  190. package/src/components/molecules/ServiceDataValidator/ServiceDataValidator.stories.js +0 -90
  191. package/src/components/molecules/ServiceDataValidator/index.js +0 -49
  192. package/src/components/molecules/ServiceDataValidator/styles.js +0 -36
  193. package/src/components/molecules/StatusRetailer/StatusAsignationInfo.stories.js +0 -17
  194. package/src/components/molecules/StatusRetailer/index.js +0 -55
  195. package/src/components/molecules/StatusRetailer/styles.js +0 -85
  196. package/src/components/molecules/TabsMenuv2/TabsMenuv2.stories.js +0 -19
  197. package/src/components/molecules/TabsMenuv2/index.js +0 -112
  198. package/src/components/molecules/TabsMenuv2/styles.js +0 -19
  199. package/src/components/molecules/TagAndInputv2/TagAndInputv2.stories.js +0 -24
  200. package/src/components/molecules/TagAndInputv2/index.js +0 -86
  201. package/src/components/molecules/TagAndInputv2/styles.js +0 -35
  202. package/src/components/molecules/Validation/Validation.stories.js +0 -12
  203. package/src/components/molecules/Validation/index.js +0 -77
  204. package/src/components/molecules/Validation/styles.js +0 -19
  205. package/src/components/molecules/VersionItemv2/VersionItemv2.stories.js +0 -14
  206. package/src/components/molecules/VersionItemv2/index.js +0 -59
  207. package/src/components/molecules/VersionItemv2/styles.js +0 -47
  208. package/src/components/organisms/BarButtons/BarButtons.stories.js +0 -13
  209. package/src/components/organisms/BarButtons/index.js +0 -150
  210. package/src/components/organisms/BarButtons/styles.js +0 -54
  211. package/src/components/organisms/Chatv2/ChatLists/ChatLists.stories.js +0 -65
  212. package/src/components/organisms/Chatv2/ChatLists/Rotoplas.jpeg +0 -0
  213. package/src/components/organisms/Chatv2/ChatLists/THD.png +0 -0
  214. package/src/components/organisms/Chatv2/ChatLists/index.js +0 -141
  215. package/src/components/organisms/Chatv2/ChatLists/styles.js +0 -162
  216. package/src/components/organisms/Chatv2/Chatv2.stories.js +0 -184
  217. package/src/components/organisms/Chatv2/ContainerItems/ContainerItems.stories.js +0 -142
  218. package/src/components/organisms/Chatv2/ContainerItems/index.js +0 -538
  219. package/src/components/organisms/Chatv2/ContainerItems/styles.js +0 -360
  220. package/src/components/organisms/Chatv2/ContentChat/ContentChat.stories.js +0 -102
  221. package/src/components/organisms/Chatv2/ContentChat/Rotoplas.jpeg +0 -0
  222. package/src/components/organisms/Chatv2/ContentChat/THD.png +0 -0
  223. package/src/components/organisms/Chatv2/ContentChat/index.js +0 -1016
  224. package/src/components/organisms/Chatv2/ContentChat/styles.js +0 -44
  225. package/src/components/organisms/Chatv2/Footer/Footer.stories.js +0 -22
  226. package/src/components/organisms/Chatv2/Footer/index.js +0 -668
  227. package/src/components/organisms/Chatv2/Footer/styles.js +0 -290
  228. package/src/components/organisms/Chatv2/Header/Header.stories.js +0 -66
  229. package/src/components/organisms/Chatv2/Header/index.js +0 -93
  230. package/src/components/organisms/Chatv2/Header/styles.js +0 -49
  231. package/src/components/organisms/Chatv2/index.js +0 -281
  232. package/src/components/organisms/Chatv2/styles.js +0 -85
  233. package/src/components/organisms/CompleteServices/CompleteServices.stories.js +0 -91
  234. package/src/components/organisms/CompleteServices/index.js +0 -82
  235. package/src/components/organisms/CompleteServices/styles.js +0 -35
  236. package/src/components/organisms/DragAndDropPhases/DragAndDropPhases.stories.js +0 -13
  237. package/src/components/organisms/DragAndDropPhases/index.js +0 -336
  238. package/src/components/organisms/DragAndDropPhases/styles.js +0 -107
  239. package/src/components/organisms/DragPrueba/DragPrueba.stories.js +0 -12
  240. package/src/components/organisms/DragPrueba/index.js +0 -57
  241. package/src/components/organisms/DragPrueba/styles.js +0 -8
  242. package/src/components/organisms/EditGroup/EditGroup.stories.js +0 -20
  243. package/src/components/organisms/EditGroup/index.js +0 -321
  244. package/src/components/organisms/EditGroup/styles.js +0 -207
  245. package/src/components/organisms/FullProductNamev2/FullProductNamev2.stories.js +0 -28
  246. package/src/components/organisms/FullProductNamev2/index.js +0 -101
  247. package/src/components/organisms/FullProductNamev2/styles.js +0 -49
  248. package/src/components/organisms/FullTabsMenuv2/FullTabsMenuv2.stories.js +0 -22
  249. package/src/components/organisms/FullTabsMenuv2/index.js +0 -142
  250. package/src/components/organisms/FullTabsMenuv2/styles.js +0 -47
  251. package/src/components/organisms/ImageDataTablev2/ImageDataTablev2.stories.js +0 -24
  252. package/src/components/organisms/ImageDataTablev2/index.js +0 -124
  253. package/src/components/organisms/ImageDataTablev2/styles.js +0 -18
  254. package/src/components/organisms/ImagePreviewerv2/ImagePreviewerv2.stories.js +0 -38
  255. package/src/components/organisms/ImagePreviewerv2/index.js +0 -22
  256. package/src/components/organisms/ImagePreviewerv2/styles.js +0 -7
  257. package/src/components/organisms/ImageUploader/ImageUploader.stories.js +0 -15
  258. package/src/components/organisms/ImageUploader/index.js +0 -62
  259. package/src/components/organisms/ImageUploader/styles.js +0 -29
  260. package/src/components/organisms/ImageVisor/ImageVisor.stories.js +0 -15
  261. package/src/components/organisms/ImageVisor/index.js +0 -143
  262. package/src/components/organisms/ImageVisor/styles.js +0 -106
  263. package/src/components/organisms/InputGroupv2/InputGroupv2.stories.js +0 -31
  264. package/src/components/organisms/InputGroupv2/index.js +0 -296
  265. package/src/components/organisms/InputGroupv2/styles.js +0 -90
  266. package/src/components/organisms/MandatoryBar/MandatoryBar.stories.js +0 -18
  267. package/src/components/organisms/MandatoryBar/index.js +0 -31
  268. package/src/components/organisms/MandatoryBar/styles.js +0 -12
  269. package/src/components/organisms/ProductImageModalv2/ProductImageModalv2.stories.js +0 -90
  270. package/src/components/organisms/ProductImageModalv2/index.js +0 -105
  271. package/src/components/organisms/ProductImageModalv2/styles.js +0 -71
  272. package/src/components/organisms/RenameImagesBar/RenameImagesBar.stories.js +0 -18
  273. package/src/components/organisms/RenameImagesBar/index.js +0 -30
  274. package/src/components/organisms/RenameImagesBar/styles.js +0 -12
  275. package/src/components/organisms/Table/Table.stories.js +0 -609
  276. package/src/components/organisms/Table/index.js +0 -84
  277. package/src/components/organisms/Table/styles.js +0 -114
  278. package/src/components/organisms/VersionSelectorv2/VersionSelectorv2.stories.js +0 -15
  279. package/src/components/organisms/VersionSelectorv2/index.js +0 -105
  280. package/src/components/organisms/VersionSelectorv2/styles.js +0 -45
  281. package/src/components/pages/MultipleEdition/MultipleEdition.stories.js +0 -17
  282. package/src/components/pages/MultipleEdition/components/ImageUploader.js +0 -62
  283. package/src/components/pages/MultipleEdition/components/ImageUploaderStyles.js +0 -29
  284. package/src/components/pages/MultipleEdition/components/ImageVisor.js +0 -143
  285. package/src/components/pages/MultipleEdition/components/styles.js +0 -106
  286. package/src/components/pages/MultipleEdition/index.js +0 -248
  287. package/src/components/pages/MultipleEdition/saveData.js +0 -92
  288. package/src/components/pages/MultipleEdition/styles.js +0 -201
  289. package/src/components/pages/MultipleEdition/utils.js +0 -1073
  290. package/src/components/pages/ProductEditionv2/ProductEditionv2.stories.js +0 -213
  291. package/src/components/pages/ProductEditionv2/index.js +0 -1758
  292. package/src/components/pages/ProductEditionv2/styles.js +0 -154
  293. package/src/components/pages/RetailerProductEdition/generateThumnail.js +0 -21
@@ -1,1073 +0,0 @@
1
- import axios from "axios";
2
- import { ImageVisor } from "../../organisms/ImageVisor";
3
- import { ButtonV2 } from "../../atoms/ButtonV2";
4
- import { deleteImage, saveData} from "./saveData";
5
- import { Container, Input, InputBase, TextField } from "@mui/material";
6
- import { ValidationPanel } from "../../atoms/ValidationPanel";
7
- import { TagAndInput } from "../../molecules/TagAndInput";
8
- import acceptIcon from "../../../assets/images/generalButton/acceptIcon.svg";
9
- import rejectIcon from "../../../assets/images/generalButton/rejectIcon.svg";
10
- import infoIcon from "../../../assets/images/Icons/info.svg";
11
- import saveWhite from "../../../assets/images/Icons/save-white.svg";
12
- import saveWhiteGray from "../../../assets/images/Icons/save-white-gray.svg";
13
- import { DockSharp } from "@mui/icons-material";
14
- import React, { useState } from 'react';
15
- import nullIcon from "../../../assets/images/generalButton/nullIcon.svg";
16
- import { Tooltip } from "../../atoms/Tooltip";
17
-
18
- // variables
19
- export const optionsSelect = [
20
- {
21
- label: "item 1",
22
- value: 1,
23
- },
24
- {
25
- label: "item 2",
26
- value: 2,
27
- },
28
- {
29
- label: "item 3",
30
- value: 3,
31
- },
32
- {
33
- label: "item 4",
34
- value: 4,
35
- },
36
- ];
37
-
38
- export const columnsBase = [
39
- {
40
- Header: "UPC",
41
- accessor: "upc",
42
- width: "100px",
43
- fixedToLeft: 0,
44
- style: {
45
- textAlign: "left",
46
- },
47
- },
48
- {
49
- Header: "Nombre",
50
- accessor: "name",
51
- width: "100px",
52
- fixedToLeft: 100,
53
- },
54
- {
55
- Header: "Categoría",
56
- accessor: "category",
57
- width: "100px",
58
- fixedToLeft: 200,
59
- },
60
- {
61
- Header: "Est.",
62
- accessor: "status",
63
- width: "30px",
64
- fixedToLeft: 300,
65
- },
66
- {
67
- Header: "Ver.",
68
- accessor: "version",
69
- width: "30px",
70
- fixedToLeft: 330,
71
- style: {
72
- borderRight: "1px solid #f0f0f0",
73
- },
74
- },
75
- ];
76
-
77
- // data
78
- async function getData(service, articles, versions, token) {
79
- const encodedArticles = encodeURIComponent(articles.join(","));
80
- const encodedVersion = encodeURIComponent(versions.join(","));
81
- const params = `?articles=${encodedArticles}&versions=${encodedVersion}`;
82
- const res = await axios.get(
83
- `${process.env.REACT_APP_BASE_MULTIPLE_EDITION_ENDPOINT}/${service}${params}`,
84
- {
85
- headers: {
86
- Authorization: token,
87
- },
88
- }
89
- );
90
- return JSON.parse(res.data.body);
91
- }
92
-
93
- // functions
94
- export function dataReducer(state, action) {
95
- if (action.type === "init") {
96
- return action.payload;
97
- }
98
- if (action.type === "updateImage") {
99
- const { articleId, imageId ,token } = action.payload;
100
- const newImageData = state.images.data.slice();
101
- const articleIndex = newImageData.findIndex((f) => f.id === articleId);
102
- const id = newImageData[articleIndex]?.images[imageId]?.value?.id;
103
- newImageData[articleIndex].images[imageId].value = {
104
- ...action.payload,
105
- id,
106
- };
107
- const data = newImageData;
108
- saveData({section:"images", data: {data}, token: token});
109
- return {
110
- ...state,
111
- images: {
112
- ...state.images,
113
- data: newImageData,
114
- },
115
- };
116
- }
117
- if (action.type === "deleteImage") {
118
- const { articleId, imageId, token } = action.payload;
119
- const newImageData = state.images.data.slice();
120
- const articleIndex = newImageData.findIndex((f) => f.id === articleId);
121
- const id = newImageData[articleIndex]?.images[imageId]?.value?.id;
122
- delete newImageData[articleIndex]?.images[imageId]?.value;
123
- const data = {
124
- articleId,
125
- deleteImages: [
126
- {
127
- id,
128
- },
129
- ],
130
- };
131
- deleteImage(data, newImageData[articleIndex].version, token);
132
- return {
133
- ...state,
134
- images: {
135
- ...state.images,
136
- data: newImageData,
137
- },
138
- };
139
- }
140
- return state;
141
- }
142
-
143
- export async function initData(setDataServices, articles, versions, token) {
144
- const [description, datasheet, images] = await Promise.all([
145
- getData("description", articles, versions, token),
146
- getData("datasheet", articles, versions, token),
147
- getData("images", articles, versions, token),
148
- ]);
149
- const { data: dataDescription, attributes: rulesDescription } = description;
150
- const { data: dataDatasheet, attributes: rulesDatasheet } = datasheet;
151
- const { data: dataImage, typesShot: rulesImage } = images;
152
- const payload = {
153
- description: {
154
- data: Object.values(dataDescription),
155
- rules: rulesDescription,
156
- },
157
- datasheet: {
158
- data: Object.values(dataDatasheet),
159
- rules: rulesDatasheet,
160
- },
161
- images: {
162
- data: Object.values(dataImage),
163
- rules: rulesImage.reduce(
164
- (prev, curr) =>
165
- (prev = {
166
- ...prev,
167
- [curr.id]: curr.name,
168
- }),
169
- {}
170
- ),
171
- },
172
- };
173
- setDataServices({
174
- type: "init",
175
- payload,
176
- });
177
- }
178
-
179
- export function setDataColumns(
180
- section,
181
- dataService,
182
- token,
183
- setModalFromTable,
184
- setDataServices,
185
- setModal,
186
- setShowValidationPanel,
187
- setAttributeSelected,
188
- setShowRejectModal,
189
- setAttributesReviewed,
190
- setMessage,
191
- showValidationPanel,
192
- attributeSelected,
193
- attributesReviewed,
194
- descriptionsReviewed,
195
- imagesReviewed
196
- ) {
197
- const { data, rules } = dataService;
198
- const columns = [...columnsBase];
199
- const values = [];
200
-
201
- const styleRetailer = {
202
- borderRight: "1px solid #f0f0f0",
203
- borderLeft: "1px solid #f0f0f0",
204
- };
205
- const styleSaveButtonCol = {
206
- borderRight: "1px solid #f0f0f0",
207
- //borderLeft: "1px solid #f0f0f0",
208
- };
209
- const styleData = {
210
- textAlign: "center",
211
- display: "flex",
212
- justifyContent: "center",
213
- };
214
-
215
- const styleApprovalAttributes = {
216
- textAlign: "center",
217
- display: "flex",
218
- justifyContent: "center",
219
- border: "1px solid #ECDD1D",
220
- background: "#ECDD1D"
221
- };
222
-
223
- const retailersAdded = {
224
- id: [],
225
- attr: [],
226
- };
227
- data.forEach((item) => {
228
- const currentData = {};
229
- ["upc", "name", "accessor", "category", "status", "version"].forEach(
230
- (key) => {
231
- currentData[key] = <p className="content"> {item[key]} </p>;
232
- }
233
- );
234
- if (item.status)
235
- currentData["status"] = (
236
- <StatusTag statusType={item.status} ovalForm={true} />
237
- );
238
- if (section === "images") {
239
- const { images } = item;
240
- item.retailer.forEach((ret) => {
241
- if (!retailersAdded.id.includes(ret.id)) {
242
- retailersAdded.id.push(ret.id);
243
- columns.push({
244
- Header: "Cadena",
245
- accessor: `retailer${ret.id}`,
246
- width: "100px"
247
- });
248
- columns.push({
249
- Header: "",
250
- accessor: `retailer${ret.id}-save`,
251
- width: "60px",
252
- style: styleSaveButtonCol,
253
- });
254
- }
255
- currentData[`retailer${ret.id}`] = <p> {ret.name} </p>;
256
- ret.images.forEach((imgId) => {
257
- if (!retailersAdded.attr.includes(`img${imgId}`)) {
258
- retailersAdded.attr.push(`img${imgId}`);
259
- columns.push({
260
- Header: rules[imgId],
261
- accessor: `img${imgId}`,
262
- width: "170px",
263
- style: styleData,
264
- });
265
- }
266
- });
267
- var saveAvailable=true;
268
- /**var saveAvailable = imagesReviewed
269
- .filter((e) => e.articleId === item.id)
270
- .every((e) => e.isReviewed === true);
271
- if (
272
- imagesReviewed.filter((e) => e.articleId === item.id).length == 0
273
- ) {
274
- saveAvailable = false;
275
- }**/
276
- currentData[`retailer${ret.id}-save`] = (
277
- <button
278
- onClick={() => {
279
- var articlesImagesUpdateBody = [];
280
- var articleImages = imagesReviewed.filter(
281
- (e) => e.articleId === item.id && e.versionId === item.version
282
- );
283
- articleImages.forEach((articleImage) => {
284
- articlesImagesUpdateBody.push({
285
- articleId: articleImage.articleId,
286
- versionId: articleImage.versionId,
287
- attributeId: articleImage.imageId,
288
- value: articleImage.srcdb,
289
- isApproved: articleImage.isApproved,
290
- comment: articleImage.comment,
291
- });
292
- });
293
- updateArticleData(
294
- item.version,
295
- item.id,
296
- articlesImagesUpdateBody,
297
- token,
298
- setMessage,
299
- section
300
- );
301
- }}
302
- className="validation-option"
303
- disabled={!saveAvailable}
304
- >
305
- {saveAvailable && <img src={saveWhite} alt="guardar" />}{" "}
306
- {!saveAvailable && <img src={saveWhiteGray} alt="guardar" />}{" "}
307
- </button>
308
- );
309
-
310
- Object.values(images).forEach(({ value, isApproved, imageId, comment}) => {
311
- const props = {
312
- name: rules[imageId],
313
- value: value,
314
- setModalFromTable,
315
- articleId: item.id,
316
- setDataServices,
317
- imageId,
318
- setModal,
319
- token,
320
- };
321
- if (
322
- !imagesReviewed.find(
323
- (e) =>
324
- e.articleId == item.id &&
325
- e.imageId == imageId &&
326
- e.versionId == item.version
327
- )
328
- )
329
- imagesReviewed.push({
330
- articleId: item.id,
331
- imageId: imageId,
332
- versionId: item.version,
333
- isApproved: isApproved? isApproved: false,
334
- isReviewed: isApproved!=null? true: false,
335
- comment: "",
336
- srcdb: value? value.src: ""
337
- });
338
- var index = imagesReviewed.findIndex(
339
- (e) =>
340
- e.articleId === item.id &&
341
- e.imageId=== imageId &&
342
- e.versionId === item.version
343
- );
344
- currentData[`img${imageId}`] =
345
- <>
346
- {/**<button
347
- onClick={() => {
348
- setShowValidationPanel(true);
349
- setAttributeSelected({
350
- articleId: item.id,
351
- attributeId: imageId,
352
- versionId: item.version,
353
- });
354
- }}
355
- className="validation-button"
356
- >
357
- {imagesReviewed[index].isReviewed &&
358
- imagesReviewed[index].isApproved && (
359
- <img
360
- id={
361
- "button_" +
362
- item.id +
363
- "_" +
364
- imageId +
365
- "_" +
366
- item.version
367
- }
368
- src={acceptIcon}
369
- alt="accept button"
370
- />
371
- )}{" "}
372
- {imagesReviewed[index].isReviewed &&
373
- !imagesReviewed[index].isApproved && (
374
- <img
375
- id={
376
- "button_" +
377
- item.id +
378
- "_" +
379
- imageId +
380
- "_" +
381
- item.version
382
- }
383
- src={rejectIcon}
384
- alt="reject button"
385
- />
386
- )}{" "}
387
- {
388
- !imagesReviewed[index].isReviewed && (
389
- <img
390
- id={
391
- "button_" +
392
- item.id +
393
- "_" +
394
- imageId +
395
- "_" +
396
- item.version
397
- }
398
- src={rejectIcon}
399
- alt="reject button"
400
- />
401
- )}
402
- </button>{" "}
403
- {showValidationPanel &&
404
- attributeSelected.articleId === item.id &&
405
- attributeSelected.attributeId === imageId &&
406
- attributeSelected.versionId === item.version && (
407
- <div className="buttons-container" style={{left: "70px"}}>
408
- <button
409
- onClick={() => {
410
- imagesReviewed[index].isApproved = true;
411
- imagesReviewed[index].isReviewed = true;
412
- //document.getElementById(item.id+'_'+des.attributeId+'_'+item.version).style.borderColor="#71DE56";
413
- setShowValidationPanel(false);
414
- }}
415
- className="validation-option"
416
- >
417
- <img src={acceptIcon} alt="accept button" />
418
- <p> Validar </p>{" "}
419
- </button>{" "}
420
- <button
421
- onClick={() => {
422
- setShowValidationPanel(false);
423
- setShowRejectModal(true);
424
- }}
425
- className="validation-option"
426
- >
427
- <img src={rejectIcon} alt="reject button" />
428
- <p> Rechazar </p>{" "}
429
- </button>{" "}
430
- </div>
431
- )}{" "**/}
432
- {comment && <div class="tooltip">
433
- <ImageVisor {...props}/>
434
- <span class="tooltiptext"><p><b>Comentarios del rechazo</b></p><p>{des.comment}</p></span>
435
- </div>}
436
- {!comment && <div>
437
- <ImageVisor {...props} />
438
- </div>}
439
- </>;
440
- });
441
- });
442
- }
443
- if (section === "datasheet") {
444
- item.retailer.forEach((ret) => {
445
- if (!retailersAdded.id.includes(ret.id)) {
446
- retailersAdded.id.push(ret.id);
447
- columns.push({
448
- Header: "Cadena",
449
- accessor: `retailer${ret.id}`,
450
- width: "100px",
451
- });
452
- columns.push({
453
- Header: "",
454
- accessor: `retailer${ret.id}-save`,
455
- width: "60px",
456
- style: styleSaveButtonCol,
457
- });
458
- }
459
- currentData[`retailer${ret.id}`] = <p> {ret.name} </p>;
460
- var saveAvailable = attributesReviewed
461
- .filter((e) => e.articleId === item.id)
462
- .every((e) => e.isReviewed === true);
463
- if (
464
- attributesReviewed.filter((e) => e.articleId === item.id).length == 0
465
- ) {
466
- saveAvailable = false;
467
- }
468
- currentData[`retailer${ret.id}-save`] = (
469
- <button
470
- onClick={() => {
471
- var articlesAtributesUpdateBody = [];
472
- var articleAttributes = attributesReviewed.filter(
473
- (e) => e.articleId === item.id && e.versionId === item.version
474
- );
475
- var value;
476
- articleAttributes.forEach((articleAttribute) => {
477
- if(articleAttribute.attributeId==6700 || articleAttribute.attributeId==6701){
478
- value= document.getElementById(
479
- articleAttribute.articleId +
480
- "_" +
481
- articleAttribute.attributeId +
482
- "_" +
483
- articleAttribute.versionId
484
- ).checked;
485
- }
486
- else{
487
- value = document.getElementById(
488
- articleAttribute.articleId +
489
- "_" +
490
- articleAttribute.attributeId +
491
- "_" +
492
- articleAttribute.versionId
493
- ).value;
494
- }
495
- articlesAtributesUpdateBody.push({
496
- articleId: articleAttribute.articleId,
497
- versionId: articleAttribute.versionId,
498
- attributeId: articleAttribute.attributeId,
499
- value: value!=undefined ? value : "",
500
- isApproved: articleAttribute.isApproved,
501
- comment: articleAttribute.comment,
502
- });
503
- });
504
- updateArticleData(
505
- item.version,
506
- item.id,
507
- articlesAtributesUpdateBody,
508
- token,
509
- setMessage,
510
- section
511
- );
512
- }}
513
- className="validation-option"
514
- disabled={!saveAvailable}
515
- >
516
- {saveAvailable && <img src={saveWhite} alt="guardar" />}{" "}
517
- {!saveAvailable && <img src={saveWhiteGray} alt="guardar" />}{" "}
518
- </button>
519
- );
520
- ret.attributes.forEach((attributeId) => {
521
- if (!retailersAdded.attr.includes(`${attributeId + "-" + ret.id}`)) {
522
- retailersAdded.attr.push(`${attributeId + "-" + ret.id}`);
523
- columns.push({
524
- Header: rules[attributeId].name,
525
- accessor: `${attributeId + "-" + ret.id}`,
526
- width: "200px",
527
- style: (attributeId==6700 || attributeId==6701) ? styleApprovalAttributes : styleData,
528
- description: rules[attributeId].description,
529
- });
530
- }
531
- });
532
-
533
- const handleChangeOptions = (attributeId, newValue) => {
534
- const updatedAttributes = Object.values(item.attributes).map((attr) => {
535
- if (attr.attributeId === attributeId) {
536
- return { ...attr, value: newValue };
537
- }
538
- return attr;
539
- });
540
- const updatedAttributesObject = {};
541
- updatedAttributes.forEach((attr) => {
542
- updatedAttributesObject[attr.attributeId] = attr;
543
- });
544
- return updatedAttributesObject;
545
- };
546
-
547
-
548
-
549
- const inputTypeValue = (type) => {
550
- switch (type) {
551
- case "Booleano":
552
- return "checkbox";
553
- case "Numérico":
554
- return "number";
555
- default:
556
- return "text";
557
- }
558
- };
559
- Object.values(item.attributes).forEach((des) => {
560
- const props = {
561
- inputId:
562
- item.id +
563
- "_" +
564
- rules[des.attributeId].attributeId +
565
- "_" +
566
- item.version,
567
- name:
568
- item.id +
569
- "-" +
570
- rules[des.attributeId].attributeId +
571
- "-" +
572
- item.version,
573
- value: des.value,
574
- inputType:inputTypeValue(des.type),
575
- };
576
- let inputComponent;
577
- if (des.option_list.length>0) {
578
- inputComponent = (
579
- <select
580
- id={
581
- item.id +
582
- "_" +
583
- rules[des.attributeId].attributeId +
584
- "_" +
585
- item.version
586
- }
587
- name={
588
- item.id +
589
- "-" +
590
- rules[des.attributeId].attributeId +
591
- "-" +
592
- item.version
593
- }
594
- className="select-edition-multiple"
595
- defaultValue={des.value}
596
- onChange={(e) =>{
597
- handleChangeOptions(des.attributeId, e.target.value)}
598
- }
599
- >
600
- <option value="" selected disabled>Selecciona una opción</option>
601
- {des.option_list.map((option, index) => (
602
- <option key={index} value={option}>
603
- {option}
604
- </option>
605
- ))}
606
- </select>
607
- );
608
-
609
- } else {
610
- inputComponent = <TagAndInput {...props} />;
611
- }
612
-
613
- if (
614
- !attributesReviewed.find(
615
- (e) =>
616
- e.articleId == item.id &&
617
- e.attributeId == des.attributeId &&
618
- e.versionId == item.version
619
- )
620
- )
621
- attributesReviewed.push({
622
- articleId: item.id,
623
- attributeId: des.attributeId,
624
- versionId: item.version,
625
- isApproved: des.isApproved ? des.isApproved : false,
626
- isReviewed: des.isApproved != null ? true : false,
627
- comment: "",
628
- });
629
- var index = attributesReviewed.findIndex(
630
- (e) =>
631
- e.articleId === item.id &&
632
- e.attributeId === des.attributeId &&
633
- e.versionId === item.version
634
- );
635
- currentData[`${des.attributeId + "-" + ret.id}`] = (
636
- <>
637
- <button
638
- onClick={() => {
639
- setShowValidationPanel(true);
640
- setAttributeSelected({
641
- articleId: item.id,
642
- attributeId: des.attributeId,
643
- versionId: item.version,
644
- });
645
- }}
646
- className="validation-button"
647
- >
648
- {attributesReviewed[index].isReviewed &&
649
- attributesReviewed[index].isApproved && (
650
- <img
651
- id={
652
- "button_" +
653
- item.id +
654
- "_" +
655
- des.attributeId +
656
- "_" +
657
- item.version
658
- }
659
- src={acceptIcon}
660
- alt="accept button"
661
- />
662
- )}
663
- {attributesReviewed[index].isReviewed &&
664
- !attributesReviewed[index].isApproved && (
665
- /**<Tooltip position="topCenter" componentTooltip={<span>Debes aprobar o rechazar para continuar</span>}>**/
666
- <div>
667
- <img
668
- id={
669
- "button_" +
670
- item.id +
671
- "_" +
672
- des.attributeId +
673
- "_" +
674
- item.version
675
- }
676
- src={rejectIcon}
677
- alt="reject icon"
678
- />
679
- </div>
680
- /*</Tooltip>*/
681
- )}
682
- {typeof des.isApproved === "undefined" &&
683
- !attributesReviewed[index].isReviewed && (
684
- <Tooltip position="topCenter" componentTooltip={<span>Debes aprobar o rechazar para continuar</span>}>
685
- <div>
686
- <img
687
- id={
688
- "button_" +
689
- item.id +
690
- "_" +
691
- des.attributeId +
692
- "_" +
693
- item.version
694
- }
695
- src={nullIcon}
696
- alt="null button"
697
- />
698
- </div>
699
- </Tooltip>
700
-
701
- )}
702
- </button>
703
- {showValidationPanel &&
704
- attributeSelected.articleId === item.id &&
705
- attributeSelected.attributeId === des.attributeId &&
706
- attributeSelected.versionId === item.version && (
707
- <div className="buttons-container" style={{left: "35px"}}>
708
- <button
709
- onClick={() => {
710
- attributesReviewed[index].isApproved = true;
711
- attributesReviewed[index].isReviewed = true;
712
- //document.getElementById(item.id+'_'+des.attributeId+'_'+item.version).style.borderColor="#71DE56";
713
- setShowValidationPanel(false);
714
- }}
715
- className="validation-option"
716
- >
717
- <img src={acceptIcon} alt="accept button" />
718
- <p> Validar </p>{" "}
719
- </button>{" "}
720
- <button
721
- onClick={() => {
722
- setShowValidationPanel(false);
723
- setShowRejectModal(true);
724
- }}
725
- className="validation-option"
726
- >
727
- <img src={rejectIcon} alt="reject button" />
728
- <p> Rechazar </p>{" "}
729
- </button>{" "}
730
- </div>
731
- )}{" "}
732
- {des.comment && <div class="tooltip">
733
- {inputComponent}
734
- <span class="tooltiptext"><p><b>Comentarios del rechazo</b></p><p>{des.comment}</p></span>
735
- </div>}
736
- {!des.comment && <div>
737
- {inputComponent}
738
- </div>}
739
- </>
740
- );
741
- });
742
- });
743
- }
744
- if (section === "description") {
745
- item.retailer.forEach((ret) => {
746
- if (!retailersAdded.id.includes(ret.id)) {
747
- retailersAdded.id.push(ret.id);
748
- columns.push({
749
- Header: "Cadena",
750
- accessor: `retailer${ret.id}`,
751
- width: "100px"
752
- });
753
- columns.push({
754
- Header: "",
755
- accessor: `retailer${ret.id}-save`,
756
- width: "60px",
757
- style: styleSaveButtonCol,
758
- });
759
- }
760
- var saveAvailable=true;
761
- /**var saveAvailable = descriptionsReviewed
762
- .filter((e) => e.articleId === item.id)
763
- .every((e) => e.isReviewed === true);
764
- if (
765
- descriptionsReviewed.filter((e) => e.articleId === item.id).length == 0
766
- ) {
767
- saveAvailable = false;
768
- }**/
769
- currentData[`retailer${ret.id}`] = <p> {ret.name} </p>;
770
- ret.descriptions.forEach((descriptionId) => {
771
- if (!retailersAdded.attr.includes(`${descriptionId}`)) {
772
- retailersAdded.attr.push(`${descriptionId}`);
773
- columns.push({
774
- Header: rules[ret.id][descriptionId].name,
775
- accessor: `${descriptionId}`,
776
- width: "250px",
777
- style: styleData,
778
- description:rules[ret.id][descriptionId].description
779
- });
780
- }
781
- });
782
-
783
- currentData[`retailer${ret.id}-save`] = (
784
- <button
785
- onClick={() => {
786
- var articlesDescriptionsUpdateBody = [];
787
- var articleDescriptions = descriptionsReviewed.filter(
788
- (e) => e.articleId === item.id && e.versionId === item.version
789
- );
790
- articleDescriptions.forEach((articleDescription) => {
791
- const value = document.getElementById(
792
- articleDescription.articleId +
793
- "_" +
794
- articleDescription.attributeId +
795
- "_" +
796
- articleDescription.versionId
797
- ).value;
798
- articlesDescriptionsUpdateBody.push({
799
- articleId: articleDescription.articleId,
800
- versionId: articleDescription.versionId,
801
- attributeId: articleDescription.attributeId,
802
- value: value ? value : "",
803
- isApproved: articleDescription.isApproved,
804
- comment: articleDescription.comment,
805
- });
806
- });
807
- updateArticleData(
808
- item.version,
809
- item.id,
810
- articlesDescriptionsUpdateBody,
811
- token,
812
- setMessage,
813
- section
814
- );
815
- }}
816
- className="validation-option"
817
- disabled={!saveAvailable}
818
- >
819
- {saveAvailable && <img src={saveWhite} alt="guardar" />}{" "}
820
- {!saveAvailable && <img src={saveWhiteGray} alt="guardar" />}{" "}
821
- </button>
822
- );
823
- Object.values(item.descriptions).forEach((des) => {
824
- const props = {
825
- name: rules[des.attributeId],
826
- id: item.id + "_" + des.attributeId + "_" + item.version,
827
- cols: 30,
828
- rows: 2,
829
- defaultValue: des.value
830
- };
831
- if (
832
- !descriptionsReviewed.find(
833
- (e) =>
834
- e.articleId == item.id &&
835
- e.attributeId == des.attributeId &&
836
- e.versionId == item.version
837
- )
838
- )
839
- descriptionsReviewed.push({
840
- articleId: item.id,
841
- attributeId: des.attributeId,
842
- versionId: item.version,
843
- isApproved: des.isApproved ? des.isApproved : false,
844
- isReviewed: des.isApproved != null ? true : false,
845
- comment: "",
846
- });
847
- var index = descriptionsReviewed.findIndex(
848
- (e) =>
849
- e.articleId === item.id &&
850
- e.attributeId === des.attributeId &&
851
- e.versionId === item.version
852
- );
853
- currentData[`${des.attributeId}`] = (
854
- <>
855
- {/**<button
856
- onClick={() => {
857
- setShowValidationPanel(true);
858
- setAttributeSelected({
859
- articleId: item.id,
860
- attributeId: des.attributeId,
861
- versionId: item.version,
862
- });
863
- }}
864
- className="validation-button"
865
- >
866
- {descriptionsReviewed[index].isReviewed &&
867
- descriptionsReviewed[index].isApproved && (
868
- <img
869
- id={
870
- "button_" +
871
- item.id +
872
- "_" +
873
- des.attributeId +
874
- "_" +
875
- item.version
876
- }
877
- src={acceptIcon}
878
- alt="accept button"
879
- />
880
- )}{" "}
881
- {descriptionsReviewed[index].isReviewed &&
882
- !descriptionsReviewed[index].isApproved && (
883
- <img
884
- id={
885
- "button_" +
886
- item.id +
887
- "_" +
888
- des.attributeId +
889
- "_" +
890
- item.version
891
- }
892
- src={rejectIcon}
893
- alt="reject button"
894
- />
895
- )}{" "}
896
- {typeof des.isApproved === "undefined" &&
897
- !descriptionsReviewed[index].isReviewed && (
898
- <img
899
- id={
900
- "button_" +
901
- item.id +
902
- "_" +
903
- des.attributeId +
904
- "_" +
905
- item.version
906
- }
907
- src={rejectIcon}
908
- alt="reject button"
909
- />
910
- )}
911
- </button>{" "}
912
- {showValidationPanel &&
913
- attributeSelected.articleId === item.id &&
914
- attributeSelected.attributeId === des.attributeId &&
915
- attributeSelected.versionId === item.version && (
916
- <div className="buttons-container" style={{left: "35px"}}>
917
- <button
918
- onClick={() => {
919
- descriptionsReviewed[index].isApproved = true;
920
- descriptionsReviewed[index].isReviewed = true;
921
- setShowValidationPanel(false);
922
- }}
923
- className="validation-option"
924
- >
925
- <img src={acceptIcon} alt="accept button" />
926
- <p> Validar </p>{" "}
927
- </button>{" "}
928
- <button
929
- onClick={() => {
930
- setShowValidationPanel(false);
931
- setShowRejectModal(true);
932
- }}
933
- className="validation-option"
934
- >
935
- <img src={rejectIcon} alt="reject button" />
936
- <p> Rechazar </p>{" "}
937
- </button>{" "}
938
- </div>
939
- )}{" "}**/}
940
- {des.comment && <div class="tooltip">
941
- <textarea {...props}></textarea>
942
- <span class="tooltiptext"><p><b>Comentarios del rechazo</b></p><p>{des.comment}</p></span>
943
- </div>}
944
- {!des.comment && <div>
945
- <textarea {...props}></textarea>
946
- </div>}
947
- </>
948
- );
949
- });
950
- });
951
- }
952
- values.push(currentData);
953
- });
954
- return [columns, values];
955
- }
956
-
957
- export function modalReducer(state, action) {
958
- if (action.type === "close") {
959
- return {
960
- show: false,
961
- };
962
- }
963
- const { setModal, setDataServices } = action?.functions;
964
- const buttons = [
965
- <ButtonV2
966
- key="btn-Cancelar"
967
- type="white"
968
- label="Cancelar"
969
- onClick={() =>
970
- setModal({
971
- type: "close",
972
- })
973
- }
974
- />,
975
- ];
976
- if (action.type === "saved successfully") {
977
- buttons[0] = (
978
- <ButtonV2
979
- key="btn-Aceptar"
980
- type="pink"
981
- label="Aceptar"
982
- onClick={async () =>
983
- setModal({
984
- type: "close",
985
- })
986
- }
987
- />
988
- );
989
- return {
990
- show: true,
991
- title: "Servicio guardado con éxito",
992
- message: `El servicio de ${action.payload?.service} se ha guardado con éxito.`,
993
- icon: "success",
994
- buttons,
995
- };
996
- }
997
- if (action.type === "delete") {
998
- buttons.push(
999
- <ButtonV2
1000
- key="btn-Aceptar"
1001
- type="pink"
1002
- label="Aceptar"
1003
- onClick={async () => {
1004
- setDataServices({
1005
- type: "deleteImage",
1006
- payload: action.payload,
1007
- });
1008
- setModal({
1009
- type: "close",
1010
- });
1011
- }}
1012
- />
1013
- );
1014
- return {
1015
- show: true,
1016
- title: "Eliminar imagen",
1017
- message: "¿Está seguro de eliminar la imagen seleccionada?",
1018
- icon: "warning",
1019
- buttons,
1020
- };
1021
- }
1022
- return state;
1023
- }
1024
-
1025
- async function updateArticleData(
1026
- version,
1027
- articleId,
1028
- attributes,
1029
- token,
1030
- setMessage,
1031
- section
1032
- ) {
1033
- var body={} ;
1034
- var params=""
1035
- if(section!="images"){
1036
- body = {
1037
- articleId: articleId,
1038
- articleData: attributes,
1039
- };
1040
- params = `?${section}=true&version=${version}`;
1041
- }
1042
- else{
1043
- body = {
1044
- articleId: articleId,
1045
- onboardingImagesData: attributes,
1046
- };
1047
- params = `?image=true&version=${version}`;
1048
-
1049
- }
1050
- try {
1051
- const res = await axios.put(
1052
- `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}` + params,
1053
- body,
1054
- {
1055
- headers: {
1056
- Authorization: token,
1057
- },
1058
- }
1059
- );
1060
- if (res.data.statusCode === 200 && section=="description") {
1061
- setMessage("Descripciones de los productos guardados con éxito");
1062
- }
1063
- if (res.data.statusCode === 200 && section=="datasheet") {
1064
- setMessage("Atributos de los productos guardados con éxito");
1065
- }
1066
- if (res.data.statusCode === 200 && section=="images") {
1067
- setMessage("Imágenes de los productos guardados con éxito");
1068
- }
1069
- } catch (error) {
1070
- console.log(error);
1071
- }
1072
- }
1073
-