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.
- package/dist/components/atoms/Select/index.js +1 -1
- package/dist/components/molecules/TableHeader/index.js +6 -2
- package/dist/components/organisms/ImageDataTable/index.js +6 -2
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +120 -71
- package/dist/components/pages/ProviderProductEdition/index.js +61 -7
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +85 -59
- package/dist/components/pages/RetailerProductEdition/index.js +61 -11
- package/package.json +1 -1
- package/src/components/atoms/Select/index.js +1 -1
- package/src/components/molecules/TableHeader/index.js +4 -0
- package/src/components/organisms/ImageDataTable/index.js +4 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +144 -87
- package/src/components/pages/ProviderProductEdition/index.js +46 -5
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +96 -59
- package/src/components/pages/RetailerProductEdition/index.js +40 -4
|
@@ -16,77 +16,114 @@ RetailerProductEditionDefault.args = {
|
|
|
16
16
|
Imágenes: false,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
19
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3Q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,
|
|
25
25
|
},
|
|
26
|
-
orderId:
|
|
27
|
-
status: "
|
|
28
|
-
datasheet_status: "
|
|
26
|
+
orderId: 82,
|
|
27
|
+
status: "AA",
|
|
28
|
+
datasheet_status: "NS",
|
|
29
29
|
prio: "none",
|
|
30
30
|
version: 2,
|
|
31
|
-
description_status: "
|
|
32
|
-
images_status: "
|
|
31
|
+
description_status: "NS",
|
|
32
|
+
images_status: "AA",
|
|
33
33
|
article: {
|
|
34
|
-
id_article:
|
|
35
|
-
id_category: "
|
|
36
|
-
name: "
|
|
37
|
-
upc: "
|
|
38
|
-
timestamp: "2022-
|
|
39
|
-
id_user:
|
|
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:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
"
|
|
60
|
-
missingAttributes:
|
|
61
|
-
missingDescriptions:
|
|
62
|
-
missingImages:
|
|
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:
|
|
67
|
-
name: "
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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:
|
|
74
|
-
upc: "
|
|
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:
|
|
81
|
-
name: "
|
|
82
|
-
last_name: "
|
|
83
|
-
email: "
|
|
84
|
-
position: "
|
|
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:
|
|
88
|
-
id_cognito: "
|
|
89
|
-
birth_Date:
|
|
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:
|
|
135
|
+
email_notify: 0,
|
|
99
136
|
membership: {
|
|
100
|
-
id:
|
|
101
|
-
start_date: "
|
|
102
|
-
end_date: "
|
|
103
|
-
planID:
|
|
104
|
-
plan: "
|
|
105
|
-
name: "Plan
|
|
106
|
-
user_limit: "
|
|
107
|
-
products_limit: "
|
|
108
|
-
type: "
|
|
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
|
|
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
|
-
|
|
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
|
|
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">
|