contentoh-components-library 21.4.48 → 21.4.50

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.
@@ -28,11 +28,10 @@ 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
- titletool = props.titletool,
33
- texttool = props.texttool,
34
31
  atributos = props.atributos,
35
- setAtributos = props.setAtributos;
32
+ setAtributos = props.setAtributos,
33
+ required = props.required,
34
+ description = props.description;
36
35
 
37
36
  var handleInputChange = function handleInputChange(event) {
38
37
  var _event$target = event.target,
@@ -46,7 +45,8 @@ var BoxAttribute = function BoxAttribute(props) {
46
45
  var formattedData = Object.keys(atributos).reduce(function (result, id) {
47
46
  result["box".concat(id)] = atributos[id];
48
47
  return result;
49
- }, {}); //escucha los cambios
48
+ }, {});
49
+ console.log("description", description); //escucha los cambios
50
50
  // console.log(formattedData);
51
51
  // console.log("atributos id", atributos[props.id]);
52
52
 
@@ -56,14 +56,11 @@ var BoxAttribute = function BoxAttribute(props) {
56
56
  className: className,
57
57
  borderType: borderType,
58
58
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.Tooltip, {
59
- componentTooltip: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
60
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
61
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("b", {
62
- children: titletool
63
- })
64
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
65
- children: texttool
66
- })]
59
+ componentTooltip: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
60
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
61
+ className: "tooltip-content",
62
+ children: description
63
+ })
67
64
  }),
68
65
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
69
66
  className: "",
@@ -74,18 +71,12 @@ var BoxAttribute = function BoxAttribute(props) {
74
71
  })
75
72
  }),
76
73
  classNameTooltip: "container-tooltip"
77
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
78
- children: text
79
- }), isEditEnabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
80
- hiddenLabel: true,
81
- name: props.id,
82
- value: atributos[props.id],
83
- onChange: handleInputChange,
84
- className: "caja-borde",
85
- variant: "outlined",
86
- size: "small",
87
- type: "number"
88
- }, props.id) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
74
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
75
+ children: [text, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
76
+ className: required ? 'required-text' : '',
77
+ children: required ? '*' : ''
78
+ })]
79
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
89
80
  hiddenLabel: true,
90
81
  name: props.id,
91
82
  value: atributos[props.id],
@@ -94,7 +85,7 @@ var BoxAttribute = function BoxAttribute(props) {
94
85
  variant: "outlined",
95
86
  size: "small",
96
87
  type: "number",
97
- disabled: true
88
+ required: required
98
89
  }, props.id)]
99
90
  }, key)
100
91
  });
@@ -15,9 +15,11 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n gap:4px;\n #atr-alto {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .caja-borde {\n font-family: ", ", sans-serif;\n font-size: 12px;\n line-height: 1.2;\n border-radius: ", ";\n }\n span {\n font-family: ", ", sans-serif;\n font-size: 12px;\n line-height: 1.2;\n font-weight: 600;\n }\n .icon {\n width: 8px;\n height: 8px;\n }\n"])), _variables.FontFamily.RobotoMedium, function (_ref) {
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n gap:4px;\n #atr-alto {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .caja-borde {\n font-family: ", ", sans-serif;\n font-size: 12px;\n line-height: 1.2;\n border-radius: ", ";\n }\n span {\n font-family: ", ", sans-serif;\n font-size: 12px;\n line-height: 1.2;\n font-weight: 600;\n }\n .icon {\n width: 8px;\n height: 8px;\n }\n .required-text {\n color: red;\n }\n\n .container-tooltip{\n background-color: ", ";\n width: fit-content;\n height: 27px;\n padding: 4px;\n border-radius: 15px;\n font-family: ", ";\n font-weight: 600;\n font-size: 14px;\n line-height: 19px;\n color: ", ";\n }\n \n"])), _variables.FontFamily.RobotoMedium, function (_ref) {
19
19
  var borderType = _ref.borderType;
20
20
  return (borderType === null || borderType === void 0 ? void 0 : borderType.toLowerCase()) === "rectangle" ? "5px" : (borderType === null || borderType === void 0 ? void 0 : borderType.toLowerCase()) === "circle" ? "50%" : "none";
21
- }, _variables.FontFamily.RobotoMedium);
21
+ }, _variables.FontFamily.RobotoMedium, _variables.GlobalColors.s3, _variables.FontFamily.AvenirNext, function (backgroundColor) {
22
+ return backgroundColor === "s2" || backgroundColor === "s1" ? _variables.GlobalColors.s4 : _variables.GlobalColors.white;
23
+ });
22
24
 
23
25
  exports.Container = Container;
@@ -16,23 +16,10 @@ var BoxButtons = function BoxButtons(_ref) {
16
16
  onAdd = _ref.onAdd,
17
17
  onDelete = _ref.onDelete,
18
18
  isTheFirstBox = _ref.isTheFirstBox,
19
- onToggleEdit = _ref.onToggleEdit,
20
- isEditEnabled = _ref.isEditEnabled,
21
19
  index = _ref.index;
22
- console.log("index", index);
23
20
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
24
21
  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, {
22
+ children: [!isTheFirstBox && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
36
23
  variant: "outlined",
37
24
  className: "button-circle",
38
25
  onClick: onDelete,
@@ -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]; // console.log("input",inputs);
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 () {
@@ -62,15 +58,15 @@ var BoxOnboarding = /*#__PURE__*/(0, _react.memo)(function (_ref) {
62
58
  fontFamily: _variables.FontFamily.Raleway,
63
59
  children: ["Caja ", index + 1]
64
60
  }), inputs.map(function (attrId) {
65
- var _dataInputs$attrId;
61
+ var _dataInputs$attrId, _dataInputs$attrId2, _dataInputs$attrId3;
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,
68
+ required: (_dataInputs$attrId2 = dataInputs[attrId]) === null || _dataInputs$attrId2 === void 0 ? void 0 : _dataInputs$attrId2.required,
69
+ description: (_dataInputs$attrId3 = dataInputs[attrId]) === null || _dataInputs$attrId3 === void 0 ? void 0 : _dataInputs$attrId3.description,
74
70
  atributos: atributos,
75
71
  setAtributos: setAtributos
76
72
  }, 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":
@@ -75,7 +73,6 @@ var InputGroup = function InputGroup(_ref) {
75
73
 
76
74
  var isEquals = function isEquals(dataInputsVal, auditInputsVal) {
77
75
  var result = dataInputsVal === auditInputsVal;
78
- console.log("Input Val", dataInputsVal);
79
76
  return result;
80
77
  };
81
78
 
@@ -84,7 +81,7 @@ var InputGroup = function InputGroup(_ref) {
84
81
  className: activeSection === "Ficha técnica" ? "datasheets-layout" : "descriptions-layout",
85
82
  children: [(inputGroup === null || inputGroup === void 0 ? void 0 : inputGroup.dataGroup) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
86
83
  headerType: "retailer-name-header",
87
- text: "".concat(inputGroup.groupId, " - ").concat(inputGroup === null || inputGroup === void 0 ? void 0 : inputGroup.dataGroup)
84
+ text: "".concat(inputGroup === null || inputGroup === void 0 ? void 0 : inputGroup.dataGroup)
88
85
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
89
86
  className: "inputs-container",
90
87
  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) {
@@ -1090,7 +1090,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1090
1090
 
1091
1091
  if ((_services$0$activeRet = services[0][activeRetailer.id]) !== null && _services$0$activeRet !== void 0 && _services$0$activeRet.data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
1092
1092
  setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
1093
- console.log("loadInputs: ", services[0]);
1094
1093
  var datagroups = services[0][activeRetailer.id];
1095
1094
  var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
1096
1095
 
@@ -1219,76 +1218,73 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1219
1218
 
1220
1219
  var saveDatasheets = /*#__PURE__*/function () {
1221
1220
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1222
- var inputs, dataObject, res;
1221
+ var parseBoxData, dataObject, res;
1223
1222
  return _regenerator.default.wrap(function _callee12$(_context12) {
1224
1223
  while (1) {
1225
1224
  switch (_context12.prev = _context12.next) {
1226
1225
  case 0:
1227
- inputs = function () {
1228
- var fields = {};
1229
- var keyCount = 1;
1230
- boxData.map(function (e) {
1231
- return (0, _objectSpread3.default)({}, e.value);
1232
- }).forEach(function (item, k) {
1233
- for (var key in item) {
1234
- if (!fields[key]) {
1235
- fields[key] = {};
1236
- }
1237
-
1238
- fields[key].box = fields[key].box || {};
1239
- fields[key].box[k + 1] = item[key];
1240
- }
1226
+ parseBoxData = [];
1227
+ Object.entries(boxData).forEach(function (_ref11, index) {
1228
+ var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
1229
+ box = _ref12[1];
1230
+
1231
+ var value = box.value;
1232
+ var attributesIds = Object.keys(value);
1233
+ attributesIds.forEach(function (attributeId) {
1234
+ var boxId = index + 1;
1235
+ var valueOfAtribute = value[attributeId];
1236
+ parseBoxData.push({
1237
+ attributeId: attributeId,
1238
+ value: valueOfAtribute,
1239
+ boxId: boxId
1240
+ });
1241
1241
  });
1242
- return fields;
1243
- }();
1244
-
1245
- setLoading(true);
1242
+ });
1246
1243
  dataObject = {
1247
1244
  articleId: product === null || product === void 0 ? void 0 : product.id_article,
1248
1245
  articleData: updatedDatasheets,
1249
- inputs: inputs
1246
+ boxData: parseBoxData
1250
1247
  };
1251
- console.log("boxData guardado", dataObject);
1252
1248
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
1253
- _context12.prev = 5;
1254
- _context12.next = 8;
1249
+ _context12.prev = 4;
1250
+ _context12.next = 7;
1255
1251
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
1256
1252
  headers: {
1257
1253
  Authorization: token
1258
1254
  }
1259
1255
  });
1260
1256
 
1261
- case 8:
1257
+ case 7:
1262
1258
  res = _context12.sent;
1263
1259
 
1264
1260
  if (!(res.data.statusCode === 200)) {
1265
- _context12.next = 14;
1261
+ _context12.next = 13;
1266
1262
  break;
1267
1263
  }
1268
1264
 
1269
1265
  setUpdatedDatasheets([]);
1270
1266
  setMessage("Fichas técnicas guardadas");
1271
- _context12.next = 14;
1267
+ _context12.next = 13;
1272
1268
  return loadData();
1273
1269
 
1274
- case 14:
1275
- _context12.next = 19;
1270
+ case 13:
1271
+ _context12.next = 18;
1276
1272
  break;
1277
1273
 
1278
- case 16:
1279
- _context12.prev = 16;
1280
- _context12.t0 = _context12["catch"](5);
1274
+ case 15:
1275
+ _context12.prev = 15;
1276
+ _context12.t0 = _context12["catch"](4);
1281
1277
  console.log(_context12.t0);
1282
1278
 
1283
- case 19:
1279
+ case 18:
1284
1280
  console.log(dataObject);
1285
1281
 
1286
- case 20:
1282
+ case 19:
1287
1283
  case "end":
1288
1284
  return _context12.stop();
1289
1285
  }
1290
1286
  }
1291
- }, _callee12, null, [[5, 16]]);
1287
+ }, _callee12, null, [[4, 15]]);
1292
1288
  }));
1293
1289
 
1294
1290
  return function saveDatasheets() {
@@ -1487,7 +1483,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1487
1483
  };
1488
1484
 
1489
1485
  var createComment = /*#__PURE__*/function () {
1490
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1486
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1491
1487
  var messages,
1492
1488
  retailerId,
1493
1489
  data,
@@ -1522,7 +1518,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1522
1518
  }));
1523
1519
 
1524
1520
  return function createComment() {
1525
- return _ref13.apply(this, arguments);
1521
+ return _ref15.apply(this, arguments);
1526
1522
  };
1527
1523
  }();
1528
1524
 
@@ -1531,7 +1527,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1531
1527
  }, [activeTab]);
1532
1528
 
1533
1529
  var commentRevised = /*#__PURE__*/function () {
1534
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1530
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1535
1531
  var data;
1536
1532
  return _regenerator.default.wrap(function _callee16$(_context16) {
1537
1533
  while (1) {
@@ -1559,12 +1555,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1559
1555
  }));
1560
1556
 
1561
1557
  return function commentRevised() {
1562
- return _ref14.apply(this, arguments);
1558
+ return _ref16.apply(this, arguments);
1563
1559
  };
1564
1560
  }();
1565
1561
 
1566
1562
  var setAssignation = /*#__PURE__*/function () {
1567
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
1563
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
1568
1564
  var concept, productTemp, data;
1569
1565
  return _regenerator.default.wrap(function _callee17$(_context17) {
1570
1566
  while (1) {
@@ -1621,7 +1617,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1621
1617
  }));
1622
1618
 
1623
1619
  return function setAssignation(_x4, _x5) {
1624
- return _ref15.apply(this, arguments);
1620
+ return _ref17.apply(this, arguments);
1625
1621
  };
1626
1622
  }();
1627
1623
 
@@ -1705,7 +1701,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1705
1701
  };
1706
1702
 
1707
1703
  var sendEvaluation = /*#__PURE__*/function () {
1708
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
1704
+ var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
1709
1705
  var _productTemp$id_order2;
1710
1706
 
1711
1707
  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 +1813,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1817
1813
  }));
1818
1814
 
1819
1815
  return function sendEvaluation(_x6) {
1820
- return _ref16.apply(this, arguments);
1816
+ return _ref18.apply(this, arguments);
1821
1817
  };
1822
1818
  }();
1823
1819
 
1824
1820
  var validateAll = /*#__PURE__*/function () {
1825
- var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
1821
+ var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
1826
1822
  var _product$id_order2, evaluationArray, conceptArray, isAproved, retailersIds, body, userType, productTemp, status, retailerStatusCopy;
1827
1823
 
1828
1824
  return _regenerator.default.wrap(function _callee19$(_context19) {
@@ -1908,12 +1904,12 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1908
1904
  }));
1909
1905
 
1910
1906
  return function validateAll(_x7) {
1911
- return _ref17.apply(this, arguments);
1907
+ return _ref19.apply(this, arguments);
1912
1908
  };
1913
1909
  }();
1914
1910
 
1915
1911
  var evaluationToRetailer = /*#__PURE__*/function () {
1916
- var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
1912
+ var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
1917
1913
  var data, prod, statusComplete;
1918
1914
  return _regenerator.default.wrap(function _callee20$(_context20) {
1919
1915
  while (1) {
@@ -1955,7 +1951,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1955
1951
  }));
1956
1952
 
1957
1953
  return function evaluationToRetailer(_x8) {
1958
- return _ref18.apply(this, arguments);
1954
+ return _ref20.apply(this, arguments);
1959
1955
  };
1960
1956
  }();
1961
1957
 
@@ -2231,7 +2227,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
2231
2227
  isShowbox: true,
2232
2228
  groupData: services[0][activeRetailer.id].data,
2233
2229
  setUpdatedBoxData: function setUpdatedBoxData(e) {
2234
- console.log("UNO", e);
2235
2230
  setBoxData(e);
2236
2231
  },
2237
2232
  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.48",
3
+ "version": "21.4.50",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -11,11 +11,10 @@ export const BoxAttribute = (props) => {
11
11
  className,
12
12
  text,
13
13
  borderType,
14
- isEditEnabled,
15
- titletool,
16
- texttool,
17
14
  atributos,
18
15
  setAtributos,
16
+ required,
17
+ description,
19
18
  } = props;
20
19
  const handleInputChange = (event) => {
21
20
  const { name, value } = event.target;
@@ -29,6 +28,7 @@ export const BoxAttribute = (props) => {
29
28
  result[`box${id}`] = atributos[id];
30
29
  return result;
31
30
  }, {});
31
+ console.log("description",description)
32
32
  //escucha los cambios
33
33
  // console.log(formattedData);
34
34
  // console.log("atributos id", atributos[props.id]);
@@ -43,10 +43,7 @@ export const BoxAttribute = (props) => {
43
43
  <Tooltip
44
44
  componentTooltip={
45
45
  <>
46
- <p>
47
- <b>{titletool}</b>
48
- </p>
49
- <p>{texttool}</p>
46
+ <p className="tooltip-content">{description}</p>
50
47
  </>
51
48
  }
52
49
  children={
@@ -56,8 +53,7 @@ export const BoxAttribute = (props) => {
56
53
  }
57
54
  classNameTooltip={"container-tooltip"}
58
55
  />
59
- <span>{text}</span>
60
- {isEditEnabled ? (
56
+ <span>{text}<span className={required ? 'required-text' : ''}>{required ? '*' : ''}</span></span>
61
57
  <TextField
62
58
  hiddenLabel
63
59
  key={props.id}
@@ -68,21 +64,8 @@ export const BoxAttribute = (props) => {
68
64
  variant="outlined"
69
65
  size="small"
70
66
  type="number"
67
+ required={required}
71
68
  />
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
69
  </Container>
87
70
  </>
88
71
  );
@@ -32,4 +32,24 @@ export const Container = styled.div`
32
32
  width: 8px;
33
33
  height: 8px;
34
34
  }
35
+ .required-text {
36
+ color: red;
37
+ }
38
+
39
+ .container-tooltip{
40
+ background-color: ${GlobalColors.s3};
41
+ width: fit-content;
42
+ height: 27px;
43
+ padding: 4px;
44
+ border-radius: 15px;
45
+ font-family: ${FontFamily.AvenirNext};
46
+ font-weight: 600;
47
+ font-size: 14px;
48
+ line-height: 19px;
49
+ color: ${(backgroundColor) =>
50
+ backgroundColor === "s2" || backgroundColor === "s1"
51
+ ? GlobalColors.s4
52
+ : GlobalColors.white};
53
+ }
54
+
35
55
  `;
@@ -1,15 +1,14 @@
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, index }) => {
5
- console.log("index",index)
4
+ export const BoxButtons = ({ showAdd, onAdd, onDelete, isTheFirstBox, index }) => {
6
5
  return (
7
6
  <Container index={index}>
8
- <Button variant="outlined" className="button-circle" onClick={onToggleEdit}>
7
+ {/* <Button variant="outlined" className="button-circle" onClick={onToggleEdit}>
9
8
  <ContainerIcon>
10
9
  <span className={`iconos-out ${isEditEnabled ? "iconos-grises" : ""}`}>edit</span>
11
10
  </ContainerIcon>
12
- </Button>
11
+ </Button> */}
13
12
  {!isTheFirstBox && (
14
13
  <Button
15
14
  variant="outlined"
@@ -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,8 @@ export const BoxOnboarding = memo(
49
44
  borderType="rectangle"
50
45
  className="caja"
51
46
  text={dataInputs[attrId]?.name}
52
- isEditEnabled={isEditEnabled}
47
+ required={dataInputs[attrId]?.required}
48
+ description={dataInputs[attrId]?.description}
53
49
  atributos={atributos}
54
50
  setAtributos={setAtributos}
55
51
  />
@@ -23,8 +23,6 @@ export const InputGroup = ({
23
23
  isShowbox,
24
24
  setUpdatedBoxData
25
25
  }) => {
26
- // console.log("groupData: ", typeof groupData);
27
- // console.log("groupData: ", groupData);
28
26
  const inputTypeValue = (type) => {
29
27
  switch (type) {
30
28
  case "Booleano":
@@ -50,7 +48,6 @@ export const InputGroup = ({
50
48
 
51
49
  const isEquals = (dataInputsVal, auditInputsVal) => {
52
50
  const result = dataInputsVal === auditInputsVal;
53
- console.log("Input Val",dataInputsVal)
54
51
  return result;
55
52
  };
56
53
  return inputGroup.groupId !== "16" ? (
@@ -65,7 +62,7 @@ export const InputGroup = ({
65
62
  {inputGroup?.dataGroup && (
66
63
  <ScreenHeader
67
64
  headerType={"retailer-name-header"}
68
- text={`${inputGroup.groupId} - ${inputGroup?.dataGroup}`}
65
+ text={`${inputGroup?.dataGroup}`}
69
66
  />
70
67
  )}
71
68
  <div className="inputs-container">
@@ -598,7 +598,6 @@ export const ProviderProductEdition = ({
598
598
  );
599
599
  setActivePercentage(Math.round(activeRetailer?.percentage, 0));
600
600
 
601
- console.log("loadInputs: ", services[0]);
602
601
  const datagroups = services[0][activeRetailer.id];
603
602
  const inputs = services[0]?.inputs;
604
603
  const descriptions = services[1]?.filter(
@@ -682,35 +681,27 @@ export const ProviderProductEdition = ({
682
681
  };
683
682
 
684
683
  const saveDatasheets = async () => {
685
- const inputs = (() => {
684
+ const parseBoxData = [];
685
+ Object.entries(boxData).forEach(([, box], index) => {
686
+ const { value } = box;
687
+ const attributesIds = Object.keys(value);
688
+ attributesIds.forEach((attributeId) => {
689
+ const boxId = index + 1;
690
+ const valueOfAtribute = value[attributeId];
691
+ parseBoxData.push({
692
+ attributeId,
693
+ value: valueOfAtribute,
694
+ boxId,
695
+ })
696
+ });
697
+ });
686
698
 
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
699
  const dataObject = {
709
700
  articleId: product?.id_article,
710
701
  articleData: updatedDatasheets,
711
- inputs
712
- };
713
- console.log("boxData guardado", dataObject);
702
+ boxData: parseBoxData,
703
+ };
704
+
714
705
  if (product?.orderId) dataObject["orderId"] = product?.orderId;
715
706
  try {
716
707
  const res = await axios.put(
@@ -1495,7 +1486,6 @@ export const ProviderProductEdition = ({
1495
1486
  isShowbox={true}
1496
1487
  groupData={services[0][activeRetailer.id].data}
1497
1488
  setUpdatedBoxData={(e) => {
1498
- console.log("UNO",e);
1499
1489
  setBoxData(e);
1500
1490
  }}
1501
1491
  index={index}