contentoh-components-library 21.0.72 → 21.0.75

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 (196) hide show
  1. package/.env.development +21 -4
  2. package/.env.production +19 -2
  3. package/CHANGELOG.md +37 -0
  4. package/dist/assets/images/generalButton/downloadIcon.svg +3 -0
  5. package/dist/assets/images/genericModal/closeWhite.svg +3 -0
  6. package/dist/assets/images/genericModal/errorModal.svg +3 -0
  7. package/dist/assets/images/genericModal/yellowAlert.svg +12 -0
  8. package/dist/assets/images/modalsSVGs/attributesSent.svg +208 -0
  9. package/dist/assets/images/modalsSVGs/descriptionSent.svg +237 -0
  10. package/dist/assets/images/modalsSVGs/providerSent.svg +445 -0
  11. package/dist/assets/images/modalsSVGs/uploadingImages.svg +148 -0
  12. package/dist/components/atoms/AsignationOption/index.js +9 -5
  13. package/dist/components/atoms/AsignationOption/styles.js +1 -1
  14. package/dist/components/{molecules/SignInLoginCreationApp/SignInLogin.stories.js → atoms/CharCounter/CharCounter.stories.js} +10 -7
  15. package/dist/components/atoms/CharCounter/index.js +22 -0
  16. package/dist/components/{molecules/ApproveRejetPanel → atoms/CharCounter}/styles.js +3 -1
  17. package/dist/components/atoms/CheckBox/index.js +4 -2
  18. package/dist/components/atoms/Commentary/Commentary.stories.js +1 -0
  19. package/dist/components/atoms/Commentary/index.js +23 -0
  20. package/dist/components/atoms/Commentary/styles.js +23 -0
  21. package/dist/components/atoms/GeneralButton/index.js +5 -0
  22. package/dist/components/atoms/GeneralButton/styles.js +4 -2
  23. package/dist/components/atoms/GeneralInput/index.js +72 -24
  24. package/dist/components/atoms/GeneralInput/styles.js +7 -1
  25. package/dist/components/atoms/GenericModal/index.js +4 -2
  26. package/dist/components/atoms/GenericModal/styles.js +1 -1
  27. package/dist/components/atoms/Input/index.js +26 -0
  28. package/dist/components/atoms/Input/style.js +26 -0
  29. package/dist/components/atoms/InputFormatter/Wysiwyg.stories.js +30 -0
  30. package/dist/components/atoms/InputFormatter/index.js +184 -0
  31. package/dist/components/atoms/InputFormatter/styles.js +33 -0
  32. package/dist/components/atoms/LabelToInput/index.js +53 -0
  33. package/dist/components/atoms/LabelToInput/style.js +22 -0
  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 +5 -3
  48. package/dist/components/atoms/VerticalSideMenuMainPage/index.js +15 -10
  49. package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +1 -1
  50. package/dist/components/molecules/AvatarAndValidation/index.js +17 -7
  51. package/dist/components/molecules/AvatarAndValidation/styles.js +1 -1
  52. package/dist/components/molecules/FeaturesBar/index.js +1 -1
  53. package/dist/components/molecules/GalleryElement/index.js +80 -21
  54. package/dist/components/molecules/GalleryElement/styles.js +1 -1
  55. package/dist/components/molecules/GalleryHeader/index.js +28 -6
  56. package/dist/components/molecules/GalleryHeader/styles.js +1 -1
  57. package/dist/components/molecules/ImageSelector/index.js +2 -4
  58. package/dist/components/molecules/ProductNameHeader/index.js +1 -2
  59. package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +48 -0
  60. package/dist/components/molecules/RetailerSelector/index.js +74 -0
  61. package/dist/components/{atoms/MenuCommercialRetailers → molecules/RetailerSelector}/styles.js +1 -1
  62. package/dist/components/molecules/StatusAsignationInfo/index.js +46 -28
  63. package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
  64. package/dist/components/molecules/TableHeader/index.js +12 -5
  65. package/dist/components/molecules/TableHeader/styles.js +1 -1
  66. package/dist/components/molecules/TagAndInput/index.js +24 -0
  67. package/dist/components/molecules/TextAndGradient/TextAndGradient.stories.js +31 -0
  68. package/dist/components/molecules/TextAndGradient/index.js +36 -0
  69. package/dist/components/molecules/TextAndGradient/styles.js +18 -0
  70. package/dist/components/organisms/FullProductNameHeader/index.js +31 -9
  71. package/dist/components/organisms/FullTabsMenu/index.js +18 -5
  72. package/dist/components/organisms/GlobalModal/index.js +73 -0
  73. package/dist/components/organisms/GlobalModal/styles.js +66 -0
  74. package/dist/components/organisms/ImageDataTable/index.js +90 -14
  75. package/dist/components/organisms/InputGroup/index.js +34 -13
  76. package/dist/components/organisms/InputGroup/styles.js +1 -1
  77. package/dist/components/organisms/ProductImageModal/index.js +13 -10
  78. package/dist/components/organisms/ProductImageModal/styles.js +1 -1
  79. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +135 -0
  80. package/dist/components/pages/ProviderProductEdition/index.js +1979 -0
  81. package/dist/components/pages/ProviderProductEdition/styles.js +23 -0
  82. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +91 -347
  83. package/dist/components/pages/RetailerProductEdition/index.js +1610 -60
  84. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  85. package/dist/global-files/data.js +213 -53
  86. package/dist/global-files/global-styles.css +1 -0
  87. package/dist/global-files/variables.js +1 -0
  88. package/dist/index.js +13 -0
  89. package/package.json +16 -9
  90. package/src/assets/images/generalButton/downloadIcon.svg +3 -0
  91. package/src/assets/images/genericModal/closeWhite.svg +3 -0
  92. package/src/assets/images/genericModal/errorModal.svg +3 -0
  93. package/src/assets/images/genericModal/yellowAlert.svg +12 -0
  94. package/src/assets/images/modalsSVGs/attributesSent.svg +208 -0
  95. package/src/assets/images/modalsSVGs/descriptionSent.svg +237 -0
  96. package/src/assets/images/modalsSVGs/providerSent.svg +445 -0
  97. package/src/assets/images/modalsSVGs/uploadingImages.svg +148 -0
  98. package/src/components/atoms/AsignationOption/index.js +7 -5
  99. package/src/components/atoms/AsignationOption/styles.js +9 -1
  100. package/src/components/atoms/CharCounter/CharCounter.stories.js +11 -0
  101. package/src/components/atoms/CharCounter/index.js +13 -0
  102. package/src/components/atoms/CharCounter/styles.js +10 -0
  103. package/src/components/atoms/CheckBox/index.js +8 -2
  104. package/src/components/atoms/Commentary/Commentary.stories.js +0 -0
  105. package/src/components/atoms/Commentary/index.js +9 -0
  106. package/src/components/atoms/Commentary/styles.js +16 -0
  107. package/src/components/atoms/GeneralButton/index.js +9 -2
  108. package/src/components/atoms/GeneralButton/styles.js +23 -0
  109. package/src/components/atoms/GeneralInput/index.js +71 -22
  110. package/src/components/atoms/GeneralInput/styles.js +11 -1
  111. package/src/components/atoms/GenericModal/index.js +2 -2
  112. package/src/components/atoms/GenericModal/styles.js +10 -2
  113. package/src/components/atoms/Input/index.js +15 -0
  114. package/src/components/atoms/Input/style.js +31 -0
  115. package/src/components/atoms/InputFormatter/Wysiwyg.stories.js +12 -0
  116. package/src/components/atoms/InputFormatter/index.js +144 -0
  117. package/src/components/atoms/InputFormatter/styles.js +40 -0
  118. package/src/components/atoms/LabelToInput/index.js +26 -0
  119. package/src/components/atoms/LabelToInput/style.js +41 -0
  120. package/src/components/atoms/PriorityFlag/index.js +1 -1
  121. package/src/components/atoms/ProductImage/styles.js +1 -1
  122. package/src/components/atoms/ProgressBar/index.js +2 -2
  123. package/src/components/atoms/ProgressBar/styles.js +54 -3
  124. package/src/components/atoms/ScreenHeader/index.js +7 -3
  125. package/src/components/atoms/ScreenHeader/styles.js +9 -2
  126. package/src/components/atoms/Select/index.js +35 -0
  127. package/src/components/atoms/Select/style.js +76 -0
  128. package/src/components/atoms/StatusTag/index.js +30 -2
  129. package/src/components/atoms/StatusTag/styles.js +15 -3
  130. package/src/components/atoms/ValidationPanel/index.js +4 -3
  131. package/src/components/atoms/VerticalSideMenuMainPage/index.js +15 -11
  132. package/src/components/atoms/VerticalSideMenuMainPage/styles.js +8 -7
  133. package/src/components/molecules/AvatarAndValidation/index.js +23 -6
  134. package/src/components/molecules/AvatarAndValidation/styles.js +1 -1
  135. package/src/components/molecules/FeaturesBar/index.js +10 -7
  136. package/src/components/molecules/GalleryElement/index.js +75 -36
  137. package/src/components/molecules/GalleryElement/styles.js +38 -11
  138. package/src/components/molecules/GalleryHeader/index.js +14 -8
  139. package/src/components/molecules/GalleryHeader/styles.js +16 -0
  140. package/src/components/molecules/ImageSelector/index.js +2 -3
  141. package/src/components/molecules/ProductNameHeader/index.js +1 -2
  142. package/src/components/molecules/RetailerSelector/RetailerSelector.stories.js +35 -0
  143. package/src/components/molecules/RetailerSelector/index.js +63 -0
  144. package/src/components/molecules/RetailerSelector/styles.js +18 -0
  145. package/src/components/molecules/StatusAsignationInfo/index.js +64 -39
  146. package/src/components/molecules/StatusAsignationInfo/styles.js +12 -2
  147. package/src/components/molecules/TableHeader/index.js +16 -3
  148. package/src/components/molecules/TableHeader/styles.js +5 -0
  149. package/src/components/molecules/TagAndInput/index.js +24 -0
  150. package/src/components/organisms/FullProductNameHeader/index.js +38 -8
  151. package/src/components/organisms/FullTabsMenu/index.js +15 -3
  152. package/src/components/organisms/GlobalModal/index.js +68 -0
  153. package/src/components/organisms/GlobalModal/styles.js +113 -0
  154. package/src/components/organisms/ImageDataTable/index.js +89 -11
  155. package/src/components/organisms/InputGroup/index.js +46 -11
  156. package/src/components/organisms/InputGroup/styles.js +3 -0
  157. package/src/components/organisms/ProductImageModal/index.js +19 -12
  158. package/src/components/organisms/ProductImageModal/styles.js +3 -0
  159. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +123 -0
  160. package/src/components/pages/ProviderProductEdition/index.js +1493 -0
  161. package/src/components/pages/ProviderProductEdition/styles.js +118 -0
  162. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +91 -343
  163. package/src/components/pages/RetailerProductEdition/index.js +1245 -48
  164. package/src/components/pages/RetailerProductEdition/styles.js +67 -4
  165. package/src/global-files/data.js +158 -57
  166. package/src/global-files/global-styles.css +1 -0
  167. package/src/global-files/variables.js +1 -0
  168. package/src/index.js +1 -0
  169. package/dist/assets/images/editField/showPassword.png +0 -0
  170. package/dist/assets/images/sliderToolTip/infoIcon.svg +0 -4
  171. package/dist/assets/images/sliderToolTip/slide1.svg +0 -5
  172. package/dist/assets/images/sliderToolTip/slide2.svg +0 -9
  173. package/dist/assets/images/sliderToolTip/slide3.svg +0 -9
  174. package/dist/assets/images/sliderToolTip/slide4.svg +0 -9
  175. package/dist/assets/images/sliderToolTip/slide5.svg +0 -40
  176. package/dist/assets/images/verticalSideMenuMainPage/closeMenu.svg +0 -4
  177. package/dist/assets/images/verticalSideMenuMainPage/iconFAQS.svg +0 -12
  178. package/dist/assets/images/verticalSideMenuMainPage/iconGroup.svg +0 -3
  179. package/dist/assets/images/verticalSideMenuMainPage/iconLogo.svg +0 -12
  180. package/dist/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +0 -15
  181. package/dist/assets/images/verticalSideMenuMainPage/iconProduct.svg +0 -3
  182. package/dist/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +0 -12
  183. package/dist/assets/images/verticalSideMenuMainPage/iconTask.svg +0 -10
  184. package/dist/assets/images/verticalSideMenuMainPage/openMenu.svg +0 -4
  185. package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +0 -36
  186. package/dist/components/atoms/ListCommercialRetailers/index.js +0 -64
  187. package/dist/components/atoms/ListCommercialRetailers/styles.js +0 -20
  188. package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +0 -37
  189. package/dist/components/atoms/MenuCommercialRetailers/index.js +0 -25
  190. package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +0 -28
  191. package/dist/components/atoms/MenuProductImage/index.js +0 -88
  192. package/dist/components/atoms/MenuProductImage/styles.js +0 -20
  193. package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +0 -25
  194. package/dist/components/molecules/ApproveRejetPanel/index.js +0 -49
  195. package/dist/components/molecules/SignInLoginCreationApp/index.js +0 -270
  196. package/dist/components/molecules/SignInLoginCreationApp/styles.js +0 -20
@@ -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);
119
444
  };
120
445
  }();
121
446
 
122
- (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
123
- return _regenerator.default.wrap(function _callee2$(_context2) {
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);
721
+ };
722
+ }();
723
+
724
+ var saveDatasheets = /*#__PURE__*/function () {
725
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
726
+ var _product$article9;
727
+
728
+ var productTemp, 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
+ productTemp = product;
735
+ dataObject = {
736
+ articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
737
+ articleData: updatedDatasheets
738
+ };
739
+ if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
740
+ _context7.prev = 4;
741
+ _context7.next = 7;
742
+ return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
743
+ headers: {
744
+ Authorization: token
745
+ }
746
+ });
747
+
748
+ case 7:
749
+ setMessage("Fichas técnicas guardadas");
750
+
751
+ if (productTemp.status === "ASSIGNED") {
752
+ productTemp.status = "IN_PROGRESS";
753
+ setProduct(productTemp);
754
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
755
+ }
756
+
757
+ loadData();
758
+ _context7.next = 15;
759
+ break;
760
+
761
+ case 12:
762
+ _context7.prev = 12;
763
+ _context7.t0 = _context7["catch"](4);
764
+ console.log(_context7.t0);
765
+
766
+ case 15:
767
+ case "end":
768
+ return _context7.stop();
769
+ }
770
+ }
771
+ }, _callee7, null, [[4, 12]]);
772
+ }));
773
+
774
+ return function saveDatasheets() {
775
+ return _ref8.apply(this, arguments);
776
+ };
777
+ }();
778
+
779
+ var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
780
+ var _images$values2, _product$article10, _data$articleData, _data$articleData2, _data$updateImages;
781
+
782
+ var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
783
+
784
+ return _regenerator.default.wrap(function _callee8$(_context8) {
785
+ while (1) {
786
+ switch (_context8.prev = _context8.next) {
787
+ case 0:
788
+ imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
789
+ imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
790
+ acc[image === null || image === void 0 ? void 0 : image.image_id] = ++acc[image === null || image === void 0 ? void 0 : image.image_id] || 0;
791
+ return acc;
792
+ }, {});
793
+ duplicated = imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (image) {
794
+ return imagesListTemp[image === null || image === void 0 ? void 0 : image.image_id];
795
+ });
796
+ attrForImgs = Object.values(images === null || images === void 0 ? void 0 : images.attrForImgs);
797
+ attrForImgs.pop();
798
+ data = {
799
+ articleId: product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article,
800
+ attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
801
+ var _e$, _e$2;
802
+
803
+ return {
804
+ attrId: (_e$ = e[0]) === null || _e$ === void 0 ? void 0 : _e$.id,
805
+ value: (_e$2 = e[0]) === null || _e$2 === void 0 ? void 0 : _e$2.value
806
+ };
807
+ }),
808
+ articleData: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
809
+ return !e.id;
810
+ }),
811
+ updateImages: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
812
+ return e.id;
813
+ })
814
+ };
815
+ if (product !== null && product !== void 0 && product.orderId) data["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
816
+ 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) {
817
+ 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) {
818
+ return true;
819
+ }
820
+
821
+ return false;
822
+ });
823
+
824
+ 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) {
825
+ 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) {
826
+ 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) {
827
+ return true;
828
+ }
829
+
830
+ return false;
831
+ });
832
+ }
833
+
834
+ if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
835
+ _context8.next = 30;
836
+ break;
837
+ }
838
+
839
+ _context8.prev = 10;
840
+ data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
841
+ e.uuid = (0, _uuid.v4)();
842
+ });
843
+ setDataImages(data);
844
+
845
+ if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
846
+ _context8.next = 22;
847
+ break;
848
+ }
849
+
850
+ setImagesUploaded(false);
851
+ promiseArray = [];
852
+ data === null || data === void 0 ? void 0 : (_data$articleData5 = data.articleData) === null || _data$articleData5 === void 0 ? void 0 : _data$articleData5.forEach(function (e) {
853
+ var file = Buffer.from(e.src.replace(/^data:image\/\w+;base64,/, ""), "base64");
854
+ var params = {
855
+ ACL: "public-read",
856
+ Body: file,
857
+ Bucket: S3_BUCKET,
858
+ 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)
859
+ };
860
+ promiseArray.push(myBucket.putObject(params).promise());
861
+ });
862
+ _context8.next = 19;
863
+ return Promise.all(promiseArray);
864
+
865
+ case 19:
866
+ setImagesUploaded(true);
867
+ _context8.next = 23;
868
+ break;
869
+
870
+ case 22:
871
+ setImagesUploaded(true);
872
+
873
+ case 23:
874
+ _context8.next = 28;
875
+ break;
876
+
877
+ case 25:
878
+ _context8.prev = 25;
879
+ _context8.t0 = _context8["catch"](10);
880
+ console.log(_context8.t0); // setMainLoading(false);
881
+
882
+ case 28:
883
+ _context8.next = 31;
884
+ break;
885
+
886
+ case 30:
887
+ // setMainLoading(false);
888
+ 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.");
889
+
890
+ case 31:
891
+ case "end":
892
+ return _context8.stop();
893
+ }
894
+ }
895
+ }, _callee8, null, [[10, 25]]);
896
+ })), [images, imagesUploaded]);
897
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
898
+ return _regenerator.default.wrap(function _callee9$(_context9) {
124
899
  while (1) {
125
- switch (_context2.prev = _context2.next) {
900
+ switch (_context9.prev = _context9.next) {
126
901
  case 0:
902
+ if (!imagesUploaded) {
903
+ _context9.next = 13;
904
+ break;
905
+ }
906
+
907
+ setLoading(true);
908
+ dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
909
+ delete e.src;
910
+ e.imageID = e.image_id;
911
+ e.packingType = e.packing_type;
912
+ e.imageType = e.image_type;
913
+ if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
914
+ return e;
915
+ });
916
+ _context9.prev = 3;
917
+ _context9.next = 6;
918
+ return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
919
+ headers: {
920
+ Authorization: token
921
+ }
922
+ });
923
+
924
+ case 6:
925
+ setMessage("Imágenes guardadas con éxito");
127
926
  loadData();
927
+ _context9.next = 13;
928
+ break;
929
+
930
+ case 10:
931
+ _context9.prev = 10;
932
+ _context9.t0 = _context9["catch"](3);
933
+ console.log(_context9.t0);
128
934
 
129
- case 1:
935
+ case 13:
130
936
  case "end":
131
- return _context2.stop();
937
+ return _context9.stop();
938
+ }
939
+ }
940
+ }, _callee9, null, [[3, 10]]);
941
+ })), [dataImages, imagesUploaded]);
942
+
943
+ var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
944
+ var srv = servicesData.filter(function (serv) {
945
+ return serv.service === getConcept(tab);
946
+ });
947
+
948
+ var _srv$filter = srv.filter(function (serv) {
949
+ return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
950
+ }),
951
+ _srv$filter2 = (0, _slicedToArray2.default)(_srv$filter, 1),
952
+ srvActive = _srv$filter2[0];
953
+
954
+ var unvalidated = product["".concat(getConcept(tab), "_status")] === "QF" || product["".concat(getConcept(tab), "_status")] === "IN_PROGRESS";
955
+
956
+ switch (userId) {
957
+ case 7:
958
+ case 8:
959
+ 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) {
960
+ return statusArray.includes(serv.status);
961
+ }).length === srv.length;
962
+
963
+ case 4:
964
+ case 5:
965
+ return unvalidated && ["IN_PROGRESS", "QF"].includes(product.status) && srv.filter(function (serv) {
966
+ return statusArray.includes(serv.status);
967
+ }).length === srv.length;
968
+
969
+ case 6:
970
+ return statusArray.includes(product.status) && servicesData.every(function (serv) {
971
+ return ["RA", "AA"].includes(serv.status);
972
+ });
973
+
974
+ default:
975
+ break;
976
+ }
977
+ };
978
+
979
+ var getConcept = function getConcept(tab) {
980
+ switch (tab) {
981
+ case "Descripción":
982
+ return "description";
983
+
984
+ case "Ficha técnica":
985
+ return "datasheet";
986
+
987
+ case "Imágenes":
988
+ return "images";
989
+ }
990
+ };
991
+
992
+ var approveRejectButtons = function approveRejectButtons(action) {
993
+ var concept = getConcept(activeTab);
994
+ concept = action ? action : concept;
995
+
996
+ var _servicesData$filter = servicesData.filter(function (srv) {
997
+ return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
998
+ }),
999
+ _servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
1000
+ retailerStatus = _servicesData$filter2[0];
1001
+
1002
+ 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
1003
+ 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);
1004
+ };
1005
+
1006
+ var getSectionIcon = function getSectionIcon() {
1007
+ switch (activeTab) {
1008
+ case "Ficha técnica":
1009
+ setIcon(_attributesSent.default);
1010
+ break;
1011
+
1012
+ case "Descripción":
1013
+ setIcon(_descriptionSent.default);
1014
+ break;
1015
+
1016
+ case "Imágenes0,,":
1017
+ setIcon(_uploadingImages.default);
1018
+ break;
1019
+
1020
+ default:
1021
+ break;
1022
+ }
1023
+ };
1024
+
1025
+ var sendToFacilitator = /*#__PURE__*/function () {
1026
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
1027
+ var concept, productTemp, evalStatus, data, specialistDone, statusArr, newStatus;
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
+ }
132
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;
133
1183
  }
134
- }, _callee2);
135
- })), []);
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
+ }
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;
1438
+ }
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,187 @@ 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
+ sendToFacilitator: sendToFacilitator,
1582
+ approve: function approve() {
1583
+ sendToFacilitator("A");
1584
+ },
1585
+ reject: function reject() {
1586
+ sendToFacilitator("R");
1587
+ },
1588
+ showValidationButtons: approveRejectButtons() && (auditorAssigned() || userAssigned())
157
1589
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
158
1590
  tabsSections: tabsSections,
159
- status: productData.status,
160
- profileImage: productData.asigned,
1591
+ status: retailerStatus,
1592
+ activeTab: activeTab,
161
1593
  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, {
1594
+ setImageLayout: setImageLayout,
1595
+ downloadImages: downloadImages,
1596
+ askToDeleteImages: askToDeleteImages,
1597
+ assig: assig[activeTab],
1598
+ setAssignation: setAssignation,
1599
+ isRetailer: isRetailer,
1600
+ onClickSave: function onClickSave() {
1601
+ var _product$services2, _product$services3, _product$services4;
1602
+
1603
+ switch (activeTab) {
1604
+ case "Descripción":
1605
+ (product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.descriptions) === 1 && saveDescriptions();
1606
+ break;
1607
+
1608
+ case "Ficha técnica":
1609
+ (product === null || product === void 0 ? void 0 : (_product$services3 = product.services) === null || _product$services3 === void 0 ? void 0 : _product$services3.datasheets) === 1 && saveDatasheets();
1610
+ break;
1611
+
1612
+ case "Imágenes":
1613
+ (product === null || product === void 0 ? void 0 : (_product$services4 = product.services) === null || _product$services4 === void 0 ? void 0 : _product$services4.images) === 1 && updateImages();
1614
+ break;
1615
+
1616
+ default:
1617
+ break;
1618
+ }
1619
+ }
1620
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1621
+ className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
1622
+ children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1623
+ 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, {
1624
+ setSelectedImages: setSelectedImages,
1625
+ checkAll: checkAll,
1626
+ setCheckAll: setCheckAll
1627
+ }), 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) {
1628
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1629
+ articleId: product.article.id_article,
1630
+ version: version,
1631
+ activeSection: activeTab,
1632
+ inputGroup: dataGroup,
1633
+ dataInputs: datasheets[1],
1634
+ updatedDatasheets: updatedDatasheets,
1635
+ setUpdatedDatasheets: setUpdatedDatasheets
1636
+ }, index + "-" + activeRetailer.name);
1637
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1638
+ text: "No cuentas con este servicio",
1639
+ headerType: "input-name-header"
1640
+ })), activeTab === "Descripción" && ((product === null || product === void 0 ? void 0 : product.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
167
1641
  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
- }))]
1642
+ inputGroup: descriptions[0],
1643
+ updatedDescriptions: updatedDescriptions,
1644
+ setUpdatedDescriptions: setUpdatedDescriptions,
1645
+ articleId: product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article,
1646
+ version: version,
1647
+ dinamicHeight: true
1648
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1649
+ text: "No cuentas con este servicio",
1650
+ headerType: "input-name-header"
1651
+ })), activeTab === "Imágenes" && ((product === null || product === void 0 ? void 0 : product.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
1652
+ className: "container",
1653
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getRootProps({
1654
+ className: "dropzone"
1655
+ })), {}, {
1656
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread2.default)({}, getInputProps())), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
1657
+ children: thumbs()
1658
+ })]
1659
+ }))
1660
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1661
+ text: "No cuentas con este servicio",
1662
+ headerType: "input-name-header"
1663
+ }))]
1664
+ })
1665
+ }), (userAssigned(activeTab) || auditorAssigned()) && product["".concat(getConcept(activeTab), "_status")] !== "NS" && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1666
+ className: "commentary-box",
1667
+ children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1668
+ className: "commentary",
1669
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1670
+ label: "Caja de Comentario",
1671
+ inputType: "textarea",
1672
+ inputCols: 80,
1673
+ inputRows: 4,
1674
+ inputId: "commentary-box",
1675
+ index: 0
1676
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1677
+ className: "buttons-box",
1678
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1679
+ buttonType: "general-transparent-button",
1680
+ label: "Enviar comentario",
1681
+ onClick: function onClick(e) {
1682
+ return createComment(e, document.querySelector("#description-commentary-box-0 .ql-container .ql-editor > p").innerHTML, activeTab);
1683
+ }
1684
+ })
1685
+ })]
1686
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1687
+ className: "feedback-box",
1688
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Commentary.Commentary, {
1689
+ comment: comment.message,
1690
+ reviewed: crossComment
1691
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1692
+ buttonType: "circular-button accept-button",
1693
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
1694
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1695
+ while (1) {
1696
+ switch (_context14.prev = _context14.next) {
1697
+ case 0:
1698
+ setCrossComment(true);
1699
+ commentRevised();
1700
+
1701
+ case 2:
1702
+ case "end":
1703
+ return _context14.stop();
1704
+ }
1705
+ }
1706
+ }, _callee14);
1707
+ }))
1708
+ })]
1709
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1710
+ buttonType: evaluationFinished(user.id_role, activeTab, statusArray) && requiredNull[activeTab] === 0 ? "general-green-button" : "general-button-disabled",
1711
+ label: "Enviar evaluación",
1712
+ onClick: function onClick() {
1713
+ return sendToFacilitator();
1714
+ }
1715
+ })]
181
1716
  })]
182
1717
  })]
183
1718
  }), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
184
1719
  images: images,
185
- setShowModal: setShowModal
1720
+ setShowModal: setShowModal,
1721
+ sendToFacilitator: sendToFacilitator,
1722
+ approveRejectButtons: approveRejectButtons
1723
+ }), message.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
1724
+ buttonType: componentsArray.length > 0 && "delete-product",
1725
+ componentsArray: componentsArray.length > 0 ? componentsArray : [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1726
+ src: _genericModalCheck.default,
1727
+ alt: "success icon"
1728
+ }, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1729
+ headerType: "retailer-name-header",
1730
+ text: message,
1731
+ color: "white"
1732
+ }, "2")],
1733
+ onClick: function onClick() {
1734
+ return setMessage("");
1735
+ }
186
1736
  })]
187
1737
  });
188
1738
  };