contentoh-components-library 21.6.60 → 21.6.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +11 -5
- package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +58 -31
- package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +5 -1
- package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +3 -0
- package/dist/components/pages/CreatorsProductEdition/sections/ImagesSection.js +18 -3
- package/dist/components/pages/CreatorsProductEdition/sections/TabsBar.js +10 -0
- package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +10 -2
- package/package.json +1 -1
- package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +22 -3
- package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +36 -1
- package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +15 -3
- package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +8 -1
- package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +24 -2
- package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +9 -0
- package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +6 -0
|
@@ -87,7 +87,7 @@ var NoService = function NoService() {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
|
|
90
|
-
var _state$errors, _pendingPropagation$k, _family$variants, _variantGroup$members, _variantGroup$group, _state$product, _state$product2, _state$product3, _state$active_retaile, _state$product4, _state$product5, _state$product6, _variantGroup$group2, _location$state, _location$state2, _state$active_retaile2, _state$active_retaile3, _state$images_values$, _state$images_values, _state$images_values$2, _state$product7, _state$active_retaile4, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile5, _state$active_retaile6, _state$active_retaile7, _state$product8, _state$services, _state$services$datas, _state$product9, _state$product10, _state$datasheets_inp, _state$datasheets_inp2
|
|
90
|
+
var _state$errors, _pendingPropagation$k, _family$variants, _variantGroup$members, _variantGroup$group, _state$product, _state$product2, _state$product3, _state$active_retaile, _state$product4, _state$product5, _state$product6, _variantGroup$group2, _location$state, _location$state2, _state$active_retaile2, _state$active_retaile3, _state$images_values$, _state$images_values, _state$images_values$2, _state$product7, _state$active_retaile4, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile5, _state$active_retaile6, _state$active_retaile7, _state$product8, _state$services, _state$services$datas, _state$product9, _state$product10, _state$datasheets_inp, _state$datasheets_inp2;
|
|
91
91
|
|
|
92
92
|
var tabsSections = _ref.tabsSections,
|
|
93
93
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -110,6 +110,8 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
|
|
|
110
110
|
isRetailer = _useCreatorsProductEd.isRetailer,
|
|
111
111
|
digitalAssets = _useCreatorsProductEd.digitalAssets,
|
|
112
112
|
currentTray = _useCreatorsProductEd.currentTray,
|
|
113
|
+
hasImagesService = _useCreatorsProductEd.hasImagesService,
|
|
114
|
+
canEditAssets = _useCreatorsProductEd.canEditAssets,
|
|
113
115
|
assetsLoadedFor = _useCreatorsProductEd.assetsLoadedFor,
|
|
114
116
|
handleOnSetSelectedAssets = _useCreatorsProductEd.handleOnSetSelectedAssets,
|
|
115
117
|
handleOnSetAllAssetsChecked = _useCreatorsProductEd.handleOnSetAllAssetsChecked,
|
|
@@ -738,8 +740,11 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
|
|
|
738
740
|
// las imágenes del producto, que no es lo que el usuario pidió.
|
|
739
741
|
,
|
|
740
742
|
downloadImages: currentTray === _GalleryTrayTabs.TRAYS.ASSETS ? handleOnDownloadAssets : handleOnDownloadImages,
|
|
741
|
-
askToDeleteImages: handleOnAskToDeleteImages
|
|
742
|
-
|
|
743
|
+
askToDeleteImages: handleOnAskToDeleteImages // En la bandeja de activos el permiso es el de los activos: sin
|
|
744
|
+
// servicio de imágenes nadie está asignado a él y el botón de
|
|
745
|
+
// guardar desaparecería justo donde sí hay algo que guardar.
|
|
746
|
+
,
|
|
747
|
+
showSaveButton: currentTray === _GalleryTrayTabs.TRAYS.ASSETS ? canEditAssets() : isAuditorAssigned() || isUserAssignedToService(),
|
|
743
748
|
onClickSave: handleOnClickSave // validations
|
|
744
749
|
,
|
|
745
750
|
canAssign: ![7, 8].includes(user.id_role)
|
|
@@ -792,11 +797,12 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
|
|
|
792
797
|
compare: compare
|
|
793
798
|
}, index + "-" + state.active_retailer.retailer);
|
|
794
799
|
})
|
|
795
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NoService, {})), state.active_tab === "Imágenes" && (
|
|
800
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NoService, {})), state.active_tab === "Imágenes" && (hasImagesService || enableDigitalAssets ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagesSection.ImagesSection, {
|
|
796
801
|
imagesValues: state.images_values,
|
|
797
802
|
selectedImages: state.selected_images,
|
|
798
803
|
imageLayout: imageLayout,
|
|
799
804
|
enableDigitalAssets: enableDigitalAssets,
|
|
805
|
+
hasImagesService: hasImagesService,
|
|
800
806
|
currentTray: currentTray,
|
|
801
807
|
setActiveTray: setActiveTray,
|
|
802
808
|
digitalAssets: digitalAssets,
|
|
@@ -804,7 +810,7 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
|
|
|
804
810
|
selectedAssets: state.selected_assets,
|
|
805
811
|
setSelectedAssets: handleOnSetSelectedAssets,
|
|
806
812
|
setAllAssetsChecked: handleOnSetAllAssetsChecked,
|
|
807
|
-
canEdit: isAuditorAssigned() || isUserAssignedToService(),
|
|
813
|
+
canEdit: currentTray === _GalleryTrayTabs.TRAYS.ASSETS ? canEditAssets() : isAuditorAssigned() || isUserAssignedToService(),
|
|
808
814
|
setCheckAll: handleOnSetCheckAll,
|
|
809
815
|
setSelectedImages: handleOnSetSelectedImages,
|
|
810
816
|
onChangeCurrentImage: handleOnChangeCurrentImage,
|
|
@@ -86,7 +86,7 @@ function obtenerDuracionVideoBase64(base64Data) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
89
|
-
var _state$product$id_art, _state$product, _state$
|
|
89
|
+
var _state$product$id_art, _state$product, _state$product2, _state$product12, _family$variants, _state$product13, _state$product17;
|
|
90
90
|
|
|
91
91
|
var tabsSections = _ref.tabsSections,
|
|
92
92
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -438,8 +438,15 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
438
438
|
_useState60 = (0, _slicedToArray2.default)(_useState59, 2),
|
|
439
439
|
activeTray = _useState60[0],
|
|
440
440
|
setActiveTray = _useState60[1];
|
|
441
|
+
/*
|
|
442
|
+
Los activos digitales no pertenecen al servicio de imágenes: se suben
|
|
443
|
+
aunque el producto no lo tenga contratado. Sin ese servicio solo queda su
|
|
444
|
+
bandeja, así que la vista abre directamente en ella.
|
|
445
|
+
*/
|
|
446
|
+
|
|
441
447
|
|
|
442
|
-
var
|
|
448
|
+
var hasImagesService = ((_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.images_status) !== "NS";
|
|
449
|
+
var currentTray = !enableDigitalAssets ? _GalleryTrayTabs.TRAYS.IMAGES : hasImagesService ? activeTray : _GalleryTrayTabs.TRAYS.ASSETS;
|
|
443
450
|
/*
|
|
444
451
|
De qué artículo se cargaron ya los activos.
|
|
445
452
|
`loadData` se vuelve a ejecutar cada vez que cambia la cadena activa, pero los
|
|
@@ -573,7 +580,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
573
580
|
|
|
574
581
|
var loadAuditableData = /*#__PURE__*/function () {
|
|
575
582
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
576
|
-
var _state$
|
|
583
|
+
var _state$product3, _state$product4, _state$product5;
|
|
577
584
|
|
|
578
585
|
var auditServices;
|
|
579
586
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
@@ -581,7 +588,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
581
588
|
switch (_context3.prev = _context3.next) {
|
|
582
589
|
case 0:
|
|
583
590
|
_context3.next = 2;
|
|
584
|
-
return (0, _data.getRetailerServices)((_state$
|
|
591
|
+
return (0, _data.getRetailerServices)((_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.id_article, (_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.categoryName, parseInt((_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.id_category), auditableVersion.version, token);
|
|
585
592
|
|
|
586
593
|
case 2:
|
|
587
594
|
auditServices = _context3.sent;
|
|
@@ -627,7 +634,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
627
634
|
_state$active_retaile2,
|
|
628
635
|
_services$0$inputs,
|
|
629
636
|
_services$2,
|
|
630
|
-
_state$
|
|
637
|
+
_state$product6,
|
|
631
638
|
id_article,
|
|
632
639
|
version,
|
|
633
640
|
id_order,
|
|
@@ -673,7 +680,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
673
680
|
type: "SET_ERRORS",
|
|
674
681
|
payload: []
|
|
675
682
|
});
|
|
676
|
-
_state$
|
|
683
|
+
_state$product6 = state.product, id_article = _state$product6.id_article, version = _state$product6.version, id_order = _state$product6.id_order;
|
|
677
684
|
_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
|
|
678
685
|
|
|
679
686
|
data = [{
|
|
@@ -968,9 +975,9 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
968
975
|
};
|
|
969
976
|
|
|
970
977
|
var isAuditorAssigned = function isAuditorAssigned() {
|
|
971
|
-
var _state$
|
|
978
|
+
var _state$product7;
|
|
972
979
|
|
|
973
|
-
return ((_state$
|
|
980
|
+
return ((_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.id_auditor) === (user === null || user === void 0 ? void 0 : user.id_user);
|
|
974
981
|
};
|
|
975
982
|
/**
|
|
976
983
|
* ¿Ocupo este slot EN ESTE producto?
|
|
@@ -983,9 +990,9 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
983
990
|
|
|
984
991
|
|
|
985
992
|
var isAssignedAs = function isAssignedAs(rol, concept) {
|
|
986
|
-
var _state$
|
|
993
|
+
var _state$product8;
|
|
987
994
|
|
|
988
|
-
var assigned = (_state$
|
|
995
|
+
var assigned = (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8["id_".concat(concept, "_").concat(rol)];
|
|
989
996
|
return !!assigned && assigned === (user === null || user === void 0 ? void 0 : user.id_user);
|
|
990
997
|
};
|
|
991
998
|
|
|
@@ -1002,6 +1009,24 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1002
1009
|
var isAssigned = rol ? isAssignedAs(rol, concept) : isAssignedAs("especialist", concept) || isAssignedAs("facilitator", concept);
|
|
1003
1010
|
return isAssigned && validUser;
|
|
1004
1011
|
};
|
|
1012
|
+
/*
|
|
1013
|
+
Permiso sobre la bandeja de activos digitales.
|
|
1014
|
+
No son parte del servicio de imágenes, así que no pueden depender de estar
|
|
1015
|
+
asignado a él: sin ese servicio nadie lo está y la bandeja quedaría de solo
|
|
1016
|
+
lectura. En ese caso vale la asignación a cualquier otro servicio del
|
|
1017
|
+
producto.
|
|
1018
|
+
*/
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
var canEditAssets = function canEditAssets() {
|
|
1022
|
+
if (isAuditorAssigned() || isUserAssignedToService()) return true;
|
|
1023
|
+
if (hasImagesService) return false;
|
|
1024
|
+
var allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
1025
|
+
if (!allowedRoles.includes(user === null || user === void 0 ? void 0 : user.id_role)) return false;
|
|
1026
|
+
return ["description", "datasheet"].some(function (concept) {
|
|
1027
|
+
return isAssignedAs("especialist", concept) || isAssignedAs("facilitator", concept);
|
|
1028
|
+
});
|
|
1029
|
+
};
|
|
1005
1030
|
|
|
1006
1031
|
var canShowSingleEvaluationButtons = function canShowSingleEvaluationButtons(action) {
|
|
1007
1032
|
var _state$services_data, _state$services_data$, _state$services_data$2;
|
|
@@ -1111,7 +1136,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1111
1136
|
|
|
1112
1137
|
var handleOnClickSaveImages = /*#__PURE__*/function () {
|
|
1113
1138
|
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1114
|
-
var _state$
|
|
1139
|
+
var _state$product9, _state$product9$servi;
|
|
1115
1140
|
|
|
1116
1141
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1117
1142
|
while (1) {
|
|
@@ -1129,7 +1154,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1129
1154
|
return _context6.abrupt("return");
|
|
1130
1155
|
|
|
1131
1156
|
case 4:
|
|
1132
|
-
if (!(((_state$
|
|
1157
|
+
if (!(((_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : (_state$product9$servi = _state$product9.services) === null || _state$product9$servi === void 0 ? void 0 : _state$product9$servi.images) === 1)) {
|
|
1133
1158
|
_context6.next = 9;
|
|
1134
1159
|
break;
|
|
1135
1160
|
}
|
|
@@ -1163,7 +1188,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1163
1188
|
var loadFamily = /*#__PURE__*/function () {
|
|
1164
1189
|
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
1165
1190
|
var forzar,
|
|
1166
|
-
_state$
|
|
1191
|
+
_state$product10,
|
|
1167
1192
|
res,
|
|
1168
1193
|
data,
|
|
1169
1194
|
_args7 = arguments;
|
|
@@ -1185,7 +1210,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1185
1210
|
_context7.prev = 3;
|
|
1186
1211
|
_context7.next = 6;
|
|
1187
1212
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/family"), {
|
|
1188
|
-
articleId: (_state$
|
|
1213
|
+
articleId: (_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.id_article
|
|
1189
1214
|
}, {
|
|
1190
1215
|
headers: {
|
|
1191
1216
|
Authorization: token
|
|
@@ -1235,16 +1260,16 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1235
1260
|
|
|
1236
1261
|
|
|
1237
1262
|
(0, _react.useEffect)(function () {
|
|
1238
|
-
var _state$
|
|
1263
|
+
var _state$product11;
|
|
1239
1264
|
|
|
1240
|
-
if (!((_state$
|
|
1265
|
+
if (!((_state$product11 = state.product) !== null && _state$product11 !== void 0 && _state$product11.id_article)) return;
|
|
1241
1266
|
loadFamily(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1242
|
-
}, [(_state$
|
|
1267
|
+
}, [(_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.id_article]); // El conteo sale de la familia recién consultada, no del producto.
|
|
1243
1268
|
|
|
1244
1269
|
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) {
|
|
1245
1270
|
return !v.isCurrent;
|
|
1246
1271
|
}).length;
|
|
1247
|
-
var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$
|
|
1272
|
+
var esHijoDeOtro = family !== null && family !== void 0 && family.error ? !!((_state$product13 = state.product) !== null && _state$product13 !== void 0 && _state$product13.parentArticleId) : !!(family !== null && family !== void 0 && family.parent);
|
|
1248
1273
|
/*
|
|
1249
1274
|
Un hijo no se agrupa como variante (decisión de producto, 2026-09-25).
|
|
1250
1275
|
Agrupar declara «estos son el mismo producto en otra presentación», y un
|
|
@@ -1286,14 +1311,14 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1286
1311
|
*/
|
|
1287
1312
|
|
|
1288
1313
|
var handleOnUnlinked = function handleOnUnlinked(result) {
|
|
1289
|
-
var _state$product$varian, _state$
|
|
1314
|
+
var _state$product$varian, _state$product14, _updatedProduct$varia;
|
|
1290
1315
|
|
|
1291
1316
|
if (!result) return;
|
|
1292
1317
|
var updatedProduct = result.mode === "self" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1293
1318
|
parentArticleId: null,
|
|
1294
1319
|
variantsCount: 0
|
|
1295
1320
|
}) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1296
|
-
variantsCount: Math.max(((_state$product$varian = (_state$
|
|
1321
|
+
variantsCount: Math.max(((_state$product$varian = (_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.variantsCount) !== null && _state$product$varian !== void 0 ? _state$product$varian : 1) - 1, 0)
|
|
1297
1322
|
});
|
|
1298
1323
|
dispatch({
|
|
1299
1324
|
type: "SET_PRODUCT",
|
|
@@ -1347,7 +1372,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1347
1372
|
var loadVariantGroup = /*#__PURE__*/function () {
|
|
1348
1373
|
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
1349
1374
|
var forzar,
|
|
1350
|
-
_state$
|
|
1375
|
+
_state$product15,
|
|
1351
1376
|
res,
|
|
1352
1377
|
data,
|
|
1353
1378
|
_args8 = arguments;
|
|
@@ -1369,7 +1394,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1369
1394
|
_context8.prev = 3;
|
|
1370
1395
|
_context8.next = 6;
|
|
1371
1396
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/group"), {
|
|
1372
|
-
articleId: (_state$
|
|
1397
|
+
articleId: (_state$product15 = state.product) === null || _state$product15 === void 0 ? void 0 : _state$product15.id_article
|
|
1373
1398
|
}, {
|
|
1374
1399
|
headers: {
|
|
1375
1400
|
Authorization: token
|
|
@@ -1407,15 +1432,15 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1407
1432
|
}();
|
|
1408
1433
|
|
|
1409
1434
|
(0, _react.useEffect)(function () {
|
|
1410
|
-
var _state$
|
|
1435
|
+
var _state$product16;
|
|
1411
1436
|
|
|
1412
|
-
if (!((_state$
|
|
1437
|
+
if (!((_state$product16 = state.product) !== null && _state$product16 !== void 0 && _state$product16.id_article)) return;
|
|
1413
1438
|
loadVariantGroup(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1414
|
-
}, [(_state$
|
|
1439
|
+
}, [(_state$product17 = state.product) === null || _state$product17 === void 0 ? void 0 : _state$product17.id_article]);
|
|
1415
1440
|
|
|
1416
1441
|
var handleOnLeaveGroup = /*#__PURE__*/function () {
|
|
1417
1442
|
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
1418
|
-
var _state$
|
|
1443
|
+
var _state$product18, res;
|
|
1419
1444
|
|
|
1420
1445
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1421
1446
|
while (1) {
|
|
@@ -1424,7 +1449,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1424
1449
|
_context9.prev = 0;
|
|
1425
1450
|
_context9.next = 3;
|
|
1426
1451
|
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/leave"), {
|
|
1427
|
-
articleId: (_state$
|
|
1452
|
+
articleId: (_state$product18 = state.product) === null || _state$product18 === void 0 ? void 0 : _state$product18.id_article
|
|
1428
1453
|
}, {
|
|
1429
1454
|
headers: {
|
|
1430
1455
|
Authorization: token
|
|
@@ -1562,11 +1587,11 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1562
1587
|
|
|
1563
1588
|
|
|
1564
1589
|
var handleOnLinkedVariants = function handleOnLinkedVariants(result) {
|
|
1565
|
-
var _state$product$varian2, _state$
|
|
1590
|
+
var _state$product$varian2, _state$product19, _result$linked, _result$parentArticle;
|
|
1566
1591
|
|
|
1567
1592
|
if (!result) return;
|
|
1568
1593
|
var updatedProduct = result.mode === "children" ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1569
|
-
variantsCount: ((_state$product$varian2 = (_state$
|
|
1594
|
+
variantsCount: ((_state$product$varian2 = (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.variantsCount) !== null && _state$product$varian2 !== void 0 ? _state$product$varian2 : 0) + ((_result$linked = result.linked) !== null && _result$linked !== void 0 ? _result$linked : []).length
|
|
1570
1595
|
}) : (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1571
1596
|
parentArticleId: (_result$parentArticle = result.parentArticleId) !== null && _result$parentArticle !== void 0 ? _result$parentArticle : null,
|
|
1572
1597
|
variantsCount: 0
|
|
@@ -1641,7 +1666,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1641
1666
|
|
|
1642
1667
|
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
1643
1668
|
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(attributeId) {
|
|
1644
|
-
var _state$
|
|
1669
|
+
var _state$product20;
|
|
1645
1670
|
|
|
1646
1671
|
var kind,
|
|
1647
1672
|
esDescripcion,
|
|
@@ -1654,7 +1679,7 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
1654
1679
|
case 0:
|
|
1655
1680
|
kind = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : "attribute";
|
|
1656
1681
|
|
|
1657
|
-
if (!(!attributeId || !((_state$
|
|
1682
|
+
if (!(!attributeId || !((_state$product20 = state.product) !== null && _state$product20 !== void 0 && _state$product20.id_article))) {
|
|
1658
1683
|
_context11.next = 3;
|
|
1659
1684
|
break;
|
|
1660
1685
|
}
|
|
@@ -2818,6 +2843,8 @@ var useCreatorsProductEdition = function useCreatorsProductEdition(_ref) {
|
|
|
2818
2843
|
isRetailer: isRetailer,
|
|
2819
2844
|
digitalAssets: digitalAssets,
|
|
2820
2845
|
currentTray: currentTray,
|
|
2846
|
+
hasImagesService: hasImagesService,
|
|
2847
|
+
canEditAssets: canEditAssets,
|
|
2821
2848
|
assetsLoadedFor: assetsLoadedFor,
|
|
2822
2849
|
handleOnSetSelectedAssets: handleOnSetSelectedAssets,
|
|
2823
2850
|
handleOnSetAllAssetsChecked: handleOnSetAllAssetsChecked,
|
|
@@ -253,6 +253,8 @@ var buildFamily = function buildFamily(familia) {
|
|
|
253
253
|
/**
|
|
254
254
|
* Crea las respuestas.
|
|
255
255
|
* - `images: false` simula un producto sin imágenes.
|
|
256
|
+
* - `imagesService: false` simula un producto sin el servicio de imágenes
|
|
257
|
+
* contratado: sin su renglón en los servicios, el estatus queda en "NS".
|
|
256
258
|
* - `delSolStatus` cambia el estatus de los tres servicios de Del Sol; con
|
|
257
259
|
* "AC" el auditor asignado puede validar o rechazar.
|
|
258
260
|
* - `familia`: "padre" (este producto con dos hijos) o "hijo" (este producto
|
|
@@ -265,6 +267,8 @@ var buildFixtures = function buildFixtures() {
|
|
|
265
267
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
266
268
|
_ref$images = _ref.images,
|
|
267
269
|
images = _ref$images === void 0 ? true : _ref$images,
|
|
270
|
+
_ref$imagesService = _ref.imagesService,
|
|
271
|
+
imagesService = _ref$imagesService === void 0 ? true : _ref$imagesService,
|
|
268
272
|
delSolStatus = _ref.delSolStatus,
|
|
269
273
|
familia = _ref.familia,
|
|
270
274
|
_ref$grupo = _ref.grupo,
|
|
@@ -398,7 +402,7 @@ var buildFixtures = function buildFixtures() {
|
|
|
398
402
|
}),
|
|
399
403
|
services: lambda({
|
|
400
404
|
message: "OK",
|
|
401
|
-
data: [service(36, "datasheet", "RA/AS", 2), service(36, "description", "RA/AS", 2), service(
|
|
405
|
+
data: [service(36, "datasheet", "RA/AS", 2), service(36, "description", "RA/AS", 2), service(38, "datasheet", delSolStatus !== null && delSolStatus !== void 0 ? delSolStatus : "RA/AS", 2), service(38, "description", delSolStatus !== null && delSolStatus !== void 0 ? delSolStatus : "RA/AS", 2)].concat((0, _toConsumableArray2.default)(imagesService ? [service(36, "images", "AA", 5), service(38, "images", delSolStatus !== null && delSolStatus !== void 0 ? delSolStatus : "AA", 5)] : []))
|
|
402
406
|
}),
|
|
403
407
|
percentages: lambda([{
|
|
404
408
|
id_article: ARTICLE_ID,
|
|
@@ -78,6 +78,8 @@ var createMockAdapter = function createMockAdapter() {
|
|
|
78
78
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
79
79
|
_ref$images = _ref.images,
|
|
80
80
|
images = _ref$images === void 0 ? true : _ref$images,
|
|
81
|
+
_ref$imagesService = _ref.imagesService,
|
|
82
|
+
imagesService = _ref$imagesService === void 0 ? true : _ref$imagesService,
|
|
81
83
|
_ref$failLoad = _ref.failLoad,
|
|
82
84
|
failLoad = _ref$failLoad === void 0 ? false : _ref$failLoad,
|
|
83
85
|
delSolStatus = _ref.delSolStatus,
|
|
@@ -86,6 +88,7 @@ var createMockAdapter = function createMockAdapter() {
|
|
|
86
88
|
|
|
87
89
|
var fx = (0, _api.buildFixtures)({
|
|
88
90
|
images: images,
|
|
91
|
+
imagesService: imagesService,
|
|
89
92
|
delSolStatus: delSolStatus,
|
|
90
93
|
familia: familia,
|
|
91
94
|
grupo: grupo
|
|
@@ -65,11 +65,16 @@ var TrayTabs = function TrayTabs(_ref) {
|
|
|
65
65
|
var activeTray = _ref.activeTray,
|
|
66
66
|
setActiveTray = _ref.setActiveTray,
|
|
67
67
|
imagesCount = _ref.imagesCount,
|
|
68
|
-
assetsCount = _ref.assetsCount
|
|
68
|
+
assetsCount = _ref.assetsCount,
|
|
69
|
+
_ref$hasImagesService = _ref.hasImagesService,
|
|
70
|
+
hasImagesService = _ref$hasImagesService === void 0 ? true : _ref$hasImagesService;
|
|
69
71
|
var trays = [{
|
|
70
72
|
id: _GalleryTrayTabs.TRAYS.IMAGES,
|
|
71
73
|
label: "Imágenes",
|
|
72
|
-
count: imagesCount
|
|
74
|
+
count: imagesCount,
|
|
75
|
+
// Sin el servicio contratado no hay nada que mostrar en esa bandeja,
|
|
76
|
+
// pero se deja a la vista para que se entienda por qué.
|
|
77
|
+
disabled: !hasImagesService
|
|
73
78
|
}, {
|
|
74
79
|
id: _GalleryTrayTabs.TRAYS.ASSETS,
|
|
75
80
|
label: "Activos digitales",
|
|
@@ -96,6 +101,7 @@ var TrayTabs = function TrayTabs(_ref) {
|
|
|
96
101
|
var active = tray.id === activeTray;
|
|
97
102
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tab, {
|
|
98
103
|
value: tray.id,
|
|
104
|
+
disabled: tray.disabled,
|
|
99
105
|
disableRipple: true,
|
|
100
106
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
101
107
|
direction: "row",
|
|
@@ -129,6 +135,12 @@ var TrayTabs = function TrayTabs(_ref) {
|
|
|
129
135
|
"&.Mui-selected": {
|
|
130
136
|
color: _tokens.COLORS.s5,
|
|
131
137
|
fontWeight: 600
|
|
138
|
+
},
|
|
139
|
+
// Igual que en `TabsBar`: el tema de Creators las pinta de rosa
|
|
140
|
+
// al pasar el ratón y aquí no se quiere.
|
|
141
|
+
"&:hover, &.Mui-selected:hover": {
|
|
142
|
+
color: _tokens.COLORS.s5,
|
|
143
|
+
backgroundColor: "transparent"
|
|
132
144
|
}
|
|
133
145
|
}
|
|
134
146
|
}, tray.id);
|
|
@@ -223,6 +235,8 @@ var ImagesSection = function ImagesSection(_ref3) {
|
|
|
223
235
|
selectedImages = _ref3.selectedImages,
|
|
224
236
|
imageLayout = _ref3.imageLayout,
|
|
225
237
|
enableDigitalAssets = _ref3.enableDigitalAssets,
|
|
238
|
+
_ref3$hasImagesServic = _ref3.hasImagesService,
|
|
239
|
+
hasImagesService = _ref3$hasImagesServic === void 0 ? true : _ref3$hasImagesServic,
|
|
226
240
|
currentTray = _ref3.currentTray,
|
|
227
241
|
setActiveTray = _ref3.setActiveTray,
|
|
228
242
|
digitalAssets = _ref3.digitalAssets,
|
|
@@ -293,7 +307,8 @@ var ImagesSection = function ImagesSection(_ref3) {
|
|
|
293
307
|
activeTray: currentTray,
|
|
294
308
|
setActiveTray: setActiveTray,
|
|
295
309
|
imagesCount: images.length,
|
|
296
|
-
assetsCount: (_digitalAssets$assets = digitalAssets === null || digitalAssets === void 0 ? void 0 : (_digitalAssets$assets2 = digitalAssets.assets) === null || _digitalAssets$assets2 === void 0 ? void 0 : _digitalAssets$assets2.length) !== null && _digitalAssets$assets !== void 0 ? _digitalAssets$assets : 0
|
|
310
|
+
assetsCount: (_digitalAssets$assets = digitalAssets === null || digitalAssets === void 0 ? void 0 : (_digitalAssets$assets2 = digitalAssets.assets) === null || _digitalAssets$assets2 === void 0 ? void 0 : _digitalAssets$assets2.length) !== null && _digitalAssets$assets !== void 0 ? _digitalAssets$assets : 0,
|
|
311
|
+
hasImagesService: hasImagesService
|
|
297
312
|
}), currentTray === _GalleryTrayTabs.TRAYS.ASSETS && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
298
313
|
sx: {
|
|
299
314
|
position: "relative",
|
|
@@ -60,6 +60,16 @@ var tabSx = {
|
|
|
60
60
|
xs: 14,
|
|
61
61
|
sm: 18
|
|
62
62
|
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
El tema de MUI de Creators pinta las pestañas de rosa al pasar el ratón
|
|
67
|
+
(`MuiTab.styleOverrides.root`). Aquí no se quiere ese realce, y la librería
|
|
68
|
+
no debe depender del tema de quien la consume: se anula explícitamente.
|
|
69
|
+
*/
|
|
70
|
+
"&:hover, &.Mui-selected:hover": {
|
|
71
|
+
color: _tokens.COLORS.s5,
|
|
72
|
+
backgroundColor: "transparent"
|
|
63
73
|
}
|
|
64
74
|
};
|
|
65
75
|
|
package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.SinImagenes = exports.HijoDeOtro = exports.EspecialistaTextosCelular = exports.EspecialistaTextos = exports.EspecialistaImagenesCelular = exports.EspecialistaImagenes = exports.ErrorAlCargar = exports.ConVariantes = exports.AuditorQACelular = exports.AuditorQA = exports.AuditorPorEvaluar = void 0;
|
|
8
|
+
exports.default = exports.SinServicioDeImagenes = exports.SinImagenes = exports.HijoDeOtro = exports.EspecialistaTextosCelular = exports.EspecialistaTextos = exports.EspecialistaImagenesCelular = exports.EspecialistaImagenes = exports.ErrorAlCargar = exports.ConVariantes = exports.AuditorQACelular = exports.AuditorQA = exports.AuditorPorEvaluar = void 0;
|
|
9
9
|
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
11
|
|
|
@@ -125,7 +125,15 @@ HijoDeOtro.args = EspecialistaTextos.args;
|
|
|
125
125
|
HijoDeOtro.decorators = [(0, _mockApi.withMockApi)({
|
|
126
126
|
familia: "hijo"
|
|
127
127
|
})]; // --- Casos límite -----------------------------------------------------------
|
|
128
|
-
|
|
128
|
+
// Producto sin el servicio de imágenes contratado: la bandeja de imágenes
|
|
129
|
+
// queda deshabilitada y la de activos digitales sigue siendo utilizable.
|
|
130
|
+
|
|
131
|
+
var SinServicioDeImagenes = Template.bind({});
|
|
132
|
+
exports.SinServicioDeImagenes = SinServicioDeImagenes;
|
|
133
|
+
SinServicioDeImagenes.args = AuditorQA.args;
|
|
134
|
+
SinServicioDeImagenes.decorators = [(0, _mockApi.withMockApi)({
|
|
135
|
+
imagesService: false
|
|
136
|
+
})];
|
|
129
137
|
var SinImagenes = Template.bind({});
|
|
130
138
|
exports.SinImagenes = SinImagenes;
|
|
131
139
|
SinImagenes.args = EspecialistaImagenes.args;
|
package/package.json
CHANGED
|
@@ -67,6 +67,8 @@ export const CreatorsProductEditionView = ({
|
|
|
67
67
|
isRetailer,
|
|
68
68
|
digitalAssets,
|
|
69
69
|
currentTray,
|
|
70
|
+
hasImagesService,
|
|
71
|
+
canEditAssets,
|
|
70
72
|
assetsLoadedFor,
|
|
71
73
|
handleOnSetSelectedAssets,
|
|
72
74
|
handleOnSetAllAssetsChecked,
|
|
@@ -635,7 +637,14 @@ export const CreatorsProductEditionView = ({
|
|
|
635
637
|
: handleOnDownloadImages
|
|
636
638
|
}
|
|
637
639
|
askToDeleteImages={handleOnAskToDeleteImages}
|
|
638
|
-
|
|
640
|
+
// En la bandeja de activos el permiso es el de los activos: sin
|
|
641
|
+
// servicio de imágenes nadie está asignado a él y el botón de
|
|
642
|
+
// guardar desaparecería justo donde sí hay algo que guardar.
|
|
643
|
+
showSaveButton={
|
|
644
|
+
currentTray === TRAYS.ASSETS
|
|
645
|
+
? canEditAssets()
|
|
646
|
+
: isAuditorAssigned() || isUserAssignedToService()
|
|
647
|
+
}
|
|
639
648
|
onClickSave={handleOnClickSave}
|
|
640
649
|
// validations
|
|
641
650
|
canAssign={![7, 8].includes(user.id_role)}
|
|
@@ -699,13 +708,19 @@ export const CreatorsProductEditionView = ({
|
|
|
699
708
|
) : (
|
|
700
709
|
<NoService />
|
|
701
710
|
))}
|
|
711
|
+
{/*
|
|
712
|
+
Los activos digitales no son parte del servicio de
|
|
713
|
+
imágenes: su bandeja sigue disponible aunque el producto no
|
|
714
|
+
tenga ese servicio contratado.
|
|
715
|
+
*/}
|
|
702
716
|
{state.active_tab === "Imágenes" &&
|
|
703
|
-
(
|
|
717
|
+
(hasImagesService || enableDigitalAssets ? (
|
|
704
718
|
<ImagesSection
|
|
705
719
|
imagesValues={state.images_values}
|
|
706
720
|
selectedImages={state.selected_images}
|
|
707
721
|
imageLayout={imageLayout}
|
|
708
722
|
enableDigitalAssets={enableDigitalAssets}
|
|
723
|
+
hasImagesService={hasImagesService}
|
|
709
724
|
currentTray={currentTray}
|
|
710
725
|
setActiveTray={setActiveTray}
|
|
711
726
|
digitalAssets={digitalAssets}
|
|
@@ -713,7 +728,11 @@ export const CreatorsProductEditionView = ({
|
|
|
713
728
|
selectedAssets={state.selected_assets}
|
|
714
729
|
setSelectedAssets={handleOnSetSelectedAssets}
|
|
715
730
|
setAllAssetsChecked={handleOnSetAllAssetsChecked}
|
|
716
|
-
canEdit={
|
|
731
|
+
canEdit={
|
|
732
|
+
currentTray === TRAYS.ASSETS
|
|
733
|
+
? canEditAssets()
|
|
734
|
+
: isAuditorAssigned() || isUserAssignedToService()
|
|
735
|
+
}
|
|
717
736
|
setCheckAll={handleOnSetCheckAll}
|
|
718
737
|
setSelectedImages={handleOnSetSelectedImages}
|
|
719
738
|
onChangeCurrentImage={handleOnChangeCurrentImage}
|
|
@@ -253,7 +253,18 @@ export const useCreatorsProductEdition = ({
|
|
|
253
253
|
onUploaded: (uploaded) => registerUploadedAssets(token, uploaded),
|
|
254
254
|
});
|
|
255
255
|
const [activeTray, setActiveTray] = useState(TRAYS.IMAGES);
|
|
256
|
-
|
|
256
|
+
|
|
257
|
+
/*
|
|
258
|
+
Los activos digitales no pertenecen al servicio de imágenes: se suben
|
|
259
|
+
aunque el producto no lo tenga contratado. Sin ese servicio solo queda su
|
|
260
|
+
bandeja, así que la vista abre directamente en ella.
|
|
261
|
+
*/
|
|
262
|
+
const hasImagesService = state.product?.images_status !== "NS";
|
|
263
|
+
const currentTray = !enableDigitalAssets
|
|
264
|
+
? TRAYS.IMAGES
|
|
265
|
+
: hasImagesService
|
|
266
|
+
? activeTray
|
|
267
|
+
: TRAYS.ASSETS;
|
|
257
268
|
|
|
258
269
|
/*
|
|
259
270
|
De qué artículo se cargaron ya los activos.
|
|
@@ -704,6 +715,28 @@ export const useCreatorsProductEdition = ({
|
|
|
704
715
|
return isAssigned && validUser;
|
|
705
716
|
};
|
|
706
717
|
|
|
718
|
+
/*
|
|
719
|
+
Permiso sobre la bandeja de activos digitales.
|
|
720
|
+
|
|
721
|
+
No son parte del servicio de imágenes, así que no pueden depender de estar
|
|
722
|
+
asignado a él: sin ese servicio nadie lo está y la bandeja quedaría de solo
|
|
723
|
+
lectura. En ese caso vale la asignación a cualquier otro servicio del
|
|
724
|
+
producto.
|
|
725
|
+
*/
|
|
726
|
+
const canEditAssets = () => {
|
|
727
|
+
if (isAuditorAssigned() || isUserAssignedToService()) return true;
|
|
728
|
+
if (hasImagesService) return false;
|
|
729
|
+
|
|
730
|
+
const allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
731
|
+
if (!allowedRoles.includes(user?.id_role)) return false;
|
|
732
|
+
|
|
733
|
+
return ["description", "datasheet"].some(
|
|
734
|
+
(concept) =>
|
|
735
|
+
isAssignedAs("especialist", concept) ||
|
|
736
|
+
isAssignedAs("facilitator", concept),
|
|
737
|
+
);
|
|
738
|
+
};
|
|
739
|
+
|
|
707
740
|
const canShowSingleEvaluationButtons = (action) => {
|
|
708
741
|
let concept = getConceptByTab(action || state.active_tab);
|
|
709
742
|
|
|
@@ -2105,6 +2138,8 @@ export const useCreatorsProductEdition = ({
|
|
|
2105
2138
|
isRetailer,
|
|
2106
2139
|
digitalAssets,
|
|
2107
2140
|
currentTray,
|
|
2141
|
+
hasImagesService,
|
|
2142
|
+
canEditAssets,
|
|
2108
2143
|
assetsLoadedFor,
|
|
2109
2144
|
handleOnSetSelectedAssets,
|
|
2110
2145
|
handleOnSetAllAssetsChecked,
|
|
@@ -190,13 +190,21 @@ const buildFamily = (familia) => {
|
|
|
190
190
|
/**
|
|
191
191
|
* Crea las respuestas.
|
|
192
192
|
* - `images: false` simula un producto sin imágenes.
|
|
193
|
+
* - `imagesService: false` simula un producto sin el servicio de imágenes
|
|
194
|
+
* contratado: sin su renglón en los servicios, el estatus queda en "NS".
|
|
193
195
|
* - `delSolStatus` cambia el estatus de los tres servicios de Del Sol; con
|
|
194
196
|
* "AC" el auditor asignado puede validar o rechazar.
|
|
195
197
|
* - `familia`: "padre" (este producto con dos hijos) o "hijo" (este producto
|
|
196
198
|
* es hijo de otro, con un hermano).
|
|
197
199
|
* - `grupo`: el producto está en un grupo de variantes con otros dos.
|
|
198
200
|
*/
|
|
199
|
-
export const buildFixtures = ({
|
|
201
|
+
export const buildFixtures = ({
|
|
202
|
+
images = true,
|
|
203
|
+
imagesService = true,
|
|
204
|
+
delSolStatus,
|
|
205
|
+
familia,
|
|
206
|
+
grupo = false,
|
|
207
|
+
} = {}) => ({
|
|
200
208
|
comments: {
|
|
201
209
|
description: lambda({ message: "OK", data: [comment(15886, "description", "Revisar la longitud del header.")], order: null }),
|
|
202
210
|
datasheet: lambda({ message: "OK", data: [comment(15885, "datasheet", "Rechazo")], order: null }),
|
|
@@ -269,10 +277,14 @@ export const buildFixtures = ({ images = true, delSolStatus, familia, grupo = fa
|
|
|
269
277
|
data: [
|
|
270
278
|
service(36, "datasheet", "RA/AS", 2),
|
|
271
279
|
service(36, "description", "RA/AS", 2),
|
|
272
|
-
service(36, "images", "AA", 5),
|
|
273
280
|
service(38, "datasheet", delSolStatus ?? "RA/AS", 2),
|
|
274
281
|
service(38, "description", delSolStatus ?? "RA/AS", 2),
|
|
275
|
-
|
|
282
|
+
...(imagesService
|
|
283
|
+
? [
|
|
284
|
+
service(36, "images", "AA", 5),
|
|
285
|
+
service(38, "images", delSolStatus ?? "AA", 5),
|
|
286
|
+
]
|
|
287
|
+
: []),
|
|
276
288
|
],
|
|
277
289
|
}),
|
|
278
290
|
percentages: lambda([
|
|
@@ -36,12 +36,19 @@ const ok = { statusCode: 200, body: JSON.stringify({ message: "OK" }) };
|
|
|
36
36
|
|
|
37
37
|
export const createMockAdapter = ({
|
|
38
38
|
images = true,
|
|
39
|
+
imagesService = true,
|
|
39
40
|
failLoad = false,
|
|
40
41
|
delSolStatus,
|
|
41
42
|
familia,
|
|
42
43
|
grupo,
|
|
43
44
|
} = {}) => {
|
|
44
|
-
const fx = buildFixtures({
|
|
45
|
+
const fx = buildFixtures({
|
|
46
|
+
images,
|
|
47
|
+
imagesService,
|
|
48
|
+
delSolStatus,
|
|
49
|
+
familia,
|
|
50
|
+
grupo,
|
|
51
|
+
});
|
|
45
52
|
|
|
46
53
|
return (config) => {
|
|
47
54
|
const method = (config.method || "get").toUpperCase();
|
|
@@ -38,9 +38,22 @@ const LIST_COLUMNS = [
|
|
|
38
38
|
// de lado dentro de su caja en vez de aplastar las columnas.
|
|
39
39
|
const LIST_MIN_WIDTH = 760;
|
|
40
40
|
|
|
41
|
-
const TrayTabs = ({
|
|
41
|
+
const TrayTabs = ({
|
|
42
|
+
activeTray,
|
|
43
|
+
setActiveTray,
|
|
44
|
+
imagesCount,
|
|
45
|
+
assetsCount,
|
|
46
|
+
hasImagesService = true,
|
|
47
|
+
}) => {
|
|
42
48
|
const trays = [
|
|
43
|
-
{
|
|
49
|
+
{
|
|
50
|
+
id: TRAYS.IMAGES,
|
|
51
|
+
label: "Imágenes",
|
|
52
|
+
count: imagesCount,
|
|
53
|
+
// Sin el servicio contratado no hay nada que mostrar en esa bandeja,
|
|
54
|
+
// pero se deja a la vista para que se entienda por qué.
|
|
55
|
+
disabled: !hasImagesService,
|
|
56
|
+
},
|
|
44
57
|
{ id: TRAYS.ASSETS, label: "Activos digitales", count: assetsCount },
|
|
45
58
|
];
|
|
46
59
|
return (
|
|
@@ -58,6 +71,7 @@ const TrayTabs = ({ activeTray, setActiveTray, imagesCount, assetsCount }) => {
|
|
|
58
71
|
<Tab
|
|
59
72
|
key={tray.id}
|
|
60
73
|
value={tray.id}
|
|
74
|
+
disabled={tray.disabled}
|
|
61
75
|
disableRipple
|
|
62
76
|
label={
|
|
63
77
|
<Stack direction="row" alignItems="center" gap="6px">
|
|
@@ -87,6 +101,12 @@ const TrayTabs = ({ activeTray, setActiveTray, imagesCount, assetsCount }) => {
|
|
|
87
101
|
letterSpacing: "-0.015em",
|
|
88
102
|
color: COLORS.s4,
|
|
89
103
|
"&.Mui-selected": { color: COLORS.s5, fontWeight: 600 },
|
|
104
|
+
// Igual que en `TabsBar`: el tema de Creators las pinta de rosa
|
|
105
|
+
// al pasar el ratón y aquí no se quiere.
|
|
106
|
+
"&:hover, &.Mui-selected:hover": {
|
|
107
|
+
color: COLORS.s5,
|
|
108
|
+
backgroundColor: "transparent",
|
|
109
|
+
},
|
|
90
110
|
}}
|
|
91
111
|
/>
|
|
92
112
|
);
|
|
@@ -167,6 +187,7 @@ export const ImagesSection = ({
|
|
|
167
187
|
imageLayout,
|
|
168
188
|
// bandejas
|
|
169
189
|
enableDigitalAssets,
|
|
190
|
+
hasImagesService = true,
|
|
170
191
|
currentTray,
|
|
171
192
|
setActiveTray,
|
|
172
193
|
digitalAssets,
|
|
@@ -230,6 +251,7 @@ export const ImagesSection = ({
|
|
|
230
251
|
setActiveTray={setActiveTray}
|
|
231
252
|
imagesCount={images.length}
|
|
232
253
|
assetsCount={digitalAssets?.assets?.length ?? 0}
|
|
254
|
+
hasImagesService={hasImagesService}
|
|
233
255
|
/>
|
|
234
256
|
)}
|
|
235
257
|
|
|
@@ -44,6 +44,15 @@ const tabSx = {
|
|
|
44
44
|
borderBottom: `2px solid ${COLORS.s3}`,
|
|
45
45
|
transition: "font-size 0.1s",
|
|
46
46
|
"&.Mui-selected": { color: COLORS.s5, fontSize: { xs: 14, sm: 18 } },
|
|
47
|
+
/*
|
|
48
|
+
El tema de MUI de Creators pinta las pestañas de rosa al pasar el ratón
|
|
49
|
+
(`MuiTab.styleOverrides.root`). Aquí no se quiere ese realce, y la librería
|
|
50
|
+
no debe depender del tema de quien la consume: se anula explícitamente.
|
|
51
|
+
*/
|
|
52
|
+
"&:hover, &.Mui-selected:hover": {
|
|
53
|
+
color: COLORS.s5,
|
|
54
|
+
backgroundColor: "transparent",
|
|
55
|
+
},
|
|
47
56
|
};
|
|
48
57
|
|
|
49
58
|
export const TabsBar = ({
|
package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js
CHANGED
|
@@ -102,6 +102,12 @@ HijoDeOtro.decorators = [withMockApi({ familia: "hijo" })];
|
|
|
102
102
|
|
|
103
103
|
// --- Casos límite -----------------------------------------------------------
|
|
104
104
|
|
|
105
|
+
// Producto sin el servicio de imágenes contratado: la bandeja de imágenes
|
|
106
|
+
// queda deshabilitada y la de activos digitales sigue siendo utilizable.
|
|
107
|
+
export const SinServicioDeImagenes = Template.bind({});
|
|
108
|
+
SinServicioDeImagenes.args = AuditorQA.args;
|
|
109
|
+
SinServicioDeImagenes.decorators = [withMockApi({ imagesService: false })];
|
|
110
|
+
|
|
105
111
|
export const SinImagenes = Template.bind({});
|
|
106
112
|
SinImagenes.args = EspecialistaImagenes.args;
|
|
107
113
|
SinImagenes.decorators = [withMockApi({ images: false })];
|