contentoh-components-library 21.0.6 → 21.0.7
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 +14 -6
- package/dist/components/atoms/GeneralInput/styles.js +4 -1
- package/dist/components/atoms/InputFormatter/index.js +15 -11
- package/dist/components/atoms/Select/style.js +1 -1
- package/dist/components/organisms/InputGroup/index.js +8 -8
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +17 -17
- package/dist/components/pages/RetailerProductEdition/index.js +6 -3
- package/package.json +1 -1
- package/src/components/atoms/GeneralInput/index.js +21 -6
- package/src/components/atoms/GeneralInput/styles.js +9 -0
- package/src/components/atoms/InputFormatter/index.js +13 -7
- package/src/components/atoms/Select/style.js +0 -1
- package/src/components/organisms/InputGroup/index.js +7 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +17 -18
- package/src/components/pages/RetailerProductEdition/index.js +14 -7
|
@@ -15,6 +15,8 @@ var _styles = require("./styles");
|
|
|
15
15
|
|
|
16
16
|
var _InputFormatter = require("../InputFormatter");
|
|
17
17
|
|
|
18
|
+
var _CheckBox = require("../CheckBox");
|
|
19
|
+
|
|
18
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
21
|
|
|
20
22
|
var GeneralInput = function GeneralInput(_ref) {
|
|
@@ -55,20 +57,20 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
55
57
|
});
|
|
56
58
|
} else {
|
|
57
59
|
setTextValue({
|
|
58
|
-
value: evt.target.value
|
|
60
|
+
value: inputType === "checkbox" ? evt.target.checked : evt.target.value
|
|
59
61
|
});
|
|
60
62
|
var dataSave = updatedDatasheets.slice();
|
|
61
63
|
if (dataSave.length === 0) dataSave.push({
|
|
62
64
|
articleId: articleId,
|
|
63
65
|
versionId: version,
|
|
64
66
|
attributeId: inputId,
|
|
65
|
-
value: evt.target.value
|
|
67
|
+
value: inputType === "checkbox" ? evt.target.checked : evt.target.value
|
|
66
68
|
});else if (dataSave.some(function (e) {
|
|
67
69
|
return e.attributeId === inputId;
|
|
68
70
|
})) {
|
|
69
71
|
dataSave.forEach(function (e) {
|
|
70
72
|
if (e.attributeId === inputId) {
|
|
71
|
-
e.value = evt.target.value;
|
|
73
|
+
e.value = inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
72
74
|
}
|
|
73
75
|
});
|
|
74
76
|
} else {
|
|
@@ -76,7 +78,7 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
76
78
|
articleId: articleId,
|
|
77
79
|
versionId: version,
|
|
78
80
|
attributeId: inputId,
|
|
79
|
-
value: evt.target.value
|
|
81
|
+
value: inputType === "checkbox" ? evt.target.checked : evt.target.value
|
|
80
82
|
});
|
|
81
83
|
}
|
|
82
84
|
setUpdatedDatasheets(dataSave);
|
|
@@ -86,11 +88,17 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
86
88
|
(0, _react.useEffect)(function () {
|
|
87
89
|
var _textValue$value;
|
|
88
90
|
|
|
89
|
-
setRequiredEmpty(isRequired && ((_textValue$value = textValue.value) === null || _textValue$value === void 0 ? void 0 : _textValue$value.length) === 0);
|
|
91
|
+
setRequiredEmpty(isRequired && (((_textValue$value = textValue.value) === null || _textValue$value === void 0 ? void 0 : _textValue$value.length) === 0 || textValue.value === undefined));
|
|
90
92
|
}, [textValue]);
|
|
91
93
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
92
94
|
isRequired: requiredEmpty,
|
|
93
|
-
children: inputType
|
|
95
|
+
children: inputType === "checkbox" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckBox.CheckBox, {
|
|
96
|
+
id: inputId,
|
|
97
|
+
onChange: function onChange(e) {
|
|
98
|
+
return onHandleChange(e);
|
|
99
|
+
},
|
|
100
|
+
defaultChecked: textValue.value === "true" ? true : false
|
|
101
|
+
}) : inputType !== "textarea" ? /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
94
102
|
type: inputType,
|
|
95
103
|
id: inputId,
|
|
96
104
|
size: inputSize,
|
|
@@ -15,8 +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 width: 100%;\n\n input,\n textarea {\n width: 100%;\n border: 1px solid\n ", ";\n font-family: ", ";\n color: ", ";\n font-weight: normal;\n font-size: 12px;\n line-height: 15px;\n padding: 10px;\n outline: none;\n border-radius: 2px;\n resize: none;\n\n &:focus {\n border: 1px solid ", ";\n }\n }\n"])), function (_ref) {
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n\n > div {\n label {\n &:before {\n outline: 1px solid ", ";\n }\n }\n }\n\n input,\n textarea {\n width: 100%;\n border: 1px solid\n ", ";\n\n font-family: ", ";\n color: ", ";\n font-weight: normal;\n font-size: 12px;\n line-height: 15px;\n padding: 10px;\n outline: none;\n border-radius: 2px;\n resize: none;\n\n &:focus {\n border: 1px solid ", ";\n }\n }\n"])), function (_ref) {
|
|
19
19
|
var isRequired = _ref.isRequired;
|
|
20
|
+
return isRequired ? "red" : "none";
|
|
21
|
+
}, function (_ref2) {
|
|
22
|
+
var isRequired = _ref2.isRequired;
|
|
20
23
|
return isRequired ? "red" : "".concat(_variables.GlobalColors.s2);
|
|
21
24
|
}, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s4, _variables.GlobalColors.magenta_s2);
|
|
22
25
|
|
|
@@ -80,17 +80,21 @@ var InputFormatter = function InputFormatter(_ref) {
|
|
|
80
80
|
var _onChange = function onChange(valueInput, delta, user, h) {
|
|
81
81
|
var value = "";
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
try {
|
|
84
|
+
if (h.getLength() - 1 <= maxLength) {
|
|
85
|
+
setInputValue(function (val) {
|
|
86
|
+
return val = valueInput.replace(/<\/?span.*?>/gm, "");
|
|
87
|
+
});
|
|
88
|
+
value = valueInput;
|
|
89
|
+
} else {
|
|
90
|
+
quillState.deleteText(maxLength, quillState.getLength());
|
|
91
|
+
setInputValue(function (val) {
|
|
92
|
+
return val = quillState.getText();
|
|
93
|
+
});
|
|
94
|
+
value = quillState.getText();
|
|
95
|
+
}
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.log(error);
|
|
94
98
|
}
|
|
95
99
|
|
|
96
100
|
setCharsCounter(h.getLength() - 1);
|
|
@@ -24,7 +24,7 @@ var BackgroundEnd = _styledComponents.default.div(_templateObject2 || (_template
|
|
|
24
24
|
|
|
25
25
|
exports.BackgroundEnd = BackgroundEnd;
|
|
26
26
|
|
|
27
|
-
var SelectCustom = _styledComponents.default.select(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n background: #fafafa;\n -webkit-appearance: none;\n -moz-appearance: none;\n -ms-appearance: none;\n appearance: none;\n outline: 0;\n box-shadow: none;\n border: 0 !important;\n background-image: none;\n width: ", ";\n cursor: pointer;\n height: 21px;\n font-family: Avenir Next;\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 21px;\n padding: 0 5px;\n box-sizing: border-box;\n &::-ms-expand {\n display: none;\n }\n option {\n
|
|
27
|
+
var SelectCustom = _styledComponents.default.select(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n background: #fafafa;\n -webkit-appearance: none;\n -moz-appearance: none;\n -ms-appearance: none;\n appearance: none;\n outline: 0;\n box-shadow: none;\n border: 0 !important;\n background-image: none;\n width: ", ";\n cursor: pointer;\n height: 21px;\n font-family: Avenir Next;\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 21px;\n padding: 0 5px;\n box-sizing: border-box;\n &::-ms-expand {\n display: none;\n }\n option {\n &:disabled {\n color: #d4d1d7;\n }\n &:invalid {\n color: gray;\n }\n }\n"])), function (_ref2) {
|
|
28
28
|
var width = _ref2.width;
|
|
29
29
|
return width || "100%";
|
|
30
30
|
});
|
|
@@ -50,21 +50,21 @@ var InputGroup = function InputGroup(_ref) {
|
|
|
50
50
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
51
51
|
className: "inputs-container",
|
|
52
52
|
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) {
|
|
53
|
-
var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9;
|
|
53
|
+
var _dataInputs$input, _dataInputs$input2, _dataInputs$input3, _dataInputs$input4, _dataInputs$input5, _dataInputs$input6, _dataInputs$input7, _dataInputs$input8, _dataInputs$input9, _dataInputs$input10;
|
|
54
54
|
|
|
55
55
|
return activeSection === "Ficha técnica" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
56
|
-
inputId: (_dataInputs$
|
|
56
|
+
inputId: (_dataInputs$input3 = dataInputs[input]) === null || _dataInputs$input3 === void 0 ? void 0 : _dataInputs$input3.id,
|
|
57
57
|
version: version,
|
|
58
|
-
inputType: inputTypeValue((_dataInputs$
|
|
59
|
-
label: ((_dataInputs$
|
|
60
|
-
value: (_dataInputs$
|
|
58
|
+
inputType: inputTypeValue((_dataInputs$input4 = dataInputs[input]) === null || _dataInputs$input4 === void 0 ? void 0 : _dataInputs$input4.type),
|
|
59
|
+
label: ((_dataInputs$input5 = dataInputs[input]) === null || _dataInputs$input5 === void 0 ? void 0 : _dataInputs$input5.name) + ((_dataInputs$input6 = dataInputs[input]) !== null && _dataInputs$input6 !== void 0 && _dataInputs$input6.required ? "*" : ""),
|
|
60
|
+
value: (_dataInputs$input7 = dataInputs[input]) === null || _dataInputs$input7 === void 0 ? void 0 : _dataInputs$input7.value,
|
|
61
61
|
inputPlaceHolder: input === null || input === void 0 ? void 0 : input.placeholder,
|
|
62
62
|
articleId: articleId,
|
|
63
|
-
isRequired: (_dataInputs$
|
|
63
|
+
isRequired: (_dataInputs$input8 = dataInputs[input]) === null || _dataInputs$input8 === void 0 ? void 0 : _dataInputs$input8.required,
|
|
64
64
|
updatedDatasheets: updatedDatasheets,
|
|
65
65
|
setUpdatedDatasheets: setUpdatedDatasheets,
|
|
66
|
-
maxChar: (_dataInputs$
|
|
67
|
-
}, index + "-" + ((_dataInputs$input = dataInputs[input]) === null || _dataInputs$input === void 0 ? void 0 : _dataInputs$input.value)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
66
|
+
maxChar: (_dataInputs$input9 = dataInputs[input]) !== null && _dataInputs$input9 !== void 0 && _dataInputs$input9.max_chars ? (_dataInputs$input10 = dataInputs[input]) === null || _dataInputs$input10 === void 0 ? void 0 : _dataInputs$input10.max_chars : 999
|
|
67
|
+
}, index + "-" + ((_dataInputs$input = dataInputs[input]) === null || _dataInputs$input === void 0 ? void 0 : _dataInputs$input.value) + "-" + ((_dataInputs$input2 = dataInputs[input]) === null || _dataInputs$input2 === void 0 ? void 0 : _dataInputs$input2.id)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
68
68
|
inputId: input.id,
|
|
69
69
|
index: index,
|
|
70
70
|
inputType: "textarea",
|
|
@@ -78,35 +78,35 @@ RetailerProductEditionDefault.args = {
|
|
|
78
78
|
descriptions: 1,
|
|
79
79
|
images: 1
|
|
80
80
|
},
|
|
81
|
-
orderId:
|
|
82
|
-
status: "
|
|
83
|
-
datasheet_status: "
|
|
81
|
+
orderId: 123,
|
|
82
|
+
status: "IN_PROGRESS",
|
|
83
|
+
datasheet_status: "IN_PROGRESS",
|
|
84
84
|
prio: "none",
|
|
85
85
|
version: 2,
|
|
86
|
-
description_status: "
|
|
87
|
-
images_status:
|
|
86
|
+
description_status: "IN_PROGRESS",
|
|
87
|
+
images_status: null,
|
|
88
88
|
article: {
|
|
89
|
-
id_article:
|
|
90
|
-
id_category: "
|
|
91
|
-
name: "
|
|
92
|
-
upc: "
|
|
93
|
-
timestamp: "2022-
|
|
89
|
+
id_article: 109481,
|
|
90
|
+
id_category: "9",
|
|
91
|
+
name: "Barrita de nuez",
|
|
92
|
+
upc: "168489",
|
|
93
|
+
timestamp: "2022-04-27T15:06:59.000Z",
|
|
94
94
|
id_user: 28,
|
|
95
95
|
status: "NULL",
|
|
96
96
|
active: 1,
|
|
97
97
|
company_id: 1,
|
|
98
98
|
company_name: "COMPANY DEV",
|
|
99
99
|
country: "Colombia",
|
|
100
|
-
id_order:
|
|
101
|
-
id_datasheet_especialist:
|
|
100
|
+
id_order: 123,
|
|
101
|
+
id_datasheet_especialist: 54,
|
|
102
102
|
id_datasheet_facilitator: 52,
|
|
103
|
-
id_description_especialist:
|
|
103
|
+
id_description_especialist: 54,
|
|
104
104
|
id_description_facilitator: 52,
|
|
105
|
-
id_images_especialist:
|
|
106
|
-
id_images_facilitator:
|
|
105
|
+
id_images_especialist: null,
|
|
106
|
+
id_images_facilitator: null,
|
|
107
107
|
id_auditor: 30,
|
|
108
108
|
id_recepcionist: null,
|
|
109
|
-
category: "
|
|
109
|
+
category: "ABARROTES|ABARROTES SECOS|CEREALES Y BARRAS",
|
|
110
110
|
missingAttributes: null,
|
|
111
111
|
missingDescriptions: null,
|
|
112
112
|
missingImages: null
|
|
@@ -125,7 +125,7 @@ RetailerProductEditionDefault.args = {
|
|
|
125
125
|
active: 1
|
|
126
126
|
}],
|
|
127
127
|
country: "Colombia",
|
|
128
|
-
upc: "
|
|
128
|
+
upc: "168489"
|
|
129
129
|
},
|
|
130
130
|
user: {
|
|
131
131
|
id_user: 30,
|
|
@@ -1232,7 +1232,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1232
1232
|
var getRequired = function getRequired(services) {
|
|
1233
1233
|
var _services$4, _services$4$inputs;
|
|
1234
1234
|
|
|
1235
|
-
var objetcTemp =
|
|
1235
|
+
var objetcTemp = {};
|
|
1236
1236
|
var datasheetServicesArray = Object.values(services[0]);
|
|
1237
1237
|
var dsInputs = datasheetServicesArray.pop();
|
|
1238
1238
|
var descriptionsServicesArray = services[1];
|
|
@@ -1241,7 +1241,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1241
1241
|
datasheetServicesArray.forEach(function (datasheet) {
|
|
1242
1242
|
return Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
|
|
1243
1243
|
return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
|
|
1244
|
-
return dsInputs[input].required && !dsInputs[input].value;
|
|
1244
|
+
return dsInputs[input].required && (dsInputs[input].value === undefined || !dsInputs[input].value);
|
|
1245
1245
|
})));
|
|
1246
1246
|
});
|
|
1247
1247
|
});
|
|
@@ -1470,6 +1470,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1470
1470
|
}
|
|
1471
1471
|
};
|
|
1472
1472
|
|
|
1473
|
+
(0, _react.useEffect)(function () {
|
|
1474
|
+
console.log(requiredNull[activeTab], evaluationComplete(activeTab));
|
|
1475
|
+
}, [activeTab]);
|
|
1473
1476
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1474
1477
|
headerTop: headerTop,
|
|
1475
1478
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -1636,7 +1639,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1636
1639
|
}))
|
|
1637
1640
|
})]
|
|
1638
1641
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1639
|
-
buttonType:
|
|
1642
|
+
buttonType: approveRejectButtons() || requiredNull[activeTab] === 0 || evaluationComplete(activeTab) ? "general-green-button" : "general-button-disabled",
|
|
1640
1643
|
label: "Enviar evaluación",
|
|
1641
1644
|
onClick: function onClick() {
|
|
1642
1645
|
return sendToFacilitator();
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
2
|
import { Container } from "./styles";
|
|
3
3
|
import { InputFormatter } from "../InputFormatter";
|
|
4
|
+
import { CheckBox } from "../CheckBox";
|
|
4
5
|
|
|
5
6
|
export const GeneralInput = ({
|
|
6
7
|
inputType,
|
|
@@ -30,19 +31,23 @@ export const GeneralInput = ({
|
|
|
30
31
|
if (validateInput) {
|
|
31
32
|
setTextValue({ value: validateInput(evt, position, inputsArray) });
|
|
32
33
|
} else {
|
|
33
|
-
setTextValue({
|
|
34
|
+
setTextValue({
|
|
35
|
+
value: inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
36
|
+
});
|
|
34
37
|
let dataSave = updatedDatasheets.slice();
|
|
35
38
|
if (dataSave.length === 0)
|
|
36
39
|
dataSave.push({
|
|
37
40
|
articleId: articleId,
|
|
38
41
|
versionId: version,
|
|
39
42
|
attributeId: inputId,
|
|
40
|
-
value:
|
|
43
|
+
value:
|
|
44
|
+
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
41
45
|
});
|
|
42
46
|
else if (dataSave.some((e) => e.attributeId === inputId)) {
|
|
43
47
|
dataSave.forEach((e) => {
|
|
44
48
|
if (e.attributeId === inputId) {
|
|
45
|
-
e.value =
|
|
49
|
+
e.value =
|
|
50
|
+
inputType === "checkbox" ? evt.target.checked : evt.target.value;
|
|
46
51
|
}
|
|
47
52
|
});
|
|
48
53
|
} else {
|
|
@@ -50,7 +55,8 @@ export const GeneralInput = ({
|
|
|
50
55
|
articleId: articleId,
|
|
51
56
|
versionId: version,
|
|
52
57
|
attributeId: inputId,
|
|
53
|
-
value:
|
|
58
|
+
value:
|
|
59
|
+
inputType === "checkbox" ? evt.target.checked : evt.target.value,
|
|
54
60
|
});
|
|
55
61
|
}
|
|
56
62
|
setUpdatedDatasheets(dataSave);
|
|
@@ -58,12 +64,21 @@ export const GeneralInput = ({
|
|
|
58
64
|
};
|
|
59
65
|
|
|
60
66
|
useEffect(() => {
|
|
61
|
-
setRequiredEmpty(
|
|
67
|
+
setRequiredEmpty(
|
|
68
|
+
isRequired &&
|
|
69
|
+
(textValue.value?.length === 0 || textValue.value === undefined)
|
|
70
|
+
);
|
|
62
71
|
}, [textValue]);
|
|
63
72
|
|
|
64
73
|
return (
|
|
65
74
|
<Container isRequired={requiredEmpty}>
|
|
66
|
-
{inputType
|
|
75
|
+
{inputType === "checkbox" ? (
|
|
76
|
+
<CheckBox
|
|
77
|
+
id={inputId}
|
|
78
|
+
onChange={(e) => onHandleChange(e)}
|
|
79
|
+
defaultChecked={textValue.value === "true" ? true : false}
|
|
80
|
+
/>
|
|
81
|
+
) : inputType !== "textarea" ? (
|
|
67
82
|
<input
|
|
68
83
|
type={inputType}
|
|
69
84
|
id={inputId}
|
|
@@ -4,11 +4,20 @@ import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
|
4
4
|
export const Container = styled.div`
|
|
5
5
|
width: 100%;
|
|
6
6
|
|
|
7
|
+
> div {
|
|
8
|
+
label {
|
|
9
|
+
&:before {
|
|
10
|
+
outline: 1px solid ${({ isRequired }) => (isRequired ? "red" : "none")};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
input,
|
|
8
16
|
textarea {
|
|
9
17
|
width: 100%;
|
|
10
18
|
border: 1px solid
|
|
11
19
|
${({ isRequired }) => (isRequired ? "red" : `${GlobalColors.s2}`)};
|
|
20
|
+
|
|
12
21
|
font-family: ${FontFamily.AvenirNext};
|
|
13
22
|
color: ${GlobalColors.s4};
|
|
14
23
|
font-weight: normal;
|
|
@@ -39,13 +39,19 @@ export const InputFormatter = ({
|
|
|
39
39
|
|
|
40
40
|
const onChange = (valueInput, delta, user, h) => {
|
|
41
41
|
let value = "";
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
try {
|
|
43
|
+
if (h.getLength() - 1 <= maxLength) {
|
|
44
|
+
setInputValue(
|
|
45
|
+
(val) => (val = valueInput.replace(/<\/?span.*?>/gm, ""))
|
|
46
|
+
);
|
|
47
|
+
value = valueInput;
|
|
48
|
+
} else {
|
|
49
|
+
quillState.deleteText(maxLength, quillState.getLength());
|
|
50
|
+
setInputValue((val) => (val = quillState.getText()));
|
|
51
|
+
value = quillState.getText();
|
|
52
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.log(error);
|
|
49
55
|
}
|
|
50
56
|
setCharsCounter(h.getLength() - 1);
|
|
51
57
|
value = valueFormater(value);
|
|
@@ -42,7 +42,13 @@ export const InputGroup = ({
|
|
|
42
42
|
{inputGroup?.inputs?.map((input, index) =>
|
|
43
43
|
activeSection === "Ficha técnica" ? (
|
|
44
44
|
<TagAndInput
|
|
45
|
-
key={
|
|
45
|
+
key={
|
|
46
|
+
index +
|
|
47
|
+
"-" +
|
|
48
|
+
dataInputs[input]?.value +
|
|
49
|
+
"-" +
|
|
50
|
+
dataInputs[input]?.id
|
|
51
|
+
}
|
|
46
52
|
inputId={dataInputs[input]?.id}
|
|
47
53
|
version={version}
|
|
48
54
|
inputType={inputTypeValue(dataInputs[input]?.type)}
|
|
@@ -54,36 +54,35 @@ RetailerProductEditionDefault.args = {
|
|
|
54
54
|
descriptions: 1,
|
|
55
55
|
images: 1,
|
|
56
56
|
},
|
|
57
|
-
orderId:
|
|
58
|
-
status: "
|
|
59
|
-
datasheet_status: "
|
|
57
|
+
orderId: 123,
|
|
58
|
+
status: "IN_PROGRESS",
|
|
59
|
+
datasheet_status: "IN_PROGRESS",
|
|
60
60
|
prio: "none",
|
|
61
61
|
version: 2,
|
|
62
|
-
description_status: "
|
|
63
|
-
images_status:
|
|
62
|
+
description_status: "IN_PROGRESS",
|
|
63
|
+
images_status: null,
|
|
64
64
|
article: {
|
|
65
|
-
id_article:
|
|
66
|
-
id_category: "
|
|
67
|
-
name: "
|
|
68
|
-
upc: "
|
|
69
|
-
timestamp: "2022-
|
|
65
|
+
id_article: 109481,
|
|
66
|
+
id_category: "9",
|
|
67
|
+
name: "Barrita de nuez",
|
|
68
|
+
upc: "168489",
|
|
69
|
+
timestamp: "2022-04-27T15:06:59.000Z",
|
|
70
70
|
id_user: 28,
|
|
71
71
|
status: "NULL",
|
|
72
72
|
active: 1,
|
|
73
73
|
company_id: 1,
|
|
74
74
|
company_name: "COMPANY DEV",
|
|
75
75
|
country: "Colombia",
|
|
76
|
-
id_order:
|
|
77
|
-
id_datasheet_especialist:
|
|
76
|
+
id_order: 123,
|
|
77
|
+
id_datasheet_especialist: 54,
|
|
78
78
|
id_datasheet_facilitator: 52,
|
|
79
|
-
id_description_especialist:
|
|
79
|
+
id_description_especialist: 54,
|
|
80
80
|
id_description_facilitator: 52,
|
|
81
|
-
id_images_especialist:
|
|
82
|
-
id_images_facilitator:
|
|
81
|
+
id_images_especialist: null,
|
|
82
|
+
id_images_facilitator: null,
|
|
83
83
|
id_auditor: 30,
|
|
84
84
|
id_recepcionist: null,
|
|
85
|
-
category:
|
|
86
|
-
"SALUD Y BELLEZA|CUIDADO DEL CABELLO|SHAMPOOS Y ACONDICIONADORES",
|
|
85
|
+
category: "ABARROTES|ABARROTES SECOS|CEREALES Y BARRAS",
|
|
87
86
|
missingAttributes: null,
|
|
88
87
|
missingDescriptions: null,
|
|
89
88
|
missingImages: null,
|
|
@@ -105,7 +104,7 @@ RetailerProductEditionDefault.args = {
|
|
|
105
104
|
},
|
|
106
105
|
],
|
|
107
106
|
country: "Colombia",
|
|
108
|
-
upc: "
|
|
107
|
+
upc: "168489",
|
|
109
108
|
},
|
|
110
109
|
user: {
|
|
111
110
|
id_user: 30,
|
|
@@ -773,7 +773,7 @@ export const RetailerProductEdition = ({
|
|
|
773
773
|
};
|
|
774
774
|
|
|
775
775
|
const getRequired = (services) => {
|
|
776
|
-
const objetcTemp =
|
|
776
|
+
const objetcTemp = {};
|
|
777
777
|
const datasheetServicesArray = Object.values(services[0]);
|
|
778
778
|
const dsInputs = datasheetServicesArray.pop();
|
|
779
779
|
const descriptionsServicesArray = services[1];
|
|
@@ -784,11 +784,14 @@ export const RetailerProductEdition = ({
|
|
|
784
784
|
Object.values(datasheet?.data).forEach((dataGroup) =>
|
|
785
785
|
dsInputsRequired.push(
|
|
786
786
|
...dataGroup.inputs.filter(
|
|
787
|
-
(input) =>
|
|
787
|
+
(input) =>
|
|
788
|
+
dsInputs[input].required &&
|
|
789
|
+
(dsInputs[input].value === undefined || !dsInputs[input].value)
|
|
788
790
|
)
|
|
789
791
|
)
|
|
790
792
|
)
|
|
791
793
|
);
|
|
794
|
+
|
|
792
795
|
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
793
796
|
|
|
794
797
|
descriptionsServicesArray.forEach((description) =>
|
|
@@ -995,6 +998,10 @@ export const RetailerProductEdition = ({
|
|
|
995
998
|
}
|
|
996
999
|
};
|
|
997
1000
|
|
|
1001
|
+
useEffect(() => {
|
|
1002
|
+
console.log(requiredNull[activeTab], evaluationComplete(activeTab));
|
|
1003
|
+
}, [activeTab]);
|
|
1004
|
+
|
|
998
1005
|
return (
|
|
999
1006
|
<Container headerTop={headerTop}>
|
|
1000
1007
|
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
@@ -1183,11 +1190,11 @@ export const RetailerProductEdition = ({
|
|
|
1183
1190
|
)}
|
|
1184
1191
|
<Button
|
|
1185
1192
|
buttonType={
|
|
1186
|
-
|
|
1187
|
-
requiredNull[activeTab]
|
|
1188
|
-
|
|
1189
|
-
? "general-button
|
|
1190
|
-
: "general-
|
|
1193
|
+
approveRejectButtons() ||
|
|
1194
|
+
requiredNull[activeTab] === 0 ||
|
|
1195
|
+
evaluationComplete(activeTab)
|
|
1196
|
+
? "general-green-button"
|
|
1197
|
+
: "general-button-disabled"
|
|
1191
1198
|
}
|
|
1192
1199
|
label={"Enviar evaluación"}
|
|
1193
1200
|
onClick={() => sendToFacilitator()}
|