contentoh-components-library 21.0.60 → 21.0.63

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