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.
- package/dist/components/organisms/VariantGroupModal/index.js +360 -0
- package/dist/components/organisms/VariantGroupModal/styles.js +55 -0
- package/dist/components/pages/ProviderProductEdition/index.js +385 -145
- package/dist/components/pages/RetailerProductEdition/index.js +467 -230
- package/dist/index.js +25 -12
- package/package.json +1 -1
- package/src/components/organisms/VariantGroupModal/index.js +252 -0
- package/src/components/organisms/VariantGroupModal/styles.js +254 -0
- package/src/components/pages/ProviderProductEdition/index.js +164 -0
- package/src/components/pages/RetailerProductEdition/index.js +156 -0
- package/src/index.js +1 -0
|
@@ -69,6 +69,8 @@ var _LinkVariantsModal = require("../../organisms/LinkVariantsModal");
|
|
|
69
69
|
|
|
70
70
|
var _UnlinkVariantModal = require("../../organisms/UnlinkVariantModal");
|
|
71
71
|
|
|
72
|
+
var _VariantGroupModal = require("../../organisms/VariantGroupModal");
|
|
73
|
+
|
|
72
74
|
var _PropagateChangesModal = require("../../organisms/PropagateChangesModal");
|
|
73
75
|
|
|
74
76
|
var _api = require("../../organisms/LinkVariantsModal/api");
|
|
@@ -92,7 +94,7 @@ var _AiProductEdition = require("../../../contexts/AiProductEdition");
|
|
|
92
94
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
93
95
|
|
|
94
96
|
var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
95
|
-
var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _family$variants2, _state$
|
|
97
|
+
var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _state$product15, _family$variants2, _state$product20, _state$product21, _state$product22, _state$active_retaile4, _state$product23, _state$product24, _state$product25, _variantGroup$group, _location$state5, _location$state6, _state$active_retaile5, _state$active_retaile6, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile7, _state$product26, _state$product27, _state$product28, _state$product29, _family$variants3, _family$variants4, _family$variants5, _variantGroup$members, _variantGroup$members2, _state$active_percent, _state$active_percent2, _state$active_retaile8, _state$active_retaile9, _state$active_retaile10, _state$product35, _state$descriptions_i, _state$services2, _state$services2$data, _state$product36, _state$product37, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product38, _state$images_values12;
|
|
96
98
|
|
|
97
99
|
var tabsSections = _ref.tabsSections,
|
|
98
100
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -151,55 +153,76 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
151
153
|
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
152
154
|
loadingVariant = _useState12[0],
|
|
153
155
|
setLoadingVariant = _useState12[1];
|
|
156
|
+
/*
|
|
157
|
+
Agrupación de variantes. Vive aparte del padre/hijo de arriba a propósito:
|
|
158
|
+
son mecanismos independientes y un producto puede tener los dos. Padre/hijo
|
|
159
|
+
es herencia; esto es solo una agrupación por un código compartido.
|
|
160
|
+
*/
|
|
161
|
+
|
|
154
162
|
|
|
155
163
|
var _useState13 = (0, _react.useState)(null),
|
|
156
164
|
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
157
|
-
|
|
158
|
-
|
|
165
|
+
variantGroup = _useState14[0],
|
|
166
|
+
setVariantGroup = _useState14[1];
|
|
159
167
|
|
|
160
168
|
var _useState15 = (0, _react.useState)(false),
|
|
161
169
|
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
162
|
-
|
|
163
|
-
|
|
170
|
+
showGroup = _useState16[0],
|
|
171
|
+
setShowGroup = _useState16[1];
|
|
164
172
|
|
|
165
173
|
var _useState17 = (0, _react.useState)(false),
|
|
166
174
|
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
showGroupModal = _useState18[0],
|
|
176
|
+
setShowGroupModal = _useState18[1];
|
|
169
177
|
|
|
170
|
-
var _useState19 = (0, _react.useState)(
|
|
178
|
+
var _useState19 = (0, _react.useState)(null),
|
|
171
179
|
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
172
|
-
|
|
173
|
-
|
|
180
|
+
pendingPropagation = _useState20[0],
|
|
181
|
+
setPendingPropagation = _useState20[1];
|
|
174
182
|
|
|
175
|
-
var _useState21 = (0, _react.useState)(
|
|
183
|
+
var _useState21 = (0, _react.useState)(false),
|
|
176
184
|
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
preparandoPropagacion = _useState22[0],
|
|
186
|
+
setPreparandoPropagacion = _useState22[1];
|
|
179
187
|
|
|
180
|
-
var _useState23 = (0, _react.useState)(
|
|
188
|
+
var _useState23 = (0, _react.useState)(false),
|
|
181
189
|
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
preparandoEdicionMultiple = _useState24[0],
|
|
191
|
+
setPreparandoEdicionMultiple = _useState24[1];
|
|
184
192
|
|
|
185
193
|
var _useState25 = (0, _react.useState)(false),
|
|
186
194
|
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
187
|
-
|
|
188
|
-
|
|
195
|
+
showRejectModal = _useState26[0],
|
|
196
|
+
setShowRejectModal = _useState26[1];
|
|
189
197
|
|
|
190
|
-
var _useState27 = (0, _react.useState)(
|
|
198
|
+
var _useState27 = (0, _react.useState)(0),
|
|
191
199
|
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
192
|
-
|
|
193
|
-
|
|
200
|
+
headerTop = _useState28[0],
|
|
201
|
+
setHeaderTop = _useState28[1];
|
|
202
|
+
|
|
203
|
+
var _useState29 = (0, _react.useState)({}),
|
|
204
|
+
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
205
|
+
assig = _useState30[0],
|
|
206
|
+
setAssig = _useState30[1];
|
|
194
207
|
|
|
195
|
-
var
|
|
208
|
+
var _useState31 = (0, _react.useState)(false),
|
|
209
|
+
_useState32 = (0, _slicedToArray2.default)(_useState31, 2),
|
|
210
|
+
imageLayout = _useState32[0],
|
|
211
|
+
setImageLayout = _useState32[1];
|
|
212
|
+
|
|
213
|
+
var _useState33 = (0, _react.useState)(false),
|
|
214
|
+
_useState34 = (0, _slicedToArray2.default)(_useState33, 2),
|
|
215
|
+
rejectAll = _useState34[0],
|
|
216
|
+
setRejectAll = _useState34[1];
|
|
217
|
+
|
|
218
|
+
var _useState35 = (0, _react.useState)({
|
|
196
219
|
"Ficha técnica": null,
|
|
197
220
|
Descripción: null,
|
|
198
221
|
Imágenes: null
|
|
199
222
|
}),
|
|
200
|
-
|
|
201
|
-
origin =
|
|
202
|
-
setOrigin =
|
|
223
|
+
_useState36 = (0, _slicedToArray2.default)(_useState35, 2),
|
|
224
|
+
origin = _useState36[0],
|
|
225
|
+
setOrigin = _useState36[1];
|
|
203
226
|
|
|
204
227
|
var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
|
|
205
228
|
_useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
|
|
@@ -326,10 +349,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
326
349
|
de antes hasta que alguien cierra y reabre el producto.
|
|
327
350
|
*/
|
|
328
351
|
|
|
329
|
-
var
|
|
330
|
-
|
|
331
|
-
linkNonce =
|
|
332
|
-
setLinkNonce =
|
|
352
|
+
var _useState37 = (0, _react.useState)(0),
|
|
353
|
+
_useState38 = (0, _slicedToArray2.default)(_useState37, 2),
|
|
354
|
+
linkNonce = _useState38[0],
|
|
355
|
+
setLinkNonce = _useState38[1]; // Setter de los servicios y porcentages del producto
|
|
333
356
|
|
|
334
357
|
|
|
335
358
|
(0, _react.useEffect)(function () {
|
|
@@ -1117,10 +1140,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1117
1140
|
*/
|
|
1118
1141
|
|
|
1119
1142
|
|
|
1120
|
-
var
|
|
1121
|
-
|
|
1122
|
-
porDesvincular =
|
|
1123
|
-
setPorDesvincular =
|
|
1143
|
+
var _useState39 = (0, _react.useState)(null),
|
|
1144
|
+
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
1145
|
+
porDesvincular = _useState40[0],
|
|
1146
|
+
setPorDesvincular = _useState40[1];
|
|
1124
1147
|
/*
|
|
1125
1148
|
Después de desvincular, esta ficha cambia de forma.
|
|
1126
1149
|
Si el producto se soltó de su padre, deja de ser hijo y vuelve a poder ligar
|
|
@@ -1176,18 +1199,161 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1176
1199
|
return n + 1;
|
|
1177
1200
|
});
|
|
1178
1201
|
};
|
|
1202
|
+
/*
|
|
1203
|
+
Trae el grupo de variantes del producto y sus miembros.
|
|
1204
|
+
Se pide al montar y no al abrir el desplegable —al contrario que la familia
|
|
1205
|
+
padre/hijo— porque aquí el conteo no viene en el producto: `variant_group`
|
|
1206
|
+
no lo devuelven los endpoints del listado, así que sin esta llamada la ficha
|
|
1207
|
+
no sabría ni si el producto está agrupado.
|
|
1208
|
+
*/
|
|
1179
1209
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1210
|
+
|
|
1211
|
+
var loadVariantGroup = /*#__PURE__*/function () {
|
|
1212
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1213
|
+
var forzar,
|
|
1214
|
+
_state$product13,
|
|
1215
|
+
res,
|
|
1216
|
+
data,
|
|
1217
|
+
_args5 = arguments;
|
|
1183
1218
|
|
|
1184
1219
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1185
1220
|
while (1) {
|
|
1186
1221
|
switch (_context5.prev = _context5.next) {
|
|
1222
|
+
case 0:
|
|
1223
|
+
forzar = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
|
|
1224
|
+
|
|
1225
|
+
if (!(variantGroup && !forzar)) {
|
|
1226
|
+
_context5.next = 3;
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
return _context5.abrupt("return", variantGroup);
|
|
1231
|
+
|
|
1232
|
+
case 3:
|
|
1233
|
+
_context5.prev = 3;
|
|
1234
|
+
_context5.next = 6;
|
|
1235
|
+
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/group"), {
|
|
1236
|
+
articleId: (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.id_article
|
|
1237
|
+
}, {
|
|
1238
|
+
headers: {
|
|
1239
|
+
Authorization: token
|
|
1240
|
+
}
|
|
1241
|
+
});
|
|
1242
|
+
|
|
1243
|
+
case 6:
|
|
1244
|
+
res = _context5.sent;
|
|
1245
|
+
data = (0, _api.readPayload)(res);
|
|
1246
|
+
setVariantGroup(data);
|
|
1247
|
+
return _context5.abrupt("return", data);
|
|
1248
|
+
|
|
1249
|
+
case 12:
|
|
1250
|
+
_context5.prev = 12;
|
|
1251
|
+
_context5.t0 = _context5["catch"](3);
|
|
1252
|
+
console.error("loadVariantGroup: ", _context5.t0);
|
|
1253
|
+
setVariantGroup({
|
|
1254
|
+
group: null,
|
|
1255
|
+
members: [],
|
|
1256
|
+
error: true
|
|
1257
|
+
});
|
|
1258
|
+
return _context5.abrupt("return", null);
|
|
1259
|
+
|
|
1260
|
+
case 17:
|
|
1261
|
+
case "end":
|
|
1262
|
+
return _context5.stop();
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}, _callee5, null, [[3, 12]]);
|
|
1266
|
+
}));
|
|
1267
|
+
|
|
1268
|
+
return function loadVariantGroup() {
|
|
1269
|
+
return _ref9.apply(this, arguments);
|
|
1270
|
+
};
|
|
1271
|
+
}();
|
|
1272
|
+
|
|
1273
|
+
(0, _react.useEffect)(function () {
|
|
1274
|
+
var _state$product14;
|
|
1275
|
+
|
|
1276
|
+
if (!((_state$product14 = state.product) !== null && _state$product14 !== void 0 && _state$product14.id_article)) return;
|
|
1277
|
+
loadVariantGroup(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1278
|
+
}, [(_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article]); // Saca el producto del grupo. Los demás miembros siguen agrupados entre ellos;
|
|
1279
|
+
// si era el último, el grupo deja de existir, porque no vive en ninguna tabla.
|
|
1280
|
+
|
|
1281
|
+
var handleOnLeaveGroup = /*#__PURE__*/function () {
|
|
1282
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1283
|
+
var _state$product16, res;
|
|
1284
|
+
|
|
1285
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1286
|
+
while (1) {
|
|
1287
|
+
switch (_context6.prev = _context6.next) {
|
|
1288
|
+
case 0:
|
|
1289
|
+
_context6.prev = 0;
|
|
1290
|
+
_context6.next = 3;
|
|
1291
|
+
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/leave"), {
|
|
1292
|
+
articleId: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.id_article
|
|
1293
|
+
}, {
|
|
1294
|
+
headers: {
|
|
1295
|
+
Authorization: token
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
case 3:
|
|
1300
|
+
res = _context6.sent;
|
|
1301
|
+
setVariantGroup((0, _api.readPayload)(res));
|
|
1302
|
+
setShowGroup(false);
|
|
1303
|
+
_context6.next = 12;
|
|
1304
|
+
break;
|
|
1305
|
+
|
|
1306
|
+
case 8:
|
|
1307
|
+
_context6.prev = 8;
|
|
1308
|
+
_context6.t0 = _context6["catch"](0);
|
|
1309
|
+
console.error("leaveVariantGroup: ", _context6.t0);
|
|
1310
|
+
dispatch({
|
|
1311
|
+
type: "SET_MODAL",
|
|
1312
|
+
payload: {
|
|
1313
|
+
show: true,
|
|
1314
|
+
title: "Variantes",
|
|
1315
|
+
message: "No se pudo quitar el producto del grupo. Intenta de nuevo.",
|
|
1316
|
+
image: _genericModalWarning.default,
|
|
1317
|
+
// Con `buttons` vacío el modal se queda sin forma de cerrarse.
|
|
1318
|
+
buttons: [{
|
|
1319
|
+
text: "Entendido",
|
|
1320
|
+
buttonType: "general-white-button",
|
|
1321
|
+
action: function action() {
|
|
1322
|
+
return dispatch({
|
|
1323
|
+
type: "SET_MODAL",
|
|
1324
|
+
payload: {
|
|
1325
|
+
show: false
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
}]
|
|
1330
|
+
}
|
|
1331
|
+
});
|
|
1332
|
+
|
|
1333
|
+
case 12:
|
|
1334
|
+
case "end":
|
|
1335
|
+
return _context6.stop();
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}, _callee6, null, [[0, 8]]);
|
|
1339
|
+
}));
|
|
1340
|
+
|
|
1341
|
+
return function handleOnLeaveGroup() {
|
|
1342
|
+
return _ref10.apply(this, arguments);
|
|
1343
|
+
};
|
|
1344
|
+
}();
|
|
1345
|
+
|
|
1346
|
+
var openVariant = /*#__PURE__*/function () {
|
|
1347
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(articleId) {
|
|
1348
|
+
var res, _readPayload2, data, encontrado;
|
|
1349
|
+
|
|
1350
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1351
|
+
while (1) {
|
|
1352
|
+
switch (_context7.prev = _context7.next) {
|
|
1187
1353
|
case 0:
|
|
1188
1354
|
setLoadingVariant(articleId);
|
|
1189
|
-
|
|
1190
|
-
|
|
1355
|
+
_context7.prev = 1;
|
|
1356
|
+
_context7.next = 4;
|
|
1191
1357
|
return _axios.default.get("".concat(process.env.REACT_APP_NEW_ARTICLES_ENDPOINT), {
|
|
1192
1358
|
params: {
|
|
1193
1359
|
listType: "general",
|
|
@@ -1199,7 +1365,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1199
1365
|
});
|
|
1200
1366
|
|
|
1201
1367
|
case 4:
|
|
1202
|
-
res =
|
|
1368
|
+
res = _context7.sent;
|
|
1203
1369
|
// read-articles-v2 responde { count, data: [...] }.
|
|
1204
1370
|
_readPayload2 = (0, _api.readPayload)(res), data = _readPayload2.data;
|
|
1205
1371
|
encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
|
|
@@ -1219,33 +1385,33 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1219
1385
|
}));
|
|
1220
1386
|
}
|
|
1221
1387
|
|
|
1222
|
-
|
|
1388
|
+
_context7.next = 13;
|
|
1223
1389
|
break;
|
|
1224
1390
|
|
|
1225
1391
|
case 10:
|
|
1226
|
-
|
|
1227
|
-
|
|
1392
|
+
_context7.prev = 10;
|
|
1393
|
+
_context7.t0 = _context7["catch"](1);
|
|
1228
1394
|
// Si la consulta falla se navega igual: la pantalla mostrará el producto
|
|
1229
1395
|
// que hubiera en sessionStorage, que es el comportamiento de siempre.
|
|
1230
1396
|
// Peor sería dejar el clic sin efecto y que pareciera que no responde.
|
|
1231
|
-
console.error("openVariant: ",
|
|
1397
|
+
console.error("openVariant: ", _context7.t0);
|
|
1232
1398
|
|
|
1233
1399
|
case 13:
|
|
1234
|
-
|
|
1400
|
+
_context7.prev = 13;
|
|
1235
1401
|
setLoadingVariant(null);
|
|
1236
1402
|
window.location.assign("/products/".concat(articleId, "/datasheet"));
|
|
1237
|
-
return
|
|
1403
|
+
return _context7.finish(13);
|
|
1238
1404
|
|
|
1239
1405
|
case 17:
|
|
1240
1406
|
case "end":
|
|
1241
|
-
return
|
|
1407
|
+
return _context7.stop();
|
|
1242
1408
|
}
|
|
1243
1409
|
}
|
|
1244
|
-
},
|
|
1410
|
+
}, _callee7, null, [[1, 10, 13, 17]]);
|
|
1245
1411
|
}));
|
|
1246
1412
|
|
|
1247
1413
|
return function openVariant(_x2) {
|
|
1248
|
-
return
|
|
1414
|
+
return _ref11.apply(this, arguments);
|
|
1249
1415
|
};
|
|
1250
1416
|
}();
|
|
1251
1417
|
/*
|
|
@@ -1261,11 +1427,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1261
1427
|
|
|
1262
1428
|
|
|
1263
1429
|
var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
|
|
1264
|
-
var _state$product$varian2, _state$
|
|
1430
|
+
var _state$product$varian2, _state$product17, _result$linked, _result$parentArticle;
|
|
1265
1431
|
|
|
1266
1432
|
if (!result) return;
|
|
1267
1433
|
var updatedProduct = result.mode === "children" ? (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
|
|
1268
|
-
variantsCount: ((_state$product$varian2 = (_state$
|
|
1434
|
+
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
|
|
1269
1435
|
}) : (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.product), {}, {
|
|
1270
1436
|
parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
|
|
1271
1437
|
variantsCount: 0
|
|
@@ -1323,31 +1489,31 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1323
1489
|
|
|
1324
1490
|
|
|
1325
1491
|
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
1326
|
-
var
|
|
1327
|
-
var _state$
|
|
1492
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(attributeId) {
|
|
1493
|
+
var _state$product18;
|
|
1328
1494
|
|
|
1329
1495
|
var kind,
|
|
1330
1496
|
esDescripcion,
|
|
1331
1497
|
res,
|
|
1332
1498
|
data,
|
|
1333
|
-
|
|
1334
|
-
return _regenerator.default.wrap(function
|
|
1499
|
+
_args8 = arguments;
|
|
1500
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1335
1501
|
while (1) {
|
|
1336
|
-
switch (
|
|
1502
|
+
switch (_context8.prev = _context8.next) {
|
|
1337
1503
|
case 0:
|
|
1338
|
-
kind =
|
|
1504
|
+
kind = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : "attribute";
|
|
1339
1505
|
|
|
1340
|
-
if (!(!attributeId || !((_state$
|
|
1341
|
-
|
|
1506
|
+
if (!(!attributeId || !((_state$product18 = state.product) !== null && _state$product18 !== void 0 && _state$product18.id_article))) {
|
|
1507
|
+
_context8.next = 3;
|
|
1342
1508
|
break;
|
|
1343
1509
|
}
|
|
1344
1510
|
|
|
1345
|
-
return
|
|
1511
|
+
return _context8.abrupt("return");
|
|
1346
1512
|
|
|
1347
1513
|
case 3:
|
|
1348
1514
|
esDescripcion = kind === "description";
|
|
1349
|
-
|
|
1350
|
-
|
|
1515
|
+
_context8.prev = 4;
|
|
1516
|
+
_context8.next = 7;
|
|
1351
1517
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread4.default)({
|
|
1352
1518
|
articleId: state.product.id_article
|
|
1353
1519
|
}, esDescripcion ? {
|
|
@@ -1361,13 +1527,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1361
1527
|
});
|
|
1362
1528
|
|
|
1363
1529
|
case 7:
|
|
1364
|
-
res =
|
|
1530
|
+
res = _context8.sent;
|
|
1365
1531
|
// El API responde 200 aunque la lambda haya devuelto 400: el resultado
|
|
1366
1532
|
// real viaja en el cuerpo y readPayload lo convierte en excepción.
|
|
1367
1533
|
data = (0, _api.readPayload)(res);
|
|
1368
1534
|
|
|
1369
1535
|
if (!esDescripcion) {
|
|
1370
|
-
|
|
1536
|
+
_context8.next = 12;
|
|
1371
1537
|
break;
|
|
1372
1538
|
}
|
|
1373
1539
|
|
|
@@ -1381,7 +1547,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1381
1547
|
};
|
|
1382
1548
|
})
|
|
1383
1549
|
});
|
|
1384
|
-
return
|
|
1550
|
+
return _context8.abrupt("return");
|
|
1385
1551
|
|
|
1386
1552
|
case 12:
|
|
1387
1553
|
dispatch({
|
|
@@ -1394,24 +1560,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1394
1560
|
};
|
|
1395
1561
|
})
|
|
1396
1562
|
});
|
|
1397
|
-
|
|
1563
|
+
_context8.next = 18;
|
|
1398
1564
|
break;
|
|
1399
1565
|
|
|
1400
1566
|
case 15:
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
console.error("restoreInheritance: ",
|
|
1567
|
+
_context8.prev = 15;
|
|
1568
|
+
_context8.t0 = _context8["catch"](4);
|
|
1569
|
+
console.error("restoreInheritance: ", _context8.t0);
|
|
1404
1570
|
|
|
1405
1571
|
case 18:
|
|
1406
1572
|
case "end":
|
|
1407
|
-
return
|
|
1573
|
+
return _context8.stop();
|
|
1408
1574
|
}
|
|
1409
1575
|
}
|
|
1410
|
-
},
|
|
1576
|
+
}, _callee8, null, [[4, 15]]);
|
|
1411
1577
|
}));
|
|
1412
1578
|
|
|
1413
1579
|
return function handleOnRestoreInheritance(_x3) {
|
|
1414
|
-
return
|
|
1580
|
+
return _ref12.apply(this, arguments);
|
|
1415
1581
|
};
|
|
1416
1582
|
}();
|
|
1417
1583
|
|
|
@@ -1446,14 +1612,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1446
1612
|
};
|
|
1447
1613
|
|
|
1448
1614
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1449
|
-
var
|
|
1450
|
-
var _state$product$id_ord, _state$active_retaile3, _state$product$status, _state$product$status2, _state$
|
|
1615
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
|
|
1616
|
+
var _state$product$id_ord, _state$active_retaile3, _state$product$status, _state$product$status2, _state$product19;
|
|
1451
1617
|
|
|
1452
1618
|
var concept, articleId, orderId, retailerId, evalStatus, data, _newStatuses$newStatu, _state$services_data, res, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
1453
1619
|
|
|
1454
|
-
return _regenerator.default.wrap(function
|
|
1620
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1455
1621
|
while (1) {
|
|
1456
|
-
switch (
|
|
1622
|
+
switch (_context9.prev = _context9.next) {
|
|
1457
1623
|
case 0:
|
|
1458
1624
|
dispatch({
|
|
1459
1625
|
type: "SET_SAVING",
|
|
@@ -1463,23 +1629,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1463
1629
|
articleId = state.product.id_article;
|
|
1464
1630
|
orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
|
|
1465
1631
|
retailerId = (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer;
|
|
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$
|
|
1632
|
+
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$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.version_status);
|
|
1467
1633
|
data = {
|
|
1468
1634
|
articleId: articleId,
|
|
1469
1635
|
orderId: orderId,
|
|
1470
1636
|
concept: concept,
|
|
1471
1637
|
evalStatus: evalStatus
|
|
1472
1638
|
};
|
|
1473
|
-
|
|
1639
|
+
_context9.prev = 7;
|
|
1474
1640
|
|
|
1475
1641
|
if (!result) {
|
|
1476
|
-
|
|
1642
|
+
_context9.next = 22;
|
|
1477
1643
|
break;
|
|
1478
1644
|
}
|
|
1479
1645
|
|
|
1480
1646
|
data.result = result;
|
|
1481
1647
|
data.retailerId = retailerId;
|
|
1482
|
-
|
|
1648
|
+
_context9.next = 13;
|
|
1483
1649
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1484
1650
|
headers: {
|
|
1485
1651
|
Authorization: token
|
|
@@ -1487,7 +1653,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1487
1653
|
});
|
|
1488
1654
|
|
|
1489
1655
|
case 13:
|
|
1490
|
-
res =
|
|
1656
|
+
res = _context9.sent;
|
|
1491
1657
|
newStatuses = JSON.parse(res.data.body);
|
|
1492
1658
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")]; // Actualizar el producto con los nuevos estados
|
|
1493
1659
|
|
|
@@ -1524,13 +1690,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1524
1690
|
});
|
|
1525
1691
|
|
|
1526
1692
|
case 22:
|
|
1527
|
-
|
|
1693
|
+
_context9.next = 28;
|
|
1528
1694
|
break;
|
|
1529
1695
|
|
|
1530
1696
|
case 24:
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
console.error("Error sending evaluation:",
|
|
1697
|
+
_context9.prev = 24;
|
|
1698
|
+
_context9.t0 = _context9["catch"](7);
|
|
1699
|
+
console.error("Error sending evaluation:", _context9.t0);
|
|
1534
1700
|
dispatch({
|
|
1535
1701
|
type: "SET_MODAL",
|
|
1536
1702
|
payload: {
|
|
@@ -1542,32 +1708,32 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1542
1708
|
});
|
|
1543
1709
|
|
|
1544
1710
|
case 28:
|
|
1545
|
-
|
|
1711
|
+
_context9.prev = 28;
|
|
1546
1712
|
dispatch({
|
|
1547
1713
|
type: "SET_SAVING",
|
|
1548
1714
|
payload: false
|
|
1549
1715
|
});
|
|
1550
|
-
return
|
|
1716
|
+
return _context9.finish(28);
|
|
1551
1717
|
|
|
1552
1718
|
case 31:
|
|
1553
1719
|
case "end":
|
|
1554
|
-
return
|
|
1720
|
+
return _context9.stop();
|
|
1555
1721
|
}
|
|
1556
1722
|
}
|
|
1557
|
-
},
|
|
1723
|
+
}, _callee9, null, [[7, 24, 28, 31]]);
|
|
1558
1724
|
}));
|
|
1559
1725
|
|
|
1560
1726
|
return function sendEvaluation(_x4) {
|
|
1561
|
-
return
|
|
1727
|
+
return _ref13.apply(this, arguments);
|
|
1562
1728
|
};
|
|
1563
1729
|
}();
|
|
1564
1730
|
|
|
1565
1731
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1566
|
-
var
|
|
1732
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
|
|
1567
1733
|
var data, statusComplete, updatedProduct;
|
|
1568
|
-
return _regenerator.default.wrap(function
|
|
1734
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1569
1735
|
while (1) {
|
|
1570
|
-
switch (
|
|
1736
|
+
switch (_context10.prev = _context10.next) {
|
|
1571
1737
|
case 0:
|
|
1572
1738
|
dispatch({
|
|
1573
1739
|
type: "SET_SAVING",
|
|
@@ -1579,8 +1745,8 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1579
1745
|
versionId: state.product.version,
|
|
1580
1746
|
status: result
|
|
1581
1747
|
};
|
|
1582
|
-
|
|
1583
|
-
|
|
1748
|
+
_context10.prev = 2;
|
|
1749
|
+
_context10.next = 5;
|
|
1584
1750
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1585
1751
|
headers: {
|
|
1586
1752
|
Authorization: token
|
|
@@ -1610,13 +1776,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1610
1776
|
image: _genericModalCheck.default
|
|
1611
1777
|
}
|
|
1612
1778
|
});
|
|
1613
|
-
|
|
1779
|
+
_context10.next = 15;
|
|
1614
1780
|
break;
|
|
1615
1781
|
|
|
1616
1782
|
case 11:
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
console.error("Error evaluating to retailer:",
|
|
1783
|
+
_context10.prev = 11;
|
|
1784
|
+
_context10.t0 = _context10["catch"](2);
|
|
1785
|
+
console.error("Error evaluating to retailer:", _context10.t0);
|
|
1620
1786
|
dispatch({
|
|
1621
1787
|
type: "SET_MODAL",
|
|
1622
1788
|
payload: {
|
|
@@ -1628,23 +1794,23 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1628
1794
|
});
|
|
1629
1795
|
|
|
1630
1796
|
case 15:
|
|
1631
|
-
|
|
1797
|
+
_context10.prev = 15;
|
|
1632
1798
|
dispatch({
|
|
1633
1799
|
type: "SET_SAVING",
|
|
1634
1800
|
payload: false
|
|
1635
1801
|
});
|
|
1636
|
-
return
|
|
1802
|
+
return _context10.finish(15);
|
|
1637
1803
|
|
|
1638
1804
|
case 18:
|
|
1639
1805
|
case "end":
|
|
1640
|
-
return
|
|
1806
|
+
return _context10.stop();
|
|
1641
1807
|
}
|
|
1642
1808
|
}
|
|
1643
|
-
},
|
|
1809
|
+
}, _callee10, null, [[2, 11, 15, 18]]);
|
|
1644
1810
|
}));
|
|
1645
1811
|
|
|
1646
1812
|
return function evaluationToRetailer(_x5) {
|
|
1647
|
-
return
|
|
1813
|
+
return _ref14.apply(this, arguments);
|
|
1648
1814
|
};
|
|
1649
1815
|
}();
|
|
1650
1816
|
|
|
@@ -1775,18 +1941,18 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1775
1941
|
};
|
|
1776
1942
|
|
|
1777
1943
|
var handleOnEvaluateAll = /*#__PURE__*/function () {
|
|
1778
|
-
var
|
|
1944
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
|
|
1779
1945
|
var _state$product$id_ord2, _state$services_data2, evaluationArray, conceptArray, dataGeneral, isProvider, userType, status, updatedStatusByRetailer, updatedProduct;
|
|
1780
1946
|
|
|
1781
|
-
return _regenerator.default.wrap(function
|
|
1947
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1782
1948
|
while (1) {
|
|
1783
|
-
switch (
|
|
1949
|
+
switch (_context11.prev = _context11.next) {
|
|
1784
1950
|
case 0:
|
|
1785
1951
|
dispatch({
|
|
1786
1952
|
type: "SET_SAVING",
|
|
1787
1953
|
payload: true
|
|
1788
1954
|
});
|
|
1789
|
-
|
|
1955
|
+
_context11.prev = 1;
|
|
1790
1956
|
evaluationArray = [];
|
|
1791
1957
|
conceptArray = ["description", "datasheet", "images"];
|
|
1792
1958
|
dataGeneral = {
|
|
@@ -1817,7 +1983,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1817
1983
|
}));
|
|
1818
1984
|
}); // Ejecutar todas las evaluaciones
|
|
1819
1985
|
|
|
1820
|
-
|
|
1986
|
+
_context11.next = 9;
|
|
1821
1987
|
return Promise.all(evaluationArray);
|
|
1822
1988
|
|
|
1823
1989
|
case 9:
|
|
@@ -1862,13 +2028,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1862
2028
|
image: _genericModalCheck.default
|
|
1863
2029
|
}
|
|
1864
2030
|
});
|
|
1865
|
-
|
|
2031
|
+
_context11.next = 24;
|
|
1866
2032
|
break;
|
|
1867
2033
|
|
|
1868
2034
|
case 20:
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
console.error("Error evaluating all:",
|
|
2035
|
+
_context11.prev = 20;
|
|
2036
|
+
_context11.t0 = _context11["catch"](1);
|
|
2037
|
+
console.error("Error evaluating all:", _context11.t0);
|
|
1872
2038
|
dispatch({
|
|
1873
2039
|
type: "SET_MODAL",
|
|
1874
2040
|
payload: {
|
|
@@ -1880,24 +2046,24 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1880
2046
|
});
|
|
1881
2047
|
|
|
1882
2048
|
case 24:
|
|
1883
|
-
|
|
2049
|
+
_context11.prev = 24;
|
|
1884
2050
|
dispatch({
|
|
1885
2051
|
type: "SET_SAVING",
|
|
1886
2052
|
payload: false
|
|
1887
2053
|
});
|
|
1888
2054
|
setRejectAll(false);
|
|
1889
|
-
return
|
|
2055
|
+
return _context11.finish(24);
|
|
1890
2056
|
|
|
1891
2057
|
case 28:
|
|
1892
2058
|
case "end":
|
|
1893
|
-
return
|
|
2059
|
+
return _context11.stop();
|
|
1894
2060
|
}
|
|
1895
2061
|
}
|
|
1896
|
-
},
|
|
2062
|
+
}, _callee11, null, [[1, 20, 24, 28]]);
|
|
1897
2063
|
}));
|
|
1898
2064
|
|
|
1899
2065
|
return function handleOnEvaluateAll(_x6) {
|
|
1900
|
-
return
|
|
2066
|
+
return _ref15.apply(this, arguments);
|
|
1901
2067
|
};
|
|
1902
2068
|
}();
|
|
1903
2069
|
|
|
@@ -1959,15 +2125,28 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1959
2125
|
saveDatasheets(token, propagation !== null && propagation !== void 0 ? propagation : undefined);
|
|
1960
2126
|
}
|
|
1961
2127
|
}), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
|
|
1962
|
-
articleId: (_state$
|
|
1963
|
-
articleName: (_state$
|
|
1964
|
-
articleUpc: (_state$
|
|
2128
|
+
articleId: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.id_article,
|
|
2129
|
+
articleName: (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.name,
|
|
2130
|
+
articleUpc: (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.upc,
|
|
1965
2131
|
activeRetailerId: (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer,
|
|
1966
2132
|
token: token,
|
|
1967
2133
|
onClose: function onClose() {
|
|
1968
2134
|
return setShowLinkVariants(false);
|
|
1969
2135
|
},
|
|
1970
2136
|
onLinked: handleOnLinkedVariants
|
|
2137
|
+
}), showGroupModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VariantGroupModal.VariantGroupModal, {
|
|
2138
|
+
articleId: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.id_article,
|
|
2139
|
+
articleName: (_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.name,
|
|
2140
|
+
articleUpc: (_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.upc,
|
|
2141
|
+
currentGroup: (_variantGroup$group = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) !== null && _variantGroup$group !== void 0 ? _variantGroup$group : null,
|
|
2142
|
+
token: token,
|
|
2143
|
+
onClose: function onClose() {
|
|
2144
|
+
return setShowGroupModal(false);
|
|
2145
|
+
},
|
|
2146
|
+
onSaved: function onSaved(result) {
|
|
2147
|
+
setVariantGroup(result);
|
|
2148
|
+
setShowGroup(true);
|
|
2149
|
+
}
|
|
1971
2150
|
}), porDesvincular && /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnlinkVariantModal.UnlinkVariantModal, (0, _objectSpread4.default)((0, _objectSpread4.default)({}, porDesvincular), {}, {
|
|
1972
2151
|
token: token,
|
|
1973
2152
|
onClose: function onClose() {
|
|
@@ -2034,21 +2213,21 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2034
2213
|
type: "pink",
|
|
2035
2214
|
label: "Aceptar",
|
|
2036
2215
|
size: 12,
|
|
2037
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2216
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
2038
2217
|
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
2039
|
-
return _regenerator.default.wrap(function
|
|
2218
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
2040
2219
|
while (1) {
|
|
2041
|
-
switch (
|
|
2220
|
+
switch (_context12.prev = _context12.next) {
|
|
2042
2221
|
case 0:
|
|
2043
2222
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
2044
2223
|
|
|
2045
2224
|
if (!(!elements || elements.length === 0)) {
|
|
2046
|
-
|
|
2225
|
+
_context12.next = 4;
|
|
2047
2226
|
break;
|
|
2048
2227
|
}
|
|
2049
2228
|
|
|
2050
2229
|
console.error("Elemento no encontrado");
|
|
2051
|
-
return
|
|
2230
|
+
return _context12.abrupt("return");
|
|
2052
2231
|
|
|
2053
2232
|
case 4:
|
|
2054
2233
|
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
@@ -2057,7 +2236,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2057
2236
|
});
|
|
2058
2237
|
|
|
2059
2238
|
if (!isMessageEmpty) {
|
|
2060
|
-
|
|
2239
|
+
_context12.next = 10;
|
|
2061
2240
|
break;
|
|
2062
2241
|
}
|
|
2063
2242
|
|
|
@@ -2072,13 +2251,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2072
2251
|
container.appendChild(alert);
|
|
2073
2252
|
}
|
|
2074
2253
|
|
|
2075
|
-
return
|
|
2254
|
+
return _context12.abrupt("return");
|
|
2076
2255
|
|
|
2077
2256
|
case 10:
|
|
2078
2257
|
fullMessage = Array.from(elements).map(function (element) {
|
|
2079
2258
|
return element.innerHTML;
|
|
2080
2259
|
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
2081
|
-
|
|
2260
|
+
_context12.next = 13;
|
|
2082
2261
|
return createComment(fullMessage, token);
|
|
2083
2262
|
|
|
2084
2263
|
case 13:
|
|
@@ -2087,10 +2266,10 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2087
2266
|
|
|
2088
2267
|
case 15:
|
|
2089
2268
|
case "end":
|
|
2090
|
-
return
|
|
2269
|
+
return _context12.stop();
|
|
2091
2270
|
}
|
|
2092
2271
|
}
|
|
2093
|
-
},
|
|
2272
|
+
}, _callee12);
|
|
2094
2273
|
}))
|
|
2095
2274
|
}, "btn-Aceptar")]
|
|
2096
2275
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -2117,7 +2296,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2117
2296
|
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] : {},
|
|
2118
2297
|
assignationsImages: assig,
|
|
2119
2298
|
retailerSelected: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.id_retailer,
|
|
2120
|
-
imagesStatus: ((_state$
|
|
2299
|
+
imagesStatus: ((_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.images_status) || "-",
|
|
2121
2300
|
isRetailer: isRetailer,
|
|
2122
2301
|
setShowVersionSelector: setShowVersionSelector,
|
|
2123
2302
|
version: state.product.version,
|
|
@@ -2130,7 +2309,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2130
2309
|
className: "product-information",
|
|
2131
2310
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2132
2311
|
className: "product-information",
|
|
2133
|
-
children: [!((_state$
|
|
2312
|
+
children: [!((_state$product27 = state.product) !== null && _state$product27 !== void 0 && _state$product27.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2134
2313
|
className: "variants-actions",
|
|
2135
2314
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
2136
2315
|
type: "button",
|
|
@@ -2139,7 +2318,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2139
2318
|
return setShowLinkVariants(true);
|
|
2140
2319
|
},
|
|
2141
2320
|
children: "Ligar productos"
|
|
2142
|
-
}), ((_state$
|
|
2321
|
+
}), ((_state$product28 = state.product) === null || _state$product28 === void 0 ? void 0 : _state$product28.variantsCount) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
2143
2322
|
type: "button",
|
|
2144
2323
|
className: "variants-count",
|
|
2145
2324
|
"aria-expanded": showFamily,
|
|
@@ -2154,7 +2333,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2154
2333
|
children: showFamily ? " ▴" : " ▾"
|
|
2155
2334
|
})]
|
|
2156
2335
|
})]
|
|
2157
|
-
}), ((_state$
|
|
2336
|
+
}), ((_state$product29 = state.product) === null || _state$product29 === void 0 ? void 0 : _state$product29.parentArticleId) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
2158
2337
|
className: "variants-actions",
|
|
2159
2338
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
2160
2339
|
type: "button",
|
|
@@ -2203,13 +2382,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2203
2382
|
className: "desvincular",
|
|
2204
2383
|
title: "Dejar de ser hijo de este producto",
|
|
2205
2384
|
onClick: function onClick() {
|
|
2206
|
-
var _state$
|
|
2385
|
+
var _state$product30, _state$product31, _state$product32;
|
|
2207
2386
|
|
|
2208
2387
|
return setPorDesvincular({
|
|
2209
2388
|
mode: "self",
|
|
2210
|
-
childArticleId: (_state$
|
|
2211
|
-
childName: (_state$
|
|
2212
|
-
childUpc: (_state$
|
|
2389
|
+
childArticleId: (_state$product30 = state.product) === null || _state$product30 === void 0 ? void 0 : _state$product30.id_article,
|
|
2390
|
+
childName: (_state$product31 = state.product) === null || _state$product31 === void 0 ? void 0 : _state$product31.name,
|
|
2391
|
+
childUpc: (_state$product32 = state.product) === null || _state$product32 === void 0 ? void 0 : _state$product32.upc,
|
|
2213
2392
|
parentName: family.parent.name,
|
|
2214
2393
|
parentUpc: family.parent.upc
|
|
2215
2394
|
});
|
|
@@ -2241,15 +2420,15 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2241
2420
|
className: "desvincular",
|
|
2242
2421
|
title: "Desvincular este hijo",
|
|
2243
2422
|
onClick: function onClick() {
|
|
2244
|
-
var _state$
|
|
2423
|
+
var _state$product33, _state$product34;
|
|
2245
2424
|
|
|
2246
2425
|
return setPorDesvincular({
|
|
2247
2426
|
mode: "child",
|
|
2248
2427
|
childArticleId: variant.articleId,
|
|
2249
2428
|
childName: variant.name,
|
|
2250
2429
|
childUpc: variant.upc,
|
|
2251
|
-
parentName: (_state$
|
|
2252
|
-
parentUpc: (_state$
|
|
2430
|
+
parentName: (_state$product33 = state.product) === null || _state$product33 === void 0 ? void 0 : _state$product33.name,
|
|
2431
|
+
parentUpc: (_state$product34 = state.product) === null || _state$product34 === void 0 ? void 0 : _state$product34.upc
|
|
2253
2432
|
});
|
|
2254
2433
|
},
|
|
2255
2434
|
children: "Desvincular"
|
|
@@ -2265,6 +2444,67 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2265
2444
|
onClick: openMultipleEdition,
|
|
2266
2445
|
children: preparandoEdicionMultiple ? "Abriendo…" : "Editar los ".concat(family.variants.length, " hijos juntos")
|
|
2267
2446
|
})]
|
|
2447
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2448
|
+
className: "variants-actions",
|
|
2449
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
2450
|
+
type: "button",
|
|
2451
|
+
className: "link-variants",
|
|
2452
|
+
onClick: function onClick() {
|
|
2453
|
+
return setShowGroupModal(true);
|
|
2454
|
+
},
|
|
2455
|
+
children: variantGroup !== null && variantGroup !== void 0 && variantGroup.group ? "Cambiar de grupo" : "Agrupar variantes"
|
|
2456
|
+
}), (variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
2457
|
+
type: "button",
|
|
2458
|
+
className: "variants-count",
|
|
2459
|
+
"aria-expanded": showGroup,
|
|
2460
|
+
onClick: function onClick() {
|
|
2461
|
+
return setShowGroup(function (abierto) {
|
|
2462
|
+
return !abierto;
|
|
2463
|
+
});
|
|
2464
|
+
},
|
|
2465
|
+
children: ["Variante ", variantGroup.group, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2466
|
+
"aria-hidden": "true",
|
|
2467
|
+
children: showGroup ? " ▴" : " ▾"
|
|
2468
|
+
})]
|
|
2469
|
+
})]
|
|
2470
|
+
}), showGroup && (variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2471
|
+
className: "variants-family",
|
|
2472
|
+
children: [((_variantGroup$members = variantGroup.members) !== null && _variantGroup$members !== void 0 ? _variantGroup$members : []).filter(function (miembro) {
|
|
2473
|
+
return !miembro.isCurrent;
|
|
2474
|
+
}).map(function (miembro) {
|
|
2475
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
2476
|
+
className: "family-item",
|
|
2477
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
2478
|
+
type: "button",
|
|
2479
|
+
className: "family-row",
|
|
2480
|
+
disabled: loadingVariant !== null,
|
|
2481
|
+
onClick: function onClick() {
|
|
2482
|
+
return openVariant(miembro.articleId);
|
|
2483
|
+
},
|
|
2484
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2485
|
+
className: "role",
|
|
2486
|
+
children: loadingVariant === miembro.articleId ? "Abriendo…" : "Variante"
|
|
2487
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2488
|
+
className: "name",
|
|
2489
|
+
children: miembro.name
|
|
2490
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2491
|
+
className: "upc",
|
|
2492
|
+
children: miembro.upc
|
|
2493
|
+
})]
|
|
2494
|
+
})
|
|
2495
|
+
}, miembro.articleId);
|
|
2496
|
+
}), ((_variantGroup$members2 = variantGroup.members) !== null && _variantGroup$members2 !== void 0 ? _variantGroup$members2 : []).filter(function (m) {
|
|
2497
|
+
return !m.isCurrent;
|
|
2498
|
+
}).length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
2499
|
+
className: "loading",
|
|
2500
|
+
children: ["Este producto es el \xFAnico en el grupo ", variantGroup.group, "."]
|
|
2501
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
2502
|
+
type: "button",
|
|
2503
|
+
className: "desvincular",
|
|
2504
|
+
title: "Quitar este producto del grupo",
|
|
2505
|
+
onClick: handleOnLeaveGroup,
|
|
2506
|
+
children: "Quitar del grupo"
|
|
2507
|
+
})]
|
|
2268
2508
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
2269
2509
|
headerData: state.product,
|
|
2270
2510
|
percent: (_state$active_percent = state.active_percentage) === null || _state$active_percent === void 0 ? void 0 : (_state$active_percent2 = _state$active_percent.percentagesGeneral) === null || _state$active_percent2 === void 0 ? void 0 : _state$active_percent2.required,
|
|
@@ -2315,7 +2555,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2315
2555
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
2316
2556
|
className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
|
|
2317
2557
|
children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
2318
|
-
children: [state.active_tab === "Descripción" && (((_state$
|
|
2558
|
+
children: [state.active_tab === "Descripción" && (((_state$product35 = state.product) === null || _state$product35 === void 0 ? void 0 : _state$product35.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, {
|
|
2319
2559
|
activeSection: state.active_tab,
|
|
2320
2560
|
inputGroup: state.descriptions_inputs[0],
|
|
2321
2561
|
updatedDescriptions: state.updated_descriptions_inputs
|
|
@@ -2326,7 +2566,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2326
2566
|
,
|
|
2327
2567
|
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,
|
|
2328
2568
|
onRestoreInheritance: handleOnRestoreInheritance,
|
|
2329
|
-
articleId: (_state$
|
|
2569
|
+
articleId: (_state$product36 = state.product) === null || _state$product36 === void 0 ? void 0 : _state$product36.id_article,
|
|
2330
2570
|
version: state.product.version,
|
|
2331
2571
|
isShowbox: false,
|
|
2332
2572
|
dinamicHeight: true,
|
|
@@ -2338,7 +2578,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2338
2578
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2339
2579
|
text: "No cuentas con este servicio",
|
|
2340
2580
|
headerType: "input-name-header"
|
|
2341
|
-
})), state.active_tab === "Ficha técnica" && (((_state$
|
|
2581
|
+
})), state.active_tab === "Ficha técnica" && (((_state$product37 = state.product) === null || _state$product37 === void 0 ? void 0 : _state$product37.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
2342
2582
|
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) {
|
|
2343
2583
|
var _state$datasheets_inp4, _state$services3, _state$services3$data, _state$services$datas3;
|
|
2344
2584
|
|
|
@@ -2368,7 +2608,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2368
2608
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
2369
2609
|
text: "No cuentas con este servicio",
|
|
2370
2610
|
headerType: "input-name-header"
|
|
2371
|
-
})), state.active_tab === "Imágenes" && (((_state$
|
|
2611
|
+
})), state.active_tab === "Imágenes" && (((_state$product38 = state.product) === null || _state$product38 === void 0 ? void 0 : _state$product38.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
2372
2612
|
children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
2373
2613
|
checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
|
|
2374
2614
|
,
|