contentoh-components-library 21.1.14 → 21.1.18
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 +22 -10
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +35 -41
- package/dist/components/pages/RetailerProductEdition/index.js +10 -9
- package/package.json +1 -1
- package/src/components/atoms/GeneralInput/index.js +21 -18
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +36 -42
- package/src/components/pages/RetailerProductEdition/index.js +1 -0
|
@@ -60,21 +60,35 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
60
60
|
value: validateInput(evt, position, inputsArray)
|
|
61
61
|
});
|
|
62
62
|
} else if (updatedDatasheets || updatedDescriptions || inputType === "textarea") {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
var generalValue;
|
|
64
|
+
|
|
65
|
+
if ((optionList === null || optionList === void 0 ? void 0 : optionList.length) > 0) {
|
|
66
|
+
var index = evt.target.selectedIndex;
|
|
67
|
+
var valueSelected = evt.target.value;
|
|
68
|
+
console.log(valueSelected);
|
|
69
|
+
generalValue = valueSelected;
|
|
70
|
+
setTextValue({
|
|
71
|
+
value: generalValue
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
generalValue = inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
75
|
+
setTextValue({
|
|
76
|
+
value: generalValue
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
66
80
|
var dataSave = updatedDatasheets === null || updatedDatasheets === void 0 ? void 0 : updatedDatasheets.slice();
|
|
67
81
|
if (dataSave.length === 0) dataSave.push({
|
|
68
82
|
articleId: articleId,
|
|
69
83
|
versionId: version,
|
|
70
84
|
attributeId: inputId,
|
|
71
|
-
value:
|
|
85
|
+
value: generalValue
|
|
72
86
|
});else if (dataSave.some(function (e) {
|
|
73
87
|
return e.attributeId === inputId;
|
|
74
88
|
})) {
|
|
75
89
|
dataSave.forEach(function (e) {
|
|
76
90
|
if (e.attributeId === inputId) {
|
|
77
|
-
e.value =
|
|
91
|
+
e.value = generalValue;
|
|
78
92
|
}
|
|
79
93
|
});
|
|
80
94
|
} else {
|
|
@@ -82,7 +96,7 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
82
96
|
articleId: articleId,
|
|
83
97
|
versionId: version,
|
|
84
98
|
attributeId: inputId,
|
|
85
|
-
value:
|
|
99
|
+
value: generalValue
|
|
86
100
|
});
|
|
87
101
|
}
|
|
88
102
|
setUpdatedDatasheets(dataSave);
|
|
@@ -102,19 +116,17 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
102
116
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
103
117
|
isRequired: requiredEmpty,
|
|
104
118
|
children: [(optionList === null || optionList === void 0 ? void 0 : optionList.length) > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
|
|
105
|
-
id: "dropdown".concat(inputId)
|
|
106
|
-
,
|
|
119
|
+
id: "dropdown".concat(inputId),
|
|
107
120
|
onChange: function onChange(e) {
|
|
108
121
|
return onHandleChange(e);
|
|
109
122
|
},
|
|
123
|
+
defaultValue: textValue.value,
|
|
110
124
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
111
125
|
value: "",
|
|
112
|
-
disabled: true,
|
|
113
126
|
children: description
|
|
114
127
|
}), JSON.parse(optionList || "[]").map(function (element, index) {
|
|
115
128
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
116
129
|
value: element,
|
|
117
|
-
defaultValue: element === textValue.value ? "selected" : "",
|
|
118
130
|
children: element
|
|
119
131
|
}, element + "-" + index);
|
|
120
132
|
})]
|
|
@@ -37,64 +37,58 @@ RetailerProductEditionDefault.args = {
|
|
|
37
37
|
version: 2,
|
|
38
38
|
productSelected: {
|
|
39
39
|
services: {
|
|
40
|
-
datasheets:
|
|
41
|
-
descriptions:
|
|
40
|
+
datasheets: 1,
|
|
41
|
+
descriptions: 1,
|
|
42
42
|
images: 1
|
|
43
43
|
},
|
|
44
|
-
orderId:
|
|
45
|
-
status: "
|
|
46
|
-
datasheet_status:
|
|
44
|
+
orderId: 83,
|
|
45
|
+
status: "ASSIGNED",
|
|
46
|
+
datasheet_status: "IN_PROGRESS",
|
|
47
47
|
prio: "none",
|
|
48
|
-
version:
|
|
49
|
-
description_status:
|
|
50
|
-
images_status:
|
|
48
|
+
version: 2,
|
|
49
|
+
description_status: "IN_PROGRESS",
|
|
50
|
+
images_status: "IN_PROGRESS",
|
|
51
51
|
article: {
|
|
52
|
-
id_article:
|
|
53
|
-
id_category: "
|
|
54
|
-
name: "
|
|
55
|
-
upc: "
|
|
56
|
-
timestamp: "2022-06-
|
|
57
|
-
id_user:
|
|
52
|
+
id_article: 55150,
|
|
53
|
+
id_category: "697",
|
|
54
|
+
name: "Shampoo hidratante",
|
|
55
|
+
upc: "4116665",
|
|
56
|
+
timestamp: "2022-06-21T19:47:57.000Z",
|
|
57
|
+
id_user: 28,
|
|
58
58
|
status: "NULL",
|
|
59
59
|
active: 1,
|
|
60
|
-
company_id:
|
|
61
|
-
company_name: "
|
|
62
|
-
country:
|
|
63
|
-
id_order:
|
|
64
|
-
id_datasheet_especialist:
|
|
65
|
-
id_datasheet_facilitator:
|
|
66
|
-
id_description_especialist:
|
|
67
|
-
id_description_facilitator:
|
|
68
|
-
id_images_especialist:
|
|
69
|
-
id_images_facilitator:
|
|
70
|
-
id_auditor:
|
|
60
|
+
company_id: 1,
|
|
61
|
+
company_name: "COMPANY DEV",
|
|
62
|
+
country: "México",
|
|
63
|
+
id_order: 83,
|
|
64
|
+
id_datasheet_especialist: 54,
|
|
65
|
+
id_datasheet_facilitator: 52,
|
|
66
|
+
id_description_especialist: 54,
|
|
67
|
+
id_description_facilitator: 52,
|
|
68
|
+
id_images_especialist: 55,
|
|
69
|
+
id_images_facilitator: 53,
|
|
70
|
+
id_auditor: 30,
|
|
71
71
|
id_recepcionist: null,
|
|
72
|
-
category: "
|
|
73
|
-
missingAttributes:
|
|
74
|
-
missingDescriptions:
|
|
75
|
-
missingImages:
|
|
72
|
+
category: "SALUD Y BELLEZA|CUIDADO DEL CABELLO|SHAMPOOS Y ACONDICIONADORES",
|
|
73
|
+
missingAttributes: 31,
|
|
74
|
+
missingDescriptions: 6,
|
|
75
|
+
missingImages: 3
|
|
76
76
|
},
|
|
77
77
|
retailers: [{
|
|
78
|
-
id:
|
|
79
|
-
name: "
|
|
80
|
-
country: "México",
|
|
81
|
-
id_region: 1,
|
|
82
|
-
active: 1
|
|
83
|
-
}, {
|
|
84
|
-
id: 59,
|
|
85
|
-
name: "The Home Depot Platinum",
|
|
78
|
+
id: 4,
|
|
79
|
+
name: "Walmart Super y Superama",
|
|
86
80
|
country: "México",
|
|
87
81
|
id_region: 1,
|
|
88
82
|
active: 1
|
|
89
83
|
}, {
|
|
90
|
-
id:
|
|
91
|
-
name: "
|
|
84
|
+
id: 26,
|
|
85
|
+
name: "Mercado Libre",
|
|
92
86
|
country: "México",
|
|
93
87
|
id_region: 1,
|
|
94
88
|
active: 1
|
|
95
89
|
}],
|
|
96
|
-
country:
|
|
97
|
-
upc: "
|
|
90
|
+
country: "México",
|
|
91
|
+
upc: "4116665"
|
|
98
92
|
},
|
|
99
93
|
location: {
|
|
100
94
|
product: {
|
|
@@ -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,23 +38,33 @@ export const GeneralInput = ({
|
|
|
38
38
|
updatedDescriptions ||
|
|
39
39
|
inputType === "textarea"
|
|
40
40
|
) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
let generalValue;
|
|
42
|
+
if (optionList?.length > 0) {
|
|
43
|
+
let index = evt.target.selectedIndex;
|
|
44
|
+
let valueSelected = evt.target.value;
|
|
45
|
+
console.log(valueSelected);
|
|
46
|
+
generalValue = valueSelected;
|
|
47
|
+
setTextValue({ value: generalValue });
|
|
48
|
+
} else {
|
|
49
|
+
generalValue =
|
|
50
|
+
inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
51
|
+
setTextValue({
|
|
52
|
+
value: generalValue,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
44
55
|
let dataSave = updatedDatasheets?.slice();
|
|
56
|
+
|
|
45
57
|
if (dataSave.length === 0)
|
|
46
58
|
dataSave.push({
|
|
47
59
|
articleId: articleId,
|
|
48
60
|
versionId: version,
|
|
49
61
|
attributeId: inputId,
|
|
50
|
-
value:
|
|
51
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
62
|
+
value: generalValue,
|
|
52
63
|
});
|
|
53
64
|
else if (dataSave.some((e) => e.attributeId === inputId)) {
|
|
54
65
|
dataSave.forEach((e) => {
|
|
55
66
|
if (e.attributeId === inputId) {
|
|
56
|
-
e.value =
|
|
57
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
67
|
+
e.value = generalValue;
|
|
58
68
|
}
|
|
59
69
|
});
|
|
60
70
|
} else {
|
|
@@ -62,8 +72,7 @@ export const GeneralInput = ({
|
|
|
62
72
|
articleId: articleId,
|
|
63
73
|
versionId: version,
|
|
64
74
|
attributeId: inputId,
|
|
65
|
-
value:
|
|
66
|
-
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
75
|
+
value: generalValue,
|
|
67
76
|
});
|
|
68
77
|
}
|
|
69
78
|
setUpdatedDatasheets(dataSave);
|
|
@@ -86,18 +95,12 @@ export const GeneralInput = ({
|
|
|
86
95
|
<select
|
|
87
96
|
key={`dropdownK${inputId}`}
|
|
88
97
|
id={`dropdown${inputId}`}
|
|
89
|
-
//disabled={!enableInputs}
|
|
90
98
|
onChange={(e) => onHandleChange(e)}
|
|
99
|
+
defaultValue={textValue.value}
|
|
91
100
|
>
|
|
92
|
-
<option value=""
|
|
93
|
-
{description}
|
|
94
|
-
</option>
|
|
101
|
+
<option value="">{description}</option>
|
|
95
102
|
{JSON.parse(optionList || "[]").map((element, index) => (
|
|
96
|
-
<option
|
|
97
|
-
key={element + "-" + index}
|
|
98
|
-
value={element}
|
|
99
|
-
defaultValue={element === textValue.value ? "selected" : ""}
|
|
100
|
-
>
|
|
103
|
+
<option key={element + "-" + index} value={element}>
|
|
101
104
|
{element}
|
|
102
105
|
</option>
|
|
103
106
|
))}
|
|
@@ -22,68 +22,62 @@ RetailerProductEditionDefault.args = {
|
|
|
22
22
|
version: 2,
|
|
23
23
|
productSelected: {
|
|
24
24
|
services: {
|
|
25
|
-
datasheets:
|
|
26
|
-
descriptions:
|
|
25
|
+
datasheets: 1,
|
|
26
|
+
descriptions: 1,
|
|
27
27
|
images: 1,
|
|
28
28
|
},
|
|
29
|
-
orderId:
|
|
30
|
-
status: "
|
|
31
|
-
datasheet_status:
|
|
29
|
+
orderId: 83,
|
|
30
|
+
status: "ASSIGNED",
|
|
31
|
+
datasheet_status: "IN_PROGRESS",
|
|
32
32
|
prio: "none",
|
|
33
|
-
version:
|
|
34
|
-
description_status:
|
|
35
|
-
images_status:
|
|
33
|
+
version: 2,
|
|
34
|
+
description_status: "IN_PROGRESS",
|
|
35
|
+
images_status: "IN_PROGRESS",
|
|
36
36
|
article: {
|
|
37
|
-
id_article:
|
|
38
|
-
id_category: "
|
|
39
|
-
name: "
|
|
40
|
-
upc: "
|
|
41
|
-
timestamp: "2022-06-
|
|
42
|
-
id_user:
|
|
37
|
+
id_article: 55150,
|
|
38
|
+
id_category: "697",
|
|
39
|
+
name: "Shampoo hidratante",
|
|
40
|
+
upc: "4116665",
|
|
41
|
+
timestamp: "2022-06-21T19:47:57.000Z",
|
|
42
|
+
id_user: 28,
|
|
43
43
|
status: "NULL",
|
|
44
44
|
active: 1,
|
|
45
|
-
company_id:
|
|
46
|
-
company_name: "
|
|
47
|
-
country:
|
|
48
|
-
id_order:
|
|
49
|
-
id_datasheet_especialist:
|
|
50
|
-
id_datasheet_facilitator:
|
|
51
|
-
id_description_especialist:
|
|
52
|
-
id_description_facilitator:
|
|
53
|
-
id_images_especialist:
|
|
54
|
-
id_images_facilitator:
|
|
55
|
-
id_auditor:
|
|
45
|
+
company_id: 1,
|
|
46
|
+
company_name: "COMPANY DEV",
|
|
47
|
+
country: "México",
|
|
48
|
+
id_order: 83,
|
|
49
|
+
id_datasheet_especialist: 54,
|
|
50
|
+
id_datasheet_facilitator: 52,
|
|
51
|
+
id_description_especialist: 54,
|
|
52
|
+
id_description_facilitator: 52,
|
|
53
|
+
id_images_especialist: 55,
|
|
54
|
+
id_images_facilitator: 53,
|
|
55
|
+
id_auditor: 30,
|
|
56
56
|
id_recepcionist: null,
|
|
57
|
-
category:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
category:
|
|
58
|
+
"SALUD Y BELLEZA|CUIDADO DEL CABELLO|SHAMPOOS Y ACONDICIONADORES",
|
|
59
|
+
missingAttributes: 31,
|
|
60
|
+
missingDescriptions: 6,
|
|
61
|
+
missingImages: 3,
|
|
61
62
|
},
|
|
62
63
|
retailers: [
|
|
63
64
|
{
|
|
64
|
-
id:
|
|
65
|
-
name: "
|
|
65
|
+
id: 4,
|
|
66
|
+
name: "Walmart Super y Superama",
|
|
66
67
|
country: "México",
|
|
67
68
|
id_region: 1,
|
|
68
69
|
active: 1,
|
|
69
70
|
},
|
|
70
71
|
{
|
|
71
|
-
id:
|
|
72
|
-
name: "
|
|
73
|
-
country: "México",
|
|
74
|
-
id_region: 1,
|
|
75
|
-
active: 1,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
id: 60,
|
|
79
|
-
name: "The Home Depot Resizing",
|
|
72
|
+
id: 26,
|
|
73
|
+
name: "Mercado Libre",
|
|
80
74
|
country: "México",
|
|
81
75
|
id_region: 1,
|
|
82
76
|
active: 1,
|
|
83
77
|
},
|
|
84
78
|
],
|
|
85
|
-
country:
|
|
86
|
-
upc: "
|
|
79
|
+
country: "México",
|
|
80
|
+
upc: "4116665",
|
|
87
81
|
},
|
|
88
82
|
location: {
|
|
89
83
|
product: { articleId: 109485, versionId: 3 },
|
|
@@ -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(
|