contentoh-components-library 21.6.49 → 21.6.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/launch.json +14 -0
- package/.env.test +1 -0
- package/dist/ai/prompts/attribute.prompt.js +28 -0
- package/dist/ai/prompts/description.prompt.js +33 -0
- package/dist/ai/schemas/attribute.schema.js +35 -0
- package/dist/ai/schemas/description.schema.js +27 -0
- package/dist/components/atoms/AssetPreview/AssetPreview.stories.js +118 -0
- package/dist/components/atoms/AssetPreview/index.js +150 -0
- package/dist/components/atoms/AssetPreview/styles.js +28 -0
- package/dist/components/atoms/IconFile/index.js +85 -2
- package/dist/components/atoms/IconFile/styles.js +1 -1
- package/dist/components/atoms/ProductImage/ProductImage.stories.js +70 -2
- package/dist/components/atoms/ProductImage/index.js +100 -27
- package/dist/components/atoms/ProductImage/styles.js +3 -1
- package/dist/components/molecules/EditionActiveImage/index.js +4 -2
- package/dist/components/molecules/GalleryAssetElement/GalleryAssetElement.stories.js +147 -0
- package/dist/components/molecules/GalleryAssetElement/index.js +178 -0
- package/dist/components/molecules/GalleryAssetElement/styles.js +26 -0
- package/dist/components/molecules/GalleryElement/index.js +13 -4
- package/dist/components/molecules/GalleryHeader/index.js +96 -24
- package/dist/components/molecules/GalleryHeader/styles.js +4 -1
- package/dist/components/molecules/GalleryTrayTabs/GalleryTrayTabs.stories.js +56 -0
- package/dist/components/molecules/GalleryTrayTabs/index.js +60 -0
- package/dist/components/molecules/GalleryTrayTabs/styles.js +20 -0
- package/dist/components/molecules/ImageSelector/index.js +1 -0
- package/dist/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +171 -0
- package/dist/components/organisms/DigitalAssetsTray/index.js +211 -0
- package/dist/components/organisms/DigitalAssetsTray/styles.js +22 -0
- package/dist/components/organisms/ImagePreviewer/index.js +1 -0
- package/dist/components/organisms/ProductImageModal/index.js +3 -2
- package/dist/components/organisms/PropagateChangesModal/index.js +12 -1
- package/dist/components/organisms/PropagateChangesModal/non-propagable.js +45 -0
- package/dist/components/pages/ProviderProductEdition/index.js +11 -1
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +330 -15
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +12 -2
- package/dist/components/pages/RetailerProductEdition/index.js +605 -414
- package/dist/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +1 -0
- package/dist/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +45 -145
- package/dist/global-files/data.js +16 -3
- package/dist/global-files/digital-assets/assetTypes.js +480 -0
- package/dist/global-files/digital-assets/assets.actions.js +64 -0
- package/dist/global-files/digital-assets/assets.adapter.js +304 -0
- package/dist/global-files/digital-assets/assets.mock.js +136 -0
- package/dist/global-files/digital-assets/assets.reducer.js +220 -0
- package/dist/global-files/digital-assets/uploadAssets.js +179 -0
- package/dist/global-files/digital-assets/useDigitalAssets.js +522 -0
- package/dist/index.js +142 -90
- package/docs/activos-digitales.md +273 -0
- package/package.json +1 -1
- package/src/components/atoms/AssetPreview/AssetPreview.stories.js +78 -0
- package/src/components/atoms/AssetPreview/index.js +119 -0
- package/src/components/atoms/AssetPreview/styles.js +190 -0
- package/src/components/atoms/IconFile/index.js +28 -1
- package/src/components/atoms/IconFile/styles.js +8 -0
- package/src/components/atoms/ProductImage/ProductImage.stories.js +38 -0
- package/src/components/atoms/ProductImage/index.js +95 -20
- package/src/components/atoms/ProductImage/styles.js +92 -7
- package/src/components/molecules/EditionActiveImage/index.js +2 -2
- package/src/components/molecules/GalleryAssetElement/GalleryAssetElement.stories.js +102 -0
- package/src/components/molecules/GalleryAssetElement/index.js +162 -0
- package/src/components/molecules/GalleryAssetElement/styles.js +159 -0
- package/src/components/molecules/GalleryElement/index.js +9 -0
- package/src/components/molecules/GalleryHeader/index.js +65 -13
- package/src/components/molecules/GalleryHeader/styles.js +2 -1
- package/src/components/molecules/GalleryTrayTabs/GalleryTrayTabs.stories.js +32 -0
- package/src/components/molecules/GalleryTrayTabs/index.js +41 -0
- package/src/components/molecules/GalleryTrayTabs/styles.js +52 -0
- package/src/components/molecules/ImageSelector/index.js +1 -0
- package/src/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +101 -0
- package/src/components/organisms/DigitalAssetsTray/index.js +189 -0
- package/src/components/organisms/DigitalAssetsTray/styles.js +183 -0
- package/src/components/organisms/ImagePreviewer/index.js +1 -0
- package/src/components/organisms/ProductImageModal/index.js +1 -0
- package/src/components/organisms/PropagateChangesModal/index.js +11 -1
- package/src/components/organisms/PropagateChangesModal/non-propagable.js +29 -0
- package/src/components/pages/ProviderProductEdition/index.js +10 -1
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +201 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +12 -0
- package/src/components/pages/RetailerProductEdition/index.js +366 -140
- package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +1 -0
- package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +51 -104
- package/src/global-files/data.js +17 -2
- package/src/global-files/digital-assets/assetTypes.js +419 -0
- package/src/global-files/digital-assets/assets.actions.js +50 -0
- package/src/global-files/digital-assets/assets.adapter.js +229 -0
- package/src/global-files/digital-assets/assets.mock.js +122 -0
- package/src/global-files/digital-assets/assets.reducer.js +197 -0
- package/src/global-files/digital-assets/uploadAssets.js +109 -0
- package/src/global-files/digital-assets/useDigitalAssets.js +329 -0
- package/src/index.js +4 -0
|
@@ -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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
21
|
-
|
|
22
20
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
23
21
|
|
|
22
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
23
|
+
|
|
24
24
|
var _react = require("react");
|
|
25
25
|
|
|
26
26
|
var _axios = _interopRequireDefault(require("axios"));
|
|
@@ -39,6 +39,10 @@ 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
|
+
|
|
42
46
|
var _GeneralButton = require("../../atoms/GeneralButton");
|
|
43
47
|
|
|
44
48
|
var _GenericModal = require("../../atoms/GenericModal");
|
|
@@ -53,6 +57,8 @@ var _GalleryElement = require("../../molecules/GalleryElement");
|
|
|
53
57
|
|
|
54
58
|
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
55
59
|
|
|
60
|
+
var _GalleryTrayTabs = require("../../molecules/GalleryTrayTabs");
|
|
61
|
+
|
|
56
62
|
var _HeaderTop = require("../../molecules/HeaderTop");
|
|
57
63
|
|
|
58
64
|
var _index = require("../../molecules/TagAndInput/index");
|
|
@@ -63,6 +69,8 @@ var _FullTabsMenu = require("../../organisms/FullTabsMenu");
|
|
|
63
69
|
|
|
64
70
|
var _ImageDataTable = require("../../organisms/ImageDataTable");
|
|
65
71
|
|
|
72
|
+
var _DigitalAssetsTray = require("../../organisms/DigitalAssetsTray");
|
|
73
|
+
|
|
66
74
|
var _ImagePreviewer = require("../../organisms/ImagePreviewer");
|
|
67
75
|
|
|
68
76
|
var _InputGroup = require("../../organisms/InputGroup");
|
|
@@ -81,6 +89,8 @@ var _VariantGroupModal = require("../../organisms/VariantGroupModal");
|
|
|
81
89
|
|
|
82
90
|
var _PropagateChangesModal = require("../../organisms/PropagateChangesModal");
|
|
83
91
|
|
|
92
|
+
var _nonPropagable = require("../../organisms/PropagateChangesModal/non-propagable");
|
|
93
|
+
|
|
84
94
|
var _api = require("../../organisms/LinkVariantsModal/api");
|
|
85
95
|
|
|
86
96
|
var _genericModalCheck = _interopRequireDefault(require("../../../assets/images/genericModal/genericModalCheck.svg"));
|
|
@@ -127,118 +137,8 @@ function obtenerDuracionVideoBase64(base64Data) {
|
|
|
127
137
|
});
|
|
128
138
|
}
|
|
129
139
|
|
|
130
|
-
function convertirVideoABase64(url) {
|
|
131
|
-
return new Promise(function (resolve, reject) {
|
|
132
|
-
var xhr = new XMLHttpRequest();
|
|
133
|
-
xhr.open("GET", url, true);
|
|
134
|
-
xhr.responseType = "blob";
|
|
135
|
-
|
|
136
|
-
xhr.onload = function () {
|
|
137
|
-
if (xhr.status === 200) {
|
|
138
|
-
var blob = xhr.response;
|
|
139
|
-
var reader = new FileReader();
|
|
140
|
-
|
|
141
|
-
reader.onloadend = function () {
|
|
142
|
-
resolve(reader.result);
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
reader.readAsDataURL(blob);
|
|
146
|
-
} else {
|
|
147
|
-
reject(new Error("Error al cargar el video"));
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
xhr.onerror = function () {
|
|
152
|
-
reject(new Error("Error de red al cargar el video"));
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
xhr.send();
|
|
156
|
-
});
|
|
157
|
-
} // Para videos ya guardados, `getImage` deja en `src` una URL del
|
|
158
|
-
// redimensionador de imágenes que no sirve para mp4. Descargamos el video
|
|
159
|
-
// desde S3 (srcDB) y generamos un thumbnail JPEG para mostrarlo en la galería.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
function regenerateVideoThumbnails(_x) {
|
|
163
|
-
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function _regenerateVideoThumbnails() {
|
|
167
|
-
_regenerateVideoThumbnails = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(values) {
|
|
168
|
-
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
169
|
-
while (1) {
|
|
170
|
-
switch (_context21.prev = _context21.next) {
|
|
171
|
-
case 0:
|
|
172
|
-
if (Array.isArray(values)) {
|
|
173
|
-
_context21.next = 2;
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return _context21.abrupt("return", values);
|
|
178
|
-
|
|
179
|
-
case 2:
|
|
180
|
-
return _context21.abrupt("return", Promise.all(values.map( /*#__PURE__*/function () {
|
|
181
|
-
var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(value) {
|
|
182
|
-
var base64, videoSrc, thumbnail;
|
|
183
|
-
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
184
|
-
while (1) {
|
|
185
|
-
switch (_context20.prev = _context20.next) {
|
|
186
|
-
case 0:
|
|
187
|
-
if (!((value === null || value === void 0 ? void 0 : value.ext) !== "mp4" || !(value !== null && value !== void 0 && value.srcDB))) {
|
|
188
|
-
_context20.next = 2;
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return _context20.abrupt("return", value);
|
|
193
|
-
|
|
194
|
-
case 2:
|
|
195
|
-
_context20.prev = 2;
|
|
196
|
-
_context20.next = 5;
|
|
197
|
-
return convertirVideoABase64("https://" + process.env.REACT_APP_IMAGES_BUCKET + ".s3.amazonaws.com/" + value.srcDB);
|
|
198
|
-
|
|
199
|
-
case 5:
|
|
200
|
-
base64 = _context20.sent;
|
|
201
|
-
videoSrc = "data:video/mp4;base64," + base64.split(",")[1];
|
|
202
|
-
_context20.next = 9;
|
|
203
|
-
return (0, _generateThumnail.default)(videoSrc, 2);
|
|
204
|
-
|
|
205
|
-
case 9:
|
|
206
|
-
thumbnail = _context20.sent;
|
|
207
|
-
return _context20.abrupt("return", (0, _objectSpread5.default)((0, _objectSpread5.default)({}, value), {}, {
|
|
208
|
-
src: thumbnail
|
|
209
|
-
}));
|
|
210
|
-
|
|
211
|
-
case 13:
|
|
212
|
-
_context20.prev = 13;
|
|
213
|
-
_context20.t0 = _context20["catch"](2);
|
|
214
|
-
console.error("Error al generar thumbnail del video:", _context20.t0);
|
|
215
|
-
return _context20.abrupt("return", value);
|
|
216
|
-
|
|
217
|
-
case 17:
|
|
218
|
-
case "end":
|
|
219
|
-
return _context20.stop();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}, _callee20, null, [[2, 13]]);
|
|
223
|
-
}));
|
|
224
|
-
|
|
225
|
-
return function (_x10) {
|
|
226
|
-
return _ref25.apply(this, arguments);
|
|
227
|
-
};
|
|
228
|
-
}())));
|
|
229
|
-
|
|
230
|
-
case 3:
|
|
231
|
-
case "end":
|
|
232
|
-
return _context21.stop();
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}, _callee21);
|
|
236
|
-
}));
|
|
237
|
-
return _regenerateVideoThumbnails.apply(this, arguments);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
140
|
var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
241
|
-
var _state$
|
|
141
|
+
var _state$product$id_art, _state$product, _state$product11, _family$variants, _state$product12, _state$product16, _state$errors, _family$variants2, _variantGroup$members2, _variantGroup$group, _state$product20, _state$product21, _state$product22, _state$active_retaile6, _state$product23, _state$product24, _state$product25, _variantGroup$group2, _location$state, _location$state2, _state$active_retaile7, _state$active_retaile8, _state$images_values$2, _state$images_values10, _state$images_values11, _state$images_values12, _state$images_values13, _state$product26, _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$product32, _state$services2, _state$services2$data, _state$product33, _state$product34, _state$datasheets_inp, _state$datasheets_inp2, _state$product35, _state$images_values$3, _state$images_values14, _state$images_values15, _state$images_values16, _state$images_values17, _state$comment;
|
|
242
142
|
|
|
243
143
|
var tabsSections = _ref.tabsSections,
|
|
244
144
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -246,7 +146,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
246
146
|
_ref$user = _ref.user,
|
|
247
147
|
user = _ref$user === void 0 ? {} : _ref$user,
|
|
248
148
|
token = _ref.token,
|
|
249
|
-
location = _ref.location
|
|
149
|
+
location = _ref.location,
|
|
150
|
+
_ref$enableDigitalAss = _ref.enableDigitalAssets,
|
|
151
|
+
enableDigitalAssets = _ref$enableDigitalAss === void 0 ? false : _ref$enableDigitalAss;
|
|
250
152
|
|
|
251
153
|
var _useProviderProductEd = (0, _providerProductEdition.useProviderProductEdition)(),
|
|
252
154
|
state = _useProviderProductEd.state,
|
|
@@ -255,6 +157,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
255
157
|
saveDescriptions = _useProviderProductEd.saveDescriptions,
|
|
256
158
|
updateImages = _useProviderProductEd.updateImages,
|
|
257
159
|
deleteImages = _useProviderProductEd.deleteImages,
|
|
160
|
+
saveAssets = _useProviderProductEd.saveAssets,
|
|
161
|
+
registerUploadedAssets = _useProviderProductEd.registerUploadedAssets,
|
|
258
162
|
handleOnDownloadImages = _useProviderProductEd.handleOnDownloadImages,
|
|
259
163
|
createComment = _useProviderProductEd.createComment;
|
|
260
164
|
|
|
@@ -521,7 +425,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
521
425
|
}, _callee, null, [[5, 18]]);
|
|
522
426
|
}));
|
|
523
427
|
|
|
524
|
-
return function (
|
|
428
|
+
return function (_x) {
|
|
525
429
|
return _ref2.apply(this, arguments);
|
|
526
430
|
};
|
|
527
431
|
}();
|
|
@@ -544,6 +448,66 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
544
448
|
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
545
449
|
openChangeStatusModal = _useState54[0],
|
|
546
450
|
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
|
+
};
|
|
547
511
|
|
|
548
512
|
var thumbs = function thumbs() {
|
|
549
513
|
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;
|
|
@@ -598,6 +562,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
598
562
|
},
|
|
599
563
|
updateApprovedInputsImages: function updateApprovedInputsImages(item) {
|
|
600
564
|
return console.log("updateApprovedInputsImages", item);
|
|
565
|
+
},
|
|
566
|
+
onSelect: function onSelect() {
|
|
567
|
+
return handleOnChangeCurrentImage(index);
|
|
601
568
|
}
|
|
602
569
|
}, index);
|
|
603
570
|
});
|
|
@@ -712,7 +679,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
712
679
|
|
|
713
680
|
var loadAuditableData = /*#__PURE__*/function () {
|
|
714
681
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
715
|
-
var _state$
|
|
682
|
+
var _state$product2, _state$product3, _state$product4;
|
|
716
683
|
|
|
717
684
|
var auditServices;
|
|
718
685
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
@@ -720,7 +687,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
720
687
|
switch (_context3.prev = _context3.next) {
|
|
721
688
|
case 0:
|
|
722
689
|
_context3.next = 2;
|
|
723
|
-
return (0, _data.getRetailerServices)((_state$
|
|
690
|
+
return (0, _data.getRetailerServices)((_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.id_article, (_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.categoryName, parseInt((_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.id_category), auditableVersion.version, token);
|
|
724
691
|
|
|
725
692
|
case 2:
|
|
726
693
|
auditServices = _context3.sent;
|
|
@@ -764,7 +731,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
764
731
|
_services$,
|
|
765
732
|
_retailerDatasheets$d,
|
|
766
733
|
_state$active_retaile2,
|
|
767
|
-
|
|
734
|
+
_services$0$inputs,
|
|
735
|
+
_services$2,
|
|
736
|
+
_state$product5,
|
|
768
737
|
id_article,
|
|
769
738
|
version,
|
|
770
739
|
id_order,
|
|
@@ -793,8 +762,6 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
793
762
|
descriptionsActiveRetailer,
|
|
794
763
|
activeRetailerId,
|
|
795
764
|
filteredValues,
|
|
796
|
-
orderedValuesWithThumbs,
|
|
797
|
-
filteredValuesWithThumbs,
|
|
798
765
|
_args4 = arguments;
|
|
799
766
|
|
|
800
767
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
@@ -812,7 +779,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
812
779
|
type: "SET_ERRORS",
|
|
813
780
|
payload: []
|
|
814
781
|
});
|
|
815
|
-
_state$
|
|
782
|
+
_state$product5 = state.product, id_article = _state$product5.id_article, version = _state$product5.version, id_order = _state$product5.id_order;
|
|
816
783
|
_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
|
|
817
784
|
|
|
818
785
|
data = [{
|
|
@@ -952,26 +919,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
952
919
|
return Number(input.id_retailer) === Number(activeRetailerId) && Number(input.id_image) === Number(value.image_id);
|
|
953
920
|
});
|
|
954
921
|
});
|
|
955
|
-
}); //
|
|
922
|
+
}); // Dispatch consolidado
|
|
956
923
|
|
|
957
|
-
_context4.next = 35;
|
|
958
|
-
return regenerateVideoThumbnails(orderedValues);
|
|
959
|
-
|
|
960
|
-
case 35:
|
|
961
|
-
orderedValuesWithThumbs = _context4.sent;
|
|
962
|
-
_context4.next = 38;
|
|
963
|
-
return regenerateVideoThumbnails(filteredValues);
|
|
964
|
-
|
|
965
|
-
case 38:
|
|
966
|
-
filteredValuesWithThumbs = _context4.sent;
|
|
967
|
-
// Dispatch consolidado
|
|
968
924
|
dispatch({
|
|
969
925
|
type: "SET_SERVICES",
|
|
970
926
|
payload: {
|
|
971
927
|
datasheets: services[0],
|
|
972
928
|
descriptions: services[1],
|
|
973
929
|
images: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
974
|
-
values:
|
|
930
|
+
values: orderedValues
|
|
975
931
|
})
|
|
976
932
|
}
|
|
977
933
|
});
|
|
@@ -993,7 +949,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
993
949
|
|
|
994
950
|
dispatch({
|
|
995
951
|
type: "SET_DATASHEETS_INPUTS",
|
|
996
|
-
|
|
952
|
+
// `services[0]?` por lo mismo que el fallback de arriba: la lectura de
|
|
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 : {}]
|
|
997
958
|
});
|
|
998
959
|
dispatch({
|
|
999
960
|
type: "SET_DESCRIPTIONS_INPUTS",
|
|
@@ -1002,9 +963,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1002
963
|
dispatch({
|
|
1003
964
|
type: "SET_IMAGES_VALUES",
|
|
1004
965
|
payload: (0, _objectSpread5.default)((0, _objectSpread5.default)({}, services[2]), {}, {
|
|
1005
|
-
values:
|
|
966
|
+
values: filteredValues
|
|
1006
967
|
})
|
|
1007
|
-
});
|
|
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
|
+
|
|
1008
980
|
|
|
1009
981
|
dispatch({
|
|
1010
982
|
type: "SET_MISSING_REQUIRED_FIELDS",
|
|
@@ -1015,11 +987,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1015
987
|
loadAuditableData();
|
|
1016
988
|
}
|
|
1017
989
|
|
|
1018
|
-
_context4.next =
|
|
990
|
+
_context4.next = 49;
|
|
1019
991
|
break;
|
|
1020
992
|
|
|
1021
|
-
case
|
|
1022
|
-
_context4.prev =
|
|
993
|
+
case 45:
|
|
994
|
+
_context4.prev = 45;
|
|
1023
995
|
_context4.t0 = _context4["catch"](2);
|
|
1024
996
|
console.log("Error loading data: ", _context4.t0);
|
|
1025
997
|
dispatch({
|
|
@@ -1027,20 +999,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1027
999
|
payload: [_context4.t0.message]
|
|
1028
1000
|
});
|
|
1029
1001
|
|
|
1030
|
-
case
|
|
1031
|
-
_context4.prev =
|
|
1002
|
+
case 49:
|
|
1003
|
+
_context4.prev = 49;
|
|
1032
1004
|
dispatch({
|
|
1033
1005
|
type: "SET_LOADING",
|
|
1034
1006
|
payload: false
|
|
1035
1007
|
});
|
|
1036
|
-
return _context4.finish(
|
|
1008
|
+
return _context4.finish(49);
|
|
1037
1009
|
|
|
1038
|
-
case
|
|
1010
|
+
case 52:
|
|
1039
1011
|
case "end":
|
|
1040
1012
|
return _context4.stop();
|
|
1041
1013
|
}
|
|
1042
1014
|
}
|
|
1043
|
-
}, _callee4, null, [[2,
|
|
1015
|
+
}, _callee4, null, [[2, 45, 49, 52]]);
|
|
1044
1016
|
}));
|
|
1045
1017
|
|
|
1046
1018
|
return function loadData() {
|
|
@@ -1103,9 +1075,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1103
1075
|
};
|
|
1104
1076
|
|
|
1105
1077
|
var isAuditorAssigned = function isAuditorAssigned() {
|
|
1106
|
-
var _state$
|
|
1078
|
+
var _state$product6;
|
|
1107
1079
|
|
|
1108
|
-
return ((_state$
|
|
1080
|
+
return ((_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.id_auditor) === (user === null || user === void 0 ? void 0 : user.id_user);
|
|
1109
1081
|
};
|
|
1110
1082
|
/**
|
|
1111
1083
|
* ¿Ocupo este slot EN ESTE producto?
|
|
@@ -1118,9 +1090,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1118
1090
|
|
|
1119
1091
|
|
|
1120
1092
|
var isAssignedAs = function isAssignedAs(rol, concept) {
|
|
1121
|
-
var _state$
|
|
1093
|
+
var _state$product7;
|
|
1122
1094
|
|
|
1123
|
-
var assigned = (_state$
|
|
1095
|
+
var assigned = (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7["id_".concat(concept, "_").concat(rol)];
|
|
1124
1096
|
return !!assigned && assigned === (user === null || user === void 0 ? void 0 : user.id_user);
|
|
1125
1097
|
};
|
|
1126
1098
|
|
|
@@ -1189,28 +1161,42 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1189
1161
|
})[0]) === null || _statusByRetailer$fil === void 0 ? void 0 : _statusByRetailer$fil.status) || "-";
|
|
1190
1162
|
return currentStatus;
|
|
1191
1163
|
};
|
|
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
|
+
*/
|
|
1192
1172
|
|
|
1193
|
-
var handleOnClickSaveImages = /*#__PURE__*/function () {
|
|
1194
|
-
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1195
|
-
var _state$product7, _state$product7$servi;
|
|
1196
1173
|
|
|
1174
|
+
var handleOnSaveAssets = /*#__PURE__*/function () {
|
|
1175
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1176
|
+
var guardado;
|
|
1197
1177
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
1198
1178
|
while (1) {
|
|
1199
1179
|
switch (_context5.prev = _context5.next) {
|
|
1200
1180
|
case 0:
|
|
1201
|
-
|
|
1181
|
+
_context5.next = 2;
|
|
1182
|
+
return saveAssets(token);
|
|
1183
|
+
|
|
1184
|
+
case 2:
|
|
1185
|
+
guardado = _context5.sent;
|
|
1186
|
+
|
|
1187
|
+
if (guardado) {
|
|
1202
1188
|
_context5.next = 5;
|
|
1203
1189
|
break;
|
|
1204
1190
|
}
|
|
1205
1191
|
|
|
1206
|
-
_context5.
|
|
1207
|
-
return updateImages(token);
|
|
1192
|
+
return _context5.abrupt("return");
|
|
1208
1193
|
|
|
1209
|
-
case
|
|
1210
|
-
|
|
1194
|
+
case 5:
|
|
1195
|
+
assetsLoadedFor.current = null;
|
|
1196
|
+
_context5.next = 8;
|
|
1211
1197
|
return loadData(false);
|
|
1212
1198
|
|
|
1213
|
-
case
|
|
1199
|
+
case 8:
|
|
1214
1200
|
case "end":
|
|
1215
1201
|
return _context5.stop();
|
|
1216
1202
|
}
|
|
@@ -1218,10 +1204,55 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1218
1204
|
}, _callee5);
|
|
1219
1205
|
}));
|
|
1220
1206
|
|
|
1221
|
-
return function
|
|
1207
|
+
return function handleOnSaveAssets() {
|
|
1222
1208
|
return _ref9.apply(this, arguments);
|
|
1223
1209
|
};
|
|
1224
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
|
+
return function handleOnClickSaveImages() {
|
|
1253
|
+
return _ref10.apply(this, arguments);
|
|
1254
|
+
};
|
|
1255
|
+
}();
|
|
1225
1256
|
/*
|
|
1226
1257
|
Trae la familia: los hijos del producto, o sus hermanos si el abierto es
|
|
1227
1258
|
una de ellas. Se pide al abrir la sección y no al montar la pantalla: la
|
|
@@ -1230,31 +1261,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1230
1261
|
|
|
1231
1262
|
|
|
1232
1263
|
var loadFamily = /*#__PURE__*/function () {
|
|
1233
|
-
var
|
|
1264
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
1234
1265
|
var forzar,
|
|
1235
|
-
_state$
|
|
1266
|
+
_state$product9,
|
|
1236
1267
|
res,
|
|
1237
1268
|
data,
|
|
1238
|
-
|
|
1269
|
+
_args7 = arguments;
|
|
1239
1270
|
|
|
1240
|
-
return _regenerator.default.wrap(function
|
|
1271
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1241
1272
|
while (1) {
|
|
1242
|
-
switch (
|
|
1273
|
+
switch (_context7.prev = _context7.next) {
|
|
1243
1274
|
case 0:
|
|
1244
|
-
forzar =
|
|
1275
|
+
forzar = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
|
|
1245
1276
|
|
|
1246
1277
|
if (!(family && !forzar)) {
|
|
1247
|
-
|
|
1278
|
+
_context7.next = 3;
|
|
1248
1279
|
break;
|
|
1249
1280
|
}
|
|
1250
1281
|
|
|
1251
|
-
return
|
|
1282
|
+
return _context7.abrupt("return", family);
|
|
1252
1283
|
|
|
1253
1284
|
case 3:
|
|
1254
|
-
|
|
1255
|
-
|
|
1285
|
+
_context7.prev = 3;
|
|
1286
|
+
_context7.next = 6;
|
|
1256
1287
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/family"), {
|
|
1257
|
-
articleId: (_state$
|
|
1288
|
+
articleId: (_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.id_article
|
|
1258
1289
|
}, {
|
|
1259
1290
|
headers: {
|
|
1260
1291
|
Authorization: token
|
|
@@ -1262,32 +1293,32 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1262
1293
|
});
|
|
1263
1294
|
|
|
1264
1295
|
case 6:
|
|
1265
|
-
res =
|
|
1296
|
+
res = _context7.sent;
|
|
1266
1297
|
data = (0, _api.readPayload)(res);
|
|
1267
1298
|
setFamily(data);
|
|
1268
|
-
return
|
|
1299
|
+
return _context7.abrupt("return", data);
|
|
1269
1300
|
|
|
1270
1301
|
case 12:
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
console.error("loadFamily: ",
|
|
1302
|
+
_context7.prev = 12;
|
|
1303
|
+
_context7.t0 = _context7["catch"](3);
|
|
1304
|
+
console.error("loadFamily: ", _context7.t0);
|
|
1274
1305
|
setFamily({
|
|
1275
1306
|
variants: [],
|
|
1276
1307
|
parent: null,
|
|
1277
1308
|
error: true
|
|
1278
1309
|
});
|
|
1279
|
-
return
|
|
1310
|
+
return _context7.abrupt("return", null);
|
|
1280
1311
|
|
|
1281
1312
|
case 17:
|
|
1282
1313
|
case "end":
|
|
1283
|
-
return
|
|
1314
|
+
return _context7.stop();
|
|
1284
1315
|
}
|
|
1285
1316
|
}
|
|
1286
|
-
},
|
|
1317
|
+
}, _callee7, null, [[3, 12]]);
|
|
1287
1318
|
}));
|
|
1288
1319
|
|
|
1289
1320
|
return function loadFamily() {
|
|
1290
|
-
return
|
|
1321
|
+
return _ref11.apply(this, arguments);
|
|
1291
1322
|
};
|
|
1292
1323
|
}();
|
|
1293
1324
|
/*
|
|
@@ -1304,16 +1335,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1304
1335
|
|
|
1305
1336
|
|
|
1306
1337
|
(0, _react.useEffect)(function () {
|
|
1307
|
-
var _state$
|
|
1338
|
+
var _state$product10;
|
|
1308
1339
|
|
|
1309
|
-
if (!((_state$
|
|
1340
|
+
if (!((_state$product10 = state.product) !== null && _state$product10 !== void 0 && _state$product10.id_article)) return;
|
|
1310
1341
|
loadFamily(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1311
|
-
}, [(_state$
|
|
1342
|
+
}, [(_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.id_article]); // El conteo sale de la familia recién consultada, no del producto.
|
|
1312
1343
|
|
|
1313
1344
|
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) {
|
|
1314
1345
|
return !v.isCurrent;
|
|
1315
1346
|
}).length;
|
|
1316
|
-
var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$
|
|
1347
|
+
var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$product12 = state.product) !== null && _state$product12 !== void 0 && _state$product12.parentArticleId) : !!(family !== null && family !== void 0 && family.parent);
|
|
1317
1348
|
/*
|
|
1318
1349
|
Abre otro producto de la familia.
|
|
1319
1350
|
Cambiar la URL no basta: esta pantalla no lee el producto de la ruta sino de
|
|
@@ -1343,14 +1374,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1343
1374
|
*/
|
|
1344
1375
|
|
|
1345
1376
|
var handleOnUnlinked = function handleOnUnlinked(result) {
|
|
1346
|
-
var _state$product$varian, _state$
|
|
1377
|
+
var _state$product$varian, _state$product13, _updatedProduct$varia;
|
|
1347
1378
|
|
|
1348
1379
|
if (!result) return;
|
|
1349
1380
|
var updatedProduct = result.mode === "self" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1350
1381
|
parentArticleId: null,
|
|
1351
1382
|
variantsCount: 0
|
|
1352
1383
|
}) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1353
|
-
variantsCount: Math.max(((_state$product$varian = (_state$
|
|
1384
|
+
variantsCount: Math.max(((_state$product$varian = (_state$product13 = state.product) === null || _state$product13 === void 0 ? void 0 : _state$product13.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 1) - 1, 0)
|
|
1354
1385
|
});
|
|
1355
1386
|
dispatch({
|
|
1356
1387
|
type: "SET_PRODUCT",
|
|
@@ -1402,31 +1433,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1402
1433
|
|
|
1403
1434
|
|
|
1404
1435
|
var loadVariantGroup = /*#__PURE__*/function () {
|
|
1405
|
-
var
|
|
1436
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
1406
1437
|
var forzar,
|
|
1407
|
-
_state$
|
|
1438
|
+
_state$product14,
|
|
1408
1439
|
res,
|
|
1409
1440
|
data,
|
|
1410
|
-
|
|
1441
|
+
_args8 = arguments;
|
|
1411
1442
|
|
|
1412
|
-
return _regenerator.default.wrap(function
|
|
1443
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1413
1444
|
while (1) {
|
|
1414
|
-
switch (
|
|
1445
|
+
switch (_context8.prev = _context8.next) {
|
|
1415
1446
|
case 0:
|
|
1416
|
-
forzar =
|
|
1447
|
+
forzar = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : false;
|
|
1417
1448
|
|
|
1418
1449
|
if (!(variantGroup && !forzar)) {
|
|
1419
|
-
|
|
1450
|
+
_context8.next = 3;
|
|
1420
1451
|
break;
|
|
1421
1452
|
}
|
|
1422
1453
|
|
|
1423
|
-
return
|
|
1454
|
+
return _context8.abrupt("return", variantGroup);
|
|
1424
1455
|
|
|
1425
1456
|
case 3:
|
|
1426
|
-
|
|
1427
|
-
|
|
1457
|
+
_context8.prev = 3;
|
|
1458
|
+
_context8.next = 6;
|
|
1428
1459
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/group"), {
|
|
1429
|
-
articleId: (_state$
|
|
1460
|
+
articleId: (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.id_article
|
|
1430
1461
|
}, {
|
|
1431
1462
|
headers: {
|
|
1432
1463
|
Authorization: token
|
|
@@ -1434,54 +1465,54 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1434
1465
|
});
|
|
1435
1466
|
|
|
1436
1467
|
case 6:
|
|
1437
|
-
res =
|
|
1468
|
+
res = _context8.sent;
|
|
1438
1469
|
data = (0, _api.readPayload)(res);
|
|
1439
1470
|
setVariantGroup(data);
|
|
1440
|
-
return
|
|
1471
|
+
return _context8.abrupt("return", data);
|
|
1441
1472
|
|
|
1442
1473
|
case 12:
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
console.error("loadVariantGroup: ",
|
|
1474
|
+
_context8.prev = 12;
|
|
1475
|
+
_context8.t0 = _context8["catch"](3);
|
|
1476
|
+
console.error("loadVariantGroup: ", _context8.t0);
|
|
1446
1477
|
setVariantGroup({
|
|
1447
1478
|
group: null,
|
|
1448
1479
|
members: [],
|
|
1449
1480
|
error: true
|
|
1450
1481
|
});
|
|
1451
|
-
return
|
|
1482
|
+
return _context8.abrupt("return", null);
|
|
1452
1483
|
|
|
1453
1484
|
case 17:
|
|
1454
1485
|
case "end":
|
|
1455
|
-
return
|
|
1486
|
+
return _context8.stop();
|
|
1456
1487
|
}
|
|
1457
1488
|
}
|
|
1458
|
-
},
|
|
1489
|
+
}, _callee8, null, [[3, 12]]);
|
|
1459
1490
|
}));
|
|
1460
1491
|
|
|
1461
1492
|
return function loadVariantGroup() {
|
|
1462
|
-
return
|
|
1493
|
+
return _ref12.apply(this, arguments);
|
|
1463
1494
|
};
|
|
1464
1495
|
}();
|
|
1465
1496
|
|
|
1466
1497
|
(0, _react.useEffect)(function () {
|
|
1467
|
-
var _state$
|
|
1498
|
+
var _state$product15;
|
|
1468
1499
|
|
|
1469
|
-
if (!((_state$
|
|
1500
|
+
if (!((_state$product15 = state.product) !== null && _state$product15 !== void 0 && _state$product15.id_article)) return;
|
|
1470
1501
|
loadVariantGroup(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1471
|
-
}, [(_state$
|
|
1502
|
+
}, [(_state$product16 = state.product) === null || _state$product16 === void 0 ? void 0 : _state$product16.id_article]);
|
|
1472
1503
|
|
|
1473
1504
|
var handleOnLeaveGroup = /*#__PURE__*/function () {
|
|
1474
|
-
var
|
|
1475
|
-
var _state$
|
|
1505
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
1506
|
+
var _state$product17, res;
|
|
1476
1507
|
|
|
1477
|
-
return _regenerator.default.wrap(function
|
|
1508
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1478
1509
|
while (1) {
|
|
1479
|
-
switch (
|
|
1510
|
+
switch (_context9.prev = _context9.next) {
|
|
1480
1511
|
case 0:
|
|
1481
|
-
|
|
1482
|
-
|
|
1512
|
+
_context9.prev = 0;
|
|
1513
|
+
_context9.next = 3;
|
|
1483
1514
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/leave"), {
|
|
1484
|
-
articleId: (_state$
|
|
1515
|
+
articleId: (_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.id_article
|
|
1485
1516
|
}, {
|
|
1486
1517
|
headers: {
|
|
1487
1518
|
Authorization: token
|
|
@@ -1489,16 +1520,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1489
1520
|
});
|
|
1490
1521
|
|
|
1491
1522
|
case 3:
|
|
1492
|
-
res =
|
|
1523
|
+
res = _context9.sent;
|
|
1493
1524
|
setVariantGroup((0, _api.readPayload)(res));
|
|
1494
1525
|
setShowGroup(false);
|
|
1495
|
-
|
|
1526
|
+
_context9.next = 12;
|
|
1496
1527
|
break;
|
|
1497
1528
|
|
|
1498
1529
|
case 8:
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
console.error("leaveVariantGroup: ",
|
|
1530
|
+
_context9.prev = 8;
|
|
1531
|
+
_context9.t0 = _context9["catch"](0);
|
|
1532
|
+
console.error("leaveVariantGroup: ", _context9.t0);
|
|
1502
1533
|
dispatch({
|
|
1503
1534
|
type: "SET_MODAL",
|
|
1504
1535
|
payload: {
|
|
@@ -1523,29 +1554,29 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1523
1554
|
|
|
1524
1555
|
case 12:
|
|
1525
1556
|
case "end":
|
|
1526
|
-
return
|
|
1557
|
+
return _context9.stop();
|
|
1527
1558
|
}
|
|
1528
1559
|
}
|
|
1529
|
-
},
|
|
1560
|
+
}, _callee9, null, [[0, 8]]);
|
|
1530
1561
|
}));
|
|
1531
1562
|
|
|
1532
1563
|
return function handleOnLeaveGroup() {
|
|
1533
|
-
return
|
|
1564
|
+
return _ref13.apply(this, arguments);
|
|
1534
1565
|
};
|
|
1535
1566
|
}();
|
|
1536
1567
|
|
|
1537
1568
|
var openFamilyMember = /*#__PURE__*/function () {
|
|
1538
|
-
var
|
|
1539
|
-
var _readPayload, res,
|
|
1569
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(articleId) {
|
|
1570
|
+
var _readPayload, res, _ref15, data, encontrado;
|
|
1540
1571
|
|
|
1541
|
-
return _regenerator.default.wrap(function
|
|
1572
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1542
1573
|
while (1) {
|
|
1543
|
-
switch (
|
|
1574
|
+
switch (_context10.prev = _context10.next) {
|
|
1544
1575
|
case 0:
|
|
1545
1576
|
setLoadingVariant(articleId);
|
|
1546
1577
|
setAvisoFamilia(null);
|
|
1547
|
-
|
|
1548
|
-
|
|
1578
|
+
_context10.prev = 2;
|
|
1579
|
+
_context10.next = 5;
|
|
1549
1580
|
return _axios.default.get("".concat(process.env.REACT_APP_ORDERED_SERVICES_ENDPOINT), {
|
|
1550
1581
|
params: {
|
|
1551
1582
|
filterByIdArticle: articleId,
|
|
@@ -1557,11 +1588,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1557
1588
|
});
|
|
1558
1589
|
|
|
1559
1590
|
case 5:
|
|
1560
|
-
res =
|
|
1591
|
+
res = _context10.sent;
|
|
1561
1592
|
// read-order-services responde { total, data: [...] }. La vista trae una
|
|
1562
1593
|
// fila por orden, así que puede haber varias del mismo artículo; llegan
|
|
1563
1594
|
// ordenadas por order_id DESC y la primera es la orden más reciente.
|
|
1564
|
-
|
|
1595
|
+
_ref15 = (_readPayload = (0, _api.readPayload)(res)) !== null && _readPayload !== void 0 ? _readPayload : {}, data = _ref15.data;
|
|
1565
1596
|
encontrado = (data !== null && data !== void 0 ? data : []).find(function (item) {
|
|
1566
1597
|
var _item$article;
|
|
1567
1598
|
|
|
@@ -1569,12 +1600,12 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1569
1600
|
});
|
|
1570
1601
|
|
|
1571
1602
|
if (encontrado) {
|
|
1572
|
-
|
|
1603
|
+
_context10.next = 11;
|
|
1573
1604
|
break;
|
|
1574
1605
|
}
|
|
1575
1606
|
|
|
1576
1607
|
setAvisoFamilia("Ese producto no está en ninguna orden de trabajo, así que no se puede abrir desde aquí.");
|
|
1577
|
-
return
|
|
1608
|
+
return _context10.abrupt("return");
|
|
1578
1609
|
|
|
1579
1610
|
case 11:
|
|
1580
1611
|
sessionStorage.setItem("productSelected", JSON.stringify(encontrado));
|
|
@@ -1585,30 +1616,30 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1585
1616
|
product: [encontrado]
|
|
1586
1617
|
}));
|
|
1587
1618
|
window.location.assign("/EditProducts");
|
|
1588
|
-
|
|
1619
|
+
_context10.next = 21;
|
|
1589
1620
|
break;
|
|
1590
1621
|
|
|
1591
1622
|
case 17:
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
console.error("openFamilyMember: ",
|
|
1623
|
+
_context10.prev = 17;
|
|
1624
|
+
_context10.t0 = _context10["catch"](2);
|
|
1625
|
+
console.error("openFamilyMember: ", _context10.t0);
|
|
1595
1626
|
setAvisoFamilia("No se pudo abrir ese producto. Intenta de nuevo.");
|
|
1596
1627
|
|
|
1597
1628
|
case 21:
|
|
1598
|
-
|
|
1629
|
+
_context10.prev = 21;
|
|
1599
1630
|
setLoadingVariant(null);
|
|
1600
|
-
return
|
|
1631
|
+
return _context10.finish(21);
|
|
1601
1632
|
|
|
1602
1633
|
case 24:
|
|
1603
1634
|
case "end":
|
|
1604
|
-
return
|
|
1635
|
+
return _context10.stop();
|
|
1605
1636
|
}
|
|
1606
1637
|
}
|
|
1607
|
-
},
|
|
1638
|
+
}, _callee10, null, [[2, 17, 21, 24]]);
|
|
1608
1639
|
}));
|
|
1609
1640
|
|
|
1610
|
-
return function openFamilyMember(
|
|
1611
|
-
return
|
|
1641
|
+
return function openFamilyMember(_x2) {
|
|
1642
|
+
return _ref14.apply(this, arguments);
|
|
1612
1643
|
};
|
|
1613
1644
|
}();
|
|
1614
1645
|
/*
|
|
@@ -1619,11 +1650,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1619
1650
|
|
|
1620
1651
|
|
|
1621
1652
|
var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
|
|
1622
|
-
var _state$product$varian2, _state$
|
|
1653
|
+
var _state$product$varian2, _state$product18, _result$linked, _result$parentArticle;
|
|
1623
1654
|
|
|
1624
1655
|
if (!result) return;
|
|
1625
1656
|
var updatedProduct = result.mode === "children" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1626
|
-
variantsCount: ((_state$product$varian2 = (_state$
|
|
1657
|
+
variantsCount: ((_state$product$varian2 = (_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
|
|
1627
1658
|
}) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1628
1659
|
parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
|
|
1629
1660
|
variantsCount: 0
|
|
@@ -1697,31 +1728,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1697
1728
|
|
|
1698
1729
|
|
|
1699
1730
|
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
1700
|
-
var
|
|
1701
|
-
var _state$
|
|
1731
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(attributeId) {
|
|
1732
|
+
var _state$product19;
|
|
1702
1733
|
|
|
1703
1734
|
var kind,
|
|
1704
1735
|
esDescripcion,
|
|
1705
1736
|
res,
|
|
1706
1737
|
data,
|
|
1707
|
-
|
|
1708
|
-
return _regenerator.default.wrap(function
|
|
1738
|
+
_args11 = arguments;
|
|
1739
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1709
1740
|
while (1) {
|
|
1710
|
-
switch (
|
|
1741
|
+
switch (_context11.prev = _context11.next) {
|
|
1711
1742
|
case 0:
|
|
1712
|
-
kind =
|
|
1743
|
+
kind = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : "attribute";
|
|
1713
1744
|
|
|
1714
|
-
if (!(!attributeId || !((_state$
|
|
1715
|
-
|
|
1745
|
+
if (!(!attributeId || !((_state$product19 = state.product) !== null && _state$product19 !== void 0 && _state$product19.id_article))) {
|
|
1746
|
+
_context11.next = 3;
|
|
1716
1747
|
break;
|
|
1717
1748
|
}
|
|
1718
1749
|
|
|
1719
|
-
return
|
|
1750
|
+
return _context11.abrupt("return");
|
|
1720
1751
|
|
|
1721
1752
|
case 3:
|
|
1722
1753
|
esDescripcion = kind === "description";
|
|
1723
|
-
|
|
1724
|
-
|
|
1754
|
+
_context11.prev = 4;
|
|
1755
|
+
_context11.next = 7;
|
|
1725
1756
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread5.default)({
|
|
1726
1757
|
articleId: state.product.id_article
|
|
1727
1758
|
}, esDescripcion ? {
|
|
@@ -1735,11 +1766,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1735
1766
|
});
|
|
1736
1767
|
|
|
1737
1768
|
case 7:
|
|
1738
|
-
res =
|
|
1769
|
+
res = _context11.sent;
|
|
1739
1770
|
data = (0, _api.readPayload)(res);
|
|
1740
1771
|
|
|
1741
1772
|
if (!esDescripcion) {
|
|
1742
|
-
|
|
1773
|
+
_context11.next = 12;
|
|
1743
1774
|
break;
|
|
1744
1775
|
}
|
|
1745
1776
|
|
|
@@ -1753,7 +1784,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1753
1784
|
};
|
|
1754
1785
|
})
|
|
1755
1786
|
});
|
|
1756
|
-
return
|
|
1787
|
+
return _context11.abrupt("return");
|
|
1757
1788
|
|
|
1758
1789
|
case 12:
|
|
1759
1790
|
dispatch({
|
|
@@ -1766,24 +1797,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1766
1797
|
};
|
|
1767
1798
|
})
|
|
1768
1799
|
});
|
|
1769
|
-
|
|
1800
|
+
_context11.next = 18;
|
|
1770
1801
|
break;
|
|
1771
1802
|
|
|
1772
1803
|
case 15:
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
console.error("restoreInheritance: ",
|
|
1804
|
+
_context11.prev = 15;
|
|
1805
|
+
_context11.t0 = _context11["catch"](4);
|
|
1806
|
+
console.error("restoreInheritance: ", _context11.t0);
|
|
1776
1807
|
|
|
1777
1808
|
case 18:
|
|
1778
1809
|
case "end":
|
|
1779
|
-
return
|
|
1810
|
+
return _context11.stop();
|
|
1780
1811
|
}
|
|
1781
1812
|
}
|
|
1782
|
-
},
|
|
1813
|
+
}, _callee11, null, [[4, 15]]);
|
|
1783
1814
|
}));
|
|
1784
1815
|
|
|
1785
|
-
return function handleOnRestoreInheritance(
|
|
1786
|
-
return
|
|
1816
|
+
return function handleOnRestoreInheritance(_x3) {
|
|
1817
|
+
return _ref16.apply(this, arguments);
|
|
1787
1818
|
};
|
|
1788
1819
|
}();
|
|
1789
1820
|
/*
|
|
@@ -1797,7 +1828,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1797
1828
|
|
|
1798
1829
|
var retailerId = (_state$active_retaile4 = state.active_retailer) === null || _state$active_retaile4 === void 0 ? void 0 : _state$active_retaile4.id_retailer;
|
|
1799
1830
|
var inputs = (_state$services$datas = (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas2 = _state$services.datasheets) === null || _state$services$datas2 === void 0 ? void 0 : _state$services$datas2.inputs) !== null && _state$services$datas !== void 0 ? _state$services$datas : {};
|
|
1800
|
-
|
|
1831
|
+
var cambios = ((_state$updated_datash = state.updated_datasheets_inputs) !== null && _state$updated_datash !== void 0 ? _state$updated_datash : []).map(function (item) {
|
|
1801
1832
|
var _input$name;
|
|
1802
1833
|
|
|
1803
1834
|
var input = inputs["".concat(item.attributeId, "_").concat(retailerId)];
|
|
@@ -1807,48 +1838,56 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1807
1838
|
value: item.value
|
|
1808
1839
|
};
|
|
1809
1840
|
});
|
|
1841
|
+
/*
|
|
1842
|
+
UPC y SKU se quitan aquí y no dentro del diálogo porque esta lista también
|
|
1843
|
+
decide SI el diálogo se abre. Editar solo el UPC no tiene nada que
|
|
1844
|
+
propagar, así que preguntarlo sería pedirle al usuario una decisión sobre
|
|
1845
|
+
un conjunto vacío.
|
|
1846
|
+
*/
|
|
1847
|
+
|
|
1848
|
+
return (0, _nonPropagable.soloPropagables)(cambios);
|
|
1810
1849
|
};
|
|
1811
1850
|
|
|
1812
1851
|
var handleOnClickSave = /*#__PURE__*/function () {
|
|
1813
|
-
var
|
|
1852
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1814
1853
|
var _familia$variants, _variantGroup$members, cambios, familia, hijos, companeras;
|
|
1815
1854
|
|
|
1816
|
-
return _regenerator.default.wrap(function
|
|
1855
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1817
1856
|
while (1) {
|
|
1818
|
-
switch (
|
|
1857
|
+
switch (_context12.prev = _context12.next) {
|
|
1819
1858
|
case 0:
|
|
1820
1859
|
if (!(state.saving || preparandoPropagacion)) {
|
|
1821
|
-
|
|
1860
|
+
_context12.next = 2;
|
|
1822
1861
|
break;
|
|
1823
1862
|
}
|
|
1824
1863
|
|
|
1825
|
-
return
|
|
1864
|
+
return _context12.abrupt("return");
|
|
1826
1865
|
|
|
1827
1866
|
case 2:
|
|
1828
|
-
|
|
1829
|
-
|
|
1867
|
+
_context12.t0 = state.active_tab;
|
|
1868
|
+
_context12.next = _context12.t0 === "Descripción" ? 5 : _context12.t0 === "Ficha técnica" ? 8 : _context12.t0 === "Imágenes" ? 33 : 40;
|
|
1830
1869
|
break;
|
|
1831
1870
|
|
|
1832
1871
|
case 5:
|
|
1833
|
-
|
|
1872
|
+
_context12.next = 7;
|
|
1834
1873
|
return saveDescriptions(token);
|
|
1835
1874
|
|
|
1836
1875
|
case 7:
|
|
1837
|
-
return
|
|
1876
|
+
return _context12.abrupt("break", 41);
|
|
1838
1877
|
|
|
1839
1878
|
case 8:
|
|
1840
1879
|
cambios = cambiosDeFichaTecnica();
|
|
1841
1880
|
|
|
1842
1881
|
if (!(cambios.length === 0)) {
|
|
1843
|
-
|
|
1882
|
+
_context12.next = 13;
|
|
1844
1883
|
break;
|
|
1845
1884
|
}
|
|
1846
1885
|
|
|
1847
|
-
|
|
1886
|
+
_context12.next = 12;
|
|
1848
1887
|
return saveDatasheets(token);
|
|
1849
1888
|
|
|
1850
1889
|
case 12:
|
|
1851
|
-
return
|
|
1890
|
+
return _context12.abrupt("break", 41);
|
|
1852
1891
|
|
|
1853
1892
|
case 13:
|
|
1854
1893
|
/*
|
|
@@ -1867,21 +1906,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1867
1906
|
*/
|
|
1868
1907
|
setPreparandoPropagacion(true);
|
|
1869
1908
|
familia = null;
|
|
1870
|
-
|
|
1871
|
-
|
|
1909
|
+
_context12.prev = 15;
|
|
1910
|
+
_context12.next = 18;
|
|
1872
1911
|
return loadFamily(true);
|
|
1873
1912
|
|
|
1874
1913
|
case 18:
|
|
1875
|
-
familia =
|
|
1914
|
+
familia = _context12.sent;
|
|
1876
1915
|
|
|
1877
1916
|
case 19:
|
|
1878
|
-
|
|
1917
|
+
_context12.prev = 19;
|
|
1879
1918
|
setPreparandoPropagacion(false);
|
|
1880
|
-
return
|
|
1919
|
+
return _context12.finish(19);
|
|
1881
1920
|
|
|
1882
1921
|
case 22:
|
|
1883
1922
|
if (!(!familia || familia.error)) {
|
|
1884
|
-
|
|
1923
|
+
_context12.next = 25;
|
|
1885
1924
|
break;
|
|
1886
1925
|
}
|
|
1887
1926
|
|
|
@@ -1918,7 +1957,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1918
1957
|
}]
|
|
1919
1958
|
}
|
|
1920
1959
|
});
|
|
1921
|
-
return
|
|
1960
|
+
return _context12.abrupt("return");
|
|
1922
1961
|
|
|
1923
1962
|
case 25:
|
|
1924
1963
|
hijos = ((_familia$variants = familia.variants) !== null && _familia$variants !== void 0 ? _familia$variants : []).filter(function (v) {
|
|
@@ -1935,46 +1974,58 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1935
1974
|
});
|
|
1936
1975
|
|
|
1937
1976
|
if (!(hijos.length > 0 || companeras.length > 0)) {
|
|
1938
|
-
|
|
1977
|
+
_context12.next = 30;
|
|
1939
1978
|
break;
|
|
1940
1979
|
}
|
|
1941
1980
|
|
|
1942
1981
|
setPendingPropagation({
|
|
1943
1982
|
cambios: cambios
|
|
1944
1983
|
});
|
|
1945
|
-
return
|
|
1984
|
+
return _context12.abrupt("return");
|
|
1946
1985
|
|
|
1947
1986
|
case 30:
|
|
1948
|
-
|
|
1987
|
+
_context12.next = 32;
|
|
1949
1988
|
return saveDatasheets(token);
|
|
1950
1989
|
|
|
1951
1990
|
case 32:
|
|
1952
|
-
return
|
|
1991
|
+
return _context12.abrupt("break", 41);
|
|
1953
1992
|
|
|
1954
1993
|
case 33:
|
|
1955
|
-
|
|
1956
|
-
|
|
1994
|
+
if (!(currentTray === _GalleryTrayTabs.TRAYS.ASSETS)) {
|
|
1995
|
+
_context12.next = 37;
|
|
1996
|
+
break;
|
|
1997
|
+
}
|
|
1957
1998
|
|
|
1958
|
-
|
|
1959
|
-
return
|
|
1999
|
+
_context12.next = 36;
|
|
2000
|
+
return handleOnSaveAssets();
|
|
1960
2001
|
|
|
1961
2002
|
case 36:
|
|
1962
|
-
return
|
|
2003
|
+
return _context12.abrupt("return");
|
|
1963
2004
|
|
|
1964
2005
|
case 37:
|
|
1965
|
-
|
|
1966
|
-
return
|
|
2006
|
+
_context12.next = 39;
|
|
2007
|
+
return updateImages(token);
|
|
1967
2008
|
|
|
1968
2009
|
case 39:
|
|
2010
|
+
return _context12.abrupt("break", 41);
|
|
2011
|
+
|
|
2012
|
+
case 40:
|
|
2013
|
+
return _context12.abrupt("break", 41);
|
|
2014
|
+
|
|
2015
|
+
case 41:
|
|
2016
|
+
_context12.next = 43;
|
|
2017
|
+
return loadData(false);
|
|
2018
|
+
|
|
2019
|
+
case 43:
|
|
1969
2020
|
case "end":
|
|
1970
|
-
return
|
|
2021
|
+
return _context12.stop();
|
|
1971
2022
|
}
|
|
1972
2023
|
}
|
|
1973
|
-
},
|
|
2024
|
+
}, _callee12, null, [[15,, 19, 22]]);
|
|
1974
2025
|
}));
|
|
1975
2026
|
|
|
1976
2027
|
return function handleOnClickSave() {
|
|
1977
|
-
return
|
|
2028
|
+
return _ref17.apply(this, arguments);
|
|
1978
2029
|
};
|
|
1979
2030
|
}();
|
|
1980
2031
|
|
|
@@ -1991,8 +2042,106 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1991
2042
|
payload: items
|
|
1992
2043
|
});
|
|
1993
2044
|
};
|
|
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
|
+
};
|
|
1994
2138
|
|
|
1995
2139
|
var handleOnAskToDeleteImages = function handleOnAskToDeleteImages() {
|
|
2140
|
+
if (currentTray === _GalleryTrayTabs.TRAYS.ASSETS) {
|
|
2141
|
+
handleOnAskToDeleteAssets();
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
1996
2145
|
if (state.selected_images.length === 0) {
|
|
1997
2146
|
dispatch({
|
|
1998
2147
|
type: "SET_MODAL",
|
|
@@ -2042,24 +2191,24 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2042
2191
|
};
|
|
2043
2192
|
|
|
2044
2193
|
var handleOnApproveSingleService = /*#__PURE__*/function () {
|
|
2045
|
-
var
|
|
2046
|
-
return _regenerator.default.wrap(function
|
|
2194
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
2195
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
2047
2196
|
while (1) {
|
|
2048
|
-
switch (
|
|
2197
|
+
switch (_context13.prev = _context13.next) {
|
|
2049
2198
|
case 0:
|
|
2050
|
-
|
|
2199
|
+
_context13.next = 2;
|
|
2051
2200
|
return sendSingleEvaluation("A");
|
|
2052
2201
|
|
|
2053
2202
|
case 2:
|
|
2054
2203
|
case "end":
|
|
2055
|
-
return
|
|
2204
|
+
return _context13.stop();
|
|
2056
2205
|
}
|
|
2057
2206
|
}
|
|
2058
|
-
},
|
|
2207
|
+
}, _callee13);
|
|
2059
2208
|
}));
|
|
2060
2209
|
|
|
2061
2210
|
return function handleOnApproveSingleService() {
|
|
2062
|
-
return
|
|
2211
|
+
return _ref18.apply(this, arguments);
|
|
2063
2212
|
};
|
|
2064
2213
|
}();
|
|
2065
2214
|
|
|
@@ -2068,21 +2217,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2068
2217
|
};
|
|
2069
2218
|
|
|
2070
2219
|
var sendSingleEvaluation = /*#__PURE__*/function () {
|
|
2071
|
-
var
|
|
2220
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
|
|
2072
2221
|
var _state$product$id_ord, _state$active_retaile5;
|
|
2073
2222
|
|
|
2074
2223
|
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;
|
|
2075
2224
|
|
|
2076
|
-
return _regenerator.default.wrap(function
|
|
2225
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
2077
2226
|
while (1) {
|
|
2078
|
-
switch (
|
|
2227
|
+
switch (_context14.prev = _context14.next) {
|
|
2079
2228
|
case 0:
|
|
2080
2229
|
if (!state.saving) {
|
|
2081
|
-
|
|
2230
|
+
_context14.next = 2;
|
|
2082
2231
|
break;
|
|
2083
2232
|
}
|
|
2084
2233
|
|
|
2085
|
-
return
|
|
2234
|
+
return _context14.abrupt("return");
|
|
2086
2235
|
|
|
2087
2236
|
case 2:
|
|
2088
2237
|
dispatch({
|
|
@@ -2103,16 +2252,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2103
2252
|
retailerId: retailerId
|
|
2104
2253
|
};
|
|
2105
2254
|
activeTab = state.active_tab;
|
|
2106
|
-
|
|
2255
|
+
_context14.prev = 11;
|
|
2107
2256
|
|
|
2108
2257
|
if (!result) {
|
|
2109
|
-
|
|
2258
|
+
_context14.next = 28;
|
|
2110
2259
|
break;
|
|
2111
2260
|
}
|
|
2112
2261
|
|
|
2113
2262
|
data.result = result;
|
|
2114
2263
|
data.retailerId = retailerId;
|
|
2115
|
-
|
|
2264
|
+
_context14.next = 17;
|
|
2116
2265
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
2117
2266
|
headers: {
|
|
2118
2267
|
Authorization: token
|
|
@@ -2120,7 +2269,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2120
2269
|
});
|
|
2121
2270
|
|
|
2122
2271
|
case 17:
|
|
2123
|
-
res =
|
|
2272
|
+
res = _context14.sent;
|
|
2124
2273
|
newStatuses = JSON.parse(res.data.body);
|
|
2125
2274
|
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
2126
2275
|
articleStatus = newStatuses.newArticleStatus[articleId];
|
|
@@ -2151,7 +2300,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2151
2300
|
image: _genericModalCheck.default
|
|
2152
2301
|
}
|
|
2153
2302
|
});
|
|
2154
|
-
|
|
2303
|
+
_context14.next = 33;
|
|
2155
2304
|
break;
|
|
2156
2305
|
|
|
2157
2306
|
case 28:
|
|
@@ -2167,7 +2316,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2167
2316
|
icon = _genericModalCheck.default;
|
|
2168
2317
|
}
|
|
2169
2318
|
|
|
2170
|
-
|
|
2319
|
+
_context14.next = 32;
|
|
2171
2320
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
2172
2321
|
headers: {
|
|
2173
2322
|
Authorization: token
|
|
@@ -2175,7 +2324,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2175
2324
|
});
|
|
2176
2325
|
|
|
2177
2326
|
case 32:
|
|
2178
|
-
res =
|
|
2327
|
+
res = _context14.sent;
|
|
2179
2328
|
|
|
2180
2329
|
case 33:
|
|
2181
2330
|
if (res.data.statusCode === 200) {
|
|
@@ -2260,13 +2409,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2260
2409
|
});
|
|
2261
2410
|
}
|
|
2262
2411
|
|
|
2263
|
-
|
|
2412
|
+
_context14.next = 40;
|
|
2264
2413
|
break;
|
|
2265
2414
|
|
|
2266
2415
|
case 36:
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
console.error("Error sending evaluation:",
|
|
2416
|
+
_context14.prev = 36;
|
|
2417
|
+
_context14.t0 = _context14["catch"](11);
|
|
2418
|
+
console.error("Error sending evaluation:", _context14.t0);
|
|
2270
2419
|
dispatch({
|
|
2271
2420
|
type: "SET_MODAL",
|
|
2272
2421
|
payload: {
|
|
@@ -2278,45 +2427,45 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2278
2427
|
});
|
|
2279
2428
|
|
|
2280
2429
|
case 40:
|
|
2281
|
-
|
|
2430
|
+
_context14.prev = 40;
|
|
2282
2431
|
dispatch({
|
|
2283
2432
|
type: "SET_SAVING",
|
|
2284
2433
|
payload: false
|
|
2285
2434
|
});
|
|
2286
|
-
return
|
|
2435
|
+
return _context14.finish(40);
|
|
2287
2436
|
|
|
2288
2437
|
case 43:
|
|
2289
2438
|
case "end":
|
|
2290
|
-
return
|
|
2439
|
+
return _context14.stop();
|
|
2291
2440
|
}
|
|
2292
2441
|
}
|
|
2293
|
-
},
|
|
2442
|
+
}, _callee14, null, [[11, 36, 40, 43]]);
|
|
2294
2443
|
}));
|
|
2295
2444
|
|
|
2296
|
-
return function sendSingleEvaluation(
|
|
2297
|
-
return
|
|
2445
|
+
return function sendSingleEvaluation(_x4) {
|
|
2446
|
+
return _ref19.apply(this, arguments);
|
|
2298
2447
|
};
|
|
2299
2448
|
}();
|
|
2300
2449
|
|
|
2301
2450
|
var handleOnApproveAllServices = /*#__PURE__*/function () {
|
|
2302
|
-
var
|
|
2303
|
-
return _regenerator.default.wrap(function
|
|
2451
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
2452
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
2304
2453
|
while (1) {
|
|
2305
|
-
switch (
|
|
2454
|
+
switch (_context15.prev = _context15.next) {
|
|
2306
2455
|
case 0:
|
|
2307
|
-
|
|
2456
|
+
_context15.next = 2;
|
|
2308
2457
|
return sendBulkEvaluation("A");
|
|
2309
2458
|
|
|
2310
2459
|
case 2:
|
|
2311
2460
|
case "end":
|
|
2312
|
-
return
|
|
2461
|
+
return _context15.stop();
|
|
2313
2462
|
}
|
|
2314
2463
|
}
|
|
2315
|
-
},
|
|
2464
|
+
}, _callee15);
|
|
2316
2465
|
}));
|
|
2317
2466
|
|
|
2318
2467
|
return function handleOnApproveAllServices() {
|
|
2319
|
-
return
|
|
2468
|
+
return _ref20.apply(this, arguments);
|
|
2320
2469
|
};
|
|
2321
2470
|
}();
|
|
2322
2471
|
|
|
@@ -2326,18 +2475,18 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2326
2475
|
};
|
|
2327
2476
|
|
|
2328
2477
|
var sendBulkEvaluation = /*#__PURE__*/function () {
|
|
2329
|
-
var
|
|
2478
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(result) {
|
|
2330
2479
|
var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, updatedServicesData;
|
|
2331
2480
|
|
|
2332
|
-
return _regenerator.default.wrap(function
|
|
2481
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
2333
2482
|
while (1) {
|
|
2334
|
-
switch (
|
|
2483
|
+
switch (_context16.prev = _context16.next) {
|
|
2335
2484
|
case 0:
|
|
2336
2485
|
dispatch({
|
|
2337
2486
|
type: "SET_SAVING",
|
|
2338
2487
|
payload: true
|
|
2339
2488
|
});
|
|
2340
|
-
|
|
2489
|
+
_context16.prev = 1;
|
|
2341
2490
|
evaluationArray = [];
|
|
2342
2491
|
conceptArray = (0, _utils.getConceptsByRole)(user.id_role);
|
|
2343
2492
|
(_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret, idx) {
|
|
@@ -2362,7 +2511,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2362
2511
|
}));
|
|
2363
2512
|
}
|
|
2364
2513
|
});
|
|
2365
|
-
|
|
2514
|
+
_context16.next = 7;
|
|
2366
2515
|
return Promise.all(evaluationArray);
|
|
2367
2516
|
|
|
2368
2517
|
case 7:
|
|
@@ -2417,41 +2566,41 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2417
2566
|
image: _genericModalCheck.default
|
|
2418
2567
|
}
|
|
2419
2568
|
});
|
|
2420
|
-
|
|
2569
|
+
_context16.next = 19;
|
|
2421
2570
|
break;
|
|
2422
2571
|
|
|
2423
2572
|
case 16:
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
console.error("Error in bulk evaluation:",
|
|
2573
|
+
_context16.prev = 16;
|
|
2574
|
+
_context16.t0 = _context16["catch"](1);
|
|
2575
|
+
console.error("Error in bulk evaluation:", _context16.t0);
|
|
2427
2576
|
|
|
2428
2577
|
case 19:
|
|
2429
|
-
|
|
2578
|
+
_context16.prev = 19;
|
|
2430
2579
|
dispatch({
|
|
2431
2580
|
type: "SET_SAVING",
|
|
2432
2581
|
payload: false
|
|
2433
2582
|
});
|
|
2434
|
-
return
|
|
2583
|
+
return _context16.finish(19);
|
|
2435
2584
|
|
|
2436
2585
|
case 22:
|
|
2437
2586
|
case "end":
|
|
2438
|
-
return
|
|
2587
|
+
return _context16.stop();
|
|
2439
2588
|
}
|
|
2440
2589
|
}
|
|
2441
|
-
},
|
|
2590
|
+
}, _callee16, null, [[1, 16, 19, 22]]);
|
|
2442
2591
|
}));
|
|
2443
2592
|
|
|
2444
|
-
return function sendBulkEvaluation(
|
|
2445
|
-
return
|
|
2593
|
+
return function sendBulkEvaluation(_x5) {
|
|
2594
|
+
return _ref21.apply(this, arguments);
|
|
2446
2595
|
};
|
|
2447
2596
|
}();
|
|
2448
2597
|
|
|
2449
2598
|
var handleOnChangeAssignations = /*#__PURE__*/function () {
|
|
2450
|
-
var
|
|
2599
|
+
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
|
|
2451
2600
|
var concept, data, updatedProduct;
|
|
2452
|
-
return _regenerator.default.wrap(function
|
|
2601
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
2453
2602
|
while (1) {
|
|
2454
|
-
switch (
|
|
2603
|
+
switch (_context17.prev = _context17.next) {
|
|
2455
2604
|
case 0:
|
|
2456
2605
|
concept = (0, _utils.getConceptByTab)(state.active_tab);
|
|
2457
2606
|
data = {
|
|
@@ -2462,7 +2611,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2462
2611
|
concept: concept,
|
|
2463
2612
|
userId: assignationId
|
|
2464
2613
|
};
|
|
2465
|
-
|
|
2614
|
+
_context17.next = 4;
|
|
2466
2615
|
return (0, _axios.default)({
|
|
2467
2616
|
method: "post",
|
|
2468
2617
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
@@ -2481,14 +2630,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2481
2630
|
|
|
2482
2631
|
case 6:
|
|
2483
2632
|
case "end":
|
|
2484
|
-
return
|
|
2633
|
+
return _context17.stop();
|
|
2485
2634
|
}
|
|
2486
2635
|
}
|
|
2487
|
-
},
|
|
2636
|
+
}, _callee17);
|
|
2488
2637
|
}));
|
|
2489
2638
|
|
|
2490
|
-
return function handleOnChangeAssignations(
|
|
2491
|
-
return
|
|
2639
|
+
return function handleOnChangeAssignations(_x6, _x7) {
|
|
2640
|
+
return _ref22.apply(this, arguments);
|
|
2492
2641
|
};
|
|
2493
2642
|
}();
|
|
2494
2643
|
|
|
@@ -2523,16 +2672,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2523
2672
|
};
|
|
2524
2673
|
|
|
2525
2674
|
var handleOnSubmitComment = /*#__PURE__*/function () {
|
|
2526
|
-
var
|
|
2675
|
+
var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(e) {
|
|
2527
2676
|
var commentText;
|
|
2528
|
-
return _regenerator.default.wrap(function
|
|
2677
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
2529
2678
|
while (1) {
|
|
2530
|
-
switch (
|
|
2679
|
+
switch (_context18.prev = _context18.next) {
|
|
2531
2680
|
case 0:
|
|
2532
2681
|
e.preventDefault();
|
|
2533
2682
|
commentText = document.querySelector("#commentary-box .ql-container .ql-editor > p").innerHTML;
|
|
2534
|
-
|
|
2535
|
-
|
|
2683
|
+
_context18.prev = 2;
|
|
2684
|
+
_context18.next = 5;
|
|
2536
2685
|
return createComment(commentText, token);
|
|
2537
2686
|
|
|
2538
2687
|
case 5:
|
|
@@ -2545,13 +2694,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2545
2694
|
image: _genericModalCheck.default
|
|
2546
2695
|
}
|
|
2547
2696
|
});
|
|
2548
|
-
|
|
2697
|
+
_context18.next = 12;
|
|
2549
2698
|
break;
|
|
2550
2699
|
|
|
2551
2700
|
case 8:
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
console.error("Error saving comment:",
|
|
2701
|
+
_context18.prev = 8;
|
|
2702
|
+
_context18.t0 = _context18["catch"](2);
|
|
2703
|
+
console.error("Error saving comment:", _context18.t0);
|
|
2555
2704
|
dispatch({
|
|
2556
2705
|
type: "SET_MODAL",
|
|
2557
2706
|
payload: {
|
|
@@ -2564,14 +2713,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2564
2713
|
|
|
2565
2714
|
case 12:
|
|
2566
2715
|
case "end":
|
|
2567
|
-
return
|
|
2716
|
+
return _context18.stop();
|
|
2568
2717
|
}
|
|
2569
2718
|
}
|
|
2570
|
-
},
|
|
2719
|
+
}, _callee18, null, [[2, 8]]);
|
|
2571
2720
|
}));
|
|
2572
2721
|
|
|
2573
|
-
return function handleOnSubmitComment(
|
|
2574
|
-
return
|
|
2722
|
+
return function handleOnSubmitComment(_x8) {
|
|
2723
|
+
return _ref23.apply(this, arguments);
|
|
2575
2724
|
};
|
|
2576
2725
|
}();
|
|
2577
2726
|
|
|
@@ -2882,7 +3031,19 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2882
3031
|
})]
|
|
2883
3032
|
})
|
|
2884
3033
|
});
|
|
2885
|
-
|
|
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, {
|
|
2886
3047
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ProductEditionSkeleton, {})
|
|
2887
3048
|
});
|
|
2888
3049
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AiProductEdition.AiProductEditionProvider, {
|
|
@@ -2910,9 +3071,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2910
3071
|
saveDatasheets(token, propagation !== null && propagation !== void 0 ? propagation : undefined);
|
|
2911
3072
|
}
|
|
2912
3073
|
}), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
|
|
2913
|
-
articleId: (_state$
|
|
2914
|
-
articleName: (_state$
|
|
2915
|
-
articleUpc: (_state$
|
|
3074
|
+
articleId: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.id_article,
|
|
3075
|
+
articleName: (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.name,
|
|
3076
|
+
articleUpc: (_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.upc,
|
|
2916
3077
|
activeRetailerId: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
|
|
2917
3078
|
token: token,
|
|
2918
3079
|
onClose: function onClose() {
|
|
@@ -2920,9 +3081,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2920
3081
|
},
|
|
2921
3082
|
onLinked: handleOnLinkedVariants
|
|
2922
3083
|
}), showGroupModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VariantGroupModal.VariantGroupModal, {
|
|
2923
|
-
articleId: (_state$
|
|
2924
|
-
articleName: (_state$
|
|
2925
|
-
articleUpc: (_state$
|
|
3084
|
+
articleId: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.id_article,
|
|
3085
|
+
articleName: (_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.name,
|
|
3086
|
+
articleUpc: (_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.upc,
|
|
2926
3087
|
currentGroup: (_variantGroup$group2 = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) !== null && _variantGroup$group2 !== void 0 ? _variantGroup$group2 : null,
|
|
2927
3088
|
token: token,
|
|
2928
3089
|
onClose: function onClose() {
|
|
@@ -2958,21 +3119,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2958
3119
|
type: "pink",
|
|
2959
3120
|
label: "Aceptar",
|
|
2960
3121
|
size: 12,
|
|
2961
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
3122
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
2962
3123
|
var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
|
|
2963
|
-
return _regenerator.default.wrap(function
|
|
3124
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
2964
3125
|
while (1) {
|
|
2965
|
-
switch (
|
|
3126
|
+
switch (_context19.prev = _context19.next) {
|
|
2966
3127
|
case 0:
|
|
2967
3128
|
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
2968
3129
|
|
|
2969
3130
|
if (!(!elements || elements.length === 0)) {
|
|
2970
|
-
|
|
3131
|
+
_context19.next = 4;
|
|
2971
3132
|
break;
|
|
2972
3133
|
}
|
|
2973
3134
|
|
|
2974
3135
|
console.error("Elemento no encontrado");
|
|
2975
|
-
return
|
|
3136
|
+
return _context19.abrupt("return");
|
|
2976
3137
|
|
|
2977
3138
|
case 4:
|
|
2978
3139
|
isMessageEmpty = Array.from(elements).every(function (el) {
|
|
@@ -2981,7 +3142,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2981
3142
|
});
|
|
2982
3143
|
|
|
2983
3144
|
if (!isMessageEmpty) {
|
|
2984
|
-
|
|
3145
|
+
_context19.next = 10;
|
|
2985
3146
|
break;
|
|
2986
3147
|
}
|
|
2987
3148
|
|
|
@@ -2996,13 +3157,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2996
3157
|
container.appendChild(alert);
|
|
2997
3158
|
}
|
|
2998
3159
|
|
|
2999
|
-
return
|
|
3160
|
+
return _context19.abrupt("return");
|
|
3000
3161
|
|
|
3001
3162
|
case 10:
|
|
3002
3163
|
fullMessage = Array.from(elements).map(function (element) {
|
|
3003
3164
|
return element.innerHTML;
|
|
3004
3165
|
}).join("").replace(/<br\s*\/?>/gi, "\n");
|
|
3005
|
-
|
|
3166
|
+
_context19.next = 13;
|
|
3006
3167
|
return createComment(fullMessage, token);
|
|
3007
3168
|
|
|
3008
3169
|
case 13:
|
|
@@ -3011,10 +3172,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3011
3172
|
|
|
3012
3173
|
case 15:
|
|
3013
3174
|
case "end":
|
|
3014
|
-
return
|
|
3175
|
+
return _context19.stop();
|
|
3015
3176
|
}
|
|
3016
3177
|
}
|
|
3017
|
-
},
|
|
3178
|
+
}, _callee19);
|
|
3018
3179
|
}))
|
|
3019
3180
|
}, "btn-Aceptar")]
|
|
3020
3181
|
}), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
@@ -3082,17 +3243,27 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3082
3243
|
className: "data-container",
|
|
3083
3244
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3084
3245
|
className: "image-data-panel",
|
|
3085
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer
|
|
3086
|
-
|
|
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 : {},
|
|
3087
3258
|
imagesArray: state.images_values || [],
|
|
3088
3259
|
setActiveImage: handleOnChangeCurrentImage,
|
|
3089
3260
|
setShowModal: handleOnShowModalGallery
|
|
3090
3261
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable // states
|
|
3091
3262
|
, {
|
|
3092
3263
|
lists: state.images_values || [],
|
|
3093
|
-
activeImage: (_state$
|
|
3264
|
+
activeImage: (_state$images_values12 = state.images_values) !== null && _state$images_values12 !== void 0 && _state$images_values12.values ? (_state$images_values13 = state.images_values) === null || _state$images_values13 === void 0 ? void 0 : _state$images_values13.values[state.current_image] : {},
|
|
3094
3265
|
assignationsImages: state.collaborator_assignations["Imágenes"],
|
|
3095
|
-
imagesStatus: ((_state$
|
|
3266
|
+
imagesStatus: ((_state$product26 = state.product) === null || _state$product26 === void 0 ? void 0 : _state$product26.images_status) || "-",
|
|
3096
3267
|
retailerSelected: (_state$active_retaile9 = state.active_retailer) === null || _state$active_retaile9 === void 0 ? void 0 : _state$active_retaile9.id_retailer,
|
|
3097
3268
|
isRetailer: isRetailer,
|
|
3098
3269
|
version: state.product.version,
|
|
@@ -3180,13 +3351,13 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3180
3351
|
className: "desvincular",
|
|
3181
3352
|
title: "Dejar de ser hijo de este producto",
|
|
3182
3353
|
onClick: function onClick() {
|
|
3183
|
-
var _state$
|
|
3354
|
+
var _state$product27, _state$product28, _state$product29;
|
|
3184
3355
|
|
|
3185
3356
|
return setPorDesvincular({
|
|
3186
3357
|
mode: "self",
|
|
3187
|
-
childArticleId: (_state$
|
|
3188
|
-
childName: (_state$
|
|
3189
|
-
childUpc: (_state$
|
|
3358
|
+
childArticleId: (_state$product27 = state.product) === null || _state$product27 === void 0 ? void 0 : _state$product27.id_article,
|
|
3359
|
+
childName: (_state$product28 = state.product) === null || _state$product28 === void 0 ? void 0 : _state$product28.name,
|
|
3360
|
+
childUpc: (_state$product29 = state.product) === null || _state$product29 === void 0 ? void 0 : _state$product29.upc,
|
|
3190
3361
|
parentName: family.parent.name,
|
|
3191
3362
|
parentUpc: family.parent.upc
|
|
3192
3363
|
});
|
|
@@ -3218,15 +3389,15 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3218
3389
|
className: "desvincular",
|
|
3219
3390
|
title: "Desvincular este hijo",
|
|
3220
3391
|
onClick: function onClick() {
|
|
3221
|
-
var _state$
|
|
3392
|
+
var _state$product30, _state$product31;
|
|
3222
3393
|
|
|
3223
3394
|
return setPorDesvincular({
|
|
3224
3395
|
mode: "child",
|
|
3225
3396
|
childArticleId: variant.articleId,
|
|
3226
3397
|
childName: variant.name,
|
|
3227
3398
|
childUpc: variant.upc,
|
|
3228
|
-
parentName: (_state$
|
|
3229
|
-
parentUpc: (_state$
|
|
3399
|
+
parentName: (_state$product30 = state.product) === null || _state$product30 === void 0 ? void 0 : _state$product30.name,
|
|
3400
|
+
parentUpc: (_state$product31 = state.product) === null || _state$product31 === void 0 ? void 0 : _state$product31.upc
|
|
3230
3401
|
});
|
|
3231
3402
|
},
|
|
3232
3403
|
children: "Desvincular"
|
|
@@ -3347,8 +3518,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3347
3518
|
,
|
|
3348
3519
|
setShowVersionSelector: setShowVersionSelector // setSelectedImages={setSelectedImages} prop pasada asi: FullTabsMenu -> TabsMenu Pero en TabsMenu no se espera ninguna prop setSelectedImages
|
|
3349
3520
|
// 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ó.
|
|
3350
3523
|
,
|
|
3351
|
-
downloadImages: handleOnDownloadImages,
|
|
3524
|
+
downloadImages: currentTray === _GalleryTrayTabs.TRAYS.ASSETS ? handleOnDownloadAssets : handleOnDownloadImages,
|
|
3352
3525
|
askToDeleteImages: handleOnAskToDeleteImages,
|
|
3353
3526
|
showSaveButton: isAuditorAssigned() || isUserAssignedToService(),
|
|
3354
3527
|
onClickSave: handleOnClickSave // validations
|
|
@@ -3358,7 +3531,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3358
3531
|
className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
|
|
3359
3532
|
id: "services-information-container",
|
|
3360
3533
|
children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
3361
|
-
children: [state.active_tab === "Descripción" && (((_state$
|
|
3534
|
+
children: [state.active_tab === "Descripción" && (((_state$product32 = state.product) === null || _state$product32 === void 0 ? void 0 : _state$product32.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
3362
3535
|
activeSection: state.active_tab,
|
|
3363
3536
|
inputGroup: state.descriptions_inputs[0],
|
|
3364
3537
|
updatedDescriptions: state.updated_descriptions_inputs
|
|
@@ -3367,7 +3540,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3367
3540
|
,
|
|
3368
3541
|
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,
|
|
3369
3542
|
onRestoreInheritance: handleOnRestoreInheritance,
|
|
3370
|
-
articleId: (_state$
|
|
3543
|
+
articleId: (_state$product33 = state.product) === null || _state$product33 === void 0 ? void 0 : _state$product33.id_article,
|
|
3371
3544
|
version: state.product.version,
|
|
3372
3545
|
auditInputGroup: auditDescriptions[0],
|
|
3373
3546
|
setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
|
|
@@ -3376,7 +3549,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3376
3549
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
3377
3550
|
text: "No cuentas con este servicio",
|
|
3378
3551
|
headerType: "input-name-header"
|
|
3379
|
-
})), state.active_tab === "Ficha técnica" && (((_state$
|
|
3552
|
+
})), state.active_tab === "Ficha técnica" && (((_state$product34 = state.product) === null || _state$product34 === void 0 ? void 0 : _state$product34.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
3380
3553
|
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) {
|
|
3381
3554
|
var _state$services3, _state$services3$data;
|
|
3382
3555
|
|
|
@@ -3397,15 +3570,33 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3397
3570
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
3398
3571
|
text: "No cuentas con este servicio",
|
|
3399
3572
|
headerType: "input-name-header"
|
|
3400
|
-
})), state.active_tab === "Imágenes" && (((_state$
|
|
3401
|
-
children: [
|
|
3573
|
+
})), state.active_tab === "Imágenes" && (((_state$product35 = state.product) === null || _state$product35 === void 0 ? void 0 : _state$product35.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
3574
|
+
children: [enableDigitalAssets && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryTrayTabs.GalleryTrayTabs, {
|
|
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, {
|
|
3402
3593
|
checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
|
|
3403
3594
|
,
|
|
3404
3595
|
setCheckAll: handleOnSetCheckAll // Toggler de true o false para el checkbox "Seleccionar todo"
|
|
3405
3596
|
,
|
|
3406
3597
|
setSelectedImages: handleOnSetSelectedImages // shotThd={shotThd} // No se usa?
|
|
3407
3598
|
|
|
3408
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
3599
|
+
}), currentTray === _GalleryTrayTabs.TRAYS.IMAGES && /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
3409
3600
|
className: "container",
|
|
3410
3601
|
style: {
|
|
3411
3602
|
position: "relative"
|
|
@@ -3421,7 +3612,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3421
3612
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
3422
3613
|
children: thumbs()
|
|
3423
3614
|
})]
|
|
3424
|
-
})), ((_state$
|
|
3615
|
+
})), ((_state$images_values16 = state.images_values) === null || _state$images_values16 === void 0 ? void 0 : (_state$images_values17 = _state$images_values16.values) === null || _state$images_values17 === void 0 ? void 0 : _state$images_values17.length) === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3425
3616
|
style: {
|
|
3426
3617
|
position: "absolute",
|
|
3427
3618
|
top: "50%",
|
|
@@ -3489,20 +3680,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3489
3680
|
reviewed: crossComment
|
|
3490
3681
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
3491
3682
|
buttonType: "circular-button accept-button",
|
|
3492
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
3493
|
-
return _regenerator.default.wrap(function
|
|
3683
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
3684
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
3494
3685
|
while (1) {
|
|
3495
|
-
switch (
|
|
3686
|
+
switch (_context20.prev = _context20.next) {
|
|
3496
3687
|
case 0:
|
|
3497
3688
|
setCrossComment(true);
|
|
3498
3689
|
commentRevised();
|
|
3499
3690
|
|
|
3500
3691
|
case 2:
|
|
3501
3692
|
case "end":
|
|
3502
|
-
return
|
|
3693
|
+
return _context20.stop();
|
|
3503
3694
|
}
|
|
3504
3695
|
}
|
|
3505
|
-
},
|
|
3696
|
+
}, _callee20);
|
|
3506
3697
|
}))
|
|
3507
3698
|
})]
|
|
3508
3699
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|