contentoh-components-library 21.4.42 → 21.4.45
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/molecules/BoxAttribute/index.js +13 -4
- package/dist/components/molecules/BoxButtons/index.js +4 -1
- package/dist/components/organisms/Box/index.js +27 -3
- package/dist/components/organisms/BoxOnboarding/index.js +12 -7
- package/dist/components/organisms/InputGroup/index.js +8 -2
- package/dist/components/pages/ProviderProductEdition/index.js +145 -127
- package/package.json +1 -1
- package/src/components/molecules/BoxAttribute/index.js +48 -37
- package/src/components/molecules/BoxButtons/index.js +3 -2
- package/src/components/organisms/Box/index.js +73 -19
- package/src/components/organisms/BoxOnboarding/index.js +55 -64
- package/src/components/organisms/BoxOnboarding/out.json +1 -0
- package/src/components/organisms/InputGroup/index.js +122 -111
- package/src/components/pages/ProviderProductEdition/index.js +29 -16
|
@@ -3,6 +3,7 @@ import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
|
3
3
|
import { TagAndInput } from "../../molecules/TagAndInput";
|
|
4
4
|
import { BoxOnboarding } from "../BoxOnboarding";
|
|
5
5
|
import { Box } from "../Box";
|
|
6
|
+
import { useEffect } from "react";
|
|
6
7
|
|
|
7
8
|
export const InputGroup = ({
|
|
8
9
|
inputGroup = {},
|
|
@@ -19,11 +20,11 @@ export const InputGroup = ({
|
|
|
19
20
|
dinamicHeight,
|
|
20
21
|
compare,
|
|
21
22
|
groupData = [],
|
|
22
|
-
isShowbox
|
|
23
|
+
isShowbox,
|
|
24
|
+
setUpdatedBoxData
|
|
23
25
|
}) => {
|
|
24
|
-
|
|
25
|
-
console.log(
|
|
26
|
-
console.log('groupData: ', groupData);
|
|
26
|
+
console.log("groupData: ", typeof groupData);
|
|
27
|
+
console.log("groupData: ", groupData);
|
|
27
28
|
const inputTypeValue = (type) => {
|
|
28
29
|
switch (type) {
|
|
29
30
|
case "Booleano":
|
|
@@ -36,123 +37,133 @@ export const InputGroup = ({
|
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
const isOnboarding = () => {
|
|
39
|
-
const contentBoxAttribute = groupData.find(
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const contentBoxAttribute = groupData.find(
|
|
41
|
+
({ dataGroup }) => dataGroup === "Caja"
|
|
42
|
+
);
|
|
43
|
+
if (contentBoxAttribute) {
|
|
44
|
+
console.log("content box attribute");
|
|
42
45
|
} else {
|
|
43
|
-
console.log(
|
|
46
|
+
console.log("dont content box attribute");
|
|
44
47
|
}
|
|
45
48
|
return contentBoxAttribute;
|
|
46
|
-
}
|
|
47
|
-
|
|
49
|
+
};
|
|
48
50
|
|
|
49
51
|
const isEquals = (dataInputsVal, auditInputsVal) => {
|
|
50
52
|
const result = dataInputsVal === auditInputsVal;
|
|
53
|
+
console.log("Input Val",dataInputsVal)
|
|
51
54
|
return result;
|
|
52
55
|
};
|
|
53
|
-
|
|
54
|
-
return (
|
|
56
|
+
return inputGroup.groupId !== "16" ? (
|
|
55
57
|
<>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
)}
|
|
69
|
-
<div className="inputs-container">
|
|
70
|
-
{inputGroup?.inputs?.map((input, index) =>
|
|
71
|
-
activeSection === "Ficha técnica" ? (
|
|
72
|
-
<>
|
|
73
|
-
|
|
74
|
-
<TagAndInput
|
|
75
|
-
key={
|
|
76
|
-
index +
|
|
77
|
-
"-" +
|
|
78
|
-
dataInputs[input]?.value +
|
|
79
|
-
"-" +
|
|
80
|
-
dataInputs[input]?.id +
|
|
81
|
-
"-" +
|
|
82
|
-
compare
|
|
83
|
-
}
|
|
84
|
-
//disabled={input === 40001}
|
|
85
|
-
disabled={false}
|
|
86
|
-
inputId={dataInputs[input]?.id}
|
|
87
|
-
version={version}
|
|
88
|
-
inputType={inputTypeValue(dataInputs[input]?.type)}
|
|
89
|
-
label={
|
|
90
|
-
dataInputs[input]?.name +
|
|
91
|
-
(dataInputs[input]?.required ? "*" : "")
|
|
92
|
-
}
|
|
93
|
-
value={
|
|
94
|
-
compare ? auditInputs[input]?.value : dataInputs[input]?.value
|
|
95
|
-
}
|
|
96
|
-
inputPlaceHolder={input?.placeholder}
|
|
97
|
-
articleId={articleId}
|
|
98
|
-
isRequired={dataInputs[input]?.required}
|
|
99
|
-
updatedDatasheets={updatedDatasheets}
|
|
100
|
-
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
101
|
-
maxChar={
|
|
102
|
-
dataInputs[input]?.max_chars
|
|
103
|
-
? dataInputs[input]?.max_chars
|
|
104
|
-
: 999
|
|
105
|
-
}
|
|
106
|
-
optionList={dataInputs[input]?.option_list}
|
|
107
|
-
description={dataInputs[input]?.description}
|
|
108
|
-
showTooltip={true}
|
|
109
|
-
auditClass={
|
|
110
|
-
compare &&
|
|
111
|
-
!isEquals(dataInputs[input].value, auditInputs[input].value)
|
|
112
|
-
? "audit-class"
|
|
113
|
-
: ""
|
|
114
|
-
}
|
|
115
|
-
/>
|
|
116
|
-
</>
|
|
117
|
-
|
|
118
|
-
) : (
|
|
119
|
-
<TagAndInput
|
|
120
|
-
key={index + "-" + input?.value + "-" + compare}
|
|
121
|
-
inputId={input.id}
|
|
122
|
-
index={index}
|
|
123
|
-
inputType={"textarea"}
|
|
124
|
-
label={input?.name + (input.required ? "*" : "")}
|
|
125
|
-
value={
|
|
126
|
-
compare ? auditInputGroup?.inputs[index]?.value : input?.value
|
|
127
|
-
}
|
|
128
|
-
isRequired={input.required}
|
|
129
|
-
maxChar={input.max_chars}
|
|
130
|
-
inputPlaceHolder={input?.placeholder}
|
|
131
|
-
updatedDescriptions={updatedDescriptions}
|
|
132
|
-
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
133
|
-
articleId={articleId}
|
|
134
|
-
version={version}
|
|
135
|
-
dinamicHeight={dinamicHeight}
|
|
136
|
-
description={input?.description}
|
|
137
|
-
showTooltip={true}
|
|
138
|
-
auditClass={
|
|
139
|
-
compare &&
|
|
140
|
-
!isEquals(input?.value, auditInputGroup?.inputs[index]?.value)
|
|
141
|
-
? "audit-class"
|
|
142
|
-
: ""
|
|
143
|
-
}
|
|
144
|
-
/>
|
|
145
|
-
)
|
|
58
|
+
<Container
|
|
59
|
+
className={
|
|
60
|
+
activeSection === "Ficha técnica"
|
|
61
|
+
? "datasheets-layout"
|
|
62
|
+
: "descriptions-layout"
|
|
63
|
+
}
|
|
64
|
+
>
|
|
65
|
+
{inputGroup?.dataGroup && (
|
|
66
|
+
<ScreenHeader
|
|
67
|
+
headerType={"retailer-name-header"}
|
|
68
|
+
text={`${inputGroup.groupId} - ${inputGroup?.dataGroup}`}
|
|
69
|
+
/>
|
|
146
70
|
)}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
71
|
+
<div className="inputs-container">
|
|
72
|
+
{inputGroup?.inputs?.map((input, index) =>
|
|
73
|
+
activeSection === "Ficha técnica" ? (
|
|
74
|
+
<>
|
|
75
|
+
<TagAndInput
|
|
76
|
+
key={
|
|
77
|
+
index +
|
|
78
|
+
"-" +
|
|
79
|
+
dataInputs[input]?.value +
|
|
80
|
+
"-" +
|
|
81
|
+
dataInputs[input]?.id +
|
|
82
|
+
"-" +
|
|
83
|
+
compare
|
|
84
|
+
}
|
|
85
|
+
//disabled={input === 40001}
|
|
86
|
+
disabled={false}
|
|
87
|
+
inputId={dataInputs[input]?.id}
|
|
88
|
+
version={version}
|
|
89
|
+
inputType={inputTypeValue(dataInputs[input]?.type)}
|
|
90
|
+
label={
|
|
91
|
+
dataInputs[input]?.name +
|
|
92
|
+
(dataInputs[input]?.required ? "*" : "")
|
|
93
|
+
}
|
|
94
|
+
value={
|
|
95
|
+
compare
|
|
96
|
+
? auditInputs[input]?.value
|
|
97
|
+
: dataInputs[input]?.value
|
|
98
|
+
}
|
|
99
|
+
inputPlaceHolder={input?.placeholder}
|
|
100
|
+
articleId={articleId}
|
|
101
|
+
isRequired={dataInputs[input]?.required}
|
|
102
|
+
updatedDatasheets={updatedDatasheets}
|
|
103
|
+
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
104
|
+
maxChar={
|
|
105
|
+
dataInputs[input]?.max_chars
|
|
106
|
+
? dataInputs[input]?.max_chars
|
|
107
|
+
: 999
|
|
108
|
+
}
|
|
109
|
+
optionList={dataInputs[input]?.option_list}
|
|
110
|
+
description={dataInputs[input]?.description}
|
|
111
|
+
showTooltip={true}
|
|
112
|
+
auditClass={
|
|
113
|
+
compare &&
|
|
114
|
+
!isEquals(dataInputs[input].value, auditInputs[input].value)
|
|
115
|
+
? "audit-class"
|
|
116
|
+
: ""
|
|
117
|
+
}
|
|
118
|
+
/>
|
|
119
|
+
</>
|
|
120
|
+
) : (
|
|
121
|
+
<TagAndInput
|
|
122
|
+
key={index + "-" + input?.value + "-" + compare}
|
|
123
|
+
inputId={input.id}
|
|
124
|
+
index={index}
|
|
125
|
+
inputType={"textarea"}
|
|
126
|
+
label={input?.name + (input.required ? "*" : "")}
|
|
127
|
+
value={
|
|
128
|
+
compare ? auditInputGroup?.inputs[index]?.value : input?.value
|
|
129
|
+
}
|
|
130
|
+
isRequired={input.required}
|
|
131
|
+
maxChar={input.max_chars}
|
|
132
|
+
inputPlaceHolder={input?.placeholder}
|
|
133
|
+
updatedDescriptions={updatedDescriptions}
|
|
134
|
+
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
135
|
+
articleId={articleId}
|
|
136
|
+
version={version}
|
|
137
|
+
dinamicHeight={dinamicHeight}
|
|
138
|
+
description={input?.description}
|
|
139
|
+
showTooltip={true}
|
|
140
|
+
auditClass={
|
|
141
|
+
compare &&
|
|
142
|
+
!isEquals(input?.value, auditInputGroup?.inputs[index]?.value)
|
|
143
|
+
? "audit-class"
|
|
144
|
+
: ""
|
|
145
|
+
}
|
|
146
|
+
/>
|
|
147
|
+
)
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
</Container>
|
|
156
151
|
</>
|
|
152
|
+
) : (
|
|
153
|
+
isShowbox && (
|
|
154
|
+
<Container
|
|
155
|
+
className={
|
|
156
|
+
activeSection === "Ficha técnica"
|
|
157
|
+
? "datasheets-layout"
|
|
158
|
+
: "descriptions-layout"
|
|
159
|
+
}
|
|
160
|
+
>
|
|
161
|
+
<Box
|
|
162
|
+
inputGroup={inputGroup}
|
|
163
|
+
dataInputs={dataInputs}
|
|
164
|
+
onChange={setUpdatedBoxData}
|
|
165
|
+
/>
|
|
166
|
+
</Container>
|
|
167
|
+
)
|
|
157
168
|
);
|
|
158
169
|
};
|
|
@@ -42,6 +42,7 @@ import { useCloseModal } from "../../../global-files/customHooks";
|
|
|
42
42
|
import { createMessage, sendMessage } from "../RetailerProductEdition/utils";
|
|
43
43
|
import { Modal } from "../../organisms/Modal";
|
|
44
44
|
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
45
|
+
import { Box } from "../../organisms/Box";
|
|
45
46
|
|
|
46
47
|
const reducerImages = (state, action) => {
|
|
47
48
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -143,6 +144,7 @@ export const ProviderProductEdition = ({
|
|
|
143
144
|
const [datasheets, setDatasheets] = useState([]);
|
|
144
145
|
const [images, setImages] = useReducer(reducerImages, {});
|
|
145
146
|
const [showModal, setShowModal] = useState(false);
|
|
147
|
+
const [boxData, setBoxData] = useState();
|
|
146
148
|
const { getRootProps, getInputProps } = useDropzone({
|
|
147
149
|
accept: "image/*",
|
|
148
150
|
noKeyboard: true,
|
|
@@ -680,11 +682,14 @@ export const ProviderProductEdition = ({
|
|
|
680
682
|
};
|
|
681
683
|
|
|
682
684
|
const saveDatasheets = async () => {
|
|
685
|
+
|
|
683
686
|
setLoading(true);
|
|
684
687
|
const dataObject = {
|
|
685
688
|
articleId: product?.id_article,
|
|
686
689
|
articleData: updatedDatasheets,
|
|
690
|
+
boxData,
|
|
687
691
|
};
|
|
692
|
+
console.log("boxData guardado", boxData);
|
|
688
693
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
689
694
|
try {
|
|
690
695
|
const res = await axios.put(
|
|
@@ -703,7 +708,8 @@ export const ProviderProductEdition = ({
|
|
|
703
708
|
}
|
|
704
709
|
} catch (error) {
|
|
705
710
|
console.log(error);
|
|
706
|
-
}
|
|
711
|
+
}
|
|
712
|
+
console.log(dataObject)
|
|
707
713
|
};
|
|
708
714
|
|
|
709
715
|
const updateImages = useCallback(async () => {
|
|
@@ -1453,21 +1459,28 @@ export const ProviderProductEdition = ({
|
|
|
1453
1459
|
)}
|
|
1454
1460
|
{activeTab === "Ficha técnica" &&
|
|
1455
1461
|
(product?.datasheet_status !== "NS" ? (
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1462
|
+
<div>
|
|
1463
|
+
{datasheets[0]?.data?.map((dataGroup, index) => (
|
|
1464
|
+
<InputGroup
|
|
1465
|
+
key={index + "-" + activeRetailer.name}
|
|
1466
|
+
articleId={product.id_article}
|
|
1467
|
+
version={version}
|
|
1468
|
+
activeSection={activeTab}
|
|
1469
|
+
inputGroup={dataGroup}
|
|
1470
|
+
dataInputs={datasheets[1]}
|
|
1471
|
+
updatedDatasheets={updatedDatasheets}
|
|
1472
|
+
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
1473
|
+
isShowbox={true}
|
|
1474
|
+
groupData={services[0][activeRetailer.id].data}
|
|
1475
|
+
setUpdatedBoxData={(e) => {
|
|
1476
|
+
setBoxData(e);
|
|
1477
|
+
console.log("UNO",e);
|
|
1478
|
+
}}
|
|
1479
|
+
index={index}
|
|
1480
|
+
//enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
|
|
1481
|
+
></InputGroup>
|
|
1482
|
+
))}
|
|
1483
|
+
</div>
|
|
1471
1484
|
) : (
|
|
1472
1485
|
<ScreenHeader
|
|
1473
1486
|
text={"No cuentas con este servicio"}
|