contentoh-components-library 21.6.34 → 21.6.36

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.
@@ -67,6 +67,8 @@ var _InputGroup = require("../../organisms/InputGroup");
67
67
 
68
68
  var _LinkVariantsModal = require("../../organisms/LinkVariantsModal");
69
69
 
70
+ var _UnlinkVariantModal = require("../../organisms/UnlinkVariantModal");
71
+
70
72
  var _PropagateChangesModal = require("../../organisms/PropagateChangesModal");
71
73
 
72
74
  var _api = require("../../organisms/LinkVariantsModal/api");
@@ -90,7 +92,7 @@ var _AiProductEdition = require("../../../contexts/AiProductEdition");
90
92
  var _jsxRuntime = require("react/jsx-runtime");
91
93
 
92
94
  var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
93
- var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _family$variants2, _state$product15, _state$product16, _state$product17, _state$active_retaile4, _location$state5, _location$state6, _state$active_retaile5, _state$active_retaile6, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile7, _state$product18, _state$product19, _state$product20, _state$product21, _family$variants3, _family$variants4, _family$variants5, _state$active_percent, _state$active_percent2, _state$active_retaile8, _state$active_retaile9, _state$active_retaile10, _state$product22, _state$descriptions_i, _state$services2, _state$services2$data, _state$product23, _state$product24, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product25, _state$images_values12;
95
+ var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _family$variants2, _state$product16, _state$product17, _state$product18, _state$active_retaile4, _location$state5, _location$state6, _state$active_retaile5, _state$active_retaile6, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile7, _state$product19, _state$product20, _state$product21, _state$product22, _family$variants3, _family$variants4, _family$variants5, _state$active_percent, _state$active_percent2, _state$active_retaile8, _state$active_retaile9, _state$active_retaile10, _state$product28, _state$descriptions_i, _state$services2, _state$services2$data, _state$product29, _state$product30, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product31, _state$images_values12;
94
96
 
95
97
  var tabsSections = _ref.tabsSections,
96
98
  _ref$productSelected = _ref.productSelected,
@@ -928,22 +930,27 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
928
930
 
929
931
  var loadFamily = /*#__PURE__*/function () {
930
932
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
931
- var _state$product11, res;
933
+ var forzar,
934
+ _state$product11,
935
+ res,
936
+ _args3 = arguments;
932
937
 
933
938
  return _regenerator.default.wrap(function _callee3$(_context3) {
934
939
  while (1) {
935
940
  switch (_context3.prev = _context3.next) {
936
941
  case 0:
937
- if (!family) {
938
- _context3.next = 2;
942
+ forzar = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
943
+
944
+ if (!(family && !forzar)) {
945
+ _context3.next = 3;
939
946
  break;
940
947
  }
941
948
 
942
949
  return _context3.abrupt("return", family);
943
950
 
944
- case 2:
945
- _context3.prev = 2;
946
- _context3.next = 5;
951
+ case 3:
952
+ _context3.prev = 3;
953
+ _context3.next = 6;
947
954
  return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/family"), {
948
955
  articleId: (_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.id_article
949
956
  }, {
@@ -952,15 +959,15 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
952
959
  }
953
960
  });
954
961
 
955
- case 5:
962
+ case 6:
956
963
  res = _context3.sent;
957
964
  setFamily((0, _api.readPayload)(res));
958
- _context3.next = 13;
965
+ _context3.next = 14;
959
966
  break;
960
967
 
961
- case 9:
962
- _context3.prev = 9;
963
- _context3.t0 = _context3["catch"](2);
968
+ case 10:
969
+ _context3.prev = 10;
970
+ _context3.t0 = _context3["catch"](3);
964
971
  console.error("loadFamily: ", _context3.t0);
965
972
  setFamily({
966
973
  variants: [],
@@ -968,12 +975,12 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
968
975
  error: true
969
976
  });
970
977
 
971
- case 13:
978
+ case 14:
972
979
  case "end":
973
980
  return _context3.stop();
974
981
  }
975
982
  }
976
- }, _callee3, null, [[2, 9]]);
983
+ }, _callee3, null, [[3, 10]]);
977
984
  }));
978
985
 
979
986
  return function loadFamily() {
@@ -1101,6 +1108,74 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1101
1108
  return _ref8.apply(this, arguments);
1102
1109
  };
1103
1110
  }();
1111
+ /*
1112
+ Qué vínculo se está por romper, o null si no hay diálogo abierto.
1113
+ Guarda al HIJO, porque la relación vive en él (`article.parent_article_id`)
1114
+ y es lo que pide la acción `unlink`. `mode` solo cambia el texto: no es lo
1115
+ mismo soltarse de un padre que soltar a un hijo, aunque por dentro sea la
1116
+ misma llamada.
1117
+ */
1118
+
1119
+
1120
+ var _useState33 = (0, _react.useState)(null),
1121
+ _useState34 = (0, _slicedToArray2.default)(_useState33, 2),
1122
+ porDesvincular = _useState34[0],
1123
+ setPorDesvincular = _useState34[1];
1124
+ /*
1125
+ Después de desvincular, esta ficha cambia de forma.
1126
+ Si el producto se soltó de su padre, deja de ser hijo y vuelve a poder ligar
1127
+ —el botón reaparece—. Si soltó a un hijo, pierde uno de la cuenta. En los dos
1128
+ casos hay que repreguntar la familia: lo que se ve en la lista ya no es lo
1129
+ que hay en el servidor.
1130
+ */
1131
+
1132
+
1133
+ var handleOnUnlinked = function handleOnUnlinked(result) {
1134
+ var _state$product$varian, _state$product12, _updatedProduct$varia;
1135
+
1136
+ if (!result) return;
1137
+ var updatedProduct = result.mode === "self" ? (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
1138
+ parentArticleId: null,
1139
+ variantsCount: 0
1140
+ }) : (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
1141
+ variantsCount: Math.max(((_state$product$varian = (_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 1) - 1, 0)
1142
+ });
1143
+ dispatch({
1144
+ type: "SET_PRODUCT",
1145
+ payload: updatedProduct
1146
+ });
1147
+
1148
+ try {
1149
+ sessionStorage.setItem("productSelected", JSON.stringify(updatedProduct));
1150
+ var productEdit = JSON.parse(sessionStorage.getItem("productEdit"));
1151
+
1152
+ if (productEdit) {
1153
+ sessionStorage.setItem("productEdit", JSON.stringify((0, _objectSpread4.default)((0, _objectSpread4.default)({}, productEdit), {}, {
1154
+ product: updatedProduct
1155
+ })));
1156
+ }
1157
+ } catch (error) {
1158
+ console.error("unlinkVariant/sessionStorage: ", error);
1159
+ }
1160
+ /*
1161
+ Si ya no queda familia, se cierra el desplegable: su botón desaparece con
1162
+ el vínculo, y dejarlo abierto pinta una caja que dice «no tiene hijos» y
1163
+ que nadie puede cerrar.
1164
+ */
1165
+
1166
+
1167
+ if (!updatedProduct.parentArticleId && ((_updatedProduct$varia = updatedProduct.variantsCount) !== null && _updatedProduct$varia !== void 0 ? _updatedProduct$varia : 0) === 0) {
1168
+ setShowFamily(false);
1169
+ }
1170
+
1171
+ loadFamily(true); // Y los servicios: al desvincular, el servidor pone `is_overridden = 0` en
1172
+ // todas las versiones, así que los chips de herencia tienen que dejar de
1173
+ // dibujarse. Sin esto la ficha sigue mostrándolos hasta que se recarga.
1174
+
1175
+ setLinkNonce(function (n) {
1176
+ return n + 1;
1177
+ });
1178
+ };
1104
1179
 
1105
1180
  var openVariant = /*#__PURE__*/function () {
1106
1181
  var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(articleId) {
@@ -1186,11 +1261,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1186
1261
 
1187
1262
 
1188
1263
  var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
1189
- var _state$product$varian, _state$product12, _result$linked, _result$parentArticle;
1264
+ var _state$product$varian2, _state$product13, _result$linked, _result$parentArticle;
1190
1265
 
1191
1266
  if (!result) return;
1192
1267
  var updatedProduct = result.mode === "children" ? (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
1193
- variantsCount: ((_state$product$varian = (_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
1268
+ 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
1194
1269
  }) : (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
1195
1270
  parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
1196
1271
  variantsCount: 0
@@ -1198,9 +1273,15 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1198
1273
  dispatch({
1199
1274
  type: "SET_PRODUCT",
1200
1275
  payload: updatedProduct
1201
- }); // La lista cacheada quedó vieja: se descarta para que vuelva a pedirse.
1276
+ });
1277
+ /*
1278
+ Se vuelve a pedir, no se vacía.
1279
+ `setFamily(null)` invalidaba la caché, pero la lista solo se pide al pulsar
1280
+ el desplegable: si estaba abierto al ligar, se quedaba en «Cargando
1281
+ familia…» para siempre, porque ya nadie iba a volver a pedirla.
1282
+ */
1202
1283
 
1203
- setFamily(null); // Y los servicios, para que los chips reflejen la herencia recién creada.
1284
+ loadFamily(true); // Y los servicios, para que los chips reflejen la herencia recién creada.
1204
1285
 
1205
1286
  setLinkNonce(function (n) {
1206
1287
  return n + 1;
@@ -1243,7 +1324,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1243
1324
 
1244
1325
  var handleOnRestoreInheritance = /*#__PURE__*/function () {
1245
1326
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(attributeId) {
1246
- var _state$product13;
1327
+ var _state$product14;
1247
1328
 
1248
1329
  var kind,
1249
1330
  esDescripcion,
@@ -1256,7 +1337,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1256
1337
  case 0:
1257
1338
  kind = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : "attribute";
1258
1339
 
1259
- if (!(!attributeId || !((_state$product13 = state.product) !== null && _state$product13 !== void 0 && _state$product13.id_article))) {
1340
+ if (!(!attributeId || !((_state$product14 = state.product) !== null && _state$product14 !== void 0 && _state$product14.id_article))) {
1260
1341
  _context6.next = 3;
1261
1342
  break;
1262
1343
  }
@@ -1366,7 +1447,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1366
1447
 
1367
1448
  var sendEvaluation = /*#__PURE__*/function () {
1368
1449
  var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
1369
- var _state$product$id_ord, _state$active_retaile3, _state$product$status, _state$product$status2, _state$product14;
1450
+ var _state$product$id_ord, _state$active_retaile3, _state$product$status, _state$product$status2, _state$product15;
1370
1451
 
1371
1452
  var concept, articleId, orderId, retailerId, evalStatus, data, _newStatuses$newStatu, _state$services_data, res, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, updatedServicesData;
1372
1453
 
@@ -1382,7 +1463,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1382
1463
  articleId = state.product.id_article;
1383
1464
  orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
1384
1465
  retailerId = (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer;
1385
- evalStatus = ((_state$product$status = state.product.statusByRetailer) === null || _state$product$status === void 0 ? void 0 : (_state$product$status2 = _state$product$status[retailerId]) === null || _state$product$status2 === void 0 ? void 0 : _state$product$status2[concept]) || state.product["".concat(concept, "_status")] || ((_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.version_status);
1466
+ evalStatus = ((_state$product$status = state.product.statusByRetailer) === null || _state$product$status === void 0 ? void 0 : (_state$product$status2 = _state$product$status[retailerId]) === null || _state$product$status2 === void 0 ? void 0 : _state$product$status2[concept]) || state.product["".concat(concept, "_status")] || ((_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.version_status);
1386
1467
  data = {
1387
1468
  articleId: articleId,
1388
1469
  orderId: orderId,
@@ -1878,16 +1959,22 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
1878
1959
  saveDatasheets(token, propagation !== null && propagation !== void 0 ? propagation : undefined);
1879
1960
  }
1880
1961
  }), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
1881
- articleId: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article,
1882
- articleName: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.name,
1883
- articleUpc: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.upc,
1962
+ articleId: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.id_article,
1963
+ articleName: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.name,
1964
+ articleUpc: (_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.upc,
1884
1965
  activeRetailerId: (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer,
1885
1966
  token: token,
1886
1967
  onClose: function onClose() {
1887
1968
  return setShowLinkVariants(false);
1888
1969
  },
1889
1970
  onLinked: handleOnLinkedVariants
1890
- }), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
1971
+ }), porDesvincular && /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnlinkVariantModal.UnlinkVariantModal, (0, _objectSpread4.default)((0, _objectSpread4.default)({}, porDesvincular), {}, {
1972
+ token: token,
1973
+ onClose: function onClose() {
1974
+ return setPorDesvincular(null);
1975
+ },
1976
+ onUnlinked: handleOnUnlinked
1977
+ })), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
1891
1978
  images: state.images_values,
1892
1979
  setShowModal: setShowModal,
1893
1980
  approveRejectButtons: canShowValidationButtons(),
@@ -2030,7 +2117,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2030
2117
  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] : {},
2031
2118
  assignationsImages: assig,
2032
2119
  retailerSelected: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.id_retailer,
2033
- imagesStatus: ((_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.images_status) || "-",
2120
+ imagesStatus: ((_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.images_status) || "-",
2034
2121
  isRetailer: isRetailer,
2035
2122
  setShowVersionSelector: setShowVersionSelector,
2036
2123
  version: state.product.version,
@@ -2043,7 +2130,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2043
2130
  className: "product-information",
2044
2131
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2045
2132
  className: "product-information",
2046
- children: [!((_state$product19 = state.product) !== null && _state$product19 !== void 0 && _state$product19.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2133
+ children: [!((_state$product20 = state.product) !== null && _state$product20 !== void 0 && _state$product20.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2047
2134
  className: "variants-actions",
2048
2135
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
2049
2136
  type: "button",
@@ -2052,7 +2139,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2052
2139
  return setShowLinkVariants(true);
2053
2140
  },
2054
2141
  children: "Ligar productos"
2055
- }), ((_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2142
+ }), ((_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2056
2143
  type: "button",
2057
2144
  className: "variants-count",
2058
2145
  "aria-expanded": showFamily,
@@ -2067,7 +2154,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2067
2154
  children: showFamily ? " ▴" : " ▾"
2068
2155
  })]
2069
2156
  })]
2070
- }), ((_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2157
+ }), ((_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2071
2158
  className: "variants-actions",
2072
2159
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2073
2160
  type: "button",
@@ -2092,40 +2179,80 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2092
2179
  }), (family === null || family === void 0 ? void 0 : family.error) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
2093
2180
  className: "loading",
2094
2181
  children: "No se pudo cargar la familia de este producto."
2095
- }), (family === null || family === void 0 ? void 0 : family.parent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2096
- type: "button",
2097
- className: "family-row parent",
2098
- disabled: loadingVariant !== null,
2099
- onClick: function onClick() {
2100
- return openVariant(family.parent.articleId);
2101
- },
2102
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2103
- className: "role",
2104
- children: loadingVariant === family.parent.articleId ? "Abriendo…" : "Producto padre"
2105
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2106
- className: "name",
2107
- children: family.parent.name
2108
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2109
- className: "upc",
2110
- children: family.parent.upc
2111
- })]
2112
- }), family === null || family === void 0 ? void 0 : (_family$variants3 = family.variants) === null || _family$variants3 === void 0 ? void 0 : _family$variants3.map(function (variant) {
2113
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2182
+ }), (family === null || family === void 0 ? void 0 : family.parent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2183
+ className: "family-item",
2184
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2114
2185
  type: "button",
2115
- className: "family-row".concat(variant.isCurrent ? " current" : ""),
2116
- disabled: variant.isCurrent || loadingVariant !== null,
2186
+ className: "family-row parent",
2187
+ disabled: loadingVariant !== null,
2117
2188
  onClick: function onClick() {
2118
- return openVariant(variant.articleId);
2189
+ return openVariant(family.parent.articleId);
2119
2190
  },
2120
2191
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2121
2192
  className: "role",
2122
- children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "Hijo"
2193
+ children: loadingVariant === family.parent.articleId ? "Abriendo…" : "Producto padre"
2123
2194
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2124
2195
  className: "name",
2125
- children: variant.name
2196
+ children: family.parent.name
2126
2197
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2127
2198
  className: "upc",
2128
- children: variant.upc
2199
+ children: family.parent.upc
2200
+ })]
2201
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
2202
+ type: "button",
2203
+ className: "desvincular",
2204
+ title: "Dejar de ser hijo de este producto",
2205
+ onClick: function onClick() {
2206
+ var _state$product23, _state$product24, _state$product25;
2207
+
2208
+ return setPorDesvincular({
2209
+ mode: "self",
2210
+ childArticleId: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.id_article,
2211
+ childName: (_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.name,
2212
+ childUpc: (_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.upc,
2213
+ parentName: family.parent.name,
2214
+ parentUpc: family.parent.upc
2215
+ });
2216
+ },
2217
+ children: "Desvincular"
2218
+ })]
2219
+ }), family === null || family === void 0 ? void 0 : (_family$variants3 = family.variants) === null || _family$variants3 === void 0 ? void 0 : _family$variants3.map(function (variant) {
2220
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2221
+ className: "family-item",
2222
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
2223
+ type: "button",
2224
+ className: "family-row".concat(variant.isCurrent ? " current" : ""),
2225
+ disabled: variant.isCurrent || loadingVariant !== null,
2226
+ onClick: function onClick() {
2227
+ return openVariant(variant.articleId);
2228
+ },
2229
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2230
+ className: "role",
2231
+ children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "Hijo"
2232
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2233
+ className: "name",
2234
+ children: variant.name
2235
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
2236
+ className: "upc",
2237
+ children: variant.upc
2238
+ })]
2239
+ }), !family.parent && !variant.isCurrent && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
2240
+ type: "button",
2241
+ className: "desvincular",
2242
+ title: "Desvincular este hijo",
2243
+ onClick: function onClick() {
2244
+ var _state$product26, _state$product27;
2245
+
2246
+ return setPorDesvincular({
2247
+ mode: "child",
2248
+ childArticleId: variant.articleId,
2249
+ childName: variant.name,
2250
+ childUpc: variant.upc,
2251
+ parentName: (_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.name,
2252
+ parentUpc: (_state$product27 = state.product) === null || _state$product27 === void 0 ? void 0 : _state$product27.upc
2253
+ });
2254
+ },
2255
+ children: "Desvincular"
2129
2256
  })]
2130
2257
  }, variant.articleId);
2131
2258
  }), family && !family.error && !((_family$variants4 = family.variants) !== null && _family$variants4 !== void 0 && _family$variants4.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
@@ -2188,7 +2315,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2188
2315
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2189
2316
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
2190
2317
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2191
- children: [state.active_tab === "Descripción" && (((_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.description_status) !== "NS" ? (_state$descriptions_i = state.descriptions_inputs) !== null && _state$descriptions_i !== void 0 && _state$descriptions_i[0] ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
2318
+ children: [state.active_tab === "Descripción" && (((_state$product28 = state.product) === null || _state$product28 === void 0 ? void 0 : _state$product28.description_status) !== "NS" ? (_state$descriptions_i = state.descriptions_inputs) !== null && _state$descriptions_i !== void 0 && _state$descriptions_i[0] ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
2192
2319
  activeSection: state.active_tab,
2193
2320
  inputGroup: state.descriptions_inputs[0],
2194
2321
  updatedDescriptions: state.updated_descriptions_inputs
@@ -2199,7 +2326,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2199
2326
  ,
2200
2327
  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,
2201
2328
  onRestoreInheritance: handleOnRestoreInheritance,
2202
- articleId: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.id_article,
2329
+ articleId: (_state$product29 = state.product) === null || _state$product29 === void 0 ? void 0 : _state$product29.id_article,
2203
2330
  version: state.product.version,
2204
2331
  isShowbox: false,
2205
2332
  dinamicHeight: true,
@@ -2211,7 +2338,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2211
2338
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
2212
2339
  text: "No cuentas con este servicio",
2213
2340
  headerType: "input-name-header"
2214
- })), state.active_tab === "Ficha técnica" && (((_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
2341
+ })), state.active_tab === "Ficha técnica" && (((_state$product30 = state.product) === null || _state$product30 === void 0 ? void 0 : _state$product30.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
2215
2342
  children: ((_state$datasheets_inp = state.datasheets_inputs) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp[0]) === null || _state$datasheets_inp2 === void 0 ? void 0 : (_state$datasheets_inp3 = _state$datasheets_inp2.data) === null || _state$datasheets_inp3 === void 0 ? void 0 : _state$datasheets_inp3.length) > 0 ? state.datasheets_inputs[0].data.map(function (dataGroup, index) {
2216
2343
  var _state$datasheets_inp4, _state$services3, _state$services3$data, _state$services$datas3;
2217
2344
 
@@ -2241,7 +2368,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
2241
2368
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
2242
2369
  text: "No cuentas con este servicio",
2243
2370
  headerType: "input-name-header"
2244
- })), state.active_tab === "Imágenes" && (((_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2371
+ })), state.active_tab === "Imágenes" && (((_state$product31 = state.product) === null || _state$product31 === void 0 ? void 0 : _state$product31.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
2245
2372
  children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
2246
2373
  checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
2247
2374
  ,
@@ -18,9 +18,9 @@ var _templateObject;
18
18
  // Rosa ContentOh, el mismo del modal de ligar productos.
19
19
  var PINK = "#E13AA8";
20
20
 
21
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n\n .required-inputs-message {\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n padding: 10px;\n display: flex;\n align-items: center;\n\n p + * {\n margin-top: 10px;\n }\n\n button {\n min-width: fit-content;\n }\n }\n }\n }\n #modal-message-box {\n width: 400px;\n height: 100px;\n }\n .container {\n width: 100%;\n height: 90%;\n .dropzone {\n height: 100%;\n width: 100%;\n position: relative;\n transition: all 0.5s ease;\n\n &.drag-active {\n background-color: rgba(", ", 0.05);\n border: 2px dashed ", ";\n border-radius: 8px;\n\n aside {\n opacity: 0.3;\n pointer-events: none;\n }\n }\n\n .drag-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(", ", 0.1);\n border-radius: 8px;\n pointer-events: none;\n z-index: 10;\n\n p {\n font-family: ", ";\n font-size: 24px;\n font-weight: 600;\n color: ", ";\n text-align: center;\n padding: 20px;\n background-color: ", ";\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n }\n }\n }\n .variants-actions {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-bottom: 8px;\n\n .link-variants {\n border: 1px solid ", ";\n border-radius: 6px;\n background: none;\n padding: 6px 12px;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n cursor: pointer;\n }\n\n .variants-count {\n border: none;\n background: none;\n padding: 0;\n cursor: pointer;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n text-decoration: underline;\n }\n }\n\n .variants-family {\n display: flex;\n flex-direction: column;\n gap: 4px;\n margin-bottom: 10px;\n padding: 8px;\n border: 1px solid ", ";\n border-radius: 6px;\n\n .loading {\n margin: 0;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n }\n\n .family-row {\n display: flex;\n align-items: baseline;\n gap: 8px;\n padding: 6px 8px;\n border: none;\n border-radius: 4px;\n background: none;\n cursor: pointer;\n text-align: left;\n font-family: ", ";\n font-size: 12px;\n color: ", ";\n }\n\n .family-row:hover:not(:disabled) {\n background-color: ", ";\n }\n\n .family-row:disabled {\n cursor: default;\n opacity: 0.7;\n }\n\n .family-row .role {\n min-width: 96px;\n font-size: 10px;\n color: ", ";\n }\n\n .family-row.current .role {\n color: ", ";\n }\n\n .family-row .name {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .family-row .upc {\n font-size: 11px;\n color: ", ";\n }\n\n .editar-juntas {\n align-self: flex-start;\n margin-top: 4px;\n border: 1px solid ", ";\n border-radius: 6px;\n background: none;\n padding: 6px 12px;\n cursor: pointer;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n }\n }\n"])), function (_ref) {
21
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n\n .required-inputs-message {\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n padding: 10px;\n display: flex;\n align-items: center;\n\n p + * {\n margin-top: 10px;\n }\n\n button {\n min-width: fit-content;\n }\n }\n }\n }\n #modal-message-box {\n width: 400px;\n height: 100px;\n }\n .container {\n width: 100%;\n height: 90%;\n .dropzone {\n height: 100%;\n width: 100%;\n position: relative;\n transition: all 0.5s ease;\n\n &.drag-active {\n background-color: rgba(", ", 0.05);\n border: 2px dashed ", ";\n border-radius: 8px;\n\n aside {\n opacity: 0.3;\n pointer-events: none;\n }\n }\n\n .drag-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(", ", 0.1);\n border-radius: 8px;\n pointer-events: none;\n z-index: 10;\n\n p {\n font-family: ", ";\n font-size: 24px;\n font-weight: 600;\n color: ", ";\n text-align: center;\n padding: 20px;\n background-color: ", ";\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n }\n }\n }\n .variants-actions {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-bottom: 8px;\n\n .link-variants {\n border: 1px solid ", ";\n border-radius: 6px;\n background: none;\n padding: 6px 12px;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n cursor: pointer;\n }\n\n .variants-count {\n border: none;\n background: none;\n padding: 0;\n cursor: pointer;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n text-decoration: underline;\n }\n }\n\n .variants-family {\n display: flex;\n flex-direction: column;\n gap: 4px;\n margin-bottom: 10px;\n padding: 8px;\n border: 1px solid ", ";\n border-radius: 6px;\n\n .loading {\n margin: 0;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n }\n\n /* La fila es un bot\xF3n que navega; desvincular tiene que quedar FUERA de\n \xE9l \u2014un bot\xF3n dentro de otro no es HTML v\xE1lido y el clic se confunde\u2014. */\n .family-item {\n display: flex;\n align-items: center;\n gap: 4px;\n }\n\n .family-item .family-row {\n flex: 1;\n min-width: 0;\n }\n\n .desvincular {\n flex-shrink: 0;\n border: none;\n background: none;\n padding: 4px 6px;\n cursor: pointer;\n font-family: ", ";\n font-size: 10px;\n color: ", ";\n text-decoration: underline;\n white-space: nowrap;\n }\n\n .desvincular:hover {\n color: ", ";\n }\n\n .family-row {\n display: flex;\n align-items: baseline;\n gap: 8px;\n padding: 6px 8px;\n border: none;\n border-radius: 4px;\n background: none;\n cursor: pointer;\n text-align: left;\n font-family: ", ";\n font-size: 12px;\n color: ", ";\n }\n\n .family-row:hover:not(:disabled) {\n background-color: ", ";\n }\n\n .family-row:disabled {\n cursor: default;\n opacity: 0.7;\n }\n\n .family-row .role {\n min-width: 96px;\n font-size: 10px;\n color: ", ";\n }\n\n .family-row.current .role {\n color: ", ";\n }\n\n .family-row .name {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .family-row .upc {\n font-size: 11px;\n color: ", ";\n }\n\n .editar-juntas {\n align-self: flex-start;\n margin-top: 4px;\n border: 1px solid ", ";\n border-radius: 6px;\n background: none;\n padding: 6px 12px;\n cursor: pointer;\n font-family: ", ";\n font-size: 11px;\n color: ", ";\n }\n }\n"])), function (_ref) {
22
22
  var headerTop = _ref.headerTop;
23
23
  return headerTop;
24
- }, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_gray, _variables.GlobalColors.rgb_color_pink, _variables.GlobalColors.color_pink, _variables.GlobalColors.rgb_color_pink, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_pink, _variables.GlobalColors.white, PINK, _variables.FontFamily.Raleway_600, PINK, _variables.FontFamily.Raleway_500, _variables.GlobalColors.gray, _variables.GlobalColors.s2, _variables.FontFamily.Raleway_500, _variables.GlobalColors.gray, _variables.FontFamily.Raleway_500, _variables.GlobalColors.deep_gray, _variables.GlobalColors.s2, PINK, _variables.GlobalColors.gray, _variables.GlobalColors.gray, PINK, _variables.FontFamily.Raleway_600, PINK);
24
+ }, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_gray, _variables.GlobalColors.rgb_color_pink, _variables.GlobalColors.color_pink, _variables.GlobalColors.rgb_color_pink, _variables.FontFamily.AvenirNext, _variables.GlobalColors.color_pink, _variables.GlobalColors.white, PINK, _variables.FontFamily.Raleway_600, PINK, _variables.FontFamily.Raleway_500, _variables.GlobalColors.gray, _variables.GlobalColors.s2, _variables.FontFamily.Raleway_500, _variables.GlobalColors.gray, _variables.FontFamily.Raleway_500, _variables.GlobalColors.gray, PINK, _variables.FontFamily.Raleway_500, _variables.GlobalColors.deep_gray, _variables.GlobalColors.s2, PINK, _variables.GlobalColors.gray, _variables.GlobalColors.gray, PINK, _variables.FontFamily.Raleway_600, PINK);
25
25
 
26
26
  exports.Container = Container;