contentoh-components-library 21.4.44 → 21.4.46

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.
Files changed (34) hide show
  1. package/dist/components/molecules/BoxAttribute/index.js +13 -4
  2. package/dist/components/molecules/BoxButtons/index.js +4 -1
  3. package/dist/components/organisms/Box/index.js +44 -7
  4. package/dist/components/organisms/BoxOnboarding/index.js +37 -48
  5. package/dist/components/organisms/InputGroup/index.js +17 -19
  6. package/dist/components/pages/ProviderProductEdition/index.js +34 -16
  7. package/package.json +1 -1
  8. package/src/components/molecules/BoxAttribute/index.js +48 -37
  9. package/src/components/molecules/BoxButtons/index.js +3 -2
  10. package/src/components/organisms/Box/index.js +71 -40
  11. package/src/components/organisms/BoxOnboarding/index.js +60 -71
  12. package/src/components/organisms/InputGroup/index.js +120 -114
  13. package/src/components/pages/ProviderProductEdition/index.js +48 -22
  14. package/src/components/pages/ProviderProductEdition/out.json +0 -0
  15. package/dist/assets/images/Icons/delete.svg +0 -8
  16. package/dist/assets/images/Icons/edit.svg +0 -3
  17. package/dist/components/molecules/ButtonsAssignation/ButtonsAssignation.stories.js +0 -34
  18. package/dist/components/molecules/ButtonsAssignation/index.js +0 -142
  19. package/dist/components/molecules/ButtonsAssignation/styles.js +0 -20
  20. package/dist/components/molecules/ButtonsEdition/ButtonsEdition.stories.js +0 -34
  21. package/dist/components/molecules/ButtonsEdition/index.js +0 -182
  22. package/dist/components/molecules/ButtonsEdition/styles.js +0 -24
  23. package/dist/components/molecules/ProductSkuStatus/ProductSkuStatus.stories.js +0 -64
  24. package/dist/components/molecules/ProductSkuStatus/index.js +0 -36
  25. package/dist/components/molecules/ProductSkuStatus/styles.js +0 -18
  26. package/dist/components/molecules/Validation/Validation.stories.js +0 -28
  27. package/dist/components/molecules/Validation/index.js +0 -77
  28. package/dist/components/molecules/Validation/styles.js +0 -18
  29. package/dist/components/organisms/BarButtons/BarButtons.stories.js +0 -30
  30. package/dist/components/organisms/BarButtons/index.js +0 -61
  31. package/dist/components/organisms/BarButtons/styles.js +0 -18
  32. package/dist/components/pages/ProviderProductEdition1/ProviderProductEdition.stories.js +0 -222
  33. package/dist/components/pages/ProviderProductEdition1/index.js +0 -2339
  34. package/dist/components/pages/ProviderProductEdition1/styles.js +0 -23
@@ -22,6 +22,7 @@ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
22
22
  var _jsxRuntime = require("react/jsx-runtime");
23
23
 
24
24
  var BoxAttribute = function BoxAttribute(props) {
25
+ // console.log({ props });
25
26
  var id = props.id,
26
27
  key = props.key,
27
28
  className = props.className,
@@ -42,7 +43,13 @@ var BoxAttribute = function BoxAttribute(props) {
42
43
  });
43
44
  };
44
45
 
45
- console.log(atributos);
46
+ var formattedData = Object.keys(atributos).reduce(function (result, id) {
47
+ result["box".concat(id)] = atributos[id];
48
+ return result;
49
+ }, {}); //escucha los cambios
50
+ // console.log(formattedData);
51
+ // console.log("atributos id", atributos[props.id]);
52
+
46
53
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
47
54
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
48
55
  id: id,
@@ -76,8 +83,9 @@ var BoxAttribute = function BoxAttribute(props) {
76
83
  onChange: handleInputChange,
77
84
  className: "caja-borde",
78
85
  variant: "outlined",
79
- size: "small"
80
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
86
+ size: "small",
87
+ type: "number"
88
+ }, props.id) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
81
89
  hiddenLabel: true,
82
90
  name: props.id,
83
91
  value: atributos[props.id],
@@ -85,8 +93,9 @@ var BoxAttribute = function BoxAttribute(props) {
85
93
  className: "caja-borde",
86
94
  variant: "outlined",
87
95
  size: "small",
96
+ type: "number",
88
97
  disabled: true
89
- })]
98
+ }, props.id)]
90
99
  }, key)
91
100
  });
92
101
  };
@@ -17,8 +17,11 @@ var BoxButtons = function BoxButtons(_ref) {
17
17
  onDelete = _ref.onDelete,
18
18
  isTheFirstBox = _ref.isTheFirstBox,
19
19
  onToggleEdit = _ref.onToggleEdit,
20
- isEditEnabled = _ref.isEditEnabled;
20
+ isEditEnabled = _ref.isEditEnabled,
21
+ index = _ref.index;
22
+ console.log("index", index);
21
23
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
24
+ index: index,
22
25
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
23
26
  variant: "outlined",
24
27
  className: "button-circle",
@@ -28,7 +28,9 @@ var _BoxButtons = require("../../molecules/BoxButtons");
28
28
  var _jsxRuntime = require("react/jsx-runtime");
29
29
 
30
30
  var Box = function Box(_ref) {
31
- var onChange = _ref.onChange;
31
+ var onChange = _ref.onChange,
32
+ dataInputs = _ref.dataInputs,
33
+ inputGroup = _ref.inputGroup;
32
34
 
33
35
  var _useState = (0, _react.useState)(true),
34
36
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -48,9 +50,41 @@ var Box = function Box(_ref) {
48
50
  boxOnboardingList = _useState6[0],
49
51
  setBoxOnboardingList = _useState6[1];
50
52
 
53
+ (0, _react.useEffect)(function () {
54
+ console.log("dataInputs:", dataInputs);
55
+ console.log("inputGroup:", inputGroup);
56
+ var temp = {};
57
+ var maxBoxId = 0;
58
+ inputGroup.inputs.forEach(function (attrId) {
59
+ if (!dataInputs[attrId].box) return;
60
+ Object.entries(dataInputs[attrId].box).forEach(function (_ref2) {
61
+ var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
62
+ boxId = _ref3[0],
63
+ value = _ref3[1];
64
+
65
+ if (boxId > maxBoxId) maxBoxId = boxId;
66
+ if (!temp[boxId]) temp[boxId] = {};
67
+ temp[boxId][attrId] = value;
68
+ });
69
+ });
70
+ var tempList = Object.values(temp);
71
+
72
+ if (tempList.length > 0) {
73
+ setBoxOnboardingList(tempList.map(function (value, index) {
74
+ return index === tempList.length - 1 ? {
75
+ showAdd: true,
76
+ value: value
77
+ } : {
78
+ value: value
79
+ };
80
+ }));
81
+ }
82
+ }, []);
83
+
51
84
  var handleAddBoxOnboarding = function handleAddBoxOnboarding() {
52
85
  var newBoxOnboarding = {
53
- showAdd: false
86
+ showAdd: false,
87
+ value: {}
54
88
  };
55
89
  setBoxOnboardingList([].concat((0, _toConsumableArray2.default)(boxOnboardingList), [newBoxOnboarding]));
56
90
  };
@@ -71,15 +105,13 @@ var Box = function Box(_ref) {
71
105
 
72
106
  (0, _react.useEffect)(function () {
73
107
  onChange && onChange(boxOnboardingList);
74
- }, [boxOnboardingList]); // console.log(atributos)
75
-
76
- console.log("onboardinglist", boxOnboardingList);
108
+ }, [boxOnboardingList]);
77
109
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
78
110
  fontFamily: _variables.FontFamily.Raleway,
79
111
  color: _variables.GlobalColors.original_magenta,
80
112
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
81
113
  fontFamily: _variables.FontFamily.Raleway,
82
- children: "Cajas"
114
+ children: inputGroup.dataGroup
83
115
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
84
116
  className: "container-box",
85
117
  children: boxOnboardingList.map(function (boxOnboarding, index) {
@@ -89,8 +121,12 @@ var Box = function Box(_ref) {
89
121
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BoxOnboarding.BoxOnboarding, {
90
122
  index: index,
91
123
  showAdd: boxOnboarding.showAdd,
124
+ data: boxOnboarding.value,
125
+ dataInputs: dataInputs,
126
+ inputs: inputGroup.inputs,
92
127
  isEditEnabled: isEditEnabled,
93
128
  onChange: function onChange(e) {
129
+ console.log("e in Box", e);
94
130
  setBoxOnboardingList(function (prev) {
95
131
  return prev.map(function (box, i) {
96
132
  if (i != index) {
@@ -104,6 +140,7 @@ var Box = function Box(_ref) {
104
140
  });
105
141
  }
106
142
  }, index), /*#__PURE__*/(0, _jsxRuntime.jsx)(_BoxButtons.BoxButtons, {
143
+ index: index,
107
144
  showAdd: boxOnboarding.showAdd,
108
145
  onAdd: handleAddBoxOnboarding,
109
146
  onDelete: function onDelete() {
@@ -112,7 +149,7 @@ var Box = function Box(_ref) {
112
149
  isDeleteDisabled: isDeleteDisabled,
113
150
  onToggleEdit: handleToggleEdit,
114
151
  isEditEnabled: isEditEnabled
115
- })]
152
+ }, index)]
116
153
  })
117
154
  });
118
155
  })
@@ -17,32 +17,41 @@ var _BoxAttribute = require("../../molecules/BoxAttribute");
17
17
 
18
18
  var _react = require("react");
19
19
 
20
+ var _lodash = require("lodash");
21
+
20
22
  var _jsxRuntime = require("react/jsx-runtime");
21
23
 
22
- var BoxOnboarding = function BoxOnboarding(_ref) {
24
+ var BoxOnboarding = /*#__PURE__*/(0, _react.memo)(function (_ref) {
23
25
  var panelColor = _ref.panelColor,
24
26
  isEditEnabled = _ref.isEditEnabled,
25
27
  index = _ref.index,
26
- onChange = _ref.onChange;
28
+ onChange = _ref.onChange,
29
+ data = _ref.data,
30
+ dataInputs = _ref.dataInputs,
31
+ inputs = _ref.inputs;
27
32
 
28
- var _useState = (0, _react.useState)(true),
33
+ var _useState = (0, _react.useState)({}),
29
34
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
30
- boxAttributesActive = _useState2[0],
31
- setBoxAttributesActive = _useState2[1];
35
+ atributos = _useState2[0],
36
+ setAtributos = _useState2[1]; // console.log("input",inputs);
37
+ //console.log("atributossss BO",atributos)
38
+
32
39
 
33
- var _useState3 = (0, _react.useState)({
34
- largo: '',
35
- alto: '',
36
- ancho: '',
37
- peso: ''
38
- }),
40
+ var _useState3 = (0, _react.useState)(true),
39
41
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
40
- atributos = _useState4[0],
41
- setAtributos = _useState4[1];
42
+ isLoading = _useState4[0],
43
+ setIsLoading = _useState4[1];
42
44
 
43
45
  (0, _react.useEffect)(function () {
46
+ console.log("atributos use", atributos);
44
47
  onChange && onChange(atributos);
45
48
  }, [atributos]);
49
+ (0, _react.useEffect)(function () {
50
+ if (isLoading && Object.keys(data).length > 0) {
51
+ setAtributos(data);
52
+ setIsLoading(false);
53
+ }
54
+ }, [data]);
46
55
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
47
56
  panelColor: panelColor,
48
57
  fontFamily: _variables.FontFamily.Raleway,
@@ -51,42 +60,22 @@ var BoxOnboarding = function BoxOnboarding(_ref) {
51
60
  id: "contenedor-caja",
52
61
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
53
62
  fontFamily: _variables.FontFamily.Raleway,
54
- children: ["Caja ", index + 1, ", chica"]
55
- }), boxAttributesActive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BoxAttribute.BoxAttribute, {
56
- id: "largo",
57
- borderType: "rectangle",
58
- className: "caja",
59
- text: "Largo",
60
- isEditEnabled: isEditEnabled,
61
- atributos: atributos.largo,
62
- setAtributos: setAtributos
63
- }), boxAttributesActive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BoxAttribute.BoxAttribute, {
64
- id: "alto",
65
- borderType: "rectangle",
66
- className: "caja",
67
- text: "Alto",
68
- isEditEnabled: isEditEnabled,
69
- atributos: atributos.alto,
70
- setAtributos: setAtributos
71
- }), boxAttributesActive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BoxAttribute.BoxAttribute, {
72
- id: "ancho",
73
- borderType: "rectangle",
74
- className: "caja",
75
- text: "Ancho",
76
- isEditEnabled: isEditEnabled,
77
- atributos: atributos.ancho,
78
- setAtributos: setAtributos
79
- }), boxAttributesActive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BoxAttribute.BoxAttribute, {
80
- id: "peso",
81
- borderType: "rectangle",
82
- className: "caja",
83
- text: "Peso",
84
- isEditEnabled: isEditEnabled,
85
- atributos: atributos.peso,
86
- setAtributos: setAtributos
63
+ children: ["Caja ", index + 1]
64
+ }), inputs.map(function (attrId) {
65
+ var _dataInputs$attrId;
66
+
67
+ console.log("data inputsss name:", atributos);
68
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BoxAttribute.BoxAttribute, {
69
+ id: attrId,
70
+ borderType: "rectangle",
71
+ className: "caja",
72
+ text: (_dataInputs$attrId = dataInputs[attrId]) === null || _dataInputs$attrId === void 0 ? void 0 : _dataInputs$attrId.name,
73
+ isEditEnabled: isEditEnabled,
74
+ atributos: atributos,
75
+ setAtributos: setAtributos
76
+ }, attrId);
87
77
  })]
88
78
  })
89
79
  });
90
- };
91
-
80
+ }, _lodash.isEqual);
92
81
  exports.BoxOnboarding = BoxOnboarding;
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.InputGroup = void 0;
9
7
 
10
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));
11
-
12
8
  var _styles = require("./styles");
13
9
 
14
10
  var _ScreenHeader = require("../../atoms/ScreenHeader");
@@ -45,11 +41,10 @@ var InputGroup = function InputGroup(_ref) {
45
41
  _ref$groupData = _ref.groupData,
46
42
  groupData = _ref$groupData === void 0 ? [] : _ref$groupData,
47
43
  isShowbox = _ref.isShowbox,
48
- index = _ref.index,
49
44
  setUpdatedBoxData = _ref.setUpdatedBoxData;
50
- console.log('groupData: ', (0, _typeof2.default)(groupData));
51
- console.log('groupData: ', groupData);
52
45
 
46
+ // console.log("groupData: ", typeof groupData);
47
+ // console.log("groupData: ", groupData);
53
48
  var inputTypeValue = function inputTypeValue(type) {
54
49
  switch (type) {
55
50
  case "Booleano":
@@ -66,13 +61,13 @@ var InputGroup = function InputGroup(_ref) {
66
61
  var isOnboarding = function isOnboarding() {
67
62
  var contentBoxAttribute = groupData.find(function (_ref2) {
68
63
  var dataGroup = _ref2.dataGroup;
69
- return dataGroup === 'Caja';
64
+ return dataGroup === "Caja";
70
65
  });
71
66
 
72
67
  if (contentBoxAttribute) {
73
- console.log('content box attribute');
68
+ console.log("content box attribute");
74
69
  } else {
75
- console.log('dont content box attribute');
70
+ console.log("dont content box attribute");
76
71
  }
77
72
 
78
73
  return contentBoxAttribute;
@@ -80,15 +75,16 @@ var InputGroup = function InputGroup(_ref) {
80
75
 
81
76
  var isEquals = function isEquals(dataInputsVal, auditInputsVal) {
82
77
  var result = dataInputsVal === auditInputsVal;
78
+ console.log("Input Val", dataInputsVal);
83
79
  return result;
84
80
  };
85
81
 
86
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
87
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
82
+ return inputGroup.groupId !== "16" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
83
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
88
84
  className: activeSection === "Ficha técnica" ? "datasheets-layout" : "descriptions-layout",
89
85
  children: [(inputGroup === null || inputGroup === void 0 ? void 0 : inputGroup.dataGroup) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
90
86
  headerType: "retailer-name-header",
91
- text: inputGroup === null || inputGroup === void 0 ? void 0 : inputGroup.dataGroup
87
+ text: "".concat(inputGroup.groupId, " - ").concat(inputGroup === null || inputGroup === void 0 ? void 0 : inputGroup.dataGroup)
92
88
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
93
89
  className: "inputs-container",
94
90
  children: inputGroup === null || inputGroup === void 0 ? void 0 : (_inputGroup$inputs = inputGroup.inputs) === null || _inputGroup$inputs === void 0 ? void 0 : _inputGroup$inputs.map(function (input, index) {
@@ -134,12 +130,14 @@ var InputGroup = function InputGroup(_ref) {
134
130
  }, index + "-" + (input === null || input === void 0 ? void 0 : input.value) + "-" + compare);
135
131
  })
136
132
  })]
137
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
138
- className: activeSection === "Ficha técnica" ? "datasheets-layout" : "descriptions-layout",
139
- children: isShowbox && isOnboarding && index == 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.Box, {
140
- onChange: setUpdatedBoxData
141
- })
142
- })]
133
+ })
134
+ }) : isShowbox && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
135
+ className: activeSection === "Ficha técnica" ? "datasheets-layout" : "descriptions-layout",
136
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.Box, {
137
+ inputGroup: inputGroup,
138
+ dataInputs: dataInputs,
139
+ onChange: setUpdatedBoxData
140
+ })
143
141
  });
144
142
  };
145
143
 
@@ -1219,58 +1219,75 @@ 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 dataObject, res;
1222
+ var inputs, 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
+ inputs = function () {
1228
+ var fields = {};
1229
+ boxData.map(function (e) {
1230
+ return (0, _objectSpread3.default)({}, e.value);
1231
+ }).forEach(function (item, k) {
1232
+ for (var key in item) {
1233
+ if (!fields[key]) {
1234
+ fields[key] = {};
1235
+ }
1236
+
1237
+ fields[key].box = fields[key].box || {};
1238
+ fields[key].box[k] = item[key];
1239
+ }
1240
+ });
1241
+ return fields;
1242
+ }();
1243
+
1227
1244
  setLoading(true);
1228
1245
  dataObject = {
1229
1246
  articleId: product === null || product === void 0 ? void 0 : product.id_article,
1230
1247
  articleData: updatedDatasheets,
1231
- boxData: boxData
1248
+ inputs: inputs
1232
1249
  };
1233
- console.log("boxData guardado", boxData);
1250
+ console.log("boxData guardado", dataObject);
1234
1251
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
1235
- _context12.prev = 4;
1236
- _context12.next = 7;
1252
+ _context12.prev = 5;
1253
+ _context12.next = 8;
1237
1254
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
1238
1255
  headers: {
1239
1256
  Authorization: token
1240
1257
  }
1241
1258
  });
1242
1259
 
1243
- case 7:
1260
+ case 8:
1244
1261
  res = _context12.sent;
1245
1262
 
1246
1263
  if (!(res.data.statusCode === 200)) {
1247
- _context12.next = 13;
1264
+ _context12.next = 14;
1248
1265
  break;
1249
1266
  }
1250
1267
 
1251
1268
  setUpdatedDatasheets([]);
1252
1269
  setMessage("Fichas técnicas guardadas");
1253
- _context12.next = 13;
1270
+ _context12.next = 14;
1254
1271
  return loadData();
1255
1272
 
1256
- case 13:
1257
- _context12.next = 18;
1273
+ case 14:
1274
+ _context12.next = 19;
1258
1275
  break;
1259
1276
 
1260
- case 15:
1261
- _context12.prev = 15;
1262
- _context12.t0 = _context12["catch"](4);
1277
+ case 16:
1278
+ _context12.prev = 16;
1279
+ _context12.t0 = _context12["catch"](5);
1263
1280
  console.log(_context12.t0);
1264
1281
 
1265
- case 18:
1282
+ case 19:
1266
1283
  console.log(dataObject);
1267
1284
 
1268
- case 19:
1285
+ case 20:
1269
1286
  case "end":
1270
1287
  return _context12.stop();
1271
1288
  }
1272
1289
  }
1273
- }, _callee12, null, [[4, 15]]);
1290
+ }, _callee12, null, [[5, 16]]);
1274
1291
  }));
1275
1292
 
1276
1293
  return function saveDatasheets() {
@@ -2213,6 +2230,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
2213
2230
  isShowbox: true,
2214
2231
  groupData: services[0][activeRetailer.id].data,
2215
2232
  setUpdatedBoxData: function setUpdatedBoxData(e) {
2233
+ console.log("UNO", e);
2216
2234
  setBoxData(e);
2217
2235
  },
2218
2236
  index: index //enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.4.44",
3
+ "version": "21.4.46",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -1,30 +1,37 @@
1
1
  import { Container } from "./styles";
2
2
  import IconInfo from "../../../assets/images/Icons/info.svg";
3
3
  import { Tooltip } from "../../atoms/Tooltip";
4
- import TextField from '@mui/material/TextField';
4
+ import TextField from "@mui/material/TextField";
5
5
 
6
6
  export const BoxAttribute = (props) => {
7
+ // console.log({ props });
7
8
  const {
8
9
  id,
9
10
  key,
10
11
  className,
11
12
  text,
12
- borderType,
13
+ borderType,
13
14
  isEditEnabled,
14
15
  titletool,
15
16
  texttool,
16
17
  atributos,
17
- setAtributos
18
+ setAtributos,
18
19
  } = props;
19
20
  const handleInputChange = (event) => {
20
- const { name, value } = event.target;
21
+ const { name, value } = event.target;
21
22
  setAtributos((prevAtributos) => ({
22
23
  ...prevAtributos,
23
- [name]: value,
24
+ [name]: value,
24
25
  }));
25
26
  };
26
- console.log(atributos)
27
27
 
28
+ const formattedData = Object.keys(atributos).reduce((result, id) => {
29
+ result[`box${id}`] = atributos[id];
30
+ return result;
31
+ }, {});
32
+ //escucha los cambios
33
+ // console.log(formattedData);
34
+ // console.log("atributos id", atributos[props.id]);
28
35
  return (
29
36
  <>
30
37
  <Container
@@ -33,45 +40,49 @@ export const BoxAttribute = (props) => {
33
40
  className={className}
34
41
  borderType={borderType}
35
42
  >
36
- <Tooltip
37
- componentTooltip={
38
- <>
39
- <p>
40
- <b>{titletool}</b>
41
- </p>
42
- <p>{texttool}</p>
43
- </>
44
- }
45
- children={
46
- <Container className="">
47
- <img className="icon" src={IconInfo} alt="iconInfo" />
48
- </Container>
49
- }
50
- classNameTooltip={"container-tooltip"}
51
- />
52
- <span>{text}</span>
53
- {isEditEnabled ? (
54
- <TextField
43
+ <Tooltip
44
+ componentTooltip={
45
+ <>
46
+ <p>
47
+ <b>{titletool}</b>
48
+ </p>
49
+ <p>{texttool}</p>
50
+ </>
51
+ }
52
+ children={
53
+ <Container className="">
54
+ <img className="icon" src={IconInfo} alt="iconInfo" />
55
+ </Container>
56
+ }
57
+ classNameTooltip={"container-tooltip"}
58
+ />
59
+ <span>{text}</span>
60
+ {isEditEnabled ? (
61
+ <TextField
55
62
  hiddenLabel
56
- name={props.id}
63
+ key={props.id}
64
+ name={props.id}
57
65
  value={atributos[props.id]}
58
66
  onChange={handleInputChange}
59
67
  className="caja-borde"
60
68
  variant="outlined"
61
69
  size="small"
70
+ type="number"
62
71
  />
63
- ) : (
64
- <TextField
65
- hiddenLabel
66
- name={props.id}
67
- value={atributos[props.id]}
68
- onChange={handleInputChange}
69
- className="caja-borde"
70
- variant="outlined"
71
- size="small"
72
- disabled
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
73
84
  />
74
- )}
85
+ )}
75
86
  </Container>
76
87
  </>
77
88
  );
@@ -1,9 +1,10 @@
1
1
  import { Container, ContainerIcon } from "./styles";
2
2
  import { Button } from "@mui/material";
3
3
 
4
- export const BoxButtons = ({ showAdd, onAdd, onDelete, isTheFirstBox, onToggleEdit, isEditEnabled }) => {
4
+ export const BoxButtons = ({ showAdd, onAdd, onDelete, isTheFirstBox, onToggleEdit, isEditEnabled, index }) => {
5
+ console.log("index",index)
5
6
  return (
6
- <Container>
7
+ <Container index={index}>
7
8
  <Button variant="outlined" className="button-circle" onClick={onToggleEdit}>
8
9
  <ContainerIcon>
9
10
  <span className={`iconos-out ${isEditEnabled ? "iconos-grises" : ""}`}>edit</span>