contentoh-components-library 21.6.33 → 21.6.35
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/LinkVariantsModal/styles.js +1 -1
- package/dist/components/pages/ProviderProductEdition/index.js +20 -3
- package/dist/components/pages/RetailerProductEdition/index.js +350 -195
- package/dist/components/pages/RetailerProductEdition/styles.js +2 -2
- package/dist/components/pages/RetailerProductEdition/utils.js +8 -3
- package/package.json +1 -1
- package/src/components/pages/ProviderProductEdition/index.js +13 -0
- package/src/components/pages/RetailerProductEdition/index.js +149 -22
- package/src/components/pages/RetailerProductEdition/styles.js +11 -0
- package/src/components/pages/RetailerProductEdition/utils.js +10 -3
- package/dist/ai/prompts/attribute.prompt.js +0 -28
- package/dist/ai/prompts/description.prompt.js +0 -33
- package/dist/ai/schemas/attribute.schema.js +0 -35
- package/dist/ai/schemas/description.schema.js +0 -27
|
@@ -160,75 +160,75 @@ function regenerateVideoThumbnails(_x) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
function _regenerateVideoThumbnails() {
|
|
163
|
-
_regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
164
|
-
return _regenerator.default.wrap(function
|
|
163
|
+
_regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(values) {
|
|
164
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
165
165
|
while (1) {
|
|
166
|
-
switch (
|
|
166
|
+
switch (_context18.prev = _context18.next) {
|
|
167
167
|
case 0:
|
|
168
168
|
if (Array.isArray(values)) {
|
|
169
|
-
|
|
169
|
+
_context18.next = 2;
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
return
|
|
173
|
+
return _context18.abrupt("return", values);
|
|
174
174
|
|
|
175
175
|
case 2:
|
|
176
|
-
return
|
|
177
|
-
var
|
|
176
|
+
return _context18.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
|
|
177
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(value) {
|
|
178
178
|
var base64, videoSrc, thumbnail;
|
|
179
|
-
return _regenerator.default.wrap(function
|
|
179
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
180
180
|
while (1) {
|
|
181
|
-
switch (
|
|
181
|
+
switch (_context17.prev = _context17.next) {
|
|
182
182
|
case 0:
|
|
183
183
|
if (!((value === null || value === void 0 ? void 0 : value.ext) !== "mp4" || !(value !== null && value !== void 0 && value.srcDB))) {
|
|
184
|
-
|
|
184
|
+
_context17.next = 2;
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
return
|
|
188
|
+
return _context17.abrupt("return", value);
|
|
189
189
|
|
|
190
190
|
case 2:
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
_context17.prev = 2;
|
|
192
|
+
_context17.next = 5;
|
|
193
193
|
return convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB);
|
|
194
194
|
|
|
195
195
|
case 5:
|
|
196
|
-
base64 =
|
|
196
|
+
base64 = _context17.sent;
|
|
197
197
|
videoSrc = "data:video/mp4;base64," + base64.split(",")[1];
|
|
198
|
-
|
|
198
|
+
_context17.next = 9;
|
|
199
199
|
return (0, _generateThumnail.default)(videoSrc, 2);
|
|
200
200
|
|
|
201
201
|
case 9:
|
|
202
|
-
thumbnail =
|
|
203
|
-
return
|
|
202
|
+
thumbnail = _context17.sent;
|
|
203
|
+
return _context17.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
|
|
204
204
|
src: thumbnail
|
|
205
205
|
}));
|
|
206
206
|
|
|
207
207
|
case 13:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
console.error("Error al generar thumbnail del video:",
|
|
211
|
-
return
|
|
208
|
+
_context17.prev = 13;
|
|
209
|
+
_context17.t0 = _context17["catch"](2);
|
|
210
|
+
console.error("Error al generar thumbnail del video:", _context17.t0);
|
|
211
|
+
return _context17.abrupt("return", value);
|
|
212
212
|
|
|
213
213
|
case 17:
|
|
214
214
|
case "end":
|
|
215
|
-
return
|
|
215
|
+
return _context17.stop();
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
},
|
|
218
|
+
}, _callee17, null, [[2, 13]]);
|
|
219
219
|
}));
|
|
220
220
|
|
|
221
|
-
return function (
|
|
222
|
-
return
|
|
221
|
+
return function (_x10) {
|
|
222
|
+
return _ref21.apply(this, arguments);
|
|
223
223
|
};
|
|
224
224
|
}())));
|
|
225
225
|
|
|
226
226
|
case 3:
|
|
227
227
|
case "end":
|
|
228
|
-
return
|
|
228
|
+
return _context18.stop();
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
},
|
|
231
|
+
}, _callee18);
|
|
232
232
|
}));
|
|
233
233
|
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
234
234
|
}
|
|
@@ -330,38 +330,50 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
330
330
|
|
|
331
331
|
var _useState27 = (0, _react.useState)(null),
|
|
332
332
|
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
loadingVariant = _useState28[0],
|
|
334
|
+
setLoadingVariant = _useState28[1]; // Por qué un salto no se pudo hacer. Vive aparte de `family.error` porque no
|
|
335
|
+
// es un fallo al leer la familia, sino al abrir uno de sus miembros.
|
|
335
336
|
|
|
336
|
-
|
|
337
|
+
|
|
338
|
+
var _useState29 = (0, _react.useState)(null),
|
|
337
339
|
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
338
|
-
|
|
339
|
-
|
|
340
|
+
avisoFamilia = _useState30[0],
|
|
341
|
+
setAvisoFamilia = _useState30[1];
|
|
340
342
|
|
|
341
|
-
var _useState31 = (0, _react.useState)(
|
|
343
|
+
var _useState31 = (0, _react.useState)(null),
|
|
342
344
|
_useState32 = (0, _slicedToArray2.default)(_useState31, 2),
|
|
343
|
-
|
|
344
|
-
|
|
345
|
+
pendingPropagation = _useState32[0],
|
|
346
|
+
setPendingPropagation = _useState32[1];
|
|
345
347
|
|
|
346
|
-
var _useState33 = (0, _react.useState)(
|
|
348
|
+
var _useState33 = (0, _react.useState)(false),
|
|
347
349
|
_useState34 = (0, _slicedToArray2.default)(_useState33, 2),
|
|
348
|
-
|
|
349
|
-
|
|
350
|
+
preparandoPropagacion = _useState34[0],
|
|
351
|
+
setPreparandoPropagacion = _useState34[1];
|
|
350
352
|
|
|
351
353
|
var _useState35 = (0, _react.useState)([]),
|
|
352
354
|
_useState36 = (0, _slicedToArray2.default)(_useState35, 2),
|
|
353
|
-
|
|
354
|
-
|
|
355
|
+
auditServices = _useState36[0],
|
|
356
|
+
setAuditServices = _useState36[1];
|
|
355
357
|
|
|
356
|
-
var _useState37 = (0, _react.useState)(
|
|
358
|
+
var _useState37 = (0, _react.useState)([]),
|
|
357
359
|
_useState38 = (0, _slicedToArray2.default)(_useState37, 2),
|
|
358
|
-
|
|
359
|
-
|
|
360
|
+
auditDatasheets = _useState38[0],
|
|
361
|
+
setAuditDatasheets = _useState38[1];
|
|
360
362
|
|
|
361
|
-
var _useState39 = (0, _react.useState)(
|
|
363
|
+
var _useState39 = (0, _react.useState)([]),
|
|
362
364
|
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
363
|
-
|
|
364
|
-
|
|
365
|
+
auditDescriptions = _useState40[0],
|
|
366
|
+
setAuditDescriptions = _useState40[1];
|
|
367
|
+
|
|
368
|
+
var _useState41 = (0, _react.useState)(false),
|
|
369
|
+
_useState42 = (0, _slicedToArray2.default)(_useState41, 2),
|
|
370
|
+
showModal = _useState42[0],
|
|
371
|
+
setShowModal = _useState42[1];
|
|
372
|
+
|
|
373
|
+
var _useState43 = (0, _react.useState)(false),
|
|
374
|
+
_useState44 = (0, _slicedToArray2.default)(_useState43, 2),
|
|
375
|
+
compare = _useState44[0],
|
|
376
|
+
setCompare = _useState44[1];
|
|
365
377
|
|
|
366
378
|
var _useDropzone = (0, _reactDropzone.useDropzone)({
|
|
367
379
|
accept: "image/*, video/mp4",
|
|
@@ -497,10 +509,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
497
509
|
isDragActive = _useDropzone.isDragActive,
|
|
498
510
|
open = _useDropzone.open;
|
|
499
511
|
|
|
500
|
-
var
|
|
501
|
-
|
|
502
|
-
openChangeStatusModal =
|
|
503
|
-
setOpenChangeStatusModal =
|
|
512
|
+
var _useState45 = (0, _react.useState)(false),
|
|
513
|
+
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
514
|
+
openChangeStatusModal = _useState46[0],
|
|
515
|
+
setOpenChangeStatusModal = _useState46[1];
|
|
504
516
|
|
|
505
517
|
var thumbs = function thumbs() {
|
|
506
518
|
var _state$images_values, _state$images_values$, _state$images_values4, _state$images_values5, _state$images_values6, _state$images_values7, _state$images_values8, _state$images_values9;
|
|
@@ -1220,23 +1232,109 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1220
1232
|
}).length;
|
|
1221
1233
|
var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$product11 = state.product) !== null && _state$product11 !== void 0 && _state$product11.parentArticleId) : !!(family !== null && family !== void 0 && family.parent);
|
|
1222
1234
|
/*
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
de
|
|
1235
|
+
Abre otro producto de la familia.
|
|
1236
|
+
Cambiar la URL no basta: esta pantalla no lee el producto de la ruta sino de
|
|
1237
|
+
sessionStorage —el router hace JSON.parse(sessionStorage.productSelected) y
|
|
1238
|
+
se lo pasa como prop—, así que navegar sin precargar dejaría la URL nueva
|
|
1239
|
+
mostrando el producto anterior. Por eso primero se trae el destino y se
|
|
1240
|
+
escriben las tres llaves que el listado escribe al hacer clic en una fila
|
|
1241
|
+
(productSelected, version, productEdit), y solo entonces se navega.
|
|
1242
|
+
Se pide a /ordered-services y no a read-articles-v2, que es lo que usa la
|
|
1243
|
+
aplicación de clientes: aquel filtra por la compañía del usuario y el equipo
|
|
1244
|
+
interno es de ContentOh trabajando productos de sus clientes, así que ahí no
|
|
1245
|
+
devolvería nada. /ordered-services es el mismo endpoint del listado de esta
|
|
1246
|
+
aplicación, así que el objeto llega con la forma exacta que normalizeProduct
|
|
1247
|
+
espera —con `article` anidado, `statusByRetailer` y `categoryRetailer`—.
|
|
1248
|
+
Un producto de la familia puede no estar en ninguna orden de trabajo: la
|
|
1249
|
+
relación padre/hijo vive en `article` y no exige haber pasado por ContentOh.
|
|
1250
|
+
En ese caso no hay nada que abrir aquí, y se dice en vez de navegar a una
|
|
1251
|
+
pantalla que mostraría el producto equivocado.
|
|
1233
1252
|
*/
|
|
1234
1253
|
|
|
1254
|
+
var openFamilyMember = /*#__PURE__*/function () {
|
|
1255
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(articleId) {
|
|
1256
|
+
var _readPayload, res, _ref10, data, encontrado;
|
|
1257
|
+
|
|
1258
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1259
|
+
while (1) {
|
|
1260
|
+
switch (_context6.prev = _context6.next) {
|
|
1261
|
+
case 0:
|
|
1262
|
+
setLoadingVariant(articleId);
|
|
1263
|
+
setAvisoFamilia(null);
|
|
1264
|
+
_context6.prev = 2;
|
|
1265
|
+
_context6.next = 5;
|
|
1266
|
+
return _axios.default.get("".concat(process.env.REACT_APP_ORDERED_SERVICES_ENDPOINT), {
|
|
1267
|
+
params: {
|
|
1268
|
+
filterByIdArticle: articleId,
|
|
1269
|
+
includeFilters: false
|
|
1270
|
+
},
|
|
1271
|
+
headers: {
|
|
1272
|
+
Authorization: token
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
case 5:
|
|
1277
|
+
res = _context6.sent;
|
|
1278
|
+
// read-order-services responde { total, data: [...] }. La vista trae una
|
|
1279
|
+
// fila por orden, así que puede haber varias del mismo artículo; llegan
|
|
1280
|
+
// ordenadas por order_id DESC y la primera es la orden más reciente.
|
|
1281
|
+
_ref10 = (_readPayload = (0, _api.readPayload)(res)) !== null && _readPayload !== void 0 ? _readPayload : {}, data = _ref10.data;
|
|
1282
|
+
encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
|
|
1283
|
+
var _item$article;
|
|
1284
|
+
|
|
1285
|
+
return Number(item === null || item === void 0 ? void 0 : (_item$article = item.article) === null || _item$article === void 0 ? void 0 : _item$article.id_article) === Number(articleId);
|
|
1286
|
+
});
|
|
1287
|
+
|
|
1288
|
+
if (encontrado) {
|
|
1289
|
+
_context6.next = 11;
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
setAvisoFamilia("Ese producto no está en ninguna orden de trabajo, así que no se puede abrir desde aquí.");
|
|
1294
|
+
return _context6.abrupt("return");
|
|
1295
|
+
|
|
1296
|
+
case 11:
|
|
1297
|
+
sessionStorage.setItem("productSelected", JSON.stringify(encontrado));
|
|
1298
|
+
sessionStorage.setItem("version", JSON.stringify(encontrado.version));
|
|
1299
|
+
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
1300
|
+
ArticleId: encontrado.article.id_article,
|
|
1301
|
+
categoryId: encontrado.article.id_article,
|
|
1302
|
+
product: [encontrado]
|
|
1303
|
+
}));
|
|
1304
|
+
window.location.assign("/EditProducts");
|
|
1305
|
+
_context6.next = 21;
|
|
1306
|
+
break;
|
|
1307
|
+
|
|
1308
|
+
case 17:
|
|
1309
|
+
_context6.prev = 17;
|
|
1310
|
+
_context6.t0 = _context6["catch"](2);
|
|
1311
|
+
console.error("openFamilyMember: ", _context6.t0);
|
|
1312
|
+
setAvisoFamilia("No se pudo abrir ese producto. Intenta de nuevo.");
|
|
1313
|
+
|
|
1314
|
+
case 21:
|
|
1315
|
+
_context6.prev = 21;
|
|
1316
|
+
setLoadingVariant(null);
|
|
1317
|
+
return _context6.finish(21);
|
|
1318
|
+
|
|
1319
|
+
case 24:
|
|
1320
|
+
case "end":
|
|
1321
|
+
return _context6.stop();
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}, _callee6, null, [[2, 17, 21, 24]]);
|
|
1325
|
+
}));
|
|
1326
|
+
|
|
1327
|
+
return function openFamilyMember(_x3) {
|
|
1328
|
+
return _ref9.apply(this, arguments);
|
|
1329
|
+
};
|
|
1330
|
+
}();
|
|
1235
1331
|
/*
|
|
1236
|
-
Refresca tras ligar, sin recargar: el producto sale de
|
|
1237
|
-
un
|
|
1332
|
+
Refresca tras ligar, sin recargar la página: el producto sale de
|
|
1333
|
+
sessionStorage, así que un F5 devolvería el mismo objeto y el contador
|
|
1334
|
+
seguiría igual.
|
|
1238
1335
|
*/
|
|
1239
1336
|
|
|
1337
|
+
|
|
1240
1338
|
var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
|
|
1241
1339
|
var _state$product$varian, _state$product12, _result$linked, _result$parentArticle;
|
|
1242
1340
|
|
|
@@ -1251,13 +1349,57 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1251
1349
|
type: "SET_PRODUCT",
|
|
1252
1350
|
payload: updatedProduct
|
|
1253
1351
|
});
|
|
1254
|
-
|
|
1352
|
+
/*
|
|
1353
|
+
En sessionStorage se PARCHEA lo guardado; no se reemplaza.
|
|
1354
|
+
Lo que hay ahí es el producto tal como lo devuelve el listado de esta
|
|
1355
|
+
aplicación: con `article` anidado, `statusByRetailer`, `categoryRetailer`
|
|
1356
|
+
y los servicios. `updatedProduct` es la versión aplanada que usa esta
|
|
1357
|
+
pantalla, y escribirla encima tiraba todo eso: al siguiente F5 la ficha se
|
|
1358
|
+
reconstruía desde un objeto mutilado —sin relaciones de cadena, sin
|
|
1359
|
+
estatus por cadena— aunque en pantalla se viera bien hasta entonces.
|
|
1360
|
+
De ligar solo cambian dos cosas, y son las dos que se copian aquí.
|
|
1361
|
+
*/
|
|
1255
1362
|
|
|
1256
1363
|
try {
|
|
1257
|
-
|
|
1364
|
+
var _sessionStorage$getIt;
|
|
1365
|
+
|
|
1366
|
+
var guardado = JSON.parse((_sessionStorage$getIt = sessionStorage.getItem("productSelected")) !== null && _sessionStorage$getIt !== void 0 ? _sessionStorage$getIt : "null");
|
|
1367
|
+
|
|
1368
|
+
if (guardado) {
|
|
1369
|
+
var _updatedProduct$paren;
|
|
1370
|
+
|
|
1371
|
+
sessionStorage.setItem("productSelected", JSON.stringify((0, _objectSpread5.default)((0, _objectSpread5.default)({}, guardado), {}, {
|
|
1372
|
+
variantsCount: updatedProduct.variantsCount,
|
|
1373
|
+
parentArticleId: (_updatedProduct$paren = updatedProduct.parentArticleId) !== null && _updatedProduct$paren !== void 0 ? _updatedProduct$paren : null
|
|
1374
|
+
})));
|
|
1375
|
+
}
|
|
1258
1376
|
} catch (error) {
|
|
1377
|
+
// Un sessionStorage inaccesible no debe tumbar la pantalla: el estado en
|
|
1378
|
+
// memoria ya quedó bien y es lo que el usuario está viendo.
|
|
1259
1379
|
console.error("linkVariants/sessionStorage: ", error);
|
|
1260
1380
|
}
|
|
1381
|
+
/*
|
|
1382
|
+
Volver a preguntar, no vaciar.
|
|
1383
|
+
Antes esto hacía `setFamily(null)` para invalidar la caché, y en esta
|
|
1384
|
+
pantalla eso tenía el efecto contrario al buscado: el bloque de parentesco
|
|
1385
|
+
se decide con `esHijoDeOtro`, que sale de `family`, no del producto. Con
|
|
1386
|
+
`family` en null el bloque desaparecía, así que después de ligar la
|
|
1387
|
+
pantalla se quedaba SIN ninguna señal de que el producto ya tenía padre
|
|
1388
|
+
—justo lo que el usuario acababa de hacer—.
|
|
1389
|
+
*/
|
|
1390
|
+
|
|
1391
|
+
|
|
1392
|
+
loadFamily(true);
|
|
1393
|
+
/*
|
|
1394
|
+
Y se recargan los servicios, porque ligar cambia la herencia de cada campo
|
|
1395
|
+
en el servidor: al planchar, lo que era propio pasa a heredado y los chips
|
|
1396
|
+
tienen que decirlo. Sin esto la ficha sigue mostrando el estado anterior
|
|
1397
|
+
hasta que alguien cierra y vuelve a abrir el producto.
|
|
1398
|
+
Sin `enableLoading` para no parpadear el esqueleto encima de una pantalla
|
|
1399
|
+
que ya está pintada.
|
|
1400
|
+
*/
|
|
1401
|
+
|
|
1402
|
+
loadData(false);
|
|
1261
1403
|
};
|
|
1262
1404
|
/*
|
|
1263
1405
|
Acción "Volver a heredar" de los chips. Repinta en sitio con lo que devuelve
|
|
@@ -1272,31 +1414,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1272
1414
|
|
|
1273
1415
|
|
|
1274
1416
|
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
1275
|
-
var
|
|
1417
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(attributeId) {
|
|
1276
1418
|
var _state$product13;
|
|
1277
1419
|
|
|
1278
1420
|
var kind,
|
|
1279
1421
|
esDescripcion,
|
|
1280
1422
|
res,
|
|
1281
1423
|
data,
|
|
1282
|
-
|
|
1283
|
-
return _regenerator.default.wrap(function
|
|
1424
|
+
_args7 = arguments;
|
|
1425
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1284
1426
|
while (1) {
|
|
1285
|
-
switch (
|
|
1427
|
+
switch (_context7.prev = _context7.next) {
|
|
1286
1428
|
case 0:
|
|
1287
|
-
kind =
|
|
1429
|
+
kind = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : "attribute";
|
|
1288
1430
|
|
|
1289
1431
|
if (!(!attributeId || !((_state$product13 = state.product) !== null && _state$product13 !== void 0 && _state$product13.id_article))) {
|
|
1290
|
-
|
|
1432
|
+
_context7.next = 3;
|
|
1291
1433
|
break;
|
|
1292
1434
|
}
|
|
1293
1435
|
|
|
1294
|
-
return
|
|
1436
|
+
return _context7.abrupt("return");
|
|
1295
1437
|
|
|
1296
1438
|
case 3:
|
|
1297
1439
|
esDescripcion = kind === "description";
|
|
1298
|
-
|
|
1299
|
-
|
|
1440
|
+
_context7.prev = 4;
|
|
1441
|
+
_context7.next = 7;
|
|
1300
1442
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread5.default)({
|
|
1301
1443
|
articleId: state.product.id_article
|
|
1302
1444
|
}, esDescripcion ? {
|
|
@@ -1310,11 +1452,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1310
1452
|
});
|
|
1311
1453
|
|
|
1312
1454
|
case 7:
|
|
1313
|
-
res =
|
|
1455
|
+
res = _context7.sent;
|
|
1314
1456
|
data = (0, _api.readPayload)(res);
|
|
1315
1457
|
|
|
1316
1458
|
if (!esDescripcion) {
|
|
1317
|
-
|
|
1459
|
+
_context7.next = 12;
|
|
1318
1460
|
break;
|
|
1319
1461
|
}
|
|
1320
1462
|
|
|
@@ -1328,7 +1470,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1328
1470
|
};
|
|
1329
1471
|
})
|
|
1330
1472
|
});
|
|
1331
|
-
return
|
|
1473
|
+
return _context7.abrupt("return");
|
|
1332
1474
|
|
|
1333
1475
|
case 12:
|
|
1334
1476
|
dispatch({
|
|
@@ -1341,24 +1483,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1341
1483
|
};
|
|
1342
1484
|
})
|
|
1343
1485
|
});
|
|
1344
|
-
|
|
1486
|
+
_context7.next = 18;
|
|
1345
1487
|
break;
|
|
1346
1488
|
|
|
1347
1489
|
case 15:
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
console.error("restoreInheritance: ",
|
|
1490
|
+
_context7.prev = 15;
|
|
1491
|
+
_context7.t0 = _context7["catch"](4);
|
|
1492
|
+
console.error("restoreInheritance: ", _context7.t0);
|
|
1351
1493
|
|
|
1352
1494
|
case 18:
|
|
1353
1495
|
case "end":
|
|
1354
|
-
return
|
|
1496
|
+
return _context7.stop();
|
|
1355
1497
|
}
|
|
1356
1498
|
}
|
|
1357
|
-
},
|
|
1499
|
+
}, _callee7, null, [[4, 15]]);
|
|
1358
1500
|
}));
|
|
1359
1501
|
|
|
1360
|
-
return function handleOnRestoreInheritance(
|
|
1361
|
-
return
|
|
1502
|
+
return function handleOnRestoreInheritance(_x4) {
|
|
1503
|
+
return _ref11.apply(this, arguments);
|
|
1362
1504
|
};
|
|
1363
1505
|
}();
|
|
1364
1506
|
/*
|
|
@@ -1385,30 +1527,30 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1385
1527
|
};
|
|
1386
1528
|
|
|
1387
1529
|
var handleOnClickSave = /*#__PURE__*/function () {
|
|
1388
|
-
var
|
|
1530
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
1389
1531
|
var esPadre, cambios;
|
|
1390
|
-
return _regenerator.default.wrap(function
|
|
1532
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1391
1533
|
while (1) {
|
|
1392
|
-
switch (
|
|
1534
|
+
switch (_context8.prev = _context8.next) {
|
|
1393
1535
|
case 0:
|
|
1394
1536
|
if (!(state.saving || preparandoPropagacion)) {
|
|
1395
|
-
|
|
1537
|
+
_context8.next = 2;
|
|
1396
1538
|
break;
|
|
1397
1539
|
}
|
|
1398
1540
|
|
|
1399
|
-
return
|
|
1541
|
+
return _context8.abrupt("return");
|
|
1400
1542
|
|
|
1401
1543
|
case 2:
|
|
1402
|
-
|
|
1403
|
-
|
|
1544
|
+
_context8.t0 = state.active_tab;
|
|
1545
|
+
_context8.next = _context8.t0 === "Descripción" ? 5 : _context8.t0 === "Ficha técnica" ? 8 : _context8.t0 === "Imágenes" ? 17 : 20;
|
|
1404
1546
|
break;
|
|
1405
1547
|
|
|
1406
1548
|
case 5:
|
|
1407
|
-
|
|
1549
|
+
_context8.next = 7;
|
|
1408
1550
|
return saveDescriptions(token);
|
|
1409
1551
|
|
|
1410
1552
|
case 7:
|
|
1411
|
-
return
|
|
1553
|
+
return _context8.abrupt("break", 21);
|
|
1412
1554
|
|
|
1413
1555
|
case 8:
|
|
1414
1556
|
// Guardar un padre con hijos abre la decisión de propagar. Sin este
|
|
@@ -1418,7 +1560,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1418
1560
|
cambios = cambiosDeFichaTecnica();
|
|
1419
1561
|
|
|
1420
1562
|
if (!(esPadre && cambios.length > 0)) {
|
|
1421
|
-
|
|
1563
|
+
_context8.next = 14;
|
|
1422
1564
|
break;
|
|
1423
1565
|
}
|
|
1424
1566
|
|
|
@@ -1430,39 +1572,39 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1430
1572
|
}).finally(function () {
|
|
1431
1573
|
return setPreparandoPropagacion(false);
|
|
1432
1574
|
});
|
|
1433
|
-
return
|
|
1575
|
+
return _context8.abrupt("return");
|
|
1434
1576
|
|
|
1435
1577
|
case 14:
|
|
1436
|
-
|
|
1578
|
+
_context8.next = 16;
|
|
1437
1579
|
return saveDatasheets(token);
|
|
1438
1580
|
|
|
1439
1581
|
case 16:
|
|
1440
|
-
return
|
|
1582
|
+
return _context8.abrupt("break", 21);
|
|
1441
1583
|
|
|
1442
1584
|
case 17:
|
|
1443
|
-
|
|
1585
|
+
_context8.next = 19;
|
|
1444
1586
|
return updateImages(token);
|
|
1445
1587
|
|
|
1446
1588
|
case 19:
|
|
1447
|
-
return
|
|
1589
|
+
return _context8.abrupt("break", 21);
|
|
1448
1590
|
|
|
1449
1591
|
case 20:
|
|
1450
|
-
return
|
|
1592
|
+
return _context8.abrupt("break", 21);
|
|
1451
1593
|
|
|
1452
1594
|
case 21:
|
|
1453
|
-
|
|
1595
|
+
_context8.next = 23;
|
|
1454
1596
|
return loadData(false);
|
|
1455
1597
|
|
|
1456
1598
|
case 23:
|
|
1457
1599
|
case "end":
|
|
1458
|
-
return
|
|
1600
|
+
return _context8.stop();
|
|
1459
1601
|
}
|
|
1460
1602
|
}
|
|
1461
|
-
},
|
|
1603
|
+
}, _callee8);
|
|
1462
1604
|
}));
|
|
1463
1605
|
|
|
1464
1606
|
return function handleOnClickSave() {
|
|
1465
|
-
return
|
|
1607
|
+
return _ref12.apply(this, arguments);
|
|
1466
1608
|
};
|
|
1467
1609
|
}();
|
|
1468
1610
|
|
|
@@ -1530,24 +1672,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1530
1672
|
};
|
|
1531
1673
|
|
|
1532
1674
|
var handleOnApproveSingleService = /*#__PURE__*/function () {
|
|
1533
|
-
var
|
|
1534
|
-
return _regenerator.default.wrap(function
|
|
1675
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
1676
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1535
1677
|
while (1) {
|
|
1536
|
-
switch (
|
|
1678
|
+
switch (_context9.prev = _context9.next) {
|
|
1537
1679
|
case 0:
|
|
1538
|
-
|
|
1680
|
+
_context9.next = 2;
|
|
1539
1681
|
return sendSingleEvaluation("A");
|
|
1540
1682
|
|
|
1541
1683
|
case 2:
|
|
1542
1684
|
case "end":
|
|
1543
|
-
return
|
|
1685
|
+
return _context9.stop();
|
|
1544
1686
|
}
|
|
1545
1687
|
}
|
|
1546
|
-
},
|
|
1688
|
+
}, _callee9);
|
|
1547
1689
|
}));
|
|
1548
1690
|
|
|
1549
1691
|
return function handleOnApproveSingleService() {
|
|
1550
|
-
return
|
|
1692
|
+
return _ref13.apply(this, arguments);
|
|
1551
1693
|
};
|
|
1552
1694
|
}();
|
|
1553
1695
|
|
|
@@ -1556,21 +1698,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1556
1698
|
};
|
|
1557
1699
|
|
|
1558
1700
|
var sendSingleEvaluation = /*#__PURE__*/function () {
|
|
1559
|
-
var
|
|
1701
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
|
|
1560
1702
|
var _state$product$id_ord, _state$active_retaile4;
|
|
1561
1703
|
|
|
1562
1704
|
var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, articleStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _articleStatus, updatedStatusByRetailerForSend, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
|
|
1563
1705
|
|
|
1564
|
-
return _regenerator.default.wrap(function
|
|
1706
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1565
1707
|
while (1) {
|
|
1566
|
-
switch (
|
|
1708
|
+
switch (_context10.prev = _context10.next) {
|
|
1567
1709
|
case 0:
|
|
1568
1710
|
if (!state.saving) {
|
|
1569
|
-
|
|
1711
|
+
_context10.next = 2;
|
|
1570
1712
|
break;
|
|
1571
1713
|
}
|
|
1572
1714
|
|
|
1573
|
-
return
|
|
1715
|
+
return _context10.abrupt("return");
|
|
1574
1716
|
|
|
1575
1717
|
case 2:
|
|
1576
1718
|
dispatch({
|
|
@@ -1591,16 +1733,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1591
1733
|
retailerId: retailerId
|
|
1592
1734
|
};
|
|
1593
1735
|
activeTab = state.active_tab;
|
|
1594
|
-
|
|
1736
|
+
_context10.prev = 11;
|
|
1595
1737
|
|
|
1596
1738
|
if (!result) {
|
|
1597
|
-
|
|
1739
|
+
_context10.next = 28;
|
|
1598
1740
|
break;
|
|
1599
1741
|
}
|
|
1600
1742
|
|
|
1601
1743
|
data.result = result;
|
|
1602
1744
|
data.retailerId = retailerId;
|
|
1603
|
-
|
|
1745
|
+
_context10.next = 17;
|
|
1604
1746
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1605
1747
|
headers: {
|
|
1606
1748
|
Authorization: token
|
|
@@ -1608,7 +1750,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1608
1750
|
});
|
|
1609
1751
|
|
|
1610
1752
|
case 17:
|
|
1611
|
-
res =
|
|
1753
|
+
res = _context10.sent;
|
|
1612
1754
|
newStatuses = JSON.parse(res.data.body);
|
|
1613
1755
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
1614
1756
|
articleStatus = newStatuses.newArticleStatus[articleId];
|
|
@@ -1639,7 +1781,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1639
1781
|
image: _genericModalCheck.default
|
|
1640
1782
|
}
|
|
1641
1783
|
});
|
|
1642
|
-
|
|
1784
|
+
_context10.next = 33;
|
|
1643
1785
|
break;
|
|
1644
1786
|
|
|
1645
1787
|
case 28:
|
|
@@ -1655,7 +1797,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1655
1797
|
icon = _genericModalCheck.default;
|
|
1656
1798
|
}
|
|
1657
1799
|
|
|
1658
|
-
|
|
1800
|
+
_context10.next = 32;
|
|
1659
1801
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1660
1802
|
headers: {
|
|
1661
1803
|
Authorization: token
|
|
@@ -1663,7 +1805,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1663
1805
|
});
|
|
1664
1806
|
|
|
1665
1807
|
case 32:
|
|
1666
|
-
res =
|
|
1808
|
+
res = _context10.sent;
|
|
1667
1809
|
|
|
1668
1810
|
case 33:
|
|
1669
1811
|
if (res.data.statusCode === 200) {
|
|
@@ -1748,13 +1890,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1748
1890
|
});
|
|
1749
1891
|
}
|
|
1750
1892
|
|
|
1751
|
-
|
|
1893
|
+
_context10.next = 40;
|
|
1752
1894
|
break;
|
|
1753
1895
|
|
|
1754
1896
|
case 36:
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
console.error("Error sending evaluation:",
|
|
1897
|
+
_context10.prev = 36;
|
|
1898
|
+
_context10.t0 = _context10["catch"](11);
|
|
1899
|
+
console.error("Error sending evaluation:", _context10.t0);
|
|
1758
1900
|
dispatch({
|
|
1759
1901
|
type: "SET_MODAL",
|
|
1760
1902
|
payload: {
|
|
@@ -1766,45 +1908,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1766
1908
|
});
|
|
1767
1909
|
|
|
1768
1910
|
case 40:
|
|
1769
|
-
|
|
1911
|
+
_context10.prev = 40;
|
|
1770
1912
|
dispatch({
|
|
1771
1913
|
type: "SET_SAVING",
|
|
1772
1914
|
payload: false
|
|
1773
1915
|
});
|
|
1774
|
-
return
|
|
1916
|
+
return _context10.finish(40);
|
|
1775
1917
|
|
|
1776
1918
|
case 43:
|
|
1777
1919
|
case "end":
|
|
1778
|
-
return
|
|
1920
|
+
return _context10.stop();
|
|
1779
1921
|
}
|
|
1780
1922
|
}
|
|
1781
|
-
},
|
|
1923
|
+
}, _callee10, null, [[11, 36, 40, 43]]);
|
|
1782
1924
|
}));
|
|
1783
1925
|
|
|
1784
|
-
return function sendSingleEvaluation(
|
|
1785
|
-
return
|
|
1926
|
+
return function sendSingleEvaluation(_x5) {
|
|
1927
|
+
return _ref14.apply(this, arguments);
|
|
1786
1928
|
};
|
|
1787
1929
|
}();
|
|
1788
1930
|
|
|
1789
1931
|
var handleOnApproveAllServices = /*#__PURE__*/function () {
|
|
1790
|
-
var
|
|
1791
|
-
return _regenerator.default.wrap(function
|
|
1932
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1933
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1792
1934
|
while (1) {
|
|
1793
|
-
switch (
|
|
1935
|
+
switch (_context11.prev = _context11.next) {
|
|
1794
1936
|
case 0:
|
|
1795
|
-
|
|
1937
|
+
_context11.next = 2;
|
|
1796
1938
|
return sendBulkEvaluation("A");
|
|
1797
1939
|
|
|
1798
1940
|
case 2:
|
|
1799
1941
|
case "end":
|
|
1800
|
-
return
|
|
1942
|
+
return _context11.stop();
|
|
1801
1943
|
}
|
|
1802
1944
|
}
|
|
1803
|
-
},
|
|
1945
|
+
}, _callee11);
|
|
1804
1946
|
}));
|
|
1805
1947
|
|
|
1806
1948
|
return function handleOnApproveAllServices() {
|
|
1807
|
-
return
|
|
1949
|
+
return _ref15.apply(this, arguments);
|
|
1808
1950
|
};
|
|
1809
1951
|
}();
|
|
1810
1952
|
|
|
@@ -1814,18 +1956,18 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1814
1956
|
};
|
|
1815
1957
|
|
|
1816
1958
|
var sendBulkEvaluation = /*#__PURE__*/function () {
|
|
1817
|
-
var
|
|
1959
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(result) {
|
|
1818
1960
|
var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
1819
1961
|
|
|
1820
|
-
return _regenerator.default.wrap(function
|
|
1962
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1821
1963
|
while (1) {
|
|
1822
|
-
switch (
|
|
1964
|
+
switch (_context12.prev = _context12.next) {
|
|
1823
1965
|
case 0:
|
|
1824
1966
|
dispatch({
|
|
1825
1967
|
type: "SET_SAVING",
|
|
1826
1968
|
payload: true
|
|
1827
1969
|
});
|
|
1828
|
-
|
|
1970
|
+
_context12.prev = 1;
|
|
1829
1971
|
evaluationArray = [];
|
|
1830
1972
|
conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
|
|
1831
1973
|
(_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
|
|
@@ -1850,7 +1992,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1850
1992
|
}));
|
|
1851
1993
|
}
|
|
1852
1994
|
});
|
|
1853
|
-
|
|
1995
|
+
_context12.next = 7;
|
|
1854
1996
|
return Promise.all(evaluationArray);
|
|
1855
1997
|
|
|
1856
1998
|
case 7:
|
|
@@ -1905,41 +2047,41 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1905
2047
|
image: _genericModalCheck.default
|
|
1906
2048
|
}
|
|
1907
2049
|
});
|
|
1908
|
-
|
|
2050
|
+
_context12.next = 19;
|
|
1909
2051
|
break;
|
|
1910
2052
|
|
|
1911
2053
|
case 16:
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
console.error("Error in bulk evaluation:",
|
|
2054
|
+
_context12.prev = 16;
|
|
2055
|
+
_context12.t0 = _context12["catch"](1);
|
|
2056
|
+
console.error("Error in bulk evaluation:", _context12.t0);
|
|
1915
2057
|
|
|
1916
2058
|
case 19:
|
|
1917
|
-
|
|
2059
|
+
_context12.prev = 19;
|
|
1918
2060
|
dispatch({
|
|
1919
2061
|
type: "SET_SAVING",
|
|
1920
2062
|
payload: false
|
|
1921
2063
|
});
|
|
1922
|
-
return
|
|
2064
|
+
return _context12.finish(19);
|
|
1923
2065
|
|
|
1924
2066
|
case 22:
|
|
1925
2067
|
case "end":
|
|
1926
|
-
return
|
|
2068
|
+
return _context12.stop();
|
|
1927
2069
|
}
|
|
1928
2070
|
}
|
|
1929
|
-
},
|
|
2071
|
+
}, _callee12, null, [[1, 16, 19, 22]]);
|
|
1930
2072
|
}));
|
|
1931
2073
|
|
|
1932
|
-
return function sendBulkEvaluation(
|
|
1933
|
-
return
|
|
2074
|
+
return function sendBulkEvaluation(_x6) {
|
|
2075
|
+
return _ref16.apply(this, arguments);
|
|
1934
2076
|
};
|
|
1935
2077
|
}();
|
|
1936
2078
|
|
|
1937
2079
|
var handleOnChangeAssignations = /*#__PURE__*/function () {
|
|
1938
|
-
var
|
|
2080
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(assignationType, assignationId) {
|
|
1939
2081
|
var concept, data, updatedProduct;
|
|
1940
|
-
return _regenerator.default.wrap(function
|
|
2082
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1941
2083
|
while (1) {
|
|
1942
|
-
switch (
|
|
2084
|
+
switch (_context13.prev = _context13.next) {
|
|
1943
2085
|
case 0:
|
|
1944
2086
|
concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
1945
2087
|
data = {
|
|
@@ -1950,7 +2092,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1950
2092
|
concept: concept,
|
|
1951
2093
|
userId: assignationId
|
|
1952
2094
|
};
|
|
1953
|
-
|
|
2095
|
+
_context13.next = 4;
|
|
1954
2096
|
return (0, _axios.default)({
|
|
1955
2097
|
method: "post",
|
|
1956
2098
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -1969,14 +2111,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1969
2111
|
|
|
1970
2112
|
case 6:
|
|
1971
2113
|
case "end":
|
|
1972
|
-
return
|
|
2114
|
+
return _context13.stop();
|
|
1973
2115
|
}
|
|
1974
2116
|
}
|
|
1975
|
-
},
|
|
2117
|
+
}, _callee13);
|
|
1976
2118
|
}));
|
|
1977
2119
|
|
|
1978
|
-
return function handleOnChangeAssignations(
|
|
1979
|
-
return
|
|
2120
|
+
return function handleOnChangeAssignations(_x7, _x8) {
|
|
2121
|
+
return _ref17.apply(this, arguments);
|
|
1980
2122
|
};
|
|
1981
2123
|
}();
|
|
1982
2124
|
|
|
@@ -2011,16 +2153,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2011
2153
|
};
|
|
2012
2154
|
|
|
2013
2155
|
var handleOnSubmitComment = /*#__PURE__*/function () {
|
|
2014
|
-
var
|
|
2156
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(e) {
|
|
2015
2157
|
var commentText;
|
|
2016
|
-
return _regenerator.default.wrap(function
|
|
2158
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
2017
2159
|
while (1) {
|
|
2018
|
-
switch (
|
|
2160
|
+
switch (_context14.prev = _context14.next) {
|
|
2019
2161
|
case 0:
|
|
2020
2162
|
e.preventDefault();
|
|
2021
2163
|
commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
|
|
2022
|
-
|
|
2023
|
-
|
|
2164
|
+
_context14.prev = 2;
|
|
2165
|
+
_context14.next = 5;
|
|
2024
2166
|
return createComment(commentText, token);
|
|
2025
2167
|
|
|
2026
2168
|
case 5:
|
|
@@ -2033,13 +2175,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2033
2175
|
image: _genericModalCheck.default
|
|
2034
2176
|
}
|
|
2035
2177
|
});
|
|
2036
|
-
|
|
2178
|
+
_context14.next = 12;
|
|
2037
2179
|
break;
|
|
2038
2180
|
|
|
2039
2181
|
case 8:
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
console.error("Error saving comment:",
|
|
2182
|
+
_context14.prev = 8;
|
|
2183
|
+
_context14.t0 = _context14["catch"](2);
|
|
2184
|
+
console.error("Error saving comment:", _context14.t0);
|
|
2043
2185
|
dispatch({
|
|
2044
2186
|
type: "SET_MODAL",
|
|
2045
2187
|
payload: {
|
|
@@ -2052,14 +2194,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2052
2194
|
|
|
2053
2195
|
case 12:
|
|
2054
2196
|
case "end":
|
|
2055
|
-
return
|
|
2197
|
+
return _context14.stop();
|
|
2056
2198
|
}
|
|
2057
2199
|
}
|
|
2058
|
-
},
|
|
2200
|
+
}, _callee14, null, [[2, 8]]);
|
|
2059
2201
|
}));
|
|
2060
2202
|
|
|
2061
|
-
return function handleOnSubmitComment(
|
|
2062
|
-
return
|
|
2203
|
+
return function handleOnSubmitComment(_x9) {
|
|
2204
|
+
return _ref18.apply(this, arguments);
|
|
2063
2205
|
};
|
|
2064
2206
|
}();
|
|
2065
2207
|
|
|
@@ -2423,21 +2565,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2423
2565
|
type: "pink",
|
|
2424
2566
|
label: "Aceptar",
|
|
2425
2567
|
size: 12,
|
|
2426
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2568
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
2427
2569
|
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
2428
|
-
return _regenerator.default.wrap(function
|
|
2570
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
2429
2571
|
while (1) {
|
|
2430
|
-
switch (
|
|
2572
|
+
switch (_context15.prev = _context15.next) {
|
|
2431
2573
|
case 0:
|
|
2432
2574
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
2433
2575
|
|
|
2434
2576
|
if (!(!elements || elements.length === 0)) {
|
|
2435
|
-
|
|
2577
|
+
_context15.next = 4;
|
|
2436
2578
|
break;
|
|
2437
2579
|
}
|
|
2438
2580
|
|
|
2439
2581
|
console.error("Elemento no encontrado");
|
|
2440
|
-
return
|
|
2582
|
+
return _context15.abrupt("return");
|
|
2441
2583
|
|
|
2442
2584
|
case 4:
|
|
2443
2585
|
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
@@ -2446,7 +2588,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2446
2588
|
});
|
|
2447
2589
|
|
|
2448
2590
|
if (!isMessageEmpty) {
|
|
2449
|
-
|
|
2591
|
+
_context15.next = 10;
|
|
2450
2592
|
break;
|
|
2451
2593
|
}
|
|
2452
2594
|
|
|
@@ -2461,13 +2603,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2461
2603
|
container.appendChild(alert);
|
|
2462
2604
|
}
|
|
2463
2605
|
|
|
2464
|
-
return
|
|
2606
|
+
return _context15.abrupt("return");
|
|
2465
2607
|
|
|
2466
2608
|
case 10:
|
|
2467
2609
|
fullMessage = Array.from(elements).map(function (element) {
|
|
2468
2610
|
return element.innerHTML;
|
|
2469
2611
|
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
2470
|
-
|
|
2612
|
+
_context15.next = 13;
|
|
2471
2613
|
return createComment(fullMessage, token);
|
|
2472
2614
|
|
|
2473
2615
|
case 13:
|
|
@@ -2476,10 +2618,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2476
2618
|
|
|
2477
2619
|
case 15:
|
|
2478
2620
|
case "end":
|
|
2479
|
-
return
|
|
2621
|
+
return _context15.stop();
|
|
2480
2622
|
}
|
|
2481
2623
|
}
|
|
2482
|
-
},
|
|
2624
|
+
}, _callee15);
|
|
2483
2625
|
}))
|
|
2484
2626
|
}, "btn-Aceptar")]
|
|
2485
2627
|
}), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
@@ -2621,11 +2763,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2621
2763
|
}), (family === null || family === void 0 ? void 0 : family.error) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
2622
2764
|
className: "loading",
|
|
2623
2765
|
children: "No se pudo cargar la familia de este producto."
|
|
2624
|
-
}), (family === null || family === void 0 ? void 0 : family.parent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("
|
|
2766
|
+
}), (family === null || family === void 0 ? void 0 : family.parent) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
2767
|
+
type: "button",
|
|
2625
2768
|
className: "family-row parent",
|
|
2769
|
+
disabled: loadingVariant !== null,
|
|
2770
|
+
onClick: function onClick() {
|
|
2771
|
+
return openFamilyMember(family.parent.articleId);
|
|
2772
|
+
},
|
|
2626
2773
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2627
2774
|
className: "role",
|
|
2628
|
-
children: "Producto padre"
|
|
2775
|
+
children: loadingVariant === family.parent.articleId ? "Abriendo…" : "Producto padre"
|
|
2629
2776
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2630
2777
|
className: "name",
|
|
2631
2778
|
children: family.parent.name
|
|
@@ -2634,11 +2781,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2634
2781
|
children: family.parent.upc
|
|
2635
2782
|
})]
|
|
2636
2783
|
}), family === null || family === void 0 ? void 0 : (_family$variants3 = family.variants) === null || _family$variants3 === void 0 ? void 0 : _family$variants3.map(function (variant) {
|
|
2637
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("
|
|
2784
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
2785
|
+
type: "button",
|
|
2638
2786
|
className: "family-row".concat(variant.isCurrent ? " current" : ""),
|
|
2787
|
+
disabled: variant.isCurrent || loadingVariant !== null,
|
|
2788
|
+
onClick: function onClick() {
|
|
2789
|
+
return openFamilyMember(variant.articleId);
|
|
2790
|
+
},
|
|
2639
2791
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2640
2792
|
className: "role",
|
|
2641
|
-
children: variant.isCurrent ? "Estás aquí" : "Hijo"
|
|
2793
|
+
children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "Hijo"
|
|
2642
2794
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2643
2795
|
className: "name",
|
|
2644
2796
|
children: variant.name
|
|
@@ -2650,6 +2802,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2650
2802
|
}), family && !family.error && !((_family$variants4 = family.variants) !== null && _family$variants4 !== void 0 && _family$variants4.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
2651
2803
|
className: "loading",
|
|
2652
2804
|
children: "Este producto no tiene hijos."
|
|
2805
|
+
}), avisoFamilia && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
2806
|
+
className: "loading",
|
|
2807
|
+
children: avisoFamilia
|
|
2653
2808
|
})]
|
|
2654
2809
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader // states
|
|
2655
2810
|
, {
|
|
@@ -2840,20 +2995,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2840
2995
|
reviewed: crossComment
|
|
2841
2996
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2842
2997
|
buttonType: "circular-button accept-button",
|
|
2843
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2844
|
-
return _regenerator.default.wrap(function
|
|
2998
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
2999
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
2845
3000
|
while (1) {
|
|
2846
|
-
switch (
|
|
3001
|
+
switch (_context16.prev = _context16.next) {
|
|
2847
3002
|
case 0:
|
|
2848
3003
|
setCrossComment(true);
|
|
2849
3004
|
commentRevised();
|
|
2850
3005
|
|
|
2851
3006
|
case 2:
|
|
2852
3007
|
case "end":
|
|
2853
|
-
return
|
|
3008
|
+
return _context16.stop();
|
|
2854
3009
|
}
|
|
2855
3010
|
}
|
|
2856
|
-
},
|
|
3011
|
+
}, _callee16);
|
|
2857
3012
|
}))
|
|
2858
3013
|
})]
|
|
2859
3014
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|