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.
@@ -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
- dataGroup=12,
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 = (dataGroup, group) => {
35
- const result = dataGroup === group;
36
- return result;
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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oxQHL5Ct9_iKQMJMRFie7Xv0xnyS0qZ6QHK4Q2A9OHsnDkAuumALZJcE19Zh6VgSitgWrZiz3x5Text4Q-U-R48NUAzUFirAzYZzJN_fCme5pGf1AnUaZjeUjPsmrV5TBVzPEYwXO0KG8lYjL8id80D7tbGs28ZIK6B4rf3-eqI_ngmBB4CjQ",
20
- articleId: 238,
21
- category: 846,
22
- version: 2,
20
+ articleId: 39550,
21
+ category: 287,
22
+ version: 1,
23
23
  productSelected: {
24
- orderId: 15275,
25
- status: "AA",
26
- datasheet_status: "AA",
27
- prio: "none",
28
- version: 3,
29
- description_status: "AA",
30
- images_status: "AA",
31
- brand: null,
32
- retailerOrder: 0,
33
- missing: {
34
- datasheet: null,
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
- ArticleId: 39485,
87
- idCategory: "11",
88
- product: {
89
- orderId: 15275,
90
- status: "AA",
91
- datasheet_status: "AA",
92
- prio: "none",
93
- version: 3,
94
- description_status: "AA",
95
- images_status: "AA",
96
- brand: null,
97
- retailerOrder: 0,
98
- missing: {
99
- datasheet: null,
100
- descriptions: null,
101
- images: null,
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
- categoryName: "Abarrotes|Abarrotes Secos|Frutos Secos",
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: 28,
164
- name: "Ismael",
165
- last_name: "López",
166
- email: "ilopez@contentoh.com",
167
- position: "Test States",
168
- telephone: "+523111366336",
169
- country: "México",
170
- id_company: 1,
171
- id_cognito: "f5927f8e-cbf7-4922-9e09-e69ec0b2731a",
172
- birth_Date: null,
173
- about_me: "",
174
- zip_code: "",
175
- address: "",
176
- job: "",
177
- id_stripe: "cus_KuEt6R6vwmN09f",
178
- id_role: 0,
179
- active: 1,
180
- is_retailer: 0,
181
- email_notify: 1,
182
- is_user_tech: "ADMIN-AS",
183
- membership: {
184
- id: 76,
185
- start_date: "2022-01-18T17:25:35.000Z",
186
- end_date: "2023-01-18T17:25:35.000Z",
187
- planID: 8,
188
- plan: "prod_KtlhECVSFG2iro",
189
- name: "Plan Pro",
190
- user_limit: "50",
191
- products_limit: "5000",
192
- type: "Enterprise",
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: 1,
198
- trade_name: "GRUPO BRAHMA",
199
- company_name: "GRUPO BRAHMA",
200
- rfc: "XAXX010101000",
201
- adress: "AA",
202
- about_company: "",
203
- telephone: "",
204
- web_site: "",
205
- zip_code: "",
206
- email: null,
207
- social_link: "",
208
- is_retailer: 0,
209
- financedRetailers: [],
210
- retailers: [],
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
  ) : (