contentoh-components-library 21.6.29 → 21.6.31
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.
- package/dist/components/pages/ProviderProductEdition/index.js +209 -130
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +44 -26
- package/dist/components/pages/RetailerProductEdition/index.js +600 -172
- package/dist/components/pages/RetailerProductEdition/styles.js +5 -2
- package/dist/components/pages/RetailerProductEdition/utils.js +8 -0
- package/package.json +1 -1
- package/src/components/pages/ProviderProductEdition/index.js +50 -15
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +22 -2
- package/src/components/pages/RetailerProductEdition/index.js +291 -2
- package/src/components/pages/RetailerProductEdition/styles.js +96 -0
- package/src/components/pages/RetailerProductEdition/utils.js +8 -0
|
@@ -162,37 +162,42 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
162
162
|
|
|
163
163
|
var _useState17 = (0, _react.useState)(false),
|
|
164
164
|
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
preparandoEdicionMultiple = _useState18[0],
|
|
166
|
+
setPreparandoEdicionMultiple = _useState18[1];
|
|
167
167
|
|
|
168
|
-
var _useState19 = (0, _react.useState)(
|
|
168
|
+
var _useState19 = (0, _react.useState)(false),
|
|
169
169
|
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
showRejectModal = _useState20[0],
|
|
171
|
+
setShowRejectModal = _useState20[1];
|
|
172
172
|
|
|
173
|
-
var _useState21 = (0, _react.useState)(
|
|
173
|
+
var _useState21 = (0, _react.useState)(0),
|
|
174
174
|
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
headerTop = _useState22[0],
|
|
176
|
+
setHeaderTop = _useState22[1];
|
|
177
177
|
|
|
178
|
-
var _useState23 = (0, _react.useState)(
|
|
178
|
+
var _useState23 = (0, _react.useState)({}),
|
|
179
179
|
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
assig = _useState24[0],
|
|
181
|
+
setAssig = _useState24[1];
|
|
182
182
|
|
|
183
183
|
var _useState25 = (0, _react.useState)(false),
|
|
184
184
|
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
imageLayout = _useState26[0],
|
|
186
|
+
setImageLayout = _useState26[1];
|
|
187
187
|
|
|
188
|
-
var _useState27 = (0, _react.useState)(
|
|
188
|
+
var _useState27 = (0, _react.useState)(false),
|
|
189
|
+
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
190
|
+
rejectAll = _useState28[0],
|
|
191
|
+
setRejectAll = _useState28[1];
|
|
192
|
+
|
|
193
|
+
var _useState29 = (0, _react.useState)({
|
|
189
194
|
"Ficha técnica": null,
|
|
190
195
|
Descripción: null,
|
|
191
196
|
Imágenes: null
|
|
192
197
|
}),
|
|
193
|
-
|
|
194
|
-
origin =
|
|
195
|
-
setOrigin =
|
|
198
|
+
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
199
|
+
origin = _useState30[0],
|
|
200
|
+
setOrigin = _useState30[1];
|
|
196
201
|
|
|
197
202
|
var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
|
|
198
203
|
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
@@ -978,50 +983,123 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
978
983
|
/*
|
|
979
984
|
Abre la edición múltiple con las variantes de la familia ya cargadas.
|
|
980
985
|
Esa pantalla lee `multipleEditionList` de sessionStorage —así la deja el
|
|
981
|
-
listado al pulsar "editar varios"— y
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
986
|
+
listado al pulsar "editar varios"— y necesita el PRODUCTO COMPLETO de cada
|
|
987
|
+
uno, no solo su id: pinta el UPC, el nombre, parte `categoryName` por "|",
|
|
988
|
+
cuenta `retailersAvailable` y decide columnas según `id_order`. Con un objeto
|
|
989
|
+
reducido revienta al entrar.
|
|
990
|
+
Por eso se piden a /new-articles, que devuelve justo la forma del listado, y
|
|
991
|
+
se filtran por id y no por UPC: hay 12,024 UPC repetidos entre artículos
|
|
992
|
+
activos y el UPC no identifica un producto.
|
|
993
|
+
Va SIN el producto padre a propósito, aunque el botón viva en su ficha. En la
|
|
994
|
+
edición múltiple no existe el diálogo de propagación, así que incluirlo
|
|
985
995
|
abriría un camino para cambiar el padre sin decidir si eso baja a los hijos
|
|
986
|
-
—justo la decisión que
|
|
987
|
-
propia pantalla.
|
|
996
|
+
—justo la decisión que su propia ficha obliga a tomar—.
|
|
988
997
|
*/
|
|
989
998
|
|
|
990
999
|
|
|
991
|
-
var openMultipleEdition = function
|
|
992
|
-
var
|
|
1000
|
+
var openMultipleEdition = /*#__PURE__*/function () {
|
|
1001
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
1002
|
+
var _family$variants;
|
|
993
1003
|
|
|
994
|
-
|
|
995
|
-
var _variant$version;
|
|
1004
|
+
var ids, res, _readPayload, data, productos;
|
|
996
1005
|
|
|
997
|
-
return {
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1006
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
1007
|
+
while (1) {
|
|
1008
|
+
switch (_context4.prev = _context4.next) {
|
|
1009
|
+
case 0:
|
|
1010
|
+
ids = ((_family$variants = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants !== void 0 ? _family$variants : []).map(function (variant) {
|
|
1011
|
+
return variant.articleId;
|
|
1012
|
+
});
|
|
1003
1013
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1014
|
+
if (ids.length) {
|
|
1015
|
+
_context4.next = 3;
|
|
1016
|
+
break;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
return _context4.abrupt("return");
|
|
1020
|
+
|
|
1021
|
+
case 3:
|
|
1022
|
+
setPreparandoEdicionMultiple(true);
|
|
1023
|
+
_context4.prev = 4;
|
|
1024
|
+
_context4.next = 7;
|
|
1025
|
+
return _axios.default.get("".concat(process.env.REACT_APP_NEW_ARTICLES_ENDPOINT), {
|
|
1026
|
+
params: {
|
|
1027
|
+
listType: "general",
|
|
1028
|
+
filterByArticleId: ids.join(",")
|
|
1029
|
+
},
|
|
1030
|
+
headers: {
|
|
1031
|
+
Authorization: token
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
case 7:
|
|
1036
|
+
res = _context4.sent;
|
|
1037
|
+
_readPayload = (0, _api.readPayload)(res), data = _readPayload.data;
|
|
1038
|
+
productos = (data !== null && data !== void 0 ? data : []).filter(function (item) {
|
|
1039
|
+
return ids.includes(Number(item.id_article));
|
|
1040
|
+
});
|
|
1041
|
+
|
|
1042
|
+
if (productos.length) {
|
|
1043
|
+
_context4.next = 13;
|
|
1044
|
+
break;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
console.error("openMultipleEdition: sin productos que abrir");
|
|
1048
|
+
return _context4.abrupt("return");
|
|
1049
|
+
|
|
1050
|
+
case 13:
|
|
1051
|
+
sessionStorage.setItem("multipleEditionList", JSON.stringify(productos.sort(function (a, b) {
|
|
1052
|
+
return a.id_article - b.id_article;
|
|
1053
|
+
})));
|
|
1054
|
+
window.location.assign("/products/multipleEdition");
|
|
1055
|
+
_context4.next = 21;
|
|
1056
|
+
break;
|
|
1057
|
+
|
|
1058
|
+
case 17:
|
|
1059
|
+
_context4.prev = 17;
|
|
1060
|
+
_context4.t0 = _context4["catch"](4);
|
|
1061
|
+
// Se avisa y se queda donde está: navegar con la lista vieja abriría otros
|
|
1062
|
+
// productos, y navegar sin lista deja la pantalla rota.
|
|
1063
|
+
console.error("openMultipleEdition: ", _context4.t0);
|
|
1064
|
+
dispatch({
|
|
1065
|
+
type: "SET_MODAL",
|
|
1066
|
+
payload: {
|
|
1067
|
+
show: true,
|
|
1068
|
+
title: "",
|
|
1069
|
+
message: "No se pudieron cargar las variantes para editarlas juntas.",
|
|
1070
|
+
image: _errorModal.default
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
|
|
1074
|
+
case 21:
|
|
1075
|
+
_context4.prev = 21;
|
|
1076
|
+
setPreparandoEdicionMultiple(false);
|
|
1077
|
+
return _context4.finish(21);
|
|
1078
|
+
|
|
1079
|
+
case 24:
|
|
1080
|
+
case "end":
|
|
1081
|
+
return _context4.stop();
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}, _callee4, null, [[4, 17, 21, 24]]);
|
|
1085
|
+
}));
|
|
1086
|
+
|
|
1087
|
+
return function openMultipleEdition() {
|
|
1088
|
+
return _ref8.apply(this, arguments);
|
|
1089
|
+
};
|
|
1090
|
+
}();
|
|
1013
1091
|
|
|
1014
1092
|
var openVariant = /*#__PURE__*/function () {
|
|
1015
|
-
var
|
|
1016
|
-
var res,
|
|
1093
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(articleId) {
|
|
1094
|
+
var res, _readPayload2, data, encontrado;
|
|
1017
1095
|
|
|
1018
|
-
return _regenerator.default.wrap(function
|
|
1096
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1019
1097
|
while (1) {
|
|
1020
|
-
switch (
|
|
1098
|
+
switch (_context5.prev = _context5.next) {
|
|
1021
1099
|
case 0:
|
|
1022
1100
|
setLoadingVariant(articleId);
|
|
1023
|
-
|
|
1024
|
-
|
|
1101
|
+
_context5.prev = 1;
|
|
1102
|
+
_context5.next = 4;
|
|
1025
1103
|
return _axios.default.get("".concat(process.env.REACT_APP_NEW_ARTICLES_ENDPOINT), {
|
|
1026
1104
|
params: {
|
|
1027
1105
|
listType: "general",
|
|
@@ -1033,9 +1111,9 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1033
1111
|
});
|
|
1034
1112
|
|
|
1035
1113
|
case 4:
|
|
1036
|
-
res =
|
|
1114
|
+
res = _context5.sent;
|
|
1037
1115
|
// read-articles-v2 responde { count, data: [...] }.
|
|
1038
|
-
|
|
1116
|
+
_readPayload2 = (0, _api.readPayload)(res), data = _readPayload2.data;
|
|
1039
1117
|
encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
|
|
1040
1118
|
return Number(item.id_article) === Number(articleId);
|
|
1041
1119
|
});
|
|
@@ -1053,33 +1131,33 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1053
1131
|
}));
|
|
1054
1132
|
}
|
|
1055
1133
|
|
|
1056
|
-
|
|
1134
|
+
_context5.next = 13;
|
|
1057
1135
|
break;
|
|
1058
1136
|
|
|
1059
1137
|
case 10:
|
|
1060
|
-
|
|
1061
|
-
|
|
1138
|
+
_context5.prev = 10;
|
|
1139
|
+
_context5.t0 = _context5["catch"](1);
|
|
1062
1140
|
// Si la consulta falla se navega igual: la pantalla mostrará el producto
|
|
1063
1141
|
// que hubiera en sessionStorage, que es el comportamiento de siempre.
|
|
1064
1142
|
// Peor sería dejar el clic sin efecto y que pareciera que no responde.
|
|
1065
|
-
console.error("openVariant: ",
|
|
1143
|
+
console.error("openVariant: ", _context5.t0);
|
|
1066
1144
|
|
|
1067
1145
|
case 13:
|
|
1068
|
-
|
|
1146
|
+
_context5.prev = 13;
|
|
1069
1147
|
setLoadingVariant(null);
|
|
1070
1148
|
window.location.assign("/products/".concat(articleId, "/datasheet"));
|
|
1071
|
-
return
|
|
1149
|
+
return _context5.finish(13);
|
|
1072
1150
|
|
|
1073
1151
|
case 17:
|
|
1074
1152
|
case "end":
|
|
1075
|
-
return
|
|
1153
|
+
return _context5.stop();
|
|
1076
1154
|
}
|
|
1077
1155
|
}
|
|
1078
|
-
},
|
|
1156
|
+
}, _callee5, null, [[1, 10, 13, 17]]);
|
|
1079
1157
|
}));
|
|
1080
1158
|
|
|
1081
1159
|
return function openVariant(_x2) {
|
|
1082
|
-
return
|
|
1160
|
+
return _ref9.apply(this, arguments);
|
|
1083
1161
|
};
|
|
1084
1162
|
}();
|
|
1085
1163
|
/*
|
|
@@ -1140,24 +1218,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1140
1218
|
|
|
1141
1219
|
|
|
1142
1220
|
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
1143
|
-
var
|
|
1221
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(attributeId) {
|
|
1144
1222
|
var _state$product13;
|
|
1145
1223
|
|
|
1146
1224
|
var res, data;
|
|
1147
|
-
return _regenerator.default.wrap(function
|
|
1225
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1148
1226
|
while (1) {
|
|
1149
|
-
switch (
|
|
1227
|
+
switch (_context6.prev = _context6.next) {
|
|
1150
1228
|
case 0:
|
|
1151
1229
|
if (!(!attributeId || !((_state$product13 = state.product) !== null && _state$product13 !== void 0 && _state$product13.id_article))) {
|
|
1152
|
-
|
|
1230
|
+
_context6.next = 2;
|
|
1153
1231
|
break;
|
|
1154
1232
|
}
|
|
1155
1233
|
|
|
1156
|
-
return
|
|
1234
|
+
return _context6.abrupt("return");
|
|
1157
1235
|
|
|
1158
1236
|
case 2:
|
|
1159
|
-
|
|
1160
|
-
|
|
1237
|
+
_context6.prev = 2;
|
|
1238
|
+
_context6.next = 5;
|
|
1161
1239
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), {
|
|
1162
1240
|
articleId: state.product.id_article,
|
|
1163
1241
|
attributes: [Number(attributeId)]
|
|
@@ -1168,7 +1246,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1168
1246
|
});
|
|
1169
1247
|
|
|
1170
1248
|
case 5:
|
|
1171
|
-
res =
|
|
1249
|
+
res = _context6.sent;
|
|
1172
1250
|
// El API responde 200 aunque la lambda haya devuelto 400: el resultado
|
|
1173
1251
|
// real viaja en el cuerpo y readPayload lo convierte en excepción.
|
|
1174
1252
|
data = (0, _api.readPayload)(res);
|
|
@@ -1182,24 +1260,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1182
1260
|
};
|
|
1183
1261
|
})
|
|
1184
1262
|
});
|
|
1185
|
-
|
|
1263
|
+
_context6.next = 13;
|
|
1186
1264
|
break;
|
|
1187
1265
|
|
|
1188
1266
|
case 10:
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
console.error("restoreInheritance: ",
|
|
1267
|
+
_context6.prev = 10;
|
|
1268
|
+
_context6.t0 = _context6["catch"](2);
|
|
1269
|
+
console.error("restoreInheritance: ", _context6.t0);
|
|
1192
1270
|
|
|
1193
1271
|
case 13:
|
|
1194
1272
|
case "end":
|
|
1195
|
-
return
|
|
1273
|
+
return _context6.stop();
|
|
1196
1274
|
}
|
|
1197
1275
|
}
|
|
1198
|
-
},
|
|
1276
|
+
}, _callee6, null, [[2, 10]]);
|
|
1199
1277
|
}));
|
|
1200
1278
|
|
|
1201
1279
|
return function handleOnRestoreInheritance(_x3) {
|
|
1202
|
-
return
|
|
1280
|
+
return _ref10.apply(this, arguments);
|
|
1203
1281
|
};
|
|
1204
1282
|
}();
|
|
1205
1283
|
|
|
@@ -1234,14 +1312,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1234
1312
|
};
|
|
1235
1313
|
|
|
1236
1314
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1237
|
-
var
|
|
1315
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
|
|
1238
1316
|
var _state$product$id_ord, _state$active_retaile3, _state$product$status, _state$product$status2, _state$product14;
|
|
1239
1317
|
|
|
1240
1318
|
var concept, articleId, orderId, retailerId, evalStatus, data, _newStatuses$newStatu, _state$services_data, res, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
1241
1319
|
|
|
1242
|
-
return _regenerator.default.wrap(function
|
|
1320
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1243
1321
|
while (1) {
|
|
1244
|
-
switch (
|
|
1322
|
+
switch (_context7.prev = _context7.next) {
|
|
1245
1323
|
case 0:
|
|
1246
1324
|
dispatch({
|
|
1247
1325
|
type: "SET_SAVING",
|
|
@@ -1258,16 +1336,16 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1258
1336
|
concept: concept,
|
|
1259
1337
|
evalStatus: evalStatus
|
|
1260
1338
|
};
|
|
1261
|
-
|
|
1339
|
+
_context7.prev = 7;
|
|
1262
1340
|
|
|
1263
1341
|
if (!result) {
|
|
1264
|
-
|
|
1342
|
+
_context7.next = 22;
|
|
1265
1343
|
break;
|
|
1266
1344
|
}
|
|
1267
1345
|
|
|
1268
1346
|
data.result = result;
|
|
1269
1347
|
data.retailerId = retailerId;
|
|
1270
|
-
|
|
1348
|
+
_context7.next = 13;
|
|
1271
1349
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1272
1350
|
headers: {
|
|
1273
1351
|
Authorization: token
|
|
@@ -1275,7 +1353,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1275
1353
|
});
|
|
1276
1354
|
|
|
1277
1355
|
case 13:
|
|
1278
|
-
res =
|
|
1356
|
+
res = _context7.sent;
|
|
1279
1357
|
newStatuses = JSON.parse(res.data.body);
|
|
1280
1358
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")]; // Actualizar el producto con los nuevos estados
|
|
1281
1359
|
|
|
@@ -1312,13 +1390,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1312
1390
|
});
|
|
1313
1391
|
|
|
1314
1392
|
case 22:
|
|
1315
|
-
|
|
1393
|
+
_context7.next = 28;
|
|
1316
1394
|
break;
|
|
1317
1395
|
|
|
1318
1396
|
case 24:
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
console.error("Error sending evaluation:",
|
|
1397
|
+
_context7.prev = 24;
|
|
1398
|
+
_context7.t0 = _context7["catch"](7);
|
|
1399
|
+
console.error("Error sending evaluation:", _context7.t0);
|
|
1322
1400
|
dispatch({
|
|
1323
1401
|
type: "SET_MODAL",
|
|
1324
1402
|
payload: {
|
|
@@ -1330,32 +1408,32 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1330
1408
|
});
|
|
1331
1409
|
|
|
1332
1410
|
case 28:
|
|
1333
|
-
|
|
1411
|
+
_context7.prev = 28;
|
|
1334
1412
|
dispatch({
|
|
1335
1413
|
type: "SET_SAVING",
|
|
1336
1414
|
payload: false
|
|
1337
1415
|
});
|
|
1338
|
-
return
|
|
1416
|
+
return _context7.finish(28);
|
|
1339
1417
|
|
|
1340
1418
|
case 31:
|
|
1341
1419
|
case "end":
|
|
1342
|
-
return
|
|
1420
|
+
return _context7.stop();
|
|
1343
1421
|
}
|
|
1344
1422
|
}
|
|
1345
|
-
},
|
|
1423
|
+
}, _callee7, null, [[7, 24, 28, 31]]);
|
|
1346
1424
|
}));
|
|
1347
1425
|
|
|
1348
1426
|
return function sendEvaluation(_x4) {
|
|
1349
|
-
return
|
|
1427
|
+
return _ref11.apply(this, arguments);
|
|
1350
1428
|
};
|
|
1351
1429
|
}();
|
|
1352
1430
|
|
|
1353
1431
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1354
|
-
var
|
|
1432
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(result) {
|
|
1355
1433
|
var data, statusComplete, updatedProduct;
|
|
1356
|
-
return _regenerator.default.wrap(function
|
|
1434
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1357
1435
|
while (1) {
|
|
1358
|
-
switch (
|
|
1436
|
+
switch (_context8.prev = _context8.next) {
|
|
1359
1437
|
case 0:
|
|
1360
1438
|
dispatch({
|
|
1361
1439
|
type: "SET_SAVING",
|
|
@@ -1367,8 +1445,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1367
1445
|
versionId: state.product.version,
|
|
1368
1446
|
status: result
|
|
1369
1447
|
};
|
|
1370
|
-
|
|
1371
|
-
|
|
1448
|
+
_context8.prev = 2;
|
|
1449
|
+
_context8.next = 5;
|
|
1372
1450
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1373
1451
|
headers: {
|
|
1374
1452
|
Authorization: token
|
|
@@ -1398,13 +1476,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1398
1476
|
image: _genericModalCheck.default
|
|
1399
1477
|
}
|
|
1400
1478
|
});
|
|
1401
|
-
|
|
1479
|
+
_context8.next = 15;
|
|
1402
1480
|
break;
|
|
1403
1481
|
|
|
1404
1482
|
case 11:
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
console.error("Error evaluating to retailer:",
|
|
1483
|
+
_context8.prev = 11;
|
|
1484
|
+
_context8.t0 = _context8["catch"](2);
|
|
1485
|
+
console.error("Error evaluating to retailer:", _context8.t0);
|
|
1408
1486
|
dispatch({
|
|
1409
1487
|
type: "SET_MODAL",
|
|
1410
1488
|
payload: {
|
|
@@ -1416,23 +1494,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1416
1494
|
});
|
|
1417
1495
|
|
|
1418
1496
|
case 15:
|
|
1419
|
-
|
|
1497
|
+
_context8.prev = 15;
|
|
1420
1498
|
dispatch({
|
|
1421
1499
|
type: "SET_SAVING",
|
|
1422
1500
|
payload: false
|
|
1423
1501
|
});
|
|
1424
|
-
return
|
|
1502
|
+
return _context8.finish(15);
|
|
1425
1503
|
|
|
1426
1504
|
case 18:
|
|
1427
1505
|
case "end":
|
|
1428
|
-
return
|
|
1506
|
+
return _context8.stop();
|
|
1429
1507
|
}
|
|
1430
1508
|
}
|
|
1431
|
-
},
|
|
1509
|
+
}, _callee8, null, [[2, 11, 15, 18]]);
|
|
1432
1510
|
}));
|
|
1433
1511
|
|
|
1434
1512
|
return function evaluationToRetailer(_x5) {
|
|
1435
|
-
return
|
|
1513
|
+
return _ref12.apply(this, arguments);
|
|
1436
1514
|
};
|
|
1437
1515
|
}();
|
|
1438
1516
|
|
|
@@ -1563,18 +1641,18 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1563
1641
|
};
|
|
1564
1642
|
|
|
1565
1643
|
var handleOnEvaluateAll = /*#__PURE__*/function () {
|
|
1566
|
-
var
|
|
1644
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
|
|
1567
1645
|
var _state$product$id_ord2, _state$services_data2, evaluationArray, conceptArray, dataGeneral, isProvider, userType, status, updatedStatusByRetailer, updatedProduct;
|
|
1568
1646
|
|
|
1569
|
-
return _regenerator.default.wrap(function
|
|
1647
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1570
1648
|
while (1) {
|
|
1571
|
-
switch (
|
|
1649
|
+
switch (_context9.prev = _context9.next) {
|
|
1572
1650
|
case 0:
|
|
1573
1651
|
dispatch({
|
|
1574
1652
|
type: "SET_SAVING",
|
|
1575
1653
|
payload: true
|
|
1576
1654
|
});
|
|
1577
|
-
|
|
1655
|
+
_context9.prev = 1;
|
|
1578
1656
|
evaluationArray = [];
|
|
1579
1657
|
conceptArray = ["description", "datasheet", "images"];
|
|
1580
1658
|
dataGeneral = {
|
|
@@ -1605,7 +1683,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1605
1683
|
}));
|
|
1606
1684
|
}); // Ejecutar todas las evaluaciones
|
|
1607
1685
|
|
|
1608
|
-
|
|
1686
|
+
_context9.next = 9;
|
|
1609
1687
|
return Promise.all(evaluationArray);
|
|
1610
1688
|
|
|
1611
1689
|
case 9:
|
|
@@ -1650,13 +1728,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1650
1728
|
image: _genericModalCheck.default
|
|
1651
1729
|
}
|
|
1652
1730
|
});
|
|
1653
|
-
|
|
1731
|
+
_context9.next = 24;
|
|
1654
1732
|
break;
|
|
1655
1733
|
|
|
1656
1734
|
case 20:
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
console.error("Error evaluating all:",
|
|
1735
|
+
_context9.prev = 20;
|
|
1736
|
+
_context9.t0 = _context9["catch"](1);
|
|
1737
|
+
console.error("Error evaluating all:", _context9.t0);
|
|
1660
1738
|
dispatch({
|
|
1661
1739
|
type: "SET_MODAL",
|
|
1662
1740
|
payload: {
|
|
@@ -1668,24 +1746,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1668
1746
|
});
|
|
1669
1747
|
|
|
1670
1748
|
case 24:
|
|
1671
|
-
|
|
1749
|
+
_context9.prev = 24;
|
|
1672
1750
|
dispatch({
|
|
1673
1751
|
type: "SET_SAVING",
|
|
1674
1752
|
payload: false
|
|
1675
1753
|
});
|
|
1676
1754
|
setRejectAll(false);
|
|
1677
|
-
return
|
|
1755
|
+
return _context9.finish(24);
|
|
1678
1756
|
|
|
1679
1757
|
case 28:
|
|
1680
1758
|
case "end":
|
|
1681
|
-
return
|
|
1759
|
+
return _context9.stop();
|
|
1682
1760
|
}
|
|
1683
1761
|
}
|
|
1684
|
-
},
|
|
1762
|
+
}, _callee9, null, [[1, 20, 24, 28]]);
|
|
1685
1763
|
}));
|
|
1686
1764
|
|
|
1687
1765
|
return function handleOnEvaluateAll(_x6) {
|
|
1688
|
-
return
|
|
1766
|
+
return _ref13.apply(this, arguments);
|
|
1689
1767
|
};
|
|
1690
1768
|
}();
|
|
1691
1769
|
|
|
@@ -1816,21 +1894,21 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1816
1894
|
type: "pink",
|
|
1817
1895
|
label: "Aceptar",
|
|
1818
1896
|
size: 12,
|
|
1819
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1897
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
1820
1898
|
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
1821
|
-
return _regenerator.default.wrap(function
|
|
1899
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1822
1900
|
while (1) {
|
|
1823
|
-
switch (
|
|
1901
|
+
switch (_context10.prev = _context10.next) {
|
|
1824
1902
|
case 0:
|
|
1825
1903
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
1826
1904
|
|
|
1827
1905
|
if (!(!elements || elements.length === 0)) {
|
|
1828
|
-
|
|
1906
|
+
_context10.next = 4;
|
|
1829
1907
|
break;
|
|
1830
1908
|
}
|
|
1831
1909
|
|
|
1832
1910
|
console.error("Elemento no encontrado");
|
|
1833
|
-
return
|
|
1911
|
+
return _context10.abrupt("return");
|
|
1834
1912
|
|
|
1835
1913
|
case 4:
|
|
1836
1914
|
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
@@ -1839,7 +1917,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1839
1917
|
});
|
|
1840
1918
|
|
|
1841
1919
|
if (!isMessageEmpty) {
|
|
1842
|
-
|
|
1920
|
+
_context10.next = 10;
|
|
1843
1921
|
break;
|
|
1844
1922
|
}
|
|
1845
1923
|
|
|
@@ -1854,13 +1932,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1854
1932
|
container.appendChild(alert);
|
|
1855
1933
|
}
|
|
1856
1934
|
|
|
1857
|
-
return
|
|
1935
|
+
return _context10.abrupt("return");
|
|
1858
1936
|
|
|
1859
1937
|
case 10:
|
|
1860
1938
|
fullMessage = Array.from(elements).map(function (element) {
|
|
1861
1939
|
return element.innerHTML;
|
|
1862
1940
|
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
1863
|
-
|
|
1941
|
+
_context10.next = 13;
|
|
1864
1942
|
return createComment(fullMessage, token);
|
|
1865
1943
|
|
|
1866
1944
|
case 13:
|
|
@@ -1869,10 +1947,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1869
1947
|
|
|
1870
1948
|
case 15:
|
|
1871
1949
|
case "end":
|
|
1872
|
-
return
|
|
1950
|
+
return _context10.stop();
|
|
1873
1951
|
}
|
|
1874
1952
|
}
|
|
1875
|
-
},
|
|
1953
|
+
}, _callee10);
|
|
1876
1954
|
}))
|
|
1877
1955
|
}, "btn-Aceptar")]
|
|
1878
1956
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -2000,11 +2078,12 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2000
2078
|
}), family && !family.error && !((_family$variants4 = family.variants) !== null && _family$variants4 !== void 0 && _family$variants4.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
2001
2079
|
className: "loading",
|
|
2002
2080
|
children: "Este producto no tiene variantes."
|
|
2003
|
-
}), (family === null || family === void 0 ? void 0 : (_family$variants5 = family.variants) === null || _family$variants5 === void 0 ? void 0 : _family$variants5.length) > 1 && /*#__PURE__*/(0, _jsxRuntime.
|
|
2081
|
+
}), (family === null || family === void 0 ? void 0 : (_family$variants5 = family.variants) === null || _family$variants5 === void 0 ? void 0 : _family$variants5.length) > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
2004
2082
|
type: "button",
|
|
2005
2083
|
className: "editar-juntas",
|
|
2084
|
+
disabled: preparandoEdicionMultiple,
|
|
2006
2085
|
onClick: openMultipleEdition,
|
|
2007
|
-
children:
|
|
2086
|
+
children: preparandoEdicionMultiple ? "Abriendo…" : "Editar las ".concat(family.variants.length, " variantes juntas")
|
|
2008
2087
|
})]
|
|
2009
2088
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
2010
2089
|
headerData: state.product,
|