contentoh-components-library 21.1.88 → 21.1.91
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/InputFormatter/index.js +4 -3
- 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 +30 -30
- package/dist/components/pages/RetailerProductEdition/index.js +61 -11
- package/package.json +1 -1
- package/src/components/atoms/InputFormatter/index.js +4 -7
- 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 +30 -31
- package/src/components/pages/RetailerProductEdition/index.js +40 -4
|
@@ -16,50 +16,49 @@ RetailerProductEditionDefault.args = {
|
|
|
16
16
|
Imágenes: false,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"
|
|
19
|
+
"eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIyM2EzZjQ5Ni00ZTM4LTRlMTItOWJmNS03ZjkwYjc3YTJmMzUiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwiY29nbml0bzp1c2VybmFtZSI6IjIzYTNmNDk2LTRlMzgtNGUxMi05YmY1LTdmOTBiNzdhMmYzNSIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiJiYjY1ODZhYS02MzQ5LTQ2ZDgtOTk1Ni00ZGQ3NGEzY2FmODYiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1OTY0OTAyOCwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY1OTY1MjYyOCwiaWF0IjoxNjU5NjQ5MDI4LCJlbWFpbCI6ImxhZGlib2g3ODVAbWkxNjYuY29tIn0.OWVf7QX5rQpQAPmqhwGG14kDJhuG051MjYdv6TVMoEi5LrwmamTk8RJiDqgLTOZOgadlQoAHq27w5LnbYqDfQRqJYfj0kh0qTg2lA7xIZCCd-ljvvMtW6XGmd2_XoEhGkrjnZkniBiOaYSpNW_qTV0FiuWNh4enI7k4kl3x48QEPG9Jd7-4q4I21xVEBD1hy_TYhKQzS7H0FP487W89qOMZhOfmyVQkEQjjuzfedJTunm5SmF1AVA7Dvt2bcBMQOPrcB3c5veUtsxf7ta9yS9wGlb8vfcizczNaN5OLATNjdfHMnEUdOYiEBmnOXzcsnnz4mykearBqYEwp3-3XijA",
|
|
20
20
|
productSelected: {
|
|
21
21
|
services: {
|
|
22
22
|
datasheets: 1,
|
|
23
23
|
descriptions: 1,
|
|
24
24
|
images: 1,
|
|
25
25
|
},
|
|
26
|
-
orderId:
|
|
27
|
-
status: "
|
|
28
|
-
datasheet_status: "
|
|
26
|
+
orderId: 2012,
|
|
27
|
+
status: "ACA",
|
|
28
|
+
datasheet_status: "ACA",
|
|
29
29
|
prio: "none",
|
|
30
30
|
version: 2,
|
|
31
|
-
description_status: "
|
|
32
|
-
images_status: "
|
|
31
|
+
description_status: "ACA",
|
|
32
|
+
images_status: "ACA",
|
|
33
33
|
article: {
|
|
34
|
-
id_article:
|
|
35
|
-
id_category: "
|
|
36
|
-
name: "
|
|
37
|
-
upc: "
|
|
38
|
-
timestamp: "2022-
|
|
39
|
-
id_user:
|
|
34
|
+
id_article: 77106,
|
|
35
|
+
id_category: "2898",
|
|
36
|
+
name: "INFLABLE CATRINA 2.13M HALLOWEEN",
|
|
37
|
+
upc: "163556",
|
|
38
|
+
timestamp: "2022-07-07T17:01:17.000Z",
|
|
39
|
+
id_user: 1195,
|
|
40
40
|
status: "NULL",
|
|
41
41
|
active: 1,
|
|
42
|
-
company_id:
|
|
42
|
+
company_id: 657,
|
|
43
43
|
SKU: null,
|
|
44
44
|
Descripcion: null,
|
|
45
45
|
Proveedor: null,
|
|
46
46
|
id_proveedor: 0,
|
|
47
47
|
company_name: "",
|
|
48
48
|
country: null,
|
|
49
|
-
id_order:
|
|
49
|
+
id_order: 2012,
|
|
50
50
|
id_datasheet_especialist: 1248,
|
|
51
51
|
id_datasheet_facilitator: 1252,
|
|
52
|
-
id_description_especialist:
|
|
52
|
+
id_description_especialist: 334,
|
|
53
53
|
id_description_facilitator: 1252,
|
|
54
|
-
id_images_especialist:
|
|
54
|
+
id_images_especialist: 1250,
|
|
55
55
|
id_images_facilitator: 1286,
|
|
56
56
|
id_auditor: 1254,
|
|
57
57
|
id_recepcionist: null,
|
|
58
|
-
category:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
missingImages: null,
|
|
58
|
+
category: "Hallowen|Decoración e Inflables|Decoración e Inflables",
|
|
59
|
+
missingAttributes: 3,
|
|
60
|
+
missingDescriptions: 0,
|
|
61
|
+
missingImages: -2,
|
|
63
62
|
},
|
|
64
63
|
retailers: [
|
|
65
64
|
{
|
|
@@ -71,22 +70,22 @@ RetailerProductEditionDefault.args = {
|
|
|
71
70
|
},
|
|
72
71
|
],
|
|
73
72
|
country: null,
|
|
74
|
-
upc: "
|
|
73
|
+
upc: "163556",
|
|
75
74
|
},
|
|
76
75
|
location: {
|
|
77
76
|
product: { articleId: 109485, versionId: 3 },
|
|
78
77
|
},
|
|
79
78
|
user: {
|
|
80
|
-
id_user:
|
|
81
|
-
name: "
|
|
82
|
-
last_name: "
|
|
83
|
-
email: "
|
|
84
|
-
position: "
|
|
79
|
+
id_user: 425,
|
|
80
|
+
name: "Auditor QA",
|
|
81
|
+
last_name: " ",
|
|
82
|
+
email: "ladiboh785@mi166.com",
|
|
83
|
+
position: "Tester",
|
|
85
84
|
telephone: null,
|
|
86
|
-
country:
|
|
85
|
+
country: null,
|
|
87
86
|
id_company: 254,
|
|
88
|
-
id_cognito: "
|
|
89
|
-
birth_Date:
|
|
87
|
+
id_cognito: "23a3f496-4e38-4e12-9bf5-7f90b77a2f35",
|
|
88
|
+
birth_Date: null,
|
|
90
89
|
about_me: null,
|
|
91
90
|
zip_code: null,
|
|
92
91
|
address: null,
|
|
@@ -107,6 +106,6 @@ RetailerProductEditionDefault.args = {
|
|
|
107
106
|
products_limit: "1000",
|
|
108
107
|
type: "Enterprise",
|
|
109
108
|
},
|
|
110
|
-
src: "https://content-management-profile-prod.s3.amazonaws.com/id-
|
|
109
|
+
src: "https://content-management-profile-prod.s3.amazonaws.com/id-425/425.png?1659649029658",
|
|
111
110
|
},
|
|
112
111
|
};
|
|
@@ -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">
|