contentoh-components-library 21.6.44 → 21.6.46

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.
@@ -77,6 +77,8 @@ var _LinkVariantsModal = require("../../organisms/LinkVariantsModal");
77
77
 
78
78
  var _UnlinkVariantModal = require("../../organisms/UnlinkVariantModal");
79
79
 
80
+ var _VariantGroupModal = require("../../organisms/VariantGroupModal");
81
+
80
82
  var _PropagateChangesModal = require("../../organisms/PropagateChangesModal");
81
83
 
82
84
  var _api = require("../../organisms/LinkVariantsModal/api");
@@ -162,81 +164,81 @@ function regenerateVideoThumbnails(_x) {
162
164
  }
163
165
 
164
166
  function _regenerateVideoThumbnails() {
165
- _regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(values) {
166
- return _regenerator.default.wrap(function _callee19$(_context19) {
167
+ _regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(values) {
168
+ return _regenerator.default.wrap(function _callee21$(_context21) {
167
169
  while (1) {
168
- switch (_context19.prev = _context19.next) {
170
+ switch (_context21.prev = _context21.next) {
169
171
  case 0:
170
172
  if (Array.isArray(values)) {
171
- _context19.next = 2;
173
+ _context21.next = 2;
172
174
  break;
173
175
  }
174
176
 
175
- return _context19.abrupt("return", values);
177
+ return _context21.abrupt("return", values);
176
178
 
177
179
  case 2:
178
- return _context19.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
179
- var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(value) {
180
+ return _context21.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
181
+ var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(value) {
180
182
  var base64, videoSrc, thumbnail;
181
- return _regenerator.default.wrap(function _callee18$(_context18) {
183
+ return _regenerator.default.wrap(function _callee20$(_context20) {
182
184
  while (1) {
183
- switch (_context18.prev = _context18.next) {
185
+ switch (_context20.prev = _context20.next) {
184
186
  case 0:
185
187
  if (!((value === null || value === void 0 ? void 0 : value.ext) !== "mp4" || !(value !== null && value !== void 0 && value.srcDB))) {
186
- _context18.next = 2;
188
+ _context20.next = 2;
187
189
  break;
188
190
  }
189
191
 
190
- return _context18.abrupt("return", value);
192
+ return _context20.abrupt("return", value);
191
193
 
192
194
  case 2:
193
- _context18.prev = 2;
194
- _context18.next = 5;
195
+ _context20.prev = 2;
196
+ _context20.next = 5;
195
197
  return convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB);
196
198
 
197
199
  case 5:
198
- base64 = _context18.sent;
200
+ base64 = _context20.sent;
199
201
  videoSrc = "data:video/mp4;base64," + base64.split(",")[1];
200
- _context18.next = 9;
202
+ _context20.next = 9;
201
203
  return (0, _generateThumnail.default)(videoSrc, 2);
202
204
 
203
205
  case 9:
204
- thumbnail = _context18.sent;
205
- return _context18.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
206
+ thumbnail = _context20.sent;
207
+ return _context20.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
206
208
  src: thumbnail
207
209
  }));
208
210
 
209
211
  case 13:
210
- _context18.prev = 13;
211
- _context18.t0 = _context18["catch"](2);
212
- console.error("Error al generar thumbnail del video:", _context18.t0);
213
- return _context18.abrupt("return", value);
212
+ _context20.prev = 13;
213
+ _context20.t0 = _context20["catch"](2);
214
+ console.error("Error al generar thumbnail del video:", _context20.t0);
215
+ return _context20.abrupt("return", value);
214
216
 
215
217
  case 17:
216
218
  case "end":
217
- return _context18.stop();
219
+ return _context20.stop();
218
220
  }
219
221
  }
220
- }, _callee18, null, [[2, 13]]);
222
+ }, _callee20, null, [[2, 13]]);
221
223
  }));
222
224
 
223
225
  return function (_x10) {
224
- return _ref23.apply(this, arguments);
226
+ return _ref25.apply(this, arguments);
225
227
  };
226
228
  }())));
227
229
 
228
230
  case 3:
229
231
  case "end":
230
- return _context19.stop();
232
+ return _context21.stop();
231
233
  }
232
234
  }
233
- }, _callee19);
235
+ }, _callee21);
234
236
  }));
235
237
  return _regenerateVideoThumbnails.apply(this, arguments);
236
238
  }
237
239
 
238
240
  var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
239
- var _state$product10, _family$variants, _state$product11, _state$errors, _family$variants2, _state$product15, _state$product16, _state$product17, _state$active_retaile6, _location$state, _location$state2, _state$active_retaile7, _state$active_retaile8, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product18, _state$active_retaile9, _family$variants3, _family$variants4, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile10, _state$active_retaile11, _state$active_retaile12, _state$product24, _state$services2, _state$services2$data, _state$product25, _state$product26, _state$datasheets_inp, _state$datasheets_inp2, _state$product27, _state$images_values12, _state$comment;
241
+ var _state$product10, _family$variants, _state$product11, _state$product15, _state$errors, _family$variants2, _state$product19, _state$product20, _state$product21, _state$active_retaile6, _state$product22, _state$product23, _state$product24, _variantGroup$group, _location$state, _location$state2, _state$active_retaile7, _state$active_retaile8, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product25, _state$active_retaile9, _family$variants3, _family$variants4, _variantGroup$members, _variantGroup$members2, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile10, _state$active_retaile11, _state$active_retaile12, _state$product31, _state$services2, _state$services2$data, _state$product32, _state$product33, _state$datasheets_inp, _state$datasheets_inp2, _state$product34, _state$images_values12, _state$comment;
240
242
 
241
243
  var tabsSections = _ref.tabsSections,
242
244
  _ref$productSelected = _ref.productSelected,
@@ -332,56 +334,77 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
332
334
  var _useState27 = (0, _react.useState)(null),
333
335
  _useState28 = (0, _slicedToArray2.default)(_useState27, 2),
334
336
  loadingVariant = _useState28[0],
335
- setLoadingVariant = _useState28[1]; // Qué vínculo se está por romper, o null si no hay diálogo abierto. Guarda al
336
- // HIJO, que es quien lleva la relación y lo que pide la acción `unlink`.
337
+ setLoadingVariant = _useState28[1];
338
+ /*
339
+ Agrupación de variantes. Aparte del padre/hijo a propósito: son mecanismos
340
+ independientes y un producto puede tener los dos. Padre/hijo es herencia;
341
+ esto es solo un código compartido.
342
+ */
337
343
 
338
344
 
339
345
  var _useState29 = (0, _react.useState)(null),
340
346
  _useState30 = (0, _slicedToArray2.default)(_useState29, 2),
341
- porDesvincular = _useState30[0],
342
- setPorDesvincular = _useState30[1]; // Por qué un salto no se pudo hacer. Vive aparte de `family.error` porque no
343
- // es un fallo al leer la familia, sino al abrir uno de sus miembros.
344
-
347
+ variantGroup = _useState30[0],
348
+ setVariantGroup = _useState30[1];
345
349
 
346
- var _useState31 = (0, _react.useState)(null),
350
+ var _useState31 = (0, _react.useState)(false),
347
351
  _useState32 = (0, _slicedToArray2.default)(_useState31, 2),
348
- avisoFamilia = _useState32[0],
349
- setAvisoFamilia = _useState32[1];
352
+ showGroup = _useState32[0],
353
+ setShowGroup = _useState32[1];
350
354
 
351
- var _useState33 = (0, _react.useState)(null),
355
+ var _useState33 = (0, _react.useState)(false),
352
356
  _useState34 = (0, _slicedToArray2.default)(_useState33, 2),
353
- pendingPropagation = _useState34[0],
354
- setPendingPropagation = _useState34[1];
357
+ showGroupModal = _useState34[0],
358
+ setShowGroupModal = _useState34[1]; // Qué vínculo se está por romper, o null si no hay diálogo abierto. Guarda al
359
+ // HIJO, que es quien lleva la relación y lo que pide la acción `unlink`.
355
360
 
356
- var _useState35 = (0, _react.useState)(false),
361
+
362
+ var _useState35 = (0, _react.useState)(null),
357
363
  _useState36 = (0, _slicedToArray2.default)(_useState35, 2),
358
- preparandoPropagacion = _useState36[0],
359
- setPreparandoPropagacion = _useState36[1];
364
+ porDesvincular = _useState36[0],
365
+ setPorDesvincular = _useState36[1]; // Por qué un salto no se pudo hacer. Vive aparte de `family.error` porque no
366
+ // es un fallo al leer la familia, sino al abrir uno de sus miembros.
360
367
 
361
- var _useState37 = (0, _react.useState)([]),
368
+
369
+ var _useState37 = (0, _react.useState)(null),
362
370
  _useState38 = (0, _slicedToArray2.default)(_useState37, 2),
363
- auditServices = _useState38[0],
364
- setAuditServices = _useState38[1];
371
+ avisoFamilia = _useState38[0],
372
+ setAvisoFamilia = _useState38[1];
365
373
 
366
- var _useState39 = (0, _react.useState)([]),
374
+ var _useState39 = (0, _react.useState)(null),
367
375
  _useState40 = (0, _slicedToArray2.default)(_useState39, 2),
368
- auditDatasheets = _useState40[0],
369
- setAuditDatasheets = _useState40[1];
376
+ pendingPropagation = _useState40[0],
377
+ setPendingPropagation = _useState40[1];
370
378
 
371
- var _useState41 = (0, _react.useState)([]),
379
+ var _useState41 = (0, _react.useState)(false),
372
380
  _useState42 = (0, _slicedToArray2.default)(_useState41, 2),
373
- auditDescriptions = _useState42[0],
374
- setAuditDescriptions = _useState42[1];
381
+ preparandoPropagacion = _useState42[0],
382
+ setPreparandoPropagacion = _useState42[1];
375
383
 
376
- var _useState43 = (0, _react.useState)(false),
384
+ var _useState43 = (0, _react.useState)([]),
377
385
  _useState44 = (0, _slicedToArray2.default)(_useState43, 2),
378
- showModal = _useState44[0],
379
- setShowModal = _useState44[1];
386
+ auditServices = _useState44[0],
387
+ setAuditServices = _useState44[1];
380
388
 
381
- var _useState45 = (0, _react.useState)(false),
389
+ var _useState45 = (0, _react.useState)([]),
382
390
  _useState46 = (0, _slicedToArray2.default)(_useState45, 2),
383
- compare = _useState46[0],
384
- setCompare = _useState46[1];
391
+ auditDatasheets = _useState46[0],
392
+ setAuditDatasheets = _useState46[1];
393
+
394
+ var _useState47 = (0, _react.useState)([]),
395
+ _useState48 = (0, _slicedToArray2.default)(_useState47, 2),
396
+ auditDescriptions = _useState48[0],
397
+ setAuditDescriptions = _useState48[1];
398
+
399
+ var _useState49 = (0, _react.useState)(false),
400
+ _useState50 = (0, _slicedToArray2.default)(_useState49, 2),
401
+ showModal = _useState50[0],
402
+ setShowModal = _useState50[1];
403
+
404
+ var _useState51 = (0, _react.useState)(false),
405
+ _useState52 = (0, _slicedToArray2.default)(_useState51, 2),
406
+ compare = _useState52[0],
407
+ setCompare = _useState52[1];
385
408
 
386
409
  var _useDropzone = (0, _reactDropzone.useDropzone)({
387
410
  accept: "image/*, video/mp4",
@@ -517,10 +540,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
517
540
  isDragActive = _useDropzone.isDragActive,
518
541
  open = _useDropzone.open;
519
542
 
520
- var _useState47 = (0, _react.useState)(false),
521
- _useState48 = (0, _slicedToArray2.default)(_useState47, 2),
522
- openChangeStatusModal = _useState48[0],
523
- setOpenChangeStatusModal = _useState48[1];
543
+ var _useState53 = (0, _react.useState)(false),
544
+ _useState54 = (0, _slicedToArray2.default)(_useState53, 2),
545
+ openChangeStatusModal = _useState54[0],
546
+ setOpenChangeStatusModal = _useState54[1];
524
547
 
525
548
  var thumbs = function thumbs() {
526
549
  var _state$images_values, _state$images_values$, _state$images_values4, _state$images_values5, _state$images_values6, _state$images_values7, _state$images_values8, _state$images_values9;
@@ -1370,19 +1393,159 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1370
1393
 
1371
1394
  loadData(false);
1372
1395
  };
1396
+ /*
1397
+ Trae el grupo de variantes y sus miembros.
1398
+ Al montar, no al abrir el desplegable: `variant_group` no lo devuelve el
1399
+ endpoint del listado, así que sin esta llamada la ficha no sabe si el
1400
+ producto está agrupado.
1401
+ */
1373
1402
 
1374
- var openFamilyMember = /*#__PURE__*/function () {
1375
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(articleId) {
1376
- var _readPayload, res, _ref12, data, encontrado;
1403
+
1404
+ var loadVariantGroup = /*#__PURE__*/function () {
1405
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1406
+ var forzar,
1407
+ _state$product13,
1408
+ res,
1409
+ data,
1410
+ _args7 = arguments;
1377
1411
 
1378
1412
  return _regenerator.default.wrap(function _callee7$(_context7) {
1379
1413
  while (1) {
1380
1414
  switch (_context7.prev = _context7.next) {
1415
+ case 0:
1416
+ forzar = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
1417
+
1418
+ if (!(variantGroup && !forzar)) {
1419
+ _context7.next = 3;
1420
+ break;
1421
+ }
1422
+
1423
+ return _context7.abrupt("return", variantGroup);
1424
+
1425
+ case 3:
1426
+ _context7.prev = 3;
1427
+ _context7.next = 6;
1428
+ return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/group"), {
1429
+ articleId: (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.id_article
1430
+ }, {
1431
+ headers: {
1432
+ Authorization: token
1433
+ }
1434
+ });
1435
+
1436
+ case 6:
1437
+ res = _context7.sent;
1438
+ data = (0, _api.readPayload)(res);
1439
+ setVariantGroup(data);
1440
+ return _context7.abrupt("return", data);
1441
+
1442
+ case 12:
1443
+ _context7.prev = 12;
1444
+ _context7.t0 = _context7["catch"](3);
1445
+ console.error("loadVariantGroup: ", _context7.t0);
1446
+ setVariantGroup({
1447
+ group: null,
1448
+ members: [],
1449
+ error: true
1450
+ });
1451
+ return _context7.abrupt("return", null);
1452
+
1453
+ case 17:
1454
+ case "end":
1455
+ return _context7.stop();
1456
+ }
1457
+ }
1458
+ }, _callee7, null, [[3, 12]]);
1459
+ }));
1460
+
1461
+ return function loadVariantGroup() {
1462
+ return _ref11.apply(this, arguments);
1463
+ };
1464
+ }();
1465
+
1466
+ (0, _react.useEffect)(function () {
1467
+ var _state$product14;
1468
+
1469
+ if (!((_state$product14 = state.product) !== null && _state$product14 !== void 0 && _state$product14.id_article)) return;
1470
+ loadVariantGroup(true); // eslint-disable-next-line react-hooks/exhaustive-deps
1471
+ }, [(_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article]);
1472
+
1473
+ var handleOnLeaveGroup = /*#__PURE__*/function () {
1474
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1475
+ var _state$product16, res;
1476
+
1477
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1478
+ while (1) {
1479
+ switch (_context8.prev = _context8.next) {
1480
+ case 0:
1481
+ _context8.prev = 0;
1482
+ _context8.next = 3;
1483
+ return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/leave"), {
1484
+ articleId: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.id_article
1485
+ }, {
1486
+ headers: {
1487
+ Authorization: token
1488
+ }
1489
+ });
1490
+
1491
+ case 3:
1492
+ res = _context8.sent;
1493
+ setVariantGroup((0, _api.readPayload)(res));
1494
+ setShowGroup(false);
1495
+ _context8.next = 12;
1496
+ break;
1497
+
1498
+ case 8:
1499
+ _context8.prev = 8;
1500
+ _context8.t0 = _context8["catch"](0);
1501
+ console.error("leaveVariantGroup: ", _context8.t0);
1502
+ dispatch({
1503
+ type: "SET_MODAL",
1504
+ payload: {
1505
+ show: true,
1506
+ title: "Variantes",
1507
+ message: "No se pudo quitar el producto del grupo. Intenta de nuevo.",
1508
+ image: _genericModalWarning.default,
1509
+ buttons: [{
1510
+ text: "Entendido",
1511
+ buttonType: "general-white-button",
1512
+ action: function action() {
1513
+ return dispatch({
1514
+ type: "SET_MODAL",
1515
+ payload: {
1516
+ show: false
1517
+ }
1518
+ });
1519
+ }
1520
+ }]
1521
+ }
1522
+ });
1523
+
1524
+ case 12:
1525
+ case "end":
1526
+ return _context8.stop();
1527
+ }
1528
+ }
1529
+ }, _callee8, null, [[0, 8]]);
1530
+ }));
1531
+
1532
+ return function handleOnLeaveGroup() {
1533
+ return _ref12.apply(this, arguments);
1534
+ };
1535
+ }();
1536
+
1537
+ var openFamilyMember = /*#__PURE__*/function () {
1538
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(articleId) {
1539
+ var _readPayload, res, _ref14, data, encontrado;
1540
+
1541
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1542
+ while (1) {
1543
+ switch (_context9.prev = _context9.next) {
1381
1544
  case 0:
1382
1545
  setLoadingVariant(articleId);
1383
1546
  setAvisoFamilia(null);
1384
- _context7.prev = 2;
1385
- _context7.next = 5;
1547
+ _context9.prev = 2;
1548
+ _context9.next = 5;
1386
1549
  return _axios.default.get("".concat(process.env.REACT_APP_ORDERED_SERVICES_ENDPOINT), {
1387
1550
  params: {
1388
1551
  filterByIdArticle: articleId,
@@ -1394,11 +1557,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1394
1557
  });
1395
1558
 
1396
1559
  case 5:
1397
- res = _context7.sent;
1560
+ res = _context9.sent;
1398
1561
  // read-order-services responde { total, data: [...] }. La vista trae una
1399
1562
  // fila por orden, así que puede haber varias del mismo artículo; llegan
1400
1563
  // ordenadas por order_id DESC y la primera es la orden más reciente.
1401
- _ref12 = (_readPayload = (0, _api.readPayload)(res)) !== null && _readPayload !== void 0 ? _readPayload : {}, data = _ref12.data;
1564
+ _ref14 = (_readPayload = (0, _api.readPayload)(res)) !== null && _readPayload !== void 0 ? _readPayload : {}, data = _ref14.data;
1402
1565
  encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
1403
1566
  var _item$article;
1404
1567
 
@@ -1406,12 +1569,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1406
1569
  });
1407
1570
 
1408
1571
  if (encontrado) {
1409
- _context7.next = 11;
1572
+ _context9.next = 11;
1410
1573
  break;
1411
1574
  }
1412
1575
 
1413
1576
  setAvisoFamilia("Ese producto no está en ninguna orden de trabajo, así que no se puede abrir desde aquí.");
1414
- return _context7.abrupt("return");
1577
+ return _context9.abrupt("return");
1415
1578
 
1416
1579
  case 11:
1417
1580
  sessionStorage.setItem("productSelected", JSON.stringify(encontrado));
@@ -1422,30 +1585,30 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1422
1585
  product: [encontrado]
1423
1586
  }));
1424
1587
  window.location.assign("/EditProducts");
1425
- _context7.next = 21;
1588
+ _context9.next = 21;
1426
1589
  break;
1427
1590
 
1428
1591
  case 17:
1429
- _context7.prev = 17;
1430
- _context7.t0 = _context7["catch"](2);
1431
- console.error("openFamilyMember: ", _context7.t0);
1592
+ _context9.prev = 17;
1593
+ _context9.t0 = _context9["catch"](2);
1594
+ console.error("openFamilyMember: ", _context9.t0);
1432
1595
  setAvisoFamilia("No se pudo abrir ese producto. Intenta de nuevo.");
1433
1596
 
1434
1597
  case 21:
1435
- _context7.prev = 21;
1598
+ _context9.prev = 21;
1436
1599
  setLoadingVariant(null);
1437
- return _context7.finish(21);
1600
+ return _context9.finish(21);
1438
1601
 
1439
1602
  case 24:
1440
1603
  case "end":
1441
- return _context7.stop();
1604
+ return _context9.stop();
1442
1605
  }
1443
1606
  }
1444
- }, _callee7, null, [[2, 17, 21, 24]]);
1607
+ }, _callee9, null, [[2, 17, 21, 24]]);
1445
1608
  }));
1446
1609
 
1447
1610
  return function openFamilyMember(_x3) {
1448
- return _ref11.apply(this, arguments);
1611
+ return _ref13.apply(this, arguments);
1449
1612
  };
1450
1613
  }();
1451
1614
  /*
@@ -1456,11 +1619,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1456
1619
 
1457
1620
 
1458
1621
  var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
1459
- var _state$product$varian2, _state$product13, _result$linked, _result$parentArticle;
1622
+ var _state$product$varian2, _state$product17, _result$linked, _result$parentArticle;
1460
1623
 
1461
1624
  if (!result) return;
1462
1625
  var updatedProduct = result.mode === "children" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1463
- variantsCount: ((_state$product$varian2 = (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
1626
+ variantsCount: ((_state$product$varian2 = (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
1464
1627
  }) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
1465
1628
  parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
1466
1629
  variantsCount: 0
@@ -1534,31 +1697,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1534
1697
 
1535
1698
 
1536
1699
  var handleOnRestoreInheritance = /*#__PURE__*/function () {
1537
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(attributeId) {
1538
- var _state$product14;
1700
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(attributeId) {
1701
+ var _state$product18;
1539
1702
 
1540
1703
  var kind,
1541
1704
  esDescripcion,
1542
1705
  res,
1543
1706
  data,
1544
- _args8 = arguments;
1545
- return _regenerator.default.wrap(function _callee8$(_context8) {
1707
+ _args10 = arguments;
1708
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1546
1709
  while (1) {
1547
- switch (_context8.prev = _context8.next) {
1710
+ switch (_context10.prev = _context10.next) {
1548
1711
  case 0:
1549
- kind = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : "attribute";
1712
+ kind = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : "attribute";
1550
1713
 
1551
- if (!(!attributeId || !((_state$product14 = state.product) !== null && _state$product14 !== void 0 && _state$product14.id_article))) {
1552
- _context8.next = 3;
1714
+ if (!(!attributeId || !((_state$product18 = state.product) !== null && _state$product18 !== void 0 && _state$product18.id_article))) {
1715
+ _context10.next = 3;
1553
1716
  break;
1554
1717
  }
1555
1718
 
1556
- return _context8.abrupt("return");
1719
+ return _context10.abrupt("return");
1557
1720
 
1558
1721
  case 3:
1559
1722
  esDescripcion = kind === "description";
1560
- _context8.prev = 4;
1561
- _context8.next = 7;
1723
+ _context10.prev = 4;
1724
+ _context10.next = 7;
1562
1725
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread5.default)({
1563
1726
  articleId: state.product.id_article
1564
1727
  }, esDescripcion ? {
@@ -1572,11 +1735,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1572
1735
  });
1573
1736
 
1574
1737
  case 7:
1575
- res = _context8.sent;
1738
+ res = _context10.sent;
1576
1739
  data = (0, _api.readPayload)(res);
1577
1740
 
1578
1741
  if (!esDescripcion) {
1579
- _context8.next = 12;
1742
+ _context10.next = 12;
1580
1743
  break;
1581
1744
  }
1582
1745
 
@@ -1590,7 +1753,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1590
1753
  };
1591
1754
  })
1592
1755
  });
1593
- return _context8.abrupt("return");
1756
+ return _context10.abrupt("return");
1594
1757
 
1595
1758
  case 12:
1596
1759
  dispatch({
@@ -1603,24 +1766,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1603
1766
  };
1604
1767
  })
1605
1768
  });
1606
- _context8.next = 18;
1769
+ _context10.next = 18;
1607
1770
  break;
1608
1771
 
1609
1772
  case 15:
1610
- _context8.prev = 15;
1611
- _context8.t0 = _context8["catch"](4);
1612
- console.error("restoreInheritance: ", _context8.t0);
1773
+ _context10.prev = 15;
1774
+ _context10.t0 = _context10["catch"](4);
1775
+ console.error("restoreInheritance: ", _context10.t0);
1613
1776
 
1614
1777
  case 18:
1615
1778
  case "end":
1616
- return _context8.stop();
1779
+ return _context10.stop();
1617
1780
  }
1618
1781
  }
1619
- }, _callee8, null, [[4, 15]]);
1782
+ }, _callee10, null, [[4, 15]]);
1620
1783
  }));
1621
1784
 
1622
1785
  return function handleOnRestoreInheritance(_x4) {
1623
- return _ref13.apply(this, arguments);
1786
+ return _ref15.apply(this, arguments);
1624
1787
  };
1625
1788
  }();
1626
1789
  /*
@@ -1647,45 +1810,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1647
1810
  };
1648
1811
 
1649
1812
  var handleOnClickSave = /*#__PURE__*/function () {
1650
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1813
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1651
1814
  var _familia$variants, cambios, familia, hijos;
1652
1815
 
1653
- return _regenerator.default.wrap(function _callee9$(_context9) {
1816
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1654
1817
  while (1) {
1655
- switch (_context9.prev = _context9.next) {
1818
+ switch (_context11.prev = _context11.next) {
1656
1819
  case 0:
1657
1820
  if (!(state.saving || preparandoPropagacion)) {
1658
- _context9.next = 2;
1821
+ _context11.next = 2;
1659
1822
  break;
1660
1823
  }
1661
1824
 
1662
- return _context9.abrupt("return");
1825
+ return _context11.abrupt("return");
1663
1826
 
1664
1827
  case 2:
1665
- _context9.t0 = state.active_tab;
1666
- _context9.next = _context9.t0 === "Descripción" ? 5 : _context9.t0 === "Ficha técnica" ? 8 : _context9.t0 === "Imágenes" ? 32 : 35;
1828
+ _context11.t0 = state.active_tab;
1829
+ _context11.next = _context11.t0 === "Descripción" ? 5 : _context11.t0 === "Ficha técnica" ? 8 : _context11.t0 === "Imágenes" ? 32 : 35;
1667
1830
  break;
1668
1831
 
1669
1832
  case 5:
1670
- _context9.next = 7;
1833
+ _context11.next = 7;
1671
1834
  return saveDescriptions(token);
1672
1835
 
1673
1836
  case 7:
1674
- return _context9.abrupt("break", 36);
1837
+ return _context11.abrupt("break", 36);
1675
1838
 
1676
1839
  case 8:
1677
1840
  cambios = cambiosDeFichaTecnica();
1678
1841
 
1679
1842
  if (!(cambios.length === 0)) {
1680
- _context9.next = 13;
1843
+ _context11.next = 13;
1681
1844
  break;
1682
1845
  }
1683
1846
 
1684
- _context9.next = 12;
1847
+ _context11.next = 12;
1685
1848
  return saveDatasheets(token);
1686
1849
 
1687
1850
  case 12:
1688
- return _context9.abrupt("break", 36);
1851
+ return _context11.abrupt("break", 36);
1689
1852
 
1690
1853
  case 13:
1691
1854
  /*
@@ -1704,21 +1867,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1704
1867
  */
1705
1868
  setPreparandoPropagacion(true);
1706
1869
  familia = null;
1707
- _context9.prev = 15;
1708
- _context9.next = 18;
1870
+ _context11.prev = 15;
1871
+ _context11.next = 18;
1709
1872
  return loadFamily(true);
1710
1873
 
1711
1874
  case 18:
1712
- familia = _context9.sent;
1875
+ familia = _context11.sent;
1713
1876
 
1714
1877
  case 19:
1715
- _context9.prev = 19;
1878
+ _context11.prev = 19;
1716
1879
  setPreparandoPropagacion(false);
1717
- return _context9.finish(19);
1880
+ return _context11.finish(19);
1718
1881
 
1719
1882
  case 22:
1720
1883
  if (!(!familia || familia.error)) {
1721
- _context9.next = 25;
1884
+ _context11.next = 25;
1722
1885
  break;
1723
1886
  }
1724
1887
 
@@ -1755,7 +1918,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1755
1918
  }]
1756
1919
  }
1757
1920
  });
1758
- return _context9.abrupt("return");
1921
+ return _context11.abrupt("return");
1759
1922
 
1760
1923
  case 25:
1761
1924
  hijos = ((_familia$variants = familia.variants) !== null && _familia$variants !== void 0 ? _familia$variants : []).filter(function (v) {
@@ -1763,46 +1926,46 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1763
1926
  });
1764
1927
 
1765
1928
  if (!(hijos.length > 0)) {
1766
- _context9.next = 29;
1929
+ _context11.next = 29;
1767
1930
  break;
1768
1931
  }
1769
1932
 
1770
1933
  setPendingPropagation({
1771
1934
  cambios: cambios
1772
1935
  });
1773
- return _context9.abrupt("return");
1936
+ return _context11.abrupt("return");
1774
1937
 
1775
1938
  case 29:
1776
- _context9.next = 31;
1939
+ _context11.next = 31;
1777
1940
  return saveDatasheets(token);
1778
1941
 
1779
1942
  case 31:
1780
- return _context9.abrupt("break", 36);
1943
+ return _context11.abrupt("break", 36);
1781
1944
 
1782
1945
  case 32:
1783
- _context9.next = 34;
1946
+ _context11.next = 34;
1784
1947
  return updateImages(token);
1785
1948
 
1786
1949
  case 34:
1787
- return _context9.abrupt("break", 36);
1950
+ return _context11.abrupt("break", 36);
1788
1951
 
1789
1952
  case 35:
1790
- return _context9.abrupt("break", 36);
1953
+ return _context11.abrupt("break", 36);
1791
1954
 
1792
1955
  case 36:
1793
- _context9.next = 38;
1956
+ _context11.next = 38;
1794
1957
  return loadData(false);
1795
1958
 
1796
1959
  case 38:
1797
1960
  case "end":
1798
- return _context9.stop();
1961
+ return _context11.stop();
1799
1962
  }
1800
1963
  }
1801
- }, _callee9, null, [[15,, 19, 22]]);
1964
+ }, _callee11, null, [[15,, 19, 22]]);
1802
1965
  }));
1803
1966
 
1804
1967
  return function handleOnClickSave() {
1805
- return _ref14.apply(this, arguments);
1968
+ return _ref16.apply(this, arguments);
1806
1969
  };
1807
1970
  }();
1808
1971
 
@@ -1870,24 +2033,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1870
2033
  };
1871
2034
 
1872
2035
  var handleOnApproveSingleService = /*#__PURE__*/function () {
1873
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1874
- return _regenerator.default.wrap(function _callee10$(_context10) {
2036
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
2037
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1875
2038
  while (1) {
1876
- switch (_context10.prev = _context10.next) {
2039
+ switch (_context12.prev = _context12.next) {
1877
2040
  case 0:
1878
- _context10.next = 2;
2041
+ _context12.next = 2;
1879
2042
  return sendSingleEvaluation("A");
1880
2043
 
1881
2044
  case 2:
1882
2045
  case "end":
1883
- return _context10.stop();
2046
+ return _context12.stop();
1884
2047
  }
1885
2048
  }
1886
- }, _callee10);
2049
+ }, _callee12);
1887
2050
  }));
1888
2051
 
1889
2052
  return function handleOnApproveSingleService() {
1890
- return _ref15.apply(this, arguments);
2053
+ return _ref17.apply(this, arguments);
1891
2054
  };
1892
2055
  }();
1893
2056
 
@@ -1896,21 +2059,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1896
2059
  };
1897
2060
 
1898
2061
  var sendSingleEvaluation = /*#__PURE__*/function () {
1899
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
2062
+ var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1900
2063
  var _state$product$id_ord, _state$active_retaile5;
1901
2064
 
1902
2065
  var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, articleStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _articleStatus, updatedStatusByRetailerForSend, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
1903
2066
 
1904
- return _regenerator.default.wrap(function _callee11$(_context11) {
2067
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1905
2068
  while (1) {
1906
- switch (_context11.prev = _context11.next) {
2069
+ switch (_context13.prev = _context13.next) {
1907
2070
  case 0:
1908
2071
  if (!state.saving) {
1909
- _context11.next = 2;
2072
+ _context13.next = 2;
1910
2073
  break;
1911
2074
  }
1912
2075
 
1913
- return _context11.abrupt("return");
2076
+ return _context13.abrupt("return");
1914
2077
 
1915
2078
  case 2:
1916
2079
  dispatch({
@@ -1931,16 +2094,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1931
2094
  retailerId: retailerId
1932
2095
  };
1933
2096
  activeTab = state.active_tab;
1934
- _context11.prev = 11;
2097
+ _context13.prev = 11;
1935
2098
 
1936
2099
  if (!result) {
1937
- _context11.next = 28;
2100
+ _context13.next = 28;
1938
2101
  break;
1939
2102
  }
1940
2103
 
1941
2104
  data.result = result;
1942
2105
  data.retailerId = retailerId;
1943
- _context11.next = 17;
2106
+ _context13.next = 17;
1944
2107
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1945
2108
  headers: {
1946
2109
  Authorization: token
@@ -1948,7 +2111,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1948
2111
  });
1949
2112
 
1950
2113
  case 17:
1951
- res = _context11.sent;
2114
+ res = _context13.sent;
1952
2115
  newStatuses = JSON.parse(res.data.body);
1953
2116
  serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
1954
2117
  articleStatus = newStatuses.newArticleStatus[articleId];
@@ -1979,7 +2142,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1979
2142
  image: _genericModalCheck.default
1980
2143
  }
1981
2144
  });
1982
- _context11.next = 33;
2145
+ _context13.next = 33;
1983
2146
  break;
1984
2147
 
1985
2148
  case 28:
@@ -1995,7 +2158,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1995
2158
  icon = _genericModalCheck.default;
1996
2159
  }
1997
2160
 
1998
- _context11.next = 32;
2161
+ _context13.next = 32;
1999
2162
  return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
2000
2163
  headers: {
2001
2164
  Authorization: token
@@ -2003,7 +2166,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2003
2166
  });
2004
2167
 
2005
2168
  case 32:
2006
- res = _context11.sent;
2169
+ res = _context13.sent;
2007
2170
 
2008
2171
  case 33:
2009
2172
  if (res.data.statusCode === 200) {
@@ -2088,13 +2251,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2088
2251
  });
2089
2252
  }
2090
2253
 
2091
- _context11.next = 40;
2254
+ _context13.next = 40;
2092
2255
  break;
2093
2256
 
2094
2257
  case 36:
2095
- _context11.prev = 36;
2096
- _context11.t0 = _context11["catch"](11);
2097
- console.error("Error sending evaluation:", _context11.t0);
2258
+ _context13.prev = 36;
2259
+ _context13.t0 = _context13["catch"](11);
2260
+ console.error("Error sending evaluation:", _context13.t0);
2098
2261
  dispatch({
2099
2262
  type: "SET_MODAL",
2100
2263
  payload: {
@@ -2106,45 +2269,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2106
2269
  });
2107
2270
 
2108
2271
  case 40:
2109
- _context11.prev = 40;
2272
+ _context13.prev = 40;
2110
2273
  dispatch({
2111
2274
  type: "SET_SAVING",
2112
2275
  payload: false
2113
2276
  });
2114
- return _context11.finish(40);
2277
+ return _context13.finish(40);
2115
2278
 
2116
2279
  case 43:
2117
2280
  case "end":
2118
- return _context11.stop();
2281
+ return _context13.stop();
2119
2282
  }
2120
2283
  }
2121
- }, _callee11, null, [[11, 36, 40, 43]]);
2284
+ }, _callee13, null, [[11, 36, 40, 43]]);
2122
2285
  }));
2123
2286
 
2124
2287
  return function sendSingleEvaluation(_x5) {
2125
- return _ref16.apply(this, arguments);
2288
+ return _ref18.apply(this, arguments);
2126
2289
  };
2127
2290
  }();
2128
2291
 
2129
2292
  var handleOnApproveAllServices = /*#__PURE__*/function () {
2130
- var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
2131
- return _regenerator.default.wrap(function _callee12$(_context12) {
2293
+ var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
2294
+ return _regenerator.default.wrap(function _callee14$(_context14) {
2132
2295
  while (1) {
2133
- switch (_context12.prev = _context12.next) {
2296
+ switch (_context14.prev = _context14.next) {
2134
2297
  case 0:
2135
- _context12.next = 2;
2298
+ _context14.next = 2;
2136
2299
  return sendBulkEvaluation("A");
2137
2300
 
2138
2301
  case 2:
2139
2302
  case "end":
2140
- return _context12.stop();
2303
+ return _context14.stop();
2141
2304
  }
2142
2305
  }
2143
- }, _callee12);
2306
+ }, _callee14);
2144
2307
  }));
2145
2308
 
2146
2309
  return function handleOnApproveAllServices() {
2147
- return _ref17.apply(this, arguments);
2310
+ return _ref19.apply(this, arguments);
2148
2311
  };
2149
2312
  }();
2150
2313
 
@@ -2154,18 +2317,18 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2154
2317
  };
2155
2318
 
2156
2319
  var sendBulkEvaluation = /*#__PURE__*/function () {
2157
- var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
2320
+ var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
2158
2321
  var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
2159
2322
 
2160
- return _regenerator.default.wrap(function _callee13$(_context13) {
2323
+ return _regenerator.default.wrap(function _callee15$(_context15) {
2161
2324
  while (1) {
2162
- switch (_context13.prev = _context13.next) {
2325
+ switch (_context15.prev = _context15.next) {
2163
2326
  case 0:
2164
2327
  dispatch({
2165
2328
  type: "SET_SAVING",
2166
2329
  payload: true
2167
2330
  });
2168
- _context13.prev = 1;
2331
+ _context15.prev = 1;
2169
2332
  evaluationArray = [];
2170
2333
  conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
2171
2334
  (_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
@@ -2190,7 +2353,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2190
2353
  }));
2191
2354
  }
2192
2355
  });
2193
- _context13.next = 7;
2356
+ _context15.next = 7;
2194
2357
  return Promise.all(evaluationArray);
2195
2358
 
2196
2359
  case 7:
@@ -2245,41 +2408,41 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2245
2408
  image: _genericModalCheck.default
2246
2409
  }
2247
2410
  });
2248
- _context13.next = 19;
2411
+ _context15.next = 19;
2249
2412
  break;
2250
2413
 
2251
2414
  case 16:
2252
- _context13.prev = 16;
2253
- _context13.t0 = _context13["catch"](1);
2254
- console.error("Error in bulk evaluation:", _context13.t0);
2415
+ _context15.prev = 16;
2416
+ _context15.t0 = _context15["catch"](1);
2417
+ console.error("Error in bulk evaluation:", _context15.t0);
2255
2418
 
2256
2419
  case 19:
2257
- _context13.prev = 19;
2420
+ _context15.prev = 19;
2258
2421
  dispatch({
2259
2422
  type: "SET_SAVING",
2260
2423
  payload: false
2261
2424
  });
2262
- return _context13.finish(19);
2425
+ return _context15.finish(19);
2263
2426
 
2264
2427
  case 22:
2265
2428
  case "end":
2266
- return _context13.stop();
2429
+ return _context15.stop();
2267
2430
  }
2268
2431
  }
2269
- }, _callee13, null, [[1, 16, 19, 22]]);
2432
+ }, _callee15, null, [[1, 16, 19, 22]]);
2270
2433
  }));
2271
2434
 
2272
2435
  return function sendBulkEvaluation(_x6) {
2273
- return _ref18.apply(this, arguments);
2436
+ return _ref20.apply(this, arguments);
2274
2437
  };
2275
2438
  }();
2276
2439
 
2277
2440
  var handleOnChangeAssignations = /*#__PURE__*/function () {
2278
- var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
2441
+ var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(assignationType, assignationId) {
2279
2442
  var concept, data, updatedProduct;
2280
- return _regenerator.default.wrap(function _callee14$(_context14) {
2443
+ return _regenerator.default.wrap(function _callee16$(_context16) {
2281
2444
  while (1) {
2282
- switch (_context14.prev = _context14.next) {
2445
+ switch (_context16.prev = _context16.next) {
2283
2446
  case 0:
2284
2447
  concept = (0, _utils.getConceptByTab)(state.active_tab);
2285
2448
  data = {
@@ -2290,7 +2453,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2290
2453
  concept: concept,
2291
2454
  userId: assignationId
2292
2455
  };
2293
- _context14.next = 4;
2456
+ _context16.next = 4;
2294
2457
  return (0, _axios.default)({
2295
2458
  method: "post",
2296
2459
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
@@ -2309,14 +2472,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2309
2472
 
2310
2473
  case 6:
2311
2474
  case "end":
2312
- return _context14.stop();
2475
+ return _context16.stop();
2313
2476
  }
2314
2477
  }
2315
- }, _callee14);
2478
+ }, _callee16);
2316
2479
  }));
2317
2480
 
2318
2481
  return function handleOnChangeAssignations(_x7, _x8) {
2319
- return _ref19.apply(this, arguments);
2482
+ return _ref21.apply(this, arguments);
2320
2483
  };
2321
2484
  }();
2322
2485
 
@@ -2351,16 +2514,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2351
2514
  };
2352
2515
 
2353
2516
  var handleOnSubmitComment = /*#__PURE__*/function () {
2354
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(e) {
2517
+ var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(e) {
2355
2518
  var commentText;
2356
- return _regenerator.default.wrap(function _callee15$(_context15) {
2519
+ return _regenerator.default.wrap(function _callee17$(_context17) {
2357
2520
  while (1) {
2358
- switch (_context15.prev = _context15.next) {
2521
+ switch (_context17.prev = _context17.next) {
2359
2522
  case 0:
2360
2523
  e.preventDefault();
2361
2524
  commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
2362
- _context15.prev = 2;
2363
- _context15.next = 5;
2525
+ _context17.prev = 2;
2526
+ _context17.next = 5;
2364
2527
  return createComment(commentText, token);
2365
2528
 
2366
2529
  case 5:
@@ -2373,13 +2536,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2373
2536
  image: _genericModalCheck.default
2374
2537
  }
2375
2538
  });
2376
- _context15.next = 12;
2539
+ _context17.next = 12;
2377
2540
  break;
2378
2541
 
2379
2542
  case 8:
2380
- _context15.prev = 8;
2381
- _context15.t0 = _context15["catch"](2);
2382
- console.error("Error saving comment:", _context15.t0);
2543
+ _context17.prev = 8;
2544
+ _context17.t0 = _context17["catch"](2);
2545
+ console.error("Error saving comment:", _context17.t0);
2383
2546
  dispatch({
2384
2547
  type: "SET_MODAL",
2385
2548
  payload: {
@@ -2392,14 +2555,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2392
2555
 
2393
2556
  case 12:
2394
2557
  case "end":
2395
- return _context15.stop();
2558
+ return _context17.stop();
2396
2559
  }
2397
2560
  }
2398
- }, _callee15, null, [[2, 8]]);
2561
+ }, _callee17, null, [[2, 8]]);
2399
2562
  }));
2400
2563
 
2401
2564
  return function handleOnSubmitComment(_x9) {
2402
- return _ref20.apply(this, arguments);
2565
+ return _ref22.apply(this, arguments);
2403
2566
  };
2404
2567
  }();
2405
2568
 
@@ -2734,15 +2897,28 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2734
2897
  saveDatasheets(token, propagation !== null && propagation !== void 0 ? propagation : undefined);
2735
2898
  }
2736
2899
  }), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
2737
- articleId: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article,
2738
- articleName: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.name,
2739
- articleUpc: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.upc,
2900
+ articleId: (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article,
2901
+ articleName: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.name,
2902
+ articleUpc: (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.upc,
2740
2903
  activeRetailerId: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
2741
2904
  token: token,
2742
2905
  onClose: function onClose() {
2743
2906
  return setShowLinkVariants(false);
2744
2907
  },
2745
2908
  onLinked: handleOnLinkedVariants
2909
+ }), showGroupModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VariantGroupModal.VariantGroupModal, {
2910
+ articleId: (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.id_article,
2911
+ articleName: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.name,
2912
+ articleUpc: (_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.upc,
2913
+ currentGroup: (_variantGroup$group = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) !== null && _variantGroup$group !== void 0 ? _variantGroup$group : null,
2914
+ token: token,
2915
+ onClose: function onClose() {
2916
+ return setShowGroupModal(false);
2917
+ },
2918
+ onSaved: function onSaved(result) {
2919
+ setVariantGroup(result);
2920
+ setShowGroup(true);
2921
+ }
2746
2922
  }), porDesvincular && /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnlinkVariantModal.UnlinkVariantModal, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, porDesvincular), {}, {
2747
2923
  token: token,
2748
2924
  onClose: function onClose() {
@@ -2769,21 +2945,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2769
2945
  type: "pink",
2770
2946
  label: "Aceptar",
2771
2947
  size: 12,
2772
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
2948
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
2773
2949
  var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
2774
- return _regenerator.default.wrap(function _callee16$(_context16) {
2950
+ return _regenerator.default.wrap(function _callee18$(_context18) {
2775
2951
  while (1) {
2776
- switch (_context16.prev = _context16.next) {
2952
+ switch (_context18.prev = _context18.next) {
2777
2953
  case 0:
2778
2954
  elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
2779
2955
 
2780
2956
  if (!(!elements || elements.length === 0)) {
2781
- _context16.next = 4;
2957
+ _context18.next = 4;
2782
2958
  break;
2783
2959
  }
2784
2960
 
2785
2961
  console.error("Elemento no encontrado");
2786
- return _context16.abrupt("return");
2962
+ return _context18.abrupt("return");
2787
2963
 
2788
2964
  case 4:
2789
2965
  isMessageEmpty = Array.from(elements).every(function (el) {
@@ -2792,7 +2968,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2792
2968
  });
2793
2969
 
2794
2970
  if (!isMessageEmpty) {
2795
- _context16.next = 10;
2971
+ _context18.next = 10;
2796
2972
  break;
2797
2973
  }
2798
2974
 
@@ -2807,13 +2983,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2807
2983
  container.appendChild(alert);
2808
2984
  }
2809
2985
 
2810
- return _context16.abrupt("return");
2986
+ return _context18.abrupt("return");
2811
2987
 
2812
2988
  case 10:
2813
2989
  fullMessage = Array.from(elements).map(function (element) {
2814
2990
  return element.innerHTML;
2815
2991
  }).join("").replace(/<br\s*\/?>/gi, "\n");
2816
- _context16.next = 13;
2992
+ _context18.next = 13;
2817
2993
  return createComment(fullMessage, token);
2818
2994
 
2819
2995
  case 13:
@@ -2822,10 +2998,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2822
2998
 
2823
2999
  case 15:
2824
3000
  case "end":
2825
- return _context16.stop();
3001
+ return _context18.stop();
2826
3002
  }
2827
3003
  }
2828
- }, _callee16);
3004
+ }, _callee18);
2829
3005
  }))
2830
3006
  }, "btn-Aceptar")]
2831
3007
  }), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
@@ -2903,7 +3079,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2903
3079
  lists: state.images_values || [],
2904
3080
  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] : {},
2905
3081
  assignationsImages: state.collaborator_assignations["Imágenes"],
2906
- imagesStatus: ((_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.images_status) || "-",
3082
+ imagesStatus: ((_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.images_status) || "-",
2907
3083
  retailerSelected: (_state$active_retaile9 = state.active_retailer) === null || _state$active_retaile9 === void 0 ? void 0 : _state$active_retaile9.id_retailer,
2908
3084
  isRetailer: isRetailer,
2909
3085
  version: state.product.version,
@@ -2991,13 +3167,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
2991
3167
  className: "desvincular",
2992
3168
  title: "Dejar de ser hijo de este producto",
2993
3169
  onClick: function onClick() {
2994
- var _state$product19, _state$product20, _state$product21;
3170
+ var _state$product26, _state$product27, _state$product28;
2995
3171
 
2996
3172
  return setPorDesvincular({
2997
3173
  mode: "self",
2998
- childArticleId: (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article,
2999
- childName: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.name,
3000
- childUpc: (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.upc,
3174
+ childArticleId: (_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.id_article,
3175
+ childName: (_state$product27 = state.product) === null || _state$product27 === void 0 ? void 0 : _state$product27.name,
3176
+ childUpc: (_state$product28 = state.product) === null || _state$product28 === void 0 ? void 0 : _state$product28.upc,
3001
3177
  parentName: family.parent.name,
3002
3178
  parentUpc: family.parent.upc
3003
3179
  });
@@ -3029,15 +3205,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3029
3205
  className: "desvincular",
3030
3206
  title: "Desvincular este hijo",
3031
3207
  onClick: function onClick() {
3032
- var _state$product22, _state$product23;
3208
+ var _state$product29, _state$product30;
3033
3209
 
3034
3210
  return setPorDesvincular({
3035
3211
  mode: "child",
3036
3212
  childArticleId: variant.articleId,
3037
3213
  childName: variant.name,
3038
3214
  childUpc: variant.upc,
3039
- parentName: (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.name,
3040
- parentUpc: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.upc
3215
+ parentName: (_state$product29 = state.product) === null || _state$product29 === void 0 ? void 0 : _state$product29.name,
3216
+ parentUpc: (_state$product30 = state.product) === null || _state$product30 === void 0 ? void 0 : _state$product30.upc
3041
3217
  });
3042
3218
  },
3043
3219
  children: "Desvincular"
@@ -3050,6 +3226,67 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3050
3226
  className: "loading",
3051
3227
  children: avisoFamilia
3052
3228
  })]
3229
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3230
+ className: "variants-actions",
3231
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
3232
+ type: "button",
3233
+ className: "link-variants",
3234
+ onClick: function onClick() {
3235
+ return setShowGroupModal(true);
3236
+ },
3237
+ children: variantGroup !== null && variantGroup !== void 0 && variantGroup.group ? "Cambiar de grupo" : "Agrupar variantes"
3238
+ }), (variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
3239
+ type: "button",
3240
+ className: "variants-count",
3241
+ "aria-expanded": showGroup,
3242
+ onClick: function onClick() {
3243
+ return setShowGroup(function (abierto) {
3244
+ return !abierto;
3245
+ });
3246
+ },
3247
+ children: ["Variante ", variantGroup.group, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
3248
+ "aria-hidden": "true",
3249
+ children: showGroup ? " ▴" : " ▾"
3250
+ })]
3251
+ })]
3252
+ }), showGroup && (variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
3253
+ className: "variants-family",
3254
+ children: [((_variantGroup$members = variantGroup.members) !== null && _variantGroup$members !== void 0 ? _variantGroup$members : []).filter(function (miembro) {
3255
+ return !miembro.isCurrent;
3256
+ }).map(function (miembro) {
3257
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
3258
+ className: "family-item",
3259
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
3260
+ type: "button",
3261
+ className: "family-row",
3262
+ disabled: loadingVariant !== null,
3263
+ onClick: function onClick() {
3264
+ return openFamilyMember(miembro.articleId);
3265
+ },
3266
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
3267
+ className: "role",
3268
+ children: loadingVariant === miembro.articleId ? "Abriendo…" : "Variante"
3269
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
3270
+ className: "name",
3271
+ children: miembro.name
3272
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
3273
+ className: "upc",
3274
+ children: miembro.upc
3275
+ })]
3276
+ })
3277
+ }, miembro.articleId);
3278
+ }), ((_variantGroup$members2 = variantGroup.members) !== null && _variantGroup$members2 !== void 0 ? _variantGroup$members2 : []).filter(function (m) {
3279
+ return !m.isCurrent;
3280
+ }).length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
3281
+ className: "loading",
3282
+ children: ["Este producto es el \xFAnico en el grupo ", variantGroup.group, "."]
3283
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
3284
+ type: "button",
3285
+ className: "desvincular",
3286
+ title: "Quitar este producto del grupo",
3287
+ onClick: handleOnLeaveGroup,
3288
+ children: "Quitar del grupo"
3289
+ })]
3053
3290
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader // states
3054
3291
  , {
3055
3292
  headerData: state.product,
@@ -3108,7 +3345,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3108
3345
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
3109
3346
  id: "services-information-container",
3110
3347
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
3111
- children: [state.active_tab === "Descripción" && (((_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
3348
+ children: [state.active_tab === "Descripción" && (((_state$product31 = state.product) === null || _state$product31 === void 0 ? void 0 : _state$product31.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
3112
3349
  activeSection: state.active_tab,
3113
3350
  inputGroup: state.descriptions_inputs[0],
3114
3351
  updatedDescriptions: state.updated_descriptions_inputs
@@ -3117,7 +3354,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3117
3354
  ,
3118
3355
  variant: (_state$services2 = state.services) === null || _state$services2 === void 0 ? void 0 : (_state$services2$data = _state$services2.datasheets) === null || _state$services2$data === void 0 ? void 0 : _state$services2$data.variant,
3119
3356
  onRestoreInheritance: handleOnRestoreInheritance,
3120
- articleId: (_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.id_article,
3357
+ articleId: (_state$product32 = state.product) === null || _state$product32 === void 0 ? void 0 : _state$product32.id_article,
3121
3358
  version: state.product.version,
3122
3359
  auditInputGroup: auditDescriptions[0],
3123
3360
  setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
@@ -3126,7 +3363,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3126
3363
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
3127
3364
  text: "No cuentas con este servicio",
3128
3365
  headerType: "input-name-header"
3129
- })), state.active_tab === "Ficha técnica" && (((_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
3366
+ })), state.active_tab === "Ficha técnica" && (((_state$product33 = state.product) === null || _state$product33 === void 0 ? void 0 : _state$product33.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
3130
3367
  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) {
3131
3368
  var _state$services3, _state$services3$data;
3132
3369
 
@@ -3147,7 +3384,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3147
3384
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
3148
3385
  text: "No cuentas con este servicio",
3149
3386
  headerType: "input-name-header"
3150
- })), state.active_tab === "Imágenes" && (((_state$product27 = state.product) === null || _state$product27 === void 0 ? void 0 : _state$product27.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
3387
+ })), state.active_tab === "Imágenes" && (((_state$product34 = state.product) === null || _state$product34 === void 0 ? void 0 : _state$product34.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
3151
3388
  children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
3152
3389
  checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
3153
3390
  ,
@@ -3239,20 +3476,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
3239
3476
  reviewed: crossComment
3240
3477
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
3241
3478
  buttonType: "circular-button accept-button",
3242
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
3243
- return _regenerator.default.wrap(function _callee17$(_context17) {
3479
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
3480
+ return _regenerator.default.wrap(function _callee19$(_context19) {
3244
3481
  while (1) {
3245
- switch (_context17.prev = _context17.next) {
3482
+ switch (_context19.prev = _context19.next) {
3246
3483
  case 0:
3247
3484
  setCrossComment(true);
3248
3485
  commentRevised();
3249
3486
 
3250
3487
  case 2:
3251
3488
  case "end":
3252
- return _context17.stop();
3489
+ return _context19.stop();
3253
3490
  }
3254
3491
  }
3255
- }, _callee17);
3492
+ }, _callee19);
3256
3493
  }))
3257
3494
  })]
3258
3495
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {