contentoh-components-library 21.0.63 → 21.0.66
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 +5 -18
- package/.env.production +3 -16
- package/CHANGELOG.md +33 -31
- package/dist/assets/images/carouselImagesLogin/login2.svg +117 -0
- package/dist/assets/images/carouselImagesLogin/login3.svg +147 -0
- package/dist/assets/images/carouselImagesLogin/loginImage.svg +301 -0
- package/dist/assets/images/sliderToolTip/infoIcon.svg +4 -0
- package/dist/assets/images/sliderToolTip/slide1.svg +5 -0
- package/dist/assets/images/sliderToolTip/slide2.svg +9 -0
- package/dist/assets/images/sliderToolTip/slide3.svg +9 -0
- package/dist/assets/images/sliderToolTip/slide4.svg +9 -0
- package/dist/assets/images/sliderToolTip/slide5.svg +40 -0
- package/dist/components/atoms/AsignationOption/index.js +5 -9
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/atoms/CheckBox/index.js +2 -4
- package/dist/components/atoms/GeneralButton/index.js +0 -5
- package/dist/components/atoms/GeneralButton/styles.js +2 -4
- package/dist/components/atoms/GeneralInput/index.js +25 -72
- package/dist/components/atoms/GeneralInput/styles.js +1 -7
- package/dist/components/atoms/GenericModal/index.js +2 -4
- package/dist/components/atoms/GenericModal/styles.js +1 -1
- package/dist/components/atoms/GradientPanel/styles.js +1 -1
- package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +36 -0
- package/dist/components/atoms/ListCommercialRetailers/index.js +64 -0
- package/dist/components/atoms/ListCommercialRetailers/styles.js +20 -0
- package/dist/components/atoms/Loading/Loading.stories.js +28 -0
- package/dist/components/atoms/Loading/index.js +1 -0
- package/dist/components/atoms/LogoImage/index.js +1 -0
- package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +37 -0
- package/dist/components/atoms/MenuCommercialRetailers/index.js +25 -0
- package/dist/components/{molecules/RetailerSelector → atoms/MenuCommercialRetailers}/styles.js +1 -1
- package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +28 -0
- package/dist/components/atoms/MenuProductImage/index.js +88 -0
- package/dist/components/atoms/MenuProductImage/styles.js +20 -0
- package/dist/components/atoms/PriorityFlag/index.js +1 -1
- package/dist/components/atoms/ProductImage/styles.js +1 -1
- package/dist/components/atoms/ProgressBar/index.js +2 -2
- package/dist/components/atoms/ProgressBar/styles.js +5 -3
- package/dist/components/atoms/ScreenHeader/index.js +1 -1
- package/dist/components/atoms/ScreenHeader/styles.js +1 -1
- package/dist/components/atoms/SliderToolTip/SliderToolTip.stories.js +47 -0
- package/dist/components/atoms/SliderToolTip/index.js +200 -0
- package/dist/components/atoms/SliderToolTip/styles.js +24 -0
- package/dist/components/atoms/StatusTag/index.js +2 -37
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/atoms/ValidationPanel/index.js +3 -4
- package/dist/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +22 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +49 -0
- package/dist/components/atoms/{Commentary → VerticalSideMenuMainPage}/styles.js +1 -6
- package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +25 -0
- package/dist/components/molecules/ApproveRejetPanel/index.js +49 -0
- package/dist/components/{atoms/CharCounter → molecules/ApproveRejetPanel}/styles.js +1 -3
- package/dist/components/molecules/AvatarAndValidation/index.js +7 -17
- package/dist/components/molecules/AvatarAndValidation/styles.js +1 -1
- package/dist/components/molecules/CarouselImagesLogin/index.js +40 -42
- package/dist/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +28 -0
- package/dist/components/molecules/EmailResetPasswordLogin/index.js +153 -0
- package/dist/components/molecules/EmailResetPasswordLogin/styles.js +20 -0
- package/dist/components/molecules/FeaturesBar/index.js +1 -1
- package/dist/components/molecules/GalleryElement/index.js +21 -80
- package/dist/components/molecules/GalleryElement/styles.js +1 -1
- package/dist/components/molecules/GalleryHeader/index.js +6 -28
- package/dist/components/molecules/GalleryHeader/styles.js +1 -1
- package/dist/components/molecules/ImageSelector/index.js +4 -2
- package/dist/components/molecules/LoginPasswordStrength/index.js +6 -6
- package/dist/components/molecules/LoginPasswordStrength/styles.js +1 -1
- package/dist/components/{atoms/CharCounter/CharCounter.stories.js → molecules/LogoLoading/Loading.stories.js} +7 -10
- package/dist/components/molecules/LogoLoading/index.js +22 -0
- package/dist/components/molecules/LogoLoading/styles.js +18 -0
- package/dist/components/molecules/ProductNameHeader/index.js +2 -1
- package/dist/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationFirstStep/index.js +308 -0
- package/dist/components/molecules/RegistrationFirstStep/styles.js +20 -0
- package/dist/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationSecondStep/index.js +169 -0
- package/dist/components/molecules/RegistrationSecondStep/styles.js +20 -0
- package/dist/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationThirdStep/index.js +155 -0
- package/dist/components/molecules/RegistrationThirdStep/styles.js +20 -0
- package/dist/components/molecules/SignInLogin/SignInLogin.stories.js +28 -0
- package/dist/components/molecules/SignInLogin/index.js +321 -0
- package/dist/components/molecules/SignInLogin/styles.js +20 -0
- package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +28 -0
- package/dist/components/molecules/SignInLoginCreationApp/index.js +270 -0
- package/dist/components/molecules/SignInLoginCreationApp/styles.js +20 -0
- package/dist/components/molecules/StatusAsignationInfo/index.js +25 -46
- package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
- package/dist/components/molecules/TableHeader/index.js +5 -12
- package/dist/components/molecules/TableHeader/styles.js +1 -1
- package/dist/components/molecules/TagAndInput/index.js +2 -24
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +28 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +210 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/styles.js +20 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +69 -0
- package/dist/components/{atoms/InputFormatter/Wysiwyg.stories.js → organisms/ChangePassword/ChangePassword.stories.js} +7 -9
- package/dist/components/organisms/ChangePassword/index.js +123 -0
- package/dist/components/organisms/ChangePassword/styles.js +18 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +8 -32
- package/dist/components/organisms/FullTabsMenu/index.js +5 -18
- package/dist/components/organisms/ImageDataTable/index.js +14 -90
- package/dist/components/organisms/InputGroup/index.js +13 -34
- package/dist/components/organisms/InputGroup/styles.js +1 -1
- package/dist/components/organisms/ProductImageModal/index.js +11 -15
- package/dist/components/organisms/ProductImageModal/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +347 -91
- package/dist/components/pages/RetailerProductEdition/index.js +60 -1608
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/global-files/data.js +53 -212
- package/dist/global-files/global-styles.css +0 -1
- package/dist/global-files/variables.js +0 -1
- package/dist/index.js +277 -30
- package/package.json +14 -12
- package/src/assets/images/editField/showPassword.png +0 -0
- package/src/assets/images/sliderToolTip/infoIcon.svg +4 -0
- package/src/assets/images/sliderToolTip/slide1.svg +5 -0
- package/src/assets/images/sliderToolTip/slide2.svg +9 -0
- package/src/assets/images/sliderToolTip/slide3.svg +9 -0
- package/src/assets/images/sliderToolTip/slide4.svg +9 -0
- package/src/assets/images/sliderToolTip/slide5.svg +40 -0
- package/src/components/atoms/AsignationOption/index.js +5 -7
- package/src/components/atoms/AsignationOption/styles.js +1 -9
- package/src/components/atoms/CheckBox/index.js +2 -8
- package/src/components/atoms/GeneralButton/index.js +2 -9
- package/src/components/atoms/GeneralButton/styles.js +0 -23
- package/src/components/atoms/GeneralInput/index.js +23 -71
- package/src/components/atoms/GeneralInput/styles.js +1 -11
- package/src/components/atoms/GenericModal/index.js +2 -2
- package/src/components/atoms/GenericModal/styles.js +2 -10
- package/src/components/atoms/GradientPanel/styles.js +1 -0
- package/src/components/atoms/Loading/Loading.stories.js +10 -0
- package/src/components/atoms/Loading/index.js +3 -2
- package/src/components/atoms/LogoImage/index.js +1 -1
- package/src/components/atoms/PriorityFlag/index.js +1 -1
- package/src/components/atoms/ProductImage/styles.js +1 -1
- package/src/components/atoms/ProgressBar/index.js +2 -2
- package/src/components/atoms/ProgressBar/styles.js +3 -54
- package/src/components/atoms/ScreenHeader/index.js +3 -7
- package/src/components/atoms/ScreenHeader/styles.js +2 -9
- package/src/components/atoms/SliderToolTip/SliderToolTip.stories.js +23 -0
- package/src/components/atoms/SliderToolTip/index.js +182 -0
- package/src/components/atoms/SliderToolTip/styles.js +168 -0
- package/src/components/atoms/StatusTag/index.js +2 -30
- package/src/components/atoms/StatusTag/styles.js +3 -15
- package/src/components/atoms/ValidationPanel/index.js +3 -3
- package/src/components/molecules/AvatarAndValidation/index.js +6 -24
- package/src/components/molecules/AvatarAndValidation/styles.js +1 -1
- package/src/components/molecules/CarouselImagesLogin/index.js +34 -37
- package/src/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +11 -0
- package/src/components/molecules/EmailResetPasswordLogin/index.js +85 -0
- package/src/components/molecules/EmailResetPasswordLogin/styles.js +23 -0
- package/src/components/molecules/FeaturesBar/index.js +7 -10
- package/src/components/molecules/GalleryElement/index.js +36 -75
- package/src/components/molecules/GalleryElement/styles.js +11 -38
- package/src/components/molecules/GalleryHeader/index.js +8 -14
- package/src/components/molecules/GalleryHeader/styles.js +0 -16
- package/src/components/molecules/ImageSelector/index.js +3 -2
- package/src/components/molecules/LoginPasswordStrength/index.js +8 -3
- package/src/components/molecules/LoginPasswordStrength/styles.js +3 -0
- package/src/components/molecules/LogoLoading/Loading.stories.js +10 -0
- package/src/components/molecules/LogoLoading/index.js +12 -0
- package/src/components/molecules/LogoLoading/styles.js +16 -0
- package/src/components/molecules/ProductNameHeader/index.js +2 -1
- package/src/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +11 -0
- package/src/components/molecules/RegistrationFirstStep/index.js +227 -0
- package/src/components/molecules/RegistrationFirstStep/styles.js +87 -0
- package/src/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +11 -0
- package/src/components/molecules/RegistrationSecondStep/index.js +130 -0
- package/src/components/molecules/RegistrationSecondStep/styles.js +59 -0
- package/src/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +11 -0
- package/src/components/molecules/RegistrationThirdStep/index.js +130 -0
- package/src/components/molecules/RegistrationThirdStep/styles.js +44 -0
- package/src/components/molecules/SignInLogin/SignInLogin.stories.js +11 -0
- package/src/components/molecules/SignInLogin/index.js +227 -0
- package/src/components/molecules/SignInLogin/styles.js +128 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +38 -62
- package/src/components/molecules/StatusAsignationInfo/styles.js +2 -12
- package/src/components/molecules/TableHeader/index.js +3 -16
- package/src/components/molecules/TableHeader/styles.js +0 -5
- package/src/components/molecules/TagAndInput/index.js +2 -24
- package/src/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +11 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +170 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/styles.js +51 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +54 -0
- package/src/components/organisms/ChangePassword/ChangePassword.stories.js +11 -0
- package/src/components/organisms/ChangePassword/index.js +76 -0
- package/src/components/organisms/ChangePassword/styles.js +13 -0
- package/src/components/organisms/FullProductNameHeader/index.js +7 -28
- package/src/components/organisms/FullTabsMenu/index.js +3 -15
- package/src/components/organisms/ImageDataTable/index.js +11 -89
- package/src/components/organisms/InputGroup/index.js +11 -46
- package/src/components/organisms/InputGroup/styles.js +0 -3
- package/src/components/organisms/ProductImageModal/index.js +12 -20
- package/src/components/organisms/ProductImageModal/styles.js +0 -3
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +343 -91
- package/src/components/pages/RetailerProductEdition/index.js +48 -1238
- package/src/components/pages/RetailerProductEdition/styles.js +4 -67
- package/src/global-files/data.js +57 -156
- package/src/global-files/global-styles.css +0 -1
- package/src/global-files/variables.js +0 -1
- package/src/index.js +20 -1
- package/dist/assets/images/generalButton/downloadIcon.svg +0 -3
- package/dist/assets/images/modalsSVGs/attributesSent.svg +0 -208
- package/dist/assets/images/modalsSVGs/descriptionSent.svg +0 -237
- package/dist/assets/images/modalsSVGs/providerSent.svg +0 -445
- package/dist/assets/images/modalsSVGs/uploadingImages.svg +0 -148
- package/dist/components/atoms/CharCounter/index.js +0 -22
- package/dist/components/atoms/Commentary/Commentary.stories.js +0 -1
- package/dist/components/atoms/Commentary/index.js +0 -23
- package/dist/components/atoms/Input/index.js +0 -26
- package/dist/components/atoms/Input/style.js +0 -26
- package/dist/components/atoms/InputFormatter/index.js +0 -184
- package/dist/components/atoms/InputFormatter/styles.js +0 -33
- package/dist/components/atoms/LabelToInput/index.js +0 -53
- package/dist/components/atoms/LabelToInput/style.js +0 -22
- package/dist/components/atoms/Percent/Percent.stories.js +0 -39
- package/dist/components/atoms/Percent/index.js +0 -39
- package/dist/components/atoms/Percent/styles.js +0 -20
- package/dist/components/atoms/Select/index.js +0 -39
- package/dist/components/atoms/Select/style.js +0 -32
- package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +0 -48
- package/dist/components/molecules/RetailerSelector/index.js +0 -74
- package/dist/components/molecules/TextAndGradient/TextAndGradient.stories.js +0 -31
- package/dist/components/molecules/TextAndGradient/index.js +0 -36
- package/dist/components/molecules/TextAndGradient/styles.js +0 -18
- package/src/assets/images/generalButton/downloadIcon.svg +0 -3
- package/src/assets/images/modalsSVGs/attributesSent.svg +0 -208
- package/src/assets/images/modalsSVGs/descriptionSent.svg +0 -237
- package/src/assets/images/modalsSVGs/providerSent.svg +0 -445
- package/src/assets/images/modalsSVGs/uploadingImages.svg +0 -148
- package/src/components/atoms/CharCounter/CharCounter.stories.js +0 -11
- package/src/components/atoms/CharCounter/index.js +0 -13
- package/src/components/atoms/CharCounter/styles.js +0 -10
- package/src/components/atoms/Commentary/Commentary.stories.js +0 -0
- package/src/components/atoms/Commentary/index.js +0 -9
- package/src/components/atoms/Commentary/styles.js +0 -16
- package/src/components/atoms/Input/index.js +0 -15
- package/src/components/atoms/Input/style.js +0 -31
- package/src/components/atoms/InputFormatter/Wysiwyg.stories.js +0 -12
- package/src/components/atoms/InputFormatter/index.js +0 -144
- package/src/components/atoms/InputFormatter/styles.js +0 -40
- package/src/components/atoms/LabelToInput/index.js +0 -26
- package/src/components/atoms/LabelToInput/style.js +0 -41
- package/src/components/atoms/Select/index.js +0 -35
- package/src/components/atoms/Select/style.js +0 -76
- package/src/components/molecules/RetailerSelector/RetailerSelector.stories.js +0 -35
- package/src/components/molecules/RetailerSelector/index.js +0 -63
- package/src/components/molecules/RetailerSelector/styles.js +0 -18
|
@@ -5,1069 +5,39 @@ import { ImageDataTable } from "../../organisms/ImageDataTable";
|
|
|
5
5
|
import { FullProductNameHeader } from "../../organisms/FullProductNameHeader";
|
|
6
6
|
import { FullTabsMenu } from "../../organisms/FullTabsMenu";
|
|
7
7
|
import { InputGroup } from "../../organisms/InputGroup";
|
|
8
|
-
import { useEffect,
|
|
8
|
+
import { useEffect, useState } from "react";
|
|
9
9
|
import { GalleryElement } from "../../molecules/GalleryElement";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
getRetailerServices,
|
|
13
|
-
getPercentage,
|
|
14
|
-
fetchUsers,
|
|
15
|
-
} from "../../../global-files/data";
|
|
10
|
+
import { getRetailerServices, getImage } from "../../../global-files/data";
|
|
16
11
|
import { GalleryHeader } from "../../molecules/GalleryHeader";
|
|
17
12
|
import { ProductImageModal } from "../../organisms/ProductImageModal";
|
|
18
|
-
import { useDropzone } from "react-dropzone";
|
|
19
|
-
import axios from "axios";
|
|
20
|
-
import { v4 as uuidv4 } from "uuid";
|
|
21
|
-
import AWS from "aws-sdk";
|
|
22
|
-
import attributesSent from "../../../assets/images/modalsSVGs/attributesSent.svg";
|
|
23
|
-
import descriptionSent from "../../../assets/images/modalsSVGs/descriptionSent.svg";
|
|
24
|
-
import imagesSent from "../../../assets/images/modalsSVGs/uploadingImages.svg";
|
|
25
|
-
import { TagAndInput } from "../../molecules/TagAndInput/index";
|
|
26
|
-
import { Button } from "../../atoms/GeneralButton";
|
|
27
|
-
import { Commentary } from "../../atoms/Commentary";
|
|
28
|
-
import { GenericModal } from "../../atoms/GenericModal";
|
|
29
|
-
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
30
|
-
import { Loading } from "../../atoms/Loading";
|
|
31
|
-
import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
32
|
-
import { getNewStatus } from "../../../global-files/data";
|
|
33
13
|
|
|
34
|
-
const
|
|
35
|
-
let { values, attrForImgs } = state;
|
|
36
|
-
switch (action.action) {
|
|
37
|
-
case "init":
|
|
38
|
-
return action.init;
|
|
39
|
-
case "addImg":
|
|
40
|
-
values = [...values, action.img];
|
|
41
|
-
return { ...state, values };
|
|
42
|
-
case "changeImageInfo":
|
|
43
|
-
values[action.index][action.attribute] = action.value;
|
|
44
|
-
return { ...state, values };
|
|
45
|
-
case "changeAttrValue":
|
|
46
|
-
attrForImgs[action.retailer][action.index].value = action.value;
|
|
47
|
-
return { ...state, attrForImgs, values };
|
|
48
|
-
default:
|
|
49
|
-
return state;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
|
|
54
|
-
const REGION = "us-east-1";
|
|
55
|
-
|
|
56
|
-
AWS.config.update({
|
|
57
|
-
accessKeyId: process.env.REACT_APP_KEY_UPLOAD_TO_S3,
|
|
58
|
-
secretAccessKey: process.env.REACT_APP_ACCESS_KEY_UPLOAD_TO_S3,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const myBucket = new AWS.S3({
|
|
62
|
-
params: { Bucket: S3_BUCKET },
|
|
63
|
-
region: REGION,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export const RetailerProductEdition = ({
|
|
67
|
-
tabsSections,
|
|
68
|
-
productSelected = {},
|
|
69
|
-
user = {},
|
|
70
|
-
location = {},
|
|
71
|
-
token,
|
|
72
|
-
}) => {
|
|
14
|
+
export const RetailerProductEdition = ({ productData, tabsSections }) => {
|
|
73
15
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
74
16
|
const [activeImage, setActiveImage] = useState();
|
|
75
|
-
const [imageLayout, setImageLayout] = useState(
|
|
17
|
+
const [imageLayout, setImageLayout] = useState(true);
|
|
76
18
|
const [headerTop, setHeaderTop] = useState(0);
|
|
77
19
|
const [descriptions, setDescriptions] = useState([]);
|
|
78
|
-
const [datasheets, setDatasheets] = useState(
|
|
79
|
-
const [images, setImages] =
|
|
20
|
+
const [datasheets, setDatasheets] = useState({});
|
|
21
|
+
const [images, setImages] = useState({});
|
|
80
22
|
const [showModal, setShowModal] = useState(false);
|
|
81
|
-
const { getRootProps, getInputProps } = useDropzone({
|
|
82
|
-
accept: "image/*",
|
|
83
|
-
noKeyboard: true,
|
|
84
|
-
multiple: true,
|
|
85
|
-
noClick: true,
|
|
86
|
-
onDrop: (acceptedFiles) => {
|
|
87
|
-
const newImages = [];
|
|
88
|
-
acceptedFiles.map((file) => {
|
|
89
|
-
const reader = new FileReader();
|
|
90
|
-
reader.fileName = file.name;
|
|
91
|
-
reader.onload = async function (e) {
|
|
92
|
-
const ext = e.srcElement.fileName.split(".");
|
|
93
|
-
const img = new Image();
|
|
94
|
-
img.src = e.target.result;
|
|
95
|
-
const width = img.width;
|
|
96
|
-
const height = img.height;
|
|
97
|
-
const newImg = {
|
|
98
|
-
action: "addImg",
|
|
99
|
-
img: {
|
|
100
|
-
src: e.target.result,
|
|
101
|
-
name: e.target.fileName,
|
|
102
|
-
ext: ext[ext.length - 1],
|
|
103
|
-
width: width,
|
|
104
|
-
height: width,
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
setImages(newImg);
|
|
108
|
-
};
|
|
109
|
-
reader.onerror = function (error) {
|
|
110
|
-
console.log("dropzoneError: ", error);
|
|
111
|
-
};
|
|
112
|
-
reader.readAsDataURL(file);
|
|
113
|
-
return file;
|
|
114
|
-
});
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
const [updatedDatasheets, setUpdatedDatasheets] = useState([]);
|
|
118
|
-
const [updatedDescriptions, setUpdatedDescriptions] = useState([]);
|
|
119
|
-
const [imagesUploaded, setImagesUploaded] = useState(false);
|
|
120
|
-
const [dataImages, setDataImages] = useState();
|
|
121
|
-
const [percentages, setPercentages] = useState(
|
|
122
|
-
new Array(product?.retailers?.length).fill({ percentage: 0 })
|
|
123
|
-
);
|
|
124
|
-
const [activePercentage, setActivePercentage] = useState(0);
|
|
125
|
-
const [activeRetailer, setActiveRetailer] = useState({});
|
|
126
|
-
const [services, setServices] = useState([]);
|
|
127
|
-
const [servicesData, setServicesData] = useState([]);
|
|
128
|
-
const [message, setMessage] = useState("");
|
|
129
|
-
const [product, setProduct] = useState(
|
|
130
|
-
JSON.parse(sessionStorage.getItem("productSelected"))
|
|
131
|
-
? JSON.parse(sessionStorage.getItem("productSelected"))
|
|
132
|
-
: productSelected
|
|
133
|
-
);
|
|
134
|
-
const [icon, setIcon] = useState(null);
|
|
135
|
-
const [version, setVersion] = useState(product?.version);
|
|
136
|
-
const [comments, setComments] = useState({});
|
|
137
|
-
const [comment, setComment] = useState("");
|
|
138
|
-
const [requiredNull, setRequiredNull] = useState({
|
|
139
|
-
"Ficha técnica": 0,
|
|
140
|
-
Descripción: 0,
|
|
141
|
-
Imágenes: 0,
|
|
142
|
-
});
|
|
143
|
-
const [crossComment, setCrossComment] = useState(false);
|
|
144
|
-
const [userGroups, setUserGroups] = useState([]);
|
|
145
|
-
const [assig, setAssig] = useState({});
|
|
146
|
-
const [selectedImages, setSelectedImages] = useState([]);
|
|
147
|
-
const [componentsArray, setComponentsArray] = useState([]);
|
|
148
|
-
const [checkAll, setCheckAll] = useState(false);
|
|
149
|
-
const isRetailer = user?.is_retailer;
|
|
150
|
-
const [loading, setLoading] = useState(true);
|
|
151
|
-
const [retailerStatus, setRetailerStatus] = useState("-");
|
|
152
|
-
const [statusArray, setStatusArray] = useState([]);
|
|
153
|
-
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
checkAll && setSelectedImages(images.values);
|
|
156
|
-
}, [checkAll]);
|
|
157
23
|
|
|
158
24
|
const loadData = async () => {
|
|
159
|
-
const services = await getRetailerServices(
|
|
160
|
-
product?.article?.id_article,
|
|
161
|
-
parseInt(product?.article?.id_category),
|
|
162
|
-
product?.version
|
|
163
|
-
);
|
|
164
|
-
//Converts the data inside the datasheets object to array
|
|
165
|
-
setServices(services);
|
|
166
|
-
|
|
167
|
-
//setActiveRetailer(product?.retailers[0]);
|
|
168
|
-
setImages({
|
|
169
|
-
action: "init",
|
|
170
|
-
init: services[2],
|
|
171
|
-
});
|
|
172
|
-
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
173
|
-
|
|
174
|
-
setActiveRetailer(
|
|
175
|
-
product.retailers ? product.retailers[0] : product.retailersAvailable[0]
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
179
|
-
setLoading(false);
|
|
180
|
-
};
|
|
25
|
+
const services = await getRetailerServices();
|
|
181
26
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
27
|
+
//Converts the data inside the datasheets object to array
|
|
28
|
+
Object.values(services[0])[0].data = Object.values(
|
|
29
|
+
Object.values(services[0])[0].data
|
|
185
30
|
);
|
|
186
|
-
const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
|
|
187
|
-
setServicesData(parsedResponse);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
const translateConcept = (concept) => {
|
|
191
|
-
let translation = "";
|
|
192
|
-
if (concept === "datasheet") {
|
|
193
|
-
translation = "Ficha técnica";
|
|
194
|
-
} else if (concept === "description") {
|
|
195
|
-
translation = "Descripción";
|
|
196
|
-
} else if (concept === "images") {
|
|
197
|
-
translation = "Imágenes";
|
|
198
|
-
}
|
|
199
|
-
return translation;
|
|
200
|
-
};
|
|
201
31
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
),
|
|
207
|
-
axios.get(
|
|
208
|
-
`${process.env.REACT_APP_COMMENTS_ENDPOINT}?articleId=${product?.article?.id_article}&concept=datasheet&orderIdColab=${product?.orderId}&version=${version}`
|
|
209
|
-
),
|
|
210
|
-
axios.get(
|
|
211
|
-
`${process.env.REACT_APP_COMMENTS_ENDPOINT}?articleId=${product?.article?.id_article}&concept=images&orderIdColab=${product?.orderId}&version=${version}`
|
|
212
|
-
),
|
|
213
|
-
]);
|
|
214
|
-
|
|
215
|
-
let comments = {};
|
|
216
|
-
commentsResponse.forEach(
|
|
217
|
-
(comment) =>
|
|
218
|
-
JSON.parse(comment?.data?.body).data[0] &&
|
|
219
|
-
(comments[
|
|
220
|
-
translateConcept(JSON.parse(comment?.data?.body)?.data[0]?.concept)
|
|
221
|
-
] = JSON.parse(comment?.data?.body).data[0])
|
|
222
|
-
);
|
|
223
|
-
setComment(comments[tab]);
|
|
224
|
-
setComments(comments);
|
|
32
|
+
setDatasheets(Object.values(services[0]));
|
|
33
|
+
setDescriptions(services[1]);
|
|
34
|
+
setImages(services[2]);
|
|
35
|
+
setActiveImage(getImage(services[2]?.values[0], 340, 295));
|
|
225
36
|
};
|
|
226
37
|
|
|
227
38
|
useEffect(async () => {
|
|
228
39
|
loadData();
|
|
229
|
-
|
|
230
|
-
// setPercentages(res)
|
|
231
|
-
// );
|
|
232
|
-
getServices();
|
|
233
|
-
getComments();
|
|
234
|
-
setUserGroups(await fetchUsers(token));
|
|
235
|
-
let arr = [];
|
|
236
|
-
switch (user.id_role) {
|
|
237
|
-
case 7:
|
|
238
|
-
case 8:
|
|
239
|
-
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
240
|
-
break;
|
|
241
|
-
case 4:
|
|
242
|
-
case 5:
|
|
243
|
-
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
244
|
-
break;
|
|
245
|
-
case 6:
|
|
246
|
-
arr = ["RP", "RC", "AF"];
|
|
247
|
-
break;
|
|
248
|
-
default:
|
|
249
|
-
arr = [];
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
setStatusArray(arr);
|
|
253
|
-
}, [product]);
|
|
254
|
-
|
|
255
|
-
const loadAssignations = (currentProduct) => {
|
|
256
|
-
setAssig({
|
|
257
|
-
Descripción: {
|
|
258
|
-
assignations: [
|
|
259
|
-
{
|
|
260
|
-
collaboratorType: "especialist",
|
|
261
|
-
id: currentProduct?.article?.id_description_especialist,
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
collaboratorType: "facilitator",
|
|
265
|
-
id: currentProduct?.article?.id_description_facilitator,
|
|
266
|
-
},
|
|
267
|
-
],
|
|
268
|
-
collaborators: {
|
|
269
|
-
especialist: userGroups[0] || [],
|
|
270
|
-
facilitator: userGroups[2] || [],
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
"Ficha técnica": {
|
|
274
|
-
assignations: [
|
|
275
|
-
{
|
|
276
|
-
collaboratorType: "especialist",
|
|
277
|
-
id: currentProduct?.article?.id_datasheet_especialist,
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
collaboratorType: "facilitator",
|
|
281
|
-
id: currentProduct?.article?.id_datasheet_facilitator,
|
|
282
|
-
},
|
|
283
|
-
],
|
|
284
|
-
collaborators: {
|
|
285
|
-
especialist: userGroups[0] || [],
|
|
286
|
-
facilitator: userGroups[2] || [],
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
Imágenes: {
|
|
290
|
-
assignations: [
|
|
291
|
-
{
|
|
292
|
-
collaboratorType: "especialist",
|
|
293
|
-
id: currentProduct?.article?.id_images_especialist,
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
collaboratorType: "facilitator",
|
|
297
|
-
id: currentProduct?.article?.id_images_facilitator,
|
|
298
|
-
},
|
|
299
|
-
],
|
|
300
|
-
collaborators: {
|
|
301
|
-
especialist: userGroups[1] || [],
|
|
302
|
-
facilitator: userGroups[3] || [],
|
|
303
|
-
},
|
|
304
|
-
},
|
|
305
|
-
});
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
useEffect(() => {
|
|
309
|
-
loadAssignations(product);
|
|
310
|
-
}, [userGroups]);
|
|
311
|
-
|
|
312
|
-
useEffect(() => {
|
|
313
|
-
product?.retailers?.forEach((retailer) => {
|
|
314
|
-
retailer["percentage"] = percentages?.filter(
|
|
315
|
-
(percent) => retailer?.id === percent?.id_retailer
|
|
316
|
-
)[0]?.percentage;
|
|
317
|
-
});
|
|
318
|
-
setActivePercentage(product?.retailers[0]?.percentage);
|
|
319
|
-
}, [percentages]);
|
|
320
|
-
|
|
321
|
-
useEffect(() => {
|
|
322
|
-
if (services.length > 0) {
|
|
323
|
-
if (services[0][activeRetailer.id]?.data)
|
|
324
|
-
services[0][activeRetailer.id].data = Object.values(
|
|
325
|
-
services[0][activeRetailer.id].data
|
|
326
|
-
);
|
|
327
|
-
setActivePercentage(Math.round(activeRetailer?.percentage, 0));
|
|
328
|
-
|
|
329
|
-
const datagroups = services[0][activeRetailer?.id];
|
|
330
|
-
const inputs = services[0]?.inputs;
|
|
331
|
-
const descriptions = services[1]?.filter(
|
|
332
|
-
(service) => service?.id === activeRetailer?.id
|
|
333
|
-
);
|
|
334
|
-
setDatasheets([datagroups, inputs]);
|
|
335
|
-
setDescriptions(descriptions);
|
|
336
|
-
}
|
|
337
|
-
}, [activeRetailer, services]);
|
|
338
|
-
|
|
339
|
-
const thumbs = () => {
|
|
340
|
-
const imageInputs = images?.inputs?.map((e) => ({
|
|
341
|
-
value: e?.id,
|
|
342
|
-
name: e?.name,
|
|
343
|
-
required: e?.required,
|
|
344
|
-
}));
|
|
345
|
-
const imageType = images?.imageType?.map((e) => ({
|
|
346
|
-
value: e?.id,
|
|
347
|
-
name: e?.name,
|
|
348
|
-
}));
|
|
349
|
-
const imagePackagingType = images?.imagePackagingType?.map((e) => ({
|
|
350
|
-
value: e?.id,
|
|
351
|
-
name: e?.name,
|
|
352
|
-
}));
|
|
353
|
-
return images?.values?.map((image, index) => (
|
|
354
|
-
<GalleryElement
|
|
355
|
-
setCheckAll={setCheckAll}
|
|
356
|
-
key={index}
|
|
357
|
-
image={image}
|
|
358
|
-
gridLayout={imageLayout}
|
|
359
|
-
id={"gallery-element-" + index}
|
|
360
|
-
index={index}
|
|
361
|
-
imageType={imageType}
|
|
362
|
-
imagePackagingType={imagePackagingType}
|
|
363
|
-
imageInputs={imageInputs}
|
|
364
|
-
changeImage={setImages}
|
|
365
|
-
selectedImages={selectedImages}
|
|
366
|
-
setSelectedImages={setSelectedImages}
|
|
367
|
-
/>
|
|
368
|
-
));
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
const saveDescriptions = async () => {
|
|
372
|
-
setLoading(true);
|
|
373
|
-
const productTemp = product;
|
|
374
|
-
const dataObject = {
|
|
375
|
-
articleId: product?.article?.id_article,
|
|
376
|
-
articleData: updatedDescriptions,
|
|
377
|
-
};
|
|
378
|
-
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
379
|
-
try {
|
|
380
|
-
await axios.put(
|
|
381
|
-
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
|
|
382
|
-
dataObject,
|
|
383
|
-
{
|
|
384
|
-
headers: {
|
|
385
|
-
Authorization: token,
|
|
386
|
-
},
|
|
387
|
-
}
|
|
388
|
-
);
|
|
389
|
-
if (productTemp.status === "ASSIGNED") {
|
|
390
|
-
productTemp.status = "IN_PROGRESS";
|
|
391
|
-
setProduct(productTemp);
|
|
392
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
setMessage("Descripciones guardadas con éxito");
|
|
396
|
-
loadData();
|
|
397
|
-
} catch (error) {
|
|
398
|
-
console.log(error);
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
const saveDatasheets = async () => {
|
|
403
|
-
setLoading(true);
|
|
404
|
-
const dataObject = {
|
|
405
|
-
articleId: product?.article?.id_article,
|
|
406
|
-
articleData: updatedDatasheets,
|
|
407
|
-
};
|
|
408
|
-
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
409
|
-
try {
|
|
410
|
-
await axios.put(
|
|
411
|
-
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?datasheet=true&version=${version}`,
|
|
412
|
-
dataObject,
|
|
413
|
-
{
|
|
414
|
-
headers: {
|
|
415
|
-
Authorization: token,
|
|
416
|
-
},
|
|
417
|
-
}
|
|
418
|
-
);
|
|
419
|
-
setMessage("Fichas técnicas guardadas");
|
|
420
|
-
if (productTemp.status === "ASSIGNED") {
|
|
421
|
-
productTemp.status = "IN_PROGRESS";
|
|
422
|
-
setProduct(productTemp);
|
|
423
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
424
|
-
}
|
|
425
|
-
loadData();
|
|
426
|
-
} catch (error) {
|
|
427
|
-
console.log(error);
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
const updateImages = useCallback(async () => {
|
|
432
|
-
const imagesList = images?.values?.slice();
|
|
433
|
-
const imagesListTemp = imagesList?.reduce((acc, image) => {
|
|
434
|
-
acc[image?.image_id] = ++acc[image?.image_id] || 0;
|
|
435
|
-
return acc;
|
|
436
|
-
}, {});
|
|
437
|
-
|
|
438
|
-
const duplicated = imagesList?.filter((image) => {
|
|
439
|
-
return imagesListTemp[image?.image_id];
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
const attrForImgs = Object.values(images?.attrForImgs);
|
|
443
|
-
attrForImgs.pop();
|
|
444
|
-
const data = {
|
|
445
|
-
articleId: product?.article?.id_article,
|
|
446
|
-
attrReqImgs: attrForImgs?.map((e) => ({
|
|
447
|
-
attrId: e[0]?.id,
|
|
448
|
-
value: e[0]?.value,
|
|
449
|
-
})),
|
|
450
|
-
articleData: imagesList?.filter((e) => !e.id),
|
|
451
|
-
updateImages: imagesList?.filter((e) => e.id),
|
|
452
|
-
};
|
|
453
|
-
if (product?.orderId) data["orderId"] = product?.orderId;
|
|
454
|
-
let valid =
|
|
455
|
-
data?.articleData?.length === 0
|
|
456
|
-
? true
|
|
457
|
-
: data?.articleData?.every((e, i) => {
|
|
458
|
-
if (e?.image_id && e?.packing_type && e?.image_type) {
|
|
459
|
-
return true;
|
|
460
|
-
}
|
|
461
|
-
return false;
|
|
462
|
-
});
|
|
463
|
-
if (valid && data?.updateImages?.length > 0 && duplicated?.length === 0) {
|
|
464
|
-
valid = data?.updateImages?.every((e, i) => {
|
|
465
|
-
if (e?.image_id && e?.packing_type && e?.image_type) {
|
|
466
|
-
return true;
|
|
467
|
-
}
|
|
468
|
-
return false;
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
if (valid && duplicated?.length === 0) {
|
|
472
|
-
try {
|
|
473
|
-
data?.articleData?.forEach((e) => {
|
|
474
|
-
e.uuid = uuidv4();
|
|
475
|
-
});
|
|
476
|
-
setDataImages(data);
|
|
477
|
-
if (data?.articleData?.length > 0) {
|
|
478
|
-
setImagesUploaded(false);
|
|
479
|
-
const promiseArray = [];
|
|
480
|
-
data?.articleData?.forEach((e) => {
|
|
481
|
-
const file = Buffer.from(
|
|
482
|
-
e.src.replace(/^data:image\/\w+;base64,/, ""),
|
|
483
|
-
"base64"
|
|
484
|
-
);
|
|
485
|
-
const params = {
|
|
486
|
-
ACL: "public-read",
|
|
487
|
-
Body: file,
|
|
488
|
-
Bucket: S3_BUCKET,
|
|
489
|
-
Key: `id-${data.articleId}/${version}/${e?.image_id}-${e?.uuid}.${e?.ext}`,
|
|
490
|
-
};
|
|
491
|
-
promiseArray.push(myBucket.putObject(params).promise());
|
|
492
|
-
});
|
|
493
|
-
await Promise.all(promiseArray);
|
|
494
|
-
setImagesUploaded(true);
|
|
495
|
-
} else {
|
|
496
|
-
setImagesUploaded(true);
|
|
497
|
-
}
|
|
498
|
-
} catch (err) {
|
|
499
|
-
console.log(err);
|
|
500
|
-
// setMainLoading(false);
|
|
501
|
-
}
|
|
502
|
-
} else {
|
|
503
|
-
// setMainLoading(false);
|
|
504
|
-
setMessage(
|
|
505
|
-
"Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.\nRecuerda hay campos obligatorios y no podras avanzar si no estan completos."
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
509
|
-
}, [images, imagesUploaded]);
|
|
510
|
-
|
|
511
|
-
useEffect(async () => {
|
|
512
|
-
if (imagesUploaded) {
|
|
513
|
-
setLoading(true);
|
|
514
|
-
dataImages.articleData = dataImages?.articleData.map((e) => {
|
|
515
|
-
delete e.src;
|
|
516
|
-
e.imageID = e.image_id;
|
|
517
|
-
e.packingType = e.packing_type;
|
|
518
|
-
e.imageType = e.image_type;
|
|
519
|
-
if (product?.orderId) e["orderId"] = product?.orderId;
|
|
520
|
-
return e;
|
|
521
|
-
});
|
|
522
|
-
try {
|
|
523
|
-
await axios.put(
|
|
524
|
-
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
525
|
-
dataImages,
|
|
526
|
-
{
|
|
527
|
-
headers: {
|
|
528
|
-
Authorization: token,
|
|
529
|
-
},
|
|
530
|
-
}
|
|
531
|
-
);
|
|
532
|
-
setMessage("Imágenes guardadas con éxito");
|
|
533
|
-
loadData();
|
|
534
|
-
} catch (error) {
|
|
535
|
-
console.log(error);
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}, [dataImages, imagesUploaded]);
|
|
539
|
-
|
|
540
|
-
const evaluationFinished = (userId, tab, statusArray) => {
|
|
541
|
-
const srv = servicesData.filter((serv) => serv.service === getConcept(tab));
|
|
542
|
-
const [srvActive] = srv.filter(
|
|
543
|
-
(serv) => serv.id_retailer === activeRetailer?.id
|
|
544
|
-
);
|
|
545
|
-
const unvalidated =
|
|
546
|
-
product[`${getConcept(tab)}_status`] === "QF" ||
|
|
547
|
-
product[`${getConcept(tab)}_status`] === "IN_PROGRESS";
|
|
548
|
-
|
|
549
|
-
switch (userId) {
|
|
550
|
-
case 7:
|
|
551
|
-
case 8:
|
|
552
|
-
return (
|
|
553
|
-
(["RA", "RF"].includes(product?.status) &&
|
|
554
|
-
statusArray.includes(srvActive?.status)) ||
|
|
555
|
-
(statusArray.includes(product.status) &&
|
|
556
|
-
srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
557
|
-
srv.length)
|
|
558
|
-
);
|
|
559
|
-
case 4:
|
|
560
|
-
case 5:
|
|
561
|
-
return (
|
|
562
|
-
unvalidated &&
|
|
563
|
-
["IN_PROGRESS", "QF"].includes(product.status) &&
|
|
564
|
-
srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
565
|
-
srv.length
|
|
566
|
-
);
|
|
567
|
-
case 6:
|
|
568
|
-
return (
|
|
569
|
-
statusArray.includes(product.status) &&
|
|
570
|
-
servicesData.every((serv) => ["RA", "AA"].includes(serv.status))
|
|
571
|
-
);
|
|
572
|
-
default:
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
const getConcept = (tab) => {
|
|
578
|
-
switch (tab) {
|
|
579
|
-
case "Descripción":
|
|
580
|
-
return "description";
|
|
581
|
-
case "Ficha técnica":
|
|
582
|
-
return "datasheet";
|
|
583
|
-
case "Imágenes":
|
|
584
|
-
return "images";
|
|
585
|
-
}
|
|
586
|
-
};
|
|
587
|
-
|
|
588
|
-
const approveRejectButtons = (action) => {
|
|
589
|
-
let concept = getConcept(activeTab);
|
|
590
|
-
concept = action ? action : concept;
|
|
591
|
-
|
|
592
|
-
const [retailerStatus] = servicesData.filter(
|
|
593
|
-
(srv) => srv.id_retailer === activeRetailer?.id && srv.service === concept
|
|
594
|
-
);
|
|
595
|
-
|
|
596
|
-
return (
|
|
597
|
-
(retailerStatus?.status === "QF" &&
|
|
598
|
-
(user.id_role === 1 || user.id_role === 4 || user.id_role === 5)) ||
|
|
599
|
-
(retailerStatus?.status === "AF" && //sessionStorage product
|
|
600
|
-
(user.id_role === 1 || user.id_role === 6)) ||
|
|
601
|
-
(retailerStatus?.status === "RP" &&
|
|
602
|
-
(user.id_role === 1 || user.id_role === 6)) ||
|
|
603
|
-
(retailerStatus?.status === "RC" &&
|
|
604
|
-
(user.id_role === 1 || user.id_role === 6))
|
|
605
|
-
);
|
|
606
|
-
};
|
|
607
|
-
|
|
608
|
-
const getSectionIcon = () => {
|
|
609
|
-
switch (activeTab) {
|
|
610
|
-
case "Ficha técnica":
|
|
611
|
-
setIcon(attributesSent);
|
|
612
|
-
break;
|
|
613
|
-
case "Descripción":
|
|
614
|
-
setIcon(descriptionSent);
|
|
615
|
-
break;
|
|
616
|
-
case "Imágenes0,,":
|
|
617
|
-
setIcon(imagesSent);
|
|
618
|
-
break;
|
|
619
|
-
default:
|
|
620
|
-
break;
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
const sendToFacilitator = async (result) => {
|
|
625
|
-
setLoading(true);
|
|
626
|
-
try {
|
|
627
|
-
let concept = getConcept(activeTab);
|
|
628
|
-
|
|
629
|
-
let productTemp = { ...product };
|
|
630
|
-
let evalStatus = product[`${concept}_status`];
|
|
631
|
-
|
|
632
|
-
let data = {};
|
|
633
|
-
if (result) {
|
|
634
|
-
//updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
|
|
635
|
-
data = {
|
|
636
|
-
articleId: product.article.id_article,
|
|
637
|
-
orderId: product.orderId,
|
|
638
|
-
concept: concept,
|
|
639
|
-
result: result,
|
|
640
|
-
evalStatus: evalStatus,
|
|
641
|
-
retailerId: activeRetailer.id,
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
645
|
-
headers: {
|
|
646
|
-
Authorization: token,
|
|
647
|
-
},
|
|
648
|
-
});
|
|
649
|
-
getServices();
|
|
650
|
-
} else {
|
|
651
|
-
const specialistDone =
|
|
652
|
-
evalStatus === "RF" ||
|
|
653
|
-
evalStatus === "RA" ||
|
|
654
|
-
evalStatus === "IN_PROGRESS";
|
|
655
|
-
|
|
656
|
-
if (specialistDone) {
|
|
657
|
-
setMessage(`${activeTab} enviada a facilitador`);
|
|
658
|
-
getSectionIcon();
|
|
659
|
-
} else if (evalStatus === "QF") {
|
|
660
|
-
setMessage("Evaluación enviada");
|
|
661
|
-
getSectionIcon();
|
|
662
|
-
} else if (evalStatus === "AF") {
|
|
663
|
-
setMessage("Evaluación enviada");
|
|
664
|
-
getSectionIcon();
|
|
665
|
-
} else if (evalStatus === "RP") {
|
|
666
|
-
setMessage("Evaluación enviada");
|
|
667
|
-
getSectionIcon();
|
|
668
|
-
} else if (evalStatus === "RC") {
|
|
669
|
-
setMessage("Evaluación enviada");
|
|
670
|
-
getSectionIcon();
|
|
671
|
-
}
|
|
672
|
-
let statusArr = [];
|
|
673
|
-
servicesData.forEach((srv) => {
|
|
674
|
-
srv.service === concept && statusArr.push(srv.status);
|
|
675
|
-
});
|
|
676
|
-
|
|
677
|
-
productTemp[`${concept}_status`] = getNewStatus(statusArr);
|
|
678
|
-
|
|
679
|
-
let newStatus = getNewStatus([
|
|
680
|
-
productTemp.datasheet_status,
|
|
681
|
-
productTemp.description_status,
|
|
682
|
-
productTemp.images_status,
|
|
683
|
-
]);
|
|
684
|
-
|
|
685
|
-
productTemp.status = newStatus;
|
|
686
|
-
|
|
687
|
-
data = {
|
|
688
|
-
articleId: product.article.id_article,
|
|
689
|
-
orderId: product.orderId,
|
|
690
|
-
concept: concept,
|
|
691
|
-
evalStatus: evalStatus,
|
|
692
|
-
retailerId: activeRetailer.id,
|
|
693
|
-
};
|
|
694
|
-
|
|
695
|
-
switch (user.id_role) {
|
|
696
|
-
case 7:
|
|
697
|
-
case 8:
|
|
698
|
-
data.especialist = true;
|
|
699
|
-
break;
|
|
700
|
-
case 4:
|
|
701
|
-
case 5:
|
|
702
|
-
data.facilitator = true;
|
|
703
|
-
break;
|
|
704
|
-
default:
|
|
705
|
-
break;
|
|
706
|
-
}
|
|
707
|
-
await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
708
|
-
headers: {
|
|
709
|
-
Authorization: token,
|
|
710
|
-
},
|
|
711
|
-
});
|
|
712
|
-
getServices();
|
|
713
|
-
}
|
|
714
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
715
|
-
setProduct(productTemp);
|
|
716
|
-
} catch (error) {
|
|
717
|
-
console.log(error);
|
|
718
|
-
}
|
|
719
|
-
setLoading(false);
|
|
720
|
-
};
|
|
721
|
-
|
|
722
|
-
const userAssigned = (tab, rol) => {
|
|
723
|
-
let concept = "";
|
|
724
|
-
switch (tab) {
|
|
725
|
-
case "Ficha técnica":
|
|
726
|
-
concept = "datasheet";
|
|
727
|
-
break;
|
|
728
|
-
case "Imágenes":
|
|
729
|
-
concept = "images";
|
|
730
|
-
break;
|
|
731
|
-
|
|
732
|
-
default:
|
|
733
|
-
concept = "description";
|
|
734
|
-
break;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
const allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
738
|
-
const validUser = allowedRoles.indexOf(user?.id_role) !== -1;
|
|
739
|
-
|
|
740
|
-
if (!rol) {
|
|
741
|
-
switch (user.id_role) {
|
|
742
|
-
case 4:
|
|
743
|
-
case 5:
|
|
744
|
-
rol = "facilitator";
|
|
745
|
-
break;
|
|
746
|
-
case 7:
|
|
747
|
-
case 8:
|
|
748
|
-
rol = "especialist";
|
|
749
|
-
break;
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
return (
|
|
754
|
-
product.article[`id_${concept}_${rol}`] === user.id_user && validUser
|
|
755
|
-
);
|
|
756
|
-
};
|
|
757
|
-
|
|
758
|
-
const auditorAssigned = () => {
|
|
759
|
-
return product?.article[`id_auditor`] === user.id_user;
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
const createComment = async (e, body, tab) => {
|
|
763
|
-
let concept = "";
|
|
764
|
-
switch (activeTab) {
|
|
765
|
-
case "Ficha técnica":
|
|
766
|
-
concept = "datasheet";
|
|
767
|
-
break;
|
|
768
|
-
case "Imágenes":
|
|
769
|
-
concept = "images";
|
|
770
|
-
break;
|
|
771
|
-
|
|
772
|
-
default:
|
|
773
|
-
concept = "description";
|
|
774
|
-
break;
|
|
775
|
-
}
|
|
776
|
-
const data = {
|
|
777
|
-
articleId: product?.article?.id_article,
|
|
778
|
-
orderId: product?.orderId,
|
|
779
|
-
message: body,
|
|
780
|
-
concept: concept,
|
|
781
|
-
version: version,
|
|
782
|
-
};
|
|
783
|
-
await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
784
|
-
headers: {
|
|
785
|
-
Authorization: token,
|
|
786
|
-
},
|
|
787
|
-
});
|
|
788
|
-
await getComments(tab);
|
|
789
|
-
};
|
|
790
|
-
|
|
791
|
-
const getRequired = (services) => {
|
|
792
|
-
const objetcTemp = {};
|
|
793
|
-
const datasheetServicesArray = Object.values(services[0]);
|
|
794
|
-
const dsInputs = datasheetServicesArray.pop();
|
|
795
|
-
const descriptionsServicesArray = services[1];
|
|
796
|
-
|
|
797
|
-
let dsInputsRequired = [];
|
|
798
|
-
let desInputsRequired = 0;
|
|
799
|
-
datasheetServicesArray.forEach((datasheet) => {
|
|
800
|
-
const [requested] = servicesData.filter(
|
|
801
|
-
(srv) =>
|
|
802
|
-
srv.id_retailer === datasheet.retailer.id &&
|
|
803
|
-
srv.service === getConcept(activeTab)
|
|
804
|
-
);
|
|
805
|
-
requested &&
|
|
806
|
-
Object.values(datasheet?.data).forEach((dataGroup) =>
|
|
807
|
-
dsInputsRequired.push(
|
|
808
|
-
...dataGroup.inputs.filter(
|
|
809
|
-
(input) =>
|
|
810
|
-
dsInputs[input].required &&
|
|
811
|
-
(dsInputs[input].value === undefined || !dsInputs[input].value)
|
|
812
|
-
)
|
|
813
|
-
)
|
|
814
|
-
);
|
|
815
|
-
});
|
|
816
|
-
|
|
817
|
-
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
818
|
-
|
|
819
|
-
descriptionsServicesArray.forEach((description) => {
|
|
820
|
-
const [requested] = servicesData.filter(
|
|
821
|
-
(srv) =>
|
|
822
|
-
srv.id_retailer === description.id &&
|
|
823
|
-
srv.service === getConcept(activeTab)
|
|
824
|
-
);
|
|
825
|
-
requested &&
|
|
826
|
-
description.inputs.forEach(
|
|
827
|
-
(input) =>
|
|
828
|
-
input.required &&
|
|
829
|
-
(!input.value ||
|
|
830
|
-
input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") ===
|
|
831
|
-
"") &&
|
|
832
|
-
desInputsRequired++
|
|
833
|
-
);
|
|
834
|
-
});
|
|
835
|
-
|
|
836
|
-
objetcTemp["Descripción"] = desInputsRequired;
|
|
837
|
-
const requiredImages = services[2]?.inputs?.filter((e) => e.required);
|
|
838
|
-
let requiredCounter = 0;
|
|
839
|
-
requiredImages?.forEach(
|
|
840
|
-
(req) =>
|
|
841
|
-
services[2].values.filter((img) => img.image_id === req.id).length ===
|
|
842
|
-
0 && requiredCounter++
|
|
843
|
-
);
|
|
844
|
-
objetcTemp["Imágenes"] = requiredCounter;
|
|
845
|
-
setRequiredNull(objetcTemp);
|
|
846
|
-
};
|
|
847
|
-
|
|
848
|
-
useEffect(() => {
|
|
849
|
-
setComment(comments[activeTab]);
|
|
850
|
-
}, [activeTab]);
|
|
851
|
-
|
|
852
|
-
const commentRevised = async () => {
|
|
853
|
-
const data = {
|
|
854
|
-
commentId: comment.id,
|
|
855
|
-
};
|
|
856
|
-
await axios.put(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
857
|
-
headers: {
|
|
858
|
-
Authorization: sessionStorage.getItem("jwt"),
|
|
859
|
-
},
|
|
860
|
-
});
|
|
861
|
-
setCrossComment(false);
|
|
862
|
-
await getComments();
|
|
863
|
-
};
|
|
864
|
-
|
|
865
|
-
const setAssignation = async (assignationType, assignationId) => {
|
|
866
|
-
let concept = "";
|
|
867
|
-
switch (activeTab) {
|
|
868
|
-
case "Ficha técnica":
|
|
869
|
-
concept = "datasheet";
|
|
870
|
-
break;
|
|
871
|
-
case "Imágenes":
|
|
872
|
-
concept = "images";
|
|
873
|
-
break;
|
|
874
|
-
|
|
875
|
-
default:
|
|
876
|
-
concept = "description";
|
|
877
|
-
break;
|
|
878
|
-
}
|
|
879
|
-
const productTemp = product;
|
|
880
|
-
productTemp.article[`id_${concept}_${assignationType}`] = assignationId;
|
|
881
|
-
const data = {
|
|
882
|
-
articleList: [
|
|
883
|
-
{
|
|
884
|
-
orderId: product.orderId,
|
|
885
|
-
articleId: product?.article?.id_article,
|
|
886
|
-
},
|
|
887
|
-
],
|
|
888
|
-
concept: concept,
|
|
889
|
-
[`${assignationType}Id`]: assignationId,
|
|
890
|
-
};
|
|
891
|
-
axios({
|
|
892
|
-
method: "post",
|
|
893
|
-
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
894
|
-
data: data,
|
|
895
|
-
headers: {
|
|
896
|
-
Authorization: token,
|
|
897
|
-
},
|
|
898
|
-
});
|
|
899
|
-
loadAssignations(productTemp);
|
|
900
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
const evaluationComplete = () => {
|
|
904
|
-
let concept = "";
|
|
905
|
-
switch (activeTab) {
|
|
906
|
-
case "Ficha técnica":
|
|
907
|
-
concept = "datasheet";
|
|
908
|
-
break;
|
|
909
|
-
case "Imágenes":
|
|
910
|
-
concept = "images";
|
|
911
|
-
break;
|
|
912
|
-
case "Descripción":
|
|
913
|
-
concept = "description";
|
|
914
|
-
break;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
let serv = servicesData.filter((item) => item.service === concept);
|
|
918
|
-
let approved = "";
|
|
919
|
-
let rejected = "";
|
|
920
|
-
if (
|
|
921
|
-
product.status === "IN_PROGRESS" ||
|
|
922
|
-
product.status === "QF" ||
|
|
923
|
-
product.status === "RF"
|
|
924
|
-
) {
|
|
925
|
-
approved = "AF";
|
|
926
|
-
rejected = "RF";
|
|
927
|
-
if (product.status === "IN_PROGRESS" || product.status === "QF") {
|
|
928
|
-
return (
|
|
929
|
-
serv.filter(
|
|
930
|
-
(item) =>
|
|
931
|
-
item.status === approved ||
|
|
932
|
-
item.status === rejected ||
|
|
933
|
-
item.status === "AA" ||
|
|
934
|
-
item.status === "IN_PROGRESS" ||
|
|
935
|
-
item.status === "AP"
|
|
936
|
-
).length === serv.length
|
|
937
|
-
);
|
|
938
|
-
}
|
|
939
|
-
} else if (
|
|
940
|
-
product.status === "AF" ||
|
|
941
|
-
product.status === "RA" ||
|
|
942
|
-
product.status === "RP"
|
|
943
|
-
) {
|
|
944
|
-
approved = "AA";
|
|
945
|
-
rejected = "RA";
|
|
946
|
-
|
|
947
|
-
if (product.status === "RP" || product.status === "AF") {
|
|
948
|
-
return (
|
|
949
|
-
serv.filter(
|
|
950
|
-
(item) =>
|
|
951
|
-
item.status === approved ||
|
|
952
|
-
item.status === rejected ||
|
|
953
|
-
item.status === "AP"
|
|
954
|
-
).length === serv.length
|
|
955
|
-
);
|
|
956
|
-
}
|
|
957
|
-
} else if (product.status === "RC") {
|
|
958
|
-
approved = "AP";
|
|
959
|
-
rejected = "RA";
|
|
960
|
-
return (
|
|
961
|
-
serv.filter(
|
|
962
|
-
(item) => item.status === approved || item.status === rejected
|
|
963
|
-
).length === serv.length
|
|
964
|
-
);
|
|
965
|
-
}
|
|
966
|
-
return (
|
|
967
|
-
serv.filter(
|
|
968
|
-
(item) => item.status === approved || item.status === rejected
|
|
969
|
-
).length === serv.length
|
|
970
|
-
);
|
|
971
|
-
};
|
|
972
|
-
|
|
973
|
-
const downloadImages = () => {
|
|
974
|
-
selectedImages.forEach((e) => {
|
|
975
|
-
if (e.id) {
|
|
976
|
-
saveAs(
|
|
977
|
-
`https://${process.env.REACT_APP_IMAGES_BUCKET}.s3.amazonaws.com/${e.srcDB}`,
|
|
978
|
-
`${product.article.upc}_${e.name}.${e.ext}`
|
|
979
|
-
);
|
|
980
|
-
}
|
|
981
|
-
});
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
const deleteImages = () => {
|
|
985
|
-
const data = {
|
|
986
|
-
articleId: product.article.id_article,
|
|
987
|
-
deleteImages: selectedImages,
|
|
988
|
-
};
|
|
989
|
-
try {
|
|
990
|
-
axios.put(
|
|
991
|
-
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
992
|
-
data,
|
|
993
|
-
{
|
|
994
|
-
headers: { Authorization: token },
|
|
995
|
-
}
|
|
996
|
-
);
|
|
997
|
-
loadData();
|
|
998
|
-
} catch (err) {
|
|
999
|
-
console.log(err);
|
|
1000
|
-
}
|
|
1001
|
-
setMessage("");
|
|
1002
|
-
};
|
|
1003
|
-
|
|
1004
|
-
const askToDeleteImages = () => {
|
|
1005
|
-
if (selectedImages.length > 0) {
|
|
1006
|
-
setMessage("¿Está seguro de eliminar las imágenes seleccionadas?");
|
|
1007
|
-
setComponentsArray([
|
|
1008
|
-
<ScreenHeader
|
|
1009
|
-
key={"1"}
|
|
1010
|
-
text={"¿Está seguro de eliminar las imágenes seleccionadas?"}
|
|
1011
|
-
headerType="retailer-name-header"
|
|
1012
|
-
color={"white"}
|
|
1013
|
-
/>,
|
|
1014
|
-
<Button
|
|
1015
|
-
key={"2"}
|
|
1016
|
-
buttonType="general-white-button"
|
|
1017
|
-
label={"Cancelar"}
|
|
1018
|
-
onClick={() => setMessage("")}
|
|
1019
|
-
/>,
|
|
1020
|
-
<Button
|
|
1021
|
-
key={"3"}
|
|
1022
|
-
buttonType="general-button-default"
|
|
1023
|
-
label={"Aceptar"}
|
|
1024
|
-
onClick={() => deleteImages()}
|
|
1025
|
-
/>,
|
|
1026
|
-
]);
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
|
-
const specialistValid = (tab) => {
|
|
1031
|
-
let concept = "";
|
|
1032
|
-
switch (tab) {
|
|
1033
|
-
case "Ficha técnica":
|
|
1034
|
-
concept = "datasheet";
|
|
1035
|
-
break;
|
|
1036
|
-
case "Imágenes":
|
|
1037
|
-
concept = "images";
|
|
1038
|
-
break;
|
|
1039
|
-
case "Descripción":
|
|
1040
|
-
concept = "description";
|
|
1041
|
-
break;
|
|
1042
|
-
}
|
|
1043
|
-
return (
|
|
1044
|
-
product[`${concept}_status`] === "IN_PROGRESS" ||
|
|
1045
|
-
product[`${concept}_status`] === "RF" ||
|
|
1046
|
-
product[`${concept}_status`] === "RA"
|
|
1047
|
-
);
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
|
-
const getRetailerStatus = (servicesData, tab) => {
|
|
1051
|
-
const arr = servicesData?.slice();
|
|
1052
|
-
let concept = getConcept(tab);
|
|
1053
|
-
|
|
1054
|
-
let retailerService = {};
|
|
1055
|
-
[retailerService] = arr?.filter(
|
|
1056
|
-
(service) =>
|
|
1057
|
-
service.id_retailer === activeRetailer?.id &&
|
|
1058
|
-
service.service === concept
|
|
1059
|
-
);
|
|
1060
|
-
return retailerService ? retailerService.status : "NA";
|
|
1061
|
-
};
|
|
1062
|
-
|
|
1063
|
-
useEffect(() => {
|
|
1064
|
-
let status = getRetailerStatus(servicesData, activeTab);
|
|
1065
|
-
setRetailerStatus(status);
|
|
1066
|
-
}, [activeTab, servicesData, activeRetailer]);
|
|
1067
|
-
|
|
1068
|
-
useEffect(() => {
|
|
1069
|
-
services.length > 0 && getRequired(services);
|
|
1070
|
-
}, [services, servicesData, activeTab]);
|
|
40
|
+
}, []);
|
|
1071
41
|
|
|
1072
42
|
return (
|
|
1073
43
|
<Container headerTop={headerTop}>
|
|
@@ -1075,222 +45,62 @@ export const RetailerProductEdition = ({
|
|
|
1075
45
|
<div className="data-container">
|
|
1076
46
|
<div className="image-data-panel">
|
|
1077
47
|
<ImagePreviewer
|
|
1078
|
-
activeImage={
|
|
48
|
+
activeImage={activeImage}
|
|
1079
49
|
imagesArray={images}
|
|
1080
50
|
setActiveImage={setActiveImage}
|
|
1081
51
|
setShowModal={setShowModal}
|
|
1082
52
|
/>
|
|
1083
53
|
<ImageDataTable
|
|
1084
|
-
|
|
1085
|
-
activeImage={
|
|
1086
|
-
retailerSelected={activeRetailer?.id}
|
|
1087
|
-
setImages={setImages}
|
|
1088
|
-
assignationsImages={assig["Imágenes"]}
|
|
1089
|
-
imagesStatus={product?.images_status}
|
|
1090
|
-
setAssignation={setAssignation}
|
|
1091
|
-
isRetailer={isRetailer}
|
|
1092
|
-
onClickSave={() =>
|
|
1093
|
-
product?.services?.images === 1 && updateImages()
|
|
1094
|
-
}
|
|
54
|
+
imageData={activeImage?.data}
|
|
55
|
+
activeImage={activeImage}
|
|
1095
56
|
/>
|
|
1096
57
|
</div>
|
|
1097
58
|
<div className="product-information">
|
|
1098
|
-
<FullProductNameHeader
|
|
1099
|
-
headerData={product}
|
|
1100
|
-
percent={activePercentage}
|
|
1101
|
-
activeRetailer={activeRetailer}
|
|
1102
|
-
setActiveRetailer={setActiveRetailer}
|
|
1103
|
-
approveRejectButtons={approveRejectButtons}
|
|
1104
|
-
sendToFacilitator={sendToFacilitator}
|
|
1105
|
-
auditorAssigned={auditorAssigned}
|
|
1106
|
-
userAssigned={() => userAssigned(activeTab)}
|
|
1107
|
-
/>
|
|
59
|
+
<FullProductNameHeader headerData={productData.headerData} />
|
|
1108
60
|
<FullTabsMenu
|
|
1109
61
|
tabsSections={tabsSections}
|
|
1110
|
-
status={
|
|
1111
|
-
|
|
62
|
+
status={productData.status}
|
|
63
|
+
profileImage={productData.asigned}
|
|
1112
64
|
setActiveTab={setActiveTab}
|
|
1113
65
|
setImageLayout={setImageLayout}
|
|
1114
|
-
downloadImages={downloadImages}
|
|
1115
|
-
askToDeleteImages={askToDeleteImages}
|
|
1116
|
-
assig={assig[activeTab]}
|
|
1117
|
-
setAssignation={setAssignation}
|
|
1118
|
-
isRetailer={isRetailer}
|
|
1119
|
-
onClickSave={() => {
|
|
1120
|
-
switch (activeTab) {
|
|
1121
|
-
case "Descripción":
|
|
1122
|
-
product?.services?.descriptions === 1 && saveDescriptions();
|
|
1123
|
-
break;
|
|
1124
|
-
case "Ficha técnica":
|
|
1125
|
-
product?.services?.datasheets === 1 && saveDatasheets();
|
|
1126
|
-
break;
|
|
1127
|
-
case "Imágenes":
|
|
1128
|
-
product?.services?.images === 1 && updateImages();
|
|
1129
|
-
break;
|
|
1130
|
-
|
|
1131
|
-
default:
|
|
1132
|
-
break;
|
|
1133
|
-
}
|
|
1134
|
-
}}
|
|
1135
66
|
/>
|
|
1136
67
|
<div
|
|
1137
68
|
className={
|
|
1138
69
|
"services-information-container " +
|
|
1139
|
-
(imageLayout && activeTab === "Imágenes"
|
|
70
|
+
(imageLayout && activeTab === "Imágenes" && "image-services")
|
|
1140
71
|
}
|
|
1141
72
|
>
|
|
1142
|
-
{
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
activeTab
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
setSelectedImages={setSelectedImages}
|
|
1151
|
-
checkAll={checkAll}
|
|
1152
|
-
setCheckAll={setCheckAll}
|
|
1153
|
-
/>
|
|
1154
|
-
)}
|
|
1155
|
-
{activeTab === "Ficha técnica" &&
|
|
1156
|
-
(product?.datasheet_status !== "NS" ? (
|
|
1157
|
-
datasheets[0]?.data?.map((dataGroup, index) => (
|
|
1158
|
-
<InputGroup
|
|
1159
|
-
key={index + "-" + activeRetailer.name}
|
|
1160
|
-
articleId={product.article.id_article}
|
|
1161
|
-
version={version}
|
|
1162
|
-
activeSection={activeTab}
|
|
1163
|
-
inputGroup={dataGroup}
|
|
1164
|
-
dataInputs={datasheets[1]}
|
|
1165
|
-
updatedDatasheets={updatedDatasheets}
|
|
1166
|
-
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
1167
|
-
/>
|
|
1168
|
-
))
|
|
1169
|
-
) : (
|
|
1170
|
-
<ScreenHeader
|
|
1171
|
-
text={"No cuentas con este servicio"}
|
|
1172
|
-
headerType={"input-name-header"}
|
|
1173
|
-
/>
|
|
1174
|
-
))}
|
|
1175
|
-
{activeTab === "Descripción" &&
|
|
1176
|
-
(product?.description_status !== "NS" ? (
|
|
1177
|
-
<InputGroup
|
|
1178
|
-
activeSection={activeTab}
|
|
1179
|
-
inputGroup={descriptions[0]}
|
|
1180
|
-
updatedDescriptions={updatedDescriptions}
|
|
1181
|
-
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
1182
|
-
articleId={product?.article?.id_article}
|
|
1183
|
-
version={version}
|
|
1184
|
-
dinamicHeight={true}
|
|
1185
|
-
/>
|
|
1186
|
-
) : (
|
|
1187
|
-
<ScreenHeader
|
|
1188
|
-
text={"No cuentas con este servicio"}
|
|
1189
|
-
headerType={"input-name-header"}
|
|
1190
|
-
/>
|
|
1191
|
-
))}
|
|
1192
|
-
|
|
1193
|
-
{activeTab === "Imágenes" &&
|
|
1194
|
-
(product?.images_status !== "NS" ? (
|
|
1195
|
-
<section className="container">
|
|
1196
|
-
<div {...getRootProps({ className: "dropzone" })}>
|
|
1197
|
-
<input {...getInputProps()} />
|
|
1198
|
-
<aside>{thumbs()}</aside>
|
|
1199
|
-
</div>
|
|
1200
|
-
</section>
|
|
1201
|
-
) : (
|
|
1202
|
-
<ScreenHeader
|
|
1203
|
-
text={"No cuentas con este servicio"}
|
|
1204
|
-
headerType={"input-name-header"}
|
|
1205
|
-
/>
|
|
1206
|
-
))}
|
|
1207
|
-
</>
|
|
1208
|
-
)}
|
|
1209
|
-
</div>
|
|
1210
|
-
{(userAssigned(activeTab) || auditorAssigned()) &&
|
|
1211
|
-
product[`${getConcept(activeTab)}_status`] !== "NS" && (
|
|
1212
|
-
<div className="commentary-box">
|
|
1213
|
-
{!comment ? (
|
|
1214
|
-
<div className="commentary">
|
|
1215
|
-
<TagAndInput
|
|
1216
|
-
label={"Caja de Comentario"}
|
|
1217
|
-
inputType={"textarea"}
|
|
1218
|
-
inputCols={80}
|
|
1219
|
-
inputRows={4}
|
|
1220
|
-
inputId={"commentary-box"}
|
|
1221
|
-
index={0}
|
|
1222
|
-
/>
|
|
1223
|
-
<div className="buttons-box">
|
|
1224
|
-
<Button
|
|
1225
|
-
buttonType={"general-transparent-button"}
|
|
1226
|
-
label={"Enviar comentario"}
|
|
1227
|
-
onClick={(e) =>
|
|
1228
|
-
createComment(
|
|
1229
|
-
e,
|
|
1230
|
-
document.querySelector(
|
|
1231
|
-
"#description-commentary-box-0 .ql-container .ql-editor > p"
|
|
1232
|
-
).innerHTML,
|
|
1233
|
-
activeTab
|
|
1234
|
-
)
|
|
1235
|
-
}
|
|
1236
|
-
/>
|
|
1237
|
-
</div>
|
|
1238
|
-
</div>
|
|
1239
|
-
) : (
|
|
1240
|
-
<div className="feedback-box">
|
|
1241
|
-
<Commentary
|
|
1242
|
-
comment={comment.message}
|
|
1243
|
-
reviewed={crossComment}
|
|
1244
|
-
/>
|
|
1245
|
-
<Button
|
|
1246
|
-
buttonType={"circular-button accept-button"}
|
|
1247
|
-
onClick={async () => {
|
|
1248
|
-
setCrossComment(true);
|
|
1249
|
-
commentRevised();
|
|
1250
|
-
}}
|
|
1251
|
-
/>
|
|
1252
|
-
</div>
|
|
1253
|
-
)}
|
|
1254
|
-
<Button
|
|
1255
|
-
buttonType={
|
|
1256
|
-
evaluationFinished(user.id_role, activeTab, statusArray) &&
|
|
1257
|
-
requiredNull[activeTab] === 0
|
|
1258
|
-
? "general-green-button"
|
|
1259
|
-
: "general-button-disabled"
|
|
1260
|
-
}
|
|
1261
|
-
label={"Enviar evaluación"}
|
|
1262
|
-
onClick={() => sendToFacilitator()}
|
|
73
|
+
{!imageLayout && <GalleryHeader />}
|
|
74
|
+
{activeTab === "Ficha técnica" &&
|
|
75
|
+
datasheets[0]?.data?.map((dataGroup, index) => (
|
|
76
|
+
<InputGroup
|
|
77
|
+
key={index}
|
|
78
|
+
activeSection={activeTab}
|
|
79
|
+
inputGroup={dataGroup}
|
|
80
|
+
dataInputs={datasheets[1]}
|
|
1263
81
|
/>
|
|
1264
|
-
|
|
82
|
+
))}
|
|
83
|
+
{activeTab === "Descripción" && (
|
|
84
|
+
<InputGroup
|
|
85
|
+
activeSection={activeTab}
|
|
86
|
+
inputGroup={descriptions[0]}
|
|
87
|
+
/>
|
|
1265
88
|
)}
|
|
89
|
+
|
|
90
|
+
{activeTab === "Imágenes" &&
|
|
91
|
+
images?.values?.map((image, index) => (
|
|
92
|
+
<GalleryElement
|
|
93
|
+
key={index}
|
|
94
|
+
image={getImage(image, 179, 179)}
|
|
95
|
+
gridLayout={imageLayout}
|
|
96
|
+
id={"gallery-element-" + index}
|
|
97
|
+
/>
|
|
98
|
+
))}
|
|
99
|
+
</div>
|
|
1266
100
|
</div>
|
|
1267
101
|
</div>
|
|
1268
102
|
{showModal && (
|
|
1269
|
-
<ProductImageModal
|
|
1270
|
-
images={images}
|
|
1271
|
-
setShowModal={setShowModal}
|
|
1272
|
-
sendToFacilitator={sendToFacilitator}
|
|
1273
|
-
approveRejectButtons={approveRejectButtons}
|
|
1274
|
-
/>
|
|
1275
|
-
)}
|
|
1276
|
-
{message.length > 0 && (
|
|
1277
|
-
<GenericModal
|
|
1278
|
-
buttonType={componentsArray.length > 0 && "delete-product"}
|
|
1279
|
-
componentsArray={
|
|
1280
|
-
componentsArray.length > 0
|
|
1281
|
-
? componentsArray
|
|
1282
|
-
: [
|
|
1283
|
-
<img key="1" src={succes} alt="success icon" />,
|
|
1284
|
-
<ScreenHeader
|
|
1285
|
-
key="2"
|
|
1286
|
-
headerType={"retailer-name-header"}
|
|
1287
|
-
text={message}
|
|
1288
|
-
color={"white"}
|
|
1289
|
-
/>,
|
|
1290
|
-
]
|
|
1291
|
-
}
|
|
1292
|
-
onClick={() => setMessage("")}
|
|
1293
|
-
/>
|
|
103
|
+
<ProductImageModal images={images} setShowModal={setShowModal} />
|
|
1294
104
|
)}
|
|
1295
105
|
</Container>
|
|
1296
106
|
);
|