contentoh-components-library 21.5.94 → 21.5.95

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 (70) hide show
  1. package/dist/ai/utils/compare-strings.js +45 -0
  2. package/dist/components/atoms/GeneralButton/styles.js +1 -1
  3. package/dist/components/atoms/GeneralInput/index.js +245 -54
  4. package/dist/components/atoms/GeneralInput/styles.js +7 -3
  5. package/dist/components/atoms/InputFormatter/index.js +223 -68
  6. package/dist/components/atoms/InputFormatter/styles.js +20 -4
  7. package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
  8. package/dist/components/molecules/TabsMenu/index.js +13 -12
  9. package/dist/components/molecules/TagAndInput/index.js +361 -24
  10. package/dist/components/molecules/TagAndInput/styles.js +2 -2
  11. package/dist/components/organisms/ChangeStatusModal/index.js +531 -0
  12. package/dist/components/organisms/ChangeStatusModal/styles.js +85 -0
  13. package/dist/components/organisms/FullProductNameHeader/index.js +6 -22
  14. package/dist/components/organisms/InputGroup/index.js +22 -18
  15. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +150 -337
  16. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
  17. package/dist/components/pages/ProviderProductEdition/index.js +413 -396
  18. package/dist/components/pages/ProviderProductEdition/utils.js +1 -0
  19. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +179 -196
  20. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +59 -260
  21. package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +50 -38
  22. package/dist/components/pages/RetailerProductEdition/index.js +1719 -2237
  23. package/dist/components/pages/RetailerProductEdition/styles.js +4 -2
  24. package/dist/components/pages/RetailerProductEdition/utils.js +251 -2
  25. package/dist/contexts/AiProductEdition.js +230 -158
  26. package/dist/global-files/statusDictionary.js +103 -0
  27. package/package.json +4 -2
  28. package/src/ai/utils/compare-strings.js +45 -0
  29. package/src/assets/images/Icons/arrow.png +0 -0
  30. package/src/assets/images/Icons/cancel.png +0 -0
  31. package/src/assets/images/Icons/ia-icon.png +0 -0
  32. package/src/assets/images/Icons/loading.svg +5 -0
  33. package/src/assets/images/Icons/reload.png +0 -0
  34. package/src/components/atoms/GeneralButton/styles.js +4 -0
  35. package/src/components/atoms/GeneralInput/index.js +237 -60
  36. package/src/components/atoms/GeneralInput/styles.js +81 -0
  37. package/src/components/atoms/InputFormatter/index.js +200 -51
  38. package/src/components/atoms/InputFormatter/styles.js +284 -0
  39. package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +10 -0
  40. package/src/components/atoms/RetailerSelector/index.js +3 -0
  41. package/src/components/atoms/RetailerSelector/styles.js +0 -0
  42. package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
  43. package/src/components/molecules/TabsMenu/index.js +12 -11
  44. package/src/components/molecules/TagAndInput/index.js +286 -21
  45. package/src/components/molecules/TagAndInput/styles.js +59 -17
  46. package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
  47. package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
  48. package/src/components/organisms/FullProductNameHeader/index.js +4 -28
  49. package/src/components/organisms/FullTabsMenu/index.js +1 -1
  50. package/src/components/organisms/InputGroup/index.js +12 -4
  51. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +174 -202
  52. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
  53. package/src/components/pages/ProviderProductEdition/index.js +496 -475
  54. package/src/components/pages/ProviderProductEdition/utils.js +2 -2
  55. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +201 -224
  56. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +575 -0
  57. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +62 -0
  58. package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +344 -0
  59. package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +155 -0
  60. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +114 -0
  61. package/src/components/pages/RetailerProductEdition/context/reducers/system.js +60 -0
  62. package/src/components/pages/RetailerProductEdition/index.js +1545 -1718
  63. package/src/components/pages/RetailerProductEdition/index_old.js +1979 -0
  64. package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +101 -0
  65. package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +115 -0
  66. package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +174 -0
  67. package/src/components/pages/RetailerProductEdition/styles.js +67 -2
  68. package/src/components/pages/RetailerProductEdition/utils.js +240 -0
  69. package/src/contexts/AiProductEdition.jsx +339 -0
  70. package/src/global-files/statusDictionary.js +103 -0
@@ -77,10 +77,12 @@ var _genericModalWarning = _interopRequireDefault(require("../../../assets/image
77
77
 
78
78
  var _styles = require("./styles");
79
79
 
80
+ var _AiProductEdition = require("../../../contexts/AiProductEdition");
81
+
80
82
  var _jsxRuntime = require("react/jsx-runtime");
81
83
 
82
84
  var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
83
- var _location$state4, _location$state5, _location$state6, _state$active_retaile3, _state$active_retaile4, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile5, _state$product5, _state$active_retaile6, _state$active_retaile7, _state$active_retaile8, _state$product6, _state$product7, _state$product8, _state$datasheets_inp, _state$product9, _state$images_values12;
85
+ var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _location$state5, _location$state6, _state$active_retaile3, _state$active_retaile4, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile5, _state$product11, _state$active_retaile6, _state$active_retaile7, _state$active_retaile8, _state$product12, _state$product13, _state$product14, _state$datasheets_inp, _state$datasheets_inp2, _state$product15, _state$images_values12;
84
86
 
85
87
  var tabsSections = _ref.tabsSections,
86
88
  _ref$productSelected = _ref.productSelected,
@@ -235,33 +237,16 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
235
237
  (0, _react.useEffect)(function () {
236
238
  var setProductData = function setProductData() {
237
239
  try {
238
- var product = JSON.parse(sessionStorage.getItem("productSelected")) ? JSON.parse(sessionStorage.getItem("productSelected")) : productSelected;
240
+ var product = productSelected ? productSelected : JSON.parse(sessionStorage.getItem("productSelected"));
239
241
  var productNormalized = (0, _utils.normalizeProduct)(product);
240
- console.log({
241
- productNormalized: productNormalized
242
- });
243
242
  dispatch({
244
243
  type: "SET_PRODUCT",
245
244
  payload: productNormalized
246
245
  });
247
-
248
- if (productNormalized.categoryRetailerInOrder.length > 0 && productNormalized.statusByRetailer) {
249
- dispatch({
250
- type: "SET_ACTIVE_RETAILER",
251
- payload: productNormalized.categoryRetailerInOrder[0]
252
- });
253
- var firstRetailerStatus = productNormalized.statusByRetailer[productNormalized.categoryRetailerInOrder[0].id_retailer];
254
- var initialTab = firstRetailerStatus.description ? "Descripción" : firstRetailerStatus.datasheet ? "Ficha técnica" : firstRetailerStatus.images ? "Imágenes" : "Imágenes";
255
- dispatch({
256
- type: "SET_ACTIVE_TAB",
257
- payload: initialTab
258
- });
259
- } else {
260
- dispatch({
261
- type: "SET_ACTIVE_RETAILER",
262
- payload: productNormalized.categoryRetailer[0]
263
- });
264
- }
246
+ dispatch({
247
+ type: "SET_ACTIVE_RETAILER",
248
+ payload: productNormalized.categoryRetailer[0]
249
+ });
265
250
  } catch (error) {
266
251
  console.log("Error setting product data: ", error);
267
252
  }
@@ -284,7 +269,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
284
269
 
285
270
  var fetchData = /*#__PURE__*/function () {
286
271
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
287
- var _JSON$parse$0$relatio, _JSON$parse, _JSON$parse$, _percentageRes$, _services$2$inputsByR, _services$2$values, data, headers, _yield$Promise$all, _yield$Promise$all2, services, percentageRes, servicesDataRes, percentages, orderMap, orderedValues;
272
+ var _JSON$parse$0$relatio, _JSON$parse, _JSON$parse$, _percentageRes$, data, headers, _yield$Promise$all, _yield$Promise$all2, services, percentageRes, servicesDataRes, percentages, orderMap, orderedValues, updatedStatusByRetailer;
288
273
 
289
274
  return _regenerator.default.wrap(function _callee2$(_context2) {
290
275
  while (1) {
@@ -324,16 +309,31 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
324
309
  percentageRes = _yield$Promise$all2[1];
325
310
  servicesDataRes = _yield$Promise$all2[2];
326
311
  percentages = (_JSON$parse$0$relatio = (_JSON$parse = JSON.parse(percentageRes === null || percentageRes === void 0 ? void 0 : (_percentageRes$ = percentageRes[0]) === null || _percentageRes$ === void 0 ? void 0 : _percentageRes$.body)) === null || _JSON$parse === void 0 ? void 0 : (_JSON$parse$ = _JSON$parse[0]) === null || _JSON$parse$ === void 0 ? void 0 : _JSON$parse$.relations) !== null && _JSON$parse$0$relatio !== void 0 ? _JSON$parse$0$relatio : [];
327
- orderMap = (_services$2$inputsByR = services[2].inputsByRetailer) !== null && _services$2$inputsByR !== void 0 ? _services$2$inputsByR : [].flat().reduce(function (acc, item) {
312
+ orderMap = services[2].inputsByRetailer.flat().reduce(function (acc, item) {
328
313
  acc[item.id_image] = item.order;
329
314
  return acc;
330
315
  }, {});
331
- orderedValues = (0, _toConsumableArray2.default)((_services$2$values = services[2].values) !== null && _services$2$values !== void 0 ? _services$2$values : []).sort(function (a, b) {
316
+ orderedValues = (0, _toConsumableArray2.default)(services[2].values).sort(function (a, b) {
332
317
  var _orderMap$a$image_id, _orderMap$b$image_id;
333
318
 
334
319
  var orderA = (_orderMap$a$image_id = orderMap[a.image_id]) !== null && _orderMap$a$image_id !== void 0 ? _orderMap$a$image_id : Number.MAX_SAFE_INTEGER;
335
320
  var orderB = (_orderMap$b$image_id = orderMap[b.image_id]) !== null && _orderMap$b$image_id !== void 0 ? _orderMap$b$image_id : Number.MAX_SAFE_INTEGER;
336
321
  return orderA - orderB;
322
+ }); //Cuando carguemos la información de los servicios, las actualizamos en el estado del producto
323
+
324
+ updatedStatusByRetailer = servicesDataRes.reduce(function (acc, current, idx) {
325
+ var id_retailer = current.id_retailer,
326
+ service = current.service,
327
+ status = current.status;
328
+ if (!acc[id_retailer]) acc[id_retailer] = {};
329
+ acc[id_retailer][service] = status;
330
+ return acc;
331
+ }, {});
332
+ dispatch({
333
+ type: "SET_PRODUCT",
334
+ payload: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
335
+ statusByRetailer: updatedStatusByRetailer
336
+ })
337
337
  });
338
338
  dispatch({
339
339
  type: "SET_SERVICES",
@@ -360,11 +360,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
360
360
  return rId === id_retailer;
361
361
  })
362
362
  });
363
- _context2.next = 24;
363
+ _context2.next = 26;
364
364
  break;
365
365
 
366
- case 20:
367
- _context2.prev = 20;
366
+ case 22:
367
+ _context2.prev = 22;
368
368
  _context2.t0 = _context2["catch"](1);
369
369
  console.error("Error fetching data:", _context2.t0);
370
370
  dispatch({
@@ -372,20 +372,20 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
372
372
  payload: _context2.t0
373
373
  });
374
374
 
375
- case 24:
376
- _context2.prev = 24;
375
+ case 26:
376
+ _context2.prev = 26;
377
377
  dispatch({
378
378
  type: "SET_LOADING",
379
379
  payload: false
380
380
  });
381
- return _context2.finish(24);
381
+ return _context2.finish(26);
382
382
 
383
- case 27:
383
+ case 29:
384
384
  case "end":
385
385
  return _context2.stop();
386
386
  }
387
387
  }
388
- }, _callee2, null, [[1, 20, 24, 27]]);
388
+ }, _callee2, null, [[1, 22, 26, 29]]);
389
389
  }));
390
390
 
391
391
  return function fetchData() {
@@ -394,7 +394,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
394
394
  }();
395
395
 
396
396
  fetchData();
397
- }, [state.product, state.active_retailer, token]); // Actualizador de campos del ui para que coincidan con el retailer activo
397
+ }, [(_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.datasheet_status, (_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.description_status, (_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.images_status, (_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.status, (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.percentages, (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.version, state.active_retailer, token]); // Actualizador de campos del ui para que coincidan con el retailer activo
398
398
 
399
399
  (0, _react.useEffect)(function () {
400
400
  if (!state.active_retailer) return;
@@ -402,54 +402,52 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
402
402
 
403
403
  var updateInputsActiveRetailer = function updateInputsActiveRetailer() {
404
404
  if (!state.services) return;
405
-
406
- if (state.services.datasheets) {
407
- var retailerDatasheets = state.services.datasheets[state.active_retailer.id_retailer];
408
- var datasheetsActiveRetailer = (0, _objectSpread4.default)((0, _objectSpread4.default)({}, retailerDatasheets), {}, {
409
- data: Object.values(retailerDatasheets.data)
410
- });
411
- dispatch({
412
- type: "SET_DATASHEETS_INPUTS",
413
- payload: [datasheetsActiveRetailer, state.services.datasheets.inputs]
414
- });
415
- }
416
-
417
- if (state.services.descriptions) {
418
- var descriptionsActiveRetailer = state.services.descriptions.filter(function (item) {
419
- return item.id === state.active_retailer.id_retailer;
420
- });
421
- dispatch({
422
- type: "SET_DESCRIPTIONS_INPUTS",
423
- payload: descriptionsActiveRetailer
424
- });
425
- }
426
-
427
- if (state.services.images) {
428
- var filteredValues = state.services.images.values.filter(function (value) {
429
- return state.services.images.inputsByRetailer.some(function (retailerInput) {
430
- return retailerInput.some(function (input) {
431
- return input.id_retailer === state.active_retailer.id_retailer && input.id_image === value.image_id;
432
- });
405
+ var retailerDatasheets = state.services.datasheets[state.active_retailer.id_retailer];
406
+ var datasheetsActiveRetailer = (0, _objectSpread4.default)((0, _objectSpread4.default)({}, retailerDatasheets), {}, {
407
+ data: Object.values(retailerDatasheets.data)
408
+ });
409
+ var descriptionsActiveRetailer = state.services.descriptions.filter(function (item) {
410
+ return item.id === state.active_retailer.id_retailer;
411
+ });
412
+ var filteredValues = state.services.images.values.filter(function (value) {
413
+ return state.services.images.inputsByRetailer.some(function (retailerInput) {
414
+ return retailerInput.some(function (input) {
415
+ return input.id_retailer === state.active_retailer.id_retailer && input.id_image === value.image_id;
433
416
  });
434
417
  });
435
- dispatch({
436
- type: "SET_IMAGES_VALUES",
437
- payload: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.services.images), {}, {
438
- values: filteredValues
439
- })
440
- });
441
- }
418
+ });
419
+ dispatch({
420
+ type: "SET_DATASHEETS_INPUTS",
421
+ payload: [datasheetsActiveRetailer, state.services.datasheets.inputs]
422
+ });
423
+ dispatch({
424
+ type: "SET_DESCRIPTIONS_INPUTS",
425
+ payload: descriptionsActiveRetailer
426
+ });
427
+ dispatch({
428
+ type: "SET_IMAGES_VALUES",
429
+ payload: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.services.images), {}, {
430
+ values: filteredValues
431
+ })
432
+ });
442
433
  };
443
434
 
444
435
  updateInputsActiveRetailer();
445
436
  }, [state.services]); // Helper functions
446
437
 
447
438
  var canShowValidationButtons = function canShowValidationButtons() {
448
- var _state$product2;
439
+ var _state$product8;
440
+
441
+ if (!((_state$product8 = state.product) !== null && _state$product8 !== void 0 && _state$product8.statusByRetailer)) return false;
442
+ var currentService = (0, _utils.getConceptByTab)(state.active_tab); // const currentStatus = state.product[`${currentService}_status`];
443
+
444
+ var currentRetailer = state.active_retailer.id_retailer; //Información del servicio de la cadena seleccionada
445
+
446
+ var _state$services_data$ = state.services_data.find(function (service) {
447
+ return service.service === currentService && service.id_retailer === currentRetailer;
448
+ }),
449
+ currentStatus = _state$services_data$.status;
449
450
 
450
- if (!((_state$product2 = state.product) !== null && _state$product2 !== void 0 && _state$product2.statusByRetailer)) return false;
451
- var currentService = (0, _utils.getConceptByTab)(state.active_tab);
452
- var currentStatus = state.product["".concat(currentService, "_status")];
453
451
  var originTab = origin[state.active_tab];
454
452
  var isRetailerUser = (user === null || user === void 0 ? void 0 : user.is_retailer) === 1;
455
453
  var validStatuses = ["AA", "AP", "R", "CA", "RCA"];
@@ -463,7 +461,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
463
461
 
464
462
 
465
463
  var hasNoOrder = !state.product.id_order && !state.product.orderId;
466
- return originTab === "RequestWithoutContentoh" && (["R", "CA"].includes(currentStatus) || currentStatus === "RCA" && hasNoOrder) || ["RequestWithContentoh", "Contentoh"].includes(originTab) && currentStatus === "AA";
464
+ var condition = originTab === "RequestWithoutContentoh" && (["R", "CA"].includes(currentStatus) || currentStatus === "RCA" && hasNoOrder) || ["RequestWithContentoh", "Contentoh"].includes(originTab) && currentStatus === "AA";
465
+ return condition;
467
466
  };
468
467
 
469
468
  var canShowSaveButton = function canShowSaveButton(version_status) {
@@ -555,9 +554,9 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
555
554
  };
556
555
 
557
556
  var handleOnClickSaveImages = function handleOnClickSaveImages() {
558
- var _state$product3, _state$product3$servi;
557
+ var _state$product9, _state$product9$servi;
559
558
 
560
- if (((_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : (_state$product3$servi = _state$product3.services) === null || _state$product3$servi === void 0 ? void 0 : _state$product3$servi.images) === 1) {
559
+ if (((_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : (_state$product9$servi = _state$product9.services) === null || _state$product9$servi === void 0 ? void 0 : _state$product9$servi.images) === 1) {
561
560
  updateImages();
562
561
  }
563
562
  };
@@ -778,9 +777,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
778
777
 
779
778
  var sendEvaluation = /*#__PURE__*/function () {
780
779
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(result) {
781
- var _state$product$id_ord, _state$product4, _state$active_retaile2;
780
+ var _state$product$id_ord, _state$product10, _state$active_retaile2;
781
+
782
+ var concept, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, _newStatuses$newStatu, _state$services_data, res, newStatuses, serviceStatus, updatedProduct, updatedServicesData;
782
783
 
783
- var concept, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, serviceStatus, updatedProduct;
784
784
  return _regenerator.default.wrap(function _callee3$(_context3) {
785
785
  while (1) {
786
786
  switch (_context3.prev = _context3.next) {
@@ -793,7 +793,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
793
793
  articleId = state.product.id_article;
794
794
  orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
795
795
  sectionStatusKey = "".concat(concept, "_status");
796
- evalStatus = state.product[sectionStatusKey] || ((_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.version_status);
796
+ evalStatus = state.product[sectionStatusKey] || ((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.version_status);
797
797
  data = {
798
798
  articleId: articleId,
799
799
  orderId: orderId,
@@ -804,7 +804,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
804
804
  _context3.prev = 8;
805
805
 
806
806
  if (!result) {
807
- _context3.next = 21;
807
+ _context3.next = 23;
808
808
  break;
809
809
  }
810
810
 
@@ -820,14 +820,29 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
820
820
  case 14:
821
821
  res = _context3.sent;
822
822
  newStatuses = JSON.parse(res.data.body);
823
- serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")]; // Actualizar el producto con los nuevos estados
823
+ serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
824
+ console.log({
825
+ product: state.product,
826
+ newStatuses: newStatuses,
827
+ serviceStatus: serviceStatus,
828
+ servicesData: state.services_data
829
+ }); // Actualizar el producto con los nuevos estados
824
830
 
825
831
  updatedProduct = (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
826
- statusByRetailer: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product.statusByRetailer), {}, (0, _defineProperty2.default)({}, retailerId, (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product.statusByRetailer[retailerId]), {}, (0, _defineProperty2.default)({}, concept, serviceStatus))))
832
+ statusByRetailer: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product.statusByRetailer), {}, (0, _defineProperty2.default)({}, retailerId, (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product.statusByRetailer[retailerId]), {}, (0, _defineProperty2.default)({}, concept, (_newStatuses$newStatu = newStatuses === null || newStatuses === void 0 ? void 0 : newStatuses.newStatus) !== null && _newStatuses$newStatu !== void 0 ? _newStatuses$newStatu : serviceStatus))))
827
833
  });
828
- console.log({
829
- updatedProduct: updatedProduct
834
+ updatedServicesData = (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : _state$services_data.map(function (service) {
835
+ var _newStatuses$newStatu2;
836
+
837
+ return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, service), {}, {
838
+ status: (service === null || service === void 0 ? void 0 : service.id_retailer) === retailerId && (service === null || service === void 0 ? void 0 : service.service) === concept ? (_newStatuses$newStatu2 = newStatuses === null || newStatuses === void 0 ? void 0 : newStatuses.newStatus) !== null && _newStatuses$newStatu2 !== void 0 ? _newStatuses$newStatu2 : serviceStatus : service === null || service === void 0 ? void 0 : service.status
839
+ });
830
840
  });
841
+ dispatch({
842
+ type: "SET_SERVICES_DATA",
843
+ payload: updatedServicesData
844
+ }); // console.log({ updatedProduct });
845
+
831
846
  dispatch({
832
847
  type: "SET_PRODUCT",
833
848
  payload: updatedProduct
@@ -843,12 +858,12 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
843
858
  }
844
859
  });
845
860
 
846
- case 21:
847
- _context3.next = 27;
861
+ case 23:
862
+ _context3.next = 29;
848
863
  break;
849
864
 
850
- case 23:
851
- _context3.prev = 23;
865
+ case 25:
866
+ _context3.prev = 25;
852
867
  _context3.t0 = _context3["catch"](8);
853
868
  console.error("Error sending evaluation:", _context3.t0);
854
869
  dispatch({
@@ -861,20 +876,20 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
861
876
  }
862
877
  });
863
878
 
864
- case 27:
865
- _context3.prev = 27;
879
+ case 29:
880
+ _context3.prev = 29;
866
881
  dispatch({
867
882
  type: "SET_SAVING",
868
883
  payload: false
869
884
  });
870
- return _context3.finish(27);
885
+ return _context3.finish(29);
871
886
 
872
- case 30:
887
+ case 32:
873
888
  case "end":
874
889
  return _context3.stop();
875
890
  }
876
891
  }
877
- }, _callee3, null, [[8, 23, 27, 30]]);
892
+ }, _callee3, null, [[8, 25, 29, 32]]);
878
893
  }));
879
894
 
880
895
  return function sendEvaluation(_x2) {
@@ -1096,7 +1111,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1096
1111
 
1097
1112
  var handleOnEvaluateAll = /*#__PURE__*/function () {
1098
1113
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(result) {
1099
- var _state$product$id_ord2, _state$services_data, evaluationArray, conceptArray, dataGeneral, userType, status, updatedStatusByRetailer, updatedProduct;
1114
+ var _state$product$id_ord2, _state$services_data2, evaluationArray, conceptArray, dataGeneral, userType, status, updatedStatusByRetailer, updatedProduct;
1100
1115
 
1101
1116
  return _regenerator.default.wrap(function _callee5$(_context5) {
1102
1117
  while (1) {
@@ -1116,7 +1131,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1116
1131
  isAproved: result === "A"
1117
1132
  }; // Crear todas las evaluaciones para cada servicio y retailer
1118
1133
 
1119
- (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : _state$services_data.forEach(function (ret) {
1134
+ (_state$services_data2 = state.services_data) === null || _state$services_data2 === void 0 ? void 0 : _state$services_data2.forEach(function (ret) {
1120
1135
  var service = ret.service,
1121
1136
  id_retailer = ret.id_retailer;
1122
1137
  var data = {};
@@ -1246,330 +1261,332 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1246
1261
  };
1247
1262
 
1248
1263
  if (state.loading || !state.services || !state.product) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {});
1249
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1250
- headerTop: headerTop,
1251
- children: [showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
1252
- modalId: "version-selector",
1253
- articleId: state.product.id_article,
1254
- setVersion: handleOnChangeProductVersion,
1255
- companyName: company.company_name,
1256
- currentVersion: state.product.version,
1257
- setShowVersionSelector: setShowVersionSelector,
1258
- jwt: token
1259
- }), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
1260
- images: state.images_values,
1261
- setShowModal: setShowModal,
1262
- approveRejectButtons: canShowValidationButtons(),
1263
- sendToFacilitator: handleOnSendEvaluation
1264
- }), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
1265
- componentsArray: [state.modal.image && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1266
- src: state.modal.image,
1267
- alt: "modal icon"
1268
- }, "1"), state.modal.title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1269
- headerType: "retailer-name-header",
1270
- text: state.modal.title,
1271
- color: "white"
1272
- }, "2"), state.modal.message && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1273
- headerType: "retailer-name-header",
1274
- text: state.modal.message,
1275
- color: "white"
1276
- }, "3"), state.modal.buttons && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1277
- style: {
1278
- marginTop: "16px"
1279
- },
1280
- children: state.modal.buttons.map(function (button, index) {
1281
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1282
- buttonType: button.buttonType,
1283
- label: button.text,
1284
- onClick: button.action
1285
- }, index);
1286
- })
1287
- }, "4")].filter(Boolean),
1288
- onClick: function onClick() {
1289
- return dispatch({
1290
- type: "SET_MODAL",
1291
- payload: {
1292
- show: false,
1293
- title: "",
1294
- message: "",
1295
- image: null
1296
- }
1297
- });
1298
- }
1299
- }), showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
1300
- title: rejectAll ? "Agregar mensaje para rechazar todo" : "Agregar mensaje de rechazo",
1301
- show: showRejectModal,
1302
- customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1303
- inputType: "textarea",
1304
- inputId: "modal-message-box",
1305
- index: 0,
1306
- color: "white"
1307
- }),
1308
- buttons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
1309
- type: "white",
1310
- label: "Cancelar",
1311
- size: 12,
1264
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AiProductEdition.AiProductEditionProvider, {
1265
+ isCreatorsEdition: false,
1266
+ state: state,
1267
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1268
+ headerTop: headerTop,
1269
+ children: [showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
1270
+ modalId: "version-selector",
1271
+ articleId: state.product.id_article,
1272
+ setVersion: handleOnChangeProductVersion,
1273
+ companyName: company.company_name,
1274
+ currentVersion: state.product.version,
1275
+ setShowVersionSelector: setShowVersionSelector,
1276
+ jwt: token
1277
+ }), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
1278
+ images: state.images_values,
1279
+ setShowModal: setShowModal,
1280
+ approveRejectButtons: canShowValidationButtons(),
1281
+ sendToFacilitator: handleOnSendEvaluation
1282
+ }), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
1283
+ componentsArray: [state.modal.image && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1284
+ src: state.modal.image,
1285
+ alt: "modal icon"
1286
+ }, "1"), state.modal.title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1287
+ headerType: "retailer-name-header",
1288
+ text: state.modal.title,
1289
+ color: "white"
1290
+ }, "2"), state.modal.message && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1291
+ headerType: "retailer-name-header",
1292
+ text: state.modal.message,
1293
+ color: "white"
1294
+ }, "3"), state.modal.buttons && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1295
+ style: {
1296
+ marginTop: "16px"
1297
+ },
1298
+ children: state.modal.buttons.map(function (button, index) {
1299
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1300
+ buttonType: button.buttonType,
1301
+ label: button.text,
1302
+ onClick: button.action
1303
+ }, index);
1304
+ })
1305
+ }, "4")].filter(Boolean),
1312
1306
  onClick: function onClick() {
1313
- setShowRejectModal(false);
1307
+ return dispatch({
1308
+ type: "SET_MODAL",
1309
+ payload: {
1310
+ show: false,
1311
+ title: "",
1312
+ message: "",
1313
+ image: null
1314
+ }
1315
+ });
1314
1316
  }
1315
- }, "btn-Cancelar"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
1316
- type: "pink",
1317
- label: "Aceptar",
1318
- size: 12,
1319
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
1320
- var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
1321
- return _regenerator.default.wrap(function _callee6$(_context6) {
1322
- while (1) {
1323
- switch (_context6.prev = _context6.next) {
1324
- case 0:
1325
- elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
1326
-
1327
- if (!(!elements || elements.length === 0)) {
1328
- _context6.next = 4;
1329
- break;
1330
- }
1317
+ }), showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
1318
+ title: rejectAll ? "Agregar mensaje para rechazar todo" : "Agregar mensaje de rechazo",
1319
+ show: showRejectModal,
1320
+ customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1321
+ inputType: "textarea",
1322
+ inputId: "modal-message-box",
1323
+ index: 0,
1324
+ color: "white"
1325
+ }),
1326
+ buttons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
1327
+ type: "white",
1328
+ label: "Cancelar",
1329
+ size: 12,
1330
+ onClick: function onClick() {
1331
+ setShowRejectModal(false);
1332
+ }
1333
+ }, "btn-Cancelar"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
1334
+ type: "pink",
1335
+ label: "Aceptar",
1336
+ size: 12,
1337
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
1338
+ var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
1339
+ return _regenerator.default.wrap(function _callee6$(_context6) {
1340
+ while (1) {
1341
+ switch (_context6.prev = _context6.next) {
1342
+ case 0:
1343
+ elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
1331
1344
 
1332
- console.error("Elemento no encontrado");
1333
- return _context6.abrupt("return");
1345
+ if (!(!elements || elements.length === 0)) {
1346
+ _context6.next = 4;
1347
+ break;
1348
+ }
1334
1349
 
1335
- case 4:
1336
- isMessageEmpty = Array.from(elements).every(function (el) {
1337
- var body = el.innerHTML;
1338
- return !body || body.replace(/<.*?\/?>/gm, "").trim() === "";
1339
- });
1350
+ console.error("Elemento no encontrado");
1351
+ return _context6.abrupt("return");
1340
1352
 
1341
- if (!isMessageEmpty) {
1342
- _context6.next = 10;
1343
- break;
1344
- }
1353
+ case 4:
1354
+ isMessageEmpty = Array.from(elements).every(function (el) {
1355
+ var body = el.innerHTML;
1356
+ return !body || body.replace(/<.*?\/?>/gm, "").trim() === "";
1357
+ });
1345
1358
 
1346
- container = document.querySelector(".container-customComponent");
1347
- existingAlert = container.querySelector(".alert-error");
1359
+ if (!isMessageEmpty) {
1360
+ _context6.next = 10;
1361
+ break;
1362
+ }
1348
1363
 
1349
- if (!existingAlert) {
1350
- alert = document.createElement("div");
1351
- alert.className = "alert-error";
1352
- alert.style.cssText = "\n color: #d32f2f;\n background-color: #ffebee;\n border: 1px solid #ef5350;\n border-radius: 4px;\n padding: 12px 16px;\n margin-top: 10px;\n font-size: 14px;\n display: flex;\n align-items: center;\n gap: 8px;\n font-family: 'Roboto', sans-serif;\n text-align: center;\n ";
1353
- alert.innerHTML = "<span>El mensaje no puede estar vac\xEDo.</span>";
1354
- container.appendChild(alert);
1355
- }
1364
+ container = document.querySelector(".container-customComponent");
1365
+ existingAlert = container.querySelector(".alert-error");
1356
1366
 
1357
- return _context6.abrupt("return");
1367
+ if (!existingAlert) {
1368
+ alert = document.createElement("div");
1369
+ alert.className = "alert-error";
1370
+ alert.style.cssText = "\n color: #d32f2f;\n background-color: #ffebee;\n border: 1px solid #ef5350;\n border-radius: 4px;\n padding: 12px 16px;\n margin-top: 10px;\n font-size: 14px;\n display: flex;\n align-items: center;\n gap: 8px;\n font-family: 'Roboto', sans-serif;\n text-align: center;\n ";
1371
+ alert.innerHTML = "<span>El mensaje no puede estar vac\xEDo.</span>";
1372
+ container.appendChild(alert);
1373
+ }
1358
1374
 
1359
- case 10:
1360
- fullMessage = Array.from(elements).map(function (element) {
1361
- return element.innerHTML;
1362
- }).join("").replace(/<br\s*\/?>/gi, "\n");
1363
- _context6.next = 13;
1364
- return createComment(fullMessage);
1375
+ return _context6.abrupt("return");
1365
1376
 
1366
- case 13:
1367
- rejectAll ? handleOnEvaluateAll("R") : handleOnSendEvaluation("R");
1368
- setShowRejectModal(false);
1377
+ case 10:
1378
+ fullMessage = Array.from(elements).map(function (element) {
1379
+ return element.innerHTML;
1380
+ }).join("").replace(/<br\s*\/?>/gi, "\n");
1381
+ _context6.next = 13;
1382
+ return createComment(fullMessage, token);
1369
1383
 
1370
- case 15:
1371
- case "end":
1372
- return _context6.stop();
1373
- }
1374
- }
1375
- }, _callee6);
1376
- }))
1377
- }, "btn-Aceptar")]
1378
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
1379
- setHeaderTop: setHeaderTop,
1380
- withChat: location === null || location === void 0 ? void 0 : (_location$state5 = location.state) === null || _location$state5 === void 0 ? void 0 : _location$state5.withChat,
1381
- chatType: location === null || location === void 0 ? void 0 : (_location$state6 = location.state) === null || _location$state6 === void 0 ? void 0 : _location$state6.chatType,
1382
- productSelected: state.product,
1383
- token: token,
1384
- activeRetailer: {
1385
- id: (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer,
1386
- name: (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.retailer
1387
- }
1388
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1389
- className: "data-container",
1390
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1391
- className: "image-data-panel",
1392
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
1393
- activeImage: (_state$images_values$2 = state.images_values.values[state.current_image]) !== null && _state$images_values$2 !== void 0 ? _state$images_values$2 : {},
1394
- imagesArray: state.images_values || [],
1395
- setActiveImage: handleOnChangeCurrentImage,
1396
- setShowModal: handleOnShowModalGalery
1397
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
1398
- lists: state.images_values || [],
1399
- activeImage: (_state$images_values10 = state.images_values) !== null && _state$images_values10 !== void 0 && _state$images_values10.values ? (_state$images_values11 = state.images_values) === null || _state$images_values11 === void 0 ? void 0 : _state$images_values11.values[state.current_image] : {},
1400
- assignationsImages: assig,
1401
- retailerSelected: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer,
1402
- imagesStatus: ((_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.images_status) || "-",
1403
- isRetailer: isRetailer,
1404
- setShowVersionSelector: setShowVersionSelector,
1405
- version: state.product.version,
1406
- setImages: handleOnChangeCurrentImage,
1407
- onClickSave: handleOnClickSaveImages,
1408
- setAssignation: handleOnChangeAssignations // No se usa?
1384
+ case 13:
1385
+ rejectAll ? handleOnEvaluateAll("R") : handleOnSendEvaluation("R");
1386
+ setShowRejectModal(false);
1409
1387
 
1410
- })]
1411
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1412
- className: "product-information",
1413
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1414
- className: "product-information",
1415
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
1416
- headerData: state.product,
1417
- percent: state.active_percentage.percentagesGeneral.required,
1418
- activeRetailer: {
1419
- id: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
1420
- name: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.retailer,
1421
- image: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.image
1422
- },
1423
- showValidationButtons: canShowValidationButtons(),
1424
- showApproveRejectAll: canShowValidationButtons(),
1425
- servicesData: state.services_data ? state.services_data : null,
1426
- approveAll: handleOnApproveAll,
1427
- rejectAll: handleOnRejectAll,
1428
- approve: function approve() {
1429
- return handleOnSendEvaluation("A");
1430
- },
1431
- reject: handleOnReject,
1432
- setActiveRetailer: handleOnChangeActiveRetailer
1433
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1434
- tabsSections: tabsSections,
1435
- status: getStatusByCurrentServiceAndRetailer(),
1436
- activeTab: state.active_tab,
1437
- user: user,
1388
+ case 15:
1389
+ case "end":
1390
+ return _context6.stop();
1391
+ }
1392
+ }
1393
+ }, _callee6);
1394
+ }))
1395
+ }, "btn-Aceptar")]
1396
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
1397
+ setHeaderTop: setHeaderTop,
1398
+ withChat: location === null || location === void 0 ? void 0 : (_location$state5 = location.state) === null || _location$state5 === void 0 ? void 0 : _location$state5.withChat,
1399
+ chatType: location === null || location === void 0 ? void 0 : (_location$state6 = location.state) === null || _location$state6 === void 0 ? void 0 : _location$state6.chatType,
1400
+ productSelected: state.product,
1401
+ token: token,
1402
+ activeRetailer: {
1403
+ id: (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer,
1404
+ name: (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.retailer
1405
+ }
1406
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1407
+ className: "data-container",
1408
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1409
+ className: "image-data-panel",
1410
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
1411
+ activeImage: (_state$images_values$2 = state.images_values.values[state.current_image]) !== null && _state$images_values$2 !== void 0 ? _state$images_values$2 : {},
1412
+ imagesArray: state.images_values || [],
1413
+ setActiveImage: handleOnChangeCurrentImage,
1414
+ setShowModal: handleOnShowModalGalery
1415
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
1416
+ lists: state.images_values || [],
1417
+ activeImage: (_state$images_values10 = state.images_values) !== null && _state$images_values10 !== void 0 && _state$images_values10.values ? (_state$images_values11 = state.images_values) === null || _state$images_values11 === void 0 ? void 0 : _state$images_values11.values[state.current_image] : {},
1418
+ assignationsImages: assig,
1419
+ retailerSelected: (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer,
1420
+ imagesStatus: ((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.images_status) || "-",
1438
1421
  isRetailer: isRetailer,
1439
- assig: assig,
1422
+ setShowVersionSelector: setShowVersionSelector,
1440
1423
  version: state.product.version,
1441
- updatedDescriptions: state.updated_descriptions_inputs,
1442
- updatedDatasheets: state.updated_datasheets_inputs,
1443
- updatedImages: state.updated_images_values,
1444
- images: state.services.images // actions
1445
- ,
1446
- downloadImages: handleOnDownloadImages,
1447
- askToDeleteImages: handleOnAskToDeleteImages,
1448
- showSaveButton: canShowSaveButton(state.product.version_status),
1449
- onClickSave: handleOnClickSave // setters
1450
- ,
1451
- setActiveTab: handleOnChangeActiveTab,
1452
- setImageLayout: handleOnSetImageLayout,
1453
- setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
1454
- setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
1455
- setAssignation: handleOnSetAssignation // No se usa?
1456
- ,
1457
- setImages: handleOnSetImages // No se usa?
1458
- // setSelectedImages={handleOnSetSelectedImages} // Se pasa hasta TabsMenu, pero no se usa
1459
- ,
1460
- setShowVersionSelector: setShowVersionSelector
1461
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1462
- className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
1463
- children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1464
- children: [state.active_tab === "Descripción" && (((_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1465
- activeSection: state.active_tab,
1466
- inputGroup: state.descriptions_inputs[0],
1467
- updatedDescriptions: state.updated_descriptions_inputs,
1468
- articleId: (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.id_article,
1469
- version: state.product.version,
1470
- isShowbox: false,
1471
- dinamicHeight: true,
1472
- setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
1473
- updateApprovedInputs: handleOnUpdateApprovedInputs // No se usa?
1474
-
1475
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1476
- text: "No cuentas con este servicio",
1477
- headerType: "input-name-header"
1478
- })), state.active_tab === "Ficha técnica" && (((_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1479
- children: (_state$datasheets_inp = state.datasheets_inputs[0].data) === null || _state$datasheets_inp === void 0 ? void 0 : _state$datasheets_inp.map(function (dataGroup, index) {
1480
- var _state$datasheets_inp2;
1481
-
1482
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1483
- index: index,
1484
- articleId: state.product.id_article,
1485
- version: state.version,
1486
- activeSection: state.active_tab,
1487
- inputGroup: dataGroup,
1488
- dataInputs: (_state$datasheets_inp2 = state.datasheets_inputs[1]) !== null && _state$datasheets_inp2 !== void 0 ? _state$datasheets_inp2 : [],
1489
- activeRetailer: state.services.datasheets[state.active_retailer.id_retailer],
1490
- groupData: state.services.datasheets[state.active_retailer.id_retailer].data,
1491
- updatedDatasheets: state.updated_datasheets_inputs,
1492
- setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
1493
- isShowbox: true,
1494
- setUpdatedBoxData: function setUpdatedBoxData(e) {
1495
- setBoxData(e);
1496
- },
1497
- updateApprovedInputs: handleOnUpdateApprovedInputs // No se usa?
1498
-
1499
- }, index + "-" + state.active_retailer.retailer);
1500
- })
1501
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1502
- text: "No cuentas con este servicio",
1503
- headerType: "input-name-header"
1504
- })), state.active_tab === "Imágenes" && (((_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1505
- children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1506
- checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
1507
- ,
1508
- setCheckAll: handleOnSetCheckAll // Toggler de true o false para el checkbox "Seleccionar todo"
1509
- ,
1510
- setSelectedImages: handleOnSetSelectedImages
1511
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
1512
- className: "container",
1513
- style: {
1514
- position: "relative"
1515
- },
1516
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread4.default)((0, _objectSpread4.default)({}, getRootProps({
1517
- className: "dropzone ".concat(isDragActive ? "drag-active" : "")
1518
- })), {}, {
1519
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread4.default)({}, getInputProps())), isDragActive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1520
- className: "drag-overlay",
1521
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1522
- children: "Suelta las im\xE1genes aqu\xED"
1523
- })
1524
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
1525
- children: thumbs()
1526
- })]
1527
- })), ((_state$images_values12 = state.images_values) === null || _state$images_values12 === void 0 ? void 0 : _state$images_values12.values.length) === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1424
+ setImages: handleOnChangeCurrentImage,
1425
+ onClickSave: handleOnClickSaveImages,
1426
+ setAssignation: handleOnChangeAssignations // No se usa?
1427
+
1428
+ })]
1429
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1430
+ className: "product-information",
1431
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1432
+ className: "product-information",
1433
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
1434
+ headerData: state.product,
1435
+ percent: state.active_percentage.percentagesGeneral.required,
1436
+ activeRetailer: {
1437
+ id: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
1438
+ name: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.retailer,
1439
+ image: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.image
1440
+ },
1441
+ showValidationButtons: canShowValidationButtons(),
1442
+ showApproveRejectAll: canShowValidationButtons(),
1443
+ servicesData: state.services_data ? state.services_data : null,
1444
+ approveAll: handleOnApproveAll,
1445
+ rejectAll: handleOnRejectAll,
1446
+ approve: function approve() {
1447
+ return handleOnSendEvaluation("A");
1448
+ },
1449
+ reject: handleOnReject,
1450
+ setActiveRetailer: handleOnChangeActiveRetailer
1451
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1452
+ tabsSections: tabsSections,
1453
+ status: getStatusByCurrentServiceAndRetailer(),
1454
+ activeTab: state.active_tab,
1455
+ user: user,
1456
+ isRetailer: isRetailer,
1457
+ assig: assig,
1458
+ version: state.product.version,
1459
+ updatedDescriptions: state.updated_descriptions_inputs,
1460
+ updatedDatasheets: state.updated_datasheets_inputs,
1461
+ updatedImages: state.updated_images_values,
1462
+ images: state.services.images // actions
1463
+ ,
1464
+ downloadImages: handleOnDownloadImages,
1465
+ askToDeleteImages: handleOnAskToDeleteImages,
1466
+ showSaveButton: canShowSaveButton(state.product.version_status),
1467
+ onClickSave: handleOnClickSave // setters
1468
+ ,
1469
+ setActiveTab: handleOnChangeActiveTab,
1470
+ setImageLayout: handleOnSetImageLayout,
1471
+ setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
1472
+ setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
1473
+ setAssignation: handleOnSetAssignation // No se usa?
1474
+ ,
1475
+ setImages: handleOnSetImages // No se usa?
1476
+ // setSelectedImages={handleOnSetSelectedImages} // Se pasa hasta TabsMenu, pero no se usa
1477
+ ,
1478
+ setShowVersionSelector: setShowVersionSelector
1479
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1480
+ className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
1481
+ children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1482
+ children: [state.active_tab === "Descripción" && (((_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1483
+ activeSection: state.active_tab,
1484
+ inputGroup: state.descriptions_inputs[0],
1485
+ updatedDescriptions: state.updated_descriptions_inputs,
1486
+ articleId: (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.id_article,
1487
+ version: state.product.version,
1488
+ isShowbox: false,
1489
+ dinamicHeight: true,
1490
+ setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
1491
+ updateApprovedInputs: handleOnUpdateApprovedInputs // No se usa?
1492
+
1493
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1494
+ text: "No cuentas con este servicio",
1495
+ headerType: "input-name-header"
1496
+ })), state.active_tab === "Ficha técnica" && (((_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1497
+ children: (_state$datasheets_inp = state.datasheets_inputs[0]) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp.data) === null || _state$datasheets_inp2 === void 0 ? void 0 : _state$datasheets_inp2.map(function (dataGroup, index) {
1498
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1499
+ index: index,
1500
+ articleId: state.product.id_article,
1501
+ version: state.version,
1502
+ activeSection: state.active_tab,
1503
+ inputGroup: dataGroup,
1504
+ dataInputs: state.datasheets_inputs[1],
1505
+ activeRetailer: state.services.datasheets[state.active_retailer.id_retailer],
1506
+ groupData: state.services.datasheets[state.active_retailer.id_retailer].data,
1507
+ updatedDatasheets: state.updated_datasheets_inputs,
1508
+ setUpdatedDatasheets: handleOnSetUpdatedDatasheets,
1509
+ isShowbox: true,
1510
+ setUpdatedBoxData: function setUpdatedBoxData(e) {
1511
+ setBoxData(e);
1512
+ },
1513
+ updateApprovedInputs: handleOnUpdateApprovedInputs // No se usa?
1514
+
1515
+ }, index + "-" + state.active_retailer.retailer);
1516
+ })
1517
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1518
+ text: "No cuentas con este servicio",
1519
+ headerType: "input-name-header"
1520
+ })), state.active_tab === "Imágenes" && (((_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1521
+ children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1522
+ checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
1523
+ ,
1524
+ setCheckAll: handleOnSetCheckAll // Toggler de true o false para el checkbox "Seleccionar todo"
1525
+ ,
1526
+ setSelectedImages: handleOnSetSelectedImages
1527
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
1528
+ className: "container",
1528
1529
  style: {
1529
- position: "absolute",
1530
- top: "50%",
1531
- left: "50%",
1532
- transform: "translate(-50%, -50%)",
1533
- textAlign: "center",
1534
- padding: "40px",
1535
- width: "80%",
1536
- maxWidth: "500px",
1537
- fontFamily: "Arial, sans-serif"
1530
+ position: "relative"
1538
1531
  },
1539
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1540
- style: {
1541
- fontSize: "18px",
1542
- color: "#666",
1543
- marginBottom: "16px"
1544
- },
1545
- children: "Este producto no tiene im\xE1genes"
1546
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
1532
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread4.default)((0, _objectSpread4.default)({}, getRootProps({
1533
+ className: "dropzone ".concat(isDragActive ? "drag-active" : "")
1534
+ })), {}, {
1535
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread4.default)({}, getInputProps())), isDragActive && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1536
+ className: "drag-overlay",
1537
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1538
+ children: "Suelta las im\xE1genes aqu\xED"
1539
+ })
1540
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
1541
+ children: thumbs()
1542
+ })]
1543
+ })), ((_state$images_values12 = state.images_values) === null || _state$images_values12 === void 0 ? void 0 : _state$images_values12.values.length) === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1547
1544
  style: {
1548
- fontSize: "14px",
1549
- color: "#999",
1550
- marginBottom: "20px"
1545
+ position: "absolute",
1546
+ top: "50%",
1547
+ left: "50%",
1548
+ transform: "translate(-50%, -50%)",
1549
+ textAlign: "center",
1550
+ padding: "40px",
1551
+ width: "80%",
1552
+ maxWidth: "500px",
1553
+ fontFamily: "Arial, sans-serif"
1551
1554
  },
1552
- children: ["Arrastra las im\xE1genes aqu\xED o", " ", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1553
- onClick: open,
1555
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1554
1556
  style: {
1555
- color: "#007bff",
1556
- cursor: "pointer",
1557
- textDecoration: "underline"
1557
+ fontSize: "18px",
1558
+ color: "#666",
1559
+ marginBottom: "16px"
1558
1560
  },
1559
- children: "haz clic para abrir el explorador de archivos"
1561
+ children: "Este producto no tiene im\xE1genes"
1562
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
1563
+ style: {
1564
+ fontSize: "14px",
1565
+ color: "#999",
1566
+ marginBottom: "20px"
1567
+ },
1568
+ children: ["Arrastra las im\xE1genes aqu\xED o", " ", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1569
+ onClick: open,
1570
+ style: {
1571
+ color: "#007bff",
1572
+ cursor: "pointer",
1573
+ textDecoration: "underline"
1574
+ },
1575
+ children: "haz clic para abrir el explorador de archivos"
1576
+ })]
1560
1577
  })]
1561
1578
  })]
1562
1579
  })]
1563
- })]
1564
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1565
- text: "No cuentas con este servicio",
1566
- headerType: "input-name-header"
1567
- }))]
1568
- })
1569
- })]
1570
- })
1580
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1581
+ text: "No cuentas con este servicio",
1582
+ headerType: "input-name-header"
1583
+ }))]
1584
+ })
1585
+ })]
1586
+ })
1587
+ })]
1571
1588
  })]
1572
- })]
1589
+ })
1573
1590
  });
1574
1591
  };
1575
1592