contentoh-components-library 21.4.41 → 21.4.44
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 +26 -5
- package/dist/components/molecules/BoxAttribute/styles.js +1 -1
- package/dist/components/organisms/Box/index.js +27 -3
- package/dist/components/organisms/BoxOnboarding/index.js +34 -11
- package/dist/components/organisms/InputGroup/index.js +29 -6
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +79 -145
- package/dist/components/pages/ProviderProductEdition/index.js +147 -125
- package/package.json +1 -1
- package/src/components/molecules/BoxAttribute/index.js +23 -16
- package/src/components/molecules/BoxAttribute/styles.js +1 -1
- package/src/components/organisms/Box/index.js +23 -2
- package/src/components/organisms/BoxOnboarding/index.js +41 -29
- package/src/components/organisms/InputGroup/index.js +19 -5
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +83 -174
- package/src/components/pages/ProviderProductEdition/index.js +18 -6
|
@@ -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 = {},
|
|
@@ -18,8 +19,15 @@ export const InputGroup = ({
|
|
|
18
19
|
version,
|
|
19
20
|
dinamicHeight,
|
|
20
21
|
compare,
|
|
21
|
-
|
|
22
|
+
groupData = [],
|
|
23
|
+
isShowbox,
|
|
24
|
+
index,
|
|
25
|
+
// boxOnboardingInput,
|
|
26
|
+
setUpdatedBoxData,
|
|
22
27
|
}) => {
|
|
28
|
+
|
|
29
|
+
console.log('groupData: ', typeof groupData);
|
|
30
|
+
console.log('groupData: ', groupData);
|
|
23
31
|
const inputTypeValue = (type) => {
|
|
24
32
|
switch (type) {
|
|
25
33
|
case "Booleano":
|
|
@@ -31,9 +39,14 @@ export const InputGroup = ({
|
|
|
31
39
|
}
|
|
32
40
|
};
|
|
33
41
|
|
|
34
|
-
const isOnboarding = (
|
|
35
|
-
const
|
|
36
|
-
|
|
42
|
+
const isOnboarding = () => {
|
|
43
|
+
const contentBoxAttribute = groupData.find(({dataGroup}) => dataGroup === 'Caja')
|
|
44
|
+
if(contentBoxAttribute) {
|
|
45
|
+
console.log('content box attribute');
|
|
46
|
+
} else {
|
|
47
|
+
console.log('dont content box attribute');
|
|
48
|
+
}
|
|
49
|
+
return contentBoxAttribute;
|
|
37
50
|
}
|
|
38
51
|
|
|
39
52
|
|
|
@@ -42,6 +55,7 @@ export const InputGroup = ({
|
|
|
42
55
|
return result;
|
|
43
56
|
};
|
|
44
57
|
|
|
58
|
+
|
|
45
59
|
return (
|
|
46
60
|
<>
|
|
47
61
|
<Container
|
|
@@ -142,7 +156,7 @@ export const InputGroup = ({
|
|
|
142
156
|
? "datasheets-layout"
|
|
143
157
|
: "descriptions-layout"
|
|
144
158
|
}>
|
|
145
|
-
{ isOnboarding && <Box/>}
|
|
159
|
+
{ isShowbox && isOnboarding && index==0 && <Box onChange={setUpdatedBoxData}/>}
|
|
146
160
|
</Container>
|
|
147
161
|
</>
|
|
148
162
|
);
|
|
@@ -17,137 +17,43 @@ ProviderProductEditionDefault.args = {
|
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
19
|
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLn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Selected: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
descriptions: null,
|
|
36
|
-
images: null,
|
|
24
|
+
id_article:39550,
|
|
25
|
+
upc:43654697,
|
|
26
|
+
name:"Campana de Cocina",
|
|
27
|
+
timestamp:"2023-08-04T22:23:40.000Z",
|
|
28
|
+
categoryName:"Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
|
|
29
|
+
id_category:287,
|
|
30
|
+
version:1,
|
|
31
|
+
retailersAvailable:[
|
|
32
|
+
{name:"The Home Depot Golden","id":58},
|
|
33
|
+
{name:"The Home Depot Onboarding","id":68}],
|
|
34
|
+
percentage:"89"
|
|
37
35
|
},
|
|
38
|
-
services: {
|
|
39
|
-
datasheets: 1,
|
|
40
|
-
descriptions: 1,
|
|
41
|
-
images: 1,
|
|
42
|
-
},
|
|
43
|
-
article: {
|
|
44
|
-
category: "Abarrotes|Abarrotes Secos|Frutos Secos",
|
|
45
|
-
company_name: "GRUPO BRAHMA",
|
|
46
|
-
country: "México",
|
|
47
|
-
id_category: "11",
|
|
48
|
-
id_datasheet_especialist: 54,
|
|
49
|
-
id_datasheet_facilitator: 52,
|
|
50
|
-
id_description_especialist: 54,
|
|
51
|
-
id_description_facilitator: 52,
|
|
52
|
-
id_images_especialist: 55,
|
|
53
|
-
id_images_facilitator: 53,
|
|
54
|
-
id_order: 15275,
|
|
55
|
-
id_article: 39485,
|
|
56
|
-
id_auditor: 37,
|
|
57
|
-
name: "Mix de nueces",
|
|
58
|
-
timestamp: "2023-07-14T21:03:19.000Z",
|
|
59
|
-
upc: "7543453453",
|
|
60
|
-
},
|
|
61
|
-
retailers: [
|
|
62
|
-
{
|
|
63
|
-
id: 34,
|
|
64
|
-
name: "San Pablo",
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
statusByRetailer: {
|
|
68
|
-
34: {
|
|
69
|
-
datasheet: "AA",
|
|
70
|
-
description: "AA",
|
|
71
|
-
images: "AA",
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
retailersAvailable: [
|
|
75
|
-
{
|
|
76
|
-
id: 34,
|
|
77
|
-
name: "San Pablo",
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
categoryName: "Abarrotes|Abarrotes Secos|Frutos Secos",
|
|
81
|
-
upc: "7543453453",
|
|
82
|
-
id_article: 39485,
|
|
83
|
-
id_order: 15275,
|
|
84
|
-
},
|
|
85
36
|
productToEdit: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
product:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
services: {
|
|
104
|
-
datasheets: 1,
|
|
105
|
-
descriptions: 1,
|
|
106
|
-
images: 1,
|
|
107
|
-
},
|
|
108
|
-
article: {
|
|
109
|
-
category: "Abarrotes|Abarrotes Secos|Frutos Secos",
|
|
110
|
-
company_name: "GRUPO BRAHMA",
|
|
111
|
-
country: "México",
|
|
112
|
-
id_category: "11",
|
|
113
|
-
id_datasheet_especialist: 54,
|
|
114
|
-
id_datasheet_facilitator: 52,
|
|
115
|
-
id_description_especialist: 54,
|
|
116
|
-
id_description_facilitator: 52,
|
|
117
|
-
id_images_especialist: 55,
|
|
118
|
-
id_images_facilitator: 53,
|
|
119
|
-
id_order: 15275,
|
|
120
|
-
id_article: 39485,
|
|
121
|
-
id_auditor: 37,
|
|
122
|
-
name: "Mix de nueces",
|
|
123
|
-
timestamp: "2023-07-14T21:03:19.000Z",
|
|
124
|
-
upc: "7543453453",
|
|
125
|
-
},
|
|
126
|
-
retailers: [
|
|
127
|
-
{
|
|
128
|
-
id: 34,
|
|
129
|
-
name: "San Pablo",
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
statusByRetailer: {
|
|
133
|
-
34: {
|
|
134
|
-
datasheet: "AA",
|
|
135
|
-
description: "AA",
|
|
136
|
-
images: "AA",
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
retailersAvailable: [
|
|
140
|
-
{
|
|
141
|
-
id: 34,
|
|
142
|
-
name: "San Pablo",
|
|
143
|
-
},
|
|
37
|
+
idCategory:287,
|
|
38
|
+
ArticleId:39550,
|
|
39
|
+
product:[{
|
|
40
|
+
id_article:39550,
|
|
41
|
+
upc:43654697,
|
|
42
|
+
name:"Campana de Cocina",
|
|
43
|
+
timestamp:"2023-08-04T22:23:40.000Z",
|
|
44
|
+
categoryName:"Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
|
|
45
|
+
id_category:287,
|
|
46
|
+
version:1,
|
|
47
|
+
retailersAvailable:[
|
|
48
|
+
{name:"The Home Depot Golden",
|
|
49
|
+
id:58,
|
|
50
|
+
percentage:100},
|
|
51
|
+
{name:"The Home Depot Onboarding",
|
|
52
|
+
id:68,
|
|
53
|
+
percentage:78}
|
|
144
54
|
],
|
|
145
|
-
|
|
146
|
-
upc: "7543453453",
|
|
147
|
-
id_article: 39485,
|
|
148
|
-
id_order: 15275,
|
|
55
|
+
percentage:"89"}]
|
|
149
56
|
},
|
|
150
|
-
},
|
|
151
57
|
location: {
|
|
152
58
|
pathname: "/EditProducts",
|
|
153
59
|
search: "",
|
|
@@ -160,54 +66,57 @@ ProviderProductEditionDefault.args = {
|
|
|
160
66
|
key: "24vwut",
|
|
161
67
|
},
|
|
162
68
|
user: {
|
|
163
|
-
id_user:
|
|
164
|
-
name:
|
|
165
|
-
last_name:
|
|
166
|
-
email:
|
|
167
|
-
position:
|
|
168
|
-
telephone:
|
|
169
|
-
country:
|
|
170
|
-
id_company:
|
|
171
|
-
id_cognito:
|
|
172
|
-
birth_Date:
|
|
173
|
-
about_me:
|
|
174
|
-
zip_code:
|
|
175
|
-
address:
|
|
176
|
-
job:
|
|
177
|
-
id_stripe:
|
|
178
|
-
id_role:
|
|
179
|
-
active:
|
|
180
|
-
is_retailer:
|
|
181
|
-
email_notify:
|
|
182
|
-
is_user_tech:
|
|
183
|
-
membership:
|
|
184
|
-
|
|
185
|
-
start_date:
|
|
186
|
-
end_date:
|
|
187
|
-
planID:
|
|
188
|
-
plan:
|
|
189
|
-
name:
|
|
190
|
-
user_limit:
|
|
191
|
-
products_limit:
|
|
192
|
-
type:
|
|
193
|
-
|
|
194
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-28/28.png?1693338334183",
|
|
195
|
-
},
|
|
69
|
+
id_user:191,
|
|
70
|
+
name:"Demo",
|
|
71
|
+
last_name:"Demo",
|
|
72
|
+
email:"merchants24feb@allfreemail.net",
|
|
73
|
+
position:"Test",
|
|
74
|
+
telephone:"+52123456789",
|
|
75
|
+
country:"México",
|
|
76
|
+
id_company:923,
|
|
77
|
+
id_cognito:"c3cd160c-76c2-497c-9357-5ef949307e1e",
|
|
78
|
+
birth_Date:null,
|
|
79
|
+
about_me:null,
|
|
80
|
+
zip_code:null,
|
|
81
|
+
address:null,
|
|
82
|
+
job:null,
|
|
83
|
+
id_stripe:null,
|
|
84
|
+
id_role:0,
|
|
85
|
+
active:1,
|
|
86
|
+
is_retailer:0,
|
|
87
|
+
email_notify:1,
|
|
88
|
+
is_user_tech:null,
|
|
89
|
+
membership:
|
|
90
|
+
{id:114,
|
|
91
|
+
start_date:"2023-02-24T18:14:43.000Z",
|
|
92
|
+
end_date:"2024-02-24T18:14:43.000Z",
|
|
93
|
+
planID:8,
|
|
94
|
+
plan:"prod_KtlhECVSFG2iro",
|
|
95
|
+
name:"Plan Pro",
|
|
96
|
+
user_limit:"50",
|
|
97
|
+
products_limit:"5000",
|
|
98
|
+
type:"Enterprise"},
|
|
99
|
+
src:"https://content-management-profile.s3.amazonaws.com/id-191/191.png?1697171804447"},
|
|
196
100
|
company: {
|
|
197
|
-
id_company:
|
|
198
|
-
trade_name:
|
|
199
|
-
company_name:
|
|
200
|
-
rfc:
|
|
201
|
-
adress:
|
|
202
|
-
about_company:
|
|
203
|
-
telephone:
|
|
204
|
-
web_site:
|
|
205
|
-
zip_code:
|
|
206
|
-
email:
|
|
207
|
-
social_link:
|
|
208
|
-
is_retailer:
|
|
209
|
-
financedRetailers:
|
|
210
|
-
|
|
211
|
-
|
|
101
|
+
id_company:923,
|
|
102
|
+
trade_name:"Demo",
|
|
103
|
+
company_name:"Demo",
|
|
104
|
+
rfc:"Demo",
|
|
105
|
+
adress:"Demo",
|
|
106
|
+
about_company:null,
|
|
107
|
+
telephone:null,
|
|
108
|
+
web_site:null,
|
|
109
|
+
zip_code:null,
|
|
110
|
+
email:null,
|
|
111
|
+
social_link:null,
|
|
112
|
+
is_retailer:0,
|
|
113
|
+
financedRetailers:
|
|
114
|
+
[{id:68,
|
|
115
|
+
name:"The Home Depot Onboarding",
|
|
116
|
+
country:"México",
|
|
117
|
+
id_region:1,
|
|
118
|
+
active:1,
|
|
119
|
+
flow:1}],
|
|
120
|
+
retailers:[{id:68,name:"The Home Depot Onboarding",country:"México",id_region:1,"active":1,flow:1}]},
|
|
212
121
|
showSurvey: (v) => v && alert("se muestra"),
|
|
213
122
|
};
|
|
@@ -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,
|
|
@@ -596,6 +598,7 @@ export const ProviderProductEdition = ({
|
|
|
596
598
|
);
|
|
597
599
|
setActivePercentage(Math.round(activeRetailer?.percentage, 0));
|
|
598
600
|
|
|
601
|
+
console.log("loadInputs: ", services[0]);
|
|
599
602
|
const datagroups = services[0][activeRetailer.id];
|
|
600
603
|
const inputs = services[0]?.inputs;
|
|
601
604
|
const descriptions = services[1]?.filter(
|
|
@@ -679,11 +682,14 @@ export const ProviderProductEdition = ({
|
|
|
679
682
|
};
|
|
680
683
|
|
|
681
684
|
const saveDatasheets = async () => {
|
|
685
|
+
|
|
682
686
|
setLoading(true);
|
|
683
687
|
const dataObject = {
|
|
684
688
|
articleId: product?.id_article,
|
|
685
689
|
articleData: updatedDatasheets,
|
|
690
|
+
boxData
|
|
686
691
|
};
|
|
692
|
+
console.log("boxData guardado",boxData)
|
|
687
693
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
688
694
|
try {
|
|
689
695
|
const res = await axios.put(
|
|
@@ -702,7 +708,8 @@ export const ProviderProductEdition = ({
|
|
|
702
708
|
}
|
|
703
709
|
} catch (error) {
|
|
704
710
|
console.log(error);
|
|
705
|
-
}
|
|
711
|
+
}
|
|
712
|
+
console.log(dataObject)
|
|
706
713
|
};
|
|
707
714
|
|
|
708
715
|
const updateImages = useCallback(async () => {
|
|
@@ -1451,8 +1458,8 @@ export const ProviderProductEdition = ({
|
|
|
1451
1458
|
/>
|
|
1452
1459
|
)}
|
|
1453
1460
|
{activeTab === "Ficha técnica" &&
|
|
1454
|
-
(product?.datasheet_status !== "NS" ?
|
|
1455
|
-
datasheets[0]?.data?.map((dataGroup, index) => (
|
|
1461
|
+
(product?.datasheet_status !== "NS" ? <div>
|
|
1462
|
+
{datasheets[0]?.data?.map((dataGroup, index) => (
|
|
1456
1463
|
<InputGroup
|
|
1457
1464
|
key={index + "-" + activeRetailer.name}
|
|
1458
1465
|
articleId={product.id_article}
|
|
@@ -1462,10 +1469,14 @@ export const ProviderProductEdition = ({
|
|
|
1462
1469
|
dataInputs={datasheets[1]}
|
|
1463
1470
|
updatedDatasheets={updatedDatasheets}
|
|
1464
1471
|
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
1472
|
+
isShowbox={true}
|
|
1473
|
+
groupData = { services[0][activeRetailer.id].data }
|
|
1474
|
+
setUpdatedBoxData={e=>{ setBoxData(e) }}
|
|
1475
|
+
index={index}
|
|
1465
1476
|
//enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
|
|
1466
|
-
|
|
1467
|
-
))
|
|
1468
|
-
|
|
1477
|
+
></InputGroup>
|
|
1478
|
+
))}
|
|
1479
|
+
</div>: (
|
|
1469
1480
|
<ScreenHeader
|
|
1470
1481
|
text={"No cuentas con este servicio"}
|
|
1471
1482
|
headerType={"input-name-header"}
|
|
@@ -1480,6 +1491,7 @@ export const ProviderProductEdition = ({
|
|
|
1480
1491
|
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
1481
1492
|
articleId={product?.id_article}
|
|
1482
1493
|
version={version}
|
|
1494
|
+
isShowbox={false}
|
|
1483
1495
|
dinamicHeight={true}
|
|
1484
1496
|
/>
|
|
1485
1497
|
) : (
|