contentoh-components-library 21.0.62 → 21.0.65

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