contentoh-components-library 8.0.0 → 10.0.1

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 (408) hide show
  1. package/.env.development +20 -12
  2. package/.env.production +10 -2
  3. package/CHANGELOG.md +39 -0
  4. package/dist/assets/images/carouselImagesLogin/login2.svg +117 -0
  5. package/dist/assets/images/carouselImagesLogin/login3.svg +147 -0
  6. package/dist/assets/images/carouselImagesLogin/loginImage.svg +301 -0
  7. package/dist/assets/images/editField/showPassword.png +0 -0
  8. package/dist/assets/images/generalButton/downloadIcon.svg +3 -0
  9. package/dist/assets/images/genericModal/closeWhite.svg +3 -0
  10. package/dist/assets/images/genericModal/errorModal.svg +3 -0
  11. package/dist/assets/images/genericModal/yellowAlert.svg +12 -0
  12. package/dist/assets/images/sliderToolTip/infoIcon.svg +4 -0
  13. package/dist/assets/images/sliderToolTip/slide1.svg +5 -0
  14. package/dist/assets/images/sliderToolTip/slide2.svg +9 -0
  15. package/dist/assets/images/sliderToolTip/slide3.svg +9 -0
  16. package/dist/assets/images/sliderToolTip/slide4.svg +9 -0
  17. package/dist/assets/images/sliderToolTip/slide5.svg +40 -0
  18. package/dist/assets/images/verticalSideMenuMainPage/closeMenu.svg +4 -0
  19. package/dist/assets/images/verticalSideMenuMainPage/iconFAQS.svg +12 -0
  20. package/dist/assets/images/verticalSideMenuMainPage/iconGroup.svg +3 -0
  21. package/dist/assets/images/verticalSideMenuMainPage/iconLogo.svg +12 -0
  22. package/dist/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +15 -0
  23. package/dist/assets/images/verticalSideMenuMainPage/iconProduct.svg +3 -0
  24. package/dist/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +12 -0
  25. package/dist/assets/images/verticalSideMenuMainPage/iconTask.svg +10 -0
  26. package/dist/assets/images/verticalSideMenuMainPage/openMenu.svg +4 -0
  27. package/dist/components/atoms/ActivedFilter/ActivedFilter.stories.js +7 -1
  28. package/dist/components/atoms/ActivedFilter/index.js +12 -4
  29. package/dist/components/atoms/AsignationOption/AsignationOptions.stories.js +7 -1
  30. package/dist/components/atoms/AsignationOption/index.js +52 -23
  31. package/dist/components/atoms/AsignationOption/styles.js +1 -1
  32. package/dist/components/atoms/AtomList/AtomList.stories.js +7 -1
  33. package/dist/components/atoms/AtomList/index.js +14 -9
  34. package/dist/components/atoms/Avatar/AsignationImage.stories.js +7 -1
  35. package/dist/components/atoms/Avatar/index.js +11 -8
  36. package/dist/components/atoms/Card/Card.stories.js +7 -1
  37. package/dist/components/atoms/Card/index.js +8 -4
  38. package/dist/components/atoms/CharCounter/CharCounter.stories.js +31 -0
  39. package/dist/components/atoms/CharCounter/index.js +22 -0
  40. package/dist/components/atoms/CharCounter/styles.js +20 -0
  41. package/dist/components/atoms/CheckBox/CheckBox.stories.js +7 -1
  42. package/dist/components/atoms/CheckBox/index.js +19 -13
  43. package/dist/components/atoms/Commentary/index.js +10 -2
  44. package/dist/components/atoms/Commentary/styles.js +4 -1
  45. package/dist/components/atoms/CustomerTypeImage/CustomerTypeImage.stories.js +7 -1
  46. package/dist/components/atoms/CustomerTypeImage/index.js +8 -6
  47. package/dist/components/atoms/DropDownButton/DropDownButton.stories.js +7 -1
  48. package/dist/components/atoms/DropDownButton/index.js +9 -6
  49. package/dist/components/atoms/DropDownButton/styles.js +1 -1
  50. package/dist/components/atoms/EditField/EditField.stories.js +7 -1
  51. package/dist/components/atoms/EditField/index.js +17 -10
  52. package/dist/components/atoms/FeatureTag/FeatureTag.stories.js +7 -1
  53. package/dist/components/atoms/FeatureTag/index.js +11 -5
  54. package/dist/components/atoms/GeneralButton/GeneralButton.stories.js +7 -1
  55. package/dist/components/atoms/GeneralButton/index.js +13 -7
  56. package/dist/components/atoms/GeneralButton/styles.js +4 -2
  57. package/dist/components/atoms/GeneralInput/GeneralInput.stories.js +7 -1
  58. package/dist/components/atoms/GeneralInput/index.js +128 -69
  59. package/dist/components/atoms/GeneralInput/styles.js +8 -2
  60. package/dist/components/atoms/GeneralTextBox/GeneralTextBox.stories.js +7 -1
  61. package/dist/components/atoms/GeneralTextBox/index.js +12 -7
  62. package/dist/components/atoms/GenericModal/GenericModal.stories.js +46 -59
  63. package/dist/components/atoms/GenericModal/index.js +15 -8
  64. package/dist/components/atoms/GenericModal/styles.js +1 -1
  65. package/dist/components/atoms/GradientPanel/GradientPanel.stories.js +85 -80
  66. package/dist/components/atoms/GradientPanel/index.js +11 -7
  67. package/dist/components/atoms/GradientPanel/styles.js +2 -2
  68. package/dist/components/atoms/Graphic/Graphic.stories.js +7 -1
  69. package/dist/components/atoms/Graphic/index.js +9 -5
  70. package/dist/components/atoms/Input/index.js +15 -8
  71. package/dist/components/atoms/Input/style.js +4 -4
  72. package/dist/components/atoms/InputFormatter/Wysiwyg.stories.js +30 -0
  73. package/dist/components/atoms/InputFormatter/index.js +187 -0
  74. package/dist/components/atoms/InputFormatter/styles.js +33 -0
  75. package/dist/components/atoms/LabelToInput/index.js +18 -13
  76. package/dist/components/atoms/LabelToInput/style.js +3 -3
  77. package/dist/components/atoms/LoadImageMenu/LoadImageMenu.stories.js +7 -1
  78. package/dist/components/atoms/LoadImageMenu/index.js +33 -22
  79. package/dist/components/atoms/Loading/Loading.stories.js +28 -0
  80. package/dist/components/atoms/Loading/index.js +27 -0
  81. package/dist/components/atoms/Loading/styles.js +22 -0
  82. package/dist/components/atoms/LogoImage/LogoImage.stories.js +7 -1
  83. package/dist/components/atoms/LogoImage/index.js +9 -6
  84. package/dist/components/atoms/MenuNotification/MenuNotification.stories.js +7 -1
  85. package/dist/components/atoms/MenuNotification/index.js +21 -15
  86. package/dist/components/atoms/MenuProfile/MenuProfile.stories.js +7 -1
  87. package/dist/components/atoms/MenuProfile/index.js +25 -15
  88. package/dist/components/atoms/Notification/Notification.stories.js +5 -1
  89. package/dist/components/atoms/Notification/index.js +15 -9
  90. package/dist/components/atoms/Percent/Percent.stories.js +7 -1
  91. package/dist/components/atoms/Percent/index.js +21 -14
  92. package/dist/components/atoms/PriorityFlag/PriorityFlag.stories.js +7 -1
  93. package/dist/components/atoms/PriorityFlag/index.js +8 -4
  94. package/dist/components/atoms/ProductImage/ProductImage.stories.js +7 -1
  95. package/dist/components/atoms/ProductImage/index.js +11 -8
  96. package/dist/components/atoms/ProductPercentCard/Percent.stories.js +41 -0
  97. package/dist/components/atoms/ProductPercentCard/index.js +45 -0
  98. package/dist/components/atoms/ProductPercentCard/styles.js +20 -0
  99. package/dist/components/atoms/ProgressBar/ProgressBar.stories.js +7 -1
  100. package/dist/components/atoms/ProgressBar/index.js +8 -3
  101. package/dist/components/atoms/ProgressBar/styles.js +1 -1
  102. package/dist/components/atoms/ScreenHeader/ScreenHeader.stories.js +7 -1
  103. package/dist/components/atoms/ScreenHeader/index.js +9 -3
  104. package/dist/components/atoms/ScreenHeader/styles.js +1 -1
  105. package/dist/components/atoms/Select/index.js +27 -20
  106. package/dist/components/atoms/Select/style.js +1 -1
  107. package/dist/components/atoms/SideMenuButton/SideMenuButton.stories.js +5 -1
  108. package/dist/components/atoms/SideMenuButton/index.js +10 -4
  109. package/dist/components/atoms/SliderToolTip/SliderToolTip.stories.js +47 -0
  110. package/dist/components/atoms/SliderToolTip/index.js +200 -0
  111. package/dist/components/atoms/SliderToolTip/styles.js +24 -0
  112. package/dist/components/atoms/StatusTag/StatusTag.stories.js +7 -1
  113. package/dist/components/atoms/StatusTag/index.js +43 -3
  114. package/dist/components/atoms/StatusTag/styles.js +1 -1
  115. package/dist/components/atoms/TabSection/TabSection.stories.js +7 -1
  116. package/dist/components/atoms/TabSection/index.js +8 -3
  117. package/dist/components/atoms/ValidationPanel/ValidationPanel.stories.js +7 -1
  118. package/dist/components/atoms/ValidationPanel/index.js +57 -34
  119. package/dist/components/atoms/ValidationPanel/styles.js +1 -1
  120. package/dist/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +28 -0
  121. package/dist/components/atoms/VerticalSideMenuMainPage/index.js +98 -0
  122. package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +24 -0
  123. package/dist/components/molecules/AddProvidersAndProducts/AddProvidersAndProducts.stories.js +5 -1
  124. package/dist/components/molecules/AddProvidersAndProducts/index.js +18 -12
  125. package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +5 -1
  126. package/dist/components/molecules/AssignedWork/index.js +36 -30
  127. package/dist/components/molecules/AvatarAndValidation/AvatarAndValidation.stories.js +7 -1
  128. package/dist/components/molecules/AvatarAndValidation/index.js +33 -25
  129. package/dist/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +37 -0
  130. package/dist/components/molecules/CarouselImagesLogin/index.js +92 -0
  131. package/dist/components/molecules/CarouselImagesLogin/styles.js +21 -0
  132. package/dist/components/molecules/EditionActiveImage/EditionActiveImage.stories.js +7 -1
  133. package/dist/components/molecules/EditionActiveImage/index.js +14 -10
  134. package/dist/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +28 -0
  135. package/dist/components/molecules/EmailResetPasswordLogin/index.js +153 -0
  136. package/dist/components/molecules/EmailResetPasswordLogin/styles.js +20 -0
  137. package/dist/components/molecules/FeaturesBar/FeaturesBar.stories.js +7 -1
  138. package/dist/components/molecules/FeaturesBar/index.js +11 -9
  139. package/dist/components/molecules/GalleryElement/GalleryElement.stories.js +7 -1
  140. package/dist/components/molecules/GalleryElement/index.js +96 -57
  141. package/dist/components/molecules/GalleryHeader/GalleryHeader.stories.js +7 -1
  142. package/dist/components/molecules/GalleryHeader/index.js +46 -16
  143. package/dist/components/molecules/HeaderTop/HeaderTop.stories.js +7 -1
  144. package/dist/components/molecules/HeaderTop/index.js +10 -7
  145. package/dist/components/molecules/ImageSelector/ImageSelector.stories.js +7 -1
  146. package/dist/components/molecules/ImageSelector/index.js +15 -13
  147. package/dist/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +28 -0
  148. package/dist/components/molecules/LoginPasswordStrength/index.js +126 -0
  149. package/dist/components/molecules/LoginPasswordStrength/styles.js +78 -0
  150. package/dist/components/molecules/LogoLoading/Loading.stories.js +28 -0
  151. package/dist/components/molecules/LogoLoading/index.js +22 -0
  152. package/dist/components/molecules/LogoLoading/styles.js +18 -0
  153. package/dist/components/molecules/ParentComponent/ParentComponent.stories.js +10 -2
  154. package/dist/components/molecules/ParentComponent/index.js +9 -5
  155. package/dist/components/molecules/PayMethod/PayMethod.stories.js +7 -1
  156. package/dist/components/molecules/PayMethod/index.js +38 -33
  157. package/dist/components/molecules/PlanSelection/PlanSelection.stories.js +7 -1
  158. package/dist/components/molecules/PlanSelection/index.js +14 -11
  159. package/dist/components/molecules/ProductNameHeader/ProductNameHeader.stories.js +7 -1
  160. package/dist/components/molecules/ProductNameHeader/index.js +18 -14
  161. package/dist/components/molecules/ProductNotification/ProductNotification.stories.js +7 -1
  162. package/dist/components/molecules/ProductNotification/index.js +12 -9
  163. package/dist/components/molecules/ProfileHeader/ProfileHeader.stories.js +5 -1
  164. package/dist/components/molecules/ProfileHeader/index.js +21 -15
  165. package/dist/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +28 -0
  166. package/dist/components/molecules/RegistrationFirstStep/index.js +308 -0
  167. package/dist/components/molecules/RegistrationFirstStep/styles.js +20 -0
  168. package/dist/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +28 -0
  169. package/dist/components/molecules/RegistrationSecondStep/index.js +172 -0
  170. package/dist/components/molecules/RegistrationSecondStep/styles.js +20 -0
  171. package/dist/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +28 -0
  172. package/dist/components/molecules/RegistrationThirdStep/index.js +155 -0
  173. package/dist/components/molecules/RegistrationThirdStep/styles.js +20 -0
  174. package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +7 -1
  175. package/dist/components/molecules/RetailerSelector/index.js +36 -25
  176. package/dist/components/molecules/RetailerSelector/styles.js +1 -1
  177. package/dist/components/molecules/SidebarNotification/SidebarNotification.stories.js +5 -1
  178. package/dist/components/molecules/SidebarNotification/index.js +43 -37
  179. package/dist/components/molecules/SignInLogin/SignInLogin.stories.js +28 -0
  180. package/dist/components/molecules/SignInLogin/index.js +315 -0
  181. package/dist/components/molecules/SignInLogin/styles.js +20 -0
  182. package/dist/components/molecules/StatusAsignationInfo/StatusAsignationInfo.stories.js +7 -1
  183. package/dist/components/molecules/StatusAsignationInfo/index.js +111 -98
  184. package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
  185. package/dist/components/molecules/TableHeader/TableHeader.stories.js +7 -1
  186. package/dist/components/molecules/TableHeader/index.js +21 -9
  187. package/dist/components/molecules/TableHeader/styles.js +1 -1
  188. package/dist/components/molecules/TableRow/TableRow.stories.js +7 -1
  189. package/dist/components/molecules/TableRow/index.js +11 -7
  190. package/dist/components/molecules/TabsMenu/TabsMenu.stories.js +7 -1
  191. package/dist/components/molecules/TabsMenu/index.js +13 -10
  192. package/dist/components/molecules/TagAndInput/TagAndInput.stories.js +7 -1
  193. package/dist/components/molecules/TagAndInput/index.js +43 -23
  194. package/dist/components/molecules/TagAndInput/styles.js +10 -2
  195. package/dist/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +28 -0
  196. package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +211 -0
  197. package/dist/components/molecules/VerificationCodeResetPasswordLogin/styles.js +20 -0
  198. package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +69 -0
  199. package/dist/components/organisms/ChangePassword/ChangePassword.stories.js +28 -0
  200. package/dist/components/organisms/ChangePassword/index.js +124 -0
  201. package/dist/components/organisms/ChangePassword/styles.js +18 -0
  202. package/dist/components/organisms/FullProductNameHeader/FullProductNameHeader.stories.js +7 -1
  203. package/dist/components/organisms/FullProductNameHeader/index.js +70 -34
  204. package/dist/components/organisms/FullTabsMenu/FullTabsMenu.stories.js +7 -1
  205. package/dist/components/organisms/FullTabsMenu/index.js +30 -23
  206. package/dist/components/organisms/Fullplan/FullPlan.stories.js +7 -1
  207. package/dist/components/organisms/Fullplan/index.js +23 -15
  208. package/dist/components/organisms/GlobalModal/index.js +73 -0
  209. package/dist/components/organisms/GlobalModal/styles.js +66 -0
  210. package/dist/components/organisms/ImageDataTable/ImageDataTable.stories.js +7 -1
  211. package/dist/components/organisms/ImageDataTable/index.js +85 -62
  212. package/dist/components/organisms/ImagePreviewer/ImagePreviewer.stories.js +7 -1
  213. package/dist/components/organisms/ImagePreviewer/index.js +12 -8
  214. package/dist/components/organisms/ImagesGroup/index.js +5 -1
  215. package/dist/components/organisms/InputGroup/InputGroup.stories.js +7 -1
  216. package/dist/components/organisms/InputGroup/index.js +44 -37
  217. package/dist/components/organisms/InputGroup/styles.js +1 -1
  218. package/dist/components/organisms/ProductImageModal/ProductImageModal.stories.js +7 -1
  219. package/dist/components/organisms/ProductImageModal/index.js +49 -46
  220. package/dist/components/organisms/ProductImageModal/styles.js +1 -1
  221. package/dist/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +38 -0
  222. package/dist/components/pages/ChangePasswordLogin/index.js +108 -0
  223. package/dist/components/pages/ChangePasswordLogin/styles.js +18 -0
  224. package/dist/components/pages/CustomerLogin/CustomerLogin.stories.js +52 -47
  225. package/dist/components/pages/CustomerLogin/index.js +18 -12
  226. package/dist/components/pages/CustomerPayMethod/CustomerPayMethod.stories.js +36 -28
  227. package/dist/components/pages/CustomerPayMethod/index.js +18 -12
  228. package/dist/components/pages/CustomerType/CustomerType.stories.js +21 -22
  229. package/dist/components/pages/CustomerType/index.js +18 -12
  230. package/dist/components/pages/EmailResetPassword/EmailResetPassword.stories.js +37 -0
  231. package/dist/components/pages/EmailResetPassword/index.js +130 -0
  232. package/dist/components/pages/EmailResetPassword/styles.js +20 -0
  233. package/dist/components/pages/OnboardPlan/OnboardPlan.stories.js +12 -9
  234. package/dist/components/pages/OnboardPlan/index.js +18 -12
  235. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +186 -0
  236. package/dist/components/pages/ProviderProductEdition/index.js +1932 -0
  237. package/dist/components/pages/ProviderProductEdition/styles.js +23 -0
  238. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
  239. package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
  240. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
  241. package/dist/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +38 -0
  242. package/dist/components/pages/RegistrationLoginSecondStep/index.js +176 -0
  243. package/dist/components/pages/RegistrationLoginSecondStep/styles.js +20 -0
  244. package/dist/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +37 -0
  245. package/dist/components/pages/RegistrationLoginThirdStep/index.js +178 -0
  246. package/dist/components/pages/RegistrationLoginThirdStep/styles.js +20 -0
  247. package/dist/components/pages/RetailerPlan/RetailerPlan.stories.js +13 -10
  248. package/dist/components/pages/RetailerPlan/index.js +18 -12
  249. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +36 -72
  250. package/dist/components/pages/RetailerProductEdition/index.js +1295 -590
  251. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  252. package/dist/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +37 -0
  253. package/dist/components/pages/VerificationCodeResetPassword/index.js +121 -0
  254. package/dist/components/pages/VerificationCodeResetPassword/styles.js +20 -0
  255. package/dist/components/pages/VerificationCodeResetPassword/utils.js +69 -0
  256. package/dist/global-files/data.js +104 -24
  257. package/dist/global-files/fonts.css +45 -0
  258. package/dist/global-files/global-styles.css +41 -0
  259. package/dist/index.js +316 -100
  260. package/package.json +28 -8
  261. package/src/assets/images/carouselImagesLogin/login2.svg +117 -0
  262. package/src/assets/images/carouselImagesLogin/login3.svg +147 -0
  263. package/src/assets/images/carouselImagesLogin/loginImage.svg +301 -0
  264. package/src/assets/images/editField/showPassword.png +0 -0
  265. package/src/assets/images/generalButton/downloadIcon.svg +3 -0
  266. package/src/assets/images/genericModal/closeWhite.svg +3 -0
  267. package/src/assets/images/genericModal/errorModal.svg +3 -0
  268. package/src/assets/images/genericModal/yellowAlert.svg +12 -0
  269. package/src/assets/images/sliderToolTip/infoIcon.svg +4 -0
  270. package/src/assets/images/sliderToolTip/slide1.svg +5 -0
  271. package/src/assets/images/sliderToolTip/slide2.svg +9 -0
  272. package/src/assets/images/sliderToolTip/slide3.svg +9 -0
  273. package/src/assets/images/sliderToolTip/slide4.svg +9 -0
  274. package/src/assets/images/sliderToolTip/slide5.svg +40 -0
  275. package/src/assets/images/verticalSideMenuMainPage/closeMenu.svg +4 -0
  276. package/src/assets/images/verticalSideMenuMainPage/iconFAQS.svg +12 -0
  277. package/src/assets/images/verticalSideMenuMainPage/iconGroup.svg +3 -0
  278. package/src/assets/images/verticalSideMenuMainPage/iconLogo.svg +12 -0
  279. package/src/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +15 -0
  280. package/src/assets/images/verticalSideMenuMainPage/iconProduct.svg +3 -0
  281. package/src/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +12 -0
  282. package/src/assets/images/verticalSideMenuMainPage/iconTask.svg +10 -0
  283. package/src/assets/images/verticalSideMenuMainPage/openMenu.svg +4 -0
  284. package/src/components/atoms/AsignationOption/index.js +18 -1
  285. package/src/components/atoms/AsignationOption/styles.js +19 -1
  286. package/src/components/atoms/CharCounter/CharCounter.stories.js +11 -0
  287. package/src/components/atoms/CharCounter/index.js +13 -0
  288. package/src/components/atoms/CharCounter/styles.js +10 -0
  289. package/src/components/atoms/CheckBox/index.js +8 -2
  290. package/src/components/atoms/Commentary/index.js +2 -2
  291. package/src/components/atoms/Commentary/styles.js +2 -1
  292. package/src/components/atoms/DropDownButton/styles.js +6 -0
  293. package/src/components/atoms/GeneralButton/index.js +1 -0
  294. package/src/components/atoms/GeneralButton/styles.js +14 -0
  295. package/src/components/atoms/GeneralInput/index.js +109 -62
  296. package/src/components/atoms/GeneralInput/styles.js +35 -1
  297. package/src/components/atoms/GenericModal/index.js +2 -2
  298. package/src/components/atoms/GenericModal/styles.js +11 -3
  299. package/src/components/atoms/GradientPanel/styles.js +8 -1
  300. package/src/components/atoms/Input/index.js +2 -1
  301. package/src/components/atoms/Input/style.js +9 -5
  302. package/src/components/atoms/InputFormatter/Wysiwyg.stories.js +12 -0
  303. package/src/components/atoms/InputFormatter/index.js +146 -0
  304. package/src/components/atoms/InputFormatter/styles.js +41 -0
  305. package/src/components/atoms/LabelToInput/index.js +0 -1
  306. package/src/components/atoms/LabelToInput/style.js +15 -4
  307. package/src/components/atoms/Loading/Loading.stories.js +10 -0
  308. package/src/components/atoms/Loading/index.js +13 -0
  309. package/src/components/atoms/Loading/styles.js +57 -0
  310. package/src/components/atoms/LogoImage/index.js +1 -1
  311. package/src/components/atoms/ProductPercentCard/Percent.stories.js +41 -0
  312. package/src/components/atoms/ProductPercentCard/index.js +23 -0
  313. package/src/components/atoms/{Percent → ProductPercentCard}/styles.js +11 -7
  314. package/src/components/atoms/ProgressBar/styles.js +2 -1
  315. package/src/components/atoms/ScreenHeader/index.js +7 -3
  316. package/src/components/atoms/ScreenHeader/styles.js +14 -2
  317. package/src/components/atoms/Select/index.js +3 -1
  318. package/src/components/atoms/Select/style.js +1 -2
  319. package/src/components/atoms/SliderToolTip/SliderToolTip.stories.js +23 -0
  320. package/src/components/atoms/SliderToolTip/index.js +182 -0
  321. package/src/components/atoms/SliderToolTip/styles.js +168 -0
  322. package/src/components/atoms/StatusTag/index.js +30 -2
  323. package/src/components/atoms/StatusTag/styles.js +9 -4
  324. package/src/components/atoms/ValidationPanel/index.js +29 -17
  325. package/src/components/atoms/ValidationPanel/styles.js +6 -2
  326. package/src/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +12 -0
  327. package/src/components/atoms/VerticalSideMenuMainPage/index.js +54 -0
  328. package/src/components/atoms/VerticalSideMenuMainPage/styles.js +45 -0
  329. package/src/components/molecules/AvatarAndValidation/index.js +20 -15
  330. package/src/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +17 -0
  331. package/src/components/molecules/CarouselImagesLogin/index.js +65 -0
  332. package/src/components/molecules/CarouselImagesLogin/styles.js +60 -0
  333. package/src/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +11 -0
  334. package/src/components/molecules/EmailResetPasswordLogin/index.js +85 -0
  335. package/src/components/molecules/EmailResetPasswordLogin/styles.js +23 -0
  336. package/src/components/molecules/GalleryElement/index.js +26 -6
  337. package/src/components/molecules/GalleryHeader/index.js +8 -2
  338. package/src/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +8 -0
  339. package/src/components/molecules/LoginPasswordStrength/index.js +84 -0
  340. package/src/components/molecules/LoginPasswordStrength/styles.js +91 -0
  341. package/src/components/molecules/LogoLoading/Loading.stories.js +10 -0
  342. package/src/components/molecules/LogoLoading/index.js +12 -0
  343. package/src/components/molecules/LogoLoading/styles.js +16 -0
  344. package/src/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +11 -0
  345. package/src/components/molecules/RegistrationFirstStep/index.js +227 -0
  346. package/src/components/molecules/RegistrationFirstStep/styles.js +87 -0
  347. package/src/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +11 -0
  348. package/src/components/molecules/RegistrationSecondStep/index.js +135 -0
  349. package/src/components/molecules/RegistrationSecondStep/styles.js +64 -0
  350. package/src/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +11 -0
  351. package/src/components/molecules/RegistrationThirdStep/index.js +130 -0
  352. package/src/components/molecules/RegistrationThirdStep/styles.js +44 -0
  353. package/src/components/molecules/RetailerSelector/index.js +7 -1
  354. package/src/components/molecules/RetailerSelector/styles.js +3 -0
  355. package/src/components/molecules/SignInLogin/SignInLogin.stories.js +11 -0
  356. package/src/components/molecules/SignInLogin/index.js +226 -0
  357. package/src/components/molecules/SignInLogin/styles.js +120 -0
  358. package/src/components/molecules/StatusAsignationInfo/index.js +60 -53
  359. package/src/components/molecules/StatusAsignationInfo/styles.js +8 -2
  360. package/src/components/molecules/TableHeader/index.js +14 -2
  361. package/src/components/molecules/TableHeader/styles.js +8 -0
  362. package/src/components/molecules/TagAndInput/index.js +19 -1
  363. package/src/components/molecules/TagAndInput/styles.js +28 -0
  364. package/src/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +11 -0
  365. package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +171 -0
  366. package/src/components/molecules/VerificationCodeResetPasswordLogin/styles.js +54 -0
  367. package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +54 -0
  368. package/src/components/organisms/ChangePassword/ChangePassword.stories.js +11 -0
  369. package/src/components/organisms/ChangePassword/index.js +77 -0
  370. package/src/components/organisms/ChangePassword/styles.js +13 -0
  371. package/src/components/organisms/FullProductNameHeader/index.js +53 -16
  372. package/src/components/organisms/FullTabsMenu/index.js +15 -12
  373. package/src/components/organisms/GlobalModal/index.js +68 -0
  374. package/src/components/organisms/GlobalModal/styles.js +113 -0
  375. package/src/components/organisms/ImageDataTable/index.js +29 -8
  376. package/src/components/organisms/InputGroup/index.js +28 -8
  377. package/src/components/organisms/InputGroup/styles.js +2 -2
  378. package/src/components/organisms/ProductImageModal/index.js +8 -9
  379. package/src/components/organisms/ProductImageModal/styles.js +3 -0
  380. package/src/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +18 -0
  381. package/src/components/pages/ChangePasswordLogin/index.js +77 -0
  382. package/src/components/pages/ChangePasswordLogin/styles.js +20 -0
  383. package/src/components/pages/EmailResetPassword/EmailResetPassword.stories.js +17 -0
  384. package/src/components/pages/EmailResetPassword/index.js +77 -0
  385. package/src/components/pages/EmailResetPassword/styles.js +27 -0
  386. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +186 -0
  387. package/src/components/pages/ProviderProductEdition/index.js +1400 -0
  388. package/src/components/pages/ProviderProductEdition/styles.js +118 -0
  389. package/src/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +17 -0
  390. package/src/components/pages/RegistrationLoginFirstStep/index.js +160 -0
  391. package/src/components/pages/RegistrationLoginFirstStep/styles.js +85 -0
  392. package/src/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +18 -0
  393. package/src/components/pages/RegistrationLoginSecondStep/index.js +111 -0
  394. package/src/components/pages/RegistrationLoginSecondStep/styles.js +64 -0
  395. package/src/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +17 -0
  396. package/src/components/pages/RegistrationLoginThirdStep/index.js +106 -0
  397. package/src/components/pages/RegistrationLoginThirdStep/styles.js +48 -0
  398. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +27 -63
  399. package/src/components/pages/RetailerProductEdition/index.js +1034 -442
  400. package/src/components/pages/RetailerProductEdition/styles.js +17 -3
  401. package/src/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +17 -0
  402. package/src/components/pages/VerificationCodeResetPassword/index.js +92 -0
  403. package/src/components/pages/VerificationCodeResetPassword/styles.js +54 -0
  404. package/src/components/pages/VerificationCodeResetPassword/utils.js +56 -0
  405. package/src/global-files/data.js +88 -28
  406. package/src/index.js +23 -8
  407. package/src/components/atoms/Percent/Percent.stories.js +0 -38
  408. package/src/components/atoms/Percent/index.js +0 -15
@@ -9,6 +9,8 @@ exports.RetailerProductEdition = void 0;
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
13
+
12
14
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
13
15
 
14
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
@@ -35,7 +37,9 @@ var _react = require("react");
35
37
 
36
38
  var _GalleryElement = require("../../molecules/GalleryElement");
37
39
 
38
- var _data = require("../../../global-files/data");
40
+ var _fileSaver = require("file-saver");
41
+
42
+ var _data2 = require("../../../global-files/data");
39
43
 
40
44
  var _GalleryHeader = require("../../molecules/GalleryHeader");
41
45
 
@@ -61,6 +65,18 @@ var _GeneralButton = require("../../atoms/GeneralButton");
61
65
 
62
66
  var _Commentary = require("../../atoms/Commentary");
63
67
 
68
+ var _GenericModal = require("../../atoms/GenericModal");
69
+
70
+ var _ScreenHeader = require("../../atoms/ScreenHeader");
71
+
72
+ var _Loading = require("../../atoms/Loading");
73
+
74
+ var _genericModalCheck = _interopRequireDefault(require("../../../assets/images/genericModal/genericModalCheck.svg"));
75
+
76
+ var _errorModal = _interopRequireDefault(require("../../../assets/images/genericModal/errorModal.svg"));
77
+
78
+ var _jsxRuntime = require("react/jsx-runtime");
79
+
64
80
  var reducerImages = function reducerImages(state, action) {
65
81
  var values = state.values,
66
82
  attrForImgs = state.attrForImgs;
@@ -82,12 +98,22 @@ var reducerImages = function reducerImages(state, action) {
82
98
  });
83
99
 
84
100
  case "changeAttrValue":
85
- attrForImgs[action.retailer][action.index].value = action.value;
101
+ action.retailersId.forEach(function (ret) {
102
+ attrForImgs[ret][action.index].name === action.name && (attrForImgs[ret][action.index].value = action.value);
103
+ });
86
104
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
87
105
  attrForImgs: attrForImgs,
88
106
  values: values
89
107
  });
90
108
 
109
+ case "deleteImage":
110
+ values = values.filter(function (value) {
111
+ return action.selectedImages.indexOf(value) === -1;
112
+ });
113
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
114
+ values: values
115
+ });
116
+
91
117
  default:
92
118
  return state;
93
119
  }
@@ -109,15 +135,14 @@ var myBucket = new _awsSdk.default.S3({
109
135
  });
110
136
 
111
137
  var RetailerProductEdition = function RetailerProductEdition(_ref) {
112
- var _servicesData$filter$, _servicesData$filter$2, _product$services, _datasheets$, _datasheets$$data, _product$services2, _product$services3;
138
+ var _product$retailers, _product$services2, _datasheets$, _datasheets$$data, _product$article14;
113
139
 
114
- var productData = _ref.productData,
115
- tabsSections = _ref.tabsSections,
116
- articleId = _ref.articleId,
140
+ var tabsSections = _ref.tabsSections,
117
141
  _ref$productSelected = _ref.productSelected,
118
142
  productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
119
143
  _ref$user = _ref.user,
120
- user = _ref$user === void 0 ? {} : _ref$user;
144
+ user = _ref$user === void 0 ? {} : _ref$user,
145
+ token = _ref.token;
121
146
 
122
147
  var _useState = (0, _react.useState)("Descripción"),
123
148
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -129,7 +154,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
129
154
  activeImage = _useState4[0],
130
155
  setActiveImage = _useState4[1];
131
156
 
132
- var _useState5 = (0, _react.useState)(true),
157
+ var _useState5 = (0, _react.useState)(false),
133
158
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
134
159
  imageLayout = _useState6[0],
135
160
  setImageLayout = _useState6[1];
@@ -159,12 +184,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
159
184
  showModal = _useState14[0],
160
185
  setShowModal = _useState14[1];
161
186
 
162
- var _useState15 = (0, _react.useState)(54),
163
- _useState16 = (0, _slicedToArray2.default)(_useState15, 2),
164
- retailerSelected = _useState16[0],
165
- setRetailerSelected = _useState16[1]; // revisar después como trabajar esto de mejor forma
166
-
167
-
168
187
  var _useDropzone = (0, _reactDropzone.useDropzone)({
169
188
  accept: "image/*",
170
189
  noKeyboard: true,
@@ -176,42 +195,26 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
176
195
  var reader = new FileReader();
177
196
  reader.fileName = file.name;
178
197
 
179
- reader.onload = /*#__PURE__*/function () {
180
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
181
- var ext, img, width, height, newImg;
182
- return _regenerator.default.wrap(function _callee$(_context) {
183
- while (1) {
184
- switch (_context.prev = _context.next) {
185
- case 0:
186
- ext = e.srcElement.fileName.split(".");
187
- img = new Image();
188
- img.src = e.target.result;
189
- width = img.width;
190
- height = img.height;
191
- newImg = {
192
- action: "addImg",
193
- img: {
194
- src: e.target.result,
195
- name: e.target.fileName,
196
- ext: ext[ext.length - 1],
197
- width: width,
198
- height: width
199
- }
200
- };
201
- setImages(newImg);
202
-
203
- case 7:
204
- case "end":
205
- return _context.stop();
206
- }
198
+ reader.onload = function (e) {
199
+ var ext = e.srcElement.fileName.split(".");
200
+ var img = new Image();
201
+ img.src = e.target.result;
202
+ setTimeout(function () {
203
+ var width = img.width;
204
+ var height = img.height;
205
+ var newImg = {
206
+ action: "addImg",
207
+ img: {
208
+ src: e.target.result,
209
+ name: e.target.fileName,
210
+ ext: ext[ext.length - 1],
211
+ width: width,
212
+ height: height
207
213
  }
208
- }, _callee);
209
- }));
210
-
211
- return function (_x) {
212
- return _ref2.apply(this, arguments);
213
- };
214
- }();
214
+ };
215
+ setImages(newImg);
216
+ }, 500);
217
+ };
215
218
 
216
219
  reader.onerror = function (error) {
217
220
  console.log("dropzoneError: ", error);
@@ -225,165 +228,243 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
225
228
  getRootProps = _useDropzone.getRootProps,
226
229
  getInputProps = _useDropzone.getInputProps;
227
230
 
231
+ var _useState15 = (0, _react.useState)([]),
232
+ _useState16 = (0, _slicedToArray2.default)(_useState15, 2),
233
+ updatedDatasheets = _useState16[0],
234
+ setUpdatedDatasheets = _useState16[1];
235
+
228
236
  var _useState17 = (0, _react.useState)([]),
229
237
  _useState18 = (0, _slicedToArray2.default)(_useState17, 2),
230
- updatedDatasheets = _useState18[0],
231
- setUpdatedDatasheets = _useState18[1];
238
+ updatedDescriptions = _useState18[0],
239
+ setUpdatedDescriptions = _useState18[1];
232
240
 
233
- var _useState19 = (0, _react.useState)([]),
241
+ var _useState19 = (0, _react.useState)(false),
234
242
  _useState20 = (0, _slicedToArray2.default)(_useState19, 2),
235
- updatedDescriptions = _useState20[0],
236
- setUpdatedDescriptions = _useState20[1];
243
+ imagesUploaded = _useState20[0],
244
+ setImagesUploaded = _useState20[1];
237
245
 
238
- var _useState21 = (0, _react.useState)(false),
246
+ var _useState21 = (0, _react.useState)(),
239
247
  _useState22 = (0, _slicedToArray2.default)(_useState21, 2),
240
- imagesUploaded = _useState22[0],
241
- setImagesUploaded = _useState22[1];
242
-
243
- var _useState23 = (0, _react.useState)(),
244
- _useState24 = (0, _slicedToArray2.default)(_useState23, 2),
245
- dataImages = _useState24[0],
246
- setDataImages = _useState24[1];
248
+ dataImages = _useState22[0],
249
+ setDataImages = _useState22[1];
247
250
 
248
- var _useState25 = (0, _react.useState)(new Array(productSelected.retailers.length).fill({
251
+ var _useState23 = (0, _react.useState)(new Array(product === null || product === void 0 ? void 0 : (_product$retailers = product.retailers) === null || _product$retailers === void 0 ? void 0 : _product$retailers.length).fill({
249
252
  percentage: 0
250
253
  })),
254
+ _useState24 = (0, _slicedToArray2.default)(_useState23, 2),
255
+ percentages = _useState24[0],
256
+ setPercentages = _useState24[1];
257
+
258
+ var _useState25 = (0, _react.useState)(0),
251
259
  _useState26 = (0, _slicedToArray2.default)(_useState25, 2),
252
- percentages = _useState26[0],
253
- setPercentages = _useState26[1];
260
+ activePercentage = _useState26[0],
261
+ setActivePercentage = _useState26[1];
254
262
 
255
- var _useState27 = (0, _react.useState)(0),
263
+ var _useState27 = (0, _react.useState)({}),
256
264
  _useState28 = (0, _slicedToArray2.default)(_useState27, 2),
257
- activePercentage = _useState28[0],
258
- setActivePercentage = _useState28[1];
265
+ activeRetailer = _useState28[0],
266
+ setActiveRetailer = _useState28[1];
259
267
 
260
- var _useState29 = (0, _react.useState)({}),
268
+ var _useState29 = (0, _react.useState)([]),
261
269
  _useState30 = (0, _slicedToArray2.default)(_useState29, 2),
262
- activeRetailer = _useState30[0],
263
- setActiveRetailer = _useState30[1];
270
+ services = _useState30[0],
271
+ setServices = _useState30[1];
264
272
 
265
273
  var _useState31 = (0, _react.useState)([]),
266
274
  _useState32 = (0, _slicedToArray2.default)(_useState31, 2),
267
- services = _useState32[0],
268
- setServices = _useState32[1];
275
+ servicesData = _useState32[0],
276
+ setServicesData = _useState32[1];
269
277
 
270
- var _useState33 = (0, _react.useState)([]),
278
+ var _useState33 = (0, _react.useState)(""),
271
279
  _useState34 = (0, _slicedToArray2.default)(_useState33, 2),
272
- servicesData = _useState34[0],
273
- setServicesData = _useState34[1];
280
+ message = _useState34[0],
281
+ setMessage = _useState34[1];
274
282
 
275
- var _useState35 = (0, _react.useState)(""),
283
+ var _useState35 = (0, _react.useState)(JSON.parse(sessionStorage.getItem("productSelected")) ? JSON.parse(sessionStorage.getItem("productSelected")) : productSelected),
276
284
  _useState36 = (0, _slicedToArray2.default)(_useState35, 2),
277
- message = _useState36[0],
278
- setMessage = _useState36[1];
285
+ product = _useState36[0],
286
+ setProduct = _useState36[1];
279
287
 
280
- var _useState37 = (0, _react.useState)({}),
288
+ var _useState37 = (0, _react.useState)(null),
281
289
  _useState38 = (0, _slicedToArray2.default)(_useState37, 2),
282
- product = _useState38[0],
283
- setProduct = _useState38[1];
290
+ icon = _useState38[0],
291
+ setIcon = _useState38[1];
284
292
 
285
- var _useState39 = (0, _react.useState)(null),
293
+ var _useState39 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
286
294
  _useState40 = (0, _slicedToArray2.default)(_useState39, 2),
287
- icon = _useState40[0],
288
- setIcon = _useState40[1];
295
+ version = _useState40[0],
296
+ setVersion = _useState40[1];
289
297
 
290
- var _useState41 = (0, _react.useState)(productSelected === null || productSelected === void 0 ? void 0 : productSelected.version),
298
+ var _useState41 = (0, _react.useState)({}),
291
299
  _useState42 = (0, _slicedToArray2.default)(_useState41, 2),
292
- version = _useState42[0],
293
- setVersion = _useState42[1];
300
+ comments = _useState42[0],
301
+ setComments = _useState42[1];
294
302
 
295
- var _useState43 = (0, _react.useState)({}),
303
+ var _useState43 = (0, _react.useState)(""),
296
304
  _useState44 = (0, _slicedToArray2.default)(_useState43, 2),
297
- comments = _useState44[0],
298
- setComments = _useState44[1];
305
+ comment = _useState44[0],
306
+ setComment = _useState44[1];
299
307
 
300
- var _useState45 = (0, _react.useState)(0),
308
+ var _useState45 = (0, _react.useState)({
309
+ "Ficha técnica": 0,
310
+ Descripción: 0,
311
+ Imágenes: 0
312
+ }),
301
313
  _useState46 = (0, _slicedToArray2.default)(_useState45, 2),
302
314
  requiredNull = _useState46[0],
303
315
  setRequiredNull = _useState46[1];
304
316
 
317
+ var _useState47 = (0, _react.useState)(false),
318
+ _useState48 = (0, _slicedToArray2.default)(_useState47, 2),
319
+ crossComment = _useState48[0],
320
+ setCrossComment = _useState48[1];
321
+
322
+ var _useState49 = (0, _react.useState)([]),
323
+ _useState50 = (0, _slicedToArray2.default)(_useState49, 2),
324
+ userGroups = _useState50[0],
325
+ setUserGroups = _useState50[1];
326
+
327
+ var _useState51 = (0, _react.useState)({}),
328
+ _useState52 = (0, _slicedToArray2.default)(_useState51, 2),
329
+ assig = _useState52[0],
330
+ setAssig = _useState52[1];
331
+
332
+ var _useState53 = (0, _react.useState)([]),
333
+ _useState54 = (0, _slicedToArray2.default)(_useState53, 2),
334
+ selectedImages = _useState54[0],
335
+ setSelectedImages = _useState54[1];
336
+
337
+ var _useState55 = (0, _react.useState)([]),
338
+ _useState56 = (0, _slicedToArray2.default)(_useState55, 2),
339
+ componentsArray = _useState56[0],
340
+ setComponentsArray = _useState56[1];
341
+
342
+ var _useState57 = (0, _react.useState)(false),
343
+ _useState58 = (0, _slicedToArray2.default)(_useState57, 2),
344
+ checkAll = _useState58[0],
345
+ setCheckAll = _useState58[1];
346
+
347
+ var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
348
+
349
+ var _useState59 = (0, _react.useState)(true),
350
+ _useState60 = (0, _slicedToArray2.default)(_useState59, 2),
351
+ loading = _useState60[0],
352
+ setLoading = _useState60[1];
353
+
354
+ var _useState61 = (0, _react.useState)("-"),
355
+ _useState62 = (0, _slicedToArray2.default)(_useState61, 2),
356
+ retailerStatus = _useState62[0],
357
+ setRetailerStatus = _useState62[1];
358
+
359
+ var _useState63 = (0, _react.useState)([]),
360
+ _useState64 = (0, _slicedToArray2.default)(_useState63, 2),
361
+ statusArray = _useState64[0],
362
+ setStatusArray = _useState64[1];
363
+
364
+ var _useState65 = (0, _react.useState)(null),
365
+ _useState66 = (0, _slicedToArray2.default)(_useState65, 2),
366
+ socketType = _useState66[0],
367
+ setSocketType = _useState66[1];
368
+
369
+ var _useState67 = (0, _react.useState)([]),
370
+ _useState68 = (0, _slicedToArray2.default)(_useState67, 2),
371
+ servicesStatus = _useState68[0],
372
+ setServicesStatus = _useState68[1];
373
+
374
+ var _useState69 = (0, _react.useState)(loading),
375
+ _useState70 = (0, _slicedToArray2.default)(_useState69, 2),
376
+ saving = _useState70[0],
377
+ setSaving = _useState70[1];
378
+
379
+ var isAuditor = user.id_role === 6;
380
+ (0, _react.useEffect)(function () {
381
+ checkAll && setSelectedImages(images.values);
382
+ }, [checkAll]);
383
+
305
384
  var loadData = /*#__PURE__*/function () {
306
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
307
- var _services$, _services$$values;
385
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
386
+ var _product$article, _product$article2, _product$article3, _services$, _services$$values, _services;
308
387
 
309
- var services;
310
- return _regenerator.default.wrap(function _callee2$(_context2) {
388
+ return _regenerator.default.wrap(function _callee$(_context) {
311
389
  while (1) {
312
- switch (_context2.prev = _context2.next) {
390
+ switch (_context.prev = _context.next) {
313
391
  case 0:
314
- _context2.next = 2;
315
- return (0, _data.getRetailerServices)(productSelected.article.id_article, parseInt(productSelected.article.id_category), productSelected.version);
392
+ _context.prev = 0;
393
+ _context.next = 3;
394
+ return (0, _data2.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article, product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category), product === null || product === void 0 ? void 0 : product.version);
316
395
 
317
- case 2:
318
- services = _context2.sent;
319
- console.log(services, "parsedResponse"); //Converts the data inside the datasheets object to array
396
+ case 3:
397
+ _services = _context.sent;
398
+ //Converts the data inside the datasheets object to array
399
+ setServices(_services);
400
+ getServices(); //setActiveRetailer(product?.retailers[0]);
320
401
 
321
- setServices(services);
322
- setActiveRetailer(productSelected === null || productSelected === void 0 ? void 0 : productSelected.retailers[0]);
323
402
  setImages({
324
403
  action: "init",
325
- init: services[2]
404
+ init: _services[2]
326
405
  });
327
- if (((_services$ = services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
328
- setProduct(productSelected);
406
+ if (((_services$ = _services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
407
+ (0, _data2.getPercentage)({
408
+ data: [product]
409
+ }).then(function (res) {
410
+ return setPercentages(res);
411
+ });
412
+ setLoading(false);
413
+ _context.next = 15;
414
+ break;
329
415
 
330
- case 9:
416
+ case 12:
417
+ _context.prev = 12;
418
+ _context.t0 = _context["catch"](0);
419
+ console.log(_context.t0);
420
+
421
+ case 15:
331
422
  case "end":
332
- return _context2.stop();
423
+ return _context.stop();
333
424
  }
334
425
  }
335
- }, _callee2);
426
+ }, _callee, null, [[0, 12]]);
336
427
  }));
337
428
 
338
429
  return function loadData() {
339
- return _ref3.apply(this, arguments);
430
+ return _ref2.apply(this, arguments);
340
431
  };
341
432
  }();
342
433
 
343
434
  var getServices = /*#__PURE__*/function () {
344
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(tab) {
345
- var serviceActive, selected, servicesResponse, parsedResponse;
346
- return _regenerator.default.wrap(function _callee3$(_context3) {
435
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
436
+ var _product$article4, _product$article5, _servicesResponse$dat;
437
+
438
+ var servicesResponse, parsedResponse, retailers, active;
439
+ return _regenerator.default.wrap(function _callee2$(_context2) {
347
440
  while (1) {
348
- switch (_context3.prev = _context3.next) {
441
+ switch (_context2.prev = _context2.next) {
349
442
  case 0:
350
- serviceActive = "";
351
- _context3.t0 = tab;
352
- _context3.next = _context3.t0 === "Ficha técnica" ? 4 : _context3.t0 === "Imágenes" ? 6 : 8;
353
- break;
354
-
355
- case 4:
356
- serviceActive = "datasheet";
357
- return _context3.abrupt("break", 10);
358
-
359
- case 6:
360
- serviceActive = "images";
361
- return _context3.abrupt("break", 10);
362
-
363
- case 8:
364
- serviceActive = "description";
365
- return _context3.abrupt("break", 10);
366
-
367
- case 10:
368
- selected = productSelected;
369
- _context3.next = 13;
370
- return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(selected.article.id_article, "&orderId=").concat(selected.article.id_order, "&end=true"));
443
+ _context2.next = 2;
444
+ return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article, "&orderId=").concat((product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.id_order) || product.orderId, "&end=true"));
371
445
 
372
- case 13:
373
- servicesResponse = _context3.sent;
374
- parsedResponse = JSON.parse(servicesResponse.data.body).data;
446
+ case 2:
447
+ servicesResponse = _context2.sent;
448
+ parsedResponse = JSON.parse(servicesResponse === null || servicesResponse === void 0 ? void 0 : (_servicesResponse$dat = servicesResponse.data) === null || _servicesResponse$dat === void 0 ? void 0 : _servicesResponse$dat.body).data;
449
+ retailers = product.retailers || product.retailersAvailable;
450
+ active = retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (retailer) {
451
+ return parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
452
+ return srv.id_retailer;
453
+ }).includes(retailer.id);
454
+ })[0];
455
+ !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
375
456
  setServicesData(parsedResponse);
376
457
 
377
- case 16:
458
+ case 8:
378
459
  case "end":
379
- return _context3.stop();
460
+ return _context2.stop();
380
461
  }
381
462
  }
382
- }, _callee3);
463
+ }, _callee2);
383
464
  }));
384
465
 
385
- return function getServices(_x2) {
386
- return _ref4.apply(this, arguments);
466
+ return function getServices() {
467
+ return _ref3.apply(this, arguments);
387
468
  };
388
469
  }();
389
470
 
@@ -391,7 +472,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
391
472
  var translation = "";
392
473
 
393
474
  if (concept === "datasheet") {
394
- translation = "Ficha ténica";
475
+ translation = "Ficha técnica";
395
476
  } else if (concept === "description") {
396
477
  translation = "Descripción";
397
478
  } else if (concept === "images") {
@@ -402,146 +483,253 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
402
483
  };
403
484
 
404
485
  var getComments = /*#__PURE__*/function () {
405
- var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(tab) {
406
- var _productSelected$arti, _productSelected$arti2, _productSelected$arti3;
486
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
487
+ var _product$article6, _product$article7, _product$article8;
407
488
 
408
- var commentsResponse, comments;
409
- return _regenerator.default.wrap(function _callee4$(_context4) {
489
+ var tab,
490
+ commentsResponse,
491
+ comments,
492
+ _args3 = arguments;
493
+ return _regenerator.default.wrap(function _callee3$(_context3) {
410
494
  while (1) {
411
- switch (_context4.prev = _context4.next) {
495
+ switch (_context3.prev = _context3.next) {
412
496
  case 0:
413
- _context4.next = 2;
414
- return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti = productSelected.article) === null || _productSelected$arti === void 0 ? void 0 : _productSelected$arti.id_article, "&concept=description&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti2 = productSelected.article) === null || _productSelected$arti2 === void 0 ? void 0 : _productSelected$arti2.id_article, "&concept=datasheet&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti3 = productSelected.article) === null || _productSelected$arti3 === void 0 ? void 0 : _productSelected$arti3.id_article, "&concept=images&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version))]);
497
+ tab = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : "Descripción";
498
+ _context3.next = 3;
499
+ return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_article, "&concept=description&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.id_article, "&concept=datasheet&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_article, "&concept=images&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version))]);
415
500
 
416
- case 2:
417
- commentsResponse = _context4.sent;
501
+ case 3:
502
+ commentsResponse = _context3.sent;
418
503
  comments = {};
419
- commentsResponse.map(function (comment) {
420
- var _JSON$parse$data$;
504
+ commentsResponse.forEach(function (comment) {
505
+ var _comment$data, _JSON$parse, _JSON$parse$data$, _comment$data2, _comment$data3;
421
506
 
422
- return JSON.parse(comment.data.body).data[0] && (comments[translateConcept((_JSON$parse$data$ = JSON.parse(comment.data.body).data[0]) === null || _JSON$parse$data$ === void 0 ? void 0 : _JSON$parse$data$.concept)] = JSON.parse(comment.data.body).data[0]);
507
+ return JSON.parse(comment === null || comment === void 0 ? void 0 : (_comment$data = comment.data) === null || _comment$data === void 0 ? void 0 : _comment$data.body).data[0] && (comments[translateConcept((_JSON$parse = JSON.parse(comment === null || comment === void 0 ? void 0 : (_comment$data2 = comment.data) === null || _comment$data2 === void 0 ? void 0 : _comment$data2.body)) === null || _JSON$parse === void 0 ? void 0 : (_JSON$parse$data$ = _JSON$parse.data[0]) === null || _JSON$parse$data$ === void 0 ? void 0 : _JSON$parse$data$.concept)] = JSON.parse(comment === null || comment === void 0 ? void 0 : (_comment$data3 = comment.data) === null || _comment$data3 === void 0 ? void 0 : _comment$data3.body).data[0]);
423
508
  });
424
- setComments(comments); //const comment = JSON.parse(commentsResponse.data.body).data;
425
- //setComment(comment[0]);
509
+ setComment(comments[tab]);
510
+ setComments(comments);
426
511
 
427
- case 6:
512
+ case 8:
428
513
  case "end":
429
- return _context4.stop();
514
+ return _context3.stop();
430
515
  }
431
516
  }
432
- }, _callee4);
517
+ }, _callee3);
433
518
  }));
434
519
 
435
- return function getComments(_x3) {
436
- return _ref5.apply(this, arguments);
520
+ return function getComments() {
521
+ return _ref4.apply(this, arguments);
437
522
  };
438
523
  }();
439
524
 
440
- (0, _react.useEffect)(function () {
441
- loadData();
442
- (0, _data.getPercentage)({
443
- data: [productSelected]
444
- }).then(function (res) {
445
- return setPercentages(res);
525
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
526
+ var arr;
527
+ return _regenerator.default.wrap(function _callee4$(_context4) {
528
+ while (1) {
529
+ switch (_context4.prev = _context4.next) {
530
+ case 0:
531
+ loadData();
532
+ getComments();
533
+ _context4.t0 = setUserGroups;
534
+ _context4.next = 5;
535
+ return (0, _data2.fetchUsers)(token);
536
+
537
+ case 5:
538
+ _context4.t1 = _context4.sent;
539
+ (0, _context4.t0)(_context4.t1);
540
+ arr = [];
541
+ _context4.t2 = user.id_role;
542
+ _context4.next = _context4.t2 === 7 ? 11 : _context4.t2 === 8 ? 11 : _context4.t2 === 4 ? 13 : _context4.t2 === 5 ? 13 : _context4.t2 === 6 ? 15 : 17;
543
+ break;
544
+
545
+ case 11:
546
+ arr = ["IN_PROGRESS", "RF", "RA"];
547
+ return _context4.abrupt("break", 19);
548
+
549
+ case 13:
550
+ arr = ["RF", "AF", "AA", "AP", "AC"];
551
+ return _context4.abrupt("break", 19);
552
+
553
+ case 15:
554
+ arr = ["RP", "RC", "AF", "RA"];
555
+ return _context4.abrupt("break", 19);
556
+
557
+ case 17:
558
+ arr = [];
559
+ return _context4.abrupt("break", 19);
560
+
561
+ case 19:
562
+ setStatusArray(arr);
563
+
564
+ case 20:
565
+ case "end":
566
+ return _context4.stop();
567
+ }
568
+ }
569
+ }, _callee4);
570
+ })), [product]);
571
+
572
+ var loadAssignations = function loadAssignations(currentProduct) {
573
+ var _currentProduct$artic, _currentProduct$artic2, _currentProduct$artic3, _currentProduct$artic4, _currentProduct$artic5, _currentProduct$artic6;
574
+
575
+ setAssig({
576
+ Descripción: {
577
+ assignations: [{
578
+ collaboratorType: "especialist",
579
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic = currentProduct.article) === null || _currentProduct$artic === void 0 ? void 0 : _currentProduct$artic.id_description_especialist
580
+ }, {
581
+ collaboratorType: "facilitator",
582
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic2 = currentProduct.article) === null || _currentProduct$artic2 === void 0 ? void 0 : _currentProduct$artic2.id_description_facilitator
583
+ }],
584
+ collaborators: {
585
+ especialist: userGroups[0] || [],
586
+ facilitator: userGroups[2] || []
587
+ }
588
+ },
589
+ "Ficha técnica": {
590
+ assignations: [{
591
+ collaboratorType: "especialist",
592
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic3 = currentProduct.article) === null || _currentProduct$artic3 === void 0 ? void 0 : _currentProduct$artic3.id_datasheet_especialist
593
+ }, {
594
+ collaboratorType: "facilitator",
595
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic4 = currentProduct.article) === null || _currentProduct$artic4 === void 0 ? void 0 : _currentProduct$artic4.id_datasheet_facilitator
596
+ }],
597
+ collaborators: {
598
+ especialist: userGroups[0] || [],
599
+ facilitator: userGroups[2] || []
600
+ }
601
+ },
602
+ Imágenes: {
603
+ assignations: [{
604
+ collaboratorType: "especialist",
605
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic5 = currentProduct.article) === null || _currentProduct$artic5 === void 0 ? void 0 : _currentProduct$artic5.id_images_especialist
606
+ }, {
607
+ collaboratorType: "facilitator",
608
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic6 = currentProduct.article) === null || _currentProduct$artic6 === void 0 ? void 0 : _currentProduct$artic6.id_images_facilitator
609
+ }],
610
+ collaborators: {
611
+ especialist: userGroups[1] || [],
612
+ facilitator: userGroups[3] || []
613
+ }
614
+ }
446
615
  });
447
- getServices();
448
- getComments();
449
- }, []);
616
+ };
617
+
618
+ (0, _react.useEffect)(function () {
619
+ loadAssignations(product);
620
+ }, [userGroups]);
450
621
  (0, _react.useEffect)(function () {
451
- var _productSelected$reta;
622
+ var _product$retailers2, _product$retailers$;
452
623
 
453
- productSelected.retailers.forEach(function (retailer) {
624
+ product === null || product === void 0 ? void 0 : (_product$retailers2 = product.retailers) === null || _product$retailers2 === void 0 ? void 0 : _product$retailers2.forEach(function (retailer) {
454
625
  var _percentages$filter$;
455
626
 
456
- retailer["percentage"] = (_percentages$filter$ = percentages.filter(function (percent) {
457
- return retailer.id === percent.id_retailer;
627
+ retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
628
+ return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
458
629
  })[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
459
630
  });
460
- setActivePercentage(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$reta = productSelected.retailers[0]) === null || _productSelected$reta === void 0 ? void 0 : _productSelected$reta.percentage);
631
+ setActivePercentage(product === null || product === void 0 ? void 0 : (_product$retailers$ = product.retailers[0]) === null || _product$retailers$ === void 0 ? void 0 : _product$retailers$.percentage);
461
632
  }, [percentages]);
462
633
  (0, _react.useEffect)(function () {
463
634
  if (services.length > 0) {
464
- services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id].data = Object.values(services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id].data);
465
- setActivePercentage(Math.round(activeRetailer.percentage, 0));
466
- setDatasheets([services[0][activeRetailer.id], services[0].inputs]);
467
- setDescriptions(services[1].filter(function (service) {
468
- return service.id === activeRetailer.id;
469
- }));
635
+ var _services$0$activeRet, _services$2, _services$3;
636
+
637
+ if ((_services$0$activeRet = services[0][activeRetailer.id]) !== null && _services$0$activeRet !== void 0 && _services$0$activeRet.data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
638
+ setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
639
+ var datagroups = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id];
640
+ var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
641
+
642
+ var _descriptions = (_services$3 = services[1]) === null || _services$3 === void 0 ? void 0 : _services$3.filter(function (service) {
643
+ return (service === null || service === void 0 ? void 0 : service.id) === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
644
+ });
645
+
646
+ setDatasheets([datagroups, inputs]);
647
+ setDescriptions(_descriptions);
470
648
  }
471
- }, [activeRetailer]);
649
+ }, [activeRetailer, services]);
472
650
 
473
651
  var thumbs = function thumbs() {
474
- var _images$values;
652
+ var _images$imageType, _images$imagePackagin, _images$values;
475
653
 
476
- var imageInputs = images.inputs.map(function (e) {
477
- return {
478
- value: e.id,
479
- name: e.name
480
- };
481
- });
482
- var imageType = images.imageType.map(function (e) {
654
+ var imageInputs = socketType === null || socketType === void 0 ? void 0 : socketType.slice();
655
+ var imageType = images === null || images === void 0 ? void 0 : (_images$imageType = images.imageType) === null || _images$imageType === void 0 ? void 0 : _images$imageType.map(function (e) {
483
656
  return {
484
- value: e.id,
485
- name: e.name
657
+ value: e === null || e === void 0 ? void 0 : e.id,
658
+ name: e === null || e === void 0 ? void 0 : e.name
486
659
  };
487
660
  });
488
- var imagePackagingType = images.imagePackagingType.map(function (e) {
661
+ var imagePackagingType = images === null || images === void 0 ? void 0 : (_images$imagePackagin = images.imagePackagingType) === null || _images$imagePackagin === void 0 ? void 0 : _images$imagePackagin.map(function (e) {
489
662
  return {
490
- value: e.id,
491
- name: e.name
663
+ value: e === null || e === void 0 ? void 0 : e.id,
664
+ name: e === null || e === void 0 ? void 0 : e.name
492
665
  };
493
666
  });
494
667
  return images === null || images === void 0 ? void 0 : (_images$values = images.values) === null || _images$values === void 0 ? void 0 : _images$values.map(function (image, index) {
495
- return /*#__PURE__*/React.createElement(_GalleryElement.GalleryElement, {
496
- key: index,
668
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryElement.GalleryElement, {
669
+ setCheckAll: setCheckAll,
497
670
  image: image,
498
671
  gridLayout: imageLayout,
499
672
  id: "gallery-element-" + index,
500
- index: index,
673
+ index: index + "-" + image.name,
674
+ number: index,
501
675
  imageType: imageType,
502
676
  imagePackagingType: imagePackagingType,
503
677
  imageInputs: imageInputs,
504
- changeImage: setImages
505
- });
678
+ setSocketType: setSocketType,
679
+ changeImage: setImages,
680
+ selectedImages: selectedImages,
681
+ setSelectedImages: setSelectedImages
682
+ }, index);
506
683
  });
507
684
  };
508
685
 
509
686
  var saveDescriptions = /*#__PURE__*/function () {
510
687
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
511
- var _productSelected$arti4;
688
+ var _product$article9;
512
689
 
513
- var dataObject;
690
+ var productTemp, dataObject;
514
691
  return _regenerator.default.wrap(function _callee5$(_context5) {
515
692
  while (1) {
516
693
  switch (_context5.prev = _context5.next) {
517
694
  case 0:
695
+ setLoading(true);
696
+ productTemp = product;
518
697
  dataObject = {
519
- articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti4 = productSelected.article) === null || _productSelected$arti4 === void 0 ? void 0 : _productSelected$arti4.id_article,
698
+ articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
520
699
  articleData: updatedDescriptions
521
700
  };
522
- _context5.prev = 1;
523
- _context5.next = 4;
701
+ if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
702
+ _context5.prev = 4;
703
+ _context5.next = 7;
524
704
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
525
705
  headers: {
526
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
706
+ Authorization: token
527
707
  }
528
708
  });
529
709
 
530
- case 4:
531
- _context5.next = 9;
710
+ case 7:
711
+ if (productTemp.status === "ASSIGNED") {
712
+ productTemp.status = "IN_PROGRESS";
713
+ setProduct(productTemp);
714
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
715
+ }
716
+
717
+ setMessage("Descripciones guardadas con éxito");
718
+ loadData();
719
+ _context5.next = 15;
532
720
  break;
533
721
 
534
- case 6:
535
- _context5.prev = 6;
536
- _context5.t0 = _context5["catch"](1);
722
+ case 12:
723
+ _context5.prev = 12;
724
+ _context5.t0 = _context5["catch"](4);
537
725
  console.log(_context5.t0);
538
726
 
539
- case 9:
727
+ case 15:
540
728
  case "end":
541
729
  return _context5.stop();
542
730
  }
543
731
  }
544
- }, _callee5, null, [[1, 6]]);
732
+ }, _callee5, null, [[4, 12]]);
545
733
  }));
546
734
 
547
735
  return function saveDescriptions() {
@@ -551,41 +739,52 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
551
739
 
552
740
  var saveDatasheets = /*#__PURE__*/function () {
553
741
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
554
- var _productSelected$arti5;
742
+ var _product$article10;
555
743
 
556
- var dataObject;
744
+ var productTemp, dataObject;
557
745
  return _regenerator.default.wrap(function _callee6$(_context6) {
558
746
  while (1) {
559
747
  switch (_context6.prev = _context6.next) {
560
748
  case 0:
749
+ setLoading(true);
750
+ productTemp = product;
561
751
  dataObject = {
562
- articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti5 = productSelected.article) === null || _productSelected$arti5 === void 0 ? void 0 : _productSelected$arti5.id_article,
752
+ articleId: product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article,
563
753
  articleData: updatedDatasheets
564
754
  };
565
- _context6.prev = 1;
566
- _context6.next = 4;
755
+ if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
756
+ _context6.prev = 4;
757
+ _context6.next = 7;
567
758
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
568
759
  headers: {
569
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
760
+ Authorization: token
570
761
  }
571
762
  });
572
763
 
573
- case 4:
574
- console.log("saved");
575
- _context6.next = 10;
764
+ case 7:
765
+ setMessage("Fichas técnicas guardadas");
766
+
767
+ if (productTemp.status === "ASSIGNED") {
768
+ productTemp.status = "IN_PROGRESS";
769
+ setProduct(productTemp);
770
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
771
+ }
772
+
773
+ loadData();
774
+ _context6.next = 15;
576
775
  break;
577
776
 
578
- case 7:
579
- _context6.prev = 7;
580
- _context6.t0 = _context6["catch"](1);
777
+ case 12:
778
+ _context6.prev = 12;
779
+ _context6.t0 = _context6["catch"](4);
581
780
  console.log(_context6.t0);
582
781
 
583
- case 10:
782
+ case 15:
584
783
  case "end":
585
784
  return _context6.stop();
586
785
  }
587
786
  }
588
- }, _callee6, null, [[1, 7]]);
787
+ }, _callee6, null, [[4, 12]]);
589
788
  }));
590
789
 
591
790
  return function saveDatasheets() {
@@ -593,50 +792,69 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
593
792
  };
594
793
  }();
595
794
 
795
+ (0, _react.useEffect)(function () {
796
+ var _images$inputs;
797
+
798
+ var imageInputs = images === null || images === void 0 ? void 0 : (_images$inputs = images.inputs) === null || _images$inputs === void 0 ? void 0 : _images$inputs.map(function (e) {
799
+ return {
800
+ value: e === null || e === void 0 ? void 0 : e.id,
801
+ name: e === null || e === void 0 ? void 0 : e.name,
802
+ required: e === null || e === void 0 ? void 0 : e.required,
803
+ active: images === null || images === void 0 ? void 0 : images.values.some(function (value) {
804
+ return (value === null || value === void 0 ? void 0 : value.image_id) === (e === null || e === void 0 ? void 0 : e.id);
805
+ })
806
+ };
807
+ });
808
+ setSocketType(imageInputs);
809
+ }, [images]);
596
810
  var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
597
- var _images$values2;
811
+ var _images$values2, _product$article11, _data$articleData, _data$articleData2, _data$updateImages;
812
+
813
+ var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray, productTemp;
598
814
 
599
- var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, promiseArray;
600
815
  return _regenerator.default.wrap(function _callee7$(_context7) {
601
816
  while (1) {
602
817
  switch (_context7.prev = _context7.next) {
603
818
  case 0:
604
819
  imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
605
- imagesListTemp = imagesList.reduce(function (acc, image) {
606
- acc[image.image_id] = ++acc[image.image_id] || 0;
820
+ imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
821
+ acc[image === null || image === void 0 ? void 0 : image.image_id] = ++acc[image === null || image === void 0 ? void 0 : image.image_id] || 0;
607
822
  return acc;
608
823
  }, {});
609
- duplicated = imagesList.filter(function (image) {
610
- return imagesListTemp[image.image_id];
824
+ duplicated = imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (image) {
825
+ return imagesListTemp[image === null || image === void 0 ? void 0 : image.image_id];
611
826
  });
612
827
  attrForImgs = Object.values(images === null || images === void 0 ? void 0 : images.attrForImgs);
613
828
  attrForImgs.pop();
614
829
  data = {
615
- articleId: articleId,
616
- attrReqImgs: attrForImgs.map(function (e) {
830
+ articleId: product === null || product === void 0 ? void 0 : (_product$article11 = product.article) === null || _product$article11 === void 0 ? void 0 : _product$article11.id_article,
831
+ attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
832
+ var _e$, _e$2;
833
+
617
834
  return {
618
- attrId: e[0].id,
619
- value: e[0].value
835
+ attrId: (_e$ = e[0]) === null || _e$ === void 0 ? void 0 : _e$.id,
836
+ value: (_e$2 = e[0]) === null || _e$2 === void 0 ? void 0 : _e$2.value
620
837
  };
621
838
  }),
622
- articleData: imagesList.filter(function (e) {
839
+ articleData: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
623
840
  return !e.id;
624
841
  }),
625
- updateImages: imagesList.filter(function (e) {
842
+ updateImages: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
626
843
  return e.id;
627
844
  })
628
845
  };
629
- valid = data.articleData.length === 0 ? true : data.articleData.every(function (e, i) {
630
- if (e.image_id && e.packing_type && e.image_type) {
846
+ if (product !== null && product !== void 0 && product.orderId) data["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
847
+ valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.length) === 0 ? true : data === null || data === void 0 ? void 0 : (_data$articleData2 = data.articleData) === null || _data$articleData2 === void 0 ? void 0 : _data$articleData2.every(function (e, i) {
848
+ if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
631
849
  return true;
632
850
  }
633
851
 
634
852
  return false;
635
853
  });
636
854
 
637
- if (valid && data.updateImages.length > 0 && duplicated.length === 0) {
638
- valid = data.updateImages.every(function (e, i) {
639
- if (e.image_id && e.packing_type && e.image_type) {
855
+ if (valid && (data === null || data === void 0 ? void 0 : (_data$updateImages = data.updateImages) === null || _data$updateImages === void 0 ? void 0 : _data$updateImages.length) > 0 && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0) {
856
+ valid = data === null || data === void 0 ? void 0 : (_data$updateImages2 = data.updateImages) === null || _data$updateImages2 === void 0 ? void 0 : _data$updateImages2.every(function (e, i) {
857
+ if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
640
858
  return true;
641
859
  }
642
860
 
@@ -644,75 +862,77 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
644
862
  });
645
863
  }
646
864
 
647
- if (!(valid && duplicated.length === 0)) {
648
- _context7.next = 29;
865
+ if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
866
+ _context7.next = 33;
649
867
  break;
650
868
  }
651
869
 
652
- _context7.prev = 9;
653
- data.articleData.forEach(function (e) {
870
+ setLoading(true);
871
+ _context7.prev = 11;
872
+ data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
654
873
  e.uuid = (0, _uuid.v4)();
655
874
  });
656
875
  setDataImages(data);
657
876
 
658
- if (!(data.articleData.length > 0)) {
659
- _context7.next = 21;
877
+ if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
878
+ _context7.next = 23;
660
879
  break;
661
880
  }
662
881
 
663
882
  setImagesUploaded(false);
664
883
  promiseArray = [];
665
- data.articleData.forEach(function (e) {
884
+ data === null || data === void 0 ? void 0 : (_data$articleData5 = data.articleData) === null || _data$articleData5 === void 0 ? void 0 : _data$articleData5.forEach(function (e) {
666
885
  var file = Buffer.from(e.src.replace(/^data:image\/\w+;base64,/, ""), "base64");
667
886
  var params = {
668
887
  ACL: "public-read",
669
888
  Body: file,
670
889
  Bucket: S3_BUCKET,
671
- Key: "id-".concat(data.articleId, "/").concat(version, "/").concat(e.image_id, "-").concat(e.uuid, ".").concat(e.ext)
890
+ Key: "id-".concat(data.articleId, "/").concat(version, "/").concat(e === null || e === void 0 ? void 0 : e.image_id, "-").concat(e === null || e === void 0 ? void 0 : e.uuid, ".").concat(e === null || e === void 0 ? void 0 : e.ext)
672
891
  };
673
892
  promiseArray.push(myBucket.putObject(params).promise());
674
893
  });
675
- _context7.next = 18;
894
+ _context7.next = 20;
676
895
  return Promise.all(promiseArray);
677
896
 
678
- case 18:
897
+ case 20:
679
898
  setImagesUploaded(true);
680
- _context7.next = 22;
899
+ _context7.next = 24;
681
900
  break;
682
901
 
683
- case 21:
902
+ case 23:
684
903
  setImagesUploaded(true);
685
904
 
686
- case 22:
687
- _context7.next = 27;
905
+ case 24:
906
+ productTemp = product;
907
+
908
+ if (productTemp.status === "ASSIGNED") {
909
+ productTemp.status = "IN_PROGRESS";
910
+ setProduct(productTemp);
911
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
912
+ }
913
+
914
+ _context7.next = 31;
688
915
  break;
689
916
 
690
- case 24:
691
- _context7.prev = 24;
692
- _context7.t0 = _context7["catch"](9);
917
+ case 28:
918
+ _context7.prev = 28;
919
+ _context7.t0 = _context7["catch"](11);
693
920
  console.log(_context7.t0); // setMainLoading(false);
694
921
 
695
- case 27:
696
- _context7.next = 30;
922
+ case 31:
923
+ _context7.next = 34;
697
924
  break;
698
925
 
699
- case 29:
926
+ case 33:
700
927
  // setMainLoading(false);
701
- console.log("Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.", "Recuerda hay campos obligatorios y no podras avanzar si no estan completos."); // setAlertList((prev) => [
702
- // ...prev,
703
- // {
704
- // titleMsg: "Completa los campos que solicita cada una de la imágenes",
705
- // alertMsg:
706
- // "Recuerda hay campos obligatorios y no podras avanzar si no estan completos.",
707
- // },
708
- // ]);
709
-
710
- case 30:
928
+ setMessage("Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.\nRecuerda hay campos obligatorios y no podras avanzar si no estan completos.");
929
+
930
+ case 34:
711
931
  case "end":
712
932
  return _context7.stop();
713
933
  }
714
934
  }
715
- }, _callee7, null, [[9, 24]]);
935
+ }, _callee7, null, [[11, 28]]);
716
936
  })), [images, imagesUploaded]);
717
937
  (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
718
938
  return _regenerator.default.wrap(function _callee8$(_context8) {
@@ -720,65 +940,110 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
720
940
  switch (_context8.prev = _context8.next) {
721
941
  case 0:
722
942
  if (!imagesUploaded) {
723
- _context8.next = 11;
943
+ _context8.next = 13;
724
944
  break;
725
945
  }
726
946
 
727
- dataImages.articleData = dataImages.articleData.map(function (e) {
947
+ dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
728
948
  delete e.src;
729
949
  e.imageID = e.image_id;
730
950
  e.packingType = e.packing_type;
731
951
  e.imageType = e.image_type;
952
+ if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
732
953
  return e;
733
954
  });
734
955
  _context8.prev = 2;
735
956
  _context8.next = 5;
736
957
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
737
958
  headers: {
738
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
959
+ Authorization: token
739
960
  }
740
961
  });
741
962
 
742
963
  case 5:
743
- console.log("imágenes guardadas con éxito");
744
- _context8.next = 11;
964
+ setMessage("Imágenes guardadas con éxito");
965
+ sessionStorage.removeItem("imagesList");
966
+ loadData();
967
+ _context8.next = 13;
745
968
  break;
746
969
 
747
- case 8:
748
- _context8.prev = 8;
970
+ case 10:
971
+ _context8.prev = 10;
749
972
  _context8.t0 = _context8["catch"](2);
750
973
  console.log(_context8.t0);
751
974
 
752
- case 11:
975
+ case 13:
753
976
  case "end":
754
977
  return _context8.stop();
755
978
  }
756
979
  }
757
- }, _callee8, null, [[2, 8]]);
980
+ }, _callee8, null, [[2, 10]]);
758
981
  })), [dataImages, imagesUploaded]);
759
982
 
760
- var approveRejectButtons = function approveRejectButtons(action) {
761
- var concept = "";
983
+ var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
984
+ var srv = servicesData.filter(function (serv) {
985
+ return serv.service === getConcept(tab);
986
+ });
762
987
 
763
- switch (activeTab) {
764
- case "Descripción":
765
- concept = "description";
988
+ var _srv$filter = srv.filter(function (serv) {
989
+ return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
990
+ }),
991
+ _srv$filter2 = (0, _slicedToArray2.default)(_srv$filter, 1),
992
+ srvActive = _srv$filter2[0];
993
+
994
+ var unvalidated = product["".concat(getConcept(tab), "_status")] === "QF" || product["".concat(getConcept(tab), "_status")] === "IN_PROGRESS";
995
+ var auditorUnvalidated = !["RA", "AA", "AC", "AP"].includes(product["".concat(getConcept(tab), "_status")]);
996
+
997
+ switch (userId) {
998
+ case 7:
999
+ case 8:
1000
+ return ["RA", "RF"].includes(product === null || product === void 0 ? void 0 : product.status) && //"IN_PROGRESS", "RF", "RA"
1001
+ statusArray.includes(srvActive === null || srvActive === void 0 ? void 0 : srvActive.status) || statusArray.includes(product.status) && srv.filter(function (serv) {
1002
+ return statusArray.includes(serv.status);
1003
+ }).length === srv.length;
1004
+
1005
+ case 4:
1006
+ case 5:
1007
+ return unvalidated && ["IN_PROGRESS", "QF"].includes(product.status) && //"RF", "AF", "AA", "AP", "AC
1008
+ srv.filter(function (serv) {
1009
+ return statusArray.includes(serv.status);
1010
+ }).length === srv.length;
1011
+
1012
+ case 6:
1013
+ return statusArray.includes(product.status) && //RP, RC, AF, RA true
1014
+ srv.every(function (serv) {
1015
+ return ["RA", "AA", "AP", "AC"].includes(serv.status);
1016
+ }) && auditorUnvalidated;
1017
+
1018
+ default:
766
1019
  break;
1020
+ }
1021
+ };
1022
+
1023
+ var getConcept = function getConcept(tab) {
1024
+ switch (tab) {
1025
+ case "Descripción":
1026
+ return "description";
767
1027
 
768
1028
  case "Ficha técnica":
769
- concept = "datasheet";
770
- break;
1029
+ return "datasheet";
771
1030
 
772
1031
  case "Imágenes":
773
- concept = "images";
774
- break;
775
-
776
- default:
777
- break;
1032
+ return "images";
778
1033
  }
1034
+ };
1035
+
1036
+ var approveRejectButtons = function approveRejectButtons(action) {
1037
+ var concept = getConcept(action || activeTab);
1038
+
1039
+ var _servicesData$filter = servicesData.filter(function (srv) {
1040
+ return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
1041
+ }),
1042
+ _servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
1043
+ retailerStatus = _servicesData$filter2[0];
779
1044
 
780
- concept = action ? action : concept;
781
- return productSelected["".concat(concept, "_status")] === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || productSelected["".concat(concept, "_status")] === "AF" && (user.id_role === 1 || user.id_role === 6) || productSelected["".concat(concept, "_status")] === "RP" && (user.id_role === 1 || user.id_role === 6);
1045
+ return (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "AF" && ( //sessionStorage product
1046
+ user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RP" && (user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RC" && (user.id_role === 1 || user.id_role === 6);
782
1047
  };
783
1048
 
784
1049
  var getSectionIcon = function getSectionIcon() {
@@ -800,369 +1065,809 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
800
1065
  }
801
1066
  };
802
1067
 
803
- var updateCompaniesList = function updateCompaniesList(status, result, retailerId, concept) {
804
- var serv = servicesData.slice();
805
- var item = serv.find(function (item) {
806
- return item.id_retailer === retailerId && item.service === concept;
807
- });
808
- var index = serv.indexOf(item);
809
-
810
- if (status === "IN_PROGRESS" || status === "QF" || status === "RF" || status === "RA") {
811
- if (result === "A") {
812
- if (activeTab === "Imágenes") {
813
- serv.map(function (item) {
814
- item.status = "AF";
815
- });
816
- } else {
817
- serv[index].status = "AF";
818
- }
819
- } else if (result === "R") {
820
- if (activeTab === "Imágenes") {
821
- serv.map(function (item) {
822
- item.status = "RF";
823
- });
824
- } else {
825
- serv[index].status = "RF";
826
- }
827
- } else {
828
- if (status === "IN_PROGRESS" || status === "ASSIGNED") {
829
- serv.map(function (item) {
830
- item.status = "QF";
831
- });
832
- } else {
833
- serv.map(function (item) {
834
- if (item.status === "RF" || item.status === "RA") {
835
- item.status = "QF";
836
- }
837
-
838
- return item;
839
- });
840
- }
841
- }
842
- } else if (status === "AF" || status === "RP") {
843
- if (result === "A") {
844
- if (activeTab === "Imágenes") {
845
- serv.map(function (item) {
846
- item.status = "AA";
847
- });
848
- } else {
849
- serv[index].status = "AA";
850
- }
851
- } else {
852
- if (activeTab === "Imágenes") {
853
- serv.map(function (item) {
854
- item.status = "RA";
855
- });
856
- } else {
857
- serv[index].status = "RA";
858
- }
859
- }
860
- } //console.log(serv, "serv");
861
-
862
-
863
- setServicesData(serv);
864
- };
865
-
866
1068
  var sendToFacilitator = /*#__PURE__*/function () {
867
1069
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
868
- var concept, evalStatus, productTemp, specialistDone, data;
1070
+ var concept, productTemp, evalStatus, data, specialistDone, statusArr, newStatus;
869
1071
  return _regenerator.default.wrap(function _callee9$(_context9) {
870
1072
  while (1) {
871
1073
  switch (_context9.prev = _context9.next) {
872
1074
  case 0:
873
- console.log("exce");
874
- concept = "";
875
- _context9.t0 = activeTab;
876
- _context9.next = _context9.t0 === "Descripción" ? 5 : _context9.t0 === "Ficha técnica" ? 7 : _context9.t0 === "Imágenes" ? 9 : 11;
877
- break;
878
-
879
- case 5:
880
- concept = "description";
881
- return _context9.abrupt("break", 12);
882
-
883
- case 7:
884
- concept = "datasheet";
885
- return _context9.abrupt("break", 12);
886
-
887
- case 9:
888
- concept = "images";
889
- return _context9.abrupt("break", 12);
890
-
891
- case 11:
892
- return _context9.abrupt("break", 12);
893
-
894
- case 12:
895
- evalStatus = "";
896
- productTemp = (0, _objectSpread2.default)({}, productSelected);
897
- evalStatus = productSelected["".concat(concept, "_status")];
898
- specialistDone = evalStatus === "RF" || evalStatus === "RA" || evalStatus === "IN_PROGRESS";
899
-
900
- if (specialistDone) {
901
- setMessage("".concat(activeTab, " enviada a facilitador"));
902
- getSectionIcon();
903
- productTemp["".concat(concept, "_status")] = "QF";
904
- } else if (evalStatus === "QF") {
905
- setMessage("Evaluación enviada");
906
- getSectionIcon();
907
- productTemp["".concat(concept, "_status")] = "AF";
908
- } else if (evalStatus === "AF") {
909
- setMessage("Evaluación enviada");
910
- getSectionIcon();
911
- productTemp["".concat(concept, "_status")] = "AA";
912
- } else if (evalStatus === "RP") {
913
- setMessage("Evaluación enviada");
914
- getSectionIcon();
915
- productTemp["".concat(concept, "_status")] = "AA";
916
- }
917
-
1075
+ setLoading(true);
1076
+ _context9.prev = 1;
1077
+ concept = getConcept(activeTab);
1078
+ productTemp = (0, _objectSpread2.default)({}, product);
1079
+ evalStatus = product["".concat(concept, "_status")];
918
1080
  data = {};
919
1081
 
920
1082
  if (!result) {
921
- _context9.next = 25;
1083
+ _context9.next = 13;
922
1084
  break;
923
1085
  }
924
1086
 
925
- updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
926
1087
  data = {
927
- articleId: productSelected.article.id_article,
928
- orderId: productSelected.orderId,
1088
+ articleId: product.article.id_article,
1089
+ orderId: product.orderId,
929
1090
  concept: concept,
930
1091
  result: result,
931
1092
  evalStatus: evalStatus,
932
1093
  retailerId: activeRetailer.id
933
1094
  };
934
- _context9.next = 23;
1095
+ _context9.next = 10;
935
1096
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
936
1097
  headers: {
937
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
1098
+ Authorization: token
938
1099
  }
939
1100
  });
940
1101
 
941
- case 23:
942
- _context9.next = 38;
1102
+ case 10:
1103
+ getServices();
1104
+ _context9.next = 31;
943
1105
  break;
944
1106
 
945
- case 25:
1107
+ case 13:
1108
+ specialistDone = evalStatus === "RF" || evalStatus === "RA" || evalStatus === "IN_PROGRESS";
1109
+
946
1110
  if (specialistDone) {
947
- updateCompaniesList(evalStatus, result, activeRetailer.id);
1111
+ setMessage("".concat(activeTab, " enviada a facilitador"));
1112
+ getSectionIcon();
1113
+ } else if (evalStatus === "QF") {
1114
+ setMessage("Evaluación enviada");
1115
+ getSectionIcon();
1116
+ } else if (evalStatus === "AF") {
1117
+ setMessage("Evaluación enviada");
1118
+ getSectionIcon();
1119
+ } else if (evalStatus === "RP") {
1120
+ setMessage("Evaluación enviada");
1121
+ getSectionIcon();
1122
+ } else if (evalStatus === "RC") {
1123
+ setMessage("Evaluación enviada");
1124
+ getSectionIcon();
948
1125
  }
949
1126
 
1127
+ statusArr = [];
1128
+ servicesData.forEach(function (srv) {
1129
+ srv.service === concept && statusArr.push(srv.status);
1130
+ });
1131
+ productTemp["".concat(concept, "_status")] = (0, _data2.getNewStatus)(statusArr);
1132
+ newStatus = (0, _data2.getNewStatus)([productTemp.datasheet_status, productTemp.description_status, productTemp.images_status]);
1133
+ productTemp.status = newStatus;
950
1134
  data = {
951
- articleId: productSelected.article.id_article,
952
- orderId: productSelected.orderId,
1135
+ articleId: product.article.id_article,
1136
+ orderId: product.orderId,
953
1137
  concept: concept,
954
1138
  evalStatus: evalStatus,
955
1139
  retailerId: activeRetailer.id
956
1140
  };
957
- _context9.t1 = user.id_role;
958
- _context9.next = _context9.t1 === 7 ? 30 : _context9.t1 === 8 ? 30 : _context9.t1 === 4 ? 32 : _context9.t1 === 5 ? 32 : 34;
1141
+ _context9.t0 = user.id_role;
1142
+ _context9.next = _context9.t0 === 7 ? 24 : _context9.t0 === 8 ? 24 : _context9.t0 === 4 ? 26 : _context9.t0 === 5 ? 26 : 28;
959
1143
  break;
960
1144
 
961
- case 30:
1145
+ case 24:
962
1146
  data.especialist = true;
963
- return _context9.abrupt("break", 35);
1147
+ return _context9.abrupt("break", 29);
964
1148
 
965
- case 32:
1149
+ case 26:
966
1150
  data.facilitator = true;
967
- return _context9.abrupt("break", 35);
1151
+ return _context9.abrupt("break", 29);
968
1152
 
969
- case 34:
970
- return _context9.abrupt("break", 35);
1153
+ case 28:
1154
+ return _context9.abrupt("break", 29);
971
1155
 
972
- case 35:
973
- _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1156
+ case 29:
1157
+ _context9.next = 31;
1158
+ return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
974
1159
  headers: {
975
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
1160
+ Authorization: token
976
1161
  }
977
1162
  });
978
1163
 
1164
+ case 31:
1165
+ loadData();
1166
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
979
1167
  setProduct(productTemp);
980
- setModalSent(true);
1168
+ _context9.next = 39;
1169
+ break;
1170
+
1171
+ case 36:
1172
+ _context9.prev = 36;
1173
+ _context9.t1 = _context9["catch"](1);
1174
+ console.log(_context9.t1);
1175
+
1176
+ case 39:
1177
+ setLoading(false);
981
1178
 
982
- case 38:
1179
+ case 40:
983
1180
  case "end":
984
1181
  return _context9.stop();
985
1182
  }
986
1183
  }
987
- }, _callee9);
1184
+ }, _callee9, null, [[1, 36]]);
988
1185
  }));
989
1186
 
990
- return function sendToFacilitator(_x4) {
1187
+ return function sendToFacilitator(_x) {
991
1188
  return _ref10.apply(this, arguments);
992
1189
  };
993
1190
  }();
994
1191
 
995
1192
  var userAssigned = function userAssigned(tab, rol) {
996
- var concept = "";
997
-
998
- switch (tab) {
999
- case "Ficha técnica":
1000
- concept = "datasheet";
1001
- break;
1002
-
1003
- case "Imágenes":
1004
- concept = "images";
1005
- break;
1006
-
1007
- default:
1008
- concept = "description";
1009
- break;
1193
+ var concept = getConcept(activeTab);
1194
+ var allowedRoles = [1, 4, 5, 6, 7, 8];
1195
+ var validUser = allowedRoles.includes(user === null || user === void 0 ? void 0 : user.id_role);
1196
+
1197
+ if (!rol) {
1198
+ switch (user.id_role) {
1199
+ case 4:
1200
+ case 5:
1201
+ rol = "facilitator";
1202
+ break;
1203
+
1204
+ case 7:
1205
+ case 8:
1206
+ rol = "especialist";
1207
+ break;
1208
+ }
1010
1209
  }
1011
1210
 
1012
- var allowedRoles = [1, 4, 5, 6, 7, 8];
1013
- var validUser = allowedRoles.indexOf(user === null || user === void 0 ? void 0 : user.id_role) !== -1;
1014
- return productSelected.article["id_".concat(concept, "_").concat(rol)] === user.id_user && validUser;
1211
+ return user.id_role === 1 || product.article["id_".concat(concept, "_").concat(rol)] === user.id_user && validUser;
1015
1212
  };
1016
1213
 
1017
1214
  var auditorAssigned = function auditorAssigned() {
1018
- return (productSelected === null || productSelected === void 0 ? void 0 : productSelected.article["id_auditor"]) === user.id_user;
1215
+ return (product === null || product === void 0 ? void 0 : product.article["id_auditor"]) === user.id_user;
1019
1216
  };
1020
1217
 
1021
- function specialistValid(tab) {
1022
- var concept = "";
1218
+ var createComment = /*#__PURE__*/function () {
1219
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e, body, tab) {
1220
+ var _product$article12;
1023
1221
 
1024
- switch (tab) {
1025
- case "Ficha técnica":
1026
- concept = "datasheet";
1027
- break;
1222
+ var concept, data;
1223
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1224
+ while (1) {
1225
+ switch (_context10.prev = _context10.next) {
1226
+ case 0:
1227
+ concept = "";
1228
+ _context10.t0 = activeTab;
1229
+ _context10.next = _context10.t0 === "Ficha técnica" ? 4 : _context10.t0 === "Imágenes" ? 6 : 8;
1230
+ break;
1028
1231
 
1029
- case "Imágenes":
1030
- concept = "images";
1031
- break;
1232
+ case 4:
1233
+ concept = "datasheet";
1234
+ return _context10.abrupt("break", 10);
1032
1235
 
1033
- default:
1034
- concept = "description";
1035
- break;
1036
- }
1236
+ case 6:
1237
+ concept = "images";
1238
+ return _context10.abrupt("break", 10);
1037
1239
 
1038
- return product["".concat(concept, "_status")] === "IN_PROGRESS" || product["".concat(concept, "_status")] === "RF" || product["".concat(concept, "_status")] === "RA";
1039
- }
1240
+ case 8:
1241
+ concept = "description";
1242
+ return _context10.abrupt("break", 10);
1040
1243
 
1041
- function versionMatch() {
1042
- return (productSelected === null || productSelected === void 0 ? void 0 : productSelected.version) === version;
1043
- }
1244
+ case 10:
1245
+ data = {
1246
+ articleId: product === null || product === void 0 ? void 0 : (_product$article12 = product.article) === null || _product$article12 === void 0 ? void 0 : _product$article12.id_article,
1247
+ orderId: product === null || product === void 0 ? void 0 : product.orderId,
1248
+ message: body,
1249
+ concept: concept,
1250
+ version: version
1251
+ };
1252
+ _context10.next = 13;
1253
+ return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1254
+ headers: {
1255
+ Authorization: token
1256
+ }
1257
+ });
1044
1258
 
1045
- (0, _react.useEffect)(function () {// let concept = "";
1046
- // switch (activeTab) {
1047
- // case "Ficha técnica":
1048
- // concept = "datasheet";
1049
- // break;
1050
- // case "Imágenes":
1051
- // concept = "images";
1052
- // break;
1053
- // default:
1054
- // concept = "description";
1055
- // break;
1056
- // }
1057
- // getComments(concept);
1259
+ case 13:
1260
+ _context10.next = 15;
1261
+ return getComments(tab);
1262
+
1263
+ case 15:
1264
+ setMessage("");
1265
+ setComponentsArray([]);
1266
+
1267
+ case 17:
1268
+ case "end":
1269
+ return _context10.stop();
1270
+ }
1271
+ }
1272
+ }, _callee10);
1273
+ }));
1274
+
1275
+ return function createComment(_x2, _x3, _x4) {
1276
+ return _ref11.apply(this, arguments);
1277
+ };
1278
+ }();
1279
+
1280
+ var getRequired = function getRequired(services) {
1281
+ try {
1282
+ var _services$4, _services$4$retailerM, _services$5, _services$5$inputs;
1283
+
1284
+ var objetcTemp = {};
1285
+ var datasheetServicesArray = Object.values(services[0]);
1286
+ var dsInputs = datasheetServicesArray.pop();
1287
+ var descriptionsServicesArray = services[1];
1288
+ var dsInputsRequired = [];
1289
+ var desInputsRequired = 0;
1290
+ datasheetServicesArray === null || datasheetServicesArray === void 0 ? void 0 : datasheetServicesArray.forEach(function (datasheet) {
1291
+ var _servicesData$filter3 = servicesData === null || servicesData === void 0 ? void 0 : servicesData.filter(function (srv) {
1292
+ return srv.id_retailer === datasheet.retailer.id && srv.service === getConcept(activeTab);
1293
+ }),
1294
+ _servicesData$filter4 = (0, _slicedToArray2.default)(_servicesData$filter3, 1),
1295
+ requested = _servicesData$filter4[0];
1296
+
1297
+ requested && (datasheet === null || datasheet === void 0 ? void 0 : datasheet.data) && Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
1298
+ return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
1299
+ return dsInputs[input].required && (dsInputs[input].value === undefined || !dsInputs[input].value);
1300
+ })));
1301
+ });
1302
+ });
1303
+ objetcTemp["Ficha técnica"] = dsInputsRequired.length;
1304
+ descriptionsServicesArray.forEach(function (description) {
1305
+ var _servicesData$filter5 = servicesData.filter(function (srv) {
1306
+ return srv.id_retailer === description.id && srv.service === getConcept(activeTab);
1307
+ }),
1308
+ _servicesData$filter6 = (0, _slicedToArray2.default)(_servicesData$filter5, 1),
1309
+ requested = _servicesData$filter6[0];
1310
+
1311
+ requested && description.inputs.forEach(function (input) {
1312
+ return input.required && (!input.value || input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") === "") && desInputsRequired++;
1313
+ });
1314
+ });
1315
+ objetcTemp["Descripción"] = desInputsRequired;
1316
+ var retailersRequested = [];
1317
+ (_services$4 = services[2]) === null || _services$4 === void 0 ? void 0 : (_services$4$retailerM = _services$4.retailerMandatories) === null || _services$4$retailerM === void 0 ? void 0 : _services$4$retailerM.forEach(function (retMan) {
1318
+ return retMan.forEach(function (rm) {
1319
+ return retailersRequested.push(rm);
1320
+ });
1321
+ });
1322
+ var requiredImages = (_services$5 = services[2]) === null || _services$5 === void 0 ? void 0 : (_services$5$inputs = _services$5.inputs) === null || _services$5$inputs === void 0 ? void 0 : _services$5$inputs.filter(function (e) {
1323
+ return e.required === 1 && retailersRequested.filter(function (ret) {
1324
+ return ret.id_image === e.id && servicesData.filter(function (srv) {
1325
+ return srv.id_retailer === ret.id_retailer;
1326
+ }).length > 0;
1327
+ }).length > 0;
1328
+ });
1329
+ var requiredCounter = 0;
1330
+ requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
1331
+ return services[2].values.filter(function (img) {
1332
+ return img.image_id === req.id;
1333
+ }).length === 0 && requiredCounter++;
1334
+ });
1335
+ objetcTemp["Imágenes"] = requiredCounter;
1336
+ setRequiredNull(objetcTemp);
1337
+ } catch (error) {
1338
+ console.log(error);
1339
+ }
1340
+ };
1341
+
1342
+ (0, _react.useEffect)(function () {
1343
+ setComment(comments[activeTab]);
1058
1344
  }, [activeTab]);
1059
- return /*#__PURE__*/React.createElement(_styles.Container, {
1060
- headerTop: headerTop
1061
- }, /*#__PURE__*/React.createElement(_HeaderTop.HeaderTop, {
1062
- setHeaderTop: setHeaderTop
1063
- }), /*#__PURE__*/React.createElement("div", {
1064
- className: "data-container"
1065
- }, /*#__PURE__*/React.createElement("div", {
1066
- className: "image-data-panel"
1067
- }, /*#__PURE__*/React.createElement(_ImagePreviewer.ImagePreviewer, {
1068
- activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
1069
- imagesArray: images,
1070
- setActiveImage: setActiveImage,
1071
- setShowModal: setShowModal
1072
- }), /*#__PURE__*/React.createElement(_ImageDataTable.ImageDataTable, {
1073
- lists: images,
1074
- activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
1075
- retailerSelected: activeRetailer.id,
1076
- setImages: setImages,
1077
- assignationsImages: [productSelected.article.id_images_especialist, productSelected.article.id_images_facilitator],
1078
- imagesStatus: productSelected === null || productSelected === void 0 ? void 0 : productSelected.images_status
1079
- })), /*#__PURE__*/React.createElement("div", {
1080
- className: "product-information"
1081
- }, /*#__PURE__*/React.createElement(_FullProductNameHeader.FullProductNameHeader, {
1082
- headerData: product,
1083
- percent: activePercentage,
1084
- activeRetailer: activeRetailer,
1085
- setActiveRetailer: setActiveRetailer,
1086
- approveRejectButtons: approveRejectButtons,
1087
- sendToFacilitator: sendToFacilitator,
1088
- auditorAssigned: auditorAssigned,
1089
- userAssigned: userAssigned(activeTab, "facilitator")
1090
- }), /*#__PURE__*/React.createElement(_FullTabsMenu.FullTabsMenu, {
1091
- tabsSections: tabsSections,
1092
- status: {
1093
- Descripción: (_servicesData$filter$ = servicesData.filter(function (service) {
1094
- return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === "description";
1095
- })[0]) === null || _servicesData$filter$ === void 0 ? void 0 : _servicesData$filter$.status,
1096
- "Ficha técnica": (_servicesData$filter$2 = servicesData.filter(function (service) {
1097
- return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === "datasheet";
1098
- })[0]) === null || _servicesData$filter$2 === void 0 ? void 0 : _servicesData$filter$2.status,
1099
- Imágenes: product === null || product === void 0 ? void 0 : product.images_status
1100
- },
1101
- profileImage: productData.asigned,
1102
- activeTab: activeTab,
1103
- setActiveTab: setActiveTab,
1104
- setImageLayout: setImageLayout,
1105
- saveDescriptions: saveDescriptions,
1106
- saveDatasheets: saveDatasheets,
1107
- updateImages: updateImages,
1108
- assignations: {
1109
- Descripción: [productSelected.article.id_description_especialist, productSelected.article.id_description_facilitator],
1110
- "Ficha técnica": [productSelected.article.id_datasheet_especialist, productSelected.article.id_datasheet_facilitator],
1111
- Imágenes: [productSelected.article.id_images_especialist, productSelected.article.id_images_facilitator]
1345
+
1346
+ var commentRevised = /*#__PURE__*/function () {
1347
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1348
+ var data;
1349
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1350
+ while (1) {
1351
+ switch (_context11.prev = _context11.next) {
1352
+ case 0:
1353
+ data = {
1354
+ commentId: comment.id
1355
+ };
1356
+ _context11.next = 3;
1357
+ return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1358
+ headers: {
1359
+ Authorization: sessionStorage.getItem("jwt")
1360
+ }
1361
+ });
1362
+
1363
+ case 3:
1364
+ setCrossComment(false);
1365
+ _context11.next = 6;
1366
+ return getComments();
1367
+
1368
+ case 6:
1369
+ case "end":
1370
+ return _context11.stop();
1371
+ }
1372
+ }
1373
+ }, _callee11);
1374
+ }));
1375
+
1376
+ return function commentRevised() {
1377
+ return _ref12.apply(this, arguments);
1378
+ };
1379
+ }();
1380
+
1381
+ var setAssignation = /*#__PURE__*/function () {
1382
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(assignationType, assignationId) {
1383
+ var _product$article13;
1384
+
1385
+ var concept, productTemp, data;
1386
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1387
+ while (1) {
1388
+ switch (_context12.prev = _context12.next) {
1389
+ case 0:
1390
+ concept = "";
1391
+ _context12.t0 = activeTab;
1392
+ _context12.next = _context12.t0 === "Ficha técnica" ? 4 : _context12.t0 === "Imágenes" ? 6 : 8;
1393
+ break;
1394
+
1395
+ case 4:
1396
+ concept = "datasheet";
1397
+ return _context12.abrupt("break", 10);
1398
+
1399
+ case 6:
1400
+ concept = "images";
1401
+ return _context12.abrupt("break", 10);
1402
+
1403
+ case 8:
1404
+ concept = "description";
1405
+ return _context12.abrupt("break", 10);
1406
+
1407
+ case 10:
1408
+ productTemp = product;
1409
+ productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
1410
+ data = (0, _defineProperty2.default)({
1411
+ articleList: [{
1412
+ orderId: product.orderId,
1413
+ articleId: product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article
1414
+ }],
1415
+ concept: concept
1416
+ }, "".concat(assignationType, "Id"), assignationId);
1417
+ (0, _axios.default)({
1418
+ method: "post",
1419
+ url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
1420
+ data: data,
1421
+ headers: {
1422
+ Authorization: token
1423
+ }
1424
+ });
1425
+ loadAssignations(productTemp);
1426
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1427
+
1428
+ case 16:
1429
+ case "end":
1430
+ return _context12.stop();
1431
+ }
1432
+ }
1433
+ }, _callee12);
1434
+ }));
1435
+
1436
+ return function setAssignation(_x5, _x6) {
1437
+ return _ref13.apply(this, arguments);
1438
+ };
1439
+ }();
1440
+
1441
+ var downloadImages = function downloadImages() {
1442
+ var _images$values3;
1443
+
1444
+ selectedImages.length > 0 ? selectedImages.forEach(function (e) {
1445
+ if (e.id) {
1446
+ (0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.article.upc, "_").concat(e.name, ".").concat(e.ext));
1447
+ }
1448
+ }) : images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.forEach(function (e) {
1449
+ if (e.id) {
1450
+ (0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.article.upc, "_").concat(e.name, ".").concat(e.ext));
1451
+ }
1452
+ });
1453
+ };
1454
+
1455
+ var deleteImages = function deleteImages() {
1456
+ setLoading(true);
1457
+ var values = images.values;
1458
+ var imgsInBack = [];
1459
+ selectedImages.forEach(function (selectedImg) {
1460
+ if (selectedImg.id) imgsInBack.push(selectedImg);
1461
+ });
1462
+ var imgsLeft = values.filter(function (value) {
1463
+ return selectedImages.indexOf(value) === -1;
1464
+ });
1465
+
1466
+ if (imgsInBack.length > 0) {
1467
+ var data = {
1468
+ articleId: product.article.id_article,
1469
+ deleteImages: imgsInBack,
1470
+ orderId: product.orderId
1471
+ };
1472
+
1473
+ try {
1474
+ _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), data, {
1475
+ headers: {
1476
+ Authorization: token
1477
+ }
1478
+ });
1479
+ } catch (err) {
1480
+ console.log(err);
1481
+ }
1112
1482
  }
1113
- }), /*#__PURE__*/React.createElement("div", {
1114
- className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : "")
1115
- }, !imageLayout && /*#__PURE__*/React.createElement(_GalleryHeader.GalleryHeader, null), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.datasheets) === 1 ? (_datasheets$ = datasheets[0]) === null || _datasheets$ === void 0 ? void 0 : (_datasheets$$data = _datasheets$.data) === null || _datasheets$$data === void 0 ? void 0 : _datasheets$$data.map(function (dataGroup, index) {
1116
- return /*#__PURE__*/React.createElement(_InputGroup.InputGroup, {
1117
- key: index + "-" + activeRetailer.name,
1118
- articleId: productSelected.article.id_article,
1119
- version: version,
1120
- activeSection: activeTab,
1121
- inputGroup: dataGroup,
1122
- dataInputs: datasheets[1],
1123
- updatedDatasheets: updatedDatasheets,
1124
- setUpdatedDatasheets: setUpdatedDatasheets
1483
+
1484
+ setImages({
1485
+ action: "deleteImage",
1486
+ selectedImages: selectedImages
1125
1487
  });
1126
- }) : /*#__PURE__*/React.createElement("p", null, "no tienes este servicio")), activeTab === "Descripción" && ((product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.descriptions) === 1 ? /*#__PURE__*/React.createElement(_InputGroup.InputGroup, {
1127
- activeSection: activeTab,
1128
- inputGroup: descriptions[0],
1129
- updatedDescriptions: updatedDescriptions,
1130
- setUpdatedDescriptions: setUpdatedDescriptions,
1131
- articleId: articleId,
1132
- version: version,
1133
- dinamicHeight: true
1134
- }) : /*#__PURE__*/React.createElement("p", null, "no tienes este servicio")), activeTab === "Imágenes" && ((product === null || product === void 0 ? void 0 : (_product$services3 = product.services) === null || _product$services3 === void 0 ? void 0 : _product$services3.images) === 1 ? /*#__PURE__*/React.createElement("section", {
1135
- className: "container"
1136
- }, /*#__PURE__*/React.createElement("div", getRootProps({
1137
- className: "dropzone"
1138
- }), /*#__PURE__*/React.createElement("input", getInputProps()), /*#__PURE__*/React.createElement("aside", null, thumbs()))) : /*#__PURE__*/React.createElement("p", null, "no tienes este servicio"))), (userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/React.createElement("div", {
1139
- className: "commentary-box"
1140
- }, !comments[activeTab] ? /*#__PURE__*/React.createElement("div", {
1141
- className: "commentary"
1142
- }, /*#__PURE__*/React.createElement(_index.TagAndInput, {
1143
- label: "Caja de Comentario",
1144
- inputType: "textarea",
1145
- inputCols: 80,
1146
- inputRows: 4
1147
- }), /*#__PURE__*/React.createElement("div", {
1148
- className: "buttons-box"
1149
- }, /*#__PURE__*/React.createElement(_GeneralButton.Button, {
1150
- buttonType: "general-transparent-button",
1151
- label: "Enviar comentario"
1152
- }), /*#__PURE__*/React.createElement(_GeneralButton.Button, {
1153
- buttonType: requiredNull !== 0 || !specialistValid(activeTab) || !versionMatch() ? "general-button-disabled" : "general-green-button",
1154
- label: "Enviar evaluación",
1155
- onClick: function onClick() {
1156
- return sendToFacilitator();
1488
+ getRequired([services[0], services[1], (0, _objectSpread2.default)((0, _objectSpread2.default)({}, services[2]), {}, {
1489
+ values: imgsLeft
1490
+ })]);
1491
+ setTimeout(function () {
1492
+ setLoading(false);
1493
+ }, 500);
1494
+ setMessage("");
1495
+ setComponentsArray([]);
1496
+ };
1497
+
1498
+ var askToDeleteImages = function askToDeleteImages() {
1499
+ if (selectedImages.length > 0) {
1500
+ setMessage("¿Está seguro de eliminar las imágenes seleccionadas?");
1501
+ setComponentsArray([/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1502
+ text: "¿Está seguro de eliminar las imágenes seleccionadas?",
1503
+ headerType: "retailer-name-header",
1504
+ color: "white"
1505
+ }, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1506
+ buttonType: "general-white-button",
1507
+ label: "Cancelar",
1508
+ onClick: function onClick() {
1509
+ return setMessage("");
1510
+ }
1511
+ }, "2"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1512
+ buttonType: "general-button-default",
1513
+ label: "Aceptar",
1514
+ onClick: function onClick() {
1515
+ setMessage("");
1516
+ deleteImages();
1517
+ }
1518
+ }, "3")]);
1157
1519
  }
1158
- }))) : /*#__PURE__*/React.createElement(_Commentary.Commentary, {
1159
- comment: comments[activeTab].message
1160
- })))), showModal && /*#__PURE__*/React.createElement(_ProductImageModal.ProductImageModal, {
1161
- images: images,
1162
- setShowModal: setShowModal,
1163
- sendToFacilitator: sendToFacilitator,
1164
- approveRejectButtons: approveRejectButtons
1165
- }));
1520
+ };
1521
+
1522
+ var getRetailerStatus = function getRetailerStatus(servicesData, tab) {
1523
+ var arr = servicesData === null || servicesData === void 0 ? void 0 : servicesData.slice();
1524
+ var concept = getConcept(tab);
1525
+ var retailerService = {};
1526
+
1527
+ var _arr$filter = arr === null || arr === void 0 ? void 0 : arr.filter(function (service) {
1528
+ return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === concept;
1529
+ });
1530
+
1531
+ var _arr$filter2 = (0, _slicedToArray2.default)(_arr$filter, 1);
1532
+
1533
+ retailerService = _arr$filter2[0];
1534
+ return retailerService ? retailerService.status : "NS";
1535
+ };
1536
+
1537
+ (0, _react.useEffect)(function () {
1538
+ var status = getRetailerStatus(servicesData, activeTab);
1539
+ setRetailerStatus(status);
1540
+ }, [activeTab, servicesData, activeRetailer]);
1541
+ (0, _react.useEffect)(function () {
1542
+ services.length > 0 && getRequired(services);
1543
+ }, [services, servicesData, activeTab]);
1544
+ (0, _react.useEffect)(function () {
1545
+ setSaving(loading);
1546
+ }, [loading]);
1547
+
1548
+ var validateAll = /*#__PURE__*/function () {
1549
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1550
+ var evaluationArray, sendAll, conceptArray, productTemp;
1551
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1552
+ while (1) {
1553
+ switch (_context13.prev = _context13.next) {
1554
+ case 0:
1555
+ _context13.prev = 0;
1556
+ setLoading(true);
1557
+ evaluationArray = [];
1558
+ sendAll = [];
1559
+ conceptArray = ["description", "datasheet", "images"];
1560
+ servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
1561
+ var _product$id_order;
1562
+
1563
+ var data = {
1564
+ articleId: product.article.id_article,
1565
+ orderId: (_product$id_order = product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId,
1566
+ concept: ret.service,
1567
+ result: result,
1568
+ evalStatus: product["".concat(ret.service, "_status")],
1569
+ retailerId: ret.id_retailer
1570
+ };
1571
+ evaluationArray.push(_axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1572
+ headers: {
1573
+ Authorization: token
1574
+ }
1575
+ }));
1576
+ });
1577
+ _context13.next = 8;
1578
+ return Promise.all(evaluationArray);
1579
+
1580
+ case 8:
1581
+ conceptArray === null || conceptArray === void 0 ? void 0 : conceptArray.forEach(function (concept) {
1582
+ var _product$id_order2;
1583
+
1584
+ var data = {
1585
+ articleId: product.article.id_article,
1586
+ orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
1587
+ concept: concept,
1588
+ evalStatus: product["".concat(concept, "_status")]
1589
+ };
1590
+ sendAll.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1591
+ headers: {
1592
+ Authorization: token
1593
+ }
1594
+ }));
1595
+ });
1596
+ _context13.next = 11;
1597
+ return Promise.all(sendAll);
1598
+
1599
+ case 11:
1600
+ productTemp = product;
1601
+ productTemp.status = "".concat(result, "A");
1602
+ productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "A");
1603
+ productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "A");
1604
+ productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "A");
1605
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1606
+ setProduct(productTemp);
1607
+ loadData();
1608
+ _context13.next = 24;
1609
+ break;
1610
+
1611
+ case 21:
1612
+ _context13.prev = 21;
1613
+ _context13.t0 = _context13["catch"](0);
1614
+ console.log(_context13.t0);
1615
+
1616
+ case 24:
1617
+ case "end":
1618
+ return _context13.stop();
1619
+ }
1620
+ }
1621
+ }, _callee13, null, [[0, 21]]);
1622
+ }));
1623
+
1624
+ return function validateAll(_x7) {
1625
+ return _ref14.apply(this, arguments);
1626
+ };
1627
+ }();
1628
+
1629
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1630
+ headerTop: headerTop,
1631
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
1632
+ setHeaderTop: setHeaderTop
1633
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1634
+ className: "data-container",
1635
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1636
+ className: "image-data-panel",
1637
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
1638
+ activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
1639
+ imagesArray: images,
1640
+ setActiveImage: setActiveImage,
1641
+ setShowModal: setShowModal
1642
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
1643
+ lists: images,
1644
+ activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
1645
+ retailerSelected: activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id,
1646
+ setImages: setImages,
1647
+ assignationsImages: assig["Imágenes"],
1648
+ imagesStatus: product === null || product === void 0 ? void 0 : product.images_status,
1649
+ setAssignation: setAssignation,
1650
+ isRetailer: isRetailer,
1651
+ onClickSave: function onClickSave() {
1652
+ var _product$services;
1653
+
1654
+ return (product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.images) === 1 && updateImages();
1655
+ },
1656
+ showSaveButton: userAssigned()
1657
+ })]
1658
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1659
+ className: "product-information",
1660
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
1661
+ headerData: product,
1662
+ percent: activePercentage,
1663
+ activeRetailer: activeRetailer,
1664
+ servicesData: servicesData,
1665
+ setActiveRetailer: setActiveRetailer,
1666
+ sendToFacilitator: sendToFacilitator,
1667
+ approve: function approve() {
1668
+ sendToFacilitator("A");
1669
+ },
1670
+ reject: function reject() {
1671
+ sendToFacilitator("R");
1672
+ setMessage("Rechazado");
1673
+ setComponentsArray([/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1674
+ src: _errorModal.default
1675
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1676
+ text: "Agrega tu comentarios para enviar el rechazo",
1677
+ headerType: "input-name-header",
1678
+ color: "white"
1679
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1680
+ label: "Caja de Comentario",
1681
+ inputType: "textarea",
1682
+ inputId: "modal-commentary-box",
1683
+ index: 0,
1684
+ color: "white"
1685
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1686
+ buttonType: "general-default-button",
1687
+ label: "Enviar comentario",
1688
+ onClick: function onClick(e) {
1689
+ return createComment(e, document.querySelector("#modal-commentary-box .ql-container .ql-editor > p").innerHTML, activeTab);
1690
+ }
1691
+ })]);
1692
+ },
1693
+ showApproveRejectAll: isAuditor && servicesData.every(function (serv) {
1694
+ return ["RA", "AA", "AP", "AC", "AF"].includes(serv.status);
1695
+ }) && approveRejectButtons() && (auditorAssigned() || userAssigned()),
1696
+ showValidationButtons: approveRejectButtons() && (auditorAssigned() || userAssigned()),
1697
+ approveAll: function approveAll() {
1698
+ return validateAll("A");
1699
+ },
1700
+ rejectAll: function rejectAll() {
1701
+ validateAll("R");
1702
+ setMessage("Rechazado");
1703
+ setComponentsArray([/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1704
+ src: _errorModal.default
1705
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1706
+ text: "Agrega tu comentarios para enviar el rechazo",
1707
+ headerType: "input-name-header",
1708
+ color: "white"
1709
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1710
+ label: "Caja de Comentario",
1711
+ inputType: "textarea",
1712
+ inputId: "modal-commentary-box",
1713
+ index: 0,
1714
+ color: "white"
1715
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1716
+ buttonType: "general-default-button",
1717
+ label: "Enviar comentario",
1718
+ onClick: function onClick(e) {
1719
+ return createComment(e, document.querySelector("#modal-commentary-box .ql-container .ql-editor > p").innerHTML, activeTab);
1720
+ }
1721
+ })]);
1722
+ }
1723
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1724
+ tabsSections: tabsSections,
1725
+ status: retailerStatus,
1726
+ activeTab: activeTab,
1727
+ setActiveTab: setActiveTab,
1728
+ setImageLayout: setImageLayout,
1729
+ downloadImages: downloadImages,
1730
+ askToDeleteImages: askToDeleteImages,
1731
+ assig: assig[activeTab],
1732
+ setAssignation: setAssignation,
1733
+ isRetailer: isRetailer,
1734
+ showSaveButton: userAssigned(),
1735
+ onClickSave: function onClickSave() {
1736
+ switch (activeTab) {
1737
+ case "Descripción":
1738
+ !saving && (product === null || product === void 0 ? void 0 : product.description_status) !== "NS" && saveDescriptions();
1739
+ break;
1740
+
1741
+ case "Ficha técnica":
1742
+ !saving && (product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" && saveDatasheets();
1743
+ break;
1744
+
1745
+ case "Imágenes":
1746
+ !saving && (product === null || product === void 0 ? void 0 : product.images_status) !== "NS" && updateImages();
1747
+ break;
1748
+
1749
+ default:
1750
+ break;
1751
+ }
1752
+ }
1753
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1754
+ className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
1755
+ children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1756
+ children: [!imageLayout && activeTab === "Imágenes" && (product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.images) === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1757
+ setSelectedImages: setSelectedImages,
1758
+ checkAll: checkAll,
1759
+ setCheckAll: setCheckAll
1760
+ }), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" ? (_datasheets$ = datasheets[0]) === null || _datasheets$ === void 0 ? void 0 : (_datasheets$$data = _datasheets$.data) === null || _datasheets$$data === void 0 ? void 0 : _datasheets$$data.map(function (dataGroup, index) {
1761
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1762
+ articleId: product.article.id_article,
1763
+ version: version,
1764
+ activeSection: activeTab,
1765
+ inputGroup: dataGroup,
1766
+ dataInputs: datasheets[1],
1767
+ updatedDatasheets: updatedDatasheets,
1768
+ setUpdatedDatasheets: setUpdatedDatasheets
1769
+ }, index + "-" + activeRetailer.name);
1770
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1771
+ text: "No cuentas con este servicio",
1772
+ headerType: "input-name-header"
1773
+ })), activeTab === "Descripción" && ((product === null || product === void 0 ? void 0 : product.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1774
+ activeSection: activeTab,
1775
+ inputGroup: descriptions[0],
1776
+ updatedDescriptions: updatedDescriptions,
1777
+ setUpdatedDescriptions: setUpdatedDescriptions,
1778
+ articleId: product === null || product === void 0 ? void 0 : (_product$article14 = product.article) === null || _product$article14 === void 0 ? void 0 : _product$article14.id_article,
1779
+ version: version,
1780
+ dinamicHeight: true
1781
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1782
+ text: "No cuentas con este servicio",
1783
+ headerType: "input-name-header"
1784
+ })), activeTab === "Imágenes" && ((product === null || product === void 0 ? void 0 : product.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
1785
+ className: "container",
1786
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getRootProps({
1787
+ className: "dropzone"
1788
+ })), {}, {
1789
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread2.default)({}, getInputProps())), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
1790
+ children: thumbs()
1791
+ })]
1792
+ }))
1793
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1794
+ text: "No cuentas con este servicio",
1795
+ headerType: "input-name-header"
1796
+ }))]
1797
+ })
1798
+ }), (userAssigned(activeTab) || auditorAssigned()) && product["".concat(getConcept(activeTab), "_status")] !== "NS" && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1799
+ className: "commentary-box",
1800
+ children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1801
+ className: "commentary",
1802
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1803
+ label: "Caja de Comentario",
1804
+ inputType: "textarea",
1805
+ inputCols: 80,
1806
+ inputRows: 4,
1807
+ inputId: "commentary-box",
1808
+ index: 0
1809
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1810
+ className: "buttons-box",
1811
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1812
+ buttonType: "general-transparent-button",
1813
+ label: "Enviar comentario",
1814
+ onClick: function onClick(e) {
1815
+ return createComment(e, document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML, activeTab);
1816
+ }
1817
+ })
1818
+ })]
1819
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1820
+ className: "feedback-box",
1821
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Commentary.Commentary, {
1822
+ comment: comment.message,
1823
+ reviewed: crossComment
1824
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1825
+ buttonType: "circular-button accept-button",
1826
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
1827
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1828
+ while (1) {
1829
+ switch (_context14.prev = _context14.next) {
1830
+ case 0:
1831
+ setCrossComment(true);
1832
+ commentRevised();
1833
+
1834
+ case 2:
1835
+ case "end":
1836
+ return _context14.stop();
1837
+ }
1838
+ }
1839
+ }, _callee14);
1840
+ }))
1841
+ })]
1842
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1843
+ buttonType: evaluationFinished(user.id_role, activeTab, statusArray) && requiredNull[activeTab] === 0 ? "general-green-button" : "general-button-disabled",
1844
+ label: "Enviar evaluación",
1845
+ onClick: function onClick() {
1846
+ return sendToFacilitator();
1847
+ }
1848
+ })]
1849
+ })]
1850
+ })]
1851
+ }), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
1852
+ images: images,
1853
+ setShowModal: setShowModal,
1854
+ sendToFacilitator: sendToFacilitator,
1855
+ approveRejectButtons: approveRejectButtons
1856
+ }), message.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
1857
+ buttonType: componentsArray.length > 0 && "delete-product",
1858
+ componentsArray: componentsArray.length > 0 ? componentsArray : [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1859
+ src: _genericModalCheck.default,
1860
+ alt: "success icon"
1861
+ }, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1862
+ headerType: "retailer-name-header",
1863
+ text: message,
1864
+ color: "white"
1865
+ }, "2")],
1866
+ onClick: function onClick() {
1867
+ return setMessage("");
1868
+ }
1869
+ })]
1870
+ });
1166
1871
  };
1167
1872
 
1168
1873
  exports.RetailerProductEdition = RetailerProductEdition;