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