contentoh-components-library 21.6.50 → 21.6.51
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/.env.test +0 -1
- package/dist/components/atoms/IconFile/index.js +2 -85
- package/dist/components/atoms/IconFile/styles.js +1 -1
- package/dist/components/atoms/ProductImage/ProductImage.stories.js +2 -70
- package/dist/components/atoms/ProductImage/index.js +27 -100
- package/dist/components/atoms/ProductImage/styles.js +1 -3
- package/dist/components/molecules/EditionActiveImage/index.js +2 -4
- package/dist/components/molecules/GalleryElement/index.js +4 -13
- package/dist/components/molecules/GalleryHeader/index.js +24 -96
- package/dist/components/molecules/GalleryHeader/styles.js +1 -4
- package/dist/components/molecules/ImageSelector/index.js +0 -1
- package/dist/components/organisms/ImagePreviewer/index.js +0 -1
- package/dist/components/organisms/ProductImageModal/index.js +2 -3
- package/dist/components/pages/ProviderProductEdition/index.js +78 -53
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +15 -330
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +2 -12
- package/dist/components/pages/RetailerProductEdition/index.js +445 -603
- package/dist/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +0 -1
- package/dist/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +145 -45
- package/dist/global-files/data.js +3 -16
- package/dist/index.js +90 -142
- package/package.json +1 -1
- package/src/components/atoms/IconFile/index.js +1 -28
- package/src/components/atoms/IconFile/styles.js +0 -8
- package/src/components/atoms/ProductImage/ProductImage.stories.js +0 -38
- package/src/components/atoms/ProductImage/index.js +20 -95
- package/src/components/atoms/ProductImage/styles.js +7 -92
- package/src/components/molecules/EditionActiveImage/index.js +2 -2
- package/src/components/molecules/GalleryElement/index.js +0 -9
- package/src/components/molecules/GalleryHeader/index.js +13 -65
- package/src/components/molecules/GalleryHeader/styles.js +1 -2
- package/src/components/molecules/ImageSelector/index.js +0 -1
- package/src/components/organisms/ImagePreviewer/index.js +0 -1
- package/src/components/organisms/ProductImageModal/index.js +0 -1
- package/src/components/pages/ProviderProductEdition/index.js +36 -3
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +0 -201
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +0 -12
- package/src/components/pages/RetailerProductEdition/index.js +179 -360
- package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +0 -1
- package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +104 -51
- package/src/global-files/data.js +2 -17
- package/src/index.js +0 -4
- package/.claude/launch.json +0 -14
- package/dist/ai/prompts/attribute.prompt.js +0 -28
- package/dist/ai/prompts/description.prompt.js +0 -33
- package/dist/ai/schemas/attribute.schema.js +0 -35
- package/dist/ai/schemas/description.schema.js +0 -27
- package/dist/components/atoms/AssetPreview/AssetPreview.stories.js +0 -118
- package/dist/components/atoms/AssetPreview/index.js +0 -150
- package/dist/components/atoms/AssetPreview/styles.js +0 -28
- package/dist/components/molecules/GalleryAssetElement/GalleryAssetElement.stories.js +0 -147
- package/dist/components/molecules/GalleryAssetElement/index.js +0 -178
- package/dist/components/molecules/GalleryAssetElement/styles.js +0 -26
- package/dist/components/molecules/GalleryTrayTabs/GalleryTrayTabs.stories.js +0 -56
- package/dist/components/molecules/GalleryTrayTabs/index.js +0 -60
- package/dist/components/molecules/GalleryTrayTabs/styles.js +0 -20
- package/dist/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +0 -171
- package/dist/components/organisms/DigitalAssetsTray/index.js +0 -211
- package/dist/components/organisms/DigitalAssetsTray/styles.js +0 -22
- package/dist/global-files/digital-assets/assetTypes.js +0 -480
- package/dist/global-files/digital-assets/assets.actions.js +0 -64
- package/dist/global-files/digital-assets/assets.adapter.js +0 -304
- package/dist/global-files/digital-assets/assets.mock.js +0 -136
- package/dist/global-files/digital-assets/assets.reducer.js +0 -220
- package/dist/global-files/digital-assets/uploadAssets.js +0 -179
- package/dist/global-files/digital-assets/useDigitalAssets.js +0 -522
- package/docs/activos-digitales.md +0 -273
- package/src/components/atoms/AssetPreview/AssetPreview.stories.js +0 -78
- package/src/components/atoms/AssetPreview/index.js +0 -119
- package/src/components/atoms/AssetPreview/styles.js +0 -190
- package/src/components/molecules/GalleryAssetElement/GalleryAssetElement.stories.js +0 -102
- package/src/components/molecules/GalleryAssetElement/index.js +0 -162
- package/src/components/molecules/GalleryAssetElement/styles.js +0 -159
- package/src/components/molecules/GalleryTrayTabs/GalleryTrayTabs.stories.js +0 -32
- package/src/components/molecules/GalleryTrayTabs/index.js +0 -41
- package/src/components/molecules/GalleryTrayTabs/styles.js +0 -52
- package/src/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +0 -101
- package/src/components/organisms/DigitalAssetsTray/index.js +0 -189
- package/src/components/organisms/DigitalAssetsTray/styles.js +0 -183
- package/src/global-files/digital-assets/assetTypes.js +0 -419
- package/src/global-files/digital-assets/assets.actions.js +0 -50
- package/src/global-files/digital-assets/assets.adapter.js +0 -229
- package/src/global-files/digital-assets/assets.mock.js +0 -122
- package/src/global-files/digital-assets/assets.reducer.js +0 -197
- package/src/global-files/digital-assets/uploadAssets.js +0 -109
- package/src/global-files/digital-assets/useDigitalAssets.js +0 -329
|
@@ -17,10 +17,10 @@ var _objectSpread5 = _interopRequireDefault(require("@babel/runtime/helpers/esm/
|
|
|
17
17
|
|
|
18
18
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
19
19
|
|
|
20
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
21
|
-
|
|
22
20
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
23
21
|
|
|
22
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
23
|
+
|
|
24
24
|
var _react = require("react");
|
|
25
25
|
|
|
26
26
|
var _axios = _interopRequireDefault(require("axios"));
|
|
@@ -39,10 +39,6 @@ var _data = require("../../../global-files/data");
|
|
|
39
39
|
|
|
40
40
|
var _customHooks = require("../../../global-files/customHooks");
|
|
41
41
|
|
|
42
|
-
var _useDigitalAssets = require("../../../global-files/digital-assets/useDigitalAssets");
|
|
43
|
-
|
|
44
|
-
var _assets = require("../../../global-files/digital-assets/assets.reducer");
|
|
45
|
-
|
|
46
42
|
var _GeneralButton = require("../../atoms/GeneralButton");
|
|
47
43
|
|
|
48
44
|
var _GenericModal = require("../../atoms/GenericModal");
|
|
@@ -57,8 +53,6 @@ var _GalleryElement = require("../../molecules/GalleryElement");
|
|
|
57
53
|
|
|
58
54
|
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
59
55
|
|
|
60
|
-
var _GalleryTrayTabs = require("../../molecules/GalleryTrayTabs");
|
|
61
|
-
|
|
62
56
|
var _HeaderTop = require("../../molecules/HeaderTop");
|
|
63
57
|
|
|
64
58
|
var _index = require("../../molecules/TagAndInput/index");
|
|
@@ -69,8 +63,6 @@ var _FullTabsMenu = require("../../organisms/FullTabsMenu");
|
|
|
69
63
|
|
|
70
64
|
var _ImageDataTable = require("../../organisms/ImageDataTable");
|
|
71
65
|
|
|
72
|
-
var _DigitalAssetsTray = require("../../organisms/DigitalAssetsTray");
|
|
73
|
-
|
|
74
66
|
var _ImagePreviewer = require("../../organisms/ImagePreviewer");
|
|
75
67
|
|
|
76
68
|
var _InputGroup = require("../../organisms/InputGroup");
|
|
@@ -137,8 +129,118 @@ function obtenerDuracionVideoBase64(base64Data) {
|
|
|
137
129
|
});
|
|
138
130
|
}
|
|
139
131
|
|
|
132
|
+
function convertirVideoABase64(url) {
|
|
133
|
+
return new Promise(function (resolve, reject) {
|
|
134
|
+
var xhr = new XMLHttpRequest();
|
|
135
|
+
xhr.open("GET", url, true);
|
|
136
|
+
xhr.responseType = "blob";
|
|
137
|
+
|
|
138
|
+
xhr.onload = function () {
|
|
139
|
+
if (xhr.status === 200) {
|
|
140
|
+
var blob = xhr.response;
|
|
141
|
+
var reader = new FileReader();
|
|
142
|
+
|
|
143
|
+
reader.onloadend = function () {
|
|
144
|
+
resolve(reader.result);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
reader.readAsDataURL(blob);
|
|
148
|
+
} else {
|
|
149
|
+
reject(new Error("Error al cargar el video"));
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
xhr.onerror = function () {
|
|
154
|
+
reject(new Error("Error de red al cargar el video"));
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
xhr.send();
|
|
158
|
+
});
|
|
159
|
+
} // Para videos ya guardados, `getImage` deja en `src` una URL del
|
|
160
|
+
// redimensionador de imágenes que no sirve para mp4. Descargamos el video
|
|
161
|
+
// desde S3 (srcDB) y generamos un thumbnail JPEG para mostrarlo en la galería.
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
function regenerateVideoThumbnails(_x) {
|
|
165
|
+
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function _regenerateVideoThumbnails() {
|
|
169
|
+
_regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(values) {
|
|
170
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
171
|
+
while (1) {
|
|
172
|
+
switch (_context21.prev = _context21.next) {
|
|
173
|
+
case 0:
|
|
174
|
+
if (Array.isArray(values)) {
|
|
175
|
+
_context21.next = 2;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return _context21.abrupt("return", values);
|
|
180
|
+
|
|
181
|
+
case 2:
|
|
182
|
+
return _context21.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
|
|
183
|
+
var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(value) {
|
|
184
|
+
var base64, videoSrc, thumbnail;
|
|
185
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
186
|
+
while (1) {
|
|
187
|
+
switch (_context20.prev = _context20.next) {
|
|
188
|
+
case 0:
|
|
189
|
+
if (!((value === null || value === void 0 ? void 0 : value.ext) !== "mp4" || !(value !== null && value !== void 0 && value.srcDB))) {
|
|
190
|
+
_context20.next = 2;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return _context20.abrupt("return", value);
|
|
195
|
+
|
|
196
|
+
case 2:
|
|
197
|
+
_context20.prev = 2;
|
|
198
|
+
_context20.next = 5;
|
|
199
|
+
return convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB);
|
|
200
|
+
|
|
201
|
+
case 5:
|
|
202
|
+
base64 = _context20.sent;
|
|
203
|
+
videoSrc = "data:video/mp4;base64," + base64.split(",")[1];
|
|
204
|
+
_context20.next = 9;
|
|
205
|
+
return (0, _generateThumnail.default)(videoSrc, 2);
|
|
206
|
+
|
|
207
|
+
case 9:
|
|
208
|
+
thumbnail = _context20.sent;
|
|
209
|
+
return _context20.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
|
|
210
|
+
src: thumbnail
|
|
211
|
+
}));
|
|
212
|
+
|
|
213
|
+
case 13:
|
|
214
|
+
_context20.prev = 13;
|
|
215
|
+
_context20.t0 = _context20["catch"](2);
|
|
216
|
+
console.error("Error al generar thumbnail del video:", _context20.t0);
|
|
217
|
+
return _context20.abrupt("return", value);
|
|
218
|
+
|
|
219
|
+
case 17:
|
|
220
|
+
case "end":
|
|
221
|
+
return _context20.stop();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}, _callee20, null, [[2, 13]]);
|
|
225
|
+
}));
|
|
226
|
+
|
|
227
|
+
return function (_x10) {
|
|
228
|
+
return _ref25.apply(this, arguments);
|
|
229
|
+
};
|
|
230
|
+
}())));
|
|
231
|
+
|
|
232
|
+
case 3:
|
|
233
|
+
case "end":
|
|
234
|
+
return _context21.stop();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}, _callee21);
|
|
238
|
+
}));
|
|
239
|
+
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
240
|
+
}
|
|
241
|
+
|
|
140
242
|
var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
141
|
-
var _state$
|
|
243
|
+
var _state$product10, _family$variants, _state$product11, _state$product15, _state$errors, _family$variants2, _variantGroup$members2, _variantGroup$group, _state$product19, _state$product20, _state$product21, _state$active_retaile6, _state$product22, _state$product23, _state$product24, _variantGroup$group2, _location$state, _location$state2, _state$active_retaile7, _state$active_retaile8, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product25, _state$active_retaile9, _family$variants3, _family$variants4, _variantGroup$members3, _variantGroup$members4, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile10, _state$active_retaile11, _state$active_retaile12, _state$product31, _state$services2, _state$services2$data, _state$product32, _state$product33, _state$datasheets_inp, _state$datasheets_inp2, _state$product34, _state$images_values12, _state$comment;
|
|
142
244
|
|
|
143
245
|
var tabsSections = _ref.tabsSections,
|
|
144
246
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -146,9 +248,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
146
248
|
_ref$user = _ref.user,
|
|
147
249
|
user = _ref$user === void 0 ? {} : _ref$user,
|
|
148
250
|
token = _ref.token,
|
|
149
|
-
location = _ref.location
|
|
150
|
-
_ref$enableDigitalAss = _ref.enableDigitalAssets,
|
|
151
|
-
enableDigitalAssets = _ref$enableDigitalAss === void 0 ? false : _ref$enableDigitalAss;
|
|
251
|
+
location = _ref.location;
|
|
152
252
|
|
|
153
253
|
var _useProviderProductEd = (0, _providerProductEdition.useProviderProductEdition)(),
|
|
154
254
|
state = _useProviderProductEd.state,
|
|
@@ -157,8 +257,6 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
157
257
|
saveDescriptions = _useProviderProductEd.saveDescriptions,
|
|
158
258
|
updateImages = _useProviderProductEd.updateImages,
|
|
159
259
|
deleteImages = _useProviderProductEd.deleteImages,
|
|
160
|
-
saveAssets = _useProviderProductEd.saveAssets,
|
|
161
|
-
registerUploadedAssets = _useProviderProductEd.registerUploadedAssets,
|
|
162
260
|
handleOnDownloadImages = _useProviderProductEd.handleOnDownloadImages,
|
|
163
261
|
createComment = _useProviderProductEd.createComment;
|
|
164
262
|
|
|
@@ -425,7 +523,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
425
523
|
}, _callee, null, [[5, 18]]);
|
|
426
524
|
}));
|
|
427
525
|
|
|
428
|
-
return function (
|
|
526
|
+
return function (_x2) {
|
|
429
527
|
return _ref2.apply(this, arguments);
|
|
430
528
|
};
|
|
431
529
|
}();
|
|
@@ -448,66 +546,6 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
448
546
|
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
449
547
|
openChangeStatusModal = _useState54[0],
|
|
450
548
|
setOpenChangeStatusModal = _useState54[1];
|
|
451
|
-
/*
|
|
452
|
-
Bandeja de activos digitales. La lista vive en el reducer de la ficha
|
|
453
|
-
(`state.assets_values`), igual que las imágenes, para que el guardado del
|
|
454
|
-
contexto pueda leerla. El hook solo aporta validación y ciclo de vida.
|
|
455
|
-
Sigue vacía porque todavía no hay de dónde leerla: cuando exista el endpoint
|
|
456
|
-
se llama a `replaceAll` desde `loadData` y el resto de la pantalla no cambia.
|
|
457
|
-
*/
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
var _useState55 = (0, _react.useState)([]),
|
|
461
|
-
_useState56 = (0, _slicedToArray2.default)(_useState55, 2),
|
|
462
|
-
assetNotices = _useState56[0],
|
|
463
|
-
setAssetNotices = _useState56[1];
|
|
464
|
-
|
|
465
|
-
var digitalAssets = (0, _useDigitalAssets.useDigitalAssets)({
|
|
466
|
-
assets: state.assets_values,
|
|
467
|
-
dispatch: dispatch,
|
|
468
|
-
notices: assetNotices,
|
|
469
|
-
setNotices: setAssetNotices,
|
|
470
|
-
// Con los dos, la subida a S3 arranca sola al soltar los archivos. Sin
|
|
471
|
-
// ellos —en Storybook, por ejemplo— la bandeja funciona igual pero no sube.
|
|
472
|
-
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,
|
|
473
|
-
token: token,
|
|
474
|
-
// Al terminar la subida el activo queda registrado solo, sin esperar al
|
|
475
|
-
// botón de guardar: con la barra llena, nadie supone que falta un paso.
|
|
476
|
-
onUploaded: function onUploaded(uploaded) {
|
|
477
|
-
return registerUploadedAssets(token, uploaded);
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
var _useState57 = (0, _react.useState)(_GalleryTrayTabs.TRAYS.IMAGES),
|
|
482
|
-
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
483
|
-
activeTray = _useState58[0],
|
|
484
|
-
setActiveTray = _useState58[1];
|
|
485
|
-
|
|
486
|
-
var currentTray = enableDigitalAssets ? activeTray : _GalleryTrayTabs.TRAYS.IMAGES;
|
|
487
|
-
/*
|
|
488
|
-
De qué artículo se cargaron ya los activos.
|
|
489
|
-
`loadData` se vuelve a ejecutar cada vez que cambia la cadena activa, pero los
|
|
490
|
-
activos son generales: no dependen de la cadena ni de la versión, así que la
|
|
491
|
-
respuesta sería idéntica. Volver a cargarlos borraría los archivos que el
|
|
492
|
-
usuario acaba de soltar y todavía no guarda —sin aviso y sin forma de
|
|
493
|
-
recuperarlos—. Por eso se cargan una sola vez por artículo.
|
|
494
|
-
*/
|
|
495
|
-
|
|
496
|
-
var assetsLoadedFor = (0, _react.useRef)(null);
|
|
497
|
-
|
|
498
|
-
var handleOnSetSelectedAssets = function handleOnSetSelectedAssets(assets) {
|
|
499
|
-
return dispatch({
|
|
500
|
-
type: "SET_SELECTED_ASSETS",
|
|
501
|
-
payload: assets
|
|
502
|
-
});
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
var handleOnSetAllAssetsChecked = function handleOnSetAllAssetsChecked(isChecked) {
|
|
506
|
-
return dispatch({
|
|
507
|
-
type: "TOGGLE_CHECK_ALL_ASSETS",
|
|
508
|
-
payload: isChecked
|
|
509
|
-
});
|
|
510
|
-
};
|
|
511
549
|
|
|
512
550
|
var thumbs = function thumbs() {
|
|
513
551
|
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;
|
|
@@ -562,9 +600,6 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
562
600
|
},
|
|
563
601
|
updateApprovedInputsImages: function updateApprovedInputsImages(item) {
|
|
564
602
|
return console.log("updateApprovedInputsImages", item);
|
|
565
|
-
},
|
|
566
|
-
onSelect: function onSelect() {
|
|
567
|
-
return handleOnChangeCurrentImage(index);
|
|
568
603
|
}
|
|
569
604
|
}, index);
|
|
570
605
|
});
|
|
@@ -679,7 +714,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
679
714
|
|
|
680
715
|
var loadAuditableData = /*#__PURE__*/function () {
|
|
681
716
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
682
|
-
var _state$
|
|
717
|
+
var _state$product, _state$product2, _state$product3;
|
|
683
718
|
|
|
684
719
|
var auditServices;
|
|
685
720
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
@@ -687,7 +722,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
687
722
|
switch (_context3.prev = _context3.next) {
|
|
688
723
|
case 0:
|
|
689
724
|
_context3.next = 2;
|
|
690
|
-
return (0, _data.getRetailerServices)((_state$
|
|
725
|
+
return (0, _data.getRetailerServices)((_state$product = state.product) === null || _state$product === void 0 ? void 0 : _state$product.id_article, (_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.categoryName, parseInt((_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.id_category), auditableVersion.version, token);
|
|
691
726
|
|
|
692
727
|
case 2:
|
|
693
728
|
auditServices = _context3.sent;
|
|
@@ -731,9 +766,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
731
766
|
_services$,
|
|
732
767
|
_retailerDatasheets$d,
|
|
733
768
|
_state$active_retaile2,
|
|
734
|
-
|
|
735
|
-
_services$2,
|
|
736
|
-
_state$product5,
|
|
769
|
+
_state$product4,
|
|
737
770
|
id_article,
|
|
738
771
|
version,
|
|
739
772
|
id_order,
|
|
@@ -762,6 +795,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
762
795
|
descriptionsActiveRetailer,
|
|
763
796
|
activeRetailerId,
|
|
764
797
|
filteredValues,
|
|
798
|
+
orderedValuesWithThumbs,
|
|
799
|
+
filteredValuesWithThumbs,
|
|
765
800
|
_args4 = arguments;
|
|
766
801
|
|
|
767
802
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
@@ -779,7 +814,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
779
814
|
type: "SET_ERRORS",
|
|
780
815
|
payload: []
|
|
781
816
|
});
|
|
782
|
-
_state$
|
|
817
|
+
_state$product4 = state.product, id_article = _state$product4.id_article, version = _state$product4.version, id_order = _state$product4.id_order;
|
|
783
818
|
_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
|
|
784
819
|
|
|
785
820
|
data = [{
|
|
@@ -919,15 +954,26 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
919
954
|
return Number(input.id_retailer) === Number(activeRetailerId) && Number(input.id_image) === Number(value.image_id);
|
|
920
955
|
});
|
|
921
956
|
});
|
|
922
|
-
}); //
|
|
957
|
+
}); // Regenerar thumbnails de videos guardados para que se muestren.
|
|
958
|
+
|
|
959
|
+
_context4.next = 35;
|
|
960
|
+
return regenerateVideoThumbnails(orderedValues);
|
|
923
961
|
|
|
962
|
+
case 35:
|
|
963
|
+
orderedValuesWithThumbs = _context4.sent;
|
|
964
|
+
_context4.next = 38;
|
|
965
|
+
return regenerateVideoThumbnails(filteredValues);
|
|
966
|
+
|
|
967
|
+
case 38:
|
|
968
|
+
filteredValuesWithThumbs = _context4.sent;
|
|
969
|
+
// Dispatch consolidado
|
|
924
970
|
dispatch({
|
|
925
971
|
type: "SET_SERVICES",
|
|
926
972
|
payload: {
|
|
927
973
|
datasheets: services[0],
|
|
928
974
|
descriptions: services[1],
|
|
929
975
|
images: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
930
|
-
values:
|
|
976
|
+
values: orderedValuesWithThumbs
|
|
931
977
|
})
|
|
932
978
|
}
|
|
933
979
|
});
|
|
@@ -949,12 +995,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
949
995
|
|
|
950
996
|
dispatch({
|
|
951
997
|
type: "SET_DATASHEETS_INPUTS",
|
|
952
|
-
|
|
953
|
-
// fichas puede volver sin datos para esa cadena y categoría. Arriba ya
|
|
954
|
-
// se contemplaba; aquí no, y como este dispatch va ANTES de
|
|
955
|
-
// SET_IMAGES_VALUES, reventar aquí dejaba la ficha cargando para
|
|
956
|
-
// siempre — con las imágenes ya traídas y sin pintar.
|
|
957
|
-
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 : {}]
|
|
998
|
+
payload: [datasheetsActiveRetailer, services[0].inputs]
|
|
958
999
|
});
|
|
959
1000
|
dispatch({
|
|
960
1001
|
type: "SET_DESCRIPTIONS_INPUTS",
|
|
@@ -963,20 +1004,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
963
1004
|
dispatch({
|
|
964
1005
|
type: "SET_IMAGES_VALUES",
|
|
965
1006
|
payload: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
966
|
-
values:
|
|
1007
|
+
values: filteredValuesWithThumbs
|
|
967
1008
|
})
|
|
968
|
-
});
|
|
969
|
-
/*
|
|
970
|
-
Activos digitales. `services[2].assets` todavía no existe en la
|
|
971
|
-
respuesta del backend: hasta que exista, esto no hace nada, y el día que
|
|
972
|
-
llegue la bandeja se llena sola sin tocar nada más.
|
|
973
|
-
*/
|
|
974
|
-
|
|
975
|
-
if (Array.isArray(services[2].assets) && assetsLoadedFor.current !== id_article) {
|
|
976
|
-
assetsLoadedFor.current = id_article;
|
|
977
|
-
digitalAssets.replaceAll(services[2].assets);
|
|
978
|
-
} // Calcular campos requeridos sin valor
|
|
979
|
-
|
|
1009
|
+
}); // Calcular campos requeridos sin valor
|
|
980
1010
|
|
|
981
1011
|
dispatch({
|
|
982
1012
|
type: "SET_MISSING_REQUIRED_FIELDS",
|
|
@@ -987,11 +1017,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
987
1017
|
loadAuditableData();
|
|
988
1018
|
}
|
|
989
1019
|
|
|
990
|
-
_context4.next =
|
|
1020
|
+
_context4.next = 54;
|
|
991
1021
|
break;
|
|
992
1022
|
|
|
993
|
-
case
|
|
994
|
-
_context4.prev =
|
|
1023
|
+
case 50:
|
|
1024
|
+
_context4.prev = 50;
|
|
995
1025
|
_context4.t0 = _context4["catch"](2);
|
|
996
1026
|
console.log("Error loading data: ", _context4.t0);
|
|
997
1027
|
dispatch({
|
|
@@ -999,20 +1029,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
999
1029
|
payload: [_context4.t0.message]
|
|
1000
1030
|
});
|
|
1001
1031
|
|
|
1002
|
-
case
|
|
1003
|
-
_context4.prev =
|
|
1032
|
+
case 54:
|
|
1033
|
+
_context4.prev = 54;
|
|
1004
1034
|
dispatch({
|
|
1005
1035
|
type: "SET_LOADING",
|
|
1006
1036
|
payload: false
|
|
1007
1037
|
});
|
|
1008
|
-
return _context4.finish(
|
|
1038
|
+
return _context4.finish(54);
|
|
1009
1039
|
|
|
1010
|
-
case
|
|
1040
|
+
case 57:
|
|
1011
1041
|
case "end":
|
|
1012
1042
|
return _context4.stop();
|
|
1013
1043
|
}
|
|
1014
1044
|
}
|
|
1015
|
-
}, _callee4, null, [[2,
|
|
1045
|
+
}, _callee4, null, [[2, 50, 54, 57]]);
|
|
1016
1046
|
}));
|
|
1017
1047
|
|
|
1018
1048
|
return function loadData() {
|
|
@@ -1075,9 +1105,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1075
1105
|
};
|
|
1076
1106
|
|
|
1077
1107
|
var isAuditorAssigned = function isAuditorAssigned() {
|
|
1078
|
-
var _state$
|
|
1108
|
+
var _state$product5;
|
|
1079
1109
|
|
|
1080
|
-
return ((_state$
|
|
1110
|
+
return ((_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.id_auditor) === (user === null || user === void 0 ? void 0 : user.id_user);
|
|
1081
1111
|
};
|
|
1082
1112
|
/**
|
|
1083
1113
|
* ¿Ocupo este slot EN ESTE producto?
|
|
@@ -1090,9 +1120,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1090
1120
|
|
|
1091
1121
|
|
|
1092
1122
|
var isAssignedAs = function isAssignedAs(rol, concept) {
|
|
1093
|
-
var _state$
|
|
1123
|
+
var _state$product6;
|
|
1094
1124
|
|
|
1095
|
-
var assigned = (_state$
|
|
1125
|
+
var assigned = (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6["id_".concat(concept, "_").concat(rol)];
|
|
1096
1126
|
return !!assigned && assigned === (user === null || user === void 0 ? void 0 : user.id_user);
|
|
1097
1127
|
};
|
|
1098
1128
|
|
|
@@ -1161,42 +1191,28 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1161
1191
|
})[0]) === null || _statusByRetailer$fil === void 0 ? void 0 : _statusByRetailer$fil.status) || "-";
|
|
1162
1192
|
return currentStatus;
|
|
1163
1193
|
};
|
|
1164
|
-
/*
|
|
1165
|
-
Guarda los activos y recarga si algo se escribió.
|
|
1166
|
-
La recarga no es opcional: un activo recién creado sigue en memoria con su
|
|
1167
|
-
id temporal y sin el id de la base. Sin volver a leer, el siguiente guardado
|
|
1168
|
-
lo mandaría otra vez como nuevo y se duplicaría. Poner el ref en `null` es
|
|
1169
|
-
lo que permite que `loadData` lo vuelva a traer —normalmente los activos se
|
|
1170
|
-
cargan una sola vez por artículo—.
|
|
1171
|
-
*/
|
|
1172
|
-
|
|
1173
1194
|
|
|
1174
|
-
var
|
|
1195
|
+
var handleOnClickSaveImages = /*#__PURE__*/function () {
|
|
1175
1196
|
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1176
|
-
var
|
|
1197
|
+
var _state$product7, _state$product7$servi;
|
|
1198
|
+
|
|
1177
1199
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1178
1200
|
while (1) {
|
|
1179
1201
|
switch (_context5.prev = _context5.next) {
|
|
1180
1202
|
case 0:
|
|
1181
|
-
|
|
1182
|
-
return saveAssets(token);
|
|
1183
|
-
|
|
1184
|
-
case 2:
|
|
1185
|
-
guardado = _context5.sent;
|
|
1186
|
-
|
|
1187
|
-
if (guardado) {
|
|
1203
|
+
if (!(((_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : (_state$product7$servi = _state$product7.services) === null || _state$product7$servi === void 0 ? void 0 : _state$product7$servi.images) === 1)) {
|
|
1188
1204
|
_context5.next = 5;
|
|
1189
1205
|
break;
|
|
1190
1206
|
}
|
|
1191
1207
|
|
|
1192
|
-
|
|
1208
|
+
_context5.next = 3;
|
|
1209
|
+
return updateImages(token);
|
|
1193
1210
|
|
|
1194
|
-
case
|
|
1195
|
-
|
|
1196
|
-
_context5.next = 8;
|
|
1211
|
+
case 3:
|
|
1212
|
+
_context5.next = 5;
|
|
1197
1213
|
return loadData(false);
|
|
1198
1214
|
|
|
1199
|
-
case
|
|
1215
|
+
case 5:
|
|
1200
1216
|
case "end":
|
|
1201
1217
|
return _context5.stop();
|
|
1202
1218
|
}
|
|
@@ -1204,53 +1220,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1204
1220
|
}, _callee5);
|
|
1205
1221
|
}));
|
|
1206
1222
|
|
|
1207
|
-
return function handleOnSaveAssets() {
|
|
1208
|
-
return _ref9.apply(this, arguments);
|
|
1209
|
-
};
|
|
1210
|
-
}();
|
|
1211
|
-
|
|
1212
|
-
var handleOnClickSaveImages = /*#__PURE__*/function () {
|
|
1213
|
-
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1214
|
-
var _state$product8, _state$product8$servi;
|
|
1215
|
-
|
|
1216
|
-
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1217
|
-
while (1) {
|
|
1218
|
-
switch (_context6.prev = _context6.next) {
|
|
1219
|
-
case 0:
|
|
1220
|
-
if (!(currentTray === _GalleryTrayTabs.TRAYS.ASSETS)) {
|
|
1221
|
-
_context6.next = 4;
|
|
1222
|
-
break;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
_context6.next = 3;
|
|
1226
|
-
return handleOnSaveAssets();
|
|
1227
|
-
|
|
1228
|
-
case 3:
|
|
1229
|
-
return _context6.abrupt("return");
|
|
1230
|
-
|
|
1231
|
-
case 4:
|
|
1232
|
-
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)) {
|
|
1233
|
-
_context6.next = 9;
|
|
1234
|
-
break;
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
_context6.next = 7;
|
|
1238
|
-
return updateImages(token);
|
|
1239
|
-
|
|
1240
|
-
case 7:
|
|
1241
|
-
_context6.next = 9;
|
|
1242
|
-
return loadData(false);
|
|
1243
|
-
|
|
1244
|
-
case 9:
|
|
1245
|
-
case "end":
|
|
1246
|
-
return _context6.stop();
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
}, _callee6);
|
|
1250
|
-
}));
|
|
1251
|
-
|
|
1252
1223
|
return function handleOnClickSaveImages() {
|
|
1253
|
-
return
|
|
1224
|
+
return _ref9.apply(this, arguments);
|
|
1254
1225
|
};
|
|
1255
1226
|
}();
|
|
1256
1227
|
/*
|
|
@@ -1261,31 +1232,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1261
1232
|
|
|
1262
1233
|
|
|
1263
1234
|
var loadFamily = /*#__PURE__*/function () {
|
|
1264
|
-
var
|
|
1235
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1265
1236
|
var forzar,
|
|
1266
|
-
_state$
|
|
1237
|
+
_state$product8,
|
|
1267
1238
|
res,
|
|
1268
1239
|
data,
|
|
1269
|
-
|
|
1240
|
+
_args6 = arguments;
|
|
1270
1241
|
|
|
1271
|
-
return _regenerator.default.wrap(function
|
|
1242
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1272
1243
|
while (1) {
|
|
1273
|
-
switch (
|
|
1244
|
+
switch (_context6.prev = _context6.next) {
|
|
1274
1245
|
case 0:
|
|
1275
|
-
forzar =
|
|
1246
|
+
forzar = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : false;
|
|
1276
1247
|
|
|
1277
1248
|
if (!(family && !forzar)) {
|
|
1278
|
-
|
|
1249
|
+
_context6.next = 3;
|
|
1279
1250
|
break;
|
|
1280
1251
|
}
|
|
1281
1252
|
|
|
1282
|
-
return
|
|
1253
|
+
return _context6.abrupt("return", family);
|
|
1283
1254
|
|
|
1284
1255
|
case 3:
|
|
1285
|
-
|
|
1286
|
-
|
|
1256
|
+
_context6.prev = 3;
|
|
1257
|
+
_context6.next = 6;
|
|
1287
1258
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/family"), {
|
|
1288
|
-
articleId: (_state$
|
|
1259
|
+
articleId: (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.id_article
|
|
1289
1260
|
}, {
|
|
1290
1261
|
headers: {
|
|
1291
1262
|
Authorization: token
|
|
@@ -1293,32 +1264,32 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1293
1264
|
});
|
|
1294
1265
|
|
|
1295
1266
|
case 6:
|
|
1296
|
-
res =
|
|
1267
|
+
res = _context6.sent;
|
|
1297
1268
|
data = (0, _api.readPayload)(res);
|
|
1298
1269
|
setFamily(data);
|
|
1299
|
-
return
|
|
1270
|
+
return _context6.abrupt("return", data);
|
|
1300
1271
|
|
|
1301
1272
|
case 12:
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
console.error("loadFamily: ",
|
|
1273
|
+
_context6.prev = 12;
|
|
1274
|
+
_context6.t0 = _context6["catch"](3);
|
|
1275
|
+
console.error("loadFamily: ", _context6.t0);
|
|
1305
1276
|
setFamily({
|
|
1306
1277
|
variants: [],
|
|
1307
1278
|
parent: null,
|
|
1308
1279
|
error: true
|
|
1309
1280
|
});
|
|
1310
|
-
return
|
|
1281
|
+
return _context6.abrupt("return", null);
|
|
1311
1282
|
|
|
1312
1283
|
case 17:
|
|
1313
1284
|
case "end":
|
|
1314
|
-
return
|
|
1285
|
+
return _context6.stop();
|
|
1315
1286
|
}
|
|
1316
1287
|
}
|
|
1317
|
-
},
|
|
1288
|
+
}, _callee6, null, [[3, 12]]);
|
|
1318
1289
|
}));
|
|
1319
1290
|
|
|
1320
1291
|
return function loadFamily() {
|
|
1321
|
-
return
|
|
1292
|
+
return _ref10.apply(this, arguments);
|
|
1322
1293
|
};
|
|
1323
1294
|
}();
|
|
1324
1295
|
/*
|
|
@@ -1335,16 +1306,28 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1335
1306
|
|
|
1336
1307
|
|
|
1337
1308
|
(0, _react.useEffect)(function () {
|
|
1338
|
-
var _state$
|
|
1309
|
+
var _state$product9;
|
|
1339
1310
|
|
|
1340
|
-
if (!((_state$
|
|
1311
|
+
if (!((_state$product9 = state.product) !== null && _state$product9 !== void 0 && _state$product9.id_article)) return;
|
|
1341
1312
|
loadFamily(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1342
|
-
}, [(_state$
|
|
1313
|
+
}, [(_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.id_article]); // El conteo sale de la familia recién consultada, no del producto.
|
|
1343
1314
|
|
|
1344
1315
|
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) {
|
|
1345
1316
|
return !v.isCurrent;
|
|
1346
1317
|
}).length;
|
|
1347
|
-
var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$
|
|
1318
|
+
var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$product11 = state.product) !== null && _state$product11 !== void 0 && _state$product11.parentArticleId) : !!(family !== null && family !== void 0 && family.parent);
|
|
1319
|
+
/*
|
|
1320
|
+
Un hijo no se agrupa como variante (decisión de producto, 2026-09-25).
|
|
1321
|
+
Agrupar declara «estos son el mismo producto en otra presentación», y un
|
|
1322
|
+
hijo ya declaró de dónde deriva. El servidor lo rechaza con
|
|
1323
|
+
VARIANT_GROUP_NOT_FOR_CHILD, así que ofrecer el botón sería ofrecer algo
|
|
1324
|
+
que siempre falla.
|
|
1325
|
+
Se apoya en `esHijoDeOtro` y no en `state.product` porque en esta pantalla
|
|
1326
|
+
el producto sale de sessionStorage: la señal buena es la familia recién
|
|
1327
|
+
consultada, con el producto solo como respaldo si esa consulta falló.
|
|
1328
|
+
*/
|
|
1329
|
+
|
|
1330
|
+
var puedeAgruparse = !esHijoDeOtro;
|
|
1348
1331
|
/*
|
|
1349
1332
|
Abre otro producto de la familia.
|
|
1350
1333
|
Cambiar la URL no basta: esta pantalla no lee el producto de la ruta sino de
|
|
@@ -1374,14 +1357,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1374
1357
|
*/
|
|
1375
1358
|
|
|
1376
1359
|
var handleOnUnlinked = function handleOnUnlinked(result) {
|
|
1377
|
-
var _state$product$varian, _state$
|
|
1360
|
+
var _state$product$varian, _state$product12, _updatedProduct$varia;
|
|
1378
1361
|
|
|
1379
1362
|
if (!result) return;
|
|
1380
1363
|
var updatedProduct = result.mode === "self" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1381
1364
|
parentArticleId: null,
|
|
1382
1365
|
variantsCount: 0
|
|
1383
1366
|
}) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1384
|
-
variantsCount: Math.max(((_state$product$varian = (_state$
|
|
1367
|
+
variantsCount: Math.max(((_state$product$varian = (_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 1) - 1, 0)
|
|
1385
1368
|
});
|
|
1386
1369
|
dispatch({
|
|
1387
1370
|
type: "SET_PRODUCT",
|
|
@@ -1433,31 +1416,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1433
1416
|
|
|
1434
1417
|
|
|
1435
1418
|
var loadVariantGroup = /*#__PURE__*/function () {
|
|
1436
|
-
var
|
|
1419
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
1437
1420
|
var forzar,
|
|
1438
|
-
_state$
|
|
1421
|
+
_state$product13,
|
|
1439
1422
|
res,
|
|
1440
1423
|
data,
|
|
1441
|
-
|
|
1424
|
+
_args7 = arguments;
|
|
1442
1425
|
|
|
1443
|
-
return _regenerator.default.wrap(function
|
|
1426
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1444
1427
|
while (1) {
|
|
1445
|
-
switch (
|
|
1428
|
+
switch (_context7.prev = _context7.next) {
|
|
1446
1429
|
case 0:
|
|
1447
|
-
forzar =
|
|
1430
|
+
forzar = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
|
|
1448
1431
|
|
|
1449
1432
|
if (!(variantGroup && !forzar)) {
|
|
1450
|
-
|
|
1433
|
+
_context7.next = 3;
|
|
1451
1434
|
break;
|
|
1452
1435
|
}
|
|
1453
1436
|
|
|
1454
|
-
return
|
|
1437
|
+
return _context7.abrupt("return", variantGroup);
|
|
1455
1438
|
|
|
1456
1439
|
case 3:
|
|
1457
|
-
|
|
1458
|
-
|
|
1440
|
+
_context7.prev = 3;
|
|
1441
|
+
_context7.next = 6;
|
|
1459
1442
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/group"), {
|
|
1460
|
-
articleId: (_state$
|
|
1443
|
+
articleId: (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.id_article
|
|
1461
1444
|
}, {
|
|
1462
1445
|
headers: {
|
|
1463
1446
|
Authorization: token
|
|
@@ -1465,54 +1448,54 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1465
1448
|
});
|
|
1466
1449
|
|
|
1467
1450
|
case 6:
|
|
1468
|
-
res =
|
|
1451
|
+
res = _context7.sent;
|
|
1469
1452
|
data = (0, _api.readPayload)(res);
|
|
1470
1453
|
setVariantGroup(data);
|
|
1471
|
-
return
|
|
1454
|
+
return _context7.abrupt("return", data);
|
|
1472
1455
|
|
|
1473
1456
|
case 12:
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
console.error("loadVariantGroup: ",
|
|
1457
|
+
_context7.prev = 12;
|
|
1458
|
+
_context7.t0 = _context7["catch"](3);
|
|
1459
|
+
console.error("loadVariantGroup: ", _context7.t0);
|
|
1477
1460
|
setVariantGroup({
|
|
1478
1461
|
group: null,
|
|
1479
1462
|
members: [],
|
|
1480
1463
|
error: true
|
|
1481
1464
|
});
|
|
1482
|
-
return
|
|
1465
|
+
return _context7.abrupt("return", null);
|
|
1483
1466
|
|
|
1484
1467
|
case 17:
|
|
1485
1468
|
case "end":
|
|
1486
|
-
return
|
|
1469
|
+
return _context7.stop();
|
|
1487
1470
|
}
|
|
1488
1471
|
}
|
|
1489
|
-
},
|
|
1472
|
+
}, _callee7, null, [[3, 12]]);
|
|
1490
1473
|
}));
|
|
1491
1474
|
|
|
1492
1475
|
return function loadVariantGroup() {
|
|
1493
|
-
return
|
|
1476
|
+
return _ref11.apply(this, arguments);
|
|
1494
1477
|
};
|
|
1495
1478
|
}();
|
|
1496
1479
|
|
|
1497
1480
|
(0, _react.useEffect)(function () {
|
|
1498
|
-
var _state$
|
|
1481
|
+
var _state$product14;
|
|
1499
1482
|
|
|
1500
|
-
if (!((_state$
|
|
1483
|
+
if (!((_state$product14 = state.product) !== null && _state$product14 !== void 0 && _state$product14.id_article)) return;
|
|
1501
1484
|
loadVariantGroup(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1502
|
-
}, [(_state$
|
|
1485
|
+
}, [(_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article]);
|
|
1503
1486
|
|
|
1504
1487
|
var handleOnLeaveGroup = /*#__PURE__*/function () {
|
|
1505
|
-
var
|
|
1506
|
-
var _state$
|
|
1488
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
1489
|
+
var _state$product16, res;
|
|
1507
1490
|
|
|
1508
|
-
return _regenerator.default.wrap(function
|
|
1491
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1509
1492
|
while (1) {
|
|
1510
|
-
switch (
|
|
1493
|
+
switch (_context8.prev = _context8.next) {
|
|
1511
1494
|
case 0:
|
|
1512
|
-
|
|
1513
|
-
|
|
1495
|
+
_context8.prev = 0;
|
|
1496
|
+
_context8.next = 3;
|
|
1514
1497
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/leave"), {
|
|
1515
|
-
articleId: (_state$
|
|
1498
|
+
articleId: (_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.id_article
|
|
1516
1499
|
}, {
|
|
1517
1500
|
headers: {
|
|
1518
1501
|
Authorization: token
|
|
@@ -1520,16 +1503,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1520
1503
|
});
|
|
1521
1504
|
|
|
1522
1505
|
case 3:
|
|
1523
|
-
res =
|
|
1506
|
+
res = _context8.sent;
|
|
1524
1507
|
setVariantGroup((0, _api.readPayload)(res));
|
|
1525
1508
|
setShowGroup(false);
|
|
1526
|
-
|
|
1509
|
+
_context8.next = 12;
|
|
1527
1510
|
break;
|
|
1528
1511
|
|
|
1529
1512
|
case 8:
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
console.error("leaveVariantGroup: ",
|
|
1513
|
+
_context8.prev = 8;
|
|
1514
|
+
_context8.t0 = _context8["catch"](0);
|
|
1515
|
+
console.error("leaveVariantGroup: ", _context8.t0);
|
|
1533
1516
|
dispatch({
|
|
1534
1517
|
type: "SET_MODAL",
|
|
1535
1518
|
payload: {
|
|
@@ -1554,29 +1537,29 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1554
1537
|
|
|
1555
1538
|
case 12:
|
|
1556
1539
|
case "end":
|
|
1557
|
-
return
|
|
1540
|
+
return _context8.stop();
|
|
1558
1541
|
}
|
|
1559
1542
|
}
|
|
1560
|
-
},
|
|
1543
|
+
}, _callee8, null, [[0, 8]]);
|
|
1561
1544
|
}));
|
|
1562
1545
|
|
|
1563
1546
|
return function handleOnLeaveGroup() {
|
|
1564
|
-
return
|
|
1547
|
+
return _ref12.apply(this, arguments);
|
|
1565
1548
|
};
|
|
1566
1549
|
}();
|
|
1567
1550
|
|
|
1568
1551
|
var openFamilyMember = /*#__PURE__*/function () {
|
|
1569
|
-
var
|
|
1570
|
-
var _readPayload, res,
|
|
1552
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(articleId) {
|
|
1553
|
+
var _readPayload, res, _ref14, data, encontrado;
|
|
1571
1554
|
|
|
1572
|
-
return _regenerator.default.wrap(function
|
|
1555
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1573
1556
|
while (1) {
|
|
1574
|
-
switch (
|
|
1557
|
+
switch (_context9.prev = _context9.next) {
|
|
1575
1558
|
case 0:
|
|
1576
1559
|
setLoadingVariant(articleId);
|
|
1577
1560
|
setAvisoFamilia(null);
|
|
1578
|
-
|
|
1579
|
-
|
|
1561
|
+
_context9.prev = 2;
|
|
1562
|
+
_context9.next = 5;
|
|
1580
1563
|
return _axios.default.get("".concat(process.env.REACT_APP_ORDERED_SERVICES_ENDPOINT), {
|
|
1581
1564
|
params: {
|
|
1582
1565
|
filterByIdArticle: articleId,
|
|
@@ -1588,11 +1571,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1588
1571
|
});
|
|
1589
1572
|
|
|
1590
1573
|
case 5:
|
|
1591
|
-
res =
|
|
1574
|
+
res = _context9.sent;
|
|
1592
1575
|
// read-order-services responde { total, data: [...] }. La vista trae una
|
|
1593
1576
|
// fila por orden, así que puede haber varias del mismo artículo; llegan
|
|
1594
1577
|
// ordenadas por order_id DESC y la primera es la orden más reciente.
|
|
1595
|
-
|
|
1578
|
+
_ref14 = (_readPayload = (0, _api.readPayload)(res)) !== null && _readPayload !== void 0 ? _readPayload : {}, data = _ref14.data;
|
|
1596
1579
|
encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
|
|
1597
1580
|
var _item$article;
|
|
1598
1581
|
|
|
@@ -1600,12 +1583,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1600
1583
|
});
|
|
1601
1584
|
|
|
1602
1585
|
if (encontrado) {
|
|
1603
|
-
|
|
1586
|
+
_context9.next = 11;
|
|
1604
1587
|
break;
|
|
1605
1588
|
}
|
|
1606
1589
|
|
|
1607
1590
|
setAvisoFamilia("Ese producto no está en ninguna orden de trabajo, así que no se puede abrir desde aquí.");
|
|
1608
|
-
return
|
|
1591
|
+
return _context9.abrupt("return");
|
|
1609
1592
|
|
|
1610
1593
|
case 11:
|
|
1611
1594
|
sessionStorage.setItem("productSelected", JSON.stringify(encontrado));
|
|
@@ -1616,30 +1599,30 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1616
1599
|
product: [encontrado]
|
|
1617
1600
|
}));
|
|
1618
1601
|
window.location.assign("/EditProducts");
|
|
1619
|
-
|
|
1602
|
+
_context9.next = 21;
|
|
1620
1603
|
break;
|
|
1621
1604
|
|
|
1622
1605
|
case 17:
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
console.error("openFamilyMember: ",
|
|
1606
|
+
_context9.prev = 17;
|
|
1607
|
+
_context9.t0 = _context9["catch"](2);
|
|
1608
|
+
console.error("openFamilyMember: ", _context9.t0);
|
|
1626
1609
|
setAvisoFamilia("No se pudo abrir ese producto. Intenta de nuevo.");
|
|
1627
1610
|
|
|
1628
1611
|
case 21:
|
|
1629
|
-
|
|
1612
|
+
_context9.prev = 21;
|
|
1630
1613
|
setLoadingVariant(null);
|
|
1631
|
-
return
|
|
1614
|
+
return _context9.finish(21);
|
|
1632
1615
|
|
|
1633
1616
|
case 24:
|
|
1634
1617
|
case "end":
|
|
1635
|
-
return
|
|
1618
|
+
return _context9.stop();
|
|
1636
1619
|
}
|
|
1637
1620
|
}
|
|
1638
|
-
},
|
|
1621
|
+
}, _callee9, null, [[2, 17, 21, 24]]);
|
|
1639
1622
|
}));
|
|
1640
1623
|
|
|
1641
|
-
return function openFamilyMember(
|
|
1642
|
-
return
|
|
1624
|
+
return function openFamilyMember(_x3) {
|
|
1625
|
+
return _ref13.apply(this, arguments);
|
|
1643
1626
|
};
|
|
1644
1627
|
}();
|
|
1645
1628
|
/*
|
|
@@ -1650,11 +1633,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1650
1633
|
|
|
1651
1634
|
|
|
1652
1635
|
var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
|
|
1653
|
-
var _state$product$varian2, _state$
|
|
1636
|
+
var _state$product$varian2, _state$product17, _result$linked, _result$parentArticle;
|
|
1654
1637
|
|
|
1655
1638
|
if (!result) return;
|
|
1656
1639
|
var updatedProduct = result.mode === "children" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1657
|
-
variantsCount: ((_state$product$varian2 = (_state$
|
|
1640
|
+
variantsCount: ((_state$product$varian2 = (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
|
|
1658
1641
|
}) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1659
1642
|
parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
|
|
1660
1643
|
variantsCount: 0
|
|
@@ -1728,31 +1711,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1728
1711
|
|
|
1729
1712
|
|
|
1730
1713
|
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
1731
|
-
var
|
|
1732
|
-
var _state$
|
|
1714
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(attributeId) {
|
|
1715
|
+
var _state$product18;
|
|
1733
1716
|
|
|
1734
1717
|
var kind,
|
|
1735
1718
|
esDescripcion,
|
|
1736
1719
|
res,
|
|
1737
1720
|
data,
|
|
1738
|
-
|
|
1739
|
-
return _regenerator.default.wrap(function
|
|
1721
|
+
_args10 = arguments;
|
|
1722
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1740
1723
|
while (1) {
|
|
1741
|
-
switch (
|
|
1724
|
+
switch (_context10.prev = _context10.next) {
|
|
1742
1725
|
case 0:
|
|
1743
|
-
kind =
|
|
1726
|
+
kind = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : "attribute";
|
|
1744
1727
|
|
|
1745
|
-
if (!(!attributeId || !((_state$
|
|
1746
|
-
|
|
1728
|
+
if (!(!attributeId || !((_state$product18 = state.product) !== null && _state$product18 !== void 0 && _state$product18.id_article))) {
|
|
1729
|
+
_context10.next = 3;
|
|
1747
1730
|
break;
|
|
1748
1731
|
}
|
|
1749
1732
|
|
|
1750
|
-
return
|
|
1733
|
+
return _context10.abrupt("return");
|
|
1751
1734
|
|
|
1752
1735
|
case 3:
|
|
1753
1736
|
esDescripcion = kind === "description";
|
|
1754
|
-
|
|
1755
|
-
|
|
1737
|
+
_context10.prev = 4;
|
|
1738
|
+
_context10.next = 7;
|
|
1756
1739
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread5.default)({
|
|
1757
1740
|
articleId: state.product.id_article
|
|
1758
1741
|
}, esDescripcion ? {
|
|
@@ -1766,11 +1749,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1766
1749
|
});
|
|
1767
1750
|
|
|
1768
1751
|
case 7:
|
|
1769
|
-
res =
|
|
1752
|
+
res = _context10.sent;
|
|
1770
1753
|
data = (0, _api.readPayload)(res);
|
|
1771
1754
|
|
|
1772
1755
|
if (!esDescripcion) {
|
|
1773
|
-
|
|
1756
|
+
_context10.next = 12;
|
|
1774
1757
|
break;
|
|
1775
1758
|
}
|
|
1776
1759
|
|
|
@@ -1784,7 +1767,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1784
1767
|
};
|
|
1785
1768
|
})
|
|
1786
1769
|
});
|
|
1787
|
-
return
|
|
1770
|
+
return _context10.abrupt("return");
|
|
1788
1771
|
|
|
1789
1772
|
case 12:
|
|
1790
1773
|
dispatch({
|
|
@@ -1797,24 +1780,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1797
1780
|
};
|
|
1798
1781
|
})
|
|
1799
1782
|
});
|
|
1800
|
-
|
|
1783
|
+
_context10.next = 18;
|
|
1801
1784
|
break;
|
|
1802
1785
|
|
|
1803
1786
|
case 15:
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
console.error("restoreInheritance: ",
|
|
1787
|
+
_context10.prev = 15;
|
|
1788
|
+
_context10.t0 = _context10["catch"](4);
|
|
1789
|
+
console.error("restoreInheritance: ", _context10.t0);
|
|
1807
1790
|
|
|
1808
1791
|
case 18:
|
|
1809
1792
|
case "end":
|
|
1810
|
-
return
|
|
1793
|
+
return _context10.stop();
|
|
1811
1794
|
}
|
|
1812
1795
|
}
|
|
1813
|
-
},
|
|
1796
|
+
}, _callee10, null, [[4, 15]]);
|
|
1814
1797
|
}));
|
|
1815
1798
|
|
|
1816
|
-
return function handleOnRestoreInheritance(
|
|
1817
|
-
return
|
|
1799
|
+
return function handleOnRestoreInheritance(_x4) {
|
|
1800
|
+
return _ref15.apply(this, arguments);
|
|
1818
1801
|
};
|
|
1819
1802
|
}();
|
|
1820
1803
|
/*
|
|
@@ -1849,45 +1832,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1849
1832
|
};
|
|
1850
1833
|
|
|
1851
1834
|
var handleOnClickSave = /*#__PURE__*/function () {
|
|
1852
|
-
var
|
|
1853
|
-
var _familia$variants, _variantGroup$members, cambios, familia, hijos, companeras;
|
|
1835
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1836
|
+
var _familia, _familia$variants, _variantGroup$members, cambios, familia, esHijo, hijos, companeras;
|
|
1854
1837
|
|
|
1855
|
-
return _regenerator.default.wrap(function
|
|
1838
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1856
1839
|
while (1) {
|
|
1857
|
-
switch (
|
|
1840
|
+
switch (_context11.prev = _context11.next) {
|
|
1858
1841
|
case 0:
|
|
1859
1842
|
if (!(state.saving || preparandoPropagacion)) {
|
|
1860
|
-
|
|
1843
|
+
_context11.next = 2;
|
|
1861
1844
|
break;
|
|
1862
1845
|
}
|
|
1863
1846
|
|
|
1864
|
-
return
|
|
1847
|
+
return _context11.abrupt("return");
|
|
1865
1848
|
|
|
1866
1849
|
case 2:
|
|
1867
|
-
|
|
1868
|
-
|
|
1850
|
+
_context11.t0 = state.active_tab;
|
|
1851
|
+
_context11.next = _context11.t0 === "Descripción" ? 5 : _context11.t0 === "Ficha técnica" ? 8 : _context11.t0 === "Imágenes" ? 34 : 37;
|
|
1869
1852
|
break;
|
|
1870
1853
|
|
|
1871
1854
|
case 5:
|
|
1872
|
-
|
|
1855
|
+
_context11.next = 7;
|
|
1873
1856
|
return saveDescriptions(token);
|
|
1874
1857
|
|
|
1875
1858
|
case 7:
|
|
1876
|
-
return
|
|
1859
|
+
return _context11.abrupt("break", 38);
|
|
1877
1860
|
|
|
1878
1861
|
case 8:
|
|
1879
1862
|
cambios = cambiosDeFichaTecnica();
|
|
1880
1863
|
|
|
1881
1864
|
if (!(cambios.length === 0)) {
|
|
1882
|
-
|
|
1865
|
+
_context11.next = 13;
|
|
1883
1866
|
break;
|
|
1884
1867
|
}
|
|
1885
1868
|
|
|
1886
|
-
|
|
1869
|
+
_context11.next = 12;
|
|
1887
1870
|
return saveDatasheets(token);
|
|
1888
1871
|
|
|
1889
1872
|
case 12:
|
|
1890
|
-
return
|
|
1873
|
+
return _context11.abrupt("break", 38);
|
|
1891
1874
|
|
|
1892
1875
|
case 13:
|
|
1893
1876
|
/*
|
|
@@ -1906,21 +1889,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1906
1889
|
*/
|
|
1907
1890
|
setPreparandoPropagacion(true);
|
|
1908
1891
|
familia = null;
|
|
1909
|
-
|
|
1910
|
-
|
|
1892
|
+
_context11.prev = 15;
|
|
1893
|
+
_context11.next = 18;
|
|
1911
1894
|
return loadFamily(true);
|
|
1912
1895
|
|
|
1913
1896
|
case 18:
|
|
1914
|
-
familia =
|
|
1897
|
+
familia = _context11.sent;
|
|
1915
1898
|
|
|
1916
1899
|
case 19:
|
|
1917
|
-
|
|
1900
|
+
_context11.prev = 19;
|
|
1918
1901
|
setPreparandoPropagacion(false);
|
|
1919
|
-
return
|
|
1902
|
+
return _context11.finish(19);
|
|
1920
1903
|
|
|
1921
1904
|
case 22:
|
|
1922
1905
|
if (!(!familia || familia.error)) {
|
|
1923
|
-
|
|
1906
|
+
_context11.next = 25;
|
|
1924
1907
|
break;
|
|
1925
1908
|
}
|
|
1926
1909
|
|
|
@@ -1957,10 +1940,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1957
1940
|
}]
|
|
1958
1941
|
}
|
|
1959
1942
|
});
|
|
1960
|
-
return
|
|
1943
|
+
return _context11.abrupt("return");
|
|
1961
1944
|
|
|
1962
1945
|
case 25:
|
|
1963
|
-
|
|
1946
|
+
/*
|
|
1947
|
+
Un HIJO no propaga a nadie, y hay que decirlo explícitamente.
|
|
1948
|
+
`familia.variants` mira la familia desde el PADRE —eso es lo correcto
|
|
1949
|
+
para navegar entre hermanos— así que desde la ficha de un hijo esa
|
|
1950
|
+
lista son sus HERMANOS. Leerla como «los destinos de este producto»
|
|
1951
|
+
hacía que el diálogo le ofreciera heredar a sus hermanos. El servidor
|
|
1952
|
+
resolvía los destinos por su cuenta y no escribía nada, de modo que el
|
|
1953
|
+
usuario elegía, guardaba, y no pasaba nada: un no-operativo silencioso.
|
|
1954
|
+
*/
|
|
1955
|
+
esHijo = !!((_familia = familia) !== null && _familia !== void 0 && _familia.parent);
|
|
1956
|
+
hijos = esHijo ? [] : ((_familia$variants = familia.variants) !== null && _familia$variants !== void 0 ? _familia$variants : []).filter(function (v) {
|
|
1964
1957
|
return !v.isCurrent;
|
|
1965
1958
|
});
|
|
1966
1959
|
/*
|
|
@@ -1971,61 +1964,50 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1971
1964
|
|
|
1972
1965
|
companeras = ((_variantGroup$members = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.members) !== null && _variantGroup$members !== void 0 ? _variantGroup$members : []).filter(function (m) {
|
|
1973
1966
|
return !m.isCurrent;
|
|
1974
|
-
});
|
|
1967
|
+
}); // Un hijo tampoco puede estar agrupado desde 2026-09-25, así que para
|
|
1968
|
+
// él no queda ningún destino posible.
|
|
1975
1969
|
|
|
1976
|
-
if (!(hijos.length > 0 || companeras.length > 0)) {
|
|
1977
|
-
|
|
1970
|
+
if (!(!esHijo && (hijos.length > 0 || companeras.length > 0))) {
|
|
1971
|
+
_context11.next = 31;
|
|
1978
1972
|
break;
|
|
1979
1973
|
}
|
|
1980
1974
|
|
|
1981
1975
|
setPendingPropagation({
|
|
1982
1976
|
cambios: cambios
|
|
1983
1977
|
});
|
|
1984
|
-
return
|
|
1978
|
+
return _context11.abrupt("return");
|
|
1985
1979
|
|
|
1986
|
-
case
|
|
1987
|
-
|
|
1980
|
+
case 31:
|
|
1981
|
+
_context11.next = 33;
|
|
1988
1982
|
return saveDatasheets(token);
|
|
1989
1983
|
|
|
1990
|
-
case 32:
|
|
1991
|
-
return _context12.abrupt("break", 41);
|
|
1992
|
-
|
|
1993
1984
|
case 33:
|
|
1994
|
-
|
|
1995
|
-
_context12.next = 37;
|
|
1996
|
-
break;
|
|
1997
|
-
}
|
|
1985
|
+
return _context11.abrupt("break", 38);
|
|
1998
1986
|
|
|
1999
|
-
|
|
2000
|
-
|
|
1987
|
+
case 34:
|
|
1988
|
+
_context11.next = 36;
|
|
1989
|
+
return updateImages(token);
|
|
2001
1990
|
|
|
2002
1991
|
case 36:
|
|
2003
|
-
return
|
|
1992
|
+
return _context11.abrupt("break", 38);
|
|
2004
1993
|
|
|
2005
1994
|
case 37:
|
|
2006
|
-
|
|
2007
|
-
return updateImages(token);
|
|
2008
|
-
|
|
2009
|
-
case 39:
|
|
2010
|
-
return _context12.abrupt("break", 41);
|
|
2011
|
-
|
|
2012
|
-
case 40:
|
|
2013
|
-
return _context12.abrupt("break", 41);
|
|
1995
|
+
return _context11.abrupt("break", 38);
|
|
2014
1996
|
|
|
2015
|
-
case
|
|
2016
|
-
|
|
1997
|
+
case 38:
|
|
1998
|
+
_context11.next = 40;
|
|
2017
1999
|
return loadData(false);
|
|
2018
2000
|
|
|
2019
|
-
case
|
|
2001
|
+
case 40:
|
|
2020
2002
|
case "end":
|
|
2021
|
-
return
|
|
2003
|
+
return _context11.stop();
|
|
2022
2004
|
}
|
|
2023
2005
|
}
|
|
2024
|
-
},
|
|
2006
|
+
}, _callee11, null, [[15,, 19, 22]]);
|
|
2025
2007
|
}));
|
|
2026
2008
|
|
|
2027
2009
|
return function handleOnClickSave() {
|
|
2028
|
-
return
|
|
2010
|
+
return _ref16.apply(this, arguments);
|
|
2029
2011
|
};
|
|
2030
2012
|
}();
|
|
2031
2013
|
|
|
@@ -2042,106 +2024,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2042
2024
|
payload: items
|
|
2043
2025
|
});
|
|
2044
2026
|
};
|
|
2045
|
-
/*
|
|
2046
|
-
Descarga de activos: los seleccionados, o todos si no hay selección — el
|
|
2047
|
-
mismo criterio que usa la descarga de imágenes.
|
|
2048
|
-
Solo se descarga lo que ya está en S3. Un activo recién soltado vive como
|
|
2049
|
-
referencia al archivo del disco del usuario: "descargarlo" le devolvería el
|
|
2050
|
-
archivo que él mismo acaba de elegir, lo cual no tiene sentido.
|
|
2051
|
-
*/
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
var handleOnDownloadAssets = function handleOnDownloadAssets() {
|
|
2055
|
-
var seleccion = state.selected_assets.length ? state.selected_assets : state.assets_values;
|
|
2056
|
-
var descargables = seleccion.filter(function (asset) {
|
|
2057
|
-
return asset.id && asset.url;
|
|
2058
|
-
});
|
|
2059
|
-
|
|
2060
|
-
if (descargables.length === 0) {
|
|
2061
|
-
dispatch({
|
|
2062
|
-
type: "SET_MODAL",
|
|
2063
|
-
payload: {
|
|
2064
|
-
show: true,
|
|
2065
|
-
title: "Nada que descargar",
|
|
2066
|
-
message: "Los activos seleccionados todavía no se han guardado. Guárdalos primero.",
|
|
2067
|
-
image: _genericModalWarning.default
|
|
2068
|
-
}
|
|
2069
|
-
});
|
|
2070
|
-
return;
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
descargables.forEach(function (asset) {
|
|
2074
|
-
return (0, _fileSaver.saveAs)(asset.url, asset.name);
|
|
2075
|
-
});
|
|
2076
|
-
};
|
|
2077
|
-
/*
|
|
2078
|
-
Borrado en lote de activos.
|
|
2079
|
-
A diferencia de las imágenes, que se borran contra el backend en el momento,
|
|
2080
|
-
los activos se quitan de la bandeja y su baja viaja en el mismo PUT del
|
|
2081
|
-
guardado (`deleteAssets`). Es lo que permite al usuario deshacerse de un
|
|
2082
|
-
borrado por error: basta con no guardar. El mensaje lo dice, para que nadie
|
|
2083
|
-
se quede pensando que ya se aplicó.
|
|
2084
|
-
*/
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
var handleOnAskToDeleteAssets = function handleOnAskToDeleteAssets() {
|
|
2088
|
-
if (state.selected_assets.length === 0) {
|
|
2089
|
-
dispatch({
|
|
2090
|
-
type: "SET_MODAL",
|
|
2091
|
-
payload: {
|
|
2092
|
-
show: true,
|
|
2093
|
-
title: "Eliminar activos digitales",
|
|
2094
|
-
message: "No has seleccionado ningún activo para eliminar.",
|
|
2095
|
-
image: _genericModalWarning.default
|
|
2096
|
-
}
|
|
2097
|
-
});
|
|
2098
|
-
return;
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
var seleccionados = state.selected_assets;
|
|
2102
|
-
dispatch({
|
|
2103
|
-
type: "SET_MODAL",
|
|
2104
|
-
payload: {
|
|
2105
|
-
show: true,
|
|
2106
|
-
title: "Eliminar activos digitales",
|
|
2107
|
-
message: "Se quitar\xE1n ".concat(seleccionados.length, " activo(s) de la bandeja. El borrado se aplica al guardar."),
|
|
2108
|
-
image: _genericModalWarning.default,
|
|
2109
|
-
buttons: [{
|
|
2110
|
-
text: "Cancelar",
|
|
2111
|
-
buttonType: "general-white-button",
|
|
2112
|
-
action: function action() {
|
|
2113
|
-
return dispatch({
|
|
2114
|
-
type: "SET_MODAL",
|
|
2115
|
-
payload: {
|
|
2116
|
-
show: false
|
|
2117
|
-
}
|
|
2118
|
-
});
|
|
2119
|
-
}
|
|
2120
|
-
}, {
|
|
2121
|
-
text: "Eliminar",
|
|
2122
|
-
buttonType: "general-button-default",
|
|
2123
|
-
action: function action() {
|
|
2124
|
-
dispatch({
|
|
2125
|
-
type: "SET_MODAL",
|
|
2126
|
-
payload: {
|
|
2127
|
-
show: false
|
|
2128
|
-
}
|
|
2129
|
-
});
|
|
2130
|
-
seleccionados.forEach(function (asset) {
|
|
2131
|
-
return digitalAssets.removeAsset(asset);
|
|
2132
|
-
});
|
|
2133
|
-
}
|
|
2134
|
-
}]
|
|
2135
|
-
}
|
|
2136
|
-
});
|
|
2137
|
-
};
|
|
2138
2027
|
|
|
2139
2028
|
var handleOnAskToDeleteImages = function handleOnAskToDeleteImages() {
|
|
2140
|
-
if (currentTray === _GalleryTrayTabs.TRAYS.ASSETS) {
|
|
2141
|
-
handleOnAskToDeleteAssets();
|
|
2142
|
-
return;
|
|
2143
|
-
}
|
|
2144
|
-
|
|
2145
2029
|
if (state.selected_images.length === 0) {
|
|
2146
2030
|
dispatch({
|
|
2147
2031
|
type: "SET_MODAL",
|
|
@@ -2191,24 +2075,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2191
2075
|
};
|
|
2192
2076
|
|
|
2193
2077
|
var handleOnApproveSingleService = /*#__PURE__*/function () {
|
|
2194
|
-
var
|
|
2195
|
-
return _regenerator.default.wrap(function
|
|
2078
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
2079
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
2196
2080
|
while (1) {
|
|
2197
|
-
switch (
|
|
2081
|
+
switch (_context12.prev = _context12.next) {
|
|
2198
2082
|
case 0:
|
|
2199
|
-
|
|
2083
|
+
_context12.next = 2;
|
|
2200
2084
|
return sendSingleEvaluation("A");
|
|
2201
2085
|
|
|
2202
2086
|
case 2:
|
|
2203
2087
|
case "end":
|
|
2204
|
-
return
|
|
2088
|
+
return _context12.stop();
|
|
2205
2089
|
}
|
|
2206
2090
|
}
|
|
2207
|
-
},
|
|
2091
|
+
}, _callee12);
|
|
2208
2092
|
}));
|
|
2209
2093
|
|
|
2210
2094
|
return function handleOnApproveSingleService() {
|
|
2211
|
-
return
|
|
2095
|
+
return _ref17.apply(this, arguments);
|
|
2212
2096
|
};
|
|
2213
2097
|
}();
|
|
2214
2098
|
|
|
@@ -2217,21 +2101,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2217
2101
|
};
|
|
2218
2102
|
|
|
2219
2103
|
var sendSingleEvaluation = /*#__PURE__*/function () {
|
|
2220
|
-
var
|
|
2104
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
|
|
2221
2105
|
var _state$product$id_ord, _state$active_retaile5;
|
|
2222
2106
|
|
|
2223
2107
|
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;
|
|
2224
2108
|
|
|
2225
|
-
return _regenerator.default.wrap(function
|
|
2109
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
2226
2110
|
while (1) {
|
|
2227
|
-
switch (
|
|
2111
|
+
switch (_context13.prev = _context13.next) {
|
|
2228
2112
|
case 0:
|
|
2229
2113
|
if (!state.saving) {
|
|
2230
|
-
|
|
2114
|
+
_context13.next = 2;
|
|
2231
2115
|
break;
|
|
2232
2116
|
}
|
|
2233
2117
|
|
|
2234
|
-
return
|
|
2118
|
+
return _context13.abrupt("return");
|
|
2235
2119
|
|
|
2236
2120
|
case 2:
|
|
2237
2121
|
dispatch({
|
|
@@ -2252,16 +2136,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2252
2136
|
retailerId: retailerId
|
|
2253
2137
|
};
|
|
2254
2138
|
activeTab = state.active_tab;
|
|
2255
|
-
|
|
2139
|
+
_context13.prev = 11;
|
|
2256
2140
|
|
|
2257
2141
|
if (!result) {
|
|
2258
|
-
|
|
2142
|
+
_context13.next = 28;
|
|
2259
2143
|
break;
|
|
2260
2144
|
}
|
|
2261
2145
|
|
|
2262
2146
|
data.result = result;
|
|
2263
2147
|
data.retailerId = retailerId;
|
|
2264
|
-
|
|
2148
|
+
_context13.next = 17;
|
|
2265
2149
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
2266
2150
|
headers: {
|
|
2267
2151
|
Authorization: token
|
|
@@ -2269,7 +2153,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2269
2153
|
});
|
|
2270
2154
|
|
|
2271
2155
|
case 17:
|
|
2272
|
-
res =
|
|
2156
|
+
res = _context13.sent;
|
|
2273
2157
|
newStatuses = JSON.parse(res.data.body);
|
|
2274
2158
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
2275
2159
|
articleStatus = newStatuses.newArticleStatus[articleId];
|
|
@@ -2300,7 +2184,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2300
2184
|
image: _genericModalCheck.default
|
|
2301
2185
|
}
|
|
2302
2186
|
});
|
|
2303
|
-
|
|
2187
|
+
_context13.next = 33;
|
|
2304
2188
|
break;
|
|
2305
2189
|
|
|
2306
2190
|
case 28:
|
|
@@ -2316,7 +2200,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2316
2200
|
icon = _genericModalCheck.default;
|
|
2317
2201
|
}
|
|
2318
2202
|
|
|
2319
|
-
|
|
2203
|
+
_context13.next = 32;
|
|
2320
2204
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
2321
2205
|
headers: {
|
|
2322
2206
|
Authorization: token
|
|
@@ -2324,7 +2208,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2324
2208
|
});
|
|
2325
2209
|
|
|
2326
2210
|
case 32:
|
|
2327
|
-
res =
|
|
2211
|
+
res = _context13.sent;
|
|
2328
2212
|
|
|
2329
2213
|
case 33:
|
|
2330
2214
|
if (res.data.statusCode === 200) {
|
|
@@ -2409,13 +2293,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2409
2293
|
});
|
|
2410
2294
|
}
|
|
2411
2295
|
|
|
2412
|
-
|
|
2296
|
+
_context13.next = 40;
|
|
2413
2297
|
break;
|
|
2414
2298
|
|
|
2415
2299
|
case 36:
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
console.error("Error sending evaluation:",
|
|
2300
|
+
_context13.prev = 36;
|
|
2301
|
+
_context13.t0 = _context13["catch"](11);
|
|
2302
|
+
console.error("Error sending evaluation:", _context13.t0);
|
|
2419
2303
|
dispatch({
|
|
2420
2304
|
type: "SET_MODAL",
|
|
2421
2305
|
payload: {
|
|
@@ -2427,45 +2311,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2427
2311
|
});
|
|
2428
2312
|
|
|
2429
2313
|
case 40:
|
|
2430
|
-
|
|
2314
|
+
_context13.prev = 40;
|
|
2431
2315
|
dispatch({
|
|
2432
2316
|
type: "SET_SAVING",
|
|
2433
2317
|
payload: false
|
|
2434
2318
|
});
|
|
2435
|
-
return
|
|
2319
|
+
return _context13.finish(40);
|
|
2436
2320
|
|
|
2437
2321
|
case 43:
|
|
2438
2322
|
case "end":
|
|
2439
|
-
return
|
|
2323
|
+
return _context13.stop();
|
|
2440
2324
|
}
|
|
2441
2325
|
}
|
|
2442
|
-
},
|
|
2326
|
+
}, _callee13, null, [[11, 36, 40, 43]]);
|
|
2443
2327
|
}));
|
|
2444
2328
|
|
|
2445
|
-
return function sendSingleEvaluation(
|
|
2446
|
-
return
|
|
2329
|
+
return function sendSingleEvaluation(_x5) {
|
|
2330
|
+
return _ref18.apply(this, arguments);
|
|
2447
2331
|
};
|
|
2448
2332
|
}();
|
|
2449
2333
|
|
|
2450
2334
|
var handleOnApproveAllServices = /*#__PURE__*/function () {
|
|
2451
|
-
var
|
|
2452
|
-
return _regenerator.default.wrap(function
|
|
2335
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
2336
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
2453
2337
|
while (1) {
|
|
2454
|
-
switch (
|
|
2338
|
+
switch (_context14.prev = _context14.next) {
|
|
2455
2339
|
case 0:
|
|
2456
|
-
|
|
2340
|
+
_context14.next = 2;
|
|
2457
2341
|
return sendBulkEvaluation("A");
|
|
2458
2342
|
|
|
2459
2343
|
case 2:
|
|
2460
2344
|
case "end":
|
|
2461
|
-
return
|
|
2345
|
+
return _context14.stop();
|
|
2462
2346
|
}
|
|
2463
2347
|
}
|
|
2464
|
-
},
|
|
2348
|
+
}, _callee14);
|
|
2465
2349
|
}));
|
|
2466
2350
|
|
|
2467
2351
|
return function handleOnApproveAllServices() {
|
|
2468
|
-
return
|
|
2352
|
+
return _ref19.apply(this, arguments);
|
|
2469
2353
|
};
|
|
2470
2354
|
}();
|
|
2471
2355
|
|
|
@@ -2475,18 +2359,18 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2475
2359
|
};
|
|
2476
2360
|
|
|
2477
2361
|
var sendBulkEvaluation = /*#__PURE__*/function () {
|
|
2478
|
-
var
|
|
2362
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
2479
2363
|
var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
2480
2364
|
|
|
2481
|
-
return _regenerator.default.wrap(function
|
|
2365
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
2482
2366
|
while (1) {
|
|
2483
|
-
switch (
|
|
2367
|
+
switch (_context15.prev = _context15.next) {
|
|
2484
2368
|
case 0:
|
|
2485
2369
|
dispatch({
|
|
2486
2370
|
type: "SET_SAVING",
|
|
2487
2371
|
payload: true
|
|
2488
2372
|
});
|
|
2489
|
-
|
|
2373
|
+
_context15.prev = 1;
|
|
2490
2374
|
evaluationArray = [];
|
|
2491
2375
|
conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
|
|
2492
2376
|
(_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
|
|
@@ -2511,7 +2395,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2511
2395
|
}));
|
|
2512
2396
|
}
|
|
2513
2397
|
});
|
|
2514
|
-
|
|
2398
|
+
_context15.next = 7;
|
|
2515
2399
|
return Promise.all(evaluationArray);
|
|
2516
2400
|
|
|
2517
2401
|
case 7:
|
|
@@ -2566,41 +2450,41 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2566
2450
|
image: _genericModalCheck.default
|
|
2567
2451
|
}
|
|
2568
2452
|
});
|
|
2569
|
-
|
|
2453
|
+
_context15.next = 19;
|
|
2570
2454
|
break;
|
|
2571
2455
|
|
|
2572
2456
|
case 16:
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
console.error("Error in bulk evaluation:",
|
|
2457
|
+
_context15.prev = 16;
|
|
2458
|
+
_context15.t0 = _context15["catch"](1);
|
|
2459
|
+
console.error("Error in bulk evaluation:", _context15.t0);
|
|
2576
2460
|
|
|
2577
2461
|
case 19:
|
|
2578
|
-
|
|
2462
|
+
_context15.prev = 19;
|
|
2579
2463
|
dispatch({
|
|
2580
2464
|
type: "SET_SAVING",
|
|
2581
2465
|
payload: false
|
|
2582
2466
|
});
|
|
2583
|
-
return
|
|
2467
|
+
return _context15.finish(19);
|
|
2584
2468
|
|
|
2585
2469
|
case 22:
|
|
2586
2470
|
case "end":
|
|
2587
|
-
return
|
|
2471
|
+
return _context15.stop();
|
|
2588
2472
|
}
|
|
2589
2473
|
}
|
|
2590
|
-
},
|
|
2474
|
+
}, _callee15, null, [[1, 16, 19, 22]]);
|
|
2591
2475
|
}));
|
|
2592
2476
|
|
|
2593
|
-
return function sendBulkEvaluation(
|
|
2594
|
-
return
|
|
2477
|
+
return function sendBulkEvaluation(_x6) {
|
|
2478
|
+
return _ref20.apply(this, arguments);
|
|
2595
2479
|
};
|
|
2596
2480
|
}();
|
|
2597
2481
|
|
|
2598
2482
|
var handleOnChangeAssignations = /*#__PURE__*/function () {
|
|
2599
|
-
var
|
|
2483
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(assignationType, assignationId) {
|
|
2600
2484
|
var concept, data, updatedProduct;
|
|
2601
|
-
return _regenerator.default.wrap(function
|
|
2485
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
2602
2486
|
while (1) {
|
|
2603
|
-
switch (
|
|
2487
|
+
switch (_context16.prev = _context16.next) {
|
|
2604
2488
|
case 0:
|
|
2605
2489
|
concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
2606
2490
|
data = {
|
|
@@ -2611,7 +2495,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2611
2495
|
concept: concept,
|
|
2612
2496
|
userId: assignationId
|
|
2613
2497
|
};
|
|
2614
|
-
|
|
2498
|
+
_context16.next = 4;
|
|
2615
2499
|
return (0, _axios.default)({
|
|
2616
2500
|
method: "post",
|
|
2617
2501
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -2630,14 +2514,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2630
2514
|
|
|
2631
2515
|
case 6:
|
|
2632
2516
|
case "end":
|
|
2633
|
-
return
|
|
2517
|
+
return _context16.stop();
|
|
2634
2518
|
}
|
|
2635
2519
|
}
|
|
2636
|
-
},
|
|
2520
|
+
}, _callee16);
|
|
2637
2521
|
}));
|
|
2638
2522
|
|
|
2639
|
-
return function handleOnChangeAssignations(
|
|
2640
|
-
return
|
|
2523
|
+
return function handleOnChangeAssignations(_x7, _x8) {
|
|
2524
|
+
return _ref21.apply(this, arguments);
|
|
2641
2525
|
};
|
|
2642
2526
|
}();
|
|
2643
2527
|
|
|
@@ -2672,16 +2556,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2672
2556
|
};
|
|
2673
2557
|
|
|
2674
2558
|
var handleOnSubmitComment = /*#__PURE__*/function () {
|
|
2675
|
-
var
|
|
2559
|
+
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(e) {
|
|
2676
2560
|
var commentText;
|
|
2677
|
-
return _regenerator.default.wrap(function
|
|
2561
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
2678
2562
|
while (1) {
|
|
2679
|
-
switch (
|
|
2563
|
+
switch (_context17.prev = _context17.next) {
|
|
2680
2564
|
case 0:
|
|
2681
2565
|
e.preventDefault();
|
|
2682
2566
|
commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
|
|
2683
|
-
|
|
2684
|
-
|
|
2567
|
+
_context17.prev = 2;
|
|
2568
|
+
_context17.next = 5;
|
|
2685
2569
|
return createComment(commentText, token);
|
|
2686
2570
|
|
|
2687
2571
|
case 5:
|
|
@@ -2694,13 +2578,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2694
2578
|
image: _genericModalCheck.default
|
|
2695
2579
|
}
|
|
2696
2580
|
});
|
|
2697
|
-
|
|
2581
|
+
_context17.next = 12;
|
|
2698
2582
|
break;
|
|
2699
2583
|
|
|
2700
2584
|
case 8:
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
console.error("Error saving comment:",
|
|
2585
|
+
_context17.prev = 8;
|
|
2586
|
+
_context17.t0 = _context17["catch"](2);
|
|
2587
|
+
console.error("Error saving comment:", _context17.t0);
|
|
2704
2588
|
dispatch({
|
|
2705
2589
|
type: "SET_MODAL",
|
|
2706
2590
|
payload: {
|
|
@@ -2713,14 +2597,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2713
2597
|
|
|
2714
2598
|
case 12:
|
|
2715
2599
|
case "end":
|
|
2716
|
-
return
|
|
2600
|
+
return _context17.stop();
|
|
2717
2601
|
}
|
|
2718
2602
|
}
|
|
2719
|
-
},
|
|
2603
|
+
}, _callee17, null, [[2, 8]]);
|
|
2720
2604
|
}));
|
|
2721
2605
|
|
|
2722
|
-
return function handleOnSubmitComment(
|
|
2723
|
-
return
|
|
2606
|
+
return function handleOnSubmitComment(_x9) {
|
|
2607
|
+
return _ref22.apply(this, arguments);
|
|
2724
2608
|
};
|
|
2725
2609
|
}();
|
|
2726
2610
|
|
|
@@ -3031,19 +2915,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3031
2915
|
})]
|
|
3032
2916
|
})
|
|
3033
2917
|
});
|
|
3034
|
-
|
|
3035
|
-
`images_values` entra al guard junto a `services` y `product`.
|
|
3036
|
-
React 17 no agrupa los dispatch que van después de un `await`: cada uno
|
|
3037
|
-
re-renderiza al instante. En `loadData` el orden es SET_SERVICES →
|
|
3038
|
-
…_INPUTS → SET_IMAGES_VALUES, así que había renders intermedios con
|
|
3039
|
-
`services` ya puesto —el guard los dejaba pasar— y el resto todavía en null.
|
|
3040
|
-
El cuerpo de abajo lee `datasheets_inputs[1]`, `descriptions_inputs[0]` y
|
|
3041
|
-
`images_values.values` sin protección, y tumbaba la pantalla entera.
|
|
3042
|
-
Se comprueba `images_values` y no cada uno: es el ÚLTIMO que `loadData`
|
|
3043
|
-
despacha, así que si ya está, los anteriores también.
|
|
3044
|
-
*/
|
|
3045
|
-
|
|
3046
|
-
if (state.loading || !state.services || !state.product || !state.images_values) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
2918
|
+
if (state.loading || !state.services || !state.product) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
3047
2919
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ProductEditionSkeleton, {})
|
|
3048
2920
|
});
|
|
3049
2921
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AiProductEdition.AiProductEditionProvider, {
|
|
@@ -3055,7 +2927,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3055
2927
|
headerTop: headerTop,
|
|
3056
2928
|
children: [pendingPropagation && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PropagateChangesModal.PropagateChangesModal, {
|
|
3057
2929
|
changedAttributes: pendingPropagation.cambios,
|
|
3058
|
-
variants: ((_family$variants2 = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants2 !== void 0 ? _family$variants2 : []).filter(function (v) {
|
|
2930
|
+
variants: esHijoDeOtro ? [] : ((_family$variants2 = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants2 !== void 0 ? _family$variants2 : []).filter(function (v) {
|
|
3059
2931
|
return !v.isCurrent;
|
|
3060
2932
|
}),
|
|
3061
2933
|
groupMembers: ((_variantGroup$members2 = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.members) !== null && _variantGroup$members2 !== void 0 ? _variantGroup$members2 : []).filter(function (m) {
|
|
@@ -3071,9 +2943,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3071
2943
|
saveDatasheets(token, propagation !== null && propagation !== void 0 ? propagation : undefined);
|
|
3072
2944
|
}
|
|
3073
2945
|
}), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
|
|
3074
|
-
articleId: (_state$
|
|
3075
|
-
articleName: (_state$
|
|
3076
|
-
articleUpc: (_state$
|
|
2946
|
+
articleId: (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article,
|
|
2947
|
+
articleName: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.name,
|
|
2948
|
+
articleUpc: (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.upc,
|
|
3077
2949
|
activeRetailerId: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
|
|
3078
2950
|
token: token,
|
|
3079
2951
|
onClose: function onClose() {
|
|
@@ -3081,9 +2953,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3081
2953
|
},
|
|
3082
2954
|
onLinked: handleOnLinkedVariants
|
|
3083
2955
|
}), showGroupModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VariantGroupModal.VariantGroupModal, {
|
|
3084
|
-
articleId: (_state$
|
|
3085
|
-
articleName: (_state$
|
|
3086
|
-
articleUpc: (_state$
|
|
2956
|
+
articleId: (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.id_article,
|
|
2957
|
+
articleName: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.name,
|
|
2958
|
+
articleUpc: (_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.upc,
|
|
3087
2959
|
currentGroup: (_variantGroup$group2 = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) !== null && _variantGroup$group2 !== void 0 ? _variantGroup$group2 : null,
|
|
3088
2960
|
token: token,
|
|
3089
2961
|
onClose: function onClose() {
|
|
@@ -3119,21 +2991,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3119
2991
|
type: "pink",
|
|
3120
2992
|
label: "Aceptar",
|
|
3121
2993
|
size: 12,
|
|
3122
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2994
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
3123
2995
|
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
3124
|
-
return _regenerator.default.wrap(function
|
|
2996
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
3125
2997
|
while (1) {
|
|
3126
|
-
switch (
|
|
2998
|
+
switch (_context18.prev = _context18.next) {
|
|
3127
2999
|
case 0:
|
|
3128
3000
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
3129
3001
|
|
|
3130
3002
|
if (!(!elements || elements.length === 0)) {
|
|
3131
|
-
|
|
3003
|
+
_context18.next = 4;
|
|
3132
3004
|
break;
|
|
3133
3005
|
}
|
|
3134
3006
|
|
|
3135
3007
|
console.error("Elemento no encontrado");
|
|
3136
|
-
return
|
|
3008
|
+
return _context18.abrupt("return");
|
|
3137
3009
|
|
|
3138
3010
|
case 4:
|
|
3139
3011
|
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
@@ -3142,7 +3014,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3142
3014
|
});
|
|
3143
3015
|
|
|
3144
3016
|
if (!isMessageEmpty) {
|
|
3145
|
-
|
|
3017
|
+
_context18.next = 10;
|
|
3146
3018
|
break;
|
|
3147
3019
|
}
|
|
3148
3020
|
|
|
@@ -3157,13 +3029,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3157
3029
|
container.appendChild(alert);
|
|
3158
3030
|
}
|
|
3159
3031
|
|
|
3160
|
-
return
|
|
3032
|
+
return _context18.abrupt("return");
|
|
3161
3033
|
|
|
3162
3034
|
case 10:
|
|
3163
3035
|
fullMessage = Array.from(elements).map(function (element) {
|
|
3164
3036
|
return element.innerHTML;
|
|
3165
3037
|
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
3166
|
-
|
|
3038
|
+
_context18.next = 13;
|
|
3167
3039
|
return createComment(fullMessage, token);
|
|
3168
3040
|
|
|
3169
3041
|
case 13:
|
|
@@ -3172,10 +3044,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3172
3044
|
|
|
3173
3045
|
case 15:
|
|
3174
3046
|
case "end":
|
|
3175
|
-
return
|
|
3047
|
+
return _context18.stop();
|
|
3176
3048
|
}
|
|
3177
3049
|
}
|
|
3178
|
-
},
|
|
3050
|
+
}, _callee18);
|
|
3179
3051
|
}))
|
|
3180
3052
|
}, "btn-Aceptar")]
|
|
3181
3053
|
}), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
@@ -3243,27 +3115,17 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3243
3115
|
className: "data-container",
|
|
3244
3116
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3245
3117
|
className: "image-data-panel",
|
|
3246
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer
|
|
3247
|
-
|
|
3248
|
-
`images_values` puede ser null en pleno render.
|
|
3249
|
-
React 17 no agrupa los dispatch que van después de un `await`:
|
|
3250
|
-
cada uno re-renderiza al instante. En `loadData`, `SET_SERVICES`
|
|
3251
|
-
se despacha antes que `SET_IMAGES_VALUES`, así que hay un render
|
|
3252
|
-
en el que `services` ya existe —y por eso el guard de arriba deja
|
|
3253
|
-
pasar— pero las imágenes todavía no. Sin las interrogaciones,
|
|
3254
|
-
ese render intermedio tumba la pantalla entera.
|
|
3255
|
-
*/
|
|
3256
|
-
, {
|
|
3257
|
-
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 : {},
|
|
3118
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
|
|
3119
|
+
activeImage: (_state$images_values$2 = state.images_values.values[state.current_image]) !== null && _state$images_values$2 !== void 0 ? _state$images_values$2 : {},
|
|
3258
3120
|
imagesArray: state.images_values || [],
|
|
3259
3121
|
setActiveImage: handleOnChangeCurrentImage,
|
|
3260
3122
|
setShowModal: handleOnShowModalGallery
|
|
3261
3123
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable // states
|
|
3262
3124
|
, {
|
|
3263
3125
|
lists: state.images_values || [],
|
|
3264
|
-
activeImage: (_state$
|
|
3126
|
+
activeImage: (_state$images_values10 = state.images_values) !== null && _state$images_values10 !== void 0 && _state$images_values10.values ? (_state$images_values11 = state.images_values) === null || _state$images_values11 === void 0 ? void 0 : _state$images_values11.values[state.current_image] : {},
|
|
3265
3127
|
assignationsImages: state.collaborator_assignations["Imágenes"],
|
|
3266
|
-
imagesStatus: ((_state$
|
|
3128
|
+
imagesStatus: ((_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.images_status) || "-",
|
|
3267
3129
|
retailerSelected: (_state$active_retaile9 = state.active_retailer) === null || _state$active_retaile9 === void 0 ? void 0 : _state$active_retaile9.id_retailer,
|
|
3268
3130
|
isRetailer: isRetailer,
|
|
3269
3131
|
version: state.product.version,
|
|
@@ -3351,13 +3213,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3351
3213
|
className: "desvincular",
|
|
3352
3214
|
title: "Dejar de ser hijo de este producto",
|
|
3353
3215
|
onClick: function onClick() {
|
|
3354
|
-
var _state$
|
|
3216
|
+
var _state$product26, _state$product27, _state$product28;
|
|
3355
3217
|
|
|
3356
3218
|
return setPorDesvincular({
|
|
3357
3219
|
mode: "self",
|
|
3358
|
-
childArticleId: (_state$
|
|
3359
|
-
childName: (_state$
|
|
3360
|
-
childUpc: (_state$
|
|
3220
|
+
childArticleId: (_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.id_article,
|
|
3221
|
+
childName: (_state$product27 = state.product) === null || _state$product27 === void 0 ? void 0 : _state$product27.name,
|
|
3222
|
+
childUpc: (_state$product28 = state.product) === null || _state$product28 === void 0 ? void 0 : _state$product28.upc,
|
|
3361
3223
|
parentName: family.parent.name,
|
|
3362
3224
|
parentUpc: family.parent.upc
|
|
3363
3225
|
});
|
|
@@ -3389,15 +3251,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3389
3251
|
className: "desvincular",
|
|
3390
3252
|
title: "Desvincular este hijo",
|
|
3391
3253
|
onClick: function onClick() {
|
|
3392
|
-
var _state$
|
|
3254
|
+
var _state$product29, _state$product30;
|
|
3393
3255
|
|
|
3394
3256
|
return setPorDesvincular({
|
|
3395
3257
|
mode: "child",
|
|
3396
3258
|
childArticleId: variant.articleId,
|
|
3397
3259
|
childName: variant.name,
|
|
3398
3260
|
childUpc: variant.upc,
|
|
3399
|
-
parentName: (_state$
|
|
3400
|
-
parentUpc: (_state$
|
|
3261
|
+
parentName: (_state$product29 = state.product) === null || _state$product29 === void 0 ? void 0 : _state$product29.name,
|
|
3262
|
+
parentUpc: (_state$product30 = state.product) === null || _state$product30 === void 0 ? void 0 : _state$product30.upc
|
|
3401
3263
|
});
|
|
3402
3264
|
},
|
|
3403
3265
|
children: "Desvincular"
|
|
@@ -3410,7 +3272,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3410
3272
|
className: "loading",
|
|
3411
3273
|
children: avisoFamilia
|
|
3412
3274
|
})]
|
|
3413
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3275
|
+
}), puedeAgruparse && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3414
3276
|
className: "variants-actions",
|
|
3415
3277
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
3416
3278
|
type: "button",
|
|
@@ -3433,7 +3295,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3433
3295
|
children: showGroup ? " ▴" : " ▾"
|
|
3434
3296
|
})]
|
|
3435
3297
|
})]
|
|
3436
|
-
}), showGroup && (variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3298
|
+
}), puedeAgruparse && showGroup && (variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3437
3299
|
className: "variants-family",
|
|
3438
3300
|
children: [((_variantGroup$members3 = variantGroup.members) !== null && _variantGroup$members3 !== void 0 ? _variantGroup$members3 : []).filter(function (miembro) {
|
|
3439
3301
|
return !miembro.isCurrent;
|
|
@@ -3518,10 +3380,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3518
3380
|
,
|
|
3519
3381
|
setShowVersionSelector: setShowVersionSelector // setSelectedImages={setSelectedImages} prop pasada asi: FullTabsMenu -> TabsMenu Pero en TabsMenu no se espera ninguna prop setSelectedImages
|
|
3520
3382
|
// actions
|
|
3521
|
-
// El botón actúa sobre la bandeja visible: en activos descargaba
|
|
3522
|
-
// las imágenes del producto, que no es lo que el usuario pidió.
|
|
3523
3383
|
,
|
|
3524
|
-
downloadImages:
|
|
3384
|
+
downloadImages: handleOnDownloadImages,
|
|
3525
3385
|
askToDeleteImages: handleOnAskToDeleteImages,
|
|
3526
3386
|
showSaveButton: isAuditorAssigned() || isUserAssignedToService(),
|
|
3527
3387
|
onClickSave: handleOnClickSave // validations
|
|
@@ -3531,7 +3391,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3531
3391
|
className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
|
|
3532
3392
|
id: "services-information-container",
|
|
3533
3393
|
children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
3534
|
-
children: [state.active_tab === "Descripción" && (((_state$
|
|
3394
|
+
children: [state.active_tab === "Descripción" && (((_state$product31 = state.product) === null || _state$product31 === void 0 ? void 0 : _state$product31.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
3535
3395
|
activeSection: state.active_tab,
|
|
3536
3396
|
inputGroup: state.descriptions_inputs[0],
|
|
3537
3397
|
updatedDescriptions: state.updated_descriptions_inputs
|
|
@@ -3540,7 +3400,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3540
3400
|
,
|
|
3541
3401
|
variant: (_state$services2 = state.services) === null || _state$services2 === void 0 ? void 0 : (_state$services2$data = _state$services2.datasheets) === null || _state$services2$data === void 0 ? void 0 : _state$services2$data.variant,
|
|
3542
3402
|
onRestoreInheritance: handleOnRestoreInheritance,
|
|
3543
|
-
articleId: (_state$
|
|
3403
|
+
articleId: (_state$product32 = state.product) === null || _state$product32 === void 0 ? void 0 : _state$product32.id_article,
|
|
3544
3404
|
version: state.product.version,
|
|
3545
3405
|
auditInputGroup: auditDescriptions[0],
|
|
3546
3406
|
setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
|
|
@@ -3549,7 +3409,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3549
3409
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
3550
3410
|
text: "No cuentas con este servicio",
|
|
3551
3411
|
headerType: "input-name-header"
|
|
3552
|
-
})), state.active_tab === "Ficha técnica" && (((_state$
|
|
3412
|
+
})), state.active_tab === "Ficha técnica" && (((_state$product33 = state.product) === null || _state$product33 === void 0 ? void 0 : _state$product33.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
3553
3413
|
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) {
|
|
3554
3414
|
var _state$services3, _state$services3$data;
|
|
3555
3415
|
|
|
@@ -3570,33 +3430,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3570
3430
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
3571
3431
|
text: "No cuentas con este servicio",
|
|
3572
3432
|
headerType: "input-name-header"
|
|
3573
|
-
})), state.active_tab === "Imágenes" && (((_state$
|
|
3574
|
-
children: [
|
|
3575
|
-
activeTray: currentTray,
|
|
3576
|
-
setActiveTray: setActiveTray,
|
|
3577
|
-
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,
|
|
3578
|
-
assetsCount: digitalAssets.assets.length
|
|
3579
|
-
}), currentTray === _GalleryTrayTabs.TRAYS.ASSETS && /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
|
|
3580
|
-
className: "container",
|
|
3581
|
-
style: {
|
|
3582
|
-
position: "relative"
|
|
3583
|
-
},
|
|
3584
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DigitalAssetsTray.DigitalAssetsTray, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, digitalAssets), {}, {
|
|
3585
|
-
unsaved: (0, _assets.countUnsavedAssets)(state),
|
|
3586
|
-
gridLayout: imageLayout,
|
|
3587
|
-
readOnly: !isAuditorAssigned() && !isUserAssignedToService(),
|
|
3588
|
-
selectedAssets: state.selected_assets,
|
|
3589
|
-
setSelectedAssets: handleOnSetSelectedAssets,
|
|
3590
|
-
setCheckAll: handleOnSetAllAssetsChecked
|
|
3591
|
-
}))
|
|
3592
|
-
}), currentTray === _GalleryTrayTabs.TRAYS.IMAGES && !imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
3433
|
+
})), state.active_tab === "Imágenes" && (((_state$product34 = state.product) === null || _state$product34 === void 0 ? void 0 : _state$product34.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
3434
|
+
children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
3593
3435
|
checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
|
|
3594
3436
|
,
|
|
3595
3437
|
setCheckAll: handleOnSetCheckAll // Toggler de true o false para el checkbox "Seleccionar todo"
|
|
3596
3438
|
,
|
|
3597
3439
|
setSelectedImages: handleOnSetSelectedImages // shotThd={shotThd} // No se usa?
|
|
3598
3440
|
|
|
3599
|
-
}),
|
|
3441
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
3600
3442
|
className: "container",
|
|
3601
3443
|
style: {
|
|
3602
3444
|
position: "relative"
|
|
@@ -3612,7 +3454,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3612
3454
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
3613
3455
|
children: thumbs()
|
|
3614
3456
|
})]
|
|
3615
|
-
})), ((_state$
|
|
3457
|
+
})), ((_state$images_values12 = state.images_values) === null || _state$images_values12 === void 0 ? void 0 : _state$images_values12.values.length) === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3616
3458
|
style: {
|
|
3617
3459
|
position: "absolute",
|
|
3618
3460
|
top: "50%",
|
|
@@ -3680,20 +3522,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3680
3522
|
reviewed: crossComment
|
|
3681
3523
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
3682
3524
|
buttonType: "circular-button accept-button",
|
|
3683
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
3684
|
-
return _regenerator.default.wrap(function
|
|
3525
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
3526
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
3685
3527
|
while (1) {
|
|
3686
|
-
switch (
|
|
3528
|
+
switch (_context19.prev = _context19.next) {
|
|
3687
3529
|
case 0:
|
|
3688
3530
|
setCrossComment(true);
|
|
3689
3531
|
commentRevised();
|
|
3690
3532
|
|
|
3691
3533
|
case 2:
|
|
3692
3534
|
case "end":
|
|
3693
|
-
return
|
|
3535
|
+
return _context19.stop();
|
|
3694
3536
|
}
|
|
3695
3537
|
}
|
|
3696
|
-
},
|
|
3538
|
+
}, _callee19);
|
|
3697
3539
|
}))
|
|
3698
3540
|
})]
|
|
3699
3541
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|