contentoh-components-library 21.1.15 → 21.1.19
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/atoms/GeneralInput/index.js +12 -8
- package/dist/components/pages/ProviderProductEdition/index.js +1 -1
- package/dist/components/pages/RetailerProductEdition/index.js +10 -9
- package/package.json +1 -1
- package/src/components/atoms/GeneralInput/index.js +13 -15
- package/src/components/pages/ProviderProductEdition/index.js +1 -1
- package/src/components/pages/RetailerProductEdition/index.js +1 -0
|
@@ -60,15 +60,20 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
60
60
|
value: validateInput(evt, position, inputsArray)
|
|
61
61
|
});
|
|
62
62
|
} else if (updatedDatasheets || updatedDescriptions || inputType === "textarea") {
|
|
63
|
+
var generalValue;
|
|
64
|
+
|
|
63
65
|
if ((optionList === null || optionList === void 0 ? void 0 : optionList.length) > 0) {
|
|
64
66
|
var index = evt.target.selectedIndex;
|
|
65
67
|
var valueSelected = evt.target.value;
|
|
68
|
+
console.log(valueSelected);
|
|
69
|
+
generalValue = valueSelected;
|
|
66
70
|
setTextValue({
|
|
67
|
-
value:
|
|
71
|
+
value: generalValue
|
|
68
72
|
});
|
|
69
73
|
} else {
|
|
74
|
+
generalValue = inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
70
75
|
setTextValue({
|
|
71
|
-
value:
|
|
76
|
+
value: generalValue
|
|
72
77
|
});
|
|
73
78
|
}
|
|
74
79
|
|
|
@@ -77,13 +82,13 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
77
82
|
articleId: articleId,
|
|
78
83
|
versionId: version,
|
|
79
84
|
attributeId: inputId,
|
|
80
|
-
value:
|
|
85
|
+
value: generalValue
|
|
81
86
|
});else if (dataSave.some(function (e) {
|
|
82
87
|
return e.attributeId === inputId;
|
|
83
88
|
})) {
|
|
84
89
|
dataSave.forEach(function (e) {
|
|
85
90
|
if (e.attributeId === inputId) {
|
|
86
|
-
e.value =
|
|
91
|
+
e.value = generalValue;
|
|
87
92
|
}
|
|
88
93
|
});
|
|
89
94
|
} else {
|
|
@@ -91,7 +96,7 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
91
96
|
articleId: articleId,
|
|
92
97
|
versionId: version,
|
|
93
98
|
attributeId: inputId,
|
|
94
|
-
value:
|
|
99
|
+
value: generalValue
|
|
95
100
|
});
|
|
96
101
|
}
|
|
97
102
|
setUpdatedDatasheets(dataSave);
|
|
@@ -111,18 +116,17 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
111
116
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
112
117
|
isRequired: requiredEmpty,
|
|
113
118
|
children: [(optionList === null || optionList === void 0 ? void 0 : optionList.length) > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
|
|
114
|
-
id: "dropdown".concat(inputId)
|
|
115
|
-
,
|
|
119
|
+
id: "dropdown".concat(inputId),
|
|
116
120
|
onChange: function onChange(e) {
|
|
117
121
|
return onHandleChange(e);
|
|
118
122
|
},
|
|
123
|
+
defaultValue: textValue.value,
|
|
119
124
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
120
125
|
value: "",
|
|
121
126
|
children: description
|
|
122
127
|
}), JSON.parse(optionList || "[]").map(function (element, index) {
|
|
123
128
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
124
129
|
value: element,
|
|
125
|
-
defaultValue: element === textValue.value ? "selected" : "",
|
|
126
130
|
children: element
|
|
127
131
|
}, element + "-" + index);
|
|
128
132
|
})]
|
|
@@ -482,7 +482,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
482
482
|
getServices();
|
|
483
483
|
|
|
484
484
|
if (!originProp) {
|
|
485
|
-
setActiveRetailer(product.retailers[0] || product.
|
|
485
|
+
setActiveRetailer(product.retailers[0] || product.retailersAvailable[0]);
|
|
486
486
|
} //setActiveRetailer(product?.retailers[0]);
|
|
487
487
|
|
|
488
488
|
|
|
@@ -753,16 +753,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
753
753
|
articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
|
|
754
754
|
articleData: updatedDatasheets
|
|
755
755
|
};
|
|
756
|
+
console.log(updatedDatasheets, "updatedDatasheets");
|
|
756
757
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
757
|
-
_context6.prev =
|
|
758
|
-
_context6.next =
|
|
758
|
+
_context6.prev = 5;
|
|
759
|
+
_context6.next = 8;
|
|
759
760
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
760
761
|
headers: {
|
|
761
762
|
Authorization: token
|
|
762
763
|
}
|
|
763
764
|
});
|
|
764
765
|
|
|
765
|
-
case
|
|
766
|
+
case 8:
|
|
766
767
|
setMessage("Fichas técnicas guardadas");
|
|
767
768
|
|
|
768
769
|
if (productTemp.status === "ASSIGNED") {
|
|
@@ -772,20 +773,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
772
773
|
}
|
|
773
774
|
|
|
774
775
|
loadData();
|
|
775
|
-
_context6.next =
|
|
776
|
+
_context6.next = 16;
|
|
776
777
|
break;
|
|
777
778
|
|
|
778
|
-
case
|
|
779
|
-
_context6.prev =
|
|
780
|
-
_context6.t0 = _context6["catch"](
|
|
779
|
+
case 13:
|
|
780
|
+
_context6.prev = 13;
|
|
781
|
+
_context6.t0 = _context6["catch"](5);
|
|
781
782
|
console.log(_context6.t0);
|
|
782
783
|
|
|
783
|
-
case
|
|
784
|
+
case 16:
|
|
784
785
|
case "end":
|
|
785
786
|
return _context6.stop();
|
|
786
787
|
}
|
|
787
788
|
}
|
|
788
|
-
}, _callee6, null, [[
|
|
789
|
+
}, _callee6, null, [[5, 13]]);
|
|
789
790
|
}));
|
|
790
791
|
|
|
791
792
|
return function saveDatasheets() {
|
package/package.json
CHANGED
|
@@ -38,30 +38,33 @@ export const GeneralInput = ({
|
|
|
38
38
|
updatedDescriptions ||
|
|
39
39
|
inputType === "textarea"
|
|
40
40
|
) {
|
|
41
|
+
let generalValue;
|
|
41
42
|
if (optionList?.length > 0) {
|
|
42
43
|
let index = evt.target.selectedIndex;
|
|
43
44
|
let valueSelected = evt.target.value;
|
|
44
|
-
|
|
45
|
+
console.log(valueSelected);
|
|
46
|
+
generalValue = valueSelected;
|
|
47
|
+
setTextValue({ value: generalValue });
|
|
45
48
|
} else {
|
|
49
|
+
generalValue =
|
|
50
|
+
inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
46
51
|
setTextValue({
|
|
47
|
-
value:
|
|
48
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
52
|
+
value: generalValue,
|
|
49
53
|
});
|
|
50
54
|
}
|
|
51
55
|
let dataSave = updatedDatasheets?.slice();
|
|
56
|
+
|
|
52
57
|
if (dataSave.length === 0)
|
|
53
58
|
dataSave.push({
|
|
54
59
|
articleId: articleId,
|
|
55
60
|
versionId: version,
|
|
56
61
|
attributeId: inputId,
|
|
57
|
-
value:
|
|
58
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
62
|
+
value: generalValue,
|
|
59
63
|
});
|
|
60
64
|
else if (dataSave.some((e) => e.attributeId === inputId)) {
|
|
61
65
|
dataSave.forEach((e) => {
|
|
62
66
|
if (e.attributeId === inputId) {
|
|
63
|
-
e.value =
|
|
64
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
67
|
+
e.value = generalValue;
|
|
65
68
|
}
|
|
66
69
|
});
|
|
67
70
|
} else {
|
|
@@ -69,8 +72,7 @@ export const GeneralInput = ({
|
|
|
69
72
|
articleId: articleId,
|
|
70
73
|
versionId: version,
|
|
71
74
|
attributeId: inputId,
|
|
72
|
-
value:
|
|
73
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
75
|
+
value: generalValue,
|
|
74
76
|
});
|
|
75
77
|
}
|
|
76
78
|
setUpdatedDatasheets(dataSave);
|
|
@@ -93,16 +95,12 @@ export const GeneralInput = ({
|
|
|
93
95
|
<select
|
|
94
96
|
key={`dropdownK${inputId}`}
|
|
95
97
|
id={`dropdown${inputId}`}
|
|
96
|
-
//disabled={!enableInputs}
|
|
97
98
|
onChange={(e) => onHandleChange(e)}
|
|
99
|
+
defaultValue={textValue.value}
|
|
98
100
|
>
|
|
99
101
|
<option value="">{description}</option>
|
|
100
102
|
{JSON.parse(optionList || "[]").map((element, index) => (
|
|
101
|
-
<option
|
|
102
|
-
key={element + "-" + index}
|
|
103
|
-
value={element}
|
|
104
|
-
defaultValue={element === textValue.value ? "selected" : ""}
|
|
105
|
-
>
|
|
103
|
+
<option key={element + "-" + index} value={element}>
|
|
106
104
|
{element}
|
|
107
105
|
</option>
|
|
108
106
|
))}
|
|
@@ -218,7 +218,7 @@ export const ProviderProductEdition = ({
|
|
|
218
218
|
getServices();
|
|
219
219
|
|
|
220
220
|
if (!originProp) {
|
|
221
|
-
setActiveRetailer(product.retailers[0] || product.
|
|
221
|
+
setActiveRetailer(product.retailers[0] || product.retailersAvailable[0]);
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
//setActiveRetailer(product?.retailers[0]);
|
|
@@ -424,6 +424,7 @@ export const RetailerProductEdition = ({
|
|
|
424
424
|
articleId: product?.article?.id_article,
|
|
425
425
|
articleData: updatedDatasheets,
|
|
426
426
|
};
|
|
427
|
+
console.log(updatedDatasheets, "updatedDatasheets");
|
|
427
428
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
428
429
|
try {
|
|
429
430
|
await axios.put(
|