contentoh-components-library 21.4.48 → 21.4.49
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/molecules/BoxAttribute/index.js +1 -12
- package/dist/components/molecules/BoxButtons/index.js +1 -11
- package/dist/components/organisms/Box/index.js +2 -3
- package/dist/components/organisms/BoxOnboarding/index.js +1 -7
- package/dist/components/organisms/InputGroup/index.js +0 -2
- package/dist/components/pages/ProviderProductEdition/index.js +43 -46
- package/package.json +1 -1
- package/src/components/molecules/BoxAttribute/index.js +0 -16
- package/src/components/molecules/BoxButtons/index.js +2 -2
- package/src/components/organisms/Box/index.js +2 -3
- package/src/components/organisms/BoxOnboarding/index.js +0 -6
- package/src/components/organisms/InputGroup/index.js +0 -2
- package/src/components/pages/ProviderProductEdition/index.js +17 -25
|
@@ -28,7 +28,6 @@ var BoxAttribute = function BoxAttribute(props) {
|
|
|
28
28
|
className = props.className,
|
|
29
29
|
text = props.text,
|
|
30
30
|
borderType = props.borderType,
|
|
31
|
-
isEditEnabled = props.isEditEnabled,
|
|
32
31
|
titletool = props.titletool,
|
|
33
32
|
texttool = props.texttool,
|
|
34
33
|
atributos = props.atributos,
|
|
@@ -76,7 +75,7 @@ var BoxAttribute = function BoxAttribute(props) {
|
|
|
76
75
|
classNameTooltip: "container-tooltip"
|
|
77
76
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
78
77
|
children: text
|
|
79
|
-
}),
|
|
78
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
80
79
|
hiddenLabel: true,
|
|
81
80
|
name: props.id,
|
|
82
81
|
value: atributos[props.id],
|
|
@@ -85,16 +84,6 @@ var BoxAttribute = function BoxAttribute(props) {
|
|
|
85
84
|
variant: "outlined",
|
|
86
85
|
size: "small",
|
|
87
86
|
type: "number"
|
|
88
|
-
}, props.id) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
89
|
-
hiddenLabel: true,
|
|
90
|
-
name: props.id,
|
|
91
|
-
value: atributos[props.id],
|
|
92
|
-
onChange: handleInputChange,
|
|
93
|
-
className: "caja-borde",
|
|
94
|
-
variant: "outlined",
|
|
95
|
-
size: "small",
|
|
96
|
-
type: "number",
|
|
97
|
-
disabled: true
|
|
98
87
|
}, props.id)]
|
|
99
88
|
}, key)
|
|
100
89
|
});
|
|
@@ -22,17 +22,7 @@ var BoxButtons = function BoxButtons(_ref) {
|
|
|
22
22
|
console.log("index", index);
|
|
23
23
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
24
24
|
index: index,
|
|
25
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
26
|
-
variant: "outlined",
|
|
27
|
-
className: "button-circle",
|
|
28
|
-
onClick: onToggleEdit,
|
|
29
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ContainerIcon, {
|
|
30
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
31
|
-
className: "iconos-out ".concat(isEditEnabled ? "iconos-grises" : ""),
|
|
32
|
-
children: "edit"
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
}), !isTheFirstBox && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
25
|
+
children: [!isTheFirstBox && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
36
26
|
variant: "outlined",
|
|
37
27
|
className: "button-circle",
|
|
38
28
|
onClick: onDelete,
|
|
@@ -51,8 +51,8 @@ var Box = function Box(_ref) {
|
|
|
51
51
|
setBoxOnboardingList = _useState6[1];
|
|
52
52
|
|
|
53
53
|
(0, _react.useEffect)(function () {
|
|
54
|
-
console.log("dataInputs:", dataInputs);
|
|
55
|
-
console.log("inputGroup:", inputGroup);
|
|
54
|
+
// console.log("dataInputs:", dataInputs);
|
|
55
|
+
// console.log("inputGroup:", inputGroup);
|
|
56
56
|
var temp = {};
|
|
57
57
|
var maxBoxId = 0;
|
|
58
58
|
inputGroup.inputs.forEach(function (attrId) {
|
|
@@ -126,7 +126,6 @@ var Box = function Box(_ref) {
|
|
|
126
126
|
inputs: inputGroup.inputs,
|
|
127
127
|
isEditEnabled: isEditEnabled,
|
|
128
128
|
onChange: function onChange(e) {
|
|
129
|
-
console.log("e in Box", e);
|
|
130
129
|
setBoxOnboardingList(function (prev) {
|
|
131
130
|
return prev.map(function (box, i) {
|
|
132
131
|
if (i != index) {
|
|
@@ -23,7 +23,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
23
23
|
|
|
24
24
|
var BoxOnboarding = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
25
25
|
var panelColor = _ref.panelColor,
|
|
26
|
-
isEditEnabled = _ref.isEditEnabled,
|
|
27
26
|
index = _ref.index,
|
|
28
27
|
onChange = _ref.onChange,
|
|
29
28
|
data = _ref.data,
|
|
@@ -33,9 +32,7 @@ var BoxOnboarding = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
33
32
|
var _useState = (0, _react.useState)({}),
|
|
34
33
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
35
34
|
atributos = _useState2[0],
|
|
36
|
-
setAtributos = _useState2[1];
|
|
37
|
-
//console.log("atributossss BO",atributos)
|
|
38
|
-
|
|
35
|
+
setAtributos = _useState2[1];
|
|
39
36
|
|
|
40
37
|
var _useState3 = (0, _react.useState)(true),
|
|
41
38
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
@@ -43,7 +40,6 @@ var BoxOnboarding = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
43
40
|
setIsLoading = _useState4[1];
|
|
44
41
|
|
|
45
42
|
(0, _react.useEffect)(function () {
|
|
46
|
-
console.log("atributos use", atributos);
|
|
47
43
|
onChange && onChange(atributos);
|
|
48
44
|
}, [atributos]);
|
|
49
45
|
(0, _react.useEffect)(function () {
|
|
@@ -64,13 +60,11 @@ var BoxOnboarding = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
64
60
|
}), inputs.map(function (attrId) {
|
|
65
61
|
var _dataInputs$attrId;
|
|
66
62
|
|
|
67
|
-
console.log("data inputsss name:", atributos);
|
|
68
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BoxAttribute.BoxAttribute, {
|
|
69
64
|
id: attrId,
|
|
70
65
|
borderType: "rectangle",
|
|
71
66
|
className: "caja",
|
|
72
67
|
text: (_dataInputs$attrId = dataInputs[attrId]) === null || _dataInputs$attrId === void 0 ? void 0 : _dataInputs$attrId.name,
|
|
73
|
-
isEditEnabled: isEditEnabled,
|
|
74
68
|
atributos: atributos,
|
|
75
69
|
setAtributos: setAtributos
|
|
76
70
|
}, attrId);
|
|
@@ -43,8 +43,6 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
43
43
|
isShowbox = _ref.isShowbox,
|
|
44
44
|
setUpdatedBoxData = _ref.setUpdatedBoxData;
|
|
45
45
|
|
|
46
|
-
// console.log("groupData: ", typeof groupData);
|
|
47
|
-
// console.log("groupData: ", groupData);
|
|
48
46
|
var inputTypeValue = function inputTypeValue(type) {
|
|
49
47
|
switch (type) {
|
|
50
48
|
case "Booleano":
|
|
@@ -1219,76 +1219,73 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1219
1219
|
|
|
1220
1220
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
1221
1221
|
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1222
|
-
var
|
|
1222
|
+
var parseBoxData, dataObject, res;
|
|
1223
1223
|
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1224
1224
|
while (1) {
|
|
1225
1225
|
switch (_context12.prev = _context12.next) {
|
|
1226
1226
|
case 0:
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
var
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1227
|
+
parseBoxData = [];
|
|
1228
|
+
Object.entries(boxData).forEach(function (_ref11, index) {
|
|
1229
|
+
var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
|
|
1230
|
+
box = _ref12[1];
|
|
1231
|
+
|
|
1232
|
+
var value = box.value;
|
|
1233
|
+
var attributesIds = Object.keys(value);
|
|
1234
|
+
attributesIds.forEach(function (attributeId) {
|
|
1235
|
+
var boxId = index + 1;
|
|
1236
|
+
var valueOfAtribute = value[attributeId];
|
|
1237
|
+
parseBoxData.push({
|
|
1238
|
+
attributeId: attributeId,
|
|
1239
|
+
value: valueOfAtribute,
|
|
1240
|
+
boxId: boxId
|
|
1241
|
+
});
|
|
1241
1242
|
});
|
|
1242
|
-
|
|
1243
|
-
}();
|
|
1244
|
-
|
|
1245
|
-
setLoading(true);
|
|
1243
|
+
});
|
|
1246
1244
|
dataObject = {
|
|
1247
1245
|
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
1248
1246
|
articleData: updatedDatasheets,
|
|
1249
|
-
|
|
1247
|
+
boxData: parseBoxData
|
|
1250
1248
|
};
|
|
1251
|
-
console.log("boxData guardado", dataObject);
|
|
1252
1249
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1253
|
-
_context12.prev =
|
|
1254
|
-
_context12.next =
|
|
1250
|
+
_context12.prev = 4;
|
|
1251
|
+
_context12.next = 7;
|
|
1255
1252
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
1256
1253
|
headers: {
|
|
1257
1254
|
Authorization: token
|
|
1258
1255
|
}
|
|
1259
1256
|
});
|
|
1260
1257
|
|
|
1261
|
-
case
|
|
1258
|
+
case 7:
|
|
1262
1259
|
res = _context12.sent;
|
|
1263
1260
|
|
|
1264
1261
|
if (!(res.data.statusCode === 200)) {
|
|
1265
|
-
_context12.next =
|
|
1262
|
+
_context12.next = 13;
|
|
1266
1263
|
break;
|
|
1267
1264
|
}
|
|
1268
1265
|
|
|
1269
1266
|
setUpdatedDatasheets([]);
|
|
1270
1267
|
setMessage("Fichas técnicas guardadas");
|
|
1271
|
-
_context12.next =
|
|
1268
|
+
_context12.next = 13;
|
|
1272
1269
|
return loadData();
|
|
1273
1270
|
|
|
1274
|
-
case
|
|
1275
|
-
_context12.next =
|
|
1271
|
+
case 13:
|
|
1272
|
+
_context12.next = 18;
|
|
1276
1273
|
break;
|
|
1277
1274
|
|
|
1278
|
-
case
|
|
1279
|
-
_context12.prev =
|
|
1280
|
-
_context12.t0 = _context12["catch"](
|
|
1275
|
+
case 15:
|
|
1276
|
+
_context12.prev = 15;
|
|
1277
|
+
_context12.t0 = _context12["catch"](4);
|
|
1281
1278
|
console.log(_context12.t0);
|
|
1282
1279
|
|
|
1283
|
-
case
|
|
1280
|
+
case 18:
|
|
1284
1281
|
console.log(dataObject);
|
|
1285
1282
|
|
|
1286
|
-
case
|
|
1283
|
+
case 19:
|
|
1287
1284
|
case "end":
|
|
1288
1285
|
return _context12.stop();
|
|
1289
1286
|
}
|
|
1290
1287
|
}
|
|
1291
|
-
}, _callee12, null, [[
|
|
1288
|
+
}, _callee12, null, [[4, 15]]);
|
|
1292
1289
|
}));
|
|
1293
1290
|
|
|
1294
1291
|
return function saveDatasheets() {
|
|
@@ -1487,7 +1484,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1487
1484
|
};
|
|
1488
1485
|
|
|
1489
1486
|
var createComment = /*#__PURE__*/function () {
|
|
1490
|
-
var
|
|
1487
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1491
1488
|
var messages,
|
|
1492
1489
|
retailerId,
|
|
1493
1490
|
data,
|
|
@@ -1522,7 +1519,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1522
1519
|
}));
|
|
1523
1520
|
|
|
1524
1521
|
return function createComment() {
|
|
1525
|
-
return
|
|
1522
|
+
return _ref15.apply(this, arguments);
|
|
1526
1523
|
};
|
|
1527
1524
|
}();
|
|
1528
1525
|
|
|
@@ -1531,7 +1528,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1531
1528
|
}, [activeTab]);
|
|
1532
1529
|
|
|
1533
1530
|
var commentRevised = /*#__PURE__*/function () {
|
|
1534
|
-
var
|
|
1531
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1535
1532
|
var data;
|
|
1536
1533
|
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1537
1534
|
while (1) {
|
|
@@ -1559,12 +1556,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1559
1556
|
}));
|
|
1560
1557
|
|
|
1561
1558
|
return function commentRevised() {
|
|
1562
|
-
return
|
|
1559
|
+
return _ref16.apply(this, arguments);
|
|
1563
1560
|
};
|
|
1564
1561
|
}();
|
|
1565
1562
|
|
|
1566
1563
|
var setAssignation = /*#__PURE__*/function () {
|
|
1567
|
-
var
|
|
1564
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
|
|
1568
1565
|
var concept, productTemp, data;
|
|
1569
1566
|
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1570
1567
|
while (1) {
|
|
@@ -1621,7 +1618,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1621
1618
|
}));
|
|
1622
1619
|
|
|
1623
1620
|
return function setAssignation(_x4, _x5) {
|
|
1624
|
-
return
|
|
1621
|
+
return _ref17.apply(this, arguments);
|
|
1625
1622
|
};
|
|
1626
1623
|
}();
|
|
1627
1624
|
|
|
@@ -1705,7 +1702,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1705
1702
|
};
|
|
1706
1703
|
|
|
1707
1704
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1708
|
-
var
|
|
1705
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
|
|
1709
1706
|
var _productTemp$id_order2;
|
|
1710
1707
|
|
|
1711
1708
|
var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, body, _JSON$parse, response, newStatuses, statusObject, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse2, _response, _statusObject, retailerStatusCopy, status;
|
|
@@ -1817,12 +1814,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1817
1814
|
}));
|
|
1818
1815
|
|
|
1819
1816
|
return function sendEvaluation(_x6) {
|
|
1820
|
-
return
|
|
1817
|
+
return _ref18.apply(this, arguments);
|
|
1821
1818
|
};
|
|
1822
1819
|
}();
|
|
1823
1820
|
|
|
1824
1821
|
var validateAll = /*#__PURE__*/function () {
|
|
1825
|
-
var
|
|
1822
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
|
|
1826
1823
|
var _product$id_order2, evaluationArray, conceptArray, isAproved, retailersIds, body, userType, productTemp, status, retailerStatusCopy;
|
|
1827
1824
|
|
|
1828
1825
|
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
@@ -1908,12 +1905,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1908
1905
|
}));
|
|
1909
1906
|
|
|
1910
1907
|
return function validateAll(_x7) {
|
|
1911
|
-
return
|
|
1908
|
+
return _ref19.apply(this, arguments);
|
|
1912
1909
|
};
|
|
1913
1910
|
}();
|
|
1914
1911
|
|
|
1915
1912
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1916
|
-
var
|
|
1913
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
|
|
1917
1914
|
var data, prod, statusComplete;
|
|
1918
1915
|
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
1919
1916
|
while (1) {
|
|
@@ -1955,7 +1952,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1955
1952
|
}));
|
|
1956
1953
|
|
|
1957
1954
|
return function evaluationToRetailer(_x8) {
|
|
1958
|
-
return
|
|
1955
|
+
return _ref20.apply(this, arguments);
|
|
1959
1956
|
};
|
|
1960
1957
|
}();
|
|
1961
1958
|
|
package/package.json
CHANGED
|
@@ -11,7 +11,6 @@ export const BoxAttribute = (props) => {
|
|
|
11
11
|
className,
|
|
12
12
|
text,
|
|
13
13
|
borderType,
|
|
14
|
-
isEditEnabled,
|
|
15
14
|
titletool,
|
|
16
15
|
texttool,
|
|
17
16
|
atributos,
|
|
@@ -57,7 +56,6 @@ export const BoxAttribute = (props) => {
|
|
|
57
56
|
classNameTooltip={"container-tooltip"}
|
|
58
57
|
/>
|
|
59
58
|
<span>{text}</span>
|
|
60
|
-
{isEditEnabled ? (
|
|
61
59
|
<TextField
|
|
62
60
|
hiddenLabel
|
|
63
61
|
key={props.id}
|
|
@@ -69,20 +67,6 @@ export const BoxAttribute = (props) => {
|
|
|
69
67
|
size="small"
|
|
70
68
|
type="number"
|
|
71
69
|
/>
|
|
72
|
-
) : (
|
|
73
|
-
<TextField
|
|
74
|
-
hiddenLabel
|
|
75
|
-
key={props.id}
|
|
76
|
-
name={props.id}
|
|
77
|
-
value={atributos[props.id]}
|
|
78
|
-
onChange={handleInputChange}
|
|
79
|
-
className="caja-borde"
|
|
80
|
-
variant="outlined"
|
|
81
|
-
size="small"
|
|
82
|
-
type="number"
|
|
83
|
-
disabled
|
|
84
|
-
/>
|
|
85
|
-
)}
|
|
86
70
|
</Container>
|
|
87
71
|
</>
|
|
88
72
|
);
|
|
@@ -5,11 +5,11 @@ export const BoxButtons = ({ showAdd, onAdd, onDelete, isTheFirstBox, onToggleEd
|
|
|
5
5
|
console.log("index",index)
|
|
6
6
|
return (
|
|
7
7
|
<Container index={index}>
|
|
8
|
-
<Button variant="outlined" className="button-circle" onClick={onToggleEdit}>
|
|
8
|
+
{/* <Button variant="outlined" className="button-circle" onClick={onToggleEdit}>
|
|
9
9
|
<ContainerIcon>
|
|
10
10
|
<span className={`iconos-out ${isEditEnabled ? "iconos-grises" : ""}`}>edit</span>
|
|
11
11
|
</ContainerIcon>
|
|
12
|
-
</Button>
|
|
12
|
+
</Button> */}
|
|
13
13
|
{!isTheFirstBox && (
|
|
14
14
|
<Button
|
|
15
15
|
variant="outlined"
|
|
@@ -15,8 +15,8 @@ export const Box = ({ onChange, dataInputs, inputGroup }) => {
|
|
|
15
15
|
]);
|
|
16
16
|
|
|
17
17
|
useEffect(() => {
|
|
18
|
-
console.log("dataInputs:", dataInputs);
|
|
19
|
-
console.log("inputGroup:", inputGroup);
|
|
18
|
+
// console.log("dataInputs:", dataInputs);
|
|
19
|
+
// console.log("inputGroup:", inputGroup);
|
|
20
20
|
const temp = {};
|
|
21
21
|
let maxBoxId = 0;
|
|
22
22
|
inputGroup.inputs.forEach((attrId) => {
|
|
@@ -83,7 +83,6 @@ export const Box = ({ onChange, dataInputs, inputGroup }) => {
|
|
|
83
83
|
inputs={inputGroup.inputs}
|
|
84
84
|
isEditEnabled={isEditEnabled}
|
|
85
85
|
onChange={(e) => {
|
|
86
|
-
console.log("e in Box",e);
|
|
87
86
|
setBoxOnboardingList((prev) => {
|
|
88
87
|
return prev.map((box, i) => {
|
|
89
88
|
if (i != index) {
|
|
@@ -7,7 +7,6 @@ import { isEqual } from "lodash";
|
|
|
7
7
|
export const BoxOnboarding = memo(
|
|
8
8
|
({
|
|
9
9
|
panelColor,
|
|
10
|
-
isEditEnabled,
|
|
11
10
|
index,
|
|
12
11
|
onChange,
|
|
13
12
|
data,
|
|
@@ -15,12 +14,9 @@ export const BoxOnboarding = memo(
|
|
|
15
14
|
inputs,
|
|
16
15
|
}) => {
|
|
17
16
|
const [atributos, setAtributos] = useState({});
|
|
18
|
-
// console.log("input",inputs);
|
|
19
|
-
//console.log("atributossss BO",atributos)
|
|
20
17
|
const [isLoading, setIsLoading] = useState(true);
|
|
21
18
|
|
|
22
19
|
useEffect(() => {
|
|
23
|
-
console.log("atributos use", atributos)
|
|
24
20
|
onChange && onChange(atributos);
|
|
25
21
|
}, [atributos]);
|
|
26
22
|
|
|
@@ -41,7 +37,6 @@ export const BoxOnboarding = memo(
|
|
|
41
37
|
<div id="contenedor-caja">
|
|
42
38
|
<p fontFamily={FontFamily.Raleway}>Caja {index + 1}</p>
|
|
43
39
|
{inputs.map((attrId) => {
|
|
44
|
-
console.log("data inputsss name:",atributos)
|
|
45
40
|
return (
|
|
46
41
|
<BoxAttribute
|
|
47
42
|
id={attrId}
|
|
@@ -49,7 +44,6 @@ export const BoxOnboarding = memo(
|
|
|
49
44
|
borderType="rectangle"
|
|
50
45
|
className="caja"
|
|
51
46
|
text={dataInputs[attrId]?.name}
|
|
52
|
-
isEditEnabled={isEditEnabled}
|
|
53
47
|
atributos={atributos}
|
|
54
48
|
setAtributos={setAtributos}
|
|
55
49
|
/>
|
|
@@ -682,35 +682,27 @@ export const ProviderProductEdition = ({
|
|
|
682
682
|
};
|
|
683
683
|
|
|
684
684
|
const saveDatasheets = async () => {
|
|
685
|
-
const
|
|
685
|
+
const parseBoxData = [];
|
|
686
|
+
Object.entries(boxData).forEach(([, box], index) => {
|
|
687
|
+
const { value } = box;
|
|
688
|
+
const attributesIds = Object.keys(value);
|
|
689
|
+
attributesIds.forEach((attributeId) => {
|
|
690
|
+
const boxId = index + 1;
|
|
691
|
+
const valueOfAtribute = value[attributeId];
|
|
692
|
+
parseBoxData.push({
|
|
693
|
+
attributeId,
|
|
694
|
+
value: valueOfAtribute,
|
|
695
|
+
boxId,
|
|
696
|
+
})
|
|
697
|
+
});
|
|
698
|
+
});
|
|
686
699
|
|
|
687
|
-
let fields = {}
|
|
688
|
-
let keyCount = 1;
|
|
689
|
-
|
|
690
|
-
boxData.map(e=>({
|
|
691
|
-
...e.value,
|
|
692
|
-
})).forEach((item, k) => {
|
|
693
|
-
|
|
694
|
-
for (const key in item) {
|
|
695
|
-
if (!fields[key]) {
|
|
696
|
-
fields[key] = {};
|
|
697
|
-
}
|
|
698
|
-
fields[key].box = fields[key].box || {};
|
|
699
|
-
fields[key].box[k+1] = item[key];
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
})
|
|
703
|
-
|
|
704
|
-
return fields
|
|
705
|
-
|
|
706
|
-
})()
|
|
707
|
-
setLoading(true);
|
|
708
700
|
const dataObject = {
|
|
709
701
|
articleId: product?.id_article,
|
|
710
702
|
articleData: updatedDatasheets,
|
|
711
|
-
|
|
712
|
-
};
|
|
713
|
-
|
|
703
|
+
boxData: parseBoxData,
|
|
704
|
+
};
|
|
705
|
+
|
|
714
706
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
715
707
|
try {
|
|
716
708
|
const res = await axios.put(
|