contentoh-components-library 21.6.32 → 21.6.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/launch.json +15 -0
- package/dist/ai/prompts/attribute.prompt.js +28 -0
- package/dist/ai/prompts/description.prompt.js +33 -0
- package/dist/ai/schemas/attribute.schema.js +35 -0
- package/dist/ai/schemas/description.schema.js +27 -0
- package/dist/components/atoms/InheritanceTag/InheritanceTag.stories.js +5 -5
- package/dist/components/atoms/InheritanceTag/index.js +6 -6
- package/dist/components/organisms/InputGroup/index.js +12 -1
- package/dist/components/organisms/LinkVariantsModal/index.js +269 -356
- package/dist/components/organisms/LinkVariantsModal/styles.js +14 -5
- package/dist/components/organisms/PropagateChangesModal/index.js +12 -13
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +5 -5
- package/dist/components/pages/ProviderProductEdition/context/reducers/inputs.js +5 -2
- package/dist/components/pages/ProviderProductEdition/index.js +96 -36
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +5 -5
- package/dist/components/pages/RetailerProductEdition/context/reducers/inputs.js +5 -2
- package/dist/components/pages/RetailerProductEdition/index.js +100 -38
- package/package.json +1 -1
- package/src/components/atoms/InheritanceTag/InheritanceTag.stories.js +3 -3
- package/src/components/atoms/InheritanceTag/index.js +6 -6
- package/src/components/organisms/InputGroup/index.js +12 -0
- package/src/components/organisms/LinkVariantsModal/index.js +260 -287
- package/src/components/organisms/LinkVariantsModal/styles.js +65 -32
- package/src/components/organisms/PropagateChangesModal/index.js +19 -17
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +4 -4
- package/src/components/pages/ProviderProductEdition/context/reducers/inputs.js +13 -1
- package/src/components/pages/ProviderProductEdition/index.js +61 -20
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +4 -4
- package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +13 -1
- package/src/components/pages/RetailerProductEdition/index.js +74 -23
|
@@ -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.Tabs = exports.Section = exports.SearchRow = exports.Panel = exports.Paging = exports.Overlay = exports.ModeSwitch = exports.Message = exports.List = exports.ImageGrid = exports.Header = exports.Footer = exports.
|
|
8
|
+
exports.Tabs = exports.Section = exports.SearchRow = exports.Panel = exports.Paging = exports.Overlay = exports.ModeSwitch = exports.Message = exports.List = exports.ImageGrid = exports.Header = exports.Footer = exports.Direction = exports.Choices = exports.Body = exports.Block = exports.AttributeList = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
11
11
|
|
|
@@ -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 .logo {\n width: 24px;\n height: 24px;\n object-fit: contain;\n border-radius: 3px;\n flex-shrink: 0;\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 .
|
|
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 .logo {\n width: 24px;\n height: 24px;\n object-fit: contain;\n border-radius: 3px;\n flex-shrink: 0;\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);
|
|
@@ -61,7 +61,7 @@ var Section = _styledComponents.default.div(_templateObject9 || (_templateObject
|
|
|
61
61
|
|
|
62
62
|
exports.Section = Section;
|
|
63
63
|
|
|
64
|
-
var Message = _styledComponents.default.p(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 0 12px;\n padding: 10px 12px;\n border-radius: 6px;\n font-size: 13px;\n line-height: 1.4;\n background-color: ", ";\n color: ", ";\n\n &.error {\n background-color: rgba(", ", 0.1);\n color: ", ";\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.deep_gray, PINK_RGB, PINK);
|
|
64
|
+
var Message = _styledComponents.default.p(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 0 12px;\n padding: 10px 12px;\n border-radius: 6px;\n font-size: 13px;\n line-height: 1.4;\n background-color: ", ";\n color: ", ";\n\n &.error {\n background-color: rgba(", ", 0.1);\n color: ", ";\n }\n\n /* Aviso, no error: el padre ya tiene hijos y planchar les cambia el origen.\n Se puede continuar, as\xED que no usa el rosa de rechazo. */\n &.aviso {\n background-color: rgba(", ", 0.06);\n border-left: 3px solid ", ";\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.deep_gray, PINK_RGB, PINK, PINK_RGB, PINK);
|
|
65
65
|
|
|
66
66
|
exports.Message = Message;
|
|
67
67
|
|
|
@@ -70,12 +70,21 @@ var Footer = _styledComponents.default.div(_templateObject11 || (_templateObject
|
|
|
70
70
|
exports.Footer = Footer;
|
|
71
71
|
|
|
72
72
|
var ImageGrid = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));\n gap: 8px;\n margin-bottom: 16px;\n\n label {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 6px;\n border: 1px solid ", ";\n border-radius: 6px;\n cursor: pointer;\n }\n\n label.picked {\n border-color: ", ";\n background-color: rgba(", ", 0.06);\n }\n\n label.locked {\n cursor: default;\n }\n\n label input {\n position: absolute;\n top: 8px;\n left: 8px;\n }\n\n label img {\n width: 100%;\n height: 72px;\n object-fit: contain;\n background-color: ", ";\n border-radius: 4px;\n }\n\n label span {\n font-size: 11px;\n color: ", ";\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n"])), _variables.GlobalColors.s2, PINK, PINK_RGB, _variables.GlobalColors.s2, _variables.GlobalColors.gray);
|
|
73
|
+
/*
|
|
74
|
+
Padre → hijo, dibujado.
|
|
75
|
+
|
|
76
|
+
El paso de herencia escribe en una dirección sola y hasta ahora no la decía:
|
|
77
|
+
el modo se elige en la pantalla anterior y desaparece de la vista. Con dos
|
|
78
|
+
tarjetas y una flecha se lee de un golpe, sin tener que reconstruirlo del
|
|
79
|
+
texto de cada bloque.
|
|
80
|
+
*/
|
|
81
|
+
|
|
73
82
|
|
|
74
83
|
exports.ImageGrid = ImageGrid;
|
|
75
84
|
|
|
76
|
-
var
|
|
85
|
+
var Direction = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: stretch;\n gap: 10px;\n margin-bottom: 12px;\n\n .lado {\n flex: 1 1 0;\n min-width: 0;\n padding: 10px 12px;\n border: 1px solid ", ";\n border-radius: 6px;\n background-color: ", ";\n }\n\n /* El padre es el que manda en esta pantalla, y se marca como tal. */\n .lado:first-of-type {\n border-color: rgba(", ", 0.45);\n background-color: rgba(", ", 0.05);\n }\n\n .rol {\n display: block;\n font-family: ", ";\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n color: ", ";\n }\n\n strong {\n display: block;\n margin-top: 2px;\n font-family: ", ";\n font-size: 13px;\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n /* Cu\xE1l de los dos es la ficha abierta: sin esto, al relacionar un padre no se\n sabe de qu\xE9 lado est\xE1 uno. */\n .actual {\n display: block;\n margin-top: 2px;\n font-size: 11px;\n font-style: italic;\n color: ", ";\n }\n\n .flecha {\n align-self: center;\n flex-shrink: 0;\n font-size: 20px;\n line-height: 1;\n color: ", ";\n }\n"])), _variables.GlobalColors.s2, _variables.GlobalColors.white, PINK_RGB, PINK_RGB, _variables.FontFamily.Raleway_600, PINK, _variables.FontFamily.Raleway_600, _variables.GlobalColors.deep_gray, _variables.GlobalColors.gray, PINK);
|
|
77
86
|
|
|
78
|
-
exports.
|
|
87
|
+
exports.Direction = Direction;
|
|
79
88
|
|
|
80
89
|
var Block = _styledComponents.default.section(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n margin-bottom: 20px;\n padding-bottom: 16px;\n border-bottom: 1px solid ", ";\n\n &:last-of-type {\n border-bottom: none;\n }\n\n h3 {\n display: flex;\n align-items: center;\n gap: 8px;\n margin: 0 0 8px;\n font-family: ", ";\n font-size: 14px;\n color: ", ";\n }\n\n h3 .paso {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background-color: ", ";\n color: ", ";\n font-size: 11px;\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.Raleway_600, _variables.GlobalColors.deep_gray, PINK, _variables.GlobalColors.white);
|
|
81
90
|
|
|
@@ -21,14 +21,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
21
21
|
Diálogo de propagación al guardar un producto padre.
|
|
22
22
|
|
|
23
23
|
Aparece cuando se guardan cambios de ficha técnica en un producto que tiene
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
como estaban.
|
|
24
|
+
hijos. El backend NO propaga nada por su cuenta: solo baja a los hijos lo que
|
|
25
|
+
venga en `propagation`, y esa lista la arma esta pantalla. Guardar sin abrirla,
|
|
26
|
+
o cerrarla sin propagar, deja al padre modificado y a los hijos como estaban.
|
|
28
27
|
|
|
29
28
|
props (* requerido):
|
|
30
29
|
- *changedAttributes: [{ id, name, value }] lo que se acaba de editar
|
|
31
|
-
- *variants: [{ articleId, name, upc }]
|
|
30
|
+
- *variants: [{ articleId, name, upc }] los hijos activos del padre
|
|
32
31
|
- *onCancel: cerrar sin guardar nada
|
|
33
32
|
- *onConfirm: (propagation | null) => void
|
|
34
33
|
null → guardar solo el padre
|
|
@@ -99,13 +98,13 @@ var PropagateChangesModal = function PropagateChangesModal(_ref) {
|
|
|
99
98
|
},
|
|
100
99
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Header, {
|
|
101
100
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
|
|
102
|
-
children: ["Este producto tiene ", variants.length, "
|
|
101
|
+
children: ["Este producto tiene ", variants.length, " hijo", variants.length === 1 ? "" : "s"]
|
|
103
102
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
104
|
-
children: ["Cambiaste ", changedAttributes.length, " atributo", changedAttributes.length === 1 ? "" : "s", ". Elige cu\xE1les bajan a
|
|
103
|
+
children: ["Cambiaste ", changedAttributes.length, " atributo", changedAttributes.length === 1 ? "" : "s", ". Elige cu\xE1les bajan a los hijos; el resto se guarda solo en este producto."]
|
|
105
104
|
})]
|
|
106
105
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Body, {
|
|
107
106
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
108
|
-
children: "\xBFQu\xE9 se baja a
|
|
107
|
+
children: "\xBFQu\xE9 se baja a los hijos?"
|
|
109
108
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.List, {
|
|
110
109
|
children: changedAttributes.map(function (attribute) {
|
|
111
110
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
@@ -138,9 +137,9 @@ var PropagateChangesModal = function PropagateChangesModal(_ref) {
|
|
|
138
137
|
return setScope("all");
|
|
139
138
|
}
|
|
140
139
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
141
|
-
children: ["A
|
|
140
|
+
children: ["A todos", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
142
141
|
className: "hint",
|
|
143
|
-
children: [variants.length, "
|
|
142
|
+
children: [variants.length, " hijo", variants.length === 1 ? "" : "s", " activo", variants.length === 1 ? "" : "s", "."]
|
|
144
143
|
})]
|
|
145
144
|
})]
|
|
146
145
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
@@ -175,15 +174,15 @@ var PropagateChangesModal = function PropagateChangesModal(_ref) {
|
|
|
175
174
|
}, variant.articleId);
|
|
176
175
|
})
|
|
177
176
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Note, {
|
|
178
|
-
children: "
|
|
177
|
+
children: "Un hijo que haya editado alguno de estos atributos por su cuenta conserva su valor. Para devolverlo al del padre est\xE1 la acci\xF3n \xABVolver a heredar\xBB en la ficha de ese hijo."
|
|
179
178
|
}), enSegundoPlano && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Note, {
|
|
180
179
|
className: "accent",
|
|
181
|
-
children: ["Son m\xE1s de ", UMBRAL_SEGUNDO_PLANO, "
|
|
180
|
+
children: ["Son m\xE1s de ", UMBRAL_SEGUNDO_PLANO, " hijos, as\xED que la propagaci\xF3n corre en segundo plano: el guardado termina antes de que todas est\xE9n actualizadas."]
|
|
182
181
|
})]
|
|
183
182
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Footer, {
|
|
184
183
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
185
184
|
className: "resumen",
|
|
186
|
-
children: puedePropagar ? "".concat(chosenAttributes.length, " atributo(s) a ").concat(destinatarios, "
|
|
185
|
+
children: puedePropagar ? "".concat(chosenAttributes.length, " atributo(s) a ").concat(destinatarios, " hijo(s).") : "No se bajará nada a los hijos."
|
|
187
186
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
188
187
|
type: "button",
|
|
189
188
|
className: "secondary",
|
package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js
CHANGED
|
@@ -188,7 +188,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
188
188
|
`propagation` es opcional y solo lo manda la ficha de un producto padre, con
|
|
189
189
|
lo que el usuario eligió en el diálogo: { attributes: [...], targetChildren }.
|
|
190
190
|
Sin ese bloque el backend no propaga nada. Es deliberado: bajar un cambio a
|
|
191
|
-
|
|
191
|
+
los hijos tiene que ser una decisión, no un efecto secundario de guardar.
|
|
192
192
|
*/
|
|
193
193
|
|
|
194
194
|
|
|
@@ -196,7 +196,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
196
196
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(token, propagation) {
|
|
197
197
|
var _state$product4, _state$product5;
|
|
198
198
|
|
|
199
|
-
var dataObject, _state$product6, res, _state$services$datas, _state$services, _state$services$datas2, _state$services$datas3, _state$product7,
|
|
199
|
+
var dataObject, _state$product6, res, _state$services$datas, _state$services, _state$services$datas2, _state$services$datas3, _state$product7, esHijo;
|
|
200
200
|
|
|
201
201
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
202
202
|
while (1) {
|
|
@@ -247,15 +247,15 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
247
247
|
dispatch({
|
|
248
248
|
type: "SET_UPDATED_DATASHEETS_INPUTS",
|
|
249
249
|
payload: []
|
|
250
|
-
}); // En
|
|
250
|
+
}); // En un hijo, todo atributo que se toca deja de ser heredado:
|
|
251
251
|
// update-articles-data le pone is_overridden = 1 en la base. Si aquí solo
|
|
252
252
|
// se refresca el valor, el chip sigue diciendo "Heredado" hasta la
|
|
253
253
|
// siguiente carga de la ficha, y el usuario ve una marca que ya es falsa.
|
|
254
254
|
|
|
255
|
-
|
|
255
|
+
esHijo = (_state$services$datas = (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas2 = _state$services.datasheets) === null || _state$services$datas2 === void 0 ? void 0 : (_state$services$datas3 = _state$services$datas2.variant) === null || _state$services$datas3 === void 0 ? void 0 : _state$services$datas3.isVariant) !== null && _state$services$datas !== void 0 ? _state$services$datas : !!((_state$product7 = state.product) !== null && _state$product7 !== void 0 && _state$product7.parentArticleId);
|
|
256
256
|
dispatch({
|
|
257
257
|
type: "UPDATE_DATASHEETS_INPUTS",
|
|
258
|
-
payload:
|
|
258
|
+
payload: esHijo ? state.updated_datasheets_inputs.map(function (item) {
|
|
259
259
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
260
260
|
isOverridden: 1
|
|
261
261
|
});
|
|
@@ -67,9 +67,12 @@ var inputsReducer = function inputsReducer(state, action) {
|
|
|
67
67
|
var updatedInput = action.payload.find(function (updated) {
|
|
68
68
|
return updated.attributeId === input.id;
|
|
69
69
|
});
|
|
70
|
-
|
|
70
|
+
if (!updatedInput) return input;
|
|
71
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input), {}, {
|
|
71
72
|
value: updatedInput.value
|
|
72
|
-
}
|
|
73
|
+
}, updatedInput.isOverridden === undefined ? {} : {
|
|
74
|
+
isOverridden: updatedInput.isOverridden
|
|
75
|
+
});
|
|
73
76
|
}); // Tambien actualizarlo dentro de services.descriptions
|
|
74
77
|
// buscar el index del retailer activo en services
|
|
75
78
|
|
|
@@ -90,7 +90,7 @@ var _AiProductEdition = require("../../../contexts/AiProductEdition");
|
|
|
90
90
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
91
91
|
|
|
92
92
|
var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
93
|
-
var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _family$variants2, _state$product15, _state$product16, _state$product17, _state$active_retaile4, _location$state5, _location$state6, _state$active_retaile5, _state$active_retaile6, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile7, _state$product18, _state$product19, _state$product20, _state$product21, _family$variants3, _family$variants4, _family$variants5, _state$active_percent, _state$active_percent2, _state$active_retaile8, _state$active_retaile9, _state$active_retaile10, _state$product22, _state$descriptions_i, _state$product23, _state$product24, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product25, _state$images_values12;
|
|
93
|
+
var _location$state4, _state$product2, _state$product3, _state$product4, _state$product5, _state$product6, _state$product7, _family$variants2, _state$product15, _state$product16, _state$product17, _state$active_retaile4, _location$state5, _location$state6, _state$active_retaile5, _state$active_retaile6, _state$images_values$2, _state$images_values10, _state$images_values11, _state$active_retaile7, _state$product18, _state$product19, _state$product20, _state$product21, _family$variants3, _family$variants4, _family$variants5, _state$active_percent, _state$active_percent2, _state$active_retaile8, _state$active_retaile9, _state$active_retaile10, _state$product22, _state$descriptions_i, _state$services2, _state$services2$data, _state$product23, _state$product24, _state$datasheets_inp, _state$datasheets_inp2, _state$datasheets_inp3, _state$product25, _state$images_values12;
|
|
94
94
|
|
|
95
95
|
var tabsSections = _ref.tabsSections,
|
|
96
96
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -315,7 +315,20 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
315
315
|
};
|
|
316
316
|
|
|
317
317
|
setProductData();
|
|
318
|
-
}, []);
|
|
318
|
+
}, []);
|
|
319
|
+
/*
|
|
320
|
+
Contador que fuerza a releer los servicios tras ligar.
|
|
321
|
+
El efecto de abajo depende de estatus, versión y cadena activa, y ligar no
|
|
322
|
+
cambia ninguno: cambia la HERENCIA de cada campo en el servidor. Al planchar,
|
|
323
|
+
lo que era propio pasa a heredado, y sin releer los chips siguen diciendo lo
|
|
324
|
+
de antes hasta que alguien cierra y reabre el producto.
|
|
325
|
+
*/
|
|
326
|
+
|
|
327
|
+
var _useState31 = (0, _react.useState)(0),
|
|
328
|
+
_useState32 = (0, _slicedToArray2.default)(_useState31, 2),
|
|
329
|
+
linkNonce = _useState32[0],
|
|
330
|
+
setLinkNonce = _useState32[1]; // Setter de los servicios y porcentages del producto
|
|
331
|
+
|
|
319
332
|
|
|
320
333
|
(0, _react.useEffect)(function () {
|
|
321
334
|
if (!state.product || !state.active_retailer) return;
|
|
@@ -481,7 +494,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
481
494
|
}();
|
|
482
495
|
|
|
483
496
|
fetchData();
|
|
484
|
-
}, [(_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.datasheet_status, (_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.description_status, (_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.images_status, (_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.status, (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.percentages, (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.version, state.active_retailer, token]); // Actualizador de campos del ui para que coincidan con el retailer activo
|
|
497
|
+
}, [(_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.datasheet_status, (_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.description_status, (_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.images_status, (_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.status, (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.percentages, (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.version, state.active_retailer, token, linkNonce]); // Actualizador de campos del ui para que coincidan con el retailer activo
|
|
485
498
|
|
|
486
499
|
(0, _react.useEffect)(function () {
|
|
487
500
|
if (!state.active_retailer) return;
|
|
@@ -846,15 +859,15 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
846
859
|
{
|
|
847
860
|
var _state$product10;
|
|
848
861
|
|
|
849
|
-
// Guardar un padre con
|
|
850
|
-
// paso el cambio se queda solo en el padre y
|
|
862
|
+
// Guardar un padre con hijos abre la decisión de propagar. Sin este
|
|
863
|
+
// paso el cambio se queda solo en el padre y los hijos se van
|
|
851
864
|
// separando de él sin que nadie lo note.
|
|
852
865
|
var esPadre = ((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.variantsCount) > 0;
|
|
853
866
|
var cambios = cambiosDeFichaTecnica();
|
|
854
867
|
|
|
855
868
|
if (esPadre && cambios.length > 0) {
|
|
856
869
|
// Se espera a tener la familia antes de abrir: si no, el diálogo
|
|
857
|
-
// aparece diciendo "0
|
|
870
|
+
// aparece diciendo "0 hijos" hasta que llega la respuesta, que es
|
|
858
871
|
// justo lo contrario de lo que va a preguntar.
|
|
859
872
|
setPreparandoPropagacion(true);
|
|
860
873
|
loadFamily().then(function () {
|
|
@@ -905,7 +918,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
905
918
|
});
|
|
906
919
|
};
|
|
907
920
|
/*
|
|
908
|
-
Trae la familia del producto: sus
|
|
921
|
+
Trae la familia del producto: sus hijos, o sus hermanos si el abierto es
|
|
909
922
|
una de ellas.
|
|
910
923
|
Se pide al abrir la sección y no al montar la pantalla: la mayoría de los
|
|
911
924
|
productos no son familia, y una llamada por ficha para no mostrar nada es
|
|
@@ -968,7 +981,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
968
981
|
};
|
|
969
982
|
}();
|
|
970
983
|
/*
|
|
971
|
-
Abre
|
|
984
|
+
Abre otro producto de la familia.
|
|
972
985
|
Esta pantalla no lee el producto de la URL: lo lee de sessionStorage, donde
|
|
973
986
|
lo dejó el listado al hacer clic. Así que navegar a /products/:id sin más
|
|
974
987
|
cambia la barra de direcciones y deja el producto anterior en pantalla.
|
|
@@ -981,7 +994,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
981
994
|
*/
|
|
982
995
|
|
|
983
996
|
/*
|
|
984
|
-
Abre la edición múltiple con
|
|
997
|
+
Abre la edición múltiple con los hijos de la familia ya cargados.
|
|
985
998
|
Esa pantalla lee `multipleEditionList` de sessionStorage —así la deja el
|
|
986
999
|
listado al pulsar "editar varios"— y necesita el PRODUCTO COMPLETO de cada
|
|
987
1000
|
uno, no solo su id: pinta el UPC, el nombre, parte `categoryName` por "|",
|
|
@@ -1066,7 +1079,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1066
1079
|
payload: {
|
|
1067
1080
|
show: true,
|
|
1068
1081
|
title: "",
|
|
1069
|
-
message: "No se pudieron cargar
|
|
1082
|
+
message: "No se pudieron cargar los hijos para editarlos juntos.",
|
|
1070
1083
|
image: _errorModal.default
|
|
1071
1084
|
}
|
|
1072
1085
|
});
|
|
@@ -1167,7 +1180,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1167
1180
|
contador seguía mostrando el número viejo. Además una recarga se lleva lo que
|
|
1168
1181
|
el usuario tenga sin guardar.
|
|
1169
1182
|
Los dos modos tienen efectos opuestos sobre este producto: ligando hijos GANA
|
|
1170
|
-
|
|
1183
|
+
hijos; ligándose a un padre pasa a SER uno, y entonces el botón de ligar
|
|
1171
1184
|
desaparece porque la jerarquía es de un solo nivel.
|
|
1172
1185
|
*/
|
|
1173
1186
|
|
|
@@ -1187,7 +1200,11 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1187
1200
|
payload: updatedProduct
|
|
1188
1201
|
}); // La lista cacheada quedó vieja: se descarta para que vuelva a pedirse.
|
|
1189
1202
|
|
|
1190
|
-
setFamily(null); // Y
|
|
1203
|
+
setFamily(null); // Y los servicios, para que los chips reflejen la herencia recién creada.
|
|
1204
|
+
|
|
1205
|
+
setLinkNonce(function (n) {
|
|
1206
|
+
return n + 1;
|
|
1207
|
+
}); // Y en sessionStorage, que es de donde sale el producto al recargar. Sin
|
|
1191
1208
|
// esto el arreglo dura hasta el siguiente F5 y vuelve el contador viejo,
|
|
1192
1209
|
// que es justo el síntoma que se reportó.
|
|
1193
1210
|
|
|
@@ -1208,7 +1225,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1208
1225
|
};
|
|
1209
1226
|
/*
|
|
1210
1227
|
Acción "Volver a heredar del producto" de los chips de herencia.
|
|
1211
|
-
La inicia
|
|
1228
|
+
La inicia el hijo, no el padre, y descarta un valor capturado a mano: por
|
|
1212
1229
|
eso el endpoint exige la lista explícita de atributos y no acepta un "todos"
|
|
1213
1230
|
implícito.
|
|
1214
1231
|
El repintado es en sitio, con lo que devuelve el propio endpoint. La
|
|
@@ -1216,40 +1233,76 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1216
1233
|
tenga sin guardar en las otras pestañas.
|
|
1217
1234
|
*/
|
|
1218
1235
|
|
|
1236
|
+
/*
|
|
1237
|
+
`kind` distingue de qué pestaña salió el chip. Las descripciones viven en
|
|
1238
|
+
`rel_article_description` y la ficha técnica en `article_data`: el endpoint
|
|
1239
|
+
recibe una lista o la otra, y lo que devuelve se repinta en su propio
|
|
1240
|
+
reducer.
|
|
1241
|
+
*/
|
|
1242
|
+
|
|
1219
1243
|
|
|
1220
1244
|
var handleOnRestoreInheritance = /*#__PURE__*/function () {
|
|
1221
1245
|
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(attributeId) {
|
|
1222
1246
|
var _state$product13;
|
|
1223
1247
|
|
|
1224
|
-
var
|
|
1248
|
+
var kind,
|
|
1249
|
+
esDescripcion,
|
|
1250
|
+
res,
|
|
1251
|
+
data,
|
|
1252
|
+
_args6 = arguments;
|
|
1225
1253
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
1226
1254
|
while (1) {
|
|
1227
1255
|
switch (_context6.prev = _context6.next) {
|
|
1228
1256
|
case 0:
|
|
1257
|
+
kind = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : "attribute";
|
|
1258
|
+
|
|
1229
1259
|
if (!(!attributeId || !((_state$product13 = state.product) !== null && _state$product13 !== void 0 && _state$product13.id_article))) {
|
|
1230
|
-
_context6.next =
|
|
1260
|
+
_context6.next = 3;
|
|
1231
1261
|
break;
|
|
1232
1262
|
}
|
|
1233
1263
|
|
|
1234
1264
|
return _context6.abrupt("return");
|
|
1235
1265
|
|
|
1236
|
-
case
|
|
1237
|
-
|
|
1238
|
-
_context6.
|
|
1239
|
-
|
|
1240
|
-
|
|
1266
|
+
case 3:
|
|
1267
|
+
esDescripcion = kind === "description";
|
|
1268
|
+
_context6.prev = 4;
|
|
1269
|
+
_context6.next = 7;
|
|
1270
|
+
return _axios.default.post("".concat(process.env.REACT_APP_VARIANTS_ENDPOINT, "/restore"), (0, _objectSpread4.default)({
|
|
1271
|
+
articleId: state.product.id_article
|
|
1272
|
+
}, esDescripcion ? {
|
|
1273
|
+
descriptions: [Number(attributeId)]
|
|
1274
|
+
} : {
|
|
1241
1275
|
attributes: [Number(attributeId)]
|
|
1242
|
-
}, {
|
|
1276
|
+
}), {
|
|
1243
1277
|
headers: {
|
|
1244
1278
|
Authorization: token
|
|
1245
1279
|
}
|
|
1246
1280
|
});
|
|
1247
1281
|
|
|
1248
|
-
case
|
|
1282
|
+
case 7:
|
|
1249
1283
|
res = _context6.sent;
|
|
1250
1284
|
// El API responde 200 aunque la lambda haya devuelto 400: el resultado
|
|
1251
1285
|
// real viaja en el cuerpo y readPayload lo convierte en excepción.
|
|
1252
1286
|
data = (0, _api.readPayload)(res);
|
|
1287
|
+
|
|
1288
|
+
if (!esDescripcion) {
|
|
1289
|
+
_context6.next = 12;
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
dispatch({
|
|
1294
|
+
type: "UPDATE_DESCRIPTIONS_INPUTS",
|
|
1295
|
+
payload: (data.descriptionValues || []).map(function (item) {
|
|
1296
|
+
return {
|
|
1297
|
+
attributeId: item.id_description,
|
|
1298
|
+
value: item.value,
|
|
1299
|
+
isOverridden: 0
|
|
1300
|
+
};
|
|
1301
|
+
})
|
|
1302
|
+
});
|
|
1303
|
+
return _context6.abrupt("return");
|
|
1304
|
+
|
|
1305
|
+
case 12:
|
|
1253
1306
|
dispatch({
|
|
1254
1307
|
type: "UPDATE_DATASHEETS_INPUTS",
|
|
1255
1308
|
payload: (data.values || []).map(function (item) {
|
|
@@ -1260,20 +1313,20 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1260
1313
|
};
|
|
1261
1314
|
})
|
|
1262
1315
|
});
|
|
1263
|
-
_context6.next =
|
|
1316
|
+
_context6.next = 18;
|
|
1264
1317
|
break;
|
|
1265
1318
|
|
|
1266
|
-
case
|
|
1267
|
-
_context6.prev =
|
|
1268
|
-
_context6.t0 = _context6["catch"](
|
|
1319
|
+
case 15:
|
|
1320
|
+
_context6.prev = 15;
|
|
1321
|
+
_context6.t0 = _context6["catch"](4);
|
|
1269
1322
|
console.error("restoreInheritance: ", _context6.t0);
|
|
1270
1323
|
|
|
1271
|
-
case
|
|
1324
|
+
case 18:
|
|
1272
1325
|
case "end":
|
|
1273
1326
|
return _context6.stop();
|
|
1274
1327
|
}
|
|
1275
1328
|
}
|
|
1276
|
-
}, _callee6, null, [[
|
|
1329
|
+
}, _callee6, null, [[4, 15]]);
|
|
1277
1330
|
}));
|
|
1278
1331
|
|
|
1279
1332
|
return function handleOnRestoreInheritance(_x3) {
|
|
@@ -2009,7 +2062,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2009
2062
|
});
|
|
2010
2063
|
loadFamily();
|
|
2011
2064
|
},
|
|
2012
|
-
children: [state.product.variantsCount, "
|
|
2065
|
+
children: [state.product.variantsCount, " hijo", state.product.variantsCount === 1 ? "" : "s", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2013
2066
|
"aria-hidden": "true",
|
|
2014
2067
|
children: showFamily ? " ▴" : " ▾"
|
|
2015
2068
|
})]
|
|
@@ -2026,7 +2079,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2026
2079
|
});
|
|
2027
2080
|
loadFamily();
|
|
2028
2081
|
},
|
|
2029
|
-
children: ["
|
|
2082
|
+
children: ["Hijo de otro producto", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2030
2083
|
"aria-hidden": "true",
|
|
2031
2084
|
children: showFamily ? " ▴" : " ▾"
|
|
2032
2085
|
})]
|
|
@@ -2066,7 +2119,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2066
2119
|
},
|
|
2067
2120
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2068
2121
|
className: "role",
|
|
2069
|
-
children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "
|
|
2122
|
+
children: loadingVariant === variant.articleId ? "Abriendo…" : variant.isCurrent ? "Estás aquí" : "Hijo"
|
|
2070
2123
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
2071
2124
|
className: "name",
|
|
2072
2125
|
children: variant.name
|
|
@@ -2077,13 +2130,13 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2077
2130
|
}, variant.articleId);
|
|
2078
2131
|
}), family && !family.error && !((_family$variants4 = family.variants) !== null && _family$variants4 !== void 0 && _family$variants4.length) && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
2079
2132
|
className: "loading",
|
|
2080
|
-
children: "Este producto no tiene
|
|
2133
|
+
children: "Este producto no tiene hijos."
|
|
2081
2134
|
}), (family === null || family === void 0 ? void 0 : (_family$variants5 = family.variants) === null || _family$variants5 === void 0 ? void 0 : _family$variants5.length) > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
2082
2135
|
type: "button",
|
|
2083
2136
|
className: "editar-juntas",
|
|
2084
2137
|
disabled: preparandoEdicionMultiple,
|
|
2085
2138
|
onClick: openMultipleEdition,
|
|
2086
|
-
children: preparandoEdicionMultiple ? "Abriendo…" : "Editar
|
|
2139
|
+
children: preparandoEdicionMultiple ? "Abriendo…" : "Editar los ".concat(family.variants.length, " hijos juntos")
|
|
2087
2140
|
})]
|
|
2088
2141
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
2089
2142
|
headerData: state.product,
|
|
@@ -2138,7 +2191,14 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2138
2191
|
children: [state.active_tab === "Descripción" && (((_state$product22 = state.product) === null || _state$product22 === void 0 ? void 0 : _state$product22.description_status) !== "NS" ? (_state$descriptions_i = state.descriptions_inputs) !== null && _state$descriptions_i !== void 0 && _state$descriptions_i[0] ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
2139
2192
|
activeSection: state.active_tab,
|
|
2140
2193
|
inputGroup: state.descriptions_inputs[0],
|
|
2141
|
-
updatedDescriptions: state.updated_descriptions_inputs
|
|
2194
|
+
updatedDescriptions: state.updated_descriptions_inputs
|
|
2195
|
+
/* El parentesco es del producto, no del servicio:
|
|
2196
|
+
los dos endpoints lo devuelven igual. Se toma de
|
|
2197
|
+
la ficha técnica para no depender de que la
|
|
2198
|
+
llamada de descripciones traiga el bloque. */
|
|
2199
|
+
,
|
|
2200
|
+
variant: (_state$services2 = state.services) === null || _state$services2 === void 0 ? void 0 : (_state$services2$data = _state$services2.datasheets) === null || _state$services2$data === void 0 ? void 0 : _state$services2$data.variant,
|
|
2201
|
+
onRestoreInheritance: handleOnRestoreInheritance,
|
|
2142
2202
|
articleId: (_state$product23 = state.product) === null || _state$product23 === void 0 ? void 0 : _state$product23.id_article,
|
|
2143
2203
|
version: state.product.version,
|
|
2144
2204
|
isShowbox: false,
|
|
@@ -2153,7 +2213,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2153
2213
|
headerType: "input-name-header"
|
|
2154
2214
|
})), state.active_tab === "Ficha técnica" && (((_state$product24 = state.product) === null || _state$product24 === void 0 ? void 0 : _state$product24.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
2155
2215
|
children: ((_state$datasheets_inp = state.datasheets_inputs) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp[0]) === null || _state$datasheets_inp2 === void 0 ? void 0 : (_state$datasheets_inp3 = _state$datasheets_inp2.data) === null || _state$datasheets_inp3 === void 0 ? void 0 : _state$datasheets_inp3.length) > 0 ? state.datasheets_inputs[0].data.map(function (dataGroup, index) {
|
|
2156
|
-
var _state$datasheets_inp4, _state$
|
|
2216
|
+
var _state$datasheets_inp4, _state$services3, _state$services3$data, _state$services$datas3;
|
|
2157
2217
|
|
|
2158
2218
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
2159
2219
|
index: index,
|
|
@@ -2162,7 +2222,7 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
2162
2222
|
activeSection: state.active_tab,
|
|
2163
2223
|
inputGroup: dataGroup,
|
|
2164
2224
|
dataInputs: (_state$datasheets_inp4 = state.datasheets_inputs[1]) !== null && _state$datasheets_inp4 !== void 0 ? _state$datasheets_inp4 : [],
|
|
2165
|
-
variant: (_state$
|
|
2225
|
+
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,
|
|
2166
2226
|
onRestoreInheritance: handleOnRestoreInheritance,
|
|
2167
2227
|
activeRetailer: state.services.datasheets[state.active_retailer.id_retailer],
|
|
2168
2228
|
groupData: (_state$services$datas3 = state.services.datasheets[state.active_retailer.id_retailer]) === null || _state$services$datas3 === void 0 ? void 0 : _state$services$datas3.data,
|
package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js
CHANGED
|
@@ -193,7 +193,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
193
193
|
/*
|
|
194
194
|
`propagation` es opcional y solo lo manda la ficha de un producto padre, con
|
|
195
195
|
lo que el usuario eligió en el diálogo. Sin ese bloque el backend no propaga
|
|
196
|
-
nada: bajar un cambio a
|
|
196
|
+
nada: bajar un cambio a los hijos es una decisión, no un efecto
|
|
197
197
|
secundario de guardar.
|
|
198
198
|
*/
|
|
199
199
|
|
|
@@ -202,7 +202,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
202
202
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(token, propagation) {
|
|
203
203
|
var _state$product4, _state$product5;
|
|
204
204
|
|
|
205
|
-
var dataObject, _state$product6, res, _state$services$datas, _state$services, _state$services$datas2, _state$services$datas3, _state$product7, _state$active_retaile,
|
|
205
|
+
var dataObject, _state$product6, res, _state$services$datas, _state$services, _state$services$datas2, _state$services$datas3, _state$product7, _state$active_retaile, esHijo, datasheetInputs, retailerId, filledRequiredCount;
|
|
206
206
|
|
|
207
207
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
208
208
|
while (1) {
|
|
@@ -251,15 +251,15 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
251
251
|
dispatch({
|
|
252
252
|
type: "SET_UPDATED_DATASHEETS_INPUTS",
|
|
253
253
|
payload: []
|
|
254
|
-
}); // En
|
|
254
|
+
}); // En un hijo, todo atributo que se toca deja de ser heredado:
|
|
255
255
|
// update-articles-data le pone is_overridden = 1 en la base. Sin
|
|
256
256
|
// reflejarlo aquí, el chip sigue diciendo "Heredado" hasta la siguiente
|
|
257
257
|
// carga de la ficha, y el usuario ve una marca que ya es falsa.
|
|
258
258
|
|
|
259
|
-
|
|
259
|
+
esHijo = (_state$services$datas = (_state$services = state.services) === null || _state$services === void 0 ? void 0 : (_state$services$datas2 = _state$services.datasheets) === null || _state$services$datas2 === void 0 ? void 0 : (_state$services$datas3 = _state$services$datas2.variant) === null || _state$services$datas3 === void 0 ? void 0 : _state$services$datas3.isVariant) !== null && _state$services$datas !== void 0 ? _state$services$datas : !!((_state$product7 = state.product) !== null && _state$product7 !== void 0 && _state$product7.parentArticleId);
|
|
260
260
|
dispatch({
|
|
261
261
|
type: "UPDATE_DATASHEETS_INPUTS",
|
|
262
|
-
payload:
|
|
262
|
+
payload: esHijo ? state.updated_datasheets_inputs.map(function (item) {
|
|
263
263
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
264
264
|
isOverridden: 1
|
|
265
265
|
});
|
|
@@ -76,9 +76,12 @@ var inputsReducer = function inputsReducer(state, action) {
|
|
|
76
76
|
var updatedInput = action.payload.find(function (updated) {
|
|
77
77
|
return updated.attributeId === input.id;
|
|
78
78
|
});
|
|
79
|
-
|
|
79
|
+
if (!updatedInput) return input;
|
|
80
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, input), {}, {
|
|
80
81
|
value: updatedInput.value
|
|
81
|
-
}
|
|
82
|
+
}, updatedInput.isOverridden === undefined ? {} : {
|
|
83
|
+
isOverridden: updatedInput.isOverridden
|
|
84
|
+
});
|
|
82
85
|
}); // Tambien actualizarlo dentro de services.descriptions
|
|
83
86
|
// buscar el index del retailer activo en services
|
|
84
87
|
|