contentoh-components-library 21.1.87 → 21.1.90

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.
@@ -16,77 +16,114 @@ RetailerProductEditionDefault.args = {
16
16
  Imágenes: false,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImE2YzRkM2Q2LTI0YTQtNDFkNC1hZDBmLWQwODc0MzhhYjViNiIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJmZTM3NjZmNS0zY2E0LTQ2N2MtOTIxMS0yM2Y0NWQ1ZWU4NjgiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1ODk5MTc2NSwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY1ODk5NTM2NSwiaWF0IjoxNjU4OTkxNzY1LCJlbWFpbCI6ImV0Y0Bjb250ZW50b2guY29tIn0.bQDE_eVpwSBWXqgbX2bicpPTgAoG8mfeA_P0l92v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YW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjU5NTAwNjMyLCJpYXQiOjE2NTk0OTcwMzIsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.YMnbVYuC12JcOT0E1FRioMGyUol_eyu9RCfwa0fwB-K9oGTkrOSLbz8jK4sNI4QRgkr5eGqwF2KASmo1DGxOUwgV2s_-BM_tJpKHEcVuQ7z0X46C5EPahSxNPLuzs22WUnf97uoGYj9IrToWfoxV_6zi1Z1jshXwZ-1Kc9zeZvlFnyGeVyLS6uavMxcD06KNLKdWenQVFGcj6LZRjB-Oy-APMF29M1oggGqrsVdY3N8E9otUkws2yYA35dpHd1zHZNEbsX6cgOemGxog7h2f6NQmNXPrnmH4ZQTLS8sLtD_UOEu9_HAdsXLZizBDKQ95cC6be2p4w_sXj22AUw5BKg",
20
20
  productSelected: {
21
21
  services: {
22
- datasheets: 1,
23
- descriptions: 1,
22
+ datasheets: 0,
23
+ descriptions: 0,
24
24
  images: 1,
25
25
  },
26
- orderId: 2426,
27
- status: "AS",
28
- datasheet_status: "AS",
26
+ orderId: 82,
27
+ status: "AA",
28
+ datasheet_status: "NS",
29
29
  prio: "none",
30
30
  version: 2,
31
- description_status: "AS",
32
- images_status: "AS",
31
+ description_status: "NS",
32
+ images_status: "AA",
33
33
  article: {
34
- id_article: 78738,
35
- id_category: "2427",
36
- name: "INTERRUPTOR TERMOMAGNETICO IUSA 2P 15A",
37
- upc: "157126",
38
- timestamp: "2022-08-01T18:28:05.000Z",
39
- id_user: 651,
34
+ id_article: 55147,
35
+ id_category: "157",
36
+ name: "Lavatrastes Axion ",
37
+ upc: "977358",
38
+ timestamp: "2022-06-21T17:37:05.000Z",
39
+ id_user: 28,
40
40
  status: "NULL",
41
41
  active: 1,
42
- company_id: 388,
43
- SKU: null,
44
- Descripcion: null,
45
- Proveedor: null,
46
- id_proveedor: 0,
47
- company_name: "",
48
- country: null,
49
- id_order: 2426,
50
- id_datasheet_especialist: 1248,
51
- id_datasheet_facilitator: 1252,
52
- id_description_especialist: 1248,
53
- id_description_facilitator: 1252,
54
- id_images_especialist: 1251,
55
- id_images_facilitator: 1286,
56
- id_auditor: 1254,
42
+ company_id: 1,
43
+ company_name: "COMPANY DEV",
44
+ country: "México",
45
+ id_order: 82,
46
+ id_datasheet_especialist: 54,
47
+ id_datasheet_facilitator: 52,
48
+ id_description_especialist: 54,
49
+ id_description_facilitator: 52,
50
+ id_images_especialist: 55,
51
+ id_images_facilitator: 53,
52
+ id_auditor: 30,
57
53
  id_recepcionist: null,
58
54
  category:
59
- "Eléctrico|Centros de Carga e Interruptores|Interruptores de Seguridad",
60
- missingAttributes: null,
61
- missingDescriptions: null,
62
- missingImages: null,
55
+ "Consumibles|Productos de Limpieza y Lavandería|Jabones y Lavatrastes",
56
+ missingAttributes: 0,
57
+ missingDescriptions: 0,
58
+ missingImages: 0,
63
59
  },
64
60
  retailers: [
65
61
  {
66
- id: 58,
67
- name: "The Home Depot Golden",
68
- country: "México",
69
- id_region: 1,
70
- active: 1,
62
+ id: 3,
63
+ name: "Sam´s Club",
64
+ },
65
+ {
66
+ id: 4,
67
+ name: "Walmart Super y Superama",
68
+ },
69
+ {
70
+ id: 5,
71
+ name: "Chedraui",
72
+ },
73
+ {
74
+ id: 6,
75
+ name: "HEB",
76
+ },
77
+ {
78
+ id: 12,
79
+ name: "La Comer",
80
+ },
81
+ {
82
+ id: 13,
83
+ name: "Soriana",
84
+ },
85
+ {
86
+ id: 17,
87
+ name: "Genérico",
88
+ },
89
+ {
90
+ id: 20,
91
+ name: "Cornershop",
92
+ },
93
+ {
94
+ id: 26,
95
+ name: "Mercado Libre",
96
+ },
97
+ {
98
+ id: 34,
99
+ name: "San Pablo",
100
+ },
101
+ {
102
+ id: 38,
103
+ name: "Del Sol",
104
+ },
105
+ {
106
+ id: 64,
107
+ name: "Cali",
71
108
  },
72
109
  ],
73
- country: null,
74
- upc: "157126",
110
+ country: "México",
111
+ upc: "977358",
75
112
  },
76
113
  location: {
77
114
  product: { articleId: 109485, versionId: 3 },
78
115
  },
79
116
  user: {
80
- id_user: 460,
81
- name: "Ismael",
82
- last_name: "López",
83
- email: "ilopez@contentoh.com",
84
- position: "Desarrollador",
117
+ id_user: 30,
118
+ name: "Admin",
119
+ last_name: "Ulises",
120
+ email: "salmeron.5@hotmail.com",
121
+ position: "Admin",
85
122
  telephone: null,
86
123
  country: "México",
87
- id_company: 254,
88
- id_cognito: "9d0cc5c8-a89e-4bdd-9e2d-358a01cc9a62",
89
- birth_Date: "1997-08-15T00:00:00.000Z",
124
+ id_company: 2,
125
+ id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
126
+ birth_Date: null,
90
127
  about_me: null,
91
128
  zip_code: null,
92
129
  address: null,
@@ -95,18 +132,18 @@ RetailerProductEditionDefault.args = {
95
132
  id_role: 1,
96
133
  active: 1,
97
134
  is_retailer: 0,
98
- email_notify: null,
135
+ email_notify: 0,
99
136
  membership: {
100
- id: 750,
101
- start_date: "2022-01-07T21:32:54.000Z",
102
- end_date: "2023-01-07T21:32:54.000Z",
103
- planID: 6,
104
- plan: "prod_KvGd6YSTJyR3AP",
105
- name: "Plan Small",
106
- user_limit: "10",
107
- products_limit: "1000",
108
- type: "Enterprise",
137
+ id: 2,
138
+ start_date: "2021-11-05T02:35:12.000Z",
139
+ end_date: "2022-11-05T02:34:49.000Z",
140
+ planID: 1,
141
+ plan: "prod_KtkvuFFLpOdP6e",
142
+ name: "Plan Free",
143
+ user_limit: "1",
144
+ products_limit: "3",
145
+ type: "PyMES",
109
146
  },
110
- src: "https://content-management-profile-prod.s3.amazonaws.com/id-460/460.png?1659463389000",
147
+ src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1659497033479",
111
148
  },
112
149
  };
@@ -35,10 +35,24 @@ import { useCloseModal } from "../../../global-files/customHooks";
35
35
  import { CreateVersion } from "../../organisms/CreateVersion";
36
36
 
37
37
  const reducerImages = (state, action) => {
38
- let { values, attrForImgs } = state;
38
+ let { values, attrForImgs, inputsByRetailer } = state;
39
39
  switch (action.action) {
40
40
  case "init":
41
- return action.init;
41
+ const newInputsByRetailer = {};
42
+ action?.init?.inputsByRetailer?.forEach((inputs) => {
43
+ inputs?.forEach((input) => {
44
+ if (!newInputsByRetailer[`${input.id_retailer}`])
45
+ newInputsByRetailer[`${input.id_retailer}`] = [];
46
+ newInputsByRetailer[`${input.id_retailer}`].push(input);
47
+ });
48
+ });
49
+ inputsByRetailer = newInputsByRetailer;
50
+ return {
51
+ ...action.init,
52
+ inputsByRetailer,
53
+ valuesInitial: action.init.values,
54
+ inputsInitial: action.init.inputs,
55
+ };
42
56
  case "addImg":
43
57
  values = [...values, action.img];
44
58
  return { ...state, values };
@@ -57,6 +71,25 @@ const reducerImages = (state, action) => {
57
71
  (value) => action.selectedImages.indexOf(value) === -1
58
72
  );
59
73
  return { ...state, values };
74
+ case "orderImages": {
75
+ let { inputsByRetailer, valuesInitial, inputsInitial, inputs } = state;
76
+ const orderedImages = [];
77
+ const imageIdArray = [];
78
+ action.retailerId &&
79
+ inputsByRetailer[action.retailerId]?.filter((input) => {
80
+ imageIdArray.push(input.id_image);
81
+ valuesInitial.forEach((value) => {
82
+ if (value.image_id === input.id_image) orderedImages.push(value);
83
+ });
84
+ });
85
+
86
+ inputs = inputsInitial?.filter((input) =>
87
+ imageIdArray.includes(input.id)
88
+ );
89
+
90
+ values = orderedImages.length > 0 ? orderedImages : valuesInitial;
91
+ return { ...state, values, inputs };
92
+ }
60
93
  default:
61
94
  return state;
62
95
  }
@@ -356,6 +389,7 @@ export const RetailerProductEdition = ({
356
389
  setDatasheets([datagroups, inputs]);
357
390
  setDescriptions(descriptions);
358
391
  }
392
+ setImages({ action: "orderImages", retailerId: activeRetailer.id });
359
393
  }, [activeRetailer, services]);
360
394
 
361
395
  const thumbs = () => {
@@ -371,7 +405,7 @@ export const RetailerProductEdition = ({
371
405
  return images?.values?.map((image, index) => (
372
406
  <GalleryElement
373
407
  setCheckAll={setCheckAll}
374
- key={index}
408
+ key={index + "-" + imageType.name}
375
409
  image={image}
376
410
  gridLayout={imageLayout}
377
411
  id={"gallery-element-" + index}
@@ -461,7 +495,7 @@ export const RetailerProductEdition = ({
461
495
  value: e?.id,
462
496
  name: e?.name,
463
497
  required: e?.required,
464
- active: images?.values.some((value) => value?.image_id === e?.id),
498
+ active: images?.values?.some((value) => value?.image_id === e?.id),
465
499
  }));
466
500
  setSocketType(imageInputs);
467
501
  }, [images]);
@@ -1143,6 +1177,8 @@ export const RetailerProductEdition = ({
1143
1177
  product?.services?.images === 1 && updateImages()
1144
1178
  }
1145
1179
  showSaveButton={auditorAssigned() || userAssigned()}
1180
+ setShowVersionSelector={setShowVersionSelector}
1181
+ version={version}
1146
1182
  />
1147
1183
  </div>
1148
1184
  <div className="product-information">