contentoh-components-library 21.6.51 → 21.6.53
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/PropagateChangesModal/index.js +6 -1
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +10 -8
- package/dist/components/pages/ProviderProductEdition/index.js +154 -62
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +11 -9
- package/dist/components/pages/RetailerProductEdition/index.js +160 -54
- package/package.json +1 -1
- package/src/components/organisms/PropagateChangesModal/index.js +10 -3
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +2 -1
- package/src/components/pages/ProviderProductEdition/index.js +75 -3
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +2 -1
- package/src/components/pages/RetailerProductEdition/index.js +79 -3
package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js
CHANGED
|
@@ -67,7 +67,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
67
67
|
dispatch = _useReducer2[1];
|
|
68
68
|
|
|
69
69
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
70
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(token) {
|
|
70
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(token, propagation) {
|
|
71
71
|
var _state$product, _state$product2;
|
|
72
72
|
|
|
73
73
|
var dataObject, _state$product3, res, inputs, filledRequiredCount;
|
|
@@ -88,10 +88,12 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
88
88
|
type: "SET_SAVING",
|
|
89
89
|
payload: true
|
|
90
90
|
});
|
|
91
|
-
dataObject = {
|
|
91
|
+
dataObject = (0, _objectSpread2.default)({
|
|
92
92
|
articleId: (_state$product = state.product) === null || _state$product === void 0 ? void 0 : _state$product.id_article,
|
|
93
93
|
articleData: state.updated_descriptions_inputs
|
|
94
|
-
}
|
|
94
|
+
}, propagation ? {
|
|
95
|
+
propagation: propagation
|
|
96
|
+
} : {}); // console.log({dataObject});
|
|
95
97
|
|
|
96
98
|
if ((_state$product2 = state.product) !== null && _state$product2 !== void 0 && _state$product2.id_order) {
|
|
97
99
|
dataObject.orderId = (_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.id_order;
|
|
@@ -186,7 +188,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
186
188
|
}, _callee, null, [[5, 12, 16, 19]]);
|
|
187
189
|
}));
|
|
188
190
|
|
|
189
|
-
return function saveDescriptions(_x) {
|
|
191
|
+
return function saveDescriptions(_x, _x2) {
|
|
190
192
|
return _ref2.apply(this, arguments);
|
|
191
193
|
};
|
|
192
194
|
}();
|
|
@@ -323,7 +325,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
323
325
|
}, _callee2, null, [[5, 12, 16, 19]]);
|
|
324
326
|
}));
|
|
325
327
|
|
|
326
|
-
return function saveDatasheets(
|
|
328
|
+
return function saveDatasheets(_x3, _x4) {
|
|
327
329
|
return _ref3.apply(this, arguments);
|
|
328
330
|
};
|
|
329
331
|
}();
|
|
@@ -526,7 +528,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
526
528
|
}, _callee3, null, [[16, 28, 33, 36]]);
|
|
527
529
|
}));
|
|
528
530
|
|
|
529
|
-
return function updateImages(
|
|
531
|
+
return function updateImages(_x5) {
|
|
530
532
|
return _ref4.apply(this, arguments);
|
|
531
533
|
};
|
|
532
534
|
}();
|
|
@@ -641,7 +643,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
641
643
|
}, _callee4, null, [[7, 14, 19, 22]]);
|
|
642
644
|
}));
|
|
643
645
|
|
|
644
|
-
return function saveImageAttrs(
|
|
646
|
+
return function saveImageAttrs(_x6) {
|
|
645
647
|
return _ref7.apply(this, arguments);
|
|
646
648
|
};
|
|
647
649
|
}();
|
|
@@ -757,7 +759,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
757
759
|
}, _callee5, null, [[4, 10, 15, 18]]);
|
|
758
760
|
}));
|
|
759
761
|
|
|
760
|
-
return function deleteImages(
|
|
762
|
+
return function deleteImages(_x7) {
|
|
761
763
|
return _ref8.apply(this, arguments);
|
|
762
764
|
};
|
|
763
765
|
}();
|
|
@@ -804,7 +806,7 @@ var ProviderProductEditionProvider = function ProviderProductEditionProvider(_re
|
|
|
804
806
|
}, _callee6, null, [[2, 7]]);
|
|
805
807
|
}));
|
|
806
808
|
|
|
807
|
-
return function createComment(
|
|
809
|
+
return function createComment(_x8, _x9) {
|
|
808
810
|
return _ref9.apply(this, arguments);
|
|
809
811
|
};
|
|
810
812
|
}();
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.RetailerProductEdition = void 0;
|
|
9
9
|
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
11
|
+
|
|
10
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
13
|
|
|
12
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
@@ -111,6 +113,7 @@ var _material = require("@mui/material");
|
|
|
111
113
|
|
|
112
114
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
113
115
|
|
|
116
|
+
var _excluded = ["attributes"];
|
|
114
117
|
var allowedAccountsToViewChangeStatus = ["mperez@contentoh.com", "gmorales@contentoh.com", "rvega@contentoh.com", "amora@contentoh.com", "maltamirano@contentoh.com", //PRODUCT DEV ACCOUNTS
|
|
115
118
|
"oparra@contentoh.com", "zsegura@contentoh.com", "oserna@contentoh.com", "jalvarado@contentoh.com", //DEV ACCOUNTS
|
|
116
119
|
"kikije1467@mtlcz.com", //IMÁGENES
|
|
@@ -240,7 +243,7 @@ function _regenerateVideoThumbnails() {
|
|
|
240
243
|
}
|
|
241
244
|
|
|
242
245
|
var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
243
|
-
var _state$product10, _family$variants, _state$product11, _state$product15, _state$errors, _family$variants2, _variantGroup$
|
|
246
|
+
var _state$product10, _family$variants, _state$product11, _state$product15, _state$errors, _pendingPropagation$k, _family$variants2, _variantGroup$members3, _variantGroup$group, _state$product19, _state$product20, _state$product21, _state$active_retaile7, _state$product22, _state$product23, _state$product24, _variantGroup$group2, _location$state, _location$state2, _state$active_retaile8, _state$active_retaile9, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product25, _state$active_retaile10, _family$variants3, _family$variants4, _variantGroup$members4, _variantGroup$members5, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile11, _state$active_retaile12, _state$active_retaile13, _state$product31, _state$services3, _state$services3$data, _state$product32, _state$product33, _state$datasheets_inp, _state$datasheets_inp2, _state$product34, _state$images_values12, _state$comment;
|
|
244
247
|
|
|
245
248
|
var tabsSections = _ref.tabsSections,
|
|
246
249
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -1830,10 +1833,34 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1830
1833
|
|
|
1831
1834
|
return (0, _nonPropagable.soloPropagables)(cambios);
|
|
1832
1835
|
};
|
|
1836
|
+
/*
|
|
1837
|
+
Lo que se acaba de editar en la pestaña de descripciones.
|
|
1838
|
+
Va aparte de `cambiosDeFichaTecnica` porque son tablas distintas y el
|
|
1839
|
+
endpoint recibe una lista o la otra. Aquí NO se filtran UPC ni SKU: esos son
|
|
1840
|
+
atributos de ficha técnica y no aparecen en esta pestaña.
|
|
1841
|
+
*/
|
|
1842
|
+
|
|
1843
|
+
|
|
1844
|
+
var cambiosDeDescripciones = function cambiosDeDescripciones() {
|
|
1845
|
+
var _state$active_retaile5, _state$services$descr, _state$services2, _state$services2$desc, _state$updated_descri;
|
|
1846
|
+
|
|
1847
|
+
var retailerId = (_state$active_retaile5 = state.active_retailer) === null || _state$active_retaile5 === void 0 ? void 0 : _state$active_retaile5.id_retailer;
|
|
1848
|
+
var inputs = (_state$services$descr = (_state$services2 = state.services) === null || _state$services2 === void 0 ? void 0 : (_state$services2$desc = _state$services2.descriptions) === null || _state$services2$desc === void 0 ? void 0 : _state$services2$desc.inputs) !== null && _state$services$descr !== void 0 ? _state$services$descr : {};
|
|
1849
|
+
return ((_state$updated_descri = state.updated_descriptions_inputs) !== null && _state$updated_descri !== void 0 ? _state$updated_descri : []).map(function (item) {
|
|
1850
|
+
var _input$name2;
|
|
1851
|
+
|
|
1852
|
+
var input = inputs["".concat(item.attributeId, "_").concat(retailerId)];
|
|
1853
|
+
return {
|
|
1854
|
+
id: Number(item.attributeId),
|
|
1855
|
+
name: (_input$name2 = input === null || input === void 0 ? void 0 : input.name) !== null && _input$name2 !== void 0 ? _input$name2 : "Descripci\xF3n ".concat(item.attributeId),
|
|
1856
|
+
value: item.value
|
|
1857
|
+
};
|
|
1858
|
+
});
|
|
1859
|
+
};
|
|
1833
1860
|
|
|
1834
1861
|
var handleOnClickSave = /*#__PURE__*/function () {
|
|
1835
1862
|
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1836
|
-
var _familia, _familia$variants, _variantGroup$
|
|
1863
|
+
var _variantGroup$members, _familiaDesc$variants, _familiaDesc, cambiosDesc, companerasDesc, familiaDesc, hijosDesc, _familia, _familia$variants, _variantGroup$members2, cambios, familia, esHijo, hijos, companeras;
|
|
1837
1864
|
|
|
1838
1865
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1839
1866
|
while (1) {
|
|
@@ -1848,31 +1875,85 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1848
1875
|
|
|
1849
1876
|
case 2:
|
|
1850
1877
|
_context11.t0 = state.active_tab;
|
|
1851
|
-
_context11.next = _context11.t0 === "Descripción" ? 5 : _context11.t0 === "Ficha técnica" ?
|
|
1878
|
+
_context11.next = _context11.t0 === "Descripción" ? 5 : _context11.t0 === "Ficha técnica" ? 27 : _context11.t0 === "Imágenes" ? 53 : 56;
|
|
1852
1879
|
break;
|
|
1853
1880
|
|
|
1854
1881
|
case 5:
|
|
1855
|
-
|
|
1882
|
+
/*
|
|
1883
|
+
Guardar una descripción en un padre también abre la decisión de
|
|
1884
|
+
propagar. Sin esto, el hijo heredaba la descripción al ligarse y se
|
|
1885
|
+
quedaba con la versión vieja en cuanto el padre la corregía, sin que
|
|
1886
|
+
nadie lo notara.
|
|
1887
|
+
*/
|
|
1888
|
+
cambiosDesc = cambiosDeDescripciones();
|
|
1889
|
+
companerasDesc = ((_variantGroup$members = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.members) !== null && _variantGroup$members !== void 0 ? _variantGroup$members : []).filter(function (m) {
|
|
1890
|
+
return !m.isCurrent;
|
|
1891
|
+
});
|
|
1892
|
+
|
|
1893
|
+
if (!(esHijoDeOtro || cambiosDesc.length === 0)) {
|
|
1894
|
+
_context11.next = 11;
|
|
1895
|
+
break;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
_context11.next = 10;
|
|
1856
1899
|
return saveDescriptions(token);
|
|
1857
1900
|
|
|
1858
|
-
case
|
|
1859
|
-
return _context11.abrupt("break",
|
|
1901
|
+
case 10:
|
|
1902
|
+
return _context11.abrupt("break", 57);
|
|
1860
1903
|
|
|
1861
|
-
case
|
|
1904
|
+
case 11:
|
|
1905
|
+
setPreparandoPropagacion(true);
|
|
1906
|
+
familiaDesc = null;
|
|
1907
|
+
_context11.prev = 13;
|
|
1908
|
+
_context11.next = 16;
|
|
1909
|
+
return loadFamily(true);
|
|
1910
|
+
|
|
1911
|
+
case 16:
|
|
1912
|
+
familiaDesc = _context11.sent;
|
|
1913
|
+
|
|
1914
|
+
case 17:
|
|
1915
|
+
_context11.prev = 17;
|
|
1916
|
+
setPreparandoPropagacion(false);
|
|
1917
|
+
return _context11.finish(17);
|
|
1918
|
+
|
|
1919
|
+
case 20:
|
|
1920
|
+
hijosDesc = ((_familiaDesc$variants = (_familiaDesc = familiaDesc) === null || _familiaDesc === void 0 ? void 0 : _familiaDesc.variants) !== null && _familiaDesc$variants !== void 0 ? _familiaDesc$variants : []).filter(function (v) {
|
|
1921
|
+
return !v.isCurrent;
|
|
1922
|
+
});
|
|
1923
|
+
|
|
1924
|
+
if (!(hijosDesc.length > 0 || companerasDesc.length > 0)) {
|
|
1925
|
+
_context11.next = 24;
|
|
1926
|
+
break;
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
setPendingPropagation({
|
|
1930
|
+
cambios: cambiosDesc,
|
|
1931
|
+
kind: "description"
|
|
1932
|
+
});
|
|
1933
|
+
return _context11.abrupt("return");
|
|
1934
|
+
|
|
1935
|
+
case 24:
|
|
1936
|
+
_context11.next = 26;
|
|
1937
|
+
return saveDescriptions(token);
|
|
1938
|
+
|
|
1939
|
+
case 26:
|
|
1940
|
+
return _context11.abrupt("break", 57);
|
|
1941
|
+
|
|
1942
|
+
case 27:
|
|
1862
1943
|
cambios = cambiosDeFichaTecnica();
|
|
1863
1944
|
|
|
1864
1945
|
if (!(cambios.length === 0)) {
|
|
1865
|
-
_context11.next =
|
|
1946
|
+
_context11.next = 32;
|
|
1866
1947
|
break;
|
|
1867
1948
|
}
|
|
1868
1949
|
|
|
1869
|
-
_context11.next =
|
|
1950
|
+
_context11.next = 31;
|
|
1870
1951
|
return saveDatasheets(token);
|
|
1871
1952
|
|
|
1872
|
-
case
|
|
1873
|
-
return _context11.abrupt("break",
|
|
1953
|
+
case 31:
|
|
1954
|
+
return _context11.abrupt("break", 57);
|
|
1874
1955
|
|
|
1875
|
-
case
|
|
1956
|
+
case 32:
|
|
1876
1957
|
/*
|
|
1877
1958
|
Guardar un padre con hijos abre la decisión de propagar. Sin este paso
|
|
1878
1959
|
el cambio se queda solo en el padre y los hijos se van separando de él
|
|
@@ -1889,21 +1970,21 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1889
1970
|
*/
|
|
1890
1971
|
setPreparandoPropagacion(true);
|
|
1891
1972
|
familia = null;
|
|
1892
|
-
_context11.prev =
|
|
1893
|
-
_context11.next =
|
|
1973
|
+
_context11.prev = 34;
|
|
1974
|
+
_context11.next = 37;
|
|
1894
1975
|
return loadFamily(true);
|
|
1895
1976
|
|
|
1896
|
-
case
|
|
1977
|
+
case 37:
|
|
1897
1978
|
familia = _context11.sent;
|
|
1898
1979
|
|
|
1899
|
-
case
|
|
1900
|
-
_context11.prev =
|
|
1980
|
+
case 38:
|
|
1981
|
+
_context11.prev = 38;
|
|
1901
1982
|
setPreparandoPropagacion(false);
|
|
1902
|
-
return _context11.finish(
|
|
1983
|
+
return _context11.finish(38);
|
|
1903
1984
|
|
|
1904
|
-
case
|
|
1985
|
+
case 41:
|
|
1905
1986
|
if (!(!familia || familia.error)) {
|
|
1906
|
-
_context11.next =
|
|
1987
|
+
_context11.next = 44;
|
|
1907
1988
|
break;
|
|
1908
1989
|
}
|
|
1909
1990
|
|
|
@@ -1942,7 +2023,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1942
2023
|
});
|
|
1943
2024
|
return _context11.abrupt("return");
|
|
1944
2025
|
|
|
1945
|
-
case
|
|
2026
|
+
case 44:
|
|
1946
2027
|
/*
|
|
1947
2028
|
Un HIJO no propaga a nadie, y hay que decirlo explícitamente.
|
|
1948
2029
|
`familia.variants` mira la familia desde el PADRE —eso es lo correcto
|
|
@@ -1962,48 +2043,49 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1962
2043
|
puede copiar igual. Si no se miraran, guardar no ofrecería nada.
|
|
1963
2044
|
*/
|
|
1964
2045
|
|
|
1965
|
-
companeras = ((_variantGroup$
|
|
2046
|
+
companeras = ((_variantGroup$members2 = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.members) !== null && _variantGroup$members2 !== void 0 ? _variantGroup$members2 : []).filter(function (m) {
|
|
1966
2047
|
return !m.isCurrent;
|
|
1967
2048
|
}); // Un hijo tampoco puede estar agrupado desde 2026-09-25, así que para
|
|
1968
2049
|
// él no queda ningún destino posible.
|
|
1969
2050
|
|
|
1970
2051
|
if (!(!esHijo && (hijos.length > 0 || companeras.length > 0))) {
|
|
1971
|
-
_context11.next =
|
|
2052
|
+
_context11.next = 50;
|
|
1972
2053
|
break;
|
|
1973
2054
|
}
|
|
1974
2055
|
|
|
1975
2056
|
setPendingPropagation({
|
|
1976
|
-
cambios: cambios
|
|
2057
|
+
cambios: cambios,
|
|
2058
|
+
kind: "datasheet"
|
|
1977
2059
|
});
|
|
1978
2060
|
return _context11.abrupt("return");
|
|
1979
2061
|
|
|
1980
|
-
case
|
|
1981
|
-
_context11.next =
|
|
2062
|
+
case 50:
|
|
2063
|
+
_context11.next = 52;
|
|
1982
2064
|
return saveDatasheets(token);
|
|
1983
2065
|
|
|
1984
|
-
case
|
|
1985
|
-
return _context11.abrupt("break",
|
|
2066
|
+
case 52:
|
|
2067
|
+
return _context11.abrupt("break", 57);
|
|
1986
2068
|
|
|
1987
|
-
case
|
|
1988
|
-
_context11.next =
|
|
2069
|
+
case 53:
|
|
2070
|
+
_context11.next = 55;
|
|
1989
2071
|
return updateImages(token);
|
|
1990
2072
|
|
|
1991
|
-
case
|
|
1992
|
-
return _context11.abrupt("break",
|
|
2073
|
+
case 55:
|
|
2074
|
+
return _context11.abrupt("break", 57);
|
|
1993
2075
|
|
|
1994
|
-
case
|
|
1995
|
-
return _context11.abrupt("break",
|
|
2076
|
+
case 56:
|
|
2077
|
+
return _context11.abrupt("break", 57);
|
|
1996
2078
|
|
|
1997
|
-
case
|
|
1998
|
-
_context11.next =
|
|
2079
|
+
case 57:
|
|
2080
|
+
_context11.next = 59;
|
|
1999
2081
|
return loadData(false);
|
|
2000
2082
|
|
|
2001
|
-
case
|
|
2083
|
+
case 59:
|
|
2002
2084
|
case "end":
|
|
2003
2085
|
return _context11.stop();
|
|
2004
2086
|
}
|
|
2005
2087
|
}
|
|
2006
|
-
}, _callee11, null, [[
|
|
2088
|
+
}, _callee11, null, [[13,, 17, 20], [34,, 38, 41]]);
|
|
2007
2089
|
}));
|
|
2008
2090
|
|
|
2009
2091
|
return function handleOnClickSave() {
|
|
@@ -2102,7 +2184,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2102
2184
|
|
|
2103
2185
|
var sendSingleEvaluation = /*#__PURE__*/function () {
|
|
2104
2186
|
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
|
|
2105
|
-
var _state$product$id_ord, _state$
|
|
2187
|
+
var _state$product$id_ord, _state$active_retaile6;
|
|
2106
2188
|
|
|
2107
2189
|
var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, articleStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _articleStatus, updatedStatusByRetailerForSend, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
|
|
2108
2190
|
|
|
@@ -2127,7 +2209,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2127
2209
|
orderId = (_state$product$id_ord = state.product.id_order) !== null && _state$product$id_ord !== void 0 ? _state$product$id_ord : state.product.orderId;
|
|
2128
2210
|
sectionStatusKey = "".concat(concept, "_status");
|
|
2129
2211
|
evalStatus = state.product[sectionStatusKey];
|
|
2130
|
-
retailerId = (_state$
|
|
2212
|
+
retailerId = (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer;
|
|
2131
2213
|
data = {
|
|
2132
2214
|
articleId: articleId,
|
|
2133
2215
|
orderId: orderId,
|
|
@@ -2927,10 +3009,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2927
3009
|
headerTop: headerTop,
|
|
2928
3010
|
children: [pendingPropagation && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PropagateChangesModal.PropagateChangesModal, {
|
|
2929
3011
|
changedAttributes: pendingPropagation.cambios,
|
|
3012
|
+
kind: (_pendingPropagation$k = pendingPropagation.kind) !== null && _pendingPropagation$k !== void 0 ? _pendingPropagation$k : "datasheet",
|
|
2930
3013
|
variants: esHijoDeOtro ? [] : ((_family$variants2 = family === null || family === void 0 ? void 0 : family.variants) !== null && _family$variants2 !== void 0 ? _family$variants2 : []).filter(function (v) {
|
|
2931
3014
|
return !v.isCurrent;
|
|
2932
3015
|
}),
|
|
2933
|
-
groupMembers: ((_variantGroup$
|
|
3016
|
+
groupMembers: ((_variantGroup$members3 = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.members) !== null && _variantGroup$members3 !== void 0 ? _variantGroup$members3 : []).filter(function (m) {
|
|
2934
3017
|
return !m.isCurrent;
|
|
2935
3018
|
}),
|
|
2936
3019
|
groupCode: (_variantGroup$group = variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) !== null && _variantGroup$group !== void 0 ? _variantGroup$group : null,
|
|
@@ -2939,14 +3022,37 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
2939
3022
|
return setPendingPropagation(null);
|
|
2940
3023
|
},
|
|
2941
3024
|
onConfirm: function onConfirm(propagation) {
|
|
3025
|
+
var esDescripcion = pendingPropagation.kind === "description";
|
|
2942
3026
|
setPendingPropagation(null);
|
|
2943
|
-
|
|
3027
|
+
|
|
3028
|
+
if (!propagation) {
|
|
3029
|
+
if (esDescripcion) saveDescriptions(token);else saveDatasheets(token);
|
|
3030
|
+
return;
|
|
3031
|
+
}
|
|
3032
|
+
/*
|
|
3033
|
+
El diálogo habla de «atributos» porque es el mismo componente
|
|
3034
|
+
para las dos pestañas. Al guardar hay que ponerlo en la lista
|
|
3035
|
+
que corresponde: el servidor recibe `attributes` o
|
|
3036
|
+
`descriptions`, nunca una por la otra.
|
|
3037
|
+
*/
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
var attributes = propagation.attributes,
|
|
3041
|
+
destinos = (0, _objectWithoutProperties2.default)(propagation, _excluded);
|
|
3042
|
+
|
|
3043
|
+
if (esDescripcion) {
|
|
3044
|
+
saveDescriptions(token, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, destinos), {}, {
|
|
3045
|
+
descriptions: attributes
|
|
3046
|
+
}));
|
|
3047
|
+
} else {
|
|
3048
|
+
saveDatasheets(token, propagation);
|
|
3049
|
+
}
|
|
2944
3050
|
}
|
|
2945
3051
|
}), showLinkVariants && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkVariantsModal.LinkVariantsModal, {
|
|
2946
3052
|
articleId: (_state$product19 = state.product) === null || _state$product19 === void 0 ? void 0 : _state$product19.id_article,
|
|
2947
3053
|
articleName: (_state$product20 = state.product) === null || _state$product20 === void 0 ? void 0 : _state$product20.name,
|
|
2948
3054
|
articleUpc: (_state$product21 = state.product) === null || _state$product21 === void 0 ? void 0 : _state$product21.upc,
|
|
2949
|
-
activeRetailerId: (_state$
|
|
3055
|
+
activeRetailerId: (_state$active_retaile7 = state.active_retailer) === null || _state$active_retaile7 === void 0 ? void 0 : _state$active_retaile7.id_retailer,
|
|
2950
3056
|
token: token,
|
|
2951
3057
|
onClose: function onClose() {
|
|
2952
3058
|
return setShowLinkVariants(false);
|
|
@@ -3108,8 +3214,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3108
3214
|
productSelected: state.product,
|
|
3109
3215
|
token: token,
|
|
3110
3216
|
activeRetailer: {
|
|
3111
|
-
id: (_state$
|
|
3112
|
-
name: (_state$
|
|
3217
|
+
id: (_state$active_retaile8 = state.active_retailer) === null || _state$active_retaile8 === void 0 ? void 0 : _state$active_retaile8.id_retailer,
|
|
3218
|
+
name: (_state$active_retaile9 = state.active_retailer) === null || _state$active_retaile9 === void 0 ? void 0 : _state$active_retaile9.retailer
|
|
3113
3219
|
}
|
|
3114
3220
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3115
3221
|
className: "data-container",
|
|
@@ -3126,7 +3232,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3126
3232
|
activeImage: (_state$images_values10 = state.images_values) !== null && _state$images_values10 !== void 0 && _state$images_values10.values ? (_state$images_values11 = state.images_values) === null || _state$images_values11 === void 0 ? void 0 : _state$images_values11.values[state.current_image] : {},
|
|
3127
3233
|
assignationsImages: state.collaborator_assignations["Imágenes"],
|
|
3128
3234
|
imagesStatus: ((_state$product25 = state.product) === null || _state$product25 === void 0 ? void 0 : _state$product25.images_status) || "-",
|
|
3129
|
-
retailerSelected: (_state$
|
|
3235
|
+
retailerSelected: (_state$active_retaile10 = state.active_retailer) === null || _state$active_retaile10 === void 0 ? void 0 : _state$active_retaile10.id_retailer,
|
|
3130
3236
|
isRetailer: isRetailer,
|
|
3131
3237
|
version: state.product.version,
|
|
3132
3238
|
shotThd: shotThd,
|
|
@@ -3297,7 +3403,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3297
3403
|
})]
|
|
3298
3404
|
}), puedeAgruparse && showGroup && (variantGroup === null || variantGroup === void 0 ? void 0 : variantGroup.group) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
3299
3405
|
className: "variants-family",
|
|
3300
|
-
children: [((_variantGroup$
|
|
3406
|
+
children: [((_variantGroup$members4 = variantGroup.members) !== null && _variantGroup$members4 !== void 0 ? _variantGroup$members4 : []).filter(function (miembro) {
|
|
3301
3407
|
return !miembro.isCurrent;
|
|
3302
3408
|
}).map(function (miembro) {
|
|
3303
3409
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -3321,7 +3427,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3321
3427
|
})]
|
|
3322
3428
|
})
|
|
3323
3429
|
}, miembro.articleId);
|
|
3324
|
-
}), ((_variantGroup$
|
|
3430
|
+
}), ((_variantGroup$members5 = variantGroup.members) !== null && _variantGroup$members5 !== void 0 ? _variantGroup$members5 : []).filter(function (m) {
|
|
3325
3431
|
return !m.isCurrent;
|
|
3326
3432
|
}).length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
3327
3433
|
className: "loading",
|
|
@@ -3339,9 +3445,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3339
3445
|
productObservation: observation,
|
|
3340
3446
|
percent: (_state$active_percent = (_state$active_percent2 = state.active_percentage) === null || _state$active_percent2 === void 0 ? void 0 : (_state$active_percent3 = _state$active_percent2.percentagesGeneral) === null || _state$active_percent3 === void 0 ? void 0 : _state$active_percent3.required) !== null && _state$active_percent !== void 0 ? _state$active_percent : 0,
|
|
3341
3447
|
activeRetailer: {
|
|
3342
|
-
id: (_state$
|
|
3343
|
-
name: (_state$
|
|
3344
|
-
image: (_state$
|
|
3448
|
+
id: (_state$active_retaile11 = state.active_retailer) === null || _state$active_retaile11 === void 0 ? void 0 : _state$active_retaile11.id_retailer,
|
|
3449
|
+
name: (_state$active_retaile12 = state.active_retailer) === null || _state$active_retaile12 === void 0 ? void 0 : _state$active_retaile12.retailer,
|
|
3450
|
+
image: (_state$active_retaile13 = state.active_retailer) === null || _state$active_retaile13 === void 0 ? void 0 : _state$active_retaile13.image
|
|
3345
3451
|
},
|
|
3346
3452
|
servicesData: state.services_data ? state.services_data : null,
|
|
3347
3453
|
isObservationVisible: isObservationVisible // actions
|
|
@@ -3398,7 +3504,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3398
3504
|
/* El parentesco es del producto, no del servicio: los
|
|
3399
3505
|
dos endpoints lo devuelven igual. */
|
|
3400
3506
|
,
|
|
3401
|
-
variant: (_state$
|
|
3507
|
+
variant: (_state$services3 = state.services) === null || _state$services3 === void 0 ? void 0 : (_state$services3$data = _state$services3.datasheets) === null || _state$services3$data === void 0 ? void 0 : _state$services3$data.variant,
|
|
3402
3508
|
onRestoreInheritance: handleOnRestoreInheritance,
|
|
3403
3509
|
articleId: (_state$product32 = state.product) === null || _state$product32 === void 0 ? void 0 : _state$product32.id_article,
|
|
3404
3510
|
version: state.product.version,
|
|
@@ -3411,7 +3517,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3411
3517
|
headerType: "input-name-header"
|
|
3412
3518
|
})), state.active_tab === "Ficha técnica" && (((_state$product33 = state.product) === null || _state$product33 === void 0 ? void 0 : _state$product33.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
3413
3519
|
children: (_state$datasheets_inp = state.datasheets_inputs[0]) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp.data) === null || _state$datasheets_inp2 === void 0 ? void 0 : _state$datasheets_inp2.map(function (dataGroup, index) {
|
|
3414
|
-
var _state$
|
|
3520
|
+
var _state$services4, _state$services4$data;
|
|
3415
3521
|
|
|
3416
3522
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
3417
3523
|
articleId: state.product.id_article,
|
|
@@ -3419,7 +3525,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
3419
3525
|
activeSection: state.active_tab,
|
|
3420
3526
|
inputGroup: dataGroup,
|
|
3421
3527
|
dataInputs: state.datasheets_inputs[1],
|
|
3422
|
-
variant: (_state$
|
|
3528
|
+
variant: (_state$services4 = state.services) === null || _state$services4 === void 0 ? void 0 : (_state$services4$data = _state$services4.datasheets) === null || _state$services4$data === void 0 ? void 0 : _state$services4$data.variant,
|
|
3423
3529
|
onRestoreInheritance: handleOnRestoreInheritance,
|
|
3424
3530
|
auditInputs: auditDatasheets[1],
|
|
3425
3531
|
updatedDatasheets: state.updated_datasheets_inputs,
|
package/package.json
CHANGED
|
@@ -40,6 +40,9 @@ const UMBRAL_SEGUNDO_PLANO = 20;
|
|
|
40
40
|
|
|
41
41
|
export const PropagateChangesModal = ({
|
|
42
42
|
changedAttributes: cambiosRecibidos = [],
|
|
43
|
+
// Qué se está propagando. El componente sirve a las dos pestañas y solo
|
|
44
|
+
// cambia cómo se nombra lo que el usuario acaba de editar.
|
|
45
|
+
kind = "datasheet",
|
|
43
46
|
variants = [],
|
|
44
47
|
groupMembers = [],
|
|
45
48
|
groupCode = null,
|
|
@@ -56,6 +59,10 @@ export const PropagateChangesModal = ({
|
|
|
56
59
|
*/
|
|
57
60
|
const changedAttributes = soloPropagables(cambiosRecibidos);
|
|
58
61
|
|
|
62
|
+
const esDescripcion = kind === "description";
|
|
63
|
+
const sustantivo = esDescripcion ? "descripción" : "atributo";
|
|
64
|
+
const plural = esDescripcion ? "descripciones" : "atributos";
|
|
65
|
+
|
|
59
66
|
const [chosenAttributes, setChosenAttributes] = useState([]);
|
|
60
67
|
|
|
61
68
|
/*
|
|
@@ -177,9 +184,9 @@ export const PropagateChangesModal = ({
|
|
|
177
184
|
{" pueden recibir este cambio"}
|
|
178
185
|
</h2>
|
|
179
186
|
<p>
|
|
180
|
-
Cambiaste {changedAttributes.length}
|
|
181
|
-
{changedAttributes.length === 1 ?
|
|
182
|
-
a quiénes; el resto se guarda solo en este producto.
|
|
187
|
+
Cambiaste {changedAttributes.length}{" "}
|
|
188
|
+
{changedAttributes.length === 1 ? sustantivo : plural}. Elige cuáles
|
|
189
|
+
se copian y a quiénes; el resto se guarda solo en este producto.
|
|
183
190
|
</p>
|
|
184
191
|
</Header>
|
|
185
192
|
|
package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx
CHANGED
|
@@ -49,7 +49,7 @@ export const useProviderProductEdition = () => {
|
|
|
49
49
|
export const ProviderProductEditionProvider = ({ children }) => {
|
|
50
50
|
const [state, dispatch] = useReducer(productEditionReducer, initialState);
|
|
51
51
|
|
|
52
|
-
const saveDescriptions = async (token) => {
|
|
52
|
+
const saveDescriptions = async (token, propagation) => {
|
|
53
53
|
if (state.updated_descriptions_inputs.length === 0) return;
|
|
54
54
|
|
|
55
55
|
dispatch({ type: "SET_SAVING", payload: true });
|
|
@@ -57,6 +57,7 @@ export const ProviderProductEditionProvider = ({ children }) => {
|
|
|
57
57
|
const dataObject = {
|
|
58
58
|
articleId: state.product?.id_article,
|
|
59
59
|
articleData: state.updated_descriptions_inputs,
|
|
60
|
+
...(propagation ? { propagation } : {}),
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
// Marcar todos los items como aprobados
|