contentoh-components-library 10.0.0 → 13.0.0
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/.env.development +12 -10
- package/.env.production +2 -0
- package/dist/components/atoms/ActivedFilter/ActivedFilter.stories.js +7 -1
- package/dist/components/atoms/ActivedFilter/index.js +12 -4
- package/dist/components/atoms/AsignationOption/AsignationOptions.stories.js +7 -1
- package/dist/components/atoms/AsignationOption/index.js +29 -22
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/atoms/AtomList/AtomList.stories.js +7 -1
- package/dist/components/atoms/AtomList/index.js +14 -9
- package/dist/components/atoms/Avatar/AsignationImage.stories.js +7 -1
- package/dist/components/atoms/Avatar/index.js +11 -8
- package/dist/components/atoms/Card/Card.stories.js +7 -1
- package/dist/components/atoms/Card/index.js +8 -4
- package/dist/components/atoms/CheckBox/CheckBox.stories.js +7 -1
- package/dist/components/atoms/CheckBox/index.js +16 -12
- package/dist/components/atoms/Commentary/index.js +10 -2
- package/dist/components/atoms/Commentary/styles.js +4 -1
- package/dist/components/atoms/CustomerTypeImage/CustomerTypeImage.stories.js +7 -1
- package/dist/components/atoms/CustomerTypeImage/index.js +8 -6
- package/dist/components/atoms/DropDownButton/DropDownButton.stories.js +7 -1
- package/dist/components/atoms/DropDownButton/index.js +9 -6
- package/dist/components/atoms/EditField/EditField.stories.js +7 -1
- package/dist/components/atoms/EditField/index.js +17 -10
- package/dist/components/atoms/FeatureTag/FeatureTag.stories.js +7 -1
- package/dist/components/atoms/FeatureTag/index.js +11 -5
- package/dist/components/atoms/GeneralButton/GeneralButton.stories.js +7 -1
- package/dist/components/atoms/GeneralButton/index.js +13 -7
- package/dist/components/atoms/GeneralInput/GeneralInput.stories.js +7 -1
- package/dist/components/atoms/GeneralInput/index.js +23 -20
- package/dist/components/atoms/GeneralTextBox/GeneralTextBox.stories.js +7 -1
- package/dist/components/atoms/GeneralTextBox/index.js +12 -7
- package/dist/components/atoms/GenericModal/GenericModal.stories.js +46 -59
- package/dist/components/atoms/GenericModal/index.js +12 -7
- package/dist/components/atoms/GradientPanel/GradientPanel.stories.js +85 -80
- package/dist/components/atoms/GradientPanel/index.js +11 -7
- package/dist/components/atoms/Graphic/Graphic.stories.js +7 -1
- package/dist/components/atoms/Graphic/index.js +9 -5
- package/dist/components/atoms/Input/index.js +14 -7
- package/dist/components/atoms/LabelToInput/index.js +19 -13
- package/dist/components/atoms/LoadImageMenu/LoadImageMenu.stories.js +7 -1
- package/dist/components/atoms/LoadImageMenu/index.js +33 -22
- package/dist/components/atoms/LogoImage/LogoImage.stories.js +7 -1
- package/dist/components/atoms/LogoImage/index.js +8 -6
- package/dist/components/atoms/MenuNotification/MenuNotification.stories.js +7 -1
- package/dist/components/atoms/MenuNotification/index.js +21 -15
- package/dist/components/atoms/MenuProfile/MenuProfile.stories.js +7 -1
- package/dist/components/atoms/MenuProfile/index.js +25 -15
- package/dist/components/atoms/Notification/Notification.stories.js +5 -1
- package/dist/components/atoms/Notification/index.js +15 -9
- package/dist/components/atoms/Percent/Percent.stories.js +7 -1
- package/dist/components/atoms/Percent/index.js +21 -14
- package/dist/components/atoms/PriorityFlag/PriorityFlag.stories.js +7 -1
- package/dist/components/atoms/PriorityFlag/index.js +8 -4
- package/dist/components/atoms/ProductImage/ProductImage.stories.js +7 -1
- package/dist/components/atoms/ProductImage/index.js +11 -8
- package/dist/components/atoms/ProgressBar/ProgressBar.stories.js +7 -1
- package/dist/components/atoms/ProgressBar/index.js +8 -3
- package/dist/components/atoms/ScreenHeader/ScreenHeader.stories.js +7 -1
- package/dist/components/atoms/ScreenHeader/index.js +9 -3
- package/dist/components/atoms/Select/index.js +25 -20
- package/dist/components/atoms/SideMenuButton/SideMenuButton.stories.js +5 -1
- package/dist/components/atoms/SideMenuButton/index.js +10 -4
- package/dist/components/atoms/StatusTag/StatusTag.stories.js +7 -1
- package/dist/components/atoms/StatusTag/index.js +8 -3
- package/dist/components/atoms/TabSection/TabSection.stories.js +7 -1
- package/dist/components/atoms/TabSection/index.js +8 -3
- package/dist/components/atoms/ValidationPanel/ValidationPanel.stories.js +7 -1
- package/dist/components/atoms/ValidationPanel/index.js +39 -27
- package/dist/components/molecules/AddProvidersAndProducts/AddProvidersAndProducts.stories.js +5 -1
- package/dist/components/molecules/AddProvidersAndProducts/index.js +18 -12
- package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +5 -1
- package/dist/components/molecules/AssignedWork/index.js +36 -30
- package/dist/components/molecules/AvatarAndValidation/AvatarAndValidation.stories.js +7 -1
- package/dist/components/molecules/AvatarAndValidation/index.js +22 -17
- package/dist/components/molecules/EditionActiveImage/EditionActiveImage.stories.js +7 -1
- package/dist/components/molecules/EditionActiveImage/index.js +14 -10
- package/dist/components/molecules/FeaturesBar/FeaturesBar.stories.js +7 -1
- package/dist/components/molecules/FeaturesBar/index.js +11 -9
- package/dist/components/molecules/GalleryElement/GalleryElement.stories.js +7 -1
- package/dist/components/molecules/GalleryElement/index.js +69 -55
- package/dist/components/molecules/GalleryHeader/GalleryHeader.stories.js +7 -1
- package/dist/components/molecules/GalleryHeader/index.js +28 -15
- package/dist/components/molecules/HeaderTop/HeaderTop.stories.js +7 -1
- package/dist/components/molecules/HeaderTop/index.js +10 -7
- package/dist/components/molecules/ImageSelector/ImageSelector.stories.js +7 -1
- package/dist/components/molecules/ImageSelector/index.js +15 -13
- package/dist/components/molecules/ParentComponent/ParentComponent.stories.js +10 -2
- package/dist/components/molecules/ParentComponent/index.js +9 -5
- package/dist/components/molecules/PayMethod/PayMethod.stories.js +7 -1
- package/dist/components/molecules/PayMethod/index.js +38 -33
- package/dist/components/molecules/PlanSelection/PlanSelection.stories.js +7 -1
- package/dist/components/molecules/PlanSelection/index.js +14 -11
- package/dist/components/molecules/ProductNameHeader/ProductNameHeader.stories.js +7 -1
- package/dist/components/molecules/ProductNameHeader/index.js +18 -14
- package/dist/components/molecules/ProductNotification/ProductNotification.stories.js +7 -1
- package/dist/components/molecules/ProductNotification/index.js +12 -9
- package/dist/components/molecules/ProfileHeader/ProfileHeader.stories.js +5 -1
- package/dist/components/molecules/ProfileHeader/index.js +21 -15
- package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +7 -1
- package/dist/components/molecules/RetailerSelector/index.js +27 -24
- package/dist/components/molecules/SidebarNotification/SidebarNotification.stories.js +5 -1
- package/dist/components/molecules/SidebarNotification/index.js +43 -37
- package/dist/components/molecules/StatusAsignationInfo/StatusAsignationInfo.stories.js +7 -1
- package/dist/components/molecules/StatusAsignationInfo/index.js +115 -88
- package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
- package/dist/components/molecules/TableHeader/TableHeader.stories.js +7 -1
- package/dist/components/molecules/TableHeader/index.js +17 -9
- package/dist/components/molecules/TableRow/TableRow.stories.js +7 -1
- package/dist/components/molecules/TableRow/index.js +11 -7
- package/dist/components/molecules/TabsMenu/TabsMenu.stories.js +7 -1
- package/dist/components/molecules/TabsMenu/index.js +13 -10
- package/dist/components/molecules/TagAndInput/TagAndInput.stories.js +7 -1
- package/dist/components/molecules/TagAndInput/index.js +24 -22
- package/dist/components/organisms/FullProductNameHeader/FullProductNameHeader.stories.js +7 -1
- package/dist/components/organisms/FullProductNameHeader/index.js +35 -30
- package/dist/components/organisms/FullTabsMenu/FullTabsMenu.stories.js +7 -1
- package/dist/components/organisms/FullTabsMenu/index.js +26 -19
- package/dist/components/organisms/Fullplan/FullPlan.stories.js +7 -1
- package/dist/components/organisms/Fullplan/index.js +23 -15
- package/dist/components/organisms/ImageDataTable/ImageDataTable.stories.js +7 -1
- package/dist/components/organisms/ImageDataTable/index.js +79 -62
- package/dist/components/organisms/ImagePreviewer/ImagePreviewer.stories.js +7 -1
- package/dist/components/organisms/ImagePreviewer/index.js +12 -8
- package/dist/components/organisms/ImagesGroup/index.js +5 -1
- package/dist/components/organisms/InputGroup/InputGroup.stories.js +7 -1
- package/dist/components/organisms/InputGroup/index.js +39 -37
- package/dist/components/organisms/ProductImageModal/ProductImageModal.stories.js +7 -1
- package/dist/components/organisms/ProductImageModal/index.js +49 -43
- package/dist/components/pages/CustomerLogin/CustomerLogin.stories.js +52 -47
- package/dist/components/pages/CustomerLogin/index.js +18 -12
- package/dist/components/pages/CustomerPayMethod/CustomerPayMethod.stories.js +36 -28
- package/dist/components/pages/CustomerPayMethod/index.js +18 -12
- package/dist/components/pages/CustomerType/CustomerType.stories.js +21 -22
- package/dist/components/pages/CustomerType/index.js +18 -12
- package/dist/components/pages/OnboardPlan/OnboardPlan.stories.js +12 -9
- package/dist/components/pages/OnboardPlan/index.js +18 -12
- package/dist/components/pages/RetailerPlan/RetailerPlan.stories.js +13 -10
- package/dist/components/pages/RetailerPlan/index.js +18 -12
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +8 -1
- package/dist/components/pages/RetailerProductEdition/index.js +538 -244
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/global-files/data.js +51 -4
- package/dist/index.js +0 -70
- package/package.json +8 -1
- package/src/components/atoms/AsignationOption/index.js +1 -1
- package/src/components/atoms/AsignationOption/styles.js +6 -0
- package/src/components/atoms/Commentary/index.js +2 -2
- package/src/components/atoms/Commentary/styles.js +1 -0
- package/src/components/atoms/GeneralButton/index.js +1 -0
- package/src/components/atoms/GeneralInput/index.js +12 -6
- package/src/components/molecules/StatusAsignationInfo/index.js +38 -24
- package/src/components/molecules/StatusAsignationInfo/styles.js +8 -2
- package/src/components/molecules/TableHeader/index.js +9 -1
- package/src/components/organisms/FullTabsMenu/index.js +6 -3
- package/src/components/organisms/ImageDataTable/index.js +4 -0
- package/src/components/organisms/ProductImageModal/index.js +0 -4
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -0
- package/src/components/pages/RetailerProductEdition/index.js +194 -54
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/global-files/data.js +29 -2
- package/src/index.js +0 -7
|
@@ -19,10 +19,13 @@ export const StatusAsignationInfo = ({
|
|
|
19
19
|
saveDescriptions,
|
|
20
20
|
updateImages,
|
|
21
21
|
assignationsImages,
|
|
22
|
+
setAssignation,
|
|
23
|
+
isRetailer,
|
|
22
24
|
id = "default-id",
|
|
23
25
|
}) => {
|
|
24
26
|
const [showAsignationPanel, setShowAsignationPanel] = useState(false);
|
|
25
27
|
const [layout, setLayout] = useState(true);
|
|
28
|
+
const [assignationType, setAssignationType] = useState("facilitator");
|
|
26
29
|
|
|
27
30
|
const closeAsignations = (e) => {
|
|
28
31
|
if (!e.target.closest("#default-id") && showAsignationPanel) {
|
|
@@ -77,14 +80,15 @@ export const StatusAsignationInfo = ({
|
|
|
77
80
|
)}
|
|
78
81
|
<StatusTag statusType={status} ovalForm={true} />
|
|
79
82
|
<div className="assignations-container">
|
|
80
|
-
{assignationsImages?.map((assignation, index) => (
|
|
83
|
+
{assignationsImages?.assignations?.map((assignation, index) => (
|
|
81
84
|
<Avatar
|
|
82
|
-
key={index + "-" + assignation}
|
|
85
|
+
key={index + "-" + assignation.id}
|
|
83
86
|
imageType={"small-image"}
|
|
84
|
-
image={getProfilePicture(assignation, 20, 20)}
|
|
87
|
+
image={getProfilePicture(assignation.id, 20, 20)}
|
|
85
88
|
altText="user profile image"
|
|
86
89
|
onClick={() => {
|
|
87
90
|
setShowAsignationPanel(true);
|
|
91
|
+
setAssignationType(assignation?.collaboratorType);
|
|
88
92
|
}}
|
|
89
93
|
/>
|
|
90
94
|
))}
|
|
@@ -108,31 +112,41 @@ export const StatusAsignationInfo = ({
|
|
|
108
112
|
</div>
|
|
109
113
|
</div>
|
|
110
114
|
<div className="asignations-list">
|
|
111
|
-
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
{assignationsImages?.collaborators !== undefined ? (
|
|
116
|
+
assignationsImages?.collaborators[assignationType]?.map(
|
|
117
|
+
(asignation, index) => (
|
|
118
|
+
<AsignationOption
|
|
119
|
+
key={index + "-" + asignation.name}
|
|
120
|
+
profileImage={getProfilePicture(
|
|
121
|
+
asignation?.id_user,
|
|
122
|
+
40,
|
|
123
|
+
40
|
|
124
|
+
)}
|
|
125
|
+
onClick={() => {
|
|
126
|
+
setAssignation(assignationType, asignation?.id_user);
|
|
127
|
+
}}
|
|
128
|
+
name={asignation.name}
|
|
129
|
+
/>
|
|
130
|
+
)
|
|
131
|
+
)
|
|
120
132
|
) : (
|
|
121
133
|
<p className="no-asignations">Sin personas para asignar</p>
|
|
122
134
|
)}
|
|
123
135
|
</div>
|
|
124
|
-
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
{isRetailer === 0 && (
|
|
137
|
+
<div className="default-asignations-list">
|
|
138
|
+
<AsignationOption
|
|
139
|
+
asignationType={"provider"}
|
|
140
|
+
name={"Solicitar a"}
|
|
141
|
+
team={"Proveedor"}
|
|
142
|
+
/>
|
|
143
|
+
<AsignationOption
|
|
144
|
+
asignationType={"team"}
|
|
145
|
+
name={"Solicitar a"}
|
|
146
|
+
team={"Content-oh!"}
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
136
150
|
</div>
|
|
137
151
|
)}
|
|
138
152
|
</Container>
|
|
@@ -18,6 +18,7 @@ export const Container = styled.div`
|
|
|
18
18
|
|
|
19
19
|
.assignations-container {
|
|
20
20
|
display: flex;
|
|
21
|
+
cursor: pointer;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
.asignation-panel {
|
|
@@ -26,10 +27,11 @@ export const Container = styled.div`
|
|
|
26
27
|
box-sizing: border-box;
|
|
27
28
|
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.25);
|
|
28
29
|
border-radius: 4px;
|
|
29
|
-
padding: 10px;
|
|
30
|
+
padding: 10px 8px;
|
|
30
31
|
position: absolute;
|
|
31
32
|
top: calc(100% + 10px);
|
|
32
33
|
right: 0;
|
|
34
|
+
z-index: 10;
|
|
33
35
|
|
|
34
36
|
.asignation-header {
|
|
35
37
|
display: flex;
|
|
@@ -57,7 +59,6 @@ export const Container = styled.div`
|
|
|
57
59
|
|
|
58
60
|
.asignations-list {
|
|
59
61
|
min-height: 40px;
|
|
60
|
-
border-bottom: 1px solid ${GlobalColors.s3};
|
|
61
62
|
|
|
62
63
|
.no-asignations {
|
|
63
64
|
padding: 5px;
|
|
@@ -70,7 +71,12 @@ export const Container = styled.div`
|
|
|
70
71
|
|
|
71
72
|
& + * {
|
|
72
73
|
margin-top: 10px;
|
|
74
|
+
border-top: 1px solid ${GlobalColors.s3};
|
|
73
75
|
}
|
|
74
76
|
}
|
|
77
|
+
|
|
78
|
+
.default-asignations-list {
|
|
79
|
+
padding-top: 10px;
|
|
80
|
+
}
|
|
75
81
|
}
|
|
76
82
|
`;
|
|
@@ -3,7 +3,13 @@ import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
|
3
3
|
import { StatusAsignationInfo } from "../StatusAsignationInfo";
|
|
4
4
|
import { GlobalColors } from "../../../global-files/variables";
|
|
5
5
|
|
|
6
|
-
export const TableHeader = ({
|
|
6
|
+
export const TableHeader = ({
|
|
7
|
+
imagesStatus,
|
|
8
|
+
activeImage,
|
|
9
|
+
assignationsImages,
|
|
10
|
+
setAssignation,
|
|
11
|
+
isRetailer,
|
|
12
|
+
}) => {
|
|
7
13
|
return (
|
|
8
14
|
<Container>
|
|
9
15
|
<ScreenHeader
|
|
@@ -14,6 +20,8 @@ export const TableHeader = ({ imagesStatus, activeImage, assignationsImages }) =
|
|
|
14
20
|
<StatusAsignationInfo
|
|
15
21
|
status={imagesStatus}
|
|
16
22
|
assignationsImages={assignationsImages}
|
|
23
|
+
setAssignation={setAssignation}
|
|
24
|
+
isRetailer={isRetailer}
|
|
17
25
|
/>
|
|
18
26
|
</Container>
|
|
19
27
|
);
|
|
@@ -13,10 +13,11 @@ export const FullTabsMenu = ({
|
|
|
13
13
|
saveDatasheets,
|
|
14
14
|
saveDescriptions,
|
|
15
15
|
updateImages,
|
|
16
|
-
|
|
16
|
+
assig,
|
|
17
|
+
setAssignation,
|
|
18
|
+
isRetailer,
|
|
17
19
|
}) => {
|
|
18
20
|
const [imagesSection, setImagesSection] = useState(false);
|
|
19
|
-
//console.log(status);
|
|
20
21
|
|
|
21
22
|
return (
|
|
22
23
|
<Container>
|
|
@@ -34,7 +35,9 @@ export const FullTabsMenu = ({
|
|
|
34
35
|
saveDatasheets={saveDatasheets}
|
|
35
36
|
saveDescriptions={saveDescriptions}
|
|
36
37
|
updateImages={updateImages}
|
|
37
|
-
assignationsImages={
|
|
38
|
+
assignationsImages={assig}
|
|
39
|
+
setAssignation={setAssignation}
|
|
40
|
+
isRetailer={isRetailer}
|
|
38
41
|
/>
|
|
39
42
|
</Container>
|
|
40
43
|
);
|
|
@@ -12,6 +12,8 @@ export const ImageDataTable = ({
|
|
|
12
12
|
setImages,
|
|
13
13
|
assignationsImages,
|
|
14
14
|
imagesStatus,
|
|
15
|
+
setAssignation,
|
|
16
|
+
isRetailer,
|
|
15
17
|
}) => {
|
|
16
18
|
return (
|
|
17
19
|
<Container darkMode={darkMode}>
|
|
@@ -19,6 +21,8 @@ export const ImageDataTable = ({
|
|
|
19
21
|
imagesStatus={imagesStatus}
|
|
20
22
|
activeImage={activeImage}
|
|
21
23
|
assignationsImages={assignationsImages}
|
|
24
|
+
setAssignation={setAssignation}
|
|
25
|
+
isRetailer={isRetailer}
|
|
22
26
|
/>
|
|
23
27
|
<Row>
|
|
24
28
|
<ScreenHeader headerType={"table-row-text"} text="Tipo de toma" />
|
|
@@ -43,6 +43,8 @@ RetailerProductEditionDefault.args = {
|
|
|
43
43
|
"Ficha técnica": false,
|
|
44
44
|
Imágenes: false,
|
|
45
45
|
},
|
|
46
|
+
token:
|
|
47
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQ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cS3opSSQpXH4Mgh415fXFjbyz344ssd5nl7Onyh8jq5i-LAex3OPXhKzjrBnDRpGg3BQPIfpsquGZNKBiWqyos--CuohFBeyevMLGoKOcU-Ga-zIdEfonTtDVRe6CQLgOZJ2xTPdswlzRPby1gFoZjNebeeRVw",
|
|
46
48
|
articleId: 238,
|
|
47
49
|
category: 846,
|
|
48
50
|
version: 2,
|
|
@@ -7,7 +7,11 @@ import { FullTabsMenu } from "../../organisms/FullTabsMenu";
|
|
|
7
7
|
import { InputGroup } from "../../organisms/InputGroup";
|
|
8
8
|
import { useEffect, useReducer, useState, useCallback } from "react";
|
|
9
9
|
import { GalleryElement } from "../../molecules/GalleryElement";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
getRetailerServices,
|
|
12
|
+
getPercentage,
|
|
13
|
+
fetchUsers,
|
|
14
|
+
} from "../../../global-files/data";
|
|
11
15
|
import { GalleryHeader } from "../../molecules/GalleryHeader";
|
|
12
16
|
import { ProductImageModal } from "../../organisms/ProductImageModal";
|
|
13
17
|
import { useDropzone } from "react-dropzone";
|
|
@@ -59,6 +63,7 @@ export const RetailerProductEdition = ({
|
|
|
59
63
|
articleId,
|
|
60
64
|
productSelected = {},
|
|
61
65
|
user = {},
|
|
66
|
+
token,
|
|
62
67
|
}) => {
|
|
63
68
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
64
69
|
const [activeImage, setActiveImage] = useState();
|
|
@@ -121,7 +126,12 @@ export const RetailerProductEdition = ({
|
|
|
121
126
|
const [icon, setIcon] = useState(null);
|
|
122
127
|
const [version, setVersion] = useState(productSelected?.version);
|
|
123
128
|
const [comments, setComments] = useState({});
|
|
129
|
+
const [comment, setComment] = useState("");
|
|
124
130
|
const [requiredNull, setRequiredNull] = useState(0);
|
|
131
|
+
const [crossComment, setCrossComment] = useState(false);
|
|
132
|
+
const [userGroups, setUserGroups] = useState([]);
|
|
133
|
+
const [assig, setAssig] = useState({});
|
|
134
|
+
const isRetailer = user?.is_retailer;
|
|
125
135
|
|
|
126
136
|
const loadData = async () => {
|
|
127
137
|
const services = await getRetailerServices(
|
|
@@ -129,7 +139,7 @@ export const RetailerProductEdition = ({
|
|
|
129
139
|
parseInt(productSelected.article.id_category),
|
|
130
140
|
productSelected.version
|
|
131
141
|
);
|
|
132
|
-
|
|
142
|
+
|
|
133
143
|
//Converts the data inside the datasheets object to array
|
|
134
144
|
setServices(services);
|
|
135
145
|
setActiveRetailer(productSelected?.retailers[0]);
|
|
@@ -166,7 +176,7 @@ export const RetailerProductEdition = ({
|
|
|
166
176
|
const translateConcept = (concept) => {
|
|
167
177
|
let translation = "";
|
|
168
178
|
if (concept === "datasheet") {
|
|
169
|
-
translation = "Ficha
|
|
179
|
+
translation = "Ficha técnica";
|
|
170
180
|
} else if (concept === "description") {
|
|
171
181
|
translation = "Descripción";
|
|
172
182
|
} else if (concept === "images") {
|
|
@@ -175,7 +185,7 @@ export const RetailerProductEdition = ({
|
|
|
175
185
|
return translation;
|
|
176
186
|
};
|
|
177
187
|
|
|
178
|
-
const getComments = async (tab) => {
|
|
188
|
+
const getComments = async (tab = "Descripción") => {
|
|
179
189
|
const commentsResponse = await Promise.all([
|
|
180
190
|
axios.get(
|
|
181
191
|
`${process.env.REACT_APP_COMMENTS_ENDPOINT}?articleId=${productSelected?.article?.id_article}&concept=description&orderIdColab=${productSelected?.orderId}&version=${version}`
|
|
@@ -189,27 +199,84 @@ export const RetailerProductEdition = ({
|
|
|
189
199
|
]);
|
|
190
200
|
|
|
191
201
|
let comments = {};
|
|
192
|
-
commentsResponse.
|
|
202
|
+
commentsResponse.forEach(
|
|
193
203
|
(comment) =>
|
|
194
204
|
JSON.parse(comment.data.body).data[0] &&
|
|
195
205
|
(comments[
|
|
196
206
|
translateConcept(JSON.parse(comment.data.body).data[0]?.concept)
|
|
197
207
|
] = JSON.parse(comment.data.body).data[0])
|
|
198
208
|
);
|
|
209
|
+
setComment(comments[tab]);
|
|
199
210
|
setComments(comments);
|
|
200
|
-
//const comment = JSON.parse(commentsResponse.data.body).data;
|
|
201
|
-
//setComment(comment[0]);
|
|
202
211
|
};
|
|
203
212
|
|
|
204
|
-
useEffect(() => {
|
|
213
|
+
useEffect(async () => {
|
|
205
214
|
loadData();
|
|
206
215
|
getPercentage({ data: [productSelected] }).then((res) =>
|
|
207
216
|
setPercentages(res)
|
|
208
217
|
);
|
|
209
218
|
getServices();
|
|
210
219
|
getComments();
|
|
220
|
+
setUserGroups(await fetchUsers(token));
|
|
211
221
|
}, []);
|
|
212
222
|
|
|
223
|
+
const loadAssignations = (currentProduct) => {
|
|
224
|
+
setAssig({
|
|
225
|
+
Descripción: {
|
|
226
|
+
assignations: [
|
|
227
|
+
{
|
|
228
|
+
collaboratorType: "especialist",
|
|
229
|
+
id: currentProduct?.article?.id_description_especialist,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
collaboratorType: "facilitator",
|
|
233
|
+
id: currentProduct?.article?.id_description_facilitator,
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
collaborators: {
|
|
237
|
+
especialist: userGroups[0] || [],
|
|
238
|
+
facilitator: userGroups[2] || [],
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
"Ficha técnica": {
|
|
242
|
+
assignations: [
|
|
243
|
+
{
|
|
244
|
+
collaboratorType: "especialist",
|
|
245
|
+
id: currentProduct?.article?.id_datasheet_especialist,
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
collaboratorType: "facilitator",
|
|
249
|
+
id: currentProduct?.article?.id_datasheet_facilitator,
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
collaborators: {
|
|
253
|
+
especialist: userGroups[0] || [],
|
|
254
|
+
facilitator: userGroups[2] || [],
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
Imágenes: {
|
|
258
|
+
assignations: [
|
|
259
|
+
{
|
|
260
|
+
collaboratorType: "especialist",
|
|
261
|
+
id: currentProduct?.article?.id_images_especialist,
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
collaboratorType: "facilitator",
|
|
265
|
+
id: currentProduct?.article?.id_images_facilitator,
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
collaborators: {
|
|
269
|
+
especialist: userGroups[1] || [],
|
|
270
|
+
facilitator: userGroups[3] || [],
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
useEffect(() => {
|
|
277
|
+
loadAssignations(productSelected);
|
|
278
|
+
}, [userGroups]);
|
|
279
|
+
|
|
213
280
|
useEffect(() => {
|
|
214
281
|
productSelected.retailers.forEach((retailer) => {
|
|
215
282
|
retailer["percentage"] = percentages.filter(
|
|
@@ -271,8 +338,7 @@ export const RetailerProductEdition = ({
|
|
|
271
338
|
dataObject,
|
|
272
339
|
{
|
|
273
340
|
headers: {
|
|
274
|
-
Authorization:
|
|
275
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
341
|
+
Authorization: token,
|
|
276
342
|
},
|
|
277
343
|
}
|
|
278
344
|
);
|
|
@@ -292,8 +358,7 @@ export const RetailerProductEdition = ({
|
|
|
292
358
|
dataObject,
|
|
293
359
|
{
|
|
294
360
|
headers: {
|
|
295
|
-
Authorization:
|
|
296
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ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export const RetailerProductEdition = ({
|
|
|
406
471
|
dataImages,
|
|
407
472
|
{
|
|
408
473
|
headers: {
|
|
409
|
-
Authorization:
|
|
410
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
474
|
+
Authorization: token,
|
|
411
475
|
},
|
|
412
476
|
}
|
|
413
477
|
);
|
|
@@ -521,12 +585,10 @@ export const RetailerProductEdition = ({
|
|
|
521
585
|
}
|
|
522
586
|
}
|
|
523
587
|
}
|
|
524
|
-
//console.log(serv, "serv");
|
|
525
588
|
setServicesData(serv);
|
|
526
589
|
};
|
|
527
590
|
|
|
528
591
|
const sendToFacilitator = async (result) => {
|
|
529
|
-
console.log("exce");
|
|
530
592
|
let concept = "";
|
|
531
593
|
switch (activeTab) {
|
|
532
594
|
case "Descripción":
|
|
@@ -579,8 +641,7 @@ export const RetailerProductEdition = ({
|
|
|
579
641
|
};
|
|
580
642
|
await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
581
643
|
headers: {
|
|
582
|
-
Authorization:
|
|
583
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
644
|
+
Authorization: token,
|
|
584
645
|
},
|
|
585
646
|
});
|
|
586
647
|
} else {
|
|
@@ -610,8 +671,7 @@ export const RetailerProductEdition = ({
|
|
|
610
671
|
|
|
611
672
|
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
612
673
|
headers: {
|
|
613
|
-
Authorization:
|
|
614
|
-
"eyJra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EWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
674
|
+
Authorization: token,
|
|
615
675
|
},
|
|
616
676
|
});
|
|
617
677
|
setProduct(productTemp);
|
|
@@ -673,22 +733,91 @@ export const RetailerProductEdition = ({
|
|
|
673
733
|
return productSelected?.version === version;
|
|
674
734
|
}
|
|
675
735
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
736
|
+
const createComment = async (e, body, tab) => {
|
|
737
|
+
let concept = "";
|
|
738
|
+
switch (activeTab) {
|
|
739
|
+
case "Ficha técnica":
|
|
740
|
+
concept = "datasheet";
|
|
741
|
+
break;
|
|
742
|
+
case "Imágenes":
|
|
743
|
+
concept = "images";
|
|
744
|
+
break;
|
|
745
|
+
|
|
746
|
+
default:
|
|
747
|
+
concept = "description";
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
const data = {
|
|
751
|
+
articleId: product?.article?.id_article,
|
|
752
|
+
orderId: product?.orderId,
|
|
753
|
+
message: body,
|
|
754
|
+
concept: concept,
|
|
755
|
+
version: version,
|
|
756
|
+
};
|
|
757
|
+
e.preventDefault();
|
|
758
|
+
await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
759
|
+
headers: {
|
|
760
|
+
Authorization: token,
|
|
761
|
+
},
|
|
762
|
+
});
|
|
763
|
+
await getComments(tab);
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
useEffect(async () => {
|
|
767
|
+
setComment(comments[activeTab]);
|
|
690
768
|
}, [activeTab]);
|
|
691
769
|
|
|
770
|
+
const commentRevised = async () => {
|
|
771
|
+
const data = {
|
|
772
|
+
commentId: comment.id,
|
|
773
|
+
};
|
|
774
|
+
await axios.put(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
775
|
+
headers: {
|
|
776
|
+
Authorization: sessionStorage.getItem("jwt"),
|
|
777
|
+
},
|
|
778
|
+
});
|
|
779
|
+
setCrossComment(false);
|
|
780
|
+
await getComments();
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
const setAssignation = async (assignationType, assignationId) => {
|
|
784
|
+
let concept = "";
|
|
785
|
+
switch (activeTab) {
|
|
786
|
+
case "Ficha técnica":
|
|
787
|
+
concept = "datasheet";
|
|
788
|
+
break;
|
|
789
|
+
case "Imágenes":
|
|
790
|
+
concept = "images";
|
|
791
|
+
break;
|
|
792
|
+
|
|
793
|
+
default:
|
|
794
|
+
concept = "description";
|
|
795
|
+
break;
|
|
796
|
+
}
|
|
797
|
+
const productTemp = productSelected;
|
|
798
|
+
productTemp.article[`id_${concept}_${assignationType}`] = assignationId;
|
|
799
|
+
const data = {
|
|
800
|
+
articleList: [
|
|
801
|
+
{
|
|
802
|
+
orderId: product.orderId,
|
|
803
|
+
articleId: product?.article?.id_article,
|
|
804
|
+
},
|
|
805
|
+
],
|
|
806
|
+
concept: concept,
|
|
807
|
+
[`${assignationType}Id`]: assignationId,
|
|
808
|
+
};
|
|
809
|
+
axios({
|
|
810
|
+
method: "post",
|
|
811
|
+
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
812
|
+
data: data,
|
|
813
|
+
headers: {
|
|
814
|
+
Authorization: token,
|
|
815
|
+
},
|
|
816
|
+
});
|
|
817
|
+
loadAssignations(productTemp);
|
|
818
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
819
|
+
};
|
|
820
|
+
|
|
692
821
|
return (
|
|
693
822
|
<Container headerTop={headerTop}>
|
|
694
823
|
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
@@ -705,11 +834,10 @@ export const RetailerProductEdition = ({
|
|
|
705
834
|
activeImage={images?.values ? images?.values[activeImage] : {}}
|
|
706
835
|
retailerSelected={activeRetailer.id}
|
|
707
836
|
setImages={setImages}
|
|
708
|
-
assignationsImages={[
|
|
709
|
-
productSelected.article.id_images_especialist,
|
|
710
|
-
productSelected.article.id_images_facilitator,
|
|
711
|
-
]}
|
|
837
|
+
assignationsImages={assig["Imágenes"]}
|
|
712
838
|
imagesStatus={productSelected?.images_status}
|
|
839
|
+
setAssignation={setAssignation}
|
|
840
|
+
isRetailer={isRetailer}
|
|
713
841
|
/>
|
|
714
842
|
</div>
|
|
715
843
|
<div className="product-information">
|
|
@@ -745,20 +873,9 @@ export const RetailerProductEdition = ({
|
|
|
745
873
|
saveDescriptions={saveDescriptions}
|
|
746
874
|
saveDatasheets={saveDatasheets}
|
|
747
875
|
updateImages={updateImages}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
productSelected.article.id_description_facilitator,
|
|
752
|
-
],
|
|
753
|
-
"Ficha técnica": [
|
|
754
|
-
productSelected.article.id_datasheet_especialist,
|
|
755
|
-
productSelected.article.id_datasheet_facilitator,
|
|
756
|
-
],
|
|
757
|
-
Imágenes: [
|
|
758
|
-
productSelected.article.id_images_especialist,
|
|
759
|
-
productSelected.article.id_images_facilitator,
|
|
760
|
-
],
|
|
761
|
-
}}
|
|
876
|
+
assig={assig[activeTab]}
|
|
877
|
+
setAssignation={setAssignation}
|
|
878
|
+
isRetailer={isRetailer}
|
|
762
879
|
/>
|
|
763
880
|
<div
|
|
764
881
|
className={
|
|
@@ -814,18 +931,29 @@ export const RetailerProductEdition = ({
|
|
|
814
931
|
{(userAssigned(activeTab, "especialist" || "facilitator") ||
|
|
815
932
|
auditorAssigned()) && (
|
|
816
933
|
<div className="commentary-box">
|
|
817
|
-
{!
|
|
934
|
+
{!comment ? (
|
|
818
935
|
<div className="commentary">
|
|
819
936
|
<TagAndInput
|
|
820
937
|
label={"Caja de Comentario"}
|
|
821
938
|
inputType={"textarea"}
|
|
822
939
|
inputCols={80}
|
|
823
940
|
inputRows={4}
|
|
941
|
+
inputId={"commentary-box"}
|
|
942
|
+
index={0}
|
|
824
943
|
/>
|
|
825
944
|
<div className="buttons-box">
|
|
826
945
|
<Button
|
|
827
946
|
buttonType={"general-transparent-button"}
|
|
828
947
|
label={"Enviar comentario"}
|
|
948
|
+
onClick={(e) =>
|
|
949
|
+
createComment(
|
|
950
|
+
e,
|
|
951
|
+
document.getElementById(
|
|
952
|
+
"description-commentary-box-0"
|
|
953
|
+
).value,
|
|
954
|
+
activeTab
|
|
955
|
+
)
|
|
956
|
+
}
|
|
829
957
|
/>
|
|
830
958
|
<Button
|
|
831
959
|
buttonType={
|
|
@@ -841,7 +969,19 @@ export const RetailerProductEdition = ({
|
|
|
841
969
|
</div>
|
|
842
970
|
</div>
|
|
843
971
|
) : (
|
|
844
|
-
<
|
|
972
|
+
<div className="feedback-box">
|
|
973
|
+
<Commentary
|
|
974
|
+
comment={comment.message}
|
|
975
|
+
reviewed={crossComment}
|
|
976
|
+
/>
|
|
977
|
+
<Button
|
|
978
|
+
buttonType={"circular-button accept-button"}
|
|
979
|
+
onClick={async () => {
|
|
980
|
+
setCrossComment(true);
|
|
981
|
+
commentRevised();
|
|
982
|
+
}}
|
|
983
|
+
/>
|
|
984
|
+
</div>
|
|
845
985
|
)}
|
|
846
986
|
</div>
|
|
847
987
|
)}
|