contentoh-components-library 21.6.37 → 21.6.38
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/organisms/LinkVariantsModal/index.js +29 -119
- package/dist/components/organisms/LinkVariantsModal/styles.js +1 -1
- package/package.json +1 -1
- package/src/components/organisms/LinkVariantsModal/index.js +37 -117
- package/src/components/organisms/LinkVariantsModal/styles.js +0 -8
|
@@ -150,8 +150,7 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
150
150
|
var _useState21 = (0, _react.useState)({
|
|
151
151
|
attributes: [],
|
|
152
152
|
descriptions: [],
|
|
153
|
-
images: []
|
|
154
|
-
categoryRetailers: []
|
|
153
|
+
images: []
|
|
155
154
|
}),
|
|
156
155
|
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
157
156
|
offered = _useState22[0],
|
|
@@ -160,8 +159,7 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
160
159
|
var _useState23 = (0, _react.useState)({
|
|
161
160
|
attributes: [],
|
|
162
161
|
descriptions: [],
|
|
163
|
-
images: []
|
|
164
|
-
categoryRetailers: []
|
|
162
|
+
images: []
|
|
165
163
|
}),
|
|
166
164
|
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
167
165
|
chosen = _useState24[0],
|
|
@@ -177,7 +175,6 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
177
175
|
|
|
178
176
|
|
|
179
177
|
var _useState27 = (0, _react.useState)({
|
|
180
|
-
categoryRetailers: null,
|
|
181
178
|
descriptions: null,
|
|
182
179
|
attributes: null,
|
|
183
180
|
images: null
|
|
@@ -451,19 +448,16 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
451
448
|
listas = {
|
|
452
449
|
attributes: data.attributes || [],
|
|
453
450
|
descriptions: data.descriptions || [],
|
|
454
|
-
images: data.images || []
|
|
455
|
-
categoryRetailers: data.categoryRetailers || []
|
|
451
|
+
images: data.images || []
|
|
456
452
|
};
|
|
457
453
|
setOffered(listas);
|
|
458
454
|
setNameScope((_data$nameScope = data.nameScope) !== null && _data$nameScope !== void 0 ? _data$nameScope : null);
|
|
459
455
|
setChosen({
|
|
460
456
|
attributes: [],
|
|
461
457
|
descriptions: [],
|
|
462
|
-
images: []
|
|
463
|
-
categoryRetailers: []
|
|
458
|
+
images: []
|
|
464
459
|
});
|
|
465
460
|
setModes({
|
|
466
|
-
categoryRetailers: null,
|
|
467
461
|
descriptions: null,
|
|
468
462
|
attributes: null,
|
|
469
463
|
images: null
|
|
@@ -544,34 +538,28 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
544
538
|
});
|
|
545
539
|
|
|
546
540
|
var buildInherit = function buildInherit(seleccion) {
|
|
547
|
-
var parejas = offered.categoryRetailers.map(function (item) {
|
|
548
|
-
return {
|
|
549
|
-
clave: "".concat(item.retailerId, "-").concat(item.categoryId),
|
|
550
|
-
retailerId: item.retailerId,
|
|
551
|
-
categoryId: item.categoryId
|
|
552
|
-
};
|
|
553
|
-
});
|
|
554
541
|
return {
|
|
555
542
|
attributes: seleccion.modes.attributes === "all" ? "all-filled" : seleccion.chosen.attributes,
|
|
556
543
|
descriptions: seleccion.modes.descriptions === "all" ? "all" : seleccion.chosen.descriptions,
|
|
557
544
|
images: seleccion.modes.images === "all" ? "all" : seleccion.chosen.images,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
545
|
+
|
|
546
|
+
/*
|
|
547
|
+
Siempre "all", nunca una lista.
|
|
548
|
+
El hijo se queda con las cadenas del padre, sin preguntar. No es una
|
|
549
|
+
preferencia: es lo que hace que la copia de atributos SE VEA. La ficha
|
|
550
|
+
arma su lista desde `attribute_manager` acotado por las cadenas del
|
|
551
|
+
propio producto, así que un valor copiado a un atributo que la cadena del
|
|
552
|
+
hijo no configura queda escrito y invisible.
|
|
553
|
+
Se manda la palabra y no la lista para que signifique "todas" también si
|
|
554
|
+
alguien agregó una cadena al padre entre abrir el modal y guardar.
|
|
555
|
+
*/
|
|
556
|
+
categoryRetailers: "all"
|
|
568
557
|
};
|
|
569
558
|
};
|
|
570
559
|
|
|
571
560
|
var seleccionVacia = function seleccionVacia() {
|
|
572
561
|
return {
|
|
573
562
|
modes: {
|
|
574
|
-
categoryRetailers: null,
|
|
575
563
|
descriptions: null,
|
|
576
564
|
attributes: null,
|
|
577
565
|
images: null
|
|
@@ -579,8 +567,7 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
579
567
|
chosen: {
|
|
580
568
|
attributes: [],
|
|
581
569
|
descriptions: [],
|
|
582
|
-
images: []
|
|
583
|
-
categoryRetailers: []
|
|
570
|
+
images: []
|
|
584
571
|
}
|
|
585
572
|
};
|
|
586
573
|
};
|
|
@@ -606,7 +593,7 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
606
593
|
};
|
|
607
594
|
|
|
608
595
|
var submit = /*#__PURE__*/function () {
|
|
609
|
-
var
|
|
596
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
610
597
|
var inherit, inheritByChild, body, data;
|
|
611
598
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
612
599
|
while (1) {
|
|
@@ -678,24 +665,19 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
678
665
|
}));
|
|
679
666
|
|
|
680
667
|
return function submit() {
|
|
681
|
-
return
|
|
668
|
+
return _ref6.apply(this, arguments);
|
|
682
669
|
};
|
|
683
670
|
}(); // Una dimensión está decidida si el usuario eligió un modo, o si el padre no
|
|
684
671
|
// ofrece nada en ella —no se puede pedir que decida sobre una lista vacía—.
|
|
685
672
|
|
|
686
673
|
|
|
687
674
|
var decidida = function decidida(dimension) {
|
|
688
|
-
if (modes[dimension] !== null) return true;
|
|
689
|
-
|
|
690
|
-
if (dimension === "categoryRetailers") {
|
|
691
|
-
return offered.categoryRetailers.length === 0;
|
|
692
|
-
} // Una imagen cuyo archivo no existe no es algo sobre lo que se pueda decidir.
|
|
693
|
-
|
|
675
|
+
if (modes[dimension] !== null) return true; // Una imagen cuyo archivo no existe no es algo sobre lo que se pueda decidir.
|
|
694
676
|
|
|
695
677
|
return dimension === "images" ? imagenesUtiles.length === 0 : offered[dimension].length === 0;
|
|
696
678
|
};
|
|
697
679
|
|
|
698
|
-
var DIMENSIONES = ["
|
|
680
|
+
var DIMENSIONES = ["descriptions", "attributes", "images"]; // Con pestañas, que la que estoy viendo esté completa no basta: ligar escribe
|
|
699
681
|
// en todos, así que todos tienen que estar decididos. Si no, un producto se
|
|
700
682
|
// ligaría sin heredar nada solo porque nadie abrió su pestaña.
|
|
701
683
|
|
|
@@ -707,24 +689,19 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
707
689
|
if (!guardado) return false;
|
|
708
690
|
return DIMENSIONES.every(function (dimension) {
|
|
709
691
|
if (guardado.modes[dimension] !== null) return true;
|
|
710
|
-
|
|
711
|
-
if (dimension === "categoryRetailers") {
|
|
712
|
-
return offered.categoryRetailers.length === 0;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
692
|
return dimension === "images" ? imagenesUtiles.length === 0 : offered[dimension].length === 0;
|
|
716
693
|
});
|
|
717
694
|
};
|
|
718
695
|
|
|
719
696
|
var todoDecidido = step === "inherit" && (mode === "parent" ? pushToParent !== null : applyToAll ? DIMENSIONES.every(decidida) : selected.every(decididoPara));
|
|
720
|
-
var faltantes = [["
|
|
721
|
-
var
|
|
722
|
-
clave =
|
|
697
|
+
var faltantes = [["descriptions", "descripciones"], ["attributes", "atributos"], ["images", "imágenes"]].filter(function (_ref7) {
|
|
698
|
+
var _ref8 = (0, _slicedToArray2.default)(_ref7, 1),
|
|
699
|
+
clave = _ref8[0];
|
|
723
700
|
|
|
724
701
|
return !decidida(clave);
|
|
725
|
-
}).map(function (
|
|
726
|
-
var
|
|
727
|
-
nombre =
|
|
702
|
+
}).map(function (_ref9) {
|
|
703
|
+
var _ref10 = (0, _slicedToArray2.default)(_ref9, 2),
|
|
704
|
+
nombre = _ref10[1];
|
|
728
705
|
|
|
729
706
|
return nombre;
|
|
730
707
|
});
|
|
@@ -1003,73 +980,6 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
1003
980
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1004
981
|
className: "paso",
|
|
1005
982
|
children: "1"
|
|
1006
|
-
}), " Cadenas y categor\xEDas"]
|
|
1007
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
|
|
1008
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1009
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1010
|
-
type: "radio",
|
|
1011
|
-
name: "categoryRetailers-".concat(activeChild !== null && activeChild !== void 0 ? activeChild : "todos"),
|
|
1012
|
-
checked: modes.categoryRetailers === "all",
|
|
1013
|
-
onChange: function onChange() {
|
|
1014
|
-
return chooseMode("categoryRetailers", "all", offered.categoryRetailers.map(function (item) {
|
|
1015
|
-
return "".concat(item.retailerId, "-").concat(item.categoryId);
|
|
1016
|
-
}));
|
|
1017
|
-
}
|
|
1018
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1019
|
-
children: ["Todas las del producto padre", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1020
|
-
className: "hint",
|
|
1021
|
-
children: [offered.categoryRetailers.length, " cadena(s)."]
|
|
1022
|
-
})]
|
|
1023
|
-
})]
|
|
1024
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1025
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1026
|
-
type: "radio",
|
|
1027
|
-
name: "categoryRetailers-".concat(activeChild !== null && activeChild !== void 0 ? activeChild : "todos"),
|
|
1028
|
-
checked: modes.categoryRetailers === "some",
|
|
1029
|
-
onChange: function onChange() {
|
|
1030
|
-
return chooseMode("categoryRetailers", "some", []);
|
|
1031
|
-
}
|
|
1032
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1033
|
-
children: ["Elegir cu\xE1les", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1034
|
-
className: "hint",
|
|
1035
|
-
children: "Solo se puede heredar de las que ya tiene el padre."
|
|
1036
|
-
})]
|
|
1037
|
-
})]
|
|
1038
|
-
})]
|
|
1039
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.List, {
|
|
1040
|
-
children: offered.categoryRetailers.map(function (item) {
|
|
1041
|
-
return (0, _objectSpread7.default)((0, _objectSpread7.default)({}, item), {}, {
|
|
1042
|
-
clave: "".concat(item.retailerId, "-").concat(item.categoryId)
|
|
1043
|
-
});
|
|
1044
|
-
}).map(function (item) {
|
|
1045
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
1046
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1047
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1048
|
-
type: "checkbox",
|
|
1049
|
-
disabled: modes.categoryRetailers === "all",
|
|
1050
|
-
checked: chosen.categoryRetailers.includes(item.clave),
|
|
1051
|
-
onChange: function onChange() {
|
|
1052
|
-
return toggleChoice("categoryRetailers", item.clave);
|
|
1053
|
-
}
|
|
1054
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
1055
|
-
className: "logo",
|
|
1056
|
-
src: (0, _helper.getRetailerPicture)(item.retailerId, 24, 24),
|
|
1057
|
-
alt: ""
|
|
1058
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1059
|
-
children: [item.retailerName, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1060
|
-
className: "meta",
|
|
1061
|
-
children: item.categoryName || "Sin categoría"
|
|
1062
|
-
})]
|
|
1063
|
-
})]
|
|
1064
|
-
})
|
|
1065
|
-
}, item.clave);
|
|
1066
|
-
})
|
|
1067
|
-
})]
|
|
1068
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Block, {
|
|
1069
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h3", {
|
|
1070
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1071
|
-
className: "paso",
|
|
1072
|
-
children: "2"
|
|
1073
983
|
}), " Descripciones"]
|
|
1074
984
|
}), offered.descriptions.length ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1075
985
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
|
|
@@ -1136,7 +1046,7 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
1136
1046
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h3", {
|
|
1137
1047
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1138
1048
|
className: "paso",
|
|
1139
|
-
children: "
|
|
1049
|
+
children: "2"
|
|
1140
1050
|
}), " Atributos de la ficha t\xE9cnica"]
|
|
1141
1051
|
}), offered.attributes.length ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1142
1052
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
|
|
@@ -1208,7 +1118,7 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
1208
1118
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h3", {
|
|
1209
1119
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1210
1120
|
className: "paso",
|
|
1211
|
-
children: "
|
|
1121
|
+
children: "3"
|
|
1212
1122
|
}), " Im\xE1genes"]
|
|
1213
1123
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
|
|
1214
1124
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
@@ -51,7 +51,7 @@ var SearchRow = _styledComponents.default.form(_templateObject6 || (_templateObj
|
|
|
51
51
|
|
|
52
52
|
exports.SearchRow = SearchRow;
|
|
53
53
|
|
|
54
|
-
var List = _styledComponents.default.ul(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n margin: 0 0 16px;\n padding: 0;\n border: 1px solid ", ";\n border-radius: 6px;\n\n li + li {\n border-top: 1px solid ", ";\n }\n\n label {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 12px;\n cursor: pointer;\n font-size: 13px;\n color: ", ";\n }\n\n .meta {\n display: block;\n font-size: 12px;\n color: ", ";\n }\n\n
|
|
54
|
+
var List = _styledComponents.default.ul(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n list-style: none;\n margin: 0 0 16px;\n padding: 0;\n border: 1px solid ", ";\n border-radius: 6px;\n\n li + li {\n border-top: 1px solid ", ";\n }\n\n label {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 12px;\n cursor: pointer;\n font-size: 13px;\n color: ", ";\n }\n\n .meta {\n display: block;\n font-size: 12px;\n color: ", ";\n }\n\n li {\n display: flex;\n align-items: center;\n }\n\n li > label {\n flex: 1;\n min-width: 0;\n }\n\n .count {\n margin-left: auto;\n font-size: 12px;\n color: ", ";\n white-space: nowrap;\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.s2, _variables.GlobalColors.deep_gray, _variables.GlobalColors.gray, PINK);
|
|
55
55
|
|
|
56
56
|
exports.List = List;
|
|
57
57
|
var AttributeList = (0, _styledComponents.default)(List)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n max-height: 220px;\n overflow-y: auto;\n\n .note {\n display: block;\n font-size: 11px;\n font-style: italic;\n color: ", ";\n }\n\n .value {\n margin-left: auto;\n max-width: 45%;\n font-size: 12px;\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])), _variables.GlobalColors.gray, _variables.GlobalColors.gray);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";
|
|
|
2
2
|
import axios from "axios";
|
|
3
3
|
|
|
4
4
|
import { readPayload, ApiError } from "./api";
|
|
5
|
-
import { getProductImage
|
|
5
|
+
import { getProductImage } from "../../../_utils/helper";
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
Overlay,
|
|
@@ -106,13 +106,11 @@ export const LinkVariantsModal = ({
|
|
|
106
106
|
attributes: [],
|
|
107
107
|
descriptions: [],
|
|
108
108
|
images: [],
|
|
109
|
-
categoryRetailers: [],
|
|
110
109
|
});
|
|
111
110
|
const [chosen, setChosen] = useState({
|
|
112
111
|
attributes: [],
|
|
113
112
|
descriptions: [],
|
|
114
113
|
images: [],
|
|
115
|
-
categoryRetailers: [],
|
|
116
114
|
});
|
|
117
115
|
const [nameScope, setNameScope] = useState(null);
|
|
118
116
|
|
|
@@ -121,7 +119,6 @@ export const LinkVariantsModal = ({
|
|
|
121
119
|
// se pudiera ligar sin haber mirado nada, que es justo lo que hay que evitar
|
|
122
120
|
// en una operación que sobrescribe valores capturados.
|
|
123
121
|
const [modes, setModes] = useState({
|
|
124
|
-
categoryRetailers: null,
|
|
125
122
|
descriptions: null,
|
|
126
123
|
attributes: null,
|
|
127
124
|
images: null,
|
|
@@ -285,7 +282,6 @@ export const LinkVariantsModal = ({
|
|
|
285
282
|
attributes: data.attributes || [],
|
|
286
283
|
descriptions: data.descriptions || [],
|
|
287
284
|
images: data.images || [],
|
|
288
|
-
categoryRetailers: data.categoryRetailers || [],
|
|
289
285
|
};
|
|
290
286
|
|
|
291
287
|
setOffered(listas);
|
|
@@ -294,10 +290,8 @@ export const LinkVariantsModal = ({
|
|
|
294
290
|
attributes: [],
|
|
295
291
|
descriptions: [],
|
|
296
292
|
images: [],
|
|
297
|
-
categoryRetailers: [],
|
|
298
293
|
});
|
|
299
294
|
setModes({
|
|
300
|
-
categoryRetailers: null,
|
|
301
295
|
descriptions: null,
|
|
302
296
|
attributes: null,
|
|
303
297
|
images: null,
|
|
@@ -367,12 +361,6 @@ export const LinkVariantsModal = ({
|
|
|
367
361
|
);
|
|
368
362
|
|
|
369
363
|
const buildInherit = (seleccion) => {
|
|
370
|
-
const parejas = offered.categoryRetailers.map((item) => ({
|
|
371
|
-
clave: `${item.retailerId}-${item.categoryId}`,
|
|
372
|
-
retailerId: item.retailerId,
|
|
373
|
-
categoryId: item.categoryId,
|
|
374
|
-
}));
|
|
375
|
-
|
|
376
364
|
return {
|
|
377
365
|
attributes:
|
|
378
366
|
seleccion.modes.attributes === "all"
|
|
@@ -384,15 +372,24 @@ export const LinkVariantsModal = ({
|
|
|
384
372
|
: seleccion.chosen.descriptions,
|
|
385
373
|
images:
|
|
386
374
|
seleccion.modes.images === "all" ? "all" : seleccion.chosen.images,
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
375
|
+
/*
|
|
376
|
+
Siempre "all", nunca una lista.
|
|
377
|
+
|
|
378
|
+
El hijo se queda con las cadenas del padre, sin preguntar. No es una
|
|
379
|
+
preferencia: es lo que hace que la copia de atributos SE VEA. La ficha
|
|
380
|
+
arma su lista desde `attribute_manager` acotado por las cadenas del
|
|
381
|
+
propio producto, así que un valor copiado a un atributo que la cadena del
|
|
382
|
+
hijo no configura queda escrito y invisible.
|
|
383
|
+
|
|
384
|
+
Se manda la palabra y no la lista para que signifique "todas" también si
|
|
385
|
+
alguien agregó una cadena al padre entre abrir el modal y guardar.
|
|
386
|
+
*/
|
|
387
|
+
categoryRetailers: "all",
|
|
390
388
|
};
|
|
391
389
|
};
|
|
392
390
|
|
|
393
391
|
const seleccionVacia = () => ({
|
|
394
392
|
modes: {
|
|
395
|
-
categoryRetailers: null,
|
|
396
393
|
descriptions: null,
|
|
397
394
|
attributes: null,
|
|
398
395
|
images: null,
|
|
@@ -401,7 +398,6 @@ export const LinkVariantsModal = ({
|
|
|
401
398
|
attributes: [],
|
|
402
399
|
descriptions: [],
|
|
403
400
|
images: [],
|
|
404
|
-
categoryRetailers: [],
|
|
405
401
|
},
|
|
406
402
|
});
|
|
407
403
|
|
|
@@ -478,21 +474,13 @@ export const LinkVariantsModal = ({
|
|
|
478
474
|
// ofrece nada en ella —no se puede pedir que decida sobre una lista vacía—.
|
|
479
475
|
const decidida = (dimension) => {
|
|
480
476
|
if (modes[dimension] !== null) return true;
|
|
481
|
-
if (dimension === "categoryRetailers") {
|
|
482
|
-
return offered.categoryRetailers.length === 0;
|
|
483
|
-
}
|
|
484
477
|
// Una imagen cuyo archivo no existe no es algo sobre lo que se pueda decidir.
|
|
485
478
|
return dimension === "images"
|
|
486
479
|
? imagenesUtiles.length === 0
|
|
487
480
|
: offered[dimension].length === 0;
|
|
488
481
|
};
|
|
489
482
|
|
|
490
|
-
const DIMENSIONES = [
|
|
491
|
-
"categoryRetailers",
|
|
492
|
-
"descriptions",
|
|
493
|
-
"attributes",
|
|
494
|
-
"images",
|
|
495
|
-
];
|
|
483
|
+
const DIMENSIONES = ["descriptions", "attributes", "images"];
|
|
496
484
|
|
|
497
485
|
// Con pestañas, que la que estoy viendo esté completa no basta: ligar escribe
|
|
498
486
|
// en todos, así que todos tienen que estar decididos. Si no, un producto se
|
|
@@ -503,9 +491,6 @@ export const LinkVariantsModal = ({
|
|
|
503
491
|
|
|
504
492
|
return DIMENSIONES.every((dimension) => {
|
|
505
493
|
if (guardado.modes[dimension] !== null) return true;
|
|
506
|
-
if (dimension === "categoryRetailers") {
|
|
507
|
-
return offered.categoryRetailers.length === 0;
|
|
508
|
-
}
|
|
509
494
|
return dimension === "images"
|
|
510
495
|
? imagenesUtiles.length === 0
|
|
511
496
|
: offered[dimension].length === 0;
|
|
@@ -521,7 +506,6 @@ export const LinkVariantsModal = ({
|
|
|
521
506
|
: selected.every(decididoPara));
|
|
522
507
|
|
|
523
508
|
const faltantes = [
|
|
524
|
-
["categoryRetailers", "cadenas"],
|
|
525
509
|
["descriptions", "descripciones"],
|
|
526
510
|
["attributes", "atributos"],
|
|
527
511
|
["images", "imágenes"],
|
|
@@ -858,96 +842,32 @@ export const LinkVariantsModal = ({
|
|
|
858
842
|
</>
|
|
859
843
|
)}
|
|
860
844
|
|
|
861
|
-
{/*
|
|
862
|
-
hijo, porque de eso depende qué atributos le aplican. Las
|
|
863
|
-
imágenes van al final: son la decisión más visual y la que menos
|
|
864
|
-
arrastra a las demás. */}
|
|
845
|
+
{/* Ya no se pregunta por cadenas ni categorías.
|
|
865
846
|
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
<input
|
|
873
|
-
type="radio"
|
|
874
|
-
name={`categoryRetailers-${activeChild ?? "todos"}`}
|
|
875
|
-
checked={modes.categoryRetailers === "all"}
|
|
876
|
-
onChange={() =>
|
|
877
|
-
chooseMode(
|
|
878
|
-
"categoryRetailers",
|
|
879
|
-
"all",
|
|
880
|
-
offered.categoryRetailers.map(
|
|
881
|
-
(item) => `${item.retailerId}-${item.categoryId}`
|
|
882
|
-
)
|
|
883
|
-
)
|
|
884
|
-
}
|
|
885
|
-
/>
|
|
886
|
-
<span>
|
|
887
|
-
Todas las del producto padre
|
|
888
|
-
<span className="hint">
|
|
889
|
-
{offered.categoryRetailers.length} cadena(s).
|
|
890
|
-
</span>
|
|
891
|
-
</span>
|
|
892
|
-
</label>
|
|
893
|
-
<label>
|
|
894
|
-
<input
|
|
895
|
-
type="radio"
|
|
896
|
-
name={`categoryRetailers-${activeChild ?? "todos"}`}
|
|
897
|
-
checked={modes.categoryRetailers === "some"}
|
|
898
|
-
onChange={() =>
|
|
899
|
-
chooseMode("categoryRetailers", "some", [])
|
|
900
|
-
}
|
|
901
|
-
/>
|
|
902
|
-
<span>
|
|
903
|
-
Elegir cuáles
|
|
904
|
-
<span className="hint">
|
|
905
|
-
Solo se puede heredar de las que ya tiene el padre.
|
|
906
|
-
</span>
|
|
907
|
-
</span>
|
|
908
|
-
</label>
|
|
909
|
-
</Choices>
|
|
847
|
+
El valor de un atributo vive en `article_data` por (artículo,
|
|
848
|
+
versión, atributo): no está partido por cadena, así que copiar
|
|
849
|
+
el atributo 27 del padre al hijo es lo mismo sin importar en
|
|
850
|
+
qué cadenas esté cada uno. Elegir cadenas aquí no cambiaba nada
|
|
851
|
+
de eso; solo servía para decidir en qué cadenas vive el hijo, y
|
|
852
|
+
la respuesta correcta resultó ser siempre «las del padre».
|
|
910
853
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
<label>
|
|
920
|
-
<input
|
|
921
|
-
type="checkbox"
|
|
922
|
-
disabled={modes.categoryRetailers === "all"}
|
|
923
|
-
checked={chosen.categoryRetailers.includes(
|
|
924
|
-
item.clave
|
|
925
|
-
)}
|
|
926
|
-
onChange={() =>
|
|
927
|
-
toggleChoice("categoryRetailers", item.clave)
|
|
928
|
-
}
|
|
929
|
-
/>
|
|
930
|
-
<img
|
|
931
|
-
className="logo"
|
|
932
|
-
src={getRetailerPicture(item.retailerId, 24, 24)}
|
|
933
|
-
alt=""
|
|
934
|
-
/>
|
|
935
|
-
<span>
|
|
936
|
-
{item.retailerName}
|
|
937
|
-
<span className="meta">
|
|
938
|
-
{item.categoryName || "Sin categoría"}
|
|
939
|
-
</span>
|
|
940
|
-
</span>
|
|
941
|
-
</label>
|
|
942
|
-
</li>
|
|
943
|
-
))}
|
|
944
|
-
</List>
|
|
854
|
+
Medido en dev sobre las 24 familias reales: cuando el hijo
|
|
855
|
+
comparte al menos una cadena con el padre, 0 atributos quedan
|
|
856
|
+
sin mostrarse; cuando no comparte ninguna, quedan entre 3 y 31.
|
|
857
|
+
91 de 394 en total (23%). La razón es que la ficha arma su lista
|
|
858
|
+
desde `attribute_manager` acotado por las cadenas DEL PROPIO
|
|
859
|
+
producto, así que un valor copiado a un atributo que su cadena
|
|
860
|
+
no configura se escribe pero no se ve. Heredar todas las del
|
|
861
|
+
padre es lo que hace visible la copia.
|
|
945
862
|
|
|
946
|
-
|
|
863
|
+
Por eso `buildInherit` manda "all" y esto ya no se pregunta.
|
|
864
|
+
|
|
865
|
+
El orden de lo que queda no es casual: las imágenes van al
|
|
866
|
+
final, son la decisión más visual y la que menos arrastra. */}
|
|
947
867
|
|
|
948
868
|
<Block>
|
|
949
869
|
<h3>
|
|
950
|
-
<span className="paso">
|
|
870
|
+
<span className="paso">1</span> Descripciones
|
|
951
871
|
</h3>
|
|
952
872
|
{offered.descriptions.length ? (
|
|
953
873
|
<>
|
|
@@ -1030,7 +950,7 @@ export const LinkVariantsModal = ({
|
|
|
1030
950
|
|
|
1031
951
|
<Block>
|
|
1032
952
|
<h3>
|
|
1033
|
-
<span className="paso">
|
|
953
|
+
<span className="paso">2</span> Atributos de la ficha técnica
|
|
1034
954
|
</h3>
|
|
1035
955
|
{offered.attributes.length ? (
|
|
1036
956
|
<>
|
|
@@ -1127,7 +1047,7 @@ export const LinkVariantsModal = ({
|
|
|
1127
1047
|
{imagenesUtiles.length > 0 && (
|
|
1128
1048
|
<Block>
|
|
1129
1049
|
<h3>
|
|
1130
|
-
<span className="paso">
|
|
1050
|
+
<span className="paso">3</span> Imágenes
|
|
1131
1051
|
</h3>
|
|
1132
1052
|
<Choices>
|
|
1133
1053
|
<label>
|
|
@@ -184,14 +184,6 @@ export const List = styled.ul`
|
|
|
184
184
|
color: ${GlobalColors.gray};
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
.logo {
|
|
188
|
-
width: 24px;
|
|
189
|
-
height: 24px;
|
|
190
|
-
object-fit: contain;
|
|
191
|
-
border-radius: 3px;
|
|
192
|
-
flex-shrink: 0;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
187
|
li {
|
|
196
188
|
display: flex;
|
|
197
189
|
align-items: center;
|