contentoh-components-library 21.0.30 → 21.0.31

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