contentoh-components-library 21.4.47 → 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 -47
- 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,77 +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
|
-
|
|
1241
|
-
}
|
|
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
|
+
});
|
|
1242
1242
|
});
|
|
1243
|
-
|
|
1244
|
-
}();
|
|
1245
|
-
|
|
1246
|
-
setLoading(true);
|
|
1243
|
+
});
|
|
1247
1244
|
dataObject = {
|
|
1248
1245
|
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
1249
1246
|
articleData: updatedDatasheets,
|
|
1250
|
-
|
|
1247
|
+
boxData: parseBoxData
|
|
1251
1248
|
};
|
|
1252
|
-
console.log("boxData guardado", dataObject);
|
|
1253
1249
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1254
|
-
_context12.prev =
|
|
1255
|
-
_context12.next =
|
|
1250
|
+
_context12.prev = 4;
|
|
1251
|
+
_context12.next = 7;
|
|
1256
1252
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
1257
1253
|
headers: {
|
|
1258
1254
|
Authorization: token
|
|
1259
1255
|
}
|
|
1260
1256
|
});
|
|
1261
1257
|
|
|
1262
|
-
case
|
|
1258
|
+
case 7:
|
|
1263
1259
|
res = _context12.sent;
|
|
1264
1260
|
|
|
1265
1261
|
if (!(res.data.statusCode === 200)) {
|
|
1266
|
-
_context12.next =
|
|
1262
|
+
_context12.next = 13;
|
|
1267
1263
|
break;
|
|
1268
1264
|
}
|
|
1269
1265
|
|
|
1270
1266
|
setUpdatedDatasheets([]);
|
|
1271
1267
|
setMessage("Fichas técnicas guardadas");
|
|
1272
|
-
_context12.next =
|
|
1268
|
+
_context12.next = 13;
|
|
1273
1269
|
return loadData();
|
|
1274
1270
|
|
|
1275
|
-
case
|
|
1276
|
-
_context12.next =
|
|
1271
|
+
case 13:
|
|
1272
|
+
_context12.next = 18;
|
|
1277
1273
|
break;
|
|
1278
1274
|
|
|
1279
|
-
case
|
|
1280
|
-
_context12.prev =
|
|
1281
|
-
_context12.t0 = _context12["catch"](
|
|
1275
|
+
case 15:
|
|
1276
|
+
_context12.prev = 15;
|
|
1277
|
+
_context12.t0 = _context12["catch"](4);
|
|
1282
1278
|
console.log(_context12.t0);
|
|
1283
1279
|
|
|
1284
|
-
case
|
|
1280
|
+
case 18:
|
|
1285
1281
|
console.log(dataObject);
|
|
1286
1282
|
|
|
1287
|
-
case
|
|
1283
|
+
case 19:
|
|
1288
1284
|
case "end":
|
|
1289
1285
|
return _context12.stop();
|
|
1290
1286
|
}
|
|
1291
1287
|
}
|
|
1292
|
-
}, _callee12, null, [[
|
|
1288
|
+
}, _callee12, null, [[4, 15]]);
|
|
1293
1289
|
}));
|
|
1294
1290
|
|
|
1295
1291
|
return function saveDatasheets() {
|
|
@@ -1488,7 +1484,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1488
1484
|
};
|
|
1489
1485
|
|
|
1490
1486
|
var createComment = /*#__PURE__*/function () {
|
|
1491
|
-
var
|
|
1487
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1492
1488
|
var messages,
|
|
1493
1489
|
retailerId,
|
|
1494
1490
|
data,
|
|
@@ -1523,7 +1519,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1523
1519
|
}));
|
|
1524
1520
|
|
|
1525
1521
|
return function createComment() {
|
|
1526
|
-
return
|
|
1522
|
+
return _ref15.apply(this, arguments);
|
|
1527
1523
|
};
|
|
1528
1524
|
}();
|
|
1529
1525
|
|
|
@@ -1532,7 +1528,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1532
1528
|
}, [activeTab]);
|
|
1533
1529
|
|
|
1534
1530
|
var commentRevised = /*#__PURE__*/function () {
|
|
1535
|
-
var
|
|
1531
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1536
1532
|
var data;
|
|
1537
1533
|
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1538
1534
|
while (1) {
|
|
@@ -1560,12 +1556,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1560
1556
|
}));
|
|
1561
1557
|
|
|
1562
1558
|
return function commentRevised() {
|
|
1563
|
-
return
|
|
1559
|
+
return _ref16.apply(this, arguments);
|
|
1564
1560
|
};
|
|
1565
1561
|
}();
|
|
1566
1562
|
|
|
1567
1563
|
var setAssignation = /*#__PURE__*/function () {
|
|
1568
|
-
var
|
|
1564
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
|
|
1569
1565
|
var concept, productTemp, data;
|
|
1570
1566
|
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1571
1567
|
while (1) {
|
|
@@ -1622,7 +1618,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1622
1618
|
}));
|
|
1623
1619
|
|
|
1624
1620
|
return function setAssignation(_x4, _x5) {
|
|
1625
|
-
return
|
|
1621
|
+
return _ref17.apply(this, arguments);
|
|
1626
1622
|
};
|
|
1627
1623
|
}();
|
|
1628
1624
|
|
|
@@ -1706,7 +1702,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1706
1702
|
};
|
|
1707
1703
|
|
|
1708
1704
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1709
|
-
var
|
|
1705
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
|
|
1710
1706
|
var _productTemp$id_order2;
|
|
1711
1707
|
|
|
1712
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;
|
|
@@ -1818,12 +1814,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1818
1814
|
}));
|
|
1819
1815
|
|
|
1820
1816
|
return function sendEvaluation(_x6) {
|
|
1821
|
-
return
|
|
1817
|
+
return _ref18.apply(this, arguments);
|
|
1822
1818
|
};
|
|
1823
1819
|
}();
|
|
1824
1820
|
|
|
1825
1821
|
var validateAll = /*#__PURE__*/function () {
|
|
1826
|
-
var
|
|
1822
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
|
|
1827
1823
|
var _product$id_order2, evaluationArray, conceptArray, isAproved, retailersIds, body, userType, productTemp, status, retailerStatusCopy;
|
|
1828
1824
|
|
|
1829
1825
|
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
@@ -1909,12 +1905,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1909
1905
|
}));
|
|
1910
1906
|
|
|
1911
1907
|
return function validateAll(_x7) {
|
|
1912
|
-
return
|
|
1908
|
+
return _ref19.apply(this, arguments);
|
|
1913
1909
|
};
|
|
1914
1910
|
}();
|
|
1915
1911
|
|
|
1916
1912
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1917
|
-
var
|
|
1913
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
|
|
1918
1914
|
var data, prod, statusComplete;
|
|
1919
1915
|
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
1920
1916
|
while (1) {
|
|
@@ -1956,7 +1952,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1956
1952
|
}));
|
|
1957
1953
|
|
|
1958
1954
|
return function evaluationToRetailer(_x8) {
|
|
1959
|
-
return
|
|
1955
|
+
return _ref20.apply(this, arguments);
|
|
1960
1956
|
};
|
|
1961
1957
|
}();
|
|
1962
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
|
-
boxData.map(e => ({
|
|
690
|
-
...e.value,
|
|
691
|
-
})).forEach((item, k) => {
|
|
692
|
-
|
|
693
|
-
for (const key in item) {
|
|
694
|
-
if (!fields[key]) {
|
|
695
|
-
fields[key] = {};
|
|
696
|
-
fields[key].box = {};
|
|
697
|
-
}
|
|
698
|
-
fields[key].box[keyCount] = item[key];
|
|
699
|
-
keyCount++;
|
|
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(
|