contentoh-components-library 21.4.83 → 21.4.85
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/TabSection/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +8 -3
- package/dist/components/organisms/EditGroup/index.js +0 -11
- package/dist/components/organisms/FullProductNameHeader/index.js +3 -1
- package/dist/components/organisms/VersionSelector/index.js +101 -169
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +55 -74
- package/dist/components/pages/ProviderProductEdition/index.js +88 -66
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +47 -52
- package/dist/components/pages/RetailerProductEdition/index.js +101 -177
- package/dist/global-files/data.js +11 -26
- package/package.json +2 -1
- package/src/components/atoms/GeneralButton/styles.js +1 -0
- package/src/components/atoms/ObservationFlag/ObservationFlag.stories.js +20 -0
- package/src/components/atoms/ObservationFlag/index.js +33 -0
- package/src/components/atoms/ObservationFlag/styles.js +3 -0
- package/src/components/atoms/TabSection/index.js +1 -1
- package/src/components/atoms/TabSection/styles.js +1 -4
- package/src/components/molecules/ProductNameHeader/index.js +5 -1
- package/src/components/organisms/EditGroup/index.js +0 -8
- package/src/components/organisms/FullProductNameHeader/index.js +2 -0
- package/src/components/organisms/VersionSelector/index.js +100 -100
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +73 -86
- package/src/components/pages/ProviderProductEdition/index.js +38 -23
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +48 -52
- package/src/components/pages/RetailerProductEdition/index.js +32 -144
- package/src/global-files/data.js +7 -33
|
@@ -3,6 +3,7 @@ import { ScreenHeader } from "../../atoms/ScreenHeader/index";
|
|
|
3
3
|
import { Status } from "../../atoms/Status/index";
|
|
4
4
|
import { ProgressBar } from "../../atoms/ProgressBar/index";
|
|
5
5
|
import { PriorityFlag } from "../../atoms/PriorityFlag/index";
|
|
6
|
+
import { ObservationFlag } from "../../atoms/ObservationFlag/index";
|
|
6
7
|
|
|
7
8
|
export const ProductNameHeader = ({
|
|
8
9
|
productName,
|
|
@@ -10,7 +11,9 @@ export const ProductNameHeader = ({
|
|
|
10
11
|
priority,
|
|
11
12
|
date,
|
|
12
13
|
percentRequired,
|
|
14
|
+
productObservation
|
|
13
15
|
}) => {
|
|
16
|
+
const typeFlag = productObservation!== null && productObservation !== "" ? "high" : "low";
|
|
14
17
|
return (
|
|
15
18
|
<Container>
|
|
16
19
|
<ScreenHeader headerType={"product-name-header"} text={productName} />
|
|
@@ -20,7 +23,8 @@ export const ProductNameHeader = ({
|
|
|
20
23
|
progressBarType={statusType}
|
|
21
24
|
percentRequired={percentRequired}
|
|
22
25
|
/>
|
|
23
|
-
<PriorityFlag priority={priority} />
|
|
26
|
+
{/* <PriorityFlag priority={priority} /> */}
|
|
27
|
+
<ObservationFlag observation={typeFlag}contentObservation={productObservation}/>
|
|
24
28
|
<ScreenHeader headerType={"date-header"} text={date} />
|
|
25
29
|
</Container>
|
|
26
30
|
);
|
|
@@ -43,7 +43,6 @@ export const EditGroup = ({ token, show, onClose }) => {
|
|
|
43
43
|
const [newGroup, setNewGroup] = useState(false);
|
|
44
44
|
const [currentEditIndex, setCurrentEditIndex] = useState(null);
|
|
45
45
|
const [inputValue, setInputValue] = useState([]);
|
|
46
|
-
const [shouldClose, setShouldClose] = useState(false);
|
|
47
46
|
|
|
48
47
|
useEffect(() => {}, [groups]);
|
|
49
48
|
|
|
@@ -51,12 +50,6 @@ export const EditGroup = ({ token, show, onClose }) => {
|
|
|
51
50
|
loadData();
|
|
52
51
|
}, []);
|
|
53
52
|
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (shouldClose) {
|
|
56
|
-
onClose && onClose();
|
|
57
|
-
}
|
|
58
|
-
}, [shouldClose, onClose]);
|
|
59
|
-
|
|
60
53
|
const loadData = async () => {
|
|
61
54
|
try {
|
|
62
55
|
const response = await axios.post(
|
|
@@ -241,7 +234,6 @@ export const EditGroup = ({ token, show, onClose }) => {
|
|
|
241
234
|
backgroundColor: "transparent",
|
|
242
235
|
zIndex: 10,
|
|
243
236
|
}}
|
|
244
|
-
onClick={onClose}
|
|
245
237
|
>
|
|
246
238
|
<Fade in={show} timeout={400}>
|
|
247
239
|
<Container>
|
|
@@ -17,6 +17,7 @@ export const FullProductNameHeader = ({
|
|
|
17
17
|
rejectAll,
|
|
18
18
|
servicesData,
|
|
19
19
|
showApproveRejectAll,
|
|
20
|
+
productObservation
|
|
20
21
|
}) => {
|
|
21
22
|
const [retailers, setRetailers] = useState([]);
|
|
22
23
|
|
|
@@ -52,6 +53,7 @@ export const FullProductNameHeader = ({
|
|
|
52
53
|
percentRequired={percent}
|
|
53
54
|
percent={percent?.toFixed(0)}
|
|
54
55
|
priority={headerData?.prio}
|
|
56
|
+
productObservation={productObservation}
|
|
55
57
|
date={getTime(headerData?.article?.timestamp || headerData?.timestamp)}
|
|
56
58
|
/>
|
|
57
59
|
<div className="features-bar-container">
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { Container } from "./styles";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
5
|
-
import { Button } from "../../atoms/GeneralButton";
|
|
6
|
-
import addVersion from "../../../assets/images/versionSelector/addVersion.svg";
|
|
7
|
-
import closeIcon from "../../../assets/images/versionSelector/closeVersionSelector.svg";
|
|
8
|
-
import { GlobalColors } from "../../../../dist/global-files/variables";
|
|
9
|
-
import { FontFamily } from "../../../global-files/variables";
|
|
10
|
-
import { VersionItem } from "../../molecules/VersionItem";
|
|
11
|
-
import { CreateVersion } from "../../organisms/CreateVersion";
|
|
12
|
-
import { useCloseModal } from "../../../global-files/customHooks";
|
|
1
|
+
// import { Container } from "./styles";
|
|
2
|
+
// import axios from "axios";
|
|
3
|
+
// import { useEffect, useState } from "react";
|
|
4
|
+
// import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
5
|
+
// import { Button } from "../../atoms/GeneralButton";
|
|
6
|
+
// import addVersion from "../../../assets/images/versionSelector/addVersion.svg";
|
|
7
|
+
// import closeIcon from "../../../assets/images/versionSelector/closeVersionSelector.svg";
|
|
8
|
+
// import { GlobalColors } from "../../../../dist/global-files/variables";
|
|
9
|
+
// import { FontFamily } from "../../../global-files/variables";
|
|
10
|
+
// import { VersionItem } from "../../molecules/VersionItem";
|
|
11
|
+
// import { CreateVersion } from "../../organisms/CreateVersion";
|
|
12
|
+
// import { useCloseModal } from "../../../global-files/customHooks";
|
|
13
13
|
|
|
14
|
-
export const VersionSelector = ({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
// export const VersionSelector = ({
|
|
15
|
+
// modalId,
|
|
16
|
+
// articleId,
|
|
17
|
+
// setVersion,
|
|
18
|
+
// companyName,
|
|
19
|
+
// currentVersion,
|
|
20
|
+
// setShowVersionSelector,
|
|
21
|
+
// jwt,
|
|
22
|
+
// }) => {
|
|
23
|
+
// const [versions, setVersions] = useState([]);
|
|
24
|
+
// const [showCreateVersion, setShowCreateVersion] =
|
|
25
|
+
// useCloseModal("create-version");
|
|
26
|
+
// const [reload, setReload] = useState(false);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
// const loadProductVersions = async (articleId) => {
|
|
29
|
+
// try {
|
|
30
|
+
// const response = await axios.get(
|
|
31
|
+
// `${process.env.REACT_APP_VERSIONS_ENDPOINT}?articleId=${articleId}&provider=true`,
|
|
32
|
+
// {
|
|
33
|
+
// headers: {
|
|
34
|
+
// Authorization: jwt,
|
|
35
|
+
// },
|
|
36
|
+
// }
|
|
37
|
+
// );
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
// const versionList = JSON.parse(response.data.body).data;
|
|
40
|
+
// setVersions(versionList);
|
|
41
|
+
// } catch (error) {
|
|
42
|
+
// console.log(error);
|
|
43
|
+
// }
|
|
44
|
+
// };
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
// useEffect(() => {
|
|
47
|
+
// const ac = new AbortController();
|
|
48
|
+
// loadProductVersions(articleId);
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
// return () => {
|
|
51
|
+
// setVersions([]);
|
|
52
|
+
// setShowCreateVersion(false);
|
|
53
|
+
// return () => ac.abort(); // Abort both fetches on unmount
|
|
54
|
+
// };
|
|
55
|
+
// }, [reload]);
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
57
|
+
// return (
|
|
58
|
+
// <Container id={modalId}>
|
|
59
|
+
// <div className="versions-header">
|
|
60
|
+
// <ScreenHeader
|
|
61
|
+
// text={"Versión del producto"}
|
|
62
|
+
// headerType={"input-name-header"}
|
|
63
|
+
// color={GlobalColors.white}
|
|
64
|
+
// fontFamily={FontFamily.Lato}
|
|
65
|
+
// />
|
|
66
|
+
// <div className="buttons-container">
|
|
67
|
+
// <Button
|
|
68
|
+
// image={addVersion}
|
|
69
|
+
// buttonType={"circular-button"}
|
|
70
|
+
// onClick={() => setShowCreateVersion(true)}
|
|
71
|
+
// id="add-version"
|
|
72
|
+
// />
|
|
73
|
+
// <Button
|
|
74
|
+
// image={closeIcon}
|
|
75
|
+
// buttonType={"circular-button"}
|
|
76
|
+
// onClick={() => setShowVersionSelector(false)}
|
|
77
|
+
// id="close-button"
|
|
78
|
+
// />
|
|
79
|
+
// </div>
|
|
80
|
+
// </div>
|
|
81
|
+
// <div className="versions-container">
|
|
82
|
+
// {versions?.map((item) => (
|
|
83
|
+
// <VersionItem
|
|
84
|
+
// key={item.version}
|
|
85
|
+
// version={item.version}
|
|
86
|
+
// articleStatus={item.article_status}
|
|
87
|
+
// currentVersion={item.version === currentVersion}
|
|
88
|
+
// productOwner={companyName}
|
|
89
|
+
// setVersion={setVersion}
|
|
90
|
+
// timestamp={item.timestamp}
|
|
91
|
+
// />
|
|
92
|
+
// ))}
|
|
93
|
+
// </div>
|
|
94
|
+
// {showCreateVersion && (
|
|
95
|
+
// <CreateVersion
|
|
96
|
+
// articleId={articleId}
|
|
97
|
+
// version={currentVersion}
|
|
98
|
+
// versionsList={versions}
|
|
99
|
+
// setShowCreateVersion={setShowCreateVersion}
|
|
100
|
+
// realoadVersion={() => setReload(!reload)}
|
|
101
|
+
// jwt={jwt}
|
|
102
|
+
// />
|
|
103
|
+
// )}
|
|
104
|
+
// </Container>
|
|
105
|
+
// );
|
|
106
|
+
// };
|
|
@@ -11,8 +11,8 @@ export const ProviderProductEditionDefault = Template.bind({});
|
|
|
11
11
|
|
|
12
12
|
ProviderProductEditionDefault.args = {
|
|
13
13
|
tabsSections: {
|
|
14
|
-
Descripción:
|
|
15
|
-
"Ficha técnica":
|
|
14
|
+
Descripción: false,
|
|
15
|
+
"Ficha técnica": true,
|
|
16
16
|
Imágenes: false,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
@@ -21,41 +21,46 @@ ProviderProductEditionDefault.args = {
|
|
|
21
21
|
category: 287,
|
|
22
22
|
version: 1,
|
|
23
23
|
productSelected: {
|
|
24
|
-
id_article:
|
|
25
|
-
upc:
|
|
26
|
-
name: "
|
|
27
|
-
timestamp: "
|
|
28
|
-
categoryName:
|
|
29
|
-
|
|
30
|
-
id_category: 287,
|
|
24
|
+
id_article: 121067,
|
|
25
|
+
upc: "2342341",
|
|
26
|
+
name: "asd",
|
|
27
|
+
timestamp: "2024-01-03T19:42:59.000Z",
|
|
28
|
+
categoryName: "Abarrotes|Abarrotes Secos|Alimentos Deshidratados",
|
|
29
|
+
id_category: 4,
|
|
31
30
|
version: 1,
|
|
31
|
+
value: null,
|
|
32
32
|
retailersAvailable: [
|
|
33
|
-
{
|
|
34
|
-
|
|
33
|
+
{
|
|
34
|
+
"name": "Walmart Marketplace",
|
|
35
|
+
"id": 75
|
|
36
|
+
}
|
|
35
37
|
],
|
|
36
|
-
percentage:
|
|
38
|
+
percentage: 1.33
|
|
37
39
|
},
|
|
38
40
|
productToEdit: {
|
|
39
|
-
idCategory:
|
|
40
|
-
ArticleId:
|
|
41
|
+
idCategory: 4,
|
|
42
|
+
ArticleId: 121067,
|
|
41
43
|
product: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
{
|
|
45
|
+
id_article: 121067,
|
|
46
|
+
upc: "2342341",
|
|
47
|
+
name: "asd",
|
|
48
|
+
timestamp: "2024-01-03T19:42:59.000Z",
|
|
49
|
+
categoryName: "Abarrotes|Abarrotes Secos|Alimentos Deshidratados",
|
|
50
|
+
id_category: 4,
|
|
51
|
+
version: 1,
|
|
52
|
+
value: null,
|
|
53
|
+
retailersAvailable: [
|
|
54
|
+
{
|
|
55
|
+
name: "Walmart Marketplace",
|
|
56
|
+
id: 75,
|
|
57
|
+
percentage: 1.33
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
percentage: 1.33
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
59
64
|
location: {
|
|
60
65
|
pathname: "/EditProducts",
|
|
61
66
|
search: "",
|
|
@@ -68,72 +73,54 @@ ProviderProductEditionDefault.args = {
|
|
|
68
73
|
key: "24vwut",
|
|
69
74
|
},
|
|
70
75
|
user: {
|
|
71
|
-
id_user:
|
|
72
|
-
name: "
|
|
73
|
-
last_name: "
|
|
74
|
-
email: "
|
|
75
|
-
position: "Test",
|
|
76
|
-
telephone: "+
|
|
76
|
+
id_user: 28,
|
|
77
|
+
name: "Ismael",
|
|
78
|
+
last_name: "López",
|
|
79
|
+
email: "ilopez@contentoh.com",
|
|
80
|
+
position: "Test States",
|
|
81
|
+
telephone: "+523111366336",
|
|
77
82
|
country: "México",
|
|
78
|
-
id_company:
|
|
79
|
-
id_cognito: "
|
|
83
|
+
id_company: 1,
|
|
84
|
+
id_cognito: "f5927f8e-cbf7-4922-9e09-e69ec0b2731a",
|
|
80
85
|
birth_Date: null,
|
|
81
|
-
about_me:
|
|
82
|
-
zip_code:
|
|
83
|
-
address:
|
|
84
|
-
job:
|
|
85
|
-
id_stripe:
|
|
86
|
+
about_me: "",
|
|
87
|
+
zip_code: "",
|
|
88
|
+
address: "",
|
|
89
|
+
job: "",
|
|
90
|
+
id_stripe: "cus_KuEt6R6vwmN09f",
|
|
86
91
|
id_role: 0,
|
|
87
92
|
active: 1,
|
|
88
93
|
is_retailer: 0,
|
|
89
94
|
email_notify: 1,
|
|
90
|
-
is_user_tech:
|
|
95
|
+
is_user_tech: "ADMIN-AS",
|
|
91
96
|
membership: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
id: 76,
|
|
98
|
+
start_date: "2022-01-18T17:25:35.000Z",
|
|
99
|
+
end_date: "2023-01-18T17:25:35.000Z",
|
|
100
|
+
planID: 8,
|
|
101
|
+
plan: "prod_KtlhECVSFG2iro",
|
|
102
|
+
name: "Plan Pro",
|
|
103
|
+
user_limit: "50",
|
|
104
|
+
products_limit: "5000",
|
|
105
|
+
type: "Enterprise"
|
|
101
106
|
},
|
|
102
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
107
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-28/28.png?1704310718113"
|
|
103
108
|
},
|
|
104
109
|
company: {
|
|
105
|
-
id_company:
|
|
106
|
-
trade_name: "
|
|
107
|
-
company_name: "
|
|
108
|
-
rfc: "
|
|
109
|
-
adress: "
|
|
110
|
-
about_company:
|
|
111
|
-
telephone:
|
|
112
|
-
web_site:
|
|
113
|
-
zip_code:
|
|
110
|
+
id_company: 1,
|
|
111
|
+
trade_name: "GRUPO BRAHMA",
|
|
112
|
+
company_name: "GRUPO BRAHMA",
|
|
113
|
+
rfc: "XAXX010101000",
|
|
114
|
+
adress: "AA",
|
|
115
|
+
about_company: "",
|
|
116
|
+
telephone: "",
|
|
117
|
+
web_site: "",
|
|
118
|
+
zip_code: "",
|
|
114
119
|
email: null,
|
|
115
|
-
social_link:
|
|
120
|
+
social_link: "",
|
|
116
121
|
is_retailer: 0,
|
|
117
|
-
financedRetailers: [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
name: "The Home Depot Onboarding",
|
|
121
|
-
country: "México",
|
|
122
|
-
id_region: 1,
|
|
123
|
-
active: 1,
|
|
124
|
-
flow: 1,
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
retailers: [
|
|
128
|
-
{
|
|
129
|
-
id: 68,
|
|
130
|
-
name: "The Home Depot Onboarding",
|
|
131
|
-
country: "México",
|
|
132
|
-
id_region: 1,
|
|
133
|
-
active: 1,
|
|
134
|
-
flow: 1,
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
},
|
|
122
|
+
financedRetailers: [],
|
|
123
|
+
retailers: []
|
|
124
|
+
},
|
|
138
125
|
showSurvey: (v) => v && alert("se muestra"),
|
|
139
126
|
};
|
|
@@ -82,19 +82,26 @@ const reducerImages = (state, action) => {
|
|
|
82
82
|
);
|
|
83
83
|
return { ...state, values };
|
|
84
84
|
case "orderImages": {
|
|
85
|
-
let {
|
|
85
|
+
let {
|
|
86
|
+
inputsByRetailer = {},
|
|
87
|
+
valuesInitial,
|
|
88
|
+
inputsInitial,
|
|
89
|
+
inputs,
|
|
90
|
+
} = state;
|
|
86
91
|
try {
|
|
87
92
|
const orderedImages = [];
|
|
88
93
|
const imageIdArray = [];
|
|
89
|
-
if (action?.retailerId && !inputsByRetailer[action.retailerId])
|
|
94
|
+
if (action?.retailerId && !inputsByRetailer[action.retailerId]) {
|
|
90
95
|
inputsByRetailer[action.retailerId] = [];
|
|
91
|
-
|
|
96
|
+
}
|
|
97
|
+
if (action.retailerId) {
|
|
92
98
|
inputsByRetailer[action.retailerId]?.filter((input) => {
|
|
93
99
|
imageIdArray.push(input.id_image);
|
|
94
100
|
valuesInitial.forEach((value) => {
|
|
95
101
|
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
96
102
|
});
|
|
97
103
|
});
|
|
104
|
+
}
|
|
98
105
|
|
|
99
106
|
inputs = inputsInitial?.filter((input) =>
|
|
100
107
|
imageIdArray.includes(input.id)
|
|
@@ -102,7 +109,7 @@ const reducerImages = (state, action) => {
|
|
|
102
109
|
|
|
103
110
|
values = orderedImages.length > 0 ? orderedImages : [];
|
|
104
111
|
} catch (error) {
|
|
105
|
-
console.log(error);
|
|
112
|
+
console.log(action.action, error);
|
|
106
113
|
}
|
|
107
114
|
return { ...state, values, inputs };
|
|
108
115
|
}
|
|
@@ -144,7 +151,7 @@ export const ProviderProductEdition = ({
|
|
|
144
151
|
const [datasheets, setDatasheets] = useState([]);
|
|
145
152
|
const [images, setImages] = useReducer(reducerImages, {});
|
|
146
153
|
const [showModal, setShowModal] = useState(false);
|
|
147
|
-
const [boxData, setBoxData] = useState();
|
|
154
|
+
const [boxData, setBoxData] = useState({});
|
|
148
155
|
const { getRootProps, getInputProps } = useDropzone({
|
|
149
156
|
accept: "image/*",
|
|
150
157
|
noKeyboard: true,
|
|
@@ -485,7 +492,20 @@ export const ProviderProductEdition = ({
|
|
|
485
492
|
|
|
486
493
|
setImages({ action: "init", init: services[2] });
|
|
487
494
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
488
|
-
|
|
495
|
+
const data = [
|
|
496
|
+
{
|
|
497
|
+
id_article: product.id_article,
|
|
498
|
+
id_category: product.id_category,
|
|
499
|
+
version: product.version,
|
|
500
|
+
id_retailer_array: (
|
|
501
|
+
product.retailersAvailable ?? product.retailers
|
|
502
|
+
).map(({ id }) => id),
|
|
503
|
+
},
|
|
504
|
+
];
|
|
505
|
+
const headers = { Authorization: token };
|
|
506
|
+
getPercentage({ data, headers }).then((res) => {
|
|
507
|
+
setPercentages(res[0]);
|
|
508
|
+
});
|
|
489
509
|
setLoading(false);
|
|
490
510
|
};
|
|
491
511
|
|
|
@@ -545,12 +565,14 @@ export const ProviderProductEdition = ({
|
|
|
545
565
|
};
|
|
546
566
|
|
|
547
567
|
const getCart = async () => {
|
|
548
|
-
const res = await axios.get(process.env.REACT_APP_CART
|
|
568
|
+
const res = await axios.get(`${process.env.REACT_APP_CART}/general/`, {
|
|
549
569
|
headers: {
|
|
550
570
|
Authorization: token,
|
|
551
571
|
},
|
|
552
572
|
});
|
|
553
|
-
const arr = JSON.parse(res.data.body).data
|
|
573
|
+
const arr = Object.values(JSON.parse(res.data.body).data)
|
|
574
|
+
?.map((e) => e.article_id)
|
|
575
|
+
.filter(Boolean);
|
|
554
576
|
setInCart(arr.some((e) => e.articleId === product.id_article));
|
|
555
577
|
};
|
|
556
578
|
|
|
@@ -648,11 +670,11 @@ export const ProviderProductEdition = ({
|
|
|
648
670
|
value: e?.id,
|
|
649
671
|
name: e?.name,
|
|
650
672
|
required: e?.required,
|
|
651
|
-
active: images?.values
|
|
673
|
+
active: images?.values?.some((value) => value?.image_id === e?.id),
|
|
652
674
|
}));
|
|
653
675
|
setSocketType(imageInputs);
|
|
654
676
|
}, [images]);
|
|
655
|
-
|
|
677
|
+
|
|
656
678
|
const saveDescriptions = async () => {
|
|
657
679
|
setLoading(true);
|
|
658
680
|
const dataObject = {
|
|
@@ -692,7 +714,7 @@ export const ProviderProductEdition = ({
|
|
|
692
714
|
attributeId,
|
|
693
715
|
value: valueOfAtribute,
|
|
694
716
|
boxId,
|
|
695
|
-
})
|
|
717
|
+
});
|
|
696
718
|
});
|
|
697
719
|
});
|
|
698
720
|
|
|
@@ -700,8 +722,10 @@ export const ProviderProductEdition = ({
|
|
|
700
722
|
articleId: product?.id_article,
|
|
701
723
|
articleData: updatedDatasheets,
|
|
702
724
|
...(parseBoxData.length > 0 && { boxData: parseBoxData }),
|
|
703
|
-
};
|
|
704
|
-
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
console.log({dataObject});
|
|
728
|
+
console.log(product?.orderId);
|
|
705
729
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
706
730
|
try {
|
|
707
731
|
const res = await axios.put(
|
|
@@ -720,8 +744,7 @@ export const ProviderProductEdition = ({
|
|
|
720
744
|
}
|
|
721
745
|
} catch (error) {
|
|
722
746
|
console.log(error);
|
|
723
|
-
}
|
|
724
|
-
console.log(dataObject)
|
|
747
|
+
}
|
|
725
748
|
};
|
|
726
749
|
|
|
727
750
|
const updateImages = useCallback(async () => {
|
|
@@ -1154,13 +1177,6 @@ export const ProviderProductEdition = ({
|
|
|
1154
1177
|
}
|
|
1155
1178
|
};
|
|
1156
1179
|
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
1180
|
const evaluationToRetailer = async (result) => {
|
|
1165
1181
|
const data = {
|
|
1166
1182
|
articleId: product.id_article,
|
|
@@ -1240,7 +1256,6 @@ export const ProviderProductEdition = ({
|
|
|
1240
1256
|
},
|
|
1241
1257
|
];
|
|
1242
1258
|
const sendToEvaluation = (result) => {
|
|
1243
|
-
console.log({ result });
|
|
1244
1259
|
if (result === "A") {
|
|
1245
1260
|
if (
|
|
1246
1261
|
origin[activeTab] === "RequestWithoutContentoh" &&
|