contentoh-components-library 10.0.0 → 12.1.17

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