contentoh-components-library 21.6.54 → 21.6.56
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/.claude/launch.json +14 -0
- package/.env.test +1 -0
- package/dist/components/atoms/IconFile/index.js +85 -2
- package/dist/components/atoms/IconFile/styles.js +1 -1
- package/dist/components/atoms/ProductImage/ProductImage.stories.js +70 -2
- package/dist/components/atoms/ProductImage/index.js +100 -27
- package/dist/components/atoms/ProductImage/styles.js +3 -1
- package/dist/components/molecules/EditionActiveImage/index.js +4 -2
- package/dist/components/molecules/GalleryElement/index.js +13 -4
- package/dist/components/molecules/GalleryHeader/index.js +96 -24
- package/dist/components/molecules/GalleryHeader/styles.js +4 -1
- package/dist/components/molecules/ImageSelector/index.js +1 -0
- package/dist/components/organisms/ImagePreviewer/index.js +1 -0
- package/dist/components/organisms/ProductImageModal/index.js +3 -2
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +330 -15
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +12 -2
- package/dist/components/pages/RetailerProductEdition/index.js +628 -428
- package/dist/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +1 -0
- package/dist/components/pages/RetailerProductEdition/utils.js +48 -1
- package/dist/global-files/data.js +16 -3
- package/dist/index.js +142 -90
- package/docs/activos-digitales.md +273 -0
- package/package.json +1 -1
- package/src/components/atoms/AssetPreview/AssetPreview.stories.js +78 -0
- package/src/components/atoms/AssetPreview/index.js +119 -0
- package/src/components/atoms/AssetPreview/styles.js +190 -0
- package/src/components/atoms/IconFile/index.js +28 -1
- package/src/components/atoms/IconFile/styles.js +8 -0
- package/src/components/atoms/ProductImage/ProductImage.stories.js +38 -0
- package/src/components/atoms/ProductImage/index.js +95 -20
- package/src/components/atoms/ProductImage/styles.js +92 -7
- package/src/components/molecules/EditionActiveImage/index.js +2 -2
- package/src/components/molecules/GalleryAssetElement/GalleryAssetElement.stories.js +102 -0
- package/src/components/molecules/GalleryAssetElement/index.js +162 -0
- package/src/components/molecules/GalleryAssetElement/styles.js +159 -0
- package/src/components/molecules/GalleryElement/index.js +9 -0
- package/src/components/molecules/GalleryHeader/index.js +65 -13
- package/src/components/molecules/GalleryHeader/styles.js +2 -1
- package/src/components/molecules/GalleryTrayTabs/GalleryTrayTabs.stories.js +32 -0
- package/src/components/molecules/GalleryTrayTabs/index.js +41 -0
- package/src/components/molecules/GalleryTrayTabs/styles.js +52 -0
- package/src/components/molecules/ImageSelector/index.js +1 -0
- package/src/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +101 -0
- package/src/components/organisms/DigitalAssetsTray/index.js +189 -0
- package/src/components/organisms/DigitalAssetsTray/styles.js +183 -0
- package/src/components/organisms/ImagePreviewer/index.js +1 -0
- package/src/components/organisms/ProductImageModal/index.js +1 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +201 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +12 -0
- package/src/components/pages/RetailerProductEdition/index.js +379 -142
- package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +1 -0
- package/src/components/pages/RetailerProductEdition/utils.js +34 -0
- package/src/global-files/data.js +17 -2
- package/src/global-files/digital-assets/assetTypes.js +419 -0
- package/src/global-files/digital-assets/assets.actions.js +50 -0
- package/src/global-files/digital-assets/assets.adapter.js +229 -0
- package/src/global-files/digital-assets/assets.mock.js +122 -0
- package/src/global-files/digital-assets/assets.reducer.js +197 -0
- package/src/global-files/digital-assets/uploadAssets.js +109 -0
- package/src/global-files/digital-assets/useDigitalAssets.js +329 -0
- package/src/index.js +4 -0
|
@@ -19,10 +19,10 @@ var _objectSpread5 = _interopRequireDefault(require("@babel/runtime/helpers/esm/
|
|
|
19
19
|
|
|
20
20
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
21
21
|
|
|
22
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
23
|
-
|
|
24
22
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
25
23
|
|
|
24
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
25
|
+
|
|
26
26
|
var _react = require("react");
|
|
27
27
|
|
|
28
28
|
var _axios = _interopRequireDefault(require("axios"));
|
|
@@ -41,6 +41,10 @@ var _data = require("../../../global-files/data");
|
|
|
41
41
|
|
|
42
42
|
var _customHooks = require("../../../global-files/customHooks");
|
|
43
43
|
|
|
44
|
+
var _useDigitalAssets = require("../../../global-files/digital-assets/useDigitalAssets");
|
|
45
|
+
|
|
46
|
+
var _assets = require("../../../global-files/digital-assets/assets.reducer");
|
|
47
|
+
|
|
44
48
|
var _GeneralButton = require("../../atoms/GeneralButton");
|
|
45
49
|
|
|
46
50
|
var _GenericModal = require("../../atoms/GenericModal");
|
|
@@ -55,6 +59,8 @@ var _GalleryElement = require("../../molecules/GalleryElement");
|
|
|
55
59
|
|
|
56
60
|
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
57
61
|
|
|
62
|
+
var _GalleryTrayTabs = require("../../molecules/GalleryTrayTabs");
|
|
63
|
+
|
|
58
64
|
var _HeaderTop = require("../../molecules/HeaderTop");
|
|
59
65
|
|
|
60
66
|
var _index = require("../../molecules/TagAndInput/index");
|
|
@@ -65,6 +71,8 @@ var _FullTabsMenu = require("../../organisms/FullTabsMenu");
|
|
|
65
71
|
|
|
66
72
|
var _ImageDataTable = require("../../organisms/ImageDataTable");
|
|
67
73
|
|
|
74
|
+
var _DigitalAssetsTray = require("../../organisms/DigitalAssetsTray");
|
|
75
|
+
|
|
68
76
|
var _ImagePreviewer = require("../../organisms/ImagePreviewer");
|
|
69
77
|
|
|
70
78
|
var _InputGroup = require("../../organisms/InputGroup");
|
|
@@ -132,118 +140,8 @@ function obtenerDuracionVideoBase64(base64Data) {
|
|
|
132
140
|
});
|
|
133
141
|
}
|
|
134
142
|
|
|
135
|
-
function convertirVideoABase64(url) {
|
|
136
|
-
return new Promise(function (resolve, reject) {
|
|
137
|
-
var xhr = new XMLHttpRequest();
|
|
138
|
-
xhr.open("GET", url, true);
|
|
139
|
-
xhr.responseType = "blob";
|
|
140
|
-
|
|
141
|
-
xhr.onload = function () {
|
|
142
|
-
if (xhr.status === 200) {
|
|
143
|
-
var blob = xhr.response;
|
|
144
|
-
var reader = new FileReader();
|
|
145
|
-
|
|
146
|
-
reader.onloadend = function () {
|
|
147
|
-
resolve(reader.result);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
reader.readAsDataURL(blob);
|
|
151
|
-
} else {
|
|
152
|
-
reject(new Error("Error al cargar el video"));
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
xhr.onerror = function () {
|
|
157
|
-
reject(new Error("Error de red al cargar el video"));
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
xhr.send();
|
|
161
|
-
});
|
|
162
|
-
} // Para videos ya guardados, `getImage` deja en `src` una URL del
|
|
163
|
-
// redimensionador de imágenes que no sirve para mp4. Descargamos el video
|
|
164
|
-
// desde S3 (srcDB) y generamos un thumbnail JPEG para mostrarlo en la galería.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
function regenerateVideoThumbnails(_x) {
|
|
168
|
-
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function _regenerateVideoThumbnails() {
|
|
172
|
-
_regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(values) {
|
|
173
|
-
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
174
|
-
while (1) {
|
|
175
|
-
switch (_context21.prev = _context21.next) {
|
|
176
|
-
case 0:
|
|
177
|
-
if (Array.isArray(values)) {
|
|
178
|
-
_context21.next = 2;
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return _context21.abrupt("return", values);
|
|
183
|
-
|
|
184
|
-
case 2:
|
|
185
|
-
return _context21.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
|
|
186
|
-
var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(value) {
|
|
187
|
-
var base64, videoSrc, thumbnail;
|
|
188
|
-
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
189
|
-
while (1) {
|
|
190
|
-
switch (_context20.prev = _context20.next) {
|
|
191
|
-
case 0:
|
|
192
|
-
if (!((value === null || value === void 0 ? void 0 : value.ext) !== "mp4" || !(value !== null && value !== void 0 && value.srcDB))) {
|
|
193
|
-
_context20.next = 2;
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return _context20.abrupt("return", value);
|
|
198
|
-
|
|
199
|
-
case 2:
|
|
200
|
-
_context20.prev = 2;
|
|
201
|
-
_context20.next = 5;
|
|
202
|
-
return convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB);
|
|
203
|
-
|
|
204
|
-
case 5:
|
|
205
|
-
base64 = _context20.sent;
|
|
206
|
-
videoSrc = "data:video/mp4;base64," + base64.split(",")[1];
|
|
207
|
-
_context20.next = 9;
|
|
208
|
-
return (0, _generateThumnail.default)(videoSrc, 2);
|
|
209
|
-
|
|
210
|
-
case 9:
|
|
211
|
-
thumbnail = _context20.sent;
|
|
212
|
-
return _context20.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
|
|
213
|
-
src: thumbnail
|
|
214
|
-
}));
|
|
215
|
-
|
|
216
|
-
case 13:
|
|
217
|
-
_context20.prev = 13;
|
|
218
|
-
_context20.t0 = _context20["catch"](2);
|
|
219
|
-
console.error("Error al generar thumbnail del video:", _context20.t0);
|
|
220
|
-
return _context20.abrupt("return", value);
|
|
221
|
-
|
|
222
|
-
case 17:
|
|
223
|
-
case "end":
|
|
224
|
-
return _context20.stop();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}, _callee20, null, [[2, 13]]);
|
|
228
|
-
}));
|
|
229
|
-
|
|
230
|
-
return function (_x10) {
|
|
231
|
-
return _ref25.apply(this, arguments);
|
|
232
|
-
};
|
|
233
|
-
}())));
|
|
234
|
-
|
|
235
|
-
case 3:
|
|
236
|
-
case "end":
|
|
237
|
-
return _context21.stop();
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}, _callee21);
|
|
241
|
-
}));
|
|
242
|
-
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
143
|
var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
246
|
-
var _state$
|
|
144
|
+
var _state$product$id_art, _state$product, _state$product11, _family$variants, _state$product12, _state$product16, _state$errors, _pendingPropagation$k, _family$variants2, _variantGroup$members3, _variantGroup$group, _state$product20, _state$product21, _state$product22, _state$active_retaile7, _state$product23, _state$product24, _state$product25, _variantGroup$group2, _location$state, _location$state2, _state$active_retaile8, _state$active_retaile9, _state$images_values$2, _state$images_values10, _state$images_values11, _state$images_values12, _state$images_values13, _state$product26, _state$active_retaile10, _family$variants3, _family$variants4, _variantGroup$members4, _variantGroup$members5, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile11, _state$active_retaile12, _state$active_retaile13, _state$product32, _state$services3, _state$services3$data, _state$product33, _state$product34, _state$datasheets_inp, _state$datasheets_inp2, _state$product35, _state$images_values$3, _state$images_values14, _state$images_values15, _state$images_values16, _state$images_values17, _state$comment;
|
|
247
145
|
|
|
248
146
|
var tabsSections = _ref.tabsSections,
|
|
249
147
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -251,7 +149,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
251
149
|
_ref$user = _ref.user,
|
|
252
150
|
user = _ref$user === void 0 ? {} : _ref$user,
|
|
253
151
|
token = _ref.token,
|
|
254
|
-
location = _ref.location
|
|
152
|
+
location = _ref.location,
|
|
153
|
+
_ref$enableDigitalAss = _ref.enableDigitalAssets,
|
|
154
|
+
enableDigitalAssets = _ref$enableDigitalAss === void 0 ? false : _ref$enableDigitalAss;
|
|
255
155
|
|
|
256
156
|
var _useProviderProductEd = (0, _providerProductEdition.useProviderProductEdition)(),
|
|
257
157
|
state = _useProviderProductEd.state,
|
|
@@ -260,6 +160,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
260
160
|
saveDescriptions = _useProviderProductEd.saveDescriptions,
|
|
261
161
|
updateImages = _useProviderProductEd.updateImages,
|
|
262
162
|
deleteImages = _useProviderProductEd.deleteImages,
|
|
163
|
+
saveAssets = _useProviderProductEd.saveAssets,
|
|
164
|
+
registerUploadedAssets = _useProviderProductEd.registerUploadedAssets,
|
|
263
165
|
handleOnDownloadImages = _useProviderProductEd.handleOnDownloadImages,
|
|
264
166
|
createComment = _useProviderProductEd.createComment;
|
|
265
167
|
|
|
@@ -526,7 +428,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
526
428
|
}, _callee, null, [[5, 18]]);
|
|
527
429
|
}));
|
|
528
430
|
|
|
529
|
-
return function (
|
|
431
|
+
return function (_x) {
|
|
530
432
|
return _ref2.apply(this, arguments);
|
|
531
433
|
};
|
|
532
434
|
}();
|
|
@@ -549,6 +451,66 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
549
451
|
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
550
452
|
openChangeStatusModal = _useState54[0],
|
|
551
453
|
setOpenChangeStatusModal = _useState54[1];
|
|
454
|
+
/*
|
|
455
|
+
Bandeja de activos digitales. La lista vive en el reducer de la ficha
|
|
456
|
+
(`state.assets_values`), igual que las imágenes, para que el guardado del
|
|
457
|
+
contexto pueda leerla. El hook solo aporta validación y ciclo de vida.
|
|
458
|
+
Sigue vacía porque todavía no hay de dónde leerla: cuando exista el endpoint
|
|
459
|
+
se llama a `replaceAll` desde `loadData` y el resto de la pantalla no cambia.
|
|
460
|
+
*/
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
var _useState55 = (0, _react.useState)([]),
|
|
464
|
+
_useState56 = (0, _slicedToArray2.default)(_useState55, 2),
|
|
465
|
+
assetNotices = _useState56[0],
|
|
466
|
+
setAssetNotices = _useState56[1];
|
|
467
|
+
|
|
468
|
+
var digitalAssets = (0, _useDigitalAssets.useDigitalAssets)({
|
|
469
|
+
assets: state.assets_values,
|
|
470
|
+
dispatch: dispatch,
|
|
471
|
+
notices: assetNotices,
|
|
472
|
+
setNotices: setAssetNotices,
|
|
473
|
+
// Con los dos, la subida a S3 arranca sola al soltar los archivos. Sin
|
|
474
|
+
// ellos —en Storybook, por ejemplo— la bandeja funciona igual pero no sube.
|
|
475
|
+
articleId: (_state$product$id_art = (_state$product = state.product) === null || _state$product === void 0 ? void 0 : _state$product.id_article) !== null && _state$product$id_art !== void 0 ? _state$product$id_art : null,
|
|
476
|
+
token: token,
|
|
477
|
+
// Al terminar la subida el activo queda registrado solo, sin esperar al
|
|
478
|
+
// botón de guardar: con la barra llena, nadie supone que falta un paso.
|
|
479
|
+
onUploaded: function onUploaded(uploaded) {
|
|
480
|
+
return registerUploadedAssets(token, uploaded);
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
var _useState57 = (0, _react.useState)(_GalleryTrayTabs.TRAYS.IMAGES),
|
|
485
|
+
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
486
|
+
activeTray = _useState58[0],
|
|
487
|
+
setActiveTray = _useState58[1];
|
|
488
|
+
|
|
489
|
+
var currentTray = enableDigitalAssets ? activeTray : _GalleryTrayTabs.TRAYS.IMAGES;
|
|
490
|
+
/*
|
|
491
|
+
De qué artículo se cargaron ya los activos.
|
|
492
|
+
`loadData` se vuelve a ejecutar cada vez que cambia la cadena activa, pero los
|
|
493
|
+
activos son generales: no dependen de la cadena ni de la versión, así que la
|
|
494
|
+
respuesta sería idéntica. Volver a cargarlos borraría los archivos que el
|
|
495
|
+
usuario acaba de soltar y todavía no guarda —sin aviso y sin forma de
|
|
496
|
+
recuperarlos—. Por eso se cargan una sola vez por artículo.
|
|
497
|
+
*/
|
|
498
|
+
|
|
499
|
+
var assetsLoadedFor = (0, _react.useRef)(null);
|
|
500
|
+
|
|
501
|
+
var handleOnSetSelectedAssets = function handleOnSetSelectedAssets(assets) {
|
|
502
|
+
return dispatch({
|
|
503
|
+
type: "SET_SELECTED_ASSETS",
|
|
504
|
+
payload: assets
|
|
505
|
+
});
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
var handleOnSetAllAssetsChecked = function handleOnSetAllAssetsChecked(isChecked) {
|
|
509
|
+
return dispatch({
|
|
510
|
+
type: "TOGGLE_CHECK_ALL_ASSETS",
|
|
511
|
+
payload: isChecked
|
|
512
|
+
});
|
|
513
|
+
};
|
|
552
514
|
|
|
553
515
|
var thumbs = function thumbs() {
|
|
554
516
|
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;
|
|
@@ -603,6 +565,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
603
565
|
},
|
|
604
566
|
updateApprovedInputsImages: function updateApprovedInputsImages(item) {
|
|
605
567
|
return console.log("updateApprovedInputsImages", item);
|
|
568
|
+
},
|
|
569
|
+
onSelect: function onSelect() {
|
|
570
|
+
return handleOnChangeCurrentImage(index);
|
|
606
571
|
}
|
|
607
572
|
}, index);
|
|
608
573
|
});
|
|
@@ -629,9 +594,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
629
594
|
type: "SET_ACTIVE_RETAILER",
|
|
630
595
|
payload: productNormalized.categoryRetailerInOrder[0]
|
|
631
596
|
});
|
|
632
|
-
setShotThd([58, 59, 60, 61].includes(productNormalized.categoryRetailerInOrder[0].id_retailer)); //
|
|
597
|
+
setShotThd([58, 59, 60, 61].includes(productNormalized.categoryRetailerInOrder[0].id_retailer)); // Los estatus evaluables salen del rol UNIDO a la asignación. Solo por
|
|
598
|
+
// rol, quien produce y además audita no tenía 'AC' en la lista y el
|
|
599
|
+
// envío se quedaba sin nada que mandar.
|
|
633
600
|
|
|
634
|
-
setStatusArray((0, _utils.
|
|
601
|
+
setStatusArray((0, _utils.getStatusArrayForUser)(user, productNormalized)); // Cargar usuarios y asignaciones
|
|
635
602
|
|
|
636
603
|
_context2.next = 10;
|
|
637
604
|
return (0, _data.fetchUsers)(token);
|
|
@@ -717,7 +684,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
717
684
|
|
|
718
685
|
var loadAuditableData = /*#__PURE__*/function () {
|
|
719
686
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
720
|
-
var _state$
|
|
687
|
+
var _state$product2, _state$product3, _state$product4;
|
|
721
688
|
|
|
722
689
|
var auditServices;
|
|
723
690
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
@@ -725,7 +692,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
725
692
|
switch (_context3.prev = _context3.next) {
|
|
726
693
|
case 0:
|
|
727
694
|
_context3.next = 2;
|
|
728
|
-
return (0, _data.getRetailerServices)((_state$
|
|
695
|
+
return (0, _data.getRetailerServices)((_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.id_article, (_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.categoryName, parseInt((_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.id_category), auditableVersion.version, token);
|
|
729
696
|
|
|
730
697
|
case 2:
|
|
731
698
|
auditServices = _context3.sent;
|
|
@@ -769,7 +736,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
769
736
|
_services$,
|
|
770
737
|
_retailerDatasheets$d,
|
|
771
738
|
_state$active_retaile2,
|
|
772
|
-
|
|
739
|
+
_services$0$inputs,
|
|
740
|
+
_services$2,
|
|
741
|
+
_state$product5,
|
|
773
742
|
id_article,
|
|
774
743
|
version,
|
|
775
744
|
id_order,
|
|
@@ -798,8 +767,6 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
798
767
|
descriptionsActiveRetailer,
|
|
799
768
|
activeRetailerId,
|
|
800
769
|
filteredValues,
|
|
801
|
-
orderedValuesWithThumbs,
|
|
802
|
-
filteredValuesWithThumbs,
|
|
803
770
|
_args4 = arguments;
|
|
804
771
|
|
|
805
772
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
@@ -817,7 +784,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
817
784
|
type: "SET_ERRORS",
|
|
818
785
|
payload: []
|
|
819
786
|
});
|
|
820
|
-
_state$
|
|
787
|
+
_state$product5 = state.product, id_article = _state$product5.id_article, version = _state$product5.version, id_order = _state$product5.id_order;
|
|
821
788
|
_state$active_retaile = state.active_retailer, category = _state$active_retaile.category, id_category = _state$active_retaile.id_category, id_retailer = _state$active_retaile.id_retailer; // Payloads y headers
|
|
822
789
|
|
|
823
790
|
data = [{
|
|
@@ -957,26 +924,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
957
924
|
return Number(input.id_retailer) === Number(activeRetailerId) && Number(input.id_image) === Number(value.image_id);
|
|
958
925
|
});
|
|
959
926
|
});
|
|
960
|
-
}); //
|
|
927
|
+
}); // Dispatch consolidado
|
|
961
928
|
|
|
962
|
-
_context4.next = 35;
|
|
963
|
-
return regenerateVideoThumbnails(orderedValues);
|
|
964
|
-
|
|
965
|
-
case 35:
|
|
966
|
-
orderedValuesWithThumbs = _context4.sent;
|
|
967
|
-
_context4.next = 38;
|
|
968
|
-
return regenerateVideoThumbnails(filteredValues);
|
|
969
|
-
|
|
970
|
-
case 38:
|
|
971
|
-
filteredValuesWithThumbs = _context4.sent;
|
|
972
|
-
// Dispatch consolidado
|
|
973
929
|
dispatch({
|
|
974
930
|
type: "SET_SERVICES",
|
|
975
931
|
payload: {
|
|
976
932
|
datasheets: services[0],
|
|
977
933
|
descriptions: services[1],
|
|
978
934
|
images: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
979
|
-
values:
|
|
935
|
+
values: orderedValues
|
|
980
936
|
})
|
|
981
937
|
}
|
|
982
938
|
});
|
|
@@ -998,7 +954,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
998
954
|
|
|
999
955
|
dispatch({
|
|
1000
956
|
type: "SET_DATASHEETS_INPUTS",
|
|
1001
|
-
|
|
957
|
+
// `services[0]?` por lo mismo que el fallback de arriba: la lectura de
|
|
958
|
+
// fichas puede volver sin datos para esa cadena y categoría. Arriba ya
|
|
959
|
+
// se contemplaba; aquí no, y como este dispatch va ANTES de
|
|
960
|
+
// SET_IMAGES_VALUES, reventar aquí dejaba la ficha cargando para
|
|
961
|
+
// siempre — con las imágenes ya traídas y sin pintar.
|
|
962
|
+
payload: [datasheetsActiveRetailer, (_services$0$inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs) !== null && _services$0$inputs !== void 0 ? _services$0$inputs : {}]
|
|
1002
963
|
});
|
|
1003
964
|
dispatch({
|
|
1004
965
|
type: "SET_DESCRIPTIONS_INPUTS",
|
|
@@ -1007,9 +968,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1007
968
|
dispatch({
|
|
1008
969
|
type: "SET_IMAGES_VALUES",
|
|
1009
970
|
payload: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
1010
|
-
values:
|
|
971
|
+
values: filteredValues
|
|
1011
972
|
})
|
|
1012
|
-
});
|
|
973
|
+
});
|
|
974
|
+
/*
|
|
975
|
+
Activos digitales. `services[2].assets` todavía no existe en la
|
|
976
|
+
respuesta del backend: hasta que exista, esto no hace nada, y el día que
|
|
977
|
+
llegue la bandeja se llena sola sin tocar nada más.
|
|
978
|
+
*/
|
|
979
|
+
|
|
980
|
+
if (Array.isArray(services[2].assets) && assetsLoadedFor.current !== id_article) {
|
|
981
|
+
assetsLoadedFor.current = id_article;
|
|
982
|
+
digitalAssets.replaceAll(services[2].assets);
|
|
983
|
+
} // Calcular campos requeridos sin valor
|
|
984
|
+
|
|
1013
985
|
|
|
1014
986
|
dispatch({
|
|
1015
987
|
type: "SET_MISSING_REQUIRED_FIELDS",
|
|
@@ -1020,11 +992,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1020
992
|
loadAuditableData();
|
|
1021
993
|
}
|
|
1022
994
|
|
|
1023
|
-
_context4.next =
|
|
995
|
+
_context4.next = 49;
|
|
1024
996
|
break;
|
|
1025
997
|
|
|
1026
|
-
case
|
|
1027
|
-
_context4.prev =
|
|
998
|
+
case 45:
|
|
999
|
+
_context4.prev = 45;
|
|
1028
1000
|
_context4.t0 = _context4["catch"](2);
|
|
1029
1001
|
console.log("Error loading data: ", _context4.t0);
|
|
1030
1002
|
dispatch({
|
|
@@ -1032,20 +1004,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1032
1004
|
payload: [_context4.t0.message]
|
|
1033
1005
|
});
|
|
1034
1006
|
|
|
1035
|
-
case
|
|
1036
|
-
_context4.prev =
|
|
1007
|
+
case 49:
|
|
1008
|
+
_context4.prev = 49;
|
|
1037
1009
|
dispatch({
|
|
1038
1010
|
type: "SET_LOADING",
|
|
1039
1011
|
payload: false
|
|
1040
1012
|
});
|
|
1041
|
-
return _context4.finish(
|
|
1013
|
+
return _context4.finish(49);
|
|
1042
1014
|
|
|
1043
|
-
case
|
|
1015
|
+
case 52:
|
|
1044
1016
|
case "end":
|
|
1045
1017
|
return _context4.stop();
|
|
1046
1018
|
}
|
|
1047
1019
|
}
|
|
1048
|
-
}, _callee4, null, [[2,
|
|
1020
|
+
}, _callee4, null, [[2, 45, 49, 52]]);
|
|
1049
1021
|
}));
|
|
1050
1022
|
|
|
1051
1023
|
return function loadData() {
|
|
@@ -1108,9 +1080,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1108
1080
|
};
|
|
1109
1081
|
|
|
1110
1082
|
var isAuditorAssigned = function isAuditorAssigned() {
|
|
1111
|
-
var _state$
|
|
1083
|
+
var _state$product6;
|
|
1112
1084
|
|
|
1113
|
-
return ((_state$
|
|
1085
|
+
return ((_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.id_auditor) === (user === null || user === void 0 ? void 0 : user.id_user);
|
|
1114
1086
|
};
|
|
1115
1087
|
/**
|
|
1116
1088
|
* ¿Ocupo este slot EN ESTE producto?
|
|
@@ -1123,9 +1095,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1123
1095
|
|
|
1124
1096
|
|
|
1125
1097
|
var isAssignedAs = function isAssignedAs(rol, concept) {
|
|
1126
|
-
var _state$
|
|
1098
|
+
var _state$product7;
|
|
1127
1099
|
|
|
1128
|
-
var assigned = (_state$
|
|
1100
|
+
var assigned = (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7["id_".concat(concept, "_").concat(rol)];
|
|
1129
1101
|
return !!assigned && assigned === (user === null || user === void 0 ? void 0 : user.id_user);
|
|
1130
1102
|
};
|
|
1131
1103
|
|
|
@@ -1201,28 +1173,42 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1201
1173
|
})[0]) === null || _statusByRetailer$fil === void 0 ? void 0 : _statusByRetailer$fil.status) || "-";
|
|
1202
1174
|
return currentStatus;
|
|
1203
1175
|
};
|
|
1176
|
+
/*
|
|
1177
|
+
Guarda los activos y recarga si algo se escribió.
|
|
1178
|
+
La recarga no es opcional: un activo recién creado sigue en memoria con su
|
|
1179
|
+
id temporal y sin el id de la base. Sin volver a leer, el siguiente guardado
|
|
1180
|
+
lo mandaría otra vez como nuevo y se duplicaría. Poner el ref en `null` es
|
|
1181
|
+
lo que permite que `loadData` lo vuelva a traer —normalmente los activos se
|
|
1182
|
+
cargan una sola vez por artículo—.
|
|
1183
|
+
*/
|
|
1204
1184
|
|
|
1205
|
-
var handleOnClickSaveImages = /*#__PURE__*/function () {
|
|
1206
|
-
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1207
|
-
var _state$product7, _state$product7$servi;
|
|
1208
1185
|
|
|
1186
|
+
var handleOnSaveAssets = /*#__PURE__*/function () {
|
|
1187
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1188
|
+
var guardado;
|
|
1209
1189
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1210
1190
|
while (1) {
|
|
1211
1191
|
switch (_context5.prev = _context5.next) {
|
|
1212
1192
|
case 0:
|
|
1213
|
-
|
|
1193
|
+
_context5.next = 2;
|
|
1194
|
+
return saveAssets(token);
|
|
1195
|
+
|
|
1196
|
+
case 2:
|
|
1197
|
+
guardado = _context5.sent;
|
|
1198
|
+
|
|
1199
|
+
if (guardado) {
|
|
1214
1200
|
_context5.next = 5;
|
|
1215
1201
|
break;
|
|
1216
1202
|
}
|
|
1217
1203
|
|
|
1218
|
-
_context5.
|
|
1219
|
-
return updateImages(token);
|
|
1204
|
+
return _context5.abrupt("return");
|
|
1220
1205
|
|
|
1221
|
-
case
|
|
1222
|
-
|
|
1206
|
+
case 5:
|
|
1207
|
+
assetsLoadedFor.current = null;
|
|
1208
|
+
_context5.next = 8;
|
|
1223
1209
|
return loadData(false);
|
|
1224
1210
|
|
|
1225
|
-
case
|
|
1211
|
+
case 8:
|
|
1226
1212
|
case "end":
|
|
1227
1213
|
return _context5.stop();
|
|
1228
1214
|
}
|
|
@@ -1230,10 +1216,55 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1230
1216
|
}, _callee5);
|
|
1231
1217
|
}));
|
|
1232
1218
|
|
|
1233
|
-
return function
|
|
1219
|
+
return function handleOnSaveAssets() {
|
|
1234
1220
|
return _ref9.apply(this, arguments);
|
|
1235
1221
|
};
|
|
1236
1222
|
}();
|
|
1223
|
+
|
|
1224
|
+
var handleOnClickSaveImages = /*#__PURE__*/function () {
|
|
1225
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1226
|
+
var _state$product8, _state$product8$servi;
|
|
1227
|
+
|
|
1228
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1229
|
+
while (1) {
|
|
1230
|
+
switch (_context6.prev = _context6.next) {
|
|
1231
|
+
case 0:
|
|
1232
|
+
if (!(currentTray === _GalleryTrayTabs.TRAYS.ASSETS)) {
|
|
1233
|
+
_context6.next = 4;
|
|
1234
|
+
break;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
_context6.next = 3;
|
|
1238
|
+
return handleOnSaveAssets();
|
|
1239
|
+
|
|
1240
|
+
case 3:
|
|
1241
|
+
return _context6.abrupt("return");
|
|
1242
|
+
|
|
1243
|
+
case 4:
|
|
1244
|
+
if (!(((_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : (_state$product8$servi = _state$product8.services) === null || _state$product8$servi === void 0 ? void 0 : _state$product8$servi.images) === 1)) {
|
|
1245
|
+
_context6.next = 9;
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
_context6.next = 7;
|
|
1250
|
+
return updateImages(token);
|
|
1251
|
+
|
|
1252
|
+
case 7:
|
|
1253
|
+
_context6.next = 9;
|
|
1254
|
+
return loadData(false);
|
|
1255
|
+
|
|
1256
|
+
case 9:
|
|
1257
|
+
case "end":
|
|
1258
|
+
return _context6.stop();
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}, _callee6);
|
|
1262
|
+
}));
|
|
1263
|
+
|
|
1264
|
+
return function handleOnClickSaveImages() {
|
|
1265
|
+
return _ref10.apply(this, arguments);
|
|
1266
|
+
};
|
|
1267
|
+
}();
|
|
1237
1268
|
/*
|
|
1238
1269
|
Trae la familia: los hijos del producto, o sus hermanos si el abierto es
|
|
1239
1270
|
una de ellas. Se pide al abrir la sección y no al montar la pantalla: la
|
|
@@ -1242,31 +1273,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1242
1273
|
|
|
1243
1274
|
|
|
1244
1275
|
var loadFamily = /*#__PURE__*/function () {
|
|
1245
|
-
var
|
|
1276
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
1246
1277
|
var forzar,
|
|
1247
|
-
_state$
|
|
1278
|
+
_state$product9,
|
|
1248
1279
|
res,
|
|
1249
1280
|
data,
|
|
1250
|
-
|
|
1281
|
+
_args7 = arguments;
|
|
1251
1282
|
|
|
1252
|
-
return _regenerator.default.wrap(function
|
|
1283
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1253
1284
|
while (1) {
|
|
1254
|
-
switch (
|
|
1285
|
+
switch (_context7.prev = _context7.next) {
|
|
1255
1286
|
case 0:
|
|
1256
|
-
forzar =
|
|
1287
|
+
forzar = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
|
|
1257
1288
|
|
|
1258
1289
|
if (!(family && !forzar)) {
|
|
1259
|
-
|
|
1290
|
+
_context7.next = 3;
|
|
1260
1291
|
break;
|
|
1261
1292
|
}
|
|
1262
1293
|
|
|
1263
|
-
return
|
|
1294
|
+
return _context7.abrupt("return", family);
|
|
1264
1295
|
|
|
1265
1296
|
case 3:
|
|
1266
|
-
|
|
1267
|
-
|
|
1297
|
+
_context7.prev = 3;
|
|
1298
|
+
_context7.next = 6;
|
|
1268
1299
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/family"), {
|
|
1269
|
-
articleId: (_state$
|
|
1300
|
+
articleId: (_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.id_article
|
|
1270
1301
|
}, {
|
|
1271
1302
|
headers: {
|
|
1272
1303
|
Authorization: token
|
|
@@ -1274,32 +1305,32 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1274
1305
|
});
|
|
1275
1306
|
|
|
1276
1307
|
case 6:
|
|
1277
|
-
res =
|
|
1308
|
+
res = _context7.sent;
|
|
1278
1309
|
data = (0, _api.readPayload)(res);
|
|
1279
1310
|
setFamily(data);
|
|
1280
|
-
return
|
|
1311
|
+
return _context7.abrupt("return", data);
|
|
1281
1312
|
|
|
1282
1313
|
case 12:
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
console.error("loadFamily: ",
|
|
1314
|
+
_context7.prev = 12;
|
|
1315
|
+
_context7.t0 = _context7["catch"](3);
|
|
1316
|
+
console.error("loadFamily: ", _context7.t0);
|
|
1286
1317
|
setFamily({
|
|
1287
1318
|
variants: [],
|
|
1288
1319
|
parent: null,
|
|
1289
1320
|
error: true
|
|
1290
1321
|
});
|
|
1291
|
-
return
|
|
1322
|
+
return _context7.abrupt("return", null);
|
|
1292
1323
|
|
|
1293
1324
|
case 17:
|
|
1294
1325
|
case "end":
|
|
1295
|
-
return
|
|
1326
|
+
return _context7.stop();
|
|
1296
1327
|
}
|
|
1297
1328
|
}
|
|
1298
|
-
},
|
|
1329
|
+
}, _callee7, null, [[3, 12]]);
|
|
1299
1330
|
}));
|
|
1300
1331
|
|
|
1301
1332
|
return function loadFamily() {
|
|
1302
|
-
return
|
|
1333
|
+
return _ref11.apply(this, arguments);
|
|
1303
1334
|
};
|
|
1304
1335
|
}();
|
|
1305
1336
|
/*
|
|
@@ -1316,16 +1347,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1316
1347
|
|
|
1317
1348
|
|
|
1318
1349
|
(0, _react.useEffect)(function () {
|
|
1319
|
-
var _state$
|
|
1350
|
+
var _state$product10;
|
|
1320
1351
|
|
|
1321
|
-
if (!((_state$
|
|
1352
|
+
if (!((_state$product10 = state.product) !== null && _state$product10 !== void 0 && _state$product10.id_article)) return;
|
|
1322
1353
|
loadFamily(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1323
|
-
}, [(_state$
|
|
1354
|
+
}, [(_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.id_article]); // El conteo sale de la familia recién consultada, no del producto.
|
|
1324
1355
|
|
|
1325
1356
|
var hijosDelProducto = family !== null && family !== void 0 && family.error ? 0 : ((_family$variants = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants !== void 0 ? _family$variants : []).filter(function (v) {
|
|
1326
1357
|
return !v.isCurrent;
|
|
1327
1358
|
}).length;
|
|
1328
|
-
var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$
|
|
1359
|
+
var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$product12 = state.product) !== null && _state$product12 !== void 0 && _state$product12.parentArticleId) : !!(family !== null && family !== void 0 && family.parent);
|
|
1329
1360
|
/*
|
|
1330
1361
|
Un hijo no se agrupa como variante (decisión de producto, 2026-09-25).
|
|
1331
1362
|
Agrupar declara «estos son el mismo producto en otra presentación», y un
|
|
@@ -1367,14 +1398,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1367
1398
|
*/
|
|
1368
1399
|
|
|
1369
1400
|
var handleOnUnlinked = function handleOnUnlinked(result) {
|
|
1370
|
-
var _state$product$varian, _state$
|
|
1401
|
+
var _state$product$varian, _state$product13, _updatedProduct$varia;
|
|
1371
1402
|
|
|
1372
1403
|
if (!result) return;
|
|
1373
1404
|
var updatedProduct = result.mode === "self" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1374
1405
|
parentArticleId: null,
|
|
1375
1406
|
variantsCount: 0
|
|
1376
1407
|
}) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1377
|
-
variantsCount: Math.max(((_state$product$varian = (_state$
|
|
1408
|
+
variantsCount: Math.max(((_state$product$varian = (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 1) - 1, 0)
|
|
1378
1409
|
});
|
|
1379
1410
|
dispatch({
|
|
1380
1411
|
type: "SET_PRODUCT",
|
|
@@ -1426,31 +1457,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1426
1457
|
|
|
1427
1458
|
|
|
1428
1459
|
var loadVariantGroup = /*#__PURE__*/function () {
|
|
1429
|
-
var
|
|
1460
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
1430
1461
|
var forzar,
|
|
1431
|
-
_state$
|
|
1462
|
+
_state$product14,
|
|
1432
1463
|
res,
|
|
1433
1464
|
data,
|
|
1434
|
-
|
|
1465
|
+
_args8 = arguments;
|
|
1435
1466
|
|
|
1436
|
-
return _regenerator.default.wrap(function
|
|
1467
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1437
1468
|
while (1) {
|
|
1438
|
-
switch (
|
|
1469
|
+
switch (_context8.prev = _context8.next) {
|
|
1439
1470
|
case 0:
|
|
1440
|
-
forzar =
|
|
1471
|
+
forzar = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : false;
|
|
1441
1472
|
|
|
1442
1473
|
if (!(variantGroup && !forzar)) {
|
|
1443
|
-
|
|
1474
|
+
_context8.next = 3;
|
|
1444
1475
|
break;
|
|
1445
1476
|
}
|
|
1446
1477
|
|
|
1447
|
-
return
|
|
1478
|
+
return _context8.abrupt("return", variantGroup);
|
|
1448
1479
|
|
|
1449
1480
|
case 3:
|
|
1450
|
-
|
|
1451
|
-
|
|
1481
|
+
_context8.prev = 3;
|
|
1482
|
+
_context8.next = 6;
|
|
1452
1483
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/group"), {
|
|
1453
|
-
articleId: (_state$
|
|
1484
|
+
articleId: (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.id_article
|
|
1454
1485
|
}, {
|
|
1455
1486
|
headers: {
|
|
1456
1487
|
Authorization: token
|
|
@@ -1458,54 +1489,54 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1458
1489
|
});
|
|
1459
1490
|
|
|
1460
1491
|
case 6:
|
|
1461
|
-
res =
|
|
1492
|
+
res = _context8.sent;
|
|
1462
1493
|
data = (0, _api.readPayload)(res);
|
|
1463
1494
|
setVariantGroup(data);
|
|
1464
|
-
return
|
|
1495
|
+
return _context8.abrupt("return", data);
|
|
1465
1496
|
|
|
1466
1497
|
case 12:
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
console.error("loadVariantGroup: ",
|
|
1498
|
+
_context8.prev = 12;
|
|
1499
|
+
_context8.t0 = _context8["catch"](3);
|
|
1500
|
+
console.error("loadVariantGroup: ", _context8.t0);
|
|
1470
1501
|
setVariantGroup({
|
|
1471
1502
|
group: null,
|
|
1472
1503
|
members: [],
|
|
1473
1504
|
error: true
|
|
1474
1505
|
});
|
|
1475
|
-
return
|
|
1506
|
+
return _context8.abrupt("return", null);
|
|
1476
1507
|
|
|
1477
1508
|
case 17:
|
|
1478
1509
|
case "end":
|
|
1479
|
-
return
|
|
1510
|
+
return _context8.stop();
|
|
1480
1511
|
}
|
|
1481
1512
|
}
|
|
1482
|
-
},
|
|
1513
|
+
}, _callee8, null, [[3, 12]]);
|
|
1483
1514
|
}));
|
|
1484
1515
|
|
|
1485
1516
|
return function loadVariantGroup() {
|
|
1486
|
-
return
|
|
1517
|
+
return _ref12.apply(this, arguments);
|
|
1487
1518
|
};
|
|
1488
1519
|
}();
|
|
1489
1520
|
|
|
1490
1521
|
(0, _react.useEffect)(function () {
|
|
1491
|
-
var _state$
|
|
1522
|
+
var _state$product15;
|
|
1492
1523
|
|
|
1493
|
-
if (!((_state$
|
|
1524
|
+
if (!((_state$product15 = state.product) !== null && _state$product15 !== void 0 && _state$product15.id_article)) return;
|
|
1494
1525
|
loadVariantGroup(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1495
|
-
}, [(_state$
|
|
1526
|
+
}, [(_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.id_article]);
|
|
1496
1527
|
|
|
1497
1528
|
var handleOnLeaveGroup = /*#__PURE__*/function () {
|
|
1498
|
-
var
|
|
1499
|
-
var _state$
|
|
1529
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
1530
|
+
var _state$product17, res;
|
|
1500
1531
|
|
|
1501
|
-
return _regenerator.default.wrap(function
|
|
1532
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1502
1533
|
while (1) {
|
|
1503
|
-
switch (
|
|
1534
|
+
switch (_context9.prev = _context9.next) {
|
|
1504
1535
|
case 0:
|
|
1505
|
-
|
|
1506
|
-
|
|
1536
|
+
_context9.prev = 0;
|
|
1537
|
+
_context9.next = 3;
|
|
1507
1538
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/leave"), {
|
|
1508
|
-
articleId: (_state$
|
|
1539
|
+
articleId: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.id_article
|
|
1509
1540
|
}, {
|
|
1510
1541
|
headers: {
|
|
1511
1542
|
Authorization: token
|
|
@@ -1513,16 +1544,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1513
1544
|
});
|
|
1514
1545
|
|
|
1515
1546
|
case 3:
|
|
1516
|
-
res =
|
|
1547
|
+
res = _context9.sent;
|
|
1517
1548
|
setVariantGroup((0, _api.readPayload)(res));
|
|
1518
1549
|
setShowGroup(false);
|
|
1519
|
-
|
|
1550
|
+
_context9.next = 12;
|
|
1520
1551
|
break;
|
|
1521
1552
|
|
|
1522
1553
|
case 8:
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
console.error("leaveVariantGroup: ",
|
|
1554
|
+
_context9.prev = 8;
|
|
1555
|
+
_context9.t0 = _context9["catch"](0);
|
|
1556
|
+
console.error("leaveVariantGroup: ", _context9.t0);
|
|
1526
1557
|
dispatch({
|
|
1527
1558
|
type: "SET_MODAL",
|
|
1528
1559
|
payload: {
|
|
@@ -1547,29 +1578,29 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1547
1578
|
|
|
1548
1579
|
case 12:
|
|
1549
1580
|
case "end":
|
|
1550
|
-
return
|
|
1581
|
+
return _context9.stop();
|
|
1551
1582
|
}
|
|
1552
1583
|
}
|
|
1553
|
-
},
|
|
1584
|
+
}, _callee9, null, [[0, 8]]);
|
|
1554
1585
|
}));
|
|
1555
1586
|
|
|
1556
1587
|
return function handleOnLeaveGroup() {
|
|
1557
|
-
return
|
|
1588
|
+
return _ref13.apply(this, arguments);
|
|
1558
1589
|
};
|
|
1559
1590
|
}();
|
|
1560
1591
|
|
|
1561
1592
|
var openFamilyMember = /*#__PURE__*/function () {
|
|
1562
|
-
var
|
|
1563
|
-
var _readPayload, res,
|
|
1593
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(articleId) {
|
|
1594
|
+
var _readPayload, res, _ref15, data, encontrado;
|
|
1564
1595
|
|
|
1565
|
-
return _regenerator.default.wrap(function
|
|
1596
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1566
1597
|
while (1) {
|
|
1567
|
-
switch (
|
|
1598
|
+
switch (_context10.prev = _context10.next) {
|
|
1568
1599
|
case 0:
|
|
1569
1600
|
setLoadingVariant(articleId);
|
|
1570
1601
|
setAvisoFamilia(null);
|
|
1571
|
-
|
|
1572
|
-
|
|
1602
|
+
_context10.prev = 2;
|
|
1603
|
+
_context10.next = 5;
|
|
1573
1604
|
return _axios.default.get("".concat(process.env.REACT_APP_ORDERED_SERVICES_ENDPOINT), {
|
|
1574
1605
|
params: {
|
|
1575
1606
|
filterByIdArticle: articleId,
|
|
@@ -1581,11 +1612,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1581
1612
|
});
|
|
1582
1613
|
|
|
1583
1614
|
case 5:
|
|
1584
|
-
res =
|
|
1615
|
+
res = _context10.sent;
|
|
1585
1616
|
// read-order-services responde { total, data: [...] }. La vista trae una
|
|
1586
1617
|
// fila por orden, así que puede haber varias del mismo artículo; llegan
|
|
1587
1618
|
// ordenadas por order_id DESC y la primera es la orden más reciente.
|
|
1588
|
-
|
|
1619
|
+
_ref15 = (_readPayload = (0, _api.readPayload)(res)) !== null && _readPayload !== void 0 ? _readPayload : {}, data = _ref15.data;
|
|
1589
1620
|
encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
|
|
1590
1621
|
var _item$article;
|
|
1591
1622
|
|
|
@@ -1593,12 +1624,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1593
1624
|
});
|
|
1594
1625
|
|
|
1595
1626
|
if (encontrado) {
|
|
1596
|
-
|
|
1627
|
+
_context10.next = 11;
|
|
1597
1628
|
break;
|
|
1598
1629
|
}
|
|
1599
1630
|
|
|
1600
1631
|
setAvisoFamilia("Ese producto no está en ninguna orden de trabajo, así que no se puede abrir desde aquí.");
|
|
1601
|
-
return
|
|
1632
|
+
return _context10.abrupt("return");
|
|
1602
1633
|
|
|
1603
1634
|
case 11:
|
|
1604
1635
|
sessionStorage.setItem("productSelected", JSON.stringify(encontrado));
|
|
@@ -1609,30 +1640,30 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1609
1640
|
product: [encontrado]
|
|
1610
1641
|
}));
|
|
1611
1642
|
window.location.assign("/EditProducts");
|
|
1612
|
-
|
|
1643
|
+
_context10.next = 21;
|
|
1613
1644
|
break;
|
|
1614
1645
|
|
|
1615
1646
|
case 17:
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
console.error("openFamilyMember: ",
|
|
1647
|
+
_context10.prev = 17;
|
|
1648
|
+
_context10.t0 = _context10["catch"](2);
|
|
1649
|
+
console.error("openFamilyMember: ", _context10.t0);
|
|
1619
1650
|
setAvisoFamilia("No se pudo abrir ese producto. Intenta de nuevo.");
|
|
1620
1651
|
|
|
1621
1652
|
case 21:
|
|
1622
|
-
|
|
1653
|
+
_context10.prev = 21;
|
|
1623
1654
|
setLoadingVariant(null);
|
|
1624
|
-
return
|
|
1655
|
+
return _context10.finish(21);
|
|
1625
1656
|
|
|
1626
1657
|
case 24:
|
|
1627
1658
|
case "end":
|
|
1628
|
-
return
|
|
1659
|
+
return _context10.stop();
|
|
1629
1660
|
}
|
|
1630
1661
|
}
|
|
1631
|
-
},
|
|
1662
|
+
}, _callee10, null, [[2, 17, 21, 24]]);
|
|
1632
1663
|
}));
|
|
1633
1664
|
|
|
1634
|
-
return function openFamilyMember(
|
|
1635
|
-
return
|
|
1665
|
+
return function openFamilyMember(_x2) {
|
|
1666
|
+
return _ref14.apply(this, arguments);
|
|
1636
1667
|
};
|
|
1637
1668
|
}();
|
|
1638
1669
|
/*
|
|
@@ -1643,11 +1674,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1643
1674
|
|
|
1644
1675
|
|
|
1645
1676
|
var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
|
|
1646
|
-
var _state$product$varian2, _state$
|
|
1677
|
+
var _state$product$varian2, _state$product18, _result$linked, _result$parentArticle;
|
|
1647
1678
|
|
|
1648
1679
|
if (!result) return;
|
|
1649
1680
|
var updatedProduct = result.mode === "children" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1650
|
-
variantsCount: ((_state$product$varian2 = (_state$
|
|
1681
|
+
variantsCount: ((_state$product$varian2 = (_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
|
|
1651
1682
|
}) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1652
1683
|
parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
|
|
1653
1684
|
variantsCount: 0
|
|
@@ -1721,31 +1752,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1721
1752
|
|
|
1722
1753
|
|
|
1723
1754
|
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
1724
|
-
var
|
|
1725
|
-
var _state$
|
|
1755
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(attributeId) {
|
|
1756
|
+
var _state$product19;
|
|
1726
1757
|
|
|
1727
1758
|
var kind,
|
|
1728
1759
|
esDescripcion,
|
|
1729
1760
|
res,
|
|
1730
1761
|
data,
|
|
1731
|
-
|
|
1732
|
-
return _regenerator.default.wrap(function
|
|
1762
|
+
_args11 = arguments;
|
|
1763
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1733
1764
|
while (1) {
|
|
1734
|
-
switch (
|
|
1765
|
+
switch (_context11.prev = _context11.next) {
|
|
1735
1766
|
case 0:
|
|
1736
|
-
kind =
|
|
1767
|
+
kind = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : "attribute";
|
|
1737
1768
|
|
|
1738
|
-
if (!(!attributeId || !((_state$
|
|
1739
|
-
|
|
1769
|
+
if (!(!attributeId || !((_state$product19 = state.product) !== null && _state$product19 !== void 0 && _state$product19.id_article))) {
|
|
1770
|
+
_context11.next = 3;
|
|
1740
1771
|
break;
|
|
1741
1772
|
}
|
|
1742
1773
|
|
|
1743
|
-
return
|
|
1774
|
+
return _context11.abrupt("return");
|
|
1744
1775
|
|
|
1745
1776
|
case 3:
|
|
1746
1777
|
esDescripcion = kind === "description";
|
|
1747
|
-
|
|
1748
|
-
|
|
1778
|
+
_context11.prev = 4;
|
|
1779
|
+
_context11.next = 7;
|
|
1749
1780
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread5.default)({
|
|
1750
1781
|
articleId: state.product.id_article
|
|
1751
1782
|
}, esDescripcion ? {
|
|
@@ -1759,11 +1790,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1759
1790
|
});
|
|
1760
1791
|
|
|
1761
1792
|
case 7:
|
|
1762
|
-
res =
|
|
1793
|
+
res = _context11.sent;
|
|
1763
1794
|
data = (0, _api.readPayload)(res);
|
|
1764
1795
|
|
|
1765
1796
|
if (!esDescripcion) {
|
|
1766
|
-
|
|
1797
|
+
_context11.next = 12;
|
|
1767
1798
|
break;
|
|
1768
1799
|
}
|
|
1769
1800
|
|
|
@@ -1777,7 +1808,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1777
1808
|
};
|
|
1778
1809
|
})
|
|
1779
1810
|
});
|
|
1780
|
-
return
|
|
1811
|
+
return _context11.abrupt("return");
|
|
1781
1812
|
|
|
1782
1813
|
case 12:
|
|
1783
1814
|
dispatch({
|
|
@@ -1790,24 +1821,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1790
1821
|
};
|
|
1791
1822
|
})
|
|
1792
1823
|
});
|
|
1793
|
-
|
|
1824
|
+
_context11.next = 18;
|
|
1794
1825
|
break;
|
|
1795
1826
|
|
|
1796
1827
|
case 15:
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
console.error("restoreInheritance: ",
|
|
1828
|
+
_context11.prev = 15;
|
|
1829
|
+
_context11.t0 = _context11["catch"](4);
|
|
1830
|
+
console.error("restoreInheritance: ", _context11.t0);
|
|
1800
1831
|
|
|
1801
1832
|
case 18:
|
|
1802
1833
|
case "end":
|
|
1803
|
-
return
|
|
1834
|
+
return _context11.stop();
|
|
1804
1835
|
}
|
|
1805
1836
|
}
|
|
1806
|
-
},
|
|
1837
|
+
}, _callee11, null, [[4, 15]]);
|
|
1807
1838
|
}));
|
|
1808
1839
|
|
|
1809
|
-
return function handleOnRestoreInheritance(
|
|
1810
|
-
return
|
|
1840
|
+
return function handleOnRestoreInheritance(_x3) {
|
|
1841
|
+
return _ref16.apply(this, arguments);
|
|
1811
1842
|
};
|
|
1812
1843
|
}();
|
|
1813
1844
|
/*
|
|
@@ -1866,23 +1897,23 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1866
1897
|
};
|
|
1867
1898
|
|
|
1868
1899
|
var handleOnClickSave = /*#__PURE__*/function () {
|
|
1869
|
-
var
|
|
1900
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1870
1901
|
var _variantGroup$members, _familiaDesc$variants, _familiaDesc, cambiosDesc, companerasDesc, familiaDesc, hijosDesc, _familia, _familia$variants, _variantGroup$members2, cambios, familia, esHijo, hijos, companeras;
|
|
1871
1902
|
|
|
1872
|
-
return _regenerator.default.wrap(function
|
|
1903
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1873
1904
|
while (1) {
|
|
1874
|
-
switch (
|
|
1905
|
+
switch (_context12.prev = _context12.next) {
|
|
1875
1906
|
case 0:
|
|
1876
1907
|
if (!(state.saving || preparandoPropagacion)) {
|
|
1877
|
-
|
|
1908
|
+
_context12.next = 2;
|
|
1878
1909
|
break;
|
|
1879
1910
|
}
|
|
1880
1911
|
|
|
1881
|
-
return
|
|
1912
|
+
return _context12.abrupt("return");
|
|
1882
1913
|
|
|
1883
1914
|
case 2:
|
|
1884
|
-
|
|
1885
|
-
|
|
1915
|
+
_context12.t0 = state.active_tab;
|
|
1916
|
+
_context12.next = _context12.t0 === "Descripción" ? 5 : _context12.t0 === "Ficha técnica" ? 27 : _context12.t0 === "Imágenes" ? 53 : 60;
|
|
1886
1917
|
break;
|
|
1887
1918
|
|
|
1888
1919
|
case 5:
|
|
@@ -1898,30 +1929,30 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1898
1929
|
});
|
|
1899
1930
|
|
|
1900
1931
|
if (!(esHijoDeOtro || cambiosDesc.length === 0)) {
|
|
1901
|
-
|
|
1932
|
+
_context12.next = 11;
|
|
1902
1933
|
break;
|
|
1903
1934
|
}
|
|
1904
1935
|
|
|
1905
|
-
|
|
1936
|
+
_context12.next = 10;
|
|
1906
1937
|
return saveDescriptions(token);
|
|
1907
1938
|
|
|
1908
1939
|
case 10:
|
|
1909
|
-
return
|
|
1940
|
+
return _context12.abrupt("break", 61);
|
|
1910
1941
|
|
|
1911
1942
|
case 11:
|
|
1912
1943
|
setPreparandoPropagacion(true);
|
|
1913
1944
|
familiaDesc = null;
|
|
1914
|
-
|
|
1915
|
-
|
|
1945
|
+
_context12.prev = 13;
|
|
1946
|
+
_context12.next = 16;
|
|
1916
1947
|
return loadFamily(true);
|
|
1917
1948
|
|
|
1918
1949
|
case 16:
|
|
1919
|
-
familiaDesc =
|
|
1950
|
+
familiaDesc = _context12.sent;
|
|
1920
1951
|
|
|
1921
1952
|
case 17:
|
|
1922
|
-
|
|
1953
|
+
_context12.prev = 17;
|
|
1923
1954
|
setPreparandoPropagacion(false);
|
|
1924
|
-
return
|
|
1955
|
+
return _context12.finish(17);
|
|
1925
1956
|
|
|
1926
1957
|
case 20:
|
|
1927
1958
|
hijosDesc = ((_familiaDesc$variants = (_familiaDesc = familiaDesc) === null || _familiaDesc === void 0 ? void 0 : _familiaDesc.variants) !== null && _familiaDesc$variants !== void 0 ? _familiaDesc$variants : []).filter(function (v) {
|
|
@@ -1929,7 +1960,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1929
1960
|
});
|
|
1930
1961
|
|
|
1931
1962
|
if (!(hijosDesc.length > 0 || companerasDesc.length > 0)) {
|
|
1932
|
-
|
|
1963
|
+
_context12.next = 24;
|
|
1933
1964
|
break;
|
|
1934
1965
|
}
|
|
1935
1966
|
|
|
@@ -1937,28 +1968,28 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1937
1968
|
cambios: cambiosDesc,
|
|
1938
1969
|
kind: "description"
|
|
1939
1970
|
});
|
|
1940
|
-
return
|
|
1971
|
+
return _context12.abrupt("return");
|
|
1941
1972
|
|
|
1942
1973
|
case 24:
|
|
1943
|
-
|
|
1974
|
+
_context12.next = 26;
|
|
1944
1975
|
return saveDescriptions(token);
|
|
1945
1976
|
|
|
1946
1977
|
case 26:
|
|
1947
|
-
return
|
|
1978
|
+
return _context12.abrupt("break", 61);
|
|
1948
1979
|
|
|
1949
1980
|
case 27:
|
|
1950
1981
|
cambios = cambiosDeFichaTecnica();
|
|
1951
1982
|
|
|
1952
1983
|
if (!(cambios.length === 0)) {
|
|
1953
|
-
|
|
1984
|
+
_context12.next = 32;
|
|
1954
1985
|
break;
|
|
1955
1986
|
}
|
|
1956
1987
|
|
|
1957
|
-
|
|
1988
|
+
_context12.next = 31;
|
|
1958
1989
|
return saveDatasheets(token);
|
|
1959
1990
|
|
|
1960
1991
|
case 31:
|
|
1961
|
-
return
|
|
1992
|
+
return _context12.abrupt("break", 61);
|
|
1962
1993
|
|
|
1963
1994
|
case 32:
|
|
1964
1995
|
/*
|
|
@@ -1977,21 +2008,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1977
2008
|
*/
|
|
1978
2009
|
setPreparandoPropagacion(true);
|
|
1979
2010
|
familia = null;
|
|
1980
|
-
|
|
1981
|
-
|
|
2011
|
+
_context12.prev = 34;
|
|
2012
|
+
_context12.next = 37;
|
|
1982
2013
|
return loadFamily(true);
|
|
1983
2014
|
|
|
1984
2015
|
case 37:
|
|
1985
|
-
familia =
|
|
2016
|
+
familia = _context12.sent;
|
|
1986
2017
|
|
|
1987
2018
|
case 38:
|
|
1988
|
-
|
|
2019
|
+
_context12.prev = 38;
|
|
1989
2020
|
setPreparandoPropagacion(false);
|
|
1990
|
-
return
|
|
2021
|
+
return _context12.finish(38);
|
|
1991
2022
|
|
|
1992
2023
|
case 41:
|
|
1993
2024
|
if (!(!familia || familia.error)) {
|
|
1994
|
-
|
|
2025
|
+
_context12.next = 44;
|
|
1995
2026
|
break;
|
|
1996
2027
|
}
|
|
1997
2028
|
|
|
@@ -2028,7 +2059,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2028
2059
|
}]
|
|
2029
2060
|
}
|
|
2030
2061
|
});
|
|
2031
|
-
return
|
|
2062
|
+
return _context12.abrupt("return");
|
|
2032
2063
|
|
|
2033
2064
|
case 44:
|
|
2034
2065
|
/*
|
|
@@ -2056,7 +2087,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2056
2087
|
// él no queda ningún destino posible.
|
|
2057
2088
|
|
|
2058
2089
|
if (!(!esHijo && (hijos.length > 0 || companeras.length > 0))) {
|
|
2059
|
-
|
|
2090
|
+
_context12.next = 50;
|
|
2060
2091
|
break;
|
|
2061
2092
|
}
|
|
2062
2093
|
|
|
@@ -2064,39 +2095,51 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2064
2095
|
cambios: cambios,
|
|
2065
2096
|
kind: "datasheet"
|
|
2066
2097
|
});
|
|
2067
|
-
return
|
|
2098
|
+
return _context12.abrupt("return");
|
|
2068
2099
|
|
|
2069
2100
|
case 50:
|
|
2070
|
-
|
|
2101
|
+
_context12.next = 52;
|
|
2071
2102
|
return saveDatasheets(token);
|
|
2072
2103
|
|
|
2073
2104
|
case 52:
|
|
2074
|
-
return
|
|
2105
|
+
return _context12.abrupt("break", 61);
|
|
2075
2106
|
|
|
2076
2107
|
case 53:
|
|
2077
|
-
|
|
2078
|
-
|
|
2108
|
+
if (!(currentTray === _GalleryTrayTabs.TRAYS.ASSETS)) {
|
|
2109
|
+
_context12.next = 57;
|
|
2110
|
+
break;
|
|
2111
|
+
}
|
|
2079
2112
|
|
|
2080
|
-
|
|
2081
|
-
return
|
|
2113
|
+
_context12.next = 56;
|
|
2114
|
+
return handleOnSaveAssets();
|
|
2082
2115
|
|
|
2083
2116
|
case 56:
|
|
2084
|
-
return
|
|
2117
|
+
return _context12.abrupt("return");
|
|
2085
2118
|
|
|
2086
2119
|
case 57:
|
|
2087
|
-
|
|
2088
|
-
return
|
|
2120
|
+
_context12.next = 59;
|
|
2121
|
+
return updateImages(token);
|
|
2089
2122
|
|
|
2090
2123
|
case 59:
|
|
2124
|
+
return _context12.abrupt("break", 61);
|
|
2125
|
+
|
|
2126
|
+
case 60:
|
|
2127
|
+
return _context12.abrupt("break", 61);
|
|
2128
|
+
|
|
2129
|
+
case 61:
|
|
2130
|
+
_context12.next = 63;
|
|
2131
|
+
return loadData(false);
|
|
2132
|
+
|
|
2133
|
+
case 63:
|
|
2091
2134
|
case "end":
|
|
2092
|
-
return
|
|
2135
|
+
return _context12.stop();
|
|
2093
2136
|
}
|
|
2094
2137
|
}
|
|
2095
|
-
},
|
|
2138
|
+
}, _callee12, null, [[13,, 17, 20], [34,, 38, 41]]);
|
|
2096
2139
|
}));
|
|
2097
2140
|
|
|
2098
2141
|
return function handleOnClickSave() {
|
|
2099
|
-
return
|
|
2142
|
+
return _ref17.apply(this, arguments);
|
|
2100
2143
|
};
|
|
2101
2144
|
}();
|
|
2102
2145
|
|
|
@@ -2113,8 +2156,106 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2113
2156
|
payload: items
|
|
2114
2157
|
});
|
|
2115
2158
|
};
|
|
2159
|
+
/*
|
|
2160
|
+
Descarga de activos: los seleccionados, o todos si no hay selección — el
|
|
2161
|
+
mismo criterio que usa la descarga de imágenes.
|
|
2162
|
+
Solo se descarga lo que ya está en S3. Un activo recién soltado vive como
|
|
2163
|
+
referencia al archivo del disco del usuario: "descargarlo" le devolvería el
|
|
2164
|
+
archivo que él mismo acaba de elegir, lo cual no tiene sentido.
|
|
2165
|
+
*/
|
|
2166
|
+
|
|
2167
|
+
|
|
2168
|
+
var handleOnDownloadAssets = function handleOnDownloadAssets() {
|
|
2169
|
+
var seleccion = state.selected_assets.length ? state.selected_assets : state.assets_values;
|
|
2170
|
+
var descargables = seleccion.filter(function (asset) {
|
|
2171
|
+
return asset.id && asset.url;
|
|
2172
|
+
});
|
|
2173
|
+
|
|
2174
|
+
if (descargables.length === 0) {
|
|
2175
|
+
dispatch({
|
|
2176
|
+
type: "SET_MODAL",
|
|
2177
|
+
payload: {
|
|
2178
|
+
show: true,
|
|
2179
|
+
title: "Nada que descargar",
|
|
2180
|
+
message: "Los activos seleccionados todavía no se han guardado. Guárdalos primero.",
|
|
2181
|
+
image: _genericModalWarning.default
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
return;
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
descargables.forEach(function (asset) {
|
|
2188
|
+
return (0, _fileSaver.saveAs)(asset.url, asset.name);
|
|
2189
|
+
});
|
|
2190
|
+
};
|
|
2191
|
+
/*
|
|
2192
|
+
Borrado en lote de activos.
|
|
2193
|
+
A diferencia de las imágenes, que se borran contra el backend en el momento,
|
|
2194
|
+
los activos se quitan de la bandeja y su baja viaja en el mismo PUT del
|
|
2195
|
+
guardado (`deleteAssets`). Es lo que permite al usuario deshacerse de un
|
|
2196
|
+
borrado por error: basta con no guardar. El mensaje lo dice, para que nadie
|
|
2197
|
+
se quede pensando que ya se aplicó.
|
|
2198
|
+
*/
|
|
2199
|
+
|
|
2200
|
+
|
|
2201
|
+
var handleOnAskToDeleteAssets = function handleOnAskToDeleteAssets() {
|
|
2202
|
+
if (state.selected_assets.length === 0) {
|
|
2203
|
+
dispatch({
|
|
2204
|
+
type: "SET_MODAL",
|
|
2205
|
+
payload: {
|
|
2206
|
+
show: true,
|
|
2207
|
+
title: "Eliminar activos digitales",
|
|
2208
|
+
message: "No has seleccionado ningún activo para eliminar.",
|
|
2209
|
+
image: _genericModalWarning.default
|
|
2210
|
+
}
|
|
2211
|
+
});
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
var seleccionados = state.selected_assets;
|
|
2216
|
+
dispatch({
|
|
2217
|
+
type: "SET_MODAL",
|
|
2218
|
+
payload: {
|
|
2219
|
+
show: true,
|
|
2220
|
+
title: "Eliminar activos digitales",
|
|
2221
|
+
message: "Se quitar\xE1n ".concat(seleccionados.length, " activo(s) de la bandeja. El borrado se aplica al guardar."),
|
|
2222
|
+
image: _genericModalWarning.default,
|
|
2223
|
+
buttons: [{
|
|
2224
|
+
text: "Cancelar",
|
|
2225
|
+
buttonType: "general-white-button",
|
|
2226
|
+
action: function action() {
|
|
2227
|
+
return dispatch({
|
|
2228
|
+
type: "SET_MODAL",
|
|
2229
|
+
payload: {
|
|
2230
|
+
show: false
|
|
2231
|
+
}
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
}, {
|
|
2235
|
+
text: "Eliminar",
|
|
2236
|
+
buttonType: "general-button-default",
|
|
2237
|
+
action: function action() {
|
|
2238
|
+
dispatch({
|
|
2239
|
+
type: "SET_MODAL",
|
|
2240
|
+
payload: {
|
|
2241
|
+
show: false
|
|
2242
|
+
}
|
|
2243
|
+
});
|
|
2244
|
+
seleccionados.forEach(function (asset) {
|
|
2245
|
+
return digitalAssets.removeAsset(asset);
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2248
|
+
}]
|
|
2249
|
+
}
|
|
2250
|
+
});
|
|
2251
|
+
};
|
|
2116
2252
|
|
|
2117
2253
|
var handleOnAskToDeleteImages = function handleOnAskToDeleteImages() {
|
|
2254
|
+
if (currentTray === _GalleryTrayTabs.TRAYS.ASSETS) {
|
|
2255
|
+
handleOnAskToDeleteAssets();
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2118
2259
|
if (state.selected_images.length === 0) {
|
|
2119
2260
|
dispatch({
|
|
2120
2261
|
type: "SET_MODAL",
|
|
@@ -2164,24 +2305,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2164
2305
|
};
|
|
2165
2306
|
|
|
2166
2307
|
var handleOnApproveSingleService = /*#__PURE__*/function () {
|
|
2167
|
-
var
|
|
2168
|
-
return _regenerator.default.wrap(function
|
|
2308
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
2309
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
2169
2310
|
while (1) {
|
|
2170
|
-
switch (
|
|
2311
|
+
switch (_context13.prev = _context13.next) {
|
|
2171
2312
|
case 0:
|
|
2172
|
-
|
|
2313
|
+
_context13.next = 2;
|
|
2173
2314
|
return sendSingleEvaluation("A");
|
|
2174
2315
|
|
|
2175
2316
|
case 2:
|
|
2176
2317
|
case "end":
|
|
2177
|
-
return
|
|
2318
|
+
return _context13.stop();
|
|
2178
2319
|
}
|
|
2179
2320
|
}
|
|
2180
|
-
},
|
|
2321
|
+
}, _callee13);
|
|
2181
2322
|
}));
|
|
2182
2323
|
|
|
2183
2324
|
return function handleOnApproveSingleService() {
|
|
2184
|
-
return
|
|
2325
|
+
return _ref18.apply(this, arguments);
|
|
2185
2326
|
};
|
|
2186
2327
|
}();
|
|
2187
2328
|
|
|
@@ -2190,21 +2331,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2190
2331
|
};
|
|
2191
2332
|
|
|
2192
2333
|
var sendSingleEvaluation = /*#__PURE__*/function () {
|
|
2193
|
-
var
|
|
2334
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
|
|
2194
2335
|
var _state$product$id_ord, _state$active_retaile6;
|
|
2195
2336
|
|
|
2196
2337
|
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;
|
|
2197
2338
|
|
|
2198
|
-
return _regenerator.default.wrap(function
|
|
2339
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
2199
2340
|
while (1) {
|
|
2200
|
-
switch (
|
|
2341
|
+
switch (_context14.prev = _context14.next) {
|
|
2201
2342
|
case 0:
|
|
2202
2343
|
if (!state.saving) {
|
|
2203
|
-
|
|
2344
|
+
_context14.next = 2;
|
|
2204
2345
|
break;
|
|
2205
2346
|
}
|
|
2206
2347
|
|
|
2207
|
-
return
|
|
2348
|
+
return _context14.abrupt("return");
|
|
2208
2349
|
|
|
2209
2350
|
case 2:
|
|
2210
2351
|
dispatch({
|
|
@@ -2225,16 +2366,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2225
2366
|
retailerId: retailerId
|
|
2226
2367
|
};
|
|
2227
2368
|
activeTab = state.active_tab;
|
|
2228
|
-
|
|
2369
|
+
_context14.prev = 11;
|
|
2229
2370
|
|
|
2230
2371
|
if (!result) {
|
|
2231
|
-
|
|
2372
|
+
_context14.next = 28;
|
|
2232
2373
|
break;
|
|
2233
2374
|
}
|
|
2234
2375
|
|
|
2235
2376
|
data.result = result;
|
|
2236
2377
|
data.retailerId = retailerId;
|
|
2237
|
-
|
|
2378
|
+
_context14.next = 17;
|
|
2238
2379
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
2239
2380
|
headers: {
|
|
2240
2381
|
Authorization: token
|
|
@@ -2242,7 +2383,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2242
2383
|
});
|
|
2243
2384
|
|
|
2244
2385
|
case 17:
|
|
2245
|
-
res =
|
|
2386
|
+
res = _context14.sent;
|
|
2246
2387
|
newStatuses = JSON.parse(res.data.body);
|
|
2247
2388
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
2248
2389
|
articleStatus = newStatuses.newArticleStatus[articleId];
|
|
@@ -2273,7 +2414,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2273
2414
|
image: _genericModalCheck.default
|
|
2274
2415
|
}
|
|
2275
2416
|
});
|
|
2276
|
-
|
|
2417
|
+
_context14.next = 33;
|
|
2277
2418
|
break;
|
|
2278
2419
|
|
|
2279
2420
|
case 28:
|
|
@@ -2289,7 +2430,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2289
2430
|
icon = _genericModalCheck.default;
|
|
2290
2431
|
}
|
|
2291
2432
|
|
|
2292
|
-
|
|
2433
|
+
_context14.next = 32;
|
|
2293
2434
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
2294
2435
|
headers: {
|
|
2295
2436
|
Authorization: token
|
|
@@ -2297,7 +2438,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2297
2438
|
});
|
|
2298
2439
|
|
|
2299
2440
|
case 32:
|
|
2300
|
-
res =
|
|
2441
|
+
res = _context14.sent;
|
|
2301
2442
|
|
|
2302
2443
|
case 33:
|
|
2303
2444
|
if (res.data.statusCode === 200) {
|
|
@@ -2382,13 +2523,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2382
2523
|
});
|
|
2383
2524
|
}
|
|
2384
2525
|
|
|
2385
|
-
|
|
2526
|
+
_context14.next = 40;
|
|
2386
2527
|
break;
|
|
2387
2528
|
|
|
2388
2529
|
case 36:
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
console.error("Error sending evaluation:",
|
|
2530
|
+
_context14.prev = 36;
|
|
2531
|
+
_context14.t0 = _context14["catch"](11);
|
|
2532
|
+
console.error("Error sending evaluation:", _context14.t0);
|
|
2392
2533
|
dispatch({
|
|
2393
2534
|
type: "SET_MODAL",
|
|
2394
2535
|
payload: {
|
|
@@ -2400,45 +2541,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2400
2541
|
});
|
|
2401
2542
|
|
|
2402
2543
|
case 40:
|
|
2403
|
-
|
|
2544
|
+
_context14.prev = 40;
|
|
2404
2545
|
dispatch({
|
|
2405
2546
|
type: "SET_SAVING",
|
|
2406
2547
|
payload: false
|
|
2407
2548
|
});
|
|
2408
|
-
return
|
|
2549
|
+
return _context14.finish(40);
|
|
2409
2550
|
|
|
2410
2551
|
case 43:
|
|
2411
2552
|
case "end":
|
|
2412
|
-
return
|
|
2553
|
+
return _context14.stop();
|
|
2413
2554
|
}
|
|
2414
2555
|
}
|
|
2415
|
-
},
|
|
2556
|
+
}, _callee14, null, [[11, 36, 40, 43]]);
|
|
2416
2557
|
}));
|
|
2417
2558
|
|
|
2418
|
-
return function sendSingleEvaluation(
|
|
2419
|
-
return
|
|
2559
|
+
return function sendSingleEvaluation(_x4) {
|
|
2560
|
+
return _ref19.apply(this, arguments);
|
|
2420
2561
|
};
|
|
2421
2562
|
}();
|
|
2422
2563
|
|
|
2423
2564
|
var handleOnApproveAllServices = /*#__PURE__*/function () {
|
|
2424
|
-
var
|
|
2425
|
-
return _regenerator.default.wrap(function
|
|
2565
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
2566
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
2426
2567
|
while (1) {
|
|
2427
|
-
switch (
|
|
2568
|
+
switch (_context15.prev = _context15.next) {
|
|
2428
2569
|
case 0:
|
|
2429
|
-
|
|
2570
|
+
_context15.next = 2;
|
|
2430
2571
|
return sendBulkEvaluation("A");
|
|
2431
2572
|
|
|
2432
2573
|
case 2:
|
|
2433
2574
|
case "end":
|
|
2434
|
-
return
|
|
2575
|
+
return _context15.stop();
|
|
2435
2576
|
}
|
|
2436
2577
|
}
|
|
2437
|
-
},
|
|
2578
|
+
}, _callee15);
|
|
2438
2579
|
}));
|
|
2439
2580
|
|
|
2440
2581
|
return function handleOnApproveAllServices() {
|
|
2441
|
-
return
|
|
2582
|
+
return _ref20.apply(this, arguments);
|
|
2442
2583
|
};
|
|
2443
2584
|
}();
|
|
2444
2585
|
|
|
@@ -2448,18 +2589,18 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2448
2589
|
};
|
|
2449
2590
|
|
|
2450
2591
|
var sendBulkEvaluation = /*#__PURE__*/function () {
|
|
2451
|
-
var
|
|
2592
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(result) {
|
|
2452
2593
|
var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
2453
2594
|
|
|
2454
|
-
return _regenerator.default.wrap(function
|
|
2595
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
2455
2596
|
while (1) {
|
|
2456
|
-
switch (
|
|
2597
|
+
switch (_context16.prev = _context16.next) {
|
|
2457
2598
|
case 0:
|
|
2458
2599
|
dispatch({
|
|
2459
2600
|
type: "SET_SAVING",
|
|
2460
2601
|
payload: true
|
|
2461
2602
|
});
|
|
2462
|
-
|
|
2603
|
+
_context16.prev = 1;
|
|
2463
2604
|
evaluationArray = [];
|
|
2464
2605
|
conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
|
|
2465
2606
|
(_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
|
|
@@ -2484,10 +2625,27 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2484
2625
|
}));
|
|
2485
2626
|
}
|
|
2486
2627
|
});
|
|
2487
|
-
|
|
2628
|
+
_context16.next = 7;
|
|
2488
2629
|
return Promise.all(evaluationArray);
|
|
2489
2630
|
|
|
2490
2631
|
case 7:
|
|
2632
|
+
if (!(evaluationArray.length === 0)) {
|
|
2633
|
+
_context16.next = 10;
|
|
2634
|
+
break;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
dispatch({
|
|
2638
|
+
type: "SET_MODAL",
|
|
2639
|
+
payload: {
|
|
2640
|
+
show: true,
|
|
2641
|
+
title: "Error",
|
|
2642
|
+
message: "No hay servicios que puedas evaluar en el estatus actual.",
|
|
2643
|
+
image: _errorModal.default
|
|
2644
|
+
}
|
|
2645
|
+
});
|
|
2646
|
+
return _context16.abrupt("return");
|
|
2647
|
+
|
|
2648
|
+
case 10:
|
|
2491
2649
|
status = "".concat(result, "A"); // Actualizar el statusByRetailer para todos los retailers y conceptos
|
|
2492
2650
|
|
|
2493
2651
|
updatedStatusByRetailer = state.product.statusByRetailer.map(function (item) {
|
|
@@ -2539,41 +2697,41 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2539
2697
|
image: _genericModalCheck.default
|
|
2540
2698
|
}
|
|
2541
2699
|
});
|
|
2542
|
-
|
|
2700
|
+
_context16.next = 22;
|
|
2543
2701
|
break;
|
|
2544
2702
|
|
|
2545
|
-
case 16:
|
|
2546
|
-
_context15.prev = 16;
|
|
2547
|
-
_context15.t0 = _context15["catch"](1);
|
|
2548
|
-
console.error("Error in bulk evaluation:", _context15.t0);
|
|
2549
|
-
|
|
2550
2703
|
case 19:
|
|
2551
|
-
|
|
2704
|
+
_context16.prev = 19;
|
|
2705
|
+
_context16.t0 = _context16["catch"](1);
|
|
2706
|
+
console.error("Error in bulk evaluation:", _context16.t0);
|
|
2707
|
+
|
|
2708
|
+
case 22:
|
|
2709
|
+
_context16.prev = 22;
|
|
2552
2710
|
dispatch({
|
|
2553
2711
|
type: "SET_SAVING",
|
|
2554
2712
|
payload: false
|
|
2555
2713
|
});
|
|
2556
|
-
return
|
|
2714
|
+
return _context16.finish(22);
|
|
2557
2715
|
|
|
2558
|
-
case
|
|
2716
|
+
case 25:
|
|
2559
2717
|
case "end":
|
|
2560
|
-
return
|
|
2718
|
+
return _context16.stop();
|
|
2561
2719
|
}
|
|
2562
2720
|
}
|
|
2563
|
-
},
|
|
2721
|
+
}, _callee16, null, [[1, 19, 22, 25]]);
|
|
2564
2722
|
}));
|
|
2565
2723
|
|
|
2566
|
-
return function sendBulkEvaluation(
|
|
2567
|
-
return
|
|
2724
|
+
return function sendBulkEvaluation(_x5) {
|
|
2725
|
+
return _ref21.apply(this, arguments);
|
|
2568
2726
|
};
|
|
2569
2727
|
}();
|
|
2570
2728
|
|
|
2571
2729
|
var handleOnChangeAssignations = /*#__PURE__*/function () {
|
|
2572
|
-
var
|
|
2730
|
+
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
|
|
2573
2731
|
var concept, data, updatedProduct;
|
|
2574
|
-
return _regenerator.default.wrap(function
|
|
2732
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
2575
2733
|
while (1) {
|
|
2576
|
-
switch (
|
|
2734
|
+
switch (_context17.prev = _context17.next) {
|
|
2577
2735
|
case 0:
|
|
2578
2736
|
concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
2579
2737
|
data = {
|
|
@@ -2584,7 +2742,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2584
2742
|
concept: concept,
|
|
2585
2743
|
userId: assignationId
|
|
2586
2744
|
};
|
|
2587
|
-
|
|
2745
|
+
_context17.next = 4;
|
|
2588
2746
|
return (0, _axios.default)({
|
|
2589
2747
|
method: "post",
|
|
2590
2748
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -2603,14 +2761,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2603
2761
|
|
|
2604
2762
|
case 6:
|
|
2605
2763
|
case "end":
|
|
2606
|
-
return
|
|
2764
|
+
return _context17.stop();
|
|
2607
2765
|
}
|
|
2608
2766
|
}
|
|
2609
|
-
},
|
|
2767
|
+
}, _callee17);
|
|
2610
2768
|
}));
|
|
2611
2769
|
|
|
2612
|
-
return function handleOnChangeAssignations(
|
|
2613
|
-
return
|
|
2770
|
+
return function handleOnChangeAssignations(_x6, _x7) {
|
|
2771
|
+
return _ref22.apply(this, arguments);
|
|
2614
2772
|
};
|
|
2615
2773
|
}();
|
|
2616
2774
|
|
|
@@ -2645,16 +2803,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2645
2803
|
};
|
|
2646
2804
|
|
|
2647
2805
|
var handleOnSubmitComment = /*#__PURE__*/function () {
|
|
2648
|
-
var
|
|
2806
|
+
var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(e) {
|
|
2649
2807
|
var commentText;
|
|
2650
|
-
return _regenerator.default.wrap(function
|
|
2808
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
2651
2809
|
while (1) {
|
|
2652
|
-
switch (
|
|
2810
|
+
switch (_context18.prev = _context18.next) {
|
|
2653
2811
|
case 0:
|
|
2654
2812
|
e.preventDefault();
|
|
2655
2813
|
commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
|
|
2656
|
-
|
|
2657
|
-
|
|
2814
|
+
_context18.prev = 2;
|
|
2815
|
+
_context18.next = 5;
|
|
2658
2816
|
return createComment(commentText, token);
|
|
2659
2817
|
|
|
2660
2818
|
case 5:
|
|
@@ -2667,13 +2825,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2667
2825
|
image: _genericModalCheck.default
|
|
2668
2826
|
}
|
|
2669
2827
|
});
|
|
2670
|
-
|
|
2828
|
+
_context18.next = 12;
|
|
2671
2829
|
break;
|
|
2672
2830
|
|
|
2673
2831
|
case 8:
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
console.error("Error saving comment:",
|
|
2832
|
+
_context18.prev = 8;
|
|
2833
|
+
_context18.t0 = _context18["catch"](2);
|
|
2834
|
+
console.error("Error saving comment:", _context18.t0);
|
|
2677
2835
|
dispatch({
|
|
2678
2836
|
type: "SET_MODAL",
|
|
2679
2837
|
payload: {
|
|
@@ -2686,14 +2844,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2686
2844
|
|
|
2687
2845
|
case 12:
|
|
2688
2846
|
case "end":
|
|
2689
|
-
return
|
|
2847
|
+
return _context18.stop();
|
|
2690
2848
|
}
|
|
2691
2849
|
}
|
|
2692
|
-
},
|
|
2850
|
+
}, _callee18, null, [[2, 8]]);
|
|
2693
2851
|
}));
|
|
2694
2852
|
|
|
2695
|
-
return function handleOnSubmitComment(
|
|
2696
|
-
return
|
|
2853
|
+
return function handleOnSubmitComment(_x8) {
|
|
2854
|
+
return _ref23.apply(this, arguments);
|
|
2697
2855
|
};
|
|
2698
2856
|
}();
|
|
2699
2857
|
|
|
@@ -3005,7 +3163,19 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3005
3163
|
})]
|
|
3006
3164
|
})
|
|
3007
3165
|
});
|
|
3008
|
-
|
|
3166
|
+
/*
|
|
3167
|
+
`images_values` entra al guard junto a `services` y `product`.
|
|
3168
|
+
React 17 no agrupa los dispatch que van después de un `await`: cada uno
|
|
3169
|
+
re-renderiza al instante. En `loadData` el orden es SET_SERVICES →
|
|
3170
|
+
…_INPUTS → SET_IMAGES_VALUES, así que había renders intermedios con
|
|
3171
|
+
`services` ya puesto —el guard los dejaba pasar— y el resto todavía en null.
|
|
3172
|
+
El cuerpo de abajo lee `datasheets_inputs[1]`, `descriptions_inputs[0]` y
|
|
3173
|
+
`images_values.values` sin protección, y tumbaba la pantalla entera.
|
|
3174
|
+
Se comprueba `images_values` y no cada uno: es el ÚLTIMO que `loadData`
|
|
3175
|
+
despacha, así que si ya está, los anteriores también.
|
|
3176
|
+
*/
|
|
3177
|
+
|
|
3178
|
+
if (state.loading || !state.services || !state.product || !state.images_values) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
3009
3179
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ProductEditionSkeleton, {})
|
|
3010
3180
|
});
|
|
3011
3181
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AiProductEdition.AiProductEditionProvider, {
|
|
@@ -3057,9 +3227,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3057
3227
|
}
|
|
3058
3228
|
}
|
|
3059
3229
|
}), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
|
|
3060
|
-
articleId: (_state$
|
|
3061
|
-
articleName: (_state$
|
|
3062
|
-
articleUpc: (_state$
|
|
3230
|
+
articleId: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.id_article,
|
|
3231
|
+
articleName: (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.name,
|
|
3232
|
+
articleUpc: (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.upc,
|
|
3063
3233
|
activeRetailerId: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.id_retailer,
|
|
3064
3234
|
token: token,
|
|
3065
3235
|
onClose: function onClose() {
|
|
@@ -3067,9 +3237,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3067
3237
|
},
|
|
3068
3238
|
onLinked: handleOnLinkedVariants
|
|
3069
3239
|
}), showGroupModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VariantGroupModal.VariantGroupModal, {
|
|
3070
|
-
articleId: (_state$
|
|
3071
|
-
articleName: (_state$
|
|
3072
|
-
articleUpc: (_state$
|
|
3240
|
+
articleId: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.id_article,
|
|
3241
|
+
articleName: (_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.name,
|
|
3242
|
+
articleUpc: (_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.upc,
|
|
3073
3243
|
currentGroup: (_variantGroup$group2 = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) !== null && _variantGroup$group2 !== void 0 ? _variantGroup$group2 : null,
|
|
3074
3244
|
token: token,
|
|
3075
3245
|
onClose: function onClose() {
|
|
@@ -3105,21 +3275,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3105
3275
|
type: "pink",
|
|
3106
3276
|
label: "Aceptar",
|
|
3107
3277
|
size: 12,
|
|
3108
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
3278
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
3109
3279
|
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
3110
|
-
return _regenerator.default.wrap(function
|
|
3280
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
3111
3281
|
while (1) {
|
|
3112
|
-
switch (
|
|
3282
|
+
switch (_context19.prev = _context19.next) {
|
|
3113
3283
|
case 0:
|
|
3114
3284
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
3115
3285
|
|
|
3116
3286
|
if (!(!elements || elements.length === 0)) {
|
|
3117
|
-
|
|
3287
|
+
_context19.next = 4;
|
|
3118
3288
|
break;
|
|
3119
3289
|
}
|
|
3120
3290
|
|
|
3121
3291
|
console.error("Elemento no encontrado");
|
|
3122
|
-
return
|
|
3292
|
+
return _context19.abrupt("return");
|
|
3123
3293
|
|
|
3124
3294
|
case 4:
|
|
3125
3295
|
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
@@ -3128,7 +3298,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3128
3298
|
});
|
|
3129
3299
|
|
|
3130
3300
|
if (!isMessageEmpty) {
|
|
3131
|
-
|
|
3301
|
+
_context19.next = 10;
|
|
3132
3302
|
break;
|
|
3133
3303
|
}
|
|
3134
3304
|
|
|
@@ -3143,13 +3313,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3143
3313
|
container.appendChild(alert);
|
|
3144
3314
|
}
|
|
3145
3315
|
|
|
3146
|
-
return
|
|
3316
|
+
return _context19.abrupt("return");
|
|
3147
3317
|
|
|
3148
3318
|
case 10:
|
|
3149
3319
|
fullMessage = Array.from(elements).map(function (element) {
|
|
3150
3320
|
return element.innerHTML;
|
|
3151
3321
|
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
3152
|
-
|
|
3322
|
+
_context19.next = 13;
|
|
3153
3323
|
return createComment(fullMessage, token);
|
|
3154
3324
|
|
|
3155
3325
|
case 13:
|
|
@@ -3158,10 +3328,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3158
3328
|
|
|
3159
3329
|
case 15:
|
|
3160
3330
|
case "end":
|
|
3161
|
-
return
|
|
3331
|
+
return _context19.stop();
|
|
3162
3332
|
}
|
|
3163
3333
|
}
|
|
3164
|
-
},
|
|
3334
|
+
}, _callee19);
|
|
3165
3335
|
}))
|
|
3166
3336
|
}, "btn-Aceptar")]
|
|
3167
3337
|
}), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
@@ -3229,17 +3399,27 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3229
3399
|
className: "data-container",
|
|
3230
3400
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3231
3401
|
className: "image-data-panel",
|
|
3232
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer
|
|
3233
|
-
|
|
3402
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer
|
|
3403
|
+
/*
|
|
3404
|
+
`images_values` puede ser null en pleno render.
|
|
3405
|
+
React 17 no agrupa los dispatch que van después de un `await`:
|
|
3406
|
+
cada uno re-renderiza al instante. En `loadData`, `SET_SERVICES`
|
|
3407
|
+
se despacha antes que `SET_IMAGES_VALUES`, así que hay un render
|
|
3408
|
+
en el que `services` ya existe —y por eso el guard de arriba deja
|
|
3409
|
+
pasar— pero las imágenes todavía no. Sin las interrogaciones,
|
|
3410
|
+
ese render intermedio tumba la pantalla entera.
|
|
3411
|
+
*/
|
|
3412
|
+
, {
|
|
3413
|
+
activeImage: (_state$images_values$2 = (_state$images_values10 = state.images_values) === null || _state$images_values10 === void 0 ? void 0 : (_state$images_values11 = _state$images_values10.values) === null || _state$images_values11 === void 0 ? void 0 : _state$images_values11[state.current_image]) !== null && _state$images_values$2 !== void 0 ? _state$images_values$2 : {},
|
|
3234
3414
|
imagesArray: state.images_values || [],
|
|
3235
3415
|
setActiveImage: handleOnChangeCurrentImage,
|
|
3236
3416
|
setShowModal: handleOnShowModalGallery
|
|
3237
3417
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable // states
|
|
3238
3418
|
, {
|
|
3239
3419
|
lists: state.images_values || [],
|
|
3240
|
-
activeImage: (_state$
|
|
3420
|
+
activeImage: (_state$images_values12 = state.images_values) !== null && _state$images_values12 !== void 0 && _state$images_values12.values ? (_state$images_values13 = state.images_values) === null || _state$images_values13 === void 0 ? void 0 : _state$images_values13.values[state.current_image] : {},
|
|
3241
3421
|
assignationsImages: state.collaborator_assignations["Imágenes"],
|
|
3242
|
-
imagesStatus: ((_state$
|
|
3422
|
+
imagesStatus: ((_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.images_status) || "-",
|
|
3243
3423
|
retailerSelected: (_state$active_retaile10 = state.active_retailer) === null || _state$active_retaile10 === void 0 ? void 0 : _state$active_retaile10.id_retailer,
|
|
3244
3424
|
isRetailer: isRetailer,
|
|
3245
3425
|
version: state.product.version,
|
|
@@ -3327,13 +3507,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3327
3507
|
className: "desvincular",
|
|
3328
3508
|
title: "Dejar de ser hijo de este producto",
|
|
3329
3509
|
onClick: function onClick() {
|
|
3330
|
-
var _state$
|
|
3510
|
+
var _state$product27, _state$product28, _state$product29;
|
|
3331
3511
|
|
|
3332
3512
|
return setPorDesvincular({
|
|
3333
3513
|
mode: "self",
|
|
3334
|
-
childArticleId: (_state$
|
|
3335
|
-
childName: (_state$
|
|
3336
|
-
childUpc: (_state$
|
|
3514
|
+
childArticleId: (_state$product27 = state.product) === null || _state$product27 === void 0 ? void 0 : _state$product27.id_article,
|
|
3515
|
+
childName: (_state$product28 = state.product) === null || _state$product28 === void 0 ? void 0 : _state$product28.name,
|
|
3516
|
+
childUpc: (_state$product29 = state.product) === null || _state$product29 === void 0 ? void 0 : _state$product29.upc,
|
|
3337
3517
|
parentName: family.parent.name,
|
|
3338
3518
|
parentUpc: family.parent.upc
|
|
3339
3519
|
});
|
|
@@ -3365,15 +3545,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3365
3545
|
className: "desvincular",
|
|
3366
3546
|
title: "Desvincular este hijo",
|
|
3367
3547
|
onClick: function onClick() {
|
|
3368
|
-
var _state$
|
|
3548
|
+
var _state$product30, _state$product31;
|
|
3369
3549
|
|
|
3370
3550
|
return setPorDesvincular({
|
|
3371
3551
|
mode: "child",
|
|
3372
3552
|
childArticleId: variant.articleId,
|
|
3373
3553
|
childName: variant.name,
|
|
3374
3554
|
childUpc: variant.upc,
|
|
3375
|
-
parentName: (_state$
|
|
3376
|
-
parentUpc: (_state$
|
|
3555
|
+
parentName: (_state$product30 = state.product) === null || _state$product30 === void 0 ? void 0 : _state$product30.name,
|
|
3556
|
+
parentUpc: (_state$product31 = state.product) === null || _state$product31 === void 0 ? void 0 : _state$product31.upc
|
|
3377
3557
|
});
|
|
3378
3558
|
},
|
|
3379
3559
|
children: "Desvincular"
|
|
@@ -3494,8 +3674,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3494
3674
|
,
|
|
3495
3675
|
setShowVersionSelector: setShowVersionSelector // setSelectedImages={setSelectedImages} prop pasada asi: FullTabsMenu -> TabsMenu Pero en TabsMenu no se espera ninguna prop setSelectedImages
|
|
3496
3676
|
// actions
|
|
3677
|
+
// El botón actúa sobre la bandeja visible: en activos descargaba
|
|
3678
|
+
// las imágenes del producto, que no es lo que el usuario pidió.
|
|
3497
3679
|
,
|
|
3498
|
-
downloadImages: handleOnDownloadImages,
|
|
3680
|
+
downloadImages: currentTray === _GalleryTrayTabs.TRAYS.ASSETS ? handleOnDownloadAssets : handleOnDownloadImages,
|
|
3499
3681
|
askToDeleteImages: handleOnAskToDeleteImages,
|
|
3500
3682
|
showSaveButton: isAuditorAssigned() || isUserAssignedToService(),
|
|
3501
3683
|
onClickSave: handleOnClickSave // validations
|
|
@@ -3505,7 +3687,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3505
3687
|
className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
|
|
3506
3688
|
id: "services-information-container",
|
|
3507
3689
|
children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
3508
|
-
children: [state.active_tab === "Descripción" && (((_state$
|
|
3690
|
+
children: [state.active_tab === "Descripción" && (((_state$product32 = state.product) === null || _state$product32 === void 0 ? void 0 : _state$product32.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
3509
3691
|
activeSection: state.active_tab,
|
|
3510
3692
|
inputGroup: state.descriptions_inputs[0],
|
|
3511
3693
|
updatedDescriptions: state.updated_descriptions_inputs
|
|
@@ -3514,7 +3696,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3514
3696
|
,
|
|
3515
3697
|
variant: (_state$services3 = state.services) === null || _state$services3 === void 0 ? void 0 : (_state$services3$data = _state$services3.datasheets) === null || _state$services3$data === void 0 ? void 0 : _state$services3$data.variant,
|
|
3516
3698
|
onRestoreInheritance: handleOnRestoreInheritance,
|
|
3517
|
-
articleId: (_state$
|
|
3699
|
+
articleId: (_state$product33 = state.product) === null || _state$product33 === void 0 ? void 0 : _state$product33.id_article,
|
|
3518
3700
|
version: state.product.version,
|
|
3519
3701
|
auditInputGroup: auditDescriptions[0],
|
|
3520
3702
|
setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
|
|
@@ -3523,7 +3705,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3523
3705
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
3524
3706
|
text: "No cuentas con este servicio",
|
|
3525
3707
|
headerType: "input-name-header"
|
|
3526
|
-
})), state.active_tab === "Ficha técnica" && (((_state$
|
|
3708
|
+
})), state.active_tab === "Ficha técnica" && (((_state$product34 = state.product) === null || _state$product34 === void 0 ? void 0 : _state$product34.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
3527
3709
|
children: (_state$datasheets_inp = state.datasheets_inputs[0]) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp.data) === null || _state$datasheets_inp2 === void 0 ? void 0 : _state$datasheets_inp2.map(function (dataGroup, index) {
|
|
3528
3710
|
var _state$services4, _state$services4$data;
|
|
3529
3711
|
|
|
@@ -3544,15 +3726,33 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3544
3726
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
3545
3727
|
text: "No cuentas con este servicio",
|
|
3546
3728
|
headerType: "input-name-header"
|
|
3547
|
-
})), state.active_tab === "Imágenes" && (((_state$
|
|
3548
|
-
children: [
|
|
3729
|
+
})), state.active_tab === "Imágenes" && (((_state$product35 = state.product) === null || _state$product35 === void 0 ? void 0 : _state$product35.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
3730
|
+
children: [enableDigitalAssets && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryTrayTabs.GalleryTrayTabs, {
|
|
3731
|
+
activeTray: currentTray,
|
|
3732
|
+
setActiveTray: setActiveTray,
|
|
3733
|
+
imagesCount: (_state$images_values$3 = (_state$images_values14 = state.images_values) === null || _state$images_values14 === void 0 ? void 0 : (_state$images_values15 = _state$images_values14.values) === null || _state$images_values15 === void 0 ? void 0 : _state$images_values15.length) !== null && _state$images_values$3 !== void 0 ? _state$images_values$3 : 0,
|
|
3734
|
+
assetsCount: digitalAssets.assets.length
|
|
3735
|
+
}), currentTray === _GalleryTrayTabs.TRAYS.ASSETS && /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
|
|
3736
|
+
className: "container",
|
|
3737
|
+
style: {
|
|
3738
|
+
position: "relative"
|
|
3739
|
+
},
|
|
3740
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DigitalAssetsTray.DigitalAssetsTray, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, digitalAssets), {}, {
|
|
3741
|
+
unsaved: (0, _assets.countUnsavedAssets)(state),
|
|
3742
|
+
gridLayout: imageLayout,
|
|
3743
|
+
readOnly: !isAuditorAssigned() && !isUserAssignedToService(),
|
|
3744
|
+
selectedAssets: state.selected_assets,
|
|
3745
|
+
setSelectedAssets: handleOnSetSelectedAssets,
|
|
3746
|
+
setCheckAll: handleOnSetAllAssetsChecked
|
|
3747
|
+
}))
|
|
3748
|
+
}), currentTray === _GalleryTrayTabs.TRAYS.IMAGES && !imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
3549
3749
|
checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
|
|
3550
3750
|
,
|
|
3551
3751
|
setCheckAll: handleOnSetCheckAll // Toggler de true o false para el checkbox "Seleccionar todo"
|
|
3552
3752
|
,
|
|
3553
3753
|
setSelectedImages: handleOnSetSelectedImages // shotThd={shotThd} // No se usa?
|
|
3554
3754
|
|
|
3555
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
3755
|
+
}), currentTray === _GalleryTrayTabs.TRAYS.IMAGES && /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
3556
3756
|
className: "container",
|
|
3557
3757
|
style: {
|
|
3558
3758
|
position: "relative"
|
|
@@ -3568,7 +3768,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3568
3768
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
3569
3769
|
children: thumbs()
|
|
3570
3770
|
})]
|
|
3571
|
-
})), ((_state$
|
|
3771
|
+
})), ((_state$images_values16 = state.images_values) === null || _state$images_values16 === void 0 ? void 0 : (_state$images_values17 = _state$images_values16.values) === null || _state$images_values17 === void 0 ? void 0 : _state$images_values17.length) === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3572
3772
|
style: {
|
|
3573
3773
|
position: "absolute",
|
|
3574
3774
|
top: "50%",
|
|
@@ -3636,20 +3836,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3636
3836
|
reviewed: crossComment
|
|
3637
3837
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
3638
3838
|
buttonType: "circular-button accept-button",
|
|
3639
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
3640
|
-
return _regenerator.default.wrap(function
|
|
3839
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
3840
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
3641
3841
|
while (1) {
|
|
3642
|
-
switch (
|
|
3842
|
+
switch (_context20.prev = _context20.next) {
|
|
3643
3843
|
case 0:
|
|
3644
3844
|
setCrossComment(true);
|
|
3645
3845
|
commentRevised();
|
|
3646
3846
|
|
|
3647
3847
|
case 2:
|
|
3648
3848
|
case "end":
|
|
3649
|
-
return
|
|
3849
|
+
return _context20.stop();
|
|
3650
3850
|
}
|
|
3651
3851
|
}
|
|
3652
|
-
},
|
|
3852
|
+
}, _callee20);
|
|
3653
3853
|
}))
|
|
3654
3854
|
})]
|
|
3655
3855
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|